@xleddyl/nuxt-cms 0.9.4 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (431) hide show
  1. package/README.md +1 -1
  2. package/dist/module.d.mts +20 -1
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +1037 -148
  5. package/dist/runtime/app/blocks/CmsBlocks.d.vue.ts +1 -1
  6. package/dist/runtime/app/blocks/CmsBlocks.vue +57 -9
  7. package/dist/runtime/app/blocks/CmsBlocks.vue.d.ts +1 -1
  8. package/dist/runtime/app/blocks/CmsField.d.ts +24 -0
  9. package/dist/runtime/app/blocks/CmsField.js +16 -0
  10. package/dist/runtime/app/blocks/node.d.ts +37 -0
  11. package/dist/runtime/app/blocks/node.js +17 -0
  12. package/dist/runtime/app/blocks/resolve.d.ts +18 -0
  13. package/dist/runtime/app/blocks/resolve.js +34 -0
  14. package/dist/runtime/app/components/cms/BlockPicker.d.vue.ts +22 -0
  15. package/dist/runtime/app/components/cms/BlockPicker.vue +87 -0
  16. package/dist/runtime/app/components/cms/BlockPicker.vue.d.ts +22 -0
  17. package/dist/runtime/app/components/cms/BlockPickerPopover.d.vue.ts +38 -0
  18. package/dist/runtime/app/components/cms/BlockPickerPopover.vue +44 -0
  19. package/dist/runtime/app/components/cms/BlockPickerPopover.vue.d.ts +38 -0
  20. package/dist/runtime/app/components/cms/BlockTree.d.vue.ts +29 -0
  21. package/dist/runtime/app/components/cms/BlockTree.vue +322 -0
  22. package/dist/runtime/app/components/cms/BlockTree.vue.d.ts +29 -0
  23. package/dist/runtime/app/components/cms/BlocksField.vue +569 -219
  24. package/dist/runtime/app/components/cms/BrandMark.vue +7 -13
  25. package/dist/runtime/app/components/cms/ConfirmGroups.vue +15 -13
  26. package/dist/runtime/app/components/cms/{BlockPalette.vue.d.ts → EditorHistory.d.vue.ts} +6 -5
  27. package/dist/runtime/app/components/cms/EditorHistory.vue +34 -0
  28. package/dist/runtime/app/components/cms/{BlockPalette.d.vue.ts → EditorHistory.vue.d.ts} +6 -5
  29. package/dist/runtime/app/components/cms/EntryDrawer.d.vue.ts +11 -5
  30. package/dist/runtime/app/components/cms/EntryDrawer.vue +183 -152
  31. package/dist/runtime/app/components/cms/EntryDrawer.vue.d.ts +11 -5
  32. package/dist/runtime/app/components/cms/EntryForm.d.vue.ts +16 -4
  33. package/dist/runtime/app/components/cms/EntryForm.vue +106 -147
  34. package/dist/runtime/app/components/cms/EntryForm.vue.d.ts +16 -4
  35. package/dist/runtime/app/components/cms/FieldInput.vue +10 -2
  36. package/dist/runtime/app/components/cms/FormSections.d.vue.ts +22 -0
  37. package/dist/runtime/app/components/cms/FormSections.vue +71 -0
  38. package/dist/runtime/app/components/cms/FormSections.vue.d.ts +22 -0
  39. package/dist/runtime/app/components/cms/ImportModal.vue +46 -58
  40. package/dist/runtime/app/components/cms/LinkField.d.vue.ts +16 -0
  41. package/dist/runtime/app/components/cms/LinkField.vue +250 -0
  42. package/dist/runtime/app/components/cms/LinkField.vue.d.ts +16 -0
  43. package/dist/runtime/app/components/cms/ListFilters.vue +10 -12
  44. package/dist/runtime/app/components/cms/LocaleSwitch.d.vue.ts +2 -1
  45. package/dist/runtime/app/components/cms/LocaleSwitch.vue +19 -11
  46. package/dist/runtime/app/components/cms/LocaleSwitch.vue.d.ts +2 -1
  47. package/dist/runtime/app/components/cms/MediaDetail.d.vue.ts +2 -0
  48. package/dist/runtime/app/components/cms/MediaDetail.vue +112 -83
  49. package/dist/runtime/app/components/cms/MediaDetail.vue.d.ts +2 -0
  50. package/dist/runtime/app/components/cms/MediaField.vue +35 -25
  51. package/dist/runtime/app/components/cms/MediaFolderPicker.vue +26 -71
  52. package/dist/runtime/app/components/cms/MediaGallery.d.vue.ts +1 -0
  53. package/dist/runtime/app/components/cms/MediaGallery.vue +442 -419
  54. package/dist/runtime/app/components/cms/MediaGallery.vue.d.ts +1 -0
  55. package/dist/runtime/app/components/cms/MediaThumb.vue +9 -25
  56. package/dist/runtime/app/components/cms/MediaUpload.vue +1 -1
  57. package/dist/runtime/app/components/cms/{BlockOutline.d.vue.ts → NestedBlockList.d.vue.ts} +5 -5
  58. package/dist/runtime/app/components/cms/NestedBlockList.vue +87 -0
  59. package/dist/runtime/app/components/cms/{BlockOutline.vue.d.ts → NestedBlockList.vue.d.ts} +5 -5
  60. package/dist/runtime/app/components/cms/PoweredBy.vue +12 -5
  61. package/dist/runtime/app/components/cms/PresetModal.d.vue.ts +18 -0
  62. package/dist/runtime/app/components/cms/PresetModal.vue +70 -0
  63. package/dist/runtime/app/components/cms/PresetModal.vue.d.ts +18 -0
  64. package/dist/runtime/app/components/cms/RelationField.vue +2 -8
  65. package/dist/runtime/app/components/cms/SettingsAccount.vue +60 -71
  66. package/dist/runtime/app/components/cms/SettingsColumns.vue +47 -69
  67. package/dist/runtime/app/components/cms/SettingsEmptyAdd.d.vue.ts +13 -0
  68. package/dist/runtime/app/components/cms/SettingsEmptyAdd.vue +21 -0
  69. package/dist/runtime/app/components/cms/SettingsEmptyAdd.vue.d.ts +13 -0
  70. package/dist/runtime/app/components/cms/SettingsEntries.d.vue.ts +13 -0
  71. package/dist/runtime/app/components/cms/SettingsEntries.vue +50 -0
  72. package/dist/runtime/app/components/cms/SettingsEntries.vue.d.ts +13 -0
  73. package/dist/runtime/app/components/cms/SettingsEntry.d.vue.ts +1 -10
  74. package/dist/runtime/app/components/cms/SettingsEntry.vue +11 -95
  75. package/dist/runtime/app/components/cms/SettingsEntry.vue.d.ts +1 -10
  76. package/dist/runtime/app/components/cms/SettingsEntryActions.d.vue.ts +7 -0
  77. package/dist/runtime/app/components/cms/SettingsEntryActions.vue +40 -0
  78. package/dist/runtime/app/components/cms/SettingsEntryActions.vue.d.ts +7 -0
  79. package/dist/runtime/app/components/cms/SettingsEntryTabs.d.vue.ts +7 -0
  80. package/dist/runtime/app/components/cms/SettingsEntryTabs.vue +21 -0
  81. package/dist/runtime/app/components/cms/SettingsEntryTabs.vue.d.ts +7 -0
  82. package/dist/runtime/app/components/cms/SettingsFormAction.d.vue.ts +3 -0
  83. package/dist/runtime/app/components/cms/SettingsFormAction.vue +17 -0
  84. package/dist/runtime/app/components/cms/SettingsFormAction.vue.d.ts +3 -0
  85. package/dist/runtime/app/components/cms/SettingsLayout.vue +18 -14
  86. package/dist/runtime/app/components/cms/SettingsPresetForm.d.vue.ts +11 -0
  87. package/dist/runtime/app/components/cms/SettingsPresetForm.vue +60 -0
  88. package/dist/runtime/app/components/cms/SettingsPresetForm.vue.d.ts +11 -0
  89. package/dist/runtime/app/components/cms/SettingsPresets.d.vue.ts +13 -0
  90. package/dist/runtime/app/components/cms/SettingsPresets.vue +65 -0
  91. package/dist/runtime/app/components/cms/SettingsPresets.vue.d.ts +13 -0
  92. package/dist/runtime/app/components/cms/SettingsRecordActions.d.vue.ts +32 -0
  93. package/dist/runtime/app/components/cms/SettingsRecordActions.vue +45 -0
  94. package/dist/runtime/app/components/cms/SettingsRecordActions.vue.d.ts +32 -0
  95. package/dist/runtime/app/components/cms/SettingsRedirectActions.d.vue.ts +3 -0
  96. package/dist/runtime/app/components/cms/SettingsRedirectActions.vue +59 -0
  97. package/dist/runtime/app/components/cms/SettingsRedirectActions.vue.d.ts +3 -0
  98. package/dist/runtime/app/components/cms/SettingsRedirectForm.d.vue.ts +11 -0
  99. package/dist/runtime/app/components/cms/SettingsRedirectForm.vue +77 -0
  100. package/dist/runtime/app/components/cms/SettingsRedirectForm.vue.d.ts +11 -0
  101. package/dist/runtime/app/components/cms/SettingsRedirects.d.vue.ts +13 -0
  102. package/dist/runtime/app/components/cms/SettingsRedirects.vue +117 -0
  103. package/dist/runtime/app/components/cms/SettingsRedirects.vue.d.ts +13 -0
  104. package/dist/runtime/app/components/cms/SettingsSecretCard.d.vue.ts +17 -0
  105. package/dist/runtime/app/components/cms/SettingsSecretCard.vue +43 -0
  106. package/dist/runtime/app/components/cms/SettingsSecretCard.vue.d.ts +17 -0
  107. package/dist/runtime/app/components/cms/SettingsSite.d.vue.ts +3 -0
  108. package/dist/runtime/app/components/cms/SettingsSite.vue +140 -0
  109. package/dist/runtime/app/components/cms/SettingsSite.vue.d.ts +3 -0
  110. package/dist/runtime/app/components/cms/SettingsUserCreate.d.vue.ts +8 -0
  111. package/dist/runtime/app/components/cms/SettingsUserCreate.vue +82 -0
  112. package/dist/runtime/app/components/cms/SettingsUserCreate.vue.d.ts +8 -0
  113. package/dist/runtime/app/components/cms/SettingsUserDetail.d.vue.ts +11 -0
  114. package/dist/runtime/app/components/cms/SettingsUserDetail.vue +179 -0
  115. package/dist/runtime/app/components/cms/SettingsUserDetail.vue.d.ts +11 -0
  116. package/dist/runtime/app/components/cms/SettingsUsers.d.vue.ts +9 -6
  117. package/dist/runtime/app/components/cms/SettingsUsers.vue +88 -234
  118. package/dist/runtime/app/components/cms/SettingsUsers.vue.d.ts +9 -6
  119. package/dist/runtime/app/components/cms/SharePreview.d.vue.ts +18 -0
  120. package/dist/runtime/app/components/cms/SharePreview.vue +219 -0
  121. package/dist/runtime/app/components/cms/SharePreview.vue.d.ts +18 -0
  122. package/dist/runtime/app/components/cms/SlugField.vue +5 -3
  123. package/dist/runtime/app/components/cms/StatusBadge.vue +8 -8
  124. package/dist/runtime/app/components/cms/TranslationBadges.d.vue.ts +7 -0
  125. package/dist/runtime/app/components/cms/TranslationBadges.vue +44 -0
  126. package/dist/runtime/app/components/cms/TranslationBadges.vue.d.ts +7 -0
  127. package/dist/runtime/app/components/cms/TranslationMenu.d.vue.ts +17 -0
  128. package/dist/runtime/app/components/cms/TranslationMenu.vue +28 -0
  129. package/dist/runtime/app/components/cms/TranslationMenu.vue.d.ts +17 -0
  130. package/dist/runtime/app/components/cms/VisualEditor.d.vue.ts +22 -4
  131. package/dist/runtime/app/components/cms/VisualEditor.vue +1153 -338
  132. package/dist/runtime/app/components/cms/VisualEditor.vue.d.ts +22 -4
  133. package/dist/runtime/app/components/cms/WelcomeModal.vue +32 -50
  134. package/dist/runtime/app/composables/cms-clipboard.d.ts +8 -0
  135. package/dist/runtime/app/composables/cms-clipboard.js +38 -0
  136. package/dist/runtime/app/composables/cms-confirm.d.ts +6 -8
  137. package/dist/runtime/app/composables/cms-confirm.js +5 -7
  138. package/dist/runtime/app/composables/cms-entry-disabled.d.ts +5 -1
  139. package/dist/runtime/app/composables/cms-entry-disabled.js +7 -0
  140. package/dist/runtime/app/composables/cms-entry-form.d.ts +15 -0
  141. package/dist/runtime/app/composables/cms-entry-form.js +40 -0
  142. package/dist/runtime/app/composables/cms-entry-settings.d.ts +30 -0
  143. package/dist/runtime/app/composables/cms-entry-settings.js +122 -0
  144. package/dist/runtime/app/composables/cms-entry.d.ts +5 -1
  145. package/dist/runtime/app/composables/cms-entry.js +36 -11
  146. package/dist/runtime/app/composables/cms-history.d.ts +10 -0
  147. package/dist/runtime/app/composables/cms-history.js +24 -0
  148. package/dist/runtime/app/composables/cms-link-targets.d.ts +10 -0
  149. package/dist/runtime/app/composables/cms-link-targets.js +40 -0
  150. package/dist/runtime/app/composables/cms-link-usage.d.ts +1 -0
  151. package/dist/runtime/app/composables/cms-link-usage.js +45 -0
  152. package/dist/runtime/app/composables/cms-media-library.d.ts +19 -9
  153. package/dist/runtime/app/composables/cms-media-library.js +31 -13
  154. package/dist/runtime/app/composables/cms-media-uploader.js +6 -20
  155. package/dist/runtime/app/composables/cms-permissions.d.ts +18 -0
  156. package/dist/runtime/app/composables/cms-permissions.js +54 -0
  157. package/dist/runtime/app/composables/cms-presets.d.ts +11 -0
  158. package/dist/runtime/app/composables/cms-presets.js +40 -0
  159. package/dist/runtime/app/composables/cms-preview-mode.d.ts +4 -0
  160. package/dist/runtime/app/composables/cms-preview-mode.js +8 -0
  161. package/dist/runtime/app/composables/cms-query.d.ts +3 -0
  162. package/dist/runtime/app/composables/cms-query.js +45 -20
  163. package/dist/runtime/app/composables/cms-record-list.d.ts +31 -0
  164. package/dist/runtime/app/composables/cms-record-list.js +75 -0
  165. package/dist/runtime/app/composables/cms-route.d.ts +6 -0
  166. package/dist/runtime/app/composables/cms-route.js +36 -0
  167. package/dist/runtime/app/composables/cms-runtime.d.ts +1 -0
  168. package/dist/runtime/app/composables/cms-save-handoff.d.ts +4 -0
  169. package/dist/runtime/app/composables/cms-save-handoff.js +19 -0
  170. package/dist/runtime/app/composables/cms-seo.d.ts +12 -0
  171. package/dist/runtime/app/composables/cms-seo.js +69 -0
  172. package/dist/runtime/app/composables/cms-settings-form.d.ts +13 -0
  173. package/dist/runtime/app/composables/cms-settings-form.js +29 -0
  174. package/dist/runtime/app/composables/cms-settings-sections.d.ts +26 -0
  175. package/dist/runtime/app/composables/cms-settings-sections.js +181 -0
  176. package/dist/runtime/app/composables/cms-settings-stores.d.ts +52 -0
  177. package/dist/runtime/app/composables/cms-settings-stores.js +156 -0
  178. package/dist/runtime/app/composables/cms-settings.d.ts +3 -3
  179. package/dist/runtime/app/composables/cms-settings.js +14 -8
  180. package/dist/runtime/app/composables/cms-site-disabled.d.ts +7 -0
  181. package/dist/runtime/app/composables/cms-site-disabled.js +8 -0
  182. package/dist/runtime/app/composables/cms-site.d.ts +7 -0
  183. package/dist/runtime/app/composables/cms-site.js +22 -0
  184. package/dist/runtime/app/composables/cms-toast.d.ts +2 -8
  185. package/dist/runtime/app/composables/cms-toast.js +3 -9
  186. package/dist/runtime/app/composables/cms-translation-actions.d.ts +15 -0
  187. package/dist/runtime/app/composables/cms-translation-actions.js +108 -0
  188. package/dist/runtime/app/css-url.d.ts +4 -0
  189. package/dist/runtime/app/image/CmsImage.d.vue.ts +89 -0
  190. package/dist/runtime/app/image/CmsImage.vue +91 -0
  191. package/dist/runtime/app/image/CmsImage.vue.d.ts +89 -0
  192. package/dist/runtime/app/layouts/cms-admin.d.vue.ts +2 -2
  193. package/dist/runtime/app/layouts/cms-admin.vue +98 -76
  194. package/dist/runtime/app/layouts/cms-admin.vue.d.ts +2 -2
  195. package/dist/runtime/app/layouts/cms-editor.vue +7 -2
  196. package/dist/runtime/app/links/CmsLink.d.vue.ts +18 -0
  197. package/dist/runtime/app/links/CmsLink.vue +18 -0
  198. package/dist/runtime/app/links/CmsLink.vue.d.ts +18 -0
  199. package/dist/runtime/app/middleware/cms-auth.js +13 -1
  200. package/dist/runtime/app/pages/admin-collection.vue +473 -297
  201. package/dist/runtime/app/pages/admin-content.vue +191 -54
  202. package/dist/runtime/app/pages/admin-entry.vue +79 -75
  203. package/dist/runtime/app/pages/admin-index.vue +18 -5
  204. package/dist/runtime/app/pages/admin-login.vue +1 -1
  205. package/dist/runtime/app/pages/admin-logout.vue +1 -1
  206. package/dist/runtime/app/pages/admin-media.vue +3 -3
  207. package/dist/runtime/app/pages/admin-preview.vue +112 -24
  208. package/dist/runtime/app/plugins/cms-field.d.ts +2 -0
  209. package/dist/runtime/app/plugins/cms-field.js +8 -0
  210. package/dist/runtime/app/plugins/cms-preview-banner.client.d.ts +2 -0
  211. package/dist/runtime/app/plugins/cms-preview-banner.client.js +19 -0
  212. package/dist/runtime/app/plugins/cms-preview.d.ts +2 -0
  213. package/dist/runtime/app/plugins/cms-preview.js +27 -0
  214. package/dist/runtime/app/preview/CmsPreviewBanner.d.vue.ts +7 -0
  215. package/dist/runtime/app/preview/CmsPreviewBanner.vue +63 -0
  216. package/dist/runtime/app/preview/CmsPreviewBanner.vue.d.ts +7 -0
  217. package/dist/runtime/app/preview/PreviewOverlay.d.vue.ts +17 -3
  218. package/dist/runtime/app/preview/PreviewOverlay.vue +629 -166
  219. package/dist/runtime/app/preview/PreviewOverlay.vue.d.ts +17 -3
  220. package/dist/runtime/app/preview/field-marker.d.ts +12 -0
  221. package/dist/runtime/app/preview/field-marker.js +20 -0
  222. package/dist/runtime/app/preview/inline-text.d.ts +15 -0
  223. package/dist/runtime/app/preview/inline-text.js +158 -0
  224. package/dist/runtime/app/utils/block-editor.d.ts +22 -0
  225. package/dist/runtime/app/utils/block-editor.js +12 -0
  226. package/dist/runtime/app/utils/keyboard.d.ts +6 -0
  227. package/dist/runtime/app/utils/keyboard.js +52 -0
  228. package/dist/runtime/app/utils/redirects.d.ts +6 -0
  229. package/dist/runtime/app/utils/redirects.js +7 -0
  230. package/dist/runtime/app/utils/ui.d.ts +8 -0
  231. package/dist/runtime/app/utils/ui.js +15 -1
  232. package/dist/runtime/app/utils/users.d.ts +15 -0
  233. package/dist/runtime/app/utils/users.js +14 -0
  234. package/dist/runtime/assets/cms.css +1 -1
  235. package/dist/runtime/generate.js +16 -2
  236. package/dist/runtime/server/api/collection-export.get.js +3 -2
  237. package/dist/runtime/server/api/collection-import.post.js +39 -11
  238. package/dist/runtime/server/api/collection.get.js +27 -9
  239. package/dist/runtime/server/api/collection.post.js +28 -11
  240. package/dist/runtime/server/api/collection.put.js +35 -13
  241. package/dist/runtime/server/api/item.delete.js +19 -7
  242. package/dist/runtime/server/api/item.get.js +3 -2
  243. package/dist/runtime/server/api/item.put.js +52 -18
  244. package/dist/runtime/server/api/link-usage.post.d.ts +5 -0
  245. package/dist/runtime/server/api/link-usage.post.js +21 -0
  246. package/dist/runtime/server/api/media-delete.post.js +4 -2
  247. package/dist/runtime/server/api/media-download.get.js +2 -2
  248. package/dist/runtime/server/api/media-folder.delete.js +8 -2
  249. package/dist/runtime/server/api/media-folder.patch.js +10 -2
  250. package/dist/runtime/server/api/media-folder.post.js +4 -2
  251. package/dist/runtime/server/api/media-move.post.js +7 -4
  252. package/dist/runtime/server/api/media-presign.post.js +2 -2
  253. package/dist/runtime/server/api/media-upload.put.js +2 -2
  254. package/dist/runtime/server/api/media-usage.post.d.ts +2 -4
  255. package/dist/runtime/server/api/media-usage.post.js +13 -9
  256. package/dist/runtime/server/api/media.delete.js +4 -2
  257. package/dist/runtime/server/api/media.get.js +22 -7
  258. package/dist/runtime/server/api/media.post.js +4 -2
  259. package/dist/runtime/server/api/media.put.js +33 -16
  260. package/dist/runtime/server/api/preset.delete.d.ts +4 -0
  261. package/dist/runtime/server/api/preset.delete.js +9 -0
  262. package/dist/runtime/server/api/preset.put.d.ts +3 -0
  263. package/dist/runtime/server/api/preset.put.js +23 -0
  264. package/dist/runtime/server/api/presets-field.get.d.ts +3 -0
  265. package/dist/runtime/server/api/presets-field.get.js +13 -0
  266. package/dist/runtime/server/api/presets-field.post.d.ts +3 -0
  267. package/dist/runtime/server/api/presets-field.post.js +36 -0
  268. package/dist/runtime/server/api/presets.get.d.ts +3 -0
  269. package/dist/runtime/server/api/presets.get.js +7 -0
  270. package/dist/runtime/server/api/preview-link.delete.d.ts +4 -0
  271. package/dist/runtime/server/api/preview-link.delete.js +15 -0
  272. package/dist/runtime/server/api/preview-links.get.d.ts +3 -0
  273. package/dist/runtime/server/api/preview-links.get.js +10 -0
  274. package/dist/runtime/server/api/preview-links.post.d.ts +3 -0
  275. package/dist/runtime/server/api/preview-links.post.js +17 -0
  276. package/dist/runtime/server/api/preview.get.d.ts +3 -0
  277. package/dist/runtime/server/api/preview.get.js +7 -0
  278. package/dist/runtime/server/api/redirect.delete.d.ts +4 -0
  279. package/dist/runtime/server/api/redirect.delete.js +10 -0
  280. package/dist/runtime/server/api/redirect.put.d.ts +3 -0
  281. package/dist/runtime/server/api/redirect.put.js +8 -0
  282. package/dist/runtime/server/api/redirects-import.post.d.ts +3 -0
  283. package/dist/runtime/server/api/redirects-import.post.js +13 -0
  284. package/dist/runtime/server/api/redirects.get.d.ts +3 -0
  285. package/dist/runtime/server/api/redirects.get.js +7 -0
  286. package/dist/runtime/server/api/redirects.post.d.ts +3 -0
  287. package/dist/runtime/server/api/redirects.post.js +7 -0
  288. package/dist/runtime/server/api/search.get.js +8 -3
  289. package/dist/runtime/server/api/settings.delete.js +2 -2
  290. package/dist/runtime/server/api/settings.get.js +4 -2
  291. package/dist/runtime/server/api/settings.put.js +2 -2
  292. package/dist/runtime/server/api/site.get.d.ts +3 -0
  293. package/dist/runtime/server/api/site.get.js +7 -0
  294. package/dist/runtime/server/api/site.put.d.ts +3 -0
  295. package/dist/runtime/server/api/site.put.js +16 -0
  296. package/dist/runtime/server/api/tags.get.js +3 -2
  297. package/dist/runtime/server/api/user.delete.js +8 -2
  298. package/dist/runtime/server/api/user.put.js +14 -4
  299. package/dist/runtime/server/api/users.get.js +2 -2
  300. package/dist/runtime/server/api/users.post.js +8 -4
  301. package/dist/runtime/server/middleware/hidden-site.d.ts +2 -0
  302. package/dist/runtime/server/middleware/hidden-site.js +8 -0
  303. package/dist/runtime/server/middleware/preview-links.d.ts +2 -0
  304. package/dist/runtime/server/middleware/preview-links.js +6 -0
  305. package/dist/runtime/server/middleware/redirects.d.ts +2 -0
  306. package/dist/runtime/server/middleware/redirects.js +18 -0
  307. package/dist/runtime/server/plugins/session-validate.js +4 -1
  308. package/dist/runtime/server/plugins/webhooks.d.ts +3 -0
  309. package/dist/runtime/server/plugins/webhooks.js +27 -0
  310. package/dist/runtime/server/routes/graphql.js +5 -3
  311. package/dist/runtime/server/routes/robots.d.ts +2 -0
  312. package/dist/runtime/server/routes/robots.js +16 -0
  313. package/dist/runtime/server/routes/sitemap.d.ts +2 -0
  314. package/dist/runtime/server/routes/sitemap.js +67 -0
  315. package/dist/runtime/server/utils/cached-value.d.ts +5 -0
  316. package/dist/runtime/server/utils/cached-value.js +24 -0
  317. package/dist/runtime/server/utils/content-routes.d.ts +5 -0
  318. package/dist/runtime/server/utils/content-routes.js +29 -0
  319. package/dist/runtime/server/utils/field-rules.d.ts +19 -0
  320. package/dist/runtime/server/utils/field-rules.js +72 -0
  321. package/dist/runtime/server/utils/graphql.d.ts +3 -1
  322. package/dist/runtime/server/utils/graphql.js +143 -28
  323. package/dist/runtime/server/utils/hooks.d.ts +14 -0
  324. package/dist/runtime/server/utils/hooks.js +71 -0
  325. package/dist/runtime/server/utils/import.d.ts +7 -2
  326. package/dist/runtime/server/utils/import.js +108 -14
  327. package/dist/runtime/server/utils/link-usage.d.ts +4 -0
  328. package/dist/runtime/server/utils/link-usage.js +28 -0
  329. package/dist/runtime/server/utils/media-references.d.ts +6 -1
  330. package/dist/runtime/server/utils/media-references.js +49 -20
  331. package/dist/runtime/server/utils/media-usage.d.ts +2 -0
  332. package/dist/runtime/server/utils/media-usage.js +5 -3
  333. package/dist/runtime/server/utils/page-rows.d.ts +2 -0
  334. package/dist/runtime/server/utils/page-rows.js +42 -29
  335. package/dist/runtime/server/utils/permissions.d.ts +14 -0
  336. package/dist/runtime/server/utils/permissions.js +43 -0
  337. package/dist/runtime/server/utils/presets.d.ts +18 -0
  338. package/dist/runtime/server/utils/presets.js +68 -0
  339. package/dist/runtime/server/utils/preview-links.d.ts +207 -0
  340. package/dist/runtime/server/utils/preview-links.js +161 -0
  341. package/dist/runtime/server/utils/redirects.d.ts +31 -0
  342. package/dist/runtime/server/utils/redirects.js +240 -0
  343. package/dist/runtime/server/utils/registry.js +4 -1
  344. package/dist/runtime/server/utils/relations.d.ts +8 -0
  345. package/dist/runtime/server/utils/relations.js +25 -6
  346. package/dist/runtime/server/utils/require-admin.d.ts +0 -1
  347. package/dist/runtime/server/utils/require-admin.js +4 -8
  348. package/dist/runtime/server/utils/search.d.ts +1 -0
  349. package/dist/runtime/server/utils/search.js +44 -19
  350. package/dist/runtime/server/utils/site.d.ts +23 -0
  351. package/dist/runtime/server/utils/site.js +79 -0
  352. package/dist/runtime/server/utils/sitemap.d.ts +12 -0
  353. package/dist/runtime/server/utils/sitemap.js +109 -0
  354. package/dist/runtime/server/utils/user-management.d.ts +4 -0
  355. package/dist/runtime/server/utils/user-management.js +20 -0
  356. package/dist/runtime/server/utils/users.d.ts +1 -1
  357. package/dist/runtime/server/utils/users.js +1 -1
  358. package/dist/runtime/server/utils/visibility.d.ts +1 -0
  359. package/dist/runtime/server/utils/visibility.js +6 -1
  360. package/dist/runtime/server/utils/webhooks.d.ts +24 -0
  361. package/dist/runtime/server/utils/webhooks.js +90 -0
  362. package/dist/runtime/shared/block-paths.d.ts +66 -0
  363. package/dist/runtime/shared/block-paths.js +310 -0
  364. package/dist/runtime/shared/block-picker.d.ts +18 -0
  365. package/dist/runtime/shared/block-picker.js +31 -0
  366. package/dist/runtime/shared/block-signature.d.ts +4 -0
  367. package/dist/runtime/shared/block-signature.js +46 -0
  368. package/dist/runtime/shared/clipboard.d.ts +31 -0
  369. package/dist/runtime/shared/clipboard.js +206 -0
  370. package/dist/runtime/shared/conditions.d.ts +36 -0
  371. package/dist/runtime/shared/conditions.js +100 -0
  372. package/dist/runtime/shared/content-routes.d.ts +42 -0
  373. package/dist/runtime/shared/content-routes.js +237 -0
  374. package/dist/runtime/shared/duplicate.js +2 -1
  375. package/dist/runtime/shared/editor-layout.d.ts +18 -0
  376. package/dist/runtime/shared/editor-layout.js +9 -0
  377. package/dist/runtime/shared/field-options.d.ts +21 -0
  378. package/dist/runtime/shared/field-options.js +90 -0
  379. package/dist/runtime/shared/graphql-sdl.d.ts +1 -0
  380. package/dist/runtime/shared/graphql-sdl.js +50 -26
  381. package/dist/runtime/shared/history.d.ts +27 -0
  382. package/dist/runtime/shared/history.js +123 -0
  383. package/dist/runtime/shared/hooks.d.ts +45 -0
  384. package/dist/runtime/shared/hooks.js +28 -0
  385. package/dist/runtime/shared/index.d.ts +90 -21
  386. package/dist/runtime/shared/index.js +121 -37
  387. package/dist/runtime/shared/inline-text.d.ts +38 -0
  388. package/dist/runtime/shared/inline-text.js +85 -0
  389. package/dist/runtime/shared/layout.d.ts +2 -1
  390. package/dist/runtime/shared/layout.js +3 -0
  391. package/dist/runtime/shared/links.d.ts +48 -0
  392. package/dist/runtime/shared/links.js +155 -0
  393. package/dist/runtime/shared/list-filters.d.ts +2 -0
  394. package/dist/runtime/shared/list-filters.js +2 -0
  395. package/dist/runtime/shared/media-focal.d.ts +30 -0
  396. package/dist/runtime/shared/media-focal.js +52 -0
  397. package/dist/runtime/shared/migrations-dir.d.ts +14 -0
  398. package/dist/runtime/shared/migrations-dir.js +48 -2
  399. package/dist/runtime/shared/presets.d.ts +67 -0
  400. package/dist/runtime/shared/presets.js +127 -0
  401. package/dist/runtime/shared/preview-links.d.ts +64 -0
  402. package/dist/runtime/shared/preview-links.js +54 -0
  403. package/dist/runtime/shared/preview.d.ts +124 -21
  404. package/dist/runtime/shared/preview.js +419 -81
  405. package/dist/runtime/shared/redirects.d.ts +75 -0
  406. package/dist/runtime/shared/redirects.js +230 -0
  407. package/dist/runtime/shared/roles.d.ts +57 -0
  408. package/dist/runtime/shared/roles.js +293 -0
  409. package/dist/runtime/shared/save-state.d.ts +8 -0
  410. package/dist/runtime/shared/save-state.js +15 -0
  411. package/dist/runtime/shared/search.d.ts +16 -1
  412. package/dist/runtime/shared/search.js +41 -7
  413. package/dist/runtime/shared/seo.d.ts +167 -0
  414. package/dist/runtime/shared/seo.js +335 -0
  415. package/dist/runtime/shared/transfer.js +2 -1
  416. package/dist/runtime/shared/translations.d.ts +29 -0
  417. package/dist/runtime/shared/translations.js +123 -0
  418. package/dist/runtime/shared/users.d.ts +1 -1
  419. package/dist/runtime/shared/validation.d.ts +23 -1
  420. package/dist/runtime/shared/validation.js +214 -64
  421. package/dist/runtime/webhooks.d.ts +33 -0
  422. package/dist/runtime/webhooks.js +57 -0
  423. package/dist/types.d.mts +5 -1
  424. package/package.json +6 -2
  425. package/dist/runtime/app/components/cms/BlockOutline.vue +0 -88
  426. package/dist/runtime/app/components/cms/BlockPalette.vue +0 -31
  427. package/dist/runtime/app/components/cms/SettingsModal.d.vue.ts +0 -12
  428. package/dist/runtime/app/components/cms/SettingsModal.vue +0 -126
  429. package/dist/runtime/app/components/cms/SettingsModal.vue.d.ts +0 -12
  430. package/dist/runtime/app/composables/cms-field-focus.d.ts +0 -4
  431. package/dist/runtime/app/composables/cms-field-focus.js +0 -20
