@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,75 @@
|
|
|
1
|
+
import { toast, useConfirm } from "@xleddyl/443-components-vue";
|
|
2
|
+
import { computed, ref, useState } from "#imports";
|
|
3
|
+
import { cmsApi } from "../utils/api.js";
|
|
4
|
+
import { errorMessage } from "../utils/ui.js";
|
|
5
|
+
export function useCmsRecordList(options) {
|
|
6
|
+
const confirm = useConfirm();
|
|
7
|
+
const items = useState(`cms-list-${options.key}`, () => []);
|
|
8
|
+
const loaded = useState(`cms-list-${options.key}-loaded`, () => false);
|
|
9
|
+
const loading = ref(false);
|
|
10
|
+
let pending = null;
|
|
11
|
+
const sorted = computed(
|
|
12
|
+
() => options.compare ? [...items.value].sort(options.compare) : items.value
|
|
13
|
+
);
|
|
14
|
+
function load() {
|
|
15
|
+
pending ??= (async () => {
|
|
16
|
+
loading.value = true;
|
|
17
|
+
try {
|
|
18
|
+
items.value = await cmsApi(options.url);
|
|
19
|
+
loaded.value = true;
|
|
20
|
+
} catch (error) {
|
|
21
|
+
toast.error(options.loadError, { description: errorMessage(error) });
|
|
22
|
+
} finally {
|
|
23
|
+
loading.value = false;
|
|
24
|
+
pending = null;
|
|
25
|
+
}
|
|
26
|
+
})();
|
|
27
|
+
return pending;
|
|
28
|
+
}
|
|
29
|
+
async function ensureLoaded() {
|
|
30
|
+
if (!loaded.value) await load();
|
|
31
|
+
}
|
|
32
|
+
function find(id) {
|
|
33
|
+
return id == null ? void 0 : items.value.find((item) => item.id === id);
|
|
34
|
+
}
|
|
35
|
+
function upsert(record) {
|
|
36
|
+
const exists = items.value.some((item) => item.id === record.id);
|
|
37
|
+
items.value = exists ? items.value.map((item) => item.id === record.id ? record : item) : [...items.value, record];
|
|
38
|
+
}
|
|
39
|
+
function removeLocal(id) {
|
|
40
|
+
items.value = items.value.filter((item) => item.id !== id);
|
|
41
|
+
}
|
|
42
|
+
async function resolveLabel(id) {
|
|
43
|
+
await ensureLoaded();
|
|
44
|
+
const record = find(id);
|
|
45
|
+
return record ? options.label(record) : void 0;
|
|
46
|
+
}
|
|
47
|
+
async function remove(record) {
|
|
48
|
+
const question = options.confirmDelete?.(record);
|
|
49
|
+
if (question && !await confirm.delete(question.title, { description: question.description }))
|
|
50
|
+
return false;
|
|
51
|
+
try {
|
|
52
|
+
await cmsApi(`${options.url}/${encodeURIComponent(record.id)}`, { method: "DELETE" });
|
|
53
|
+
removeLocal(record.id);
|
|
54
|
+
if (options.deleted) toast.success(options.deleted);
|
|
55
|
+
return true;
|
|
56
|
+
} catch (error) {
|
|
57
|
+
toast.error(options.deleteError ?? "Not deleted", { description: errorMessage(error) });
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
items,
|
|
63
|
+
sorted,
|
|
64
|
+
loaded,
|
|
65
|
+
loading,
|
|
66
|
+
load,
|
|
67
|
+
ensureLoaded,
|
|
68
|
+
find,
|
|
69
|
+
upsert,
|
|
70
|
+
removeLocal,
|
|
71
|
+
resolveLabel,
|
|
72
|
+
remove,
|
|
73
|
+
label: options.label
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CMS_NEW_RECORD = "new";
|
|
2
|
+
export declare const CMS_MEDIA_ROUTE_KEY = "media";
|
|
3
|
+
export declare function provideCmsRouteLocation(): void;
|
|
4
|
+
export declare function useCmsRouteFlag(key: string, value?: string): import("vue").WritableComputedRef<boolean, boolean>;
|
|
5
|
+
export declare function useCmsOverlayFlag(key: string, routed: boolean, value?: string): import("vue").WritableComputedRef<boolean, boolean>;
|
|
6
|
+
export declare function useCmsPageQuery(key: string): import("vue").WritableComputedRef<string, string>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ROUTE_LOCATION_KEY, useRouteState } from "@xleddyl/443-components-vue";
|
|
2
|
+
import { computed, provide, ref } from "#imports";
|
|
3
|
+
export const CMS_NEW_RECORD = "new";
|
|
4
|
+
export const CMS_MEDIA_ROUTE_KEY = "media";
|
|
5
|
+
export function provideCmsRouteLocation() {
|
|
6
|
+
provide(ROUTE_LOCATION_KEY, "hash");
|
|
7
|
+
}
|
|
8
|
+
export function useCmsRouteFlag(key, value = "open") {
|
|
9
|
+
const param = useRouteState(key, { location: "hash" });
|
|
10
|
+
return computed({
|
|
11
|
+
get: () => param.value === value,
|
|
12
|
+
set: (open) => {
|
|
13
|
+
param.value = open ? value : void 0;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export function useCmsOverlayFlag(key, routed, value = "open") {
|
|
18
|
+
const local = ref(false);
|
|
19
|
+
const flag = useCmsRouteFlag(key, value);
|
|
20
|
+
return computed({
|
|
21
|
+
get: () => routed ? flag.value : local.value,
|
|
22
|
+
set: (open) => {
|
|
23
|
+
if (routed) flag.value = open;
|
|
24
|
+
else local.value = open;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function useCmsPageQuery(key) {
|
|
29
|
+
const param = useRouteState(key, { location: "query", history: "replace" });
|
|
30
|
+
return computed({
|
|
31
|
+
get: () => param.value ?? "",
|
|
32
|
+
set: (value) => {
|
|
33
|
+
param.value = value.trim() ? value : void 0;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useState } from "#imports";
|
|
2
|
+
export function useCmsSaveHandoff(entry) {
|
|
3
|
+
const pending = useState("cms:save-handoff", () => ({}));
|
|
4
|
+
const keyOf = (id) => `${entry}/${id}`;
|
|
5
|
+
return {
|
|
6
|
+
stash(id, state) {
|
|
7
|
+
pending.value = { ...pending.value, [keyOf(id)]: state };
|
|
8
|
+
},
|
|
9
|
+
take(id) {
|
|
10
|
+
const key = keyOf(id);
|
|
11
|
+
const state = pending.value[key] ?? null;
|
|
12
|
+
if (state) {
|
|
13
|
+
const { [key]: _taken, ...rest } = pending.value;
|
|
14
|
+
pending.value = rest;
|
|
15
|
+
}
|
|
16
|
+
return state;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
import type { CmsSeoMeta, CmsSeoOverrides, CmsSeoSource, CmsSite } from '../../shared/index.js';
|
|
3
|
+
export type CmsSeoOptions = {
|
|
4
|
+
[K in keyof CmsSeoOverrides]?: MaybeRefOrGetter<CmsSeoOverrides[K]>;
|
|
5
|
+
} & {
|
|
6
|
+
locale?: string;
|
|
7
|
+
};
|
|
8
|
+
export interface CmsSeoResult {
|
|
9
|
+
site: Ref<CmsSite | null>;
|
|
10
|
+
meta: ComputedRef<CmsSeoMeta>;
|
|
11
|
+
}
|
|
12
|
+
export declare function useCmsSeo(item?: MaybeRefOrGetter<CmsSeoSource | null | undefined>, options?: CmsSeoOptions): CmsSeoResult;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
toValue,
|
|
4
|
+
useCmsSite,
|
|
5
|
+
useHead,
|
|
6
|
+
useRequestURL,
|
|
7
|
+
useRoute,
|
|
8
|
+
useRuntimeConfig,
|
|
9
|
+
useSeoMeta
|
|
10
|
+
} from "#imports";
|
|
11
|
+
import { isForwardedHostTrusted, normalizeSiteUrl, resolveSeoMeta } from "../../shared/index.js";
|
|
12
|
+
export function useCmsSeo(item, options = {}) {
|
|
13
|
+
const { locale, ...overrides } = options;
|
|
14
|
+
const config = useRuntimeConfig().public;
|
|
15
|
+
const { i18n } = config.cms ?? {};
|
|
16
|
+
const trusted = isForwardedHostTrusted(
|
|
17
|
+
config.cmsTrustForwardedHost
|
|
18
|
+
);
|
|
19
|
+
const siteUrl = normalizeSiteUrl(config.siteUrl) || useRequestURL({ xForwardedHost: trusted, xForwardedProto: trusted }).origin;
|
|
20
|
+
const route = useRoute();
|
|
21
|
+
const { data: site } = useCmsSite({ locale });
|
|
22
|
+
const meta = computed(
|
|
23
|
+
() => resolveSeoMeta(
|
|
24
|
+
toValue(item),
|
|
25
|
+
site.value,
|
|
26
|
+
{ siteUrl, path: route.path, defaultLocale: i18n?.defaultLocale ?? "en" },
|
|
27
|
+
Object.fromEntries(
|
|
28
|
+
Object.entries(overrides).map(([key, value]) => [key, toValue(value)])
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
);
|
|
32
|
+
const image = () => meta.value.image;
|
|
33
|
+
const article = () => meta.value.type === "article";
|
|
34
|
+
useHead({
|
|
35
|
+
title: () => meta.value.title,
|
|
36
|
+
titleTemplate: null,
|
|
37
|
+
link: () => [
|
|
38
|
+
{ key: "cms-canonical", rel: "canonical", href: meta.value.canonical },
|
|
39
|
+
...meta.value.alternates.map((alternate) => ({
|
|
40
|
+
key: `cms-alternate-${alternate.hreflang}`,
|
|
41
|
+
rel: "alternate",
|
|
42
|
+
hreflang: alternate.hreflang,
|
|
43
|
+
href: alternate.href
|
|
44
|
+
}))
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
useSeoMeta({
|
|
48
|
+
description: () => meta.value.description ?? void 0,
|
|
49
|
+
robots: () => meta.value.robots ?? void 0,
|
|
50
|
+
ogTitle: () => meta.value.pageTitle ?? meta.value.title,
|
|
51
|
+
ogDescription: () => meta.value.description ?? void 0,
|
|
52
|
+
ogUrl: () => meta.value.canonical,
|
|
53
|
+
ogType: () => meta.value.type,
|
|
54
|
+
ogSiteName: () => meta.value.siteName ?? void 0,
|
|
55
|
+
ogImage: () => image()?.url,
|
|
56
|
+
ogImageAlt: () => image()?.alt ?? void 0,
|
|
57
|
+
ogImageWidth: () => image()?.width ?? void 0,
|
|
58
|
+
ogImageHeight: () => image()?.height ?? void 0,
|
|
59
|
+
ogImageType: () => image()?.type ?? void 0,
|
|
60
|
+
articlePublishedTime: () => article() ? meta.value.publishedTime ?? void 0 : void 0,
|
|
61
|
+
articleModifiedTime: () => article() ? meta.value.modifiedTime ?? void 0 : void 0,
|
|
62
|
+
twitterCard: () => image() ? "summary_large_image" : "summary",
|
|
63
|
+
twitterTitle: () => meta.value.pageTitle ?? meta.value.title,
|
|
64
|
+
twitterDescription: () => meta.value.description ?? void 0,
|
|
65
|
+
twitterImage: () => image()?.url,
|
|
66
|
+
twitterImageAlt: () => image()?.alt ?? void 0
|
|
67
|
+
});
|
|
68
|
+
return { site, meta };
|
|
69
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
export interface CmsSettingsFormAction {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
submitting: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function useCmsSettingsFormAction(): Ref<CmsSettingsFormAction | null, CmsSettingsFormAction | null>;
|
|
8
|
+
export declare function useCmsSettingsForm(options: {
|
|
9
|
+
creating?: MaybeRefOrGetter<boolean>;
|
|
10
|
+
label?: MaybeRefOrGetter<string>;
|
|
11
|
+
submitting: Ref<boolean>;
|
|
12
|
+
enabled?: MaybeRefOrGetter<boolean>;
|
|
13
|
+
}): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { onBeforeUnmount, onMounted, toValue, useId, useState, watch } from "#imports";
|
|
2
|
+
export function useCmsSettingsFormAction() {
|
|
3
|
+
return useState("cms-settings-form-action", () => null);
|
|
4
|
+
}
|
|
5
|
+
export function useCmsSettingsForm(options) {
|
|
6
|
+
const id = useId();
|
|
7
|
+
const action = useCmsSettingsFormAction();
|
|
8
|
+
function label() {
|
|
9
|
+
if (options.label !== void 0) return toValue(options.label);
|
|
10
|
+
return toValue(options.creating) ? "Create" : "Save";
|
|
11
|
+
}
|
|
12
|
+
function sync() {
|
|
13
|
+
const enabled = toValue(options.enabled) ?? true;
|
|
14
|
+
if (enabled) {
|
|
15
|
+
action.value = { id, label: label(), submitting: options.submitting.value };
|
|
16
|
+
} else if (action.value?.id === id) {
|
|
17
|
+
action.value = null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
onMounted(() => {
|
|
21
|
+
watch(() => [label(), options.submitting.value, toValue(options.enabled)], sync, {
|
|
22
|
+
immediate: true
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
onBeforeUnmount(() => {
|
|
26
|
+
if (action.value?.id === id) action.value = null;
|
|
27
|
+
});
|
|
28
|
+
return id;
|
|
29
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SettingsModalPage, SettingsModalSection } from '@xleddyl/443-components-vue';
|
|
2
|
+
import type { Component } from 'vue';
|
|
3
|
+
export interface CmsSettingsSlot {
|
|
4
|
+
page?: SettingsModalPage;
|
|
5
|
+
pages: SettingsModalPage[];
|
|
6
|
+
openPage: (page: SettingsModalPage) => Promise<boolean>;
|
|
7
|
+
back: () => Promise<boolean>;
|
|
8
|
+
goTo: (depth: number) => Promise<boolean>;
|
|
9
|
+
}
|
|
10
|
+
type SlotBinding = (slot: CmsSettingsSlot) => Record<string, unknown>;
|
|
11
|
+
export interface CmsSettingsSectionView extends SettingsModalSection {
|
|
12
|
+
component?: Component;
|
|
13
|
+
bind?: SlotBinding;
|
|
14
|
+
actions?: Component;
|
|
15
|
+
bindActions?: SlotBinding;
|
|
16
|
+
tabs?: Component;
|
|
17
|
+
resolvePage?: (id: string, parents: SettingsModalPage[]) => Promise<string | undefined>;
|
|
18
|
+
}
|
|
19
|
+
export declare function useCmsSettingsSections(): {
|
|
20
|
+
navigation: import("vue").ComputedRef<SettingsModalSection[]>;
|
|
21
|
+
views: import("vue").ComputedRef<CmsSettingsSectionView[]>;
|
|
22
|
+
actionViews: import("vue").ComputedRef<CmsSettingsSectionView[]>;
|
|
23
|
+
tabViews: import("vue").ComputedRef<CmsSettingsSectionView[]>;
|
|
24
|
+
resolvePage: (sectionId: string, id: string, parents: SettingsModalPage[]) => Promise<string | undefined> | undefined;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { entryFieldsFor } from "#nuxt-cms";
|
|
2
|
+
import { computed, nextTick } from "#imports";
|
|
3
|
+
import cmsConfig from "#cms-config";
|
|
4
|
+
import { CMS_PRESET_ICON } from "../../shared/presets.js";
|
|
5
|
+
import CmsSettingsEntries from "../components/cms/SettingsEntries.vue";
|
|
6
|
+
import CmsSettingsEntryActions from "../components/cms/SettingsEntryActions.vue";
|
|
7
|
+
import CmsSettingsEntryTabs from "../components/cms/SettingsEntryTabs.vue";
|
|
8
|
+
import CmsSettingsFormAction from "../components/cms/SettingsFormAction.vue";
|
|
9
|
+
import CmsSettingsPresets from "../components/cms/SettingsPresets.vue";
|
|
10
|
+
import CmsSettingsRecordActions from "../components/cms/SettingsRecordActions.vue";
|
|
11
|
+
import CmsSettingsRedirectActions from "../components/cms/SettingsRedirectActions.vue";
|
|
12
|
+
import CmsSettingsRedirects from "../components/cms/SettingsRedirects.vue";
|
|
13
|
+
import CmsSettingsSite from "../components/cms/SettingsSite.vue";
|
|
14
|
+
import CmsSettingsUsers from "../components/cms/SettingsUsers.vue";
|
|
15
|
+
import { cmsIcon } from "../utils/ui.js";
|
|
16
|
+
import { useCmsSettingsEntries } from "./cms-entry-settings.js";
|
|
17
|
+
import { useCmsPermissions } from "./cms-permissions.js";
|
|
18
|
+
import { CMS_NEW_RECORD } from "./cms-route.js";
|
|
19
|
+
import { useCmsPresetStore, useCmsRedirects, useCmsUsers } from "./cms-settings-stores.js";
|
|
20
|
+
const GROUPS = { account: "Account", access: "Access", site: "Site", content: "Content" };
|
|
21
|
+
function pageBinding({ page, openPage, back }) {
|
|
22
|
+
return { page, onOpen: openPage, onBack: back };
|
|
23
|
+
}
|
|
24
|
+
function hasBlockFields() {
|
|
25
|
+
return Object.values(cmsConfig).some(
|
|
26
|
+
(entry) => Object.values(entryFieldsFor(entry)).some((field) => field.type === "blocks")
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
export function useCmsSettingsSections() {
|
|
30
|
+
const { can } = useCmsPermissions();
|
|
31
|
+
const users = useCmsUsers();
|
|
32
|
+
const redirects = useCmsRedirects();
|
|
33
|
+
const presets = useCmsPresetStore();
|
|
34
|
+
const entries = useCmsSettingsEntries();
|
|
35
|
+
const blocks = hasBlockFields();
|
|
36
|
+
function recordSection(section, component, store, options = {}) {
|
|
37
|
+
const creatable = options.creatable ?? true;
|
|
38
|
+
const newLabel = options.newLabel ?? "New";
|
|
39
|
+
return {
|
|
40
|
+
...section,
|
|
41
|
+
component,
|
|
42
|
+
bind: pageBinding,
|
|
43
|
+
actions: options.actions ?? CmsSettingsRecordActions,
|
|
44
|
+
bindActions: ({ page, openPage, back }) => {
|
|
45
|
+
const record = store.find(page?.id);
|
|
46
|
+
return {
|
|
47
|
+
page,
|
|
48
|
+
addLabel: options.addLabel ?? "Add",
|
|
49
|
+
addIcon: options.addIcon,
|
|
50
|
+
newLabel,
|
|
51
|
+
hideAdd: !creatable || !(store.loaded.value && store.items.value.length),
|
|
52
|
+
deletable: !!record && (options.deletable?.(record) ?? true),
|
|
53
|
+
deleteDisabled: !!record && !!options.locked?.(record),
|
|
54
|
+
deleteHint: options.lockHint,
|
|
55
|
+
onOpen: openPage,
|
|
56
|
+
onDelete: async () => {
|
|
57
|
+
if (!record || !await store.remove(record)) return;
|
|
58
|
+
await nextTick();
|
|
59
|
+
void back();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
resolvePage: async (id) => {
|
|
64
|
+
if (id === CMS_NEW_RECORD) return creatable ? newLabel : void 0;
|
|
65
|
+
return store.resolveLabel(id);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const sections = computed(() => [
|
|
70
|
+
{
|
|
71
|
+
id: "account",
|
|
72
|
+
label: "Account",
|
|
73
|
+
icon: cmsIcon("user-circle"),
|
|
74
|
+
description: "Your profile and your password.",
|
|
75
|
+
group: GROUPS.account
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "appearance",
|
|
79
|
+
label: "Appearance",
|
|
80
|
+
icon: cmsIcon("swatch"),
|
|
81
|
+
description: "Choose how the panel looks. System follows your device.",
|
|
82
|
+
group: GROUPS.account
|
|
83
|
+
},
|
|
84
|
+
...can("users.manage") ? [
|
|
85
|
+
recordSection(
|
|
86
|
+
{
|
|
87
|
+
id: "users",
|
|
88
|
+
label: "Users",
|
|
89
|
+
icon: cmsIcon("users"),
|
|
90
|
+
description: "Accounts that can sign in to the panel, and what their role allows.",
|
|
91
|
+
group: GROUPS.access
|
|
92
|
+
},
|
|
93
|
+
CmsSettingsUsers,
|
|
94
|
+
users,
|
|
95
|
+
{
|
|
96
|
+
addLabel: "Add user",
|
|
97
|
+
addIcon: "user-plus",
|
|
98
|
+
newLabel: "New user",
|
|
99
|
+
deletable: users.canManageUser,
|
|
100
|
+
locked: users.isSelf,
|
|
101
|
+
lockHint: "You cannot delete your own account"
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] : [],
|
|
105
|
+
...can("settings.manage") ? [
|
|
106
|
+
{
|
|
107
|
+
id: "site",
|
|
108
|
+
label: "Site",
|
|
109
|
+
icon: cmsIcon("globe-alt"),
|
|
110
|
+
description: "Site name, search engines and sharing.",
|
|
111
|
+
group: GROUPS.site,
|
|
112
|
+
component: CmsSettingsSite,
|
|
113
|
+
actions: CmsSettingsFormAction
|
|
114
|
+
}
|
|
115
|
+
] : [],
|
|
116
|
+
...can("redirects.manage") ? [
|
|
117
|
+
recordSection(
|
|
118
|
+
{
|
|
119
|
+
id: "redirects",
|
|
120
|
+
label: "Redirects",
|
|
121
|
+
icon: cmsIcon("arrow-uturn-right"),
|
|
122
|
+
description: "Send visitors from old paths to new ones.",
|
|
123
|
+
group: GROUPS.site
|
|
124
|
+
},
|
|
125
|
+
CmsSettingsRedirects,
|
|
126
|
+
redirects,
|
|
127
|
+
{
|
|
128
|
+
addLabel: "Add redirect",
|
|
129
|
+
newLabel: "New redirect",
|
|
130
|
+
actions: CmsSettingsRedirectActions
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
] : [],
|
|
134
|
+
...entries.value.length ? [
|
|
135
|
+
{
|
|
136
|
+
id: "layout",
|
|
137
|
+
label: "Layout",
|
|
138
|
+
icon: cmsIcon("view-columns"),
|
|
139
|
+
description: "Table columns and form layout of each content type.",
|
|
140
|
+
group: GROUPS.content,
|
|
141
|
+
component: CmsSettingsEntries,
|
|
142
|
+
bind: pageBinding,
|
|
143
|
+
actions: CmsSettingsEntryActions,
|
|
144
|
+
bindActions: ({ page }) => ({ page }),
|
|
145
|
+
tabs: CmsSettingsEntryTabs,
|
|
146
|
+
resolvePage: async (id) => entries.value.find((entry) => entry.name === id)?.label
|
|
147
|
+
}
|
|
148
|
+
] : [],
|
|
149
|
+
...blocks && can("settings.manage") ? [
|
|
150
|
+
recordSection(
|
|
151
|
+
{
|
|
152
|
+
id: "presets",
|
|
153
|
+
label: "Block presets",
|
|
154
|
+
icon: cmsIcon(CMS_PRESET_ICON),
|
|
155
|
+
description: "Saved copies of blocks, inserted from the block picker.",
|
|
156
|
+
group: GROUPS.content
|
|
157
|
+
},
|
|
158
|
+
CmsSettingsPresets,
|
|
159
|
+
presets,
|
|
160
|
+
{ creatable: false }
|
|
161
|
+
)
|
|
162
|
+
] : []
|
|
163
|
+
]);
|
|
164
|
+
const views = computed(() => sections.value.filter((section) => section.component));
|
|
165
|
+
const actionViews = computed(() => sections.value.filter((section) => section.actions));
|
|
166
|
+
const tabViews = computed(() => sections.value.filter((section) => section.tabs));
|
|
167
|
+
const navigation = computed(
|
|
168
|
+
() => sections.value.map(({ id, label, icon, description, group }) => ({
|
|
169
|
+
id,
|
|
170
|
+
label,
|
|
171
|
+
icon,
|
|
172
|
+
description,
|
|
173
|
+
group
|
|
174
|
+
}))
|
|
175
|
+
);
|
|
176
|
+
function resolvePage(sectionId, id, parents) {
|
|
177
|
+
const section = sections.value.find((item) => item.id === sectionId);
|
|
178
|
+
return section?.resolvePage ? section.resolvePage(id, parents) : void 0;
|
|
179
|
+
}
|
|
180
|
+
return { navigation, views, actionViews, tabViews, resolvePage };
|
|
181
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CmsAccount, CmsRedirect } from '#nuxt-cms';
|
|
2
|
+
import type { CmsBlockPreset } from '../../shared/presets.js';
|
|
3
|
+
export declare function useCmsUsers(): {
|
|
4
|
+
canManageUser: (account: CmsAccount) => boolean;
|
|
5
|
+
isSelf: (account: CmsAccount) => boolean;
|
|
6
|
+
items: import("vue").Ref<CmsAccount[], CmsAccount[]>;
|
|
7
|
+
sorted: import("vue").ComputedRef<CmsAccount[]>;
|
|
8
|
+
loaded: import("vue").Ref<boolean, boolean>;
|
|
9
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
10
|
+
load: () => Promise<void>;
|
|
11
|
+
ensureLoaded: () => Promise<void>;
|
|
12
|
+
find: (id: string | null | undefined) => CmsAccount | undefined;
|
|
13
|
+
upsert: (record: CmsAccount) => void;
|
|
14
|
+
removeLocal: (id: string) => void;
|
|
15
|
+
resolveLabel: (id: string) => Promise<string | undefined>;
|
|
16
|
+
remove: (record: CmsAccount) => Promise<boolean>;
|
|
17
|
+
label: (item: CmsAccount) => string;
|
|
18
|
+
};
|
|
19
|
+
export declare function useCmsRedirects(): {
|
|
20
|
+
importing: import("vue").Ref<boolean, boolean>;
|
|
21
|
+
exportCsv: () => void;
|
|
22
|
+
exportJson: () => void;
|
|
23
|
+
importFile: (file: File) => Promise<void>;
|
|
24
|
+
items: import("vue").Ref<CmsRedirect[], CmsRedirect[]>;
|
|
25
|
+
sorted: import("vue").ComputedRef<CmsRedirect[]>;
|
|
26
|
+
loaded: import("vue").Ref<boolean, boolean>;
|
|
27
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
28
|
+
load: () => Promise<void>;
|
|
29
|
+
ensureLoaded: () => Promise<void>;
|
|
30
|
+
find: (id: string | null | undefined) => CmsRedirect | undefined;
|
|
31
|
+
upsert: (record: CmsRedirect) => void;
|
|
32
|
+
removeLocal: (id: string) => void;
|
|
33
|
+
resolveLabel: (id: string) => Promise<string | undefined>;
|
|
34
|
+
remove: (record: CmsRedirect) => Promise<boolean>;
|
|
35
|
+
label: (item: CmsRedirect) => string;
|
|
36
|
+
};
|
|
37
|
+
export declare function presetMeta(preset: CmsBlockPreset): string;
|
|
38
|
+
export declare function useCmsPresetStore(): {
|
|
39
|
+
remove: (preset: CmsBlockPreset) => Promise<boolean>;
|
|
40
|
+
saved: (preset: CmsBlockPreset) => void;
|
|
41
|
+
items: import("vue").Ref<CmsBlockPreset[], CmsBlockPreset[]>;
|
|
42
|
+
sorted: import("vue").ComputedRef<CmsBlockPreset[]>;
|
|
43
|
+
loaded: import("vue").Ref<boolean, boolean>;
|
|
44
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
45
|
+
load: () => Promise<void>;
|
|
46
|
+
ensureLoaded: () => Promise<void>;
|
|
47
|
+
find: (id: string | null | undefined) => CmsBlockPreset | undefined;
|
|
48
|
+
upsert: (record: CmsBlockPreset) => void;
|
|
49
|
+
removeLocal: (id: string) => void;
|
|
50
|
+
resolveLabel: (id: string) => Promise<string | undefined>;
|
|
51
|
+
label: (item: CmsBlockPreset) => string;
|
|
52
|
+
};
|