rimecms 0.33.0 → 1.0.1
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 +36 -15
- package/dist/adapter-sqlite/generate-schema/templates.server.js +60 -18
- 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 +131 -0
- package/dist/adapter-sqlite/read.server.d.ts +10 -1
- package/dist/adapter-sqlite/read.server.js +22 -10
- package/dist/adapter-sqlite/rows.server.d.ts +1 -1
- 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 +98 -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 +8 -8
- package/dist/core/config/context.server.d.ts +2 -2
- 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/routes/common.server.d.ts +2 -0
- package/dist/core/dev/codegen/routes/common.server.js +7 -3
- package/dist/core/dev/codegen/routes/util.server.d.ts +2 -1
- package/dist/core/dev/codegen/routes/util.server.js +4 -1
- 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/config-memo.server.js +4 -0
- 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/duplicate.js +1 -1
- 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/thumbnail/hooks/set-document-thumbnail.server.js +1 -1
- 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/title/hooks/set-document-title.server.js +1 -1
- package/dist/core/prototype/shared/url/addresses.server.d.ts +36 -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 +6 -0
- package/dist/core/prototype/shared/url/hooks/detach-paths.server.js +19 -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 +8 -0
- package/dist/core/prototype/shared/url/hooks/sync-paths.server.js +38 -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 +2 -1
- 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/index.d.ts +1 -41
- package/dist/fields/relation/index.js +0 -67
- package/dist/fields/relation/module.server.js +7 -1
- package/dist/fields/relation/populate.d.ts +8 -0
- package/dist/fields/relation/populate.js +49 -0
- package/dist/fields/relation/util.d.ts +69 -0
- package/dist/fields/relation/util.js +103 -0
- package/dist/fields/relation/value.d.ts +25 -0
- package/dist/fields/relation/value.js +27 -0
- package/dist/fields/rich-text/client.d.ts +2 -5
- package/dist/fields/rich-text/client.js +1 -3
- package/dist/fields/rich-text/component/Cell.svelte +1 -1
- 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-extension.js +3 -3
- package/dist/fields/rich-text/core/features/resource/resource.svelte +21 -7
- package/dist/fields/rich-text/core/features/upload/upload-extension.js +3 -4
- package/dist/fields/rich-text/core/features/upload/upload.svelte +21 -9
- 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/rich-text/index.d.ts +0 -17
- package/dist/fields/rich-text/index.js +0 -44
- package/dist/fields/rich-text/json.d.ts +18 -0
- package/dist/fields/rich-text/json.js +44 -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 +2 -8
- package/dist/index.js +2 -6
- package/dist/{panel/components/sections/live → live}/Consumer.svelte +2 -2
- package/dist/{panel/components/sections/live → live}/Consumer.svelte.d.ts +1 -1
- package/dist/{panel/components/sections/live → live}/LiveEdit.svelte +3 -3
- package/dist/{panel/components/sections/live → live}/Provider.svelte +1 -1
- package/dist/{panel/context/live.svelte.d.ts → live/context.svelte.d.ts} +1 -1
- package/dist/{panel/context/live.svelte.js → live/context.svelte.js} +3 -74
- 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/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/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/checkbox/checkbox.svelte.d.ts +1 -1
- 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-checkbox-item.svelte.d.ts +1 -1
- 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/switch/switch.svelte.d.ts +1 -1
- 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/config.svelte.d.ts +2 -2
- package/dist/panel/context/documentForm.svelte.d.ts +34 -2
- package/dist/panel/context/documentForm.svelte.js +106 -103
- 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 -4
- package/dist/panel/index.js +11 -5
- 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/public.d.ts +4 -0
- package/dist/panel/public.js +6 -0
- 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/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/public.d.ts +13 -0
- package/dist/public.js +12 -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 +12 -8
- 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/relation/client.d.ts +0 -28
- package/dist/fields/relation/client.js +0 -37
- 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
- /package/dist/{panel/components/sections/live → live}/LiveEdit.svelte.d.ts +0 -0
- /package/dist/{panel/components/sections/live → live}/Provider.svelte.d.ts +0 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { PARAMS } from '../../core/constants.js';
|
|
2
|
+
import { getExtensionFromMimeType } from '../../core/prototype/collection/upload/util/mime.js';
|
|
3
|
+
import { trycatchFetch } from '../../util/function.js';
|
|
4
|
+
/**
|
|
5
|
+
* Whether the collection takes this file. No `accept` takes anything.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* isAccepted(photo, ['image/jpeg', 'image/png']) // true for a .jpg
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export const isAccepted = (file, accept) => !accept?.length || accept.includes(file.type);
|
|
12
|
+
/**
|
|
13
|
+
* A mime type as people read it.
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* typeLabel('image/jpeg') // 'JPG'
|
|
17
|
+
* typeLabel('application/pdf') // 'PDF'
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const typeLabel = (mimeType) => {
|
|
21
|
+
if (!mimeType)
|
|
22
|
+
return '';
|
|
23
|
+
return (getExtensionFromMimeType(mimeType) ?? mimeType.split('/').pop() ?? '').toUpperCase();
|
|
24
|
+
};
|
|
25
|
+
const BYTES = { B: 1, KB: 1_000, MB: 1_000_000, GB: 1_000_000_000 };
|
|
26
|
+
/**
|
|
27
|
+
* A file size in bytes, from a count of bytes or a stored size.
|
|
28
|
+
*
|
|
29
|
+
* ```ts
|
|
30
|
+
* fileSizeBytes('3.20MB') // 3200000
|
|
31
|
+
* fileSizeBytes('0.84KB') // 840
|
|
32
|
+
* fileSizeBytes(840) // 840
|
|
33
|
+
* fileSizeBytes('') // null
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export const fileSizeBytes = (size) => {
|
|
37
|
+
if (typeof size === 'number')
|
|
38
|
+
return Number.isFinite(size) ? size : null;
|
|
39
|
+
const match = size?.trim().match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)?$/i);
|
|
40
|
+
if (!match)
|
|
41
|
+
return null;
|
|
42
|
+
const unit = (match[2]?.toUpperCase() ?? 'B');
|
|
43
|
+
return Math.round(parseFloat(match[1]) * BYTES[unit]);
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A file size as people read it: whole kilobytes, then one decimal from a megabyte up.
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* fileSizeLabel('3.20MB') // '3.2 MB'
|
|
50
|
+
* fileSizeLabel('840.12KB') // '840 KB'
|
|
51
|
+
* fileSizeLabel(1_240_000_000) // '1.2 GB'
|
|
52
|
+
* fileSizeLabel(512) // '512 B'
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export const fileSizeLabel = (size) => {
|
|
56
|
+
const bytes = fileSizeBytes(size);
|
|
57
|
+
if (bytes === null)
|
|
58
|
+
return '';
|
|
59
|
+
if (bytes < BYTES.KB)
|
|
60
|
+
return `${bytes} B`;
|
|
61
|
+
const kilobytes = Math.round(bytes / BYTES.KB);
|
|
62
|
+
if (kilobytes < 1000)
|
|
63
|
+
return `${kilobytes} KB`;
|
|
64
|
+
const megabytes = bytes / BYTES.MB;
|
|
65
|
+
if (megabytes < 999.95)
|
|
66
|
+
return `${megabytes.toFixed(1)} MB`;
|
|
67
|
+
return `${(bytes / BYTES.GB).toFixed(1)} GB`;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* A media's size and type, for the line under its name.
|
|
71
|
+
*
|
|
72
|
+
* ```ts
|
|
73
|
+
* mediaMeta({ filesize: '3.20MB', mimeType: 'image/jpeg' }) // '3.2 MB · JPG'
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export const mediaMeta = (doc) => [fileSizeLabel(doc.filesize), typeLabel(doc.mimeType ?? undefined)].filter(Boolean).join(' · ');
|
|
77
|
+
export const MEDIA_KINDS = ['image', 'video', 'audio', 'document', 'other'];
|
|
78
|
+
const DOCUMENT_TYPES = /^(text\/|application\/(pdf|rtf|msword|vnd\.ms-|vnd\.openxmlformats-officedocument|vnd\.oasis\.opendocument))/;
|
|
79
|
+
/**
|
|
80
|
+
* The kind of file a mime type is, to filter medias by.
|
|
81
|
+
*
|
|
82
|
+
* ```ts
|
|
83
|
+
* mediaKind('image/webp') // 'image'
|
|
84
|
+
* mediaKind('application/pdf') // 'document'
|
|
85
|
+
* mediaKind('application/zip') // 'other'
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export const mediaKind = (mimeType) => {
|
|
89
|
+
const type = mimeType ?? '';
|
|
90
|
+
if (type.startsWith('image/'))
|
|
91
|
+
return 'image';
|
|
92
|
+
if (type.startsWith('video/'))
|
|
93
|
+
return 'video';
|
|
94
|
+
if (type.startsWith('audio/'))
|
|
95
|
+
return 'audio';
|
|
96
|
+
if (DOCUMENT_TYPES.test(type))
|
|
97
|
+
return 'document';
|
|
98
|
+
return 'other';
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* The accepted types as a sentence.
|
|
102
|
+
*
|
|
103
|
+
* ```ts
|
|
104
|
+
* acceptLabel(['image/jpeg', 'image/png', 'image/webp'], 'or') // 'JPG, PNG or WEBP'
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export const acceptLabel = (accept, or) => {
|
|
108
|
+
const labels = [...new Set(accept.map(typeLabel))];
|
|
109
|
+
if (labels.length < 2)
|
|
110
|
+
return labels.join('');
|
|
111
|
+
return `${labels.slice(0, -1).join(', ')} ${or} ${labels.at(-1)}`;
|
|
112
|
+
};
|
|
113
|
+
const readAsDataURL = (file) => new Promise((resolve, reject) => {
|
|
114
|
+
const reader = new FileReader();
|
|
115
|
+
reader.onload = () => typeof reader.result === 'string'
|
|
116
|
+
? resolve(reader.result)
|
|
117
|
+
: reject(new Error(`Cannot read ${file.name}`));
|
|
118
|
+
reader.onerror = () => reject(reader.error ?? new Error(`Cannot read ${file.name}`));
|
|
119
|
+
reader.readAsDataURL(file);
|
|
120
|
+
});
|
|
121
|
+
/**
|
|
122
|
+
* Creates one document of an upload collection from a file, and answers it.
|
|
123
|
+
* Validation is skipped, so a required field the file cannot fill, like an `alt`, never blocks it.
|
|
124
|
+
*
|
|
125
|
+
* ```ts
|
|
126
|
+
* const doc = await uploadFile(file, { url: '/api/medias', path: 'root:press' });
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export async function uploadFile(file, target) {
|
|
130
|
+
if (!isAccepted(file, target.accept)) {
|
|
131
|
+
throw new Error(`${file.name} is not of an accepted type`);
|
|
132
|
+
}
|
|
133
|
+
const base64 = await readAsDataURL(file);
|
|
134
|
+
const [error, response] = await trycatchFetch(`${target.url}?${PARAMS.SKIP_VALIDATION}=true`, {
|
|
135
|
+
method: 'POST',
|
|
136
|
+
body: JSON.stringify({ _path: target.path, file: { base64, filename: file.name } })
|
|
137
|
+
});
|
|
138
|
+
if (error)
|
|
139
|
+
throw error;
|
|
140
|
+
const { doc } = await response.json();
|
|
141
|
+
return doc;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Uploads files one after the other. A file that fails is counted and skipped.
|
|
145
|
+
*
|
|
146
|
+
* ```ts
|
|
147
|
+
* const { docs, failed } = await uploadFiles(files, target, (progress) => (state = progress));
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
export async function uploadFiles(files, target, onProgress) {
|
|
151
|
+
const docs = [];
|
|
152
|
+
const failed = [];
|
|
153
|
+
const report = (current) => onProgress?.({ total: files.length, uploaded: docs.length, failed: [...failed], current });
|
|
154
|
+
for (const file of files) {
|
|
155
|
+
report(file.name);
|
|
156
|
+
try {
|
|
157
|
+
docs.push(await uploadFile(file, target));
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
failed.push(file.name);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
report(null);
|
|
164
|
+
return { docs, failed };
|
|
165
|
+
}
|
package/dist/public.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getI18nContext, setI18nContext } from './core/i18n/context.js';
|
|
2
|
+
import { createI18n } from './core/i18n/index.js';
|
|
3
|
+
import { openSse } from './core/plugins/sse/index.js';
|
|
4
|
+
import { isRelationPopulated, isRelationResolved, isRelationUnresolved, resolveRelation } from './fields/relation/util.js';
|
|
5
|
+
import RenderRichText from './fields/rich-text/core/render-rich-text.svelte';
|
|
6
|
+
import { richTextJSONToText } from './fields/rich-text/json.js';
|
|
7
|
+
import LiveConsumer from './live/Consumer.svelte';
|
|
8
|
+
import LiveEdit from './live/LiveEdit.svelte';
|
|
9
|
+
import LiveProvider from './live/Provider.svelte';
|
|
10
|
+
export type { SSEEvent, SSEHandler } from './core/plugins/sse/index.js';
|
|
11
|
+
export type { RichTextNodeRenderer, RichTextNodeRendererProps } from './fields/rich-text/core/types.js';
|
|
12
|
+
export type { JSONContent } from '@tiptap/core';
|
|
13
|
+
export { createI18n, getI18nContext, isRelationPopulated, isRelationResolved, isRelationUnresolved, LiveConsumer, LiveEdit, LiveProvider, openSse, RenderRichText, resolveRelation, richTextJSONToText, setI18nContext };
|
package/dist/public.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// rimecms/public: what a site page imports from rime, and only that. Nothing it reaches is the
|
|
2
|
+
// panel or the config, which `public-entries.spec.ts` checks.
|
|
3
|
+
import { getI18nContext, setI18nContext } from './core/i18n/context.js';
|
|
4
|
+
import { createI18n } from './core/i18n/index.js';
|
|
5
|
+
import { openSse } from './core/plugins/sse/index.js';
|
|
6
|
+
import { isRelationPopulated, isRelationResolved, isRelationUnresolved, resolveRelation } from './fields/relation/util.js';
|
|
7
|
+
import RenderRichText from './fields/rich-text/core/render-rich-text.svelte';
|
|
8
|
+
import { richTextJSONToText } from './fields/rich-text/json.js';
|
|
9
|
+
import LiveConsumer from './live/Consumer.svelte';
|
|
10
|
+
import LiveEdit from './live/LiveEdit.svelte';
|
|
11
|
+
import LiveProvider from './live/Provider.svelte';
|
|
12
|
+
export { createI18n, getI18nContext, isRelationPopulated, isRelationResolved, isRelationUnresolved, LiveConsumer, LiveEdit, LiveProvider, openSse, RenderRichText, resolveRelation, richTextJSONToText, setI18nContext };
|
package/dist/util/index.d.ts
CHANGED
|
@@ -12,14 +12,11 @@ import * as string from './string.js';
|
|
|
12
12
|
*
|
|
13
13
|
* This is a **barrel, not a home**: what a namespace here re-exports and where that code lives
|
|
14
14
|
* are separate questions. Everything in `./*` passes the util rule (no rime vocabulary), while
|
|
15
|
-
* `access
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* `access` and `validate` name rime types and therefore live with their concept — auth and fields
|
|
16
|
+
* respectively. They are published from here because that is the path config authors import them
|
|
17
|
+
* from.
|
|
18
|
+
*
|
|
19
|
+
* Nothing inside the library imports from here: internal code reaches for the module itself, so
|
|
20
|
+
* this barrel stays a leaf of the import graph.
|
|
18
21
|
*/
|
|
19
|
-
|
|
20
|
-
declare const doc: {
|
|
21
|
-
normalizeFieldPath: (path: string) => string;
|
|
22
|
-
createBlankDocument: <C extends import("../types.js").BuiltCollection | import("../types.js").BuiltArea, T extends import("../core/prototype/types.js").GenericDoc = import("../core/prototype/types.js").GenericDoc>(config: C, event?: import("@sveltejs/kit").RequestEvent) => T;
|
|
23
|
-
toNestedStructure: (documents: import("../core/prototype/types.js").GenericDoc[]) => import("../core/prototype/types.js").GenericDoc[];
|
|
24
|
-
};
|
|
25
|
-
export { access, array, doc, file, object, random, state, string, upload, validate };
|
|
22
|
+
export { access, array, file, object, random, state, string, upload, validate };
|
package/dist/util/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { access } from '../core/auth/access.js';
|
|
2
2
|
import * as validate from '../core/fields/validate.js';
|
|
3
3
|
import * as upload from '../core/prototype/collection/upload/util/client.js';
|
|
4
|
-
import * as docBuilders from '../core/prototype/doc.js';
|
|
5
4
|
import * as array from './array.js';
|
|
6
5
|
import * as file from './file.js';
|
|
7
6
|
import * as object from './object.js';
|
|
8
|
-
import * as docPath from './path.js';
|
|
9
7
|
import * as random from './random.js';
|
|
10
8
|
import * as state from './state.js';
|
|
11
9
|
import * as string from './string.js';
|
|
@@ -14,10 +12,11 @@ import * as string from './string.js';
|
|
|
14
12
|
*
|
|
15
13
|
* This is a **barrel, not a home**: what a namespace here re-exports and where that code lives
|
|
16
14
|
* are separate questions. Everything in `./*` passes the util rule (no rime vocabulary), while
|
|
17
|
-
* `access
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* `access` and `validate` name rime types and therefore live with their concept — auth and fields
|
|
16
|
+
* respectively. They are published from here because that is the path config authors import them
|
|
17
|
+
* from.
|
|
18
|
+
*
|
|
19
|
+
* Nothing inside the library imports from here: internal code reaches for the module itself, so
|
|
20
|
+
* this barrel stays a leaf of the import graph.
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
-
const doc = { ...docBuilders, ...docPath };
|
|
23
|
-
export { access, array, doc, file, object, random, state, string, upload, validate };
|
|
22
|
+
export { access, array, file, object, random, state, string, upload, validate };
|
package/dist/util/object.d.ts
CHANGED
|
@@ -35,6 +35,16 @@ export declare const omitId: <T extends {
|
|
|
35
35
|
id?: string;
|
|
36
36
|
[k: string]: any;
|
|
37
37
|
}>(obj: T) => Omit<T, "id">;
|
|
38
|
+
/**
|
|
39
|
+
* `obj` with every key it lacks taken from `defaults`, an object both hold merged the same way.
|
|
40
|
+
* Anything the object holds is the object's — `null` included, an array as it is.
|
|
41
|
+
*
|
|
42
|
+
* ```
|
|
43
|
+
* withDefaults({ title: 'T', seo: { og: null } }, { title: null, body: null, seo: { og: null, meta: null } })
|
|
44
|
+
* // { title: 'T', seo: { og: null, meta: null }, body: null }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare const withDefaults: <T extends Dic>(obj: T, defaults: Dic) => T;
|
|
38
48
|
/**
|
|
39
49
|
* Type guard to check if an object has all the specified properties.
|
|
40
50
|
*
|
package/dist/util/object.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeFieldPath } from './
|
|
1
|
+
import { normalizeFieldPath } from './string.js';
|
|
2
2
|
/**
|
|
3
3
|
* Creates a new object with only the specified keys from the original object.
|
|
4
4
|
*
|
|
@@ -54,6 +54,27 @@ export const withoutNull = (obj) => {
|
|
|
54
54
|
* omitId({ id: '123', name: 'John', age: 30 });
|
|
55
55
|
*/
|
|
56
56
|
export const omitId = (obj) => omit(['id'], obj);
|
|
57
|
+
/**
|
|
58
|
+
* `obj` with every key it lacks taken from `defaults`, an object both hold merged the same way.
|
|
59
|
+
* Anything the object holds is the object's — `null` included, an array as it is.
|
|
60
|
+
*
|
|
61
|
+
* ```
|
|
62
|
+
* withDefaults({ title: 'T', seo: { og: null } }, { title: null, body: null, seo: { og: null, meta: null } })
|
|
63
|
+
* // { title: 'T', seo: { og: null, meta: null }, body: null }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export const withDefaults = (obj, defaults) => {
|
|
67
|
+
const out = { ...obj };
|
|
68
|
+
for (const key of Object.keys(defaults)) {
|
|
69
|
+
const value = obj[key];
|
|
70
|
+
if (value === undefined)
|
|
71
|
+
out[key] = defaults[key];
|
|
72
|
+
else if (isObjectLiteral(value) && isObjectLiteral(defaults[key])) {
|
|
73
|
+
out[key] = withDefaults(value, defaults[key]);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
};
|
|
57
78
|
/**
|
|
58
79
|
* Type guard to check if an object has all the specified properties.
|
|
59
80
|
*
|
package/dist/util/string.d.ts
CHANGED
|
@@ -128,3 +128,20 @@ export declare const isValidSlug: (str: string) => boolean;
|
|
|
128
128
|
* allowed tags : ['strong', 'b', 'em', 'i', 'u', 'br', 'a']
|
|
129
129
|
*/
|
|
130
130
|
export declare const sanitize: (value?: string) => string;
|
|
131
|
+
/**
|
|
132
|
+
* The members of a generated type literal, one per line. A container's own type ends with a
|
|
133
|
+
* comma and a leaf's does not, so each is stripped before the join.
|
|
134
|
+
*
|
|
135
|
+
* ```ts
|
|
136
|
+
* joinMemberTypes(['title: string', 'facts: Array<TreeFacts>,']) // 'title: string,\nfacts: Array<TreeFacts>'
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export declare const joinMemberTypes: (types: string[]) => string;
|
|
140
|
+
/**
|
|
141
|
+
* Removes the block type from a field path.
|
|
142
|
+
*
|
|
143
|
+
* ```ts
|
|
144
|
+
* normalizeFieldPath('foo.bar.0:content.baz'); // 'foo.bar.0.baz'
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
export declare const normalizeFieldPath: (path: string) => string;
|
package/dist/util/string.js
CHANGED
|
@@ -301,3 +301,26 @@ export const sanitize = (value) => {
|
|
|
301
301
|
const sanitized = root.children ? root.children.map(processNode).join('') : '';
|
|
302
302
|
return decode(restoreWhitespace(sanitized));
|
|
303
303
|
};
|
|
304
|
+
/**
|
|
305
|
+
* The members of a generated type literal, one per line. A container's own type ends with a
|
|
306
|
+
* comma and a leaf's does not, so each is stripped before the join.
|
|
307
|
+
*
|
|
308
|
+
* ```ts
|
|
309
|
+
* joinMemberTypes(['title: string', 'facts: Array<TreeFacts>,']) // 'title: string,\nfacts: Array<TreeFacts>'
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
312
|
+
export const joinMemberTypes = (types) => types
|
|
313
|
+
.map((type) => type.trim().replace(/,$/, ''))
|
|
314
|
+
.filter(Boolean)
|
|
315
|
+
.join(',\n');
|
|
316
|
+
/**
|
|
317
|
+
* Removes the block type from a field path.
|
|
318
|
+
*
|
|
319
|
+
* ```ts
|
|
320
|
+
* normalizeFieldPath('foo.bar.0:content.baz'); // 'foo.bar.0.baz'
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
export const normalizeFieldPath = (path) => {
|
|
324
|
+
const regExpBlockType = /:[a-zA-Z0-9]+/g;
|
|
325
|
+
return path.replace(regExpBlockType, '');
|
|
326
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rimecms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"homepage": "https://github.com/bienbiendev/rime",
|
|
5
5
|
"packageManager": "bun@1.3.0",
|
|
6
6
|
"scripts": {
|
|
@@ -39,6 +39,12 @@
|
|
|
39
39
|
"import": "./dist/index.js",
|
|
40
40
|
"default": "./dist/index.js"
|
|
41
41
|
},
|
|
42
|
+
"./public": {
|
|
43
|
+
"types": "./dist/public.d.ts",
|
|
44
|
+
"svelte": "./dist/public.js",
|
|
45
|
+
"import": "./dist/public.js",
|
|
46
|
+
"default": "./dist/public.js"
|
|
47
|
+
},
|
|
42
48
|
"./server": {
|
|
43
49
|
"types": "./dist/server.d.ts",
|
|
44
50
|
"import": "./dist/server.js",
|
|
@@ -69,16 +75,16 @@
|
|
|
69
75
|
"import": "./dist/fields/rich-text/client.js",
|
|
70
76
|
"default": "./dist/fields/rich-text/client.js"
|
|
71
77
|
},
|
|
72
|
-
"./fields/relation": {
|
|
73
|
-
"types": "./dist/fields/relation/client.d.ts",
|
|
74
|
-
"import": "./dist/fields/relation/client.js",
|
|
75
|
-
"default": "./dist/fields/relation/client.js"
|
|
76
|
-
},
|
|
77
78
|
"./panel": {
|
|
78
79
|
"types": "./dist/panel/index.d.ts",
|
|
79
80
|
"import": "./dist/panel/index.js",
|
|
80
81
|
"default": "./dist/panel/index.js"
|
|
81
82
|
},
|
|
83
|
+
"./panel/public": {
|
|
84
|
+
"types": "./dist/panel/public.d.ts",
|
|
85
|
+
"import": "./dist/panel/public.js",
|
|
86
|
+
"default": "./dist/panel/public.js"
|
|
87
|
+
},
|
|
82
88
|
"./panel/style/index.css": {
|
|
83
89
|
"import": "./dist/panel/style/index.css",
|
|
84
90
|
"default": "./dist/panel/style/index.css"
|
|
@@ -233,11 +239,9 @@
|
|
|
233
239
|
"camelcase": "^8.0.0",
|
|
234
240
|
"chalk": "^5.6.2",
|
|
235
241
|
"clone-deep": "^4.0.1",
|
|
236
|
-
"command-score": "^0.1.2",
|
|
237
242
|
"commander": "^12.1.0",
|
|
238
243
|
"dedent": "^1.5.3",
|
|
239
244
|
"deep-object-diff": "^1.1.9",
|
|
240
|
-
"deepmerge": "^4.3.1",
|
|
241
245
|
"dotenv": "^16.4.7",
|
|
242
246
|
"drizzle-orm": "1.0.0-rc.4",
|
|
243
247
|
"flat": "^6.0.1",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { TreeBlock } from '../../prototype/types.js';
|
|
2
|
-
import type { TreeBuilder } from '../../../fields/tree/index.js';
|
|
3
|
-
import type { ConfigMap } from './types.js';
|
|
4
|
-
export declare function buildTreeFieldsMap(treeConfig: TreeBuilder, treeItems: TreeBlock[], basePath: string): ConfigMap;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { isFormField } from '../../fields/util.js';
|
|
2
|
-
export function buildTreeFieldsMap(treeConfig, treeItems, basePath) {
|
|
3
|
-
const treeMap = {};
|
|
4
|
-
// Helper to add field configs for a specific path
|
|
5
|
-
const addFieldConfigs = (path) => {
|
|
6
|
-
for (const field of treeConfig.get.fields) {
|
|
7
|
-
if (isFormField(field)) {
|
|
8
|
-
treeMap[`${path}.${field.name}`] = field;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
// Process each item in the tree
|
|
13
|
-
const processItem = (item, itemPath) => {
|
|
14
|
-
// Add configs for current item
|
|
15
|
-
addFieldConfigs(itemPath);
|
|
16
|
-
// If item has children, process them
|
|
17
|
-
if (item._children && Array.isArray(item._children)) {
|
|
18
|
-
item._children.forEach((child, childIndex) => {
|
|
19
|
-
const childPath = `${itemPath}._children.${childIndex}`;
|
|
20
|
-
processItem(child, childPath);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
// Process each root level item
|
|
25
|
-
treeItems.forEach((item, index) => {
|
|
26
|
-
const itemPath = `${basePath}.${index}`;
|
|
27
|
-
processItem(item, itemPath);
|
|
28
|
-
});
|
|
29
|
-
return treeMap;
|
|
30
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { GenericDoc } from './types.js';
|
|
2
|
-
import type { BuiltArea, BuiltCollection } from '../../types.js';
|
|
3
|
-
import type { RequestEvent } from '@sveltejs/kit';
|
|
4
|
-
/**
|
|
5
|
-
* Creates a blank document based on a collection or area configuration.
|
|
6
|
-
* Initializes all fields with appropriate default values based on their type.
|
|
7
|
-
*
|
|
8
|
-
* @returns A new blank document with default values for all fields
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* // Create a blank document for the 'pages' collection
|
|
12
|
-
* const blankPage = createBlankDocument(config.getCollection('pages'));
|
|
13
|
-
*/
|
|
14
|
-
export declare const createBlankDocument: <C extends BuiltCollection | BuiltArea, T extends GenericDoc = GenericDoc>(config: C, event?: RequestEvent) => T;
|
|
15
|
-
/**
|
|
16
|
-
* Converts a flat array of documents into a nested tree structure based on parent-child relationships.
|
|
17
|
-
* Documents are organized hierarchically with each document containing its children in the _children property.
|
|
18
|
-
*
|
|
19
|
-
* @param documents - Array of documents with parent properties indicating their relationships
|
|
20
|
-
* @returns A nested tree structure where each document contains its children
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* // Convert a flat list of pages into a hierarchical structure
|
|
24
|
-
* const pageTree = toNestedStructure(pagesList);
|
|
25
|
-
* // Result: [{ id: '1', _children: [{ id: '2', _children: [] }] }]
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* Converts a flat array of documents into a nested tree structure
|
|
29
|
-
* based on _parent and _position fields
|
|
30
|
-
*/
|
|
31
|
-
export declare const toNestedStructure: (documents: GenericDoc[]) => GenericDoc[];
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { FormFieldBuilder } from '../fields/builders/form-field-builder.js';
|
|
2
|
-
import { GroupFieldBuilder } from '../../fields/group/index.js';
|
|
3
|
-
import { TabsBuilder } from '../../fields/tabs/index.js';
|
|
4
|
-
import { snapshot } from '../../util/state.js';
|
|
5
|
-
/**
|
|
6
|
-
* Creates a blank document based on a collection or area configuration.
|
|
7
|
-
* Initializes all fields with appropriate default values based on their type.
|
|
8
|
-
*
|
|
9
|
-
* @returns A new blank document with default values for all fields
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* // Create a blank document for the 'pages' collection
|
|
13
|
-
* const blankPage = createBlankDocument(config.getCollection('pages'));
|
|
14
|
-
*/
|
|
15
|
-
export const createBlankDocument = (config, event) => {
|
|
16
|
-
/**
|
|
17
|
-
* Recursively processes field definitions to create a blank document structure.
|
|
18
|
-
* Handles special field types like tabs, blocks, relations, and nested fields.
|
|
19
|
-
*/
|
|
20
|
-
function reduceFieldsToBlankDocument(prev, curr) {
|
|
21
|
-
try {
|
|
22
|
-
if (curr instanceof TabsBuilder) {
|
|
23
|
-
curr.get.tabs.forEach((tab) => {
|
|
24
|
-
prev[tab.name] = tab.get.fields.reduce(reduceFieldsToBlankDocument, {});
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
else if (['blocks', 'relation', 'tree'].includes(curr.type)) {
|
|
28
|
-
prev[curr.name] = [];
|
|
29
|
-
}
|
|
30
|
-
else if (curr instanceof GroupFieldBuilder) {
|
|
31
|
-
prev[curr.name] = curr.get.fields.reduce(reduceFieldsToBlankDocument, {});
|
|
32
|
-
}
|
|
33
|
-
else if (curr instanceof FormFieldBuilder) {
|
|
34
|
-
// Presentational fields (separator, bare component()) are plain
|
|
35
|
-
// FieldBuilder, never FormFieldBuilder, and get skipped here rather
|
|
36
|
-
// than assigned `prev['']` (they never got a real name) — that used
|
|
37
|
-
// to corrupt the parent object into looking array-like once
|
|
38
|
-
// flattened/unflattened.
|
|
39
|
-
const defaultValue = curr.use.defaultValue({ event });
|
|
40
|
-
prev[curr.name] = defaultValue !== undefined ? defaultValue : null;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
catch (err) {
|
|
44
|
-
console.error(curr);
|
|
45
|
-
throw err;
|
|
46
|
-
}
|
|
47
|
-
return prev;
|
|
48
|
-
}
|
|
49
|
-
const fields = config.fields.reduce(reduceFieldsToBlankDocument, {});
|
|
50
|
-
/**
|
|
51
|
-
* The fields, plus what every document has regardless of kind. Nothing feature-shaped: a
|
|
52
|
-
* feature adds to this through `FeatureDefinition.blank`, which the local API folds — see
|
|
53
|
-
* `prototype/api.server.ts`.
|
|
54
|
-
*
|
|
55
|
-
* An `isUploadConfig(config) && 'imageSizes' in config` branch used to seed `sizes: {}` here.
|
|
56
|
-
* It never once ran: `imageSizes` is a member of `UploadConfig`, so it lives at
|
|
57
|
-
* `config.upload.imageSizes` and never at `config.imageSizes` — every other reader in the repo
|
|
58
|
-
* uses the former. Removed rather than moved to `upload.blank`, because reviving a branch that
|
|
59
|
-
* has never executed is a behaviour change, not a relocation.
|
|
60
|
-
*/
|
|
61
|
-
return {
|
|
62
|
-
...fields,
|
|
63
|
-
_type: config.slug,
|
|
64
|
-
_prototype: config.type
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Converts a flat array of documents into a nested tree structure based on parent-child relationships.
|
|
69
|
-
* Documents are organized hierarchically with each document containing its children in the _children property.
|
|
70
|
-
*
|
|
71
|
-
* @param documents - Array of documents with parent properties indicating their relationships
|
|
72
|
-
* @returns A nested tree structure where each document contains its children
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* // Convert a flat list of pages into a hierarchical structure
|
|
76
|
-
* const pageTree = toNestedStructure(pagesList);
|
|
77
|
-
* // Result: [{ id: '1', _children: [{ id: '2', _children: [] }] }]
|
|
78
|
-
*/
|
|
79
|
-
/**
|
|
80
|
-
* Converts a flat array of documents into a nested tree structure
|
|
81
|
-
* based on _parent and _position fields
|
|
82
|
-
*/
|
|
83
|
-
export const toNestedStructure = (documents) => {
|
|
84
|
-
const incomingDocs = snapshot(documents);
|
|
85
|
-
// Create a map for quick document lookup by ID
|
|
86
|
-
const docById = new Map();
|
|
87
|
-
incomingDocs.forEach((doc) => docById.set(doc.id, doc));
|
|
88
|
-
// Track processed documents to prevent infinite recursion
|
|
89
|
-
const processed = new Set();
|
|
90
|
-
// Process documents recursively
|
|
91
|
-
const processDocument = (doc) => {
|
|
92
|
-
if (!doc || processed.has(doc.id)) {
|
|
93
|
-
return doc;
|
|
94
|
-
}
|
|
95
|
-
processed.add(doc.id);
|
|
96
|
-
const result = { ...doc };
|
|
97
|
-
// Process children first (depth-first)
|
|
98
|
-
if (Array.isArray(result._children)) {
|
|
99
|
-
result._children = result._children
|
|
100
|
-
.map((id) => {
|
|
101
|
-
const childDoc = docById.get(id);
|
|
102
|
-
return childDoc ? processDocument(childDoc) : null;
|
|
103
|
-
})
|
|
104
|
-
.filter(Boolean);
|
|
105
|
-
}
|
|
106
|
-
// Only set the parent ID, don't process it recursively
|
|
107
|
-
if (result._parent && typeof result._parent === 'string') {
|
|
108
|
-
result._parent = docById.get(result._parent)?.id || null;
|
|
109
|
-
}
|
|
110
|
-
return result;
|
|
111
|
-
};
|
|
112
|
-
const output = incomingDocs
|
|
113
|
-
.filter((doc) => !doc._parent)
|
|
114
|
-
.map(processDocument)
|
|
115
|
-
.sort((a, b) => (a._position || 0) - (b._position || 0));
|
|
116
|
-
// Filter to get root documents and process them
|
|
117
|
-
return output;
|
|
118
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Collection } from '../../../config/types.js';
|
|
2
|
-
type Input = {
|
|
3
|
-
$url?: Collection<any>['$url'];
|
|
4
|
-
fields?: Collection<any>['fields'];
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Adds the hidden `url` field a document's computed url is stored in.
|
|
8
|
-
*
|
|
9
|
-
* Applied only to configs that declare `$url`, which the feature's `enabled` decides, so there is
|
|
10
|
-
* no condition here. See features/url/index.ts.
|
|
11
|
-
*/
|
|
12
|
-
export declare const augmentUrl: <T extends Input>(config: T) => T;
|
|
13
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { text } from '../../../../fields/text/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Adds the hidden `url` field a document's computed url is stored in.
|
|
4
|
-
*
|
|
5
|
-
* Applied only to configs that declare `$url`, which the feature's `enabled` decides, so there is
|
|
6
|
-
* no condition here. See features/url/index.ts.
|
|
7
|
-
*/
|
|
8
|
-
export const augmentUrl = (config) => ({
|
|
9
|
-
...config,
|
|
10
|
-
fields: [...(config.fields || []), text('url').localized().hidden()]
|
|
11
|
-
});
|