rimecms 0.32.1 → 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/column.server.js +1 -1
- 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 +63 -11
- 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 +53 -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/plugins/defaults/module.server.js +2 -2
- package/dist/core/plugins/defaults/types.d.ts +5 -3
- package/dist/core/plugins/sse/index.d.ts +1 -1
- package/dist/core/plugins/sse/index.server.d.ts +5 -6
- package/dist/core/plugins/sse/index.server.js +3 -2
- package/dist/core/plugins/sse/types.d.ts +5 -0
- 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/types.d.ts +1 -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
|
@@ -9,19 +9,19 @@ import { AUTO_SAVE_DELAY_MS, VERSIONS_STATUS } from '../../core/prototype/shared
|
|
|
9
9
|
import { apiUrl, panelUrl } from '../../core/routes/util.js';
|
|
10
10
|
import { isJSONContent, richTextJSONToText } from '../../fields/rich-text/index.js';
|
|
11
11
|
import { isObjectLiteral, omit } from '../../util/object.js';
|
|
12
|
-
import { normalizeFieldPath } from '../../util/
|
|
12
|
+
import { normalizeFieldPath } from '../../util/string.js';
|
|
13
13
|
import { randomId } from '../../util/random.js';
|
|
14
14
|
import cloneDeep from 'clone-deep';
|
|
15
15
|
import { diff } from 'deep-object-diff';
|
|
16
16
|
import { flatten } from 'flat';
|
|
17
17
|
import { getContext, setContext } from 'svelte';
|
|
18
|
-
import { SvelteURLSearchParams } from 'svelte/reactivity';
|
|
19
18
|
import { toast } from 'svelte-sonner';
|
|
19
|
+
import { SvelteURLSearchParams } from 'svelte/reactivity';
|
|
20
20
|
import { t__ } from '../../core/i18n/index.js';
|
|
21
|
-
import { moveItem } from '../../util/array.js';
|
|
22
21
|
import { getValueAtPath, setValueAtPath } from '../../util/object.js';
|
|
23
22
|
import { snapshot } from '../../util/state.js';
|
|
24
23
|
import { getAPIProxyContext } from './api-proxy.svelte.js';
|
|
24
|
+
import { duplicateBlock as duplicateBlockIn, fromClipboard, insertBlock, moveBlock as moveBlockIn, parseBlockPath, readList, rebuildPaths, removeBlock, toClipboard, withBlockTypes, withFreshIds } from './blocks-ops.js';
|
|
25
25
|
import { setErrorsContext } from './errors.svelte.js';
|
|
26
26
|
import { getLocaleContext } from './locale.svelte.js';
|
|
27
27
|
import { getTitleContext } from './title.js';
|
|
@@ -100,29 +100,6 @@ function createDocumentFormState({ initial, config, readOnly, key, onNestedDocum
|
|
|
100
100
|
return doc && initialTitle ? initialTitle : '[untitled]';
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
const rebuildPaths = (items, basePath, parentPath = basePath) => {
|
|
104
|
-
return items.map((item, index) => {
|
|
105
|
-
// Clone the item
|
|
106
|
-
const newItem = cloneDeep(item);
|
|
107
|
-
// If item has a path property, update it with parent path
|
|
108
|
-
if ('path' in newItem) {
|
|
109
|
-
newItem.path = parentPath;
|
|
110
|
-
}
|
|
111
|
-
// If item is part of an array, update its position
|
|
112
|
-
newItem.position = index;
|
|
113
|
-
// Process all properties of the item
|
|
114
|
-
Object.keys(newItem).forEach((key) => {
|
|
115
|
-
// If property is an array of object, process it recursively
|
|
116
|
-
if (Array.isArray(newItem[key]) &&
|
|
117
|
-
newItem[key].length &&
|
|
118
|
-
isObjectLiteral(newItem[key][0])) {
|
|
119
|
-
const newParentPath = `${parentPath}.${index}.${key}`;
|
|
120
|
-
newItem[key] = rebuildPaths(newItem[key], basePath, newParentPath);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
return newItem;
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
103
|
function setValue(path, value) {
|
|
127
104
|
doc = setValueAtPath(path, doc, value);
|
|
128
105
|
if (onDataChange)
|
|
@@ -162,16 +139,25 @@ function createDocumentFormState({ initial, config, readOnly, key, onNestedDocum
|
|
|
162
139
|
/** update stamp to rerender */
|
|
163
140
|
stamp = new Date().getTime().toString();
|
|
164
141
|
};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
142
|
+
/** A new item at the end of a list: the tree's own, or one inside an item, `links.0._children`. */
|
|
143
|
+
const addItem = (emptyFields, atPath = path) => {
|
|
144
|
+
let items = cloneDeep(snapshot(getItems()));
|
|
145
|
+
let target = items;
|
|
146
|
+
if (atPath !== path) {
|
|
147
|
+
const parent = getValueAtPath(atPath.replace(`${path}.`, '').replace(/\._children$/, ''), items);
|
|
148
|
+
if (!parent)
|
|
149
|
+
return;
|
|
150
|
+
parent._children ??= [];
|
|
151
|
+
target = parent._children;
|
|
152
|
+
}
|
|
153
|
+
target.push({
|
|
168
154
|
...emptyFields,
|
|
169
155
|
id: generateTempId(),
|
|
170
|
-
path:
|
|
171
|
-
position:
|
|
156
|
+
path: atPath,
|
|
157
|
+
position: target.length,
|
|
172
158
|
_children: []
|
|
173
|
-
};
|
|
174
|
-
items =
|
|
159
|
+
});
|
|
160
|
+
items = rebuildPaths(items, path);
|
|
175
161
|
assignItemsToDoc(items);
|
|
176
162
|
};
|
|
177
163
|
const deleteItem = (atPath, index) => {
|
|
@@ -233,78 +219,94 @@ function createDocumentFormState({ initial, config, readOnly, key, onNestedDocum
|
|
|
233
219
|
}
|
|
234
220
|
};
|
|
235
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* The block operations, document-wide. Paths are normalized, without `:type`; a list path names
|
|
224
|
+
* the array, `sections` or `sections.0.items`. Every view of the blocks calls these.
|
|
225
|
+
*/
|
|
226
|
+
const blocks = {
|
|
227
|
+
list(list) {
|
|
228
|
+
return readList(doc, list);
|
|
229
|
+
},
|
|
230
|
+
/** The `BlocksBuilder` a list path names, read through the document for the block types. */
|
|
231
|
+
builder(list) {
|
|
232
|
+
const field = getFieldAtPath(withBlockTypes(list, doc), documentConfig.fields);
|
|
233
|
+
return field && field.type === 'blocks' ? field : undefined;
|
|
234
|
+
},
|
|
235
|
+
/** Whether the list's block set has this type. */
|
|
236
|
+
accepts(list, type) {
|
|
237
|
+
return !!blocks.builder(list)?.get.blocks.some((block) => block.name === type);
|
|
238
|
+
},
|
|
239
|
+
insert(at, block) {
|
|
240
|
+
const change = insertBlock(doc, at, block);
|
|
241
|
+
apply(change);
|
|
242
|
+
return change.id;
|
|
243
|
+
},
|
|
244
|
+
remove(path) {
|
|
245
|
+
const at = parseBlockPath(path);
|
|
246
|
+
errors.deleteAllThatStartWith(`${at.list}.${at.index}.`);
|
|
247
|
+
apply(removeBlock(doc, path));
|
|
248
|
+
},
|
|
249
|
+
duplicate(path) {
|
|
250
|
+
const change = duplicateBlockIn(doc, path);
|
|
251
|
+
apply(change);
|
|
252
|
+
return change.id;
|
|
253
|
+
},
|
|
254
|
+
move(from, to) {
|
|
255
|
+
apply(moveBlockIn(doc, from, to));
|
|
256
|
+
},
|
|
257
|
+
/** Copies the block to the clipboard, and keeps it here for a browser that refuses to read back. */
|
|
258
|
+
async copy(path) {
|
|
259
|
+
const at = parseBlockPath(path);
|
|
260
|
+
const block = readList(doc, at.list)[at.index];
|
|
261
|
+
if (!block)
|
|
262
|
+
return;
|
|
263
|
+
const data = toClipboard(block);
|
|
264
|
+
clipboard = data;
|
|
265
|
+
try {
|
|
266
|
+
await navigator.clipboard.writeText(JSON.stringify(data));
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
// The in-memory copy above is what paste reads then.
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
/** Pastes the copied block at `at`. `null` when there is none, or the list refuses its type. */
|
|
273
|
+
async paste(at) {
|
|
274
|
+
let data = clipboard;
|
|
275
|
+
try {
|
|
276
|
+
data = fromClipboard(await navigator.clipboard.readText()) ?? data;
|
|
277
|
+
}
|
|
278
|
+
catch {
|
|
279
|
+
// Reading the clipboard needs a permission some browsers never give.
|
|
280
|
+
}
|
|
281
|
+
if (!data || !blocks.accepts(at.list, data.type))
|
|
282
|
+
return null;
|
|
283
|
+
const { id: _id, path: _path, position: _position, ...block } = withFreshIds(data.block);
|
|
284
|
+
return blocks.insert(at, block);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
let clipboard = null;
|
|
288
|
+
function apply(change) {
|
|
289
|
+
if (!change.lists.length)
|
|
290
|
+
return;
|
|
291
|
+
doc = change.doc;
|
|
292
|
+
if (onDataChange) {
|
|
293
|
+
for (const list of change.lists) {
|
|
294
|
+
onDataChange({ path: list, value: snapshot(getValueAtPath(list, doc)) });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/** One list's view of the operations above, for the inline cards. */
|
|
236
299
|
function useBlocks(path) {
|
|
237
|
-
const
|
|
238
|
-
const getBlocks = () => {
|
|
239
|
-
return cloneDeep(getValueAtPath(path, doc)) || [];
|
|
240
|
-
};
|
|
241
|
-
const assignBlocksToDoc = (blocks) => {
|
|
242
|
-
blocks = rebuildPaths(blocks, path);
|
|
243
|
-
doc = setValueAtPath(path, doc, blocks);
|
|
244
|
-
if (onDataChange)
|
|
245
|
-
onDataChange({ path, value: snapshot(blocks) });
|
|
246
|
-
};
|
|
300
|
+
const list = normalizeFieldPath(path);
|
|
247
301
|
const addBlock = (block) => {
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
type: block.type,
|
|
252
|
-
path: path,
|
|
253
|
-
position: block.position
|
|
254
|
-
};
|
|
255
|
-
let blocks = [...getBlocks()];
|
|
256
|
-
blocks = blocks.toSpliced(block.position, 0, blockWithPath);
|
|
257
|
-
assignBlocksToDoc(blocks);
|
|
258
|
-
};
|
|
259
|
-
const deleteBlock = (index) => {
|
|
260
|
-
const blocks = [...getBlocks()]
|
|
261
|
-
.filter((_, i) => i !== index)
|
|
262
|
-
.map((block, index) => ({ ...block, position: index }));
|
|
263
|
-
errors.deleteAllThatStartWith(`${path}.${index}.`);
|
|
264
|
-
assignBlocksToDoc(blocks);
|
|
265
|
-
};
|
|
266
|
-
const moveBlock = (from, to) => {
|
|
267
|
-
let blocks = moveItem(getBlocks(), from, to);
|
|
268
|
-
blocks = blocks.map((block, index) => ({
|
|
269
|
-
...block,
|
|
270
|
-
position: index
|
|
271
|
-
}));
|
|
272
|
-
assignBlocksToDoc(blocks);
|
|
302
|
+
const { position, ...rest } = block;
|
|
303
|
+
const index = position ?? blocks.list(list).length;
|
|
304
|
+
blocks.insert({ list, index }, rest);
|
|
273
305
|
};
|
|
306
|
+
const deleteBlock = (index) => blocks.remove(`${list}.${index}`);
|
|
307
|
+
const moveBlock = (from, to) => blocks.move(`${list}.${from}`, { list, index: to });
|
|
274
308
|
const duplicateBlock = (index) => {
|
|
275
|
-
|
|
276
|
-
let blocks = [...getBlocks()];
|
|
277
|
-
const cloneBlock = (block) => {
|
|
278
|
-
// First deep clone the block so duplicate origin
|
|
279
|
-
// is not impacted.
|
|
280
|
-
const clone = cloneDeep(block);
|
|
281
|
-
// Function to reset all nested id properties
|
|
282
|
-
// so nested elements are threated as created elements
|
|
283
|
-
const resetIds = (obj) => {
|
|
284
|
-
if ('id' in obj) {
|
|
285
|
-
obj = { ...obj, id: generateTempId() };
|
|
286
|
-
}
|
|
287
|
-
for (const key of Object.keys(obj)) {
|
|
288
|
-
const value = obj[key];
|
|
289
|
-
if (Array.isArray(value) && value.length && isObjectLiteral(value[0])) {
|
|
290
|
-
obj = {
|
|
291
|
-
...obj,
|
|
292
|
-
[key]: value.map((child) => resetIds(child))
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return obj;
|
|
297
|
-
};
|
|
298
|
-
// set temp-ids for nested elements
|
|
299
|
-
return resetIds(clone);
|
|
300
|
-
};
|
|
301
|
-
const blockCopy = cloneBlock(blocks[index]);
|
|
302
|
-
blocks.splice(index + 1, 0, blockCopy);
|
|
303
|
-
blocks = blocks.map((block, index) => ({
|
|
304
|
-
...block,
|
|
305
|
-
position: index
|
|
306
|
-
}));
|
|
307
|
-
assignBlocksToDoc(blocks);
|
|
309
|
+
blocks.duplicate(`${list}.${index}`);
|
|
308
310
|
};
|
|
309
311
|
return {
|
|
310
312
|
addBlock,
|
|
@@ -312,7 +314,7 @@ function createDocumentFormState({ initial, config, readOnly, key, onNestedDocum
|
|
|
312
314
|
moveBlock,
|
|
313
315
|
duplicateBlock,
|
|
314
316
|
get blocks() {
|
|
315
|
-
return
|
|
317
|
+
return blocks.list(list);
|
|
316
318
|
}
|
|
317
319
|
};
|
|
318
320
|
}
|
|
@@ -804,6 +806,7 @@ function createDocumentFormState({ initial, config, readOnly, key, onNestedDocum
|
|
|
804
806
|
getValue,
|
|
805
807
|
useBlocks,
|
|
806
808
|
useTree,
|
|
809
|
+
blocks,
|
|
807
810
|
nestedLevel,
|
|
808
811
|
buildPanelActionUrl,
|
|
809
812
|
readOnly,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { page } from '$app/state';
|
|
2
2
|
import { env } from '$env/dynamic/public';
|
|
3
3
|
import { PARAMS } from '../../core/constants.js';
|
|
4
|
-
import { apiUrl } from '../../core/routes/util.js';
|
|
5
|
-
import { toKebabCase } from '../../util/string.js';
|
|
6
4
|
import { getContext, setContext } from 'svelte';
|
|
7
|
-
import { getValueAtPath,
|
|
5
|
+
import { getValueAtPath, setValueAtPath } from '../../util/object.js';
|
|
6
|
+
import { populate } from '../util/populate.js';
|
|
8
7
|
export const LIVE_KEY = Symbol('rime.live');
|
|
9
8
|
function createStore(href) {
|
|
10
9
|
let enabled = $state(false);
|
|
@@ -54,76 +53,6 @@ function createStore(href) {
|
|
|
54
53
|
await handleFieldUpdate(e.data);
|
|
55
54
|
}
|
|
56
55
|
};
|
|
57
|
-
/**
|
|
58
|
-
* Recursively processes relation objects in any data structure
|
|
59
|
-
*/
|
|
60
|
-
const populate = async (value) => {
|
|
61
|
-
// Base case: null or undefined
|
|
62
|
-
if (value === null || value === undefined) {
|
|
63
|
-
return value;
|
|
64
|
-
}
|
|
65
|
-
// Check if it's a resource link field value
|
|
66
|
-
if (isObjectLiteral(value) &&
|
|
67
|
-
'value' in value &&
|
|
68
|
-
'target' in value &&
|
|
69
|
-
'type' in value &&
|
|
70
|
-
!['url', 'email', 'tel', 'anchor'].includes(value.type)) {
|
|
71
|
-
if (value.type && value.value) {
|
|
72
|
-
try {
|
|
73
|
-
const { type, value: id } = value;
|
|
74
|
-
const response = await fetch(`${apiUrl(toKebabCase(type), id)}?depth=1`).then((r) => r.json());
|
|
75
|
-
if (response && response.doc && response.doc.url) {
|
|
76
|
-
return {
|
|
77
|
-
...value,
|
|
78
|
-
url: response.doc.url
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch (err) {
|
|
83
|
-
console.error(err);
|
|
84
|
-
return value;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return value;
|
|
88
|
-
}
|
|
89
|
-
// Check if it's a relation object
|
|
90
|
-
if (isObjectLiteral(value) && 'documentId' in value && 'relationTo' in value) {
|
|
91
|
-
// Process single relation object
|
|
92
|
-
if ('livePreview' in value) {
|
|
93
|
-
return value.livePreview;
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
try {
|
|
97
|
-
const response = await fetch(`${apiUrl(toKebabCase(value.relationTo), value.documentId)}?depth=1`).then((r) => r.json());
|
|
98
|
-
if (response && response.doc) {
|
|
99
|
-
return response.doc;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
console.error(err);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return value;
|
|
107
|
-
}
|
|
108
|
-
// Process arrays
|
|
109
|
-
if (Array.isArray(value)) {
|
|
110
|
-
const result = [...value];
|
|
111
|
-
for (let i = 0; i < result.length; i++) {
|
|
112
|
-
result[i] = await populate(result[i]);
|
|
113
|
-
}
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
116
|
-
// Process objects (recursively)
|
|
117
|
-
if (isObjectLiteral(value)) {
|
|
118
|
-
const result = { ...value };
|
|
119
|
-
for (const key of Object.keys(result)) {
|
|
120
|
-
result[key] = await populate(result[key]);
|
|
121
|
-
}
|
|
122
|
-
return result;
|
|
123
|
-
}
|
|
124
|
-
// Return primitives as is
|
|
125
|
-
return value;
|
|
126
|
-
};
|
|
127
56
|
/**
|
|
128
57
|
* Handles panel store updates (new multi-panel protocol)
|
|
129
58
|
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const NAV_CTX = "rime.nav";
|
|
2
|
+
/**
|
|
3
|
+
* The panel's navigation: folded or not, and how wide, for whatever lines up with its edge.
|
|
4
|
+
*
|
|
5
|
+
* Folded is the user's choice, kept in the browser across visits, open until they fold it. A
|
|
6
|
+
* narrow window folds it regardless, and gives the choice back when it widens.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setNavContext(): {
|
|
9
|
+
readonly collapsed: boolean;
|
|
10
|
+
/** A CSS length: the navigation's width as it stands. */
|
|
11
|
+
readonly width: "var(--rz-size-12)" | "var(--rz-size-60)";
|
|
12
|
+
setCollapsed: (value: boolean) => void;
|
|
13
|
+
toggle: () => void;
|
|
14
|
+
};
|
|
15
|
+
export type NavStore = ReturnType<typeof setNavContext>;
|
|
16
|
+
/** The navigation, or nothing on a page without one: the live edit page. */
|
|
17
|
+
export declare const getNavContext: () => {
|
|
18
|
+
readonly collapsed: boolean;
|
|
19
|
+
/** A CSS length: the navigation's width as it stands. */
|
|
20
|
+
readonly width: "var(--rz-size-12)" | "var(--rz-size-60)";
|
|
21
|
+
setCollapsed: (value: boolean) => void;
|
|
22
|
+
toggle: () => void;
|
|
23
|
+
} | undefined;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
export const NAV_CTX = 'rime.nav';
|
|
3
|
+
const STORAGE_KEY = 'rz-panel-collapsed';
|
|
4
|
+
/** Under this width the navigation is folded whatever was chosen. */
|
|
5
|
+
const NARROW_PX = 1024;
|
|
6
|
+
/**
|
|
7
|
+
* The panel's navigation: folded or not, and how wide, for whatever lines up with its edge.
|
|
8
|
+
*
|
|
9
|
+
* Folded is the user's choice, kept in the browser across visits, open until they fold it. A
|
|
10
|
+
* narrow window folds it regardless, and gives the choice back when it widens.
|
|
11
|
+
*/
|
|
12
|
+
export function setNavContext() {
|
|
13
|
+
let collapsed = $state(true);
|
|
14
|
+
let chosen = null;
|
|
15
|
+
function setCollapsed(value) {
|
|
16
|
+
collapsed = value;
|
|
17
|
+
chosen = value;
|
|
18
|
+
try {
|
|
19
|
+
localStorage.setItem(STORAGE_KEY, String(value));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// A browser without storage keeps the choice for the visit.
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** The window's width decides first, the choice second, open by default. */
|
|
26
|
+
function fit() {
|
|
27
|
+
collapsed = window.innerWidth < NARROW_PX ? true : (chosen ?? false);
|
|
28
|
+
}
|
|
29
|
+
$effect(() => {
|
|
30
|
+
try {
|
|
31
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
32
|
+
if (stored !== null)
|
|
33
|
+
chosen = stored === 'true';
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// No storage, no remembered choice.
|
|
37
|
+
}
|
|
38
|
+
fit();
|
|
39
|
+
window.addEventListener('resize', fit);
|
|
40
|
+
return () => window.removeEventListener('resize', fit);
|
|
41
|
+
});
|
|
42
|
+
const store = {
|
|
43
|
+
get collapsed() {
|
|
44
|
+
return collapsed;
|
|
45
|
+
},
|
|
46
|
+
/** A CSS length: the navigation's width as it stands. */
|
|
47
|
+
get width() {
|
|
48
|
+
return collapsed ? 'var(--rz-size-12)' : 'var(--rz-size-60)';
|
|
49
|
+
},
|
|
50
|
+
setCollapsed,
|
|
51
|
+
toggle: () => setCollapsed(!collapsed)
|
|
52
|
+
};
|
|
53
|
+
return setContext(NAV_CTX, store);
|
|
54
|
+
}
|
|
55
|
+
/** The navigation, or nothing on a page without one: the live edit page. */
|
|
56
|
+
export const getNavContext = () => getContext(NAV_CTX);
|
|
Binary file
|
|
Binary file
|
package/dist/panel/index.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import type { AutoSaves } from '../core/prototype/shared/versions/types.js';
|
|
|
3
3
|
import type { GenericDoc } from '../core/prototype/types.js';
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
5
|
import { Field } from './components/fields/index.js';
|
|
6
|
+
import RelationInline from '../fields/relation/component/RelationInline.svelte';
|
|
7
|
+
import RichTextInline from '../fields/rich-text/component/RichTextInline.svelte';
|
|
8
|
+
import RenderFields from './components/fields/RenderFields.svelte';
|
|
6
9
|
import Panel from './components/Root.svelte';
|
|
7
10
|
import Doc from './components/sections/document/Document.svelte';
|
|
8
11
|
import Button from './components/ui/button/button.svelte';
|
|
@@ -17,7 +20,9 @@ import Collection from './pages/collection/Collection.svelte';
|
|
|
17
20
|
import Dashboard from './pages/dashboard/Dashboard.svelte';
|
|
18
21
|
import Live from './pages/live/Live.svelte';
|
|
19
22
|
import type { Route } from './types.js';
|
|
20
|
-
|
|
23
|
+
import { populate } from './util/populate.js';
|
|
24
|
+
import { useCommands } from './context/commands.svelte.js';
|
|
25
|
+
export { Area, Button, Collection, CollectionDoc, Dashboard, Doc, Field, ForgotPassword, Input, Live, Panel, RelationInline, RenderFields, ResetPassword, RichTextInline, SignIn, SpinLoader, populate, useCommands };
|
|
21
26
|
export declare const CONTEXT: {
|
|
22
27
|
COLLECTION: symbol;
|
|
23
28
|
LIVE: symbol;
|
|
@@ -27,6 +32,7 @@ export declare const CONTEXT: {
|
|
|
27
32
|
TITLE: string;
|
|
28
33
|
};
|
|
29
34
|
export type { DocumentFormContext } from './context/documentForm.svelte.js';
|
|
35
|
+
export type { Command } from './context/commands.svelte.js';
|
|
30
36
|
export type CollectionProps = {
|
|
31
37
|
data: {
|
|
32
38
|
docs: GenericDoc[];
|
package/dist/panel/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Field } from './components/fields/index.js';
|
|
2
|
+
import RelationInline from '../fields/relation/component/RelationInline.svelte';
|
|
3
|
+
import RichTextInline from '../fields/rich-text/component/RichTextInline.svelte';
|
|
4
|
+
import RenderFields from './components/fields/RenderFields.svelte';
|
|
2
5
|
import Panel from './components/Root.svelte';
|
|
3
6
|
import Doc from './components/sections/document/Document.svelte';
|
|
4
7
|
import Button from './components/ui/button/button.svelte';
|
|
@@ -18,9 +21,15 @@ import CollectionDoc from './pages/collection-document/CollectionDocument.svelte
|
|
|
18
21
|
import Collection from './pages/collection/Collection.svelte';
|
|
19
22
|
import Dashboard from './pages/dashboard/Dashboard.svelte';
|
|
20
23
|
import Live from './pages/live/Live.svelte';
|
|
24
|
+
import { populate } from './util/populate.js';
|
|
25
|
+
import { useCommands } from './context/commands.svelte.js';
|
|
21
26
|
export {
|
|
22
27
|
// Components
|
|
23
|
-
Area, Button, Collection, CollectionDoc, Dashboard, Doc, Field, ForgotPassword, Input, Live, Panel, ResetPassword, SignIn, SpinLoader
|
|
28
|
+
Area, Button, Collection, CollectionDoc, Dashboard, Doc, Field, ForgotPassword, Input, Live, Panel, RelationInline, RenderFields, ResetPassword, RichTextInline, SignIn, SpinLoader,
|
|
29
|
+
// A block render's relations, resolved as the API answers them
|
|
30
|
+
populate,
|
|
31
|
+
// The commands a component offers while mounted: palette lines, keys
|
|
32
|
+
useCommands };
|
|
24
33
|
// Context keys, for a plugin/field that needs to read a context rime's own panel sets
|
|
25
34
|
export const CONTEXT = {
|
|
26
35
|
COLLECTION: COLLECTION_CTX,
|
|
@@ -52,7 +52,22 @@
|
|
|
52
52
|
{/if}
|
|
53
53
|
</AuthForm>
|
|
54
54
|
|
|
55
|
-
<style
|
|
55
|
+
<style>/* A level: its fill, a hairline, its shadow. raised, float. */
|
|
56
|
+
|
|
57
|
+
/* A well: an input, a track, a dropzone. Its edge shows on hover. */
|
|
58
|
+
|
|
59
|
+
/* The hover tint, laid over the element's own fill. */
|
|
60
|
+
|
|
61
|
+
/* The picked item of a segmented control. */
|
|
62
|
+
|
|
63
|
+
/* The primary button's face: black on light, white on dark. */
|
|
64
|
+
|
|
65
|
+
/* Keyboard focus on a button, a tab, a link. */
|
|
66
|
+
|
|
67
|
+
/* A focused input: an accent edge and a soft halo. */
|
|
68
|
+
|
|
69
|
+
/* An input with an error. */
|
|
70
|
+
p {
|
|
56
71
|
font-size: var(--rz-text-lg);
|
|
57
72
|
font-variation-settings: 'wght' 600;
|
|
58
73
|
font-weight: 600;
|