@xihan-ui/styles 3.1.0 → 4.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 (290) hide show
  1. package/CHANGELOG.md +470 -0
  2. package/component-tokens.d.ts +230 -60
  3. package/components.tokens.json +5156 -1557
  4. package/css/accordion.css +47 -20
  5. package/css/alert.css +16 -17
  6. package/css/anchor.css +2 -2
  7. package/css/approval.css +41 -17
  8. package/css/avatar-group.css +9 -12
  9. package/css/avatar.css +20 -18
  10. package/css/back-top.css +21 -7
  11. package/css/badge.css +5 -5
  12. package/css/breadcrumb.css +18 -16
  13. package/css/button-group.css +4 -6
  14. package/css/button.css +13 -12
  15. package/css/calendar-picker.css +178 -95
  16. package/css/calendar-range-picker.css +207 -122
  17. package/css/card.css +34 -6
  18. package/css/carousel.css +94 -46
  19. package/css/cartesian-chart.css +11 -11
  20. package/css/cascader.css +51 -39
  21. package/css/checkbox-group.css +9 -6
  22. package/css/checkbox.css +5 -4
  23. package/css/citation.css +9 -4
  24. package/css/clipboard.css +20 -4
  25. package/css/code-view.css +6 -6
  26. package/css/collapsible.css +29 -14
  27. package/css/color-field.css +4 -4
  28. package/css/color-picker.css +77 -23
  29. package/css/color-slider.css +10 -8
  30. package/css/color-swatch-picker.css +14 -9
  31. package/css/combobox.css +26 -14
  32. package/css/command.css +14 -9
  33. package/css/context-menu.css +10 -5
  34. package/css/date-field.css +12 -6
  35. package/css/date-picker.css +178 -109
  36. package/css/date-range-picker.css +199 -130
  37. package/css/description.css +10 -6
  38. package/css/descriptions.css +47 -19
  39. package/css/dialog.css +50 -35
  40. package/css/diff-view.css +8 -8
  41. package/css/drawer.css +75 -21
  42. package/css/editable.css +15 -41
  43. package/css/empty-state.css +21 -3
  44. package/css/field-array.css +5 -2
  45. package/css/field.css +17 -18
  46. package/css/fieldset.css +33 -13
  47. package/css/file-upload.css +66 -33
  48. package/css/float-button.css +60 -35
  49. package/css/floating-panel.css +1 -1
  50. package/css/form.css +30 -16
  51. package/css/graph-chart.css +2 -2
  52. package/css/grid-list.css +1 -1
  53. package/css/highlight.css +5 -5
  54. package/css/hover-card.css +19 -12
  55. package/css/image-viewer.css +77 -27
  56. package/css/image.css +13 -5
  57. package/css/infinite-scroll.css +8 -4
  58. package/css/input-group.css +74 -26
  59. package/css/kbd.css +1 -1
  60. package/css/label.css +27 -11
  61. package/css/layout.css +17 -10
  62. package/css/list.css +13 -9
  63. package/css/listbox.css +12 -7
  64. package/css/loading-bar.css +3 -0
  65. package/css/mention.css +11 -9
  66. package/css/menu.css +10 -5
  67. package/css/menubar.css +13 -8
  68. package/css/message-feed.css +1 -1
  69. package/css/navigation-menu.css +2 -2
  70. package/css/notification.css +132 -49
  71. package/css/number-animation.css +2 -2
  72. package/css/number-field.css +75 -52
  73. package/css/page-header.css +64 -27
  74. package/css/pagination.css +35 -38
  75. package/css/password-input.css +12 -68
  76. package/css/pin-input.css +18 -26
  77. package/css/popconfirm.css +23 -14
  78. package/css/popover.css +18 -12
  79. package/css/progress.css +14 -13
  80. package/css/prompt-input.css +3 -3
  81. package/css/question-flow.css +41 -15
  82. package/css/radar-chart.css +6 -6
  83. package/css/radio-group.css +120 -55
  84. package/css/rating.css +32 -15
  85. package/css/select.css +16 -12
  86. package/css/separator.css +24 -6
  87. package/css/side-nav.css +29 -24
  88. package/css/signature-pad.css +23 -9
  89. package/css/skeleton.css +12 -12
  90. package/css/slider.css +77 -48
  91. package/css/sortable.css +2 -2
  92. package/css/sparkline.css +8 -2
  93. package/css/spinner.css +40 -20
  94. package/css/statistic.css +14 -14
  95. package/css/steps.css +115 -84
  96. package/css/switch.css +9 -7
  97. package/css/table.css +29 -12
  98. package/css/tabs.css +35 -12
  99. package/css/tag-group.css +17 -6
  100. package/css/tag.css +54 -29
  101. package/css/tags-input.css +39 -20
  102. package/css/text-field.css +5 -5
  103. package/css/time-field.css +4 -4
  104. package/css/time-picker.css +150 -64
  105. package/css/time-range-picker.css +91 -62
  106. package/css/timeline.css +37 -20
  107. package/css/timer.css +3 -3
  108. package/css/toggle-group.css +4 -4
  109. package/css/tool-call.css +13 -11
  110. package/css/toolbar.css +6 -5
  111. package/css/tooltip.css +16 -17
  112. package/css/tour.css +14 -7
  113. package/css/transfer.css +22 -16
  114. package/css/tree-select.css +12 -12
  115. package/css/tree.css +26 -25
  116. package/css/typography.css +28 -25
  117. package/dist/css/accordion.css +296 -0
  118. package/dist/css/affix.css +47 -0
  119. package/dist/css/alert.css +246 -0
  120. package/dist/css/anchor.css +252 -0
  121. package/dist/css/approval.css +525 -0
  122. package/dist/css/avatar-group.css +96 -0
  123. package/dist/css/avatar.css +100 -0
  124. package/dist/css/back-top.css +175 -0
  125. package/dist/css/badge.css +205 -0
  126. package/dist/css/bar-code.css +62 -0
  127. package/dist/css/breadcrumb.css +232 -0
  128. package/dist/css/button-group.css +261 -0
  129. package/dist/css/button.css +216 -0
  130. package/dist/css/calendar-picker.css +550 -0
  131. package/dist/css/calendar-range-picker.css +639 -0
  132. package/dist/css/card.css +249 -0
  133. package/dist/css/carousel.css +726 -0
  134. package/dist/css/cartesian-chart.css +830 -0
  135. package/dist/css/cascader.css +973 -0
  136. package/dist/css/checkbox-group.css +361 -0
  137. package/dist/css/checkbox.css +258 -0
  138. package/dist/css/citation.css +475 -0
  139. package/dist/css/clipboard.css +331 -0
  140. package/dist/css/code-view.css +374 -0
  141. package/dist/css/collapsible.css +200 -0
  142. package/dist/css/color-field.css +176 -0
  143. package/dist/css/color-picker.css +649 -0
  144. package/dist/css/color-slider.css +283 -0
  145. package/dist/css/color-swatch-picker.css +250 -0
  146. package/dist/css/color-swatch.css +35 -0
  147. package/dist/css/combobox.css +578 -0
  148. package/dist/css/command.css +404 -0
  149. package/dist/css/context-menu.css +425 -0
  150. package/dist/css/date-field.css +317 -0
  151. package/dist/css/date-picker.css +931 -0
  152. package/dist/css/date-range-picker.css +949 -0
  153. package/dist/css/description.css +71 -0
  154. package/dist/css/descriptions.css +327 -0
  155. package/dist/css/dialog.css +470 -0
  156. package/dist/css/diff-view.css +513 -0
  157. package/dist/css/download-trigger.css +151 -0
  158. package/dist/css/drawer.css +606 -0
  159. package/dist/css/editable.css +269 -0
  160. package/dist/css/empty-state.css +181 -0
  161. package/dist/css/field-array.css +229 -0
  162. package/dist/css/field.css +165 -0
  163. package/dist/css/fieldset.css +122 -0
  164. package/dist/css/file-upload.css +462 -0
  165. package/dist/css/flex.css +441 -0
  166. package/dist/css/float-button.css +579 -0
  167. package/dist/css/floating-panel.css +429 -0
  168. package/dist/css/focus.css +46 -0
  169. package/dist/css/forced-colors.css +93 -0
  170. package/dist/css/form.css +407 -0
  171. package/dist/css/funnel-chart.css +106 -0
  172. package/dist/css/graph-chart.css +205 -0
  173. package/dist/css/grid-list.css +235 -0
  174. package/dist/css/grid.css +1201 -0
  175. package/dist/css/heatmap.css +552 -0
  176. package/dist/css/hierarchy-chart.css +298 -0
  177. package/dist/css/highlight.css +41 -0
  178. package/dist/css/hover-card.css +233 -0
  179. package/dist/css/icon.css +225 -0
  180. package/dist/css/image-cropper.css +373 -0
  181. package/dist/css/image-viewer.css +588 -0
  182. package/dist/css/image.css +106 -0
  183. package/dist/css/infinite-scroll.css +81 -0
  184. package/dist/css/input-group.css +323 -0
  185. package/dist/css/json-viewer.css +379 -0
  186. package/dist/css/kbd.css +72 -0
  187. package/dist/css/label.css +94 -0
  188. package/dist/css/layers.css +7 -0
  189. package/dist/css/layout.css +379 -0
  190. package/dist/css/liquid.css +106 -0
  191. package/dist/css/list.css +156 -0
  192. package/dist/css/listbox.css +395 -0
  193. package/dist/css/loading-bar.css +144 -0
  194. package/dist/css/log.css +306 -0
  195. package/dist/css/markdown-stream.css +149 -0
  196. package/dist/css/marquee.css +378 -0
  197. package/dist/css/masonry.css +70 -0
  198. package/dist/css/matrix-code.css +67 -0
  199. package/dist/css/mention.css +395 -0
  200. package/dist/css/menu.css +369 -0
  201. package/dist/css/menubar.css +461 -0
  202. package/dist/css/message-feed.css +318 -0
  203. package/dist/css/navigation-menu.css +513 -0
  204. package/dist/css/notification.css +865 -0
  205. package/dist/css/number-animation.css +44 -0
  206. package/dist/css/number-field.css +275 -0
  207. package/dist/css/overlay-arrow.css +56 -0
  208. package/dist/css/page-header.css +221 -0
  209. package/dist/css/pagination.css +447 -0
  210. package/dist/css/password-input.css +335 -0
  211. package/dist/css/pie-chart.css +247 -0
  212. package/dist/css/pin-input.css +191 -0
  213. package/dist/css/pointer.css +36 -0
  214. package/dist/css/popconfirm.css +329 -0
  215. package/dist/css/popover.css +285 -0
  216. package/dist/css/progress.css +502 -0
  217. package/dist/css/prompt-input.css +260 -0
  218. package/dist/css/question-flow.css +579 -0
  219. package/dist/css/radar-chart.css +233 -0
  220. package/dist/css/radio-group.css +663 -0
  221. package/dist/css/rating.css +311 -0
  222. package/dist/css/reasoning.css +343 -0
  223. package/dist/css/reset.css +117 -0
  224. package/dist/css/resizable.css +242 -0
  225. package/dist/css/sankey-chart.css +174 -0
  226. package/dist/css/scroll-area.css +240 -0
  227. package/dist/css/scrollbar.css +204 -0
  228. package/dist/css/select.css +616 -0
  229. package/dist/css/separator.css +140 -0
  230. package/dist/css/side-nav.css +481 -0
  231. package/dist/css/signature-pad.css +193 -0
  232. package/dist/css/skeleton.css +161 -0
  233. package/dist/css/slider.css +403 -0
  234. package/dist/css/sortable.css +228 -0
  235. package/dist/css/sparkline.css +170 -0
  236. package/dist/css/spinner.css +256 -0
  237. package/dist/css/splitter.css +159 -0
  238. package/dist/css/statistic.css +137 -0
  239. package/dist/css/steps.css +658 -0
  240. package/dist/css/switch.css +353 -0
  241. package/dist/css/table.css +1162 -0
  242. package/dist/css/tabs.css +967 -0
  243. package/dist/css/tag-group.css +258 -0
  244. package/dist/css/tag.css +335 -0
  245. package/dist/css/tags-input.css +341 -0
  246. package/dist/css/text-field.css +197 -0
  247. package/dist/css/time-field.css +277 -0
  248. package/dist/css/time-picker.css +793 -0
  249. package/dist/css/time-range-picker.css +775 -0
  250. package/dist/css/timeline.css +440 -0
  251. package/dist/css/timer.css +123 -0
  252. package/dist/css/timestamp.css +34 -0
  253. package/dist/css/toggle-group.css +424 -0
  254. package/dist/css/toggle.css +146 -0
  255. package/dist/css/tone.css +189 -0
  256. package/dist/css/tool-call.css +431 -0
  257. package/dist/css/toolbar.css +366 -0
  258. package/dist/css/tooltip.css +217 -0
  259. package/dist/css/tour.css +446 -0
  260. package/dist/css/transfer.css +644 -0
  261. package/dist/css/tree-select.css +878 -0
  262. package/dist/css/tree.css +734 -0
  263. package/dist/css/truncate.css +108 -0
  264. package/dist/css/typography.css +475 -0
  265. package/dist/css/undefined.css +58 -0
  266. package/dist/css/virtualizer.css +166 -0
  267. package/dist/css/visually-hidden.css +20 -0
  268. package/dist/css/watermark.css +82 -0
  269. package/dist/family/action-control.css +493 -0
  270. package/dist/family/chart.css +537 -0
  271. package/dist/family/check-mark.css +94 -0
  272. package/dist/family/choice-card.css +97 -0
  273. package/dist/family/collection-item.css +768 -0
  274. package/dist/family/field-chrome.css +296 -0
  275. package/dist/family/loading-ring.css +102 -0
  276. package/dist/family/material.css +72 -0
  277. package/dist/family/menu-choice.css +56 -0
  278. package/dist/family/motion.css +363 -0
  279. package/dist/family/swatch.css +59 -0
  280. package/dist/family/tag-list.css +65 -0
  281. package/family/action-control.css +33 -36
  282. package/family/chart.css +57 -0
  283. package/family/collection-item.css +12 -8
  284. package/family/field-chrome.css +28 -19
  285. package/family/loading-ring.css +20 -13
  286. package/family/swatch.css +4 -4
  287. package/family/tag-list.css +6 -0
  288. package/index.css +10349 -8756
  289. package/index.unlayered.css +10350 -8758
  290. package/package.json +165 -164
