@astryx-vue/core 0.33.2 → 0.33.4

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 (320) hide show
  1. package/dist/AlertDialog/index.js +1 -1
  2. package/dist/{AlertDialog-BwW3jdTg.js → AlertDialog-CwyMvZEI.js} +9 -9
  3. package/dist/AppShell/index.js +1 -1
  4. package/dist/{AppShell-BURF50V8.js → AppShell-4hWTPKSD.js} +5 -5
  5. package/dist/Avatar/index.js +1 -1
  6. package/dist/{Avatar-CcmhCa5q.js → Avatar-C6E6TYbe.js} +1 -1
  7. package/dist/AvatarGroup/index.d.ts +1 -1
  8. package/dist/AvatarGroup/index.js +1 -1
  9. package/dist/{AvatarGroup-DJKoExQk.js → AvatarGroup-BIPixZOb.js} +1 -1
  10. package/dist/Banner/index.d.ts +1 -1
  11. package/dist/Banner/index.js +1 -1
  12. package/dist/{Banner-DSSXXFU9.js → Banner-CMXebR4Y.js} +1 -1
  13. package/dist/BottomSheet/index.js +2 -2
  14. package/dist/{BottomSheet-KUGb-GPw.js → BottomSheet-BmmGemH5.js} +1 -1
  15. package/dist/{BottomSheet-Jq7g0EWd.js → BottomSheet-DKEUVLe5.js} +9 -9
  16. package/dist/Breadcrumbs/index.js +2 -2
  17. package/dist/{Breadcrumbs-BEx7_LpB.js → Breadcrumbs-BPxPAEHQ.js} +1 -1
  18. package/dist/Button/index.d.ts +1 -1
  19. package/dist/Button/index.js +1 -1
  20. package/dist/{Button-BlWhnkeM.js → Button-B7PvGVt6.js} +4 -4
  21. package/dist/ButtonGroup/index.d.ts +1 -1
  22. package/dist/ButtonGroup/index.js +1 -1
  23. package/dist/{ButtonGroup-D3pGXH3t.js → ButtonGroup-BkwQ0h97.js} +2 -2
  24. package/dist/Calendar/index.d.ts +1 -1
  25. package/dist/Card/index.d.ts +1 -1
  26. package/dist/Carousel/index.d.ts +1 -1
  27. package/dist/Carousel/index.js +1 -1
  28. package/dist/{Carousel-XHo3AGQj.js → Carousel-BmfKiv69.js} +1 -1
  29. package/dist/Chat/index.d.ts +1 -1
  30. package/dist/Chat/index.js +1 -1
  31. package/dist/{Chat-B0c_CxBk.js → Chat-2AG37D51.js} +5 -5
  32. package/dist/CheckboxInput/index.d.ts +1 -1
  33. package/dist/CheckboxInput/index.js +1 -1
  34. package/dist/{CheckboxInput-DCeCsNvg.js → CheckboxInput-rbMgS8ZL.js} +79 -74
  35. package/dist/CheckboxList/index.d.ts +1 -1
  36. package/dist/CheckboxList/index.js +1 -1
  37. package/dist/{CheckboxListItem-CGC_EBYs.js → CheckboxListItem-Ckt1Cwt_.js} +5 -5
  38. package/dist/ClickableCard/index.d.ts +1 -1
  39. package/dist/ClickableCard/index.js +1 -1
  40. package/dist/{ClickableCard-aU0QED8P.js → ClickableCard-Dh0tOQv-.js} +1 -1
  41. package/dist/Code/index.js +1 -1
  42. package/dist/{CodeBlock-ClZvd61o.js → CodeBlock-ZluDuBT7.js} +1 -1
  43. package/dist/Collapsible/index.js +1 -1
  44. package/dist/{Collapsible-BAup__Sy.js → Collapsible-B_9H2wV_.js} +3 -3
  45. package/dist/CommandPalette/index.js +1 -1
  46. package/dist/{CommandPalette-CvalZZHH.js → CommandPalette-Cbr-WWC8.js} +2 -2
  47. package/dist/ComplexSelector/index.d.ts +1 -1
  48. package/dist/ComplexSelector/index.js +1 -1
  49. package/dist/{ComplexSelector-DIwWcWwi.js → ComplexSelector-BPvBCUJk.js} +2 -2
  50. package/dist/ContextMenu/index.d.ts +1 -1
  51. package/dist/ContextMenu/index.js +2 -2
  52. package/dist/{ContextMenu-BnX93m0D.js → ContextMenu-BF4ALBZn.js} +6 -6
  53. package/dist/DateInput/index.d.ts +1 -1
  54. package/dist/DateInput/index.js +1 -1
  55. package/dist/{DateInput-BFjeik3X.js → DateInput-C7PICKR2.js} +4 -4
  56. package/dist/DateRangeInput/index.d.ts +1 -1
  57. package/dist/DateRangeInput/index.js +1 -1
  58. package/dist/{DateRangeInput-Cnrp5SDW.js → DateRangeInput-Dt-BA7AA.js} +3 -3
  59. package/dist/DateTimeInput/index.d.ts +1 -1
  60. package/dist/DateTimeInput/index.js +1 -1
  61. package/dist/{DateTimeInput-Zsf86rSO.js → DateTimeInput-XEESzGJf.js} +5 -5
  62. package/dist/Dialog/index.d.ts +1 -1
  63. package/dist/Dialog/index.js +3 -3
  64. package/dist/{Dialog-Bl5CCsoX.js → Dialog-B1xC9xMC.js} +2 -2
  65. package/dist/{Dialog-DIWIrzgk.js → Dialog-BmdNX3NC.js} +1 -1
  66. package/dist/{DialogHeader-DbWkeIrf.js → DialogHeader-DcP4xAk3.js} +2 -2
  67. package/dist/Divider/index.d.ts +1 -1
  68. package/dist/Drawer/index.d.ts +1 -1
  69. package/dist/Drawer/index.js +1 -1
  70. package/dist/{Drawer-MdC2BxbG.js → Drawer-CdHbZffI.js} +2 -2
  71. package/dist/DropdownMenu/index.js +2 -2
  72. package/dist/{DropdownMenu-4o8qS78m.js → DropdownMenu-C1494BkC.js} +9 -9
  73. package/dist/EmptyState/index.js +1 -1
  74. package/dist/{EmptyState-CeZXvaPU.js → EmptyState-BAP8BpDj.js} +2 -2
  75. package/dist/Field/index.js +3 -3
  76. package/dist/{Field-CrTrfcXB.js → Field-KszpxUdx.js} +1 -1
  77. package/dist/{FieldInfoTip-C3Ztw-wI.js → FieldInfoTip-CY9BTVtK.js} +1 -1
  78. package/dist/{FieldLabel-CFE2WC_i.js → FieldLabel-KPCTcJpO.js} +1 -1
  79. package/dist/FileInput/index.js +1 -1
  80. package/dist/{FileInput-BhO1SCw-.js → FileInput-BTIn6OoY.js} +3 -3
  81. package/dist/Heading/index.d.ts +1 -1
  82. package/dist/Heading/index.js +1 -1
  83. package/dist/{Heading-AZCa8gid.js → Heading-D94VFJtm.js} +1 -1
  84. package/dist/HoverCard/index.d.ts +1 -1
  85. package/dist/HoverCard/index.js +1 -1
  86. package/dist/{HoverCard-C4VR_GZ0.js → HoverCard-rwpyd6nt.js} +4 -4
  87. package/dist/IconButton/index.js +1 -1
  88. package/dist/{IconButton-CqWEkha9.js → IconButton-e5xeGow-.js} +1 -1
  89. package/dist/InfoTip/index.d.ts +1 -1
  90. package/dist/InfoTip/index.js +1 -1
  91. package/dist/{InfoTip-Dps1Aaem.js → InfoTip-DpvV8zrm.js} +2 -2
  92. package/dist/{InputClearButton-Xjvkkq7B.js → InputClearButton-BzxJH6mk.js} +1 -1
  93. package/dist/InputGroup/index.d.ts +1 -1
  94. package/dist/InputGroup/index.js +1 -1
  95. package/dist/{InputGroup-gYIGs7VH.js → InputGroup-Bj4hksiI.js} +1 -1
  96. package/dist/{Item-FxMSEuU3.js → Item-D62Cibn1.js} +2 -2
  97. package/dist/{LayerContentBoundary-C7VZOgMs.js → LayerContentBoundary-CTjEpdM4.js} +1 -1
  98. package/dist/Layout/index.js +2 -2
  99. package/dist/{Layout-D6UhyoVb.js → Layout-SJoCw8NC.js} +1 -1
  100. package/dist/{LayoutPanel-DfS5TvSP.js → LayoutPanel-DZN4RxX6.js} +1 -1
  101. package/dist/Lightbox/index.js +1 -1
  102. package/dist/{Lightbox-76vHqGA0.js → Lightbox-FWtAn7X5.js} +1 -1
  103. package/dist/Link/index.d.ts +1 -1
  104. package/dist/Link/index.js +1 -1
  105. package/dist/{Link-QPBGLcTk.js → Link-BxK3lbA-.js} +2 -2
  106. package/dist/List/index.d.ts +1 -1
  107. package/dist/List/index.js +2 -2
  108. package/dist/{ListItem-Ss6Kw90l.js → ListItem-B4jt3EXr.js} +4 -4
  109. package/dist/Markdown/index.js +1 -1
  110. package/dist/{Markdown-Cz6wbx9z.js → Markdown-CsoseOGe.js} +3 -3
  111. package/dist/MobileNav/index.js +1 -1
  112. package/dist/{MobileNavToggle-CCJBX2fq.js → MobileNavToggle-AgT6hzTg.js} +2 -2
  113. package/dist/MoreMenu/index.d.ts +1 -1
  114. package/dist/MoreMenu/index.js +1 -1
  115. package/dist/{MoreMenu-OOQAeJT9.js → MoreMenu-4zcxptan.js} +8 -8
  116. package/dist/MultiSelector/index.d.ts +1 -1
  117. package/dist/MultiSelector/index.js +1 -1
  118. package/dist/{MultiSelector-9HGDsMQE.js → MultiSelector-LuAE71wE.js} +6 -6
  119. package/dist/{NavDisclosure-BTeZLyLq.js → NavDisclosure-CSnUZY3k.js} +1 -1
  120. package/dist/{NavHeadingSurface-DPmolgVb.js → NavHeadingSurface-C3fTf5--.js} +1 -1
  121. package/dist/NavItem/index.d.ts +1 -1
  122. package/dist/NavItem/index.js +1 -1
  123. package/dist/{NavItem-BL3g0YUf.js → NavItem-mcmzIshL.js} +1 -1
  124. package/dist/NavMenu/index.js +3 -3
  125. package/dist/{NavMenu-DcTh1DCM.js → NavMenu-Bp35Bk7_.js} +2 -2
  126. package/dist/{NavMenuItem-Dmsno5s3.js → NavMenuItem-DviXkleh.js} +3 -3
  127. package/dist/NumberInput/index.d.ts +1 -1
  128. package/dist/NumberInput/index.js +1 -1
  129. package/dist/{NumberInput-DWYCcrUw.js → NumberInput-CxzhFPQw.js} +3 -3
  130. package/dist/Outline/index.js +1 -1
  131. package/dist/{Outline-DGtPcD0U.js → Outline-KpA-ffCT.js} +3 -3
  132. package/dist/OverflowList/index.d.ts +1 -1
  133. package/dist/OverflowList/index.js +1 -1
  134. package/dist/{OverflowList-EIr4jQjY.js → OverflowList-DRZxrAYq.js} +2 -2
  135. package/dist/Overlay/index.d.ts +1 -1
  136. package/dist/Pagination/index.d.ts +1 -1
  137. package/dist/Pagination/index.js +1 -1
  138. package/dist/{Pagination-Ch7-xIFe.js → Pagination-B3JMAlnl.js} +2 -2
  139. package/dist/PanGestureRecognizer-R5y8LZ9h.js +681 -0
  140. package/dist/Popover/index.d.ts +1 -1
  141. package/dist/Popover/index.js +1 -1
  142. package/dist/{Popover-LSIKv1zS.js → Popover-CQr95J2s.js} +10 -10
  143. package/dist/PowerSearch/index.d.ts +1 -1
  144. package/dist/PowerSearch/index.js +1 -1
  145. package/dist/{PowerSearch-Cjkv0qON.js → PowerSearch-BEaqgsZa.js} +26 -26
  146. package/dist/PressTracker-Dze87pxw.js +190 -0
  147. package/dist/ProgressBar/index.d.ts +1 -1
  148. package/dist/ProgressBar/index.js +1 -1
  149. package/dist/{ProgressBar-nPERcjvJ.js → ProgressBar-ChgsiVRR.js} +3 -3
  150. package/dist/Radio/index.d.ts +1 -1
  151. package/dist/Radio/index.js +1 -1
  152. package/dist/{RadioGroup-BWFVn7Gd.js → RadioGroup-CpMYh9eL.js} +9 -6
  153. package/dist/RadioList/index.d.ts +1 -1
  154. package/dist/RadioList/index.js +1 -1
  155. package/dist/{RadioListItem-D1rnSZeL.js → RadioListItem-n-h5r1GO.js} +1 -1
  156. package/dist/Resizable/index.d.ts +1 -1
  157. package/dist/Resizable/index.js +1 -1
  158. package/dist/{ResizeHandle-DyjQfxxG.js → ResizeHandle-J9-dAMuo.js} +2 -2
  159. package/dist/ScrollableArea/index.d.ts +1 -1
  160. package/dist/SegmentedControl/index.js +1 -1
  161. package/dist/SegmentedControl-nz9d6e0y.js +1465 -0
  162. package/dist/SelectableCard/index.d.ts +1 -1
  163. package/dist/SelectableCard/index.js +1 -1
  164. package/dist/{SelectableCard-uDblNb5T.js → SelectableCard-C018jluo.js} +1 -1
  165. package/dist/Selector/index.d.ts +1 -1
  166. package/dist/Selector/index.js +1 -1
  167. package/dist/{Selector-BiLcyM3Y.js → Selector-CW1jaM4F.js} +4 -4
  168. package/dist/SideNav/index.d.ts +1 -1
  169. package/dist/SideNav/index.js +2 -2
  170. package/dist/{SideNav-d0A9mlEW.js → SideNav-DgRpBPuP.js} +9 -9
  171. package/dist/Slider/index.js +1 -1
  172. package/dist/Slider-Bz72itTP.js +1786 -0
  173. package/dist/Stack/index.d.ts +1 -1
  174. package/dist/StatusDot/index.js +1 -1
  175. package/dist/{StatusDot-D3z-WEGn.js → StatusDot-D7nVuPg7.js} +1 -1
  176. package/dist/Stepper/index.d.ts +1 -1
  177. package/dist/Stepper/index.js +1 -1
  178. package/dist/{Stepper-CePOs80C.js → Stepper-Af_rH8C4.js} +1 -1
  179. package/dist/Switch/index.d.ts +1 -1
  180. package/dist/Switch/index.js +1 -1
  181. package/dist/Switch-BYsb1gKn.js +1397 -0
  182. package/dist/TabList/index.d.ts +1 -1
  183. package/dist/TabList/index.js +1 -1
  184. package/dist/{TabList-CthDI2i1.js → TabList-Cgw2IuL-.js} +3 -3
  185. package/dist/Table/index.d.ts +1 -1
  186. package/dist/Table/index.js +1 -1
  187. package/dist/{Table-egoY0slV.js → Table-DzE-4_og.js} +12 -12
  188. package/dist/Text/index.d.ts +1 -1
  189. package/dist/Text/index.js +1 -1
  190. package/dist/{Text-CGb1rxyK.js → Text-kwsIut3C.js} +1 -1
  191. package/dist/TextArea/index.d.ts +1 -1
  192. package/dist/TextArea/index.js +1 -1
  193. package/dist/{TextArea-B3WlT4sr.js → TextArea-DrYMTaZm.js} +4 -4
  194. package/dist/TextInput/index.d.ts +1 -1
  195. package/dist/TextInput/index.js +1 -1
  196. package/dist/{TextInput-C4CqgE0E.js → TextInput-B-1cuwcB.js} +4 -4
  197. package/dist/Thumbnail/index.js +1 -1
  198. package/dist/{Thumbnail-6YWZ9a2A.js → Thumbnail-DeMaRkDU.js} +3 -3
  199. package/dist/{TimeField-CvBKO_Ew.js → TimeField-C1Nv-fz3.js} +3 -3
  200. package/dist/TimeInput/index.d.ts +1 -1
  201. package/dist/TimeInput/index.js +1 -1
  202. package/dist/{TimeInput-Cl9HIZrP.js → TimeInput-Dvh6qqHI.js} +2 -2
  203. package/dist/Timer/index.d.ts +1 -1
  204. package/dist/Timer/index.js +1 -1
  205. package/dist/{Timer-BNa_W8zr.js → Timer-B-9sSJWK.js} +1 -1
  206. package/dist/Timestamp/index.d.ts +1 -1
  207. package/dist/Timestamp/index.js +1 -1
  208. package/dist/{Timestamp-D_NTXtxz.js → Timestamp-wFkl39dn.js} +3 -3
  209. package/dist/Toast/index.js +1 -1
  210. package/dist/{Toast-E6NqFf3W.js → Toast-CO6Z1r1s.js} +5 -3
  211. package/dist/ToggleButton/index.d.ts +1 -1
  212. package/dist/ToggleButton/index.js +1 -1
  213. package/dist/{ToggleButton-ih92QX-K.js → ToggleButton-DPpjDYxP.js} +3 -3
  214. package/dist/Token/index.js +1 -1
  215. package/dist/{Token-DE1udaRF.js → Token-DZkUAIYA.js} +1 -1
  216. package/dist/Tokenizer/index.js +1 -1
  217. package/dist/{Tokenizer-DbD2ZBuh.js → Tokenizer-CX7D4klL.js} +13 -13
  218. package/dist/Toolbar/index.d.ts +1 -1
  219. package/dist/Tooltip/index.d.ts +1 -1
  220. package/dist/Tooltip/index.js +2 -2
  221. package/dist/{Tooltip-sXtW5dTD.js → Tooltip-DyGaJUbl.js} +1 -1
  222. package/dist/TopNav/index.d.ts +1 -1
  223. package/dist/TopNav/index.js +1 -1
  224. package/dist/{TopNav-D688LaUK.js → TopNav-D8Hc_kQ-.js} +5 -5
  225. package/dist/TreeList/index.d.ts +1 -1
  226. package/dist/TreeList/index.js +1 -1
  227. package/dist/{TreeList-BFKPBFKu.js → TreeList-lNyuRBOk.js} +4 -4
  228. package/dist/Typeahead/index.js +2 -2
  229. package/dist/{Typeahead-BwjzOjT4.js → Typeahead-BiosTaFo.js} +5 -5
  230. package/dist/{VelocityTracker-bns4TzMt.js → VelocityTracker-CPFBHDpy.js} +1 -1
  231. package/dist/{accessibleName-nYUMoSTW.js → accessibleName-f5xApbXG.js} +2 -2
  232. package/dist/{animator-DnLs_cbV.js → animator-ozeBZ_zC.js} +3 -3
  233. package/dist/{assertOptions-BdLvkG6M.js → assertOptions-Byu4Yqfg.js} +1 -1
  234. package/dist/boxHold-YML2o6iP.js +170 -0
  235. package/dist/browserClickWait-DIj9tkLa.js +77 -0
  236. package/dist/{clickGuard-C3VmOLhI.js → clickGuard-CxqcfBCJ.js} +2 -2
  237. package/dist/{coarsePointer-BfMx3H23.js → coarsePointer-BWNSUIY8.js} +2 -32
  238. package/dist/composables/index.js +10 -10
  239. package/dist/{composables-B9tgZEzP.js → composables-CPDafrux.js} +12 -9
  240. package/dist/{context-Dktfy1fh.js → context-C1MPE6J5.js} +1 -1
  241. package/dist/{useAttachment-CALrXA-t.js → geometry-CGa3nNzZ.js} +14 -837
  242. package/dist/{gestures-CppaWqif.js → gestures-yKyyMqeQ.js} +225 -1
  243. package/dist/{holdEntranceInput-DgimbgGm.js → holdEntranceInput-C8B_DYYs.js} +2 -2
  244. package/dist/{index-MOtVbTwK.d.ts → index-B6GTqpW-.d.ts} +4 -4
  245. package/dist/{index-X4S7_dmq.d.ts → index-BA8exXNP.d.ts} +1 -1
  246. package/dist/{index-D7ShT2c-.d.ts → index-BB9acgK8.d.ts} +2 -2
  247. package/dist/{index-BuubzuE8.d.ts → index-BDZCJ9ri.d.ts} +2 -2
  248. package/dist/{index-D65x5ny5.d.ts → index-BdICULsZ.d.ts} +78 -78
  249. package/dist/{index-maTGrWjF.d.ts → index-BenG-F5d.d.ts} +1 -1
  250. package/dist/{index-3LdpzxQZ.d.ts → index-BfFpUr1B.d.ts} +1 -1
  251. package/dist/{index-CTjkJP4x.d.ts → index-Bgk1Rj2A.d.ts} +1 -1
  252. package/dist/{index-CKnr0JlT.d.ts → index-C4S65SAW.d.ts} +1 -1
  253. package/dist/{index-waTkqxTz.d.ts → index-C89cIh4E.d.ts} +1 -1
  254. package/dist/{index-D05JGsT3.d.ts → index-C8wfe0Mr.d.ts} +1 -1
  255. package/dist/{index-Cm36VS1A.d.ts → index-C9uW39Mj.d.ts} +1 -1
  256. package/dist/{index-AgTJRqUY.d.ts → index-CQi9WGWE.d.ts} +2 -2
  257. package/dist/{index-Bwh8O-v8.d.ts → index-CZ29Xu_E.d.ts} +1 -1
  258. package/dist/{index-85y5NZP-.d.ts → index-CpkQlo1t.d.ts} +2 -2
  259. package/dist/{index-rdwI-mcm.d.ts → index-CtYlR9Cu.d.ts} +1 -1
  260. package/dist/{index-DWVhyvVu.d.ts → index-CukA-J8A.d.ts} +6 -6
  261. package/dist/{index-eCp-ElSp.d.ts → index-DYabo8TI.d.ts} +1 -1
  262. package/dist/{index-CM00rrgg.d.ts → index-DhrnMYVh.d.ts} +3 -3
  263. package/dist/{index-BOiwoyXq.d.ts → index-DlsrR4Gm.d.ts} +8 -8
  264. package/dist/{index-Otl047R1.d.ts → index-DofC9Rll.d.ts} +1 -1
  265. package/dist/{index-CArP_6wv.d.ts → index-ZXrvTM3A.d.ts} +1 -1
  266. package/dist/{index-CbA8rR_b.d.ts → index-a_FOKJMw.d.ts} +2 -2
  267. package/dist/{index-CdvmnNMH.d.ts → index-jz9GfvS0.d.ts} +1 -1
  268. package/dist/{index-Ak1b0V24.d.ts → index-tdOyqA_U.d.ts} +1 -1
  269. package/dist/index.d.ts +25 -25
  270. package/dist/index.js +101 -101
  271. package/dist/{inputHold-DW2LYHb5.js → inputHold-BJtjc9iI.js} +4 -4
  272. package/dist/{inputHoldState-xntIqr5W.js → inputHoldState-BYi5FKZl.js} +2 -2
  273. package/dist/{inputStream-bPd9eB2b.js → inputStream-HXw2lZ-3.js} +1 -1
  274. package/dist/{landing-9mjHGn26.js → landing-BW6qLvC8.js} +1 -1
  275. package/dist/{layerDepth-c3jUndA2.js → layerDepth-SGFJ5L6X.js} +1 -1
  276. package/dist/{lazyBottomSheet-Ca7Mdou2.js → lazyBottomSheet-Bg5E8lr3.js} +1 -1
  277. package/dist/{linearEasing-CBwOorE7.js → linearEasing-VHwy6xl_.js} +1 -1
  278. package/dist/{presentation-Cy_yf56y.js → presentation-twEOzzJq.js} +1 -1
  279. package/dist/{presentationHold-B4tK68sd.js → presentationHold-ZKixVLcz.js} +1 -1
  280. package/dist/pressClaim-DvdlIn4w.js +24 -0
  281. package/dist/{pressFeedback-BlOSZew9.js → pressFeedback--_INTed0.js} +49 -9
  282. package/dist/{pressGesture-yntcDLXo.js → pressGesture-B3Efxs_z.js} +1 -1
  283. package/dist/{rubberBand-DDapO54w.js → projection-qPcLQcwK.js} +2 -50
  284. package/dist/{reportChange-DPFCmyOB.js → reportChange-DwOfucSf.js} +4 -4
  285. package/dist/{resizableChannel-DOmBYh4V.js → resizableChannel-BnwrR5tr.js} +5 -5
  286. package/dist/{resolveMotion-CF9fXX0t.js → resolveMotion-DftkGFw6.js} +1 -1
  287. package/dist/{resolveSnapPoint-mZzJRIC2.js → resolveSnapPoint-A4dhS5jj.js} +1 -1
  288. package/dist/rubberBand-DDd5ElTe.js +65 -0
  289. package/dist/selectionLock-BrUpRS0E.js +130 -0
  290. package/dist/{sharedRealm-H1OrlP0V.js → sharedRealm-DBtNH73I.js} +9 -1
  291. package/dist/{springs-B2jqskKJ.js → springs-DjAn_oV5.js} +1 -1
  292. package/dist/{stillPointerGate-Htiy6uKa.js → stillPointerGate-BvCX7ddI.js} +1 -1
  293. package/dist/{themeTiming-ClYaZxGf.js → themeTiming-BJziEh4O.js} +1 -1
  294. package/dist/{tooltipFocusRules-BHJUQprJ.js → tooltipFocusRules-CxIlSnHw.js} +2 -2
  295. package/dist/{tooltipTriggerRules-Dremu4W9.js → tooltipTriggerRules-CHNpQ6RL.js} +1 -1
  296. package/dist/{touchHold-DXtx7npm.js → touchHold-CjNjGH7O.js} +1 -1
  297. package/dist/touchQueries-xy5IeZfe.js +32 -0
  298. package/dist/{useActionGroupTracking-DDhfTUOK.js → useActionGroupTracking-BTjuGF9J.js} +3 -3
  299. package/dist/{useAnimatedLayout-B6Xj_kTo.js → useAnimatedLayout-CRAuCwTZ.js} +1 -1
  300. package/dist/useAttachment-CGiD9rt6.js +24 -0
  301. package/dist/{useChatStreamScroll-CuMzkXgD.js → useChatStreamScroll-DcNKcNTj.js} +1 -1
  302. package/dist/{useDismiss-BvDK4xBe.js → useDismiss-6SGAlkB_.js} +1 -1
  303. package/dist/{useHeldPresentation-BF5vGVUn.js → useHeldPresentation-CaIKTwUh.js} +1 -1
  304. package/dist/{useInputStatusIcon-MyCpVp3g.js → useInputStatusIcon-Bl2JFlc3.js} +1 -1
  305. package/dist/{useMenuEntranceHold-HznOwIry.js → useMenuEntranceHold-C-kHicUN.js} +1 -1
  306. package/dist/{useMenuPress-BJVQF7ml.js → useMenuPress-CF1GHP_7.js} +6 -4
  307. package/dist/{usePressFeedback-cxyksfAD.js → usePressFeedback-B_NavJu0.js} +1 -1
  308. package/dist/{useResizable-C-9ff2ZK.js → useResizable-I0APFcMz.js} +6 -5
  309. package/dist/{useTooltip-w57yzB7h.js → useTooltip-owvVSn_m.js} +4 -4
  310. package/dist/{useTouchHitArea-CgUvnuTz.js → useTouchHitArea-BpEJXuu-.js} +2 -2
  311. package/dist/{useTouchTriggerInternal-DSA228_-.js → useTouchTriggerInternal-5ExaYYSy.js} +1 -1
  312. package/dist/{useTruncationTooltip--w8vh7M-.js → useTruncationTooltip-DHI6q_EV.js} +3 -3
  313. package/dist/{useTypeaheadMenuConfig-C-EOaLF-.js → useTypeaheadMenuConfig-COiZ4isy.js} +1 -1
  314. package/package.json +1 -1
  315. package/styles/segmented-control.css +20 -11
  316. package/styles/slider.css +59 -12
  317. package/styles/switch.css +101 -34
  318. package/dist/SegmentedControl-CkR8ur3h.js +0 -416
  319. package/dist/Slider-BdIrYmul.js +0 -735
  320. package/dist/Switch-6tQbDX9A.js +0 -355
