@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,1115 @@
|
|
|
1
|
+
import { t as createAnatomy } from "../../create-anatomy-B2q3wiaw.js";
|
|
2
|
+
import { S as getWindow, k as isHTMLElement, p as contains, z as dataAttr } from "../../dom-query-e7fh0TEH.js";
|
|
3
|
+
import { t as getComputedStyle$1 } from "../../computed-style-B1MKlCoo.js";
|
|
4
|
+
import { i as raf } from "../../raf-Dhvm7f1e.js";
|
|
5
|
+
import { r as waitForPromise, t as waitForElement } from "../../wait-for-CI5Ye-Lo.js";
|
|
6
|
+
import { _ as prevIndex, m as nextIndex } from "../../array-C4KbHsha.js";
|
|
7
|
+
import { t as isEqual } from "../../equal-DtrP8DPh.js";
|
|
8
|
+
import { F as toPx, it as isString, n as createSplitProps } from "../../utils-Cht5XaHf.js";
|
|
9
|
+
import { i as warn } from "../../warning-CrzBpWT1.js";
|
|
10
|
+
import { m as mergeProps, n as createGuards, r as createMachine } from "../../core-CJ0MZr3D.js";
|
|
11
|
+
import { t as trackInteractOutside } from "../../interact-outside-BjqIunFx.js";
|
|
12
|
+
import { t as trackDismissableBranch } from "../../dismissable-KM1jPtNQ.js";
|
|
13
|
+
import { t as trapFocus } from "../../focus-trap-89E5I9nm.js";
|
|
14
|
+
import { n as getPlacement, r as getPlacementSide, t as getPlacementStyles } from "../../popper-DzBZzAe4.js";
|
|
15
|
+
import { t as createProps } from "../../create-props-CgtcN_Qu.js";
|
|
16
|
+
//#region src/machines/tour/anatomy.ts
|
|
17
|
+
const anatomy = createAnatomy("tour").parts("content", "actionTrigger", "closeTrigger", "progressText", "title", "description", "positioner", "arrow", "arrowTip", "backdrop", "spotlight");
|
|
18
|
+
const parts = anatomy.build();
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/machines/tour/dom.ts
|
|
21
|
+
const getPositionerId = (ctx) => ctx.ids?.positioner ?? `tour:${ctx.id}:positioner`;
|
|
22
|
+
const getContentId = (ctx) => ctx.ids?.content ?? `tour:${ctx.id}:content`;
|
|
23
|
+
const getTitleId = (ctx) => ctx.ids?.title ?? `tour:${ctx.id}:title`;
|
|
24
|
+
const getDescriptionId = (ctx) => ctx.ids?.description ?? `tour:${ctx.id}:description`;
|
|
25
|
+
const getArrowId = (ctx) => ctx.ids?.arrow ?? `tour:${ctx.id}:arrow`;
|
|
26
|
+
const getBackdropId = (ctx) => ctx.ids?.backdrop ?? `tour:${ctx.id}:backdrop`;
|
|
27
|
+
const getContentEl = (ctx) => ctx.getById(getContentId(ctx));
|
|
28
|
+
const getPositionerEl = (ctx) => ctx.getById(getPositionerId(ctx));
|
|
29
|
+
const getBackdropEl = (ctx) => ctx.getById(getBackdropId(ctx));
|
|
30
|
+
function syncZIndex(scope) {
|
|
31
|
+
return raf(() => {
|
|
32
|
+
const contentEl = getContentEl(scope);
|
|
33
|
+
if (!contentEl) return;
|
|
34
|
+
const styles = getComputedStyle$1(contentEl);
|
|
35
|
+
const positionerEl = getPositionerEl(scope);
|
|
36
|
+
const backdropEl = getBackdropEl(scope);
|
|
37
|
+
if (positionerEl) {
|
|
38
|
+
positionerEl.style.setProperty("--z-index", styles.zIndex);
|
|
39
|
+
positionerEl.style.setProperty("z-index", "var(--z-index)");
|
|
40
|
+
}
|
|
41
|
+
if (backdropEl) backdropEl.style.setProperty("--z-index", styles.zIndex);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/machines/tour/utils/clip-path.ts
|
|
46
|
+
function getClipPath(options) {
|
|
47
|
+
const { radius = 0, rootSize: { width: w, height: h }, rect: { width, height, x, y }, enabled = true } = options;
|
|
48
|
+
if (!enabled) return "";
|
|
49
|
+
const { topLeft = 0, topRight = 0, bottomRight = 0, bottomLeft = 0 } = typeof radius === "number" ? {
|
|
50
|
+
topLeft: radius,
|
|
51
|
+
topRight: radius,
|
|
52
|
+
bottomRight: radius,
|
|
53
|
+
bottomLeft: radius
|
|
54
|
+
} : radius;
|
|
55
|
+
return `M${w},${h}\
|
|
56
|
+
H0\
|
|
57
|
+
V0\
|
|
58
|
+
H${w}\
|
|
59
|
+
V${h}\
|
|
60
|
+
Z\
|
|
61
|
+
M${x + topLeft},${y}\
|
|
62
|
+
a${topLeft},${topLeft},0,0,0-${topLeft},${topLeft}\
|
|
63
|
+
V${height + y - bottomLeft}\
|
|
64
|
+
a${bottomLeft},${bottomLeft},0,0,0,${bottomLeft},${bottomLeft}\
|
|
65
|
+
H${width + x - bottomRight}\
|
|
66
|
+
a${bottomRight},${bottomRight},0,0,0,${bottomRight}-${bottomRight}\
|
|
67
|
+
V${y + topRight}\
|
|
68
|
+
a${topRight},${topRight},0,0,0-${topRight}-${topRight}\
|
|
69
|
+
Z`;
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/machines/tour/utils/step.ts
|
|
73
|
+
const isTooltipStep = (step) => {
|
|
74
|
+
return step?.type === "tooltip";
|
|
75
|
+
};
|
|
76
|
+
const isDialogStep = (step) => {
|
|
77
|
+
return step?.type === "dialog";
|
|
78
|
+
};
|
|
79
|
+
const isWaitStep = (step) => {
|
|
80
|
+
return step?.type === "wait";
|
|
81
|
+
};
|
|
82
|
+
const getEffectiveSteps = (steps) => {
|
|
83
|
+
return steps.filter((step) => step.type !== "wait");
|
|
84
|
+
};
|
|
85
|
+
const getProgress = (steps, stepIndex) => {
|
|
86
|
+
const effectiveLength = getEffectiveSteps(steps).length;
|
|
87
|
+
return (stepIndex + 1) / effectiveLength;
|
|
88
|
+
};
|
|
89
|
+
const getEffectiveStepIndex = (steps, stepId) => {
|
|
90
|
+
const effectiveSteps = getEffectiveSteps(steps);
|
|
91
|
+
return findStepIndex(effectiveSteps, stepId);
|
|
92
|
+
};
|
|
93
|
+
const isTooltipPlacement = (placement) => {
|
|
94
|
+
return placement != null && placement != "center";
|
|
95
|
+
};
|
|
96
|
+
const normalizeStep = (step) => {
|
|
97
|
+
if (step.type === "floating") return {
|
|
98
|
+
backdrop: false,
|
|
99
|
+
arrow: false,
|
|
100
|
+
placement: "bottom-end",
|
|
101
|
+
...step
|
|
102
|
+
};
|
|
103
|
+
if (step.target == null || step.type === "dialog") return {
|
|
104
|
+
type: "dialog",
|
|
105
|
+
placement: "center",
|
|
106
|
+
backdrop: true,
|
|
107
|
+
...step
|
|
108
|
+
};
|
|
109
|
+
if (!step.type || step.type === "tooltip") return {
|
|
110
|
+
type: "tooltip",
|
|
111
|
+
arrow: true,
|
|
112
|
+
backdrop: true,
|
|
113
|
+
...step
|
|
114
|
+
};
|
|
115
|
+
return step;
|
|
116
|
+
};
|
|
117
|
+
const findStep = (steps, id) => {
|
|
118
|
+
const res = id != null ? steps.find((step) => step.id === id) : null;
|
|
119
|
+
return res ? normalizeStep(res) : null;
|
|
120
|
+
};
|
|
121
|
+
const findStepIndex = (steps, id) => {
|
|
122
|
+
return id != null ? steps.findIndex((step) => step.id === id) : -1;
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/machines/tour/connect.ts
|
|
126
|
+
function connect(service, normalize) {
|
|
127
|
+
const { state, context, computed, send, prop, scope } = service;
|
|
128
|
+
const open = state.hasTag("open");
|
|
129
|
+
const steps = Array.from(context.get("steps"));
|
|
130
|
+
const stepIndex = computed("stepIndex");
|
|
131
|
+
const step = computed("step");
|
|
132
|
+
const hasTarget = typeof step?.target?.() !== "undefined";
|
|
133
|
+
const hasNextStep = computed("hasNextStep");
|
|
134
|
+
const hasPrevStep = computed("hasPrevStep");
|
|
135
|
+
const firstStep = computed("isFirstStep");
|
|
136
|
+
const lastStep = computed("isLastStep");
|
|
137
|
+
const placement = context.get("currentPlacement");
|
|
138
|
+
const placementSide = isTooltipPlacement(placement) ? getPlacementSide(placement) : void 0;
|
|
139
|
+
const targetRect = context.get("targetRect");
|
|
140
|
+
const popperStyles = getPlacementStyles({
|
|
141
|
+
strategy: "absolute",
|
|
142
|
+
placement: isTooltipPlacement(placement) ? placement : void 0
|
|
143
|
+
});
|
|
144
|
+
const clipPath = getClipPath({
|
|
145
|
+
enabled: isTooltipStep(step),
|
|
146
|
+
rect: targetRect,
|
|
147
|
+
rootSize: context.get("boundarySize"),
|
|
148
|
+
radius: prop("spotlightRadius")
|
|
149
|
+
});
|
|
150
|
+
const actionMap = {
|
|
151
|
+
next() {
|
|
152
|
+
send({
|
|
153
|
+
type: "STEP.NEXT",
|
|
154
|
+
src: "actionTrigger"
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
prev() {
|
|
158
|
+
send({
|
|
159
|
+
type: "STEP.PREV",
|
|
160
|
+
src: "actionTrigger"
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
dismiss() {
|
|
164
|
+
send({
|
|
165
|
+
type: "DISMISS",
|
|
166
|
+
src: "actionTrigger"
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
skip() {
|
|
170
|
+
send({
|
|
171
|
+
type: "SKIP",
|
|
172
|
+
src: "actionTrigger"
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
goto(id) {
|
|
176
|
+
send({
|
|
177
|
+
type: "STEP.SET",
|
|
178
|
+
value: id,
|
|
179
|
+
src: "actionTrigger"
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
return {
|
|
184
|
+
open,
|
|
185
|
+
totalSteps: steps.length,
|
|
186
|
+
stepIndex,
|
|
187
|
+
step,
|
|
188
|
+
hasNextStep,
|
|
189
|
+
hasPrevStep,
|
|
190
|
+
firstStep,
|
|
191
|
+
lastStep,
|
|
192
|
+
addStep(step) {
|
|
193
|
+
const next = steps.concat(step);
|
|
194
|
+
send({
|
|
195
|
+
type: "STEPS.SET",
|
|
196
|
+
value: next,
|
|
197
|
+
src: "addStep"
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
removeStep(id) {
|
|
201
|
+
const next = steps.filter((step) => step.id !== id);
|
|
202
|
+
send({
|
|
203
|
+
type: "STEPS.SET",
|
|
204
|
+
value: next,
|
|
205
|
+
src: "removeStep"
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
updateStep(id, stepOverrides) {
|
|
209
|
+
const next = steps.map((step) => step.id === id ? mergeProps(step, stepOverrides) : step);
|
|
210
|
+
send({
|
|
211
|
+
type: "STEPS.SET",
|
|
212
|
+
value: next,
|
|
213
|
+
src: "updateStep"
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
setSteps(steps) {
|
|
217
|
+
send({
|
|
218
|
+
type: "STEPS.SET",
|
|
219
|
+
value: steps,
|
|
220
|
+
src: "setSteps"
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
setStep(id) {
|
|
224
|
+
send({
|
|
225
|
+
type: "STEP.SET",
|
|
226
|
+
value: id
|
|
227
|
+
});
|
|
228
|
+
},
|
|
229
|
+
start(id) {
|
|
230
|
+
send({
|
|
231
|
+
type: "START",
|
|
232
|
+
value: id
|
|
233
|
+
});
|
|
234
|
+
},
|
|
235
|
+
isValidStep(id) {
|
|
236
|
+
return steps.some((step) => step.id === id);
|
|
237
|
+
},
|
|
238
|
+
isCurrentStep(id) {
|
|
239
|
+
return Boolean(step?.id === id);
|
|
240
|
+
},
|
|
241
|
+
next() {
|
|
242
|
+
send({ type: "STEP.NEXT" });
|
|
243
|
+
},
|
|
244
|
+
prev() {
|
|
245
|
+
send({ type: "STEP.PREV" });
|
|
246
|
+
},
|
|
247
|
+
getProgressPercent() {
|
|
248
|
+
const index = getEffectiveStepIndex(steps, step?.id);
|
|
249
|
+
const total = getEffectiveSteps(steps).length;
|
|
250
|
+
return (index + 1) / total * 100;
|
|
251
|
+
},
|
|
252
|
+
getProgressText() {
|
|
253
|
+
const details = {
|
|
254
|
+
current: getEffectiveStepIndex(steps, step?.id),
|
|
255
|
+
total: getEffectiveSteps(steps).length
|
|
256
|
+
};
|
|
257
|
+
return prop("translations").progressText?.(details) ?? "";
|
|
258
|
+
},
|
|
259
|
+
getBackdropProps() {
|
|
260
|
+
return normalize.element({
|
|
261
|
+
...parts.backdrop.attrs,
|
|
262
|
+
id: getBackdropId(scope),
|
|
263
|
+
dir: prop("dir"),
|
|
264
|
+
hidden: !open,
|
|
265
|
+
"data-state": open ? "open" : "closed",
|
|
266
|
+
"data-type": step?.type,
|
|
267
|
+
style: {
|
|
268
|
+
"--tour-layer": 0,
|
|
269
|
+
clipPath: isTooltipStep(step) ? `path("${clipPath}")` : void 0,
|
|
270
|
+
position: isDialogStep(step) ? "fixed" : "absolute",
|
|
271
|
+
inset: "0",
|
|
272
|
+
willChange: isTooltipStep(step) ? "clip-path" : void 0
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
},
|
|
276
|
+
getSpotlightProps() {
|
|
277
|
+
return normalize.element({
|
|
278
|
+
...parts.spotlight.attrs,
|
|
279
|
+
hidden: !open || !step?.target?.(),
|
|
280
|
+
style: {
|
|
281
|
+
"--tour-layer": 1,
|
|
282
|
+
position: "absolute",
|
|
283
|
+
width: toPx(targetRect.width),
|
|
284
|
+
height: toPx(targetRect.height),
|
|
285
|
+
left: toPx(targetRect.x),
|
|
286
|
+
top: toPx(targetRect.y),
|
|
287
|
+
borderRadius: toPx(prop("spotlightRadius")),
|
|
288
|
+
pointerEvents: "none"
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
},
|
|
292
|
+
getProgressTextProps() {
|
|
293
|
+
return normalize.element({ ...parts.progressText.attrs });
|
|
294
|
+
},
|
|
295
|
+
getPositionerProps() {
|
|
296
|
+
return normalize.element({
|
|
297
|
+
...parts.positioner.attrs,
|
|
298
|
+
dir: prop("dir"),
|
|
299
|
+
id: getPositionerId(scope),
|
|
300
|
+
"data-type": step?.type,
|
|
301
|
+
"data-placement": placement,
|
|
302
|
+
"data-side": placementSide,
|
|
303
|
+
style: {
|
|
304
|
+
"--tour-layer": 2,
|
|
305
|
+
...step?.type === "tooltip" && popperStyles.floating
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
},
|
|
309
|
+
getArrowProps() {
|
|
310
|
+
return normalize.element({
|
|
311
|
+
id: getArrowId(scope),
|
|
312
|
+
...parts.arrow.attrs,
|
|
313
|
+
dir: prop("dir"),
|
|
314
|
+
hidden: step?.type !== "tooltip",
|
|
315
|
+
style: step?.type === "tooltip" ? popperStyles.arrow : void 0,
|
|
316
|
+
opacity: hasTarget ? void 0 : 0
|
|
317
|
+
});
|
|
318
|
+
},
|
|
319
|
+
getArrowTipProps() {
|
|
320
|
+
return normalize.element({
|
|
321
|
+
...parts.arrowTip.attrs,
|
|
322
|
+
dir: prop("dir"),
|
|
323
|
+
style: popperStyles.arrowTip
|
|
324
|
+
});
|
|
325
|
+
},
|
|
326
|
+
getContentProps() {
|
|
327
|
+
return normalize.element({
|
|
328
|
+
...parts.content.attrs,
|
|
329
|
+
id: getContentId(scope),
|
|
330
|
+
dir: prop("dir"),
|
|
331
|
+
role: "alertdialog",
|
|
332
|
+
"aria-modal": "true",
|
|
333
|
+
"aria-live": "polite",
|
|
334
|
+
"aria-atomic": "true",
|
|
335
|
+
hidden: !open,
|
|
336
|
+
"data-state": open ? "open" : "closed",
|
|
337
|
+
"data-type": step?.type,
|
|
338
|
+
"data-placement": placement,
|
|
339
|
+
"data-side": placementSide,
|
|
340
|
+
"data-step": step?.id,
|
|
341
|
+
"aria-labelledby": getTitleId(scope),
|
|
342
|
+
"aria-describedby": getDescriptionId(scope),
|
|
343
|
+
tabIndex: -1,
|
|
344
|
+
onKeyDown(event) {
|
|
345
|
+
if (event.defaultPrevented) return;
|
|
346
|
+
if (!prop("keyboardNavigation")) return;
|
|
347
|
+
const isRtl = prop("dir") === "rtl";
|
|
348
|
+
switch (event.key) {
|
|
349
|
+
case "ArrowRight":
|
|
350
|
+
if (!hasNextStep) return;
|
|
351
|
+
send({
|
|
352
|
+
type: isRtl ? "STEP.PREV" : "STEP.NEXT",
|
|
353
|
+
src: "keydown"
|
|
354
|
+
});
|
|
355
|
+
break;
|
|
356
|
+
case "ArrowLeft":
|
|
357
|
+
if (!hasPrevStep) return;
|
|
358
|
+
send({
|
|
359
|
+
type: isRtl ? "STEP.NEXT" : "STEP.PREV",
|
|
360
|
+
src: "keydown"
|
|
361
|
+
});
|
|
362
|
+
break;
|
|
363
|
+
default: break;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
},
|
|
368
|
+
getTitleProps() {
|
|
369
|
+
return normalize.element({
|
|
370
|
+
...parts.title.attrs,
|
|
371
|
+
id: getTitleId(scope),
|
|
372
|
+
"data-placement": hasTarget ? placement : "center",
|
|
373
|
+
"data-side": hasTarget ? placementSide : void 0
|
|
374
|
+
});
|
|
375
|
+
},
|
|
376
|
+
getDescriptionProps() {
|
|
377
|
+
return normalize.element({
|
|
378
|
+
...parts.description.attrs,
|
|
379
|
+
id: getDescriptionId(scope),
|
|
380
|
+
"data-placement": hasTarget ? placement : "center",
|
|
381
|
+
"data-side": hasTarget ? placementSide : void 0
|
|
382
|
+
});
|
|
383
|
+
},
|
|
384
|
+
getCloseTriggerProps() {
|
|
385
|
+
return normalize.element({
|
|
386
|
+
...parts.closeTrigger.attrs,
|
|
387
|
+
"data-type": step?.type,
|
|
388
|
+
"aria-label": prop("translations").close,
|
|
389
|
+
onClick: actionMap.dismiss
|
|
390
|
+
});
|
|
391
|
+
},
|
|
392
|
+
getActionTriggerProps(props) {
|
|
393
|
+
const { action, attrs } = props.action;
|
|
394
|
+
let actionProps = {};
|
|
395
|
+
switch (action) {
|
|
396
|
+
case "next":
|
|
397
|
+
actionProps = {
|
|
398
|
+
"data-type": "next",
|
|
399
|
+
disabled: !hasNextStep,
|
|
400
|
+
"data-disabled": dataAttr(!hasNextStep),
|
|
401
|
+
"aria-label": prop("translations").nextStep,
|
|
402
|
+
onClick: actionMap.next
|
|
403
|
+
};
|
|
404
|
+
break;
|
|
405
|
+
case "prev":
|
|
406
|
+
actionProps = {
|
|
407
|
+
"data-type": "prev",
|
|
408
|
+
disabled: !hasPrevStep,
|
|
409
|
+
"data-disabled": dataAttr(!hasPrevStep),
|
|
410
|
+
"aria-label": prop("translations").prevStep,
|
|
411
|
+
onClick: actionMap.prev
|
|
412
|
+
};
|
|
413
|
+
break;
|
|
414
|
+
case "dismiss":
|
|
415
|
+
actionProps = {
|
|
416
|
+
"data-type": "close",
|
|
417
|
+
"aria-label": prop("translations").close,
|
|
418
|
+
onClick: actionMap.dismiss
|
|
419
|
+
};
|
|
420
|
+
break;
|
|
421
|
+
default:
|
|
422
|
+
actionProps = {
|
|
423
|
+
"data-type": "custom",
|
|
424
|
+
onClick() {
|
|
425
|
+
if (typeof action === "function") action(actionMap);
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
return normalize.button({
|
|
431
|
+
...parts.actionTrigger.attrs,
|
|
432
|
+
type: "button",
|
|
433
|
+
...attrs,
|
|
434
|
+
...actionProps
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
//#endregion
|
|
440
|
+
//#region src/machines/tour/utils/rect.ts
|
|
441
|
+
function getFrameElement(win) {
|
|
442
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
443
|
+
}
|
|
444
|
+
const normalizeEventPoint = (event) => {
|
|
445
|
+
let clientX = event.clientX;
|
|
446
|
+
let clientY = event.clientY;
|
|
447
|
+
let win = event.view || window;
|
|
448
|
+
let frame = getFrameElement(win);
|
|
449
|
+
while (frame) {
|
|
450
|
+
const iframeRect = frame.getBoundingClientRect();
|
|
451
|
+
const css = getComputedStyle(frame);
|
|
452
|
+
const left = iframeRect.left + (frame.clientLeft + parseFloat(css.paddingLeft));
|
|
453
|
+
const top = iframeRect.top + (frame.clientTop + parseFloat(css.paddingTop));
|
|
454
|
+
clientX += left;
|
|
455
|
+
clientY += top;
|
|
456
|
+
win = getWindow(frame);
|
|
457
|
+
frame = getFrameElement(win);
|
|
458
|
+
}
|
|
459
|
+
return {
|
|
460
|
+
clientX,
|
|
461
|
+
clientY
|
|
462
|
+
};
|
|
463
|
+
};
|
|
464
|
+
function isEventInRect(rect, event) {
|
|
465
|
+
const { clientX, clientY } = normalizeEventPoint(event);
|
|
466
|
+
return rect.y <= clientY && clientY <= rect.y + rect.height && rect.x <= clientX && clientX <= rect.x + rect.width;
|
|
467
|
+
}
|
|
468
|
+
function offset(r, i) {
|
|
469
|
+
const dx = i.x || 0;
|
|
470
|
+
const dy = i.y || 0;
|
|
471
|
+
return {
|
|
472
|
+
x: r.x - dx,
|
|
473
|
+
y: r.y - dy,
|
|
474
|
+
width: r.width + dx + dx,
|
|
475
|
+
height: r.height + dy + dy
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region src/machines/tour/machine.ts
|
|
480
|
+
const { and } = createGuards();
|
|
481
|
+
const machine = createMachine({
|
|
482
|
+
props({ props }) {
|
|
483
|
+
return {
|
|
484
|
+
preventInteraction: false,
|
|
485
|
+
closeOnInteractOutside: true,
|
|
486
|
+
closeOnEscape: true,
|
|
487
|
+
keyboardNavigation: true,
|
|
488
|
+
spotlightOffset: {
|
|
489
|
+
x: 10,
|
|
490
|
+
y: 10
|
|
491
|
+
},
|
|
492
|
+
spotlightRadius: 4,
|
|
493
|
+
...props,
|
|
494
|
+
translations: {
|
|
495
|
+
nextStep: "next step",
|
|
496
|
+
prevStep: "previous step",
|
|
497
|
+
close: "close tour",
|
|
498
|
+
progressText: ({ current, total }) => `${current + 1} of ${total}`,
|
|
499
|
+
skip: "skip tour",
|
|
500
|
+
...props.translations
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
},
|
|
504
|
+
initialState() {
|
|
505
|
+
return "tourInactive";
|
|
506
|
+
},
|
|
507
|
+
context({ prop, bindable, getContext }) {
|
|
508
|
+
return {
|
|
509
|
+
steps: bindable(() => ({
|
|
510
|
+
defaultValue: prop("steps") ?? [],
|
|
511
|
+
onChange(value) {
|
|
512
|
+
prop("onStepsChange")?.({ steps: value });
|
|
513
|
+
}
|
|
514
|
+
})),
|
|
515
|
+
stepId: bindable(() => ({
|
|
516
|
+
defaultValue: prop("stepId"),
|
|
517
|
+
sync: true,
|
|
518
|
+
onChange(value) {
|
|
519
|
+
const steps = getContext().get("steps");
|
|
520
|
+
const stepIndex = findStepIndex(steps, value);
|
|
521
|
+
const progress = getProgress(steps, stepIndex);
|
|
522
|
+
const complete = stepIndex == steps.length - 1;
|
|
523
|
+
prop("onStepChange")?.({
|
|
524
|
+
stepId: value,
|
|
525
|
+
stepIndex,
|
|
526
|
+
totalSteps: steps.length,
|
|
527
|
+
complete,
|
|
528
|
+
progress
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
})),
|
|
532
|
+
resolvedTarget: bindable(() => ({
|
|
533
|
+
sync: true,
|
|
534
|
+
defaultValue: null
|
|
535
|
+
})),
|
|
536
|
+
targetRect: bindable(() => ({ defaultValue: {
|
|
537
|
+
width: 0,
|
|
538
|
+
height: 0,
|
|
539
|
+
x: 0,
|
|
540
|
+
y: 0
|
|
541
|
+
} })),
|
|
542
|
+
boundarySize: bindable(() => ({ defaultValue: {
|
|
543
|
+
width: 0,
|
|
544
|
+
height: 0
|
|
545
|
+
} })),
|
|
546
|
+
currentPlacement: bindable(() => ({ defaultValue: void 0 }))
|
|
547
|
+
};
|
|
548
|
+
},
|
|
549
|
+
computed: {
|
|
550
|
+
stepIndex: ({ context }) => findStepIndex(context.get("steps"), context.get("stepId")),
|
|
551
|
+
step: ({ context }) => findStep(context.get("steps"), context.get("stepId")),
|
|
552
|
+
hasNextStep: ({ context, computed }) => computed("stepIndex") < context.get("steps").length - 1,
|
|
553
|
+
hasPrevStep: ({ computed }) => computed("stepIndex") > 0,
|
|
554
|
+
isFirstStep: ({ computed }) => computed("stepIndex") === 0,
|
|
555
|
+
isLastStep: ({ context, computed }) => computed("stepIndex") === context.get("steps").length - 1,
|
|
556
|
+
progress: ({ context, computed }) => {
|
|
557
|
+
const effectiveLength = getEffectiveSteps(context.get("steps")).length;
|
|
558
|
+
return (computed("stepIndex") + 1) / effectiveLength;
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
watch({ track, context, refs, send }) {
|
|
562
|
+
track([() => context.get("stepId")], () => {
|
|
563
|
+
if (refs.get("_internalChange")) {
|
|
564
|
+
refs.set("_internalChange", false);
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
const step = findStep(context.get("steps"), context.get("stepId"));
|
|
568
|
+
context.set("resolvedTarget", step?.target?.() ?? null);
|
|
569
|
+
syncTargetAttrsFromContext({
|
|
570
|
+
context,
|
|
571
|
+
refs
|
|
572
|
+
});
|
|
573
|
+
queueMicrotask(() => {
|
|
574
|
+
send({ type: "STEP.CHANGED" });
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
},
|
|
578
|
+
effects: ["trackBoundarySize"],
|
|
579
|
+
exit: ["cleanupAll"],
|
|
580
|
+
on: {
|
|
581
|
+
"STEPS.SET": { actions: ["setSteps", "validateSteps"] },
|
|
582
|
+
"STEP.CHANGED": [
|
|
583
|
+
{
|
|
584
|
+
guard: and("isValidStep", "hasResolvedTarget"),
|
|
585
|
+
target: "running.scrolling",
|
|
586
|
+
reenter: true,
|
|
587
|
+
actions: ["cleanupStepEffect"]
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
guard: and("isValidStep", "hasTarget"),
|
|
591
|
+
target: "running.resolving",
|
|
592
|
+
reenter: true,
|
|
593
|
+
actions: ["cleanupStepEffect"]
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
guard: and("isValidStep", "isWaitingStep"),
|
|
597
|
+
target: "running.waiting",
|
|
598
|
+
reenter: true,
|
|
599
|
+
actions: ["cleanupStepEffect"]
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
guard: "isValidStep",
|
|
603
|
+
target: "running.active",
|
|
604
|
+
reenter: true,
|
|
605
|
+
actions: ["cleanupStepEffect"]
|
|
606
|
+
}
|
|
607
|
+
],
|
|
608
|
+
"STEP.ROUTE": [
|
|
609
|
+
{
|
|
610
|
+
guard: and("isValidStep", "hasResolvedTarget"),
|
|
611
|
+
target: "running.scrolling",
|
|
612
|
+
reenter: true
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
guard: and("isValidStep", "hasTarget"),
|
|
616
|
+
target: "running.resolving",
|
|
617
|
+
reenter: true
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
guard: and("isValidStep", "isWaitingStep"),
|
|
621
|
+
target: "running.waiting",
|
|
622
|
+
reenter: true
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
guard: "isValidStep",
|
|
626
|
+
target: "running.active",
|
|
627
|
+
reenter: true
|
|
628
|
+
}
|
|
629
|
+
]
|
|
630
|
+
},
|
|
631
|
+
states: {
|
|
632
|
+
tourInactive: {
|
|
633
|
+
tags: ["closed"],
|
|
634
|
+
entry: ["validateSteps"],
|
|
635
|
+
on: { START: { actions: ["setInitialStep", "invokeOnStart"] } }
|
|
636
|
+
},
|
|
637
|
+
running: {
|
|
638
|
+
initial: "resolving",
|
|
639
|
+
on: {
|
|
640
|
+
"STEP.SET": { actions: ["setStep"] },
|
|
641
|
+
"STEP.NEXT": { actions: ["setNextStep"] },
|
|
642
|
+
"STEP.PREV": { actions: ["setPrevStep"] },
|
|
643
|
+
DISMISS: [{
|
|
644
|
+
guard: "isLastStep",
|
|
645
|
+
target: "tourInactive",
|
|
646
|
+
actions: [
|
|
647
|
+
"cleanupAll",
|
|
648
|
+
"invokeOnDismiss",
|
|
649
|
+
"invokeOnComplete",
|
|
650
|
+
"clearStep"
|
|
651
|
+
]
|
|
652
|
+
}, {
|
|
653
|
+
target: "tourInactive",
|
|
654
|
+
actions: [
|
|
655
|
+
"cleanupAll",
|
|
656
|
+
"invokeOnDismiss",
|
|
657
|
+
"clearStep"
|
|
658
|
+
]
|
|
659
|
+
}],
|
|
660
|
+
SKIP: {
|
|
661
|
+
target: "tourInactive",
|
|
662
|
+
actions: [
|
|
663
|
+
"cleanupAll",
|
|
664
|
+
"invokeOnSkip",
|
|
665
|
+
"clearStep"
|
|
666
|
+
]
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
states: {
|
|
670
|
+
resolving: {
|
|
671
|
+
tags: ["closed"],
|
|
672
|
+
effects: ["waitForTarget", "waitForTargetTimeout"],
|
|
673
|
+
on: {
|
|
674
|
+
"TARGET.NOT_FOUND": {
|
|
675
|
+
target: "tourInactive",
|
|
676
|
+
actions: ["invokeOnNotFound", "clearStep"]
|
|
677
|
+
},
|
|
678
|
+
"TARGET.RESOLVED": {
|
|
679
|
+
target: "scrolling",
|
|
680
|
+
actions: ["setResolvedTarget"]
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
scrolling: {
|
|
685
|
+
tags: ["open"],
|
|
686
|
+
entry: ["scrollToTarget"],
|
|
687
|
+
effects: [
|
|
688
|
+
"waitForScrollEnd",
|
|
689
|
+
"trapFocus",
|
|
690
|
+
"trackPlacement",
|
|
691
|
+
"trackDismissableBranch",
|
|
692
|
+
"trackInteractOutside",
|
|
693
|
+
"trackEscapeKeydown"
|
|
694
|
+
],
|
|
695
|
+
on: { "SCROLL.END": { target: "active" } }
|
|
696
|
+
},
|
|
697
|
+
waiting: { tags: ["closed"] },
|
|
698
|
+
active: {
|
|
699
|
+
tags: ["open"],
|
|
700
|
+
effects: [
|
|
701
|
+
"trapFocus",
|
|
702
|
+
"trackPlacement",
|
|
703
|
+
"trackDismissableBranch",
|
|
704
|
+
"trackInteractOutside",
|
|
705
|
+
"trackEscapeKeydown"
|
|
706
|
+
]
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
implementations: {
|
|
712
|
+
guards: {
|
|
713
|
+
isLastStep: ({ computed, context }) => computed("stepIndex") === context.get("steps").length - 1,
|
|
714
|
+
isValidStep: ({ context }) => context.get("stepId") != null,
|
|
715
|
+
hasTarget: ({ computed }) => computed("step")?.target != null,
|
|
716
|
+
hasResolvedTarget: ({ context }) => context.get("resolvedTarget") != null,
|
|
717
|
+
isWaitingStep: ({ computed }) => computed("step")?.type === "wait"
|
|
718
|
+
},
|
|
719
|
+
actions: {
|
|
720
|
+
scrollToTarget({ context }) {
|
|
721
|
+
context.get("resolvedTarget")?.scrollIntoView({
|
|
722
|
+
behavior: "instant",
|
|
723
|
+
block: "nearest",
|
|
724
|
+
inline: "nearest"
|
|
725
|
+
});
|
|
726
|
+
},
|
|
727
|
+
setSteps(params) {
|
|
728
|
+
const { event, context } = params;
|
|
729
|
+
context.set("steps", event.value);
|
|
730
|
+
},
|
|
731
|
+
setStep(params) {
|
|
732
|
+
const { event } = params;
|
|
733
|
+
if (event.value == null) return;
|
|
734
|
+
const steps = params.context.get("steps");
|
|
735
|
+
performStepTransition(params, isString(event.value) ? findStepIndex(steps, event.value) : event.value);
|
|
736
|
+
},
|
|
737
|
+
clearStep({ context, refs }) {
|
|
738
|
+
refs.get("_targetCleanup")?.();
|
|
739
|
+
refs.set("_targetCleanup", void 0);
|
|
740
|
+
context.set("targetRect", {
|
|
741
|
+
width: 0,
|
|
742
|
+
height: 0,
|
|
743
|
+
x: 0,
|
|
744
|
+
y: 0
|
|
745
|
+
});
|
|
746
|
+
context.set("resolvedTarget", null);
|
|
747
|
+
refs.set("_internalChange", true);
|
|
748
|
+
context.set("stepId", null);
|
|
749
|
+
},
|
|
750
|
+
setInitialStep(params) {
|
|
751
|
+
const { context, event } = params;
|
|
752
|
+
const steps = context.get("steps");
|
|
753
|
+
if (steps.length === 0) return;
|
|
754
|
+
performStepTransition(params, isString(event.value) ? findStepIndex(steps, event.value) : event.value ?? 0);
|
|
755
|
+
},
|
|
756
|
+
setNextStep(params) {
|
|
757
|
+
performStepTransition(params, nextIndex(params.context.get("steps"), params.computed("stepIndex")));
|
|
758
|
+
},
|
|
759
|
+
setPrevStep(params) {
|
|
760
|
+
performStepTransition(params, prevIndex(params.context.get("steps"), params.computed("stepIndex")));
|
|
761
|
+
},
|
|
762
|
+
invokeOnStart({ prop, context, computed }) {
|
|
763
|
+
prop("onStatusChange")?.({
|
|
764
|
+
status: "started",
|
|
765
|
+
stepId: context.get("stepId"),
|
|
766
|
+
stepIndex: computed("stepIndex")
|
|
767
|
+
});
|
|
768
|
+
},
|
|
769
|
+
invokeOnDismiss({ prop, context, computed }) {
|
|
770
|
+
prop("onStatusChange")?.({
|
|
771
|
+
status: "dismissed",
|
|
772
|
+
stepId: context.get("stepId"),
|
|
773
|
+
stepIndex: computed("stepIndex")
|
|
774
|
+
});
|
|
775
|
+
},
|
|
776
|
+
invokeOnComplete({ prop, context, computed }) {
|
|
777
|
+
prop("onStatusChange")?.({
|
|
778
|
+
status: "completed",
|
|
779
|
+
stepId: context.get("stepId"),
|
|
780
|
+
stepIndex: computed("stepIndex")
|
|
781
|
+
});
|
|
782
|
+
},
|
|
783
|
+
invokeOnSkip({ prop, context, computed }) {
|
|
784
|
+
prop("onStatusChange")?.({
|
|
785
|
+
status: "skipped",
|
|
786
|
+
stepId: context.get("stepId"),
|
|
787
|
+
stepIndex: computed("stepIndex")
|
|
788
|
+
});
|
|
789
|
+
},
|
|
790
|
+
invokeOnNotFound({ prop, context, computed }) {
|
|
791
|
+
prop("onStatusChange")?.({
|
|
792
|
+
status: "not-found",
|
|
793
|
+
stepId: context.get("stepId"),
|
|
794
|
+
stepIndex: computed("stepIndex")
|
|
795
|
+
});
|
|
796
|
+
},
|
|
797
|
+
setResolvedTarget({ context, event, computed }) {
|
|
798
|
+
const node = event.node ?? computed("step")?.target?.();
|
|
799
|
+
context.set("resolvedTarget", node ?? null);
|
|
800
|
+
},
|
|
801
|
+
cleanupAll({ refs }) {
|
|
802
|
+
refs.get("_targetCleanup")?.();
|
|
803
|
+
refs.set("_targetCleanup", void 0);
|
|
804
|
+
refs.set("_prevTarget", void 0);
|
|
805
|
+
refs.get("_effectCleanup")?.();
|
|
806
|
+
refs.set("_effectCleanup", void 0);
|
|
807
|
+
},
|
|
808
|
+
cleanupStepEffect({ refs }) {
|
|
809
|
+
refs.get("_effectCleanup")?.();
|
|
810
|
+
refs.set("_effectCleanup", void 0);
|
|
811
|
+
},
|
|
812
|
+
validateSteps({ context }) {
|
|
813
|
+
const ids = /* @__PURE__ */ new Set();
|
|
814
|
+
context.get("steps").forEach((step) => {
|
|
815
|
+
if (ids.has(step.id)) throw new Error(`[wirekyt/tour] Duplicate step id: ${step.id}`);
|
|
816
|
+
if (step.target == null && step.type == null) throw new Error(`[wirekyt/tour] Step ${step.id} has no target or type. At least one of those is required.`);
|
|
817
|
+
ids.add(step.id);
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
},
|
|
821
|
+
effects: {
|
|
822
|
+
waitForScrollEnd({ send }) {
|
|
823
|
+
const id = setTimeout(() => {
|
|
824
|
+
send({ type: "SCROLL.END" });
|
|
825
|
+
}, 100);
|
|
826
|
+
return () => clearTimeout(id);
|
|
827
|
+
},
|
|
828
|
+
waitForTargetTimeout({ send }) {
|
|
829
|
+
const id = setTimeout(() => {
|
|
830
|
+
send({ type: "TARGET.NOT_FOUND" });
|
|
831
|
+
}, 3e3);
|
|
832
|
+
return () => clearTimeout(id);
|
|
833
|
+
},
|
|
834
|
+
waitForTarget({ scope, computed, send }) {
|
|
835
|
+
const step = computed("step");
|
|
836
|
+
if (!step) return;
|
|
837
|
+
const targetEl = step.target;
|
|
838
|
+
const win = scope.getWin();
|
|
839
|
+
const rootNode = scope.getRootNode();
|
|
840
|
+
const observer = new win.MutationObserver(() => {
|
|
841
|
+
const node = targetEl?.();
|
|
842
|
+
if (node) {
|
|
843
|
+
send({
|
|
844
|
+
type: "TARGET.RESOLVED",
|
|
845
|
+
node
|
|
846
|
+
});
|
|
847
|
+
observer.disconnect();
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
observer.observe(rootNode, {
|
|
851
|
+
childList: true,
|
|
852
|
+
subtree: true,
|
|
853
|
+
characterData: true
|
|
854
|
+
});
|
|
855
|
+
return () => {
|
|
856
|
+
observer.disconnect();
|
|
857
|
+
};
|
|
858
|
+
},
|
|
859
|
+
trackBoundarySize({ context, scope }) {
|
|
860
|
+
const win = scope.getWin();
|
|
861
|
+
const doc = scope.getDoc();
|
|
862
|
+
const onResize = () => {
|
|
863
|
+
const width = visualViewport?.width ?? win.innerWidth;
|
|
864
|
+
const height = doc.documentElement.scrollHeight;
|
|
865
|
+
context.set("boundarySize", {
|
|
866
|
+
width,
|
|
867
|
+
height
|
|
868
|
+
});
|
|
869
|
+
};
|
|
870
|
+
onResize();
|
|
871
|
+
const viewport = win.visualViewport ?? win;
|
|
872
|
+
viewport.addEventListener("resize", onResize);
|
|
873
|
+
return () => viewport.removeEventListener("resize", onResize);
|
|
874
|
+
},
|
|
875
|
+
trackEscapeKeydown({ scope, send, prop }) {
|
|
876
|
+
if (!prop("closeOnEscape")) return;
|
|
877
|
+
const doc = scope.getDoc();
|
|
878
|
+
const onKeyDown = (event) => {
|
|
879
|
+
if (event.key === "Escape") {
|
|
880
|
+
event.preventDefault();
|
|
881
|
+
event.stopPropagation();
|
|
882
|
+
send({
|
|
883
|
+
type: "DISMISS",
|
|
884
|
+
src: "esc"
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
doc.addEventListener("keydown", onKeyDown, true);
|
|
889
|
+
return () => {
|
|
890
|
+
doc.removeEventListener("keydown", onKeyDown, true);
|
|
891
|
+
};
|
|
892
|
+
},
|
|
893
|
+
trackInteractOutside({ context, computed, scope, send, prop }) {
|
|
894
|
+
const step = computed("step");
|
|
895
|
+
if (step == null) return;
|
|
896
|
+
const contentEl = () => getContentEl(scope);
|
|
897
|
+
return trackInteractOutside(contentEl, {
|
|
898
|
+
defer: true,
|
|
899
|
+
exclude(target) {
|
|
900
|
+
return contains(step.target?.(), target);
|
|
901
|
+
},
|
|
902
|
+
onFocusOutside(event) {
|
|
903
|
+
prop("onFocusOutside")?.(event);
|
|
904
|
+
if (!prop("closeOnInteractOutside")) event.preventDefault();
|
|
905
|
+
},
|
|
906
|
+
onPointerDownOutside(event) {
|
|
907
|
+
prop("onPointerDownOutside")?.(event);
|
|
908
|
+
if (isEventInRect(context.get("targetRect"), event.detail.originalEvent)) {
|
|
909
|
+
event.preventDefault();
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
if (!prop("closeOnInteractOutside")) event.preventDefault();
|
|
913
|
+
},
|
|
914
|
+
onInteractOutside(event) {
|
|
915
|
+
prop("onInteractOutside")?.(event);
|
|
916
|
+
if (event.defaultPrevented) return;
|
|
917
|
+
send({
|
|
918
|
+
type: "DISMISS",
|
|
919
|
+
src: "interact-outside"
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
},
|
|
924
|
+
trackDismissableBranch({ computed, scope }) {
|
|
925
|
+
if (computed("step") == null) return;
|
|
926
|
+
const contentEl = () => getContentEl(scope);
|
|
927
|
+
return trackDismissableBranch(contentEl, { defer: true });
|
|
928
|
+
},
|
|
929
|
+
trapFocus({ computed, scope, context }) {
|
|
930
|
+
if (computed("step") == null) return;
|
|
931
|
+
const contentEl = () => getContentEl(scope);
|
|
932
|
+
const targetEl = () => context.get("resolvedTarget");
|
|
933
|
+
return trapFocus([contentEl, targetEl], {
|
|
934
|
+
escapeDeactivates: false,
|
|
935
|
+
allowOutsideClick: true,
|
|
936
|
+
preventScroll: true,
|
|
937
|
+
returnFocusOnDeactivate: false,
|
|
938
|
+
getShadowRoot: true
|
|
939
|
+
});
|
|
940
|
+
},
|
|
941
|
+
trackPlacement({ context, computed, scope, prop }) {
|
|
942
|
+
const step = computed("step");
|
|
943
|
+
if (step == null) return;
|
|
944
|
+
context.set("currentPlacement", step.placement ?? "bottom");
|
|
945
|
+
if (isDialogStep(step)) return syncZIndex(scope);
|
|
946
|
+
if (!isTooltipStep(step)) return;
|
|
947
|
+
const positionerEl = () => getPositionerEl(scope);
|
|
948
|
+
return getPlacement(context.get("resolvedTarget"), positionerEl, {
|
|
949
|
+
defer: true,
|
|
950
|
+
placement: step.placement ?? "bottom",
|
|
951
|
+
strategy: "absolute",
|
|
952
|
+
gutter: 10,
|
|
953
|
+
offset: step.offset,
|
|
954
|
+
restoreStyles: true,
|
|
955
|
+
getAnchorRect(el) {
|
|
956
|
+
if (!isHTMLElement(el)) return null;
|
|
957
|
+
return offset(el.getBoundingClientRect(), prop("spotlightOffset"));
|
|
958
|
+
},
|
|
959
|
+
onComplete(data) {
|
|
960
|
+
const { rects } = data.middlewareData;
|
|
961
|
+
context.set("currentPlacement", data.placement);
|
|
962
|
+
context.set("targetRect", rects.reference);
|
|
963
|
+
}
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
});
|
|
969
|
+
/**
|
|
970
|
+
* Shared logic for syncing target element attributes.
|
|
971
|
+
* Used by both actions and the watch callback.
|
|
972
|
+
*/
|
|
973
|
+
function syncTargetAttrsFromContext(params) {
|
|
974
|
+
const { context, refs, prop } = params;
|
|
975
|
+
const targetEl = context.get("resolvedTarget");
|
|
976
|
+
const prevTarget = refs.get("_prevTarget");
|
|
977
|
+
if (targetEl !== prevTarget) {
|
|
978
|
+
refs.get("_targetCleanup")?.();
|
|
979
|
+
refs.set("_targetCleanup", void 0);
|
|
980
|
+
}
|
|
981
|
+
if (!targetEl) {
|
|
982
|
+
refs.set("_prevTarget", null);
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
if (targetEl === prevTarget) return;
|
|
986
|
+
if (prop?.("preventInteraction")) targetEl.inert = true;
|
|
987
|
+
targetEl.setAttribute("data-tour-highlighted", "");
|
|
988
|
+
refs.set("_targetCleanup", () => {
|
|
989
|
+
if (prop?.("preventInteraction")) targetEl.inert = false;
|
|
990
|
+
targetEl.removeAttribute("data-tour-highlighted");
|
|
991
|
+
});
|
|
992
|
+
refs.set("_prevTarget", targetEl);
|
|
993
|
+
}
|
|
994
|
+
function performStepTransition(params, idx) {
|
|
995
|
+
const { context, refs, send } = params;
|
|
996
|
+
const step = context.get("steps")[idx];
|
|
997
|
+
if (!step) {
|
|
998
|
+
refs.set("_internalChange", true);
|
|
999
|
+
context.set("stepId", null);
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
if (isEqual(context.get("stepId"), step.id)) return;
|
|
1003
|
+
refs.get("_effectCleanup")?.();
|
|
1004
|
+
refs.set("_effectCleanup", void 0);
|
|
1005
|
+
refs.get("_targetCleanup")?.();
|
|
1006
|
+
refs.set("_targetCleanup", void 0);
|
|
1007
|
+
if (step.effect) {
|
|
1008
|
+
executeStepEffect(params, step, idx);
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
const resolvedTarget = step.target?.() ?? null;
|
|
1012
|
+
context.set("resolvedTarget", resolvedTarget);
|
|
1013
|
+
refs.set("_internalChange", true);
|
|
1014
|
+
context.set("stepId", step.id);
|
|
1015
|
+
syncTargetAttrsFromContext(params);
|
|
1016
|
+
send({ type: "STEP.ROUTE" });
|
|
1017
|
+
}
|
|
1018
|
+
function createEffectUtilities(params, step, idx) {
|
|
1019
|
+
const { context, computed, refs, send, prop } = params;
|
|
1020
|
+
const steps = context.get("steps");
|
|
1021
|
+
return {
|
|
1022
|
+
show: () => {
|
|
1023
|
+
const resolvedTarget = step.target?.() ?? null;
|
|
1024
|
+
context.set("resolvedTarget", resolvedTarget);
|
|
1025
|
+
refs.set("_internalChange", true);
|
|
1026
|
+
context.set("stepId", step.id);
|
|
1027
|
+
syncTargetAttrsFromContext(params);
|
|
1028
|
+
send({ type: "STEP.ROUTE" });
|
|
1029
|
+
},
|
|
1030
|
+
update: (data) => {
|
|
1031
|
+
context.set("steps", (prev) => prev.map((s, i) => i === idx ? {
|
|
1032
|
+
...s,
|
|
1033
|
+
...data
|
|
1034
|
+
} : s));
|
|
1035
|
+
},
|
|
1036
|
+
next: () => {
|
|
1037
|
+
performStepTransition(params, nextIndex(steps, computed("stepIndex")));
|
|
1038
|
+
},
|
|
1039
|
+
goto: (id) => {
|
|
1040
|
+
const targetIdx = findStepIndex(steps, id);
|
|
1041
|
+
if (targetIdx === -1) {
|
|
1042
|
+
warn(`[wirekyt/tour] Step with id "${id}" not found`);
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
performStepTransition(params, targetIdx);
|
|
1046
|
+
},
|
|
1047
|
+
dismiss: () => {
|
|
1048
|
+
refs.set("_internalChange", true);
|
|
1049
|
+
context.set("stepId", null);
|
|
1050
|
+
prop("onStatusChange")?.({
|
|
1051
|
+
status: "dismissed",
|
|
1052
|
+
stepId: null,
|
|
1053
|
+
stepIndex: -1
|
|
1054
|
+
});
|
|
1055
|
+
},
|
|
1056
|
+
target: step.target
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
function executeStepEffect(params, step, idx) {
|
|
1060
|
+
const { refs } = params;
|
|
1061
|
+
const utilities = createEffectUtilities(params, step, idx);
|
|
1062
|
+
let cleanup;
|
|
1063
|
+
try {
|
|
1064
|
+
cleanup = step.effect(utilities);
|
|
1065
|
+
} catch (error) {
|
|
1066
|
+
console.error(error);
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
refs.set("_effectCleanup", cleanup);
|
|
1070
|
+
if (isWaitStep(step)) utilities.show();
|
|
1071
|
+
}
|
|
1072
|
+
//#endregion
|
|
1073
|
+
//#region src/machines/tour/props.ts
|
|
1074
|
+
const props = createProps()([
|
|
1075
|
+
"closeOnEscape",
|
|
1076
|
+
"closeOnInteractOutside",
|
|
1077
|
+
"dir",
|
|
1078
|
+
"getRootNode",
|
|
1079
|
+
"id",
|
|
1080
|
+
"ids",
|
|
1081
|
+
"keyboardNavigation",
|
|
1082
|
+
"onFocusOutside",
|
|
1083
|
+
"onInteractOutside",
|
|
1084
|
+
"onPointerDownOutside",
|
|
1085
|
+
"onStatusChange",
|
|
1086
|
+
"onStepChange",
|
|
1087
|
+
"onStepsChange",
|
|
1088
|
+
"preventInteraction",
|
|
1089
|
+
"spotlightOffset",
|
|
1090
|
+
"spotlightRadius",
|
|
1091
|
+
"stepId",
|
|
1092
|
+
"steps",
|
|
1093
|
+
"translations"
|
|
1094
|
+
]);
|
|
1095
|
+
const splitProps = createSplitProps(props);
|
|
1096
|
+
//#endregion
|
|
1097
|
+
//#region src/machines/tour/utils/wait.ts
|
|
1098
|
+
function waitForElementValue(target, value, options) {
|
|
1099
|
+
const { timeout, rootNode } = options;
|
|
1100
|
+
const controller = new (getWindow(rootNode)).AbortController();
|
|
1101
|
+
return waitForPromise(new Promise((resolve) => {
|
|
1102
|
+
const el = target();
|
|
1103
|
+
if (!el) return;
|
|
1104
|
+
const checkValue = () => {
|
|
1105
|
+
if (el.value === value) {
|
|
1106
|
+
resolve();
|
|
1107
|
+
el.removeEventListener("input", checkValue);
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1110
|
+
checkValue();
|
|
1111
|
+
el.addEventListener("input", checkValue, { signal: controller.signal });
|
|
1112
|
+
}), controller, timeout);
|
|
1113
|
+
}
|
|
1114
|
+
//#endregion
|
|
1115
|
+
export { anatomy, connect, machine, props, splitProps, waitForElement, waitForElementValue, waitForPromise };
|