@antelopejs/dms 0.25.7 → 0.25.8-next.1166.gbc4d5cc
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/E2E.md +3 -2
- package/data/mockup-example/spec.json +11 -0
- package/data/mockup-spec.schema.json +399 -20
- package/dist/e2e/index.d.mts +3 -1
- package/dist/e2e/run-state.d.mts +8 -0
- package/dist/e2e/stack.d.mts +3 -1
- package/dist/implementations/dms/page/access.js +1 -1
- package/dist/implementations/dms/page/access.js.map +1 -1
- package/dist/implementations/dms/page/payloads.js +1 -1
- package/dist/implementations/dms/page/payloads.js.map +1 -1
- package/dist/implementations/dms/page/registry.js +1 -1
- package/dist/implementations/dms/page/registry.js.map +1 -1
- package/dist/implementations/dms-base/bulk-selection.d.ts +1 -1
- package/dist/implementations/dms-base/bulk-selection.js +7 -1
- package/dist/implementations/dms-base/bulk-selection.js.map +1 -1
- package/dist/implementations/dms-base/group-order.d.ts +1 -1
- package/dist/implementations/dms-base/group-order.js +17 -4
- package/dist/implementations/dms-base/group-order.js.map +1 -1
- package/dist/implementations/dms-base/search-route.d.ts +1 -1
- package/dist/implementations/dms-base/search-route.js +11 -3
- package/dist/implementations/dms-base/search-route.js.map +1 -1
- package/dist/implementations/dms-base/table-view.js +12 -3
- package/dist/implementations/dms-base/table-view.js.map +1 -1
- package/dist/implementations/dms-builder/engine/expression.js +3 -2
- package/dist/implementations/dms-builder/engine/expression.js.map +1 -1
- package/dist/implementations/dms-builder/engine/inherited-variables.js +2 -1
- package/dist/implementations/dms-builder/engine/inherited-variables.js.map +1 -1
- package/dist/implementations/dms-builder/engine/preview.js +2 -1
- package/dist/implementations/dms-builder/engine/preview.js.map +1 -1
- package/dist/implementations/dms-builder/engine/table-view-settings.js +34 -14
- package/dist/implementations/dms-builder/engine/table-view-settings.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +9 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/mockup-export/capture.d.ts +19 -0
- package/dist/mcp/mockup-export/capture.js +99 -0
- package/dist/mcp/mockup-export/capture.js.map +1 -0
- package/dist/mcp/mockup-export/document.d.ts +4 -0
- package/dist/mcp/mockup-export/document.js +199 -0
- package/dist/mcp/mockup-export/document.js.map +1 -0
- package/dist/mcp/mockup-export/index.d.ts +20 -0
- package/dist/mcp/mockup-export/index.js +110 -0
- package/dist/mcp/mockup-export/index.js.map +1 -0
- package/dist/mcp/mockup-export/jobs.d.ts +32 -0
- package/dist/mcp/mockup-export/jobs.js +49 -0
- package/dist/mcp/mockup-export/jobs.js.map +1 -0
- package/dist/mcp/mockup-export/plan.d.ts +78 -0
- package/dist/mcp/mockup-export/plan.js +292 -0
- package/dist/mcp/mockup-export/plan.js.map +1 -0
- package/dist/mcp/mockup-export/route.d.ts +23 -0
- package/dist/mcp/mockup-export/route.js +91 -0
- package/dist/mcp/mockup-export/route.js.map +1 -0
- package/dist/mcp/page-verify/index.d.ts +15 -0
- package/dist/mcp/page-verify/index.js +16 -6
- package/dist/mcp/page-verify/index.js.map +1 -1
- package/dist/mcp/page-verify/mockup.d.ts +2 -1
- package/dist/mcp/page-verify/mockup.js +1 -0
- package/dist/mcp/page-verify/mockup.js.map +1 -1
- package/dist/mcp/page-verify/modules.d.ts +8 -0
- package/dist/mcp/page-verify/modules.js +49 -0
- package/dist/mcp/page-verify/modules.js.map +1 -0
- package/dist/mcp/page-verify/playwright.d.ts +22 -4
- package/dist/mcp/page-verify/playwright.js.map +1 -1
- package/dist/mcp/page-verify/report.d.ts +1 -0
- package/dist/mcp/tools/mockup-export-pdf.d.ts +1 -0
- package/dist/mcp/tools/mockup-export-pdf.js +69 -0
- package/dist/mcp/tools/mockup-export-pdf.js.map +1 -0
- package/dist/mcp/tools/mockup-module-catalog.d.ts +1 -0
- package/dist/mcp/tools/mockup-module-catalog.js +36 -0
- package/dist/mcp/tools/mockup-module-catalog.js.map +1 -0
- package/dist/mcp/tools/mockup-read-spec.js +2 -3
- package/dist/mcp/tools/mockup-read-spec.js.map +1 -1
- package/dist/mcp/tools/mockup.js +4 -0
- package/dist/mcp/tools/mockup.js.map +1 -1
- package/dist/mcp/tools/page-verify.d.ts +1 -0
- package/dist/mcp/tools/page-verify.js +6 -2
- package/dist/mcp/tools/page-verify.js.map +1 -1
- package/dist/mockup/annotations.js +2 -2
- package/dist/mockup/annotations.js.map +1 -1
- package/dist/mockup/apply-notes.js +1 -1
- package/dist/mockup/apply-notes.js.map +1 -1
- package/dist/mockup/compile-layouts.d.ts +5 -0
- package/dist/mockup/compile-layouts.js +74 -0
- package/dist/mockup/compile-layouts.js.map +1 -0
- package/dist/mockup/compile-nodes.d.ts +11 -0
- package/dist/mockup/compile-nodes.js +119 -0
- package/dist/mockup/compile-nodes.js.map +1 -0
- package/dist/mockup/compile-pages.d.ts +18 -0
- package/dist/mockup/compile-pages.js +188 -0
- package/dist/mockup/compile-pages.js.map +1 -0
- package/dist/mockup/compile.d.ts +6 -10
- package/dist/mockup/compile.js +31 -289
- package/dist/mockup/compile.js.map +1 -1
- package/dist/mockup/create.d.ts +16 -0
- package/dist/mockup/create.js +78 -0
- package/dist/mockup/create.js.map +1 -0
- package/dist/mockup/created-watch.d.ts +18 -0
- package/dist/mockup/created-watch.js +110 -0
- package/dist/mockup/created-watch.js.map +1 -0
- package/dist/mockup/entities.d.ts +20 -0
- package/dist/mockup/entities.js +213 -0
- package/dist/mockup/entities.js.map +1 -0
- package/dist/mockup/etag.d.ts +1 -0
- package/dist/mockup/etag.js +10 -0
- package/dist/mockup/etag.js.map +1 -0
- package/dist/mockup/extensions.d.ts +17 -0
- package/dist/mockup/extensions.js +56 -0
- package/dist/mockup/extensions.js.map +1 -0
- package/dist/mockup/files.d.ts +2 -1
- package/dist/mockup/files.js +2 -1
- package/dist/mockup/files.js.map +1 -1
- package/dist/mockup/fixture-answers.d.ts +1 -0
- package/dist/mockup/fixture-answers.js +1 -1
- package/dist/mockup/fixture-answers.js.map +1 -1
- package/dist/mockup/fixture-batch.d.ts +21 -0
- package/dist/mockup/fixture-batch.js +111 -0
- package/dist/mockup/fixture-batch.js.map +1 -0
- package/dist/mockup/fixture-routes.d.ts +21 -0
- package/dist/mockup/fixture-routes.js +136 -0
- package/dist/mockup/fixture-routes.js.map +1 -0
- package/dist/mockup/fixtures.d.ts +0 -27
- package/dist/mockup/fixtures.js +11 -117
- package/dist/mockup/fixtures.js.map +1 -1
- package/dist/mockup/from-page.js +2 -9
- package/dist/mockup/from-page.js.map +1 -1
- package/dist/mockup/generate.js +4 -1
- package/dist/mockup/generate.js.map +1 -1
- package/dist/mockup/history-routes.d.ts +2 -4
- package/dist/mockup/history-routes.js +27 -36
- package/dist/mockup/history-routes.js.map +1 -1
- package/dist/mockup/history.js +2 -1
- package/dist/mockup/history.js.map +1 -1
- package/dist/mockup/index.d.ts +10 -0
- package/dist/mockup/index.js +10 -0
- package/dist/mockup/index.js.map +1 -1
- package/dist/mockup/json-schema-entities.d.ts +5 -0
- package/dist/mockup/json-schema-entities.js +141 -0
- package/dist/mockup/json-schema-entities.js.map +1 -0
- package/dist/mockup/json-schema-layout.d.ts +1 -0
- package/dist/mockup/json-schema-layout.js +95 -2
- package/dist/mockup/json-schema-layout.js.map +1 -1
- package/dist/mockup/json-schema.js +40 -23
- package/dist/mockup/json-schema.js.map +1 -1
- package/dist/mockup/json.d.ts +8 -0
- package/dist/mockup/json.js +20 -0
- package/dist/mockup/json.js.map +1 -0
- package/dist/mockup/layout-model.d.ts +156 -0
- package/dist/mockup/layout-model.js +96 -0
- package/dist/mockup/layout-model.js.map +1 -0
- package/dist/mockup/layouts.d.ts +9 -0
- package/dist/mockup/layouts.js +40 -0
- package/dist/mockup/layouts.js.map +1 -0
- package/dist/mockup/manage-routes.d.ts +3 -1
- package/dist/mockup/manage-routes.js +38 -1
- package/dist/mockup/manage-routes.js.map +1 -1
- package/dist/mockup/manage.js +1 -1
- package/dist/mockup/manage.js.map +1 -1
- package/dist/mockup/model.d.ts +137 -101
- package/dist/mockup/model.js +105 -91
- package/dist/mockup/model.js.map +1 -1
- package/dist/mockup/module-manifests.d.ts +99 -0
- package/dist/mockup/module-manifests.js +95 -0
- package/dist/mockup/module-manifests.js.map +1 -0
- package/dist/mockup/module-states.d.ts +10 -0
- package/dist/mockup/module-states.js +85 -0
- package/dist/mockup/module-states.js.map +1 -0
- package/dist/mockup/modules-schema.d.ts +2 -0
- package/dist/mockup/modules-schema.js +39 -0
- package/dist/mockup/modules-schema.js.map +1 -0
- package/dist/mockup/modules.d.ts +6 -9
- package/dist/mockup/modules.js +105 -24
- package/dist/mockup/modules.js.map +1 -1
- package/dist/mockup/owner-controller.js +1 -1
- package/dist/mockup/owner-controller.js.map +1 -1
- package/dist/mockup/page-capture-routes.d.ts +19 -0
- package/dist/mockup/page-capture-routes.js +92 -0
- package/dist/mockup/page-capture-routes.js.map +1 -0
- package/dist/mockup/page-captures.d.ts +61 -0
- package/dist/mockup/page-captures.js +252 -0
- package/dist/mockup/page-captures.js.map +1 -0
- package/dist/mockup/parse-spec.d.ts +10 -0
- package/dist/mockup/parse-spec.js +62 -0
- package/dist/mockup/parse-spec.js.map +1 -0
- package/dist/mockup/places.d.ts +17 -0
- package/dist/mockup/places.js +75 -0
- package/dist/mockup/places.js.map +1 -0
- package/dist/mockup/presence-board.js +1 -1
- package/dist/mockup/presence-board.js.map +1 -1
- package/dist/mockup/presence-routes.js +2 -2
- package/dist/mockup/presence-routes.js.map +1 -1
- package/dist/mockup/refusals.d.ts +5 -0
- package/dist/mockup/refusals.js +16 -0
- package/dist/mockup/refusals.js.map +1 -1
- package/dist/mockup/routes.d.ts +3 -5
- package/dist/mockup/routes.js +19 -162
- package/dist/mockup/routes.js.map +1 -1
- package/dist/mockup/sketch-limits.d.ts +1 -0
- package/dist/mockup/sketch-limits.js +2 -1
- package/dist/mockup/sketch-limits.js.map +1 -1
- package/dist/mockup/sketch.d.ts +2 -2
- package/dist/mockup/sketch.js +2 -1
- package/dist/mockup/sketch.js.map +1 -1
- package/dist/mockup/slug.d.ts +3 -0
- package/dist/mockup/slug.js +7 -0
- package/dist/mockup/slug.js.map +1 -0
- package/dist/mockup/source-routes.d.ts +5 -4
- package/dist/mockup/source-routes.js +26 -17
- package/dist/mockup/source-routes.js.map +1 -1
- package/dist/mockup/source.js +2 -1
- package/dist/mockup/source.js.map +1 -1
- package/dist/mockup/state-patch.d.ts +22 -0
- package/dist/mockup/state-patch.js +75 -0
- package/dist/mockup/state-patch.js.map +1 -0
- package/dist/mockup/state.d.ts +112 -0
- package/dist/mockup/state.js +22 -0
- package/dist/mockup/state.js.map +1 -0
- package/dist/mockup/store-list.d.ts +28 -0
- package/dist/mockup/store-list.js +89 -0
- package/dist/mockup/store-list.js.map +1 -0
- package/dist/mockup/store.d.ts +16 -37
- package/dist/mockup/store.js +85 -200
- package/dist/mockup/store.js.map +1 -1
- package/dist/mockup/table-archive.d.ts +0 -1
- package/dist/mockup/table-archive.js +0 -16
- package/dist/mockup/table-archive.js.map +1 -1
- package/dist/mockup/tenancy.d.ts +19 -0
- package/dist/mockup/tenancy.js +73 -0
- package/dist/mockup/tenancy.js.map +1 -0
- package/dist/mockup/tenant-rows.d.ts +4 -0
- package/dist/mockup/tenant-rows.js +19 -0
- package/dist/mockup/tenant-rows.js.map +1 -0
- package/dist/pages/settings/users/account-activity.js +2 -1
- package/dist/pages/settings/users/account-activity.js.map +1 -1
- package/dist/routes/auth/oauth/config.js +1 -1
- package/dist/routes/auth/oauth/config.js.map +1 -1
- package/dist/routes/system-state.js +1 -1
- package/dist/routes/system-state.js.map +1 -1
- package/dist/store/interfaces.js +2 -1
- package/dist/store/interfaces.js.map +1 -1
- package/dist/utils/export-jobs-run.js +4 -4
- package/dist/utils/export-jobs-run.js.map +1 -1
- package/dist/utils/export-jobs.js +15 -3
- package/dist/utils/export-jobs.js.map +1 -1
- package/e2e/index.mjs +25 -3
- package/e2e/journey-run.mjs +4 -3
- package/e2e/run-state.mjs +11 -0
- package/e2e/stack.mjs +9 -1
- package/frontend-vue/eslint-globals.generated.mjs +40 -38
- package/frontend-vue/layers/dms-core/app/build/utils/asyncDataScope.ts +3 -31
- package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +8 -2
- package/frontend-vue/layers/dms-core/app/composables/page/useSiteLayout.ts +5 -2
- package/frontend-vue/layers/dms-core/app/composables/period/usePeriod.ts +13 -19
- package/frontend-vue/layers/dms-core/app/composables/period/usePeriodScope.ts +6 -15
- package/frontend-vue/layers/dms-core/app/utils/localFetchAnswers.ts +124 -0
- package/frontend-vue/layers/dms-core/app/utils/textDigest.ts +29 -0
- package/frontend-vue/layers/dms-core/i18n/locales/core-en-GB.json +27 -3
- package/frontend-vue/layers/dms-core/i18n/locales/core-fr-FR.json +27 -3
- package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +110 -30
- package/frontend-vue/layers/dms-layout/app/build/components/layout/MockupSidebarMenu.vue +21 -6
- package/frontend-vue/layers/dms-layout/app/build/components/layout/SidebarUserMenu.vue +19 -7
- package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupMenu.ts +79 -9
- package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupWidgets.ts +65 -0
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsNav.vue +17 -4
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsShell.vue +12 -0
- package/frontend-vue/layers/dms-layout/app/build/composables/notification/useNotificationGroupsOpen.ts +3 -3
- package/frontend-vue/layers/dms-layout/app/build/composables/notification/useNotificationPreferences.ts +13 -8
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/useSettingsNavigation.ts +39 -0
- package/frontend-vue/layers/dms-layout/app/build/mockups/created-mockups.ts +12 -2
- package/frontend-vue/layers/dms-layout/app/build/mockups/created-toast.ts +9 -1
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleHistory.ts +3 -1
- package/frontend-vue/layers/dms-layout/app/custom-layouts/PreviewLayout.vue +53 -6
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/BlockPreviewSketch.vue +31 -5
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupCanvasChrome.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabase.vue +153 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEmptyState.vue +23 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModuleStore.vue +164 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverview.vue +59 -33
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSectionLabel.vue +51 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSlot.vue +58 -12
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPagesList.vue +21 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPinCard.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPinLayer.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupReconnecting.vue +17 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTenantBanner.vue +48 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTopBar.vue +77 -9
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkbench.vue +130 -45
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkspaceSwitcher.vue +142 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/{MockupOverviewZoom.vue → MockupZoomControls.vue} +23 -15
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentTheme.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewCapture.ts +70 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewNavigation.ts +44 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockInspector.ts +14 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockPreviewEmbed.ts +241 -35
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useFixtureBatches.ts +154 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupActivation.ts +157 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupDatabase.ts +165 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupEditing.ts +13 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupFrameRender.ts +126 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupFrameSize.ts +10 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupOverview.ts +63 -25
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageFrame.ts +82 -29
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageZoom.ts +138 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPdfExport.ts +124 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPins.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupRealData.ts +10 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupRoutePage.ts +60 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSession.ts +8 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSpec.ts +6 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupTenancy.ts +37 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupToolModes.ts +5 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerActivation.ts +56 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerExport.ts +46 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerPages.ts +29 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerShortcuts.ts +13 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useOverviewCaptures.ts +39 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePersistedCaptures.ts +151 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewFrame.ts +19 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/containers/drawerSize.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultIdentityCells.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationBadges.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formState.ts +3 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/navigation/useNavBadges.ts +3 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/page-toolbar/toolbarControlHeight.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewPresence.ts +10 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewSelection.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useExpandedRowDetails.ts +6 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/card.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/formTexts.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/views.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +37 -3
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCreateModal.vue +130 -0
- package/frontend-vue/layers/dms-ui/app/build/mockups/manage.ts +20 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewChannel.ts +1 -8
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +141 -103
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewNavigation.ts +332 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewRects.ts +22 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +75 -173
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupActivation.ts +100 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupAnnotations.ts +146 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCaptures.ts +118 -9
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupEdit.ts +0 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupEntities.ts +80 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupFrame.ts +123 -8
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupLinks.ts +6 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupModuleNavigation.ts +171 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupModules.ts +138 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverview.ts +42 -8
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverviewSections.ts +66 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupPageTree.ts +15 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupPins.ts +6 -8
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupRealData.ts +18 -5
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSchema.ts +177 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSections.ts +1 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupShortcuts.ts +17 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSketchStates.ts +7 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +0 -3
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStatePatch.ts +179 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +17 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenancy.ts +143 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenants.ts +23 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupVersions.ts +2 -7
- package/frontend-vue/layers/dms-ui/app/build/utils/previewFixtureAnswers.ts +156 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/previewFixturesOnly.ts +8 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/previewPageLayout.ts +108 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/previewPageQuery.ts +5 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/previewRows.ts +400 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/recordGuards.ts +15 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/sketch.ts +40 -10
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +23 -6
- package/frontend-vue/layers/dms-ui/app/components/block-preview/MockupViewer.vue +2 -0
- package/frontend-vue/layers/dms-ui/app/components/chart/ChartBlock.vue +1 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/RepeaterTable.vue +3 -1
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +0 -2
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.types.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/composables/chart/useChartTheme.ts +8 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/useTableDataChanges.ts +5 -4
- package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupModuleStore.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupTenantBanner.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupWorkspaceSwitcher.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useFixtureBatches.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupActivation.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupOverview.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupPdfExport.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupRoutePage.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupSession.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupTenancy.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/usePersistedCaptures.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/json.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupActivation.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupAnnotations.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupModuleNavigation.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupOverviewSections.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupSchema.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupStatePatch.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenancy.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenants.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/previewFixtureAnswers.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/previewRows.ts +1 -0
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-en-GB.json +53 -4
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-fr-FR.json +53 -4
- package/frontend-vue/package.json +2 -2
- package/frontend-vue/server/private-options.ts +13 -3
- package/package.json +5 -5
- package/dist/mockup/row-filters.d.ts +0 -8
- package/dist/mockup/row-filters.js +0 -107
- package/dist/mockup/row-filters.js.map +0 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModules.vue +0 -47
package/dist/mockup/compile.js
CHANGED
|
@@ -1,266 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAX_JSON_DEPTH = void 0;
|
|
4
3
|
exports.openOracle = openOracle;
|
|
5
4
|
exports.compileSpec = compileSpec;
|
|
6
|
-
exports.parseSpec = parseSpec;
|
|
7
|
-
const validation_1 = require("../validation");
|
|
8
5
|
const anchor_1 = require("./anchor");
|
|
9
6
|
const block_catalog_1 = require("./block-catalog");
|
|
10
|
-
const
|
|
7
|
+
const compile_layouts_1 = require("./compile-layouts");
|
|
8
|
+
const compile_pages_1 = require("./compile-pages");
|
|
9
|
+
const compile_nodes_1 = require("./compile-nodes");
|
|
11
10
|
const data_access_1 = require("./data-access");
|
|
12
|
-
const
|
|
11
|
+
const entities_1 = require("./entities");
|
|
13
12
|
const fixture_answers_1 = require("./fixture-answers");
|
|
14
|
-
const form_fields_1 = require("./form-fields");
|
|
15
13
|
const form_page_modes_1 = require("./form-page-modes");
|
|
16
14
|
const generate_1 = require("./generate");
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const page_links_1 = require("./page-links");
|
|
20
|
-
const sample_routes_1 = require("./sample-routes");
|
|
15
|
+
const module_states_1 = require("./module-states");
|
|
16
|
+
const places_1 = require("./places");
|
|
21
17
|
const sidebar_1 = require("./sidebar");
|
|
22
|
-
const
|
|
18
|
+
const tenancy_1 = require("./tenancy");
|
|
23
19
|
const table_title_1 = require("./table-title");
|
|
24
|
-
const validate_1 = require("./validate");
|
|
25
|
-
function compileChildren(node, pointer, layoutPath, scope) {
|
|
26
|
-
if (!node.children)
|
|
27
|
-
return node;
|
|
28
|
-
const children = node.children.map((child, index) => {
|
|
29
|
-
const childPointer = `${pointer}/children/${index}`;
|
|
30
|
-
const childPath = `${layoutPath}.${child.id ?? index}`;
|
|
31
|
-
if (Object.hasOwn(scope.paths, childPath)) {
|
|
32
|
-
scope.issues.push({
|
|
33
|
-
path: child.id === undefined ? childPointer : `${childPointer}/id`,
|
|
34
|
-
message: `another child of this block already has the id "${child.id ?? index}"`,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return compileNode(child, childPointer, childPath, scope);
|
|
38
|
-
});
|
|
39
|
-
return { ...node, children };
|
|
40
|
-
}
|
|
41
|
-
function withOptions(node, pointer, scope) {
|
|
42
|
-
return {
|
|
43
|
-
...node,
|
|
44
|
-
options: (0, fixtures_1.rewriteObject)(node.options ?? {}, `${pointer}/options`, scope),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
const sketchKind = {
|
|
48
|
-
resolve: (node, scope) => node.type === sketch_1.SKETCH_TYPE
|
|
49
|
-
? (pointer) => (0, sketch_1.compileSketch)(node, pointer, scope.issues, (0, page_links_1.sketchLinks)(scope))
|
|
50
|
-
: undefined,
|
|
51
|
-
};
|
|
52
|
-
const controllerKind = {
|
|
53
|
-
resolve(node, scope) {
|
|
54
|
-
const descriptor = (0, block_catalog_1.descriptorOf)(node, scope.catalog);
|
|
55
|
-
if (!descriptor?.controllerArg)
|
|
56
|
-
return undefined;
|
|
57
|
-
const block = controller_blocks_1.CONTROLLER_BLOCKS.get(descriptor.type);
|
|
58
|
-
return (pointer, layoutPath) => {
|
|
59
|
-
if (block) {
|
|
60
|
-
const built = block.compile(node, pointer, scope);
|
|
61
|
-
return compileChildren(built, pointer, layoutPath, scope);
|
|
62
|
-
}
|
|
63
|
-
scope.issues.push({
|
|
64
|
-
path: pointer,
|
|
65
|
-
message: `${descriptor.type} needs a controller class, which a mockup cannot build: draw it with a sketch`,
|
|
66
|
-
});
|
|
67
|
-
return compileChildren(withOptions(node, pointer, scope), pointer, layoutPath, scope);
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
const blockKind = {
|
|
72
|
-
resolve(node, scope) {
|
|
73
|
-
const descriptor = (0, block_catalog_1.descriptorOf)(node, scope.catalog);
|
|
74
|
-
if (!descriptor)
|
|
75
|
-
return undefined;
|
|
76
|
-
return (pointer, layoutPath) => {
|
|
77
|
-
const compiled = withOptions(node, pointer, scope);
|
|
78
|
-
(0, validate_1.validateBlockOptions)(descriptor, node, compiled.options, `${pointer}/options`, scope);
|
|
79
|
-
(0, validate_1.validateBlockChildren)(descriptor, node, pointer, scope.issues, (child) => (0, block_catalog_1.descriptorOf)(child, scope.catalog)?.type ?? child.type);
|
|
80
|
-
const options = (0, form_fields_1.withFieldInputs)(descriptor, compiled.options, `${pointer}/options`, scope.issues);
|
|
81
|
-
return compileChildren({ ...compiled, options: (0, validate_1.componentOptionsOf)(descriptor, options) }, pointer, layoutPath, scope);
|
|
82
|
-
};
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
function unknownIssue(node, pointer) {
|
|
86
|
-
if (node.type !== undefined) {
|
|
87
|
-
return {
|
|
88
|
-
path: `${pointer}/type`,
|
|
89
|
-
message: `no block type is registered as "${node.type}"`,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
if (node.componentName !== undefined) {
|
|
93
|
-
return {
|
|
94
|
-
path: `${pointer}/componentName`,
|
|
95
|
-
message: `no registered block emits the component "${node.componentName}"`,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
return { path: pointer, message: "a node needs a type or a componentName" };
|
|
99
|
-
}
|
|
100
|
-
const unknownKind = {
|
|
101
|
-
resolve: (node, scope) => (pointer, layoutPath) => {
|
|
102
|
-
scope.issues.push(unknownIssue(node, pointer));
|
|
103
|
-
return compileChildren(withOptions(node, pointer, scope), pointer, layoutPath, scope);
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
const NODE_KINDS = [
|
|
107
|
-
sketchKind,
|
|
108
|
-
controllerKind,
|
|
109
|
-
blockKind,
|
|
110
|
-
unknownKind,
|
|
111
|
-
];
|
|
112
|
-
function drawnOn(node, scope) {
|
|
113
|
-
if (scope.routes || !node.options)
|
|
114
|
-
return node;
|
|
115
|
-
return { ...node, options: (0, sample_routes_1.confineToFixtures)(node.options, scope) };
|
|
116
|
-
}
|
|
117
|
-
function compileNode(node, pointer, layoutPath, scope) {
|
|
118
|
-
scope.paths[layoutPath] = pointer;
|
|
119
|
-
const descriptor = (0, block_catalog_1.descriptorOf)(node, scope.catalog);
|
|
120
|
-
if (descriptor)
|
|
121
|
-
(0, fixture_answers_1.checkFixtureAnswer)(descriptor, node, pointer, scope);
|
|
122
|
-
for (const kind of NODE_KINDS) {
|
|
123
|
-
const compile = kind.resolve(node, scope);
|
|
124
|
-
if (compile)
|
|
125
|
-
return drawnOn(compile(pointer, layoutPath), scope);
|
|
126
|
-
}
|
|
127
|
-
return node;
|
|
128
|
-
}
|
|
129
|
-
const ROOT_LAYOUT_PREFIX = "block-";
|
|
130
|
-
exports.MAX_JSON_DEPTH = 100;
|
|
131
|
-
const OPENERS = new Set(["{", "["]);
|
|
132
|
-
const CLOSERS = new Set(["}", "]"]);
|
|
133
|
-
function jsonDepth(text) {
|
|
134
|
-
let depth = 0;
|
|
135
|
-
let deepest = 0;
|
|
136
|
-
let inString = false;
|
|
137
|
-
let escaped = false;
|
|
138
|
-
for (const char of text) {
|
|
139
|
-
if (inString) {
|
|
140
|
-
if (escaped)
|
|
141
|
-
escaped = false;
|
|
142
|
-
else if (char === "\\")
|
|
143
|
-
escaped = true;
|
|
144
|
-
else if (char === '"')
|
|
145
|
-
inString = false;
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
if (char === '"')
|
|
149
|
-
inString = true;
|
|
150
|
-
else if (OPENERS.has(char))
|
|
151
|
-
deepest = Math.max(deepest, ++depth);
|
|
152
|
-
else if (CLOSERS.has(char))
|
|
153
|
-
depth -= 1;
|
|
154
|
-
}
|
|
155
|
-
return deepest;
|
|
156
|
-
}
|
|
157
|
-
function compileTree(page, pointer, scope) {
|
|
158
|
-
return page.tree.map((node, index) => compileNode(node, `${pointer}/tree/${index}`, `${ROOT_LAYOUT_PREFIX}${index}`, scope));
|
|
159
|
-
}
|
|
160
|
-
function compileCustomPage(page, pointer, scope) {
|
|
161
|
-
const fields = {};
|
|
162
|
-
for (const field of model_1.CUSTOM_PAGE_FIELDS) {
|
|
163
|
-
const value = page[field];
|
|
164
|
-
if (value !== undefined)
|
|
165
|
-
fields[field] = value;
|
|
166
|
-
}
|
|
167
|
-
return [(0, sketch_1.compileSketchPage)(fields, pointer, scope.issues, (0, page_links_1.sketchLinks)(scope))];
|
|
168
|
-
}
|
|
169
|
-
function pageGraph(pages) {
|
|
170
|
-
return new Map(pages.map((page) => [
|
|
171
|
-
page.id,
|
|
172
|
-
{
|
|
173
|
-
...(page.parent !== undefined && { parent: page.parent }),
|
|
174
|
-
...(page.route !== undefined && { param: page.route.slice(1) }),
|
|
175
|
-
},
|
|
176
|
-
]));
|
|
177
|
-
}
|
|
178
|
-
function ancestorsOf(id, graph) {
|
|
179
|
-
const found = [];
|
|
180
|
-
for (let at = graph.get(id)?.parent; at !== undefined;) {
|
|
181
|
-
if (at === id || found.includes(at) || !graph.has(at))
|
|
182
|
-
break;
|
|
183
|
-
found.push(at);
|
|
184
|
-
at = graph.get(at)?.parent;
|
|
185
|
-
}
|
|
186
|
-
return found;
|
|
187
|
-
}
|
|
188
|
-
function scopeOf(page, spec, { issues, warnings }) {
|
|
189
|
-
const ancestors = ancestorsOf(page.id, spec.graph).map((id) => ({ id, fixtures: spec.fixtures.get(id) ?? {} }));
|
|
190
|
-
const param = spec.graph.get(page.id)?.param;
|
|
191
|
-
return {
|
|
192
|
-
catalog: spec.catalog,
|
|
193
|
-
issues,
|
|
194
|
-
warnings,
|
|
195
|
-
name: spec.name,
|
|
196
|
-
pageId: page.id,
|
|
197
|
-
fixtures: spec.fixtures.get(page.id) ?? {},
|
|
198
|
-
pages: spec.graph,
|
|
199
|
-
links: new Set(),
|
|
200
|
-
generatedPages: [],
|
|
201
|
-
ancestors,
|
|
202
|
-
answers: spec.answers,
|
|
203
|
-
...(param !== undefined && { route: { param } }),
|
|
204
|
-
paths: {},
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
function compilePage(page, pointer, spec) {
|
|
208
|
-
const pageScope = scopeOf(page, spec, spec);
|
|
209
|
-
const isCustom = page.custom === true;
|
|
210
|
-
const tree = isCustom
|
|
211
|
-
? compileCustomPage(page, pointer, pageScope)
|
|
212
|
-
: compileTree(page, pointer, pageScope);
|
|
213
|
-
const headerActions = page.headerActions &&
|
|
214
|
-
(0, page_links_1.headerActionLinks)(page.headerActions, `${pointer}/headerActions`, pageScope);
|
|
215
|
-
const state = {
|
|
216
|
-
id: page.id,
|
|
217
|
-
title: page.title,
|
|
218
|
-
options: page.options ?? {},
|
|
219
|
-
links: [...spec.graph.keys()].filter((id) => pageScope.links.has(id)),
|
|
220
|
-
tree,
|
|
221
|
-
paths: pageScope.paths,
|
|
222
|
-
};
|
|
223
|
-
spec.generated.push(...pageScope.generatedPages.map((generated) => ({
|
|
224
|
-
id: generated.id,
|
|
225
|
-
title: generated.title,
|
|
226
|
-
description: generated.description,
|
|
227
|
-
options: page.options ?? {},
|
|
228
|
-
links: [],
|
|
229
|
-
tree: generated.tree,
|
|
230
|
-
paths: {},
|
|
231
|
-
menu: false,
|
|
232
|
-
generated: true,
|
|
233
|
-
parent: page.id,
|
|
234
|
-
...(generated.route && { route: generated.route }),
|
|
235
|
-
})));
|
|
236
|
-
if (page.liveRoutes && !isCustom) {
|
|
237
|
-
state.realTree = compileTree(page, pointer, {
|
|
238
|
-
...scopeOf(page, spec, { issues: [], warnings: [] }),
|
|
239
|
-
routes: page.liveRoutes,
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
if (pageScope.route)
|
|
243
|
-
state.route = pageScope.route;
|
|
244
|
-
if (page.menu === false)
|
|
245
|
-
state.menu = false;
|
|
246
|
-
if (isCustom)
|
|
247
|
-
state.custom = true;
|
|
248
|
-
if (page.parent !== undefined)
|
|
249
|
-
state.parent = page.parent;
|
|
250
|
-
if (page.category !== undefined)
|
|
251
|
-
state.category = page.category;
|
|
252
|
-
if (page.icon !== undefined)
|
|
253
|
-
state.icon = page.icon;
|
|
254
|
-
if (page.description !== undefined)
|
|
255
|
-
state.description = page.description;
|
|
256
|
-
if (headerActions)
|
|
257
|
-
state.headerActions = headerActions;
|
|
258
|
-
if (page.layout)
|
|
259
|
-
state.layout = page.layout;
|
|
260
|
-
if (page.livePage)
|
|
261
|
-
state.livePage = { ref: page.livePage.ref };
|
|
262
|
-
return state;
|
|
263
|
-
}
|
|
264
20
|
const STYLE_GROUPS = new Set([
|
|
265
21
|
"appearance",
|
|
266
22
|
"layout",
|
|
@@ -294,7 +50,7 @@ function openOracle(name, pageId) {
|
|
|
294
50
|
answers: (0, fixture_answers_1.fixtureAnswers)([], () => false),
|
|
295
51
|
paths: {},
|
|
296
52
|
};
|
|
297
|
-
compileNode(node, "", `${ROOT_LAYOUT_PREFIX}0`, scope);
|
|
53
|
+
(0, compile_nodes_1.compileNode)(node, "", `${compile_nodes_1.ROOT_LAYOUT_PREFIX}0`, scope);
|
|
298
54
|
return scope.issues;
|
|
299
55
|
},
|
|
300
56
|
sampleOf(type) {
|
|
@@ -304,23 +60,32 @@ function openOracle(name, pageId) {
|
|
|
304
60
|
};
|
|
305
61
|
}
|
|
306
62
|
function compileSpec(name, spec, now = Date.now()) {
|
|
307
|
-
const
|
|
63
|
+
const pages = (0, places_1.parentsAtLeads)(spec.pages.map((page, index) => ({
|
|
64
|
+
...page,
|
|
65
|
+
pointer: `/pages/${index}`,
|
|
66
|
+
})));
|
|
67
|
+
const entries = (0, places_1.placePages)(spec.modules ?? [], pages);
|
|
68
|
+
const fixtures = new Map(pages.map((page) => [
|
|
308
69
|
page.id,
|
|
309
70
|
(0, generate_1.materializeFixtures)(name, page.id, page.fixtures ?? {}, now),
|
|
310
71
|
]));
|
|
311
72
|
const catalog = (0, block_catalog_1.readCatalog)();
|
|
73
|
+
const issues = [];
|
|
312
74
|
const scope = {
|
|
313
75
|
catalog,
|
|
314
|
-
issues
|
|
76
|
+
issues,
|
|
315
77
|
warnings: [],
|
|
316
78
|
name,
|
|
317
|
-
|
|
79
|
+
layouts: (0, compile_layouts_1.compileLayouts)(spec.layouts ?? [], issues),
|
|
80
|
+
graph: (0, compile_pages_1.pageGraph)(entries.map((entry) => (0, places_1.leadOf)(entry))),
|
|
318
81
|
fixtures,
|
|
319
82
|
generated: [],
|
|
320
|
-
answers: (0, fixture_answers_1.fixtureAnswers)(
|
|
83
|
+
answers: (0, fixture_answers_1.fixtureAnswers)(pages, (node) => (0, block_catalog_1.descriptorOf)(node, catalog)?.type === "PeriodSelector"),
|
|
321
84
|
};
|
|
322
|
-
const
|
|
323
|
-
|
|
85
|
+
const compiled = entries.map((entry) => (0, compile_pages_1.compileEntry)(entry, scope));
|
|
86
|
+
compiled.push(...scope.generated);
|
|
87
|
+
const entities = (0, entities_1.compileEntities)(spec);
|
|
88
|
+
const modules = (0, module_states_1.moduleStates)(spec.modules ?? []);
|
|
324
89
|
return {
|
|
325
90
|
title: spec.title,
|
|
326
91
|
categories: spec.categories,
|
|
@@ -328,46 +93,23 @@ function compileSpec(name, spec, now = Date.now()) {
|
|
|
328
93
|
spec.sidebar.widgets.length > 0 && {
|
|
329
94
|
sidebar: (0, sidebar_1.compileSidebar)(spec.sidebar, scope.issues),
|
|
330
95
|
}),
|
|
331
|
-
...(
|
|
332
|
-
|
|
333
|
-
|
|
96
|
+
...(modules.length > 0 && { modules }),
|
|
97
|
+
...(entities && { entities }),
|
|
98
|
+
...(spec.fixtures && { tenants: spec.fixtures.tenants }),
|
|
99
|
+
...(spec.data && { connection: spec.data.connection }),
|
|
100
|
+
pages: compiled,
|
|
334
101
|
fixtures,
|
|
102
|
+
tenantFixtures: (0, tenancy_1.tenantFixtures)(spec),
|
|
335
103
|
issues: [
|
|
336
104
|
...scope.issues,
|
|
337
105
|
...(0, table_title_1.tableCaptionIssues)(spec),
|
|
338
106
|
...(0, form_page_modes_1.formPageModeIssues)(spec),
|
|
339
107
|
...(0, data_access_1.readOnlyConnectionIssues)(spec),
|
|
108
|
+
...(0, entities_1.entityIssues)(spec),
|
|
109
|
+
...(0, tenancy_1.tenantIssues)(spec),
|
|
340
110
|
...(0, anchor_1.stampedIdIssues)(spec),
|
|
341
111
|
],
|
|
342
112
|
warnings: [...scope.warnings, ...scope.answers.warnings],
|
|
343
113
|
};
|
|
344
114
|
}
|
|
345
|
-
function parseSpec(text) {
|
|
346
|
-
let raw;
|
|
347
|
-
try {
|
|
348
|
-
raw = JSON.parse(text);
|
|
349
|
-
}
|
|
350
|
-
catch (error) {
|
|
351
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
352
|
-
return {
|
|
353
|
-
ok: false,
|
|
354
|
-
issues: [{ path: "", message: `invalid JSON: ${message}` }],
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
if (jsonDepth(text) > exports.MAX_JSON_DEPTH) {
|
|
358
|
-
return {
|
|
359
|
-
ok: false,
|
|
360
|
-
issues: [
|
|
361
|
-
{
|
|
362
|
-
path: "",
|
|
363
|
-
message: `the spec nests deeper than ${exports.MAX_JSON_DEPTH} levels`,
|
|
364
|
-
},
|
|
365
|
-
],
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
const parsed = model_1.specSchema.safeParse(raw, { error: validation_1.allowedKeysError });
|
|
369
|
-
return parsed.success
|
|
370
|
-
? { ok: true, spec: parsed.data }
|
|
371
|
-
: { ok: false, issues: (0, model_1.zodIssues)("", parsed.error) };
|
|
372
|
-
}
|
|
373
115
|
//# sourceMappingURL=compile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/mockup/compile.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAiD;AACjD,qCAA2C;AAC3C,mDAA0E;AAC1E,2DAAwD;AACxD,+CAAyD;AAEzD,yCAA2C;AAC3C,uDAK2B;AAC3B,+CAAgD;AAChD,uDAAuD;AACvD,yCAAiD;AAcjD,mCAAoE;AACpE,uCAA2C;AAC3C,6CAA+E;AAC/E,mDAAoD;AACpD,uCAA2C;AAC3C,qCAAyE;AACzE,+CAAmD;AACnD,yCAIoB;AAmBpB,SAAS,eAAe,CACtB,IAAgB,EAChB,OAAe,EACf,UAAkB,EA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,CAAC;QACxD,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;QACtD,KAAK,EAAE,QAAQ;QACf,QAAQ;QACR,cAAc,EAAE,IAAA,wBAAc,EAAC,IAAI,CAAC;QACpC,MAAM,EAAE;YACN,GAAG,KAAK,CAAC,MAAM;YACf,GAAG,IAAA,gCAAkB,EAAC,IAAI,CAAC;YAC3B,GAAG,IAAA,oCAAkB,EAAC,IAAI,CAAC;YAC3B,GAAG,IAAA,sCAAwB,EAAC,IAAI,CAAC;YACjC,GAAG,IAAA,uBAAY,EAAC,IAAI,CAAC;YACrB,GAAG,IAAA,sBAAY,EAAC,IAAI,CAAC;YACrB,GAAG,IAAA,wBAAe,EAAC,IAAI,CAAC;SACzB;QACD,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;KACzD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MockupNamed } from "./manage";
|
|
2
|
+
export declare const MOCKUP_TEMPLATES: readonly ["blank", "example"];
|
|
3
|
+
export type MockupTemplate = (typeof MOCKUP_TEMPLATES)[number];
|
|
4
|
+
export interface MockupCreation {
|
|
5
|
+
title: string;
|
|
6
|
+
template: MockupTemplate;
|
|
7
|
+
}
|
|
8
|
+
export type CreateRefusal = {
|
|
9
|
+
kind: "no_free_name";
|
|
10
|
+
} | {
|
|
11
|
+
kind: "no_template";
|
|
12
|
+
};
|
|
13
|
+
export type CreateResult = ({
|
|
14
|
+
kind: "done";
|
|
15
|
+
} & MockupNamed) | CreateRefusal;
|
|
16
|
+
export declare function createMockup(mockupsDir: string, request: MockupCreation): Promise<CreateResult>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MOCKUP_TEMPLATES = void 0;
|
|
4
|
+
exports.createMockup = createMockup;
|
|
5
|
+
const node_crypto_1 = require("node:crypto");
|
|
6
|
+
const promises_1 = require("node:fs/promises");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const example_1 = require("./example");
|
|
9
|
+
const files_1 = require("./files");
|
|
10
|
+
const model_1 = require("./model");
|
|
11
|
+
const JSON_INDENT = 2;
|
|
12
|
+
const MAX_CREATE_ATTEMPTS = 100;
|
|
13
|
+
const MAX_STEM_LENGTH = 48;
|
|
14
|
+
const FALLBACK_STEM = "mockup";
|
|
15
|
+
const TEMPORARY_SUFFIX = ".tmp";
|
|
16
|
+
const EXISTING_DIRECTORY = "EEXIST";
|
|
17
|
+
exports.MOCKUP_TEMPLATES = ["blank", "example"];
|
|
18
|
+
const TEMPLATES = {
|
|
19
|
+
blank: (title) => Promise.resolve({
|
|
20
|
+
version: 1,
|
|
21
|
+
title,
|
|
22
|
+
pages: [{ id: "home", title: "Home", tree: [] }],
|
|
23
|
+
}),
|
|
24
|
+
example: async (title) => {
|
|
25
|
+
const example = await (0, example_1.readExampleSpec)();
|
|
26
|
+
return example && { ...example, title };
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
function withoutAccents(text) {
|
|
30
|
+
return text.normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
31
|
+
}
|
|
32
|
+
function* candidateNames(title) {
|
|
33
|
+
const stem = (0, model_1.slugOfText)(withoutAccents(title).toLowerCase(), MAX_STEM_LENGTH) ||
|
|
34
|
+
FALLBACK_STEM;
|
|
35
|
+
for (let attempt = 1; attempt <= MAX_CREATE_ATTEMPTS; attempt++) {
|
|
36
|
+
const name = (0, model_1.parseMockupName)(attempt === 1 ? stem : `${stem}-${attempt}`);
|
|
37
|
+
if (name)
|
|
38
|
+
yield name;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function createMockup(mockupsDir, request) {
|
|
42
|
+
const spec = await TEMPLATES[request.template](request.title);
|
|
43
|
+
if (!spec)
|
|
44
|
+
return { kind: "no_template" };
|
|
45
|
+
await (0, promises_1.mkdir)(mockupsDir, { recursive: true });
|
|
46
|
+
const staging = (0, node_path_1.join)(mockupsDir, `.create-${(0, node_crypto_1.randomBytes)(6).toString("hex")}${TEMPORARY_SUFFIX}`);
|
|
47
|
+
const staged = (0, node_path_1.join)(staging, files_1.SPEC_FILE);
|
|
48
|
+
try {
|
|
49
|
+
await (0, promises_1.mkdir)(staging);
|
|
50
|
+
await (0, promises_1.writeFile)(staged, `${JSON.stringify(spec, null, JSON_INDENT)}\n`, "utf8");
|
|
51
|
+
for (const name of candidateNames(request.title)) {
|
|
52
|
+
const directory = (0, files_1.mockupDirectory)(mockupsDir, name);
|
|
53
|
+
try {
|
|
54
|
+
await (0, promises_1.mkdir)(directory);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
if ((0, files_1.parseFsError)(error).code === EXISTING_DIRECTORY)
|
|
58
|
+
continue;
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
await (0, promises_1.link)(staged, (0, node_path_1.join)(directory, files_1.SPEC_FILE));
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if ((0, files_1.parseFsError)(error).code === EXISTING_DIRECTORY)
|
|
66
|
+
continue;
|
|
67
|
+
await (0, promises_1.rmdir)(directory).catch(() => undefined);
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
return { kind: "done", name };
|
|
71
|
+
}
|
|
72
|
+
return { kind: "no_free_name" };
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
await (0, promises_1.rm)(staging, { recursive: true, force: true });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/mockup/create.ts"],"names":[],"mappings":";;;;AAAA,6CAA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C,CAAC,IAAI,KAAK,kBAAkB;oBAAE,SAAS;gBAC9D,MAAM,KAAK,CAAC;YACd,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,IAAA,eAAI,EAAC,MAAM,EAAE,IAAA,gBAAI,EAAC,SAAS,EAAE,iBAAS,CAAC,CAAC,CAAC;YACjD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC,IAAI,KAAK,kBAAkB;oBAAE,SAAS;gBAC9D,MAAM,IAAA,gBAAK,EAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;gBAC9C,MAAM,KAAK,CAAC;YACd,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAChC,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IAClC,CAAC;YAAS,CAAC;QACT,MAAM,IAAA,aAAE,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { MockupName } from "./model";
|
|
2
|
+
export interface MockupCreated {
|
|
3
|
+
name: MockupName;
|
|
4
|
+
title?: string;
|
|
5
|
+
}
|
|
6
|
+
export type MockupCreatedListener = (created: MockupCreated) => void;
|
|
7
|
+
export declare class CreatedWatcher {
|
|
8
|
+
private readonly mockupsDir;
|
|
9
|
+
private readonly readSpec;
|
|
10
|
+
private watch;
|
|
11
|
+
constructor(mockupsDir: string, readSpec: (name: MockupName) => Promise<string | undefined>);
|
|
12
|
+
subscribe(listener: MockupCreatedListener): Promise<() => void>;
|
|
13
|
+
close(): void;
|
|
14
|
+
private start;
|
|
15
|
+
private stop;
|
|
16
|
+
private specNames;
|
|
17
|
+
private scan;
|
|
18
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreatedWatcher = void 0;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
7
|
+
const files_1 = require("./files");
|
|
8
|
+
const model_1 = require("./model");
|
|
9
|
+
const summary_fields_1 = require("./summary-fields");
|
|
10
|
+
const CREATED_POLL_MS = 500;
|
|
11
|
+
class CreatedWatcher {
|
|
12
|
+
mockupsDir;
|
|
13
|
+
readSpec;
|
|
14
|
+
watch;
|
|
15
|
+
constructor(mockupsDir, readSpec) {
|
|
16
|
+
this.mockupsDir = mockupsDir;
|
|
17
|
+
this.readSpec = readSpec;
|
|
18
|
+
}
|
|
19
|
+
async subscribe(listener) {
|
|
20
|
+
const watched = this.watch ?? (await this.start());
|
|
21
|
+
watched.listeners.add(listener);
|
|
22
|
+
return () => {
|
|
23
|
+
watched.listeners.delete(listener);
|
|
24
|
+
if (!watched.listeners.size)
|
|
25
|
+
this.stop(watched);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
close() {
|
|
29
|
+
if (this.watch)
|
|
30
|
+
this.stop(this.watch);
|
|
31
|
+
}
|
|
32
|
+
async start() {
|
|
33
|
+
const known = new Set(await this.specNames());
|
|
34
|
+
if (this.watch)
|
|
35
|
+
return this.watch;
|
|
36
|
+
const watched = {
|
|
37
|
+
listeners: new Set(),
|
|
38
|
+
known,
|
|
39
|
+
scanning: false,
|
|
40
|
+
timer: setInterval(() => void this.scan(watched), CREATED_POLL_MS),
|
|
41
|
+
};
|
|
42
|
+
watched.timer.unref();
|
|
43
|
+
this.watch = watched;
|
|
44
|
+
return watched;
|
|
45
|
+
}
|
|
46
|
+
stop(watched) {
|
|
47
|
+
clearInterval(watched.timer);
|
|
48
|
+
if (this.watch === watched)
|
|
49
|
+
this.watch = undefined;
|
|
50
|
+
}
|
|
51
|
+
async specNames() {
|
|
52
|
+
let entries;
|
|
53
|
+
try {
|
|
54
|
+
entries = await (0, promises_1.readdir)(this.mockupsDir);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
if ((0, files_1.parseFsError)(error).code === files_1.MISSING_FILE)
|
|
58
|
+
return [];
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
const names = await Promise.all(entries.map(async (entry) => {
|
|
62
|
+
const name = (0, model_1.parseMockupName)(entry);
|
|
63
|
+
if (!name)
|
|
64
|
+
return undefined;
|
|
65
|
+
try {
|
|
66
|
+
await (0, promises_1.stat)((0, node_path_1.join)((0, files_1.mockupDirectory)(this.mockupsDir, name), files_1.SPEC_FILE));
|
|
67
|
+
return name;
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if ((0, files_1.parseFsError)(error).code === files_1.MISSING_FILE)
|
|
71
|
+
return undefined;
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
}));
|
|
75
|
+
return names.flatMap((name) => name ?? []);
|
|
76
|
+
}
|
|
77
|
+
async scan(watched) {
|
|
78
|
+
if (watched.scanning)
|
|
79
|
+
return;
|
|
80
|
+
watched.scanning = true;
|
|
81
|
+
try {
|
|
82
|
+
const names = await this.specNames();
|
|
83
|
+
const present = new Set(names);
|
|
84
|
+
for (const name of watched.known) {
|
|
85
|
+
if (!present.has(name))
|
|
86
|
+
watched.known.delete(name);
|
|
87
|
+
}
|
|
88
|
+
for (const name of names) {
|
|
89
|
+
if (watched.known.has(name))
|
|
90
|
+
continue;
|
|
91
|
+
const text = await this.readSpec(name);
|
|
92
|
+
watched.known.add(name);
|
|
93
|
+
const created = { name };
|
|
94
|
+
const title = text === undefined ? "" : (0, summary_fields_1.readSummaryFields)(text).title;
|
|
95
|
+
if (title)
|
|
96
|
+
created.title = title;
|
|
97
|
+
for (const listener of watched.listeners)
|
|
98
|
+
listener(created);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
logging_1.Logging.Warn("[DMS] the mockups directory could not be read", error);
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
watched.scanning = false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.CreatedWatcher = CreatedWatcher;
|
|
110
|
+
//# sourceMappingURL=created-watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"created-watch.js","sourceRoot":"","sources":["../../src/mockup/created-watch.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AACjD,yCAAiC;AACjC,gEAA6D;AAC7D,mCAKiB;AAEjB,mCAA0C;AAC1C,qDAAqD;AAGrD,MAAM,eAAe,GAAG,GAAG,CAAC;AAyB5B;IAIqB,UAAU;IACV,QAAQ;IAJnB,KAAK,CAA2B;IAExC,YACmB,UAAkB,EAClB,QAEe;0BAHf,UAAU;wBACV,QAAQ;IAGxB,CAAC;IAGJ,KAAK,CAAC,SAAS,CAAC,QAA+B;QAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACnD,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAChC,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACnC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI;gBAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC,CAAC;IACJ,CAAC;IAGD,KAAK;QACH,IAAI,IAAI,CAAC,KAAK;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAEO,KAAK,CAAC,KAAK;QACjB,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,SAAS,EAA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