@apliteni/apliteni-ui

中文文档
0.162.0发布于 2026/11/05MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 1.2万

Apliteni shared design system & UI kit — tokens, React components and the deck theme.

原始使用文档
文档目录9 节
  1. Install
  2. Use it
  3. Fonts
  4. Lint app styles
  5. Theme and accent
  6. The rules
  7. Documentation
  8. Contribute
  9. License

@apliteni/apliteni-ui

npm license: MIT live: ui.apli.tech

The Apliteni design system and UI kit provides shared design tokens, React components, themes and UI rules for the strategy deck, the text portal, /account and future product surfaces.

The kit ships tokens, component CSS and React components together. Server-rendered pages that do not use a component framework can still take the CSS, tokens and the inline strings, or write the kit's .ui-* classes by hand. The helpers the root entry publishes — icon, prism, sun, moon, brand, esc, safeUrl and the shared logic — serve both.

Every component is in Storybook at ui.apli.tech.

Install

The package is published on the public npm registry. You do not need scope configuration or an npm token:

npm install @apliteni/apliteni-ui react react-dom

Install React and React DOM yourself, using version 18 or newer. The kit does not declare either package as a regular or peer dependency. npm therefore does not install them or warn when they are missing. If they are missing, importing @apliteni/apliteni-ui/react fails at build time or runtime with a module-not-found error.

The React components are a subpath of this package, not a separate package. You get one install, one version and one version pin.

ImportWhat it is
@apliteni/apliteni-ui/cssTokens and every component stylesheet. Import once at the app root.
@apliteni/apliteni-uiThe helpers and shared logic: icon, prism, sun, moon, brand, esc, safeUrl, motion and the dropdown, chart, pagination and filter helpers.
@apliteni/apliteni-ui/reactThe React components, TypeScript types included.
@apliteni/apliteni-ui/react/cssTheir shell styles.
@apliteni/apliteni-ui/inlineThe same CSS as strings, for a server that inlines it.
@apliteni/apliteni-ui/guidelines/*The UI rules as Markdown.

Use it

import '@apliteni/apliteni-ui/css';
import '@apliteni/apliteni-ui/react/css';
import { AppShell, DataTable, Modal } from '@apliteni/apliteni-ui/react';
import { icon } from '@apliteni/apliteni-ui';

The AppShell component provides the complete product layout: the rail, the page body and a topbar over it when you ask for one, so no product rebuilds it. The component catalog lists it and every other component. Account and personal settings belong in a modal over the product rather than on a page of their own — see Guidelines / Account and settings.

Fonts

The kit defines two font families but does not bundle them, so the host page must load them. Poppins is --font-display, used for headings, brand marks and large readouts. IBM Plex Sans is --font-sans, used for tables, fields, paragraphs, chat and most application text. Both families support weights 300–700.

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

If a family does not load, the browser uses its system fallback stack. The kit does not display a message about this fallback.

Lint app styles

The package ships a stylelint config at @apliteni/apliteni-ui/stylelint. It refuses a raw colour, a raw px, rem or em spacing value, and an override of a .ui-* kit class. Install stylelint, then extend the config:

npm install --save-dev stylelint
{
  "extends": ["@apliteni/apliteni-ui/stylelint"]
}

Use a semantic colour token such as var(--text) and a spacing token such as var(--space-4) from @apliteni/apliteni-ui/tokens. Turn a rule off only with a comment that names the approved exception, after --:

/* stylelint-disable color-no-hex -- an approved brand colour */

Theme and accent

Set the theme on <html> with data-theme="dark|light". You can set an accent separately with data-accent:

<html data-theme="dark" data-accent="phoenix">

An accent changes only the accent family: --accent, --purple*, --glow-purple, --ring and --grad-*. Surfaces, text and signal colours remain unchanged. Green remains the live colour and pink remains the danger colour. As a result, every accent works in both themes without requiring component changes. The shipped accents are Nebula (purple and the default), Phoenix (ember), Ocean (azure) and Emerald (jade).

Both attributes override the defaults. If neither is present, the kit uses dark Nebula. If only data-accent is present, the kit uses that accent with the dark theme. An absent data-theme does not mean “follow the system”: the kit has no prefers-color-scheme rule. If the host wants to follow the operating system preference, its JavaScript must choose the theme and add the attribute. See an absent attribute means dark.

The rules

The Guidelines explain what a page may contain, which component to choose, which states it must support, and how to handle colour and wording. The kit follows these rules. The guidelines ship as Markdown in the package and are also available as a Storybook section.

Documentation

PageWhat it answers
foundations.mdThe tokens and the floors: widths, breakpoints, spacing, type, colour, elevation, the focus ring, the tap floor.
components.mdThe package: what to import, theming, the component catalog, and what each component guarantees.
react/README.mdThe React components and their props.
contributing.mdWorking on the kit: the repository's layout, Storybook, the guidelines collection, the site, the changelog and releases.

Contribute

Use Node 20 or newer. Install jq, then run:

npm ci
npm run storybook
npm test && npm test -w react && npm run build-storybook && node site/build.mjs

Run the final command before opening a PR.

Add a general, composable kit component only when all three conditions are true: the issue names at least two products that use it or have requested it; existing components cannot provide it without copying markup or logic; and it contains no domain-specific data or rules. If any condition is missing, compose the UI from existing components and add a Storybook showcase.

To add a component, put its token-based CSS in src/styles/. Include that CSS in src/index.css and in both the styles map and cssText in src/inline.js. Put the React component in react/src/; each one needs a test and a story that use the shared classes and tokens. Shared logic the React components take from the root entry lives in src/logic/ and is exported from src/index.js. The guidelines define the design rules.

Open an issue, create a branch from main, and link the issue in your PR. If you change a published file, including this README, bump the version in package.json and package-lock.json, and add an entry to site/changelog.mjs. Merging that version bump starts the release workflow. Do not push a tag or publish manually. AGENTS.md describes the review, data-handling and release checks.

License

MIT © Apliteni, for the code. The Apliteni name, logos and brand marks are trademarks and are not covered by the MIT license — see TRADEMARK.md.

版本与发布记录

@apliteni/apliteni-ui 共发布 184 个版本,首次发布于 2026/07/22;过去 12 个月发布了 184 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.162.0latest2026/11/05今天
0.161.02026/11/042 天前
0.160.02026/11/042 天前
0.159.02026/11/042 天前
0.158.22026/11/042 天前
0.158.02026/11/015 天前

关于 @apliteni/apliteni-ui 的常见问题

@apliteni/apliteni-ui 是什么?

Apliteni shared design system & UI kit — tokens, React components and the deck theme.

如何安装 @apliteni/apliteni-ui?

在项目目录运行 npm install @apliteni/apliteni-ui,或使用 pnpm add / yarn add / bun add。

@apliteni/apliteni-ui 支持 TypeScript 吗?

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

@apliteni/apliteni-ui 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@apliteni/apliteni-ui 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@apliteni/apliteni-ui 可以商用吗?

@apliteni/apliteni-ui 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@apliteni/apliteni-ui 的下载量有多少?

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

@apliteni/apliteni-ui 还在维护吗?

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