@constructive-io/ui 0.12.0 → 0.14.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/README.md +1 -1
- package/dist/{ai-CiaH2sfF.js → ai-4JrVVL3q.js} +1794 -250
- package/dist/ai-4JrVVL3q.js.map +1 -0
- package/dist/{ai-lAkichk8.cjs → ai-B08ufcbD.cjs} +1888 -248
- package/dist/ai-B08ufcbD.cjs.map +1 -0
- package/dist/{alert-BXuP0ayz.d.ts → alert-CJ4Qyk6W.d.cts} +4 -2
- package/dist/{alert-BXuP0ayz.d.cts → alert-CJ4Qyk6W.d.ts} +4 -2
- package/dist/components/accordion.cjs +60 -0
- package/dist/components/accordion.cjs.map +1 -0
- package/dist/components/accordion.d.cts +14 -0
- package/dist/components/accordion.d.ts +14 -0
- package/dist/components/accordion.js +54 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/ai/index.cjs +17 -1
- package/dist/components/ai/index.d.cts +2 -2
- package/dist/components/ai/index.d.ts +2 -2
- package/dist/components/ai/index.js +2 -2
- package/dist/components/alert-dialog.cjs +17 -8
- package/dist/components/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog.d.cts +1 -1
- package/dist/components/alert-dialog.d.ts +1 -1
- package/dist/components/alert-dialog.js +17 -8
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.cjs +18 -8
- package/dist/components/alert.cjs.map +1 -1
- package/dist/components/alert.d.cts +2 -2
- package/dist/components/alert.d.ts +2 -2
- package/dist/components/alert.js +18 -9
- package/dist/components/alert.js.map +1 -1
- package/dist/components/autocomplete.cjs +9 -5
- package/dist/components/autocomplete.cjs.map +1 -1
- package/dist/components/autocomplete.js +9 -5
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.cjs +9 -3
- package/dist/components/avatar.cjs.map +1 -1
- package/dist/components/avatar.d.cts +6 -0
- package/dist/components/avatar.d.ts +6 -0
- package/dist/components/avatar.js +9 -3
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.cjs +25 -18
- package/dist/components/badge.cjs.map +1 -1
- package/dist/components/badge.d.cts +2 -2
- package/dist/components/badge.d.ts +2 -2
- package/dist/components/badge.js +25 -18
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.cjs +9 -6
- package/dist/components/breadcrumb.cjs.map +1 -1
- package/dist/components/breadcrumb.js +9 -6
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button-group.cjs +57 -0
- package/dist/components/button-group.cjs.map +1 -0
- package/dist/components/button-group.d.cts +16 -0
- package/dist/components/button-group.d.ts +16 -0
- package/dist/components/button-group.js +51 -0
- package/dist/components/button-group.js.map +1 -0
- package/dist/components/button.cjs +62 -18
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +32 -2
- package/dist/components/button.d.ts +32 -2
- package/dist/components/button.js +62 -18
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-rac.cjs +14 -8
- package/dist/components/calendar-rac.cjs.map +1 -1
- package/dist/components/calendar-rac.js +14 -8
- package/dist/components/calendar-rac.js.map +1 -1
- package/dist/components/card.cjs +35 -23
- package/dist/components/card.cjs.map +1 -1
- package/dist/components/card.d.cts +3 -2
- package/dist/components/card.d.ts +3 -2
- package/dist/components/card.js +35 -23
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox.cjs +5 -5
- package/dist/components/checkbox.cjs.map +1 -1
- package/dist/components/checkbox.js +5 -5
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.cjs +3 -3
- package/dist/components/collapsible.cjs.map +1 -1
- package/dist/components/collapsible.js +3 -3
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.cjs +24 -12
- package/dist/components/combobox.cjs.map +1 -1
- package/dist/components/combobox.d.cts +2 -1
- package/dist/components/combobox.d.ts +2 -1
- package/dist/components/combobox.js +24 -12
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.cjs +30 -14
- package/dist/components/command.cjs.map +1 -1
- package/dist/components/command.d.cts +9 -2
- package/dist/components/command.d.ts +9 -2
- package/dist/components/command.js +30 -14
- package/dist/components/command.js.map +1 -1
- package/dist/components/dialog.cjs +22 -12
- package/dist/components/dialog.cjs.map +1 -1
- package/dist/components/dialog.d.cts +5 -2
- package/dist/components/dialog.d.ts +5 -2
- package/dist/components/dialog.js +22 -12
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.cjs +50 -27
- package/dist/components/dock.cjs.map +1 -1
- package/dist/components/dock.d.cts +1 -1
- package/dist/components/dock.d.ts +1 -1
- package/dist/components/dock.js +51 -28
- package/dist/components/dock.js.map +1 -1
- package/dist/components/drawer.cjs +22 -14
- package/dist/components/drawer.cjs.map +1 -1
- package/dist/components/drawer.js +22 -14
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +34 -28
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.d.cts +2 -2
- package/dist/components/dropdown-menu.d.ts +2 -2
- package/dist/components/dropdown-menu.js +52 -46
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty.cjs +4 -4
- package/dist/components/empty.cjs.map +1 -1
- package/dist/components/empty.js +4 -4
- package/dist/components/empty.js.map +1 -1
- package/dist/components/field.cjs +33 -33
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.js +34 -34
- package/dist/components/field.js.map +1 -1
- package/dist/components/flickering-grid.cjs +1 -1
- package/dist/components/flickering-grid.cjs.map +1 -1
- package/dist/components/flickering-grid.js +1 -1
- package/dist/components/flickering-grid.js.map +1 -1
- package/dist/components/flow-zoom-panel.cjs +10 -5
- package/dist/components/flow-zoom-panel.cjs.map +1 -1
- package/dist/components/flow-zoom-panel.d.cts +8 -1
- package/dist/components/flow-zoom-panel.d.ts +8 -1
- package/dist/components/flow-zoom-panel.js +10 -5
- package/dist/components/flow-zoom-panel.js.map +1 -1
- package/dist/components/form-control.cjs +12 -8
- package/dist/components/form-control.cjs.map +1 -1
- package/dist/components/form-control.js +12 -8
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/form.cjs +5 -5
- package/dist/components/form.cjs.map +1 -1
- package/dist/components/form.js +5 -5
- package/dist/components/form.js.map +1 -1
- package/dist/components/input-group.cjs +13 -7
- package/dist/components/input-group.cjs.map +1 -1
- package/dist/components/input-group.d.cts +2 -2
- package/dist/components/input-group.d.ts +2 -2
- package/dist/components/input-group.js +11 -7
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input-otp.cjs +252 -0
- package/dist/components/input-otp.cjs.map +1 -0
- package/dist/components/input-otp.d.cts +44 -0
- package/dist/components/input-otp.d.ts +44 -0
- package/dist/components/input-otp.js +251 -0
- package/dist/components/input-otp.js.map +1 -0
- package/dist/components/input.cjs +10 -4
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/input.d.cts +11 -2
- package/dist/components/input.d.ts +11 -2
- package/dist/components/input.js +10 -4
- package/dist/components/input.js.map +1 -1
- package/dist/components/item.cjs +151 -0
- package/dist/components/item.cjs.map +1 -0
- package/dist/components/item.d.cts +37 -0
- package/dist/components/item.d.ts +37 -0
- package/dist/components/item.js +137 -0
- package/dist/components/item.js.map +1 -0
- package/dist/components/json-input.cjs +4 -143
- package/dist/components/json-input.d.cts +6 -4
- package/dist/components/json-input.d.ts +6 -4
- package/dist/components/json-input.js +2 -140
- package/dist/components/kbd.cjs +35 -0
- package/dist/components/kbd.cjs.map +1 -0
- package/dist/components/kbd.d.cts +16 -0
- package/dist/components/kbd.d.ts +16 -0
- package/dist/components/kbd.js +31 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/label.cjs +3 -3
- package/dist/components/label.cjs.map +1 -1
- package/dist/components/label.js +3 -3
- package/dist/components/label.js.map +1 -1
- package/dist/components/motion-grid.cjs +20 -8
- package/dist/components/motion-grid.cjs.map +1 -1
- package/dist/components/motion-grid.js +20 -8
- package/dist/components/motion-grid.js.map +1 -1
- package/dist/components/multi-select.cjs +77 -67
- package/dist/components/multi-select.cjs.map +1 -1
- package/dist/components/multi-select.js +77 -67
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/page-header.cjs +12 -9
- package/dist/components/page-header.cjs.map +1 -1
- package/dist/components/page-header.js +12 -9
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.cjs +10 -4
- package/dist/components/pagination.cjs.map +1 -1
- package/dist/components/pagination.d.cts +1 -1
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/pagination.js +10 -4
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/phone-input.cjs +228 -0
- package/dist/components/phone-input.cjs.map +1 -0
- package/dist/components/phone-input.d.cts +42 -0
- package/dist/components/phone-input.d.ts +42 -0
- package/dist/components/phone-input.js +220 -0
- package/dist/components/phone-input.js.map +1 -0
- package/dist/components/popover.cjs +12 -4
- package/dist/components/popover.cjs.map +1 -1
- package/dist/components/popover.d.cts +7 -1
- package/dist/components/popover.d.ts +7 -1
- package/dist/components/popover.js +12 -5
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.cjs +20 -3
- package/dist/components/progress.cjs.map +1 -1
- package/dist/components/progress.d.cts +1 -1
- package/dist/components/progress.d.ts +1 -1
- package/dist/components/progress.js +20 -3
- package/dist/components/progress.js.map +1 -1
- package/dist/components/progressive-blur-scroll-container.cjs +2 -2
- package/dist/components/progressive-blur-scroll-container.cjs.map +1 -1
- package/dist/components/progressive-blur-scroll-container.d.cts +1 -1
- package/dist/components/progressive-blur-scroll-container.d.ts +1 -1
- package/dist/components/progressive-blur-scroll-container.js +2 -2
- package/dist/components/progressive-blur-scroll-container.js.map +1 -1
- package/dist/components/progressive-blur.cjs +3 -2
- package/dist/components/progressive-blur.cjs.map +1 -1
- package/dist/components/progressive-blur.js +3 -2
- package/dist/components/progressive-blur.js.map +1 -1
- package/dist/components/radio-group.cjs +2 -2
- package/dist/components/radio-group.cjs.map +1 -1
- package/dist/components/radio-group.js +2 -2
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/record-picker.cjs +1 -1
- package/dist/components/record-picker.js +1 -1
- package/dist/components/resizable.cjs +2 -2
- package/dist/components/resizable.cjs.map +1 -1
- package/dist/components/resizable.js +2 -2
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/responsive-diagram.cjs +43 -21
- package/dist/components/responsive-diagram.cjs.map +1 -1
- package/dist/components/responsive-diagram.d.cts +7 -1
- package/dist/components/responsive-diagram.d.ts +7 -1
- package/dist/components/responsive-diagram.js +43 -21
- package/dist/components/responsive-diagram.js.map +1 -1
- package/dist/components/scroll-area.cjs +2 -2
- package/dist/components/scroll-area.cjs.map +1 -1
- package/dist/components/scroll-area.js +2 -2
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/select.cjs +84 -20
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.d.cts +12 -7
- package/dist/components/select.d.ts +12 -7
- package/dist/components/select.js +84 -20
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +1 -1
- package/dist/components/separator.cjs.map +1 -1
- package/dist/components/separator.d.cts +11 -2
- package/dist/components/separator.d.ts +11 -2
- package/dist/components/separator.js +1 -1
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.cjs +1 -1
- package/dist/components/sheet.d.cts +11 -5
- package/dist/components/sheet.d.ts +12 -6
- package/dist/components/sheet.js +1 -1
- package/dist/components/sidebar.cjs +2 -1
- package/dist/components/sidebar.d.cts +8 -7
- package/dist/components/sidebar.d.ts +8 -7
- package/dist/components/sidebar.js +2 -1
- package/dist/components/slider.cjs +47 -0
- package/dist/components/slider.cjs.map +1 -0
- package/dist/components/slider.d.cts +8 -0
- package/dist/components/slider.d.ts +8 -0
- package/dist/components/slider.js +44 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sonner.cjs +15 -4
- package/dist/components/sonner.cjs.map +1 -1
- package/dist/components/sonner.d.cts +10 -1
- package/dist/components/sonner.d.ts +10 -1
- package/dist/components/sonner.js +16 -5
- package/dist/components/sonner.js.map +1 -1
- package/dist/components/spinner.cjs +25 -0
- package/dist/components/spinner.cjs.map +1 -0
- package/dist/components/spinner.d.cts +16 -0
- package/dist/components/spinner.d.ts +16 -0
- package/dist/components/spinner.js +22 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/stack/index.cjs +1 -1
- package/dist/components/stack/index.d.cts +1 -1
- package/dist/components/stack/index.d.ts +1 -1
- package/dist/components/stack/index.js +1 -1
- package/dist/components/stepper.cjs +23 -17
- package/dist/components/stepper.cjs.map +1 -1
- package/dist/components/stepper.d.cts +2 -2
- package/dist/components/stepper.d.ts +2 -2
- package/dist/components/stepper.js +23 -17
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.cjs +5 -5
- package/dist/components/switch.cjs.map +1 -1
- package/dist/components/switch.js +5 -5
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +26 -7
- package/dist/components/table.cjs.map +1 -1
- package/dist/components/table.d.cts +20 -2
- package/dist/components/table.d.ts +20 -2
- package/dist/components/table.js +26 -8
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.cjs +64 -8
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.d.cts +13 -2
- package/dist/components/tabs.d.ts +13 -2
- package/dist/components/tabs.js +66 -11
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tags.cjs +10 -5
- package/dist/components/tags.cjs.map +1 -1
- package/dist/components/tags.d.cts +1 -1
- package/dist/components/tags.d.ts +1 -1
- package/dist/components/tags.js +10 -5
- package/dist/components/tags.js.map +1 -1
- package/dist/components/textarea.cjs +5 -4
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/textarea.js +5 -4
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toast/index.cjs +1 -1
- package/dist/components/toast/index.d.cts +2 -2
- package/dist/components/toast/index.d.ts +2 -2
- package/dist/components/toast/index.js +1 -1
- package/dist/components/toggle-group.cjs +69 -0
- package/dist/components/toggle-group.cjs.map +1 -0
- package/dist/components/toggle-group.d.cts +27 -0
- package/dist/components/toggle-group.d.ts +27 -0
- package/dist/components/toggle-group.js +65 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.cjs +54 -0
- package/dist/components/toggle.cjs.map +1 -0
- package/dist/components/toggle.d.cts +13 -0
- package/dist/components/toggle.d.ts +13 -0
- package/dist/components/toggle.js +50 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tooltip.cjs +18 -6
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.d.cts +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +18 -6
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unlink-button.cjs +2 -2
- package/dist/components/unlink-button.cjs.map +1 -1
- package/dist/components/unlink-button.d.cts +1 -0
- package/dist/components/unlink-button.d.ts +1 -0
- package/dist/components/unlink-button.js +2 -2
- package/dist/components/unlink-button.js.map +1 -1
- package/dist/components/workspace-kit/index.cjs +1507 -0
- package/dist/components/workspace-kit/index.cjs.map +1 -0
- package/dist/components/workspace-kit/index.d.cts +728 -0
- package/dist/components/workspace-kit/index.d.ts +728 -0
- package/dist/components/workspace-kit/index.js +1440 -0
- package/dist/components/workspace-kit/index.js.map +1 -0
- package/dist/compose-refs-Mbma1O3M.js +47 -0
- package/dist/compose-refs-Mbma1O3M.js.map +1 -0
- package/dist/compose-refs-uPrvNoiU.cjs +52 -0
- package/dist/compose-refs-uPrvNoiU.cjs.map +1 -0
- package/dist/fluid-highlight-CNELHV8o.js +134 -0
- package/dist/fluid-highlight-CNELHV8o.js.map +1 -0
- package/dist/fluid-highlight-YWFRZXsw.cjs +145 -0
- package/dist/fluid-highlight-YWFRZXsw.cjs.map +1 -0
- package/dist/{index-BzLmDsId.d.cts → index-B7cT7gZU.d.cts} +3 -3
- package/dist/{index-BzLmDsId.d.ts → index-B7cT7gZU.d.ts} +3 -3
- package/dist/{index-UnM04j0t.d.ts → index-BQZxmMpw.d.cts} +11 -31
- package/dist/{index-UnM04j0t.d.cts → index-BQZxmMpw.d.ts} +11 -31
- package/dist/{index-CyaFaZe2.d.cts → index-Cluc_xc5.d.ts} +345 -20
- package/dist/{index-B0wXxIAb.d.ts → index-DXoG0ghv.d.cts} +345 -20
- package/dist/index.cjs +107 -17
- package/dist/index.d.cts +64 -14
- package/dist/index.d.ts +64 -14
- package/dist/index.js +27 -14
- package/dist/initial-focus-B8RLtyOZ.cjs +67 -0
- package/dist/initial-focus-B8RLtyOZ.cjs.map +1 -0
- package/dist/initial-focus-j2E0EnIx.js +61 -0
- package/dist/initial-focus-j2E0EnIx.js.map +1 -0
- package/dist/initials-DSkWTOb0.cjs +127 -0
- package/dist/initials-DSkWTOb0.cjs.map +1 -0
- package/dist/initials-kCcHgrSy.js +97 -0
- package/dist/initials-kCcHgrSy.js.map +1 -0
- package/dist/json-input-CH5aEmoA.js +293 -0
- package/dist/json-input-CH5aEmoA.js.map +1 -0
- package/dist/json-input-D8yM578l.cjs +311 -0
- package/dist/json-input-D8yM578l.cjs.map +1 -0
- package/dist/{motion-config-COCFHq1L.cjs → motion-config-DZ7w5Uhq.cjs} +32 -2
- package/dist/motion-config-DZ7w5Uhq.cjs.map +1 -0
- package/dist/{motion-config-COsZ6azM.js → motion-config-DoFp4I8f.js} +21 -3
- package/dist/motion-config-DoFp4I8f.js.map +1 -0
- package/dist/{record-picker-Bz4FApxD.cjs → record-picker-BQ1-Vx0g.cjs} +23 -8
- package/dist/record-picker-BQ1-Vx0g.cjs.map +1 -0
- package/dist/{record-picker-BbxngCeV.js → record-picker-DSRo4RXV.js} +23 -8
- package/dist/record-picker-DSRo4RXV.js.map +1 -0
- package/dist/{sheet-BdA0rfIz.cjs → sheet-OxWlnT_G.cjs} +25 -32
- package/dist/sheet-OxWlnT_G.cjs.map +1 -0
- package/dist/{sheet-BLHnhLRH.js → sheet-wPF_l9Cn.js} +25 -32
- package/dist/sheet-wPF_l9Cn.js.map +1 -0
- package/dist/{sidebar-BavjjJp0.cjs → sidebar-BEEWmJwC.cjs} +74 -57
- package/dist/sidebar-BEEWmJwC.cjs.map +1 -0
- package/dist/{sidebar-DeoL2ttp.js → sidebar-DWl1Azyv.js} +74 -57
- package/dist/sidebar-DWl1Azyv.js.map +1 -0
- package/dist/{stack-ci2lkfkr.cjs → stack-CEvmUSwF.cjs} +12 -10
- package/dist/stack-CEvmUSwF.cjs.map +1 -0
- package/dist/{stack-C9GROTGA.js → stack-Kqu7YaR0.js} +12 -10
- package/dist/stack-Kqu7YaR0.js.map +1 -0
- package/dist/text-runs-CdmlS5C7.cjs +52 -0
- package/dist/text-runs-CdmlS5C7.cjs.map +1 -0
- package/dist/text-runs-DqcEO8L_.js +45 -0
- package/dist/text-runs-DqcEO8L_.js.map +1 -0
- package/dist/theme-CKpIa4Fj.d.cts +536 -0
- package/dist/theme-CKpIa4Fj.d.ts +536 -0
- package/dist/theme-dials-config.cjs +273 -0
- package/dist/theme-dials-config.cjs.map +1 -0
- package/dist/theme-dials-config.d.cts +95 -0
- package/dist/theme-dials-config.d.ts +95 -0
- package/dist/theme-dials-config.js +269 -0
- package/dist/theme-dials-config.js.map +1 -0
- package/dist/theme-presets.cjs +922 -0
- package/dist/theme-presets.cjs.map +1 -0
- package/dist/theme-presets.d.cts +89 -0
- package/dist/theme-presets.d.ts +89 -0
- package/dist/theme-presets.js +912 -0
- package/dist/theme-presets.js.map +1 -0
- package/dist/theme-tuning-CTOHSrsh.d.cts +158 -0
- package/dist/theme-tuning-DOko6Pmy.d.ts +158 -0
- package/dist/theme-tuning.cjs +349 -0
- package/dist/theme-tuning.cjs.map +1 -0
- package/dist/theme-tuning.d.cts +2 -0
- package/dist/theme-tuning.d.ts +2 -0
- package/dist/theme-tuning.js +333 -0
- package/dist/theme-tuning.js.map +1 -0
- package/dist/theme.cjs +438 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +2 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +436 -0
- package/dist/theme.js.map +1 -0
- package/dist/toast-08jF1DBQ.cjs +193 -0
- package/dist/toast-08jF1DBQ.cjs.map +1 -0
- package/dist/toast-CVW5XY4u.js +164 -0
- package/dist/toast-CVW5XY4u.js.map +1 -0
- package/dist/toast-details-BdxxSLlN.cjs +209 -0
- package/dist/toast-details-BdxxSLlN.cjs.map +1 -0
- package/dist/toast-details-CfsB1Vxb.js +198 -0
- package/dist/toast-details-CfsB1Vxb.js.map +1 -0
- package/dist/{tooltip-CTRQoN1A.d.ts → tooltip-Fqb4JK-g.d.cts} +2 -2
- package/dist/{tooltip-CTRQoN1A.d.cts → tooltip-Fqb4JK-g.d.ts} +2 -2
- package/dist/tuning-BKVFsxLr.js +48 -0
- package/dist/tuning-BKVFsxLr.js.map +1 -0
- package/dist/tuning-BRPG7U1U.cjs +71 -0
- package/dist/tuning-BRPG7U1U.cjs.map +1 -0
- package/dist/use-document-theme-BSEuNsEE.cjs +43 -0
- package/dist/use-document-theme-BSEuNsEE.cjs.map +1 -0
- package/dist/use-document-theme-Ch_PqxZz.js +38 -0
- package/dist/use-document-theme-Ch_PqxZz.js.map +1 -0
- package/dist/use-scroll-fade-CaHp52u4.cjs +79 -0
- package/dist/use-scroll-fade-CaHp52u4.cjs.map +1 -0
- package/dist/use-scroll-fade-ilq-o00-.js +72 -0
- package/dist/use-scroll-fade-ilq-o00-.js.map +1 -0
- package/package.json +166 -27
- package/src/styles/globals.css +194 -97
- package/dist/ai-CiaH2sfF.js.map +0 -1
- package/dist/ai-lAkichk8.cjs.map +0 -1
- package/dist/button-Bvh83YGs.d.cts +0 -20
- package/dist/button-Bvh83YGs.d.ts +0 -20
- package/dist/components/app-bar.cjs +0 -81
- package/dist/components/app-bar.cjs.map +0 -1
- package/dist/components/app-bar.d.cts +0 -27
- package/dist/components/app-bar.d.ts +0 -27
- package/dist/components/app-bar.js +0 -77
- package/dist/components/app-bar.js.map +0 -1
- package/dist/components/app-shell.cjs +0 -267
- package/dist/components/app-shell.cjs.map +0 -1
- package/dist/components/app-shell.d.cts +0 -98
- package/dist/components/app-shell.d.ts +0 -98
- package/dist/components/app-shell.js +0 -264
- package/dist/components/app-shell.js.map +0 -1
- package/dist/components/json-input.cjs.map +0 -1
- package/dist/components/json-input.js.map +0 -1
- package/dist/input-CBrCuMH8.d.cts +0 -11
- package/dist/input-CBrCuMH8.d.ts +0 -11
- package/dist/motion-config-COCFHq1L.cjs.map +0 -1
- package/dist/motion-config-COsZ6azM.js.map +0 -1
- package/dist/record-picker-BbxngCeV.js.map +0 -1
- package/dist/record-picker-Bz4FApxD.cjs.map +0 -1
- package/dist/separator-BQEsr0Rc.d.cts +0 -11
- package/dist/separator-BQEsr0Rc.d.ts +0 -11
- package/dist/sheet-BLHnhLRH.js.map +0 -1
- package/dist/sheet-BdA0rfIz.cjs.map +0 -1
- package/dist/sidebar-BavjjJp0.cjs.map +0 -1
- package/dist/sidebar-DeoL2ttp.js.map +0 -1
- package/dist/stack-C9GROTGA.js.map +0 -1
- package/dist/stack-ci2lkfkr.cjs.map +0 -1
- package/dist/toast-D6MqijT2.cjs +0 -316
- package/dist/toast-D6MqijT2.cjs.map +0 -1
- package/dist/toast-D_BOLzm3.js +0 -287
- package/dist/toast-D_BOLzm3.js.map +0 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Button } from "./components/button.js";
|
|
3
|
+
import { Dialog, DialogClose, DialogContent as DialogPopup, DialogFooter, DialogHeader, DialogPanel, DialogTitle } from "./components/dialog.js";
|
|
4
|
+
import { useEffect, useId, useRef, useState, useSyncExternalStore } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
7
|
+
import { createRoot } from "react-dom/client";
|
|
8
|
+
|
|
9
|
+
//#region src/components/toast/toast-details.tsx
|
|
10
|
+
const COPIED_FEEDBACK_MS = 1500;
|
|
11
|
+
const ROOT_SLOT = "toast-details-root";
|
|
12
|
+
const STORE_KEY = Symbol.for("constructive.toast-details");
|
|
13
|
+
const EMPTY = {
|
|
14
|
+
details: null,
|
|
15
|
+
hosts: []
|
|
16
|
+
};
|
|
17
|
+
function getStore() {
|
|
18
|
+
const scope = globalThis;
|
|
19
|
+
return scope[STORE_KEY] ??= {
|
|
20
|
+
snapshot: EMPTY,
|
|
21
|
+
listeners: /* @__PURE__ */ new Set()
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function update(next) {
|
|
25
|
+
const store = getStore();
|
|
26
|
+
store.snapshot = next;
|
|
27
|
+
for (const listener of store.listeners) listener();
|
|
28
|
+
}
|
|
29
|
+
function subscribe(listener) {
|
|
30
|
+
const { listeners } = getStore();
|
|
31
|
+
listeners.add(listener);
|
|
32
|
+
return () => {
|
|
33
|
+
listeners.delete(listener);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const getSnapshot = () => getStore().snapshot;
|
|
37
|
+
const getServerSnapshot = () => EMPTY;
|
|
38
|
+
function registerHost(id) {
|
|
39
|
+
update({
|
|
40
|
+
...getSnapshot(),
|
|
41
|
+
hosts: [...getSnapshot().hosts, id]
|
|
42
|
+
});
|
|
43
|
+
return () => {
|
|
44
|
+
const current = getSnapshot();
|
|
45
|
+
const hosts = current.hosts.filter((host) => host !== id);
|
|
46
|
+
update({
|
|
47
|
+
details: hosts.length > 0 ? current.details : null,
|
|
48
|
+
hosts
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const closeDetails = () => update({
|
|
53
|
+
...getSnapshot(),
|
|
54
|
+
details: null
|
|
55
|
+
});
|
|
56
|
+
function currentFocus() {
|
|
57
|
+
const active = document.activeElement;
|
|
58
|
+
return active instanceof HTMLElement && active !== document.body ? active : null;
|
|
59
|
+
}
|
|
60
|
+
/** Sonner's own region, for a dialog opened without our `Toaster`; found by Sonner's default label. */
|
|
61
|
+
function findToasterRegion() {
|
|
62
|
+
return document.querySelector("section[aria-live=\"polite\"][aria-label^=\"Notifications\"]");
|
|
63
|
+
}
|
|
64
|
+
function ToastDetailsDialog({ details, regionRef, onClosed }) {
|
|
65
|
+
const { title, description, trigger } = details;
|
|
66
|
+
const [open, setOpen] = useState(true);
|
|
67
|
+
const [copied, setCopied] = useState(false);
|
|
68
|
+
const feedbackTimer = useRef(void 0);
|
|
69
|
+
const mounted = useRef(true);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
mounted.current = true;
|
|
72
|
+
return () => {
|
|
73
|
+
mounted.current = false;
|
|
74
|
+
clearTimeout(feedbackTimer.current);
|
|
75
|
+
};
|
|
76
|
+
}, []);
|
|
77
|
+
const handleCopy = async () => {
|
|
78
|
+
try {
|
|
79
|
+
await navigator.clipboard.writeText(description);
|
|
80
|
+
} catch {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!mounted.current) return;
|
|
84
|
+
setCopied(true);
|
|
85
|
+
clearTimeout(feedbackTimer.current);
|
|
86
|
+
feedbackTimer.current = setTimeout(() => setCopied(false), COPIED_FEEDBACK_MS);
|
|
87
|
+
};
|
|
88
|
+
const finalFocus = () => trigger?.isConnected ? trigger : regionRef?.current ?? findToasterRegion() ?? true;
|
|
89
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
90
|
+
open,
|
|
91
|
+
onOpenChange: setOpen,
|
|
92
|
+
onOpenChangeComplete: (isOpen) => !isOpen && onClosed(),
|
|
93
|
+
children: /* @__PURE__ */ jsxs(DialogPopup, {
|
|
94
|
+
className: "max-w-2xl",
|
|
95
|
+
finalFocus,
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: title }) }),
|
|
98
|
+
/* @__PURE__ */ jsx(DialogPanel, { children: /* @__PURE__ */ jsx("pre", {
|
|
99
|
+
className: "bg-muted text-foreground rounded-md p-3 text-xs break-words whitespace-pre-wrap",
|
|
100
|
+
children: description
|
|
101
|
+
}) }),
|
|
102
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsxs(Button, {
|
|
103
|
+
variant: "outline",
|
|
104
|
+
size: "sm",
|
|
105
|
+
onClick: handleCopy,
|
|
106
|
+
children: [copied ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
107
|
+
size: 14,
|
|
108
|
+
"aria-hidden": "true"
|
|
109
|
+
}) : /* @__PURE__ */ jsx(CopyIcon, {
|
|
110
|
+
size: 14,
|
|
111
|
+
"aria-hidden": "true"
|
|
112
|
+
}), copied ? "Copied" : "Copy"]
|
|
113
|
+
}), /* @__PURE__ */ jsx(DialogClose, {
|
|
114
|
+
asChild: true,
|
|
115
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
116
|
+
size: "sm",
|
|
117
|
+
children: "Close"
|
|
118
|
+
})
|
|
119
|
+
})] })
|
|
120
|
+
]
|
|
121
|
+
})
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Shows the dialog opened by `openToastDetails`. `Toaster` renders it next to Sonner, and that placement is the point:
|
|
126
|
+
*
|
|
127
|
+
* - It is not below Sonner in the React tree, so Sonner never sees its events. Sonner reads pointer and hover events
|
|
128
|
+
* from everything beneath it, portals included: a dialog inside the toast would vanish when the toast's timer ran out
|
|
129
|
+
* (a keyboard or screen-reader user has no pointer holding it open), a drag inside it would read as a swipe that
|
|
130
|
+
* dismisses the toast, and it would keep the toaster in its hover state long after it closed.
|
|
131
|
+
* - It is inside whatever the app wrapped `Toaster` in, so it gets the app's providers: Base UI's `DirectionProvider`,
|
|
132
|
+
* motion settings, the portal context, a theme or an i18n provider.
|
|
133
|
+
*
|
|
134
|
+
* With several toasters mounted, the first one shows the dialog.
|
|
135
|
+
*/
|
|
136
|
+
function ToastDetailsHost({ regionRef }) {
|
|
137
|
+
const id = useId();
|
|
138
|
+
const { details, hosts } = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
139
|
+
useEffect(() => registerHost(id), [id]);
|
|
140
|
+
if (!details || hosts[0] !== id) return null;
|
|
141
|
+
return /* @__PURE__ */ jsx(ToastDetailsDialog, {
|
|
142
|
+
details,
|
|
143
|
+
regionRef,
|
|
144
|
+
onClosed: closeDetails
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Without a host, in a React root of its own on `document.body`: for an app that mounts Sonner's `Toaster` directly
|
|
149
|
+
* instead of ours. It works the same, but a root of its own does not inherit the app's providers, and when the toast
|
|
150
|
+
* is gone focus can only fall back to the region of Sonner's default label.
|
|
151
|
+
*/
|
|
152
|
+
function openInOwnRoot(details) {
|
|
153
|
+
if (document.querySelector(`[data-slot="${ROOT_SLOT}"]`)) return;
|
|
154
|
+
const container = document.createElement("div");
|
|
155
|
+
container.setAttribute("data-slot", ROOT_SLOT);
|
|
156
|
+
document.body.appendChild(container);
|
|
157
|
+
const root = createRoot(container);
|
|
158
|
+
let disposed = false;
|
|
159
|
+
const dispose = () => {
|
|
160
|
+
if (disposed) return;
|
|
161
|
+
disposed = true;
|
|
162
|
+
setTimeout(() => {
|
|
163
|
+
root.unmount();
|
|
164
|
+
container.remove();
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
root.render(/* @__PURE__ */ jsx(ToastDetailsDialog, {
|
|
168
|
+
details,
|
|
169
|
+
onClosed: dispose
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Opens the full text of a toast in a dialog.
|
|
174
|
+
*
|
|
175
|
+
* The toaster shows it when one of ours is mounted, and `trigger` (default: the focused element) gets focus back on
|
|
176
|
+
* close. See `ToastDetailsHost` for why the toast itself must not render the dialog, and `openInOwnRoot` for the
|
|
177
|
+
* fallback when no toaster of ours is mounted.
|
|
178
|
+
*/
|
|
179
|
+
function openToastDetails(details) {
|
|
180
|
+
if (typeof document === "undefined") return;
|
|
181
|
+
const request = {
|
|
182
|
+
...details,
|
|
183
|
+
trigger: details.trigger ?? currentFocus()
|
|
184
|
+
};
|
|
185
|
+
const { details: open, hosts } = getSnapshot();
|
|
186
|
+
if (hosts.length === 0) {
|
|
187
|
+
openInOwnRoot(request);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (!open) update({
|
|
191
|
+
hosts,
|
|
192
|
+
details: request
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
//#endregion
|
|
197
|
+
export { openToastDetails as n, ToastDetailsHost as t };
|
|
198
|
+
//# sourceMappingURL=toast-details-CfsB1Vxb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-details-CfsB1Vxb.js","names":[],"sources":["../src/components/toast/toast-details.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useId, useRef, useState, useSyncExternalStore } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { CheckIcon, CopyIcon } from 'lucide-react';\n\nimport { Button } from '../button';\nimport {\n\tDialog,\n\tDialogClose,\n\tDialogFooter,\n\tDialogHeader,\n\tDialogPanel,\n\tDialogPopup,\n\tDialogTitle,\n} from '../dialog';\n\nexport interface ToastDetails {\n\ttitle: string;\n\tdescription: string;\n\t/** The control that opened the dialog. Focus goes back to it on close while it is still on the page. */\n\ttrigger?: HTMLElement | null;\n}\n\ntype RegionRef = React.RefObject<HTMLElement | null>;\n\nconst COPIED_FEEDBACK_MS = 1500;\nconst ROOT_SLOT = 'toast-details-root';\n\n// ---------------------------------------------------------------------------------------------------------------------\n// The request to show a toast's details, shared between whoever asks (a toast) and whoever shows it (a host).\n//\n// It lives on `globalThis` so that two copies of this module, such as the package and a copy from the registry, still\n// find each other: a toast from one copy is shown by the `Toaster` of the other.\n// ---------------------------------------------------------------------------------------------------------------------\n\ninterface Snapshot {\n\treadonly details: ToastDetails | null;\n\treadonly hosts: readonly string[];\n}\n\ninterface Store {\n\tsnapshot: Snapshot;\n\tlisteners: Set<() => void>;\n}\n\nconst STORE_KEY = Symbol.for('constructive.toast-details');\nconst EMPTY: Snapshot = { details: null, hosts: [] };\n\nfunction getStore(): Store {\n\tconst scope = globalThis as unknown as Record<symbol, Store | undefined>;\n\treturn (scope[STORE_KEY] ??= { snapshot: EMPTY, listeners: new Set() });\n}\n\nfunction update(next: Snapshot) {\n\tconst store = getStore();\n\tstore.snapshot = next;\n\tfor (const listener of store.listeners) listener();\n}\n\nfunction subscribe(listener: () => void) {\n\tconst { listeners } = getStore();\n\tlisteners.add(listener);\n\treturn () => {\n\t\tlisteners.delete(listener);\n\t};\n}\n\nconst getSnapshot = () => getStore().snapshot;\nconst getServerSnapshot = () => EMPTY;\n\nfunction registerHost(id: string) {\n\tupdate({ ...getSnapshot(), hosts: [...getSnapshot().hosts, id] });\n\treturn () => {\n\t\tconst current = getSnapshot();\n\t\tconst hosts = current.hosts.filter((host) => host !== id);\n\t\t// With no host left nothing would show the request, and a request nobody shows must not block the next one.\n\t\tupdate({ details: hosts.length > 0 ? current.details : null, hosts });\n\t};\n}\n\nconst closeDetails = () => update({ ...getSnapshot(), details: null });\n\nfunction currentFocus() {\n\tconst active = document.activeElement;\n\treturn active instanceof HTMLElement && active !== document.body ? active : null;\n}\n\n/** Sonner's own region, for a dialog opened without our `Toaster`; found by Sonner's default label. */\nfunction findToasterRegion() {\n\treturn document.querySelector<HTMLElement>('section[aria-live=\"polite\"][aria-label^=\"Notifications\"]');\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n// The dialog\n// ---------------------------------------------------------------------------------------------------------------------\n\nfunction ToastDetailsDialog({\n\tdetails,\n\tregionRef,\n\tonClosed,\n}: {\n\tdetails: ToastDetails;\n\tregionRef?: RegionRef;\n\tonClosed: () => void;\n}) {\n\tconst { title, description, trigger } = details;\n\tconst [open, setOpen] = useState(true);\n\tconst [copied, setCopied] = useState(false);\n\tconst feedbackTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\tconst mounted = useRef(true);\n\n\tuseEffect(() => {\n\t\tmounted.current = true;\n\t\treturn () => {\n\t\t\tmounted.current = false;\n\t\t\tclearTimeout(feedbackTimer.current);\n\t\t};\n\t}, []);\n\n\tconst handleCopy = async () => {\n\t\ttry {\n\t\t\tawait navigator.clipboard.writeText(description);\n\t\t} catch {\n\t\t\t// Clipboard may be unavailable (e.g., insecure context) — silently ignore.\n\t\t\treturn;\n\t\t}\n\t\tif (!mounted.current) return;\n\t\tsetCopied(true);\n\t\t// One feedback window: a second copy extends it instead of the first one cutting it short.\n\t\tclearTimeout(feedbackTimer.current);\n\t\tfeedbackTimer.current = setTimeout(() => setCopied(false), COPIED_FEEDBACK_MS);\n\t};\n\n\t// Focus goes back to the control that opened the dialog while it is still on the page. A toast that timed out while\n\t// the dialog was open took that control with it, and the toaster's region is the nearest place left; failing that,\n\t// the browser's default.\n\tconst finalFocus = () => (trigger?.isConnected ? trigger : (regionRef?.current ?? findToasterRegion() ?? true));\n\n\treturn (\n\t\t<Dialog open={open} onOpenChange={setOpen} onOpenChangeComplete={(isOpen) => !isOpen && onClosed()}>\n\t\t\t<DialogPopup className='max-w-2xl' finalFocus={finalFocus}>\n\t\t\t\t<DialogHeader>\n\t\t\t\t\t<DialogTitle>{title}</DialogTitle>\n\t\t\t\t</DialogHeader>\n\t\t\t\t<DialogPanel>\n\t\t\t\t\t<pre className='bg-muted text-foreground rounded-md p-3 text-xs break-words whitespace-pre-wrap'>\n\t\t\t\t\t\t{description}\n\t\t\t\t\t</pre>\n\t\t\t\t</DialogPanel>\n\t\t\t\t<DialogFooter>\n\t\t\t\t\t<Button variant='outline' size='sm' onClick={handleCopy}>\n\t\t\t\t\t\t{copied ? <CheckIcon size={14} aria-hidden='true' /> : <CopyIcon size={14} aria-hidden='true' />}\n\t\t\t\t\t\t{copied ? 'Copied' : 'Copy'}\n\t\t\t\t\t</Button>\n\t\t\t\t\t<DialogClose asChild>\n\t\t\t\t\t\t<Button size='sm'>Close</Button>\n\t\t\t\t\t</DialogClose>\n\t\t\t\t</DialogFooter>\n\t\t\t</DialogPopup>\n\t\t</Dialog>\n\t);\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n// Where it is shown\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Shows the dialog opened by `openToastDetails`. `Toaster` renders it next to Sonner, and that placement is the point:\n *\n * - It is not below Sonner in the React tree, so Sonner never sees its events. Sonner reads pointer and hover events\n * from everything beneath it, portals included: a dialog inside the toast would vanish when the toast's timer ran out\n * (a keyboard or screen-reader user has no pointer holding it open), a drag inside it would read as a swipe that\n * dismisses the toast, and it would keep the toaster in its hover state long after it closed.\n * - It is inside whatever the app wrapped `Toaster` in, so it gets the app's providers: Base UI's `DirectionProvider`,\n * motion settings, the portal context, a theme or an i18n provider.\n *\n * With several toasters mounted, the first one shows the dialog.\n */\nexport function ToastDetailsHost({ regionRef }: { regionRef?: RegionRef }) {\n\tconst id = useId();\n\tconst { details, hosts } = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n\n\tuseEffect(() => registerHost(id), [id]);\n\n\tif (!details || hosts[0] !== id) return null;\n\treturn <ToastDetailsDialog details={details} regionRef={regionRef} onClosed={closeDetails} />;\n}\n\n/**\n * Without a host, in a React root of its own on `document.body`: for an app that mounts Sonner's `Toaster` directly\n * instead of ours. It works the same, but a root of its own does not inherit the app's providers, and when the toast\n * is gone focus can only fall back to the region of Sonner's default label.\n */\nfunction openInOwnRoot(details: ToastDetails) {\n\t// One at a time: a second click before the first dialog has painted its backdrop must not stack another.\n\tif (document.querySelector(`[data-slot=\"${ROOT_SLOT}\"]`)) return;\n\n\tconst container = document.createElement('div');\n\tcontainer.setAttribute('data-slot', ROOT_SLOT);\n\tdocument.body.appendChild(container);\n\tconst root = createRoot(container);\n\n\t// After the exit animation, and never while React is rendering the dialog that asked for it.\n\tlet disposed = false;\n\tconst dispose = () => {\n\t\tif (disposed) return;\n\t\tdisposed = true;\n\t\tsetTimeout(() => {\n\t\t\troot.unmount();\n\t\t\tcontainer.remove();\n\t\t});\n\t};\n\n\troot.render(<ToastDetailsDialog details={details} onClosed={dispose} />);\n}\n\n/**\n * Opens the full text of a toast in a dialog.\n *\n * The toaster shows it when one of ours is mounted, and `trigger` (default: the focused element) gets focus back on\n * close. See `ToastDetailsHost` for why the toast itself must not render the dialog, and `openInOwnRoot` for the\n * fallback when no toaster of ours is mounted.\n */\nexport function openToastDetails(details: ToastDetails) {\n\tif (typeof document === 'undefined') return;\n\n\tconst request = { ...details, trigger: details.trigger ?? currentFocus() };\n\tconst { details: open, hosts } = getSnapshot();\n\tif (hosts.length === 0) {\n\t\topenInOwnRoot(request);\n\t\treturn;\n\t}\n\t// One at a time here too.\n\tif (!open) update({ hosts, details: request });\n}\n"],"mappings":";;;;;;;;;AA0BA,MAAM,qBAAqB;AAC3B,MAAM,YAAY;AAmBlB,MAAM,YAAY,OAAO,IAAI,4BAA4B;AACzD,MAAM,QAAkB;CAAE,SAAS;CAAM,OAAO,CAAC;AAAE;AAEnD,SAAS,WAAkB;CAC1B,MAAM,QAAQ;CACd,OAAQ,MAAM,eAAe;EAAE,UAAU;EAAO,2BAAW,IAAI,IAAI;CAAE;AACtE;AAEA,SAAS,OAAO,MAAgB;CAC/B,MAAM,QAAQ,SAAS;CACvB,MAAM,WAAW;CACjB,KAAK,MAAM,YAAY,MAAM,WAAW,SAAS;AAClD;AAEA,SAAS,UAAU,UAAsB;CACxC,MAAM,EAAE,cAAc,SAAS;CAC/B,UAAU,IAAI,QAAQ;CACtB,aAAa;EACZ,UAAU,OAAO,QAAQ;CAC1B;AACD;AAEA,MAAM,oBAAoB,SAAS,CAAC,CAAC;AACrC,MAAM,0BAA0B;AAEhC,SAAS,aAAa,IAAY;CACjC,OAAO;EAAE,GAAG,YAAY;EAAG,OAAO,CAAC,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE;CAAE,CAAC;CAChE,aAAa;EACZ,MAAM,UAAU,YAAY;EAC5B,MAAM,QAAQ,QAAQ,MAAM,QAAQ,SAAS,SAAS,EAAE;EAExD,OAAO;GAAE,SAAS,MAAM,SAAS,IAAI,QAAQ,UAAU;GAAM;EAAM,CAAC;CACrE;AACD;AAEA,MAAM,qBAAqB,OAAO;CAAE,GAAG,YAAY;CAAG,SAAS;AAAK,CAAC;AAErE,SAAS,eAAe;CACvB,MAAM,SAAS,SAAS;CACxB,OAAO,kBAAkB,eAAe,WAAW,SAAS,OAAO,SAAS;AAC7E;;AAGA,SAAS,oBAAoB;CAC5B,OAAO,SAAS,cAA2B,8DAA0D;AACtG;AAMA,SAAS,mBAAmB,EAC3B,SACA,WACA,YAKE;CACF,MAAM,EAAE,OAAO,aAAa,YAAY;CACxC,MAAM,CAAC,MAAM,WAAW,SAAS,IAAI;CACrC,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAC1C,MAAM,gBAAgB,OAAkD,MAAS;CACjF,MAAM,UAAU,OAAO,IAAI;CAE3B,gBAAgB;EACf,QAAQ,UAAU;EAClB,aAAa;GACZ,QAAQ,UAAU;GAClB,aAAa,cAAc,OAAO;EACnC;CACD,GAAG,CAAC,CAAC;CAEL,MAAM,aAAa,YAAY;EAC9B,IAAI;GACH,MAAM,UAAU,UAAU,UAAU,WAAW;EAChD,QAAQ;GAEP;EACD;EACA,IAAI,CAAC,QAAQ,SAAS;EACtB,UAAU,IAAI;EAEd,aAAa,cAAc,OAAO;EAClC,cAAc,UAAU,iBAAiB,UAAU,KAAK,GAAG,kBAAkB;CAC9E;CAKA,MAAM,mBAAoB,SAAS,cAAc,UAAW,WAAW,WAAW,kBAAkB,KAAK;CAEzG,OACC,oBAAC,QAAD;EAAc;EAAM,cAAc;EAAS,uBAAuB,WAAW,CAAC,UAAU,SAAS;YAChG,qBAAC,aAAD;GAAa,WAAU;GAAwB;aAA/C;IACC,oBAAC,cAAD,YACC,oBAAC,aAAD,YAAc,MAAmB,GACpB;IACd,oBAAC,aAAD,YACC,oBAAC,OAAD;KAAK,WAAU;eACb;IACG,GACO;IACb,qBAAC,cAAD,aACC,qBAAC,QAAD;KAAQ,SAAQ;KAAU,MAAK;KAAK,SAAS;eAA7C,CACE,SAAS,oBAAC,WAAD;MAAW,MAAM;MAAI,eAAY;KAAQ,KAAI,oBAAC,UAAD;MAAU,MAAM;MAAI,eAAY;KAAQ,IAC9F,SAAS,WAAW,MACd;QACR,oBAAC,aAAD;KAAa;eACZ,oBAAC,QAAD;MAAQ,MAAK;gBAAK;KAAa;IACnB,EACA;GACF;;CACN;AAEV;;;;;;;;;;;;;AAkBA,SAAgB,iBAAiB,EAAE,aAAwC;CAC1E,MAAM,KAAK,MAAM;CACjB,MAAM,EAAE,SAAS,UAAU,qBAAqB,WAAW,aAAa,iBAAiB;CAEzF,gBAAgB,aAAa,EAAE,GAAG,CAAC,EAAE,CAAC;CAEtC,IAAI,CAAC,WAAW,MAAM,OAAO,IAAI,OAAO;CACxC,OAAO,oBAAC,oBAAD;EAA6B;EAAoB;EAAW,UAAU;CAAe;AAC7F;;;;;;AAOA,SAAS,cAAc,SAAuB;CAE7C,IAAI,SAAS,cAAc,eAAe,UAAU,GAAG,GAAG;CAE1D,MAAM,YAAY,SAAS,cAAc,KAAK;CAC9C,UAAU,aAAa,aAAa,SAAS;CAC7C,SAAS,KAAK,YAAY,SAAS;CACnC,MAAM,OAAO,WAAW,SAAS;CAGjC,IAAI,WAAW;CACf,MAAM,gBAAgB;EACrB,IAAI,UAAU;EACd,WAAW;EACX,iBAAiB;GAChB,KAAK,QAAQ;GACb,UAAU,OAAO;EAClB,CAAC;CACF;CAEA,KAAK,OAAO,oBAAC,oBAAD;EAA6B;EAAS,UAAU;CAAU,EAAC;AACxE;;;;;;;;AASA,SAAgB,iBAAiB,SAAuB;CACvD,IAAI,OAAO,aAAa,aAAa;CAErC,MAAM,UAAU;EAAE,GAAG;EAAS,SAAS,QAAQ,WAAW,aAAa;CAAE;CACzE,MAAM,EAAE,SAAS,MAAM,UAAU,YAAY;CAC7C,IAAI,MAAM,WAAW,GAAG;EACvB,cAAc,OAAO;EACrB;CACD;CAEA,IAAI,CAAC,MAAM,OAAO;EAAE;EAAO,SAAS;CAAQ,CAAC;AAC9C"}
|
|
@@ -23,7 +23,7 @@ type TooltipContentProps = React$1.ComponentProps<typeof Tooltip.Popup> & {
|
|
|
23
23
|
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
24
24
|
align?: 'start' | 'center' | 'end';
|
|
25
25
|
};
|
|
26
|
-
declare function TooltipContent({ className, sideOffset, showArrow, side, align, children, ...props }: TooltipContentProps): React$1.JSX.Element;
|
|
26
|
+
declare function TooltipContent({ className, sideOffset, showArrow, side, align, children, ...props }: TooltipContentProps): React$1.JSX.Element | null;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { TooltipTrigger as i, TooltipContent as n, TooltipProvider as r, Tooltip$1 as t };
|
|
29
|
-
//# sourceMappingURL=tooltip-
|
|
29
|
+
//# sourceMappingURL=tooltip-Fqb4JK-g.d.cts.map
|
|
@@ -23,7 +23,7 @@ type TooltipContentProps = React$1.ComponentProps<typeof Tooltip.Popup> & {
|
|
|
23
23
|
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
24
24
|
align?: 'start' | 'center' | 'end';
|
|
25
25
|
};
|
|
26
|
-
declare function TooltipContent({ className, sideOffset, showArrow, side, align, children, ...props }: TooltipContentProps): React$1.JSX.Element;
|
|
26
|
+
declare function TooltipContent({ className, sideOffset, showArrow, side, align, children, ...props }: TooltipContentProps): React$1.JSX.Element | null;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { TooltipTrigger as i, TooltipContent as n, TooltipProvider as r, Tooltip$1 as t };
|
|
29
|
-
//# sourceMappingURL=tooltip-
|
|
29
|
+
//# sourceMappingURL=tooltip-Fqb4JK-g.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/motion/tuning.ts
|
|
5
|
+
const DEFAULT_SPRING_TIERS = {
|
|
6
|
+
/** Hover, focus rings, fades, tooltips, selection indicators. */
|
|
7
|
+
fast: {
|
|
8
|
+
duration: .08,
|
|
9
|
+
bounce: 0,
|
|
10
|
+
exitDuration: .06
|
|
11
|
+
},
|
|
12
|
+
/** Short travel and panels that must land exactly: dropdowns, tabs, drawers. */
|
|
13
|
+
moderate: {
|
|
14
|
+
duration: .16,
|
|
15
|
+
bounce: 0,
|
|
16
|
+
exitDuration: .12
|
|
17
|
+
},
|
|
18
|
+
/** Large surfaces: dialogs, side panels, stepped flows. */
|
|
19
|
+
slow: {
|
|
20
|
+
duration: .24,
|
|
21
|
+
bounce: .12,
|
|
22
|
+
exitDuration: .16
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
let tiers = { ...DEFAULT_SPRING_TIERS };
|
|
26
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
27
|
+
function emit() {
|
|
28
|
+
for (const listener of listeners) listener();
|
|
29
|
+
}
|
|
30
|
+
function getSpringTiers() {
|
|
31
|
+
return tiers;
|
|
32
|
+
}
|
|
33
|
+
function setSpringTiers(next) {
|
|
34
|
+
tiers = { ...next };
|
|
35
|
+
emit();
|
|
36
|
+
}
|
|
37
|
+
function subscribeSpringTiers(listener) {
|
|
38
|
+
listeners.add(listener);
|
|
39
|
+
return () => listeners.delete(listener);
|
|
40
|
+
}
|
|
41
|
+
/** Reactive read for components and stories that should re-render on dial changes. */
|
|
42
|
+
function useSpringTiers() {
|
|
43
|
+
return useSyncExternalStore(subscribeSpringTiers, getSpringTiers, getSpringTiers);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { useSpringTiers as i, getSpringTiers as n, setSpringTiers as r, DEFAULT_SPRING_TIERS as t };
|
|
48
|
+
//# sourceMappingURL=tuning-BKVFsxLr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tuning-BKVFsxLr.js","names":[],"sources":["../src/lib/motion/tuning.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\n/**\n * Live-tunable motion tiers.\n *\n * `springTiers` holds the shared enter/exit timing for the library's motion\n * system (duration-based springs + quicker tween exits). The DialKit panel in\n * Storybook mutates this store so every consumer that reads through\n * `useSpringTiers` / `getSpringTiers` updates live while tuning.\n */\nexport interface SpringTier {\n\t/** Enter transition duration in seconds. */\n\tduration: number;\n\t/** Spring bounce (0 = critically damped). */\n\tbounce: number;\n\t/** Exit tween duration in seconds — always quicker than the enter tier. */\n\texitDuration: number;\n}\n\nexport interface SpringTiers {\n\tfast: SpringTier;\n\tmoderate: SpringTier;\n\tslow: SpringTier;\n}\n\nexport const DEFAULT_SPRING_TIERS: SpringTiers = {\n\t/** Hover, focus rings, fades, tooltips, selection indicators. */\n\tfast: { duration: 0.08, bounce: 0, exitDuration: 0.06 },\n\t/** Short travel and panels that must land exactly: dropdowns, tabs, drawers. */\n\tmoderate: { duration: 0.16, bounce: 0, exitDuration: 0.12 },\n\t/** Large surfaces: dialogs, side panels, stepped flows. */\n\tslow: { duration: 0.24, bounce: 0.12, exitDuration: 0.16 },\n};\n\nlet tiers: SpringTiers = { ...DEFAULT_SPRING_TIERS };\nconst listeners = new Set<() => void>();\n\nfunction emit() {\n\tfor (const listener of listeners) listener();\n}\n\nexport function getSpringTiers(): SpringTiers {\n\treturn tiers;\n}\n\nexport function setSpringTiers(next: SpringTiers) {\n\ttiers = { ...next };\n\temit();\n}\n\nexport function resetSpringTiers() {\n\ttiers = { ...DEFAULT_SPRING_TIERS };\n\temit();\n}\n\nexport function subscribeSpringTiers(listener: () => void): () => void {\n\tlisteners.add(listener);\n\treturn () => listeners.delete(listener);\n}\n\n/** Reactive read for components and stories that should re-render on dial changes. */\nexport function useSpringTiers(): SpringTiers {\n\treturn useSyncExternalStore(subscribeSpringTiers, getSpringTiers, getSpringTiers);\n}\n"],"mappings":";;;;AAyBA,MAAa,uBAAoC;;CAEhD,MAAM;EAAE,UAAU;EAAM,QAAQ;EAAG,cAAc;CAAK;;CAEtD,UAAU;EAAE,UAAU;EAAM,QAAQ;EAAG,cAAc;CAAK;;CAE1D,MAAM;EAAE,UAAU;EAAM,QAAQ;EAAM,cAAc;CAAK;AAC1D;AAEA,IAAI,QAAqB,EAAE,GAAG,qBAAqB;AACnD,MAAM,4BAAY,IAAI,IAAgB;AAEtC,SAAS,OAAO;CACf,KAAK,MAAM,YAAY,WAAW,SAAS;AAC5C;AAEA,SAAgB,iBAA8B;CAC7C,OAAO;AACR;AAEA,SAAgB,eAAe,MAAmB;CACjD,QAAQ,EAAE,GAAG,KAAK;CAClB,KAAK;AACN;AAOA,SAAgB,qBAAqB,UAAkC;CACtE,UAAU,IAAI,QAAQ;CACtB,aAAa,UAAU,OAAO,QAAQ;AACvC;;AAGA,SAAgB,iBAA8B;CAC7C,OAAO,qBAAqB,sBAAsB,gBAAgB,cAAc;AACjF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
let react = require("react");
|
|
3
|
+
|
|
4
|
+
//#region src/lib/motion/tuning.ts
|
|
5
|
+
const DEFAULT_SPRING_TIERS = {
|
|
6
|
+
/** Hover, focus rings, fades, tooltips, selection indicators. */
|
|
7
|
+
fast: {
|
|
8
|
+
duration: .08,
|
|
9
|
+
bounce: 0,
|
|
10
|
+
exitDuration: .06
|
|
11
|
+
},
|
|
12
|
+
/** Short travel and panels that must land exactly: dropdowns, tabs, drawers. */
|
|
13
|
+
moderate: {
|
|
14
|
+
duration: .16,
|
|
15
|
+
bounce: 0,
|
|
16
|
+
exitDuration: .12
|
|
17
|
+
},
|
|
18
|
+
/** Large surfaces: dialogs, side panels, stepped flows. */
|
|
19
|
+
slow: {
|
|
20
|
+
duration: .24,
|
|
21
|
+
bounce: .12,
|
|
22
|
+
exitDuration: .16
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
let tiers = { ...DEFAULT_SPRING_TIERS };
|
|
26
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
27
|
+
function emit() {
|
|
28
|
+
for (const listener of listeners) listener();
|
|
29
|
+
}
|
|
30
|
+
function getSpringTiers() {
|
|
31
|
+
return tiers;
|
|
32
|
+
}
|
|
33
|
+
function setSpringTiers(next) {
|
|
34
|
+
tiers = { ...next };
|
|
35
|
+
emit();
|
|
36
|
+
}
|
|
37
|
+
function subscribeSpringTiers(listener) {
|
|
38
|
+
listeners.add(listener);
|
|
39
|
+
return () => listeners.delete(listener);
|
|
40
|
+
}
|
|
41
|
+
/** Reactive read for components and stories that should re-render on dial changes. */
|
|
42
|
+
function useSpringTiers() {
|
|
43
|
+
return (0, react.useSyncExternalStore)(subscribeSpringTiers, getSpringTiers, getSpringTiers);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
Object.defineProperty(exports, 'DEFAULT_SPRING_TIERS', {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () {
|
|
50
|
+
return DEFAULT_SPRING_TIERS;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, 'getSpringTiers', {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () {
|
|
56
|
+
return getSpringTiers;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, 'setSpringTiers', {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function () {
|
|
62
|
+
return setSpringTiers;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(exports, 'useSpringTiers', {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return useSpringTiers;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=tuning-BRPG7U1U.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tuning-BRPG7U1U.cjs","names":[],"sources":["../src/lib/motion/tuning.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\n/**\n * Live-tunable motion tiers.\n *\n * `springTiers` holds the shared enter/exit timing for the library's motion\n * system (duration-based springs + quicker tween exits). The DialKit panel in\n * Storybook mutates this store so every consumer that reads through\n * `useSpringTiers` / `getSpringTiers` updates live while tuning.\n */\nexport interface SpringTier {\n\t/** Enter transition duration in seconds. */\n\tduration: number;\n\t/** Spring bounce (0 = critically damped). */\n\tbounce: number;\n\t/** Exit tween duration in seconds — always quicker than the enter tier. */\n\texitDuration: number;\n}\n\nexport interface SpringTiers {\n\tfast: SpringTier;\n\tmoderate: SpringTier;\n\tslow: SpringTier;\n}\n\nexport const DEFAULT_SPRING_TIERS: SpringTiers = {\n\t/** Hover, focus rings, fades, tooltips, selection indicators. */\n\tfast: { duration: 0.08, bounce: 0, exitDuration: 0.06 },\n\t/** Short travel and panels that must land exactly: dropdowns, tabs, drawers. */\n\tmoderate: { duration: 0.16, bounce: 0, exitDuration: 0.12 },\n\t/** Large surfaces: dialogs, side panels, stepped flows. */\n\tslow: { duration: 0.24, bounce: 0.12, exitDuration: 0.16 },\n};\n\nlet tiers: SpringTiers = { ...DEFAULT_SPRING_TIERS };\nconst listeners = new Set<() => void>();\n\nfunction emit() {\n\tfor (const listener of listeners) listener();\n}\n\nexport function getSpringTiers(): SpringTiers {\n\treturn tiers;\n}\n\nexport function setSpringTiers(next: SpringTiers) {\n\ttiers = { ...next };\n\temit();\n}\n\nexport function resetSpringTiers() {\n\ttiers = { ...DEFAULT_SPRING_TIERS };\n\temit();\n}\n\nexport function subscribeSpringTiers(listener: () => void): () => void {\n\tlisteners.add(listener);\n\treturn () => listeners.delete(listener);\n}\n\n/** Reactive read for components and stories that should re-render on dial changes. */\nexport function useSpringTiers(): SpringTiers {\n\treturn useSyncExternalStore(subscribeSpringTiers, getSpringTiers, getSpringTiers);\n}\n"],"mappings":";;;;AAyBA,MAAa,uBAAoC;;CAEhD,MAAM;EAAE,UAAU;EAAM,QAAQ;EAAG,cAAc;CAAK;;CAEtD,UAAU;EAAE,UAAU;EAAM,QAAQ;EAAG,cAAc;CAAK;;CAE1D,MAAM;EAAE,UAAU;EAAM,QAAQ;EAAM,cAAc;CAAK;AAC1D;AAEA,IAAI,QAAqB,EAAE,GAAG,qBAAqB;AACnD,MAAM,4BAAY,IAAI,IAAgB;AAEtC,SAAS,OAAO;CACf,KAAK,MAAM,YAAY,WAAW,SAAS;AAC5C;AAEA,SAAgB,iBAA8B;CAC7C,OAAO;AACR;AAEA,SAAgB,eAAe,MAAmB;CACjD,QAAQ,EAAE,GAAG,KAAK;CAClB,KAAK;AACN;AAOA,SAAgB,qBAAqB,UAAkC;CACtE,UAAU,IAAI,QAAQ;CACtB,aAAa,UAAU,OAAO,QAAQ;AACvC;;AAGA,SAAgB,iBAA8B;CAC7C,uCAA4B,sBAAsB,gBAAgB,cAAc;AACjF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
let react = require("react");
|
|
3
|
+
|
|
4
|
+
//#region src/lib/use-document-theme.ts
|
|
5
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
6
|
+
let observer;
|
|
7
|
+
/** One observer on `<html>` serves every subscriber; it connects with the first and disconnects with the last. */
|
|
8
|
+
function subscribe(listener) {
|
|
9
|
+
listeners.add(listener);
|
|
10
|
+
if (!observer) {
|
|
11
|
+
observer = new MutationObserver(() => listeners.forEach((notify) => notify()));
|
|
12
|
+
observer.observe(document.documentElement, {
|
|
13
|
+
attributes: true,
|
|
14
|
+
attributeFilter: ["class"]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return () => {
|
|
18
|
+
listeners.delete(listener);
|
|
19
|
+
if (listeners.size === 0) {
|
|
20
|
+
observer?.disconnect();
|
|
21
|
+
observer = void 0;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const subscribeToNothing = () => () => {};
|
|
26
|
+
const getTheme = () => document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
27
|
+
const getServerTheme = () => "light";
|
|
28
|
+
/**
|
|
29
|
+
* The theme the page is in, following the `dark` class on `<html>`. Pass `false` when the caller has a theme of its
|
|
30
|
+
* own, so it does not subscribe to changes it would ignore.
|
|
31
|
+
*/
|
|
32
|
+
function useDocumentTheme(follow = true) {
|
|
33
|
+
return (0, react.useSyncExternalStore)(follow ? subscribe : subscribeToNothing, getTheme, getServerTheme);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
Object.defineProperty(exports, 'useDocumentTheme', {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return useDocumentTheme;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=use-document-theme-BSEuNsEE.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-document-theme-BSEuNsEE.cjs","names":[],"sources":["../src/lib/use-document-theme.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nexport type DocumentTheme = 'light' | 'dark';\n\nconst listeners = new Set<() => void>();\nlet observer: MutationObserver | undefined;\n\n/** One observer on `<html>` serves every subscriber; it connects with the first and disconnects with the last. */\nfunction subscribe(listener: () => void) {\n\tlisteners.add(listener);\n\tif (!observer) {\n\t\tobserver = new MutationObserver(() => listeners.forEach((notify) => notify()));\n\t\tobserver.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });\n\t}\n\treturn () => {\n\t\tlisteners.delete(listener);\n\t\tif (listeners.size === 0) {\n\t\t\tobserver?.disconnect();\n\t\t\tobserver = undefined;\n\t\t}\n\t};\n}\n\nconst subscribeToNothing = () => () => {};\n\nconst getTheme = (): DocumentTheme => (document.documentElement.classList.contains('dark') ? 'dark' : 'light');\n\nconst getServerTheme = (): DocumentTheme => 'light';\n\n/**\n * The theme the page is in, following the `dark` class on `<html>`. Pass `false` when the caller has a theme of its\n * own, so it does not subscribe to changes it would ignore.\n */\nexport function useDocumentTheme(follow = true): DocumentTheme {\n\treturn useSyncExternalStore(follow ? subscribe : subscribeToNothing, getTheme, getServerTheme);\n}\n"],"mappings":";;;;AAIA,MAAM,4BAAY,IAAI,IAAgB;AACtC,IAAI;;AAGJ,SAAS,UAAU,UAAsB;CACxC,UAAU,IAAI,QAAQ;CACtB,IAAI,CAAC,UAAU;EACd,WAAW,IAAI,uBAAuB,UAAU,SAAS,WAAW,OAAO,CAAC,CAAC;EAC7E,SAAS,QAAQ,SAAS,iBAAiB;GAAE,YAAY;GAAM,iBAAiB,CAAC,OAAO;EAAE,CAAC;CAC5F;CACA,aAAa;EACZ,UAAU,OAAO,QAAQ;EACzB,IAAI,UAAU,SAAS,GAAG;GACzB,UAAU,WAAW;GACrB,WAAW;EACZ;CACD;AACD;AAEA,MAAM,iCAAiC,CAAC;AAExC,MAAM,iBAAiC,SAAS,gBAAgB,UAAU,SAAS,MAAM,IAAI,SAAS;AAEtG,MAAM,uBAAsC;;;;;AAM5C,SAAgB,iBAAiB,SAAS,MAAqB;CAC9D,uCAA4B,SAAS,YAAY,oBAAoB,UAAU,cAAc;AAC9F"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/use-document-theme.ts
|
|
5
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
6
|
+
let observer;
|
|
7
|
+
/** One observer on `<html>` serves every subscriber; it connects with the first and disconnects with the last. */
|
|
8
|
+
function subscribe(listener) {
|
|
9
|
+
listeners.add(listener);
|
|
10
|
+
if (!observer) {
|
|
11
|
+
observer = new MutationObserver(() => listeners.forEach((notify) => notify()));
|
|
12
|
+
observer.observe(document.documentElement, {
|
|
13
|
+
attributes: true,
|
|
14
|
+
attributeFilter: ["class"]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return () => {
|
|
18
|
+
listeners.delete(listener);
|
|
19
|
+
if (listeners.size === 0) {
|
|
20
|
+
observer?.disconnect();
|
|
21
|
+
observer = void 0;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const subscribeToNothing = () => () => {};
|
|
26
|
+
const getTheme = () => document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
27
|
+
const getServerTheme = () => "light";
|
|
28
|
+
/**
|
|
29
|
+
* The theme the page is in, following the `dark` class on `<html>`. Pass `false` when the caller has a theme of its
|
|
30
|
+
* own, so it does not subscribe to changes it would ignore.
|
|
31
|
+
*/
|
|
32
|
+
function useDocumentTheme(follow = true) {
|
|
33
|
+
return useSyncExternalStore(follow ? subscribe : subscribeToNothing, getTheme, getServerTheme);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { useDocumentTheme as t };
|
|
38
|
+
//# sourceMappingURL=use-document-theme-Ch_PqxZz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-document-theme-Ch_PqxZz.js","names":[],"sources":["../src/lib/use-document-theme.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nexport type DocumentTheme = 'light' | 'dark';\n\nconst listeners = new Set<() => void>();\nlet observer: MutationObserver | undefined;\n\n/** One observer on `<html>` serves every subscriber; it connects with the first and disconnects with the last. */\nfunction subscribe(listener: () => void) {\n\tlisteners.add(listener);\n\tif (!observer) {\n\t\tobserver = new MutationObserver(() => listeners.forEach((notify) => notify()));\n\t\tobserver.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });\n\t}\n\treturn () => {\n\t\tlisteners.delete(listener);\n\t\tif (listeners.size === 0) {\n\t\t\tobserver?.disconnect();\n\t\t\tobserver = undefined;\n\t\t}\n\t};\n}\n\nconst subscribeToNothing = () => () => {};\n\nconst getTheme = (): DocumentTheme => (document.documentElement.classList.contains('dark') ? 'dark' : 'light');\n\nconst getServerTheme = (): DocumentTheme => 'light';\n\n/**\n * The theme the page is in, following the `dark` class on `<html>`. Pass `false` when the caller has a theme of its\n * own, so it does not subscribe to changes it would ignore.\n */\nexport function useDocumentTheme(follow = true): DocumentTheme {\n\treturn useSyncExternalStore(follow ? subscribe : subscribeToNothing, getTheme, getServerTheme);\n}\n"],"mappings":";;;;AAIA,MAAM,4BAAY,IAAI,IAAgB;AACtC,IAAI;;AAGJ,SAAS,UAAU,UAAsB;CACxC,UAAU,IAAI,QAAQ;CACtB,IAAI,CAAC,UAAU;EACd,WAAW,IAAI,uBAAuB,UAAU,SAAS,WAAW,OAAO,CAAC,CAAC;EAC7E,SAAS,QAAQ,SAAS,iBAAiB;GAAE,YAAY;GAAM,iBAAiB,CAAC,OAAO;EAAE,CAAC;CAC5F;CACA,aAAa;EACZ,UAAU,OAAO,QAAQ;EACzB,IAAI,UAAU,SAAS,GAAG;GACzB,UAAU,WAAW;GACrB,WAAW;EACZ;CACD;AACD;AAEA,MAAM,iCAAiC,CAAC;AAExC,MAAM,iBAAiC,SAAS,gBAAgB,UAAU,SAAS,MAAM,IAAI,SAAS;AAEtG,MAAM,uBAAsC;;;;;AAM5C,SAAgB,iBAAiB,SAAS,MAAqB;CAC9D,OAAO,qBAAqB,SAAS,YAAY,oBAAoB,UAAU,cAAc;AAC9F"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
const require_rolldown_runtime = require('./rolldown-runtime-D_qnwXdH.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
react = require_rolldown_runtime.__toESM(react, 1);
|
|
5
|
+
|
|
6
|
+
//#region src/lib/use-scroll-fade.ts
|
|
7
|
+
const FADE = "1.5rem";
|
|
8
|
+
const NONE = {
|
|
9
|
+
left: false,
|
|
10
|
+
right: false
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Tracks a sideways scroller and fades each edge that still has content past it, so a row cut off at the edge reads
|
|
14
|
+
* as scrollable instead of ending in a hard cut. The sides are physical, so the mask is right in both directions.
|
|
15
|
+
*/
|
|
16
|
+
function useScrollFade() {
|
|
17
|
+
const [node, ref] = react.useState(null);
|
|
18
|
+
const [hidden, setHidden] = react.useState(NONE);
|
|
19
|
+
react.useEffect(() => {
|
|
20
|
+
if (!node) return;
|
|
21
|
+
const measure = () => {
|
|
22
|
+
const rtl = getComputedStyle(node).direction === "rtl";
|
|
23
|
+
const room = node.scrollWidth - node.clientWidth;
|
|
24
|
+
const offset = Math.abs(node.scrollLeft);
|
|
25
|
+
const before = room > 1 && offset > 1;
|
|
26
|
+
const after = room > 1 && room - offset > 1;
|
|
27
|
+
const next = {
|
|
28
|
+
left: rtl ? after : before,
|
|
29
|
+
right: rtl ? before : after
|
|
30
|
+
};
|
|
31
|
+
setHidden((current) => current.left === next.left && current.right === next.right ? current : next);
|
|
32
|
+
};
|
|
33
|
+
measure();
|
|
34
|
+
node.addEventListener("scroll", measure, { passive: true });
|
|
35
|
+
const resize = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
|
|
36
|
+
resize?.observe(node);
|
|
37
|
+
for (const child of Array.from(node.children)) resize?.observe(child);
|
|
38
|
+
const mutation = typeof MutationObserver === "undefined" ? null : new MutationObserver((records) => {
|
|
39
|
+
for (const record of records) {
|
|
40
|
+
for (const removed of Array.from(record.removedNodes)) if (removed instanceof Element) resize?.unobserve(removed);
|
|
41
|
+
for (const added of Array.from(record.addedNodes)) if (added instanceof Element) resize?.observe(added);
|
|
42
|
+
}
|
|
43
|
+
measure();
|
|
44
|
+
});
|
|
45
|
+
mutation?.observe(node, { childList: true });
|
|
46
|
+
return () => {
|
|
47
|
+
node.removeEventListener("scroll", measure);
|
|
48
|
+
resize?.disconnect();
|
|
49
|
+
mutation?.disconnect();
|
|
50
|
+
};
|
|
51
|
+
}, [node]);
|
|
52
|
+
const overflowing = hidden.left || hidden.right;
|
|
53
|
+
return {
|
|
54
|
+
ref,
|
|
55
|
+
node,
|
|
56
|
+
overflowing,
|
|
57
|
+
style: react.useMemo(() => {
|
|
58
|
+
if (!overflowing) return void 0;
|
|
59
|
+
const mask = `linear-gradient(to right, transparent, black ${hidden.left ? FADE : "0px"}, black calc(100% - ${hidden.right ? FADE : "0px"}), transparent)`;
|
|
60
|
+
return {
|
|
61
|
+
maskImage: mask,
|
|
62
|
+
WebkitMaskImage: mask
|
|
63
|
+
};
|
|
64
|
+
}, [
|
|
65
|
+
overflowing,
|
|
66
|
+
hidden.left,
|
|
67
|
+
hidden.right
|
|
68
|
+
])
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
Object.defineProperty(exports, 'useScrollFade', {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return useScrollFade;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=use-scroll-fade-CaHp52u4.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-scroll-fade-CaHp52u4.cjs","names":["React"],"sources":["../src/lib/use-scroll-fade.ts"],"sourcesContent":["import * as React from 'react';\n\nconst FADE = '1.5rem';\n\n/** Physical sides of a sideways scroller that still have content past them. */\ntype HiddenSides = { left: boolean; right: boolean };\n\nconst NONE: HiddenSides = { left: false, right: false };\n\nexport interface ScrollFade<T extends HTMLElement> {\n\t/** A callback ref, so the fade follows the scroller even when it mounts after the component does. */\n\tref: (node: T | null) => void;\n\t/** The scroller, once mounted. */\n\tnode: T | null;\n\t/** Whether the content is wider than the scroller. */\n\toverflowing: boolean;\n\t/** A mask that fades each edge with content past it; undefined while everything fits. */\n\tstyle: React.CSSProperties | undefined;\n}\n\n/**\n * Tracks a sideways scroller and fades each edge that still has content past it, so a row cut off at the edge reads\n * as scrollable instead of ending in a hard cut. The sides are physical, so the mask is right in both directions.\n */\nexport function useScrollFade<T extends HTMLElement>(): ScrollFade<T> {\n\tconst [node, ref] = React.useState<T | null>(null);\n\tconst [hidden, setHidden] = React.useState<HiddenSides>(NONE);\n\n\tReact.useEffect(() => {\n\t\tif (!node) return;\n\t\tconst measure = () => {\n\t\t\tconst rtl = getComputedStyle(node).direction === 'rtl';\n\t\t\tconst room = node.scrollWidth - node.clientWidth;\n\t\t\tconst offset = Math.abs(node.scrollLeft);\n\t\t\tconst before = room > 1 && offset > 1;\n\t\t\tconst after = room > 1 && room - offset > 1;\n\t\t\tconst next = { left: rtl ? after : before, right: rtl ? before : after };\n\t\t\tsetHidden((current) => (current.left === next.left && current.right === next.right ? current : next));\n\t\t};\n\t\tmeasure();\n\t\tnode.addEventListener('scroll', measure, { passive: true });\n\t\tconst resize = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);\n\t\tresize?.observe(node);\n\t\tfor (const child of Array.from(node.children)) resize?.observe(child);\n\t\t// A size observer reports only the elements it was given, and a row that grows because a child was added\n\t\t// resizes nothing it watches, so children coming and going are watched too.\n\t\tconst mutation =\n\t\t\ttypeof MutationObserver === 'undefined'\n\t\t\t\t? null\n\t\t\t\t: new MutationObserver((records) => {\n\t\t\t\t\t\tfor (const record of records) {\n\t\t\t\t\t\t\tfor (const removed of Array.from(record.removedNodes)) if (removed instanceof Element) resize?.unobserve(removed);\n\t\t\t\t\t\t\tfor (const added of Array.from(record.addedNodes)) if (added instanceof Element) resize?.observe(added);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmeasure();\n\t\t\t\t\t});\n\t\tmutation?.observe(node, { childList: true });\n\t\treturn () => {\n\t\t\tnode.removeEventListener('scroll', measure);\n\t\t\tresize?.disconnect();\n\t\t\tmutation?.disconnect();\n\t\t};\n\t}, [node]);\n\n\tconst overflowing = hidden.left || hidden.right;\n\tconst style = React.useMemo(() => {\n\t\tif (!overflowing) return undefined;\n\t\tconst mask = `linear-gradient(to right, transparent, black ${hidden.left ? FADE : '0px'}, black calc(100% - ${hidden.right ? FADE : '0px'}), transparent)`;\n\t\treturn { maskImage: mask, WebkitMaskImage: mask };\n\t}, [overflowing, hidden.left, hidden.right]);\n\n\treturn { ref, node, overflowing, style };\n}\n"],"mappings":";;;;;;AAEA,MAAM,OAAO;AAKb,MAAM,OAAoB;CAAE,MAAM;CAAO,OAAO;AAAM;;;;;AAiBtD,SAAgB,gBAAsD;CACrE,MAAM,CAAC,MAAM,OAAOA,MAAM,SAAmB,IAAI;CACjD,MAAM,CAAC,QAAQ,aAAaA,MAAM,SAAsB,IAAI;CAE5D,MAAM,gBAAgB;EACrB,IAAI,CAAC,MAAM;EACX,MAAM,gBAAgB;GACrB,MAAM,MAAM,iBAAiB,IAAI,CAAC,CAAC,cAAc;GACjD,MAAM,OAAO,KAAK,cAAc,KAAK;GACrC,MAAM,SAAS,KAAK,IAAI,KAAK,UAAU;GACvC,MAAM,SAAS,OAAO,KAAK,SAAS;GACpC,MAAM,QAAQ,OAAO,KAAK,OAAO,SAAS;GAC1C,MAAM,OAAO;IAAE,MAAM,MAAM,QAAQ;IAAQ,OAAO,MAAM,SAAS;GAAM;GACvE,WAAW,YAAa,QAAQ,SAAS,KAAK,QAAQ,QAAQ,UAAU,KAAK,QAAQ,UAAU,IAAK;EACrG;EACA,QAAQ;EACR,KAAK,iBAAiB,UAAU,SAAS,EAAE,SAAS,KAAK,CAAC;EAC1D,MAAM,SAAS,OAAO,mBAAmB,cAAc,OAAO,IAAI,eAAe,OAAO;EACxF,QAAQ,QAAQ,IAAI;EACpB,KAAK,MAAM,SAAS,MAAM,KAAK,KAAK,QAAQ,GAAG,QAAQ,QAAQ,KAAK;EAGpE,MAAM,WACL,OAAO,qBAAqB,cACzB,OACA,IAAI,kBAAkB,YAAY;GAClC,KAAK,MAAM,UAAU,SAAS;IAC7B,KAAK,MAAM,WAAW,MAAM,KAAK,OAAO,YAAY,GAAG,IAAI,mBAAmB,SAAS,QAAQ,UAAU,OAAO;IAChH,KAAK,MAAM,SAAS,MAAM,KAAK,OAAO,UAAU,GAAG,IAAI,iBAAiB,SAAS,QAAQ,QAAQ,KAAK;GACvG;GACA,QAAQ;EACT,CAAC;EACJ,UAAU,QAAQ,MAAM,EAAE,WAAW,KAAK,CAAC;EAC3C,aAAa;GACZ,KAAK,oBAAoB,UAAU,OAAO;GAC1C,QAAQ,WAAW;GACnB,UAAU,WAAW;EACtB;CACD,GAAG,CAAC,IAAI,CAAC;CAET,MAAM,cAAc,OAAO,QAAQ,OAAO;CAO1C,OAAO;EAAE;EAAK;EAAM;EAAa,OANnBA,MAAM,cAAc;GACjC,IAAI,CAAC,aAAa,OAAO;GACzB,MAAM,OAAO,gDAAgD,OAAO,OAAO,OAAO,MAAM,sBAAsB,OAAO,QAAQ,OAAO,MAAM;GAC1I,OAAO;IAAE,WAAW;IAAM,iBAAiB;GAAK;EACjD,GAAG;GAAC;GAAa,OAAO;GAAM,OAAO;EAAK,CAEL;CAAE;AACxC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/use-scroll-fade.ts
|
|
5
|
+
const FADE = "1.5rem";
|
|
6
|
+
const NONE = {
|
|
7
|
+
left: false,
|
|
8
|
+
right: false
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Tracks a sideways scroller and fades each edge that still has content past it, so a row cut off at the edge reads
|
|
12
|
+
* as scrollable instead of ending in a hard cut. The sides are physical, so the mask is right in both directions.
|
|
13
|
+
*/
|
|
14
|
+
function useScrollFade() {
|
|
15
|
+
const [node, ref] = React$1.useState(null);
|
|
16
|
+
const [hidden, setHidden] = React$1.useState(NONE);
|
|
17
|
+
React$1.useEffect(() => {
|
|
18
|
+
if (!node) return;
|
|
19
|
+
const measure = () => {
|
|
20
|
+
const rtl = getComputedStyle(node).direction === "rtl";
|
|
21
|
+
const room = node.scrollWidth - node.clientWidth;
|
|
22
|
+
const offset = Math.abs(node.scrollLeft);
|
|
23
|
+
const before = room > 1 && offset > 1;
|
|
24
|
+
const after = room > 1 && room - offset > 1;
|
|
25
|
+
const next = {
|
|
26
|
+
left: rtl ? after : before,
|
|
27
|
+
right: rtl ? before : after
|
|
28
|
+
};
|
|
29
|
+
setHidden((current) => current.left === next.left && current.right === next.right ? current : next);
|
|
30
|
+
};
|
|
31
|
+
measure();
|
|
32
|
+
node.addEventListener("scroll", measure, { passive: true });
|
|
33
|
+
const resize = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
|
|
34
|
+
resize?.observe(node);
|
|
35
|
+
for (const child of Array.from(node.children)) resize?.observe(child);
|
|
36
|
+
const mutation = typeof MutationObserver === "undefined" ? null : new MutationObserver((records) => {
|
|
37
|
+
for (const record of records) {
|
|
38
|
+
for (const removed of Array.from(record.removedNodes)) if (removed instanceof Element) resize?.unobserve(removed);
|
|
39
|
+
for (const added of Array.from(record.addedNodes)) if (added instanceof Element) resize?.observe(added);
|
|
40
|
+
}
|
|
41
|
+
measure();
|
|
42
|
+
});
|
|
43
|
+
mutation?.observe(node, { childList: true });
|
|
44
|
+
return () => {
|
|
45
|
+
node.removeEventListener("scroll", measure);
|
|
46
|
+
resize?.disconnect();
|
|
47
|
+
mutation?.disconnect();
|
|
48
|
+
};
|
|
49
|
+
}, [node]);
|
|
50
|
+
const overflowing = hidden.left || hidden.right;
|
|
51
|
+
return {
|
|
52
|
+
ref,
|
|
53
|
+
node,
|
|
54
|
+
overflowing,
|
|
55
|
+
style: React$1.useMemo(() => {
|
|
56
|
+
if (!overflowing) return void 0;
|
|
57
|
+
const mask = `linear-gradient(to right, transparent, black ${hidden.left ? FADE : "0px"}, black calc(100% - ${hidden.right ? FADE : "0px"}), transparent)`;
|
|
58
|
+
return {
|
|
59
|
+
maskImage: mask,
|
|
60
|
+
WebkitMaskImage: mask
|
|
61
|
+
};
|
|
62
|
+
}, [
|
|
63
|
+
overflowing,
|
|
64
|
+
hidden.left,
|
|
65
|
+
hidden.right
|
|
66
|
+
])
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { useScrollFade as t };
|
|
72
|
+
//# sourceMappingURL=use-scroll-fade-ilq-o00-.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-scroll-fade-ilq-o00-.js","names":["React"],"sources":["../src/lib/use-scroll-fade.ts"],"sourcesContent":["import * as React from 'react';\n\nconst FADE = '1.5rem';\n\n/** Physical sides of a sideways scroller that still have content past them. */\ntype HiddenSides = { left: boolean; right: boolean };\n\nconst NONE: HiddenSides = { left: false, right: false };\n\nexport interface ScrollFade<T extends HTMLElement> {\n\t/** A callback ref, so the fade follows the scroller even when it mounts after the component does. */\n\tref: (node: T | null) => void;\n\t/** The scroller, once mounted. */\n\tnode: T | null;\n\t/** Whether the content is wider than the scroller. */\n\toverflowing: boolean;\n\t/** A mask that fades each edge with content past it; undefined while everything fits. */\n\tstyle: React.CSSProperties | undefined;\n}\n\n/**\n * Tracks a sideways scroller and fades each edge that still has content past it, so a row cut off at the edge reads\n * as scrollable instead of ending in a hard cut. The sides are physical, so the mask is right in both directions.\n */\nexport function useScrollFade<T extends HTMLElement>(): ScrollFade<T> {\n\tconst [node, ref] = React.useState<T | null>(null);\n\tconst [hidden, setHidden] = React.useState<HiddenSides>(NONE);\n\n\tReact.useEffect(() => {\n\t\tif (!node) return;\n\t\tconst measure = () => {\n\t\t\tconst rtl = getComputedStyle(node).direction === 'rtl';\n\t\t\tconst room = node.scrollWidth - node.clientWidth;\n\t\t\tconst offset = Math.abs(node.scrollLeft);\n\t\t\tconst before = room > 1 && offset > 1;\n\t\t\tconst after = room > 1 && room - offset > 1;\n\t\t\tconst next = { left: rtl ? after : before, right: rtl ? before : after };\n\t\t\tsetHidden((current) => (current.left === next.left && current.right === next.right ? current : next));\n\t\t};\n\t\tmeasure();\n\t\tnode.addEventListener('scroll', measure, { passive: true });\n\t\tconst resize = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);\n\t\tresize?.observe(node);\n\t\tfor (const child of Array.from(node.children)) resize?.observe(child);\n\t\t// A size observer reports only the elements it was given, and a row that grows because a child was added\n\t\t// resizes nothing it watches, so children coming and going are watched too.\n\t\tconst mutation =\n\t\t\ttypeof MutationObserver === 'undefined'\n\t\t\t\t? null\n\t\t\t\t: new MutationObserver((records) => {\n\t\t\t\t\t\tfor (const record of records) {\n\t\t\t\t\t\t\tfor (const removed of Array.from(record.removedNodes)) if (removed instanceof Element) resize?.unobserve(removed);\n\t\t\t\t\t\t\tfor (const added of Array.from(record.addedNodes)) if (added instanceof Element) resize?.observe(added);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmeasure();\n\t\t\t\t\t});\n\t\tmutation?.observe(node, { childList: true });\n\t\treturn () => {\n\t\t\tnode.removeEventListener('scroll', measure);\n\t\t\tresize?.disconnect();\n\t\t\tmutation?.disconnect();\n\t\t};\n\t}, [node]);\n\n\tconst overflowing = hidden.left || hidden.right;\n\tconst style = React.useMemo(() => {\n\t\tif (!overflowing) return undefined;\n\t\tconst mask = `linear-gradient(to right, transparent, black ${hidden.left ? FADE : '0px'}, black calc(100% - ${hidden.right ? FADE : '0px'}), transparent)`;\n\t\treturn { maskImage: mask, WebkitMaskImage: mask };\n\t}, [overflowing, hidden.left, hidden.right]);\n\n\treturn { ref, node, overflowing, style };\n}\n"],"mappings":";;;;AAEA,MAAM,OAAO;AAKb,MAAM,OAAoB;CAAE,MAAM;CAAO,OAAO;AAAM;;;;;AAiBtD,SAAgB,gBAAsD;CACrE,MAAM,CAAC,MAAM,OAAOA,QAAM,SAAmB,IAAI;CACjD,MAAM,CAAC,QAAQ,aAAaA,QAAM,SAAsB,IAAI;CAE5D,QAAM,gBAAgB;EACrB,IAAI,CAAC,MAAM;EACX,MAAM,gBAAgB;GACrB,MAAM,MAAM,iBAAiB,IAAI,CAAC,CAAC,cAAc;GACjD,MAAM,OAAO,KAAK,cAAc,KAAK;GACrC,MAAM,SAAS,KAAK,IAAI,KAAK,UAAU;GACvC,MAAM,SAAS,OAAO,KAAK,SAAS;GACpC,MAAM,QAAQ,OAAO,KAAK,OAAO,SAAS;GAC1C,MAAM,OAAO;IAAE,MAAM,MAAM,QAAQ;IAAQ,OAAO,MAAM,SAAS;GAAM;GACvE,WAAW,YAAa,QAAQ,SAAS,KAAK,QAAQ,QAAQ,UAAU,KAAK,QAAQ,UAAU,IAAK;EACrG;EACA,QAAQ;EACR,KAAK,iBAAiB,UAAU,SAAS,EAAE,SAAS,KAAK,CAAC;EAC1D,MAAM,SAAS,OAAO,mBAAmB,cAAc,OAAO,IAAI,eAAe,OAAO;EACxF,QAAQ,QAAQ,IAAI;EACpB,KAAK,MAAM,SAAS,MAAM,KAAK,KAAK,QAAQ,GAAG,QAAQ,QAAQ,KAAK;EAGpE,MAAM,WACL,OAAO,qBAAqB,cACzB,OACA,IAAI,kBAAkB,YAAY;GAClC,KAAK,MAAM,UAAU,SAAS;IAC7B,KAAK,MAAM,WAAW,MAAM,KAAK,OAAO,YAAY,GAAG,IAAI,mBAAmB,SAAS,QAAQ,UAAU,OAAO;IAChH,KAAK,MAAM,SAAS,MAAM,KAAK,OAAO,UAAU,GAAG,IAAI,iBAAiB,SAAS,QAAQ,QAAQ,KAAK;GACvG;GACA,QAAQ;EACT,CAAC;EACJ,UAAU,QAAQ,MAAM,EAAE,WAAW,KAAK,CAAC;EAC3C,aAAa;GACZ,KAAK,oBAAoB,UAAU,OAAO;GAC1C,QAAQ,WAAW;GACnB,UAAU,WAAW;EACtB;CACD,GAAG,CAAC,IAAI,CAAC;CAET,MAAM,cAAc,OAAO,QAAQ,OAAO;CAO1C,OAAO;EAAE;EAAK;EAAM;EAAa,OANnBA,QAAM,cAAc;GACjC,IAAI,CAAC,aAAa,OAAO;GACzB,MAAM,OAAO,gDAAgD,OAAO,OAAO,OAAO,MAAM,sBAAsB,OAAO,QAAQ,OAAO,MAAM;GAC1I,OAAO;IAAE,WAAW;IAAM,iBAAiB;GAAK;EACjD,GAAG;GAAC;GAAa,OAAO;GAAM,OAAO;EAAK,CAEL;CAAE;AACxC"}
|