@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.
- package/README.md +38 -0
- package/README.template.md +32 -0
- package/dist/layer/error.vue +13 -0
- package/dist/layer/layouts/CwaRootLayout.vue +140 -0
- package/dist/layer/nuxt.config.spec.ts +10 -0
- package/dist/layer/nuxt.config.ts +3 -0
- package/dist/layer/pages/_cwa/composables/useDataList.ts +50 -0
- package/dist/layer/pages/_cwa/composables/useDataType.ts +30 -0
- package/dist/layer/pages/_cwa/composables/useDynamicPageLoader.ts +28 -0
- package/dist/layer/pages/_cwa/composables/useItemPage.ts +172 -0
- package/dist/layer/pages/_cwa/composables/useListPage.ts +43 -0
- package/dist/layer/pages/_cwa/data/[type]/[iri].vue +17 -0
- package/dist/layer/pages/_cwa/data/[type].vue +131 -0
- package/dist/layer/pages/_cwa/data/index.vue +84 -0
- package/dist/layer/pages/_cwa/layouts/[iri].vue +174 -0
- package/dist/layer/pages/_cwa/layouts.vue +77 -0
- package/dist/layer/pages/_cwa/pages/[iri].vue +11 -0
- package/dist/layer/pages/_cwa/pages.vue +129 -0
- package/dist/layer/pages/_cwa/routes.vue +72 -0
- package/dist/layer/pages/_cwa/users/[iri].vue +248 -0
- package/dist/layer/pages/_cwa/users.vue +86 -0
- package/dist/layer/pages/_cwa.vue +43 -0
- package/dist/layer/pages/forgot-password.vue +32 -0
- package/dist/layer/pages/login.vue +33 -0
- package/dist/layer/pages/reset-password/[username]/[token].vue +39 -0
- package/dist/module.d.mts +53 -0
- package/dist/module.json +13 -0
- package/dist/module.mjs +235 -0
- package/dist/runtime/admin/admin.d.ts +36 -0
- package/dist/runtime/admin/admin.js +65 -0
- package/dist/runtime/admin/manageable-resource.d.ts +41 -0
- package/dist/runtime/admin/manageable-resource.js +206 -0
- package/dist/runtime/admin/manager-tabs-resolver.d.ts +17 -0
- package/dist/runtime/admin/manager-tabs-resolver.js +51 -0
- package/dist/runtime/admin/navigation-guard.d.ts +18 -0
- package/dist/runtime/admin/navigation-guard.js +55 -0
- package/dist/runtime/admin/resource-stack-manager.d.ts +92 -0
- package/dist/runtime/admin/resource-stack-manager.js +355 -0
- package/dist/runtime/api/api-documentation.d.ts +28 -0
- package/dist/runtime/api/api-documentation.js +131 -0
- package/dist/runtime/api/auth.d.ts +85 -0
- package/dist/runtime/api/auth.js +183 -0
- package/dist/runtime/api/fetcher/cwa-fetch.d.ts +5 -0
- package/dist/runtime/api/fetcher/cwa-fetch.js +20 -0
- package/dist/runtime/api/fetcher/fetch-status-manager.d.ts +51 -0
- package/dist/runtime/api/fetcher/fetch-status-manager.js +185 -0
- package/dist/runtime/api/fetcher/fetcher.d.ts +57 -0
- package/dist/runtime/api/fetcher/fetcher.js +222 -0
- package/dist/runtime/api/fetcher/preload-headers.d.ts +6 -0
- package/dist/runtime/api/fetcher/preload-headers.js +31 -0
- package/dist/runtime/api/forms.d.ts +40 -0
- package/dist/runtime/api/forms.js +40 -0
- package/dist/runtime/api/mercure.d.ts +33 -0
- package/dist/runtime/api/mercure.js +191 -0
- package/dist/runtime/composables/component/html-content.d.ts +2 -0
- package/dist/runtime/composables/component/html-content.js +82 -0
- package/dist/runtime/composables/cwa-collection-pagination.d.ts +13 -0
- package/dist/runtime/composables/cwa-collection-pagination.js +34 -0
- package/dist/runtime/composables/cwa-collection-resource.d.ts +16 -0
- package/dist/runtime/composables/cwa-collection-resource.js +92 -0
- package/dist/runtime/composables/cwa-image.d.ts +19 -0
- package/dist/runtime/composables/cwa-image.js +43 -0
- package/dist/runtime/composables/cwa-query-bound-model.d.ts +9 -0
- package/dist/runtime/composables/cwa-query-bound-model.js +108 -0
- package/dist/runtime/composables/cwa-resource-endpoint.d.ts +5 -0
- package/dist/runtime/composables/cwa-resource-endpoint.js +36 -0
- package/dist/runtime/composables/cwa-resource-manageable.d.ts +10 -0
- package/dist/runtime/composables/cwa-resource-manageable.js +32 -0
- package/dist/runtime/composables/cwa-resource-manager-tab.d.ts +17 -0
- package/dist/runtime/composables/cwa-resource-manager-tab.js +30 -0
- package/dist/runtime/composables/cwa-resource-model.d.ts +21 -0
- package/dist/runtime/composables/cwa-resource-model.js +149 -0
- package/dist/runtime/composables/cwa-resource-upload.d.ts +8 -0
- package/dist/runtime/composables/cwa-resource-upload.js +70 -0
- package/dist/runtime/composables/cwa-resource.d.ts +24 -0
- package/dist/runtime/composables/cwa-resource.js +22 -0
- package/dist/runtime/composables/cwa-select-input.d.ts +21 -0
- package/dist/runtime/composables/cwa-select-input.js +37 -0
- package/dist/runtime/composables/cwa-select.d.ts +15 -0
- package/dist/runtime/composables/cwa-select.js +24 -0
- package/dist/runtime/composables/cwa.d.ts +2 -0
- package/dist/runtime/composables/cwa.js +2 -0
- package/dist/runtime/composables/forgot-password.d.ts +9 -0
- package/dist/runtime/composables/forgot-password.js +45 -0
- package/dist/runtime/composables/login.d.ts +9 -0
- package/dist/runtime/composables/login.js +30 -0
- package/dist/runtime/composables/popper.d.ts +529 -0
- package/dist/runtime/composables/popper.js +104 -0
- package/dist/runtime/composables/process.d.ts +4 -0
- package/dist/runtime/composables/process.js +6 -0
- package/dist/runtime/composables/reset-password.d.ts +14 -0
- package/dist/runtime/composables/reset-password.js +75 -0
- package/dist/runtime/composables/transitions.d.ts +12 -0
- package/dist/runtime/composables/transitions.js +12 -0
- package/dist/runtime/cwa.d.ts +61 -0
- package/dist/runtime/cwa.js +123 -0
- package/dist/runtime/errors/cwa-resource-error.d.ts +18 -0
- package/dist/runtime/errors/cwa-resource-error.js +54 -0
- package/dist/runtime/plugin.d.ts +7 -0
- package/dist/runtime/plugin.js +18 -0
- package/dist/runtime/resources/resource-utils.d.ts +44 -0
- package/dist/runtime/resources/resource-utils.js +73 -0
- package/dist/runtime/resources/resources-manager.d.ts +70 -0
- package/dist/runtime/resources/resources-manager.js +463 -0
- package/dist/runtime/resources/resources.d.ts +53 -0
- package/dist/runtime/resources/resources.js +300 -0
- package/dist/runtime/route-middleware.d.ts +2 -0
- package/dist/runtime/route-middleware.js +86 -0
- package/dist/runtime/storage/storage.d.ts +20 -0
- package/dist/runtime/storage/storage.js +25 -0
- package/dist/runtime/storage/stores/admin/actions.d.ts +5 -0
- package/dist/runtime/storage/stores/admin/actions.js +10 -0
- package/dist/runtime/storage/stores/admin/admin-store.d.ts +18 -0
- package/dist/runtime/storage/stores/admin/admin-store.js +20 -0
- package/dist/runtime/storage/stores/admin/state.d.ts +7 -0
- package/dist/runtime/storage/stores/admin/state.js +9 -0
- package/dist/runtime/storage/stores/api-documentation/api-documentation-store.d.ts +16 -0
- package/dist/runtime/storage/stores/api-documentation/api-documentation-store.js +18 -0
- package/dist/runtime/storage/stores/api-documentation/state.d.ts +74 -0
- package/dist/runtime/storage/stores/api-documentation/state.js +6 -0
- package/dist/runtime/storage/stores/auth/auth-store.d.ts +16 -0
- package/dist/runtime/storage/stores/auth/auth-store.js +18 -0
- package/dist/runtime/storage/stores/auth/state.d.ts +20 -0
- package/dist/runtime/storage/stores/auth/state.js +15 -0
- package/dist/runtime/storage/stores/cwa-store-types.d.ts +14 -0
- package/dist/runtime/storage/stores/error/actions.d.ts +11 -0
- package/dist/runtime/storage/stores/error/actions.js +69 -0
- package/dist/runtime/storage/stores/error/error-store.d.ts +13 -0
- package/dist/runtime/storage/stores/error/error-store.js +21 -0
- package/dist/runtime/storage/stores/error/getters.d.ts +7 -0
- package/dist/runtime/storage/stores/error/getters.js +11 -0
- package/dist/runtime/storage/stores/error/state.d.ts +35 -0
- package/dist/runtime/storage/stores/error/state.js +15 -0
- package/dist/runtime/storage/stores/fetcher/actions.d.ts +49 -0
- package/dist/runtime/storage/stores/fetcher/actions.js +125 -0
- package/dist/runtime/storage/stores/fetcher/fetcher-store.d.ts +19 -0
- package/dist/runtime/storage/stores/fetcher/fetcher-store.js +23 -0
- package/dist/runtime/storage/stores/fetcher/getter-utils.d.ts +7 -0
- package/dist/runtime/storage/stores/fetcher/getter-utils.js +27 -0
- package/dist/runtime/storage/stores/fetcher/getters.d.ts +13 -0
- package/dist/runtime/storage/stores/fetcher/getters.js +52 -0
- package/dist/runtime/storage/stores/fetcher/state.d.ts +25 -0
- package/dist/runtime/storage/stores/fetcher/state.js +7 -0
- package/dist/runtime/storage/stores/mercure/mercure-store.d.ts +16 -0
- package/dist/runtime/storage/stores/mercure/mercure-store.js +18 -0
- package/dist/runtime/storage/stores/mercure/state.d.ts +5 -0
- package/dist/runtime/storage/stores/mercure/state.js +6 -0
- package/dist/runtime/storage/stores/resources/actions.d.ts +54 -0
- package/dist/runtime/storage/stores/resources/actions.js +390 -0
- package/dist/runtime/storage/stores/resources/getter-utils.d.ts +7 -0
- package/dist/runtime/storage/stores/resources/getter-utils.js +27 -0
- package/dist/runtime/storage/stores/resources/getters.d.ts +38 -0
- package/dist/runtime/storage/stores/resources/getters.js +251 -0
- package/dist/runtime/storage/stores/resources/resources-store.d.ts +19 -0
- package/dist/runtime/storage/stores/resources/resources-store.js +23 -0
- package/dist/runtime/storage/stores/resources/state.d.ts +64 -0
- package/dist/runtime/storage/stores/resources/state.js +24 -0
- package/dist/runtime/templates/assets/base.css +1 -0
- package/dist/runtime/templates/assets/cwa.css +1 -0
- package/dist/runtime/templates/components/core/ComponentPlaceholder.vue +18 -0
- package/dist/runtime/templates/components/core/ComponentPlaceholder.vue.d.ts +3 -0
- package/dist/runtime/templates/components/core/ComponentPosition.spec.ts.snap +16 -0
- package/dist/runtime/templates/components/core/ComponentPosition.vue +63 -0
- package/dist/runtime/templates/components/core/ComponentPosition.vue.d.ts +3 -0
- package/dist/runtime/templates/components/core/ConfirmDialog.vue +41 -0
- package/dist/runtime/templates/components/core/ConfirmDialog.vue.d.ts +9 -0
- package/dist/runtime/templates/components/core/DialogBox.vue +95 -0
- package/dist/runtime/templates/components/core/DialogBox.vue.d.ts +38 -0
- package/dist/runtime/templates/components/core/README.md +1 -0
- package/dist/runtime/templates/components/core/ResourceLoader.spec.ts.snap +39 -0
- package/dist/runtime/templates/components/core/ResourceLoader.vue +151 -0
- package/dist/runtime/templates/components/core/ResourceLoader.vue.d.ts +13 -0
- package/dist/runtime/templates/components/core/admin/ListContainer.vue +7 -0
- package/dist/runtime/templates/components/core/admin/ListContainer.vue.d.ts +12 -0
- package/dist/runtime/templates/components/core/admin/ListContent.vue +136 -0
- package/dist/runtime/templates/components/core/admin/ListContent.vue.d.ts +21 -0
- package/dist/runtime/templates/components/core/admin/ListFilter.vue +49 -0
- package/dist/runtime/templates/components/core/admin/ListFilter.vue.d.ts +9 -0
- package/dist/runtime/templates/components/core/admin/ListFilterButton.vue +53 -0
- package/dist/runtime/templates/components/core/admin/ListFilterButton.vue.d.ts +9 -0
- package/dist/runtime/templates/components/core/admin/ListHeading.vue +32 -0
- package/dist/runtime/templates/components/core/admin/ListHeading.vue.d.ts +20 -0
- package/dist/runtime/templates/components/core/admin/ListPagination.vue +87 -0
- package/dist/runtime/templates/components/core/admin/ListPagination.vue.d.ts +15 -0
- package/dist/runtime/templates/components/core/admin/ListPaginationButton.vue +18 -0
- package/dist/runtime/templates/components/core/admin/ListPaginationButton.vue.d.ts +16 -0
- package/dist/runtime/templates/components/core/admin/PageAdminModal.vue +260 -0
- package/dist/runtime/templates/components/core/admin/PageAdminModal.vue.d.ts +12 -0
- package/dist/runtime/templates/components/core/admin/PageDataAdminModal.vue +187 -0
- package/dist/runtime/templates/components/core/admin/PageDataAdminModal.vue.d.ts +13 -0
- package/dist/runtime/templates/components/core/admin/ResourceModal.vue +99 -0
- package/dist/runtime/templates/components/core/admin/ResourceModal.vue.d.ts +27 -0
- package/dist/runtime/templates/components/core/admin/ResourceModalOverlay.vue +27 -0
- package/dist/runtime/templates/components/core/admin/ResourceModalOverlay.vue.d.ts +6 -0
- package/dist/runtime/templates/components/core/admin/ResourceModalOverlayTemplate.vue +23 -0
- package/dist/runtime/templates/components/core/admin/ResourceModalOverlayTemplate.vue.d.ts +15 -0
- package/dist/runtime/templates/components/core/admin/ResourceModalTabs.vue +77 -0
- package/dist/runtime/templates/components/core/admin/ResourceModalTabs.vue.d.ts +19 -0
- package/dist/runtime/templates/components/core/admin/RouteListRow.vue +102 -0
- package/dist/runtime/templates/components/core/admin/RouteListRow.vue.d.ts +20 -0
- package/dist/runtime/templates/components/core/admin/RouteRedirectsTree.vue +52 -0
- package/dist/runtime/templates/components/core/admin/RouteRedirectsTree.vue.d.ts +10 -0
- package/dist/runtime/templates/components/core/admin/RoutesTab.vue +273 -0
- package/dist/runtime/templates/components/core/admin/RoutesTab.vue.d.ts +12 -0
- package/dist/runtime/templates/components/core/admin/form/FilterFormWrapper.vue +18 -0
- package/dist/runtime/templates/components/core/admin/form/FilterFormWrapper.vue.d.ts +16 -0
- package/dist/runtime/templates/components/core/admin/form/FilterSelect.vue +86 -0
- package/dist/runtime/templates/components/core/admin/form/FilterSelect.vue.d.ts +3 -0
- package/dist/runtime/templates/components/core/admin/form/ModalInfo.vue +23 -0
- package/dist/runtime/templates/components/core/admin/form/ModalInfo.vue.d.ts +16 -0
- package/dist/runtime/templates/components/core/admin/form/ModalInput.vue +30 -0
- package/dist/runtime/templates/components/core/admin/form/ModalInput.vue.d.ts +15 -0
- package/dist/runtime/templates/components/core/admin/form/ModalSelect.vue +99 -0
- package/dist/runtime/templates/components/core/admin/form/ModalSelect.vue.d.ts +6 -0
- package/dist/runtime/templates/components/core/admin/form/PageTypeSelect.vue +112 -0
- package/dist/runtime/templates/components/core/admin/form/PageTypeSelect.vue.d.ts +4 -0
- package/dist/runtime/templates/components/core/assets/CwaLogo.vue +21 -0
- package/dist/runtime/templates/components/core/assets/CwaLogo.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/assets/IconComponents.vue +15 -0
- package/dist/runtime/templates/components/core/assets/IconComponents.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/assets/IconData.vue +24 -0
- package/dist/runtime/templates/components/core/assets/IconData.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/assets/IconLayouts.vue +20 -0
- package/dist/runtime/templates/components/core/assets/IconLayouts.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/assets/IconPages.vue +21 -0
- package/dist/runtime/templates/components/core/assets/IconPages.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/assets/IconRoutes.vue +23 -0
- package/dist/runtime/templates/components/core/assets/IconRoutes.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/assets/IconUsers.vue +13 -0
- package/dist/runtime/templates/components/core/assets/IconUsers.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/useDataResolver.d.ts +12 -0
- package/dist/runtime/templates/components/core/useDataResolver.js +109 -0
- package/dist/runtime/templates/components/main/ComponentGroup.Util.Positions.d.ts +6 -0
- package/dist/runtime/templates/components/main/ComponentGroup.Util.Positions.js +164 -0
- package/dist/runtime/templates/components/main/ComponentGroup.Util.Synchronizer.d.ts +20 -0
- package/dist/runtime/templates/components/main/ComponentGroup.Util.Synchronizer.js +69 -0
- package/dist/runtime/templates/components/main/ComponentGroup.spec.ts.snap +59 -0
- package/dist/runtime/templates/components/main/ComponentGroup.vue +107 -0
- package/dist/runtime/templates/components/main/ComponentGroup.vue.d.ts +9 -0
- package/dist/runtime/templates/components/main/CwaLink.vue +51 -0
- package/dist/runtime/templates/components/main/CwaLink.vue.d.ts +14 -0
- package/dist/runtime/templates/components/main/DefaultLayout.vue +8 -0
- package/dist/runtime/templates/components/main/DefaultLayout.vue.d.ts +12 -0
- package/dist/runtime/templates/components/main/ErrorPage.vue +98 -0
- package/dist/runtime/templates/components/main/ErrorPage.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/Logo.vue +18 -0
- package/dist/runtime/templates/components/main/Logo.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/README.md +7 -0
- package/dist/runtime/templates/components/main/admin/_common/ResourceContextItem.vue +41 -0
- package/dist/runtime/templates/components/main/admin/_common/ResourceContextItem.vue.d.ts +7 -0
- package/dist/runtime/templates/components/main/admin/_common/ResourceLoadingIndicator.vue +48 -0
- package/dist/runtime/templates/components/main/admin/_common/ResourceLoadingIndicator.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/_common/useDynamicPositionSelectOptions.d.ts +5 -0
- package/dist/runtime/templates/components/main/admin/_common/useDynamicPositionSelectOptions.js +19 -0
- package/dist/runtime/templates/components/main/admin/header/Header.vue +207 -0
- package/dist/runtime/templates/components/main/admin/header/Header.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/Menu.vue +189 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/Menu.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/MenuLink.vue +14 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/MenuLink.vue.d.ts +16 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/MenuPrimaryLink.vue +19 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/MenuPrimaryLink.vue.d.ts +15 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/Notification.vue +69 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/Notification.vue.d.ts +12 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/OutdatedContentNotice.vue +19 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/OutdatedContentNotice.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/PathSelector.vue +79 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/PathSelector.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/RequestErrors.vue +52 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/RequestErrors.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/ComponentFocus.vue +151 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/ComponentFocus.vue.d.ts +10 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/LayoutPageOverlay.vue +192 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/LayoutPageOverlay.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/ResourceManager.vue +186 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/ResourceManager.vue.d.ts +9 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/AddComponentDialog.vue +205 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/AddComponentDialog.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/CwaResourceManagerContextMenu.vue +38 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/CwaResourceManagerContextMenu.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/ManagerTab.vue +15 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/ManagerTab.vue.d.ts +7 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/ManagerTabs.vue +44 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/ManagerTabs.vue.d.ts +13 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/ResourceInfoTab.vue +59 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/ResourceInfoTab.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Order.vue +75 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Order.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Publish.vue +41 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Publish.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Ui.vue +101 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Ui.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/group/Group.vue +34 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/group/Group.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/position/DataPage.vue +121 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/position/DataPage.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/position/DynamicPage.vue +52 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/position/DynamicPage.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/cta/CurrentResourceCta.vue +99 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/cta/CurrentResourceCta.vue.d.ts +7 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/cta/NewResourceCta.vue +59 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/cta/NewResourceCta.vue.d.ts +7 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/cta/ResourceManagerCtaButton.vue +28 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/cta/ResourceManagerCtaButton.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/auth/ForgotPasswordPage.vue +55 -0
- package/dist/runtime/templates/components/main/auth/ForgotPasswordPage.vue.d.ts +20 -0
- package/dist/runtime/templates/components/main/auth/LoginPage.vue +60 -0
- package/dist/runtime/templates/components/main/auth/LoginPage.vue.d.ts +23 -0
- package/dist/runtime/templates/components/main/auth/ResetPasswordPage.vue +59 -0
- package/dist/runtime/templates/components/main/auth/ResetPasswordPage.vue.d.ts +27 -0
- package/dist/runtime/templates/components/main/auth/_parts/AuthPageLink.spec.ts.snap +14 -0
- package/dist/runtime/templates/components/main/auth/_parts/AuthPageLink.vue +17 -0
- package/dist/runtime/templates/components/main/auth/_parts/AuthPageLink.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/auth/_parts/AuthTemplate.spec.ts.snap +90 -0
- package/dist/runtime/templates/components/main/auth/_parts/AuthTemplate.vue +45 -0
- package/dist/runtime/templates/components/main/auth/_parts/AuthTemplate.vue.d.ts +17 -0
- package/dist/runtime/templates/components/main/auth/_parts/InputField.spec.ts.snap +111 -0
- package/dist/runtime/templates/components/main/auth/_parts/InputField.vue +50 -0
- package/dist/runtime/templates/components/main/auth/_parts/InputField.vue.d.ts +17 -0
- package/dist/runtime/templates/components/ui/BackgroundParticles.vue +960 -0
- package/dist/runtime/templates/components/ui/BackgroundParticles.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/Hamburger.vue +75 -0
- package/dist/runtime/templates/components/ui/Hamburger.vue.d.ts +9 -0
- package/dist/runtime/templates/components/ui/ProgressBar.spec.ts.snap +71 -0
- package/dist/runtime/templates/components/ui/ProgressBar.vue +29 -0
- package/dist/runtime/templates/components/ui/ProgressBar.vue.d.ts +9 -0
- package/dist/runtime/templates/components/ui/README.md +6 -0
- package/dist/runtime/templates/components/ui/alert/Info.spec.ts.snap +23 -0
- package/dist/runtime/templates/components/ui/alert/Info.vue +13 -0
- package/dist/runtime/templates/components/ui/alert/Info.vue.d.ts +12 -0
- package/dist/runtime/templates/components/ui/alert/Warning.spec.ts.snap +14 -0
- package/dist/runtime/templates/components/ui/alert/Warning.vue +8 -0
- package/dist/runtime/templates/components/ui/alert/Warning.vue.d.ts +12 -0
- package/dist/runtime/templates/components/ui/form/Button.vue +139 -0
- package/dist/runtime/templates/components/ui/form/Button.vue.d.ts +52 -0
- package/dist/runtime/templates/components/ui/form/ButtonPopoverGroup.vue +18 -0
- package/dist/runtime/templates/components/ui/form/ButtonPopoverGroup.vue.d.ts +10 -0
- package/dist/runtime/templates/components/ui/form/ButtonPopoverItem.vue +15 -0
- package/dist/runtime/templates/components/ui/form/ButtonPopoverItem.vue.d.ts +10 -0
- package/dist/runtime/templates/components/ui/form/File.vue +72 -0
- package/dist/runtime/templates/components/ui/form/File.vue.d.ts +9 -0
- package/dist/runtime/templates/components/ui/form/Input.vue +22 -0
- package/dist/runtime/templates/components/ui/form/Input.vue.d.ts +5 -0
- package/dist/runtime/templates/components/ui/form/LabelWrapper.vue +16 -0
- package/dist/runtime/templates/components/ui/form/LabelWrapper.vue.d.ts +15 -0
- package/dist/runtime/templates/components/ui/form/SearchResource.vue +212 -0
- package/dist/runtime/templates/components/ui/form/SearchResource.vue.d.ts +14 -0
- package/dist/runtime/templates/components/ui/form/Select.vue +60 -0
- package/dist/runtime/templates/components/ui/form/Select.vue.d.ts +3 -0
- package/dist/runtime/templates/components/ui/form/Toggle.vue +39 -0
- package/dist/runtime/templates/components/ui/form/Toggle.vue.d.ts +6 -0
- package/dist/runtime/templates/components/ui/icon/ArrowIcon.vue +30 -0
- package/dist/runtime/templates/components/ui/icon/ArrowIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/BinIcon.vue +24 -0
- package/dist/runtime/templates/components/ui/icon/BinIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/CogIcon.vue +9 -0
- package/dist/runtime/templates/components/ui/icon/CogIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/EyeIcon.vue +24 -0
- package/dist/runtime/templates/components/ui/icon/EyeIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/PenIcon.vue +12 -0
- package/dist/runtime/templates/components/ui/icon/PenIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/PlusIcon.vue +9 -0
- package/dist/runtime/templates/components/ui/icon/PlusIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/SearchIcon.vue +10 -0
- package/dist/runtime/templates/components/ui/icon/SearchIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/TickIcon.vue +23 -0
- package/dist/runtime/templates/components/ui/icon/TickIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/WarningIcon.vue +11 -0
- package/dist/runtime/templates/components/ui/icon/WarningIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/XMarkIcon.vue +15 -0
- package/dist/runtime/templates/components/ui/icon/XMarkIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/utils/ContextMenu.vue +59 -0
- package/dist/runtime/templates/components/utils/ContextMenu.vue.d.ts +21 -0
- package/dist/runtime/templates/components/utils/HotSpot.vue +24 -0
- package/dist/runtime/templates/components/utils/HotSpot.vue.d.ts +9 -0
- package/dist/runtime/templates/components/utils/README.md +1 -0
- package/dist/runtime/templates/components/utils/Spinner.spec.ts.snap +56 -0
- package/dist/runtime/templates/components/utils/Spinner.vue +42 -0
- package/dist/runtime/templates/components/utils/Spinner.vue.d.ts +5 -0
- package/dist/runtime/templates/components/utils/SpinnerTick.vue +43 -0
- package/dist/runtime/templates/components/utils/SpinnerTick.vue.d.ts +6 -0
- package/dist/runtime/templates/cwa-page.spec.ts.snap +20 -0
- package/dist/runtime/templates/cwa-page.vue +32 -0
- package/dist/runtime/templates/cwa-page.vue.d.ts +2 -0
- package/dist/runtime/types/popper.d.ts +14 -0
- package/dist/types.d.mts +9 -0
- package/package.json +108 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CwaResourceTypes,
|
|
3
|
+
getResourceTypeFromIri,
|
|
4
|
+
resourceTypeToNestedResourceProperties
|
|
5
|
+
} from "../../resources/resource-utils.js";
|
|
6
|
+
import { FinishFetchManifestType } from "../../storage/stores/fetcher/actions.js";
|
|
7
|
+
import { createCwaResourceError } from "../../errors/cwa-resource-error.js";
|
|
8
|
+
import preloadHeaders from "./preload-headers.js";
|
|
9
|
+
export default class Fetcher {
|
|
10
|
+
cwaFetch;
|
|
11
|
+
fetchStatusManager;
|
|
12
|
+
currentRoute;
|
|
13
|
+
resourcesStoreDefinition;
|
|
14
|
+
constructor(cwaFetch, fetchStatusManager, currentRoute, resourcesStoreDefinition) {
|
|
15
|
+
this.cwaFetch = cwaFetch;
|
|
16
|
+
this.fetchStatusManager = fetchStatusManager;
|
|
17
|
+
this.currentRoute = currentRoute;
|
|
18
|
+
this.resourcesStoreDefinition = resourcesStoreDefinition;
|
|
19
|
+
}
|
|
20
|
+
async fetchRoute(route) {
|
|
21
|
+
if (route.meta.cwa?.disabled === true) {
|
|
22
|
+
this.fetchStatusManager.clearPrimaryFetch();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
let iri;
|
|
26
|
+
let manifestPath;
|
|
27
|
+
const routeParam = route.params.cwaPage0;
|
|
28
|
+
iri = Array.isArray(routeParam) ? "/" + routeParam.join("/") : routeParam;
|
|
29
|
+
const resourceType = iri ? getResourceTypeFromIri(iri) : void 0;
|
|
30
|
+
if (!resourceType || ![CwaResourceTypes.PAGE, CwaResourceTypes.PAGE_DATA].includes(resourceType)) {
|
|
31
|
+
iri = `/_/routes/${route.path}`;
|
|
32
|
+
manifestPath = `/_/routes_manifest/${route.path}`;
|
|
33
|
+
}
|
|
34
|
+
return await this.fetchResource({
|
|
35
|
+
path: iri,
|
|
36
|
+
isPrimary: true,
|
|
37
|
+
manifestPath
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async fetchResource({ path, token, manifestPath, preload, shallowFetch, noSave, isPrimary, iri: userProvidedIri }) {
|
|
41
|
+
const iri = userProvidedIri || path.split("?")[0];
|
|
42
|
+
const startFetchResult = this.fetchStatusManager.startFetch({
|
|
43
|
+
path,
|
|
44
|
+
token,
|
|
45
|
+
isPrimary,
|
|
46
|
+
manifestPath
|
|
47
|
+
});
|
|
48
|
+
if (!startFetchResult.continue) {
|
|
49
|
+
return this.fetchStatusManager.getFetchedCurrentResource(path);
|
|
50
|
+
}
|
|
51
|
+
if (manifestPath) {
|
|
52
|
+
this.fetchManifest({ token: startFetchResult.token, manifestPath }).then(() => {
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const continueToFetchResource = this.fetchStatusManager.startFetchResource({
|
|
56
|
+
resource: iri,
|
|
57
|
+
token: startFetchResult.token
|
|
58
|
+
});
|
|
59
|
+
if (!continueToFetchResource) {
|
|
60
|
+
return this.fetchStatusManager.getFetchedCurrentResource(path);
|
|
61
|
+
}
|
|
62
|
+
const finishFetchResourceEvent = {
|
|
63
|
+
resource: iri,
|
|
64
|
+
token: startFetchResult.token
|
|
65
|
+
};
|
|
66
|
+
let cwaFetchRaw;
|
|
67
|
+
let resource;
|
|
68
|
+
try {
|
|
69
|
+
cwaFetchRaw = this.fetch({
|
|
70
|
+
path,
|
|
71
|
+
preload
|
|
72
|
+
});
|
|
73
|
+
const fetchResponse = await cwaFetchRaw.response;
|
|
74
|
+
resource = this.fetchStatusManager.finishFetchResource({
|
|
75
|
+
...finishFetchResourceEvent,
|
|
76
|
+
success: true,
|
|
77
|
+
fetchResponse,
|
|
78
|
+
headers: cwaFetchRaw.headers,
|
|
79
|
+
noSave
|
|
80
|
+
});
|
|
81
|
+
} catch (error) {
|
|
82
|
+
this.fetchStatusManager.finishFetchResource({
|
|
83
|
+
...finishFetchResourceEvent,
|
|
84
|
+
success: false,
|
|
85
|
+
error: createCwaResourceError(error)
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const doRedirect = this.fetchStatusManager.primaryFetchPath === path && getResourceTypeFromIri(iri) === CwaResourceTypes.ROUTE && resource?.redirectPath;
|
|
89
|
+
if (doRedirect) {
|
|
90
|
+
this.fetchStatusManager.abortFetch(startFetchResult.token);
|
|
91
|
+
} else if (resource && shallowFetch !== true) {
|
|
92
|
+
await this.fetchNestedResources({ resource, token: startFetchResult.token, noSave: !!noSave, onlyIfNoExist: shallowFetch === "noexist" });
|
|
93
|
+
}
|
|
94
|
+
if (!token) {
|
|
95
|
+
await this.fetchStatusManager.finishFetch({
|
|
96
|
+
token: startFetchResult.token
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return resource;
|
|
100
|
+
}
|
|
101
|
+
async fetchManifest(event) {
|
|
102
|
+
let resources = [];
|
|
103
|
+
try {
|
|
104
|
+
const result = this.fetch({
|
|
105
|
+
path: event.manifestPath
|
|
106
|
+
});
|
|
107
|
+
const response = await result.response;
|
|
108
|
+
resources = response._data?.resource_iris || [];
|
|
109
|
+
if (resources.length && this.fetchStatusManager.isCurrentFetchingToken(event.token)) {
|
|
110
|
+
await this.fetchBatch({ paths: resources, token: event.token });
|
|
111
|
+
}
|
|
112
|
+
this.fetchStatusManager.finishManifestFetch({
|
|
113
|
+
type: FinishFetchManifestType.SUCCESS,
|
|
114
|
+
token: event.token,
|
|
115
|
+
resources
|
|
116
|
+
});
|
|
117
|
+
} catch (error) {
|
|
118
|
+
this.fetchStatusManager.finishManifestFetch({
|
|
119
|
+
type: FinishFetchManifestType.ERROR,
|
|
120
|
+
token: event.token,
|
|
121
|
+
error: createCwaResourceError(error)
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
fetchNestedResources({ resource, token, noSave, onlyIfNoExist }) {
|
|
126
|
+
const iri = resource["@id"];
|
|
127
|
+
const type = getResourceTypeFromIri(iri);
|
|
128
|
+
if (!type) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const nestedIris = [];
|
|
132
|
+
const nestedPropertiesToFetch = resourceTypeToNestedResourceProperties[type];
|
|
133
|
+
for (const prop of nestedPropertiesToFetch) {
|
|
134
|
+
let propIris = resource[prop];
|
|
135
|
+
if (!propIris) {
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (Array.isArray(propIris)) {
|
|
139
|
+
nestedIris.push(...propIris);
|
|
140
|
+
} else {
|
|
141
|
+
if (prop === "publishedResource") {
|
|
142
|
+
propIris += "?published=true";
|
|
143
|
+
}
|
|
144
|
+
nestedIris.push(propIris);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (onlyIfNoExist) {
|
|
148
|
+
nestedIris.filter((iri2) => !this.resourcesStore.current.currentIds.includes(iri2));
|
|
149
|
+
if (!nestedIris.length) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return this.fetchBatch({ paths: nestedIris, token, noSave });
|
|
154
|
+
}
|
|
155
|
+
fetchBatch({ paths, token, noSave, shallowFetch }) {
|
|
156
|
+
const promises = [];
|
|
157
|
+
for (const path of paths) {
|
|
158
|
+
const pathPromise = new Promise((resolve) => {
|
|
159
|
+
this.fetchResource({ path, token, noSave, shallowFetch }).then((resource) => {
|
|
160
|
+
resolve(resource);
|
|
161
|
+
}).catch(() => {
|
|
162
|
+
resolve(void 0);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
promises.push(pathPromise);
|
|
166
|
+
}
|
|
167
|
+
return Promise.all(promises);
|
|
168
|
+
}
|
|
169
|
+
fetch(event) {
|
|
170
|
+
const url = event.noQuery ? event.path : this.appendQueryToPath(event.path);
|
|
171
|
+
const headers = this.createRequestHeaders(event);
|
|
172
|
+
const response = this.cwaFetch.fetch.raw(url, {
|
|
173
|
+
headers
|
|
174
|
+
});
|
|
175
|
+
return {
|
|
176
|
+
response,
|
|
177
|
+
headers
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
appendQueryToPath(path) {
|
|
181
|
+
const queryObj = this.currentRoute.query;
|
|
182
|
+
if (!queryObj) {
|
|
183
|
+
return path;
|
|
184
|
+
}
|
|
185
|
+
const queryKeys = Object.keys(queryObj);
|
|
186
|
+
if (!queryKeys.length) {
|
|
187
|
+
return path;
|
|
188
|
+
}
|
|
189
|
+
const queryString = queryKeys.reduce((accumulator, key) => {
|
|
190
|
+
if (key.endsWith("[]") && Array.isArray(queryObj[key])) {
|
|
191
|
+
for (const arrValue of queryObj[key]) {
|
|
192
|
+
accumulator.push(key + "=" + arrValue);
|
|
193
|
+
}
|
|
194
|
+
} else {
|
|
195
|
+
accumulator.push(key + "=" + queryObj[key]);
|
|
196
|
+
}
|
|
197
|
+
return accumulator;
|
|
198
|
+
}, []).join("&");
|
|
199
|
+
const delimiter = path.includes("?") ? "&" : "?";
|
|
200
|
+
return `${path}${delimiter}${queryString}`;
|
|
201
|
+
}
|
|
202
|
+
createRequestHeaders(event) {
|
|
203
|
+
let preload = event.preload;
|
|
204
|
+
if (!preload) {
|
|
205
|
+
const resourceType = getResourceTypeFromIri(event.path);
|
|
206
|
+
if (resourceType) {
|
|
207
|
+
preload = preloadHeaders[resourceType];
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const requestHeaders = {};
|
|
211
|
+
if (this.fetchStatusManager.primaryFetchPath) {
|
|
212
|
+
requestHeaders.path = this.fetchStatusManager.primaryFetchPath.replace(/^\/_\/routes\//, "");
|
|
213
|
+
}
|
|
214
|
+
if (preload) {
|
|
215
|
+
requestHeaders.preload = preload.join(",");
|
|
216
|
+
}
|
|
217
|
+
return requestHeaders;
|
|
218
|
+
}
|
|
219
|
+
get resourcesStore() {
|
|
220
|
+
return this.resourcesStoreDefinition.useStore();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CwaResourceTypes } from "../../resources/resource-utils.js";
|
|
2
|
+
const preloadToNextComponent = "/componentGroups/*/componentPositions/*/component";
|
|
3
|
+
const preloadHeaders = {
|
|
4
|
+
[CwaResourceTypes.ROUTE]: [
|
|
5
|
+
`/page/layout${preloadToNextComponent}${preloadToNextComponent}`,
|
|
6
|
+
`/page${preloadToNextComponent}${preloadToNextComponent}`,
|
|
7
|
+
`/pageData/page/layout${preloadToNextComponent}${preloadToNextComponent}`,
|
|
8
|
+
`/pageData/page${preloadToNextComponent}${preloadToNextComponent}`
|
|
9
|
+
],
|
|
10
|
+
[CwaResourceTypes.PAGE]: [
|
|
11
|
+
`/layout${preloadToNextComponent}${preloadToNextComponent}`,
|
|
12
|
+
`${preloadToNextComponent}${preloadToNextComponent}`
|
|
13
|
+
],
|
|
14
|
+
[CwaResourceTypes.LAYOUT]: [
|
|
15
|
+
`${preloadToNextComponent}${preloadToNextComponent}`
|
|
16
|
+
],
|
|
17
|
+
[CwaResourceTypes.PAGE_DATA]: [
|
|
18
|
+
`/page/layout${preloadToNextComponent}${preloadToNextComponent}`,
|
|
19
|
+
`/page${preloadToNextComponent}${preloadToNextComponent}`
|
|
20
|
+
],
|
|
21
|
+
[CwaResourceTypes.COMPONENT_GROUP]: [
|
|
22
|
+
`/componentPositions/*/component${preloadToNextComponent}${preloadToNextComponent}`
|
|
23
|
+
],
|
|
24
|
+
[CwaResourceTypes.COMPONENT_POSITION]: [
|
|
25
|
+
`/component${preloadToNextComponent}${preloadToNextComponent}`
|
|
26
|
+
],
|
|
27
|
+
[CwaResourceTypes.COMPONENT]: [
|
|
28
|
+
preloadToNextComponent
|
|
29
|
+
]
|
|
30
|
+
};
|
|
31
|
+
export default preloadHeaders;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ComputedRef } from 'vue';
|
|
2
|
+
import type { ResourcesStore } from '../storage/stores/resources/resources-store.js';
|
|
3
|
+
interface ViewVars {
|
|
4
|
+
full_name: string;
|
|
5
|
+
name: string;
|
|
6
|
+
id: string;
|
|
7
|
+
unique_block_prefix: string;
|
|
8
|
+
valid: boolean;
|
|
9
|
+
submitted: boolean;
|
|
10
|
+
required: boolean;
|
|
11
|
+
value: any;
|
|
12
|
+
errors: string[];
|
|
13
|
+
action?: string;
|
|
14
|
+
block_prefixes: string[];
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
checked?: boolean;
|
|
17
|
+
multiple?: boolean;
|
|
18
|
+
attr: {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
21
|
+
label?: string;
|
|
22
|
+
label_attr: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
interface FormView {
|
|
28
|
+
vars: ViewVars;
|
|
29
|
+
}
|
|
30
|
+
interface KeyedFormView {
|
|
31
|
+
[key: string]: FormView;
|
|
32
|
+
}
|
|
33
|
+
export default class Forms {
|
|
34
|
+
private resourcesStoreDefinition;
|
|
35
|
+
constructor(resourcesStoreDefinition: ResourcesStore);
|
|
36
|
+
getForm(iri: string): ComputedRef<KeyedFormView | undefined>;
|
|
37
|
+
getFormViewErrors(formIri: string, field: string): ComputedRef<string[] | undefined>;
|
|
38
|
+
private get resourcesStore();
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
export default class Forms {
|
|
3
|
+
resourcesStoreDefinition;
|
|
4
|
+
constructor(resourcesStoreDefinition) {
|
|
5
|
+
this.resourcesStoreDefinition = resourcesStoreDefinition;
|
|
6
|
+
}
|
|
7
|
+
getForm(iri) {
|
|
8
|
+
return computed(() => {
|
|
9
|
+
const resource = this.resourcesStore.current.byId[iri];
|
|
10
|
+
if (resource?.data?.["@type"] !== "Form") {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const createFormViewObject = (apiFormView) => {
|
|
14
|
+
const structuredFormView = {
|
|
15
|
+
vars: Object.assign({}, apiFormView.vars)
|
|
16
|
+
};
|
|
17
|
+
let data = {
|
|
18
|
+
[apiFormView.vars.full_name]: structuredFormView
|
|
19
|
+
};
|
|
20
|
+
if (apiFormView.children) {
|
|
21
|
+
for (const child of apiFormView.children) {
|
|
22
|
+
data = { ...data, ...createFormViewObject(child) };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
return createFormViewObject(resource.data.formView);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
getFormViewErrors(formIri, field) {
|
|
31
|
+
return computed(() => {
|
|
32
|
+
const form = this.getForm(formIri);
|
|
33
|
+
const errors = form.value?.[field].vars.errors;
|
|
34
|
+
return errors && errors.length ? errors : void 0;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
get resourcesStore() {
|
|
38
|
+
return this.resourcesStoreDefinition.useStore();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ComputedRef } from 'vue';
|
|
2
|
+
import type { MercureStore } from '../storage/stores/mercure/mercure-store.js';
|
|
3
|
+
import type { ResourcesStore } from '../storage/stores/resources/resources-store.js';
|
|
4
|
+
import type { FetcherStore } from '../storage/stores/fetcher/fetcher-store.js';
|
|
5
|
+
import type Fetcher from './fetcher/fetcher.js';
|
|
6
|
+
export default class Mercure {
|
|
7
|
+
private mercureStoreDefinition;
|
|
8
|
+
private resourcesStoreDefinition;
|
|
9
|
+
private fetcherStoreDefinition;
|
|
10
|
+
private eventSource?;
|
|
11
|
+
private lastEventId?;
|
|
12
|
+
private mercureMessageQueue;
|
|
13
|
+
private fetcher?;
|
|
14
|
+
private requestCount?;
|
|
15
|
+
private resourcesManager?;
|
|
16
|
+
constructor(mercureStoreDefinition: MercureStore, resourcesStoreDefinition: ResourcesStore, fetcherStoreDefinition: FetcherStore);
|
|
17
|
+
setFetcher(fetcher: Fetcher): void;
|
|
18
|
+
setRequestCount(requestCount: ComputedRef<number>): void;
|
|
19
|
+
setMercureHubFromLinkHeader(linkHeader: string): void;
|
|
20
|
+
init(forceRestart?: boolean): void;
|
|
21
|
+
closeMercure(): void;
|
|
22
|
+
private get requestsInProgress();
|
|
23
|
+
private handleMercureMessage;
|
|
24
|
+
private isMessageForCurrentResource;
|
|
25
|
+
private addMercureMessageToQueue;
|
|
26
|
+
private processMessageQueue;
|
|
27
|
+
private collectResourceActions;
|
|
28
|
+
private fetch;
|
|
29
|
+
private get hubUrl();
|
|
30
|
+
private get hub();
|
|
31
|
+
private get mercureStore();
|
|
32
|
+
private get resourcesStore();
|
|
33
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { consola as logger } from "consola";
|
|
2
|
+
import { storeToRefs } from "pinia";
|
|
3
|
+
import { computed, watch } from "vue";
|
|
4
|
+
import { getPublishedResourceIri } from "../resources/resource-utils.js";
|
|
5
|
+
import { useProcess } from "#cwa/runtime/composables/process";
|
|
6
|
+
export default class Mercure {
|
|
7
|
+
constructor(mercureStoreDefinition, resourcesStoreDefinition, fetcherStoreDefinition) {
|
|
8
|
+
this.mercureStoreDefinition = mercureStoreDefinition;
|
|
9
|
+
this.resourcesStoreDefinition = resourcesStoreDefinition;
|
|
10
|
+
this.fetcherStoreDefinition = fetcherStoreDefinition;
|
|
11
|
+
}
|
|
12
|
+
eventSource;
|
|
13
|
+
lastEventId;
|
|
14
|
+
mercureMessageQueue = [];
|
|
15
|
+
fetcher;
|
|
16
|
+
requestCount;
|
|
17
|
+
resourcesManager;
|
|
18
|
+
setFetcher(fetcher) {
|
|
19
|
+
this.fetcher = fetcher;
|
|
20
|
+
}
|
|
21
|
+
setRequestCount(requestCount) {
|
|
22
|
+
this.requestCount = requestCount;
|
|
23
|
+
}
|
|
24
|
+
setMercureHubFromLinkHeader(linkHeader) {
|
|
25
|
+
if (this.hub) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const matches = linkHeader.match(/<([^>]+)>;\s+rel="mercure".*/);
|
|
29
|
+
if (!matches?.[1]) {
|
|
30
|
+
logger.error("No Mercure rel in link header.");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const { hub } = storeToRefs(this.mercureStore);
|
|
34
|
+
hub.value = matches[1];
|
|
35
|
+
logger.debug("Mercure hub set", this.hub);
|
|
36
|
+
}
|
|
37
|
+
init(forceRestart) {
|
|
38
|
+
const { isServer } = useProcess();
|
|
39
|
+
if (isServer) {
|
|
40
|
+
logger.debug("Mercure can only initialise on the client side");
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (!this.hubUrl) {
|
|
44
|
+
logger.warn("Cannot initialize Mercure. Hub URL is not set.");
|
|
45
|
+
this.closeMercure();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (!forceRestart && this.eventSource && this.eventSource.readyState === 1 && this.eventSource.url === this.hubUrl) {
|
|
49
|
+
logger.debug(`Mercure already initialized '${this.hubUrl}'`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
this.closeMercure();
|
|
53
|
+
logger.info(`Initializing Mercure '${this.hubUrl}'`);
|
|
54
|
+
this.eventSource = new EventSource(this.hubUrl, { withCredentials: true });
|
|
55
|
+
this.eventSource.onmessage = (event) => this.handleMercureMessage(event);
|
|
56
|
+
}
|
|
57
|
+
closeMercure() {
|
|
58
|
+
if (this.eventSource) {
|
|
59
|
+
this.eventSource.close();
|
|
60
|
+
logger.info("Mercure Event Source Closed");
|
|
61
|
+
} else {
|
|
62
|
+
logger.warn("No Mercure Event Source exists to close");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
get requestsInProgress() {
|
|
66
|
+
const { currentResourcesApiStateIsPending } = storeToRefs(this.resourcesStore);
|
|
67
|
+
return computed(() => {
|
|
68
|
+
return this.requestCount && this.requestCount?.value > 0 || currentResourcesApiStateIsPending.value;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
handleMercureMessage(event) {
|
|
72
|
+
const mercureMessage = {
|
|
73
|
+
event,
|
|
74
|
+
data: JSON.parse(event.data)
|
|
75
|
+
};
|
|
76
|
+
if (!this.isMessageForCurrentResource(mercureMessage)) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.addMercureMessageToQueue(mercureMessage);
|
|
80
|
+
if (!this.requestsInProgress.value) {
|
|
81
|
+
this.processMessageQueue();
|
|
82
|
+
} else {
|
|
83
|
+
const unwatch = watch(this.requestsInProgress, (inProgress) => {
|
|
84
|
+
if (!inProgress) {
|
|
85
|
+
this.processMessageQueue();
|
|
86
|
+
unwatch();
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
isMessageForCurrentResource(mercureMessage) {
|
|
92
|
+
const currentResources = this.resourcesStore.current.currentIds;
|
|
93
|
+
const mercureMessageResource = mercureMessage.data;
|
|
94
|
+
if (!currentResources.includes(mercureMessageResource["@id"])) {
|
|
95
|
+
const publishedIri = getPublishedResourceIri(mercureMessageResource);
|
|
96
|
+
if (!publishedIri || !currentResources.includes(publishedIri)) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
addMercureMessageToQueue(mercureMessage) {
|
|
103
|
+
this.mercureMessageQueue = [
|
|
104
|
+
...this.mercureMessageQueue.filter((existingMessage) => {
|
|
105
|
+
return existingMessage.data["@id"] !== mercureMessage.data["@id"];
|
|
106
|
+
}),
|
|
107
|
+
mercureMessage
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
async processMessageQueue() {
|
|
111
|
+
const messages = this.mercureMessageQueue;
|
|
112
|
+
this.mercureMessageQueue = [];
|
|
113
|
+
const path = this.fetcherStoreDefinition.useStore().primaryFetchPath;
|
|
114
|
+
const resourceActions = this.collectResourceActions(messages);
|
|
115
|
+
const fetchedResources = await this.fetch(resourceActions.toFetch);
|
|
116
|
+
const toSave = [...resourceActions.toSave, ...fetchedResources];
|
|
117
|
+
for (const resource of toSave) {
|
|
118
|
+
this.resourcesStore.saveResource({
|
|
119
|
+
resource,
|
|
120
|
+
path,
|
|
121
|
+
isNew: true
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
collectResourceActions(messages) {
|
|
126
|
+
const toSave = [];
|
|
127
|
+
const toFetch = [];
|
|
128
|
+
for (const message of messages) {
|
|
129
|
+
this.lastEventId = message.event.lastEventId;
|
|
130
|
+
if (!this.isMessageForCurrentResource(message)) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const isDelete = Object.keys(message.data).length === 1 && message.data["@id"];
|
|
134
|
+
if (!isDelete && message.data["@type"] === "ComponentPosition") {
|
|
135
|
+
toFetch.push(message.data["@id"]);
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
toSave.push(message.data);
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
toSave,
|
|
142
|
+
toFetch
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
async fetch(paths) {
|
|
146
|
+
const resources = [];
|
|
147
|
+
if (paths.length) {
|
|
148
|
+
if (!this.fetcher) {
|
|
149
|
+
throw new Error("Mercure cannot fetch resources. Fetcher is not set.");
|
|
150
|
+
}
|
|
151
|
+
const fetchPromises = [];
|
|
152
|
+
for (const path of paths) {
|
|
153
|
+
const fetchPromise = this.fetcher.fetchResource({
|
|
154
|
+
path,
|
|
155
|
+
noSave: true,
|
|
156
|
+
shallowFetch: true
|
|
157
|
+
});
|
|
158
|
+
fetchPromises.push(fetchPromise);
|
|
159
|
+
}
|
|
160
|
+
await Promise.all(fetchPromises).then((responses) => {
|
|
161
|
+
for (const resource of responses) {
|
|
162
|
+
if (!resource) {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
resources.push(resource);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return resources;
|
|
170
|
+
}
|
|
171
|
+
get hubUrl() {
|
|
172
|
+
if (!this.hub) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const hub = new URL(this.hub);
|
|
176
|
+
hub.searchParams.append("topic", "*");
|
|
177
|
+
if (this.lastEventId) {
|
|
178
|
+
hub.searchParams.append("Last-Event-ID", this.lastEventId);
|
|
179
|
+
}
|
|
180
|
+
return hub.toString();
|
|
181
|
+
}
|
|
182
|
+
get hub() {
|
|
183
|
+
return this.mercureStore.hub;
|
|
184
|
+
}
|
|
185
|
+
get mercureStore() {
|
|
186
|
+
return this.mercureStoreDefinition.useStore();
|
|
187
|
+
}
|
|
188
|
+
get resourcesStore() {
|
|
189
|
+
return this.resourcesStoreDefinition.useStore();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createApp, onBeforeUnmount, onMounted, resolveComponent, watch } from "vue";
|
|
2
|
+
import { hasProtocol } from "ufo";
|
|
3
|
+
import { defineNuxtLink } from "#app";
|
|
4
|
+
import { useCwa } from "#cwa/runtime/composables/cwa";
|
|
5
|
+
export const useHtmlContent = (container) => {
|
|
6
|
+
let watchStopHandle;
|
|
7
|
+
const $cwa = useCwa();
|
|
8
|
+
const isExternal = (props) => {
|
|
9
|
+
if (props.external) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
if (props.target && props.target !== "_self") {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
return props.to === "" || hasProtocol(props.to, { acceptRelative: true });
|
|
16
|
+
};
|
|
17
|
+
const linkClickHandler = (e, props) => {
|
|
18
|
+
$cwa.navigationDisabled && isExternal(props) && e.preventDefault();
|
|
19
|
+
};
|
|
20
|
+
function convertAnchor(anchor) {
|
|
21
|
+
const href = anchor.getAttribute("href");
|
|
22
|
+
if (!href) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
function hrefToUrl(href2) {
|
|
26
|
+
try {
|
|
27
|
+
new URL(href2);
|
|
28
|
+
return href2;
|
|
29
|
+
} catch (err) {
|
|
30
|
+
return `//${href2}`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const props = {
|
|
34
|
+
to: hrefToUrl(href),
|
|
35
|
+
innerHTML: anchor.innerHTML
|
|
36
|
+
};
|
|
37
|
+
for (const attr of anchor.attributes) {
|
|
38
|
+
if (!["href"].includes(attr.name)) {
|
|
39
|
+
const anchorAttr = anchor.getAttribute(attr.name);
|
|
40
|
+
if (anchorAttr) {
|
|
41
|
+
props[attr.name] = anchorAttr;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const rlComponent = resolveComponent("RouterLink");
|
|
46
|
+
if (typeof rlComponent === "string") {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const nlComponent = defineNuxtLink({});
|
|
50
|
+
const app = createApp(nlComponent, {
|
|
51
|
+
...props,
|
|
52
|
+
onClick: (e) => linkClickHandler(e, props)
|
|
53
|
+
});
|
|
54
|
+
app.component("RouterLink", rlComponent);
|
|
55
|
+
return app;
|
|
56
|
+
}
|
|
57
|
+
function replaceAnchors() {
|
|
58
|
+
if (!container.value) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const anchors = container.value.getElementsByTagName("a");
|
|
62
|
+
Array.from(anchors).forEach((anchor) => {
|
|
63
|
+
const nuxtLink = convertAnchor(anchor);
|
|
64
|
+
if (nuxtLink) {
|
|
65
|
+
const parent = anchor.parentNode;
|
|
66
|
+
if (parent) {
|
|
67
|
+
const linkContainer = document.createElement("span");
|
|
68
|
+
parent.replaceChild(linkContainer, anchor);
|
|
69
|
+
nuxtLink.mount(linkContainer);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
onMounted(() => {
|
|
75
|
+
watchStopHandle = watch(container, replaceAnchors, {
|
|
76
|
+
immediate: true
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
onBeforeUnmount(() => {
|
|
80
|
+
watchStopHandle && watchStopHandle();
|
|
81
|
+
});
|
|
82
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type CwaPaginationProps = {
|
|
2
|
+
currentPage: number;
|
|
3
|
+
totalPages: number;
|
|
4
|
+
maxPagesToDisplay: number;
|
|
5
|
+
};
|
|
6
|
+
export type CwaPaginationEmits = {
|
|
7
|
+
next: [];
|
|
8
|
+
previous: [];
|
|
9
|
+
change: [value: number];
|
|
10
|
+
};
|
|
11
|
+
export declare const useCwaCollectionPagination: (props: CwaPaginationProps) => {
|
|
12
|
+
pages: import("vue").ComputedRef<number[]>;
|
|
13
|
+
};
|