@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/css/toast.css DELETED
@@ -1,499 +0,0 @@
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
- /* 定义 toast 样式。 */
7
-
8
- /* Toast 独立皮肤同时传递引入操作 / 关闭钮的动作控件配方;full bundle 递归去重。 */
9
- @import '../family/action-control.css';
10
-
11
- @layer xihan.motion {
12
- /* 新条目从视口边缘外进入,同时落到自己的折叠层级。 */
13
- @keyframes xh-toast-in {
14
- from {
15
- opacity: 0;
16
- transform: translateY(calc(var(--xh-toast-dir, 1) * (var(--xh-toast-offset-collapsed, 0px) - 100%)))
17
- scale(var(--xh-toast-scale-collapsed, 1));
18
- }
19
-
20
- to {
21
- opacity: 1;
22
- transform: translateY(calc(var(--xh-toast-dir, 1) * var(--xh-toast-offset-collapsed, 0px)))
23
- scale(var(--xh-toast-scale-collapsed, 1));
24
- }
25
- }
26
-
27
- @keyframes xh-toast-spin {
28
- to {
29
- rotate: 360deg;
30
- }
31
- }
32
-
33
- /* 倒计时条:从占满一整条收到零。走一遍就到头,时长由连接层写进时长槽 */
34
- @keyframes xh-countdown {
35
- from {
36
- inline-size: 100%;
37
- }
38
-
39
- to {
40
- inline-size: 0%;
41
- }
42
- }
43
-
44
- @keyframes xh-toast-out {
45
- from {
46
- opacity: 1;
47
- transform: translateY(calc(var(--xh-toast-dir, 1) * var(--xh-toast-y, 0px)))
48
- scale(var(--xh-toast-scale, 1));
49
- }
50
-
51
- to {
52
- opacity: 0;
53
- transform: translateY(calc(var(--xh-toast-dir, 1) * (var(--xh-toast-y, 0px) - 100%)))
54
- scale(var(--xh-toast-scale, 1));
55
- }
56
- }
57
- }
58
-
59
- @layer xihan.components {
60
- /* 皮肤在场的标记:开发模式下按 scope 探一次,取不到就说明这份皮肤没被引入。 */
61
- [data-scope='toast'] {
62
- --xh-toast-skin: 1;
63
- }
64
-
65
- /* 固定宽度的堆叠定位面;每条 Toast 在其中绝对定位。 */
66
- [data-scope='toast'][data-part='group'] {
67
- position: fixed;
68
- z-index: var(--xh-toast-layer, var(--xh-layer-toast));
69
- display: block;
70
- inline-size: min(var(--xh-toast-inline-size, 28.75rem), calc(100vw - var(--xh-space-8)));
71
- block-size: 0;
72
- pointer-events: none;
73
- }
74
-
75
- [data-scope='toast'][data-part='group'][hidden] {
76
- display: none;
77
- }
78
-
79
- [data-scope='toast'][data-part='group'][data-placement='bottom'] {
80
- inset-block-end: max(var(--xh-toast-inset, var(--xh-space-4)), env(safe-area-inset-bottom));
81
- inset-inline-start: 50%;
82
- translate: -50% 0;
83
- }
84
-
85
- [data-scope='toast'][data-part='group'][data-placement='top'] {
86
- inset-block-start: max(var(--xh-toast-inset, var(--xh-space-4)), env(safe-area-inset-top));
87
- inset-inline-start: 50%;
88
- translate: -50% 0;
89
- }
90
-
91
- [data-scope='toast'][data-part='group'][data-placement$='-start'] {
92
- inset-inline-start: max(var(--xh-toast-inset, var(--xh-space-4)), env(safe-area-inset-left));
93
- }
94
-
95
- [data-scope='toast'][data-part='group'][data-placement$='-end'] {
96
- inset-inline-end: max(var(--xh-toast-inset, var(--xh-space-4)), env(safe-area-inset-right));
97
- }
98
-
99
- [data-scope='toast'][data-part='group'][data-placement^='bottom'][data-placement$='-start'],
100
- [data-scope='toast'][data-part='group'][data-placement^='bottom'][data-placement$='-end'] {
101
- inset-block-end: max(var(--xh-toast-inset, var(--xh-space-4)), env(safe-area-inset-bottom));
102
- }
103
-
104
- [data-scope='toast'][data-part='group'][data-placement^='top'][data-placement$='-start'],
105
- [data-scope='toast'][data-part='group'][data-placement^='top'][data-placement$='-end'] {
106
- inset-block-start: max(var(--xh-toast-inset, var(--xh-space-4)), env(safe-area-inset-top));
107
- }
108
-
109
- /* 中性浮层承载整条反馈,语气只落到状态字形和标题。
110
- 面走 sheet 三件套(--xh-material-elevated-bg / -border / -shadow,亮暗两档同有 1px 描边)。 */
111
- [data-scope='toast'][data-part='root'] {
112
- /* 作者塞进指示符槽的图标与皮肤画的兜底字形同一把尺:Feedback 指示符统一 md 档 */
113
- --xh-icon-size: var(--xh-toast-icon-size, var(--xh-glyph-size-md));
114
-
115
- --xh-toast-y: var(--xh-toast-offset-collapsed, 0px);
116
- --xh-toast-scale: var(--xh-toast-scale-collapsed, 1);
117
-
118
- position: relative;
119
- display: flex;
120
- flex: none;
121
- align-items: flex-start;
122
- gap: var(--xh-toast-gap, var(--xh-space-1_5));
123
- inline-size: min(var(--xh-toast-inline-size, 28.75rem), 100%);
124
- padding-block: var(--xh-toast-py, var(--xh-space-3));
125
- padding-inline: var(--xh-toast-px, var(--xh-space-4));
126
- border: var(--xh-stroke-thin) solid var(--xh-toast-border, var(--xh-material-elevated-border));
127
- border-radius: var(--xh-toast-radius, var(--xh-shape-overlay));
128
- background: var(--xh-toast-bg, var(--xh-material-elevated-bg));
129
- color: var(--xh-toast-fg, var(--xh-material-elevated-fg));
130
- box-shadow: var(--xh-toast-shadow, var(--xh-material-elevated-shadow));
131
- font-size: var(--xh-toast-font-size, var(--xh-text-label-size));
132
- line-height: var(--xh-toast-leading, var(--xh-text-body-leading));
133
- /* 摞的定位面整面铺开且不吃指针,条子必须自己吃回来:
134
- 悬停按住计时、按钮可点、焦点进出,全指着这一条 */
135
- pointer-events: auto;
136
- transform: translateY(calc(var(--xh-toast-dir, 1) * var(--xh-toast-y))) scale(var(--xh-toast-scale));
137
- transform-origin: bottom center;
138
- transition:
139
- transform var(--xh-motion-duration-enter) var(--xh-motion-ease-continuous),
140
- block-size var(--xh-motion-duration-enter) var(--xh-motion-ease-continuous),
141
- opacity var(--xh-motion-duration-micro) var(--xh-motion-ease-enter);
142
- }
143
-
144
- [data-scope='toast'][data-part='group'] [data-scope='toast'][data-part='root'] {
145
- position: absolute;
146
- inset-inline: 0;
147
- inline-size: 100%;
148
- }
149
-
150
- [data-scope='toast'][data-part='root'][data-placement^='bottom'] {
151
- --xh-toast-dir: -1;
152
- inset-block-end: 0;
153
- }
154
-
155
- [data-scope='toast'][data-part='root'][data-placement^='top'] {
156
- --xh-toast-dir: 1;
157
- inset-block-start: 0;
158
- transform-origin: top center;
159
- }
160
-
161
- /* 退场窗口走完连接层给的是 hidden 属性,而上面声明了 display——
162
- 漏掉这条,已经"卸载"的提示会一直杵在屏幕上,且再也没人来收 */
163
- [data-scope='toast'][data-part='root'][hidden] {
164
- display: none;
165
- }
166
-
167
- /* 生命周期只有三段,unmounted 那段由上面的 [hidden] 收走,这里只管前两段 */
168
- [data-scope='toast'][data-part='root'][data-state='visible'] {
169
- animation: xh-toast-in var(--xh-motion-duration-enter) var(--xh-motion-ease-enter-strong) backwards;
170
- }
171
-
172
- [data-scope='toast'][data-part='root'][data-stack-index]:not([data-frontmost]):not([data-expanded]) {
173
- block-size: var(--xh-toast-front-height, auto);
174
- overflow: hidden;
175
- }
176
-
177
- [data-scope='toast'][data-part='root'][data-stack-index]:not([data-frontmost]):not([data-expanded])
178
- > :not([data-part='close-trigger']) {
179
- opacity: 0;
180
- }
181
-
182
- [data-scope='toast'][data-part='root'][data-expanded] {
183
- --xh-toast-y: var(--xh-toast-offset-expanded, 0px);
184
- --xh-toast-scale: 1;
185
- block-size: var(--xh-toast-height, auto);
186
- }
187
-
188
- [data-scope='toast'][data-part='root'] > :not([data-part='close-trigger']) {
189
- transition: opacity var(--xh-motion-duration-micro) var(--xh-motion-ease-enter);
190
- }
191
-
192
- /* forwards 不能省:退场窗口(removeDelay 默认 300ms)比退场动画长,
193
- 不定住末帧的话动画跑完会弹回全不透明,条子在被收起前先闪一下 */
194
- [data-scope='toast'][data-part='root'][data-state='dismissing'] {
195
- animation: xh-toast-out var(--xh-motion-duration-exit) var(--xh-motion-ease-exit) forwards;
196
- }
197
-
198
- /*
199
- * 语气的非颜色通道。行首字形按 data-tone 区分信息、成功、警告与失败;加载中另由 data-loading 说,
200
- * 字形换成转圈但配色仍照语气走。
201
- * 作者未渲染 indicator 时由 root 的伪元素补上。
202
- */
203
- [data-scope='toast'][data-part='root']::before {
204
- content: '';
205
- flex: none;
206
- display: inline-block;
207
- inline-size: var(--xh-icon-size, var(--xh-glyph-size-text));
208
- block-size: var(--xh-icon-size, var(--xh-glyph-size-text));
209
- vertical-align: var(--xh-glyph-baseline-shift);
210
- background-color: var(--xh-toast-icon-fg, var(--xh-_tone-fg));
211
- -webkit-mask: var(--xh-glyph-mark-info) center / contain no-repeat;
212
- mask: var(--xh-glyph-mark-info) center / contain no-repeat;
213
- }
214
-
215
- [data-scope='toast'][data-part='root'][data-tone='success']::before {
216
- -webkit-mask-image: var(--xh-glyph-mark-check);
217
- mask-image: var(--xh-glyph-mark-check);
218
- }
219
-
220
- [data-scope='toast'][data-part='root'][data-tone='warning']::before {
221
- -webkit-mask-image: var(--xh-glyph-mark-warning);
222
- mask-image: var(--xh-glyph-mark-warning);
223
- }
224
-
225
- [data-scope='toast'][data-part='root'][data-tone='danger']::before {
226
- -webkit-mask-image: var(--xh-glyph-mark-close);
227
- mask-image: var(--xh-glyph-mark-close);
228
- }
229
-
230
- /* 加载中不是语气:只换字形,颜色沿用当前语气的前景档;写在四档语气之后,转圈压过它们 */
231
- [data-scope='toast'][data-part='root'][data-loading]::before {
232
- -webkit-mask-image: var(--xh-glyph-mark-rotate-right);
233
- mask-image: var(--xh-glyph-mark-rotate-right);
234
- animation: xh-toast-spin var(--xh-spin-duration) var(--xh-motion-ease-loop) infinite;
235
- }
236
-
237
- /* 减少动效:转圈停下,静止的箭头仍然读得出「还没好」;「在等什么」由条子上的
238
- role=status 与可见文案继续承担。
239
- 两组规则是同一件事的两个触发条件:系统偏好与作者打的 data-motion */
240
- @media (prefers-reduced-motion: reduce) {
241
- [data-scope='toast'][data-part='root'][data-loading]::before {
242
- animation: none;
243
- }
244
- }
245
-
246
- :where([data-motion='reduce']) [data-scope='toast'][data-part='root'][data-loading]::before {
247
- animation: none;
248
- }
249
-
250
- /* 作者渲染了指示符部件,行首那枚兜底字形就让位给它,一行里不出现两枚图形 */
251
- [data-scope='toast'][data-part='root']:has([data-part='indicator'])::before {
252
- content: none;
253
- }
254
-
255
- /* 指示符部件:字形与 root 上那枚同尺同色,作者往里塞节点即整枚换掉 */
256
- [data-scope='toast'][data-part='indicator'] {
257
- flex: none;
258
- display: inline-flex;
259
- align-items: center;
260
- justify-content: center;
261
- box-sizing: content-box;
262
- inline-size: var(--xh-icon-size, var(--xh-glyph-size-text));
263
- block-size: var(--xh-icon-size, var(--xh-glyph-size-text));
264
- padding: var(--xh-toast-indicator-p, var(--xh-space-1));
265
- color: var(--xh-toast-icon-fg, var(--xh-_tone-fg));
266
- }
267
-
268
- /* 没写内容就由皮肤画兜底字形;作者往部件里塞了自己的图形,这几条即不命中 */
269
- [data-scope='toast'][data-part='indicator']:empty::before {
270
- content: '';
271
- display: inline-block;
272
- inline-size: var(--xh-icon-size, var(--xh-glyph-size-text));
273
- block-size: var(--xh-icon-size, var(--xh-glyph-size-text));
274
- vertical-align: var(--xh-glyph-baseline-shift);
275
- background-color: currentColor;
276
- -webkit-mask: var(--xh-glyph-mark-info) center / contain no-repeat;
277
- mask: var(--xh-glyph-mark-info) center / contain no-repeat;
278
- }
279
-
280
- [data-scope='toast'][data-part='indicator'][data-tone='success']:empty::before {
281
- -webkit-mask-image: var(--xh-glyph-mark-check);
282
- mask-image: var(--xh-glyph-mark-check);
283
- }
284
-
285
- [data-scope='toast'][data-part='indicator'][data-tone='warning']:empty::before {
286
- -webkit-mask-image: var(--xh-glyph-mark-warning);
287
- mask-image: var(--xh-glyph-mark-warning);
288
- }
289
-
290
- [data-scope='toast'][data-part='indicator'][data-tone='danger']:empty::before {
291
- -webkit-mask-image: var(--xh-glyph-mark-close);
292
- mask-image: var(--xh-glyph-mark-close);
293
- }
294
-
295
- [data-scope='toast'][data-part='indicator'][data-loading]:empty::before {
296
- -webkit-mask-image: var(--xh-glyph-mark-rotate-right);
297
- mask-image: var(--xh-glyph-mark-rotate-right);
298
- animation: xh-toast-spin var(--xh-spin-duration) var(--xh-motion-ease-loop) infinite;
299
- }
300
-
301
- /* 减少动效:与 root 上那枚同一处理——转圈停下,静止的箭头仍读得出「还没好」。
302
- 两组规则是同一件事的两个触发条件:系统偏好与作者打的 data-motion */
303
- @media (prefers-reduced-motion: reduce) {
304
- [data-scope='toast'][data-part='indicator'][data-loading]:empty::before {
305
- animation: none;
306
- }
307
- }
308
-
309
- :where([data-motion='reduce']) [data-scope='toast'][data-part='indicator'][data-loading]:empty::before {
310
- animation: none;
311
- }
312
-
313
- [data-scope='toast'][data-part='indicator'][hidden] {
314
- display: none;
315
- }
316
-
317
- [data-scope='toast'][data-part='content'] {
318
- flex: 1 1 auto;
319
- display: flex;
320
- flex-direction: column;
321
- align-self: center;
322
- min-inline-size: 0;
323
- }
324
-
325
- [data-scope='toast'][data-part='title'],
326
- [data-scope='toast'][data-part='description'] {
327
- margin: 0;
328
- min-inline-size: 0;
329
- }
330
-
331
- [data-scope='toast'][data-part='title'] {
332
- color: var(--xh-toast-title-fg, var(--xh-_tone-fg));
333
- font-size: var(--xh-toast-title-font-size, var(--xh-text-label-size));
334
- font-weight: var(--xh-toast-title-font-weight, var(--xh-font-weight-semibold));
335
- line-height: var(--xh-toast-title-leading, var(--xh-text-body-leading));
336
- }
337
-
338
- [data-scope='toast'][data-part='description'] {
339
- color: var(--xh-toast-description-fg, var(--xh-fg-muted));
340
- font-size: var(--xh-toast-description-font-size, var(--xh-text-secondary-size));
341
- line-height: var(--xh-toast-description-leading, var(--xh-leading-normal));
342
- }
343
-
344
- /* 没给文案时仍然要留在 DOM 里(aria-labelledby 指着它),
345
- 但空盒子会照吃一份 gap,条子看着就多出一截莫名的留白 */
346
- [data-scope='toast'][data-part='title']:empty {
347
- display: none;
348
- }
349
-
350
- [data-scope='toast'][data-part='description']:empty {
351
- display: none;
352
- }
353
-
354
- [data-scope='toast'][data-part='title'][hidden] {
355
- display: none;
356
- }
357
-
358
- /* 操作钮是带文案的离散动作钮:盒几何、悬停 / 按下与 0.97 按压、粗指针热区、焦点环、禁用面全由 Action Control
359
- 的 text outline 档给(连接层投 sm;非 Button 的触发器缺省中性描边、透明底),组件只映射既有使用者槽。
360
- 语气只落到状态字形和标题:这颗钮坐在带 data-tone 的条子里,底 / 边 / 字钉在中性语义面上,不随语气;
361
- 条子是 sheet 白面承载:hover --xh-bg-subtle(100)→ pressed --xh-bg-subtle-hover(200)。
362
- 条子是单行 flex,按钮不参与伸缩:文案长了该换行的是文字 */
363
- [data-scope='toast'][data-part='action-trigger'] {
364
- --xh-action-visual-size: var(--xh-toast-action-h, var(--xh-_action-profile-visual-size));
365
- --xh-action-padding-inline: var(--xh-toast-action-px, var(--xh-_action-profile-padding-inline));
366
- --xh-action-radius: var(--xh-toast-action-radius, var(--xh-shape-control));
367
- --xh-action-bg-rest: var(--xh-toast-action-bg, transparent);
368
- --xh-action-bg-hover: var(--xh-toast-action-bg-hover, var(--xh-bg-subtle));
369
- --xh-action-bg-pressed: var(--xh-toast-action-bg-active, var(--xh-bg-subtle-hover));
370
- --xh-action-fg-rest: var(--xh-toast-action-fg, var(--xh-fg-default));
371
- --xh-action-fg-hover: var(--xh-toast-action-fg, var(--xh-fg-default));
372
- --xh-action-fg-pressed: var(--xh-toast-action-fg, var(--xh-fg-default));
373
- --xh-action-border-rest: var(--xh-toast-action-border, var(--xh-border-control));
374
- --xh-action-border-hover: var(--xh-toast-action-border, var(--xh-border-control-hover));
375
- --xh-action-border-pressed: var(--xh-toast-action-border, var(--xh-border-control-hover));
376
- --xh-action-highlight-rest: transparent;
377
- --xh-action-shadow-rest: none;
378
- --xh-action-shadow-hover: none;
379
- --xh-action-shadow-pressed: none;
380
-
381
- flex: none;
382
- align-self: center;
383
- font-weight: var(--xh-toast-action-font-weight, var(--xh-font-weight-medium));
384
- }
385
-
386
- /* 家族那条 display 会把 UA 的 [hidden]{display:none} 盖掉 */
387
- [data-scope='toast'][data-part='action-trigger'][hidden] {
388
- display: none;
389
- }
390
-
391
- /*
392
- * 倒计时条。总时长由连接层写进 --xh-toast-progress-duration(不自动消失的那些整条收起),
393
- * 计时被按住时动画一并停住——停表这件事此前没有任何可画的地方。
394
- * 取装饰档 --xh-_tone-soft:压在同族淡底上仍看得出来。
395
- */
396
- [data-scope='toast'][data-part='progress'] {
397
- position: absolute;
398
- inset-block-end: 0;
399
- inset-inline-start: 0;
400
- overflow: hidden;
401
- inline-size: 100%;
402
- block-size: var(--xh-toast-progress-thickness, var(--xh-space-0_5));
403
- background: var(--xh-toast-progress-bg, var(--xh-_tone-soft));
404
- animation: xh-countdown var(--xh-toast-progress-duration, var(--xh-motion-duration-slide)) var(--xh-motion-ease-loop) forwards;
405
- }
406
-
407
- [data-scope='toast'][data-part='root'][data-paused] [data-part='progress'] {
408
- animation-play-state: paused;
409
- }
410
-
411
- [data-scope='toast'][data-part='progress'][hidden] {
412
- display: none;
413
- }
414
-
415
- /* 关闭钮是只有字形的离散动作钮:盒几何、悬停 / 按下与 0.97 按压、粗指针热区、焦点环、禁用面全由 Action Control
416
- 的 icon ghost 档给(连接层投 xs:24px 正方盒,与此前 --xh-control-action-size 同尺寸;那颗叉排在单行短消息里,
417
- 走行级动作钮那一档),组件只映射既有使用者槽。静息透明,sheet 白面承载 hover 100 → pressed 200,
418
- 写了语气时悬停底跟着语气走(--xh-_tone-subtle)。
419
- 有悬停能力的设备上默认静默、指针进入条子或焦点落进条子后显现——不走家族的 hover-focus 显示策略:
420
- 那一档用 visibility 收起,这颗叉占 Tab 位,收成 visibility: hidden 后键盘就够不到它了;
421
- 这里只压 opacity 与 pointer-events,焦点仍能落进来 */
422
- [data-scope='toast'][data-part='close-trigger'] {
423
- --xh-action-visual-size: var(--xh-toast-close-size, var(--xh-_action-profile-visual-size));
424
- --xh-action-min-inline-size: var(--xh-toast-close-size, var(--xh-_action-profile-visual-size));
425
- --xh-action-radius: var(--xh-toast-close-radius, var(--xh-shape-control));
426
- --xh-action-bg-rest: var(--xh-toast-close-bg, var(--xh-_action-variant-bg-rest));
427
- --xh-action-bg-hover: var(--xh-toast-close-bg-hover, var(--xh-_action-variant-bg-hover));
428
- --xh-action-bg-pressed: var(--xh-toast-close-bg-active, var(--xh-_action-variant-bg-pressed));
429
- --xh-action-fg-rest: var(--xh-toast-close-fg, var(--xh-fg-muted));
430
- --xh-action-fg-hover: var(--xh-toast-close-fg-hover, var(--xh-fg-default));
431
- --xh-action-fg-pressed: var(--xh-toast-close-fg-hover, var(--xh-fg-default));
432
- --xh-action-border-rest: var(--xh-toast-close-border, var(--xh-_action-variant-border-rest));
433
- --xh-action-highlight-rest: transparent;
434
- --xh-action-shadow-rest: none;
435
- --xh-action-shadow-hover: none;
436
- --xh-action-shadow-pressed: none;
437
- /* 叉的字形按钮档取值(xs → 16px),与 root 上给指示符的 md 档分开 */
438
- --xh-icon-size: var(--xh-toast-icon-size, var(--xh-_action-profile-glyph-size));
439
-
440
- flex: none;
441
- align-self: center;
442
- }
443
-
444
- @media (hover: hover) {
445
- [data-scope='toast'][data-part='close-trigger'] {
446
- opacity: 0;
447
- pointer-events: none;
448
- }
449
-
450
- [data-scope='toast'][data-part='root']:hover [data-part='close-trigger'],
451
- [data-scope='toast'][data-part='root']:focus-within [data-part='close-trigger'] {
452
- opacity: 1;
453
- pointer-events: auto;
454
- }
455
- }
456
-
457
- /* 折叠堆叠只允许最前一条露出关闭入口;触屏没有 hover,必须显式收起后台按钮。 */
458
- [data-scope='toast'][data-part='root'][data-stack-index]:not([data-frontmost]):not([data-expanded])
459
- [data-part='close-trigger'] {
460
- opacity: 0;
461
- pointer-events: none;
462
- }
463
-
464
- /* closable=false 时连接层同时给了 hidden 与 disabled,这条是它真正收起的那一半:
465
- 上面声明了 display,不补回来就会留下一个按不动的叉,比压根没有叉更让人困惑 */
466
- [data-scope='toast'][data-part='close-trigger'][hidden] {
467
- display: none;
468
- }
469
-
470
- /* 没写内容就由皮肤画兜底字形;作者往部件里塞了自己的图形,这几条即不命中 */
471
- [data-scope='toast'][data-part='close-trigger']:empty::before {
472
- content: '';
473
- display: inline-block;
474
- inline-size: var(--xh-icon-size, var(--xh-glyph-size-text));
475
- block-size: var(--xh-icon-size, var(--xh-glyph-size-text));
476
- vertical-align: var(--xh-glyph-baseline-shift);
477
- background-color: currentColor;
478
- -webkit-mask: var(--xh-glyph-mark-close) center / contain no-repeat;
479
- mask: var(--xh-glyph-mark-close) center / contain no-repeat;
480
- }
481
-
482
- @media print {
483
- /* 打印:轻提示是瞬态的,打印那一刻恰好在场就会横在正文上,且它已经错过了被读到的时机。 */
484
- [data-scope='toast'][data-part='group'] {
485
- display: none;
486
- }
487
-
488
- /* 摞收起后条子本不该出现在纸上;这一条兜的是作者把条子摆在别处的用法:
489
- 动画会被定格在任意一帧——转了一半的圈。取值与减弱动效那一档相同。 */
490
- [data-scope='toast'][data-part='root'][data-loading]::before {
491
- animation: none;
492
- }
493
- }
494
-
495
- [data-scope='toast'][data-part='content'][hidden],
496
- [data-scope='toast'][data-part='description'][hidden] {
497
- display: none;
498
- }
499
- }