@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
|
@@ -2,21 +2,15 @@ import { isPreviewTheme, type PreviewNode } from "./blockPreview";
|
|
|
2
2
|
import {
|
|
3
3
|
previewRenderMessage,
|
|
4
4
|
type PreviewNavigation,
|
|
5
|
-
type PreviewNavigationModule,
|
|
6
|
-
type PreviewNavigationSection,
|
|
7
5
|
type PreviewRenderMessage,
|
|
8
6
|
type PreviewSidebarWidget,
|
|
9
|
-
type PreviewWorkspace,
|
|
10
7
|
} from "./blockPreviewMessages";
|
|
11
8
|
import type {
|
|
12
9
|
MockupCategory,
|
|
13
|
-
MockupModule,
|
|
14
|
-
MockupModuleSide,
|
|
15
10
|
MockupPageState,
|
|
16
11
|
MockupSidebarWidget,
|
|
17
12
|
} from "./mockup";
|
|
18
13
|
import { groupSections } from "./mockupSections";
|
|
19
|
-
import { type MockupTenancy, SINGLE_TENANCY } from "./mockupTenancy";
|
|
20
14
|
import { currentSketchScheme } from "./sketch";
|
|
21
15
|
|
|
22
16
|
const HOME_ICON = "i-ph-house-light";
|
|
@@ -86,12 +80,6 @@ export interface MockupNavigationSource {
|
|
|
86
80
|
editable?: boolean;
|
|
87
81
|
/** Sketches the sidebar draws among its widgets. */
|
|
88
82
|
widgets?: readonly MockupSidebarWidget[];
|
|
89
|
-
/** The modules under the app's menu, each listing the pages it holds. */
|
|
90
|
-
modules?: readonly MockupModule[];
|
|
91
|
-
/** How the mockup is seen: in SaaS mode a module with a tenant side draws it in place of its platform side. Single-tenant when absent. */
|
|
92
|
-
tenancy?: MockupTenancy;
|
|
93
|
-
/** The workspace switcher and the banner SaaS mode draws; none when absent. */
|
|
94
|
-
workspace?: PreviewWorkspace;
|
|
95
83
|
}
|
|
96
84
|
|
|
97
85
|
function sidebarWidget(widget: MockupSidebarWidget): PreviewSidebarWidget {
|
|
@@ -125,90 +113,18 @@ function menuEntryOf(
|
|
|
125
113
|
return undefined;
|
|
126
114
|
}
|
|
127
115
|
|
|
128
|
-
/** The side of `module` the menu draws: its tenant side in SaaS mode when it has one, else its platform side. */
|
|
129
|
-
function sideOf(
|
|
130
|
-
module: MockupModule,
|
|
131
|
-
tenancy: MockupTenancy,
|
|
132
|
-
): MockupModuleSide {
|
|
133
|
-
return tenancy.mode === "saas" && module.tenant ? module.tenant : module;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* A module as the sidebar lists it: the root pages of its side as a section
|
|
138
|
-
* with no category, then each category that holds a page. A page the module
|
|
139
|
-
* lists and the mockup lacks, or with `menu: false`, is left out.
|
|
140
|
-
*/
|
|
141
|
-
function moduleNavigation(
|
|
142
|
-
module: MockupModule,
|
|
143
|
-
pages: ReadonlyMap<string, NavigationPage>,
|
|
144
|
-
tenancy: MockupTenancy,
|
|
145
|
-
): PreviewNavigationModule {
|
|
146
|
-
const side = sideOf(module, tenancy);
|
|
147
|
-
const listed = side.pages.flatMap((id) => {
|
|
148
|
-
const page = pages.get(id);
|
|
149
|
-
return page && page.menu !== false ? [page] : [];
|
|
150
|
-
});
|
|
151
|
-
const sectionOf = (
|
|
152
|
-
pagesIn: readonly NavigationPage[],
|
|
153
|
-
category?: MockupCategory,
|
|
154
|
-
): PreviewNavigationSection[] =>
|
|
155
|
-
pagesIn.length === 0
|
|
156
|
-
? []
|
|
157
|
-
: [
|
|
158
|
-
{
|
|
159
|
-
...(category && { category }),
|
|
160
|
-
items: pagesIn.map((page) => ({
|
|
161
|
-
id: page.id,
|
|
162
|
-
label: page.title,
|
|
163
|
-
icon: page.icon,
|
|
164
|
-
})),
|
|
165
|
-
},
|
|
166
|
-
];
|
|
167
|
-
return {
|
|
168
|
-
id: module.id,
|
|
169
|
-
title: side.title,
|
|
170
|
-
icon: module.icon,
|
|
171
|
-
sections: [
|
|
172
|
-
...sectionOf(
|
|
173
|
-
listed.filter(
|
|
174
|
-
(page) =>
|
|
175
|
-
!side.categories.some((category) => category.id === page.category),
|
|
176
|
-
),
|
|
177
|
-
),
|
|
178
|
-
...side.categories.flatMap((category) =>
|
|
179
|
-
sectionOf(
|
|
180
|
-
listed.filter((page) => page.category === category.id),
|
|
181
|
-
category,
|
|
182
|
-
),
|
|
183
|
-
),
|
|
184
|
-
],
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
|
|
188
116
|
/**
|
|
189
117
|
* The mockup's pages as the preview's sidebar lists them: under their
|
|
190
118
|
* sections, each page with its icon, and `active` as the current one. A page with `menu: false`
|
|
191
119
|
* is left out, and while it is the current one, its nearest listed parent is.
|
|
192
|
-
*
|
|
193
|
-
* the sections and is listed under the module, which follows them in
|
|
194
|
-
* `modules` order, drawing its tenant side in SaaS mode. The
|
|
195
|
-
* mockup's sidebar widgets follow, each `title` the caption over it.
|
|
120
|
+
* The mockup's sidebar widgets follow, each `title` the caption over it.
|
|
196
121
|
*/
|
|
197
122
|
export function mockupNavigation(
|
|
198
123
|
source: MockupNavigationSource,
|
|
199
124
|
): PreviewNavigation {
|
|
200
|
-
const modules = source.modules ?? [];
|
|
201
|
-
const byId = new Map(source.pages.map((page) => [page.id, page]));
|
|
202
|
-
const tenancy = source.tenancy ?? SINGLE_TENANCY;
|
|
203
|
-
const inModule = new Set(
|
|
204
|
-
modules.flatMap((module) => [
|
|
205
|
-
...module.pages,
|
|
206
|
-
...(module.tenant?.pages ?? []),
|
|
207
|
-
]),
|
|
208
|
-
);
|
|
209
125
|
const indexed = source.pages
|
|
210
126
|
.map((page, index) => ({ page, index }))
|
|
211
|
-
.filter(({ page }) => page.menu !== false
|
|
127
|
+
.filter(({ page }) => page.menu !== false);
|
|
212
128
|
const sections = groupSections(
|
|
213
129
|
source.categories,
|
|
214
130
|
indexed,
|
|
@@ -224,33 +140,32 @@ export function mockupNavigation(
|
|
|
224
140
|
icon: sidebarIcon(page, index),
|
|
225
141
|
})),
|
|
226
142
|
})),
|
|
227
|
-
...(modules.length > 0 && {
|
|
228
|
-
modules: modules.map((module) => moduleNavigation(module, byId, tenancy)),
|
|
229
|
-
}),
|
|
230
143
|
active: menuEntryOf(source.pages, source.active),
|
|
231
144
|
...(source.editable && { editable: true }),
|
|
232
145
|
...(source.widgets &&
|
|
233
146
|
source.widgets.length > 0 && {
|
|
234
147
|
widgets: source.widgets.map(sidebarWidget),
|
|
235
148
|
}),
|
|
236
|
-
...(source.workspace && { workspace: source.workspace }),
|
|
237
149
|
};
|
|
238
150
|
}
|
|
239
151
|
|
|
240
152
|
/**
|
|
241
153
|
* What the preview draws for a page of the mockup: `tree`, the page's own or
|
|
242
154
|
* its live one, in the page's theme, else the dashboard's, and its locale,
|
|
243
|
-
* inside `navigation`, under the page header its spec writes,
|
|
244
|
-
* `{{params.X}}` tokens filled with `params
|
|
155
|
+
* inside `navigation`, under the page header its spec writes, in the page's
|
|
156
|
+
* layout, its blocks' `{{params.X}}` tokens filled with `params`, and the
|
|
157
|
+
* page's URL query `query`.
|
|
245
158
|
*/
|
|
246
159
|
export function mockupPageRender(
|
|
247
160
|
page: MockupPageState,
|
|
248
161
|
tree: PreviewNode[],
|
|
249
162
|
navigation: PreviewNavigation,
|
|
250
163
|
params?: Record<string, string>,
|
|
164
|
+
query?: Record<string, string>,
|
|
251
165
|
): PreviewRenderMessage {
|
|
252
166
|
return previewRenderMessage({
|
|
253
167
|
...(params && { params }),
|
|
168
|
+
...(query && { query }),
|
|
254
169
|
tree,
|
|
255
170
|
theme: isPreviewTheme(page.options.theme)
|
|
256
171
|
? page.options.theme
|
|
@@ -264,5 +179,6 @@ export function mockupPageRender(
|
|
|
264
179
|
description: page.description,
|
|
265
180
|
actions: page.headerActions,
|
|
266
181
|
},
|
|
182
|
+
...(page.layout && { pageLayout: page.layout }),
|
|
267
183
|
});
|
|
268
184
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type MockupPageState, readQueryValue } from "./mockup";
|
|
2
2
|
|
|
3
3
|
/** Where the viewer draws a mockup: a spec's `page:<id>` link compiles to it. */
|
|
4
4
|
export const MOCKUP_VIEWER_PATH = "/mockup";
|
|
@@ -8,6 +8,40 @@ const PAGE_QUERY = "page";
|
|
|
8
8
|
/** The viewer's query naming the row a page with a route shows. */
|
|
9
9
|
export const RECORD_QUERY = "record";
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* The query parameters the viewer and its preview read themselves: the
|
|
13
|
+
* mockup, the page, the canvas width, the data shown, the preview's state and
|
|
14
|
+
* its fixtures-only switch.
|
|
15
|
+
*/
|
|
16
|
+
const VIEWER_QUERY_KEYS: ReadonlySet<string> = new Set([
|
|
17
|
+
"name",
|
|
18
|
+
PAGE_QUERY,
|
|
19
|
+
"width",
|
|
20
|
+
"data",
|
|
21
|
+
"state",
|
|
22
|
+
"fixtures",
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The query of the page the viewer shows, which its tables'
|
|
27
|
+
* `queryParamFilters` and its `{{query.X}}` tokens read: the viewer's URL
|
|
28
|
+
* query, `?record=` included, without the parameters the viewer reads
|
|
29
|
+
* itself. None when nothing is left.
|
|
30
|
+
*/
|
|
31
|
+
export function mockupPageQuery(
|
|
32
|
+
query: Readonly<
|
|
33
|
+
Record<string, string | null | readonly (string | null)[] | undefined>
|
|
34
|
+
>,
|
|
35
|
+
): Record<string, string> | undefined {
|
|
36
|
+
const entries = Object.entries(query).flatMap(([key, value]) => {
|
|
37
|
+
const read = readQueryValue(value);
|
|
38
|
+
return VIEWER_QUERY_KEYS.has(key) || read === undefined
|
|
39
|
+
? []
|
|
40
|
+
: [[key, read] as const];
|
|
41
|
+
});
|
|
42
|
+
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
11
45
|
/** A page of the mockup a link opens, and the row it shows there. */
|
|
12
46
|
export interface MockupLink {
|
|
13
47
|
page: string;
|
|
@@ -327,34 +327,61 @@ function overlaps(left: PreviewRect, right: PreviewRect): boolean {
|
|
|
327
327
|
);
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
+
/** How wide a frame is on the screen, at least, for its page to be worth drawing live: a narrower frame is a thumbnail, which its image serves as well. */
|
|
331
|
+
export const LIVE_FRAME_MIN_SCREEN_WIDTH = 400;
|
|
332
|
+
|
|
333
|
+
/** What decides which pages the live slots draw. */
|
|
334
|
+
export interface LiveView {
|
|
335
|
+
frames: readonly OverviewFrame[];
|
|
336
|
+
camera: OverviewCamera;
|
|
337
|
+
viewport: ViewportSize;
|
|
338
|
+
/** The page picked with a click, if any. */
|
|
339
|
+
picked: string | undefined;
|
|
340
|
+
/** Whether the page has no image, or one that is out of date. */
|
|
341
|
+
needsCapture: (page: string) => boolean;
|
|
342
|
+
}
|
|
343
|
+
|
|
330
344
|
/**
|
|
331
|
-
* The
|
|
332
|
-
*
|
|
345
|
+
* The pages to draw live, most wanted first: the picked page; the frames in
|
|
346
|
+
* view, while a frame is at least {@link LIVE_FRAME_MIN_SCREEN_WIDTH} wide on
|
|
347
|
+
* the screen, those with no current image before the others, each group
|
|
348
|
+
* nearest the middle of the view first; then every page with no current
|
|
349
|
+
* image, nearest first. A page in view with no image comes before the pages
|
|
350
|
+
* in view that have one, so a view of more frames than slots still draws and
|
|
351
|
+
* captures each of them. The caller hands slots to the first few.
|
|
333
352
|
*/
|
|
334
|
-
export function
|
|
335
|
-
frames
|
|
336
|
-
camera
|
|
337
|
-
viewport
|
|
338
|
-
|
|
353
|
+
export function wantedLivePages({
|
|
354
|
+
frames,
|
|
355
|
+
camera,
|
|
356
|
+
viewport,
|
|
357
|
+
picked,
|
|
358
|
+
needsCapture,
|
|
359
|
+
}: LiveView): string[] {
|
|
339
360
|
const width = viewport.width / camera.zoom;
|
|
340
361
|
const height = viewport.height / camera.zoom;
|
|
341
362
|
const { x, y } = toWorld(camera, { x: 0, y: 0 });
|
|
342
|
-
const
|
|
343
|
-
x: x - width / 2,
|
|
344
|
-
y: y - height / 2,
|
|
345
|
-
width: width * 2,
|
|
346
|
-
height: height * 2,
|
|
347
|
-
};
|
|
363
|
+
const view = { x, y, width, height };
|
|
348
364
|
const middle = { x: x + width / 2, y: y + height / 2 };
|
|
349
365
|
const distance = ({ rect }: OverviewFrame) =>
|
|
350
366
|
Math.hypot(
|
|
351
367
|
rect.x + rect.width / 2 - middle.x,
|
|
352
368
|
rect.y + rect.height / 2 - middle.y,
|
|
353
369
|
);
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
370
|
+
const nearest = [...frames].sort((a, b) => distance(a) - distance(b));
|
|
371
|
+
const isWide =
|
|
372
|
+
OVERVIEW_FRAME_WIDTH * camera.zoom >= LIVE_FRAME_MIN_SCREEN_WIDTH;
|
|
373
|
+
const inView = isWide
|
|
374
|
+
? nearest.filter(({ rect }) => overlaps(rect, view)).map(({ id }) => id)
|
|
375
|
+
: [];
|
|
376
|
+
const wanted = [
|
|
377
|
+
...(picked !== undefined && frames.some(({ id }) => id === picked)
|
|
378
|
+
? [picked]
|
|
379
|
+
: []),
|
|
380
|
+
...inView.filter(needsCapture),
|
|
381
|
+
...inView.filter((id) => !needsCapture(id)),
|
|
382
|
+
...nearest.map(({ id }) => id).filter(needsCapture),
|
|
383
|
+
];
|
|
384
|
+
return [...new Set(wanted)];
|
|
358
385
|
}
|
|
359
386
|
|
|
360
387
|
/**
|
|
@@ -31,17 +31,11 @@ export interface MockupCombo {
|
|
|
31
31
|
/**
|
|
32
32
|
* What the canvas shows: one page of the mockup as it is now, or of a past
|
|
33
33
|
* version of it, read-only; every page of either side by side, in the
|
|
34
|
-
* overview; a page as the dashboard runs it, in Preview, where a click
|
|
35
|
-
* reaches the page
|
|
36
|
-
* the page behind it.
|
|
34
|
+
* overview; or a page as the dashboard runs it, in Preview, where a click
|
|
35
|
+
* reaches the page.
|
|
37
36
|
*/
|
|
38
37
|
export type MockupView =
|
|
39
|
-
| "
|
|
40
|
-
| "version"
|
|
41
|
-
| "overview"
|
|
42
|
-
| "overview_version"
|
|
43
|
-
| "preview"
|
|
44
|
-
| "database";
|
|
38
|
+
"current" | "version" | "overview" | "overview_version" | "preview";
|
|
45
39
|
|
|
46
40
|
const PAGE_VIEWS: readonly MockupView[] = ["current", "version"];
|
|
47
41
|
const OVERVIEW_VIEWS: readonly MockupView[] = ["overview", "overview_version"];
|
|
@@ -136,11 +130,6 @@ export const MOCKUP_SHORTCUTS = {
|
|
|
136
130
|
combos: [{ key: "escape" }],
|
|
137
131
|
views: ["preview"],
|
|
138
132
|
},
|
|
139
|
-
close_database: {
|
|
140
|
-
group: "panels",
|
|
141
|
-
combos: [{ key: "escape" }],
|
|
142
|
-
views: ["database"],
|
|
143
|
-
},
|
|
144
133
|
} as const satisfies Record<string, MockupShortcut>;
|
|
145
134
|
|
|
146
135
|
export type MockupShortcutId = keyof typeof MOCKUP_SHORTCUTS;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { JsonValue } from "../../../../dms-core/app/types/json";
|
|
2
2
|
import { isNumber, isString } from "../../../../dms-core/app/utils/type-check";
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
isHeaderColor,
|
|
5
|
+
isHeaderVariant,
|
|
6
|
+
type PreviewHeaderAction,
|
|
7
|
+
} from "./previewHeader";
|
|
5
8
|
import {
|
|
6
9
|
isJsonObject,
|
|
7
10
|
isJsonValue,
|
|
@@ -99,8 +102,17 @@ function isOptional<Value extends JsonValue>(
|
|
|
99
102
|
return value === undefined || guard(value);
|
|
100
103
|
}
|
|
101
104
|
|
|
102
|
-
/**
|
|
103
|
-
|
|
105
|
+
/**
|
|
106
|
+
* A button right of a page's title, as a spec page holds it: the look the
|
|
107
|
+
* page inspector edits, and what else the spec writes on it (its target, its
|
|
108
|
+
* confirmation), kept as written.
|
|
109
|
+
*/
|
|
110
|
+
export interface MockupHeaderAction extends Pick<
|
|
111
|
+
PreviewHeaderAction,
|
|
112
|
+
"label" | "icon" | "color" | "variant"
|
|
113
|
+
> {
|
|
114
|
+
kept?: JsonObject;
|
|
115
|
+
}
|
|
104
116
|
|
|
105
117
|
/** The header buttons a page holds, in order, as far as each reads cleanly. */
|
|
106
118
|
export function pageHeaderActions(page: MockupSpecPage): MockupHeaderAction[] {
|
|
@@ -108,15 +120,15 @@ export function pageHeaderActions(page: MockupSpecPage): MockupHeaderAction[] {
|
|
|
108
120
|
if (!Array.isArray(headerActions)) return [];
|
|
109
121
|
return headerActions.flatMap((entry): MockupHeaderAction[] => {
|
|
110
122
|
if (!isJsonObject(entry)) return [];
|
|
111
|
-
const { label, icon, color, variant } = entry;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
];
|
|
123
|
+
const { label, icon, color, variant, ...kept } = entry;
|
|
124
|
+
const action: MockupHeaderAction = {
|
|
125
|
+
label: isString(label) ? label : "",
|
|
126
|
+
icon: isString(icon) ? icon : undefined,
|
|
127
|
+
color: isHeaderColor(color) ? color : undefined,
|
|
128
|
+
variant: isHeaderVariant(variant) ? variant : undefined,
|
|
129
|
+
};
|
|
130
|
+
if (Object.keys(kept).length) action.kept = kept;
|
|
131
|
+
return [action];
|
|
120
132
|
});
|
|
121
133
|
}
|
|
122
134
|
|
|
@@ -126,7 +138,7 @@ export function headerActionJson(action: MockupHeaderAction): JsonObject {
|
|
|
126
138
|
if (action.icon) written.icon = action.icon;
|
|
127
139
|
if (action.color) written.color = action.color;
|
|
128
140
|
if (action.variant) written.variant = action.variant;
|
|
129
|
-
return written;
|
|
141
|
+
return { ...written, ...action.kept };
|
|
130
142
|
}
|
|
131
143
|
|
|
132
144
|
/** The text field `name` of a page, empty when it holds none. */
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { ButtonVariant } from "../../../../dms-core/app/types/button";
|
|
2
|
+
import { Color, type ColorValue } from "../../../../dms-core/app/types/color";
|
|
3
|
+
import {
|
|
4
|
+
isBoolean,
|
|
5
|
+
isNumber,
|
|
6
|
+
isObject,
|
|
7
|
+
isString,
|
|
8
|
+
} from "../../../../dms-core/app/utils/type-check";
|
|
9
|
+
|
|
10
|
+
type ButtonVariantValue = `${ButtonVariant}`;
|
|
11
|
+
|
|
12
|
+
const HEADER_COLORS = new Set<string>(Object.values(Color));
|
|
13
|
+
const HEADER_VARIANTS = new Set<string>(Object.values(ButtonVariant));
|
|
14
|
+
|
|
15
|
+
/** Whether `value` is a color a header button takes. */
|
|
16
|
+
export function isHeaderColor(
|
|
17
|
+
value: Parameters<typeof isString>[0],
|
|
18
|
+
): value is ColorValue {
|
|
19
|
+
return isString(value) && HEADER_COLORS.has(value);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Whether `value` is a variant a header button takes. */
|
|
23
|
+
export function isHeaderVariant(
|
|
24
|
+
value: Parameters<typeof isString>[0],
|
|
25
|
+
): value is ButtonVariantValue {
|
|
26
|
+
return isString(value) && HEADER_VARIANTS.has(value);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Where a header button of a mockup goes: the viewer's URL of a page of the mockup. */
|
|
30
|
+
export interface PreviewHeaderTarget {
|
|
31
|
+
type: "page";
|
|
32
|
+
url: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** One dependent a header button's action affects, listed in its dialog. */
|
|
36
|
+
export interface PreviewConfirmImpact {
|
|
37
|
+
icon: string;
|
|
38
|
+
label: string;
|
|
39
|
+
count?: number | string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The dialog a header button of a mockup asks in before it goes: a fixed `ConfirmDialog`'s texts. */
|
|
43
|
+
export interface PreviewHeaderConfirm {
|
|
44
|
+
title: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
params?: Record<string, string | number>;
|
|
47
|
+
icon?: string;
|
|
48
|
+
color?: ColorValue;
|
|
49
|
+
confirmLabel?: string;
|
|
50
|
+
cancelLabel?: string;
|
|
51
|
+
impact?: PreviewConfirmImpact[];
|
|
52
|
+
blocked?: boolean;
|
|
53
|
+
confirmText?: string;
|
|
54
|
+
confirmTextCaseInsensitive?: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** A button right of the page title, as the header draws it, and what pressing it does. */
|
|
58
|
+
export interface PreviewHeaderAction {
|
|
59
|
+
label: string;
|
|
60
|
+
icon?: string;
|
|
61
|
+
color?: ColorValue;
|
|
62
|
+
variant?: ButtonVariantValue;
|
|
63
|
+
target?: PreviewHeaderTarget;
|
|
64
|
+
confirm?: PreviewHeaderConfirm;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The page header the preview draws above the blocks, as the dashboard draws a page's. */
|
|
68
|
+
export interface PreviewHeader {
|
|
69
|
+
title: string;
|
|
70
|
+
icon?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
actions?: PreviewHeaderAction[];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function isRecord(
|
|
76
|
+
value: Parameters<typeof isObject>[0],
|
|
77
|
+
): value is Record<string, unknown> {
|
|
78
|
+
return isObject(value) && value !== null && !Array.isArray(value);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function isOptionalString(value: Parameters<typeof isString>[0]): boolean {
|
|
82
|
+
return value === undefined || isString(value);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function isOptionalBoolean(value: Parameters<typeof isBoolean>[0]): boolean {
|
|
86
|
+
return value === undefined || isBoolean(value);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function isHeaderTarget(value: unknown): value is PreviewHeaderTarget {
|
|
90
|
+
return isRecord(value) && value.type === "page" && isString(value.url);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function isConfirmImpact(value: unknown): value is PreviewConfirmImpact {
|
|
94
|
+
return (
|
|
95
|
+
isRecord(value) &&
|
|
96
|
+
isString(value.icon) &&
|
|
97
|
+
isString(value.label) &&
|
|
98
|
+
(value.count === undefined ||
|
|
99
|
+
isString(value.count) ||
|
|
100
|
+
isNumber(value.count))
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function isConfirmParams(
|
|
105
|
+
value: unknown,
|
|
106
|
+
): value is PreviewHeaderConfirm["params"] {
|
|
107
|
+
return (
|
|
108
|
+
value === undefined ||
|
|
109
|
+
(isRecord(value) &&
|
|
110
|
+
Object.values(value).every((param) => isString(param) || isNumber(param)))
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function isHeaderConfirm(value: unknown): value is PreviewHeaderConfirm {
|
|
115
|
+
return (
|
|
116
|
+
isRecord(value) &&
|
|
117
|
+
isString(value.title) &&
|
|
118
|
+
isOptionalString(value.description) &&
|
|
119
|
+
isConfirmParams(value.params) &&
|
|
120
|
+
isOptionalString(value.icon) &&
|
|
121
|
+
(value.color === undefined || isHeaderColor(value.color)) &&
|
|
122
|
+
isOptionalString(value.confirmLabel) &&
|
|
123
|
+
isOptionalString(value.cancelLabel) &&
|
|
124
|
+
(value.impact === undefined ||
|
|
125
|
+
(Array.isArray(value.impact) && value.impact.every(isConfirmImpact))) &&
|
|
126
|
+
isOptionalBoolean(value.blocked) &&
|
|
127
|
+
isOptionalString(value.confirmText) &&
|
|
128
|
+
isOptionalBoolean(value.confirmTextCaseInsensitive)
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function isHeaderAction(value: unknown): value is PreviewHeaderAction {
|
|
133
|
+
return (
|
|
134
|
+
isRecord(value) &&
|
|
135
|
+
isString(value.label) &&
|
|
136
|
+
isOptionalString(value.icon) &&
|
|
137
|
+
(value.color === undefined || isHeaderColor(value.color)) &&
|
|
138
|
+
(value.variant === undefined || isHeaderVariant(value.variant)) &&
|
|
139
|
+
(value.target === undefined || isHeaderTarget(value.target)) &&
|
|
140
|
+
(value.confirm === undefined || isHeaderConfirm(value.confirm))
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Whether `value` is a page header a `render` may carry, every button checked. */
|
|
145
|
+
export function isPreviewHeader(value: unknown): value is PreviewHeader {
|
|
146
|
+
return (
|
|
147
|
+
isRecord(value) &&
|
|
148
|
+
isString(value.title) &&
|
|
149
|
+
isOptionalString(value.icon) &&
|
|
150
|
+
isOptionalString(value.description) &&
|
|
151
|
+
(value.actions === undefined ||
|
|
152
|
+
(Array.isArray(value.actions) && value.actions.every(isHeaderAction)))
|
|
153
|
+
);
|
|
154
|
+
}
|