@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,1288 @@
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_raf = require("../../raf-BSDcY4UD.cjs");
7
+ const require_array = require("../../array-BGtygd0o.cjs");
8
+ const require_equal = require("../../equal-C927y7MN.cjs");
9
+ const require_utils = require("../../utils-BH-oBBz2.cjs");
10
+ const require_warning = require("../../warning-HAmFXLHm.cjs");
11
+ const require_collection = require("../../collection-CwzUJwBJ.cjs");
12
+ const require_core = require("../../core-BNMw-JId.cjs");
13
+ const require_create_props = require("../../create-props-CjLx2oS8.cjs");
14
+ //#region src/machines/tree-view/anatomy.ts
15
+ const anatomy = require_create_anatomy.createAnatomy("tree-view").parts("branch", "branchContent", "branchControl", "branchIndentGuide", "branchIndicator", "branchText", "branchTrigger", "item", "itemIndicator", "itemText", "label", "nodeCheckbox", "nodeRenameInput", "root", "tree");
16
+ const parts = anatomy.build();
17
+ //#endregion
18
+ //#region src/machines/tree-view/collection.ts
19
+ const collection = (options) => {
20
+ return new require_collection.TreeCollection(options);
21
+ };
22
+ collection.empty = () => {
23
+ return new require_collection.TreeCollection({ rootNode: { children: [] } });
24
+ };
25
+ function filePathCollection(paths) {
26
+ return require_collection.filePathToTree(paths);
27
+ }
28
+ //#endregion
29
+ //#region src/machines/tree-view/dom.ts
30
+ const getRootId = (ctx) => ctx.ids?.root ?? `tree-view:${ctx.id}:root`;
31
+ const getLabelId = (ctx) => ctx.ids?.label ?? `tree-view:${ctx.id}:label`;
32
+ const getNodeId = (ctx, value) => ctx.ids?.node?.(value) ?? `tree-view:${ctx.id}:node:${value}`;
33
+ const getTreeId = (ctx) => ctx.ids?.tree ?? `tree-view:${ctx.id}:tree`;
34
+ const getRenameInputId = (ctx, value) => `tree-view:${ctx.id}:rename-input:${value}`;
35
+ const focusNode = (ctx, value) => {
36
+ if (value == null) return;
37
+ ctx.getById(getNodeId(ctx, value))?.focus();
38
+ };
39
+ const getRenameInputEl = (ctx, value) => {
40
+ return ctx.getById(getRenameInputId(ctx, value));
41
+ };
42
+ //#endregion
43
+ //#region src/machines/tree-view/utils/checked-state.ts
44
+ function getCheckedState(collection, node, checkedValue) {
45
+ const value = collection.getNodeValue(node);
46
+ if (!collection.isBranchNode(node)) return checkedValue.includes(value);
47
+ const childValues = collection.getDescendantValues(value);
48
+ const allChecked = childValues.every((v) => checkedValue.includes(v));
49
+ const someChecked = childValues.some((v) => checkedValue.includes(v));
50
+ return allChecked ? true : someChecked ? "indeterminate" : false;
51
+ }
52
+ function toggleBranchChecked(collection, value, checkedValue) {
53
+ const childValues = collection.getDescendantValues(value);
54
+ return require_array.uniq(childValues.every((child) => checkedValue.includes(child)) ? require_array.remove(checkedValue, ...childValues) : require_array.add(checkedValue, ...childValues));
55
+ }
56
+ function getCheckedValueMap(collection, checkedValue) {
57
+ const map = /* @__PURE__ */ new Map();
58
+ collection.visit({ onEnter: (node) => {
59
+ const value = collection.getNodeValue(node);
60
+ const isBranch = collection.isBranchNode(node);
61
+ const checked = getCheckedState(collection, node, checkedValue);
62
+ map.set(value, {
63
+ type: isBranch ? "branch" : "leaf",
64
+ checked
65
+ });
66
+ } });
67
+ return map;
68
+ }
69
+ //#endregion
70
+ //#region src/machines/tree-view/connect.ts
71
+ function connect(service, normalize) {
72
+ const { context, scope, computed, prop, send } = service;
73
+ const collection = prop("collection");
74
+ const translations = prop("translations");
75
+ const expandedValue = Array.from(context.get("expandedValue"));
76
+ const selectedValue = Array.from(context.get("selectedValue"));
77
+ const checkedValue = Array.from(context.get("checkedValue"));
78
+ const isTypingAhead = computed("isTypingAhead");
79
+ const focusedValue = context.get("focusedValue");
80
+ const loadingStatus = context.get("loadingStatus");
81
+ const renamingValue = context.get("renamingValue");
82
+ const skip = ({ indexPath }) => {
83
+ return collection.getValuePath(indexPath).slice(0, -1).some((value) => !expandedValue.includes(value));
84
+ };
85
+ const firstNode = collection.getFirstNode(void 0, { skip });
86
+ const firstNodeValue = firstNode ? collection.getNodeValue(firstNode) : null;
87
+ function getNodeState(props) {
88
+ const { node, indexPath } = props;
89
+ const value = collection.getNodeValue(node);
90
+ return {
91
+ id: getNodeId(scope, value),
92
+ value,
93
+ indexPath,
94
+ valuePath: collection.getValuePath(indexPath),
95
+ disabled: Boolean(node.disabled),
96
+ focused: focusedValue == null ? firstNodeValue === value : focusedValue === value,
97
+ selected: selectedValue.includes(value),
98
+ expanded: expandedValue.includes(value),
99
+ loading: loadingStatus[value] === "loading",
100
+ depth: indexPath.length,
101
+ isBranch: collection.isBranchNode(node),
102
+ renaming: renamingValue === value,
103
+ get checked() {
104
+ return getCheckedState(collection, node, checkedValue);
105
+ }
106
+ };
107
+ }
108
+ return {
109
+ collection,
110
+ expandedValue,
111
+ selectedValue,
112
+ checkedValue,
113
+ toggleChecked(value, isBranch) {
114
+ send({
115
+ type: "CHECKED.TOGGLE",
116
+ value,
117
+ isBranch
118
+ });
119
+ },
120
+ setChecked(value) {
121
+ send({
122
+ type: "CHECKED.SET",
123
+ value
124
+ });
125
+ },
126
+ clearChecked() {
127
+ send({ type: "CHECKED.CLEAR" });
128
+ },
129
+ getCheckedMap() {
130
+ return getCheckedValueMap(collection, checkedValue);
131
+ },
132
+ expand(value) {
133
+ send({
134
+ type: value ? "BRANCH.EXPAND" : "EXPANDED.ALL",
135
+ value
136
+ });
137
+ },
138
+ collapse(value) {
139
+ send({
140
+ type: value ? "BRANCH.COLLAPSE" : "EXPANDED.CLEAR",
141
+ value
142
+ });
143
+ },
144
+ deselect(value) {
145
+ send({
146
+ type: value ? "NODE.DESELECT" : "SELECTED.CLEAR",
147
+ value
148
+ });
149
+ },
150
+ select(value) {
151
+ send({
152
+ type: value ? "NODE.SELECT" : "SELECTED.ALL",
153
+ value,
154
+ isTrusted: false
155
+ });
156
+ },
157
+ getVisibleNodes() {
158
+ return computed("visibleNodes");
159
+ },
160
+ focus(value) {
161
+ focusNode(scope, value);
162
+ },
163
+ selectParent(value) {
164
+ const parentNode = collection.getParentNode(value);
165
+ if (!parentNode) return;
166
+ const _selectedValue = require_array.add(selectedValue, collection.getNodeValue(parentNode));
167
+ send({
168
+ type: "SELECTED.SET",
169
+ value: _selectedValue,
170
+ src: "select.parent"
171
+ });
172
+ },
173
+ expandParent(value) {
174
+ const parentNode = collection.getParentNode(value);
175
+ if (!parentNode) return;
176
+ const _expandedValue = require_array.add(expandedValue, collection.getNodeValue(parentNode));
177
+ send({
178
+ type: "EXPANDED.SET",
179
+ value: _expandedValue,
180
+ src: "expand.parent"
181
+ });
182
+ },
183
+ setExpandedValue(value) {
184
+ const _expandedValue = require_array.uniq(value);
185
+ send({
186
+ type: "EXPANDED.SET",
187
+ value: _expandedValue
188
+ });
189
+ },
190
+ setSelectedValue(value) {
191
+ const _selectedValue = require_array.uniq(value);
192
+ send({
193
+ type: "SELECTED.SET",
194
+ value: _selectedValue
195
+ });
196
+ },
197
+ startRenaming(value) {
198
+ send({
199
+ type: "NODE.RENAME",
200
+ value
201
+ });
202
+ },
203
+ submitRenaming(value, label) {
204
+ send({
205
+ type: "RENAME.SUBMIT",
206
+ value,
207
+ label
208
+ });
209
+ },
210
+ cancelRenaming() {
211
+ send({ type: "RENAME.CANCEL" });
212
+ },
213
+ getRootProps() {
214
+ return normalize.element({
215
+ ...parts.root.attrs,
216
+ id: getRootId(scope),
217
+ dir: prop("dir")
218
+ });
219
+ },
220
+ getLabelProps() {
221
+ return normalize.element({
222
+ ...parts.label.attrs,
223
+ id: getLabelId(scope),
224
+ dir: prop("dir")
225
+ });
226
+ },
227
+ getTreeProps() {
228
+ return normalize.element({
229
+ ...parts.tree.attrs,
230
+ id: getTreeId(scope),
231
+ dir: prop("dir"),
232
+ role: "tree",
233
+ "aria-label": translations.treeLabel,
234
+ "aria-labelledby": getLabelId(scope),
235
+ "aria-multiselectable": prop("selectionMode") === "multiple" || void 0,
236
+ tabIndex: -1,
237
+ onKeyDown(event) {
238
+ if (event.defaultPrevented) return;
239
+ if (require_event.isComposingEvent(event)) return;
240
+ const target = require_event.getEventTarget(event);
241
+ if (require_dom_query.isEditableElement(target)) return;
242
+ const node = target?.closest("[data-part=branch-control], [data-part=item]");
243
+ if (!node) return;
244
+ const nodeId = node.dataset.value;
245
+ if (nodeId == null) {
246
+ console.warn(`[wirekyt/tree-view] Node id not found for node`, node);
247
+ return;
248
+ }
249
+ const isBranchNode = node.matches("[data-part=branch-control]");
250
+ const keyMap = {
251
+ ArrowDown(event) {
252
+ if (require_event.isModifierKey(event)) return;
253
+ event.preventDefault();
254
+ send({
255
+ type: "NODE.ARROW_DOWN",
256
+ id: nodeId,
257
+ shiftKey: event.shiftKey
258
+ });
259
+ },
260
+ ArrowUp(event) {
261
+ if (require_event.isModifierKey(event)) return;
262
+ event.preventDefault();
263
+ send({
264
+ type: "NODE.ARROW_UP",
265
+ id: nodeId,
266
+ shiftKey: event.shiftKey
267
+ });
268
+ },
269
+ ArrowLeft(event) {
270
+ if (require_event.isModifierKey(event) || node.dataset.disabled) return;
271
+ event.preventDefault();
272
+ send({
273
+ type: isBranchNode ? "BRANCH_NODE.ARROW_LEFT" : "NODE.ARROW_LEFT",
274
+ id: nodeId
275
+ });
276
+ },
277
+ ArrowRight(event) {
278
+ if (!isBranchNode || node.dataset.disabled) return;
279
+ event.preventDefault();
280
+ send({
281
+ type: "BRANCH_NODE.ARROW_RIGHT",
282
+ id: nodeId
283
+ });
284
+ },
285
+ Home(event) {
286
+ if (require_event.isModifierKey(event)) return;
287
+ event.preventDefault();
288
+ send({
289
+ type: "NODE.HOME",
290
+ id: nodeId,
291
+ shiftKey: event.shiftKey
292
+ });
293
+ },
294
+ End(event) {
295
+ if (require_event.isModifierKey(event)) return;
296
+ event.preventDefault();
297
+ send({
298
+ type: "NODE.END",
299
+ id: nodeId,
300
+ shiftKey: event.shiftKey
301
+ });
302
+ },
303
+ Space(event) {
304
+ if (node.dataset.disabled) return;
305
+ if (isTypingAhead) send({
306
+ type: "TREE.TYPEAHEAD",
307
+ key: event.key
308
+ });
309
+ else keyMap.Enter?.(event);
310
+ },
311
+ Enter(event) {
312
+ if (node.dataset.disabled) return;
313
+ if (require_dom_query.isAnchorElement(target) && require_event.isModifierKey(event)) return;
314
+ send({
315
+ type: isBranchNode ? "BRANCH_NODE.CLICK" : "NODE.CLICK",
316
+ id: nodeId,
317
+ src: "keyboard"
318
+ });
319
+ if (!require_dom_query.isAnchorElement(target)) event.preventDefault();
320
+ },
321
+ "*"(event) {
322
+ if (node.dataset.disabled) return;
323
+ event.preventDefault();
324
+ send({
325
+ type: "SIBLINGS.EXPAND",
326
+ id: nodeId
327
+ });
328
+ },
329
+ a(event) {
330
+ if (!event.metaKey || node.dataset.disabled) return;
331
+ event.preventDefault();
332
+ send({
333
+ type: "SELECTED.ALL",
334
+ moveFocus: true
335
+ });
336
+ },
337
+ F2(event) {
338
+ if (node.dataset.disabled) return;
339
+ const canRenameFn = prop("canRename");
340
+ if (!canRenameFn) return;
341
+ const indexPath = collection.getIndexPath(nodeId);
342
+ if (indexPath) {
343
+ const node = collection.at(indexPath);
344
+ if (node && !canRenameFn(node, indexPath)) return;
345
+ }
346
+ event.preventDefault();
347
+ send({
348
+ type: "NODE.RENAME",
349
+ value: nodeId
350
+ });
351
+ }
352
+ };
353
+ const exec = keyMap[require_event.getEventKey(event, { dir: prop("dir") })];
354
+ if (exec) {
355
+ exec(event);
356
+ return;
357
+ }
358
+ if (!require_dom_query.getByTypeahead.isValidEvent(event)) return;
359
+ send({
360
+ type: "TREE.TYPEAHEAD",
361
+ key: event.key,
362
+ id: nodeId
363
+ });
364
+ event.preventDefault();
365
+ }
366
+ });
367
+ },
368
+ getNodeState,
369
+ getItemProps(props) {
370
+ const nodeState = getNodeState(props);
371
+ return normalize.element({
372
+ ...parts.item.attrs,
373
+ id: nodeState.id,
374
+ dir: prop("dir"),
375
+ "data-ownedby": getTreeId(scope),
376
+ "data-path": props.indexPath.join("/"),
377
+ "data-value": nodeState.value,
378
+ tabIndex: nodeState.focused ? 0 : -1,
379
+ "data-focus": require_dom_query.dataAttr(nodeState.focused),
380
+ role: "treeitem",
381
+ "aria-current": nodeState.selected ? "true" : void 0,
382
+ "aria-selected": nodeState.disabled ? void 0 : nodeState.selected,
383
+ "data-selected": require_dom_query.dataAttr(nodeState.selected),
384
+ "aria-disabled": require_dom_query.ariaAttr(nodeState.disabled),
385
+ "data-disabled": require_dom_query.dataAttr(nodeState.disabled),
386
+ "data-renaming": require_dom_query.dataAttr(nodeState.renaming),
387
+ "data-checked": require_dom_query.dataAttr(nodeState.checked === true),
388
+ "data-indeterminate": require_dom_query.dataAttr(nodeState.checked === "indeterminate"),
389
+ "aria-level": nodeState.depth,
390
+ "data-depth": nodeState.depth,
391
+ style: { "--depth": nodeState.depth },
392
+ onFocus(event) {
393
+ event.stopPropagation();
394
+ send({
395
+ type: "NODE.FOCUS",
396
+ id: nodeState.value
397
+ });
398
+ },
399
+ onClick(event) {
400
+ if (nodeState.disabled) return;
401
+ if (!require_event.isLeftClick(event)) return;
402
+ if (require_dom_query.isAnchorElement(event.currentTarget) && require_event.isModifierKey(event)) return;
403
+ const isMetaKey = event.metaKey || event.ctrlKey;
404
+ send({
405
+ type: "NODE.CLICK",
406
+ id: nodeState.value,
407
+ shiftKey: event.shiftKey,
408
+ ctrlKey: isMetaKey
409
+ });
410
+ event.stopPropagation();
411
+ if (!require_dom_query.isAnchorElement(event.currentTarget)) event.preventDefault();
412
+ }
413
+ });
414
+ },
415
+ getItemTextProps(props) {
416
+ const itemState = getNodeState(props);
417
+ return normalize.element({
418
+ ...parts.itemText.attrs,
419
+ "data-disabled": require_dom_query.dataAttr(itemState.disabled),
420
+ "data-selected": require_dom_query.dataAttr(itemState.selected),
421
+ "data-focus": require_dom_query.dataAttr(itemState.focused)
422
+ });
423
+ },
424
+ getItemIndicatorProps(props) {
425
+ const itemState = getNodeState(props);
426
+ return normalize.element({
427
+ ...parts.itemIndicator.attrs,
428
+ "aria-hidden": true,
429
+ "data-disabled": require_dom_query.dataAttr(itemState.disabled),
430
+ "data-selected": require_dom_query.dataAttr(itemState.selected),
431
+ "data-focus": require_dom_query.dataAttr(itemState.focused),
432
+ hidden: !itemState.selected
433
+ });
434
+ },
435
+ getBranchProps(props) {
436
+ const nodeState = getNodeState(props);
437
+ return normalize.element({
438
+ ...parts.branch.attrs,
439
+ "data-depth": nodeState.depth,
440
+ dir: prop("dir"),
441
+ "data-branch": nodeState.value,
442
+ role: "treeitem",
443
+ "data-ownedby": getTreeId(scope),
444
+ "data-value": nodeState.value,
445
+ "aria-level": nodeState.depth,
446
+ "aria-selected": nodeState.disabled ? void 0 : nodeState.selected,
447
+ "data-path": props.indexPath.join("/"),
448
+ "data-selected": require_dom_query.dataAttr(nodeState.selected),
449
+ "aria-expanded": nodeState.expanded,
450
+ "data-state": nodeState.expanded ? "open" : "closed",
451
+ "aria-disabled": require_dom_query.ariaAttr(nodeState.disabled),
452
+ "data-disabled": require_dom_query.dataAttr(nodeState.disabled),
453
+ "data-loading": require_dom_query.dataAttr(nodeState.loading),
454
+ "aria-busy": require_dom_query.ariaAttr(nodeState.loading),
455
+ style: { "--depth": nodeState.depth }
456
+ });
457
+ },
458
+ getBranchIndicatorProps(props) {
459
+ const nodeState = getNodeState(props);
460
+ return normalize.element({
461
+ ...parts.branchIndicator.attrs,
462
+ "aria-hidden": true,
463
+ "data-state": nodeState.expanded ? "open" : "closed",
464
+ "data-disabled": require_dom_query.dataAttr(nodeState.disabled),
465
+ "data-selected": require_dom_query.dataAttr(nodeState.selected),
466
+ "data-focus": require_dom_query.dataAttr(nodeState.focused),
467
+ "data-loading": require_dom_query.dataAttr(nodeState.loading)
468
+ });
469
+ },
470
+ getBranchTriggerProps(props) {
471
+ const nodeState = getNodeState(props);
472
+ return normalize.element({
473
+ ...parts.branchTrigger.attrs,
474
+ role: "button",
475
+ dir: prop("dir"),
476
+ "data-disabled": require_dom_query.dataAttr(nodeState.disabled),
477
+ "data-state": nodeState.expanded ? "open" : "closed",
478
+ "data-value": nodeState.value,
479
+ "data-loading": require_dom_query.dataAttr(nodeState.loading),
480
+ disabled: nodeState.loading,
481
+ onClick(event) {
482
+ if (nodeState.disabled || nodeState.loading) return;
483
+ send({
484
+ type: "BRANCH_TOGGLE.CLICK",
485
+ id: nodeState.value
486
+ });
487
+ event.stopPropagation();
488
+ }
489
+ });
490
+ },
491
+ getBranchControlProps(props) {
492
+ const nodeState = getNodeState(props);
493
+ return normalize.element({
494
+ ...parts.branchControl.attrs,
495
+ role: "button",
496
+ id: nodeState.id,
497
+ dir: prop("dir"),
498
+ tabIndex: nodeState.focused ? 0 : -1,
499
+ "data-path": props.indexPath.join("/"),
500
+ "data-state": nodeState.expanded ? "open" : "closed",
501
+ "data-disabled": require_dom_query.dataAttr(nodeState.disabled),
502
+ "data-selected": require_dom_query.dataAttr(nodeState.selected),
503
+ "data-focus": require_dom_query.dataAttr(nodeState.focused),
504
+ "data-renaming": require_dom_query.dataAttr(nodeState.renaming),
505
+ "data-checked": require_dom_query.dataAttr(nodeState.checked === true),
506
+ "data-indeterminate": require_dom_query.dataAttr(nodeState.checked === "indeterminate"),
507
+ "data-value": nodeState.value,
508
+ "data-depth": nodeState.depth,
509
+ "data-loading": require_dom_query.dataAttr(nodeState.loading),
510
+ "aria-busy": require_dom_query.ariaAttr(nodeState.loading),
511
+ onFocus(event) {
512
+ send({
513
+ type: "NODE.FOCUS",
514
+ id: nodeState.value
515
+ });
516
+ event.stopPropagation();
517
+ },
518
+ onClick(event) {
519
+ if (nodeState.disabled) return;
520
+ if (nodeState.loading) return;
521
+ if (!require_event.isLeftClick(event)) return;
522
+ if (require_dom_query.isAnchorElement(event.currentTarget) && require_event.isModifierKey(event)) return;
523
+ const isMetaKey = event.metaKey || event.ctrlKey;
524
+ send({
525
+ type: "BRANCH_NODE.CLICK",
526
+ id: nodeState.value,
527
+ shiftKey: event.shiftKey,
528
+ ctrlKey: isMetaKey
529
+ });
530
+ event.stopPropagation();
531
+ }
532
+ });
533
+ },
534
+ getBranchTextProps(props) {
535
+ const nodeState = getNodeState(props);
536
+ return normalize.element({
537
+ ...parts.branchText.attrs,
538
+ dir: prop("dir"),
539
+ "data-disabled": require_dom_query.dataAttr(nodeState.disabled),
540
+ "data-state": nodeState.expanded ? "open" : "closed",
541
+ "data-loading": require_dom_query.dataAttr(nodeState.loading)
542
+ });
543
+ },
544
+ getBranchContentProps(props) {
545
+ const nodeState = getNodeState(props);
546
+ return normalize.element({
547
+ ...parts.branchContent.attrs,
548
+ role: "group",
549
+ dir: prop("dir"),
550
+ "data-state": nodeState.expanded ? "open" : "closed",
551
+ "data-depth": nodeState.depth,
552
+ "data-path": props.indexPath.join("/"),
553
+ "data-value": nodeState.value,
554
+ hidden: !nodeState.expanded
555
+ });
556
+ },
557
+ getBranchIndentGuideProps(props) {
558
+ const nodeState = getNodeState(props);
559
+ return normalize.element({
560
+ ...parts.branchIndentGuide.attrs,
561
+ "data-depth": nodeState.depth
562
+ });
563
+ },
564
+ getNodeCheckboxProps(props) {
565
+ const nodeState = getNodeState(props);
566
+ const checkedState = nodeState.checked;
567
+ return normalize.element({
568
+ ...parts.nodeCheckbox.attrs,
569
+ tabIndex: -1,
570
+ role: "checkbox",
571
+ "data-state": checkedState === true ? "checked" : checkedState === false ? "unchecked" : "indeterminate",
572
+ "aria-checked": checkedState === true ? "true" : checkedState === false ? "false" : "mixed",
573
+ "data-disabled": require_dom_query.dataAttr(nodeState.disabled),
574
+ onClick(event) {
575
+ if (event.defaultPrevented) return;
576
+ if (nodeState.disabled) return;
577
+ if (!require_event.isLeftClick(event)) return;
578
+ send({
579
+ type: "CHECKED.TOGGLE",
580
+ value: nodeState.value,
581
+ isBranch: nodeState.isBranch
582
+ });
583
+ event.stopPropagation();
584
+ event.currentTarget.closest("[role=treeitem]")?.focus({ preventScroll: true });
585
+ }
586
+ });
587
+ },
588
+ getNodeRenameInputProps(props) {
589
+ const nodeState = getNodeState(props);
590
+ return normalize.input({
591
+ ...parts.nodeRenameInput.attrs,
592
+ id: getRenameInputId(scope, nodeState.value),
593
+ type: "text",
594
+ "aria-label": translations.renameInputLabel,
595
+ hidden: !nodeState.renaming,
596
+ onKeyDown(event) {
597
+ if (require_event.isComposingEvent(event)) return;
598
+ if (event.key === "Escape") {
599
+ send({ type: "RENAME.CANCEL" });
600
+ event.preventDefault();
601
+ }
602
+ if (event.key === "Enter") {
603
+ send({
604
+ type: "RENAME.SUBMIT",
605
+ label: event.currentTarget.value
606
+ });
607
+ event.preventDefault();
608
+ }
609
+ event.stopPropagation();
610
+ },
611
+ onBlur(event) {
612
+ send({
613
+ type: "RENAME.SUBMIT",
614
+ label: event.currentTarget.value
615
+ });
616
+ }
617
+ });
618
+ }
619
+ };
620
+ }
621
+ //#endregion
622
+ //#region src/machines/tree-view/utils/expand-branch.ts
623
+ function expandBranches(params, values) {
624
+ const { context, prop, refs } = params;
625
+ if (!prop("loadChildren")) {
626
+ context.set("expandedValue", (prev) => require_array.uniq(require_array.add(prev, ...values)));
627
+ return;
628
+ }
629
+ const loadingStatus = context.get("loadingStatus");
630
+ const [loadedValues, loadingValues] = require_array.partition(values, (value) => loadingStatus[value] === "loaded");
631
+ if (loadedValues.length > 0) context.set("expandedValue", (prev) => require_array.uniq(require_array.add(prev, ...loadedValues)));
632
+ if (loadingValues.length === 0) return;
633
+ const collection = prop("collection");
634
+ const [nodeWithChildren, nodeWithoutChildren] = require_array.partition(loadingValues, (id) => {
635
+ const node = collection.findNode(id);
636
+ return collection.getNodeChildren(node).length > 0;
637
+ });
638
+ if (nodeWithChildren.length > 0) context.set("expandedValue", (prev) => require_array.uniq(require_array.add(prev, ...nodeWithChildren)));
639
+ if (nodeWithoutChildren.length === 0) return;
640
+ context.set("loadingStatus", (prev) => ({
641
+ ...prev,
642
+ ...nodeWithoutChildren.reduce((acc, id) => ({
643
+ ...acc,
644
+ [id]: "loading"
645
+ }), {})
646
+ }));
647
+ const nodesToLoad = nodeWithoutChildren.map((id) => {
648
+ const indexPath = collection.getIndexPath(id);
649
+ return {
650
+ id,
651
+ indexPath,
652
+ valuePath: collection.getValuePath(indexPath),
653
+ node: collection.findNode(id)
654
+ };
655
+ });
656
+ const pendingAborts = refs.get("pendingAborts");
657
+ const loadChildren = prop("loadChildren");
658
+ require_warning.ensure(loadChildren, () => "[wirekyt/tree-view] `loadChildren` is required for async expansion");
659
+ const proms = nodesToLoad.map(({ id, indexPath, valuePath, node }) => {
660
+ const existingAbort = pendingAborts.get(id);
661
+ if (existingAbort) {
662
+ existingAbort.abort();
663
+ pendingAborts.delete(id);
664
+ }
665
+ const abortController = new AbortController();
666
+ pendingAborts.set(id, abortController);
667
+ return loadChildren({
668
+ valuePath,
669
+ indexPath,
670
+ node,
671
+ signal: abortController.signal
672
+ });
673
+ });
674
+ Promise.allSettled(proms).then((results) => {
675
+ const loadedValues = [];
676
+ const nodeWithErrors = [];
677
+ const nextLoadingStatus = context.get("loadingStatus");
678
+ let collection = prop("collection");
679
+ results.forEach((result, index) => {
680
+ const { id, indexPath, node, valuePath } = nodesToLoad[index];
681
+ if (result.status === "fulfilled") {
682
+ nextLoadingStatus[id] = "loaded";
683
+ loadedValues.push(id);
684
+ collection = collection.replace(indexPath, {
685
+ ...node,
686
+ children: result.value
687
+ });
688
+ } else {
689
+ pendingAborts.delete(id);
690
+ Reflect.deleteProperty(nextLoadingStatus, id);
691
+ nodeWithErrors.push({
692
+ node,
693
+ error: result.reason,
694
+ indexPath,
695
+ valuePath
696
+ });
697
+ }
698
+ });
699
+ context.set("loadingStatus", nextLoadingStatus);
700
+ if (loadedValues.length) {
701
+ context.set("expandedValue", (prev) => require_array.uniq(require_array.add(prev, ...loadedValues)));
702
+ prop("onLoadChildrenComplete")?.({ collection });
703
+ }
704
+ if (nodeWithErrors.length) prop("onLoadChildrenError")?.({ nodes: nodeWithErrors });
705
+ });
706
+ }
707
+ //#endregion
708
+ //#region src/machines/tree-view/utils/visit-skip.ts
709
+ function skipFn(params) {
710
+ const { prop, context } = params;
711
+ return function skip({ indexPath }) {
712
+ return prop("collection").getValuePath(indexPath).slice(0, -1).some((value) => !context.get("expandedValue").includes(value));
713
+ };
714
+ }
715
+ //#endregion
716
+ //#region src/machines/tree-view/machine.ts
717
+ const { and } = require_core.createGuards();
718
+ const machine = require_core.createMachine({
719
+ props({ props }) {
720
+ return {
721
+ selectionMode: "single",
722
+ collection: collection.empty(),
723
+ typeahead: true,
724
+ expandOnClick: true,
725
+ defaultExpandedValue: [],
726
+ defaultSelectedValue: [],
727
+ ...props,
728
+ translations: {
729
+ treeLabel: "Tree View",
730
+ renameInputLabel: "Rename tree item",
731
+ ...props.translations
732
+ }
733
+ };
734
+ },
735
+ initialState() {
736
+ return "idle";
737
+ },
738
+ context({ prop, bindable, getContext }) {
739
+ return {
740
+ expandedValue: bindable(() => ({
741
+ defaultValue: prop("defaultExpandedValue"),
742
+ value: prop("expandedValue"),
743
+ isEqual: require_equal.isEqual,
744
+ onChange(expandedValue) {
745
+ const focusedValue = getContext().get("focusedValue");
746
+ prop("onExpandedChange")?.({
747
+ expandedValue,
748
+ focusedValue,
749
+ get expandedNodes() {
750
+ return prop("collection").findNodes(expandedValue);
751
+ }
752
+ });
753
+ }
754
+ })),
755
+ selectedValue: bindable(() => ({
756
+ defaultValue: prop("defaultSelectedValue"),
757
+ value: prop("selectedValue"),
758
+ isEqual: require_equal.isEqual,
759
+ onChange(selectedValue) {
760
+ const focusedValue = getContext().get("focusedValue");
761
+ prop("onSelectionChange")?.({
762
+ selectedValue,
763
+ focusedValue,
764
+ get selectedNodes() {
765
+ return prop("collection").findNodes(selectedValue);
766
+ }
767
+ });
768
+ }
769
+ })),
770
+ focusedValue: bindable(() => ({
771
+ defaultValue: prop("defaultFocusedValue") || null,
772
+ value: prop("focusedValue"),
773
+ onChange(focusedValue) {
774
+ prop("onFocusChange")?.({
775
+ focusedValue,
776
+ get focusedNode() {
777
+ return focusedValue ? prop("collection").findNode(focusedValue) : null;
778
+ }
779
+ });
780
+ }
781
+ })),
782
+ loadingStatus: bindable(() => ({ defaultValue: {} })),
783
+ checkedValue: bindable(() => ({
784
+ defaultValue: prop("defaultCheckedValue") || [],
785
+ value: prop("checkedValue"),
786
+ isEqual: require_equal.isEqual,
787
+ onChange(value) {
788
+ prop("onCheckedChange")?.({ checkedValue: value });
789
+ }
790
+ })),
791
+ renamingValue: bindable(() => ({
792
+ sync: true,
793
+ defaultValue: null
794
+ }))
795
+ };
796
+ },
797
+ refs() {
798
+ return {
799
+ typeaheadState: { ...require_dom_query.getByTypeahead.defaultOptions },
800
+ pendingAborts: /* @__PURE__ */ new Map()
801
+ };
802
+ },
803
+ computed: {
804
+ isMultipleSelection: ({ prop }) => prop("selectionMode") === "multiple",
805
+ isTypingAhead: ({ refs }) => refs.get("typeaheadState").keysSoFar.length > 0,
806
+ visibleNodes: ({ prop, context }) => {
807
+ const nodes = [];
808
+ prop("collection").visit({
809
+ skip: skipFn({
810
+ prop,
811
+ context
812
+ }),
813
+ onEnter: (node, indexPath) => {
814
+ nodes.push({
815
+ node,
816
+ indexPath
817
+ });
818
+ }
819
+ });
820
+ return nodes;
821
+ }
822
+ },
823
+ on: {
824
+ "EXPANDED.SET": { actions: ["setExpanded"] },
825
+ "EXPANDED.CLEAR": { actions: ["clearExpanded"] },
826
+ "EXPANDED.ALL": { actions: ["expandAllBranches"] },
827
+ "BRANCH.EXPAND": { actions: ["expandBranches"] },
828
+ "BRANCH.COLLAPSE": { actions: ["collapseBranches"] },
829
+ "SELECTED.SET": { actions: ["setSelected"] },
830
+ "SELECTED.ALL": [{
831
+ guard: and("isMultipleSelection", "moveFocus"),
832
+ actions: ["selectAllNodes", "focusTreeLastNode"]
833
+ }, {
834
+ guard: "isMultipleSelection",
835
+ actions: ["selectAllNodes"]
836
+ }],
837
+ "SELECTED.CLEAR": { actions: ["clearSelected"] },
838
+ "NODE.SELECT": { actions: ["selectNode"] },
839
+ "NODE.DESELECT": { actions: ["deselectNode"] },
840
+ "CHECKED.TOGGLE": { actions: ["toggleChecked"] },
841
+ "CHECKED.SET": { actions: ["setChecked"] },
842
+ "CHECKED.CLEAR": { actions: ["clearChecked"] },
843
+ "NODE.FOCUS": { actions: ["setFocusedNode"] },
844
+ "NODE.ARROW_DOWN": [{
845
+ guard: and("isShiftKey", "isMultipleSelection"),
846
+ actions: ["focusTreeNextNode", "extendSelectionToNextNode"]
847
+ }, { actions: ["focusTreeNextNode"] }],
848
+ "NODE.ARROW_UP": [{
849
+ guard: and("isShiftKey", "isMultipleSelection"),
850
+ actions: ["focusTreePrevNode", "extendSelectionToPrevNode"]
851
+ }, { actions: ["focusTreePrevNode"] }],
852
+ "NODE.ARROW_LEFT": { actions: ["focusBranchNode"] },
853
+ "BRANCH_NODE.ARROW_LEFT": [{
854
+ guard: "isBranchExpanded",
855
+ actions: ["collapseBranch"]
856
+ }, { actions: ["focusBranchNode"] }],
857
+ "BRANCH_NODE.ARROW_RIGHT": [{
858
+ guard: and("isBranchFocused", "isBranchExpanded"),
859
+ actions: ["focusBranchFirstNode"]
860
+ }, { actions: ["expandBranch"] }],
861
+ "SIBLINGS.EXPAND": { actions: ["expandSiblingBranches"] },
862
+ "NODE.HOME": [{
863
+ guard: and("isShiftKey", "isMultipleSelection"),
864
+ actions: ["extendSelectionToFirstNode", "focusTreeFirstNode"]
865
+ }, { actions: ["focusTreeFirstNode"] }],
866
+ "NODE.END": [{
867
+ guard: and("isShiftKey", "isMultipleSelection"),
868
+ actions: ["extendSelectionToLastNode", "focusTreeLastNode"]
869
+ }, { actions: ["focusTreeLastNode"] }],
870
+ "NODE.CLICK": [
871
+ {
872
+ guard: and("isCtrlKey", "isMultipleSelection"),
873
+ actions: ["toggleNodeSelection"]
874
+ },
875
+ {
876
+ guard: and("isShiftKey", "isMultipleSelection"),
877
+ actions: ["extendSelectionToNode"]
878
+ },
879
+ { actions: ["selectNode"] }
880
+ ],
881
+ "BRANCH_NODE.CLICK": [
882
+ {
883
+ guard: and("isCtrlKey", "isMultipleSelection"),
884
+ actions: ["toggleNodeSelection"]
885
+ },
886
+ {
887
+ guard: and("isShiftKey", "isMultipleSelection"),
888
+ actions: ["extendSelectionToNode"]
889
+ },
890
+ {
891
+ guard: "expandOnClick",
892
+ actions: ["selectNode", "toggleBranchNode"]
893
+ },
894
+ { actions: ["selectNode"] }
895
+ ],
896
+ "BRANCH_TOGGLE.CLICK": { actions: ["toggleBranchNode"] },
897
+ "TREE.TYPEAHEAD": { actions: ["focusMatchedNode"] }
898
+ },
899
+ exit: ["clearPendingAborts"],
900
+ states: {
901
+ idle: { on: { "NODE.RENAME": {
902
+ target: "renaming",
903
+ actions: ["setRenamingValue"]
904
+ } } },
905
+ renaming: {
906
+ entry: ["syncRenameInput", "focusRenameInput"],
907
+ on: {
908
+ "RENAME.SUBMIT": {
909
+ guard: "isRenameLabelValid",
910
+ target: "idle",
911
+ actions: ["submitRenaming"]
912
+ },
913
+ "RENAME.CANCEL": {
914
+ target: "idle",
915
+ actions: ["cancelRenaming"]
916
+ }
917
+ }
918
+ }
919
+ },
920
+ implementations: {
921
+ guards: {
922
+ isBranchFocused: ({ context, event }) => context.get("focusedValue") === event.id,
923
+ isBranchExpanded: ({ context, event }) => context.get("expandedValue").includes(event.id),
924
+ isShiftKey: ({ event }) => event.shiftKey,
925
+ isCtrlKey: ({ event }) => event.ctrlKey,
926
+ hasSelectedItems: ({ context }) => context.get("selectedValue").length > 0,
927
+ isMultipleSelection: ({ prop }) => prop("selectionMode") === "multiple",
928
+ moveFocus: ({ event }) => !!event.moveFocus,
929
+ expandOnClick: ({ prop }) => !!prop("expandOnClick"),
930
+ isRenameLabelValid: ({ event }) => event.label.trim() !== ""
931
+ },
932
+ actions: {
933
+ selectNode({ context, event }) {
934
+ const value = event.id || event.value;
935
+ context.set("selectedValue", (prev) => {
936
+ if (value == null) return prev;
937
+ if (!event.isTrusted && require_utils.isArray(value)) return prev.concat(...value);
938
+ return [require_utils.isArray(value) ? require_array.last(value) : value].filter(Boolean);
939
+ });
940
+ },
941
+ deselectNode({ context, event }) {
942
+ const value = require_array.toArray(event.id || event.value);
943
+ context.set("selectedValue", (prev) => require_array.remove(prev, ...value));
944
+ },
945
+ setFocusedNode({ context, event }) {
946
+ context.set("focusedValue", event.id);
947
+ },
948
+ clearFocusedNode({ context }) {
949
+ context.set("focusedValue", null);
950
+ },
951
+ clearSelectedItem({ context }) {
952
+ context.set("selectedValue", []);
953
+ },
954
+ toggleBranchNode({ context, event, action }) {
955
+ action(context.get("expandedValue").includes(event.id) ? ["collapseBranch"] : ["expandBranch"]);
956
+ },
957
+ expandBranch(params) {
958
+ const { event } = params;
959
+ expandBranches(params, [event.id]);
960
+ },
961
+ expandBranches(params) {
962
+ const { context, event } = params;
963
+ expandBranches(params, require_array.diff(require_array.toArray(event.value), context.get("expandedValue")));
964
+ },
965
+ collapseBranch({ context, event }) {
966
+ context.set("expandedValue", (prev) => require_array.remove(prev, event.id));
967
+ },
968
+ collapseBranches(params) {
969
+ const { context, event } = params;
970
+ const value = require_array.toArray(event.value);
971
+ context.set("expandedValue", (prev) => require_array.remove(prev, ...value));
972
+ },
973
+ setExpanded({ context, event }) {
974
+ if (!require_utils.isArray(event.value)) return;
975
+ context.set("expandedValue", event.value);
976
+ },
977
+ clearExpanded({ context }) {
978
+ context.set("expandedValue", []);
979
+ },
980
+ setSelected({ context, event }) {
981
+ if (!require_utils.isArray(event.value)) return;
982
+ context.set("selectedValue", event.value);
983
+ },
984
+ clearSelected({ context }) {
985
+ context.set("selectedValue", []);
986
+ },
987
+ focusTreeFirstNode(params) {
988
+ const { prop, scope } = params;
989
+ const collection = prop("collection");
990
+ const firstNode = collection.getFirstNode(void 0, { skip: skipFn(params) });
991
+ if (!firstNode) return;
992
+ const firstValue = collection.getNodeValue(firstNode);
993
+ if (scrollToNode(params, firstValue)) require_raf.raf(() => focusNode(scope, firstValue));
994
+ else focusNode(scope, firstValue);
995
+ },
996
+ focusTreeLastNode(params) {
997
+ const { prop, scope } = params;
998
+ const collection = prop("collection");
999
+ const lastNode = collection.getLastNode(void 0, { skip: skipFn(params) });
1000
+ const lastValue = collection.getNodeValue(lastNode);
1001
+ if (scrollToNode(params, lastValue)) require_raf.raf(() => focusNode(scope, lastValue));
1002
+ else focusNode(scope, lastValue);
1003
+ },
1004
+ focusBranchFirstNode(params) {
1005
+ const { event, prop, scope } = params;
1006
+ const collection = prop("collection");
1007
+ const branchNode = collection.findNode(event.id);
1008
+ const firstNode = collection.getFirstNode(branchNode, { skip: skipFn(params) });
1009
+ if (!firstNode) return;
1010
+ const firstValue = collection.getNodeValue(firstNode);
1011
+ if (scrollToNode(params, firstValue)) require_raf.raf(() => focusNode(scope, firstValue));
1012
+ else focusNode(scope, firstValue);
1013
+ },
1014
+ focusTreeNextNode(params) {
1015
+ const { event, prop, scope } = params;
1016
+ const collection = prop("collection");
1017
+ const nextNode = collection.getNextNode(event.id, { skip: skipFn(params) });
1018
+ if (!nextNode) return;
1019
+ const nextValue = collection.getNodeValue(nextNode);
1020
+ if (scrollToNode(params, nextValue)) require_raf.raf(() => focusNode(scope, nextValue));
1021
+ else focusNode(scope, nextValue);
1022
+ },
1023
+ focusTreePrevNode(params) {
1024
+ const { event, prop, scope } = params;
1025
+ const collection = prop("collection");
1026
+ const prevNode = collection.getPreviousNode(event.id, { skip: skipFn(params) });
1027
+ if (!prevNode) return;
1028
+ const prevValue = collection.getNodeValue(prevNode);
1029
+ if (scrollToNode(params, prevValue)) require_raf.raf(() => focusNode(scope, prevValue));
1030
+ else focusNode(scope, prevValue);
1031
+ },
1032
+ focusBranchNode(params) {
1033
+ const { event, prop, scope } = params;
1034
+ const collection = prop("collection");
1035
+ const parentNode = collection.getParentNode(event.id);
1036
+ const parentValue = parentNode ? collection.getNodeValue(parentNode) : void 0;
1037
+ if (!parentValue) return;
1038
+ if (scrollToNode(params, parentValue)) require_raf.raf(() => focusNode(scope, parentValue));
1039
+ else focusNode(scope, parentValue);
1040
+ },
1041
+ selectAllNodes({ context, prop }) {
1042
+ context.set("selectedValue", prop("collection").getValues());
1043
+ },
1044
+ focusMatchedNode(params) {
1045
+ const { context, prop, refs, event, scope, computed } = params;
1046
+ const node = require_dom_query.getByTypeahead(computed("visibleNodes").map(({ node }) => ({
1047
+ textContent: prop("collection").stringifyNode(node),
1048
+ id: prop("collection").getNodeValue(node)
1049
+ })), {
1050
+ state: refs.get("typeaheadState"),
1051
+ activeId: context.get("focusedValue"),
1052
+ key: event.key
1053
+ });
1054
+ if (!node?.id) return;
1055
+ if (scrollToNode(params, node.id)) require_raf.raf(() => focusNode(scope, node.id));
1056
+ else focusNode(scope, node.id);
1057
+ },
1058
+ toggleNodeSelection({ context, event }) {
1059
+ const selectedValue = require_array.addOrRemove(context.get("selectedValue"), event.id);
1060
+ context.set("selectedValue", selectedValue);
1061
+ },
1062
+ expandAllBranches(params) {
1063
+ const { context, prop } = params;
1064
+ expandBranches(params, require_array.diff(prop("collection").getBranchValues(), context.get("expandedValue")));
1065
+ },
1066
+ expandSiblingBranches(params) {
1067
+ const { context, event, prop } = params;
1068
+ const collection = prop("collection");
1069
+ const indexPath = collection.getIndexPath(event.id);
1070
+ if (!indexPath) return;
1071
+ expandBranches(params, require_array.diff(collection.getSiblingNodes(indexPath).map((node) => collection.getNodeValue(node)), context.get("expandedValue")));
1072
+ },
1073
+ extendSelectionToNode(params) {
1074
+ const { context, event, prop, computed } = params;
1075
+ const collection = prop("collection");
1076
+ const anchorValue = require_array.first(context.get("selectedValue")) || collection.getNodeValue(collection.getFirstNode());
1077
+ const targetValue = event.id;
1078
+ let values = [anchorValue, targetValue];
1079
+ let hits = 0;
1080
+ computed("visibleNodes").forEach(({ node }) => {
1081
+ const nodeValue = collection.getNodeValue(node);
1082
+ if (hits === 1) values.push(nodeValue);
1083
+ if (nodeValue === anchorValue || nodeValue === targetValue) hits++;
1084
+ });
1085
+ context.set("selectedValue", require_array.uniq(values));
1086
+ },
1087
+ extendSelectionToNextNode(params) {
1088
+ const { context, event, prop } = params;
1089
+ const collection = prop("collection");
1090
+ const nextNode = collection.getNextNode(event.id, { skip: skipFn(params) });
1091
+ if (!nextNode) return;
1092
+ const values = new Set(context.get("selectedValue"));
1093
+ const nextValue = collection.getNodeValue(nextNode);
1094
+ if (nextValue == null) return;
1095
+ if (values.has(event.id) && values.has(nextValue)) values.delete(event.id);
1096
+ else if (!values.has(nextValue)) values.add(nextValue);
1097
+ context.set("selectedValue", Array.from(values));
1098
+ },
1099
+ extendSelectionToPrevNode(params) {
1100
+ const { context, event, prop } = params;
1101
+ const collection = prop("collection");
1102
+ const prevNode = collection.getPreviousNode(event.id, { skip: skipFn(params) });
1103
+ if (!prevNode) return;
1104
+ const values = new Set(context.get("selectedValue"));
1105
+ const prevValue = collection.getNodeValue(prevNode);
1106
+ if (prevValue == null) return;
1107
+ if (values.has(event.id) && values.has(prevValue)) values.delete(event.id);
1108
+ else if (!values.has(prevValue)) values.add(prevValue);
1109
+ context.set("selectedValue", Array.from(values));
1110
+ },
1111
+ extendSelectionToFirstNode(params) {
1112
+ const { context, prop } = params;
1113
+ const collection = prop("collection");
1114
+ const currentSelection = require_array.first(context.get("selectedValue"));
1115
+ const values = [];
1116
+ collection.visit({
1117
+ skip: skipFn(params),
1118
+ onEnter: (node) => {
1119
+ const nodeValue = collection.getNodeValue(node);
1120
+ values.push(nodeValue);
1121
+ if (nodeValue === currentSelection) return "stop";
1122
+ }
1123
+ });
1124
+ context.set("selectedValue", values);
1125
+ },
1126
+ extendSelectionToLastNode(params) {
1127
+ const { context, prop } = params;
1128
+ const collection = prop("collection");
1129
+ const currentSelection = require_array.first(context.get("selectedValue"));
1130
+ const values = [];
1131
+ let current = false;
1132
+ collection.visit({
1133
+ skip: skipFn(params),
1134
+ onEnter: (node) => {
1135
+ const nodeValue = collection.getNodeValue(node);
1136
+ if (nodeValue === currentSelection) current = true;
1137
+ if (current) values.push(nodeValue);
1138
+ }
1139
+ });
1140
+ context.set("selectedValue", values);
1141
+ },
1142
+ clearPendingAborts({ refs }) {
1143
+ const aborts = refs.get("pendingAborts");
1144
+ aborts.forEach((abort) => abort.abort());
1145
+ aborts.clear();
1146
+ },
1147
+ toggleChecked({ context, event, prop }) {
1148
+ const collection = prop("collection");
1149
+ context.set("checkedValue", (prev) => event.isBranch ? toggleBranchChecked(collection, event.value, prev) : require_array.addOrRemove(prev, event.value));
1150
+ },
1151
+ setChecked({ context, event }) {
1152
+ context.set("checkedValue", event.value);
1153
+ },
1154
+ clearChecked({ context }) {
1155
+ context.set("checkedValue", []);
1156
+ },
1157
+ setRenamingValue({ context, event, prop }) {
1158
+ context.set("renamingValue", event.value);
1159
+ const onRenameStartFn = prop("onRenameStart");
1160
+ if (onRenameStartFn) {
1161
+ const collection = prop("collection");
1162
+ const indexPath = collection.getIndexPath(event.value);
1163
+ if (indexPath) {
1164
+ const node = collection.at(indexPath);
1165
+ if (node) onRenameStartFn({
1166
+ value: event.value,
1167
+ node,
1168
+ indexPath
1169
+ });
1170
+ }
1171
+ }
1172
+ },
1173
+ submitRenaming({ context, event, prop, scope }) {
1174
+ const renamingValue = context.get("renamingValue");
1175
+ if (!renamingValue) return;
1176
+ const indexPath = prop("collection").getIndexPath(renamingValue);
1177
+ if (!indexPath) return;
1178
+ const trimmedLabel = event.label.trim();
1179
+ const onBeforeRenameFn = prop("onBeforeRename");
1180
+ if (onBeforeRenameFn) {
1181
+ if (!onBeforeRenameFn({
1182
+ value: renamingValue,
1183
+ label: trimmedLabel,
1184
+ indexPath
1185
+ })) {
1186
+ context.set("renamingValue", null);
1187
+ focusNode(scope, renamingValue);
1188
+ return;
1189
+ }
1190
+ }
1191
+ prop("onRenameComplete")?.({
1192
+ value: renamingValue,
1193
+ label: trimmedLabel,
1194
+ indexPath
1195
+ });
1196
+ context.set("renamingValue", null);
1197
+ focusNode(scope, renamingValue);
1198
+ },
1199
+ cancelRenaming({ context, scope }) {
1200
+ const renamingValue = context.get("renamingValue");
1201
+ context.set("renamingValue", null);
1202
+ if (renamingValue) focusNode(scope, renamingValue);
1203
+ },
1204
+ syncRenameInput({ context, scope, prop }) {
1205
+ const renamingValue = context.get("renamingValue");
1206
+ if (!renamingValue) return;
1207
+ const collection = prop("collection");
1208
+ const node = collection.findNode(renamingValue);
1209
+ if (!node) return;
1210
+ const label = collection.stringifyNode(node);
1211
+ require_form.setElementValue(getRenameInputEl(scope, renamingValue), label);
1212
+ },
1213
+ focusRenameInput({ context, scope }) {
1214
+ const renamingValue = context.get("renamingValue");
1215
+ if (!renamingValue) return;
1216
+ const inputEl = getRenameInputEl(scope, renamingValue);
1217
+ if (!inputEl) return;
1218
+ inputEl.focus();
1219
+ inputEl.select();
1220
+ }
1221
+ }
1222
+ }
1223
+ });
1224
+ function scrollToNode(params, value) {
1225
+ const { prop, scope, computed } = params;
1226
+ const scrollToIndexFn = prop("scrollToIndexFn");
1227
+ if (!scrollToIndexFn) return false;
1228
+ const collection = prop("collection");
1229
+ const visibleNodes = computed("visibleNodes");
1230
+ for (let i = 0; i < visibleNodes.length; i++) {
1231
+ const { node, indexPath } = visibleNodes[i];
1232
+ if (collection.getNodeValue(node) !== value) continue;
1233
+ scrollToIndexFn({
1234
+ index: i,
1235
+ node,
1236
+ indexPath,
1237
+ getElement: () => scope.getById(getNodeId(scope, value))
1238
+ });
1239
+ return true;
1240
+ }
1241
+ return false;
1242
+ }
1243
+ //#endregion
1244
+ //#region src/machines/tree-view/props.ts
1245
+ const props = require_create_props.createProps()([
1246
+ "ids",
1247
+ "collection",
1248
+ "dir",
1249
+ "expandedValue",
1250
+ "expandOnClick",
1251
+ "defaultFocusedValue",
1252
+ "focusedValue",
1253
+ "getRootNode",
1254
+ "id",
1255
+ "onExpandedChange",
1256
+ "onFocusChange",
1257
+ "onSelectionChange",
1258
+ "checkedValue",
1259
+ "selectedValue",
1260
+ "selectionMode",
1261
+ "typeahead",
1262
+ "defaultExpandedValue",
1263
+ "defaultSelectedValue",
1264
+ "defaultCheckedValue",
1265
+ "onCheckedChange",
1266
+ "onLoadChildrenComplete",
1267
+ "onLoadChildrenError",
1268
+ "loadChildren",
1269
+ "canRename",
1270
+ "onRenameStart",
1271
+ "onBeforeRename",
1272
+ "onRenameComplete",
1273
+ "scrollToIndexFn",
1274
+ "translations"
1275
+ ]);
1276
+ const splitProps = require_utils.createSplitProps(props);
1277
+ const itemProps = require_create_props.createProps()(["node", "indexPath"]);
1278
+ const splitItemProps = require_utils.createSplitProps(itemProps);
1279
+ //#endregion
1280
+ exports.anatomy = anatomy;
1281
+ exports.collection = collection;
1282
+ exports.connect = connect;
1283
+ exports.filePathCollection = filePathCollection;
1284
+ exports.itemProps = itemProps;
1285
+ exports.machine = machine;
1286
+ exports.props = props;
1287
+ exports.splitItemProps = splitItemProps;
1288
+ exports.splitProps = splitProps;