@42-central/ui-react 0.29.1 → 0.30.0
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/{chunk-X6DESK37.js → chunk-2RRTT4AF.js} +17 -5
- package/dist/chunk-2RRTT4AF.js.map +1 -0
- package/dist/{chunk-TUP7WXQE.js → chunk-322I2RSV.js} +9 -6
- package/dist/chunk-322I2RSV.js.map +1 -0
- package/dist/{chunk-ISX3AM32.js → chunk-37SRSNLJ.js} +4 -4
- package/dist/{chunk-ISX3AM32.js.map → chunk-37SRSNLJ.js.map} +1 -1
- package/dist/{chunk-L5GH7LLD.js → chunk-3MFWUG5O.js} +4 -4
- package/dist/{chunk-L5GH7LLD.js.map → chunk-3MFWUG5O.js.map} +1 -1
- package/dist/{chunk-FQJNQW3G.js → chunk-3XQEOJCE.js} +8 -5
- package/dist/chunk-3XQEOJCE.js.map +1 -0
- package/dist/{chunk-JKFPRQB2.js → chunk-4LSZ5JWF.js} +3 -3
- package/dist/{chunk-JKFPRQB2.js.map → chunk-4LSZ5JWF.js.map} +1 -1
- package/dist/{chunk-V2QZG4IT.js → chunk-5HWFYYHW.js} +27 -9
- package/dist/chunk-5HWFYYHW.js.map +1 -0
- package/dist/{chunk-GEZYGBXY.js → chunk-6MVFCS46.js} +99 -42
- package/dist/chunk-6MVFCS46.js.map +1 -0
- package/dist/{chunk-NNPSBC7O.js → chunk-6WZSUS3U.js} +10 -9
- package/dist/chunk-6WZSUS3U.js.map +1 -0
- package/dist/chunk-6YRGP6PS.js +138 -0
- package/dist/chunk-6YRGP6PS.js.map +1 -0
- package/dist/{chunk-B5YHYI7E.js → chunk-ALANKV5Y.js} +23 -6
- package/dist/chunk-ALANKV5Y.js.map +1 -0
- package/dist/{chunk-IA6DCC3N.js → chunk-AUQPNDE5.js} +23 -13
- package/dist/chunk-AUQPNDE5.js.map +1 -0
- package/dist/{chunk-AKXALCUN.js → chunk-D7SW2E24.js} +4 -4
- package/dist/chunk-D7SW2E24.js.map +1 -0
- package/dist/{chunk-OXR7BXZA.js → chunk-DQIYYDFD.js} +4 -3
- package/dist/chunk-DQIYYDFD.js.map +1 -0
- package/dist/{chunk-HMNXNKDA.js → chunk-FCBYUN6F.js} +4 -4
- package/dist/{chunk-HMNXNKDA.js.map → chunk-FCBYUN6F.js.map} +1 -1
- package/dist/{chunk-2W7H43WL.js → chunk-FED6SJWM.js} +23 -14
- package/dist/chunk-FED6SJWM.js.map +1 -0
- package/dist/{chunk-7E7JNWOC.js → chunk-FEPIHXVI.js} +6 -5
- package/dist/chunk-FEPIHXVI.js.map +1 -0
- package/dist/{chunk-Y57NW6G7.js → chunk-G3YOSG3U.js} +4 -4
- package/dist/{chunk-Y57NW6G7.js.map → chunk-G3YOSG3U.js.map} +1 -1
- package/dist/chunk-GZN5CXMR.js +100 -0
- package/dist/chunk-GZN5CXMR.js.map +1 -0
- package/dist/{chunk-HCHGERDB.js → chunk-HCSZPBWV.js} +17 -115
- package/dist/chunk-HCSZPBWV.js.map +1 -0
- package/dist/{chunk-I4B3N3UX.js → chunk-HTVICHT4.js} +12 -7
- package/dist/chunk-HTVICHT4.js.map +1 -0
- package/dist/chunk-I7TC2C3I.js +163 -0
- package/dist/chunk-I7TC2C3I.js.map +1 -0
- package/dist/{chunk-7FPSQBWB.js → chunk-IBXYLO2J.js} +14 -13
- package/dist/chunk-IBXYLO2J.js.map +1 -0
- package/dist/{chunk-7KFUFAVP.js → chunk-IRYG6B5A.js} +9 -8
- package/dist/chunk-IRYG6B5A.js.map +1 -0
- package/dist/{chunk-2RQLPN4U.js → chunk-JCNEW4WJ.js} +8 -8
- package/dist/{chunk-2RQLPN4U.js.map → chunk-JCNEW4WJ.js.map} +1 -1
- package/dist/{chunk-SP6LCCTZ.js → chunk-KZDMVOL6.js} +35 -8
- package/dist/chunk-KZDMVOL6.js.map +1 -0
- package/dist/chunk-LR5U6TZZ.js +169 -0
- package/dist/chunk-LR5U6TZZ.js.map +1 -0
- package/dist/{chunk-MQHD3EJE.js → chunk-LZHZJWVM.js} +6 -4
- package/dist/chunk-LZHZJWVM.js.map +1 -0
- package/dist/{chunk-5EOMSWNO.js → chunk-MAM2X3MW.js} +5 -5
- package/dist/{chunk-5EOMSWNO.js.map → chunk-MAM2X3MW.js.map} +1 -1
- package/dist/{chunk-FSPS7TVD.js → chunk-MCMS4NMO.js} +5 -5
- package/dist/{chunk-FSPS7TVD.js.map → chunk-MCMS4NMO.js.map} +1 -1
- package/dist/{chunk-ZB5VMGKB.js → chunk-MV5DIE2T.js} +15 -4
- package/dist/chunk-MV5DIE2T.js.map +1 -0
- package/dist/chunk-NDI4HLQE.js +41 -0
- package/dist/chunk-NDI4HLQE.js.map +1 -0
- package/dist/{chunk-B4GNSSHU.js → chunk-NLJEQZQQ.js} +3 -3
- package/dist/{chunk-B4GNSSHU.js.map → chunk-NLJEQZQQ.js.map} +1 -1
- package/dist/{chunk-SBZJGFZ6.js → chunk-QHT4DCXE.js} +8 -7
- package/dist/chunk-QHT4DCXE.js.map +1 -0
- package/dist/{chunk-I4IJOLNA.js → chunk-RMUBCTEF.js} +5 -5
- package/dist/{chunk-I4IJOLNA.js.map → chunk-RMUBCTEF.js.map} +1 -1
- package/dist/{chunk-G3AD3NJG.js → chunk-RNTDM3RP.js} +9 -5
- package/dist/chunk-RNTDM3RP.js.map +1 -0
- package/dist/chunk-RPFN6ETQ.js +509 -0
- package/dist/chunk-RPFN6ETQ.js.map +1 -0
- package/dist/{chunk-HWBFRDX7.js → chunk-SI7C3W5M.js} +28 -9
- package/dist/chunk-SI7C3W5M.js.map +1 -0
- package/dist/chunk-TPOV3OCC.js +234 -0
- package/dist/chunk-TPOV3OCC.js.map +1 -0
- package/dist/{chunk-IANYMDKH.js → chunk-UBQ54W46.js} +4 -4
- package/dist/chunk-UBQ54W46.js.map +1 -0
- package/dist/{chunk-QVOBLRCM.js → chunk-UIKQ4X6W.js} +3 -3
- package/dist/{chunk-QVOBLRCM.js.map → chunk-UIKQ4X6W.js.map} +1 -1
- package/dist/chunk-UOWQH53N.js +70 -0
- package/dist/chunk-UOWQH53N.js.map +1 -0
- package/dist/{chunk-QRNQQIQM.js → chunk-WJUY6YWF.js} +52 -20
- package/dist/chunk-WJUY6YWF.js.map +1 -0
- package/dist/{chunk-3KARNPW4.js → chunk-WKIUMLRT.js} +3 -3
- package/dist/{chunk-3KARNPW4.js.map → chunk-WKIUMLRT.js.map} +1 -1
- package/dist/chunk-X6RB74JN.js +37 -0
- package/dist/chunk-X6RB74JN.js.map +1 -0
- package/dist/chunk-XQ6L2CM5.js +83 -0
- package/dist/chunk-XQ6L2CM5.js.map +1 -0
- package/dist/{chunk-RKCUXOU2.js → chunk-YUVKROMA.js} +44 -7
- package/dist/chunk-YUVKROMA.js.map +1 -0
- package/dist/components/action-icon/action-icon.d.ts +9 -2
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +5 -1
- package/dist/components/alert/index.js +4 -4
- package/dist/components/anchor/anchor.d.ts +45 -0
- package/dist/components/anchor/anchor.d.ts.map +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.d.ts.map +1 -0
- package/dist/components/anchor/index.js +11 -0
- package/dist/components/anchor/index.js.map +1 -0
- package/dist/components/app-shell/app-shell.d.ts +10 -6
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +23 -24
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/index.js +15 -9
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/button/button.d.ts +15 -2
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/index.js +5 -1
- package/dist/components/button-multi-select/index.js +6 -4
- package/dist/components/button-multi-select/index.js.map +1 -1
- package/dist/components/button-select/button-select-control.d.ts.map +1 -1
- package/dist/components/button-select/button-select.d.ts +2 -2
- package/dist/components/button-select/button-select.d.ts.map +1 -1
- package/dist/components/button-select/index.js +6 -4
- package/dist/components/button-select/index.js.map +1 -1
- package/dist/components/calendar/aliases.d.ts +16 -0
- package/dist/components/calendar/aliases.d.ts.map +1 -0
- package/dist/components/calendar/calendar-body.d.ts +11 -1
- package/dist/components/calendar/calendar-body.d.ts.map +1 -1
- package/dist/components/calendar/calendar.d.ts +8 -4
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/index.d.ts +2 -1
- package/dist/components/calendar/index.d.ts.map +1 -1
- package/dist/components/calendar/index.js +15 -5
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/calendar-heatmap/calendar-heatmap.d.ts.map +1 -1
- package/dist/components/calendar-heatmap/index.js +85 -73
- package/dist/components/calendar-heatmap/index.js.map +1 -1
- package/dist/components/camera/index.js +16 -14
- package/dist/components/carousel/index.js +3 -3
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/choice-card-group/index.js +2 -2
- package/dist/components/choice-card-group/index.js.map +1 -1
- package/dist/components/circular-progress/circular-progress.d.ts +22 -11
- package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
- package/dist/components/circular-progress/index.d.ts +1 -1
- package/dist/components/circular-progress/index.d.ts.map +1 -1
- package/dist/components/circular-progress/index.js +68 -49
- package/dist/components/circular-progress/index.js.map +1 -1
- package/dist/components/clipboard/index.js +7 -3
- package/dist/components/clipboard/index.js.map +1 -1
- package/dist/components/code/code.d.ts +10 -0
- package/dist/components/code/code.d.ts.map +1 -1
- package/dist/components/code/index.js +1 -0
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/code-block/chrome.js +10 -6
- package/dist/components/code-block/index.js +10 -7
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/combobox/combobox.d.ts +5 -3
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +12 -7
- package/dist/components/combobox-list/combobox-list.d.ts +1 -1
- package/dist/components/combobox-list/combobox-list.d.ts.map +1 -1
- package/dist/components/combobox-list/index.js +14 -9
- package/dist/components/compare/index.js +1 -1
- package/dist/components/data-list/data-list.d.ts +96 -0
- package/dist/components/data-list/data-list.d.ts.map +1 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.d.ts.map +1 -0
- package/dist/components/data-list/index.js +147 -0
- package/dist/components/data-list/index.js.map +1 -0
- package/dist/components/data-table/data-table-group.d.ts.map +1 -1
- package/dist/components/data-table/data-table-placeholder.d.ts +12 -1
- package/dist/components/data-table/data-table-placeholder.d.ts.map +1 -1
- package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +5 -2
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/index.js +163 -168
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/aliases.d.ts +16 -0
- package/dist/components/date-picker/aliases.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.d.ts +22 -8
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/index.d.ts +2 -2
- package/dist/components/date-picker/index.d.ts.map +1 -1
- package/dist/components/date-picker/index.js +34 -28
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/download-button/index.js +6 -2
- package/dist/components/drawer/drawer.d.ts +7 -4
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/index.js +11 -6
- package/dist/components/empty-state/empty-state.d.ts +57 -0
- package/dist/components/empty-state/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state/index.d.ts +2 -0
- package/dist/components/empty-state/index.d.ts.map +1 -0
- package/dist/components/empty-state/index.js +8 -0
- package/dist/components/empty-state/index.js.map +1 -0
- package/dist/components/field/field.d.ts +20 -0
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +1 -1
- package/dist/components/fieldset/fieldset.d.ts +103 -0
- package/dist/components/fieldset/fieldset.d.ts.map +1 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.d.ts.map +1 -0
- package/dist/components/fieldset/index.js +150 -0
- package/dist/components/fieldset/index.js.map +1 -0
- package/dist/components/file-item/index.js +10 -7
- package/dist/components/file-preview/file-preview.d.ts.map +1 -1
- package/dist/components/file-preview/index.js +10 -18
- package/dist/components/file-preview/index.js.map +1 -1
- package/dist/components/file-trigger/index.js +6 -2
- package/dist/components/file-upload/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload/index.js +18 -14
- package/dist/components/file-upload/index.js.map +1 -1
- package/dist/components/gallery/index.js +3 -3
- package/dist/components/geodesic/a11y.d.ts +3 -3
- package/dist/components/geodesic/a11y.d.ts.map +1 -1
- package/dist/components/hover-card/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card/index.js +10 -3
- package/dist/components/hover-card/index.js.map +1 -1
- package/dist/components/image/index.js +3 -3
- package/dist/components/image-cropper/index.js +9 -6
- package/dist/components/input/index.js +2 -2
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/kbd/kbd.d.ts +4 -0
- package/dist/components/kbd/kbd.d.ts.map +1 -1
- package/dist/components/lightbox/index.js +13 -11
- package/dist/components/lightbox/index.js.map +1 -1
- package/dist/components/menu/index.js +9 -5
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/modal/index.js +11 -6
- package/dist/components/modal/modal.d.ts +10 -4
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.js +13 -9
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts +1 -1
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts.map +1 -1
- package/dist/components/multi-select/index.js +13 -10
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/multi-select/multi-select.d.ts +1 -1
- package/dist/components/multi-select/multi-select.d.ts.map +1 -1
- package/dist/components/nav-link/index.js +4 -4
- package/dist/components/nav-link/tanstack.js +4 -4
- package/dist/components/notification/index.js +6 -6
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/number-input/index.js +11 -7
- package/dist/components/number-input/number-input.d.ts +1 -1
- package/dist/components/number-input/number-input.d.ts.map +1 -1
- package/dist/components/overlays/dialog-parts.d.ts +10 -1
- package/dist/components/overlays/dialog-parts.d.ts.map +1 -1
- package/dist/components/overlays/index.js +13 -8
- package/dist/components/overlays/index.js.map +1 -1
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.d.ts.map +1 -0
- package/dist/components/pagination/index.js +362 -0
- package/dist/components/pagination/index.js.map +1 -0
- package/dist/components/pagination/pagination.d.ts +147 -0
- package/dist/components/pagination/pagination.d.ts.map +1 -0
- package/dist/components/password-input/index.js +6 -5
- package/dist/components/password-input/index.js.map +1 -1
- package/dist/components/password-input/password-input.d.ts +1 -1
- package/dist/components/password-input/password-input.d.ts.map +1 -1
- package/dist/components/phone-input/index.js +14 -11
- package/dist/components/phone-input/index.js.map +1 -1
- package/dist/components/phone-input/phone-input.d.ts +1 -1
- package/dist/components/phone-input/phone-input.d.ts.map +1 -1
- package/dist/components/photo-capture/index.js +19 -17
- package/dist/components/photo-capture/index.js.map +1 -1
- package/dist/components/pills-input/index.js +4 -4
- package/dist/components/pills-input/pills-input.d.ts +1 -1
- package/dist/components/pills-input/pills-input.d.ts.map +1 -1
- package/dist/components/pin-input/index.js +6 -5
- package/dist/components/pin-input/index.js.map +1 -1
- package/dist/components/pin-input/pin-input.d.ts.map +1 -1
- package/dist/components/popover/index.js +7 -2
- package/dist/components/popover/popover.d.ts +41 -16
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/progress/index.d.ts +1 -1
- package/dist/components/progress/index.d.ts.map +1 -1
- package/dist/components/progress/index.js +4 -1
- package/dist/components/progress/progress.d.ts +22 -14
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/prose/index.d.ts +2 -0
- package/dist/components/prose/index.d.ts.map +1 -0
- package/dist/components/prose/index.js +17 -0
- package/dist/components/prose/index.js.map +1 -0
- package/dist/components/prose/prose.d.ts +49 -0
- package/dist/components/prose/prose.d.ts.map +1 -0
- package/dist/components/prose/styles.css +593 -0
- package/dist/components/radio-group/index.js +9 -3
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/rating/index.js +3 -2
- package/dist/components/rating/index.js.map +1 -1
- package/dist/components/rating/rating.d.ts.map +1 -1
- package/dist/components/schedule/index.js +10 -8
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.d.ts.map +1 -0
- package/dist/components/scroll-area/index.js +10 -0
- package/dist/components/scroll-area/index.js.map +1 -0
- package/dist/components/scroll-area/scroll-area.d.ts +150 -0
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -0
- package/dist/components/segment-group/index.js +2 -2
- package/dist/components/segment-group/segment-group.d.ts.map +1 -1
- package/dist/components/select/index.js +12 -8
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/slider/index.js +2 -2
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/splitter/index.d.ts +2 -0
- package/dist/components/splitter/index.d.ts.map +1 -0
- package/dist/components/splitter/index.js +373 -0
- package/dist/components/splitter/index.js.map +1 -0
- package/dist/components/splitter/splitter.d.ts +159 -0
- package/dist/components/splitter/splitter.d.ts.map +1 -0
- package/dist/components/spotlight/index.js +23 -22
- package/dist/components/spotlight/index.js.map +1 -1
- package/dist/components/spotlight/spotlight.d.ts.map +1 -1
- package/dist/components/steps/index.d.ts +4 -0
- package/dist/components/steps/index.d.ts.map +1 -0
- package/dist/components/steps/index.js +478 -0
- package/dist/components/steps/index.js.map +1 -0
- package/dist/components/steps/steps-data.d.ts +78 -0
- package/dist/components/steps/steps-data.d.ts.map +1 -0
- package/dist/components/steps/steps.d.ts +183 -0
- package/dist/components/steps/steps.d.ts.map +1 -0
- package/dist/components/switch/index.js +4 -3
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/table-of-contents/index.d.ts +2 -0
- package/dist/components/table-of-contents/index.d.ts.map +1 -0
- package/dist/components/table-of-contents/index.js +471 -0
- package/dist/components/table-of-contents/index.js.map +1 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +173 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts.map +1 -0
- package/dist/components/tags-input/index.js +12 -9
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/tags-input/tags-input.d.ts +1 -1
- package/dist/components/tags-input/tags-input.d.ts.map +1 -1
- package/dist/components/text-input/index.js +2 -2
- package/dist/components/textarea/index.js +8 -6
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/time-input/index.js +11 -9
- package/dist/components/time-input/index.js.map +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +3 -8
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tour/conditions.d.ts +83 -0
- package/dist/components/tour/conditions.d.ts.map +1 -0
- package/dist/components/tour/create-tours.d.ts +49 -0
- package/dist/components/tour/create-tours.d.ts.map +1 -0
- package/dist/components/tour/index.d.ts +6 -0
- package/dist/components/tour/index.d.ts.map +1 -0
- package/dist/components/tour/index.js +1449 -0
- package/dist/components/tour/index.js.map +1 -0
- package/dist/components/tour/runtime.d.ts +57 -0
- package/dist/components/tour/runtime.d.ts.map +1 -0
- package/dist/components/tour/storage.d.ts +14 -0
- package/dist/components/tour/storage.d.ts.map +1 -0
- package/dist/components/tour/store.d.ts +62 -0
- package/dist/components/tour/store.d.ts.map +1 -0
- package/dist/components/tour/tour.d.ts +77 -0
- package/dist/components/tour/tour.d.ts.map +1 -0
- package/dist/components/tour/types.d.ts +680 -0
- package/dist/components/tour/types.d.ts.map +1 -0
- package/dist/components/tree/index.d.ts +3 -0
- package/dist/components/tree/index.d.ts.map +1 -0
- package/dist/components/tree/index.js +457 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/components/tree/tree-row.d.ts +72 -0
- package/dist/components/tree/tree-row.d.ts.map +1 -0
- package/dist/components/tree/tree.d.ts +193 -0
- package/dist/components/tree/tree.d.ts.map +1 -0
- package/dist/components/tree-multi-select/index.js +31 -54
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts +16 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts.map +1 -1
- package/dist/components/tree-select/index.js +30 -24
- package/dist/components/tree-select/index.js.map +1 -1
- package/dist/components/tree-select/tree-popover.d.ts +20 -31
- package/dist/components/tree-select/tree-popover.d.ts.map +1 -1
- package/dist/components/tree-select/tree-select.d.ts +1 -1
- package/dist/components/tree-select/tree-select.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/date-predicates.d.ts +7 -5
- package/dist/lib/date-predicates.d.ts.map +1 -1
- package/dist/lib/date-value.d.ts +20 -0
- package/dist/lib/date-value.d.ts.map +1 -1
- package/dist/lib/floating-arrow.d.ts +53 -0
- package/dist/lib/floating-arrow.d.ts.map +1 -0
- package/dist/lib/focus-return.d.ts +53 -0
- package/dist/lib/focus-return.d.ts.map +1 -0
- package/dist/lib/meter.d.ts +104 -0
- package/dist/lib/meter.d.ts.map +1 -0
- package/dist/lib/overlay-layer.d.ts +26 -8
- package/dist/lib/overlay-layer.d.ts.map +1 -1
- package/dist/lib/pressed.d.ts +92 -0
- package/dist/lib/pressed.d.ts.map +1 -0
- package/dist/lib/tree-data.d.ts +18 -2
- package/dist/lib/tree-data.d.ts.map +1 -1
- package/dist/lib/use-pagination.d.ts +102 -0
- package/dist/lib/use-pagination.d.ts.map +1 -0
- package/dist/lib/use-scroll-spy.d.ts +126 -0
- package/dist/lib/use-scroll-spy.d.ts.map +1 -0
- package/dist/theme.css +39 -3
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +283 -1
- package/src/components/action-icon/action-icon.tsx +34 -4
- package/src/components/anchor/anchor.test.tsx +232 -0
- package/src/components/anchor/anchor.tsx +187 -0
- package/src/components/anchor/index.ts +12 -0
- package/src/components/app-shell/app-shell.test.tsx +15 -7
- package/src/components/app-shell/app-shell.tsx +27 -20
- package/src/components/autocomplete/autocomplete.tsx +11 -3
- package/src/components/button/button-pressed.test.tsx +202 -0
- package/src/components/button/button.tsx +48 -6
- package/src/components/button-select/button-select-control.tsx +2 -2
- package/src/components/button-select/button-select.tsx +22 -2
- package/src/components/calendar/aliases.tsx +28 -0
- package/src/components/calendar/calendar-body.tsx +310 -210
- package/src/components/calendar/calendar.tsx +43 -12
- package/src/components/calendar/index.ts +7 -1
- package/src/components/calendar/month-year-calendar.test.tsx +106 -0
- package/src/components/calendar-heatmap/calendar-heatmap.tsx +88 -73
- package/src/components/checkbox/checkbox.tsx +7 -2
- package/src/components/choice-card-group/choice-card-group.tsx +2 -2
- package/src/components/circular-progress/circular-progress.test.tsx +35 -0
- package/src/components/circular-progress/circular-progress.tsx +116 -59
- package/src/components/circular-progress/index.ts +1 -0
- package/src/components/code/code.test.tsx +16 -0
- package/src/components/code/code.tsx +11 -0
- package/src/components/combobox/combobox.tsx +63 -28
- package/src/components/combobox-list/combobox-list.tsx +11 -3
- package/src/components/data-list/data-list.test.tsx +149 -0
- package/src/components/data-list/data-list.tsx +268 -0
- package/src/components/data-list/index.ts +9 -0
- package/src/components/data-table/data-table-group.test.tsx +16 -0
- package/src/components/data-table/data-table-group.tsx +15 -2
- package/src/components/data-table/data-table-placeholder.tsx +28 -36
- package/src/components/data-table/data-table-stack.tsx +33 -39
- package/src/components/data-table/data-table.test.tsx +31 -0
- package/src/components/data-table/data-table.tsx +41 -42
- package/src/components/date-picker/aliases.tsx +28 -0
- package/src/components/date-picker/date-picker.test.tsx +29 -0
- package/src/components/date-picker/date-picker.tsx +164 -45
- package/src/components/date-picker/index.ts +5 -1
- package/src/components/date-picker/month-year-picker.test.tsx +362 -0
- package/src/components/drawer/drawer.test.tsx +41 -0
- package/src/components/drawer/drawer.tsx +7 -1
- package/src/components/empty-state/empty-state.test.tsx +109 -0
- package/src/components/empty-state/empty-state.tsx +180 -0
- package/src/components/empty-state/index.ts +9 -0
- package/src/components/field/field.tsx +35 -1
- package/src/components/fieldset/fieldset.test.tsx +352 -0
- package/src/components/fieldset/fieldset.tsx +268 -0
- package/src/components/fieldset/index.ts +11 -0
- package/src/components/file-preview/file-preview.test.tsx +2 -1
- package/src/components/file-preview/file-preview.tsx +7 -13
- package/src/components/file-upload/file-upload.tsx +14 -5
- package/src/components/hover-card/hover-card.tsx +5 -1
- package/src/components/input/input.tsx +12 -5
- package/src/components/kbd/kbd.test.tsx +13 -0
- package/src/components/kbd/kbd.tsx +6 -0
- package/src/components/menu/menu.tsx +6 -2
- package/src/components/modal/modal.test.tsx +41 -0
- package/src/components/modal/modal.tsx +17 -9
- package/src/components/multi-combobox-list/multi-combobox-list.tsx +11 -3
- package/src/components/multi-select/multi-select.tsx +11 -3
- package/src/components/notification/create-notifier.tsx +1 -1
- package/src/components/number-input/number-input.tsx +12 -3
- package/src/components/overlays/dialog-parts.tsx +42 -5
- package/src/components/pagination/index.ts +19 -0
- package/src/components/pagination/pagination.test.tsx +187 -0
- package/src/components/pagination/pagination.tsx +563 -0
- package/src/components/password-input/password-input.tsx +12 -3
- package/src/components/phone-input/phone-input.tsx +12 -3
- package/src/components/pills-input/pills-input.tsx +7 -2
- package/src/components/pin-input/pin-input.tsx +13 -4
- package/src/components/popover/popover.tsx +87 -17
- package/src/components/progress/index.ts +1 -0
- package/src/components/progress/progress.test.tsx +102 -0
- package/src/components/progress/progress.tsx +116 -62
- package/src/components/prose/index.ts +1 -0
- package/src/components/prose/prose.test.tsx +90 -0
- package/src/components/prose/prose.tsx +60 -0
- package/src/components/prose/styles.css +593 -0
- package/src/components/radio-group/radio-group.tsx +8 -3
- package/src/components/rating/rating.tsx +5 -2
- package/src/components/scroll-area/index.ts +18 -0
- package/src/components/scroll-area/scroll-area.test.tsx +184 -0
- package/src/components/scroll-area/scroll-area.tsx +448 -0
- package/src/components/segment-group/segment-group.tsx +2 -2
- package/src/components/select/select.tsx +37 -18
- package/src/components/slider/slider.tsx +2 -2
- package/src/components/splitter/index.ts +15 -0
- package/src/components/splitter/splitter.test.tsx +244 -0
- package/src/components/splitter/splitter.tsx +625 -0
- package/src/components/spotlight/spotlight.test.tsx +34 -26
- package/src/components/spotlight/spotlight.tsx +7 -9
- package/src/components/steps/index.ts +21 -0
- package/src/components/steps/steps-data.tsx +179 -0
- package/src/components/steps/steps.test.tsx +235 -0
- package/src/components/steps/steps.tsx +686 -0
- package/src/components/switch/switch.tsx +7 -2
- package/src/components/table-of-contents/index.ts +17 -0
- package/src/components/table-of-contents/table-of-contents.test.tsx +289 -0
- package/src/components/table-of-contents/table-of-contents.tsx +708 -0
- package/src/components/tags-input/tags-input.tsx +12 -3
- package/src/components/textarea/textarea.tsx +15 -5
- package/src/components/tooltip/tooltip.tsx +8 -17
- package/src/components/tour/conditions.test.ts +527 -0
- package/src/components/tour/conditions.ts +445 -0
- package/src/components/tour/create-tours.tsx +150 -0
- package/src/components/tour/index.ts +86 -0
- package/src/components/tour/runtime.ts +187 -0
- package/src/components/tour/storage.test.ts +68 -0
- package/src/components/tour/storage.ts +44 -0
- package/src/components/tour/store.test.tsx +784 -0
- package/src/components/tour/store.ts +661 -0
- package/src/components/tour/tour.test.tsx +318 -0
- package/src/components/tour/tour.tsx +773 -0
- package/src/components/tour/tour.types.test.ts +185 -0
- package/src/components/tour/types.ts +904 -0
- package/src/components/tree/index.ts +24 -0
- package/src/components/tree/tree-row.tsx +179 -0
- package/src/components/tree/tree.test.tsx +296 -0
- package/src/components/tree/tree.tsx +796 -0
- package/src/components/tree-multi-select/tree-multi-select.tsx +29 -58
- package/src/components/tree-select/tree-popover.tsx +26 -107
- package/src/components/tree-select/tree-select.tsx +24 -16
- package/src/icon-stroke.test.tsx +2 -0
- package/src/index.ts +16 -0
- package/src/lib/date-predicates.test.ts +46 -0
- package/src/lib/date-predicates.ts +44 -24
- package/src/lib/date-value.test.ts +24 -1
- package/src/lib/date-value.ts +42 -1
- package/src/lib/floating-arrow.tsx +73 -0
- package/src/lib/focus-return.test.tsx +143 -0
- package/src/lib/focus-return.ts +106 -0
- package/src/lib/meter.test.ts +40 -0
- package/src/lib/meter.ts +159 -0
- package/src/lib/overlay-layer.test.tsx +47 -1
- package/src/lib/overlay-layer.tsx +65 -8
- package/src/lib/pressed.ts +130 -0
- package/src/lib/tree-data.ts +42 -2
- package/src/lib/use-pagination.test.ts +105 -0
- package/src/lib/use-pagination.ts +179 -0
- package/src/lib/use-scroll-spy.test.tsx +238 -0
- package/src/lib/use-scroll-spy.ts +336 -0
- package/src/theme.css +39 -3
- package/src/theme.test.ts +29 -1
- package/src/visually-hidden-containment.test.tsx +9 -0
- package/dist/chunk-2W7H43WL.js.map +0 -1
- package/dist/chunk-7E7JNWOC.js.map +0 -1
- package/dist/chunk-7FPSQBWB.js.map +0 -1
- package/dist/chunk-7KFUFAVP.js.map +0 -1
- package/dist/chunk-AKXALCUN.js.map +0 -1
- package/dist/chunk-B5YHYI7E.js.map +0 -1
- package/dist/chunk-FQJNQW3G.js.map +0 -1
- package/dist/chunk-G3AD3NJG.js.map +0 -1
- package/dist/chunk-GEZYGBXY.js.map +0 -1
- package/dist/chunk-HCHGERDB.js.map +0 -1
- package/dist/chunk-HWBFRDX7.js.map +0 -1
- package/dist/chunk-I4B3N3UX.js.map +0 -1
- package/dist/chunk-IA6DCC3N.js.map +0 -1
- package/dist/chunk-IANYMDKH.js.map +0 -1
- package/dist/chunk-MQHD3EJE.js.map +0 -1
- package/dist/chunk-NNPSBC7O.js.map +0 -1
- package/dist/chunk-OXR7BXZA.js.map +0 -1
- package/dist/chunk-QKSLDQM2.js +0 -120
- package/dist/chunk-QKSLDQM2.js.map +0 -1
- package/dist/chunk-QRNQQIQM.js.map +0 -1
- package/dist/chunk-RKCUXOU2.js.map +0 -1
- package/dist/chunk-S5CQRCTF.js +0 -426
- package/dist/chunk-S5CQRCTF.js.map +0 -1
- package/dist/chunk-SBZJGFZ6.js.map +0 -1
- package/dist/chunk-SP6LCCTZ.js.map +0 -1
- package/dist/chunk-TUP7WXQE.js.map +0 -1
- package/dist/chunk-V2QZG4IT.js.map +0 -1
- package/dist/chunk-X6DESK37.js.map +0 -1
- package/dist/chunk-ZB5VMGKB.js.map +0 -1
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
import { customAlphabet } from "nanoid"
|
|
2
|
+
import { devWarn } from "../../lib/dev-warn"
|
|
3
|
+
import { createFocusReturn, type FocusReturn } from "../../lib/focus-return"
|
|
4
|
+
import { isModalOpen, subscribeLayers } from "../../lib/overlay-layer"
|
|
5
|
+
import {
|
|
6
|
+
type ConditionServices,
|
|
7
|
+
createGateStore,
|
|
8
|
+
type GateStore,
|
|
9
|
+
resolveTarget,
|
|
10
|
+
sameState,
|
|
11
|
+
setupOf,
|
|
12
|
+
windowLocation,
|
|
13
|
+
} from "./runtime"
|
|
14
|
+
import type {
|
|
15
|
+
AnyTourDefinition,
|
|
16
|
+
ConditionCleanup,
|
|
17
|
+
ConditionState,
|
|
18
|
+
TourAnswers,
|
|
19
|
+
TourChecklistItem,
|
|
20
|
+
TourContext,
|
|
21
|
+
TourEndStatus,
|
|
22
|
+
TourEvent,
|
|
23
|
+
TourLocation,
|
|
24
|
+
TourRecord,
|
|
25
|
+
TourResult,
|
|
26
|
+
TourRunId,
|
|
27
|
+
TourSnapshot,
|
|
28
|
+
TourStepPatch,
|
|
29
|
+
TourStepState,
|
|
30
|
+
TourStorage,
|
|
31
|
+
} from "./types"
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The tour engine: a store outside React, like the overlays store, that owns
|
|
35
|
+
* the whole step flow. `<Tours />` only renders what it holds, so every rule
|
|
36
|
+
* below is testable without a DOM renderer, and a tour survives route changes.
|
|
37
|
+
*
|
|
38
|
+
* - **Queue (D7).** One tour runs at a time. A `start` while another runs
|
|
39
|
+
* waits for it to end; a tour never starts over an open Modal, Drawer or
|
|
40
|
+
* Lightbox, and starts once the last one closes.
|
|
41
|
+
* - **Steps.** `when` is checked when the tour starts and again before each
|
|
42
|
+
* step. A step whose target is missing waits (D3): `step:waiting`, then
|
|
43
|
+
* `step:timeout` after `wait.timeout` (5 s), and it carries on whenever the
|
|
44
|
+
* target shows up, even after the timeout.
|
|
45
|
+
* - **Gates.** The step's `until` runs while the step shows. Valid shows a
|
|
46
|
+
* tick (`TICK`), then advances when its `advance` is `"auto"` (D5).
|
|
47
|
+
* - **Focus.** Each run remembers where focus was when it started showing,
|
|
48
|
+
* and gives it back when it ends (`lib/focus-return.ts`).
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/** How long the tick shows before an auto step advances. */
|
|
52
|
+
export const TICK = 600
|
|
53
|
+
/** The default `wait.timeout` (D3). */
|
|
54
|
+
export const WAIT_TIMEOUT = 5000
|
|
55
|
+
|
|
56
|
+
const nanoid = customAlphabet("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 8)
|
|
57
|
+
const mintRunId = (): TourRunId => nanoid() as TourRunId
|
|
58
|
+
|
|
59
|
+
/** What the engine needs from `createTours`' config. */
|
|
60
|
+
export type TourEngineConfig = {
|
|
61
|
+
registry: Record<string, AnyTourDefinition>
|
|
62
|
+
app?: unknown
|
|
63
|
+
location?: TourLocation
|
|
64
|
+
storage?: TourStorage
|
|
65
|
+
onEvent?: (event: TourEvent) => void
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** How a run was asked for. */
|
|
69
|
+
type StartRequest = {
|
|
70
|
+
key: string
|
|
71
|
+
params: unknown
|
|
72
|
+
from?: string
|
|
73
|
+
resumed: boolean
|
|
74
|
+
answers: TourAnswers
|
|
75
|
+
resolve: (result: TourResult) => void
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** The step that shows, and everything that lives only as long as it does. */
|
|
79
|
+
type StepRun = {
|
|
80
|
+
index: number
|
|
81
|
+
state: TourStepState
|
|
82
|
+
gate: ConditionState | null
|
|
83
|
+
checklist: readonly TourChecklistItem[] | null
|
|
84
|
+
checking: boolean
|
|
85
|
+
help: { hint: string | undefined; pulse: boolean } | null
|
|
86
|
+
patch: TourStepPatch
|
|
87
|
+
attempts: number
|
|
88
|
+
startedAt: number
|
|
89
|
+
shown: boolean
|
|
90
|
+
abort: AbortController
|
|
91
|
+
/** Timers, observers and the condition's cleanup, undone on leave. */
|
|
92
|
+
undo: (() => void)[]
|
|
93
|
+
advanceTimer?: ReturnType<typeof setTimeout>
|
|
94
|
+
helpTimer?: ReturnType<typeof setTimeout>
|
|
95
|
+
waitTimer?: ReturnType<typeof setTimeout>
|
|
96
|
+
conditionCleanup?: ConditionCleanup
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** A running tour. */
|
|
100
|
+
type Run = {
|
|
101
|
+
id: TourRunId
|
|
102
|
+
key: string
|
|
103
|
+
tour: AnyTourDefinition
|
|
104
|
+
params: unknown
|
|
105
|
+
answers: TourAnswers
|
|
106
|
+
/** Indexes of the steps shown before this one, for Back. */
|
|
107
|
+
history: number[]
|
|
108
|
+
/** Indexes of the steps that show, as of the last step change: what
|
|
109
|
+
* `index` and `total` count. `when` is re-checked on each step. */
|
|
110
|
+
visible: number[]
|
|
111
|
+
/** Signals fired during this run that no step was waiting on yet, by
|
|
112
|
+
* name, oldest first. A later step's `signal()` takes the first payload
|
|
113
|
+
* its `match` accepts. Forgotten when the run ends. */
|
|
114
|
+
signals: Map<string, unknown[]>
|
|
115
|
+
step: StepRun | null
|
|
116
|
+
focus: FocusReturn
|
|
117
|
+
resolve: (result: TourResult) => void
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** A step of any registered tour. */
|
|
121
|
+
type AnyStep = AnyTourDefinition["steps"][number]
|
|
122
|
+
|
|
123
|
+
/** A step's `choices`, whatever its type. */
|
|
124
|
+
const choicesOf = (step: AnyStep) => ("choices" in step ? step.choices : undefined)
|
|
125
|
+
|
|
126
|
+
/** The step types that highlight an element and so must wait for it. */
|
|
127
|
+
const needsTarget = (step: AnyStep) =>
|
|
128
|
+
step.target !== undefined &&
|
|
129
|
+
(step.type === undefined || step.type === "tooltip" || step.type === "floating")
|
|
130
|
+
|
|
131
|
+
/** The tour's own elements, which focus may be taken back from. */
|
|
132
|
+
const tourElements = () =>
|
|
133
|
+
typeof document === "undefined" ? [] : [...document.querySelectorAll('[data-scope="tour"]')]
|
|
134
|
+
|
|
135
|
+
export type TourEngine = ReturnType<typeof createTourEngine>
|
|
136
|
+
|
|
137
|
+
export function createTourEngine(config: TourEngineConfig) {
|
|
138
|
+
const location = config.location ?? windowLocation
|
|
139
|
+
const gates: GateStore = createGateStore()
|
|
140
|
+
const signals = new Map<string, Set<(payload: unknown) => void>>()
|
|
141
|
+
const listeners = new Set<() => void>()
|
|
142
|
+
const queue: StartRequest[] = []
|
|
143
|
+
let run: Run | null = null
|
|
144
|
+
let snapshot: TourSnapshot | null = null
|
|
145
|
+
let stopWaitingForModal: (() => void) | null = null
|
|
146
|
+
|
|
147
|
+
/* ------------------------------------------------------------ plumbing */
|
|
148
|
+
|
|
149
|
+
const emitChange = () => {
|
|
150
|
+
snapshot = run?.step ? buildSnapshot(run, run.step) : null
|
|
151
|
+
for (const listener of listeners) listener()
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const persist = (key: string, record: Omit<TourRecord, "updatedAt">) => {
|
|
155
|
+
if (!config.storage) return
|
|
156
|
+
try {
|
|
157
|
+
Promise.resolve(config.storage.set(key, { ...record, updatedAt: Date.now() })).catch(() => {})
|
|
158
|
+
} catch {
|
|
159
|
+
// A storage that throws is best-effort, like `useLocalStorage`.
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const visibleIndexes = (current: Run) =>
|
|
164
|
+
current.tour.steps.flatMap((step, index) => (isEligible(current, step) ? [index] : []))
|
|
165
|
+
|
|
166
|
+
const event = (current: Run, step: StepRun | null) => {
|
|
167
|
+
const index = step ? Math.max(0, current.visible.indexOf(step.index)) : 0
|
|
168
|
+
return {
|
|
169
|
+
key: current.key,
|
|
170
|
+
version: current.tour.version,
|
|
171
|
+
run: current.id,
|
|
172
|
+
stepId: step ? (current.tour.steps[step.index]?.id ?? null) : null,
|
|
173
|
+
index,
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const send = (payload: TourEvent) => config.onEvent?.(payload)
|
|
178
|
+
|
|
179
|
+
/* ------------------------------------------------------------- context */
|
|
180
|
+
|
|
181
|
+
const media = (query: string) =>
|
|
182
|
+
typeof window !== "undefined" &&
|
|
183
|
+
typeof window.matchMedia === "function" &&
|
|
184
|
+
window.matchMedia(query).matches
|
|
185
|
+
|
|
186
|
+
const contextFor = (
|
|
187
|
+
current: Run,
|
|
188
|
+
target: HTMLElement | null,
|
|
189
|
+
signal: AbortSignal,
|
|
190
|
+
): TourContext => ({
|
|
191
|
+
target,
|
|
192
|
+
params: current.params,
|
|
193
|
+
answers: current.answers,
|
|
194
|
+
get location() {
|
|
195
|
+
return location.get()
|
|
196
|
+
},
|
|
197
|
+
media,
|
|
198
|
+
app: config.app,
|
|
199
|
+
signal,
|
|
200
|
+
tours: {
|
|
201
|
+
get active() {
|
|
202
|
+
return snapshot
|
|
203
|
+
},
|
|
204
|
+
goto: (id) => controller.goto(id),
|
|
205
|
+
},
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
const isEligible = (current: Run, step: AnyStep) => {
|
|
209
|
+
if (!step.when) return true
|
|
210
|
+
const probe = new AbortController()
|
|
211
|
+
const eligible = step.when(contextFor(current, resolveTarget(step.target), probe.signal))
|
|
212
|
+
probe.abort()
|
|
213
|
+
return eligible
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** The first eligible step from `index` on, going `direction`. */
|
|
217
|
+
const findStep = (current: Run, index: number, direction: 1 | -1) => {
|
|
218
|
+
for (let i = index; i >= 0 && i < current.tour.steps.length; i += direction) {
|
|
219
|
+
const step = current.tour.steps[i]
|
|
220
|
+
if (step && isEligible(current, step)) return i
|
|
221
|
+
}
|
|
222
|
+
return -1
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const buildSnapshot = (current: Run, step: StepRun): TourSnapshot => {
|
|
226
|
+
const definition = current.tour.steps[step.index] as AnyStep
|
|
227
|
+
const visible = current.visible
|
|
228
|
+
return {
|
|
229
|
+
run: current.id,
|
|
230
|
+
key: current.key,
|
|
231
|
+
version: current.tour.version,
|
|
232
|
+
stepId: definition.id,
|
|
233
|
+
index: Math.max(0, visible.indexOf(step.index)),
|
|
234
|
+
total: visible.length,
|
|
235
|
+
state: step.state,
|
|
236
|
+
gate: step.gate,
|
|
237
|
+
checklist: step.checklist,
|
|
238
|
+
checking: step.checking,
|
|
239
|
+
help: step.help,
|
|
240
|
+
step: { ...definition, ...step.patch } as TourSnapshot["step"],
|
|
241
|
+
answers: { ...current.answers },
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* --------------------------------------------------------------- steps */
|
|
246
|
+
|
|
247
|
+
const leaveStep = (current: Run) => {
|
|
248
|
+
const step = current.step
|
|
249
|
+
if (!step) return
|
|
250
|
+
step.abort.abort()
|
|
251
|
+
clearTimeout(step.advanceTimer)
|
|
252
|
+
clearTimeout(step.helpTimer)
|
|
253
|
+
clearTimeout(step.waitTimer)
|
|
254
|
+
step.conditionCleanup?.()
|
|
255
|
+
for (const undo of step.undo) undo()
|
|
256
|
+
current.step = null
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const armHelp = (current: Run, step: StepRun) => {
|
|
260
|
+
const help = current.tour.steps[step.index]?.help
|
|
261
|
+
clearTimeout(step.helpTimer)
|
|
262
|
+
if (!help || step.gate === "valid") return
|
|
263
|
+
step.helpTimer = setTimeout(() => {
|
|
264
|
+
if (current.step !== step) return
|
|
265
|
+
step.help = { hint: help.hint, pulse: help.pulse ?? false }
|
|
266
|
+
send({ ...event(current, step), type: "step:hint", hint: help.hint } as TourEvent)
|
|
267
|
+
emitChange()
|
|
268
|
+
}, help.after)
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const onReport = (current: Run, step: StepRun, state: ConditionState) => {
|
|
272
|
+
if (current.step !== step || step.abort.signal.aborted || sameState(step.gate, state)) return
|
|
273
|
+
step.gate = state
|
|
274
|
+
step.help = null
|
|
275
|
+
clearTimeout(step.advanceTimer)
|
|
276
|
+
if (typeof state === "object") {
|
|
277
|
+
step.attempts += 1
|
|
278
|
+
send({
|
|
279
|
+
...event(current, step),
|
|
280
|
+
type: "step:invalid",
|
|
281
|
+
message: state.invalid,
|
|
282
|
+
attempts: step.attempts,
|
|
283
|
+
} as TourEvent)
|
|
284
|
+
}
|
|
285
|
+
const definition = current.tour.steps[step.index] as AnyStep
|
|
286
|
+
const advance = definition.advance ?? definition.until?.advance ?? "auto"
|
|
287
|
+
if (state === "valid" && advance === "auto") {
|
|
288
|
+
step.advanceTimer = setTimeout(() => {
|
|
289
|
+
if (current.step === step) moveOn(current, "complete")
|
|
290
|
+
}, TICK)
|
|
291
|
+
}
|
|
292
|
+
armHelp(current, step)
|
|
293
|
+
emitChange()
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const services = (current: Run, step: StepRun): ConditionServices => ({
|
|
297
|
+
target: () => resolveTarget(current.tour.steps[step.index]?.target),
|
|
298
|
+
location,
|
|
299
|
+
onSignal: (name, listener) => {
|
|
300
|
+
// A signal this run already heard before any step waited on it.
|
|
301
|
+
const remembered = current.signals.get(name) ?? []
|
|
302
|
+
const taken = remembered.findIndex((payload) => listener(payload))
|
|
303
|
+
if (taken >= 0) remembered.splice(taken, 1)
|
|
304
|
+
let set = signals.get(name)
|
|
305
|
+
if (!set) {
|
|
306
|
+
set = new Set()
|
|
307
|
+
signals.set(name, set)
|
|
308
|
+
}
|
|
309
|
+
set.add(listener)
|
|
310
|
+
return () => {
|
|
311
|
+
set.delete(listener)
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
gates,
|
|
315
|
+
setChecking: (checking) => {
|
|
316
|
+
if (current.step !== step || step.checking === checking) return
|
|
317
|
+
step.checking = checking
|
|
318
|
+
emitChange()
|
|
319
|
+
},
|
|
320
|
+
setChecklist: (items) => {
|
|
321
|
+
if (current.step !== step) return
|
|
322
|
+
step.checklist = items
|
|
323
|
+
emitChange()
|
|
324
|
+
},
|
|
325
|
+
})
|
|
326
|
+
|
|
327
|
+
/** The step's target is on the page: show it, or carry on showing it. */
|
|
328
|
+
const show = (current: Run, step: StepRun) => {
|
|
329
|
+
clearTimeout(step.waitTimer)
|
|
330
|
+
step.state = "shown"
|
|
331
|
+
if (step.shown) return emitChange()
|
|
332
|
+
step.shown = true
|
|
333
|
+
step.startedAt = Date.now()
|
|
334
|
+
const definition = current.tour.steps[step.index] as AnyStep
|
|
335
|
+
send({ ...event(current, step), type: "step:show" } as TourEvent)
|
|
336
|
+
persist(current.key, {
|
|
337
|
+
version: current.tour.version,
|
|
338
|
+
status: "active",
|
|
339
|
+
stepId: definition.id,
|
|
340
|
+
answers: current.answers,
|
|
341
|
+
})
|
|
342
|
+
if (definition.until) {
|
|
343
|
+
const target = resolveTarget(definition.target)
|
|
344
|
+
step.conditionCleanup = setupOf(definition.until)(
|
|
345
|
+
contextFor(current, target, step.abort.signal),
|
|
346
|
+
(state) => onReport(current, step, state),
|
|
347
|
+
services(current, step),
|
|
348
|
+
)
|
|
349
|
+
}
|
|
350
|
+
armHelp(current, step)
|
|
351
|
+
emitChange()
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** The target is missing (D3): wait, and time out after `wait.timeout`. */
|
|
355
|
+
const wait = (current: Run, step: StepRun) => {
|
|
356
|
+
step.state = "loading"
|
|
357
|
+
const definition = current.tour.steps[step.index] as AnyStep
|
|
358
|
+
send({ ...event(current, step), type: "step:waiting" } as TourEvent)
|
|
359
|
+
const timeout = definition.wait?.timeout ?? WAIT_TIMEOUT
|
|
360
|
+
clearTimeout(step.waitTimer)
|
|
361
|
+
step.waitTimer = setTimeout(() => {
|
|
362
|
+
if (current.step !== step || step.state !== "loading") return
|
|
363
|
+
step.state = "timeout"
|
|
364
|
+
devWarn(
|
|
365
|
+
`[tour] "${current.key}" step "${definition.id}": its target is still missing after ${timeout}ms.`,
|
|
366
|
+
)
|
|
367
|
+
send({ ...event(current, step), type: "step:timeout", timeout } as TourEvent)
|
|
368
|
+
emitChange()
|
|
369
|
+
}, timeout)
|
|
370
|
+
emitChange()
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const enter = (current: Run, index: number) => {
|
|
374
|
+
leaveStep(current)
|
|
375
|
+
current.visible = visibleIndexes(current)
|
|
376
|
+
const definition = current.tour.steps[index] as AnyStep
|
|
377
|
+
const step: StepRun = {
|
|
378
|
+
index,
|
|
379
|
+
state: "loading",
|
|
380
|
+
gate: definition.until ? "pending" : null,
|
|
381
|
+
checklist: null,
|
|
382
|
+
checking: false,
|
|
383
|
+
help: null,
|
|
384
|
+
patch: {},
|
|
385
|
+
attempts: 0,
|
|
386
|
+
startedAt: Date.now(),
|
|
387
|
+
shown: false,
|
|
388
|
+
abort: new AbortController(),
|
|
389
|
+
undo: [],
|
|
390
|
+
}
|
|
391
|
+
current.step = step
|
|
392
|
+
if (!needsTarget(definition)) return show(current, step)
|
|
393
|
+
|
|
394
|
+
// Watch the target for the whole step: it may be missing now, show up
|
|
395
|
+
// later, or go away again (the user navigated); each flips the state.
|
|
396
|
+
const sync = () => {
|
|
397
|
+
if (current.step !== step) return
|
|
398
|
+
const present = resolveTarget(definition.target) !== null
|
|
399
|
+
if (present && step.state !== "shown") show(current, step)
|
|
400
|
+
else if (!present && step.state === "shown") wait(current, step)
|
|
401
|
+
}
|
|
402
|
+
if (typeof MutationObserver !== "undefined" && typeof document !== "undefined") {
|
|
403
|
+
const observer = new MutationObserver(sync)
|
|
404
|
+
observer.observe(document.documentElement, {
|
|
405
|
+
childList: true,
|
|
406
|
+
subtree: true,
|
|
407
|
+
attributes: true,
|
|
408
|
+
})
|
|
409
|
+
step.undo.push(() => observer.disconnect())
|
|
410
|
+
}
|
|
411
|
+
if (resolveTarget(definition.target)) show(current, step)
|
|
412
|
+
else wait(current, step)
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/** Leaves the step for the next eligible one, or ends the tour after the last. */
|
|
416
|
+
const moveOn = (current: Run, how: "complete" | "skip", to?: number) => {
|
|
417
|
+
const step = current.step
|
|
418
|
+
if (!step) return
|
|
419
|
+
const base = event(current, step)
|
|
420
|
+
if (how === "complete") {
|
|
421
|
+
send({
|
|
422
|
+
...base,
|
|
423
|
+
type: "step:complete",
|
|
424
|
+
duration: Date.now() - step.startedAt,
|
|
425
|
+
attempts: step.attempts,
|
|
426
|
+
} as TourEvent)
|
|
427
|
+
} else {
|
|
428
|
+
send({ ...base, type: "step:skip" } as TourEvent)
|
|
429
|
+
}
|
|
430
|
+
const next = to ?? findStep(current, step.index + 1, 1)
|
|
431
|
+
// The run ends here: on the last step's skip it ends skipped.
|
|
432
|
+
if (next < 0) return end(current, how === "skip" ? "skipped" : "completed")
|
|
433
|
+
current.history.push(step.index)
|
|
434
|
+
enter(current, next)
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/* ----------------------------------------------------------------- run */
|
|
438
|
+
|
|
439
|
+
const end = (current: Run, status: TourEndStatus) => {
|
|
440
|
+
const step = current.step
|
|
441
|
+
const stepId = step ? (current.tour.steps[step.index]?.id ?? null) : null
|
|
442
|
+
send({ ...event(current, step), type: "tour:end", stepId, status } as TourEvent)
|
|
443
|
+
leaveStep(current)
|
|
444
|
+
if (status !== "not-found") {
|
|
445
|
+
persist(current.key, {
|
|
446
|
+
version: current.tour.version,
|
|
447
|
+
status,
|
|
448
|
+
stepId,
|
|
449
|
+
answers: current.answers,
|
|
450
|
+
})
|
|
451
|
+
}
|
|
452
|
+
run = null
|
|
453
|
+
emitChange()
|
|
454
|
+
current.focus.restore()
|
|
455
|
+
current.resolve({ status, stepId, answers: { ...current.answers } })
|
|
456
|
+
pump()
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
const begin = (request: StartRequest) => {
|
|
460
|
+
const tour = config.registry[request.key]
|
|
461
|
+
if (!tour) {
|
|
462
|
+
devWarn(`[tour] start: no tour registered as "${request.key}".`)
|
|
463
|
+
request.resolve({ status: "not-found", stepId: null, answers: {} })
|
|
464
|
+
return pump()
|
|
465
|
+
}
|
|
466
|
+
const current: Run = {
|
|
467
|
+
id: mintRunId(),
|
|
468
|
+
key: request.key,
|
|
469
|
+
tour,
|
|
470
|
+
params: request.params ?? {},
|
|
471
|
+
answers: { ...request.answers },
|
|
472
|
+
history: [],
|
|
473
|
+
visible: [],
|
|
474
|
+
signals: new Map(),
|
|
475
|
+
step: null,
|
|
476
|
+
focus: createFocusReturn(tourElements),
|
|
477
|
+
resolve: request.resolve,
|
|
478
|
+
}
|
|
479
|
+
run = current
|
|
480
|
+
current.focus.capture()
|
|
481
|
+
|
|
482
|
+
const probe = new AbortController()
|
|
483
|
+
const allowed = tour.when ? tour.when(contextFor(current, null, probe.signal)) : true
|
|
484
|
+
probe.abort()
|
|
485
|
+
let first = -1
|
|
486
|
+
if (allowed) {
|
|
487
|
+
const from =
|
|
488
|
+
request.from === undefined ? 0 : tour.steps.findIndex((s) => s.id === request.from)
|
|
489
|
+
if (from < 0)
|
|
490
|
+
devWarn(`[tour] "${request.key}" has no step "${request.from}"; starting at the first.`)
|
|
491
|
+
first = findStep(current, Math.max(0, from), 1)
|
|
492
|
+
}
|
|
493
|
+
send({
|
|
494
|
+
...event(current, null),
|
|
495
|
+
type: "tour:start",
|
|
496
|
+
stepId: first < 0 ? null : (tour.steps[first]?.id ?? null),
|
|
497
|
+
resumed: request.resumed,
|
|
498
|
+
} as TourEvent)
|
|
499
|
+
if (first < 0) return end(current, "not-found")
|
|
500
|
+
enter(current, first)
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/** Starts the next queued tour, unless one runs or a modal is open. */
|
|
504
|
+
const pump = () => {
|
|
505
|
+
if (run || queue.length === 0) return
|
|
506
|
+
if (isModalOpen()) {
|
|
507
|
+
stopWaitingForModal ??= subscribeLayers(() => {
|
|
508
|
+
if (isModalOpen()) return
|
|
509
|
+
stopWaitingForModal?.()
|
|
510
|
+
stopWaitingForModal = null
|
|
511
|
+
pump()
|
|
512
|
+
})
|
|
513
|
+
return
|
|
514
|
+
}
|
|
515
|
+
const next = queue.shift()
|
|
516
|
+
if (next) begin(next)
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
const request = (
|
|
520
|
+
key: string,
|
|
521
|
+
options: { params?: unknown; from?: string } = {},
|
|
522
|
+
resumed = false,
|
|
523
|
+
answers: TourAnswers = {},
|
|
524
|
+
) =>
|
|
525
|
+
new Promise<TourResult>((resolve) => {
|
|
526
|
+
queue.push({ key, params: options.params, from: options.from, resumed, answers, resolve })
|
|
527
|
+
pump()
|
|
528
|
+
})
|
|
529
|
+
|
|
530
|
+
const record = async (key: string): Promise<TourRecord | null> => {
|
|
531
|
+
if (!config.storage) return null
|
|
532
|
+
try {
|
|
533
|
+
return (await config.storage.get(key)) ?? null
|
|
534
|
+
} catch {
|
|
535
|
+
return null
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/* ---------------------------------------------------------- controller */
|
|
540
|
+
|
|
541
|
+
const withRun = (name: string, action: (current: Run, step: StepRun) => void) => {
|
|
542
|
+
if (!run?.step) {
|
|
543
|
+
devWarn(`[tour] ${name}: no tour is running.`)
|
|
544
|
+
return
|
|
545
|
+
}
|
|
546
|
+
action(run, run.step)
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
const controller = {
|
|
550
|
+
start: (key: string, options?: { params?: unknown; from?: string }) => request(key, options),
|
|
551
|
+
|
|
552
|
+
startOnce: async (key: string, options?: { params?: unknown; from?: string }) => {
|
|
553
|
+
const saved = await record(key)
|
|
554
|
+
const version = config.registry[key]?.version
|
|
555
|
+
if (saved && saved.version === version && saved.status !== "active") return null
|
|
556
|
+
return request(key, options)
|
|
557
|
+
},
|
|
558
|
+
|
|
559
|
+
resume: async (key: string, options?: { params?: unknown; from?: string }) => {
|
|
560
|
+
const saved = await record(key)
|
|
561
|
+
const version = config.registry[key]?.version
|
|
562
|
+
const resumable =
|
|
563
|
+
saved && saved.version === version && saved.status === "active" && saved.stepId
|
|
564
|
+
if (!resumable) return request(key, options)
|
|
565
|
+
return request(
|
|
566
|
+
key,
|
|
567
|
+
{ ...options, from: options?.from ?? saved.stepId ?? undefined },
|
|
568
|
+
true,
|
|
569
|
+
saved.answers,
|
|
570
|
+
)
|
|
571
|
+
},
|
|
572
|
+
|
|
573
|
+
reset: async (key: string) => {
|
|
574
|
+
try {
|
|
575
|
+
await config.storage?.remove(key)
|
|
576
|
+
} catch {
|
|
577
|
+
// Best-effort, like every storage call.
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
|
|
581
|
+
next: () =>
|
|
582
|
+
withRun("next", (current, step) => {
|
|
583
|
+
const definition = current.tour.steps[step.index] as AnyStep
|
|
584
|
+
const answered = !choicesOf(definition) || current.answers[definition.id] !== undefined
|
|
585
|
+
const done =
|
|
586
|
+
step.state === "shown" && (step.gate === null || step.gate === "valid") && answered
|
|
587
|
+
moveOn(current, done ? "complete" : "skip")
|
|
588
|
+
}),
|
|
589
|
+
|
|
590
|
+
back: () =>
|
|
591
|
+
withRun("back", (current) => {
|
|
592
|
+
const previous = current.history.pop()
|
|
593
|
+
if (previous === undefined) return
|
|
594
|
+
enter(current, previous)
|
|
595
|
+
}),
|
|
596
|
+
|
|
597
|
+
goto: (id: string) =>
|
|
598
|
+
withRun("goto", (current, step) => {
|
|
599
|
+
const index = current.tour.steps.findIndex((s) => s.id === id)
|
|
600
|
+
if (index < 0) return devWarn(`[tour] goto: "${current.key}" has no step "${id}".`)
|
|
601
|
+
const target = findStep(current, index, 1)
|
|
602
|
+
if (target < 0) return end(current, "completed")
|
|
603
|
+
current.history.push(step.index)
|
|
604
|
+
enter(current, target)
|
|
605
|
+
}),
|
|
606
|
+
|
|
607
|
+
choose: (value: string) =>
|
|
608
|
+
withRun("choose", (current, step) => {
|
|
609
|
+
const definition = current.tour.steps[step.index] as AnyStep
|
|
610
|
+
const choice = choicesOf(definition)?.find((c) => c.value === value)
|
|
611
|
+
if (!choice)
|
|
612
|
+
return devWarn(`[tour] choose: step "${definition.id}" offers no choice "${value}".`)
|
|
613
|
+
current.answers[definition.id] = value
|
|
614
|
+
const to =
|
|
615
|
+
choice.goto === undefined
|
|
616
|
+
? undefined
|
|
617
|
+
: current.tour.steps.findIndex((s) => s.id === choice.goto)
|
|
618
|
+
moveOn(
|
|
619
|
+
current,
|
|
620
|
+
"complete",
|
|
621
|
+
to === undefined || to < 0 ? undefined : findStep(current, to, 1),
|
|
622
|
+
)
|
|
623
|
+
}),
|
|
624
|
+
|
|
625
|
+
skip: () => withRun("skip", (current) => end(current, "skipped")),
|
|
626
|
+
|
|
627
|
+
dismiss: () => withRun("dismiss", (current) => end(current, "dismissed")),
|
|
628
|
+
|
|
629
|
+
signal: (name: string, payload?: unknown) => {
|
|
630
|
+
if (!run) return // No tour runs: nothing to remember it for.
|
|
631
|
+
const listening = [...(signals.get(name) ?? [])]
|
|
632
|
+
const heard = listening.map((listener) => listener(payload)).some(Boolean)
|
|
633
|
+
if (heard) return
|
|
634
|
+
const remembered = run.signals.get(name) ?? []
|
|
635
|
+
remembered.push(payload)
|
|
636
|
+
run.signals.set(name, remembered)
|
|
637
|
+
},
|
|
638
|
+
|
|
639
|
+
update: (patch: TourStepPatch) =>
|
|
640
|
+
withRun("update", (_current, step) => {
|
|
641
|
+
step.patch = { ...step.patch, ...patch }
|
|
642
|
+
emitChange()
|
|
643
|
+
}),
|
|
644
|
+
|
|
645
|
+
get active() {
|
|
646
|
+
return snapshot
|
|
647
|
+
},
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
return {
|
|
651
|
+
controller,
|
|
652
|
+
gates,
|
|
653
|
+
subscribe: (listener: () => void) => {
|
|
654
|
+
listeners.add(listener)
|
|
655
|
+
return () => {
|
|
656
|
+
listeners.delete(listener)
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
getSnapshot: () => snapshot,
|
|
660
|
+
}
|
|
661
|
+
}
|