@xleddyl/nuxt-cms 0.9.3 → 0.10.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/README.md +1 -1
- package/dist/module.d.mts +20 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1037 -148
- package/dist/runtime/app/blocks/CmsBlocks.d.vue.ts +1 -1
- package/dist/runtime/app/blocks/CmsBlocks.vue +57 -9
- package/dist/runtime/app/blocks/CmsBlocks.vue.d.ts +1 -1
- package/dist/runtime/app/blocks/CmsField.d.ts +24 -0
- package/dist/runtime/app/blocks/CmsField.js +16 -0
- package/dist/runtime/app/blocks/node.d.ts +37 -0
- package/dist/runtime/app/blocks/node.js +17 -0
- package/dist/runtime/app/blocks/resolve.d.ts +18 -0
- package/dist/runtime/app/blocks/resolve.js +34 -0
- package/dist/runtime/app/components/cms/BlockPicker.d.vue.ts +22 -0
- package/dist/runtime/app/components/cms/BlockPicker.vue +87 -0
- package/dist/runtime/app/components/cms/BlockPicker.vue.d.ts +22 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.d.vue.ts +38 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.vue +44 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.vue.d.ts +38 -0
- package/dist/runtime/app/components/cms/BlockTree.d.vue.ts +29 -0
- package/dist/runtime/app/components/cms/BlockTree.vue +322 -0
- package/dist/runtime/app/components/cms/BlockTree.vue.d.ts +29 -0
- package/dist/runtime/app/components/cms/BlocksField.vue +569 -218
- package/dist/runtime/app/components/cms/BrandMark.vue +7 -13
- package/dist/runtime/app/components/cms/ConfirmGroups.vue +15 -13
- package/dist/runtime/app/components/cms/{BlockPalette.vue.d.ts → EditorHistory.d.vue.ts} +6 -5
- package/dist/runtime/app/components/cms/EditorHistory.vue +34 -0
- package/dist/runtime/app/components/cms/{BlockPalette.d.vue.ts → EditorHistory.vue.d.ts} +6 -5
- package/dist/runtime/app/components/cms/EntryDrawer.d.vue.ts +11 -5
- package/dist/runtime/app/components/cms/EntryDrawer.vue +183 -152
- package/dist/runtime/app/components/cms/EntryDrawer.vue.d.ts +11 -5
- package/dist/runtime/app/components/cms/EntryForm.d.vue.ts +16 -4
- package/dist/runtime/app/components/cms/EntryForm.vue +106 -146
- package/dist/runtime/app/components/cms/EntryForm.vue.d.ts +16 -4
- package/dist/runtime/app/components/cms/FieldInput.vue +10 -2
- package/dist/runtime/app/components/cms/FormSections.d.vue.ts +22 -0
- package/dist/runtime/app/components/cms/FormSections.vue +71 -0
- package/dist/runtime/app/components/cms/FormSections.vue.d.ts +22 -0
- package/dist/runtime/app/components/cms/ImportModal.vue +46 -58
- package/dist/runtime/app/components/cms/LinkField.d.vue.ts +16 -0
- package/dist/runtime/app/components/cms/LinkField.vue +250 -0
- package/dist/runtime/app/components/cms/LinkField.vue.d.ts +16 -0
- package/dist/runtime/app/components/cms/ListFilters.vue +10 -12
- package/dist/runtime/app/components/cms/LocaleSwitch.d.vue.ts +2 -1
- package/dist/runtime/app/components/cms/LocaleSwitch.vue +29 -5
- package/dist/runtime/app/components/cms/LocaleSwitch.vue.d.ts +2 -1
- package/dist/runtime/app/components/cms/MediaDetail.d.vue.ts +2 -0
- package/dist/runtime/app/components/cms/MediaDetail.vue +112 -83
- package/dist/runtime/app/components/cms/MediaDetail.vue.d.ts +2 -0
- package/dist/runtime/app/components/cms/MediaField.vue +35 -25
- package/dist/runtime/app/components/cms/MediaFolderPicker.vue +26 -71
- package/dist/runtime/app/components/cms/MediaGallery.d.vue.ts +1 -0
- package/dist/runtime/app/components/cms/MediaGallery.vue +442 -419
- package/dist/runtime/app/components/cms/MediaGallery.vue.d.ts +1 -0
- package/dist/runtime/app/components/cms/MediaThumb.vue +9 -25
- package/dist/runtime/app/components/cms/MediaUpload.vue +1 -1
- package/dist/runtime/app/components/cms/{BlockOutline.d.vue.ts → NestedBlockList.d.vue.ts} +5 -5
- package/dist/runtime/app/components/cms/NestedBlockList.vue +87 -0
- package/dist/runtime/app/components/cms/{BlockOutline.vue.d.ts → NestedBlockList.vue.d.ts} +5 -5
- package/dist/runtime/app/components/cms/PoweredBy.vue +12 -5
- package/dist/runtime/app/components/cms/PresetModal.d.vue.ts +18 -0
- package/dist/runtime/app/components/cms/PresetModal.vue +70 -0
- package/dist/runtime/app/components/cms/PresetModal.vue.d.ts +18 -0
- package/dist/runtime/app/components/cms/RelationField.vue +2 -8
- package/dist/runtime/app/components/cms/SettingsAccount.vue +60 -71
- package/dist/runtime/app/components/cms/SettingsColumns.vue +47 -69
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.vue +21 -0
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntries.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntries.vue +50 -0
- package/dist/runtime/app/components/cms/SettingsEntries.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntry.d.vue.ts +1 -10
- package/dist/runtime/app/components/cms/SettingsEntry.vue +11 -95
- package/dist/runtime/app/components/cms/SettingsEntry.vue.d.ts +1 -10
- package/dist/runtime/app/components/cms/SettingsEntryActions.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryActions.vue +42 -0
- package/dist/runtime/app/components/cms/SettingsEntryActions.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.vue +21 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.vue +17 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsLayout.vue +18 -14
- package/dist/runtime/app/components/cms/SettingsPresetForm.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsPresetForm.vue +60 -0
- package/dist/runtime/app/components/cms/SettingsPresetForm.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsPresets.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsPresets.vue +65 -0
- package/dist/runtime/app/components/cms/SettingsPresets.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.d.vue.ts +32 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.vue +45 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.vue.d.ts +32 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.vue +59 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.vue +77 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.vue +117 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.d.vue.ts +17 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.vue +43 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.vue.d.ts +17 -0
- package/dist/runtime/app/components/cms/SettingsSite.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsSite.vue +140 -0
- package/dist/runtime/app/components/cms/SettingsSite.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.d.vue.ts +8 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.vue +82 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.vue.d.ts +8 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.vue +179 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsUsers.d.vue.ts +9 -6
- package/dist/runtime/app/components/cms/SettingsUsers.vue +88 -234
- package/dist/runtime/app/components/cms/SettingsUsers.vue.d.ts +9 -6
- package/dist/runtime/app/components/cms/SharePreview.d.vue.ts +18 -0
- package/dist/runtime/app/components/cms/SharePreview.vue +219 -0
- package/dist/runtime/app/components/cms/SharePreview.vue.d.ts +18 -0
- package/dist/runtime/app/components/cms/SlugField.vue +5 -3
- package/dist/runtime/app/components/cms/StatusBadge.vue +9 -8
- package/dist/runtime/app/components/cms/TranslationBadges.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/TranslationBadges.vue +45 -0
- package/dist/runtime/app/components/cms/TranslationBadges.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/TranslationMenu.d.vue.ts +17 -0
- package/dist/runtime/app/components/cms/TranslationMenu.vue +28 -0
- package/dist/runtime/app/components/cms/TranslationMenu.vue.d.ts +17 -0
- package/dist/runtime/app/components/cms/VisualEditor.d.vue.ts +22 -4
- package/dist/runtime/app/components/cms/VisualEditor.vue +1152 -335
- package/dist/runtime/app/components/cms/VisualEditor.vue.d.ts +22 -4
- package/dist/runtime/app/components/cms/WelcomeModal.vue +32 -50
- package/dist/runtime/app/composables/cms-clipboard.d.ts +8 -0
- package/dist/runtime/app/composables/cms-clipboard.js +38 -0
- package/dist/runtime/app/composables/cms-confirm.d.ts +6 -8
- package/dist/runtime/app/composables/cms-confirm.js +5 -7
- package/dist/runtime/app/composables/cms-entry-disabled.d.ts +5 -1
- package/dist/runtime/app/composables/cms-entry-disabled.js +7 -0
- package/dist/runtime/app/composables/cms-entry-form.d.ts +15 -0
- package/dist/runtime/app/composables/cms-entry-form.js +40 -0
- package/dist/runtime/app/composables/cms-entry-settings.d.ts +30 -0
- package/dist/runtime/app/composables/cms-entry-settings.js +122 -0
- package/dist/runtime/app/composables/cms-entry.d.ts +5 -1
- package/dist/runtime/app/composables/cms-entry.js +36 -11
- package/dist/runtime/app/composables/cms-history.d.ts +10 -0
- package/dist/runtime/app/composables/cms-history.js +24 -0
- package/dist/runtime/app/composables/cms-link-targets.d.ts +10 -0
- package/dist/runtime/app/composables/cms-link-targets.js +40 -0
- package/dist/runtime/app/composables/cms-link-usage.d.ts +1 -0
- package/dist/runtime/app/composables/cms-link-usage.js +45 -0
- package/dist/runtime/app/composables/cms-media-library.d.ts +19 -9
- package/dist/runtime/app/composables/cms-media-library.js +31 -13
- package/dist/runtime/app/composables/cms-media-uploader.js +6 -20
- package/dist/runtime/app/composables/cms-permissions.d.ts +18 -0
- package/dist/runtime/app/composables/cms-permissions.js +54 -0
- package/dist/runtime/app/composables/cms-presets.d.ts +11 -0
- package/dist/runtime/app/composables/cms-presets.js +40 -0
- package/dist/runtime/app/composables/cms-preview-mode.d.ts +4 -0
- package/dist/runtime/app/composables/cms-preview-mode.js +8 -0
- package/dist/runtime/app/composables/cms-query.d.ts +3 -0
- package/dist/runtime/app/composables/cms-query.js +45 -20
- package/dist/runtime/app/composables/cms-record-list.d.ts +31 -0
- package/dist/runtime/app/composables/cms-record-list.js +75 -0
- package/dist/runtime/app/composables/cms-route.d.ts +6 -0
- package/dist/runtime/app/composables/cms-route.js +36 -0
- package/dist/runtime/app/composables/cms-runtime.d.ts +1 -0
- package/dist/runtime/app/composables/cms-save-handoff.d.ts +4 -0
- package/dist/runtime/app/composables/cms-save-handoff.js +19 -0
- package/dist/runtime/app/composables/cms-seo.d.ts +12 -0
- package/dist/runtime/app/composables/cms-seo.js +69 -0
- package/dist/runtime/app/composables/cms-settings-form.d.ts +13 -0
- package/dist/runtime/app/composables/cms-settings-form.js +29 -0
- package/dist/runtime/app/composables/cms-settings-sections.d.ts +26 -0
- package/dist/runtime/app/composables/cms-settings-sections.js +181 -0
- package/dist/runtime/app/composables/cms-settings-stores.d.ts +52 -0
- package/dist/runtime/app/composables/cms-settings-stores.js +156 -0
- package/dist/runtime/app/composables/cms-settings.d.ts +3 -3
- package/dist/runtime/app/composables/cms-settings.js +14 -8
- package/dist/runtime/app/composables/cms-site-disabled.d.ts +7 -0
- package/dist/runtime/app/composables/cms-site-disabled.js +8 -0
- package/dist/runtime/app/composables/cms-site.d.ts +7 -0
- package/dist/runtime/app/composables/cms-site.js +22 -0
- package/dist/runtime/app/composables/cms-toast.d.ts +2 -8
- package/dist/runtime/app/composables/cms-toast.js +3 -9
- package/dist/runtime/app/composables/cms-translation-actions.d.ts +15 -0
- package/dist/runtime/app/composables/cms-translation-actions.js +108 -0
- package/dist/runtime/app/css-url.d.ts +4 -0
- package/dist/runtime/app/image/CmsImage.d.vue.ts +89 -0
- package/dist/runtime/app/image/CmsImage.vue +91 -0
- package/dist/runtime/app/image/CmsImage.vue.d.ts +89 -0
- package/dist/runtime/app/layouts/cms-admin.d.vue.ts +2 -2
- package/dist/runtime/app/layouts/cms-admin.vue +98 -76
- package/dist/runtime/app/layouts/cms-admin.vue.d.ts +2 -2
- package/dist/runtime/app/layouts/cms-editor.vue +7 -2
- package/dist/runtime/app/links/CmsLink.d.vue.ts +18 -0
- package/dist/runtime/app/links/CmsLink.vue +18 -0
- package/dist/runtime/app/links/CmsLink.vue.d.ts +18 -0
- package/dist/runtime/app/middleware/cms-auth.js +13 -1
- package/dist/runtime/app/pages/admin-collection.vue +473 -297
- package/dist/runtime/app/pages/admin-content.vue +190 -53
- package/dist/runtime/app/pages/admin-entry.vue +79 -75
- package/dist/runtime/app/pages/admin-index.vue +18 -5
- package/dist/runtime/app/pages/admin-login.vue +1 -1
- package/dist/runtime/app/pages/admin-logout.vue +1 -1
- package/dist/runtime/app/pages/admin-media.vue +3 -3
- package/dist/runtime/app/pages/admin-preview.vue +112 -24
- package/dist/runtime/app/plugins/cms-field.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-field.js +8 -0
- package/dist/runtime/app/plugins/cms-preview-banner.client.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-preview-banner.client.js +19 -0
- package/dist/runtime/app/plugins/cms-preview.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-preview.js +27 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.d.vue.ts +7 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.vue +63 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.vue.d.ts +7 -0
- package/dist/runtime/app/preview/PreviewOverlay.d.vue.ts +17 -3
- package/dist/runtime/app/preview/PreviewOverlay.vue +629 -166
- package/dist/runtime/app/preview/PreviewOverlay.vue.d.ts +17 -3
- package/dist/runtime/app/preview/field-marker.d.ts +12 -0
- package/dist/runtime/app/preview/field-marker.js +20 -0
- package/dist/runtime/app/preview/inline-text.d.ts +15 -0
- package/dist/runtime/app/preview/inline-text.js +158 -0
- package/dist/runtime/app/utils/block-editor.d.ts +22 -0
- package/dist/runtime/app/utils/block-editor.js +12 -0
- package/dist/runtime/app/utils/keyboard.d.ts +6 -0
- package/dist/runtime/app/utils/keyboard.js +52 -0
- package/dist/runtime/app/utils/redirects.d.ts +6 -0
- package/dist/runtime/app/utils/redirects.js +7 -0
- package/dist/runtime/app/utils/ui.d.ts +8 -0
- package/dist/runtime/app/utils/ui.js +15 -1
- package/dist/runtime/app/utils/users.d.ts +15 -0
- package/dist/runtime/app/utils/users.js +14 -0
- package/dist/runtime/assets/cms.css +1 -1
- package/dist/runtime/generate.js +16 -2
- package/dist/runtime/server/api/collection-export.get.js +3 -2
- package/dist/runtime/server/api/collection-import.post.js +39 -11
- package/dist/runtime/server/api/collection.get.js +29 -10
- package/dist/runtime/server/api/collection.post.js +28 -11
- package/dist/runtime/server/api/collection.put.js +35 -13
- package/dist/runtime/server/api/item.delete.js +19 -7
- package/dist/runtime/server/api/item.get.js +3 -2
- package/dist/runtime/server/api/item.put.js +52 -18
- package/dist/runtime/server/api/link-usage.post.d.ts +5 -0
- package/dist/runtime/server/api/link-usage.post.js +21 -0
- package/dist/runtime/server/api/media-delete.post.js +4 -2
- package/dist/runtime/server/api/media-download.get.js +2 -2
- package/dist/runtime/server/api/media-folder.delete.js +8 -2
- package/dist/runtime/server/api/media-folder.patch.js +10 -2
- package/dist/runtime/server/api/media-folder.post.js +4 -2
- package/dist/runtime/server/api/media-move.post.js +7 -4
- package/dist/runtime/server/api/media-presign.post.js +2 -2
- package/dist/runtime/server/api/media-upload.put.js +2 -2
- package/dist/runtime/server/api/media-usage.post.d.ts +2 -4
- package/dist/runtime/server/api/media-usage.post.js +13 -9
- package/dist/runtime/server/api/media.delete.js +4 -2
- package/dist/runtime/server/api/media.get.js +22 -7
- package/dist/runtime/server/api/media.post.js +4 -2
- package/dist/runtime/server/api/media.put.js +33 -16
- package/dist/runtime/server/api/preset.delete.d.ts +4 -0
- package/dist/runtime/server/api/preset.delete.js +9 -0
- package/dist/runtime/server/api/preset.put.d.ts +3 -0
- package/dist/runtime/server/api/preset.put.js +23 -0
- package/dist/runtime/server/api/presets-field.get.d.ts +3 -0
- package/dist/runtime/server/api/presets-field.get.js +13 -0
- package/dist/runtime/server/api/presets-field.post.d.ts +3 -0
- package/dist/runtime/server/api/presets-field.post.js +36 -0
- package/dist/runtime/server/api/presets.get.d.ts +3 -0
- package/dist/runtime/server/api/presets.get.js +7 -0
- package/dist/runtime/server/api/preview-link.delete.d.ts +4 -0
- package/dist/runtime/server/api/preview-link.delete.js +15 -0
- package/dist/runtime/server/api/preview-links.get.d.ts +3 -0
- package/dist/runtime/server/api/preview-links.get.js +10 -0
- package/dist/runtime/server/api/preview-links.post.d.ts +3 -0
- package/dist/runtime/server/api/preview-links.post.js +17 -0
- package/dist/runtime/server/api/preview.get.d.ts +3 -0
- package/dist/runtime/server/api/preview.get.js +7 -0
- package/dist/runtime/server/api/redirect.delete.d.ts +4 -0
- package/dist/runtime/server/api/redirect.delete.js +10 -0
- package/dist/runtime/server/api/redirect.put.d.ts +3 -0
- package/dist/runtime/server/api/redirect.put.js +8 -0
- package/dist/runtime/server/api/redirects-import.post.d.ts +3 -0
- package/dist/runtime/server/api/redirects-import.post.js +13 -0
- package/dist/runtime/server/api/redirects.get.d.ts +3 -0
- package/dist/runtime/server/api/redirects.get.js +7 -0
- package/dist/runtime/server/api/redirects.post.d.ts +3 -0
- package/dist/runtime/server/api/redirects.post.js +7 -0
- package/dist/runtime/server/api/search.get.js +8 -3
- package/dist/runtime/server/api/settings.delete.js +2 -2
- package/dist/runtime/server/api/settings.get.js +4 -2
- package/dist/runtime/server/api/settings.put.js +2 -2
- package/dist/runtime/server/api/site.get.d.ts +3 -0
- package/dist/runtime/server/api/site.get.js +7 -0
- package/dist/runtime/server/api/site.put.d.ts +3 -0
- package/dist/runtime/server/api/site.put.js +16 -0
- package/dist/runtime/server/api/tags.get.js +3 -2
- package/dist/runtime/server/api/user.delete.js +8 -2
- package/dist/runtime/server/api/user.put.js +14 -4
- package/dist/runtime/server/api/users.get.js +2 -2
- package/dist/runtime/server/api/users.post.js +8 -4
- package/dist/runtime/server/middleware/hidden-site.d.ts +2 -0
- package/dist/runtime/server/middleware/hidden-site.js +8 -0
- package/dist/runtime/server/middleware/preview-links.d.ts +2 -0
- package/dist/runtime/server/middleware/preview-links.js +6 -0
- package/dist/runtime/server/middleware/redirects.d.ts +2 -0
- package/dist/runtime/server/middleware/redirects.js +18 -0
- package/dist/runtime/server/plugins/session-validate.js +4 -1
- package/dist/runtime/server/plugins/webhooks.d.ts +3 -0
- package/dist/runtime/server/plugins/webhooks.js +27 -0
- package/dist/runtime/server/routes/graphql.js +5 -3
- package/dist/runtime/server/routes/robots.d.ts +2 -0
- package/dist/runtime/server/routes/robots.js +16 -0
- package/dist/runtime/server/routes/sitemap.d.ts +2 -0
- package/dist/runtime/server/routes/sitemap.js +67 -0
- package/dist/runtime/server/utils/cached-value.d.ts +5 -0
- package/dist/runtime/server/utils/cached-value.js +24 -0
- package/dist/runtime/server/utils/content-routes.d.ts +5 -0
- package/dist/runtime/server/utils/content-routes.js +29 -0
- package/dist/runtime/server/utils/field-rules.d.ts +19 -0
- package/dist/runtime/server/utils/field-rules.js +72 -0
- package/dist/runtime/server/utils/graphql.d.ts +3 -1
- package/dist/runtime/server/utils/graphql.js +145 -29
- package/dist/runtime/server/utils/hooks.d.ts +14 -0
- package/dist/runtime/server/utils/hooks.js +71 -0
- package/dist/runtime/server/utils/import.d.ts +7 -2
- package/dist/runtime/server/utils/import.js +108 -14
- package/dist/runtime/server/utils/link-usage.d.ts +4 -0
- package/dist/runtime/server/utils/link-usage.js +28 -0
- package/dist/runtime/server/utils/media-references.d.ts +6 -1
- package/dist/runtime/server/utils/media-references.js +49 -20
- package/dist/runtime/server/utils/media-usage.d.ts +2 -0
- package/dist/runtime/server/utils/media-usage.js +5 -3
- package/dist/runtime/server/utils/page-rows.d.ts +2 -0
- package/dist/runtime/server/utils/page-rows.js +42 -29
- package/dist/runtime/server/utils/permissions.d.ts +14 -0
- package/dist/runtime/server/utils/permissions.js +43 -0
- package/dist/runtime/server/utils/presets.d.ts +18 -0
- package/dist/runtime/server/utils/presets.js +68 -0
- package/dist/runtime/server/utils/preview-links.d.ts +207 -0
- package/dist/runtime/server/utils/preview-links.js +161 -0
- package/dist/runtime/server/utils/redirects.d.ts +31 -0
- package/dist/runtime/server/utils/redirects.js +240 -0
- package/dist/runtime/server/utils/registry.js +4 -1
- package/dist/runtime/server/utils/relations.d.ts +8 -0
- package/dist/runtime/server/utils/relations.js +25 -6
- package/dist/runtime/server/utils/require-admin.d.ts +0 -1
- package/dist/runtime/server/utils/require-admin.js +4 -8
- package/dist/runtime/server/utils/search.d.ts +1 -0
- package/dist/runtime/server/utils/search.js +44 -19
- package/dist/runtime/server/utils/single-row.d.ts +3 -0
- package/dist/runtime/server/utils/single-row.js +4 -0
- package/dist/runtime/server/utils/site.d.ts +23 -0
- package/dist/runtime/server/utils/site.js +79 -0
- package/dist/runtime/server/utils/sitemap.d.ts +12 -0
- package/dist/runtime/server/utils/sitemap.js +109 -0
- package/dist/runtime/server/utils/user-management.d.ts +4 -0
- package/dist/runtime/server/utils/user-management.js +20 -0
- package/dist/runtime/server/utils/users.d.ts +1 -1
- package/dist/runtime/server/utils/users.js +1 -1
- package/dist/runtime/server/utils/visibility.d.ts +1 -0
- package/dist/runtime/server/utils/visibility.js +6 -1
- package/dist/runtime/server/utils/webhooks.d.ts +24 -0
- package/dist/runtime/server/utils/webhooks.js +90 -0
- package/dist/runtime/shared/block-paths.d.ts +66 -0
- package/dist/runtime/shared/block-paths.js +310 -0
- package/dist/runtime/shared/block-picker.d.ts +18 -0
- package/dist/runtime/shared/block-picker.js +31 -0
- package/dist/runtime/shared/block-signature.d.ts +4 -0
- package/dist/runtime/shared/block-signature.js +46 -0
- package/dist/runtime/shared/clipboard.d.ts +31 -0
- package/dist/runtime/shared/clipboard.js +206 -0
- package/dist/runtime/shared/conditions.d.ts +36 -0
- package/dist/runtime/shared/conditions.js +100 -0
- package/dist/runtime/shared/content-routes.d.ts +42 -0
- package/dist/runtime/shared/content-routes.js +237 -0
- package/dist/runtime/shared/duplicate.js +2 -1
- package/dist/runtime/shared/editor-layout.d.ts +18 -0
- package/dist/runtime/shared/editor-layout.js +9 -0
- package/dist/runtime/shared/field-options.d.ts +21 -0
- package/dist/runtime/shared/field-options.js +90 -0
- package/dist/runtime/shared/graphql-sdl.d.ts +1 -0
- package/dist/runtime/shared/graphql-sdl.js +50 -26
- package/dist/runtime/shared/history.d.ts +27 -0
- package/dist/runtime/shared/history.js +123 -0
- package/dist/runtime/shared/hooks.d.ts +45 -0
- package/dist/runtime/shared/hooks.js +28 -0
- package/dist/runtime/shared/index.d.ts +90 -21
- package/dist/runtime/shared/index.js +121 -37
- package/dist/runtime/shared/inline-text.d.ts +38 -0
- package/dist/runtime/shared/inline-text.js +85 -0
- package/dist/runtime/shared/layout.d.ts +2 -1
- package/dist/runtime/shared/layout.js +3 -0
- package/dist/runtime/shared/links.d.ts +48 -0
- package/dist/runtime/shared/links.js +155 -0
- package/dist/runtime/shared/list-filters.d.ts +2 -0
- package/dist/runtime/shared/list-filters.js +2 -0
- package/dist/runtime/shared/media-focal.d.ts +30 -0
- package/dist/runtime/shared/media-focal.js +52 -0
- package/dist/runtime/shared/migrations-dir.d.ts +14 -0
- package/dist/runtime/shared/migrations-dir.js +48 -2
- package/dist/runtime/shared/presets.d.ts +67 -0
- package/dist/runtime/shared/presets.js +127 -0
- package/dist/runtime/shared/preview-links.d.ts +64 -0
- package/dist/runtime/shared/preview-links.js +54 -0
- package/dist/runtime/shared/preview.d.ts +124 -21
- package/dist/runtime/shared/preview.js +419 -81
- package/dist/runtime/shared/redirects.d.ts +75 -0
- package/dist/runtime/shared/redirects.js +230 -0
- package/dist/runtime/shared/roles.d.ts +57 -0
- package/dist/runtime/shared/roles.js +293 -0
- package/dist/runtime/shared/save-state.d.ts +8 -0
- package/dist/runtime/shared/save-state.js +15 -0
- package/dist/runtime/shared/search.d.ts +16 -1
- package/dist/runtime/shared/search.js +41 -7
- package/dist/runtime/shared/seo.d.ts +167 -0
- package/dist/runtime/shared/seo.js +335 -0
- package/dist/runtime/shared/transfer.js +2 -1
- package/dist/runtime/shared/translations.d.ts +29 -0
- package/dist/runtime/shared/translations.js +123 -0
- package/dist/runtime/shared/users.d.ts +1 -1
- package/dist/runtime/shared/validation.d.ts +23 -1
- package/dist/runtime/shared/validation.js +214 -64
- package/dist/runtime/webhooks.d.ts +33 -0
- package/dist/runtime/webhooks.js +57 -0
- package/dist/types.d.mts +5 -1
- package/package.json +6 -2
- package/dist/runtime/app/components/cms/BlockOutline.vue +0 -88
- package/dist/runtime/app/components/cms/BlockPalette.vue +0 -31
- package/dist/runtime/app/components/cms/SettingsModal.d.vue.ts +0 -12
- package/dist/runtime/app/components/cms/SettingsModal.vue +0 -126
- package/dist/runtime/app/components/cms/SettingsModal.vue.d.ts +0 -12
- package/dist/runtime/app/composables/cms-field-focus.d.ts +0 -4
- package/dist/runtime/app/composables/cms-field-focus.js +0 -20
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { PgTable } from 'drizzle-orm/pg-core';
|
|
2
2
|
import type { SQLiteTable } from 'drizzle-orm/sqlite-core';
|
|
3
|
+
import type { CmsShowIf } from './conditions.js';
|
|
4
|
+
import type { CmsContentRoute } from './content-routes.js';
|
|
3
5
|
import type { CmsLayoutBlock, CmsListInput } from './layout.js';
|
|
4
6
|
export type CmsTable = SQLiteTable | PgTable;
|
|
5
|
-
export type FieldType = 'text' | 'richtext' | 'number' | 'boolean' | 'date' | 'datetime' | 'email' | 'slug' | 'select' | 'tags' | 'json' | 'media' | 'relation' | 'blocks';
|
|
7
|
+
export type FieldType = 'text' | 'richtext' | 'number' | 'boolean' | 'date' | 'datetime' | 'email' | 'slug' | 'select' | 'tags' | 'json' | 'media' | 'relation' | 'link' | 'blocks';
|
|
6
8
|
export interface CmsI18n {
|
|
7
9
|
locales: string[];
|
|
8
10
|
defaultLocale: string;
|
|
@@ -42,6 +44,8 @@ export interface MediaItem {
|
|
|
42
44
|
size: number | null;
|
|
43
45
|
width: number | null;
|
|
44
46
|
height: number | null;
|
|
47
|
+
focalX: number | null;
|
|
48
|
+
focalY: number | null;
|
|
45
49
|
createdAt: string | null;
|
|
46
50
|
type: MediaType;
|
|
47
51
|
url: string | null;
|
|
@@ -52,10 +56,11 @@ export interface MediaSourceInfo {
|
|
|
52
56
|
root: string;
|
|
53
57
|
builtAt: string | null;
|
|
54
58
|
}
|
|
59
|
+
export type MediaUsageKind = CmsEntryKind | 'site';
|
|
55
60
|
export interface MediaUsage {
|
|
56
61
|
collection: string;
|
|
57
62
|
label: string;
|
|
58
|
-
kind:
|
|
63
|
+
kind: MediaUsageKind;
|
|
59
64
|
id: string | null;
|
|
60
65
|
title: string | null;
|
|
61
66
|
field: string;
|
|
@@ -63,23 +68,32 @@ export interface MediaUsage {
|
|
|
63
68
|
export interface MediaUsageEntry {
|
|
64
69
|
collection: string;
|
|
65
70
|
label: string;
|
|
66
|
-
kind:
|
|
71
|
+
kind: MediaUsageKind;
|
|
67
72
|
id: string | null;
|
|
68
73
|
title: string | null;
|
|
69
74
|
fields: string[];
|
|
70
75
|
}
|
|
71
76
|
export declare function groupMediaUsage(usage: MediaUsage[]): MediaUsageEntry[];
|
|
77
|
+
export interface MediaUsageReport {
|
|
78
|
+
usage: Record<string, MediaUsage[]>;
|
|
79
|
+
hidden: Record<string, number>;
|
|
80
|
+
}
|
|
72
81
|
export interface MediaUsageGroup {
|
|
73
82
|
key: string;
|
|
74
83
|
entries: MediaUsageEntry[];
|
|
84
|
+
hidden: number;
|
|
75
85
|
}
|
|
76
|
-
export declare function mediaUsageGroups(usage: Record<string, MediaUsage[]>, keys: string[]): MediaUsageGroup[];
|
|
86
|
+
export declare function mediaUsageGroups(usage: Record<string, MediaUsage[]>, keys: string[], hidden?: Record<string, number>): MediaUsageGroup[];
|
|
87
|
+
export declare function otherEntriesLabel(count: number): string;
|
|
77
88
|
export interface BlockConfig {
|
|
78
89
|
label: string;
|
|
79
90
|
component?: string;
|
|
80
91
|
icon?: string;
|
|
81
92
|
description?: string;
|
|
93
|
+
group?: string;
|
|
94
|
+
tags?: readonly string[];
|
|
82
95
|
fields: Record<string, FieldConfig>;
|
|
96
|
+
layout?: CmsLayoutBlock[];
|
|
83
97
|
validate?: CmsBlockValidate;
|
|
84
98
|
}
|
|
85
99
|
export type CmsValidationLevel = 'error' | 'warning';
|
|
@@ -95,6 +109,7 @@ export interface CmsValidateContext {
|
|
|
95
109
|
}
|
|
96
110
|
export interface CmsBlockValidateContext extends CmsValidateContext {
|
|
97
111
|
index: number;
|
|
112
|
+
blockPath: string;
|
|
98
113
|
}
|
|
99
114
|
export type CmsValidateResult = readonly CmsValidationIssue[] | null | undefined | void;
|
|
100
115
|
export type CmsValidate = (values: Record<string, unknown>, context: CmsValidateContext) => CmsValidateResult;
|
|
@@ -118,12 +133,6 @@ export declare function selectOptionValues(field: Pick<FieldConfig, 'options'>):
|
|
|
118
133
|
export declare function selectOptionLabel(field: Pick<FieldConfig, 'options'>, value: unknown): string;
|
|
119
134
|
export declare function selectValuesMatching(field: Pick<FieldConfig, 'options'>, term: string): string[];
|
|
120
135
|
export declare function selectDisplayValue(field: Pick<FieldConfig, 'options'>, value: unknown): string;
|
|
121
|
-
export type ConditionValue = string | number | boolean;
|
|
122
|
-
export interface FieldCondition {
|
|
123
|
-
field: string;
|
|
124
|
-
eq?: ConditionValue;
|
|
125
|
-
in?: ConditionValue[];
|
|
126
|
-
}
|
|
127
136
|
export interface CmsTab {
|
|
128
137
|
id: string;
|
|
129
138
|
label: string;
|
|
@@ -136,6 +145,9 @@ export interface FieldConfig {
|
|
|
136
145
|
tab?: string;
|
|
137
146
|
required?: boolean;
|
|
138
147
|
private?: boolean;
|
|
148
|
+
default?: unknown;
|
|
149
|
+
unique?: boolean;
|
|
150
|
+
immutable?: boolean;
|
|
139
151
|
textarea?: boolean;
|
|
140
152
|
integer?: boolean;
|
|
141
153
|
translatable?: boolean;
|
|
@@ -150,16 +162,18 @@ export interface FieldConfig {
|
|
|
150
162
|
accept?: string[];
|
|
151
163
|
mobile?: boolean;
|
|
152
164
|
mobileOf?: string;
|
|
153
|
-
to?: string;
|
|
165
|
+
to?: string | readonly string[];
|
|
166
|
+
external?: boolean;
|
|
167
|
+
withLabel?: boolean;
|
|
154
168
|
cardinality?: 'many-to-one' | 'one-to-one' | 'many-to-many';
|
|
155
169
|
onDelete?: 'set null' | 'cascade' | 'restrict';
|
|
156
|
-
showIf?:
|
|
170
|
+
showIf?: CmsShowIf;
|
|
157
171
|
}
|
|
172
|
+
export declare function relationTarget(field: Pick<FieldConfig, 'to'>): string;
|
|
158
173
|
export declare function isPrivateField(field: FieldConfig): boolean;
|
|
159
174
|
export declare function isRequiredField(field: FieldConfig): boolean;
|
|
160
|
-
export declare function fieldConditions(field: FieldConfig): FieldCondition[];
|
|
161
|
-
export declare function isFieldVisible(field: FieldConfig, values: Record<string, unknown> | null | undefined): boolean;
|
|
162
175
|
export declare function isTranslatableField(field: FieldConfig): boolean;
|
|
176
|
+
export declare function isLocalizedLinkField(field: FieldConfig): boolean;
|
|
163
177
|
export declare function isTranslatableMediaField(field: FieldConfig): boolean;
|
|
164
178
|
export declare function defaultLocaleValue(value: unknown, defaultLocale: string): string | null;
|
|
165
179
|
export declare function decodeTranslatableValue(value: unknown, defaultLocale: string): Record<string, string> | null;
|
|
@@ -215,6 +229,7 @@ export interface CmsEntry {
|
|
|
215
229
|
list?: CmsListInput;
|
|
216
230
|
blocks?: Record<string, BlockConfig>;
|
|
217
231
|
preview?: CmsPreviewOptions;
|
|
232
|
+
route?: CmsContentRoute;
|
|
218
233
|
declared?: CmsContentDeclared;
|
|
219
234
|
validate?: CmsValidate;
|
|
220
235
|
}
|
|
@@ -233,12 +248,14 @@ export declare const CONTENT_TITLE_FIELD = "title";
|
|
|
233
248
|
export declare const CONTENT_SLUG_FIELD = "slug";
|
|
234
249
|
export declare const CONTENT_PUBLISHED_AT_FIELD = "publishedAt";
|
|
235
250
|
export declare const CONTENT_BODY_FIELD = "body";
|
|
236
|
-
export declare const CONTENT_SYSTEM_FIELDS: readonly ["title", "slug", "publishedAt", "excerpt", "cover", "body", "seoTitle", "seoDescription", "seoImage"];
|
|
251
|
+
export declare const CONTENT_SYSTEM_FIELDS: readonly ["title", "slug", "publishedAt", "excerpt", "cover", "body", "seoTitle", "seoDescription", "seoImage", "seoNoindex"];
|
|
252
|
+
export declare const CONTENT_NOINDEX_FIELD = "seoNoindex";
|
|
237
253
|
export type CmsContentSystemField = (typeof CONTENT_SYSTEM_FIELDS)[number];
|
|
238
254
|
export declare const CONTENT_LIST_COLUMNS: string[];
|
|
239
255
|
export declare function isContentEntry(entry: Pick<CmsEntry, 'kind'>): boolean;
|
|
240
256
|
export declare function isCollectionKind(entry: Pick<CmsEntry, 'kind'>): boolean;
|
|
241
257
|
export declare function normalizeContentEntries<T extends Record<string, unknown>>(config: T, i18n?: Pick<CmsI18n, 'locales'>): T;
|
|
258
|
+
export declare function boundBlockNesting<T extends Record<string, unknown>>(config: T): T;
|
|
242
259
|
export declare function normalizeCmsConfig<T extends Record<string, unknown>>(config: T, i18n?: Pick<CmsI18n, 'locales'>): T;
|
|
243
260
|
export declare function slugSourceValue(source: FieldConfig | undefined, value: unknown, defaultLocale: string): string | null;
|
|
244
261
|
export declare function isScheduledContent(row: Record<string, unknown> | null | undefined, now?: Date): boolean;
|
|
@@ -265,8 +282,9 @@ export declare function pageMediaTableName(name: string): string;
|
|
|
265
282
|
type EntryLike = Pick<CmsEntry, 'fields'> & Partial<Pick<CmsEntry, 'kind' | 'overrides'>>;
|
|
266
283
|
export declare function entryFieldsFor(entry: EntryLike, path?: string): Record<string, FieldConfig>;
|
|
267
284
|
export declare function typeName(name: string): string;
|
|
268
|
-
export declare function
|
|
269
|
-
export declare function
|
|
285
|
+
export declare function blocksTypePrefix(entryName: string, schemaPath: string | readonly string[]): string;
|
|
286
|
+
export declare function blocksFieldTypeName(entryName: string, schemaPath: string | readonly string[]): string;
|
|
287
|
+
export declare function blockTypeName(entryName: string, schemaPath: string | readonly string[], blockName: string): string;
|
|
270
288
|
interface FieldInputBase {
|
|
271
289
|
label: string;
|
|
272
290
|
description?: string;
|
|
@@ -274,46 +292,70 @@ interface FieldInputBase {
|
|
|
274
292
|
required?: boolean;
|
|
275
293
|
private?: boolean;
|
|
276
294
|
tab?: string;
|
|
277
|
-
showIf?:
|
|
295
|
+
showIf?: CmsShowIf;
|
|
278
296
|
}
|
|
279
297
|
export interface TextFieldInput extends FieldInputBase {
|
|
280
298
|
type: 'text';
|
|
281
299
|
textarea?: boolean;
|
|
282
300
|
translatable?: boolean;
|
|
301
|
+
default?: string;
|
|
302
|
+
min?: number;
|
|
303
|
+
max?: number;
|
|
304
|
+
unique?: boolean;
|
|
305
|
+
immutable?: boolean;
|
|
283
306
|
}
|
|
284
307
|
export interface RichtextFieldInput extends FieldInputBase {
|
|
285
308
|
type: 'richtext';
|
|
286
309
|
translatable?: boolean;
|
|
310
|
+
default?: string;
|
|
287
311
|
}
|
|
288
312
|
export interface NumberFieldInput extends FieldInputBase {
|
|
289
313
|
type: 'number';
|
|
290
314
|
integer?: boolean;
|
|
315
|
+
default?: number;
|
|
316
|
+
min?: number;
|
|
317
|
+
max?: number;
|
|
318
|
+
unique?: boolean;
|
|
319
|
+
immutable?: boolean;
|
|
291
320
|
}
|
|
292
321
|
export interface BooleanFieldInput extends FieldInputBase {
|
|
293
322
|
type: 'boolean';
|
|
323
|
+
default?: boolean;
|
|
324
|
+
immutable?: boolean;
|
|
294
325
|
}
|
|
295
326
|
export interface DateFieldInput extends FieldInputBase {
|
|
296
327
|
type: 'date';
|
|
328
|
+
default?: 'today' | (string & {});
|
|
329
|
+
immutable?: boolean;
|
|
297
330
|
}
|
|
298
331
|
export interface DateTimeFieldInput extends FieldInputBase {
|
|
299
332
|
type: 'datetime';
|
|
333
|
+
default?: 'now' | (string & {});
|
|
334
|
+
immutable?: boolean;
|
|
300
335
|
}
|
|
301
336
|
export interface EmailFieldInput extends FieldInputBase {
|
|
302
337
|
type: 'email';
|
|
338
|
+
default?: string;
|
|
339
|
+
unique?: boolean;
|
|
340
|
+
immutable?: boolean;
|
|
303
341
|
}
|
|
304
342
|
export interface SlugFieldInput extends FieldInputBase {
|
|
305
343
|
type: 'slug';
|
|
306
344
|
from: string;
|
|
345
|
+
immutable?: boolean;
|
|
307
346
|
}
|
|
308
347
|
export interface SelectFieldInput extends FieldInputBase {
|
|
309
348
|
type: 'select';
|
|
310
349
|
options: readonly SelectOptionInput[];
|
|
311
350
|
multiple?: boolean;
|
|
351
|
+
default?: string | readonly string[];
|
|
352
|
+
immutable?: boolean;
|
|
312
353
|
}
|
|
313
354
|
export interface TagsFieldInput extends FieldInputBase {
|
|
314
355
|
type: 'tags';
|
|
315
356
|
max?: number;
|
|
316
357
|
suggestions?: boolean;
|
|
358
|
+
default?: readonly string[];
|
|
317
359
|
}
|
|
318
360
|
export interface JsonFieldInput extends FieldInputBase {
|
|
319
361
|
type: 'json';
|
|
@@ -330,15 +372,32 @@ export interface RelationFieldInput extends FieldInputBase {
|
|
|
330
372
|
to: string;
|
|
331
373
|
cardinality?: 'many-to-one' | 'one-to-one' | 'many-to-many';
|
|
332
374
|
onDelete?: 'set null' | 'cascade' | 'restrict';
|
|
375
|
+
immutable?: boolean;
|
|
376
|
+
}
|
|
377
|
+
export interface LinkFieldInput extends FieldInputBase {
|
|
378
|
+
type: 'link';
|
|
379
|
+
to?: readonly string[];
|
|
380
|
+
external?: boolean;
|
|
381
|
+
withLabel?: boolean;
|
|
382
|
+
translatable?: boolean;
|
|
333
383
|
}
|
|
334
|
-
type BlockField<T> = Omit<T, 'private' | '
|
|
335
|
-
export
|
|
384
|
+
type BlockField<T> = Omit<T, 'private' | 'tab' | 'default' | 'unique' | 'immutable'>;
|
|
385
|
+
export interface NestedBlocksFieldInput extends Omit<FieldInputBase, 'private' | 'tab'> {
|
|
386
|
+
type: 'blocks';
|
|
387
|
+
blocks: Record<string, BlockInput>;
|
|
388
|
+
min?: number;
|
|
389
|
+
max?: number;
|
|
390
|
+
}
|
|
391
|
+
export type BlockFieldInput = BlockField<TextFieldInput> | BlockField<RichtextFieldInput> | BlockField<NumberFieldInput> | BlockField<BooleanFieldInput> | BlockField<DateFieldInput> | BlockField<DateTimeFieldInput> | BlockField<EmailFieldInput> | BlockField<SelectFieldInput> | BlockField<JsonFieldInput> | BlockField<LinkFieldInput> | Omit<BlockField<MediaFieldInput>, 'mobile'> | NestedBlocksFieldInput;
|
|
336
392
|
export interface BlockInput {
|
|
337
393
|
label: string;
|
|
338
394
|
component?: string;
|
|
339
395
|
icon?: string;
|
|
340
396
|
description?: string;
|
|
397
|
+
group?: string;
|
|
398
|
+
tags?: readonly string[];
|
|
341
399
|
fields: Record<string, BlockFieldInput>;
|
|
400
|
+
layout?: CmsLayoutBlock[];
|
|
342
401
|
validate?: CmsBlockValidate;
|
|
343
402
|
}
|
|
344
403
|
export interface BlocksFieldInput extends FieldInputBase {
|
|
@@ -347,7 +406,7 @@ export interface BlocksFieldInput extends FieldInputBase {
|
|
|
347
406
|
min?: number;
|
|
348
407
|
max?: number;
|
|
349
408
|
}
|
|
350
|
-
export type CmsFieldInput = TextFieldInput | RichtextFieldInput | NumberFieldInput | BooleanFieldInput | DateFieldInput | DateTimeFieldInput | EmailFieldInput | SlugFieldInput | SelectFieldInput | TagsFieldInput | JsonFieldInput | MediaFieldInput | RelationFieldInput | BlocksFieldInput;
|
|
409
|
+
export type CmsFieldInput = TextFieldInput | RichtextFieldInput | NumberFieldInput | BooleanFieldInput | DateFieldInput | DateTimeFieldInput | EmailFieldInput | SlugFieldInput | SelectFieldInput | TagsFieldInput | JsonFieldInput | MediaFieldInput | RelationFieldInput | LinkFieldInput | BlocksFieldInput;
|
|
351
410
|
interface CmsEntryInputBase {
|
|
352
411
|
id: string;
|
|
353
412
|
label: string;
|
|
@@ -391,6 +450,7 @@ export interface CmsContentInput {
|
|
|
391
450
|
layout?: CmsLayoutBlock[];
|
|
392
451
|
list?: CmsListInput;
|
|
393
452
|
preview?: CmsPreviewOptions;
|
|
453
|
+
route?: string | Readonly<Record<string, string>>;
|
|
394
454
|
validate?: CmsValidate;
|
|
395
455
|
titleField?: never;
|
|
396
456
|
drafts?: never;
|
|
@@ -399,5 +459,14 @@ export type CmsEntryInput = CmsCollectionInput | CmsSingleInput | CmsPageInput |
|
|
|
399
459
|
export type CmsConfigInput = Record<string, CmsEntryInput>;
|
|
400
460
|
export declare function defineCmsConfig<T extends CmsConfigInput>(config: T): T;
|
|
401
461
|
export declare function defineCmsBlocks<T extends Record<string, BlockInput>>(blocks: T): T;
|
|
462
|
+
export * from './block-paths.js';
|
|
463
|
+
export * from './conditions.js';
|
|
464
|
+
export * from './content-routes.js';
|
|
465
|
+
export * from './seo.js';
|
|
466
|
+
export * from './redirects.js';
|
|
402
467
|
export * from './layout.js';
|
|
468
|
+
export * from './media-focal.js';
|
|
403
469
|
export * from './users.js';
|
|
470
|
+
export * from './preview-links.js';
|
|
471
|
+
export * from './links.js';
|
|
472
|
+
export type { CmsAccess, CmsRole, CmsRoleInput, CmsRoleOption, CmsRoles, CmsRolesInput, } from './roles.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MAX_BLOCKS_DEPTH, blockFieldsDeep, mapBlocks } from "./block-paths.js";
|
|
1
2
|
export const MEDIA_TYPES = ["image", "video", "file"];
|
|
2
3
|
const MEDIA_EXTENSIONS = {
|
|
3
4
|
image: [
|
|
@@ -120,8 +121,15 @@ export function groupMediaUsage(usage) {
|
|
|
120
121
|
}
|
|
121
122
|
return [...entries.values()];
|
|
122
123
|
}
|
|
123
|
-
export function mediaUsageGroups(usage, keys) {
|
|
124
|
-
return [...new Set(keys)].map((key) => ({
|
|
124
|
+
export function mediaUsageGroups(usage, keys, hidden = {}) {
|
|
125
|
+
return [...new Set(keys)].map((key) => ({
|
|
126
|
+
key,
|
|
127
|
+
entries: groupMediaUsage(usage[key] ?? []),
|
|
128
|
+
hidden: hidden[key] ?? 0
|
|
129
|
+
})).filter((group) => group.entries.length > 0 || group.hidden > 0);
|
|
130
|
+
}
|
|
131
|
+
export function otherEntriesLabel(count) {
|
|
132
|
+
return `${count} other entr${count === 1 ? "y" : "ies"}`;
|
|
125
133
|
}
|
|
126
134
|
export function selectOptions(field) {
|
|
127
135
|
return (field.options ?? []).map(
|
|
@@ -148,28 +156,21 @@ export function selectDisplayValue(field, value) {
|
|
|
148
156
|
if (Array.isArray(value)) return value.map((item) => selectOptionLabel(field, item)).join(", ");
|
|
149
157
|
return selectOptionLabel(field, value);
|
|
150
158
|
}
|
|
159
|
+
export function relationTarget(field) {
|
|
160
|
+
return typeof field.to === "string" ? field.to : "";
|
|
161
|
+
}
|
|
151
162
|
export function isPrivateField(field) {
|
|
152
163
|
return !!field.private;
|
|
153
164
|
}
|
|
154
165
|
export function isRequiredField(field) {
|
|
155
166
|
return !!field.required && !field.showIf;
|
|
156
167
|
}
|
|
157
|
-
export function fieldConditions(field) {
|
|
158
|
-
if (!field.showIf) return [];
|
|
159
|
-
return Array.isArray(field.showIf) ? field.showIf : [field.showIf];
|
|
160
|
-
}
|
|
161
|
-
function matchesCondition(condition, value) {
|
|
162
|
-
if (condition.in) return condition.in.some((option) => option === value);
|
|
163
|
-
return condition.eq === value;
|
|
164
|
-
}
|
|
165
|
-
export function isFieldVisible(field, values) {
|
|
166
|
-
const conditions = fieldConditions(field);
|
|
167
|
-
if (!conditions.length) return true;
|
|
168
|
-
return conditions.every((condition) => matchesCondition(condition, values?.[condition.field]));
|
|
169
|
-
}
|
|
170
168
|
export function isTranslatableField(field) {
|
|
171
169
|
return !!field.translatable && (field.type === "text" || field.type === "richtext" || field.type === "media");
|
|
172
170
|
}
|
|
171
|
+
export function isLocalizedLinkField(field) {
|
|
172
|
+
return field.type === "link" && !!field.translatable && !!field.withLabel;
|
|
173
|
+
}
|
|
173
174
|
export function isTranslatableMediaField(field) {
|
|
174
175
|
return !!field.translatable && field.type === "media";
|
|
175
176
|
}
|
|
@@ -285,8 +286,8 @@ export function translatableBlockFieldKeys(block) {
|
|
|
285
286
|
}
|
|
286
287
|
export function hasTranslatableBlockFields(field) {
|
|
287
288
|
if (field.type !== "blocks") return false;
|
|
288
|
-
return
|
|
289
|
-
(
|
|
289
|
+
return blockFieldsDeep(field).some(
|
|
290
|
+
(blockField) => isTranslatableField(blockField) || isLocalizedLinkField(blockField)
|
|
290
291
|
);
|
|
291
292
|
}
|
|
292
293
|
export function canAddBlock(field, count) {
|
|
@@ -300,11 +301,11 @@ export function isHiddenBlock(item) {
|
|
|
300
301
|
return !!item && typeof item === "object" && item.hidden === true;
|
|
301
302
|
}
|
|
302
303
|
export function publicBlocks(field, value) {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
304
|
+
return mapBlocks(
|
|
305
|
+
field,
|
|
306
|
+
value,
|
|
307
|
+
(item, block) => isHiddenBlock(item) && !declaresHiddenField(block) ? null : item
|
|
308
|
+
);
|
|
308
309
|
}
|
|
309
310
|
export function localizeBlock(field, item, locale, defaultLocale) {
|
|
310
311
|
if (!item || typeof item !== "object") return item;
|
|
@@ -320,8 +321,11 @@ export function localizeBlock(field, item, locale, defaultLocale) {
|
|
|
320
321
|
return localized;
|
|
321
322
|
}
|
|
322
323
|
export function localizeBlocks(field, value, locale, defaultLocale) {
|
|
323
|
-
|
|
324
|
-
|
|
324
|
+
return mapBlocks(
|
|
325
|
+
field,
|
|
326
|
+
value,
|
|
327
|
+
(item, _block, owner) => localizeBlock(owner, item, locale, defaultLocale)
|
|
328
|
+
);
|
|
325
329
|
}
|
|
326
330
|
export const CMS_GRAPHQL_BATCH_LIMIT = 20;
|
|
327
331
|
export const MOBILE_MEDIA_SUFFIX = "Mobile";
|
|
@@ -389,8 +393,10 @@ export const CONTENT_SYSTEM_FIELDS = [
|
|
|
389
393
|
"body",
|
|
390
394
|
"seoTitle",
|
|
391
395
|
"seoDescription",
|
|
392
|
-
"seoImage"
|
|
396
|
+
"seoImage",
|
|
397
|
+
"seoNoindex"
|
|
393
398
|
];
|
|
399
|
+
export const CONTENT_NOINDEX_FIELD = "seoNoindex";
|
|
394
400
|
export const CONTENT_LIST_COLUMNS = ["title", "status", "publishedAt"];
|
|
395
401
|
export function isContentEntry(entry) {
|
|
396
402
|
return entry.kind === "content";
|
|
@@ -430,7 +436,12 @@ function contentSystemFields(blocks, labels, translatable) {
|
|
|
430
436
|
textarea: true,
|
|
431
437
|
...localized
|
|
432
438
|
},
|
|
433
|
-
seoImage: { label: label("seoImage", "SEO image"), type: "media", mediaType: "image" }
|
|
439
|
+
seoImage: { label: label("seoImage", "SEO image"), type: "media", mediaType: "image" },
|
|
440
|
+
seoNoindex: {
|
|
441
|
+
label: label("seoNoindex", "Hide from search engines"),
|
|
442
|
+
type: "boolean",
|
|
443
|
+
description: "Adds noindex to the page and leaves it out of the sitemap."
|
|
444
|
+
}
|
|
434
445
|
};
|
|
435
446
|
}
|
|
436
447
|
function normalizeContentEntry(entry, translatable) {
|
|
@@ -440,7 +451,7 @@ function normalizeContentEntry(entry, translatable) {
|
|
|
440
451
|
const extra = Object.fromEntries(
|
|
441
452
|
Object.entries(declared).filter(([key]) => !Object.hasOwn(system, key))
|
|
442
453
|
);
|
|
443
|
-
const { body, seoTitle, seoDescription, seoImage, ...head } = system;
|
|
454
|
+
const { body, seoTitle, seoDescription, seoImage, seoNoindex, ...head } = system;
|
|
444
455
|
return Object.assign(entry, {
|
|
445
456
|
declared: {
|
|
446
457
|
fields: Object.keys(declared),
|
|
@@ -449,7 +460,7 @@ function normalizeContentEntry(entry, translatable) {
|
|
|
449
460
|
},
|
|
450
461
|
titleField: CONTENT_TITLE_FIELD,
|
|
451
462
|
drafts: true,
|
|
452
|
-
fields: { ...head, ...extra, body, seoTitle, seoDescription, seoImage },
|
|
463
|
+
fields: { ...head, ...extra, body, seoTitle, seoDescription, seoImage, seoNoindex },
|
|
453
464
|
list: entry.list ?? { columns: [...CONTENT_LIST_COLUMNS] }
|
|
454
465
|
});
|
|
455
466
|
}
|
|
@@ -460,8 +471,72 @@ export function normalizeContentEntries(config, i18n) {
|
|
|
460
471
|
}
|
|
461
472
|
return config;
|
|
462
473
|
}
|
|
474
|
+
function boundBlocksField(field, depth, trail) {
|
|
475
|
+
const blocks = field.blocks;
|
|
476
|
+
if (!blocks || typeof blocks !== "object") return field;
|
|
477
|
+
const inner = new Set(trail).add(blocks);
|
|
478
|
+
let changed = false;
|
|
479
|
+
const bounded = {};
|
|
480
|
+
for (const [name, block] of Object.entries(blocks)) {
|
|
481
|
+
if (!block?.fields || typeof block.fields !== "object") {
|
|
482
|
+
bounded[name] = block;
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
let fields = null;
|
|
486
|
+
let dropped = false;
|
|
487
|
+
for (const [key, subfield] of Object.entries(block.fields)) {
|
|
488
|
+
if (subfield?.type !== "blocks" || !subfield.blocks) continue;
|
|
489
|
+
const cyclic = inner.has(subfield.blocks);
|
|
490
|
+
if (depth >= MAX_BLOCKS_DEPTH) {
|
|
491
|
+
if (cyclic) dropped = true;
|
|
492
|
+
continue;
|
|
493
|
+
}
|
|
494
|
+
const next = boundBlocksField(subfield, depth + 1, inner);
|
|
495
|
+
if (next === subfield) continue;
|
|
496
|
+
fields ??= { ...block.fields };
|
|
497
|
+
fields[key] = next;
|
|
498
|
+
}
|
|
499
|
+
if (dropped) {
|
|
500
|
+
changed = true;
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
if (fields) {
|
|
504
|
+
changed = true;
|
|
505
|
+
bounded[name] = { ...block, fields };
|
|
506
|
+
} else {
|
|
507
|
+
bounded[name] = block;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
return changed ? { ...field, blocks: bounded } : field;
|
|
511
|
+
}
|
|
512
|
+
function boundFields(fields) {
|
|
513
|
+
let next = null;
|
|
514
|
+
for (const [key, field] of Object.entries(fields)) {
|
|
515
|
+
if (field?.type !== "blocks") continue;
|
|
516
|
+
const bounded = boundBlocksField(field, 1, /* @__PURE__ */ new Set());
|
|
517
|
+
if (bounded === field) continue;
|
|
518
|
+
next ??= { ...fields };
|
|
519
|
+
next[key] = bounded;
|
|
520
|
+
}
|
|
521
|
+
return next ?? fields;
|
|
522
|
+
}
|
|
523
|
+
export function boundBlockNesting(config) {
|
|
524
|
+
for (const entry of Object.values(config)) {
|
|
525
|
+
if (!entry?.fields || typeof entry.fields !== "object") continue;
|
|
526
|
+
entry.fields = boundFields(entry.fields);
|
|
527
|
+
if (entry.overrides && typeof entry.overrides === "object") {
|
|
528
|
+
entry.overrides = Object.fromEntries(
|
|
529
|
+
Object.entries(entry.overrides).map(([path, override]) => [
|
|
530
|
+
path,
|
|
531
|
+
override && typeof override === "object" ? boundFields(override) : override
|
|
532
|
+
])
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
return config;
|
|
537
|
+
}
|
|
463
538
|
export function normalizeCmsConfig(config, i18n) {
|
|
464
|
-
return expandMobileMedia(normalizeContentEntries(config, i18n));
|
|
539
|
+
return boundBlockNesting(expandMobileMedia(normalizeContentEntries(config, i18n)));
|
|
465
540
|
}
|
|
466
541
|
export function slugSourceValue(source, value, defaultLocale) {
|
|
467
542
|
if (value == null) return null;
|
|
@@ -478,10 +553,7 @@ export function isScheduledContent(row, now = /* @__PURE__ */ new Date()) {
|
|
|
478
553
|
return !Number.isNaN(time) && time > now.getTime();
|
|
479
554
|
}
|
|
480
555
|
export function resolveBlocksMedia(field, value, resolve) {
|
|
481
|
-
|
|
482
|
-
return value.map((item) => {
|
|
483
|
-
if (!item || typeof item !== "object") return item;
|
|
484
|
-
const block = field.blocks?.[String(item.type)];
|
|
556
|
+
return mapBlocks(field, value, (item, block) => {
|
|
485
557
|
if (!block) return item;
|
|
486
558
|
const resolved = { ...item };
|
|
487
559
|
for (const [key, blockField] of Object.entries(block.fields)) {
|
|
@@ -586,11 +658,15 @@ export function entryFieldsFor(entry, path) {
|
|
|
586
658
|
export function typeName(name) {
|
|
587
659
|
return name.replace(/(?:^|_)([a-z0-9])/gi, (_, c) => c.toUpperCase());
|
|
588
660
|
}
|
|
589
|
-
export function
|
|
590
|
-
|
|
661
|
+
export function blocksTypePrefix(entryName, schemaPath) {
|
|
662
|
+
const segments = typeof schemaPath === "string" ? schemaPath.split(".") : schemaPath;
|
|
663
|
+
return `${typeName(entryName)}${segments.map(typeName).join("")}`;
|
|
664
|
+
}
|
|
665
|
+
export function blocksFieldTypeName(entryName, schemaPath) {
|
|
666
|
+
return `${blocksTypePrefix(entryName, schemaPath)}Block`;
|
|
591
667
|
}
|
|
592
|
-
export function blockTypeName(entryName,
|
|
593
|
-
return `${
|
|
668
|
+
export function blockTypeName(entryName, schemaPath, blockName) {
|
|
669
|
+
return `${blocksTypePrefix(entryName, schemaPath)}${typeName(blockName)}`;
|
|
594
670
|
}
|
|
595
671
|
export function defineCmsConfig(config) {
|
|
596
672
|
return config;
|
|
@@ -598,5 +674,13 @@ export function defineCmsConfig(config) {
|
|
|
598
674
|
export function defineCmsBlocks(blocks) {
|
|
599
675
|
return blocks;
|
|
600
676
|
}
|
|
677
|
+
export * from "./block-paths.js";
|
|
678
|
+
export * from "./conditions.js";
|
|
679
|
+
export * from "./content-routes.js";
|
|
680
|
+
export * from "./seo.js";
|
|
681
|
+
export * from "./redirects.js";
|
|
601
682
|
export * from "./layout.js";
|
|
683
|
+
export * from "./media-focal.js";
|
|
602
684
|
export * from "./users.js";
|
|
685
|
+
export * from "./preview-links.js";
|
|
686
|
+
export * from "./links.js";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CmsBlockPath } from './block-paths.js';
|
|
2
|
+
import type { FieldConfig } from './index.js';
|
|
3
|
+
export declare const CMS_INLINE_TEXT_MAX_LENGTH = 100000;
|
|
4
|
+
export declare const CMS_INLINE_INPUT_DELAY = 250;
|
|
5
|
+
export interface CmsInlineNode {
|
|
6
|
+
nodeType: number;
|
|
7
|
+
nodeName: string;
|
|
8
|
+
nodeValue: string | null;
|
|
9
|
+
childNodes: ArrayLike<CmsInlineNode>;
|
|
10
|
+
}
|
|
11
|
+
export interface CmsInlineOverride {
|
|
12
|
+
path: CmsBlockPath | null;
|
|
13
|
+
key: string;
|
|
14
|
+
value: unknown;
|
|
15
|
+
settled: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function isInlineTextField(field: FieldConfig | undefined): field is FieldConfig;
|
|
18
|
+
export declare function isPlainTextContent(node: CmsInlineNode): boolean;
|
|
19
|
+
export declare function editableText(node: CmsInlineNode): string;
|
|
20
|
+
export declare function normalizeInlineText(text: string, multiline: boolean): string;
|
|
21
|
+
export declare function inlineTextLimit(field: FieldConfig | undefined): number | undefined;
|
|
22
|
+
export declare function clampInlineText(text: string, max: number | undefined): string;
|
|
23
|
+
export declare function fitInlineInsertion(text: string, room: number): string;
|
|
24
|
+
export declare function inlineFieldPath(path: CmsBlockPath | null, key: string): string;
|
|
25
|
+
export interface CmsInlineLockOptions {
|
|
26
|
+
fields: Record<string, FieldConfig> | null;
|
|
27
|
+
values: Record<string, unknown>;
|
|
28
|
+
blocksFields: Record<string, FieldConfig>;
|
|
29
|
+
blocksValues: Record<string, unknown>;
|
|
30
|
+
locked?: readonly string[];
|
|
31
|
+
}
|
|
32
|
+
export declare function lockedInlineFields(options: CmsInlineLockOptions): string[];
|
|
33
|
+
export declare function matchesInlineValue(text: string, value: unknown): boolean;
|
|
34
|
+
export declare function inlineFieldValue(field: FieldConfig, current: unknown, locale: string, defaultLocale: string, text: string): unknown;
|
|
35
|
+
export declare function applyInlineOverride<T extends Record<string, unknown>>(blocks: readonly T[], item: Record<string, unknown> | null, override: CmsInlineOverride | null): {
|
|
36
|
+
blocks: T[];
|
|
37
|
+
item: Record<string, unknown> | null;
|
|
38
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { formatBlockPath, updateBlockAt, walkBlocks } from "./block-paths.js";
|
|
2
|
+
import { decodeTranslatableValue, isFieldVisible, isTranslatableField } from "./index.js";
|
|
3
|
+
export const CMS_INLINE_TEXT_MAX_LENGTH = 1e5;
|
|
4
|
+
export const CMS_INLINE_INPUT_DELAY = 250;
|
|
5
|
+
const TEXT_NODE = 3;
|
|
6
|
+
const ELEMENT_NODE = 1;
|
|
7
|
+
const LINE_TAGS = /* @__PURE__ */ new Set(["DIV", "P", "LI"]);
|
|
8
|
+
export function isInlineTextField(field) {
|
|
9
|
+
return field?.type === "text";
|
|
10
|
+
}
|
|
11
|
+
export function isPlainTextContent(node) {
|
|
12
|
+
return Array.from(node.childNodes).every((child) => child.nodeType !== ELEMENT_NODE);
|
|
13
|
+
}
|
|
14
|
+
export function editableText(node) {
|
|
15
|
+
let text = "";
|
|
16
|
+
const walk = (parent) => {
|
|
17
|
+
for (const child of Array.from(parent.childNodes)) {
|
|
18
|
+
if (child.nodeType === TEXT_NODE) text += child.nodeValue ?? "";
|
|
19
|
+
else if (child.nodeType !== ELEMENT_NODE) continue;
|
|
20
|
+
else if (child.nodeName === "BR") text += "\n";
|
|
21
|
+
else {
|
|
22
|
+
if (LINE_TAGS.has(child.nodeName) && text && !text.endsWith("\n")) text += "\n";
|
|
23
|
+
walk(child);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
walk(node);
|
|
28
|
+
return text;
|
|
29
|
+
}
|
|
30
|
+
export function normalizeInlineText(text, multiline) {
|
|
31
|
+
const value = text.replace(/ /g, " ").replace(/\r\n?/g, "\n").replace(/\n$/, "");
|
|
32
|
+
return multiline ? value : value.replace(/[^\S\n]*\n\s*/g, " ");
|
|
33
|
+
}
|
|
34
|
+
export function inlineTextLimit(field) {
|
|
35
|
+
return isInlineTextField(field) && typeof field.max === "number" ? field.max : void 0;
|
|
36
|
+
}
|
|
37
|
+
export function clampInlineText(text, max) {
|
|
38
|
+
return max === void 0 || text.length <= max ? text : text.slice(0, max);
|
|
39
|
+
}
|
|
40
|
+
export function fitInlineInsertion(text, room) {
|
|
41
|
+
return text.slice(0, Math.max(room, 0));
|
|
42
|
+
}
|
|
43
|
+
export function inlineFieldPath(path, key) {
|
|
44
|
+
return path ? `${formatBlockPath(path)}.${key}` : key;
|
|
45
|
+
}
|
|
46
|
+
export function lockedInlineFields(options) {
|
|
47
|
+
const paths = [];
|
|
48
|
+
for (const [key, field] of Object.entries(options.fields ?? {})) {
|
|
49
|
+
if (!isInlineTextField(field)) continue;
|
|
50
|
+
if (options.locked?.includes(key) || !isFieldVisible(field, options.values, options.fields))
|
|
51
|
+
paths.push(key);
|
|
52
|
+
}
|
|
53
|
+
walkBlocks(options.blocksFields, options.blocksValues, ({ item, block, path }) => {
|
|
54
|
+
for (const [key, field] of Object.entries(block.fields)) {
|
|
55
|
+
if (isInlineTextField(field) && !isFieldVisible(field, item, block.fields))
|
|
56
|
+
paths.push(inlineFieldPath(path, key));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return paths;
|
|
60
|
+
}
|
|
61
|
+
export function matchesInlineValue(text, value) {
|
|
62
|
+
if (value != null && typeof value !== "string") return false;
|
|
63
|
+
return text.trim() === (value ?? "").trim();
|
|
64
|
+
}
|
|
65
|
+
export function inlineFieldValue(field, current, locale, defaultLocale, text) {
|
|
66
|
+
if (!isTranslatableField(field)) return text === "" ? null : text;
|
|
67
|
+
const translations = decodeTranslatableValue(current, defaultLocale) ?? {};
|
|
68
|
+
const next = Object.fromEntries(Object.entries(translations).filter(([code]) => code !== locale));
|
|
69
|
+
if (text !== "") next[locale] = text;
|
|
70
|
+
return Object.keys(next).length ? next : null;
|
|
71
|
+
}
|
|
72
|
+
export function applyInlineOverride(blocks, item, override) {
|
|
73
|
+
if (!override) return { blocks: [...blocks], item };
|
|
74
|
+
if (!override.path)
|
|
75
|
+
return {
|
|
76
|
+
blocks: [...blocks],
|
|
77
|
+
item: item ? { ...item, [override.key]: override.value } : item
|
|
78
|
+
};
|
|
79
|
+
const root = String(override.path[0]);
|
|
80
|
+
const updated = updateBlockAt({ [root]: blocks }, override.path, (block) => ({
|
|
81
|
+
...block,
|
|
82
|
+
[override.key]: override.value
|
|
83
|
+
}));
|
|
84
|
+
return { blocks: [...updated[root] ?? []], item };
|
|
85
|
+
}
|