@@ -0,0 +1,246 @@
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
+ /* 定义 alert 样式。 */
7
+
8
+ /* Alert 独立皮肤同时传递引入关闭钮的动作控件配方;full bundle 递归去重。 */
9
+ @import '../family/action-control.css';
10
+ /* 淡出的关键帧由 family/motion.css 提供,本皮肤 @import 它,单独引入仍成立。 */
11
+ @import '../family/motion.css';
12
+
13
+ @layer xihan.motion {
14
+ /* 关闭时收起占位:从连接层量下的整块高度收到 0,内缩与描边一起收掉 */
15
+ @keyframes xh-alert-collapse {
16
+ from {
17
+ block-size: var(--xh-_alert-exit-block-size);
18
+ }
19
+
20
+ to {
21
+ block-size: 0;
22
+ padding-block: 0;
23
+ border-block-width: 0;
24
+ }
25
+ }
26
+ }
27
+
28
+ @layer xihan.components {
29
+ /* 皮肤在场的标记:开发模式下按 scope 探一次,取不到就说明这份皮肤没被引入。 */
30
+ .xh-scope-alert {
31
+ --xh-alert-skin: 1;
32
+ }
33
+
34
+ /* 提示本体是一块语气淡底面(淡底形态:透明边位 + 语气 12% 淡底、无影),语气由底色与图标表达;
35
+ 标题与正文仍取正文色,彩色只落在底与图标上,不让整段文字变色抢走层级。 */
36
+ .xh-scope-alert[data-part='root'] {
37
+ /* 作者塞进指示符槽的图标与皮肤画的兜底字形同一把尺:Feedback 指示符统一 md 档 */
38
+ --xh-icon-size: var(--xh-alert-icon-size, var(--xh-glyph-size-md));
39
+
40
+ display: flex;
41
+ align-items: flex-start;
42
+ /* 指示符盒自带 --xh-space-1 内衬:与间距合起来,字形到正文 12px,与 Notification 同一个距离 */
43
+ gap: var(--xh-alert-gap, var(--xh-space-2));
44
+ padding-block: var(--xh-alert-py, var(--xh-space-2));
45
+ padding-inline: var(--xh-alert-px, var(--xh-surface-px-sm));
46
+ border: var(--xh-stroke-thin) solid var(--xh-alert-border, transparent);
47
+ border-radius: var(--xh-alert-radius, var(--xh-shape-control));
48
+ background: var(--xh-alert-bg, var(--xh-_tone-subtle, var(--xh-bg-subtle)));
49
+ box-shadow: var(--xh-alert-shadow, none);
50
+ color: var(--xh-alert-fg, var(--xh-fg-default));
51
+ font-size: var(--xh-alert-font-size, var(--xh-text-body-size));
52
+ line-height: var(--xh-alert-leading, var(--xh-leading-normal));
53
+ }
54
+
55
+ /* 横幅:页面顶部的通栏,贴着页面或容器的边铺满整行。面本身就是语气淡底,不另画边;贴边铺满的栏不取圆角:
56
+ 圆了会在两个角露出底下的页面。面与语气规则与页内提示相同,横幅不换底色 */
57
+ .xh-scope-alert[data-part='root'][data-banner] {
58
+ inline-size: 100%;
59
+ border-block-start-width: 0;
60
+ border-inline-width: 0;
61
+ border-radius: 0;
62
+ }
63
+
64
+ /* 关闭的退场:先淡出,再把占位收起——下面的内容跟着一路平移上来,而不是整块跳上来。
65
+ 收占位接在淡出之后(延迟一个 exit),播完连接层才写 hidden。收起态常挂 hidden,这条只在退场途中命中;
66
+ 减弱动效下收占位瞬时完成,淡出照常 */
67
+ .xh-scope-alert[data-part='root'][data-state='closed'] {
68
+ box-sizing: border-box;
69
+ overflow: hidden;
70
+ animation:
71
+ xh-fade-out var(--xh-motion-duration-exit) var(--xh-motion-ease-exit) forwards,
72
+ xh-alert-collapse var(--xh-motion-duration-collapse) var(--xh-motion-ease-exit) var(--xh-motion-duration-exit) forwards;
73
+ }
74
+
75
+ /* 收起态连接层给的是 hidden 属性,而上面声明了 display——
76
+ 漏掉这条,关掉的提示还会一直摊在页面上 */
77
+ .xh-scope-alert[data-part='root'][hidden] {
78
+ display: none;
79
+ }
80
+
81
+ .xh-scope-alert[data-part='indicator'] {
82
+ display: inline-flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ flex: none;
86
+ padding: var(--xh-alert-indicator-p, var(--xh-space-1));
87
+ color: var(--xh-alert-indicator-fg, var(--xh-_tone-fg));
88
+ }
89
+
90
+ /* 必需的文本列:标题与说明在这里排成一列。 */
91
+ .xh-scope-alert[data-part='content'] {
92
+ display: flex;
93
+ /* 伸缩基准取 0 而不是 auto:取 auto 时基准是这一列的 max-content——
94
+ 一段长说明就能把基准撑到比整行还宽,root 那条换行随即把图标、文本列、叉拆成三行 */
95
+ flex: 1 1 0;
96
+ flex-direction: column;
97
+ gap: var(--xh-alert-content-gap, var(--xh-space-1));
98
+ min-inline-size: 0;
99
+ }
100
+
101
+ /* 列里的两段文字不再参与 root 那一行的伸缩:宽度由列自己给 */
102
+ .xh-scope-alert[data-part='content'] [data-part='title']:where(.xh-scope-alert),
103
+ .xh-scope-alert[data-part='content'] [data-part='description']:where(.xh-scope-alert) {
104
+ flex: none;
105
+ }
106
+
107
+ /* 操作与关闭入口都留在尾端,不把说明挤到下一行。 */
108
+ .xh-scope-alert[data-part='action'] {
109
+ display: flex;
110
+ flex: none;
111
+ align-items: center;
112
+ align-self: center;
113
+ gap: var(--xh-alert-action-gap, var(--xh-space-2));
114
+ margin-inline-start: auto;
115
+ }
116
+
117
+ /* 标题与说明摞成一列,占满 root 剩下的横向空间,
118
+ 关闭按钮才推得到行尾 */
119
+ .xh-scope-alert[data-part='title'],
120
+ .xh-scope-alert[data-part='description'] {
121
+ margin: 0;
122
+ min-inline-size: 0;
123
+ }
124
+
125
+ .xh-scope-alert[data-part='title'] {
126
+ flex: none;
127
+ color: var(--xh-alert-title-fg, var(--xh-fg-default));
128
+ font-size: var(--xh-alert-title-font-size, var(--xh-text-heading-3-size));
129
+ font-weight: var(--xh-alert-title-font-weight, var(--xh-text-heading-3-weight));
130
+ line-height: var(--xh-alert-title-leading, var(--xh-leading-tight));
131
+ }
132
+
133
+ .xh-scope-alert[data-part='description'] {
134
+ flex: none;
135
+ color: var(--xh-alert-description-fg, var(--xh-fg-muted));
136
+ font-size: var(--xh-alert-description-font-size, var(--xh-text-secondary-size));
137
+ }
138
+
139
+ /* 没写标题时说明自己占满这一行,否则它会挤在标题旁边 */
140
+ .xh-scope-alert[data-part='title']:empty {
141
+ display: none;
142
+ }
143
+
144
+ /* 关闭钮是只有字形的离散动作钮:盒几何、悬停 / 按下与按压、粗指针热区、焦点环、禁用面全由
145
+ Action Control 的 icon ghost 档给(连接层投 sm:与此前 --xh-control-h-sm 同尺寸),组件只映射既有使用者槽。
146
+ 静息透明;提示本体是语气淡底(12%),叉的悬停 / 按下沿语气淡底再升一档、两档(20% / 28%)。
147
+ closable=false 时连接层同时给 hidden 与 disabled / data-disabled,家族按后者收掉反馈 */
148
+ .xh-scope-alert[data-part='close-trigger'] {
149
+ --xh-action-visual-size: var(--xh-alert-close-size, var(--xh-_action-profile-visual-size));
150
+ --xh-action-min-inline-size: var(--xh-alert-close-size, var(--xh-_action-profile-visual-size));
151
+ --xh-action-radius: var(--xh-alert-close-radius, var(--xh-shape-control));
152
+ --xh-action-bg-hover: var(--xh-alert-close-bg-hover, var(--xh-_tone-subtle-hover, var(--xh-_action-variant-bg-hover)));
153
+ --xh-action-bg-pressed: var(--xh-alert-close-bg-active, var(--xh-_tone-subtle-active, var(--xh-_action-variant-bg-pressed)));
154
+ --xh-action-fg-rest: var(--xh-alert-close-fg, var(--xh-fg-muted));
155
+ --xh-action-fg-hover: var(--xh-alert-close-fg-hover, var(--xh-fg-default));
156
+ --xh-action-fg-pressed: var(--xh-alert-close-fg-hover, var(--xh-fg-default));
157
+ --xh-action-border-rest: transparent;
158
+ --xh-action-highlight-rest: transparent;
159
+ --xh-action-shadow-rest: none;
160
+ --xh-action-shadow-hover: none;
161
+ --xh-action-shadow-pressed: none;
162
+ /* 叉的字形按钮档取值(sm → 16px),与 root 上给指示符的 md 档分开 */
163
+ --xh-icon-size: var(--xh-alert-icon-size, var(--xh-_action-profile-glyph-size));
164
+
165
+ flex: none;
166
+ align-self: center;
167
+ border-width: 0;
168
+ }
169
+
170
+ /* closable=false 时连接层同时给了 hidden 与 disabled,这条是它真正收起的那一半;
171
+ 家族那条 display 会把 UA 的 [hidden]{display:none} 盖掉 */
172
+ .xh-scope-alert[data-part='close-trigger'][hidden] {
173
+ display: none;
174
+ }
175
+
176
+ /* 没写内容就由皮肤画兜底字形;作者往部件里塞了自己的图形,这几条即不命中 */
177
+ .xh-scope-alert[data-part='close-trigger']:empty::before {
178
+ content: '';
179
+ display: inline-block;
180
+ inline-size: var(--xh-icon-size, var(--xh-glyph-size-text));
181
+ block-size: var(--xh-icon-size, var(--xh-glyph-size-text));
182
+ vertical-align: var(--xh-glyph-baseline-shift);
183
+ background-color: currentColor;
184
+ -webkit-mask: var(--xh-glyph-mark-close) center / contain no-repeat;
185
+ mask: var(--xh-glyph-mark-close) center / contain no-repeat;
186
+ }
187
+
188
+ /*
189
+ * 打印:底色被丢掉,六档语气那层淡底一起没了,剩下的描边兑了 40% 的底色,在纸上几乎印不出。
190
+ * 描边换成正文色把这块提示框出来,标题加重一档——纸上分得出「这是一段提示」,
191
+ * 靠的是框与字重这两条无色通道,不是那层底。
192
+ * 关闭钮在纸上按不动,一并收起。
193
+ */
194
+ @media print {
195
+ .xh-scope-alert[data-part='root'] {
196
+ border-color: currentColor;
197
+ }
198
+
199
+ .xh-scope-alert[data-part='title'] {
200
+ font-weight: var(--xh-font-weight-bold);
201
+ }
202
+
203
+ .xh-scope-alert[data-part='close-trigger'] {
204
+ display: none;
205
+ }
206
+ }
207
+
208
+ @media (forced-colors: active) {
209
+ .xh-scope-alert[data-part='root'] {
210
+ border-color: CanvasText;
211
+ }
212
+ }
213
+
214
+ /* 声明过任何 display 就盖掉了 UA 的 [hidden]{display:none},收起态得自己还回去。
215
+ 写在文件末尾:兜底必须排在该部件所有 display 声明之后 */
216
+ .xh-scope-alert[data-part='indicator'][hidden] {
217
+ display: none;
218
+ }
219
+
220
+ .xh-scope-alert[data-part='content'][hidden] {
221
+ display: none;
222
+ }
223
+
224
+ .xh-scope-alert[data-part='action'][hidden] {
225
+ display: none;
226
+ }
227
+
228
+ @media (forced-colors: active) {
229
+ /* 兜底字形是 mask 挖出来的一块底色,这一档里底色被系统换成 Canvas,字形跟着消失。
230
+ 字形退出强制换色、直接写系统色(不能取 currentColor:退出强制换色的伪元素读到的是被系统换掉之前的作者色):
231
+ 按钮面上取 ButtonText,悬停与按下时家族把按钮涂成 Highlight、字形换 HighlightText;
232
+ 禁用取 GrayText */
233
+ .xh-scope-alert[data-part='close-trigger']:empty::before {
234
+ forced-color-adjust: none;
235
+ background-color: ButtonText;
236
+ }
237
+
238
+ .xh-scope-alert[data-part='close-trigger']:not([data-disabled]):not([data-loading]):is(:hover, :active, [data-pressed]):empty::before {
239
+ background-color: HighlightText;
240
+ }
241
+
242
+ .xh-scope-alert[data-part='close-trigger'][data-disabled]:empty::before {
243
+ background-color: GrayText;
244
+ }
245
+ }
246
+ }
@@ -0,0 +1,252 @@
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
+ /* 定义 anchor 样式。 */
7
+
8
+ /* 链接归 Collection Item 导航当前(nav 语境):面、字色、字重、光标与按压时间线由家族配方按投影的家族角色给,
9
+ 本皮肤只映射桥接槽。2px 指示线由本皮肤画:目录里放了 indicator 部件就由部件在轨道上滑动,
10
+ 没放则当前那一节的链接自画一条静态线 */
11
+ @import '../family/collection-item.css';
12
+
13
+ @layer xihan.components {
14
+ /* 皮肤在场的标记:开发模式下按 scope 探一次,取不到就说明这份皮肤没被引入。 */
15
+ .xh-scope-anchor {
16
+ --xh-anchor-skin: 1;
17
+ }
18
+
19
+ /* 根节点是 nav 地标,不参与排版:整条目录的布局全在 list 上,
20
+ 这里不给 display,UA 的 [hidden]{display:none} 就仍然压得住 */
21
+ .xh-scope-anchor[data-part='root'] {
22
+ /* 尺寸档只换这两个私有槽,链接从 root 继承它们,换档不必给每个部件各写一条选择器 */
23
+ --xh-_anchor-font-size: var(--xh-control-font-md);
24
+ --xh-_anchor-link-px: var(--xh-control-px-md);
25
+ /* 当前那一节的指示条与文字随语气走。没写 data-tone 时这两个槽都没被声明,退回品牌色。
26
+ 指示条是装饰性的色条,取柔和档;文字要压在普通背景上读,取语气的文字档——
27
+ 导航当前页缺省是 --xh-fg-brand,与指示条同一档主色。
28
+ 聚焦环不在其列,它恒是 --xh-ring-focus */
29
+ --xh-_anchor-accent: var(--xh-_tone-soft, var(--xh-fg-brand));
30
+ --xh-_anchor-accent-text: var(--xh-_tone-fg, var(--xh-fg-brand));
31
+
32
+ color: var(--xh-anchor-fg, var(--xh-fg-muted));
33
+ font-size: var(--xh-anchor-font-size, var(--xh-_anchor-font-size));
34
+ line-height: var(--xh-anchor-leading, var(--xh-leading-normal));
35
+ }
36
+
37
+ /* —— 尺寸 —— */
38
+ /* 缺省档写在上面的基础规则里;链接的内边距三档都走控件内边距那把尺 */
39
+ .xh-scope-anchor[data-part='root'][data-size='sm'] {
40
+ --xh-_anchor-font-size: var(--xh-control-font-sm);
41
+ --xh-_anchor-link-px: var(--xh-control-px-sm);
42
+ }
43
+
44
+ .xh-scope-anchor[data-part='root'][data-size='lg'] {
45
+ --xh-_anchor-font-size: var(--xh-control-font-lg);
46
+ --xh-_anchor-link-px: var(--xh-control-px-lg);
47
+ }
48
+
49
+ /* 指示条的定位参照系(它是 absolute,量出来的偏移就是相对这里的)。
50
+ ul 的项目符号与内外边距是 UA 给的,库里没有全局 preflight,只能在这儿自己抹平 */
51
+ .xh-scope-anchor[data-part='list'] {
52
+ position: relative;
53
+ display: flex;
54
+ flex-direction: column;
55
+ gap: var(--xh-anchor-gap, var(--xh-space-1));
56
+ margin: 0;
57
+ padding: 0;
58
+ /* 起始缘的那条轨道:指示条就在它上面滑 */
59
+ border-inline-start: var(--xh-stroke-thin) solid var(--xh-anchor-track, var(--xh-border-default));
60
+ list-style: none;
61
+ }
62
+
63
+ .xh-scope-anchor[data-part='list'][hidden] {
64
+ display: none;
65
+ }
66
+
67
+ /* 横排:轨道从起始缘挪到底边,条目改成一行 */
68
+ .xh-scope-anchor[data-part='list'][data-orientation='horizontal'] {
69
+ flex-direction: row;
70
+ align-items: center;
71
+ gap: var(--xh-anchor-gap-horizontal, var(--xh-space-2));
72
+ border-inline-start: 0;
73
+ border-block-end: var(--xh-stroke-thin) solid var(--xh-anchor-track, var(--xh-border-default));
74
+ }
75
+
76
+ .xh-scope-anchor[data-part='item'] {
77
+ display: flex;
78
+ /* 库里没有全局 preflight,列表项的外边距在这里自己抹平 */
79
+ margin: 0;
80
+ /* 允许被压缩,链接内部的省略号才有生效的余地 */
81
+ min-inline-size: 0;
82
+ }
83
+
84
+ .xh-scope-anchor[data-part='item'][hidden] {
85
+ display: none;
86
+ }
87
+
88
+ /* 链接的几何、字号与面全经家族桥接槽:静息 muted / regular,悬停走白底承载 hover 100 + default 字,
89
+ 按下 pressed 200 只换面;当前那一节(导航当前页)brand-strong 字色(随语气的
90
+ --xh-_anchor-accent-text)+ medium 字重都跟着变,2px 指示线放了 indicator 部件由部件滑动、没放则由
91
+ 下面的静态线规则画在当前链接自己身上。本条 (0,2,0) 压过家族基础块 (0,1,0),不能再写 color / background。
92
+ position: relative 是静态线的定位参照 */
93
+ .xh-scope-anchor[data-part='link'] {
94
+ --xh-collection-block-padding: var(--xh-anchor-link-py, var(--xh-space-1));
95
+ --xh-collection-inline-padding: var(--xh-anchor-link-px, var(--xh-_anchor-link-px));
96
+ --xh-collection-radius: var(--xh-anchor-link-radius, var(--xh-shape-control));
97
+ --xh-collection-font-size: var(--xh-anchor-font-size, var(--xh-_anchor-font-size));
98
+ --xh-collection-fg-rest: var(--xh-anchor-fg, var(--xh-fg-muted));
99
+ --xh-collection-bg-hover: var(--xh-anchor-link-bg-hover, var(--xh-bg-subtle));
100
+ --xh-collection-fg-hover: var(--xh-anchor-link-fg-hover, var(--xh-fg-default));
101
+ --xh-collection-bg-pressed: var(--xh-anchor-link-bg-pressed, var(--xh-bg-subtle-hover));
102
+ --xh-collection-fg-current: var(--xh-anchor-link-fg-current, var(--xh-_anchor-accent-text));
103
+ --xh-collection-font-weight-current: var(--xh-anchor-link-font-weight-current, var(--xh-font-weight-medium));
104
+
105
+ position: relative;
106
+ display: inline-flex;
107
+ align-items: center;
108
+ /* 一节的标题可能很长,压不住会把整列撑开 */
109
+ max-inline-size: var(--xh-anchor-link-max-w, var(--xh-nav-link-max-w));
110
+ /* 行高随 root 的行距槽:家族基础块给条目写了 leading-normal,这里接回 root 那一支 */
111
+ line-height: var(--xh-anchor-leading, var(--xh-leading-normal));
112
+ white-space: nowrap;
113
+ text-decoration: none;
114
+ text-overflow: ellipsis;
115
+ overflow: hidden;
116
+ }
117
+
118
+ .xh-scope-anchor[data-part='link'][hidden] {
119
+ display: none;
120
+ }
121
+
122
+ /* 链接里另有图标时,省略号只裁这一段文字 */
123
+ .xh-scope-anchor[data-part='link-text'] {
124
+ min-inline-size: 0;
125
+ white-space: nowrap;
126
+ text-overflow: ellipsis;
127
+ overflow: hidden;
128
+ }
129
+
130
+ /* 当前链接的四个几何量由机器量好、连接层写成私有槽 --xh-_anchor-indicator-x / -y / -w / -h
131
+ (它量得到,样式表量不到);这里按排布取主轴那两支,落点交给 translate(只走合成),
132
+ 另管交叉轴的贴边与粗细,以及长什么样。它是可选部件——不渲染它时,
133
+ 当前那一节的链接自画一条同规格的静态线(见下) */
134
+ .xh-scope-anchor[data-part='indicator'] {
135
+ /* 还没量到时的落点,量到即被机器写的私有槽盖过 */
136
+ --xh-_anchor-indicator-x: 0;
137
+ --xh-_anchor-indicator-y: 0;
138
+ --xh-_anchor-indicator-w: 0;
139
+ --xh-_anchor-indicator-h: 0;
140
+ --xh-_anchor-indicator-stretch: 0;
141
+
142
+ position: absolute;
143
+ display: block;
144
+ /* 指示条也是列表项,宿主给 li 的外边距会把绝对定位的它推离条目 */
145
+ margin: 0;
146
+ inset-block-start: 0;
147
+ inset-inline-start: calc(var(--xh-anchor-indicator-thickness, var(--xh-stroke-thick)) * -1);
148
+ inline-size: var(--xh-anchor-indicator-thickness, var(--xh-stroke-thick));
149
+ block-size: var(--xh-_anchor-indicator-h);
150
+ border-radius: var(--xh-anchor-indicator-radius, var(--xh-shape-pill));
151
+ background: var(--xh-anchor-indicator-color, var(--xh-_anchor-accent));
152
+ translate: 0 var(--xh-_anchor-indicator-y);
153
+ transition:
154
+ translate var(--xh-motion-duration-move) var(--xh-motion-ease-continuous),
155
+ block-size var(--xh-motion-duration-move) var(--xh-motion-ease-continuous);
156
+ }
157
+
158
+ /* display 会盖掉 hidden 属性的 UA 规则,无激活项时显式让位 */
159
+ .xh-scope-anchor[data-part='indicator'][hidden] {
160
+ display: none;
161
+ }
162
+
163
+ /* 横排:指示条改躺在底边的轨道上,交叉轴换成块轴 */
164
+ .xh-scope-anchor[data-part='indicator'][data-orientation='horizontal'] {
165
+ inset-block-start: auto;
166
+ inset-inline-start: 0;
167
+ inset-block-end: calc(var(--xh-anchor-indicator-thickness, var(--xh-stroke-thick)) * -1);
168
+ inline-size: var(--xh-_anchor-indicator-w);
169
+ block-size: var(--xh-anchor-indicator-thickness, var(--xh-stroke-thick));
170
+ translate: var(--xh-_anchor-indicator-x) 0;
171
+ transition:
172
+ translate var(--xh-motion-duration-move) var(--xh-motion-ease-continuous),
173
+ inline-size var(--xh-motion-duration-move) var(--xh-motion-ease-continuous);
174
+ }
175
+
176
+ /* translate 只认物理方向:RTL 下行首在右边,起始缘量出的距离往左推 */
177
+ .xh-scope-anchor[data-part='indicator'][data-orientation='horizontal']:dir(rtl) {
178
+ translate: calc(-1 * var(--xh-_anchor-indicator-x)) 0;
179
+ }
180
+
181
+ /* 首次落位与同一项的重量(窗口缩放、换上正式字体)直接到位,只有换项才滑:连接层在这一落点投影
182
+ data-instant。写在排布那几条之后,同一特异性按先后压过它们单写的过渡 */
183
+ .xh-scope-anchor[data-part='indicator'][data-instant] {
184
+ transition: none;
185
+ }
186
+
187
+ /* 液态档:两沿由弹簧逐帧推着走(连接层每一帧写好盒子),几何量不再补过渡;
188
+ 被拉长时在另一个方向上压扁(竖排缺省压行向,横排压块向),表达体积守恒,拉长到目标的两倍时压到 --xh-motion-scale-squash */
189
+ :where([data-material='liquid']) .xh-scope-anchor[data-part='indicator'] {
190
+ --xh-_anchor-indicator-squash: max(var(--xh-motion-scale-squash), calc(1 - var(--xh-_anchor-indicator-stretch) * (1 - var(--xh-motion-scale-squash))));
191
+
192
+ scale: var(--xh-_anchor-indicator-squash) 1;
193
+ transition: none;
194
+ }
195
+
196
+ :where([data-material='liquid']) .xh-scope-anchor[data-part='indicator'][data-orientation='horizontal'] {
197
+ scale: 1 var(--xh-_anchor-indicator-squash);
198
+ transition: none;
199
+ }
200
+
201
+ /* 目录里没放 indicator 部件时,当前那一节的链接自画一条静态指示线(导航当前页):
202
+ 与 Tabs line 档同一取法,作者不必为了这条线多放一个部件。
203
+ 线画在当前链接的 ::after 上,以链接盒为定位参照(上面已给 position: relative),
204
+ 厚度 / 颜色 / 圆角与 indicator 部件读同一组槽与缺省——作者改一处,部件与静态线一起改。
205
+ 不做动画:它随 data-current 在链接间跳,滑动只有部件做得到。
206
+ 线贴在链接盒内的那条缘:链接为了省略号收着 overflow,画不到盒外;部件骑在 list 的轨道上(盒外一线宽),
207
+ 两者同侧、差一线宽。主轴两端各退一格 --xh-space-1 避开链接的圆角(overflow 连圆角一起裁,贴满会被
208
+ 切掉两个角),与家族 page 语境的起始侧指示条同一取法。嵌套目录里子级链接随自己的缩进走,部件则始终在
209
+ 外层轨道上。
210
+ 目录里一旦放了 indicator 部件,这条线就收起、位置交给部件滑动,不重复画两条:
211
+ 由 list 按 :has 探一次,把私有槽写成 none,线的 content 读它;链接自己不必再各带一段 :has */
212
+ .xh-scope-anchor[data-part='list']:has(.xh-scope-anchor[data-part='indicator']) {
213
+ --xh-_anchor-static-line: none;
214
+ }
215
+
216
+ .xh-scope-anchor[data-part='link'][data-current]::after {
217
+ content: var(--xh-_anchor-static-line, '');
218
+ position: absolute;
219
+ pointer-events: none;
220
+ border-radius: var(--xh-anchor-indicator-radius, var(--xh-shape-pill));
221
+ background: var(--xh-anchor-indicator-color, var(--xh-_anchor-accent));
222
+ }
223
+
224
+ /* 竖排(缺省):贴链接的行向起始缘(与 indicator 部件同一侧,rtl 随逻辑属性镜像) */
225
+ .xh-scope-anchor[data-part='list'][data-orientation='vertical']
226
+ .xh-scope-anchor[data-part='link'][data-current]::after {
227
+ inset-inline-start: 0;
228
+ inset-block: var(--xh-space-1);
229
+ inline-size: var(--xh-anchor-indicator-thickness, var(--xh-stroke-thick));
230
+ }
231
+
232
+ /* 横排:贴链接的块向末端(底边) */
233
+ .xh-scope-anchor[data-part='list'][data-orientation='horizontal']
234
+ .xh-scope-anchor[data-part='link'][data-current]::after {
235
+ inset-block-end: 0;
236
+ inset-inline: var(--xh-space-1);
237
+ block-size: var(--xh-anchor-indicator-thickness, var(--xh-stroke-thick));
238
+ }
239
+
240
+ @media (forced-colors: active) {
241
+ /* 指示条画的是一块纯底色,这一档里底色被统一换成 Canvas,条子整根消失,
242
+ "读到哪一节"就只剩链接自己的字重。换成系统高亮色画回来 */
243
+ .xh-scope-anchor[data-part='indicator'] {
244
+ background: Highlight;
245
+ }
246
+
247
+ /* 没放部件时当前链接自画的那条静态线同样是一块纯底色,同一档换成系统高亮色 */
248
+ .xh-scope-anchor[data-part='link'][data-current]::after {
249
+ background: Highlight;
250
+ }
251
+ }
252
+ }