@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,920 @@
|
|
|
1
|
+
import { t as createAnatomy } from "../../create-anatomy-B2q3wiaw.js";
|
|
2
|
+
import { L as ariaAttr, f as queryAll, p as contains, r as resizeObserverBorderBox, z as dataAttr } from "../../dom-query-e7fh0TEH.js";
|
|
3
|
+
import { m as isLeftClick, r as getEventKey, s as getEventTarget, t as addDomEvent } from "../../event-bTItRgiw.js";
|
|
4
|
+
import { c as getTabbables, l as isFocusable } from "../../tabbable-CDA1YMjZ.js";
|
|
5
|
+
import { i as raf } from "../../raf-Dhvm7f1e.js";
|
|
6
|
+
import { t as trackPointerMove } from "../../pointer-move-Tijb8Ptk.js";
|
|
7
|
+
import { _ as prevIndex, m as nextIndex, t as add, v as remove, x as uniq } from "../../array-C4KbHsha.js";
|
|
8
|
+
import { G as throttle, L as callAll, l as clampValue, n as createSplitProps, tt as isObject } from "../../utils-Cht5XaHf.js";
|
|
9
|
+
import { n as ensureProps } from "../../warning-CrzBpWT1.js";
|
|
10
|
+
import { r as createMachine } from "../../core-CJ0MZr3D.js";
|
|
11
|
+
import { n as getScrollSnapPositions, t as findSnapPoint } from "../../scroll-snap-DqMiFASa.js";
|
|
12
|
+
import { t as createProps } from "../../create-props-CgtcN_Qu.js";
|
|
13
|
+
//#region src/machines/carousel/anatomy.ts
|
|
14
|
+
const anatomy = createAnatomy("carousel").parts("root", "itemGroup", "item", "control", "nextTrigger", "prevTrigger", "indicatorGroup", "indicator", "autoplayTrigger", "progressText");
|
|
15
|
+
const parts = anatomy.build();
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/machines/carousel/dom.ts
|
|
18
|
+
const getRootId = (ctx) => ctx.ids?.root ?? `carousel:${ctx.id}`;
|
|
19
|
+
const getItemId = (ctx, index) => ctx.ids?.item?.(index) ?? `carousel:${ctx.id}:item:${index}`;
|
|
20
|
+
const getItemGroupId = (ctx) => ctx.ids?.itemGroup ?? `carousel:${ctx.id}:item-group`;
|
|
21
|
+
const getNextTriggerId = (ctx) => ctx.ids?.nextTrigger ?? `carousel:${ctx.id}:next-trigger`;
|
|
22
|
+
const getPrevTriggerId = (ctx) => ctx.ids?.prevTrigger ?? `carousel:${ctx.id}:prev-trigger`;
|
|
23
|
+
const getIndicatorGroupId = (ctx) => ctx.ids?.indicatorGroup ?? `carousel:${ctx.id}:indicator-group`;
|
|
24
|
+
const getIndicatorId = (ctx, index) => ctx.ids?.indicator?.(index) ?? `carousel:${ctx.id}:indicator:${index}`;
|
|
25
|
+
const getItemGroupEl = (ctx) => ctx.getById(getItemGroupId(ctx));
|
|
26
|
+
const getItemEls = (ctx) => queryAll(getItemGroupEl(ctx), `[data-part=item]`);
|
|
27
|
+
const getIndicatorEl = (ctx, page) => ctx.getById(getIndicatorId(ctx, page));
|
|
28
|
+
const syncTabIndex = (ctx) => {
|
|
29
|
+
const el = getItemGroupEl(ctx);
|
|
30
|
+
if (!el) return;
|
|
31
|
+
const tabbables = getTabbables(el);
|
|
32
|
+
el.setAttribute("tabindex", tabbables.length > 0 ? "-1" : "0");
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/machines/carousel/connect.ts
|
|
36
|
+
function connect(service, normalize) {
|
|
37
|
+
const { state, context, computed, send, scope, prop } = service;
|
|
38
|
+
const isPlaying = state.matches("autoplay");
|
|
39
|
+
const isDragging = state.matches("dragging");
|
|
40
|
+
const canScrollNext = computed("canScrollNext");
|
|
41
|
+
const canScrollPrev = computed("canScrollPrev");
|
|
42
|
+
const horizontal = computed("isHorizontal");
|
|
43
|
+
const autoSize = prop("autoSize");
|
|
44
|
+
const pageSnapPoints = Array.from(context.get("pageSnapPoints"));
|
|
45
|
+
const page = context.get("page");
|
|
46
|
+
const activePage = pageSnapPoints.length ? clampValue(page, 0, pageSnapPoints.length - 1) : 0;
|
|
47
|
+
const slidesPerPage = prop("slidesPerPage");
|
|
48
|
+
const padding = prop("padding");
|
|
49
|
+
const translations = prop("translations");
|
|
50
|
+
return {
|
|
51
|
+
isPlaying,
|
|
52
|
+
isDragging,
|
|
53
|
+
page: activePage,
|
|
54
|
+
pageSnapPoints,
|
|
55
|
+
canScrollNext,
|
|
56
|
+
canScrollPrev,
|
|
57
|
+
getProgress() {
|
|
58
|
+
return activePage / pageSnapPoints.length;
|
|
59
|
+
},
|
|
60
|
+
getProgressText() {
|
|
61
|
+
const details = {
|
|
62
|
+
page: activePage + 1,
|
|
63
|
+
totalPages: pageSnapPoints.length
|
|
64
|
+
};
|
|
65
|
+
return translations.progressText?.(details) ?? "";
|
|
66
|
+
},
|
|
67
|
+
scrollToIndex(index, instant) {
|
|
68
|
+
send({
|
|
69
|
+
type: "INDEX.SET",
|
|
70
|
+
index,
|
|
71
|
+
instant
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
scrollTo(index, instant) {
|
|
75
|
+
send({
|
|
76
|
+
type: "PAGE.SET",
|
|
77
|
+
index,
|
|
78
|
+
instant
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
scrollNext(instant) {
|
|
82
|
+
send({
|
|
83
|
+
type: "PAGE.NEXT",
|
|
84
|
+
instant
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
scrollPrev(instant) {
|
|
88
|
+
send({
|
|
89
|
+
type: "PAGE.PREV",
|
|
90
|
+
instant
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
play() {
|
|
94
|
+
send({ type: "AUTOPLAY.START" });
|
|
95
|
+
},
|
|
96
|
+
pause() {
|
|
97
|
+
send({ type: "AUTOPLAY.PAUSE" });
|
|
98
|
+
},
|
|
99
|
+
isInView(index) {
|
|
100
|
+
return Array.from(context.get("slidesInView")).includes(index);
|
|
101
|
+
},
|
|
102
|
+
refresh() {
|
|
103
|
+
send({ type: "SNAP.REFRESH" });
|
|
104
|
+
},
|
|
105
|
+
getRootProps() {
|
|
106
|
+
return normalize.element({
|
|
107
|
+
...parts.root.attrs,
|
|
108
|
+
id: getRootId(scope),
|
|
109
|
+
role: "region",
|
|
110
|
+
"aria-roledescription": "carousel",
|
|
111
|
+
"data-orientation": prop("orientation"),
|
|
112
|
+
dir: prop("dir"),
|
|
113
|
+
style: {
|
|
114
|
+
"--slides-per-page": slidesPerPage,
|
|
115
|
+
"--slide-spacing": prop("spacing"),
|
|
116
|
+
"--slide-item-size": autoSize ? "auto" : "calc(100% / var(--slides-per-page) - var(--slide-spacing) * (var(--slides-per-page) - 1) / var(--slides-per-page))"
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
getItemGroupProps() {
|
|
121
|
+
return normalize.element({
|
|
122
|
+
...parts.itemGroup.attrs,
|
|
123
|
+
id: getItemGroupId(scope),
|
|
124
|
+
"data-orientation": prop("orientation"),
|
|
125
|
+
"data-dragging": dataAttr(isDragging),
|
|
126
|
+
dir: prop("dir"),
|
|
127
|
+
"aria-live": isPlaying ? "off" : "polite",
|
|
128
|
+
onFocus(event) {
|
|
129
|
+
if (!contains(event.currentTarget, getEventTarget(event))) return;
|
|
130
|
+
send({ type: "VIEWPORT.FOCUS" });
|
|
131
|
+
},
|
|
132
|
+
onBlur(event) {
|
|
133
|
+
if (contains(event.currentTarget, event.relatedTarget)) return;
|
|
134
|
+
send({ type: "VIEWPORT.BLUR" });
|
|
135
|
+
},
|
|
136
|
+
onMouseDown(event) {
|
|
137
|
+
if (event.defaultPrevented) return;
|
|
138
|
+
if (!prop("allowMouseDrag")) return;
|
|
139
|
+
if (!isLeftClick(event)) return;
|
|
140
|
+
const target = getEventTarget(event);
|
|
141
|
+
if (isFocusable(target) && target !== event.currentTarget) return;
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
send({ type: "DRAGGING.START" });
|
|
144
|
+
},
|
|
145
|
+
onWheel: throttle((event) => {
|
|
146
|
+
const axis = prop("orientation") === "horizontal" ? "deltaX" : "deltaY";
|
|
147
|
+
if (event[axis] < 0 && !computed("canScrollPrev")) return;
|
|
148
|
+
if (event[axis] > 0 && !computed("canScrollNext")) return;
|
|
149
|
+
send({ type: "USER.SCROLL" });
|
|
150
|
+
}, 150),
|
|
151
|
+
onTouchStart() {
|
|
152
|
+
send({ type: "USER.SCROLL" });
|
|
153
|
+
},
|
|
154
|
+
style: {
|
|
155
|
+
display: autoSize ? "flex" : "grid",
|
|
156
|
+
gap: "var(--slide-spacing)",
|
|
157
|
+
scrollSnapType: [horizontal ? "x" : "y", prop("snapType")].join(" "),
|
|
158
|
+
gridAutoFlow: horizontal ? "column" : "row",
|
|
159
|
+
scrollbarWidth: "none",
|
|
160
|
+
overscrollBehaviorX: "contain",
|
|
161
|
+
[horizontal ? "gridAutoColumns" : "gridAutoRows"]: autoSize ? void 0 : "var(--slide-item-size)",
|
|
162
|
+
[horizontal ? "scrollPaddingInline" : "scrollPaddingBlock"]: padding,
|
|
163
|
+
[horizontal ? "paddingInline" : "paddingBlock"]: padding,
|
|
164
|
+
[horizontal ? "overflowX" : "overflowY"]: "auto"
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
getItemProps(props) {
|
|
169
|
+
const isInView = context.get("slidesInView").includes(props.index);
|
|
170
|
+
return normalize.element({
|
|
171
|
+
...parts.item.attrs,
|
|
172
|
+
id: getItemId(scope, props.index),
|
|
173
|
+
dir: prop("dir"),
|
|
174
|
+
role: "group",
|
|
175
|
+
"data-index": props.index,
|
|
176
|
+
"data-inview": dataAttr(isInView),
|
|
177
|
+
"aria-roledescription": "slide",
|
|
178
|
+
"data-orientation": prop("orientation"),
|
|
179
|
+
"aria-label": translations.item(props.index, prop("slideCount")),
|
|
180
|
+
"aria-hidden": ariaAttr(!isInView),
|
|
181
|
+
style: {
|
|
182
|
+
flex: "0 0 auto",
|
|
183
|
+
[horizontal ? "maxWidth" : "maxHeight"]: "100%",
|
|
184
|
+
scrollSnapAlign: (() => {
|
|
185
|
+
const snapAlign = props.snapAlign ?? "start";
|
|
186
|
+
const slidesPerMove = prop("slidesPerMove");
|
|
187
|
+
const perMove = slidesPerMove === "auto" ? Math.floor(prop("slidesPerPage")) : slidesPerMove;
|
|
188
|
+
return (props.index + perMove) % perMove === 0 ? snapAlign : void 0;
|
|
189
|
+
})()
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
getControlProps() {
|
|
194
|
+
return normalize.element({
|
|
195
|
+
...parts.control.attrs,
|
|
196
|
+
"data-orientation": prop("orientation")
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
getPrevTriggerProps() {
|
|
200
|
+
return normalize.button({
|
|
201
|
+
...parts.prevTrigger.attrs,
|
|
202
|
+
id: getPrevTriggerId(scope),
|
|
203
|
+
type: "button",
|
|
204
|
+
disabled: !canScrollPrev,
|
|
205
|
+
dir: prop("dir"),
|
|
206
|
+
"aria-label": translations.prevTrigger,
|
|
207
|
+
"data-orientation": prop("orientation"),
|
|
208
|
+
"aria-controls": getItemGroupId(scope),
|
|
209
|
+
onClick(event) {
|
|
210
|
+
if (event.defaultPrevented) return;
|
|
211
|
+
send({
|
|
212
|
+
type: "PAGE.PREV",
|
|
213
|
+
src: "trigger"
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
getNextTriggerProps() {
|
|
219
|
+
return normalize.button({
|
|
220
|
+
...parts.nextTrigger.attrs,
|
|
221
|
+
dir: prop("dir"),
|
|
222
|
+
id: getNextTriggerId(scope),
|
|
223
|
+
type: "button",
|
|
224
|
+
"aria-label": translations.nextTrigger,
|
|
225
|
+
"data-orientation": prop("orientation"),
|
|
226
|
+
"aria-controls": getItemGroupId(scope),
|
|
227
|
+
disabled: !canScrollNext,
|
|
228
|
+
onClick(event) {
|
|
229
|
+
if (event.defaultPrevented) return;
|
|
230
|
+
send({
|
|
231
|
+
type: "PAGE.NEXT",
|
|
232
|
+
src: "trigger"
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
getIndicatorGroupProps() {
|
|
238
|
+
return normalize.element({
|
|
239
|
+
...parts.indicatorGroup.attrs,
|
|
240
|
+
dir: prop("dir"),
|
|
241
|
+
id: getIndicatorGroupId(scope),
|
|
242
|
+
"data-orientation": prop("orientation"),
|
|
243
|
+
onKeyDown(event) {
|
|
244
|
+
if (event.defaultPrevented) return;
|
|
245
|
+
const src = "indicator";
|
|
246
|
+
const exec = {
|
|
247
|
+
ArrowDown(event) {
|
|
248
|
+
if (horizontal) return;
|
|
249
|
+
send({
|
|
250
|
+
type: "PAGE.NEXT",
|
|
251
|
+
src
|
|
252
|
+
});
|
|
253
|
+
event.preventDefault();
|
|
254
|
+
},
|
|
255
|
+
ArrowUp(event) {
|
|
256
|
+
if (horizontal) return;
|
|
257
|
+
send({
|
|
258
|
+
type: "PAGE.PREV",
|
|
259
|
+
src
|
|
260
|
+
});
|
|
261
|
+
event.preventDefault();
|
|
262
|
+
},
|
|
263
|
+
ArrowRight(event) {
|
|
264
|
+
if (!horizontal) return;
|
|
265
|
+
send({
|
|
266
|
+
type: "PAGE.NEXT",
|
|
267
|
+
src
|
|
268
|
+
});
|
|
269
|
+
event.preventDefault();
|
|
270
|
+
},
|
|
271
|
+
ArrowLeft(event) {
|
|
272
|
+
if (!horizontal) return;
|
|
273
|
+
send({
|
|
274
|
+
type: "PAGE.PREV",
|
|
275
|
+
src
|
|
276
|
+
});
|
|
277
|
+
event.preventDefault();
|
|
278
|
+
},
|
|
279
|
+
Home(event) {
|
|
280
|
+
send({
|
|
281
|
+
type: "PAGE.SET",
|
|
282
|
+
index: 0,
|
|
283
|
+
src
|
|
284
|
+
});
|
|
285
|
+
event.preventDefault();
|
|
286
|
+
},
|
|
287
|
+
End(event) {
|
|
288
|
+
send({
|
|
289
|
+
type: "PAGE.SET",
|
|
290
|
+
index: pageSnapPoints.length - 1,
|
|
291
|
+
src
|
|
292
|
+
});
|
|
293
|
+
event.preventDefault();
|
|
294
|
+
}
|
|
295
|
+
}[getEventKey(event, {
|
|
296
|
+
dir: prop("dir"),
|
|
297
|
+
orientation: prop("orientation")
|
|
298
|
+
})];
|
|
299
|
+
exec?.(event);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
},
|
|
303
|
+
getIndicatorProps(props) {
|
|
304
|
+
return normalize.button({
|
|
305
|
+
...parts.indicator.attrs,
|
|
306
|
+
dir: prop("dir"),
|
|
307
|
+
id: getIndicatorId(scope, props.index),
|
|
308
|
+
type: "button",
|
|
309
|
+
"data-orientation": prop("orientation"),
|
|
310
|
+
"data-index": props.index,
|
|
311
|
+
"data-readonly": dataAttr(props.readOnly),
|
|
312
|
+
"data-current": dataAttr(props.index === activePage),
|
|
313
|
+
"aria-label": translations.indicator(props.index),
|
|
314
|
+
onClick(event) {
|
|
315
|
+
if (event.defaultPrevented) return;
|
|
316
|
+
if (props.readOnly) return;
|
|
317
|
+
send({
|
|
318
|
+
type: "PAGE.SET",
|
|
319
|
+
index: props.index,
|
|
320
|
+
src: "indicator"
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
},
|
|
325
|
+
getAutoplayTriggerProps() {
|
|
326
|
+
return normalize.button({
|
|
327
|
+
...parts.autoplayTrigger.attrs,
|
|
328
|
+
type: "button",
|
|
329
|
+
"data-orientation": prop("orientation"),
|
|
330
|
+
"data-pressed": dataAttr(isPlaying),
|
|
331
|
+
"aria-label": isPlaying ? translations.autoplayStop : translations.autoplayStart,
|
|
332
|
+
onClick(event) {
|
|
333
|
+
if (event.defaultPrevented) return;
|
|
334
|
+
send({ type: isPlaying ? "AUTOPLAY.PAUSE" : "AUTOPLAY.START" });
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
},
|
|
338
|
+
getProgressTextProps() {
|
|
339
|
+
return normalize.element({ ...parts.progressText.attrs });
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
//#endregion
|
|
344
|
+
//#region src/machines/carousel/machine.ts
|
|
345
|
+
const DRIFT_THRESHOLD = 1;
|
|
346
|
+
const machine = createMachine({
|
|
347
|
+
props({ props }) {
|
|
348
|
+
ensureProps(props, ["slideCount"], "carousel");
|
|
349
|
+
return {
|
|
350
|
+
dir: "ltr",
|
|
351
|
+
defaultPage: 0,
|
|
352
|
+
orientation: "horizontal",
|
|
353
|
+
snapType: "mandatory",
|
|
354
|
+
loop: !!props.autoplay,
|
|
355
|
+
slidesPerPage: 1,
|
|
356
|
+
slidesPerMove: "auto",
|
|
357
|
+
spacing: "0px",
|
|
358
|
+
autoplay: false,
|
|
359
|
+
allowMouseDrag: false,
|
|
360
|
+
inViewThreshold: .6,
|
|
361
|
+
autoSize: false,
|
|
362
|
+
...props,
|
|
363
|
+
translations: {
|
|
364
|
+
nextTrigger: "Next slide",
|
|
365
|
+
prevTrigger: "Previous slide",
|
|
366
|
+
indicator: (index) => `Go to slide ${index + 1}`,
|
|
367
|
+
item: (index, count) => `${index + 1} of ${count}`,
|
|
368
|
+
autoplayStart: "Start slide rotation",
|
|
369
|
+
autoplayStop: "Stop slide rotation",
|
|
370
|
+
progressText: ({ page, totalPages }) => `${page} / ${totalPages}`,
|
|
371
|
+
...props.translations
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
},
|
|
375
|
+
refs() {
|
|
376
|
+
return { timeoutRef: void 0 };
|
|
377
|
+
},
|
|
378
|
+
initialState({ prop }) {
|
|
379
|
+
return prop("autoplay") ? "autoplay" : "idle";
|
|
380
|
+
},
|
|
381
|
+
context({ prop, bindable, getContext }) {
|
|
382
|
+
return {
|
|
383
|
+
page: bindable(() => ({
|
|
384
|
+
defaultValue: prop("defaultPage"),
|
|
385
|
+
value: prop("page"),
|
|
386
|
+
onChange(page) {
|
|
387
|
+
const pageSnapPoints = getContext().get("pageSnapPoints");
|
|
388
|
+
prop("onPageChange")?.({
|
|
389
|
+
page,
|
|
390
|
+
pageSnapPoint: pageSnapPoints[page]
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
})),
|
|
394
|
+
pageSnapPoints: bindable(() => {
|
|
395
|
+
return { defaultValue: prop("autoSize") ? Array.from({ length: prop("slideCount") }, (_, i) => i) : getPageSnapPoints(prop("slideCount"), prop("slidesPerMove"), prop("slidesPerPage")) };
|
|
396
|
+
}),
|
|
397
|
+
slidesInView: bindable(() => ({ defaultValue: [] }))
|
|
398
|
+
};
|
|
399
|
+
},
|
|
400
|
+
computed: {
|
|
401
|
+
isRtl: ({ prop }) => prop("dir") === "rtl",
|
|
402
|
+
isHorizontal: ({ prop }) => prop("orientation") === "horizontal",
|
|
403
|
+
canScrollNext: ({ prop, context }) => prop("loop") || context.get("page") < context.get("pageSnapPoints").length - 1,
|
|
404
|
+
canScrollPrev: ({ prop, context }) => prop("loop") || context.get("page") > 0,
|
|
405
|
+
autoplayInterval: ({ prop }) => {
|
|
406
|
+
const autoplay = prop("autoplay");
|
|
407
|
+
return isObject(autoplay) ? autoplay.delay : 4e3;
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
watch({ track, action, context, prop, send }) {
|
|
411
|
+
track([() => prop("slidesPerPage"), () => prop("slidesPerMove")], () => {
|
|
412
|
+
action(["setSnapPoints"]);
|
|
413
|
+
});
|
|
414
|
+
track([() => context.get("page")], () => {
|
|
415
|
+
action(["scrollToPage", "focusIndicatorEl"]);
|
|
416
|
+
});
|
|
417
|
+
track([
|
|
418
|
+
() => prop("orientation"),
|
|
419
|
+
() => prop("autoSize"),
|
|
420
|
+
() => prop("dir")
|
|
421
|
+
], () => {
|
|
422
|
+
action(["setSnapPoints", "scrollToPage"]);
|
|
423
|
+
});
|
|
424
|
+
track([() => prop("slideCount")], () => {
|
|
425
|
+
send({
|
|
426
|
+
type: "SNAP.REFRESH",
|
|
427
|
+
src: "slide.count"
|
|
428
|
+
});
|
|
429
|
+
});
|
|
430
|
+
track([() => !!prop("autoplay")], () => {
|
|
431
|
+
send({
|
|
432
|
+
type: prop("autoplay") ? "AUTOPLAY.START" : "AUTOPLAY.PAUSE",
|
|
433
|
+
src: "autoplay.prop.change"
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
},
|
|
437
|
+
on: {
|
|
438
|
+
"PAGE.NEXT": {
|
|
439
|
+
target: "idle",
|
|
440
|
+
actions: ["clearScrollEndTimer", "setNextPage"]
|
|
441
|
+
},
|
|
442
|
+
"PAGE.PREV": {
|
|
443
|
+
target: "idle",
|
|
444
|
+
actions: ["clearScrollEndTimer", "setPrevPage"]
|
|
445
|
+
},
|
|
446
|
+
"PAGE.SET": {
|
|
447
|
+
target: "idle",
|
|
448
|
+
actions: ["clearScrollEndTimer", "setPage"]
|
|
449
|
+
},
|
|
450
|
+
"INDEX.SET": {
|
|
451
|
+
target: "idle",
|
|
452
|
+
actions: ["clearScrollEndTimer", "setMatchingPage"]
|
|
453
|
+
},
|
|
454
|
+
"SNAP.REFRESH": { actions: ["setSnapPoints", "scrollToPageIfDrifted"] },
|
|
455
|
+
"PAGE.SCROLL": { actions: ["scrollToPage"] }
|
|
456
|
+
},
|
|
457
|
+
effects: [
|
|
458
|
+
"trackSlideMutation",
|
|
459
|
+
"trackSlideIntersections",
|
|
460
|
+
"trackSlideResize"
|
|
461
|
+
],
|
|
462
|
+
entry: ["setSnapPoints", "setPage"],
|
|
463
|
+
exit: ["clearScrollEndTimer"],
|
|
464
|
+
states: {
|
|
465
|
+
idle: { on: {
|
|
466
|
+
"DRAGGING.START": {
|
|
467
|
+
target: "dragging",
|
|
468
|
+
actions: ["invokeDragStart"]
|
|
469
|
+
},
|
|
470
|
+
"AUTOPLAY.START": {
|
|
471
|
+
target: "autoplay",
|
|
472
|
+
actions: ["invokeAutoplayStart"]
|
|
473
|
+
},
|
|
474
|
+
"USER.SCROLL": { target: "userScroll" },
|
|
475
|
+
"VIEWPORT.FOCUS": { target: "focus" }
|
|
476
|
+
} },
|
|
477
|
+
focus: {
|
|
478
|
+
effects: ["trackKeyboardScroll"],
|
|
479
|
+
on: {
|
|
480
|
+
"VIEWPORT.BLUR": { target: "idle" },
|
|
481
|
+
"PAGE.NEXT": { actions: ["clearScrollEndTimer", "setNextPage"] },
|
|
482
|
+
"PAGE.PREV": { actions: ["clearScrollEndTimer", "setPrevPage"] },
|
|
483
|
+
"PAGE.SET": { actions: ["clearScrollEndTimer", "setPage"] },
|
|
484
|
+
"INDEX.SET": { actions: ["clearScrollEndTimer", "setMatchingPage"] },
|
|
485
|
+
"USER.SCROLL": { target: "userScroll" }
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
dragging: {
|
|
489
|
+
effects: ["trackPointerMove"],
|
|
490
|
+
entry: ["disableScrollSnap"],
|
|
491
|
+
on: {
|
|
492
|
+
DRAGGING: { actions: ["scrollSlides", "invokeDragging"] },
|
|
493
|
+
"DRAGGING.END": {
|
|
494
|
+
target: "settling",
|
|
495
|
+
actions: ["endDragging"]
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
settling: {
|
|
500
|
+
effects: ["trackSettlingScroll"],
|
|
501
|
+
on: {
|
|
502
|
+
"DRAGGING.START": {
|
|
503
|
+
target: "dragging",
|
|
504
|
+
actions: ["clearScrollEndTimer", "invokeDragStart"]
|
|
505
|
+
},
|
|
506
|
+
"SCROLL.END": [{
|
|
507
|
+
guard: "isFocused",
|
|
508
|
+
target: "focus",
|
|
509
|
+
actions: [
|
|
510
|
+
"clearScrollEndTimer",
|
|
511
|
+
"setClosestPage",
|
|
512
|
+
"invokeDraggingEnd"
|
|
513
|
+
]
|
|
514
|
+
}, {
|
|
515
|
+
target: "idle",
|
|
516
|
+
actions: [
|
|
517
|
+
"clearScrollEndTimer",
|
|
518
|
+
"setClosestPage",
|
|
519
|
+
"invokeDraggingEnd"
|
|
520
|
+
]
|
|
521
|
+
}]
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
userScroll: {
|
|
525
|
+
effects: ["trackScroll"],
|
|
526
|
+
on: {
|
|
527
|
+
"DRAGGING.START": {
|
|
528
|
+
target: "dragging",
|
|
529
|
+
actions: ["invokeDragStart"]
|
|
530
|
+
},
|
|
531
|
+
"SCROLL.END": [{
|
|
532
|
+
guard: "isFocused",
|
|
533
|
+
target: "focus",
|
|
534
|
+
actions: ["setClosestPage"]
|
|
535
|
+
}, {
|
|
536
|
+
target: "idle",
|
|
537
|
+
actions: ["setClosestPage"]
|
|
538
|
+
}]
|
|
539
|
+
}
|
|
540
|
+
},
|
|
541
|
+
autoplay: {
|
|
542
|
+
effects: [
|
|
543
|
+
"trackDocumentVisibility",
|
|
544
|
+
"trackScroll",
|
|
545
|
+
"autoUpdateSlide"
|
|
546
|
+
],
|
|
547
|
+
exit: ["invokeAutoplayEnd"],
|
|
548
|
+
on: {
|
|
549
|
+
"AUTOPLAY.TICK": { actions: ["setNextPage", "invokeAutoplay"] },
|
|
550
|
+
"DRAGGING.START": {
|
|
551
|
+
target: "dragging",
|
|
552
|
+
actions: ["invokeDragStart"]
|
|
553
|
+
},
|
|
554
|
+
"AUTOPLAY.PAUSE": { target: "idle" }
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
implementations: {
|
|
559
|
+
guards: { isFocused: ({ scope }) => scope.isActiveElement(getItemGroupEl(scope)) },
|
|
560
|
+
effects: {
|
|
561
|
+
autoUpdateSlide({ computed, send }) {
|
|
562
|
+
const id = setInterval(() => {
|
|
563
|
+
send({
|
|
564
|
+
type: computed("canScrollNext") ? "AUTOPLAY.TICK" : "AUTOPLAY.PAUSE",
|
|
565
|
+
src: "autoplay.interval"
|
|
566
|
+
});
|
|
567
|
+
}, computed("autoplayInterval"));
|
|
568
|
+
return () => clearInterval(id);
|
|
569
|
+
},
|
|
570
|
+
trackSlideMutation({ scope, send }) {
|
|
571
|
+
const el = getItemGroupEl(scope);
|
|
572
|
+
if (!el) return;
|
|
573
|
+
const observer = new (scope.getWin()).MutationObserver(() => {
|
|
574
|
+
send({
|
|
575
|
+
type: "SNAP.REFRESH",
|
|
576
|
+
src: "slide.mutation"
|
|
577
|
+
});
|
|
578
|
+
syncTabIndex(scope);
|
|
579
|
+
});
|
|
580
|
+
syncTabIndex(scope);
|
|
581
|
+
observer.observe(el, {
|
|
582
|
+
childList: true,
|
|
583
|
+
subtree: true
|
|
584
|
+
});
|
|
585
|
+
return () => observer.disconnect();
|
|
586
|
+
},
|
|
587
|
+
trackSlideResize({ scope, send }) {
|
|
588
|
+
const el = getItemGroupEl(scope);
|
|
589
|
+
if (!el) return;
|
|
590
|
+
const exec = () => {
|
|
591
|
+
send({
|
|
592
|
+
type: "SNAP.REFRESH",
|
|
593
|
+
src: "slide.resize"
|
|
594
|
+
});
|
|
595
|
+
};
|
|
596
|
+
raf(() => {
|
|
597
|
+
exec();
|
|
598
|
+
raf(() => {
|
|
599
|
+
send({
|
|
600
|
+
type: "PAGE.SCROLL",
|
|
601
|
+
instant: true
|
|
602
|
+
});
|
|
603
|
+
});
|
|
604
|
+
});
|
|
605
|
+
const itemEls = getItemEls(scope);
|
|
606
|
+
itemEls.forEach(exec);
|
|
607
|
+
return callAll(...[resizeObserverBorderBox.observe(el, exec), ...itemEls.map((el) => resizeObserverBorderBox.observe(el, exec))]);
|
|
608
|
+
},
|
|
609
|
+
trackSlideIntersections({ scope, prop, context }) {
|
|
610
|
+
const el = getItemGroupEl(scope);
|
|
611
|
+
const observer = new (scope.getWin()).IntersectionObserver((entries) => {
|
|
612
|
+
const slidesInView = entries.reduce((acc, entry) => {
|
|
613
|
+
const target = entry.target;
|
|
614
|
+
const index = Number(target.dataset.index ?? "-1");
|
|
615
|
+
if (index == null || Number.isNaN(index) || index === -1) return acc;
|
|
616
|
+
return entry.isIntersecting ? add(acc, index) : remove(acc, index);
|
|
617
|
+
}, context.get("slidesInView"));
|
|
618
|
+
context.set("slidesInView", uniq(slidesInView));
|
|
619
|
+
}, {
|
|
620
|
+
root: el,
|
|
621
|
+
threshold: prop("inViewThreshold")
|
|
622
|
+
});
|
|
623
|
+
getItemEls(scope).forEach((slide) => observer.observe(slide));
|
|
624
|
+
return () => observer.disconnect();
|
|
625
|
+
},
|
|
626
|
+
trackScroll({ send, refs, scope }) {
|
|
627
|
+
const el = getItemGroupEl(scope);
|
|
628
|
+
if (!el) return;
|
|
629
|
+
const onScroll = () => {
|
|
630
|
+
clearTimeout(refs.get("timeoutRef"));
|
|
631
|
+
refs.set("timeoutRef", void 0);
|
|
632
|
+
refs.set("timeoutRef", setTimeout(() => {
|
|
633
|
+
send({ type: "SCROLL.END" });
|
|
634
|
+
}, 150));
|
|
635
|
+
};
|
|
636
|
+
return addDomEvent(el, "scroll", onScroll, { passive: true });
|
|
637
|
+
},
|
|
638
|
+
trackSettlingScroll({ send, refs, scope }) {
|
|
639
|
+
const el = getItemGroupEl(scope);
|
|
640
|
+
if (!el) return;
|
|
641
|
+
const startTimer = () => {
|
|
642
|
+
clearTimeout(refs.get("timeoutRef"));
|
|
643
|
+
refs.set("timeoutRef", void 0);
|
|
644
|
+
refs.set("timeoutRef", setTimeout(() => {
|
|
645
|
+
send({ type: "SCROLL.END" });
|
|
646
|
+
}, 200));
|
|
647
|
+
};
|
|
648
|
+
startTimer();
|
|
649
|
+
const onScroll = () => {
|
|
650
|
+
startTimer();
|
|
651
|
+
};
|
|
652
|
+
const cleanup = addDomEvent(el, "scroll", onScroll, { passive: true });
|
|
653
|
+
return () => {
|
|
654
|
+
cleanup();
|
|
655
|
+
clearTimeout(refs.get("timeoutRef"));
|
|
656
|
+
refs.set("timeoutRef", void 0);
|
|
657
|
+
};
|
|
658
|
+
},
|
|
659
|
+
trackDocumentVisibility({ scope, send }) {
|
|
660
|
+
const doc = scope.getDoc();
|
|
661
|
+
const onVisibilityChange = () => {
|
|
662
|
+
if (doc.visibilityState === "visible") return;
|
|
663
|
+
send({
|
|
664
|
+
type: "AUTOPLAY.PAUSE",
|
|
665
|
+
src: "doc.hidden"
|
|
666
|
+
});
|
|
667
|
+
};
|
|
668
|
+
return addDomEvent(doc, "visibilitychange", onVisibilityChange);
|
|
669
|
+
},
|
|
670
|
+
trackPointerMove({ scope, send }) {
|
|
671
|
+
return trackPointerMove(scope.getDoc(), {
|
|
672
|
+
onPointerMove({ event }) {
|
|
673
|
+
send({
|
|
674
|
+
type: "DRAGGING",
|
|
675
|
+
left: -event.movementX,
|
|
676
|
+
top: -event.movementY
|
|
677
|
+
});
|
|
678
|
+
},
|
|
679
|
+
onPointerUp() {
|
|
680
|
+
send({ type: "DRAGGING.END" });
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
},
|
|
684
|
+
trackKeyboardScroll({ scope, send, context }) {
|
|
685
|
+
const win = scope.getWin();
|
|
686
|
+
const onKeyDown = (event) => {
|
|
687
|
+
switch (event.key) {
|
|
688
|
+
case "ArrowRight":
|
|
689
|
+
event.preventDefault();
|
|
690
|
+
send({ type: "PAGE.NEXT" });
|
|
691
|
+
break;
|
|
692
|
+
case "ArrowLeft":
|
|
693
|
+
event.preventDefault();
|
|
694
|
+
send({ type: "PAGE.PREV" });
|
|
695
|
+
break;
|
|
696
|
+
case "Home":
|
|
697
|
+
event.preventDefault();
|
|
698
|
+
send({
|
|
699
|
+
type: "PAGE.SET",
|
|
700
|
+
index: 0
|
|
701
|
+
});
|
|
702
|
+
break;
|
|
703
|
+
case "End":
|
|
704
|
+
event.preventDefault();
|
|
705
|
+
send({
|
|
706
|
+
type: "PAGE.SET",
|
|
707
|
+
index: context.get("pageSnapPoints").length - 1
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
return addDomEvent(win, "keydown", onKeyDown, { capture: true });
|
|
712
|
+
}
|
|
713
|
+
},
|
|
714
|
+
actions: {
|
|
715
|
+
clearScrollEndTimer({ refs }) {
|
|
716
|
+
if (refs.get("timeoutRef") == null) return;
|
|
717
|
+
clearTimeout(refs.get("timeoutRef"));
|
|
718
|
+
refs.set("timeoutRef", void 0);
|
|
719
|
+
},
|
|
720
|
+
scrollToPage({ context, event, scope, computed, flush }) {
|
|
721
|
+
const behavior = event.instant ? "instant" : "smooth";
|
|
722
|
+
const index = clampValue(event.index ?? context.get("page"), 0, context.get("pageSnapPoints").length - 1);
|
|
723
|
+
const el = getItemGroupEl(scope);
|
|
724
|
+
if (!el) return;
|
|
725
|
+
const axis = computed("isHorizontal") ? "left" : "top";
|
|
726
|
+
flush(() => {
|
|
727
|
+
el.scrollTo({
|
|
728
|
+
[axis]: context.get("pageSnapPoints")[index],
|
|
729
|
+
behavior
|
|
730
|
+
});
|
|
731
|
+
});
|
|
732
|
+
},
|
|
733
|
+
scrollToPageIfDrifted({ context, scope, computed }) {
|
|
734
|
+
const el = getItemGroupEl(scope);
|
|
735
|
+
if (!el) return;
|
|
736
|
+
const snapPoint = context.get("pageSnapPoints")[context.get("page")];
|
|
737
|
+
if (snapPoint == null) return;
|
|
738
|
+
const scrollPos = computed("isHorizontal") ? el.scrollLeft : el.scrollTop;
|
|
739
|
+
if (Math.abs(scrollPos - snapPoint) <= DRIFT_THRESHOLD) return;
|
|
740
|
+
const axis = computed("isHorizontal") ? "left" : "top";
|
|
741
|
+
el.scrollTo({
|
|
742
|
+
[axis]: snapPoint,
|
|
743
|
+
behavior: "instant"
|
|
744
|
+
});
|
|
745
|
+
},
|
|
746
|
+
setClosestPage({ context, scope, computed }) {
|
|
747
|
+
const el = getItemGroupEl(scope);
|
|
748
|
+
if (!el) return;
|
|
749
|
+
const scrollPosition = computed("isHorizontal") ? el.scrollLeft : el.scrollTop;
|
|
750
|
+
const snapPoints = context.get("pageSnapPoints");
|
|
751
|
+
if (!snapPoints.length) return;
|
|
752
|
+
const page = snapPoints.reduce((closestIndex, snapPoint, index) => {
|
|
753
|
+
return Math.abs(snapPoint - scrollPosition) < Math.abs(snapPoints[closestIndex] - scrollPosition) ? index : closestIndex;
|
|
754
|
+
}, 0);
|
|
755
|
+
context.set("page", page);
|
|
756
|
+
},
|
|
757
|
+
setNextPage({ context, prop, state }) {
|
|
758
|
+
const loop = state.matches("autoplay") || prop("loop");
|
|
759
|
+
const page = nextIndex(context.get("pageSnapPoints"), context.get("page"), { loop });
|
|
760
|
+
context.set("page", page);
|
|
761
|
+
},
|
|
762
|
+
setPrevPage({ context, prop, state }) {
|
|
763
|
+
const loop = state.matches("autoplay") || prop("loop");
|
|
764
|
+
const page = prevIndex(context.get("pageSnapPoints"), context.get("page"), { loop });
|
|
765
|
+
context.set("page", page);
|
|
766
|
+
},
|
|
767
|
+
setMatchingPage({ context, event, computed, scope }) {
|
|
768
|
+
const el = getItemGroupEl(scope);
|
|
769
|
+
if (!el) return;
|
|
770
|
+
const snapPoint = findSnapPoint(el, computed("isHorizontal") ? "x" : "y", (node) => node.dataset.index === event.index.toString());
|
|
771
|
+
if (snapPoint == null) return;
|
|
772
|
+
const page = context.get("pageSnapPoints").findIndex((point) => Math.abs(point - snapPoint) < 1);
|
|
773
|
+
context.set("page", page);
|
|
774
|
+
},
|
|
775
|
+
setPage({ context, event }) {
|
|
776
|
+
const page = event.index ?? context.get("page");
|
|
777
|
+
context.set("page", page);
|
|
778
|
+
},
|
|
779
|
+
setSnapPoints({ context, computed, scope }) {
|
|
780
|
+
const el = getItemGroupEl(scope);
|
|
781
|
+
if (!el) return;
|
|
782
|
+
const scrollSnapPoints = getScrollSnapPositions(el);
|
|
783
|
+
const pageSnapPoints = computed("isHorizontal") ? scrollSnapPoints.x : scrollSnapPoints.y;
|
|
784
|
+
context.set("pageSnapPoints", pageSnapPoints);
|
|
785
|
+
if (!pageSnapPoints.length) return;
|
|
786
|
+
const index = clampValue(context.get("page"), 0, pageSnapPoints.length - 1);
|
|
787
|
+
context.set("page", index);
|
|
788
|
+
},
|
|
789
|
+
disableScrollSnap({ scope }) {
|
|
790
|
+
const el = getItemGroupEl(scope);
|
|
791
|
+
if (!el) return;
|
|
792
|
+
const styles = getComputedStyle(el);
|
|
793
|
+
el.dataset.scrollSnapType = styles.getPropertyValue("scroll-snap-type");
|
|
794
|
+
el.style.setProperty("scroll-snap-type", "none");
|
|
795
|
+
},
|
|
796
|
+
scrollSlides({ scope, event }) {
|
|
797
|
+
getItemGroupEl(scope)?.scrollBy({
|
|
798
|
+
left: event.left,
|
|
799
|
+
top: event.top,
|
|
800
|
+
behavior: "instant"
|
|
801
|
+
});
|
|
802
|
+
},
|
|
803
|
+
endDragging({ scope, context, computed }) {
|
|
804
|
+
const el = getItemGroupEl(scope);
|
|
805
|
+
if (!el) return;
|
|
806
|
+
const isHorizontal = computed("isHorizontal");
|
|
807
|
+
const scrollPos = isHorizontal ? el.scrollLeft : el.scrollTop;
|
|
808
|
+
const snapPoints = context.get("pageSnapPoints");
|
|
809
|
+
if (!snapPoints.length) return;
|
|
810
|
+
const closest = snapPoints.reduce((closest, curr) => {
|
|
811
|
+
return Math.abs(curr - scrollPos) < Math.abs(closest - scrollPos) ? curr : closest;
|
|
812
|
+
}, snapPoints[0]);
|
|
813
|
+
raf(() => {
|
|
814
|
+
el.scrollTo({
|
|
815
|
+
left: isHorizontal ? closest : el.scrollLeft,
|
|
816
|
+
top: isHorizontal ? el.scrollTop : closest,
|
|
817
|
+
behavior: "smooth"
|
|
818
|
+
});
|
|
819
|
+
const scrollSnapType = el.dataset.scrollSnapType;
|
|
820
|
+
if (scrollSnapType) {
|
|
821
|
+
el.style.setProperty("scroll-snap-type", scrollSnapType);
|
|
822
|
+
delete el.dataset.scrollSnapType;
|
|
823
|
+
}
|
|
824
|
+
});
|
|
825
|
+
},
|
|
826
|
+
focusIndicatorEl({ context, event, scope }) {
|
|
827
|
+
if (event.src !== "indicator") return;
|
|
828
|
+
const el = getIndicatorEl(scope, context.get("page"));
|
|
829
|
+
if (!el) return;
|
|
830
|
+
raf(() => el.focus({ preventScroll: true }));
|
|
831
|
+
},
|
|
832
|
+
invokeDragStart({ context, prop }) {
|
|
833
|
+
prop("onDragStatusChange")?.({
|
|
834
|
+
type: "dragging.start",
|
|
835
|
+
isDragging: true,
|
|
836
|
+
page: context.get("page")
|
|
837
|
+
});
|
|
838
|
+
},
|
|
839
|
+
invokeDragging({ context, prop }) {
|
|
840
|
+
prop("onDragStatusChange")?.({
|
|
841
|
+
type: "dragging",
|
|
842
|
+
isDragging: true,
|
|
843
|
+
page: context.get("page")
|
|
844
|
+
});
|
|
845
|
+
},
|
|
846
|
+
invokeDraggingEnd({ context, prop }) {
|
|
847
|
+
prop("onDragStatusChange")?.({
|
|
848
|
+
type: "dragging.end",
|
|
849
|
+
isDragging: false,
|
|
850
|
+
page: context.get("page")
|
|
851
|
+
});
|
|
852
|
+
},
|
|
853
|
+
invokeAutoplay({ context, prop }) {
|
|
854
|
+
prop("onAutoplayStatusChange")?.({
|
|
855
|
+
type: "autoplay",
|
|
856
|
+
isPlaying: true,
|
|
857
|
+
page: context.get("page")
|
|
858
|
+
});
|
|
859
|
+
},
|
|
860
|
+
invokeAutoplayStart({ context, prop }) {
|
|
861
|
+
prop("onAutoplayStatusChange")?.({
|
|
862
|
+
type: "autoplay.start",
|
|
863
|
+
isPlaying: true,
|
|
864
|
+
page: context.get("page")
|
|
865
|
+
});
|
|
866
|
+
},
|
|
867
|
+
invokeAutoplayEnd({ context, prop }) {
|
|
868
|
+
prop("onAutoplayStatusChange")?.({
|
|
869
|
+
type: "autoplay.stop",
|
|
870
|
+
isPlaying: false,
|
|
871
|
+
page: context.get("page")
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
});
|
|
877
|
+
function getPageSnapPoints(totalSlides, slidesPerMove, slidesPerPage) {
|
|
878
|
+
if (totalSlides == null || slidesPerPage <= 0) return [];
|
|
879
|
+
const snapPoints = [];
|
|
880
|
+
const perMove = slidesPerMove === "auto" ? Math.floor(slidesPerPage) : slidesPerMove;
|
|
881
|
+
if (perMove <= 0) return [];
|
|
882
|
+
for (let i = 0; i < totalSlides; i += perMove) {
|
|
883
|
+
if (i + slidesPerPage > totalSlides) break;
|
|
884
|
+
snapPoints.push(i);
|
|
885
|
+
}
|
|
886
|
+
return snapPoints;
|
|
887
|
+
}
|
|
888
|
+
//#endregion
|
|
889
|
+
//#region src/machines/carousel/props.ts
|
|
890
|
+
const props = createProps()([
|
|
891
|
+
"dir",
|
|
892
|
+
"getRootNode",
|
|
893
|
+
"id",
|
|
894
|
+
"ids",
|
|
895
|
+
"loop",
|
|
896
|
+
"page",
|
|
897
|
+
"defaultPage",
|
|
898
|
+
"onPageChange",
|
|
899
|
+
"orientation",
|
|
900
|
+
"slideCount",
|
|
901
|
+
"slidesPerPage",
|
|
902
|
+
"slidesPerMove",
|
|
903
|
+
"spacing",
|
|
904
|
+
"padding",
|
|
905
|
+
"autoplay",
|
|
906
|
+
"allowMouseDrag",
|
|
907
|
+
"inViewThreshold",
|
|
908
|
+
"translations",
|
|
909
|
+
"snapType",
|
|
910
|
+
"autoSize",
|
|
911
|
+
"onDragStatusChange",
|
|
912
|
+
"onAutoplayStatusChange"
|
|
913
|
+
]);
|
|
914
|
+
const splitProps = createSplitProps(props);
|
|
915
|
+
const indicatorProps = createProps()(["index", "readOnly"]);
|
|
916
|
+
const splitIndicatorProps = createSplitProps(indicatorProps);
|
|
917
|
+
const itemProps = createProps()(["index", "snapAlign"]);
|
|
918
|
+
const splitItemProps = createSplitProps(itemProps);
|
|
919
|
+
//#endregion
|
|
920
|
+
export { anatomy, connect, indicatorProps, itemProps, machine, props, splitIndicatorProps, splitItemProps, splitProps };
|