@kujoforall/paper-ui 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +93 -0
- package/LICENSE +21 -0
- package/README.md +295 -2
- package/dist/components/editor/block-text.d.ts +8 -0
- package/dist/components/editor/block-text.d.ts.map +1 -0
- package/dist/components/editor/block-text.js +248 -0
- package/dist/components/editor/block-text.js.map +1 -0
- package/dist/components/editor/blocks.d.ts +33 -0
- package/dist/components/editor/blocks.d.ts.map +1 -0
- package/dist/components/editor/blocks.js +191 -0
- package/dist/components/editor/blocks.js.map +1 -0
- package/dist/components/editor/document-editor.d.ts +27 -0
- package/dist/components/editor/document-editor.d.ts.map +1 -0
- package/dist/components/editor/document-editor.js +42 -0
- package/dist/components/editor/document-editor.js.map +1 -0
- package/dist/components/editor/document-view.d.ts +22 -0
- package/dist/components/editor/document-view.d.ts.map +1 -0
- package/dist/components/editor/document-view.js +110 -0
- package/dist/components/editor/document-view.js.map +1 -0
- package/dist/components/editor/editor-state.d.ts +107 -0
- package/dist/components/editor/editor-state.d.ts.map +1 -0
- package/dist/components/editor/editor-state.js +217 -0
- package/dist/components/editor/editor-state.js.map +1 -0
- 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 +8 -0
- package/dist/components/editor/extensions/spoiler.d.ts.map +1 -0
- package/dist/components/editor/extensions/spoiler.js +36 -0
- package/dist/components/editor/extensions/spoiler.js.map +1 -0
- package/dist/components/editor/index.d.ts +10 -0
- package/dist/components/editor/index.d.ts.map +1 -0
- package/dist/components/editor/index.js +10 -0
- package/dist/components/editor/index.js.map +1 -0
- package/dist/components/editor/kinds.d.ts +99 -0
- package/dist/components/editor/kinds.d.ts.map +1 -0
- package/dist/components/editor/kinds.js +74 -0
- package/dist/components/editor/kinds.js.map +1 -0
- 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/sketch/rough.d.ts +38 -0
- package/dist/components/sketch/rough.d.ts.map +1 -0
- package/dist/components/sketch/rough.js +57 -0
- package/dist/components/sketch/rough.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.d.ts +2 -0
- package/dist/components/ui/accent-picker.d.ts.map +1 -0
- package/dist/components/ui/accent-picker.js +44 -0
- package/dist/components/ui/accent-picker.js.map +1 -0
- package/dist/components/ui/address-field.d.ts +10 -0
- package/dist/components/ui/address-field.d.ts.map +1 -0
- package/dist/components/ui/address-field.js +24 -0
- package/dist/components/ui/address-field.js.map +1 -0
- 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 +26 -0
- package/dist/components/ui/app-shell.d.ts.map +1 -0
- package/dist/components/ui/app-shell.js +71 -0
- package/dist/components/ui/app-shell.js.map +1 -0
- 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 +19 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +62 -0
- package/dist/components/ui/badge.js.map +1 -0
- 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.d.ts +10 -0
- package/dist/components/ui/breadcrumbs.d.ts.map +1 -0
- package/dist/components/ui/breadcrumbs.js +9 -0
- package/dist/components/ui/breadcrumbs.js.map +1 -0
- package/dist/components/ui/button.d.ts +15 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +110 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +5 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +65 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/callout.d.ts +32 -0
- package/dist/components/ui/callout.d.ts.map +1 -0
- package/dist/components/ui/callout.js +40 -0
- package/dist/components/ui/callout.js.map +1 -0
- package/dist/components/ui/card.d.ts +18 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +28 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +11 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +30 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- 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 +18 -0
- package/dist/components/ui/command-menu.d.ts.map +1 -0
- package/dist/components/ui/command-menu.js +49 -0
- package/dist/components/ui/command-menu.js.map +1 -0
- 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 +40 -0
- package/dist/components/ui/date-picker.d.ts.map +1 -0
- package/dist/components/ui/date-picker.js +64 -0
- package/dist/components/ui/date-picker.js.map +1 -0
- package/dist/components/ui/date-time-picker.d.ts +21 -0
- package/dist/components/ui/date-time-picker.d.ts.map +1 -0
- package/dist/components/ui/date-time-picker.js +34 -0
- package/dist/components/ui/date-time-picker.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +21 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +63 -0
- package/dist/components/ui/dialog.js.map +1 -0
- 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 +24 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +65 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/editable-text.d.ts +24 -0
- package/dist/components/ui/editable-text.d.ts.map +1 -0
- package/dist/components/ui/editable-text.js +85 -0
- package/dist/components/ui/editable-text.js.map +1 -0
- 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 +15 -0
- package/dist/components/ui/field-button.d.ts.map +1 -0
- package/dist/components/ui/field-button.js +18 -0
- package/dist/components/ui/field-button.js.map +1 -0
- package/dist/components/ui/file-preview.d.ts +5 -0
- package/dist/components/ui/file-preview.d.ts.map +1 -0
- package/dist/components/ui/file-preview.js +66 -0
- package/dist/components/ui/file-preview.js.map +1 -0
- package/dist/components/ui/file-uploader.d.ts +39 -0
- package/dist/components/ui/file-uploader.d.ts.map +1 -0
- package/dist/components/ui/file-uploader.js +111 -0
- package/dist/components/ui/file-uploader.js.map +1 -0
- 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 +25 -0
- package/dist/components/ui/handle-row.d.ts.map +1 -0
- package/dist/components/ui/handle-row.js +110 -0
- package/dist/components/ui/handle-row.js.map +1 -0
- 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.d.ts +31 -0
- package/dist/components/ui/image-block.d.ts.map +1 -0
- package/dist/components/ui/image-block.js +103 -0
- package/dist/components/ui/image-block.js.map +1 -0
- package/dist/components/ui/image-card.d.ts +17 -0
- package/dist/components/ui/image-card.d.ts.map +1 -0
- package/dist/components/ui/image-card.js +39 -0
- package/dist/components/ui/image-card.js.map +1 -0
- 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 +31 -0
- package/dist/components/ui/image-viewer.d.ts.map +1 -0
- package/dist/components/ui/image-viewer.js +114 -0
- package/dist/components/ui/image-viewer.js.map +1 -0
- package/dist/components/ui/image.d.ts +33 -0
- package/dist/components/ui/image.d.ts.map +1 -0
- package/dist/components/ui/image.js +61 -0
- package/dist/components/ui/image.js.map +1 -0
- package/dist/components/ui/index.d.ts +92 -0
- package/dist/components/ui/index.d.ts.map +1 -0
- package/dist/components/ui/index.js +92 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/components/ui/input.d.ts +75 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +245 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/link-block.d.ts +13 -0
- package/dist/components/ui/link-block.d.ts.map +1 -0
- package/dist/components/ui/link-block.js +21 -0
- package/dist/components/ui/link-block.js.map +1 -0
- 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.d.ts +15 -0
- package/dist/components/ui/mac-card.d.ts.map +1 -0
- package/dist/components/ui/mac-card.js +9 -0
- package/dist/components/ui/mac-card.js.map +1 -0
- 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 +16 -0
- package/dist/components/ui/nav-tree.d.ts.map +1 -0
- package/dist/components/ui/nav-tree.js +41 -0
- package/dist/components/ui/nav-tree.js.map +1 -0
- package/dist/components/ui/page.d.ts +23 -0
- package/dist/components/ui/page.d.ts.map +1 -0
- package/dist/components/ui/page.js +28 -0
- package/dist/components/ui/page.js.map +1 -0
- 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 +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +18 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +19 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +22 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/property.d.ts +11 -0
- package/dist/components/ui/property.d.ts.map +1 -0
- package/dist/components/ui/property.js +18 -0
- package/dist/components/ui/property.js.map +1 -0
- 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 +21 -0
- package/dist/components/ui/segmented.d.ts.map +1 -0
- package/dist/components/ui/segmented.js +12 -0
- package/dist/components/ui/segmented.js.map +1 -0
- package/dist/components/ui/select-menu.d.ts +12 -0
- package/dist/components/ui/select-menu.d.ts.map +1 -0
- package/dist/components/ui/select-menu.js +10 -0
- package/dist/components/ui/select-menu.js.map +1 -0
- package/dist/components/ui/select.d.ts +16 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +45 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/selection-bar.d.ts +12 -0
- package/dist/components/ui/selection-bar.d.ts.map +1 -0
- package/dist/components/ui/selection-bar.js +15 -0
- package/dist/components/ui/selection-bar.js.map +1 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +12 -0
- package/dist/components/ui/separator.js.map +1 -0
- 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 +23 -0
- package/dist/components/ui/spotlight.d.ts.map +1 -0
- package/dist/components/ui/spotlight.js +110 -0
- package/dist/components/ui/spotlight.js.map +1 -0
- package/dist/components/ui/stat-tile.d.ts +8 -0
- package/dist/components/ui/stat-tile.d.ts.map +1 -0
- package/dist/components/ui/stat-tile.js +9 -0
- package/dist/components/ui/stat-tile.js.map +1 -0
- package/dist/components/ui/step-dialog.d.ts +20 -0
- package/dist/components/ui/step-dialog.d.ts.map +1 -0
- package/dist/components/ui/step-dialog.js +36 -0
- package/dist/components/ui/step-dialog.js.map +1 -0
- 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 +16 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +76 -0
- package/dist/components/ui/table.js.map +1 -0
- 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 +16 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -0
- package/dist/components/ui/theme-toggle.js +65 -0
- package/dist/components/ui/theme-toggle.js.map +1 -0
- 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 +47 -0
- package/dist/components/ui/time-picker.d.ts.map +1 -0
- package/dist/components/ui/time-picker.js +141 -0
- package/dist/components/ui/time-picker.js.map +1 -0
- 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 +15 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +32 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- 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 +40 -0
- package/dist/components/ui/typography.d.ts.map +1 -0
- package/dist/components/ui/typography.js +98 -0
- package/dist/components/ui/typography.js.map +1 -0
- package/dist/components/ui/video-block.d.ts +14 -0
- package/dist/components/ui/video-block.d.ts.map +1 -0
- package/dist/components/ui/video-block.js +22 -0
- package/dist/components/ui/video-block.js.map +1 -0
- 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 +13 -0
- package/dist/hooks/use-save-queue.d.ts.map +1 -0
- package/dist/hooks/use-save-queue.js +57 -0
- package/dist/hooks/use-save-queue.js.map +1 -0
- package/dist/hooks/use-selection.d.ts +10 -0
- package/dist/hooks/use-selection.d.ts.map +1 -0
- package/dist/hooks/use-selection.js +52 -0
- package/dist/hooks/use-selection.js.map +1 -0
- package/dist/hooks/use-shared-transition.d.ts +3 -0
- package/dist/hooks/use-shared-transition.d.ts.map +1 -0
- package/dist/hooks/use-shared-transition.js +38 -0
- package/dist/hooks/use-shared-transition.js.map +1 -0
- package/dist/hooks/use-upload-queue.d.ts +22 -0
- package/dist/hooks/use-upload-queue.d.ts.map +1 -0
- package/dist/hooks/use-upload-queue.js +78 -0
- package/dist/hooks/use-upload-queue.js.map +1 -0
- package/dist/lib/accent.d.ts +5 -0
- package/dist/lib/accent.d.ts.map +1 -0
- package/dist/lib/accent.js +10 -0
- package/dist/lib/accent.js.map +1 -0
- package/dist/lib/bento.d.ts +17 -0
- package/dist/lib/bento.d.ts.map +1 -0
- package/dist/lib/bento.js +92 -0
- package/dist/lib/bento.js.map +1 -0
- 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 +30 -0
- package/dist/lib/dates.d.ts.map +1 -0
- package/dist/lib/dates.js +61 -0
- package/dist/lib/dates.js.map +1 -0
- package/dist/lib/document.d.ts +79 -0
- package/dist/lib/document.d.ts.map +1 -0
- package/dist/lib/document.js +11 -0
- package/dist/lib/document.js.map +1 -0
- package/dist/lib/embed.d.ts +14 -0
- package/dist/lib/embed.d.ts.map +1 -0
- package/dist/lib/embed.js +63 -0
- package/dist/lib/embed.js.map +1 -0
- package/dist/lib/files.d.ts +23 -0
- package/dist/lib/files.d.ts.map +1 -0
- package/dist/lib/files.js +69 -0
- package/dist/lib/files.js.map +1 -0
- package/dist/lib/justified.d.ts +50 -0
- package/dist/lib/justified.d.ts.map +1 -0
- package/dist/lib/justified.js +78 -0
- package/dist/lib/justified.js.map +1 -0
- 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 +16 -0
- package/dist/lib/rich-text-dom.d.ts.map +1 -0
- package/dist/lib/rich-text-dom.js +145 -0
- package/dist/lib/rich-text-dom.js.map +1 -0
- package/dist/lib/rich-text.d.ts +15 -0
- package/dist/lib/rich-text.d.ts.map +1 -0
- package/dist/lib/rich-text.js +35 -0
- package/dist/lib/rich-text.js.map +1 -0
- package/dist/lib/spotlight.d.ts +22 -0
- package/dist/lib/spotlight.d.ts.map +1 -0
- package/dist/lib/spotlight.js +66 -0
- package/dist/lib/spotlight.js.map +1 -0
- 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/tree.d.ts +17 -0
- package/dist/lib/tree.d.ts.map +1 -0
- package/dist/lib/tree.js +35 -0
- package/dist/lib/tree.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +24 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/styles/notion.css +817 -0
- package/package.json +129 -5
- package/src/components/editor/block-text.tsx +271 -0
- package/src/components/editor/blocks.tsx +373 -0
- package/src/components/editor/document-editor.tsx +106 -0
- package/src/components/editor/document-view.tsx +205 -0
- package/src/components/editor/editor-state.tsx +298 -0
- package/src/components/editor/extensions/kit-blocks.tsx +452 -0
- package/src/components/editor/extensions/spoiler.tsx +81 -0
- package/src/components/editor/index.ts +10 -0
- package/src/components/editor/kinds.ts +158 -0
- package/src/components/editor/look.tsx +36 -0
- package/src/components/sketch/rough.tsx +90 -0
- package/src/components/three/model-viewer.tsx +514 -0
- package/src/components/ui/accent-picker.tsx +72 -0
- package/src/components/ui/address-field.tsx +57 -0
- 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 +140 -0
- package/src/components/ui/avatar.tsx +106 -0
- package/src/components/ui/badge.tsx +81 -0
- package/src/components/ui/banner.tsx +53 -0
- package/src/components/ui/breadcrumbs.tsx +25 -0
- package/src/components/ui/button.tsx +147 -0
- package/src/components/ui/calendar.tsx +101 -0
- package/src/components/ui/callout.tsx +61 -0
- package/src/components/ui/card.tsx +59 -0
- package/src/components/ui/checkbox.tsx +66 -0
- 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 +102 -0
- 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 +208 -0
- package/src/components/ui/date-time-picker.tsx +123 -0
- package/src/components/ui/dialog.tsx +151 -0
- package/src/components/ui/document-layout.tsx +52 -0
- package/src/components/ui/dropdown-menu.tsx +185 -0
- package/src/components/ui/editable-text.tsx +142 -0
- 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 +70 -0
- package/src/components/ui/file-preview.tsx +80 -0
- package/src/components/ui/file-uploader.tsx +375 -0
- 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 +252 -0
- 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 +238 -0
- package/src/components/ui/image-card.tsx +95 -0
- package/src/components/ui/image-framer.tsx +160 -0
- package/src/components/ui/image-viewer.tsx +230 -0
- package/src/components/ui/image.tsx +200 -0
- package/src/components/ui/index.ts +178 -0
- package/src/components/ui/input.tsx +471 -0
- package/src/components/ui/link-block.tsx +85 -0
- package/src/components/ui/list-detail.tsx +115 -0
- package/src/components/ui/listbox.ts +26 -0
- package/src/components/ui/mac-card.tsx +46 -0
- 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 +92 -0
- package/src/components/ui/page.tsx +73 -0
- package/src/components/ui/pagination.tsx +143 -0
- package/src/components/ui/picker-panel.tsx +69 -0
- package/src/components/ui/popover.tsx +42 -0
- package/src/components/ui/progress.tsx +76 -0
- package/src/components/ui/property.tsx +33 -0
- 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 +74 -0
- package/src/components/ui/select-menu.tsx +54 -0
- package/src/components/ui/select.tsx +147 -0
- package/src/components/ui/selection-bar.tsx +50 -0
- package/src/components/ui/separator.tsx +30 -0
- 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 +222 -0
- package/src/components/ui/stat-tile.tsx +25 -0
- package/src/components/ui/step-dialog.tsx +104 -0
- package/src/components/ui/steps-layout.tsx +91 -0
- package/src/components/ui/switch.tsx +55 -0
- package/src/components/ui/table.tsx +99 -0
- package/src/components/ui/tabs.tsx +41 -0
- package/src/components/ui/theme-toggle.tsx +80 -0
- package/src/components/ui/time-list.tsx +106 -0
- package/src/components/ui/time-picker.tsx +344 -0
- package/src/components/ui/toast.tsx +132 -0
- package/src/components/ui/toggle.tsx +76 -0
- package/src/components/ui/tooltip.tsx +78 -0
- package/src/components/ui/top-bar.tsx +118 -0
- package/src/components/ui/typography.tsx +204 -0
- package/src/components/ui/video-block.tsx +66 -0
- 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 +78 -0
- package/src/hooks/use-selection.ts +51 -0
- package/src/hooks/use-shared-transition.ts +40 -0
- package/src/hooks/use-upload-queue.ts +111 -0
- package/src/lib/accent.ts +11 -0
- package/src/lib/bento.ts +87 -0
- package/src/lib/database.ts +322 -0
- package/src/lib/dates.ts +75 -0
- package/src/lib/document.ts +55 -0
- package/src/lib/embed.ts +62 -0
- package/src/lib/files.ts +73 -0
- package/src/lib/justified.ts +106 -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 +138 -0
- package/src/lib/rich-text.ts +50 -0
- package/src/lib/spotlight.ts +78 -0
- package/src/lib/theme.ts +18 -0
- package/src/lib/time.ts +83 -0
- package/src/lib/tree.ts +41 -0
- package/src/lib/utils.ts +25 -0
- package/src/styles/notion.css +817 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4
|
+
import { Check, ChevronRight } from "lucide-react";
|
|
5
|
+
import type { ComponentProps } from "react";
|
|
6
|
+
import { formatShortcut } from "../../lib/keys.ts";
|
|
7
|
+
import { cn } from "../../lib/utils.ts";
|
|
8
|
+
import { usePlatform } from "./typography.tsx";
|
|
9
|
+
|
|
10
|
+
/* The archetypal Notion surface: 6px padding, 4px-radius rows, 28px
|
|
11
|
+
tall, hover = tint. The shadow's 1px ambient ring is what keeps this
|
|
12
|
+
crisp when it opens over a white page. */
|
|
13
|
+
|
|
14
|
+
export const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
15
|
+
export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
16
|
+
export const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
17
|
+
export const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
18
|
+
export const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
19
|
+
|
|
20
|
+
/* Shared with ContextMenu, so the two menus are one look. A menu taller than the
|
|
21
|
+
room there is scrolls inside itself rather than running off the screen. */
|
|
22
|
+
export const menuSurfaceClasses = [
|
|
23
|
+
"z-(--z-overlay) min-w-[11rem] overflow-x-hidden overflow-y-auto overscroll-contain p-1.5",
|
|
24
|
+
"max-h-[var(--radix-dropdown-menu-content-available-height,var(--radix-context-menu-content-available-height,80vh))]",
|
|
25
|
+
"bg-surface-overlay shadow-popover rounded-overlay",
|
|
26
|
+
"data-[state=open]:animate-slide-in data-[state=closed]:animate-fade-out",
|
|
27
|
+
"origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export const menuItemClasses = [
|
|
31
|
+
"relative flex items-center gap-2 cursor-default select-none",
|
|
32
|
+
"h-control-sm px-2 rounded-control text-sm text-ink outline-none",
|
|
33
|
+
"transition-colors duration-(--duration-instant)",
|
|
34
|
+
"data-[highlighted]:bg-tint-hover",
|
|
35
|
+
"data-[disabled]:pointer-events-none data-[disabled]:text-ink-disabled",
|
|
36
|
+
"[&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-ink-tertiary",
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
export function DropdownMenuContent({
|
|
40
|
+
className,
|
|
41
|
+
sideOffset = 6,
|
|
42
|
+
...props
|
|
43
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.Content>) {
|
|
44
|
+
return (
|
|
45
|
+
<DropdownMenuPrimitive.Portal>
|
|
46
|
+
<DropdownMenuPrimitive.Content
|
|
47
|
+
sideOffset={sideOffset}
|
|
48
|
+
className={cn(menuSurfaceClasses, className)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
</DropdownMenuPrimitive.Portal>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface DropdownMenuItemProps
|
|
56
|
+
extends ComponentProps<typeof DropdownMenuPrimitive.Item> {
|
|
57
|
+
danger?: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function DropdownMenuItem({
|
|
61
|
+
className,
|
|
62
|
+
danger,
|
|
63
|
+
...props
|
|
64
|
+
}: DropdownMenuItemProps) {
|
|
65
|
+
return (
|
|
66
|
+
<DropdownMenuPrimitive.Item
|
|
67
|
+
className={cn(
|
|
68
|
+
menuItemClasses,
|
|
69
|
+
danger &&
|
|
70
|
+
"text-danger data-[highlighted]:bg-danger-tint [&_svg]:text-danger",
|
|
71
|
+
className,
|
|
72
|
+
)}
|
|
73
|
+
{...props}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function DropdownMenuCheckboxItem({
|
|
79
|
+
className,
|
|
80
|
+
children,
|
|
81
|
+
...props
|
|
82
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
|
|
83
|
+
return (
|
|
84
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
85
|
+
className={cn(menuItemClasses, "pl-7", className)}
|
|
86
|
+
{...props}
|
|
87
|
+
>
|
|
88
|
+
<span className="left-2 absolute flex justify-center items-center size-4">
|
|
89
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
90
|
+
<Check className="size-3.5 !text-ink" />
|
|
91
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
92
|
+
</span>
|
|
93
|
+
{children}
|
|
94
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function DropdownMenuRadioItem({
|
|
99
|
+
className,
|
|
100
|
+
children,
|
|
101
|
+
...props
|
|
102
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
|
|
103
|
+
return (
|
|
104
|
+
<DropdownMenuPrimitive.RadioItem
|
|
105
|
+
className={cn(menuItemClasses, "pl-7", className)}
|
|
106
|
+
{...props}
|
|
107
|
+
>
|
|
108
|
+
<span className="left-2 absolute flex justify-center items-center size-4">
|
|
109
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
110
|
+
<span className="bg-ink rounded-full size-1.5" />
|
|
111
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
112
|
+
</span>
|
|
113
|
+
{children}
|
|
114
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function DropdownMenuLabel({
|
|
119
|
+
className,
|
|
120
|
+
...props
|
|
121
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.Label>) {
|
|
122
|
+
return (
|
|
123
|
+
<DropdownMenuPrimitive.Label
|
|
124
|
+
className={cn(
|
|
125
|
+
"px-2 pt-1.5 pb-1 font-medium text-ink-tertiary text-caption",
|
|
126
|
+
className,
|
|
127
|
+
)}
|
|
128
|
+
{...props}
|
|
129
|
+
/>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function DropdownMenuSeparator({
|
|
134
|
+
className,
|
|
135
|
+
...props
|
|
136
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
|
137
|
+
return (
|
|
138
|
+
<DropdownMenuPrimitive.Separator
|
|
139
|
+
className={cn("-mx-1.5 my-1.5 bg-hairline h-px", className)}
|
|
140
|
+
{...props}
|
|
141
|
+
/>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* A menu item's shortcut, written once ("mod+d") and shown as the platform has it
|
|
146
|
+
(⌘D, Ctrl+D). It is for the eye: hidden from the item's name, which a screen
|
|
147
|
+
reader reads as the words alone. */
|
|
148
|
+
export function DropdownMenuShortcut({ className, keys, children, ...props }: ComponentProps<"span"> & { keys?: string }) {
|
|
149
|
+
const on = usePlatform();
|
|
150
|
+
return (
|
|
151
|
+
<span aria-hidden className={cn("ml-auto pl-4 text-ink-tertiary text-caption tracking-wide", className)} {...props}>
|
|
152
|
+
{keys ? formatShortcut(keys, on) : children}
|
|
153
|
+
</span>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function DropdownMenuSubTrigger({
|
|
158
|
+
className,
|
|
159
|
+
children,
|
|
160
|
+
...props
|
|
161
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.SubTrigger>) {
|
|
162
|
+
return (
|
|
163
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
164
|
+
className={cn(menuItemClasses, "data-[state=open]:bg-tint-hover", className)}
|
|
165
|
+
{...props}
|
|
166
|
+
>
|
|
167
|
+
{children}
|
|
168
|
+
<ChevronRight className="ml-auto size-3.5" />
|
|
169
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export function DropdownMenuSubContent({
|
|
174
|
+
className,
|
|
175
|
+
...props
|
|
176
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
|
177
|
+
return (
|
|
178
|
+
<DropdownMenuPrimitive.Portal>
|
|
179
|
+
<DropdownMenuPrimitive.SubContent
|
|
180
|
+
className={cn(menuSurfaceClasses, className)}
|
|
181
|
+
{...props}
|
|
182
|
+
/>
|
|
183
|
+
</DropdownMenuPrimitive.Portal>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useLayoutEffect, useRef, useState, type AriaAttributes, type ClipboardEvent, type KeyboardEvent, type MouseEvent } from "react";
|
|
4
|
+
import { isWebUrl } from "../../lib/embed.ts";
|
|
5
|
+
import type { Text } from "../../lib/rich-text.ts";
|
|
6
|
+
import { readSpans, spansToHtml } from "../../lib/rich-text-dom.ts";
|
|
7
|
+
import { cn } from "../../lib/utils.ts";
|
|
8
|
+
import { matchShortcut } from "../../lib/keys.ts";
|
|
9
|
+
|
|
10
|
+
/* Rich text edited in place: bold, italic, strike, code, links and page mentions
|
|
11
|
+
over the span model in lib/rich-text. The browser owns the DOM while the user
|
|
12
|
+
types: the markup is written once per `rev`, and every edit is read back into
|
|
13
|
+
spans. Bump `rev` only when you replace the text from outside (a split, a merge,
|
|
14
|
+
a command), which is when the DOM has to be rewritten.
|
|
15
|
+
|
|
16
|
+
⌘B and ⌘I are the browser's own; ⌘⇧S strikes through. Paste is plain text,
|
|
17
|
+
except a web address: pasted over a selection it links the selection, and
|
|
18
|
+
pasted on its own it arrives as a link. */
|
|
19
|
+
|
|
20
|
+
const escape = (s: string) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
21
|
+
export function EditableText({
|
|
22
|
+
id,
|
|
23
|
+
text,
|
|
24
|
+
rev = 0,
|
|
25
|
+
onChange,
|
|
26
|
+
onKeyDown,
|
|
27
|
+
onLink,
|
|
28
|
+
placeholder,
|
|
29
|
+
alwaysShowPlaceholder,
|
|
30
|
+
label,
|
|
31
|
+
multiline = true,
|
|
32
|
+
onBlur,
|
|
33
|
+
aria,
|
|
34
|
+
className,
|
|
35
|
+
}: {
|
|
36
|
+
// Put on the element as data-text, so it can be found to move focus to it.
|
|
37
|
+
id?: string;
|
|
38
|
+
text: Text;
|
|
39
|
+
rev?: number;
|
|
40
|
+
onChange: (text: Text, el: HTMLElement) => void;
|
|
41
|
+
onKeyDown?: (e: KeyboardEvent<HTMLDivElement>) => void;
|
|
42
|
+
// A click on a link or a page mention. Without it, links open in a new tab and
|
|
43
|
+
// mentions do nothing: wire mentions to your router here.
|
|
44
|
+
onLink?: (link: { href?: string; page?: string }) => void;
|
|
45
|
+
placeholder?: string;
|
|
46
|
+
alwaysShowPlaceholder?: boolean;
|
|
47
|
+
/** Names the field for a screen reader (the placeholder is heard too). */
|
|
48
|
+
label?: string;
|
|
49
|
+
/** Enter makes a new line or block, rather than submitting. */
|
|
50
|
+
multiline?: boolean;
|
|
51
|
+
onBlur?: () => void;
|
|
52
|
+
/** More ARIA for the field: a "/" menu's aria-controls, aria-expanded, aria-activedescendant. */
|
|
53
|
+
aria?: AriaAttributes;
|
|
54
|
+
className?: string;
|
|
55
|
+
}) {
|
|
56
|
+
const el = useRef<HTMLDivElement>(null);
|
|
57
|
+
// The first markup goes through React, so a server-rendered page shows the text.
|
|
58
|
+
// React never writes it again (the string never changes): every later rewrite is
|
|
59
|
+
// done here, on each `rev`. Leaving it to React would skip a rewrite whose markup
|
|
60
|
+
// happens to equal the last one React wrote, though the browser has changed the
|
|
61
|
+
// DOM since (an empty line typed into, then split: both halves kept the text).
|
|
62
|
+
const [initial] = useState(() => ({ __html: spansToHtml(text) }));
|
|
63
|
+
const latest = useRef(text);
|
|
64
|
+
latest.current = text;
|
|
65
|
+
const first = useRef(true);
|
|
66
|
+
useLayoutEffect(() => {
|
|
67
|
+
if (first.current) {
|
|
68
|
+
first.current = false;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (el.current) el.current.innerHTML = spansToHtml(latest.current);
|
|
72
|
+
}, [rev]);
|
|
73
|
+
|
|
74
|
+
const onInput = (el: HTMLDivElement) => {
|
|
75
|
+
// An emptied element keeps a stray <br>, which would defeat :empty and read
|
|
76
|
+
// back as a newline.
|
|
77
|
+
if (el.textContent === "" && !el.querySelector("[data-page]")) el.innerHTML = "";
|
|
78
|
+
onChange(readSpans(el), el);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const onPaste = (e: ClipboardEvent<HTMLDivElement>) => {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
const pasted = e.clipboardData.getData("text/plain");
|
|
84
|
+
const url = pasted.trim();
|
|
85
|
+
if (/^\S+$/.test(url) && isWebUrl(url)) {
|
|
86
|
+
const selection = window.getSelection();
|
|
87
|
+
if (selection && !selection.isCollapsed) document.execCommand("createLink", false, url);
|
|
88
|
+
else document.execCommand("insertHTML", false, `<a href="${escape(url)}">${escape(url)}</a> `);
|
|
89
|
+
onInput(e.currentTarget);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
document.execCommand("insertText", false, pasted);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const onClick = (e: MouseEvent<HTMLDivElement>) => {
|
|
96
|
+
const link = (e.target as Element).closest("a");
|
|
97
|
+
if (!link) return;
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
const target = link.dataset.page ? { page: link.dataset.page } : { href: link.getAttribute("href") ?? undefined };
|
|
100
|
+
if (onLink) onLink(target);
|
|
101
|
+
else if (target.href) window.open(target.href, "_blank", "noreferrer");
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<div
|
|
106
|
+
ref={el}
|
|
107
|
+
data-text={id}
|
|
108
|
+
role="textbox"
|
|
109
|
+
aria-label={label}
|
|
110
|
+
aria-multiline={multiline}
|
|
111
|
+
aria-placeholder={placeholder}
|
|
112
|
+
{...aria}
|
|
113
|
+
contentEditable
|
|
114
|
+
suppressContentEditableWarning
|
|
115
|
+
spellCheck
|
|
116
|
+
data-placeholder={placeholder}
|
|
117
|
+
className={cn(
|
|
118
|
+
// A link the browser inserts (a paste) is styled before the text is redrawn.
|
|
119
|
+
"min-w-0 break-words whitespace-pre-wrap outline-none [&_a]:link [&_b]:font-semibold",
|
|
120
|
+
"empty:before:pointer-events-none empty:before:text-ink-tertiary",
|
|
121
|
+
alwaysShowPlaceholder
|
|
122
|
+
? "empty:before:content-[attr(data-placeholder)]"
|
|
123
|
+
: "focus:empty:before:content-[attr(data-placeholder)]",
|
|
124
|
+
className,
|
|
125
|
+
)}
|
|
126
|
+
dangerouslySetInnerHTML={initial}
|
|
127
|
+
onInput={(e) => onInput(e.currentTarget)}
|
|
128
|
+
onKeyDown={(e) => {
|
|
129
|
+
// The model has no underline.
|
|
130
|
+
if (matchShortcut(e, "mod+u")) e.preventDefault();
|
|
131
|
+
if (matchShortcut(e, "mod+shift+s")) {
|
|
132
|
+
e.preventDefault();
|
|
133
|
+
document.execCommand("strikeThrough");
|
|
134
|
+
}
|
|
135
|
+
onKeyDown?.(e);
|
|
136
|
+
}}
|
|
137
|
+
onBlur={onBlur}
|
|
138
|
+
onPaste={onPaste}
|
|
139
|
+
onClick={onClick}
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LucideIcon } from "lucide-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.ts";
|
|
4
|
+
|
|
5
|
+
/* Nothing here yet, said kindly: an icon, a line saying what would be here, a
|
|
6
|
+
sentence on how it gets here, and the one action that starts it. `compact` for
|
|
7
|
+
inside a card, a table or a sidebar; the default for a page. */
|
|
8
|
+
export function EmptyState({
|
|
9
|
+
icon: Icon,
|
|
10
|
+
title,
|
|
11
|
+
description,
|
|
12
|
+
action,
|
|
13
|
+
compact = false,
|
|
14
|
+
className,
|
|
15
|
+
}: {
|
|
16
|
+
icon?: LucideIcon;
|
|
17
|
+
title: ReactNode;
|
|
18
|
+
description?: ReactNode;
|
|
19
|
+
action?: ReactNode;
|
|
20
|
+
compact?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
}) {
|
|
23
|
+
return (
|
|
24
|
+
<div className={cn("flex flex-col items-center mx-auto max-w-sm text-center", compact ? "gap-1.5 py-6" : "gap-2 py-16", className)}>
|
|
25
|
+
{Icon && (
|
|
26
|
+
<span aria-hidden className={cn("flex justify-center items-center bg-tint-hover mb-1 rounded-full text-ink-tertiary", compact ? "size-9 [&>svg]:size-4" : "size-12 [&>svg]:size-5")}>
|
|
27
|
+
<Icon />
|
|
28
|
+
</span>
|
|
29
|
+
)}
|
|
30
|
+
<p className={cn("font-medium text-ink", compact ? "text-sm" : "text-body")}>{title}</p>
|
|
31
|
+
{description && <p className="text-ink-secondary text-sm">{description}</p>}
|
|
32
|
+
{action && <div className="mt-2">{action}</div>}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CircleAlert, FileQuestion, type LucideIcon } from "lucide-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.ts";
|
|
4
|
+
import { EmptyState } from "./empty-state.tsx";
|
|
5
|
+
|
|
6
|
+
/* Something went wrong where content should be: a page that failed to load, a
|
|
7
|
+
panel whose request errored. EmptyState's shape, in the danger ink, with what
|
|
8
|
+
happened, what to do, and usually a "Try again". `detail` is the technical
|
|
9
|
+
message, folded away for whoever needs it. `compact` inside a card or panel. */
|
|
10
|
+
export function ErrorState({
|
|
11
|
+
title = "Something went wrong",
|
|
12
|
+
description = "It may be a moment's trouble. Try again, and if it keeps happening, reload the page.",
|
|
13
|
+
action,
|
|
14
|
+
detail,
|
|
15
|
+
icon = CircleAlert,
|
|
16
|
+
compact = false,
|
|
17
|
+
className,
|
|
18
|
+
}: {
|
|
19
|
+
title?: ReactNode;
|
|
20
|
+
description?: ReactNode;
|
|
21
|
+
action?: ReactNode;
|
|
22
|
+
/** The error's own message, shown under "Details". */
|
|
23
|
+
detail?: string;
|
|
24
|
+
icon?: LucideIcon;
|
|
25
|
+
compact?: boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
}) {
|
|
28
|
+
return (
|
|
29
|
+
<div role="alert" className={cn("[&>div>span:first-child]:bg-danger-tint [&>div>span:first-child]:text-danger", className)}>
|
|
30
|
+
<EmptyState icon={icon} title={title} description={description} compact={compact} action={action} />
|
|
31
|
+
{detail && (
|
|
32
|
+
<details className="mx-auto -mt-8 mb-8 max-w-sm text-caption text-ink-tertiary text-center">
|
|
33
|
+
<summary className="rounded-control cursor-pointer">Details</summary>
|
|
34
|
+
<pre className="bg-surface-sunken mt-2 p-2 rounded-control font-mono text-left whitespace-pre-wrap break-words">{detail}</pre>
|
|
35
|
+
</details>
|
|
36
|
+
)}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* The body of a not-found page: the page's code in quiet large type, a line on
|
|
42
|
+
what happened, and a way home (`action`). Give it a Page or a FocusShell. */
|
|
43
|
+
export function NotFound({
|
|
44
|
+
title = "This page doesn't exist",
|
|
45
|
+
description = "It may have been moved or deleted, or the link may be mistyped.",
|
|
46
|
+
action,
|
|
47
|
+
code = "404",
|
|
48
|
+
className,
|
|
49
|
+
}: {
|
|
50
|
+
title?: ReactNode;
|
|
51
|
+
description?: ReactNode;
|
|
52
|
+
action?: ReactNode;
|
|
53
|
+
code?: ReactNode;
|
|
54
|
+
className?: string;
|
|
55
|
+
}) {
|
|
56
|
+
return (
|
|
57
|
+
<div className={cn("flex flex-col items-center mx-auto py-16 max-w-sm text-center", className)}>
|
|
58
|
+
<FileQuestion aria-hidden className="mb-4 size-10 text-ink-tertiary" strokeWidth={1.5} />
|
|
59
|
+
<p aria-hidden className="tabular-nums font-semibold text-display text-ink-tertiary leading-none">
|
|
60
|
+
{code}
|
|
61
|
+
</p>
|
|
62
|
+
<h1 className="mt-4 font-semibold text-h2 text-balance">{title}</h1>
|
|
63
|
+
<p className="mt-2 text-ink-secondary text-sm">{description}</p>
|
|
64
|
+
{action !== undefined && <div className="flex flex-wrap justify-center gap-2 mt-6">{action}</div>}
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { X, type LucideIcon } from "lucide-react";
|
|
4
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
5
|
+
import { fieldVariants, fromField, useField } from "./input.tsx";
|
|
6
|
+
import { cn } from "../../lib/utils.ts";
|
|
7
|
+
|
|
8
|
+
export interface FieldButtonProps extends Omit<ComponentPropsWithRef<"button">, "children"> {
|
|
9
|
+
icon?: LucideIcon;
|
|
10
|
+
/** What is chosen. Nothing, and the placeholder shows in its place. */
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
/** Supplying this adds the cross that empties the field. */
|
|
14
|
+
onClear?: () => void;
|
|
15
|
+
clearLabel?: string;
|
|
16
|
+
invalid?: boolean;
|
|
17
|
+
size?: "sm" | "md" | "lg";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* A field you press rather than type in: what a picker shows at rest. It is the
|
|
21
|
+
same sunken well as Input, so a row of both reads as one form. The cross sits
|
|
22
|
+
beside the button, not inside it, because a button cannot hold a button. */
|
|
23
|
+
export function FieldButton({
|
|
24
|
+
icon: Icon,
|
|
25
|
+
children,
|
|
26
|
+
placeholder,
|
|
27
|
+
onClear,
|
|
28
|
+
clearLabel = "Clear",
|
|
29
|
+
invalid,
|
|
30
|
+
className,
|
|
31
|
+
disabled,
|
|
32
|
+
size,
|
|
33
|
+
...props
|
|
34
|
+
}: FieldButtonProps) {
|
|
35
|
+
// Inside a Field: its id (so the label names this), description, invalid, disabled.
|
|
36
|
+
const own = fromField(useField(), { ...props, disabled, "aria-invalid": invalid || undefined });
|
|
37
|
+
const empty = children === undefined || children === null || children === "";
|
|
38
|
+
const clearable = onClear !== undefined && !empty && !own.disabled;
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<span className={cn("relative block w-full", className)}>
|
|
42
|
+
<button
|
|
43
|
+
type="button"
|
|
44
|
+
{...own}
|
|
45
|
+
className={cn(
|
|
46
|
+
fieldVariants({ size }),
|
|
47
|
+
"flex items-center gap-2 text-left cursor-pointer",
|
|
48
|
+
// Open, it looks the way a focused input does.
|
|
49
|
+
"data-[state=open]:bg-surface data-[state=open]:shadow-[inset_0_0_0_1px_var(--accent),0_0_0_3px_var(--accent-tint)]",
|
|
50
|
+
clearable && "pr-8",
|
|
51
|
+
)}
|
|
52
|
+
>
|
|
53
|
+
{Icon !== undefined && <Icon className="size-4 shrink-0 text-ink-tertiary" />}
|
|
54
|
+
<span className={cn("min-w-0 flex-1 truncate", empty && "text-ink-placeholder")}>
|
|
55
|
+
{empty ? placeholder : children}
|
|
56
|
+
</span>
|
|
57
|
+
</button>
|
|
58
|
+
{clearable && (
|
|
59
|
+
<button
|
|
60
|
+
type="button"
|
|
61
|
+
aria-label={clearLabel}
|
|
62
|
+
onClick={onClear}
|
|
63
|
+
className="absolute top-1/2 right-1 flex size-6 -translate-y-1/2 items-center justify-center rounded-control text-ink-tertiary transition-colors duration-(--duration-fast) hover:bg-tint-active hover:text-ink"
|
|
64
|
+
>
|
|
65
|
+
<X className="size-3.5" />
|
|
66
|
+
</button>
|
|
67
|
+
)}
|
|
68
|
+
</span>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ImageOff } from "lucide-react";
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { cn } from "../../lib/utils.ts";
|
|
6
|
+
|
|
7
|
+
/* A small picture of an image file that has not been uploaded: for showing
|
|
8
|
+
someone what they picked before anything is sent.
|
|
9
|
+
|
|
10
|
+
A camera's files are tens of megapixels; decoding a folder of them at full
|
|
11
|
+
size would stall the tab. So each is decoded straight to a few hundred
|
|
12
|
+
pixels, two at a time, and only once it is scrolled into view. A file is
|
|
13
|
+
decoded once however many times its preview is shown. */
|
|
14
|
+
|
|
15
|
+
const decoded = new WeakMap<File, Promise<ImageBitmap>>();
|
|
16
|
+
let running = 0;
|
|
17
|
+
const waiting: (() => void)[] = [];
|
|
18
|
+
|
|
19
|
+
function small(file: File): Promise<ImageBitmap> {
|
|
20
|
+
let promise = decoded.get(file);
|
|
21
|
+
if (promise === undefined) {
|
|
22
|
+
promise = (async () => {
|
|
23
|
+
if (running >= 2) await new Promise<void>((resolve) => waiting.push(resolve));
|
|
24
|
+
running += 1;
|
|
25
|
+
try {
|
|
26
|
+
return await createImageBitmap(file, { resizeWidth: 360, resizeQuality: "low" });
|
|
27
|
+
} finally {
|
|
28
|
+
running -= 1;
|
|
29
|
+
waiting.shift()?.();
|
|
30
|
+
}
|
|
31
|
+
})();
|
|
32
|
+
decoded.set(file, promise);
|
|
33
|
+
}
|
|
34
|
+
return promise;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function FilePreview({ file, className }: { file: File | undefined; className?: string }) {
|
|
38
|
+
const canvas = useRef<HTMLCanvasElement>(null);
|
|
39
|
+
const [state, setState] = useState<"waiting" | "shown" | "unreadable">("waiting");
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const el = canvas.current;
|
|
43
|
+
if (el === null || file === undefined) return;
|
|
44
|
+
let cancelled = false;
|
|
45
|
+
const observer = new IntersectionObserver(
|
|
46
|
+
(entries) => {
|
|
47
|
+
if (!entries.some((entry) => entry.isIntersecting)) return;
|
|
48
|
+
observer.disconnect();
|
|
49
|
+
small(file).then(
|
|
50
|
+
(bitmap) => {
|
|
51
|
+
if (cancelled) return;
|
|
52
|
+
el.width = bitmap.width;
|
|
53
|
+
el.height = bitmap.height;
|
|
54
|
+
el.getContext("2d")?.drawImage(bitmap, 0, 0);
|
|
55
|
+
setState("shown");
|
|
56
|
+
},
|
|
57
|
+
// Not an image the browser can read: another type renamed, a damaged file.
|
|
58
|
+
() => !cancelled && setState("unreadable"),
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
{ rootMargin: "200px" },
|
|
62
|
+
);
|
|
63
|
+
observer.observe(el);
|
|
64
|
+
return () => {
|
|
65
|
+
cancelled = true;
|
|
66
|
+
observer.disconnect();
|
|
67
|
+
};
|
|
68
|
+
}, [file]);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<span className={cn("relative block overflow-hidden bg-surface-sunken", className)}>
|
|
72
|
+
<canvas ref={canvas} className={cn("h-full w-full object-cover transition-opacity duration-(--duration-slow)", state === "shown" ? "opacity-100" : "opacity-0")} />
|
|
73
|
+
{(state === "unreadable" || file === undefined) && (
|
|
74
|
+
<span className="absolute inset-0 flex items-center justify-center text-ink-disabled">
|
|
75
|
+
<ImageOff className="size-5" />
|
|
76
|
+
</span>
|
|
77
|
+
)}
|
|
78
|
+
</span>
|
|
79
|
+
);
|
|
80
|
+
}
|