@antelopejs/dms 0.25.6-next.1105.g9b73018 → 0.25.6
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 +60 -0
- package/README.md +16 -16
- package/data/mockup-spec.schema.json +289 -5
- 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/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-write-spec.js +1 -1
- package/dist/mcp/tools/mockup-write-spec.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/capture-routes.d.ts +18 -0
- 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.js +16 -8
- 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 -1
- package/dist/mockup/files.js +3 -2
- package/dist/mockup/files.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/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 +8 -1
- package/dist/mockup/history-routes.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 +5 -16
- package/dist/mockup/json-schema.js.map +1 -1
- package/dist/mockup/model.d.ts +204 -18
- package/dist/mockup/model.js +46 -12
- package/dist/mockup/model.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 -0
- package/dist/mockup/refusals.js +1 -0
- package/dist/mockup/refusals.js.map +1 -1
- package/dist/mockup/routes.js +11 -1
- 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 +1 -0
- package/dist/mockup/store.js +9 -19
- package/dist/mockup/store.js.map +1 -1
- package/dist/mockup/summary-fields.d.ts +20 -0
- package/dist/mockup/summary-fields.js +22 -0
- 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/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/PreviewPageHeader.vue +19 -3
- package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupMenu.ts +3 -8
- 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 -4
- 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/MockupOverview.vue +125 -178
- 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 +113 -4
- 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/MockupWorkbench.vue +8 -1
- 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 -1
- 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 +4 -0
- 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/useOverviewCaptures.ts +136 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewFrame.ts +68 -8
- 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 +14 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/groupedRows.ts +68 -6
- 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 +34 -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 +29 -118
- 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 +34 -5
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCaptures.ts +130 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupFrame.ts +6 -2
- 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/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/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 -0
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-fr-FR.json +12 -10
- package/frontend-vue/scripts/check-invariants.mjs +101 -0
- package/package.json +8 -8
- package/skills/dms/SKILL.md +4 -2
- package/skills/dms-module/SKILL.md +3 -0
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isBoolean,
|
|
3
|
+
isObject,
|
|
4
|
+
isString,
|
|
5
|
+
} from "../../../../dms-core/app/utils/type-check";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The layouts a mockup page is drawn in, named after their factories:
|
|
9
|
+
* `DefaultLayout`, `FormPageLayout`, `SettingsLayout` and `EmptyLayout`.
|
|
10
|
+
*/
|
|
11
|
+
export const PREVIEW_PAGE_LAYOUTS = [
|
|
12
|
+
"default",
|
|
13
|
+
"form-page",
|
|
14
|
+
"settings",
|
|
15
|
+
"empty",
|
|
16
|
+
] as const;
|
|
17
|
+
export type PreviewPageLayoutType = (typeof PREVIEW_PAGE_LAYOUTS)[number];
|
|
18
|
+
|
|
19
|
+
/** The options of a layout, each one the layout's factory takes. */
|
|
20
|
+
export interface PreviewPageLayoutOptions {
|
|
21
|
+
fullWidth?: boolean;
|
|
22
|
+
hideHeader?: boolean;
|
|
23
|
+
fillHeight?: boolean;
|
|
24
|
+
hideBrand?: boolean;
|
|
25
|
+
hideFooter?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const LAYOUT_TYPES: ReadonlySet<unknown> = new Set(PREVIEW_PAGE_LAYOUTS);
|
|
29
|
+
|
|
30
|
+
const LAYOUT_OPTION_KEYS: readonly string[] = [
|
|
31
|
+
"fullWidth",
|
|
32
|
+
"hideHeader",
|
|
33
|
+
"fillHeight",
|
|
34
|
+
"hideBrand",
|
|
35
|
+
"hideFooter",
|
|
36
|
+
] satisfies (keyof PreviewPageLayoutOptions)[];
|
|
37
|
+
|
|
38
|
+
/** The layout a page is drawn in, with its options. */
|
|
39
|
+
export interface PreviewPageLayout {
|
|
40
|
+
type: PreviewPageLayoutType;
|
|
41
|
+
options?: PreviewPageLayoutOptions;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** What the preview draws around a page's blocks. */
|
|
45
|
+
export interface PreviewFrame {
|
|
46
|
+
/** The dashboard's sidebar and top bar. */
|
|
47
|
+
dashboard: boolean;
|
|
48
|
+
/** The page header: title, icon, description and buttons. */
|
|
49
|
+
header: boolean;
|
|
50
|
+
/** The blocks span the panel, else a readable column. */
|
|
51
|
+
fullWidth: boolean;
|
|
52
|
+
/** The settings navigation beside the page. */
|
|
53
|
+
settings: boolean;
|
|
54
|
+
/** The page fills the frame's height, its last block taking what is left. */
|
|
55
|
+
fillHeight: boolean;
|
|
56
|
+
/** Without the dashboard: the app logo and the theme toggle above the page. */
|
|
57
|
+
brand: boolean;
|
|
58
|
+
/** Without the dashboard: the footer under the page. */
|
|
59
|
+
footer: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function isRecord(
|
|
63
|
+
value: Parameters<typeof isObject>[0],
|
|
64
|
+
): value is Record<string, unknown> {
|
|
65
|
+
return isObject(value) && value !== null && !Array.isArray(value);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function isLayoutType(value: unknown): value is PreviewPageLayoutType {
|
|
69
|
+
return LAYOUT_TYPES.has(value);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function isOptionalBoolean(value: Parameters<typeof isBoolean>[0]): boolean {
|
|
73
|
+
return value === undefined || isBoolean(value);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function isLayoutOptions(value: unknown): value is PreviewPageLayoutOptions {
|
|
77
|
+
return (
|
|
78
|
+
isRecord(value) &&
|
|
79
|
+
Object.keys(value).every((key) => LAYOUT_OPTION_KEYS.includes(key)) &&
|
|
80
|
+
isOptionalBoolean(value.fullWidth) &&
|
|
81
|
+
isOptionalBoolean(value.hideHeader) &&
|
|
82
|
+
isOptionalBoolean(value.fillHeight) &&
|
|
83
|
+
isOptionalBoolean(value.hideBrand) &&
|
|
84
|
+
isOptionalBoolean(value.hideFooter)
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Whether `value` is a layout a page is drawn in, each option a boolean the layouts take. */
|
|
89
|
+
export function isPreviewPageLayout(
|
|
90
|
+
value: unknown,
|
|
91
|
+
): value is PreviewPageLayout {
|
|
92
|
+
return (
|
|
93
|
+
isRecord(value) &&
|
|
94
|
+
isLayoutType(value.type) &&
|
|
95
|
+
(value.options === undefined || isLayoutOptions(value.options))
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Whether `value` is absent, or a layout a page is drawn in. */
|
|
100
|
+
export function isOptionalPreviewPageLayout(
|
|
101
|
+
value: unknown,
|
|
102
|
+
): value is PreviewPageLayout | undefined {
|
|
103
|
+
return value === undefined || isPreviewPageLayout(value);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Whether `value` is absent, or an object of strings, as a render's `params` and `query` are. */
|
|
107
|
+
export function isOptionalStringRecord(
|
|
108
|
+
value: Parameters<typeof isObject>[0],
|
|
109
|
+
): boolean {
|
|
110
|
+
return (
|
|
111
|
+
value === undefined ||
|
|
112
|
+
(isObject(value) &&
|
|
113
|
+
value !== null &&
|
|
114
|
+
!Array.isArray(value) &&
|
|
115
|
+
Object.values(value).every(isString))
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* What the preview draws around a page in `layout`, as the layout draws a
|
|
121
|
+
* real page: the dashboard frame of `DefaultLayout()` when there is none.
|
|
122
|
+
*/
|
|
123
|
+
export function previewFrameOf(
|
|
124
|
+
layout: PreviewPageLayout | undefined,
|
|
125
|
+
): PreviewFrame {
|
|
126
|
+
const options = layout?.options ?? {};
|
|
127
|
+
const fillHeight = options.fillHeight ?? false;
|
|
128
|
+
if (layout?.type === "empty") {
|
|
129
|
+
return {
|
|
130
|
+
dashboard: false,
|
|
131
|
+
header: false,
|
|
132
|
+
fullWidth: true,
|
|
133
|
+
settings: false,
|
|
134
|
+
fillHeight,
|
|
135
|
+
brand: !(options.hideBrand ?? false),
|
|
136
|
+
footer: !(options.hideFooter ?? false),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
const type = layout?.type ?? "default";
|
|
140
|
+
return {
|
|
141
|
+
dashboard: true,
|
|
142
|
+
header: !(options.hideHeader ?? false),
|
|
143
|
+
fullWidth: type === "default" && (options.fullWidth ?? true),
|
|
144
|
+
settings: type === "settings",
|
|
145
|
+
fillHeight,
|
|
146
|
+
brand: false,
|
|
147
|
+
footer: false,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FIXTURES_ONLY_QUERY } from "./previewFixturesOnly";
|
|
2
|
+
|
|
3
|
+
/** The query `/dms-preview` reads its first state from. */
|
|
4
|
+
export const STATE_QUERY = "state";
|
|
5
|
+
|
|
6
|
+
/** The parameters the preview reads itself, which a page's query never replaces. */
|
|
7
|
+
const PREVIEW_QUERY_KEYS: ReadonlySet<string> = new Set([
|
|
8
|
+
STATE_QUERY,
|
|
9
|
+
FIXTURES_ONLY_QUERY,
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
type QueryValue = string | null | readonly (string | null)[];
|
|
13
|
+
|
|
14
|
+
type RouteQuery = Readonly<Record<string, QueryValue | undefined>>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The query `/dms-preview` takes so its blocks read `page`, the query of the
|
|
18
|
+
* page they are drawn on, from the route as a page's blocks do: the preview's
|
|
19
|
+
* own parameters, then each of `page`'s. Undefined when `current` holds that
|
|
20
|
+
* already, so the route is replaced only when the page's query changes.
|
|
21
|
+
*/
|
|
22
|
+
export function previewRouteQuery(
|
|
23
|
+
current: RouteQuery,
|
|
24
|
+
page: Readonly<Record<string, string>> | undefined,
|
|
25
|
+
): Record<string, QueryValue> | undefined {
|
|
26
|
+
const held = new Map(
|
|
27
|
+
Object.entries(current).flatMap(([key, value]) =>
|
|
28
|
+
value === undefined ? [] : [[key, value] as const],
|
|
29
|
+
),
|
|
30
|
+
);
|
|
31
|
+
const next = new Map<string, QueryValue>();
|
|
32
|
+
for (const [key, value] of held) {
|
|
33
|
+
if (PREVIEW_QUERY_KEYS.has(key)) next.set(key, value);
|
|
34
|
+
}
|
|
35
|
+
for (const [key, value] of Object.entries(page ?? {})) {
|
|
36
|
+
if (!PREVIEW_QUERY_KEYS.has(key)) next.set(key, value);
|
|
37
|
+
}
|
|
38
|
+
const same =
|
|
39
|
+
held.size === next.size &&
|
|
40
|
+
[...next].every(([key, value]) => held.get(key) === value);
|
|
41
|
+
return same ? undefined : Object.fromEntries(next);
|
|
42
|
+
}
|
|
@@ -3,7 +3,10 @@ import { isString } from "../../../../dms-core/app/utils/type-check";
|
|
|
3
3
|
import { markRaw, type Component } from "vue";
|
|
4
4
|
import BlockPreviewIssue from "../../build/components/block-preview/BlockPreviewIssue.vue";
|
|
5
5
|
import BlockPreviewSketch from "../../build/components/block-preview/BlockPreviewSketch.vue";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
previewHeader,
|
|
8
|
+
previewPageLayout,
|
|
9
|
+
} from "../../build/composables/block-preview/previewNavigation";
|
|
7
10
|
import { useBlockPreviewEmbed } from "../../build/composables/block-preview/useBlockPreviewEmbed";
|
|
8
11
|
import {
|
|
9
12
|
collectPreviewIssues,
|
|
@@ -14,10 +17,16 @@ import {
|
|
|
14
17
|
type PreviewResolvedNode,
|
|
15
18
|
type PreviewTree,
|
|
16
19
|
} from "../../build/utils/blockPreview";
|
|
20
|
+
import { previewFrameOf } from "../../build/utils/previewPageLayout";
|
|
17
21
|
import {
|
|
18
22
|
FIXTURES_ONLY_QUERY,
|
|
19
23
|
FIXTURES_ONLY_VALUE,
|
|
20
24
|
} from "../../build/utils/previewFixturesOnly";
|
|
25
|
+
import {
|
|
26
|
+
previewRouteQuery,
|
|
27
|
+
STATE_QUERY,
|
|
28
|
+
} from "../../build/utils/previewPageQuery";
|
|
29
|
+
import { detach } from "../../build/composables/detach";
|
|
21
30
|
import { childComponentId } from "../../utils/componentId";
|
|
22
31
|
|
|
23
32
|
const { resolveError } = useApiErrorPresenter();
|
|
@@ -57,7 +66,6 @@ const props = withDefaults(
|
|
|
57
66
|
);
|
|
58
67
|
|
|
59
68
|
const BLOCK_TYPES_ENDPOINT = "/api/block-preview/types";
|
|
60
|
-
const STATE_QUERY = "state";
|
|
61
69
|
|
|
62
70
|
const { t, locale, locales, setLocale } = useI18n();
|
|
63
71
|
const route = useDmsRoute();
|
|
@@ -86,13 +94,36 @@ const embed = props.embed
|
|
|
86
94
|
|
|
87
95
|
const PAGE_HEADER_COMPONENT = "DmsPreviewPageHeader";
|
|
88
96
|
|
|
89
|
-
/**
|
|
97
|
+
/** How the page's layout frames it; the dashboard frame outside a mockup. */
|
|
98
|
+
const frame = computed(() =>
|
|
99
|
+
previewFrameOf(embed ? previewPageLayout.value : undefined),
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
/** The dashboard's page header, when a mockup's render asked the preview to draw one above the blocks and its layout has one. */
|
|
90
103
|
const headerComponent = computed(() =>
|
|
91
|
-
embed && previewHeader.value
|
|
104
|
+
embed && previewHeader.value && frame.value.header
|
|
92
105
|
? resolveDmsComponent(PAGE_HEADER_COMPONENT)
|
|
93
106
|
: undefined,
|
|
94
107
|
);
|
|
95
108
|
|
|
109
|
+
/** The padding of the dashboard's page region, and of `EmptyLayout`'s page under its logo or at the top of the window. */
|
|
110
|
+
const DASHBOARD_PADDING_CLASS = "p-4 sm:p-6";
|
|
111
|
+
const EMPTY_PADDING_CLASS = "px-3 pb-8 sm:px-5 sm:pb-10";
|
|
112
|
+
const EMPTY_TOP_PADDING_CLASS = "pt-3 sm:pt-5";
|
|
113
|
+
/** The flex column a page filling its frame is laid out in, down to its last block. */
|
|
114
|
+
const FILL_COLUMN_CLASS = "flex min-h-0 flex-1 flex-col";
|
|
115
|
+
|
|
116
|
+
const paddingClass = computed(() => {
|
|
117
|
+
if (!isPadded.value) return undefined;
|
|
118
|
+
if (frame.value.dashboard) return DASHBOARD_PADDING_CLASS;
|
|
119
|
+
return frame.value.brand
|
|
120
|
+
? EMPTY_PADDING_CLASS
|
|
121
|
+
: [EMPTY_PADDING_CLASS, EMPTY_TOP_PADDING_CLASS];
|
|
122
|
+
});
|
|
123
|
+
const fillClass = computed(() =>
|
|
124
|
+
frame.value.fillHeight ? FILL_COLUMN_CLASS : undefined,
|
|
125
|
+
);
|
|
126
|
+
|
|
96
127
|
const fetchedBlockTypes = ref<PreviewBlockTypes>();
|
|
97
128
|
const blockTypes = computed(() => props.blockTypes ?? fetchedBlockTypes.value);
|
|
98
129
|
const tree = computed(() => (embed ? embed.tree.value : props.tree));
|
|
@@ -103,6 +134,14 @@ const isPadded = computed(
|
|
|
103
134
|
() => embed?.padding.value ?? (props.embed || props.padding),
|
|
104
135
|
);
|
|
105
136
|
|
|
137
|
+
watch(
|
|
138
|
+
() => embed?.query.value,
|
|
139
|
+
(pageQuery) => {
|
|
140
|
+
const next = previewRouteQuery(route.query, pageQuery);
|
|
141
|
+
if (next) detach(useDmsRouter().replace({ query: next }));
|
|
142
|
+
},
|
|
143
|
+
);
|
|
144
|
+
|
|
106
145
|
const resolved = computed<PreviewResolvedNode[]>(() =>
|
|
107
146
|
tree.value && blockTypes.value
|
|
108
147
|
? resolvePreviewTree(tree.value, blockTypes.value)
|
|
@@ -136,6 +175,11 @@ function toPageComponent(node: PreviewResolvedNode): ResolvedComponentInfo {
|
|
|
136
175
|
|
|
137
176
|
const components = computed(() => resolved.value.map(toPageComponent));
|
|
138
177
|
|
|
178
|
+
/** The block that takes the height left, when the page fills its frame. */
|
|
179
|
+
const fillingId = computed(() =>
|
|
180
|
+
frame.value.fillHeight ? components.value.at(-1)?.id : undefined,
|
|
181
|
+
);
|
|
182
|
+
|
|
139
183
|
function describeIssue(issue: PreviewIssue): string {
|
|
140
184
|
return t(`dms.block_preview.${issue.key}`, {
|
|
141
185
|
name: issue.name,
|
|
@@ -174,7 +218,7 @@ onMounted(async () => {
|
|
|
174
218
|
data-dms-block-preview
|
|
175
219
|
:data-dms-preview-transparent="isTransparent || undefined"
|
|
176
220
|
:data-dms-inspecting="embed?.inspecting.value || undefined"
|
|
177
|
-
:class="
|
|
221
|
+
:class="[paddingClass, fillClass]"
|
|
178
222
|
>
|
|
179
223
|
<component
|
|
180
224
|
:is="headerComponent"
|
|
@@ -194,11 +238,17 @@ onMounted(async () => {
|
|
|
194
238
|
>
|
|
195
239
|
{{ t("dms.block_preview.empty") }}
|
|
196
240
|
</p>
|
|
197
|
-
<div
|
|
241
|
+
<div
|
|
242
|
+
v-else
|
|
243
|
+
:key="revision"
|
|
244
|
+
class="dms-page-stack space-y-6"
|
|
245
|
+
:class="fillClass"
|
|
246
|
+
>
|
|
198
247
|
<div
|
|
199
248
|
v-for="component in components"
|
|
200
249
|
:key="component.id"
|
|
201
250
|
class="empty:hidden"
|
|
251
|
+
:class="component.id === fillingId && FILL_COLUMN_CLASS"
|
|
202
252
|
data-dms-preview-block
|
|
203
253
|
>
|
|
204
254
|
<DmsRecursiveComponent
|
|
@@ -27,7 +27,10 @@ import {
|
|
|
27
27
|
} from "../../composables/confirm/types";
|
|
28
28
|
import { isConfirmTextMatch } from "../../build/composables/confirm/confirmTextMatch";
|
|
29
29
|
import type { ConfirmDialogField } from "#dms-core/app/types/confirm-dialog";
|
|
30
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
fieldErrorMessage,
|
|
32
|
+
resolveFieldErrors,
|
|
33
|
+
} from "#dms-core/app/composables/useFieldErrors";
|
|
31
34
|
|
|
32
35
|
interface ConfirmModalProps {
|
|
33
36
|
title: string;
|
|
@@ -267,12 +270,9 @@ function showFieldErrors(
|
|
|
267
270
|
});
|
|
268
271
|
if (resolved.fields.length === 0) return false;
|
|
269
272
|
fieldErrors.value = Object.fromEntries(
|
|
270
|
-
resolved.fields.map((
|
|
271
|
-
field,
|
|
272
|
-
|
|
273
|
-
fallbackKey: fallbackKey ?? "dms.field_errors.invalid",
|
|
274
|
-
params,
|
|
275
|
-
})?.message,
|
|
273
|
+
resolved.fields.map((entry) => [
|
|
274
|
+
entry.field,
|
|
275
|
+
fieldErrorMessage(entry, resolveError),
|
|
276
276
|
]),
|
|
277
277
|
);
|
|
278
278
|
return !resolved.hasUnmatched;
|
|
@@ -15,10 +15,7 @@ import { MiniMap } from "@vue-flow/minimap";
|
|
|
15
15
|
import type { Component } from "vue";
|
|
16
16
|
import { computed, useId, useSlots } from "vue";
|
|
17
17
|
import { isString } from "#dms-core/app/utils/type-check";
|
|
18
|
-
|
|
19
|
-
const DMS_GRID_GAP = 24;
|
|
20
|
-
const DMS_GRID_DOT_SIZE = 1.2;
|
|
21
|
-
const DMS_GRID_COLOR = "rgba(127, 140, 170, 0.25)";
|
|
18
|
+
import { DOT_GRID } from "../../build/utils/dotGrid";
|
|
22
19
|
|
|
23
20
|
const ZOOM_RESET_LEVEL = 1;
|
|
24
21
|
const ZOOM_TRANSITION_MS = 200;
|
|
@@ -105,9 +102,9 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
105
102
|
nodeTypes: undefined,
|
|
106
103
|
edgeTypes: undefined,
|
|
107
104
|
grid: "dots",
|
|
108
|
-
gridGap:
|
|
109
|
-
gridSize:
|
|
110
|
-
gridColor:
|
|
105
|
+
gridGap: DOT_GRID.gap,
|
|
106
|
+
gridSize: DOT_GRID.size,
|
|
107
|
+
gridColor: DOT_GRID.color,
|
|
111
108
|
controls: true,
|
|
112
109
|
minimap: false,
|
|
113
110
|
fitViewOnInit: true,
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useFormField } from "@nuxt/ui/composables/useFormField";
|
|
3
|
+
import { useControlError } from "../../../composables/form/useControlError";
|
|
4
|
+
import {
|
|
5
|
+
formatIdentifier,
|
|
6
|
+
type IdentifierKind,
|
|
7
|
+
identifierErrorKey,
|
|
8
|
+
readIdentifier,
|
|
9
|
+
} from "../../../build/utils/legalIdentifier";
|
|
10
|
+
|
|
11
|
+
interface InputIdentifierProps {
|
|
12
|
+
id?: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Which identifier the field holds, and so which rule it checks. */
|
|
16
|
+
identifier: IdentifierKind;
|
|
17
|
+
/** `vat_number`: the country a number typed without its code is read in. */
|
|
18
|
+
defaultCountry?: string;
|
|
19
|
+
/** `company_number`: the country whose register the number belongs to. */
|
|
20
|
+
country?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const props = defineProps<InputIdentifierProps>();
|
|
24
|
+
const model = defineModel<string | null | undefined>();
|
|
25
|
+
const { t } = useI18n();
|
|
26
|
+
const { report } = useControlError();
|
|
27
|
+
const {
|
|
28
|
+
id,
|
|
29
|
+
size,
|
|
30
|
+
color,
|
|
31
|
+
highlight,
|
|
32
|
+
disabled,
|
|
33
|
+
ariaAttrs,
|
|
34
|
+
emitFormBlur,
|
|
35
|
+
emitFormInput,
|
|
36
|
+
} = useFormField(props);
|
|
37
|
+
|
|
38
|
+
const text = ref("");
|
|
39
|
+
let emitted: string | null | undefined;
|
|
40
|
+
|
|
41
|
+
function shown(value: string | null | undefined): string {
|
|
42
|
+
return value ? formatIdentifier(value, props) : "";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
text.value = shown(model.value);
|
|
46
|
+
|
|
47
|
+
watch(model, (value) => {
|
|
48
|
+
if (value !== emitted) text.value = shown(value);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
function onInput(next: string | number | null | undefined): void {
|
|
52
|
+
text.value = String(next ?? "");
|
|
53
|
+
const read = readIdentifier(text.value, props);
|
|
54
|
+
emitted = read ?? text.value.trim();
|
|
55
|
+
model.value = emitted;
|
|
56
|
+
emitFormInput();
|
|
57
|
+
if (read !== undefined || !text.value.trim()) report(undefined);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function onBlur(): void {
|
|
61
|
+
const read = readIdentifier(text.value, props);
|
|
62
|
+
if (read !== undefined) text.value = shown(read);
|
|
63
|
+
report(
|
|
64
|
+
read === undefined && text.value.trim()
|
|
65
|
+
? t(identifierErrorKey(props.identifier))
|
|
66
|
+
: undefined,
|
|
67
|
+
);
|
|
68
|
+
emitFormBlur();
|
|
69
|
+
}
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<template>
|
|
73
|
+
<UInput
|
|
74
|
+
v-bind="ariaAttrs"
|
|
75
|
+
:id="id"
|
|
76
|
+
:model-value="text"
|
|
77
|
+
autocomplete="off"
|
|
78
|
+
spellcheck="false"
|
|
79
|
+
:placeholder="props.placeholder"
|
|
80
|
+
:size="size"
|
|
81
|
+
:color="color"
|
|
82
|
+
:highlight="highlight"
|
|
83
|
+
:disabled="disabled"
|
|
84
|
+
class="w-full"
|
|
85
|
+
:ui="{ base: 'tabular-nums uppercase' }"
|
|
86
|
+
:data-identifier="props.identifier"
|
|
87
|
+
@update:model-value="onInput"
|
|
88
|
+
@blur="onBlur"
|
|
89
|
+
/>
|
|
90
|
+
</template>
|