@wirekyt/dom 0.0.1 → 0.0.2

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 (476) hide show
  1. package/dist/anatomy-DMuSMbOP.d.cts +18 -0
  2. package/dist/anatomy-DMuSMbOP.d.ts +18 -0
  3. package/dist/anatomy.cjs +3 -0
  4. package/dist/anatomy.d.cts +2 -0
  5. package/dist/anatomy.d.ts +2 -0
  6. package/dist/anatomy.js +2 -0
  7. package/dist/angle-3hqP0Mp5.cjs +13 -0
  8. package/dist/angle-oNt8uGHQ.js +8 -0
  9. package/dist/aria-hidden-CEXexb2I.js +127 -0
  10. package/dist/aria-hidden-Y7iJHPMr.cjs +132 -0
  11. package/dist/aria-hidden.cjs +3 -0
  12. package/dist/aria-hidden.d.cts +10 -0
  13. package/dist/aria-hidden.d.ts +10 -0
  14. package/dist/aria-hidden.js +2 -0
  15. package/dist/array-BGtygd0o.cjs +198 -0
  16. package/dist/array-C4KbHsha.js +73 -0
  17. package/dist/auto-resize-5F5iiKZb.cjs +106 -0
  18. package/dist/auto-resize-KkNfCcBt.js +95 -0
  19. package/dist/auto-resize.cjs +4 -0
  20. package/dist/auto-resize.d.cts +7 -0
  21. package/dist/auto-resize.d.ts +7 -0
  22. package/dist/auto-resize.js +2 -0
  23. package/dist/caret-CHqaP4XG.cjs +30 -0
  24. package/dist/caret-aiDJ6mAS.js +19 -0
  25. package/dist/closest-Clo6ODcK.js +117 -0
  26. package/dist/closest-IiRz1GIJ.cjs +176 -0
  27. package/dist/collection-CJU0oDtX.js +1295 -0
  28. package/dist/collection-CwzUJwBJ.cjs +1342 -0
  29. package/dist/collection.cjs +15 -0
  30. package/dist/collection.d.cts +34 -0
  31. package/dist/collection.d.ts +34 -0
  32. package/dist/collection.js +3 -0
  33. package/dist/color-CsugZjq6.d.cts +60 -0
  34. package/dist/color-CsugZjq6.d.ts +60 -0
  35. package/dist/color-utils-DzeOVYlL.cjs +662 -0
  36. package/dist/color-utils-lDDg9FEh.js +639 -0
  37. package/dist/color-utils.cjs +6 -0
  38. package/dist/color-utils.d.cts +18 -0
  39. package/dist/color-utils.d.ts +18 -0
  40. package/dist/color-utils.js +2 -0
  41. package/dist/computed-style-B1MKlCoo.js +9 -0
  42. package/dist/computed-style-DLArEFNw.cjs +14 -0
  43. package/dist/controller-B8E8ZJCI.cjs +133 -0
  44. package/dist/controller-Dv7lWHDr.js +92 -0
  45. package/dist/core-BF6G2RiC.d.cts +1 -0
  46. package/dist/core-BNMw-JId.cjs +372 -0
  47. package/dist/core-BdeZuSX6.d.ts +1 -0
  48. package/dist/core-CJ0MZr3D.js +289 -0
  49. package/dist/core.cjs +19 -0
  50. package/dist/core.d.cts +3 -0
  51. package/dist/core.d.ts +3 -0
  52. package/dist/core.js +3 -0
  53. package/dist/create-anatomy-B2q3wiaw.js +22 -0
  54. package/dist/create-anatomy-BwDn25ph.cjs +27 -0
  55. package/dist/create-props-CgtcN_Qu.js +4 -0
  56. package/dist/create-props-CjLx2oS8.cjs +9 -0
  57. package/dist/data-url-C-Uk31Q9.cjs +42 -0
  58. package/dist/data-url-DHUHj7UF.js +37 -0
  59. package/dist/data-url-Gx_SWG-k.d.cts +10 -0
  60. package/dist/data-url-Gx_SWG-k.d.ts +10 -0
  61. package/dist/date-utils-D-JJHedx.cjs +868 -0
  62. package/dist/date-utils-D5zXW-Cs.js +569 -0
  63. package/dist/date-utils.cjs +52 -0
  64. package/dist/date-utils.d.cts +7 -0
  65. package/dist/date-utils.d.ts +7 -0
  66. package/dist/date-utils.js +2 -0
  67. package/dist/dismissable-C0bixtzl.cjs +348 -0
  68. package/dist/dismissable-KM1jPtNQ.js +337 -0
  69. package/dist/dismissable-layer-BTX5EvXw.d.ts +40 -0
  70. package/dist/dismissable-layer-Ch5niVaq.d.cts +40 -0
  71. package/dist/dismissable.cjs +4 -0
  72. package/dist/dismissable.d.cts +3 -0
  73. package/dist/dismissable.d.ts +3 -0
  74. package/dist/dismissable.js +2 -0
  75. package/dist/dom-query-CQzY93XU.cjs +488 -0
  76. package/dist/dom-query-e7fh0TEH.js +243 -0
  77. package/dist/dom-query.cjs +180 -0
  78. package/dist/dom-query.d.cts +142 -0
  79. package/dist/dom-query.d.ts +142 -0
  80. package/dist/dom-query.js +43 -0
  81. package/dist/equal-C927y7MN.cjs +30 -0
  82. package/dist/equal-DtrP8DPh.js +25 -0
  83. package/dist/event-DDz-mMhM.cjs +242 -0
  84. package/dist/event-bTItRgiw.js +117 -0
  85. package/dist/file-utils-6EXCdfHx.js +116 -0
  86. package/dist/file-utils-B7OJigQq.cjs +151 -0
  87. package/dist/file-utils.cjs +92 -0
  88. package/dist/file-utils.d.cts +40 -0
  89. package/dist/file-utils.d.ts +40 -0
  90. package/dist/file-utils.js +82 -0
  91. package/dist/focus-trap-89E5I9nm.js +487 -0
  92. package/dist/focus-trap-D7jKsfHW.cjs +498 -0
  93. package/dist/focus-trap.cjs +4 -0
  94. package/dist/focus-trap.d.cts +89 -0
  95. package/dist/focus-trap.d.ts +89 -0
  96. package/dist/focus-trap.js +2 -0
  97. package/dist/focus-visible-DWdQf__4.js +176 -0
  98. package/dist/focus-visible-G4cmlWqq.cjs +217 -0
  99. package/dist/focus-visible.cjs +9 -0
  100. package/dist/focus-visible.d.cts +32 -0
  101. package/dist/focus-visible.d.ts +32 -0
  102. package/dist/focus-visible.js +2 -0
  103. package/dist/form-B1DW_w_3.js +89 -0
  104. package/dist/form-CoupKpuP.cjs +130 -0
  105. package/dist/from-window-5ZhzSURC.js +68 -0
  106. package/dist/from-window-B9DKtaoR.cjs +115 -0
  107. package/dist/functions-isw5Ovcx.d.cts +16 -0
  108. package/dist/functions-isw5Ovcx.d.ts +16 -0
  109. package/dist/highlight-word.cjs +95 -0
  110. package/dist/highlight-word.d.cts +24 -0
  111. package/dist/highlight-word.d.ts +24 -0
  112. package/dist/highlight-word.js +94 -0
  113. package/dist/hotkeys.cjs +1183 -0
  114. package/dist/hotkeys.d.cts +199 -0
  115. package/dist/hotkeys.d.ts +199 -0
  116. package/dist/hotkeys.js +1173 -0
  117. package/dist/i18n-utils-BD4VtonY.cjs +345 -0
  118. package/dist/i18n-utils-C4FQZ39m.js +280 -0
  119. package/dist/i18n-utils.cjs +216 -0
  120. package/dist/i18n-utils.d.cts +71 -0
  121. package/dist/i18n-utils.d.ts +71 -0
  122. package/dist/i18n-utils.js +204 -0
  123. package/dist/index-3tNJficI.d.cts +117 -0
  124. package/dist/index-3tNJficI.d.ts +117 -0
  125. package/dist/index-BEfvdGE2.d.cts +116 -0
  126. package/dist/index-BEfvdGE2.d.ts +116 -0
  127. package/dist/index-BF6G2RiC.d.cts +1 -0
  128. package/dist/index-BKgxIVbE.d.cts +285 -0
  129. package/dist/index-BMtpmaRD.d.cts +16 -0
  130. package/dist/index-BMtpmaRD.d.ts +16 -0
  131. package/dist/index-BWiYePx8.d.cts +216 -0
  132. package/dist/index-BXfunVyD.d.cts +1342 -0
  133. package/dist/index-BXfunVyD.d.ts +1342 -0
  134. package/dist/index-BdeZuSX6.d.ts +1 -0
  135. package/dist/index-C2865AJq.d.cts +25 -0
  136. package/dist/index-C2865AJq.d.ts +25 -0
  137. package/dist/index-CFoN0L3C.d.ts +285 -0
  138. package/dist/index-vPrqYDHu.d.ts +216 -0
  139. package/dist/index.cjs +19 -0
  140. package/dist/index.d.cts +3 -0
  141. package/dist/index.d.ts +3 -0
  142. package/dist/index.js +3 -0
  143. package/dist/initial-focus-BQxRRFPa.cjs +37 -0
  144. package/dist/initial-focus-BrN5tT2X.js +26 -0
  145. package/dist/interact-outside-BjqIunFx.js +211 -0
  146. package/dist/interact-outside-Dphjr2Zh.cjs +216 -0
  147. package/dist/interact-outside.cjs +3 -0
  148. package/dist/interact-outside.d.cts +2 -0
  149. package/dist/interact-outside.d.ts +2 -0
  150. package/dist/interact-outside.js +2 -0
  151. package/dist/json-tree-utils.cjs +1518 -0
  152. package/dist/json-tree-utils.d.cts +117 -0
  153. package/dist/json-tree-utils.d.ts +117 -0
  154. package/dist/json-tree-utils.js +1469 -0
  155. package/dist/list-collection-D_eNKrot.d.cts +60 -0
  156. package/dist/list-collection-RqYEWHb4.d.ts +60 -0
  157. package/dist/live-region-BD0OgmrH.cjs +68 -0
  158. package/dist/live-region-F8YMmbrY.js +63 -0
  159. package/dist/live-region.cjs +3 -0
  160. package/dist/live-region.d.cts +2 -0
  161. package/dist/live-region.d.ts +2 -0
  162. package/dist/live-region.js +2 -0
  163. package/dist/machines/accordion/index.cjs +328 -0
  164. package/dist/machines/accordion/index.d.cts +83 -0
  165. package/dist/machines/accordion/index.d.ts +83 -0
  166. package/dist/machines/accordion/index.js +321 -0
  167. package/dist/machines/angle-slider/index.cjs +420 -0
  168. package/dist/machines/angle-slider/index.d.cts +84 -0
  169. package/dist/machines/angle-slider/index.d.ts +84 -0
  170. package/dist/machines/angle-slider/index.js +415 -0
  171. package/dist/machines/async-list/index.cjs +310 -0
  172. package/dist/machines/async-list/index.d.cts +90 -0
  173. package/dist/machines/async-list/index.d.ts +90 -0
  174. package/dist/machines/async-list/index.js +308 -0
  175. package/dist/machines/avatar/index.cjs +165 -0
  176. package/dist/machines/avatar/index.d.cts +63 -0
  177. package/dist/machines/avatar/index.d.ts +63 -0
  178. package/dist/machines/avatar/index.js +160 -0
  179. package/dist/machines/carousel/index.cjs +929 -0
  180. package/dist/machines/carousel/index.d.cts +146 -0
  181. package/dist/machines/carousel/index.d.ts +146 -0
  182. package/dist/machines/carousel/index.js +920 -0
  183. package/dist/machines/cascade-select/index.cjs +1426 -0
  184. package/dist/machines/cascade-select/index.d.cts +167 -0
  185. package/dist/machines/cascade-select/index.d.ts +167 -0
  186. package/dist/machines/cascade-select/index.js +1419 -0
  187. package/dist/machines/checkbox/index.cjs +316 -0
  188. package/dist/machines/checkbox/index.d.cts +81 -0
  189. package/dist/machines/checkbox/index.d.ts +81 -0
  190. package/dist/machines/checkbox/index.js +311 -0
  191. package/dist/machines/clipboard/index.cjs +228 -0
  192. package/dist/machines/clipboard/index.d.cts +72 -0
  193. package/dist/machines/clipboard/index.d.ts +72 -0
  194. package/dist/machines/clipboard/index.js +221 -0
  195. package/dist/machines/collapsible/index.cjs +363 -0
  196. package/dist/machines/collapsible/index.d.cts +82 -0
  197. package/dist/machines/collapsible/index.d.ts +82 -0
  198. package/dist/machines/collapsible/index.js +358 -0
  199. package/dist/machines/color-picker/index.cjs +1534 -0
  200. package/dist/machines/color-picker/index.d.cts +207 -0
  201. package/dist/machines/color-picker/index.d.ts +207 -0
  202. package/dist/machines/color-picker/index.js +1518 -0
  203. package/dist/machines/combobox/index.cjs +1554 -0
  204. package/dist/machines/combobox/index.d.cts +219 -0
  205. package/dist/machines/combobox/index.d.ts +219 -0
  206. package/dist/machines/combobox/index.js +1542 -0
  207. package/dist/machines/date-input/index.cjs +1974 -0
  208. package/dist/machines/date-input/index.d.cts +230 -0
  209. package/dist/machines/date-input/index.d.ts +230 -0
  210. package/dist/machines/date-input/index.js +1958 -0
  211. package/dist/machines/date-picker/index.cjs +2424 -0
  212. package/dist/machines/date-picker/index.d.cts +378 -0
  213. package/dist/machines/date-picker/index.d.ts +378 -0
  214. package/dist/machines/date-picker/index.js +2408 -0
  215. package/dist/machines/dialog/index.cjs +378 -0
  216. package/dist/machines/dialog/index.d.cts +94 -0
  217. package/dist/machines/dialog/index.d.ts +94 -0
  218. package/dist/machines/dialog/index.js +373 -0
  219. package/dist/machines/drawer/index.cjs +2066 -0
  220. package/dist/machines/drawer/index.d.cts +334 -0
  221. package/dist/machines/drawer/index.d.ts +334 -0
  222. package/dist/machines/drawer/index.js +2059 -0
  223. package/dist/machines/editable/index.cjs +550 -0
  224. package/dist/machines/editable/index.d.cts +114 -0
  225. package/dist/machines/editable/index.d.ts +114 -0
  226. package/dist/machines/editable/index.js +545 -0
  227. package/dist/machines/file-upload/index.cjs +648 -0
  228. package/dist/machines/file-upload/index.d.cts +150 -0
  229. package/dist/machines/file-upload/index.d.ts +150 -0
  230. package/dist/machines/file-upload/index.js +641 -0
  231. package/dist/machines/floating-panel/index.cjs +1020 -0
  232. package/dist/machines/floating-panel/index.d.cts +149 -0
  233. package/dist/machines/floating-panel/index.d.ts +149 -0
  234. package/dist/machines/floating-panel/index.js +1012 -0
  235. package/dist/machines/hover-card/index.cjs +441 -0
  236. package/dist/machines/hover-card/index.d.cts +82 -0
  237. package/dist/machines/hover-card/index.d.ts +82 -0
  238. package/dist/machines/hover-card/index.js +436 -0
  239. package/dist/machines/image-cropper/index.cjs +2082 -0
  240. package/dist/machines/image-cropper/index.d.cts +182 -0
  241. package/dist/machines/image-cropper/index.d.ts +182 -0
  242. package/dist/machines/image-cropper/index.js +2076 -0
  243. package/dist/machines/listbox/index.cjs +873 -0
  244. package/dist/machines/listbox/index.d.cts +175 -0
  245. package/dist/machines/listbox/index.d.ts +175 -0
  246. package/dist/machines/listbox/index.js +860 -0
  247. package/dist/machines/marquee/index.cjs +387 -0
  248. package/dist/machines/marquee/index.d.cts +102 -0
  249. package/dist/machines/marquee/index.d.ts +102 -0
  250. package/dist/machines/marquee/index.js +382 -0
  251. package/dist/machines/menu/index.cjs +1562 -0
  252. package/dist/machines/menu/index.d.cts +188 -0
  253. package/dist/machines/menu/index.d.ts +188 -0
  254. package/dist/machines/menu/index.js +1549 -0
  255. package/dist/machines/navigation-menu/index.cjs +860 -0
  256. package/dist/machines/navigation-menu/index.d.cts +131 -0
  257. package/dist/machines/navigation-menu/index.d.ts +131 -0
  258. package/dist/machines/navigation-menu/index.js +855 -0
  259. package/dist/machines/number-input/index.cjs +1014 -0
  260. package/dist/machines/number-input/index.d.cts +136 -0
  261. package/dist/machines/number-input/index.d.ts +136 -0
  262. package/dist/machines/number-input/index.js +1009 -0
  263. package/dist/machines/pagination/index.cjs +413 -0
  264. package/dist/machines/pagination/index.d.cts +139 -0
  265. package/dist/machines/pagination/index.d.ts +139 -0
  266. package/dist/machines/pagination/index.js +404 -0
  267. package/dist/machines/password-input/index.cjs +224 -0
  268. package/dist/machines/password-input/index.d.cts +71 -0
  269. package/dist/machines/password-input/index.d.ts +71 -0
  270. package/dist/machines/password-input/index.js +219 -0
  271. package/dist/machines/pin-input/index.cjs +595 -0
  272. package/dist/machines/pin-input/index.d.cts +107 -0
  273. package/dist/machines/pin-input/index.d.ts +107 -0
  274. package/dist/machines/pin-input/index.js +590 -0
  275. package/dist/machines/popover/index.cjs +516 -0
  276. package/dist/machines/popover/index.d.cts +107 -0
  277. package/dist/machines/popover/index.d.ts +107 -0
  278. package/dist/machines/popover/index.js +511 -0
  279. package/dist/machines/presence/index.cjs +193 -0
  280. package/dist/machines/presence/index.d.cts +44 -0
  281. package/dist/machines/presence/index.d.ts +44 -0
  282. package/dist/machines/presence/index.js +190 -0
  283. package/dist/machines/progress/index.cjs +282 -0
  284. package/dist/machines/progress/index.d.cts +96 -0
  285. package/dist/machines/progress/index.d.ts +96 -0
  286. package/dist/machines/progress/index.js +277 -0
  287. package/dist/machines/qr-code/index.cjs +167 -0
  288. package/dist/machines/qr-code/index.d.cts +71 -0
  289. package/dist/machines/qr-code/index.d.ts +71 -0
  290. package/dist/machines/qr-code/index.js +162 -0
  291. package/dist/machines/radio-group/index.cjs +465 -0
  292. package/dist/machines/radio-group/index.d.cts +218 -0
  293. package/dist/machines/radio-group/index.d.ts +218 -0
  294. package/dist/machines/radio-group/index.js +458 -0
  295. package/dist/machines/rating-group/index.cjs +405 -0
  296. package/dist/machines/rating-group/index.d.cts +101 -0
  297. package/dist/machines/rating-group/index.d.ts +101 -0
  298. package/dist/machines/rating-group/index.js +398 -0
  299. package/dist/machines/scroll-area/index.cjs +865 -0
  300. package/dist/machines/scroll-area/index.d.cts +126 -0
  301. package/dist/machines/scroll-area/index.d.ts +126 -0
  302. package/dist/machines/scroll-area/index.js +860 -0
  303. package/dist/machines/select/index.cjs +1226 -0
  304. package/dist/machines/select/index.d.cts +190 -0
  305. package/dist/machines/select/index.d.ts +190 -0
  306. package/dist/machines/select/index.js +1214 -0
  307. package/dist/machines/signature-pad/index.cjs +337 -0
  308. package/dist/machines/signature-pad/index.d.cts +108 -0
  309. package/dist/machines/signature-pad/index.d.ts +108 -0
  310. package/dist/machines/signature-pad/index.js +330 -0
  311. package/dist/machines/slider/index.cjs +1103 -0
  312. package/dist/machines/slider/index.d.cts +154 -0
  313. package/dist/machines/slider/index.d.ts +154 -0
  314. package/dist/machines/slider/index.js +1094 -0
  315. package/dist/machines/splitter/index.cjs +1686 -0
  316. package/dist/machines/splitter/index.d.cts +282 -0
  317. package/dist/machines/splitter/index.d.ts +282 -0
  318. package/dist/machines/splitter/index.js +1675 -0
  319. package/dist/machines/steps/index.cjs +330 -0
  320. package/dist/machines/steps/index.d.cts +109 -0
  321. package/dist/machines/steps/index.d.ts +109 -0
  322. package/dist/machines/steps/index.js +325 -0
  323. package/dist/machines/switch/index.cjs +307 -0
  324. package/dist/machines/switch/index.d.cts +80 -0
  325. package/dist/machines/switch/index.d.ts +80 -0
  326. package/dist/machines/switch/index.js +302 -0
  327. package/dist/machines/tabs/index.cjs +542 -0
  328. package/dist/machines/tabs/index.d.cts +113 -0
  329. package/dist/machines/tabs/index.d.ts +113 -0
  330. package/dist/machines/tabs/index.js +533 -0
  331. package/dist/machines/tags-input/index.cjs +1151 -0
  332. package/dist/machines/tags-input/index.d.cts +182 -0
  333. package/dist/machines/tags-input/index.d.ts +182 -0
  334. package/dist/machines/tags-input/index.js +1144 -0
  335. package/dist/machines/timer/index.cjs +329 -0
  336. package/dist/machines/timer/index.d.cts +102 -0
  337. package/dist/machines/timer/index.d.ts +102 -0
  338. package/dist/machines/timer/index.js +323 -0
  339. package/dist/machines/toast/index.cjs +1185 -0
  340. package/dist/machines/toast/index.d.cts +204 -0
  341. package/dist/machines/toast/index.d.ts +204 -0
  342. package/dist/machines/toast/index.js +1180 -0
  343. package/dist/machines/toc/index.cjs +358 -0
  344. package/dist/machines/toc/index.d.cts +98 -0
  345. package/dist/machines/toc/index.d.ts +98 -0
  346. package/dist/machines/toc/index.js +351 -0
  347. package/dist/machines/toggle/index.cjs +99 -0
  348. package/dist/machines/toggle/index.d.cts +46 -0
  349. package/dist/machines/toggle/index.d.ts +46 -0
  350. package/dist/machines/toggle/index.js +94 -0
  351. package/dist/machines/toggle-group/index.cjs +329 -0
  352. package/dist/machines/toggle-group/index.d.cts +81 -0
  353. package/dist/machines/toggle-group/index.d.ts +81 -0
  354. package/dist/machines/toggle-group/index.js +322 -0
  355. package/dist/machines/tooltip/index.cjs +638 -0
  356. package/dist/machines/tooltip/index.d.cts +84 -0
  357. package/dist/machines/tooltip/index.d.ts +84 -0
  358. package/dist/machines/tooltip/index.js +633 -0
  359. package/dist/machines/tour/index.cjs +1123 -0
  360. package/dist/machines/tour/index.d.cts +207 -0
  361. package/dist/machines/tour/index.d.ts +207 -0
  362. package/dist/machines/tour/index.js +1115 -0
  363. package/dist/machines/tree-view/index.cjs +1288 -0
  364. package/dist/machines/tree-view/index.d.cts +221 -0
  365. package/dist/machines/tree-view/index.d.ts +221 -0
  366. package/dist/machines/tree-view/index.js +1279 -0
  367. package/dist/mutation-observer-_LbwtN3W.cjs +61 -0
  368. package/dist/mutation-observer-qObPUo3D.js +50 -0
  369. package/dist/navigate-CJOaL3vx.js +31 -0
  370. package/dist/navigate-uJG-006f.cjs +42 -0
  371. package/dist/overflow-BBihfMxX.cjs +67 -0
  372. package/dist/overflow-C-zO1CWA.js +44 -0
  373. package/dist/platform-BDB0wXUk.js +26 -0
  374. package/dist/platform-BZS-dkZN.cjs +109 -0
  375. package/dist/point-C9A4dk1i.js +27 -0
  376. package/dist/point-DxnCrJBy.cjs +32 -0
  377. package/dist/pointer-lock-BvfSjt_s.cjs +31 -0
  378. package/dist/pointer-lock-WezxTqu-.js +26 -0
  379. package/dist/pointer-move-CGzan38r.cjs +42 -0
  380. package/dist/pointer-move-Tijb8Ptk.js +37 -0
  381. package/dist/polygon-BvdwYRBw.js +76 -0
  382. package/dist/polygon-CTR1kEoU.cjs +93 -0
  383. package/dist/popper-DkAAS9VE.cjs +487 -0
  384. package/dist/popper-DzBZzAe4.js +464 -0
  385. package/dist/popper.cjs +6 -0
  386. package/dist/popper.d.cts +2 -0
  387. package/dist/popper.d.ts +2 -0
  388. package/dist/popper.js +2 -0
  389. package/dist/press-B7XLrLGR.js +65 -0
  390. package/dist/press-BdD5suLQ.cjs +70 -0
  391. package/dist/proxy-tab-focus-DWMXvAfO.js +54 -0
  392. package/dist/proxy-tab-focus-NthYgHdY.cjs +59 -0
  393. package/dist/raf-BSDcY4UD.cjs +85 -0
  394. package/dist/raf-DgINgykK.d.cts +15 -0
  395. package/dist/raf-DgINgykK.d.ts +15 -0
  396. package/dist/raf-Dhvm7f1e.js +62 -0
  397. package/dist/rect-utils-DiT4k3jS.cjs +548 -0
  398. package/dist/rect-utils-d_3gZVsc.js +459 -0
  399. package/dist/rect-utils.cjs +165 -0
  400. package/dist/rect-utils.d.cts +197 -0
  401. package/dist/rect-utils.d.ts +197 -0
  402. package/dist/rect-utils.js +116 -0
  403. package/dist/remove-scroll-DTVA5f4w.cjs +86 -0
  404. package/dist/remove-scroll-WEheFCiq.js +81 -0
  405. package/dist/remove-scroll.cjs +3 -0
  406. package/dist/remove-scroll.d.cts +4 -0
  407. package/dist/remove-scroll.d.ts +4 -0
  408. package/dist/remove-scroll.js +2 -0
  409. package/dist/rolldown-runtime-D6vf50IK.cjs +28 -0
  410. package/dist/scale-C5BBHVgH.js +17 -0
  411. package/dist/scale-C7iiUGhS.cjs +22 -0
  412. package/dist/scope-CysKlKe9.cjs +28 -0
  413. package/dist/scope-D1873Mzi.js +23 -0
  414. package/dist/scroll-CVJ40w2e.js +46 -0
  415. package/dist/scroll-Dyd1QLrc.cjs +63 -0
  416. package/dist/scroll-snap-Cuaqdevf.cjs +224 -0
  417. package/dist/scroll-snap-DqMiFASa.js +201 -0
  418. package/dist/scroll-snap.cjs +6 -0
  419. package/dist/scroll-snap.d.cts +14 -0
  420. package/dist/scroll-snap.d.ts +14 -0
  421. package/dist/scroll-snap.js +2 -0
  422. package/dist/selection-ClKhnWit.d.cts +49 -0
  423. package/dist/selection-DzLiSVkg.d.ts +49 -0
  424. package/dist/selection-map-962WvX2k.js +45 -0
  425. package/dist/selection-map-BwlZr1LH.cjs +68 -0
  426. package/dist/set-CFNGOW5W.js +50 -0
  427. package/dist/set-DrtWCLFb.cjs +73 -0
  428. package/dist/store-BLpJlMxz.js +257 -0
  429. package/dist/store-Btfrm2bs.cjs +47 -0
  430. package/dist/store-C5HvdLyc.js +42 -0
  431. package/dist/store-Wg8KVwNv.cjs +298 -0
  432. package/dist/store.cjs +9 -0
  433. package/dist/store.d.cts +26 -0
  434. package/dist/store.d.ts +26 -0
  435. package/dist/store.js +2 -0
  436. package/dist/stringify-state.cjs +48 -0
  437. package/dist/stringify-state.d.cts +8 -0
  438. package/dist/stringify-state.d.ts +8 -0
  439. package/dist/stringify-state.js +44 -0
  440. package/dist/tabbable-Bz1-1GAY.cjs +206 -0
  441. package/dist/tabbable-CDA1YMjZ.js +147 -0
  442. package/dist/text-selection-B3OQpQGy.cjs +75 -0
  443. package/dist/text-selection-DXvWvm6k.js +64 -0
  444. package/dist/timers-BRyPrXIX.js +82 -0
  445. package/dist/timers-Beu4SfAj.cjs +99 -0
  446. package/dist/tree-collection-3QX3EIhq.d.ts +77 -0
  447. package/dist/tree-collection-C6oDQGUJ.d.cts +77 -0
  448. package/dist/typeahead-DremEgML.d.cts +45 -0
  449. package/dist/typeahead-DremEgML.d.ts +45 -0
  450. package/dist/types-BFuHIo7S.js +10 -0
  451. package/dist/types-CczqoQLL.d.cts +57 -0
  452. package/dist/types-CczqoQLL.d.ts +57 -0
  453. package/dist/types-CjocssbC.d.cts +13 -0
  454. package/dist/types-CjocssbC.d.ts +13 -0
  455. package/dist/types-D7oF7eWh.d.cts +54 -0
  456. package/dist/types-D7oF7eWh.d.ts +54 -0
  457. package/dist/types-HCvp3Bhv.cjs +21 -0
  458. package/dist/types.cjs +14 -0
  459. package/dist/types.d.cts +6 -0
  460. package/dist/types.d.ts +6 -0
  461. package/dist/types.js +12 -0
  462. package/dist/utils-BH-oBBz2.cjs +614 -0
  463. package/dist/utils-Cht5XaHf.js +267 -0
  464. package/dist/utils.cjs +95 -0
  465. package/dist/utils.d.cts +144 -0
  466. package/dist/utils.d.ts +144 -0
  467. package/dist/utils.js +7 -0
  468. package/dist/visually-hidden-BgSCFLz_.cjs +29 -0
  469. package/dist/visually-hidden-yDJ517KZ.js +18 -0
  470. package/dist/wait-for-3n85JcCU.d.cts +15 -0
  471. package/dist/wait-for-3n85JcCU.d.ts +15 -0
  472. package/dist/wait-for-CI5Ye-Lo.js +69 -0
  473. package/dist/wait-for-Db73VpZQ.cjs +86 -0
  474. package/dist/warning-CrzBpWT1.js +19 -0
  475. package/dist/warning-HAmFXLHm.cjs +42 -0
  476. package/package.json +349 -6
