@cwa/nuxt-edge 1.0.0-29138192.e49c1a0

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 (387) hide show
  1. package/README.md +38 -0
  2. package/README.template.md +32 -0
  3. package/dist/layer/error.vue +13 -0
  4. package/dist/layer/layouts/CwaRootLayout.vue +140 -0
  5. package/dist/layer/nuxt.config.spec.ts +10 -0
  6. package/dist/layer/nuxt.config.ts +3 -0
  7. package/dist/layer/pages/_cwa/composables/useDataList.ts +50 -0
  8. package/dist/layer/pages/_cwa/composables/useDataType.ts +30 -0
  9. package/dist/layer/pages/_cwa/composables/useDynamicPageLoader.ts +28 -0
  10. package/dist/layer/pages/_cwa/composables/useItemPage.ts +172 -0
  11. package/dist/layer/pages/_cwa/composables/useListPage.ts +43 -0
  12. package/dist/layer/pages/_cwa/data/[type]/[iri].vue +17 -0
  13. package/dist/layer/pages/_cwa/data/[type].vue +131 -0
  14. package/dist/layer/pages/_cwa/data/index.vue +84 -0
  15. package/dist/layer/pages/_cwa/layouts/[iri].vue +174 -0
  16. package/dist/layer/pages/_cwa/layouts.vue +77 -0
  17. package/dist/layer/pages/_cwa/pages/[iri].vue +11 -0
  18. package/dist/layer/pages/_cwa/pages.vue +129 -0
  19. package/dist/layer/pages/_cwa/routes.vue +72 -0
  20. package/dist/layer/pages/_cwa/users/[iri].vue +248 -0
  21. package/dist/layer/pages/_cwa/users.vue +86 -0
  22. package/dist/layer/pages/_cwa.vue +43 -0
  23. package/dist/layer/pages/forgot-password.vue +32 -0
  24. package/dist/layer/pages/login.vue +33 -0
  25. package/dist/layer/pages/reset-password/[username]/[token].vue +39 -0
  26. package/dist/module.d.mts +53 -0
  27. package/dist/module.json +13 -0
  28. package/dist/module.mjs +235 -0
  29. package/dist/runtime/admin/admin.d.ts +36 -0
  30. package/dist/runtime/admin/admin.js +65 -0
  31. package/dist/runtime/admin/manageable-resource.d.ts +41 -0
  32. package/dist/runtime/admin/manageable-resource.js +206 -0
  33. package/dist/runtime/admin/manager-tabs-resolver.d.ts +17 -0
  34. package/dist/runtime/admin/manager-tabs-resolver.js +51 -0
  35. package/dist/runtime/admin/navigation-guard.d.ts +18 -0
  36. package/dist/runtime/admin/navigation-guard.js +55 -0
  37. package/dist/runtime/admin/resource-stack-manager.d.ts +92 -0
  38. package/dist/runtime/admin/resource-stack-manager.js +355 -0
  39. package/dist/runtime/api/api-documentation.d.ts +28 -0
  40. package/dist/runtime/api/api-documentation.js +131 -0
  41. package/dist/runtime/api/auth.d.ts +85 -0
  42. package/dist/runtime/api/auth.js +183 -0
  43. package/dist/runtime/api/fetcher/cwa-fetch.d.ts +5 -0
  44. package/dist/runtime/api/fetcher/cwa-fetch.js +20 -0
  45. package/dist/runtime/api/fetcher/fetch-status-manager.d.ts +51 -0
  46. package/dist/runtime/api/fetcher/fetch-status-manager.js +185 -0
  47. package/dist/runtime/api/fetcher/fetcher.d.ts +57 -0
  48. package/dist/runtime/api/fetcher/fetcher.js +222 -0
  49. package/dist/runtime/api/fetcher/preload-headers.d.ts +6 -0
  50. package/dist/runtime/api/fetcher/preload-headers.js +31 -0
  51. package/dist/runtime/api/forms.d.ts +40 -0
  52. package/dist/runtime/api/forms.js +40 -0
  53. package/dist/runtime/api/mercure.d.ts +33 -0
  54. package/dist/runtime/api/mercure.js +191 -0
  55. package/dist/runtime/composables/component/html-content.d.ts +2 -0
  56. package/dist/runtime/composables/component/html-content.js +82 -0
  57. package/dist/runtime/composables/cwa-collection-pagination.d.ts +13 -0
  58. package/dist/runtime/composables/cwa-collection-pagination.js +34 -0
  59. package/dist/runtime/composables/cwa-collection-resource.d.ts +16 -0
  60. package/dist/runtime/composables/cwa-collection-resource.js +92 -0
  61. package/dist/runtime/composables/cwa-image.d.ts +19 -0
  62. package/dist/runtime/composables/cwa-image.js +43 -0
  63. package/dist/runtime/composables/cwa-query-bound-model.d.ts +9 -0
  64. package/dist/runtime/composables/cwa-query-bound-model.js +108 -0
  65. package/dist/runtime/composables/cwa-resource-endpoint.d.ts +5 -0
  66. package/dist/runtime/composables/cwa-resource-endpoint.js +36 -0
  67. package/dist/runtime/composables/cwa-resource-manageable.d.ts +10 -0
  68. package/dist/runtime/composables/cwa-resource-manageable.js +32 -0
  69. package/dist/runtime/composables/cwa-resource-manager-tab.d.ts +17 -0
  70. package/dist/runtime/composables/cwa-resource-manager-tab.js +30 -0
  71. package/dist/runtime/composables/cwa-resource-model.d.ts +21 -0
  72. package/dist/runtime/composables/cwa-resource-model.js +149 -0
  73. package/dist/runtime/composables/cwa-resource-upload.d.ts +8 -0
  74. package/dist/runtime/composables/cwa-resource-upload.js +70 -0
  75. package/dist/runtime/composables/cwa-resource.d.ts +24 -0
  76. package/dist/runtime/composables/cwa-resource.js +22 -0
  77. package/dist/runtime/composables/cwa-select-input.d.ts +21 -0
  78. package/dist/runtime/composables/cwa-select-input.js +37 -0
  79. package/dist/runtime/composables/cwa-select.d.ts +15 -0
  80. package/dist/runtime/composables/cwa-select.js +24 -0
  81. package/dist/runtime/composables/cwa.d.ts +2 -0
  82. package/dist/runtime/composables/cwa.js +2 -0
  83. package/dist/runtime/composables/forgot-password.d.ts +9 -0
  84. package/dist/runtime/composables/forgot-password.js +45 -0
  85. package/dist/runtime/composables/login.d.ts +9 -0
  86. package/dist/runtime/composables/login.js +30 -0
  87. package/dist/runtime/composables/popper.d.ts +529 -0
  88. package/dist/runtime/composables/popper.js +104 -0
  89. package/dist/runtime/composables/process.d.ts +4 -0
  90. package/dist/runtime/composables/process.js +6 -0
  91. package/dist/runtime/composables/reset-password.d.ts +14 -0
  92. package/dist/runtime/composables/reset-password.js +75 -0
  93. package/dist/runtime/composables/transitions.d.ts +12 -0
  94. package/dist/runtime/composables/transitions.js +12 -0
  95. package/dist/runtime/cwa.d.ts +61 -0
  96. package/dist/runtime/cwa.js +123 -0
  97. package/dist/runtime/errors/cwa-resource-error.d.ts +18 -0
  98. package/dist/runtime/errors/cwa-resource-error.js +54 -0
  99. package/dist/runtime/plugin.d.ts +7 -0
  100. package/dist/runtime/plugin.js +18 -0
  101. package/dist/runtime/resources/resource-utils.d.ts +44 -0
  102. package/dist/runtime/resources/resource-utils.js +73 -0
  103. package/dist/runtime/resources/resources-manager.d.ts +70 -0
  104. package/dist/runtime/resources/resources-manager.js +463 -0
  105. package/dist/runtime/resources/resources.d.ts +53 -0
  106. package/dist/runtime/resources/resources.js +300 -0
  107. package/dist/runtime/route-middleware.d.ts +2 -0
  108. package/dist/runtime/route-middleware.js +86 -0
  109. package/dist/runtime/storage/storage.d.ts +20 -0
  110. package/dist/runtime/storage/storage.js +25 -0
  111. package/dist/runtime/storage/stores/admin/actions.d.ts +5 -0
  112. package/dist/runtime/storage/stores/admin/actions.js +10 -0
  113. package/dist/runtime/storage/stores/admin/admin-store.d.ts +18 -0
  114. package/dist/runtime/storage/stores/admin/admin-store.js +20 -0
  115. package/dist/runtime/storage/stores/admin/state.d.ts +7 -0
  116. package/dist/runtime/storage/stores/admin/state.js +9 -0
  117. package/dist/runtime/storage/stores/api-documentation/api-documentation-store.d.ts +16 -0
  118. package/dist/runtime/storage/stores/api-documentation/api-documentation-store.js +18 -0
  119. package/dist/runtime/storage/stores/api-documentation/state.d.ts +74 -0
  120. package/dist/runtime/storage/stores/api-documentation/state.js +6 -0
  121. package/dist/runtime/storage/stores/auth/auth-store.d.ts +16 -0
  122. package/dist/runtime/storage/stores/auth/auth-store.js +18 -0
  123. package/dist/runtime/storage/stores/auth/state.d.ts +20 -0
  124. package/dist/runtime/storage/stores/auth/state.js +15 -0
  125. package/dist/runtime/storage/stores/cwa-store-types.d.ts +14 -0
  126. package/dist/runtime/storage/stores/error/actions.d.ts +11 -0
  127. package/dist/runtime/storage/stores/error/actions.js +69 -0
  128. package/dist/runtime/storage/stores/error/error-store.d.ts +13 -0
  129. package/dist/runtime/storage/stores/error/error-store.js +21 -0
  130. package/dist/runtime/storage/stores/error/getters.d.ts +7 -0
  131. package/dist/runtime/storage/stores/error/getters.js +11 -0
  132. package/dist/runtime/storage/stores/error/state.d.ts +35 -0
  133. package/dist/runtime/storage/stores/error/state.js +15 -0
  134. package/dist/runtime/storage/stores/fetcher/actions.d.ts +49 -0
  135. package/dist/runtime/storage/stores/fetcher/actions.js +125 -0
  136. package/dist/runtime/storage/stores/fetcher/fetcher-store.d.ts +19 -0
  137. package/dist/runtime/storage/stores/fetcher/fetcher-store.js +23 -0
  138. package/dist/runtime/storage/stores/fetcher/getter-utils.d.ts +7 -0
  139. package/dist/runtime/storage/stores/fetcher/getter-utils.js +27 -0
  140. package/dist/runtime/storage/stores/fetcher/getters.d.ts +13 -0
  141. package/dist/runtime/storage/stores/fetcher/getters.js +52 -0
  142. package/dist/runtime/storage/stores/fetcher/state.d.ts +25 -0
  143. package/dist/runtime/storage/stores/fetcher/state.js +7 -0
  144. package/dist/runtime/storage/stores/mercure/mercure-store.d.ts +16 -0
  145. package/dist/runtime/storage/stores/mercure/mercure-store.js +18 -0
  146. package/dist/runtime/storage/stores/mercure/state.d.ts +5 -0
  147. package/dist/runtime/storage/stores/mercure/state.js +6 -0
  148. package/dist/runtime/storage/stores/resources/actions.d.ts +54 -0
  149. package/dist/runtime/storage/stores/resources/actions.js +390 -0
  150. package/dist/runtime/storage/stores/resources/getter-utils.d.ts +7 -0
  151. package/dist/runtime/storage/stores/resources/getter-utils.js +27 -0
  152. package/dist/runtime/storage/stores/resources/getters.d.ts +38 -0
  153. package/dist/runtime/storage/stores/resources/getters.js +251 -0
  154. package/dist/runtime/storage/stores/resources/resources-store.d.ts +19 -0
  155. package/dist/runtime/storage/stores/resources/resources-store.js +23 -0
  156. package/dist/runtime/storage/stores/resources/state.d.ts +64 -0
  157. package/dist/runtime/storage/stores/resources/state.js +24 -0
  158. package/dist/runtime/templates/assets/base.css +1 -0
  159. package/dist/runtime/templates/assets/cwa.css +1 -0
  160. package/dist/runtime/templates/components/core/ComponentPlaceholder.vue +18 -0
  161. package/dist/runtime/templates/components/core/ComponentPlaceholder.vue.d.ts +3 -0
  162. package/dist/runtime/templates/components/core/ComponentPosition.spec.ts.snap +16 -0
  163. package/dist/runtime/templates/components/core/ComponentPosition.vue +63 -0
  164. package/dist/runtime/templates/components/core/ComponentPosition.vue.d.ts +3 -0
  165. package/dist/runtime/templates/components/core/ConfirmDialog.vue +41 -0
  166. package/dist/runtime/templates/components/core/ConfirmDialog.vue.d.ts +9 -0
  167. package/dist/runtime/templates/components/core/DialogBox.vue +95 -0
  168. package/dist/runtime/templates/components/core/DialogBox.vue.d.ts +38 -0
  169. package/dist/runtime/templates/components/core/README.md +1 -0
  170. package/dist/runtime/templates/components/core/ResourceLoader.spec.ts.snap +39 -0
  171. package/dist/runtime/templates/components/core/ResourceLoader.vue +151 -0
  172. package/dist/runtime/templates/components/core/ResourceLoader.vue.d.ts +13 -0
  173. package/dist/runtime/templates/components/core/admin/ListContainer.vue +7 -0
  174. package/dist/runtime/templates/components/core/admin/ListContainer.vue.d.ts +12 -0
  175. package/dist/runtime/templates/components/core/admin/ListContent.vue +136 -0
  176. package/dist/runtime/templates/components/core/admin/ListContent.vue.d.ts +21 -0
  177. package/dist/runtime/templates/components/core/admin/ListFilter.vue +49 -0
  178. package/dist/runtime/templates/components/core/admin/ListFilter.vue.d.ts +9 -0
  179. package/dist/runtime/templates/components/core/admin/ListFilterButton.vue +53 -0
  180. package/dist/runtime/templates/components/core/admin/ListFilterButton.vue.d.ts +9 -0
  181. package/dist/runtime/templates/components/core/admin/ListHeading.vue +32 -0
  182. package/dist/runtime/templates/components/core/admin/ListHeading.vue.d.ts +20 -0
  183. package/dist/runtime/templates/components/core/admin/ListPagination.vue +87 -0
  184. package/dist/runtime/templates/components/core/admin/ListPagination.vue.d.ts +15 -0
  185. package/dist/runtime/templates/components/core/admin/ListPaginationButton.vue +18 -0
  186. package/dist/runtime/templates/components/core/admin/ListPaginationButton.vue.d.ts +16 -0
  187. package/dist/runtime/templates/components/core/admin/PageAdminModal.vue +260 -0
  188. package/dist/runtime/templates/components/core/admin/PageAdminModal.vue.d.ts +12 -0
  189. package/dist/runtime/templates/components/core/admin/PageDataAdminModal.vue +187 -0
  190. package/dist/runtime/templates/components/core/admin/PageDataAdminModal.vue.d.ts +13 -0
  191. package/dist/runtime/templates/components/core/admin/ResourceModal.vue +99 -0
  192. package/dist/runtime/templates/components/core/admin/ResourceModal.vue.d.ts +27 -0
  193. package/dist/runtime/templates/components/core/admin/ResourceModalOverlay.vue +27 -0
  194. package/dist/runtime/templates/components/core/admin/ResourceModalOverlay.vue.d.ts +6 -0
  195. package/dist/runtime/templates/components/core/admin/ResourceModalOverlayTemplate.vue +23 -0
  196. package/dist/runtime/templates/components/core/admin/ResourceModalOverlayTemplate.vue.d.ts +15 -0
  197. package/dist/runtime/templates/components/core/admin/ResourceModalTabs.vue +77 -0
  198. package/dist/runtime/templates/components/core/admin/ResourceModalTabs.vue.d.ts +19 -0
  199. package/dist/runtime/templates/components/core/admin/RouteListRow.vue +102 -0
  200. package/dist/runtime/templates/components/core/admin/RouteListRow.vue.d.ts +20 -0
  201. package/dist/runtime/templates/components/core/admin/RouteRedirectsTree.vue +52 -0
  202. package/dist/runtime/templates/components/core/admin/RouteRedirectsTree.vue.d.ts +10 -0
  203. package/dist/runtime/templates/components/core/admin/RoutesTab.vue +273 -0
  204. package/dist/runtime/templates/components/core/admin/RoutesTab.vue.d.ts +12 -0
  205. package/dist/runtime/templates/components/core/admin/form/FilterFormWrapper.vue +18 -0
  206. package/dist/runtime/templates/components/core/admin/form/FilterFormWrapper.vue.d.ts +16 -0
  207. package/dist/runtime/templates/components/core/admin/form/FilterSelect.vue +86 -0
  208. package/dist/runtime/templates/components/core/admin/form/FilterSelect.vue.d.ts +3 -0
  209. package/dist/runtime/templates/components/core/admin/form/ModalInfo.vue +23 -0
  210. package/dist/runtime/templates/components/core/admin/form/ModalInfo.vue.d.ts +16 -0
  211. package/dist/runtime/templates/components/core/admin/form/ModalInput.vue +30 -0
  212. package/dist/runtime/templates/components/core/admin/form/ModalInput.vue.d.ts +15 -0
  213. package/dist/runtime/templates/components/core/admin/form/ModalSelect.vue +99 -0
  214. package/dist/runtime/templates/components/core/admin/form/ModalSelect.vue.d.ts +6 -0
  215. package/dist/runtime/templates/components/core/admin/form/PageTypeSelect.vue +112 -0
  216. package/dist/runtime/templates/components/core/admin/form/PageTypeSelect.vue.d.ts +4 -0
  217. package/dist/runtime/templates/components/core/assets/CwaLogo.vue +21 -0
  218. package/dist/runtime/templates/components/core/assets/CwaLogo.vue.d.ts +2 -0
  219. package/dist/runtime/templates/components/core/assets/IconComponents.vue +15 -0
  220. package/dist/runtime/templates/components/core/assets/IconComponents.vue.d.ts +2 -0
  221. package/dist/runtime/templates/components/core/assets/IconData.vue +24 -0
  222. package/dist/runtime/templates/components/core/assets/IconData.vue.d.ts +2 -0
  223. package/dist/runtime/templates/components/core/assets/IconLayouts.vue +20 -0
  224. package/dist/runtime/templates/components/core/assets/IconLayouts.vue.d.ts +2 -0
  225. package/dist/runtime/templates/components/core/assets/IconPages.vue +21 -0
  226. package/dist/runtime/templates/components/core/assets/IconPages.vue.d.ts +2 -0
  227. package/dist/runtime/templates/components/core/assets/IconRoutes.vue +23 -0
  228. package/dist/runtime/templates/components/core/assets/IconRoutes.vue.d.ts +2 -0
  229. package/dist/runtime/templates/components/core/assets/IconUsers.vue +13 -0
  230. package/dist/runtime/templates/components/core/assets/IconUsers.vue.d.ts +2 -0
  231. package/dist/runtime/templates/components/core/useDataResolver.d.ts +12 -0
  232. package/dist/runtime/templates/components/core/useDataResolver.js +109 -0
  233. package/dist/runtime/templates/components/main/ComponentGroup.Util.Positions.d.ts +6 -0
  234. package/dist/runtime/templates/components/main/ComponentGroup.Util.Positions.js +164 -0
  235. package/dist/runtime/templates/components/main/ComponentGroup.Util.Synchronizer.d.ts +20 -0
  236. package/dist/runtime/templates/components/main/ComponentGroup.Util.Synchronizer.js +69 -0
  237. package/dist/runtime/templates/components/main/ComponentGroup.spec.ts.snap +59 -0
  238. package/dist/runtime/templates/components/main/ComponentGroup.vue +107 -0
  239. package/dist/runtime/templates/components/main/ComponentGroup.vue.d.ts +9 -0
  240. package/dist/runtime/templates/components/main/CwaLink.vue +51 -0
  241. package/dist/runtime/templates/components/main/CwaLink.vue.d.ts +14 -0
  242. package/dist/runtime/templates/components/main/DefaultLayout.vue +8 -0
  243. package/dist/runtime/templates/components/main/DefaultLayout.vue.d.ts +12 -0
  244. package/dist/runtime/templates/components/main/ErrorPage.vue +98 -0
  245. package/dist/runtime/templates/components/main/ErrorPage.vue.d.ts +6 -0
  246. package/dist/runtime/templates/components/main/Logo.vue +18 -0
  247. package/dist/runtime/templates/components/main/Logo.vue.d.ts +2 -0
  248. package/dist/runtime/templates/components/main/README.md +7 -0
  249. package/dist/runtime/templates/components/main/admin/_common/ResourceContextItem.vue +41 -0
  250. package/dist/runtime/templates/components/main/admin/_common/ResourceContextItem.vue.d.ts +7 -0
  251. package/dist/runtime/templates/components/main/admin/_common/ResourceLoadingIndicator.vue +48 -0
  252. package/dist/runtime/templates/components/main/admin/_common/ResourceLoadingIndicator.vue.d.ts +2 -0
  253. package/dist/runtime/templates/components/main/admin/_common/useDynamicPositionSelectOptions.d.ts +5 -0
  254. package/dist/runtime/templates/components/main/admin/_common/useDynamicPositionSelectOptions.js +19 -0
  255. package/dist/runtime/templates/components/main/admin/header/Header.vue +207 -0
  256. package/dist/runtime/templates/components/main/admin/header/Header.vue.d.ts +2 -0
  257. package/dist/runtime/templates/components/main/admin/header/_parts/Menu.vue +189 -0
  258. package/dist/runtime/templates/components/main/admin/header/_parts/Menu.vue.d.ts +2 -0
  259. package/dist/runtime/templates/components/main/admin/header/_parts/MenuLink.vue +14 -0
  260. package/dist/runtime/templates/components/main/admin/header/_parts/MenuLink.vue.d.ts +16 -0
  261. package/dist/runtime/templates/components/main/admin/header/_parts/MenuPrimaryLink.vue +19 -0
  262. package/dist/runtime/templates/components/main/admin/header/_parts/MenuPrimaryLink.vue.d.ts +15 -0
  263. package/dist/runtime/templates/components/main/admin/header/_parts/Notification.vue +69 -0
  264. package/dist/runtime/templates/components/main/admin/header/_parts/Notification.vue.d.ts +12 -0
  265. package/dist/runtime/templates/components/main/admin/header/_parts/OutdatedContentNotice.vue +19 -0
  266. package/dist/runtime/templates/components/main/admin/header/_parts/OutdatedContentNotice.vue.d.ts +2 -0
  267. package/dist/runtime/templates/components/main/admin/header/_parts/PathSelector.vue +79 -0
  268. package/dist/runtime/templates/components/main/admin/header/_parts/PathSelector.vue.d.ts +2 -0
  269. package/dist/runtime/templates/components/main/admin/header/_parts/RequestErrors.vue +52 -0
  270. package/dist/runtime/templates/components/main/admin/header/_parts/RequestErrors.vue.d.ts +2 -0
  271. package/dist/runtime/templates/components/main/admin/resource-manager/ComponentFocus.vue +151 -0
  272. package/dist/runtime/templates/components/main/admin/resource-manager/ComponentFocus.vue.d.ts +10 -0
  273. package/dist/runtime/templates/components/main/admin/resource-manager/LayoutPageOverlay.vue +192 -0
  274. package/dist/runtime/templates/components/main/admin/resource-manager/LayoutPageOverlay.vue.d.ts +6 -0
  275. package/dist/runtime/templates/components/main/admin/resource-manager/ResourceManager.vue +186 -0
  276. package/dist/runtime/templates/components/main/admin/resource-manager/ResourceManager.vue.d.ts +9 -0
  277. package/dist/runtime/templates/components/main/admin/resource-manager/_parts/AddComponentDialog.vue +205 -0
  278. package/dist/runtime/templates/components/main/admin/resource-manager/_parts/AddComponentDialog.vue.d.ts +2 -0
  279. package/dist/runtime/templates/components/main/admin/resource-manager/_parts/CwaResourceManagerContextMenu.vue +38 -0
  280. package/dist/runtime/templates/components/main/admin/resource-manager/_parts/CwaResourceManagerContextMenu.vue.d.ts +6 -0
  281. package/dist/runtime/templates/components/main/admin/resource-manager/_parts/ManagerTab.vue +15 -0
  282. package/dist/runtime/templates/components/main/admin/resource-manager/_parts/ManagerTab.vue.d.ts +7 -0
  283. package/dist/runtime/templates/components/main/admin/resource-manager/_parts/ManagerTabs.vue +44 -0
  284. package/dist/runtime/templates/components/main/admin/resource-manager/_parts/ManagerTabs.vue.d.ts +13 -0
  285. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/ResourceInfoTab.vue +59 -0
  286. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/ResourceInfoTab.vue.d.ts +6 -0
  287. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Order.vue +75 -0
  288. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Order.vue.d.ts +6 -0
  289. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Publish.vue +41 -0
  290. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Publish.vue.d.ts +6 -0
  291. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Ui.vue +101 -0
  292. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Ui.vue.d.ts +6 -0
  293. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/group/Group.vue +34 -0
  294. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/group/Group.vue.d.ts +6 -0
  295. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/position/DataPage.vue +121 -0
  296. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/position/DataPage.vue.d.ts +6 -0
  297. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/position/DynamicPage.vue +52 -0
  298. package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/position/DynamicPage.vue.d.ts +6 -0
  299. package/dist/runtime/templates/components/main/admin/resource-manager/cta/CurrentResourceCta.vue +99 -0
  300. package/dist/runtime/templates/components/main/admin/resource-manager/cta/CurrentResourceCta.vue.d.ts +7 -0
  301. package/dist/runtime/templates/components/main/admin/resource-manager/cta/NewResourceCta.vue +59 -0
  302. package/dist/runtime/templates/components/main/admin/resource-manager/cta/NewResourceCta.vue.d.ts +7 -0
  303. package/dist/runtime/templates/components/main/admin/resource-manager/cta/ResourceManagerCtaButton.vue +28 -0
  304. package/dist/runtime/templates/components/main/admin/resource-manager/cta/ResourceManagerCtaButton.vue.d.ts +2 -0
  305. package/dist/runtime/templates/components/main/auth/ForgotPasswordPage.vue +55 -0
  306. package/dist/runtime/templates/components/main/auth/ForgotPasswordPage.vue.d.ts +20 -0
  307. package/dist/runtime/templates/components/main/auth/LoginPage.vue +60 -0
  308. package/dist/runtime/templates/components/main/auth/LoginPage.vue.d.ts +23 -0
  309. package/dist/runtime/templates/components/main/auth/ResetPasswordPage.vue +59 -0
  310. package/dist/runtime/templates/components/main/auth/ResetPasswordPage.vue.d.ts +27 -0
  311. package/dist/runtime/templates/components/main/auth/_parts/AuthPageLink.spec.ts.snap +14 -0
  312. package/dist/runtime/templates/components/main/auth/_parts/AuthPageLink.vue +17 -0
  313. package/dist/runtime/templates/components/main/auth/_parts/AuthPageLink.vue.d.ts +6 -0
  314. package/dist/runtime/templates/components/main/auth/_parts/AuthTemplate.spec.ts.snap +90 -0
  315. package/dist/runtime/templates/components/main/auth/_parts/AuthTemplate.vue +45 -0
  316. package/dist/runtime/templates/components/main/auth/_parts/AuthTemplate.vue.d.ts +17 -0
  317. package/dist/runtime/templates/components/main/auth/_parts/InputField.spec.ts.snap +111 -0
  318. package/dist/runtime/templates/components/main/auth/_parts/InputField.vue +50 -0
  319. package/dist/runtime/templates/components/main/auth/_parts/InputField.vue.d.ts +17 -0
  320. package/dist/runtime/templates/components/ui/BackgroundParticles.vue +960 -0
  321. package/dist/runtime/templates/components/ui/BackgroundParticles.vue.d.ts +2 -0
  322. package/dist/runtime/templates/components/ui/Hamburger.vue +75 -0
  323. package/dist/runtime/templates/components/ui/Hamburger.vue.d.ts +9 -0
  324. package/dist/runtime/templates/components/ui/ProgressBar.spec.ts.snap +71 -0
  325. package/dist/runtime/templates/components/ui/ProgressBar.vue +29 -0
  326. package/dist/runtime/templates/components/ui/ProgressBar.vue.d.ts +9 -0
  327. package/dist/runtime/templates/components/ui/README.md +6 -0
  328. package/dist/runtime/templates/components/ui/alert/Info.spec.ts.snap +23 -0
  329. package/dist/runtime/templates/components/ui/alert/Info.vue +13 -0
  330. package/dist/runtime/templates/components/ui/alert/Info.vue.d.ts +12 -0
  331. package/dist/runtime/templates/components/ui/alert/Warning.spec.ts.snap +14 -0
  332. package/dist/runtime/templates/components/ui/alert/Warning.vue +8 -0
  333. package/dist/runtime/templates/components/ui/alert/Warning.vue.d.ts +12 -0
  334. package/dist/runtime/templates/components/ui/form/Button.vue +139 -0
  335. package/dist/runtime/templates/components/ui/form/Button.vue.d.ts +52 -0
  336. package/dist/runtime/templates/components/ui/form/ButtonPopoverGroup.vue +18 -0
  337. package/dist/runtime/templates/components/ui/form/ButtonPopoverGroup.vue.d.ts +10 -0
  338. package/dist/runtime/templates/components/ui/form/ButtonPopoverItem.vue +15 -0
  339. package/dist/runtime/templates/components/ui/form/ButtonPopoverItem.vue.d.ts +10 -0
  340. package/dist/runtime/templates/components/ui/form/File.vue +72 -0
  341. package/dist/runtime/templates/components/ui/form/File.vue.d.ts +9 -0
  342. package/dist/runtime/templates/components/ui/form/Input.vue +22 -0
  343. package/dist/runtime/templates/components/ui/form/Input.vue.d.ts +5 -0
  344. package/dist/runtime/templates/components/ui/form/LabelWrapper.vue +16 -0
  345. package/dist/runtime/templates/components/ui/form/LabelWrapper.vue.d.ts +15 -0
  346. package/dist/runtime/templates/components/ui/form/SearchResource.vue +212 -0
  347. package/dist/runtime/templates/components/ui/form/SearchResource.vue.d.ts +14 -0
  348. package/dist/runtime/templates/components/ui/form/Select.vue +60 -0
  349. package/dist/runtime/templates/components/ui/form/Select.vue.d.ts +3 -0
  350. package/dist/runtime/templates/components/ui/form/Toggle.vue +39 -0
  351. package/dist/runtime/templates/components/ui/form/Toggle.vue.d.ts +6 -0
  352. package/dist/runtime/templates/components/ui/icon/ArrowIcon.vue +30 -0
  353. package/dist/runtime/templates/components/ui/icon/ArrowIcon.vue.d.ts +2 -0
  354. package/dist/runtime/templates/components/ui/icon/BinIcon.vue +24 -0
  355. package/dist/runtime/templates/components/ui/icon/BinIcon.vue.d.ts +2 -0
  356. package/dist/runtime/templates/components/ui/icon/CogIcon.vue +9 -0
  357. package/dist/runtime/templates/components/ui/icon/CogIcon.vue.d.ts +2 -0
  358. package/dist/runtime/templates/components/ui/icon/EyeIcon.vue +24 -0
  359. package/dist/runtime/templates/components/ui/icon/EyeIcon.vue.d.ts +2 -0
  360. package/dist/runtime/templates/components/ui/icon/PenIcon.vue +12 -0
  361. package/dist/runtime/templates/components/ui/icon/PenIcon.vue.d.ts +2 -0
  362. package/dist/runtime/templates/components/ui/icon/PlusIcon.vue +9 -0
  363. package/dist/runtime/templates/components/ui/icon/PlusIcon.vue.d.ts +2 -0
  364. package/dist/runtime/templates/components/ui/icon/SearchIcon.vue +10 -0
  365. package/dist/runtime/templates/components/ui/icon/SearchIcon.vue.d.ts +2 -0
  366. package/dist/runtime/templates/components/ui/icon/TickIcon.vue +23 -0
  367. package/dist/runtime/templates/components/ui/icon/TickIcon.vue.d.ts +2 -0
  368. package/dist/runtime/templates/components/ui/icon/WarningIcon.vue +11 -0
  369. package/dist/runtime/templates/components/ui/icon/WarningIcon.vue.d.ts +2 -0
  370. package/dist/runtime/templates/components/ui/icon/XMarkIcon.vue +15 -0
  371. package/dist/runtime/templates/components/ui/icon/XMarkIcon.vue.d.ts +2 -0
  372. package/dist/runtime/templates/components/utils/ContextMenu.vue +59 -0
  373. package/dist/runtime/templates/components/utils/ContextMenu.vue.d.ts +21 -0
  374. package/dist/runtime/templates/components/utils/HotSpot.vue +24 -0
  375. package/dist/runtime/templates/components/utils/HotSpot.vue.d.ts +9 -0
  376. package/dist/runtime/templates/components/utils/README.md +1 -0
  377. package/dist/runtime/templates/components/utils/Spinner.spec.ts.snap +56 -0
  378. package/dist/runtime/templates/components/utils/Spinner.vue +42 -0
  379. package/dist/runtime/templates/components/utils/Spinner.vue.d.ts +5 -0
  380. package/dist/runtime/templates/components/utils/SpinnerTick.vue +43 -0
  381. package/dist/runtime/templates/components/utils/SpinnerTick.vue.d.ts +6 -0
  382. package/dist/runtime/templates/cwa-page.spec.ts.snap +20 -0
  383. package/dist/runtime/templates/cwa-page.vue +32 -0
  384. package/dist/runtime/templates/cwa-page.vue.d.ts +2 -0
  385. package/dist/runtime/types/popper.d.ts +14 -0
  386. package/dist/types.d.mts +9 -0
  387. package/package.json +108 -0
