@antelopejs/dms 0.25.7-next.1111.gaba637e → 0.25.7
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 +73 -0
- package/README.md +2 -2
- package/data/mockup-spec.schema.json +303 -223
- package/dist/implementations/dms-auth/account-emails.js +2 -2
- package/dist/implementations/dms-auth/account-emails.js.map +1 -1
- package/dist/implementations/dms-auth/index.js +1 -2
- package/dist/implementations/dms-auth/index.js.map +1 -1
- package/dist/implementations/dms-base/group-order.d.ts +18 -0
- package/dist/implementations/dms-base/group-order.js +66 -0
- package/dist/implementations/dms-base/group-order.js.map +1 -0
- package/dist/implementations/dms-base/search-route.js +8 -5
- package/dist/implementations/dms-base/search-route.js.map +1 -1
- package/dist/implementations/dms-builder/engine/cell-displays.js +4 -1
- package/dist/implementations/dms-builder/engine/cell-displays.js.map +1 -1
- package/dist/implementations/dms-builder/engine/mapped-displays.js +5 -1
- package/dist/implementations/dms-builder/engine/mapped-displays.js.map +1 -1
- package/dist/implementations/dms-builder/engine/resource-emit.js +4 -0
- package/dist/implementations/dms-builder/engine/resource-emit.js.map +1 -1
- package/dist/implementations/dms-builder/engine/theme-assets.js +5 -17
- package/dist/implementations/dms-builder/engine/theme-assets.js.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +0 -1
- package/dist/mcp/index.js +0 -5
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/page-verify/index.d.ts +0 -14
- package/dist/mcp/page-verify/index.js +5 -9
- package/dist/mcp/page-verify/index.js.map +1 -1
- package/dist/mcp/page-verify/mockup.d.ts +1 -2
- package/dist/mcp/page-verify/mockup.js +0 -1
- package/dist/mcp/page-verify/mockup.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/tools/mockup-apply-to-page.js +1 -1
- package/dist/mcp/tools/mockup-apply-to-page.js.map +1 -1
- package/dist/mcp/tools/mockup-patch-spec.js +1 -1
- package/dist/mcp/tools/mockup-patch-spec.js.map +1 -1
- package/dist/mcp/tools/mockup-read-spec.js +3 -10
- package/dist/mcp/tools/mockup-read-spec.js.map +1 -1
- package/dist/mcp/tools/mockup-write-spec.js +1 -1
- package/dist/mcp/tools/mockup-write-spec.js.map +1 -1
- package/dist/mcp/tools/mockup.js +0 -2
- 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 +1 -5
- package/dist/mcp/tools/page-verify.js.map +1 -1
- package/dist/mockup/apply-notes.d.ts +1 -1
- package/dist/mockup/apply-notes.js +2 -1
- package/dist/mockup/apply-notes.js.map +1 -1
- package/dist/mockup/apply-plan.js +3 -0
- package/dist/mockup/apply-plan.js.map +1 -1
- package/dist/mockup/{fixture-routes.d.ts → capture-routes.d.ts} +6 -11
- package/dist/mockup/capture-routes.js +101 -0
- package/dist/mockup/capture-routes.js.map +1 -0
- package/dist/mockup/capture.d.ts +10 -0
- package/dist/mockup/capture.js +64 -0
- package/dist/mockup/capture.js.map +1 -0
- package/dist/mockup/compile.d.ts +1 -6
- package/dist/mockup/compile.js +25 -29
- package/dist/mockup/compile.js.map +1 -1
- package/dist/mockup/controller-blocks.js +62 -10
- package/dist/mockup/controller-blocks.js.map +1 -1
- package/dist/mockup/display-values.js +1 -1
- package/dist/mockup/display-values.js.map +1 -1
- package/dist/mockup/files.d.ts +2 -2
- package/dist/mockup/files.js +2 -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 +3 -1
- package/dist/mockup/fixtures.js +25 -2
- package/dist/mockup/fixtures.js.map +1 -1
- package/dist/mockup/form-fields.js +10 -1
- package/dist/mockup/form-fields.js.map +1 -1
- package/dist/mockup/generate.js +1 -4
- package/dist/mockup/generate.js.map +1 -1
- package/dist/mockup/header-action.d.ts +47 -0
- package/dist/mockup/header-action.js +46 -0
- package/dist/mockup/header-action.js.map +1 -0
- package/dist/mockup/history-routes.js +17 -2
- package/dist/mockup/history-routes.js.map +1 -1
- package/dist/mockup/index.d.ts +0 -3
- package/dist/mockup/index.js +0 -3
- package/dist/mockup/index.js.map +1 -1
- package/dist/mockup/json-schema-header.d.ts +2 -0
- package/dist/mockup/json-schema-header.js +69 -0
- package/dist/mockup/json-schema-header.js.map +1 -0
- package/dist/mockup/json-schema-layout.d.ts +2 -0
- package/dist/mockup/json-schema-layout.js +61 -0
- package/dist/mockup/json-schema-layout.js.map +1 -0
- package/dist/mockup/json-schema.js +24 -23
- package/dist/mockup/json-schema.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 +255 -106
- package/dist/mockup/model.js +82 -86
- package/dist/mockup/model.js.map +1 -1
- package/dist/mockup/modules.d.ts +9 -20
- package/dist/mockup/modules.js +22 -146
- package/dist/mockup/modules.js.map +1 -1
- package/dist/mockup/page-links.d.ts +2 -1
- package/dist/mockup/page-links.js +14 -3
- package/dist/mockup/page-links.js.map +1 -1
- package/dist/mockup/refusals.d.ts +1 -4
- package/dist/mockup/refusals.js +1 -15
- package/dist/mockup/refusals.js.map +1 -1
- package/dist/mockup/routes.d.ts +5 -1
- package/dist/mockup/routes.js +171 -9
- package/dist/mockup/routes.js.map +1 -1
- package/dist/mockup/sample-rows.js +4 -0
- package/dist/mockup/sample-rows.js.map +1 -1
- package/dist/mockup/store.d.ts +2 -1
- package/dist/mockup/store.js +22 -16
- package/dist/mockup/store.js.map +1 -1
- package/dist/mockup/{store-summary.js → summary-fields.js} +1 -1
- package/dist/mockup/summary-fields.js.map +1 -0
- package/dist/mockup/table-columns.js +9 -3
- package/dist/mockup/table-columns.js.map +1 -1
- package/dist/mockup/table-options.d.ts +4 -1
- package/dist/mockup/table-options.js +40 -2
- package/dist/mockup/table-options.js.map +1 -1
- package/dist/mockup/table-param-filters.d.ts +52 -0
- package/dist/mockup/table-param-filters.js +83 -0
- package/dist/mockup/table-param-filters.js.map +1 -0
- package/dist/mockup/table-row-actions.d.ts +2 -0
- package/dist/mockup/table-row-actions.js +85 -0
- package/dist/mockup/table-row-actions.js.map +1 -0
- package/dist/mockup/unknown-keys.d.ts +3 -0
- package/dist/mockup/unknown-keys.js +45 -0
- package/dist/mockup/unknown-keys.js.map +1 -0
- package/dist/mockup/validate.d.ts +7 -1
- package/dist/mockup/validate.js +76 -3
- package/dist/mockup/validate.js.map +1 -1
- package/dist/pages/account.d.ts +1 -0
- package/dist/pages/account.js +1 -0
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/settings/overview/account-summary.d.ts +2 -0
- package/dist/pages/settings/overview/account-summary.js +17 -8
- package/dist/pages/settings/overview/account-summary.js.map +1 -1
- package/dist/pages/settings/settings-index.js +2 -1
- package/dist/pages/settings/settings-index.js.map +1 -1
- package/dist/realtime/sse.js +2 -4
- package/dist/realtime/sse.js.map +1 -1
- package/dist/store/internal/frontend/dev-reload.js +7 -1
- package/dist/store/internal/frontend/dev-reload.js.map +1 -1
- package/dist/utils/account-notifications.js +1 -0
- package/dist/utils/account-notifications.js.map +1 -1
- package/dist/utils/email-change-mail.js +2 -2
- package/dist/utils/email-change-mail.js.map +1 -1
- package/dist/utils/email-plain-text.d.ts +1 -0
- package/dist/utils/email-plain-text.js +95 -0
- package/dist/utils/email-plain-text.js.map +1 -0
- package/dist/utils/export-jobs.js +2 -2
- package/dist/utils/export-jobs.js.map +1 -1
- package/dist/utils/html-email.d.ts +8 -0
- package/dist/utils/html-email.js +9 -0
- package/dist/utils/html-email.js.map +1 -0
- package/dist/utils/image-signatures.d.ts +3 -0
- package/dist/utils/image-signatures.js +22 -0
- package/dist/utils/image-signatures.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/sse-keepalive/index.d.ts +3 -0
- package/dist/utils/sse-keepalive/index.js +8 -0
- package/dist/utils/sse-keepalive/index.js.map +1 -0
- package/dist/validation/allowed-keys.d.ts +2 -0
- package/dist/validation/allowed-keys.js +16 -0
- package/dist/validation/allowed-keys.js.map +1 -0
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.js +1 -0
- package/dist/validation/index.js.map +1 -1
- package/frontend-vue/eslint-globals.generated.mjs +2 -2
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/2fa.vue +3 -0
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/backup.vue +3 -0
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/forgot-validation.vue +3 -0
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/forgot.vue +3 -0
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/login.vue +4 -1
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/recover.vue +3 -0
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/signup.vue +17 -1
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/validate.vue +3 -0
- package/frontend-vue/layers/dms-auth/i18n/locales/auth-fr-FR.json +10 -10
- package/frontend-vue/layers/dms-core/app/build/composables/api-error.ts +8 -0
- package/frontend-vue/layers/dms-core/app/build/composables/field-errors.ts +485 -0
- package/frontend-vue/layers/dms-core/app/build/composables/useHydrated.ts +27 -0
- package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/translation/useUniqueLocales.ts +23 -5
- package/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts +1 -0
- package/frontend-vue/layers/dms-core/app/composables/useFieldErrors.ts +12 -443
- package/frontend-vue/layers/dms-core/app/entries/composables/useHydrated.ts +1 -0
- package/frontend-vue/layers/dms-core/i18n/locales/core-en-GB.json +8 -0
- package/frontend-vue/layers/dms-core/i18n/locales/core-fr-FR.json +8 -0
- package/frontend-vue/layers/dms-core/shared/types/app-config.ts +2 -0
- package/frontend-vue/layers/dms-layout/app/app.config.ts +1 -0
- package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardHeader.vue +7 -4
- package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +14 -29
- package/frontend-vue/layers/dms-layout/app/build/components/layout/EmptyLayoutBrand.vue +49 -0
- package/frontend-vue/layers/dms-layout/app/build/components/layout/LayoutFooter.vue +2 -0
- package/frontend-vue/layers/dms-layout/app/build/components/layout/MockupSidebarMenu.vue +6 -21
- package/frontend-vue/layers/dms-layout/app/build/components/layout/PreviewPageHeader.vue +19 -3
- package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupMenu.ts +9 -110
- package/frontend-vue/layers/dms-layout/app/build/components/notification/NotificationPopover.vue +8 -2
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationInboxItem.vue +6 -9
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationMatrixCategory.vue +6 -2
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationMatrixSubject.vue +27 -22
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationPreferencesForm.vue +8 -10
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/notificationDisplay.ts +39 -3
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsShell.vue +38 -5
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/profile/useProfilePreferences.ts +1 -3
- package/frontend-vue/layers/dms-layout/app/build/utils/dev-reload-stream.ts +23 -4
- package/frontend-vue/layers/dms-layout/app/custom-layouts/EmptyLayout.vue +39 -31
- package/frontend-vue/layers/dms-layout/app/custom-layouts/PreviewLayout.vue +60 -9
- package/frontend-vue/layers/dms-layout/app/entries/components/pages/settings/shell/SettingsShell.ts +2 -0
- package/frontend-vue/layers/dms-layout/app/error.vue +1 -1
- package/frontend-vue/layers/dms-layout/app/middleware/module-routing.global.ts +7 -1
- package/frontend-vue/layers/dms-layout/app/plugins/dms-menu-sync.client.ts +14 -1
- package/frontend-vue/layers/dms-layout/app/utils/breadcrumb.ts +13 -0
- package/frontend-vue/layers/dms-layout/i18n/locales/layout-en-GB.json +1 -1
- package/frontend-vue/layers/dms-layout/i18n/locales/layout-fr-FR.json +5 -5
- package/frontend-vue/layers/dms-onboarding/app/build/components/onboarding/steps/StepPlatform.vue +3 -0
- package/frontend-vue/layers/dms-onboarding/app/components/onboarding/steps/StepRegister.vue +3 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/BlockPreviewSketch.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupHeaderActions.vue +1 -4
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspector.vue +2 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupIssues.vue +22 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModules.vue +6 -11
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverview.vue +125 -182
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewArrows.vue +110 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewFrameImage.vue +75 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSlot.vue +114 -12
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewZoom.vue +67 -0
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPinLayer.vue +10 -4
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTopBar.vue +8 -76
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkbench.vue +9 -65
- package/frontend-vue/layers/dms-ui/app/build/components/table-view/ExpandedRowDetail.vue +26 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewCapture.ts +247 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewCaptureAssets.ts +181 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewNavigation.ts +8 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewRaster.ts +45 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockPreviewEmbed.ts +46 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupOverview.ts +109 -35
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageFrame.ts +5 -18
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupRoutePage.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerPages.ts +3 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerShortcuts.ts +0 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useOverviewCaptures.ts +137 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewFrame.ts +68 -13
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewLinks.ts +17 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/confirm/fetchedConfirmDialog.ts +6 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultDisplayComponents.ts +4 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultPrimitiveTypes.ts +38 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/registerFieldTypes.ts +69 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/useColumnValueRenderer.ts +20 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/form/keyValueRows.ts +36 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/form/useInstantForm.ts +4 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewGrouping.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewListing.ts +21 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewSorting.ts +8 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useGroupedRows.ts +32 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableFooter.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRows.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/displayOptions.ts +16 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/groupedRows.ts +67 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableQuery.ts +5 -0
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCard.vue +73 -48
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +18 -11
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupThumbnail.vue +35 -124
- package/frontend-vue/layers/dms-ui/app/build/mockups/manage.ts +7 -3
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewCapture.ts +96 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewChannel.ts +10 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +84 -149
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewRects.ts +61 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/dotGrid.ts +37 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/legalIdentifier.ts +279 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +43 -72
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCaptures.ts +130 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupFrame.ts +8 -92
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupLinks.ts +35 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverview.ts +44 -17
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupShortcuts.ts +3 -14
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +26 -14
- package/frontend-vue/layers/dms-ui/app/build/utils/previewHeader.ts +154 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/previewPageLayout.ts +149 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/previewPageQuery.ts +42 -0
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +56 -6
- package/frontend-vue/layers/dms-ui/app/components/block-preview/MockupViewer.vue +0 -3
- package/frontend-vue/layers/dms-ui/app/components/confirm/ConfirmModal.vue +7 -7
- package/frontend-vue/layers/dms-ui/app/components/flow-canvas/FlowCanvas.vue +4 -7
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputIdentifier.vue +90 -0
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputPhone.vue +5 -0
- package/frontend-vue/layers/dms-ui/app/components/form/components/KeyValue.vue +2 -20
- package/frontend-vue/layers/dms-ui/app/components/key-value-list/KeyValueList.vue +51 -15
- package/frontend-vue/layers/dms-ui/app/composables/form/useForm.ts +3 -8
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/config.ts +10 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/previewCapture.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/previewCaptureAssets.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/usePreviewFrame.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/table-view/utils/displayOptions.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/mockups/manage.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/blockPreview.ts +3 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/legalIdentifier.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/mockupCaptures.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/types/table/query.ts +5 -0
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-en-GB.json +2 -28
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-fr-FR.json +12 -38
- package/frontend-vue/package.json +3 -3
- package/frontend-vue/scripts/check-invariants.mjs +101 -0
- package/package.json +9 -8
- package/skills/dms/SKILL.md +4 -2
- package/skills/dms-module/SKILL.md +3 -0
- package/dist/mcp/mockup-export/capture.d.ts +0 -15
- package/dist/mcp/mockup-export/capture.js +0 -97
- 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 -23
- package/dist/mcp/mockup-export/index.js +0 -90
- package/dist/mcp/mockup-export/index.js.map +0 -1
- package/dist/mcp/mockup-export/plan.d.ts +0 -78
- package/dist/mcp/mockup-export/plan.js +0 -257
- package/dist/mcp/mockup-export/plan.js.map +0 -1
- package/dist/mcp/mockup-export/route.d.ts +0 -13
- package/dist/mcp/mockup-export/route.js +0 -66
- package/dist/mcp/mockup-export/route.js.map +0 -1
- package/dist/mcp/tools/mockup-export-pdf.d.ts +0 -1
- package/dist/mcp/tools/mockup-export-pdf.js +0 -71
- package/dist/mcp/tools/mockup-export-pdf.js.map +0 -1
- package/dist/mockup/database-manifest.d.ts +0 -2
- package/dist/mockup/database-manifest.js +0 -75
- package/dist/mockup/database-manifest.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/fixture-routes.js +0 -155
- 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/manifest-blocks.d.ts +0 -19
- package/dist/mockup/manifest-blocks.js +0 -65
- package/dist/mockup/manifest-blocks.js.map +0 -1
- package/dist/mockup/module-manifests.d.ts +0 -22
- package/dist/mockup/module-manifests.js +0 -28
- package/dist/mockup/module-manifests.js.map +0 -1
- package/dist/mockup/modules-schema.d.ts +0 -2
- package/dist/mockup/modules-schema.js +0 -42
- package/dist/mockup/modules-schema.js.map +0 -1
- package/dist/mockup/saas-manifest.d.ts +0 -2
- package/dist/mockup/saas-manifest.js +0 -496
- package/dist/mockup/saas-manifest.js.map +0 -1
- package/dist/mockup/state.d.ts +0 -76
- package/dist/mockup/state.js +0 -22
- package/dist/mockup/state.js.map +0 -1
- package/dist/mockup/store-summary.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-ui/app/build/components/block-preview/MockupDatabase.vue +0 -165
- 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/useMockupDatabase.ts +0 -175
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPdfExport.ts +0 -76
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupTenancy.ts +0 -63
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewNavigation.ts +0 -119
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupEntities.ts +0 -80
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSchema.ts +0 -177
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenancy.ts +0 -151
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenants.ts +0 -23
- package/frontend-vue/layers/dms-ui/app/build/utils/recordGuards.ts +0 -15
- 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/useMockupPdfExport.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/utils/mockupSchema.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/dist/mockup/{store-summary.d.ts → summary-fields.d.ts} +0 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/** A country whose company registration number is read. */
|
|
2
|
+
export type CompanyNumberCountry = "BE" | "FR";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* What a person types, without its spaces, dots, dashes and
|
|
6
|
+
* slashes, in upper case.
|
|
7
|
+
*/
|
|
8
|
+
export function compactIdentifier(value: string): string {
|
|
9
|
+
return value.replace(/[\s.\-/]/g, "").toUpperCase();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** The remainder of a digit string of any length divided by 97. */
|
|
13
|
+
function mod97(digits: string): number {
|
|
14
|
+
let remainder = 0;
|
|
15
|
+
for (const digit of digits) {
|
|
16
|
+
remainder = (remainder * 10 + Number(digit)) % 97;
|
|
17
|
+
}
|
|
18
|
+
return remainder;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Whether a digit string passes the Luhn check (ISO/IEC 7812). */
|
|
22
|
+
function passesLuhn(digits: string): boolean {
|
|
23
|
+
let sum = 0;
|
|
24
|
+
for (let index = 0; index < digits.length; index++) {
|
|
25
|
+
const digit = Number(digits[digits.length - 1 - index]);
|
|
26
|
+
const weighted = index % 2 === 1 ? digit * 2 : digit;
|
|
27
|
+
sum += weighted > 9 ? weighted - 9 : weighted;
|
|
28
|
+
}
|
|
29
|
+
return sum % 10 === 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const IBAN = /^[A-Z]{2}\d{2}[A-Z0-9]{11,30}$/;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* An IBAN without spaces (`BE68539007547034`), checked against its
|
|
36
|
+
* two check digits (ISO 13616, modulo 97); `undefined` when it is none.
|
|
37
|
+
*/
|
|
38
|
+
export function readIban(value: string): string | undefined {
|
|
39
|
+
const iban = compactIdentifier(value);
|
|
40
|
+
if (!IBAN.test(iban)) return undefined;
|
|
41
|
+
const numeric = `${iban.slice(4)}${iban.slice(0, 4)}`.replace(
|
|
42
|
+
/[A-Z]/g,
|
|
43
|
+
(letter) => String(letter.charCodeAt(0) - 55),
|
|
44
|
+
);
|
|
45
|
+
return mod97(numeric) === 1 ? iban : undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** An IBAN as printed, in groups of four: `BE68 5390 0754 7034`. */
|
|
49
|
+
export function formatIban(iban: string): string {
|
|
50
|
+
return iban.replace(/(.{4})(?=.)/g, "$1 ");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const BIC = /^[A-Z0-9]{4}[A-Z]{2}[A-Z0-9]{2}(?:[A-Z0-9]{3})?$/;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A BIC of 8 or 11 characters (ISO 9362): party prefix, country,
|
|
57
|
+
* location and an optional branch; `undefined` when it is none.
|
|
58
|
+
*/
|
|
59
|
+
export function readBic(value: string): string | undefined {
|
|
60
|
+
const bic = compactIdentifier(value);
|
|
61
|
+
return BIC.test(bic) ? bic : undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** The ten digits of a Belgian enterprise number, or `undefined`. */
|
|
65
|
+
function readBelgianEnterpriseNumber(digits: string): string | undefined {
|
|
66
|
+
const number = digits.length === 9 ? `0${digits}` : digits;
|
|
67
|
+
if (!/^[01]\d{9}$/.test(number)) return undefined;
|
|
68
|
+
const check = 97 - mod97(number.slice(0, 8));
|
|
69
|
+
return check === Number(number.slice(8)) ? number : undefined;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** The nine digits of a French SIREN, or `undefined`. */
|
|
73
|
+
function readSiren(digits: string): string | undefined {
|
|
74
|
+
return /^\d{9}$/.test(digits) && passesLuhn(digits) ? digits : undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const COMPANY_NUMBER_READERS = new Map<
|
|
78
|
+
string,
|
|
79
|
+
(digits: string) => string | undefined
|
|
80
|
+
>([
|
|
81
|
+
["BE", readBelgianEnterpriseNumber],
|
|
82
|
+
["FR", readSiren],
|
|
83
|
+
]);
|
|
84
|
+
|
|
85
|
+
/** Whether `country` is one whose company number is read. */
|
|
86
|
+
export function isCompanyNumberCountry(
|
|
87
|
+
country: unknown,
|
|
88
|
+
): country is CompanyNumberCountry {
|
|
89
|
+
return typeof country === "string" && COMPANY_NUMBER_READERS.has(country);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* A company registration number of `country` as its register
|
|
94
|
+
* writes it, digits only: a Belgian enterprise number of ten digits (the
|
|
95
|
+
* nine of before 2005 get their leading zero), a French SIREN of nine.
|
|
96
|
+
* Typed with its country's code in front (`BE 0123.456.749`), it reads the
|
|
97
|
+
* same. `undefined` when it is none.
|
|
98
|
+
*/
|
|
99
|
+
export function readCompanyNumber(
|
|
100
|
+
value: string,
|
|
101
|
+
country: CompanyNumberCountry,
|
|
102
|
+
): string | undefined {
|
|
103
|
+
const compact = compactIdentifier(value);
|
|
104
|
+
const digits = compact.startsWith(country)
|
|
105
|
+
? compact.slice(country.length)
|
|
106
|
+
: compact;
|
|
107
|
+
return COMPANY_NUMBER_READERS.get(country)?.(digits);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* A company registration number as its country prints it:
|
|
112
|
+
* `0123.456.749` in Belgium, `123 456 782` in France.
|
|
113
|
+
*/
|
|
114
|
+
export function formatCompanyNumber(
|
|
115
|
+
number: string,
|
|
116
|
+
country: CompanyNumberCountry,
|
|
117
|
+
): string {
|
|
118
|
+
if (country === "BE") {
|
|
119
|
+
return `${number.slice(0, 4)}.${number.slice(4, 7)}.${number.slice(7)}`;
|
|
120
|
+
}
|
|
121
|
+
return number.replace(/(\d{3})(?=\d)/g, "$1 ");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The format of each country's VAT number after its country code, as the
|
|
126
|
+
* EU's VIES service lists it, plus Northern Ireland (`XI`) and Great Britain.
|
|
127
|
+
*/
|
|
128
|
+
const VAT_NUMBER_FORMATS = new Map<string, RegExp>([
|
|
129
|
+
["AT", /^U\d{8}$/],
|
|
130
|
+
["BE", /^[01]\d{9}$/],
|
|
131
|
+
["BG", /^\d{9,10}$/],
|
|
132
|
+
["CY", /^\d{8}[A-Z]$/],
|
|
133
|
+
["CZ", /^\d{8,10}$/],
|
|
134
|
+
["DE", /^\d{9}$/],
|
|
135
|
+
["DK", /^\d{8}$/],
|
|
136
|
+
["EE", /^\d{9}$/],
|
|
137
|
+
["EL", /^\d{9}$/],
|
|
138
|
+
["ES", /^[A-Z0-9]\d{7}[A-Z0-9]$/],
|
|
139
|
+
["FI", /^\d{8}$/],
|
|
140
|
+
["FR", /^[A-HJ-NP-Z0-9]{2}\d{9}$/],
|
|
141
|
+
["GB", /^(?:\d{9}|\d{12}|GD\d{3}|HA\d{3})$/],
|
|
142
|
+
["HR", /^\d{11}$/],
|
|
143
|
+
["HU", /^\d{8}$/],
|
|
144
|
+
["IE", /^(?:\d{7}[A-W][A-IW]?|\d[A-Z+*]\d{5}[A-W])$/],
|
|
145
|
+
["IT", /^\d{11}$/],
|
|
146
|
+
["LT", /^(?:\d{9}|\d{12})$/],
|
|
147
|
+
["LU", /^\d{8}$/],
|
|
148
|
+
["LV", /^\d{11}$/],
|
|
149
|
+
["MT", /^\d{8}$/],
|
|
150
|
+
["NL", /^\d{9}B\d{2}$/],
|
|
151
|
+
["PL", /^\d{10}$/],
|
|
152
|
+
["PT", /^\d{9}$/],
|
|
153
|
+
["RO", /^[1-9]\d{1,9}$/],
|
|
154
|
+
["SE", /^\d{10}01$/],
|
|
155
|
+
["SI", /^\d{8}$/],
|
|
156
|
+
["SK", /^\d{10}$/],
|
|
157
|
+
["XI", /^(?:\d{9}|\d{12}|GD\d{3}|HA\d{3})$/],
|
|
158
|
+
]);
|
|
159
|
+
|
|
160
|
+
/** German VAT check digit: ISO 7064 MOD 11,10 over the first eight digits. */
|
|
161
|
+
function passesGermanCheck(number: string): boolean {
|
|
162
|
+
let product = 10;
|
|
163
|
+
for (const digit of number.slice(0, 8)) {
|
|
164
|
+
let sum = (Number(digit) + product) % 10;
|
|
165
|
+
if (sum === 0) sum = 10;
|
|
166
|
+
product = (2 * sum) % 11;
|
|
167
|
+
}
|
|
168
|
+
const check = (11 - product) % 10;
|
|
169
|
+
return check === Number(number[8]);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** French VAT key: `(12 + 3 × (SIREN mod 97)) mod 97`, when it is numeric. */
|
|
173
|
+
function passesFrenchCheck(number: string): boolean {
|
|
174
|
+
const key = number.slice(0, 2);
|
|
175
|
+
if (!/^\d{2}$/.test(key)) return true;
|
|
176
|
+
const siren = number.slice(2);
|
|
177
|
+
return Number(key) === (12 + 3 * mod97(siren)) % 97;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Luxembourg VAT: the first six digits modulo 89 are the last two. */
|
|
181
|
+
function passesLuxembourgCheck(number: string): boolean {
|
|
182
|
+
return Number(number.slice(0, 6)) % 89 === Number(number.slice(6));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** The check digits of the countries whose public rule is stable; the format only elsewhere. */
|
|
186
|
+
const VAT_CHECKS = new Map<string, (number: string) => boolean>([
|
|
187
|
+
["BE", (number) => readBelgianEnterpriseNumber(number) !== undefined],
|
|
188
|
+
["DE", passesGermanCheck],
|
|
189
|
+
["FR", passesFrenchCheck],
|
|
190
|
+
["IT", passesLuhn],
|
|
191
|
+
["LU", passesLuxembourgCheck],
|
|
192
|
+
]);
|
|
193
|
+
|
|
194
|
+
/** The code a person may type for a VAT country, read as VIES writes it. */
|
|
195
|
+
const VAT_PREFIX_ALIASES = new Map([["GR", "EL"]]);
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* A VAT number as VIES writes it (`BE0123456749`): its country's
|
|
199
|
+
* code, then its number without spaces. The number must have its country's
|
|
200
|
+
* format; Belgium, Germany, France, Italy and Luxembourg also check its check
|
|
201
|
+
* digits. A number typed without its country's code reads in
|
|
202
|
+
* `defaultCountry`, and a Belgian one of nine digits gets its leading zero.
|
|
203
|
+
* `undefined` when it is none.
|
|
204
|
+
*/
|
|
205
|
+
export function readVatNumber(
|
|
206
|
+
value: string,
|
|
207
|
+
defaultCountry?: string,
|
|
208
|
+
): string | undefined {
|
|
209
|
+
const compact = compactIdentifier(value);
|
|
210
|
+
const typedPrefix = compact.slice(0, 2);
|
|
211
|
+
const isPrefixed = /^[A-Z]{2}$/.test(typedPrefix);
|
|
212
|
+
const prefix = isPrefixed ? typedPrefix : defaultCountry?.toUpperCase();
|
|
213
|
+
if (!prefix) return undefined;
|
|
214
|
+
const country = VAT_PREFIX_ALIASES.get(prefix) ?? prefix;
|
|
215
|
+
const format = VAT_NUMBER_FORMATS.get(country);
|
|
216
|
+
if (!format) return undefined;
|
|
217
|
+
const typed = isPrefixed ? compact.slice(2) : compact;
|
|
218
|
+
const number = country === "BE" && typed.length === 9 ? `0${typed}` : typed;
|
|
219
|
+
if (!format.test(number)) return undefined;
|
|
220
|
+
const check = VAT_CHECKS.get(country);
|
|
221
|
+
if (check && !check(number)) return undefined;
|
|
222
|
+
return `${country}${number}`;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** The identifier a field holds; the input's `identifier` option. */
|
|
226
|
+
export type IdentifierKind = "iban" | "bic" | "vat_number" | "company_number";
|
|
227
|
+
|
|
228
|
+
/** The options of the identifier input a reading depends on. */
|
|
229
|
+
export interface IdentifierRule {
|
|
230
|
+
identifier: IdentifierKind;
|
|
231
|
+
/** `vat_number`: the country a number without its code is read in. */
|
|
232
|
+
defaultCountry?: string;
|
|
233
|
+
/** `company_number`: the country whose register the number belongs to. */
|
|
234
|
+
country?: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const IDENTIFIER_READERS: Record<
|
|
238
|
+
IdentifierKind,
|
|
239
|
+
(value: string, rule: IdentifierRule) => string | undefined
|
|
240
|
+
> = {
|
|
241
|
+
iban: readIban,
|
|
242
|
+
bic: readBic,
|
|
243
|
+
vat_number: (value, rule) => readVatNumber(value, rule.defaultCountry),
|
|
244
|
+
company_number: (value, rule) =>
|
|
245
|
+
isCompanyNumberCountry(rule.country)
|
|
246
|
+
? readCompanyNumber(value, rule.country)
|
|
247
|
+
: undefined,
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* The stored form of what was typed into an identifier input, or
|
|
252
|
+
* `undefined` when it is not an identifier of the field's kind.
|
|
253
|
+
*/
|
|
254
|
+
export function readIdentifier(
|
|
255
|
+
value: string,
|
|
256
|
+
rule: IdentifierRule,
|
|
257
|
+
): string | undefined {
|
|
258
|
+
return IDENTIFIER_READERS[rule.identifier](value, rule);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* A stored identifier as it is printed: an IBAN in groups of four, a
|
|
263
|
+
* company number as its country writes it, the others as stored.
|
|
264
|
+
*/
|
|
265
|
+
export function formatIdentifier(value: string, rule: IdentifierRule): string {
|
|
266
|
+
if (rule.identifier === "iban") return formatIban(value);
|
|
267
|
+
if (
|
|
268
|
+
rule.identifier === "company_number" &&
|
|
269
|
+
isCompanyNumberCountry(rule.country)
|
|
270
|
+
) {
|
|
271
|
+
return formatCompanyNumber(value, rule.country);
|
|
272
|
+
}
|
|
273
|
+
return value;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** The message key a refused identifier of `kind` shows. */
|
|
277
|
+
export function identifierErrorKey(kind: IdentifierKind): string {
|
|
278
|
+
return `dms.field_errors.invalid_${kind}`;
|
|
279
|
+
}
|
|
@@ -4,19 +4,11 @@ import {
|
|
|
4
4
|
isString,
|
|
5
5
|
} from "../../../../dms-core/app/utils/type-check";
|
|
6
6
|
import { isPreviewTree, type PreviewNode } from "./blockPreview";
|
|
7
|
+
import { isPreviewHeader, type PreviewHeaderAction } from "./previewHeader";
|
|
7
8
|
import {
|
|
8
|
-
|
|
9
|
-
type
|
|
10
|
-
} from "./
|
|
11
|
-
import { isMockupEntities, type MockupEntityState } from "./mockupEntities";
|
|
12
|
-
import { isMockupTenants, type MockupTenant } from "./mockupTenants";
|
|
13
|
-
|
|
14
|
-
export { MOCKUP_FIELD_TYPES } from "./mockupEntities";
|
|
15
|
-
export type {
|
|
16
|
-
MockupEntityField,
|
|
17
|
-
MockupEntityState,
|
|
18
|
-
MockupFieldType,
|
|
19
|
-
} from "./mockupEntities";
|
|
9
|
+
isPreviewPageLayout,
|
|
10
|
+
type PreviewPageLayout,
|
|
11
|
+
} from "./previewPageLayout";
|
|
20
12
|
|
|
21
13
|
/** A problem in `spec.json`, at a JSON pointer into it (`""` is the whole file). */
|
|
22
14
|
export interface MockupIssue {
|
|
@@ -69,6 +61,8 @@ export interface MockupPageState {
|
|
|
69
61
|
icon?: string;
|
|
70
62
|
description?: string;
|
|
71
63
|
headerActions?: PreviewHeaderAction[];
|
|
64
|
+
/** The layout the page is drawn in; the dashboard frame when absent. */
|
|
65
|
+
layout?: PreviewPageLayout;
|
|
72
66
|
options: MockupPageOptions;
|
|
73
67
|
/** What `DmsBlockPreview` draws: fixtures resolved, sketch nodes passed through. */
|
|
74
68
|
tree: PreviewNode[];
|
|
@@ -98,30 +92,13 @@ export interface MockupSidebar {
|
|
|
98
92
|
widgets: MockupSidebarWidget[];
|
|
99
93
|
}
|
|
100
94
|
|
|
101
|
-
/**
|
|
102
|
-
export interface MockupModuleSide {
|
|
103
|
-
title: string;
|
|
104
|
-
categories: MockupCategory[];
|
|
105
|
-
pages: string[];
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* A module of the mockup's app, a menu root under the app's own menu: a
|
|
110
|
-
* catalog module with its manifest pages, or one the spec defines.
|
|
111
|
-
*/
|
|
95
|
+
/** A DMS module the mockup's app needs: its entry in the module store catalog. */
|
|
112
96
|
export interface MockupModule {
|
|
113
|
-
/** The
|
|
97
|
+
/** The module's id in the catalog. */
|
|
114
98
|
id: string;
|
|
115
|
-
|
|
99
|
+
/** The npm package building the mockup installs. */
|
|
100
|
+
package: string;
|
|
116
101
|
icon: string;
|
|
117
|
-
/** The npm package building the mockup installs; a spec's own module has none. */
|
|
118
|
-
package?: string;
|
|
119
|
-
/** The module's sub-sections, in menu order. */
|
|
120
|
-
categories: MockupCategory[];
|
|
121
|
-
/** The ids of the pages its root lists, in menu order. */
|
|
122
|
-
pages: string[];
|
|
123
|
-
/** What the menu draws in SaaS mode in place of the sections and pages above; absent for a module with no tenant side. */
|
|
124
|
-
tenant?: MockupModuleSide;
|
|
125
102
|
}
|
|
126
103
|
|
|
127
104
|
export interface MockupState {
|
|
@@ -135,14 +112,10 @@ export interface MockupState {
|
|
|
135
112
|
sidebar?: MockupSidebar;
|
|
136
113
|
/** Absent when the spec lists no module. */
|
|
137
114
|
modules?: MockupModule[];
|
|
138
|
-
/** The spec's entities, in spec order; absent when the spec has none. */
|
|
139
|
-
entities?: MockupEntityState[];
|
|
140
|
-
/** `fixtures.tenants` of the spec: the workspaces SaaS mode lists; absent when the spec has none. */
|
|
141
|
-
tenants?: MockupTenant[];
|
|
142
|
-
/** `data.connection` of the spec: the external connection the explorer introspects; absent when the spec has no `data`. */
|
|
143
|
-
connection?: string;
|
|
144
115
|
pages: MockupPageState[];
|
|
145
116
|
issues: MockupIssue[];
|
|
117
|
+
/** What the spec likely does not show as meant; absent from a backend that reports none. */
|
|
118
|
+
warnings?: MockupIssue[];
|
|
146
119
|
}
|
|
147
120
|
|
|
148
121
|
export type MockupAnnotationStatus = "open" | "resolved";
|
|
@@ -240,6 +213,8 @@ interface MockupSummaryBase {
|
|
|
240
213
|
source?: MockupSource;
|
|
241
214
|
/** When `spec.json` last changed, ISO 8601. */
|
|
242
215
|
updatedAt: string;
|
|
216
|
+
/** When the stored image of the first page was last written, ISO 8601; absent when the mockup has none. */
|
|
217
|
+
capturedAt?: string;
|
|
243
218
|
}
|
|
244
219
|
|
|
245
220
|
/** One row of `GET /api/mockup`: a draft, or a mockup built into real pages. */
|
|
@@ -275,6 +250,9 @@ export const MOCKUP_WIDTHS: Record<MockupWidth, number> = {
|
|
|
275
250
|
|
|
276
251
|
export const MOCKUP_LIST_ENDPOINT = "/api/mockup";
|
|
277
252
|
|
|
253
|
+
/** The path under a mockup's endpoint of the stored image of its first page. */
|
|
254
|
+
export const MOCKUP_CAPTURE_SUFFIX = "/capture";
|
|
255
|
+
|
|
278
256
|
/** Event of the state stream carrying a {@link MockupState}. */
|
|
279
257
|
export const MOCKUP_STATE_EVENT = "state";
|
|
280
258
|
|
|
@@ -286,6 +264,21 @@ export function mockupEndpoint(name: string, suffix = ""): string {
|
|
|
286
264
|
return `${MOCKUP_LIST_ENDPOINT}/${encodeURIComponent(name)}${suffix}`;
|
|
287
265
|
}
|
|
288
266
|
|
|
267
|
+
/**
|
|
268
|
+
* The URL of the stored image of a mockup's first page. `capturedAt` makes
|
|
269
|
+
* it a new URL each time the image is written, so a browser that kept the
|
|
270
|
+
* old one asks again. `baseURL` is the API's own, which the session cookie
|
|
271
|
+
* authenticates an image request on.
|
|
272
|
+
*/
|
|
273
|
+
export function mockupCaptureUrl(
|
|
274
|
+
baseURL: string | undefined,
|
|
275
|
+
name: string,
|
|
276
|
+
capturedAt: string,
|
|
277
|
+
): string {
|
|
278
|
+
const origin = baseURL?.replace(/\/+$/, "") ?? "";
|
|
279
|
+
return `${origin}${mockupEndpoint(name, MOCKUP_CAPTURE_SUFFIX)}?v=${encodeURIComponent(capturedAt)}`;
|
|
280
|
+
}
|
|
281
|
+
|
|
289
282
|
export function isMockupWidth(value: string | undefined): value is MockupWidth {
|
|
290
283
|
return value !== undefined && Object.hasOwn(MOCKUP_WIDTHS, value);
|
|
291
284
|
}
|
|
@@ -365,6 +358,7 @@ function isPageState(
|
|
|
365
358
|
description: value.description,
|
|
366
359
|
actions: value.headerActions,
|
|
367
360
|
}) &&
|
|
361
|
+
(value.layout === undefined || isPreviewPageLayout(value.layout)) &&
|
|
368
362
|
isRecord(value.options) &&
|
|
369
363
|
Array.isArray(value.tree) &&
|
|
370
364
|
isPreviewTree(value.tree) &&
|
|
@@ -400,41 +394,14 @@ function isSidebar(
|
|
|
400
394
|
);
|
|
401
395
|
}
|
|
402
396
|
|
|
403
|
-
function isModuleSide(
|
|
404
|
-
value: Parameters<typeof isObject>[0],
|
|
405
|
-
): value is MockupModuleSide {
|
|
406
|
-
return (
|
|
407
|
-
isRecord(value) &&
|
|
408
|
-
isString(value.title) &&
|
|
409
|
-
Array.isArray(value.categories) &&
|
|
410
|
-
value.categories.every(isMockupCategory) &&
|
|
411
|
-
Array.isArray(value.pages) &&
|
|
412
|
-
value.pages.every(isString)
|
|
413
|
-
);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
397
|
function isModule(
|
|
417
398
|
value: Parameters<typeof isObject>[0],
|
|
418
399
|
): value is MockupModule {
|
|
419
400
|
return (
|
|
420
|
-
isModuleSide(value) &&
|
|
421
401
|
isRecord(value) &&
|
|
422
402
|
isString(value.id) &&
|
|
423
|
-
isString(value.
|
|
424
|
-
|
|
425
|
-
(value.tenant === undefined || isModuleSide(value.tenant))
|
|
426
|
-
);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/** Whether the parts of a state a spec may leave out are each absent or well-formed. */
|
|
430
|
-
function hasValidParts(value: Parameters<typeof isObject>[0]): boolean {
|
|
431
|
-
return (
|
|
432
|
-
isRecord(value) &&
|
|
433
|
-
(value.sidebar === undefined || isSidebar(value.sidebar)) &&
|
|
434
|
-
(value.modules === undefined ||
|
|
435
|
-
(Array.isArray(value.modules) && value.modules.every(isModule))) &&
|
|
436
|
-
(value.entities === undefined || isMockupEntities(value.entities)) &&
|
|
437
|
-
(value.tenants === undefined || isMockupTenants(value.tenants))
|
|
403
|
+
isString(value.package) &&
|
|
404
|
+
isString(value.icon)
|
|
438
405
|
);
|
|
439
406
|
}
|
|
440
407
|
|
|
@@ -449,12 +416,15 @@ function isMockupState(
|
|
|
449
416
|
(value.categories === undefined ||
|
|
450
417
|
(Array.isArray(value.categories) &&
|
|
451
418
|
value.categories.every(isMockupCategory))) &&
|
|
452
|
-
|
|
453
|
-
|
|
419
|
+
(value.sidebar === undefined || isSidebar(value.sidebar)) &&
|
|
420
|
+
(value.modules === undefined ||
|
|
421
|
+
(Array.isArray(value.modules) && value.modules.every(isModule))) &&
|
|
454
422
|
Array.isArray(value.pages) &&
|
|
455
423
|
value.pages.every(isPageState) &&
|
|
456
424
|
Array.isArray(value.issues) &&
|
|
457
|
-
value.issues.every(isIssue)
|
|
425
|
+
value.issues.every(isIssue) &&
|
|
426
|
+
(value.warnings === undefined ||
|
|
427
|
+
(Array.isArray(value.warnings) && value.warnings.every(isIssue)))
|
|
458
428
|
);
|
|
459
429
|
}
|
|
460
430
|
|
|
@@ -566,7 +536,8 @@ function isSummaryBase(
|
|
|
566
536
|
isNumber(value.pages) &&
|
|
567
537
|
isNumber(value.openComments) &&
|
|
568
538
|
(value.source === undefined || isSource(value.source)) &&
|
|
569
|
-
isString(value.updatedAt)
|
|
539
|
+
isString(value.updatedAt) &&
|
|
540
|
+
isOptionalString(value.capturedAt)
|
|
570
541
|
);
|
|
571
542
|
}
|
|
572
543
|
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { shallowRef, type Ref, type ShallowRef } from "vue";
|
|
2
|
+
import type {
|
|
3
|
+
PreviewBlockRect,
|
|
4
|
+
PreviewNavigation,
|
|
5
|
+
} from "./blockPreviewMessages";
|
|
6
|
+
import type { MockupPageState } from "./mockup";
|
|
7
|
+
import { mockupPageRender } from "./mockupFrame";
|
|
8
|
+
import { mockupDataTree } from "./mockupRealData";
|
|
9
|
+
|
|
10
|
+
/** The image of a page of a mockup, drawn once by the page's live preview. */
|
|
11
|
+
export interface PageCapture {
|
|
12
|
+
/** What drew the page, as {@link captureKey} names it: a page whose key is another is out of date. */
|
|
13
|
+
key: string;
|
|
14
|
+
/** An object URL of the image, WebP where the browser encodes it. */
|
|
15
|
+
url: string;
|
|
16
|
+
/** The height of the page the image shows, as its preview reported it. */
|
|
17
|
+
height?: number;
|
|
18
|
+
/** Where each block of the page sat in the image, for the pins of a frame no live preview reported. */
|
|
19
|
+
blocks?: PreviewBlockRect[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** What the live preview of a page reported of the drawing it was captured from. */
|
|
23
|
+
export interface CapturedLayout {
|
|
24
|
+
height?: number;
|
|
25
|
+
blocks?: PreviewBlockRect[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** The captures of a mockup by page id. */
|
|
29
|
+
export type PageCaptures = ReadonlyMap<string, PageCapture>;
|
|
30
|
+
|
|
31
|
+
/** The sidebar every page is drawn in, which is the same for all of them and so says nothing of one. */
|
|
32
|
+
const NO_NAVIGATION: PreviewNavigation = { sections: [] };
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* What draws `page` alone: its own state as the preview is sent it, minus
|
|
36
|
+
* the sidebar, and whether it reads real data. Another page changing, or
|
|
37
|
+
* the pages' order or titles, leaves the key as it was; changing the page
|
|
38
|
+
* itself, its theme or locale, or Real data does not.
|
|
39
|
+
*/
|
|
40
|
+
export function captureKey(page: MockupPageState, realData: boolean): string {
|
|
41
|
+
return JSON.stringify([
|
|
42
|
+
realData,
|
|
43
|
+
mockupPageRender(page, mockupDataTree(page, realData), NO_NAVIGATION),
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The captures of each mockup, kept outside the viewer, which the dashboard
|
|
49
|
+
* builds again on a step of the browser's history, so a viewer built again,
|
|
50
|
+
* or another view of the mockup, can show a page the Overview drew.
|
|
51
|
+
*/
|
|
52
|
+
const stores = new Map<string, ShallowRef<PageCaptures>>();
|
|
53
|
+
|
|
54
|
+
function storeOf(name: string): ShallowRef<PageCaptures> {
|
|
55
|
+
const known = stores.get(name);
|
|
56
|
+
if (known) return known;
|
|
57
|
+
const made = shallowRef<PageCaptures>(new Map());
|
|
58
|
+
stores.set(name, made);
|
|
59
|
+
return made;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** The captures of the mockup `name`, replaced as a whole on each change: read them reactively. */
|
|
63
|
+
export function mockupCaptures(name: string): Readonly<Ref<PageCaptures>> {
|
|
64
|
+
return storeOf(name);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The capture of `page` of the mockup `name`, stale or not; undefined while it has none. */
|
|
68
|
+
export function pageCapture(
|
|
69
|
+
name: string,
|
|
70
|
+
page: string,
|
|
71
|
+
): PageCapture | undefined {
|
|
72
|
+
return storeOf(name).value.get(page);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Keeps `image` as the capture of `page` of the mockup `name`, drawn from `key` at the height and with the blocks of `drawn`, and releases the image it replaces. */
|
|
76
|
+
export function storePageCapture(
|
|
77
|
+
name: string,
|
|
78
|
+
page: string,
|
|
79
|
+
key: string,
|
|
80
|
+
image: Blob,
|
|
81
|
+
drawn: CapturedLayout = {},
|
|
82
|
+
): void {
|
|
83
|
+
const store = storeOf(name);
|
|
84
|
+
const replaced = store.value.get(page);
|
|
85
|
+
store.value = new Map(store.value).set(page, {
|
|
86
|
+
key,
|
|
87
|
+
url: URL.createObjectURL(image),
|
|
88
|
+
...drawn,
|
|
89
|
+
});
|
|
90
|
+
if (replaced) URL.revokeObjectURL(replaced.url);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* What the server holds of each mockup's first page as far as this browser
|
|
95
|
+
* session knows, as the page and the capture key it was sent from.
|
|
96
|
+
*/
|
|
97
|
+
const sent = new Map<string, string>();
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Takes the right to send the capture of `page`, drawn from `key`, as the
|
|
101
|
+
* image of the mockup `name`. False when it was sent already, or is being
|
|
102
|
+
* sent, so each drawing of a first page is sent once per session.
|
|
103
|
+
*/
|
|
104
|
+
export function claimCaptureUpload(
|
|
105
|
+
name: string,
|
|
106
|
+
page: string,
|
|
107
|
+
key: string,
|
|
108
|
+
): boolean {
|
|
109
|
+
const claim = JSON.stringify([page, key]);
|
|
110
|
+
if (sent.get(name) === claim) return false;
|
|
111
|
+
sent.set(name, claim);
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Gives back a claim whose upload failed, so the same capture is sent again the next time it is current. */
|
|
116
|
+
export function releaseCaptureUpload(
|
|
117
|
+
name: string,
|
|
118
|
+
page: string,
|
|
119
|
+
key: string,
|
|
120
|
+
): void {
|
|
121
|
+
if (sent.get(name) === JSON.stringify([page, key])) sent.delete(name);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Forgets every capture of the mockup `name`, and releases its images. */
|
|
125
|
+
export function clearMockupCaptures(name: string): void {
|
|
126
|
+
sent.delete(name);
|
|
127
|
+
const store = storeOf(name);
|
|
128
|
+
for (const { url } of store.value.values()) URL.revokeObjectURL(url);
|
|
129
|
+
store.value = new Map();
|
|
130
|
+
}
|