@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
|
@@ -1,23 +1,120 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
DndContext,
|
|
5
|
+
MouseSensor,
|
|
6
|
+
pointerWithin,
|
|
7
|
+
TouchSensor,
|
|
8
|
+
useDraggable,
|
|
9
|
+
useDroppable,
|
|
10
|
+
useSensor,
|
|
11
|
+
useSensors,
|
|
12
|
+
type DragEndEvent,
|
|
13
|
+
type DragMoveEvent,
|
|
14
|
+
type DragStartEvent,
|
|
15
|
+
} from "@dnd-kit/core";
|
|
16
|
+
import { ArrowDown, ArrowUp, GripVertical, Plus } from "lucide-react";
|
|
17
|
+
import { createContext, useContext, useId, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
|
18
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "./dropdown-menu.tsx";
|
|
19
|
+
import { flushSync } from "react-dom";
|
|
6
20
|
import { cn } from "../../lib/utils.ts";
|
|
7
21
|
|
|
8
22
|
const control =
|
|
9
|
-
"flex h-6 items-center justify-center rounded-control text-ink-tertiary transition-colors duration-
|
|
23
|
+
"flex h-6 items-center justify-center rounded-control text-ink-tertiary transition-colors duration-(--duration-fast) hover:bg-tint-hover [&_svg]:size-4";
|
|
10
24
|
|
|
11
25
|
export type DropSide = "before" | "after";
|
|
12
26
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
type RowHandlers = {
|
|
28
|
+
onDragStart?: () => void;
|
|
29
|
+
onDragEnd?: () => void;
|
|
30
|
+
onDragOverSide?: (side: DropSide) => void;
|
|
31
|
+
onDrop?: () => void;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/* The rows of one list (or tree) that can be dragged among each other. Each
|
|
35
|
+
HandleRow inside registers its handlers here, and the drag (dnd-kit's) calls
|
|
36
|
+
them: the row picked up, the half of the row under the pointer, the drop.
|
|
17
37
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
38
|
+
With a mouse a drag starts once the grip has moved 4px, so a click still opens
|
|
39
|
+
the grip's menu. On a touch screen it starts after a short press on the grip,
|
|
40
|
+
so a swipe over the page still scrolls it. The page scrolls on its own near
|
|
41
|
+
its edges while dragging. */
|
|
42
|
+
const Rows = createContext<Map<string, { current: RowHandlers }> | null>(null);
|
|
43
|
+
|
|
44
|
+
export function DragRows({ children }: { children: ReactNode }) {
|
|
45
|
+
const rows = useMemo(() => new Map<string, { current: RowHandlers }>(), []);
|
|
46
|
+
const dragged = useRef<string | null>(null);
|
|
47
|
+
const lastOver = useRef<{ id: string; side: DropSide } | null>(null);
|
|
48
|
+
const sensors = useSensors(
|
|
49
|
+
useSensor(MouseSensor, { activationConstraint: { distance: 4 } }),
|
|
50
|
+
useSensor(TouchSensor, { activationConstraint: { delay: 220, tolerance: 6 } }),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const pointerY = (e: DragMoveEvent | DragEndEvent) => {
|
|
54
|
+
const start = e.activatorEvent as MouseEvent | TouchEvent;
|
|
55
|
+
const y = "touches" in start ? (start.touches[0]?.clientY ?? 0) : start.clientY;
|
|
56
|
+
return y + e.delta.y;
|
|
57
|
+
};
|
|
58
|
+
const onMove = (e: DragMoveEvent) => {
|
|
59
|
+
const over = e.over;
|
|
60
|
+
if (!over || over.id === dragged.current) return;
|
|
61
|
+
const side: DropSide = pointerY(e) < over.rect.top + over.rect.height / 2 ? "before" : "after";
|
|
62
|
+
const id = String(over.id);
|
|
63
|
+
if (lastOver.current?.id === id && lastOver.current.side === side) return;
|
|
64
|
+
lastOver.current = { id, side };
|
|
65
|
+
rows.get(id)?.current.onDragOverSide?.(side);
|
|
66
|
+
};
|
|
67
|
+
const finish = (e: DragEndEvent | null) => {
|
|
68
|
+
const from = dragged.current;
|
|
69
|
+
if (e?.over && String(e.over.id) !== from) {
|
|
70
|
+
// Where the pointer let go decides, even after a flick too quick for a
|
|
71
|
+
// move to be reported: the owner hears that side, rendered, then the drop.
|
|
72
|
+
const id = String(e.over.id);
|
|
73
|
+
const side: DropSide = pointerY(e) < e.over.rect.top + e.over.rect.height / 2 ? "before" : "after";
|
|
74
|
+
if (lastOver.current?.id !== id || lastOver.current.side !== side) flushSync(() => rows.get(id)?.current.onDragOverSide?.(side));
|
|
75
|
+
rows.get(id)?.current.onDrop?.();
|
|
76
|
+
}
|
|
77
|
+
if (from) rows.get(from)?.current.onDragEnd?.();
|
|
78
|
+
dragged.current = null;
|
|
79
|
+
lastOver.current = null;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<Rows.Provider value={rows}>
|
|
84
|
+
<DndContext
|
|
85
|
+
sensors={sensors}
|
|
86
|
+
// The row under the pointer is the target: what a person aims with, not
|
|
87
|
+
// the overlap of the small grip being carried.
|
|
88
|
+
collisionDetection={pointerWithin}
|
|
89
|
+
onDragStart={(e: DragStartEvent) => {
|
|
90
|
+
dragged.current = String(e.active.id);
|
|
91
|
+
rows.get(dragged.current)?.current.onDragStart?.();
|
|
92
|
+
}}
|
|
93
|
+
onDragMove={onMove}
|
|
94
|
+
onDragOver={onMove}
|
|
95
|
+
onDragEnd={finish}
|
|
96
|
+
onDragCancel={() => finish(null)}
|
|
97
|
+
accessibility={{ screenReaderInstructions: { draggable: "Press the grip for options, including Move up and Move down." } }}
|
|
98
|
+
>
|
|
99
|
+
{children}
|
|
100
|
+
</DndContext>
|
|
101
|
+
</Rows.Provider>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* A row with Notion's two margin controls to its left, shown on hover: "+" to add
|
|
106
|
+
below, and a grip that drags the row and, pressed, opens its menu. Together they
|
|
107
|
+
are 46px wide, so whatever holds the row leaves that much room to its left
|
|
108
|
+
(DocumentEditor's gutter is 3rem).
|
|
109
|
+
|
|
110
|
+
On a screen that cannot hover, the grip alone shows on the row being edited or
|
|
111
|
+
selected (`selected`), small enough for a phone's margin; the menu it opens
|
|
112
|
+
holds everything + does and more.
|
|
113
|
+
|
|
114
|
+
Dragging needs a DragRows around the rows; the row reports which half the
|
|
115
|
+
pointer is over, the owner decides what a drop means and tells the row where to
|
|
116
|
+
draw the line (`drop`). From the keyboard, the grip's menu has Move up and Move
|
|
117
|
+
down (`onMove`).
|
|
21
118
|
|
|
22
119
|
Nest rows as siblings, not inside one another: put a row's children after this
|
|
23
120
|
element, or hovering a child lights up its parent's controls too. */
|
|
@@ -26,6 +123,8 @@ export function HandleRow({
|
|
|
26
123
|
className,
|
|
27
124
|
onAdd,
|
|
28
125
|
menu,
|
|
126
|
+
onMove,
|
|
127
|
+
selected = false,
|
|
29
128
|
dragging,
|
|
30
129
|
onDragStart,
|
|
31
130
|
onDragEnd,
|
|
@@ -38,6 +137,10 @@ export function HandleRow({
|
|
|
38
137
|
onAdd?: () => void;
|
|
39
138
|
// DropdownMenuItem elements for the grip's menu.
|
|
40
139
|
menu?: ReactNode;
|
|
140
|
+
/** Moves the row one place, from the grip's menu; give `null` for a direction it cannot go. */
|
|
141
|
+
onMove?: { up: (() => void) | null; down: (() => void) | null };
|
|
142
|
+
/** The row is the one being edited or selected: on a touch screen, its grip shows. */
|
|
143
|
+
selected?: boolean;
|
|
41
144
|
// True while any row is being dragged, so this one accepts the drop.
|
|
42
145
|
dragging?: boolean;
|
|
43
146
|
onDragStart?: () => void;
|
|
@@ -47,33 +150,42 @@ export function HandleRow({
|
|
|
47
150
|
// Where to draw the drop line on this row, if at all.
|
|
48
151
|
drop?: DropSide | null;
|
|
49
152
|
}) {
|
|
50
|
-
const row = useRef<HTMLDivElement>(null);
|
|
51
153
|
const [open, setOpen] = useState(false);
|
|
154
|
+
const grip = useRef<HTMLButtonElement>(null);
|
|
155
|
+
const id = useId();
|
|
156
|
+
const rows = useContext(Rows);
|
|
157
|
+
const handlers = useRef<RowHandlers>({});
|
|
158
|
+
handlers.current = { onDragStart, onDragEnd, onDragOverSide: dragging === false ? undefined : onDragOverSide, onDrop };
|
|
159
|
+
useLayoutEffect(() => {
|
|
160
|
+
if (!rows) return;
|
|
161
|
+
rows.set(id, handlers);
|
|
162
|
+
return () => void rows.delete(id);
|
|
163
|
+
}, [rows, id]);
|
|
164
|
+
|
|
165
|
+
const canDrag = rows !== null && onDragStart !== undefined;
|
|
166
|
+
const draggable = useDraggable({ id, disabled: !canDrag });
|
|
167
|
+
const droppable = useDroppable({ id, disabled: rows === null });
|
|
168
|
+
const hasMenu = menu !== undefined || onMove !== undefined;
|
|
52
169
|
|
|
53
170
|
return (
|
|
54
171
|
<div
|
|
55
|
-
ref={
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
e.preventDefault();
|
|
60
|
-
e.stopPropagation();
|
|
61
|
-
const box = e.currentTarget.getBoundingClientRect();
|
|
62
|
-
onDragOverSide?.(e.clientY < box.top + box.height / 2 ? "before" : "after");
|
|
63
|
-
}}
|
|
64
|
-
onDrop={(e) => {
|
|
65
|
-
e.preventDefault();
|
|
66
|
-
e.stopPropagation();
|
|
67
|
-
onDrop?.();
|
|
68
|
-
}}
|
|
172
|
+
ref={droppable.setNodeRef}
|
|
173
|
+
data-selected={selected || undefined}
|
|
174
|
+
data-dragged={draggable.isDragging || undefined}
|
|
175
|
+
className={cn("group/row relative transition-opacity duration-(--duration-fast) data-dragged:opacity-40", className)}
|
|
69
176
|
>
|
|
70
177
|
<div
|
|
71
178
|
contentEditable={false}
|
|
72
179
|
data-open={open}
|
|
73
|
-
className=
|
|
180
|
+
className={cn(
|
|
181
|
+
"absolute top-0 right-full flex h-[calc(1lh+6px)] items-center pr-1 opacity-0 transition-opacity duration-(--duration-fast)",
|
|
182
|
+
"group-hover/row:opacity-100 focus-within:opacity-100 data-[open=true]:opacity-100",
|
|
183
|
+
// No hover: the grip shows on the row being edited or selected.
|
|
184
|
+
"[@media(hover:none)]:pr-0.5 [@media(hover:none)]:group-focus-within/row:opacity-100 [@media(hover:none)]:group-data-selected/row:opacity-100",
|
|
185
|
+
)}
|
|
74
186
|
>
|
|
75
187
|
{onAdd && (
|
|
76
|
-
<button type="button" aria-label="Add below" className={cn(control, "w-6")} onClick={onAdd}>
|
|
188
|
+
<button type="button" aria-label="Add below" className={cn(control, "w-6 [@media(hover:none)]:hidden")} onClick={onAdd}>
|
|
77
189
|
<Plus />
|
|
78
190
|
</button>
|
|
79
191
|
)}
|
|
@@ -84,22 +196,46 @@ export function HandleRow({
|
|
|
84
196
|
<span className="pointer-events-none absolute inset-y-0 right-1 w-[18px]" />
|
|
85
197
|
</DropdownMenuTrigger>
|
|
86
198
|
<button
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
className={cn(control, "w-[18px] cursor-grab active:cursor-grabbing")}
|
|
91
|
-
onClick={() => menu && setOpen(true)}
|
|
92
|
-
onDragStart={(e) => {
|
|
93
|
-
e.dataTransfer.effectAllowed = "move";
|
|
94
|
-
e.dataTransfer.setData("text/plain", "row");
|
|
95
|
-
if (row.current) e.dataTransfer.setDragImage(row.current, 0, 0);
|
|
96
|
-
onDragStart?.();
|
|
199
|
+
ref={(el) => {
|
|
200
|
+
grip.current = el;
|
|
201
|
+
draggable.setNodeRef(el);
|
|
97
202
|
}}
|
|
98
|
-
|
|
203
|
+
type="button"
|
|
204
|
+
{...(canDrag ? draggable.listeners : null)}
|
|
205
|
+
// The button keeps its own role and name; dnd-kit's describe the drag.
|
|
206
|
+
aria-describedby={canDrag ? draggable.attributes["aria-describedby"] : undefined}
|
|
207
|
+
aria-label={hasMenu ? (canDrag ? "Drag to move, or press for options" : "Options") : "Drag to move"}
|
|
208
|
+
aria-haspopup={hasMenu ? "menu" : undefined}
|
|
209
|
+
aria-expanded={hasMenu ? open : undefined}
|
|
210
|
+
className={cn(control, "w-[18px] touch-none", canDrag && "cursor-grab active:cursor-grabbing")}
|
|
211
|
+
onClick={() => hasMenu && setOpen(true)}
|
|
99
212
|
>
|
|
100
213
|
<GripVertical />
|
|
101
214
|
</button>
|
|
102
|
-
{
|
|
215
|
+
{hasMenu && (
|
|
216
|
+
<DropdownMenuContent
|
|
217
|
+
align="start"
|
|
218
|
+
// Back to the grip that opened it: the menu's own trigger is a
|
|
219
|
+
// stand-in that cannot take focus, which would drop it to the page.
|
|
220
|
+
onCloseAutoFocus={(e) => {
|
|
221
|
+
e.preventDefault();
|
|
222
|
+
grip.current?.focus();
|
|
223
|
+
}}
|
|
224
|
+
>
|
|
225
|
+
{onMove && (
|
|
226
|
+
<>
|
|
227
|
+
<DropdownMenuItem disabled={!onMove.up} onSelect={() => onMove.up?.()}>
|
|
228
|
+
<ArrowUp /> Move up
|
|
229
|
+
</DropdownMenuItem>
|
|
230
|
+
<DropdownMenuItem disabled={!onMove.down} onSelect={() => onMove.down?.()}>
|
|
231
|
+
<ArrowDown /> Move down
|
|
232
|
+
</DropdownMenuItem>
|
|
233
|
+
{menu !== undefined && <DropdownMenuSeparator />}
|
|
234
|
+
</>
|
|
235
|
+
)}
|
|
236
|
+
{menu}
|
|
237
|
+
</DropdownMenuContent>
|
|
238
|
+
)}
|
|
103
239
|
</DropdownMenu>
|
|
104
240
|
</div>
|
|
105
241
|
{drop && (
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../lib/utils.ts";
|
|
3
|
+
|
|
4
|
+
/* The bar at the top of a page: what it is on the left (a sidebar's trigger,
|
|
5
|
+
breadcrumbs, a title), its actions on the right. Sticky, 2.75rem tall (the
|
|
6
|
+
sidebar's header is the same, so the two line up), on the page's surface. Inside
|
|
7
|
+
an inset sidebar it takes the card's rounded corners. */
|
|
8
|
+
export function HeaderBar({ className, children, end, ...props }: ComponentProps<"header"> & { end?: ReactNode }) {
|
|
9
|
+
return (
|
|
10
|
+
<header className={cn("top-0 z-(--z-sticky) sticky flex items-center gap-1 bg-surface px-3 rounded-t-[inherit] h-11 shrink-0", className)} {...props}>
|
|
11
|
+
{children}
|
|
12
|
+
{end !== undefined && <div className="flex items-center gap-1 ml-auto shrink-0">{end}</div>}
|
|
13
|
+
</header>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
4
|
+
import type { ComponentProps } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
|
|
7
|
+
/* A preview of what a link leads to, on hover or keyboard focus: a page's first
|
|
8
|
+
lines, a person's card. It adds to the link and never replaces it, because a
|
|
9
|
+
touch screen never shows it: nothing in it may be the only way to something. */
|
|
10
|
+
|
|
11
|
+
export const HoverCard = HoverCardPrimitive.Root;
|
|
12
|
+
export const HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
13
|
+
|
|
14
|
+
export function HoverCardContent({ className, align = "start", sideOffset = 6, ...props }: ComponentProps<typeof HoverCardPrimitive.Content>) {
|
|
15
|
+
return (
|
|
16
|
+
<HoverCardPrimitive.Portal>
|
|
17
|
+
<HoverCardPrimitive.Content
|
|
18
|
+
align={align}
|
|
19
|
+
sideOffset={sideOffset}
|
|
20
|
+
collisionPadding={8}
|
|
21
|
+
className={cn(
|
|
22
|
+
"z-(--z-overlay) bg-surface-overlay shadow-popover p-4 rounded-overlay w-72 max-w-[calc(100vw-1rem)] outline-none",
|
|
23
|
+
"data-[state=open]:animate-slide-in data-[state=closed]:animate-fade-out origin-[--radix-hover-card-content-transform-origin]",
|
|
24
|
+
className,
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
</HoverCardPrimitive.Portal>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -75,7 +75,7 @@ export function ImageBlock({
|
|
|
75
75
|
<div
|
|
76
76
|
tabIndex={-1}
|
|
77
77
|
className={cn(
|
|
78
|
-
"flex flex-col gap-3 rounded-surface bg-tint-hover p-4 text-sm text-ink-secondary transition-shadow duration-
|
|
78
|
+
"flex flex-col gap-3 rounded-surface bg-tint-hover p-4 text-sm text-ink-secondary transition-shadow duration-(--duration-base) outline-none sm:flex-row sm:items-center",
|
|
79
79
|
dropping && "shadow-[0_0_0_2px_var(--accent)]",
|
|
80
80
|
className,
|
|
81
81
|
)}
|
|
@@ -114,7 +114,7 @@ export function ImageBlock({
|
|
|
114
114
|
<button
|
|
115
115
|
type="button"
|
|
116
116
|
onClick={() => input.current?.click()}
|
|
117
|
-
className="flex h-8 shrink-0 items-center gap-2 rounded-control bg-surface px-3 font-medium text-ink shadow-xs transition-colors duration-
|
|
117
|
+
className="flex h-8 shrink-0 items-center gap-2 rounded-control bg-surface px-3 font-medium text-ink shadow-xs transition-colors duration-(--duration-fast) hover:bg-surface-overlay [&_svg]:size-4"
|
|
118
118
|
>
|
|
119
119
|
<ImagePlus />
|
|
120
120
|
Choose a picture
|
|
@@ -208,13 +208,13 @@ export function ImageBlock({
|
|
|
208
208
|
aria-valuetext={`${Math.round(shown * 100)}% of the page`}
|
|
209
209
|
{...drag(side)}
|
|
210
210
|
className={cn(
|
|
211
|
-
"absolute top-1/2 z-10 flex h-16 max-h-[60%] w-3 -translate-y-1/2 cursor-ew-resize touch-none items-center justify-center opacity-0 transition-opacity duration-
|
|
211
|
+
"absolute top-1/2 z-10 flex h-16 max-h-[60%] w-3 -translate-y-1/2 cursor-ew-resize touch-none items-center justify-center opacity-0 transition-opacity duration-(--duration-fast) group-hover/image:opacity-100 focus-visible:opacity-100 max-md:hidden",
|
|
212
212
|
side === -1 ? "left-1" : "right-1",
|
|
213
213
|
dragging !== null && "opacity-100",
|
|
214
214
|
)}
|
|
215
215
|
>
|
|
216
216
|
{/* A pill that reads on any picture: a dark core with a light edge. */}
|
|
217
|
-
<span className="h-full w-1.5 rounded-full bg-
|
|
217
|
+
<span className="h-full w-1.5 rounded-full bg-on-media-strong shadow-[0_0_0_1px_var(--on-media-edge)]" />
|
|
218
218
|
</span>
|
|
219
219
|
);
|
|
220
220
|
|
|
@@ -227,9 +227,9 @@ export function ImageBlock({
|
|
|
227
227
|
<Image src={src} placeholder={placeholder} aspect={aspect} alt={alt} fit="cover" draggable={false} className="w-full" />
|
|
228
228
|
</button>
|
|
229
229
|
{handle(1)}
|
|
230
|
-
{actions && <div className="absolute top-2 right-2 flex gap-1 opacity-0 transition-opacity duration-
|
|
230
|
+
{actions && <div className="absolute top-2 right-2 flex gap-1 opacity-0 transition-opacity duration-(--duration-fast) group-hover/image:opacity-100 focus-within:opacity-100 max-md:opacity-100">{actions}</div>}
|
|
231
231
|
{dragging !== null && (
|
|
232
|
-
<span className="
|
|
232
|
+
<span className="tabular-nums absolute top-2 left-2 rounded-control bg-on-media-strong px-1.5 py-0.5 text-caption text-on-media-ink">{Math.round(dragging * 100)}%</span>
|
|
233
233
|
)}
|
|
234
234
|
</div>
|
|
235
235
|
{caption !== undefined && <figcaption className="mt-1.5 w-full max-w-full text-sm text-ink-secondary" style={{ width: `${shown * 100}%` }}>{caption}</figcaption>}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { Check } from "lucide-react";
|
|
4
4
|
import type { ComponentPropsWithoutRef, MouseEvent, ReactNode } from "react";
|
|
5
5
|
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
import { Button } from "./button.tsx";
|
|
6
7
|
|
|
7
8
|
/* A picture as a card: the image is the whole card, and anything else sits on
|
|
8
9
|
top of it in a corner. Rounded, with a slight dim on hover.
|
|
@@ -35,9 +36,10 @@ export function ImageCard({
|
|
|
35
36
|
return (
|
|
36
37
|
<div
|
|
37
38
|
className={cn(
|
|
38
|
-
"group relative overflow-hidden rounded-
|
|
39
|
+
"group relative overflow-hidden rounded-overlay bg-surface-sunken transition-[scale,box-shadow] duration-(--duration-base) ease-out-notion",
|
|
39
40
|
"[&_img]:transition-[filter,opacity,scale] hover:[&_img]:brightness-[0.94]",
|
|
40
41
|
selecting && selected && "scale-[0.94] shadow-[0_0_0_3px_var(--accent)]",
|
|
42
|
+
selecting && !selected && "shadow-[0_0_0_0px_var(--accent)]",
|
|
41
43
|
className,
|
|
42
44
|
)}
|
|
43
45
|
// Capture, so the press never reaches a link or button inside.
|
|
@@ -54,17 +56,19 @@ export function ImageCard({
|
|
|
54
56
|
{...props}
|
|
55
57
|
>
|
|
56
58
|
{children}
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
{/* Always drawn, so it can ease in when picking starts and out when it ends,
|
|
60
|
+
rather than appear and vanish. The tick itself grows in when picked. */}
|
|
61
|
+
<span
|
|
62
|
+
aria-hidden
|
|
63
|
+
className={cn(
|
|
64
|
+
"pointer-events-none absolute top-2 left-2 z-10 flex size-6 items-center justify-center rounded-full shadow-sm",
|
|
65
|
+
"transition-[opacity,scale,background-color] duration-(--duration-base) ease-out-notion",
|
|
66
|
+
selecting ? "opacity-100 scale-100" : "opacity-0 scale-50",
|
|
67
|
+
selected ? "bg-accent-solid text-accent-ink" : "bg-on-media-edge text-transparent backdrop-blur-sm",
|
|
68
|
+
)}
|
|
69
|
+
>
|
|
70
|
+
<Check className={cn("size-4 transition-[scale] duration-(--duration-base) ease-out-notion", selected ? "scale-100" : "scale-0")} />
|
|
71
|
+
</span>
|
|
68
72
|
{bottomLeft !== undefined && <div className="pointer-events-none absolute bottom-2 left-2 flex gap-1">{bottomLeft}</div>}
|
|
69
73
|
{topRight !== undefined && !selecting && <div className="absolute top-2 right-2 flex gap-1">{topRight}</div>}
|
|
70
74
|
</div>
|
|
@@ -76,18 +80,7 @@ export function ImageCard({
|
|
|
76
80
|
well as a dark one. Hidden until the card is hovered or it takes focus,
|
|
77
81
|
unless `always` is set (for a state that is on, like a favourite). */
|
|
78
82
|
export function ImageCardButton({ always = false, className, ...props }: ComponentPropsWithoutRef<"button"> & { always?: boolean }) {
|
|
79
|
-
return (
|
|
80
|
-
<button
|
|
81
|
-
type="button"
|
|
82
|
-
className={cn(
|
|
83
|
-
"flex size-7 items-center justify-center rounded-full bg-black/35 text-white backdrop-blur-sm",
|
|
84
|
-
"transition-[opacity,scale,background-color] duration-100 hover:bg-black/55 active:scale-90 [&_svg]:size-4",
|
|
85
|
-
!always && "affordance",
|
|
86
|
-
className,
|
|
87
|
-
)}
|
|
88
|
-
{...props}
|
|
89
|
-
/>
|
|
90
|
-
);
|
|
83
|
+
return <Button variant="on-media" size="icon-sm" className={cn("[&_svg]:size-4", !always && "affordance", className)} {...props} />;
|
|
91
84
|
}
|
|
92
85
|
|
|
93
86
|
/* A marker on top of a picture that is always shown: a fact about it that
|
|
@@ -95,7 +88,7 @@ export function ImageCardButton({ always = false, className, ...props }: Compone
|
|
|
95
88
|
export function ImageCardBadge({ className, ...props }: ComponentPropsWithoutRef<"span">) {
|
|
96
89
|
return (
|
|
97
90
|
<span
|
|
98
|
-
className={cn("flex size-6 items-center justify-center rounded-full bg-
|
|
91
|
+
className={cn("flex size-6 items-center justify-center rounded-full bg-on-media text-on-media-ink backdrop-blur-sm [&_svg]:size-3.5", className)}
|
|
99
92
|
{...props}
|
|
100
93
|
/>
|
|
101
94
|
);
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Minus, Move, Plus } from "lucide-react";
|
|
4
|
+
import { useRef, useState, type KeyboardEvent, type PointerEvent } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
import { Button } from "./button.tsx";
|
|
7
|
+
import { focusStyle, ratioOf, type ImageFocus, type ImageRatio } from "./image.tsx";
|
|
8
|
+
|
|
9
|
+
/* Choosing which part of a picture shows when its shape is not the frame's: a
|
|
10
|
+
portrait shown square, a wide photo as a tall card. The picture fills the frame
|
|
11
|
+
(`ratio`) and is dragged within it, by mouse or finger, or moved with the arrow
|
|
12
|
+
keys (Shift for bigger steps); the zoom goes in steps, 1× to 3×, with its
|
|
13
|
+
buttons or + and −. A rule-of-thirds grid shows while it moves.
|
|
14
|
+
|
|
15
|
+
It hands back `{ x, y, zoom }`: x and y from 0 to 1 across and down, the point
|
|
16
|
+
kept in view. Give the same to Image's `focus` and it shows exactly this. */
|
|
17
|
+
|
|
18
|
+
export const ZOOMS = [1, 1.5, 2, 3] as const;
|
|
19
|
+
|
|
20
|
+
/** Keeps a focus within 0 and 1, and its zoom one of the steps. */
|
|
21
|
+
export function clampFocus(focus: ImageFocus): Required<ImageFocus> {
|
|
22
|
+
const zoom = ZOOMS.reduce((best, z) => (Math.abs(z - (focus.zoom ?? 1)) < Math.abs(best - (focus.zoom ?? 1)) ? z : best), 1 as number);
|
|
23
|
+
return { x: Math.min(1, Math.max(0, focus.x)), y: Math.min(1, Math.max(0, focus.y)), zoom };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* How far the focus moves for a drag of (dx, dy) pixels. A covering picture overflows
|
|
27
|
+
the frame along one axis (more with zoom); dragging by the whole overflow moves the
|
|
28
|
+
focus from one edge to the other. Dragging right shows more of the left, so the
|
|
29
|
+
focus moves the other way. With no overflow on an axis, that axis does not move. */
|
|
30
|
+
export function dragFocus(
|
|
31
|
+
focus: Required<ImageFocus>,
|
|
32
|
+
drag: { dx: number; dy: number },
|
|
33
|
+
frame: { width: number; height: number },
|
|
34
|
+
natural: { width: number; height: number },
|
|
35
|
+
): Required<ImageFocus> {
|
|
36
|
+
const cover = Math.max(frame.width / natural.width, frame.height / natural.height);
|
|
37
|
+
const overflowX = natural.width * cover * focus.zoom - frame.width;
|
|
38
|
+
const overflowY = natural.height * cover * focus.zoom - frame.height;
|
|
39
|
+
return clampFocus({
|
|
40
|
+
x: overflowX > 0.5 ? focus.x - drag.dx / overflowX : focus.x,
|
|
41
|
+
y: overflowY > 0.5 ? focus.y - drag.dy / overflowY : focus.y,
|
|
42
|
+
zoom: focus.zoom,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function ImageFramer({
|
|
47
|
+
src,
|
|
48
|
+
alt,
|
|
49
|
+
ratio = "square",
|
|
50
|
+
value,
|
|
51
|
+
onChange,
|
|
52
|
+
className,
|
|
53
|
+
}: {
|
|
54
|
+
src: string;
|
|
55
|
+
alt: string;
|
|
56
|
+
/** The shape it will be shown in. */
|
|
57
|
+
ratio?: ImageRatio;
|
|
58
|
+
value: ImageFocus;
|
|
59
|
+
onChange: (focus: Required<ImageFocus>) => void;
|
|
60
|
+
className?: string;
|
|
61
|
+
}) {
|
|
62
|
+
const focus = clampFocus(value);
|
|
63
|
+
const frame = useRef<HTMLDivElement>(null);
|
|
64
|
+
const img = useRef<HTMLImageElement>(null);
|
|
65
|
+
const drag = useRef<{ x: number; y: number; start: Required<ImageFocus> } | null>(null);
|
|
66
|
+
const [moving, setMoving] = useState(false);
|
|
67
|
+
|
|
68
|
+
const measure = () => {
|
|
69
|
+
const f = frame.current?.getBoundingClientRect();
|
|
70
|
+
const i = img.current;
|
|
71
|
+
if (!f || !i || !i.naturalWidth) return null;
|
|
72
|
+
return { frame: { width: f.width, height: f.height }, natural: { width: i.naturalWidth, height: i.naturalHeight } };
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const onPointerDown = (e: PointerEvent<HTMLDivElement>) => {
|
|
76
|
+
if (e.button !== 0) return;
|
|
77
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
78
|
+
drag.current = { x: e.clientX, y: e.clientY, start: focus };
|
|
79
|
+
setMoving(true);
|
|
80
|
+
};
|
|
81
|
+
const onPointerMove = (e: PointerEvent<HTMLDivElement>) => {
|
|
82
|
+
const d = drag.current;
|
|
83
|
+
const m = measure();
|
|
84
|
+
if (!d || !m) return;
|
|
85
|
+
onChange(dragFocus(d.start, { dx: e.clientX - d.x, dy: e.clientY - d.y }, m.frame, m.natural));
|
|
86
|
+
};
|
|
87
|
+
const onPointerUp = () => {
|
|
88
|
+
drag.current = null;
|
|
89
|
+
setMoving(false);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const zoomBy = (step: 1 | -1) => {
|
|
93
|
+
const at = ZOOMS.indexOf(focus.zoom as (typeof ZOOMS)[number]);
|
|
94
|
+
onChange({ ...focus, zoom: ZOOMS[Math.min(ZOOMS.length - 1, Math.max(0, at + step))] });
|
|
95
|
+
};
|
|
96
|
+
const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {
|
|
97
|
+
const by = e.shiftKey ? 0.1 : 0.02;
|
|
98
|
+
const moves: Record<string, [number, number]> = { ArrowLeft: [-by, 0], ArrowRight: [by, 0], ArrowUp: [0, -by], ArrowDown: [0, by] };
|
|
99
|
+
if (moves[e.key]) {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
onChange(clampFocus({ ...focus, x: focus.x + moves[e.key][0], y: focus.y + moves[e.key][1] }));
|
|
102
|
+
} else if (e.key === "+" || e.key === "=") {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
zoomBy(1);
|
|
105
|
+
} else if (e.key === "-" || e.key === "_") {
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
zoomBy(-1);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<div className={cn("flex flex-col gap-2", className)}>
|
|
113
|
+
<div
|
|
114
|
+
ref={frame}
|
|
115
|
+
tabIndex={0}
|
|
116
|
+
role="slider"
|
|
117
|
+
aria-label={`Position of ${alt}`}
|
|
118
|
+
aria-roledescription="picture framer"
|
|
119
|
+
aria-valuetext={`${Math.round(focus.x * 100)}% across, ${Math.round(focus.y * 100)}% down, ${focus.zoom}× zoom`}
|
|
120
|
+
aria-keyshortcuts="ArrowLeft ArrowRight ArrowUp ArrowDown + -"
|
|
121
|
+
onPointerDown={onPointerDown}
|
|
122
|
+
onPointerMove={onPointerMove}
|
|
123
|
+
onPointerUp={onPointerUp}
|
|
124
|
+
onPointerCancel={onPointerUp}
|
|
125
|
+
onKeyDown={onKeyDown}
|
|
126
|
+
style={{ aspectRatio: ratioOf(ratio) }}
|
|
127
|
+
className={cn(
|
|
128
|
+
"relative bg-surface-sunken rounded-surface overflow-hidden outline-offset-2 select-none touch-none",
|
|
129
|
+
moving ? "cursor-grabbing" : "cursor-grab",
|
|
130
|
+
)}
|
|
131
|
+
>
|
|
132
|
+
<img ref={img} src={src} alt={alt} draggable={false} style={focusStyle(focus)} className="w-full h-full object-cover pointer-events-none" />
|
|
133
|
+
{/* Rule of thirds, while it moves. */}
|
|
134
|
+
<span aria-hidden className={cn("absolute inset-0 transition-opacity duration-(--duration-fast) pointer-events-none", moving ? "opacity-100" : "opacity-0")}>
|
|
135
|
+
<span className="top-0 bottom-0 left-1/3 absolute bg-on-media-edge w-px" />
|
|
136
|
+
<span className="top-0 bottom-0 left-2/3 absolute bg-on-media-edge w-px" />
|
|
137
|
+
<span className="top-1/3 right-0 left-0 absolute bg-on-media-edge h-px" />
|
|
138
|
+
<span className="top-2/3 right-0 left-0 absolute bg-on-media-edge h-px" />
|
|
139
|
+
</span>
|
|
140
|
+
<span aria-hidden className={cn("bottom-2 left-2 absolute flex items-center gap-1 bg-on-media-strong px-1.5 py-0.5 rounded-control text-caption text-on-media-ink transition-opacity duration-(--duration-fast)", moving && "opacity-0")}>
|
|
141
|
+
<Move className="size-3.5" /> Drag to frame
|
|
142
|
+
</span>
|
|
143
|
+
</div>
|
|
144
|
+
<div className="flex items-center gap-1">
|
|
145
|
+
<Button size="icon-sm" variant="ghost" aria-label="Zoom out" disabled={focus.zoom === ZOOMS[0]} onClick={() => zoomBy(-1)}>
|
|
146
|
+
<Minus />
|
|
147
|
+
</Button>
|
|
148
|
+
<span className="w-10 tabular-nums text-ink-secondary text-sm text-center" aria-live="polite">
|
|
149
|
+
{focus.zoom}×
|
|
150
|
+
</span>
|
|
151
|
+
<Button size="icon-sm" variant="ghost" aria-label="Zoom in" disabled={focus.zoom === ZOOMS[ZOOMS.length - 1]} onClick={() => zoomBy(1)}>
|
|
152
|
+
<Plus />
|
|
153
|
+
</Button>
|
|
154
|
+
<Button size="sm" variant="ghost" className="ml-auto" onClick={() => onChange({ x: 0.5, y: 0.5, zoom: 1 })}>
|
|
155
|
+
Centre
|
|
156
|
+
</Button>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
}
|