@@ -0,0 +1,1426 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_create_anatomy = require("../../create-anatomy-BwDn25ph.cjs");
3
+ const require_dom_query = require("../../dom-query-CQzY93XU.cjs");
4
+ const require_event = require("../../event-DDz-mMhM.cjs");
5
+ const require_form = require("../../form-CoupKpuP.cjs");
6
+ const require_initial_focus = require("../../initial-focus-BQxRRFPa.cjs");
7
+ const require_raf = require("../../raf-BSDcY4UD.cjs");
8
+ const require_mutation_observer = require("../../mutation-observer-_LbwtN3W.cjs");
9
+ const require_scope = require("../../scope-CysKlKe9.cjs");
10
+ const require_scroll = require("../../scroll-Dyd1QLrc.cjs");
11
+ const require_array = require("../../array-BGtygd0o.cjs");
12
+ const require_equal = require("../../equal-C927y7MN.cjs");
13
+ const require_utils = require("../../utils-BH-oBBz2.cjs");
14
+ const require_collection = require("../../collection-CwzUJwBJ.cjs");
15
+ const require_core = require("../../core-BNMw-JId.cjs");
16
+ const require_dismissable = require("../../dismissable-C0bixtzl.cjs");
17
+ const require_focus_visible = require("../../focus-visible-G4cmlWqq.cjs");
18
+ const require_popper = require("../../popper-DkAAS9VE.cjs");
19
+ const require_rect_utils = require("../../rect-utils-DiT4k3jS.cjs");
20
+ const require_closest = require("../../closest-IiRz1GIJ.cjs");
21
+ const require_polygon = require("../../polygon-CTR1kEoU.cjs");
22
+ const require_create_props = require("../../create-props-CjLx2oS8.cjs");
23
+ //#region src/machines/cascade-select/anatomy.ts
24
+ const anatomy = require_create_anatomy.createAnatomy("cascade-select").parts("root", "label", "control", "trigger", "indicator", "valueText", "clearTrigger", "positioner", "content", "list", "item", "itemText", "itemIndicator");
25
+ const parts = anatomy.build();
26
+ //#endregion
27
+ //#region src/machines/cascade-select/collection.ts
28
+ const collection = (options) => {
29
+ return new require_collection.TreeCollection(options);
30
+ };
31
+ collection.empty = () => {
32
+ return new require_collection.TreeCollection({ rootNode: {
33
+ value: "ROOT",
34
+ children: []
35
+ } });
36
+ };
37
+ //#endregion
38
+ //#region src/machines/cascade-select/dom.ts
39
+ const dom = require_scope.createScope({
40
+ getRootId: (ctx) => ctx.ids?.root ?? `cascade-select:${ctx.id}`,
41
+ getLabelId: (ctx) => ctx.ids?.label ?? `cascade-select:${ctx.id}:label`,
42
+ getControlId: (ctx) => ctx.ids?.control ?? `cascade-select:${ctx.id}:control`,
43
+ getTriggerId: (ctx) => ctx.ids?.trigger ?? `cascade-select:${ctx.id}:trigger`,
44
+ getIndicatorId: (ctx) => ctx.ids?.indicator ?? `cascade-select:${ctx.id}:indicator`,
45
+ getClearTriggerId: (ctx) => ctx.ids?.clearTrigger ?? `cascade-select:${ctx.id}:clear-trigger`,
46
+ getPositionerId: (ctx) => ctx.ids?.positioner ?? `cascade-select:${ctx.id}:positioner`,
47
+ getContentId: (ctx) => ctx.ids?.content ?? `cascade-select:${ctx.id}:content`,
48
+ getHiddenInputId: (ctx) => ctx.ids?.hiddenInput ?? `cascade-select:${ctx.id}:hidden-input`,
49
+ getListId: (ctx, value) => ctx.ids?.list?.(value) ?? `cascade-select:${ctx.id}:list:${value}`,
50
+ getItemId: (ctx, value) => ctx.ids?.item?.(value) ?? `cascade-select:${ctx.id}:item:${value}`,
51
+ getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
52
+ getLabelEl: (ctx) => dom.getById(ctx, dom.getLabelId(ctx)),
53
+ getControlEl: (ctx) => dom.getById(ctx, dom.getControlId(ctx)),
54
+ getTriggerEl: (ctx) => dom.getById(ctx, dom.getTriggerId(ctx)),
55
+ getIndicatorEl: (ctx) => dom.getById(ctx, dom.getIndicatorId(ctx)),
56
+ getClearTriggerEl: (ctx) => dom.getById(ctx, dom.getClearTriggerId(ctx)),
57
+ getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
58
+ getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
59
+ getHiddenInputEl: (ctx) => dom.getById(ctx, dom.getHiddenInputId(ctx)),
60
+ getListEl: (ctx, value) => dom.getById(ctx, dom.getListId(ctx, value)),
61
+ getListEls: (ctx) => require_dom_query.queryAll(dom.getContentEl(ctx), `[data-part="list"]`),
62
+ getItemEl: (ctx, value) => dom.getById(ctx, dom.getItemId(ctx, value)),
63
+ dispatchInputEvent: (ctx, value) => {
64
+ const inputEl = dom.getHiddenInputEl(ctx);
65
+ if (!inputEl) return;
66
+ require_form.dispatchInputValueEvent(inputEl, { value });
67
+ }
68
+ });
69
+ //#endregion
70
+ //#region src/machines/cascade-select/connect.ts
71
+ function connect(service, normalize) {
72
+ const { send, context, prop, scope, computed, state } = service;
73
+ const collection = prop("collection");
74
+ const value = context.get("value");
75
+ const open = state.hasTag("open");
76
+ const focused = state.matches("focused");
77
+ const highlightedIndexPath = context.get("highlightedIndexPath");
78
+ const highlightedValue = context.get("highlightedValue");
79
+ const currentPlacement = context.get("currentPlacement");
80
+ const currentPlacementSide = currentPlacement ? require_popper.getPlacementSide(currentPlacement) : void 0;
81
+ const disabled = prop("disabled") || context.get("fieldsetDisabled");
82
+ const interactive = computed("isInteractive");
83
+ const valueAsString = computed("valueAsString");
84
+ const highlightedItems = context.get("highlightedItems");
85
+ const selectedItems = context.get("selectedItems");
86
+ const popperStyles = require_popper.getPlacementStyles({
87
+ ...prop("positioning"),
88
+ placement: currentPlacement
89
+ });
90
+ const getItemState = (props) => {
91
+ const { item, indexPath, value: itemValue } = props;
92
+ const depth = indexPath ? indexPath.length : 0;
93
+ const highlighted = itemValue.every((v, i) => v === highlightedValue[i]);
94
+ const selected = value.some((v) => require_equal.isEqual(v, itemValue));
95
+ const highlightedChild = collection.getNodeChildren(collection.at(indexPath))[highlightedIndexPath[depth]];
96
+ const highlightedIndex = highlightedIndexPath[depth];
97
+ return {
98
+ value: itemValue,
99
+ disabled: collection.getNodeDisabled(item),
100
+ highlighted,
101
+ selected,
102
+ hasChildren: collection.isBranchNode(item),
103
+ depth,
104
+ highlightedChild,
105
+ highlightedIndex
106
+ };
107
+ };
108
+ const hasSelectedItems = value.length > 0;
109
+ const empty = value.length === 0;
110
+ return {
111
+ collection,
112
+ open,
113
+ focused,
114
+ multiple: !!prop("multiple"),
115
+ disabled,
116
+ value,
117
+ highlightedValue,
118
+ highlightedItems,
119
+ selectedItems,
120
+ hasSelectedItems,
121
+ empty,
122
+ valueAsString,
123
+ reposition(options = {}) {
124
+ send({
125
+ type: "POSITIONING.SET",
126
+ options
127
+ });
128
+ },
129
+ focus() {
130
+ dom.getTriggerEl(scope)?.focus({ preventScroll: true });
131
+ },
132
+ setOpen(nextOpen) {
133
+ if (nextOpen === open) return;
134
+ send({ type: nextOpen ? "OPEN" : "CLOSE" });
135
+ },
136
+ setHighlightValue(value) {
137
+ send({
138
+ type: "HIGHLIGHTED_VALUE.SET",
139
+ value
140
+ });
141
+ },
142
+ clearHighlightValue() {
143
+ send({ type: "HIGHLIGHTED_VALUE.CLEAR" });
144
+ },
145
+ setValue(value) {
146
+ send({
147
+ type: "VALUE.SET",
148
+ value
149
+ });
150
+ },
151
+ selectValue(value) {
152
+ send({
153
+ type: "ITEM.SELECT",
154
+ value
155
+ });
156
+ },
157
+ clearValue(value) {
158
+ if (value) send({
159
+ type: "ITEM.CLEAR",
160
+ value
161
+ });
162
+ else send({ type: "VALUE.CLEAR" });
163
+ },
164
+ getItemState,
165
+ getRootProps() {
166
+ return normalize.element({
167
+ ...parts.root.attrs,
168
+ id: dom.getRootId(scope),
169
+ dir: prop("dir"),
170
+ "data-disabled": require_dom_query.dataAttr(disabled),
171
+ "data-readonly": require_dom_query.dataAttr(prop("readOnly")),
172
+ "data-invalid": require_dom_query.dataAttr(prop("invalid")),
173
+ "data-state": open ? "open" : "closed"
174
+ });
175
+ },
176
+ getLabelProps() {
177
+ return normalize.label({
178
+ ...parts.label.attrs,
179
+ id: dom.getLabelId(scope),
180
+ dir: prop("dir"),
181
+ htmlFor: dom.getHiddenInputId(scope),
182
+ "data-disabled": require_dom_query.dataAttr(disabled),
183
+ "data-readonly": require_dom_query.dataAttr(prop("readOnly")),
184
+ "data-invalid": require_dom_query.dataAttr(prop("invalid")),
185
+ onClick(event) {
186
+ if (event.defaultPrevented) return;
187
+ if (disabled) return;
188
+ dom.getTriggerEl(scope)?.focus({ preventScroll: true });
189
+ }
190
+ });
191
+ },
192
+ getControlProps() {
193
+ return normalize.element({
194
+ ...parts.control.attrs,
195
+ dir: prop("dir"),
196
+ id: dom.getControlId(scope),
197
+ "data-disabled": require_dom_query.dataAttr(disabled),
198
+ "data-focus": require_dom_query.dataAttr(focused),
199
+ "data-readonly": require_dom_query.dataAttr(prop("readOnly")),
200
+ "data-invalid": require_dom_query.dataAttr(prop("invalid")),
201
+ "data-state": open ? "open" : "closed"
202
+ });
203
+ },
204
+ getTriggerProps() {
205
+ return normalize.button({
206
+ ...parts.trigger.attrs,
207
+ dir: prop("dir"),
208
+ id: dom.getTriggerId(scope),
209
+ type: "button",
210
+ role: "combobox",
211
+ "aria-controls": dom.getContentId(scope),
212
+ "aria-expanded": open,
213
+ "aria-haspopup": "listbox",
214
+ "aria-labelledby": dom.getLabelId(scope),
215
+ "data-state": open ? "open" : "closed",
216
+ "data-disabled": require_dom_query.dataAttr(disabled),
217
+ "data-readonly": require_dom_query.dataAttr(prop("readOnly")),
218
+ "data-invalid": require_dom_query.dataAttr(prop("invalid")),
219
+ "data-focus": require_dom_query.dataAttr(focused),
220
+ "data-placement": currentPlacement,
221
+ "data-side": currentPlacementSide,
222
+ "data-placeholder-shown": require_dom_query.dataAttr(!hasSelectedItems),
223
+ disabled,
224
+ onClick(event) {
225
+ if (event.defaultPrevented) return;
226
+ if (!interactive) return;
227
+ send({ type: "TRIGGER.CLICK" });
228
+ },
229
+ onFocus() {
230
+ send({ type: "TRIGGER.FOCUS" });
231
+ },
232
+ onBlur() {
233
+ send({ type: "TRIGGER.BLUR" });
234
+ },
235
+ onKeyDown(event) {
236
+ if (event.defaultPrevented) return;
237
+ if (!interactive) return;
238
+ const exec = {
239
+ ArrowUp() {
240
+ send({ type: "TRIGGER.ARROW_UP" });
241
+ },
242
+ ArrowDown(event) {
243
+ send({ type: event.altKey ? "OPEN" : "TRIGGER.ARROW_DOWN" });
244
+ },
245
+ ArrowLeft() {
246
+ send({ type: "TRIGGER.ARROW_LEFT" });
247
+ },
248
+ ArrowRight() {
249
+ send({ type: "TRIGGER.ARROW_RIGHT" });
250
+ },
251
+ Enter() {
252
+ send({ type: "TRIGGER.ENTER" });
253
+ },
254
+ Space() {
255
+ send({ type: "TRIGGER.ENTER" });
256
+ }
257
+ }[require_event.getEventKey(event, { dir: prop("dir") })];
258
+ if (exec) {
259
+ exec(event);
260
+ event.preventDefault();
261
+ }
262
+ }
263
+ });
264
+ },
265
+ getClearTriggerProps() {
266
+ return normalize.button({
267
+ ...parts.clearTrigger.attrs,
268
+ dir: prop("dir"),
269
+ id: dom.getClearTriggerId(scope),
270
+ type: "button",
271
+ "aria-label": "Clear value",
272
+ hidden: !hasSelectedItems,
273
+ "data-disabled": require_dom_query.dataAttr(disabled),
274
+ "data-readonly": require_dom_query.dataAttr(prop("readOnly")),
275
+ "data-invalid": require_dom_query.dataAttr(prop("invalid")),
276
+ disabled,
277
+ onClick(event) {
278
+ if (event.defaultPrevented) return;
279
+ send({ type: "CLEAR_TRIGGER.CLICK" });
280
+ }
281
+ });
282
+ },
283
+ getPositionerProps() {
284
+ return normalize.element({
285
+ ...parts.positioner.attrs,
286
+ dir: prop("dir"),
287
+ id: dom.getPositionerId(scope),
288
+ style: popperStyles.floating
289
+ });
290
+ },
291
+ getContentProps() {
292
+ const highlightedItemId = highlightedValue ? dom.getItemId(scope, highlightedValue.toString()) : void 0;
293
+ return normalize.element({
294
+ ...parts.content.attrs,
295
+ id: dom.getContentId(scope),
296
+ role: "listbox",
297
+ "aria-labelledby": dom.getLabelId(scope),
298
+ "aria-activedescendant": highlightedItemId,
299
+ "data-activedescendant": highlightedItemId,
300
+ "data-state": open ? "open" : "closed",
301
+ "aria-multiselectable": prop("multiple"),
302
+ "aria-required": prop("required"),
303
+ "aria-readonly": prop("readOnly"),
304
+ hidden: !open,
305
+ tabIndex: 0,
306
+ onKeyDown(event) {
307
+ if (!interactive) return;
308
+ if (!require_event.isSelfTarget(event)) return;
309
+ if (event.key === "Tab") {
310
+ if (!require_initial_focus.isValidTabEvent(event)) {
311
+ event.preventDefault();
312
+ return;
313
+ }
314
+ }
315
+ const exec = {
316
+ ArrowDown() {
317
+ send({ type: "CONTENT.ARROW_DOWN" });
318
+ },
319
+ ArrowUp() {
320
+ send({ type: "CONTENT.ARROW_UP" });
321
+ },
322
+ ArrowRight() {
323
+ send({ type: "CONTENT.ARROW_RIGHT" });
324
+ },
325
+ ArrowLeft() {
326
+ send({ type: "CONTENT.ARROW_LEFT" });
327
+ },
328
+ Home() {
329
+ send({ type: "CONTENT.HOME" });
330
+ },
331
+ End() {
332
+ send({ type: "CONTENT.END" });
333
+ },
334
+ Enter() {
335
+ send({ type: "CONTENT.ENTER" });
336
+ },
337
+ " "() {
338
+ send({ type: "CONTENT.ENTER" });
339
+ }
340
+ }[require_event.getEventKey(event, { dir: prop("dir") })];
341
+ if (exec) {
342
+ exec();
343
+ event.preventDefault();
344
+ return;
345
+ }
346
+ if (require_dom_query.isEditableElement(event.target)) return;
347
+ },
348
+ onPointerMove(event) {
349
+ if (!interactive) return;
350
+ send({
351
+ type: "POINTER_MOVE",
352
+ clientX: event.clientX,
353
+ clientY: event.clientY,
354
+ target: event.target
355
+ });
356
+ }
357
+ });
358
+ },
359
+ getListProps(props) {
360
+ const itemState = getItemState(props);
361
+ return normalize.element({
362
+ ...parts.list.attrs,
363
+ id: dom.getListId(scope, itemState.value.toString()),
364
+ dir: prop("dir"),
365
+ "data-depth": itemState.depth,
366
+ "aria-level": itemState.depth,
367
+ role: "group"
368
+ });
369
+ },
370
+ getIndicatorProps() {
371
+ return normalize.element({
372
+ ...parts.indicator.attrs,
373
+ id: dom.getIndicatorId(scope),
374
+ dir: prop("dir"),
375
+ "aria-hidden": true,
376
+ "data-state": open ? "open" : "closed",
377
+ "data-disabled": require_dom_query.dataAttr(disabled),
378
+ "data-readonly": require_dom_query.dataAttr(prop("readOnly")),
379
+ "data-invalid": require_dom_query.dataAttr(prop("invalid"))
380
+ });
381
+ },
382
+ getItemProps(props) {
383
+ const { indexPath } = props;
384
+ const itemState = getItemState(props);
385
+ return normalize.element({
386
+ ...parts.item.attrs,
387
+ id: dom.getItemId(scope, itemState.value.toString()),
388
+ dir: prop("dir"),
389
+ role: "treeitem",
390
+ "aria-haspopup": itemState.hasChildren ? "menu" : void 0,
391
+ "aria-expanded": itemState.hasChildren ? itemState.highlighted : false,
392
+ "aria-controls": itemState.hasChildren ? dom.getListId(scope, itemState.value.toString()) : void 0,
393
+ "aria-owns": itemState.hasChildren ? dom.getListId(scope, itemState.value.toString()) : void 0,
394
+ "aria-disabled": require_dom_query.ariaAttr(itemState.disabled),
395
+ "data-value": itemState.value.toString(),
396
+ "data-disabled": require_dom_query.dataAttr(itemState.disabled),
397
+ "data-highlighted": require_dom_query.dataAttr(itemState.highlighted),
398
+ "data-selected": require_dom_query.dataAttr(itemState.selected),
399
+ "data-depth": itemState.depth,
400
+ "data-state": itemState.selected ? "checked" : "unchecked",
401
+ "data-type": itemState.hasChildren ? "branch" : "leaf",
402
+ "data-index-path": indexPath.toString(),
403
+ onDoubleClick() {
404
+ if (itemState.disabled) return;
405
+ send({ type: "CLOSE" });
406
+ },
407
+ onClick(event) {
408
+ if (event.defaultPrevented) return;
409
+ if (!interactive) return;
410
+ if (itemState.disabled) return;
411
+ send({
412
+ type: "ITEM.CLICK",
413
+ value: itemState.value,
414
+ indexPath
415
+ });
416
+ },
417
+ onPointerEnter(event) {
418
+ if (!interactive) return;
419
+ if (itemState.disabled) return;
420
+ send({
421
+ type: "ITEM.POINTER_ENTER",
422
+ value: itemState.value,
423
+ indexPath,
424
+ clientX: event.clientX,
425
+ clientY: event.clientY
426
+ });
427
+ },
428
+ onPointerLeave(event) {
429
+ if (!interactive) return;
430
+ if (itemState.disabled) return;
431
+ if (event.pointerType !== "mouse") return;
432
+ if (!service.event.previous()?.type.includes("POINTER")) return;
433
+ send({
434
+ type: "ITEM.POINTER_LEAVE",
435
+ value: itemState.value,
436
+ indexPath,
437
+ clientX: event.clientX,
438
+ clientY: event.clientY
439
+ });
440
+ }
441
+ });
442
+ },
443
+ getItemTextProps(props) {
444
+ const { item } = props;
445
+ const itemValue = collection.getNodeValue(item);
446
+ const itemState = getItemState(props);
447
+ return normalize.element({
448
+ dir: prop("dir"),
449
+ ...parts.itemText.attrs,
450
+ "data-value": itemValue,
451
+ "data-highlighted": require_dom_query.dataAttr(itemState.highlighted),
452
+ "data-state": itemState.selected ? "checked" : "unchecked",
453
+ "data-disabled": require_dom_query.dataAttr(itemState.disabled)
454
+ });
455
+ },
456
+ getItemIndicatorProps(props) {
457
+ const { item } = props;
458
+ const itemValue = collection.getNodeValue(item);
459
+ const itemState = getItemState(props);
460
+ return normalize.element({
461
+ ...parts.itemIndicator.attrs,
462
+ dir: prop("dir"),
463
+ "data-value": itemValue,
464
+ "data-highlighted": require_dom_query.dataAttr(itemState.highlighted),
465
+ "data-type": itemState.hasChildren ? "branch" : "leaf",
466
+ "data-state": itemState.selected ? "checked" : "unchecked",
467
+ hidden: !itemState.selected
468
+ });
469
+ },
470
+ getValueTextProps() {
471
+ return normalize.element({
472
+ ...parts.valueText.attrs,
473
+ dir: prop("dir"),
474
+ "data-disabled": require_dom_query.dataAttr(disabled),
475
+ "data-invalid": require_dom_query.dataAttr(prop("invalid")),
476
+ "data-focus": require_dom_query.dataAttr(focused)
477
+ });
478
+ },
479
+ getHiddenInputProps() {
480
+ const defaultValue = context.hash("value");
481
+ return normalize.input({
482
+ name: prop("name"),
483
+ form: prop("form"),
484
+ disabled,
485
+ multiple: prop("multiple"),
486
+ required: prop("required"),
487
+ readOnly: prop("readOnly"),
488
+ hidden: true,
489
+ "aria-hidden": true,
490
+ id: dom.getHiddenInputId(scope),
491
+ defaultValue,
492
+ "aria-labelledby": dom.getLabelId(scope)
493
+ });
494
+ }
495
+ };
496
+ }
497
+ //#endregion
498
+ //#region src/machines/cascade-select/utils.ts
499
+ function createGraceArea(exitPoint, triggerRect, targetRect, options = {}) {
500
+ const { padding = 5 } = options;
501
+ const paddedExitPoints = getPaddedExitPoints(exitPoint, require_closest.closestSideToPoint(require_rect_utils.createRect({
502
+ x: triggerRect.left,
503
+ y: triggerRect.top,
504
+ width: triggerRect.width,
505
+ height: triggerRect.height
506
+ }), exitPoint), padding);
507
+ const targetPoints = domRectToPoints(targetRect);
508
+ return getConvexHull([...paddedExitPoints, ...targetPoints]);
509
+ }
510
+ function isPointerInGraceArea(point, graceArea) {
511
+ return require_polygon.isPointInPolygon(graceArea, point);
512
+ }
513
+ function getPaddedExitPoints(exitPoint, exitSide, padding) {
514
+ const { x, y } = exitPoint;
515
+ switch (exitSide) {
516
+ case "top": return [require_rect_utils.createPoint(x - padding, y + padding), require_rect_utils.createPoint(x + padding, y + padding)];
517
+ case "bottom": return [require_rect_utils.createPoint(x - padding, y - padding), require_rect_utils.createPoint(x + padding, y - padding)];
518
+ case "left": return [require_rect_utils.createPoint(x + padding, y - padding), require_rect_utils.createPoint(x + padding, y + padding)];
519
+ case "right": return [require_rect_utils.createPoint(x - padding, y - padding), require_rect_utils.createPoint(x - padding, y + padding)];
520
+ default: return [];
521
+ }
522
+ }
523
+ function domRectToPoints(rect) {
524
+ const corners = require_rect_utils.getRectCorners(require_rect_utils.createRect({
525
+ x: rect.left,
526
+ y: rect.top,
527
+ width: rect.width,
528
+ height: rect.height
529
+ }));
530
+ return [
531
+ corners.top,
532
+ corners.right,
533
+ corners.bottom,
534
+ corners.left
535
+ ];
536
+ }
537
+ function getConvexHull(points) {
538
+ if (points.length <= 1) return points.slice();
539
+ const sortedPoints = points.slice().sort((a, b) => {
540
+ if (a.x !== b.x) return a.x - b.x;
541
+ return a.y - b.y;
542
+ });
543
+ const lower = [];
544
+ for (const point of sortedPoints) {
545
+ while (lower.length >= 2 && crossProduct(lower[lower.length - 2], lower[lower.length - 1], point) <= 0) lower.pop();
546
+ lower.push(point);
547
+ }
548
+ const upper = [];
549
+ for (let i = sortedPoints.length - 1; i >= 0; i--) {
550
+ const point = sortedPoints[i];
551
+ while (upper.length >= 2 && crossProduct(upper[upper.length - 2], upper[upper.length - 1], point) <= 0) upper.pop();
552
+ upper.push(point);
553
+ }
554
+ lower.pop();
555
+ upper.pop();
556
+ return lower.concat(upper);
557
+ }
558
+ function crossProduct(o, a, b) {
559
+ return (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
560
+ }
561
+ //#endregion
562
+ //#region src/machines/cascade-select/machine.ts
563
+ const { or, and, not } = require_core.createGuards();
564
+ const machine = require_core.createMachine({
565
+ props({ props }) {
566
+ return {
567
+ closeOnSelect: true,
568
+ loopFocus: false,
569
+ defaultValue: [],
570
+ defaultHighlightedValue: [],
571
+ defaultOpen: false,
572
+ multiple: false,
573
+ highlightTrigger: "click",
574
+ allowParentSelection: false,
575
+ positioning: {
576
+ placement: "bottom-start",
577
+ gutter: 8,
578
+ ...props.positioning
579
+ },
580
+ ...props,
581
+ collection: props.collection ?? collection.empty()
582
+ };
583
+ },
584
+ context({ prop, bindable }) {
585
+ return {
586
+ value: bindable(() => ({
587
+ defaultValue: prop("defaultValue"),
588
+ value: prop("value"),
589
+ isEqual: require_equal.isEqual,
590
+ hash(value) {
591
+ return value.join(", ");
592
+ }
593
+ })),
594
+ highlightedValue: bindable(() => ({
595
+ defaultValue: prop("defaultHighlightedValue"),
596
+ value: prop("highlightedValue"),
597
+ isEqual: require_equal.isEqual
598
+ })),
599
+ valueIndexPath: bindable(() => {
600
+ return { defaultValue: (prop("value") ?? prop("defaultValue") ?? []).map((v) => prop("collection").getIndexPath(v)) };
601
+ }),
602
+ highlightedIndexPath: bindable(() => {
603
+ const value = prop("highlightedValue") ?? prop("defaultHighlightedValue") ?? null;
604
+ return { defaultValue: value ? prop("collection").getIndexPath(value) : [] };
605
+ }),
606
+ highlightedItems: bindable(() => ({ defaultValue: [] })),
607
+ selectedItems: bindable(() => ({ defaultValue: [] })),
608
+ currentPlacement: bindable(() => ({ defaultValue: void 0 })),
609
+ fieldsetDisabled: bindable(() => ({ defaultValue: false })),
610
+ graceArea: bindable(() => ({ defaultValue: null })),
611
+ isPointerInTransit: bindable(() => ({ defaultValue: false }))
612
+ };
613
+ },
614
+ computed: {
615
+ isInteractive: ({ prop }) => !(prop("disabled") || prop("readOnly")),
616
+ valueAsString: ({ prop, context }) => {
617
+ const collection = prop("collection");
618
+ const items = context.get("selectedItems");
619
+ const multiple = prop("multiple");
620
+ const formatMultipleMode = (items) => collection.stringifyNode(items.at(-1)) ?? collection.getNodeValue(items.at(-1));
621
+ const formatSingleMode = (items) => {
622
+ return items.map((item) => {
623
+ return collection.stringifyNode(item) ?? collection.getNodeValue(item);
624
+ }).join(" / ");
625
+ };
626
+ const defaultFormatValue = (items) => items.map(multiple ? formatMultipleMode : formatSingleMode).join(", ");
627
+ return (prop("formatValue") ?? defaultFormatValue)(items);
628
+ }
629
+ },
630
+ initialState({ prop }) {
631
+ return prop("open") || prop("defaultOpen") ? "open" : "idle";
632
+ },
633
+ watch({ context, prop, track, action }) {
634
+ track([() => context.get("value")?.toString()], () => {
635
+ action(["syncInputValue", "dispatchChangeEvent"]);
636
+ });
637
+ track([() => prop("open")], () => {
638
+ action(["toggleVisibility"]);
639
+ });
640
+ },
641
+ on: {
642
+ "VALUE.SET": { actions: ["setValue"] },
643
+ "VALUE.CLEAR": { actions: ["clearValue"] },
644
+ "CLEAR_TRIGGER.CLICK": { actions: ["clearValue", "focusTriggerEl"] },
645
+ "HIGHLIGHTED_VALUE.SET": { actions: ["setHighlightedValue"] },
646
+ "HIGHLIGHTED_VALUE.CLEAR": { actions: ["clearHighlightedValue"] },
647
+ "ITEM.SELECT": { actions: ["selectItem"] },
648
+ "ITEM.CLEAR": { actions: ["clearItem"] }
649
+ },
650
+ effects: ["trackFormControlState"],
651
+ states: {
652
+ idle: {
653
+ tags: ["closed"],
654
+ on: {
655
+ "CONTROLLED.OPEN": [{
656
+ guard: "isTriggerClickEvent",
657
+ target: "open",
658
+ actions: ["setInitialFocus", "highlightFirstSelectedItem"]
659
+ }, {
660
+ target: "open",
661
+ actions: ["setInitialFocus"]
662
+ }],
663
+ "TRIGGER.CLICK": [{
664
+ guard: "isOpenControlled",
665
+ actions: ["invokeOnOpen"]
666
+ }, {
667
+ target: "open",
668
+ actions: [
669
+ "invokeOnOpen",
670
+ "setInitialFocus",
671
+ "highlightFirstSelectedItem"
672
+ ]
673
+ }],
674
+ "TRIGGER.FOCUS": { target: "focused" },
675
+ OPEN: [{
676
+ guard: "isOpenControlled",
677
+ actions: ["invokeOnOpen"]
678
+ }, {
679
+ target: "open",
680
+ actions: ["setInitialFocus", "invokeOnOpen"]
681
+ }]
682
+ }
683
+ },
684
+ focused: {
685
+ tags: ["closed"],
686
+ on: {
687
+ "CONTROLLED.OPEN": [
688
+ {
689
+ guard: "isTriggerClickEvent",
690
+ target: "open",
691
+ actions: ["setInitialFocus", "highlightFirstSelectedItem"]
692
+ },
693
+ {
694
+ guard: "isTriggerArrowUpEvent",
695
+ target: "open",
696
+ actions: ["setInitialFocus", "highlightLastItem"]
697
+ },
698
+ {
699
+ guard: or("isTriggerArrowDownEvent", "isTriggerEnterEvent", ""),
700
+ target: "open",
701
+ actions: ["setInitialFocus", "highlightFirstItem"]
702
+ },
703
+ {
704
+ target: "open",
705
+ actions: ["setInitialFocus"]
706
+ }
707
+ ],
708
+ OPEN: [{
709
+ guard: "isOpenControlled",
710
+ actions: ["invokeOnOpen"]
711
+ }, {
712
+ target: "open",
713
+ actions: ["setInitialFocus", "invokeOnOpen"]
714
+ }],
715
+ "TRIGGER.BLUR": { target: "idle" },
716
+ "TRIGGER.CLICK": [{
717
+ guard: "isOpenControlled",
718
+ actions: ["invokeOnOpen"]
719
+ }, {
720
+ target: "open",
721
+ actions: [
722
+ "setInitialFocus",
723
+ "invokeOnOpen",
724
+ "highlightFirstSelectedItem"
725
+ ]
726
+ }],
727
+ "TRIGGER.ENTER": [{
728
+ guard: "isOpenControlled",
729
+ actions: ["invokeOnOpen"]
730
+ }, {
731
+ target: "open",
732
+ actions: [
733
+ "setInitialFocus",
734
+ "invokeOnOpen",
735
+ "highlightFirstItem"
736
+ ]
737
+ }],
738
+ "TRIGGER.ARROW_UP": [{
739
+ guard: "isOpenControlled",
740
+ actions: ["invokeOnOpen"]
741
+ }, {
742
+ target: "open",
743
+ actions: [
744
+ "setInitialFocus",
745
+ "invokeOnOpen",
746
+ "highlightLastItem"
747
+ ]
748
+ }],
749
+ "TRIGGER.ARROW_DOWN": [{
750
+ guard: "isOpenControlled",
751
+ actions: ["invokeOnOpen"]
752
+ }, {
753
+ target: "open",
754
+ actions: [
755
+ "setInitialFocus",
756
+ "invokeOnOpen",
757
+ "highlightFirstItem"
758
+ ]
759
+ }],
760
+ "TRIGGER.ARROW_LEFT": [{
761
+ guard: "isOpenControlled",
762
+ actions: ["invokeOnOpen"]
763
+ }, {
764
+ target: "open",
765
+ actions: ["invokeOnOpen"]
766
+ }],
767
+ "TRIGGER.ARROW_RIGHT": [{
768
+ guard: "isOpenControlled",
769
+ actions: ["invokeOnOpen"]
770
+ }, {
771
+ target: "open",
772
+ actions: ["invokeOnOpen", "highlightFirstItem"]
773
+ }]
774
+ }
775
+ },
776
+ open: {
777
+ tags: ["open"],
778
+ exit: ["scrollContentToTop"],
779
+ effects: [
780
+ "trackDismissableElement",
781
+ "trackFocusVisible",
782
+ "computePlacement",
783
+ "scrollToHighlightedItems"
784
+ ],
785
+ on: {
786
+ "CONTROLLED.CLOSE": [{
787
+ guard: "restoreFocus",
788
+ target: "focused",
789
+ actions: ["focusTriggerEl", "clearHighlightedValue"]
790
+ }, {
791
+ target: "idle",
792
+ actions: ["clearHighlightedValue"]
793
+ }],
794
+ CLOSE: [
795
+ {
796
+ guard: "isOpenControlled",
797
+ actions: ["invokeOnClose"]
798
+ },
799
+ {
800
+ guard: "restoreFocus",
801
+ target: "focused",
802
+ actions: [
803
+ "invokeOnClose",
804
+ "focusTriggerEl",
805
+ "clearHighlightedValue"
806
+ ]
807
+ },
808
+ {
809
+ target: "idle",
810
+ actions: ["invokeOnClose", "clearHighlightedValue"]
811
+ }
812
+ ],
813
+ "TRIGGER.CLICK": [{
814
+ guard: "isOpenControlled",
815
+ actions: ["invokeOnClose"]
816
+ }, {
817
+ target: "focused",
818
+ actions: [
819
+ "invokeOnClose",
820
+ "focusTriggerEl",
821
+ "clearHighlightedValue"
822
+ ]
823
+ }],
824
+ "ITEM.CLICK": [
825
+ {
826
+ guard: and("canSelectItem", and("shouldCloseOnSelect", not("multiple")), "isOpenControlled"),
827
+ actions: ["selectItem", "invokeOnClose"]
828
+ },
829
+ {
830
+ guard: and("canSelectItem", and("shouldCloseOnSelect", not("multiple"))),
831
+ target: "focused",
832
+ actions: [
833
+ "selectItem",
834
+ "invokeOnClose",
835
+ "focusTriggerEl",
836
+ "clearHighlightedValue"
837
+ ]
838
+ },
839
+ {
840
+ guard: "canSelectItem",
841
+ actions: ["selectItem"]
842
+ },
843
+ { actions: ["setHighlightedValue"] }
844
+ ],
845
+ "ITEM.POINTER_ENTER": [{
846
+ guard: "isHoverHighlight",
847
+ actions: ["setHighlightingForHoveredItem"]
848
+ }],
849
+ "ITEM.POINTER_LEAVE": [{
850
+ guard: and("isHoverHighlight", "shouldHighlightOnHover"),
851
+ actions: ["createGraceArea"]
852
+ }],
853
+ POINTER_MOVE: [{
854
+ guard: and("isHoverHighlight", "hasGraceArea", "isPointerOutsideGraceArea", "isPointerNotInAnyItem", "hasHighlightedValue"),
855
+ actions: ["clearGraceArea"]
856
+ }],
857
+ "GRACE_AREA.CLEAR": [{
858
+ guard: "isHoverHighlight",
859
+ actions: ["clearGraceArea"]
860
+ }],
861
+ "CONTENT.HOME": { actions: ["highlightFirstItem"] },
862
+ "CONTENT.END": { actions: ["highlightLastItem"] },
863
+ "CONTENT.ARROW_DOWN": [{
864
+ guard: or(not("hasHighlightedValue"), and("loop", "isHighlightedLastItem")),
865
+ actions: ["highlightFirstItem"]
866
+ }, { actions: ["highlightNextItem"] }],
867
+ "CONTENT.ARROW_UP": [{
868
+ guard: or(not("hasHighlightedValue"), and("loop", "isHighlightedFirstItem")),
869
+ actions: ["highlightLastItem"]
870
+ }, { actions: ["highlightPreviousItem"] }],
871
+ "CONTENT.ARROW_RIGHT": [{
872
+ guard: "canNavigateToChild",
873
+ actions: ["highlightFirstChild"]
874
+ }],
875
+ "CONTENT.ARROW_LEFT": [
876
+ {
877
+ guard: and("isAtRootLevel", "isOpenControlled"),
878
+ actions: ["invokeOnClose", "focusTriggerEl"]
879
+ },
880
+ {
881
+ guard: and("isAtRootLevel", "restoreFocus"),
882
+ target: "focused",
883
+ actions: [
884
+ "invokeOnClose",
885
+ "focusTriggerEl",
886
+ "clearHighlightedValue"
887
+ ]
888
+ },
889
+ {
890
+ guard: "isAtRootLevel",
891
+ target: "idle",
892
+ actions: ["invokeOnClose", "clearHighlightedValue"]
893
+ },
894
+ {
895
+ guard: "canNavigateToParent",
896
+ actions: ["highlightParent"]
897
+ }
898
+ ],
899
+ "CONTENT.ENTER": [
900
+ {
901
+ guard: and("canSelectHighlightedItem", and("shouldCloseOnSelectHighlighted", not("multiple")), "isOpenControlled"),
902
+ actions: ["selectHighlightedItem", "invokeOnClose"]
903
+ },
904
+ {
905
+ guard: and("canSelectHighlightedItem", and("shouldCloseOnSelectHighlighted", not("multiple"))),
906
+ target: "focused",
907
+ actions: [
908
+ "selectHighlightedItem",
909
+ "invokeOnClose",
910
+ "focusTriggerEl",
911
+ "clearHighlightedValue"
912
+ ]
913
+ },
914
+ {
915
+ guard: "canSelectHighlightedItem",
916
+ actions: ["selectHighlightedItem"]
917
+ }
918
+ ],
919
+ "POSITIONING.SET": { actions: ["reposition"] }
920
+ }
921
+ }
922
+ },
923
+ implementations: {
924
+ guards: {
925
+ restoreFocus: ({ event }) => restoreFocusFn(event),
926
+ multiple: ({ prop }) => !!prop("multiple"),
927
+ loop: ({ prop }) => !!prop("loopFocus"),
928
+ isOpenControlled: ({ prop }) => !!prop("open"),
929
+ isTriggerClickEvent: ({ event }) => event.previousEvent?.type === "TRIGGER.CLICK",
930
+ isTriggerArrowUpEvent: ({ event }) => event.previousEvent?.type === "TRIGGER.ARROW_UP",
931
+ isTriggerArrowDownEvent: ({ event }) => event.previousEvent?.type === "TRIGGER.ARROW_DOWN",
932
+ isTriggerEnterEvent: ({ event }) => event.previousEvent?.type === "TRIGGER.ENTER",
933
+ isTriggerArrowRightEvent: ({ event }) => event.previousEvent?.type === "TRIGGER.ARROW_RIGHT",
934
+ hasHighlightedValue: ({ context }) => context.get("highlightedValue").length > 0,
935
+ isHighlightedFirstItem: ({ context }) => context.get("highlightedIndexPath").at(-1) === 0,
936
+ isHighlightedLastItem: ({ prop, context }) => {
937
+ const path = context.get("highlightedIndexPath");
938
+ const itemIndex = path.at(-1);
939
+ if (!itemIndex && itemIndex !== 0) return false;
940
+ const parentIndexPath = path.slice(0, -1);
941
+ return !prop("collection").at([...parentIndexPath, itemIndex + 1]);
942
+ },
943
+ shouldCloseOnSelect: ({ prop, event }) => {
944
+ const collection = prop("collection");
945
+ const node = collection.at(event.indexPath);
946
+ return prop("closeOnSelect") && node && !collection.isBranchNode(node);
947
+ },
948
+ shouldCloseOnSelectHighlighted: ({ prop, context }) => {
949
+ const collection = prop("collection");
950
+ const node = require_array.last(context.get("highlightedItems"));
951
+ return prop("closeOnSelect") && node != null && !collection.isBranchNode(node);
952
+ },
953
+ canSelectItem: ({ prop, event }) => {
954
+ const collection = prop("collection");
955
+ const node = collection.at(event.indexPath);
956
+ if (!node) return false;
957
+ return prop("allowParentSelection") || !collection.isBranchNode(node);
958
+ },
959
+ canSelectHighlightedItem: ({ prop, context }) => {
960
+ const collection = prop("collection");
961
+ const node = collection.at(context.get("highlightedIndexPath"));
962
+ if (!node) return false;
963
+ return prop("allowParentSelection") || !collection.isBranchNode(node);
964
+ },
965
+ canNavigateToChild: ({ prop, context }) => {
966
+ const highlightedIndexPath = context.get("highlightedIndexPath");
967
+ if (!highlightedIndexPath.length) return false;
968
+ const collection = prop("collection");
969
+ const node = collection.at(highlightedIndexPath);
970
+ return node && collection.isBranchNode(node);
971
+ },
972
+ canNavigateToParent: ({ context }) => context.get("highlightedIndexPath").length > 1,
973
+ isAtRootLevel: ({ context }) => context.get("highlightedIndexPath").length <= 1,
974
+ isHoverHighlight: ({ prop }) => prop("highlightTrigger") === "hover",
975
+ shouldHighlightOnHover: ({ prop, event }) => {
976
+ const collection = prop("collection");
977
+ const node = collection.at(event.indexPath);
978
+ return node && collection.isBranchNode(node);
979
+ },
980
+ shouldUpdateHighlightedIndexPath: ({ prop, context, event }) => {
981
+ const collection = prop("collection");
982
+ const currentHighlightedIndexPath = context.get("highlightedIndexPath");
983
+ if (!currentHighlightedIndexPath || currentHighlightedIndexPath.length === 0) return false;
984
+ const node = collection.at(event.indexPath);
985
+ if (!node || collection.isBranchNode(node)) return false;
986
+ const indexPath = event.indexPath;
987
+ if (!indexPath) return false;
988
+ const minLength = Math.min(indexPath.length, currentHighlightedIndexPath.length);
989
+ let commonPrefixLength = 0;
990
+ for (let i = 0; i < minLength; i++) if (indexPath[i] === currentHighlightedIndexPath[i]) commonPrefixLength = i + 1;
991
+ else break;
992
+ return commonPrefixLength > 0 && (commonPrefixLength < currentHighlightedIndexPath.length || commonPrefixLength < indexPath.length);
993
+ },
994
+ hasGraceArea: ({ context }) => {
995
+ return context.get("graceArea") != null;
996
+ },
997
+ isPointerOutsideGraceArea: ({ context, event }) => {
998
+ const graceArea = context.get("graceArea");
999
+ if (!graceArea) return false;
1000
+ return !isPointerInGraceArea({
1001
+ x: event.clientX,
1002
+ y: event.clientY
1003
+ }, graceArea);
1004
+ },
1005
+ isPointerNotInAnyItem: ({ event }) => {
1006
+ const target = event.target;
1007
+ const itemElement = target.closest("[data-part=\"item\"]");
1008
+ const contentElement = target.closest("[data-part=\"content\"]");
1009
+ return !contentElement || !itemElement && !!contentElement;
1010
+ }
1011
+ },
1012
+ effects: {
1013
+ trackFormControlState({ context, scope, prop }) {
1014
+ return require_form.trackFormControl(dom.getTriggerEl(scope), {
1015
+ onFieldsetDisabledChange(disabled) {
1016
+ context.set("fieldsetDisabled", disabled);
1017
+ },
1018
+ onFormReset() {
1019
+ context.set("value", prop("defaultValue") ?? []);
1020
+ }
1021
+ });
1022
+ },
1023
+ trackFocusVisible({ scope }) {
1024
+ return require_focus_visible.trackFocusVisible({ root: scope.getRootNode?.() });
1025
+ },
1026
+ trackDismissableElement({ scope, send, prop }) {
1027
+ const contentEl = () => dom.getContentEl(scope);
1028
+ let restoreFocus = true;
1029
+ return require_dismissable.trackDismissableElement(contentEl, {
1030
+ defer: true,
1031
+ exclude: [dom.getTriggerEl(scope), dom.getClearTriggerEl(scope)],
1032
+ onFocusOutside: prop("onFocusOutside"),
1033
+ onPointerDownOutside: prop("onPointerDownOutside"),
1034
+ onInteractOutside(event) {
1035
+ prop("onInteractOutside")?.(event);
1036
+ restoreFocus = !(event.detail.focusable || event.detail.contextmenu);
1037
+ },
1038
+ onDismiss() {
1039
+ send({
1040
+ type: "CLOSE",
1041
+ src: "interact-outside",
1042
+ restoreFocus
1043
+ });
1044
+ }
1045
+ });
1046
+ },
1047
+ computePlacement({ context, prop, scope }) {
1048
+ const triggerEl = () => dom.getTriggerEl(scope);
1049
+ const positionerEl = () => dom.getPositionerEl(scope);
1050
+ return require_popper.getPlacement(triggerEl, positionerEl, {
1051
+ ...prop("positioning"),
1052
+ onComplete(data) {
1053
+ context.set("currentPlacement", data.placement);
1054
+ }
1055
+ });
1056
+ },
1057
+ scrollToHighlightedItems({ context, prop, scope }) {
1058
+ let cleanups = [];
1059
+ const exec = (immediate) => {
1060
+ const highlightedValue = context.get("highlightedValue");
1061
+ const highlightedIndexPath = context.get("highlightedIndexPath");
1062
+ if (!highlightedIndexPath.length) return;
1063
+ if (require_focus_visible.getInteractionModality() === "pointer") return;
1064
+ dom.getListEls(scope).forEach((listEl, index) => {
1065
+ const itemPath = highlightedIndexPath.slice(0, index + 1);
1066
+ const itemEl = dom.getItemEl(scope, highlightedValue.toString());
1067
+ const scrollToIndexFn = prop("scrollToIndexFn");
1068
+ if (scrollToIndexFn) {
1069
+ const itemIndexInList = itemPath[itemPath.length - 1];
1070
+ scrollToIndexFn({
1071
+ index: itemIndexInList,
1072
+ immediate,
1073
+ depth: index
1074
+ });
1075
+ return;
1076
+ }
1077
+ const raf_cleanup = require_raf.raf(() => {
1078
+ require_scroll.scrollIntoView(itemEl, {
1079
+ rootEl: listEl,
1080
+ block: "nearest"
1081
+ });
1082
+ });
1083
+ cleanups.push(raf_cleanup);
1084
+ });
1085
+ };
1086
+ require_raf.raf(() => {
1087
+ require_focus_visible.setInteractionModality("virtual");
1088
+ exec(true);
1089
+ });
1090
+ const rafCleanup = require_raf.raf(() => exec(true));
1091
+ cleanups.push(rafCleanup);
1092
+ const observerCleanup = require_mutation_observer.observeAttributes(dom.getContentEl(scope), {
1093
+ attributes: ["data-activedescendant"],
1094
+ callback: () => exec(false)
1095
+ });
1096
+ cleanups.push(observerCleanup);
1097
+ return () => {
1098
+ cleanups.forEach((cleanup) => cleanup());
1099
+ };
1100
+ }
1101
+ },
1102
+ actions: {
1103
+ setValue(params) {
1104
+ set.value(params, params.event.value);
1105
+ },
1106
+ clearValue(params) {
1107
+ set.value(params, []);
1108
+ },
1109
+ setHighlightedValue(params) {
1110
+ const { event } = params;
1111
+ set.highlightedValue(params, event.value);
1112
+ },
1113
+ clearHighlightedValue(params) {
1114
+ set.highlightedValue(params, []);
1115
+ },
1116
+ reposition({ context, prop, scope, event }) {
1117
+ const positionerEl = () => dom.getPositionerEl(scope);
1118
+ require_popper.getPlacement(dom.getTriggerEl(scope), positionerEl, {
1119
+ ...prop("positioning"),
1120
+ ...event.options,
1121
+ defer: true,
1122
+ listeners: false,
1123
+ onComplete(data) {
1124
+ context.set("currentPlacement", data.placement);
1125
+ }
1126
+ });
1127
+ },
1128
+ selectItem(params) {
1129
+ const { context, prop, event } = params;
1130
+ const collection = prop("collection");
1131
+ const multiple = prop("multiple");
1132
+ const value = context.get("value");
1133
+ const itemValue = event.value;
1134
+ const indexPath = event.indexPath ?? collection.getIndexPath(itemValue);
1135
+ const node = collection.at(indexPath);
1136
+ const hasChildren = collection.isBranchNode(node);
1137
+ if (prop("allowParentSelection")) {
1138
+ if (multiple) {
1139
+ const filteredValue = value.filter((v) => {
1140
+ const shortPath = v.length < itemValue.length ? v : itemValue;
1141
+ return !(v.length < itemValue.length ? itemValue : v).slice(0, shortPath.length).every((val, i) => val === shortPath[i]) && !require_equal.isEqual(v, itemValue);
1142
+ });
1143
+ set.value(params, [...filteredValue, itemValue]);
1144
+ } else set.value(params, [itemValue]);
1145
+ if (hasChildren) set.highlightedValue(params, itemValue);
1146
+ } else if (hasChildren) {
1147
+ if (multiple && value.length > 0) set.value(params, [...value.slice(0, -1), itemValue]);
1148
+ else set.value(params, [itemValue]);
1149
+ set.highlightedValue(params, itemValue);
1150
+ } else if (multiple) {
1151
+ const existingIndex = value.findIndex((path) => require_equal.isEqual(path, itemValue));
1152
+ if (existingIndex >= 0) {
1153
+ const newValues = [...value];
1154
+ newValues.splice(existingIndex, 1);
1155
+ set.value(params, newValues);
1156
+ } else set.value(params, [...value, itemValue]);
1157
+ } else set.value(params, [itemValue]);
1158
+ },
1159
+ clearItem(params) {
1160
+ const { context, event } = params;
1161
+ const newValue = context.get("value").filter((v) => !require_equal.isEqual(v, event.value));
1162
+ set.value(params, newValue);
1163
+ },
1164
+ selectHighlightedItem({ context, send }) {
1165
+ const indexPath = context.get("highlightedIndexPath");
1166
+ const value = context.get("highlightedValue");
1167
+ if (value) send({
1168
+ type: "ITEM.SELECT",
1169
+ value,
1170
+ indexPath
1171
+ });
1172
+ },
1173
+ highlightFirstItem(params) {
1174
+ const { context, prop } = params;
1175
+ const collection = prop("collection");
1176
+ const highlightedValue = context.get("highlightedValue");
1177
+ let parentNode;
1178
+ if (!highlightedValue.length) parentNode = collection.rootNode;
1179
+ else {
1180
+ const indexPath = context.get("highlightedIndexPath");
1181
+ parentNode = collection.getParentNode(indexPath) ?? collection.rootNode;
1182
+ }
1183
+ const firstChild = collection.getNodeChildren(parentNode).find((child) => !collection.getNodeDisabled(child));
1184
+ if (!firstChild) return;
1185
+ const firstValue = collection.getNodeValue(firstChild);
1186
+ if (!highlightedValue.length) set.highlightedValue(params, [firstValue]);
1187
+ else {
1188
+ const parentPath = highlightedValue.slice(0, -1);
1189
+ set.highlightedValue(params, [...parentPath, firstValue]);
1190
+ }
1191
+ },
1192
+ highlightLastItem(params) {
1193
+ const { context, prop } = params;
1194
+ const collection = prop("collection");
1195
+ const highlightedValue = context.get("highlightedValue");
1196
+ let parentNode;
1197
+ if (!highlightedValue.length) parentNode = collection.rootNode;
1198
+ else {
1199
+ const indexPath = context.get("highlightedIndexPath");
1200
+ parentNode = collection.getParentNode(indexPath) ?? collection.rootNode;
1201
+ }
1202
+ const lastChild = collection.getNodeChildren(parentNode).findLast((child) => !collection.getNodeDisabled(child));
1203
+ if (!lastChild) return;
1204
+ const lastValue = collection.getNodeValue(lastChild);
1205
+ if (!highlightedValue.length) set.highlightedValue(params, [lastValue]);
1206
+ else {
1207
+ const parentPath = highlightedValue.slice(0, -1);
1208
+ set.highlightedValue(params, [...parentPath, lastValue]);
1209
+ }
1210
+ },
1211
+ highlightNextItem(params) {
1212
+ const { context, prop } = params;
1213
+ const collection = prop("collection");
1214
+ const highlightedValue = context.get("highlightedValue");
1215
+ if (!highlightedValue.length) return;
1216
+ const indexPath = context.get("highlightedIndexPath");
1217
+ const nextSibling = collection.getNextSibling(indexPath);
1218
+ if (!nextSibling) return;
1219
+ const nextValue = collection.getNodeValue(nextSibling);
1220
+ if (highlightedValue.length === 1) set.highlightedValue(params, [nextValue]);
1221
+ else {
1222
+ const parentPath = highlightedValue.slice(0, -1);
1223
+ set.highlightedValue(params, [...parentPath, nextValue]);
1224
+ }
1225
+ },
1226
+ highlightPreviousItem(params) {
1227
+ const { context, prop } = params;
1228
+ const collection = prop("collection");
1229
+ const highlightedValue = context.get("highlightedValue");
1230
+ if (!highlightedValue.length) return;
1231
+ const indexPath = context.get("highlightedIndexPath");
1232
+ const previousSibling = collection.getPreviousSibling(indexPath);
1233
+ if (!previousSibling) return;
1234
+ const prevValue = collection.getNodeValue(previousSibling);
1235
+ if (highlightedValue.length === 1) set.highlightedValue(params, [prevValue]);
1236
+ else {
1237
+ const parentPath = highlightedValue.slice(0, -1);
1238
+ set.highlightedValue(params, [...parentPath, prevValue]);
1239
+ }
1240
+ },
1241
+ highlightFirstChild(params) {
1242
+ const { context, prop } = params;
1243
+ const collection = prop("collection");
1244
+ const highlightedValue = context.get("highlightedValue");
1245
+ if (!highlightedValue.length) return;
1246
+ const indexPath = context.get("highlightedIndexPath");
1247
+ const node = collection.getFirstNode(collection.at(indexPath));
1248
+ if (!node) return;
1249
+ const childValue = collection.getNodeValue(node);
1250
+ set.highlightedValue(params, [...highlightedValue, childValue]);
1251
+ },
1252
+ highlightParent(params) {
1253
+ const { context } = params;
1254
+ const highlightedValue = context.get("highlightedValue");
1255
+ if (!highlightedValue.length) return;
1256
+ const parentPath = highlightedValue.slice(0, -1);
1257
+ set.highlightedValue(params, parentPath);
1258
+ },
1259
+ setInitialFocus({ scope }) {
1260
+ require_raf.raf(() => {
1261
+ dom.getContentEl(scope)?.focus({ preventScroll: true });
1262
+ });
1263
+ },
1264
+ focusTriggerEl({ event, scope }) {
1265
+ if (!restoreFocusFn(event)) return;
1266
+ require_raf.raf(() => {
1267
+ dom.getTriggerEl(scope)?.focus({ preventScroll: true });
1268
+ });
1269
+ },
1270
+ invokeOnOpen({ prop, context }) {
1271
+ prop("onOpenChange")?.({
1272
+ open: true,
1273
+ value: context.get("value")
1274
+ });
1275
+ },
1276
+ invokeOnClose({ prop, context }) {
1277
+ prop("onOpenChange")?.({
1278
+ open: false,
1279
+ value: context.get("value")
1280
+ });
1281
+ },
1282
+ toggleVisibility({ send, prop }) {
1283
+ if (prop("open") != null) send({ type: prop("open") ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE" });
1284
+ },
1285
+ highlightFirstSelectedItem(params) {
1286
+ const { context } = params;
1287
+ const value = context.get("value");
1288
+ if (require_array.isEmpty(value)) return;
1289
+ const mostRecentSelection = require_array.last(value);
1290
+ if (mostRecentSelection) set.highlightedValue(params, mostRecentSelection);
1291
+ },
1292
+ createGraceArea({ context, event, scope }) {
1293
+ const value = event.value.toString();
1294
+ const triggerElement = dom.getItemEl(scope, value);
1295
+ if (!triggerElement) return;
1296
+ const exitPoint = {
1297
+ x: event.clientX,
1298
+ y: event.clientY
1299
+ };
1300
+ const triggerRect = triggerElement.getBoundingClientRect();
1301
+ const nextLevelEl = dom.getListEl(scope, value);
1302
+ if (!nextLevelEl) return;
1303
+ const graceArea = createGraceArea(exitPoint, triggerRect, nextLevelEl.getBoundingClientRect());
1304
+ context.set("graceArea", graceArea);
1305
+ setTimeout(() => {
1306
+ context.set("graceArea", null);
1307
+ }, 300);
1308
+ },
1309
+ clearGraceArea({ context }) {
1310
+ context.set("graceArea", null);
1311
+ },
1312
+ setHighlightingForHoveredItem(params) {
1313
+ const { prop, event } = params;
1314
+ const collection = prop("collection");
1315
+ const node = collection.at(event.indexPath);
1316
+ let newHighlightedValue;
1317
+ if (node && collection.isBranchNode(node)) newHighlightedValue = event.value;
1318
+ else newHighlightedValue = event.value.slice(0, -1);
1319
+ set.highlightedValue(params, newHighlightedValue);
1320
+ },
1321
+ syncInputValue({ context, scope }) {
1322
+ const inputEl = dom.getHiddenInputEl(scope);
1323
+ if (!inputEl) return;
1324
+ require_form.setElementValue(inputEl, context.hash("value"));
1325
+ },
1326
+ dispatchChangeEvent({ scope, context }) {
1327
+ require_form.dispatchInputValueEvent(dom.getHiddenInputEl(scope), { value: context.hash("value") });
1328
+ },
1329
+ scrollContentToTop({ scope, prop }) {
1330
+ const scrollToIndexFn = prop("scrollToIndexFn");
1331
+ require_raf.raf(() => {
1332
+ (dom.getContentEl(scope)?.querySelectorAll("[data-part=\"list\"]"))?.forEach((listEl, index) => {
1333
+ if (scrollToIndexFn) scrollToIndexFn({
1334
+ index: 0,
1335
+ immediate: true,
1336
+ depth: index
1337
+ });
1338
+ else listEl.scrollTop = 0;
1339
+ });
1340
+ });
1341
+ }
1342
+ }
1343
+ }
1344
+ });
1345
+ const set = {
1346
+ value({ context, prop }, value) {
1347
+ const collection = prop("collection");
1348
+ context.set("value", value);
1349
+ const valueIndexPath = value.map((v) => collection.getIndexPath(v));
1350
+ context.set("valueIndexPath", valueIndexPath);
1351
+ const selectedItems = valueIndexPath.map((indexPath) => {
1352
+ return indexPath.map((_, index) => {
1353
+ const partialPath = indexPath.slice(0, index + 1);
1354
+ return collection.at(partialPath);
1355
+ });
1356
+ });
1357
+ context.set("selectedItems", selectedItems);
1358
+ prop("onValueChange")?.({
1359
+ value,
1360
+ items: selectedItems
1361
+ });
1362
+ },
1363
+ highlightedValue({ context, prop }, value) {
1364
+ const collection = prop("collection");
1365
+ context.set("highlightedValue", value);
1366
+ const highlightedIndexPath = (value == null ? [] : collection.getIndexPath(value)) ?? [];
1367
+ context.set("highlightedIndexPath", highlightedIndexPath);
1368
+ const highlightedItems = highlightedIndexPath.map((_, index) => {
1369
+ const partialPath = highlightedIndexPath.slice(0, index + 1);
1370
+ return collection.at(partialPath);
1371
+ });
1372
+ context.set("highlightedItems", highlightedItems);
1373
+ prop("onHighlightChange")?.({
1374
+ highlightedValue: value,
1375
+ highlightedItems
1376
+ });
1377
+ }
1378
+ };
1379
+ function restoreFocusFn(event) {
1380
+ const v = event.restoreFocus ?? event.previousEvent?.restoreFocus;
1381
+ return v == null || !!v;
1382
+ }
1383
+ //#endregion
1384
+ //#region src/machines/cascade-select/props.ts
1385
+ const props = require_create_props.createProps()([
1386
+ "allowParentSelection",
1387
+ "closeOnSelect",
1388
+ "collection",
1389
+ "defaultOpen",
1390
+ "defaultValue",
1391
+ "defaultHighlightedValue",
1392
+ "dir",
1393
+ "disabled",
1394
+ "formatValue",
1395
+ "form",
1396
+ "getRootNode",
1397
+ "highlightedValue",
1398
+ "highlightTrigger",
1399
+ "id",
1400
+ "ids",
1401
+ "invalid",
1402
+ "loopFocus",
1403
+ "multiple",
1404
+ "name",
1405
+ "onFocusOutside",
1406
+ "onHighlightChange",
1407
+ "onInteractOutside",
1408
+ "onOpenChange",
1409
+ "onPointerDownOutside",
1410
+ "onValueChange",
1411
+ "open",
1412
+ "positioning",
1413
+ "readOnly",
1414
+ "required",
1415
+ "scrollToIndexFn",
1416
+ "value"
1417
+ ]);
1418
+ const splitProps = require_utils.createSplitProps(props);
1419
+ //#endregion
1420
+ exports.anatomy = anatomy;
1421
+ exports.collection = collection;
1422
+ exports.connect = connect;
1423
+ exports.machine = machine;
1424
+ exports.parts = parts;
1425
+ exports.props = props;
1426
+ exports.splitProps = splitProps;