@oods/component-contracts

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

Component contracts for OODS Foundry: each component's identity, props, events, states, token roles and accessibility obligations, with shared formatting helpers.

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

@oods/component-contracts

Framework-independent component contracts and shared formatting helpers for OODS. A contract lists a component's identity, props, slots, events, states, token roles and accessibility obligations. The package contains data and helpers; it does not render a UI.

Install

npm install @oods/component-contracts

First result

Run this in an ES module:

import { componentContracts } from '@oods/component-contracts';
console.log(componentContracts.Button.id); // Button
console.log(componentContracts.Button.events);
console.log(componentContracts.Button.accessibility);

Use the contract when writing a component adapter. The componentCapabilityBaseline export and @oods/component-contracts/registry/capabilities contain the retained capability ledger. Its evidence is scoped to the recorded component scenarios; a declared obligation is not evidence that an arbitrary implementation meets it.

OODS Foundry's mapped-component reports distinguish met, unmet and not-checked obligations. Read their reasons and source identities before using a report as evidence. The package does not certify an application, a third-party library or every possible component state.

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-contracts 共发布 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-contracts 的常见问题

@oods/component-contracts 是什么?

OODS Foundry的组件契约:每个组件的标识、道具、事件、状态、令牌角色和可访问性义务,以及共享的格式化助手。

如何安装 @oods/component-contracts?

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

@oods/component-contracts 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

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