@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
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { shallowRef, type Ref, type ShallowRef } from "vue";
|
|
2
|
+
import type { JsonValue } from "../../../../dms-core/app/types/json";
|
|
3
|
+
import { textDigest } from "../../../../dms-core/app/utils/textDigest";
|
|
4
|
+
import { isNumber, isString } from "../../../../dms-core/app/utils/type-check";
|
|
2
5
|
import type {
|
|
3
6
|
PreviewBlockRect,
|
|
4
7
|
PreviewNavigation,
|
|
5
8
|
} from "./blockPreviewMessages";
|
|
9
|
+
import { parseBlockRects } from "./blockPreviewRects";
|
|
10
|
+
import { isObjectValue } from "./json";
|
|
6
11
|
import type { MockupPageState } from "./mockup";
|
|
7
12
|
import { mockupPageRender } from "./mockupFrame";
|
|
8
13
|
import { mockupDataTree } from "./mockupRealData";
|
|
@@ -31,17 +36,34 @@ export type PageCaptures = ReadonlyMap<string, PageCapture>;
|
|
|
31
36
|
/** The sidebar every page is drawn in, which is the same for all of them and so says nothing of one. */
|
|
32
37
|
const NO_NAVIGATION: PreviewNavigation = { sections: [] };
|
|
33
38
|
|
|
39
|
+
/** Changes with how a preview draws a capture, or with what the server keeps of one, so that every image taken before it is out of date. */
|
|
40
|
+
const CAPTURE_VERSION = 1;
|
|
41
|
+
|
|
34
42
|
/**
|
|
35
|
-
* What draws `page` alone: its own state as the preview is sent
|
|
36
|
-
* the sidebar,
|
|
37
|
-
* the
|
|
38
|
-
*
|
|
43
|
+
* What draws `page` alone: a digest of its own state as the preview is sent
|
|
44
|
+
* it, minus the sidebar, of the route of its fixture batch, which holds the
|
|
45
|
+
* digest of the rows it draws, of whether it reads real data and of the
|
|
46
|
+
* language it is drawn in: its own, else `locale`, the viewer's, which the
|
|
47
|
+
* frame follows when the page names none. Another page changing, or the
|
|
48
|
+
* pages' order or titles, leaves the key as it was; changing the page
|
|
49
|
+
* itself, its theme or locale, its fixtures, Real data, or the viewer's
|
|
50
|
+
* language for a page that names none, does not. It is short, and made of
|
|
51
|
+
* letters, digits and dashes, so the server keeps it as the name of what its
|
|
52
|
+
* image was drawn from.
|
|
39
53
|
*/
|
|
40
|
-
export function captureKey(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
export function captureKey(
|
|
55
|
+
page: MockupPageState,
|
|
56
|
+
realData: boolean,
|
|
57
|
+
locale: string,
|
|
58
|
+
): string {
|
|
59
|
+
return `c${CAPTURE_VERSION}-${textDigest(
|
|
60
|
+
JSON.stringify([
|
|
61
|
+
realData,
|
|
62
|
+
page.fixtures ?? null,
|
|
63
|
+
page.options.locale ?? locale,
|
|
64
|
+
mockupPageRender(page, mockupDataTree(page, realData), NO_NAVIGATION),
|
|
65
|
+
]),
|
|
66
|
+
)}`;
|
|
45
67
|
}
|
|
46
68
|
|
|
47
69
|
/**
|
|
@@ -121,9 +143,96 @@ export function releaseCaptureUpload(
|
|
|
121
143
|
if (sent.get(name) === JSON.stringify([page, key])) sent.delete(name);
|
|
122
144
|
}
|
|
123
145
|
|
|
146
|
+
/** The images a data URL of an image holds, which is how the server sends one. */
|
|
147
|
+
const IMAGE_DATA_URL = /^data:image\/(?:webp|png);base64,/;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The captures `GET /captures` answered, by page id. An entry whose key or
|
|
151
|
+
* image is not a string, whose image is not a WebP or PNG data URL, or whose
|
|
152
|
+
* blocks are not all a path and a box, is left out, so a page nothing sound
|
|
153
|
+
* is known of is drawn live as if it had no capture.
|
|
154
|
+
*/
|
|
155
|
+
export function parseSeededCaptures(
|
|
156
|
+
value: JsonValue | undefined,
|
|
157
|
+
): Map<string, PageCapture> {
|
|
158
|
+
const captures = new Map<string, PageCapture>();
|
|
159
|
+
if (!isObjectValue(value)) return captures;
|
|
160
|
+
for (const [page, entry] of Object.entries(value)) {
|
|
161
|
+
if (!isObjectValue(entry)) continue;
|
|
162
|
+
const { key, src, height, blocks } = entry;
|
|
163
|
+
if (!isString(key) || !isString(src) || !IMAGE_DATA_URL.test(src)) continue;
|
|
164
|
+
const drawn = blocks === undefined ? undefined : parseBlockRects(blocks);
|
|
165
|
+
if (blocks !== undefined && drawn === undefined) continue;
|
|
166
|
+
captures.set(page, {
|
|
167
|
+
key,
|
|
168
|
+
url: src,
|
|
169
|
+
...(isNumber(height) &&
|
|
170
|
+
Number.isFinite(height) &&
|
|
171
|
+
height >= 0 && { height }),
|
|
172
|
+
...(drawn && { blocks: drawn }),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return captures;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* What the server holds of each mockup's pages as far as this browser session
|
|
180
|
+
* knows, by mockup and page: the key of the capture it holds.
|
|
181
|
+
*/
|
|
182
|
+
const persisted = new Map<string, Map<string, string>>();
|
|
183
|
+
|
|
184
|
+
/** Whether the server holds the capture of `page` of the mockup `name` for `key`. */
|
|
185
|
+
export function isCapturePersisted(
|
|
186
|
+
name: string,
|
|
187
|
+
page: string,
|
|
188
|
+
key: string,
|
|
189
|
+
): boolean {
|
|
190
|
+
return persisted.get(name)?.get(page) === key;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Records that the server holds the capture of `page` of the mockup `name` for `key`. */
|
|
194
|
+
export function markCapturePersisted(
|
|
195
|
+
name: string,
|
|
196
|
+
page: string,
|
|
197
|
+
key: string,
|
|
198
|
+
): void {
|
|
199
|
+
const pages = persisted.get(name) ?? new Map<string, string>();
|
|
200
|
+
pages.set(page, key);
|
|
201
|
+
persisted.set(name, pages);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** The mockups whose captures were read from the server in this session. */
|
|
205
|
+
const seeded = new Set<string>();
|
|
206
|
+
|
|
207
|
+
/** Whether the captures of the mockup `name` were read from the server in this session. */
|
|
208
|
+
export function hasSeededCaptures(name: string): boolean {
|
|
209
|
+
return seeded.has(name);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Keeps the captures the server held for the mockup `name`, but for a page
|
|
214
|
+
* this browser captured since it asked: a capture taken here is never
|
|
215
|
+
* replaced by one read later. What is kept is what the server holds.
|
|
216
|
+
*/
|
|
217
|
+
export function seedPageCaptures(
|
|
218
|
+
name: string,
|
|
219
|
+
captures: ReadonlyMap<string, PageCapture>,
|
|
220
|
+
): void {
|
|
221
|
+
const store = storeOf(name);
|
|
222
|
+
const next = new Map(store.value);
|
|
223
|
+
for (const [page, capture] of captures) {
|
|
224
|
+
markCapturePersisted(name, page, capture.key);
|
|
225
|
+
if (!next.has(page)) next.set(page, capture);
|
|
226
|
+
}
|
|
227
|
+
store.value = next;
|
|
228
|
+
seeded.add(name);
|
|
229
|
+
}
|
|
230
|
+
|
|
124
231
|
/** Forgets every capture of the mockup `name`, and releases its images. */
|
|
125
232
|
export function clearMockupCaptures(name: string): void {
|
|
126
233
|
sent.delete(name);
|
|
234
|
+
persisted.delete(name);
|
|
235
|
+
seeded.delete(name);
|
|
127
236
|
const store = storeOf(name);
|
|
128
237
|
for (const { url } of store.value.values()) URL.revokeObjectURL(url);
|
|
129
238
|
store.value = new Map();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
MOCKUP_MAX_PAGES,
|
|
3
2
|
MOCKUP_PAGE_ID_PATTERN,
|
|
4
3
|
authoredId,
|
|
5
4
|
freeId,
|
|
@@ -386,7 +385,6 @@ function setTitle(spec: MockupSpecDocument, title: string): MockupEditResult {
|
|
|
386
385
|
}
|
|
387
386
|
|
|
388
387
|
function addPage(spec: MockupSpecDocument, title: string): MockupEditResult {
|
|
389
|
-
if (spec.pages.length >= MOCKUP_MAX_PAGES) return { spec };
|
|
390
388
|
const page: MockupSpecPage = { id: pageIdFor(spec, title), title, tree: [] };
|
|
391
389
|
return { spec: { ...spec, pages: [...spec.pages, page] }, page: page.id };
|
|
392
390
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { isString } from "../../../../dms-core/app/utils/type-check";
|
|
2
|
+
import { isJsonObject, type JsonObject } from "./json";
|
|
3
|
+
import { isRecord } from "./recordGuards";
|
|
4
|
+
|
|
5
|
+
/** The types a field of a spec entity takes. */
|
|
6
|
+
export const MOCKUP_FIELD_TYPES = [
|
|
7
|
+
"string",
|
|
8
|
+
"number",
|
|
9
|
+
"price",
|
|
10
|
+
"boolean",
|
|
11
|
+
"date",
|
|
12
|
+
"email",
|
|
13
|
+
"url",
|
|
14
|
+
"enum",
|
|
15
|
+
"ref",
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
/** A field type of an entity. */
|
|
19
|
+
export type MockupFieldType = (typeof MOCKUP_FIELD_TYPES)[number];
|
|
20
|
+
|
|
21
|
+
export interface MockupEntityField {
|
|
22
|
+
name: string;
|
|
23
|
+
type: MockupFieldType;
|
|
24
|
+
/** The entity a `ref` points to; set on a `ref` alone. */
|
|
25
|
+
to?: string;
|
|
26
|
+
/** The values an `enum` takes, at least one; set on an `enum` alone. */
|
|
27
|
+
values?: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** An entity of the spec's data model: a table of the mockup's database. */
|
|
31
|
+
export interface MockupEntityState {
|
|
32
|
+
name: string;
|
|
33
|
+
tenantScoped?: true;
|
|
34
|
+
/** `id` first (declared, else implied `{ name: "id", type: "string" }`), then the declared fields in spec order. */
|
|
35
|
+
fields: MockupEntityField[];
|
|
36
|
+
/** The rows of every fixture pointing to it, pages in spec order then fixture keys in order; a row whose `id` an earlier row has is dropped. */
|
|
37
|
+
rows: JsonObject[];
|
|
38
|
+
/** The ids of the pages holding a fixture that points to it, in spec order, each once. */
|
|
39
|
+
pages: string[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function isFieldType(value: unknown): value is MockupFieldType {
|
|
43
|
+
const types: readonly unknown[] = MOCKUP_FIELD_TYPES;
|
|
44
|
+
return types.includes(value);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function isEnumValues(value: Parameters<typeof isString>[0]): boolean {
|
|
48
|
+
return Array.isArray(value) && value.length > 0 && value.every(isString);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Whether `value` is a field: a `ref` names its target and an `enum` its values, and no other type carries either. */
|
|
52
|
+
function isEntityField(value: unknown): value is MockupEntityField {
|
|
53
|
+
if (!isRecord(value) || !isString(value.name) || !isFieldType(value.type)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
const { type, to, values } = value;
|
|
57
|
+
return (
|
|
58
|
+
(type === "ref" ? isString(to) : to === undefined) &&
|
|
59
|
+
(type === "enum" ? isEnumValues(values) : values === undefined)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function isEntity(value: unknown): value is MockupEntityState {
|
|
64
|
+
return (
|
|
65
|
+
isRecord(value) &&
|
|
66
|
+
isString(value.name) &&
|
|
67
|
+
(value.tenantScoped === undefined || value.tenantScoped === true) &&
|
|
68
|
+
Array.isArray(value.fields) &&
|
|
69
|
+
value.fields.every(isEntityField) &&
|
|
70
|
+
Array.isArray(value.rows) &&
|
|
71
|
+
value.rows.every(isJsonObject) &&
|
|
72
|
+
Array.isArray(value.pages) &&
|
|
73
|
+
value.pages.every(isString)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Whether `value` is a list of entities, each field, row and page id of them read. */
|
|
78
|
+
export function isMockupEntities(value: unknown): value is MockupEntityState[] {
|
|
79
|
+
return Array.isArray(value) && value.every(isEntity);
|
|
80
|
+
}
|
|
@@ -1,15 +1,29 @@
|
|
|
1
|
+
import { textDigest } from "../../../../dms-core/app/utils/textDigest";
|
|
1
2
|
import { isPreviewTheme, type PreviewNode } from "./blockPreview";
|
|
2
3
|
import {
|
|
3
4
|
previewRenderMessage,
|
|
4
5
|
type PreviewNavigation,
|
|
6
|
+
type PreviewNavigationItem,
|
|
5
7
|
type PreviewRenderMessage,
|
|
6
8
|
type PreviewSidebarWidget,
|
|
9
|
+
type PreviewWorkspace,
|
|
7
10
|
} from "./blockPreviewMessages";
|
|
8
11
|
import type {
|
|
9
12
|
MockupCategory,
|
|
13
|
+
MockupModule,
|
|
10
14
|
MockupPageState,
|
|
11
15
|
MockupSidebarWidget,
|
|
12
16
|
} from "./mockup";
|
|
17
|
+
import {
|
|
18
|
+
activeModule,
|
|
19
|
+
isAppPage,
|
|
20
|
+
isSettingsPage,
|
|
21
|
+
moduleWidgets,
|
|
22
|
+
settingsNavigation,
|
|
23
|
+
storeModules,
|
|
24
|
+
} from "./mockupModuleNavigation";
|
|
25
|
+
import type { PreviewFixtureBatch } from "./previewFixtureAnswers";
|
|
26
|
+
import type { PreviewHeader } from "./previewHeader";
|
|
13
27
|
import { groupSections } from "./mockupSections";
|
|
14
28
|
import { currentSketchScheme } from "./sketch";
|
|
15
29
|
|
|
@@ -49,7 +63,7 @@ export function mockupPageIcon(
|
|
|
49
63
|
|
|
50
64
|
type NavigationPage = Pick<
|
|
51
65
|
MockupPageState,
|
|
52
|
-
"id" | "title" | "icon" | "category" | "menu" | "parent"
|
|
66
|
+
"id" | "title" | "icon" | "category" | "menu" | "parent" | "place"
|
|
53
67
|
>;
|
|
54
68
|
|
|
55
69
|
/**
|
|
@@ -78,8 +92,14 @@ export interface MockupNavigationSource {
|
|
|
78
92
|
active: string | undefined;
|
|
79
93
|
/** Whether the sidebar edits its sections. */
|
|
80
94
|
editable?: boolean;
|
|
81
|
-
/** Sketches the
|
|
95
|
+
/** Sketches the spec adds among the sidebar's widgets. */
|
|
82
96
|
widgets?: readonly MockupSidebarWidget[];
|
|
97
|
+
/** The modules the mockup installs: the Modules button counts them, the store lists them, and their widgets are in the sidebar. */
|
|
98
|
+
modules?: readonly MockupModule[];
|
|
99
|
+
/** Whether the module store is open in place of the page. */
|
|
100
|
+
isStoreOpen?: boolean;
|
|
101
|
+
/** The workspace the switcher widget lists and the banner names; none when absent. */
|
|
102
|
+
workspace?: PreviewWorkspace;
|
|
83
103
|
}
|
|
84
104
|
|
|
85
105
|
function sidebarWidget(widget: MockupSidebarWidget): PreviewSidebarWidget {
|
|
@@ -113,23 +133,44 @@ function menuEntryOf(
|
|
|
113
133
|
return undefined;
|
|
114
134
|
}
|
|
115
135
|
|
|
136
|
+
/** The Settings section's entries: the spec's settings pages and the pages that extend a Settings page, in the spec's order. */
|
|
137
|
+
function settingsItems(
|
|
138
|
+
pages: readonly NavigationPage[],
|
|
139
|
+
): PreviewNavigationItem[] {
|
|
140
|
+
return pages
|
|
141
|
+
.filter((page) => page.menu !== false && isSettingsPage(page))
|
|
142
|
+
.map((page) => ({ id: page.id, label: page.title, icon: page.icon }));
|
|
143
|
+
}
|
|
144
|
+
|
|
116
145
|
/**
|
|
117
|
-
* The mockup's pages as the preview's sidebar lists them:
|
|
118
|
-
* sections, each
|
|
119
|
-
*
|
|
120
|
-
*
|
|
146
|
+
* The mockup's pages as the preview's sidebar lists them: the app's pages
|
|
147
|
+
* under their sections, each with its icon, then the settings pages and the
|
|
148
|
+
* pages that extend a Settings page under a Settings header. A page with `menu: false` is left
|
|
149
|
+
* out, and while it is the current one, its nearest listed parent is. A page
|
|
150
|
+
* of a module is never in the app's menu: while one is current, the sidebar
|
|
151
|
+
* draws as inside that module, its pages in place of the app's menu. The
|
|
152
|
+
* installed modules fill the Modules button and the module store, and put
|
|
153
|
+
* their widgets in the sidebar; the mockup's own sketches follow.
|
|
121
154
|
*/
|
|
122
155
|
export function mockupNavigation(
|
|
123
156
|
source: MockupNavigationSource,
|
|
124
157
|
): PreviewNavigation {
|
|
158
|
+
const modules = source.modules ?? [];
|
|
125
159
|
const indexed = source.pages
|
|
126
160
|
.map((page, index) => ({ page, index }))
|
|
127
|
-
.filter(({ page }) => page.menu !== false);
|
|
161
|
+
.filter(({ page }) => page.menu !== false && isAppPage(page));
|
|
128
162
|
const sections = groupSections(
|
|
129
163
|
source.categories,
|
|
130
164
|
indexed,
|
|
131
165
|
({ page }) => page.category,
|
|
132
166
|
);
|
|
167
|
+
const settings = settingsItems(source.pages);
|
|
168
|
+
const settingsNav = settingsNavigation(modules, source.pages);
|
|
169
|
+
const isStore = source.isStoreOpen === true;
|
|
170
|
+
const module = isStore
|
|
171
|
+
? undefined
|
|
172
|
+
: activeModule(modules, source.pages, source.active);
|
|
173
|
+
const widgets = moduleWidgets(modules);
|
|
133
174
|
return {
|
|
134
175
|
title: source.title,
|
|
135
176
|
sections: sections.map((section) => ({
|
|
@@ -140,12 +181,64 @@ export function mockupNavigation(
|
|
|
140
181
|
icon: sidebarIcon(page, index),
|
|
141
182
|
})),
|
|
142
183
|
})),
|
|
143
|
-
|
|
184
|
+
...(settings.length > 0 && { settings }),
|
|
185
|
+
...(settingsNav.length > 0 && { settingsNav }),
|
|
186
|
+
...(module && { module }),
|
|
187
|
+
...(modules.length > 0 && {
|
|
188
|
+
modules: storeModules(modules, source.pages),
|
|
189
|
+
}),
|
|
190
|
+
...(isStore && { store: true as const }),
|
|
191
|
+
active: isStore ? undefined : menuEntryOf(source.pages, source.active),
|
|
144
192
|
...(source.editable && { editable: true }),
|
|
145
193
|
...(source.widgets &&
|
|
146
194
|
source.widgets.length > 0 && {
|
|
147
195
|
widgets: source.widgets.map(sidebarWidget),
|
|
148
196
|
}),
|
|
197
|
+
...(widgets.length > 0 && { moduleWidgets: widgets }),
|
|
198
|
+
...(source.workspace && { workspace: source.workspace }),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* What the blocks a render draws are of: the page, as one tenant sees it when
|
|
204
|
+
* SaaS mode is on, on its fixtures or its live routes, as `tree` draws it and
|
|
205
|
+
* `params` fill it. Another page, tenant, data mode, tree or row remounts the
|
|
206
|
+
* blocks, which read their options once when they mount; a change of the
|
|
207
|
+
* fixtures alone leaves the scope as it was, and the blocks read them again
|
|
208
|
+
* in place.
|
|
209
|
+
*/
|
|
210
|
+
export function mockupRenderScope(
|
|
211
|
+
pageId: string,
|
|
212
|
+
tenant: string | undefined,
|
|
213
|
+
realData: boolean,
|
|
214
|
+
tree: readonly PreviewNode[],
|
|
215
|
+
params?: Record<string, string>,
|
|
216
|
+
): string {
|
|
217
|
+
return JSON.stringify([
|
|
218
|
+
pageId,
|
|
219
|
+
tenant ?? null,
|
|
220
|
+
realData,
|
|
221
|
+
textDigest(JSON.stringify([tree, params ?? null])),
|
|
222
|
+
]);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** What a render brings besides the page's tree. */
|
|
226
|
+
export interface MockupRenderData {
|
|
227
|
+
/** What the blocks are of; a render with none remounts them. */
|
|
228
|
+
scope?: string;
|
|
229
|
+
/** The fixtures the page reads, which the frame answers its blocks' reads from. */
|
|
230
|
+
fixtures?: PreviewFixtureBatch;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** `message` naming what its blocks are of and carrying the fixtures they read. */
|
|
234
|
+
export function withRenderData(
|
|
235
|
+
message: PreviewRenderMessage,
|
|
236
|
+
data: MockupRenderData,
|
|
237
|
+
): PreviewRenderMessage {
|
|
238
|
+
return {
|
|
239
|
+
...message,
|
|
240
|
+
...(data.scope !== undefined && { scope: data.scope }),
|
|
241
|
+
...(data.fixtures && { fixtures: data.fixtures }),
|
|
149
242
|
};
|
|
150
243
|
}
|
|
151
244
|
|
|
@@ -182,3 +275,25 @@ export function mockupPageRender(
|
|
|
182
275
|
...(page.layout && { pageLayout: page.layout }),
|
|
183
276
|
});
|
|
184
277
|
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* What the preview draws while the module store is open: no block, the
|
|
281
|
+
* store under `header`, inside `navigation`, in the theme and the locale of
|
|
282
|
+
* `page`, the page the viewer would otherwise show.
|
|
283
|
+
*/
|
|
284
|
+
export function mockupStoreRender(
|
|
285
|
+
page: MockupPageState,
|
|
286
|
+
navigation: PreviewNavigation,
|
|
287
|
+
header: PreviewHeader,
|
|
288
|
+
): PreviewRenderMessage {
|
|
289
|
+
return previewRenderMessage({
|
|
290
|
+
tree: [],
|
|
291
|
+
theme: isPreviewTheme(page.options.theme)
|
|
292
|
+
? page.options.theme
|
|
293
|
+
: currentSketchScheme(),
|
|
294
|
+
locale: page.options.locale,
|
|
295
|
+
padding: true,
|
|
296
|
+
navigation,
|
|
297
|
+
header,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
@@ -8,14 +8,18 @@ const PAGE_QUERY = "page";
|
|
|
8
8
|
/** The viewer's query naming the row a page with a route shows. */
|
|
9
9
|
export const RECORD_QUERY = "record";
|
|
10
10
|
|
|
11
|
+
/** The viewer's query that opens the module store in place of a page. */
|
|
12
|
+
export const STORE_QUERY = "store";
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* The query parameters the viewer and its preview read themselves: the
|
|
13
|
-
* mockup, the page, the canvas width, the data shown,
|
|
14
|
-
* its fixtures-only switch.
|
|
16
|
+
* mockup, the page, the open module store, the canvas width, the data shown,
|
|
17
|
+
* the preview's state and its fixtures-only switch.
|
|
15
18
|
*/
|
|
16
19
|
const VIEWER_QUERY_KEYS: ReadonlySet<string> = new Set([
|
|
17
20
|
"name",
|
|
18
21
|
PAGE_QUERY,
|
|
22
|
+
STORE_QUERY,
|
|
19
23
|
"width",
|
|
20
24
|
"data",
|
|
21
25
|
"state",
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PreviewModuleWidget,
|
|
3
|
+
PreviewNavigationItem,
|
|
4
|
+
PreviewNavigationModule,
|
|
5
|
+
PreviewSettingsNavGroup,
|
|
6
|
+
PreviewStoreModule,
|
|
7
|
+
} from "./blockPreviewNavigation";
|
|
8
|
+
import type { MockupModule, MockupPageState } from "./mockup";
|
|
9
|
+
import { placeModule } from "./mockupModules";
|
|
10
|
+
|
|
11
|
+
/** The frame height of a module's sketch widget that names none: a card, not a page section. */
|
|
12
|
+
const WIDGET_DEFAULT_HEIGHT = 120;
|
|
13
|
+
|
|
14
|
+
/** The fields of a page the module views read. */
|
|
15
|
+
export type ModulePage = Pick<
|
|
16
|
+
MockupPageState,
|
|
17
|
+
"id" | "title" | "icon" | "menu" | "place"
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
/** The module a page is listed under: its own, or the one its extended target belongs to; none for a page of the app or of Settings. */
|
|
21
|
+
export function moduleOfPage(
|
|
22
|
+
page: Pick<ModulePage, "place">,
|
|
23
|
+
): string | undefined {
|
|
24
|
+
return placeModule(page.place);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Whether the app's own sections list the page: a page of the app, or one that extends a page of the app. */
|
|
28
|
+
export function isAppPage(page: Pick<ModulePage, "place">): boolean {
|
|
29
|
+
return (
|
|
30
|
+
page.place.kind === "app" ||
|
|
31
|
+
(page.place.kind === "extension" && page.place.menu === "app")
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Whether the Settings lists the page: one the spec adds under `/settings`, or one that extends a page of the dashboard's Settings. */
|
|
36
|
+
export function isSettingsPage(page: Pick<ModulePage, "place">): boolean {
|
|
37
|
+
return (
|
|
38
|
+
page.place.kind === "settings" ||
|
|
39
|
+
(page.place.kind === "extension" && page.place.menu === "settings")
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The i18n key of the settings navigation's own group, the dashboard's Settings title. */
|
|
44
|
+
export const SETTINGS_GROUP_LABEL = "$page.settings.title";
|
|
45
|
+
|
|
46
|
+
function itemOf(page: ModulePage): PreviewNavigationItem {
|
|
47
|
+
return { id: page.id, label: page.title, icon: page.icon };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function listedPages(
|
|
51
|
+
module: Pick<MockupModule, "id">,
|
|
52
|
+
pages: readonly ModulePage[],
|
|
53
|
+
): ModulePage[] {
|
|
54
|
+
return pages.filter(
|
|
55
|
+
(page) => page.menu !== false && moduleOfPage(page) === module.id,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** The pages `module` adds or extends, in the spec's order, each a sidebar entry; the sidebar leaves out a page with `menu: false`. */
|
|
60
|
+
export function modulePages(
|
|
61
|
+
module: Pick<MockupModule, "id">,
|
|
62
|
+
pages: readonly ModulePage[],
|
|
63
|
+
): PreviewNavigationItem[] {
|
|
64
|
+
return listedPages(module, pages).map(itemOf);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The module the sidebar draws as the dashboard does inside a module: the
|
|
69
|
+
* module the page `active` belongs to, with its pages. None while no page is
|
|
70
|
+
* open, for a page of the app or of Settings, and for a module the mockup
|
|
71
|
+
* does not install.
|
|
72
|
+
*/
|
|
73
|
+
export function activeModule(
|
|
74
|
+
modules: readonly MockupModule[],
|
|
75
|
+
pages: readonly ModulePage[],
|
|
76
|
+
active: string | undefined,
|
|
77
|
+
): PreviewNavigationModule | undefined {
|
|
78
|
+
const page = pages.find((entry) => entry.id === active);
|
|
79
|
+
const id = page && moduleOfPage(page);
|
|
80
|
+
const module = modules.find((entry) => entry.id === id);
|
|
81
|
+
if (!module) return undefined;
|
|
82
|
+
return {
|
|
83
|
+
id: module.id,
|
|
84
|
+
title: module.title,
|
|
85
|
+
icon: module.icon,
|
|
86
|
+
items: modulePages(module, pages),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The name a widget goes by on its module's card: its title, else its id without the module's prefix. */
|
|
91
|
+
function widgetName(widget: MockupModule["widgets"][number]): string {
|
|
92
|
+
if (widget.kind === "sketch" && widget.title) return widget.title;
|
|
93
|
+
return widget.id.slice(widget.id.indexOf(":") + 1).replaceAll("-", " ");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** The cards of the module store, one per installed module, in the spec's order. */
|
|
97
|
+
export function storeModules(
|
|
98
|
+
modules: readonly MockupModule[],
|
|
99
|
+
pages: readonly ModulePage[],
|
|
100
|
+
): PreviewStoreModule[] {
|
|
101
|
+
return modules.map((module) => ({
|
|
102
|
+
id: module.id,
|
|
103
|
+
title: module.title,
|
|
104
|
+
icon: module.icon,
|
|
105
|
+
...(module.description !== undefined && {
|
|
106
|
+
description: module.description,
|
|
107
|
+
}),
|
|
108
|
+
...(module.package !== undefined && { package: module.package }),
|
|
109
|
+
pages: listedPages(module, pages).map((page) => ({
|
|
110
|
+
...itemOf(page),
|
|
111
|
+
ownerOnly: page.place.kind === "module",
|
|
112
|
+
})),
|
|
113
|
+
settings: module.settings.map(({ title, icon }) => ({ title, icon })),
|
|
114
|
+
widgets: module.widgets.map(widgetName),
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The settings navigation beside a page in the settings layout, as the
|
|
120
|
+
* mockup's app has it: a group for each installed module that brings settings
|
|
121
|
+
* pages, labelled with its title, listing them; a page of the spec that
|
|
122
|
+
* extends one stands in for that entry, under the page's id so it is the
|
|
123
|
+
* active one while the page is open. Then the Settings group, listing the
|
|
124
|
+
* spec's settings pages and the settings extensions no module entry matches,
|
|
125
|
+
* in the spec's order. A group with no entry is left out.
|
|
126
|
+
*/
|
|
127
|
+
export function settingsNavigation(
|
|
128
|
+
modules: readonly MockupModule[],
|
|
129
|
+
pages: readonly ModulePage[],
|
|
130
|
+
): PreviewSettingsNavGroup[] {
|
|
131
|
+
const listed = pages.filter(
|
|
132
|
+
(page) => page.menu !== false && isSettingsPage(page),
|
|
133
|
+
);
|
|
134
|
+
const matched = new Set<string>();
|
|
135
|
+
const ofModules = modules.map((module): PreviewSettingsNavGroup => ({
|
|
136
|
+
label: module.title,
|
|
137
|
+
items: module.settings.map(({ id, title, icon }) => {
|
|
138
|
+
const standIn = listed.find(
|
|
139
|
+
(page) => page.place.kind === "extension" && page.place.target === id,
|
|
140
|
+
);
|
|
141
|
+
if (standIn) matched.add(standIn.id);
|
|
142
|
+
return { id: standIn?.id ?? id, label: title, icon };
|
|
143
|
+
}),
|
|
144
|
+
}));
|
|
145
|
+
const own = listed.filter((page) => !matched.has(page.id)).map(itemOf);
|
|
146
|
+
return [...ofModules, { label: SETTINGS_GROUP_LABEL, items: own }].filter(
|
|
147
|
+
(group) => group.items.length > 0,
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** What the installed modules put in the sidebar, in the modules' order. */
|
|
152
|
+
export function moduleWidgets(
|
|
153
|
+
modules: readonly MockupModule[],
|
|
154
|
+
): PreviewModuleWidget[] {
|
|
155
|
+
return modules.flatMap((module) =>
|
|
156
|
+
module.widgets.map((widget): PreviewModuleWidget => {
|
|
157
|
+
if (widget.kind === "workspace-switcher") return widget;
|
|
158
|
+
return {
|
|
159
|
+
id: widget.id,
|
|
160
|
+
kind: "sketch",
|
|
161
|
+
position: widget.position,
|
|
162
|
+
sketch: {
|
|
163
|
+
html: widget.html,
|
|
164
|
+
height: widget.height ?? WIDGET_DEFAULT_HEIGHT,
|
|
165
|
+
...(widget.css !== undefined && { css: widget.css }),
|
|
166
|
+
...(widget.title !== undefined && { caption: widget.title }),
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
}),
|
|
170
|
+
);
|
|
171
|
+
}
|