@oods/component-styles

中文文档
0.11.3发布于 2026/11/02Apache-2.0TypeScriptESM + CJS

Shared CSS for the OODS Foundry React and Vue components, driven by its design tokens.

原始使用文档
文档目录4 节
  1. Install
  2. First result
  3. Limits
  4. License

@oods/component-styles

Shared CSS for OODS React and Vue components. It supplies component styles and imports @oods/tokens/css; it contains no React or Vue runtime.

Install

npm install @oods/component-styles @oods/tokens

First result

Import the stylesheet once in your application's entry, alongside the component package for your framework:

import '@oods/component-styles/css';
document.documentElement.dataset.brand = 'A';
document.documentElement.dataset.theme = 'light';

Render a component from @oods/components-react or @oods/components-vue to see its styles. Set data-theme to dark or hc for those scopes; high-contrast behaviour also follows the browser's forced-colour settings.

The stylesheet expects OODS component markup and classes. Applying it to an unrelated component library does not make that library implement OODS contracts. A custom brand's generated stylesheet must also be imported when it is not part of this token build.

Limits

Generated apps pin the OODS release that generated them; to upgrade, regenerate the app or move all four pins together. These packages are separate from the local MCP server, @oods/foundry.

License

Apache License 2.0. See LICENSE and NOTICE. Generated output belongs to its user; installed package dependencies retain their own licenses.

版本与发布记录

@oods/component-styles 共发布 25 个版本,首次发布于 2026/09/26;过去 12 个月发布了 25 个版本。

版本发布日期距今
0.11.3latest2026/11/021 天前
0.11.22026/10/1123 天前
0.11.12026/10/1023 天前
0.11.02026/10/0925 天前
0.10.22026/10/0925 天前
0.10.12026/10/0825 天前

关于 @oods/component-styles 的常见问题

@oods/component-styles 是什么?

OODS Foundry React和Vue组件的共享CSS,由其设计令牌驱动。

如何安装 @oods/component-styles?

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

@oods/component-styles 支持 TypeScript 吗?

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

@oods/component-styles 支持 ESM 还是 CommonJS?

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

@oods/component-styles 需要什么版本的 Node.js?

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

@oods/component-styles 可以商用吗?

@oods/component-styles 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@oods/component-styles 还在维护吗?

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