@@ -0,0 +1,156 @@
1
+ import {
2
+ REDIRECT_IMPORT_MAX_ROWS,
3
+ entryFieldsFor,
4
+ normalizeRedirectPath,
5
+ redirectRowsFromTable,
6
+ redirectsToTable
7
+ } from "#nuxt-cms";
8
+ import { toast, useConfirm } from "@xleddyl/443-components-vue";
9
+ import { ref, useState } from "#imports";
10
+ import cmsConfig from "#cms-config";
11
+ import { presetBlockCount } from "../../shared/presets.js";
12
+ import { encodeCsv, parseCsv } from "../../shared/transfer.js";
13
+ import { cmsApi } from "../utils/api.js";
14
+ import { errorMessage } from "../utils/ui.js";
15
+ import { useCmsAccount } from "./cms-account.js";
16
+ import { useCmsPermissions } from "./cms-permissions.js";
17
+ import { useCmsRecordList } from "./cms-record-list.js";
18
+ export function useCmsUsers() {
19
+ const { user } = useCmsAccount();
20
+ const { canManage } = useCmsPermissions();
21
+ const list = useCmsRecordList({
22
+ key: "users",
23
+ url: "/api/cms/users",
24
+ label: (account) => account.name || account.email,
25
+ loadError: "Could not load users",
26
+ confirmDelete: (account) => ({
27
+ title: `Delete ${account.email}?`,
28
+ description: "They lose access to the panel."
29
+ }),
30
+ deleted: "User deleted",
31
+ deleteError: "User not deleted"
32
+ });
33
+ function canManageUser(account) {
34
+ return canManage(account.role);
35
+ }
36
+ function isSelf(account) {
37
+ return account.id === user.value?.id;
38
+ }
39
+ return { ...list, canManageUser, isSelf };
40
+ }
41
+ export function useCmsRedirects() {
42
+ const confirm = useConfirm();
43
+ const importing = ref(false);
44
+ const list = useCmsRecordList({
45
+ key: "redirects",
46
+ url: "/api/cms/redirects",
47
+ label: (redirect) => redirect.from,
48
+ compare: (a, b) => a.from.localeCompare(b.from),
49
+ loadError: "Could not load redirects",
50
+ confirmDelete: (redirect) => ({
51
+ title: "Delete this redirect?",
52
+ description: `Visitors of ${redirect.from} are not sent to ${redirect.to} anymore.`
53
+ }),
54
+ deleted: "Redirect deleted",
55
+ deleteError: "Redirect not deleted"
56
+ });
57
+ function download(content, type, extension) {
58
+ const url = URL.createObjectURL(new Blob([content], { type }));
59
+ const link = document.createElement("a");
60
+ link.href = url;
61
+ link.download = `redirects.${extension}`;
62
+ link.click();
63
+ URL.revokeObjectURL(url);
64
+ }
65
+ function exportCsv() {
66
+ download(encodeCsv(redirectsToTable(list.items.value)), "text/csv", "csv");
67
+ }
68
+ function exportJson() {
69
+ const rows = list.items.value.map(({ from, to, status, keepQuery }) => ({
70
+ from,
71
+ to,
72
+ status,
73
+ keepQuery
74
+ }));
75
+ download(`${JSON.stringify(rows, null, 2)}
76
+ `, "application/json", "json");
77
+ }
78
+ function parseImport(name, text) {
79
+ if (name.toLowerCase().endsWith(".json") || text.trim().startsWith("[")) {
80
+ const rows = JSON.parse(text);
81
+ if (!Array.isArray(rows)) throw new Error("The JSON file must hold an array of redirects");
82
+ return rows;
83
+ }
84
+ return redirectRowsFromTable(parseCsv(text));
85
+ }
86
+ async function importFile(file) {
87
+ importing.value = true;
88
+ try {
89
+ const rows = parseImport(file.name, await file.text());
90
+ if (!rows.length) throw new Error("The file holds no redirects");
91
+ if (rows.length > REDIRECT_IMPORT_MAX_ROWS)
92
+ throw new Error(`Import at most ${REDIRECT_IMPORT_MAX_ROWS} redirects at a time`);
93
+ const updates = rows.filter(
94
+ (row) => list.items.value.some(
95
+ (redirect) => redirect.from === normalizeRedirectPath(String(row.from ?? ""))
96
+ )
97
+ ).length;
98
+ const confirmed = await confirm({
99
+ title: `Import ${rows.length} redirects?`,
100
+ description: updates ? `${updates} replace a redirect with the same From.` : "They are added to the list.",
101
+ confirmLabel: "Import"
102
+ });
103
+ if (!confirmed) return;
104
+ const result = await cmsApi(
105
+ "/api/cms/redirects/import",
106
+ { method: "POST", body: { redirects: rows } }
107
+ );
108
+ await list.load();
109
+ toast.success("Redirects imported", {
110
+ description: `${result.created} added, ${result.updated} updated.`
111
+ });
112
+ } catch (error) {
113
+ toast.error("Import failed", { description: errorMessage(error) });
114
+ } finally {
115
+ importing.value = false;
116
+ }
117
+ }
118
+ return { ...list, importing, exportCsv, exportJson, importFile };
119
+ }
120
+ function presetSourceLabel(source) {
121
+ const [entryName = "", fieldKey = ""] = source.split(".");
122
+ const entry = Object.hasOwn(cmsConfig, entryName) ? cmsConfig[entryName] : void 0;
123
+ if (!entry) return source;
124
+ const field = entryFieldsFor(entry)[fieldKey];
125
+ return field ? `${entry.label}, ${field.label}` : entry.label;
126
+ }
127
+ export function presetMeta(preset) {
128
+ return `${presetBlockCount(preset.items.length)} \xB7 Saved from ${presetSourceLabel(
129
+ preset.source
130
+ )}`;
131
+ }
132
+ export function useCmsPresetStore() {
133
+ const fieldCache = useState("cms-presets", () => ({}));
134
+ const list = useCmsRecordList({
135
+ key: "presets",
136
+ url: "/api/cms/presets",
137
+ label: (preset) => preset.name,
138
+ loadError: "Could not load presets",
139
+ confirmDelete: (preset) => ({
140
+ title: `Delete the preset "${preset.name}"?`,
141
+ description: "Blocks already inserted from it stay as they are."
142
+ }),
143
+ deleted: "Preset deleted",
144
+ deleteError: "Preset not deleted"
145
+ });
146
+ async function remove(preset) {
147
+ const removed = await list.remove(preset);
148
+ if (removed) fieldCache.value = {};
149
+ return removed;
150
+ }
151
+ function saved(preset) {
152
+ list.upsert(preset);
153
+ fieldCache.value = {};
154
+ }
155
+ return { ...list, remove, saved };
156
+ }
@@ -1,4 +1,4 @@
1
- import type { CmsEntrySettings, CmsFormLayout, CmsSettingsMap } from '#nuxt-cms';
1
+ import type { CmsEntrySettings, CmsFormLayout, CmsI18n, CmsSettingsMap } from '#nuxt-cms';
2
2
  export declare function useCmsSettingsState(): import("vue").Ref<CmsSettingsMap, CmsSettingsMap>;
