@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,98 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { useSyncExternalStore } from "react";
|
|
4
|
+
import { platform, shortcutKeys, speakShortcut } from "../../lib/keys.js";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { CODE_CLASSES } from "../../lib/rich-text-dom.js";
|
|
7
|
+
/* ────────────────────────────────────────────────────────────────────────
|
|
8
|
+
Typography carries the entire hierarchy in this system. There are no
|
|
9
|
+
boxes around headings, no coloured section bars, no rules above titles.
|
|
10
|
+
Rank is communicated by size, weight and the space above a block — and
|
|
11
|
+
by nothing else. Keep it that way and the UI stays calm as it grows.
|
|
12
|
+
──────────────────────────────────────────────────────────────────────── */
|
|
13
|
+
const headingVariants = cva("text-ink font-sans text-balance", {
|
|
14
|
+
variants: {
|
|
15
|
+
level: {
|
|
16
|
+
display: "text-display mt-0 mb-2",
|
|
17
|
+
title: "text-title mt-0 mb-2",
|
|
18
|
+
1: "text-h1 mt-8 mb-1",
|
|
19
|
+
2: "text-h2 mt-6 mb-1",
|
|
20
|
+
3: "text-h3 mt-4 mb-0.5",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: { level: 1 },
|
|
24
|
+
});
|
|
25
|
+
const defaultTag = {
|
|
26
|
+
display: "h1",
|
|
27
|
+
title: "h1",
|
|
28
|
+
1: "h1",
|
|
29
|
+
2: "h2",
|
|
30
|
+
3: "h3",
|
|
31
|
+
};
|
|
32
|
+
export function Heading({ level = 1, as, flush, className, ...props }) {
|
|
33
|
+
const Tag = (as ?? defaultTag[String(level)] ?? "h2");
|
|
34
|
+
return (_jsx(Tag, { className: cn(headingVariants({ level }), flush && "my-0 mt-0 mb-0", className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
const textVariants = cva("font-sans", {
|
|
37
|
+
variants: {
|
|
38
|
+
tone: {
|
|
39
|
+
default: "text-ink",
|
|
40
|
+
secondary: "text-ink-secondary",
|
|
41
|
+
tertiary: "text-ink-tertiary",
|
|
42
|
+
disabled: "text-ink-disabled",
|
|
43
|
+
// Words in the accent: pulled toward the ink, so they read as text.
|
|
44
|
+
accent: "text-accent-text",
|
|
45
|
+
success: "text-success",
|
|
46
|
+
warning: "text-warning",
|
|
47
|
+
info: "text-info",
|
|
48
|
+
danger: "text-danger",
|
|
49
|
+
},
|
|
50
|
+
size: {
|
|
51
|
+
lead: "text-lead",
|
|
52
|
+
body: "text-body",
|
|
53
|
+
sm: "text-sm",
|
|
54
|
+
caption: "text-caption",
|
|
55
|
+
micro: "text-micro",
|
|
56
|
+
},
|
|
57
|
+
weight: {
|
|
58
|
+
normal: "font-normal",
|
|
59
|
+
medium: "font-medium",
|
|
60
|
+
semibold: "font-semibold",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
defaultVariants: { tone: "default", size: "body", weight: "normal" },
|
|
64
|
+
});
|
|
65
|
+
export function Text({ as, tone, size, weight, className, ...props }) {
|
|
66
|
+
const Tag = (as ?? "p");
|
|
67
|
+
return (_jsx(Tag, { className: cn(textVariants({ tone, size, weight }), className), ...props }));
|
|
68
|
+
}
|
|
69
|
+
/** Inline code. Tinted, not boxed — a box would outrank the paragraph. */
|
|
70
|
+
export function Code({ className, ...props }) {
|
|
71
|
+
return (_jsx("code", { className: cn(CODE_CLASSES, className), ...props }));
|
|
72
|
+
}
|
|
73
|
+
/* One key, as printed on a keyboard. For a combination, use Shortcut. */
|
|
74
|
+
export function Kbd({ className, ...props }) {
|
|
75
|
+
return (_jsx("kbd", { className: cn("inline-flex justify-center items-center bg-surface shadow-xs px-1.5 rounded-small min-w-5 h-5 font-sans font-medium text-ink-secondary text-caption", className), ...props }));
|
|
76
|
+
}
|
|
77
|
+
/* Which platform's keys to show. "other" on the server and in the first render
|
|
78
|
+
after it, so a server-rendered page hydrates cleanly; the right one next. */
|
|
79
|
+
export function usePlatform() {
|
|
80
|
+
return useSyncExternalStore(noSubscription, platform, () => "other");
|
|
81
|
+
}
|
|
82
|
+
const noSubscription = () => () => { };
|
|
83
|
+
/* A keyboard shortcut written once ("mod+shift+k") and shown right where it is
|
|
84
|
+
read: ⌘ ⇧ K on a Mac, Ctrl Shift K elsewhere. A screen reader hears the keys by
|
|
85
|
+
name ("Command Shift K"), not the symbols. */
|
|
86
|
+
export function Shortcut({ keys, className }) {
|
|
87
|
+
const on = usePlatform();
|
|
88
|
+
return (_jsxs("span", { className: cn("inline-flex items-center gap-0.5 align-middle", className), children: [_jsx("span", { className: "sr-only", children: speakShortcut(keys, on) }), shortcutKeys(keys, on).map((key, i) => (_jsx(Kbd, { "aria-hidden": true, children: key.shown }, i)))] }));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Long-form content wrapper. Applies the reading measure plus the
|
|
92
|
+
* vertical rhythm Notion uses between blocks. Wrap raw markdown output
|
|
93
|
+
* in this and it looks intentional with no further work.
|
|
94
|
+
*/
|
|
95
|
+
export function Prose({ children, className, serif, }) {
|
|
96
|
+
return (_jsx("div", { className: cn("measure text-ink text-body", serif && "font-serif", "[&>*+*]:mt-3", "[&_p]:text-ink [&_p]:leading-prose", "[&_a]:link", "[&_strong]:font-semibold", "[&_ul]:list-disc [&_ul]:pl-6 [&_ol]:list-decimal [&_ol]:pl-6", "[&_li]:mt-1 [&_li]:leading-prose", "[&_blockquote]:border-ink/40 [&_blockquote]:pl-4 [&_blockquote]:border-l-2 [&_blockquote]:text-ink", "[&_hr]:my-6 [&_hr]:border-hairline", className), children: children }));
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=typography.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.js","sourceRoot":"","sources":["../../../src/components/ui/typography.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAwF,MAAM,OAAO,CAAC;AACnI,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAiB,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;;;;8EAK8E;AAE9E,MAAM,eAAe,GAAG,GAAG,CAAC,iCAAiC,EAAE;IAC3D,QAAQ,EAAE;QACN,K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S,EAAwC;IAC9E,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IACzB,OAAO,CACH,gBAAM,SAAS,EAAE,EAAE,CAAC,+CAA+C,EAAE,SAAS,CAAC,aAC3E,eAAM,SAAS,EAAC,SAAS,YAAE,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC,GAAQ,EACzD,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CACpC,KAAC,GAAG,mCACC,GAAG,CAAC,KAAK,IADJ,CAAC,CAEL,CACT,CAAC,IACC,CACV,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,EAClB,QAAQ,EACR,SAAS,EACT,KAAK,GAKR;IACG,OAAO,CACH,cACI,SAAS,EAAE,EAAE,CACT,4BAA4B,EAC5B,KAAK,IAAI,YAAY,EACrB,cAAc,EACd,oCAAoC,EACpC,YAAY,EACZ,0BAA0B,EAC1B,8DAA8D,EAC9D,kCAAkC,EAClC,oGAAoG,EACpG,oCAAoC,EACpC,SAAS,CACZ,YAEA,QAAQ,GACP,CACT,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export declare function VideoBlock({ url, onLink, check, caption, title, className, }: {
|
|
3
|
+
/** The link as given, not the embed address. */
|
|
4
|
+
url?: string;
|
|
5
|
+
onLink?: (url: string) => void;
|
|
6
|
+
/** The owner's own rule for a link, after this block's: why it is refused, or null. */
|
|
7
|
+
check?: (url: string) => string | null;
|
|
8
|
+
/** Under the video: usually an EditableText. */
|
|
9
|
+
caption?: ReactNode;
|
|
10
|
+
/** Read out for the player. */
|
|
11
|
+
title?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}): import("react").JSX.Element | null;
|
|
14
|
+
//# sourceMappingURL=video-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video-block.d.ts","sourceRoot":"","sources":["../../../src/components/ui/video-block.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC,wBAAgB,UAAU,CAAC,EACvB,GAAG,EACH,MAAM,EACN,KAAK,EACL,OAAO,EACP,KAAe,EACf,SAAS,GACZ,EAAE;IACC,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,uFAAuF;IACvF,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACvC,gDAAgD;IAChD,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,sCAiCA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { SquarePlay } from "lucide-react";
|
|
5
|
+
import { videoEmbed } from "../../lib/embed.js";
|
|
6
|
+
import { AddressField } from "./address-field.js";
|
|
7
|
+
/* A YouTube or Vimeo video in a document, played in place at the column's full
|
|
8
|
+
width, with a caption slot under it. Until it has a link it asks for one, and
|
|
9
|
+
refuses anything `videoEmbed` cannot play.
|
|
10
|
+
|
|
11
|
+
The player is sandboxed: it may run, go full screen and open YouTube in a new
|
|
12
|
+
tab, and nothing else on the page. */
|
|
13
|
+
export function VideoBlock({ url, onLink, check, caption, title = "Video", className, }) {
|
|
14
|
+
const embed = url ? videoEmbed(url) : null;
|
|
15
|
+
if (embed === null)
|
|
16
|
+
return onLink ? (_jsx(AddressField, { icon: _jsx(SquarePlay, {}), placeholder: "Paste a YouTube or Vimeo link, then Enter", check: (link) => (videoEmbed(link) === null ? "That is not a YouTube or Vimeo link." : null) ?? check?.(link) ?? null, onCommit: onLink, className: className })) : null;
|
|
17
|
+
return (
|
|
18
|
+
// min-w-0: in a grid or flex row the player shrinks to the room there is; an
|
|
19
|
+
// iframe's natural width otherwise pushed a phone's page sideways.
|
|
20
|
+
_jsxs("figure", { className: cn("w-full min-w-0", className), children: [_jsx("div", { className: "relative bg-surface-sunken rounded-surface w-full overflow-hidden aspect-video", children: _jsx("iframe", { src: embed, title: title, className: "absolute inset-0 size-full", allow: "fullscreen; picture-in-picture; encrypted-media", sandbox: "allow-scripts allow-same-origin allow-presentation allow-popups", referrerPolicy: "strict-origin-when-cross-origin", loading: "lazy" }) }), caption !== undefined && _jsx("figcaption", { className: "mt-1.5 text-sm text-ink-secondary", children: caption })] }));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=video-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video-block.js","sourceRoot":"","sources":["../../../src/components/ui/video-block.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAqB,CAAC;AAEnD;;;;;wCAKwC;AACxC,MAAM,UAAU,UAAU,CAAC,EACvB,GAAG,EACH,MAAM,EACN,KAAK,EACL,OAAO,EACP,KAAK,GAAG,OAAO,EACf,SAAS,GAYZ;IACG,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3C,IAAI,KAAK,KAAK,IAAI;QACd,OAAO,MAAM,CAAC,CAAC,CAAC,CACZ,KAAC,YAAY,IACT,IAAI,EAAE,KAAC,UAAU,KAAG,EACpB,WAAW,EAAC,2CAA2C,EACvD,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,EACrH,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,SAAS,GACtB,CACL,CAAC,CAAC,CAAC,IAAI,CAAC;IACb,OAAO;IACH,6EAA6E;IAC7E,mEAAmE;IACnE,kBAAQ,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,aAI9C,cAAK,SAAS,EAAC,gFAAgF,YAC3F,iBACI,GAAG,EAAE,KAAK,EACV,KAAK,EAAE,KAAK,EACZ,SAAS,EAAC,4BAA4B,EACtC,KAAK,EAAC,iDAAiD,EACvD,OAAO,EAAC,iEAAiE,EACzE,cAAc,EAAC,iCAAiC,EAChD,OAAO,EAAC,MAAM,GAChB,GACA,EACL,OAAO,KAAK,SAAS,IAAI,qBAAY,SAAS,EAAC,mCAAmC,YAAE,OAAO,GAAc,IACrG,CACZ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-dismiss.d.ts","sourceRoot":"","sources":["../../src/hooks/use-dismiss.ts"],"names":[],"mappings":"AAaA,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAUtF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useRef, useState } from "react";
|
|
3
|
+
// A little longer than the dialog's closing animation.
|
|
4
|
+
const CLOSING_MS = 170;
|
|
5
|
+
/* For a dialog that only exists while it is open (`{thing && <ThingDialog />}`).
|
|
6
|
+
Unmounting it on close would skip its closing animation, so it first closes,
|
|
7
|
+
then tells its parent once the animation has played. Pass `open` to the Dialog and
|
|
8
|
+
call `dismiss` wherever `onClose` would have gone.
|
|
9
|
+
|
|
10
|
+
From endgame, 2026-12-05. */
|
|
11
|
+
export function useDismiss(onClose) {
|
|
12
|
+
const [open, setOpen] = useState(true);
|
|
13
|
+
const done = useRef(false);
|
|
14
|
+
const dismiss = useCallback(() => {
|
|
15
|
+
if (done.current)
|
|
16
|
+
return;
|
|
17
|
+
done.current = true;
|
|
18
|
+
setOpen(false);
|
|
19
|
+
setTimeout(onClose, CLOSING_MS);
|
|
20
|
+
}, [onClose]);
|
|
21
|
+
return { open, dismiss };
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=use-dismiss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-dismiss.js","sourceRoot":"","sources":["../../src/hooks/use-dismiss.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtD,uDAAuD;AACvD,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB;;;;;+BAK+B;AAC/B,MAAM,UAAU,UAAU,CAAC,OAAmB;IAC1C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3B,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE;QAC7B,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QACf,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACpC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACd,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-escape-first.d.ts","sourceRoot":"","sources":["../../src/hooks/use-escape-first.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAO1D,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,KAAK,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,IAAI,QAe9I"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
/* Escape, while `active`, does `onEscape` and nothing else: a list closes without
|
|
4
|
+
closing the dialog around it. A Radix dialog listens for Escape on the document as
|
|
5
|
+
the key travels down the tree, before the field hears it, so stopping it in the
|
|
6
|
+
field's own handler is too late; the window hears it first of all. Only keys from
|
|
7
|
+
`target` (an element, or a test of the event's target) count. */
|
|
8
|
+
export function useEscapeFirst(active, target, onEscape) {
|
|
9
|
+
const latest = useRef(onEscape);
|
|
10
|
+
latest.current = onEscape;
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!active)
|
|
13
|
+
return;
|
|
14
|
+
const onKey = (e) => {
|
|
15
|
+
if (e.key !== "Escape" || e.isComposing)
|
|
16
|
+
return;
|
|
17
|
+
const ours = typeof target === "function" ? target(e.target) : e.target === target.current;
|
|
18
|
+
if (!ours)
|
|
19
|
+
return;
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
latest.current();
|
|
22
|
+
};
|
|
23
|
+
window.addEventListener("keydown", onKey, { capture: true });
|
|
24
|
+
return () => window.removeEventListener("keydown", onKey, { capture: true });
|
|
25
|
+
}, [active, target]);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=use-escape-first.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-escape-first.js","sourceRoot":"","sources":["../../src/hooks/use-escape-first.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AAE1D;;;;mEAImE;AACnE,MAAM,UAAU,cAAc,CAAC,MAAe,EAAE,MAAyE,EAAE,QAAoB;IAC3I,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChC,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC;IAC1B,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,MAAM,KAAK,GAAG,CAAC,CAAgB,EAAE,EAAE;YAC/B,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,WAAW;gBAAE,OAAO;YAChD,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,CAAC;YAC3F,IAAI,CAAC,IAAI;gBAAE,OAAO;YAClB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,MAAM,CAAC,OAAO,EAAE,CAAC;QACrB,CAAC,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACjF,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
2
|
+
/** Narrower than Tailwind's `md` (48rem): where the kit's layouts switch to their phone shape. */
|
|
3
|
+
export declare const PHONE_QUERY = "(max-width: 47.99rem)";
|
|
4
|
+
export declare const useIsPhone: () => boolean;
|
|
5
|
+
//# sourceMappingURL=use-media-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-media-query.d.ts","sourceRoot":"","sources":["../../src/hooks/use-media-query.ts"],"names":[],"mappings":"AAOA,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAUpD;AAED,kGAAkG;AAClG,eAAO,MAAM,WAAW,0BAA0B,CAAC;AAEnD,eAAO,MAAM,UAAU,QAAO,OAAqC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
/* Whether a media query matches now, kept up to date as the window changes. False
|
|
4
|
+
on the server and in the first render after it, so a server-rendered page and
|
|
5
|
+
its hydration agree; it settles on the next render. */
|
|
6
|
+
export function useMediaQuery(query) {
|
|
7
|
+
return useSyncExternalStore((onChange) => {
|
|
8
|
+
const list = window.matchMedia(query);
|
|
9
|
+
list.addEventListener("change", onChange);
|
|
10
|
+
return () => list.removeEventListener("change", onChange);
|
|
11
|
+
}, () => window.matchMedia(query).matches, () => false);
|
|
12
|
+
}
|
|
13
|
+
/** Narrower than Tailwind's `md` (48rem): where the kit's layouts switch to their phone shape. */
|
|
14
|
+
export const PHONE_QUERY = "(max-width: 47.99rem)";
|
|
15
|
+
export const useIsPhone = () => useMediaQuery(PHONE_QUERY);
|
|
16
|
+
//# sourceMappingURL=use-media-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-media-query.js","sourceRoot":"","sources":["../../src/hooks/use-media-query.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAE7C;;yDAEyD;AACzD,MAAM,UAAU,aAAa,CAAC,KAAa;IACvC,OAAO,oBAAoB,CACvB,CAAC,QAAQ,EAAE,EAAE;QACT,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC1C,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC9D,CAAC,EACD,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,EACtC,GAAG,EAAE,CAAC,KAAK,CACd,CAAC;AACN,CAAC;AAED,kGAAkG;AAClG,MAAM,CAAC,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAEnD,MAAM,CAAC,MAAM,UAAU,GAAG,GAAY,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function useSaveQueue<K>({ save, delay, }: {
|
|
2
|
+
save: (key: K, opts: {
|
|
3
|
+
keepalive: boolean;
|
|
4
|
+
}) => Promise<unknown>;
|
|
5
|
+
delay?: number;
|
|
6
|
+
}): {
|
|
7
|
+
error: string | null;
|
|
8
|
+
enqueue: (job: () => Promise<unknown>) => void;
|
|
9
|
+
schedule: (key: K) => void;
|
|
10
|
+
flush: (key: K, keepalive?: boolean) => void;
|
|
11
|
+
cancel: (key: K) => void;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=use-save-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-save-queue.d.ts","sourceRoot":"","sources":["../../src/hooks/use-save-queue.ts"],"names":[],"mappings":"AAcA,wBAAgB,YAAY,CAAC,CAAC,EAAE,EAC5B,IAAI,EACJ,KAAW,GACd,EAAE;IAGC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;;mBAQqC,MAAM,OAAO,CAAC,OAAO,CAAC;oBAkB9C,CAAC;iBARD,CAAC;kBANsB,CAAC;EA2CrC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
/* Optimistic saving, the way an editor needs it. Change local state first, then:
|
|
4
|
+
|
|
5
|
+
- `schedule(key)` saves that thing after a pause in typing;
|
|
6
|
+
- `flush(key)` saves it now;
|
|
7
|
+
- `enqueue(job)` runs any other write (create, move, delete).
|
|
8
|
+
|
|
9
|
+
Everything goes to the server one request at a time, in the order it was asked
|
|
10
|
+
for, so a move can never overtake the edit before it. Pending saves are flushed
|
|
11
|
+
when the page is hidden or closed, at once and as keepalive requests. The first failure is kept in `error` and nothing is
|
|
12
|
+
retried: show it and offer a reload, rather than guess what the server holds. */
|
|
13
|
+
export function useSaveQueue({ save, delay = 600, }) {
|
|
14
|
+
const [error, setError] = useState(null);
|
|
15
|
+
const queue = useRef(Promise.resolve());
|
|
16
|
+
const timers = useRef(new Map());
|
|
17
|
+
// The latest `save`, so callers need not memoise it.
|
|
18
|
+
const saver = useRef(save);
|
|
19
|
+
saver.current = save;
|
|
20
|
+
const enqueue = useCallback((job) => {
|
|
21
|
+
queue.current = queue.current.then(job).catch((err) => setError((first) => first ?? err.message));
|
|
22
|
+
}, []);
|
|
23
|
+
const cancel = useCallback((key) => {
|
|
24
|
+
clearTimeout(timers.current.get(key));
|
|
25
|
+
timers.current.delete(key);
|
|
26
|
+
}, []);
|
|
27
|
+
const flush = useCallback((key, keepalive = false) => {
|
|
28
|
+
cancel(key);
|
|
29
|
+
enqueue(() => saver.current(key, { keepalive }));
|
|
30
|
+
}, [cancel, enqueue]);
|
|
31
|
+
const schedule = useCallback((key) => {
|
|
32
|
+
cancel(key);
|
|
33
|
+
timers.current.set(key, setTimeout(() => flush(key), delay));
|
|
34
|
+
}, [cancel, flush, delay]);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
// The page is going (closed, or hidden on a phone, which may be the last
|
|
37
|
+
// signal before the app is killed): pending saves go now, as keepalive
|
|
38
|
+
// requests, not behind one already on its way, which may never finish.
|
|
39
|
+
const sendNow = () => {
|
|
40
|
+
for (const key of [...timers.current.keys()]) {
|
|
41
|
+
cancel(key);
|
|
42
|
+
saver.current(key, { keepalive: true }).catch((err) => setError((first) => first ?? err.message));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const onHidden = () => document.visibilityState === "hidden" && sendNow();
|
|
46
|
+
window.addEventListener("pagehide", sendNow);
|
|
47
|
+
document.addEventListener("visibilitychange", onHidden);
|
|
48
|
+
return () => {
|
|
49
|
+
window.removeEventListener("pagehide", sendNow);
|
|
50
|
+
document.removeEventListener("visibilitychange", onHidden);
|
|
51
|
+
// Unmounting within a living page: saved in their turn.
|
|
52
|
+
[...timers.current.keys()].forEach((key) => flush(key));
|
|
53
|
+
};
|
|
54
|
+
}, [flush, cancel]);
|
|
55
|
+
return { error, enqueue, schedule, flush, cancel };
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=use-save-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-save-queue.js","sourceRoot":"","sources":["../../src/hooks/use-save-queue.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE;;;;;;;;;mFASmF;AACnF,MAAM,UAAU,YAAY,CAAI,EAC5B,IAAI,EACJ,KAAK,GAAG,GAAG,GAMd;IACG,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,MAAM,CAAmB,OAAO,CAAC,OA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AEpB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Selection = {
|
|
2
|
+
ids: Set<string>;
|
|
3
|
+
toggle: (id: string, range: boolean) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare function useSelection(order: string[]): {
|
|
6
|
+
selection: Selection | null;
|
|
7
|
+
start: () => void;
|
|
8
|
+
stop: () => void;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=use-selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-selection.d.ts","sourceRoot":"","sources":["../../src/hooks/use-selection.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG;IAAE,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CAAE,CAAC;AAQ3F,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG;IAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,IAAI,CAAA;CAAE,CAsClH"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
/* Picking several things from an ordered list. `selection` is null until
|
|
4
|
+
`start()`; then a press toggles one, and a press with `range` (Shift) picks
|
|
5
|
+
everything between it and the last one pressed. Escape stops.
|
|
6
|
+
|
|
7
|
+
`order` is every id on the page, in the order shown; it is what "between"
|
|
8
|
+
means. */
|
|
9
|
+
export function useSelection(order) {
|
|
10
|
+
const [ids, setIds] = useState(null);
|
|
11
|
+
const [anchor, setAnchor] = useState(null);
|
|
12
|
+
const selecting = ids !== null;
|
|
13
|
+
const stop = () => {
|
|
14
|
+
setIds(null);
|
|
15
|
+
setAnchor(null);
|
|
16
|
+
};
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!selecting)
|
|
19
|
+
return;
|
|
20
|
+
// Escape ends the selection, unless it was meant for something over the page:
|
|
21
|
+
// the confirm() asked about deleting the selection, a menu, a list. That
|
|
22
|
+
// closes, and the selection stays.
|
|
23
|
+
const onKey = (event) => {
|
|
24
|
+
if (event.key !== "Escape" || event.defaultPrevented)
|
|
25
|
+
return;
|
|
26
|
+
if (document.querySelector('[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]'))
|
|
27
|
+
return;
|
|
28
|
+
stop();
|
|
29
|
+
};
|
|
30
|
+
window.addEventListener("keydown", onKey);
|
|
31
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
32
|
+
}, [selecting]);
|
|
33
|
+
const toggle = (id, range) => {
|
|
34
|
+
setIds((prev) => {
|
|
35
|
+
const next = new Set(prev);
|
|
36
|
+
const from = anchor === null ? -1 : order.indexOf(anchor);
|
|
37
|
+
const to = order.indexOf(id);
|
|
38
|
+
if (range && from !== -1 && to !== -1) {
|
|
39
|
+
for (const between of order.slice(Math.min(from, to), Math.max(from, to) + 1))
|
|
40
|
+
next.add(between);
|
|
41
|
+
}
|
|
42
|
+
else if (next.has(id))
|
|
43
|
+
next.delete(id);
|
|
44
|
+
else
|
|
45
|
+
next.add(id);
|
|
46
|
+
return next;
|
|
47
|
+
});
|
|
48
|
+
setAnchor(id);
|
|
49
|
+
};
|
|
50
|
+
return { selection: ids === null ? null : { ids, toggle }, start: () => setIds(new Set()), stop };
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=use-selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-selection.js","sourceRoot":"","sources":["../../src/hooks/use-selection.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,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AM,CAAC,CAAC;YAC1D,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC7B,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;gBACpC,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;oBAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACrG,CAAC;iBAAM,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;;gBACpC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAClB,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,SAAS,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC;AACtG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-shared-transition.d.ts","sourceRoot":"","sources":["../../src/hooks/use-shared-transition.ts"],"names":[],"mappings":"AA4BA,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAI9C;AAOD,eAAO,MAAM,aAAa,QAAO,MAAM,GAAG,IAAqD,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
/* Growing one element out of another with the browser's View Transitions: a
|
|
4
|
+
thumbnail into a full view and back.
|
|
5
|
+
|
|
6
|
+
The browser pairs two elements by a shared `view-transition-name`, and only
|
|
7
|
+
one element in the page may carry a given name at a time. With a grid of
|
|
8
|
+
hundreds, something has to say which thumbnail it is. This is that: the id
|
|
9
|
+
of the item last opened.
|
|
10
|
+
|
|
11
|
+
// on the thumbnail
|
|
12
|
+
const active = useActiveItem();
|
|
13
|
+
<img style={{ viewTransitionName: active === id && !viewerOpen ? "shared" : undefined }} />
|
|
14
|
+
// when it is pressed, before navigating
|
|
15
|
+
setActiveItem(id);
|
|
16
|
+
// on the full view, and whenever it steps to another item
|
|
17
|
+
<img style={{ viewTransitionName: "shared" }} />
|
|
18
|
+
useEffect(() => setActiveItem(id), [id]);
|
|
19
|
+
|
|
20
|
+
The thumbnail drops the name while the view is open, or the two would hold
|
|
21
|
+
it at once and the browser would skip the transition. Start the transition
|
|
22
|
+
with `document.startViewTransition`, or your router's own switch for it.
|
|
23
|
+
The stylesheet's `::view-transition-group(shared)` rules set the timing. */
|
|
24
|
+
let active = null;
|
|
25
|
+
const listeners = new Set();
|
|
26
|
+
export function setActiveItem(id) {
|
|
27
|
+
if (active === id)
|
|
28
|
+
return;
|
|
29
|
+
active = id;
|
|
30
|
+
for (const listener of listeners)
|
|
31
|
+
listener();
|
|
32
|
+
}
|
|
33
|
+
const subscribe = (listener) => {
|
|
34
|
+
listeners.add(listener);
|
|
35
|
+
return () => listeners.delete(listener);
|
|
36
|
+
};
|
|
37
|
+
export const useActiveItem = () => useSyncExternalStore(subscribe, () => active);
|
|
38
|
+
//# sourceMappingURL=use-shared-transition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-shared-transition.js","sourceRoot":"","sources":["../../src/hooks/use-shared-transition.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;8EAoB8E;AAC9E,IAAI,MAAM,GAAkB,IAAI,CAAC;AACjC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;AAExC,MAAM,UAAU,aAAa,CAAC,EAAU;IACpC,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO;IAC1B,MAAM,GAAG,EAAE,CAAC;IACZ,KAAK,MAAM,QAAQ,IAAI,SAAS;QAAE,QAAQ,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,QAAoB,EAAgB,EAAE;IACrD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAkB,EAAE,CAAC,oBAAoB,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type UploadState = "waiting" | "uploading" | "done" | "failed" | "rejected";
|
|
2
|
+
export type UploadItem = {
|
|
3
|
+
key: number;
|
|
4
|
+
file: File;
|
|
5
|
+
state: UploadState;
|
|
6
|
+
/** 0 to 1, while uploading. */
|
|
7
|
+
progress: number;
|
|
8
|
+
/** Why it failed or was turned away, or anything the upload wants said. */
|
|
9
|
+
message?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function useUploadQueue({ upload, validate, parallel, }: {
|
|
12
|
+
upload: (file: File, report: (progress: number) => void) => Promise<string | void>;
|
|
13
|
+
validate?: (file: File) => string | undefined;
|
|
14
|
+
parallel?: number;
|
|
15
|
+
}): {
|
|
16
|
+
items: UploadItem[];
|
|
17
|
+
busy: boolean;
|
|
18
|
+
add: (files: File[]) => void;
|
|
19
|
+
retry: (key: number) => void;
|
|
20
|
+
clear: () => void;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=use-upload-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-upload-queue.d.ts","sourceRoot":"","sources":["../../src/hooks/use-upload-queue.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEnF,MAAM,MAAM,UAAU,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,WAAW,CAAC;IACnB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAaF,wBAAgB,cAAc,CAAC,EAC3B,MAAM,EACN,QAAQ,EACR,QAAY,GACf,EAAE;IACC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACnF,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;;;iBA6Ce,IAAI,EAAE;iBAYR,MAAM;;EAkBnB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
/* A queue of files being sent, a few at a time.
|
|
4
|
+
|
|
5
|
+
You supply `upload`: send one file, call `report` with 0 to 1 as it goes,
|
|
6
|
+
resolve when it is done (optionally with a message to show), throw an Error
|
|
7
|
+
when it fails. The queue does the rest: holds the order, runs `parallel` at
|
|
8
|
+
once, keeps each file's progress, and lets a failed one be tried again.
|
|
9
|
+
|
|
10
|
+
`validate` turns a file away before anything is sent, by returning why.
|
|
11
|
+
|
|
12
|
+
The queue lives in the component that calls this. For uploads that must
|
|
13
|
+
survive navigation, keep the same logic in a store outside React instead. */
|
|
14
|
+
export function useUploadQueue({ upload, validate, parallel = 3, }) {
|
|
15
|
+
const items = useRef([]);
|
|
16
|
+
const nextKey = useRef(1);
|
|
17
|
+
const running = useRef(0);
|
|
18
|
+
const [, render] = useState(0);
|
|
19
|
+
// The latest functions, so a queue started with one render's props finishes with the current ones.
|
|
20
|
+
const latest = useRef({ upload, validate });
|
|
21
|
+
latest.current = { upload, validate };
|
|
22
|
+
// Progress arrives many times a second per file; one render per frame is plenty.
|
|
23
|
+
const frame = useRef(0);
|
|
24
|
+
const changed = useCallback(() => {
|
|
25
|
+
if (frame.current !== 0)
|
|
26
|
+
return;
|
|
27
|
+
frame.current = requestAnimationFrame(() => {
|
|
28
|
+
frame.current = 0;
|
|
29
|
+
render((n) => n + 1);
|
|
30
|
+
});
|
|
31
|
+
}, []);
|
|
32
|
+
useEffect(() => () => cancelAnimationFrame(frame.current), []);
|
|
33
|
+
const pump = useCallback(() => {
|
|
34
|
+
while (running.current < parallel) {
|
|
35
|
+
const item = items.current.find((i) => i.state === "waiting");
|
|
36
|
+
if (item === undefined)
|
|
37
|
+
return;
|
|
38
|
+
running.current += 1;
|
|
39
|
+
Object.assign(item, { state: "uploading", progress: 0, message: undefined });
|
|
40
|
+
changed();
|
|
41
|
+
latest.current
|
|
42
|
+
.upload(item.file, (progress) => {
|
|
43
|
+
item.progress = progress;
|
|
44
|
+
changed();
|
|
45
|
+
})
|
|
46
|
+
.then((message) => Object.assign(item, { state: "done", progress: 1, message: message ?? undefined }), (error) => Object.assign(item, { state: "failed", message: error instanceof Error ? error.message : "It could not be sent" }))
|
|
47
|
+
.finally(() => {
|
|
48
|
+
running.current -= 1;
|
|
49
|
+
changed();
|
|
50
|
+
pump();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}, [parallel, changed]);
|
|
54
|
+
const add = useCallback((files) => {
|
|
55
|
+
for (const file of files) {
|
|
56
|
+
const refused = latest.current.validate?.(file);
|
|
57
|
+
items.current.push({ key: nextKey.current++, file, state: refused === undefined ? "waiting" : "rejected", progress: 0, message: refused });
|
|
58
|
+
}
|
|
59
|
+
changed();
|
|
60
|
+
pump();
|
|
61
|
+
}, [changed, pump]);
|
|
62
|
+
const retry = useCallback((key) => {
|
|
63
|
+
const item = items.current.find((i) => i.key === key);
|
|
64
|
+
if (item?.state !== "failed")
|
|
65
|
+
return;
|
|
66
|
+
item.state = "waiting";
|
|
67
|
+
changed();
|
|
68
|
+
pump();
|
|
69
|
+
}, [changed, pump]);
|
|
70
|
+
/** Drops everything that has reached an end; work in flight stays. */
|
|
71
|
+
const clear = useCallback(() => {
|
|
72
|
+
items.current = items.current.filter((i) => i.state === "waiting" || i.state === "uploading");
|
|
73
|
+
changed();
|
|
74
|
+
}, [changed]);
|
|
75
|
+
const list = [...items.current];
|
|
76
|
+
return { items: list, busy: list.some((i) => i.state === "waiting" || i.state === "uploading"), add, retry, clear };
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=use-upload-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-upload-queue.js","sourceRoot":"","sources":["../../src/hooks/use-upload-queue.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAcjE;;;;;;;;;;+EAU+E;AAC/E,MAAM,UAAU,cAAc,CAAC,EAC3B,MAAM,EACN,QAAQ,EACR,QAAQ,GAAG,CAAC,GAKf;IACG,MAAM,KAAK,GAAG,MAAM,CAAe,EAAE,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC/B,mGAAmG;IACnG,MAAM,MA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E,IAAI,CAAC,CAClB,CAAC;IAEF,MAAM,KAAK,GAAG,WAAW,CACrB,CAAC,GAAW,EAAE,EAAE;QACZ,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;QACtD,IAAI,IAAI,EAAE,KAAK,KAAK,QAAQ;YAAE,OAAO;QACrC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,CAAC;IACX,CAAC,EACD,CAAC,OAAO,EAAE,IAAI,CAAC,CAClB,CAAC;IAEF,sEAAsE;IACtE,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;QAC3B,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,KAAK,WAAW,CAAC,CAAC;QAC9F,OAAO,EAAE,CAAC;IACd,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,MAAM,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAChC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,KAAK,WAAW,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AACxH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const ACCENTS: readonly ["paper", "blue", "green", "purple", "pink", "orange", "red", "brown"];
|
|
2
|
+
export type Accent = (typeof ACCENTS)[number];
|
|
3
|
+
export declare const ACCENT_KEY = "accent";
|
|
4
|
+
export declare const ACCENT_INIT_SCRIPT: string;
|
|
5
|
+
//# sourceMappingURL=accent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accent.d.ts","sourceRoot":"","sources":["../../src/lib/accent.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,iFAAkF,CAAC;AACvG,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9C,eAAO,MAAM,UAAU,WAAW,CAAC;AAGnC,eAAO,MAAM,kBAAkB,QAAyI,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// The colour themes, independent of light and dark. "paper" is the plain one: white
|
|
2
|
+
// and warm grey with the blue accent, and it is the absence of a theme, so nothing is
|
|
3
|
+
// set for it. Each of the others sets the accent and washes every surface with it;
|
|
4
|
+
// the colours live in notion.css under [data-accent]. This is only their names
|
|
5
|
+
// and where the choice is kept.
|
|
6
|
+
export const ACCENTS = ["paper", "blue", "green", "purple", "pink", "orange", "red", "brown"];
|
|
7
|
+
export const ACCENT_KEY = "accent";
|
|
8
|
+
// Runs in <head> before first paint, so the page never flashes the wrong theme.
|
|
9
|
+
export const ACCENT_INIT_SCRIPT = `try{var a=localStorage.getItem(${JSON.stringify(ACCENT_KEY)});if(a&&a!=="paper")document.documentElement.dataset.accent=a}catch(e){}`;
|
|
10
|
+
//# sourceMappingURL=accent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accent.js","sourceRoot":"","sources":["../../src/lib/accent.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sFAAsF;AACtF,mFAAmF;AACnF,+EAA+E;AAC/E,gCAAgC;AAChC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAU,CAAC;AAEvG,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC;AAEnC,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,kCAAkC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,0EAA0E,CAAC"}
|