@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
package/dist/mockup/state.d.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import type { JsonObject } from "./json";
|
|
2
|
-
import type { MockupCategory, MockupFieldType, MockupHeaderAction, MockupIssue, MockupLivePage, MockupName, MockupNode, MockupPageLayout, MockupPageOptions, MockupTenant, ModuleSettingsPage, ModuleWidget } from "./model";
|
|
3
|
-
export interface MockupPageState {
|
|
4
|
-
id: string;
|
|
5
|
-
title: string;
|
|
6
|
-
place: MockupPagePlace;
|
|
7
|
-
category?: string;
|
|
8
|
-
menu?: false;
|
|
9
|
-
custom?: true;
|
|
10
|
-
generated?: true;
|
|
11
|
-
parent?: string;
|
|
12
|
-
route?: {
|
|
13
|
-
param: string;
|
|
14
|
-
sample?: string;
|
|
15
|
-
};
|
|
16
|
-
links: string[];
|
|
17
|
-
icon?: string;
|
|
18
|
-
description?: string;
|
|
19
|
-
headerActions?: MockupHeaderAction[];
|
|
20
|
-
layout?: MockupPageLayoutState;
|
|
21
|
-
options: MockupPageOptions;
|
|
22
|
-
tree: MockupNode[];
|
|
23
|
-
realTree?: MockupNode[];
|
|
24
|
-
fixtures?: string;
|
|
25
|
-
livePage?: Pick<MockupLivePage, "ref">;
|
|
26
|
-
paths: Record<string, string>;
|
|
27
|
-
}
|
|
28
|
-
export interface MockupLayoutRegionState {
|
|
29
|
-
html: string;
|
|
30
|
-
css?: string;
|
|
31
|
-
height: number;
|
|
32
|
-
}
|
|
33
|
-
export interface MockupLayoutAsideState extends MockupLayoutRegionState {
|
|
34
|
-
width: number;
|
|
35
|
-
side: "start" | "end";
|
|
36
|
-
}
|
|
37
|
-
export interface MockupCustomLayoutState {
|
|
38
|
-
type: "custom";
|
|
39
|
-
id: string;
|
|
40
|
-
title: string;
|
|
41
|
-
dashboard: boolean;
|
|
42
|
-
header?: MockupLayoutRegionState;
|
|
43
|
-
aside?: MockupLayoutAsideState;
|
|
44
|
-
footer?: MockupLayoutRegionState;
|
|
45
|
-
}
|
|
46
|
-
export type MockupPageLayoutState = Exclude<MockupPageLayout, {
|
|
47
|
-
type: "custom";
|
|
48
|
-
}> | MockupCustomLayoutState;
|
|
49
|
-
export interface MockupModule {
|
|
50
|
-
id: string;
|
|
51
|
-
title: string;
|
|
52
|
-
icon: string;
|
|
53
|
-
description?: string;
|
|
54
|
-
package?: string;
|
|
55
|
-
tenancy?: true;
|
|
56
|
-
widgets: ModuleWidget[];
|
|
57
|
-
settings: ModuleSettingsPage[];
|
|
58
|
-
}
|
|
59
|
-
export type MockupExtensionMenu = "app" | "settings" | {
|
|
60
|
-
module: string;
|
|
61
|
-
};
|
|
62
|
-
export type MockupPagePlace = {
|
|
63
|
-
kind: "app";
|
|
64
|
-
} | {
|
|
65
|
-
kind: "module";
|
|
66
|
-
module: string;
|
|
67
|
-
} | {
|
|
68
|
-
kind: "settings";
|
|
69
|
-
} | {
|
|
70
|
-
kind: "extension";
|
|
71
|
-
target: string;
|
|
72
|
-
menu: MockupExtensionMenu;
|
|
73
|
-
};
|
|
74
|
-
export interface MockupSidebarWidgetState {
|
|
75
|
-
id: string;
|
|
76
|
-
title?: string;
|
|
77
|
-
html: string;
|
|
78
|
-
css?: string;
|
|
79
|
-
height: number;
|
|
80
|
-
}
|
|
81
|
-
export interface MockupSidebarState {
|
|
82
|
-
widgets: MockupSidebarWidgetState[];
|
|
83
|
-
}
|
|
84
|
-
export interface MockupEntityField {
|
|
85
|
-
name: string;
|
|
86
|
-
type: MockupFieldType;
|
|
87
|
-
to?: string;
|
|
88
|
-
values?: string[];
|
|
89
|
-
}
|
|
90
|
-
export interface MockupEntityState {
|
|
91
|
-
name: string;
|
|
92
|
-
tenantScoped?: true;
|
|
93
|
-
fields: MockupEntityField[];
|
|
94
|
-
rows: JsonObject[];
|
|
95
|
-
pages: string[];
|
|
96
|
-
}
|
|
97
|
-
export interface MockupState {
|
|
98
|
-
name: MockupName;
|
|
99
|
-
title?: string;
|
|
100
|
-
revision: number;
|
|
101
|
-
categories?: MockupCategory[];
|
|
102
|
-
sidebar?: MockupSidebarState;
|
|
103
|
-
modules?: MockupModule[];
|
|
104
|
-
entities?: MockupEntityState[];
|
|
105
|
-
tenants?: MockupTenant[];
|
|
106
|
-
connection?: string;
|
|
107
|
-
pages: MockupPageState[];
|
|
108
|
-
issues: MockupIssue[];
|
|
109
|
-
warnings: MockupIssue[];
|
|
110
|
-
}
|
|
111
|
-
export type MockupStateParts = Pick<MockupState, "title" | "categories" | "sidebar" | "modules" | "entities" | "tenants" | "connection">;
|
|
112
|
-
export declare function stateParts(source: MockupStateParts): MockupStateParts;
|
package/dist/mockup/state.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stateParts = stateParts;
|
|
4
|
-
function stateParts(source) {
|
|
5
|
-
const parts = {};
|
|
6
|
-
if (source.title !== undefined)
|
|
7
|
-
parts.title = source.title;
|
|
8
|
-
if (source.categories !== undefined)
|
|
9
|
-
parts.categories = source.categories;
|
|
10
|
-
if (source.sidebar !== undefined)
|
|
11
|
-
parts.sidebar = source.sidebar;
|
|
12
|
-
if (source.modules !== undefined)
|
|
13
|
-
parts.modules = source.modules;
|
|
14
|
-
if (source.entities !== undefined)
|
|
15
|
-
parts.entities = source.entities;
|
|
16
|
-
if (source.tenants !== undefined)
|
|
17
|
-
parts.tenants = source.tenants;
|
|
18
|
-
if (source.connection !== undefined)
|
|
19
|
-
parts.connection = source.connection;
|
|
20
|
-
return parts;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=state.js.map
|
package/dist/mockup/state.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/mockup/state.ts"],"names":[],"mappings":";;;AA2NA,oBAA2B,MAAwB;IACjD,MAAM,KAAK,GAAqB,EAAE,CAAC;IACnC,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3D,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS;QAAE,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAC1E,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS;QAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IACjE,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS;QAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IACjE,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS;QAAE,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACpE,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS;QAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IACjE,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS;QAAE,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAC1E,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type BuiltPageSync, type PageReader } from "./built-sync";
|
|
2
|
-
import { type MockupName, type MockupSource } from "./model";
|
|
3
|
-
interface MockupSummaryBase {
|
|
4
|
-
name: MockupName;
|
|
5
|
-
title?: string;
|
|
6
|
-
pages: number;
|
|
7
|
-
openComments: number;
|
|
8
|
-
source?: MockupSource;
|
|
9
|
-
updatedAt: string;
|
|
10
|
-
capturedAt?: string;
|
|
11
|
-
}
|
|
12
|
-
export type MockupSummary = MockupSummaryBase & ({
|
|
13
|
-
status: "draft";
|
|
14
|
-
} | {
|
|
15
|
-
status: "built";
|
|
16
|
-
builtAt: string;
|
|
17
|
-
builtPages: Array<{
|
|
18
|
-
path: string;
|
|
19
|
-
title: string;
|
|
20
|
-
} & BuiltPageSync>;
|
|
21
|
-
});
|
|
22
|
-
export interface MockupListing {
|
|
23
|
-
mockupsDir: string;
|
|
24
|
-
livePages?: PageReader;
|
|
25
|
-
readSpec: (name: MockupName) => Promise<string | undefined>;
|
|
26
|
-
}
|
|
27
|
-
export declare function listMockups(listing: MockupListing): Promise<MockupSummary[]>;
|
|
28
|
-
export {};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listMockups = listMockups;
|
|
4
|
-
const promises_1 = require("node:fs/promises");
|
|
5
|
-
const node_path_1 = require("node:path");
|
|
6
|
-
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
7
|
-
const annotations_1 = require("./annotations");
|
|
8
|
-
const built_sync_1 = require("./built-sync");
|
|
9
|
-
const capture_1 = require("./capture");
|
|
10
|
-
const files_1 = require("./files");
|
|
11
|
-
const model_1 = require("./model");
|
|
12
|
-
const summary_fields_1 = require("./summary-fields");
|
|
13
|
-
async function openComments(mockupsDir, name) {
|
|
14
|
-
try {
|
|
15
|
-
const annotations = await (0, annotations_1.listAnnotations)(name, mockupsDir);
|
|
16
|
-
return (annotations?.filter((annotation) => annotation.status === "open")
|
|
17
|
-
.length ?? 0);
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
logging_1.Logging.Warn(`[DMS] mockup "${name}": annotations cannot be read`, error);
|
|
21
|
-
return 0;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
async function specFile(listing, name) {
|
|
25
|
-
const text = await listing.readSpec(name);
|
|
26
|
-
if (text === undefined)
|
|
27
|
-
return undefined;
|
|
28
|
-
try {
|
|
29
|
-
const { mtime } = await (0, promises_1.stat)((0, node_path_1.join)((0, files_1.mockupDirectory)(listing.mockupsDir, name), files_1.SPEC_FILE));
|
|
30
|
-
return { text, updatedAt: mtime.toISOString() };
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
if ((0, files_1.parseFsError)(error).code === files_1.MISSING_FILE)
|
|
34
|
-
return undefined;
|
|
35
|
-
throw error;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
async function summary(listing, name, reads) {
|
|
39
|
-
const file = await specFile(listing, name);
|
|
40
|
-
if (!file)
|
|
41
|
-
return undefined;
|
|
42
|
-
const { title, pages, source, built } = (0, summary_fields_1.readSummaryFields)(file.text);
|
|
43
|
-
const base = {
|
|
44
|
-
name,
|
|
45
|
-
pages: pages.length,
|
|
46
|
-
openComments: await openComments(listing.mockupsDir, name),
|
|
47
|
-
updatedAt: file.updatedAt,
|
|
48
|
-
};
|
|
49
|
-
const capturedAt = await (0, capture_1.captureUpdatedAt)(listing.mockupsDir, name);
|
|
50
|
-
if (capturedAt)
|
|
51
|
-
base.capturedAt = capturedAt.toISOString();
|
|
52
|
-
if (title !== undefined)
|
|
53
|
-
base.title = title;
|
|
54
|
-
if (source !== undefined)
|
|
55
|
-
base.source = source;
|
|
56
|
-
if (!built)
|
|
57
|
-
return { ...base, status: "draft" };
|
|
58
|
-
return {
|
|
59
|
-
...base,
|
|
60
|
-
status: "built",
|
|
61
|
-
builtAt: built.at,
|
|
62
|
-
builtPages: await Promise.all(built.pages.map(async (page) => ({
|
|
63
|
-
path: page.path,
|
|
64
|
-
title: page.title?.trim() || page.path,
|
|
65
|
-
...(await (0, built_sync_1.builtPageSync)(page.path, pages, reads)),
|
|
66
|
-
}))),
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
async function listMockups(listing) {
|
|
70
|
-
let names;
|
|
71
|
-
try {
|
|
72
|
-
names = await (0, promises_1.readdir)(listing.mockupsDir);
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
if ((0, files_1.parseFsError)(error).code === files_1.MISSING_FILE)
|
|
76
|
-
return [];
|
|
77
|
-
throw error;
|
|
78
|
-
}
|
|
79
|
-
const reads = listing.livePages && new built_sync_1.BuilderReads(listing.livePages);
|
|
80
|
-
const summaries = await Promise.all(names.map(async (raw) => {
|
|
81
|
-
const name = (0, model_1.parseMockupName)(raw);
|
|
82
|
-
return name ? summary(listing, name, reads) : undefined;
|
|
83
|
-
}));
|
|
84
|
-
return summaries
|
|
85
|
-
.flatMap((entry) => entry ?? [])
|
|
86
|
-
.sort((left, right) => right.updatedAt.localeCompare(left.updatedAt) ||
|
|
87
|
-
left.name.localeCompare(right.name));
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=store-list.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store-list.js","sourceRoot":"","sources":["../../src/mockup/store-list.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AACjD,yCAAiC;AACjC,gEAA6D;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from "./model";
|
|
3
|
-
declare const tenantSchema: z.ZodObject<{
|
|
4
|
-
id: z.ZodString;
|
|
5
|
-
name: z.ZodString;
|
|
6
|
-
plan: z.ZodOptional<z.ZodString>;
|
|
7
|
-
}, z.core.$strict>;
|
|
8
|
-
export type MockupTenant = z.infer<typeof tenantSchema>;
|
|
9
|
-
export declare const specFixturesSchema: z.ZodObject<{
|
|
10
|
-
tenants: z.ZodArray<z.ZodObject<{
|
|
11
|
-
id: z.ZodString;
|
|
12
|
-
name: z.ZodString;
|
|
13
|
-
plan: z.ZodOptional<z.ZodString>;
|
|
14
|
-
}, z.core.$strict>>;
|
|
15
|
-
}, z.core.$strict>;
|
|
16
|
-
export type TenantFixtures = ReadonlyMap<string, ReadonlySet<string>>;
|
|
17
|
-
export declare function tenantFixtures(spec: MockupSpec): TenantFixtures;
|
|
18
|
-
export declare function tenantIssues(spec: MockupSpec): MockupIssue[];
|
|
19
|
-
export {};
|
package/dist/mockup/tenancy.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.specFixturesSchema = void 0;
|
|
4
|
-
exports.tenantFixtures = tenantFixtures;
|
|
5
|
-
exports.tenantIssues = tenantIssues;
|
|
6
|
-
const zod_1 = require("zod");
|
|
7
|
-
const json_1 = require("./json");
|
|
8
|
-
const entities_1 = require("./entities");
|
|
9
|
-
const tenant_rows_1 = require("./tenant-rows");
|
|
10
|
-
const tenantSchema = zod_1.z
|
|
11
|
-
.object({
|
|
12
|
-
id: zod_1.z.string().min(1),
|
|
13
|
-
name: zod_1.z.string(),
|
|
14
|
-
plan: zod_1.z.string().optional(),
|
|
15
|
-
})
|
|
16
|
-
.strict();
|
|
17
|
-
exports.specFixturesSchema = zod_1.z
|
|
18
|
-
.object({ tenants: zod_1.z.array(tenantSchema) })
|
|
19
|
-
.strict();
|
|
20
|
-
const tenantIdSchema = zod_1.z.string();
|
|
21
|
-
function tenantFixtures(spec) {
|
|
22
|
-
const scoped = new Set(Object.entries(spec.entities ?? {}).flatMap(([name, entity]) => entity.tenantScoped === true ? [name] : []));
|
|
23
|
-
const keys = new Map();
|
|
24
|
-
for (const { pageId, key, entity } of (0, entities_1.pointingFixtures)(spec)) {
|
|
25
|
-
if (!scoped.has(entity))
|
|
26
|
-
continue;
|
|
27
|
-
keys.set(pageId, (keys.get(pageId) ?? new Set()).add(key));
|
|
28
|
-
}
|
|
29
|
-
return keys;
|
|
30
|
-
}
|
|
31
|
-
function tenantIssues(spec) {
|
|
32
|
-
const tenants = spec.fixtures?.tenants;
|
|
33
|
-
if (!tenants)
|
|
34
|
-
return [];
|
|
35
|
-
const known = new Set();
|
|
36
|
-
const duplicates = tenants.flatMap((tenant, index) => {
|
|
37
|
-
const seen = known.has(tenant.id);
|
|
38
|
-
known.add(tenant.id);
|
|
39
|
-
return seen
|
|
40
|
-
? [
|
|
41
|
-
{
|
|
42
|
-
path: (0, json_1.jsonPointer)(["fixtures", "tenants", index, "id"]),
|
|
43
|
-
message: `another tenant already has the id "${tenant.id}"`,
|
|
44
|
-
},
|
|
45
|
-
]
|
|
46
|
-
: [];
|
|
47
|
-
});
|
|
48
|
-
const scoped = tenantFixtures(spec);
|
|
49
|
-
const strays = (0, entities_1.pointingFixtures)(spec).flatMap((fixture) => scoped.get(fixture.pageId)?.has(fixture.key)
|
|
50
|
-
? fixture.rows.flatMap((row, at) => {
|
|
51
|
-
const read = tenantIdSchema.safeParse(row[tenant_rows_1.TENANT_ID_FIELD]);
|
|
52
|
-
const id = read.success ? read.data : undefined;
|
|
53
|
-
return id !== undefined && !known.has(id)
|
|
54
|
-
? [
|
|
55
|
-
{
|
|
56
|
-
path: (0, json_1.jsonPointer)([
|
|
57
|
-
"pages",
|
|
58
|
-
fixture.index,
|
|
59
|
-
"fixtures",
|
|
60
|
-
fixture.key,
|
|
61
|
-
"rows",
|
|
62
|
-
at,
|
|
63
|
-
tenant_rows_1.TENANT_ID_FIELD,
|
|
64
|
-
]),
|
|
65
|
-
message: `no tenant has the id "${id}": the tenants are ${[...known].join(", ")}`,
|
|
66
|
-
},
|
|
67
|
-
]
|
|
68
|
-
: [];
|
|
69
|
-
})
|
|
70
|
-
: []);
|
|
71
|
-
return [...duplicates, ...strays];
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=tenancy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tenancy.js","sourceRoot":"","sources":["../../src/mockup/tenancy.ts"],"names":[],"mappings":";;;;;AAAA,6BAAwB;AACxB,iCAAqC;AAErC,yCAA8C;AAC9C,+CAAgD;AAGhD,MAAM,YAAY,GAAG,OAAC;KACnB,MAAM,CAAC;IACN,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC;KACD,MAAM,EAAE,CAAC;AAKC,QAAA,kBAAkB,GAAG,OAAC;KAChC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;KAC1C,MAAM,EAAE,CAAC;AAEZ,MAAM,cAAc,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC;AAMlC,wBAA+B,IAAgB;IAC7C,MAAM,MAAM,GAAG,IAAI,GAAG,CACpB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE,CAC7D,MAAM,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAC3C,CACF,CAAC;IACF,MAAM,IAAI,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC5C,KAAK,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C,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC;QAC1C,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,EAAiB,EAAE;YAC9C,MAAM,IAAI,GAAG,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,6BAAe,CAAC,CAAC,CAAC;YAC5D,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;YAChD,OAAO,EAAE,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvC,CAAC,CAAC;oBACE;wBACE,IAAI,EAAE,IAAA,kBAAW,EAAC;4BAChB,OAAO;4BACP,OAAO,CAAC,KAAK;4BACb,UAAU;4BACV,OAAO,CAAC,GAAG;4BACX,MAAM;4BACN,EAAE;4BACF,6BAAe;yBAChB,CAAC;wBACF,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;qBAClF;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;QACT,CAAC,CAAC;QACJ,CAAC,CAAC,EAAE,CACP,CAAC;IACF,OAAO,CAAC,GAAG,UAAU,EAAE,GAAG,MAAM,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type Json, type JsonObject } from "./json";
|
|
2
|
-
export declare const TENANT_ID_FIELD = "tenantId";
|
|
3
|
-
export declare function tenantRows(rows: readonly JsonObject[], tenant: string): JsonObject[];
|
|
4
|
-
export declare function fixtureForTenant(value: Json, scoped: boolean, tenant: string | undefined): Json;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TENANT_ID_FIELD = void 0;
|
|
4
|
-
exports.tenantRows = tenantRows;
|
|
5
|
-
exports.fixtureForTenant = fixtureForTenant;
|
|
6
|
-
const zod_1 = require("zod");
|
|
7
|
-
const json_1 = require("./json");
|
|
8
|
-
exports.TENANT_ID_FIELD = "tenantId";
|
|
9
|
-
function tenantRows(rows, tenant) {
|
|
10
|
-
return rows.filter((row) => row[exports.TENANT_ID_FIELD] === tenant);
|
|
11
|
-
}
|
|
12
|
-
const rowsSchema = zod_1.z.array(json_1.jsonObjectSchema);
|
|
13
|
-
function fixtureForTenant(value, scoped, tenant) {
|
|
14
|
-
if (tenant === undefined || !scoped)
|
|
15
|
-
return value;
|
|
16
|
-
const rows = rowsSchema.safeParse(value);
|
|
17
|
-
return rows.success ? tenantRows(rows.data, tenant) : value;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=tenant-rows.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tenant-rows.js","sourceRoot":"","sources":["../../src/mockup/tenant-rows.ts"],"names":[],"mappings":";;;;;AAAA,6BAAwB;AACxB,iCAAsE;AAGzD,QAAA,eAAe,GAAG,UAAU,CAAC;AAG1C,oBACE,IAA2B,EAC3B,MAAc;IAEd,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAA,eAAe,CAAC,KAAK,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,GAAG,OAAC,CAAC,KAAK,CAAC,uBAAgB,CAAC,CAAC;AAO7C,0BACE,KAAW,EACX,MAAe,EACf,MAA0B;IAE1B,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAClD,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9D,CAAC"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import type { JsonValue } from "../types/json";
|
|
2
|
-
import type { HTTP_NOT_FOUND } from "./http-status";
|
|
3
|
-
import { isString } from "./type-check";
|
|
4
|
-
|
|
5
|
-
/** A GET `$authFetch` is about to send: its path, and every query parameter, whether the URL or the options hold it. */
|
|
6
|
-
export interface LocalFetchRequest {
|
|
7
|
-
path: string;
|
|
8
|
-
query: URLSearchParams;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/** What answers a GET with no request: the data, or the refusal the server would have sent. */
|
|
12
|
-
export type LocalFetchAnswer =
|
|
13
|
-
{ data: JsonValue } | { status: typeof HTTP_NOT_FOUND; message: string };
|
|
14
|
-
|
|
15
|
-
/** Answers a GET from what the page already holds; undefined leaves it to the network. */
|
|
16
|
-
export type LocalFetchAnswerer = (
|
|
17
|
-
request: LocalFetchRequest,
|
|
18
|
-
) => LocalFetchAnswer | undefined;
|
|
19
|
-
|
|
20
|
-
/** A value of a query option: a list repeats its key, an object is sent as JSON. */
|
|
21
|
-
type QueryValue = JsonValue | undefined;
|
|
22
|
-
type QueryOption = Record<string, QueryValue>;
|
|
23
|
-
|
|
24
|
-
/** The part of a fetch's options that decides whether a GET can be answered locally. */
|
|
25
|
-
interface LocalFetchOptions {
|
|
26
|
-
method?: string;
|
|
27
|
-
body?: BodyInit | object | null;
|
|
28
|
-
query?: QueryOption;
|
|
29
|
-
params?: QueryOption;
|
|
30
|
-
responseType?: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** The base the path of a relative request is read against. */
|
|
34
|
-
const REQUEST_BASE = "http://local.invalid";
|
|
35
|
-
|
|
36
|
-
/** The failure of a GET answered locally with a refusal: what ofetch's `FetchError` carries, so blocks read it as they read the server's. */
|
|
37
|
-
class LocalFetchError extends Error {
|
|
38
|
-
readonly status: number;
|
|
39
|
-
readonly statusCode: number;
|
|
40
|
-
readonly data: { message: string };
|
|
41
|
-
readonly response: { status: number; _data: { message: string } };
|
|
42
|
-
|
|
43
|
-
constructor(status: number, message: string) {
|
|
44
|
-
super(message);
|
|
45
|
-
this.name = "FetchError";
|
|
46
|
-
this.status = status;
|
|
47
|
-
this.statusCode = status;
|
|
48
|
-
this.data = { message };
|
|
49
|
-
this.response = { status, _data: { message } };
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let answerer: LocalFetchAnswerer | undefined;
|
|
54
|
-
|
|
55
|
-
/** Installs the answerer every `$authFetch` GET asks first; undefined removes it. */
|
|
56
|
-
export function setLocalFetchAnswerer(
|
|
57
|
-
next: LocalFetchAnswerer | undefined,
|
|
58
|
-
): void {
|
|
59
|
-
answerer = next;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/** An item of a list value, as ufo writes it: text as it is, anything else as JSON. */
|
|
63
|
-
function itemText(item: QueryValue): string {
|
|
64
|
-
return isString(item) ? item : (JSON.stringify(item) ?? "undefined");
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* The values `$fetch` sends for the query option `value`, as ufo's
|
|
69
|
-
* `stringifyQuery` writes them: none for `undefined` or an empty list, one
|
|
70
|
-
* for each item of a list, an empty one for `null` and for empty text, the
|
|
71
|
-
* text itself for text, and JSON for a number, a boolean or an object.
|
|
72
|
-
*/
|
|
73
|
-
function valuesOf(value: QueryValue): string[] {
|
|
74
|
-
if (value === undefined) return [];
|
|
75
|
-
if (Array.isArray(value)) return value.map(itemText);
|
|
76
|
-
if (value === null || value === "") return [""];
|
|
77
|
-
return [itemText(value)];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Puts the query options into `params` as `$fetch` merges them into the URL's
|
|
82
|
-
* own query: an option replaces every parameter of its name, and an option
|
|
83
|
-
* that is `undefined` removes it.
|
|
84
|
-
*/
|
|
85
|
-
function addQuery(params: URLSearchParams, query: QueryOption): void {
|
|
86
|
-
for (const [key, value] of Object.entries(query)) {
|
|
87
|
-
params.delete(key);
|
|
88
|
-
for (const text of valuesOf(value)) params.append(key, text);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/** The GET `request` and `options` describe, or undefined for a request only the network can answer. */
|
|
93
|
-
function readGet(
|
|
94
|
-
request: string | Request,
|
|
95
|
-
options: LocalFetchOptions | undefined,
|
|
96
|
-
): LocalFetchRequest | undefined {
|
|
97
|
-
const method = (options?.method ?? "GET").toUpperCase();
|
|
98
|
-
const isJson =
|
|
99
|
-
options?.responseType === undefined || options.responseType === "json";
|
|
100
|
-
if (!isString(request) || method !== "GET" || !isJson) return undefined;
|
|
101
|
-
if (options?.body !== undefined && options.body !== null) return undefined;
|
|
102
|
-
const url = new URL(request, REQUEST_BASE);
|
|
103
|
-
addQuery(url.searchParams, { ...options?.params, ...options?.query });
|
|
104
|
-
return { path: url.pathname, query: url.searchParams };
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* The answer of the installed answerer to the GET `request` and `options`
|
|
109
|
-
* describe, as the promise `$authFetch` returns; undefined when none is
|
|
110
|
-
* installed, the request is no plain GET, or the answerer leaves it to the
|
|
111
|
-
* network.
|
|
112
|
-
*/
|
|
113
|
-
export function answerFetchLocally(
|
|
114
|
-
request: string | Request,
|
|
115
|
-
options: LocalFetchOptions | undefined,
|
|
116
|
-
): Promise<JsonValue> | undefined {
|
|
117
|
-
if (!answerer) return undefined;
|
|
118
|
-
const get = readGet(request, options);
|
|
119
|
-
const answer = get && answerer(get);
|
|
120
|
-
if (!answer) return undefined;
|
|
121
|
-
return "data" in answer
|
|
122
|
-
? Promise.resolve(answer.data)
|
|
123
|
-
: Promise.reject(new LocalFetchError(answer.status, answer.message));
|
|
124
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const HASH_SEED_LOW = 0xdeadbeef;
|
|
2
|
-
const HASH_SEED_HIGH = 0x41c6ce57;
|
|
3
|
-
const HASH_MULTIPLIER_LOW = 2_654_435_761;
|
|
4
|
-
const HASH_MULTIPLIER_HIGH = 1_597_334_677;
|
|
5
|
-
const HASH_MIX_LOW = 2_246_822_507;
|
|
6
|
-
const HASH_MIX_HIGH = 3_266_489_909;
|
|
7
|
-
const HIGH_WORD = 2 ** 32;
|
|
8
|
-
const HIGH_BITS_MASK = 2_097_151;
|
|
9
|
-
const RADIX = 36;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* A 53-bit digest of `text` (cyrb53): the same in a server render and in the
|
|
13
|
-
* browser, and synchronous. Not a secret, and not collision resistant against
|
|
14
|
-
* an adversary: it only names a text by something short.
|
|
15
|
-
*/
|
|
16
|
-
export function textDigest(text: string): string {
|
|
17
|
-
let low = HASH_SEED_LOW;
|
|
18
|
-
let high = HASH_SEED_HIGH;
|
|
19
|
-
for (let index = 0; index < text.length; index++) {
|
|
20
|
-
const code = text.charCodeAt(index);
|
|
21
|
-
low = Math.imul(low ^ code, HASH_MULTIPLIER_LOW);
|
|
22
|
-
high = Math.imul(high ^ code, HASH_MULTIPLIER_HIGH);
|
|
23
|
-
}
|
|
24
|
-
low = Math.imul(low ^ (low >>> 16), HASH_MIX_LOW);
|
|
25
|
-
low ^= Math.imul(high ^ (high >>> 13), HASH_MIX_HIGH);
|
|
26
|
-
high = Math.imul(high ^ (high >>> 16), HASH_MIX_LOW);
|
|
27
|
-
high ^= Math.imul(low ^ (low >>> 13), HASH_MIX_HIGH);
|
|
28
|
-
return (HIGH_WORD * (HIGH_BITS_MASK & high) + (low >>> 0)).toString(RADIX);
|
|
29
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { markRaw, type Component } from "vue";
|
|
2
|
-
import BlockPreviewSketch from "#dms-ui/app/entries/components/block-preview/BlockPreviewSketch";
|
|
3
|
-
import MockupWorkspaceSwitcher from "#dms-ui/app/entries/components/block-preview/MockupWorkspaceSwitcher";
|
|
4
|
-
import type {
|
|
5
|
-
PreviewModuleWidget,
|
|
6
|
-
PreviewWidgetPosition,
|
|
7
|
-
PreviewWorkspace,
|
|
8
|
-
} from "#dms-ui/app/entries/utils/blockPreview";
|
|
9
|
-
|
|
10
|
-
/** What a module widget's component takes: the workspace its switcher lists, or the sketch it draws. */
|
|
11
|
-
type WidgetProps =
|
|
12
|
-
| { workspace: PreviewWorkspace }
|
|
13
|
-
| { sketch: Extract<PreviewModuleWidget, { kind: "sketch" }>["sketch"] };
|
|
14
|
-
|
|
15
|
-
/** A module's widget as the sidebar draws it: the component, its props, and whether it folds with the sidebar. */
|
|
16
|
-
export interface MockupWidgetView {
|
|
17
|
-
id: string;
|
|
18
|
-
component: Component;
|
|
19
|
-
props: WidgetProps;
|
|
20
|
-
/** The component takes `collapsed`, and shows in the icon rail; a widget without it is left out of the rail. */
|
|
21
|
-
isCollapsible: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
type WidgetView = Omit<MockupWidgetView, "id">;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* How each kind of module widget is drawn. The workspace switcher is fed by
|
|
28
|
-
* the sidebar's workspace and draws nothing without one; a sketch is drawn
|
|
29
|
-
* from its own markup.
|
|
30
|
-
*/
|
|
31
|
-
const WIDGET_VIEWS: Record<
|
|
32
|
-
PreviewModuleWidget["kind"],
|
|
33
|
-
(
|
|
34
|
-
widget: PreviewModuleWidget,
|
|
35
|
-
workspace: PreviewWorkspace | undefined,
|
|
36
|
-
) => WidgetView | undefined
|
|
37
|
-
> = {
|
|
38
|
-
"workspace-switcher": (_widget, workspace) =>
|
|
39
|
-
workspace && {
|
|
40
|
-
component: markRaw(MockupWorkspaceSwitcher),
|
|
41
|
-
props: { workspace },
|
|
42
|
-
isCollapsible: true,
|
|
43
|
-
},
|
|
44
|
-
sketch: (widget) =>
|
|
45
|
-
widget.kind === "sketch"
|
|
46
|
-
? {
|
|
47
|
-
component: markRaw(BlockPreviewSketch),
|
|
48
|
-
props: { sketch: widget.sketch },
|
|
49
|
-
isCollapsible: false,
|
|
50
|
-
}
|
|
51
|
-
: undefined,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/** The views of the module widgets at `position`, in the modules' order. */
|
|
55
|
-
export function moduleWidgetViews(
|
|
56
|
-
widgets: readonly PreviewModuleWidget[] | undefined,
|
|
57
|
-
position: PreviewWidgetPosition,
|
|
58
|
-
workspace: PreviewWorkspace | undefined,
|
|
59
|
-
): MockupWidgetView[] {
|
|
60
|
-
return (widgets ?? []).flatMap((widget) => {
|
|
61
|
-
if (widget.position !== position) return [];
|
|
62
|
-
const view = WIDGET_VIEWS[widget.kind](widget, workspace);
|
|
63
|
-
return view ? [{ id: widget.id, ...view }] : [];
|
|
64
|
-
});
|
|
65
|
-
}
|