@xihan-ui/cli 0.0.0-stage → 4.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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +58 -2
- package/bin/xihan-ui.mjs +4 -0
- package/data/changelog.md +669 -0
- package/data/components.json +1 -0
- package/data/demos.json +1 -0
- package/data/design.md +251 -0
- package/data/meta.json +4 -0
- package/data/pages.json +1 -0
- package/data/tokens.json +1 -0
- package/dist/index.d.ts +213 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1540 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -3
- package/skills/xihan-ui/SKILL.md +48 -0
package/data/design.md
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
---
|
|
2
|
+
version: alpha
|
|
3
|
+
name: XiHan.UI
|
|
4
|
+
description: 'XiHan.UI 4.2.0 缺省主题(浅色 · 舒适密度 · 基础对比度)的设计语言:中性克制、描边分界、4px 网格、令牌驱动。'
|
|
5
|
+
colors:
|
|
6
|
+
primary: 'oklch(0.546 0.216 258)'
|
|
7
|
+
primary-hover: 'oklch(0.488 0.196 258)'
|
|
8
|
+
primary-active: 'oklch(0.424 0.164 258)'
|
|
9
|
+
on-primary: 'oklch(1 0 0)'
|
|
10
|
+
primary-subtle: 'color-mix(in oklab, oklch(0.546 0.216 258) 12%, oklch(1 0 0))'
|
|
11
|
+
on-primary-subtle: 'color-mix(in oklab, oklch(0.546 0.216 258) 60%, oklch(0.208 0.006 258))'
|
|
12
|
+
page: 'oklch(0.964 0.004 265)'
|
|
13
|
+
surface: 'oklch(1 0 0)'
|
|
14
|
+
surface-raised: 'oklch(1 0 0)'
|
|
15
|
+
field: 'color-mix(in oklab, color-mix(in oklab, oklch(0 0 0) 4.7%, transparent) 55%, transparent)'
|
|
16
|
+
subtle: 'color-mix(in oklab, oklch(0 0 0) 4.7%, transparent)'
|
|
17
|
+
subtle-hover: 'color-mix(in oklab, oklch(0 0 0) 10.2%, transparent)'
|
|
18
|
+
subtle-active: 'color-mix(in oklab, oklch(0 0 0) 16.9%, transparent)'
|
|
19
|
+
on-surface: 'oklch(0.208 0.006 258)'
|
|
20
|
+
on-surface-muted: 'oklch(0.461 0.018 258)'
|
|
21
|
+
on-surface-subtle: 'oklch(0.52 0.018 256)'
|
|
22
|
+
disabled: 'oklch(0.7 0.016 258)'
|
|
23
|
+
outline: 'color-mix(in oklab, oklch(0 0 0) 10.2%, transparent)'
|
|
24
|
+
outline-subtle: 'color-mix(in oklab, oklch(0 0 0) 4.7%, transparent)'
|
|
25
|
+
outline-strong: 'color-mix(in oklab, oklch(0 0 0) 16.9%, transparent)'
|
|
26
|
+
outline-control-hover: 'color-mix(in oklab, oklch(0 0 0) 37.9%, transparent)'
|
|
27
|
+
focus-ring: 'oklch(0.546 0.216 258)'
|
|
28
|
+
success: 'oklch(0.51 0.15 149)'
|
|
29
|
+
warning: 'oklch(0.62 0.15 70)'
|
|
30
|
+
info: 'oklch(0.53 0.15 237)'
|
|
31
|
+
danger: 'oklch(0.577 0.213 25)'
|
|
32
|
+
scrim: 'color-mix(in oklab, oklch(0.208 0.006 258) 60%, transparent)'
|
|
33
|
+
typography:
|
|
34
|
+
display:
|
|
35
|
+
fontFamily: '-apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif'
|
|
36
|
+
fontSize: '1.75rem'
|
|
37
|
+
lineHeight: 1.25
|
|
38
|
+
heading-1:
|
|
39
|
+
fontFamily: '-apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif'
|
|
40
|
+
fontSize: '1.5rem'
|
|
41
|
+
fontWeight: 500
|
|
42
|
+
lineHeight: 1.25
|
|
43
|
+
heading-2:
|
|
44
|
+
fontFamily: '-apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif'
|
|
45
|
+
fontSize: '1.25rem'
|
|
46
|
+
fontWeight: 500
|
|
47
|
+
lineHeight: 1.25
|
|
48
|
+
heading-3:
|
|
49
|
+
fontFamily: '-apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif'
|
|
50
|
+
fontSize: '1rem'
|
|
51
|
+
fontWeight: 500
|
|
52
|
+
lineHeight: 1.25
|
|
53
|
+
body:
|
|
54
|
+
fontFamily: '-apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif'
|
|
55
|
+
fontSize: '0.875rem'
|
|
56
|
+
fontWeight: 400
|
|
57
|
+
lineHeight: 1.5
|
|
58
|
+
label:
|
|
59
|
+
fontFamily: '-apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif'
|
|
60
|
+
fontSize: '0.875rem'
|
|
61
|
+
fontWeight: 400
|
|
62
|
+
lineHeight: 1.5
|
|
63
|
+
secondary:
|
|
64
|
+
fontFamily: '-apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif'
|
|
65
|
+
fontSize: '0.8125rem'
|
|
66
|
+
fontWeight: 400
|
|
67
|
+
lineHeight: 1.5
|
|
68
|
+
caption:
|
|
69
|
+
fontFamily: '-apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif'
|
|
70
|
+
fontSize: '0.75rem'
|
|
71
|
+
fontWeight: 400
|
|
72
|
+
lineHeight: 1.5
|
|
73
|
+
code:
|
|
74
|
+
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'
|
|
75
|
+
fontSize: '0.8125rem'
|
|
76
|
+
lineHeight: '1.5rem'
|
|
77
|
+
rounded:
|
|
78
|
+
none: '0px'
|
|
79
|
+
sm: '2px'
|
|
80
|
+
md: '4px'
|
|
81
|
+
lg: '8px'
|
|
82
|
+
xl: '16px'
|
|
83
|
+
full: '9999px'
|
|
84
|
+
control: '2px'
|
|
85
|
+
surface: '4px'
|
|
86
|
+
overlay: '4px'
|
|
87
|
+
spacing:
|
|
88
|
+
unit: '4px'
|
|
89
|
+
xs: '4px'
|
|
90
|
+
sm: '8px'
|
|
91
|
+
md: '12px'
|
|
92
|
+
lg: '16px'
|
|
93
|
+
xl: '24px'
|
|
94
|
+
2xl: '32px'
|
|
95
|
+
control-sm: '28px'
|
|
96
|
+
control-md: '32px'
|
|
97
|
+
control-lg: '36px'
|
|
98
|
+
hit-coarse: '44px'
|
|
99
|
+
components:
|
|
100
|
+
button-primary:
|
|
101
|
+
backgroundColor: '{colors.primary}'
|
|
102
|
+
textColor: '{colors.on-primary}'
|
|
103
|
+
typography: '{typography.label}'
|
|
104
|
+
rounded: '{rounded.control}'
|
|
105
|
+
height: '{spacing.control-md}'
|
|
106
|
+
padding: '0 16px'
|
|
107
|
+
button-primary-hover:
|
|
108
|
+
backgroundColor: '{colors.primary-hover}'
|
|
109
|
+
button-primary-active:
|
|
110
|
+
backgroundColor: '{colors.primary-active}'
|
|
111
|
+
button-ghost:
|
|
112
|
+
backgroundColor: 'transparent'
|
|
113
|
+
textColor: '{colors.on-surface}'
|
|
114
|
+
typography: '{typography.label}'
|
|
115
|
+
rounded: '{rounded.control}'
|
|
116
|
+
height: '{spacing.control-md}'
|
|
117
|
+
padding: '0 16px'
|
|
118
|
+
button-ghost-hover:
|
|
119
|
+
backgroundColor: '{colors.subtle}'
|
|
120
|
+
button-ghost-active:
|
|
121
|
+
backgroundColor: '{colors.subtle-hover}'
|
|
122
|
+
input:
|
|
123
|
+
backgroundColor: '{colors.field}'
|
|
124
|
+
textColor: '{colors.on-surface}'
|
|
125
|
+
typography: '{typography.body}'
|
|
126
|
+
rounded: '{rounded.control}'
|
|
127
|
+
height: '{spacing.control-md}'
|
|
128
|
+
padding: '0 12px'
|
|
129
|
+
width: '16rem'
|
|
130
|
+
input-focus:
|
|
131
|
+
backgroundColor: '{colors.surface}'
|
|
132
|
+
card:
|
|
133
|
+
backgroundColor: '{colors.surface}'
|
|
134
|
+
textColor: '{colors.on-surface}'
|
|
135
|
+
rounded: '{rounded.surface}'
|
|
136
|
+
padding: '20px 16px'
|
|
137
|
+
menu:
|
|
138
|
+
backgroundColor: '{colors.surface}'
|
|
139
|
+
textColor: '{colors.on-surface}'
|
|
140
|
+
typography: '{typography.body}'
|
|
141
|
+
rounded: '{rounded.overlay}'
|
|
142
|
+
menu-item-hover:
|
|
143
|
+
backgroundColor: '{colors.subtle}'
|
|
144
|
+
list-item-selected:
|
|
145
|
+
backgroundColor: '{colors.primary-subtle}'
|
|
146
|
+
textColor: '{colors.on-primary-subtle}'
|
|
147
|
+
dialog:
|
|
148
|
+
backgroundColor: '{colors.surface}'
|
|
149
|
+
textColor: '{colors.on-surface}'
|
|
150
|
+
rounded: '{rounded.overlay}'
|
|
151
|
+
tooltip:
|
|
152
|
+
backgroundColor: '{colors.on-surface}'
|
|
153
|
+
textColor: '{colors.surface}'
|
|
154
|
+
typography: '{typography.secondary}'
|
|
155
|
+
rounded: '{rounded.control}'
|
|
156
|
+
badge:
|
|
157
|
+
backgroundColor: '{colors.danger}'
|
|
158
|
+
textColor: '{colors.on-primary}'
|
|
159
|
+
typography: '{typography.caption}'
|
|
160
|
+
rounded: '{rounded.full}'
|
|
161
|
+
---
|
|
162
|
+
## Overview
|
|
163
|
+
|
|
164
|
+
XiHan.UI 是框架无关的设计系统运行时:组件行为住在 Headless 层,Vue、React 与 Web Components 三端消费同一份纯 CSS 皮肤,所以三端外观一致。视觉取向是**中性、克制、任务导向**:页面主体保持中性,只有主按钮缺省使用品牌实心,品牌淡底专门表达「选中 / 当前」;层级先靠描边、间距与字重区分,阴影只表达真实的抬升。
|
|
165
|
+
|
|
166
|
+
所有尺度都是令牌:颜色、间距、圆角、描边、阴影与动效不写散值,皮肤里的每个数字都能回溯到一支 `--xh-*` 令牌。本文件取值是缺省档;深色、紧凑、高对比、减弱动效、减少透明度、强制色与打印是同一份皮肤的不同切面,组件身份(形状、结构)在各切面下不变。
|
|
167
|
+
|
|
168
|
+
完整规范:https://ui.docs.xihanfun.com/design/
|
|
169
|
+
|
|
170
|
+
## Colors
|
|
171
|
+
|
|
172
|
+
颜色用 OKLCH 表达,明度感知均匀:同一档跨色相同一明度,换色相不必重算对比度。颜色分三层——基础色板(primitive)、语义角色(`--xh-bg-*` / `--xh-fg-*` / `--xh-border-*` / `--xh-ring-*`)与组件覆盖槽(`--xh-<组件>-*`);界面只消费语义角色,不直接取色板。
|
|
173
|
+
|
|
174
|
+
- 品牌色是从种子派生的 11 档梯度,600 档是锚点:实心底取 600,悬停 700,按下 800;品牌淡底按比例混入承载面。
|
|
175
|
+
- 页面底(page)是冷灰,内容面(surface)是白;淡底与三档边线不取灰色板,而是墨色按比例透明(淡底 4.7% / 10.2% / 16.9%)。
|
|
176
|
+
- 状态色(success / warning / info / danger)表达任务结果,不表达空间层级;错误、警告、选择与加载不能只靠颜色,必须同时有图标、文案或形状。
|
|
177
|
+
- 正文与背景对比至少 4.5:1,大字与图形至少 3:1;焦点环颜色不随语气变化。
|
|
178
|
+
|
|
179
|
+
## Typography
|
|
180
|
+
|
|
181
|
+
组件不指定正文字族,控件与面板继承宿主页面的字体;库只定等宽字族、字号阶梯、字重、行高与排版角色。中后台建议系统字栈,数字密集处开启 `font-variant-numeric: tabular-nums`。
|
|
182
|
+
|
|
183
|
+
- 字号以 rem 记:正文、标签与 md 档控件 0.875rem,说明与 sm 档控件 0.8125rem,次级标注 0.75rem;标题三级 1rem / 1.25rem / 1.5rem,字重 500。
|
|
184
|
+
- 层级由字号、字重、行高与间距共同表达,不只调颜色;密度切换不缩字号。
|
|
185
|
+
- 代码、密钥、哈希与快捷键用等宽字族 `--xh-font-family-mono`。
|
|
186
|
+
|
|
187
|
+
## Layout
|
|
188
|
+
|
|
189
|
+
只有一把尺:4px 网格。间距阶梯 4px / 8px / 12px / 16px / 24px / 32px,2 / 6 / 10px 只用于图标基线与几何补偿;信息关系越紧密间距越小,不同信息组之间至少升一档。
|
|
190
|
+
|
|
191
|
+
- 控件高 sm / md / lg = 28px / 32px / 36px(紧凑密度各降 4px),md 是缺省;同一 size 不随断点改变。
|
|
192
|
+
- 尺寸档同时换行内内衬(8px / 12px / 16px)、间隙、字号与图标;按钮这类文字动作控件的行内内衬再宽一档。
|
|
193
|
+
- 字段缺省宽 16rem、压缩底线 12rem,放进表单字段即铺满。
|
|
194
|
+
- 粗指针下命中区至少 44px,用伪元素外扩,不改布局盒。
|
|
195
|
+
- 面的内衬只走 `--xh-surface-*`,页面分段走 `--xh-section-py-*`,列隙走 `--xh-layout-gap-*`。
|
|
196
|
+
|
|
197
|
+
## Elevation & Depth
|
|
198
|
+
|
|
199
|
+
阴影只表达「离页面多远」,不表达边界——边界归描边。只有四个海拔角色:
|
|
200
|
+
|
|
201
|
+
- raised:贴在页面上略抬起的面(Card、开关拇指),缺省无影,边界全靠描边。
|
|
202
|
+
- lifted:正被指针拖动的东西,`0 4px 10px oklch(0 0 0 / 0.1)`。
|
|
203
|
+
- floating:含网格或多列的锚定面板(日期面板、多列级联),`0 4px 10px oklch(0 0 0 / 0.1)`。
|
|
204
|
+
- sheet:模态与强反馈面(Dialog、Drawer、Command、Notification),`0 4px 12px oklch(0 0 0 / 0.15)`。
|
|
205
|
+
|
|
206
|
+
锚定瞬态浮层(菜单、气泡)是实体白底 + 1px 描边 + 一层柔和投影,不采样背后内容;没有玻璃拟态材质。
|
|
207
|
+
|
|
208
|
+
## Shapes
|
|
209
|
+
|
|
210
|
+
圆角只有一条语义阶梯:控件本体(Button、Input、Select、Tag 方签、Alert 提示条)2px,成面的静态容器(Card、Panel、列表容器)4px,脱离文档流的浮层(Popover、Menu、Dialog)4px。
|
|
211
|
+
|
|
212
|
+
- pill 只给两类身份:状态 chip(Badge)与一维对象(轨道、进度条、指示条、滚动条滑块);普通按钮、字段、卡片与浮层不用 pill。
|
|
213
|
+
- 宽高相等的圆(头像、单选圈、拇指、圆形图标钮)取 circle,不用 pill 冒充。
|
|
214
|
+
- 内层圆角不超过外层圆角减去内边距;相连控件(输入组、按钮组)消除相接侧圆角;锚定浮层里的列表行是通栏行,不取圆角。
|
|
215
|
+
- 描边只有 1px / 2px / 3px 三档:一切描边与分隔线用细档,焦点环与选中指示条用粗档。
|
|
216
|
+
|
|
217
|
+
## Components
|
|
218
|
+
|
|
219
|
+
组件先归族再画样式,同族同类部件逐条同值:
|
|
220
|
+
|
|
221
|
+
- **Action Control**(Button、Toggle、图标按钮、分页按钮、各类 trigger):只有 Button 缺省品牌实心,其余缺省中性;按下 120ms 换到 active 底、释放 200ms 回到 rest,缺省只换面不缩放。
|
|
222
|
+
- **Field Chrome**(Input、Select trigger、日期与时间字段、Combobox):静息是淡底 `--xh-bg-field` + 控件描边、无影;聚焦换承载面底 + 品牌描边,不画聚焦环;校验失败换 danger 描边与淡底。
|
|
223
|
+
- **Collection Item**(菜单项、列表项、树节点、表格行):悬停在白底上取 hover 100 档、按下 200 档;选中按语境只有一种标记——浮层集合是行尾对号,页内集合是品牌淡底,导航是指示条或品牌字色。
|
|
224
|
+
- **Surface**(Card、Alert、Panel):边界三选一——描边(缺省)、淡底、无壳;Card 的抬起影是加成,描边必须在。
|
|
225
|
+
- **Overlay**(Popover、Menu、Tooltip、Dialog、Drawer):浮层圆角 overlay,模态取 sheet 海拔并带遮罩;有进场就有退场。
|
|
226
|
+
- **Feedback**(Notification、Progress、Skeleton):状态语气配图标与文案,进行中给可感知的进度。
|
|
227
|
+
|
|
228
|
+
公共视觉轴只有 `size`(sm / md / lg)、`variant`(outline / subtle / ghost,可按下的面多一档 solid)与 `tone`(brand / neutral / danger / warning / success / info),没有私有的 bordered、primary 之类开关。
|
|
229
|
+
|
|
230
|
+
## Do's and Don'ts
|
|
231
|
+
|
|
232
|
+
- Do:颜色、间距、圆角、阴影与动效只取 `--xh-*` 令牌;缺令牌时先加语义令牌,不写散值。
|
|
233
|
+
- Don't:写 5px、6px、10px 这类独立圆角或 5 / 7 / 9 / 13px 这类散值间距。
|
|
234
|
+
- Do:用描边划分边界,阴影只表达抬升。
|
|
235
|
+
- Don't:用阴影或大面积色块代替描边做分区,也不要做玻璃拟态的半透明面。
|
|
236
|
+
- Do:主要动作用 Button 缺省的品牌实心,次要动作用中性的 outline / subtle / ghost 形态。
|
|
237
|
+
- Don't:把品牌淡底用于「今天」「已完成」「展开中」这类非选中语义。
|
|
238
|
+
- Do:错误、警告与选中同时给图标、文案或形状通道;禁用同时调整前景或背景并关闭交互。
|
|
239
|
+
- Don't:只靠颜色区分状态,或只把禁用项降低透明度。
|
|
240
|
+
- Do:中后台页面保持紧凑、清晰、任务导向,列表与表单优先信息密度。
|
|
241
|
+
- Don't:在控制台页面放营销式大标题、装饰性 Hero 区或大面积插画。
|
|
242
|
+
|
|
243
|
+
## Customization
|
|
244
|
+
|
|
245
|
+
1. 品牌色:用 `registerBrand` 从一个种子色派生整条 11 档品牌梯度,明度曲线不变,对比度保证随之成立。
|
|
246
|
+
2. 视觉环境:`createVisualEnvironmentController` 把明暗、密度、对比度、动效、透明度等偏好写到根元素的 `data-*` 属性上,皮肤随之切换。
|
|
247
|
+
3. 全局令牌:在 `:root` 或任意子树上直接改写同名 `--xh-*` 语义令牌,作用域内的组件随之变化。
|
|
248
|
+
4. 组件覆盖槽:改写 `--xh-<组件>-*` 只影响该组件,缺省值回落到语义令牌。
|
|
249
|
+
5. 覆盖样式写进 `@layer xihan.overrides`,按 `[data-scope][data-part]` 部件选择器书写,不依赖类名。
|
|
250
|
+
|
|
251
|
+
主题设计器:https://ui.docs.xihanfun.com/design/theme-designer
|
package/data/meta.json
ADDED