@@ -0,0 +1,1397 @@
1
+ import "./pressFeedback--_INTed0.js";
2
+ import { t as armClickGuard } from "./clickGuard-CxqcfBCJ.js";
3
+ import { n as useTouchHitArea } from "./useTouchHitArea-BpEJXuu-.js";
4
+ import { a as registerMotionTable, d as toSpring } from "./roles-DWH31Bn3.js";
5
+ import { c as solveSpring } from "./linearEasing-VHwy6xl_.js";
6
+ import { r as UIKIT_GESTURES } from "./gestures-yKyyMqeQ.js";
7
+ import { t as usePressFeedback } from "./usePressFeedback-B_NavJu0.js";
8
+ import { t as _sfc_main$1 } from "./VisuallyHidden-cpmsV-0M.js";
9
+ import { t as _sfc_main$2 } from "./ButtonTooltip-ZpQP-aQg.js";
10
+ import { t as useButtonTooltip } from "./useButtonTooltip-DjCaZMp_.js";
11
+ import { n as createMotionEngine } from "./animator-ozeBZ_zC.js";
12
+ import { t as resolveMotion } from "./resolveMotion-DftkGFw6.js";
13
+ import { i as SWITCH_THUMB_MOVE_SPRING } from "./springs-DjAn_oV5.js";
14
+ import { i as getGestureHost } from "./geometry-CGa3nNzZ.js";
15
+ import "./touchQueries-xy5IeZfe.js";
16
+ import { n as lockSelection } from "./selectionLock-BrUpRS0E.js";
17
+ import { r as watchCoarsePointer } from "./coarsePointer-BWNSUIY8.js";
18
+ import { t as isRtlElement } from "./isRtlElement-NHuH48AA.js";
19
+ import { t as useAnnounce } from "./announce-GU01Oix2.js";
20
+ import { o as useComponentMessages } from "./context-B8IEFCDR.js";
21
+ import { a as rubberBandUnclamp, n as rubberBandClamp } from "./rubberBand-DDd5ElTe.js";
22
+ import { r as withholdCallerHandlers } from "./disabledInteraction-Bqoyhoss.js";
23
+ import { t as ariaRequired } from "./context-CrVCeUUK.js";
24
+ import { t as _sfc_main$3 } from "./FieldLabel-KPCTcJpO.js";
25
+ import { t as _sfc_main$4 } from "./FieldStatus-DmCWPT6U.js";
26
+ import { n as clickForLift, t as awaitBrowserClick } from "./browserClickWait-DIj9tkLa.js";
27
+ import { t as switchMessages } from "./switch-B9xwxdOU.js";
28
+ import { n as createPressTracker } from "./PressTracker-Dze87pxw.js";
29
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onScopeDispose, onUpdated, openBlock, renderSlot, shallowRef, toDisplayString, unref, useAttrs, useId, useModel, useTemplateRef, watch, withCtx } from "vue";
30
+ import "../styles/switch.css";
31
+ //#region src/Switch/useSwitchAction.ts
32
+ function useSwitchAction(options) {
33
+ const optimistic = shallowRef(null);
34
+ const pendingCount = shallowRef(0);
35
+ let revision = 0;
36
+ watch(options.model, () => {
37
+ optimistic.value = null;
38
+ });
39
+ function commit(value, event) {
40
+ const current = ++revision;
41
+ const changeEvent = new CustomEvent("change", {
42
+ cancelable: true,
43
+ detail: {
44
+ value,
45
+ originalEvent: event
46
+ }
47
+ });
48
+ if (event.defaultPrevented) changeEvent.preventDefault();
49
+ optimistic.value = value;
50
+ options.model.value = value;
51
+ options.emitChange(value, changeEvent);
52
+ const action = options.changeAction();
53
+ if (!action || changeEvent.defaultPrevented) {
54
+ optimistic.value = null;
55
+ return;
56
+ }
57
+ pendingCount.value += 1;
58
+ const finish = () => {
59
+ pendingCount.value -= 1;
60
+ if (current === revision) optimistic.value = null;
61
+ };
62
+ try {
63
+ const result = action(value, changeEvent);
64
+ if (result == null) {
65
+ finish();
66
+ return;
67
+ }
68
+ Promise.resolve(result).then(finish, (error) => {
69
+ finish();
70
+ options.emitError(error, value, changeEvent);
71
+ });
72
+ } catch (error) {
73
+ finish();
74
+ options.emitError(error, value, changeEvent);
75
+ }
76
+ }
77
+ return {
78
+ commit,
79
+ value: computed(() => optimistic.value ?? options.model.value),
80
+ isPending: computed(() => pendingCount.value > 0)
81
+ };
82
+ }
83
+ //#endregion
84
+ //#region src/motion/uikit/switch.ts
85
+ /**
86
+ * @file switch.ts
87
+ * @input The springs table's measured switch travel (springs.ts)
88
+ * @output Exports `switchControl`: UISwitch's geometry, the springs of its
89
+ * Liquid Glass thumb and of its track color, the drag's rubber band and
90
+ * flip distance, and the release timing
91
+ * @position The switch domain of the UIKit constants table (motion/uikit)
92
+ *
93
+ * The values are UISwitch's on iOS 26.2, read in a UIKit host app on the
94
+ * simulator. Lengths are in pt (CSS px). uikit.test.ts checks each `@source`.
95
+ */
96
+ /**
97
+ * UISwitch on iOS 26.2. Under a finger its white thumb lifts into a clear
98
+ * glass lens, and a drag moves it with a rubber band. The track colour slides
99
+ * on a spring of its own. UISwitch plays no haptic.
100
+ */
101
+ const switchControl = {
102
+ /**
103
+ * The control's size (width × height): the track.
104
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
105
+ * iPhone 17 Pro, `UISwitch` frame 63 × 28 (intrinsic 61 × 28), track view
106
+ * 63 × 28 with corner radius 14, Oct 23 2026
107
+ */
108
+ trackSize: [63, 28],
109
+ /**
110
+ * The thumb at rest (width × height), inset equally from the track's top,
111
+ * bottom and nearer end; it never changes size between off and on.
112
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
113
+ * iPhone 17 Pro, `_UILiquidLensView` frame 37 × 24 at x 2 (off) and
114
+ * x 24 (on) inside the 63 × 28 track, Oct 23 2026
115
+ */
116
+ thumbSize: [37, 24],
117
+ /**
118
+ * The thumb lifted under a finger (width × height). The lens grows about
119
+ * its own center, past the track, and holds this size while the finger
120
+ * stays down.
121
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
122
+ * iPhone 17 Pro, lens bounds settled at 58 × 38.33 during a 1 s hold
123
+ * (center unmoved), Oct 23 2026
124
+ */
125
+ liftedThumbSize: [58, 38.333],
126
+ /**
127
+ * The lift: the thumb growing to `liftedThumbSize` while its white fill
128
+ * fades out and the clear glass fades in (one spring drives all three).
129
+ * Starts with the touch outside a scroll view, after its content delay
130
+ * inside one. UISwitch keeps it under Reduce Motion; core's Switch does not
131
+ * lift then.
132
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
133
+ * iPhone 17 Pro, per-frame lens bounds during a 1 s hold fitted with one
134
+ * spring for width and height (rms 0.29 pt; the fill's and the glass's
135
+ * opacity overshoot by the same 13 %; the lens's settings read on a tap
136
+ * say damping 0.625, response 0.27, whose 8 % overshoot is short of the
137
+ * frames' 12 %), Oct 23 2026
138
+ */
139
+ lift: {
140
+ response: .23,
141
+ dampingRatio: .55
142
+ },
143
+ /**
144
+ * The settle after the finger lifts: the lens shrinking back to
145
+ * `thumbSize` while the white fill returns over the glass.
146
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
147
+ * iPhone 17 Pro, the lens's spring settings read on a tap (damping 0.7,
148
+ * response 0.5); per-frame lens bounds after the lift of a 1 s hold fit
149
+ * one spring at 0.49 / 0.70 (rms 0.065 pt; the opacities undershoot by
150
+ * the same 4.5 %), Oct 23 2026
151
+ */
152
+ settle: {
153
+ response: .5,
154
+ dampingRatio: .7
155
+ },
156
+ /**
157
+ * The settle never starts sooner than this after the lift began, so a
158
+ * quick tap still shows the lifted lens, in ms.
159
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
160
+ * iPhone 17 Pro, a 50 ms tap: the lift→settle hand-off fitted at 235 ms
161
+ * after the lift began (rms 0.33 pt), Oct 23 2026
162
+ * @measure M-SW07
163
+ */
164
+ minimumLiftMs: 235,
165
+ /**
166
+ * The thumb travelling to the committed end after a release or a
167
+ * programmatic change. It starts from the thumb's own velocity.
168
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
169
+ * iPhone 17 Pro, the lens's position behavior read on a tap (damping 1,
170
+ * response 0.3); the lens center after a 50 ms tap and after a 1 s hold
171
+ * fits one spring at 0.31 / 1 (rms 0.11 pt), Oct 23 2026; the springs
172
+ * table's `SWITCH_THUMB_MOVE_SPRING` holds the one value
173
+ */
174
+ travel: SWITCH_THUMB_MOVE_SPRING,
175
+ /**
176
+ * During a drag the thumb chases the finger: each move retargets this
177
+ * spring at the finger's position, rubber-banded past either end.
178
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
179
+ * iPhone 17 Pro, a 4 s drag off → on → past both ends: the lens center
180
+ * simulated as this spring chasing the rubber-banded finger fits every
181
+ * frame (rms 0.21 pt), Oct 23 2026
182
+ */
183
+ tracking: {
184
+ response: .36,
185
+ dampingRatio: 1
186
+ },
187
+ /**
188
+ * The drag's rubber band past either end: UIScrollView's
189
+ * `(1 − 1 ÷ (x·c ÷ d + 1))·d`. The coefficient c and the dimension d are in
190
+ * pt for the 28 pt control. Scale d with the track height.
191
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
192
+ * iPhone 17 Pro, the same drag fit: c 0.55, d 11.75–12 pt, the
193
+ * translation measured from where the finger landed, Oct 23 2026
194
+ */
195
+ rubberBand: {
196
+ coefficient: .55,
197
+ dimension: 12
198
+ },
199
+ /**
200
+ * A drag flips the switch by the finger, not the thumb. Once the finger is
201
+ * this far from where it landed, toward the other end, the switch shows
202
+ * the other side. The distance is the track width minus the thumb width
203
+ * (63 − 37 pt). Back past where it landed, the starting side shows again.
204
+ * Flips happen on touch events only, so a fast swipe flips on the lift.
205
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
206
+ * iPhone 17 Pro, `UISwitchModernVisualElement` ivars per frame and the
207
+ * "SwitchWellPosition" springs during 1 pt-step drags: the same 26 pt for
208
+ * presses at x 8, 20.5 and 45, with and without a 400 ms hold, mirrored
209
+ * on an on switch; flipping back at the press point, Oct 23 2026
210
+ */
211
+ flipDistance: 26,
212
+ /**
213
+ * The track color turning on: the well image sliding in on a critically
214
+ * damped spring, starting when the switch flips (the lift of a tap).
215
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
216
+ * iPhone 17 Pro, `CASpringAnimation` "SwitchWellPosition" read: mass 1,
217
+ * stiffness 85.377, damping 18.480 (response 0.68 s), Oct 23 2026
218
+ */
219
+ wellOn: {
220
+ mass: 1,
221
+ stiffness: 85.37720070146501,
222
+ damping: 18.47995678582231
223
+ },
224
+ /**
225
+ * The track color turning off: the same well sliding back, faster.
226
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
227
+ * iPhone 17 Pro, `CASpringAnimation` "SwitchWellPosition" read: mass 1,
228
+ * stiffness 246.740, damping 31.416 (response 0.40 s), Oct 23 2026
229
+ */
230
+ wellOff: {
231
+ mass: 1,
232
+ stiffness: 246.74011002723395,
233
+ damping: 31.41592653589793
234
+ },
235
+ /**
236
+ * The lifted lens's drop shadow: y offset and radius in pt, then black
237
+ * alpha; none at rest.
238
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
239
+ * iPhone 17 Pro, the lens layer's presented `shadowOffset` (0, 7),
240
+ * `shadowRadius` 3, `shadowOpacity` 0.12 once lifted, 0 at rest,
241
+ * Oct 23 2026
242
+ */
243
+ liftedShadow: [
244
+ 7,
245
+ 3,
246
+ .12
247
+ ],
248
+ /**
249
+ * UISwitch plays no haptic on a tap, a hold or a drag.
250
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
251
+ * iPhone 17 Pro, every `UIFeedbackGenerator` entry point hooked: no call
252
+ * on tap, hold, drag or flip, Oct 23 2026
253
+ */
254
+ haptic: "none"
255
+ };
256
+ /**
257
+ * Registers the switch table's motion roles as internal roles. Nothing
258
+ * registers on import: Switch's touch presentation calls it once before its
259
+ * first animation, and a second call does nothing.
260
+ */
261
+ function registerSwitchTable() {
262
+ registerMotionTable("switchControl", switchControl, { roles: [
263
+ "lift",
264
+ "settle",
265
+ "travel",
266
+ "tracking",
267
+ "wellOn",
268
+ "wellOff",
269
+ "minimumLiftMs"
270
+ ] });
271
+ }
272
+ //#endregion
273
+ //#region src/Switch/switchTouch.ts
274
+ /**
275
+ * @file switchTouch.ts
276
+ * @input The UIKit switch constants (motion/uikit/switch.ts) and a track size
277
+ * @output The pure model of Switch's touch presentation: thumb geometry, the
278
+ * drag's target, the flip rule, the commit on release, and when the lifted
279
+ * thumb may settle
280
+ * @position Pure half of Switch's touch presentation; driven by
281
+ * switchTouchController.ts, tested by switchTouch.test.ts without a browser
282
+ *
283
+ * Positions are thumb offsets from the off end, 0 … `travel`, in the writing
284
+ * direction; the caller mirrors them for right-to-left.
285
+ */
286
+ const [UIKIT_TRACK_WIDTH, UIKIT_TRACK_HEIGHT] = switchControl.trackSize;
287
+ const [UIKIT_THUMB_WIDTH, UIKIT_THUMB_HEIGHT] = switchControl.thumbSize;
288
+ const [LIFTED_WIDTH, LIFTED_HEIGHT] = switchControl.liftedThumbSize;
289
+ /**
290
+ * The thumb geometry in a track of this size: the thumb's measured box when
291
+ * given, UIKit's proportions otherwise.
292
+ */
293
+ function switchTouchGeometry(trackWidth, trackHeight, thumb) {
294
+ const thumbHeight = thumb?.height ?? trackHeight * UIKIT_THUMB_HEIGHT / UIKIT_TRACK_HEIGHT;
295
+ const thumbWidth = thumb?.width ?? trackWidth * UIKIT_THUMB_WIDTH / UIKIT_TRACK_WIDTH;
296
+ const inset = Math.max(0, (trackHeight - thumbHeight) / 2);
297
+ const liftScale = Math.max(1, Math.min(LIFTED_WIDTH / UIKIT_THUMB_WIDTH, LIFTED_HEIGHT / UIKIT_THUMB_HEIGHT, thumbWidth > 0 ? 1 + inset / thumbWidth : 1, thumbHeight > 0 ? 1 + inset / thumbHeight : 1));
298
+ const liftGrowth = thumbWidth * (liftScale - 1) / 2;
299
+ return {
300
+ trackWidth,
301
+ trackHeight,
302
+ thumbWidth,
303
+ thumbHeight,
304
+ inset,
305
+ travel: Math.max(0, trackWidth - thumbWidth - 2 * inset),
306
+ liftScaleX: liftScale,
307
+ liftScaleY: liftScale,
308
+ rubberBandDimension: Math.max(0, Math.min(switchControl.rubberBand.dimension * trackHeight / UIKIT_TRACK_HEIGHT, inset - liftGrowth)),
309
+ flipDistance: Math.max(0, trackWidth - thumbWidth)
310
+ };
311
+ }
312
+ /**
313
+ * Where the drag puts the thumb's target: the offset at the landing, moved
314
+ * by the finger's translation and rubber-banded past either end. `start` is
315
+ * the thumb's offset on screen when the finger landed, mid-flight or banded.
316
+ * It is unbanded first, so a finger that grabs a moving thumb continues
317
+ * without a jump.
318
+ */
319
+ function dragTarget(start, translation, geometry) {
320
+ const { travel, rubberBandDimension } = geometry;
321
+ const coefficient = switchControl.rubberBand.coefficient;
322
+ const raw = rubberBandUnclamp(start, 0, travel, rubberBandDimension, coefficient) + translation;
323
+ return rubberBandClamp(raw, 0, travel, rubberBandDimension, coefficient);
324
+ }
325
+ function startFlip(isOn) {
326
+ return {
327
+ startedOn: isOn,
328
+ isVisuallyOn: isOn,
329
+ isArmed: false,
330
+ didFlip: false
331
+ };
332
+ }
333
+ /**
334
+ * One touch event of the drag. `translation` is the finger's travel since it
335
+ * landed along the writing direction (positive toward the on end).
336
+ */
337
+ function stepFlip(flip, translation, geometry) {
338
+ const toward = flip.startedOn ? -translation : translation;
339
+ if (flip.isVisuallyOn !== flip.startedOn) return toward < 0 ? {
340
+ ...flip,
341
+ isVisuallyOn: flip.startedOn,
342
+ isArmed: false
343
+ } : flip;
344
+ const isPast = toward >= geometry.flipDistance;
345
+ if (flip.isArmed && isPast) return {
346
+ ...flip,
347
+ isVisuallyOn: !flip.startedOn,
348
+ isArmed: false,
349
+ didFlip: true
350
+ };
351
+ return isPast === flip.isArmed ? flip : {
352
+ ...flip,
353
+ isArmed: isPast
354
+ };
355
+ }
356
+ /**
357
+ * What a release commits: the side a drag flipped to; when nothing flipped,
358
+ * the other side of the value, wherever the finger lifts. A press slid off
359
+ * and lifted outside toggles too, as UISwitch's does.
360
+ */
361
+ function commitOnRelease(flip, isOn) {
362
+ return flip?.didFlip === true ? flip.isVisuallyOn : !isOn;
363
+ }
364
+ /**
365
+ * When the lifted thumb may settle (ms): the release, but never sooner than
366
+ * the minimum lift time after the lift.
367
+ */
368
+ function settleTime(releaseTime, liftTime, minimumLiftMs = switchControl.minimumLiftMs) {
369
+ return Math.max(releaseTime, liftTime + minimumLiftMs);
370
+ }
371
+ //#endregion
372
+ //#region src/utils/pressedRowLock.ts
373
+ /**
374
+ * @file pressedRowLock.ts
375
+ * @input The elements a press tracker holds and the touch's target
376
+ * @output lockPressedRow: the selection lock for a control's press, over the
377
+ * control and the pressable row around it
378
+ * @position A press tracker's `selectionLock` for a control whose hold acts
379
+ * (Switch), over utils/selectionLock.ts
380
+ */
381
+ /**
382
+ * Locks the selection on `elements` and on the pressable row each sits in,
383
+ * so a held finger selects no label text beside the control.
384
+ */
385
+ function lockPressedRow(elements, target) {
386
+ const held = /* @__PURE__ */ new Set();
387
+ for (const element of elements) {
388
+ held.add(element);
389
+ held.add(element.closest(`[data-astryx-pressable]`) ?? element);
390
+ }
391
+ return lockSelection(held, target);
392
+ }
393
+ //#endregion
394
+ //#region src/Switch/switchFill.ts
395
+ /**
396
+ * @file switchFill.ts
397
+ * @input Switch's native input and its track
398
+ * @output readFillInState: the track's computed fill as the theme paints it
399
+ * in a given state, read in place
400
+ * @position Read by switchTouchVisuals.ts for the colour fade under a finger
401
+ *
402
+ * The track's fill follows the input's `:checked` (switch.css). The colour
403
+ * fade needs the fill of the state the track is not in: the input's checked
404
+ * state is swapped, the colour read and the state swapped back in the same
405
+ * task, so nothing paints in between and no event fires.
406
+ */
407
+ /** The track's computed fill when the input's checked state is `isOn`. */
408
+ function readFillInState(input, track, isOn) {
409
+ const saved = input.checked;
410
+ const held = track.style.getPropertyValue("background-color");
411
+ input.checked = isOn;
412
+ if (held !== "") track.style.removeProperty("background-color");
413
+ try {
414
+ return getComputedStyle(track).backgroundColor;
415
+ } finally {
416
+ input.checked = saved;
417
+ if (held !== "") track.style.setProperty("background-color", held);
418
+ }
419
+ }
420
+ //#endregion
421
+ //#region src/Switch/switchTouchVisuals.ts
422
+ /** The fade layer's colour, set on the track for its `::after`. */
423
+ const FADE_FILL = "--_switch-fade-fill";
424
+ /** The track's own fill while a change is held (inline, over its CSS). */
425
+ const BASE_FILL = "background-color";
426
+ function now$1() {
427
+ return typeof performance === "undefined" ? Date.now() : performance.now();
428
+ }
429
+ /**
430
+ * The lift spring until `holdSeconds`, then the settle spring from where the
431
+ * lift got to: one curve, so the settle starts on the compositor's clock.
432
+ */
433
+ function liftThenSettle(options) {
434
+ const hold = Math.max(0, options.holdSeconds);
435
+ const first = solveSpring(toSpring(options.lift), {
436
+ from: options.from,
437
+ to: options.lifted,
438
+ velocity: options.velocity
439
+ });
440
+ const second = solveSpring(toSpring(options.settle), {
441
+ from: first.value(hold),
442
+ to: options.rest,
443
+ velocity: first.velocity(hold)
444
+ });
445
+ return {
446
+ duration: hold + second.settleTime(options.threshold),
447
+ at: (t) => t < hold ? first.value(t) : second.value(t - hold),
448
+ velocity: (t) => t < hold ? first.velocity(t) : second.velocity(t - hold)
449
+ };
450
+ }
451
+ var SwitchTouchVisuals = class {
452
+ geometry;
453
+ /** Whether `geometry` holds the rendered boxes since the last attach. */
454
+ isGeometryMeasured = false;
455
+ /** The value the CSS shows. */
456
+ isOn;
457
+ /** The side the visuals show or head to. */
458
+ isVisuallyOn;
459
+ /** +1 left-to-right, −1 right-to-left. */
460
+ direction = 1;
461
+ thumb = null;
462
+ /** The fade layer: its opacity is how far the visuals are from the value. */
463
+ fade = null;
464
+ /** The lifted shadow: the thumb's `::after`, faded in with the lift. */
465
+ shadow = null;
466
+ elements = null;
467
+ /** When the thumb lifted (ms); null while at rest. */
468
+ liftTime = null;
469
+ /** When the running settle leaves the lift, ms. */
470
+ settleAt = null;
471
+ /** A change landed mid-fade that the fade already heads to (see the file). */
472
+ baseHeld = false;
473
+ baseHold = 0;
474
+ constructor(isOn, geometry) {
475
+ this.isOn = isOn;
476
+ this.isVisuallyOn = isOn;
477
+ this.geometry = geometry;
478
+ }
479
+ /** The parts a press measures, with no animator (the switch's own look). */
480
+ bind(elements, direction) {
481
+ this.elements = elements;
482
+ this.direction = direction;
483
+ this.isGeometryMeasured = false;
484
+ this.isVisuallyOn = this.isOn;
485
+ }
486
+ /** The animators of the touch presentation, from rest. */
487
+ attach(elements, direction) {
488
+ this.bind(elements, direction);
489
+ this.thumb = createMotionEngine(elements.thumb);
490
+ this.fade = createMotionEngine(elements.track, {
491
+ pseudoElement: "::after",
492
+ initial: { opacity: 0 },
493
+ base: { opacity: 0 }
494
+ });
495
+ this.fade.set({ opacity: 0 }, { promote: false });
496
+ this.shadow = createMotionEngine(elements.thumb, {
497
+ pseudoElement: "::after",
498
+ initial: { opacity: 0 },
499
+ base: { opacity: 0 }
500
+ });
501
+ this.shadow.set({ opacity: 0 }, { promote: false });
502
+ this.paintFade();
503
+ }
504
+ /** Undo the animators and every inline style they wrote. */
505
+ detach() {
506
+ for (const animator of [
507
+ this.thumb,
508
+ this.fade,
509
+ this.shadow
510
+ ]) {
511
+ const element = animator?.element;
512
+ animator?.dispose();
513
+ if (element != null) for (const property of [
514
+ "translate",
515
+ "scale",
516
+ "opacity"
517
+ ]) element.style.removeProperty(property);
518
+ }
519
+ this.elements?.track.style.removeProperty(FADE_FILL);
520
+ this.elements?.track.style.removeProperty(BASE_FILL);
521
+ this.baseHeld = false;
522
+ this.baseHold++;
523
+ this.thumb = this.fade = this.shadow = null;
524
+ this.liftTime = null;
525
+ this.settleAt = null;
526
+ this.elements = null;
527
+ }
528
+ setGeometry(geometry) {
529
+ this.geometry = geometry;
530
+ this.isGeometryMeasured = false;
531
+ this.thumb?.set({
532
+ x: 0,
533
+ scaleX: 1,
534
+ scaleY: 1
535
+ }, { promote: false });
536
+ }
537
+ /**
538
+ * The thumb geometry from the rendered boxes: the track's box less its
539
+ * border, and the thumb's used size from its computed style, which its
540
+ * scale does not change.
541
+ */
542
+ measureGeometry() {
543
+ const track = this.elements?.track;
544
+ const thumb = this.elements?.thumb;
545
+ if (track == null) return;
546
+ const box = track.getBoundingClientRect();
547
+ const trackWidth = box.width - 2 * track.clientLeft;
548
+ const trackHeight = box.height - 2 * track.clientTop;
549
+ if (trackWidth <= 0 || trackHeight <= 0) return;
550
+ this.isGeometryMeasured = true;
551
+ const style = thumb == null ? null : getComputedStyle(thumb);
552
+ const thumbWidth = style == null ? NaN : Number.parseFloat(style.width);
553
+ const thumbHeight = style == null ? NaN : Number.parseFloat(style.height);
554
+ this.geometry = switchTouchGeometry(trackWidth, trackHeight, thumbWidth > 0 && thumbHeight > 0 ? {
555
+ width: thumbWidth,
556
+ height: thumbHeight
557
+ } : void 0);
558
+ }
559
+ /**
560
+ * The rendered value changed and the CSS already moved the thumb's rest:
561
+ * the delta is rebased so nothing moves, the thumb's scale carries its old
562
+ * size, and the fade layer swaps under the new fill. `previousSize` is the
563
+ * thumb diameter of the previous state when nothing was measured yet.
564
+ * Returns whether the animator springs (reduced motion is off).
565
+ */
566
+ rebaseToValue(isOn, previousSize, time) {
567
+ const previous = this.isOn;
568
+ this.isOn = isOn;
569
+ const thumb = this.thumb;
570
+ if (thumb == null) return false;
571
+ let measured = null;
572
+ if (!this.isGeometryMeasured && previousSize != null) {
573
+ this.measureGeometry();
574
+ measured = this.geometry;
575
+ this.geometry = switchTouchGeometry(measured.trackWidth, measured.trackHeight, {
576
+ width: previousSize,
577
+ height: previousSize
578
+ });
579
+ }
580
+ const springs = thumb.reducedMotion() === "off";
581
+ thumb.rebase({ x: this.direction * (this.rest(previous) - this.rest(isOn)) }, springs ? { towards: { x: this.toX(this.rest(isOn)) } } : {});
582
+ const before = this.geometry;
583
+ if (measured == null) this.measureGeometry();
584
+ else this.geometry = measured;
585
+ if (springs) this.rescaleThumb(before, this.geometry, time);
586
+ if (this.fade != null) {
587
+ this.landBase(time);
588
+ if (this.isVisuallyOn !== isOn || !this.holdBase()) this.swapFade(time);
589
+ }
590
+ return springs;
591
+ }
592
+ rest(isOn) {
593
+ return isOn ? this.geometry.travel : 0;
594
+ }
595
+ /** The animator's x for a thumb offset, relative to its CSS place. */
596
+ toX(offset) {
597
+ return this.direction * (offset - this.rest(this.isOn));
598
+ }
599
+ /** The thumb's offset on screen at `time`, from the curve. */
600
+ offsetAt(time) {
601
+ const x = this.thumb?.get("x", time) ?? 0;
602
+ return this.rest(this.isOn) + this.direction * x;
603
+ }
604
+ /** The colour heads for one side. */
605
+ showWell(isOn, time, touchRelease = false) {
606
+ this.isVisuallyOn = isOn;
607
+ this.paintFade();
608
+ this.animateFade(time, void 0, touchRelease);
609
+ }
610
+ /** The track colour and the thumb head for one side. */
611
+ showSide(isOn, time, velocity, touchRelease = false) {
612
+ if (isOn !== this.isVisuallyOn) this.showWell(isOn, time, touchRelease);
613
+ this.thumb?.animate({ x: this.toX(this.rest(isOn)) }, {
614
+ spring: switchControl.travel,
615
+ velocity: velocity == null ? void 0 : { x: velocity }
616
+ }, { touchRelease });
617
+ }
618
+ /** The thumb follows the finger: a tracking spring, or at once under reduced motion. */
619
+ track(offset) {
620
+ const thumb = this.thumb;
621
+ if (thumb == null) return;
622
+ const target = this.toX(offset);
623
+ if (thumb.reducedMotion() === "off") thumb.animate({ x: target }, { spring: switchControl.tracking });
624
+ else thumb.set({ x: target });
625
+ }
626
+ /**
627
+ * The fade layer heads for the visuals on UIKit's well springs: clear when
628
+ * they show the value, opaque (the other fill) when they show the other side.
629
+ */
630
+ animateFade(_time, velocity, touchRelease = false) {
631
+ this.fade?.animate({ opacity: this.isVisuallyOn === this.isOn ? 0 : 1 }, {
632
+ spring: this.isVisuallyOn ? switchControl.wellOn : switchControl.wellOff,
633
+ velocity: velocity == null ? void 0 : { opacity: velocity }
634
+ }, { touchRelease });
635
+ }
636
+ /** The layer swaps to the other fill and the complement of its opacity. */
637
+ swapFade(time) {
638
+ const fade = this.fade;
639
+ if (fade == null) return;
640
+ const opacity = fade.get("opacity", time);
641
+ const fadeVelocity = fade.getVelocity("opacity", time);
642
+ this.paintFade();
643
+ fade.rebase({ opacity: 1 - 2 * opacity });
644
+ this.animateFade(time, -fadeVelocity);
645
+ }
646
+ /** Holds the track's fill at the previous value's until the fade lands. */
647
+ holdBase() {
648
+ const elements = this.elements;
649
+ const fade = this.fade;
650
+ if (elements == null || fade == null) return false;
651
+ elements.track.style.setProperty(BASE_FILL, readFillInState(elements.input, elements.track, !this.isOn));
652
+ this.baseHeld = true;
653
+ const hold = ++this.baseHold;
654
+ fade.atRest(["opacity"]).then(() => {
655
+ if (hold === this.baseHold) this.landBase(now$1());
656
+ });
657
+ return true;
658
+ }
659
+ /** Ends a held fill: the track shows its value's fill and the layer swaps under it. */
660
+ landBase(time) {
661
+ if (!this.baseHeld) return;
662
+ this.baseHeld = false;
663
+ this.baseHold++;
664
+ this.elements?.track.style.removeProperty(BASE_FILL);
665
+ this.swapFade(time);
666
+ }
667
+ /** The fade layer's colour: the track's fill in its other state. */
668
+ paintFade() {
669
+ const elements = this.elements;
670
+ if (elements == null || this.fade == null) return;
671
+ elements.track.style.setProperty(FADE_FILL, readFillInState(elements.input, elements.track, !this.isOn));
672
+ }
673
+ /** The thumb grows into half the gap around it and its shadow fades in. */
674
+ lift(time) {
675
+ if (this.thumb == null || this.thumb.reducedMotion() !== "off") return;
676
+ this.liftTime = time;
677
+ const lift = this.thumb.animate({
678
+ scaleX: this.geometry.liftScaleX,
679
+ scaleY: this.geometry.liftScaleY
680
+ }, { spring: switchControl.lift });
681
+ this.shadow?.animate({ opacity: 1 }, { spring: switchControl.lift });
682
+ lift.started.then((start) => {
683
+ if (this.liftTime === time) this.liftTime = start;
684
+ });
685
+ }
686
+ /** The thumb settles back, no sooner than the minimum lift time after it lifted. */
687
+ settle(time, touchRelease) {
688
+ const liftTime = this.liftTime;
689
+ if (liftTime == null) return;
690
+ this.liftTime = null;
691
+ const element = this.thumb?.element;
692
+ const lift = resolveMotion(element, switchControl.lift);
693
+ const settle = resolveMotion(element, switchControl.settle);
694
+ this.settleAt = settleTime(time, liftTime, resolveMotion(element, switchControl, "minimumLiftMs"));
695
+ const holdSeconds = (this.settleAt - time) / 1e3;
696
+ const play = (animator, property, lifted, rest, threshold) => {
697
+ animator?.play({ [property]: liftThenSettle({
698
+ from: animator.get(property, time),
699
+ velocity: animator.getVelocity(property, time),
700
+ lifted,
701
+ rest,
702
+ holdSeconds,
703
+ threshold,
704
+ lift,
705
+ settle
706
+ }) }, { touchRelease });
707
+ };
708
+ play(this.thumb, "scaleX", this.geometry.liftScaleX, 1, 1e-4);
709
+ play(this.thumb, "scaleY", this.geometry.liftScaleY, 1, 1e-4);
710
+ play(this.shadow, "opacity", 1, 0, .001);
711
+ }
712
+ /**
713
+ * The thumb's box changed size with the value: its scale carries the size
714
+ * it showed, then heads for the new box through the settle, or to the lift
715
+ * a held press keeps.
716
+ */
717
+ rescaleThumb(before, after, time) {
718
+ const thumb = this.thumb;
719
+ if (thumb == null || !(before.thumbWidth > 0 && before.thumbHeight > 0) || !(after.thumbWidth > 0 && after.thumbHeight > 0) || before.thumbWidth === after.thumbWidth && before.thumbHeight === after.thumbHeight) return;
720
+ const held = this.liftTime != null;
721
+ const hold = this.settleAt == null ? 0 : Math.max(0, this.settleAt - time) / 1e3;
722
+ for (const [property, factor, lifted] of [[
723
+ "scaleX",
724
+ before.thumbWidth / after.thumbWidth,
725
+ before.liftScaleX
726
+ ], [
727
+ "scaleY",
728
+ before.thumbHeight / after.thumbHeight,
729
+ before.liftScaleY
730
+ ]]) {
731
+ const keep = lifted * factor;
732
+ thumb.play({ [property]: liftThenSettle({
733
+ from: thumb.get(property, time) * factor,
734
+ velocity: thumb.getVelocity(property, time) * factor,
735
+ lifted: keep,
736
+ rest: held ? keep : 1,
737
+ holdSeconds: held ? 0 : hold,
738
+ threshold: 1e-4,
739
+ lift: resolveMotion(thumb.element, switchControl.lift),
740
+ settle: resolveMotion(thumb.element, switchControl.settle)
741
+ }) });
742
+ }
743
+ }
744
+ };
745
+ //#endregion
746
+ //#region src/Switch/switchTouchController.ts
747
+ /** Horizontal travel at which the press begins if it has not (a pan would), px. */
748
+ const PAN_HYSTERESIS = UIKIT_GESTURES.pan.hysteresis.value;
749
+ function now() {
750
+ return typeof performance === "undefined" ? Date.now() : performance.now();
751
+ }
752
+ var SwitchTouchController = class {
753
+ visuals;
754
+ elements = null;
755
+ isInteractive = true;
756
+ /** The thumb's diameter in each state, for a change before any press. */
757
+ thumbSizes = null;
758
+ /** The thumb's diameter the stylesheet sets for the state it attached in. */
759
+ attachedThumb = null;
760
+ detachers = [];
761
+ /** When the press began (ms); null with no press. */
762
+ pressTime = null;
763
+ /** The thumb's offset when the current finger landed. */
764
+ downOffset = 0;
765
+ drag = null;
766
+ /** The press and the pan both report one event; the second is skipped. */
767
+ isStepping = false;
768
+ /** The current touch already ended in a release. */
769
+ released = false;
770
+ /** Reduced motion: a release changed the value and the travel waits for it. */
771
+ pendingTravel = false;
772
+ /** A finger is down on the switch. */
773
+ isTracking = false;
774
+ /** A lift is waiting for the browser's own click; this ends the wait. */
775
+ endBrowserClickWait = null;
776
+ reconcileTimer = null;
777
+ constructor(isOn, geometry) {
778
+ this.visuals = new SwitchTouchVisuals(isOn, geometry);
779
+ }
780
+ get isAttached() {
781
+ return this.elements != null;
782
+ }
783
+ attach(elements, presentation) {
784
+ this.detach();
785
+ this.elements = elements;
786
+ const direction = isRtlElement(elements.surface) ? -1 : 1;
787
+ this.attachedThumb = null;
788
+ this.visuals.bind(elements, direction);
789
+ if (presentation === "touch") {
790
+ registerSwitchTable();
791
+ const themed = /^\s*(\d+(?:\.\d+)?|\.\d+)px\s*$/.exec(getComputedStyle(elements.thumb).getPropertyValue("--_switch-thumb-size"));
792
+ this.attachedThumb = themed ? Number(themed[1]) : null;
793
+ this.visuals.attach(elements, direction);
794
+ }
795
+ this.detachers = this.attachTracker(elements.surface);
796
+ }
797
+ /**
798
+ * UIControl's tracking, which never blocks a scroll. The press begins with
799
+ * the touch, or with the first horizontal move a pan would begin on.
800
+ * Inside a scroller the touch waits for the content delay.
801
+ */
802
+ attachTracker(surface) {
803
+ const host = getGestureHost(surface.ownerDocument);
804
+ const tracker = createPressTracker({
805
+ view: surface,
806
+ getBounds: () => surface.getBoundingClientRect(),
807
+ isEnabled: () => this.isInteractive,
808
+ isBraking: () => host.isScrollBraking(surface),
809
+ selectionLock: lockPressedRow,
810
+ holdsContextMenu: () => this.pressTime != null,
811
+ onControlEvent: (event, touch) => this.onControlEvent(event, touch),
812
+ onHighlightChange: (isHighlighted) => {
813
+ if (isHighlighted && this.isTracking && this.pressTime == null) this.pressBegan(now());
814
+ }
815
+ });
816
+ return [host.attachConsumer(surface, tracker), () => tracker.dispose()];
817
+ }
818
+ /** Undo everything: listeners, timers, animations and inline styles. */
819
+ detach() {
820
+ for (const detach of this.detachers) detach();
821
+ this.detachers = [];
822
+ this.clearTimers();
823
+ this.visuals.detach();
824
+ this.elements = null;
825
+ this.pressTime = null;
826
+ this.drag = null;
827
+ this.isTracking = false;
828
+ }
829
+ setInteractive(isInteractive) {
830
+ this.isInteractive = isInteractive;
831
+ if (!isInteractive && this.pressTime != null) this.abandon(now());
832
+ }
833
+ setThumbSizes(sizes) {
834
+ this.thumbSizes = sizes;
835
+ }
836
+ setGeometry(geometry) {
837
+ this.visuals.setGeometry(geometry);
838
+ }
839
+ /**
840
+ * The rendered value changed and the CSS already moved the thumb's rest.
841
+ * The visuals rebase so nothing moves on screen, then head for the value.
842
+ */
843
+ setValue(isOn) {
844
+ const visuals = this.visuals;
845
+ if (isOn === visuals.isOn) return;
846
+ const previous = visuals.isOn;
847
+ const time = now();
848
+ const previousSize = this.thumbSizes == null ? null : this.attachedThumb ?? this.thumbSizes[previous ? "on" : "off"];
849
+ const springs = visuals.rebaseToValue(isOn, previousSize, time);
850
+ const thumb = visuals.thumb;
851
+ if (thumb == null) {
852
+ visuals.isVisuallyOn = isOn;
853
+ return;
854
+ }
855
+ const wasDragging = this.endDragForValue();
856
+ if (springs || wasDragging || this.pendingTravel || visuals.isVisuallyOn !== isOn) {
857
+ const touchRelease = this.pendingTravel;
858
+ this.pendingTravel = false;
859
+ visuals.showSide(isOn, time, thumb.getVelocity("x", time), touchRelease);
860
+ }
861
+ }
862
+ /** The app changed the value mid-gesture: the value wins, nothing commits. */
863
+ endDragForValue() {
864
+ if (this.drag == null || this.released) return false;
865
+ this.drag = null;
866
+ this.released = true;
867
+ this.pressEnded();
868
+ return true;
869
+ }
870
+ touchDown(time) {
871
+ this.visuals.measureGeometry();
872
+ this.visuals.landBase(time);
873
+ this.released = false;
874
+ this.pendingTravel = false;
875
+ this.drag = null;
876
+ this.downOffset = this.visuals.offsetAt(time);
877
+ }
878
+ onControlEvent(event, touch) {
879
+ const travel = touch.x - touch.startX;
880
+ const time = now();
881
+ switch (event) {
882
+ case "touchDown":
883
+ this.isTracking = true;
884
+ this.touchDown(time);
885
+ return;
886
+ case "touchDragInside":
887
+ case "touchDragOutside":
888
+ if (this.released || !this.isInteractive) return;
889
+ if (this.pressTime == null) {
890
+ if (Math.abs(travel) < PAN_HYSTERESIS) return;
891
+ this.pressBegan(time);
892
+ }
893
+ this.move(time, travel);
894
+ return;
895
+ case "touchUpInside":
896
+ case "touchUpOutside":
897
+ this.isTracking = false;
898
+ if (this.released || !this.isInteractive) return;
899
+ this.move(time, travel);
900
+ if (this.drag?.flip.didFlip !== true && event === "touchUpInside") {
901
+ this.release(time, {
902
+ byBrowserClick: true,
903
+ clicksIfNoBrowserClick: touch.pointerType === "touch"
904
+ });
905
+ return;
906
+ }
907
+ if (touch.pointerType !== "touch" && (event === "touchUpOutside" || this.drag?.flip.didFlip !== true)) {
908
+ this.released = true;
909
+ this.abandon(time);
910
+ return;
911
+ }
912
+ if (this.elements != null) armClickGuard(this.elements.input.ownerDocument);
913
+ this.release(time);
914
+ return;
915
+ case "touchCancel":
916
+ this.isTracking = false;
917
+ if (!this.released) {
918
+ this.released = true;
919
+ this.abandon(time);
920
+ }
921
+ }
922
+ }
923
+ /** One event of a held or dragged switch: the thumb follows and the flip rule steps. */
924
+ move(time, travel) {
925
+ if (this.isStepping) return;
926
+ this.isStepping = true;
927
+ queueMicrotask(() => {
928
+ this.isStepping = false;
929
+ });
930
+ const visuals = this.visuals;
931
+ const x = visuals.direction * travel;
932
+ const drag = this.drag ??= {
933
+ start: this.downOffset,
934
+ flip: startFlip(visuals.isOn)
935
+ };
936
+ visuals.track(dragTarget(drag.start, x, visuals.geometry));
937
+ drag.flip = stepFlip(drag.flip, x, visuals.geometry);
938
+ if (drag.flip.isVisuallyOn !== visuals.isVisuallyOn) visuals.showWell(drag.flip.isVisuallyOn, time);
939
+ }
940
+ /**
941
+ * The finger lifted after a tap, a hold or a drag. `byBrowserClick`: the
942
+ * browser's own click activates the input, and the switch clicks it only
943
+ * if that click never comes.
944
+ */
945
+ release(time, { byBrowserClick = false, clicksIfNoBrowserClick = true } = {}) {
946
+ if (this.released) return;
947
+ this.released = true;
948
+ this.clearTimers();
949
+ const visuals = this.visuals;
950
+ const commit = commitOnRelease(this.drag?.flip ?? null, visuals.isOn);
951
+ this.drag = null;
952
+ if (this.pressTime == null) this.pressBegan(time);
953
+ if (commit !== visuals.isOn && visuals.thumb != null && visuals.thumb.reducedMotion({ touchRelease: true }) !== "off") {
954
+ this.pendingTravel = true;
955
+ visuals.showWell(commit, time, true);
956
+ } else visuals.showSide(commit, time, void 0, true);
957
+ this.pressEnded(time, true);
958
+ const surface = this.elements?.surface;
959
+ if (byBrowserClick && surface != null) {
960
+ this.endBrowserClickWait = awaitBrowserClick(surface, {
961
+ onClicked: () => {
962
+ this.endBrowserClickWait = null;
963
+ this.scheduleReconcile();
964
+ },
965
+ onNoClick: () => {
966
+ this.endBrowserClickWait = null;
967
+ if (clicksIfNoBrowserClick && commit !== visuals.isOn) this.clickInput();
968
+ this.scheduleReconcile();
969
+ }
970
+ });
971
+ return;
972
+ }
973
+ if (commit !== visuals.isOn) this.clickInput();
974
+ this.scheduleReconcile();
975
+ }
976
+ clickInput() {
977
+ const input = this.elements?.input;
978
+ if (input != null) clickForLift(input);
979
+ }
980
+ /** If the owner kept the old value, the visuals go back to it. */
981
+ scheduleReconcile() {
982
+ if (this.reconcileTimer != null) clearTimeout(this.reconcileTimer);
983
+ this.reconcileTimer = setTimeout(() => {
984
+ this.reconcileTimer = null;
985
+ const visuals = this.visuals;
986
+ if (this.drag == null && visuals.isVisuallyOn !== visuals.isOn) {
987
+ this.pendingTravel = false;
988
+ visuals.showSide(visuals.isOn, now(), void 0, true);
989
+ }
990
+ }, 0);
991
+ }
992
+ /** The touch ended without a release (cancelled, or the switch turned off). */
993
+ abandon(time) {
994
+ this.drag = null;
995
+ this.visuals.showSide(this.visuals.isOn, time, void 0, true);
996
+ this.pressEnded(time, true);
997
+ }
998
+ /** The press began: the switch holds the touch and the thumb lifts. */
999
+ pressBegan(time) {
1000
+ this.pressTime = time;
1001
+ this.visuals.lift(time);
1002
+ }
1003
+ pressEnded(time = now(), touchRelease = false) {
1004
+ this.pressTime = null;
1005
+ this.visuals.settle(time, touchRelease);
1006
+ }
1007
+ clearTimers() {
1008
+ this.endBrowserClickWait?.();
1009
+ this.endBrowserClickWait = null;
1010
+ if (this.reconcileTimer != null) {
1011
+ clearTimeout(this.reconcileTimer);
1012
+ this.reconcileTimer = null;
1013
+ }
1014
+ }
1015
+ };
1016
+ //#endregion
1017
+ //#region src/Switch/useSwitchTouch.ts
1018
+ /** Whether the primary pointer is coarse now, following changes. */
1019
+ function useIsTouch() {
1020
+ const isTouch = shallowRef(false);
1021
+ if (typeof window === "undefined") return isTouch;
1022
+ isTouch.value = typeof window.matchMedia === "function" && window.matchMedia("(pointer: coarse)").matches;
1023
+ onScopeDispose(watchCoarsePointer(window, (isCoarse) => {
1024
+ isTouch.value = isCoarse;
1025
+ }));
1026
+ return isTouch;
1027
+ }
1028
+ /**
1029
+ * Switch's gestures, attached for every pointer, with the touch
1030
+ * presentation under a coarse primary pointer. Its parts are rendered and
1031
+ * styled for it whether or not it is active; it only animates and listens.
1032
+ */
1033
+ function useSwitchTouch(parts, options) {
1034
+ const isTouch = useIsTouch();
1035
+ const [width, height] = options.trackSize();
1036
+ const controller = new SwitchTouchController(options.isOn(), switchTouchGeometry(width, height));
1037
+ watch(options.isOn, (isOn) => controller.setValue(isOn), { flush: "post" });
1038
+ watch(options.trackSize, ([trackWidth, trackHeight]) => controller.setGeometry(switchTouchGeometry(trackWidth, trackHeight)));
1039
+ watch(options.thumbSizes, (sizes) => controller.setThumbSizes(sizes), { immediate: true });
1040
+ watch(options.isInteractive, (isInteractive) => controller.setInteractive(isInteractive), {
1041
+ immediate: true,
1042
+ flush: "sync"
1043
+ });
1044
+ watch(() => [
1045
+ parts.surface.value,
1046
+ parts.input.value,
1047
+ parts.thumb.value,
1048
+ parts.track.value,
1049
+ isTouch.value,
1050
+ options.isDisabled()
1051
+ ], ([surface, input, thumb, track, touch, isDisabled], _previous, onCleanup) => {
1052
+ if (isDisabled || surface == null || input == null || thumb == null || track == null) return;
1053
+ controller.attach({
1054
+ surface,
1055
+ input,
1056
+ thumb,
1057
+ track
1058
+ }, touch ? "touch" : "pointer");
1059
+ onCleanup(() => controller.detach());
1060
+ }, {
1061
+ immediate: true,
1062
+ flush: "post"
1063
+ });
1064
+ }
1065
+ //#endregion
1066
+ //#region src/Switch/Switch.vue
1067
+ const _hoisted_1 = [
1068
+ "data-size",
1069
+ "data-label-position",
1070
+ "data-label-spacing",
1071
+ "data-status",
1072
+ "data-blocked"
1073
+ ];
1074
+ const _hoisted_2 = [
1075
+ "id",
1076
+ "checked",
1077
+ "name",
1078
+ "form",
1079
+ "readonly",
1080
+ "required",
1081
+ "aria-checked",
1082
+ "aria-labelledby",
1083
+ "aria-describedby",
1084
+ "aria-disabled",
1085
+ "aria-readonly",
1086
+ "aria-busy",
1087
+ "aria-required",
1088
+ "aria-invalid"
1089
+ ];
1090
+ const _hoisted_3 = {
1091
+ key: 0,
1092
+ class: "astryx-switch-spinner"
1093
+ };
1094
+ const _hoisted_4 = { class: "astryx-switch-label" };
1095
+ const _sfc_main = /*@__PURE__*/ defineComponent({
1096
+ name: "AstryxSwitch",
1097
+ inheritAttrs: false,
1098
+ __name: "Switch",
1099
+ props: /*@__PURE__*/ mergeModels({
1100
+ id: {},
1101
+ size: { default: "md" },
1102
+ labelPosition: { default: "end" },
1103
+ labelSpacing: { default: "hug" },
1104
+ isReadOnly: { type: Boolean },
1105
+ disabledMessage: {},
1106
+ status: {},
1107
+ statusVariant: { default: "detached" },
1108
+ changeAction: {},
1109
+ isLoading: { type: Boolean },
1110
+ description: {},
1111
+ width: {},
1112
+ hasAutoFocus: { type: Boolean },
1113
+ htmlName: {},
1114
+ form: {},
1115
+ loadingLabel: {},
1116
+ label: {},
1117
+ isLabelHidden: { type: Boolean },
1118
+ isDisabled: { type: Boolean },
1119
+ isOptional: { type: Boolean },
1120
+ isRequired: { type: Boolean },
1121
+ labelIcon: {},
1122
+ labelTooltip: {},
1123
+ optionalLabel: {},
1124
+ requiredLabel: {},
1125
+ targetClass: {}
1126
+ }, {
1127
+ "modelValue": {
1128
+ type: Boolean,
1129
+ required: true
1130
+ },
1131
+ "modelModifiers": {}
1132
+ }),
1133
+ emits: /*@__PURE__*/ mergeModels(["change", "actionError"], ["update:modelValue"]),
1134
+ setup(__props, { expose: __expose, emit: __emit }) {
1135
+ const props = __props;
1136
+ const emit = __emit;
1137
+ const TRACK_SIZE = {
1138
+ sm: [32, 20],
1139
+ md: [40, 24],
1140
+ lg: [52, 28]
1141
+ };
1142
+ const THUMB_SIZE = {
1143
+ sm: {
1144
+ off: 14,
1145
+ on: 16
1146
+ },
1147
+ md: {
1148
+ off: 16,
1149
+ on: 20
1150
+ },
1151
+ lg: {
1152
+ off: 20,
1153
+ on: 24
1154
+ }
1155
+ };
1156
+ const ariaRequired$1 = computed(() => ariaRequired(props.isRequired, props.isOptional, void 0));
1157
+ const messages = useComponentMessages({ switch: switchMessages });
1158
+ const announce = useAnnounce();
1159
+ const press = usePressFeedback({ hasOverlay: false });
1160
+ const model = useModel(__props, "modelValue");
1161
+ const attrs = useAttrs();
1162
+ const input = useTemplateRef("input");
1163
+ const control = useTemplateRef("control");
1164
+ const track = useTemplateRef("track");
1165
+ const thumb = useTemplateRef("thumb");
1166
+ const generatedId = `astryx-switch-${useId()}`;
1167
+ const inputId = computed(() => props.id ?? generatedId);
1168
+ const descriptionId = computed(() => props.description ? `${inputId.value}-description` : void 0);
1169
+ const statusId = computed(() => props.status?.message ? props.status.messageId ?? `${inputId.value}-status` : void 0);
1170
+ const disabledId = `${generatedId}-disabled`;
1171
+ const showsDisabledMessage = computed(() => !!props.isDisabled && !!props.disabledMessage?.trim());
1172
+ const tooltip = useButtonTooltip(showsDisabledMessage);
1173
+ const action = useSwitchAction({
1174
+ model,
1175
+ changeAction: () => props.changeAction,
1176
+ emitChange: (value, event) => emit("change", value, event),
1177
+ emitError: (error, value, event) => emit("actionError", error, value, event)
1178
+ });
1179
+ const busy = computed(() => !!props.isLoading || action.isPending.value);
1180
+ const blocked = computed(() => props.isDisabled || props.isReadOnly || busy.value);
1181
+ useTouchHitArea(control, () => !blocked.value);
1182
+ useSwitchTouch({
1183
+ surface: control,
1184
+ input,
1185
+ thumb,
1186
+ track
1187
+ }, {
1188
+ isOn: () => action.value.value,
1189
+ isInteractive: () => !blocked.value,
1190
+ isDisabled: () => !!props.isDisabled,
1191
+ trackSize: () => TRACK_SIZE[props.size],
1192
+ thumbSizes: () => THUMB_SIZE[props.size]
1193
+ });
1194
+ const loadingText = computed(() => props.loadingLabel || messages.value.switch.loading);
1195
+ watch(busy, (isBusy) => {
1196
+ if (isBusy) announce(loadingText.value);
1197
+ }, { immediate: true });
1198
+ const widthStyle = computed(() => ({ width: typeof props.width === "number" ? `${props.width}px` : props.width }));
1199
+ const element = computed(() => input.value ?? null);
1200
+ function focus(options) {
1201
+ input.value?.focus(options);
1202
+ }
1203
+ function blur() {
1204
+ input.value?.blur();
1205
+ }
1206
+ __expose({
1207
+ element,
1208
+ focus,
1209
+ blur
1210
+ });
1211
+ const controlledAttrs = /* @__PURE__ */ new Set([
1212
+ "class",
1213
+ "style",
1214
+ "id",
1215
+ "type",
1216
+ "checked",
1217
+ "disabled",
1218
+ "readonly",
1219
+ "autofocus",
1220
+ "role",
1221
+ "aria-checked",
1222
+ "aria-labelledby",
1223
+ "aria-describedby",
1224
+ "aria-disabled",
1225
+ "aria-readonly",
1226
+ "aria-required",
1227
+ "aria-busy"
1228
+ ]);
1229
+ function inputAttrs() {
1230
+ return Object.fromEntries(Object.entries(withholdCallerHandlers(attrs, !!props.isDisabled)).filter(([key]) => !controlledAttrs.has(key)));
1231
+ }
1232
+ function describedBy() {
1233
+ return [
1234
+ attrs["aria-describedby"],
1235
+ descriptionId.value,
1236
+ statusId.value,
1237
+ showsDisabledMessage.value ? disabledId : void 0
1238
+ ].filter(Boolean).join(" ") || void 0;
1239
+ }
1240
+ function labelledBy() {
1241
+ const external = attrs["aria-labelledby"];
1242
+ if (typeof external === "string" && external.trim() !== "") return external;
1243
+ return `${inputId.value}-label`;
1244
+ }
1245
+ function syncNative() {
1246
+ if (input.value) input.value.checked = action.value.value;
1247
+ }
1248
+ function click(event) {
1249
+ if (blocked.value) {
1250
+ event.preventDefault();
1251
+ nextTick(syncNative);
1252
+ }
1253
+ }
1254
+ function change(event) {
1255
+ if (!blocked.value && input.value) action.commit(input.value.checked, event);
1256
+ nextTick(syncNative);
1257
+ }
1258
+ function reset(event) {
1259
+ if (event.target === input.value?.form) nextTick(syncNative);
1260
+ }
1261
+ function keydown(event) {
1262
+ if (event.key === "Escape") tooltip.hideImmediately();
1263
+ }
1264
+ let ownerDocument;
1265
+ onMounted(() => {
1266
+ syncNative();
1267
+ ownerDocument = input.value?.ownerDocument;
1268
+ ownerDocument?.addEventListener("reset", reset, true);
1269
+ if (props.hasAutoFocus) focus({ preventScroll: true });
1270
+ });
1271
+ onUpdated(syncNative);
1272
+ onBeforeUnmount(() => ownerDocument?.removeEventListener("reset", reset, true));
1273
+ return (_ctx, _cache) => {
1274
+ return openBlock(), createElementBlock(Fragment, null, [createElementVNode("div", {
1275
+ class: normalizeClass(["astryx-switch", unref(attrs).class]),
1276
+ style: normalizeStyle([widthStyle.value, unref(attrs).style]),
1277
+ "data-size": __props.size,
1278
+ "data-label-position": __props.labelPosition !== "end" ? __props.labelPosition : void 0,
1279
+ "data-label-spacing": __props.labelSpacing !== "hug" ? __props.labelSpacing : void 0,
1280
+ "data-status": __props.status?.type,
1281
+ "data-blocked": blocked.value || void 0
1282
+ }, [
1283
+ createElementVNode("div", mergeProps({ class: "astryx-switch-row" }, blocked.value ? void 0 : unref(press).pressableProps, {
1284
+ onPointerenter: _cache[2] || (_cache[2] = (...args) => unref(tooltip).onPointerEnter && unref(tooltip).onPointerEnter(...args)),
1285
+ onPointerleave: _cache[3] || (_cache[3] = (...args) => unref(tooltip).onPointerLeave && unref(tooltip).onPointerLeave(...args))
1286
+ }), [createElementVNode("span", {
1287
+ ref_key: "control",
1288
+ ref: control,
1289
+ class: "astryx-switch-control"
1290
+ }, [createElementVNode("input", mergeProps(inputAttrs(), {
1291
+ id: inputId.value,
1292
+ ref_key: "input",
1293
+ ref: input,
1294
+ class: "astryx-switch-native",
1295
+ type: "checkbox",
1296
+ role: "switch",
1297
+ checked: unref(action).value.value,
1298
+ name: __props.isDisabled ? void 0 : __props.htmlName ?? inputAttrs().name,
1299
+ form: __props.isDisabled ? "" : inputAttrs().form,
1300
+ readonly: __props.isReadOnly || showsDisabledMessage.value,
1301
+ required: __props.isRequired && !__props.isOptional,
1302
+ "aria-checked": unref(action).value.value,
1303
+ "aria-labelledby": labelledBy(),
1304
+ "aria-describedby": describedBy(),
1305
+ "aria-disabled": __props.isDisabled || void 0,
1306
+ "aria-readonly": __props.isReadOnly || void 0,
1307
+ "aria-busy": busy.value || void 0,
1308
+ "aria-required": ariaRequired$1.value,
1309
+ "aria-invalid": __props.status?.type === "error" ? true : __props.isRequired ? false : inputAttrs()["aria-invalid"],
1310
+ onClick: click,
1311
+ onChange: change,
1312
+ onKeydown: keydown,
1313
+ onFocus: _cache[0] || (_cache[0] = (...args) => unref(tooltip).onFocus && unref(tooltip).onFocus(...args)),
1314
+ onBlur: _cache[1] || (_cache[1] = (...args) => unref(tooltip).onBlur && unref(tooltip).onBlur(...args))
1315
+ }), null, 16, _hoisted_2), createElementVNode("span", {
1316
+ ref_key: "track",
1317
+ ref: track,
1318
+ class: "astryx-switch-track",
1319
+ "aria-hidden": "true"
1320
+ }, [createElementVNode("span", {
1321
+ ref_key: "thumb",
1322
+ ref: thumb,
1323
+ class: "astryx-switch-thumb"
1324
+ }, null, 512), busy.value ? (openBlock(), createElementBlock("span", _hoisted_3)) : createCommentVNode("v-if", true)], 512)], 512), createElementVNode("div", _hoisted_4, [createVNode(_sfc_main$3, {
1325
+ label: __props.label,
1326
+ "input-id": inputId.value,
1327
+ "label-id": `${inputId.value}-label`,
1328
+ description: __props.description,
1329
+ "description-id": descriptionId.value,
1330
+ "is-label-hidden": __props.isLabelHidden,
1331
+ "is-disabled": __props.isDisabled,
1332
+ "is-optional": __props.isOptional,
1333
+ "is-required": __props.isRequired,
1334
+ "target-class": "astryx-switch-label",
1335
+ "label-icon": __props.labelIcon,
1336
+ "label-tooltip": __props.labelTooltip,
1337
+ "optional-label": __props.optionalLabel,
1338
+ "required-label": __props.requiredLabel
1339
+ }, createSlots({ _: 2 }, [_ctx.$slots.labelIcon ? {
1340
+ name: "labelIcon",
1341
+ fn: withCtx(() => [renderSlot(_ctx.$slots, "labelIcon")]),
1342
+ key: "0"
1343
+ } : void 0]), 1032, [
1344
+ "label",
1345
+ "input-id",
1346
+ "label-id",
1347
+ "description",
1348
+ "description-id",
1349
+ "is-label-hidden",
1350
+ "is-disabled",
1351
+ "is-optional",
1352
+ "is-required",
1353
+ "label-icon",
1354
+ "label-tooltip",
1355
+ "optional-label",
1356
+ "required-label"
1357
+ ])])], 16),
1358
+ __props.status?.message ? (openBlock(), createBlock(_sfc_main$4, {
1359
+ key: 0,
1360
+ id: statusId.value,
1361
+ type: __props.status.type,
1362
+ message: __props.status.message,
1363
+ variant: __props.statusVariant === "attached" ? "attached" : "detached"
1364
+ }, null, 8, [
1365
+ "id",
1366
+ "type",
1367
+ "message",
1368
+ "variant"
1369
+ ])) : createCommentVNode("v-if", true),
1370
+ showsDisabledMessage.value ? (openBlock(), createBlock(_sfc_main$1, {
1371
+ key: 1,
1372
+ id: disabledId
1373
+ }, {
1374
+ default: withCtx(() => [createTextVNode(toDisplayString(__props.disabledMessage), 1)]),
1375
+ _: 1
1376
+ })) : createCommentVNode("v-if", true)
1377
+ ], 14, _hoisted_1), showsDisabledMessage.value ? (openBlock(), createBlock(_sfc_main$2, {
1378
+ key: 0,
1379
+ id: `${generatedId}-tooltip`,
1380
+ anchor: input.value,
1381
+ open: unref(tooltip).isOpen.value,
1382
+ text: __props.disabledMessage ?? "",
1383
+ onPointerEnter: unref(tooltip).onTooltipPointerEnter,
1384
+ onPointerLeave: unref(tooltip).onTooltipPointerLeave
1385
+ }, null, 8, [
1386
+ "id",
1387
+ "anchor",
1388
+ "open",
1389
+ "text",
1390
+ "onPointerEnter",
1391
+ "onPointerLeave"
1392
+ ])) : createCommentVNode("v-if", true)], 64);
1393
+ };
1394
+ }
1395
+ });
1396
+ //#endregion
1397
+ export { _sfc_main as t };