@xleddyl/nuxt-cms 0.9.4 → 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 +27 -9
- 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 +143 -28
- 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/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
|
@@ -6,8 +6,10 @@ import {
|
|
|
6
6
|
isMultiValueField,
|
|
7
7
|
isPrivateField,
|
|
8
8
|
isRequiredField,
|
|
9
|
+
isRoutedContent,
|
|
9
10
|
isTranslatableField,
|
|
10
11
|
pageAllFields,
|
|
12
|
+
relationTarget,
|
|
11
13
|
typeName
|
|
12
14
|
} from "./index.js";
|
|
13
15
|
export { blockTypeName, blocksFieldTypeName, typeName };
|
|
@@ -32,6 +34,7 @@ function filterScalarFor(field) {
|
|
|
32
34
|
if (isMultiValueField(field)) return LIST_FILTER;
|
|
33
35
|
switch (field.type) {
|
|
34
36
|
case "json":
|
|
37
|
+
case "link":
|
|
35
38
|
return null;
|
|
36
39
|
case "blocks":
|
|
37
40
|
return null;
|
|
@@ -54,12 +57,13 @@ function filterableKeys(entry) {
|
|
|
54
57
|
}
|
|
55
58
|
function fieldSdl(config, entryName, key, field) {
|
|
56
59
|
if (field.type === "relation") {
|
|
57
|
-
const target = typeName(field
|
|
60
|
+
const target = typeName(relationTarget(field));
|
|
58
61
|
if (field.cardinality === "many-to-many") return ` ${key}: [${target}!]!`;
|
|
59
|
-
const nonNull = isRequiredField(field) && !config[field
|
|
62
|
+
const nonNull = isRequiredField(field) && !config[relationTarget(field)]?.drafts;
|
|
60
63
|
return ` ${key}: ${target}${nonNull ? "!" : ""}`;
|
|
61
64
|
}
|
|
62
65
|
if (field.type === "media") return ` ${key}: CmsMedia`;
|
|
66
|
+
if (field.type === "link") return ` ${key}: CmsLink`;
|
|
63
67
|
if (field.type === "tags" || field.type === "select" && field.multiple)
|
|
64
68
|
return ` ${key}: [String!]!`;
|
|
65
69
|
if (field.type === "blocks")
|
|
@@ -69,6 +73,7 @@ function fieldSdl(config, entryName, key, field) {
|
|
|
69
73
|
function entrySdl(config, name, entry) {
|
|
70
74
|
const lines = [" id: ID!"];
|
|
71
75
|
if (entry.kind === "page") lines.push(` ${PAGE_PATH_FIELD}: String!`);
|
|
76
|
+
if (isRoutedContent(entry)) lines.push(" path: String!", " paths: [CmsLocalePath!]!");
|
|
72
77
|
for (const [key, field] of Object.entries(entryFields(entry))) {
|
|
73
78
|
if (isPrivateField(field)) continue;
|
|
74
79
|
lines.push(fieldSdl(config, name, key, field));
|
|
@@ -79,42 +84,58 @@ function entrySdl(config, name, entry) {
|
|
|
79
84
|
${lines.join("\n")}
|
|
80
85
|
}`;
|
|
81
86
|
}
|
|
82
|
-
function blockFieldSdl(field) {
|
|
83
|
-
|
|
87
|
+
function blockFieldSdl(name, schemaPath, blockName, key, field) {
|
|
88
|
+
if (field.type === "media") return "CmsMedia";
|
|
89
|
+
if (field.type === "link") return "CmsLink";
|
|
90
|
+
if (field.type === "blocks")
|
|
91
|
+
return `[${blocksFieldTypeName(name, [...schemaPath, blockName, key])}!]`;
|
|
92
|
+
return scalarFor(field);
|
|
84
93
|
}
|
|
85
|
-
function sharedBlockFieldsSdl(field) {
|
|
86
|
-
const blocks = Object.
|
|
94
|
+
function sharedBlockFieldsSdl(name, schemaPath, field) {
|
|
95
|
+
const blocks = Object.entries(field.blocks ?? {});
|
|
87
96
|
const first = blocks[0];
|
|
88
97
|
if (!first) return [];
|
|
89
98
|
const lines = [];
|
|
90
|
-
for (const key of Object.keys(first.fields)) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
for (const key of Object.keys(first[1].fields)) {
|
|
100
|
+
if (blocks.some(([, block]) => !block.fields[key])) continue;
|
|
101
|
+
const types = blocks.map(
|
|
102
|
+
([blockName, block]) => blockFieldSdl(name, schemaPath, blockName, key, block.fields[key])
|
|
103
|
+
);
|
|
94
104
|
if (types.some((type) => type !== types[0])) continue;
|
|
95
105
|
lines.push(` ${key}: ${types[0]}`);
|
|
96
106
|
}
|
|
97
107
|
return lines;
|
|
98
108
|
}
|
|
99
|
-
function blocksSdl(name,
|
|
109
|
+
function blocksSdl(name, schemaPath, field) {
|
|
100
110
|
const blocks = Object.entries(field.blocks ?? {});
|
|
101
111
|
if (!blocks.length) return [];
|
|
102
|
-
const interfaceName = blocksFieldTypeName(name,
|
|
103
|
-
const shared = [" type: String!", ...sharedBlockFieldsSdl(field)];
|
|
112
|
+
const interfaceName = blocksFieldTypeName(name, schemaPath);
|
|
113
|
+
const shared = [" type: String!", ...sharedBlockFieldsSdl(name, schemaPath, field)];
|
|
104
114
|
const defs = [`interface ${interfaceName} {
|
|
105
115
|
${shared.join("\n")}
|
|
106
116
|
}`];
|
|
117
|
+
const nested = [];
|
|
107
118
|
for (const [blockName, block] of blocks) {
|
|
108
119
|
const lines = [" type: String!"];
|
|
109
120
|
for (const [blockFieldKey, blockField] of Object.entries(block.fields)) {
|
|
110
|
-
lines.push(
|
|
121
|
+
lines.push(
|
|
122
|
+
` ${blockFieldKey}: ${blockFieldSdl(
|
|
123
|
+
name,
|
|
124
|
+
schemaPath,
|
|
125
|
+
blockName,
|
|
126
|
+
blockFieldKey,
|
|
127
|
+
blockField
|
|
128
|
+
)}`
|
|
129
|
+
);
|
|
130
|
+
if (blockField.type === "blocks")
|
|
131
|
+
nested.push(...blocksSdl(name, [...schemaPath, blockName, blockFieldKey], blockField));
|
|
111
132
|
}
|
|
112
|
-
const gqlType = blockTypeName(name,
|
|
133
|
+
const gqlType = blockTypeName(name, schemaPath, blockName);
|
|
113
134
|
defs.push(`type ${gqlType} implements ${interfaceName} {
|
|
114
135
|
${lines.join("\n")}
|
|
115
136
|
}`);
|
|
116
137
|
}
|
|
117
|
-
return defs;
|
|
138
|
+
return [...defs, ...nested];
|
|
118
139
|
}
|
|
119
140
|
function filterSdl(name, entry) {
|
|
120
141
|
const gqlType = typeName(name);
|
|
@@ -147,17 +168,22 @@ const COMMON_SDL = [
|
|
|
147
168
|
isEmpty: Boolean
|
|
148
169
|
}`,
|
|
149
170
|
"enum CmsMediaType {\n image\n video\n file\n}",
|
|
150
|
-
"type CmsMedia {\n key: String!\n url: String\n type: CmsMediaType!\n alt: String\n folder: String\n mime: String\n size: Int\n width: Int\n height: Int\n}"
|
|
171
|
+
"type CmsMedia {\n key: String!\n url: String\n type: CmsMediaType!\n alt: String\n folder: String\n mime: String\n size: Int\n width: Int\n height: Int\n focalX: Float\n focalY: Float\n}",
|
|
172
|
+
"type CmsLink {\n href: String\n label: String\n newTab: Boolean!\n external: Boolean!\n entry: String\n id: String\n}",
|
|
173
|
+
"type CmsSite {\n name: String\n titleTemplate: String\n description: String\n image: CmsMedia\n hidden: Boolean!\n}"
|
|
151
174
|
];
|
|
175
|
+
export const SITE_QUERY_FIELD = "cmsSite";
|
|
152
176
|
export function renderGraphqlSdl(config) {
|
|
153
|
-
const queryLines = [];
|
|
177
|
+
const queryLines = [` ${SITE_QUERY_FIELD}(locale: String): CmsSite!`];
|
|
154
178
|
const types = [];
|
|
179
|
+
if (Object.values(config).some(isRoutedContent))
|
|
180
|
+
types.push("type CmsLocalePath {\n locale: String!\n path: String!\n}");
|
|
155
181
|
for (const [name, entry] of Object.entries(config)) {
|
|
156
182
|
const gqlType = typeName(name);
|
|
157
183
|
types.push(entrySdl(config, name, entry));
|
|
158
184
|
for (const [key, field] of Object.entries(entryFields(entry))) {
|
|
159
185
|
if (field.type === "blocks" && !isPrivateField(field))
|
|
160
|
-
types.push(...blocksSdl(name, key, field));
|
|
186
|
+
types.push(...blocksSdl(name, [key], field));
|
|
161
187
|
}
|
|
162
188
|
if (entry.kind === "single") {
|
|
163
189
|
queryLines.push(` ${name}(locale: String): ${gqlType}`);
|
|
@@ -176,12 +202,10 @@ export function renderGraphqlSdl(config) {
|
|
|
176
202
|
queryLines.push(` ${name}Count(filters: ${gqlType}Filters): Int!`);
|
|
177
203
|
if (entry.kind === "content")
|
|
178
204
|
queryLines.push(` ${name}BySlug(slug: String!, locale: String): ${gqlType}`);
|
|
205
|
+
if (isRoutedContent(entry))
|
|
206
|
+
queryLines.push(` ${name}ByPath(path: String!, locale: String): ${gqlType}`);
|
|
179
207
|
}
|
|
180
|
-
return [
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
`type Query {
|
|
184
|
-
${queryLines.length ? queryLines.join("\n") : " _empty: Boolean"}
|
|
185
|
-
}`
|
|
186
|
-
].join("\n\n");
|
|
208
|
+
return [...COMMON_SDL, ...types, `type Query {
|
|
209
|
+
${queryLines.join("\n")}
|
|
210
|
+
}`].join("\n\n");
|
|
187
211
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const CMS_HISTORY_MAX = 100;
|
|
2
|
+
export declare const CMS_HISTORY_DELAY = 400;
|
|
3
|
+
export interface CmsHistoryStatus {
|
|
4
|
+
canUndo: boolean;
|
|
5
|
+
canRedo: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface CmsHistoryOptions<S = number | null> {
|
|
8
|
+
state: () => Record<string, unknown>;
|
|
9
|
+
selected: () => S;
|
|
10
|
+
restore: (state: Record<string, unknown>, selected: S) => void;
|
|
11
|
+
omit?: readonly string[];
|
|
12
|
+
max?: number;
|
|
13
|
+
delay?: number;
|
|
14
|
+
onUpdate?: (status: CmsHistoryStatus) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function createCmsHistory<S = number | null>(options: CmsHistoryOptions<S>): {
|
|
17
|
+
change: (key?: string, hold?: boolean) => void;
|
|
18
|
+
release: () => void;
|
|
19
|
+
observe: () => void;
|
|
20
|
+
undo: () => boolean;
|
|
21
|
+
redo: () => boolean;
|
|
22
|
+
reset: () => void;
|
|
23
|
+
flush: () => void;
|
|
24
|
+
dispose: () => void;
|
|
25
|
+
canUndo: () => boolean;
|
|
26
|
+
canRedo: () => boolean;
|
|
27
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export const CMS_HISTORY_MAX = 100;
|
|
2
|
+
export const CMS_HISTORY_DELAY = 400;
|
|
3
|
+
export function createCmsHistory(options) {
|
|
4
|
+
const max = options.max ?? CMS_HISTORY_MAX;
|
|
5
|
+
const delay = options.delay ?? CMS_HISTORY_DELAY;
|
|
6
|
+
const omitted = new Set(options.omit ?? []);
|
|
7
|
+
const status = { canUndo: false, canRedo: false };
|
|
8
|
+
let entries = [];
|
|
9
|
+
let index = 0;
|
|
10
|
+
let intent = null;
|
|
11
|
+
let timer;
|
|
12
|
+
function serialize() {
|
|
13
|
+
const state = options.state();
|
|
14
|
+
return JSON.stringify(
|
|
15
|
+
Object.fromEntries(Object.entries(state).filter(([key]) => !omitted.has(key)))
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
function refresh() {
|
|
19
|
+
const pending = !!intent && serialize() !== entries[index].json;
|
|
20
|
+
const canUndo = index > 0 || pending;
|
|
21
|
+
const canRedo = !pending && index < entries.length - 1;
|
|
22
|
+
if (canUndo === status.canUndo && canRedo === status.canRedo) return;
|
|
23
|
+
status.canUndo = canUndo;
|
|
24
|
+
status.canRedo = canRedo;
|
|
25
|
+
options.onUpdate?.({ ...status });
|
|
26
|
+
}
|
|
27
|
+
function clearTimer() {
|
|
28
|
+
if (timer === void 0) return;
|
|
29
|
+
clearTimeout(timer);
|
|
30
|
+
timer = void 0;
|
|
31
|
+
}
|
|
32
|
+
function reset() {
|
|
33
|
+
clearTimer();
|
|
34
|
+
intent = null;
|
|
35
|
+
const selected = options.selected();
|
|
36
|
+
entries = [{ json: serialize(), selected, before: selected }];
|
|
37
|
+
index = 0;
|
|
38
|
+
refresh();
|
|
39
|
+
}
|
|
40
|
+
function flush() {
|
|
41
|
+
clearTimer();
|
|
42
|
+
const current = intent;
|
|
43
|
+
intent = null;
|
|
44
|
+
if (!current) return;
|
|
45
|
+
const json = serialize();
|
|
46
|
+
if (json !== entries[index].json) {
|
|
47
|
+
entries = entries.slice(0, index + 1);
|
|
48
|
+
entries.push({ json, selected: options.selected(), before: current.before });
|
|
49
|
+
if (entries.length > max + 1) entries = entries.slice(entries.length - max - 1);
|
|
50
|
+
index = entries.length - 1;
|
|
51
|
+
}
|
|
52
|
+
refresh();
|
|
53
|
+
}
|
|
54
|
+
function change(key, hold = false) {
|
|
55
|
+
const coalesce = key ?? null;
|
|
56
|
+
if (intent && (coalesce === null || intent.key !== coalesce)) flush();
|
|
57
|
+
if (!intent) intent = { key: coalesce, before: options.selected(), held: false };
|
|
58
|
+
if (hold && coalesce !== null) {
|
|
59
|
+
intent.held = true;
|
|
60
|
+
clearTimer();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function release() {
|
|
64
|
+
if (intent?.held) flush();
|
|
65
|
+
}
|
|
66
|
+
function observe() {
|
|
67
|
+
const json = serialize();
|
|
68
|
+
const entry = entries[index];
|
|
69
|
+
if (json === entry.json) {
|
|
70
|
+
if (intent && timer === void 0 && !intent.held) intent = null;
|
|
71
|
+
refresh();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!intent) {
|
|
75
|
+
entry.json = json;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (intent.key === null) {
|
|
79
|
+
flush();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (intent.held) {
|
|
83
|
+
refresh();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
clearTimer();
|
|
87
|
+
timer = setTimeout(flush, delay);
|
|
88
|
+
refresh();
|
|
89
|
+
}
|
|
90
|
+
function apply(entry, selected) {
|
|
91
|
+
const values = JSON.parse(entry.json);
|
|
92
|
+
options.restore({ ...options.state(), ...values }, selected);
|
|
93
|
+
refresh();
|
|
94
|
+
}
|
|
95
|
+
function undo() {
|
|
96
|
+
flush();
|
|
97
|
+
if (index === 0) return false;
|
|
98
|
+
const from = entries[index];
|
|
99
|
+
index--;
|
|
100
|
+
apply(entries[index], from.before);
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
function redo() {
|
|
104
|
+
flush();
|
|
105
|
+
if (index >= entries.length - 1) return false;
|
|
106
|
+
index++;
|
|
107
|
+
apply(entries[index], entries[index].selected);
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
reset();
|
|
111
|
+
return {
|
|
112
|
+
change,
|
|
113
|
+
release,
|
|
114
|
+
observe,
|
|
115
|
+
undo,
|
|
116
|
+
redo,
|
|
117
|
+
reset,
|
|
118
|
+
flush,
|
|
119
|
+
dispose: clearTimer,
|
|
120
|
+
canUndo: () => status.canUndo,
|
|
121
|
+
canRedo: () => status.canRedo
|
|
122
|
+
};
|
|
123
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { H3Event } from 'h3';
|
|
2
|
+
import type { CmsEntryKind } from './index.js';
|
|
3
|
+
import type { CmsUserRole } from './users.js';
|
|
4
|
+
export declare const CMS_ENTRY_CHANGE_HOOK = "cms:entry:change";
|
|
5
|
+
export declare const CMS_MEDIA_CHANGE_HOOK = "cms:media:change";
|
|
6
|
+
export declare const CMS_ENTRY_ACTIONS: readonly ["create", "update", "delete", "publish", "unpublish", "import"];
|
|
7
|
+
export declare const CMS_MEDIA_ACTIONS: readonly ["upload", "update", "move", "delete", "folder-create", "folder-rename", "folder-delete"];
|
|
8
|
+
export type CmsEntryAction = (typeof CMS_ENTRY_ACTIONS)[number];
|
|
9
|
+
export type CmsMediaAction = (typeof CMS_MEDIA_ACTIONS)[number];
|
|
10
|
+
export type CmsEntryStatus = 'draft' | 'published';
|
|
11
|
+
export interface CmsHookUser {
|
|
12
|
+
id: string | null;
|
|
13
|
+
email: string;
|
|
14
|
+
name: string | null;
|
|
15
|
+
role: CmsUserRole;
|
|
16
|
+
}
|
|
17
|
+
export interface CmsEntryChange {
|
|
18
|
+
entry: string;
|
|
19
|
+
kind: CmsEntryKind;
|
|
20
|
+
action: CmsEntryAction;
|
|
21
|
+
ids: string[];
|
|
22
|
+
path: string | null;
|
|
23
|
+
status: CmsEntryStatus | null;
|
|
24
|
+
item: Record<string, unknown> | null;
|
|
25
|
+
user: CmsHookUser;
|
|
26
|
+
at: string;
|
|
27
|
+
}
|
|
28
|
+
export interface CmsMediaChange {
|
|
29
|
+
action: CmsMediaAction;
|
|
30
|
+
keys: string[];
|
|
31
|
+
folder: string | null;
|
|
32
|
+
from: string | null;
|
|
33
|
+
user: CmsHookUser;
|
|
34
|
+
at: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CmsHookContext {
|
|
37
|
+
event: H3Event;
|
|
38
|
+
}
|
|
39
|
+
export interface CmsRuntimeHooks {
|
|
40
|
+
[CMS_ENTRY_CHANGE_HOOK]: (change: CmsEntryChange, context: CmsHookContext) => void | Promise<void>;
|
|
41
|
+
[CMS_MEDIA_CHANGE_HOOK]: (change: CmsMediaChange, context: CmsHookContext) => void | Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
export type CmsHookName = keyof CmsRuntimeHooks;
|
|
44
|
+
export declare function entryStatus(value: unknown): CmsEntryStatus | null;
|
|
45
|
+
export declare function entryWriteAction(created: boolean, previous: CmsEntryStatus | null, next: CmsEntryStatus | null): CmsEntryAction;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const CMS_ENTRY_CHANGE_HOOK = "cms:entry:change";
|
|
2
|
+
export const CMS_MEDIA_CHANGE_HOOK = "cms:media:change";
|
|
3
|
+
export const CMS_ENTRY_ACTIONS = [
|
|
4
|
+
"create",
|
|
5
|
+
"update",
|
|
6
|
+
"delete",
|
|
7
|
+
"publish",
|
|
8
|
+
"unpublish",
|
|
9
|
+
"import"
|
|
10
|
+
];
|
|
11
|
+
export const CMS_MEDIA_ACTIONS = [
|
|
12
|
+
"upload",
|
|
13
|
+
"update",
|
|
14
|
+
"move",
|
|
15
|
+
"delete",
|
|
16
|
+
"folder-create",
|
|
17
|
+
"folder-rename",
|
|
18
|
+
"folder-delete"
|
|
19
|
+
];
|
|
20
|
+
export function entryStatus(value) {
|
|
21
|
+
return value === "draft" || value === "published" ? value : null;
|
|
22
|
+
}
|
|
23
|
+
export function entryWriteAction(created, previous, next) {
|
|
24
|
+
if (created) return "create";
|
|
25
|
+
if (previous !== "published" && next === "published") return "publish";
|
|
26
|
+
if (previous === "published" && next === "draft") return "unpublish";
|
|
27
|
+
return "update";
|
|
28
|
+
}
|
|
@@ -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';
|