@astryx-vue/core 0.7.28 → 0.7.29

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 (215) hide show
  1. package/dist/AlertDialog/index.d.ts +1 -1
  2. package/dist/AlertDialog/index.js +1 -1
  3. package/dist/{AlertDialog-DZpJzvOC.js → AlertDialog-BO2LucRK.js} +3 -3
  4. package/dist/AvatarGroup/index.d.ts +1 -1
  5. package/dist/Banner/index.d.ts +1 -1
  6. package/dist/Banner/index.js +1 -1
  7. package/dist/{Banner-Dx2JtVc-.js → Banner-C-8DEWdJ.js} +1 -1
  8. package/dist/BottomSheet/index.d.ts +1 -1
  9. package/dist/Breadcrumbs/index.d.ts +2 -2
  10. package/dist/Breadcrumbs/index.js +1 -1
  11. package/dist/{Breadcrumbs-Brgi3F8q.js → Breadcrumbs-sakAtNnr.js} +1 -1
  12. package/dist/Button/index.d.ts +2 -2
  13. package/dist/Button/index.js +1 -1
  14. package/dist/{Button-DsjdehLZ.js → Button-BeNp2zq_.js} +7 -4
  15. package/dist/ButtonGroup/index.d.ts +1 -1
  16. package/dist/ButtonGroup/index.js +1 -1
  17. package/dist/{ButtonGroup-CSW7a9vq.js → ButtonGroup-CosYAili.js} +15 -4
  18. package/dist/Calendar/index.d.ts +1 -1
  19. package/dist/Carousel/index.js +1 -1
  20. package/dist/{Carousel-CSsQ4GHW.js → Carousel-C8kE0YJh.js} +1 -1
  21. package/dist/Chat/index.js +1 -1
  22. package/dist/{Chat-j2m3Exwo.js → Chat-Bl_Wr2lK.js} +5 -5
  23. package/dist/CheckboxInput/index.d.ts +1 -1
  24. package/dist/CheckboxList/index.d.ts +1 -1
  25. package/dist/ClickableCard/index.d.ts +1 -1
  26. package/dist/Code/index.js +1 -1
  27. package/dist/{CodeBlock-PSnUWX57.js → CodeBlock-CSxQPryb.js} +1 -1
  28. package/dist/Collapsible/index.d.ts +1 -1
  29. package/dist/CommandPalette/index.d.ts +1 -1
  30. package/dist/ComplexSelector/index.d.ts +1 -1
  31. package/dist/ComplexSelector/index.js +1 -1
  32. package/dist/{ComplexSelector-BgnhEjIN.js → ComplexSelector-DFKi6sKq.js} +1 -1
  33. package/dist/ContextMenu/index.d.ts +2 -2
  34. package/dist/DateInput/index.d.ts +1 -1
  35. package/dist/DateInput/index.js +1 -1
  36. package/dist/{DateInput-BY9qdl_H.js → DateInput-CI1_FFPZ.js} +1 -1
  37. package/dist/DateRangeInput/index.d.ts +1 -1
  38. package/dist/DateRangeInput/index.js +1 -1
  39. package/dist/{DateRangeInput-C0vyG95Z.js → DateRangeInput-lTx_eqfT.js} +2 -2
  40. package/dist/DateTimeInput/index.d.ts +1 -1
  41. package/dist/DateTimeInput/index.js +1 -1
  42. package/dist/{DateTimeInput-BmIljXWd.js → DateTimeInput-BouEOOwo.js} +3 -3
  43. package/dist/Dialog/index.d.ts +1 -1
  44. package/dist/Dialog/index.js +1 -1
  45. package/dist/{DialogHeader-Dfegdd7v.js → DialogHeader-cr9rFLYM.js} +1 -1
  46. package/dist/Drawer/index.d.ts +1 -1
  47. package/dist/Drawer/index.js +1 -1
  48. package/dist/{Drawer-7LLlGQcE.js → Drawer-Ba-yG1rk.js} +1 -1
  49. package/dist/DropdownMenu/index.d.ts +2 -2
  50. package/dist/DropdownMenu/index.js +2 -2
  51. package/dist/{DropdownMenu-CJxA-kJ2.js → DropdownMenu-BJicFgwf.js} +1 -1
  52. package/dist/{DropdownMenu-B6SXhr61.js → DropdownMenu-BPZjqbcw.js} +1 -1
  53. package/dist/{DropdownMenuRadioItem.vue-D455cIQQ.d.ts → DropdownMenuRadioItem.vue-C9DdN6UE.d.ts} +1 -1
  54. package/dist/Field/index.d.ts +2 -2
  55. package/dist/Field/index.js +1 -1
  56. package/dist/{FieldInfoTip-BJAaKJjM.js → FieldInfoTip-BouJddgS.js} +1 -1
  57. package/dist/FieldStatus/index.d.ts +1 -1
  58. package/dist/FileInput/index.d.ts +1 -1
  59. package/dist/FileInput/index.js +1 -1
  60. package/dist/{FileInput-C6eX4nBl.js → FileInput-CFUgV2px.js} +1 -1
  61. package/dist/Heading/index.d.ts +1 -1
  62. package/dist/HoverCard/index.d.ts +1 -1
  63. package/dist/Icon/index.d.ts +3 -3
  64. package/dist/IconButton/index.d.ts +1 -1
  65. package/dist/IconButton/index.js +1 -1
  66. package/dist/{IconButton-Crtfruc0.js → IconButton-C91rhbvu.js} +1 -1
  67. package/dist/Indicator/index.d.ts +2 -2
  68. package/dist/InfoTip/index.d.ts +1 -1
  69. package/dist/{InputClearButton-DjIxNNH8.js → InputClearButton-BiF7qGMR.js} +4 -2
  70. package/dist/InputGroup/index.d.ts +1 -1
  71. package/dist/Lightbox/index.js +1 -1
  72. package/dist/{Lightbox-rY1XJs38.js → Lightbox-VlvxtZn4.js} +1 -1
  73. package/dist/Link/index.d.ts +1 -1
  74. package/dist/List/index.d.ts +1 -1
  75. package/dist/Markdown/index.js +1 -1
  76. package/dist/{Markdown-BQbchOad.js → Markdown-DsE-40yq.js} +1 -1
  77. package/dist/{MediaTheme-Bt7WBTkq.js → MediaTheme-BVKUsMfC.js} +37 -1
  78. package/dist/MoreMenu/index.d.ts +1 -1
  79. package/dist/MoreMenu/index.js +1 -1
  80. package/dist/{MoreMenu-C2ZrGrJ-.js → MoreMenu-1lxF-JY5.js} +1 -1
  81. package/dist/MultiSelector/index.d.ts +1 -1
  82. package/dist/MultiSelector/index.js +1 -1
  83. package/dist/{MultiSelector-DWKh7ePj.js → MultiSelector-Slqiulwd.js} +1 -1
  84. package/dist/NavItem/index.d.ts +1 -1
  85. package/dist/NumberInput/index.d.ts +1 -1
  86. package/dist/NumberInput/index.js +1 -1
  87. package/dist/{NumberInput-Bzc9v9oU.js → NumberInput-Bsz7bmRp.js} +2 -2
  88. package/dist/OverflowList/index.d.ts +1 -1
  89. package/dist/Overlay/index.d.ts +1 -1
  90. package/dist/Pagination/index.d.ts +1 -1
  91. package/dist/Popover/index.d.ts +1 -1
  92. package/dist/Popover/index.js +1 -1
  93. package/dist/{Popover-DaGcaKHo.js → Popover-cnfHz2tm.js} +1 -1
  94. package/dist/PowerSearch/index.d.ts +1 -1
  95. package/dist/PowerSearch/index.js +1 -1
  96. package/dist/{PowerSearch-CtC5P-zt.js → PowerSearch-2jO62NSM.js} +8 -8
  97. package/dist/ProgressBar/index.d.ts +1 -1
  98. package/dist/Radio/index.d.ts +1 -1
  99. package/dist/RadioList/index.d.ts +1 -1
  100. package/dist/Resizable/index.d.ts +1 -1
  101. package/dist/ScrollableArea/index.d.ts +1 -1
  102. package/dist/SelectableCard/index.d.ts +1 -1
  103. package/dist/Selector/index.d.ts +1 -1
  104. package/dist/SideNav/index.d.ts +1 -1
  105. package/dist/SideNav/index.js +1 -1
  106. package/dist/{SideNav-YO-fBuwR.js → SideNav-DeVtoFFq.js} +1 -1
  107. package/dist/Slider/index.d.ts +1 -1
  108. package/dist/Stack/index.d.ts +1 -1
  109. package/dist/Stepper/index.d.ts +1 -1
  110. package/dist/Switch/index.d.ts +1 -1
  111. package/dist/TabList/index.d.ts +1 -1
  112. package/dist/Table/index.d.ts +1 -1
  113. package/dist/Table/index.js +1 -1
  114. package/dist/{Table-DkibnUnt.js → Table-sKQpWVKc.js} +6 -6
  115. package/dist/Text/index.d.ts +1 -1
  116. package/dist/TextArea/index.d.ts +1 -1
  117. package/dist/TextArea/index.js +1 -1
  118. package/dist/{TextArea-CKg-oybo.js → TextArea-BzcHz2qI.js} +3 -3
  119. package/dist/TextInput/index.d.ts +1 -1
  120. package/dist/TextInput/index.js +1 -1
  121. package/dist/{TextInput-QnW6aidH.js → TextInput-BeJNEQL6.js} +3 -3
  122. package/dist/Theme/index.d.ts +3 -3
  123. package/dist/Theme/index.js +3 -3
  124. package/dist/{Theme-BQe--DY6.js → Theme-1r_aWHvr.js} +330 -4
  125. package/dist/Thumbnail/index.js +1 -1
  126. package/dist/{Thumbnail-Cqt2l_zO.js → Thumbnail-CTkLFo-A.js} +1 -1
  127. package/dist/{TimeField-2QBI5tU6.js → TimeField-BGtS_m-U.js} +1 -1
  128. package/dist/TimeInput/index.d.ts +1 -1
  129. package/dist/TimeInput/index.js +1 -1
  130. package/dist/{TimeInput-DYAsRNAO.js → TimeInput-BKfg3SZ7.js} +1 -1
  131. package/dist/Timer/index.d.ts +1 -1
  132. package/dist/Timestamp/index.d.ts +1 -1
  133. package/dist/Timestamp/index.js +1 -1
  134. package/dist/{Timestamp-CwNc1inn.js → Timestamp-B7H0KScU.js} +1 -1
  135. package/dist/Toast/index.js +1 -1
  136. package/dist/{Toast-cVNBdW-q.js → Toast-aI9QMW-L.js} +2 -2
  137. package/dist/ToggleButton/index.d.ts +1 -1
  138. package/dist/ToggleButton/index.js +1 -1
  139. package/dist/{ToggleButton-BMn4yJXe.js → ToggleButton-DI9I-LBH.js} +14 -7
  140. package/dist/Token/index.d.ts +1 -1
  141. package/dist/Tokenizer/index.d.ts +1 -1
  142. package/dist/Toolbar/index.d.ts +1 -1
  143. package/dist/Tooltip/index.d.ts +1 -1
  144. package/dist/TopNav/index.d.ts +1 -1
  145. package/dist/composables/index.d.ts +1 -1
  146. package/dist/composables/index.js +1 -1
  147. package/dist/context-BJ9RkXYX.js +676 -0
  148. package/dist/{index-BBTU-TKb.d.ts → index-9eluGe3a.d.ts} +1 -1
  149. package/dist/{index-BU78NOP-.d.ts → index-B0R5CLPF.d.ts} +1 -1
  150. package/dist/{index-BtuK-muv.d.ts → index-B16Jb5mf.d.ts} +9 -9
  151. package/dist/{index-wY6dKz6c.d.ts → index-BEZ4ezJk.d.ts} +2 -2
  152. package/dist/{index-CfPGC9aW.d.ts → index-BMCjAlq6.d.ts} +1 -1
  153. package/dist/{index-D57GW53K.d.ts → index-BMVI4cM5.d.ts} +1 -1
  154. package/dist/{index-D1JXm7Et.d.ts → index-BPf_jmME.d.ts} +1 -1
  155. package/dist/{index-BgT6mH3U.d.ts → index-BR3MOBYd.d.ts} +2 -2
  156. package/dist/{index-CbNLiaWw.d.ts → index-Bfm6mF-r.d.ts} +47 -2
  157. package/dist/{index-CAoenU4T.d.ts → index-BlhbRf58.d.ts} +1 -1
  158. package/dist/{index-wkeCkhTi.d.ts → index-BmYnVNI-.d.ts} +3 -3
  159. package/dist/{index-mkbGYz8f.d.ts → index-Bn-v89Vt.d.ts} +3 -3
  160. package/dist/{index-BDZCJ9ri.d.ts → index-BuubzuE8.d.ts} +2 -2
  161. package/dist/{index-BZuEYd9y.d.ts → index-BvWBeoa8.d.ts} +2 -2
  162. package/dist/{index-BO9TY87G.d.ts → index-BxWCX2pJ.d.ts} +3 -3
  163. package/dist/{index-waTkqxTz.d.ts → index-C89cIh4E.d.ts} +1 -1
  164. package/dist/{index-Q1oG9yIT.d.ts → index-CO9GW-ik.d.ts} +1 -1
  165. package/dist/{index-CvquEEGw.d.ts → index-CXOAA8us.d.ts} +2 -2
  166. package/dist/{index-COgrQZIL.d.ts → index-CdvmnNMH.d.ts} +1 -1
  167. package/dist/{index-BPyRH3WL.d.ts → index-CfXW4km8.d.ts} +1 -1
  168. package/dist/{index-rdwI-mcm.d.ts → index-CtYlR9Cu.d.ts} +1 -1
  169. package/dist/{index-CpG5Wql5.d.ts → index-CvLWh-d-.d.ts} +4 -4
  170. package/dist/{index-CL6DNvOo.d.ts → index-CxdKu7d2.d.ts} +2 -2
  171. package/dist/{index-BzZC2Y7c.d.ts → index-Cz72NaF_.d.ts} +1 -1
  172. package/dist/{index-9tZJgo0R.d.ts → index-D4FgX9h3.d.ts} +2 -2
  173. package/dist/{index-Ukeoz7_9.d.ts → index-DCxdesMw.d.ts} +6 -6
  174. package/dist/{index-C16d2Fc4.d.ts → index-DDAcxZAP.d.ts} +1 -1
  175. package/dist/{index-DCU6dy7n.d.ts → index-DKgonPjs.d.ts} +1 -1
  176. package/dist/{index-C1zwvxPH.d.ts → index-DY8Wph-A.d.ts} +2 -2
  177. package/dist/{index-qayqGnJT.d.ts → index-DZKv1WNB.d.ts} +1 -1
  178. package/dist/{index-dWlCpnua.d.ts → index-Dlq0cFK-.d.ts} +3 -3
  179. package/dist/{index--tm6L1ot.d.ts → index-DpYJBFJj.d.ts} +1 -1
  180. package/dist/{index-DN1RqxjP.d.ts → index-DxR6cZBf.d.ts} +1 -1
  181. package/dist/{index-IFFGXlhq.d.ts → index-GmoeIuhl.d.ts} +1 -1
  182. package/dist/{index-CEHqYyz5.d.ts → index-MOtVbTwK.d.ts} +3 -3
  183. package/dist/{index-DhMCql2U.d.ts → index-NHtQmIIM.d.ts} +1 -1
  184. package/dist/{index-D44l1Esr.d.ts → index-dRBNR7Tq.d.ts} +62 -62
  185. package/dist/{index-Dy746dfn.d.ts → index-unAZVFGz.d.ts} +1 -1
  186. package/dist/index.d.ts +46 -46
  187. package/dist/index.js +39 -39
  188. package/dist/{semantic-CXHSMwPK.d.ts → semantic-Dj507RuV.d.ts} +1 -1
  189. package/dist/{types-Dcai2Icw.d.ts → types-D8t_HevJ.d.ts} +1 -0
  190. package/dist/{types-hB0M54I7.d.ts → types-DRpOiAlm.d.ts} +1 -1
  191. package/dist/{types-BwVJBE-G.d.ts → types-bAQk3F8G.d.ts} +1 -1
  192. package/dist/{types-Bq4Yl6CS.d.ts → types-uWxXh1Jm.d.ts} +7 -2
  193. package/dist/{useActionGroupTracking-BncJjk1A.js → useActionGroupTracking-B4niQ_tR.js} +3 -3
  194. package/dist/{useInputStatusIcon-DCnx00BM.js → useInputStatusIcon-Da2FiXwF.js} +1 -1
  195. package/package.json +1 -1
  196. package/styles/avatar.css +2 -2
  197. package/styles/badge.css +8 -0
  198. package/styles/button.css +3 -0
  199. package/styles/chat.css +10 -3
  200. package/styles/dropdown-menu.css +3 -3
  201. package/styles/field.css +9 -9
  202. package/styles/icon.css +4 -0
  203. package/styles/input-group.css +6 -6
  204. package/styles/list.css +7 -0
  205. package/styles/more-menu.css +4 -4
  206. package/styles/number-input.css +6 -6
  207. package/styles/power-search.css +3 -3
  208. package/styles/progress-bar.css +8 -0
  209. package/styles/status-dot.css +21 -1
  210. package/styles/stepper.css +11 -3
  211. package/styles/text-area.css +1 -1
  212. package/styles/touch-hit-area.css +37 -0
  213. package/styles.css +1 -0
  214. package/dist/context-CZP3jfy-.js +0 -125
  215. package/dist/{index-5FGt4HsB.d.ts → index-J6YRJ7Ul.d.ts} +1 -1
