@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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CmsI18n, FieldConfig } from './index.js';
|
|
2
|
+
export declare const DEFAULT_TODAY = "today";
|
|
3
|
+
export declare const DEFAULT_NOW = "now";
|
|
4
|
+
export declare const DEFAULT_FIELD_TYPES: string[];
|
|
5
|
+
export declare const UNIQUE_FIELD_TYPES: string[];
|
|
6
|
+
export declare const IMMUTABLE_FIELD_TYPES: string[];
|
|
7
|
+
export interface FieldDefaultOptions {
|
|
8
|
+
now?: Date;
|
|
9
|
+
local?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function hasFieldDefault(field: FieldConfig): boolean;
|
|
12
|
+
export declare function resolveFieldDefault(field: FieldConfig, i18n: Pick<CmsI18n, 'locales' | 'defaultLocale'>, options?: FieldDefaultOptions): unknown;
|
|
13
|
+
export declare function entryDefaults(fields: Record<string, FieldConfig>, i18n: Pick<CmsI18n, 'locales' | 'defaultLocale'>, options?: FieldDefaultOptions): Record<string, unknown>;
|
|
14
|
+
export declare function withEntryDefaults(fields: Record<string, FieldConfig>, values: Record<string, unknown>, i18n: Pick<CmsI18n, 'locales' | 'defaultLocale'>, options?: FieldDefaultOptions): Record<string, unknown>;
|
|
15
|
+
export declare function isUniqueValueField(field: FieldConfig): boolean;
|
|
16
|
+
export declare function isCaseInsensitiveUnique(field: Pick<FieldConfig, 'type'>): boolean;
|
|
17
|
+
export declare function uniqueCompareValue<T>(field: Pick<FieldConfig, 'type'>, value: T): T | string;
|
|
18
|
+
export declare function isImmutableField(field: FieldConfig): boolean;
|
|
19
|
+
export declare function immutableFieldKeys(fields: Record<string, FieldConfig>): string[];
|
|
20
|
+
export declare function lockedFieldKeys(fields: Record<string, FieldConfig>, saved: Record<string, unknown> | null | undefined): string[];
|
|
21
|
+
export declare function changedImmutableKeys(fields: Record<string, FieldConfig>, saved: Record<string, unknown> | null | undefined, next: Record<string, unknown>): string[];
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { isTranslatableField } from "./index.js";
|
|
2
|
+
export const DEFAULT_TODAY = "today";
|
|
3
|
+
export const DEFAULT_NOW = "now";
|
|
4
|
+
export const DEFAULT_FIELD_TYPES = [
|
|
5
|
+
"text",
|
|
6
|
+
"richtext",
|
|
7
|
+
"number",
|
|
8
|
+
"boolean",
|
|
9
|
+
"date",
|
|
10
|
+
"datetime",
|
|
11
|
+
"email",
|
|
12
|
+
"select",
|
|
13
|
+
"tags"
|
|
14
|
+
];
|
|
15
|
+
export const UNIQUE_FIELD_TYPES = ["text", "email", "number"];
|
|
16
|
+
export const IMMUTABLE_FIELD_TYPES = [
|
|
17
|
+
"text",
|
|
18
|
+
"number",
|
|
19
|
+
"boolean",
|
|
20
|
+
"date",
|
|
21
|
+
"datetime",
|
|
22
|
+
"email",
|
|
23
|
+
"slug",
|
|
24
|
+
"select",
|
|
25
|
+
"relation"
|
|
26
|
+
];
|
|
27
|
+
function pad(value) {
|
|
28
|
+
return String(value).padStart(2, "0");
|
|
29
|
+
}
|
|
30
|
+
function todayOf(now, local) {
|
|
31
|
+
if (!local) return now.toISOString().slice(0, 10);
|
|
32
|
+
return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
|
|
33
|
+
}
|
|
34
|
+
export function hasFieldDefault(field) {
|
|
35
|
+
return field.default !== void 0 && DEFAULT_FIELD_TYPES.includes(field.type);
|
|
36
|
+
}
|
|
37
|
+
export function resolveFieldDefault(field, i18n, options = {}) {
|
|
38
|
+
const value = field.default;
|
|
39
|
+
if (value === void 0 || value === null) return null;
|
|
40
|
+
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
41
|
+
if (field.type === "date" && value === DEFAULT_TODAY) return todayOf(now, !!options.local);
|
|
42
|
+
if (field.type === "datetime" && value === DEFAULT_NOW) return now.toISOString();
|
|
43
|
+
if (Array.isArray(value)) return [...value];
|
|
44
|
+
if (isTranslatableField(field) && i18n.locales.length) return { [i18n.defaultLocale]: value };
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
export function entryDefaults(fields, i18n, options = {}) {
|
|
48
|
+
return Object.fromEntries(
|
|
49
|
+
Object.entries(fields).filter(([, field]) => hasFieldDefault(field)).map(([key, field]) => [key, resolveFieldDefault(field, i18n, options)])
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
export function withEntryDefaults(fields, values, i18n, options = {}) {
|
|
53
|
+
const filled = { ...values };
|
|
54
|
+
for (const [key, value] of Object.entries(entryDefaults(fields, i18n, options))) {
|
|
55
|
+
if (!Object.hasOwn(filled, key)) filled[key] = value;
|
|
56
|
+
}
|
|
57
|
+
return filled;
|
|
58
|
+
}
|
|
59
|
+
export function isUniqueValueField(field) {
|
|
60
|
+
return !!field.unique && UNIQUE_FIELD_TYPES.includes(field.type) && !isTranslatableField(field);
|
|
61
|
+
}
|
|
62
|
+
export function isCaseInsensitiveUnique(field) {
|
|
63
|
+
return field.type === "email";
|
|
64
|
+
}
|
|
65
|
+
export function uniqueCompareValue(field, value) {
|
|
66
|
+
return isCaseInsensitiveUnique(field) && typeof value === "string" ? value.toLowerCase() : value;
|
|
67
|
+
}
|
|
68
|
+
export function isImmutableField(field) {
|
|
69
|
+
return !!field.immutable && IMMUTABLE_FIELD_TYPES.includes(field.type) && !isTranslatableField(field) && !(field.type === "relation" && field.cardinality === "many-to-many");
|
|
70
|
+
}
|
|
71
|
+
export function immutableFieldKeys(fields) {
|
|
72
|
+
return Object.keys(fields).filter((key) => isImmutableField(fields[key]));
|
|
73
|
+
}
|
|
74
|
+
function isBlank(value) {
|
|
75
|
+
if (value === null || value === void 0) return true;
|
|
76
|
+
if (typeof value === "string") return !value.trim();
|
|
77
|
+
return Array.isArray(value) && !value.length;
|
|
78
|
+
}
|
|
79
|
+
export function lockedFieldKeys(fields, saved) {
|
|
80
|
+
if (!saved) return [];
|
|
81
|
+
return immutableFieldKeys(fields).filter((key) => !isBlank(saved[key]));
|
|
82
|
+
}
|
|
83
|
+
function comparable(value) {
|
|
84
|
+
return JSON.stringify(isBlank(value) ? null : value);
|
|
85
|
+
}
|
|
86
|
+
export function changedImmutableKeys(fields, saved, next) {
|
|
87
|
+
return lockedFieldKeys(fields, saved).filter(
|
|
88
|
+
(key) => Object.hasOwn(next, key) && comparable(saved[key]) !== comparable(next[key])
|
|
89
|
+
);
|
|
90
|
+
}
|
|
@@ -2,4 +2,5 @@ import type { CmsConfig } from './index.js';
|
|
|
2
2
|
import { blockTypeName, blocksFieldTypeName, typeName } from './index.js';
|
|
3
3
|
export { blockTypeName, blocksFieldTypeName, typeName };
|
|
4
4
|
export declare const LIST_FILTER = "StringListFilter";
|
|
5
|
+
export declare const SITE_QUERY_FIELD = "cmsSite";
|
|
5
6
|
export declare function renderGraphqlSdl(config: CmsConfig): string;
|
|
@@ -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
|
+
}
|