@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,34 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<KModal v-model:open="open" :title="`Import ${config.label}`" size="lg">
|
|
2
|
+
<KModal v-model:open="open" :title="`Import ${config.label}`" :description="intro" size="lg">
|
|
3
3
|
<KStack gap="md">
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@change="onFile"
|
|
17
|
-
/>
|
|
18
|
-
<KButton
|
|
19
|
-
:label="file ? 'Choose another file' : 'Choose file'"
|
|
20
|
-
:icon="cmsIcon('document-arrow-up')"
|
|
21
|
-
variant="soft"
|
|
22
|
-
tone="neutral"
|
|
23
|
-
:disabled="busy"
|
|
24
|
-
@click="input?.click()"
|
|
25
|
-
/>
|
|
26
|
-
<span v-if="file" class="cms-import-file-name">
|
|
27
|
-
{{ file.name }} · {{ formatFileSize(file.size) }}
|
|
28
|
-
</span>
|
|
29
|
-
</KStack>
|
|
4
|
+
<KFileInput
|
|
5
|
+
:model-value="file"
|
|
6
|
+
:accept="csv ? '.json,.csv,application/json,text/csv' : '.json,application/json'"
|
|
7
|
+
:icon="cmsIcon('document-arrow-up')"
|
|
8
|
+
:title="file ? 'Choose another file' : 'Choose a file'"
|
|
9
|
+
:disabled="busy"
|
|
10
|
+
:previews="false"
|
|
11
|
+
size="sm"
|
|
12
|
+
list
|
|
13
|
+
aria-label="Import file"
|
|
14
|
+
@update:model-value="onFile"
|
|
15
|
+
/>
|
|
30
16
|
|
|
31
17
|
<KFormField
|
|
18
|
+
v-if="canUpsert"
|
|
32
19
|
label="Mode"
|
|
33
20
|
:description="
|
|
34
21
|
mode === 'create' ? 'Every row becomes a new entry. A row with the id of an existing entry is an error.' : 'A row with the id of an existing entry replaces it. Other rows become new entries.'
|
|
@@ -44,18 +31,15 @@
|
|
|
44
31
|
/>
|
|
45
32
|
</KFormField>
|
|
46
33
|
|
|
47
|
-
<
|
|
34
|
+
<KSkeletonList v-if="checking" :rows="3" />
|
|
48
35
|
|
|
49
36
|
<KAlert
|
|
50
37
|
v-else-if="fileErrors.length"
|
|
51
38
|
tone="danger"
|
|
52
39
|
role="alert"
|
|
53
40
|
title="The file cannot be imported"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<li v-for="message in fileErrors" :key="message">{{ message }}</li>
|
|
57
|
-
</ul>
|
|
58
|
-
</KAlert>
|
|
41
|
+
:description="fileErrors"
|
|
42
|
+
/>
|
|
59
43
|
|
|
60
44
|
<template v-else-if="preview">
|
|
61
45
|
<KAlert :tone="invalidCount ? 'warning' : 'success'" role="status" :title="summary" />
|
|
@@ -74,26 +58,27 @@
|
|
|
74
58
|
<KBadge :label="row.action === 'update' ? 'Update' : 'New'" size="sm" />
|
|
75
59
|
</template>
|
|
76
60
|
<template #cell-errors="{ row }">
|
|
77
|
-
<
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
61
|
+
<KStack v-if="row.errors.length" gap="none" class="cms-import-issues">
|
|
62
|
+
<KFieldMessage
|
|
63
|
+
v-for="(issue, index) in row.errors"
|
|
64
|
+
:key="index"
|
|
65
|
+
:message="issue.path ? `${issue.path}: ${issue.message}` : issue.message"
|
|
66
|
+
:icon="false"
|
|
67
|
+
/>
|
|
68
|
+
</KStack>
|
|
69
|
+
<KBadge v-else label="Ready" tone="success" icon="check" size="sm" />
|
|
86
70
|
</template>
|
|
87
71
|
</KTable>
|
|
88
72
|
</template>
|
|
89
73
|
</KStack>
|
|
90
74
|
|
|
91
75
|
<template #footer>
|
|
92
|
-
<KButton label="Cancel" variant="
|
|
76
|
+
<KButton label="Cancel" variant="ghost" tone="neutral" @click="open = false" />
|
|
93
77
|
<KButton
|
|
94
78
|
:label="importLabel"
|
|
95
79
|
:icon="cmsIcon('arrow-down-tray')"
|
|
96
80
|
:disabled="!canImport"
|
|
81
|
+
disabled-reason="Choose a file without errors first"
|
|
97
82
|
:loading="importing"
|
|
98
83
|
@click="commit"
|
|
99
84
|
/>
|
|
@@ -107,17 +92,19 @@ import {
|
|
|
107
92
|
Alert as KAlert,
|
|
108
93
|
Badge as KBadge,
|
|
109
94
|
Button as KButton,
|
|
95
|
+
FieldMessage as KFieldMessage,
|
|
96
|
+
FileInput as KFileInput,
|
|
110
97
|
FormField as KFormField,
|
|
111
|
-
Icon as KIcon,
|
|
112
98
|
Modal as KModal,
|
|
113
99
|
SegmentedControl as KSegmentedControl,
|
|
114
|
-
|
|
100
|
+
SkeletonList as KSkeletonList,
|
|
115
101
|
Stack as KStack,
|
|
116
|
-
Table as KTable
|
|
102
|
+
Table as KTable,
|
|
103
|
+
toast
|
|
117
104
|
} from "@xleddyl/443-components-vue";
|
|
118
105
|
import { computed, ref, watch } from "#imports";
|
|
119
106
|
import { canTransferCsv, IMPORT_MAX_BYTES, IMPORT_MAX_ROWS } from "../../../shared/transfer";
|
|
120
|
-
import {
|
|
107
|
+
import { useCmsPermissions } from "../../composables/cms-permissions";
|
|
121
108
|
import { cmsIcon, errorMessage } from "../../utils/ui";
|
|
122
109
|
const MODE_OPTIONS = [
|
|
123
110
|
{ value: "create", label: "Create only" },
|
|
@@ -135,10 +122,11 @@ const props = defineProps({
|
|
|
135
122
|
});
|
|
136
123
|
const open = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
137
124
|
const emit = defineEmits(["imported"]);
|
|
138
|
-
const
|
|
125
|
+
const { can } = useCmsPermissions();
|
|
126
|
+
const canUpsert = computed(() => can(`${props.collection}.update`));
|
|
139
127
|
const csv = canTransferCsv(props.config);
|
|
140
128
|
const maxSize = formatFileSize(IMPORT_MAX_BYTES);
|
|
141
|
-
const
|
|
129
|
+
const intro = `${csv ? "A JSON or CSV file" : "A JSON file"} in the format of the export, up to ${maxSize} and ${IMPORT_MAX_ROWS} rows. Media fields take keys of files that are already in the media library. Nothing is written until you confirm.`;
|
|
142
130
|
const file = ref(null);
|
|
143
131
|
const text = ref("");
|
|
144
132
|
const mode = ref("create");
|
|
@@ -179,7 +167,6 @@ function reset() {
|
|
|
179
167
|
preview.value = null;
|
|
180
168
|
fileErrors.value = [];
|
|
181
169
|
mode.value = "create";
|
|
182
|
-
if (input.value) input.value.value = "";
|
|
183
170
|
}
|
|
184
171
|
watch(open, (value) => {
|
|
185
172
|
if (value) reset();
|
|
@@ -211,11 +198,15 @@ async function check() {
|
|
|
211
198
|
checking.value = false;
|
|
212
199
|
}
|
|
213
200
|
}
|
|
214
|
-
async function onFile(
|
|
215
|
-
const picked =
|
|
216
|
-
if (!picked)
|
|
201
|
+
async function onFile(value) {
|
|
202
|
+
const picked = Array.isArray(value) ? value[0] : value;
|
|
203
|
+
if (!picked) {
|
|
204
|
+
reset();
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
217
207
|
file.value = picked;
|
|
218
208
|
preview.value = null;
|
|
209
|
+
fileErrors.value = [];
|
|
219
210
|
if (picked.size > IMPORT_MAX_BYTES) {
|
|
220
211
|
fileErrors.value = [`The file is larger than ${maxSize}`];
|
|
221
212
|
return;
|
|
@@ -238,10 +229,7 @@ async function commit() {
|
|
|
238
229
|
try {
|
|
239
230
|
const result = await send(false);
|
|
240
231
|
const count = result.create + result.update;
|
|
241
|
-
toast.
|
|
242
|
-
title: `Imported ${count} ${count === 1 ? "entry" : "entries"}`,
|
|
243
|
-
color: "success"
|
|
244
|
-
});
|
|
232
|
+
toast.success(`Imported ${count} ${count === 1 ? "entry" : "entries"}`);
|
|
245
233
|
emit("imported");
|
|
246
234
|
open.value = false;
|
|
247
235
|
} catch (error) {
|
|
@@ -250,7 +238,7 @@ async function commit() {
|
|
|
250
238
|
preview.value = returned;
|
|
251
239
|
fileErrors.value = returned.errors;
|
|
252
240
|
}
|
|
253
|
-
toast.
|
|
241
|
+
toast.error("Import failed", { description: errorMessage(error) });
|
|
254
242
|
} finally {
|
|
255
243
|
importing.value = false;
|
|
256
244
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FieldConfig } from '#nuxt-cms';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
field: FieldConfig;
|
|
4
|
+
locale?: string;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_ModelProps = {
|
|
7
|
+
modelValue: unknown;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:modelValue": (value: unknown) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
13
|
+
"onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<KStack gap="sm">
|
|
3
|
+
<KStack direction="row" align="center" gap="sm" wrap>
|
|
4
|
+
<KFieldBoundary v-if="modeOptions.length > 1" auxiliary>
|
|
5
|
+
<KSegmentedControl
|
|
6
|
+
v-model="mode"
|
|
7
|
+
:options="modeOptions"
|
|
8
|
+
size="sm"
|
|
9
|
+
required
|
|
10
|
+
aria-label="Link type"
|
|
11
|
+
/>
|
|
12
|
+
</KFieldBoundary>
|
|
13
|
+
<KCombobox
|
|
14
|
+
v-if="mode === 'internal'"
|
|
15
|
+
v-model="targetValue"
|
|
16
|
+
class="cms-link-input"
|
|
17
|
+
clearable
|
|
18
|
+
open-on-focus
|
|
19
|
+
:options="selectedOptions"
|
|
20
|
+
:search="search"
|
|
21
|
+
:debounce="300"
|
|
22
|
+
:placeholder="field.placeholder ?? 'Search pages and content\u2026'"
|
|
23
|
+
/>
|
|
24
|
+
<KInput
|
|
25
|
+
v-else
|
|
26
|
+
v-model="urlValue"
|
|
27
|
+
class="cms-link-input k-mono"
|
|
28
|
+
:placeholder="field.placeholder ?? 'https://, /path, mailto:, tel: or #anchor'"
|
|
29
|
+
/>
|
|
30
|
+
</KStack>
|
|
31
|
+
<KFieldMessage v-if="warning" tone="warning" :message="warning" />
|
|
32
|
+
<KFieldBoundary auxiliary>
|
|
33
|
+
<KStack direction="row" align="center" gap="md" wrap>
|
|
34
|
+
<KInput
|
|
35
|
+
v-if="field.withLabel"
|
|
36
|
+
v-model="labelValue"
|
|
37
|
+
class="cms-link-label"
|
|
38
|
+
aria-label="Link text"
|
|
39
|
+
placeholder="Link text"
|
|
40
|
+
/>
|
|
41
|
+
<KSwitch v-model="newTabValue" size="sm" label="Open in a new tab" />
|
|
42
|
+
</KStack>
|
|
43
|
+
</KFieldBoundary>
|
|
44
|
+
</KStack>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup>
|
|
48
|
+
import {
|
|
49
|
+
allowsExternalLinks,
|
|
50
|
+
contentItemPath,
|
|
51
|
+
isLocalizedLinkField,
|
|
52
|
+
linkLabelText,
|
|
53
|
+
linkTargetKey,
|
|
54
|
+
linkTargetNames,
|
|
55
|
+
pageLinkPath,
|
|
56
|
+
pageRoutes,
|
|
57
|
+
parseLinkTargetKey,
|
|
58
|
+
readLinkValue
|
|
59
|
+
} from "#nuxt-cms";
|
|
60
|
+
import {
|
|
61
|
+
Combobox as KCombobox,
|
|
62
|
+
FieldBoundary as KFieldBoundary,
|
|
63
|
+
FieldMessage as KFieldMessage,
|
|
64
|
+
Input as KInput,
|
|
65
|
+
SegmentedControl as KSegmentedControl,
|
|
66
|
+
Stack as KStack,
|
|
67
|
+
Switch as KSwitch,
|
|
68
|
+
toast
|
|
69
|
+
} from "@xleddyl/443-components-vue";
|
|
70
|
+
import { computed, ref, watch } from "#imports";
|
|
71
|
+
import cmsConfig from "#cms-config";
|
|
72
|
+
import { useCmsLinkTargets } from "../../composables/cms-link-targets";
|
|
73
|
+
import { useCmsPermissions } from "../../composables/cms-permissions";
|
|
74
|
+
import { useCmsRuntime } from "../../composables/cms-runtime";
|
|
75
|
+
import { errorMessage } from "../../utils/ui";
|
|
76
|
+
const SEARCH_LIMIT = 10;
|
|
77
|
+
const props = defineProps({
|
|
78
|
+
field: { type: Object, required: true },
|
|
79
|
+
locale: { type: String, required: false }
|
|
80
|
+
});
|
|
81
|
+
const model = defineModel({ type: null, ...{ required: true } });
|
|
82
|
+
const config = cmsConfig;
|
|
83
|
+
const { i18n } = useCmsRuntime();
|
|
84
|
+
const targets = useCmsLinkTargets(config);
|
|
85
|
+
const { can } = useCmsPermissions();
|
|
86
|
+
const targetNames = computed(
|
|
87
|
+
() => linkTargetNames(config, props.field).filter((name) => can(`${name}.read`))
|
|
88
|
+
);
|
|
89
|
+
const external = computed(() => allowsExternalLinks(props.field));
|
|
90
|
+
const activeLocale = computed(() => props.locale ?? i18n.defaultLocale);
|
|
91
|
+
const link = computed(() => readLinkValue(model.value));
|
|
92
|
+
const modeOptions = computed(() => [
|
|
93
|
+
...targetNames.value.length ? [{ value: "internal", label: "Internal" }] : [],
|
|
94
|
+
...external.value ? [{ value: "external", label: "External" }] : []
|
|
95
|
+
]);
|
|
96
|
+
function initialMode() {
|
|
97
|
+
if (link.value?.url) return "external";
|
|
98
|
+
if (link.value?.entry || !external.value) return "internal";
|
|
99
|
+
return targetNames.value.length ? "internal" : "external";
|
|
100
|
+
}
|
|
101
|
+
const mode = ref(initialMode());
|
|
102
|
+
function write(next) {
|
|
103
|
+
const hasTarget = !!next.url || !!(next.entry && next.id);
|
|
104
|
+
const hasExtra = next.label !== void 0 || !!next.newTab;
|
|
105
|
+
model.value = hasTarget || hasExtra ? next : null;
|
|
106
|
+
}
|
|
107
|
+
function extras() {
|
|
108
|
+
const current = link.value;
|
|
109
|
+
return {
|
|
110
|
+
...current?.label !== void 0 ? { label: current.label } : {},
|
|
111
|
+
...current?.newTab ? { newTab: true } : {}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
watch(mode, (next) => {
|
|
115
|
+
if (next === "internal" && link.value?.url) write(extras());
|
|
116
|
+
if (next === "external" && link.value?.entry) write(extras());
|
|
117
|
+
});
|
|
118
|
+
const urlValue = computed({
|
|
119
|
+
get: () => link.value?.url ?? "",
|
|
120
|
+
set: (value) => {
|
|
121
|
+
const url = value == null ? "" : String(value);
|
|
122
|
+
write({ ...url ? { url } : {}, ...extras() });
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
const targetValue = computed({
|
|
126
|
+
get: () => link.value?.entry && link.value.id ? linkTargetKey(link.value.entry, link.value.id) : null,
|
|
127
|
+
set: (value) => {
|
|
128
|
+
const target = value ? parseLinkTargetKey(value) : null;
|
|
129
|
+
write({ ...target ? { entry: target.entry, id: target.id } : {}, ...extras() });
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
const labelValue = computed({
|
|
133
|
+
get: () => {
|
|
134
|
+
const label = link.value?.label;
|
|
135
|
+
if (isLocalizedLinkField(props.field))
|
|
136
|
+
return label && typeof label === "object" ? label[activeLocale.value] ?? "" : "";
|
|
137
|
+
return typeof label === "string" ? label : "";
|
|
138
|
+
},
|
|
139
|
+
set: (value) => {
|
|
140
|
+
const text = value == null ? "" : String(value);
|
|
141
|
+
const current = link.value ?? {};
|
|
142
|
+
const { label: previous, ...rest } = current;
|
|
143
|
+
let label;
|
|
144
|
+
if (isLocalizedLinkField(props.field)) {
|
|
145
|
+
const map = { ...previous && typeof previous === "object" ? previous : {} };
|
|
146
|
+
if (text) map[activeLocale.value] = text;
|
|
147
|
+
else delete map[activeLocale.value];
|
|
148
|
+
label = Object.keys(map).length ? map : void 0;
|
|
149
|
+
} else {
|
|
150
|
+
label = text || void 0;
|
|
151
|
+
}
|
|
152
|
+
write({ ...rest, ...label !== void 0 ? { label } : {} });
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
const newTabValue = computed({
|
|
156
|
+
get: () => !!link.value?.newTab,
|
|
157
|
+
set: (value) => {
|
|
158
|
+
const { newTab: _newTab, ...rest } = link.value ?? {};
|
|
159
|
+
write({ ...rest, ...value ? { newTab: true } : {} });
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
function rowTitle(entry, row) {
|
|
163
|
+
const value = row[entry.titleField ?? "title"];
|
|
164
|
+
const text = typeof value === "string" ? value : value && typeof value === "object" ? linkLabelText(value, activeLocale.value, i18n.defaultLocale) : null;
|
|
165
|
+
return text || `#${String(row.id)}`;
|
|
166
|
+
}
|
|
167
|
+
function rowPath(entry, row) {
|
|
168
|
+
return contentItemPath(entry, row, activeLocale.value) ?? "";
|
|
169
|
+
}
|
|
170
|
+
function pageOptions(name, entry, term) {
|
|
171
|
+
return pageRoutes(entry).filter(
|
|
172
|
+
(route) => !term || route.path.toLowerCase().includes(term) || route.label.toLowerCase().includes(term)
|
|
173
|
+
).slice(0, SEARCH_LIMIT).map((route) => ({
|
|
174
|
+
label: route.label,
|
|
175
|
+
value: linkTargetKey(name, route.key),
|
|
176
|
+
description: route.path,
|
|
177
|
+
group: entry.label
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
180
|
+
async function contentOptions(name, entry, term, signal) {
|
|
181
|
+
const page = await $fetch(`/api/cms/admin/${name}`, {
|
|
182
|
+
query: { light: "true", limit: SEARCH_LIMIT, ...term ? { search: term } : {} },
|
|
183
|
+
signal
|
|
184
|
+
});
|
|
185
|
+
return page.items.map((row) => {
|
|
186
|
+
targets.remember(name, row);
|
|
187
|
+
const state = targets.state({ entry: name, id: String(row.id) });
|
|
188
|
+
const path = rowPath(entry, row);
|
|
189
|
+
return {
|
|
190
|
+
label: rowTitle(entry, row),
|
|
191
|
+
value: linkTargetKey(name, String(row.id)),
|
|
192
|
+
description: state === "live" ? path : `${path} (${state})`.trim(),
|
|
193
|
+
group: entry.label
|
|
194
|
+
};
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
async function search(query, signal) {
|
|
198
|
+
const term = query.trim().toLowerCase();
|
|
199
|
+
try {
|
|
200
|
+
const groups = await Promise.all(
|
|
201
|
+
targetNames.value.map((name) => {
|
|
202
|
+
const entry = config[name];
|
|
203
|
+
return entry.kind === "page" ? pageOptions(name, entry, term) : contentOptions(name, entry, query.trim(), signal);
|
|
204
|
+
})
|
|
205
|
+
);
|
|
206
|
+
return groups.flat();
|
|
207
|
+
} catch (error) {
|
|
208
|
+
if (signal.aborted) throw error;
|
|
209
|
+
toast.error("Loading failed", { description: errorMessage(error) });
|
|
210
|
+
return [];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
watch(
|
|
214
|
+
link,
|
|
215
|
+
(value) => {
|
|
216
|
+
if (value?.entry && value.id && !value.url) targets.load(value.entry, value.id);
|
|
217
|
+
},
|
|
218
|
+
{ immediate: true }
|
|
219
|
+
);
|
|
220
|
+
const selectedOptions = computed(() => {
|
|
221
|
+
const value = link.value;
|
|
222
|
+
if (!value?.entry || !value.id || value.url) return [];
|
|
223
|
+
const entry = config[value.entry];
|
|
224
|
+
const key = linkTargetKey(value.entry, value.id);
|
|
225
|
+
if (entry?.kind === "page") {
|
|
226
|
+
const route = pageRoutes(entry).find((candidate) => candidate.key === value.id);
|
|
227
|
+
return [{ label: route?.label ?? value.id, value: key, description: route?.path }];
|
|
228
|
+
}
|
|
229
|
+
const row = targets.target(value.entry, value.id);
|
|
230
|
+
if (!entry || !row) return [{ label: `${entry?.label ?? value.entry} #${value.id}`, value: key }];
|
|
231
|
+
return [{ label: rowTitle(entry, row), value: key, description: rowPath(entry, row) }];
|
|
232
|
+
});
|
|
233
|
+
const warning = computed(() => {
|
|
234
|
+
const value = link.value;
|
|
235
|
+
if (mode.value !== "internal" || !value?.entry || !value.id) return null;
|
|
236
|
+
const entry = config[value.entry];
|
|
237
|
+
if (entry?.kind === "page")
|
|
238
|
+
return pageLinkPath(entry, value.id) ? null : "This page no longer exists.";
|
|
239
|
+
switch (targets.state(value)) {
|
|
240
|
+
case "missing":
|
|
241
|
+
return "The linked item was deleted. The site shows no link until you pick another one.";
|
|
242
|
+
case "draft":
|
|
243
|
+
return "The linked item is a draft. The site hides this link until it is published.";
|
|
244
|
+
case "scheduled":
|
|
245
|
+
return "The linked item is scheduled. The site shows this link once it goes live.";
|
|
246
|
+
default:
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FieldConfig } from '#nuxt-cms';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
field: FieldConfig;
|
|
4
|
+
locale?: string;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_ModelProps = {
|
|
7
|
+
modelValue: unknown;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:modelValue": (value: unknown) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
13
|
+
"onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -7,23 +7,20 @@
|
|
|
7
7
|
multiple
|
|
8
8
|
clearable
|
|
9
9
|
clear-label="Clear filters"
|
|
10
|
-
class="cms-list-filters"
|
|
11
10
|
@update:model-value="onPillsUpdate"
|
|
12
11
|
>
|
|
13
12
|
<template v-for="key in relationKeys" #[`panel-${key}`]="{ close }" :key="key">
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/>
|
|
20
|
-
</div>
|
|
13
|
+
<CmsRelationField
|
|
14
|
+
:model-value="model[key] ?? null"
|
|
15
|
+
:to="relationTarget(config.fields[key])"
|
|
16
|
+
@update:model-value="(value) => pickRelation(key, value, close)"
|
|
17
|
+
/>
|
|
21
18
|
</template>
|
|
22
19
|
</KFilterPills>
|
|
23
20
|
</template>
|
|
24
21
|
|
|
25
22
|
<script setup>
|
|
26
|
-
import { isTranslatableField, selectDisplayValue } from "#nuxt-cms";
|
|
23
|
+
import { isTranslatableField, relationTarget, selectDisplayValue } from "#nuxt-cms";
|
|
27
24
|
import { FilterPills as KFilterPills } from "@xleddyl/443-components-vue";
|
|
28
25
|
import { computed, reactive, watch } from "#imports";
|
|
29
26
|
import cmsConfig from "#cms-config";
|
|
@@ -53,7 +50,8 @@ const pills = computed(
|
|
|
53
50
|
valueLabel: valueLabelOf(key),
|
|
54
51
|
active: isActive(key),
|
|
55
52
|
menu,
|
|
56
|
-
panel: !menu
|
|
53
|
+
panel: !menu,
|
|
54
|
+
panelWidth: menu ? void 0 : "18rem"
|
|
57
55
|
};
|
|
58
56
|
})
|
|
59
57
|
);
|
|
@@ -104,7 +102,7 @@ function titleText(entry, value) {
|
|
|
104
102
|
return String(value);
|
|
105
103
|
}
|
|
106
104
|
function relationTitle(key, id) {
|
|
107
|
-
const target = cmsConfig[props.config.fields[key]
|
|
105
|
+
const target = cmsConfig[relationTarget(props.config.fields[key] ?? {})];
|
|
108
106
|
const known = props.relations?.[key]?.[id];
|
|
109
107
|
const title = known !== void 0 ? titleText(target, known) : fetchedTitles[`${key}:${id}`];
|
|
110
108
|
return title || `#${id}`;
|
|
@@ -113,7 +111,7 @@ async function resolveTitle(key, id) {
|
|
|
113
111
|
if (import.meta.server) return;
|
|
114
112
|
const cacheKey = `${key}:${id}`;
|
|
115
113
|
if (props.relations?.[key]?.[id] !== void 0 || fetchedTitles[cacheKey] !== void 0) return;
|
|
116
|
-
const to = props.config.fields[key]
|
|
114
|
+
const to = relationTarget(props.config.fields[key] ?? {});
|
|
117
115
|
if (!to) return;
|
|
118
116
|
fetchedTitles[cacheKey] = "";
|
|
119
117
|
try {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<KSegmentedControl
|
|
3
3
|
v-model="model"
|
|
4
|
-
class="cms-
|
|
4
|
+
class="cms-code"
|
|
5
5
|
:options="options"
|
|
6
6
|
size="sm"
|
|
7
|
+
:disabled="false"
|
|
7
8
|
required
|
|
8
9
|
aria-label="Content language"
|
|
9
10
|
/>
|
|
@@ -12,20 +13,43 @@
|
|
|
12
13
|
<script setup>
|
|
13
14
|
import { SegmentedControl as KSegmentedControl } from "@xleddyl/443-components-vue";
|
|
14
15
|
import { computed } from "#imports";
|
|
16
|
+
import { translationSummary } from "../../../shared/translations";
|
|
15
17
|
import { useCmsRuntime } from "../../composables/cms-runtime";
|
|
16
18
|
const props = defineProps({
|
|
17
|
-
|
|
19
|
+
progress: { type: [Object, null], required: false }
|
|
18
20
|
});
|
|
19
21
|
const model = defineModel({ type: String, ...{ required: true } });
|
|
20
22
|
const { i18n } = useCmsRuntime();
|
|
23
|
+
function stateOf(locale) {
|
|
24
|
+
const progress = props.progress?.[locale];
|
|
25
|
+
if (locale === i18n.defaultLocale || !progress?.total) return null;
|
|
26
|
+
return progress.state;
|
|
27
|
+
}
|
|
28
|
+
function titleOf(locale) {
|
|
29
|
+
const progress = props.progress?.[locale];
|
|
30
|
+
if (!progress) return void 0;
|
|
31
|
+
if (locale === i18n.defaultLocale) {
|
|
32
|
+
return progress.values ? `${locale}: default language` : `${locale}: empty`;
|
|
33
|
+
}
|
|
34
|
+
if (!progress.total) return progress.values ? void 0 : `${locale}: empty`;
|
|
35
|
+
return `${locale}: ${translationSummary(progress)}`;
|
|
36
|
+
}
|
|
37
|
+
const DOT_TONES = {
|
|
38
|
+
complete: "success",
|
|
39
|
+
partial: "warning",
|
|
40
|
+
missing: "danger"
|
|
41
|
+
};
|
|
21
42
|
const options = computed(
|
|
22
43
|
() => i18n.locales.map((locale) => {
|
|
23
|
-
const
|
|
44
|
+
const state = stateOf(locale);
|
|
24
45
|
return {
|
|
25
46
|
value: locale,
|
|
26
47
|
label: locale,
|
|
27
|
-
title:
|
|
28
|
-
muted:
|
|
48
|
+
title: titleOf(locale),
|
|
49
|
+
muted: !!props.progress && !props.progress[locale]?.values,
|
|
50
|
+
dot: !!state,
|
|
51
|
+
dotTone: state ? DOT_TONES[state] : void 0,
|
|
52
|
+
dotLabel: state ? titleOf(locale) : void 0
|
|
29
53
|
};
|
|
30
54
|
})
|
|
31
55
|
);
|
|
@@ -4,6 +4,8 @@ type __VLS_Props = {
|
|
|
4
4
|
item: MediaItem | null;
|
|
5
5
|
library: CmsMediaLibrary;
|
|
6
6
|
readOnly: boolean;
|
|
7
|
+
canEdit?: boolean;
|
|
8
|
+
canDelete?: boolean;
|
|
7
9
|
};
|
|
8
10
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
11
|
delete: (item: MediaItem) => any;
|