@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,1549 @@
1
+ import { t as createAnatomy } from "../../create-anatomy-B2q3wiaw.js";
2
+ import { E as isEditableElement, L as ariaAttr, S as getWindow, f as queryAll, k as isHTMLElement, p as contains, t as getByTypeahead, w as isAnchorElement, z as dataAttr } from "../../dom-query-e7fh0TEH.js";
3
+ import { _ as isPrintableKey, f as isDownloadingEvent, g as isOpeningInNewTab, h as isModifierKey, i as getEventPoint, r as getEventKey, s as getEventTarget, t as addDomEvent, u as isContextMenuEvent } from "../../event-bTItRgiw.js";
4
+ import { n as isValidTabEvent, t as getInitialFocus } from "../../initial-focus-BrN5tT2X.js";
5
+ import { i as raf } from "../../raf-Dhvm7f1e.js";
6
+ import { t as observeAttributes } from "../../mutation-observer-qObPUo3D.js";
7
+ import { t as clickIfLink } from "../../navigate-CJOaL3vx.js";
8
+ import { n as scrollIntoView } from "../../scroll-CVJ40w2e.js";
9
+ import { f as last, g as prev, o as first, p as next } from "../../array-C4KbHsha.js";
10
+ import { t as isEqual } from "../../equal-DtrP8DPh.js";
11
+ import { J as hasProp, Q as isFunction, R as cast, n as createSplitProps } from "../../utils-Cht5XaHf.js";
12
+ import { m as mergeProps, n as createGuards, r as createMachine } from "../../core-CJ0MZr3D.js";
13
+ import { n as trackDismissableElement } from "../../dismissable-KM1jPtNQ.js";
14
+ import { a as setInteractionModality, o as trackFocusVisible, t as getInteractionModality } from "../../focus-visible-DWdQf__4.js";
15
+ import { n as getPlacement, r as getPlacementSide, t as getPlacementStyles } from "../../popper-DzBZzAe4.js";
16
+ import "../../rect-utils-d_3gZVsc.js";
17
+ import { n as getElementPolygon, r as isPointInPolygon } from "../../polygon-BvdwYRBw.js";
18
+ import { t as createProps } from "../../create-props-CgtcN_Qu.js";
19
+ //#region src/machines/menu/anatomy.ts
20
+ const anatomy = createAnatomy("menu").parts("arrow", "arrowTip", "content", "contextTrigger", "indicator", "item", "itemGroup", "itemGroupLabel", "itemIndicator", "itemText", "positioner", "separator", "trigger", "triggerItem");
21
+ const parts = anatomy.build();
22
+ //#endregion
23
+ //#region src/machines/menu/dom.ts
24
+ const getTriggerId = (ctx, value) => {
25
+ const customId = ctx.ids?.trigger;
26
+ if (customId != null) return isFunction(customId) ? customId(value) : customId;
27
+ return value ? `menu:${ctx.id}:trigger:${value}` : `menu:${ctx.id}:trigger`;
28
+ };
29
+ const getContextTriggerId = (ctx, value) => {
30
+ const customId = ctx.ids?.contextTrigger;
31
+ if (customId != null) return isFunction(customId) ? customId(value) : customId;
32
+ return value ? `menu:${ctx.id}:ctx-trigger:${value}` : `menu:${ctx.id}:ctx-trigger`;
33
+ };
34
+ const getContentId = (ctx) => ctx.ids?.content ?? `menu:${ctx.id}:content`;
35
+ const getArrowId = (ctx) => ctx.ids?.arrow ?? `menu:${ctx.id}:arrow`;
36
+ const getPositionerId = (ctx) => ctx.ids?.positioner ?? `menu:${ctx.id}:popper`;
37
+ const getGroupId = (ctx, id) => ctx.ids?.group?.(id) ?? `menu:${ctx.id}:group:${id}`;
38
+ const getItemId = (ctx, id) => `${ctx.id}/${id}`;
39
+ const getItemValue = (el) => el?.dataset.value ?? null;
40
+ const getGroupLabelId = (ctx, id) => ctx.ids?.groupLabel?.(id) ?? `menu:${ctx.id}:group-label:${id}`;
41
+ const getContentEl = (ctx) => ctx.getById(getContentId(ctx));
42
+ const getPositionerEl = (ctx) => ctx.getById(getPositionerId(ctx));
43
+ const getTriggerEl = (ctx) => ctx.getById(getTriggerId(ctx));
44
+ const getItemEl = (ctx, value) => value ? ctx.getById(getItemId(ctx, value)) : null;
45
+ const getContextTriggerEl = (ctx) => ctx.getById(getContextTriggerId(ctx));
46
+ const getTriggerEls = (ctx) => queryAll(ctx.getRootNode(), `[data-scope="menu"][data-part="trigger"][data-ownedby="${ctx.id}"]`);
47
+ const getContextTriggerEls = (ctx) => queryAll(ctx.getRootNode(), `[data-scope="menu"][data-part="context-trigger"][data-ownedby="${ctx.id}"]`);
48
+ const getActiveTriggerEl = (ctx, value) => {
49
+ if (value == null) return getTriggerEl(ctx) ?? getTriggerEls(ctx)[0];
50
+ return ctx.getById(getTriggerId(ctx, value));
51
+ };
52
+ const getElements = (ctx) => {
53
+ const selector = `[role^="menuitem"][data-ownedby=${CSS.escape(getContentId(ctx))}]:not([data-disabled])`;
54
+ return queryAll(getContentEl(ctx), selector);
55
+ };
56
+ const getFirstEl = (ctx) => first(getElements(ctx));
57
+ const getLastEl = (ctx) => last(getElements(ctx));
58
+ const isMatch = (el, value) => {
59
+ if (!value) return false;
60
+ return el.id === value || el.dataset.value === value;
61
+ };
62
+ const getNextEl = (ctx, opts) => {
63
+ const items = getElements(ctx);
64
+ return next(items, items.findIndex((el) => isMatch(el, opts.value)), { loop: opts.loop ?? opts.loopFocus });
65
+ };
66
+ const getPrevEl = (ctx, opts) => {
67
+ const items = getElements(ctx);
68
+ return prev(items, items.findIndex((el) => isMatch(el, opts.value)), { loop: opts.loop ?? opts.loopFocus });
69
+ };
70
+ const getElemByKey = (ctx, opts) => {
71
+ const items = getElements(ctx);
72
+ const item = items.find((el) => isMatch(el, opts.value));
73
+ return getByTypeahead(items, {
74
+ state: opts.typeaheadState,
75
+ key: opts.key,
76
+ activeId: item?.id ?? null
77
+ });
78
+ };
79
+ const isTargetDisabled = (v) => {
80
+ return isHTMLElement(v) && (v.dataset.disabled === "" || v.hasAttribute("disabled"));
81
+ };
82
+ const isTriggerItem = (el) => {
83
+ return !!el?.getAttribute("role")?.startsWith("menuitem") && !!el?.hasAttribute("data-controls");
84
+ };
85
+ const itemSelectEvent = "menu:select";
86
+ function dispatchSelectionEvent(el, value) {
87
+ if (!el) return;
88
+ const event = new (getWindow(el)).CustomEvent(itemSelectEvent, { detail: { value } });
89
+ el.dispatchEvent(event);
90
+ }
91
+ function getPortaledContentEl(scope) {
92
+ const contentId = getContentId(scope);
93
+ return getContentEl(scope) ?? scope.getDoc().getElementById(contentId);
94
+ }
95
+ function isTargetWithinMenuTree(target, children) {
96
+ if (!isHTMLElement(target)) return false;
97
+ for (const id in children) {
98
+ const child = children[id];
99
+ const childContent = getPortaledContentEl(child.scope);
100
+ if (childContent && contains(childContent, target)) return true;
101
+ const nested = child.refs.get("children");
102
+ if (Object.keys(nested).length > 0 && isTargetWithinMenuTree(target, nested)) return true;
103
+ }
104
+ return false;
105
+ }
106
+ //#endregion
107
+ //#region src/machines/menu/utils.ts
108
+ function closeRootMenu(ctx) {
109
+ let parent = ctx.parent;
110
+ while (parent && parent.context.get("isSubmenu")) parent = parent.refs.get("parent");
111
+ parent?.send({ type: "CLOSE" });
112
+ }
113
+ function isWithinPolygon(polygon, point) {
114
+ if (!polygon) return false;
115
+ return isPointInPolygon(polygon, point);
116
+ }
117
+ function resolveItemId(children, value, scope) {
118
+ const hasChildren = Object.keys(children).length > 0;
119
+ if (!value) return null;
120
+ if (!hasChildren) return getItemId(scope, value);
121
+ for (const id in children) {
122
+ const childMenu = children[id];
123
+ const childTriggerId = getTriggerId(childMenu.scope);
124
+ if (childTriggerId === value) return childTriggerId;
125
+ }
126
+ return getItemId(scope, value);
127
+ }
128
+ function setParentRoutingLock(parent, locked) {
129
+ if (!parent) return;
130
+ parent.refs.set("pointerRoutingLocked", locked);
131
+ parent.context.set("pointerRoutingMode", locked ? "locked" : "interactive");
132
+ }
133
+ function isHighlightedItemSubmenuOpen(parent) {
134
+ const highlighted = parent.context.get("highlightedValue");
135
+ if (!highlighted) return false;
136
+ const children = parent.refs.get("children");
137
+ for (const id in children) {
138
+ const child = children[id];
139
+ if (!child.state.hasTag("open")) continue;
140
+ if (getTriggerId(child.scope) === highlighted) return true;
141
+ }
142
+ return false;
143
+ }
144
+ function unlockParentAfterChildClose(parent, childIsSubmenu) {
145
+ if (!parent) return;
146
+ if (parent.refs.get("pointerRoutingLocked")) return;
147
+ if (childIsSubmenu && isHighlightedItemSubmenuOpen(parent)) return;
148
+ setParentRoutingLock(parent, false);
149
+ }
150
+ function unlockParentOnSubmenuClose(parent) {
151
+ if (!parent) return;
152
+ if (!isHighlightedItemSubmenuOpen(parent)) setParentRoutingLock(parent, false);
153
+ }
154
+ //#endregion
155
+ //#region src/machines/menu/connect.ts
156
+ function connect(service, normalize) {
157
+ const { context, send, state, computed, prop, scope } = service;
158
+ const open = state.hasTag("open");
159
+ const isSubmenu = context.get("isSubmenu");
160
+ const isTypingAhead = computed("isTypingAhead");
161
+ const composite = prop("composite");
162
+ const currentPlacement = context.get("currentPlacement");
163
+ const currentPlacementSide = currentPlacement ? getPlacementSide(currentPlacement) : void 0;
164
+ const anchorPoint = context.get("anchorPoint");
165
+ const highlightedValue = context.get("highlightedValue");
166
+ const triggerValue = context.get("triggerValue");
167
+ const popperStyles = getPlacementStyles({
168
+ ...prop("positioning"),
169
+ placement: currentPlacement
170
+ });
171
+ function getItemState(props) {
172
+ return {
173
+ id: getItemId(scope, props.value),
174
+ disabled: !!props.disabled,
175
+ highlighted: highlightedValue === props.value
176
+ };
177
+ }
178
+ function getOptionItemProps(props) {
179
+ const valueText = props.valueText ?? props.value;
180
+ return {
181
+ ...props,
182
+ id: props.value,
183
+ valueText
184
+ };
185
+ }
186
+ function getOptionItemState(props) {
187
+ return {
188
+ ...getItemState(getOptionItemProps(props)),
189
+ checked: !!props.checked
190
+ };
191
+ }
192
+ function getItemProps(props) {
193
+ const { closeOnSelect, valueText, value } = props;
194
+ const itemState = getItemState(props);
195
+ const id = getItemId(scope, value);
196
+ return normalize.element({
197
+ ...parts.item.attrs,
198
+ id,
199
+ role: "menuitem",
200
+ "aria-disabled": ariaAttr(itemState.disabled),
201
+ "data-disabled": dataAttr(itemState.disabled),
202
+ "data-ownedby": getContentId(scope),
203
+ "data-highlighted": dataAttr(itemState.highlighted),
204
+ "data-value": value,
205
+ "data-valuetext": valueText,
206
+ onDragStart(event) {
207
+ if (event.currentTarget.matches("a[href]")) event.preventDefault();
208
+ },
209
+ onPointerMove(event) {
210
+ if (itemState.disabled) return;
211
+ if (event.pointerType !== "mouse") return;
212
+ const target = event.currentTarget;
213
+ if (itemState.highlighted) return;
214
+ const point = getEventPoint(event);
215
+ send({
216
+ type: "ITEM_POINTERMOVE",
217
+ id,
218
+ target,
219
+ closeOnSelect,
220
+ point
221
+ });
222
+ },
223
+ onPointerLeave(event) {
224
+ if (itemState.disabled) return;
225
+ if (event.pointerType !== "mouse") return;
226
+ if (!service.event.previous()?.type.includes("POINTER")) return;
227
+ const target = event.currentTarget;
228
+ send({
229
+ type: "ITEM_POINTERLEAVE",
230
+ id,
231
+ target,
232
+ closeOnSelect
233
+ });
234
+ },
235
+ onPointerDown(event) {
236
+ if (itemState.disabled) return;
237
+ const target = event.currentTarget;
238
+ send({
239
+ type: "ITEM_POINTERDOWN",
240
+ target,
241
+ id,
242
+ closeOnSelect
243
+ });
244
+ },
245
+ onClick(event) {
246
+ if (isDownloadingEvent(event)) return;
247
+ if (isOpeningInNewTab(event)) return;
248
+ if (itemState.disabled) return;
249
+ const target = event.currentTarget;
250
+ send({
251
+ type: "ITEM_CLICK",
252
+ target,
253
+ id,
254
+ closeOnSelect
255
+ });
256
+ }
257
+ });
258
+ }
259
+ return {
260
+ highlightedValue,
261
+ open,
262
+ setOpen(nextOpen) {
263
+ if (state.hasTag("open") === nextOpen) return;
264
+ send({ type: nextOpen ? "OPEN" : "CLOSE" });
265
+ },
266
+ triggerValue,
267
+ setTriggerValue(value) {
268
+ send({
269
+ type: "TRIGGER_VALUE.SET",
270
+ value
271
+ });
272
+ },
273
+ setHighlightedValue(value) {
274
+ send({
275
+ type: "HIGHLIGHTED.SET",
276
+ value
277
+ });
278
+ },
279
+ setParent(parent) {
280
+ send({
281
+ type: "PARENT.SET",
282
+ value: parent,
283
+ id: parent.prop("id")
284
+ });
285
+ },
286
+ setChild(child) {
287
+ send({
288
+ type: "CHILD.SET",
289
+ value: child,
290
+ id: child.prop("id")
291
+ });
292
+ },
293
+ reposition(options = {}) {
294
+ send({
295
+ type: "POSITIONING.SET",
296
+ options
297
+ });
298
+ },
299
+ addItemListener(props) {
300
+ const node = scope.getById(props.id);
301
+ if (!node) return;
302
+ const listener = () => props.onSelect?.();
303
+ node.addEventListener(itemSelectEvent, listener);
304
+ return () => node.removeEventListener(itemSelectEvent, listener);
305
+ },
306
+ getContextTriggerProps(props = {}) {
307
+ const { value } = props;
308
+ const current = value == null ? false : triggerValue === value;
309
+ const contextTriggerId = getContextTriggerId(scope, value);
310
+ return normalize.element({
311
+ ...parts.contextTrigger.attrs,
312
+ dir: prop("dir"),
313
+ id: contextTriggerId,
314
+ "data-ownedby": scope.id,
315
+ "data-value": value,
316
+ "data-current": dataAttr(current),
317
+ "data-state": open ? "open" : "closed",
318
+ onPointerDown(event) {
319
+ if (event.pointerType === "mouse") return;
320
+ const point = getEventPoint(event);
321
+ send({
322
+ type: "CONTEXT_MENU_START",
323
+ point,
324
+ value
325
+ });
326
+ },
327
+ onPointerCancel(event) {
328
+ if (event.pointerType === "mouse") return;
329
+ send({ type: "CONTEXT_MENU_CANCEL" });
330
+ },
331
+ onPointerMove(event) {
332
+ if (event.pointerType === "mouse") return;
333
+ send({ type: "CONTEXT_MENU_CANCEL" });
334
+ },
335
+ onPointerUp(event) {
336
+ if (event.pointerType === "mouse") return;
337
+ send({ type: "CONTEXT_MENU_CANCEL" });
338
+ },
339
+ onContextMenu(event) {
340
+ const point = getEventPoint(event);
341
+ send({
342
+ type: open && value != null && !current ? "TRIGGER_VALUE.SET" : "CONTEXT_MENU",
343
+ point,
344
+ value
345
+ });
346
+ event.preventDefault();
347
+ },
348
+ style: {
349
+ WebkitTouchCallout: "none",
350
+ WebkitUserSelect: "none",
351
+ userSelect: "none"
352
+ }
353
+ });
354
+ },
355
+ getTriggerItemProps(childApi) {
356
+ const triggerProps = childApi.getTriggerProps();
357
+ return mergeProps(getItemProps({ value: triggerProps.id }), triggerProps);
358
+ },
359
+ getTriggerProps(props = {}) {
360
+ const { value } = props;
361
+ const current = value == null ? false : triggerValue === value;
362
+ const triggerId = getTriggerId(scope, value);
363
+ return normalize.button({
364
+ ...isSubmenu ? parts.triggerItem.attrs : parts.trigger.attrs,
365
+ "data-placement": currentPlacement,
366
+ "data-side": currentPlacementSide,
367
+ type: "button",
368
+ dir: prop("dir"),
369
+ id: triggerId,
370
+ ...value != null && {
371
+ "data-ownedby": scope.id,
372
+ "data-value": value,
373
+ "data-current": dataAttr(current)
374
+ },
375
+ "data-uid": prop("id"),
376
+ "aria-haspopup": composite ? "menu" : "dialog",
377
+ "aria-controls": getContentId(scope),
378
+ "data-controls": getContentId(scope),
379
+ "aria-expanded": value == null ? open : open && current,
380
+ "data-state": open ? "open" : "closed",
381
+ onPointerMove(event) {
382
+ if (event.pointerType !== "mouse") return;
383
+ if (isTargetDisabled(event.currentTarget) || !isSubmenu) return;
384
+ const point = getEventPoint(event);
385
+ send({
386
+ type: "TRIGGER_POINTERMOVE",
387
+ target: event.currentTarget,
388
+ point
389
+ });
390
+ },
391
+ onPointerLeave(event) {
392
+ if (isTargetDisabled(event.currentTarget)) return;
393
+ if (event.pointerType !== "mouse") return;
394
+ if (!isSubmenu) return;
395
+ setParentRoutingLock(service.refs.get("parent"), true);
396
+ const point = getEventPoint(event);
397
+ send({
398
+ type: "TRIGGER_POINTERLEAVE",
399
+ target: event.currentTarget,
400
+ point
401
+ });
402
+ },
403
+ onPointerDown(event) {
404
+ if (isTargetDisabled(event.currentTarget)) return;
405
+ if (isContextMenuEvent(event)) return;
406
+ event.preventDefault();
407
+ },
408
+ onClick(event) {
409
+ if (event.defaultPrevented) return;
410
+ if (isTargetDisabled(event.currentTarget)) return;
411
+ send({
412
+ type: open && value != null && !current ? "TRIGGER_VALUE.SET" : "TRIGGER_CLICK",
413
+ target: event.currentTarget,
414
+ value
415
+ });
416
+ },
417
+ onBlur() {
418
+ send({ type: "TRIGGER_BLUR" });
419
+ },
420
+ onFocus() {
421
+ send({ type: "TRIGGER_FOCUS" });
422
+ },
423
+ onKeyDown(event) {
424
+ if (event.defaultPrevented) return;
425
+ const exec = {
426
+ ArrowDown() {
427
+ send({
428
+ type: "ARROW_DOWN",
429
+ value
430
+ });
431
+ },
432
+ ArrowUp() {
433
+ send({
434
+ type: "ARROW_UP",
435
+ value
436
+ });
437
+ },
438
+ Enter() {
439
+ send({
440
+ type: "ARROW_DOWN",
441
+ src: "enter",
442
+ value
443
+ });
444
+ },
445
+ Space() {
446
+ send({
447
+ type: "ARROW_DOWN",
448
+ src: "space",
449
+ value
450
+ });
451
+ }
452
+ }[getEventKey(event, {
453
+ orientation: "vertical",
454
+ dir: prop("dir")
455
+ })];
456
+ if (exec) {
457
+ event.preventDefault();
458
+ exec(event);
459
+ }
460
+ }
461
+ });
462
+ },
463
+ getIndicatorProps() {
464
+ return normalize.element({
465
+ ...parts.indicator.attrs,
466
+ dir: prop("dir"),
467
+ "data-state": open ? "open" : "closed"
468
+ });
469
+ },
470
+ getPositionerProps() {
471
+ return normalize.element({
472
+ ...parts.positioner.attrs,
473
+ dir: prop("dir"),
474
+ id: getPositionerId(scope),
475
+ style: popperStyles.floating
476
+ });
477
+ },
478
+ getArrowProps() {
479
+ return normalize.element({
480
+ id: getArrowId(scope),
481
+ ...parts.arrow.attrs,
482
+ dir: prop("dir"),
483
+ style: popperStyles.arrow
484
+ });
485
+ },
486
+ getArrowTipProps() {
487
+ return normalize.element({
488
+ ...parts.arrowTip.attrs,
489
+ dir: prop("dir"),
490
+ style: popperStyles.arrowTip
491
+ });
492
+ },
493
+ getContentProps() {
494
+ return normalize.element({
495
+ ...parts.content.attrs,
496
+ id: getContentId(scope),
497
+ "aria-label": prop("aria-label"),
498
+ hidden: !open,
499
+ "data-state": open ? "open" : "closed",
500
+ role: composite ? "menu" : "dialog",
501
+ tabIndex: 0,
502
+ dir: prop("dir"),
503
+ "aria-activedescendant": computed("highlightedId") || void 0,
504
+ "aria-labelledby": anchorPoint ? getContextTriggerId(scope, triggerValue ?? void 0) : getTriggerId(scope, triggerValue ?? void 0),
505
+ "data-placement": currentPlacement,
506
+ "data-side": currentPlacementSide,
507
+ onPointerEnter(event) {
508
+ if (event.pointerType !== "mouse") return;
509
+ send({ type: "MENU_POINTERENTER" });
510
+ },
511
+ onKeyDown(event) {
512
+ if (event.defaultPrevented) return;
513
+ if (!contains(event.currentTarget, getEventTarget(event))) return;
514
+ const target = getEventTarget(event);
515
+ if (!(target?.closest("[role=menu]") === event.currentTarget || target === event.currentTarget)) return;
516
+ if (event.key === "Tab") {
517
+ if (!isValidTabEvent(event)) {
518
+ event.preventDefault();
519
+ return;
520
+ }
521
+ }
522
+ const keyMap = {
523
+ ArrowDown() {
524
+ send({ type: "ARROW_DOWN" });
525
+ },
526
+ ArrowUp() {
527
+ send({ type: "ARROW_UP" });
528
+ },
529
+ ArrowLeft() {
530
+ send({ type: "ARROW_LEFT" });
531
+ },
532
+ ArrowRight() {
533
+ send({ type: "ARROW_RIGHT" });
534
+ },
535
+ Enter() {
536
+ send({ type: "ENTER" });
537
+ },
538
+ Space(event) {
539
+ if (isTypingAhead) send({
540
+ type: "TYPEAHEAD",
541
+ key: event.key
542
+ });
543
+ else keyMap.Enter?.(event);
544
+ },
545
+ Home() {
546
+ send({ type: "HOME" });
547
+ },
548
+ End() {
549
+ send({ type: "END" });
550
+ }
551
+ };
552
+ const exec = keyMap[getEventKey(event, { dir: prop("dir") })];
553
+ if (exec) {
554
+ exec(event);
555
+ event.stopPropagation();
556
+ event.preventDefault();
557
+ return;
558
+ }
559
+ if (!prop("typeahead")) return;
560
+ if (!isPrintableKey(event)) return;
561
+ if (isModifierKey(event)) return;
562
+ if (isEditableElement(target)) return;
563
+ send({
564
+ type: "TYPEAHEAD",
565
+ key: event.key
566
+ });
567
+ event.preventDefault();
568
+ }
569
+ });
570
+ },
571
+ getSeparatorProps() {
572
+ return normalize.element({
573
+ ...parts.separator.attrs,
574
+ role: "separator",
575
+ dir: prop("dir"),
576
+ "aria-orientation": "horizontal"
577
+ });
578
+ },
579
+ getItemState,
580
+ getItemProps,
581
+ getOptionItemState,
582
+ getOptionItemProps(props) {
583
+ const { type, disabled, closeOnSelect } = props;
584
+ const option = getOptionItemProps(props);
585
+ const itemState = getOptionItemState(props);
586
+ return {
587
+ ...getItemProps(option),
588
+ ...normalize.element({
589
+ "data-type": type,
590
+ ...parts.item.attrs,
591
+ dir: prop("dir"),
592
+ "data-value": option.value,
593
+ role: `menuitem${type}`,
594
+ "aria-checked": !!itemState.checked,
595
+ "data-state": itemState.checked ? "checked" : "unchecked",
596
+ onClick(event) {
597
+ if (disabled) return;
598
+ if (isDownloadingEvent(event)) return;
599
+ if (isOpeningInNewTab(event)) return;
600
+ const target = event.currentTarget;
601
+ send({
602
+ type: "ITEM_CLICK",
603
+ target,
604
+ option,
605
+ closeOnSelect
606
+ });
607
+ }
608
+ })
609
+ };
610
+ },
611
+ getItemIndicatorProps(props) {
612
+ const itemState = getOptionItemState(cast(props));
613
+ const dataState = itemState.checked ? "checked" : "unchecked";
614
+ return normalize.element({
615
+ ...parts.itemIndicator.attrs,
616
+ dir: prop("dir"),
617
+ "data-disabled": dataAttr(itemState.disabled),
618
+ "data-highlighted": dataAttr(itemState.highlighted),
619
+ "data-state": hasProp(props, "checked") ? dataState : void 0,
620
+ hidden: hasProp(props, "checked") ? !itemState.checked : void 0
621
+ });
622
+ },
623
+ getItemTextProps(props) {
624
+ const itemState = getOptionItemState(cast(props));
625
+ const dataState = itemState.checked ? "checked" : "unchecked";
626
+ return normalize.element({
627
+ ...parts.itemText.attrs,
628
+ dir: prop("dir"),
629
+ "data-disabled": dataAttr(itemState.disabled),
630
+ "data-highlighted": dataAttr(itemState.highlighted),
631
+ "data-state": hasProp(props, "checked") ? dataState : void 0
632
+ });
633
+ },
634
+ getItemGroupLabelProps(props) {
635
+ return normalize.element({
636
+ ...parts.itemGroupLabel.attrs,
637
+ id: getGroupLabelId(scope, props.htmlFor),
638
+ dir: prop("dir")
639
+ });
640
+ },
641
+ getItemGroupProps(props) {
642
+ return normalize.element({
643
+ id: getGroupId(scope, props.id),
644
+ ...parts.itemGroup.attrs,
645
+ dir: prop("dir"),
646
+ "aria-labelledby": getGroupLabelId(scope, props.id),
647
+ role: "group"
648
+ });
649
+ }
650
+ };
651
+ }
652
+ //#endregion
653
+ //#region src/machines/menu/machine.ts
654
+ const { not, and, or } = createGuards();
655
+ const machine = createMachine({
656
+ props({ props }) {
657
+ return {
658
+ closeOnSelect: true,
659
+ typeahead: true,
660
+ composite: true,
661
+ loopFocus: false,
662
+ navigate(details) {
663
+ clickIfLink(details.node);
664
+ },
665
+ ...props,
666
+ positioning: {
667
+ placement: "bottom-start",
668
+ gutter: 8,
669
+ ...props.positioning
670
+ }
671
+ };
672
+ },
673
+ initialState({ prop }) {
674
+ return prop("open") || prop("defaultOpen") ? "open" : "idle";
675
+ },
676
+ context({ bindable, prop, scope }) {
677
+ return {
678
+ highlightedValue: bindable(() => ({
679
+ defaultValue: prop("defaultHighlightedValue") || null,
680
+ value: prop("highlightedValue"),
681
+ onChange(value) {
682
+ prop("onHighlightChange")?.({ highlightedValue: value });
683
+ }
684
+ })),
685
+ lastHighlightedValue: bindable(() => ({ defaultValue: null })),
686
+ currentPlacement: bindable(() => ({ defaultValue: void 0 })),
687
+ intentPolygon: bindable(() => ({ defaultValue: null })),
688
+ anchorPoint: bindable(() => ({
689
+ defaultValue: null,
690
+ hash(value) {
691
+ return `x: ${value?.x}, y: ${value?.y}`;
692
+ }
693
+ })),
694
+ isSubmenu: bindable(() => ({ defaultValue: false })),
695
+ triggerValue: bindable(() => ({
696
+ defaultValue: prop("defaultTriggerValue") ?? null,
697
+ value: prop("triggerValue"),
698
+ onChange(value) {
699
+ const onTriggerValueChange = prop("onTriggerValueChange");
700
+ if (!onTriggerValueChange) return;
701
+ onTriggerValueChange({
702
+ value,
703
+ triggerElement: getActiveTriggerEl(scope, value)
704
+ });
705
+ }
706
+ })),
707
+ pointerRoutingMode: bindable(() => ({ defaultValue: "interactive" }))
708
+ };
709
+ },
710
+ refs() {
711
+ return {
712
+ parent: null,
713
+ children: {},
714
+ pointerRoutingLocked: false,
715
+ typeaheadState: { ...getByTypeahead.defaultOptions },
716
+ positioningOverride: {}
717
+ };
718
+ },
719
+ computed: {
720
+ isRtl: ({ prop }) => prop("dir") === "rtl",
721
+ isTypingAhead: ({ refs }) => refs.get("typeaheadState").keysSoFar !== "",
722
+ highlightedId: ({ context, scope, refs }) => resolveItemId(refs.get("children"), context.get("highlightedValue"), scope)
723
+ },
724
+ watch({ track, action, context, prop }) {
725
+ track([() => context.get("isSubmenu")], () => {
726
+ action(["setSubmenuPlacement"]);
727
+ });
728
+ track([() => context.hash("anchorPoint")], () => {
729
+ if (!context.get("anchorPoint")) return;
730
+ action(["reposition"]);
731
+ });
732
+ track([() => prop("open")], () => {
733
+ action(["toggleVisibility"]);
734
+ });
735
+ },
736
+ on: {
737
+ "TRIGGER_VALUE.SET": { actions: [
738
+ "setTriggerValue",
739
+ "setAnchorPoint",
740
+ "reposition",
741
+ "focusMenu"
742
+ ] },
743
+ "PARENT.SET": { actions: ["setParentMenu"] },
744
+ "CHILD.SET": { actions: ["setChildMenu"] },
745
+ OPEN: [{
746
+ guard: "isOpenControlled",
747
+ actions: ["setTriggerValue", "invokeOnOpen"]
748
+ }, {
749
+ target: "open",
750
+ actions: ["setTriggerValue", "invokeOnOpen"]
751
+ }],
752
+ OPEN_AUTOFOCUS: [{
753
+ guard: "isOpenControlled",
754
+ actions: ["setTriggerValue", "invokeOnOpen"]
755
+ }, {
756
+ target: "open",
757
+ actions: [
758
+ "setTriggerValue",
759
+ "highlightFirstItem",
760
+ "invokeOnOpen"
761
+ ]
762
+ }],
763
+ CLOSE: [{
764
+ guard: "isOpenControlled",
765
+ actions: ["invokeOnClose", "releaseParentRoutingLock"]
766
+ }, {
767
+ target: "closed",
768
+ actions: [
769
+ "invokeOnClose",
770
+ "releaseParentRoutingLock",
771
+ "focusTrigger"
772
+ ]
773
+ }],
774
+ "HIGHLIGHTED.RESTORE": { actions: ["restoreHighlightedItem"] },
775
+ "HIGHLIGHTED.SET": { actions: ["setHighlightedItem"] },
776
+ "HIGHLIGHTED.SUGGEST": { actions: ["suggestHighlightedItem"] }
777
+ },
778
+ states: {
779
+ idle: {
780
+ tags: ["closed"],
781
+ on: {
782
+ "CONTROLLED.OPEN": { target: "open" },
783
+ "CONTROLLED.CLOSE": { target: "closed" },
784
+ CONTEXT_MENU_START: {
785
+ target: "opening:contextmenu",
786
+ actions: ["setAnchorPoint", "setTriggerValue"]
787
+ },
788
+ CONTEXT_MENU: [{
789
+ guard: "isOpenControlled",
790
+ actions: [
791
+ "setAnchorPoint",
792
+ "setTriggerValue",
793
+ "invokeOnOpen"
794
+ ]
795
+ }, {
796
+ target: "open",
797
+ actions: [
798
+ "setAnchorPoint",
799
+ "setTriggerValue",
800
+ "invokeOnOpen"
801
+ ]
802
+ }],
803
+ TRIGGER_CLICK: [{
804
+ guard: "isOpenControlled",
805
+ actions: ["invokeOnOpen", "setTriggerValue"]
806
+ }, {
807
+ target: "open",
808
+ actions: ["invokeOnOpen", "setTriggerValue"]
809
+ }],
810
+ TRIGGER_FOCUS: {
811
+ guard: not("isSubmenu"),
812
+ target: "closed"
813
+ },
814
+ TRIGGER_POINTERMOVE: {
815
+ guard: "isSubmenu",
816
+ target: "opening"
817
+ }
818
+ }
819
+ },
820
+ "opening:contextmenu": {
821
+ tags: ["closed"],
822
+ effects: ["waitForLongPress"],
823
+ on: {
824
+ "CONTROLLED.OPEN": {
825
+ target: "open",
826
+ actions: ["reposition"]
827
+ },
828
+ "CONTROLLED.CLOSE": {
829
+ target: "closed",
830
+ actions: ["focusTrigger"]
831
+ },
832
+ CONTEXT_MENU_CANCEL: [{
833
+ guard: "isOpenControlled",
834
+ actions: ["invokeOnClose", "releaseParentRoutingLock"]
835
+ }, {
836
+ target: "closed",
837
+ actions: [
838
+ "invokeOnClose",
839
+ "releaseParentRoutingLock",
840
+ "focusTrigger"
841
+ ]
842
+ }],
843
+ "LONG_PRESS.OPEN": [{
844
+ guard: "isOpenControlled",
845
+ actions: ["setTriggerValue", "invokeOnOpen"]
846
+ }, {
847
+ target: "open",
848
+ actions: [
849
+ "setTriggerValue",
850
+ "invokeOnOpen",
851
+ "reposition"
852
+ ]
853
+ }]
854
+ }
855
+ },
856
+ opening: {
857
+ tags: ["closed"],
858
+ effects: ["waitForOpenDelay"],
859
+ on: {
860
+ "CONTROLLED.OPEN": { target: "open" },
861
+ "CONTROLLED.CLOSE": {
862
+ target: "closed",
863
+ actions: ["focusTrigger"]
864
+ },
865
+ BLUR: [{
866
+ guard: "isOpenControlled",
867
+ actions: ["invokeOnClose", "releaseParentRoutingLock"]
868
+ }, {
869
+ target: "closed",
870
+ actions: [
871
+ "invokeOnClose",
872
+ "releaseParentRoutingLock",
873
+ "focusTrigger"
874
+ ]
875
+ }],
876
+ TRIGGER_POINTERLEAVE: [{
877
+ guard: "isOpenControlled",
878
+ actions: ["invokeOnClose", "releaseParentRoutingLock"]
879
+ }, {
880
+ target: "closed",
881
+ actions: [
882
+ "invokeOnClose",
883
+ "releaseParentRoutingLock",
884
+ "focusTrigger"
885
+ ]
886
+ }],
887
+ "DELAY.OPEN": [{
888
+ guard: "isOpenControlled",
889
+ actions: ["invokeOnOpen"]
890
+ }, {
891
+ target: "open",
892
+ actions: ["invokeOnOpen"]
893
+ }]
894
+ }
895
+ },
896
+ closing: {
897
+ tags: ["open"],
898
+ effects: [
899
+ "trackPointerMove",
900
+ "trackInteractOutside",
901
+ "waitForCloseDelay"
902
+ ],
903
+ on: {
904
+ "CONTROLLED.OPEN": { target: "open" },
905
+ "CONTROLLED.CLOSE": {
906
+ target: "closed",
907
+ actions: ["focusParentMenu", "restoreParentHighlightedItem"]
908
+ },
909
+ MENU_POINTERENTER: {
910
+ target: "open",
911
+ actions: ["clearIntentPolygon"]
912
+ },
913
+ POINTER_MOVED_AWAY_FROM_SUBMENU: [{
914
+ guard: "isOpenControlled",
915
+ actions: ["invokeOnClose", "releaseParentRoutingLock"]
916
+ }, {
917
+ target: "closed",
918
+ actions: ["focusParentMenu", "restoreParentHighlightedItem"]
919
+ }],
920
+ "DELAY.CLOSE": [{
921
+ guard: "isOpenControlled",
922
+ actions: ["invokeOnClose", "releaseParentRoutingLock"]
923
+ }, {
924
+ target: "closed",
925
+ actions: [
926
+ "focusParentMenu",
927
+ "restoreParentHighlightedItem",
928
+ "invokeOnClose",
929
+ "releaseParentRoutingLock"
930
+ ]
931
+ }]
932
+ }
933
+ },
934
+ closed: {
935
+ tags: ["closed"],
936
+ entry: [
937
+ "clearHighlightedItem",
938
+ "unlockParentOnClose",
939
+ "clearAnchorPoint"
940
+ ],
941
+ on: {
942
+ "CONTROLLED.OPEN": [
943
+ {
944
+ guard: or("isOpenAutoFocusEvent", "isArrowDownEvent"),
945
+ target: "open",
946
+ actions: ["highlightFirstItem"]
947
+ },
948
+ {
949
+ guard: "isArrowUpEvent",
950
+ target: "open",
951
+ actions: ["highlightLastItem"]
952
+ },
953
+ { target: "open" }
954
+ ],
955
+ CONTEXT_MENU_START: {
956
+ target: "opening:contextmenu",
957
+ actions: ["setAnchorPoint", "setTriggerValue"]
958
+ },
959
+ CONTEXT_MENU: [{
960
+ guard: "isOpenControlled",
961
+ actions: [
962
+ "setAnchorPoint",
963
+ "setTriggerValue",
964
+ "invokeOnOpen"
965
+ ]
966
+ }, {
967
+ target: "open",
968
+ actions: [
969
+ "setAnchorPoint",
970
+ "setTriggerValue",
971
+ "invokeOnOpen"
972
+ ]
973
+ }],
974
+ TRIGGER_CLICK: [{
975
+ guard: "isOpenControlled",
976
+ actions: ["invokeOnOpen", "setTriggerValue"]
977
+ }, {
978
+ target: "open",
979
+ actions: ["invokeOnOpen", "setTriggerValue"]
980
+ }],
981
+ TRIGGER_POINTERMOVE: {
982
+ guard: "isTriggerItem",
983
+ target: "opening"
984
+ },
985
+ TRIGGER_BLUR: { target: "idle" },
986
+ ARROW_DOWN: [{
987
+ guard: "isOpenControlled",
988
+ actions: ["setTriggerValue", "invokeOnOpen"]
989
+ }, {
990
+ target: "open",
991
+ actions: [
992
+ "setTriggerValue",
993
+ "highlightFirstItem",
994
+ "invokeOnOpen"
995
+ ]
996
+ }],
997
+ ARROW_UP: [{
998
+ guard: "isOpenControlled",
999
+ actions: ["setTriggerValue", "invokeOnOpen"]
1000
+ }, {
1001
+ target: "open",
1002
+ actions: [
1003
+ "setTriggerValue",
1004
+ "highlightLastItem",
1005
+ "invokeOnOpen"
1006
+ ]
1007
+ }]
1008
+ }
1009
+ },
1010
+ open: {
1011
+ tags: ["open"],
1012
+ effects: [
1013
+ "trackInteractOutside",
1014
+ "trackFocusVisible",
1015
+ "trackPositioning",
1016
+ "scrollToHighlightedItem"
1017
+ ],
1018
+ entry: ["focusMenu", "unlockParentOnOpen"],
1019
+ on: {
1020
+ "CONTROLLED.CLOSE": [{
1021
+ target: "closed",
1022
+ guard: "isArrowLeftEvent",
1023
+ actions: ["focusParentMenu"]
1024
+ }, {
1025
+ target: "closed",
1026
+ actions: ["focusTrigger"]
1027
+ }],
1028
+ TRIGGER_CLICK: [{
1029
+ guard: and(not("isTriggerItem"), "isOpenControlled"),
1030
+ actions: ["invokeOnClose", "releaseParentRoutingLock"]
1031
+ }, {
1032
+ guard: not("isTriggerItem"),
1033
+ target: "closed",
1034
+ actions: [
1035
+ "invokeOnClose",
1036
+ "releaseParentRoutingLock",
1037
+ "focusTrigger"
1038
+ ]
1039
+ }],
1040
+ CONTEXT_MENU: { actions: [
1041
+ "setAnchorPoint",
1042
+ "setTriggerValue",
1043
+ "focusMenu"
1044
+ ] },
1045
+ ARROW_UP: { actions: ["highlightPrevItem", "focusMenu"] },
1046
+ ARROW_DOWN: { actions: ["highlightNextItem", "focusMenu"] },
1047
+ ARROW_LEFT: [{
1048
+ guard: and("isSubmenu", "isOpenControlled"),
1049
+ actions: ["invokeOnClose", "releaseParentRoutingLock"]
1050
+ }, {
1051
+ guard: "isSubmenu",
1052
+ target: "closed",
1053
+ actions: [
1054
+ "focusParentMenu",
1055
+ "invokeOnClose",
1056
+ "releaseParentRoutingLock"
1057
+ ]
1058
+ }],
1059
+ HOME: { actions: ["highlightFirstItem", "focusMenu"] },
1060
+ END: { actions: ["highlightLastItem", "focusMenu"] },
1061
+ ARROW_RIGHT: {
1062
+ guard: "isTriggerItemHighlighted",
1063
+ actions: ["openSubmenu"]
1064
+ },
1065
+ ENTER: [{
1066
+ guard: "isTriggerItemHighlighted",
1067
+ actions: ["openSubmenu"]
1068
+ }, { actions: ["clickHighlightedItem"] }],
1069
+ ITEM_POINTERMOVE: [{
1070
+ guard: not("isPointerRoutingLocked"),
1071
+ actions: [
1072
+ "setHighlightedItem",
1073
+ "focusMenu",
1074
+ "closeSiblingMenus"
1075
+ ]
1076
+ }, { actions: ["setLastHighlightedItem", "closeSiblingMenus"] }],
1077
+ ITEM_POINTERLEAVE: {
1078
+ guard: and(not("isPointerRoutingLocked"), not("isTriggerItem")),
1079
+ actions: ["clearHighlightedItem"]
1080
+ },
1081
+ ITEM_CLICK: [
1082
+ {
1083
+ guard: and(not("isTriggerItemHighlighted"), not("isHighlightedItemEditable"), "closeOnSelect", "isOpenControlled"),
1084
+ actions: [
1085
+ "invokeOnSelect",
1086
+ "setOptionState",
1087
+ "closeRootMenu",
1088
+ "invokeOnClose",
1089
+ "releaseParentRoutingLock"
1090
+ ]
1091
+ },
1092
+ {
1093
+ guard: and(not("isTriggerItemHighlighted"), not("isHighlightedItemEditable"), "closeOnSelect"),
1094
+ target: "closed",
1095
+ actions: [
1096
+ "invokeOnSelect",
1097
+ "setOptionState",
1098
+ "closeRootMenu",
1099
+ "invokeOnClose",
1100
+ "releaseParentRoutingLock",
1101
+ "focusTrigger"
1102
+ ]
1103
+ },
1104
+ {
1105
+ guard: and(not("isTriggerItemHighlighted"), not("isHighlightedItemEditable")),
1106
+ actions: ["invokeOnSelect", "setOptionState"]
1107
+ },
1108
+ { actions: ["setHighlightedItem"] }
1109
+ ],
1110
+ TRIGGER_POINTERMOVE: {
1111
+ guard: "isTriggerItem",
1112
+ actions: ["setIntentPolygon"]
1113
+ },
1114
+ TRIGGER_POINTERLEAVE: {
1115
+ target: "closing",
1116
+ actions: ["setIntentPolygon"]
1117
+ },
1118
+ ITEM_POINTERDOWN: { actions: ["setHighlightedItem"] },
1119
+ TYPEAHEAD: { actions: ["highlightMatchedItem"] },
1120
+ FOCUS_MENU: { actions: ["focusMenu"] },
1121
+ "POSITIONING.SET": { actions: ["reposition"] }
1122
+ }
1123
+ }
1124
+ },
1125
+ implementations: {
1126
+ guards: {
1127
+ closeOnSelect: ({ prop, event }) => !!(event?.closeOnSelect ?? prop("closeOnSelect")),
1128
+ isTriggerItem: ({ event }) => isTriggerItem(event.target),
1129
+ isTriggerItemHighlighted: ({ event, scope, computed }) => {
1130
+ return !!(event.target ?? scope.getById(computed("highlightedId")))?.hasAttribute("data-controls");
1131
+ },
1132
+ isSubmenu: ({ context }) => context.get("isSubmenu"),
1133
+ isPointerRoutingLocked: ({ refs }) => refs.get("pointerRoutingLocked"),
1134
+ isHighlightedItemEditable: ({ scope, computed }) => isEditableElement(scope.getById(computed("highlightedId"))),
1135
+ isOpenControlled: ({ prop }) => prop("open") !== void 0,
1136
+ isArrowLeftEvent: ({ event }) => event.previousEvent?.type === "ARROW_LEFT",
1137
+ isArrowUpEvent: ({ event }) => event.previousEvent?.type === "ARROW_UP",
1138
+ isArrowDownEvent: ({ event }) => event.previousEvent?.type === "ARROW_DOWN",
1139
+ isOpenAutoFocusEvent: ({ event }) => event.previousEvent?.type === "OPEN_AUTOFOCUS"
1140
+ },
1141
+ effects: {
1142
+ waitForOpenDelay({ send }) {
1143
+ const timer = setTimeout(() => {
1144
+ send({ type: "DELAY.OPEN" });
1145
+ }, 200);
1146
+ return () => clearTimeout(timer);
1147
+ },
1148
+ waitForCloseDelay({ send }) {
1149
+ const timer = setTimeout(() => {
1150
+ send({ type: "DELAY.CLOSE" });
1151
+ }, 100);
1152
+ return () => clearTimeout(timer);
1153
+ },
1154
+ waitForLongPress({ send }) {
1155
+ const timer = setTimeout(() => {
1156
+ send({ type: "LONG_PRESS.OPEN" });
1157
+ }, 700);
1158
+ return () => clearTimeout(timer);
1159
+ },
1160
+ trackFocusVisible({ scope }) {
1161
+ return trackFocusVisible({ root: scope.getRootNode?.() });
1162
+ },
1163
+ trackPositioning({ context, prop, scope, refs }) {
1164
+ if (getContextTriggerEl(scope) || getContextTriggerEls(scope).length > 0) return;
1165
+ const positioning = {
1166
+ ...prop("positioning"),
1167
+ ...refs.get("positioningOverride")
1168
+ };
1169
+ context.set("currentPlacement", positioning.placement);
1170
+ const getPositionerEl$1 = () => getPositionerEl(scope);
1171
+ const getTriggerEl = () => getActiveTriggerEl(scope, context.get("triggerValue"));
1172
+ return getPlacement(getTriggerEl, getPositionerEl$1, {
1173
+ ...positioning,
1174
+ defer: true,
1175
+ onComplete(data) {
1176
+ context.set("currentPlacement", data.placement);
1177
+ }
1178
+ });
1179
+ },
1180
+ trackInteractOutside({ refs, scope, prop, context, send }) {
1181
+ const getContentEl$1 = () => getContentEl(scope);
1182
+ let restoreFocus = true;
1183
+ const isWithinAnyContextTrigger = (target) => {
1184
+ return getContextTriggerEls(scope).some((el) => contains(el, target));
1185
+ };
1186
+ return trackDismissableElement(getContentEl$1, {
1187
+ type: "menu",
1188
+ defer: true,
1189
+ exclude: [getTriggerEl(scope), ...getTriggerEls(scope)].filter(Boolean),
1190
+ onInteractOutside: prop("onInteractOutside"),
1191
+ onRequestDismiss: prop("onRequestDismiss"),
1192
+ onFocusOutside(event) {
1193
+ prop("onFocusOutside")?.(event);
1194
+ const target = getEventTarget(event.detail.originalEvent);
1195
+ if (isWithinAnyContextTrigger(target)) {
1196
+ event.preventDefault();
1197
+ return;
1198
+ }
1199
+ if (isTargetWithinMenuTree(target, refs.get("children"))) {
1200
+ event.preventDefault();
1201
+ return;
1202
+ }
1203
+ },
1204
+ onEscapeKeyDown(event) {
1205
+ prop("onEscapeKeyDown")?.(event);
1206
+ if (context.get("isSubmenu")) event.preventDefault();
1207
+ closeRootMenu({ parent: refs.get("parent") });
1208
+ },
1209
+ onPointerDownOutside(event) {
1210
+ prop("onPointerDownOutside")?.(event);
1211
+ const target = getEventTarget(event.detail.originalEvent);
1212
+ if (isWithinAnyContextTrigger(target) && event.detail.contextmenu) {
1213
+ event.preventDefault();
1214
+ return;
1215
+ }
1216
+ restoreFocus = !event.detail.focusable;
1217
+ },
1218
+ onDismiss() {
1219
+ send({
1220
+ type: "CLOSE",
1221
+ src: "interact-outside",
1222
+ restoreFocus
1223
+ });
1224
+ }
1225
+ });
1226
+ },
1227
+ trackPointerMove({ context, scope, send, refs }) {
1228
+ const parent = refs.get("parent");
1229
+ if (!parent) return;
1230
+ setParentRoutingLock(parent, true);
1231
+ return addDomEvent(scope.getDoc(), "pointermove", (e) => {
1232
+ if (!isWithinPolygon(context.get("intentPolygon"), {
1233
+ x: e.clientX,
1234
+ y: e.clientY
1235
+ })) {
1236
+ send({ type: "POINTER_MOVED_AWAY_FROM_SUBMENU" });
1237
+ setParentRoutingLock(parent, false);
1238
+ }
1239
+ });
1240
+ },
1241
+ scrollToHighlightedItem({ scope, computed }) {
1242
+ const exec = () => {
1243
+ if (getInteractionModality() === "pointer") return;
1244
+ scrollIntoView(scope.getById(computed("highlightedId")), {
1245
+ rootEl: getContentEl(scope),
1246
+ block: "nearest"
1247
+ });
1248
+ };
1249
+ raf(() => {
1250
+ setInteractionModality("virtual");
1251
+ exec();
1252
+ });
1253
+ const contentEl = () => getContentEl(scope);
1254
+ return observeAttributes(contentEl, {
1255
+ defer: true,
1256
+ attributes: ["aria-activedescendant"],
1257
+ callback: exec
1258
+ });
1259
+ }
1260
+ },
1261
+ actions: {
1262
+ setAnchorPoint({ context, event }) {
1263
+ context.set("anchorPoint", (prev) => isEqual(prev, event.point) ? prev : event.point);
1264
+ },
1265
+ setSubmenuPlacement({ context, computed, refs }) {
1266
+ if (!context.get("isSubmenu")) return;
1267
+ const placement = computed("isRtl") ? "left-start" : "right-start";
1268
+ refs.set("positioningOverride", {
1269
+ placement,
1270
+ gutter: 0
1271
+ });
1272
+ },
1273
+ reposition({ context, scope, prop, event, refs }) {
1274
+ const getPositionerEl$2 = () => getPositionerEl(scope);
1275
+ const anchorPoint = event.point ?? context.get("anchorPoint");
1276
+ const getAnchorRect = anchorPoint ? () => ({
1277
+ width: 0,
1278
+ height: 0,
1279
+ ...anchorPoint
1280
+ }) : void 0;
1281
+ const positioning = {
1282
+ ...prop("positioning"),
1283
+ ...refs.get("positioningOverride")
1284
+ };
1285
+ const triggerValue = event.value ?? context.get("triggerValue");
1286
+ const getTriggerEl = () => getActiveTriggerEl(scope, triggerValue);
1287
+ getPlacement(getTriggerEl, getPositionerEl$2, {
1288
+ ...positioning,
1289
+ defer: true,
1290
+ getAnchorRect,
1291
+ ...event.options,
1292
+ listeners: false,
1293
+ onComplete(data) {
1294
+ context.set("currentPlacement", data.placement);
1295
+ }
1296
+ });
1297
+ },
1298
+ setOptionState({ event }) {
1299
+ if (!event.option) return;
1300
+ const { checked, onCheckedChange, type } = event.option;
1301
+ if (type === "radio") onCheckedChange?.(true);
1302
+ else if (type === "checkbox") onCheckedChange?.(!checked);
1303
+ },
1304
+ clickHighlightedItem({ scope, computed, prop, context }) {
1305
+ const itemEl = scope.getById(computed("highlightedId"));
1306
+ if (!itemEl || itemEl.dataset.disabled) return;
1307
+ const highlightedValue = context.get("highlightedValue");
1308
+ if (isAnchorElement(itemEl)) prop("navigate")?.({
1309
+ value: highlightedValue,
1310
+ node: itemEl,
1311
+ href: itemEl.href
1312
+ });
1313
+ else queueMicrotask(() => itemEl.click());
1314
+ },
1315
+ setIntentPolygon({ context, scope, event }) {
1316
+ const menu = getContentEl(scope);
1317
+ const placement = context.get("currentPlacement");
1318
+ if (!menu || !placement) return;
1319
+ const polygon = getElementPolygon(menu.getBoundingClientRect(), placement);
1320
+ if (!polygon) return;
1321
+ const bleed = getPlacementSide(placement) === "right" ? -5 : 5;
1322
+ context.set("intentPolygon", [{
1323
+ ...event.point,
1324
+ x: event.point.x + bleed
1325
+ }, ...polygon]);
1326
+ },
1327
+ clearIntentPolygon({ context }) {
1328
+ context.set("intentPolygon", null);
1329
+ },
1330
+ clearAnchorPoint({ context }) {
1331
+ context.set("anchorPoint", null);
1332
+ },
1333
+ unlockParentOnOpen({ refs, context, scope }) {
1334
+ const parent = refs.get("parent");
1335
+ if (context.get("isSubmenu")) {
1336
+ const value = getTriggerId(scope);
1337
+ parent?.send({
1338
+ type: "HIGHLIGHTED.SUGGEST",
1339
+ value
1340
+ });
1341
+ }
1342
+ setParentRoutingLock(parent, false);
1343
+ },
1344
+ unlockParentOnClose({ refs, context }) {
1345
+ unlockParentAfterChildClose(refs.get("parent"), context.get("isSubmenu"));
1346
+ },
1347
+ setHighlightedItem({ context, event }) {
1348
+ const value = event.value || getItemValue(event.target);
1349
+ context.set("highlightedValue", value);
1350
+ },
1351
+ clearHighlightedItem({ context }) {
1352
+ context.set("highlightedValue", null);
1353
+ },
1354
+ focusMenu({ scope }) {
1355
+ raf(() => {
1356
+ const contentEl = getContentEl(scope);
1357
+ getInitialFocus({
1358
+ root: contentEl,
1359
+ enabled: !contains(contentEl, scope.getActiveElement()),
1360
+ filter(node) {
1361
+ return !node.role?.startsWith("menuitem");
1362
+ }
1363
+ })?.focus({ preventScroll: true });
1364
+ });
1365
+ },
1366
+ highlightFirstItem({ context, scope }) {
1367
+ (getContentEl(scope) ? queueMicrotask : raf)(() => {
1368
+ const first = getFirstEl(scope);
1369
+ if (!first) return;
1370
+ context.set("highlightedValue", getItemValue(first));
1371
+ });
1372
+ },
1373
+ highlightLastItem({ context, scope }) {
1374
+ (getContentEl(scope) ? queueMicrotask : raf)(() => {
1375
+ const last = getLastEl(scope);
1376
+ if (!last) return;
1377
+ context.set("highlightedValue", getItemValue(last));
1378
+ });
1379
+ },
1380
+ highlightNextItem({ context, scope, event, prop }) {
1381
+ const next = getNextEl(scope, {
1382
+ loop: event.loop,
1383
+ value: context.get("highlightedValue"),
1384
+ loopFocus: prop("loopFocus")
1385
+ });
1386
+ context.set("highlightedValue", getItemValue(next));
1387
+ },
1388
+ highlightPrevItem({ context, scope, event, prop }) {
1389
+ const prev = getPrevEl(scope, {
1390
+ loop: event.loop,
1391
+ value: context.get("highlightedValue"),
1392
+ loopFocus: prop("loopFocus")
1393
+ });
1394
+ context.set("highlightedValue", getItemValue(prev));
1395
+ },
1396
+ invokeOnSelect({ context, prop, scope }) {
1397
+ const value = context.get("highlightedValue");
1398
+ if (value == null) return;
1399
+ dispatchSelectionEvent(getItemEl(scope, value), value);
1400
+ prop("onSelect")?.({ value });
1401
+ },
1402
+ focusTrigger({ scope, context, event }) {
1403
+ if (context.get("isSubmenu") || context.get("anchorPoint") || event.restoreFocus === false) return;
1404
+ queueMicrotask(() => {
1405
+ getActiveTriggerEl(scope, context.get("triggerValue"))?.focus({ preventScroll: true });
1406
+ });
1407
+ },
1408
+ highlightMatchedItem({ scope, context, event, refs }) {
1409
+ const node = getElemByKey(scope, {
1410
+ key: event.key,
1411
+ value: context.get("highlightedValue"),
1412
+ typeaheadState: refs.get("typeaheadState")
1413
+ });
1414
+ if (!node) return;
1415
+ context.set("highlightedValue", getItemValue(node));
1416
+ },
1417
+ setParentMenu({ refs, event, context }) {
1418
+ refs.set("parent", event.value);
1419
+ context.set("isSubmenu", true);
1420
+ },
1421
+ setChildMenu({ refs, event }) {
1422
+ const children = refs.get("children");
1423
+ children[event.id] = event.value;
1424
+ refs.set("children", children);
1425
+ },
1426
+ closeSiblingMenus({ refs, event, scope }) {
1427
+ const target = event.target;
1428
+ if (!isTriggerItem(target)) return;
1429
+ const hoveredChildId = target?.getAttribute("data-uid");
1430
+ const children = refs.get("children");
1431
+ for (const id in children) {
1432
+ if (id === hoveredChildId) continue;
1433
+ const child = children[id];
1434
+ const intentPolygon = child.context.get("intentPolygon");
1435
+ if (intentPolygon && event.point && isPointInPolygon(intentPolygon, event.point)) continue;
1436
+ getContentEl(scope)?.focus({ preventScroll: true });
1437
+ child.send({ type: "CLOSE" });
1438
+ }
1439
+ },
1440
+ closeRootMenu({ refs }) {
1441
+ closeRootMenu({ parent: refs.get("parent") });
1442
+ },
1443
+ openSubmenu({ refs, scope, computed }) {
1444
+ const id = scope.getById(computed("highlightedId"))?.getAttribute("data-uid");
1445
+ const children = refs.get("children");
1446
+ (id ? children[id] : null)?.send({ type: "OPEN_AUTOFOCUS" });
1447
+ },
1448
+ focusParentMenu({ refs }) {
1449
+ refs.get("parent")?.send({ type: "FOCUS_MENU" });
1450
+ },
1451
+ setLastHighlightedItem({ context, event }) {
1452
+ context.set("lastHighlightedValue", getItemValue(event.target));
1453
+ },
1454
+ suggestHighlightedItem({ context, event }) {
1455
+ const value = event.value;
1456
+ if (!value) return;
1457
+ if (context.get("highlightedValue") != null) {
1458
+ context.set("lastHighlightedValue", value);
1459
+ return;
1460
+ }
1461
+ context.set("highlightedValue", value);
1462
+ },
1463
+ restoreHighlightedItem({ context }) {
1464
+ const last = context.get("lastHighlightedValue");
1465
+ context.set("lastHighlightedValue", null);
1466
+ if (!last) return;
1467
+ context.set("highlightedValue", last);
1468
+ },
1469
+ restoreParentHighlightedItem({ refs }) {
1470
+ refs.get("parent")?.send({ type: "HIGHLIGHTED.RESTORE" });
1471
+ },
1472
+ invokeOnOpen({ prop }) {
1473
+ prop("onOpenChange")?.({ open: true });
1474
+ },
1475
+ invokeOnClose({ prop }) {
1476
+ prop("onOpenChange")?.({ open: false });
1477
+ },
1478
+ releaseParentRoutingLock({ refs, context }) {
1479
+ if (!context.get("isSubmenu")) return;
1480
+ unlockParentOnSubmenuClose(refs.get("parent"));
1481
+ },
1482
+ toggleVisibility({ prop, event, send }) {
1483
+ send({
1484
+ type: prop("open") ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE",
1485
+ previousEvent: event
1486
+ });
1487
+ },
1488
+ setTriggerValue({ context, event }) {
1489
+ if (event.value === void 0) return;
1490
+ context.set("triggerValue", event.value);
1491
+ }
1492
+ }
1493
+ }
1494
+ });
1495
+ //#endregion
1496
+ //#region src/machines/menu/props.ts
1497
+ const props = createProps()([
1498
+ "anchorPoint",
1499
+ "aria-label",
1500
+ "closeOnSelect",
1501
+ "composite",
1502
+ "defaultHighlightedValue",
1503
+ "defaultOpen",
1504
+ "defaultTriggerValue",
1505
+ "dir",
1506
+ "getRootNode",
1507
+ "highlightedValue",
1508
+ "id",
1509
+ "ids",
1510
+ "loopFocus",
1511
+ "navigate",
1512
+ "onEscapeKeyDown",
1513
+ "onFocusOutside",
1514
+ "onHighlightChange",
1515
+ "onInteractOutside",
1516
+ "onOpenChange",
1517
+ "onPointerDownOutside",
1518
+ "onRequestDismiss",
1519
+ "onSelect",
1520
+ "onTriggerValueChange",
1521
+ "open",
1522
+ "positioning",
1523
+ "triggerValue",
1524
+ "typeahead"
1525
+ ]);
1526
+ const splitProps = createSplitProps(props);
1527
+ const itemProps = createProps()([
1528
+ "closeOnSelect",
1529
+ "disabled",
1530
+ "value",
1531
+ "valueText"
1532
+ ]);
1533
+ const splitItemProps = createSplitProps(itemProps);
1534
+ const itemGroupLabelProps = createProps()(["htmlFor"]);
1535
+ const splitItemGroupLabelProps = createSplitProps(itemGroupLabelProps);
1536
+ const itemGroupProps = createProps()(["id"]);
1537
+ const splitItemGroupProps = createSplitProps(itemGroupProps);
1538
+ const optionItemProps = createProps()([
1539
+ "checked",
1540
+ "closeOnSelect",
1541
+ "disabled",
1542
+ "onCheckedChange",
1543
+ "type",
1544
+ "value",
1545
+ "valueText"
1546
+ ]);
1547
+ const splitOptionItemProps = createSplitProps(optionItemProps);
1548
+ //#endregion
1549
+ export { anatomy, connect, itemGroupLabelProps, itemGroupProps, itemProps, machine, optionItemProps, props, splitItemGroupLabelProps, splitItemGroupProps, splitItemProps, splitOptionItemProps, splitProps };