@mapomodule/uikit 1.0.0 → 2.0.0-beta.10

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 (427) hide show
  1. package/README.md +199 -0
  2. package/dist/index.d.mts +5 -0
  3. package/dist/index.d.ts +6 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.mjs +1 -0
  6. package/dist/module.d.mts +60 -0
  7. package/dist/module.d.ts +55 -0
  8. package/dist/module.d.ts.map +1 -0
  9. package/dist/module.json +9 -0
  10. package/dist/module.mjs +179 -0
  11. package/dist/runtime/adapters/defaultMediaAdapter.d.ts +14 -0
  12. package/dist/runtime/adapters/defaultMediaAdapter.d.ts.map +1 -0
  13. package/dist/runtime/adapters/defaultMediaAdapter.js +30 -0
  14. package/dist/runtime/assets/main.css +1 -0
  15. package/dist/runtime/components/MapoConfirmDialog.vue +35 -0
  16. package/dist/runtime/components/MapoConfirmDialog.vue.d.ts +4 -0
  17. package/dist/runtime/components/MapoConfirmDialog.vue.d.ts.map +1 -0
  18. package/dist/runtime/components/MapoDetail.vue +606 -0
  19. package/dist/runtime/components/MapoDetail.vue.d.ts +401 -0
  20. package/dist/runtime/components/MapoDetail.vue.d.ts.map +1 -0
  21. package/dist/runtime/components/MapoDetailLangSwitch.vue +126 -0
  22. package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts +23 -0
  23. package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts.map +1 -0
  24. package/dist/runtime/components/MapoDropArea.vue +99 -0
  25. package/dist/runtime/components/MapoDropArea.vue.d.ts +33 -0
  26. package/dist/runtime/components/MapoDropArea.vue.d.ts.map +1 -0
  27. package/dist/runtime/components/MapoLangSwitcher.vue +39 -0
  28. package/dist/runtime/components/MapoLangSwitcher.vue.d.ts +18 -0
  29. package/dist/runtime/components/MapoLangSwitcher.vue.d.ts.map +1 -0
  30. package/dist/runtime/components/MapoList.vue +191 -0
  31. package/dist/runtime/components/MapoList.vue.d.ts +111 -0
  32. package/dist/runtime/components/MapoList.vue.d.ts.map +1 -0
  33. package/dist/runtime/components/MapoListActions.vue +119 -0
  34. package/dist/runtime/components/MapoListActions.vue.d.ts +33 -0
  35. package/dist/runtime/components/MapoListActions.vue.d.ts.map +1 -0
  36. package/dist/runtime/components/MapoListFilters.vue +246 -0
  37. package/dist/runtime/components/MapoListFilters.vue.d.ts +38 -0
  38. package/dist/runtime/components/MapoListFilters.vue.d.ts.map +1 -0
  39. package/dist/runtime/components/MapoListHead.vue +9 -0
  40. package/dist/runtime/components/MapoListHead.vue.d.ts +14 -0
  41. package/dist/runtime/components/MapoListHead.vue.d.ts.map +1 -0
  42. package/dist/runtime/components/MapoListQuickEdit.vue +123 -0
  43. package/dist/runtime/components/MapoListQuickEdit.vue.d.ts +47 -0
  44. package/dist/runtime/components/MapoListQuickEdit.vue.d.ts.map +1 -0
  45. package/dist/runtime/components/MapoListTable.vue +665 -0
  46. package/dist/runtime/components/MapoListTable.vue.d.ts +105 -0
  47. package/dist/runtime/components/MapoListTable.vue.d.ts.map +1 -0
  48. package/dist/runtime/components/MapoListTabs.vue +38 -0
  49. package/dist/runtime/components/MapoListTabs.vue.d.ts +26 -0
  50. package/dist/runtime/components/MapoListTabs.vue.d.ts.map +1 -0
  51. package/dist/runtime/components/MapoLogin.vue +196 -0
  52. package/dist/runtime/components/MapoLogin.vue.d.ts +22 -0
  53. package/dist/runtime/components/MapoLogin.vue.d.ts.map +1 -0
  54. package/dist/runtime/components/MapoLogoutButton.vue +27 -0
  55. package/dist/runtime/components/MapoLogoutButton.vue.d.ts +29 -0
  56. package/dist/runtime/components/MapoLogoutButton.vue.d.ts.map +1 -0
  57. package/dist/runtime/components/MapoMediaBreadcrumbs.vue +47 -0
  58. package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts +4 -0
  59. package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts.map +1 -0
  60. package/dist/runtime/components/MapoMediaEditor.vue +320 -0
  61. package/dist/runtime/components/MapoMediaEditor.vue.d.ts +8 -0
  62. package/dist/runtime/components/MapoMediaEditor.vue.d.ts.map +1 -0
  63. package/dist/runtime/components/MapoMediaFileChanger.vue +112 -0
  64. package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts +15 -0
  65. package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts.map +1 -0
  66. package/dist/runtime/components/MapoMediaFolders.vue +220 -0
  67. package/dist/runtime/components/MapoMediaFolders.vue.d.ts +4 -0
  68. package/dist/runtime/components/MapoMediaFolders.vue.d.ts.map +1 -0
  69. package/dist/runtime/components/MapoMediaGallery.vue +219 -0
  70. package/dist/runtime/components/MapoMediaGallery.vue.d.ts +4 -0
  71. package/dist/runtime/components/MapoMediaGallery.vue.d.ts.map +1 -0
  72. package/dist/runtime/components/MapoMediaManager.vue +140 -0
  73. package/dist/runtime/components/MapoMediaManager.vue.d.ts +35 -0
  74. package/dist/runtime/components/MapoMediaManager.vue.d.ts.map +1 -0
  75. package/dist/runtime/components/MapoMediaManagerDialog.vue +116 -0
  76. package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts +41 -0
  77. package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts.map +1 -0
  78. package/dist/runtime/components/MapoMediaPreview.vue +92 -0
  79. package/dist/runtime/components/MapoMediaPreview.vue.d.ts +19 -0
  80. package/dist/runtime/components/MapoMediaPreview.vue.d.ts.map +1 -0
  81. package/dist/runtime/components/MapoMediaUploader.vue +290 -0
  82. package/dist/runtime/components/MapoMediaUploader.vue.d.ts +8 -0
  83. package/dist/runtime/components/MapoMediaUploader.vue.d.ts.map +1 -0
  84. package/dist/runtime/components/MapoMenuManager.vue +273 -0
  85. package/dist/runtime/components/MapoMenuManager.vue.d.ts +92 -0
  86. package/dist/runtime/components/MapoMenuManager.vue.d.ts.map +1 -0
  87. package/dist/runtime/components/MapoMenuNodeEditor.vue +201 -0
  88. package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts +61 -0
  89. package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts.map +1 -0
  90. package/dist/runtime/components/MapoMenuTreeview.vue +181 -0
  91. package/dist/runtime/components/MapoMenuTreeview.vue.d.ts +57 -0
  92. package/dist/runtime/components/MapoMenuTreeview.vue.d.ts.map +1 -0
  93. package/dist/runtime/components/MapoMenuTreeviewNode.vue +175 -0
  94. package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts +27 -0
  95. package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts.map +1 -0
  96. package/dist/runtime/components/MapoRootComponents.vue +9 -0
  97. package/dist/runtime/components/MapoRootComponents.vue.d.ts +4 -0
  98. package/dist/runtime/components/MapoRootComponents.vue.d.ts.map +1 -0
  99. package/dist/runtime/components/MapoSidebar.vue +89 -0
  100. package/dist/runtime/components/MapoSidebar.vue.d.ts +22 -0
  101. package/dist/runtime/components/MapoSidebar.vue.d.ts.map +1 -0
  102. package/dist/runtime/components/MapoSidebarList.vue +27 -0
  103. package/dist/runtime/components/MapoSidebarList.vue.d.ts +8 -0
  104. package/dist/runtime/components/MapoSidebarList.vue.d.ts.map +1 -0
  105. package/dist/runtime/components/MapoSidebarListItem.vue +74 -0
  106. package/dist/runtime/components/MapoSidebarListItem.vue.d.ts +9 -0
  107. package/dist/runtime/components/MapoSidebarListItem.vue.d.ts.map +1 -0
  108. package/dist/runtime/components/MapoSidebarProfile.vue +55 -0
  109. package/dist/runtime/components/MapoSidebarProfile.vue.d.ts +10 -0
  110. package/dist/runtime/components/MapoSidebarProfile.vue.d.ts.map +1 -0
  111. package/dist/runtime/components/MapoSnackBar.vue +38 -0
  112. package/dist/runtime/components/MapoSnackBar.vue.d.ts +4 -0
  113. package/dist/runtime/components/MapoSnackBar.vue.d.ts.map +1 -0
  114. package/dist/runtime/components/MapoThemeToggle.vue +23 -0
  115. package/dist/runtime/components/MapoThemeToggle.vue.d.ts +4 -0
  116. package/dist/runtime/components/MapoThemeToggle.vue.d.ts.map +1 -0
  117. package/dist/runtime/components/MapoTopbar.vue +30 -0
  118. package/dist/runtime/components/MapoTopbar.vue.d.ts +15 -0
  119. package/dist/runtime/components/MapoTopbar.vue.d.ts.map +1 -0
  120. package/dist/runtime/components/menuDndContext.d.ts +19 -0
  121. package/dist/runtime/components/menuDndContext.d.ts.map +1 -0
  122. package/dist/runtime/components/menuDndContext.js +3 -0
  123. package/dist/runtime/layouts/default.vue +43 -0
  124. package/dist/runtime/layouts/default.vue.d.ts +20 -0
  125. package/dist/runtime/layouts/default.vue.d.ts.map +1 -0
  126. package/dist/runtime/layouts/empty.vue +9 -0
  127. package/dist/runtime/layouts/empty.vue.d.ts +14 -0
  128. package/dist/runtime/layouts/empty.vue.d.ts.map +1 -0
  129. package/dist/runtime/page-meta.nuxt.d.ts +45 -0
  130. package/dist/runtime/pages/index.vue +14 -0
  131. package/dist/runtime/pages/index.vue.d.ts +4 -0
  132. package/dist/runtime/pages/index.vue.d.ts.map +1 -0
  133. package/dist/runtime/pages/login.vue +3 -0
  134. package/dist/runtime/pages/login.vue.d.ts +4 -0
  135. package/dist/runtime/pages/login.vue.d.ts.map +1 -0
  136. package/dist/runtime/plugins/media-adapter.d.ts +18 -0
  137. package/dist/runtime/plugins/media-adapter.d.ts.map +1 -0
  138. package/dist/runtime/plugins/media-adapter.js +8 -0
  139. package/dist/runtime/stores/media.d.ts +462 -0
  140. package/dist/runtime/stores/media.d.ts.map +1 -0
  141. package/dist/runtime/stores/media.js +344 -0
  142. package/dist/runtime/types/list.d.ts +59 -0
  143. package/dist/runtime/types/list.d.ts.map +1 -0
  144. package/dist/runtime/types/list.js +0 -0
  145. package/dist/runtime/types/media.d.ts +116 -0
  146. package/dist/runtime/types/media.d.ts.map +1 -0
  147. package/dist/runtime/types/media.js +0 -0
  148. package/dist/runtime/types/menu.d.ts +66 -0
  149. package/dist/runtime/types/menu.d.ts.map +1 -0
  150. package/dist/runtime/types/menu.js +30 -0
  151. package/dist/types.d.mts +9 -0
  152. package/package.json +67 -12
  153. package/src/index.ts +30 -0
  154. package/src/module.ts +311 -0
  155. package/src/runtime/adapters/defaultMediaAdapter.ts +57 -0
  156. package/src/runtime/assets/main.css +59 -0
  157. package/src/runtime/components/MapoConfirmDialog.vue +36 -0
  158. package/src/runtime/components/MapoDetail.vue +864 -0
  159. package/src/runtime/components/MapoDetailLangSwitch.vue +166 -0
  160. package/src/runtime/components/MapoDropArea.vue +127 -0
  161. package/src/runtime/components/MapoLangSwitcher.vue +74 -0
  162. package/src/runtime/components/MapoList.vue +339 -0
  163. package/src/runtime/components/MapoListActions.vue +158 -0
  164. package/src/runtime/components/MapoListFilters.vue +292 -0
  165. package/src/runtime/components/MapoListHead.vue +12 -0
  166. package/src/runtime/components/MapoListQuickEdit.vue +166 -0
  167. package/src/runtime/components/MapoListTable.vue +931 -0
  168. package/src/runtime/components/MapoListTabs.vue +48 -0
  169. package/src/runtime/components/MapoLogin.vue +212 -0
  170. package/src/runtime/components/MapoLogoutButton.vue +48 -0
  171. package/src/runtime/components/MapoMediaBreadcrumbs.vue +53 -0
  172. package/src/runtime/components/MapoMediaEditor.vue +350 -0
  173. package/src/runtime/components/MapoMediaFileChanger.vue +136 -0
  174. package/src/runtime/components/MapoMediaFolders.vue +239 -0
  175. package/src/runtime/components/MapoMediaGallery.vue +239 -0
  176. package/src/runtime/components/MapoMediaManager.vue +180 -0
  177. package/src/runtime/components/MapoMediaManagerDialog.vue +148 -0
  178. package/src/runtime/components/MapoMediaPreview.vue +111 -0
  179. package/src/runtime/components/MapoMediaUploader.vue +351 -0
  180. package/src/runtime/components/MapoMenuManager.vue +402 -0
  181. package/src/runtime/components/MapoMenuNodeEditor.vue +282 -0
  182. package/src/runtime/components/MapoMenuTreeview.vue +264 -0
  183. package/src/runtime/components/MapoMenuTreeviewNode.vue +234 -0
  184. package/src/runtime/components/MapoRootComponents.vue +9 -0
  185. package/src/runtime/components/MapoSidebar.vue +114 -0
  186. package/src/runtime/components/MapoSidebarList.vue +35 -0
  187. package/src/runtime/components/MapoSidebarListItem.vue +79 -0
  188. package/src/runtime/components/MapoSidebarProfile.vue +61 -0
  189. package/src/runtime/components/MapoSnackBar.vue +42 -0
  190. package/src/runtime/components/MapoThemeToggle.vue +27 -0
  191. package/src/runtime/components/MapoTopbar.vue +36 -0
  192. package/src/runtime/components/menuDndContext.ts +22 -0
  193. package/src/runtime/layouts/default.vue +53 -0
  194. package/src/runtime/layouts/empty.vue +9 -0
  195. package/src/runtime/page-meta.nuxt.d.ts +45 -0
  196. package/src/runtime/pages/index.vue +15 -0
  197. package/src/runtime/pages/login.vue +3 -0
  198. package/src/runtime/plugins/media-adapter.ts +33 -0
  199. package/src/runtime/stores/media.ts +474 -0
  200. package/src/runtime/types/list.ts +64 -0
  201. package/src/runtime/types/media.ts +126 -0
  202. package/src/runtime/types/menu.ts +105 -0
  203. package/CHANGELOG.md +0 -1030
  204. package/assets/mixins.scss +0 -22
  205. package/assets/variables.scss +0 -18
  206. package/components/ConfirmDialog.vue +0 -173
  207. package/components/Detail/Detail.vue +0 -696
  208. package/components/Detail/DetailLangSwitch.vue +0 -79
  209. package/components/DropArea.vue +0 -257
  210. package/components/Form/Form.vue +0 -218
  211. package/components/Form/FormField.vue +0 -216
  212. package/components/Form/FormGroup.vue +0 -146
  213. package/components/Form/FormTabs.vue +0 -188
  214. package/components/Form/defaults.js +0 -98
  215. package/components/Form/fields/ColorField.vue +0 -79
  216. package/components/Form/fields/DateField.vue +0 -77
  217. package/components/Form/fields/DateTimeField.vue +0 -271
  218. package/components/Form/fields/EnhancedMediaField.vue +0 -224
  219. package/components/Form/fields/FileField.vue +0 -125
  220. package/components/Form/fields/FksField.vue +0 -115
  221. package/components/Form/fields/MediaField.vue +0 -159
  222. package/components/Form/fields/MediaM2mField.vue +0 -149
  223. package/components/Form/fields/Repeater.vue +0 -618
  224. package/components/Form/fields/SeoPreview.vue +0 -89
  225. package/components/Form/fields/TimeField.vue +0 -154
  226. package/components/Form/fields/mapField/leaflet.injector.js +0 -39
  227. package/components/Form/fields/mapField/mapField.vue +0 -350
  228. package/components/Form/fields/wygEditor/defaults.js +0 -25
  229. package/components/Form/fields/wygEditor/utils/events.js +0 -64
  230. package/components/Form/fields/wygEditor/utils/mapomedia.plugin.js +0 -32
  231. package/components/Form/fields/wygEditor/utils/tinymce.injector.js +0 -29
  232. package/components/Form/fields/wygEditor/wygEditor.vue +0 -285
  233. package/components/Form/fields/wygEditorCKE/defaults.js +0 -103
  234. package/components/Form/fields/wygEditorCKE/utils/ckeditor.injector.js +0 -29
  235. package/components/Form/fields/wygEditorCKE/wygEditorCKE.vue +0 -270
  236. package/components/LangSwitcher.vue +0 -44
  237. package/components/List/List.vue +0 -271
  238. package/components/List/ListActions.vue +0 -164
  239. package/components/List/ListFilters.vue +0 -372
  240. package/components/List/ListHead.vue +0 -67
  241. package/components/List/ListQuickEdit.vue +0 -228
  242. package/components/List/ListTable.vue +0 -484
  243. package/components/List/ListTabs.vue +0 -65
  244. package/components/Login.vue +0 -125
  245. package/components/Logo.vue +0 -79
  246. package/components/LogoutButton.vue +0 -54
  247. package/components/MediaManager/MediaBreadcrumbs.vue +0 -45
  248. package/components/MediaManager/MediaEditor.vue +0 -340
  249. package/components/MediaManager/MediaFileChanger.vue +0 -78
  250. package/components/MediaManager/MediaFolders.vue +0 -287
  251. package/components/MediaManager/MediaGallery.vue +0 -281
  252. package/components/MediaManager/MediaManager.vue +0 -159
  253. package/components/MediaManager/MediaManagerDialog.vue +0 -104
  254. package/components/MediaManager/MediaPreview.vue +0 -258
  255. package/components/MediaManager/MediaUploader.vue +0 -163
  256. package/components/MenuManager/MenuManager.vue +0 -332
  257. package/components/MenuManager/MenuNodeEditor.vue +0 -270
  258. package/components/MenuManager/MenuTreeview.vue +0 -237
  259. package/components/MenuManager/MenuTreeviewNode.vue +0 -208
  260. package/components/PagePreview.vue +0 -58
  261. package/components/RootComponents.vue +0 -25
  262. package/components/SnackBar.vue +0 -69
  263. package/components/ThemeToggle.vue +0 -13
  264. package/components/layout/Sidebar/Sidebar.vue +0 -89
  265. package/components/layout/Sidebar/SidebarList.vue +0 -49
  266. package/components/layout/Sidebar/SidebarListItem.vue +0 -185
  267. package/components/layout/Sidebar/SidebarProfile.vue +0 -42
  268. package/components/layout/Sidebar/SidebarTitle.vue +0 -45
  269. package/components/layout/Topbar/Topbar.vue +0 -29
  270. package/components/layout/routebuilder.js +0 -48
  271. package/defaults/i18n.js +0 -37
  272. package/defaults/vuetify.js +0 -34
  273. package/layouts/default.vue +0 -47
  274. package/layouts/empty.vue +0 -16
  275. package/module.js +0 -80
  276. package/pages/index.vue +0 -37
  277. package/pages/login.vue +0 -10
  278. package/static/mapo/ckeditor/plugins/image2/dev/assets/image1.jpg +0 -0
  279. package/static/mapo/ckeditor/plugins/image2/dev/assets/image2.jpg +0 -0
  280. package/static/mapo/ckeditor/plugins/image2/dev/contents.css +0 -35
  281. package/static/mapo/ckeditor/plugins/image2/dev/image2.html +0 -338
  282. package/static/mapo/ckeditor/plugins/image2/dialogs/image2.js +0 -557
  283. package/static/mapo/ckeditor/plugins/image2/icons/hidpi/image.png +0 -0
  284. package/static/mapo/ckeditor/plugins/image2/icons/image.png +0 -0
  285. package/static/mapo/ckeditor/plugins/image2/lang/af.js +0 -21
  286. package/static/mapo/ckeditor/plugins/image2/lang/ar.js +0 -21
  287. package/static/mapo/ckeditor/plugins/image2/lang/az.js +0 -21
  288. package/static/mapo/ckeditor/plugins/image2/lang/bg.js +0 -21
  289. package/static/mapo/ckeditor/plugins/image2/lang/bn.js +0 -21
  290. package/static/mapo/ckeditor/plugins/image2/lang/bs.js +0 -21
  291. package/static/mapo/ckeditor/plugins/image2/lang/ca.js +0 -21
  292. package/static/mapo/ckeditor/plugins/image2/lang/cs.js +0 -21
  293. package/static/mapo/ckeditor/plugins/image2/lang/cy.js +0 -21
  294. package/static/mapo/ckeditor/plugins/image2/lang/da.js +0 -21
  295. package/static/mapo/ckeditor/plugins/image2/lang/de-ch.js +0 -21
  296. package/static/mapo/ckeditor/plugins/image2/lang/de.js +0 -21
  297. package/static/mapo/ckeditor/plugins/image2/lang/el.js +0 -21
  298. package/static/mapo/ckeditor/plugins/image2/lang/en-au.js +0 -21
  299. package/static/mapo/ckeditor/plugins/image2/lang/en-ca.js +0 -21
  300. package/static/mapo/ckeditor/plugins/image2/lang/en-gb.js +0 -21
  301. package/static/mapo/ckeditor/plugins/image2/lang/en.js +0 -21
  302. package/static/mapo/ckeditor/plugins/image2/lang/eo.js +0 -21
  303. package/static/mapo/ckeditor/plugins/image2/lang/es-mx.js +0 -21
  304. package/static/mapo/ckeditor/plugins/image2/lang/es.js +0 -21
  305. package/static/mapo/ckeditor/plugins/image2/lang/et.js +0 -21
  306. package/static/mapo/ckeditor/plugins/image2/lang/eu.js +0 -21
  307. package/static/mapo/ckeditor/plugins/image2/lang/fa.js +0 -21
  308. package/static/mapo/ckeditor/plugins/image2/lang/fi.js +0 -21
  309. package/static/mapo/ckeditor/plugins/image2/lang/fo.js +0 -21
  310. package/static/mapo/ckeditor/plugins/image2/lang/fr-ca.js +0 -21
  311. package/static/mapo/ckeditor/plugins/image2/lang/fr.js +0 -21
  312. package/static/mapo/ckeditor/plugins/image2/lang/gl.js +0 -21
  313. package/static/mapo/ckeditor/plugins/image2/lang/gu.js +0 -21
  314. package/static/mapo/ckeditor/plugins/image2/lang/he.js +0 -21
  315. package/static/mapo/ckeditor/plugins/image2/lang/hi.js +0 -21
  316. package/static/mapo/ckeditor/plugins/image2/lang/hr.js +0 -21
  317. package/static/mapo/ckeditor/plugins/image2/lang/hu.js +0 -21
  318. package/static/mapo/ckeditor/plugins/image2/lang/id.js +0 -21
  319. package/static/mapo/ckeditor/plugins/image2/lang/is.js +0 -21
  320. package/static/mapo/ckeditor/plugins/image2/lang/it.js +0 -21
  321. package/static/mapo/ckeditor/plugins/image2/lang/ja.js +0 -21
  322. package/static/mapo/ckeditor/plugins/image2/lang/ka.js +0 -21
  323. package/static/mapo/ckeditor/plugins/image2/lang/km.js +0 -21
  324. package/static/mapo/ckeditor/plugins/image2/lang/ko.js +0 -21
  325. package/static/mapo/ckeditor/plugins/image2/lang/ku.js +0 -21
  326. package/static/mapo/ckeditor/plugins/image2/lang/lt.js +0 -21
  327. package/static/mapo/ckeditor/plugins/image2/lang/lv.js +0 -21
  328. package/static/mapo/ckeditor/plugins/image2/lang/mk.js +0 -21
  329. package/static/mapo/ckeditor/plugins/image2/lang/mn.js +0 -21
  330. package/static/mapo/ckeditor/plugins/image2/lang/ms.js +0 -21
  331. package/static/mapo/ckeditor/plugins/image2/lang/nb.js +0 -21
  332. package/static/mapo/ckeditor/plugins/image2/lang/nl.js +0 -21
  333. package/static/mapo/ckeditor/plugins/image2/lang/no.js +0 -21
  334. package/static/mapo/ckeditor/plugins/image2/lang/oc.js +0 -21
  335. package/static/mapo/ckeditor/plugins/image2/lang/pl.js +0 -21
  336. package/static/mapo/ckeditor/plugins/image2/lang/pt-br.js +0 -21
  337. package/static/mapo/ckeditor/plugins/image2/lang/pt.js +0 -21
  338. package/static/mapo/ckeditor/plugins/image2/lang/ro.js +0 -21
  339. package/static/mapo/ckeditor/plugins/image2/lang/ru.js +0 -21
  340. package/static/mapo/ckeditor/plugins/image2/lang/si.js +0 -21
  341. package/static/mapo/ckeditor/plugins/image2/lang/sk.js +0 -21
  342. package/static/mapo/ckeditor/plugins/image2/lang/sl.js +0 -21
  343. package/static/mapo/ckeditor/plugins/image2/lang/sq.js +0 -21
  344. package/static/mapo/ckeditor/plugins/image2/lang/sr-latn.js +0 -21
  345. package/static/mapo/ckeditor/plugins/image2/lang/sr.js +0 -21
  346. package/static/mapo/ckeditor/plugins/image2/lang/sv.js +0 -21
  347. package/static/mapo/ckeditor/plugins/image2/lang/th.js +0 -21
  348. package/static/mapo/ckeditor/plugins/image2/lang/tr.js +0 -21
  349. package/static/mapo/ckeditor/plugins/image2/lang/tt.js +0 -21
  350. package/static/mapo/ckeditor/plugins/image2/lang/ug.js +0 -21
  351. package/static/mapo/ckeditor/plugins/image2/lang/uk.js +0 -21
  352. package/static/mapo/ckeditor/plugins/image2/lang/vi.js +0 -21
  353. package/static/mapo/ckeditor/plugins/image2/lang/zh-cn.js +0 -21
  354. package/static/mapo/ckeditor/plugins/image2/lang/zh.js +0 -21
  355. package/static/mapo/ckeditor/plugins/image2/plugin.js +0 -1798
  356. package/static/mapo/ckeditor/plugins/image2/samples/assets/image1.jpg +0 -0
  357. package/static/mapo/ckeditor/plugins/image2/samples/assets/image2.jpg +0 -0
  358. package/static/mapo/ckeditor/plugins/image2/samples/image2.html +0 -68
  359. package/static/mapo/ckeditor/skins/moono/dev/icons16.png +0 -0
  360. package/static/mapo/ckeditor/skins/moono/dev/icons16.svg +0 -2374
  361. package/static/mapo/ckeditor/skins/moono/dev/icons32.png +0 -0
  362. package/static/mapo/ckeditor/skins/moono/dev/icons32.svg +0 -2722
  363. package/static/mapo/ckeditor/skins/moono/dev/locations.json +0 -144
  364. package/static/mapo/ckeditor/skins/moono/dialog.css +0 -5
  365. package/static/mapo/ckeditor/skins/moono/dialog_ie.css +0 -5
  366. package/static/mapo/ckeditor/skins/moono/dialog_ie7.css +0 -5
  367. package/static/mapo/ckeditor/skins/moono/dialog_ie8.css +0 -5
  368. package/static/mapo/ckeditor/skins/moono/dialog_iequirks.css +0 -5
  369. package/static/mapo/ckeditor/skins/moono/editor.css +0 -5
  370. package/static/mapo/ckeditor/skins/moono/editor_gecko.css +0 -5
  371. package/static/mapo/ckeditor/skins/moono/editor_ie.css +0 -5
  372. package/static/mapo/ckeditor/skins/moono/editor_ie7.css +0 -5
  373. package/static/mapo/ckeditor/skins/moono/editor_ie8.css +0 -5
  374. package/static/mapo/ckeditor/skins/moono/editor_iequirks.css +0 -5
  375. package/static/mapo/ckeditor/skins/moono/icons.png +0 -0
  376. package/static/mapo/ckeditor/skins/moono/icons_hidpi.png +0 -0
  377. package/static/mapo/ckeditor/skins/moono/images/anchor.png +0 -0
  378. package/static/mapo/ckeditor/skins/moono/images/arrow.png +0 -0
  379. package/static/mapo/ckeditor/skins/moono/images/close.png +0 -0
  380. package/static/mapo/ckeditor/skins/moono/images/hidpi/anchor.png +0 -0
  381. package/static/mapo/ckeditor/skins/moono/images/hidpi/close.png +0 -0
  382. package/static/mapo/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
  383. package/static/mapo/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
  384. package/static/mapo/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
  385. package/static/mapo/ckeditor/skins/moono/images/lock-open.png +0 -0
  386. package/static/mapo/ckeditor/skins/moono/images/lock.png +0 -0
  387. package/static/mapo/ckeditor/skins/moono/images/refresh.png +0 -0
  388. package/static/mapo/ckeditor/skins/moono/images/spinner.gif +0 -0
  389. package/static/mapo/ckeditor/skins/moono/readme.md +0 -49
  390. package/static/mapo/ckeditor/skins/moono/skin.js +0 -10
  391. package/static/mapo/ckeditor/skins/moono-dark/dialog.css +0 -5
  392. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie.css +0 -5
  393. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie7.css +0 -5
  394. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie8.css +0 -5
  395. package/static/mapo/ckeditor/skins/moono-dark/dialog_iequirks.css +0 -5
  396. package/static/mapo/ckeditor/skins/moono-dark/editor.css +0 -5
  397. package/static/mapo/ckeditor/skins/moono-dark/editor_gecko.css +0 -5
  398. package/static/mapo/ckeditor/skins/moono-dark/editor_ie.css +0 -5
  399. package/static/mapo/ckeditor/skins/moono-dark/editor_ie7.css +0 -5
  400. package/static/mapo/ckeditor/skins/moono-dark/editor_ie8.css +0 -5
  401. package/static/mapo/ckeditor/skins/moono-dark/editor_iequirks.css +0 -5
  402. package/static/mapo/ckeditor/skins/moono-dark/icons.png +0 -0
  403. package/static/mapo/ckeditor/skins/moono-dark/icons_hidpi.png +0 -0
  404. package/static/mapo/ckeditor/skins/moono-dark/images/arrow.png +0 -0
  405. package/static/mapo/ckeditor/skins/moono-dark/images/close.png +0 -0
  406. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/close.png +0 -0
  407. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock-open.png +0 -0
  408. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock.png +0 -0
  409. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/refresh.png +0 -0
  410. package/static/mapo/ckeditor/skins/moono-dark/images/lock-open.png +0 -0
  411. package/static/mapo/ckeditor/skins/moono-dark/images/lock.png +0 -0
  412. package/static/mapo/ckeditor/skins/moono-dark/images/refresh.png +0 -0
  413. package/static/mapo/ckeditor/skins/moono-dark/readme.md +0 -51
  414. package/static/mapo/ckeditor/skins/moono-dark/skin.js +0 -5
  415. package/static/mapo/favicon.ico +0 -0
  416. package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +0 -7
  417. package/static/mapo/tinymce-skins/mapo-dark/content.min.css +0 -7
  418. package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +0 -7
  419. package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +0 -7
  420. package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +0 -7
  421. package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +0 -7
  422. package/static/mapo/tinymce-skins/mapo-light/content.min.css +0 -7
  423. package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +0 -7
  424. package/static/mapo/tinymce-skins/mapo-light/skin.min.css +0 -7
  425. package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +0 -7
  426. package/translations/en-US.js +0 -177
  427. package/translations/it-IT.js +0 -180
