@xihan-ui/styles 2.1.0 → 3.0.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.
Files changed (152) hide show
  1. package/CHANGELOG.md +1227 -0
  2. package/README.md +6 -1
  3. package/component-tokens.d.ts +505 -96
  4. package/components.tokens.json +34636 -25846
  5. package/css/accordion.css +34 -8
  6. package/css/alert.css +59 -1
  7. package/css/anchor.css +46 -8
  8. package/css/approval.css +116 -76
  9. package/css/avatar-group.css +1 -1
  10. package/css/avatar.css +13 -5
  11. package/css/back-top.css +61 -42
  12. package/css/badge.css +62 -12
  13. package/css/bar-code.css +1 -1
  14. package/css/breadcrumb.css +62 -3
  15. package/css/button-group.css +4 -4
  16. package/css/button.css +67 -19
  17. package/css/calendar-picker.css +19 -0
  18. package/css/calendar-range-picker.css +39 -2
  19. package/css/card.css +115 -1
  20. package/css/carousel.css +148 -43
  21. package/css/cartesian-chart.css +830 -0
  22. package/css/cascader.css +181 -65
  23. package/css/checkbox-group.css +59 -89
  24. package/css/checkbox.css +16 -49
  25. package/css/citation.css +470 -0
  26. package/css/clipboard.css +20 -63
  27. package/css/code-view.css +101 -6
  28. package/css/collapsible.css +34 -8
  29. package/css/color-field.css +18 -0
  30. package/css/color-picker.css +55 -58
  31. package/css/color-slider.css +22 -15
  32. package/css/color-swatch-picker.css +3 -1
  33. package/css/combobox.css +80 -33
  34. package/css/command.css +45 -43
  35. package/css/context-menu.css +39 -22
  36. package/css/date-field.css +23 -0
  37. package/css/date-picker.css +57 -22
  38. package/css/date-range-picker.css +301 -12
  39. package/css/description.css +17 -1
  40. package/css/descriptions.css +42 -0
  41. package/css/dialog.css +94 -36
  42. package/css/diff-view.css +97 -12
  43. package/css/download-trigger.css +44 -78
  44. package/css/drawer.css +160 -119
  45. package/css/editable.css +19 -0
  46. package/css/empty-state.css +7 -6
  47. package/css/field-array.css +36 -0
  48. package/css/field.css +16 -18
  49. package/css/file-upload.css +125 -135
  50. package/css/flex.css +324 -8
  51. package/css/float-button.css +165 -38
  52. package/css/floating-panel.css +53 -19
  53. package/css/form.css +23 -17
  54. package/css/funnel-chart.css +106 -0
  55. package/css/graph-chart.css +205 -0
  56. package/css/grid-list.css +235 -0
  57. package/css/grid.css +252 -1
  58. package/css/heatmap.css +119 -36
  59. package/css/hierarchy-chart.css +298 -0
  60. package/css/hover-card.css +31 -14
  61. package/css/icon.css +100 -0
  62. package/css/image-cropper.css +33 -7
  63. package/css/image-viewer.css +167 -22
  64. package/css/image.css +23 -4
  65. package/css/input-group.css +11 -13
  66. package/css/json-viewer.css +50 -2
  67. package/css/layout.css +68 -18
  68. package/css/liquid.css +106 -0
  69. package/css/list.css +1 -1
  70. package/css/listbox.css +46 -6
  71. package/css/loading-bar.css +27 -13
  72. package/css/log.css +129 -33
  73. package/css/markdown-stream.css +1 -1
  74. package/css/marquee.css +163 -7
  75. package/css/matrix-code.css +1 -1
  76. package/css/mention.css +35 -19
  77. package/css/menu.css +35 -21
  78. package/css/menubar.css +36 -20
  79. package/css/message-feed.css +172 -51
  80. package/css/navigation-menu.css +172 -11
  81. package/css/notification.css +429 -108
  82. package/css/number-field.css +22 -0
  83. package/css/page-header.css +3 -1
  84. package/css/pagination.css +126 -24
  85. package/css/password-input.css +40 -8
  86. package/css/pie-chart.css +247 -0
  87. package/css/popconfirm.css +44 -50
  88. package/css/popover.css +50 -14
  89. package/css/progress.css +308 -10
  90. package/css/prompt-input.css +36 -0
  91. package/css/question-flow.css +97 -57
  92. package/css/radar-chart.css +233 -0
  93. package/css/radio-group.css +363 -5
  94. package/css/rating.css +21 -23
  95. package/css/reasoning.css +61 -54
  96. package/css/resizable.css +6 -1
  97. package/css/sankey-chart.css +174 -0
  98. package/css/scroll-area.css +32 -0
  99. package/css/scrollbar.css +1 -1
  100. package/css/select.css +74 -55
  101. package/css/side-nav.css +173 -24
  102. package/css/signature-pad.css +16 -1
  103. package/css/skeleton.css +13 -14
  104. package/css/slider.css +35 -13
  105. package/css/sortable.css +37 -7
  106. package/css/sparkline.css +164 -0
  107. package/css/spinner.css +50 -22
  108. package/css/splitter.css +7 -1
  109. package/css/statistic.css +10 -0
  110. package/css/steps.css +248 -29
  111. package/css/switch.css +23 -48
  112. package/css/table.css +158 -118
  113. package/css/tabs.css +231 -19
  114. package/css/tag-group.css +27 -3
  115. package/css/tag.css +53 -12
  116. package/css/tags-input.css +40 -3
  117. package/css/text-field.css +19 -0
  118. package/css/time-field.css +20 -1
  119. package/css/time-picker.css +44 -15
  120. package/css/time-range-picker.css +45 -16
  121. package/css/timeline.css +1 -1
  122. package/css/toggle-group.css +4 -4
  123. package/css/toggle.css +4 -3
  124. package/css/tool-call.css +59 -51
  125. package/css/toolbar.css +101 -3
  126. package/css/tooltip.css +15 -2
  127. package/css/tour.css +42 -12
  128. package/css/transfer.css +98 -75
  129. package/css/tree-select.css +232 -53
  130. package/css/tree.css +201 -55
  131. package/css/truncate.css +55 -12
  132. package/css/typography.css +93 -0
  133. package/css/virtualizer.css +56 -0
  134. package/css/watermark.css +23 -0
  135. package/family/action-control.css +14 -5
  136. package/family/chart.css +480 -0
  137. package/family/check-mark.css +94 -0
  138. package/family/choice-card.css +97 -0
  139. package/family/collection-item.css +9 -15
  140. package/family/field-chrome.css +1 -12
  141. package/family/loading-ring.css +95 -0
  142. package/family/material.css +72 -0
  143. package/family/menu-choice.css +56 -0
  144. package/family/motion.css +207 -10
  145. package/family/tag-list.css +59 -0
  146. package/index.css +22997 -13678
  147. package/index.unlayered.css +12928 -3605
  148. package/package.json +20 -8
  149. package/css/gradient-text.css +0 -91
  150. package/css/icon-wrapper.css +0 -81
  151. package/css/segmented.css +0 -280
  152. package/css/toast.css +0 -499