@@ -193,4 +193,12 @@
193
193
  animation-duration: 3s;
194
194
  }
195
195
  }
196
+
197
+ /* 强制配色会把填充色换成 Canvas,补一圈边让进度还看得见。 */
198
+ @media (forced-colors: active) {
199
+ .astryx-progress-bar-fill {
200
+ outline: 1px solid CanvasText;
201
+ outline-offset: -1px;
202
+ }
203
+ }
196
204
  }
@@ -51,8 +51,20 @@
51
51
  color: var(--astryx-status-dot-accent-icon-foreground, var(--astryx-color-on-accent, #fff));
52
52
  }
53
53
 
54
+ .astryx-status-dot[data-variant='info'] .astryx-status-dot__icon {
55
+ color: var(--astryx-status-dot-icon-foreground, var(--astryx-color-on-info, #fff));
56
+ }
57
+
58
+ .astryx-status-dot[data-variant='success'] .astryx-status-dot__icon {
59
+ color: var(--astryx-status-dot-icon-foreground, var(--astryx-color-on-success, #fff));
60
+ }
61
+
54
62
  .astryx-status-dot[data-variant='warning'] .astryx-status-dot__icon {
55
- color: var(--astryx-status-dot-warning-icon-foreground, #171717);
63
+ color: var(--astryx-status-dot-warning-icon-foreground, var(--astryx-color-on-warning, #171717));
64
+ }
65
+
66
+ .astryx-status-dot[data-variant='error'] .astryx-status-dot__icon {
67
+ color: var(--astryx-status-dot-icon-foreground, var(--astryx-color-on-error, #fff));
56
68
  }
57
69
 
58
70
  .astryx-status-dot--pulsing {
@@ -69,4 +81,12 @@
69
81
  0%, 100% { opacity: 1; }
70
82
  50% { opacity: 0.4; }
71
83
  }
84
+
85
+ /* 强制配色会把状态底色换成 Canvas,补一圈边让圆点的形状还看得见。 */
86
+ @media (forced-colors: active) {
87
+ .astryx-status-dot:is([data-variant='info'], [data-variant='success'], [data-variant='warning'], [data-variant='error']) {
88
+ outline: 1px solid CanvasText;
89
+ outline-offset: -1px;
90
+ }
91
+ }
72
92
  }
@@ -298,17 +298,17 @@
298
298
 
299
299
  .astryx-step-indicator[data-status='success'] {
300
300
  background: transparent;
301
- color: var(--astryx-color-success, #16a34a);
301
+ color: var(--astryx-color-icon-success, #16a34a);
302
302
  }
303
303
 
304
304
  .astryx-step-indicator[data-status='warning'] {
305
305
  background: transparent;
306
- color: var(--astryx-color-warning, #ca8a04);
306
+ color: var(--astryx-color-icon-warning, #ca8a04);
307
307
  }
308
308
 
309
309
  .astryx-step-indicator[data-status='error'] {
310
310
  background: transparent;
311
- color: var(--astryx-color-error, #dc2626);
311
+ color: var(--astryx-color-icon-error, #dc2626);
312
312
  }
313
313
 
314
314
  /* 指示点自带 data-progress / data-status:嵌套的步骤条不会吃到外层步骤的状态。 */
@@ -485,4 +485,12 @@
485
485
  transition-delay: 0s;
486
486
  }
487
487
  }
488
+
489
+ /* 强制配色会把数字徽标的底色换成 Canvas,补一圈边让徽标的形状还看得见。 */
490
+ @media (forced-colors: active) {
491
+ .astryx-step-indicator[data-glyph='number'] {
492
+ outline: 1px solid CanvasText;
493
+ outline-offset: -1px;
494
+ }
495
+ }
488
496
  }
@@ -33,7 +33,7 @@
33
33
  }
34
34
 
35
35
  .astryx-text-area-count[data-over='true'] {
36
- color: var(--astryx-input-error, #e33f4a);
36
+ color: var(--astryx-color-text-error, #e33f4a);
37
37
  }
38
38
 
39
39
  .astryx-text-area:has(.astryx-text-area-count) {
@@ -0,0 +1,37 @@
1
+ @layer astryx.reset, astryx.tokens, astryx.base, astryx.components, astryx.overrides;
2
+
3
+ /*
4
+ * 触控热区:粗指针下,一个透明的伪元素从被测元素的边框盒往外伸出 `--astryx-hit-inset-*`
5
+ * (useTouchHitArea 测量后写在被测元素上,往下继承)。按在它上面就是按在宿主上,
6
+ * 宿主自己的盒子不变。细指针下没有这个伪元素。
7
+ *
8
+ * - `.astryx-touch-hit-area`:画在 `::after` 上。伪元素的包含块是最近的定位祖先,
9
+ * 它就得是被测的那个元素。Button 把类放在内容包裹层上,热区以按钮为包含块,
10
+ * 按钮自己的 `::before`(触屏按压)和 `::after` 留给原来的用途。
11
+ * - `.astryx-touch-hit-area-below`:画在宿主自己的 `::before` 上,宿主就是包含块。
12
+ * 成员铺满盒子的组用它,定位的成员画在热区上面,成员自己那块的点按还是成员的。
13
+ *
14
+ * 偏移从包含块的内边距盒算起,测量从边框盒算起。宿主有边框时在 `--_hit-border`
15
+ * 里给出边框宽度,用负外边距补上;宽度写成不带单位的 0 时外边距的 calc 无效,正好退回 0。
16
+ */
17
+ @layer astryx.components {
18
+ @media (pointer: coarse) {
19
+ .astryx-touch-hit-area::after,
20
+ .astryx-touch-hit-area-below::before {
21
+ content: '';
22
+ position: absolute;
23
+ inset:
24
+ calc(var(--astryx-hit-inset-top, 0px) * -1)
25
+ calc(var(--astryx-hit-inset-right, 0px) * -1)
26
+ calc(var(--astryx-hit-inset-bottom, 0px) * -1)
27
+ calc(var(--astryx-hit-inset-left, 0px) * -1);
28
+ margin: calc(var(--_hit-border, 0px) * -1);
29
+ /* 宿主内容被隐藏(忙碌时)也照样接点按。 */
30
+ visibility: visible;
31
+ }
32
+
33
+ .astryx-touch-hit-area-below {
34
+ position: relative;
35
+ }
36
+ }
37
+ }
package/styles.css CHANGED
@@ -101,6 +101,7 @@
101
101
  @import './styles/toolbar.css';
102
102
  @import './styles/tooltip.css';
103
103
  @import './styles/top-nav.css';
104
+ @import './styles/touch-hit-area.css';
104
105
  @import './styles/tree-list.css';
105
106
  @import './styles/typeahead.css';
106
107
  @import './styles/visually-hidden.css';
@@ -1,125 +0,0 @@
1
- import { c as PRESS_GROUP_ITEM_ATTRIBUTE, l as isTrackedByGroup, r as pressFadeMs, t as PRESSED_ATTRIBUTE } from "./pressFeedback-Bwwpex9q.js";
2
- import { t as armStrayClick } from "./strayClick-CY-_ImKv.js";
3
- import { t as defineLayerScopedKey } from "./scopedProvide-C-Df7c15.js";
4
- //#region src/composables/internal/actionGroupTracker.ts
5
- /** 组跟踪手指和笔的滑动;鼠标保持原生按钮的行为。 */
6
- const GROUP_PRESS_POINTERS = ["touch", "pen"];
7
- /** 不可用的动作不亮也不执行。 */
8
- const DISABLED = ":disabled, [aria-disabled=\"true\"]";
9
- /** 摊到组跟踪的每个动作上的标记。 */
10
- function pressGroupItemProps(pointerTypes = GROUP_PRESS_POINTERS) {
11
- return { [PRESS_GROUP_ITEM_ATTRIBUTE]: pointerTypes.join(" ") };
12
- }
13
- function measure(root, pointerType) {
14
- const actions = [];
15
- for (const element of root.querySelectorAll(`[${PRESS_GROUP_ITEM_ATTRIBUTE}]`)) {
16
- if (element.matches(DISABLED) || !isTrackedByGroup(element, pointerType)) continue;
17
- const { left, top, right, bottom } = element.getBoundingClientRect();
18
- actions.push({
19
- element,
20
- left,
21
- top,
22
- right,
23
- bottom
24
- });
25
- }
26
- return actions;
27
- }
28
- function createActionGroupTracker() {
29
- let actions = [];
30
- let highlighted = null;
31
- let landedOn = null;
32
- let isTracking = false;
33
- const fades = /* @__PURE__ */ new Map();
34
- function clearFade(element) {
35
- const fade = fades.get(element);
36
- if (fade != null) {
37
- clearTimeout(fade);
38
- fades.delete(element);
39
- }
40
- }
41
- function paint(element, state) {
42
- if (element == null) return;
43
- clearFade(element);
44
- if (state === "none") {
45
- element.removeAttribute(PRESSED_ATTRIBUTE);
46
- return;
47
- }
48
- element.setAttribute(PRESSED_ATTRIBUTE, state);
49
- if (state === "fading") fades.set(element, setTimeout(() => {
50
- fades.delete(element);
51
- if (element.getAttribute("data-astryx-press") === "fading") element.removeAttribute(PRESSED_ATTRIBUTE);
52
- }, pressFadeMs(element)));
53
- }
54
- /** 手指下的动作。没有布局(测试环境)时几个矩形都包含这个点,落点所在的那个优先。 */
55
- function actionAt(x, y) {
56
- let first = null;
57
- for (const action of actions) {
58
- if (x < action.left || x > action.right || y < action.top || y > action.bottom) continue;
59
- if (landedOn != null && action.element.contains(landedOn)) return action.element;
60
- first ??= action.element;
61
- }
62
- return first;
63
- }
64
- function highlight(next) {
65
- if (next === highlighted) return;
66
- paint(highlighted, "none");
67
- highlighted = next;
68
- paint(next, "on");
69
- }
70
- function reset() {
71
- actions = [];
72
- highlighted = null;
73
- landedOn = null;
74
- isTracking = false;
75
- }
76
- return {
77
- begin(root, pointerType, x, y, landed) {
78
- paint(highlighted, "none");
79
- highlighted = null;
80
- actions = measure(root, pointerType);
81
- landedOn = landed;
82
- isTracking = true;
83
- highlight(actionAt(x, y));
84
- return highlighted;
85
- },
86
- move(x, y) {
87
- if (isTracking) highlight(actionAt(x, y));
88
- },
89
- end() {
90
- const lifted = highlighted;
91
- const wasTracking = isTracking;
92
- reset();
93
- if (!wasTracking || lifted == null) return null;
94
- paint(lifted, "fading");
95
- if (lifted.matches(DISABLED)) return null;
96
- armStrayClick(lifted.ownerDocument);
97
- lifted.click();
98
- return lifted;
99
- },
100
- cancel() {
101
- paint(highlighted, "none");
102
- reset();
103
- },
104
- get highlighted() {
105
- return highlighted;
106
- },
107
- get isTracking() {
108
- return isTracking;
109
- },
110
- dispose() {
111
- for (const [element, fade] of fades) {
112
- clearTimeout(fade);
113
- if (element.getAttribute("data-astryx-press") === "fading") element.removeAttribute(PRESSED_ATTRIBUTE);
114
- }
115
- fades.clear();
116
- paint(highlighted, "none");
117
- reset();
118
- }
119
- };
120
- }
121
- //#endregion
122
- //#region src/Button/context.ts
123
- const buttonGroupContextKey = defineLayerScopedKey("astryx-button-group", null);
124
- //#endregion
125
- export { pressGroupItemProps as i, GROUP_PRESS_POINTERS as n, createActionGroupTracker as r, buttonGroupContextKey as t };
@@ -44,8 +44,8 @@ declare const __VLS_base: import("vue").DefineComponent<TokenProps, {}, {}, {},
44
44
  }>, {
45
45
  size: TokenSize;
46
46
  disabled: boolean;
47
- labelHidden: boolean;
48
47
  color: "default" | "blue" | "cyan" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "teal" | "yellow";
48
+ labelHidden: boolean;
49
49
  removable: boolean;
50
50
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
51
51
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;