@flood-md/tokens

中文文档
0.2.14发布于 2026/11/15MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 3284

Flood semantic design tokens and light/dark themes.

原始使用文档

@flood-md/tokens

Typed reference values and semantic CSS roles for Flood 0.2.14. Keep Flood package versions aligned. Existing 0.1.1 installs use their earlier token contract.

React consumers import @flood-md/react/styles.css and use FloodRoot. Token-only consumers import @flood-md/tokens/foundations.css and set both attributes on the same scope element: data-flood-foundations="neutral" data-flood-theme="dark". Only the neutral/dark foundations profile is supplied.

The 0.2.11 candidate adds base/filled contextual neutral recipes. Absolute material colors remain separate from inherited action, field, selection and supporting-element roles. React material owners establish the appropriate context; token-only hosts must apply their own scoped role mapping. See the foundations guide's material-context section and the generated manifest before overriding an elevated control recipe. Alpha fills need review over the actual backdrop; they do not establish accessibility by themselves.

Exports include ./foundations (typed tokenNames lookup), ./foundations.css, ./foundations.manifest.json and ./neutral.dark.tokens.json. Values are authored only in src/tokens.json. Generated artifacts must not be edited.

Roles cover surfaces/content, primary/subtle/contextual actions, fields, selection/feedback/focus, Inter typography, relative spacing/radii, control/icon sizes, motion and local layer order. Override public semantic --flood-sys-* roles on their scope; repeat both attributes for nested scopes. See the foundations guide for supported types and limits.

The React package bundles Inter and its OFL license. Token-only consumers provide their own font setup. Version 0.2.3 maps the quiet field.border role to the container-outline tone. field.boundary remains a stronger opt-in; the quiet default does not establish 3:1 non-text contrast. Evaluate actual recognition and accessibility for the host composition.

Legacy ./tokens.css and JSON retain the earlier shared/light/dark contract and --flood-* names. Legacy controls outside FloodRoot remain compatible; legacy overrides do not automatically change separately scoped foundations roles.

Version 0.2.3 adds scrollbar size/inset/min-thumb roles and semantic thumb/hover colors, expanding the profile to 168 roles. Install matching package versions.

Version 0.2.5 adds twenty-five semantic roles, bringing the dark profile to 193 roles. Existing role values remain unchanged:

  • sys.color.accent.content and sys.color.loading.placeholder separate accent text and loading fills from focus and action states.

  • sys.color.indicator.track/fill/accent and sys.size.indicator.sm/md/lg control bounded indicators without borrowing control or focus roles.

  • sys.color.action.danger.content styles destructive actions independently from validation messages and keyboard focus.

  • sys.size.keycap.sm/md/lg provide independent relative heights for keyboard hints.

  • sys.size.container.sm/md/lg and sys.size.grid.min-item supply relative layout bounds.

Version 0.2.5 separates floating surfaces from modal surfaces. The floating material uses nine of those new semantic roles; previous token values remain intact. surface.floating is the opaque fallback; surface.floating-translucent, border.floating, selection.floating, shadow.floating and effect.floating blur/saturation/shadow-offset/shadow-blur define the floating material. Select, Combobox, MultiSelect, Menu, Popover and Tooltip share it; Dialog and Drawer retain surface.overlay. Backdrop filtering is progressive enhancement; reduced transparency uses the opaque fill and forced colors use system colors. Keep text opaque and evaluate it against the actual composited background.

Version 0.2.11 adds field-label, group-title and dialog-title type roles. They separate form hierarchy without changing generic body/label roles or the host root font. Runtime values are compiled only from src/tokens.json.

版本与发布记录

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

版本发布日期距今
0.2.14latest2026/11/15今天
0.2.132026/11/141 天前
0.2.122026/11/132 天前
0.2.112026/11/115 天前
0.2.102026/10/3115 天前
0.2.92026/10/3017 天前

关于 @flood-md/tokens 的常见问题

@flood-md/tokens 是什么?

Flood semantic design tokens and light/dark themes.

如何安装 @flood-md/tokens?

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

@flood-md/tokens 支持 TypeScript 吗?

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

@flood-md/tokens 支持 ESM 还是 CommonJS?

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

@flood-md/tokens 可以商用吗?

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

@flood-md/tokens 的下载量有多少?

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

@flood-md/tokens 还在维护吗?

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