@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,201 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronRight, Code2, Lightbulb, ListCollapse, Minus, Plus, Table2 } from "lucide-react";
|
|
4
|
+
import { useId, useLayoutEffect, useRef } from "react";
|
|
5
|
+
import { cn } from "../../../lib/utils.js";
|
|
6
|
+
import { calloutVariants } from "../../ui/callout.js";
|
|
7
|
+
import { CopyButton } from "../../ui/copy-button.js";
|
|
8
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "../../ui/dropdown-menu.js";
|
|
9
|
+
import { SelectMenu } from "../../ui/select-menu.js";
|
|
10
|
+
import { Table, Td, Th } from "../../ui/table.js";
|
|
11
|
+
import { BlockList, BlockRow } from "../blocks.js";
|
|
12
|
+
import { BlockText } from "../block-text.js";
|
|
13
|
+
import { Blocks, Spans } from "../document-view.js";
|
|
14
|
+
import { useEditor } from "../editor-state.js";
|
|
15
|
+
/* The kit's own blocks beyond text, lists and media: toggle, callout, code and a
|
|
16
|
+
simple table. Written as BlockExtensions, from the same parts an app's own
|
|
17
|
+
blocks use, and given to every DocumentEditor and DocumentView. */
|
|
18
|
+
/* ── Toggle ──────────────────────────────────────────────────────────────────
|
|
19
|
+
A line that folds away what is under it. Open or closed is a reader's choice,
|
|
20
|
+
not the document's: it starts open in the editor (to write in) and closed when
|
|
21
|
+
read. Stored as { type: "toggle", text, children }. */
|
|
22
|
+
function ToggleEdit({ block, depth }) {
|
|
23
|
+
const ed = useEditor();
|
|
24
|
+
// Folded in the editor's own state, so the arrows step over what is hidden.
|
|
25
|
+
const open = !ed.folded(block.id);
|
|
26
|
+
const setOpen = (next) => ed.fold(block.id, !next(open));
|
|
27
|
+
const inside = useId();
|
|
28
|
+
return (_jsxs("div", { className: "my-px", children: [_jsx(BlockRow, { block: block, children: _jsxs("div", { className: "flex items-start px-0.5 py-[3px]", children: [_jsx("button", { type: "button", contentEditable: false, "aria-expanded": open, "aria-controls": inside, "aria-label": open ? "Fold" : "Unfold", onClick: () => setOpen((o) => !o), className: "flex justify-center items-center hover:bg-tint-hover rounded-control w-6 h-[1.5em] text-ink-secondary shrink-0", children: _jsx(ChevronRight, { className: cn("size-4 transition-transform duration-(--duration-fast)", open && "rotate-90") }) }), _jsx(BlockText, { block: block, placeholder: "Toggle", alwaysShowPlaceholder: true, className: "flex-1" })] }) }), _jsx("div", { id: inside, hidden: !open, className: "pl-6", children: block.children.length > 0 ? (_jsx(BlockList, { blocks: block.children, depth: depth + 1 })) : (_jsx("button", { type: "button", onClick: () => ed.create(block.id, null, { type: "paragraph", text: [] }, { focus: true }), className: "px-0.5 py-[3px] text-ink-tertiary hover:text-ink-secondary text-sm text-left", children: "Empty. Click to write inside." })) })] }));
|
|
29
|
+
}
|
|
30
|
+
function ToggleView({ block, depth }) {
|
|
31
|
+
const { text = [], children = [] } = block;
|
|
32
|
+
return (_jsxs("details", { className: "group/toggle my-1 [&[open]>summary_svg]:rotate-90", children: [_jsxs("summary", { className: "flex items-start py-0.5 rounded-control cursor-pointer list-none [&::-webkit-details-marker]:hidden", children: [_jsx("span", { "aria-hidden": true, className: "flex justify-center items-center w-6 h-[1.5em] text-ink-secondary shrink-0", children: _jsx(ChevronRight, { className: "size-4 transition-transform duration-(--duration-fast)" }) }), _jsx("span", { className: "flex-1 min-w-0", children: _jsx(Spans, { text: text }) })] }), _jsx("div", { className: "pl-6", children: _jsx(Blocks, { blocks: children, depth: depth + 1 }) })] }));
|
|
33
|
+
}
|
|
34
|
+
export const toggleBlock = {
|
|
35
|
+
type: "toggle",
|
|
36
|
+
kinds: [{ key: "toggle", label: "Toggle", hint: "A line that folds away what is under it", icon: ListCollapse, make: (text) => ({ type: "toggle", text }) }],
|
|
37
|
+
holds: () => true,
|
|
38
|
+
toggle: true,
|
|
39
|
+
Edit: ToggleEdit,
|
|
40
|
+
View: ToggleView,
|
|
41
|
+
};
|
|
42
|
+
/* ── Callout ─────────────────────────────────────────────────────────────────
|
|
43
|
+
A tinted note with an emoji in its gutter: the kit's Callout, written in.
|
|
44
|
+
The emoji and the colour are chosen from a menu on the emoji. Stored as
|
|
45
|
+
{ type: "callout", text, icon, color }. */
|
|
46
|
+
const CALLOUT_ICONS = ["💡", "⚠️", "✅", "📌", "❗", "ℹ️", "🧭", "✈️"];
|
|
47
|
+
const CALLOUT_COLORS = ["gray", "brown", "orange", "yellow", "green", "blue", "purple", "pink", "red"];
|
|
48
|
+
function CalloutEdit({ block }) {
|
|
49
|
+
const ed = useEditor();
|
|
50
|
+
const set = (patch) => ed.edit(block.id, (b) => ({ ...b, ...patch }));
|
|
51
|
+
return (_jsx(BlockRow, { block: block, className: "my-1", children: _jsxs("div", { className: cn(calloutVariants({ color: block.color ?? "gray" }), "py-3"), children: [_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", contentEditable: false, "aria-label": "The callout's icon and colour", className: "flex justify-center items-center hover:bg-tint-active rounded-control size-6 text-body leading-none shrink-0", children: _jsx("span", { "aria-hidden": true, children: block.icon ?? "💡" }) }) }), _jsxs(DropdownMenuContent, { align: "start", children: [_jsx(DropdownMenuLabel, { children: "Icon" }), _jsx("div", { className: "gap-0.5 grid grid-cols-4 px-1 pb-1", children: CALLOUT_ICONS.map((icon) => (_jsx(DropdownMenuItem, { onSelect: () => set({ icon }), className: "justify-center p-0 text-body", "aria-label": `Icon ${icon}`, children: icon }, icon))) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Colour" }), CALLOUT_COLORS.map((color) => (_jsxs(DropdownMenuItem, { onSelect: () => set({ color }), children: [_jsx("span", { "aria-hidden": true, className: cn("rounded-small size-4 shadow-edge", calloutVariants({ color }).split(" ").find((c) => c.startsWith("bg-"))) }), color[0].toUpperCase() + color.slice(1)] }, color)))] })] }), _jsx(BlockText, { block: block, placeholder: "A note worth noticing", alwaysShowPlaceholder: true, className: "flex-1 min-w-0" })] }) }));
|
|
52
|
+
}
|
|
53
|
+
function CalloutView({ block }) {
|
|
54
|
+
const { text = [], icon = "💡", color = "gray" } = block;
|
|
55
|
+
return (_jsxs("div", { role: "note", className: cn(calloutVariants({ color }), "my-4"), children: [_jsx("span", { "aria-hidden": true, className: "text-body leading-snug shrink-0", children: icon }), _jsx("div", { className: "min-w-0", children: _jsx(Spans, { text: text }) })] }));
|
|
56
|
+
}
|
|
57
|
+
export const calloutBlock = {
|
|
58
|
+
type: "callout",
|
|
59
|
+
kinds: [{ key: "callout", label: "Callout", hint: "A note that stands out", icon: Lightbulb, make: (text) => ({ type: "callout", text, icon: "💡", color: "gray" }) }],
|
|
60
|
+
Edit: CalloutEdit,
|
|
61
|
+
View: CalloutView,
|
|
62
|
+
};
|
|
63
|
+
/* ── Code ────────────────────────────────────────────────────────────────────
|
|
64
|
+
Code in a monospace box, with its language named and a copy button. No
|
|
65
|
+
highlighting in v1. Tab indents (two spaces) inside it, so Escape first, then
|
|
66
|
+
Tab, moves on: Escape selects the block. Stored as { type: "code", code,
|
|
67
|
+
language }. */
|
|
68
|
+
const LANGUAGES = ["Plain text", "TypeScript", "JavaScript", "Python", "Go", "Rust", "SQL", "Shell", "JSON", "HTML", "CSS", "YAML", "Markdown"];
|
|
69
|
+
function CodeEdit({ block }) {
|
|
70
|
+
const ed = useEditor();
|
|
71
|
+
const area = useRef(null);
|
|
72
|
+
const code = block.code ?? "";
|
|
73
|
+
// Grows with its lines rather than scrolling inside itself.
|
|
74
|
+
useLayoutEffect(() => {
|
|
75
|
+
const el = area.current;
|
|
76
|
+
if (!el)
|
|
77
|
+
return;
|
|
78
|
+
el.style.height = "auto";
|
|
79
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
80
|
+
}, [code]);
|
|
81
|
+
const write = (next) => ed.edit(block.id, (b) => ({ ...b, code: next }), { typing: true });
|
|
82
|
+
const onKeyDown = (e) => {
|
|
83
|
+
if (e.key === "Escape") {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
ed.select(block.id);
|
|
86
|
+
}
|
|
87
|
+
else if (e.key === "Tab" && !e.metaKey && !e.ctrlKey && !e.altKey) {
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
const el = e.currentTarget;
|
|
90
|
+
const { selectionStart: s, selectionEnd: end } = el;
|
|
91
|
+
const lineStart = (i) => (i === 0 ? 0 : code.lastIndexOf("\n", i - 1) + 1);
|
|
92
|
+
if (!e.shiftKey && s === end) {
|
|
93
|
+
write(code.slice(0, s) + " " + code.slice(end));
|
|
94
|
+
requestAnimationFrame(() => el.setSelectionRange(s + 2, s + 2));
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
// Every line the selection touches (or the caret's line) moves in or out by two spaces.
|
|
98
|
+
const from = lineStart(s);
|
|
99
|
+
const lines = code.slice(from, end).split("\n");
|
|
100
|
+
const shifted = lines.map((line) => (e.shiftKey ? line.replace(/^ {1,2}/, "") : " " + line));
|
|
101
|
+
const firstChange = shifted[0].length - lines[0].length;
|
|
102
|
+
const total = shifted.join("\n").length - lines.join("\n").length;
|
|
103
|
+
if (total === 0)
|
|
104
|
+
return;
|
|
105
|
+
write(code.slice(0, from) + shifted.join("\n") + code.slice(end));
|
|
106
|
+
requestAnimationFrame(() => el.setSelectionRange(Math.max(from, s + firstChange), Math.max(from, end + total)));
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
return (_jsx(BlockRow, { block: block, className: "my-1", children: _jsxs("div", { className: "group/code relative bg-surface-sunken rounded-surface shadow-edge", children: [_jsxs("div", { className: "flex items-center gap-1 px-2 pt-1.5", children: [_jsx(SelectMenu, { label: "Language", value: (block.language ?? "Plain text"), options: LANGUAGES, onChange: (language) => ed.edit(block.id, (b) => ({ ...b, language })), className: "text-caption text-ink-tertiary" }), _jsx(CopyButton, { value: () => code, label: "Copy the code", className: "ml-auto" })] }), _jsx("textarea", { ref: area, "data-code": block.id, "aria-label": `Code, ${block.language ?? "plain text"}`, spellCheck: false, autoCapitalize: "off", autoCorrect: "off", value: code, placeholder: "// Code", rows: 1, onChange: (e) => write(e.target.value), onKeyDown: onKeyDown, className: "block bg-transparent px-4 pt-1 pb-4 outline-none w-full overflow-x-auto font-mono text-ink placeholder:text-ink-tertiary text-sm leading-relaxed whitespace-pre resize-none" })] }) }));
|
|
110
|
+
}
|
|
111
|
+
function CodeView({ block }) {
|
|
112
|
+
const { code = "", language = "Plain text" } = block;
|
|
113
|
+
return (_jsxs("figure", { className: "relative bg-surface-sunken my-4 rounded-surface shadow-edge", children: [_jsxs("figcaption", { className: "flex items-center px-4 pt-2 text-caption text-ink-tertiary", children: [language, _jsx(CopyButton, { value: code, label: "Copy the code", className: "ml-auto -mr-2" })] }), _jsx("pre", { className: "px-4 pt-1 pb-4 overflow-x-auto font-mono text-sm leading-relaxed", tabIndex: 0, children: _jsx("code", { children: code }) })] }));
|
|
114
|
+
}
|
|
115
|
+
export const codeBlock = {
|
|
116
|
+
type: "code",
|
|
117
|
+
kinds: [{ key: "code", label: "Code", hint: "A snippet, in monospace", icon: Code2, make: () => ({ type: "code", code: "", language: "Plain text" }) }],
|
|
118
|
+
shortcuts: { "```": "code" },
|
|
119
|
+
Edit: CodeEdit,
|
|
120
|
+
View: CodeView,
|
|
121
|
+
focus: (element) => {
|
|
122
|
+
const area = element.querySelector("textarea[data-code]");
|
|
123
|
+
area?.focus();
|
|
124
|
+
return area !== null;
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
function TableEdit({ block }) {
|
|
128
|
+
const ed = useEditor();
|
|
129
|
+
const rows = block.rows && block.rows.length > 0 ? block.rows : [["", ""], ["", ""]];
|
|
130
|
+
const header = block.header !== false;
|
|
131
|
+
const box = useRef(null);
|
|
132
|
+
const set = (patch, typing = false) => ed.edit(block.id, (b) => ({ ...b, ...patch }), typing ? { typing: true } : undefined);
|
|
133
|
+
const cols = Math.max(...rows.map((r) => r.length));
|
|
134
|
+
const focusCell = (r, c) => requestAnimationFrame(() => box.current?.querySelector(`[data-cell="${r}-${c}"]`)?.focus());
|
|
135
|
+
const addRow = (at = rows.length) => {
|
|
136
|
+
set({ rows: [...rows.slice(0, at), Array(cols).fill(""), ...rows.slice(at)] });
|
|
137
|
+
focusCell(at, 0);
|
|
138
|
+
};
|
|
139
|
+
const addCol = () => set({ rows: rows.map((r) => [...r, ...Array(cols - r.length + 1).fill("")]) });
|
|
140
|
+
const removeRow = (r) => rows.length > 1 && set({ rows: rows.filter((_, i) => i !== r) });
|
|
141
|
+
const removeCol = (c) => cols > 1 && set({ rows: rows.map((row) => row.filter((_, i) => i !== c)) });
|
|
142
|
+
return (_jsx(BlockRow, { block: block, className: "my-2", children: _jsxs("div", { ref: box, className: "group group/table flex items-start gap-1", children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("div", { className: "overflow-x-auto", children: _jsx("table", { className: "border-collapse w-full text-sm", children: _jsx("tbody", { children: rows.map((row, r) => (_jsx("tr", { children: Array.from({ length: cols }, (_, c) => (_jsx("td", { className: cn("p-0 border border-hairline-strong min-w-28", header && r === 0 && "bg-surface-sunken font-medium"), children: _jsxs("div", { className: "flex items-center", children: [_jsx("input", { "data-cell": `${r}-${c}`, "aria-label": `Row ${r + 1}, column ${c + 1}${header && r === 0 ? ", heading" : ""}`, value: row[c] ?? "", onChange: (e) => {
|
|
143
|
+
const next = rows.map((x) => [...x]);
|
|
144
|
+
next[r][c] = e.target.value;
|
|
145
|
+
set({ rows: next }, true);
|
|
146
|
+
}, onKeyDown: (e) => {
|
|
147
|
+
if (e.key === "Enter" && !e.nativeEvent.isComposing) {
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
if (r === rows.length - 1)
|
|
150
|
+
addRow();
|
|
151
|
+
else
|
|
152
|
+
focusCell(r + 1, c);
|
|
153
|
+
}
|
|
154
|
+
else if (e.key === "Escape") {
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
ed.select(block.id);
|
|
157
|
+
}
|
|
158
|
+
}, className: "flex-1 bg-transparent px-2.25 py-1.75 outline-none focus:bg-accent-tint min-w-0" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": `Row ${r + 1}, column ${c + 1}: options`, className: "mr-0.5 rounded-control size-5 text-ink-tertiary hover:bg-tint-hover affordance", children: _jsx(ChevronRight, { className: "mx-auto size-3.5 rotate-90" }) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { onSelect: () => addRow(r), children: [_jsx(Plus, {}), " Row above"] }), _jsxs(DropdownMenuItem, { onSelect: () => addRow(r + 1), children: [_jsx(Plus, {}), " Row below"] }), _jsxs(DropdownMenuItem, { onSelect: addCol, children: [_jsx(Plus, {}), " Column at the end"] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { disabled: rows.length <= 1, onSelect: () => removeRow(r), children: [_jsx(Minus, {}), " Delete row"] }), _jsxs(DropdownMenuItem, { disabled: cols <= 1, onSelect: () => removeCol(c), children: [_jsx(Minus, {}), " Delete column"] }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: () => set({ header: !header }), children: header ? "First row is plain" : "First row is a header" })] })] })] }) }, c))) }, r))) }) }) }), _jsx("button", { type: "button", onClick: () => addRow(), className: "flex justify-center items-center hover:bg-tint-hover mt-0.5 rounded-control w-full h-5 text-ink-tertiary affordance", "aria-label": "Add a row", children: _jsx(Plus, { className: "size-3.5" }) })] }), _jsx("button", { type: "button", onClick: addCol, className: "flex justify-center items-center hover:bg-tint-hover rounded-control w-5 h-8 text-ink-tertiary affordance", "aria-label": "Add a column", children: _jsx(Plus, { className: "size-3.5" }) })] }) }));
|
|
159
|
+
}
|
|
160
|
+
function TableView({ block }) {
|
|
161
|
+
const { rows = [], header = true } = block;
|
|
162
|
+
if (rows.length === 0)
|
|
163
|
+
return null;
|
|
164
|
+
const cols = Math.max(...rows.map((r) => r.length));
|
|
165
|
+
const [head, ...body] = header ? rows : [null, ...rows];
|
|
166
|
+
return (_jsx("div", { className: "my-4", children: _jsxs(Table, { children: [head && (_jsx("thead", { children: _jsx("tr", { children: Array.from({ length: cols }, (_, c) => (_jsx(Th, { children: head[c] }, c))) }) })), _jsx("tbody", { children: body.map((row, r) => (_jsx("tr", { children: Array.from({ length: cols }, (_, c) => (_jsx(Td, { children: row?.[c] }, c))) }, r))) })] }) }));
|
|
167
|
+
}
|
|
168
|
+
export const tableBlock = {
|
|
169
|
+
type: "table",
|
|
170
|
+
kinds: [
|
|
171
|
+
{
|
|
172
|
+
key: "table",
|
|
173
|
+
label: "Table",
|
|
174
|
+
hint: "Words in rows and columns",
|
|
175
|
+
icon: Table2,
|
|
176
|
+
make: () => ({
|
|
177
|
+
type: "table",
|
|
178
|
+
header: true,
|
|
179
|
+
rows: [
|
|
180
|
+
["", "", ""],
|
|
181
|
+
["", "", ""],
|
|
182
|
+
],
|
|
183
|
+
}),
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
Edit: TableEdit,
|
|
187
|
+
View: TableView,
|
|
188
|
+
focus: (element) => {
|
|
189
|
+
const cell = element.querySelector('[data-cell="0-0"]');
|
|
190
|
+
cell?.focus();
|
|
191
|
+
return cell !== null;
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
/** The kit's own extra blocks, given to every editor and view before an app's. */
|
|
195
|
+
export const KIT_BLOCKS = [toggleBlock, calloutBlock, codeBlock, tableBlock];
|
|
196
|
+
/** An app's extensions with the kit's blocks before them; an app's own block of the same type wins. */
|
|
197
|
+
export const withKitBlocks = (extensions = []) => [
|
|
198
|
+
...KIT_BLOCKS.filter((k) => !extensions.some((x) => x.type === k.type)),
|
|
199
|
+
...extensions,
|
|
200
|
+
];
|
|
201
|
+
//# sourceMappingURL=kit-blocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-blocks.js","sourceRoot":"","sources":["../../../../src/components/editor/extensions/kit-blocks.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACjG,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAsB,MAAM,OAAO,CAAC;AAG3E,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CA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;QACf,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAmB,mBAAmB,CAAC,CAAC;QAC1E,IAAI,EAAE,KAAK,EAAE,CAAC;QACd,OAAO,IAAI,KAAK,IAAI,CAAC;IACzB,CAAC;CACJ,CAAC;AAEF,kFAAkF;AAClF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAE7E,uGAAuG;AACvG,MAAM,CAAC,MAAM,aAAa,GAAG,CAA6B,aAA2B,EAAE,EAAuC,EAAE,CAAC;IAC7H,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;IACvE,GAAG,UAAU;CAChB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AnyBlock } from "../../../lib/document.js";
|
|
2
|
+
import type { Text } from "../../../lib/rich-text.js";
|
|
3
|
+
import type { BlockExtension } from "../kinds.js";
|
|
4
|
+
export declare const spoilerBlock: BlockExtension<{
|
|
5
|
+
text: Text;
|
|
6
|
+
children?: AnyBlock[];
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=spoiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spoiler.d.ts","sourceRoot":"","sources":["../../../../src/components/editor/extensions/spoiler.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAKtD,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAC;AA8DlE,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAA;CAAE,CAS9E,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { EyeOff } from "lucide-react";
|
|
4
|
+
import { BlockList, BlockRow } from "../blocks.js";
|
|
5
|
+
import { BlockText } from "../block-text.js";
|
|
6
|
+
import { Blocks, Spans } from "../document-view.js";
|
|
7
|
+
import { useEditor } from "../editor-state.js";
|
|
8
|
+
/*
|
|
9
|
+
* A spoiler: its own line says what it hides, and the blocks inside it are the
|
|
10
|
+
* spoiler. Written open, read closed until pressed. Built only from what the kit
|
|
11
|
+
* exports to extensions, so it doubles as the example of writing one.
|
|
12
|
+
*
|
|
13
|
+
* Stored as { type: "spoiler", text, children }. It hides text in the interface
|
|
14
|
+
* only: whoever stores a document must keep a spoiler's children out of any
|
|
15
|
+
* summary or excerpt shown beside it.
|
|
16
|
+
*/
|
|
17
|
+
function SpoilerEdit({ block, depth }) {
|
|
18
|
+
const ed = useEditor();
|
|
19
|
+
return (_jsxs("div", { className: "my-1.5 rounded-surface bg-tint-hover/70 py-1 shadow-edge", children: [_jsx(BlockRow, { block: block, children: _jsxs("div", { className: "flex items-start gap-2 px-2.5 py-[3px]", children: [_jsx("span", { contentEditable: false, className: "flex h-[1.5em] shrink-0 items-center text-ink-tertiary select-none", title: "Spoiler: hidden from readers until opened", children: _jsx(EyeOff, { className: "size-4" }) }), _jsx(BlockText, { block: block, placeholder: "Spoiler \u2014 say what it hides, e.g. \u201CThe ending\u201D", alwaysShowPlaceholder: true, className: "flex-1 font-medium" })] }) }), _jsx("div", { className: "pr-2.5 pl-8", children: block.children.length > 0 ? (_jsx(BlockList, { blocks: block.children, depth: depth + 1 })) : (_jsx("button", { type: "button", onClick: () => ed.create(block.id, null, { type: "paragraph", text: [] }, { focus: true }), className: "px-0.5 py-[3px] text-left text-sm text-ink-tertiary hover:text-ink-secondary", children: "Write what it hides" })) })] }));
|
|
20
|
+
}
|
|
21
|
+
function SpoilerView({ block, depth }) {
|
|
22
|
+
// A View receives any block; this one is always a spoiler's shape.
|
|
23
|
+
const { text = [], children = [] } = block;
|
|
24
|
+
return (_jsxs("details", { className: "my-4 [&[open]>summary>[data-when=closed]]:hidden [&:not([open])>summary>[data-when=open]]:hidden rounded-surface bg-tint-hover/70 shadow-edge", children: [_jsxs("summary", { className: "flex cursor-pointer list-none items-center gap-2 px-4 py-3 font-medium select-none [&::-webkit-details-marker]:hidden", children: [_jsx(EyeOff, { className: "size-4 shrink-0 text-ink-tertiary" }), _jsx("span", { className: "min-w-0 flex-1", children: _jsx(Spans, { text: text.length > 0 ? text : [{ text: "Spoiler" }] }) }), _jsx("span", { "data-when": "closed", className: "text-caption font-normal text-ink-tertiary", children: "Spoiler \u00B7 show" }), _jsx("span", { "data-when": "open", className: "text-caption font-normal text-ink-tertiary", children: "Hide" })] }), _jsx("div", { className: "px-4 pb-3", children: _jsx(Blocks, { blocks: children, depth: depth + 1 }) })] }));
|
|
25
|
+
}
|
|
26
|
+
export const spoilerBlock = {
|
|
27
|
+
type: "spoiler",
|
|
28
|
+
kinds: [{ key: "spoiler", label: "Spoiler", hint: "Hidden until a reader opens it", icon: EyeOff, make: (text) => ({ type: "spoiler", text }) }],
|
|
29
|
+
shortcuts: { "!! ": "spoiler" },
|
|
30
|
+
// Anything can be hidden; a spoiler inside a spoiler is allowed but rarely wanted.
|
|
31
|
+
holds: () => true,
|
|
32
|
+
toggle: true,
|
|
33
|
+
Edit: SpoilerEdit,
|
|
34
|
+
View: SpoilerView,
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=spoiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spoiler.js","sourceRoot":"","sources":["../../../../src/components/editor/extensions/spoiler.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM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jB,IAAI,EAAE,WAAW;CACpB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { DocumentEditor, type CheckLink, type DocumentEditorHandle, type ImageExtras, type OnLink, type UploadImage } from "./document-editor.js";
|
|
2
|
+
export { DocumentView, Blocks, Spans, type Density } from "./document-view.js";
|
|
3
|
+
export { spoilerBlock } from "./extensions/spoiler.js";
|
|
4
|
+
export { calloutBlock, codeBlock, KIT_BLOCKS, tableBlock, toggleBlock } from "./extensions/kit-blocks.js";
|
|
5
|
+
export { BlockList, BlockRow, Caption, PictureBlock } from "./blocks.js";
|
|
6
|
+
export { BlockText } from "./block-text.js";
|
|
7
|
+
export { useEditor } from "./editor-state.js";
|
|
8
|
+
export { schemaFor, type AnyExtension, type BlockExtension, type BlockKind, type KindOptions, type Node, type TextNode } from "./kinds.js";
|
|
9
|
+
export type { AnyBlock, Block, CustomBlock } from "../../lib/document.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,oBAAoB,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACnJ,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE3G,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3I,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { DocumentEditor } from "./document-editor.js";
|
|
2
|
+
export { DocumentView, Blocks, Spans } from "./document-view.js";
|
|
3
|
+
export { spoilerBlock } from "./extensions/spoiler.js";
|
|
4
|
+
export { calloutBlock, codeBlock, KIT_BLOCKS, tableBlock, toggleBlock } from "./extensions/kit-blocks.js";
|
|
5
|
+
// What an app needs to write its own block (see BlockExtension and extensions/spoiler).
|
|
6
|
+
export { BlockList, BlockRow, Caption, PictureBlock } from "./blocks.js";
|
|
7
|
+
export { BlockText } from "./block-text.js";
|
|
8
|
+
export { useEditor } from "./editor-state.js";
|
|
9
|
+
export { schemaFor } from "./kinds.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA8F,MAAM,sBAAuB,CAAC;AACnJ,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAgB,MAAM,oBAAqB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA6B,CAAC;AAC3G,wFAAwF;AACxF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAc,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAsG,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import { type LucideIcon } from "lucide-react";
|
|
3
|
+
import { isListType, type AnyBlock, type Block } from "../../lib/document.js";
|
|
4
|
+
import type { Text } from "../../lib/rich-text.js";
|
|
5
|
+
import type { TreeNode } from "../../lib/tree.js";
|
|
6
|
+
export { isListType };
|
|
7
|
+
/** A block as the editor holds it: every kind has children, so the tree helpers work on all of them. */
|
|
8
|
+
type Flat<B> = B extends unknown ? Omit<B, "children" | "id"> : never;
|
|
9
|
+
/** Written out, not Omit'd: Omit over an index signature loses `type`. */
|
|
10
|
+
type CustomDraft = {
|
|
11
|
+
type: string;
|
|
12
|
+
text?: Text;
|
|
13
|
+
[field: string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
export type BuiltinDraft = Flat<Block>;
|
|
16
|
+
export type Draft = BuiltinDraft | CustomDraft;
|
|
17
|
+
export type Node = TreeNode<Draft>;
|
|
18
|
+
/** A node of one of the kit's own kinds, once an extension has been ruled out. */
|
|
19
|
+
export type BuiltinNode = TreeNode<BuiltinDraft>;
|
|
20
|
+
export type TextNode = Node & {
|
|
21
|
+
text: Text;
|
|
22
|
+
};
|
|
23
|
+
export declare const hasText: (node: Node) => node is TextNode;
|
|
24
|
+
/** An entry in the "/" menu: what it is called and the block it makes. */
|
|
25
|
+
export type BlockKind = {
|
|
26
|
+
key: string;
|
|
27
|
+
label: string;
|
|
28
|
+
hint: string;
|
|
29
|
+
icon: LucideIcon;
|
|
30
|
+
make: (text: Text) => Draft;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* A block type an app adds to the editor: a spoiler, a table of items, anything
|
|
34
|
+
* Notion would call a block. The kit's own blocks follow the same rules.
|
|
35
|
+
*
|
|
36
|
+
* - `kinds` are its entries in the "/" menu; `shortcuts` map what is typed at the
|
|
37
|
+
* start of an empty line ("!! ") to one of those entries' keys.
|
|
38
|
+
* - `holds` says which blocks may sit inside it, by type. Without it, none.
|
|
39
|
+
* - `toggle` makes it behave like Notion's toggle: Enter on its own line starts
|
|
40
|
+
* its first child, and Enter on an empty last child steps back out.
|
|
41
|
+
* - `Edit` draws it in the editor, from the parts the kit exports (BlockRow,
|
|
42
|
+
* BlockText, BlockList, Caption, useEditor). `View` draws it read-only in
|
|
43
|
+
* DocumentView. A block with `text` takes a caret; one without is selected whole.
|
|
44
|
+
* - `focus` puts the caret somewhere inside a block without `text` (a table's
|
|
45
|
+
* first cell) when the editor is asked to focus it, for example right after it
|
|
46
|
+
* is made from the "/" menu. Return false to have it selected instead.
|
|
47
|
+
*
|
|
48
|
+
* An extension may take the `type` of one of the kit's own blocks (not a list),
|
|
49
|
+
* to draw it differently: an app's picture block with a picker of its own, say.
|
|
50
|
+
* Its `kinds`, if it gives any, then replace the kit's entries for that type.
|
|
51
|
+
*/
|
|
52
|
+
export type BlockExtension<Fields extends object = Record<string, unknown>> = {
|
|
53
|
+
type: string;
|
|
54
|
+
kinds?: BlockKind[];
|
|
55
|
+
shortcuts?: Record<string, string>;
|
|
56
|
+
holds?: (childType: string) => boolean;
|
|
57
|
+
toggle?: boolean;
|
|
58
|
+
/** `Fields` are the extension's own, typed for it: `BlockExtension<{ stars: number }>`. */
|
|
59
|
+
Edit: ComponentType<{
|
|
60
|
+
block: Node & Fields;
|
|
61
|
+
depth: number;
|
|
62
|
+
}>;
|
|
63
|
+
View?: ComponentType<{
|
|
64
|
+
block: AnyBlock & Fields;
|
|
65
|
+
depth: number;
|
|
66
|
+
}>;
|
|
67
|
+
focus?: (element: HTMLElement, at: number | "end") => boolean;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Which of the kit's "/" entries an app offers, and what they are called. Keys
|
|
71
|
+
* are the entries' own: text, h1, h2, h3, bullet, numbered, todo, quote, divider,
|
|
72
|
+
* image, video, bookmark. A hidden entry's typed shortcut goes with it; blocks of
|
|
73
|
+
* that kind already in a document are still drawn.
|
|
74
|
+
*/
|
|
75
|
+
export type KindOptions = {
|
|
76
|
+
hide?: string[];
|
|
77
|
+
labels?: Record<string, string>;
|
|
78
|
+
hints?: Record<string, string>;
|
|
79
|
+
};
|
|
80
|
+
/** Everything the editor knows about block types: the kit's, then an app's. */
|
|
81
|
+
export type Schema = {
|
|
82
|
+
kinds: BlockKind[];
|
|
83
|
+
/** The kinds a block of text can be turned into. */
|
|
84
|
+
textKinds: BlockKind[];
|
|
85
|
+
shortcuts: Record<string, string>;
|
|
86
|
+
kind: (key: string) => BlockKind | undefined;
|
|
87
|
+
kindOf: (node: Node) => BlockKind | undefined;
|
|
88
|
+
extension: (type: string) => AnyExtension | undefined;
|
|
89
|
+
nests: (type: string) => boolean;
|
|
90
|
+
holds: (parent: string, child: string) => boolean;
|
|
91
|
+
toggle: (type: string) => boolean;
|
|
92
|
+
};
|
|
93
|
+
export type AnyExtension = BlockExtension<any>;
|
|
94
|
+
export declare function schemaFor(extensions?: AnyExtension[], options?: KindOptions): Schema;
|
|
95
|
+
/** From the stored shape to the editor's, giving every block its children. */
|
|
96
|
+
export declare const toNodes: (blocks: AnyBlock[]) => Node[];
|
|
97
|
+
/** Back to the stored shape: only the kinds that hold children keep them. */
|
|
98
|
+
export declare const toBlocks: (nodes: Node[], schema: Schema) => AnyBlock[];
|
|
99
|
+
//# sourceMappingURL=kinds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../../src/components/editor/kinds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAA8G,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3J,OAAO,EAAE,UAAU,EAAE,K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AAK,SAAS,GAAG,SAAS,CAAC;IAC9C,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,GAAG,SAAS,CAAC;IACtD,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACjC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IAClD,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACrC,CAAC;AAGF,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;AAE/C,wBAAgB,SAAS,CAAC,UAAU,GAAE,YAAY,EAAO,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAqC5F;AAED,8EAA8E;AAC9E,eAAO,MAAM,OAAO,GAAI,QAAQ,QAAQ,EAAE,KAAG,IAAI,EACkH,CAAC;AAEpK,6EAA6E;AAC7E,eAAO,MAAM,QAAQ,GAAI,OAAO,IAAI,EAAE,EAAE,QAAQ,MAAM,KAAG,QAAQ,EAI3D,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Bookmark, Heading1, Heading2, Heading3, Image, List, ListOrdered, ListTodo, Minus, Quote, SquarePlay, Type } from "lucide-react";
|
|
2
|
+
import { isListType } from "../../lib/document.js";
|
|
3
|
+
export { isListType };
|
|
4
|
+
export const hasText = (node) => "text" in node && Array.isArray(node.text);
|
|
5
|
+
const BUILTIN_KINDS = [
|
|
6
|
+
{ key: "text", label: "Text", hint: "Plain words", icon: Type, make: (text) => ({ type: "paragraph", text }) },
|
|
7
|
+
{ key: "h1", label: "Heading 1", hint: "A big section heading", icon: Heading1, make: (text) => ({ type: "heading", level: 1, text }) },
|
|
8
|
+
{ key: "h2", label: "Heading 2", hint: "A medium heading", icon: Heading2, make: (text) => ({ type: "heading", level: 2, text }) },
|
|
9
|
+
{ key: "h3", label: "Heading 3", hint: "A small heading", icon: Heading3, make: (text) => ({ type: "heading", level: 3, text }) },
|
|
10
|
+
{ key: "bullet", label: "Bulleted list", hint: "A simple list", icon: List, make: (text) => ({ type: "bullet", text }) },
|
|
11
|
+
{ key: "numbered", label: "Numbered list", hint: "A list in order", icon: ListOrdered, make: (text) => ({ type: "numbered", text }) },
|
|
12
|
+
{ key: "todo", label: "To-do", hint: "Something to tick off", icon: ListTodo, make: (text) => ({ type: "check", checked: false, text }) },
|
|
13
|
+
{ key: "quote", label: "Quote", hint: "Something someone said", icon: Quote, make: (text) => ({ type: "quote", text }) },
|
|
14
|
+
{ key: "divider", label: "Divider", hint: "A line between parts", icon: Minus, make: () => ({ type: "divider" }) },
|
|
15
|
+
{ key: "image", label: "Image", hint: "A picture", icon: Image, make: () => ({ type: "image", caption: [], width: 1 }) },
|
|
16
|
+
{ key: "video", label: "Video", hint: "From YouTube or Vimeo", icon: SquarePlay, make: () => ({ type: "video", url: "", caption: [] }) },
|
|
17
|
+
{ key: "bookmark", label: "Link", hint: "A web page, as a card", icon: Bookmark, make: () => ({ type: "bookmark", url: "", title: "" }) },
|
|
18
|
+
];
|
|
19
|
+
/** Typed at the start of an empty block, these turn it into that kind. */
|
|
20
|
+
const BUILTIN_SHORTCUTS = {
|
|
21
|
+
"- ": "bullet",
|
|
22
|
+
"* ": "bullet",
|
|
23
|
+
"1. ": "numbered",
|
|
24
|
+
"[] ": "todo",
|
|
25
|
+
"# ": "h1",
|
|
26
|
+
"## ": "h2",
|
|
27
|
+
"### ": "h3",
|
|
28
|
+
"> ": "quote",
|
|
29
|
+
"---": "divider",
|
|
30
|
+
};
|
|
31
|
+
export function schemaFor(extensions = [], options = {}) {
|
|
32
|
+
const byType = new Map(extensions.map((x) => [x.type, x]));
|
|
33
|
+
const hidden = new Set(options.hide ?? []);
|
|
34
|
+
const builtin = BUILTIN_KINDS.filter((k) => !hidden.has(k.key) && byType.get(k.make([]).type)?.kinds === undefined).map((k) => ({
|
|
35
|
+
...k,
|
|
36
|
+
label: options.labels?.[k.key] ?? k.label,
|
|
37
|
+
hint: options.hints?.[k.key] ?? k.hint,
|
|
38
|
+
}));
|
|
39
|
+
const kinds = [...builtin, ...extensions.flatMap((x) => x.kinds ?? []).filter((k) => !hidden.has(k.key))];
|
|
40
|
+
const offered = new Set(kinds.map((k) => k.key));
|
|
41
|
+
const shortcuts = Object.fromEntries(Object.entries(Object.assign({}, BUILTIN_SHORTCUTS, ...extensions.map((x) => x.shortcuts ?? {}))).filter(([, key]) => offered.has(key)));
|
|
42
|
+
const holds = (parent, child) => {
|
|
43
|
+
const x = byType.get(parent);
|
|
44
|
+
if (x !== undefined)
|
|
45
|
+
return x.holds?.(child) ?? false;
|
|
46
|
+
return isListType(parent) && isListType(child);
|
|
47
|
+
};
|
|
48
|
+
const nests = (type) => {
|
|
49
|
+
const x = byType.get(type);
|
|
50
|
+
return x !== undefined ? x.holds !== undefined : isListType(type);
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
kinds,
|
|
54
|
+
textKinds: kinds.filter((k) => "text" in k.make([])),
|
|
55
|
+
shortcuts,
|
|
56
|
+
kind: (key) => kinds.find((k) => k.key === key),
|
|
57
|
+
kindOf: (node) => kinds.find((k) => {
|
|
58
|
+
const made = k.make([]);
|
|
59
|
+
return made.type === node.type && (made.type !== "heading" || made.level === node.level);
|
|
60
|
+
}),
|
|
61
|
+
extension: (type) => byType.get(type),
|
|
62
|
+
nests,
|
|
63
|
+
holds,
|
|
64
|
+
toggle: (type) => byType.get(type)?.toggle === true,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** From the stored shape to the editor's, giving every block its children. */
|
|
68
|
+
export const toNodes = (blocks) => blocks.map((b) => ({ ...b, children: Array.isArray(b.children) ? toNodes(b.children) : [] }));
|
|
69
|
+
/** Back to the stored shape: only the kinds that hold children keep them. */
|
|
70
|
+
export const toBlocks = (nodes, schema) => nodes.map((n) => {
|
|
71
|
+
const { children, ...rest } = n;
|
|
72
|
+
return (schema.nests(n.type) ? { ...rest, children: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,CAAa,CAAC;AACzG,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Rank comes from size and the space above, nothing else. A heading sits much closer to what follows it than to what came before. */
|
|
2
|
+
export declare const HEADINGS: {
|
|
3
|
+
readonly 1: "text-h1 mt-8 mb-1";
|
|
4
|
+
readonly 2: "text-h2 mt-6 mb-1";
|
|
5
|
+
readonly 3: "text-h3 mt-4 mb-0.5";
|
|
6
|
+
};
|
|
7
|
+
/** A quote: a rule of ink at its side, a size up. */
|
|
8
|
+
export declare const QUOTE = "border-l-[3px] border-ink px-3.5 text-lead leading-prose";
|
|
9
|
+
export declare function BulletMark({ depth }: {
|
|
10
|
+
depth: number;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
/** A to-do's box, drawn: the editor's Checkbox at rest, for where it cannot be pressed. */
|
|
13
|
+
export declare function CheckMark({ checked }: {
|
|
14
|
+
checked: boolean;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
16
|
+
/** The gutter a list item's mark sits in, the same width in both. */
|
|
17
|
+
export declare const MARK_GUTTER = "flex h-[1.5em] w-6 shrink-0 items-center justify-center text-accent-text select-none";
|
|
18
|
+
//# sourceMappingURL=look.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"look.d.ts","sourceRoot":"","sources":["../../../src/components/editor/look.tsx"],"names":[],"mappings":"AAMA,sIAAsI;AACtI,eAAO,MAAM,QAAQ;;;;CAAwF,CAAC;AAE9G,qDAAqD;AACrD,eAAO,MAAM,KAAK,6DAA6D,CAAC;AAKhF,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,+BAEtD;AAED,2FAA2F;AAC3F,wBAAgB,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,+BAY1D;AAED,qEAAqE;AACrE,eAAO,MAAM,WAAW,yFAAyF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Check } from "lucide-react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
/* How blocks look, written once for the editor and the read view, so a page reads
|
|
5
|
+
the same written as it does saved. */
|
|
6
|
+
/** Rank comes from size and the space above, nothing else. A heading sits much closer to what follows it than to what came before. */
|
|
7
|
+
export const HEADINGS = { 1: "text-h1 mt-8 mb-1", 2: "text-h2 mt-6 mb-1", 3: "text-h3 mt-4 mb-0.5" };
|
|
8
|
+
/** A quote: a rule of ink at its side, a size up. */
|
|
9
|
+
export const QUOTE = "border-l-[3px] border-ink px-3.5 text-lead leading-prose";
|
|
10
|
+
/** Notion cycles the bullet by depth: disc, ring, square. Drawn as shapes, since the glyphs fall back to emoji on some platforms. */
|
|
11
|
+
const BULLETS = ["rounded-full bg-current", "rounded-full border border-current", "bg-current"];
|
|
12
|
+
export function BulletMark({ depth }) {
|
|
13
|
+
return _jsx("span", { "aria-hidden": true, className: cn("size-[5px]", BULLETS[depth % BULLETS.length]) });
|
|
14
|
+
}
|
|
15
|
+
/** A to-do's box, drawn: the editor's Checkbox at rest, for where it cannot be pressed. */
|
|
16
|
+
export function CheckMark({ checked }) {
|
|
17
|
+
return (_jsx("span", { "aria-hidden": true, className: cn("flex justify-center items-center rounded-small size-4 shrink-0", checked ? "bg-accent-solid text-accent-ink" : "shadow-[inset_0_0_0_1.5px_var(--control-edge)]"), children: checked && _jsx(Check, { className: "size-3", strokeWidth: 3 }) }));
|
|
18
|
+
}
|
|
19
|
+
/** The gutter a list item's mark sits in, the same width in both. */
|
|
20
|
+
export const MARK_GUTTER = "flex h-[1.5em] w-6 shrink-0 items-center justify-center text-accent-text select-none";
|
|
21
|
+
//# sourceMappingURL=look.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"look.js","sourceRoot":"","sources":["../../../src/components/editor/look.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC;wCACwC;AAExC,sIAAsI;AACtI,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC,EAAE,mBAAmB,EAAE,CAAC,EAAE,mBAAmB,EAAE,CAAC,EAAE,qBAAqB,EAAW,CAAC;AAE9G,qDAAqD;AACrD,MAAM,CAAC,MAAM,KAAK,GAAG,0DAA0D,CAAC;AAEhF,qIAAqI;AACrI,MAAM,OAAO,GAAG,CAAC,yBAAyB,EAAE,oCAAoC,EAAE,YAAY,CAAC,CAAC;AAEhG,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,EAAqB;IACnD,OAAO,oCAAkB,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAI,CAAC;AAC9F,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,SAAS,CAAC,EAAE,OAAO,EAAwB;IACvD,OAAO,CACH,oCAEI,SAAS,EAAE,EAAE,CACT,gEAAgE,EAChE,OAAO,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC,CAAC,gDAAgD,CACjG,YAEA,OAAO,IAAI,KAAC,KAAK,IAAC,SAAS,EAAC,QAAQ,EAAC,WAAW,EAAE,CAAC,GAAI,GACrD,CACV,CAAC;AACN,CAAC;AAED,qEAAqE;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,sFAAsF,CAAC"}
|