@xleddyl/nuxt-cms 0.9.4 → 0.10.1
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 -219
- 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 -147
- 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 +19 -11
- 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 +40 -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 +8 -8
- package/dist/runtime/app/components/cms/TranslationBadges.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/TranslationBadges.vue +44 -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 +1153 -338
- 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 +191 -54
- 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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
title: string;
|
|
3
|
+
description: string;
|
|
4
|
+
items: {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}[];
|
|
8
|
+
copyLabel?: string;
|
|
9
|
+
secretKey?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
done: () => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
14
|
+
onDone?: (() => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<KSkeletonForm v-if="!loaded" :fields="4" :columns="2" />
|
|
3
|
+
|
|
4
|
+
<KForm v-else :id="formId" :form="form">
|
|
5
|
+
<KStack gap="lg">
|
|
6
|
+
<KSettingsGroup
|
|
7
|
+
label="Search results"
|
|
8
|
+
description="How the pages of the site show up in search engines and browser tabs."
|
|
9
|
+
>
|
|
10
|
+
<template v-if="multilingual" #actions>
|
|
11
|
+
<CmsLocaleSwitch v-model="locale" :progress="progress" />
|
|
12
|
+
</template>
|
|
13
|
+
<KStack>
|
|
14
|
+
<KGrid :columns="{ base: 1, sm: 2 }">
|
|
15
|
+
<KFormField label="Site name" name="name">
|
|
16
|
+
<CmsTranslatableField
|
|
17
|
+
v-model="state.name"
|
|
18
|
+
:field="NAME_FIELD"
|
|
19
|
+
:locale="locale"
|
|
20
|
+
/>
|
|
21
|
+
</KFormField>
|
|
22
|
+
<KFormField
|
|
23
|
+
label="Title template"
|
|
24
|
+
name="titleTemplate"
|
|
25
|
+
:help="`${TITLE_PLACEHOLDER} is the page title, ${SITE_NAME_PLACEHOLDER} the site name.`"
|
|
26
|
+
>
|
|
27
|
+
<KInput v-model="titleTemplate" :placeholder="DEFAULT_TITLE_TEMPLATE" />
|
|
28
|
+
</KFormField>
|
|
29
|
+
</KGrid>
|
|
30
|
+
<KFormField
|
|
31
|
+
label="Default description"
|
|
32
|
+
name="description"
|
|
33
|
+
description="Used by the pages that have no description of their own."
|
|
34
|
+
>
|
|
35
|
+
<CmsTranslatableField
|
|
36
|
+
v-model="state.description"
|
|
37
|
+
:field="DESCRIPTION_FIELD"
|
|
38
|
+
:locale="locale"
|
|
39
|
+
/>
|
|
40
|
+
</KFormField>
|
|
41
|
+
</KStack>
|
|
42
|
+
</KSettingsGroup>
|
|
43
|
+
|
|
44
|
+
<KSettingsGroup
|
|
45
|
+
label="Share image"
|
|
46
|
+
description="Shown when a page without its own image is shared. 1200 x 630 pixels works best."
|
|
47
|
+
>
|
|
48
|
+
<CmsMediaField v-model="state.image" media-type="image" />
|
|
49
|
+
</KSettingsGroup>
|
|
50
|
+
|
|
51
|
+
<KSettingsGroup
|
|
52
|
+
row
|
|
53
|
+
label="Hide the site from search engines"
|
|
54
|
+
description="Every page is sent with noindex and the sitemap is empty. For a staging site or one not launched yet."
|
|
55
|
+
>
|
|
56
|
+
<template #actions>
|
|
57
|
+
<KSwitch v-model="state.hidden" aria-label="Hide the site from search engines" />
|
|
58
|
+
</template>
|
|
59
|
+
</KSettingsGroup>
|
|
60
|
+
</KStack>
|
|
61
|
+
</KForm>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script setup>
|
|
65
|
+
import {
|
|
66
|
+
DEFAULT_TITLE_TEMPLATE,
|
|
67
|
+
EMPTY_SITE_SETTINGS,
|
|
68
|
+
SITE_NAME_PLACEHOLDER,
|
|
69
|
+
TITLE_PLACEHOLDER,
|
|
70
|
+
titleTemplateErrors
|
|
71
|
+
} from "#nuxt-cms";
|
|
72
|
+
import {
|
|
73
|
+
Form as KForm,
|
|
74
|
+
FormField as KFormField,
|
|
75
|
+
Grid as KGrid,
|
|
76
|
+
Input as KInput,
|
|
77
|
+
SettingsGroup as KSettingsGroup,
|
|
78
|
+
SkeletonForm as KSkeletonForm,
|
|
79
|
+
Stack as KStack,
|
|
80
|
+
Switch as KSwitch,
|
|
81
|
+
toast,
|
|
82
|
+
useForm
|
|
83
|
+
} from "@xleddyl/443-components-vue";
|
|
84
|
+
import { computed, onMounted, ref } from "#imports";
|
|
85
|
+
import { translationProgress } from "../../../shared/translations";
|
|
86
|
+
import { useCmsRuntime } from "../../composables/cms-runtime";
|
|
87
|
+
import { useCmsSettingsForm } from "../../composables/cms-settings-form";
|
|
88
|
+
import { cmsApi } from "../../utils/api";
|
|
89
|
+
import { errorMessage } from "../../utils/ui";
|
|
90
|
+
const NAME_FIELD = { label: "Site name", type: "text" };
|
|
91
|
+
const DESCRIPTION_FIELD = {
|
|
92
|
+
label: "Default description",
|
|
93
|
+
type: "text",
|
|
94
|
+
textarea: true
|
|
95
|
+
};
|
|
96
|
+
const PROGRESS_FIELDS = {
|
|
97
|
+
name: { ...NAME_FIELD, translatable: true },
|
|
98
|
+
description: { ...DESCRIPTION_FIELD, translatable: true }
|
|
99
|
+
};
|
|
100
|
+
const ENDPOINT = "/api/cms/site";
|
|
101
|
+
const { i18n } = useCmsRuntime();
|
|
102
|
+
const multilingual = i18n.locales.length > 1;
|
|
103
|
+
const locale = ref(i18n.defaultLocale);
|
|
104
|
+
const loaded = ref(false);
|
|
105
|
+
const state = ref({ ...EMPTY_SITE_SETTINGS });
|
|
106
|
+
const titleTemplate = computed({
|
|
107
|
+
get: () => state.value.titleTemplate ?? "",
|
|
108
|
+
set: (value) => {
|
|
109
|
+
state.value.titleTemplate = value == null || value === "" ? null : String(value);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const progress = computed(
|
|
113
|
+
() => translationProgress(PROGRESS_FIELDS, state.value, i18n)
|
|
114
|
+
);
|
|
115
|
+
const form = useForm({
|
|
116
|
+
values: state,
|
|
117
|
+
schema: {
|
|
118
|
+
titleTemplate: {
|
|
119
|
+
validate: (value) => {
|
|
120
|
+
const template = value?.trim();
|
|
121
|
+
return template ? titleTemplateErrors(template)[0] : void 0;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
onSubmit: async (values) => {
|
|
126
|
+
const saved = await cmsApi(ENDPOINT, { method: "PUT", body: values });
|
|
127
|
+
form.reset({ ...EMPTY_SITE_SETTINGS, ...saved });
|
|
128
|
+
toast.success("Site settings saved");
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
const formId = useCmsSettingsForm({ submitting: form.submitting, enabled: loaded });
|
|
132
|
+
onMounted(async () => {
|
|
133
|
+
try {
|
|
134
|
+
form.reset({ ...EMPTY_SITE_SETTINGS, ...await cmsApi(ENDPOINT) });
|
|
135
|
+
loaded.value = true;
|
|
136
|
+
} catch (error) {
|
|
137
|
+
toast.error("Site settings not loaded", { description: errorMessage(error) });
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
</script>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CmsAccount } from '#nuxt-cms';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
created: (account: CmsAccount, password: string) => any;
|
|
4
|
+
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
5
|
+
onCreated?: ((account: CmsAccount, password: string) => any) | undefined;
|
|
6
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<KForm :id="formId" :form="form">
|
|
3
|
+
<KGrid :columns="{ base: 1, sm: 2 }">
|
|
4
|
+
<KFormField label="Email" name="email" required>
|
|
5
|
+
<KInput
|
|
6
|
+
v-model="draft.email"
|
|
7
|
+
type="email"
|
|
8
|
+
placeholder="name@example.com"
|
|
9
|
+
autocomplete="off"
|
|
10
|
+
/>
|
|
11
|
+
</KFormField>
|
|
12
|
+
<KFormField label="Name" name="name">
|
|
13
|
+
<KInput v-model="draft.name" placeholder="Optional" autocomplete="off" />
|
|
14
|
+
</KFormField>
|
|
15
|
+
</KGrid>
|
|
16
|
+
<KFormField label="Role" name="role" required :description="roleDescription">
|
|
17
|
+
<KSelect v-model="draft.role" :options="grantableOptions" />
|
|
18
|
+
</KFormField>
|
|
19
|
+
<KFormField label="Password" name="password" required>
|
|
20
|
+
<KPasswordInput
|
|
21
|
+
v-model="draft.password"
|
|
22
|
+
autocomplete="new-password"
|
|
23
|
+
:generate="generatePassword"
|
|
24
|
+
copy
|
|
25
|
+
/>
|
|
26
|
+
</KFormField>
|
|
27
|
+
</KForm>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script setup>
|
|
31
|
+
import { MIN_PASSWORD_LENGTH } from "#nuxt-cms";
|
|
32
|
+
import {
|
|
33
|
+
Form as KForm,
|
|
34
|
+
FormField as KFormField,
|
|
35
|
+
Grid as KGrid,
|
|
36
|
+
Input as KInput,
|
|
37
|
+
PasswordInput as KPasswordInput,
|
|
38
|
+
Select as KSelect,
|
|
39
|
+
useForm
|
|
40
|
+
} from "@xleddyl/443-components-vue";
|
|
41
|
+
import { computed, ref } from "#imports";
|
|
42
|
+
import { generatePassword } from "../../composables/cms-account";
|
|
43
|
+
import { useCmsPermissions } from "../../composables/cms-permissions";
|
|
44
|
+
import { useCmsSettingsForm } from "../../composables/cms-settings-form";
|
|
45
|
+
import { cmsApi } from "../../utils/api";
|
|
46
|
+
const emit = defineEmits(["created"]);
|
|
47
|
+
const { roleOptions, canGrant } = useCmsPermissions();
|
|
48
|
+
const grantableOptions = computed(
|
|
49
|
+
() => roleOptions.filter((option) => canGrant(option.key)).map((option) => ({ value: option.key, label: option.label }))
|
|
50
|
+
);
|
|
51
|
+
const draft = ref({
|
|
52
|
+
email: "",
|
|
53
|
+
name: "",
|
|
54
|
+
role: grantableOptions.value[0]?.value ?? "",
|
|
55
|
+
password: generatePassword()
|
|
56
|
+
});
|
|
57
|
+
const roleDescription = computed(
|
|
58
|
+
() => roleOptions.find((option) => option.key === draft.value.role)?.description ?? void 0
|
|
59
|
+
);
|
|
60
|
+
const form = useForm({
|
|
61
|
+
values: draft,
|
|
62
|
+
schema: {
|
|
63
|
+
email: { required: true, maxLength: 254 },
|
|
64
|
+
name: { maxLength: 120 },
|
|
65
|
+
role: { required: true },
|
|
66
|
+
password: { required: true, minLength: MIN_PASSWORD_LENGTH, maxLength: 256 }
|
|
67
|
+
},
|
|
68
|
+
onSubmit: async (values) => {
|
|
69
|
+
const account = await cmsApi("/api/cms/users", {
|
|
70
|
+
method: "POST",
|
|
71
|
+
body: {
|
|
72
|
+
email: values.email.trim(),
|
|
73
|
+
name: values.name.trim() || null,
|
|
74
|
+
role: values.role,
|
|
75
|
+
password: values.password
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
emit("created", account, values.password);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const formId = useCmsSettingsForm({ creating: true, submitting: form.submitting });
|
|
82
|
+
</script>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CmsAccount } from '#nuxt-cms';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
created: (account: CmsAccount, password: string) => any;
|
|
4
|
+
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
5
|
+
onCreated?: ((account: CmsAccount, password: string) => any) | undefined;
|
|
6
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CmsAccount } from '#nuxt-cms';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
account: CmsAccount;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
updated: (account: CmsAccount) => any;
|
|
7
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
8
|
+
onUpdated?: ((account: CmsAccount) => any) | undefined;
|
|
9
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<KStack gap="lg">
|
|
3
|
+
<KSettingsGroup label="Profile">
|
|
4
|
+
<template v-if="editable" #actions>
|
|
5
|
+
<KButton
|
|
6
|
+
variant="soft"
|
|
7
|
+
tone="neutral"
|
|
8
|
+
type="submit"
|
|
9
|
+
size="sm"
|
|
10
|
+
:form="profileFormId"
|
|
11
|
+
:loading="profileForm.submitting.value"
|
|
12
|
+
:disabled="profile.name === (account.name ?? '')"
|
|
13
|
+
>
|
|
14
|
+
Save
|
|
15
|
+
</KButton>
|
|
16
|
+
</template>
|
|
17
|
+
<KForm :id="profileFormId" :form="profileForm" :disabled="!editable || void 0">
|
|
18
|
+
<KGrid :columns="{ base: 1, sm: 2 }">
|
|
19
|
+
<KFormField label="Name" name="name" :hint="lockReason">
|
|
20
|
+
<KInput v-model="profile.name" placeholder="Optional" autocomplete="off" />
|
|
21
|
+
</KFormField>
|
|
22
|
+
<KFormField label="Email">
|
|
23
|
+
<KInput :model-value="account.email" type="email" disabled />
|
|
24
|
+
</KFormField>
|
|
25
|
+
</KGrid>
|
|
26
|
+
</KForm>
|
|
27
|
+
</KSettingsGroup>
|
|
28
|
+
|
|
29
|
+
<KSettingsGroup label="Role">
|
|
30
|
+
<template v-if="editable && !self" #actions>
|
|
31
|
+
<KButton
|
|
32
|
+
variant="soft"
|
|
33
|
+
tone="neutral"
|
|
34
|
+
type="submit"
|
|
35
|
+
size="sm"
|
|
36
|
+
:form="roleFormId"
|
|
37
|
+
:loading="roleForm.submitting.value"
|
|
38
|
+
:disabled="role.role === account.role"
|
|
39
|
+
>
|
|
40
|
+
Save
|
|
41
|
+
</KButton>
|
|
42
|
+
</template>
|
|
43
|
+
<KForm :id="roleFormId" :form="roleForm" :disabled="!editable || self || void 0">
|
|
44
|
+
<KFormField
|
|
45
|
+
label="Role"
|
|
46
|
+
name="role"
|
|
47
|
+
:hint="roleHint"
|
|
48
|
+
:description="roleDescription"
|
|
49
|
+
:warning="known ? void 0 : UNKNOWN_ROLE_HINT"
|
|
50
|
+
>
|
|
51
|
+
<KSelect v-model="role.role" :options="roleChoices" />
|
|
52
|
+
</KFormField>
|
|
53
|
+
</KForm>
|
|
54
|
+
</KSettingsGroup>
|
|
55
|
+
|
|
56
|
+
<KSettingsGroup v-if="editable" label="Password">
|
|
57
|
+
<template v-if="!newPassword" #actions>
|
|
58
|
+
<KButton
|
|
59
|
+
variant="soft"
|
|
60
|
+
tone="neutral"
|
|
61
|
+
type="submit"
|
|
62
|
+
size="sm"
|
|
63
|
+
:form="passwordFormId"
|
|
64
|
+
:loading="passwordForm.submitting.value"
|
|
65
|
+
>
|
|
66
|
+
Set password
|
|
67
|
+
</KButton>
|
|
68
|
+
</template>
|
|
69
|
+
<CmsSettingsSecretCard
|
|
70
|
+
v-if="newPassword"
|
|
71
|
+
title="Password changed"
|
|
72
|
+
description="Share these credentials with the user. The password does not show again."
|
|
73
|
+
:items="[
|
|
74
|
+
{ label: 'Email', value: account.email },
|
|
75
|
+
{ label: 'Password', value: newPassword }
|
|
76
|
+
]"
|
|
77
|
+
@done="newPassword = null"
|
|
78
|
+
/>
|
|
79
|
+
<KForm v-else :id="passwordFormId" :form="passwordForm">
|
|
80
|
+
<KFormField label="New password" name="password" required>
|
|
81
|
+
<KPasswordInput
|
|
82
|
+
v-model="password.password"
|
|
83
|
+
autocomplete="new-password"
|
|
84
|
+
:generate="generatePassword"
|
|
85
|
+
copy
|
|
86
|
+
/>
|
|
87
|
+
</KFormField>
|
|
88
|
+
</KForm>
|
|
89
|
+
</KSettingsGroup>
|
|
90
|
+
</KStack>
|
|
91
|
+
</template>
|
|
92
|
+
|
|
93
|
+
<script setup>
|
|
94
|
+
import { MIN_PASSWORD_LENGTH } from "#nuxt-cms";
|
|
95
|
+
import {
|
|
96
|
+
Button as KButton,
|
|
97
|
+
Form as KForm,
|
|
98
|
+
FormField as KFormField,
|
|
99
|
+
Grid as KGrid,
|
|
100
|
+
Input as KInput,
|
|
101
|
+
PasswordInput as KPasswordInput,
|
|
102
|
+
Select as KSelect,
|
|
103
|
+
SettingsGroup as KSettingsGroup,
|
|
104
|
+
Stack as KStack,
|
|
105
|
+
toast,
|
|
106
|
+
useForm
|
|
107
|
+
} from "@xleddyl/443-components-vue";
|
|
108
|
+
import { computed, ref, useId } from "#imports";
|
|
109
|
+
import { generatePassword } from "../../composables/cms-account";
|
|
110
|
+
import { useCmsPermissions } from "../../composables/cms-permissions";
|
|
111
|
+
import { useCmsUsers } from "../../composables/cms-settings-stores";
|
|
112
|
+
import { cmsApi } from "../../utils/api";
|
|
113
|
+
import { UNKNOWN_ROLE_HINT, isKnownRole } from "../../utils/users";
|
|
114
|
+
const props = defineProps({
|
|
115
|
+
account: { type: Object, required: true }
|
|
116
|
+
});
|
|
117
|
+
const emit = defineEmits(["updated"]);
|
|
118
|
+
const profileFormId = useId();
|
|
119
|
+
const roleFormId = useId();
|
|
120
|
+
const passwordFormId = useId();
|
|
121
|
+
const { roleOptions, roleLabel, canGrant } = useCmsPermissions();
|
|
122
|
+
const { canManageUser, isSelf } = useCmsUsers();
|
|
123
|
+
const editable = computed(() => canManageUser(props.account));
|
|
124
|
+
const self = computed(() => isSelf(props.account));
|
|
125
|
+
const known = computed(() => isKnownRole(props.account.role, roleOptions));
|
|
126
|
+
const lockReason = computed(
|
|
127
|
+
() => editable.value ? void 0 : "Your role cannot manage this account."
|
|
128
|
+
);
|
|
129
|
+
const roleHint = computed(
|
|
130
|
+
() => editable.value && self.value ? "You cannot change your own role." : lockReason.value
|
|
131
|
+
);
|
|
132
|
+
const roleChoices = computed(() => {
|
|
133
|
+
const options = roleOptions.filter((option) => canGrant(option.key) || option.key === props.account.role).map((option) => ({ value: option.key, label: option.label }));
|
|
134
|
+
return known.value ? options : [
|
|
135
|
+
{ value: props.account.role, label: `${props.account.role} (removed)`, disabled: true },
|
|
136
|
+
...options
|
|
137
|
+
];
|
|
138
|
+
});
|
|
139
|
+
const roleDescription = computed(
|
|
140
|
+
() => roleOptions.find((option) => option.key === role.value.role)?.description ?? void 0
|
|
141
|
+
);
|
|
142
|
+
async function update(body) {
|
|
143
|
+
const account = await cmsApi(`/api/cms/users/${props.account.id}`, {
|
|
144
|
+
method: "PUT",
|
|
145
|
+
body
|
|
146
|
+
});
|
|
147
|
+
emit("updated", account);
|
|
148
|
+
return account;
|
|
149
|
+
}
|
|
150
|
+
const profile = ref({ name: props.account.name ?? "" });
|
|
151
|
+
const profileForm = useForm({
|
|
152
|
+
values: profile,
|
|
153
|
+
schema: { name: { maxLength: 120 } },
|
|
154
|
+
onSubmit: async (values) => {
|
|
155
|
+
await update({ name: values.name.trim() || null });
|
|
156
|
+
toast.success("Profile saved");
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
const role = ref({ role: props.account.role });
|
|
160
|
+
const roleForm = useForm({
|
|
161
|
+
values: role,
|
|
162
|
+
schema: { role: { required: true } },
|
|
163
|
+
onSubmit: async (values) => {
|
|
164
|
+
const account = await update({ role: values.role });
|
|
165
|
+
toast.success(`${account.email} is now ${roleLabel(account.role)}`);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
const password = ref({ password: generatePassword() });
|
|
169
|
+
const newPassword = ref(null);
|
|
170
|
+
const passwordForm = useForm({
|
|
171
|
+
values: password,
|
|
172
|
+
schema: { password: { required: true, minLength: MIN_PASSWORD_LENGTH, maxLength: 256 } },
|
|
173
|
+
onSubmit: async (values) => {
|
|
174
|
+
await update({ password: values.password });
|
|
175
|
+
newPassword.value = values.password;
|
|
176
|
+
passwordForm.reset({ password: generatePassword() });
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CmsAccount } from '#nuxt-cms';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
account: CmsAccount;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
updated: (account: CmsAccount) => any;
|
|
7
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
8
|
+
onUpdated?: ((account: CmsAccount) => any) | undefined;
|
|
9
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
1
|
+
import type { SettingsModalPage } from '@xleddyl/443-components-vue';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
page?: SettingsModalPage;
|
|
3
4
|
};
|
|
4
|
-
declare const __VLS_export: import("vue").DefineComponent<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
open: (page: SettingsModalPage) => any;
|
|
7
|
+
back: () => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
onOpen?: ((page: SettingsModalPage) => any) | undefined;
|
|
10
|
+
onBack?: (() => any) | undefined;
|
|
8
11
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
12
|
declare const _default: typeof __VLS_export;
|
|
10
13
|
export default _default;
|