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
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { GenericBlock } from '../../../../core/prototype/types.js';
|
|
2
|
+
import type { BlocksBuilder, BlocksFieldBlock } from '../../index.js';
|
|
3
|
+
import { type BlockAt } from '../../../../panel/context/blocks-ops.js';
|
|
4
|
+
import type { DocumentFormContext } from '../../../../panel/context/documentForm.svelte.js';
|
|
5
|
+
/** The query parameter that names the list focus is open on: `?focus=layout.sections`. */
|
|
6
|
+
export declare const FOCUS_PARAM = "focus";
|
|
7
|
+
export type SidebarTab = 'layers' | 'inspector' | 'add';
|
|
8
|
+
/** One step of the way down to the open list: a blocks field, or the block an index names. */
|
|
9
|
+
export type Crumb = {
|
|
10
|
+
label: string;
|
|
11
|
+
list: string;
|
|
12
|
+
block?: string;
|
|
13
|
+
};
|
|
14
|
+
/** One row of the layers: a block, where it sits, and the lists it holds. */
|
|
15
|
+
export type LayerRow = {
|
|
16
|
+
/** The block's path, `sections.0.items.2`. */
|
|
17
|
+
path: string;
|
|
18
|
+
list: string;
|
|
19
|
+
index: number;
|
|
20
|
+
depth: number;
|
|
21
|
+
block: GenericBlock;
|
|
22
|
+
config: BlocksFieldBlock | undefined;
|
|
23
|
+
title: string;
|
|
24
|
+
/** One entry per `blocks` field of the block. */
|
|
25
|
+
children: {
|
|
26
|
+
list: string;
|
|
27
|
+
builder: BlocksBuilder;
|
|
28
|
+
label: string;
|
|
29
|
+
}[];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The focus mode of one blocks field: which list it is open on, which blocks are selected, which
|
|
33
|
+
* rows are folded. The document form is the only state it writes to; a page reload with
|
|
34
|
+
* `?focus=` in the address reopens it.
|
|
35
|
+
*
|
|
36
|
+
* The selection drives the stage: a block, or nothing, which is the root node of the layers and
|
|
37
|
+
* shows the whole list.
|
|
38
|
+
*
|
|
39
|
+
* A focus opened from the field rides in `page.state`, so Escape, the close button and the back
|
|
40
|
+
* button all do the same thing. One opened by the address has no history entry of its own: the
|
|
41
|
+
* router is not ready for one while the page mounts, and closing it rewrites the address instead.
|
|
42
|
+
*/
|
|
43
|
+
export declare function setBlocksFocusContext(form: DocumentFormContext): {
|
|
44
|
+
readonly path: string | null;
|
|
45
|
+
readonly selection: string[];
|
|
46
|
+
readonly current: BlockAt | null;
|
|
47
|
+
readonly currentRow: LayerRow | null;
|
|
48
|
+
readonly locked: boolean;
|
|
49
|
+
tab: SidebarTab;
|
|
50
|
+
readonly inspected: number;
|
|
51
|
+
/** Turns the panel to the selected block's fields, and opens it where it is a sheet. */
|
|
52
|
+
inspect(): void;
|
|
53
|
+
picking: boolean;
|
|
54
|
+
/** Opens the picker of types to add; the one picked goes after the selection. */
|
|
55
|
+
pick(): void;
|
|
56
|
+
/** The open list's block set has at least one render: the stage is the stack of renders. */
|
|
57
|
+
readonly hasRenders: boolean;
|
|
58
|
+
/** Nothing selected: the root node, and the whole list on the stage. */
|
|
59
|
+
readonly rootSelected: boolean;
|
|
60
|
+
rootLabel: () => string;
|
|
61
|
+
selectRoot: () => void;
|
|
62
|
+
breadcrumb: () => Crumb[];
|
|
63
|
+
isSelected: (rowPath: string) => boolean;
|
|
64
|
+
isCollapsed: (rowPath: string) => boolean;
|
|
65
|
+
open: (list: string, selected?: string) => void;
|
|
66
|
+
close: () => void;
|
|
67
|
+
rowsOf: (list: string, depth?: number) => LayerRow[];
|
|
68
|
+
allRows: () => LayerRow[];
|
|
69
|
+
visibleRows: () => LayerRow[];
|
|
70
|
+
moveTargets: () => {
|
|
71
|
+
list: string;
|
|
72
|
+
label: string;
|
|
73
|
+
}[];
|
|
74
|
+
select: (rowPath: string, options?: {
|
|
75
|
+
extend?: boolean;
|
|
76
|
+
}) => void;
|
|
77
|
+
selectRelative: (delta: number, extend?: boolean) => void;
|
|
78
|
+
insertionPoint: () => BlockAt | null;
|
|
79
|
+
insertType: (type: string, at?: BlockAt | null) => string | null;
|
|
80
|
+
duplicateSelection: () => void;
|
|
81
|
+
removeSelection: () => void;
|
|
82
|
+
moveSelection: (delta: number) => void;
|
|
83
|
+
moveSelectionInto: (list: string) => void;
|
|
84
|
+
copySelection: () => Promise<void>;
|
|
85
|
+
pasteAfterSelection: () => Promise<string | null>;
|
|
86
|
+
setCollapsed: (rowPath: string, value: boolean) => void;
|
|
87
|
+
toggleCollapsed: (rowPath: string) => void;
|
|
88
|
+
collapseAll: () => void;
|
|
89
|
+
expandAll: () => void;
|
|
90
|
+
};
|
|
91
|
+
export type BlocksFocus = ReturnType<typeof setBlocksFocusContext>;
|
|
92
|
+
/** The focus of the document on screen, or nothing in a form that has none: a nested create. */
|
|
93
|
+
export declare const getBlocksFocusContext: () => {
|
|
94
|
+
readonly path: string | null;
|
|
95
|
+
readonly selection: string[];
|
|
96
|
+
readonly current: BlockAt | null;
|
|
97
|
+
readonly currentRow: LayerRow | null;
|
|
98
|
+
readonly locked: boolean;
|
|
99
|
+
tab: SidebarTab;
|
|
100
|
+
readonly inspected: number;
|
|
101
|
+
/** Turns the panel to the selected block's fields, and opens it where it is a sheet. */
|
|
102
|
+
inspect(): void;
|
|
103
|
+
picking: boolean;
|
|
104
|
+
/** Opens the picker of types to add; the one picked goes after the selection. */
|
|
105
|
+
pick(): void;
|
|
106
|
+
/** The open list's block set has at least one render: the stage is the stack of renders. */
|
|
107
|
+
readonly hasRenders: boolean;
|
|
108
|
+
/** Nothing selected: the root node, and the whole list on the stage. */
|
|
109
|
+
readonly rootSelected: boolean;
|
|
110
|
+
rootLabel: () => string;
|
|
111
|
+
selectRoot: () => void;
|
|
112
|
+
breadcrumb: () => Crumb[];
|
|
113
|
+
isSelected: (rowPath: string) => boolean;
|
|
114
|
+
isCollapsed: (rowPath: string) => boolean;
|
|
115
|
+
open: (list: string, selected?: string) => void;
|
|
116
|
+
close: () => void;
|
|
117
|
+
rowsOf: (list: string, depth?: number) => LayerRow[];
|
|
118
|
+
allRows: () => LayerRow[];
|
|
119
|
+
visibleRows: () => LayerRow[];
|
|
120
|
+
moveTargets: () => {
|
|
121
|
+
list: string;
|
|
122
|
+
label: string;
|
|
123
|
+
}[];
|
|
124
|
+
select: (rowPath: string, options?: {
|
|
125
|
+
extend?: boolean;
|
|
126
|
+
}) => void;
|
|
127
|
+
selectRelative: (delta: number, extend?: boolean) => void;
|
|
128
|
+
insertionPoint: () => BlockAt | null;
|
|
129
|
+
insertType: (type: string, at?: BlockAt | null) => string | null;
|
|
130
|
+
duplicateSelection: () => void;
|
|
131
|
+
removeSelection: () => void;
|
|
132
|
+
moveSelection: (delta: number) => void;
|
|
133
|
+
moveSelectionInto: (list: string) => void;
|
|
134
|
+
copySelection: () => Promise<void>;
|
|
135
|
+
pasteAfterSelection: () => Promise<string | null>;
|
|
136
|
+
setCollapsed: (rowPath: string, value: boolean) => void;
|
|
137
|
+
toggleCollapsed: (rowPath: string) => void;
|
|
138
|
+
collapseAll: () => void;
|
|
139
|
+
expandAll: () => void;
|
|
140
|
+
} | undefined;
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { pushState, replaceState } from '$app/navigation';
|
|
2
|
+
import { page } from '$app/state';
|
|
3
|
+
import { emptyValuesFromFieldConfig } from '../../../../core/fields/util.js';
|
|
4
|
+
import { blockPath, parseBlockPath, shiftListPath } from '../../../../panel/context/blocks-ops.js';
|
|
5
|
+
import { capitalize } from '../../../../util/string.js';
|
|
6
|
+
import { getContext, setContext } from 'svelte';
|
|
7
|
+
import { SvelteSet } from 'svelte/reactivity';
|
|
8
|
+
const KEY = 'rime.blocks-focus';
|
|
9
|
+
/** The query parameter that names the list focus is open on: `?focus=layout.sections`. */
|
|
10
|
+
export const FOCUS_PARAM = 'focus';
|
|
11
|
+
/**
|
|
12
|
+
* The focus mode of one blocks field: which list it is open on, which blocks are selected, which
|
|
13
|
+
* rows are folded. The document form is the only state it writes to; a page reload with
|
|
14
|
+
* `?focus=` in the address reopens it.
|
|
15
|
+
*
|
|
16
|
+
* The selection drives the stage: a block, or nothing, which is the root node of the layers and
|
|
17
|
+
* shows the whole list.
|
|
18
|
+
*
|
|
19
|
+
* A focus opened from the field rides in `page.state`, so Escape, the close button and the back
|
|
20
|
+
* button all do the same thing. One opened by the address has no history entry of its own: the
|
|
21
|
+
* router is not ready for one while the page mounts, and closing it rewrites the address instead.
|
|
22
|
+
*/
|
|
23
|
+
export function setBlocksFocusContext(form) {
|
|
24
|
+
let fromUrl = $state(page.url.searchParams.get(FOCUS_PARAM));
|
|
25
|
+
const path = $derived((page.state.blocksFocus ?? fromUrl) || null);
|
|
26
|
+
let selection = $state([]);
|
|
27
|
+
/** The panel's tab: the tree of blocks, the selected block's fields, the types to add. */
|
|
28
|
+
let tab = $state('layers');
|
|
29
|
+
/** Counts the asks to show a block's fields, so a closed panel knows to open. */
|
|
30
|
+
let inspected = $state(0);
|
|
31
|
+
/** The picker of types to add is open. */
|
|
32
|
+
let picking = $state(false);
|
|
33
|
+
/** The folded rows, by block id: a fold stays on its block when the block moves. */
|
|
34
|
+
const collapsed = new SvelteSet();
|
|
35
|
+
let openedHere = false;
|
|
36
|
+
$effect(() => {
|
|
37
|
+
if (path)
|
|
38
|
+
return;
|
|
39
|
+
selection = [];
|
|
40
|
+
collapsed.clear();
|
|
41
|
+
});
|
|
42
|
+
const locked = $derived(form.isDisabled || form.readOnly);
|
|
43
|
+
const urlWith = (list) => {
|
|
44
|
+
const url = new URL(page.url);
|
|
45
|
+
if (list)
|
|
46
|
+
url.searchParams.set(FOCUS_PARAM, list);
|
|
47
|
+
else
|
|
48
|
+
url.searchParams.delete(FOCUS_PARAM);
|
|
49
|
+
return url;
|
|
50
|
+
};
|
|
51
|
+
function open(list, selected) {
|
|
52
|
+
openedHere = true;
|
|
53
|
+
fromUrl = null;
|
|
54
|
+
pushState(urlWith(list), { blocksFocus: list });
|
|
55
|
+
selection = selected ? [selected] : [];
|
|
56
|
+
}
|
|
57
|
+
function close() {
|
|
58
|
+
if (openedHere) {
|
|
59
|
+
openedHere = false;
|
|
60
|
+
history.back();
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
fromUrl = null;
|
|
64
|
+
replaceState(urlWith(null), {});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/* ---------------------------------------------------------------- rows */
|
|
68
|
+
const builderOf = (list) => form.blocks.builder(list);
|
|
69
|
+
const configOf = (list, block) => builderOf(list)?.get.blocks.find((candidate) => candidate.name === block.type)?.get;
|
|
70
|
+
function titleOf(config, block, index) {
|
|
71
|
+
if (config?.renderTitle) {
|
|
72
|
+
try {
|
|
73
|
+
const title = config.renderTitle({ values: block, position: index });
|
|
74
|
+
if (title)
|
|
75
|
+
return title;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
console.error(`Can't render title in block`, error);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return config?.label || capitalize(block.type);
|
|
82
|
+
}
|
|
83
|
+
function rowsOf(list, depth = 0) {
|
|
84
|
+
return form.blocks.list(list).map((block, index) => {
|
|
85
|
+
const config = configOf(list, block);
|
|
86
|
+
const rowPath = `${list}.${index}`;
|
|
87
|
+
const children = (config?.fields ?? [])
|
|
88
|
+
.filter((field) => field.type === 'blocks')
|
|
89
|
+
.map((field) => ({
|
|
90
|
+
list: `${rowPath}.${field.name}`,
|
|
91
|
+
builder: field,
|
|
92
|
+
label: field.get.label || capitalize(field.name)
|
|
93
|
+
}));
|
|
94
|
+
return {
|
|
95
|
+
path: rowPath,
|
|
96
|
+
list,
|
|
97
|
+
index,
|
|
98
|
+
depth,
|
|
99
|
+
block,
|
|
100
|
+
config,
|
|
101
|
+
title: titleOf(config, block, index),
|
|
102
|
+
children
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/** Every row, folded ones included, in layers order. */
|
|
107
|
+
function allRows() {
|
|
108
|
+
if (!path)
|
|
109
|
+
return [];
|
|
110
|
+
const out = [];
|
|
111
|
+
const walk = (list, depth) => {
|
|
112
|
+
for (const row of rowsOf(list, depth)) {
|
|
113
|
+
out.push(row);
|
|
114
|
+
for (const child of row.children)
|
|
115
|
+
walk(child.list, depth + 1);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
walk(path, 0);
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
/** The rows on screen: what the arrow keys walk. */
|
|
122
|
+
function visibleRows() {
|
|
123
|
+
if (!path)
|
|
124
|
+
return [];
|
|
125
|
+
const out = [];
|
|
126
|
+
const walk = (list, depth) => {
|
|
127
|
+
for (const row of rowsOf(list, depth)) {
|
|
128
|
+
out.push(row);
|
|
129
|
+
if (collapsed.has(row.block.id))
|
|
130
|
+
continue;
|
|
131
|
+
for (const child of row.children)
|
|
132
|
+
walk(child.list, depth + 1);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
walk(path, 0);
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The root node of the layers: the blocks field's label, or the block the open list hangs off,
|
|
140
|
+
* with the field's label after it when that block holds several lists.
|
|
141
|
+
*/
|
|
142
|
+
function rootLabel() {
|
|
143
|
+
if (!path)
|
|
144
|
+
return '';
|
|
145
|
+
const builder = builderOf(path);
|
|
146
|
+
const fieldLabel = builder?.get.label || capitalize(builder?.name || '');
|
|
147
|
+
const crumbs = breadcrumb();
|
|
148
|
+
const parent = crumbs.length > 1 ? crumbs[crumbs.length - 2] : undefined;
|
|
149
|
+
if (!parent?.block)
|
|
150
|
+
return fieldLabel;
|
|
151
|
+
const block = form.blocks.list(parent.list)[parseBlockPath(parent.block).index];
|
|
152
|
+
const lists = block
|
|
153
|
+
? (configOf(parent.list, block)?.fields ?? []).filter((f) => f.type === 'blocks')
|
|
154
|
+
: [];
|
|
155
|
+
return lists.length > 1 ? `${parent.label} › ${fieldLabel}` : parent.label;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The way down to the open list, blocks fields and blocks only: `sections.1.items` reads
|
|
159
|
+
* *Sections › Grid › Items*. A container segment, a tab or a group, adds nothing.
|
|
160
|
+
*/
|
|
161
|
+
function breadcrumb() {
|
|
162
|
+
if (!path)
|
|
163
|
+
return [];
|
|
164
|
+
const crumbs = [];
|
|
165
|
+
let list = '';
|
|
166
|
+
for (const part of path.split('.')) {
|
|
167
|
+
if (/^\d+$/.test(part)) {
|
|
168
|
+
const index = parseInt(part);
|
|
169
|
+
const block = form.blocks.list(list)[index];
|
|
170
|
+
if (!block)
|
|
171
|
+
continue;
|
|
172
|
+
crumbs.push({
|
|
173
|
+
label: titleOf(configOf(list, block), block, index),
|
|
174
|
+
list,
|
|
175
|
+
block: `${list}.${index}`
|
|
176
|
+
});
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
list = list ? `${list}.${part}` : part;
|
|
180
|
+
const builder = builderOf(list);
|
|
181
|
+
if (builder)
|
|
182
|
+
crumbs.push({ label: builder.get.label || capitalize(part), list });
|
|
183
|
+
}
|
|
184
|
+
return crumbs;
|
|
185
|
+
}
|
|
186
|
+
/** The lists a block of `type` may go to, the one it is in and its own subtree left out. */
|
|
187
|
+
function moveTargets() {
|
|
188
|
+
const current = currentAt();
|
|
189
|
+
if (!path || !current)
|
|
190
|
+
return [];
|
|
191
|
+
const currentPath = blockPath(current);
|
|
192
|
+
const type = form.blocks.list(current.list)[current.index]?.type;
|
|
193
|
+
if (!type)
|
|
194
|
+
return [];
|
|
195
|
+
const rootBuilder = builderOf(path);
|
|
196
|
+
const targets = [];
|
|
197
|
+
if (form.blocks.accepts(path, type) && current.list !== path) {
|
|
198
|
+
targets.push({
|
|
199
|
+
list: path,
|
|
200
|
+
label: rootBuilder?.get.label || capitalize(rootBuilder?.name || '')
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
for (const row of allRows()) {
|
|
204
|
+
if (row.path === currentPath || row.path.startsWith(`${currentPath}.`))
|
|
205
|
+
continue;
|
|
206
|
+
for (const child of row.children) {
|
|
207
|
+
if (child.list === current.list)
|
|
208
|
+
continue;
|
|
209
|
+
if (!form.blocks.accepts(child.list, type))
|
|
210
|
+
continue;
|
|
211
|
+
targets.push({ list: child.list, label: `${row.title} › ${child.label}` });
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return targets;
|
|
215
|
+
}
|
|
216
|
+
/* ----------------------------------------------------------- selection */
|
|
217
|
+
const currentAt = () => (selection[0] ? parseBlockPath(selection[0]) : null);
|
|
218
|
+
function select(rowPath, options = {}) {
|
|
219
|
+
if (options.extend && selection.length) {
|
|
220
|
+
selection = selection.includes(rowPath)
|
|
221
|
+
? selection.filter((item) => item !== rowPath)
|
|
222
|
+
: [rowPath, ...selection];
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
selection = [rowPath];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/** Up from the first row lands on the root node; down from the root on the first row. */
|
|
229
|
+
function selectRelative(delta, extend = false) {
|
|
230
|
+
const rows = visibleRows();
|
|
231
|
+
if (!rows.length)
|
|
232
|
+
return;
|
|
233
|
+
const index = rows.findIndex((row) => row.path === selection[0]);
|
|
234
|
+
const target = index + delta;
|
|
235
|
+
if (target < 0)
|
|
236
|
+
return selectRoot();
|
|
237
|
+
const next = rows[Math.min(rows.length - 1, target)];
|
|
238
|
+
if (next)
|
|
239
|
+
select(next.path, { extend });
|
|
240
|
+
}
|
|
241
|
+
const selectRoot = () => {
|
|
242
|
+
selection = [];
|
|
243
|
+
};
|
|
244
|
+
/* ---------------------------------------------------------- operations */
|
|
245
|
+
/** Where the palette inserts: after the current block, else at the end of the open list. */
|
|
246
|
+
function insertionPoint() {
|
|
247
|
+
const current = currentAt();
|
|
248
|
+
if (current)
|
|
249
|
+
return { list: current.list, index: current.index + 1 };
|
|
250
|
+
if (!path)
|
|
251
|
+
return null;
|
|
252
|
+
return { list: path, index: form.blocks.list(path).length };
|
|
253
|
+
}
|
|
254
|
+
function insertType(type, at = insertionPoint()) {
|
|
255
|
+
if (locked || !at)
|
|
256
|
+
return null;
|
|
257
|
+
const config = builderOf(at.list)?.get.blocks.find((candidate) => candidate.name === type)?.get;
|
|
258
|
+
if (!config)
|
|
259
|
+
return null;
|
|
260
|
+
const empty = { ...emptyValuesFromFieldConfig(config.fields), type };
|
|
261
|
+
const id = form.blocks.insert(at, empty);
|
|
262
|
+
select(blockPath(at));
|
|
263
|
+
return id;
|
|
264
|
+
}
|
|
265
|
+
function duplicateSelection() {
|
|
266
|
+
const current = currentAt();
|
|
267
|
+
if (locked || !current)
|
|
268
|
+
return;
|
|
269
|
+
form.blocks.duplicate(blockPath(current));
|
|
270
|
+
select(blockPath({ list: current.list, index: current.index + 1 }));
|
|
271
|
+
}
|
|
272
|
+
/** Removes the selected blocks, last in layers order first, so earlier paths hold. */
|
|
273
|
+
function removeSelection() {
|
|
274
|
+
if (locked || !selection.length)
|
|
275
|
+
return;
|
|
276
|
+
const order = visibleRows().map((row) => row.path);
|
|
277
|
+
const targets = [...selection].sort((a, b) => order.indexOf(b) - order.indexOf(a));
|
|
278
|
+
for (const target of targets)
|
|
279
|
+
form.blocks.remove(target);
|
|
280
|
+
const first = parseBlockPath(targets[targets.length - 1]);
|
|
281
|
+
const remaining = form.blocks.list(first.list);
|
|
282
|
+
if (!remaining.length) {
|
|
283
|
+
selection = [];
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
select(blockPath({ list: first.list, index: Math.min(first.index, remaining.length - 1) }));
|
|
287
|
+
}
|
|
288
|
+
function moveSelection(delta) {
|
|
289
|
+
const current = currentAt();
|
|
290
|
+
if (locked || !current)
|
|
291
|
+
return;
|
|
292
|
+
const index = current.index + delta;
|
|
293
|
+
if (index < 0 || index >= form.blocks.list(current.list).length)
|
|
294
|
+
return;
|
|
295
|
+
form.blocks.move(blockPath(current), { list: current.list, index });
|
|
296
|
+
select(blockPath({ list: current.list, index }));
|
|
297
|
+
}
|
|
298
|
+
function moveSelectionInto(list) {
|
|
299
|
+
const current = currentAt();
|
|
300
|
+
if (locked || !current)
|
|
301
|
+
return;
|
|
302
|
+
const index = form.blocks.list(list).length;
|
|
303
|
+
form.blocks.move(blockPath(current), { list, index });
|
|
304
|
+
const landed = shiftListPath(list, current);
|
|
305
|
+
select(blockPath({ list: landed, index }));
|
|
306
|
+
}
|
|
307
|
+
function copySelection() {
|
|
308
|
+
const current = currentAt();
|
|
309
|
+
if (!current)
|
|
310
|
+
return Promise.resolve();
|
|
311
|
+
return form.blocks.copy(blockPath(current));
|
|
312
|
+
}
|
|
313
|
+
async function pasteAfterSelection() {
|
|
314
|
+
const at = insertionPoint();
|
|
315
|
+
if (locked || !at)
|
|
316
|
+
return null;
|
|
317
|
+
const id = await form.blocks.paste(at);
|
|
318
|
+
if (id)
|
|
319
|
+
select(blockPath(at));
|
|
320
|
+
return id;
|
|
321
|
+
}
|
|
322
|
+
/* ------------------------------------------------------------ folding */
|
|
323
|
+
/** `sections.0.items.2` -> the id of the block there. */
|
|
324
|
+
const idAt = (rowPath) => {
|
|
325
|
+
const at = parseBlockPath(rowPath);
|
|
326
|
+
return form.blocks.list(at.list)[at.index]?.id;
|
|
327
|
+
};
|
|
328
|
+
const isCollapsed = (rowPath) => collapsed.has(idAt(rowPath) ?? '');
|
|
329
|
+
const setCollapsed = (rowPath, value) => {
|
|
330
|
+
const id = idAt(rowPath);
|
|
331
|
+
if (!id)
|
|
332
|
+
return;
|
|
333
|
+
if (value)
|
|
334
|
+
collapsed.add(id);
|
|
335
|
+
else
|
|
336
|
+
collapsed.delete(id);
|
|
337
|
+
};
|
|
338
|
+
const collapseAll = () => {
|
|
339
|
+
for (const row of allRows())
|
|
340
|
+
if (row.children.length)
|
|
341
|
+
collapsed.add(row.block.id);
|
|
342
|
+
};
|
|
343
|
+
const store = {
|
|
344
|
+
get path() {
|
|
345
|
+
return path;
|
|
346
|
+
},
|
|
347
|
+
get selection() {
|
|
348
|
+
return selection;
|
|
349
|
+
},
|
|
350
|
+
get current() {
|
|
351
|
+
return currentAt();
|
|
352
|
+
},
|
|
353
|
+
get currentRow() {
|
|
354
|
+
const current = currentAt();
|
|
355
|
+
return current
|
|
356
|
+
? (rowsOf(current.list).find((row) => row.index === current.index) ?? null)
|
|
357
|
+
: null;
|
|
358
|
+
},
|
|
359
|
+
get locked() {
|
|
360
|
+
return locked;
|
|
361
|
+
},
|
|
362
|
+
get tab() {
|
|
363
|
+
return tab;
|
|
364
|
+
},
|
|
365
|
+
set tab(value) {
|
|
366
|
+
tab = value;
|
|
367
|
+
},
|
|
368
|
+
get inspected() {
|
|
369
|
+
return inspected;
|
|
370
|
+
},
|
|
371
|
+
/** Turns the panel to the selected block's fields, and opens it where it is a sheet. */
|
|
372
|
+
inspect() {
|
|
373
|
+
tab = 'inspector';
|
|
374
|
+
inspected++;
|
|
375
|
+
},
|
|
376
|
+
get picking() {
|
|
377
|
+
return picking;
|
|
378
|
+
},
|
|
379
|
+
set picking(value) {
|
|
380
|
+
picking = value;
|
|
381
|
+
},
|
|
382
|
+
/** Opens the picker of types to add; the one picked goes after the selection. */
|
|
383
|
+
pick() {
|
|
384
|
+
if (!locked)
|
|
385
|
+
picking = true;
|
|
386
|
+
},
|
|
387
|
+
/** The open list's block set has at least one render: the stage is the stack of renders. */
|
|
388
|
+
get hasRenders() {
|
|
389
|
+
return !!path && !!builderOf(path)?.get.blocks.some((block) => block.get.render);
|
|
390
|
+
},
|
|
391
|
+
/** Nothing selected: the root node, and the whole list on the stage. */
|
|
392
|
+
get rootSelected() {
|
|
393
|
+
return selection.length === 0;
|
|
394
|
+
},
|
|
395
|
+
rootLabel,
|
|
396
|
+
selectRoot,
|
|
397
|
+
breadcrumb,
|
|
398
|
+
isSelected: (rowPath) => selection.includes(rowPath),
|
|
399
|
+
isCollapsed,
|
|
400
|
+
open,
|
|
401
|
+
close,
|
|
402
|
+
rowsOf,
|
|
403
|
+
allRows,
|
|
404
|
+
visibleRows,
|
|
405
|
+
moveTargets,
|
|
406
|
+
select,
|
|
407
|
+
selectRelative,
|
|
408
|
+
insertionPoint,
|
|
409
|
+
insertType,
|
|
410
|
+
duplicateSelection,
|
|
411
|
+
removeSelection,
|
|
412
|
+
moveSelection,
|
|
413
|
+
moveSelectionInto,
|
|
414
|
+
copySelection,
|
|
415
|
+
pasteAfterSelection,
|
|
416
|
+
setCollapsed,
|
|
417
|
+
toggleCollapsed: (rowPath) => setCollapsed(rowPath, !isCollapsed(rowPath)),
|
|
418
|
+
collapseAll,
|
|
419
|
+
expandAll: () => collapsed.clear()
|
|
420
|
+
};
|
|
421
|
+
return setContext(KEY, store);
|
|
422
|
+
}
|
|
423
|
+
/** The focus of the document on screen, or nothing in a form that has none: a nested create. */
|
|
424
|
+
export const getBlocksFocusContext = () => getContext(KEY);
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { t__ } from '../../../../core/i18n/index.js';
|
|
3
|
+
import * as Command from '../../../../panel/components/ui/command/index.js';
|
|
4
|
+
import Kbd from '../../../../panel/components/ui/kbd/Kbd.svelte';
|
|
5
|
+
import { capitalize } from '../../../../util/string.js';
|
|
6
|
+
import { Command as CommandPrimitive } from 'bits-ui';
|
|
7
|
+
import type { BlockBuilder, BlocksFieldBlock } from '../../index.js';
|
|
8
|
+
import BlockTile from './BlockTile.svelte';
|
|
9
|
+
|
|
10
|
+
/** The types to add, as tiles in a dialog: a search above, the arrows walk the grid. */
|
|
11
|
+
type Props = {
|
|
12
|
+
open: boolean;
|
|
13
|
+
types: BlockBuilder[];
|
|
14
|
+
onpick: (block: BlocksFieldBlock) => void;
|
|
15
|
+
};
|
|
16
|
+
let { open = $bindable(false), types, onpick }: Props = $props();
|
|
17
|
+
|
|
18
|
+
const COLUMNS = 3;
|
|
19
|
+
|
|
20
|
+
function pick(block: BlocksFieldBlock) {
|
|
21
|
+
open = false;
|
|
22
|
+
onpick(block);
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<Command.Dialog bind:open columns={COLUMNS}>
|
|
27
|
+
<Command.Input placeholder={t__('fields.search_blocks')}>
|
|
28
|
+
{#snippet end()}
|
|
29
|
+
<Kbd keys="escape" />
|
|
30
|
+
{/snippet}
|
|
31
|
+
</Command.Input>
|
|
32
|
+
<Command.List class="rz-block-picker">
|
|
33
|
+
<Command.Empty>{t__('common.nothing_found')}</Command.Empty>
|
|
34
|
+
<div class="rz-block-picker__grid" style:--rz-block-picker-columns={COLUMNS}>
|
|
35
|
+
{#each types as builder (builder.name)}
|
|
36
|
+
{@const block = builder.block}
|
|
37
|
+
<CommandPrimitive.Item
|
|
38
|
+
class="rz-block-tile"
|
|
39
|
+
value={block.label || capitalize(block.name)}
|
|
40
|
+
keywords={[block.name, block.description ?? '']}
|
|
41
|
+
onSelect={() => pick(block)}
|
|
42
|
+
>
|
|
43
|
+
<BlockTile {block} />
|
|
44
|
+
</CommandPrimitive.Item>
|
|
45
|
+
{/each}
|
|
46
|
+
</div>
|
|
47
|
+
</Command.List>
|
|
48
|
+
<footer class="rz-block-picker__foot">
|
|
49
|
+
<span><Kbd keys="arrowup" /><Kbd keys="arrowdown" /> {t__('common.palette_move')}</span>
|
|
50
|
+
<span><Kbd keys="enter" /> {t__('fields.picker_add')}</span>
|
|
51
|
+
<span><Kbd keys="escape" /> {t__('common.palette_close')}</span>
|
|
52
|
+
</footer>
|
|
53
|
+
</Command.Dialog>
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
/* Wider than the command palette, for three tiles a row. */
|
|
57
|
+
:global(.rz-command-dialog-content:has(.rz-block-picker)) {
|
|
58
|
+
width: min(46rem, calc(100% - 2 * var(--gutter)));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:global(.rz-command-list.rz-block-picker) {
|
|
62
|
+
max-height: min(60vh, 32rem);
|
|
63
|
+
padding: var(--rz-size-3);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.rz-block-picker__grid {
|
|
67
|
+
display: grid;
|
|
68
|
+
grid-template-columns: repeat(var(--rz-block-picker-columns), minmax(0, 1fr));
|
|
69
|
+
gap: var(--rz-size-2-5);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.rz-block-picker__foot {
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: var(--rz-size-4);
|
|
76
|
+
height: var(--rz-size-9);
|
|
77
|
+
padding: 0 var(--rz-size-3-5);
|
|
78
|
+
border-top: 1px solid var(--rz-border);
|
|
79
|
+
color: var(--rz-fg-subtle);
|
|
80
|
+
font-size: var(--rz-text-sm);
|
|
81
|
+
|
|
82
|
+
span {
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: var(--rz-size-1);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BlockBuilder, BlocksFieldBlock } from '../../index.js';
|
|
2
|
+
/** The types to add, as tiles in a dialog: a search above, the arrows walk the grid. */
|
|
3
|
+
type Props = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
types: BlockBuilder[];
|
|
6
|
+
onpick: (block: BlocksFieldBlock) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const BlockPicker: import("svelte").Component<Props, {}, "open">;
|
|
9
|
+
type BlockPicker = ReturnType<typeof BlockPicker>;
|
|
10
|
+
export default BlockPicker;
|