@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
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import type { isObject } from "../../../../dms-core/app/utils/type-check";
|
|
2
|
+
import { isNumber, isString } from "../../../../dms-core/app/utils/type-check";
|
|
3
|
+
import {
|
|
4
|
+
isPageState,
|
|
5
|
+
parseMockupState,
|
|
6
|
+
type MockupPageState,
|
|
7
|
+
type MockupState,
|
|
8
|
+
} from "./mockup";
|
|
9
|
+
import { isRecord } from "./recordGuards";
|
|
10
|
+
|
|
11
|
+
/** The keys of a state besides its name, revision and pages. */
|
|
12
|
+
type FieldKey = Exclude<keyof MockupState, "name" | "revision" | "pages">;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* `fields` as the tuple it is, when it lists every {@link FieldKey}: a key
|
|
16
|
+
* added to {@link MockupState} and left out of the list is an argument of
|
|
17
|
+
* type `never`, so the file stops compiling.
|
|
18
|
+
*/
|
|
19
|
+
function allFields<const Listed extends readonly FieldKey[]>(
|
|
20
|
+
fields: Listed &
|
|
21
|
+
([Exclude<FieldKey, Listed[number]>] extends [never] ? unknown : never),
|
|
22
|
+
): Listed {
|
|
23
|
+
return fields;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** The keys of a state besides its name, revision and pages: each is sent whole when it changed. */
|
|
27
|
+
const STATE_FIELDS = allFields([
|
|
28
|
+
"title",
|
|
29
|
+
"categories",
|
|
30
|
+
"sidebar",
|
|
31
|
+
"modules",
|
|
32
|
+
"entities",
|
|
33
|
+
"tenants",
|
|
34
|
+
"connection",
|
|
35
|
+
"issues",
|
|
36
|
+
"warnings",
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
type StateField = (typeof STATE_FIELDS)[number];
|
|
40
|
+
|
|
41
|
+
/** The fields a state can lose: every one but its issues, which it always lists. */
|
|
42
|
+
type DroppableField = Exclude<StateField, "issues">;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* What changed from the state the stream sent last to the state now: the
|
|
46
|
+
* revision it was diffed against, the revision it leads to, the fields that
|
|
47
|
+
* changed, and for the pages the ones that changed or came whole, the ids of
|
|
48
|
+
* the ones that went, and the ids in order when the order changed.
|
|
49
|
+
*/
|
|
50
|
+
export interface MockupStatePatch {
|
|
51
|
+
/** The revision of the state the patch applies to, and only to. */
|
|
52
|
+
from: number;
|
|
53
|
+
revision: number;
|
|
54
|
+
set?: Partial<Pick<MockupState, StateField>>;
|
|
55
|
+
unset?: DroppableField[];
|
|
56
|
+
pages?: {
|
|
57
|
+
changed: MockupPageState[];
|
|
58
|
+
removed: string[];
|
|
59
|
+
order?: string[];
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const FIELD_NAMES: ReadonlySet<string> = new Set(STATE_FIELDS);
|
|
64
|
+
|
|
65
|
+
function isField(value: Parameters<typeof isString>[0]): value is StateField {
|
|
66
|
+
return isString(value) && FIELD_NAMES.has(value);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function isDroppable(
|
|
70
|
+
value: Parameters<typeof isString>[0],
|
|
71
|
+
): value is DroppableField {
|
|
72
|
+
return isField(value) && value !== "issues";
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The fields a patch sets, each as a state holds it, or undefined when one is no such value. */
|
|
76
|
+
function parseSet(
|
|
77
|
+
set: Parameters<typeof isObject>[0],
|
|
78
|
+
): MockupStatePatch["set"] | undefined {
|
|
79
|
+
if (!isRecord(set) || !Object.keys(set).every(isField)) return undefined;
|
|
80
|
+
const parsed = parseMockupState({
|
|
81
|
+
name: "patch",
|
|
82
|
+
revision: 0,
|
|
83
|
+
pages: [],
|
|
84
|
+
issues: [],
|
|
85
|
+
...set,
|
|
86
|
+
});
|
|
87
|
+
if (!parsed) return undefined;
|
|
88
|
+
return Object.fromEntries(
|
|
89
|
+
Object.keys(set).flatMap((field) =>
|
|
90
|
+
isField(field) ? [[field, parsed[field]]] : [],
|
|
91
|
+
),
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function parsePages(
|
|
96
|
+
pages: Parameters<typeof isObject>[0],
|
|
97
|
+
): MockupStatePatch["pages"] | undefined {
|
|
98
|
+
if (!isRecord(pages)) return undefined;
|
|
99
|
+
const { changed, removed, order } = pages;
|
|
100
|
+
const isIds = (ids: Parameters<typeof isObject>[0]) =>
|
|
101
|
+
Array.isArray(ids) && ids.every(isString);
|
|
102
|
+
if (
|
|
103
|
+
!Array.isArray(changed) ||
|
|
104
|
+
!changed.every(isPageState) ||
|
|
105
|
+
!isIds(removed) ||
|
|
106
|
+
!Array.isArray(removed) ||
|
|
107
|
+
(order !== undefined && !isIds(order))
|
|
108
|
+
) {
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
changed,
|
|
113
|
+
removed: removed.filter(isString),
|
|
114
|
+
...(Array.isArray(order) && { order: order.filter(isString) }),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** The patch a stream event carries, or undefined when the data is not one. */
|
|
119
|
+
export function parseStatePatch(
|
|
120
|
+
value: Parameters<typeof isObject>[0],
|
|
121
|
+
): MockupStatePatch | undefined {
|
|
122
|
+
if (!isRecord(value) || !isNumber(value.revision) || !isNumber(value.from)) {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
const set = value.set === undefined ? undefined : parseSet(value.set);
|
|
126
|
+
const pages = value.pages === undefined ? undefined : parsePages(value.pages);
|
|
127
|
+
const unset = value.unset;
|
|
128
|
+
const isValid =
|
|
129
|
+
(value.set === undefined || set !== undefined) &&
|
|
130
|
+
(value.pages === undefined || pages !== undefined) &&
|
|
131
|
+
(unset === undefined || (Array.isArray(unset) && unset.every(isDroppable)));
|
|
132
|
+
if (!isValid) return undefined;
|
|
133
|
+
return {
|
|
134
|
+
from: value.from,
|
|
135
|
+
revision: value.revision,
|
|
136
|
+
...(set && { set }),
|
|
137
|
+
...(Array.isArray(unset) && { unset: unset.filter(isDroppable) }),
|
|
138
|
+
...(pages && { pages }),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** The pages of `state` with `patch` applied, an unchanged page being the object it was. */
|
|
143
|
+
function patchedPages(
|
|
144
|
+
state: MockupState,
|
|
145
|
+
pages: NonNullable<MockupStatePatch["pages"]>,
|
|
146
|
+
): MockupPageState[] | undefined {
|
|
147
|
+
const byId = new Map(state.pages.map((page) => [page.id, page]));
|
|
148
|
+
for (const id of pages.removed) byId.delete(id);
|
|
149
|
+
for (const page of pages.changed) byId.set(page.id, page);
|
|
150
|
+
const order = pages.order ?? state.pages.map((page) => page.id);
|
|
151
|
+
const ordered = order.flatMap((id) => byId.get(id) ?? []);
|
|
152
|
+
return ordered.length === order.length ? ordered : undefined;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* `state` as `patch` changes it: the new revision, the fields it sets and
|
|
157
|
+
* drops, and the pages it changes, adds, removes and reorders. Every page the
|
|
158
|
+
* patch leaves alone is the object `state` already held, so nothing that
|
|
159
|
+
* watches it fires. Undefined when `state` is not the revision the patch was
|
|
160
|
+
* diffed against, or the patch names a page `state` has not and the patch does
|
|
161
|
+
* not bring: the viewer then opens the stream again, which sends the state
|
|
162
|
+
* whole.
|
|
163
|
+
*/
|
|
164
|
+
export function applyStatePatch(
|
|
165
|
+
state: MockupState,
|
|
166
|
+
patch: MockupStatePatch,
|
|
167
|
+
): MockupState | undefined {
|
|
168
|
+
if (patch.from !== state.revision) return undefined;
|
|
169
|
+
const pages = patch.pages ? patchedPages(state, patch.pages) : state.pages;
|
|
170
|
+
if (!pages) return undefined;
|
|
171
|
+
const next: MockupState = {
|
|
172
|
+
...state,
|
|
173
|
+
...patch.set,
|
|
174
|
+
pages,
|
|
175
|
+
revision: patch.revision,
|
|
176
|
+
};
|
|
177
|
+
for (const field of patch.unset ?? []) Reflect.deleteProperty(next, field);
|
|
178
|
+
return next;
|
|
179
|
+
}
|
|
@@ -3,12 +3,13 @@ import { isString } from "../../../../dms-core/app/utils/type-check";
|
|
|
3
3
|
import { isJsonValue } from "./json";
|
|
4
4
|
import {
|
|
5
5
|
MOCKUP_ANNOTATIONS_EVENT,
|
|
6
|
+
MOCKUP_PATCH_EVENT,
|
|
6
7
|
MOCKUP_STATE_EVENT,
|
|
7
|
-
parseAnnotations,
|
|
8
8
|
parseMockupState,
|
|
9
|
-
type MockupAnnotation,
|
|
10
9
|
type MockupState,
|
|
11
10
|
} from "./mockup";
|
|
11
|
+
import { parseAnnotations, type MockupAnnotation } from "./mockupAnnotations";
|
|
12
|
+
import { type MockupStatePatch, parseStatePatch } from "./mockupStatePatch";
|
|
12
13
|
import {
|
|
13
14
|
MOCKUP_PRESENCE_EVENT,
|
|
14
15
|
parseMockupPresence,
|
|
@@ -18,7 +19,10 @@ import {
|
|
|
18
19
|
const REOPEN_DELAY_MS = 2000;
|
|
19
20
|
|
|
20
21
|
export interface MockupStreamHandlers {
|
|
22
|
+
/** The state, whole: on connect, and again when the stream reconnects. */
|
|
21
23
|
onState: (state: MockupState) => void;
|
|
24
|
+
/** What changed since the last state or patch the stream sent, which the patch names by its `from`. */
|
|
25
|
+
onPatch: (patch: MockupStatePatch) => void;
|
|
22
26
|
onAnnotations: (annotations: MockupAnnotation[]) => void;
|
|
23
27
|
/** Who is on the mockup and which blocks they hold, on connect and after each change. */
|
|
24
28
|
onPresence: (presence: MockupPresence) => void;
|
|
@@ -28,6 +32,8 @@ export interface MockupStreamHandlers {
|
|
|
28
32
|
|
|
29
33
|
export interface MockupStream {
|
|
30
34
|
close: () => void;
|
|
35
|
+
/** Opens the stream again at once: the server sends the state whole on connect. */
|
|
36
|
+
reopen: () => void;
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
interface StreamState {
|
|
@@ -72,6 +78,10 @@ function open(state: StreamState): void {
|
|
|
72
78
|
const mockup = parseMockupState(readJson(event));
|
|
73
79
|
if (mockup) state.handlers.onState(mockup);
|
|
74
80
|
});
|
|
81
|
+
source.addEventListener(MOCKUP_PATCH_EVENT, (event) => {
|
|
82
|
+
const patch = parseStatePatch(readJson(event));
|
|
83
|
+
if (patch) state.handlers.onPatch(patch);
|
|
84
|
+
});
|
|
75
85
|
source.addEventListener(MOCKUP_ANNOTATIONS_EVENT, (event) => {
|
|
76
86
|
const annotations = parseAnnotations(readJson(event));
|
|
77
87
|
if (annotations) state.handlers.onAnnotations(annotations);
|
|
@@ -103,6 +113,11 @@ export function openMockupStream(
|
|
|
103
113
|
};
|
|
104
114
|
open(state);
|
|
105
115
|
return {
|
|
116
|
+
reopen: () => {
|
|
117
|
+
if (state.reopenTimer) clearTimeout(state.reopenTimer);
|
|
118
|
+
state.reopenTimer = null;
|
|
119
|
+
open(state);
|
|
120
|
+
},
|
|
106
121
|
close: () => {
|
|
107
122
|
state.isClosed = true;
|
|
108
123
|
if (state.reopenTimer) clearTimeout(state.reopenTimer);
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { PreviewNode } from "./blockPreview";
|
|
2
|
+
import type {
|
|
3
|
+
PreviewHiddenRows,
|
|
4
|
+
PreviewWorkspace,
|
|
5
|
+
} from "./blockPreviewNavigation";
|
|
6
|
+
import {
|
|
7
|
+
isWritableObject,
|
|
8
|
+
type JsonWritable,
|
|
9
|
+
type JsonWritableObject,
|
|
10
|
+
} from "./json";
|
|
11
|
+
import { isString } from "../../../../dms-core/app/utils/type-check";
|
|
12
|
+
import { mockupEndpoint } from "./mockup";
|
|
13
|
+
import type { MockupEntityState } from "./mockupEntities";
|
|
14
|
+
import type { MockupTenant } from "./mockupTenants";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The tenant SaaS mode shows: `preferred` while the spec still lists it, else
|
|
18
|
+
* the first one; undefined when the spec lists none.
|
|
19
|
+
*/
|
|
20
|
+
export function activeTenantId(
|
|
21
|
+
tenants: readonly MockupTenant[],
|
|
22
|
+
preferred: string | undefined,
|
|
23
|
+
): string | undefined {
|
|
24
|
+
return tenants.some((tenant) => tenant.id === preferred)
|
|
25
|
+
? preferred
|
|
26
|
+
: tenants[0]?.id;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function scopedFields(
|
|
30
|
+
fields: JsonWritableObject,
|
|
31
|
+
from: string,
|
|
32
|
+
to: string,
|
|
33
|
+
): JsonWritableObject {
|
|
34
|
+
return Object.fromEntries(
|
|
35
|
+
Object.entries(fields).map(([key, field]) => [
|
|
36
|
+
key,
|
|
37
|
+
field === undefined ? undefined : scopedJson(field, from, to),
|
|
38
|
+
]),
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function scopedJson(
|
|
43
|
+
value: JsonWritable,
|
|
44
|
+
from: string,
|
|
45
|
+
to: string,
|
|
46
|
+
): JsonWritable {
|
|
47
|
+
if (isString(value)) {
|
|
48
|
+
return value.startsWith(from) ? `${to}${value.slice(from.length)}` : value;
|
|
49
|
+
}
|
|
50
|
+
if (Array.isArray(value)) {
|
|
51
|
+
return value.map((item) => scopedJson(item, from, to));
|
|
52
|
+
}
|
|
53
|
+
return isWritableObject(value) ? scopedFields(value, from, to) : value;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function scopedNode(node: PreviewNode, from: string, to: string): PreviewNode {
|
|
57
|
+
return {
|
|
58
|
+
...node,
|
|
59
|
+
...(node.options && { options: scopedFields(node.options, from, to) }),
|
|
60
|
+
...(node.children && {
|
|
61
|
+
children: node.children.map((child) => scopedNode(child, from, to)),
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* `tree` with every string that starts at the mockup's fixture routes,
|
|
68
|
+
* `/api/mockup/<name>/pages/`, moved under the tenant's,
|
|
69
|
+
* `/api/mockup/<name>/tenants/<tenant>/pages/`, at any depth. What follows
|
|
70
|
+
* the prefix, a suffix or a query, stays as it is; any other string stays too.
|
|
71
|
+
*/
|
|
72
|
+
export function withTenantFixtures(
|
|
73
|
+
tree: readonly PreviewNode[],
|
|
74
|
+
name: string,
|
|
75
|
+
tenant: string,
|
|
76
|
+
): PreviewNode[] {
|
|
77
|
+
const from = mockupEndpoint(name, "/pages/");
|
|
78
|
+
const to = mockupEndpoint(
|
|
79
|
+
name,
|
|
80
|
+
`/tenants/${encodeURIComponent(tenant)}/pages/`,
|
|
81
|
+
);
|
|
82
|
+
return tree.map((node) => scopedNode(node, from, to));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const FIXTURE_BATCH_ROUTE = /^(\/api\/mockup\/[^/]+)\/pages\//;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* `route`, the fixture batch of a page of the mockup, as the tenant `tenant`
|
|
89
|
+
* sees it: moved under the tenant's routes, as {@link withTenantFixtures}
|
|
90
|
+
* moves a tree's.
|
|
91
|
+
*/
|
|
92
|
+
export function tenantFixtureRoute(route: string, tenant: string): string {
|
|
93
|
+
return route.replace(
|
|
94
|
+
FIXTURE_BATCH_ROUTE,
|
|
95
|
+
(_, mockup: string) =>
|
|
96
|
+
`${mockup}/tenants/${encodeURIComponent(tenant)}/pages/`,
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Each tenant-scoped entity the page `page` holds, with the rows of the
|
|
102
|
+
* tenant `tenant` it shows out of all its rows; empty for a page that holds
|
|
103
|
+
* none.
|
|
104
|
+
*/
|
|
105
|
+
export function hiddenRows(
|
|
106
|
+
entities: readonly MockupEntityState[] | undefined,
|
|
107
|
+
page: string | undefined,
|
|
108
|
+
tenant: string,
|
|
109
|
+
): PreviewHiddenRows[] {
|
|
110
|
+
return (entities ?? []).flatMap((entity) =>
|
|
111
|
+
entity.tenantScoped === true &&
|
|
112
|
+
page !== undefined &&
|
|
113
|
+
entity.pages.includes(page)
|
|
114
|
+
? [
|
|
115
|
+
{
|
|
116
|
+
entity: entity.name,
|
|
117
|
+
shown: entity.rows.filter((row) => row.tenantId === tenant).length,
|
|
118
|
+
total: entity.rows.length,
|
|
119
|
+
},
|
|
120
|
+
]
|
|
121
|
+
: [],
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* What the preview's sidebar and banner draw of SaaS mode: the tenants, the
|
|
127
|
+
* active one and the rows hidden on `page`. Undefined when there is no active
|
|
128
|
+
* tenant, which is the case in single-tenant mode and for a spec that lists
|
|
129
|
+
* no tenant.
|
|
130
|
+
*/
|
|
131
|
+
export function mockupWorkspace(
|
|
132
|
+
tenants: readonly MockupTenant[] | undefined,
|
|
133
|
+
tenant: string | undefined,
|
|
134
|
+
entities: readonly MockupEntityState[] | undefined,
|
|
135
|
+
page: string | undefined,
|
|
136
|
+
): PreviewWorkspace | undefined {
|
|
137
|
+
if (tenant === undefined || !tenants?.length) return undefined;
|
|
138
|
+
return {
|
|
139
|
+
tenants: [...tenants],
|
|
140
|
+
active: tenant,
|
|
141
|
+
hidden: hiddenRows(entities, page, tenant),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isString } from "../../../../dms-core/app/utils/type-check";
|
|
2
|
+
import { isOptionalString, isRecord } from "./recordGuards";
|
|
3
|
+
|
|
4
|
+
/** A workspace of the mockup's SaaS mode: one of `fixtures.tenants` of the spec. */
|
|
5
|
+
export interface MockupTenant {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
plan?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function isTenant(value: unknown): value is MockupTenant {
|
|
12
|
+
return (
|
|
13
|
+
isRecord(value) &&
|
|
14
|
+
isString(value.id) &&
|
|
15
|
+
isString(value.name) &&
|
|
16
|
+
isOptionalString(value.plan)
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Whether `value` is a list of tenants, each read. */
|
|
21
|
+
export function isMockupTenants(value: unknown): value is MockupTenant[] {
|
|
22
|
+
return Array.isArray(value) && value.every(isTenant);
|
|
23
|
+
}
|
|
@@ -3,13 +3,8 @@ import {
|
|
|
3
3
|
isObject,
|
|
4
4
|
isString,
|
|
5
5
|
} from "../../../../dms-core/app/utils/type-check";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
parseAnnotations,
|
|
9
|
-
parseMockupState,
|
|
10
|
-
type MockupAnnotation,
|
|
11
|
-
type MockupState,
|
|
12
|
-
} from "./mockup";
|
|
6
|
+
import { mockupEndpoint, parseMockupState, type MockupState } from "./mockup";
|
|
7
|
+
import { parseAnnotations, type MockupAnnotation } from "./mockupAnnotations";
|
|
13
8
|
|
|
14
9
|
/** Who wrote a version of a mockup: the AI's tools, this viewer, or an edit of the file. */
|
|
15
10
|
export type MockupVersionAuthor = "ai" | "you" | "disk";
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type { JsonValue } from "../../../../dms-core/app/types/json";
|
|
2
|
+
import type {
|
|
3
|
+
LocalFetchAnswer,
|
|
4
|
+
LocalFetchAnswerer,
|
|
5
|
+
LocalFetchRequest,
|
|
6
|
+
} from "../../../../dms-core/app/utils/localFetchAnswers";
|
|
7
|
+
import { HTTP_NOT_FOUND } from "../../../../dms-core/app/utils/http-status";
|
|
8
|
+
import { isJsonValue, isObjectValue } from "./json";
|
|
9
|
+
import { isRecord } from "./recordGuards";
|
|
10
|
+
import { findRow, listRows, parseRows, parseRowsQuery } from "./previewRows";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The fixtures one page reads, keyed by the fixture route its tree names,
|
|
14
|
+
* `/api/mockup/<name>[/tenants/<tenant>]/pages/<page>/fixtures/<key>`: what
|
|
15
|
+
* the viewer posts with a `render` so the frame answers its blocks' reads
|
|
16
|
+
* with no request.
|
|
17
|
+
*/
|
|
18
|
+
export type PreviewFixtureBatch = Record<string, JsonValue>;
|
|
19
|
+
|
|
20
|
+
/** Whether `value` is a {@link PreviewFixtureBatch}: an object whose every value is JSON. */
|
|
21
|
+
export function isPreviewFixtureBatch(
|
|
22
|
+
value: Parameters<typeof isRecord>[0],
|
|
23
|
+
): value is PreviewFixtureBatch {
|
|
24
|
+
return isRecord(value) && Object.values(value).every(isJsonValue);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The keys of a batch the frame answers from: the fixture routes of one of
|
|
29
|
+
* the mockup's pages, `/api/mockup/<name>/.../fixtures/<key>`. The page the
|
|
30
|
+
* batch comes from is trusted to name what it reads, and not to name any
|
|
31
|
+
* other route of the API for its blocks to read from.
|
|
32
|
+
*/
|
|
33
|
+
const FIXTURE_ROUTE = /^\/api\/mockup\/[^/]+\/(?:[^/]+\/)*fixtures\/[^/]+$/;
|
|
34
|
+
|
|
35
|
+
const ROWS_NOT_FOUND = "$dms.refusals.mockup.rows_not_found";
|
|
36
|
+
const ROW_NOT_FOUND = "$dms.refusals.mockup.row_not_found";
|
|
37
|
+
|
|
38
|
+
/** What a read of a fixture asks for, by the route's suffix after the fixture's own. */
|
|
39
|
+
type Read = "fixture" | "rows" | "record";
|
|
40
|
+
|
|
41
|
+
/** The suffixes a fixture's routes carry after its own, longest first. */
|
|
42
|
+
const SUFFIXES: ReadonlyArray<readonly [string, Read]> = [
|
|
43
|
+
["/rows/list", "rows"],
|
|
44
|
+
["/rows/get", "record"],
|
|
45
|
+
["/rows", "rows"],
|
|
46
|
+
["/record", "record"],
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
const notFound = (message: string): LocalFetchAnswer => ({
|
|
50
|
+
status: HTTP_NOT_FOUND,
|
|
51
|
+
message,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
/** `value` as a copy no block can write back into the batch through. */
|
|
55
|
+
function copyOf<T extends JsonValue>(value: T): T {
|
|
56
|
+
return structuredClone(value);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Whether two JSON values are the same data. */
|
|
60
|
+
function isSameJson(left: JsonValue, right: JsonValue): boolean {
|
|
61
|
+
if (left === right) return true;
|
|
62
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
63
|
+
return (
|
|
64
|
+
Array.isArray(left) &&
|
|
65
|
+
Array.isArray(right) &&
|
|
66
|
+
left.length === right.length &&
|
|
67
|
+
left.every((entry, index) => isSameJson(entry, right[index]))
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
if (!isObjectValue(left) || !isObjectValue(right)) return false;
|
|
71
|
+
const keys = Object.keys(left);
|
|
72
|
+
return (
|
|
73
|
+
keys.length === Object.keys(right).length &&
|
|
74
|
+
keys.every(
|
|
75
|
+
(key) => Object.hasOwn(right, key) && isSameJson(left[key], right[key]),
|
|
76
|
+
)
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The fixture of the batch a path names, and what the path reads of it. */
|
|
81
|
+
function readOf(
|
|
82
|
+
batch: ReadonlyMap<string, JsonValue>,
|
|
83
|
+
path: string,
|
|
84
|
+
): { fixture: JsonValue; read: Read } | undefined {
|
|
85
|
+
const own = batch.get(path);
|
|
86
|
+
if (own !== undefined) return { fixture: own, read: "fixture" };
|
|
87
|
+
for (const [suffix, read] of SUFFIXES) {
|
|
88
|
+
if (!path.endsWith(suffix)) continue;
|
|
89
|
+
const fixture = batch.get(path.slice(0, -suffix.length));
|
|
90
|
+
if (fixture !== undefined) return { fixture, read };
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** The answer of a read of `fixture` that lists rows or names one. */
|
|
96
|
+
function answerRows(
|
|
97
|
+
fixture: JsonValue,
|
|
98
|
+
read: Exclude<Read, "fixture">,
|
|
99
|
+
query: LocalFetchRequest["query"],
|
|
100
|
+
): LocalFetchAnswer {
|
|
101
|
+
const rows = parseRows(fixture);
|
|
102
|
+
if (!rows) return notFound(ROWS_NOT_FOUND);
|
|
103
|
+
if (read === "rows") {
|
|
104
|
+
const { results, total } = listRows(rows, parseRowsQuery(query));
|
|
105
|
+
return { data: copyOf({ results, total }) };
|
|
106
|
+
}
|
|
107
|
+
const id = query.get("id");
|
|
108
|
+
const row =
|
|
109
|
+
id === null ? undefined : findRow(rows, id, query.get("key") ?? undefined);
|
|
110
|
+
return row ? { data: copyOf(row) } : notFound(ROW_NOT_FOUND);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The fixtures a preview frame answers from, and how it answers. A GET whose
|
|
115
|
+
* path is under an entry of the batch is answered from it, with no request:
|
|
116
|
+
* the fixture itself, its rows (a page of them, as a table asks), one row as
|
|
117
|
+
* a record, and the row a details view reads. Any other request goes to the
|
|
118
|
+
* network.
|
|
119
|
+
*/
|
|
120
|
+
export interface PreviewFixtureAnswers {
|
|
121
|
+
/**
|
|
122
|
+
* Makes `batch` the fixtures answered from, the entries under the mockup's
|
|
123
|
+
* fixture routes alone: any other key is ignored.
|
|
124
|
+
*
|
|
125
|
+
* @returns Whether an entry was added, removed or changed
|
|
126
|
+
*/
|
|
127
|
+
replace: (batch: PreviewFixtureBatch) => boolean;
|
|
128
|
+
/** The answerer to install on `$authFetch`. */
|
|
129
|
+
answer: LocalFetchAnswerer;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function createPreviewFixtureAnswers(): PreviewFixtureAnswers {
|
|
133
|
+
let held = new Map<string, JsonValue>();
|
|
134
|
+
return {
|
|
135
|
+
replace(batch) {
|
|
136
|
+
const next = new Map(
|
|
137
|
+
Object.entries(batch).filter(([route]) => FIXTURE_ROUTE.test(route)),
|
|
138
|
+
);
|
|
139
|
+
const isChanged =
|
|
140
|
+
next.size !== held.size ||
|
|
141
|
+
[...next].some(([key, value]) => {
|
|
142
|
+
const before = held.get(key);
|
|
143
|
+
return before === undefined || !isSameJson(before, value);
|
|
144
|
+
});
|
|
145
|
+
held = next;
|
|
146
|
+
return isChanged;
|
|
147
|
+
},
|
|
148
|
+
answer({ path, query }) {
|
|
149
|
+
const found = readOf(held, path);
|
|
150
|
+
if (!found) return undefined;
|
|
151
|
+
return found.read === "fixture"
|
|
152
|
+
? { data: copyOf(found.fixture) }
|
|
153
|
+
: answerRows(found.fixture, found.read, query);
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
}
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
export const FIXTURES_ONLY_QUERY = "fixtures";
|
|
3
3
|
export const FIXTURES_ONLY_VALUE = "only";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* The query that marks `/dms-preview` as the mockup viewer's page frame, on
|
|
7
|
+
* sample or real data alike, and its value: that frame hands the viewer its
|
|
8
|
+
* zoom wheel and reports where its blocks sit while not inspecting.
|
|
9
|
+
*/
|
|
10
|
+
export const MOCKUP_PAGE_FRAME_QUERY = "frame";
|
|
11
|
+
export const MOCKUP_PAGE_FRAME_VALUE = "page";
|
|
12
|
+
|
|
5
13
|
/** The routes answering a mockup's fixtures and its own state. */
|
|
6
14
|
const MOCKUP_ROUTES = "/api/mockup/";
|
|
7
15
|
|