@@ -0,0 +1,474 @@
1
+ import { defineStore } from "pinia";
2
+ import { ref, computed, shallowRef } from "vue";
3
+ import { useConfirmStore } from "@mapomodule/store/runtime/stores/confirm";
4
+ import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
5
+ import { normalizeEndpoint } from "@mapomodule/utils";
6
+ import { useCrud } from "@mapomodule/core/runtime/api/crud";
7
+ import { useMapoT } from "@mapomodule/i18n/runtime/composables/useMapoT";
8
+ import { applyMultipartPolicy } from "@mapomodule/core/runtime/api/multipart";
9
+ import { useNuxtApp, useRuntimeConfig } from "#app";
10
+ import { defaultMediaAdapter } from "../adapters/defaultMediaAdapter.js";
11
+ import type {
12
+ MediaItem,
13
+ MediaFolder,
14
+ MediaApiResponse,
15
+ MediaGetRootParams,
16
+ MediaUploadPayload,
17
+ MediaAdapter,
18
+ MediaEndpoints,
19
+ SelectMode,
20
+ } from "../types/media.js";
21
+
22
+ export const useMediaStore = defineStore("mapo-media", () => {
23
+ // ─── Config (endpoints) ─────────────────────────────────────────────────
24
+ const runtimeConfig = useRuntimeConfig();
25
+ const mediaConfig = (runtimeConfig.public.mapoMedia ?? {}) as {
26
+ endpoints?: Partial<MediaEndpoints>;
27
+ };
28
+ const endpoints: MediaEndpoints = {
29
+ media: mediaConfig.endpoints?.media ?? "/api/media",
30
+ folders: mediaConfig.endpoints?.folders ?? "/api/media-folders",
31
+ };
32
+
33
+ /**
34
+ * Absolute-from-origin URL for the upload POST.
35
+ *
36
+ * Every other media request goes through `useCrud` → `$mapoFetch`, which
37
+ * inherits `baseURL: app.baseURL` from Nuxt's global `$fetch`. The upload has
38
+ * to use XHR (ofetch exposes no upload-progress hook), so it must reproduce
39
+ * that resolution itself: `normalizeEndpoint` for the path (same call
40
+ * `useCrud` makes) plus the app base. Skipping the base made the upload the
41
+ * only request to miss it, so on a sub-path deployment it bypassed server
42
+ * middleware mounted under that base — including the proxy that attaches
43
+ * `X-CSRFToken`, hence 403s on session-authenticated backends.
44
+ */
45
+ function uploadUrl(): string {
46
+ const app = runtimeConfig.app as { baseURL?: string } | undefined;
47
+ const base = (app?.baseURL ?? "/").replace(/\/+$/, "");
48
+ return `${base}${normalizeEndpoint(endpoints.media)}`;
49
+ }
50
+
51
+ // Adapter: backend-specific request/response transforms. Provided by a plugin
52
+ // ($mapoMediaAdapter); falls back to plain REST when none is registered.
53
+ function adapter(): MediaAdapter {
54
+ const nuxt = useNuxtApp() as unknown as {
55
+ $mapoMediaAdapter?: MediaAdapter;
56
+ };
57
+ return nuxt.$mapoMediaAdapter ?? defaultMediaAdapter;
58
+ }
59
+
60
+ // ─── State ────────────────────────────────────────────────────────────────
61
+ const medias = ref<MediaItem[]>([]);
62
+ const folders = ref<MediaFolder[]>([]);
63
+ const parentFolders = ref<MediaFolder[]>([]);
64
+ const page = ref(1);
65
+ const pages = ref(1);
66
+ const mimeType = ref<string | null>(null);
67
+ /**
68
+ * Mime constraint imposed by the host (e.g. an `image/*` picker field).
69
+ * When set, the folders panel only offers matching filters and `mimeType`
70
+ * cannot be cleared below the lock — a picker must never leak other types.
71
+ */
72
+ const lockedMime = ref<string | null>(null);
73
+ const loading = ref(false);
74
+ const editMedia = ref<MediaItem | null>(null);
75
+ const selection = shallowRef<MediaItem | MediaItem[] | null>(null);
76
+ const editList = ref<number[]>([]);
77
+ const selectMode = ref<SelectMode>("none");
78
+
79
+ // ─── Internal navigation context ────────────────────────────────────────
80
+ const _currentFolderId = ref<number | null>(null);
81
+ const _currentSearch = ref<string>("");
82
+ // Whether the current view spans the whole library (global search / mime
83
+ // filter) instead of the current folder. Persisted so pagination keeps the
84
+ // same scope as the request that produced page 1.
85
+ const _currentAll = ref(false);
86
+ const _currentLang = ref<string | undefined>(undefined);
87
+
88
+ // ─── Getters ──────────────────────────────────────────────────────────────
89
+ const parentFolder = computed(
90
+ () => parentFolders.value[parentFolders.value.length - 1] ?? null,
91
+ );
92
+
93
+ const editListSet = computed(() => new Set(editList.value));
94
+
95
+ const editListState = computed<{
96
+ value: boolean;
97
+ indeterminate: boolean;
98
+ outside: boolean;
99
+ }>(() => {
100
+ const total = medias.value.length;
101
+ const selected = editList.value.filter((id) =>
102
+ medias.value.some((m) => m.id === id),
103
+ ).length;
104
+ if (total === 0 || selected === 0)
105
+ return {
106
+ value: false,
107
+ indeterminate: false,
108
+ outside: editList.value.length > 0,
109
+ };
110
+ if (selected === total)
111
+ return { value: true, indeterminate: false, outside: false };
112
+ return { value: false, indeterminate: true, outside: false };
113
+ });
114
+
115
+ // ─── CRUD helpers ─────────────────────────────────────────────────────────
116
+ function mediaCrud() {
117
+ return useCrud<MediaItem>(endpoints.media);
118
+ }
119
+ function folderCrud() {
120
+ return useCrud<MediaFolder>(endpoints.folders);
121
+ }
122
+
123
+ // ─── Breadcrumb maintenance ─────────────────────────────────────────────
124
+ // Driven by the response's `parent_folder` (matches the legacy contract):
125
+ // push when entering a new folder, slice when navigating back up.
126
+ function applyParentFolder(pf: MediaFolder | null): void {
127
+ if (!pf) {
128
+ parentFolders.value = [];
129
+ return;
130
+ }
131
+ const key = pf.path ?? pf.id;
132
+ const idx = parentFolders.value.findIndex((f) => (f.path ?? f.id) === key);
133
+ if (idx === -1) {
134
+ parentFolders.value = [...parentFolders.value, pf];
135
+ } else {
136
+ parentFolders.value = parentFolders.value.slice(0, idx + 1);
137
+ }
138
+ }
139
+
140
+ // ─── Actions ──────────────────────────────────────────────────────────────
141
+
142
+ /**
143
+ * Fetch the current folder contents. Root (`folderId === null`) → `list()`,
144
+ * inside a folder → `detail(folderId)` on the folders endpoint. Both return
145
+ * the canonical `{ media, folders, parent_folder }` shape (after the adapter
146
+ * normalizes it).
147
+ */
148
+ async function getRoot(params: MediaGetRootParams = {}): Promise<void> {
149
+ loading.value = true;
150
+ if (params.search !== undefined) _currentSearch.value = params.search;
151
+ if (params.all !== undefined) _currentAll.value = params.all;
152
+
153
+ const all = _currentAll.value;
154
+ const folderId = all ? null : _currentFolderId.value;
155
+
156
+ try {
157
+ const a = adapter();
158
+ const listParams = (
159
+ a.buildListParams ?? defaultMediaAdapter.buildListParams
160
+ )({
161
+ page: params.page ?? page.value,
162
+ search: _currentSearch.value || undefined,
163
+ mime: mimeType.value,
164
+ all: all || undefined,
165
+ });
166
+
167
+ const crud = folderCrud();
168
+ const raw =
169
+ folderId != null
170
+ ? await crud.detail(folderId, { params: listParams })
171
+ : await crud.list(listParams as never);
172
+
173
+ const data = (
174
+ a.parseRootResponse ?? defaultMediaAdapter.parseRootResponse
175
+ )(raw) as MediaApiResponse;
176
+
177
+ medias.value = data.media.items;
178
+ page.value = data.media.paginator.page;
179
+ pages.value = data.media.paginator.pages;
180
+ folders.value = data.folders;
181
+ applyParentFolder(data.parent_folder);
182
+ } finally {
183
+ loading.value = false;
184
+ }
185
+ }
186
+
187
+ async function navigateToFolder(folder: MediaFolder | null): Promise<void> {
188
+ _currentFolderId.value = folder?.id ?? null;
189
+ _currentSearch.value = "";
190
+ _currentAll.value = false;
191
+ await getRoot({ page: 1 });
192
+ }
193
+
194
+ async function openEditor(media: MediaItem): Promise<void> {
195
+ try {
196
+ const a = adapter();
197
+ const params = (
198
+ a.buildDetailParams ?? defaultMediaAdapter.buildDetailParams
199
+ )({ lang: _currentLang.value });
200
+ const detail = await mediaCrud().detail(media.id, { params });
201
+ editMedia.value = detail;
202
+ } catch {
203
+ editMedia.value = media;
204
+ }
205
+ }
206
+
207
+ function closeEditor(): void {
208
+ editMedia.value = null;
209
+ }
210
+
211
+ function setLang(lang: string | undefined): void {
212
+ _currentLang.value = lang;
213
+ }
214
+
215
+ async function updateMedia(media: MediaItem): Promise<MediaItem> {
216
+ const a = adapter();
217
+ const payload = (
218
+ a.buildMediaPatchPayload ?? defaultMediaAdapter.buildMediaPatchPayload
219
+ )(media);
220
+ const updated = await mediaCrud().partialUpdate(media.id, payload as never);
221
+ // Keep the open editor in sync with the server response (legacy behavior).
222
+ if (editMedia.value?.id === media.id) editMedia.value = updated;
223
+ useSnackStore().show(useMapoT()("mapo.mediaManager.fileInfo"), "success");
224
+ await getRoot();
225
+ return updated;
226
+ }
227
+
228
+ async function replaceFile(
229
+ mediaId: number,
230
+ file: File,
231
+ maintainUrl = false,
232
+ ): Promise<MediaItem> {
233
+ const a = adapter();
234
+ const payload = (
235
+ a.buildReplaceFilePayload ?? defaultMediaAdapter.buildReplaceFilePayload
236
+ )(file, maintainUrl);
237
+ const updated = await mediaCrud().partialUpdate(
238
+ mediaId,
239
+ payload as never,
240
+ undefined,
241
+ { multipart: "force" },
242
+ );
243
+ if (editMedia.value?.id === mediaId) editMedia.value = updated;
244
+ return updated;
245
+ }
246
+
247
+ async function updateOrCreateFolder(
248
+ folder: Partial<MediaFolder>,
249
+ ): Promise<void> {
250
+ const a = adapter();
251
+ const payload = (
252
+ a.buildFolderPayload ?? defaultMediaAdapter.buildFolderPayload
253
+ )({
254
+ parent: _currentFolderId.value,
255
+ ...folder,
256
+ });
257
+ await folderCrud().updateOrCreate(payload as never);
258
+ await getRoot();
259
+ }
260
+
261
+ async function deleteFolder(folder: MediaFolder): Promise<void> {
262
+ const t = useMapoT();
263
+ const confirmed = await useConfirmStore().ask({
264
+ title: t("mapo.mediaFolders.deleteTitle"),
265
+ message: t("mapo.mediaFolders.confirmDelete", { name: folder.name }),
266
+ confirmText: t("mapo.delete"),
267
+ dangerous: true,
268
+ });
269
+ if (!confirmed) return;
270
+ await folderCrud().delete(folder.id);
271
+ await getRoot();
272
+ }
273
+
274
+ async function deleteMedia(media: MediaItem): Promise<void> {
275
+ const t = useMapoT();
276
+ const confirmed = await useConfirmStore().ask({
277
+ title: t("mapo.mediaManager.deleteTitle"),
278
+ message: t("mapo.mediaEditor.confirmDelete", {
279
+ name: media.title || media.file,
280
+ }),
281
+ confirmText: t("mapo.delete"),
282
+ dangerous: true,
283
+ });
284
+ if (!confirmed) return;
285
+ await mediaCrud().delete(media.id);
286
+ if (editMedia.value?.id === media.id) editMedia.value = null;
287
+ await getRoot();
288
+ }
289
+
290
+ function select(media: MediaItem): void {
291
+ if (selectMode.value === "none") {
292
+ openEditor(media);
293
+ return;
294
+ }
295
+ if (selectMode.value === "single") {
296
+ selection.value = media;
297
+ return;
298
+ }
299
+ // multi
300
+ const current = (selection.value as MediaItem[]) ?? [];
301
+ const idx = current.findIndex((m) => m.id === media.id);
302
+ selection.value =
303
+ idx === -1
304
+ ? [...current, media]
305
+ : current.filter((m) => m.id !== media.id);
306
+ }
307
+
308
+ function setSelectionMode(mode: SelectMode): void {
309
+ selectMode.value = mode;
310
+ selection.value = mode === "multi" ? [] : null;
311
+ }
312
+
313
+ function setSelection(value: MediaItem | MediaItem[] | null): void {
314
+ selection.value = value;
315
+ }
316
+
317
+ function editSelect(id: number | number[]): void {
318
+ const ids = Array.isArray(id) ? id : [id];
319
+ const set = new Set(editList.value);
320
+ for (const i of ids) {
321
+ if (set.has(i)) set.delete(i);
322
+ else set.add(i);
323
+ }
324
+ editList.value = Array.from(set);
325
+ }
326
+
327
+ function editSelectAll(): void {
328
+ const allIds = medias.value.map((m) => m.id);
329
+ const allSelected = allIds.every((id) => editListSet.value.has(id));
330
+ if (allSelected) {
331
+ editList.value = editList.value.filter((id) => !allIds.includes(id));
332
+ } else {
333
+ const set = new Set([...editList.value, ...allIds]);
334
+ editList.value = Array.from(set);
335
+ }
336
+ }
337
+
338
+ async function deleteSelected(): Promise<void> {
339
+ const count = editList.value.length;
340
+ if (count === 0) return;
341
+ const t = useMapoT();
342
+ const confirmed = await useConfirmStore().ask({
343
+ title: t("mapo.mediaGallery.deleteTitle"),
344
+ message: t("mapo.mediaGallery.deleteSelected", { number: count }),
345
+ confirmText: t("mapo.delete"),
346
+ dangerous: true,
347
+ });
348
+ if (!confirmed) return;
349
+ await Promise.all(editList.value.map((id) => mediaCrud().delete(id)));
350
+ editList.value = [];
351
+ useSnackStore().show(
352
+ t("mapo.mediaGallery.deleteSuccess", { number: count }),
353
+ "success",
354
+ );
355
+ await getRoot();
356
+ }
357
+
358
+ async function uploadMedia(
359
+ payload: MediaUploadPayload,
360
+ onProgress?: (percent: number) => void,
361
+ ): Promise<MediaItem> {
362
+ // Build the body through the same multipart pipeline every other write uses
363
+ // (`data` JSON envelope + files at their dot-path). Hand-rolling a flat
364
+ // FormData here made uploads the only write that spoke a different wire
365
+ // format, which backends parsing the envelope reject.
366
+ const body: Record<string, unknown> = { file: payload.file };
367
+ if (payload.title) body.title = payload.title;
368
+ if (payload.alt_text) body.alt_text = payload.alt_text;
369
+ if (payload.description) body.description = payload.description;
370
+ if (payload.folder != null) body.folder = payload.folder;
371
+ const formData = applyMultipartPolicy(body, "force") as FormData;
372
+
373
+ // ofetch has no upload-progress hook, so uploads go through XHR.
374
+ // Same-origin request: the session cookie is attached automatically, and
375
+ // `uploadUrl()` keeps the target identical to the one `useCrud` would hit.
376
+ return await new Promise<MediaItem>((resolve, reject) => {
377
+ const xhr = new XMLHttpRequest();
378
+ xhr.open("POST", uploadUrl());
379
+ xhr.responseType = "json";
380
+ if (onProgress) {
381
+ xhr.upload.addEventListener("progress", (event) => {
382
+ if (event.lengthComputable)
383
+ onProgress(Math.round((event.loaded / event.total) * 100));
384
+ });
385
+ }
386
+ xhr.addEventListener("load", () => {
387
+ if (xhr.status >= 200 && xhr.status < 300) {
388
+ resolve(xhr.response as MediaItem);
389
+ } else {
390
+ const detail = (xhr.response as { detail?: string } | null)?.detail;
391
+ reject(
392
+ new Error(
393
+ detail ||
394
+ `${useMapoT()("mapo.mediaUploader.uploadFailed")} (${xhr.status})`,
395
+ ),
396
+ );
397
+ }
398
+ });
399
+ xhr.addEventListener("error", () =>
400
+ reject(new Error(useMapoT()("mapo.mediaUploader.uploadFailed"))),
401
+ );
402
+ xhr.send(formData);
403
+ });
404
+ }
405
+
406
+ function setMimeType(mime: string | null): void {
407
+ // A locked picker can narrow the filter but never widen it past the lock.
408
+ mimeType.value = mime ?? lockedMime.value;
409
+ }
410
+
411
+ function lockMimeType(mime: string | null): void {
412
+ lockedMime.value = mime;
413
+ if (mime) mimeType.value = mime;
414
+ }
415
+
416
+ function reset(): void {
417
+ medias.value = [];
418
+ folders.value = [];
419
+ parentFolders.value = [];
420
+ page.value = 1;
421
+ pages.value = 1;
422
+ mimeType.value = null;
423
+ lockedMime.value = null;
424
+ loading.value = false;
425
+ editMedia.value = null;
426
+ selection.value = null;
427
+ editList.value = [];
428
+ selectMode.value = "none";
429
+ _currentFolderId.value = null;
430
+ _currentSearch.value = "";
431
+ _currentAll.value = false;
432
+ }
433
+
434
+ return {
435
+ // state
436
+ medias,
437
+ folders,
438
+ parentFolders,
439
+ page,
440
+ pages,
441
+ mimeType,
442
+ lockedMime,
443
+ loading,
444
+ editMedia,
445
+ selection,
446
+ editList,
447
+ selectMode,
448
+ // getters
449
+ parentFolder,
450
+ editListSet,
451
+ editListState,
452
+ // actions
453
+ getRoot,
454
+ navigateToFolder,
455
+ openEditor,
456
+ closeEditor,
457
+ setLang,
458
+ updateMedia,
459
+ replaceFile,
460
+ updateOrCreateFolder,
461
+ deleteFolder,
462
+ deleteMedia,
463
+ select,
464
+ setSelectionMode,
465
+ setSelection,
466
+ editSelect,
467
+ editSelectAll,
468
+ deleteSelected,
469
+ uploadMedia,
470
+ setMimeType,
471
+ lockMimeType,
472
+ reset,
473
+ };
474
+ });
@@ -0,0 +1,64 @@
1
+ /** Defines a single column in the list table. */
2
+ export interface ListColumn<T = Record<string, unknown>> {
3
+ /** Property name on the row object. Must be a key of `T`. */
4
+ key: keyof T & string;
5
+ label: string;
6
+ sortable?: boolean;
7
+ /** CSS class applied to the `<td>` cell. */
8
+ class?: string;
9
+ }
10
+
11
+ /** A single selectable option inside a filter dropdown. */
12
+ export interface FilterChoice {
13
+ text: string;
14
+ value: unknown;
15
+ icon?: string;
16
+ }
17
+
18
+ /** Describes a filter control rendered in the list filter bar. */
19
+ export interface FilterDescriptor {
20
+ /** Query parameter name sent to the backend (e.g. `"status"`, `"date_range"`). */
21
+ value: string;
22
+ /** Label displayed in the filter dropdown. */
23
+ text: string;
24
+ choices?: FilterChoice[];
25
+ datepicker?: boolean;
26
+ /** When `true`, multiple choices can be selected simultaneously (default: `false` → exclusive). */
27
+ multiple?: boolean;
28
+ /** Default value applied on mount (same format as `choice.value`; comma-separated for multi). */
29
+ defaultChoice?: string;
30
+ }
31
+
32
+ /** A filter descriptor with its current active selection state. */
33
+ export interface ActiveFilter extends FilterDescriptor {
34
+ active: FilterChoice[];
35
+ dates?: string[];
36
+ }
37
+
38
+ /** Context passed to a bulk action handler. */
39
+ export interface ActionContext<T = Record<string, unknown>> {
40
+ /** Selected row objects, or `null` when the "select all" mode is active. */
41
+ selection: T[] | null;
42
+ selectionQuery: URLSearchParams;
43
+ lookup: string;
44
+ }
45
+
46
+ /** Describes a bulk action available in the list actions toolbar. */
47
+ export interface ActionDescriptor<T = Record<string, unknown>> {
48
+ label: string;
49
+ handler: (ctx: ActionContext<T>) => Promise<unknown>;
50
+ permissions?: string | string[];
51
+ /** Action is available when individual rows are selected. Default: `true`. */
52
+ handleMultiple?: boolean;
53
+ /** Action is available when the "select all" mode is active. Default: `false`. */
54
+ handleAll?: boolean;
55
+ /** When true, Apply and confirm buttons are rendered with a destructive/error color. */
56
+ dangerous?: boolean;
57
+ }
58
+
59
+ /** A single tab item used in the list tab bar to filter by a fixed value. */
60
+ export interface ListTabItem {
61
+ text: string;
62
+ value: string;
63
+ count?: number;
64
+ }
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Media **value** types are owned by `@mapomodule/form` (they are the value that
3
+ * lands in the form model, next to their descriptors) and re-exported here so the
4
+ * Media Manager keeps a single import surface. `uikit` already depends on `form`,
5
+ * so this direction introduces no cycle.
6
+ */
7
+ export type {
8
+ MediaLink,
9
+ MediaItem,
10
+ EnhancedMediaValue,
11
+ } from "@mapomodule/form/types";
12
+
13
+ import type { MediaItem } from "@mapomodule/form/types";
14
+
15
+ export interface MediaFolder {
16
+ id: number;
17
+ name: string;
18
+ parent?: number | null;
19
+ /**
20
+ * Materialized path of the folder (e.g. "root/images/hero").
21
+ * Camomilla returns it and the breadcrumb uses it for deduplication.
22
+ * Falls back to `id` when absent.
23
+ */
24
+ path?: string;
25
+ }
26
+
27
+ export interface MediaApiResponse {
28
+ media: {
29
+ items: MediaItem[];
30
+ paginator: { page: number; pages: number };
31
+ };
32
+ folders: MediaFolder[];
33
+ parent_folder: MediaFolder | null;
34
+ }
35
+
36
+ export type SelectMode = "none" | "single" | "multi";
37
+
38
+ export interface MediaGetRootParams {
39
+ page?: number;
40
+ folder?: number | null;
41
+ search?: string;
42
+ mime?: string | null;
43
+ all?: boolean;
44
+ }
45
+
46
+ export interface MediaUploadPayload {
47
+ file: File;
48
+ title?: string;
49
+ alt_text?: string;
50
+ description?: string;
51
+ folder?: number | null;
52
+ }
53
+
54
+ /**
55
+ * REST endpoints used by the media store. Configured via
56
+ * `mapo.uikit.media.endpoints` in `nuxt.config.ts` and forwarded to
57
+ * `runtimeConfig.public.mapoMedia`.
58
+ */
59
+ export interface MediaEndpoints {
60
+ /** Single-media CRUD: detail, partialUpdate, delete, upload (POST). Default `/api/media`. */
61
+ media: string;
62
+ /** Folder navigation + CRUD: list (root), detail (enter folder), create, delete. Default `/api/media-folders`. */
63
+ folders: string;
64
+ }
65
+
66
+ /**
67
+ * Context passed to the adapter when building list/detail query params.
68
+ * Values are the **canonical** Mapo params — the adapter maps them to the
69
+ * shape the target backend expects (e.g. `mime` → `fltr=mime_type=`).
70
+ */
71
+ export interface MediaListParamsContext {
72
+ page?: number;
73
+ search?: string;
74
+ mime?: string | null;
75
+ all?: boolean;
76
+ }
77
+
78
+ /**
79
+ * Backend adapter for the media store. Lets integrations (e.g. Camomilla)
80
+ * remap request params and normalize responses without coupling the store to a
81
+ * specific backend. Injected as `$mapoMediaAdapter` by a Nuxt plugin — functions
82
+ * are not serializable through `runtimeConfig`, so this mirrors the
83
+ * `$mapoFormRegistry` pattern.
84
+ *
85
+ * Every method is optional; the default adapter applies plain REST semantics.
86
+ */
87
+ export interface MediaAdapter {
88
+ /**
89
+ * Build the query params object for the `getRoot` list/detail request.
90
+ * @example
91
+ * // Camomilla: { page, search, fltr: 'mime_type=image/png' }
92
+ */
93
+ buildListParams?(ctx: MediaListParamsContext): Record<string, unknown>;
94
+ /**
95
+ * Normalize a raw `getRoot` response (folder list or detail) into the
96
+ * canonical {@link MediaApiResponse} shape. Default = identity.
97
+ */
98
+ parseRootResponse?(raw: unknown): MediaApiResponse;
99
+ /**
100
+ * Build query params for the single-media detail fetch (`openEditor`).
101
+ * @example
102
+ * // Camomilla: { language_code: 'it' }
103
+ */
104
+ buildDetailParams?(ctx: { lang?: string }): Record<string, unknown>;
105
+ /**
106
+ * Map a canonical folder (`{ name, parent }`) to the backend's create/update
107
+ * payload.
108
+ * @example
109
+ * // Camomilla: { title, slug: slugify(title), updir: parent }
110
+ */
111
+ buildFolderPayload?(folder: Partial<MediaFolder>): Record<string, unknown>;
112
+ /**
113
+ * Build the PATCH payload for a media metadata update.
114
+ * Default: `{ title, alt_text, description, translations }`.
115
+ */
116
+ buildMediaPatchPayload?(media: MediaItem): Record<string, unknown>;
117
+ /**
118
+ * Build the multipart PATCH payload for a file replacement.
119
+ * @example
120
+ * // Default REST: { file, maintain_url } — Camomilla: { file, same_url }
121
+ */
122
+ buildReplaceFilePayload?(
123
+ file: File,
124
+ maintainUrl: boolean,
125
+ ): Record<string, unknown>;
126
+ }