@a-little-world/little-world-design-system

中文文档
3.3.0发布于 2026/11/06LGPL-3.0-onlyTypeScriptESM + CJS构建来源已验证近 30 天下载 1716

Design system for Little World applications

原始使用文档
文档目录18 节
  1. Installation
  2. Usage
  3. Fonts
  4. Local Development
  5. ⚠️ Important: Build from Root
  6. Quick Start
  7. Development Workflow
  8. Manual Setup
  9. Storybook
  10. Building
  11. Publishing
  12. Automated Releases (Recommended)
  13. Manual Publishing (Fallback)
  14. Dependencies
  15. Gotcha's! Going from web to native...
  16. Contributing
  17. Versioning and Releases
  18. Deprecated Manual Release Process

@a-little-world/little-world-design-system

Web components for the Little World Design System.

This system utilises Radix Primitives to ensure components are accessible and customizable.

Installation

pnpm add @a-little-world/little-world-design-system

Usage

import { Button, Text } from '@a-little-world/little-world-design-system';

export default function App() {
  return (
    <Button variant="primary">
      <Text>Hello World</Text>
    </Button>
  );
}

Fonts

Ensure that you have the required fonts available by including them in your HTML file:

<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
  href="https://fonts.googleapis.com/css2?family=Signika+Negative:wght@300;600;700&family=Work+Sans:wght@700&display=swap"
  rel="stylesheet"
/>

Local Development

⚠️ Important: Build from Root

Always build and publish from the root of the monorepo, never from individual package directories.

✅ Correct (from root):

pnpm build:web
pnpm --filter=@a-little-world/little-world-design-system publish

❌ Incorrect (from package directory):

cd packages/web
pnpm run build
pnpm publish  # This will break workspace dependencies!

Quick Start

From the root of the monorepo:

# Build the web package
pnpm build:web

# Start Storybook for development
pnpm storybook:web

# Build Storybook for production
pnpm storybook:web:build

Development Workflow

  1. Make changes to web components
  2. Build package - pnpm build:web
  3. Test in Storybook - pnpm storybook:web
  4. Preview changes - View components in Storybook at http://localhost:6006

Manual Setup

If you prefer to work directly in the web package directory:

cd packages/web
pnpm install
pnpm run build
pnpm run storybook

Storybook

The web package includes Storybook for component development and testing:

# From root
pnpm storybook:web

# Or from web package directory
cd packages/web
pnpm run storybook

Building

# Build the web package
pnpm build:web

# Or from the web package directory
cd packages/web
pnpm run build

Publishing

Releases should ideally be automated and handled via merging into the main branch of the repo.

See the Versioning and Releases section in the root README for detailed information about the automated release process using Changesets.

The automated workflow will:

  • Detect version changes in package.json
  • Publish to GitHub Packages registry
  • Create GitHub releases with changelog information
  • Handle all publishing steps automatically

Manual Publishing (Fallback)

If you need to publish manually (not recommended):

# Ensure you're authenticated to GitHub Packages
pnpm login --registry=https://npm.pkg.github.com

pnpm build:web
pnpm --filter=@a-little-world/little-world-design-system publish

Note: Manual publishing bypasses the automated changelog generation and release management. Use the automated process whenever possible.

Dependencies

This package depends on:

  • @a-little-world/little-world-design-system-core - Core design tokens and utilities
  • react - React framework
  • styled-components - Styling library
  • @radix-ui/react-* - Radix UI primitives for accessibility

Gotcha's! Going from web to native...

In React Native, when you set minWidth on a component, it doesn't automatically expand beyond that width based on content like it would on the web. The flexbox implementation in React Native is more strict about respecting explicit dimensions.

Recommendation: For most cases:

  • Use flex: 1 when you want a component to fill its parent
  • Use max-width to limit the size
  • Otherwise use an explicit width and manage the content

Contributing

Check contribution guidelines.

Versioning and Releases

This package uses Changesets for version management. See the root README for detailed information about the release process.

Note: The manual release process described below is deprecated. Use Changesets instead.

Deprecated Manual Release Process

In order to release a new version of this package:

  1. Bump the version in the package.json and run pnpm install to update the pnpm-lock.yaml in the relevant release branch.
  2. Ensure your release branch has been tested, approved and merged into main.
  3. Go to the "Draft a release" section of the repo.
  4. Create a tag that relates to the new version.
  5. Include the release version in the title and give an appropriate description
  6. Hit the "publish release" button which will trigger a github action that will publish the new version to npm.

版本与发布记录

@a-little-world/little-world-design-system 共发布 27 个版本,首次发布于 2025/12/31;过去 12 个月发布了 27 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.3.0latest2026/11/063 天前
3.2.12026/10/1922 天前
3.2.02026/10/1624 天前
3.1.22026/08/262 个月前
3.1.12026/08/182 个月前
3.1.02026/08/132 个月前

关于 @a-little-world/little-world-design-system 的常见问题

@a-little-world/little-world-design-system 是什么?

Design system for Little World applications

如何安装 @a-little-world/little-world-design-system?

在项目目录运行 npm install @a-little-world/little-world-design-system,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^19.0.0)、react-dom(^19.0.0)、react-router-dom(^6.28.2)、styled-components(^6.1.18)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@a-little-world/little-world-design-system 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@a-little-world/little-world-design-system 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@a-little-world/little-world-design-system 可以商用吗?

@a-little-world/little-world-design-system 使用 LGPL-3.0-only 许可。弱 Copyleft:作为库被调用时通常不要求开源你自己的代码,但修改库本身需以 LGPL 开源;前端打包合并后的适用边界存在不同理解。以上为概括,不构成法律意见,请以许可原文为准。

@a-little-world/little-world-design-system 的下载量有多少?

根据 npm 官方下载统计,@a-little-world/little-world-design-system 在 2026/10/05 – 2026/11/03 这 30 天内被下载 1,716 次,日均约 57 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@a-little-world/little-world-design-system 还在维护吗?

最新版本 3.3.0 发布于 2026/11/06(3 天前);至今共发布 27 个版本,其中过去 12 个月发布了 27 个;首次发布于 2025/12/31。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。