@antelopejs/dms 0.25.8-next.1174.ge77e0bd → 0.25.8
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/CHANGELOG.md +48 -0
- package/README.md +2 -2
- package/data/mockup-example/spec.json +0 -11
- package/data/mockup-spec.schema.json +16 -399
- package/dist/e2e/index.d.mts +1 -2
- package/dist/implementations/dms-builder/engine/table-view-settings.js +33 -9
- package/dist/implementations/dms-builder/engine/table-view-settings.js.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +0 -2
- package/dist/mcp/index.js +0 -9
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/page-verify/index.d.ts +0 -15
- package/dist/mcp/page-verify/index.js +6 -16
- package/dist/mcp/page-verify/index.js.map +1 -1
- package/dist/mcp/page-verify/mockup.d.ts +1 -3
- package/dist/mcp/page-verify/mockup.js +1 -5
- package/dist/mcp/page-verify/mockup.js.map +1 -1
- package/dist/mcp/page-verify/page-probe.d.ts +0 -5
- package/dist/mcp/page-verify/page-probe.js +0 -2
- package/dist/mcp/page-verify/page-probe.js.map +1 -1
- package/dist/mcp/page-verify/playwright.d.ts +4 -22
- package/dist/mcp/page-verify/playwright.js.map +1 -1
- package/dist/mcp/page-verify/report.d.ts +0 -1
- package/dist/mcp/tools/mockup-read-spec.js +3 -2
- package/dist/mcp/tools/mockup-read-spec.js.map +1 -1
- package/dist/mcp/tools/mockup.js +0 -4
- package/dist/mcp/tools/mockup.js.map +1 -1
- package/dist/mcp/tools/page-verify.d.ts +0 -1
- package/dist/mcp/tools/page-verify.js +2 -6
- 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.d.ts +10 -6
- package/dist/mockup/compile.js +290 -31
- package/dist/mockup/compile.js.map +1 -1
- package/dist/mockup/files.d.ts +1 -2
- package/dist/mockup/files.js +1 -2
- package/dist/mockup/files.js.map +1 -1
- package/dist/mockup/fixture-answers.d.ts +0 -1
- package/dist/mockup/fixture-answers.js +1 -1
- package/dist/mockup/fixture-answers.js.map +1 -1
- package/dist/mockup/fixtures.d.ts +27 -0
- package/dist/mockup/fixtures.js +111 -0
- package/dist/mockup/fixtures.js.map +1 -1
- package/dist/mockup/from-page.js +9 -2
- package/dist/mockup/from-page.js.map +1 -1
- package/dist/mockup/generate.js +1 -4
- package/dist/mockup/generate.js.map +1 -1
- package/dist/mockup/history-routes.d.ts +4 -2
- package/dist/mockup/history-routes.js +36 -27
- package/dist/mockup/history-routes.js.map +1 -1
- package/dist/mockup/history.js +1 -2
- package/dist/mockup/history.js.map +1 -1
- package/dist/mockup/index.d.ts +0 -10
- package/dist/mockup/index.js +0 -10
- package/dist/mockup/index.js.map +1 -1
- package/dist/mockup/json-schema-layout.d.ts +0 -1
- package/dist/mockup/json-schema-layout.js +2 -95
- package/dist/mockup/json-schema-layout.js.map +1 -1
- package/dist/mockup/json-schema.js +19 -40
- package/dist/mockup/json-schema.js.map +1 -1
- package/dist/mockup/manage-routes.d.ts +1 -3
- package/dist/mockup/manage-routes.js +1 -38
- 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 +100 -137
- package/dist/mockup/model.js +86 -102
- package/dist/mockup/model.js.map +1 -1
- package/dist/mockup/modules.d.ts +9 -6
- package/dist/mockup/modules.js +24 -105
- package/dist/mockup/modules.js.map +1 -1
- 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 +0 -5
- package/dist/mockup/refusals.js +0 -16
- package/dist/mockup/refusals.js.map +1 -1
- package/dist/mockup/routes.d.ts +5 -3
- package/dist/mockup/routes.js +162 -19
- package/dist/mockup/routes.js.map +1 -1
- package/dist/mockup/row-filters.d.ts +8 -0
- package/dist/mockup/row-filters.js +107 -0
- package/dist/mockup/row-filters.js.map +1 -0
- package/dist/mockup/sketch-limits.d.ts +0 -1
- package/dist/mockup/sketch-limits.js +1 -2
- package/dist/mockup/sketch-limits.js.map +1 -1
- package/dist/mockup/sketch.d.ts +2 -2
- package/dist/mockup/sketch.js +1 -2
- package/dist/mockup/sketch.js.map +1 -1
- package/dist/mockup/source-routes.d.ts +4 -5
- package/dist/mockup/source-routes.js +17 -26
- package/dist/mockup/source-routes.js.map +1 -1
- package/dist/mockup/source.js +1 -2
- package/dist/mockup/source.js.map +1 -1
- package/dist/mockup/store.d.ts +37 -16
- package/dist/mockup/store.js +200 -85
- package/dist/mockup/store.js.map +1 -1
- package/dist/mockup/table-archive.d.ts +1 -0
- package/dist/mockup/table-archive.js +16 -0
- package/dist/mockup/table-archive.js.map +1 -1
- package/e2e/index.mjs +2 -3
- package/frontend-vue/eslint-globals.generated.mjs +38 -40
- package/frontend-vue/layers/dms-core/app/build/utils/asyncDataScope.ts +31 -3
- package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +2 -8
- package/frontend-vue/layers/dms-core/i18n/locales/core-en-GB.json +0 -3
- package/frontend-vue/layers/dms-core/i18n/locales/core-fr-FR.json +0 -3
- package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +30 -110
- package/frontend-vue/layers/dms-layout/app/build/components/layout/MockupSidebarMenu.vue +6 -21
- package/frontend-vue/layers/dms-layout/app/build/components/layout/SidebarUserMenu.vue +7 -19
- package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupMenu.ts +9 -79
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsNav.vue +4 -17
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsShell.vue +0 -12
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/useSettingsNavigation.ts +0 -39
- package/frontend-vue/layers/dms-layout/app/build/mockups/created-mockups.ts +2 -12
- package/frontend-vue/layers/dms-layout/app/build/mockups/created-toast.ts +1 -9
- package/frontend-vue/layers/dms-layout/app/custom-layouts/PreviewLayout.vue +6 -53
- package/frontend-vue/layers/dms-layout/app/theme/actions.ts +7 -11
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/BlockPreviewSketch.vue +5 -31
- 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/MockupModules.vue +47 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverview.vue +33 -59
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSlot.vue +12 -58
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/{MockupZoomControls.vue → MockupOverviewZoom.vue} +15 -23
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPagesList.vue +0 -21
- 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/MockupTopBar.vue +9 -77
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkbench.vue +45 -130
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewCapture.ts +3 -70
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewNavigation.ts +4 -44
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockInspector.ts +2 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockPreviewEmbed.ts +36 -256
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupEditing.ts +1 -13
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupFrameSize.ts +5 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupOverview.ts +23 -50
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageFrame.ts +29 -82
- 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 +3 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupRoutePage.ts +14 -60
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSession.ts +3 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSpec.ts +2 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupToolModes.ts +7 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerPages.ts +8 -29
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerShortcuts.ts +2 -13
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useOverviewCaptures.ts +10 -39
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewFrame.ts +0 -29
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +3 -37
- package/frontend-vue/layers/dms-ui/app/build/mockups/manage.ts +1 -20
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewChannel.ts +8 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +103 -167
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewRects.ts +0 -22
- package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +173 -75
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCaptures.ts +9 -118
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupFrame.ts +8 -123
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupLinks.ts +2 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverview.ts +3 -21
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupPageTree.ts +0 -15
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupPins.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupRealData.ts +5 -18
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupShortcuts.ts +6 -17
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +2 -17
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupVersions.ts +7 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/previewFixturesOnly.ts +0 -8
- package/frontend-vue/layers/dms-ui/app/build/utils/previewPageLayout.ts +6 -108
- package/frontend-vue/layers/dms-ui/app/build/utils/previewPageQuery.ts +1 -5
- package/frontend-vue/layers/dms-ui/app/build/utils/sketch.ts +10 -40
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +6 -23
- package/frontend-vue/layers/dms-ui/app/components/block-preview/MockupViewer.vue +0 -2
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-en-GB.json +4 -53
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-fr-FR.json +4 -53
- package/frontend-vue/package.json +2 -2
- package/package.json +5 -6
- package/E2E.md +0 -138
- package/dist/mcp/mockup-export/capture.d.ts +0 -19
- package/dist/mcp/mockup-export/capture.js +0 -99
- package/dist/mcp/mockup-export/capture.js.map +0 -1
- package/dist/mcp/mockup-export/document.d.ts +0 -4
- package/dist/mcp/mockup-export/document.js +0 -199
- package/dist/mcp/mockup-export/document.js.map +0 -1
- package/dist/mcp/mockup-export/index.d.ts +0 -20
- package/dist/mcp/mockup-export/index.js +0 -110
- package/dist/mcp/mockup-export/index.js.map +0 -1
- package/dist/mcp/mockup-export/jobs.d.ts +0 -32
- package/dist/mcp/mockup-export/jobs.js +0 -49
- package/dist/mcp/mockup-export/jobs.js.map +0 -1
- package/dist/mcp/mockup-export/plan.d.ts +0 -78
- package/dist/mcp/mockup-export/plan.js +0 -292
- package/dist/mcp/mockup-export/plan.js.map +0 -1
- package/dist/mcp/mockup-export/route.d.ts +0 -23
- package/dist/mcp/mockup-export/route.js +0 -91
- package/dist/mcp/mockup-export/route.js.map +0 -1
- package/dist/mcp/page-verify/modules.d.ts +0 -8
- package/dist/mcp/page-verify/modules.js +0 -49
- package/dist/mcp/page-verify/modules.js.map +0 -1
- package/dist/mcp/tools/mockup-export-pdf.d.ts +0 -1
- package/dist/mcp/tools/mockup-export-pdf.js +0 -69
- package/dist/mcp/tools/mockup-export-pdf.js.map +0 -1
- package/dist/mcp/tools/mockup-module-catalog.d.ts +0 -1
- package/dist/mcp/tools/mockup-module-catalog.js +0 -36
- package/dist/mcp/tools/mockup-module-catalog.js.map +0 -1
- package/dist/mockup/compile-layouts.d.ts +0 -5
- package/dist/mockup/compile-layouts.js +0 -74
- package/dist/mockup/compile-layouts.js.map +0 -1
- package/dist/mockup/compile-nodes.d.ts +0 -11
- package/dist/mockup/compile-nodes.js +0 -119
- package/dist/mockup/compile-nodes.js.map +0 -1
- package/dist/mockup/compile-pages.d.ts +0 -18
- package/dist/mockup/compile-pages.js +0 -189
- package/dist/mockup/compile-pages.js.map +0 -1
- package/dist/mockup/create.d.ts +0 -16
- package/dist/mockup/create.js +0 -78
- package/dist/mockup/create.js.map +0 -1
- package/dist/mockup/created-watch.d.ts +0 -18
- package/dist/mockup/created-watch.js +0 -110
- package/dist/mockup/created-watch.js.map +0 -1
- package/dist/mockup/entities.d.ts +0 -20
- package/dist/mockup/entities.js +0 -213
- package/dist/mockup/entities.js.map +0 -1
- package/dist/mockup/etag.d.ts +0 -1
- package/dist/mockup/etag.js +0 -10
- package/dist/mockup/etag.js.map +0 -1
- package/dist/mockup/extensions.d.ts +0 -18
- package/dist/mockup/extensions.js +0 -61
- package/dist/mockup/extensions.js.map +0 -1
- package/dist/mockup/fixture-batch.d.ts +0 -21
- package/dist/mockup/fixture-batch.js +0 -111
- package/dist/mockup/fixture-batch.js.map +0 -1
- package/dist/mockup/fixture-routes.d.ts +0 -21
- package/dist/mockup/fixture-routes.js +0 -136
- package/dist/mockup/fixture-routes.js.map +0 -1
- package/dist/mockup/json-schema-entities.d.ts +0 -5
- package/dist/mockup/json-schema-entities.js +0 -141
- package/dist/mockup/json-schema-entities.js.map +0 -1
- package/dist/mockup/json.d.ts +0 -8
- package/dist/mockup/json.js +0 -20
- package/dist/mockup/json.js.map +0 -1
- package/dist/mockup/layout-model.d.ts +0 -156
- package/dist/mockup/layout-model.js +0 -96
- package/dist/mockup/layout-model.js.map +0 -1
- package/dist/mockup/layouts.d.ts +0 -9
- package/dist/mockup/layouts.js +0 -40
- package/dist/mockup/layouts.js.map +0 -1
- package/dist/mockup/module-manifests.d.ts +0 -99
- package/dist/mockup/module-manifests.js +0 -95
- package/dist/mockup/module-manifests.js.map +0 -1
- package/dist/mockup/module-states.d.ts +0 -10
- package/dist/mockup/module-states.js +0 -85
- package/dist/mockup/module-states.js.map +0 -1
- package/dist/mockup/modules-schema.d.ts +0 -2
- package/dist/mockup/modules-schema.js +0 -39
- package/dist/mockup/modules-schema.js.map +0 -1
- package/dist/mockup/page-capture-routes.d.ts +0 -19
- package/dist/mockup/page-capture-routes.js +0 -92
- package/dist/mockup/page-capture-routes.js.map +0 -1
- package/dist/mockup/page-captures.d.ts +0 -61
- package/dist/mockup/page-captures.js +0 -252
- package/dist/mockup/page-captures.js.map +0 -1
- package/dist/mockup/parse-spec.d.ts +0 -10
- package/dist/mockup/parse-spec.js +0 -62
- package/dist/mockup/parse-spec.js.map +0 -1
- package/dist/mockup/places.d.ts +0 -17
- package/dist/mockup/places.js +0 -75
- package/dist/mockup/places.js.map +0 -1
- package/dist/mockup/slug.d.ts +0 -3
- package/dist/mockup/slug.js +0 -7
- package/dist/mockup/slug.js.map +0 -1
- package/dist/mockup/state-patch.d.ts +0 -22
- package/dist/mockup/state-patch.js +0 -75
- package/dist/mockup/state-patch.js.map +0 -1
- package/dist/mockup/state.d.ts +0 -112
- package/dist/mockup/state.js +0 -22
- package/dist/mockup/state.js.map +0 -1
- package/dist/mockup/store-list.d.ts +0 -28
- package/dist/mockup/store-list.js +0 -89
- package/dist/mockup/store-list.js.map +0 -1
- package/dist/mockup/tenancy.d.ts +0 -19
- package/dist/mockup/tenancy.js +0 -73
- package/dist/mockup/tenancy.js.map +0 -1
- package/dist/mockup/tenant-rows.d.ts +0 -4
- package/dist/mockup/tenant-rows.js +0 -19
- package/dist/mockup/tenant-rows.js.map +0 -1
- package/frontend-vue/layers/dms-core/app/utils/localFetchAnswers.ts +0 -124
- package/frontend-vue/layers/dms-core/app/utils/textDigest.ts +0 -29
- package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupWidgets.ts +0 -65
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabase.vue +0 -153
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEmptyState.vue +0 -23
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModuleStore.vue +0 -164
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSectionLabel.vue +0 -51
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupReconnecting.vue +0 -17
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTenantBanner.vue +0 -48
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkspaceSwitcher.vue +0 -142
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useFixtureBatches.ts +0 -154
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupActivation.ts +0 -157
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupDatabase.ts +0 -165
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupFrameRender.ts +0 -126
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageZoom.ts +0 -138
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPdfExport.ts +0 -124
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupTenancy.ts +0 -37
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerActivation.ts +0 -56
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerExport.ts +0 -46
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePersistedCaptures.ts +0 -151
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCreateModal.vue +0 -130
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewNavigation.ts +0 -332
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupActivation.ts +0 -100
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupAnnotations.ts +0 -146
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupEntities.ts +0 -80
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupModuleNavigation.ts +0 -171
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupModules.ts +0 -138
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverviewSections.ts +0 -66
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSchema.ts +0 -177
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStatePatch.ts +0 -179
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenancy.ts +0 -143
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenants.ts +0 -23
- package/frontend-vue/layers/dms-ui/app/build/utils/previewFixtureAnswers.ts +0 -156
- package/frontend-vue/layers/dms-ui/app/build/utils/previewRows.ts +0 -400
- package/frontend-vue/layers/dms-ui/app/build/utils/recordGuards.ts +0 -15
- package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupModuleStore.ts +0 -2
- package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupTenantBanner.ts +0 -2
- package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupWorkspaceSwitcher.ts +0 -2
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useFixtureBatches.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupActivation.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupOverview.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupPdfExport.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupRoutePage.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupSession.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupTenancy.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/usePersistedCaptures.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/json.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupActivation.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupAnnotations.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupModuleNavigation.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupOverviewSections.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupSchema.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupStatePatch.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenancy.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenants.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/previewFixtureAnswers.ts +0 -1
- package/frontend-vue/layers/dms-ui/app/entries/utils/previewRows.ts +0 -1
|
@@ -1,171 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { isNumber, isString } from "../../../../dms-core/app/utils/type-check";
|
|
2
|
-
import { isOptionalString, isRecord } from "./recordGuards";
|
|
3
|
-
|
|
4
|
-
/** A settings page a module adds under `/settings`: its full page id, its title and its icon. */
|
|
5
|
-
export interface MockupModuleSettingsPage {
|
|
6
|
-
id: string;
|
|
7
|
-
title: string;
|
|
8
|
-
icon: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/** Where in the sidebar a module's widget sits. */
|
|
12
|
-
export type MockupWidgetPosition = "above-search" | "below-search";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A widget an installed module puts in the sidebar. Its `id` is the id of the
|
|
16
|
-
* real widget it stands for, so the sidebar hides that one in its favour.
|
|
17
|
-
*/
|
|
18
|
-
export type MockupModuleWidget =
|
|
19
|
-
| { id: string; kind: "workspace-switcher"; position: MockupWidgetPosition }
|
|
20
|
-
| {
|
|
21
|
-
id: string;
|
|
22
|
-
kind: "sketch";
|
|
23
|
-
title?: string;
|
|
24
|
-
/** Checked markup: empty when the manifest's was refused. */
|
|
25
|
-
html: string;
|
|
26
|
-
css?: string;
|
|
27
|
-
/** Frame height in CSS pixels. */
|
|
28
|
-
height?: number;
|
|
29
|
-
position: MockupWidgetPosition;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/** A module the mockup installs, as the module store and the sidebar draw it. */
|
|
33
|
-
export interface MockupModule {
|
|
34
|
-
/** The catalog id, or the id of the module the spec defines. */
|
|
35
|
-
id: string;
|
|
36
|
-
title: string;
|
|
37
|
-
icon: string;
|
|
38
|
-
description?: string;
|
|
39
|
-
/** The npm package building the mockup installs; a spec's own module has none. */
|
|
40
|
-
package?: string;
|
|
41
|
-
/** Installing the module makes the app multi-tenant: the viewer shows SaaS mode. */
|
|
42
|
-
tenancy?: true;
|
|
43
|
-
widgets: MockupModuleWidget[];
|
|
44
|
-
settings: MockupModuleSettingsPage[];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Where in the menu an extended page is listed. */
|
|
48
|
-
export type MockupExtensionMenu = "app" | "settings" | { module: string };
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Where a page lives. `app`: the spec's sections. `module`: `/modules/<module>`,
|
|
52
|
-
* owner only. `settings`: `/settings/<id>`, listed under the dashboard's
|
|
53
|
-
* Settings. `extension`: the existing page `target`, with the blocks the
|
|
54
|
-
* spec's extending pages inject into it, listed where `menu` says.
|
|
55
|
-
*/
|
|
56
|
-
export type MockupPagePlace =
|
|
57
|
-
| { kind: "app" }
|
|
58
|
-
| { kind: "module"; module: string }
|
|
59
|
-
| { kind: "settings" }
|
|
60
|
-
| { kind: "extension"; target: string; menu: MockupExtensionMenu };
|
|
61
|
-
|
|
62
|
-
function isWidgetPosition(
|
|
63
|
-
value: Parameters<typeof isString>[0],
|
|
64
|
-
): value is MockupWidgetPosition {
|
|
65
|
-
return value === "above-search" || value === "below-search";
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function isModuleWidget(value: unknown): value is MockupModuleWidget {
|
|
69
|
-
if (!isRecord(value) || !isString(value.id)) return false;
|
|
70
|
-
if (!isWidgetPosition(value.position)) return false;
|
|
71
|
-
if (value.kind === "workspace-switcher") return true;
|
|
72
|
-
return (
|
|
73
|
-
value.kind === "sketch" &&
|
|
74
|
-
isString(value.html) &&
|
|
75
|
-
isOptionalString(value.title) &&
|
|
76
|
-
isOptionalString(value.css) &&
|
|
77
|
-
(value.height === undefined || isNumber(value.height))
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function isSettingsPage(value: unknown): value is MockupModuleSettingsPage {
|
|
82
|
-
return (
|
|
83
|
-
isRecord(value) &&
|
|
84
|
-
isString(value.id) &&
|
|
85
|
-
isString(value.title) &&
|
|
86
|
-
isString(value.icon)
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function isModule(value: unknown): value is MockupModule {
|
|
91
|
-
return (
|
|
92
|
-
isRecord(value) &&
|
|
93
|
-
isString(value.id) &&
|
|
94
|
-
isString(value.title) &&
|
|
95
|
-
isString(value.icon) &&
|
|
96
|
-
isOptionalString(value.description) &&
|
|
97
|
-
isOptionalString(value.package) &&
|
|
98
|
-
(value.tenancy === undefined || value.tenancy === true) &&
|
|
99
|
-
Array.isArray(value.widgets) &&
|
|
100
|
-
value.widgets.every(isModuleWidget) &&
|
|
101
|
-
Array.isArray(value.settings) &&
|
|
102
|
-
value.settings.every(isSettingsPage)
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/** Whether `value` is a list of installed modules, each read. */
|
|
107
|
-
export function isMockupModules(value: unknown): value is MockupModule[] {
|
|
108
|
-
return Array.isArray(value) && value.every(isModule);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function isExtensionMenu(value: unknown): value is MockupExtensionMenu {
|
|
112
|
-
return (
|
|
113
|
-
value === "app" ||
|
|
114
|
-
value === "settings" ||
|
|
115
|
-
(isRecord(value) && isString(value.module))
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/** Whether `value` is a page's place. */
|
|
120
|
-
export function isPagePlace(value: unknown): value is MockupPagePlace {
|
|
121
|
-
if (!isRecord(value)) return false;
|
|
122
|
-
if (value.kind === "app" || value.kind === "settings") return true;
|
|
123
|
-
if (value.kind === "module") return isString(value.module);
|
|
124
|
-
return (
|
|
125
|
-
value.kind === "extension" &&
|
|
126
|
-
isString(value.target) &&
|
|
127
|
-
isExtensionMenu(value.menu)
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/** The module a page's place lists it under, none for a page of the app's menu or of Settings. */
|
|
132
|
-
export function placeModule(place: MockupPagePlace): string | undefined {
|
|
133
|
-
if (place.kind === "module") return place.module;
|
|
134
|
-
if (place.kind !== "extension") return undefined;
|
|
135
|
-
return place.menu === "app" || place.menu === "settings"
|
|
136
|
-
? undefined
|
|
137
|
-
: place.menu.module;
|
|
138
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { MockupCategory, MockupModule, MockupPageState } from "./mockup";
|
|
2
|
-
import {
|
|
3
|
-
isAppPage,
|
|
4
|
-
isSettingsPage,
|
|
5
|
-
moduleOfPage,
|
|
6
|
-
} from "./mockupModuleNavigation";
|
|
7
|
-
import { groupSections } from "./mockupSections";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* What labels a section's row of the Overview: a category of the app's menu,
|
|
11
|
-
* none for the default section; a module, whose pages sit at `/modules/<id>`,
|
|
12
|
-
* owner only; or Settings, where the spec's settings pages and the pages that
|
|
13
|
-
* extend a Settings page sit.
|
|
14
|
-
*/
|
|
15
|
-
export interface OverviewSectionTitle {
|
|
16
|
-
category?: MockupCategory;
|
|
17
|
-
module?: Pick<MockupModule, "id" | "title" | "icon">;
|
|
18
|
-
isSettings?: true;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** The key of a row's label, unique among the Overview's rows: the category id, `module:<id>` or `settings`. */
|
|
22
|
-
export function overviewSectionKey(label: OverviewSectionTitle): string {
|
|
23
|
-
if (label.module) return `module:${label.module.id}`;
|
|
24
|
-
if (label.isSettings) return "settings";
|
|
25
|
-
return label.category?.id ?? "";
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** A row of the Overview: its label, and the top pages it lays out. */
|
|
29
|
-
export interface OverviewPageSection {
|
|
30
|
-
title: OverviewSectionTitle;
|
|
31
|
-
pages: MockupPageState[];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The top pages of the mockup as the Overview rows them: the app's sections
|
|
36
|
-
* first, the default one then each category, then each installed module with
|
|
37
|
-
* the pages it adds or extends, then Settings with the spec's settings pages
|
|
38
|
-
* and the pages that extend a Settings page. A module or Settings with no
|
|
39
|
-
* page has no row.
|
|
40
|
-
*/
|
|
41
|
-
export function overviewSections(
|
|
42
|
-
categories: readonly MockupCategory[],
|
|
43
|
-
modules: readonly MockupModule[],
|
|
44
|
-
roots: readonly MockupPageState[],
|
|
45
|
-
): OverviewPageSection[] {
|
|
46
|
-
const app = groupSections(
|
|
47
|
-
categories,
|
|
48
|
-
roots.filter(isAppPage),
|
|
49
|
-
(page) => page.category,
|
|
50
|
-
).map((section): OverviewPageSection => ({
|
|
51
|
-
title: { category: section.category },
|
|
52
|
-
pages: section.pages,
|
|
53
|
-
}));
|
|
54
|
-
const ofModules = modules.map((module): OverviewPageSection => ({
|
|
55
|
-
title: { module },
|
|
56
|
-
pages: roots.filter((page) => moduleOfPage(page) === module.id),
|
|
57
|
-
}));
|
|
58
|
-
const settings: OverviewPageSection = {
|
|
59
|
-
title: { isSettings: true },
|
|
60
|
-
pages: roots.filter(isSettingsPage),
|
|
61
|
-
};
|
|
62
|
-
return [...app, ...ofModules, settings].filter(
|
|
63
|
-
(section) =>
|
|
64
|
-
section.pages.length > 0 || section.title.category !== undefined,
|
|
65
|
-
);
|
|
66
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import type { JsonObject, JsonWritableObject } from "./json";
|
|
2
|
-
import type {
|
|
3
|
-
MockupEntityField,
|
|
4
|
-
MockupEntityState,
|
|
5
|
-
MockupFieldType,
|
|
6
|
-
} from "./mockupEntities";
|
|
7
|
-
|
|
8
|
-
/** The name `@antelopejs/dms-database` registers its schema explorer under. */
|
|
9
|
-
export const SCHEMA_EXPLORER_COMPONENT = "DmsDatabaseSchemaExplorer";
|
|
10
|
-
|
|
11
|
-
/** The package that registers {@link SCHEMA_EXPLORER_COMPONENT}. */
|
|
12
|
-
export const SCHEMA_EXPLORER_PACKAGE = "@antelopejs/dms-database";
|
|
13
|
-
|
|
14
|
-
/** The id of the one schema the spec's entities make up. */
|
|
15
|
-
export const MOCKUP_SCHEMA_ID = "mockup";
|
|
16
|
-
|
|
17
|
-
/** The badge the diagram draws in the header of a tenant-scoped entity's table. */
|
|
18
|
-
export const TENANT_SCOPED_BADGE = "Tenant-scoped";
|
|
19
|
-
|
|
20
|
-
/** What the explorer needs of the schema's field descriptors, as `@antelopejs/dms-database` declares them. */
|
|
21
|
-
export type FieldDescriptor =
|
|
22
|
-
| { kind: "string" }
|
|
23
|
-
| { kind: "number" }
|
|
24
|
-
| { kind: "boolean" }
|
|
25
|
-
| { kind: "date" }
|
|
26
|
-
| { kind: "literal"; value: string | number | boolean }
|
|
27
|
-
| { kind: "union"; members: FieldDescriptor[] }
|
|
28
|
-
| { kind: "refinement"; base: FieldDescriptor; name: string };
|
|
29
|
-
|
|
30
|
-
export interface RelationDeclaration {
|
|
31
|
-
fromField: string;
|
|
32
|
-
toSchema: string;
|
|
33
|
-
toTable: string;
|
|
34
|
-
toField: string;
|
|
35
|
-
many: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface TableSummary {
|
|
39
|
-
name: string;
|
|
40
|
-
fields: Record<string, FieldDescriptor>;
|
|
41
|
-
indexes: Record<string, { fields?: string[]; multi?: boolean }>;
|
|
42
|
-
relations: RelationDeclaration[];
|
|
43
|
-
modifiers?: Record<string, string[]>;
|
|
44
|
-
/** Labels the diagram draws in the table's header. */
|
|
45
|
-
badges?: string[];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface SchemaSummary {
|
|
49
|
-
id: string;
|
|
50
|
-
options: Record<string, never>;
|
|
51
|
-
tables: TableSummary[];
|
|
52
|
-
label?: { text: string; color?: string };
|
|
53
|
-
stats: { tableCount: number; elementCount: number; instanceCount: number };
|
|
54
|
-
instances: string[];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** Where the explorer reads its schema: the one it is given, with its rows, or the connection it introspects. */
|
|
58
|
-
export type SchemaExplorerSource =
|
|
59
|
-
| {
|
|
60
|
-
kind: "static";
|
|
61
|
-
schema: SchemaSummary;
|
|
62
|
-
rows: Record<string, JsonObject[]>;
|
|
63
|
-
}
|
|
64
|
-
| { kind: "connection"; connection: string };
|
|
65
|
-
|
|
66
|
-
/** The views of the explorer. */
|
|
67
|
-
export type SchemaExplorerView = "diagram" | "data";
|
|
68
|
-
|
|
69
|
-
const STRING: FieldDescriptor = { kind: "string" };
|
|
70
|
-
const NUMBER: FieldDescriptor = { kind: "number" };
|
|
71
|
-
|
|
72
|
-
function refined(base: FieldDescriptor, name: string): FieldDescriptor {
|
|
73
|
-
return { kind: "refinement", base, name };
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** The descriptor each field type draws as: an `email`, a `url` and a `price` are refinements of their base, an `enum` is the union of its values, a `ref` the string key it holds. */
|
|
77
|
-
const DESCRIBE: Record<
|
|
78
|
-
MockupFieldType,
|
|
79
|
-
(field: MockupEntityField) => FieldDescriptor
|
|
80
|
-
> = {
|
|
81
|
-
string: () => STRING,
|
|
82
|
-
number: () => NUMBER,
|
|
83
|
-
price: () => refined(NUMBER, "price"),
|
|
84
|
-
boolean: () => ({ kind: "boolean" }),
|
|
85
|
-
date: () => ({ kind: "date" }),
|
|
86
|
-
email: () => refined(STRING, "email"),
|
|
87
|
-
url: () => refined(STRING, "url"),
|
|
88
|
-
enum: (field) => ({
|
|
89
|
-
kind: "union",
|
|
90
|
-
members: (field.values ?? []).map((value) => ({ kind: "literal", value })),
|
|
91
|
-
}),
|
|
92
|
-
ref: () => STRING,
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
function relationOf(
|
|
96
|
-
field: MockupEntityField,
|
|
97
|
-
known: ReadonlySet<string>,
|
|
98
|
-
): RelationDeclaration[] {
|
|
99
|
-
if (field.to === undefined || !known.has(field.to)) return [];
|
|
100
|
-
return [
|
|
101
|
-
{
|
|
102
|
-
fromField: field.name,
|
|
103
|
-
toSchema: MOCKUP_SCHEMA_ID,
|
|
104
|
-
toTable: field.to,
|
|
105
|
-
toField: "id",
|
|
106
|
-
many: false,
|
|
107
|
-
},
|
|
108
|
-
];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function tableOf(
|
|
112
|
-
entity: MockupEntityState,
|
|
113
|
-
known: ReadonlySet<string>,
|
|
114
|
-
): TableSummary {
|
|
115
|
-
return {
|
|
116
|
-
name: entity.name,
|
|
117
|
-
fields: Object.fromEntries(
|
|
118
|
-
entity.fields.map((field) => [field.name, DESCRIBE[field.type](field)]),
|
|
119
|
-
),
|
|
120
|
-
indexes: { id: { fields: ["id"] } },
|
|
121
|
-
relations: entity.fields.flatMap((field) => relationOf(field, known)),
|
|
122
|
-
...(entity.tenantScoped && {
|
|
123
|
-
badges: [TENANT_SCOPED_BADGE],
|
|
124
|
-
}),
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* The explorer's source for the spec's entities: one table per entity with
|
|
130
|
-
* `id` indexed, a relation for each `ref` whose target is an entity, and the
|
|
131
|
-
* rows the entities hold, keyed by entity name.
|
|
132
|
-
*/
|
|
133
|
-
export function entitiesSource(
|
|
134
|
-
entities: readonly MockupEntityState[],
|
|
135
|
-
): Extract<SchemaExplorerSource, { kind: "static" }> {
|
|
136
|
-
const known = new Set(entities.map((entity) => entity.name));
|
|
137
|
-
return {
|
|
138
|
-
kind: "static",
|
|
139
|
-
schema: {
|
|
140
|
-
id: MOCKUP_SCHEMA_ID,
|
|
141
|
-
options: {},
|
|
142
|
-
tables: entities.map((entity) => tableOf(entity, known)),
|
|
143
|
-
stats: {
|
|
144
|
-
tableCount: entities.length,
|
|
145
|
-
elementCount: entities.reduce(
|
|
146
|
-
(count, entity) => count + entity.rows.length,
|
|
147
|
-
0,
|
|
148
|
-
),
|
|
149
|
-
instanceCount: 0,
|
|
150
|
-
},
|
|
151
|
-
instances: [],
|
|
152
|
-
},
|
|
153
|
-
rows: Object.fromEntries(
|
|
154
|
-
entities.map((entity) => [entity.name, entity.rows]),
|
|
155
|
-
),
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/** The entities as `spec.json` writes them once serialized: keyed by name, each field keyed by its name, with `tenantScoped`, `to` and `values` only where they are set. */
|
|
160
|
-
export function entitiesSpec(
|
|
161
|
-
entities: readonly MockupEntityState[],
|
|
162
|
-
): JsonWritableObject {
|
|
163
|
-
return Object.fromEntries(
|
|
164
|
-
entities.map((entity) => [
|
|
165
|
-
entity.name,
|
|
166
|
-
{
|
|
167
|
-
tenantScoped: entity.tenantScoped,
|
|
168
|
-
fields: Object.fromEntries(
|
|
169
|
-
entity.fields.map((field) => [
|
|
170
|
-
field.name,
|
|
171
|
-
{ type: field.type, to: field.to, values: field.values },
|
|
172
|
-
]),
|
|
173
|
-
),
|
|
174
|
-
},
|
|
175
|
-
]),
|
|
176
|
-
);
|
|
177
|
-
}
|