@mapomodule/uikit 2.0.0-beta.2 → 2.0.0-beta.20

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 (258) hide show
  1. package/README.md +46 -142
  2. package/dist/__tests__/MapoConfirmDialog.component.test.d.ts +2 -0
  3. package/dist/__tests__/MapoConfirmDialog.component.test.d.ts.map +1 -0
  4. package/dist/__tests__/MapoDetail.component.test.d.ts +2 -0
  5. package/dist/__tests__/MapoDetail.component.test.d.ts.map +1 -0
  6. package/dist/__tests__/MapoDetailLangSwitch.component.test.d.ts +2 -0
  7. package/dist/__tests__/MapoDetailLangSwitch.component.test.d.ts.map +1 -0
  8. package/dist/__tests__/MapoList.component.test.d.ts +2 -0
  9. package/dist/__tests__/MapoList.component.test.d.ts.map +1 -0
  10. package/dist/__tests__/MapoListActions.component.test.d.ts +2 -0
  11. package/dist/__tests__/MapoListActions.component.test.d.ts.map +1 -0
  12. package/dist/__tests__/MapoListTable.component.test.d.ts +2 -0
  13. package/dist/__tests__/MapoListTable.component.test.d.ts.map +1 -0
  14. package/dist/__tests__/MapoMediaEditor.component.test.d.ts +2 -0
  15. package/dist/__tests__/MapoMediaEditor.component.test.d.ts.map +1 -0
  16. package/dist/__tests__/MapoMediaFolderPicker.component.test.d.ts +2 -0
  17. package/dist/__tests__/MapoMediaFolderPicker.component.test.d.ts.map +1 -0
  18. package/dist/__tests__/MapoMediaFolders.component.test.d.ts +2 -0
  19. package/dist/__tests__/MapoMediaFolders.component.test.d.ts.map +1 -0
  20. package/dist/__tests__/MapoMediaGallery.component.test.d.ts +2 -0
  21. package/dist/__tests__/MapoMediaGallery.component.test.d.ts.map +1 -0
  22. package/dist/__tests__/MapoMediaUploadHandover.component.test.d.ts +2 -0
  23. package/dist/__tests__/MapoMediaUploadHandover.component.test.d.ts.map +1 -0
  24. package/dist/__tests__/MapoMenuManager.component.test.d.ts +2 -0
  25. package/dist/__tests__/MapoMenuManager.component.test.d.ts.map +1 -0
  26. package/dist/__tests__/MapoSnackBar.component.test.d.ts +2 -0
  27. package/dist/__tests__/MapoSnackBar.component.test.d.ts.map +1 -0
  28. package/dist/__tests__/__mocks__/nuxt-app.d.ts +9 -0
  29. package/dist/__tests__/__mocks__/nuxt-app.d.ts.map +1 -0
  30. package/dist/__tests__/langInfo.test.d.ts +2 -0
  31. package/dist/__tests__/langInfo.test.d.ts.map +1 -0
  32. package/dist/__tests__/listTable.test.d.ts +2 -0
  33. package/dist/__tests__/listTable.test.d.ts.map +1 -0
  34. package/dist/__tests__/mediaDrag.test.d.ts +2 -0
  35. package/dist/__tests__/mediaDrag.test.d.ts.map +1 -0
  36. package/dist/__tests__/mediaFolders.test.d.ts +2 -0
  37. package/dist/__tests__/mediaFolders.test.d.ts.map +1 -0
  38. package/dist/__tests__/mediaLanguages.test.d.ts +2 -0
  39. package/dist/__tests__/mediaLanguages.test.d.ts.map +1 -0
  40. package/dist/__tests__/mediaMetadata.test.d.ts +2 -0
  41. package/dist/__tests__/mediaMetadata.test.d.ts.map +1 -0
  42. package/dist/__tests__/mediaStore.test.d.ts +2 -0
  43. package/dist/__tests__/mediaStore.test.d.ts.map +1 -0
  44. package/dist/__tests__/mediaUrl.test.d.ts +2 -0
  45. package/dist/__tests__/mediaUrl.test.d.ts.map +1 -0
  46. package/dist/index.d.mts +3 -0
  47. package/dist/index.d.ts +4 -0
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.mjs +1 -1
  50. package/dist/module.d.mts +48 -1
  51. package/dist/module.d.ts +44 -0
  52. package/dist/module.d.ts.map +1 -1
  53. package/dist/module.json +1 -1
  54. package/dist/module.mjs +71 -2
  55. package/dist/runtime/adapters/defaultMediaAdapter.d.ts +15 -0
  56. package/dist/runtime/adapters/defaultMediaAdapter.d.ts.map +1 -0
  57. package/dist/runtime/adapters/defaultMediaAdapter.js +35 -0
  58. package/dist/runtime/assets/main.css +1 -1
  59. package/dist/runtime/components/MapoConfirmDialog.vue +23 -4
  60. package/dist/runtime/components/MapoConfirmDialog.vue.d.ts.map +1 -1
  61. package/dist/runtime/components/MapoDetail.vue +127 -55
  62. package/dist/runtime/components/MapoDetail.vue.d.ts +102 -5
  63. package/dist/runtime/components/MapoDetail.vue.d.ts.map +1 -1
  64. package/dist/runtime/components/MapoDetailLangSwitch.vue +22 -26
  65. package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts +4 -3
  66. package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts.map +1 -1
  67. package/dist/runtime/components/MapoDropArea.vue +110 -0
  68. package/dist/runtime/components/MapoDropArea.vue.d.ts +33 -0
  69. package/dist/runtime/components/MapoDropArea.vue.d.ts.map +1 -0
  70. package/dist/runtime/components/MapoLangSwitcher.vue +39 -0
  71. package/dist/runtime/components/MapoLangSwitcher.vue.d.ts +18 -0
  72. package/dist/runtime/components/MapoLangSwitcher.vue.d.ts.map +1 -0
  73. package/dist/runtime/components/MapoList.vue +45 -31
  74. package/dist/runtime/components/MapoList.vue.d.ts +18 -5
  75. package/dist/runtime/components/MapoList.vue.d.ts.map +1 -1
  76. package/dist/runtime/components/MapoListActions.vue +27 -13
  77. package/dist/runtime/components/MapoListActions.vue.d.ts +4 -0
  78. package/dist/runtime/components/MapoListActions.vue.d.ts.map +1 -1
  79. package/dist/runtime/components/MapoListFilters.vue +4 -2
  80. package/dist/runtime/components/MapoListFilters.vue.d.ts.map +1 -1
  81. package/dist/runtime/components/MapoListQuickEdit.vue +20 -10
  82. package/dist/runtime/components/MapoListQuickEdit.vue.d.ts.map +1 -1
  83. package/dist/runtime/components/MapoListTable.vue +125 -49
  84. package/dist/runtime/components/MapoListTable.vue.d.ts +13 -5
  85. package/dist/runtime/components/MapoListTable.vue.d.ts.map +1 -1
  86. package/dist/runtime/components/MapoLogin.vue +13 -10
  87. package/dist/runtime/components/MapoLogin.vue.d.ts.map +1 -1
  88. package/dist/runtime/components/MapoLogoutButton.vue +4 -2
  89. package/dist/runtime/components/MapoLogoutButton.vue.d.ts.map +1 -1
  90. package/dist/runtime/components/MapoMediaBreadcrumbs.vue +47 -0
  91. package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts +4 -0
  92. package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts.map +1 -0
  93. package/dist/runtime/components/MapoMediaEditor.vue +382 -0
  94. package/dist/runtime/components/MapoMediaEditor.vue.d.ts +13 -0
  95. package/dist/runtime/components/MapoMediaEditor.vue.d.ts.map +1 -0
  96. package/dist/runtime/components/MapoMediaFileChanger.vue +112 -0
  97. package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts +15 -0
  98. package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts.map +1 -0
  99. package/dist/runtime/components/MapoMediaFolderPicker.vue +129 -0
  100. package/dist/runtime/components/MapoMediaFolderPicker.vue.d.ts +33 -0
  101. package/dist/runtime/components/MapoMediaFolderPicker.vue.d.ts.map +1 -0
  102. package/dist/runtime/components/MapoMediaFolders.vue +402 -0
  103. package/dist/runtime/components/MapoMediaFolders.vue.d.ts +4 -0
  104. package/dist/runtime/components/MapoMediaFolders.vue.d.ts.map +1 -0
  105. package/dist/runtime/components/MapoMediaGallery.vue +304 -0
  106. package/dist/runtime/components/MapoMediaGallery.vue.d.ts +8 -0
  107. package/dist/runtime/components/MapoMediaGallery.vue.d.ts.map +1 -0
  108. package/dist/runtime/components/MapoMediaManager.vue +144 -0
  109. package/dist/runtime/components/MapoMediaManager.vue.d.ts +44 -0
  110. package/dist/runtime/components/MapoMediaManager.vue.d.ts.map +1 -0
  111. package/dist/runtime/components/MapoMediaManagerDialog.vue +116 -0
  112. package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts +41 -0
  113. package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts.map +1 -0
  114. package/dist/runtime/components/MapoMediaPreview.vue +94 -0
  115. package/dist/runtime/components/MapoMediaPreview.vue.d.ts +19 -0
  116. package/dist/runtime/components/MapoMediaPreview.vue.d.ts.map +1 -0
  117. package/dist/runtime/components/MapoMediaUploader.vue +294 -0
  118. package/dist/runtime/components/MapoMediaUploader.vue.d.ts +8 -0
  119. package/dist/runtime/components/MapoMediaUploader.vue.d.ts.map +1 -0
  120. package/dist/runtime/components/MapoMenuManager.vue +301 -0
  121. package/dist/runtime/components/MapoMenuManager.vue.d.ts +92 -0
  122. package/dist/runtime/components/MapoMenuManager.vue.d.ts.map +1 -0
  123. package/dist/runtime/components/MapoMenuNodeEditor.vue +201 -0
  124. package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts +61 -0
  125. package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts.map +1 -0
  126. package/dist/runtime/components/MapoMenuTreeview.vue +181 -0
  127. package/dist/runtime/components/MapoMenuTreeview.vue.d.ts +57 -0
  128. package/dist/runtime/components/MapoMenuTreeview.vue.d.ts.map +1 -0
  129. package/dist/runtime/components/MapoMenuTreeviewNode.vue +175 -0
  130. package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts +27 -0
  131. package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts.map +1 -0
  132. package/dist/runtime/components/MapoSidebar.vue +3 -1
  133. package/dist/runtime/components/MapoSidebar.vue.d.ts.map +1 -1
  134. package/dist/runtime/components/MapoSidebarList.vue +1 -1
  135. package/dist/runtime/components/MapoSidebarProfile.vue +6 -2
  136. package/dist/runtime/components/MapoSidebarProfile.vue.d.ts.map +1 -1
  137. package/dist/runtime/components/MapoSnackBar.vue +11 -0
  138. package/dist/runtime/components/MapoSnackBar.vue.d.ts.map +1 -1
  139. package/dist/runtime/components/MapoThemeToggle.vue +5 -1
  140. package/dist/runtime/components/MapoThemeToggle.vue.d.ts.map +1 -1
  141. package/dist/runtime/components/menuDndContext.d.ts +19 -0
  142. package/dist/runtime/components/menuDndContext.d.ts.map +1 -0
  143. package/dist/runtime/components/menuDndContext.js +3 -0
  144. package/dist/runtime/page-meta.nuxt.d.ts +4 -0
  145. package/dist/runtime/pages/index.vue +4 -3
  146. package/dist/runtime/pages/index.vue.d.ts.map +1 -1
  147. package/dist/runtime/pages/login.vue +0 -4
  148. package/dist/runtime/pages/login.vue.d.ts.map +1 -1
  149. package/dist/runtime/plugins/media-adapter.d.ts +18 -0
  150. package/dist/runtime/plugins/media-adapter.d.ts.map +1 -0
  151. package/dist/runtime/plugins/media-adapter.js +8 -0
  152. package/dist/runtime/stores/media.d.ts +505 -0
  153. package/dist/runtime/stores/media.d.ts.map +1 -0
  154. package/dist/runtime/stores/media.js +545 -0
  155. package/dist/runtime/types/list.d.ts +10 -2
  156. package/dist/runtime/types/list.d.ts.map +1 -1
  157. package/dist/runtime/types/media.d.ts +131 -0
  158. package/dist/runtime/types/media.d.ts.map +1 -0
  159. package/dist/runtime/types/media.js +0 -0
  160. package/dist/runtime/types/menu.d.ts +66 -0
  161. package/dist/runtime/types/menu.d.ts.map +1 -0
  162. package/dist/runtime/types/menu.js +30 -0
  163. package/dist/runtime/utils/contentLanguages.d.ts +9 -0
  164. package/dist/runtime/utils/contentLanguages.d.ts.map +1 -0
  165. package/dist/runtime/utils/contentLanguages.js +8 -0
  166. package/dist/runtime/utils/langInfo.d.ts +43 -0
  167. package/dist/runtime/utils/langInfo.d.ts.map +1 -0
  168. package/dist/runtime/utils/langInfo.js +17 -0
  169. package/dist/runtime/utils/listTable.d.ts +29 -0
  170. package/dist/runtime/utils/listTable.d.ts.map +1 -0
  171. package/dist/runtime/utils/listTable.js +21 -0
  172. package/dist/runtime/utils/mediaDrag.d.ts +21 -0
  173. package/dist/runtime/utils/mediaDrag.d.ts.map +1 -0
  174. package/dist/runtime/utils/mediaDrag.js +11 -0
  175. package/dist/runtime/utils/mediaFolders.d.ts +65 -0
  176. package/dist/runtime/utils/mediaFolders.d.ts.map +1 -0
  177. package/dist/runtime/utils/mediaFolders.js +97 -0
  178. package/dist/runtime/utils/mediaMetadata.d.ts +39 -0
  179. package/dist/runtime/utils/mediaMetadata.d.ts.map +1 -0
  180. package/dist/runtime/utils/mediaMetadata.js +97 -0
  181. package/dist/runtime/utils/mediaUrl.d.ts +16 -0
  182. package/dist/runtime/utils/mediaUrl.d.ts.map +1 -0
  183. package/dist/runtime/utils/mediaUrl.js +12 -0
  184. package/dist/types.d.mts +1 -1
  185. package/package.json +15 -11
  186. package/src/__tests__/MapoConfirmDialog.component.test.ts +165 -0
  187. package/src/__tests__/MapoDetail.component.test.ts +393 -0
  188. package/src/__tests__/MapoDetailLangSwitch.component.test.ts +145 -0
  189. package/src/__tests__/MapoList.component.test.ts +166 -0
  190. package/src/__tests__/MapoListActions.component.test.ts +175 -0
  191. package/src/__tests__/MapoListTable.component.test.ts +545 -0
  192. package/src/__tests__/MapoMediaEditor.component.test.ts +447 -0
  193. package/src/__tests__/MapoMediaFolderPicker.component.test.ts +220 -0
  194. package/src/__tests__/MapoMediaFolders.component.test.ts +519 -0
  195. package/src/__tests__/MapoMediaGallery.component.test.ts +211 -0
  196. package/src/__tests__/MapoMediaUploadHandover.component.test.ts +241 -0
  197. package/src/__tests__/MapoMenuManager.component.test.ts +175 -0
  198. package/src/__tests__/MapoSnackBar.component.test.ts +79 -0
  199. package/src/__tests__/__mocks__/nuxt-app.ts +8 -0
  200. package/src/__tests__/langInfo.test.ts +85 -0
  201. package/src/__tests__/listTable.test.ts +82 -0
  202. package/src/__tests__/mediaDrag.test.ts +42 -0
  203. package/src/__tests__/mediaFolders.test.ts +204 -0
  204. package/src/__tests__/mediaLanguages.test.ts +66 -0
  205. package/src/__tests__/mediaMetadata.test.ts +169 -0
  206. package/src/__tests__/mediaStore.test.ts +569 -0
  207. package/src/__tests__/mediaUrl.test.ts +44 -0
  208. package/src/index.ts +21 -0
  209. package/src/module.ts +155 -0
  210. package/src/runtime/adapters/defaultMediaAdapter.ts +67 -0
  211. package/src/runtime/assets/main.css +9 -0
  212. package/src/runtime/components/MapoConfirmDialog.vue +33 -4
  213. package/src/runtime/components/MapoDetail.vue +229 -73
  214. package/src/runtime/components/MapoDetailLangSwitch.vue +27 -28
  215. package/src/runtime/components/MapoDropArea.vue +145 -0
  216. package/src/runtime/components/MapoLangSwitcher.vue +74 -0
  217. package/src/runtime/components/MapoList.vue +65 -34
  218. package/src/runtime/components/MapoListActions.vue +32 -14
  219. package/src/runtime/components/MapoListFilters.vue +5 -2
  220. package/src/runtime/components/MapoListQuickEdit.vue +22 -10
  221. package/src/runtime/components/MapoListTable.vue +159 -59
  222. package/src/runtime/components/MapoLogin.vue +13 -10
  223. package/src/runtime/components/MapoLogoutButton.vue +4 -2
  224. package/src/runtime/components/MapoMediaBreadcrumbs.vue +53 -0
  225. package/src/runtime/components/MapoMediaEditor.vue +447 -0
  226. package/src/runtime/components/MapoMediaFileChanger.vue +136 -0
  227. package/src/runtime/components/MapoMediaFolderPicker.vue +176 -0
  228. package/src/runtime/components/MapoMediaFolders.vue +478 -0
  229. package/src/runtime/components/MapoMediaGallery.vue +350 -0
  230. package/src/runtime/components/MapoMediaManager.vue +194 -0
  231. package/src/runtime/components/MapoMediaManagerDialog.vue +148 -0
  232. package/src/runtime/components/MapoMediaPreview.vue +116 -0
  233. package/src/runtime/components/MapoMediaUploader.vue +362 -0
  234. package/src/runtime/components/MapoMenuManager.vue +454 -0
  235. package/src/runtime/components/MapoMenuNodeEditor.vue +282 -0
  236. package/src/runtime/components/MapoMenuTreeview.vue +264 -0
  237. package/src/runtime/components/MapoMenuTreeviewNode.vue +234 -0
  238. package/src/runtime/components/MapoSidebar.vue +3 -1
  239. package/src/runtime/components/MapoSidebarList.vue +1 -1
  240. package/src/runtime/components/MapoSidebarProfile.vue +6 -2
  241. package/src/runtime/components/MapoSnackBar.vue +12 -0
  242. package/src/runtime/components/MapoThemeToggle.vue +5 -1
  243. package/src/runtime/components/menuDndContext.ts +22 -0
  244. package/src/runtime/page-meta.nuxt.d.ts +4 -0
  245. package/src/runtime/pages/index.vue +4 -3
  246. package/src/runtime/pages/login.vue +0 -4
  247. package/src/runtime/plugins/media-adapter.ts +33 -0
  248. package/src/runtime/stores/media.ts +820 -0
  249. package/src/runtime/types/list.ts +10 -2
  250. package/src/runtime/types/media.ts +144 -0
  251. package/src/runtime/types/menu.ts +105 -0
  252. package/src/runtime/utils/contentLanguages.ts +18 -0
  253. package/src/runtime/utils/langInfo.ts +63 -0
  254. package/src/runtime/utils/listTable.ts +54 -0
  255. package/src/runtime/utils/mediaDrag.ts +29 -0
  256. package/src/runtime/utils/mediaFolders.ts +182 -0
  257. package/src/runtime/utils/mediaMetadata.ts +165 -0
  258. package/src/runtime/utils/mediaUrl.ts +30 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/runtime/types/media.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,YAAY,EACV,SAAS,EACT,SAAS,EACT,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE;QACL,KAAK,EAAE,SAAS,EAAE,CAAC;QACnB,SAAS,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5C,CAAC;IACF,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,aAAa,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErD,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,6FAA6F;IAC7F,KAAK,EAAE,MAAM,CAAC;IACd,kHAAkH;IAClH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,eAAe,CAAC,CAAC,GAAG,EAAE,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvE;;;OAGG;IACH,iBAAiB,CAAC,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAAC;IACnD;;;;OAIG;IACH,iBAAiB,CAAC,CAAC,GAAG,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpE;;;;;OAKG;IACH,kBAAkB,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3E;;;;;;;;OAQG;IACH,sBAAsB,CAAC,CACrB,KAAK,EAAE,SAAS,EAChB,QAAQ,CAAC,EAAE,SAAS,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3B;;;;OAIG;IACH,qBAAqB,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzE;;;;OAIG;IACH,uBAAuB,CAAC,CACtB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,OAAO,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5B"}