3
3
  export declare function loadCmsSettings(): Promise<void>;
4
4
  export declare function useCmsSettings(): {
@@ -8,5 +8,5 @@ export declare function useCmsSettings(): {
8
8
  };
9
9
  export declare function entryFields(name: string): Record<string, import("#nuxt-cms").FieldConfig>;
10
10
  export declare function entryFormLayout(name: string, settings: CmsSettingsMap, fields?: Record<string, import("#nuxt-cms").FieldConfig>): CmsFormLayout;
11
- export declare function listExtraColumns(name: string): string[];
12
- export declare function entryListColumns(name: string, settings: CmsSettingsMap): string[];
11
+ export declare function listExtraColumns(name: string, i18n?: CmsI18n): string[];
12
+ export declare function entryListColumns(name: string, settings: CmsSettingsMap, i18n?: CmsI18n): string[];
@@ -7,6 +7,7 @@ import {
7
7
  } from "#nuxt-cms";
8
8
  import { useFetch, useState } from "#imports";
9
9
  import cmsConfig from "#cms-config";
10
+ import { TRANSLATIONS_COLUMN, hasTranslationsColumn } from "../../shared/translations.js";
10
11
  import { cmsApi } from "../utils/api.js";
11
12
  const SETTINGS_ENDPOINT = "/api/cms/admin/settings";
12
13
  export function useCmsSettingsState() {
@@ -49,17 +50,22 @@ export function entryFormLayout(name, settings, fields = entryFields(name)) {
49
50
  const saved = settings[name]?.layout;
50
51
  return saved ? resolveFormLayout(fields, saved) : defaultFormLayout(name, fields);
51
52
  }
52
- export function listExtraColumns(name) {
53
+ export function listExtraColumns(name, i18n) {
53
54
  const entry = entryOf(name);
54
- return entry && isCollectionKind(entry) && entry.drafts ? ["status"] : [];
55
+ if (!entry || !isCollectionKind(entry)) return [];
56
+ return [
57
+ ...entry.drafts ? ["status"] : [],
58
+ ...i18n && hasTranslationsColumn(entry, i18n) ? [TRANSLATIONS_COLUMN] : []
59
+ ];
55
60
  }
56
- export function entryListColumns(name, settings) {
61
+ export function entryListColumns(name, settings, i18n) {
57
62
  const entry = entryOf(name);
58
63
  if (!entry) return [];
59
- return resolveListColumns(
60
- entry.fields,
61
- settings[name]?.columns,
62
- entry.list,
63
- listExtraColumns(name)
64
+ const extra = listExtraColumns(name, i18n);
65
+ const saved = settings[name]?.columns;
66
+ const columns = resolveListColumns(entry.fields, saved, entry.list, extra);
67
+ const customized = !!saved?.some(
68
+ (key) => Object.hasOwn(entry.fields, key) || extra.includes(key)
64
69
  );
70
+ return customized || !extra.includes(TRANSLATIONS_COLUMN) || columns.includes(TRANSLATIONS_COLUMN) ? columns : [...columns, TRANSLATIONS_COLUMN];
65
71
  }
@@ -0,0 +1,7 @@
1
+ import type { AsyncData } from 'nuxt/app';
2
+ import type { CmsSite } from '../../shared/index.js';
3
+ import type { CmsAsyncDataOptions } from './cms-query-disabled.js';
4
+ export interface CmsSiteOptions<DefaultT> extends CmsAsyncDataOptions<CmsSite | null, DefaultT> {
5
+ locale?: string;
6
+ }
7
+ export declare function useCmsSite<DefaultT = null>(options?: CmsSiteOptions<DefaultT>): AsyncData<CmsSite | DefaultT | null, Error | undefined>;
@@ -0,0 +1,8 @@
1
+ import { useAsyncData } from "#imports";
2
+ export function useCmsSite(options = {}) {
3
+ const { locale, key, default: fallback } = options;
4
+ return useAsyncData(
5
+ key ?? `cms-site:${locale ?? ""}`,
6
+ async () => fallback ? fallback() : null
7
+ );
8
+ }
@@ -0,0 +1,7 @@
1
+ import type { AsyncData } from 'nuxt/app';
2
+ import type { CmsSite } from '../../shared/index.js';
3
+ import type { CmsAsyncDataOptions } from './cms-query.js';
4
+ export interface CmsSiteOptions<DefaultT> extends CmsAsyncDataOptions<CmsSite | null, DefaultT> {
5
+ locale?: string;
6
+ }
7
+ export declare function useCmsSite<DefaultT = null>(options?: CmsSiteOptions<DefaultT>): AsyncData<CmsSite | DefaultT | null, Error | undefined>;
@@ -0,0 +1,22 @@
1
+ import { useAsyncData } from "#imports";
2
+ import { $cmsQuery } from "./cms-query.js";
3
+ const SITE_QUERY = `query ($locale: String) {
4
+ cmsSite(locale: $locale) {
5
+ name titleTemplate description hidden
6
+ image { key url type alt mime width height }
7
+ }
8
+ }`;
9
+ export function useCmsSite(options = {}) {
10
+ const { locale, key, default: fallback, ...asyncDataOptions } = options;
11
+ return useAsyncData(
12
+ key ?? `cms-site:${locale ?? ""}`,
13
+ async () => {
14
+ const result = await $cmsQuery(SITE_QUERY, { locale });
15
+ return result?.cmsSite ?? null;
16
+ },
17
+ {
18
+ default: fallback ?? (() => null),
19
+ ...asyncDataOptions
20
+ }
21
+ );
22
+ }
@@ -1,12 +1,6 @@
1
- export interface CmsToast {
2
- id: number;
1
+ export interface CmsNotice {
3
2
  title: string;
4
3
  description?: string;
5
4
  color?: 'success' | 'error';
6
5
  }
7
- export declare function useCmsToast(): {
8
- add: (input: Omit<CmsToast, "id">) => {
9
- id: import("@xleddyl/443-components-vue").ToastId;
10
- };
11
- remove: (id: string | number) => void;
12
- };
6
+ export declare function showCmsNotice(notice: CmsNotice): import("@xleddyl/443-components-vue").ToastId;
@@ -1,11 +1,5 @@
1
1
  import { toast } from "@xleddyl/443-components-vue";
2
- export function useCmsToast() {
3
- function add(input) {
4
- const show = input.color === "error" ? toast.error : input.color === "success" ? toast.success : toast;
5
- return { id: show(input.title, { description: input.description }) };
6
- }
7
- function remove(id) {
8
- toast.dismiss(id);
9
- }
10
- return { add, remove };
2
+ export function showCmsNotice(notice) {
3
+ const show = notice.color === "error" ? toast.error : notice.color === "success" ? toast.success : toast;
4
+ return show(notice.title, { description: notice.description });
11
5
  }
@@ -0,0 +1,15 @@
1
+ import type { FieldConfig } from '#nuxt-cms';
2
+ import type { MenuEntry } from '@xleddyl/443-components-vue';
3
+ import type { MaybeRefOrGetter, Ref } from 'vue';
4
+ type Values = Record<string, unknown>;
5
+ export interface CmsTranslationActionsOptions {
6
+ fields: MaybeRefOrGetter<Record<string, FieldConfig>>;
7
+ state: Ref<Values>;
8
+ locale?: MaybeRefOrGetter<string | null | undefined>;
9
+ disabled?: MaybeRefOrGetter<boolean | null | undefined>;
10
+ apply?: (values: Values) => void;
11
+ }
12
+ export declare function useCmsTranslationActions(options: CmsTranslationActionsOptions): {
13
+ items: import("vue").ComputedRef<MenuEntry[]>;
14
+ };
15
+ export {};
@@ -0,0 +1,108 @@
1
+ import { toast } from "@xleddyl/443-components-vue";
2
+ import { computed, toValue } from "#imports";
3
+ import {
4
+ clearTranslations,
5
+ copyTranslations,
6
+ hasTranslatableContent
7
+ } from "../../shared/translations.js";
8
+ import { cmsIcon } from "../utils/ui.js";
9
+ import { useCmsConfirm } from "./cms-confirm.js";
10
+ import { useCmsRuntime } from "./cms-runtime.js";
11
+ function code(locale) {
12
+ return locale.toUpperCase();
13
+ }
14
+ function valuesLabel(count) {
15
+ return `${count} ${count === 1 ? "value" : "values"}`;
16
+ }
17
+ export function useCmsTranslationActions(options) {
18
+ const { i18n } = useCmsRuntime();
19
+ const confirmAction = useCmsConfirm();
20
+ function commit(values) {
21
+ if (options.apply) options.apply(values);
22
+ else options.state.value = values;
23
+ }
24
+ function copy(from, to, overwrite) {
25
+ const result = copyTranslations(toValue(options.fields), options.state.value, i18n, {
26
+ from,
27
+ to,
28
+ overwrite
29
+ });
30
+ if (!result.count) return;
31
+ commit(result.values);
32
+ toast.success(`Copied ${valuesLabel(result.count)} from ${code(from)} to ${code(to)}`);
33
+ }
34
+ async function replace(from, to) {
35
+ const confirmed = await confirmAction({
36
+ title: `Replace ${code(to)} with ${code(from)}?`,
37
+ description: `Every ${code(to)} value that has a ${code(
38
+ from
39
+ )} version is overwritten. The change stays unsaved until you save.`,
40
+ confirmLabel: "Replace"
41
+ });
42
+ if (confirmed) copy(from, to, true);
43
+ }
44
+ async function clear(locale) {
45
+ const confirmed = await confirmAction({
46
+ title: `Clear ${code(locale)}?`,
47
+ description: `The ${code(locale)} values are removed and the site shows the ${code(
48
+ i18n.defaultLocale
49
+ )} text instead. The change stays unsaved until you save.`,
50
+ confirmLabel: "Clear"
51
+ });
52
+ if (!confirmed) return;
53
+ const result = clearTranslations(toValue(options.fields), options.state.value, i18n, locale);
54
+ commit(result.values);
55
+ toast.success(`Cleared ${valuesLabel(result.count)} in ${code(locale)}`);
56
+ }
57
+ function copyItem(fields, from, to) {
58
+ const values = options.state.value;
59
+ const empty = copyTranslations(fields, values, i18n, { from, to }).count;
60
+ const all = copyTranslations(fields, values, i18n, { from, to, overwrite: true }).count;
61
+ return {
62
+ label: `Copy ${code(from)} into ${code(to)}`,
63
+ icon: cmsIcon("language"),
64
+ disabled: !all,
65
+ disabledReason: `Nothing in ${code(from)} to copy`,
66
+ children: [
67
+ {
68
+ label: "Fill empty values",
69
+ description: empty ? `${valuesLabel(empty)}, keeps what ${code(to)} has` : `No empty ${code(to)} values`,
70
+ disabled: !empty,
71
+ onSelect: () => copy(from, to, false)
72
+ },
73
+ {
74
+ label: "Replace all values\u2026",
75
+ description: `${valuesLabel(all)}, overwrites ${code(to)}`,
76
+ onSelect: () => void replace(from, to)
77
+ }
78
+ ]
79
+ };
80
+ }
81
+ function clearItem(fields, locale) {
82
+ const count = clearTranslations(fields, options.state.value, i18n, locale).count;
83
+ return {
84
+ label: `Clear ${code(locale)}\u2026`,
85
+ icon: cmsIcon("backspace"),
86
+ tone: "danger",
87
+ description: count ? `${valuesLabel(count)}, falls back to ${code(i18n.defaultLocale)}` : void 0,
88
+ disabled: !count,
89
+ disabledReason: `No ${code(locale)} values`,
90
+ onSelect: () => void clear(locale)
91
+ };
92
+ }
93
+ const items = computed(() => {
94
+ if (toValue(options.disabled) || i18n.locales.length < 2) return [];
95
+ const fields = toValue(options.fields);
96
+ if (!hasTranslatableContent(fields)) return [];
97
+ const active = toValue(options.locale);
98
+ const targets = active && i18n.locales.includes(active) ? [active] : i18n.locales.filter((locale) => locale !== i18n.defaultLocale);
99
+ return [
100
+ { type: "label", label: "Translations" },
101
+ ...targets.flatMap((target) => [
102
+ ...i18n.locales.filter((source) => source !== target).map((source) => copyItem(fields, source, target)),
103
+ ...target === i18n.defaultLocale ? [] : [clearItem(fields, target)]
104
+ ])
105
+ ];
106
+ });
107
+ return { items };
108
+ }
@@ -0,0 +1,4 @@
1
+ declare module '*.css?url' {
2
+ const href: string
3
+ export default href
4
+ }
@@ -0,0 +1,89 @@
1
+ import type { PropType } from 'vue';
2
+ import type { CmsImageMedia } from '../../shared/media-focal.js';
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ media: {
5
+ type: PropType<CmsImageMedia | null>;
6
+ default: null;
7
+ };
8
+ alt: {
9
+ type: StringConstructor;
10
+ default: undefined;
11
+ };
12
+ width: {
13
+ type: (NumberConstructor | StringConstructor)[];
14
+ default: undefined;
15
+ };
16
+ height: {
17
+ type: (NumberConstructor | StringConstructor)[];
18
+ default: undefined;
19
+ };
20
+ loading: {
21
+ type: PropType<"lazy" | "eager">;
22
+ default: string;
23
+ };
24
+ decoding: {
25
+ type: PropType<"async" | "auto" | "sync">;
26
+ default: string;
27
+ };
28
+ picture: {
29
+ type: BooleanConstructor;
30
+ default: boolean;
31
+ };
32
+ provider: {
33
+ type: StringConstructor;
34
+ default: undefined;
35
+ };
36
+ modifiers: {
37
+ type: PropType<Record<string, unknown>>;
38
+ default: undefined;
39
+ };
40
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
41
+ media: {
42
+ type: PropType<CmsImageMedia | null>;
43
+ default: null;
44
+ };
45
+ alt: {
46
+ type: StringConstructor;
47
+ default: undefined;
48
+ };
49
+ width: {
50
+ type: (NumberConstructor | StringConstructor)[];
51
+ default: undefined;
52
+ };
53
+ height: {
54
+ type: (NumberConstructor | StringConstructor)[];
55
+ default: undefined;
56
+ };
57
+ loading: {
58
+ type: PropType<"lazy" | "eager">;
59
+ default: string;
60
+ };
61
+ decoding: {
62
+ type: PropType<"async" | "auto" | "sync">;
63
+ default: string;
64
+ };
65
+ picture: {
66
+ type: BooleanConstructor;
67
+ default: boolean;
68
+ };
69
+ provider: {
70
+ type: StringConstructor;
71
+ default: undefined;
72
+ };
73
+ modifiers: {
74
+ type: PropType<Record<string, unknown>>;
75
+ default: undefined;
76
+ };
77
+ }>> & Readonly<{}>, {
78
+ media: CmsImageMedia | null;
79
+ alt: string;
80
+ width: string | number;
81
+ height: string | number;
82
+ picture: boolean;
83
+ loading: "lazy" | "eager";
84
+ decoding: "auto" | "async" | "sync";
85
+ provider: string;
86
+ modifiers: Record<string, unknown>;
87
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
88
+ declare const _default: typeof __VLS_export;
89
+ export default _default;
@@ -0,0 +1,91 @@
1
+ <template>
2
+ <component :is="nuxtComponent" v-if="image && nuxtComponent" v-bind="nuxtBindings" />
3
+ <img v-else-if="image" v-bind="plainBindings" />
4
+ </template>
5
+
6
+ <script setup>
7
+ import { cmsImageProvider, cmsNuxtImg, cmsNuxtPicture } from "#cms-image";
8
+ import { computed, useAttrs } from "#imports";
9
+ import {
10
+ cmsImageSize,
11
+ focalObjectPosition,
12
+ imgixFocalModifiers,
13
+ isRenderableImage
14
+ } from "../../shared/media-focal";
15
+ import { useCmsRuntime } from "../composables/cms-runtime";
16
+ defineOptions({ inheritAttrs: false });
17
+ const props = defineProps({
18
+ media: { type: Object, default: null },
19
+ alt: { type: String, default: void 0 },
20
+ width: { type: [Number, String], default: void 0 },
21
+ height: { type: [Number, String], default: void 0 },
22
+ loading: { type: String, default: "lazy" },
23
+ decoding: { type: String, default: "async" },
24
+ picture: { type: Boolean, default: false },
25
+ provider: { type: String, default: void 0 },
26
+ modifiers: { type: Object, default: void 0 }
27
+ });
28
+ const attrs = useAttrs();
29
+ const { mediaStorage } = useCmsRuntime();
30
+ const image = computed(() => isRenderableImage(props.media) ? props.media : null);
31
+ const size = computed(() => cmsImageSize(image.value, { width: props.width, height: props.height }));
32
+ const objectPosition = computed(() => focalObjectPosition(image.value));
33
+ const positioned = computed(
34
+ () => objectPosition.value ? { style: [attrs.style, { objectPosition: objectPosition.value }] } : {}
35
+ );
36
+ const provider = computed(() => props.provider ?? cmsImageProvider);
37
+ const nuxtComponent = computed(() => {
38
+ if (!cmsNuxtImg) return null;
39
+ if (!props.provider && mediaStorage === "filesystem" && (provider.value ?? "ipx") === "ipx")
40
+ return null;
41
+ return props.picture ? cmsNuxtPicture : cmsNuxtImg;
42
+ });
43
+ const common = computed(() => ({
44
+ src: image.value?.url ?? void 0,
45
+ alt: props.alt ?? image.value?.alt ?? "",
46
+ width: size.value.width,
47
+ height: size.value.height,
48
+ loading: props.loading,
49
+ decoding: props.decoding
50
+ }));
51
+ const NUXT_IMAGE_ATTRS = /* @__PURE__ */ new Set([
52
+ "sizes",
53
+ "densities",
54
+ "format",
55
+ "quality",
56
+ "fit",
57
+ "preset",
58
+ "placeholder",
59
+ "placeholderClass",
60
+ "placeholder-class",
61
+ "background",
62
+ "preload",
63
+ "imgAttrs",
64
+ "img-attrs"
65
+ ]);
66
+ const plainBindings = computed(() => ({
67
+ ...Object.fromEntries(Object.entries(attrs).filter(([key]) => !NUXT_IMAGE_ATTRS.has(key))),
68
+ ...common.value,
69
+ ...positioned.value
70
+ }));
71
+ const nuxtBindings = computed(() => {
72
+ const focal = provider.value === "imgix" ? imgixFocalModifiers(image.value) : {};
73
+ const modifiers = { ...focal, ...props.modifiers };
74
+ const base = {
75
+ ...attrs,
76
+ ...common.value,
77
+ provider: props.provider,
78
+ modifiers: Object.keys(modifiers).length ? modifiers : void 0
79
+ };
80
+ if (!props.picture) return { ...base, ...positioned.value };
81
+ const imgAttrs = attrs.imgAttrs ?? attrs["img-attrs"] ?? {};
82
+ if (!objectPosition.value) return base;
83
+ return {
84
+ ...base,
85
+ imgAttrs: {
86
+ ...imgAttrs,
87
+ style: [imgAttrs.style, { objectPosition: objectPosition.value }]
88
+ }
89
+ };
90
+ });
91
+ </script>