@@ -0,0 +1,55 @@
1
+ export default class NavigationGuard {
2
+ constructor(router, adminStoreDefinition) {
3
+ this.router = router;
4
+ this.adminStoreDefinition = adminStoreDefinition;
5
+ this.extendRouteMethods();
6
+ }
7
+ programmatic = false;
8
+ extendRouteMethods() {
9
+ ["push", "go", "back", "forward", "replace"].forEach((methodName) => {
10
+ const routerFn = this.router[methodName];
11
+ this.router[methodName] = (...args) => {
12
+ this.programmatic = true;
13
+ return routerFn.apply(this.router, args);
14
+ };
15
+ });
16
+ }
17
+ isRouteForcedNavigation(toRoute) {
18
+ const cwaForceQuery = toRoute.query?.cwa_force === "true";
19
+ if (cwaForceQuery) {
20
+ delete toRoute.query.cwa_force;
21
+ return true;
22
+ }
23
+ const cwaForceParam = toRoute.params?.cwa_force;
24
+ return cwaForceParam === "true";
25
+ }
26
+ allowNavigation(toRoute) {
27
+ return this.isRouteForcedNavigation(toRoute) || !this.programmatic || !this.navigationDisabled;
28
+ }
29
+ get navigationDisabled() {
30
+ return this.adminStore.state.isEditing && !this.adminStore.state.navigationGuardDisabled;
31
+ }
32
+ get adminNavigationGuardFn() {
33
+ return (toRoute) => {
34
+ try {
35
+ const cwaForceQuery = toRoute.query?.cwa_force;
36
+ if (!this.allowNavigation(toRoute)) {
37
+ return false;
38
+ }
39
+ if (!cwaForceQuery) {
40
+ return true;
41
+ }
42
+ return {
43
+ path: toRoute.path,
44
+ query: toRoute.query,
45
+ hash: toRoute.hash
46
+ };
47
+ } finally {
48
+ this.programmatic = false;
49
+ }
50
+ };
51
+ }
52
+ get adminStore() {
53
+ return this.adminStoreDefinition.useStore();
54
+ }
55
+ }
@@ -0,0 +1,92 @@
1
+ import type { ComputedRef, Ref } from 'vue';
2
+ import type { AdminStore } from '../storage/stores/admin/admin-store.js';
3
+ import type { ResourcesStore } from '../storage/stores/resources/resources-store.js';
4
+ import type { ManageableResourceOps, StyleOptions } from './manageable-resource.js';
5
+ import type { ComponentUi, ManagerTab } from '#cwa/module';
6
+ import { CwaResourceTypes } from '#cwa/runtime/resources/resource-utils';
7
+ import type { Resources } from '#cwa/runtime/resources/resources';
8
+ interface _ResourceStackItem {
9
+ iri: string;
10
+ domElements: Ref<HTMLElement[]>;
11
+ displayName?: string;
12
+ managerTabs?: ManagerTab[];
13
+ ui?: ComponentUi[];
14
+ childIris: Ref<string[]>;
15
+ styles?: ComputedRef<StyleOptions | undefined>;
16
+ resourceOps?: ManageableResourceOps;
17
+ }
18
+ export type ResourceStackItem = _ResourceStackItem;
19
+ interface AddToStackWindowEvent {
20
+ clickTarget: EventTarget | null;
21
+ }
22
+ interface AddToStackEvent extends _ResourceStackItem, AddToStackWindowEvent {
23
+ }
24
+ export interface AddResourceEvent {
25
+ addAfter: boolean | null;
26
+ targetIri: string;
27
+ closest: {
28
+ position?: string;
29
+ group?: string;
30
+ };
31
+ pageDataProperty?: string;
32
+ }
33
+ export default class ResourceStackManager {
34
+ private adminStoreDefinition;
35
+ private readonly resourcesStoreDefinition;
36
+ private readonly resources;
37
+ readonly forcePublishedVersion: Ref<boolean | undefined>;
38
+ readonly showManager: Ref<boolean>;
39
+ private readonly isLayoutStack;
40
+ private readonly _isEditingLayout;
41
+ private readonly currentClickTarget;
42
+ private readonly currentResourceStack;
43
+ private readonly previousResourceStack;
44
+ private readonly lastContextTarget;
45
+ private readonly contextResourceStack;
46
+ private readonly cachedCurrentStackItem;
47
+ private readonly resourceManagerState;
48
+ private readonly yOffset;
49
+ private focusComponent;
50
+ private focusWrapper;
51
+ private focusProxy;
52
+ private _currentStackItem;
53
+ private _currentIri;
54
+ constructor(adminStoreDefinition: AdminStore, resourcesStoreDefinition: ResourcesStore, resources: Resources);
55
+ private handleCurrentStackItemChange;
56
+ get isEditingLayout(): Ref<boolean, boolean>;
57
+ getState(prop: string): any;
58
+ setState(prop: string, value: any): void;
59
+ get contextStack(): ComputedRef<_ResourceStackItem[]>;
60
+ get resourceStack(): ComputedRef<_ResourceStackItem[]>;
61
+ get isPopulating(): ComputedRef<boolean>;
62
+ get isContextPopulating(): ComputedRef<boolean>;
63
+ get currentStackItem(): ComputedRef<_ResourceStackItem | undefined>;
64
+ get currentIri(): ComputedRef<string | undefined>;
65
+ resetStack(clearContextStack?: boolean): void;
66
+ getClosestStackItemByType(type: CwaResourceTypes): string | undefined;
67
+ private confirmStackChange;
68
+ selectStackIndex(index: number, fromContext: boolean): Promise<void>;
69
+ private getCurrentTarget;
70
+ completeStack(event: AddToStackWindowEvent, isContext?: boolean, type?: undefined | 'page' | 'layout'): void;
71
+ addToStack(event: AddToStackEvent, isContext?: boolean, resourceOps?: ManageableResourceOps): void;
72
+ private _addToStack;
73
+ private finishStack;
74
+ isComponentGroupDisabled(iri: string): boolean;
75
+ isComponentDisabled(iri: string): boolean;
76
+ private filterDisabledStackItems;
77
+ private getCurrentStack;
78
+ private insertResourceStackItem;
79
+ redrawFocus(): void;
80
+ private createFocusComponent;
81
+ private removeFocusComponent;
82
+ private scrollIntoView;
83
+ private isElementOutsideViewport;
84
+ private listenEditModeChange;
85
+ private listenCurrentIri;
86
+ private resetResourceManagerVars;
87
+ private isResourceInStack;
88
+ private get isEditing();
89
+ private get adminStore();
90
+ private get resourcesStore();
91
+ }
92
+ export {};
@@ -0,0 +1,355 @@
1
+ import { computed, createApp, nextTick, ref, shallowRef, watch } from "vue";
2
+ import { consola as logger } from "consola";
3
+ import { createConfirmDialog } from "vuejs-confirm-dialog";
4
+ import ComponentFocus from "../templates/components/main/admin/resource-manager/ComponentFocus.vue";
5
+ import { CwaResourceTypes, getResourceTypeFromIri } from "#cwa/runtime/resources/resource-utils";
6
+ import ConfirmDialog from "#cwa/runtime/templates/components/core/ConfirmDialog.vue";
7
+ export default class ResourceStackManager {
8
+ constructor(adminStoreDefinition, resourcesStoreDefinition, resources) {
9
+ this.adminStoreDefinition = adminStoreDefinition;
10
+ this.resourcesStoreDefinition = resourcesStoreDefinition;
11
+ this.resources = resources;
12
+ watch(() => this.isEditing, this.listenEditModeChange.bind(this));
13
+ watch(this.currentIri, this.listenCurrentIri.bind(this));
14
+ watch(this.currentStackItem, this.handleCurrentStackItemChange.bind(this));
15
+ watch(this.showManager, (newValue) => !newValue && this.removeFocusComponent());
16
+ }
17
+ forcePublishedVersion = ref();
18
+ showManager = ref(false);
19
+ isLayoutStack = ref(false);
20
+ _isEditingLayout = ref(false);
21
+ currentClickTarget = ref(null);
22
+ currentResourceStack = shallowRef([]);
23
+ previousResourceStack = shallowRef([]);
24
+ lastContextTarget = ref(null);
25
+ contextResourceStack = shallowRef([]);
26
+ cachedCurrentStackItem = shallowRef();
27
+ resourceManagerState = ref({});
28
+ yOffset = 100;
29
+ focusComponent;
30
+ focusWrapper;
31
+ focusProxy;
32
+ _currentStackItem;
33
+ _currentIri;
34
+ async handleCurrentStackItemChange(currentStackItem) {
35
+ this.cachedCurrentStackItem.value = currentStackItem;
36
+ await nextTick();
37
+ this.scrollIntoView();
38
+ this.createFocusComponent();
39
+ }
40
+ get isEditingLayout() {
41
+ return this._isEditingLayout;
42
+ }
43
+ getState(prop) {
44
+ return this.resourceManagerState.value[prop];
45
+ }
46
+ setState(prop, value) {
47
+ Object.assign(this.resourceManagerState.value, { [prop]: value });
48
+ }
49
+ get contextStack() {
50
+ return computed(() => {
51
+ return this.lastContextTarget.value ? [] : this.contextResourceStack.value;
52
+ });
53
+ }
54
+ get resourceStack() {
55
+ return computed(() => {
56
+ return this.currentClickTarget.value ? [] : this.currentResourceStack.value;
57
+ });
58
+ }
59
+ get isPopulating() {
60
+ return computed(() => !!this.currentClickTarget.value);
61
+ }
62
+ get isContextPopulating() {
63
+ return computed(() => !!this.lastContextTarget.value);
64
+ }
65
+ get currentStackItem() {
66
+ if (!this._currentStackItem) {
67
+ this._currentStackItem = computed(() => {
68
+ if (!this.showManager.value) {
69
+ return;
70
+ }
71
+ if (this.currentClickTarget.value) {
72
+ return this.cachedCurrentStackItem.value;
73
+ }
74
+ return this.currentResourceStack.value[0];
75
+ });
76
+ }
77
+ return this._currentStackItem;
78
+ }
79
+ get currentIri() {
80
+ if (!this._currentIri) {
81
+ this._currentIri = computed(() => {
82
+ const currentStackItem = this.currentStackItem.value;
83
+ if (!currentStackItem) {
84
+ return;
85
+ }
86
+ const stackIri = currentStackItem.iri;
87
+ if (this.forcePublishedVersion.value === void 0) {
88
+ return stackIri;
89
+ }
90
+ if (this.forcePublishedVersion.value) {
91
+ return this.resourcesStore.findPublishedComponentIri(stackIri);
92
+ }
93
+ return this.resourcesStore.findDraftComponentIri(stackIri);
94
+ });
95
+ }
96
+ return this._currentIri;
97
+ }
98
+ resetStack(clearContextStack) {
99
+ if (clearContextStack) {
100
+ this.lastContextTarget.value = null;
101
+ this.contextResourceStack.value = [];
102
+ return;
103
+ }
104
+ this.previousResourceStack.value = this.currentResourceStack.value;
105
+ this.currentClickTarget.value = null;
106
+ this.currentResourceStack.value = [];
107
+ }
108
+ getClosestStackItemByType(type) {
109
+ const currentStack = this.resourceStack.value;
110
+ for (const stackItem of currentStack) {
111
+ const stackItemIri = stackItem.iri;
112
+ const resourceType = getResourceTypeFromIri(stackItemIri);
113
+ if (resourceType === type) {
114
+ return stackItemIri;
115
+ }
116
+ }
117
+ }
118
+ async confirmStackChange(alertData, fromContext) {
119
+ let cachedNewStack;
120
+ if (!fromContext) {
121
+ cachedNewStack = this.currentResourceStack.value;
122
+ this.currentResourceStack.value = this.previousResourceStack.value;
123
+ }
124
+ const dialog = createConfirmDialog(ConfirmDialog);
125
+ const { isCanceled } = await dialog.reveal(alertData);
126
+ if (isCanceled) {
127
+ if (fromContext) {
128
+ this.resetStack(true);
129
+ }
130
+ return false;
131
+ }
132
+ if (cachedNewStack) {
133
+ this.currentResourceStack.value = cachedNewStack;
134
+ }
135
+ return true;
136
+ }
137
+ async selectStackIndex(index, fromContext) {
138
+ if (!this.isEditing) {
139
+ return;
140
+ }
141
+ const fromStack = fromContext ? this.contextResourceStack : this.currentResourceStack;
142
+ const currentLength = fromStack.value.length;
143
+ if (!currentLength) {
144
+ this.showManager.value = false;
145
+ return;
146
+ }
147
+ if (index < 0 || index > currentLength - 1) {
148
+ logger.error(`Cannot select stack index: '${index}' is out of range`);
149
+ return;
150
+ }
151
+ if (this._isEditingLayout.value !== this.isLayoutStack.value) {
152
+ const confirmed = await this.confirmStackChange({ title: "Are you sure?", content: `<p>Are you sure you want to switch and edit the ${this.isLayoutStack.value ? "layout" : "page"}?</p>` }, fromContext);
153
+ if (!confirmed) {
154
+ this.isLayoutStack.value = this._isEditingLayout.value;
155
+ return;
156
+ }
157
+ this._isEditingLayout.value = this.isLayoutStack.value;
158
+ }
159
+ this.currentResourceStack.value = fromStack.value.slice(index);
160
+ this.showManager.value = true;
161
+ if (fromContext) {
162
+ this.resetStack(true);
163
+ }
164
+ }
165
+ getCurrentTarget(isContext) {
166
+ return isContext ? this.lastContextTarget : this.currentClickTarget;
167
+ }
168
+ completeStack(event, isContext, type) {
169
+ if (type) {
170
+ this.isLayoutStack.value = type === "layout";
171
+ }
172
+ this._addToStack(event, isContext);
173
+ }
174
+ addToStack(event, isContext, resourceOps) {
175
+ return this._addToStack(event, isContext, resourceOps);
176
+ }
177
+ _addToStack(event, isContext, resourceOps) {
178
+ const currentTarget = this.getCurrentTarget(!!isContext);
179
+ const { clickTarget, ...resourceStackItem } = event;
180
+ const isResourceClick = "iri" in resourceStackItem;
181
+ if (!currentTarget.value) {
182
+ if (!isContext && isResourceClick && this.isResourceInStack(resourceStackItem.iri, false)) {
183
+ currentTarget.value = clickTarget;
184
+ return;
185
+ }
186
+ this.resetStack(isContext);
187
+ if (!isContext) {
188
+ this.resetStack(true);
189
+ }
190
+ }
191
+ if (!this.isEditing) {
192
+ return;
193
+ }
194
+ if (isResourceClick && this.isResourceInStack(resourceStackItem.iri, !!isContext) && currentTarget.value) {
195
+ return;
196
+ }
197
+ if (!isResourceClick) {
198
+ this.finishStack(!!isContext);
199
+ return;
200
+ }
201
+ resourceStackItem.resourceOps = resourceOps;
202
+ this.insertResourceStackItem(resourceStackItem, !!isContext);
203
+ currentTarget.value = clickTarget;
204
+ }
205
+ finishStack(isContext) {
206
+ this.filterDisabledStackItems(isContext);
207
+ this.getCurrentTarget(isContext).value = null;
208
+ if (this.currentResourceStack.value.length === 0) {
209
+ this.previousResourceStack.value = [];
210
+ }
211
+ }
212
+ isComponentGroupDisabled(iri) {
213
+ if (getResourceTypeFromIri(iri) !== CwaResourceTypes.COMPONENT_GROUP) {
214
+ return false;
215
+ }
216
+ return this.resources.isDataPage.value && !this.isLayoutStack.value;
217
+ }
218
+ isComponentDisabled(iri) {
219
+ if (getResourceTypeFromIri(iri) !== CwaResourceTypes.COMPONENT) {
220
+ return false;
221
+ }
222
+ return this.resources.isDataPage.value && !this.resources.isPageDataResource(iri).value && !this.isLayoutStack.value;
223
+ }
224
+ filterDisabledStackItems(isContext) {
225
+ const stack = this.getCurrentStack(isContext);
226
+ const newStack = [];
227
+ for (const item of stack.value) {
228
+ if (this.isComponentGroupDisabled(item.iri)) {
229
+ continue;
230
+ }
231
+ if (this.isComponentDisabled(item.iri)) {
232
+ continue;
233
+ }
234
+ newStack.push(item);
235
+ }
236
+ stack.value = newStack;
237
+ }
238
+ getCurrentStack(isContext) {
239
+ return isContext ? this.contextResourceStack : this.currentResourceStack;
240
+ }
241
+ insertResourceStackItem(resourceStackItem, isContext) {
242
+ const stack = this.getCurrentStack(!!isContext);
243
+ const iris = this.resourcesStore.findAllPublishableIris(resourceStackItem.iri);
244
+ const insertAtIndex = stack.value.findIndex((existingStackItem) => {
245
+ const existingItemChildren = existingStackItem.childIris.value;
246
+ if (!existingItemChildren) {
247
+ return false;
248
+ }
249
+ return existingItemChildren.some((r) => iris.includes(r));
250
+ });
251
+ insertAtIndex === -1 ? stack.value.push(resourceStackItem) : stack.value.splice(insertAtIndex, 0, resourceStackItem);
252
+ }
253
+ redrawFocus() {
254
+ if (!this.focusProxy) {
255
+ return;
256
+ }
257
+ this.focusProxy.redraw();
258
+ }
259
+ createFocusComponent() {
260
+ this.removeFocusComponent();
261
+ const stackItem = this.currentStackItem.value;
262
+ if (!this.currentIri.value || !stackItem) {
263
+ return;
264
+ }
265
+ this.focusComponent = createApp(ComponentFocus, {
266
+ iri: this.currentIri,
267
+ domElements: stackItem.domElements
268
+ });
269
+ this.focusWrapper = document.createElement("div");
270
+ this.focusWrapper.className = "cwa:absolute cwa:z-10";
271
+ document.body.appendChild(this.focusWrapper);
272
+ this.focusProxy = this.focusComponent.mount(this.focusWrapper);
273
+ }
274
+ removeFocusComponent() {
275
+ if (this.focusComponent) {
276
+ const toUnmount = this.focusComponent;
277
+ this.focusComponent = void 0;
278
+ this.focusProxy = void 0;
279
+ toUnmount.unmount();
280
+ }
281
+ if (this.focusWrapper) {
282
+ const toRemove = this.focusWrapper;
283
+ this.focusWrapper = void 0;
284
+ toRemove.remove();
285
+ }
286
+ }
287
+ scrollIntoView() {
288
+ let element;
289
+ let elementOutOfView = false;
290
+ const stackItem = this.currentStackItem.value;
291
+ if (!stackItem) {
292
+ return;
293
+ }
294
+ for (const elCandidate of stackItem.domElements.value) {
295
+ if (elCandidate.nodeType === Node.ELEMENT_NODE) {
296
+ if (!element) {
297
+ element = elCandidate;
298
+ }
299
+ if (this.isElementOutsideViewport(element)) {
300
+ elementOutOfView = true;
301
+ }
302
+ if (elementOutOfView && element) {
303
+ break;
304
+ }
305
+ }
306
+ }
307
+ if (!element || !elementOutOfView) {
308
+ return;
309
+ }
310
+ const y = element.getBoundingClientRect().top + window.scrollY - this.yOffset;
311
+ window.scrollTo({ top: y, behavior: "smooth" });
312
+ }
313
+ isElementOutsideViewport(el) {
314
+ const { top, left, bottom, right } = el.getBoundingClientRect();
315
+ const { innerHeight, innerWidth } = window;
316
+ let visibleHeight = innerHeight;
317
+ const managerSpacer = document.getElementById("cwa-manager-spacer");
318
+ if (managerSpacer) {
319
+ visibleHeight -= managerSpacer.offsetHeight;
320
+ }
321
+ return top < this.yOffset || left < 0 || bottom > visibleHeight || right > innerWidth;
322
+ }
323
+ listenEditModeChange(isEditing) {
324
+ if (!isEditing) {
325
+ this.showManager.value = false;
326
+ this.resetStack(true);
327
+ this._isEditingLayout.value = false;
328
+ }
329
+ }
330
+ listenCurrentIri(newIri, oldIri) {
331
+ if (newIri && oldIri) {
332
+ if (this.resourcesStore.isIriPublishableEquivalent(oldIri, newIri)) {
333
+ return;
334
+ }
335
+ }
336
+ this.resetResourceManagerVars();
337
+ }
338
+ resetResourceManagerVars() {
339
+ this.forcePublishedVersion.value = void 0;
340
+ this.resourceManagerState.value = {};
341
+ }
342
+ isResourceInStack(iri, isContext) {
343
+ const stack = isContext ? this.contextResourceStack : this.currentResourceStack;
344
+ return !!stack.value.find((el) => el.iri === iri);
345
+ }
346
+ get isEditing() {
347
+ return this.adminStore.state.isEditing;
348
+ }
349
+ get adminStore() {
350
+ return this.adminStoreDefinition.useStore();
351
+ }
352
+ get resourcesStore() {
353
+ return this.resourcesStoreDefinition.useStore();
354
+ }
355
+ }
@@ -0,0 +1,28 @@
1
+ import type { ApiDocumentationStore } from '../storage/stores/api-documentation/api-documentation-store.js';
2
+ import type { CwaApiDocumentationDataInterface } from '../storage/stores/api-documentation/state.js';
3
+ import type CwaFetch from './fetcher/cwa-fetch.js';
4
+ export interface ApiDocumentationComponentMetadata {
5
+ resourceName: string;
6
+ endpoint: string;
7
+ isPublishable: boolean;
8
+ }
9
+ export interface ApiDocumentationComponentMetadataCollection {
10
+ [key: string]: ApiDocumentationComponentMetadata;
11
+ }
12
+ export default class ApiDocumentation {
13
+ private readonly cwaFetch;
14
+ private readonly storeDefinition;
15
+ private readonly apiDocsSet;
16
+ private apiDocPromise;
17
+ constructor(cwaFetch: CwaFetch, store: ApiDocumentationStore);
18
+ setDocsPathFromLinkHeader(linkHeader: string): void;
19
+ getApiDocumentation(refresh?: boolean): Promise<CwaApiDocumentationDataInterface | undefined>;
20
+ getComponentMetadata(refresh?: boolean, includePosition?: boolean): Promise<undefined | ApiDocumentationComponentMetadataCollection>;
21
+ private reRunGetApiDocumentationWhenReady;
22
+ private getCurrentApiDocs;
23
+ private awaitApiDocPromise;
24
+ private fetchAllApiDocumentation;
25
+ private doRequest;
26
+ private get store();
27
+ private get docsPath();
28
+ }
@@ -0,0 +1,131 @@
1
+ import { ref, watch } from "vue";
2
+ import { consola as logger } from "consola";
3
+ import { CwaResourceTypes, getResourceTypeFromIri } from "#cwa/runtime/resources/resource-utils";
4
+ export default class ApiDocumentation {
5
+ cwaFetch;
6
+ storeDefinition;
7
+ apiDocsSet = ref(false);
8
+ apiDocPromise;
9
+ constructor(cwaFetch, store) {
10
+ this.cwaFetch = cwaFetch;
11
+ this.storeDefinition = store;
12
+ }
13
+ setDocsPathFromLinkHeader(linkHeader) {
14
+ this.apiDocsSet.value = this.apiDocsSet.value || !!this.docsPath;
15
+ if (this.apiDocsSet.value) {
16
+ return;
17
+ }
18
+ const matches = /<(.+)>; rel="http:\/\/www.w3.org\/ns\/hydra\/core#apiDocumentation"/.exec(
19
+ linkHeader
20
+ );
21
+ if (!matches || !matches[1]) {
22
+ logger.error(
23
+ 'The "Link" HTTP header is not of the type "http://www.w3.org/ns/hydra/core#apiDocumentation".'
24
+ );
25
+ return;
26
+ }
27
+ this.store.$patch({
28
+ docsPath: matches[1]
29
+ });
30
+ this.apiDocsSet.value = true;
31
+ logger.debug("ApiDocumentation docsPath", this.docsPath);
32
+ }
33
+ async getApiDocumentation(refresh = false) {
34
+ if (!this.docsPath) {
35
+ logger.debug("Waiting for docsPath to bet set to fetch API Documentation");
36
+ return this.reRunGetApiDocumentationWhenReady(refresh);
37
+ }
38
+ const currentDocs = this.getCurrentApiDocs(refresh);
39
+ if (currentDocs) {
40
+ return currentDocs;
41
+ }
42
+ logger.debug("Fetching API Documentation");
43
+ return await this.fetchAllApiDocumentation(this.docsPath);
44
+ }
45
+ async getComponentMetadata(refresh = false, includePosition = false) {
46
+ const apiDocumentation = await this.getApiDocumentation(refresh);
47
+ const docs = apiDocumentation?.docs;
48
+ const entrypoint = apiDocumentation?.entrypoint;
49
+ if (!docs || !entrypoint) {
50
+ return;
51
+ }
52
+ const properties = docs["hydra:supportedClass"].reduce(
53
+ (obj, supportedClass) => {
54
+ obj[supportedClass["rdfs:label"]] = supportedClass["hydra:supportedProperty"].map((supportedProperty) => supportedProperty["hydra:title"]);
55
+ return obj;
56
+ },
57
+ {}
58
+ );
59
+ const metadata = {};
60
+ const typeCheckArray = [CwaResourceTypes.COMPONENT];
61
+ if (includePosition) {
62
+ typeCheckArray.push(CwaResourceTypes.COMPONENT_POSITION);
63
+ }
64
+ for (const [key, endpoint] of Object.entries(entrypoint)) {
65
+ const rType = getResourceTypeFromIri(endpoint);
66
+ if (rType && typeCheckArray.includes(rType)) {
67
+ const resourceName = key[0].toUpperCase() + key.slice(1);
68
+ const isPublishable = properties?.[resourceName].includes("publishedAt") || false;
69
+ metadata[resourceName] = {
70
+ resourceName,
71
+ endpoint,
72
+ isPublishable
73
+ };
74
+ }
75
+ }
76
+ return metadata;
77
+ }
78
+ reRunGetApiDocumentationWhenReady(refresh = false) {
79
+ return new Promise((resolve) => {
80
+ watch(this.apiDocsSet, async (isSet) => {
81
+ if (isSet) {
82
+ const docs = await this.getApiDocumentation(refresh);
83
+ resolve(docs);
84
+ }
85
+ });
86
+ });
87
+ }
88
+ getCurrentApiDocs(refresh) {
89
+ if (!this.apiDocPromise && !refresh && this.store.$state.apiDocumentation) {
90
+ logger.debug("Not refreshing API Documentation. Returning cached data.");
91
+ return this.store.$state.apiDocumentation;
92
+ }
93
+ return null;
94
+ }
95
+ async awaitApiDocPromise() {
96
+ logger.debug("Waiting for previous request to complete for API Documentation");
97
+ await this.apiDocPromise;
98
+ return this.store.$state.apiDocumentation;
99
+ }
100
+ async fetchAllApiDocumentation(docsPath) {
101
+ if (this.apiDocPromise) {
102
+ return await this.awaitApiDocPromise();
103
+ }
104
+ this.apiDocPromise = Promise.all([
105
+ this.doRequest("/.jsonld"),
106
+ this.doRequest(docsPath),
107
+ this.doRequest("/_/page_data_metadatas")
108
+ ]).then((responses) => {
109
+ this.store.$patch({
110
+ apiDocumentation: {
111
+ entrypoint: responses[0],
112
+ docs: responses[1],
113
+ pageDataMetadata: responses[2]
114
+ }
115
+ });
116
+ logger.debug("New API Documentation Saved");
117
+ this.apiDocPromise = void 0;
118
+ });
119
+ await this.apiDocPromise;
120
+ return this.store.$state.apiDocumentation;
121
+ }
122
+ async doRequest(path) {
123
+ return await this.cwaFetch.fetch(path);
124
+ }
125
+ get store() {
126
+ return this.storeDefinition.useStore();
127
+ }
128
+ get docsPath() {
129
+ return this.store.$state.docsPath;
130
+ }
131
+ }