@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,1103 @@
|
|
|
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_pointer_move = require("../../pointer-move-CGzan38r.cjs");
|
|
8
|
+
const require_array = require("../../array-BGtygd0o.cjs");
|
|
9
|
+
const require_equal = require("../../equal-C927y7MN.cjs");
|
|
10
|
+
const require_utils = require("../../utils-BH-oBBz2.cjs");
|
|
11
|
+
const require_core = require("../../core-BNMw-JId.cjs");
|
|
12
|
+
const require_create_props = require("../../create-props-CjLx2oS8.cjs");
|
|
13
|
+
//#region src/machines/slider/anatomy.ts
|
|
14
|
+
const anatomy = require_create_anatomy.createAnatomy("slider").parts("root", "label", "thumb", "valueText", "track", "range", "control", "markerGroup", "marker", "draggingIndicator");
|
|
15
|
+
const parts = anatomy.build();
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/machines/slider/dom.ts
|
|
18
|
+
const getRootId = (ctx) => ctx.ids?.root ?? `slider:${ctx.id}`;
|
|
19
|
+
const getThumbId = (ctx, index) => ctx.ids?.thumb?.(index) ?? `slider:${ctx.id}:thumb:${index}`;
|
|
20
|
+
const getHiddenInputId = (ctx, index) => ctx.ids?.hiddenInput?.(index) ?? `slider:${ctx.id}:input:${index}`;
|
|
21
|
+
const getControlId = (ctx) => ctx.ids?.control ?? `slider:${ctx.id}:control`;
|
|
22
|
+
const getTrackId = (ctx) => ctx.ids?.track ?? `slider:${ctx.id}:track`;
|
|
23
|
+
const getRangeId = (ctx) => ctx.ids?.range ?? `slider:${ctx.id}:range`;
|
|
24
|
+
const getLabelId = (ctx) => ctx.ids?.label ?? `slider:${ctx.id}:label`;
|
|
25
|
+
const getValueTextId = (ctx) => ctx.ids?.valueText ?? `slider:${ctx.id}:value-text`;
|
|
26
|
+
const getMarkerId = (ctx, value) => ctx.ids?.marker?.(value) ?? `slider:${ctx.id}:marker:${value}`;
|
|
27
|
+
const getRootEl = (ctx) => ctx.getById(getRootId(ctx));
|
|
28
|
+
const getThumbEl = (ctx, index) => ctx.getById(getThumbId(ctx, index));
|
|
29
|
+
const getThumbEls = (ctx) => require_dom_query.queryAll(getControlEl(ctx), "[role=slider]");
|
|
30
|
+
const getFirstThumbEl = (ctx) => getThumbEls(ctx)[0];
|
|
31
|
+
const getHiddenInputEl = (ctx, index) => ctx.getById(getHiddenInputId(ctx, index));
|
|
32
|
+
const getControlEl = (ctx) => ctx.getById(getControlId(ctx));
|
|
33
|
+
const getThumbInset = (thumbSize, thumbAlignment, orientation) => {
|
|
34
|
+
return thumbAlignment === "contain" ? (orientation === "vertical" ? thumbSize?.height ?? 0 : thumbSize?.width ?? 0) / 2 : 0;
|
|
35
|
+
};
|
|
36
|
+
const getPointValue = (params, point) => {
|
|
37
|
+
const { context, prop, scope, refs } = params;
|
|
38
|
+
const controlEl = getControlEl(scope);
|
|
39
|
+
if (!controlEl) return;
|
|
40
|
+
const offset = refs.get("thumbDragOffset");
|
|
41
|
+
return require_utils.getPercentValue(getRelativePointWithInset({
|
|
42
|
+
x: point.x - (offset?.x ?? 0),
|
|
43
|
+
y: point.y - (offset?.y ?? 0)
|
|
44
|
+
}, controlEl, getThumbInset(context.get("thumbSize"), prop("thumbAlignment"), prop("orientation"))).getPercentValue({
|
|
45
|
+
orientation: prop("orientation"),
|
|
46
|
+
dir: prop("dir"),
|
|
47
|
+
inverted: { y: true }
|
|
48
|
+
}), prop("min"), prop("max"), prop("step"));
|
|
49
|
+
};
|
|
50
|
+
function getRelativePointWithInset(point, element, inset) {
|
|
51
|
+
const { left, top, width, height } = element.getBoundingClientRect();
|
|
52
|
+
const effectiveWidth = width - inset * 2;
|
|
53
|
+
const effectiveHeight = height - inset * 2;
|
|
54
|
+
const effectiveLeft = left + inset;
|
|
55
|
+
const effectiveTop = top + inset;
|
|
56
|
+
const offset = {
|
|
57
|
+
x: point.x - effectiveLeft,
|
|
58
|
+
y: point.y - effectiveTop
|
|
59
|
+
};
|
|
60
|
+
const percent = {
|
|
61
|
+
x: effectiveWidth > 0 ? require_utils.clampPercent(offset.x / effectiveWidth) : 0,
|
|
62
|
+
y: effectiveHeight > 0 ? require_utils.clampPercent(offset.y / effectiveHeight) : 0
|
|
63
|
+
};
|
|
64
|
+
function getPercentValue(options = {}) {
|
|
65
|
+
const { dir = "ltr", orientation = "horizontal", inverted } = options;
|
|
66
|
+
const invertX = typeof inverted === "object" ? inverted.x : inverted;
|
|
67
|
+
const invertY = typeof inverted === "object" ? inverted.y : inverted;
|
|
68
|
+
if (orientation === "horizontal") return dir === "rtl" || invertX ? 1 - percent.x : percent.x;
|
|
69
|
+
return invertY ? 1 - percent.y : percent.y;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
offset,
|
|
73
|
+
percent,
|
|
74
|
+
getPercentValue
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const dispatchChangeEvent = (ctx, value) => {
|
|
78
|
+
value.forEach((value, index) => {
|
|
79
|
+
const inputEl = getHiddenInputEl(ctx, index);
|
|
80
|
+
if (!inputEl) return;
|
|
81
|
+
require_form.dispatchInputValueEvent(inputEl, { value });
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
const getOffsetRect = (el) => ({
|
|
85
|
+
left: el?.offsetLeft ?? 0,
|
|
86
|
+
top: el?.offsetTop ?? 0,
|
|
87
|
+
width: el?.offsetWidth ?? 0,
|
|
88
|
+
height: el?.offsetHeight ?? 0
|
|
89
|
+
});
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/machines/slider/style.ts
|
|
92
|
+
function getBounds(value) {
|
|
93
|
+
return [value[0], value[value.length - 1]];
|
|
94
|
+
}
|
|
95
|
+
function getRangeOffsets(params) {
|
|
96
|
+
const { prop, computed } = params;
|
|
97
|
+
const valuePercent = computed("valuePercent");
|
|
98
|
+
const [firstPercent, lastPercent] = getBounds(valuePercent);
|
|
99
|
+
if (valuePercent.length === 1) {
|
|
100
|
+
if (prop("origin") === "center") {
|
|
101
|
+
const isNegative = valuePercent[0] < 50;
|
|
102
|
+
return {
|
|
103
|
+
start: isNegative ? `${valuePercent[0]}%` : "50%",
|
|
104
|
+
end: isNegative ? "50%" : `${100 - valuePercent[0]}%`
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (prop("origin") === "end") return {
|
|
108
|
+
start: `${lastPercent}%`,
|
|
109
|
+
end: "0%"
|
|
110
|
+
};
|
|
111
|
+
return {
|
|
112
|
+
start: "0%",
|
|
113
|
+
end: `${100 - lastPercent}%`
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
start: `${firstPercent}%`,
|
|
118
|
+
end: `${100 - lastPercent}%`
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function getRangeStyle(params) {
|
|
122
|
+
const { computed } = params;
|
|
123
|
+
const isVertical = computed("isVertical");
|
|
124
|
+
const isRtl = computed("isRtl");
|
|
125
|
+
if (isVertical) return {
|
|
126
|
+
position: "absolute",
|
|
127
|
+
bottom: "var(--slider-range-start)",
|
|
128
|
+
top: "var(--slider-range-end)"
|
|
129
|
+
};
|
|
130
|
+
return {
|
|
131
|
+
position: "absolute",
|
|
132
|
+
[isRtl ? "right" : "left"]: "var(--slider-range-start)",
|
|
133
|
+
[isRtl ? "left" : "right"]: "var(--slider-range-end)"
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function getVerticalThumbOffset(params, value) {
|
|
137
|
+
const { context, prop } = params;
|
|
138
|
+
const { height = 0 } = context.get("thumbSize") ?? {};
|
|
139
|
+
const getValue = require_utils.getValueTransformer([prop("min"), prop("max")], [-height / 2, height / 2]);
|
|
140
|
+
return parseFloat(getValue(value).toFixed(2));
|
|
141
|
+
}
|
|
142
|
+
function getHorizontalThumbOffset(params, value) {
|
|
143
|
+
const { computed, context, prop } = params;
|
|
144
|
+
const { width = 0 } = context.get("thumbSize") ?? {};
|
|
145
|
+
if (computed("isRtl")) {
|
|
146
|
+
const getValue = require_utils.getValueTransformer([prop("max"), prop("min")], [-width / 2, width / 2]);
|
|
147
|
+
return -1 * parseFloat(getValue(value).toFixed(2));
|
|
148
|
+
}
|
|
149
|
+
const getValue = require_utils.getValueTransformer([prop("min"), prop("max")], [-width / 2, width / 2]);
|
|
150
|
+
return parseFloat(getValue(value).toFixed(2));
|
|
151
|
+
}
|
|
152
|
+
function getOffset(params, percent, value) {
|
|
153
|
+
const { computed, prop } = params;
|
|
154
|
+
if (prop("thumbAlignment") === "center") return `${percent}%`;
|
|
155
|
+
return `calc(${percent}% - ${computed("isVertical") ? getVerticalThumbOffset(params, value) : getHorizontalThumbOffset(params, value)}px)`;
|
|
156
|
+
}
|
|
157
|
+
function getThumbOffset(params, value) {
|
|
158
|
+
const { prop } = params;
|
|
159
|
+
return getOffset(params, require_utils.getValuePercent(value, prop("min"), prop("max")) * 100, value);
|
|
160
|
+
}
|
|
161
|
+
function getVisibility(params) {
|
|
162
|
+
const { computed, prop } = params;
|
|
163
|
+
let visibility = "visible";
|
|
164
|
+
if (prop("thumbAlignment") === "contain" && !computed("hasMeasuredThumbSize")) visibility = "hidden";
|
|
165
|
+
return visibility;
|
|
166
|
+
}
|
|
167
|
+
function getThumbStyle(params, index) {
|
|
168
|
+
const { computed, context } = params;
|
|
169
|
+
const placementProp = computed("isVertical") ? "bottom" : "insetInlineStart";
|
|
170
|
+
const focusedIndex = context.get("focusedIndex");
|
|
171
|
+
return {
|
|
172
|
+
visibility: getVisibility(params),
|
|
173
|
+
position: "absolute",
|
|
174
|
+
transform: "var(--slider-thumb-transform)",
|
|
175
|
+
[placementProp]: `var(--slider-thumb-offset-${index})`,
|
|
176
|
+
zIndex: focusedIndex === index ? 1 : void 0
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function getControlStyle() {
|
|
180
|
+
return {
|
|
181
|
+
touchAction: "none",
|
|
182
|
+
userSelect: "none",
|
|
183
|
+
WebkitUserSelect: "none",
|
|
184
|
+
position: "relative"
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function getRootStyle(params) {
|
|
188
|
+
const { context, computed } = params;
|
|
189
|
+
const isVertical = computed("isVertical");
|
|
190
|
+
const isRtl = computed("isRtl");
|
|
191
|
+
const range = getRangeOffsets(params);
|
|
192
|
+
const thumbSize = context.get("thumbSize");
|
|
193
|
+
return {
|
|
194
|
+
...context.get("value").reduce((styles, value, index) => {
|
|
195
|
+
const offset = getThumbOffset(params, value);
|
|
196
|
+
return {
|
|
197
|
+
...styles,
|
|
198
|
+
[`--slider-thumb-offset-${index}`]: offset
|
|
199
|
+
};
|
|
200
|
+
}, {}),
|
|
201
|
+
"--slider-thumb-width": require_utils.toPx(thumbSize?.width),
|
|
202
|
+
"--slider-thumb-height": require_utils.toPx(thumbSize?.height),
|
|
203
|
+
"--slider-thumb-transform": isVertical ? "translateY(50%)" : isRtl ? "translateX(50%)" : "translateX(-50%)",
|
|
204
|
+
"--slider-range-start": range.start,
|
|
205
|
+
"--slider-range-end": range.end
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function getMarkerStyle(params, value) {
|
|
209
|
+
const { computed } = params;
|
|
210
|
+
const isHorizontal = computed("isHorizontal");
|
|
211
|
+
const isRtl = computed("isRtl");
|
|
212
|
+
return {
|
|
213
|
+
visibility: getVisibility(params),
|
|
214
|
+
position: "absolute",
|
|
215
|
+
pointerEvents: "none",
|
|
216
|
+
[isHorizontal ? "insetInlineStart" : "bottom"]: getThumbOffset(params, value),
|
|
217
|
+
translate: "var(--translate-x) var(--translate-y)",
|
|
218
|
+
"--translate-x": isHorizontal ? isRtl ? "50%" : "-50%" : "0%",
|
|
219
|
+
"--translate-y": !isHorizontal ? "50%" : "0%"
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function getMarkerGroupStyle() {
|
|
223
|
+
return {
|
|
224
|
+
userSelect: "none",
|
|
225
|
+
WebkitUserSelect: "none",
|
|
226
|
+
pointerEvents: "none",
|
|
227
|
+
position: "relative"
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/machines/slider/utils.ts
|
|
232
|
+
function getThumbBounds(ctx) {
|
|
233
|
+
const { index, values, min, max, gap } = ctx;
|
|
234
|
+
const prevThumb = values[index - 1];
|
|
235
|
+
const nextThumb = values[index + 1];
|
|
236
|
+
return {
|
|
237
|
+
min: prevThumb != null ? prevThumb + gap : min,
|
|
238
|
+
max: nextThumb != null ? nextThumb - gap : max
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function round(value) {
|
|
242
|
+
return Math.round(value * 1e10) / 1e10;
|
|
243
|
+
}
|
|
244
|
+
function handleNone(ctx) {
|
|
245
|
+
const { index, value, values } = ctx;
|
|
246
|
+
const bounds = getThumbBounds(ctx);
|
|
247
|
+
const nextValues = values.slice();
|
|
248
|
+
nextValues[index] = round(require_utils.clampValue(value, bounds.min, bounds.max));
|
|
249
|
+
return {
|
|
250
|
+
values: nextValues,
|
|
251
|
+
index,
|
|
252
|
+
swapped: false
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function handlePush(ctx) {
|
|
256
|
+
const { index, value, values, min, max, gap } = ctx;
|
|
257
|
+
const nextValues = values.slice();
|
|
258
|
+
nextValues[index] = round(require_utils.clampValue(value, min + index * gap, max - (values.length - 1 - index) * gap));
|
|
259
|
+
for (let i = index + 1; i < values.length; i++) {
|
|
260
|
+
const minAllowed = nextValues[i - 1] + gap;
|
|
261
|
+
if (nextValues[i] < minAllowed) nextValues[i] = round(minAllowed);
|
|
262
|
+
}
|
|
263
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
264
|
+
const maxAllowed = nextValues[i + 1] - gap;
|
|
265
|
+
if (nextValues[i] > maxAllowed) nextValues[i] = round(maxAllowed);
|
|
266
|
+
}
|
|
267
|
+
return {
|
|
268
|
+
values: nextValues,
|
|
269
|
+
index,
|
|
270
|
+
swapped: false
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function handleSwap(ctx, startValue) {
|
|
274
|
+
const { index, value, values, gap } = ctx;
|
|
275
|
+
const prevThumb = values[index - 1];
|
|
276
|
+
const nextThumb = values[index + 1];
|
|
277
|
+
const crossingNext = nextThumb != null && value >= nextThumb && value > startValue;
|
|
278
|
+
const crossingPrev = prevThumb != null && value <= prevThumb && value < startValue;
|
|
279
|
+
if (!crossingNext && !crossingPrev) return handleNone(ctx);
|
|
280
|
+
const swapIndex = crossingNext ? index + 1 : index - 1;
|
|
281
|
+
const nextValues = values.slice();
|
|
282
|
+
const bounds = getThumbBounds({
|
|
283
|
+
...ctx,
|
|
284
|
+
index: swapIndex
|
|
285
|
+
});
|
|
286
|
+
nextValues[swapIndex] = round(require_utils.clampValue(value, bounds.min, bounds.max));
|
|
287
|
+
nextValues[index] = values[swapIndex];
|
|
288
|
+
if (crossingNext && nextValues[index] > nextValues[swapIndex] - gap) nextValues[index] = round(nextValues[swapIndex] - gap);
|
|
289
|
+
else if (crossingPrev && nextValues[index] < nextValues[swapIndex] + gap) nextValues[index] = round(nextValues[swapIndex] + gap);
|
|
290
|
+
return {
|
|
291
|
+
values: nextValues,
|
|
292
|
+
index: swapIndex,
|
|
293
|
+
swapped: true
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
function resolveThumbCollision(behavior, index, value, values, min, max, step, minStepsBetweenThumbs, startValue) {
|
|
297
|
+
if (values.length === 1) return {
|
|
298
|
+
values: [round(require_utils.clampValue(value, min, max))],
|
|
299
|
+
index: 0,
|
|
300
|
+
swapped: false
|
|
301
|
+
};
|
|
302
|
+
const ctx = {
|
|
303
|
+
behavior,
|
|
304
|
+
index,
|
|
305
|
+
value,
|
|
306
|
+
values,
|
|
307
|
+
min,
|
|
308
|
+
max,
|
|
309
|
+
gap: step * minStepsBetweenThumbs
|
|
310
|
+
};
|
|
311
|
+
switch (behavior) {
|
|
312
|
+
case "push": return handlePush(ctx);
|
|
313
|
+
case "swap": return handleSwap(ctx, startValue ?? values[index]);
|
|
314
|
+
default: return handleNone(ctx);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
function normalizeValues(params, nextValues) {
|
|
318
|
+
return nextValues.map((value, index) => {
|
|
319
|
+
return constrainValue(params, value, index);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
function getRangeAtIndex(params, index) {
|
|
323
|
+
const { context, prop } = params;
|
|
324
|
+
const step = prop("step") * prop("minStepsBetweenThumbs");
|
|
325
|
+
return require_utils.getValueRanges(context.get("value"), prop("min"), prop("max"), step)[index];
|
|
326
|
+
}
|
|
327
|
+
function constrainValue(params, value, index) {
|
|
328
|
+
const { prop } = params;
|
|
329
|
+
const range = getRangeAtIndex(params, index);
|
|
330
|
+
return require_utils.clampValue(require_utils.snapValueToStep(value, prop("min"), prop("max"), prop("step")), range.min, range.max);
|
|
331
|
+
}
|
|
332
|
+
function decrement(params, index, step) {
|
|
333
|
+
const { context, prop } = params;
|
|
334
|
+
const idx = index ?? context.get("focusedIndex");
|
|
335
|
+
const range = getRangeAtIndex(params, idx);
|
|
336
|
+
const nextValues = require_utils.getPreviousStepValue(idx, {
|
|
337
|
+
...range,
|
|
338
|
+
step: step ?? prop("step"),
|
|
339
|
+
values: context.get("value")
|
|
340
|
+
});
|
|
341
|
+
nextValues[idx] = require_utils.clampValue(nextValues[idx], range.min, range.max);
|
|
342
|
+
return nextValues;
|
|
343
|
+
}
|
|
344
|
+
function increment(params, index, step) {
|
|
345
|
+
const { context, prop } = params;
|
|
346
|
+
const idx = index ?? context.get("focusedIndex");
|
|
347
|
+
const range = getRangeAtIndex(params, idx);
|
|
348
|
+
const nextValues = require_utils.getNextStepValue(idx, {
|
|
349
|
+
...range,
|
|
350
|
+
step: step ?? prop("step"),
|
|
351
|
+
values: context.get("value")
|
|
352
|
+
});
|
|
353
|
+
nextValues[idx] = require_utils.clampValue(nextValues[idx], range.min, range.max);
|
|
354
|
+
return nextValues;
|
|
355
|
+
}
|
|
356
|
+
function getClosestIndex(params, pointValue) {
|
|
357
|
+
const { context } = params;
|
|
358
|
+
const values = context.get("value");
|
|
359
|
+
let closestIndex = 0;
|
|
360
|
+
let minDistance = Math.abs(values[0] - pointValue);
|
|
361
|
+
for (let i = 1; i < values.length; i++) {
|
|
362
|
+
const distance = Math.abs(values[i] - pointValue);
|
|
363
|
+
if (distance <= minDistance) {
|
|
364
|
+
closestIndex = i;
|
|
365
|
+
minDistance = distance;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return selectMovableThumb(params, closestIndex);
|
|
369
|
+
}
|
|
370
|
+
function selectMovableThumb(params, index) {
|
|
371
|
+
const { context, prop } = params;
|
|
372
|
+
const values = context.get("value");
|
|
373
|
+
const max = prop("max");
|
|
374
|
+
if (values[index] === max) {
|
|
375
|
+
let movableIndex = index;
|
|
376
|
+
while (movableIndex > 0 && values[movableIndex - 1] === max) movableIndex -= 1;
|
|
377
|
+
return movableIndex;
|
|
378
|
+
}
|
|
379
|
+
return index;
|
|
380
|
+
}
|
|
381
|
+
//#endregion
|
|
382
|
+
//#region src/machines/slider/connect.ts
|
|
383
|
+
function connect(service, normalize) {
|
|
384
|
+
const { state, send, context, prop, computed, scope } = service;
|
|
385
|
+
const ariaLabel = prop("aria-label");
|
|
386
|
+
const ariaLabelledBy = prop("aria-labelledby");
|
|
387
|
+
const sliderValue = context.get("value");
|
|
388
|
+
const focusedIndex = context.get("focusedIndex");
|
|
389
|
+
const focused = state.matches("focus");
|
|
390
|
+
const dragging = state.matches("dragging");
|
|
391
|
+
const disabled = computed("isDisabled");
|
|
392
|
+
const invalid = prop("invalid");
|
|
393
|
+
const interactive = computed("isInteractive");
|
|
394
|
+
const isHorizontal = prop("orientation") === "horizontal";
|
|
395
|
+
const isVertical = prop("orientation") === "vertical";
|
|
396
|
+
function getValuePercentFn(value) {
|
|
397
|
+
return require_utils.getValuePercent(value, prop("min"), prop("max"));
|
|
398
|
+
}
|
|
399
|
+
function getPercentValueFn(percent) {
|
|
400
|
+
return require_utils.getPercentValue(percent, prop("min"), prop("max"), prop("step"));
|
|
401
|
+
}
|
|
402
|
+
return {
|
|
403
|
+
value: sliderValue,
|
|
404
|
+
dragging,
|
|
405
|
+
focused,
|
|
406
|
+
setValue(value) {
|
|
407
|
+
send({
|
|
408
|
+
type: "SET_VALUE",
|
|
409
|
+
value
|
|
410
|
+
});
|
|
411
|
+
},
|
|
412
|
+
getThumbValue(index) {
|
|
413
|
+
return sliderValue[index];
|
|
414
|
+
},
|
|
415
|
+
setThumbValue(index, value) {
|
|
416
|
+
send({
|
|
417
|
+
type: "SET_VALUE",
|
|
418
|
+
index,
|
|
419
|
+
value
|
|
420
|
+
});
|
|
421
|
+
},
|
|
422
|
+
getValuePercent: getValuePercentFn,
|
|
423
|
+
getPercentValue: getPercentValueFn,
|
|
424
|
+
getThumbPercent(index) {
|
|
425
|
+
return getValuePercentFn(sliderValue[index]);
|
|
426
|
+
},
|
|
427
|
+
setThumbPercent(index, percent) {
|
|
428
|
+
const value = getPercentValueFn(percent);
|
|
429
|
+
send({
|
|
430
|
+
type: "SET_VALUE",
|
|
431
|
+
index,
|
|
432
|
+
value
|
|
433
|
+
});
|
|
434
|
+
},
|
|
435
|
+
getThumbMin(index) {
|
|
436
|
+
return getRangeAtIndex(service, index).min;
|
|
437
|
+
},
|
|
438
|
+
getThumbMax(index) {
|
|
439
|
+
return getRangeAtIndex(service, index).max;
|
|
440
|
+
},
|
|
441
|
+
increment(index) {
|
|
442
|
+
send({
|
|
443
|
+
type: "INCREMENT",
|
|
444
|
+
index
|
|
445
|
+
});
|
|
446
|
+
},
|
|
447
|
+
decrement(index) {
|
|
448
|
+
send({
|
|
449
|
+
type: "DECREMENT",
|
|
450
|
+
index
|
|
451
|
+
});
|
|
452
|
+
},
|
|
453
|
+
focus() {
|
|
454
|
+
if (!interactive) return;
|
|
455
|
+
send({
|
|
456
|
+
type: "FOCUS",
|
|
457
|
+
index: 0
|
|
458
|
+
});
|
|
459
|
+
},
|
|
460
|
+
getLabelProps() {
|
|
461
|
+
return normalize.label({
|
|
462
|
+
...parts.label.attrs,
|
|
463
|
+
dir: prop("dir"),
|
|
464
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
465
|
+
"data-orientation": prop("orientation"),
|
|
466
|
+
"data-invalid": require_dom_query.dataAttr(invalid),
|
|
467
|
+
"data-dragging": require_dom_query.dataAttr(dragging),
|
|
468
|
+
"data-focus": require_dom_query.dataAttr(focused),
|
|
469
|
+
id: getLabelId(scope),
|
|
470
|
+
htmlFor: getHiddenInputId(scope, 0),
|
|
471
|
+
onClick(event) {
|
|
472
|
+
if (!interactive) return;
|
|
473
|
+
event.preventDefault();
|
|
474
|
+
getFirstThumbEl(scope)?.focus();
|
|
475
|
+
},
|
|
476
|
+
style: {
|
|
477
|
+
userSelect: "none",
|
|
478
|
+
WebkitUserSelect: "none"
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
},
|
|
482
|
+
getRootProps() {
|
|
483
|
+
return normalize.element({
|
|
484
|
+
...parts.root.attrs,
|
|
485
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
486
|
+
"data-orientation": prop("orientation"),
|
|
487
|
+
"data-dragging": require_dom_query.dataAttr(dragging),
|
|
488
|
+
"data-invalid": require_dom_query.dataAttr(invalid),
|
|
489
|
+
"data-focus": require_dom_query.dataAttr(focused),
|
|
490
|
+
id: getRootId(scope),
|
|
491
|
+
dir: prop("dir"),
|
|
492
|
+
style: getRootStyle(service)
|
|
493
|
+
});
|
|
494
|
+
},
|
|
495
|
+
getValueTextProps() {
|
|
496
|
+
return normalize.element({
|
|
497
|
+
...parts.valueText.attrs,
|
|
498
|
+
dir: prop("dir"),
|
|
499
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
500
|
+
"data-orientation": prop("orientation"),
|
|
501
|
+
"data-invalid": require_dom_query.dataAttr(invalid),
|
|
502
|
+
"data-focus": require_dom_query.dataAttr(focused),
|
|
503
|
+
id: getValueTextId(scope)
|
|
504
|
+
});
|
|
505
|
+
},
|
|
506
|
+
getTrackProps() {
|
|
507
|
+
return normalize.element({
|
|
508
|
+
...parts.track.attrs,
|
|
509
|
+
dir: prop("dir"),
|
|
510
|
+
id: getTrackId(scope),
|
|
511
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
512
|
+
"data-invalid": require_dom_query.dataAttr(invalid),
|
|
513
|
+
"data-dragging": require_dom_query.dataAttr(dragging),
|
|
514
|
+
"data-orientation": prop("orientation"),
|
|
515
|
+
"data-focus": require_dom_query.dataAttr(focused),
|
|
516
|
+
style: { position: "relative" }
|
|
517
|
+
});
|
|
518
|
+
},
|
|
519
|
+
getThumbProps(props) {
|
|
520
|
+
const { index = 0, name } = props;
|
|
521
|
+
const value = sliderValue[index];
|
|
522
|
+
const range = getRangeAtIndex(service, index);
|
|
523
|
+
const valueText = prop("getAriaValueText")?.({
|
|
524
|
+
value,
|
|
525
|
+
index
|
|
526
|
+
});
|
|
527
|
+
const _ariaLabel = Array.isArray(ariaLabel) ? ariaLabel[index] : ariaLabel;
|
|
528
|
+
const _ariaLabelledBy = Array.isArray(ariaLabelledBy) ? ariaLabelledBy[index] : ariaLabelledBy;
|
|
529
|
+
return normalize.element({
|
|
530
|
+
...parts.thumb.attrs,
|
|
531
|
+
dir: prop("dir"),
|
|
532
|
+
"data-index": index,
|
|
533
|
+
"data-name": name,
|
|
534
|
+
id: getThumbId(scope, index),
|
|
535
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
536
|
+
"data-orientation": prop("orientation"),
|
|
537
|
+
"data-focus": require_dom_query.dataAttr(focused && focusedIndex === index),
|
|
538
|
+
"data-dragging": require_dom_query.dataAttr(dragging && focusedIndex === index),
|
|
539
|
+
draggable: false,
|
|
540
|
+
"aria-disabled": require_dom_query.ariaAttr(disabled),
|
|
541
|
+
"aria-label": _ariaLabel,
|
|
542
|
+
"aria-labelledby": _ariaLabelledBy ?? getLabelId(scope),
|
|
543
|
+
"aria-orientation": prop("orientation"),
|
|
544
|
+
"aria-valuemax": range.max,
|
|
545
|
+
"aria-valuemin": range.min,
|
|
546
|
+
"aria-valuenow": sliderValue[index],
|
|
547
|
+
"aria-valuetext": valueText,
|
|
548
|
+
role: "slider",
|
|
549
|
+
tabIndex: disabled ? void 0 : 0,
|
|
550
|
+
style: getThumbStyle(service, index),
|
|
551
|
+
onPointerDown(event) {
|
|
552
|
+
if (!interactive) return;
|
|
553
|
+
if (!require_event.isLeftClick(event)) return;
|
|
554
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
555
|
+
const midpoint = {
|
|
556
|
+
x: rect.left + rect.width / 2,
|
|
557
|
+
y: rect.top + rect.height / 2
|
|
558
|
+
};
|
|
559
|
+
const offset = {
|
|
560
|
+
x: event.clientX - midpoint.x,
|
|
561
|
+
y: event.clientY - midpoint.y
|
|
562
|
+
};
|
|
563
|
+
send({
|
|
564
|
+
type: "THUMB_POINTER_DOWN",
|
|
565
|
+
index,
|
|
566
|
+
offset
|
|
567
|
+
});
|
|
568
|
+
event.stopPropagation();
|
|
569
|
+
},
|
|
570
|
+
onBlur() {
|
|
571
|
+
if (!interactive) return;
|
|
572
|
+
send({ type: "BLUR" });
|
|
573
|
+
},
|
|
574
|
+
onFocus() {
|
|
575
|
+
if (!interactive) return;
|
|
576
|
+
send({
|
|
577
|
+
type: "FOCUS",
|
|
578
|
+
index
|
|
579
|
+
});
|
|
580
|
+
},
|
|
581
|
+
onKeyDown(event) {
|
|
582
|
+
if (event.defaultPrevented) return;
|
|
583
|
+
if (!interactive) return;
|
|
584
|
+
const step = require_event.getEventStepValue(event, {
|
|
585
|
+
step: prop("step"),
|
|
586
|
+
largeStep: prop("largeStep")
|
|
587
|
+
});
|
|
588
|
+
const exec = {
|
|
589
|
+
ArrowUp() {
|
|
590
|
+
if (isHorizontal) return;
|
|
591
|
+
send({
|
|
592
|
+
type: "ARROW_INC",
|
|
593
|
+
step,
|
|
594
|
+
src: "ArrowUp"
|
|
595
|
+
});
|
|
596
|
+
},
|
|
597
|
+
ArrowDown() {
|
|
598
|
+
if (isHorizontal) return;
|
|
599
|
+
send({
|
|
600
|
+
type: "ARROW_DEC",
|
|
601
|
+
step,
|
|
602
|
+
src: "ArrowDown"
|
|
603
|
+
});
|
|
604
|
+
},
|
|
605
|
+
ArrowLeft() {
|
|
606
|
+
if (isVertical) return;
|
|
607
|
+
send({
|
|
608
|
+
type: "ARROW_DEC",
|
|
609
|
+
step,
|
|
610
|
+
src: "ArrowLeft"
|
|
611
|
+
});
|
|
612
|
+
},
|
|
613
|
+
ArrowRight() {
|
|
614
|
+
if (isVertical) return;
|
|
615
|
+
send({
|
|
616
|
+
type: "ARROW_INC",
|
|
617
|
+
step,
|
|
618
|
+
src: "ArrowRight"
|
|
619
|
+
});
|
|
620
|
+
},
|
|
621
|
+
PageUp() {
|
|
622
|
+
send({
|
|
623
|
+
type: "ARROW_INC",
|
|
624
|
+
step,
|
|
625
|
+
src: "PageUp"
|
|
626
|
+
});
|
|
627
|
+
},
|
|
628
|
+
PageDown() {
|
|
629
|
+
send({
|
|
630
|
+
type: "ARROW_DEC",
|
|
631
|
+
step,
|
|
632
|
+
src: "PageDown"
|
|
633
|
+
});
|
|
634
|
+
},
|
|
635
|
+
Home() {
|
|
636
|
+
send({ type: "HOME" });
|
|
637
|
+
},
|
|
638
|
+
End() {
|
|
639
|
+
send({ type: "END" });
|
|
640
|
+
}
|
|
641
|
+
}[require_event.getEventKey(event, {
|
|
642
|
+
dir: prop("dir"),
|
|
643
|
+
orientation: prop("orientation")
|
|
644
|
+
})];
|
|
645
|
+
if (exec) {
|
|
646
|
+
exec(event);
|
|
647
|
+
event.preventDefault();
|
|
648
|
+
event.stopPropagation();
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
},
|
|
653
|
+
getHiddenInputProps(props) {
|
|
654
|
+
const { index = 0, name } = props;
|
|
655
|
+
return normalize.input({
|
|
656
|
+
name: name ?? (prop("name") ? prop("name") + (sliderValue.length > 1 ? "[]" : "") : void 0),
|
|
657
|
+
form: prop("form"),
|
|
658
|
+
type: "text",
|
|
659
|
+
hidden: true,
|
|
660
|
+
defaultValue: sliderValue[index],
|
|
661
|
+
id: getHiddenInputId(scope, index)
|
|
662
|
+
});
|
|
663
|
+
},
|
|
664
|
+
getRangeProps() {
|
|
665
|
+
return normalize.element({
|
|
666
|
+
id: getRangeId(scope),
|
|
667
|
+
...parts.range.attrs,
|
|
668
|
+
dir: prop("dir"),
|
|
669
|
+
"data-dragging": require_dom_query.dataAttr(dragging),
|
|
670
|
+
"data-focus": require_dom_query.dataAttr(focused),
|
|
671
|
+
"data-invalid": require_dom_query.dataAttr(invalid),
|
|
672
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
673
|
+
"data-orientation": prop("orientation"),
|
|
674
|
+
style: getRangeStyle(service)
|
|
675
|
+
});
|
|
676
|
+
},
|
|
677
|
+
getControlProps() {
|
|
678
|
+
return normalize.element({
|
|
679
|
+
...parts.control.attrs,
|
|
680
|
+
dir: prop("dir"),
|
|
681
|
+
id: getControlId(scope),
|
|
682
|
+
"data-dragging": require_dom_query.dataAttr(dragging),
|
|
683
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
684
|
+
"data-orientation": prop("orientation"),
|
|
685
|
+
"data-invalid": require_dom_query.dataAttr(invalid),
|
|
686
|
+
"data-focus": require_dom_query.dataAttr(focused),
|
|
687
|
+
style: getControlStyle(),
|
|
688
|
+
onPointerDown(event) {
|
|
689
|
+
if (!interactive) return;
|
|
690
|
+
if (!require_event.isLeftClick(event)) return;
|
|
691
|
+
if (require_event.isModifierKey(event)) return;
|
|
692
|
+
const point = require_event.getEventPoint(event);
|
|
693
|
+
send({
|
|
694
|
+
type: "POINTER_DOWN",
|
|
695
|
+
point
|
|
696
|
+
});
|
|
697
|
+
event.preventDefault();
|
|
698
|
+
event.stopPropagation();
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
},
|
|
702
|
+
getMarkerGroupProps() {
|
|
703
|
+
return normalize.element({
|
|
704
|
+
...parts.markerGroup.attrs,
|
|
705
|
+
role: "presentation",
|
|
706
|
+
dir: prop("dir"),
|
|
707
|
+
"aria-hidden": true,
|
|
708
|
+
"data-orientation": prop("orientation"),
|
|
709
|
+
style: getMarkerGroupStyle()
|
|
710
|
+
});
|
|
711
|
+
},
|
|
712
|
+
getMarkerProps(props) {
|
|
713
|
+
const style = getMarkerStyle(service, props.value);
|
|
714
|
+
let markerState;
|
|
715
|
+
if (props.value < require_array.first(sliderValue)) markerState = "under-value";
|
|
716
|
+
else if (props.value > require_array.last(sliderValue)) markerState = "over-value";
|
|
717
|
+
else markerState = "at-value";
|
|
718
|
+
return normalize.element({
|
|
719
|
+
...parts.marker.attrs,
|
|
720
|
+
id: getMarkerId(scope, props.value),
|
|
721
|
+
role: "presentation",
|
|
722
|
+
dir: prop("dir"),
|
|
723
|
+
"data-orientation": prop("orientation"),
|
|
724
|
+
"data-value": props.value,
|
|
725
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
726
|
+
"data-state": markerState,
|
|
727
|
+
style
|
|
728
|
+
});
|
|
729
|
+
},
|
|
730
|
+
getDraggingIndicatorProps(props) {
|
|
731
|
+
const { index = 0 } = props;
|
|
732
|
+
const isDragging = index === focusedIndex && dragging;
|
|
733
|
+
return normalize.element({
|
|
734
|
+
...parts.draggingIndicator.attrs,
|
|
735
|
+
role: "presentation",
|
|
736
|
+
dir: prop("dir"),
|
|
737
|
+
hidden: !isDragging,
|
|
738
|
+
"data-orientation": prop("orientation"),
|
|
739
|
+
"data-state": isDragging ? "open" : "closed",
|
|
740
|
+
style: getThumbStyle(service, index)
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
//#endregion
|
|
746
|
+
//#region src/machines/slider/machine.ts
|
|
747
|
+
const isEqualSize = (a, b) => {
|
|
748
|
+
return a?.width === b?.width && a?.height === b?.height;
|
|
749
|
+
};
|
|
750
|
+
const normalize = (value, min, max, step, minStepsBetweenThumbs) => {
|
|
751
|
+
return require_utils.getValueRanges(value, min, max, minStepsBetweenThumbs * step).map((range) => {
|
|
752
|
+
const rangeValue = require_utils.clampValue(require_utils.snapValueToStep(range.value, range.min, range.max, step), range.min, range.max);
|
|
753
|
+
if (!require_utils.isValueWithinRange(rangeValue, min, max)) throw new Error("[wirekyt/slider] The configured `min`, `max`, `step` or `minStepsBetweenThumbs` values are invalid");
|
|
754
|
+
return rangeValue;
|
|
755
|
+
});
|
|
756
|
+
};
|
|
757
|
+
const machine = require_core.createMachine({
|
|
758
|
+
props({ props }) {
|
|
759
|
+
const min = props.min ?? 0;
|
|
760
|
+
const max = props.max ?? 100;
|
|
761
|
+
const step = props.step ?? 1;
|
|
762
|
+
const defaultValue = props.defaultValue ?? [min];
|
|
763
|
+
const minStepsBetweenThumbs = props.minStepsBetweenThumbs ?? 0;
|
|
764
|
+
return {
|
|
765
|
+
dir: "ltr",
|
|
766
|
+
thumbAlignment: "contain",
|
|
767
|
+
origin: "start",
|
|
768
|
+
orientation: "horizontal",
|
|
769
|
+
thumbCollisionBehavior: "none",
|
|
770
|
+
minStepsBetweenThumbs,
|
|
771
|
+
...props,
|
|
772
|
+
largeStep: props.largeStep ?? 10 * step,
|
|
773
|
+
defaultValue: normalize(defaultValue, min, max, step, minStepsBetweenThumbs),
|
|
774
|
+
value: props.value ? normalize(props.value, min, max, step, minStepsBetweenThumbs) : void 0,
|
|
775
|
+
max,
|
|
776
|
+
step,
|
|
777
|
+
min
|
|
778
|
+
};
|
|
779
|
+
},
|
|
780
|
+
initialState() {
|
|
781
|
+
return "idle";
|
|
782
|
+
},
|
|
783
|
+
context({ prop, bindable, getContext }) {
|
|
784
|
+
return {
|
|
785
|
+
thumbSize: bindable(() => ({ defaultValue: prop("thumbSize") || null })),
|
|
786
|
+
value: bindable(() => ({
|
|
787
|
+
defaultValue: prop("defaultValue"),
|
|
788
|
+
value: prop("value"),
|
|
789
|
+
isEqual: require_equal.isEqual,
|
|
790
|
+
hash(a) {
|
|
791
|
+
return a.join(",");
|
|
792
|
+
},
|
|
793
|
+
onChange(value) {
|
|
794
|
+
prop("onValueChange")?.({ value });
|
|
795
|
+
}
|
|
796
|
+
})),
|
|
797
|
+
focusedIndex: bindable(() => ({
|
|
798
|
+
defaultValue: -1,
|
|
799
|
+
onChange(value) {
|
|
800
|
+
const ctx = getContext();
|
|
801
|
+
prop("onFocusChange")?.({
|
|
802
|
+
focusedIndex: value,
|
|
803
|
+
value: ctx.get("value")
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
})),
|
|
807
|
+
fieldsetDisabled: bindable(() => ({ defaultValue: false }))
|
|
808
|
+
};
|
|
809
|
+
},
|
|
810
|
+
refs() {
|
|
811
|
+
return {
|
|
812
|
+
thumbDragOffset: null,
|
|
813
|
+
thumbDragStartValue: null
|
|
814
|
+
};
|
|
815
|
+
},
|
|
816
|
+
computed: {
|
|
817
|
+
isHorizontal: ({ prop }) => prop("orientation") === "horizontal",
|
|
818
|
+
isVertical: ({ prop }) => prop("orientation") === "vertical",
|
|
819
|
+
isRtl: ({ prop }) => prop("orientation") === "horizontal" && prop("dir") === "rtl",
|
|
820
|
+
isDisabled: ({ context, prop }) => !!prop("disabled") || context.get("fieldsetDisabled"),
|
|
821
|
+
isInteractive: ({ prop, computed }) => !(prop("readOnly") || computed("isDisabled")),
|
|
822
|
+
hasMeasuredThumbSize: ({ context }) => context.get("thumbSize") != null,
|
|
823
|
+
valuePercent: require_core.memo(({ context, prop }) => [
|
|
824
|
+
context.get("value"),
|
|
825
|
+
prop("min"),
|
|
826
|
+
prop("max")
|
|
827
|
+
], ([value, min, max]) => value.map((value) => 100 * require_utils.getValuePercent(value, min, max)))
|
|
828
|
+
},
|
|
829
|
+
watch({ track, action, context, computed, send }) {
|
|
830
|
+
track([() => context.hash("value")], () => {
|
|
831
|
+
action(["syncInputElements", "dispatchChangeEvent"]);
|
|
832
|
+
});
|
|
833
|
+
track([() => computed("isDisabled")], () => {
|
|
834
|
+
if (computed("isDisabled")) send({ type: "POINTER_CANCEL" });
|
|
835
|
+
});
|
|
836
|
+
},
|
|
837
|
+
effects: ["trackFormControlState", "trackThumbSize"],
|
|
838
|
+
on: {
|
|
839
|
+
SET_VALUE: [{
|
|
840
|
+
guard: "hasIndex",
|
|
841
|
+
actions: ["setValueAtIndex", "invokeOnChangeEnd"]
|
|
842
|
+
}, { actions: ["setValue", "invokeOnChangeEnd"] }],
|
|
843
|
+
INCREMENT: { actions: ["incrementThumbAtIndex", "invokeOnChangeEnd"] },
|
|
844
|
+
DECREMENT: { actions: ["decrementThumbAtIndex", "invokeOnChangeEnd"] }
|
|
845
|
+
},
|
|
846
|
+
states: {
|
|
847
|
+
idle: { on: {
|
|
848
|
+
POINTER_DOWN: {
|
|
849
|
+
target: "dragging",
|
|
850
|
+
actions: [
|
|
851
|
+
"setClosestThumbIndex",
|
|
852
|
+
"setThumbDragStartValue",
|
|
853
|
+
"setPointerValue",
|
|
854
|
+
"focusActiveThumb"
|
|
855
|
+
]
|
|
856
|
+
},
|
|
857
|
+
FOCUS: {
|
|
858
|
+
target: "focus",
|
|
859
|
+
actions: ["setFocusedIndex"]
|
|
860
|
+
},
|
|
861
|
+
THUMB_POINTER_DOWN: {
|
|
862
|
+
target: "dragging",
|
|
863
|
+
actions: [
|
|
864
|
+
"setFocusedIndex",
|
|
865
|
+
"setThumbDragOffset",
|
|
866
|
+
"setThumbDragStartValue",
|
|
867
|
+
"focusActiveThumb"
|
|
868
|
+
]
|
|
869
|
+
}
|
|
870
|
+
} },
|
|
871
|
+
focus: {
|
|
872
|
+
entry: ["focusActiveThumb"],
|
|
873
|
+
on: {
|
|
874
|
+
POINTER_DOWN: {
|
|
875
|
+
target: "dragging",
|
|
876
|
+
actions: [
|
|
877
|
+
"setClosestThumbIndex",
|
|
878
|
+
"setThumbDragStartValue",
|
|
879
|
+
"setPointerValue",
|
|
880
|
+
"focusActiveThumb"
|
|
881
|
+
]
|
|
882
|
+
},
|
|
883
|
+
THUMB_POINTER_DOWN: {
|
|
884
|
+
target: "dragging",
|
|
885
|
+
actions: [
|
|
886
|
+
"setFocusedIndex",
|
|
887
|
+
"setThumbDragOffset",
|
|
888
|
+
"setThumbDragStartValue",
|
|
889
|
+
"focusActiveThumb"
|
|
890
|
+
]
|
|
891
|
+
},
|
|
892
|
+
ARROW_DEC: { actions: ["decrementThumbAtIndex", "invokeOnChangeEnd"] },
|
|
893
|
+
ARROW_INC: { actions: ["incrementThumbAtIndex", "invokeOnChangeEnd"] },
|
|
894
|
+
HOME: { actions: ["setFocusedThumbToMin", "invokeOnChangeEnd"] },
|
|
895
|
+
END: { actions: ["setFocusedThumbToMax", "invokeOnChangeEnd"] },
|
|
896
|
+
BLUR: {
|
|
897
|
+
target: "idle",
|
|
898
|
+
actions: ["clearFocusedIndex"]
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
},
|
|
902
|
+
dragging: {
|
|
903
|
+
entry: ["focusActiveThumb"],
|
|
904
|
+
effects: ["trackPointerMove"],
|
|
905
|
+
on: {
|
|
906
|
+
POINTER_UP: {
|
|
907
|
+
target: "focus",
|
|
908
|
+
actions: [
|
|
909
|
+
"invokeOnChangeEnd",
|
|
910
|
+
"clearThumbDragOffset",
|
|
911
|
+
"clearThumbDragStartValue"
|
|
912
|
+
]
|
|
913
|
+
},
|
|
914
|
+
POINTER_MOVE: { actions: ["setPointerValue"] },
|
|
915
|
+
POINTER_CANCEL: {
|
|
916
|
+
target: "idle",
|
|
917
|
+
actions: [
|
|
918
|
+
"clearFocusedIndex",
|
|
919
|
+
"clearThumbDragOffset",
|
|
920
|
+
"clearThumbDragStartValue"
|
|
921
|
+
]
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
},
|
|
926
|
+
implementations: {
|
|
927
|
+
guards: { hasIndex: ({ event }) => event.index != null },
|
|
928
|
+
effects: {
|
|
929
|
+
trackFormControlState({ context, scope }) {
|
|
930
|
+
return require_form.trackFormControl(getRootEl(scope), {
|
|
931
|
+
onFieldsetDisabledChange(disabled) {
|
|
932
|
+
context.set("fieldsetDisabled", disabled);
|
|
933
|
+
},
|
|
934
|
+
onFormReset() {
|
|
935
|
+
context.set("value", context.initial("value"));
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
},
|
|
939
|
+
trackPointerMove({ scope, send }) {
|
|
940
|
+
return require_pointer_move.trackPointerMove(scope.getDoc(), {
|
|
941
|
+
onPointerMove(info) {
|
|
942
|
+
send({
|
|
943
|
+
type: "POINTER_MOVE",
|
|
944
|
+
point: info.point
|
|
945
|
+
});
|
|
946
|
+
},
|
|
947
|
+
onPointerUp() {
|
|
948
|
+
send({ type: "POINTER_UP" });
|
|
949
|
+
}
|
|
950
|
+
});
|
|
951
|
+
},
|
|
952
|
+
trackThumbSize({ context, scope, prop }) {
|
|
953
|
+
if (prop("thumbAlignment") !== "contain" || prop("thumbSize")) return;
|
|
954
|
+
const exec = (el) => {
|
|
955
|
+
const size = require_utils.pick(getOffsetRect(el), ["width", "height"]);
|
|
956
|
+
if (isEqualSize(context.get("thumbSize"), size)) return;
|
|
957
|
+
context.set("thumbSize", size);
|
|
958
|
+
};
|
|
959
|
+
const thumbEls = getThumbEls(scope);
|
|
960
|
+
thumbEls.forEach(exec);
|
|
961
|
+
return require_utils.callAll(...thumbEls.map((el) => require_dom_query.resizeObserverBorderBox.observe(el, () => exec(el))));
|
|
962
|
+
}
|
|
963
|
+
},
|
|
964
|
+
actions: {
|
|
965
|
+
dispatchChangeEvent({ context, scope }) {
|
|
966
|
+
dispatchChangeEvent(scope, context.get("value"));
|
|
967
|
+
},
|
|
968
|
+
syncInputElements({ context, scope }) {
|
|
969
|
+
context.get("value").forEach((value, index) => {
|
|
970
|
+
require_form.setElementValue(getHiddenInputEl(scope, index), value.toString());
|
|
971
|
+
});
|
|
972
|
+
},
|
|
973
|
+
invokeOnChangeEnd({ prop, context }) {
|
|
974
|
+
queueMicrotask(() => {
|
|
975
|
+
prop("onValueChangeEnd")?.({ value: context.get("value") });
|
|
976
|
+
});
|
|
977
|
+
},
|
|
978
|
+
setClosestThumbIndex(params) {
|
|
979
|
+
const { context, event } = params;
|
|
980
|
+
const pointValue = getPointValue(params, event.point);
|
|
981
|
+
if (pointValue == null) return;
|
|
982
|
+
const focusedIndex = getClosestIndex(params, pointValue);
|
|
983
|
+
context.set("focusedIndex", focusedIndex);
|
|
984
|
+
},
|
|
985
|
+
setFocusedIndex(params) {
|
|
986
|
+
const { context, event } = params;
|
|
987
|
+
const movableIndex = selectMovableThumb(params, event.index);
|
|
988
|
+
context.set("focusedIndex", movableIndex);
|
|
989
|
+
},
|
|
990
|
+
clearFocusedIndex({ context }) {
|
|
991
|
+
context.set("focusedIndex", -1);
|
|
992
|
+
},
|
|
993
|
+
setThumbDragOffset(params) {
|
|
994
|
+
const { refs, event } = params;
|
|
995
|
+
refs.set("thumbDragOffset", event.offset ?? null);
|
|
996
|
+
},
|
|
997
|
+
clearThumbDragOffset({ refs }) {
|
|
998
|
+
refs.set("thumbDragOffset", null);
|
|
999
|
+
},
|
|
1000
|
+
setThumbDragStartValue({ refs, context }) {
|
|
1001
|
+
refs.set("thumbDragStartValue", context.get("value").slice());
|
|
1002
|
+
},
|
|
1003
|
+
clearThumbDragStartValue({ refs }) {
|
|
1004
|
+
refs.set("thumbDragStartValue", null);
|
|
1005
|
+
},
|
|
1006
|
+
setPointerValue(params) {
|
|
1007
|
+
queueMicrotask(() => {
|
|
1008
|
+
const { context, event, prop, refs } = params;
|
|
1009
|
+
const pointValue = getPointValue(params, event.point);
|
|
1010
|
+
if (pointValue == null) return;
|
|
1011
|
+
const focusedIndex = context.get("focusedIndex");
|
|
1012
|
+
const startValues = refs.get("thumbDragStartValue");
|
|
1013
|
+
const result = resolveThumbCollision(prop("thumbCollisionBehavior"), focusedIndex, pointValue, context.get("value"), prop("min"), prop("max"), prop("step"), prop("minStepsBetweenThumbs"), startValues?.[focusedIndex]);
|
|
1014
|
+
if (result.swapped) context.set("focusedIndex", result.index);
|
|
1015
|
+
context.set("value", result.values);
|
|
1016
|
+
});
|
|
1017
|
+
},
|
|
1018
|
+
focusActiveThumb({ scope, context }) {
|
|
1019
|
+
require_raf.raf(() => {
|
|
1020
|
+
getThumbEl(scope, context.get("focusedIndex"))?.focus({ preventScroll: true });
|
|
1021
|
+
});
|
|
1022
|
+
},
|
|
1023
|
+
decrementThumbAtIndex(params) {
|
|
1024
|
+
const { context, event } = params;
|
|
1025
|
+
const value = decrement(params, event.index, event.step);
|
|
1026
|
+
context.set("value", value);
|
|
1027
|
+
},
|
|
1028
|
+
incrementThumbAtIndex(params) {
|
|
1029
|
+
const { context, event } = params;
|
|
1030
|
+
const value = increment(params, event.index, event.step);
|
|
1031
|
+
context.set("value", value);
|
|
1032
|
+
},
|
|
1033
|
+
setFocusedThumbToMin(params) {
|
|
1034
|
+
const { context } = params;
|
|
1035
|
+
const index = context.get("focusedIndex");
|
|
1036
|
+
const { min } = getRangeAtIndex(params, index);
|
|
1037
|
+
context.set("value", (prev) => require_utils.setValueAtIndex(prev, index, min));
|
|
1038
|
+
},
|
|
1039
|
+
setFocusedThumbToMax(params) {
|
|
1040
|
+
const { context } = params;
|
|
1041
|
+
const index = context.get("focusedIndex");
|
|
1042
|
+
const { max } = getRangeAtIndex(params, index);
|
|
1043
|
+
context.set("value", (prev) => require_utils.setValueAtIndex(prev, index, max));
|
|
1044
|
+
},
|
|
1045
|
+
setValueAtIndex(params) {
|
|
1046
|
+
const { context, event } = params;
|
|
1047
|
+
const value = constrainValue(params, event.value, event.index);
|
|
1048
|
+
context.set("value", (prev) => require_utils.setValueAtIndex(prev, event.index, value));
|
|
1049
|
+
},
|
|
1050
|
+
setValue(params) {
|
|
1051
|
+
const { context, event } = params;
|
|
1052
|
+
const value = normalizeValues(params, event.value);
|
|
1053
|
+
context.set("value", value);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
//#endregion
|
|
1059
|
+
//#region src/machines/slider/props.ts
|
|
1060
|
+
const props = require_create_props.createProps()([
|
|
1061
|
+
"aria-label",
|
|
1062
|
+
"aria-labelledby",
|
|
1063
|
+
"dir",
|
|
1064
|
+
"disabled",
|
|
1065
|
+
"form",
|
|
1066
|
+
"getAriaValueText",
|
|
1067
|
+
"getRootNode",
|
|
1068
|
+
"id",
|
|
1069
|
+
"ids",
|
|
1070
|
+
"invalid",
|
|
1071
|
+
"largeStep",
|
|
1072
|
+
"max",
|
|
1073
|
+
"min",
|
|
1074
|
+
"minStepsBetweenThumbs",
|
|
1075
|
+
"name",
|
|
1076
|
+
"onFocusChange",
|
|
1077
|
+
"onValueChange",
|
|
1078
|
+
"onValueChangeEnd",
|
|
1079
|
+
"orientation",
|
|
1080
|
+
"origin",
|
|
1081
|
+
"readOnly",
|
|
1082
|
+
"step",
|
|
1083
|
+
"thumbAlignment",
|
|
1084
|
+
"thumbCollisionBehavior",
|
|
1085
|
+
"thumbSize",
|
|
1086
|
+
"value",
|
|
1087
|
+
"defaultValue"
|
|
1088
|
+
]);
|
|
1089
|
+
const splitProps = require_utils.createSplitProps(props);
|
|
1090
|
+
const thumbProps = require_create_props.createProps()(["index", "name"]);
|
|
1091
|
+
const splitThumbProps = require_utils.createSplitProps(thumbProps);
|
|
1092
|
+
const markerProps = require_create_props.createProps()(["value"]);
|
|
1093
|
+
const splitMarkerProps = require_utils.createSplitProps(markerProps);
|
|
1094
|
+
//#endregion
|
|
1095
|
+
exports.anatomy = anatomy;
|
|
1096
|
+
exports.connect = connect;
|
|
1097
|
+
exports.machine = machine;
|
|
1098
|
+
exports.markerProps = markerProps;
|
|
1099
|
+
exports.props = props;
|
|
1100
|
+
exports.splitMarkerProps = splitMarkerProps;
|
|
1101
|
+
exports.splitProps = splitProps;
|
|
1102
|
+
exports.splitThumbProps = splitThumbProps;
|
|
1103
|
+
exports.thumbProps = thumbProps;
|