@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,1009 @@
|
|
|
1
|
+
import { t as createAnatomy } from "../../create-anatomy-B2q3wiaw.js";
|
|
2
|
+
import { n as setCaretToEnd } from "../../caret-aiDJ6mAS.js";
|
|
3
|
+
import { I as MAX_Z_INDEX, L as ariaAttr, S as getWindow, z as dataAttr } from "../../dom-query-e7fh0TEH.js";
|
|
4
|
+
import { f as isSafari } from "../../platform-BDB0wXUk.js";
|
|
5
|
+
import { h as isModifierKey, i as getEventPoint, l as isComposingEvent, m as isLeftClick, o as getEventStepValue, t as addDomEvent } from "../../event-bTItRgiw.js";
|
|
6
|
+
import { o as setElementValue, s as trackFormControl } from "../../form-B1DW_w_3.js";
|
|
7
|
+
import { i as raf } from "../../raf-Dhvm7f1e.js";
|
|
8
|
+
import { t as observeAttributes } from "../../mutation-observer-qObPUo3D.js";
|
|
9
|
+
import { t as requestPointerLock } from "../../pointer-lock-WezxTqu-.js";
|
|
10
|
+
import { E as isValueWithinRange, I as wrap, L as callAll, S as incrementValue, T as isValueAtMin, k as roundToDpr, l as clampValue, n as createSplitProps, u as decrementValue, w as isValueAtMax } from "../../utils-Cht5XaHf.js";
|
|
11
|
+
import { i as setup, p as memo } from "../../core-CJ0MZr3D.js";
|
|
12
|
+
import { t as createProps } from "../../create-props-CgtcN_Qu.js";
|
|
13
|
+
import { NumberParser } from "@internationalized/number";
|
|
14
|
+
//#region src/machines/number-input/anatomy.ts
|
|
15
|
+
const anatomy = createAnatomy("numberInput").parts("root", "label", "input", "control", "valueText", "incrementTrigger", "decrementTrigger", "scrubber");
|
|
16
|
+
const parts = anatomy.build();
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/machines/number-input/cursor.ts
|
|
19
|
+
function recordCursor(inputEl, scope) {
|
|
20
|
+
if (!inputEl || !scope.isActiveElement(inputEl)) return;
|
|
21
|
+
try {
|
|
22
|
+
const { selectionStart: start, selectionEnd: end, value } = inputEl;
|
|
23
|
+
if (start == null || end == null) return void 0;
|
|
24
|
+
return {
|
|
25
|
+
start,
|
|
26
|
+
end,
|
|
27
|
+
value
|
|
28
|
+
};
|
|
29
|
+
} catch {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function restoreCursor(inputEl, selection, scope) {
|
|
34
|
+
if (!inputEl || !scope.isActiveElement(inputEl)) return;
|
|
35
|
+
if (!selection) {
|
|
36
|
+
const len = inputEl.value.length;
|
|
37
|
+
inputEl.setSelectionRange(len, len);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const newValue = inputEl.value;
|
|
42
|
+
const { start, end, value: oldValue } = selection;
|
|
43
|
+
if (newValue === oldValue) {
|
|
44
|
+
inputEl.setSelectionRange(start, end);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const newStart = getNextCursorPosition(oldValue, newValue, start);
|
|
48
|
+
const newEnd = start === end ? newStart : getNextCursorPosition(oldValue, newValue, end);
|
|
49
|
+
const clampedStart = Math.max(0, Math.min(newStart, newValue.length));
|
|
50
|
+
const clampedEnd = Math.max(clampedStart, Math.min(newEnd, newValue.length));
|
|
51
|
+
inputEl.setSelectionRange(clampedStart, clampedEnd);
|
|
52
|
+
} catch {
|
|
53
|
+
const len = inputEl.value.length;
|
|
54
|
+
inputEl.setSelectionRange(len, len);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function getNextCursorPosition(oldValue, newValue, oldPosition) {
|
|
58
|
+
const beforeCursor = oldValue.slice(0, oldPosition);
|
|
59
|
+
const afterCursor = oldValue.slice(oldPosition);
|
|
60
|
+
let prefixLength = 0;
|
|
61
|
+
const maxPrefixLength = Math.min(beforeCursor.length, newValue.length);
|
|
62
|
+
for (let i = 0; i < maxPrefixLength; i++) if (beforeCursor[i] === newValue[i]) prefixLength = i + 1;
|
|
63
|
+
else break;
|
|
64
|
+
let suffixLength = 0;
|
|
65
|
+
const maxSuffixLength = Math.min(afterCursor.length, newValue.length - prefixLength);
|
|
66
|
+
for (let i = 0; i < maxSuffixLength; i++) {
|
|
67
|
+
const oldIndex = afterCursor.length - 1 - i;
|
|
68
|
+
const newIndex = newValue.length - 1 - i;
|
|
69
|
+
if (afterCursor[oldIndex] === newValue[newIndex]) suffixLength = i + 1;
|
|
70
|
+
else break;
|
|
71
|
+
}
|
|
72
|
+
if (beforeCursor.length > 0 && prefixLength >= beforeCursor.length) return prefixLength;
|
|
73
|
+
if (suffixLength >= afterCursor.length) return newValue.length - suffixLength;
|
|
74
|
+
if (prefixLength > 0) return prefixLength;
|
|
75
|
+
if (suffixLength > 0) return newValue.length - suffixLength;
|
|
76
|
+
if (oldPosition === 0 && prefixLength === 0 && suffixLength === 0) return newValue.length;
|
|
77
|
+
if (oldValue.length > 0) {
|
|
78
|
+
const ratio = oldPosition / oldValue.length;
|
|
79
|
+
return Math.round(ratio * newValue.length);
|
|
80
|
+
}
|
|
81
|
+
return newValue.length;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/machines/number-input/dom.ts
|
|
85
|
+
const getRootId = (ctx) => ctx.ids?.root ?? `number-input:${ctx.id}`;
|
|
86
|
+
const getInputId = (ctx) => ctx.ids?.input ?? `number-input:${ctx.id}:input`;
|
|
87
|
+
const getIncrementTriggerId = (ctx) => ctx.ids?.incrementTrigger ?? `number-input:${ctx.id}:inc`;
|
|
88
|
+
const getDecrementTriggerId = (ctx) => ctx.ids?.decrementTrigger ?? `number-input:${ctx.id}:dec`;
|
|
89
|
+
const getScrubberId = (ctx) => ctx.ids?.scrubber ?? `number-input:${ctx.id}:scrubber`;
|
|
90
|
+
const getCursorId = (ctx) => `number-input:${ctx.id}:cursor`;
|
|
91
|
+
const getLabelId = (ctx) => ctx.ids?.label ?? `number-input:${ctx.id}:label`;
|
|
92
|
+
const getInputEl = (ctx) => ctx.getById(getInputId(ctx));
|
|
93
|
+
const getIncrementTriggerEl = (ctx) => ctx.getById(getIncrementTriggerId(ctx));
|
|
94
|
+
const getDecrementTriggerEl = (ctx) => ctx.getById(getDecrementTriggerId(ctx));
|
|
95
|
+
const getCursorEl = (ctx) => ctx.getDoc().getElementById(getCursorId(ctx));
|
|
96
|
+
const getPressedTriggerEl = (ctx, hint) => {
|
|
97
|
+
let btnEl = null;
|
|
98
|
+
if (hint === "increment") btnEl = getIncrementTriggerEl(ctx);
|
|
99
|
+
if (hint === "decrement") btnEl = getDecrementTriggerEl(ctx);
|
|
100
|
+
return btnEl;
|
|
101
|
+
};
|
|
102
|
+
const setupVirtualCursor = (ctx, point) => {
|
|
103
|
+
if (isSafari()) return;
|
|
104
|
+
createVirtualCursor(ctx, point);
|
|
105
|
+
return () => {
|
|
106
|
+
getCursorEl(ctx)?.remove();
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
const preventTextSelection = (ctx) => {
|
|
110
|
+
const doc = ctx.getDoc();
|
|
111
|
+
const html = doc.documentElement;
|
|
112
|
+
const body = doc.body;
|
|
113
|
+
body.style.pointerEvents = "none";
|
|
114
|
+
html.style.userSelect = "none";
|
|
115
|
+
html.style.cursor = "ew-resize";
|
|
116
|
+
return () => {
|
|
117
|
+
body.style.pointerEvents = "";
|
|
118
|
+
html.style.userSelect = "";
|
|
119
|
+
html.style.cursor = "";
|
|
120
|
+
if (!html.style.length) html.removeAttribute("style");
|
|
121
|
+
if (!body.style.length) body.removeAttribute("style");
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
const getMousemoveValue = (ctx, opts) => {
|
|
125
|
+
const { point, isRtl, event } = opts;
|
|
126
|
+
const win = ctx.getWin();
|
|
127
|
+
const x = roundToDpr(event.movementX, win.devicePixelRatio);
|
|
128
|
+
const y = roundToDpr(event.movementY, win.devicePixelRatio);
|
|
129
|
+
let hint = x > 0 ? "increment" : x < 0 ? "decrement" : null;
|
|
130
|
+
if (isRtl && hint === "increment") hint = "decrement";
|
|
131
|
+
if (isRtl && hint === "decrement") hint = "increment";
|
|
132
|
+
const newPoint = {
|
|
133
|
+
x: point.x + x,
|
|
134
|
+
y: point.y + y
|
|
135
|
+
};
|
|
136
|
+
const width = win.innerWidth;
|
|
137
|
+
const half = roundToDpr(7.5, win.devicePixelRatio);
|
|
138
|
+
newPoint.x = wrap(newPoint.x + half, width) - half;
|
|
139
|
+
return {
|
|
140
|
+
hint,
|
|
141
|
+
point: newPoint
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
const createVirtualCursor = (ctx, point) => {
|
|
145
|
+
const doc = ctx.getDoc();
|
|
146
|
+
const el = doc.createElement("div");
|
|
147
|
+
el.className = "scrubber--cursor";
|
|
148
|
+
el.id = getCursorId(ctx);
|
|
149
|
+
Object.assign(el.style, {
|
|
150
|
+
width: "15px",
|
|
151
|
+
height: "15px",
|
|
152
|
+
position: "fixed",
|
|
153
|
+
pointerEvents: "none",
|
|
154
|
+
left: "0px",
|
|
155
|
+
top: "0px",
|
|
156
|
+
zIndex: MAX_Z_INDEX,
|
|
157
|
+
transform: point ? `translate3d(${point.x}px, ${point.y}px, 0px)` : void 0,
|
|
158
|
+
willChange: "transform"
|
|
159
|
+
});
|
|
160
|
+
el.innerHTML = `
|
|
161
|
+
<svg width="46" height="15" style="left: -15.5px; position: absolute; top: 0; filter: drop-shadow(rgba(0, 0, 0, 0.4) 0px 1px 1.1px);">
|
|
162
|
+
<g transform="translate(2 3)">
|
|
163
|
+
<path fill-rule="evenodd" d="M 15 4.5L 15 2L 11.5 5.5L 15 9L 15 6.5L 31 6.5L 31 9L 34.5 5.5L 31 2L 31 4.5Z" style="stroke-width: 2px; stroke: white;"></path>
|
|
164
|
+
<path fill-rule="evenodd" d="M 15 4.5L 15 2L 11.5 5.5L 15 9L 15 6.5L 31 6.5L 31 9L 34.5 5.5L 31 2L 31 4.5Z"></path>
|
|
165
|
+
</g>
|
|
166
|
+
</svg>`;
|
|
167
|
+
doc.body.appendChild(el);
|
|
168
|
+
};
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/machines/number-input/connect.ts
|
|
171
|
+
function connect(service, normalize) {
|
|
172
|
+
const { state, send, prop, scope, computed } = service;
|
|
173
|
+
const focused = state.hasTag("focus");
|
|
174
|
+
const disabled = computed("isDisabled");
|
|
175
|
+
const readOnly = !!prop("readOnly");
|
|
176
|
+
const required = !!prop("required");
|
|
177
|
+
const scrubbing = state.matches("scrubbing");
|
|
178
|
+
const empty = computed("isValueEmpty");
|
|
179
|
+
const invalid = prop("invalid") !== void 0 ? !!prop("invalid") : computed("isOutOfRange");
|
|
180
|
+
const isIncrementDisabled = disabled || !computed("canIncrement") || readOnly;
|
|
181
|
+
const isDecrementDisabled = disabled || !computed("canDecrement") || readOnly;
|
|
182
|
+
const translations = prop("translations");
|
|
183
|
+
return {
|
|
184
|
+
focused,
|
|
185
|
+
invalid,
|
|
186
|
+
empty,
|
|
187
|
+
value: computed("formattedValue"),
|
|
188
|
+
valueAsNumber: computed("valueAsNumber"),
|
|
189
|
+
setValue(value) {
|
|
190
|
+
send({
|
|
191
|
+
type: "VALUE.SET",
|
|
192
|
+
value
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
clearValue() {
|
|
196
|
+
send({ type: "VALUE.CLEAR" });
|
|
197
|
+
},
|
|
198
|
+
increment() {
|
|
199
|
+
send({ type: "VALUE.INCREMENT" });
|
|
200
|
+
},
|
|
201
|
+
decrement() {
|
|
202
|
+
send({ type: "VALUE.DECREMENT" });
|
|
203
|
+
},
|
|
204
|
+
setToMax() {
|
|
205
|
+
send({
|
|
206
|
+
type: "VALUE.SET",
|
|
207
|
+
value: prop("max")
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
setToMin() {
|
|
211
|
+
send({
|
|
212
|
+
type: "VALUE.SET",
|
|
213
|
+
value: prop("min")
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
focus() {
|
|
217
|
+
getInputEl(scope)?.focus();
|
|
218
|
+
},
|
|
219
|
+
getRootProps() {
|
|
220
|
+
return normalize.element({
|
|
221
|
+
id: getRootId(scope),
|
|
222
|
+
...parts.root.attrs,
|
|
223
|
+
dir: prop("dir"),
|
|
224
|
+
"data-disabled": dataAttr(disabled),
|
|
225
|
+
"data-focus": dataAttr(focused),
|
|
226
|
+
"data-invalid": dataAttr(invalid),
|
|
227
|
+
"data-scrubbing": dataAttr(scrubbing)
|
|
228
|
+
});
|
|
229
|
+
},
|
|
230
|
+
getLabelProps() {
|
|
231
|
+
return normalize.label({
|
|
232
|
+
...parts.label.attrs,
|
|
233
|
+
dir: prop("dir"),
|
|
234
|
+
"data-disabled": dataAttr(disabled),
|
|
235
|
+
"data-focus": dataAttr(focused),
|
|
236
|
+
"data-invalid": dataAttr(invalid),
|
|
237
|
+
"data-required": dataAttr(required),
|
|
238
|
+
"data-scrubbing": dataAttr(scrubbing),
|
|
239
|
+
id: getLabelId(scope),
|
|
240
|
+
htmlFor: getInputId(scope),
|
|
241
|
+
onClick() {
|
|
242
|
+
raf(() => {
|
|
243
|
+
setCaretToEnd(getInputEl(scope));
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
},
|
|
248
|
+
getControlProps() {
|
|
249
|
+
return normalize.element({
|
|
250
|
+
...parts.control.attrs,
|
|
251
|
+
dir: prop("dir"),
|
|
252
|
+
role: "group",
|
|
253
|
+
"aria-disabled": disabled,
|
|
254
|
+
"data-focus": dataAttr(focused),
|
|
255
|
+
"data-disabled": dataAttr(disabled),
|
|
256
|
+
"data-invalid": dataAttr(invalid),
|
|
257
|
+
"data-scrubbing": dataAttr(scrubbing),
|
|
258
|
+
"aria-invalid": ariaAttr(invalid)
|
|
259
|
+
});
|
|
260
|
+
},
|
|
261
|
+
getValueTextProps() {
|
|
262
|
+
return normalize.element({
|
|
263
|
+
...parts.valueText.attrs,
|
|
264
|
+
dir: prop("dir"),
|
|
265
|
+
"data-disabled": dataAttr(disabled),
|
|
266
|
+
"data-invalid": dataAttr(invalid),
|
|
267
|
+
"data-focus": dataAttr(focused),
|
|
268
|
+
"data-scrubbing": dataAttr(scrubbing)
|
|
269
|
+
});
|
|
270
|
+
},
|
|
271
|
+
getInputProps() {
|
|
272
|
+
return normalize.input({
|
|
273
|
+
...parts.input.attrs,
|
|
274
|
+
dir: prop("dir"),
|
|
275
|
+
name: prop("name"),
|
|
276
|
+
form: prop("form"),
|
|
277
|
+
id: getInputId(scope),
|
|
278
|
+
role: "spinbutton",
|
|
279
|
+
defaultValue: computed("formattedValue"),
|
|
280
|
+
pattern: prop("formatOptions") ? void 0 : prop("pattern"),
|
|
281
|
+
inputMode: prop("inputMode"),
|
|
282
|
+
"aria-invalid": ariaAttr(invalid),
|
|
283
|
+
"data-invalid": dataAttr(invalid),
|
|
284
|
+
disabled,
|
|
285
|
+
"data-disabled": dataAttr(disabled),
|
|
286
|
+
readOnly,
|
|
287
|
+
required: prop("required"),
|
|
288
|
+
autoComplete: "off",
|
|
289
|
+
autoCorrect: "off",
|
|
290
|
+
spellCheck: "false",
|
|
291
|
+
type: "text",
|
|
292
|
+
"aria-roledescription": "numberfield",
|
|
293
|
+
"aria-valuemin": prop("min"),
|
|
294
|
+
"aria-valuemax": prop("max"),
|
|
295
|
+
"aria-valuenow": Number.isNaN(computed("valueAsNumber")) ? void 0 : computed("valueAsNumber"),
|
|
296
|
+
"aria-valuetext": computed("valueText"),
|
|
297
|
+
"data-scrubbing": dataAttr(scrubbing),
|
|
298
|
+
onFocus() {
|
|
299
|
+
send({ type: "INPUT.FOCUS" });
|
|
300
|
+
},
|
|
301
|
+
onBlur() {
|
|
302
|
+
send({ type: "INPUT.BLUR" });
|
|
303
|
+
},
|
|
304
|
+
onInput(event) {
|
|
305
|
+
const selection = recordCursor(event.currentTarget, scope);
|
|
306
|
+
send({
|
|
307
|
+
type: "INPUT.CHANGE",
|
|
308
|
+
target: event.currentTarget,
|
|
309
|
+
hint: "set",
|
|
310
|
+
selection
|
|
311
|
+
});
|
|
312
|
+
},
|
|
313
|
+
onBeforeInput(event) {
|
|
314
|
+
try {
|
|
315
|
+
const { selectionStart, selectionEnd, value } = event.currentTarget;
|
|
316
|
+
const nextValue = value.slice(0, selectionStart) + (event.data ?? "") + value.slice(selectionEnd);
|
|
317
|
+
if (!computed("parser").isValidPartialNumber(nextValue)) event.preventDefault();
|
|
318
|
+
} catch {}
|
|
319
|
+
},
|
|
320
|
+
onKeyDown(event) {
|
|
321
|
+
if (event.defaultPrevented) return;
|
|
322
|
+
if (readOnly) return;
|
|
323
|
+
if (isComposingEvent(event)) return;
|
|
324
|
+
const step = getEventStepValue(event, {
|
|
325
|
+
step: prop("step"),
|
|
326
|
+
largeStep: prop("largeStep"),
|
|
327
|
+
smallStep: prop("smallStep")
|
|
328
|
+
});
|
|
329
|
+
const exec = {
|
|
330
|
+
ArrowUp() {
|
|
331
|
+
send({
|
|
332
|
+
type: "INPUT.ARROW_UP",
|
|
333
|
+
step
|
|
334
|
+
});
|
|
335
|
+
event.preventDefault();
|
|
336
|
+
},
|
|
337
|
+
ArrowDown() {
|
|
338
|
+
send({
|
|
339
|
+
type: "INPUT.ARROW_DOWN",
|
|
340
|
+
step
|
|
341
|
+
});
|
|
342
|
+
event.preventDefault();
|
|
343
|
+
},
|
|
344
|
+
Home() {
|
|
345
|
+
if (isModifierKey(event)) return;
|
|
346
|
+
send({ type: "INPUT.HOME" });
|
|
347
|
+
event.preventDefault();
|
|
348
|
+
},
|
|
349
|
+
End() {
|
|
350
|
+
if (isModifierKey(event)) return;
|
|
351
|
+
send({ type: "INPUT.END" });
|
|
352
|
+
event.preventDefault();
|
|
353
|
+
},
|
|
354
|
+
Enter(event) {
|
|
355
|
+
const selection = recordCursor(event.currentTarget, scope);
|
|
356
|
+
send({
|
|
357
|
+
type: "INPUT.ENTER",
|
|
358
|
+
selection
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
}[event.key];
|
|
362
|
+
exec?.(event);
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
},
|
|
366
|
+
getDecrementTriggerProps() {
|
|
367
|
+
return normalize.button({
|
|
368
|
+
...parts.decrementTrigger.attrs,
|
|
369
|
+
dir: prop("dir"),
|
|
370
|
+
id: getDecrementTriggerId(scope),
|
|
371
|
+
disabled: isDecrementDisabled,
|
|
372
|
+
"data-disabled": dataAttr(isDecrementDisabled),
|
|
373
|
+
"aria-label": translations.decrementLabel,
|
|
374
|
+
type: "button",
|
|
375
|
+
tabIndex: -1,
|
|
376
|
+
"aria-controls": getInputId(scope),
|
|
377
|
+
"data-scrubbing": dataAttr(scrubbing),
|
|
378
|
+
onPointerDown(event) {
|
|
379
|
+
if (isDecrementDisabled) return;
|
|
380
|
+
if (!isLeftClick(event)) return;
|
|
381
|
+
send({
|
|
382
|
+
type: "TRIGGER.PRESS_DOWN",
|
|
383
|
+
hint: "decrement",
|
|
384
|
+
pointerType: event.pointerType
|
|
385
|
+
});
|
|
386
|
+
if (event.pointerType === "mouse") event.preventDefault();
|
|
387
|
+
if (event.pointerType === "touch") event.currentTarget?.focus({ preventScroll: true });
|
|
388
|
+
},
|
|
389
|
+
onPointerUp(event) {
|
|
390
|
+
send({
|
|
391
|
+
type: "TRIGGER.PRESS_UP",
|
|
392
|
+
hint: "decrement",
|
|
393
|
+
pointerType: event.pointerType
|
|
394
|
+
});
|
|
395
|
+
},
|
|
396
|
+
onPointerLeave() {
|
|
397
|
+
if (isDecrementDisabled) return;
|
|
398
|
+
send({
|
|
399
|
+
type: "TRIGGER.PRESS_UP",
|
|
400
|
+
hint: "decrement"
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
},
|
|
405
|
+
getIncrementTriggerProps() {
|
|
406
|
+
return normalize.button({
|
|
407
|
+
...parts.incrementTrigger.attrs,
|
|
408
|
+
dir: prop("dir"),
|
|
409
|
+
id: getIncrementTriggerId(scope),
|
|
410
|
+
disabled: isIncrementDisabled,
|
|
411
|
+
"data-disabled": dataAttr(isIncrementDisabled),
|
|
412
|
+
"aria-label": translations.incrementLabel,
|
|
413
|
+
type: "button",
|
|
414
|
+
tabIndex: -1,
|
|
415
|
+
"aria-controls": getInputId(scope),
|
|
416
|
+
"data-scrubbing": dataAttr(scrubbing),
|
|
417
|
+
onPointerDown(event) {
|
|
418
|
+
if (isIncrementDisabled || !isLeftClick(event)) return;
|
|
419
|
+
send({
|
|
420
|
+
type: "TRIGGER.PRESS_DOWN",
|
|
421
|
+
hint: "increment",
|
|
422
|
+
pointerType: event.pointerType
|
|
423
|
+
});
|
|
424
|
+
if (event.pointerType === "mouse") event.preventDefault();
|
|
425
|
+
if (event.pointerType === "touch") event.currentTarget?.focus({ preventScroll: true });
|
|
426
|
+
},
|
|
427
|
+
onPointerUp(event) {
|
|
428
|
+
send({
|
|
429
|
+
type: "TRIGGER.PRESS_UP",
|
|
430
|
+
hint: "increment",
|
|
431
|
+
pointerType: event.pointerType
|
|
432
|
+
});
|
|
433
|
+
},
|
|
434
|
+
onPointerLeave(event) {
|
|
435
|
+
send({
|
|
436
|
+
type: "TRIGGER.PRESS_UP",
|
|
437
|
+
hint: "increment",
|
|
438
|
+
pointerType: event.pointerType
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
},
|
|
443
|
+
getScrubberProps() {
|
|
444
|
+
return normalize.element({
|
|
445
|
+
...parts.scrubber.attrs,
|
|
446
|
+
dir: prop("dir"),
|
|
447
|
+
"data-disabled": dataAttr(disabled),
|
|
448
|
+
id: getScrubberId(scope),
|
|
449
|
+
role: "presentation",
|
|
450
|
+
"data-scrubbing": dataAttr(scrubbing),
|
|
451
|
+
onMouseDown(event) {
|
|
452
|
+
if (disabled) return;
|
|
453
|
+
if (!isLeftClick(event)) return;
|
|
454
|
+
const point = getEventPoint(event);
|
|
455
|
+
const dpr = getWindow(event.currentTarget).devicePixelRatio;
|
|
456
|
+
point.x = point.x - roundToDpr(7.5, dpr);
|
|
457
|
+
point.y = point.y - roundToDpr(7.5, dpr);
|
|
458
|
+
send({
|
|
459
|
+
type: "SCRUBBER.PRESS_DOWN",
|
|
460
|
+
point
|
|
461
|
+
});
|
|
462
|
+
event.preventDefault();
|
|
463
|
+
raf(() => {
|
|
464
|
+
setCaretToEnd(getInputEl(scope));
|
|
465
|
+
});
|
|
466
|
+
},
|
|
467
|
+
style: { cursor: disabled ? void 0 : "ew-resize" }
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
//#endregion
|
|
473
|
+
//#region src/machines/number-input/utils.ts
|
|
474
|
+
const createFormatter = (locale, options = {}) => {
|
|
475
|
+
return new Intl.NumberFormat(locale, options);
|
|
476
|
+
};
|
|
477
|
+
const createParser = (locale, options = {}) => {
|
|
478
|
+
return new NumberParser(locale, options);
|
|
479
|
+
};
|
|
480
|
+
const parseValue = (value, params) => {
|
|
481
|
+
const { prop, computed } = params;
|
|
482
|
+
if (!prop("formatOptions")) return parseFloat(value);
|
|
483
|
+
if (value === "") return NaN;
|
|
484
|
+
return computed("parser").parse(value);
|
|
485
|
+
};
|
|
486
|
+
const formatValue = (value, params) => {
|
|
487
|
+
const { prop, computed } = params;
|
|
488
|
+
if (Number.isNaN(value)) return "";
|
|
489
|
+
if (!prop("formatOptions")) return value.toString();
|
|
490
|
+
return computed("formatter").format(value);
|
|
491
|
+
};
|
|
492
|
+
const getDefaultStep = (step, formatOptions) => {
|
|
493
|
+
let defaultStep = step !== void 0 && !Number.isNaN(step) ? step : 1;
|
|
494
|
+
if (formatOptions?.style === "percent" && (step === void 0 || Number.isNaN(step))) defaultStep = .01;
|
|
495
|
+
return defaultStep;
|
|
496
|
+
};
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/machines/number-input/machine.ts
|
|
499
|
+
const { choose, guards, createMachine } = setup();
|
|
500
|
+
const { not, and } = guards;
|
|
501
|
+
const machine = createMachine({
|
|
502
|
+
props({ props }) {
|
|
503
|
+
const step = getDefaultStep(props.step, props.formatOptions);
|
|
504
|
+
return {
|
|
505
|
+
dir: "ltr",
|
|
506
|
+
locale: "en-US",
|
|
507
|
+
focusInputOnChange: true,
|
|
508
|
+
clampValueOnBlur: !props.allowOverflow,
|
|
509
|
+
allowOverflow: false,
|
|
510
|
+
inputMode: "decimal",
|
|
511
|
+
pattern: "-?[0-9]*(.[0-9]+)?",
|
|
512
|
+
defaultValue: "",
|
|
513
|
+
step,
|
|
514
|
+
min: Number.MIN_SAFE_INTEGER,
|
|
515
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
516
|
+
spinOnPress: true,
|
|
517
|
+
...props,
|
|
518
|
+
largeStep: props.largeStep ?? 10 * step,
|
|
519
|
+
smallStep: props.smallStep ?? step / 10,
|
|
520
|
+
translations: {
|
|
521
|
+
incrementLabel: "increment value",
|
|
522
|
+
decrementLabel: "decrease value",
|
|
523
|
+
...props.translations
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
},
|
|
527
|
+
initialState() {
|
|
528
|
+
return "idle";
|
|
529
|
+
},
|
|
530
|
+
context({ prop, bindable, getComputed }) {
|
|
531
|
+
return {
|
|
532
|
+
value: bindable(() => ({
|
|
533
|
+
defaultValue: prop("defaultValue"),
|
|
534
|
+
value: prop("value"),
|
|
535
|
+
onChange(value) {
|
|
536
|
+
const valueAsNumber = parseValue(value, {
|
|
537
|
+
computed: getComputed(),
|
|
538
|
+
prop
|
|
539
|
+
});
|
|
540
|
+
prop("onValueChange")?.({
|
|
541
|
+
value,
|
|
542
|
+
valueAsNumber
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
})),
|
|
546
|
+
hint: bindable(() => ({ defaultValue: null })),
|
|
547
|
+
scrubberCursorPoint: bindable(() => ({
|
|
548
|
+
defaultValue: null,
|
|
549
|
+
hash(value) {
|
|
550
|
+
return value ? `x:${value.x}, y:${value.y}` : "";
|
|
551
|
+
}
|
|
552
|
+
})),
|
|
553
|
+
fieldsetDisabled: bindable(() => ({ defaultValue: false }))
|
|
554
|
+
};
|
|
555
|
+
},
|
|
556
|
+
computed: {
|
|
557
|
+
isRtl: ({ prop }) => prop("dir") === "rtl",
|
|
558
|
+
valueAsNumber: ({ context, computed, prop }) => parseValue(context.get("value"), {
|
|
559
|
+
computed,
|
|
560
|
+
prop
|
|
561
|
+
}),
|
|
562
|
+
formattedValue: ({ computed, prop }) => formatValue(computed("valueAsNumber"), {
|
|
563
|
+
computed,
|
|
564
|
+
prop
|
|
565
|
+
}),
|
|
566
|
+
isAtMin: ({ computed, prop }) => isValueAtMin(computed("valueAsNumber"), prop("min")),
|
|
567
|
+
isAtMax: ({ computed, prop }) => isValueAtMax(computed("valueAsNumber"), prop("max")),
|
|
568
|
+
isOutOfRange: ({ computed, prop }) => !isValueWithinRange(computed("valueAsNumber"), prop("min"), prop("max")),
|
|
569
|
+
isValueEmpty: ({ context }) => context.get("value") === "",
|
|
570
|
+
isDisabled: ({ prop, context }) => !!prop("disabled") || context.get("fieldsetDisabled"),
|
|
571
|
+
canIncrement: ({ prop, computed }) => prop("allowOverflow") || !computed("isAtMax"),
|
|
572
|
+
canDecrement: ({ prop, computed }) => prop("allowOverflow") || !computed("isAtMin"),
|
|
573
|
+
valueText: ({ prop, context }) => prop("translations").valueText?.(context.get("value")),
|
|
574
|
+
formatter: memo(({ prop }) => [prop("locale"), prop("formatOptions")], ([locale, formatOptions]) => createFormatter(locale, formatOptions)),
|
|
575
|
+
parser: memo(({ prop }) => [prop("locale"), prop("formatOptions")], ([locale, formatOptions]) => createParser(locale, formatOptions))
|
|
576
|
+
},
|
|
577
|
+
watch({ track, action, context, computed, prop }) {
|
|
578
|
+
track([
|
|
579
|
+
() => context.get("value"),
|
|
580
|
+
() => prop("locale"),
|
|
581
|
+
() => JSON.stringify(prop("formatOptions"))
|
|
582
|
+
], () => {
|
|
583
|
+
action(["syncInputElement"]);
|
|
584
|
+
});
|
|
585
|
+
track([() => computed("isOutOfRange")], () => {
|
|
586
|
+
action(["invokeOnInvalid"]);
|
|
587
|
+
});
|
|
588
|
+
track([() => context.hash("scrubberCursorPoint")], () => {
|
|
589
|
+
action(["setVirtualCursorPosition"]);
|
|
590
|
+
});
|
|
591
|
+
},
|
|
592
|
+
effects: ["trackFormControl"],
|
|
593
|
+
on: {
|
|
594
|
+
"VALUE.SET": { actions: ["setRawValue"] },
|
|
595
|
+
"VALUE.CLEAR": { actions: ["clearValue"] },
|
|
596
|
+
"VALUE.INCREMENT": { actions: ["increment"] },
|
|
597
|
+
"VALUE.DECREMENT": { actions: ["decrement"] }
|
|
598
|
+
},
|
|
599
|
+
states: {
|
|
600
|
+
idle: { on: {
|
|
601
|
+
"TRIGGER.PRESS_DOWN": [{
|
|
602
|
+
guard: "isTouchPointer",
|
|
603
|
+
target: "before:spin",
|
|
604
|
+
actions: ["setHint"]
|
|
605
|
+
}, {
|
|
606
|
+
target: "before:spin",
|
|
607
|
+
actions: [
|
|
608
|
+
"focusInput",
|
|
609
|
+
"invokeOnFocus",
|
|
610
|
+
"setHint"
|
|
611
|
+
]
|
|
612
|
+
}],
|
|
613
|
+
"SCRUBBER.PRESS_DOWN": {
|
|
614
|
+
target: "scrubbing",
|
|
615
|
+
actions: [
|
|
616
|
+
"focusInput",
|
|
617
|
+
"invokeOnFocus",
|
|
618
|
+
"setHint",
|
|
619
|
+
"setCursorPoint"
|
|
620
|
+
]
|
|
621
|
+
},
|
|
622
|
+
"INPUT.FOCUS": {
|
|
623
|
+
target: "focused",
|
|
624
|
+
actions: ["focusInput", "invokeOnFocus"]
|
|
625
|
+
}
|
|
626
|
+
} },
|
|
627
|
+
focused: {
|
|
628
|
+
tags: ["focus"],
|
|
629
|
+
effects: ["attachWheelListener"],
|
|
630
|
+
on: {
|
|
631
|
+
"TRIGGER.PRESS_DOWN": [{
|
|
632
|
+
guard: "isTouchPointer",
|
|
633
|
+
target: "before:spin",
|
|
634
|
+
actions: ["setHint"]
|
|
635
|
+
}, {
|
|
636
|
+
target: "before:spin",
|
|
637
|
+
actions: ["focusInput", "setHint"]
|
|
638
|
+
}],
|
|
639
|
+
"SCRUBBER.PRESS_DOWN": {
|
|
640
|
+
target: "scrubbing",
|
|
641
|
+
actions: [
|
|
642
|
+
"focusInput",
|
|
643
|
+
"setHint",
|
|
644
|
+
"setCursorPoint"
|
|
645
|
+
]
|
|
646
|
+
},
|
|
647
|
+
"INPUT.ARROW_UP": { actions: ["increment"] },
|
|
648
|
+
"INPUT.ARROW_DOWN": { actions: ["decrement"] },
|
|
649
|
+
"INPUT.HOME": { actions: ["decrementToMin"] },
|
|
650
|
+
"INPUT.END": { actions: ["incrementToMax"] },
|
|
651
|
+
"INPUT.CHANGE": { actions: ["setValue", "setHint"] },
|
|
652
|
+
"INPUT.BLUR": [
|
|
653
|
+
{
|
|
654
|
+
guard: and("clampValueOnBlur", not("isValueEmpty"), not("isInRange")),
|
|
655
|
+
target: "idle",
|
|
656
|
+
actions: [
|
|
657
|
+
"setClampedValue",
|
|
658
|
+
"clearHint",
|
|
659
|
+
"invokeOnBlur",
|
|
660
|
+
"invokeOnValueCommit"
|
|
661
|
+
]
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
guard: not("isInRange"),
|
|
665
|
+
target: "idle",
|
|
666
|
+
actions: [
|
|
667
|
+
"setFormattedValue",
|
|
668
|
+
"clearHint",
|
|
669
|
+
"invokeOnBlur",
|
|
670
|
+
"invokeOnInvalid",
|
|
671
|
+
"invokeOnValueCommit"
|
|
672
|
+
]
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
target: "idle",
|
|
676
|
+
actions: [
|
|
677
|
+
"setFormattedValue",
|
|
678
|
+
"clearHint",
|
|
679
|
+
"invokeOnBlur",
|
|
680
|
+
"invokeOnValueCommit"
|
|
681
|
+
]
|
|
682
|
+
}
|
|
683
|
+
],
|
|
684
|
+
"INPUT.ENTER": { actions: [
|
|
685
|
+
"setFormattedValue",
|
|
686
|
+
"clearHint",
|
|
687
|
+
"invokeOnBlur",
|
|
688
|
+
"invokeOnValueCommit"
|
|
689
|
+
] }
|
|
690
|
+
}
|
|
691
|
+
},
|
|
692
|
+
"before:spin": {
|
|
693
|
+
tags: ["focus"],
|
|
694
|
+
effects: ["trackButtonDisabled", "waitForChangeDelay"],
|
|
695
|
+
entry: choose([{
|
|
696
|
+
guard: "isIncrementHint",
|
|
697
|
+
actions: ["increment"]
|
|
698
|
+
}, {
|
|
699
|
+
guard: "isDecrementHint",
|
|
700
|
+
actions: ["decrement"]
|
|
701
|
+
}]),
|
|
702
|
+
on: {
|
|
703
|
+
CHANGE_DELAY: {
|
|
704
|
+
target: "spinning",
|
|
705
|
+
guard: and("isInRange", "spinOnPress")
|
|
706
|
+
},
|
|
707
|
+
"TRIGGER.PRESS_UP": [{
|
|
708
|
+
guard: "isTouchPointer",
|
|
709
|
+
target: "focused",
|
|
710
|
+
actions: ["clearHint"]
|
|
711
|
+
}, {
|
|
712
|
+
target: "focused",
|
|
713
|
+
actions: ["focusInput", "clearHint"]
|
|
714
|
+
}]
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
spinning: {
|
|
718
|
+
tags: ["focus"],
|
|
719
|
+
effects: ["trackButtonDisabled", "spinValue"],
|
|
720
|
+
on: {
|
|
721
|
+
SPIN: [{
|
|
722
|
+
guard: "isIncrementHint",
|
|
723
|
+
actions: ["increment"]
|
|
724
|
+
}, {
|
|
725
|
+
guard: "isDecrementHint",
|
|
726
|
+
actions: ["decrement"]
|
|
727
|
+
}],
|
|
728
|
+
"TRIGGER.PRESS_UP": {
|
|
729
|
+
target: "focused",
|
|
730
|
+
actions: ["focusInput", "clearHint"]
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
},
|
|
734
|
+
scrubbing: {
|
|
735
|
+
tags: ["focus"],
|
|
736
|
+
effects: [
|
|
737
|
+
"activatePointerLock",
|
|
738
|
+
"trackMousemove",
|
|
739
|
+
"setupVirtualCursor",
|
|
740
|
+
"preventTextSelection"
|
|
741
|
+
],
|
|
742
|
+
on: {
|
|
743
|
+
"SCRUBBER.POINTER_UP": {
|
|
744
|
+
target: "focused",
|
|
745
|
+
actions: ["focusInput", "clearCursorPoint"]
|
|
746
|
+
},
|
|
747
|
+
"SCRUBBER.POINTER_MOVE": [{
|
|
748
|
+
guard: "isIncrementHint",
|
|
749
|
+
actions: ["increment", "setCursorPoint"]
|
|
750
|
+
}, {
|
|
751
|
+
guard: "isDecrementHint",
|
|
752
|
+
actions: ["decrement", "setCursorPoint"]
|
|
753
|
+
}]
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
},
|
|
757
|
+
implementations: {
|
|
758
|
+
guards: {
|
|
759
|
+
clampValueOnBlur: ({ prop }) => prop("clampValueOnBlur"),
|
|
760
|
+
spinOnPress: ({ prop }) => !!prop("spinOnPress"),
|
|
761
|
+
isInRange: ({ computed }) => !computed("isOutOfRange"),
|
|
762
|
+
isValueEmpty: ({ computed }) => computed("isValueEmpty"),
|
|
763
|
+
isDecrementHint: ({ context, event }) => (event.hint ?? context.get("hint")) === "decrement",
|
|
764
|
+
isIncrementHint: ({ context, event }) => (event.hint ?? context.get("hint")) === "increment",
|
|
765
|
+
isTouchPointer: ({ event }) => event.pointerType === "touch"
|
|
766
|
+
},
|
|
767
|
+
effects: {
|
|
768
|
+
waitForChangeDelay({ send }) {
|
|
769
|
+
const id = setTimeout(() => {
|
|
770
|
+
send({ type: "CHANGE_DELAY" });
|
|
771
|
+
}, 300);
|
|
772
|
+
return () => clearTimeout(id);
|
|
773
|
+
},
|
|
774
|
+
spinValue({ send }) {
|
|
775
|
+
const id = setInterval(() => {
|
|
776
|
+
send({ type: "SPIN" });
|
|
777
|
+
}, 50);
|
|
778
|
+
return () => clearInterval(id);
|
|
779
|
+
},
|
|
780
|
+
trackFormControl({ context, scope }) {
|
|
781
|
+
return trackFormControl(getInputEl(scope), {
|
|
782
|
+
onFieldsetDisabledChange(disabled) {
|
|
783
|
+
context.set("fieldsetDisabled", disabled);
|
|
784
|
+
},
|
|
785
|
+
onFormReset() {
|
|
786
|
+
context.set("value", context.initial("value"));
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
},
|
|
790
|
+
setupVirtualCursor({ context, scope }) {
|
|
791
|
+
const point = context.get("scrubberCursorPoint");
|
|
792
|
+
return setupVirtualCursor(scope, point);
|
|
793
|
+
},
|
|
794
|
+
preventTextSelection({ scope }) {
|
|
795
|
+
return preventTextSelection(scope);
|
|
796
|
+
},
|
|
797
|
+
trackButtonDisabled({ context, scope, send }) {
|
|
798
|
+
const hint = context.get("hint");
|
|
799
|
+
return observeAttributes(getPressedTriggerEl(scope, hint), {
|
|
800
|
+
attributes: ["disabled"],
|
|
801
|
+
callback() {
|
|
802
|
+
send({
|
|
803
|
+
type: "TRIGGER.PRESS_UP",
|
|
804
|
+
src: "attr"
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
},
|
|
809
|
+
attachWheelListener({ scope, send, prop }) {
|
|
810
|
+
const inputEl = getInputEl(scope);
|
|
811
|
+
if (!inputEl || !scope.isActiveElement(inputEl) || !prop("allowMouseWheel")) return;
|
|
812
|
+
function onWheel(event) {
|
|
813
|
+
event.preventDefault();
|
|
814
|
+
const dir = Math.sign(event.deltaY) * -1;
|
|
815
|
+
if (dir === 1) send({ type: "VALUE.INCREMENT" });
|
|
816
|
+
else if (dir === -1) send({ type: "VALUE.DECREMENT" });
|
|
817
|
+
}
|
|
818
|
+
return addDomEvent(inputEl, "wheel", onWheel, { passive: false });
|
|
819
|
+
},
|
|
820
|
+
activatePointerLock({ scope }) {
|
|
821
|
+
if (isSafari()) return;
|
|
822
|
+
return requestPointerLock(scope.getDoc());
|
|
823
|
+
},
|
|
824
|
+
trackMousemove({ scope, send, context, computed }) {
|
|
825
|
+
const doc = scope.getDoc();
|
|
826
|
+
function onMousemove(event) {
|
|
827
|
+
const point = context.get("scrubberCursorPoint");
|
|
828
|
+
const isRtl = computed("isRtl");
|
|
829
|
+
const value = getMousemoveValue(scope, {
|
|
830
|
+
point,
|
|
831
|
+
isRtl,
|
|
832
|
+
event
|
|
833
|
+
});
|
|
834
|
+
if (!value.hint) return;
|
|
835
|
+
send({
|
|
836
|
+
type: "SCRUBBER.POINTER_MOVE",
|
|
837
|
+
hint: value.hint,
|
|
838
|
+
point: value.point
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
function onMouseup() {
|
|
842
|
+
send({ type: "SCRUBBER.POINTER_UP" });
|
|
843
|
+
}
|
|
844
|
+
return callAll(addDomEvent(doc, "mousemove", onMousemove, false), addDomEvent(doc, "mouseup", onMouseup, false));
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
actions: {
|
|
848
|
+
focusInput({ scope, prop }) {
|
|
849
|
+
if (!prop("focusInputOnChange")) return;
|
|
850
|
+
const inputEl = getInputEl(scope);
|
|
851
|
+
if (scope.isActiveElement(inputEl)) return;
|
|
852
|
+
raf(() => inputEl?.focus({ preventScroll: true }));
|
|
853
|
+
},
|
|
854
|
+
increment({ context, event, prop, computed }) {
|
|
855
|
+
let nextValue = incrementValue(computed("valueAsNumber"), event.step ?? prop("step"));
|
|
856
|
+
if (!prop("allowOverflow")) nextValue = clampValue(nextValue, prop("min"), prop("max"));
|
|
857
|
+
context.set("value", formatValue(nextValue, {
|
|
858
|
+
computed,
|
|
859
|
+
prop
|
|
860
|
+
}));
|
|
861
|
+
},
|
|
862
|
+
decrement({ context, event, prop, computed }) {
|
|
863
|
+
let nextValue = decrementValue(computed("valueAsNumber"), event.step ?? prop("step"));
|
|
864
|
+
if (!prop("allowOverflow")) nextValue = clampValue(nextValue, prop("min"), prop("max"));
|
|
865
|
+
context.set("value", formatValue(nextValue, {
|
|
866
|
+
computed,
|
|
867
|
+
prop
|
|
868
|
+
}));
|
|
869
|
+
},
|
|
870
|
+
setClampedValue({ context, prop, computed }) {
|
|
871
|
+
const nextValue = clampValue(computed("valueAsNumber"), prop("min"), prop("max"));
|
|
872
|
+
context.set("value", formatValue(nextValue, {
|
|
873
|
+
computed,
|
|
874
|
+
prop
|
|
875
|
+
}));
|
|
876
|
+
},
|
|
877
|
+
setRawValue({ context, event, prop, computed }) {
|
|
878
|
+
let nextValue = typeof event.value === "number" ? event.value : parseValue(event.value, {
|
|
879
|
+
computed,
|
|
880
|
+
prop
|
|
881
|
+
});
|
|
882
|
+
if (!prop("allowOverflow")) nextValue = clampValue(nextValue, prop("min"), prop("max"));
|
|
883
|
+
context.set("value", formatValue(nextValue, {
|
|
884
|
+
computed,
|
|
885
|
+
prop
|
|
886
|
+
}));
|
|
887
|
+
},
|
|
888
|
+
setValue({ context, event }) {
|
|
889
|
+
const value = event.target?.value ?? event.value;
|
|
890
|
+
context.set("value", value);
|
|
891
|
+
},
|
|
892
|
+
clearValue({ context }) {
|
|
893
|
+
context.set("value", "");
|
|
894
|
+
},
|
|
895
|
+
incrementToMax({ context, prop, computed }) {
|
|
896
|
+
const value = formatValue(prop("max"), {
|
|
897
|
+
computed,
|
|
898
|
+
prop
|
|
899
|
+
});
|
|
900
|
+
context.set("value", value);
|
|
901
|
+
},
|
|
902
|
+
decrementToMin({ context, prop, computed }) {
|
|
903
|
+
const value = formatValue(prop("min"), {
|
|
904
|
+
computed,
|
|
905
|
+
prop
|
|
906
|
+
});
|
|
907
|
+
context.set("value", value);
|
|
908
|
+
},
|
|
909
|
+
setHint({ context, event }) {
|
|
910
|
+
context.set("hint", event.hint);
|
|
911
|
+
},
|
|
912
|
+
clearHint({ context }) {
|
|
913
|
+
context.set("hint", null);
|
|
914
|
+
},
|
|
915
|
+
invokeOnFocus({ computed, prop }) {
|
|
916
|
+
prop("onFocusChange")?.({
|
|
917
|
+
focused: true,
|
|
918
|
+
value: computed("formattedValue"),
|
|
919
|
+
valueAsNumber: computed("valueAsNumber")
|
|
920
|
+
});
|
|
921
|
+
},
|
|
922
|
+
invokeOnBlur({ computed, prop }) {
|
|
923
|
+
prop("onFocusChange")?.({
|
|
924
|
+
focused: false,
|
|
925
|
+
value: computed("formattedValue"),
|
|
926
|
+
valueAsNumber: computed("valueAsNumber")
|
|
927
|
+
});
|
|
928
|
+
},
|
|
929
|
+
invokeOnInvalid({ computed, prop, event }) {
|
|
930
|
+
if (event.type === "INPUT.CHANGE") return;
|
|
931
|
+
const reason = computed("valueAsNumber") > prop("max") ? "rangeOverflow" : "rangeUnderflow";
|
|
932
|
+
prop("onValueInvalid")?.({
|
|
933
|
+
reason,
|
|
934
|
+
value: computed("formattedValue"),
|
|
935
|
+
valueAsNumber: computed("valueAsNumber")
|
|
936
|
+
});
|
|
937
|
+
},
|
|
938
|
+
invokeOnValueCommit({ computed, prop }) {
|
|
939
|
+
prop("onValueCommit")?.({
|
|
940
|
+
value: computed("formattedValue"),
|
|
941
|
+
valueAsNumber: computed("valueAsNumber")
|
|
942
|
+
});
|
|
943
|
+
},
|
|
944
|
+
syncInputElement({ context, event, computed, scope }) {
|
|
945
|
+
const value = event.type.endsWith("CHANGE") ? context.get("value") : computed("formattedValue");
|
|
946
|
+
const inputEl = getInputEl(scope);
|
|
947
|
+
const sel = event.selection ?? recordCursor(inputEl, scope);
|
|
948
|
+
raf(() => {
|
|
949
|
+
setElementValue(inputEl, value);
|
|
950
|
+
restoreCursor(inputEl, sel, scope);
|
|
951
|
+
});
|
|
952
|
+
},
|
|
953
|
+
setFormattedValue({ context, computed, action }) {
|
|
954
|
+
context.set("value", computed("formattedValue"));
|
|
955
|
+
action(["syncInputElement"]);
|
|
956
|
+
},
|
|
957
|
+
setCursorPoint({ context, event }) {
|
|
958
|
+
context.set("scrubberCursorPoint", event.point);
|
|
959
|
+
},
|
|
960
|
+
clearCursorPoint({ context }) {
|
|
961
|
+
context.set("scrubberCursorPoint", null);
|
|
962
|
+
},
|
|
963
|
+
setVirtualCursorPosition({ context, scope }) {
|
|
964
|
+
const cursorEl = getCursorEl(scope);
|
|
965
|
+
const point = context.get("scrubberCursorPoint");
|
|
966
|
+
if (!cursorEl || !point) return;
|
|
967
|
+
cursorEl.style.transform = `translate3d(${point.x}px, ${point.y}px, 0px)`;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
});
|
|
972
|
+
//#endregion
|
|
973
|
+
//#region src/machines/number-input/props.ts
|
|
974
|
+
const props = createProps()([
|
|
975
|
+
"allowMouseWheel",
|
|
976
|
+
"allowOverflow",
|
|
977
|
+
"clampValueOnBlur",
|
|
978
|
+
"dir",
|
|
979
|
+
"disabled",
|
|
980
|
+
"focusInputOnChange",
|
|
981
|
+
"form",
|
|
982
|
+
"formatOptions",
|
|
983
|
+
"getRootNode",
|
|
984
|
+
"id",
|
|
985
|
+
"ids",
|
|
986
|
+
"inputMode",
|
|
987
|
+
"invalid",
|
|
988
|
+
"largeStep",
|
|
989
|
+
"locale",
|
|
990
|
+
"max",
|
|
991
|
+
"min",
|
|
992
|
+
"name",
|
|
993
|
+
"onFocusChange",
|
|
994
|
+
"onValueChange",
|
|
995
|
+
"onValueCommit",
|
|
996
|
+
"onValueInvalid",
|
|
997
|
+
"pattern",
|
|
998
|
+
"required",
|
|
999
|
+
"readOnly",
|
|
1000
|
+
"smallStep",
|
|
1001
|
+
"spinOnPress",
|
|
1002
|
+
"step",
|
|
1003
|
+
"translations",
|
|
1004
|
+
"value",
|
|
1005
|
+
"defaultValue"
|
|
1006
|
+
]);
|
|
1007
|
+
const splitProps = createSplitProps(props);
|
|
1008
|
+
//#endregion
|
|
1009
|
+
export { anatomy, connect, machine, props, splitProps };
|