@xleddyl/nuxt-cms 0.9.3 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/module.d.mts +20 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1037 -148
- package/dist/runtime/app/blocks/CmsBlocks.d.vue.ts +1 -1
- package/dist/runtime/app/blocks/CmsBlocks.vue +57 -9
- package/dist/runtime/app/blocks/CmsBlocks.vue.d.ts +1 -1
- package/dist/runtime/app/blocks/CmsField.d.ts +24 -0
- package/dist/runtime/app/blocks/CmsField.js +16 -0
- package/dist/runtime/app/blocks/node.d.ts +37 -0
- package/dist/runtime/app/blocks/node.js +17 -0
- package/dist/runtime/app/blocks/resolve.d.ts +18 -0
- package/dist/runtime/app/blocks/resolve.js +34 -0
- package/dist/runtime/app/components/cms/BlockPicker.d.vue.ts +22 -0
- package/dist/runtime/app/components/cms/BlockPicker.vue +87 -0
- package/dist/runtime/app/components/cms/BlockPicker.vue.d.ts +22 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.d.vue.ts +38 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.vue +44 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.vue.d.ts +38 -0
- package/dist/runtime/app/components/cms/BlockTree.d.vue.ts +29 -0
- package/dist/runtime/app/components/cms/BlockTree.vue +322 -0
- package/dist/runtime/app/components/cms/BlockTree.vue.d.ts +29 -0
- package/dist/runtime/app/components/cms/BlocksField.vue +569 -218
- package/dist/runtime/app/components/cms/BrandMark.vue +7 -13
- package/dist/runtime/app/components/cms/ConfirmGroups.vue +15 -13
- package/dist/runtime/app/components/cms/{BlockPalette.vue.d.ts → EditorHistory.d.vue.ts} +6 -5
- package/dist/runtime/app/components/cms/EditorHistory.vue +34 -0
- package/dist/runtime/app/components/cms/{BlockPalette.d.vue.ts → EditorHistory.vue.d.ts} +6 -5
- package/dist/runtime/app/components/cms/EntryDrawer.d.vue.ts +11 -5
- package/dist/runtime/app/components/cms/EntryDrawer.vue +183 -152
- package/dist/runtime/app/components/cms/EntryDrawer.vue.d.ts +11 -5
- package/dist/runtime/app/components/cms/EntryForm.d.vue.ts +16 -4
- package/dist/runtime/app/components/cms/EntryForm.vue +106 -146
- package/dist/runtime/app/components/cms/EntryForm.vue.d.ts +16 -4
- package/dist/runtime/app/components/cms/FieldInput.vue +10 -2
- package/dist/runtime/app/components/cms/FormSections.d.vue.ts +22 -0
- package/dist/runtime/app/components/cms/FormSections.vue +71 -0
- package/dist/runtime/app/components/cms/FormSections.vue.d.ts +22 -0
- package/dist/runtime/app/components/cms/ImportModal.vue +46 -58
- package/dist/runtime/app/components/cms/LinkField.d.vue.ts +16 -0
- package/dist/runtime/app/components/cms/LinkField.vue +250 -0
- package/dist/runtime/app/components/cms/LinkField.vue.d.ts +16 -0
- package/dist/runtime/app/components/cms/ListFilters.vue +10 -12
- package/dist/runtime/app/components/cms/LocaleSwitch.d.vue.ts +2 -1
- package/dist/runtime/app/components/cms/LocaleSwitch.vue +29 -5
- package/dist/runtime/app/components/cms/LocaleSwitch.vue.d.ts +2 -1
- package/dist/runtime/app/components/cms/MediaDetail.d.vue.ts +2 -0
- package/dist/runtime/app/components/cms/MediaDetail.vue +112 -83
- package/dist/runtime/app/components/cms/MediaDetail.vue.d.ts +2 -0
- package/dist/runtime/app/components/cms/MediaField.vue +35 -25
- package/dist/runtime/app/components/cms/MediaFolderPicker.vue +26 -71
- package/dist/runtime/app/components/cms/MediaGallery.d.vue.ts +1 -0
- package/dist/runtime/app/components/cms/MediaGallery.vue +442 -419
- package/dist/runtime/app/components/cms/MediaGallery.vue.d.ts +1 -0
- package/dist/runtime/app/components/cms/MediaThumb.vue +9 -25
- package/dist/runtime/app/components/cms/MediaUpload.vue +1 -1
- package/dist/runtime/app/components/cms/{BlockOutline.d.vue.ts → NestedBlockList.d.vue.ts} +5 -5
- package/dist/runtime/app/components/cms/NestedBlockList.vue +87 -0
- package/dist/runtime/app/components/cms/{BlockOutline.vue.d.ts → NestedBlockList.vue.d.ts} +5 -5
- package/dist/runtime/app/components/cms/PoweredBy.vue +12 -5
- package/dist/runtime/app/components/cms/PresetModal.d.vue.ts +18 -0
- package/dist/runtime/app/components/cms/PresetModal.vue +70 -0
- package/dist/runtime/app/components/cms/PresetModal.vue.d.ts +18 -0
- package/dist/runtime/app/components/cms/RelationField.vue +2 -8
- package/dist/runtime/app/components/cms/SettingsAccount.vue +60 -71
- package/dist/runtime/app/components/cms/SettingsColumns.vue +47 -69
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.vue +21 -0
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntries.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntries.vue +50 -0
- package/dist/runtime/app/components/cms/SettingsEntries.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntry.d.vue.ts +1 -10
- package/dist/runtime/app/components/cms/SettingsEntry.vue +11 -95
- package/dist/runtime/app/components/cms/SettingsEntry.vue.d.ts +1 -10
- package/dist/runtime/app/components/cms/SettingsEntryActions.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryActions.vue +42 -0
- package/dist/runtime/app/components/cms/SettingsEntryActions.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.vue +21 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.vue +17 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsLayout.vue +18 -14
- package/dist/runtime/app/components/cms/SettingsPresetForm.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsPresetForm.vue +60 -0
- package/dist/runtime/app/components/cms/SettingsPresetForm.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsPresets.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsPresets.vue +65 -0
- package/dist/runtime/app/components/cms/SettingsPresets.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.d.vue.ts +32 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.vue +45 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.vue.d.ts +32 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.vue +59 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.vue +77 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.vue +117 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.d.vue.ts +17 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.vue +43 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.vue.d.ts +17 -0
- package/dist/runtime/app/components/cms/SettingsSite.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsSite.vue +140 -0
- package/dist/runtime/app/components/cms/SettingsSite.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.d.vue.ts +8 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.vue +82 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.vue.d.ts +8 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.vue +179 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsUsers.d.vue.ts +9 -6
- package/dist/runtime/app/components/cms/SettingsUsers.vue +88 -234
- package/dist/runtime/app/components/cms/SettingsUsers.vue.d.ts +9 -6
- package/dist/runtime/app/components/cms/SharePreview.d.vue.ts +18 -0
- package/dist/runtime/app/components/cms/SharePreview.vue +219 -0
- package/dist/runtime/app/components/cms/SharePreview.vue.d.ts +18 -0
- package/dist/runtime/app/components/cms/SlugField.vue +5 -3
- package/dist/runtime/app/components/cms/StatusBadge.vue +9 -8
- package/dist/runtime/app/components/cms/TranslationBadges.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/TranslationBadges.vue +45 -0
- package/dist/runtime/app/components/cms/TranslationBadges.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/TranslationMenu.d.vue.ts +17 -0
- package/dist/runtime/app/components/cms/TranslationMenu.vue +28 -0
- package/dist/runtime/app/components/cms/TranslationMenu.vue.d.ts +17 -0
- package/dist/runtime/app/components/cms/VisualEditor.d.vue.ts +22 -4
- package/dist/runtime/app/components/cms/VisualEditor.vue +1152 -335
- package/dist/runtime/app/components/cms/VisualEditor.vue.d.ts +22 -4
- package/dist/runtime/app/components/cms/WelcomeModal.vue +32 -50
- package/dist/runtime/app/composables/cms-clipboard.d.ts +8 -0
- package/dist/runtime/app/composables/cms-clipboard.js +38 -0
- package/dist/runtime/app/composables/cms-confirm.d.ts +6 -8
- package/dist/runtime/app/composables/cms-confirm.js +5 -7
- package/dist/runtime/app/composables/cms-entry-disabled.d.ts +5 -1
- package/dist/runtime/app/composables/cms-entry-disabled.js +7 -0
- package/dist/runtime/app/composables/cms-entry-form.d.ts +15 -0
- package/dist/runtime/app/composables/cms-entry-form.js +40 -0
- package/dist/runtime/app/composables/cms-entry-settings.d.ts +30 -0
- package/dist/runtime/app/composables/cms-entry-settings.js +122 -0
- package/dist/runtime/app/composables/cms-entry.d.ts +5 -1
- package/dist/runtime/app/composables/cms-entry.js +36 -11
- package/dist/runtime/app/composables/cms-history.d.ts +10 -0
- package/dist/runtime/app/composables/cms-history.js +24 -0
- package/dist/runtime/app/composables/cms-link-targets.d.ts +10 -0
- package/dist/runtime/app/composables/cms-link-targets.js +40 -0
- package/dist/runtime/app/composables/cms-link-usage.d.ts +1 -0
- package/dist/runtime/app/composables/cms-link-usage.js +45 -0
- package/dist/runtime/app/composables/cms-media-library.d.ts +19 -9
- package/dist/runtime/app/composables/cms-media-library.js +31 -13
- package/dist/runtime/app/composables/cms-media-uploader.js +6 -20
- package/dist/runtime/app/composables/cms-permissions.d.ts +18 -0
- package/dist/runtime/app/composables/cms-permissions.js +54 -0
- package/dist/runtime/app/composables/cms-presets.d.ts +11 -0
- package/dist/runtime/app/composables/cms-presets.js +40 -0
- package/dist/runtime/app/composables/cms-preview-mode.d.ts +4 -0
- package/dist/runtime/app/composables/cms-preview-mode.js +8 -0
- package/dist/runtime/app/composables/cms-query.d.ts +3 -0
- package/dist/runtime/app/composables/cms-query.js +45 -20
- package/dist/runtime/app/composables/cms-record-list.d.ts +31 -0
- package/dist/runtime/app/composables/cms-record-list.js +75 -0
- package/dist/runtime/app/composables/cms-route.d.ts +6 -0
- package/dist/runtime/app/composables/cms-route.js +36 -0
- package/dist/runtime/app/composables/cms-runtime.d.ts +1 -0
- package/dist/runtime/app/composables/cms-save-handoff.d.ts +4 -0
- package/dist/runtime/app/composables/cms-save-handoff.js +19 -0
- package/dist/runtime/app/composables/cms-seo.d.ts +12 -0
- package/dist/runtime/app/composables/cms-seo.js +69 -0
- package/dist/runtime/app/composables/cms-settings-form.d.ts +13 -0
- package/dist/runtime/app/composables/cms-settings-form.js +29 -0
- package/dist/runtime/app/composables/cms-settings-sections.d.ts +26 -0
- package/dist/runtime/app/composables/cms-settings-sections.js +181 -0
- package/dist/runtime/app/composables/cms-settings-stores.d.ts +52 -0
- package/dist/runtime/app/composables/cms-settings-stores.js +156 -0
- package/dist/runtime/app/composables/cms-settings.d.ts +3 -3
- package/dist/runtime/app/composables/cms-settings.js +14 -8
- package/dist/runtime/app/composables/cms-site-disabled.d.ts +7 -0
- package/dist/runtime/app/composables/cms-site-disabled.js +8 -0
- package/dist/runtime/app/composables/cms-site.d.ts +7 -0
- package/dist/runtime/app/composables/cms-site.js +22 -0
- package/dist/runtime/app/composables/cms-toast.d.ts +2 -8
- package/dist/runtime/app/composables/cms-toast.js +3 -9
- package/dist/runtime/app/composables/cms-translation-actions.d.ts +15 -0
- package/dist/runtime/app/composables/cms-translation-actions.js +108 -0
- package/dist/runtime/app/css-url.d.ts +4 -0
- package/dist/runtime/app/image/CmsImage.d.vue.ts +89 -0
- package/dist/runtime/app/image/CmsImage.vue +91 -0
- package/dist/runtime/app/image/CmsImage.vue.d.ts +89 -0
- package/dist/runtime/app/layouts/cms-admin.d.vue.ts +2 -2
- package/dist/runtime/app/layouts/cms-admin.vue +98 -76
- package/dist/runtime/app/layouts/cms-admin.vue.d.ts +2 -2
- package/dist/runtime/app/layouts/cms-editor.vue +7 -2
- package/dist/runtime/app/links/CmsLink.d.vue.ts +18 -0
- package/dist/runtime/app/links/CmsLink.vue +18 -0
- package/dist/runtime/app/links/CmsLink.vue.d.ts +18 -0
- package/dist/runtime/app/middleware/cms-auth.js +13 -1
- package/dist/runtime/app/pages/admin-collection.vue +473 -297
- package/dist/runtime/app/pages/admin-content.vue +190 -53
- package/dist/runtime/app/pages/admin-entry.vue +79 -75
- package/dist/runtime/app/pages/admin-index.vue +18 -5
- package/dist/runtime/app/pages/admin-login.vue +1 -1
- package/dist/runtime/app/pages/admin-logout.vue +1 -1
- package/dist/runtime/app/pages/admin-media.vue +3 -3
- package/dist/runtime/app/pages/admin-preview.vue +112 -24
- package/dist/runtime/app/plugins/cms-field.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-field.js +8 -0
- package/dist/runtime/app/plugins/cms-preview-banner.client.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-preview-banner.client.js +19 -0
- package/dist/runtime/app/plugins/cms-preview.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-preview.js +27 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.d.vue.ts +7 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.vue +63 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.vue.d.ts +7 -0
- package/dist/runtime/app/preview/PreviewOverlay.d.vue.ts +17 -3
- package/dist/runtime/app/preview/PreviewOverlay.vue +629 -166
- package/dist/runtime/app/preview/PreviewOverlay.vue.d.ts +17 -3
- package/dist/runtime/app/preview/field-marker.d.ts +12 -0
- package/dist/runtime/app/preview/field-marker.js +20 -0
- package/dist/runtime/app/preview/inline-text.d.ts +15 -0
- package/dist/runtime/app/preview/inline-text.js +158 -0
- package/dist/runtime/app/utils/block-editor.d.ts +22 -0
- package/dist/runtime/app/utils/block-editor.js +12 -0
- package/dist/runtime/app/utils/keyboard.d.ts +6 -0
- package/dist/runtime/app/utils/keyboard.js +52 -0
- package/dist/runtime/app/utils/redirects.d.ts +6 -0
- package/dist/runtime/app/utils/redirects.js +7 -0
- package/dist/runtime/app/utils/ui.d.ts +8 -0
- package/dist/runtime/app/utils/ui.js +15 -1
- package/dist/runtime/app/utils/users.d.ts +15 -0
- package/dist/runtime/app/utils/users.js +14 -0
- package/dist/runtime/assets/cms.css +1 -1
- package/dist/runtime/generate.js +16 -2
- package/dist/runtime/server/api/collection-export.get.js +3 -2
- package/dist/runtime/server/api/collection-import.post.js +39 -11
- package/dist/runtime/server/api/collection.get.js +29 -10
- package/dist/runtime/server/api/collection.post.js +28 -11
- package/dist/runtime/server/api/collection.put.js +35 -13
- package/dist/runtime/server/api/item.delete.js +19 -7
- package/dist/runtime/server/api/item.get.js +3 -2
- package/dist/runtime/server/api/item.put.js +52 -18
- package/dist/runtime/server/api/link-usage.post.d.ts +5 -0
- package/dist/runtime/server/api/link-usage.post.js +21 -0
- package/dist/runtime/server/api/media-delete.post.js +4 -2
- package/dist/runtime/server/api/media-download.get.js +2 -2
- package/dist/runtime/server/api/media-folder.delete.js +8 -2
- package/dist/runtime/server/api/media-folder.patch.js +10 -2
- package/dist/runtime/server/api/media-folder.post.js +4 -2
- package/dist/runtime/server/api/media-move.post.js +7 -4
- package/dist/runtime/server/api/media-presign.post.js +2 -2
- package/dist/runtime/server/api/media-upload.put.js +2 -2
- package/dist/runtime/server/api/media-usage.post.d.ts +2 -4
- package/dist/runtime/server/api/media-usage.post.js +13 -9
- package/dist/runtime/server/api/media.delete.js +4 -2
- package/dist/runtime/server/api/media.get.js +22 -7
- package/dist/runtime/server/api/media.post.js +4 -2
- package/dist/runtime/server/api/media.put.js +33 -16
- package/dist/runtime/server/api/preset.delete.d.ts +4 -0
- package/dist/runtime/server/api/preset.delete.js +9 -0
- package/dist/runtime/server/api/preset.put.d.ts +3 -0
- package/dist/runtime/server/api/preset.put.js +23 -0
- package/dist/runtime/server/api/presets-field.get.d.ts +3 -0
- package/dist/runtime/server/api/presets-field.get.js +13 -0
- package/dist/runtime/server/api/presets-field.post.d.ts +3 -0
- package/dist/runtime/server/api/presets-field.post.js +36 -0
- package/dist/runtime/server/api/presets.get.d.ts +3 -0
- package/dist/runtime/server/api/presets.get.js +7 -0
- package/dist/runtime/server/api/preview-link.delete.d.ts +4 -0
- package/dist/runtime/server/api/preview-link.delete.js +15 -0
- package/dist/runtime/server/api/preview-links.get.d.ts +3 -0
- package/dist/runtime/server/api/preview-links.get.js +10 -0
- package/dist/runtime/server/api/preview-links.post.d.ts +3 -0
- package/dist/runtime/server/api/preview-links.post.js +17 -0
- package/dist/runtime/server/api/preview.get.d.ts +3 -0
- package/dist/runtime/server/api/preview.get.js +7 -0
- package/dist/runtime/server/api/redirect.delete.d.ts +4 -0
- package/dist/runtime/server/api/redirect.delete.js +10 -0
- package/dist/runtime/server/api/redirect.put.d.ts +3 -0
- package/dist/runtime/server/api/redirect.put.js +8 -0
- package/dist/runtime/server/api/redirects-import.post.d.ts +3 -0
- package/dist/runtime/server/api/redirects-import.post.js +13 -0
- package/dist/runtime/server/api/redirects.get.d.ts +3 -0
- package/dist/runtime/server/api/redirects.get.js +7 -0
- package/dist/runtime/server/api/redirects.post.d.ts +3 -0
- package/dist/runtime/server/api/redirects.post.js +7 -0
- package/dist/runtime/server/api/search.get.js +8 -3
- package/dist/runtime/server/api/settings.delete.js +2 -2
- package/dist/runtime/server/api/settings.get.js +4 -2
- package/dist/runtime/server/api/settings.put.js +2 -2
- package/dist/runtime/server/api/site.get.d.ts +3 -0
- package/dist/runtime/server/api/site.get.js +7 -0
- package/dist/runtime/server/api/site.put.d.ts +3 -0
- package/dist/runtime/server/api/site.put.js +16 -0
- package/dist/runtime/server/api/tags.get.js +3 -2
- package/dist/runtime/server/api/user.delete.js +8 -2
- package/dist/runtime/server/api/user.put.js +14 -4
- package/dist/runtime/server/api/users.get.js +2 -2
- package/dist/runtime/server/api/users.post.js +8 -4
- package/dist/runtime/server/middleware/hidden-site.d.ts +2 -0
- package/dist/runtime/server/middleware/hidden-site.js +8 -0
- package/dist/runtime/server/middleware/preview-links.d.ts +2 -0
- package/dist/runtime/server/middleware/preview-links.js +6 -0
- package/dist/runtime/server/middleware/redirects.d.ts +2 -0
- package/dist/runtime/server/middleware/redirects.js +18 -0
- package/dist/runtime/server/plugins/session-validate.js +4 -1
- package/dist/runtime/server/plugins/webhooks.d.ts +3 -0
- package/dist/runtime/server/plugins/webhooks.js +27 -0
- package/dist/runtime/server/routes/graphql.js +5 -3
- package/dist/runtime/server/routes/robots.d.ts +2 -0
- package/dist/runtime/server/routes/robots.js +16 -0
- package/dist/runtime/server/routes/sitemap.d.ts +2 -0
- package/dist/runtime/server/routes/sitemap.js +67 -0
- package/dist/runtime/server/utils/cached-value.d.ts +5 -0
- package/dist/runtime/server/utils/cached-value.js +24 -0
- package/dist/runtime/server/utils/content-routes.d.ts +5 -0
- package/dist/runtime/server/utils/content-routes.js +29 -0
- package/dist/runtime/server/utils/field-rules.d.ts +19 -0
- package/dist/runtime/server/utils/field-rules.js +72 -0
- package/dist/runtime/server/utils/graphql.d.ts +3 -1
- package/dist/runtime/server/utils/graphql.js +145 -29
- package/dist/runtime/server/utils/hooks.d.ts +14 -0
- package/dist/runtime/server/utils/hooks.js +71 -0
- package/dist/runtime/server/utils/import.d.ts +7 -2
- package/dist/runtime/server/utils/import.js +108 -14
- package/dist/runtime/server/utils/link-usage.d.ts +4 -0
- package/dist/runtime/server/utils/link-usage.js +28 -0
- package/dist/runtime/server/utils/media-references.d.ts +6 -1
- package/dist/runtime/server/utils/media-references.js +49 -20
- package/dist/runtime/server/utils/media-usage.d.ts +2 -0
- package/dist/runtime/server/utils/media-usage.js +5 -3
- package/dist/runtime/server/utils/page-rows.d.ts +2 -0
- package/dist/runtime/server/utils/page-rows.js +42 -29
- package/dist/runtime/server/utils/permissions.d.ts +14 -0
- package/dist/runtime/server/utils/permissions.js +43 -0
- package/dist/runtime/server/utils/presets.d.ts +18 -0
- package/dist/runtime/server/utils/presets.js +68 -0
- package/dist/runtime/server/utils/preview-links.d.ts +207 -0
- package/dist/runtime/server/utils/preview-links.js +161 -0
- package/dist/runtime/server/utils/redirects.d.ts +31 -0
- package/dist/runtime/server/utils/redirects.js +240 -0
- package/dist/runtime/server/utils/registry.js +4 -1
- package/dist/runtime/server/utils/relations.d.ts +8 -0
- package/dist/runtime/server/utils/relations.js +25 -6
- package/dist/runtime/server/utils/require-admin.d.ts +0 -1
- package/dist/runtime/server/utils/require-admin.js +4 -8
- package/dist/runtime/server/utils/search.d.ts +1 -0
- package/dist/runtime/server/utils/search.js +44 -19
- package/dist/runtime/server/utils/single-row.d.ts +3 -0
- package/dist/runtime/server/utils/single-row.js +4 -0
- package/dist/runtime/server/utils/site.d.ts +23 -0
- package/dist/runtime/server/utils/site.js +79 -0
- package/dist/runtime/server/utils/sitemap.d.ts +12 -0
- package/dist/runtime/server/utils/sitemap.js +109 -0
- package/dist/runtime/server/utils/user-management.d.ts +4 -0
- package/dist/runtime/server/utils/user-management.js +20 -0
- package/dist/runtime/server/utils/users.d.ts +1 -1
- package/dist/runtime/server/utils/users.js +1 -1
- package/dist/runtime/server/utils/visibility.d.ts +1 -0
- package/dist/runtime/server/utils/visibility.js +6 -1
- package/dist/runtime/server/utils/webhooks.d.ts +24 -0
- package/dist/runtime/server/utils/webhooks.js +90 -0
- package/dist/runtime/shared/block-paths.d.ts +66 -0
- package/dist/runtime/shared/block-paths.js +310 -0
- package/dist/runtime/shared/block-picker.d.ts +18 -0
- package/dist/runtime/shared/block-picker.js +31 -0
- package/dist/runtime/shared/block-signature.d.ts +4 -0
- package/dist/runtime/shared/block-signature.js +46 -0
- package/dist/runtime/shared/clipboard.d.ts +31 -0
- package/dist/runtime/shared/clipboard.js +206 -0
- package/dist/runtime/shared/conditions.d.ts +36 -0
- package/dist/runtime/shared/conditions.js +100 -0
- package/dist/runtime/shared/content-routes.d.ts +42 -0
- package/dist/runtime/shared/content-routes.js +237 -0
- package/dist/runtime/shared/duplicate.js +2 -1
- package/dist/runtime/shared/editor-layout.d.ts +18 -0
- package/dist/runtime/shared/editor-layout.js +9 -0
- package/dist/runtime/shared/field-options.d.ts +21 -0
- package/dist/runtime/shared/field-options.js +90 -0
- package/dist/runtime/shared/graphql-sdl.d.ts +1 -0
- package/dist/runtime/shared/graphql-sdl.js +50 -26
- package/dist/runtime/shared/history.d.ts +27 -0
- package/dist/runtime/shared/history.js +123 -0
- package/dist/runtime/shared/hooks.d.ts +45 -0
- package/dist/runtime/shared/hooks.js +28 -0
- package/dist/runtime/shared/index.d.ts +90 -21
- package/dist/runtime/shared/index.js +121 -37
- package/dist/runtime/shared/inline-text.d.ts +38 -0
- package/dist/runtime/shared/inline-text.js +85 -0
- package/dist/runtime/shared/layout.d.ts +2 -1
- package/dist/runtime/shared/layout.js +3 -0
- package/dist/runtime/shared/links.d.ts +48 -0
- package/dist/runtime/shared/links.js +155 -0
- package/dist/runtime/shared/list-filters.d.ts +2 -0
- package/dist/runtime/shared/list-filters.js +2 -0
- package/dist/runtime/shared/media-focal.d.ts +30 -0
- package/dist/runtime/shared/media-focal.js +52 -0
- package/dist/runtime/shared/migrations-dir.d.ts +14 -0
- package/dist/runtime/shared/migrations-dir.js +48 -2
- package/dist/runtime/shared/presets.d.ts +67 -0
- package/dist/runtime/shared/presets.js +127 -0
- package/dist/runtime/shared/preview-links.d.ts +64 -0
- package/dist/runtime/shared/preview-links.js +54 -0
- package/dist/runtime/shared/preview.d.ts +124 -21
- package/dist/runtime/shared/preview.js +419 -81
- package/dist/runtime/shared/redirects.d.ts +75 -0
- package/dist/runtime/shared/redirects.js +230 -0
- package/dist/runtime/shared/roles.d.ts +57 -0
- package/dist/runtime/shared/roles.js +293 -0
- package/dist/runtime/shared/save-state.d.ts +8 -0
- package/dist/runtime/shared/save-state.js +15 -0
- package/dist/runtime/shared/search.d.ts +16 -1
- package/dist/runtime/shared/search.js +41 -7
- package/dist/runtime/shared/seo.d.ts +167 -0
- package/dist/runtime/shared/seo.js +335 -0
- package/dist/runtime/shared/transfer.js +2 -1
- package/dist/runtime/shared/translations.d.ts +29 -0
- package/dist/runtime/shared/translations.js +123 -0
- package/dist/runtime/shared/users.d.ts +1 -1
- package/dist/runtime/shared/validation.d.ts +23 -1
- package/dist/runtime/shared/validation.js +214 -64
- package/dist/runtime/webhooks.d.ts +33 -0
- package/dist/runtime/webhooks.js +57 -0
- package/dist/types.d.mts +5 -1
- package/package.json +6 -2
- package/dist/runtime/app/components/cms/BlockOutline.vue +0 -88
- package/dist/runtime/app/components/cms/BlockPalette.vue +0 -31
- package/dist/runtime/app/components/cms/SettingsModal.d.vue.ts +0 -12
- package/dist/runtime/app/components/cms/SettingsModal.vue +0 -126
- package/dist/runtime/app/components/cms/SettingsModal.vue.d.ts +0 -12
- package/dist/runtime/app/composables/cms-field-focus.d.ts +0 -4
- package/dist/runtime/app/composables/cms-field-focus.js +0 -20
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<KFormDrawer
|
|
3
3
|
:open="!!item"
|
|
4
4
|
:title="shown ? mediaFilename(shown.key) : ''"
|
|
5
5
|
size="lg"
|
|
6
|
+
:form="form"
|
|
7
|
+
:readonly="!canEdit"
|
|
8
|
+
:deletable="!readOnly && canDelete"
|
|
6
9
|
@update:open="(value) => !value && emit('close')"
|
|
10
|
+
@delete="item && emit('delete', item)"
|
|
7
11
|
>
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
<KStack v-if="shown" gap="lg">
|
|
13
|
+
<KFormField
|
|
14
|
+
v-if="shown.type === 'image' && shown.url"
|
|
15
|
+
label="Focal point"
|
|
16
|
+
:description="
|
|
17
|
+
focalEditable ? 'Click or drag on the image to mark the part that must stay visible when it is cropped.' : void 0
|
|
18
|
+
"
|
|
19
|
+
>
|
|
20
|
+
<KFocalPointInput
|
|
21
|
+
v-model="focal"
|
|
12
22
|
:src="shown.url"
|
|
13
23
|
:alt="shown.alt ?? ''"
|
|
24
|
+
:readonly="!focalEditable"
|
|
25
|
+
empty-text="Center (default)"
|
|
26
|
+
clearable
|
|
14
27
|
/>
|
|
28
|
+
</KFormField>
|
|
29
|
+
<div v-else class="cms-media-detail-preview">
|
|
15
30
|
<video
|
|
16
|
-
v-
|
|
31
|
+
v-if="shown.type === 'video' && shown.url"
|
|
17
32
|
:src="shown.url"
|
|
18
33
|
controls
|
|
19
34
|
preload="metadata"
|
|
@@ -54,102 +69,100 @@
|
|
|
54
69
|
/>
|
|
55
70
|
</KStack>
|
|
56
71
|
|
|
57
|
-
<
|
|
58
|
-
<KDescriptionList :items="facts">
|
|
59
|
-
<template #value="{ item: fact }">
|
|
60
|
-
<span
|
|
61
|
-
class="cms-media-detail-fact"
|
|
62
|
-
:class="{ 'k-mono': fact.key === 'key' }"
|
|
63
|
-
:title="fact.value == null ? void 0 : String(fact.value)"
|
|
64
|
-
>{{ fact.value }}</span
|
|
65
|
-
>
|
|
72
|
+
<KCard variant="subtle" padding="sm">
|
|
73
|
+
<KDescriptionList :items="facts" layout="inline">
|
|
74
|
+
<template #value-key="{ item: fact }">
|
|
75
|
+
<span class="k-mono">{{ fact.value }}</span>
|
|
66
76
|
</template>
|
|
67
77
|
</KDescriptionList>
|
|
68
|
-
</
|
|
78
|
+
</KCard>
|
|
69
79
|
|
|
70
80
|
<KStack gap="md">
|
|
71
|
-
<KFormField label="Alt text">
|
|
81
|
+
<KFormField label="Alt text" name="alt">
|
|
72
82
|
<KInput
|
|
73
|
-
v-model="alt"
|
|
83
|
+
v-model="draft.alt"
|
|
74
84
|
placeholder="Describe the image for screen readers"
|
|
75
|
-
|
|
85
|
+
:maxlength="ALT_MAX"
|
|
76
86
|
/>
|
|
77
87
|
</KFormField>
|
|
78
|
-
<KFormField v-if="!readOnly" label="Folder">
|
|
79
|
-
<CmsMediaFolderPicker v-model="folder" :folders="folders" />
|
|
88
|
+
<KFormField v-if="!readOnly && canEdit" label="Folder" name="folder">
|
|
89
|
+
<CmsMediaFolderPicker v-model="draft.folder" :folders="folders" />
|
|
80
90
|
</KFormField>
|
|
81
91
|
</KStack>
|
|
82
92
|
|
|
83
|
-
<section
|
|
84
|
-
<
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
Could not check where this file is used.
|
|
90
|
-
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
<template #footer>
|
|
108
|
-
<KButton
|
|
109
|
-
v-if="!readOnly"
|
|
110
|
-
label="Delete"
|
|
111
|
-
:icon="cmsIcon('trash')"
|
|
112
|
-
variant="ghost"
|
|
113
|
-
tone="danger"
|
|
114
|
-
@click="item && emit('delete', item)"
|
|
115
|
-
/>
|
|
116
|
-
<span v-else />
|
|
117
|
-
<KStack direction="row" gap="sm" align="center">
|
|
118
|
-
<KButton label="Close" variant="ghost" tone="neutral" @click="emit('close')" />
|
|
119
|
-
<KButton label="Save" :loading="saving" :disabled="!dirty" @click="save" />
|
|
93
|
+
<KStack as="section" gap="sm">
|
|
94
|
+
<KSeparator variant="heading" label="Used in" :level="3" />
|
|
95
|
+
<KFieldMessage
|
|
96
|
+
v-if="!usageLoading && usageList === null"
|
|
97
|
+
tone="neutral"
|
|
98
|
+
:icon="false"
|
|
99
|
+
message="Could not check where this file is used."
|
|
100
|
+
/>
|
|
101
|
+
<KRecordList
|
|
102
|
+
v-else-if="usageLoading || usageItems.length || !hiddenUsage"
|
|
103
|
+
:items="usageItems"
|
|
104
|
+
:loading="usageLoading"
|
|
105
|
+
:skeleton-rows="2"
|
|
106
|
+
label="Used in"
|
|
107
|
+
empty-text="Not used in any entry."
|
|
108
|
+
empty-variant="hint"
|
|
109
|
+
/>
|
|
110
|
+
<KFieldMessage
|
|
111
|
+
v-if="!usageLoading && hiddenUsage"
|
|
112
|
+
tone="neutral"
|
|
113
|
+
:icon="false"
|
|
114
|
+
:message="otherEntriesLabel(hiddenUsage)"
|
|
115
|
+
/>
|
|
120
116
|
</KStack>
|
|
121
|
-
</
|
|
122
|
-
</
|
|
117
|
+
</KStack>
|
|
118
|
+
</KFormDrawer>
|
|
123
119
|
</template>
|
|
124
120
|
|
|
125
121
|
<script setup>
|
|
126
122
|
import { computed, ref, useRequestURL, watch } from "#imports";
|
|
127
123
|
import {
|
|
128
124
|
Button as KButton,
|
|
125
|
+
Card as KCard,
|
|
129
126
|
CopyButton as KCopyButton,
|
|
130
127
|
DescriptionList as KDescriptionList,
|
|
131
|
-
|
|
128
|
+
FieldMessage as KFieldMessage,
|
|
129
|
+
FocalPointInput as KFocalPointInput,
|
|
130
|
+
FormDrawer as KFormDrawer,
|
|
132
131
|
FormField as KFormField,
|
|
133
132
|
Icon as KIcon,
|
|
134
133
|
Input as KInput,
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
RecordList as KRecordList,
|
|
135
|
+
Separator as KSeparator,
|
|
136
|
+
Stack as KStack,
|
|
137
|
+
toast,
|
|
138
|
+
useForm
|
|
137
139
|
} from "@xleddyl/443-components-vue";
|
|
138
|
-
import {
|
|
139
|
-
|
|
140
|
+
import {
|
|
141
|
+
focalPointOf,
|
|
142
|
+
formatFileSize,
|
|
143
|
+
groupMediaUsage,
|
|
144
|
+
mediaFilename,
|
|
145
|
+
mediaIconFor,
|
|
146
|
+
otherEntriesLabel
|
|
147
|
+
} from "#nuxt-cms";
|
|
148
|
+
import { usageItem } from "../../composables/cms-media-library";
|
|
140
149
|
import { cmsIcon } from "../../utils/ui";
|
|
141
150
|
const props = defineProps({
|
|
142
151
|
item: { type: [Object, null], required: true },
|
|
143
152
|
library: { type: null, required: true },
|
|
144
|
-
readOnly: { type: Boolean, required: true }
|
|
153
|
+
readOnly: { type: Boolean, required: true },
|
|
154
|
+
canEdit: { type: Boolean, required: false, default: true },
|
|
155
|
+
canDelete: { type: Boolean, required: false, default: true }
|
|
145
156
|
});
|
|
146
157
|
const emit = defineEmits(["close", "delete"]);
|
|
147
158
|
const folders = computed(() => props.library.folders.value);
|
|
148
|
-
const
|
|
149
|
-
const
|
|
150
|
-
const
|
|
159
|
+
const ALT_MAX = 1024;
|
|
160
|
+
const draft = ref({ alt: "", folder: null, focalX: null, focalY: null });
|
|
161
|
+
const form = useForm({ values: draft, onSubmit: save });
|
|
151
162
|
const usageList = ref([]);
|
|
163
|
+
const hiddenUsage = ref(0);
|
|
152
164
|
const usageLoading = ref(false);
|
|
165
|
+
const usageItems = computed(() => groupMediaUsage(usageList.value ?? []).map(usageItem));
|
|
153
166
|
const requestUrl = useRequestURL();
|
|
154
167
|
const lastItem = ref(props.item);
|
|
155
168
|
watch(
|
|
@@ -163,19 +176,35 @@ watch(
|
|
|
163
176
|
() => props.item?.key,
|
|
164
177
|
async (key) => {
|
|
165
178
|
if (!props.item || !key) return;
|
|
166
|
-
|
|
167
|
-
|
|
179
|
+
const point = focalPointOf(props.item);
|
|
180
|
+
form.reset({
|
|
181
|
+
alt: props.item.alt ?? "",
|
|
182
|
+
folder: props.item.folder ?? null,
|
|
183
|
+
focalX: point?.x ?? null,
|
|
184
|
+
focalY: point?.y ?? null
|
|
185
|
+
});
|
|
168
186
|
usageLoading.value = true;
|
|
169
187
|
const usage = await props.library.usage([key]);
|
|
170
188
|
if (props.item?.key !== key) return;
|
|
171
|
-
usageList.value = usage ? usage[key] ?? [] : null;
|
|
189
|
+
usageList.value = usage ? usage.usage[key] ?? [] : null;
|
|
190
|
+
hiddenUsage.value = usage?.hidden[key] ?? 0;
|
|
172
191
|
usageLoading.value = false;
|
|
173
192
|
},
|
|
174
193
|
{ immediate: true }
|
|
175
194
|
);
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
195
|
+
const focal = computed({
|
|
196
|
+
get: () => draft.value.focalX == null || draft.value.focalY == null ? null : { x: draft.value.focalX, y: draft.value.focalY },
|
|
197
|
+
set: (point) => {
|
|
198
|
+
draft.value.focalX = point?.x ?? null;
|
|
199
|
+
draft.value.focalY = point?.y ?? null;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
const focalEditable = computed(() => props.canEdit && !!props.item);
|
|
203
|
+
const focalChanged = computed(() => {
|
|
204
|
+
const saved = focalPointOf(props.item);
|
|
205
|
+
const current = focal.value;
|
|
206
|
+
if (!saved || !current) return saved !== current;
|
|
207
|
+
return saved.x !== current.x || saved.y !== current.y;
|
|
179
208
|
});
|
|
180
209
|
const downloadHref = computed(
|
|
181
210
|
() => shown.value ? `/api/cms/admin/media/download?key=${encodeURIComponent(shown.value.key)}` : ""
|
|
@@ -206,14 +235,14 @@ const facts = computed(() => {
|
|
|
206
235
|
list.push({ key: "key", label: "Key", value: item.key });
|
|
207
236
|
return list;
|
|
208
237
|
});
|
|
209
|
-
async function save() {
|
|
210
|
-
if (!props.item
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
...
|
|
238
|
+
async function save(values) {
|
|
239
|
+
if (!props.item) return;
|
|
240
|
+
await props.library.updateItem(props.item.key, {
|
|
241
|
+
alt: values.alt.trim() || null,
|
|
242
|
+
...props.readOnly ? {} : { folder: values.folder },
|
|
243
|
+
...focalChanged.value ? { focalX: values.focalX, focalY: values.focalY } : {}
|
|
215
244
|
});
|
|
216
|
-
|
|
217
|
-
|
|
245
|
+
toast.success("Saved");
|
|
246
|
+
emit("close");
|
|
218
247
|
}
|
|
219
248
|
</script>
|
|
@@ -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;
|
|
@@ -4,27 +4,29 @@
|
|
|
4
4
|
variant="outline"
|
|
5
5
|
padding="none"
|
|
6
6
|
class="cms-media-single"
|
|
7
|
-
:class="{ 'is-
|
|
7
|
+
:class="{ 'is-disabled': disabled }"
|
|
8
8
|
>
|
|
9
9
|
<button
|
|
10
10
|
type="button"
|
|
11
|
-
class="cms-
|
|
11
|
+
class="cms-tile-preview"
|
|
12
12
|
aria-label="Replace media"
|
|
13
|
+
:disabled="disabled || void 0"
|
|
13
14
|
@click="openGallery"
|
|
14
15
|
>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
<KThumbnail
|
|
17
|
+
:src="url ?? void 0"
|
|
18
|
+
:kind="kind"
|
|
19
|
+
aspect="4/3"
|
|
20
|
+
rounded="none"
|
|
21
|
+
:missing="missing"
|
|
22
|
+
missing-text="Not found in the media library"
|
|
22
23
|
/>
|
|
23
|
-
<KIcon v-else :name="cmsIcon(icon)" />
|
|
24
24
|
</button>
|
|
25
|
-
<div class="cms-
|
|
26
|
-
<
|
|
27
|
-
|
|
25
|
+
<div class="cms-tile-bar">
|
|
26
|
+
<KTooltip :text="model">
|
|
27
|
+
<span class="cms-tile-name">{{ mediaFilename(model) }}</span>
|
|
28
|
+
</KTooltip>
|
|
29
|
+
<KStack v-if="!disabled" direction="row" gap="none" align="center">
|
|
28
30
|
<KButton
|
|
29
31
|
:icon="cmsIcon('arrow-path')"
|
|
30
32
|
size="xs"
|
|
@@ -45,15 +47,18 @@
|
|
|
45
47
|
</div>
|
|
46
48
|
</KCard>
|
|
47
49
|
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
<KCard
|
|
51
|
+
v-else
|
|
52
|
+
variant="dashed"
|
|
53
|
+
as="button"
|
|
54
|
+
:icon="cmsIcon('photo')"
|
|
55
|
+
title="Choose"
|
|
56
|
+
:disabled="disabled"
|
|
57
|
+
class="cms-media-single-add"
|
|
58
|
+
@click="openGallery"
|
|
59
|
+
/>
|
|
52
60
|
|
|
53
|
-
<
|
|
54
|
-
<KIcon :name="cmsIcon('exclamation-triangle')" />
|
|
55
|
-
<span>Not found in the media library</span>
|
|
56
|
-
</p>
|
|
61
|
+
<KFieldMessage v-if="missing" tone="warning" message="Not found in the media library" />
|
|
57
62
|
|
|
58
63
|
<KModal v-model:open="galleryOpen" title="Media" size="lg">
|
|
59
64
|
<CmsMediaGallery
|
|
@@ -71,11 +76,14 @@ import { computed, ref, useState } from "#imports";
|
|
|
71
76
|
import {
|
|
72
77
|
Button as KButton,
|
|
73
78
|
Card as KCard,
|
|
74
|
-
|
|
79
|
+
FieldMessage as KFieldMessage,
|
|
75
80
|
Modal as KModal,
|
|
76
|
-
Stack as KStack
|
|
81
|
+
Stack as KStack,
|
|
82
|
+
Thumbnail as KThumbnail,
|
|
83
|
+
Tooltip as KTooltip,
|
|
84
|
+
useFieldControl
|
|
77
85
|
} from "@xleddyl/443-components-vue";
|
|
78
|
-
import { mediaFilename,
|
|
86
|
+
import { mediaFilename, mediaPublicUrl, mediaTypeForKey } from "#nuxt-cms";
|
|
79
87
|
import { useCmsMediaKeys } from "../../composables/cms-media-keys";
|
|
80
88
|
import { useCmsRuntime } from "../../composables/cms-runtime";
|
|
81
89
|
import { cmsIcon } from "../../utils/ui";
|
|
@@ -86,6 +94,7 @@ defineProps({
|
|
|
86
94
|
const model = defineModel({ type: [String, null], ...{ required: true } });
|
|
87
95
|
const { mediaBaseUrl } = useCmsRuntime();
|
|
88
96
|
const mediaKeys = useCmsMediaKeys();
|
|
97
|
+
const { disabled } = useFieldControl();
|
|
89
98
|
const galleryOpen = ref(false);
|
|
90
99
|
const pickerFolder = useState("cms-media-picker-folder", () => null);
|
|
91
100
|
function onSelect(item) {
|
|
@@ -94,13 +103,14 @@ function onSelect(item) {
|
|
|
94
103
|
galleryOpen.value = false;
|
|
95
104
|
}
|
|
96
105
|
function openGallery() {
|
|
106
|
+
if (disabled.value) return;
|
|
97
107
|
galleryOpen.value = true;
|
|
98
108
|
}
|
|
99
109
|
function clear() {
|
|
110
|
+
if (disabled.value) return;
|
|
100
111
|
model.value = null;
|
|
101
112
|
}
|
|
102
113
|
const missing = computed(() => mediaKeys.isMissing(model.value));
|
|
103
114
|
const url = computed(() => model.value ? mediaPublicUrl(mediaBaseUrl, model.value) : null);
|
|
104
115
|
const kind = computed(() => model.value ? mediaTypeForKey(model.value) : "file");
|
|
105
|
-
const icon = computed(() => mediaIconFor(kind.value));
|
|
106
116
|
</script>
|
|
@@ -1,37 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
clearable
|
|
11
|
-
/>
|
|
12
|
-
</KFieldBoundary>
|
|
13
|
-
<div class="cms-media-folder-picker-list">
|
|
14
|
-
<KTree
|
|
15
|
-
v-model:selected="selected"
|
|
16
|
-
v-model:expanded="expanded"
|
|
17
|
-
:nodes="nodes"
|
|
18
|
-
:bordered="false"
|
|
19
|
-
:label="label"
|
|
20
|
-
size="sm"
|
|
21
|
-
checkmark
|
|
22
|
-
empty-text="No matching folders"
|
|
23
|
-
/>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
2
|
+
<KTreeSelect
|
|
3
|
+
v-model="selected"
|
|
4
|
+
:nodes="nodes"
|
|
5
|
+
:icon="cmsIcon(model === null ? 'home' : 'folder')"
|
|
6
|
+
:aria-label="label"
|
|
7
|
+
search-placeholder="Find a folder…"
|
|
8
|
+
empty-text="No matching folders"
|
|
9
|
+
/>
|
|
26
10
|
</template>
|
|
27
11
|
|
|
28
12
|
<script setup>
|
|
29
|
-
import { computed
|
|
30
|
-
import {
|
|
31
|
-
FieldBoundary as KFieldBoundary,
|
|
32
|
-
Input as KInput,
|
|
33
|
-
Tree as KTree
|
|
34
|
-
} from "@xleddyl/443-components-vue";
|
|
13
|
+
import { computed } from "#imports";
|
|
14
|
+
import { TreeSelect as KTreeSelect } from "@xleddyl/443-components-vue";
|
|
35
15
|
import { isWithinMediaFolder, mediaFolderName, mediaFolderParent } from "#nuxt-cms";
|
|
36
16
|
import { cmsIcon } from "../../utils/ui";
|
|
37
17
|
const ROOT_ID = ":root";
|
|
@@ -41,51 +21,26 @@ const props = defineProps({
|
|
|
41
21
|
label: { type: String, required: false }
|
|
42
22
|
});
|
|
43
23
|
const model = defineModel({ type: [String, null], ...{ default: null } });
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
24
|
+
function folderNodes(parent) {
|
|
25
|
+
return props.folders.filter((folder) => mediaFolderParent(folder) === parent).map((folder) => {
|
|
26
|
+
const children = folderNodes(folder);
|
|
27
|
+
return {
|
|
28
|
+
id: folder,
|
|
29
|
+
label: mediaFolderName(folder),
|
|
30
|
+
icon: cmsIcon("folder"),
|
|
31
|
+
disabled: !!props.exclude && isWithinMediaFolder(folder, props.exclude),
|
|
32
|
+
children: children.length ? children : void 0
|
|
33
|
+
};
|
|
34
|
+
});
|
|
51
35
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
icon: cmsIcon(model.value === folder ? "folder-open" : "folder"),
|
|
57
|
-
disabled: isDisabled(folder),
|
|
58
|
-
children: children?.length ? children : void 0
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
const nodes = computed(() => {
|
|
62
|
-
if (term.value) return visible.value.map((folder) => folderNode(folder, folder));
|
|
63
|
-
const build = (parent) => props.folders.filter((folder) => mediaFolderParent(folder) === parent).map((folder) => folderNode(folder, mediaFolderName(folder), build(folder)));
|
|
64
|
-
return [{ id: ROOT_ID, label: "Library root", icon: cmsIcon("home"), children: build(null) }];
|
|
65
|
-
});
|
|
66
|
-
const parentIds = computed(() => {
|
|
67
|
-
const ids = [];
|
|
68
|
-
const walk = (list) => {
|
|
69
|
-
for (const node of list) {
|
|
70
|
-
if (!node.children) continue;
|
|
71
|
-
ids.push(node.id);
|
|
72
|
-
walk(node.children);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
walk(nodes.value);
|
|
76
|
-
return ids;
|
|
77
|
-
});
|
|
78
|
-
const collapsed = ref([]);
|
|
79
|
-
const expanded = computed({
|
|
80
|
-
get: () => parentIds.value.filter((id) => !collapsed.value.includes(id)),
|
|
81
|
-
set: (ids) => {
|
|
82
|
-
collapsed.value = parentIds.value.filter((id) => !ids.includes(id));
|
|
83
|
-
}
|
|
84
|
-
});
|
|
36
|
+
const nodes = computed(() => [
|
|
37
|
+
{ id: ROOT_ID, label: "Library root", icon: cmsIcon("home") },
|
|
38
|
+
...folderNodes(null)
|
|
39
|
+
]);
|
|
85
40
|
const selected = computed({
|
|
86
41
|
get: () => model.value === null ? ROOT_ID : model.value,
|
|
87
42
|
set: (id) => {
|
|
88
|
-
if (id === null) return;
|
|
43
|
+
if (id === null || id === void 0) return;
|
|
89
44
|
model.value = id === ROOT_ID ? null : String(id);
|
|
90
45
|
}
|
|
91
46
|
});
|