rimecms 0.33.0 → 1.0.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/dist/adapter-sqlite/auth.server.d.ts +2 -2
- package/dist/adapter-sqlite/columns.server.js +2 -2
- package/dist/adapter-sqlite/connect.server.d.ts +12 -0
- package/dist/adapter-sqlite/connect.server.js +31 -0
- package/dist/adapter-sqlite/generate-schema/index.server.js +11 -3
- package/dist/adapter-sqlite/generate-schema/root.server.d.ts +13 -4
- package/dist/adapter-sqlite/generate-schema/root.server.js +75 -131
- package/dist/adapter-sqlite/generate-schema/templates.server.d.ts +27 -6
- package/dist/adapter-sqlite/generate-schema/templates.server.js +52 -10
- package/dist/adapter-sqlite/index.server.d.ts +13 -5
- package/dist/adapter-sqlite/index.server.js +9 -6
- package/dist/adapter-sqlite/naming.server.d.ts +6 -8
- package/dist/adapter-sqlite/naming.server.js +22 -4
- package/dist/adapter-sqlite/paths.server.d.ts +10 -0
- package/dist/adapter-sqlite/paths.server.js +122 -0
- package/dist/adapter-sqlite/read.server.d.ts +10 -1
- package/dist/adapter-sqlite/read.server.js +22 -10
- package/dist/adapter-sqlite/select.server.d.ts +19 -0
- package/dist/adapter-sqlite/select.server.js +71 -63
- package/dist/adapter-sqlite/table.server.d.ts +2 -2
- package/dist/adapter-sqlite/transform.server.js +33 -3
- package/dist/adapter-sqlite/types.server.d.ts +10 -3
- package/dist/adapter-sqlite/where.server.d.ts +2 -3
- package/dist/adapter-sqlite/where.server.js +19 -1
- package/dist/core/adapter.d.ts +94 -0
- package/dist/core/auth/better-auth/config.server.d.ts +3 -3
- package/dist/core/auth/better-auth/instance.server.d.ts +6 -6
- package/dist/core/auth/handler/index.server.js +1 -1
- package/dist/core/auth/staff/derive.js +1 -1
- package/dist/core/auth/validate-config.js +3 -5
- package/dist/core/boot.server.d.ts +6 -6
- package/dist/core/config/types.d.ts +43 -5
- package/dist/core/config/validate.server.js +34 -51
- package/dist/core/dev/cli/commands/build.js +21 -6
- package/dist/core/dev/cli/commands/init.server.d.ts +2 -1
- package/dist/core/dev/cli/commands/init.server.js +32 -6
- package/dist/core/dev/cli/index.js +1 -0
- package/dist/core/dev/cli/templates/init.d.ts +6 -1
- package/dist/core/dev/cli/templates/init.js +30 -2
- package/dist/core/dev/cli/util/package-manager.server.d.ts +1 -0
- package/dist/core/dev/cli/util/package-manager.server.js +11 -8
- package/dist/core/dev/cli/util/package.server.d.ts +9 -0
- package/dist/core/dev/cli/util/package.server.js +43 -0
- package/dist/core/dev/codegen/types/contributions.server.d.ts +3 -2
- package/dist/core/dev/codegen/types/contributions.server.js +10 -3
- package/dist/core/dev/vite.server.js +4 -3
- package/dist/core/fields/blank.d.ts +21 -0
- package/dist/core/fields/blank.js +37 -0
- package/dist/core/fields/builders/field-builder.d.ts +53 -0
- package/dist/core/fields/builders/field-builder.js +14 -1
- package/dist/core/fields/builders/form-field-builder.d.ts +8 -0
- package/dist/core/fields/builders/form-field-builder.js +14 -1
- package/dist/core/fields/util.d.ts +9 -2
- package/dist/core/fields/util.js +123 -135
- package/dist/core/fields/walk.d.ts +44 -0
- package/dist/core/fields/walk.js +55 -0
- package/dist/core/handler.server.js +4 -0
- package/dist/core/i18n/context.d.ts +5 -0
- package/dist/core/i18n/context.js +6 -0
- package/dist/core/i18n/en/common.d.ts +71 -0
- package/dist/core/i18n/en/common.js +72 -1
- package/dist/core/i18n/en/fields.d.ts +68 -0
- package/dist/core/i18n/en/fields.js +69 -1
- package/dist/core/i18n/fr/common.d.ts +71 -0
- package/dist/core/i18n/fr/common.js +72 -1
- package/dist/core/i18n/fr/fields.d.ts +68 -0
- package/dist/core/i18n/fr/fields.js +69 -1
- package/dist/core/i18n/index.d.ts +29 -3
- package/dist/core/i18n/index.js +55 -29
- package/dist/core/locale/copy.server.js +3 -3
- package/dist/core/logger.server.js +15 -6
- package/dist/core/pipeline/build-document.server.d.ts +3 -0
- package/dist/core/pipeline/build-document.server.js +10 -7
- package/dist/core/pipeline/config-map/index.d.ts +9 -0
- package/dist/core/pipeline/config-map/index.js +16 -50
- package/dist/core/pipeline/hooks/process-document-fields.server.d.ts +3 -0
- package/dist/core/pipeline/hooks/process-document-fields.server.js +48 -12
- package/dist/core/pipeline/hooks/set-default-values.server.d.ts +1 -0
- package/dist/core/pipeline/hooks/set-default-values.server.js +1 -0
- package/dist/core/pipeline/persist/blocks/extract.server.js +1 -1
- package/dist/core/pipeline/persist/relations/extract.server.js +2 -0
- package/dist/core/pipeline/populate-relations.server.d.ts +27 -0
- package/dist/core/pipeline/populate-relations.server.js +42 -0
- package/dist/core/pipeline/run.server.d.ts +17 -6
- package/dist/core/pipeline/run.server.js +44 -30
- package/dist/core/plugins/cache/module.server.d.ts +1 -1
- package/dist/core/plugins/cache/module.server.js +5 -5
- package/dist/core/prototype/area/api.server.js +1 -2
- package/dist/core/prototype/area/definition.js +1 -10
- package/dist/core/prototype/area/definition.server.js +4 -5
- package/dist/core/prototype/area/hooks.server.js +3 -2
- package/dist/core/prototype/area/operations/find.js +2 -0
- package/dist/core/prototype/blank.d.ts +26 -0
- package/dist/core/prototype/blank.js +22 -0
- package/dist/core/prototype/collection/api.server.d.ts +29 -3
- package/dist/core/prototype/collection/api.server.js +47 -4
- package/dist/core/prototype/collection/definition.js +0 -3
- package/dist/core/prototype/collection/hooks/merge-with-blank.server.d.ts +5 -1
- package/dist/core/prototype/collection/hooks/merge-with-blank.server.js +8 -22
- package/dist/core/prototype/collection/hooks.server.js +11 -5
- package/dist/core/prototype/collection/nested/module.server.js +3 -1
- package/dist/core/prototype/collection/nested/tree.d.ts +12 -0
- package/dist/core/prototype/collection/nested/tree.js +42 -0
- package/dist/core/prototype/collection/operations/find-by-id.js +2 -0
- package/dist/core/prototype/collection/operations/find-by-ids.d.ts +19 -0
- package/dist/core/prototype/collection/operations/find-by-ids.js +54 -0
- package/dist/core/prototype/collection/operations/find.js +21 -27
- package/dist/core/prototype/collection/operations/update-slug-by-id.d.ts +20 -0
- package/dist/core/prototype/collection/operations/update-slug-by-id.js +53 -0
- package/dist/core/prototype/collection/rest/index.server.js +3 -1
- package/dist/core/prototype/collection/rest/update-slug-by-id.server.d.ts +2 -0
- package/dist/core/prototype/collection/rest/update-slug-by-id.server.js +20 -0
- package/dist/core/prototype/collection/thumbnail/find-thumbnail.d.ts +2 -1
- package/dist/core/prototype/collection/thumbnail/find-thumbnail.js +4 -27
- package/dist/core/prototype/collection/upload/directories/derive.js +3 -1
- package/dist/core/prototype/collection/upload/disk/delete.server.js +1 -2
- package/dist/core/prototype/define.js +2 -0
- package/dist/core/prototype/shared/metas/fields.js +2 -1
- package/dist/core/prototype/shared/title/find-title.d.ts +2 -1
- package/dist/core/prototype/shared/title/find-title.js +5 -28
- package/dist/core/prototype/shared/url/addresses.server.d.ts +26 -0
- package/dist/core/prototype/shared/url/addresses.server.js +119 -0
- package/dist/core/prototype/shared/url/doc-type.d.ts +6 -0
- package/dist/core/prototype/shared/url/doc-type.js +9 -0
- package/dist/core/prototype/shared/url/format.server.d.ts +27 -0
- package/dist/core/prototype/shared/url/format.server.js +38 -0
- package/dist/core/prototype/shared/url/hooks/create-paths.server.d.ts +2 -0
- package/dist/core/prototype/shared/url/hooks/create-paths.server.js +9 -0
- package/dist/core/prototype/shared/url/hooks/detach-paths.server.d.ts +5 -0
- package/dist/core/prototype/shared/url/hooks/detach-paths.server.js +18 -0
- package/dist/core/prototype/shared/url/hooks/index.server.d.ts +5 -1
- package/dist/core/prototype/shared/url/hooks/index.server.js +5 -1
- package/dist/core/prototype/shared/url/hooks/set-area-url.server.d.ts +2 -0
- package/dist/core/prototype/shared/url/hooks/set-area-url.server.js +8 -0
- package/dist/core/prototype/shared/url/hooks/set-live-url.server.d.ts +5 -0
- package/dist/core/prototype/shared/url/hooks/set-live-url.server.js +19 -0
- package/dist/core/prototype/shared/url/hooks/sync-paths.server.d.ts +7 -0
- package/dist/core/prototype/shared/url/hooks/sync-paths.server.js +37 -0
- package/dist/core/prototype/shared/url/refresh.server.d.ts +36 -0
- package/dist/core/prototype/shared/url/refresh.server.js +58 -0
- package/dist/core/prototype/shared/versions/configure.server.js +3 -0
- package/dist/core/routes/context.server.d.ts +2 -1
- package/dist/fields/blocks/component/AddBlockButton.svelte +48 -137
- package/dist/fields/blocks/component/Block.svelte +153 -117
- package/dist/fields/blocks/component/Block.svelte.d.ts +11 -5
- package/dist/fields/blocks/component/BlockActions.svelte +76 -26
- package/dist/fields/blocks/component/BlockActions.svelte.d.ts +3 -0
- package/dist/fields/blocks/component/Blocks.svelte +248 -91
- package/dist/fields/blocks/component/focus/BlocksFocus.svelte +680 -0
- package/dist/fields/blocks/component/focus/BlocksFocus.svelte.d.ts +7 -0
- package/dist/fields/blocks/component/focus/Layers.svelte +145 -0
- package/dist/fields/blocks/component/focus/Layers.svelte.d.ts +9 -0
- package/dist/fields/blocks/component/focus/LayersList.svelte +304 -0
- package/dist/fields/blocks/component/focus/LayersList.svelte.d.ts +10 -0
- package/dist/fields/blocks/component/focus/Palette.svelte +135 -0
- package/dist/fields/blocks/component/focus/Palette.svelte.d.ts +9 -0
- package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte +77 -0
- package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte.d.ts +10 -0
- package/dist/fields/blocks/component/focus/Renders.svelte +302 -0
- package/dist/fields/blocks/component/focus/Renders.svelte.d.ts +11 -0
- package/dist/fields/blocks/component/focus/Stage.svelte +190 -0
- package/dist/fields/blocks/component/focus/Stage.svelte.d.ts +8 -0
- package/dist/fields/blocks/component/focus/StagePlaceholder.svelte +69 -0
- package/dist/fields/blocks/component/focus/StagePlaceholder.svelte.d.ts +3 -0
- package/dist/fields/blocks/component/focus/focus.svelte.d.ts +140 -0
- package/dist/fields/blocks/component/focus/focus.svelte.js +424 -0
- package/dist/fields/blocks/component/picker/BlockPicker.svelte +88 -0
- package/dist/fields/blocks/component/picker/BlockPicker.svelte.d.ts +10 -0
- package/dist/fields/blocks/component/picker/BlockTile.svelte +121 -0
- package/dist/fields/blocks/component/picker/BlockTile.svelte.d.ts +12 -0
- package/dist/fields/blocks/index.d.ts +49 -7
- package/dist/fields/blocks/index.js +61 -12
- package/dist/fields/checkbox/component/Checkbox.svelte +11 -37
- package/dist/fields/checkbox/component/Checkbox.svelte.d.ts +1 -0
- package/dist/fields/combobox/component/ComboBox.svelte +37 -7
- package/dist/fields/combobox/component/combobox.css +26 -10
- package/dist/fields/date/component/Date.svelte +43 -12
- package/dist/fields/group/component/Group.svelte +110 -41
- package/dist/fields/group/index.d.ts +5 -1
- package/dist/fields/group/index.js +10 -2
- package/dist/fields/link/component/Link.svelte +184 -143
- package/dist/fields/link/component/RessourceInput.svelte +26 -24
- package/dist/fields/link/index.d.ts +1 -0
- package/dist/fields/link/module.server.js +2 -4
- package/dist/fields/number/component/Number.svelte +38 -20
- package/dist/fields/number/component/number.css +22 -20
- package/dist/fields/number/index.d.ts +1 -0
- package/dist/fields/radio/component/Radio.svelte +12 -0
- package/dist/fields/radio/index.js +1 -1
- package/dist/fields/relation/component/Relation.svelte +169 -40
- package/dist/fields/relation/component/RelationInline.svelte +258 -0
- package/dist/fields/relation/component/RelationInline.svelte.d.ts +26 -0
- package/dist/fields/relation/component/default/Default.svelte +210 -100
- package/dist/fields/relation/component/default/Default.svelte.d.ts +14 -1
- package/dist/fields/relation/component/types.d.ts +4 -0
- package/dist/fields/relation/component/upload/Browse.svelte +619 -88
- package/dist/fields/relation/component/upload/Browse.svelte.d.ts +10 -2
- package/dist/fields/relation/component/upload/Create.svelte +41 -0
- package/dist/fields/relation/component/upload/Create.svelte.d.ts +13 -0
- package/dist/fields/relation/component/upload/Upload.svelte +287 -101
- package/dist/fields/relation/component/upload/Upload.svelte.d.ts +6 -1
- package/dist/fields/relation/component/upload/upload.css +5 -81
- package/dist/fields/relation/module.server.js +7 -1
- package/dist/fields/relation/value.d.ts +25 -0
- package/dist/fields/relation/value.js +27 -0
- package/dist/fields/rich-text/component/RichText.svelte +12 -80
- package/dist/fields/rich-text/component/RichText.svelte.d.ts +1 -1
- package/dist/fields/rich-text/component/RichTextInline.svelte +28 -0
- package/dist/fields/rich-text/component/RichTextInline.svelte.d.ts +11 -0
- package/dist/fields/rich-text/component/bubble-menu/bubble-menu.css +4 -3
- package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte +3 -1
- package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.css +2 -2
- package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.css +7 -10
- package/dist/fields/rich-text/component/drag-handle/drag-handle.css +0 -2
- package/dist/fields/rich-text/component/styles/editor.css +111 -0
- package/dist/fields/rich-text/component/styles/field.css +71 -0
- package/dist/fields/rich-text/component/suggestion/suggestion.svelte +41 -56
- package/dist/fields/rich-text/core/build-editor-config.js +1 -1
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.js +29 -3
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.d.ts +1 -0
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.js +2 -1
- package/dist/fields/rich-text/core/features/fields/fields.css +2 -3
- package/dist/fields/rich-text/core/features/hr/hr.css +4 -4
- package/dist/fields/rich-text/core/features/link/component/link-selector.css +0 -4
- package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +24 -8
- package/dist/fields/rich-text/core/features/resource/resource.svelte +20 -6
- package/dist/fields/rich-text/core/features/upload/upload.svelte +20 -8
- package/dist/fields/rich-text/core/rich-text-editor-core.svelte +103 -0
- package/dist/fields/rich-text/core/rich-text-editor-core.svelte.d.ts +15 -0
- package/dist/fields/select/component/Select.svelte +67 -28
- package/dist/fields/slug/component/Slug.svelte +26 -53
- package/dist/fields/slug/index.d.ts +1 -0
- package/dist/fields/slug/index.js +1 -1
- package/dist/fields/tabs/component/Tabs.svelte +28 -22
- package/dist/fields/tabs/index.d.ts +4 -1
- package/dist/fields/tabs/index.js +17 -5
- package/dist/fields/text/index.d.ts +1 -0
- package/dist/fields/textarea/component/TextArea.svelte +28 -13
- package/dist/fields/textarea/index.d.ts +1 -0
- package/dist/fields/time/component/Time.svelte +9 -2
- package/dist/fields/toggle/component/Toggle.svelte +8 -25
- package/dist/fields/toggle/component/Toggle.svelte.d.ts +1 -0
- package/dist/fields/toggle/index.d.ts +1 -0
- package/dist/fields/tree/component/AddItemButton.svelte +18 -5
- package/dist/fields/tree/component/Tree.svelte +48 -19
- package/dist/fields/tree/component/TreeBlock.svelte +318 -104
- package/dist/fields/tree/component/TreeBlockActions.svelte +71 -7
- package/dist/fields/tree/component/TreeBlockActions.svelte.d.ts +4 -0
- package/dist/fields/tree/component/props.d.ts +2 -1
- package/dist/fields/tree/index.d.ts +13 -1
- package/dist/fields/tree/index.js +35 -9
- package/dist/fields/types.d.ts +3 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -2
- package/dist/panel/components/Root.svelte +16 -44
- package/dist/panel/components/Root.svelte.d.ts +1 -1
- package/dist/panel/components/fields/Error.svelte +18 -3
- package/dist/panel/components/fields/FieldsPreview.svelte +30 -17
- package/dist/panel/components/fields/FieldsPreviewTrigger.svelte +25 -3
- package/dist/panel/components/fields/Hint.svelte +51 -8
- package/dist/panel/components/fields/Hint.svelte.d.ts +11 -0
- package/dist/panel/components/fields/Label.svelte +2 -0
- package/dist/panel/components/fields/LabelFor.svelte +7 -2
- package/dist/panel/components/fields/RenderFields.svelte +10 -3
- package/dist/panel/components/fields/fieldset.svelte.d.ts +4 -1
- package/dist/panel/components/fields/fieldset.svelte.js +9 -2
- package/dist/panel/components/fields/index.d.ts +1 -0
- package/dist/panel/components/fields/setting.css +82 -0
- package/dist/panel/components/sections/auth/AuthForm.svelte +25 -26
- package/dist/panel/components/sections/collection/Avatar.svelte +61 -0
- package/dist/panel/components/sections/collection/Avatar.svelte.d.ts +9 -0
- package/dist/panel/components/sections/collection/DocStatus.svelte +28 -0
- package/dist/panel/components/sections/collection/DocStatus.svelte.d.ts +7 -0
- package/dist/panel/components/sections/collection/Empty.svelte +3 -3
- package/dist/panel/components/sections/collection/StatusDot.svelte +7 -5
- package/dist/panel/components/sections/collection/When.svelte +33 -0
- package/dist/panel/components/sections/collection/When.svelte.d.ts +8 -0
- package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte +65 -21
- package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte.d.ts +3 -2
- package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte +45 -162
- package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte.d.ts +3 -2
- package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte +151 -0
- package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte.d.ts +17 -0
- package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte +177 -0
- package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte.d.ts +12 -0
- package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte +75 -0
- package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte.d.ts +8 -0
- package/dist/panel/components/sections/collection/folder/Folder.svelte +18 -3
- package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +26 -18
- package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +98 -58
- package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte.d.ts +0 -1
- package/dist/panel/components/sections/collection/folder/Folders.svelte +60 -0
- package/dist/panel/components/sections/collection/folder/Folders.svelte.d.ts +7 -0
- package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +31 -71
- package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte.d.ts +1 -0
- package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +5 -3
- package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +250 -37
- package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte.d.ts +2 -0
- package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +43 -18
- package/dist/panel/components/sections/collection/header/ButtonCreate.svelte.d.ts +6 -4
- package/dist/panel/components/sections/collection/header/DisplayMode.svelte +69 -58
- package/dist/panel/components/sections/collection/header/DisplayMode.svelte.d.ts +0 -1
- package/dist/panel/components/sections/collection/header/FilterMenu.svelte +60 -0
- package/dist/panel/components/sections/collection/header/FilterMenu.svelte.d.ts +14 -0
- package/dist/panel/components/sections/collection/header/SearchInput.svelte +17 -26
- package/dist/panel/components/sections/collection/header/SelectUI.svelte +19 -34
- package/dist/panel/components/sections/collection/list/CollectionList.svelte +99 -68
- package/dist/panel/components/sections/collection/list/columns.d.ts +21 -0
- package/dist/panel/components/sections/collection/list/columns.js +23 -0
- package/dist/panel/components/sections/collection/list/header/Header.svelte +99 -51
- package/dist/panel/components/sections/collection/list/row/Row.svelte +165 -82
- package/dist/panel/components/sections/collection/list/row/Row.svelte.d.ts +4 -0
- package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +92 -44
- package/dist/panel/components/sections/collection/tree/CollectionTree.svelte.d.ts +1 -0
- package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte +139 -43
- package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte.d.ts +2 -0
- package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +1 -1
- package/dist/panel/components/sections/commands/CommandButton.svelte +99 -0
- package/dist/panel/components/sections/commands/CommandButton.svelte.d.ts +10 -0
- package/dist/panel/components/sections/commands/CommandPalette.svelte +275 -0
- package/dist/panel/components/sections/commands/CommandPalette.svelte.d.ts +8 -0
- package/dist/panel/components/sections/commands/Commands.svelte +18 -0
- package/dist/panel/components/sections/commands/Commands.svelte.d.ts +9 -0
- package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte +23 -7
- package/dist/panel/components/sections/document/AuthFooter.svelte +31 -12
- package/dist/panel/components/sections/document/AutoSaveBanner.svelte +24 -7
- package/dist/panel/components/sections/document/ButtonSave.svelte +32 -21
- package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +5 -5
- package/dist/panel/components/sections/document/ButtonStatus.svelte +68 -20
- package/dist/panel/components/sections/document/ChangeSlugDialog.svelte +199 -0
- package/dist/panel/components/sections/document/ChangeSlugDialog.svelte.d.ts +10 -0
- package/dist/panel/components/sections/document/CurrentlyEdited.svelte +2 -2
- package/dist/panel/components/sections/document/Document.svelte +96 -65
- package/dist/panel/components/sections/document/DocumentChildren.svelte +175 -0
- package/dist/panel/components/sections/document/DocumentChildren.svelte.d.ts +8 -0
- package/dist/panel/components/sections/document/DocumentUrl.svelte +119 -0
- package/dist/panel/components/sections/document/DocumentUrl.svelte.d.ts +9 -0
- package/dist/panel/components/sections/document/Header.svelte +171 -94
- package/dist/panel/components/sections/document/Settings.svelte +255 -110
- package/dist/panel/components/sections/document/Settings.svelte.d.ts +0 -1
- package/dist/panel/components/sections/document/Versions.svelte +5 -3
- package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +112 -53
- package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte.d.ts +2 -2
- package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte +74 -41
- package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte.d.ts +1 -1
- package/dist/panel/components/sections/live/LiveEdit.svelte +2 -2
- package/dist/panel/components/sections/live/LiveFloatingUI.svelte +30 -11
- package/dist/panel/components/sections/live/live-edit-panel.css +2 -2
- package/dist/panel/components/sections/page-layout/Page.svelte +13 -1
- package/dist/panel/components/ui/breadcrumb/BreadCrumb.svelte +55 -27
- package/dist/panel/components/ui/button/button.svelte +81 -54
- package/dist/panel/components/ui/button/index.d.ts +7 -3
- package/dist/panel/components/ui/button/index.js +2 -2
- package/dist/panel/components/ui/calendar/calendar.css +27 -27
- package/dist/panel/components/ui/calendar/calendar.svelte.d.ts +1 -1
- package/dist/panel/components/ui/card/card-description.svelte +1 -1
- package/dist/panel/components/ui/card/card.svelte +21 -4
- package/dist/panel/components/ui/card-document/card-document.svelte +24 -12
- package/dist/panel/components/ui/card-resource/card-resource.svelte +26 -8
- package/dist/panel/components/ui/checkbox/checkbox.css +8 -10
- package/dist/panel/components/ui/command/command-dialog.css +28 -4
- package/dist/panel/components/ui/command/command-dialog.svelte +4 -1
- package/dist/panel/components/ui/command/command-dialog.svelte.d.ts +2 -0
- package/dist/panel/components/ui/command/command-empty.css +1 -1
- package/dist/panel/components/ui/command/command-group.css +3 -3
- package/dist/panel/components/ui/command/command-input-select.svelte +3 -3
- package/dist/panel/components/ui/command/command-input.svelte +38 -14
- package/dist/panel/components/ui/command/command-input.svelte.d.ts +6 -1
- package/dist/panel/components/ui/command/command-item.css +2 -2
- package/dist/panel/components/ui/command/command-list.css +1 -1
- package/dist/panel/components/ui/command/command-separator.css +1 -1
- package/dist/panel/components/ui/context-menu/context-menu-item.css +2 -2
- package/dist/panel/components/ui/context-menu/context-menu.css +6 -7
- package/dist/panel/components/ui/dialog/dialog-content.css +8 -10
- package/dist/panel/components/ui/dialog/dialog-content.svelte +19 -0
- package/dist/panel/components/ui/dialog/dialog-description.css +1 -1
- package/dist/panel/components/ui/dialog/dialog-footer.svelte +5 -1
- package/dist/panel/components/ui/dialog/dialog-overlay.css +1 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +19 -5
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.css +6 -4
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-item.css +1 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-radio-item.css +1 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-separator.css +1 -1
- package/dist/panel/components/ui/input/input.svelte +57 -31
- package/dist/panel/components/ui/kbd/Kbd.svelte +90 -0
- package/dist/panel/components/ui/kbd/Kbd.svelte.d.ts +11 -0
- package/dist/panel/components/ui/kbd/index.d.ts +1 -0
- package/dist/panel/components/ui/kbd/index.js +1 -0
- package/dist/panel/components/ui/label/label.css +5 -3
- package/dist/panel/components/ui/language-switcher/LanguageSwitcher.svelte +27 -15
- package/dist/panel/components/ui/nav/Nav.svelte +180 -110
- package/dist/panel/components/ui/nav/Nav.svelte.d.ts +0 -2
- package/dist/panel/components/ui/nav/NavGroup.svelte +87 -73
- package/dist/panel/components/ui/nav/NavItemButton.svelte +69 -29
- package/dist/panel/components/ui/nav/UserButton.svelte +132 -71
- package/dist/panel/components/ui/page-header/PageHeader.svelte +140 -42
- package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +8 -1
- package/dist/panel/components/ui/popover/popover-content.css +4 -3
- package/dist/panel/components/ui/radio-group/radio-group.css +4 -6
- package/dist/panel/components/ui/radio-row-group/radio-row-group.css +19 -7
- package/dist/panel/components/ui/scroll-area/scroll-area.css +2 -2
- package/dist/panel/components/ui/separator/separator.svelte +1 -1
- package/dist/panel/components/ui/sheet/index.d.ts +4 -4
- package/dist/panel/components/ui/sheet/index.js +5 -5
- package/dist/panel/components/ui/sheet/sheet.css +50 -11
- package/dist/panel/components/ui/sonner/sonner.css +11 -8
- package/dist/panel/components/ui/switch/switch.css +13 -18
- package/dist/panel/components/ui/tabs/tabs.css +44 -35
- package/dist/panel/components/ui/tag/tag.svelte +20 -6
- package/dist/panel/components/ui/tooltip/tooltip-content.svelte +14 -4
- package/dist/panel/components/ui/tree/tree-rows.css +146 -0
- package/dist/panel/context/blocks-ops.d.ts +78 -0
- package/dist/panel/context/blocks-ops.js +170 -0
- package/dist/panel/context/collection.svelte.d.ts +28 -0
- package/dist/panel/context/collection.svelte.js +120 -65
- package/dist/panel/context/commands.svelte.d.ts +80 -0
- package/dist/panel/context/commands.svelte.js +108 -0
- package/dist/panel/context/documentForm.svelte.d.ts +34 -2
- package/dist/panel/context/documentForm.svelte.js +105 -102
- package/dist/panel/context/live.svelte.js +2 -73
- package/dist/panel/context/nav.svelte.d.ts +23 -0
- package/dist/panel/context/nav.svelte.js +56 -0
- package/dist/panel/fonts/Geist-VariableFont_wght.ttf +0 -0
- package/dist/panel/fonts/GeistMono-VariableFont_wght.ttf +0 -0
- package/dist/panel/index.d.ts +7 -1
- package/dist/panel/index.js +10 -1
- package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +16 -1
- package/dist/panel/pages/collection/CollectionPage.svelte +236 -61
- package/dist/panel/pages/collection/load.server.js +1 -1
- package/dist/panel/pages/dashboard/Dashboard.svelte +135 -90
- package/dist/panel/pages/dashboard/DashboardCard.svelte +109 -0
- package/dist/panel/pages/dashboard/DashboardCard.svelte.d.ts +14 -0
- package/dist/panel/pages/dashboard/DashboardCollection.svelte +180 -57
- package/dist/panel/pages/dashboard/DashboardCollection.svelte.d.ts +1 -0
- package/dist/panel/pages/dashboard/DashboardRow.svelte +93 -0
- package/dist/panel/pages/dashboard/DashboardRow.svelte.d.ts +16 -0
- package/dist/panel/pages/dashboard/load.server.js +49 -25
- package/dist/panel/pages/dashboard/time.d.ts +19 -0
- package/dist/panel/pages/dashboard/time.js +29 -0
- package/dist/panel/pages/dashboard/types.d.ts +9 -2
- package/dist/panel/pages/live/Live.svelte +53 -50
- package/dist/panel/style/font.css +21 -32
- package/dist/panel/style/index.css +191 -122
- package/dist/panel/style/mixins/index.css +14 -0
- package/dist/panel/style/palette.css +35 -26
- package/dist/panel/style/postcss/size-function.d.ts +4 -0
- package/dist/panel/style/postcss/size-function.js +24 -0
- package/dist/panel/style/radius.css +4 -5
- package/dist/panel/style/scheme.css +111 -0
- package/dist/panel/style/size.css +3 -0
- package/dist/panel/util/Sortable.js +9 -4
- package/dist/panel/util/keys.d.ts +24 -0
- package/dist/panel/util/keys.js +63 -0
- package/dist/panel/util/populate.d.ts +8 -0
- package/dist/panel/util/populate.js +49 -0
- package/dist/panel/util/time.d.ts +12 -0
- package/dist/panel/util/time.js +35 -0
- package/dist/panel/util/upload-file.d.ts +106 -0
- package/dist/panel/util/upload-file.js +165 -0
- package/dist/util/index.d.ts +7 -10
- package/dist/util/index.js +7 -8
- package/dist/util/object.d.ts +10 -0
- package/dist/util/object.js +22 -1
- package/dist/util/string.d.ts +17 -0
- package/dist/util/string.js +23 -0
- package/package.json +1 -3
- package/dist/core/pipeline/config-map/build-tree-map.d.ts +0 -4
- package/dist/core/pipeline/config-map/build-tree-map.js +0 -30
- package/dist/core/prototype/doc.d.ts +0 -31
- package/dist/core/prototype/doc.js +0 -118
- package/dist/core/prototype/shared/url/augment.d.ts +0 -13
- package/dist/core/prototype/shared/url/augment.js +0 -11
- package/dist/core/prototype/shared/url/hooks/populate-url.server.d.ts +0 -4
- package/dist/core/prototype/shared/url/hooks/populate-url.server.js +0 -120
- package/dist/fields/rich-text/component/styles/rich-text.css +0 -183
- package/dist/panel/components/sections/collection/header/Header.svelte +0 -17
- package/dist/panel/components/sections/collection/header/Header.svelte.d.ts +0 -3
- package/dist/panel/components/sections/collection/header/Separator.svelte +0 -8
- package/dist/panel/components/sections/collection/header/Separator.svelte.d.ts +0 -26
- package/dist/panel/components/sections/collection/tree/util.d.ts +0 -12
- package/dist/panel/components/sections/collection/tree/util.js +0 -22
- package/dist/panel/fonts/ChivoMono-Italic-VariableFont_wght.ttf +0 -0
- package/dist/panel/fonts/ChivoMono-VariableFont_wght.ttf +0 -0
- package/dist/panel/fonts/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/dist/panel/fonts/Lora-Italic-VariableFont_wght.ttf +0 -0
- package/dist/panel/fonts/Lora-VariableFont_wght.ttf +0 -0
- package/dist/panel/style/shadow.css +0 -10
- package/dist/util/path.d.ts +0 -16
- package/dist/util/path.js +0 -19
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { invalidateAll } from '$app/navigation';
|
|
2
2
|
import { PARAMS } from '../../core/constants.js';
|
|
3
3
|
import { isFormField } from '../../core/fields/util.js';
|
|
4
|
+
import { walkFields } from '../../core/fields/walk.js';
|
|
4
5
|
import { directoriesKebab } from '../../core/prototype/collection/upload/naming.js';
|
|
5
6
|
import { isUploadConfig } from '../../core/prototype/collection/upload/util/config.js';
|
|
6
|
-
import { toNestedStructure } from '../../core/prototype/
|
|
7
|
+
import { toNestedStructure } from '../../core/prototype/collection/nested/tree.js';
|
|
7
8
|
import { apiUrl, panelUrl } from '../../core/routes/util.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
9
|
+
import { VERSIONS_STATUS } from '../../core/prototype/shared/versions/constant.js';
|
|
10
|
+
import { fileSizeBytes, mediaKind, MEDIA_KINDS } from '../util/upload-file.js';
|
|
10
11
|
import { trycatch, trycatchFetch } from '../../util/function.js';
|
|
11
12
|
import { getValueAtPath, hasProp } from '../../util/object.js';
|
|
12
|
-
import {
|
|
13
|
+
import { computeCommandScore } from 'bits-ui';
|
|
14
|
+
import { getContext, onMount, setContext, untrack } from 'svelte';
|
|
13
15
|
import { toast } from 'svelte-sonner';
|
|
14
|
-
//@ts-expect-error command-score has no types
|
|
15
|
-
import commandScore from 'command-score';
|
|
16
16
|
export const DISPLAY_MODE = {
|
|
17
17
|
LIST: 'display_list',
|
|
18
18
|
GRID: 'display_grid',
|
|
@@ -20,12 +20,14 @@ export const DISPLAY_MODE = {
|
|
|
20
20
|
};
|
|
21
21
|
function createCollectionStore(args) {
|
|
22
22
|
const { initial, config, canCreate, upload: incomingUpload } = args;
|
|
23
|
-
|
|
24
|
-
let
|
|
25
|
-
let sortingOrder = $state('asc');
|
|
23
|
+
// The latest edit first, until another order is picked.
|
|
24
|
+
let sortingOrder = $state('dsc');
|
|
26
25
|
let sortingBy = $state('updatedAt');
|
|
27
|
-
let
|
|
26
|
+
let initialDocs = $state.raw(initial);
|
|
27
|
+
let docs = $state(sorted([...initial]));
|
|
28
28
|
let selected = $state([]);
|
|
29
|
+
let statusFilter = $state('all');
|
|
30
|
+
let kindFilter = $state('all');
|
|
29
31
|
let displayMode = $state(DISPLAY_MODE.LIST);
|
|
30
32
|
let upload = $state({
|
|
31
33
|
directories: incomingUpload?.directories || [],
|
|
@@ -33,6 +35,8 @@ function createCollectionStore(args) {
|
|
|
33
35
|
parentDirectory: incomingUpload?.parentDirectory || null
|
|
34
36
|
});
|
|
35
37
|
let isFiltered = $state(false);
|
|
38
|
+
/** The search as typed. */
|
|
39
|
+
let query = '';
|
|
36
40
|
let stamp = $state(Date.now()); // Timestamp to invalidate on changes
|
|
37
41
|
const hasVersions = $derived(!!config.versions);
|
|
38
42
|
const hasDraft = $derived(config.versions && config.versions.draft);
|
|
@@ -45,44 +49,63 @@ function createCollectionStore(args) {
|
|
|
45
49
|
const localSortBy = localStorage.getItem(`collection.${config.slug}.sortBy`);
|
|
46
50
|
sortingBy = localSortBy || 'updatedAt';
|
|
47
51
|
const localSortOrder = localStorage.getItem(`collection.${config.slug}.sortOrder`);
|
|
48
|
-
sortingOrder = localSortOrder || '
|
|
52
|
+
sortingOrder = localSortOrder || 'dsc';
|
|
49
53
|
if (localSortBy) {
|
|
50
54
|
sortBy(sortingBy, false);
|
|
51
55
|
}
|
|
52
56
|
});
|
|
53
|
-
$effect(() => {
|
|
54
|
-
if (!selectMode)
|
|
55
|
-
selected = [];
|
|
56
|
-
});
|
|
57
57
|
const nested = $derived.by(() => {
|
|
58
58
|
return toNestedStructure(docs);
|
|
59
59
|
});
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
/** An upload collection shows the files of the folder on screen; any other, all of them. */
|
|
61
|
+
const inFolder = (doc) => !config.upload || doc._path === upload.currentPath;
|
|
62
|
+
const ofStatus = (doc) => statusFilter === 'all' || doc.status === statusFilter;
|
|
63
|
+
const ofKind = (doc) => kindFilter === 'all' || mediaKind(doc.mimeType) === kindFilter;
|
|
64
|
+
/** The documents on screen: the search's, in the folder, of the status and the kind picked. */
|
|
65
|
+
const shown = $derived(docs.filter((doc) => inFolder(doc) && ofStatus(doc) && ofKind(doc)));
|
|
66
|
+
/** The kinds of file the collection holds, in a fixed order. */
|
|
67
|
+
const kinds = $derived.by(() => {
|
|
68
|
+
const present = new Set(initialDocs.map((doc) => mediaKind(doc.mimeType)));
|
|
69
|
+
return MEDIA_KINDS.filter((kind) => present.has(kind));
|
|
70
|
+
});
|
|
71
|
+
const draftsCount = $derived(hasDraft ? initialDocs.filter((doc) => doc.status === VERSIONS_STATUS.DRAFT).length : 0);
|
|
72
|
+
/** What the files weigh together, in bytes. */
|
|
73
|
+
const totalSize = $derived(initialDocs.reduce((sum, doc) => sum + (fileSizeBytes(doc.filesize) ?? 0), 0));
|
|
74
|
+
/** Where a slug field sits, when the collection has one. */
|
|
75
|
+
const slugPath = [...walkFields(config.fields, { determinate: true })].find(({ field }) => field.type === 'slug')?.path;
|
|
76
|
+
/**
|
|
77
|
+
* The path of a document, after its title: the pathname of its url, else its slug.
|
|
78
|
+
*
|
|
79
|
+
* ```ts
|
|
80
|
+
* pathOf({ url: 'https://site.com/studio' }) // '/studio'
|
|
81
|
+
* pathOf({ attributes: { slug: 'studio' } }) // 'studio'
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
function pathOf(doc) {
|
|
85
|
+
if (!config.upload && typeof doc.url === 'string' && doc.url) {
|
|
86
|
+
try {
|
|
87
|
+
return new URL(doc.url, 'http://localhost').pathname;
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return doc.url;
|
|
67
91
|
}
|
|
92
|
+
}
|
|
93
|
+
const slug = slugPath ? getValueAtPath(slugPath, doc) : null;
|
|
94
|
+
return typeof slug === 'string' ? slug : '';
|
|
95
|
+
}
|
|
96
|
+
/** Every field marked `table()`, at a path a config alone can name. */
|
|
97
|
+
const buildFieldColumns = (fields) => {
|
|
98
|
+
const columns = [];
|
|
99
|
+
for (const { field, path } of walkFields(fields, { determinate: true })) {
|
|
68
100
|
if (isFormField(field) && hasProp('table', field.get)) {
|
|
69
|
-
|
|
70
|
-
const path = parentPath ? `${parentPath}.${field.name}` : field.name;
|
|
71
|
-
// Create column
|
|
72
|
-
const column = {
|
|
101
|
+
columns.push({
|
|
73
102
|
type: field.type,
|
|
103
|
+
name: field.name,
|
|
104
|
+
label: field.get.label,
|
|
74
105
|
path,
|
|
75
106
|
cell: field.get.table.cell || field.cell,
|
|
76
107
|
table: field.get.table
|
|
77
|
-
};
|
|
78
|
-
columns.push(column);
|
|
79
|
-
}
|
|
80
|
-
else if (field instanceof TabsBuilder) {
|
|
81
|
-
for (const tab of field.get.tabs) {
|
|
82
|
-
// For tab fields, create a path with the tab name
|
|
83
|
-
const path = parentPath ? `${parentPath}.${tab.name}` : tab.name;
|
|
84
|
-
columns = [...columns, ...buildFieldColumns(tab.get.fields, path)];
|
|
85
|
-
}
|
|
108
|
+
});
|
|
86
109
|
}
|
|
87
110
|
}
|
|
88
111
|
return columns;
|
|
@@ -100,6 +123,19 @@ function createCollectionStore(args) {
|
|
|
100
123
|
return { ...col, table: tableConfig };
|
|
101
124
|
})
|
|
102
125
|
.sort((a, b) => a.table.position - b.table.position);
|
|
126
|
+
/** The documents in the order picked, by `sortingBy` then `sortingOrder`. */
|
|
127
|
+
function sorted(list) {
|
|
128
|
+
const orderMult = sortingOrder === 'asc' ? 1 : -1;
|
|
129
|
+
return list.sort((a, b) => {
|
|
130
|
+
if (a[sortingBy] < b[sortingBy]) {
|
|
131
|
+
return -1 * orderMult;
|
|
132
|
+
}
|
|
133
|
+
if (a[sortingBy] > b[sortingBy]) {
|
|
134
|
+
return 1 * orderMult;
|
|
135
|
+
}
|
|
136
|
+
return 0;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
103
139
|
const sortBy = (fieldName, toggle = true) => {
|
|
104
140
|
if (sortingBy === fieldName) {
|
|
105
141
|
if (toggle) {
|
|
@@ -110,17 +146,7 @@ function createCollectionStore(args) {
|
|
|
110
146
|
// Else sort by field asc
|
|
111
147
|
sortingBy = fieldName;
|
|
112
148
|
}
|
|
113
|
-
|
|
114
|
-
const orderMult = sortingOrder === 'asc' ? 1 : -1;
|
|
115
|
-
docs = docs.sort((a, b) => {
|
|
116
|
-
if (a[fieldName] < b[fieldName]) {
|
|
117
|
-
return -1 * orderMult;
|
|
118
|
-
}
|
|
119
|
-
if (a[fieldName] > b[fieldName]) {
|
|
120
|
-
return 1 * orderMult;
|
|
121
|
-
}
|
|
122
|
-
return 0;
|
|
123
|
-
});
|
|
149
|
+
docs = sorted(docs);
|
|
124
150
|
// Save to local storage
|
|
125
151
|
localStorage.setItem(`collection.${config.slug}.sortBy`, fieldName);
|
|
126
152
|
localStorage.setItem(`collection.${config.slug}.sortOrder`, sortingOrder);
|
|
@@ -258,18 +284,15 @@ function createCollectionStore(args) {
|
|
|
258
284
|
}
|
|
259
285
|
}
|
|
260
286
|
function selectAll() {
|
|
261
|
-
|
|
262
|
-
selected = docs.filter((doc) => doc._path === upload.currentPath).map((doc) => doc.id);
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
selected = docs.map((doc) => doc.id);
|
|
266
|
-
}
|
|
287
|
+
selected = shown.map((doc) => doc.id);
|
|
267
288
|
}
|
|
268
289
|
async function deleteSelection() {
|
|
269
|
-
|
|
270
|
-
|
|
290
|
+
const ids = selected;
|
|
291
|
+
selected = [];
|
|
292
|
+
await deleteDocs(ids);
|
|
271
293
|
}
|
|
272
294
|
function filterBy(inputValue) {
|
|
295
|
+
query = inputValue;
|
|
273
296
|
if (inputValue !== '') {
|
|
274
297
|
isFiltered = true;
|
|
275
298
|
const scores = [];
|
|
@@ -277,7 +300,7 @@ function createCollectionStore(args) {
|
|
|
277
300
|
const asTitle = getValueAtPath(config.asTitle, doc);
|
|
278
301
|
if (!asTitle)
|
|
279
302
|
continue;
|
|
280
|
-
const score =
|
|
303
|
+
const score = computeCommandScore(asTitle, inputValue);
|
|
281
304
|
if (score > 0) {
|
|
282
305
|
scores.push({
|
|
283
306
|
doc,
|
|
@@ -299,7 +322,7 @@ function createCollectionStore(args) {
|
|
|
299
322
|
}
|
|
300
323
|
else {
|
|
301
324
|
isFiltered = false;
|
|
302
|
-
docs = [...initialDocs];
|
|
325
|
+
docs = sorted([...initialDocs]);
|
|
303
326
|
}
|
|
304
327
|
}
|
|
305
328
|
return {
|
|
@@ -357,22 +380,52 @@ function createCollectionStore(args) {
|
|
|
357
380
|
set selected(value) {
|
|
358
381
|
selected = value;
|
|
359
382
|
},
|
|
383
|
+
/** On while a document is checked; turning it off drops the selection. */
|
|
360
384
|
get selectMode() {
|
|
361
|
-
return
|
|
385
|
+
return selected.length > 0;
|
|
362
386
|
},
|
|
363
387
|
set selectMode(bool) {
|
|
364
|
-
|
|
388
|
+
if (!bool)
|
|
389
|
+
selected = [];
|
|
365
390
|
},
|
|
366
391
|
get isAllSelected() {
|
|
367
|
-
|
|
368
|
-
return selected.length === docs.filter((d) => d._path === upload.currentPath).length;
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
return selected.length === docs.length;
|
|
372
|
-
}
|
|
392
|
+
return shown.length > 0 && shown.every((doc) => selected.includes(doc.id));
|
|
373
393
|
},
|
|
374
394
|
deleteSelection,
|
|
375
395
|
filterBy,
|
|
396
|
+
/** The documents on screen, after the search, the folder and the filters. */
|
|
397
|
+
get shown() {
|
|
398
|
+
return shown;
|
|
399
|
+
},
|
|
400
|
+
/** A filter change drops the selection, so no hidden document stays picked. */
|
|
401
|
+
get statusFilter() {
|
|
402
|
+
return statusFilter;
|
|
403
|
+
},
|
|
404
|
+
set statusFilter(value) {
|
|
405
|
+
statusFilter = value;
|
|
406
|
+
selected = [];
|
|
407
|
+
},
|
|
408
|
+
get kindFilter() {
|
|
409
|
+
return kindFilter;
|
|
410
|
+
},
|
|
411
|
+
set kindFilter(value) {
|
|
412
|
+
kindFilter = value;
|
|
413
|
+
selected = [];
|
|
414
|
+
},
|
|
415
|
+
get kinds() {
|
|
416
|
+
return kinds;
|
|
417
|
+
},
|
|
418
|
+
get draftsCount() {
|
|
419
|
+
return draftsCount;
|
|
420
|
+
},
|
|
421
|
+
get totalSize() {
|
|
422
|
+
return totalSize;
|
|
423
|
+
},
|
|
424
|
+
/** Every document of the collection, whatever the search. */
|
|
425
|
+
get total() {
|
|
426
|
+
return initialDocs.length;
|
|
427
|
+
},
|
|
428
|
+
pathOf,
|
|
376
429
|
get isUpload() {
|
|
377
430
|
return isUploadConfig(config);
|
|
378
431
|
},
|
|
@@ -389,8 +442,10 @@ function createCollectionStore(args) {
|
|
|
389
442
|
get docs() {
|
|
390
443
|
return docs;
|
|
391
444
|
},
|
|
445
|
+
/** A reload: the search runs again over the new documents, in the order picked. */
|
|
392
446
|
set docs(value) {
|
|
393
|
-
|
|
447
|
+
initialDocs = value;
|
|
448
|
+
untrack(() => filterBy(query));
|
|
394
449
|
stamp = Date.now();
|
|
395
450
|
},
|
|
396
451
|
get length() {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { IconProps } from '@lucide/svelte';
|
|
2
|
+
import { type Component } from 'svelte';
|
|
3
|
+
/** One thing the user can do where they are: a palette line, a key, or both. */
|
|
4
|
+
export type Command = {
|
|
5
|
+
/** `document.save`, `blocks.duplicate`, `text.bold` */
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
/** The palette's heading: `Document`, `Block`, `Add`, `Go to`, `Text` */
|
|
9
|
+
group?: string;
|
|
10
|
+
/** On the palette line, before the label. */
|
|
11
|
+
icon?: Component<IconProps>;
|
|
12
|
+
/** `mod+s`, `alt+arrowup`, `backspace`, `/`. `mod` is ⌘ on a Mac, Ctrl elsewhere. */
|
|
13
|
+
keys?: string;
|
|
14
|
+
/** Fires while a field has the keyboard. Off, the field keeps the key. */
|
|
15
|
+
inField?: boolean;
|
|
16
|
+
/** Keys only, not a palette line: the arrows. */
|
|
17
|
+
hidden?: boolean;
|
|
18
|
+
/** Offered right now. A command that is not is skipped, keys and palette alike. */
|
|
19
|
+
when?: () => boolean;
|
|
20
|
+
/** From a key, the event; from the palette, nothing. */
|
|
21
|
+
run: (event?: KeyboardEvent) => unknown;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The commands a mounted component offers, read when a key comes or the palette opens. `depth`
|
|
25
|
+
* is how many scopes it sits inside; `order` breaks a tie, the latest mounted first.
|
|
26
|
+
*/
|
|
27
|
+
type Scope = {
|
|
28
|
+
get: () => Command[];
|
|
29
|
+
depth: number;
|
|
30
|
+
order: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* One dispatcher for every key of the panel, and one palette. Components nest their scopes; a key
|
|
34
|
+
* goes to the innermost scope that claims it, and the palette lists them all, the innermost
|
|
35
|
+
* first, so what the page offers comes before what the panel offers.
|
|
36
|
+
*/
|
|
37
|
+
export declare function setCommandsContext(): {
|
|
38
|
+
register: (scope: Omit<Scope, "order">) => () => void;
|
|
39
|
+
dispatch: (event: KeyboardEvent) => void;
|
|
40
|
+
palette: {
|
|
41
|
+
open: boolean;
|
|
42
|
+
query: string;
|
|
43
|
+
readonly group: string | null;
|
|
44
|
+
/** The commands on offer when the palette opened; the dialog takes the focus, they stay. */
|
|
45
|
+
readonly commands: Command[];
|
|
46
|
+
show(options?: {
|
|
47
|
+
group?: string;
|
|
48
|
+
}): void;
|
|
49
|
+
toggle(): void;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export type CommandsContext = ReturnType<typeof setCommandsContext>;
|
|
53
|
+
export declare function getCommandsContext(): {
|
|
54
|
+
register: (scope: Omit<Scope, "order">) => () => void;
|
|
55
|
+
dispatch: (event: KeyboardEvent) => void;
|
|
56
|
+
palette: {
|
|
57
|
+
open: boolean;
|
|
58
|
+
query: string;
|
|
59
|
+
readonly group: string | null;
|
|
60
|
+
/** The commands on offer when the palette opened; the dialog takes the focus, they stay. */
|
|
61
|
+
readonly commands: Command[];
|
|
62
|
+
show(options?: {
|
|
63
|
+
group?: string;
|
|
64
|
+
}): void;
|
|
65
|
+
toggle(): void;
|
|
66
|
+
};
|
|
67
|
+
} | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* The commands a component offers while it is mounted. Outside the panel, nothing listens.
|
|
70
|
+
*
|
|
71
|
+
* Its depth is one more than the scope it sits in, and the components under it sit one deeper:
|
|
72
|
+
*
|
|
73
|
+
* Document 1 > BlocksFocus 2 > RichText 3
|
|
74
|
+
*
|
|
75
|
+
* `depth: 0` puts it with the panel's own, below every page: the language, the navigation.
|
|
76
|
+
*/
|
|
77
|
+
export declare function useCommands(get: () => Command[], options?: {
|
|
78
|
+
depth?: number;
|
|
79
|
+
}): void;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { isTyping, matches, parseKeys } from '../util/keys.js';
|
|
2
|
+
import { getContext, setContext } from 'svelte';
|
|
3
|
+
const KEY = Symbol('rime.commands');
|
|
4
|
+
const DEPTH = Symbol('rime.commands.depth');
|
|
5
|
+
/**
|
|
6
|
+
* One dispatcher for every key of the panel, and one palette. Components nest their scopes; a key
|
|
7
|
+
* goes to the innermost scope that claims it, and the palette lists them all, the innermost
|
|
8
|
+
* first, so what the page offers comes before what the panel offers.
|
|
9
|
+
*/
|
|
10
|
+
export function setCommandsContext() {
|
|
11
|
+
// Read on a key and when the palette opens, never by a derived: a plain array, so registering
|
|
12
|
+
// from an effect does not re-run that effect.
|
|
13
|
+
let scopes = [];
|
|
14
|
+
let open = $state(false);
|
|
15
|
+
let query = $state('');
|
|
16
|
+
let group = $state(null);
|
|
17
|
+
let listed = $state.raw([]);
|
|
18
|
+
let mounted = 0;
|
|
19
|
+
function register(scope) {
|
|
20
|
+
const entry = { ...scope, order: mounted++ };
|
|
21
|
+
scopes = [...scopes, entry];
|
|
22
|
+
return () => {
|
|
23
|
+
scopes = scopes.filter((candidate) => candidate !== entry);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** What is offered right now, innermost scope first. */
|
|
27
|
+
function available() {
|
|
28
|
+
return scopes
|
|
29
|
+
.toSorted((a, b) => b.depth - a.depth || b.order - a.order)
|
|
30
|
+
.flatMap((scope) => scope.get())
|
|
31
|
+
.filter((command) => !command.when || command.when());
|
|
32
|
+
}
|
|
33
|
+
function dispatch(event) {
|
|
34
|
+
// Taken already: a dialog closing on Escape, an editor's own shortcut.
|
|
35
|
+
if (event.defaultPrevented)
|
|
36
|
+
return;
|
|
37
|
+
const typing = isTyping(event);
|
|
38
|
+
for (const command of available()) {
|
|
39
|
+
if (!command.keys || !matches(event, parseKeys(command.keys)))
|
|
40
|
+
continue;
|
|
41
|
+
if (typing && !command.inField)
|
|
42
|
+
continue;
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
command.run(event);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const palette = {
|
|
49
|
+
get open() {
|
|
50
|
+
return open;
|
|
51
|
+
},
|
|
52
|
+
set open(value) {
|
|
53
|
+
open = value;
|
|
54
|
+
if (!value)
|
|
55
|
+
group = null;
|
|
56
|
+
},
|
|
57
|
+
get query() {
|
|
58
|
+
return query;
|
|
59
|
+
},
|
|
60
|
+
set query(value) {
|
|
61
|
+
query = value;
|
|
62
|
+
},
|
|
63
|
+
get group() {
|
|
64
|
+
return group;
|
|
65
|
+
},
|
|
66
|
+
/** The commands on offer when the palette opened; the dialog takes the focus, they stay. */
|
|
67
|
+
get commands() {
|
|
68
|
+
return listed;
|
|
69
|
+
},
|
|
70
|
+
show(options = {}) {
|
|
71
|
+
listed = available().filter((command) => !command.hidden);
|
|
72
|
+
group = options.group ?? null;
|
|
73
|
+
query = '';
|
|
74
|
+
open = true;
|
|
75
|
+
},
|
|
76
|
+
toggle() {
|
|
77
|
+
if (open)
|
|
78
|
+
palette.open = false;
|
|
79
|
+
else
|
|
80
|
+
palette.show();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return setContext(KEY, { register, dispatch, palette });
|
|
84
|
+
}
|
|
85
|
+
export function getCommandsContext() {
|
|
86
|
+
return getContext(KEY);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The commands a component offers while it is mounted. Outside the panel, nothing listens.
|
|
90
|
+
*
|
|
91
|
+
* Its depth is one more than the scope it sits in, and the components under it sit one deeper:
|
|
92
|
+
*
|
|
93
|
+
* Document 1 > BlocksFocus 2 > RichText 3
|
|
94
|
+
*
|
|
95
|
+
* `depth: 0` puts it with the panel's own, below every page: the language, the navigation.
|
|
96
|
+
*/
|
|
97
|
+
export function useCommands(get, options = {}) {
|
|
98
|
+
const commands = getCommandsContext();
|
|
99
|
+
if (!commands)
|
|
100
|
+
return;
|
|
101
|
+
let depth = options.depth;
|
|
102
|
+
if (depth === undefined) {
|
|
103
|
+
depth = (getContext(DEPTH) ?? 0) + 1;
|
|
104
|
+
setContext(DEPTH, depth);
|
|
105
|
+
}
|
|
106
|
+
const scope = { get, depth };
|
|
107
|
+
$effect(() => commands.register(scope));
|
|
108
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { BuiltAreaClient, BuiltCollectionClient } from '../../core/config/types.js';
|
|
2
2
|
import type { FormFieldBuilder } from '../../core/fields/builders/index.js';
|
|
3
3
|
import type { AreaSlug, GenericBlock, GenericDoc, TreeBlock } from '../../core/prototype/types.js';
|
|
4
|
+
import type { BlocksBuilder } from '../../fields/blocks/index.js';
|
|
4
5
|
import type { FormField } from '../../types.js';
|
|
5
6
|
import type { Dic, WithOptional } from '../../util/types.js';
|
|
7
|
+
import { type BlockAt, type NewBlock } from './blocks-ops.js';
|
|
6
8
|
export declare function setDocumentFormContext<T extends WithOptional<GenericDoc, 'id'>>(args: Args<T>): {
|
|
7
9
|
key: string;
|
|
8
10
|
setValue: (path: string, value: any) => void;
|
|
@@ -30,13 +32,28 @@ export declare function setDocumentFormContext<T extends WithOptional<GenericDoc
|
|
|
30
32
|
readonly blocks: GenericBlock[];
|
|
31
33
|
};
|
|
32
34
|
useTree: (path: string) => {
|
|
33
|
-
addItem: (emptyFields: Dic) => void;
|
|
35
|
+
addItem: (emptyFields: Dic, atPath?: string) => void;
|
|
34
36
|
moveItem: (fromPath: string, toPath: string) => void;
|
|
35
37
|
deleteItem: (atPath: string, index: number) => void;
|
|
36
38
|
path: string;
|
|
37
39
|
readonly stamp: string;
|
|
38
40
|
readonly items: TreeBlock[];
|
|
39
41
|
};
|
|
42
|
+
blocks: {
|
|
43
|
+
list(list: string): GenericBlock[];
|
|
44
|
+
/** The `BlocksBuilder` a list path names, read through the document for the block types. */
|
|
45
|
+
builder(list: string): BlocksBuilder | undefined;
|
|
46
|
+
/** Whether the list's block set has this type. */
|
|
47
|
+
accepts(list: string, type: string): boolean;
|
|
48
|
+
insert(at: BlockAt, block: NewBlock): string;
|
|
49
|
+
remove(path: string): void;
|
|
50
|
+
duplicate(path: string): string | null;
|
|
51
|
+
move(from: string, to: BlockAt): void;
|
|
52
|
+
/** Copies the block to the clipboard, and keeps it here for a browser that refuses to read back. */
|
|
53
|
+
copy(path: string): Promise<void>;
|
|
54
|
+
/** Pastes the copied block at `at`. `null` when there is none, or the list refuses its type. */
|
|
55
|
+
paste(at: BlockAt): Promise<string | null>;
|
|
56
|
+
};
|
|
40
57
|
nestedLevel: number;
|
|
41
58
|
buildPanelActionUrl: () => string;
|
|
42
59
|
readOnly: boolean;
|
|
@@ -100,13 +117,28 @@ export declare function getDocumentFormContext<T extends WithOptional<GenericDoc
|
|
|
100
117
|
readonly blocks: GenericBlock[];
|
|
101
118
|
};
|
|
102
119
|
useTree: (path: string) => {
|
|
103
|
-
addItem: (emptyFields: Dic) => void;
|
|
120
|
+
addItem: (emptyFields: Dic, atPath?: string) => void;
|
|
104
121
|
moveItem: (fromPath: string, toPath: string) => void;
|
|
105
122
|
deleteItem: (atPath: string, index: number) => void;
|
|
106
123
|
path: string;
|
|
107
124
|
readonly stamp: string;
|
|
108
125
|
readonly items: TreeBlock[];
|
|
109
126
|
};
|
|
127
|
+
blocks: {
|
|
128
|
+
list(list: string): GenericBlock[];
|
|
129
|
+
/** The `BlocksBuilder` a list path names, read through the document for the block types. */
|
|
130
|
+
builder(list: string): BlocksBuilder | undefined;
|
|
131
|
+
/** Whether the list's block set has this type. */
|
|
132
|
+
accepts(list: string, type: string): boolean;
|
|
133
|
+
insert(at: BlockAt, block: NewBlock): string;
|
|
134
|
+
remove(path: string): void;
|
|
135
|
+
duplicate(path: string): string | null;
|
|
136
|
+
move(from: string, to: BlockAt): void;
|
|
137
|
+
/** Copies the block to the clipboard, and keeps it here for a browser that refuses to read back. */
|
|
138
|
+
copy(path: string): Promise<void>;
|
|
139
|
+
/** Pastes the copied block at `at`. `null` when there is none, or the list refuses its type. */
|
|
140
|
+
paste(at: BlockAt): Promise<string | null>;
|
|
141
|
+
};
|
|
110
142
|
nestedLevel: number;
|
|
111
143
|
buildPanelActionUrl: () => string;
|
|
112
144
|
readOnly: boolean;
|