@kujoforall/paper-ui 0.1.0 → 0.2.1
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/CHANGELOG.md +94 -0
- package/README.md +50 -7
- package/dist/components/editor/block-text.d.ts.map +1 -1
- package/dist/components/editor/block-text.js +52 -17
- package/dist/components/editor/block-text.js.map +1 -1
- package/dist/components/editor/blocks.d.ts.map +1 -1
- package/dist/components/editor/blocks.js +17 -13
- package/dist/components/editor/blocks.js.map +1 -1
- package/dist/components/editor/document-editor.d.ts.map +1 -1
- package/dist/components/editor/document-editor.js +4 -2
- package/dist/components/editor/document-editor.js.map +1 -1
- package/dist/components/editor/document-view.d.ts.map +1 -1
- package/dist/components/editor/document-view.js +17 -12
- package/dist/components/editor/document-view.js.map +1 -1
- package/dist/components/editor/editor-state.d.ts +7 -0
- package/dist/components/editor/editor-state.d.ts.map +1 -1
- package/dist/components/editor/editor-state.js +28 -3
- package/dist/components/editor/editor-state.js.map +1 -1
- package/dist/components/editor/extensions/kit-blocks.d.ts +34 -0
- package/dist/components/editor/extensions/kit-blocks.d.ts.map +1 -0
- package/dist/components/editor/extensions/kit-blocks.js +201 -0
- package/dist/components/editor/extensions/kit-blocks.js.map +1 -0
- package/dist/components/editor/extensions/spoiler.d.ts.map +1 -1
- package/dist/components/editor/extensions/spoiler.js +2 -2
- package/dist/components/editor/extensions/spoiler.js.map +1 -1
- package/dist/components/editor/index.d.ts +1 -0
- package/dist/components/editor/index.d.ts.map +1 -1
- package/dist/components/editor/index.js +1 -0
- package/dist/components/editor/index.js.map +1 -1
- package/dist/components/editor/kinds.js +1 -1
- package/dist/components/editor/kinds.js.map +1 -1
- package/dist/components/editor/look.d.ts +18 -0
- package/dist/components/editor/look.d.ts.map +1 -0
- package/dist/components/editor/look.js +21 -0
- package/dist/components/editor/look.js.map +1 -0
- package/dist/components/three/model-viewer.d.ts +36 -0
- package/dist/components/three/model-viewer.d.ts.map +1 -0
- package/dist/components/three/model-viewer.js +338 -0
- package/dist/components/three/model-viewer.js.map +1 -0
- package/dist/components/ui/accent-picker.js +1 -1
- package/dist/components/ui/accent-picker.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +29 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +72 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/animated-height.d.ts +6 -0
- package/dist/components/ui/animated-height.d.ts.map +1 -0
- package/dist/components/ui/animated-height.js +26 -0
- package/dist/components/ui/animated-height.js.map +1 -0
- package/dist/components/ui/app-shell.d.ts +1 -0
- package/dist/components/ui/app-shell.d.ts.map +1 -1
- package/dist/components/ui/app-shell.js +5 -3
- package/dist/components/ui/app-shell.js.map +1 -1
- package/dist/components/ui/avatar.d.ts +30 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +50 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +3 -3
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +2 -2
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/banner.d.ts +33 -0
- package/dist/components/ui/banner.d.ts.map +1 -0
- package/dist/components/ui/banner.js +21 -0
- package/dist/components/ui/banner.js.map +1 -0
- package/dist/components/ui/breadcrumbs.js +1 -1
- package/dist/components/ui/breadcrumbs.js.map +1 -1
- package/dist/components/ui/button.d.ts +8 -6
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +91 -26
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/calendar.js +6 -5
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/callout.d.ts +23 -4
- package/dist/components/ui/callout.d.ts.map +1 -1
- package/dist/components/ui/callout.js +28 -15
- package/dist/components/ui/callout.js.map +1 -1
- package/dist/components/ui/card.d.ts +13 -8
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +10 -9
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/checkbox.d.ts +9 -4
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +25 -5
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/choice-label.d.ts +13 -0
- package/dist/components/ui/choice-label.d.ts.map +1 -0
- package/dist/components/ui/choice-label.js +17 -0
- package/dist/components/ui/choice-label.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +10 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +21 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/collection-layout.d.ts +24 -0
- package/dist/components/ui/collection-layout.d.ts.map +1 -0
- package/dist/components/ui/collection-layout.js +16 -0
- package/dist/components/ui/collection-layout.js.map +1 -0
- package/dist/components/ui/combobox.d.ts +10 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox.js +93 -0
- package/dist/components/ui/combobox.js.map +1 -0
- package/dist/components/ui/command-menu.d.ts +5 -2
- package/dist/components/ui/command-menu.d.ts.map +1 -1
- package/dist/components/ui/command-menu.js +31 -6
- package/dist/components/ui/command-menu.js.map +1 -1
- package/dist/components/ui/context-menu.d.ts +19 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +42 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/copy-button.d.ts +11 -0
- package/dist/components/ui/copy-button.d.ts.map +1 -0
- package/dist/components/ui/copy-button.js +48 -0
- package/dist/components/ui/copy-button.js.map +1 -0
- package/dist/components/ui/database/calendar-view.d.ts +10 -0
- package/dist/components/ui/database/calendar-view.d.ts.map +1 -0
- package/dist/components/ui/database/calendar-view.js +65 -0
- package/dist/components/ui/database/calendar-view.js.map +1 -0
- package/dist/components/ui/database/card-views.d.ts +22 -0
- package/dist/components/ui/database/card-views.d.ts.map +1 -0
- package/dist/components/ui/database/card-views.js +74 -0
- package/dist/components/ui/database/card-views.js.map +1 -0
- package/dist/components/ui/database/cells.d.ts +20 -0
- package/dist/components/ui/database/cells.d.ts.map +1 -0
- package/dist/components/ui/database/cells.js +132 -0
- package/dist/components/ui/database/cells.js.map +1 -0
- package/dist/components/ui/database/database.d.ts +19 -0
- package/dist/components/ui/database/database.d.ts.map +1 -0
- package/dist/components/ui/database/database.js +102 -0
- package/dist/components/ui/database/database.js.map +1 -0
- package/dist/components/ui/database/icons.d.ts +5 -0
- package/dist/components/ui/database/icons.d.ts.map +1 -0
- package/dist/components/ui/database/icons.js +13 -0
- package/dist/components/ui/database/icons.js.map +1 -0
- package/dist/components/ui/database/table-view.d.ts +11 -0
- package/dist/components/ui/database/table-view.d.ts.map +1 -0
- package/dist/components/ui/database/table-view.js +157 -0
- package/dist/components/ui/database/table-view.js.map +1 -0
- package/dist/components/ui/date-picker.d.ts +6 -1
- package/dist/components/ui/date-picker.d.ts.map +1 -1
- package/dist/components/ui/date-picker.js +20 -12
- package/dist/components/ui/date-picker.js.map +1 -1
- package/dist/components/ui/date-time-picker.d.ts +3 -1
- package/dist/components/ui/date-time-picker.d.ts.map +1 -1
- package/dist/components/ui/date-time-picker.js +17 -15
- package/dist/components/ui/date-time-picker.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +13 -9
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +33 -3
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/document-layout.d.ts +15 -0
- package/dist/components/ui/document-layout.d.ts.map +1 -0
- package/dist/components/ui/document-layout.js +15 -0
- package/dist/components/ui/document-layout.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +14 -10
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +22 -13
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/editable-text.d.ts +9 -2
- package/dist/components/ui/editable-text.d.ts.map +1 -1
- package/dist/components/ui/editable-text.js +27 -10
- package/dist/components/ui/editable-text.js.map +1 -1
- package/dist/components/ui/empty-state.d.ts +11 -0
- package/dist/components/ui/empty-state.d.ts.map +1 -0
- package/dist/components/ui/empty-state.js +9 -0
- package/dist/components/ui/empty-state.js.map +1 -0
- package/dist/components/ui/error-state.d.ts +20 -0
- package/dist/components/ui/error-state.d.ts.map +1 -0
- package/dist/components/ui/error-state.js +17 -0
- package/dist/components/ui/error-state.js.map +1 -0
- package/dist/components/ui/field-button.d.ts +2 -1
- package/dist/components/ui/field-button.d.ts.map +1 -1
- package/dist/components/ui/field-button.js +7 -5
- package/dist/components/ui/field-button.js.map +1 -1
- package/dist/components/ui/file-preview.js +1 -1
- package/dist/components/ui/file-preview.js.map +1 -1
- package/dist/components/ui/file-uploader.d.ts.map +1 -1
- package/dist/components/ui/file-uploader.js +5 -4
- package/dist/components/ui/file-uploader.js.map +1 -1
- package/dist/components/ui/filter-builder.d.ts +18 -0
- package/dist/components/ui/filter-builder.d.ts.map +1 -0
- package/dist/components/ui/filter-builder.js +98 -0
- package/dist/components/ui/filter-builder.js.map +1 -0
- package/dist/components/ui/focus-shell.d.ts +14 -0
- package/dist/components/ui/focus-shell.d.ts.map +1 -0
- package/dist/components/ui/focus-shell.js +13 -0
- package/dist/components/ui/focus-shell.js.map +1 -0
- package/dist/components/ui/handle-row.d.ts +11 -1
- package/dist/components/ui/handle-row.d.ts.map +1 -1
- package/dist/components/ui/handle-row.js +101 -32
- package/dist/components/ui/handle-row.js.map +1 -1
- package/dist/components/ui/header-bar.d.ts +5 -0
- package/dist/components/ui/header-bar.d.ts.map +1 -0
- package/dist/components/ui/header-bar.js +10 -0
- package/dist/components/ui/header-bar.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +13 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/image-block.js +4 -4
- package/dist/components/ui/image-block.js.map +1 -1
- package/dist/components/ui/image-card.d.ts.map +1 -1
- package/dist/components/ui/image-card.js +5 -4
- package/dist/components/ui/image-card.js.map +1 -1
- package/dist/components/ui/image-framer.d.ts +24 -0
- package/dist/components/ui/image-framer.d.ts.map +1 -0
- package/dist/components/ui/image-framer.js +89 -0
- package/dist/components/ui/image-framer.js.map +1 -0
- package/dist/components/ui/image-viewer.d.ts.map +1 -1
- package/dist/components/ui/image-viewer.js +38 -5
- package/dist/components/ui/image-viewer.js.map +1 -1
- package/dist/components/ui/image.d.ts +25 -3
- package/dist/components/ui/image.d.ts.map +1 -1
- package/dist/components/ui/image.js +50 -21
- package/dist/components/ui/image.js.map +1 -1
- package/dist/components/ui/index.d.ts +54 -11
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +53 -10
- package/dist/components/ui/index.js.map +1 -1
- package/dist/components/ui/input.d.ts +71 -12
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +236 -23
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/link-block.d.ts.map +1 -1
- package/dist/components/ui/link-block.js +1 -1
- package/dist/components/ui/link-block.js.map +1 -1
- package/dist/components/ui/list-detail.d.ts +23 -0
- package/dist/components/ui/list-detail.d.ts.map +1 -0
- package/dist/components/ui/list-detail.js +33 -0
- package/dist/components/ui/list-detail.js.map +1 -0
- package/dist/components/ui/listbox.d.ts +7 -0
- package/dist/components/ui/listbox.d.ts.map +1 -0
- package/dist/components/ui/listbox.js +29 -0
- package/dist/components/ui/listbox.js.map +1 -0
- package/dist/components/ui/mac-card.js +1 -1
- package/dist/components/ui/mac-card.js.map +1 -1
- package/dist/components/ui/month-picker.d.ts +13 -0
- package/dist/components/ui/month-picker.d.ts.map +1 -0
- package/dist/components/ui/month-picker.js +53 -0
- package/dist/components/ui/month-picker.js.map +1 -0
- package/dist/components/ui/multi-select.d.ts +22 -0
- package/dist/components/ui/multi-select.d.ts.map +1 -0
- package/dist/components/ui/multi-select.js +88 -0
- package/dist/components/ui/multi-select.js.map +1 -0
- package/dist/components/ui/nav-tree.d.ts.map +1 -1
- package/dist/components/ui/nav-tree.js +10 -3
- package/dist/components/ui/nav-tree.js.map +1 -1
- package/dist/components/ui/page.d.ts +16 -5
- package/dist/components/ui/page.d.ts.map +1 -1
- package/dist/components/ui/page.js +23 -10
- package/dist/components/ui/page.js.map +1 -1
- package/dist/components/ui/pagination.d.ts +26 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +54 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/picker-panel.d.ts +13 -0
- package/dist/components/ui/picker-panel.d.ts.map +1 -0
- package/dist/components/ui/picker-panel.js +19 -0
- package/dist/components/ui/picker-panel.js.map +1 -0
- package/dist/components/ui/popover.d.ts +2 -2
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.d.ts +11 -1
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/progress.js +17 -4
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/property.d.ts +2 -6
- package/dist/components/ui/property.d.ts.map +1 -1
- package/dist/components/ui/property.js +6 -22
- package/dist/components/ui/property.js.map +1 -1
- package/dist/components/ui/radio-group.d.ts +8 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +18 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/rating.d.ts +14 -0
- package/dist/components/ui/rating.d.ts.map +1 -0
- package/dist/components/ui/rating.js +61 -0
- package/dist/components/ui/rating.js.map +1 -0
- package/dist/components/ui/save-status.d.ts +8 -0
- package/dist/components/ui/save-status.d.ts.map +1 -0
- package/dist/components/ui/save-status.js +31 -0
- package/dist/components/ui/save-status.js.map +1 -0
- package/dist/components/ui/segmented.d.ts +15 -7
- package/dist/components/ui/segmented.d.ts.map +1 -1
- package/dist/components/ui/segmented.js +8 -6
- package/dist/components/ui/segmented.js.map +1 -1
- package/dist/components/ui/select-menu.d.ts +3 -1
- package/dist/components/ui/select-menu.d.ts.map +1 -1
- package/dist/components/ui/select-menu.js +2 -2
- package/dist/components/ui/select-menu.js.map +1 -1
- package/dist/components/ui/select.d.ts +7 -2
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +19 -5
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/selection-bar.js +1 -1
- package/dist/components/ui/selection-bar.js.map +1 -1
- package/dist/components/ui/settings-layout.d.ts +34 -0
- package/dist/components/ui/settings-layout.d.ts.map +1 -0
- package/dist/components/ui/settings-layout.js +16 -0
- package/dist/components/ui/settings-layout.js.map +1 -0
- package/dist/components/ui/share-link.d.ts +14 -0
- package/dist/components/ui/share-link.d.ts.map +1 -0
- package/dist/components/ui/share-link.js +16 -0
- package/dist/components/ui/share-link.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +21 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +53 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +82 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +258 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +8 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +15 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/spinner.d.ts +12 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +14 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/spotlight.d.ts.map +1 -1
- package/dist/components/ui/spotlight.js +14 -11
- package/dist/components/ui/spotlight.js.map +1 -1
- package/dist/components/ui/step-dialog.js +3 -3
- package/dist/components/ui/step-dialog.js.map +1 -1
- package/dist/components/ui/steps-layout.d.ts +20 -0
- package/dist/components/ui/steps-layout.d.ts.map +1 -0
- package/dist/components/ui/steps-layout.js +26 -0
- package/dist/components/ui/steps-layout.js.map +1 -0
- package/dist/components/ui/switch.d.ts +8 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +21 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/table.d.ts +13 -5
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +65 -12
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +19 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/theme-toggle.d.ts +14 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -1
- package/dist/components/ui/theme-toggle.js +69 -41
- package/dist/components/ui/theme-toggle.js.map +1 -1
- package/dist/components/ui/time-list.d.ts +16 -0
- package/dist/components/ui/time-list.d.ts.map +1 -0
- package/dist/components/ui/time-list.js +49 -0
- package/dist/components/ui/time-list.js.map +1 -0
- package/dist/components/ui/time-picker.d.ts +37 -11
- package/dist/components/ui/time-picker.d.ts.map +1 -1
- package/dist/components/ui/time-picker.js +130 -52
- package/dist/components/ui/time-picker.js.map +1 -1
- package/dist/components/ui/toast.d.ts +18 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +77 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +15 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +55 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +1 -1
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +13 -2
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/components/ui/top-bar.d.ts +25 -0
- package/dist/components/ui/top-bar.d.ts.map +1 -0
- package/dist/components/ui/top-bar.js +23 -0
- package/dist/components/ui/top-bar.js.map +1 -0
- package/dist/components/ui/typography.d.ts +11 -5
- package/dist/components/ui/typography.d.ts.map +1 -1
- package/dist/components/ui/typography.js +31 -5
- package/dist/components/ui/typography.js.map +1 -1
- package/dist/components/ui/video-block.d.ts.map +1 -1
- package/dist/components/ui/video-block.js +5 -1
- package/dist/components/ui/video-block.js.map +1 -1
- package/dist/hooks/use-dismiss.d.ts +5 -0
- package/dist/hooks/use-dismiss.d.ts.map +1 -0
- package/dist/hooks/use-dismiss.js +23 -0
- package/dist/hooks/use-dismiss.js.map +1 -0
- package/dist/hooks/use-escape-first.d.ts +3 -0
- package/dist/hooks/use-escape-first.d.ts.map +1 -0
- package/dist/hooks/use-escape-first.js +27 -0
- package/dist/hooks/use-escape-first.js.map +1 -0
- package/dist/hooks/use-media-query.d.ts +5 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +16 -0
- package/dist/hooks/use-media-query.js.map +1 -0
- package/dist/hooks/use-save-queue.d.ts.map +1 -1
- package/dist/hooks/use-save-queue.js +19 -7
- package/dist/hooks/use-save-queue.js.map +1 -1
- package/dist/hooks/use-selection.d.ts.map +1 -1
- package/dist/hooks/use-selection.js +10 -1
- package/dist/hooks/use-selection.js.map +1 -1
- package/dist/lib/database.d.ts +92 -0
- package/dist/lib/database.d.ts.map +1 -0
- package/dist/lib/database.js +272 -0
- package/dist/lib/database.js.map +1 -0
- package/dist/lib/dates.d.ts +16 -0
- package/dist/lib/dates.d.ts.map +1 -1
- package/dist/lib/dates.js +27 -0
- package/dist/lib/dates.js.map +1 -1
- package/dist/lib/keys.d.ts +18 -0
- package/dist/lib/keys.d.ts.map +1 -0
- package/dist/lib/keys.js +66 -0
- package/dist/lib/keys.js.map +1 -0
- package/dist/lib/number.d.ts +4 -0
- package/dist/lib/number.d.ts.map +1 -0
- package/dist/lib/number.js +33 -0
- package/dist/lib/number.js.map +1 -0
- package/dist/lib/pointer.d.ts +2 -0
- package/dist/lib/pointer.d.ts.map +1 -0
- package/dist/lib/pointer.js +4 -0
- package/dist/lib/pointer.js.map +1 -0
- package/dist/lib/prepare-image.d.ts +43 -0
- package/dist/lib/prepare-image.d.ts.map +1 -0
- package/dist/lib/prepare-image.js +105 -0
- package/dist/lib/prepare-image.js.map +1 -0
- package/dist/lib/rich-text-dom.d.ts +2 -0
- package/dist/lib/rich-text-dom.d.ts.map +1 -1
- package/dist/lib/rich-text-dom.js +5 -3
- package/dist/lib/rich-text-dom.js.map +1 -1
- package/dist/lib/theme.d.ts +6 -0
- package/dist/lib/theme.d.ts.map +1 -0
- package/dist/lib/theme.js +15 -0
- package/dist/lib/theme.js.map +1 -0
- package/dist/lib/time.d.ts +19 -0
- package/dist/lib/time.d.ts.map +1 -0
- package/dist/lib/time.js +91 -0
- package/dist/lib/time.js.map +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +20 -2
- package/dist/lib/utils.js.map +1 -1
- package/dist/styles/notion.css +342 -51
- package/package.json +27 -4
- package/src/components/editor/block-text.tsx +58 -17
- package/src/components/editor/blocks.tsx +19 -14
- package/src/components/editor/document-editor.tsx +7 -2
- package/src/components/editor/document-view.tsx +37 -24
- package/src/components/editor/editor-state.tsx +31 -3
- package/src/components/editor/extensions/kit-blocks.tsx +452 -0
- package/src/components/editor/extensions/spoiler.tsx +9 -4
- package/src/components/editor/index.ts +1 -0
- package/src/components/editor/kinds.ts +1 -1
- package/src/components/editor/look.tsx +36 -0
- package/src/components/three/model-viewer.tsx +514 -0
- package/src/components/ui/accent-picker.tsx +2 -2
- package/src/components/ui/alert-dialog.tsx +136 -0
- package/src/components/ui/animated-height.tsx +34 -0
- package/src/components/ui/app-shell.tsx +9 -7
- package/src/components/ui/avatar.tsx +106 -0
- package/src/components/ui/badge.tsx +4 -4
- package/src/components/ui/banner.tsx +53 -0
- package/src/components/ui/breadcrumbs.tsx +1 -1
- package/src/components/ui/button.tsx +115 -41
- package/src/components/ui/calendar.tsx +8 -7
- package/src/components/ui/callout.tsx +41 -42
- package/src/components/ui/card.tsx +27 -58
- package/src/components/ui/checkbox.tsx +53 -19
- package/src/components/ui/choice-label.tsx +43 -0
- package/src/components/ui/collapsible.tsx +58 -0
- package/src/components/ui/collection-layout.tsx +69 -0
- package/src/components/ui/combobox.tsx +155 -0
- package/src/components/ui/command-menu.tsx +61 -31
- package/src/components/ui/context-menu.tsx +89 -0
- package/src/components/ui/copy-button.tsx +80 -0
- package/src/components/ui/database/calendar-view.tsx +180 -0
- package/src/components/ui/database/card-views.tsx +221 -0
- package/src/components/ui/database/cells.tsx +237 -0
- package/src/components/ui/database/database.tsx +279 -0
- package/src/components/ui/database/icons.ts +15 -0
- package/src/components/ui/database/table-view.tsx +311 -0
- package/src/components/ui/date-picker.tsx +99 -61
- package/src/components/ui/date-time-picker.tsx +68 -62
- package/src/components/ui/dialog.tsx +48 -21
- package/src/components/ui/document-layout.tsx +52 -0
- package/src/components/ui/dropdown-menu.tsx +33 -31
- package/src/components/ui/editable-text.tsx +40 -7
- package/src/components/ui/empty-state.tsx +35 -0
- package/src/components/ui/error-state.tsx +67 -0
- package/src/components/ui/field-button.tsx +11 -9
- package/src/components/ui/file-preview.tsx +1 -1
- package/src/components/ui/file-uploader.tsx +23 -24
- package/src/components/ui/filter-builder.tsx +304 -0
- package/src/components/ui/focus-shell.tsx +48 -0
- package/src/components/ui/handle-row.tsx +176 -40
- package/src/components/ui/header-bar.tsx +15 -0
- package/src/components/ui/hover-card.tsx +30 -0
- package/src/components/ui/image-block.tsx +6 -6
- package/src/components/ui/image-card.tsx +18 -25
- package/src/components/ui/image-framer.tsx +160 -0
- package/src/components/ui/image-viewer.tsx +53 -10
- package/src/components/ui/image.tsx +133 -29
- package/src/components/ui/index.ts +106 -11
- package/src/components/ui/input.tsx +437 -65
- package/src/components/ui/link-block.tsx +5 -2
- package/src/components/ui/list-detail.tsx +115 -0
- package/src/components/ui/listbox.ts +26 -0
- package/src/components/ui/mac-card.tsx +5 -5
- package/src/components/ui/month-picker.tsx +119 -0
- package/src/components/ui/multi-select.tsx +221 -0
- package/src/components/ui/nav-tree.tsx +11 -5
- package/src/components/ui/page.tsx +63 -15
- package/src/components/ui/pagination.tsx +143 -0
- package/src/components/ui/picker-panel.tsx +69 -0
- package/src/components/ui/popover.tsx +3 -3
- package/src/components/ui/progress.tsx +56 -16
- package/src/components/ui/property.tsx +6 -37
- package/src/components/ui/radio-group.tsx +61 -0
- package/src/components/ui/rating.tsx +122 -0
- package/src/components/ui/save-status.tsx +53 -0
- package/src/components/ui/segmented.tsx +48 -16
- package/src/components/ui/select-menu.tsx +11 -3
- package/src/components/ui/select.tsx +33 -10
- package/src/components/ui/selection-bar.tsx +1 -1
- package/src/components/ui/settings-layout.tsx +117 -0
- package/src/components/ui/share-link.tsx +66 -0
- package/src/components/ui/sheet.tsx +90 -0
- package/src/components/ui/sidebar.tsx +627 -0
- package/src/components/ui/skeleton.tsx +22 -0
- package/src/components/ui/spinner.tsx +28 -0
- package/src/components/ui/spotlight.tsx +21 -21
- package/src/components/ui/step-dialog.tsx +6 -6
- package/src/components/ui/steps-layout.tsx +91 -0
- package/src/components/ui/switch.tsx +55 -0
- package/src/components/ui/table.tsx +75 -18
- package/src/components/ui/tabs.tsx +41 -0
- package/src/components/ui/theme-toggle.tsx +74 -83
- package/src/components/ui/time-list.tsx +106 -0
- package/src/components/ui/time-picker.tsx +305 -134
- package/src/components/ui/toast.tsx +132 -0
- package/src/components/ui/toggle.tsx +76 -0
- package/src/components/ui/tooltip.tsx +20 -6
- package/src/components/ui/top-bar.tsx +118 -0
- package/src/components/ui/typography.tsx +45 -9
- package/src/components/ui/video-block.tsx +9 -3
- package/src/hooks/use-dismiss.ts +24 -0
- package/src/hooks/use-escape-first.ts +25 -0
- package/src/hooks/use-media-query.ts +23 -0
- package/src/hooks/use-save-queue.ts +19 -7
- package/src/hooks/use-selection.ts +8 -1
- package/src/lib/database.ts +322 -0
- package/src/lib/dates.ts +36 -0
- package/src/lib/keys.ts +72 -0
- package/src/lib/number.ts +29 -0
- package/src/lib/pointer.ts +3 -0
- package/src/lib/prepare-image.ts +141 -0
- package/src/lib/rich-text-dom.ts +5 -3
- package/src/lib/theme.ts +18 -0
- package/src/lib/time.ts +83 -0
- package/src/lib/utils.ts +21 -2
- package/src/styles/notion.css +342 -51
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Check, Info, TriangleAlert, X } from "lucide-react";
|
|
4
|
+
import { createContext, useCallback, useContext, useEffect, useRef, useState, type ReactNode } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
import { Button } from "./button.tsx";
|
|
7
|
+
|
|
8
|
+
export type ToastTone = "done" | "info" | "error";
|
|
9
|
+
export type Toast = {
|
|
10
|
+
message: ReactNode;
|
|
11
|
+
tone?: ToastTone;
|
|
12
|
+
action?: { label: string; onAction: () => void };
|
|
13
|
+
/** How long it stays, in ms. 6s, or 10s when it has an action to reach. */
|
|
14
|
+
duration?: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const Ctx = createContext<(toast: Toast) => void>(() => {});
|
|
18
|
+
|
|
19
|
+
/** Says, briefly and out of the way, that something happened. Needs a ToastProvider above. */
|
|
20
|
+
export const useToast = () => useContext(Ctx);
|
|
21
|
+
|
|
22
|
+
const SHOWN_MS = 6000;
|
|
23
|
+
const WITH_ACTION_MS = 10000;
|
|
24
|
+
|
|
25
|
+
const TONES: Record<ToastTone, { icon: typeof Check; className: string }> = {
|
|
26
|
+
done: { icon: Check, className: "bg-tag-green-bg text-tag-green-ink" },
|
|
27
|
+
info: { icon: Info, className: "bg-tag-blue-bg text-tag-blue-ink" },
|
|
28
|
+
error: { icon: TriangleAlert, className: "bg-tag-red-bg text-tag-red-ink" },
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/* One toast at a time, at the bottom of the window. A newer one replaces the one
|
|
32
|
+
showing. It leaves by itself; hovering or focusing it holds it, and its action or
|
|
33
|
+
its cross dismisses it. For telling what just happened, never for something that
|
|
34
|
+
needs an answer: that is a dialog.
|
|
35
|
+
|
|
36
|
+
A toast is at the far end of the page, out of a keyboard's easy reach, so F8
|
|
37
|
+
moves focus to it (as Radix's toasts do), Escape there dismisses it, and one
|
|
38
|
+
with an action stays 10 seconds rather than 6.
|
|
39
|
+
|
|
40
|
+
From endgame, 2026-12-05, with tones added. */
|
|
41
|
+
export function ToastProvider({ children }: { children: ReactNode }) {
|
|
42
|
+
const [toast, setToast] = useState<(Toast & { id: number }) | null>(null);
|
|
43
|
+
const [held, setHeld] = useState(false);
|
|
44
|
+
const next = useRef(0);
|
|
45
|
+
const box = useRef<HTMLDivElement>(null);
|
|
46
|
+
// Where focus was before F8 took it to the toast, to go back to.
|
|
47
|
+
const returnTo = useRef<HTMLElement | null>(null);
|
|
48
|
+
const show = useCallback((t: Toast) => setToast({ ...t, id: ++next.current }), []);
|
|
49
|
+
// Gone by its cross, its action or Escape: a toast that leaves never hears the
|
|
50
|
+
// pointer leave or the focus go, so `held` is let go of here, or every later
|
|
51
|
+
// toast would stay up. Focus taken to it by F8 goes back where it came from.
|
|
52
|
+
const dismiss = useCallback(() => {
|
|
53
|
+
const hadFocus = box.current?.contains(document.activeElement) ?? false;
|
|
54
|
+
setToast(null);
|
|
55
|
+
setHeld(false);
|
|
56
|
+
if (hadFocus) {
|
|
57
|
+
returnTo.current?.focus?.();
|
|
58
|
+
returnTo.current = null;
|
|
59
|
+
}
|
|
60
|
+
}, []);
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!toast || held) return;
|
|
64
|
+
const timer = setTimeout(() => setToast(null), toast.duration ?? (toast.action ? WITH_ACTION_MS : SHOWN_MS));
|
|
65
|
+
return () => clearTimeout(timer);
|
|
66
|
+
}, [toast, held]);
|
|
67
|
+
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (!toast) return;
|
|
70
|
+
const onKey = (e: KeyboardEvent) => {
|
|
71
|
+
if (e.key === "F8") {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
if (!box.current?.contains(document.activeElement)) returnTo.current = document.activeElement as HTMLElement | null;
|
|
74
|
+
box.current?.querySelector<HTMLElement>("button")?.focus();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
window.addEventListener("keydown", onKey);
|
|
78
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
79
|
+
}, [toast]);
|
|
80
|
+
|
|
81
|
+
const tone = TONES[toast?.tone ?? "done"];
|
|
82
|
+
const Icon = tone.icon;
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Ctx.Provider value={show}>
|
|
86
|
+
{children}
|
|
87
|
+
<div
|
|
88
|
+
role="region"
|
|
89
|
+
aria-label="Notifications (F8)"
|
|
90
|
+
aria-live="polite"
|
|
91
|
+
className="z-(--z-toast) fixed inset-x-0 bottom-0 flex justify-center p-4 pb-[max(1rem,env(safe-area-inset-bottom))] pointer-events-none"
|
|
92
|
+
>
|
|
93
|
+
{toast && (
|
|
94
|
+
<div
|
|
95
|
+
ref={box}
|
|
96
|
+
key={toast.id}
|
|
97
|
+
onKeyDown={(e) => {
|
|
98
|
+
if (e.key === "Escape") dismiss();
|
|
99
|
+
}}
|
|
100
|
+
role={toast.tone === "error" ? "alert" : "status"}
|
|
101
|
+
onMouseEnter={() => setHeld(true)}
|
|
102
|
+
onMouseLeave={() => setHeld(false)}
|
|
103
|
+
onFocus={() => setHeld(true)}
|
|
104
|
+
onBlur={() => setHeld(false)}
|
|
105
|
+
className="flex items-center gap-3 bg-surface-overlay shadow-popover py-2 pr-2 pl-3 rounded-overlay max-w-[min(32rem,100%)] text-sm animate-toast-in pointer-events-auto"
|
|
106
|
+
>
|
|
107
|
+
<span className={cn("flex justify-center items-center rounded-full size-5 shrink-0", tone.className)}>
|
|
108
|
+
<Icon className="size-3" strokeWidth={3} />
|
|
109
|
+
</span>
|
|
110
|
+
<span className="flex-1 min-w-0">{toast.message}</span>
|
|
111
|
+
{toast.action && (
|
|
112
|
+
<Button
|
|
113
|
+
variant="ghost"
|
|
114
|
+
size="sm"
|
|
115
|
+
onClick={() => {
|
|
116
|
+
toast.action!.onAction();
|
|
117
|
+
dismiss();
|
|
118
|
+
}}
|
|
119
|
+
className="font-medium text-accent-text shrink-0"
|
|
120
|
+
>
|
|
121
|
+
{toast.action.label}
|
|
122
|
+
</Button>
|
|
123
|
+
)}
|
|
124
|
+
<Button variant="ghost" size="icon-sm" aria-label="Dismiss" onClick={dismiss} className="text-ink-tertiary hover:text-ink shrink-0">
|
|
125
|
+
<X />
|
|
126
|
+
</Button>
|
|
127
|
+
</div>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
</Ctx.Provider>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
4
|
+
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
5
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
|
+
import { createContext, useContext, type ComponentProps } from "react";
|
|
7
|
+
import { cn } from "../../lib/utils.ts";
|
|
8
|
+
|
|
9
|
+
/* A button that stays pressed: Bold in a toolbar, a filter that is on. It says so
|
|
10
|
+
to assistive technology (aria-pressed) and looks it: the accent's tint, which
|
|
11
|
+
no hover state uses, so "on" never reads as "under the pointer".
|
|
12
|
+
|
|
13
|
+
For a row of them, ToggleGroup: arrow keys move between them, Tab leaves the row.
|
|
14
|
+
`type="multiple"` lets any number be on (Bold, Italic); `type="single"` one at
|
|
15
|
+
most, and none (an alignment that can be cleared). To choose exactly one of a
|
|
16
|
+
few, always one, use Segmented. */
|
|
17
|
+
|
|
18
|
+
const toggleVariants = cva(
|
|
19
|
+
[
|
|
20
|
+
"inline-flex items-center justify-center gap-1.5 shrink-0 rounded-control font-medium text-sm whitespace-nowrap select-none",
|
|
21
|
+
"text-ink-secondary transition-[background-color,box-shadow,color] duration-(--duration-fast) ease-out-notion",
|
|
22
|
+
"hover:bg-tint-hover hover:text-ink active:bg-tint-active",
|
|
23
|
+
"data-[state=on]:bg-accent-tint data-[state=on]:text-accent-text",
|
|
24
|
+
"disabled:pointer-events-none disabled:text-ink-disabled",
|
|
25
|
+
"[&_svg]:shrink-0 [&_svg]:pointer-events-none",
|
|
26
|
+
],
|
|
27
|
+
{
|
|
28
|
+
variants: {
|
|
29
|
+
variant: {
|
|
30
|
+
/** Bare until hovered or on: in a toolbar. */
|
|
31
|
+
ghost: "",
|
|
32
|
+
/** With an edge, standing alone among other controls. */
|
|
33
|
+
secondary: "bg-surface shadow-xs data-[state=on]:shadow-[0_0_0_1px_var(--accent)]",
|
|
34
|
+
},
|
|
35
|
+
size: {
|
|
36
|
+
sm: "h-control-sm px-2 [&_svg]:size-3.5",
|
|
37
|
+
md: "h-control-md px-2.5 [&_svg]:size-4",
|
|
38
|
+
lg: "h-control-lg px-3 text-body [&_svg]:size-4",
|
|
39
|
+
"icon-sm": "size-control-sm [&_svg]:size-3.5",
|
|
40
|
+
icon: "size-control-md [&_svg]:size-4",
|
|
41
|
+
"icon-lg": "size-control-lg [&_svg]:size-5",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: { variant: "ghost", size: "md" },
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
type ToggleLook = VariantProps<typeof toggleVariants>;
|
|
49
|
+
|
|
50
|
+
/** `pressed` and `onPressedChange`, or `defaultPressed` to let it keep its own. Name an icon-only one with aria-label. */
|
|
51
|
+
export function Toggle({ className, variant, size, ...props }: ComponentProps<typeof TogglePrimitive.Root> & ToggleLook) {
|
|
52
|
+
return <TogglePrimitive.Root className={cn(toggleVariants({ variant, size }), className)} {...props} />;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const GroupLook = createContext<ToggleLook>({});
|
|
56
|
+
|
|
57
|
+
export function ToggleGroup({
|
|
58
|
+
className,
|
|
59
|
+
variant,
|
|
60
|
+
size,
|
|
61
|
+
children,
|
|
62
|
+
...props
|
|
63
|
+
}: ComponentProps<typeof ToggleGroupPrimitive.Root> & ToggleLook) {
|
|
64
|
+
return (
|
|
65
|
+
<ToggleGroupPrimitive.Root className={cn("inline-flex items-center gap-0.5", className)} {...props}>
|
|
66
|
+
<GroupLook.Provider value={{ variant, size }}>{children}</GroupLook.Provider>
|
|
67
|
+
</ToggleGroupPrimitive.Root>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function ToggleGroupItem({ className, variant, size, ...props }: ComponentProps<typeof ToggleGroupPrimitive.Item> & ToggleLook) {
|
|
72
|
+
const group = useContext(GroupLook);
|
|
73
|
+
return <ToggleGroupPrimitive.Item className={cn(toggleVariants({ variant: variant ?? group.variant, size: size ?? group.size }), className)} {...props} />;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { toggleVariants };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4
|
-
import type
|
|
4
|
+
import { isValidElement, type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
5
|
+
import { formatShortcut } from "../../lib/keys.ts";
|
|
6
|
+
import { usePlatform } from "./typography.tsx";
|
|
5
7
|
import { cn } from "../../lib/utils.ts";
|
|
6
8
|
|
|
7
9
|
/* A tooltip is a small overlay like any other: the theme's own surface and
|
|
@@ -25,7 +27,7 @@ export function TooltipContent({
|
|
|
25
27
|
<TooltipPrimitive.Content
|
|
26
28
|
sideOffset={sideOffset}
|
|
27
29
|
className={cn(
|
|
28
|
-
"z-
|
|
30
|
+
"z-(--z-tooltip) bg-surface-overlay shadow-popover px-2 py-1 rounded-control",
|
|
29
31
|
"max-w-56 font-medium text-ink text-caption",
|
|
30
32
|
"data-[state=delayed-open]:animate-fade-in",
|
|
31
33
|
className,
|
|
@@ -37,6 +39,12 @@ export function TooltipContent({
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
/** Convenience wrapper — the common case in one element. */
|
|
42
|
+
/* A word or two about a control, on hover or focus. `shortcut` is written once,
|
|
43
|
+
"mod+k", and shown as the platform has it (⌘K, Ctrl+K).
|
|
44
|
+
|
|
45
|
+
A disabled button takes no pointer events, so a tooltip saying why it is disabled
|
|
46
|
+
could never open. When the child is disabled it is wrapped in a span that takes
|
|
47
|
+
them instead, and that span is focusable so the reason is reachable by keyboard. */
|
|
40
48
|
export function Tooltip({
|
|
41
49
|
children,
|
|
42
50
|
content,
|
|
@@ -50,14 +58,20 @@ export function Tooltip({
|
|
|
50
58
|
shortcut?: string;
|
|
51
59
|
delayDuration?: number;
|
|
52
60
|
}) {
|
|
61
|
+
const on = usePlatform();
|
|
62
|
+
const child = isValidElement<{ disabled?: boolean }>(children) && children.props.disabled ? (
|
|
63
|
+
<span tabIndex={0} className="inline-flex rounded-control">
|
|
64
|
+
{children}
|
|
65
|
+
</span>
|
|
66
|
+
) : (
|
|
67
|
+
children
|
|
68
|
+
);
|
|
53
69
|
return (
|
|
54
70
|
<TooltipRoot delayDuration={delayDuration}>
|
|
55
|
-
<TooltipTrigger asChild>{
|
|
71
|
+
<TooltipTrigger asChild>{child}</TooltipTrigger>
|
|
56
72
|
<TooltipContent side={side}>
|
|
57
73
|
{content}
|
|
58
|
-
{shortcut && (
|
|
59
|
-
<span className="ml-1.5 text-ink-tertiary">{shortcut}</span>
|
|
60
|
-
)}
|
|
74
|
+
{shortcut && <span className="ml-1.5 text-ink-tertiary">{formatShortcut(shortcut, on)}</span>}
|
|
61
75
|
</TooltipContent>
|
|
62
76
|
</TooltipRoot>
|
|
63
77
|
);
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Menu } from "lucide-react";
|
|
4
|
+
import { useEffect, useState, type ElementType, type ReactNode } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
import { Button } from "./button.tsx";
|
|
7
|
+
import { Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "./sheet.tsx";
|
|
8
|
+
|
|
9
|
+
/* The top bar app (docs/parts/layouts.md): the app's name and a few destinations
|
|
10
|
+
across the top, the page under it. For small apps and public pages, where a
|
|
11
|
+
sidebar would be more frame than content.
|
|
12
|
+
|
|
13
|
+
- The bar is 3.5rem, sticky, and gains a hairline once the page scrolls under it.
|
|
14
|
+
- Its content lines up with the page's: the same widths (`width`) and the same
|
|
15
|
+
margins, which step with the room there is.
|
|
16
|
+
- Destinations are links, the current one marked (aria-current, and ruled in ink
|
|
17
|
+
as Tabs are). Pass your router's link as `link`.
|
|
18
|
+
- Below 48rem the destinations fold into a menu button that opens them in a
|
|
19
|
+
sheet from the side, with large rows.
|
|
20
|
+
- The page itself goes in `children`; it is a container, so a Page inside sizes
|
|
21
|
+
itself to it. */
|
|
22
|
+
|
|
23
|
+
export type TopBarLink = { label: string; href: string; current?: boolean };
|
|
24
|
+
|
|
25
|
+
const WIDTHS = { reading: "max-w-reading", wide: "max-w-wide" } as const;
|
|
26
|
+
|
|
27
|
+
export function TopBarShell({
|
|
28
|
+
brand,
|
|
29
|
+
links = [],
|
|
30
|
+
actions,
|
|
31
|
+
link: Link = "a",
|
|
32
|
+
width = "wide",
|
|
33
|
+
label = "Main",
|
|
34
|
+
children,
|
|
35
|
+
className,
|
|
36
|
+
}: {
|
|
37
|
+
/** The app's name or mark, usually a link home. */
|
|
38
|
+
brand: ReactNode;
|
|
39
|
+
links?: readonly TopBarLink[];
|
|
40
|
+
/** Beside the menu on the right: a theme toggle, an account, a sign-in button. */
|
|
41
|
+
actions?: ReactNode;
|
|
42
|
+
link?: ElementType;
|
|
43
|
+
width?: keyof typeof WIDTHS;
|
|
44
|
+
/** Names the navigation for a screen reader. */
|
|
45
|
+
label?: string;
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
className?: string;
|
|
48
|
+
}) {
|
|
49
|
+
const [scrolled, setScrolled] = useState(false);
|
|
50
|
+
const [open, setOpen] = useState(false);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const onScroll = () => setScrolled(window.scrollY > 0);
|
|
53
|
+
onScroll();
|
|
54
|
+
window.addEventListener("scroll", onScroll, { passive: true });
|
|
55
|
+
return () => window.removeEventListener("scroll", onScroll);
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
const item = (l: TopBarLink, big: boolean) => (
|
|
59
|
+
<Link
|
|
60
|
+
key={l.href}
|
|
61
|
+
href={l.href}
|
|
62
|
+
aria-current={l.current ? "page" : undefined}
|
|
63
|
+
onClick={() => setOpen(false)}
|
|
64
|
+
className={cn(
|
|
65
|
+
"inline-flex relative items-center rounded-control font-medium text-sm transition-colors duration-(--duration-fast)",
|
|
66
|
+
big ? "px-3 h-11 w-full hover:bg-tint-hover" : "px-2.5 h-control-md hover:bg-tint-hover",
|
|
67
|
+
l.current ? "text-ink" : "text-ink-secondary hover:text-ink",
|
|
68
|
+
// The current one ruled in ink under it, as a tab is (in the bar only).
|
|
69
|
+
!big && "after:absolute after:inset-x-2.5 after:-bottom-3 after:h-0.5 after:rounded-full after:content-['']",
|
|
70
|
+
!big && l.current && "after:bg-ink",
|
|
71
|
+
big && l.current && "bg-tint-active"
|
|
72
|
+
)}
|
|
73
|
+
>
|
|
74
|
+
{l.label}
|
|
75
|
+
</Link>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<div className={cn("flex flex-col bg-surface min-h-dvh", className)}>
|
|
80
|
+
<header
|
|
81
|
+
data-scrolled={scrolled || undefined}
|
|
82
|
+
className="@container top-0 z-(--z-sticky) sticky bg-surface data-scrolled:shadow-edge-b transition-shadow duration-(--duration-fast)"
|
|
83
|
+
>
|
|
84
|
+
<div className={cn("flex items-center gap-2 mx-auto px-5 @xl:px-8 @4xl:px-12 w-full h-14", WIDTHS[width])}>
|
|
85
|
+
<div className="flex items-center min-w-0 shrink-0">{brand}</div>
|
|
86
|
+
{links.length > 0 && (
|
|
87
|
+
<nav aria-label={label} className="@max-3xl:hidden flex items-center gap-1 ml-4">
|
|
88
|
+
{links.map((l) => item(l, false))}
|
|
89
|
+
</nav>
|
|
90
|
+
)}
|
|
91
|
+
<div className="flex items-center gap-1 ml-auto shrink-0">
|
|
92
|
+
{actions}
|
|
93
|
+
{links.length > 0 && (
|
|
94
|
+
<Sheet open={open} onOpenChange={setOpen}>
|
|
95
|
+
<SheetTrigger asChild>
|
|
96
|
+
<Button variant="ghost" size="icon" aria-label="Menu" className="@3xl:hidden">
|
|
97
|
+
<Menu />
|
|
98
|
+
</Button>
|
|
99
|
+
</SheetTrigger>
|
|
100
|
+
<SheetContent side="right" aria-describedby={undefined}>
|
|
101
|
+
<SheetHeader>
|
|
102
|
+
<SheetTitle>{label}</SheetTitle>
|
|
103
|
+
</SheetHeader>
|
|
104
|
+
<SheetBody>
|
|
105
|
+
<nav aria-label={label} className="flex flex-col gap-0.5">
|
|
106
|
+
{links.map((l) => item(l, true))}
|
|
107
|
+
</nav>
|
|
108
|
+
</SheetBody>
|
|
109
|
+
</SheetContent>
|
|
110
|
+
</Sheet>
|
|
111
|
+
)}
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</header>
|
|
115
|
+
<main className="@container flex-1">{children}</main>
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
|
-
import type
|
|
2
|
+
import { useSyncExternalStore, type ComponentProps, type ComponentPropsWithoutRef, type ElementType, type ReactNode } from "react";
|
|
3
|
+
import { platform, shortcutKeys, speakShortcut, type Platform } from "../../lib/keys.ts";
|
|
3
4
|
import { cn } from "../../lib/utils.ts";
|
|
5
|
+
import { CODE_CLASSES } from "../../lib/rich-text-dom.ts";
|
|
4
6
|
|
|
5
7
|
/* ────────────────────────────────────────────────────────────────────────
|
|
6
8
|
Typography carries the entire hierarchy in this system. There are no
|
|
@@ -12,6 +14,7 @@ import { cn } from "../../lib/utils.ts";
|
|
|
12
14
|
const headingVariants = cva("text-ink font-sans text-balance", {
|
|
13
15
|
variants: {
|
|
14
16
|
level: {
|
|
17
|
+
display: "text-display mt-0 mb-2",
|
|
15
18
|
title: "text-title mt-0 mb-2",
|
|
16
19
|
1: "text-h1 mt-8 mb-1",
|
|
17
20
|
2: "text-h2 mt-6 mb-1",
|
|
@@ -21,9 +24,10 @@ const headingVariants = cva("text-ink font-sans text-balance", {
|
|
|
21
24
|
defaultVariants: { level: 1 },
|
|
22
25
|
});
|
|
23
26
|
|
|
24
|
-
type HeadingLevel = "title" | 1 | 2 | 3;
|
|
27
|
+
type HeadingLevel = "display" | "title" | 1 | 2 | 3;
|
|
25
28
|
|
|
26
29
|
const defaultTag: Record<string, ElementType> = {
|
|
30
|
+
display: "h1",
|
|
27
31
|
title: "h1",
|
|
28
32
|
1: "h1",
|
|
29
33
|
2: "h2",
|
|
@@ -64,13 +68,20 @@ const textVariants = cva("font-sans", {
|
|
|
64
68
|
default: "text-ink",
|
|
65
69
|
secondary: "text-ink-secondary",
|
|
66
70
|
tertiary: "text-ink-tertiary",
|
|
67
|
-
|
|
71
|
+
disabled: "text-ink-disabled",
|
|
72
|
+
// Words in the accent: pulled toward the ink, so they read as text.
|
|
73
|
+
accent: "text-accent-text",
|
|
74
|
+
success: "text-success",
|
|
75
|
+
warning: "text-warning",
|
|
76
|
+
info: "text-info",
|
|
68
77
|
danger: "text-danger",
|
|
69
78
|
},
|
|
70
79
|
size: {
|
|
80
|
+
lead: "text-lead",
|
|
71
81
|
body: "text-body",
|
|
72
82
|
sm: "text-sm",
|
|
73
83
|
caption: "text-caption",
|
|
84
|
+
micro: "text-micro",
|
|
74
85
|
},
|
|
75
86
|
weight: {
|
|
76
87
|
normal: "font-normal",
|
|
@@ -112,7 +123,7 @@ export function Code({
|
|
|
112
123
|
return (
|
|
113
124
|
<code
|
|
114
125
|
className={cn(
|
|
115
|
-
|
|
126
|
+
CODE_CLASSES,
|
|
116
127
|
className,
|
|
117
128
|
)}
|
|
118
129
|
{...props}
|
|
@@ -120,11 +131,12 @@ export function Code({
|
|
|
120
131
|
);
|
|
121
132
|
}
|
|
122
133
|
|
|
123
|
-
|
|
134
|
+
/* One key, as printed on a keyboard. For a combination, use Shortcut. */
|
|
135
|
+
export function Kbd({ className, ...props }: ComponentProps<"kbd">) {
|
|
124
136
|
return (
|
|
125
137
|
<kbd
|
|
126
138
|
className={cn(
|
|
127
|
-
"inline-flex justify-center items-center bg-surface shadow-xs px-1.5 rounded-
|
|
139
|
+
"inline-flex justify-center items-center bg-surface shadow-xs px-1.5 rounded-small min-w-5 h-5 font-sans font-medium text-ink-secondary text-caption",
|
|
128
140
|
className,
|
|
129
141
|
)}
|
|
130
142
|
{...props}
|
|
@@ -132,6 +144,30 @@ export function Kbd({ className, ...props }: ComponentPropsWithoutRef<"kbd">) {
|
|
|
132
144
|
);
|
|
133
145
|
}
|
|
134
146
|
|
|
147
|
+
/* Which platform's keys to show. "other" on the server and in the first render
|
|
148
|
+
after it, so a server-rendered page hydrates cleanly; the right one next. */
|
|
149
|
+
export function usePlatform(): Platform {
|
|
150
|
+
return useSyncExternalStore(noSubscription, platform, () => "other");
|
|
151
|
+
}
|
|
152
|
+
const noSubscription = () => () => {};
|
|
153
|
+
|
|
154
|
+
/* A keyboard shortcut written once ("mod+shift+k") and shown right where it is
|
|
155
|
+
read: ⌘ ⇧ K on a Mac, Ctrl Shift K elsewhere. A screen reader hears the keys by
|
|
156
|
+
name ("Command Shift K"), not the symbols. */
|
|
157
|
+
export function Shortcut({ keys, className }: { keys: string; className?: string }) {
|
|
158
|
+
const on = usePlatform();
|
|
159
|
+
return (
|
|
160
|
+
<span className={cn("inline-flex items-center gap-0.5 align-middle", className)}>
|
|
161
|
+
<span className="sr-only">{speakShortcut(keys, on)}</span>
|
|
162
|
+
{shortcutKeys(keys, on).map((key, i) => (
|
|
163
|
+
<Kbd key={i} aria-hidden>
|
|
164
|
+
{key.shown}
|
|
165
|
+
</Kbd>
|
|
166
|
+
))}
|
|
167
|
+
</span>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
135
171
|
/**
|
|
136
172
|
* Long-form content wrapper. Applies the reading measure plus the
|
|
137
173
|
* vertical rhythm Notion uses between blocks. Wrap raw markdown output
|
|
@@ -152,11 +188,11 @@ export function Prose({
|
|
|
152
188
|
"measure text-ink text-body",
|
|
153
189
|
serif && "font-serif",
|
|
154
190
|
"[&>*+*]:mt-3",
|
|
155
|
-
"[&_p]:text-ink [&_p]:leading-
|
|
156
|
-
"[&_a]:
|
|
191
|
+
"[&_p]:text-ink [&_p]:leading-prose",
|
|
192
|
+
"[&_a]:link",
|
|
157
193
|
"[&_strong]:font-semibold",
|
|
158
194
|
"[&_ul]:list-disc [&_ul]:pl-6 [&_ol]:list-decimal [&_ol]:pl-6",
|
|
159
|
-
"[&_li]:mt-1 [&_li]:leading-
|
|
195
|
+
"[&_li]:mt-1 [&_li]:leading-prose",
|
|
160
196
|
"[&_blockquote]:border-ink/40 [&_blockquote]:pl-4 [&_blockquote]:border-l-2 [&_blockquote]:text-ink",
|
|
161
197
|
"[&_hr]:my-6 [&_hr]:border-hairline",
|
|
162
198
|
className,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import { cn } from "../../lib/utils.ts";
|
|
3
4
|
import { SquarePlay } from "lucide-react";
|
|
4
5
|
import type { ReactNode } from "react";
|
|
5
6
|
import { videoEmbed } from "../../lib/embed.ts";
|
|
@@ -42,12 +43,17 @@ export function VideoBlock({
|
|
|
42
43
|
/>
|
|
43
44
|
) : null;
|
|
44
45
|
return (
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
// min-w-0: in a grid or flex row the player shrinks to the room there is; an
|
|
47
|
+
// iframe's natural width otherwise pushed a phone's page sideways.
|
|
48
|
+
<figure className={cn("w-full min-w-0", className)}>
|
|
49
|
+
{/* The player sits absolutely in a box shaped by aspect-video, so its own
|
|
50
|
+
height cannot feed back into the box's width (with the iframe in flow,
|
|
51
|
+
a 16:9 box took a minimum width from the iframe's height). */}
|
|
52
|
+
<div className="relative bg-surface-sunken rounded-surface w-full overflow-hidden aspect-video">
|
|
47
53
|
<iframe
|
|
48
54
|
src={embed}
|
|
49
55
|
title={title}
|
|
50
|
-
className="size-full"
|
|
56
|
+
className="absolute inset-0 size-full"
|
|
51
57
|
allow="fullscreen; picture-in-picture; encrypted-media"
|
|
52
58
|
sandbox="allow-scripts allow-same-origin allow-presentation allow-popups"
|
|
53
59
|
referrerPolicy="strict-origin-when-cross-origin"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useRef, useState } from "react";
|
|
4
|
+
|
|
5
|
+
// A little longer than the dialog's closing animation.
|
|
6
|
+
const CLOSING_MS = 170;
|
|
7
|
+
|
|
8
|
+
/* For a dialog that only exists while it is open (`{thing && <ThingDialog />}`).
|
|
9
|
+
Unmounting it on close would skip its closing animation, so it first closes,
|
|
10
|
+
then tells its parent once the animation has played. Pass `open` to the Dialog and
|
|
11
|
+
call `dismiss` wherever `onClose` would have gone.
|
|
12
|
+
|
|
13
|
+
From endgame, 2026-12-05. */
|
|
14
|
+
export function useDismiss(onClose: () => void): { open: boolean; dismiss: () => void } {
|
|
15
|
+
const [open, setOpen] = useState(true);
|
|
16
|
+
const done = useRef(false);
|
|
17
|
+
const dismiss = useCallback(() => {
|
|
18
|
+
if (done.current) return;
|
|
19
|
+
done.current = true;
|
|
20
|
+
setOpen(false);
|
|
21
|
+
setTimeout(onClose, CLOSING_MS);
|
|
22
|
+
}, [onClose]);
|
|
23
|
+
return { open, dismiss };
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, type RefObject } from "react";
|
|
4
|
+
|
|
5
|
+
/* Escape, while `active`, does `onEscape` and nothing else: a list closes without
|
|
6
|
+
closing the dialog around it. A Radix dialog listens for Escape on the document as
|
|
7
|
+
the key travels down the tree, before the field hears it, so stopping it in the
|
|
8
|
+
field's own handler is too late; the window hears it first of all. Only keys from
|
|
9
|
+
`target` (an element, or a test of the event's target) count. */
|
|
10
|
+
export function useEscapeFirst(active: boolean, target: RefObject<Element | null> | ((el: EventTarget | null) => boolean), onEscape: () => void) {
|
|
11
|
+
const latest = useRef(onEscape);
|
|
12
|
+
latest.current = onEscape;
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!active) return;
|
|
15
|
+
const onKey = (e: KeyboardEvent) => {
|
|
16
|
+
if (e.key !== "Escape" || e.isComposing) return;
|
|
17
|
+
const ours = typeof target === "function" ? target(e.target) : e.target === target.current;
|
|
18
|
+
if (!ours) return;
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
latest.current();
|
|
21
|
+
};
|
|
22
|
+
window.addEventListener("keydown", onKey, { capture: true });
|
|
23
|
+
return () => window.removeEventListener("keydown", onKey, { capture: true });
|
|
24
|
+
}, [active, target]);
|
|
25
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useSyncExternalStore } from "react";
|
|
4
|
+
|
|
5
|
+
/* Whether a media query matches now, kept up to date as the window changes. False
|
|
6
|
+
on the server and in the first render after it, so a server-rendered page and
|
|
7
|
+
its hydration agree; it settles on the next render. */
|
|
8
|
+
export function useMediaQuery(query: string): boolean {
|
|
9
|
+
return useSyncExternalStore(
|
|
10
|
+
(onChange) => {
|
|
11
|
+
const list = window.matchMedia(query);
|
|
12
|
+
list.addEventListener("change", onChange);
|
|
13
|
+
return () => list.removeEventListener("change", onChange);
|
|
14
|
+
},
|
|
15
|
+
() => window.matchMedia(query).matches,
|
|
16
|
+
() => false,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Narrower than Tailwind's `md` (48rem): where the kit's layouts switch to their phone shape. */
|
|
21
|
+
export const PHONE_QUERY = "(max-width: 47.99rem)";
|
|
22
|
+
|
|
23
|
+
export const useIsPhone = (): boolean => useMediaQuery(PHONE_QUERY);
|
|
@@ -10,7 +10,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
|
|
10
10
|
|
|
11
11
|
Everything goes to the server one request at a time, in the order it was asked
|
|
12
12
|
for, so a move can never overtake the edit before it. Pending saves are flushed
|
|
13
|
-
when the page is hidden. The first failure is kept in `error` and nothing is
|
|
13
|
+
when the page is hidden or closed, at once and as keepalive requests. The first failure is kept in `error` and nothing is
|
|
14
14
|
retried: show it and offer a reload, rather than guess what the server holds. */
|
|
15
15
|
export function useSaveQueue<K>({
|
|
16
16
|
save,
|
|
@@ -29,7 +29,7 @@ export function useSaveQueue<K>({
|
|
|
29
29
|
saver.current = save;
|
|
30
30
|
|
|
31
31
|
const enqueue = useCallback((job: () => Promise<unknown>) => {
|
|
32
|
-
queue.current = queue.current.then(job).catch((err: Error) => setError(err.message));
|
|
32
|
+
queue.current = queue.current.then(job).catch((err: Error) => setError((first) => first ?? err.message));
|
|
33
33
|
}, []);
|
|
34
34
|
|
|
35
35
|
const cancel = useCallback((key: K) => {
|
|
@@ -54,13 +54,25 @@ export function useSaveQueue<K>({
|
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
useEffect(() => {
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
// The page is going (closed, or hidden on a phone, which may be the last
|
|
58
|
+
// signal before the app is killed): pending saves go now, as keepalive
|
|
59
|
+
// requests, not behind one already on its way, which may never finish.
|
|
60
|
+
const sendNow = () => {
|
|
61
|
+
for (const key of [...timers.current.keys()]) {
|
|
62
|
+
cancel(key);
|
|
63
|
+
saver.current(key, { keepalive: true }).catch((err: Error) => setError((first) => first ?? err.message));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const onHidden = () => document.visibilityState === "hidden" && sendNow();
|
|
67
|
+
window.addEventListener("pagehide", sendNow);
|
|
68
|
+
document.addEventListener("visibilitychange", onHidden);
|
|
59
69
|
return () => {
|
|
60
|
-
window.removeEventListener("pagehide",
|
|
61
|
-
|
|
70
|
+
window.removeEventListener("pagehide", sendNow);
|
|
71
|
+
document.removeEventListener("visibilitychange", onHidden);
|
|
72
|
+
// Unmounting within a living page: saved in their turn.
|
|
73
|
+
[...timers.current.keys()].forEach((key) => flush(key));
|
|
62
74
|
};
|
|
63
|
-
}, [flush]);
|
|
75
|
+
}, [flush, cancel]);
|
|
64
76
|
|
|
65
77
|
return { error, enqueue, schedule, flush, cancel };
|
|
66
78
|
}
|