@yuhuanowo/yunui 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@yuhuanowo/yunui.svg)](https://www.npmjs.com/package/@yuhuanowo/yunui)
4
4
 
5
- Yunxin 的设计系统(YUNXIN Design System v3 / Zinc),提取成一个独立、版本化、可被多项目引用的 UI 库 —— 对标 [once-ui.com](https://once-ui.com)。
5
+ 一个独立、版本化、可被多项目引用的 React 19 + Tailwind v4 设计系统 —— 对标 [once-ui.com](https://once-ui.com)。
6
6
 
7
7
  改 YunUI 一处 → 发版 → 各项目升级版本号即可同步获得统一的 **设计 token、动画、组件**。已在 Yunxin 生产环境使用。
8
8
 
@@ -19,7 +19,7 @@ npm i @yuhuanowo/yunui # 或 pnpm add / yarn add
19
19
  > 想让 import 保持短名 `yunui`?用包别名:
20
20
  > ```jsonc
21
21
  > // package.json
22
- > "dependencies": { "yunui": "npm:@yuhuanowo/yunui@^0.1.5" }
22
+ > "dependencies": { "yunui": "npm:@yuhuanowo/yunui@^0.1.8" }
23
23
  > ```
24
24
  > 之后 `import { Button } from "yunui"` 即可,下文示例同理。
25
25
 
@@ -88,7 +88,7 @@ import { useTranslations } from "next-intl";
88
88
  | `@yuhuanowo/yunui/css` | 设计系统样式(token 变量、`@theme` 映射、`.btn`/`.card`/`.glass` 等全局类、动画 keyframes) |
89
89
  | `@yuhuanowo/yunui/adapters` | `YunUIProvider` / `useYunUI` 与适配器接口 |
90
90
  | `@yuhuanowo/yunui/patterns` | 页面级组件:FAQ、StatCard(`tone`/`inline`/`valueFirst` 变体)、BlogCard、CodeBlock、Sidebar、BackgroundEffects 等 |
91
- | `@yuhuanowo/yunui/ai` | Yunxin AI 产品域(prop 驱动,无 API 直连):ProviderIcon / ModelIcon / ModelTypeIcon、ModelCard、CapabilitySelector、Navbar、Footer、LanguageSwitcher、ThinkingBlock、IDBadge … |
91
+ | `@yuhuanowo/yunui/ai` | AI 产品域组件(prop 驱动,无 API 直连):ProviderIcon / ModelIcon / ModelTypeIcon、ModelCard、CapabilitySelector、Navbar、Footer、LanguageSwitcher、ThinkingBlock、IDBadge … |
92
92
 
93
93
  **工具 / hooks**(从 `@yuhuanowo/yunui` 导出):`cn`、`toast` / `Toaster`(基于 sonner)、`MotionDiv` / `MotionSpan` / `fadeIn` / `staggerContainer` / `staggerItem`、`useEscapeKey` / `useBodyScrollLock` / `useModalBehavior`。
94
94
 
@@ -106,7 +106,7 @@ import { useTranslations } from "next-intl";
106
106
 
107
107
  ```bash
108
108
  # 在 YunUI:改代码 → 升 package.json 版本号 → 提交
109
- git tag v0.1.6 && git push origin v0.1.6
109
+ git tag v0.1.8 && git push origin v0.1.8
110
110
  # ↑ 推 tag 触发 GitHub Actions:typecheck → test → build → npm publish
111
111
  # (tokenless OIDC trusted publishing + provenance,无需本地发布/OTP)
112
112
 
@@ -129,6 +129,23 @@ pnpm typecheck
129
129
 
130
130
  展示站在 `site/`(Next 16 + Tailwind v4):`pnpm --filter yunui-site dev`。
131
131
 
132
+ ## 贡献 / 加新组件
133
+
134
+ 完整规范见 **[CONTRIBUTING.md](./CONTRIBUTING.md)**。最容易踩的一条:**组件不内置文案 / 不绑定 i18n 库**。需要显示文字的组件必须走 adapter,不要 import next-intl,也不要硬写字符串:
135
+
136
+ ```tsx
137
+ import { useYunUI } from "../adapters/context";
138
+
139
+ export function Thing() {
140
+ const t = useYunUI().useT("thing"); // 命名空间
141
+ return <button>{t("submit")}</button>; // key,不是字面量
142
+ }
143
+ ```
144
+
145
+ - 不注入 provider 时 `useT` 直接返回 key(组件照样渲染,展示站也是这样跑的)。
146
+ - 真正的翻译文案加到**消费方**(如 Yunxin `messages/{en,zh-CN,zh-TW}.json`),不放 YunUI。
147
+ - 同理:路由/图片走 `useYunUI().Link/Image/useRouter`(别用 `next/*`);业务数据走 **props**(别在组件里 `useBranding`/`fetch`/`localStorage`)。
148
+
132
149
  ## License
133
150
 
134
- MIT © yuhuanowo
151
+ Apache-2.0 © YuhuanStudio