@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
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { readFileSync, statSync } from 'node:fs';
|
|
4
|
+
import { defu } from 'defu';
|
|
5
|
+
import { mergeWith, isArray } from 'lodash-es';
|
|
6
|
+
import { defineNuxtModule, useLogger, createResolver, installModule, addImportsDir, extendPages, addTemplate, addTypeTemplate, addPlugin, updateTemplates, resolveAlias } from '@nuxt/kit';
|
|
7
|
+
|
|
8
|
+
function createDefaultCwaPages(pages, pageComponentFilePath, maxDepth, layout) {
|
|
9
|
+
function create(currentDepth = 0) {
|
|
10
|
+
const page = {
|
|
11
|
+
name: `cwaPage${currentDepth}`,
|
|
12
|
+
path: `:cwaPage${currentDepth}*`,
|
|
13
|
+
file: pageComponentFilePath,
|
|
14
|
+
meta: {
|
|
15
|
+
cwa: {
|
|
16
|
+
disabled: false
|
|
17
|
+
},
|
|
18
|
+
layout: layout || "cwa-root-layout"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
if (currentDepth === 0) {
|
|
22
|
+
page.path = "/:cwaPage0*";
|
|
23
|
+
}
|
|
24
|
+
if (currentDepth < maxDepth) {
|
|
25
|
+
const child = create(++currentDepth);
|
|
26
|
+
page.children = [child];
|
|
27
|
+
}
|
|
28
|
+
return page;
|
|
29
|
+
}
|
|
30
|
+
const pagesTree = create();
|
|
31
|
+
pages.push(pagesTree);
|
|
32
|
+
}
|
|
33
|
+
const NAME = "@cwa/nuxt";
|
|
34
|
+
const module = defineNuxtModule({
|
|
35
|
+
meta: {
|
|
36
|
+
name: NAME,
|
|
37
|
+
configKey: "cwa",
|
|
38
|
+
compatibility: {
|
|
39
|
+
nuxt: "^3.6.5",
|
|
40
|
+
bridge: false
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
defaults: {
|
|
44
|
+
appName: "CWA Web App",
|
|
45
|
+
storeName: "cwa",
|
|
46
|
+
resources: {
|
|
47
|
+
ComponentPosition: {
|
|
48
|
+
name: "Position",
|
|
49
|
+
description: "<p>Dynamic components can be used on dynamic pages to specify what component should be displayed from a data page in any given location.</p><p>You must select the reference from the data page to load into this position below.</p>",
|
|
50
|
+
instantAdd: true
|
|
51
|
+
},
|
|
52
|
+
ComponentGroup: {
|
|
53
|
+
name: "Group"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
async setup(options, nuxt) {
|
|
58
|
+
const logger = useLogger(NAME);
|
|
59
|
+
const { resolve } = createResolver(import.meta.url);
|
|
60
|
+
const { version, name } = JSON.parse(
|
|
61
|
+
readFileSync(resolve("../package.json"), "utf8")
|
|
62
|
+
);
|
|
63
|
+
logger.info(`Adding ${NAME} module (${name}@${version})...`);
|
|
64
|
+
logger.info(`Installing @pinia/nuxt for ${NAME} module...`);
|
|
65
|
+
await installModule("@pinia/nuxt");
|
|
66
|
+
logger.info(`Modifying Nuxt configuration options for ${NAME} module...`);
|
|
67
|
+
nuxt.options.runtimeConfig.public.cwa = defu(nuxt.options.runtimeConfig.public.cwa, {
|
|
68
|
+
apiUrl: options.apiUrl || options.apiUrlBrowser || "",
|
|
69
|
+
apiUrlBrowser: options.apiUrlBrowser || options.apiUrl || ""
|
|
70
|
+
});
|
|
71
|
+
nuxt.options.alias["#cwa"] = resolve("./");
|
|
72
|
+
nuxt.options.routeRules = Object.assign({
|
|
73
|
+
"/_/**": { ssr: false }
|
|
74
|
+
}, nuxt.options.routeRules || {});
|
|
75
|
+
const runtimeDir = resolve("./runtime");
|
|
76
|
+
nuxt.options.build.transpile.push(runtimeDir);
|
|
77
|
+
logger.info(`Configuring auto-imports for CWA composables...`);
|
|
78
|
+
addImportsDir(resolve("./runtime/composables"));
|
|
79
|
+
addImportsDir(resolve("./runtime/composables/component"));
|
|
80
|
+
logger.info(`Configuring CWA default pages and components...`);
|
|
81
|
+
const vueTemplatesDir = resolve("./runtime/templates");
|
|
82
|
+
extendPages((pages) => {
|
|
83
|
+
const pageComponent = resolve(vueTemplatesDir, "cwa-page.vue");
|
|
84
|
+
createDefaultCwaPages(pages, pageComponent, options.pagesDepth || 3, options.layoutName);
|
|
85
|
+
});
|
|
86
|
+
const cwaVueComponentsDir = join(vueTemplatesDir, "components");
|
|
87
|
+
logger.info(`Registering user components for CWA...`);
|
|
88
|
+
const userComponentsPath = join(nuxt.options.srcDir, "cwa", "components");
|
|
89
|
+
nuxt.options.alias["#cwaComponents"] = userComponentsPath;
|
|
90
|
+
function extendCwaOptions(components) {
|
|
91
|
+
const defaultResourcesConfig = {};
|
|
92
|
+
const regex = /^(?!.+\/(admin|ui)\/).+.vue$/;
|
|
93
|
+
const allUserComponents = components.filter(({ filePath }) => filePath.startsWith(userComponentsPath));
|
|
94
|
+
const componentsByPath = allUserComponents.reduce((obj, value) => ({ ...obj, [value.filePath]: value }), {});
|
|
95
|
+
const userComponents = allUserComponents.filter(({ filePath }) => regex.test(filePath));
|
|
96
|
+
for (const component of userComponents) {
|
|
97
|
+
const isDirectory = (p) => {
|
|
98
|
+
try {
|
|
99
|
+
return statSync(p).isDirectory();
|
|
100
|
+
} catch (_e) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const resolveComponentNames = (dirPath) => {
|
|
105
|
+
const componentNames = [];
|
|
106
|
+
if (isDirectory(dirPath)) {
|
|
107
|
+
const componentFilePaths = Object.keys(componentsByPath).filter((path2) => path2.startsWith(dirPath));
|
|
108
|
+
componentFilePaths.forEach((filePath) => {
|
|
109
|
+
if (componentsByPath[filePath]) {
|
|
110
|
+
componentsByPath[filePath].global && componentNames.push(componentsByPath[filePath].pascalName);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return componentNames;
|
|
115
|
+
};
|
|
116
|
+
const tabsDir = resolveAlias(resolve(path.dirname(component.filePath), "admin"));
|
|
117
|
+
const managerTabs = resolveComponentNames(tabsDir);
|
|
118
|
+
const uiDir = resolveAlias(resolve(path.dirname(component.filePath), "ui"));
|
|
119
|
+
const ui = resolveComponentNames(uiDir);
|
|
120
|
+
const resourceType = component.pascalName.replace(/^CwaComponent/, "");
|
|
121
|
+
defaultResourcesConfig[resourceType] = {
|
|
122
|
+
// auto name with spaces in place of pascal/camel case
|
|
123
|
+
name: resourceType.replace(/(?!^)([A-Z])/g, " $1"),
|
|
124
|
+
managerTabs,
|
|
125
|
+
ui
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const resources = mergeWith({}, defaultResourcesConfig, options.resources, (a, b) => {
|
|
129
|
+
if (isArray(a)) {
|
|
130
|
+
return b.concat(a);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
return { ...options, resources };
|
|
134
|
+
}
|
|
135
|
+
nuxt.hook("modules:done", () => {
|
|
136
|
+
logger.info(`Configuring template to propagate module options and adding plugin for ${NAME} module...`);
|
|
137
|
+
delete options.pagesDepth;
|
|
138
|
+
addTemplate({
|
|
139
|
+
filename: "cwa-options.ts",
|
|
140
|
+
getContents: ({ app }) => {
|
|
141
|
+
return `import type { CwaModuleOptions } from '#cwa/module';
|
|
142
|
+
export const options:CwaModuleOptions = ${JSON.stringify(extendCwaOptions(app.components), void 0, 2)}
|
|
143
|
+
export const currentModulePackageInfo:{ version: string, name: string } = ${JSON.stringify({ version, name }, void 0, 2)}
|
|
144
|
+
`;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
addTypeTemplate({
|
|
148
|
+
filename: "types/cwa.d.ts",
|
|
149
|
+
write: true,
|
|
150
|
+
getContents: () => (
|
|
151
|
+
/* ts */
|
|
152
|
+
`interface CwaRouteMeta {
|
|
153
|
+
admin?: boolean
|
|
154
|
+
disabled?: boolean
|
|
155
|
+
staticLayout?: GlobalComponentNames
|
|
156
|
+
}
|
|
157
|
+
export * from 'vue-router'
|
|
158
|
+
declare module 'vue-router' {
|
|
159
|
+
interface RouteMeta {
|
|
160
|
+
cwa?: CwaRouteMeta
|
|
161
|
+
}
|
|
162
|
+
}`
|
|
163
|
+
)
|
|
164
|
+
});
|
|
165
|
+
addPlugin({
|
|
166
|
+
src: resolve("./runtime/plugin")
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
nuxt.hook("components:dirs", (dirs) => {
|
|
170
|
+
logger.info(`Configuring component directories for ${NAME} module...`);
|
|
171
|
+
dirs.unshift({
|
|
172
|
+
path: join(cwaVueComponentsDir, "main"),
|
|
173
|
+
prefix: "Cwa",
|
|
174
|
+
ignore: ["**/_*/*", "**/*.spec.{cts,mts,ts}"]
|
|
175
|
+
});
|
|
176
|
+
dirs.unshift({
|
|
177
|
+
path: join(cwaVueComponentsDir, "ui"),
|
|
178
|
+
prefix: "CwaUi",
|
|
179
|
+
ignore: ["**/*.spec.{cts,mts,ts}"]
|
|
180
|
+
});
|
|
181
|
+
dirs.unshift({
|
|
182
|
+
path: join(nuxt.options.srcDir, "cwa", "layouts"),
|
|
183
|
+
prefix: "CwaLayout",
|
|
184
|
+
global: true,
|
|
185
|
+
ignore: ["**/*.spec.{cts,mts,ts}"]
|
|
186
|
+
});
|
|
187
|
+
dirs.unshift({
|
|
188
|
+
path: join(nuxt.options.srcDir, "cwa", "pages"),
|
|
189
|
+
prefix: "CwaPage",
|
|
190
|
+
global: true,
|
|
191
|
+
ignore: ["**/*.spec.{cts,mts,ts}"]
|
|
192
|
+
});
|
|
193
|
+
dirs.unshift({
|
|
194
|
+
path: userComponentsPath,
|
|
195
|
+
prefix: "CwaComponent",
|
|
196
|
+
global: true,
|
|
197
|
+
ignore: ["**/*.spec.{cts,mts,ts}"]
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
nuxt.hook("builder:watch", async (event, relativePath) => {
|
|
201
|
+
if (!["add", "unlink"].includes(event)) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
logger.info(`File added or removed - updating options for ${NAME} module...`);
|
|
205
|
+
const path2 = resolve(nuxt.options.srcDir, relativePath);
|
|
206
|
+
const cwaDirs = [userComponentsPath];
|
|
207
|
+
if (cwaDirs.some((dir) => dir === path2 || path2.startsWith(dir + "/"))) {
|
|
208
|
+
await updateTemplates({
|
|
209
|
+
filter: (template) => [
|
|
210
|
+
"cwa-options.ts"
|
|
211
|
+
].includes(template.filename)
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
nuxt.hook("vite:extendConfig", (config) => {
|
|
216
|
+
logger.info(`Extending Vite optimizeDeps config for ${NAME} module dependencies...`);
|
|
217
|
+
config.optimizeDeps = config.optimizeDeps || {};
|
|
218
|
+
config.optimizeDeps.include = config.optimizeDeps.include || [];
|
|
219
|
+
config.optimizeDeps.exclude = config.optimizeDeps.exclude || [];
|
|
220
|
+
const optimizeDepPackages = ["slugify", "dayjs"];
|
|
221
|
+
for (const opPkg of optimizeDepPackages) {
|
|
222
|
+
const pkgIndex = config.optimizeDeps.exclude.indexOf(opPkg);
|
|
223
|
+
if (pkgIndex > -1) {
|
|
224
|
+
config.optimizeDeps.exclude.splice(pkgIndex, 1);
|
|
225
|
+
}
|
|
226
|
+
if (!config.optimizeDeps.include.includes(opPkg)) {
|
|
227
|
+
config.optimizeDeps.include.push(opPkg);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
logger.success(`Added ${NAME} module successfully.`);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
export { NAME, module as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type Emitter } from 'mitt';
|
|
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 { Resources } from '../resources/resources.js';
|
|
5
|
+
import ResourceStackManager from './resource-stack-manager.js';
|
|
6
|
+
export type ReorderEvent = {
|
|
7
|
+
positionIri: string;
|
|
8
|
+
location: 'previous' | 'next' | number;
|
|
9
|
+
};
|
|
10
|
+
type Events = {
|
|
11
|
+
redrawFocus: undefined;
|
|
12
|
+
manageableComponentMounted: string;
|
|
13
|
+
componentMounted: string;
|
|
14
|
+
selectResource: string;
|
|
15
|
+
reorder: ReorderEvent;
|
|
16
|
+
};
|
|
17
|
+
export default class Admin {
|
|
18
|
+
private readonly adminStoreDefinition;
|
|
19
|
+
private readonly resourcesStoreDefinition;
|
|
20
|
+
private readonly stackManagerInstance;
|
|
21
|
+
private readonly emitter;
|
|
22
|
+
private throttledRedrawEmitFn;
|
|
23
|
+
constructor(adminStoreDefinition: AdminStore, resourcesStoreDefinition: ResourcesStore, resources: Resources);
|
|
24
|
+
get eventBus(): Emitter<Events>;
|
|
25
|
+
get resourceStackManager(): ResourceStackManager;
|
|
26
|
+
emptyStack(): void;
|
|
27
|
+
toggleEdit(editing?: boolean): void;
|
|
28
|
+
setNavigationGuardDisabled(disabled: boolean): void;
|
|
29
|
+
get navigationGuardDisabled(): boolean;
|
|
30
|
+
get isEditing(): boolean;
|
|
31
|
+
private get adminStore();
|
|
32
|
+
private redrawListen;
|
|
33
|
+
emitRedraw(): void;
|
|
34
|
+
private doEmitRedraw;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import mitt from "mitt";
|
|
2
|
+
import { watch } from "vue";
|
|
3
|
+
import { throttle } from "lodash-es";
|
|
4
|
+
import ResourceStackManager from "./resource-stack-manager.js";
|
|
5
|
+
export default class Admin {
|
|
6
|
+
constructor(adminStoreDefinition, resourcesStoreDefinition, resources) {
|
|
7
|
+
this.adminStoreDefinition = adminStoreDefinition;
|
|
8
|
+
this.resourcesStoreDefinition = resourcesStoreDefinition;
|
|
9
|
+
this.emitter = mitt();
|
|
10
|
+
this.stackManagerInstance = new ResourceStackManager(this.adminStoreDefinition, this.resourcesStoreDefinition, resources);
|
|
11
|
+
this.emitRedraw = this.emitRedraw.bind(this);
|
|
12
|
+
this.redrawListen();
|
|
13
|
+
}
|
|
14
|
+
stackManagerInstance;
|
|
15
|
+
emitter;
|
|
16
|
+
throttledRedrawEmitFn;
|
|
17
|
+
get eventBus() {
|
|
18
|
+
return this.emitter;
|
|
19
|
+
}
|
|
20
|
+
get resourceStackManager() {
|
|
21
|
+
return this.stackManagerInstance;
|
|
22
|
+
}
|
|
23
|
+
emptyStack() {
|
|
24
|
+
this.resourceStackManager.completeStack({ clickTarget: window }, false);
|
|
25
|
+
this.resourceStackManager.showManager.value = false;
|
|
26
|
+
}
|
|
27
|
+
toggleEdit(editing) {
|
|
28
|
+
if (editing === false || editing === void 0 && this.isEditing) {
|
|
29
|
+
this.emptyStack();
|
|
30
|
+
}
|
|
31
|
+
this.adminStore.toggleEdit(editing);
|
|
32
|
+
}
|
|
33
|
+
setNavigationGuardDisabled(disabled) {
|
|
34
|
+
this.adminStore.state.navigationGuardDisabled = disabled;
|
|
35
|
+
}
|
|
36
|
+
get navigationGuardDisabled() {
|
|
37
|
+
return this.adminStore.state.navigationGuardDisabled;
|
|
38
|
+
}
|
|
39
|
+
get isEditing() {
|
|
40
|
+
return this.adminStore.state.isEditing;
|
|
41
|
+
}
|
|
42
|
+
get adminStore() {
|
|
43
|
+
return this.adminStoreDefinition.useStore();
|
|
44
|
+
}
|
|
45
|
+
redrawListen() {
|
|
46
|
+
this.eventBus.on("componentMounted", this.emitRedraw);
|
|
47
|
+
this.eventBus.on("manageableComponentMounted", this.emitRedraw);
|
|
48
|
+
watch([
|
|
49
|
+
this.resourceStackManager.showManager,
|
|
50
|
+
this.resourceStackManager.isEditingLayout
|
|
51
|
+
], this.emitRedraw);
|
|
52
|
+
}
|
|
53
|
+
emitRedraw() {
|
|
54
|
+
if (!this.throttledRedrawEmitFn) {
|
|
55
|
+
this.throttledRedrawEmitFn = throttle(this.doEmitRedraw, 40, {
|
|
56
|
+
leading: true,
|
|
57
|
+
trailing: true
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
this.throttledRedrawEmitFn();
|
|
61
|
+
}
|
|
62
|
+
doEmitRedraw() {
|
|
63
|
+
this.eventBus.emit("redrawFocus");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ComponentPublicInstance, type Ref } from 'vue';
|
|
2
|
+
import type Cwa from '../cwa.js';
|
|
3
|
+
export type StyleOptions = {
|
|
4
|
+
multiple?: boolean;
|
|
5
|
+
classes: {
|
|
6
|
+
[name: string]: string[];
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export type ManageableResourceOps = Ref<{
|
|
10
|
+
styles?: StyleOptions;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
export default class ManageableResource {
|
|
14
|
+
private readonly component;
|
|
15
|
+
private readonly $cwa;
|
|
16
|
+
private readonly ops;
|
|
17
|
+
private currentIri;
|
|
18
|
+
private domElements;
|
|
19
|
+
private unwatchCurrentIri;
|
|
20
|
+
private tabResolver;
|
|
21
|
+
private isIriInit;
|
|
22
|
+
constructor(component: ComponentPublicInstance, $cwa: Cwa, ops: ManageableResourceOps);
|
|
23
|
+
init(iri: Ref<string | undefined>): void;
|
|
24
|
+
private _initNewIri;
|
|
25
|
+
initNewIri(): void;
|
|
26
|
+
clear(soft?: boolean): void;
|
|
27
|
+
private componentMountedListener;
|
|
28
|
+
mockChildMounted(): void;
|
|
29
|
+
private selectResourceListener;
|
|
30
|
+
private get childIris();
|
|
31
|
+
private getAllEls;
|
|
32
|
+
private addClickEventListeners;
|
|
33
|
+
private triggerClick;
|
|
34
|
+
private removeClickEventListeners;
|
|
35
|
+
private clickListener;
|
|
36
|
+
private getCurrentStackItem;
|
|
37
|
+
private get currentResource();
|
|
38
|
+
private get resourceType();
|
|
39
|
+
private get resourceConfig();
|
|
40
|
+
private get displayName();
|
|
41
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
markRaw,
|
|
4
|
+
ref,
|
|
5
|
+
watch
|
|
6
|
+
} from "vue";
|
|
7
|
+
import ManagerTabsResolver from "./manager-tabs-resolver.js";
|
|
8
|
+
export default class ManageableResource {
|
|
9
|
+
constructor(component, $cwa, ops) {
|
|
10
|
+
this.component = component;
|
|
11
|
+
this.$cwa = $cwa;
|
|
12
|
+
this.ops = ops;
|
|
13
|
+
this.tabResolver = new ManagerTabsResolver();
|
|
14
|
+
this.componentMountedListener = this.componentMountedListener.bind(this);
|
|
15
|
+
this.selectResourceListener = this.selectResourceListener.bind(this);
|
|
16
|
+
this.clickListener = this.clickListener.bind(this);
|
|
17
|
+
}
|
|
18
|
+
currentIri;
|
|
19
|
+
domElements = ref([]);
|
|
20
|
+
unwatchCurrentIri;
|
|
21
|
+
tabResolver;
|
|
22
|
+
isIriInit = false;
|
|
23
|
+
// PUBLIC
|
|
24
|
+
init(iri) {
|
|
25
|
+
this.clear(false);
|
|
26
|
+
this.currentIri = iri;
|
|
27
|
+
this.$cwa.admin.eventBus.on("componentMounted", this.componentMountedListener);
|
|
28
|
+
this.$cwa.admin.eventBus.on("selectResource", this.selectResourceListener);
|
|
29
|
+
this.unwatchCurrentIri = watch(this.currentIri, this._initNewIri.bind(this), {
|
|
30
|
+
immediate: true,
|
|
31
|
+
flush: "post"
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
_initNewIri(iri) {
|
|
35
|
+
this.clear(true);
|
|
36
|
+
this.isIriInit = true;
|
|
37
|
+
if (!iri) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.addClickEventListeners();
|
|
41
|
+
}
|
|
42
|
+
initNewIri() {
|
|
43
|
+
this._initNewIri(this.currentIri?.value);
|
|
44
|
+
}
|
|
45
|
+
clear(soft = false) {
|
|
46
|
+
if (!this.isIriInit) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this.removeClickEventListeners();
|
|
50
|
+
this.domElements.value = [];
|
|
51
|
+
if (!soft) {
|
|
52
|
+
this.$cwa.admin.eventBus.off("componentMounted", this.componentMountedListener);
|
|
53
|
+
this.$cwa.admin.eventBus.off("selectResource", this.selectResourceListener);
|
|
54
|
+
if (this.unwatchCurrentIri) {
|
|
55
|
+
this.unwatchCurrentIri();
|
|
56
|
+
this.unwatchCurrentIri = void 0;
|
|
57
|
+
}
|
|
58
|
+
if (this.currentIri) {
|
|
59
|
+
this.currentIri = void 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
this.isIriInit = false;
|
|
63
|
+
}
|
|
64
|
+
// REFRESHING INITIALISATION
|
|
65
|
+
componentMountedListener(iri) {
|
|
66
|
+
const currentIri = this.currentIri?.value;
|
|
67
|
+
if (!currentIri || this.currentIri?.value === iri) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const childIris = this.childIris.value;
|
|
71
|
+
const iris = [];
|
|
72
|
+
if (iri.endsWith("_placeholder")) {
|
|
73
|
+
iris.push(iri);
|
|
74
|
+
iris.push(...this.$cwa.resources.findAllPublishableIris(iri.replace("_placeholder", "")));
|
|
75
|
+
} else {
|
|
76
|
+
iris.push(...this.$cwa.resources.findAllPublishableIris(iri));
|
|
77
|
+
}
|
|
78
|
+
const iriIsChild = () => {
|
|
79
|
+
for (const iri2 of iris) {
|
|
80
|
+
if (childIris.includes(iri2)) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
};
|
|
86
|
+
const isNewlyMountedIriAChild = iriIsChild();
|
|
87
|
+
if (isNewlyMountedIriAChild) {
|
|
88
|
+
this.removeClickEventListeners();
|
|
89
|
+
this.addClickEventListeners();
|
|
90
|
+
this.$cwa.admin.eventBus.emit("componentMounted", currentIri);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
mockChildMounted() {
|
|
94
|
+
const currentIri = this.currentIri?.value;
|
|
95
|
+
this.removeClickEventListeners();
|
|
96
|
+
this.addClickEventListeners();
|
|
97
|
+
if (currentIri) this.$cwa.admin.eventBus.emit("componentMounted", currentIri);
|
|
98
|
+
}
|
|
99
|
+
selectResourceListener(iri) {
|
|
100
|
+
if (iri === this.currentIri?.value) {
|
|
101
|
+
this.triggerClick();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
get childIris() {
|
|
105
|
+
return computed(() => {
|
|
106
|
+
if (!this.currentIri?.value) {
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
const addResourceEvent = this.$cwa.resourcesManager.addResourceEvent.value;
|
|
110
|
+
return this.$cwa.resources.getChildIris(this.currentIri?.value, addResourceEvent);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
// GET DOM ELEMENTS TO ADD CLICK EVENTS TO
|
|
114
|
+
getAllEls() {
|
|
115
|
+
const allSiblings = [];
|
|
116
|
+
let currentEl = this.component.$el;
|
|
117
|
+
if (!currentEl) {
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
if (currentEl.nodeType === Node.ELEMENT_NODE) {
|
|
121
|
+
return [currentEl];
|
|
122
|
+
}
|
|
123
|
+
let startTagCount = 0;
|
|
124
|
+
do {
|
|
125
|
+
if (currentEl.nodeType === Node.COMMENT_NODE) {
|
|
126
|
+
const nodeValue = currentEl.nodeValue.trim();
|
|
127
|
+
if (startTagCount && nodeValue === "cwa-end") {
|
|
128
|
+
startTagCount--;
|
|
129
|
+
if (startTagCount === 0) {
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (nodeValue === "cwa-start") {
|
|
134
|
+
startTagCount++;
|
|
135
|
+
}
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
currentEl.nodeType === Node.ELEMENT_NODE && startTagCount && allSiblings.push(currentEl);
|
|
139
|
+
} while (currentEl = currentEl.nextSibling);
|
|
140
|
+
return allSiblings;
|
|
141
|
+
}
|
|
142
|
+
addClickEventListeners() {
|
|
143
|
+
this.domElements.value = this.getAllEls();
|
|
144
|
+
for (const el of this.domElements.value) {
|
|
145
|
+
el.addEventListener("click", this.clickListener, false);
|
|
146
|
+
el.addEventListener("contextmenu", this.clickListener, false);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
triggerClick() {
|
|
150
|
+
const firstDomElement = this.domElements.value[0];
|
|
151
|
+
const clickEvent = new Event("click", { bubbles: true });
|
|
152
|
+
firstDomElement.dispatchEvent(clickEvent);
|
|
153
|
+
}
|
|
154
|
+
removeClickEventListeners() {
|
|
155
|
+
for (const el of this.domElements.value) {
|
|
156
|
+
el.removeEventListener("click", this.clickListener);
|
|
157
|
+
el.removeEventListener("contextmenu", this.clickListener);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// This will be called by the click event listener in context of this, and can be removed as well.
|
|
161
|
+
// if we define with a name and call that, the `this` context will be the clicked dom element
|
|
162
|
+
clickListener(evt) {
|
|
163
|
+
if (!this.currentIri?.value || !this.currentResource || this.ops.value.disabled === true) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
this.$cwa.admin.resourceStackManager.addToStack(this.getCurrentStackItem(evt.target), evt.type === "contextmenu", this.ops);
|
|
167
|
+
}
|
|
168
|
+
getCurrentStackItem(clickTarget) {
|
|
169
|
+
if (!this.currentResource || !this.currentIri?.value) {
|
|
170
|
+
throw new Error("Cannot get a currentStackItem when currentResource or currentIri is not defined");
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
iri: this.currentIri.value,
|
|
174
|
+
domElements: this.domElements,
|
|
175
|
+
clickTarget,
|
|
176
|
+
displayName: this.displayName,
|
|
177
|
+
managerTabs: markRaw(this.tabResolver.resolve({ resourceType: this.resourceType, resourceConfig: this.resourceConfig, resource: this.currentResource })),
|
|
178
|
+
ui: this.resourceConfig?.ui,
|
|
179
|
+
styles: computed(() => this.ops.value.styles),
|
|
180
|
+
childIris: this.childIris
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
get currentResource() {
|
|
184
|
+
return this.currentIri?.value ? this.$cwa.resources.getResource(this.currentIri.value)?.value : void 0;
|
|
185
|
+
}
|
|
186
|
+
get resourceType() {
|
|
187
|
+
const currentResource = this.currentResource;
|
|
188
|
+
if (!currentResource) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
return currentResource.data?.["@type"];
|
|
192
|
+
}
|
|
193
|
+
get resourceConfig() {
|
|
194
|
+
const currentResource = this.currentResource;
|
|
195
|
+
if (!currentResource) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (!this.$cwa.resourcesConfig || !this.resourceType) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
return this.$cwa.resourcesConfig[this.resourceType];
|
|
202
|
+
}
|
|
203
|
+
get displayName() {
|
|
204
|
+
return this.resourceConfig?.name || this.resourceType;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CwaResourceMeta, ManagerTab } from '#cwa/module';
|
|
2
|
+
import type { CwaCurrentResourceInterface } from '#cwa/runtime/storage/stores/resources/state';
|
|
3
|
+
export declare const DEFAULT_TAB_ORDER = 50;
|
|
4
|
+
interface resolveTabsOps {
|
|
5
|
+
resourceType?: string;
|
|
6
|
+
resourceConfig?: CwaResourceMeta;
|
|
7
|
+
resource: CwaCurrentResourceInterface;
|
|
8
|
+
}
|
|
9
|
+
export default class ManagerTabsResolver {
|
|
10
|
+
private cwa;
|
|
11
|
+
constructor();
|
|
12
|
+
private getComponentGroupTabs;
|
|
13
|
+
private getComponentPositionTabs;
|
|
14
|
+
private getComponentTabs;
|
|
15
|
+
resolve(ops: resolveTabsOps): ManagerTab[];
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineAsyncComponent } from "vue";
|
|
2
|
+
import { getPublishedResourceState } from "#cwa/runtime/resources/resource-utils";
|
|
3
|
+
import { useCwa } from "#imports";
|
|
4
|
+
export const DEFAULT_TAB_ORDER = 50;
|
|
5
|
+
export default class ManagerTabsResolver {
|
|
6
|
+
cwa;
|
|
7
|
+
constructor() {
|
|
8
|
+
this.cwa = useCwa();
|
|
9
|
+
}
|
|
10
|
+
*getComponentGroupTabs() {
|
|
11
|
+
yield defineAsyncComponent(() => import("#cwa/runtime/templates/components/main/admin/resource-manager/_tabs/group/Group.vue"));
|
|
12
|
+
}
|
|
13
|
+
*getComponentPositionTabs() {
|
|
14
|
+
if (this.cwa.resources.isDataPage.value) {
|
|
15
|
+
yield defineAsyncComponent(() => import("#cwa/runtime/templates/components/main/admin/resource-manager/_tabs/position/DataPage.vue"));
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (this.cwa.resources.isDynamicPage.value) {
|
|
19
|
+
yield defineAsyncComponent(() => import("#cwa/runtime/templates/components/main/admin/resource-manager/_tabs/position/DynamicPage.vue"));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
*getComponentTabs(resource) {
|
|
23
|
+
yield defineAsyncComponent(() => import("#cwa/runtime/templates/components/main/admin/resource-manager/_tabs/component/Ui.vue"));
|
|
24
|
+
yield defineAsyncComponent(() => import("#cwa/runtime/templates/components/main/admin/resource-manager/_tabs/component/Order.vue"));
|
|
25
|
+
if (getPublishedResourceState(resource) !== void 0) {
|
|
26
|
+
yield defineAsyncComponent(() => import("#cwa/runtime/templates/components/main/admin/resource-manager/_tabs/component/Publish.vue"));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
resolve(ops) {
|
|
30
|
+
let tabs = [
|
|
31
|
+
defineAsyncComponent(() => import("#cwa/runtime/templates/components/main/admin/resource-manager/_tabs/ResourceInfoTab.vue"))
|
|
32
|
+
];
|
|
33
|
+
if (ops.resourceConfig?.managerTabs) {
|
|
34
|
+
tabs = [...tabs, ...ops.resourceConfig.managerTabs];
|
|
35
|
+
}
|
|
36
|
+
if (ops.resourceType) {
|
|
37
|
+
switch (ops.resourceType) {
|
|
38
|
+
case "ComponentGroup":
|
|
39
|
+
tabs = [...tabs, ...this.getComponentGroupTabs()];
|
|
40
|
+
break;
|
|
41
|
+
case "ComponentPosition":
|
|
42
|
+
tabs = [...tabs, ...this.getComponentPositionTabs()];
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
tabs = [...tabs, ...this.getComponentTabs(ops.resource)];
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return tabs;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RouteLocationNormalized, Router } from 'vue-router';
|
|
2
|
+
import type { AdminStore } from '../storage/stores/admin/admin-store.js';
|
|
3
|
+
export default class NavigationGuard {
|
|
4
|
+
private router;
|
|
5
|
+
private adminStoreDefinition;
|
|
6
|
+
private programmatic;
|
|
7
|
+
constructor(router: Router, adminStoreDefinition: AdminStore);
|
|
8
|
+
private extendRouteMethods;
|
|
9
|
+
private isRouteForcedNavigation;
|
|
10
|
+
private allowNavigation;
|
|
11
|
+
get navigationDisabled(): boolean;
|
|
12
|
+
get adminNavigationGuardFn(): (toRoute: RouteLocationNormalized) => boolean | {
|
|
13
|
+
path: string;
|
|
14
|
+
query: import("vue-router").LocationQuery;
|
|
15
|
+
hash: string;
|
|
16
|
+
};
|
|
17
|
+
private get adminStore();
|
|
18
|
+
}
|