@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.
- package/dist/anatomy-DMuSMbOP.d.cts +18 -0
- package/dist/anatomy-DMuSMbOP.d.ts +18 -0
- package/dist/anatomy.cjs +3 -0
- package/dist/anatomy.d.cts +2 -0
- package/dist/anatomy.d.ts +2 -0
- package/dist/anatomy.js +2 -0
- package/dist/angle-3hqP0Mp5.cjs +13 -0
- package/dist/angle-oNt8uGHQ.js +8 -0
- package/dist/aria-hidden-CEXexb2I.js +127 -0
- package/dist/aria-hidden-Y7iJHPMr.cjs +132 -0
- package/dist/aria-hidden.cjs +3 -0
- package/dist/aria-hidden.d.cts +10 -0
- package/dist/aria-hidden.d.ts +10 -0
- package/dist/aria-hidden.js +2 -0
- package/dist/array-BGtygd0o.cjs +198 -0
- package/dist/array-C4KbHsha.js +73 -0
- package/dist/auto-resize-5F5iiKZb.cjs +106 -0
- package/dist/auto-resize-KkNfCcBt.js +95 -0
- package/dist/auto-resize.cjs +4 -0
- package/dist/auto-resize.d.cts +7 -0
- package/dist/auto-resize.d.ts +7 -0
- package/dist/auto-resize.js +2 -0
- package/dist/caret-CHqaP4XG.cjs +30 -0
- package/dist/caret-aiDJ6mAS.js +19 -0
- package/dist/closest-Clo6ODcK.js +117 -0
- package/dist/closest-IiRz1GIJ.cjs +176 -0
- package/dist/collection-CJU0oDtX.js +1295 -0
- package/dist/collection-CwzUJwBJ.cjs +1342 -0
- package/dist/collection.cjs +15 -0
- package/dist/collection.d.cts +34 -0
- package/dist/collection.d.ts +34 -0
- package/dist/collection.js +3 -0
- package/dist/color-CsugZjq6.d.cts +60 -0
- package/dist/color-CsugZjq6.d.ts +60 -0
- package/dist/color-utils-DzeOVYlL.cjs +662 -0
- package/dist/color-utils-lDDg9FEh.js +639 -0
- package/dist/color-utils.cjs +6 -0
- package/dist/color-utils.d.cts +18 -0
- package/dist/color-utils.d.ts +18 -0
- package/dist/color-utils.js +2 -0
- package/dist/computed-style-B1MKlCoo.js +9 -0
- package/dist/computed-style-DLArEFNw.cjs +14 -0
- package/dist/controller-B8E8ZJCI.cjs +133 -0
- package/dist/controller-Dv7lWHDr.js +92 -0
- package/dist/core-BF6G2RiC.d.cts +1 -0
- package/dist/core-BNMw-JId.cjs +372 -0
- package/dist/core-BdeZuSX6.d.ts +1 -0
- package/dist/core-CJ0MZr3D.js +289 -0
- package/dist/core.cjs +19 -0
- package/dist/core.d.cts +3 -0
- package/dist/core.d.ts +3 -0
- package/dist/core.js +3 -0
- package/dist/create-anatomy-B2q3wiaw.js +22 -0
- package/dist/create-anatomy-BwDn25ph.cjs +27 -0
- package/dist/create-props-CgtcN_Qu.js +4 -0
- package/dist/create-props-CjLx2oS8.cjs +9 -0
- package/dist/data-url-C-Uk31Q9.cjs +42 -0
- package/dist/data-url-DHUHj7UF.js +37 -0
- package/dist/data-url-Gx_SWG-k.d.cts +10 -0
- package/dist/data-url-Gx_SWG-k.d.ts +10 -0
- package/dist/date-utils-D-JJHedx.cjs +868 -0
- package/dist/date-utils-D5zXW-Cs.js +569 -0
- package/dist/date-utils.cjs +52 -0
- package/dist/date-utils.d.cts +7 -0
- package/dist/date-utils.d.ts +7 -0
- package/dist/date-utils.js +2 -0
- package/dist/dismissable-C0bixtzl.cjs +348 -0
- package/dist/dismissable-KM1jPtNQ.js +337 -0
- package/dist/dismissable-layer-BTX5EvXw.d.ts +40 -0
- package/dist/dismissable-layer-Ch5niVaq.d.cts +40 -0
- package/dist/dismissable.cjs +4 -0
- package/dist/dismissable.d.cts +3 -0
- package/dist/dismissable.d.ts +3 -0
- package/dist/dismissable.js +2 -0
- package/dist/dom-query-CQzY93XU.cjs +488 -0
- package/dist/dom-query-e7fh0TEH.js +243 -0
- package/dist/dom-query.cjs +180 -0
- package/dist/dom-query.d.cts +142 -0
- package/dist/dom-query.d.ts +142 -0
- package/dist/dom-query.js +43 -0
- package/dist/equal-C927y7MN.cjs +30 -0
- package/dist/equal-DtrP8DPh.js +25 -0
- package/dist/event-DDz-mMhM.cjs +242 -0
- package/dist/event-bTItRgiw.js +117 -0
- package/dist/file-utils-6EXCdfHx.js +116 -0
- package/dist/file-utils-B7OJigQq.cjs +151 -0
- package/dist/file-utils.cjs +92 -0
- package/dist/file-utils.d.cts +40 -0
- package/dist/file-utils.d.ts +40 -0
- package/dist/file-utils.js +82 -0
- package/dist/focus-trap-89E5I9nm.js +487 -0
- package/dist/focus-trap-D7jKsfHW.cjs +498 -0
- package/dist/focus-trap.cjs +4 -0
- package/dist/focus-trap.d.cts +89 -0
- package/dist/focus-trap.d.ts +89 -0
- package/dist/focus-trap.js +2 -0
- package/dist/focus-visible-DWdQf__4.js +176 -0
- package/dist/focus-visible-G4cmlWqq.cjs +217 -0
- package/dist/focus-visible.cjs +9 -0
- package/dist/focus-visible.d.cts +32 -0
- package/dist/focus-visible.d.ts +32 -0
- package/dist/focus-visible.js +2 -0
- package/dist/form-B1DW_w_3.js +89 -0
- package/dist/form-CoupKpuP.cjs +130 -0
- package/dist/from-window-5ZhzSURC.js +68 -0
- package/dist/from-window-B9DKtaoR.cjs +115 -0
- package/dist/functions-isw5Ovcx.d.cts +16 -0
- package/dist/functions-isw5Ovcx.d.ts +16 -0
- package/dist/highlight-word.cjs +95 -0
- package/dist/highlight-word.d.cts +24 -0
- package/dist/highlight-word.d.ts +24 -0
- package/dist/highlight-word.js +94 -0
- package/dist/hotkeys.cjs +1183 -0
- package/dist/hotkeys.d.cts +199 -0
- package/dist/hotkeys.d.ts +199 -0
- package/dist/hotkeys.js +1173 -0
- package/dist/i18n-utils-BD4VtonY.cjs +345 -0
- package/dist/i18n-utils-C4FQZ39m.js +280 -0
- package/dist/i18n-utils.cjs +216 -0
- package/dist/i18n-utils.d.cts +71 -0
- package/dist/i18n-utils.d.ts +71 -0
- package/dist/i18n-utils.js +204 -0
- package/dist/index-3tNJficI.d.cts +117 -0
- package/dist/index-3tNJficI.d.ts +117 -0
- package/dist/index-BEfvdGE2.d.cts +116 -0
- package/dist/index-BEfvdGE2.d.ts +116 -0
- package/dist/index-BF6G2RiC.d.cts +1 -0
- package/dist/index-BKgxIVbE.d.cts +285 -0
- package/dist/index-BMtpmaRD.d.cts +16 -0
- package/dist/index-BMtpmaRD.d.ts +16 -0
- package/dist/index-BWiYePx8.d.cts +216 -0
- package/dist/index-BXfunVyD.d.cts +1342 -0
- package/dist/index-BXfunVyD.d.ts +1342 -0
- package/dist/index-BdeZuSX6.d.ts +1 -0
- package/dist/index-C2865AJq.d.cts +25 -0
- package/dist/index-C2865AJq.d.ts +25 -0
- package/dist/index-CFoN0L3C.d.ts +285 -0
- package/dist/index-vPrqYDHu.d.ts +216 -0
- package/dist/index.cjs +19 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/initial-focus-BQxRRFPa.cjs +37 -0
- package/dist/initial-focus-BrN5tT2X.js +26 -0
- package/dist/interact-outside-BjqIunFx.js +211 -0
- package/dist/interact-outside-Dphjr2Zh.cjs +216 -0
- package/dist/interact-outside.cjs +3 -0
- package/dist/interact-outside.d.cts +2 -0
- package/dist/interact-outside.d.ts +2 -0
- package/dist/interact-outside.js +2 -0
- package/dist/json-tree-utils.cjs +1518 -0
- package/dist/json-tree-utils.d.cts +117 -0
- package/dist/json-tree-utils.d.ts +117 -0
- package/dist/json-tree-utils.js +1469 -0
- package/dist/list-collection-D_eNKrot.d.cts +60 -0
- package/dist/list-collection-RqYEWHb4.d.ts +60 -0
- package/dist/live-region-BD0OgmrH.cjs +68 -0
- package/dist/live-region-F8YMmbrY.js +63 -0
- package/dist/live-region.cjs +3 -0
- package/dist/live-region.d.cts +2 -0
- package/dist/live-region.d.ts +2 -0
- package/dist/live-region.js +2 -0
- package/dist/machines/accordion/index.cjs +328 -0
- package/dist/machines/accordion/index.d.cts +83 -0
- package/dist/machines/accordion/index.d.ts +83 -0
- package/dist/machines/accordion/index.js +321 -0
- package/dist/machines/angle-slider/index.cjs +420 -0
- package/dist/machines/angle-slider/index.d.cts +84 -0
- package/dist/machines/angle-slider/index.d.ts +84 -0
- package/dist/machines/angle-slider/index.js +415 -0
- package/dist/machines/async-list/index.cjs +310 -0
- package/dist/machines/async-list/index.d.cts +90 -0
- package/dist/machines/async-list/index.d.ts +90 -0
- package/dist/machines/async-list/index.js +308 -0
- package/dist/machines/avatar/index.cjs +165 -0
- package/dist/machines/avatar/index.d.cts +63 -0
- package/dist/machines/avatar/index.d.ts +63 -0
- package/dist/machines/avatar/index.js +160 -0
- package/dist/machines/carousel/index.cjs +929 -0
- package/dist/machines/carousel/index.d.cts +146 -0
- package/dist/machines/carousel/index.d.ts +146 -0
- package/dist/machines/carousel/index.js +920 -0
- package/dist/machines/cascade-select/index.cjs +1426 -0
- package/dist/machines/cascade-select/index.d.cts +167 -0
- package/dist/machines/cascade-select/index.d.ts +167 -0
- package/dist/machines/cascade-select/index.js +1419 -0
- package/dist/machines/checkbox/index.cjs +316 -0
- package/dist/machines/checkbox/index.d.cts +81 -0
- package/dist/machines/checkbox/index.d.ts +81 -0
- package/dist/machines/checkbox/index.js +311 -0
- package/dist/machines/clipboard/index.cjs +228 -0
- package/dist/machines/clipboard/index.d.cts +72 -0
- package/dist/machines/clipboard/index.d.ts +72 -0
- package/dist/machines/clipboard/index.js +221 -0
- package/dist/machines/collapsible/index.cjs +363 -0
- package/dist/machines/collapsible/index.d.cts +82 -0
- package/dist/machines/collapsible/index.d.ts +82 -0
- package/dist/machines/collapsible/index.js +358 -0
- package/dist/machines/color-picker/index.cjs +1534 -0
- package/dist/machines/color-picker/index.d.cts +207 -0
- package/dist/machines/color-picker/index.d.ts +207 -0
- package/dist/machines/color-picker/index.js +1518 -0
- package/dist/machines/combobox/index.cjs +1554 -0
- package/dist/machines/combobox/index.d.cts +219 -0
- package/dist/machines/combobox/index.d.ts +219 -0
- package/dist/machines/combobox/index.js +1542 -0
- package/dist/machines/date-input/index.cjs +1974 -0
- package/dist/machines/date-input/index.d.cts +230 -0
- package/dist/machines/date-input/index.d.ts +230 -0
- package/dist/machines/date-input/index.js +1958 -0
- package/dist/machines/date-picker/index.cjs +2424 -0
- package/dist/machines/date-picker/index.d.cts +378 -0
- package/dist/machines/date-picker/index.d.ts +378 -0
- package/dist/machines/date-picker/index.js +2408 -0
- package/dist/machines/dialog/index.cjs +378 -0
- package/dist/machines/dialog/index.d.cts +94 -0
- package/dist/machines/dialog/index.d.ts +94 -0
- package/dist/machines/dialog/index.js +373 -0
- package/dist/machines/drawer/index.cjs +2066 -0
- package/dist/machines/drawer/index.d.cts +334 -0
- package/dist/machines/drawer/index.d.ts +334 -0
- package/dist/machines/drawer/index.js +2059 -0
- package/dist/machines/editable/index.cjs +550 -0
- package/dist/machines/editable/index.d.cts +114 -0
- package/dist/machines/editable/index.d.ts +114 -0
- package/dist/machines/editable/index.js +545 -0
- package/dist/machines/file-upload/index.cjs +648 -0
- package/dist/machines/file-upload/index.d.cts +150 -0
- package/dist/machines/file-upload/index.d.ts +150 -0
- package/dist/machines/file-upload/index.js +641 -0
- package/dist/machines/floating-panel/index.cjs +1020 -0
- package/dist/machines/floating-panel/index.d.cts +149 -0
- package/dist/machines/floating-panel/index.d.ts +149 -0
- package/dist/machines/floating-panel/index.js +1012 -0
- package/dist/machines/hover-card/index.cjs +441 -0
- package/dist/machines/hover-card/index.d.cts +82 -0
- package/dist/machines/hover-card/index.d.ts +82 -0
- package/dist/machines/hover-card/index.js +436 -0
- package/dist/machines/image-cropper/index.cjs +2082 -0
- package/dist/machines/image-cropper/index.d.cts +182 -0
- package/dist/machines/image-cropper/index.d.ts +182 -0
- package/dist/machines/image-cropper/index.js +2076 -0
- package/dist/machines/listbox/index.cjs +873 -0
- package/dist/machines/listbox/index.d.cts +175 -0
- package/dist/machines/listbox/index.d.ts +175 -0
- package/dist/machines/listbox/index.js +860 -0
- package/dist/machines/marquee/index.cjs +387 -0
- package/dist/machines/marquee/index.d.cts +102 -0
- package/dist/machines/marquee/index.d.ts +102 -0
- package/dist/machines/marquee/index.js +382 -0
- package/dist/machines/menu/index.cjs +1562 -0
- package/dist/machines/menu/index.d.cts +188 -0
- package/dist/machines/menu/index.d.ts +188 -0
- package/dist/machines/menu/index.js +1549 -0
- package/dist/machines/navigation-menu/index.cjs +860 -0
- package/dist/machines/navigation-menu/index.d.cts +131 -0
- package/dist/machines/navigation-menu/index.d.ts +131 -0
- package/dist/machines/navigation-menu/index.js +855 -0
- package/dist/machines/number-input/index.cjs +1014 -0
- package/dist/machines/number-input/index.d.cts +136 -0
- package/dist/machines/number-input/index.d.ts +136 -0
- package/dist/machines/number-input/index.js +1009 -0
- package/dist/machines/pagination/index.cjs +413 -0
- package/dist/machines/pagination/index.d.cts +139 -0
- package/dist/machines/pagination/index.d.ts +139 -0
- package/dist/machines/pagination/index.js +404 -0
- package/dist/machines/password-input/index.cjs +224 -0
- package/dist/machines/password-input/index.d.cts +71 -0
- package/dist/machines/password-input/index.d.ts +71 -0
- package/dist/machines/password-input/index.js +219 -0
- package/dist/machines/pin-input/index.cjs +595 -0
- package/dist/machines/pin-input/index.d.cts +107 -0
- package/dist/machines/pin-input/index.d.ts +107 -0
- package/dist/machines/pin-input/index.js +590 -0
- package/dist/machines/popover/index.cjs +516 -0
- package/dist/machines/popover/index.d.cts +107 -0
- package/dist/machines/popover/index.d.ts +107 -0
- package/dist/machines/popover/index.js +511 -0
- package/dist/machines/presence/index.cjs +193 -0
- package/dist/machines/presence/index.d.cts +44 -0
- package/dist/machines/presence/index.d.ts +44 -0
- package/dist/machines/presence/index.js +190 -0
- package/dist/machines/progress/index.cjs +282 -0
- package/dist/machines/progress/index.d.cts +96 -0
- package/dist/machines/progress/index.d.ts +96 -0
- package/dist/machines/progress/index.js +277 -0
- package/dist/machines/qr-code/index.cjs +167 -0
- package/dist/machines/qr-code/index.d.cts +71 -0
- package/dist/machines/qr-code/index.d.ts +71 -0
- package/dist/machines/qr-code/index.js +162 -0
- package/dist/machines/radio-group/index.cjs +465 -0
- package/dist/machines/radio-group/index.d.cts +218 -0
- package/dist/machines/radio-group/index.d.ts +218 -0
- package/dist/machines/radio-group/index.js +458 -0
- package/dist/machines/rating-group/index.cjs +405 -0
- package/dist/machines/rating-group/index.d.cts +101 -0
- package/dist/machines/rating-group/index.d.ts +101 -0
- package/dist/machines/rating-group/index.js +398 -0
- package/dist/machines/scroll-area/index.cjs +865 -0
- package/dist/machines/scroll-area/index.d.cts +126 -0
- package/dist/machines/scroll-area/index.d.ts +126 -0
- package/dist/machines/scroll-area/index.js +860 -0
- package/dist/machines/select/index.cjs +1226 -0
- package/dist/machines/select/index.d.cts +190 -0
- package/dist/machines/select/index.d.ts +190 -0
- package/dist/machines/select/index.js +1214 -0
- package/dist/machines/signature-pad/index.cjs +337 -0
- package/dist/machines/signature-pad/index.d.cts +108 -0
- package/dist/machines/signature-pad/index.d.ts +108 -0
- package/dist/machines/signature-pad/index.js +330 -0
- package/dist/machines/slider/index.cjs +1103 -0
- package/dist/machines/slider/index.d.cts +154 -0
- package/dist/machines/slider/index.d.ts +154 -0
- package/dist/machines/slider/index.js +1094 -0
- package/dist/machines/splitter/index.cjs +1686 -0
- package/dist/machines/splitter/index.d.cts +282 -0
- package/dist/machines/splitter/index.d.ts +282 -0
- package/dist/machines/splitter/index.js +1675 -0
- package/dist/machines/steps/index.cjs +330 -0
- package/dist/machines/steps/index.d.cts +109 -0
- package/dist/machines/steps/index.d.ts +109 -0
- package/dist/machines/steps/index.js +325 -0
- package/dist/machines/switch/index.cjs +307 -0
- package/dist/machines/switch/index.d.cts +80 -0
- package/dist/machines/switch/index.d.ts +80 -0
- package/dist/machines/switch/index.js +302 -0
- package/dist/machines/tabs/index.cjs +542 -0
- package/dist/machines/tabs/index.d.cts +113 -0
- package/dist/machines/tabs/index.d.ts +113 -0
- package/dist/machines/tabs/index.js +533 -0
- package/dist/machines/tags-input/index.cjs +1151 -0
- package/dist/machines/tags-input/index.d.cts +182 -0
- package/dist/machines/tags-input/index.d.ts +182 -0
- package/dist/machines/tags-input/index.js +1144 -0
- package/dist/machines/timer/index.cjs +329 -0
- package/dist/machines/timer/index.d.cts +102 -0
- package/dist/machines/timer/index.d.ts +102 -0
- package/dist/machines/timer/index.js +323 -0
- package/dist/machines/toast/index.cjs +1185 -0
- package/dist/machines/toast/index.d.cts +204 -0
- package/dist/machines/toast/index.d.ts +204 -0
- package/dist/machines/toast/index.js +1180 -0
- package/dist/machines/toc/index.cjs +358 -0
- package/dist/machines/toc/index.d.cts +98 -0
- package/dist/machines/toc/index.d.ts +98 -0
- package/dist/machines/toc/index.js +351 -0
- package/dist/machines/toggle/index.cjs +99 -0
- package/dist/machines/toggle/index.d.cts +46 -0
- package/dist/machines/toggle/index.d.ts +46 -0
- package/dist/machines/toggle/index.js +94 -0
- package/dist/machines/toggle-group/index.cjs +329 -0
- package/dist/machines/toggle-group/index.d.cts +81 -0
- package/dist/machines/toggle-group/index.d.ts +81 -0
- package/dist/machines/toggle-group/index.js +322 -0
- package/dist/machines/tooltip/index.cjs +638 -0
- package/dist/machines/tooltip/index.d.cts +84 -0
- package/dist/machines/tooltip/index.d.ts +84 -0
- package/dist/machines/tooltip/index.js +633 -0
- package/dist/machines/tour/index.cjs +1123 -0
- package/dist/machines/tour/index.d.cts +207 -0
- package/dist/machines/tour/index.d.ts +207 -0
- package/dist/machines/tour/index.js +1115 -0
- package/dist/machines/tree-view/index.cjs +1288 -0
- package/dist/machines/tree-view/index.d.cts +221 -0
- package/dist/machines/tree-view/index.d.ts +221 -0
- package/dist/machines/tree-view/index.js +1279 -0
- package/dist/mutation-observer-_LbwtN3W.cjs +61 -0
- package/dist/mutation-observer-qObPUo3D.js +50 -0
- package/dist/navigate-CJOaL3vx.js +31 -0
- package/dist/navigate-uJG-006f.cjs +42 -0
- package/dist/overflow-BBihfMxX.cjs +67 -0
- package/dist/overflow-C-zO1CWA.js +44 -0
- package/dist/platform-BDB0wXUk.js +26 -0
- package/dist/platform-BZS-dkZN.cjs +109 -0
- package/dist/point-C9A4dk1i.js +27 -0
- package/dist/point-DxnCrJBy.cjs +32 -0
- package/dist/pointer-lock-BvfSjt_s.cjs +31 -0
- package/dist/pointer-lock-WezxTqu-.js +26 -0
- package/dist/pointer-move-CGzan38r.cjs +42 -0
- package/dist/pointer-move-Tijb8Ptk.js +37 -0
- package/dist/polygon-BvdwYRBw.js +76 -0
- package/dist/polygon-CTR1kEoU.cjs +93 -0
- package/dist/popper-DkAAS9VE.cjs +487 -0
- package/dist/popper-DzBZzAe4.js +464 -0
- package/dist/popper.cjs +6 -0
- package/dist/popper.d.cts +2 -0
- package/dist/popper.d.ts +2 -0
- package/dist/popper.js +2 -0
- package/dist/press-B7XLrLGR.js +65 -0
- package/dist/press-BdD5suLQ.cjs +70 -0
- package/dist/proxy-tab-focus-DWMXvAfO.js +54 -0
- package/dist/proxy-tab-focus-NthYgHdY.cjs +59 -0
- package/dist/raf-BSDcY4UD.cjs +85 -0
- package/dist/raf-DgINgykK.d.cts +15 -0
- package/dist/raf-DgINgykK.d.ts +15 -0
- package/dist/raf-Dhvm7f1e.js +62 -0
- package/dist/rect-utils-DiT4k3jS.cjs +548 -0
- package/dist/rect-utils-d_3gZVsc.js +459 -0
- package/dist/rect-utils.cjs +165 -0
- package/dist/rect-utils.d.cts +197 -0
- package/dist/rect-utils.d.ts +197 -0
- package/dist/rect-utils.js +116 -0
- package/dist/remove-scroll-DTVA5f4w.cjs +86 -0
- package/dist/remove-scroll-WEheFCiq.js +81 -0
- package/dist/remove-scroll.cjs +3 -0
- package/dist/remove-scroll.d.cts +4 -0
- package/dist/remove-scroll.d.ts +4 -0
- package/dist/remove-scroll.js +2 -0
- package/dist/rolldown-runtime-D6vf50IK.cjs +28 -0
- package/dist/scale-C5BBHVgH.js +17 -0
- package/dist/scale-C7iiUGhS.cjs +22 -0
- package/dist/scope-CysKlKe9.cjs +28 -0
- package/dist/scope-D1873Mzi.js +23 -0
- package/dist/scroll-CVJ40w2e.js +46 -0
- package/dist/scroll-Dyd1QLrc.cjs +63 -0
- package/dist/scroll-snap-Cuaqdevf.cjs +224 -0
- package/dist/scroll-snap-DqMiFASa.js +201 -0
- package/dist/scroll-snap.cjs +6 -0
- package/dist/scroll-snap.d.cts +14 -0
- package/dist/scroll-snap.d.ts +14 -0
- package/dist/scroll-snap.js +2 -0
- package/dist/selection-ClKhnWit.d.cts +49 -0
- package/dist/selection-DzLiSVkg.d.ts +49 -0
- package/dist/selection-map-962WvX2k.js +45 -0
- package/dist/selection-map-BwlZr1LH.cjs +68 -0
- package/dist/set-CFNGOW5W.js +50 -0
- package/dist/set-DrtWCLFb.cjs +73 -0
- package/dist/store-BLpJlMxz.js +257 -0
- package/dist/store-Btfrm2bs.cjs +47 -0
- package/dist/store-C5HvdLyc.js +42 -0
- package/dist/store-Wg8KVwNv.cjs +298 -0
- package/dist/store.cjs +9 -0
- package/dist/store.d.cts +26 -0
- package/dist/store.d.ts +26 -0
- package/dist/store.js +2 -0
- package/dist/stringify-state.cjs +48 -0
- package/dist/stringify-state.d.cts +8 -0
- package/dist/stringify-state.d.ts +8 -0
- package/dist/stringify-state.js +44 -0
- package/dist/tabbable-Bz1-1GAY.cjs +206 -0
- package/dist/tabbable-CDA1YMjZ.js +147 -0
- package/dist/text-selection-B3OQpQGy.cjs +75 -0
- package/dist/text-selection-DXvWvm6k.js +64 -0
- package/dist/timers-BRyPrXIX.js +82 -0
- package/dist/timers-Beu4SfAj.cjs +99 -0
- package/dist/tree-collection-3QX3EIhq.d.ts +77 -0
- package/dist/tree-collection-C6oDQGUJ.d.cts +77 -0
- package/dist/typeahead-DremEgML.d.cts +45 -0
- package/dist/typeahead-DremEgML.d.ts +45 -0
- package/dist/types-BFuHIo7S.js +10 -0
- package/dist/types-CczqoQLL.d.cts +57 -0
- package/dist/types-CczqoQLL.d.ts +57 -0
- package/dist/types-CjocssbC.d.cts +13 -0
- package/dist/types-CjocssbC.d.ts +13 -0
- package/dist/types-D7oF7eWh.d.cts +54 -0
- package/dist/types-D7oF7eWh.d.ts +54 -0
- package/dist/types-HCvp3Bhv.cjs +21 -0
- package/dist/types.cjs +14 -0
- package/dist/types.d.cts +6 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.js +12 -0
- package/dist/utils-BH-oBBz2.cjs +614 -0
- package/dist/utils-Cht5XaHf.js +267 -0
- package/dist/utils.cjs +95 -0
- package/dist/utils.d.cts +144 -0
- package/dist/utils.d.ts +144 -0
- package/dist/utils.js +7 -0
- package/dist/visually-hidden-BgSCFLz_.cjs +29 -0
- package/dist/visually-hidden-yDJ517KZ.js +18 -0
- package/dist/wait-for-3n85JcCU.d.cts +15 -0
- package/dist/wait-for-3n85JcCU.d.ts +15 -0
- package/dist/wait-for-CI5Ye-Lo.js +69 -0
- package/dist/wait-for-Db73VpZQ.cjs +86 -0
- package/dist/warning-CrzBpWT1.js +19 -0
- package/dist/warning-HAmFXLHm.cjs +42 -0
- package/package.json +349 -6
|
@@ -0,0 +1,1151 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_create_anatomy = require("../../create-anatomy-BwDn25ph.cjs");
|
|
3
|
+
const require_caret = require("../../caret-CHqaP4XG.cjs");
|
|
4
|
+
const require_dom_query = require("../../dom-query-CQzY93XU.cjs");
|
|
5
|
+
const require_event = require("../../event-DDz-mMhM.cjs");
|
|
6
|
+
const require_form = require("../../form-CoupKpuP.cjs");
|
|
7
|
+
const require_raf = require("../../raf-BSDcY4UD.cjs");
|
|
8
|
+
const require_auto_resize = require("../../auto-resize-5F5iiKZb.cjs");
|
|
9
|
+
const require_array = require("../../array-BGtygd0o.cjs");
|
|
10
|
+
const require_equal = require("../../equal-C927y7MN.cjs");
|
|
11
|
+
const require_utils = require("../../utils-BH-oBBz2.cjs");
|
|
12
|
+
const require_warning = require("../../warning-HAmFXLHm.cjs");
|
|
13
|
+
const require_core = require("../../core-BNMw-JId.cjs");
|
|
14
|
+
const require_interact_outside = require("../../interact-outside-Dphjr2Zh.cjs");
|
|
15
|
+
const require_live_region = require("../../live-region-BD0OgmrH.cjs");
|
|
16
|
+
const require_create_props = require("../../create-props-CjLx2oS8.cjs");
|
|
17
|
+
//#region src/machines/tags-input/anatomy.ts
|
|
18
|
+
const anatomy = require_create_anatomy.createAnatomy("tags-input").parts("root", "label", "control", "input", "clearTrigger", "item", "itemPreview", "itemInput", "itemText", "itemDeleteTrigger");
|
|
19
|
+
const parts = anatomy.build();
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/machines/tags-input/dom.ts
|
|
22
|
+
const getRootId = (ctx) => ctx.ids?.root ?? `tags-input:${ctx.id}`;
|
|
23
|
+
const getInputId = (ctx) => ctx.ids?.input ?? `tags-input:${ctx.id}:input`;
|
|
24
|
+
const getClearTriggerId = (ctx) => ctx.ids?.clearBtn ?? `tags-input:${ctx.id}:clear-btn`;
|
|
25
|
+
const getHiddenInputId = (ctx) => ctx.ids?.hiddenInput ?? `tags-input:${ctx.id}:hidden-input`;
|
|
26
|
+
const getLabelId = (ctx) => ctx.ids?.label ?? `tags-input:${ctx.id}:label`;
|
|
27
|
+
const getControlId = (ctx) => ctx.ids?.control ?? `tags-input:${ctx.id}:control`;
|
|
28
|
+
const getItemId = (ctx, opt) => ctx.ids?.item?.(opt) ?? `tags-input:${ctx.id}:tag:${opt.value}:${opt.index}`;
|
|
29
|
+
const getItemDeleteTriggerId = (ctx, opt) => ctx.ids?.itemDeleteTrigger?.(opt) ?? `${getItemId(ctx, opt)}:delete-btn`;
|
|
30
|
+
const getItemInputId = (ctx, opt) => ctx.ids?.itemInput?.(opt) ?? `${getItemId(ctx, opt)}:input`;
|
|
31
|
+
const getEditInputId = (id) => `${id}:input`;
|
|
32
|
+
const getEditInputEl = (ctx, id) => ctx.getById(getEditInputId(id));
|
|
33
|
+
const getItemEls = (ctx) => require_dom_query.queryAll(getRootEl(ctx), `[data-part=item]`);
|
|
34
|
+
const getTagInputEl = (ctx, opt) => ctx.getById(getItemInputId(ctx, opt));
|
|
35
|
+
const getRootEl = (ctx) => ctx.getById(getRootId(ctx));
|
|
36
|
+
const getInputEl = (ctx) => ctx.getById(getInputId(ctx));
|
|
37
|
+
const getHiddenInputEl = (ctx) => ctx.getById(getHiddenInputId(ctx));
|
|
38
|
+
const getTagElements = (ctx) => require_dom_query.queryAll(getRootEl(ctx), `[data-part=item-preview]:not([data-disabled])`);
|
|
39
|
+
const getFirstEl = (ctx) => getTagElements(ctx)[0];
|
|
40
|
+
const getLastEl = (ctx) => getTagElements(ctx)[getTagElements(ctx).length - 1];
|
|
41
|
+
const getPrevEl = (ctx, id) => require_dom_query.prevById(getTagElements(ctx), id, false);
|
|
42
|
+
const getNextEl = (ctx, id) => require_dom_query.nextById(getTagElements(ctx), id, false);
|
|
43
|
+
const getTagElAtIndex = (ctx, index) => getTagElements(ctx)[index];
|
|
44
|
+
const getIndexOfId = (ctx, id) => require_dom_query.indexOfId(getTagElements(ctx), id);
|
|
45
|
+
const setHoverIntent = (el) => {
|
|
46
|
+
const tagEl = el.closest("[data-part=item-preview]");
|
|
47
|
+
if (!tagEl) return;
|
|
48
|
+
tagEl.dataset.deleteIntent = "";
|
|
49
|
+
};
|
|
50
|
+
const clearHoverIntent = (el) => {
|
|
51
|
+
const tagEl = el.closest("[data-part=item-preview]");
|
|
52
|
+
if (!tagEl) return;
|
|
53
|
+
delete tagEl.dataset.deleteIntent;
|
|
54
|
+
};
|
|
55
|
+
const dispatchInputEvent = (ctx, value) => {
|
|
56
|
+
const inputEl = getHiddenInputEl(ctx);
|
|
57
|
+
if (!inputEl) return;
|
|
58
|
+
require_form.dispatchInputValueEvent(inputEl, { value });
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/machines/tags-input/connect.ts
|
|
62
|
+
function connect(service, normalize) {
|
|
63
|
+
const { state, send, computed, prop, scope, context } = service;
|
|
64
|
+
const interactive = computed("isInteractive");
|
|
65
|
+
const disabled = !!prop("disabled");
|
|
66
|
+
const readOnly = !!prop("readOnly");
|
|
67
|
+
const required = !!prop("required");
|
|
68
|
+
const invalid = prop("invalid") || computed("isOverflowing");
|
|
69
|
+
const translations = prop("translations");
|
|
70
|
+
const focused = state.hasTag("focused");
|
|
71
|
+
const editingTag = state.matches("editing:tag");
|
|
72
|
+
const empty = computed("count") === 0;
|
|
73
|
+
function getItemState(options) {
|
|
74
|
+
const id = getItemId(scope, options);
|
|
75
|
+
const editedTagId = context.get("editedTagId");
|
|
76
|
+
const highlightedTagId = context.get("highlightedTagId");
|
|
77
|
+
return {
|
|
78
|
+
id,
|
|
79
|
+
editing: editingTag && editedTagId === id,
|
|
80
|
+
highlighted: id === highlightedTagId,
|
|
81
|
+
disabled: Boolean(options.disabled || disabled)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
empty,
|
|
86
|
+
inputValue: context.get("inputValue"),
|
|
87
|
+
value: context.get("value"),
|
|
88
|
+
valueAsString: computed("valueAsString"),
|
|
89
|
+
count: computed("count"),
|
|
90
|
+
atMax: computed("isAtMax"),
|
|
91
|
+
setValue(value) {
|
|
92
|
+
send({
|
|
93
|
+
type: "SET_VALUE",
|
|
94
|
+
value
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
clearValue(id) {
|
|
98
|
+
if (id) send({
|
|
99
|
+
type: "CLEAR_TAG",
|
|
100
|
+
id
|
|
101
|
+
});
|
|
102
|
+
else send({ type: "CLEAR_VALUE" });
|
|
103
|
+
},
|
|
104
|
+
addValue(value) {
|
|
105
|
+
send({
|
|
106
|
+
type: "ADD_TAG",
|
|
107
|
+
value
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
setValueAtIndex(index, value) {
|
|
111
|
+
send({
|
|
112
|
+
type: "SET_VALUE_AT_INDEX",
|
|
113
|
+
index,
|
|
114
|
+
value
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
setInputValue(value) {
|
|
118
|
+
send({
|
|
119
|
+
type: "SET_INPUT_VALUE",
|
|
120
|
+
value
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
clearInputValue() {
|
|
124
|
+
send({
|
|
125
|
+
type: "SET_INPUT_VALUE",
|
|
126
|
+
value: ""
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
focus() {
|
|
130
|
+
getInputEl(scope)?.focus();
|
|
131
|
+
},
|
|
132
|
+
getItemState,
|
|
133
|
+
getRootProps() {
|
|
134
|
+
return normalize.element({
|
|
135
|
+
dir: prop("dir"),
|
|
136
|
+
...parts.root.attrs,
|
|
137
|
+
"data-invalid": require_dom_query.dataAttr(invalid),
|
|
138
|
+
"data-readonly": require_dom_query.dataAttr(readOnly),
|
|
139
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
140
|
+
"data-focus": require_dom_query.dataAttr(focused),
|
|
141
|
+
"data-empty": require_dom_query.dataAttr(empty),
|
|
142
|
+
id: getRootId(scope),
|
|
143
|
+
onPointerDown() {
|
|
144
|
+
if (!interactive) return;
|
|
145
|
+
send({ type: "POINTER_DOWN" });
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
getLabelProps() {
|
|
150
|
+
return normalize.label({
|
|
151
|
+
...parts.label.attrs,
|
|
152
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
153
|
+
"data-invalid": require_dom_query.dataAttr(invalid),
|
|
154
|
+
"data-readonly": require_dom_query.dataAttr(readOnly),
|
|
155
|
+
"data-required": require_dom_query.dataAttr(required),
|
|
156
|
+
id: getLabelId(scope),
|
|
157
|
+
dir: prop("dir"),
|
|
158
|
+
htmlFor: getInputId(scope)
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
getControlProps() {
|
|
162
|
+
return normalize.element({
|
|
163
|
+
id: getControlId(scope),
|
|
164
|
+
...parts.control.attrs,
|
|
165
|
+
dir: prop("dir"),
|
|
166
|
+
tabIndex: readOnly ? 0 : void 0,
|
|
167
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
168
|
+
"data-readonly": require_dom_query.dataAttr(readOnly),
|
|
169
|
+
"data-invalid": require_dom_query.dataAttr(invalid),
|
|
170
|
+
"data-focus": require_dom_query.dataAttr(focused)
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
getInputProps() {
|
|
174
|
+
return normalize.input({
|
|
175
|
+
...parts.input.attrs,
|
|
176
|
+
dir: prop("dir"),
|
|
177
|
+
"data-invalid": require_dom_query.dataAttr(invalid),
|
|
178
|
+
"aria-invalid": require_dom_query.ariaAttr(invalid),
|
|
179
|
+
"data-readonly": require_dom_query.dataAttr(readOnly),
|
|
180
|
+
"data-empty": require_dom_query.dataAttr(empty),
|
|
181
|
+
maxLength: prop("maxLength"),
|
|
182
|
+
id: getInputId(scope),
|
|
183
|
+
defaultValue: context.get("inputValue"),
|
|
184
|
+
autoComplete: "off",
|
|
185
|
+
autoCorrect: "off",
|
|
186
|
+
autoCapitalize: "none",
|
|
187
|
+
enterKeyHint: "done",
|
|
188
|
+
disabled: disabled || readOnly,
|
|
189
|
+
placeholder: empty ? prop("placeholder") : void 0,
|
|
190
|
+
onInput(event) {
|
|
191
|
+
const evt = require_event.getNativeEvent(event);
|
|
192
|
+
const value = event.currentTarget.value;
|
|
193
|
+
if (evt.inputType === "insertFromPaste") {
|
|
194
|
+
send({
|
|
195
|
+
type: "PASTE",
|
|
196
|
+
value
|
|
197
|
+
});
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (endsWith(value, prop("delimiter"))) {
|
|
201
|
+
send({ type: "DELIMITER_KEY" });
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
send({
|
|
205
|
+
type: "TYPE",
|
|
206
|
+
value,
|
|
207
|
+
key: evt.inputType
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
onFocus() {
|
|
211
|
+
queueMicrotask(() => {
|
|
212
|
+
send({ type: "FOCUS" });
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
onKeyDown(event) {
|
|
216
|
+
if (event.defaultPrevented) return;
|
|
217
|
+
if (require_event.isComposingEvent(event)) return;
|
|
218
|
+
const target = event.currentTarget;
|
|
219
|
+
const isCombobox = target.getAttribute("role") === "combobox";
|
|
220
|
+
const isExpanded = target.ariaExpanded === "true";
|
|
221
|
+
const exec = {
|
|
222
|
+
ArrowDown() {
|
|
223
|
+
send({ type: "ARROW_DOWN" });
|
|
224
|
+
},
|
|
225
|
+
ArrowLeft() {
|
|
226
|
+
if (isCombobox && isExpanded) return;
|
|
227
|
+
send({ type: "ARROW_LEFT" });
|
|
228
|
+
},
|
|
229
|
+
ArrowRight(event) {
|
|
230
|
+
if (context.get("highlightedTagId")) event.preventDefault();
|
|
231
|
+
if (isCombobox && isExpanded) return;
|
|
232
|
+
send({ type: "ARROW_RIGHT" });
|
|
233
|
+
},
|
|
234
|
+
Escape(event) {
|
|
235
|
+
event.preventDefault();
|
|
236
|
+
send({ type: "ESCAPE" });
|
|
237
|
+
},
|
|
238
|
+
Backspace() {
|
|
239
|
+
send({ type: "BACKSPACE" });
|
|
240
|
+
},
|
|
241
|
+
Delete() {
|
|
242
|
+
send({ type: "DELETE" });
|
|
243
|
+
},
|
|
244
|
+
Enter(event) {
|
|
245
|
+
const hasHighlightedItem = target.getAttribute("aria-activedescendant");
|
|
246
|
+
if (isCombobox && isExpanded && hasHighlightedItem) return;
|
|
247
|
+
send({ type: "ENTER" });
|
|
248
|
+
event.preventDefault();
|
|
249
|
+
}
|
|
250
|
+
}[require_event.getEventKey(event, { dir: prop("dir") })];
|
|
251
|
+
if (exec) {
|
|
252
|
+
exec(event);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
},
|
|
258
|
+
getHiddenInputProps() {
|
|
259
|
+
return normalize.input({
|
|
260
|
+
type: "text",
|
|
261
|
+
hidden: true,
|
|
262
|
+
name: prop("name"),
|
|
263
|
+
form: prop("form"),
|
|
264
|
+
disabled,
|
|
265
|
+
readOnly,
|
|
266
|
+
required: prop("required"),
|
|
267
|
+
id: getHiddenInputId(scope),
|
|
268
|
+
defaultValue: computed("valueAsString")
|
|
269
|
+
});
|
|
270
|
+
},
|
|
271
|
+
getItemProps(props) {
|
|
272
|
+
return normalize.element({
|
|
273
|
+
...parts.item.attrs,
|
|
274
|
+
dir: prop("dir"),
|
|
275
|
+
"data-value": props.value,
|
|
276
|
+
"data-disabled": require_dom_query.dataAttr(disabled)
|
|
277
|
+
});
|
|
278
|
+
},
|
|
279
|
+
getItemPreviewProps(props) {
|
|
280
|
+
const itemState = getItemState(props);
|
|
281
|
+
return normalize.element({
|
|
282
|
+
...parts.itemPreview.attrs,
|
|
283
|
+
id: itemState.id,
|
|
284
|
+
dir: prop("dir"),
|
|
285
|
+
hidden: itemState.editing,
|
|
286
|
+
"data-value": props.value,
|
|
287
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
288
|
+
"data-highlighted": require_dom_query.dataAttr(itemState.highlighted),
|
|
289
|
+
onPointerDown(event) {
|
|
290
|
+
if (!interactive || itemState.disabled) return;
|
|
291
|
+
if (!require_event.isLeftClick(event)) return;
|
|
292
|
+
event.preventDefault();
|
|
293
|
+
send({
|
|
294
|
+
type: "POINTER_DOWN_TAG",
|
|
295
|
+
id: itemState.id
|
|
296
|
+
});
|
|
297
|
+
},
|
|
298
|
+
onDoubleClick() {
|
|
299
|
+
if (!interactive || itemState.disabled) return;
|
|
300
|
+
send({
|
|
301
|
+
type: "DOUBLE_CLICK_TAG",
|
|
302
|
+
id: itemState.id
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
},
|
|
307
|
+
getItemTextProps(props) {
|
|
308
|
+
const itemState = getItemState(props);
|
|
309
|
+
return normalize.element({
|
|
310
|
+
...parts.itemText.attrs,
|
|
311
|
+
dir: prop("dir"),
|
|
312
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
313
|
+
"data-highlighted": require_dom_query.dataAttr(itemState.highlighted)
|
|
314
|
+
});
|
|
315
|
+
},
|
|
316
|
+
getItemInputProps(props) {
|
|
317
|
+
const itemState = getItemState(props);
|
|
318
|
+
return normalize.input({
|
|
319
|
+
...parts.itemInput.attrs,
|
|
320
|
+
dir: prop("dir"),
|
|
321
|
+
"aria-label": translations?.tagEdited?.(props.value),
|
|
322
|
+
disabled,
|
|
323
|
+
id: getItemInputId(scope, props),
|
|
324
|
+
tabIndex: -1,
|
|
325
|
+
hidden: !itemState.editing,
|
|
326
|
+
maxLength: prop("maxLength"),
|
|
327
|
+
defaultValue: itemState.editing ? context.get("editedTagValue") : "",
|
|
328
|
+
onInput(event) {
|
|
329
|
+
send({
|
|
330
|
+
type: "TAG_INPUT_TYPE",
|
|
331
|
+
value: event.currentTarget.value
|
|
332
|
+
});
|
|
333
|
+
},
|
|
334
|
+
onBlur(event) {
|
|
335
|
+
queueMicrotask(() => {
|
|
336
|
+
send({
|
|
337
|
+
type: "TAG_INPUT_BLUR",
|
|
338
|
+
target: event.relatedTarget,
|
|
339
|
+
id: itemState.id
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
},
|
|
343
|
+
onKeyDown(event) {
|
|
344
|
+
if (event.defaultPrevented) return;
|
|
345
|
+
if (require_event.isComposingEvent(event)) return;
|
|
346
|
+
const exec = {
|
|
347
|
+
Enter() {
|
|
348
|
+
send({ type: "TAG_INPUT_ENTER" });
|
|
349
|
+
},
|
|
350
|
+
Escape() {
|
|
351
|
+
send({ type: "TAG_INPUT_ESCAPE" });
|
|
352
|
+
}
|
|
353
|
+
}[event.key];
|
|
354
|
+
if (exec) {
|
|
355
|
+
event.preventDefault();
|
|
356
|
+
exec(event);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
},
|
|
361
|
+
getItemDeleteTriggerProps(props) {
|
|
362
|
+
const itemState = getItemState(props);
|
|
363
|
+
return normalize.button({
|
|
364
|
+
...parts.itemDeleteTrigger.attrs,
|
|
365
|
+
dir: prop("dir"),
|
|
366
|
+
"data-disabled": require_dom_query.dataAttr(itemState.disabled),
|
|
367
|
+
"aria-disabled": itemState.disabled,
|
|
368
|
+
"data-highlighted": require_dom_query.dataAttr(itemState.highlighted),
|
|
369
|
+
id: getItemDeleteTriggerId(scope, props),
|
|
370
|
+
type: "button",
|
|
371
|
+
disabled: itemState.disabled,
|
|
372
|
+
"aria-label": translations?.deleteTagTriggerLabel?.(props.value),
|
|
373
|
+
tabIndex: -1,
|
|
374
|
+
onPointerDown(event) {
|
|
375
|
+
if (!require_event.isLeftClick(event)) return;
|
|
376
|
+
if (!interactive) event.preventDefault();
|
|
377
|
+
},
|
|
378
|
+
onPointerMove(event) {
|
|
379
|
+
if (!interactive) return;
|
|
380
|
+
setHoverIntent(event.currentTarget);
|
|
381
|
+
},
|
|
382
|
+
onPointerLeave(event) {
|
|
383
|
+
if (!interactive) return;
|
|
384
|
+
clearHoverIntent(event.currentTarget);
|
|
385
|
+
},
|
|
386
|
+
onClick(event) {
|
|
387
|
+
if (event.defaultPrevented) return;
|
|
388
|
+
if (!interactive) return;
|
|
389
|
+
send({
|
|
390
|
+
type: "CLICK_DELETE_TAG",
|
|
391
|
+
id: itemState.id
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
},
|
|
396
|
+
getClearTriggerProps() {
|
|
397
|
+
return normalize.button({
|
|
398
|
+
...parts.clearTrigger.attrs,
|
|
399
|
+
dir: prop("dir"),
|
|
400
|
+
id: getClearTriggerId(scope),
|
|
401
|
+
type: "button",
|
|
402
|
+
"data-readonly": require_dom_query.dataAttr(readOnly),
|
|
403
|
+
disabled,
|
|
404
|
+
"aria-label": translations?.clearTriggerLabel,
|
|
405
|
+
hidden: empty,
|
|
406
|
+
onClick() {
|
|
407
|
+
if (!interactive) return;
|
|
408
|
+
send({ type: "CLEAR_VALUE" });
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function endsWith(str, del) {
|
|
415
|
+
if (!del) return false;
|
|
416
|
+
if (typeof del === "string") return str.endsWith(del);
|
|
417
|
+
return new RegExp(`${del.source}$`).test(str);
|
|
418
|
+
}
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/machines/tags-input/machine.ts
|
|
421
|
+
const { and, not, or } = require_core.createGuards();
|
|
422
|
+
const machine = require_core.createMachine({
|
|
423
|
+
props({ props }) {
|
|
424
|
+
return {
|
|
425
|
+
dir: "ltr",
|
|
426
|
+
addOnPaste: false,
|
|
427
|
+
editable: true,
|
|
428
|
+
validate: () => true,
|
|
429
|
+
allowDuplicates: false,
|
|
430
|
+
delimiter: ",",
|
|
431
|
+
defaultValue: [],
|
|
432
|
+
defaultInputValue: "",
|
|
433
|
+
max: Infinity,
|
|
434
|
+
sanitizeValue: (value) => value.trim(),
|
|
435
|
+
...props,
|
|
436
|
+
translations: {
|
|
437
|
+
clearTriggerLabel: "Clear all tags",
|
|
438
|
+
deleteTagTriggerLabel: (value) => `Delete tag ${value}`,
|
|
439
|
+
tagAdded: (value) => `Added tag ${value}`,
|
|
440
|
+
tagsPasted: (values) => `Pasted ${values.length} tags`,
|
|
441
|
+
tagEdited: (value) => `Editing tag ${value}. Press enter to save or escape to cancel.`,
|
|
442
|
+
tagUpdated: (value) => `Tag update to ${value}`,
|
|
443
|
+
tagDeleted: (value) => `Tag ${value} deleted`,
|
|
444
|
+
tagSelected: (value) => `Tag ${value} selected. Press enter to edit, delete or backspace to remove.`,
|
|
445
|
+
...props.translations
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
},
|
|
449
|
+
initialState({ prop }) {
|
|
450
|
+
return prop("autoFocus") ? "focused:input" : "idle";
|
|
451
|
+
},
|
|
452
|
+
refs() {
|
|
453
|
+
return {
|
|
454
|
+
liveRegion: null,
|
|
455
|
+
log: {
|
|
456
|
+
current: null,
|
|
457
|
+
prev: null
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
},
|
|
461
|
+
context({ bindable, prop }) {
|
|
462
|
+
return {
|
|
463
|
+
value: bindable(() => ({
|
|
464
|
+
defaultValue: prop("defaultValue"),
|
|
465
|
+
value: prop("value"),
|
|
466
|
+
isEqual: require_equal.isEqual,
|
|
467
|
+
hash(value) {
|
|
468
|
+
return value.join(", ");
|
|
469
|
+
},
|
|
470
|
+
onChange(value) {
|
|
471
|
+
prop("onValueChange")?.({ value });
|
|
472
|
+
}
|
|
473
|
+
})),
|
|
474
|
+
inputValue: bindable(() => ({
|
|
475
|
+
sync: true,
|
|
476
|
+
defaultValue: prop("defaultInputValue"),
|
|
477
|
+
value: prop("inputValue"),
|
|
478
|
+
onChange(value) {
|
|
479
|
+
prop("onInputValueChange")?.({ inputValue: value });
|
|
480
|
+
}
|
|
481
|
+
})),
|
|
482
|
+
fieldsetDisabled: bindable(() => ({ defaultValue: false })),
|
|
483
|
+
editedTagValue: bindable(() => ({ defaultValue: "" })),
|
|
484
|
+
editedTagId: bindable(() => ({ defaultValue: null })),
|
|
485
|
+
editedTagIndex: bindable(() => ({
|
|
486
|
+
defaultValue: null,
|
|
487
|
+
sync: true
|
|
488
|
+
})),
|
|
489
|
+
highlightedTagId: bindable(() => ({
|
|
490
|
+
defaultValue: null,
|
|
491
|
+
sync: true,
|
|
492
|
+
onChange(value) {
|
|
493
|
+
prop("onHighlightChange")?.({ highlightedValue: value });
|
|
494
|
+
}
|
|
495
|
+
}))
|
|
496
|
+
};
|
|
497
|
+
},
|
|
498
|
+
computed: {
|
|
499
|
+
count: ({ context }) => context.get("value").length,
|
|
500
|
+
valueAsString: ({ context }) => context.hash("value"),
|
|
501
|
+
sanitizedInputValue: ({ context, prop }) => prop("sanitizeValue")(context.get("inputValue")),
|
|
502
|
+
isDisabled: ({ prop }) => !!prop("disabled"),
|
|
503
|
+
isInteractive: ({ prop }) => !(prop("readOnly") || !!prop("disabled")),
|
|
504
|
+
isAtMax: ({ context, prop }) => context.get("value").length === prop("max"),
|
|
505
|
+
isOverflowing: ({ context, prop }) => context.get("value").length > prop("max")
|
|
506
|
+
},
|
|
507
|
+
watch({ track, context, action, computed, refs }) {
|
|
508
|
+
track([() => computed("valueAsString")], () => {
|
|
509
|
+
action(["dispatchChangeEvent"]);
|
|
510
|
+
});
|
|
511
|
+
track([() => context.get("editedTagValue")], () => {
|
|
512
|
+
action(["syncEditedTagInputValue"]);
|
|
513
|
+
});
|
|
514
|
+
track([() => context.get("inputValue")], () => {
|
|
515
|
+
action(["syncInputValue"]);
|
|
516
|
+
});
|
|
517
|
+
track([() => context.get("highlightedTagId")], () => {
|
|
518
|
+
action(["logHighlightedTag"]);
|
|
519
|
+
});
|
|
520
|
+
track([() => computed("isOverflowing")], () => {
|
|
521
|
+
action(["invokeOnInvalid"]);
|
|
522
|
+
});
|
|
523
|
+
track([() => JSON.stringify(refs.get("log"))], () => {
|
|
524
|
+
action(["announceLog"]);
|
|
525
|
+
});
|
|
526
|
+
},
|
|
527
|
+
effects: ["trackLiveRegion", "trackFormControlState"],
|
|
528
|
+
exit: ["clearLog"],
|
|
529
|
+
on: {
|
|
530
|
+
DOUBLE_CLICK_TAG: {
|
|
531
|
+
guard: "isTagEditable",
|
|
532
|
+
target: "editing:tag",
|
|
533
|
+
actions: ["setEditedId"]
|
|
534
|
+
},
|
|
535
|
+
POINTER_DOWN_TAG: {
|
|
536
|
+
target: "navigating:tag",
|
|
537
|
+
actions: ["highlightTag", "focusInput"]
|
|
538
|
+
},
|
|
539
|
+
CLICK_DELETE_TAG: {
|
|
540
|
+
target: "focused:input",
|
|
541
|
+
actions: ["deleteTag"]
|
|
542
|
+
},
|
|
543
|
+
SET_INPUT_VALUE: { actions: ["setInputValue"] },
|
|
544
|
+
SET_VALUE: { actions: ["setValue"] },
|
|
545
|
+
CLEAR_TAG: { actions: ["deleteTag"] },
|
|
546
|
+
SET_VALUE_AT_INDEX: { actions: ["setValueAtIndex"] },
|
|
547
|
+
CLEAR_VALUE: { actions: [
|
|
548
|
+
"clearTags",
|
|
549
|
+
"clearInputValue",
|
|
550
|
+
"focusInput"
|
|
551
|
+
] },
|
|
552
|
+
ADD_TAG: { actions: ["addTag"] },
|
|
553
|
+
INSERT_TAG: {
|
|
554
|
+
guard: and(or(not("isAtMax"), "allowOverflow"), not("isInputValueEmpty")),
|
|
555
|
+
actions: ["addTag", "clearInputValue"]
|
|
556
|
+
},
|
|
557
|
+
EXTERNAL_BLUR: [{
|
|
558
|
+
guard: "addOnBlur",
|
|
559
|
+
actions: ["raiseInsertTagEvent"]
|
|
560
|
+
}, {
|
|
561
|
+
guard: "clearOnBlur",
|
|
562
|
+
actions: ["clearInputValue"]
|
|
563
|
+
}]
|
|
564
|
+
},
|
|
565
|
+
states: {
|
|
566
|
+
idle: { on: {
|
|
567
|
+
FOCUS: { target: "focused:input" },
|
|
568
|
+
POINTER_DOWN: {
|
|
569
|
+
guard: not("hasHighlightedTag"),
|
|
570
|
+
target: "focused:input"
|
|
571
|
+
}
|
|
572
|
+
} },
|
|
573
|
+
"focused:input": {
|
|
574
|
+
tags: ["focused"],
|
|
575
|
+
entry: ["focusInput", "clearHighlightedId"],
|
|
576
|
+
effects: ["trackInteractOutside"],
|
|
577
|
+
on: {
|
|
578
|
+
TYPE: { actions: ["setInputValue"] },
|
|
579
|
+
BLUR: [
|
|
580
|
+
{
|
|
581
|
+
guard: "addOnBlur",
|
|
582
|
+
target: "idle",
|
|
583
|
+
actions: ["raiseInsertTagEvent"]
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
guard: "clearOnBlur",
|
|
587
|
+
target: "idle",
|
|
588
|
+
actions: ["clearInputValue"]
|
|
589
|
+
},
|
|
590
|
+
{ target: "idle" }
|
|
591
|
+
],
|
|
592
|
+
ENTER: { actions: ["raiseInsertTagEvent"] },
|
|
593
|
+
DELIMITER_KEY: { actions: ["raiseInsertTagEvent"] },
|
|
594
|
+
ARROW_LEFT: {
|
|
595
|
+
guard: and("hasTags", "isCaretAtStart"),
|
|
596
|
+
target: "navigating:tag",
|
|
597
|
+
actions: ["highlightLastTag"]
|
|
598
|
+
},
|
|
599
|
+
BACKSPACE: {
|
|
600
|
+
target: "navigating:tag",
|
|
601
|
+
guard: and("hasTags", "isCaretAtStart"),
|
|
602
|
+
actions: ["highlightLastTag"]
|
|
603
|
+
},
|
|
604
|
+
DELETE: {
|
|
605
|
+
guard: "hasHighlightedTag",
|
|
606
|
+
actions: ["deleteHighlightedTag", "highlightTagAtIndex"]
|
|
607
|
+
},
|
|
608
|
+
PASTE: [{
|
|
609
|
+
guard: "addOnPaste",
|
|
610
|
+
actions: ["setInputValue", "addTagFromPaste"]
|
|
611
|
+
}, { actions: ["setInputValue"] }]
|
|
612
|
+
}
|
|
613
|
+
},
|
|
614
|
+
"navigating:tag": {
|
|
615
|
+
tags: ["focused"],
|
|
616
|
+
effects: ["trackInteractOutside"],
|
|
617
|
+
on: {
|
|
618
|
+
ARROW_RIGHT: [{
|
|
619
|
+
guard: and("hasTags", "isCaretAtStart", not("isLastTagHighlighted")),
|
|
620
|
+
actions: ["highlightNextTag"]
|
|
621
|
+
}, { target: "focused:input" }],
|
|
622
|
+
ARROW_LEFT: [{
|
|
623
|
+
guard: not("isCaretAtStart"),
|
|
624
|
+
target: "focused:input"
|
|
625
|
+
}, { actions: ["highlightPrevTag"] }],
|
|
626
|
+
BLUR: {
|
|
627
|
+
target: "idle",
|
|
628
|
+
actions: ["clearHighlightedId"]
|
|
629
|
+
},
|
|
630
|
+
ENTER: {
|
|
631
|
+
guard: and("isTagEditable", "hasHighlightedTag"),
|
|
632
|
+
target: "editing:tag",
|
|
633
|
+
actions: ["setEditedId", "focusEditedTagInput"]
|
|
634
|
+
},
|
|
635
|
+
ARROW_DOWN: { target: "focused:input" },
|
|
636
|
+
ESCAPE: { target: "focused:input" },
|
|
637
|
+
TYPE: {
|
|
638
|
+
target: "focused:input",
|
|
639
|
+
actions: ["setInputValue"]
|
|
640
|
+
},
|
|
641
|
+
BACKSPACE: [
|
|
642
|
+
{
|
|
643
|
+
guard: not("isCaretAtStart"),
|
|
644
|
+
target: "focused:input"
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
guard: "isFirstTagHighlighted",
|
|
648
|
+
actions: ["deleteHighlightedTag", "highlightFirstTag"]
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
guard: "hasHighlightedTag",
|
|
652
|
+
actions: ["deleteHighlightedTag", "highlightPrevTag"]
|
|
653
|
+
},
|
|
654
|
+
{ actions: ["highlightLastTag"] }
|
|
655
|
+
],
|
|
656
|
+
DELETE: [{
|
|
657
|
+
guard: not("isCaretAtStart"),
|
|
658
|
+
target: "focused:input"
|
|
659
|
+
}, {
|
|
660
|
+
target: "focused:input",
|
|
661
|
+
actions: ["deleteHighlightedTag", "highlightTagAtIndex"]
|
|
662
|
+
}],
|
|
663
|
+
PASTE: [{
|
|
664
|
+
guard: "addOnPaste",
|
|
665
|
+
target: "focused:input",
|
|
666
|
+
actions: ["setInputValue", "addTagFromPaste"]
|
|
667
|
+
}, {
|
|
668
|
+
target: "focused:input",
|
|
669
|
+
actions: ["setInputValue"]
|
|
670
|
+
}]
|
|
671
|
+
}
|
|
672
|
+
},
|
|
673
|
+
"editing:tag": {
|
|
674
|
+
tags: ["editing", "focused"],
|
|
675
|
+
entry: ["focusEditedTagInput"],
|
|
676
|
+
effects: ["autoResize"],
|
|
677
|
+
on: {
|
|
678
|
+
TAG_INPUT_TYPE: { actions: ["setEditedTagValue"] },
|
|
679
|
+
TAG_INPUT_ESCAPE: {
|
|
680
|
+
target: "navigating:tag",
|
|
681
|
+
actions: [
|
|
682
|
+
"clearEditedTagValue",
|
|
683
|
+
"focusInput",
|
|
684
|
+
"clearEditedId",
|
|
685
|
+
"highlightTagAtIndex"
|
|
686
|
+
]
|
|
687
|
+
},
|
|
688
|
+
TAG_INPUT_BLUR: [{
|
|
689
|
+
guard: "isInputRelatedTarget",
|
|
690
|
+
target: "navigating:tag",
|
|
691
|
+
actions: [
|
|
692
|
+
"clearEditedTagValue",
|
|
693
|
+
"clearHighlightedId",
|
|
694
|
+
"clearEditedId"
|
|
695
|
+
]
|
|
696
|
+
}, {
|
|
697
|
+
target: "idle",
|
|
698
|
+
actions: [
|
|
699
|
+
"clearEditedTagValue",
|
|
700
|
+
"clearHighlightedId",
|
|
701
|
+
"clearEditedId",
|
|
702
|
+
"raiseExternalBlurEvent"
|
|
703
|
+
]
|
|
704
|
+
}],
|
|
705
|
+
TAG_INPUT_ENTER: [{
|
|
706
|
+
guard: "isEditedTagEmpty",
|
|
707
|
+
target: "navigating:tag",
|
|
708
|
+
actions: [
|
|
709
|
+
"deleteHighlightedTag",
|
|
710
|
+
"focusInput",
|
|
711
|
+
"clearEditedId",
|
|
712
|
+
"highlightTagAtIndex"
|
|
713
|
+
]
|
|
714
|
+
}, {
|
|
715
|
+
target: "navigating:tag",
|
|
716
|
+
actions: [
|
|
717
|
+
"submitEditedTagValue",
|
|
718
|
+
"focusInput",
|
|
719
|
+
"clearEditedId",
|
|
720
|
+
"highlightTagAtIndex"
|
|
721
|
+
]
|
|
722
|
+
}]
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
},
|
|
726
|
+
implementations: {
|
|
727
|
+
guards: {
|
|
728
|
+
isInputRelatedTarget: ({ scope, event }) => event.relatedTarget === getInputEl(scope),
|
|
729
|
+
isAtMax: ({ computed }) => computed("isAtMax"),
|
|
730
|
+
hasHighlightedTag: ({ context }) => context.get("highlightedTagId") != null,
|
|
731
|
+
isFirstTagHighlighted: ({ context, scope }) => {
|
|
732
|
+
const value = context.get("value");
|
|
733
|
+
return getItemId(scope, {
|
|
734
|
+
value: value[0],
|
|
735
|
+
index: 0
|
|
736
|
+
}) === context.get("highlightedTagId");
|
|
737
|
+
},
|
|
738
|
+
isEditedTagEmpty: ({ context, prop }) => prop("sanitizeValue")(context.get("editedTagValue")) === "",
|
|
739
|
+
isLastTagHighlighted: ({ context, scope }) => {
|
|
740
|
+
const value = context.get("value");
|
|
741
|
+
const lastIndex = value.length - 1;
|
|
742
|
+
return getItemId(scope, {
|
|
743
|
+
value: value[lastIndex],
|
|
744
|
+
index: lastIndex
|
|
745
|
+
}) === context.get("highlightedTagId");
|
|
746
|
+
},
|
|
747
|
+
isInputValueEmpty: ({ context, prop }) => prop("sanitizeValue")(context.get("inputValue")).length === 0,
|
|
748
|
+
hasTags: ({ context }) => context.get("value").length > 0,
|
|
749
|
+
allowOverflow: ({ prop }) => !!prop("allowOverflow"),
|
|
750
|
+
autoFocus: ({ prop }) => !!prop("autoFocus"),
|
|
751
|
+
addOnBlur: ({ prop }) => prop("blurBehavior") === "add",
|
|
752
|
+
clearOnBlur: ({ prop }) => prop("blurBehavior") === "clear",
|
|
753
|
+
addOnPaste: ({ prop }) => !!prop("addOnPaste"),
|
|
754
|
+
isTagEditable: ({ prop }) => !!prop("editable"),
|
|
755
|
+
isCaretAtStart: ({ scope }) => require_caret.isCaretAtStart(getInputEl(scope))
|
|
756
|
+
},
|
|
757
|
+
effects: {
|
|
758
|
+
trackInteractOutside({ scope, prop, send }) {
|
|
759
|
+
return require_interact_outside.trackInteractOutside(getInputEl(scope), {
|
|
760
|
+
exclude(target) {
|
|
761
|
+
return getItemEls(scope).some((el) => require_dom_query.contains(el, target));
|
|
762
|
+
},
|
|
763
|
+
onFocusOutside: prop("onFocusOutside"),
|
|
764
|
+
onPointerDownOutside: prop("onPointerDownOutside"),
|
|
765
|
+
onInteractOutside(event) {
|
|
766
|
+
prop("onInteractOutside")?.(event);
|
|
767
|
+
if (event.defaultPrevented) return;
|
|
768
|
+
send({
|
|
769
|
+
type: "BLUR",
|
|
770
|
+
src: "interact-outside"
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
},
|
|
775
|
+
trackFormControlState({ context, send, scope }) {
|
|
776
|
+
return require_form.trackFormControl(getHiddenInputEl(scope), {
|
|
777
|
+
onFieldsetDisabledChange(disabled) {
|
|
778
|
+
context.set("fieldsetDisabled", disabled);
|
|
779
|
+
},
|
|
780
|
+
onFormReset() {
|
|
781
|
+
send({
|
|
782
|
+
type: "SET_VALUE",
|
|
783
|
+
value: context.initial("value"),
|
|
784
|
+
src: "form-reset"
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
},
|
|
789
|
+
autoResize({ context, prop, scope }) {
|
|
790
|
+
let fn_cleanup;
|
|
791
|
+
queueMicrotask(() => {
|
|
792
|
+
const editedTagValue = context.get("editedTagValue");
|
|
793
|
+
const editedTagIndex = context.get("editedTagIndex");
|
|
794
|
+
if (!editedTagValue || editedTagIndex == null || !prop("editable")) return;
|
|
795
|
+
fn_cleanup = require_auto_resize.autoResizeInput(getTagInputEl(scope, {
|
|
796
|
+
value: editedTagValue,
|
|
797
|
+
index: editedTagIndex
|
|
798
|
+
}));
|
|
799
|
+
});
|
|
800
|
+
return () => {
|
|
801
|
+
fn_cleanup?.();
|
|
802
|
+
};
|
|
803
|
+
},
|
|
804
|
+
trackLiveRegion({ scope, refs }) {
|
|
805
|
+
const liveRegion = require_live_region.createLiveRegion({
|
|
806
|
+
level: "assertive",
|
|
807
|
+
document: scope.getDoc()
|
|
808
|
+
});
|
|
809
|
+
refs.set("liveRegion", liveRegion);
|
|
810
|
+
return () => liveRegion.destroy();
|
|
811
|
+
}
|
|
812
|
+
},
|
|
813
|
+
actions: {
|
|
814
|
+
raiseInsertTagEvent({ send }) {
|
|
815
|
+
send({ type: "INSERT_TAG" });
|
|
816
|
+
},
|
|
817
|
+
raiseExternalBlurEvent({ send, event }) {
|
|
818
|
+
send({
|
|
819
|
+
type: "EXTERNAL_BLUR",
|
|
820
|
+
id: event.id
|
|
821
|
+
});
|
|
822
|
+
},
|
|
823
|
+
dispatchChangeEvent({ scope, computed }) {
|
|
824
|
+
queueMicrotask(() => {
|
|
825
|
+
dispatchInputEvent(scope, computed("valueAsString"));
|
|
826
|
+
});
|
|
827
|
+
},
|
|
828
|
+
highlightNextTag({ context, scope }) {
|
|
829
|
+
const highlightedTagId = context.get("highlightedTagId");
|
|
830
|
+
if (highlightedTagId == null) return;
|
|
831
|
+
const next = getNextEl(scope, highlightedTagId);
|
|
832
|
+
context.set("highlightedTagId", next?.id ?? null);
|
|
833
|
+
},
|
|
834
|
+
highlightFirstTag({ context, scope }) {
|
|
835
|
+
require_raf.raf(() => {
|
|
836
|
+
const first = getFirstEl(scope);
|
|
837
|
+
context.set("highlightedTagId", first?.id ?? null);
|
|
838
|
+
});
|
|
839
|
+
},
|
|
840
|
+
highlightLastTag({ context, scope }) {
|
|
841
|
+
const last = getLastEl(scope);
|
|
842
|
+
context.set("highlightedTagId", last?.id ?? null);
|
|
843
|
+
},
|
|
844
|
+
highlightPrevTag({ context, scope }) {
|
|
845
|
+
const highlightedTagId = context.get("highlightedTagId");
|
|
846
|
+
if (highlightedTagId == null) return;
|
|
847
|
+
const prev = getPrevEl(scope, highlightedTagId);
|
|
848
|
+
context.set("highlightedTagId", prev?.id ?? null);
|
|
849
|
+
},
|
|
850
|
+
highlightTag({ context, event }) {
|
|
851
|
+
context.set("highlightedTagId", event.id);
|
|
852
|
+
},
|
|
853
|
+
highlightTagAtIndex({ context, scope }) {
|
|
854
|
+
require_raf.raf(() => {
|
|
855
|
+
const idx = context.get("editedTagIndex");
|
|
856
|
+
if (idx == null) return;
|
|
857
|
+
const tagEl = getTagElAtIndex(scope, idx);
|
|
858
|
+
if (tagEl == null) return;
|
|
859
|
+
context.set("highlightedTagId", tagEl.id);
|
|
860
|
+
context.set("editedTagIndex", null);
|
|
861
|
+
});
|
|
862
|
+
},
|
|
863
|
+
deleteTag({ context, scope, event, refs }) {
|
|
864
|
+
const index = getIndexOfId(scope, event.id);
|
|
865
|
+
const value = context.get("value")[index];
|
|
866
|
+
const prevLog = refs.get("log");
|
|
867
|
+
refs.set("log", {
|
|
868
|
+
prev: prevLog.current,
|
|
869
|
+
current: {
|
|
870
|
+
type: "delete",
|
|
871
|
+
value
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
context.set("value", (prev) => require_array.removeAt(prev, index));
|
|
875
|
+
},
|
|
876
|
+
deleteHighlightedTag({ context, scope, refs }) {
|
|
877
|
+
const highlightedTagId = context.get("highlightedTagId");
|
|
878
|
+
if (highlightedTagId == null) return;
|
|
879
|
+
const index = getIndexOfId(scope, highlightedTagId);
|
|
880
|
+
context.set("editedTagIndex", index);
|
|
881
|
+
const value = context.get("value");
|
|
882
|
+
const prevLog = refs.get("log");
|
|
883
|
+
refs.set("log", {
|
|
884
|
+
prev: prevLog.current,
|
|
885
|
+
current: {
|
|
886
|
+
type: "delete",
|
|
887
|
+
value: value[index]
|
|
888
|
+
}
|
|
889
|
+
});
|
|
890
|
+
context.set("value", (prev) => require_array.removeAt(prev, index));
|
|
891
|
+
},
|
|
892
|
+
setEditedId({ context, event, scope }) {
|
|
893
|
+
const highlightedTagId = context.get("highlightedTagId");
|
|
894
|
+
const editedTagId = event.id ?? highlightedTagId;
|
|
895
|
+
context.set("editedTagId", editedTagId);
|
|
896
|
+
const index = getIndexOfId(scope, editedTagId);
|
|
897
|
+
const valueAtIndex = context.get("value")[index];
|
|
898
|
+
context.set("editedTagIndex", index);
|
|
899
|
+
context.set("editedTagValue", valueAtIndex);
|
|
900
|
+
},
|
|
901
|
+
clearEditedId({ context }) {
|
|
902
|
+
context.set("editedTagId", null);
|
|
903
|
+
},
|
|
904
|
+
clearEditedTagValue({ context }) {
|
|
905
|
+
context.set("editedTagValue", "");
|
|
906
|
+
},
|
|
907
|
+
setEditedTagValue({ context, event }) {
|
|
908
|
+
context.set("editedTagValue", event.value);
|
|
909
|
+
},
|
|
910
|
+
submitEditedTagValue({ context, scope, refs, prop }) {
|
|
911
|
+
const editedTagId = context.get("editedTagId");
|
|
912
|
+
if (!editedTagId) return;
|
|
913
|
+
const index = getIndexOfId(scope, editedTagId);
|
|
914
|
+
const editedTagValue = context.get("editedTagValue");
|
|
915
|
+
const value = context.get("value");
|
|
916
|
+
const hasDuplicate = value.some((item, idx) => idx !== index && item === editedTagValue);
|
|
917
|
+
if (!prop("allowDuplicates") && hasDuplicate) return;
|
|
918
|
+
if (value[index] === editedTagValue) return;
|
|
919
|
+
context.set("value", (prev) => {
|
|
920
|
+
const nextValue = prev.slice();
|
|
921
|
+
nextValue[index] = editedTagValue;
|
|
922
|
+
return nextValue;
|
|
923
|
+
});
|
|
924
|
+
const prevLog = refs.get("log");
|
|
925
|
+
refs.set("log", {
|
|
926
|
+
prev: prevLog.current,
|
|
927
|
+
current: {
|
|
928
|
+
type: "update",
|
|
929
|
+
value: editedTagValue
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
},
|
|
933
|
+
setValueAtIndex({ context, event, refs, prop }) {
|
|
934
|
+
if (event.value) {
|
|
935
|
+
const value = context.get("value");
|
|
936
|
+
const hasDuplicate = value.some((item, idx) => idx !== event.index && item === event.value);
|
|
937
|
+
if (!prop("allowDuplicates") && hasDuplicate) return;
|
|
938
|
+
if (value[event.index] === event.value) return;
|
|
939
|
+
context.set("value", (prev) => {
|
|
940
|
+
const nextValue = prev.slice();
|
|
941
|
+
nextValue[event.index] = event.value;
|
|
942
|
+
return nextValue;
|
|
943
|
+
});
|
|
944
|
+
const prevLog = refs.get("log");
|
|
945
|
+
refs.set("log", {
|
|
946
|
+
prev: prevLog.current,
|
|
947
|
+
current: {
|
|
948
|
+
type: "update",
|
|
949
|
+
value: event.value
|
|
950
|
+
}
|
|
951
|
+
});
|
|
952
|
+
} else require_warning.warn("You need to provide a value for the tag");
|
|
953
|
+
},
|
|
954
|
+
focusEditedTagInput({ context, scope }) {
|
|
955
|
+
require_raf.raf(() => {
|
|
956
|
+
const editedTagId = context.get("editedTagId");
|
|
957
|
+
if (!editedTagId) return;
|
|
958
|
+
getEditInputEl(scope, editedTagId)?.select();
|
|
959
|
+
});
|
|
960
|
+
},
|
|
961
|
+
setInputValue({ context, event }) {
|
|
962
|
+
context.set("inputValue", event.value);
|
|
963
|
+
},
|
|
964
|
+
clearHighlightedId({ context }) {
|
|
965
|
+
context.set("highlightedTagId", null);
|
|
966
|
+
},
|
|
967
|
+
focusInput({ scope }) {
|
|
968
|
+
require_raf.raf(() => {
|
|
969
|
+
getInputEl(scope)?.focus();
|
|
970
|
+
});
|
|
971
|
+
},
|
|
972
|
+
clearInputValue({ context }) {
|
|
973
|
+
require_raf.raf(() => {
|
|
974
|
+
context.set("inputValue", "");
|
|
975
|
+
});
|
|
976
|
+
},
|
|
977
|
+
syncInputValue({ context, scope }) {
|
|
978
|
+
const inputEl = getInputEl(scope);
|
|
979
|
+
if (!inputEl) return;
|
|
980
|
+
require_form.setElementValue(inputEl, context.get("inputValue"));
|
|
981
|
+
},
|
|
982
|
+
syncEditedTagInputValue({ context, event, scope }) {
|
|
983
|
+
const id = context.get("editedTagId") || context.get("highlightedTagId") || event.id;
|
|
984
|
+
if (id == null) return;
|
|
985
|
+
const editTagInputEl = getEditInputEl(scope, id);
|
|
986
|
+
if (!editTagInputEl) return;
|
|
987
|
+
require_form.setElementValue(editTagInputEl, context.get("editedTagValue"));
|
|
988
|
+
},
|
|
989
|
+
addTag({ context, event, computed, prop, refs }) {
|
|
990
|
+
const inputValue = event.value ?? computed("sanitizedInputValue");
|
|
991
|
+
const value = context.get("value");
|
|
992
|
+
if (prop("validate")?.({
|
|
993
|
+
inputValue,
|
|
994
|
+
value: Array.from(value)
|
|
995
|
+
})) {
|
|
996
|
+
const nextValue = prop("allowDuplicates") ? value.concat(inputValue) : require_array.uniq(value.concat(inputValue));
|
|
997
|
+
context.set("value", nextValue);
|
|
998
|
+
const prevLog = refs.get("log");
|
|
999
|
+
refs.set("log", {
|
|
1000
|
+
prev: prevLog.current,
|
|
1001
|
+
current: {
|
|
1002
|
+
type: "add",
|
|
1003
|
+
value: inputValue
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
} else prop("onValueInvalid")?.({ reason: "invalidTag" });
|
|
1007
|
+
},
|
|
1008
|
+
addTagFromPaste({ context, computed, prop, refs }) {
|
|
1009
|
+
require_raf.raf(() => {
|
|
1010
|
+
const inputValue = computed("sanitizedInputValue");
|
|
1011
|
+
const value = context.get("value");
|
|
1012
|
+
const sanitize = prop("sanitizeValue");
|
|
1013
|
+
if (prop("validate")?.({
|
|
1014
|
+
inputValue,
|
|
1015
|
+
value: Array.from(value)
|
|
1016
|
+
})) {
|
|
1017
|
+
const delimiter = prop("delimiter");
|
|
1018
|
+
const sanitizedValues = delimiter ? inputValue.split(delimiter).map(sanitize) : [inputValue];
|
|
1019
|
+
const nextValue = prop("allowDuplicates") ? value.concat(...sanitizedValues) : require_array.uniq(value.concat(...sanitizedValues));
|
|
1020
|
+
context.set("value", nextValue);
|
|
1021
|
+
const prevLog = refs.get("log");
|
|
1022
|
+
refs.set("log", {
|
|
1023
|
+
prev: prevLog.current,
|
|
1024
|
+
current: {
|
|
1025
|
+
type: "paste",
|
|
1026
|
+
values: sanitizedValues
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
1029
|
+
} else prop("onValueInvalid")?.({ reason: "invalidTag" });
|
|
1030
|
+
context.set("inputValue", "");
|
|
1031
|
+
});
|
|
1032
|
+
},
|
|
1033
|
+
clearTags({ context, refs }) {
|
|
1034
|
+
context.set("value", []);
|
|
1035
|
+
const prevLog = refs.get("log");
|
|
1036
|
+
refs.set("log", {
|
|
1037
|
+
prev: prevLog.current,
|
|
1038
|
+
current: { type: "clear" }
|
|
1039
|
+
});
|
|
1040
|
+
},
|
|
1041
|
+
setValue({ context, event }) {
|
|
1042
|
+
context.set("value", event.value);
|
|
1043
|
+
},
|
|
1044
|
+
invokeOnInvalid({ prop, computed }) {
|
|
1045
|
+
if (computed("isOverflowing")) prop("onValueInvalid")?.({ reason: "rangeOverflow" });
|
|
1046
|
+
},
|
|
1047
|
+
clearLog({ refs }) {
|
|
1048
|
+
const log = refs.get("log");
|
|
1049
|
+
log.prev = log.current = null;
|
|
1050
|
+
},
|
|
1051
|
+
logHighlightedTag({ refs, context, scope }) {
|
|
1052
|
+
const highlightedTagId = context.get("highlightedTagId");
|
|
1053
|
+
const log = refs.get("log");
|
|
1054
|
+
if (highlightedTagId == null || !log.current) return;
|
|
1055
|
+
const index = getIndexOfId(scope, highlightedTagId);
|
|
1056
|
+
const value = context.get("value")[index];
|
|
1057
|
+
const prevLog = refs.get("log");
|
|
1058
|
+
refs.set("log", {
|
|
1059
|
+
prev: prevLog.current,
|
|
1060
|
+
current: {
|
|
1061
|
+
type: "select",
|
|
1062
|
+
value
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
},
|
|
1066
|
+
announceLog({ refs, prop }) {
|
|
1067
|
+
const liveRegion = refs.get("liveRegion");
|
|
1068
|
+
const translations = prop("translations");
|
|
1069
|
+
const log = refs.get("log");
|
|
1070
|
+
if (!log.current || liveRegion == null) return;
|
|
1071
|
+
const region = liveRegion;
|
|
1072
|
+
const { current, prev } = log;
|
|
1073
|
+
let msg;
|
|
1074
|
+
switch (current.type) {
|
|
1075
|
+
case "add":
|
|
1076
|
+
msg = translations.tagAdded(current.value);
|
|
1077
|
+
break;
|
|
1078
|
+
case "delete":
|
|
1079
|
+
msg = translations.tagDeleted(current.value);
|
|
1080
|
+
break;
|
|
1081
|
+
case "update":
|
|
1082
|
+
msg = translations.tagUpdated(current.value);
|
|
1083
|
+
break;
|
|
1084
|
+
case "paste":
|
|
1085
|
+
msg = translations.tagsPasted(current.values);
|
|
1086
|
+
break;
|
|
1087
|
+
case "select":
|
|
1088
|
+
msg = translations.tagSelected(current.value);
|
|
1089
|
+
if (prev?.type === "delete") msg = `${translations.tagDeleted(prev.value)}. ${msg}`;
|
|
1090
|
+
else if (prev?.type === "update") msg = `${translations.tagUpdated(prev.value)}. ${msg}`;
|
|
1091
|
+
break;
|
|
1092
|
+
default: break;
|
|
1093
|
+
}
|
|
1094
|
+
if (msg) region.announce(msg);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
});
|
|
1099
|
+
//#endregion
|
|
1100
|
+
//#region src/machines/tags-input/props.ts
|
|
1101
|
+
const props = require_create_props.createProps()([
|
|
1102
|
+
"addOnPaste",
|
|
1103
|
+
"allowDuplicates",
|
|
1104
|
+
"allowOverflow",
|
|
1105
|
+
"autoFocus",
|
|
1106
|
+
"blurBehavior",
|
|
1107
|
+
"delimiter",
|
|
1108
|
+
"dir",
|
|
1109
|
+
"disabled",
|
|
1110
|
+
"editable",
|
|
1111
|
+
"form",
|
|
1112
|
+
"getRootNode",
|
|
1113
|
+
"id",
|
|
1114
|
+
"ids",
|
|
1115
|
+
"inputValue",
|
|
1116
|
+
"invalid",
|
|
1117
|
+
"max",
|
|
1118
|
+
"maxLength",
|
|
1119
|
+
"name",
|
|
1120
|
+
"onFocusOutside",
|
|
1121
|
+
"onHighlightChange",
|
|
1122
|
+
"onInputValueChange",
|
|
1123
|
+
"onInteractOutside",
|
|
1124
|
+
"onPointerDownOutside",
|
|
1125
|
+
"onValueChange",
|
|
1126
|
+
"onValueInvalid",
|
|
1127
|
+
"placeholder",
|
|
1128
|
+
"required",
|
|
1129
|
+
"readOnly",
|
|
1130
|
+
"sanitizeValue",
|
|
1131
|
+
"translations",
|
|
1132
|
+
"validate",
|
|
1133
|
+
"value",
|
|
1134
|
+
"defaultValue",
|
|
1135
|
+
"defaultInputValue"
|
|
1136
|
+
]);
|
|
1137
|
+
const splitProps = require_utils.createSplitProps(props);
|
|
1138
|
+
const itemProps = require_create_props.createProps()([
|
|
1139
|
+
"index",
|
|
1140
|
+
"disabled",
|
|
1141
|
+
"value"
|
|
1142
|
+
]);
|
|
1143
|
+
const splitItemProps = require_utils.createSplitProps(itemProps);
|
|
1144
|
+
//#endregion
|
|
1145
|
+
exports.anatomy = anatomy;
|
|
1146
|
+
exports.connect = connect;
|
|
1147
|
+
exports.itemProps = itemProps;
|
|
1148
|
+
exports.machine = machine;
|
|
1149
|
+
exports.props = props;
|
|
1150
|
+
exports.splitItemProps = splitItemProps;
|
|
1151
|
+
exports.splitProps = splitProps;
|