@xleddyl/nuxt-cms 0.9.4 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/module.d.mts +20 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1037 -148
- package/dist/runtime/app/blocks/CmsBlocks.d.vue.ts +1 -1
- package/dist/runtime/app/blocks/CmsBlocks.vue +57 -9
- package/dist/runtime/app/blocks/CmsBlocks.vue.d.ts +1 -1
- package/dist/runtime/app/blocks/CmsField.d.ts +24 -0
- package/dist/runtime/app/blocks/CmsField.js +16 -0
- package/dist/runtime/app/blocks/node.d.ts +37 -0
- package/dist/runtime/app/blocks/node.js +17 -0
- package/dist/runtime/app/blocks/resolve.d.ts +18 -0
- package/dist/runtime/app/blocks/resolve.js +34 -0
- package/dist/runtime/app/components/cms/BlockPicker.d.vue.ts +22 -0
- package/dist/runtime/app/components/cms/BlockPicker.vue +87 -0
- package/dist/runtime/app/components/cms/BlockPicker.vue.d.ts +22 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.d.vue.ts +38 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.vue +44 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.vue.d.ts +38 -0
- package/dist/runtime/app/components/cms/BlockTree.d.vue.ts +29 -0
- package/dist/runtime/app/components/cms/BlockTree.vue +322 -0
- package/dist/runtime/app/components/cms/BlockTree.vue.d.ts +29 -0
- package/dist/runtime/app/components/cms/BlocksField.vue +569 -218
- package/dist/runtime/app/components/cms/BrandMark.vue +7 -13
- package/dist/runtime/app/components/cms/ConfirmGroups.vue +15 -13
- package/dist/runtime/app/components/cms/{BlockPalette.vue.d.ts → EditorHistory.d.vue.ts} +6 -5
- package/dist/runtime/app/components/cms/EditorHistory.vue +34 -0
- package/dist/runtime/app/components/cms/{BlockPalette.d.vue.ts → EditorHistory.vue.d.ts} +6 -5
- package/dist/runtime/app/components/cms/EntryDrawer.d.vue.ts +11 -5
- package/dist/runtime/app/components/cms/EntryDrawer.vue +183 -152
- package/dist/runtime/app/components/cms/EntryDrawer.vue.d.ts +11 -5
- package/dist/runtime/app/components/cms/EntryForm.d.vue.ts +16 -4
- package/dist/runtime/app/components/cms/EntryForm.vue +106 -146
- package/dist/runtime/app/components/cms/EntryForm.vue.d.ts +16 -4
- package/dist/runtime/app/components/cms/FieldInput.vue +10 -2
- package/dist/runtime/app/components/cms/FormSections.d.vue.ts +22 -0
- package/dist/runtime/app/components/cms/FormSections.vue +71 -0
- package/dist/runtime/app/components/cms/FormSections.vue.d.ts +22 -0
- package/dist/runtime/app/components/cms/ImportModal.vue +46 -58
- package/dist/runtime/app/components/cms/LinkField.d.vue.ts +16 -0
- package/dist/runtime/app/components/cms/LinkField.vue +250 -0
- package/dist/runtime/app/components/cms/LinkField.vue.d.ts +16 -0
- package/dist/runtime/app/components/cms/ListFilters.vue +10 -12
- package/dist/runtime/app/components/cms/LocaleSwitch.d.vue.ts +2 -1
- package/dist/runtime/app/components/cms/LocaleSwitch.vue +29 -5
- package/dist/runtime/app/components/cms/LocaleSwitch.vue.d.ts +2 -1
- package/dist/runtime/app/components/cms/MediaDetail.d.vue.ts +2 -0
- package/dist/runtime/app/components/cms/MediaDetail.vue +112 -83
- package/dist/runtime/app/components/cms/MediaDetail.vue.d.ts +2 -0
- package/dist/runtime/app/components/cms/MediaField.vue +35 -25
- package/dist/runtime/app/components/cms/MediaFolderPicker.vue +26 -71
- package/dist/runtime/app/components/cms/MediaGallery.d.vue.ts +1 -0
- package/dist/runtime/app/components/cms/MediaGallery.vue +442 -419
- package/dist/runtime/app/components/cms/MediaGallery.vue.d.ts +1 -0
- package/dist/runtime/app/components/cms/MediaThumb.vue +9 -25
- package/dist/runtime/app/components/cms/MediaUpload.vue +1 -1
- package/dist/runtime/app/components/cms/{BlockOutline.d.vue.ts → NestedBlockList.d.vue.ts} +5 -5
- package/dist/runtime/app/components/cms/NestedBlockList.vue +87 -0
- package/dist/runtime/app/components/cms/{BlockOutline.vue.d.ts → NestedBlockList.vue.d.ts} +5 -5
- package/dist/runtime/app/components/cms/PoweredBy.vue +12 -5
- package/dist/runtime/app/components/cms/PresetModal.d.vue.ts +18 -0
- package/dist/runtime/app/components/cms/PresetModal.vue +70 -0
- package/dist/runtime/app/components/cms/PresetModal.vue.d.ts +18 -0
- package/dist/runtime/app/components/cms/RelationField.vue +2 -8
- package/dist/runtime/app/components/cms/SettingsAccount.vue +60 -71
- package/dist/runtime/app/components/cms/SettingsColumns.vue +47 -69
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.vue +21 -0
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntries.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntries.vue +50 -0
- package/dist/runtime/app/components/cms/SettingsEntries.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntry.d.vue.ts +1 -10
- package/dist/runtime/app/components/cms/SettingsEntry.vue +11 -95
- package/dist/runtime/app/components/cms/SettingsEntry.vue.d.ts +1 -10
- package/dist/runtime/app/components/cms/SettingsEntryActions.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryActions.vue +42 -0
- package/dist/runtime/app/components/cms/SettingsEntryActions.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.vue +21 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.vue +17 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsLayout.vue +18 -14
- package/dist/runtime/app/components/cms/SettingsPresetForm.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsPresetForm.vue +60 -0
- package/dist/runtime/app/components/cms/SettingsPresetForm.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsPresets.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsPresets.vue +65 -0
- package/dist/runtime/app/components/cms/SettingsPresets.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.d.vue.ts +32 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.vue +45 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.vue.d.ts +32 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.vue +59 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.vue +77 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.vue +117 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.d.vue.ts +17 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.vue +43 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.vue.d.ts +17 -0
- package/dist/runtime/app/components/cms/SettingsSite.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsSite.vue +140 -0
- package/dist/runtime/app/components/cms/SettingsSite.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.d.vue.ts +8 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.vue +82 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.vue.d.ts +8 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.vue +179 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsUsers.d.vue.ts +9 -6
- package/dist/runtime/app/components/cms/SettingsUsers.vue +88 -234
- package/dist/runtime/app/components/cms/SettingsUsers.vue.d.ts +9 -6
- package/dist/runtime/app/components/cms/SharePreview.d.vue.ts +18 -0
- package/dist/runtime/app/components/cms/SharePreview.vue +219 -0
- package/dist/runtime/app/components/cms/SharePreview.vue.d.ts +18 -0
- package/dist/runtime/app/components/cms/SlugField.vue +5 -3
- package/dist/runtime/app/components/cms/StatusBadge.vue +9 -8
- package/dist/runtime/app/components/cms/TranslationBadges.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/TranslationBadges.vue +45 -0
- package/dist/runtime/app/components/cms/TranslationBadges.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/TranslationMenu.d.vue.ts +17 -0
- package/dist/runtime/app/components/cms/TranslationMenu.vue +28 -0
- package/dist/runtime/app/components/cms/TranslationMenu.vue.d.ts +17 -0
- package/dist/runtime/app/components/cms/VisualEditor.d.vue.ts +22 -4
- package/dist/runtime/app/components/cms/VisualEditor.vue +1152 -335
- package/dist/runtime/app/components/cms/VisualEditor.vue.d.ts +22 -4
- package/dist/runtime/app/components/cms/WelcomeModal.vue +32 -50
- package/dist/runtime/app/composables/cms-clipboard.d.ts +8 -0
- package/dist/runtime/app/composables/cms-clipboard.js +38 -0
- package/dist/runtime/app/composables/cms-confirm.d.ts +6 -8
- package/dist/runtime/app/composables/cms-confirm.js +5 -7
- package/dist/runtime/app/composables/cms-entry-disabled.d.ts +5 -1
- package/dist/runtime/app/composables/cms-entry-disabled.js +7 -0
- package/dist/runtime/app/composables/cms-entry-form.d.ts +15 -0
- package/dist/runtime/app/composables/cms-entry-form.js +40 -0
- package/dist/runtime/app/composables/cms-entry-settings.d.ts +30 -0
- package/dist/runtime/app/composables/cms-entry-settings.js +122 -0
- package/dist/runtime/app/composables/cms-entry.d.ts +5 -1
- package/dist/runtime/app/composables/cms-entry.js +36 -11
- package/dist/runtime/app/composables/cms-history.d.ts +10 -0
- package/dist/runtime/app/composables/cms-history.js +24 -0
- package/dist/runtime/app/composables/cms-link-targets.d.ts +10 -0
- package/dist/runtime/app/composables/cms-link-targets.js +40 -0
- package/dist/runtime/app/composables/cms-link-usage.d.ts +1 -0
- package/dist/runtime/app/composables/cms-link-usage.js +45 -0
- package/dist/runtime/app/composables/cms-media-library.d.ts +19 -9
- package/dist/runtime/app/composables/cms-media-library.js +31 -13
- package/dist/runtime/app/composables/cms-media-uploader.js +6 -20
- package/dist/runtime/app/composables/cms-permissions.d.ts +18 -0
- package/dist/runtime/app/composables/cms-permissions.js +54 -0
- package/dist/runtime/app/composables/cms-presets.d.ts +11 -0
- package/dist/runtime/app/composables/cms-presets.js +40 -0
- package/dist/runtime/app/composables/cms-preview-mode.d.ts +4 -0
- package/dist/runtime/app/composables/cms-preview-mode.js +8 -0
- package/dist/runtime/app/composables/cms-query.d.ts +3 -0
- package/dist/runtime/app/composables/cms-query.js +45 -20
- package/dist/runtime/app/composables/cms-record-list.d.ts +31 -0
- package/dist/runtime/app/composables/cms-record-list.js +75 -0
- package/dist/runtime/app/composables/cms-route.d.ts +6 -0
- package/dist/runtime/app/composables/cms-route.js +36 -0
- package/dist/runtime/app/composables/cms-runtime.d.ts +1 -0
- package/dist/runtime/app/composables/cms-save-handoff.d.ts +4 -0
- package/dist/runtime/app/composables/cms-save-handoff.js +19 -0
- package/dist/runtime/app/composables/cms-seo.d.ts +12 -0
- package/dist/runtime/app/composables/cms-seo.js +69 -0
- package/dist/runtime/app/composables/cms-settings-form.d.ts +13 -0
- package/dist/runtime/app/composables/cms-settings-form.js +29 -0
- package/dist/runtime/app/composables/cms-settings-sections.d.ts +26 -0
- package/dist/runtime/app/composables/cms-settings-sections.js +181 -0
- package/dist/runtime/app/composables/cms-settings-stores.d.ts +52 -0
- package/dist/runtime/app/composables/cms-settings-stores.js +156 -0
- package/dist/runtime/app/composables/cms-settings.d.ts +3 -3
- package/dist/runtime/app/composables/cms-settings.js +14 -8
- package/dist/runtime/app/composables/cms-site-disabled.d.ts +7 -0
- package/dist/runtime/app/composables/cms-site-disabled.js +8 -0
- package/dist/runtime/app/composables/cms-site.d.ts +7 -0
- package/dist/runtime/app/composables/cms-site.js +22 -0
- package/dist/runtime/app/composables/cms-toast.d.ts +2 -8
- package/dist/runtime/app/composables/cms-toast.js +3 -9
- package/dist/runtime/app/composables/cms-translation-actions.d.ts +15 -0
- package/dist/runtime/app/composables/cms-translation-actions.js +108 -0
- package/dist/runtime/app/css-url.d.ts +4 -0
- package/dist/runtime/app/image/CmsImage.d.vue.ts +89 -0
- package/dist/runtime/app/image/CmsImage.vue +91 -0
- package/dist/runtime/app/image/CmsImage.vue.d.ts +89 -0
- package/dist/runtime/app/layouts/cms-admin.d.vue.ts +2 -2
- package/dist/runtime/app/layouts/cms-admin.vue +98 -76
- package/dist/runtime/app/layouts/cms-admin.vue.d.ts +2 -2
- package/dist/runtime/app/layouts/cms-editor.vue +7 -2
- package/dist/runtime/app/links/CmsLink.d.vue.ts +18 -0
- package/dist/runtime/app/links/CmsLink.vue +18 -0
- package/dist/runtime/app/links/CmsLink.vue.d.ts +18 -0
- package/dist/runtime/app/middleware/cms-auth.js +13 -1
- package/dist/runtime/app/pages/admin-collection.vue +473 -297
- package/dist/runtime/app/pages/admin-content.vue +190 -53
- package/dist/runtime/app/pages/admin-entry.vue +79 -75
- package/dist/runtime/app/pages/admin-index.vue +18 -5
- package/dist/runtime/app/pages/admin-login.vue +1 -1
- package/dist/runtime/app/pages/admin-logout.vue +1 -1
- package/dist/runtime/app/pages/admin-media.vue +3 -3
- package/dist/runtime/app/pages/admin-preview.vue +112 -24
- package/dist/runtime/app/plugins/cms-field.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-field.js +8 -0
- package/dist/runtime/app/plugins/cms-preview-banner.client.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-preview-banner.client.js +19 -0
- package/dist/runtime/app/plugins/cms-preview.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-preview.js +27 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.d.vue.ts +7 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.vue +63 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.vue.d.ts +7 -0
- package/dist/runtime/app/preview/PreviewOverlay.d.vue.ts +17 -3
- package/dist/runtime/app/preview/PreviewOverlay.vue +629 -166
- package/dist/runtime/app/preview/PreviewOverlay.vue.d.ts +17 -3
- package/dist/runtime/app/preview/field-marker.d.ts +12 -0
- package/dist/runtime/app/preview/field-marker.js +20 -0
- package/dist/runtime/app/preview/inline-text.d.ts +15 -0
- package/dist/runtime/app/preview/inline-text.js +158 -0
- package/dist/runtime/app/utils/block-editor.d.ts +22 -0
- package/dist/runtime/app/utils/block-editor.js +12 -0
- package/dist/runtime/app/utils/keyboard.d.ts +6 -0
- package/dist/runtime/app/utils/keyboard.js +52 -0
- package/dist/runtime/app/utils/redirects.d.ts +6 -0
- package/dist/runtime/app/utils/redirects.js +7 -0
- package/dist/runtime/app/utils/ui.d.ts +8 -0
- package/dist/runtime/app/utils/ui.js +15 -1
- package/dist/runtime/app/utils/users.d.ts +15 -0
- package/dist/runtime/app/utils/users.js +14 -0
- package/dist/runtime/assets/cms.css +1 -1
- package/dist/runtime/generate.js +16 -2
- package/dist/runtime/server/api/collection-export.get.js +3 -2
- package/dist/runtime/server/api/collection-import.post.js +39 -11
- package/dist/runtime/server/api/collection.get.js +27 -9
- package/dist/runtime/server/api/collection.post.js +28 -11
- package/dist/runtime/server/api/collection.put.js +35 -13
- package/dist/runtime/server/api/item.delete.js +19 -7
- package/dist/runtime/server/api/item.get.js +3 -2
- package/dist/runtime/server/api/item.put.js +52 -18
- package/dist/runtime/server/api/link-usage.post.d.ts +5 -0
- package/dist/runtime/server/api/link-usage.post.js +21 -0
- package/dist/runtime/server/api/media-delete.post.js +4 -2
- package/dist/runtime/server/api/media-download.get.js +2 -2
- package/dist/runtime/server/api/media-folder.delete.js +8 -2
- package/dist/runtime/server/api/media-folder.patch.js +10 -2
- package/dist/runtime/server/api/media-folder.post.js +4 -2
- package/dist/runtime/server/api/media-move.post.js +7 -4
- package/dist/runtime/server/api/media-presign.post.js +2 -2
- package/dist/runtime/server/api/media-upload.put.js +2 -2
- package/dist/runtime/server/api/media-usage.post.d.ts +2 -4
- package/dist/runtime/server/api/media-usage.post.js +13 -9
- package/dist/runtime/server/api/media.delete.js +4 -2
- package/dist/runtime/server/api/media.get.js +22 -7
- package/dist/runtime/server/api/media.post.js +4 -2
- package/dist/runtime/server/api/media.put.js +33 -16
- package/dist/runtime/server/api/preset.delete.d.ts +4 -0
- package/dist/runtime/server/api/preset.delete.js +9 -0
- package/dist/runtime/server/api/preset.put.d.ts +3 -0
- package/dist/runtime/server/api/preset.put.js +23 -0
- package/dist/runtime/server/api/presets-field.get.d.ts +3 -0
- package/dist/runtime/server/api/presets-field.get.js +13 -0
- package/dist/runtime/server/api/presets-field.post.d.ts +3 -0
- package/dist/runtime/server/api/presets-field.post.js +36 -0
- package/dist/runtime/server/api/presets.get.d.ts +3 -0
- package/dist/runtime/server/api/presets.get.js +7 -0
- package/dist/runtime/server/api/preview-link.delete.d.ts +4 -0
- package/dist/runtime/server/api/preview-link.delete.js +15 -0
- package/dist/runtime/server/api/preview-links.get.d.ts +3 -0
- package/dist/runtime/server/api/preview-links.get.js +10 -0
- package/dist/runtime/server/api/preview-links.post.d.ts +3 -0
- package/dist/runtime/server/api/preview-links.post.js +17 -0
- package/dist/runtime/server/api/preview.get.d.ts +3 -0
- package/dist/runtime/server/api/preview.get.js +7 -0
- package/dist/runtime/server/api/redirect.delete.d.ts +4 -0
- package/dist/runtime/server/api/redirect.delete.js +10 -0
- package/dist/runtime/server/api/redirect.put.d.ts +3 -0
- package/dist/runtime/server/api/redirect.put.js +8 -0
- package/dist/runtime/server/api/redirects-import.post.d.ts +3 -0
- package/dist/runtime/server/api/redirects-import.post.js +13 -0
- package/dist/runtime/server/api/redirects.get.d.ts +3 -0
- package/dist/runtime/server/api/redirects.get.js +7 -0
- package/dist/runtime/server/api/redirects.post.d.ts +3 -0
- package/dist/runtime/server/api/redirects.post.js +7 -0
- package/dist/runtime/server/api/search.get.js +8 -3
- package/dist/runtime/server/api/settings.delete.js +2 -2
- package/dist/runtime/server/api/settings.get.js +4 -2
- package/dist/runtime/server/api/settings.put.js +2 -2
- package/dist/runtime/server/api/site.get.d.ts +3 -0
- package/dist/runtime/server/api/site.get.js +7 -0
- package/dist/runtime/server/api/site.put.d.ts +3 -0
- package/dist/runtime/server/api/site.put.js +16 -0
- package/dist/runtime/server/api/tags.get.js +3 -2
- package/dist/runtime/server/api/user.delete.js +8 -2
- package/dist/runtime/server/api/user.put.js +14 -4
- package/dist/runtime/server/api/users.get.js +2 -2
- package/dist/runtime/server/api/users.post.js +8 -4
- package/dist/runtime/server/middleware/hidden-site.d.ts +2 -0
- package/dist/runtime/server/middleware/hidden-site.js +8 -0
- package/dist/runtime/server/middleware/preview-links.d.ts +2 -0
- package/dist/runtime/server/middleware/preview-links.js +6 -0
- package/dist/runtime/server/middleware/redirects.d.ts +2 -0
- package/dist/runtime/server/middleware/redirects.js +18 -0
- package/dist/runtime/server/plugins/session-validate.js +4 -1
- package/dist/runtime/server/plugins/webhooks.d.ts +3 -0
- package/dist/runtime/server/plugins/webhooks.js +27 -0
- package/dist/runtime/server/routes/graphql.js +5 -3
- package/dist/runtime/server/routes/robots.d.ts +2 -0
- package/dist/runtime/server/routes/robots.js +16 -0
- package/dist/runtime/server/routes/sitemap.d.ts +2 -0
- package/dist/runtime/server/routes/sitemap.js +67 -0
- package/dist/runtime/server/utils/cached-value.d.ts +5 -0
- package/dist/runtime/server/utils/cached-value.js +24 -0
- package/dist/runtime/server/utils/content-routes.d.ts +5 -0
- package/dist/runtime/server/utils/content-routes.js +29 -0
- package/dist/runtime/server/utils/field-rules.d.ts +19 -0
- package/dist/runtime/server/utils/field-rules.js +72 -0
- package/dist/runtime/server/utils/graphql.d.ts +3 -1
- package/dist/runtime/server/utils/graphql.js +143 -28
- package/dist/runtime/server/utils/hooks.d.ts +14 -0
- package/dist/runtime/server/utils/hooks.js +71 -0
- package/dist/runtime/server/utils/import.d.ts +7 -2
- package/dist/runtime/server/utils/import.js +108 -14
- package/dist/runtime/server/utils/link-usage.d.ts +4 -0
- package/dist/runtime/server/utils/link-usage.js +28 -0
- package/dist/runtime/server/utils/media-references.d.ts +6 -1
- package/dist/runtime/server/utils/media-references.js +49 -20
- package/dist/runtime/server/utils/media-usage.d.ts +2 -0
- package/dist/runtime/server/utils/media-usage.js +5 -3
- package/dist/runtime/server/utils/page-rows.d.ts +2 -0
- package/dist/runtime/server/utils/page-rows.js +42 -29
- package/dist/runtime/server/utils/permissions.d.ts +14 -0
- package/dist/runtime/server/utils/permissions.js +43 -0
- package/dist/runtime/server/utils/presets.d.ts +18 -0
- package/dist/runtime/server/utils/presets.js +68 -0
- package/dist/runtime/server/utils/preview-links.d.ts +207 -0
- package/dist/runtime/server/utils/preview-links.js +161 -0
- package/dist/runtime/server/utils/redirects.d.ts +31 -0
- package/dist/runtime/server/utils/redirects.js +240 -0
- package/dist/runtime/server/utils/registry.js +4 -1
- package/dist/runtime/server/utils/relations.d.ts +8 -0
- package/dist/runtime/server/utils/relations.js +25 -6
- package/dist/runtime/server/utils/require-admin.d.ts +0 -1
- package/dist/runtime/server/utils/require-admin.js +4 -8
- package/dist/runtime/server/utils/search.d.ts +1 -0
- package/dist/runtime/server/utils/search.js +44 -19
- package/dist/runtime/server/utils/site.d.ts +23 -0
- package/dist/runtime/server/utils/site.js +79 -0
- package/dist/runtime/server/utils/sitemap.d.ts +12 -0
- package/dist/runtime/server/utils/sitemap.js +109 -0
- package/dist/runtime/server/utils/user-management.d.ts +4 -0
- package/dist/runtime/server/utils/user-management.js +20 -0
- package/dist/runtime/server/utils/users.d.ts +1 -1
- package/dist/runtime/server/utils/users.js +1 -1
- package/dist/runtime/server/utils/visibility.d.ts +1 -0
- package/dist/runtime/server/utils/visibility.js +6 -1
- package/dist/runtime/server/utils/webhooks.d.ts +24 -0
- package/dist/runtime/server/utils/webhooks.js +90 -0
- package/dist/runtime/shared/block-paths.d.ts +66 -0
- package/dist/runtime/shared/block-paths.js +310 -0
- package/dist/runtime/shared/block-picker.d.ts +18 -0
- package/dist/runtime/shared/block-picker.js +31 -0
- package/dist/runtime/shared/block-signature.d.ts +4 -0
- package/dist/runtime/shared/block-signature.js +46 -0
- package/dist/runtime/shared/clipboard.d.ts +31 -0
- package/dist/runtime/shared/clipboard.js +206 -0
- package/dist/runtime/shared/conditions.d.ts +36 -0
- package/dist/runtime/shared/conditions.js +100 -0
- package/dist/runtime/shared/content-routes.d.ts +42 -0
- package/dist/runtime/shared/content-routes.js +237 -0
- package/dist/runtime/shared/duplicate.js +2 -1
- package/dist/runtime/shared/editor-layout.d.ts +18 -0
- package/dist/runtime/shared/editor-layout.js +9 -0
- package/dist/runtime/shared/field-options.d.ts +21 -0
- package/dist/runtime/shared/field-options.js +90 -0
- package/dist/runtime/shared/graphql-sdl.d.ts +1 -0
- package/dist/runtime/shared/graphql-sdl.js +50 -26
- package/dist/runtime/shared/history.d.ts +27 -0
- package/dist/runtime/shared/history.js +123 -0
- package/dist/runtime/shared/hooks.d.ts +45 -0
- package/dist/runtime/shared/hooks.js +28 -0
- package/dist/runtime/shared/index.d.ts +90 -21
- package/dist/runtime/shared/index.js +121 -37
- package/dist/runtime/shared/inline-text.d.ts +38 -0
- package/dist/runtime/shared/inline-text.js +85 -0
- package/dist/runtime/shared/layout.d.ts +2 -1
- package/dist/runtime/shared/layout.js +3 -0
- package/dist/runtime/shared/links.d.ts +48 -0
- package/dist/runtime/shared/links.js +155 -0
- package/dist/runtime/shared/list-filters.d.ts +2 -0
- package/dist/runtime/shared/list-filters.js +2 -0
- package/dist/runtime/shared/media-focal.d.ts +30 -0
- package/dist/runtime/shared/media-focal.js +52 -0
- package/dist/runtime/shared/migrations-dir.d.ts +14 -0
- package/dist/runtime/shared/migrations-dir.js +48 -2
- package/dist/runtime/shared/presets.d.ts +67 -0
- package/dist/runtime/shared/presets.js +127 -0
- package/dist/runtime/shared/preview-links.d.ts +64 -0
- package/dist/runtime/shared/preview-links.js +54 -0
- package/dist/runtime/shared/preview.d.ts +124 -21
- package/dist/runtime/shared/preview.js +419 -81
- package/dist/runtime/shared/redirects.d.ts +75 -0
- package/dist/runtime/shared/redirects.js +230 -0
- package/dist/runtime/shared/roles.d.ts +57 -0
- package/dist/runtime/shared/roles.js +293 -0
- package/dist/runtime/shared/save-state.d.ts +8 -0
- package/dist/runtime/shared/save-state.js +15 -0
- package/dist/runtime/shared/search.d.ts +16 -1
- package/dist/runtime/shared/search.js +41 -7
- package/dist/runtime/shared/seo.d.ts +167 -0
- package/dist/runtime/shared/seo.js +335 -0
- package/dist/runtime/shared/transfer.js +2 -1
- package/dist/runtime/shared/translations.d.ts +29 -0
- package/dist/runtime/shared/translations.js +123 -0
- package/dist/runtime/shared/users.d.ts +1 -1
- package/dist/runtime/shared/validation.d.ts +23 -1
- package/dist/runtime/shared/validation.js +214 -64
- package/dist/runtime/webhooks.d.ts +33 -0
- package/dist/runtime/webhooks.js +57 -0
- package/dist/types.d.mts +5 -1
- package/package.json +6 -2
- package/dist/runtime/app/components/cms/BlockOutline.vue +0 -88
- package/dist/runtime/app/components/cms/BlockPalette.vue +0 -31
- package/dist/runtime/app/components/cms/SettingsModal.d.vue.ts +0 -12
- package/dist/runtime/app/components/cms/SettingsModal.vue +0 -126
- package/dist/runtime/app/components/cms/SettingsModal.vue.d.ts +0 -12
- package/dist/runtime/app/composables/cms-field-focus.d.ts +0 -4
- package/dist/runtime/app/composables/cms-field-focus.js +0 -20
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { FieldConfig } from '#nuxt-cms';
|
|
2
|
+
import type { BreadcrumbItem } from '@xleddyl/443-components-vue';
|
|
2
3
|
import type { CmsSearchFocus } from '../../../shared/search.js';
|
|
4
|
+
import type { CmsResponseIssue } from '../../utils/ui.js';
|
|
3
5
|
type __VLS_Props = {
|
|
4
6
|
entryName: string;
|
|
5
7
|
fieldKey: string;
|
|
@@ -7,26 +9,42 @@ type __VLS_Props = {
|
|
|
7
9
|
title: string;
|
|
8
10
|
content?: boolean;
|
|
9
11
|
focus?: CmsSearchFocus | null;
|
|
12
|
+
locked?: string[];
|
|
13
|
+
readonly?: boolean;
|
|
14
|
+
tabQuery?: string;
|
|
15
|
+
trail?: BreadcrumbItem[];
|
|
10
16
|
};
|
|
11
17
|
declare function validate(): boolean;
|
|
18
|
+
declare function setIssues(issues: CmsResponseIssue[]): void;
|
|
19
|
+
declare function applyChange(values: Record<string, unknown>): void;
|
|
12
20
|
type __VLS_ModelProps = {
|
|
13
21
|
'state': Record<string, unknown>;
|
|
14
22
|
};
|
|
15
23
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
16
|
-
declare var
|
|
24
|
+
declare var __VLS_10: {}, __VLS_19: {}, __VLS_49: {
|
|
25
|
+
compact: boolean;
|
|
26
|
+
}, __VLS_222: {
|
|
27
|
+
locale: string;
|
|
28
|
+
};
|
|
17
29
|
type __VLS_Slots = {} & {
|
|
18
|
-
start?: (props: typeof
|
|
30
|
+
start?: (props: typeof __VLS_10) => any;
|
|
31
|
+
} & {
|
|
32
|
+
status?: (props: typeof __VLS_19) => any;
|
|
19
33
|
} & {
|
|
20
|
-
|
|
34
|
+
actions?: (props: typeof __VLS_49) => any;
|
|
21
35
|
} & {
|
|
22
|
-
|
|
36
|
+
'content-start'?: (props: typeof __VLS_222) => any;
|
|
23
37
|
};
|
|
24
38
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
25
39
|
validate: typeof validate;
|
|
40
|
+
setIssues: typeof setIssues;
|
|
41
|
+
applyChange: typeof applyChange;
|
|
26
42
|
locale: import("vue").Ref<string, string>;
|
|
27
43
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
44
|
+
save: () => any;
|
|
28
45
|
"update:state": (value: Record<string, unknown>) => any;
|
|
29
46
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
47
|
+
onSave?: (() => any) | undefined;
|
|
30
48
|
"onUpdate:state"?: ((value: Record<string, unknown>) => any) | undefined;
|
|
31
49
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
32
50
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -1,40 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<KFormModal
|
|
3
3
|
:open="open"
|
|
4
4
|
size="sm"
|
|
5
5
|
:title="`Welcome to ${cmsBrand.title}`"
|
|
6
|
+
description="You signed in with a password that someone shared with you. Set your own password now, or keep this one. You can change it later in Settings, Account."
|
|
7
|
+
:form="form"
|
|
8
|
+
:guard="false"
|
|
6
9
|
@update:open="(value) => !value && keep()"
|
|
7
10
|
>
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<KButton
|
|
24
|
-
label="Keep current password"
|
|
25
|
-
variant="ghost"
|
|
26
|
-
tone="neutral"
|
|
27
|
-
:disabled="form.submitting.value"
|
|
28
|
-
@click="keep"
|
|
29
|
-
/>
|
|
30
|
-
<KButton
|
|
31
|
-
type="submit"
|
|
32
|
-
label="Set password"
|
|
33
|
-
:disabled="(form.values.password ?? '').length < MIN_PASSWORD_LENGTH"
|
|
34
|
-
/>
|
|
35
|
-
</KStack>
|
|
36
|
-
</KForm>
|
|
37
|
-
</KModal>
|
|
11
|
+
<KFormField label="New password" name="password" required>
|
|
12
|
+
<KPasswordInput
|
|
13
|
+
v-model="draft.password"
|
|
14
|
+
autocomplete="new-password"
|
|
15
|
+
:generate="generatePassword"
|
|
16
|
+
copy
|
|
17
|
+
/>
|
|
18
|
+
</KFormField>
|
|
19
|
+
<template #footer="{ submit }">
|
|
20
|
+
<KButton variant="ghost" tone="neutral" :disabled="form.submitting.value" @click="keep">
|
|
21
|
+
Keep current password
|
|
22
|
+
</KButton>
|
|
23
|
+
<KButton :loading="form.submitting.value" @click="submit">Set password</KButton>
|
|
24
|
+
</template>
|
|
25
|
+
</KFormModal>
|
|
38
26
|
</template>
|
|
39
27
|
|
|
40
28
|
<script setup>
|
|
@@ -42,42 +30,36 @@ import { MIN_PASSWORD_LENGTH } from "#nuxt-cms";
|
|
|
42
30
|
import { cmsBrand } from "#cms-brand";
|
|
43
31
|
import {
|
|
44
32
|
Button as KButton,
|
|
45
|
-
Form as KForm,
|
|
46
33
|
FormField as KFormField,
|
|
47
|
-
|
|
34
|
+
FormModal as KFormModal,
|
|
48
35
|
PasswordInput as KPasswordInput,
|
|
49
|
-
|
|
36
|
+
toast,
|
|
50
37
|
useForm
|
|
51
38
|
} from "@xleddyl/443-components-vue";
|
|
52
39
|
import { computed, ref } from "#imports";
|
|
53
40
|
import { generatePassword, useCmsAccount } from "../../composables/cms-account";
|
|
54
|
-
import { useCmsToast } from "../../composables/cms-toast";
|
|
55
41
|
import { cmsApi } from "../../utils/api";
|
|
56
|
-
import { errorMessage } from "../../utils/ui";
|
|
57
42
|
const { user, refresh } = useCmsAccount();
|
|
58
|
-
const toast = useCmsToast();
|
|
59
43
|
const dismissed = ref(false);
|
|
60
44
|
const open = computed(() => !!user.value?.firstLogin && !dismissed.value);
|
|
45
|
+
const draft = ref({ password: "" });
|
|
61
46
|
const form = useForm({
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
async
|
|
66
|
-
dismissed.value = true;
|
|
67
|
-
await cmsApi("/api/cms/account/welcome", { method: "POST" }).catch(() => void 0);
|
|
68
|
-
await refresh();
|
|
69
|
-
}
|
|
70
|
-
async function save(values) {
|
|
71
|
-
try {
|
|
47
|
+
values: draft,
|
|
48
|
+
schema: { password: { required: true, minLength: MIN_PASSWORD_LENGTH, maxLength: 256 } },
|
|
49
|
+
guard: false,
|
|
50
|
+
onSubmit: async (values) => {
|
|
72
51
|
await cmsApi("/api/cms/account/password", {
|
|
73
52
|
method: "PUT",
|
|
74
53
|
body: { newPassword: values.password }
|
|
75
54
|
});
|
|
76
55
|
dismissed.value = true;
|
|
77
56
|
await refresh();
|
|
78
|
-
toast.
|
|
79
|
-
} catch (e) {
|
|
80
|
-
form.setError("", errorMessage(e) ?? "Password not set.");
|
|
57
|
+
toast.success("Password set");
|
|
81
58
|
}
|
|
59
|
+
});
|
|
60
|
+
async function keep() {
|
|
61
|
+
dismissed.value = true;
|
|
62
|
+
await cmsApi("/api/cms/account/welcome", { method: "POST" }).catch(() => void 0);
|
|
63
|
+
await refresh();
|
|
82
64
|
}
|
|
83
65
|
</script>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CmsClipboardNotice } from '../../shared/clipboard.js';
|
|
2
|
+
import type { CmsBlockValue } from '../../shared/preview.js';
|
|
3
|
+
export declare function useCmsClipboard(): {
|
|
4
|
+
items: import("vue").ComputedRef<CmsBlockValue[] | null>;
|
|
5
|
+
copy: (list: readonly CmsBlockValue[], event?: ClipboardEvent) => void;
|
|
6
|
+
read: (text?: string | null) => Promise<CmsBlockValue[] | null>;
|
|
7
|
+
notify: (notice: CmsClipboardNotice) => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { computed, shallowRef } from "#imports";
|
|
2
|
+
import { clipboardText, parseClipboardText } from "../../shared/clipboard.js";
|
|
3
|
+
import { showCmsNotice } from "./cms-toast.js";
|
|
4
|
+
const memory = shallowRef(null);
|
|
5
|
+
async function readSystemClipboard() {
|
|
6
|
+
try {
|
|
7
|
+
return await navigator.clipboard.readText();
|
|
8
|
+
} catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function useCmsClipboard() {
|
|
13
|
+
const items = computed(() => parseClipboardText(memory.value));
|
|
14
|
+
function copy(list, event) {
|
|
15
|
+
const text = clipboardText(list);
|
|
16
|
+
memory.value = text;
|
|
17
|
+
if (event?.clipboardData) {
|
|
18
|
+
event.clipboardData.setData("text/plain", text);
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
void navigator.clipboard?.writeText(text).catch(() => {
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async function read(text) {
|
|
26
|
+
const source = text === void 0 ? await readSystemClipboard() : text;
|
|
27
|
+
const parsed = parseClipboardText(source);
|
|
28
|
+
if (parsed) {
|
|
29
|
+
memory.value = source;
|
|
30
|
+
return parsed;
|
|
31
|
+
}
|
|
32
|
+
return items.value;
|
|
33
|
+
}
|
|
34
|
+
function notify(notice) {
|
|
35
|
+
showCmsNotice(notice);
|
|
36
|
+
}
|
|
37
|
+
return { items, copy, read, notify };
|
|
38
|
+
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
title: string;
|
|
3
|
-
meta: string;
|
|
4
|
-
to: string;
|
|
5
|
-
}
|
|
1
|
+
import type { RecordListItem } from '@xleddyl/443-components-vue';
|
|
6
2
|
export interface CmsConfirmGroup {
|
|
7
3
|
title: string;
|
|
8
|
-
|
|
4
|
+
items: RecordListItem[];
|
|
5
|
+
note?: string;
|
|
9
6
|
}
|
|
10
7
|
export interface CmsConfirmOptions {
|
|
11
|
-
title
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
12
10
|
confirmLabel?: string;
|
|
13
11
|
groups?: CmsConfirmGroup[];
|
|
14
12
|
}
|
|
15
|
-
export declare function useCmsConfirm(): (
|
|
13
|
+
export declare function useCmsConfirm(): (options: CmsConfirmOptions) => Promise<boolean>;
|
|
@@ -3,14 +3,12 @@ import { useConfirm } from "@xleddyl/443-components-vue";
|
|
|
3
3
|
import CmsConfirmGroups from "../components/cms/ConfirmGroups.vue";
|
|
4
4
|
export function useCmsConfirm() {
|
|
5
5
|
const confirm = useConfirm();
|
|
6
|
-
return (
|
|
7
|
-
const groups = options
|
|
6
|
+
return (options) => {
|
|
7
|
+
const groups = options.groups;
|
|
8
8
|
const body = groups?.length ? (_props, { attrs }) => h(CmsConfirmGroups, { ...attrs, groups }) : void 0;
|
|
9
|
-
return confirm({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
confirmLabel: options?.confirmLabel,
|
|
13
|
-
tone: "danger",
|
|
9
|
+
return confirm.delete(options.title, {
|
|
10
|
+
description: options.description,
|
|
11
|
+
confirmLabel: options.confirmLabel,
|
|
14
12
|
body: body ? markRaw(body) : void 0
|
|
15
13
|
});
|
|
16
14
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AsyncData } from 'nuxt/app';
|
|
2
|
-
import type { CmsCollectionName, CmsCollectionTypes, CmsContentName, CmsContentTypes, CmsPagePath, CmsPageTypes, CmsSingleName, CmsSingleTypes } from '#cms-types';
|
|
2
|
+
import type { CmsCollectionName, CmsCollectionTypes, CmsContentName, CmsContentRouteMatch, CmsContentTypes, CmsPagePath, CmsPageTypes, CmsSingleName, CmsSingleTypes } from '#cms-types';
|
|
3
3
|
import type { CmsAsyncDataOptions } from './cms-query-disabled.js';
|
|
4
4
|
export interface CmsSortInput<Entry> {
|
|
5
5
|
field: Extract<keyof Entry, string>;
|
|
@@ -22,8 +22,12 @@ export interface CmsContentOptions<ResT, DefaultT> extends CmsAsyncDataOptions<R
|
|
|
22
22
|
locale?: string;
|
|
23
23
|
}
|
|
24
24
|
export type CmsContentsOptions<ResT, DefaultT, Entry> = CmsCollectionOptions<ResT, DefaultT, Entry>;
|
|
25
|
+
export interface CmsRouteOptions<ResT, DefaultT> extends CmsAsyncDataOptions<ResT, DefaultT> {
|
|
26
|
+
locale?: string;
|
|
27
|
+
}
|
|
25
28
|
export declare function useCmsSingle<K extends CmsSingleName, DefaultT = null>(name: K, options?: CmsSingleOptions<CmsSingleTypes[K] | null, DefaultT>): AsyncData<CmsSingleTypes[K] | DefaultT | null, Error | undefined>;
|
|
26
29
|
export declare function useCmsCollection<K extends CmsCollectionName, DefaultT = CmsCollectionTypes[K][]>(name: K, options?: CmsCollectionOptions<CmsCollectionTypes[K][], DefaultT, CmsCollectionTypes[K]>): AsyncData<CmsCollectionTypes[K][] | DefaultT, Error | undefined>;
|
|
27
30
|
export declare function useCmsContents<K extends CmsContentName, DefaultT = CmsContentTypes[K][]>(name: K, options?: CmsContentsOptions<CmsContentTypes[K][], DefaultT, CmsContentTypes[K]>): AsyncData<CmsContentTypes[K][] | DefaultT, Error | undefined>;
|
|
28
31
|
export declare function useCmsContent<K extends CmsContentName, DefaultT = null>(name: K, slug: string, options?: CmsContentOptions<CmsContentTypes[K] | null, DefaultT>): AsyncData<CmsContentTypes[K] | DefaultT | null, Error | undefined>;
|
|
29
32
|
export declare function useCmsPage<P extends CmsPagePath, DefaultT = null>(path: P, options?: CmsPageOptions<CmsPageTypes[P] | null, DefaultT>): AsyncData<CmsPageTypes[P] | DefaultT | null, Error | undefined>;
|
|
33
|
+
export declare function useCmsRoute<DefaultT = null>(path: string, options?: CmsRouteOptions<CmsContentRouteMatch | null, DefaultT>): AsyncData<CmsContentRouteMatch | DefaultT | null, Error | undefined>;
|
|
@@ -36,3 +36,10 @@ export function useCmsPage(path, options = {}) {
|
|
|
36
36
|
async () => fallback ? fallback() : null
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
|
+
export function useCmsRoute(path, options = {}) {
|
|
40
|
+
const { locale, key, default: fallback } = options;
|
|
41
|
+
return useAsyncData(
|
|
42
|
+
key ?? `cms-route:${path}:${locale ?? ""}`,
|
|
43
|
+
async () => fallback ? fallback() : null
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CmsEntry } from '#nuxt-cms';
|
|
2
|
+
import type { FormErrors } from '@xleddyl/443-components-vue';
|
|
3
|
+
import type { MaybeRefOrGetter, Ref } from 'vue';
|
|
4
|
+
export interface CmsEntryFormOptions {
|
|
5
|
+
state: Ref<Record<string, unknown>>;
|
|
6
|
+
fields: MaybeRefOrGetter<CmsEntry['fields']>;
|
|
7
|
+
entryName?: MaybeRefOrGetter<string | undefined>;
|
|
8
|
+
drafts?: MaybeRefOrGetter<boolean | undefined>;
|
|
9
|
+
path?: MaybeRefOrGetter<string | undefined>;
|
|
10
|
+
onSubmit: (values: Record<string, unknown>) => unknown;
|
|
11
|
+
onInvalid?: (errors: FormErrors) => unknown;
|
|
12
|
+
guard?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function useCmsEntryForm(options: CmsEntryFormOptions): import("@xleddyl/443-components-vue").UseFormReturn<import("@xleddyl/443-components-vue").FormSchema, Record<string, unknown>>;
|
|
15
|
+
export type CmsEntryForm = ReturnType<typeof useCmsEntryForm>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useForm } from "@xleddyl/443-components-vue";
|
|
2
|
+
import { computed, toValue } from "#imports";
|
|
3
|
+
import cmsConfig from "#cms-config";
|
|
4
|
+
import { buildEntrySchema, entryValidationWarnings } from "../../shared/validation.js";
|
|
5
|
+
import { useCmsRuntime } from "./cms-runtime.js";
|
|
6
|
+
export function useCmsEntryForm(options) {
|
|
7
|
+
const { i18n } = useCmsRuntime();
|
|
8
|
+
const validate = computed(() => {
|
|
9
|
+
const name = toValue(options.entryName);
|
|
10
|
+
return name ? cmsConfig[name]?.validate : void 0;
|
|
11
|
+
});
|
|
12
|
+
const schema = computed(
|
|
13
|
+
() => buildEntrySchema(
|
|
14
|
+
{
|
|
15
|
+
fields: toValue(options.fields),
|
|
16
|
+
drafts: toValue(options.drafts),
|
|
17
|
+
validate: validate.value,
|
|
18
|
+
path: toValue(options.path),
|
|
19
|
+
config: cmsConfig
|
|
20
|
+
},
|
|
21
|
+
i18n
|
|
22
|
+
)
|
|
23
|
+
);
|
|
24
|
+
function warnings(values) {
|
|
25
|
+
return entryValidationWarnings(
|
|
26
|
+
{ fields: toValue(options.fields), validate: validate.value },
|
|
27
|
+
values,
|
|
28
|
+
i18n,
|
|
29
|
+
toValue(options.path)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return useForm({
|
|
33
|
+
values: options.state,
|
|
34
|
+
validator: schema,
|
|
35
|
+
warnings,
|
|
36
|
+
onSubmit: options.onSubmit,
|
|
37
|
+
onInvalid: options.onInvalid,
|
|
38
|
+
guard: options.guard
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CmsEntry, CmsFormLayout } from '#nuxt-cms';
|
|
2
|
+
import type { TabItem } from '@xleddyl/443-components-vue';
|
|
3
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
4
|
+
export type CmsEntrySettingsStatus = 'idle' | 'saving' | 'saved' | 'error';
|
|
5
|
+
export type CmsEntrySettingsPart = 'columns' | 'layout';
|
|
6
|
+
export declare const CMS_ENTRY_SETTINGS_TAB = "layouttab";
|
|
7
|
+
export declare const CMS_ENTRY_SETTINGS_PANEL = "cms-entry-settings-panel";
|
|
8
|
+
export declare const ENTRY_SETTINGS_STATUS_LABELS: Record<CmsEntrySettingsStatus, string>;
|
|
9
|
+
export declare const CMS_ENTRY_KIND_ICONS: Record<CmsEntry['kind'], string>;
|
|
10
|
+
export declare function useCmsSettingsEntries(): import("vue").ComputedRef<{
|
|
11
|
+
name: string;
|
|
12
|
+
label: string;
|
|
13
|
+
kind: string;
|
|
14
|
+
icon: string;
|
|
15
|
+
}[]>;
|
|
16
|
+
export declare function entrySettingsParts(name: string): TabItem[];
|
|
17
|
+
export declare function useCmsEntrySettings(nameSource: MaybeRefOrGetter<string | undefined>): {
|
|
18
|
+
entry: import("vue").ComputedRef<CmsEntry | undefined>;
|
|
19
|
+
parts: import("vue").ComputedRef<TabItem[]>;
|
|
20
|
+
part: import("vue").WritableComputedRef<CmsEntrySettingsPart, CmsEntrySettingsPart>;
|
|
21
|
+
fields: import("vue").ComputedRef<Record<string, import("#nuxt-cms").FieldConfig>>;
|
|
22
|
+
columns: import("vue").ComputedRef<string[]>;
|
|
23
|
+
layout: import("vue").ComputedRef<CmsFormLayout>;
|
|
24
|
+
extraColumns: import("vue").ComputedRef<string[]>;
|
|
25
|
+
isCustom: import("vue").ComputedRef<boolean>;
|
|
26
|
+
status: import("vue").Ref<CmsEntrySettingsStatus, CmsEntrySettingsStatus>;
|
|
27
|
+
saveColumns: (value: string[]) => void;
|
|
28
|
+
saveLayout: (value: CmsFormLayout) => void;
|
|
29
|
+
resetPart: () => void;
|
|
30
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { toast, useRouteState } from "@xleddyl/443-components-vue";
|
|
2
|
+
import { computed, toValue, useState } from "#imports";
|
|
3
|
+
import cmsConfig from "#cms-config";
|
|
4
|
+
import { errorMessage } from "../utils/ui.js";
|
|
5
|
+
import { useCmsPermissions } from "./cms-permissions.js";
|
|
6
|
+
import { useCmsRuntime } from "./cms-runtime.js";
|
|
7
|
+
import {
|
|
8
|
+
entryFields,
|
|
9
|
+
entryFormLayout,
|
|
10
|
+
entryListColumns,
|
|
11
|
+
listExtraColumns,
|
|
12
|
+
useCmsSettings
|
|
13
|
+
} from "./cms-settings.js";
|
|
14
|
+
export const CMS_ENTRY_SETTINGS_TAB = "layouttab";
|
|
15
|
+
export const CMS_ENTRY_SETTINGS_PANEL = "cms-entry-settings-panel";
|
|
16
|
+
export const ENTRY_SETTINGS_STATUS_LABELS = {
|
|
17
|
+
idle: "Changes save automatically",
|
|
18
|
+
saving: "Saving\u2026",
|
|
19
|
+
saved: "Saved",
|
|
20
|
+
error: "Not saved"
|
|
21
|
+
};
|
|
22
|
+
const KIND_LABELS = {
|
|
23
|
+
collection: "Collection",
|
|
24
|
+
single: "Single",
|
|
25
|
+
page: "Pages",
|
|
26
|
+
content: "Content"
|
|
27
|
+
};
|
|
28
|
+
export const CMS_ENTRY_KIND_ICONS = {
|
|
29
|
+
collection: "square-3-stack-3d",
|
|
30
|
+
single: "document-text",
|
|
31
|
+
page: "window",
|
|
32
|
+
content: "newspaper"
|
|
33
|
+
};
|
|
34
|
+
function configEntries() {
|
|
35
|
+
return Object.entries(cmsConfig);
|
|
36
|
+
}
|
|
37
|
+
export function useCmsSettingsEntries() {
|
|
38
|
+
const { can } = useCmsPermissions();
|
|
39
|
+
return computed(
|
|
40
|
+
() => can("settings.manage") ? configEntries().filter(([name]) => can(`${name}.read`)).map(([name, entry]) => ({
|
|
41
|
+
name,
|
|
42
|
+
label: entry.label,
|
|
43
|
+
kind: KIND_LABELS[entry.kind],
|
|
44
|
+
icon: entry.icon ?? CMS_ENTRY_KIND_ICONS[entry.kind]
|
|
45
|
+
})) : []
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
export function entrySettingsParts(name) {
|
|
49
|
+
const entry = cmsConfig[name];
|
|
50
|
+
if (!entry) return [];
|
|
51
|
+
return [
|
|
52
|
+
...entry.kind === "collection" || entry.kind === "content" ? [{ value: "columns", label: "Table columns" }] : [],
|
|
53
|
+
{ value: "layout", label: "Form layout" }
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
export function useCmsEntrySettings(nameSource) {
|
|
57
|
+
const { settings, save, reset } = useCmsSettings();
|
|
58
|
+
const { i18n } = useCmsRuntime();
|
|
59
|
+
const status = useState("cms-entry-settings-status", () => "idle");
|
|
60
|
+
const tab = useRouteState(CMS_ENTRY_SETTINGS_TAB, { location: "hash", history: "replace" });
|
|
61
|
+
const name = computed(() => toValue(nameSource) ?? "");
|
|
62
|
+
const entry = computed(() => cmsConfig[name.value]);
|
|
63
|
+
const parts = computed(() => entrySettingsParts(name.value));
|
|
64
|
+
const part = computed({
|
|
65
|
+
get: () => {
|
|
66
|
+
const wanted = tab.value;
|
|
67
|
+
return parts.value.find((item) => item.value === wanted)?.value ?? parts.value[0]?.value ?? "layout";
|
|
68
|
+
},
|
|
69
|
+
set: (value) => {
|
|
70
|
+
tab.value = value === parts.value[0]?.value ? void 0 : value;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const fields = computed(() => entryFields(name.value));
|
|
74
|
+
const columns = computed(() => entryListColumns(name.value, settings.value, i18n));
|
|
75
|
+
const layout = computed(() => entryFormLayout(name.value, settings.value, fields.value));
|
|
76
|
+
const extraColumns = computed(() => listExtraColumns(name.value, i18n));
|
|
77
|
+
const isCustom = computed(() => {
|
|
78
|
+
const saved = settings.value[name.value];
|
|
79
|
+
return part.value === "columns" ? !!saved?.columns : !!saved?.layout;
|
|
80
|
+
});
|
|
81
|
+
function current() {
|
|
82
|
+
const saved = settings.value[name.value] ?? {};
|
|
83
|
+
return { columns: saved.columns, layout: saved.layout };
|
|
84
|
+
}
|
|
85
|
+
async function persist(next) {
|
|
86
|
+
status.value = "saving";
|
|
87
|
+
try {
|
|
88
|
+
if (!next.columns && !next.layout) await reset(name.value);
|
|
89
|
+
else await save(name.value, next);
|
|
90
|
+
status.value = "saved";
|
|
91
|
+
} catch (error) {
|
|
92
|
+
status.value = "error";
|
|
93
|
+
toast.error("Settings not saved", { description: errorMessage(error) });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function saveColumns(value) {
|
|
97
|
+
void persist({ ...current(), columns: value });
|
|
98
|
+
}
|
|
99
|
+
function saveLayout(value) {
|
|
100
|
+
void persist({ ...current(), layout: value });
|
|
101
|
+
}
|
|
102
|
+
function resetPart() {
|
|
103
|
+
const next = current();
|
|
104
|
+
if (part.value === "columns") next.columns = void 0;
|
|
105
|
+
else next.layout = void 0;
|
|
106
|
+
void persist(next);
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
entry,
|
|
110
|
+
parts,
|
|
111
|
+
part,
|
|
112
|
+
fields,
|
|
113
|
+
columns,
|
|
114
|
+
layout,
|
|
115
|
+
extraColumns,
|
|
116
|
+
isCustom,
|
|
117
|
+
status,
|
|
118
|
+
saveColumns,
|
|
119
|
+
saveLayout,
|
|
120
|
+
resetPart
|
|
121
|
+
};
|
|
122
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AsyncData } from 'nuxt/app';
|
|
2
|
-
import type { CmsCollectionName, CmsCollectionTypes, CmsContentName, CmsContentTypes, CmsPagePath, CmsPageTypes, CmsSingleName, CmsSingleTypes } from '#cms-types';
|
|
2
|
+
import type { CmsCollectionName, CmsCollectionTypes, CmsContentName, CmsContentRouteMatch, CmsContentTypes, CmsPagePath, CmsPageTypes, CmsSingleName, CmsSingleTypes } from '#cms-types';
|
|
3
3
|
import type { CmsAsyncDataOptions } from './cms-query.js';
|
|
4
4
|
export interface CmsSortInput<Entry> {
|
|
5
5
|
field: Extract<keyof Entry, string>;
|
|
@@ -22,8 +22,12 @@ export interface CmsContentOptions<ResT, DefaultT> extends CmsAsyncDataOptions<R
|
|
|
22
22
|
locale?: string;
|
|
23
23
|
}
|
|
24
24
|
export type CmsContentsOptions<ResT, DefaultT, Entry> = CmsCollectionOptions<ResT, DefaultT, Entry>;
|
|
25
|
+
export interface CmsRouteOptions<ResT, DefaultT> extends CmsAsyncDataOptions<ResT, DefaultT> {
|
|
26
|
+
locale?: string;
|
|
27
|
+
}
|
|
25
28
|
export declare function useCmsSingle<K extends CmsSingleName, DefaultT = null>(name: K, options?: CmsSingleOptions<CmsSingleTypes[K] | null, DefaultT>): AsyncData<CmsSingleTypes[K] | DefaultT | null, Error | undefined>;
|
|
26
29
|
export declare function useCmsCollection<K extends CmsCollectionName, DefaultT = CmsCollectionTypes[K][]>(name: K, options?: CmsCollectionOptions<CmsCollectionTypes[K][], DefaultT, CmsCollectionTypes[K]>): AsyncData<CmsCollectionTypes[K][] | DefaultT, Error | undefined>;
|
|
27
30
|
export declare function useCmsContents<K extends CmsContentName, DefaultT = CmsContentTypes[K][]>(name: K, options?: CmsContentsOptions<CmsContentTypes[K][], DefaultT, CmsContentTypes[K]>): AsyncData<CmsContentTypes[K][] | DefaultT, Error | undefined>;
|
|
28
31
|
export declare function useCmsContent<K extends CmsContentName, DefaultT = null>(name: K, slug: string, options?: CmsContentOptions<CmsContentTypes[K] | null, DefaultT>): AsyncData<CmsContentTypes[K] | DefaultT | null, Error | undefined>;
|
|
29
32
|
export declare function useCmsPage<P extends CmsPagePath, DefaultT = null>(path: P, options?: CmsPageOptions<CmsPageTypes[P] | null, DefaultT>): AsyncData<CmsPageTypes[P] | DefaultT | null, Error | undefined>;
|
|
33
|
+
export declare function useCmsRoute<DefaultT = null>(path: string, options?: CmsRouteOptions<CmsContentRouteMatch | null, DefaultT>): AsyncData<CmsContentRouteMatch | DefaultT | null, Error | undefined>;
|
|
@@ -3,10 +3,12 @@ import {
|
|
|
3
3
|
cmsContentItemQueries,
|
|
4
4
|
cmsContentQueries,
|
|
5
5
|
cmsPageQueries,
|
|
6
|
+
cmsRouteEntries,
|
|
7
|
+
cmsRouteQuery,
|
|
6
8
|
cmsSingleQueries
|
|
7
9
|
} from "#cms-queries";
|
|
8
10
|
import { useAsyncData } from "#imports";
|
|
9
|
-
import {
|
|
11
|
+
import { cmsPreviewKey, cmsPreviewToken, cmsQueryWithPreview } from "./cms-query.js";
|
|
10
12
|
function unknownEntry(name) {
|
|
11
13
|
throw new Error(`[nuxt-cms] no generated query for "${name}"; check cms.config.ts`);
|
|
12
14
|
}
|
|
@@ -14,11 +16,12 @@ export function useCmsSingle(name, options = {}) {
|
|
|
14
16
|
const { locale, key, default: fallback, ...asyncDataOptions } = options;
|
|
15
17
|
const entryName = String(name);
|
|
16
18
|
const query = cmsSingleQueries[entryName];
|
|
19
|
+
const preview = cmsPreviewToken();
|
|
17
20
|
return useAsyncData(
|
|
18
|
-
key ?? `cms-single:${entryName}:${locale ?? ""}`,
|
|
21
|
+
key ?? cmsPreviewKey(`cms-single:${entryName}:${locale ?? ""}`, preview),
|
|
19
22
|
async () => {
|
|
20
23
|
if (!query) unknownEntry(entryName);
|
|
21
|
-
const result = await
|
|
24
|
+
const result = await cmsQueryWithPreview(query, { locale }, preview);
|
|
22
25
|
return result?.[entryName] ?? null;
|
|
23
26
|
},
|
|
24
27
|
{
|
|
@@ -41,11 +44,12 @@ export function useCmsCollection(name, options = {}) {
|
|
|
41
44
|
const entryName = String(name);
|
|
42
45
|
const query = cmsCollectionQueries[entryName];
|
|
43
46
|
const variables = { locale, filters, sort, limit, offset };
|
|
47
|
+
const preview = cmsPreviewToken();
|
|
44
48
|
return useAsyncData(
|
|
45
|
-
key ?? `cms-collection:${entryName}:${JSON.stringify(variables)}`,
|
|
49
|
+
key ?? cmsPreviewKey(`cms-collection:${entryName}:${JSON.stringify(variables)}`, preview),
|
|
46
50
|
async () => {
|
|
47
51
|
if (!query) unknownEntry(entryName);
|
|
48
|
-
const result = await
|
|
52
|
+
const result = await cmsQueryWithPreview(query, variables, preview);
|
|
49
53
|
return result?.[entryName] ?? [];
|
|
50
54
|
},
|
|
51
55
|
{
|
|
@@ -68,11 +72,12 @@ export function useCmsContents(name, options = {}) {
|
|
|
68
72
|
const entryName = String(name);
|
|
69
73
|
const query = cmsContentQueries[entryName];
|
|
70
74
|
const variables = { locale, filters, sort, limit, offset };
|
|
75
|
+
const preview = cmsPreviewToken();
|
|
71
76
|
return useAsyncData(
|
|
72
|
-
key ?? `cms-contents:${entryName}:${JSON.stringify(variables)}`,
|
|
77
|
+
key ?? cmsPreviewKey(`cms-contents:${entryName}:${JSON.stringify(variables)}`, preview),
|
|
73
78
|
async () => {
|
|
74
79
|
if (!query) unknownEntry(entryName);
|
|
75
|
-
const result = await
|
|
80
|
+
const result = await cmsQueryWithPreview(query, variables, preview);
|
|
76
81
|
return result?.[entryName] ?? [];
|
|
77
82
|
},
|
|
78
83
|
{
|
|
@@ -85,11 +90,12 @@ export function useCmsContent(name, slug, options = {}) {
|
|
|
85
90
|
const { locale, key, default: fallback, ...asyncDataOptions } = options;
|
|
86
91
|
const entryName = String(name);
|
|
87
92
|
const query = cmsContentItemQueries[entryName];
|
|
93
|
+
const preview = cmsPreviewToken();
|
|
88
94
|
return useAsyncData(
|
|
89
|
-
key ?? `cms-content:${entryName}:${slug}:${locale ?? ""}`,
|
|
95
|
+
key ?? cmsPreviewKey(`cms-content:${entryName}:${slug}:${locale ?? ""}`, preview),
|
|
90
96
|
async () => {
|
|
91
97
|
if (!query) unknownEntry(entryName);
|
|
92
|
-
const result = await
|
|
98
|
+
const result = await cmsQueryWithPreview(query, { slug, locale }, preview);
|
|
93
99
|
return result?.item ?? null;
|
|
94
100
|
},
|
|
95
101
|
{
|
|
@@ -102,11 +108,12 @@ export function useCmsPage(path, options = {}) {
|
|
|
102
108
|
const { locale, key, default: fallback, ...asyncDataOptions } = options;
|
|
103
109
|
const pagePath = String(path);
|
|
104
110
|
const query = cmsPageQueries[pagePath];
|
|
111
|
+
const preview = cmsPreviewToken();
|
|
105
112
|
return useAsyncData(
|
|
106
|
-
key ?? `cms-page:${pagePath}:${locale ?? ""}`,
|
|
113
|
+
key ?? cmsPreviewKey(`cms-page:${pagePath}:${locale ?? ""}`, preview),
|
|
107
114
|
async () => {
|
|
108
115
|
if (!query) unknownEntry(pagePath);
|
|
109
|
-
const result = await
|
|
116
|
+
const result = await cmsQueryWithPreview(query, { path: pagePath, locale }, preview);
|
|
110
117
|
return result?.page ?? null;
|
|
111
118
|
},
|
|
112
119
|
{
|
|
@@ -115,3 +122,21 @@ export function useCmsPage(path, options = {}) {
|
|
|
115
122
|
}
|
|
116
123
|
);
|
|
117
124
|
}
|
|
125
|
+
export function useCmsRoute(path, options = {}) {
|
|
126
|
+
const { locale, key, default: fallback, ...asyncDataOptions } = options;
|
|
127
|
+
const preview = cmsPreviewToken();
|
|
128
|
+
return useAsyncData(
|
|
129
|
+
key ?? cmsPreviewKey(`cms-route:${path}:${locale ?? ""}`, preview),
|
|
130
|
+
async () => {
|
|
131
|
+
if (!cmsRouteQuery) return null;
|
|
132
|
+
const result = await cmsQueryWithPreview(cmsRouteQuery, { path, locale }, preview);
|
|
133
|
+
const entry = cmsRouteEntries.find((name) => result?.[name]);
|
|
134
|
+
if (!entry) return null;
|
|
135
|
+
return { entry, item: result[entry] };
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
default: fallback ?? (() => null),
|
|
139
|
+
...asyncDataOptions
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CmsHistoryOptions } from '../../shared/history.js';
|
|
2
|
+
export declare function useCmsHistory<S = number | null>(options: Omit<CmsHistoryOptions<S>, 'onUpdate'>): {
|
|
3
|
+
canUndo: Readonly<import("vue").Ref<boolean, boolean>>;
|
|
4
|
+
canRedo: Readonly<import("vue").Ref<boolean, boolean>>;
|
|
5
|
+
change: (key?: string, hold?: boolean) => void;
|
|
6
|
+
release: () => void;
|
|
7
|
+
undo: () => boolean;
|
|
8
|
+
redo: () => boolean;
|
|
9
|
+
reset: () => void;
|
|
10
|
+
};
|