File without changes
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Menu Manager types — the canonical tree contract matches the Camomilla
3
+ * `/api/camomilla/menus` payload (v1 parity): a menu is a keyed collection
4
+ * of recursively nested nodes, optionally translated per language.
5
+ */
6
+ /** Link carried by a menu node: relational (a CMS page) or static (raw URL). */
7
+ export interface MenuNodeLink {
8
+ /** `"RE"` = relational (page picked from the backend), `"ST"` = static URL. */
9
+ link_type?: "RE" | "ST";
10
+ /** Static URL used when `link_type === "ST"`. */
11
+ static?: string;
12
+ /** Content-type id used when `link_type === "RE"`. */
13
+ content_type?: number | string | null;
14
+ /** Routable node id of the linked page when `link_type === "RE"`. */
15
+ url_node?: number | string | null;
16
+ [key: string]: unknown;
17
+ }
18
+ /** A single node of the menu tree. */
19
+ export interface MenuTreeNode {
20
+ /**
21
+ * Node identity. Nodes created client-side get a random string id;
22
+ * the backend may replace it with a numeric one on save.
23
+ */
24
+ id: string | number;
25
+ title: string;
26
+ link: MenuNodeLink;
27
+ /**
28
+ * Free-form node metadata (e.g. `style`, `target_bank`).
29
+ * `target_bank` keeps the v1/Camomilla key for data compatibility.
30
+ */
31
+ meta: Record<string, unknown>;
32
+ /** Child nodes. */
33
+ nodes: MenuTreeNode[];
34
+ /** Per-field backend validation errors attached by the manager. */
35
+ errors?: Record<string, string[]>;
36
+ [key: string]: unknown;
37
+ }
38
+ /** Per-language node tree used when the menu is translatable. */
39
+ export interface MenuTranslation {
40
+ nodes: MenuTreeNode[];
41
+ [key: string]: unknown;
42
+ }
43
+ /** The full menu payload handled by `MapoMenuManager`. */
44
+ export interface MapoMenu {
45
+ id?: number | string;
46
+ /** Unique menu identifier (e.g. `"navbar"`, `"footer"`). */
47
+ key: string;
48
+ enabled?: boolean;
49
+ /** Node tree used when the menu is NOT translatable. */
50
+ nodes?: MenuTreeNode[];
51
+ /** Per-language node trees used when the menu IS translatable. */
52
+ translations?: Record<string, MenuTranslation>;
53
+ [key: string]: unknown;
54
+ }
55
+ /** Create an empty client-side node with a unique temporary id. */
56
+ export declare function createMenuNode(partial?: Partial<MenuTreeNode>): MenuTreeNode;
57
+ /** Maximum nesting depth of a menu node tree (a flat list = depth 1). */
58
+ export declare function menuTreeDepth(nodes: MenuTreeNode[]): number;
59
+ /** Depth-first search for a node id. Returns the node and its ancestor chain. */
60
+ export declare function findMenuNode(nodes: MenuTreeNode[], id: string | number, parents?: MenuTreeNode[]): {
61
+ node: MenuTreeNode;
62
+ parents: MenuTreeNode[];
63
+ } | null;
64
+ /** Remove a node (by id) anywhere in the tree. Returns `true` when removed. */
65
+ export declare function removeMenuNode(nodes: MenuTreeNode[], id: string | number): boolean;
66
+ //# sourceMappingURL=menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/runtime/types/menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,+EAA+E;IAC/E,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACtC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,sCAAsC;AACtC,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;IACnB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,mBAAmB;IACnB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,iEAAiE;AACjE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,0DAA0D;AAC1D,MAAM,WAAW,QAAQ;IACvB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wDAAwD;IACxD,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC/C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,mEAAmE;AACnE,wBAAgB,cAAc,CAC5B,OAAO,GAAE,OAAO,CAAC,YAAY,CAAM,GAClC,YAAY,CASd;AAED,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,MAAM,CAG3D;AAED,iFAAiF;AACjF,wBAAgB,YAAY,CAC1B,KAAK,EAAE,YAAY,EAAE,EACrB,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,OAAO,GAAE,YAAY,EAAO,GAC3B;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,YAAY,EAAE,CAAA;CAAE,GAAG,IAAI,CAOxD;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAC5B,KAAK,EAAE,YAAY,EAAE,EACrB,EAAE,EAAE,MAAM,GAAG,MAAM,GAClB,OAAO,CAOT"}
@@ -0,0 +1,30 @@
1
+ export function createMenuNode(partial = {}) {
2
+ return {
3
+ id: Math.random().toString(36).slice(2),
4
+ title: "",
5
+ link: {},
6
+ meta: {},
7
+ nodes: [],
8
+ ...partial
9
+ };
10
+ }
11
+ export function menuTreeDepth(nodes) {
12
+ if (!nodes.length) return 0;
13
+ return 1 + Math.max(...nodes.map((n) => menuTreeDepth(n.nodes ?? [])));
14
+ }
15
+ export function findMenuNode(nodes, id, parents = []) {
16
+ for (const node of nodes) {
17
+ if (String(node.id) === String(id)) return { node, parents };
18
+ const found = findMenuNode(node.nodes ?? [], id, [...parents, node]);
19
+ if (found) return found;
20
+ }
21
+ return null;
22
+ }
23
+ export function removeMenuNode(nodes, id) {
24
+ const index = nodes.findIndex((n) => String(n.id) === String(id));
25
+ if (index !== -1) {
26
+ nodes.splice(index, 1);
27
+ return true;
28
+ }
29
+ return nodes.some((n) => removeMenuNode(n.nodes ?? [], id));
30
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The app's `mapo.uikit.contentLanguages`: the content languages editors may
3
+ * switch between, in order. Empty when the app sets none, which restricts
4
+ * nothing. Narrow a list with `restrictLanguages` from `./langInfo`.
5
+ *
6
+ * Kept apart from `langInfo.ts`, whose helpers stay free of Nuxt imports.
7
+ */
8
+ export declare function useContentLanguages(): string[];
9
+ //# sourceMappingURL=contentLanguages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contentLanguages.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils/contentLanguages.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAQ9C"}
@@ -0,0 +1,8 @@
1
+ import { useRuntimeConfig } from "#app";
2
+ export function useContentLanguages() {
3
+ const runtimeConfig = useRuntimeConfig();
4
+ const uikit = runtimeConfig.public.mapoUikit ?? {};
5
+ const configured = uikit.contentLanguages;
6
+ if (!Array.isArray(configured)) return [];
7
+ return configured.filter((code) => typeof code === "string");
8
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * `lang_info`, as served by Camomilla on an endpoint's OPTIONS response.
3
+ *
4
+ * It describes the MODEL, not the site and not a record: a multilingual site can
5
+ * still expose models nobody registered for translation, and rendering a
6
+ * language switcher for those invites the user to type values the backend will
7
+ * drop on save.
8
+ *
9
+ * OPTIONS rather than the record payload because it is metadata, and because a
10
+ * "create new" form has no record to read it from.
11
+ */
12
+ export interface LangInfo {
13
+ /** Whether this model is registered for translation at all. */
14
+ translatable?: boolean;
15
+ /** Codes usable for THIS model. Empty when it is not translatable. */
16
+ languages?: string[];
17
+ /** What the site supports. Present for context; not model-specific. */
18
+ site_languages?: string[];
19
+ default?: string;
20
+ active?: string;
21
+ }
22
+ /**
23
+ * Language codes a model can be translated into, read from its OPTIONS metadata.
24
+ *
25
+ * Returns `[]` — meaning "render no language switcher" — when the model is not
26
+ * translatable and when `lang_info` is absent entirely. A backend that does not
27
+ * publish the field cannot be assumed multilingual.
28
+ */
29
+ export declare function languagesFromMetadata(metadata: unknown): string[];
30
+ /**
31
+ * `languages` narrowed to `allowed` (the app's `mapo.uikit.contentLanguages`),
32
+ * in `allowed`'s order, so its first language is the one editing starts on.
33
+ * An empty `allowed` restricts nothing. It never adds a language the list does
34
+ * not offer: the backend would drop whatever is typed for it.
35
+ */
36
+ export declare function restrictLanguages(languages: string[], allowed: string[]): string[];
37
+ /**
38
+ * The language to start from: `preferred` when the list offers it, else the
39
+ * first one. Returns `""` for an empty list, which callers read as "this
40
+ * model is not translated".
41
+ */
42
+ export declare function pickLanguage(languages: string[], preferred?: string): string;
43
+ //# sourceMappingURL=langInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"langInfo.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils/langInfo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,QAAQ;IACvB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,EAAE,CAQjE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,EAAE,MAAM,EAAE,GAChB,MAAM,EAAE,CAGV;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAI5E"}
@@ -0,0 +1,17 @@
1
+ export function languagesFromMetadata(metadata) {
2
+ const info = metadata?.lang_info;
3
+ if (!info || info.translatable === false) return [];
4
+ if (!Array.isArray(info.languages)) return [];
5
+ return info.languages.filter(
6
+ (code) => typeof code === "string"
7
+ );
8
+ }
9
+ export function restrictLanguages(languages, allowed) {
10
+ if (!allowed.length) return languages;
11
+ return allowed.filter((lang) => languages.includes(lang));
12
+ }
13
+ export function pickLanguage(languages, preferred) {
14
+ if (!preferred) return languages[0] ?? "";
15
+ const isOffered = languages.includes(preferred);
16
+ return isOffered ? preferred : languages[0] ?? "";
17
+ }
@@ -0,0 +1,29 @@
1
+ /** One sort key as `UTable` holds it: the column id and the direction. */
2
+ export interface TableSort {
3
+ id: string;
4
+ desc: boolean;
5
+ }
6
+ /**
7
+ * The page size that stands for "all rows". A plain number, so the paging
8
+ * arithmetic and the in-memory slicing keep working unchanged.
9
+ */
10
+ export declare const ALL_ROWS: number;
11
+ /** A `pageSizeOptions` entry as the table stores it: `"all"` → {@link ALL_ROWS}. */
12
+ export declare function toPageSize(option: number | "all"): number;
13
+ /** Reads `page_size` from the URL: `all`, or a positive number, else `fallback`. */
14
+ export declare function parsePageSize(value: unknown, fallback: number): number;
15
+ /** Writes a page size to the URL: {@link ALL_ROWS} as `all`. */
16
+ export declare function formatPageSize(size: number): string;
17
+ /**
18
+ * The sorting after a click on a sortable header. The column goes from
19
+ * unsorted to ascending, to descending, and back to unsorted, so the natural
20
+ * order (needed by drag reorder) is one click away. It replaces any other key.
21
+ */
22
+ export declare function nextSorting(sorting: TableSort[], columnId: string): TableSort[];
23
+ /**
24
+ * The `ordering` param for a sorting: comma-separated keys, `-` for descending.
25
+ * A dotted key becomes a Django lookup (`category.name` → `category__name`),
26
+ * the way DRF's OrderingFilter reaches a field of a related object.
27
+ */
28
+ export declare function orderingParam(sorting: TableSort[]): string;
29
+ //# sourceMappingURL=listTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listTable.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils/listTable.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,QAA0B,CAAC;AAEhD,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAEzD;AAED,oFAAoF;AACpF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAItE;AAED,gEAAgE;AAChE,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,SAAS,EAAE,EACpB,QAAQ,EAAE,MAAM,GACf,SAAS,EAAE,CAKb;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,MAAM,CAI1D"}
@@ -0,0 +1,21 @@
1
+ export const ALL_ROWS = Number.MAX_SAFE_INTEGER;
2
+ export function toPageSize(option) {
3
+ return option === "all" ? ALL_ROWS : option;
4
+ }
5
+ export function parsePageSize(value, fallback) {
6
+ if (value === "all") return ALL_ROWS;
7
+ const size = Number(value);
8
+ return Number.isFinite(size) && size > 0 ? size : fallback;
9
+ }
10
+ export function formatPageSize(size) {
11
+ return size === ALL_ROWS ? "all" : String(size);
12
+ }
13
+ export function nextSorting(sorting, columnId) {
14
+ const current = sorting.find((sort) => sort.id === columnId);
15
+ if (!current) return [{ id: columnId, desc: false }];
16
+ if (!current.desc) return [{ id: columnId, desc: true }];
17
+ return [];
18
+ }
19
+ export function orderingParam(sorting) {
20
+ return sorting.map((sort) => `${sort.desc ? "-" : ""}${sort.id.split(".").join("__")}`).join(",");
21
+ }
@@ -0,0 +1,21 @@
1
+ import type { MediaFolder } from "../types/media.js";
2
+ /**
3
+ * Data type of every drag started inside the media manager: a gallery card,
4
+ * the bulk selection, a folder of the tree. Drop zones for files from the
5
+ * computer ignore it, since Chrome reports an image dragged from the page as
6
+ * "Files" too.
7
+ */
8
+ export declare const MEDIA_DRAG_TYPE = "application/x-mapo-media-drag";
9
+ /** What is being dragged inside the media manager. */
10
+ export type MediaDrag = {
11
+ kind: "media";
12
+ ids: number[];
13
+ } | {
14
+ kind: "folder";
15
+ folder: MediaFolder;
16
+ };
17
+ /** Whether `event` drags something from inside the media manager. */
18
+ export declare function isMediaDrag(event: DragEvent): boolean;
19
+ /** Starts dragging `drag`: the data type that marks it, and a move. */
20
+ export declare function startMediaDrag(event: DragEvent, drag: MediaDrag): void;
21
+ //# sourceMappingURL=mediaDrag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaDrag.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils/mediaDrag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,eAAe,kCAAkC,CAAC;AAE/D,sDAAsD;AACtD,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC;AAE5C,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAGrD;AAED,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAMtE"}
@@ -0,0 +1,11 @@
1
+ export const MEDIA_DRAG_TYPE = "application/x-mapo-media-drag";
2
+ export function isMediaDrag(event) {
3
+ const types = Array.from(event.dataTransfer?.types ?? []);
4
+ return types.includes(MEDIA_DRAG_TYPE);
5
+ }
6
+ export function startMediaDrag(event, drag) {
7
+ const transfer = event.dataTransfer;
8
+ if (!transfer) return;
9
+ transfer.setData(MEDIA_DRAG_TYPE, JSON.stringify(drag));
10
+ transfer.effectAllowed = "move";
11
+ }
@@ -0,0 +1,65 @@
1
+ import type { TreeItem } from "@nuxt/ui";
2
+ import type { MediaFolder } from "../types/media.js";
3
+ /** Key of the media root in the folder tree and in the store's folder cache. */
4
+ export declare const ROOT_FOLDER_KEY = "root";
5
+ /**
6
+ * Key of a folder in the folder tree and in the store's `folderChildren`
7
+ * cache: its id, or `ROOT_FOLDER_KEY` for the root (`null`).
8
+ */
9
+ export declare function folderKey(id: number | null | undefined): string;
10
+ /**
11
+ * `folder` with its `parent` as an id, as the store and the folder tree read
12
+ * it. Camomilla serializes a folder's parent (`updir`) as the whole parent
13
+ * folder, and an adapter may hand that object on as `parent`; it is read by
14
+ * its `id` (none is the root).
15
+ */
16
+ export declare function canonicalFolder(folder: MediaFolder): MediaFolder;
17
+ /** A node of the folder tree: the root (`folder: null`), a folder, or the placeholder of a branch still loading. */
18
+ export interface FolderNode extends TreeItem {
19
+ key: string;
20
+ label: string;
21
+ folder: MediaFolder | null;
22
+ children?: FolderNode[];
23
+ /** Placeholder in a branch whose subfolders are not loaded yet. */
24
+ pending?: boolean;
25
+ }
26
+ /**
27
+ * The folder tree, from the store's `folderChildren` cache: the root, then the
28
+ * folders. A branch not loaded yet holds one placeholder child, so it shows as
29
+ * expandable; a loaded branch with no subfolders is a leaf. A folder met twice
30
+ * on the same path (a cycle in the backend's data) is not expanded again.
31
+ *
32
+ * `exclude` leaves out folders and everything under them, as a destination
33
+ * picker needs when a folder cannot go inside itself.
34
+ */
35
+ export declare function buildFolderTree(folderChildren: Record<string, MediaFolder[]>, labels: {
36
+ root: string;
37
+ loading: string;
38
+ }, options?: {
39
+ exclude?: ReadonlySet<number>;
40
+ }): FolderNode[];
41
+ /** The node with `key` in the tree, at any depth. */
42
+ export declare function findFolderNode(nodes: FolderNode[] | undefined, key: string): FolderNode | undefined;
43
+ /** Icon of a tree node: a spinner while loading, an open folder when it shows children. */
44
+ export declare function folderNodeIcon(node: FolderNode, isOpen: boolean): string;
45
+ /**
46
+ * The parent of `folder` as the tree shows it: the cached branch that lists
47
+ * it, else its `parent`, which a backend may leave out.
48
+ */
49
+ export declare function folderParentId(folderChildren: Record<string, MediaFolder[]>, folder: MediaFolder): number | null;
50
+ /**
51
+ * Whether `folder` can move into folder `targetId` (the root when `null`):
52
+ * not into itself or one of its subfolders, as far as the cache knows the
53
+ * tree, and not where it already is.
54
+ */
55
+ export declare function canMoveFolderTo(folderChildren: Record<string, MediaFolder[]>, folder: MediaFolder, targetId: number | null): boolean;
56
+ /**
57
+ * The path to folder `id` read from the `folderChildren` cache: its ancestors
58
+ * from the top level down, then the folder itself. `undefined` when the cache
59
+ * cannot place it, or one of its ancestors, or meets a cycle.
60
+ *
61
+ * Breadcrumbs need it once the tree lets the user jump to any folder: a
62
+ * folder opened from another branch is not a child of the one on screen.
63
+ */
64
+ export declare function folderPath(folderChildren: Record<string, MediaFolder[]>, id: number): MediaFolder[] | undefined;
65
+ //# sourceMappingURL=mediaFolders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaFolders.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils/mediaFolders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,gFAAgF;AAChF,eAAO,MAAM,eAAe,SAAS,CAAC;AAEtC;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAOhE;AAED,oHAAoH;AACpH,MAAM,WAAW,UAAW,SAAQ,QAAQ;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,EAC7C,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EACzC,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAAO,GAC9C,UAAU,EAAE,CAmCd;AAED,qDAAqD;AACrD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,UAAU,EAAE,GAAG,SAAS,EAC/B,GAAG,EAAE,MAAM,GACV,UAAU,GAAG,SAAS,CAOxB;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAIxE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,EAC7C,MAAM,EAAE,WAAW,GAClB,MAAM,GAAG,IAAI,CAQf;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,EAC7C,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,GACtB,OAAO,CAST;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,EAC7C,EAAE,EAAE,MAAM,GACT,WAAW,EAAE,GAAG,SAAS,CAwB3B"}
@@ -0,0 +1,97 @@
1
+ export const ROOT_FOLDER_KEY = "root";
2
+ export function folderKey(id) {
3
+ return id == null ? ROOT_FOLDER_KEY : String(id);
4
+ }
5
+ export function canonicalFolder(folder) {
6
+ const parent = folder.parent;
7
+ const isObject = typeof parent === "object";
8
+ const isNull = parent === null;
9
+ if (!isObject || isNull) return folder;
10
+ const parentId = parent.id ?? null;
11
+ return { ...folder, parent: parentId };
12
+ }
13
+ export function buildFolderTree(folderChildren, labels, options = {}) {
14
+ const excluded = options.exclude ?? /* @__PURE__ */ new Set();
15
+ const branch = (parentKey, seen) => {
16
+ const loaded = folderChildren[parentKey];
17
+ if (!loaded) {
18
+ const placeholder = {
19
+ key: `${parentKey}:pending`,
20
+ label: labels.loading,
21
+ folder: null,
22
+ pending: true
23
+ };
24
+ return [placeholder];
25
+ }
26
+ const shown = loaded.filter((folder) => !excluded.has(folder.id));
27
+ if (!shown.length) return void 0;
28
+ return shown.map((folder) => {
29
+ const key = folderKey(folder.id);
30
+ const isRepeated = seen.has(key);
31
+ const children = isRepeated ? void 0 : branch(key, new Set(seen).add(key));
32
+ return { key, label: folder.name, folder, children };
33
+ });
34
+ };
35
+ const root = {
36
+ key: ROOT_FOLDER_KEY,
37
+ label: labels.root,
38
+ folder: null,
39
+ children: branch(ROOT_FOLDER_KEY, /* @__PURE__ */ new Set([ROOT_FOLDER_KEY]))
40
+ };
41
+ return [root];
42
+ }
43
+ export function findFolderNode(nodes, key) {
44
+ for (const node of nodes ?? []) {
45
+ if (node.key === key) return node;
46
+ const inner = findFolderNode(node.children, key);
47
+ if (inner) return inner;
48
+ }
49
+ return void 0;
50
+ }
51
+ export function folderNodeIcon(node, isOpen) {
52
+ if (node.pending) return "i-lucide-loader-circle";
53
+ const showsChildren = isOpen && !!node.children?.length;
54
+ return showsChildren ? "i-lucide-folder-open" : "i-lucide-folder";
55
+ }
56
+ export function folderParentId(folderChildren, folder) {
57
+ const entries = Object.entries(folderChildren);
58
+ const branch = entries.find(
59
+ ([, children]) => children.some((child) => child.id === folder.id)
60
+ );
61
+ if (!branch) return folder.parent ?? null;
62
+ const isRoot = branch[0] === ROOT_FOLDER_KEY;
63
+ return isRoot ? null : Number(branch[0]);
64
+ }
65
+ export function canMoveFolderTo(folderChildren, folder, targetId) {
66
+ const isSelf = targetId === folder.id;
67
+ if (isSelf) return false;
68
+ const targetPath = targetId == null ? [] : folderPath(folderChildren, targetId) ?? [];
69
+ const isInside = targetPath.some((f) => f.id === folder.id);
70
+ if (isInside) return false;
71
+ const staysPut = folderParentId(folderChildren, folder) === targetId;
72
+ return !staysPut;
73
+ }
74
+ export function folderPath(folderChildren, id) {
75
+ const parentOf = /* @__PURE__ */ new Map();
76
+ const byId = /* @__PURE__ */ new Map();
77
+ for (const [key, children] of Object.entries(folderChildren)) {
78
+ const parentId = key === ROOT_FOLDER_KEY ? null : Number(key);
79
+ for (const child of children) {
80
+ parentOf.set(child.id, parentId);
81
+ byId.set(child.id, child);
82
+ }
83
+ }
84
+ const path = [];
85
+ const seen = /* @__PURE__ */ new Set();
86
+ let currentId = id;
87
+ while (currentId != null) {
88
+ const folder = byId.get(currentId);
89
+ const isKnown = folder !== void 0;
90
+ const isCycle = seen.has(currentId);
91
+ if (!isKnown || isCycle) return void 0;
92
+ path.unshift(folder);
93
+ seen.add(currentId);
94
+ currentId = parentOf.get(currentId) ?? null;
95
+ }
96
+ return path;
97
+ }
@@ -0,0 +1,39 @@
1
+ import type { MediaItem, MediaUploadPayload } from "../types/media.js";
2
+ /** The text metadata of a media: the fields the editor and the uploader fill. */
3
+ export declare const MEDIA_METADATA_FIELDS: readonly ["title", "alt_text", "description"];
4
+ export type MediaMetadataField = (typeof MEDIA_METADATA_FIELDS)[number];
5
+ /**
6
+ * The metadata of `media` that differs from `previous`, as a PATCH body: plain
7
+ * fields, and `translations` narrowed to the languages and fields that changed.
8
+ *
9
+ * A full body breaks translated media in two ways. A backend that translates
10
+ * media (Camomilla, through django-modeltranslation) maps a plain field and its
11
+ * active-language translation to the same column, so a body carrying both
12
+ * writes whichever the backend applies last, and Camomilla applies the
13
+ * translations, holding the values read when the editor opened. And every other
14
+ * language is rewritten with those values, over any change made since.
15
+ */
16
+ export declare function mediaMetadataPatch(media: MediaItem, previous: MediaItem): Record<string, unknown>;
17
+ /** The text metadata of a media, to carry edits over a fresh server copy. */
18
+ export declare function pickMetadata(media: MediaItem): Pick<MediaItem, MediaMetadataField | "translations">;
19
+ /**
20
+ * The body of an upload request, before the multipart encoding.
21
+ *
22
+ * With a `lang`, the text metadata goes into `translations[lang]`: a backend
23
+ * that translates media ignores plain translatable fields (Camomilla drops them
24
+ * on write), and the upload would lose its title and alt text. Without one it
25
+ * stays in plain fields. Empty values are left out.
26
+ */
27
+ export declare function buildUploadBody(payload: MediaUploadPayload, lang?: string): Record<string, unknown>;
28
+ /**
29
+ * Lines for an error toast, out of a DRF error body: `Label: message` for each
30
+ * field.
31
+ *
32
+ * Covers the shapes a media save fails with: plain fields (`title`),
33
+ * per-language columns (`title_it`, as Camomilla reports them) and nested
34
+ * translations (`translations.it.title`). `detail` and `non_field_errors` are
35
+ * about the whole request and show without a label; a field missing from
36
+ * `labels` shows its key.
37
+ */
38
+ export declare function describeMediaErrors(data: unknown, labels: Record<string, string>): string[];
39
+ //# sourceMappingURL=mediaMetadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaMetadata.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils/mediaMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvE,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,+CAIxB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAUxE;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,SAAS,GAClB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqBzB;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,GACf,IAAI,CAAC,SAAS,EAAE,kBAAkB,GAAG,cAAc,CAAC,CAOtD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,kBAAkB,EAC3B,IAAI,CAAC,EAAE,MAAM,GACZ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAczB;AA2BD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,MAAM,EAAE,CA+BV"}
@@ -0,0 +1,97 @@
1
+ export const MEDIA_METADATA_FIELDS = [
2
+ "title",
3
+ "alt_text",
4
+ "description"
5
+ ];
6
+ function sameValue(a, b) {
7
+ return (a ?? "") === (b ?? "");
8
+ }
9
+ export function mediaMetadataPatch(media, previous) {
10
+ const patch = {};
11
+ for (const field of MEDIA_METADATA_FIELDS) {
12
+ if (sameValue(media[field], previous[field])) continue;
13
+ patch[field] = media[field] ?? "";
14
+ }
15
+ const translations = {};
16
+ for (const [lang, values] of Object.entries(media.translations ?? {})) {
17
+ const before = previous.translations?.[lang] ?? {};
18
+ for (const field of MEDIA_METADATA_FIELDS) {
19
+ const value = values?.[field];
20
+ if (sameValue(value, before[field])) continue;
21
+ const changed = translations[lang] ??= {};
22
+ changed[field] = value ?? "";
23
+ }
24
+ }
25
+ const hasTranslations = Object.keys(translations).length > 0;
26
+ if (hasTranslations) patch.translations = translations;
27
+ return patch;
28
+ }
29
+ export function pickMetadata(media) {
30
+ return {
31
+ title: media.title,
32
+ alt_text: media.alt_text,
33
+ description: media.description,
34
+ translations: media.translations
35
+ };
36
+ }
37
+ export function buildUploadBody(payload, lang) {
38
+ const body = { file: payload.file };
39
+ const metadata = {};
40
+ for (const field of MEDIA_METADATA_FIELDS) {
41
+ const value = payload[field];
42
+ if (value) metadata[field] = value;
43
+ }
44
+ const hasMetadata = Object.keys(metadata).length > 0;
45
+ if (hasMetadata && lang) body.translations = { [lang]: metadata };
46
+ else Object.assign(body, metadata);
47
+ if (payload.folder != null) body.folder = payload.folder;
48
+ return body;
49
+ }
50
+ const GENERAL_ERROR_KEYS = /* @__PURE__ */ new Set(["detail", "non_field_errors"]);
51
+ function errorLabel(path, labels) {
52
+ const key = path.join(".");
53
+ if (GENERAL_ERROR_KEYS.has(key)) return "";
54
+ const [head, lang = "", field = ""] = path;
55
+ const isTranslation = head === "translations";
56
+ const hasLangAndField = path.length === 3;
57
+ if (isTranslation && hasLangAndField) {
58
+ return `${labels[field] ?? field} (${lang.toUpperCase()})`;
59
+ }
60
+ const ownLabel = labels[key];
61
+ if (ownLabel) return ownLabel;
62
+ for (const [name, label] of Object.entries(labels)) {
63
+ if (!key.startsWith(`${name}_`)) continue;
64
+ return `${label} (${key.slice(name.length + 1).toUpperCase()})`;
65
+ }
66
+ return key;
67
+ }
68
+ export function describeMediaErrors(data, labels) {
69
+ const lines = [];
70
+ const add = (path, messages) => {
71
+ if (!messages.length) return;
72
+ const label = errorLabel(path, labels);
73
+ const text = messages.join(", ");
74
+ lines.push(label ? `${label}: ${text}` : text);
75
+ };
76
+ const walk = (value, path) => {
77
+ const isMessage = typeof value === "string";
78
+ const isUnderAKey = path.length > 0;
79
+ if (isMessage) {
80
+ if (isUnderAKey) add(path, [value]);
81
+ return;
82
+ }
83
+ if (Array.isArray(value)) {
84
+ add(
85
+ path,
86
+ value.filter((item) => typeof item === "string")
87
+ );
88
+ return;
89
+ }
90
+ if (!value || typeof value !== "object") return;
91
+ for (const [key, nested] of Object.entries(value)) {
92
+ walk(nested, [...path, key]);
93
+ }
94
+ };
95
+ walk(data, []);
96
+ return lines;
97
+ }
@@ -0,0 +1,16 @@
1
+ import type { MediaItem } from "../types/media.js";
2
+ type VersionedMedia = Pick<MediaItem, "file"> & Partial<Pick<MediaItem, "modified" | "created">>;
3
+ /**
4
+ * The URL to load a media file from in the backoffice: `file`, with
5
+ * `v=<modified, else created>` appended, so a file replaced at the same URL
6
+ * ("Keep current URL") is fetched again instead of served from the browser
7
+ * cache. Camomilla's `created` changes on every save, a replacement included.
8
+ *
9
+ * The URL is left as it is when it already has a query string (a signed URL
10
+ * would stop matching its signature), when it is a `data:` or `blob:` URL, and
11
+ * when the media carries no date. Display only: the stored `file` never
12
+ * changes.
13
+ */
14
+ export declare function mediaFileUrl(media: VersionedMedia): string;
15
+ export {};
16
+ //# sourceMappingURL=mediaUrl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaUrl.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils/mediaUrl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,KAAK,cAAc,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GAC3C,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAa1D"}
@@ -0,0 +1,12 @@
1
+ export function mediaFileUrl(media) {
2
+ const url = media.file ?? "";
3
+ const version = media.modified || media.created;
4
+ if (!url || !version) return url;
5
+ const isInline = /^(data|blob):/i.test(url);
6
+ const hasQuery = url.includes("?");
7
+ if (isInline || hasQuery) return url;
8
+ const hashAt = url.indexOf("#");
9
+ const path = hashAt === -1 ? url : url.slice(0, hashAt);
10
+ const hash = hashAt === -1 ? "" : url.slice(hashAt);
11
+ return `${path}?v=${encodeURIComponent(version)}${hash}`;
12
+ }
package/dist/types.d.mts CHANGED
@@ -6,4 +6,4 @@ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<
6
6
 
7
7
  export { default } from './module.mjs'
8
8
 
9
- export { type MapoUikitOptions } from './module.mjs'
9
+ export { type MapoMediaOptions, type MapoUikitOptions } from './module.mjs'