package/family/motion.css CHANGED
@@ -13,17 +13,17 @@
13
13
  * @import 去重,同名同帧体即使重复插入也无副作用。
14
14
  *
15
15
  * 本文件只放跨皮肤共用的关键帧,皮肤内不得重定义这些名字(check-keyframe-refs 判红);
16
- * 组件专属关键帧仍住在各自皮肤。幅度只引 --xh-motion-distance-sm 与 --xh-motion-scale-enter /
17
- * -exit,减弱动效档由令牌层把它们归零。四个方向槽 --xh-_overlay-enter-* 由浮层皮肤按
18
- * placement 写在 positioner 上,四个都没写时位移退回 0。
16
+ * 组件专属关键帧仍住在各自皮肤。幅度只引 --xh-motion-distance-sm / -md 与 --xh-motion-scale-enter /
17
+ * -exit,整幅位移经私有槽取 --xh-motion-travel,减弱动效档由令牌层把它们归零。四个方向槽
18
+ * --xh-_overlay-enter-* 由浮层皮肤按 placement 写在 positioner 上,四个都没写时位移退回 0。
19
19
  */
20
20
  @layer xihan.motion {
21
21
  /* ── 锚定列表 / 菜单:沿落位方向短位移,不缩放文字与选中标记 ──
22
22
  Menu、Select、Combobox、Cascader、ContextMenu、Menubar、Mention、TreeSelect、
23
- Date / Time picker、Tooltip */
23
+ Date / Time picker、ColorPicker、Tooltip */
24
24
  @keyframes xh-overlay-slide-in {
25
25
  from {
26
- opacity: 0;
26
+ opacity: var(--xh-_enter-from-opacity, 0);
27
27
  translate:
28
28
  calc((var(--xh-_overlay-enter-right, 0) - var(--xh-_overlay-enter-left, 0)) * var(--xh-motion-distance-sm))
29
29
  calc((var(--xh-_overlay-enter-down, 0) - var(--xh-_overlay-enter-up, 0)) * var(--xh-motion-distance-sm));
@@ -54,7 +54,7 @@
54
54
  起点朝哪个方向退让由 placement 写进四个方向槽(那一侧写 1),四个都没写就退回原地缩放 */
55
55
  @keyframes xh-overlay-pop-in {
56
56
  from {
57
- opacity: 0;
57
+ opacity: var(--xh-_enter-from-opacity, 0);
58
58
  scale: var(--xh-motion-scale-enter);
59
59
  translate:
60
60
  calc((var(--xh-_overlay-enter-right, 0) - var(--xh-_overlay-enter-left, 0)) * var(--xh-motion-distance-sm))
@@ -82,10 +82,12 @@
82
82
  }
83
83
 
84
84
  /* ── 无锚定弹出:原地缩放淡入,没有方向 ──
85
- NavigationMenu、SideNav popout、FloatingPanel、FloatButton 列表、Pagination 弹层 */
85
+ NavigationMenu、SideNav popout、FloatingPanel、FloatButton 列表、Pagination 弹层;
86
+ 页内浮现的小件也取它:Approval、QuestionFlow 的结果标记,MessageFeed、Log 的回底钮;
87
+ 行内横排的胶囊集合(TagsInput、TagGroup、Select 标签行)加入一枚也取它:竖向上浮与来源方向不符,还会探出字段外壳 */
86
88
  @keyframes xh-pop-in {
87
89
  from {
88
- opacity: 0;
90
+ opacity: var(--xh-_enter-from-opacity, 0);
89
91
  scale: var(--xh-motion-scale-enter);
90
92
  }
91
93
 
@@ -100,7 +102,7 @@
100
102
  Cascader 列项的淡入 */
101
103
  @keyframes xh-fade-in {
102
104
  from {
103
- opacity: 0;
105
+ opacity: var(--xh-_enter-from-opacity, 0);
104
106
  }
105
107
 
106
108
  to {
@@ -121,7 +123,7 @@
121
123
  /* 页内内容的上浮进场:淡入叠一小段向上位移。Command 的分组、EmptyState、QuestionFlow */
122
124
  @keyframes xh-rise-in {
123
125
  from {
124
- opacity: 0;
126
+ opacity: var(--xh-_enter-from-opacity, 0);
125
127
  translate: 0 var(--xh-motion-distance-sm);
126
128
  }
127
129
 
@@ -163,4 +165,199 @@
163
165
  padding-block-end: 0;
164
166
  }
165
167
  }
168
+
169
+ /* ── 列表条目进场:淡入叠一段向上位移,比页内上浮大一档 ──
170
+ Approval、MessageFeed、QuestionFlow、ToolCall 的条目 */
171
+ @keyframes xh-item-in {
172
+ from {
173
+ opacity: var(--xh-_enter-from-opacity, 0);
174
+ translate: 0 var(--xh-motion-distance-md);
175
+ }
176
+
177
+ to {
178
+ opacity: 1;
179
+ translate: 0 0;
180
+ }
181
+ }
182
+
183
+ /* 自上而下的显现:新揭开的内容从上方落位。DiffView 展开的折叠块、Form 的错误汇总 */
184
+ @keyframes xh-drop-in {
185
+ from {
186
+ opacity: var(--xh-_enter-from-opacity, 0);
187
+ translate: 0 calc(-1 * var(--xh-motion-distance-sm));
188
+ }
189
+
190
+ to {
191
+ opacity: 1;
192
+ translate: 0 0;
193
+ }
194
+ }
195
+
196
+ /* ── 面板(sheet):模态与强反馈面,竖向一小段位移叠缩放 ──
197
+ 位移与缩放写独立属性,互不覆盖,手势期间写 translate 也不会把 scale 抹掉。Dialog、Notification */
198
+ @keyframes xh-sheet-in {
199
+ from {
200
+ opacity: var(--xh-_enter-from-opacity, 0);
201
+ translate: 0 var(--xh-motion-distance-md);
202
+ scale: var(--xh-motion-scale-enter);
203
+ }
204
+
205
+ to {
206
+ opacity: 1;
207
+ translate: 0 0;
208
+ scale: 1;
209
+ }
210
+ }
211
+
212
+ @keyframes xh-sheet-out {
213
+ from {
214
+ opacity: 1;
215
+ translate: 0 0;
216
+ scale: 1;
217
+ }
218
+
219
+ to {
220
+ opacity: 0;
221
+ translate: 0 var(--xh-motion-distance-md);
222
+ scale: var(--xh-motion-scale-exit);
223
+ }
224
+ }
225
+
226
+ /* ── 整幅滑入(slide):面板从所在边整条推入推出 ──
227
+ 方向由皮肤在元素上写进 --xh-_slide-from-x / --xh-_slide-from-y(取正负整幅位移令牌或 0),
228
+ 两个都没写时位移退回 0。整幅位移令牌在减弱动效下归零,进出场只剩时长。Drawer */
229
+ @keyframes xh-slide-in {
230
+ from {
231
+ translate: var(--xh-_slide-from-x, 0) var(--xh-_slide-from-y, 0);
232
+ }
233
+
234
+ to {
235
+ translate: 0 0;
236
+ }
237
+ }
238
+
239
+ @keyframes xh-slide-out {
240
+ from {
241
+ translate: 0 0;
242
+ }
243
+
244
+ to {
245
+ translate: var(--xh-_slide-from-x, 0) var(--xh-_slide-from-y, 0);
246
+ }
247
+ }
248
+
249
+ /* 整幅滑入配套的淡变:起止端取 --xh-motion-travel-opacity,缺省为 1 即不淡变,
250
+ 减弱动效下为 0,整幅位移归零后由它接住进出场。与 xh-slide-in / -out 并列播放,
251
+ 时长取淡变档(enter / exit),不随几何时长一起归零。Drawer */
252
+ @keyframes xh-slide-fade-in {
253
+ from {
254
+ opacity: var(--xh-_enter-from-opacity, var(--xh-motion-travel-opacity));
255
+ }
256
+
257
+ to {
258
+ opacity: 1;
259
+ }
260
+ }
261
+
262
+ @keyframes xh-slide-fade-out {
263
+ from {
264
+ opacity: 1;
265
+ }
266
+
267
+ to {
268
+ opacity: var(--xh-motion-travel-opacity);
269
+ }
270
+ }
271
+
272
+ /* ── 循环:匀速转圈与扫过的流光 ──
273
+ 时长取循环令牌,减弱动效下由各皮肤停掉并换成静态替代。
274
+ 转圈写独立的 rotate 属性,与元素自身的 transform 叠加而不互相覆盖。
275
+ 流光的亮带从右扫到左:消费方把渐变画成自身两倍宽(background-size: 200% 100%),
276
+ 只移动背景位置,不动布局也不动 transform。Reasoning、ToolCall 的在跑文字 */
277
+ @keyframes xh-spin {
278
+ to {
279
+ rotate: 1turn;
280
+ }
281
+ }
282
+
283
+ @keyframes xh-shimmer {
284
+ from {
285
+ background-position: 150% center;
286
+ }
287
+
288
+ to {
289
+ background-position: -50% center;
290
+ }
291
+ }
292
+
293
+ /* 呼吸:进行中、给不出进度、需要被察觉的状态点。明暗与缩放一起起伏,峰值落在 42%,
294
+ 周期 --xh-motion-loop-breathe、缓动 --xh-motion-ease-breathe。只动 opacity 与 scale。
295
+ 光环画在状态点的 ::after 上,同周期从点本身的大小外扩淡尽,只播 3 个周期,状态点本身持续到状态结束。
296
+ 减弱动效下两者都停,状态点停在满不透明度。Badge 的 pulse */
297
+ @keyframes xh-breathe {
298
+ 0%,
299
+ 100% {
300
+ opacity: 0.5;
301
+ scale: var(--xh-motion-scale-breathe);
302
+ }
303
+
304
+ 42% {
305
+ opacity: 1;
306
+ scale: 1;
307
+ }
308
+ }
309
+
310
+ @keyframes xh-breathe-halo {
311
+ from {
312
+ opacity: 0.32;
313
+ scale: 1;
314
+ }
315
+
316
+ 60%,
317
+ to {
318
+ opacity: 0;
319
+ scale: var(--xh-motion-scale-halo);
320
+ }
321
+ }
322
+
323
+ /* ── 交互光:一道光沿 1px 描边环扫过一次 ──
324
+ 光带画在三倍宽的背景里、居中,遮罩只留描边环;背景位置从 100% 走到 0%,光带从起始缘外扫到末缘外。
325
+ 只动背景位置,不动几何;只播一遍,不循环 */
326
+ @keyframes xh-glint {
327
+ from {
328
+ background-position: 100% 0;
329
+ }
330
+
331
+ to {
332
+ background-position: 0% 0;
333
+ }
334
+ }
335
+
336
+ /* ── 数值:倒计时条从占满一整条收到零 ──
337
+ 条子自己不改尺寸,靠裁切从行尾往行首收:只重绘、不重排。裁掉哪一侧随书写方向由
338
+ --xh-_countdown-cut-left / -right 给出,缺省按 LTR 收掉右侧;前端的圆角取
339
+ --xh-_countdown-radius。走一遍就到头,时长由连接层写进 Notification 的时长槽。 */
340
+ @keyframes xh-countdown {
341
+ from {
342
+ clip-path: inset(0 0 0 0 round var(--xh-_countdown-radius, 0));
343
+ }
344
+
345
+ to {
346
+ clip-path: inset(0 var(--xh-_countdown-cut-right, 100%) 0 var(--xh-_countdown-cut-left, 0) round var(--xh-_countdown-radius, 0));
347
+ }
348
+ }
349
+
350
+ /* ── 数据:新出现的折线从头描到尾 ──
351
+ 连接层给路径写 pathLength="1" 把长度归一,消费方把虚线设成一整段(stroke-dasharray: 1),
352
+ 虚线偏移从 1 走到 0。只动 stroke-dashoffset,不动几何。时长取 reveal、曲线取 continuous,
353
+ 与柱从基线长出同一档;减弱动效下时长降到 1ms,折线直接在场。CartesianChart */
354
+ @keyframes xh-draw {
355
+ from {
356
+ stroke-dashoffset: 1;
357
+ }
358
+
359
+ to {
360
+ stroke-dashoffset: 0;
361
+ }
362
+ }
166
363
  }
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Copyright (c) 2021-Present XiHanFun and contributors.
3
+ * Licensed under the MIT License. See LICENSE in the project root for license information.
4
+ */
5
+
6
+ /*
7
+ * 标签行家族配方:多选控件把已选值摆成一行标签,Select、Combobox、TreeSelect、Cascader 共用这一份排法。
8
+ *
9
+ * 连接层在标签行上投影 data-xh-tag-list。行里每一枚都是库里的 tag(data-scope="tag"),样子归 tag.css,
10
+ * 这里只管行怎么排、标签怎么进出:
11
+ * - 行是弹性子项,只缩不涨:允许被压缩并把溢出裁掉,标签不冲出字段盒、不把盒尾的钮挤出去;
12
+ * - 行装不下时各枚标签各自缩短,截断落在 tag 自己的 label 上;+N 那一枚(带 data-count)不缩,始终完整可见;
13
+ * - 新选中的标签原地弹出(横排胶囊不用竖向上浮,会探出字段外壳的底边),同一批按到达顺序错开,首帧就在的直接呈现;
14
+ * 取消选中的由列表动效在原处放一个替身淡出,其余标签沿 translate 滑到新位置。
15
+ * 行与标签之间的间距经桥接槽 --xh-tag-list-gap 交给皮肤,皮肤把自己的公开槽接进来。
16
+ *
17
+ * 进退场的关键帧走 motion.css:引入本配方的皮肤同时 @import 它;家族文件之间不互相引入,
18
+ * 全量入口里每份家族只内联一次。
19
+ */
20
+ @layer xihan.components {
21
+ [data-xh-tag-list] {
22
+ /* 取消选中的标签由列表动效在原处放一个绝对定位的替身:行自己作定位容器,替身才裁在行里 */
23
+ position: relative;
24
+ display: inline-flex;
25
+ flex: 0 1 auto;
26
+ align-items: center;
27
+ gap: var(--xh-tag-list-gap, var(--xh-space-1));
28
+ /* 弹性子项默认最小尺寸是内容尺寸,不归零则标签把行撑破、省略号永远轮不到 */
29
+ min-inline-size: 0;
30
+ overflow: hidden;
31
+ }
32
+
33
+ /* 无选中时连接层给 hidden:上面给了 display,UA 的 [hidden]{display:none} 已被盖掉,这里补回来 */
34
+ [data-xh-tag-list][hidden] {
35
+ display: none;
36
+ }
37
+
38
+ [data-xh-tag-list] > [data-scope='tag'][data-part='root'] {
39
+ flex: 0 1 auto;
40
+ min-inline-size: 0;
41
+ /* 选中、取消选中一枚时,其余标签由列表动效先反向补偿、再沿这条滑到新位置 */
42
+ transition: translate var(--xh-motion-duration-move) var(--xh-motion-ease-continuous);
43
+ }
44
+
45
+ /* 新选中的标签原地弹出,同一批按到达顺序错开;首帧就在的直接呈现(列表动效接上之前行带 data-instant)。+N 那一枚不是到达的条目,不播 */
46
+ [data-xh-tag-list]:not([data-instant]) > [data-scope='tag'][data-part='root'][data-value]:not([data-instant], [data-state='closed']) {
47
+ animation: xh-pop-in var(--xh-motion-duration-enter) var(--xh-motion-ease-enter-strong) backwards;
48
+ animation-delay: calc(var(--xh-_stagger-index, 0) * var(--xh-motion-stagger-step));
49
+ }
50
+
51
+ /* 取消选中的标签:替身留在原处淡出,播完即移除 */
52
+ [data-xh-tag-list] > [data-scope='tag'][data-part='root'][data-state='closed'] {
53
+ animation: xh-fade-out var(--xh-motion-duration-exit) var(--xh-motion-ease-exit) forwards;
54
+ }
55
+
56
+ [data-xh-tag-list] > [data-scope='tag'][data-part='root'][data-count] {
57
+ flex: none;
58
+ }
59
+ }