@antelopejs/dms 0.20.2 → 0.20.4
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 +49 -0
- package/README.md +1 -1
- package/dist/config/internal/state.d.ts +5 -3
- package/dist/config/internal/state.js +9 -1
- package/dist/config/internal/state.js.map +1 -1
- package/dist/implementations/dms-builder/engine/compose-page.js +3 -2
- package/dist/implementations/dms-builder/engine/compose-page.js.map +1 -1
- package/dist/implementations/dms-builder/engine/connection-targets.d.ts +2 -0
- package/dist/implementations/dms-builder/engine/connection-targets.js +276 -0
- package/dist/implementations/dms-builder/engine/connection-targets.js.map +1 -0
- package/dist/implementations/dms-builder/engine/dms-database.d.ts +1 -0
- package/dist/implementations/dms-builder/engine/dms-database.js +1 -0
- package/dist/implementations/dms-builder/engine/dms-database.js.map +1 -1
- package/dist/implementations/dms-builder/engine/driver-packages.js +16 -4
- package/dist/implementations/dms-builder/engine/driver-packages.js.map +1 -1
- package/dist/implementations/dms-builder/engine/index.d.ts +1 -0
- package/dist/implementations/dms-builder/engine/index.js +1 -0
- package/dist/implementations/dms-builder/engine/index.js.map +1 -1
- package/dist/implementations/dms-builder/engine/theme-scaffold.js +1 -1
- package/dist/implementations/dms-html-render/index.js +5 -2
- package/dist/implementations/dms-html-render/index.js.map +1 -1
- package/dist/mcp/page-verify/index.d.ts +1 -0
- package/dist/mcp/page-verify/index.js +1 -0
- package/dist/mcp/page-verify/index.js.map +1 -1
- package/dist/mcp/page-verify/redact-report.d.ts +2 -0
- package/dist/mcp/page-verify/redact-report.js +120 -0
- package/dist/mcp/page-verify/redact-report.js.map +1 -0
- package/dist/mcp/page-verify/render.js +4 -1
- package/dist/mcp/page-verify/render.js.map +1 -1
- package/dist/mcp/redact.d.ts +87 -0
- package/dist/mcp/redact.js +139 -0
- package/dist/mcp/redact.js.map +1 -0
- package/dist/mcp/tools/builder-compose.js +11 -2
- package/dist/mcp/tools/builder-compose.js.map +1 -1
- package/dist/mcp/tools/builder-project.js +59 -26
- package/dist/mcp/tools/builder-project.js.map +1 -1
- package/dist/mcp/tools/builder-queries.js +41 -4
- package/dist/mcp/tools/builder-queries.js.map +1 -1
- package/dist/mcp/tools/builder-shared.d.ts +3 -1
- package/dist/mcp/tools/builder-shared.js +5 -0
- package/dist/mcp/tools/builder-shared.js.map +1 -1
- package/dist/mcp/tools/database.js +3 -2
- package/dist/mcp/tools/database.js.map +1 -1
- package/dist/mcp/tools/page-verify.js +3 -2
- package/dist/mcp/tools/page-verify.js.map +1 -1
- package/frontend-vue/dms.frontend.ts +6 -2
- package/frontend-vue/eslint-globals.generated.mjs +259 -942
- package/frontend-vue/layers/dms-auth/app/build/composables/useAuthFormError.ts +5 -3
- package/frontend-vue/layers/dms-auth/app/composables/useOAuthErrorToast.ts +6 -4
- package/frontend-vue/layers/dms-auth/app/composables/usePostLoginRedirect.ts +3 -2
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/backup.vue +1 -1
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/forgot.vue +1 -1
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/login.vue +12 -4
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/recover.vue +1 -1
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/signup.vue +12 -6
- package/frontend-vue/layers/dms-auth/app/middleware/auth.ts +4 -2
- package/frontend-vue/layers/dms-auth/server/oauth.ts +13 -7
- package/frontend-vue/layers/dms-auth/server/session.ts +37 -6
- package/frontend-vue/layers/dms-core/app/build/composables/api-error.ts +46 -23
- package/frontend-vue/layers/dms-core/app/build/composables/auth/usePermissionPreview.ts +34 -23
- package/frontend-vue/layers/dms-core/app/build/composables/user/preferencesCookie.ts +8 -2
- package/frontend-vue/layers/dms-core/app/build/composables/user/tablePreferences.ts +11 -5
- package/frontend-vue/layers/dms-core/app/build/utils/crossTab.ts +4 -2
- package/frontend-vue/layers/dms-core/app/build/utils/json.ts +31 -0
- package/frontend-vue/layers/dms-core/app/build/utils/permission-preview.ts +6 -11
- package/frontend-vue/layers/dms-core/app/build/utils/record.ts +4 -0
- package/frontend-vue/layers/dms-core/app/build/utils/sharedRealtimeConnection.ts +56 -36
- package/frontend-vue/layers/dms-core/app/composables/auth/useApiData.ts +2 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +6 -1
- package/frontend-vue/layers/dms-core/app/composables/auth/useCurrentUser.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useLogout.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useMultiAccount.ts +15 -14
- package/frontend-vue/layers/dms-core/app/composables/auth/useSessionRecovery.ts +21 -8
- package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +3 -3
- package/frontend-vue/layers/dms-core/app/composables/page/useSiteLayout.ts +11 -9
- package/frontend-vue/layers/dms-core/app/composables/period/periodLink.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/period/usePeriod.ts +2 -2
- package/frontend-vue/layers/dms-core/app/composables/realtime/usePageRealtime.ts +10 -3
- package/frontend-vue/layers/dms-core/app/composables/realtime/useSseStream.ts +22 -16
- package/frontend-vue/layers/dms-core/app/composables/realtime/useUserRealtime.ts +68 -46
- package/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts +22 -11
- package/frontend-vue/layers/dms-core/app/composables/useEventedAction.ts +4 -1
- package/frontend-vue/layers/dms-core/app/composables/useFieldErrors.ts +14 -6
- package/frontend-vue/layers/dms-core/app/composables/user/usePreferences.ts +8 -3
- package/frontend-vue/layers/dms-core/app/composables/watch/useWatch.ts +17 -8
- package/frontend-vue/layers/dms-core/app/types/module-store.ts +3 -1
- package/frontend-vue/layers/dms-core/app/types/page.ts +3 -1
- package/frontend-vue/layers/dms-core/app/utils/dedupedRefresh.ts +2 -2
- package/frontend-vue/layers/dms-core/app/utils/formatter.ts +5 -5
- package/frontend-vue/layers/dms-core/app/utils/menu.ts +12 -4
- package/frontend-vue/layers/dms-core/app/utils/pageQuery.ts +7 -4
- package/frontend-vue/layers/dms-core/app/utils/row-action-rule-evaluator.ts +7 -3
- package/frontend-vue/layers/dms-core/app/utils/stringTypeParser.ts +8 -10
- package/frontend-vue/layers/dms-core/app/utils/type-check.ts +25 -12
- package/frontend-vue/layers/dms-layout/app/build/branding/BrandingColorPair.vue +5 -2
- package/frontend-vue/layers/dms-layout/app/build/branding/device-draft.ts +2 -1
- package/frontend-vue/layers/dms-layout/app/build/branding/logos.ts +11 -13
- package/frontend-vue/layers/dms-layout/app/build/branding/model.ts +6 -2
- package/frontend-vue/layers/dms-layout/app/build/branding/preview-style.ts +12 -10
- package/frontend-vue/layers/dms-layout/app/build/branding/raster.ts +7 -4
- package/frontend-vue/layers/dms-layout/app/build/branding/useBrandingEditor.ts +59 -31
- package/frontend-vue/layers/dms-layout/app/build/branding/values.ts +2 -1
- package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +1 -1
- package/frontend-vue/layers/dms-layout/app/build/components/layout/PageHeaderActionBar.vue +37 -24
- package/frontend-vue/layers/dms-layout/app/build/components/notification/NotificationPopover.vue +2 -4
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/profile/ProfileSummaryRow.vue +2 -2
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/security/SecuritySessions.vue +35 -10
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/theme/CssVariablesList.vue +2 -2
- package/frontend-vue/layers/dms-layout/app/build/composables/dev-reload/useDevReloadHolder.ts +4 -4
- package/frontend-vue/layers/dms-layout/app/build/composables/navigation/useVisitNavBadges.ts +26 -4
- package/frontend-vue/layers/dms-layout/app/build/composables/security/useSessionHandoff.ts +3 -6
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/profile/useAccountData.ts +16 -12
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/security/useSecurityFormat.ts +12 -9
- package/frontend-vue/layers/dms-layout/app/build/mockup/header-action.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/build/utils/modules-catalog.ts +13 -6
- package/frontend-vue/layers/dms-layout/app/build/utils/notificationPayload.ts +81 -0
- package/frontend-vue/layers/dms-layout/app/build/utils/submittedUrl.ts +14 -0
- package/frontend-vue/layers/dms-layout/app/components/AppWidgetsDock.vue +3 -1
- package/frontend-vue/layers/dms-layout/app/composables/general/useSystemState.ts +4 -5
- package/frontend-vue/layers/dms-layout/app/composables/layout/useServedHeaderActions.ts +7 -5
- package/frontend-vue/layers/dms-layout/app/composables/notification/useNotifications.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleHistory.ts +1 -1
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleStore.ts +3 -3
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleStoreActions.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/composables/page/useModulesListing.ts +17 -4
- package/frontend-vue/layers/dms-layout/app/composables/page/usePageComponentPreload.ts +15 -7
- package/frontend-vue/layers/dms-layout/app/composables/page/usePageRecordDeletion.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/composables/profile/useUserLanguage.ts +3 -2
- package/frontend-vue/layers/dms-layout/app/composables/useCommandPaletteSources.ts +20 -2
- package/frontend-vue/layers/dms-layout/app/custom-pages/settings/roles.vue +5 -1
- package/frontend-vue/layers/dms-layout/app/custom-pages/settings/shortcuts.vue +4 -1
- package/frontend-vue/layers/dms-layout/app/pages/[...slug].vue +13 -5
- package/frontend-vue/layers/dms-layout/app/plugins/command-palette-session.client.ts +8 -8
- package/frontend-vue/layers/dms-layout/app/plugins/dms-dev-reload.client.ts +1 -1
- package/frontend-vue/layers/dms-layout/app/plugins/dms-mcp-navigate.client.ts +4 -2
- package/frontend-vue/layers/dms-layout/app/plugins/dms-menu-sync.client.ts +3 -3
- package/frontend-vue/layers/dms-layout/app/plugins/notification-stream.client.ts +47 -40
- package/frontend-vue/layers/dms-layout/app/plugins/permission-preview.client.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/plugins/profile-sync.client.ts +3 -10
- package/frontend-vue/layers/dms-layout/app/plugins/seo.ts +2 -2
- package/frontend-vue/layers/dms-layout/app/utils/breadcrumb.ts +3 -2
- package/frontend-vue/layers/dms-layout/server/html-render.ts +5 -1
- package/frontend-vue/layers/dms-layout/server/render-token.ts +3 -2
- package/frontend-vue/layers/dms-onboarding/app/build/components/onboarding/steps/StepPlatform.vue +1 -1
- package/frontend-vue/layers/dms-onboarding/app/components/onboarding/steps/StepRegister.vue +1 -1
- package/frontend-vue/layers/dms-onboarding/app/custom-pages/onboarding.vue +2 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEditOverlay.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupIndex.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspector.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspectorField.vue +5 -2
- package/frontend-vue/layers/dms-ui/app/build/components/containers/drawer/DynamicDrawer.vue +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/containers/modal/DynamicModal.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/build/components/containers/row/RowHeader.vue +2 -1
- package/frontend-vue/layers/dms-ui/app/build/components/period/PeriodRangeCalendar.vue +10 -7
- package/frontend-vue/layers/dms-ui/app/build/components/sortable/SortableList.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/build/components/table/FiltersRow.vue +20 -18
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuColumns.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuDensity.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuFilter.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuImport.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuPage.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuRoot.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuSort.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuViewMode.vue +21 -19
- package/frontend-vue/layers/dms-ui/app/build/components/table/RowSelection.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/Table.types.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableActions.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableMenu.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TablePagination.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableRoot.vue +3 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableTabs.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableViews.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentFilters.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentPreferences.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentRows.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentTheme.ts +11 -0
- package/frontend-vue/layers/dms-ui/app/build/components/table-view/CardsDisplay.vue +35 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetActions.ts +24 -17
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetConfirmation.ts +53 -30
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetHandlers.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRequests.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRows.ts +8 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetTypes.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/rowNavigation.ts +3 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/useActionTargets.ts +9 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupEditing.ts +156 -99
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSession.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSpec.ts +194 -161
- package/frontend-vue/layers/dms-ui/app/build/composables/blocks/blockDataState.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/blocks/useGuard.ts +38 -11
- package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexRawOptions.ts +34 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexSeriesStyle.ts +32 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/chart/apexTheme.ts +13 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/confirm/useActionConfirm.ts +8 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/containers/drawerSize.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/cellHelpers.ts +23 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultChoiceTypes.ts +11 -11
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultDateCells.ts +7 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultIdentityCells.ts +22 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultMediaTypes.ts +5 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultPrimitiveTypes.ts +10 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultRelationTypes.ts +8 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/metricCells.ts +12 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/numberSuffix.ts +4 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationRows.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationValue.ts +10 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/twoLineCell.ts +21 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/useColumnValueRenderer.ts +6 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/detach.ts +9 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/files/useFileMetadata.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldComponentProps.ts +38 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldSaved.ts +6 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldValueRule.ts +19 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentCancel.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentErrors.ts +3 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentRealtime.ts +28 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formComponentValidation.ts +5 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formState.ts +15 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formValidation.ts +12 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/form/registerFormFunctions.ts +7 -8
- package/frontend-vue/layers/dms-ui/app/build/composables/form/stringSet.ts +6 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/form/useFormModel.ts +60 -16
- package/frontend-vue/layers/dms-ui/app/build/composables/form/useInstantForm.ts +5 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/instant-save/useInstantSave.ts +13 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/layout/rowSidePanel.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/live/currentPageLive.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/live/liveCadence.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/live/missedTally.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/live/pageLiveController.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/live/usePageDataRefresh.ts +3 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/navigation/useNavBadges.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/period/periodQuery.ts +42 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionDescriptors.ts +63 -46
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionSizing.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnStructure.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useRelationFilterLabels.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useTable.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useTableConfigClipboard.ts +71 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useTableStates.ts +6 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table/utils/rowId.ts +15 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/registerDefaultFunctions.ts +21 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionBulkRequests.ts +3 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionContainers.ts +1 -17
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionNavigation.ts +12 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionValues.ts +25 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewArrival.ts +8 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewCounts.ts +4 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewDisplayContext.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewDisplays.ts +18 -14
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewEvents.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewGrouping.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewListing.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewLive.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewQuickActions.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewQuickFilters.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewRealtime.ts +9 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewTabs.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useCardFields.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useExpandedRowDetails.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useGroupedRows.ts +7 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/usePersistedPagination.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useReorderHandles.ts +9 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableFooter.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableLiveHold.ts +2 -6
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTablePreferences.ts +19 -12
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRecordLink.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableReorder.ts +7 -7
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRows.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableViewRowActions.ts +6 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/bulkActions.ts +3 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/card.ts +14 -12
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/displayOptions.ts +38 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/expandedRows.ts +4 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/groupedRows.ts +12 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/reorder.ts +6 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/sortableColumns.ts +38 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableCounts.ts +8 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableQuery.ts +14 -11
- package/frontend-vue/layers/dms-ui/app/build/composables/unsaved-changes/formValue.ts +22 -12
- package/frontend-vue/layers/dms-ui/app/build/composables/unsaved-changes/registry.ts +27 -6
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/mockups/resync.ts +9 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +34 -25
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +52 -26
- package/frontend-vue/layers/dms-ui/app/build/utils/calendarDay.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/characterCount.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/dispatchQuickActionTarget.ts +16 -11
- package/frontend-vue/layers/dms-ui/app/build/utils/fieldOptionsI18n.ts +23 -21
- package/frontend-vue/layers/dms-ui/app/build/utils/json.ts +74 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/link.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCatalog.ts +59 -50
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupDrop.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupEdit.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +34 -28
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStamp.ts +11 -3
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/streamHighlight.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/urlVariables.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/components/RecursiveComponent.vue +3 -6
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +5 -4
- package/frontend-vue/layers/dms-ui/app/components/blocks/BannerBlock.vue +1 -2
- package/frontend-vue/layers/dms-ui/app/components/card/NavCard.vue +4 -1
- package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +62 -13
- package/frontend-vue/layers/dms-ui/app/components/chart/ChartBlock.vue +18 -6
- package/frontend-vue/layers/dms-ui/app/components/code-snippet/CodeSnippet.vue +9 -4
- package/frontend-vue/layers/dms-ui/app/components/confirm/ConfirmModal.vue +9 -6
- package/frontend-vue/layers/dms-ui/app/components/flow-canvas/FlowCanvas.vue +16 -18
- package/frontend-vue/layers/dms-ui/app/components/form/FormBlock.vue +4 -9
- package/frontend-vue/layers/dms-ui/app/components/form/LocalizedField.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputAddress.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputImage.vue +5 -8
- package/frontend-vue/layers/dms-ui/app/components/form/components/RichText.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/components/master-detail/MasterDetail.vue +3 -1
- package/frontend-vue/layers/dms-ui/app/components/period/usePeriodSelectorInteraction.ts +9 -7
- package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanBoard.vue +11 -6
- package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanDisplay.vue +40 -3
- package/frontend-vue/layers/dms-ui/app/composables/chart/apexDatetimeBuckets.ts +9 -5
- package/frontend-vue/layers/dms-ui/app/composables/chart/events.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/composables/chart/heatmapColors.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/chart/localizeSeries.ts +13 -2
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +27 -4
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.types.ts +3 -2
- package/frontend-vue/layers/dms-ui/app/composables/chart/useChartFetch.ts +3 -4
- package/frontend-vue/layers/dms-ui/app/composables/confirm/types.ts +5 -1
- package/frontend-vue/layers/dms-ui/app/composables/containers/openDynamicContainer.ts +6 -6
- package/frontend-vue/layers/dms-ui/app/composables/containers/types.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/containers/useDrawer.ts +8 -5
- package/frontend-vue/layers/dms-ui/app/composables/containers/useModal.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/form/types/props.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/composables/form/useForm.ts +80 -39
- package/frontend-vue/layers/dms-ui/app/composables/live/usePageLiveRefresh.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/resolveDmsComponent.ts +9 -2
- package/frontend-vue/layers/dms-ui/app/composables/tab/useTab.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/shortcuts/tableViewShiftA.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/action-target.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/column.ts +3 -1
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/display.ts +6 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/useTableViewExport.ts +6 -5
- package/frontend-vue/layers/dms-ui/app/composables/unsaved-changes/useUnsavedChanges.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/useExportJob.ts +21 -9
- package/frontend-vue/layers/dms-ui/app/utils/blockRefresh.ts +8 -2
- package/frontend-vue/layers/dms-ui/app/utils/cascader.ts +18 -8
- package/frontend-vue/layers/dms-ui/app/utils/metadataRetry.ts +1 -1
- package/frontend-vue/lazy-plugin.ts +1 -1
- package/frontend-vue/package.json +5 -4
- package/frontend-vue/scripts/check-api-error-presentation.mjs +257 -117
- package/frontend-vue/scripts/check-autoimport-boundaries.mjs +143 -27
- package/frontend-vue/scripts/check-disable-blocks.mjs +26 -4
- package/frontend-vue/scripts/check-dms-components.mjs +152 -246
- package/frontend-vue/scripts/check-invariants.mjs +100 -42
- package/frontend-vue/scripts/check-page-invariants.mjs +103 -40
- package/frontend-vue/scripts/dms-components-dependencies.mjs +106 -13
- package/frontend-vue/scripts/dms-components-script.mjs +375 -0
- package/frontend-vue/scripts/eslint-test-quality.mjs +126 -0
- package/frontend-vue/scripts/jsconfig.json +10 -0
- package/frontend-vue/scripts/probes/capture-frontend-probe.cjs +4 -2
- package/frontend-vue/scripts/probes/frontend-behavior.cjs +217 -47
- package/frontend-vue/scripts/probes/frontend-legacy.cjs +159 -8
- package/frontend-vue/scripts/probes/frontend-probe-controls.cjs +89 -10
- package/frontend-vue/scripts/prove-comment-emit.mjs +33 -4
- package/frontend-vue/scripts/prove-component-registration.mjs +110 -24
- package/frontend-vue/scripts/test-autoimport-boundaries.mjs +37 -6
- package/frontend-vue/scripts/test-dms-components.mjs +70 -5
- package/frontend-vue/server/request-body.ts +29 -5
- package/package.json +5 -3
- package/frontend-vue/eslint-test-quality.mjs +0 -62
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { isString } from "../../../../dms-core/app/utils/type-check";
|
|
2
|
+
import { type JsonWritableObject, isJsonWritableObject } from "./json";
|
|
3
|
+
|
|
1
4
|
/** An input component, with the options its field declares. */
|
|
2
|
-
import { isString, isObject } from "../../../../dms-core/app/utils/type-check";
|
|
3
5
|
interface ComponentWithOptions {
|
|
4
6
|
options?: object;
|
|
5
7
|
}
|
|
@@ -10,7 +12,6 @@ interface FieldWithOptions {
|
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
type Translate = (key: string) => string;
|
|
13
|
-
type Options = Record<string, unknown>;
|
|
14
15
|
|
|
15
16
|
const TEXT_OPTIONS = [
|
|
16
17
|
"placeholder",
|
|
@@ -24,19 +25,15 @@ const TEXT_OPTIONS = [
|
|
|
24
25
|
const LIST_OPTIONS = ["items", "columns"] as const;
|
|
25
26
|
const ENTRY_TEXTS = ["label", "description"] as const;
|
|
26
27
|
|
|
27
|
-
const isText = (value: unknown): value is string => isString(value);
|
|
28
|
-
|
|
29
|
-
const isOptions = (value: unknown): value is Options =>
|
|
30
|
-
isObject(value) && value !== null && !Array.isArray(value);
|
|
31
|
-
|
|
32
28
|
function translateTexts(
|
|
33
|
-
source:
|
|
29
|
+
source: JsonWritableObject,
|
|
34
30
|
keys: readonly string[],
|
|
35
31
|
processI18n: Translate,
|
|
36
|
-
) {
|
|
32
|
+
): JsonWritableObject {
|
|
37
33
|
const translated = { ...source };
|
|
38
34
|
for (const key of keys) {
|
|
39
|
-
|
|
35
|
+
const text = Object.hasOwn(source, key) ? source[key] : undefined;
|
|
36
|
+
if (isString(text)) translated[key] = processI18n(text);
|
|
40
37
|
}
|
|
41
38
|
return translated;
|
|
42
39
|
}
|
|
@@ -46,8 +43,11 @@ function translateTexts(
|
|
|
46
43
|
* editor's value) has the options of that field's component translated too,
|
|
47
44
|
* so a select inside a repeater shows its options in the reader's language.
|
|
48
45
|
*/
|
|
49
|
-
function translateNestedField(
|
|
50
|
-
|
|
46
|
+
function translateNestedField(
|
|
47
|
+
entry: JsonWritableObject,
|
|
48
|
+
processI18n: Translate,
|
|
49
|
+
): JsonWritableObject {
|
|
50
|
+
if (!isJsonWritableObject(entry.component)) return entry;
|
|
51
51
|
return {
|
|
52
52
|
...entry,
|
|
53
53
|
component: translateComponent(entry.component, processI18n),
|
|
@@ -58,21 +58,23 @@ function translateComponent<C extends ComponentWithOptions>(
|
|
|
58
58
|
component: C,
|
|
59
59
|
processI18n: Translate,
|
|
60
60
|
): C {
|
|
61
|
-
const opts = component.options
|
|
62
|
-
if (!opts) return component;
|
|
61
|
+
const opts = component.options;
|
|
62
|
+
if (!isJsonWritableObject(opts)) return component;
|
|
63
63
|
|
|
64
64
|
const options = translateTexts(opts, TEXT_OPTIONS, processI18n);
|
|
65
65
|
for (const key of LIST_OPTIONS) {
|
|
66
|
-
const list = opts[key];
|
|
66
|
+
const list = Object.hasOwn(opts, key) ? opts[key] : undefined;
|
|
67
67
|
if (!Array.isArray(list)) continue;
|
|
68
|
-
options[key] = list.map((entry
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
options[key] = list.map((entry) =>
|
|
69
|
+
isJsonWritableObject(entry)
|
|
70
|
+
? translateNestedField(
|
|
71
|
+
translateTexts(entry, ENTRY_TEXTS, processI18n),
|
|
72
|
+
processI18n,
|
|
73
|
+
)
|
|
74
|
+
: entry,
|
|
73
75
|
);
|
|
74
76
|
}
|
|
75
|
-
if (
|
|
77
|
+
if (isJsonWritableObject(opts.value)) {
|
|
76
78
|
options.value = translateNestedField(opts.value, processI18n);
|
|
77
79
|
}
|
|
78
80
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
JsonPrimitive,
|
|
3
|
+
JsonValue,
|
|
4
|
+
} from "../../../../dms-core/app/types/json";
|
|
5
|
+
|
|
6
|
+
/** A JSON object, as a parsed response or a `spec.json` holds one. */
|
|
7
|
+
export type JsonObject = { [key: string]: JsonValue };
|
|
8
|
+
|
|
9
|
+
/** Whether `value` and every value it holds is JSON, walked without recursion so that no nesting depth `JSON.parse` accepts exhausts the stack. */
|
|
10
|
+
export function isJsonValue(value: unknown): value is JsonValue {
|
|
11
|
+
const pending: unknown[] = [value];
|
|
12
|
+
while (pending.length > 0) {
|
|
13
|
+
const next = pending.pop();
|
|
14
|
+
if (next === null || ["string", "number", "boolean"].includes(typeof next))
|
|
15
|
+
continue;
|
|
16
|
+
if (typeof next !== "object") return false;
|
|
17
|
+
for (const held of Array.isArray(next) ? next : Object.values(next))
|
|
18
|
+
pending.push(held);
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Whether `value` is a JSON object: not `null`, not a list, and JSON all the way down. */
|
|
24
|
+
export function isJsonObject(value: unknown): value is JsonObject {
|
|
25
|
+
return (
|
|
26
|
+
typeof value === "object" &&
|
|
27
|
+
value !== null &&
|
|
28
|
+
!Array.isArray(value) &&
|
|
29
|
+
isJsonValue(value)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Whether a value already known to be JSON is an object: not `null`, not a list. */
|
|
34
|
+
export function isObjectValue(
|
|
35
|
+
value: JsonValue | undefined,
|
|
36
|
+
): value is JsonObject {
|
|
37
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A JSON object as code writes one: a field set to `undefined` is absent, as `JSON.stringify` leaves it out. */
|
|
41
|
+
export type JsonWritableObject = { [key: string]: JsonWritable | undefined };
|
|
42
|
+
|
|
43
|
+
/** A value `JSON.stringify` writes as the same JSON: JSON whose objects may hold `undefined` fields. */
|
|
44
|
+
export type JsonWritable = JsonPrimitive | JsonWritable[] | JsonWritableObject;
|
|
45
|
+
|
|
46
|
+
/** Whether `value` is {@link JsonWritable} all the way down, walked without recursion like {@link isJsonValue}. */
|
|
47
|
+
export function isJsonWritable(value: unknown): value is JsonWritable {
|
|
48
|
+
const pending: unknown[] = [value];
|
|
49
|
+
while (pending.length > 0) {
|
|
50
|
+
const next = pending.pop();
|
|
51
|
+
if (next === null || ["string", "number", "boolean"].includes(typeof next))
|
|
52
|
+
continue;
|
|
53
|
+
if (typeof next !== "object") return false;
|
|
54
|
+
const held = Array.isArray(next)
|
|
55
|
+
? next
|
|
56
|
+
: Object.values(next).filter((field) => field !== undefined);
|
|
57
|
+
for (const entry of held) pending.push(entry);
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Whether a value already known to be {@link JsonWritable} is an object: not `null`, not a list. */
|
|
63
|
+
export function isWritableObject(
|
|
64
|
+
value: JsonWritable | undefined,
|
|
65
|
+
): value is JsonWritableObject {
|
|
66
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Whether `value` is a {@link JsonWritableObject}: not `null`, not a list, and {@link JsonWritable} all the way down. */
|
|
70
|
+
export function isJsonWritableObject(
|
|
71
|
+
value: unknown,
|
|
72
|
+
): value is JsonWritableObject {
|
|
73
|
+
return isJsonWritable(value) && isWritableObject(value);
|
|
74
|
+
}
|
|
@@ -51,10 +51,10 @@ export function buttonLinkProps(declared: string | undefined) {
|
|
|
51
51
|
to,
|
|
52
52
|
external: true,
|
|
53
53
|
noRel: true,
|
|
54
|
-
onClick: (event: MouseEvent) => {
|
|
54
|
+
onClick: async (event: MouseEvent) => {
|
|
55
55
|
if (!isPlainClick(event)) return;
|
|
56
56
|
event.preventDefault();
|
|
57
|
-
|
|
57
|
+
await navigateDms(pathOnThisSite(to));
|
|
58
58
|
},
|
|
59
59
|
};
|
|
60
60
|
}
|
|
@@ -172,9 +172,9 @@ export function isMockupWidth(value: string | undefined): value is MockupWidth {
|
|
|
172
172
|
|
|
173
173
|
/** The first value of a query parameter, `undefined` when it is absent or empty. */
|
|
174
174
|
export function readQueryValue(
|
|
175
|
-
value:
|
|
175
|
+
value: string | null | undefined | readonly (string | null)[],
|
|
176
176
|
): string | undefined {
|
|
177
|
-
const first =
|
|
177
|
+
const first = isString(value) ? value : value?.[0];
|
|
178
178
|
return isString(first) && first !== "" ? first : undefined;
|
|
179
179
|
}
|
|
180
180
|
|
|
@@ -311,7 +311,7 @@ function isBuiltPage(
|
|
|
311
311
|
|
|
312
312
|
function isSummaryBase(
|
|
313
313
|
value: Parameters<typeof isObject>[0],
|
|
314
|
-
): value is
|
|
314
|
+
): value is MockupSummaryBase {
|
|
315
315
|
return (
|
|
316
316
|
isRecord(value) &&
|
|
317
317
|
isString(value.name) &&
|
|
@@ -326,7 +326,7 @@ function isSummaryBase(
|
|
|
326
326
|
function isSummary(
|
|
327
327
|
value: Parameters<typeof isObject>[0],
|
|
328
328
|
): value is MockupSummary {
|
|
329
|
-
if (!isSummaryBase(value)) return false;
|
|
329
|
+
if (!isRecord(value) || !isSummaryBase(value)) return false;
|
|
330
330
|
if (value.status === "draft") return true;
|
|
331
331
|
return (
|
|
332
332
|
value.status === "built" &&
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { JsonValue } from "../../../../dms-core/app/types/json";
|
|
1
2
|
import {
|
|
2
3
|
isBoolean,
|
|
3
4
|
isNumber,
|
|
4
|
-
isObject,
|
|
5
5
|
isString,
|
|
6
6
|
} from "../../../../dms-core/app/utils/type-check";
|
|
7
|
+
import { isJsonObject, isObjectValue, type JsonObject } from "./json";
|
|
7
8
|
import type { MockupSpecNode } from "./mockupSpec";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -24,7 +25,7 @@ export interface MockupOptionUi {
|
|
|
24
25
|
max?: number;
|
|
25
26
|
step?: number;
|
|
26
27
|
valueLabels?: Record<string, string>;
|
|
27
|
-
initial?:
|
|
28
|
+
initial?: JsonValue;
|
|
28
29
|
blockTypes?: string[];
|
|
29
30
|
}
|
|
30
31
|
|
|
@@ -32,7 +33,7 @@ export interface MockupOptionUi {
|
|
|
32
33
|
export interface MockupOptionSchema {
|
|
33
34
|
type: string;
|
|
34
35
|
optional?: boolean;
|
|
35
|
-
default?:
|
|
36
|
+
default?: JsonValue;
|
|
36
37
|
enum?: Array<string | number | boolean>;
|
|
37
38
|
ui?: MockupOptionUi;
|
|
38
39
|
}
|
|
@@ -41,7 +42,7 @@ export interface MockupOptionSchema {
|
|
|
41
42
|
export interface MockupInitialChild {
|
|
42
43
|
id: string;
|
|
43
44
|
type: string;
|
|
44
|
-
options:
|
|
45
|
+
options: JsonObject;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
/** One registered block type (`BlockTypeDescriptor`). */
|
|
@@ -52,7 +53,7 @@ export interface MockupBlockType {
|
|
|
52
53
|
container?: boolean;
|
|
53
54
|
allowedChildren?: string[];
|
|
54
55
|
config: Record<string, MockupOptionSchema>;
|
|
55
|
-
defaults:
|
|
56
|
+
defaults: JsonObject;
|
|
56
57
|
initialChildren?: MockupInitialChild[];
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -73,27 +74,23 @@ export interface MockupCatalogSection {
|
|
|
73
74
|
blocks: MockupBlockType[];
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
function
|
|
77
|
-
return isObject(value) && value !== null && !Array.isArray(value);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function isStringList(value: unknown): value is string[] {
|
|
77
|
+
function isStringList(value: JsonValue): value is string[] {
|
|
81
78
|
return Array.isArray(value) && value.every(isString);
|
|
82
79
|
}
|
|
83
80
|
|
|
84
|
-
function isOptionalOf(
|
|
85
|
-
value:
|
|
86
|
-
guard: (entry:
|
|
87
|
-
):
|
|
81
|
+
function isOptionalOf<Value extends JsonValue>(
|
|
82
|
+
value: JsonValue | undefined,
|
|
83
|
+
guard: (entry: JsonValue) => entry is Value,
|
|
84
|
+
): value is Value | undefined {
|
|
88
85
|
return value === undefined || guard(value);
|
|
89
86
|
}
|
|
90
87
|
|
|
91
|
-
function isLabels(value:
|
|
92
|
-
return
|
|
88
|
+
function isLabels(value: JsonValue): value is Record<string, string> {
|
|
89
|
+
return isObjectValue(value) && Object.values(value).every(isString);
|
|
93
90
|
}
|
|
94
91
|
|
|
95
|
-
function isOptionUi(value:
|
|
96
|
-
if (!
|
|
92
|
+
function isOptionUi(value: JsonValue): value is JsonObject & MockupOptionUi {
|
|
93
|
+
if (!isObjectValue(value)) return false;
|
|
97
94
|
const strings = ["label", "widget", "group", "placeholder"];
|
|
98
95
|
const numbers = ["order", "min", "max", "step"];
|
|
99
96
|
return (
|
|
@@ -106,35 +103,50 @@ function isOptionUi(value: unknown): value is MockupOptionUi {
|
|
|
106
103
|
);
|
|
107
104
|
}
|
|
108
105
|
|
|
109
|
-
function isEnumValue(value:
|
|
106
|
+
function isEnumValue(value: JsonValue): value is string | number | boolean {
|
|
110
107
|
return isString(value) || isNumber(value) || isBoolean(value);
|
|
111
108
|
}
|
|
112
109
|
|
|
113
|
-
function
|
|
110
|
+
function isEnumList(
|
|
111
|
+
value: JsonValue,
|
|
112
|
+
): value is Array<string | number | boolean> {
|
|
113
|
+
return Array.isArray(value) && value.every(isEnumValue);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function isOptionSchema(
|
|
117
|
+
value: JsonValue,
|
|
118
|
+
): value is JsonObject & MockupOptionSchema {
|
|
114
119
|
return (
|
|
115
|
-
|
|
120
|
+
isObjectValue(value) &&
|
|
116
121
|
isString(value.type) &&
|
|
117
122
|
isOptionalOf(value.optional, isBoolean) &&
|
|
118
|
-
isOptionalOf(
|
|
119
|
-
value.enum,
|
|
120
|
-
(entry) => Array.isArray(entry) && entry.every(isEnumValue),
|
|
121
|
-
) &&
|
|
123
|
+
isOptionalOf(value.enum, isEnumList) &&
|
|
122
124
|
isOptionalOf(value.ui, isOptionUi)
|
|
123
125
|
);
|
|
124
126
|
}
|
|
125
127
|
|
|
126
|
-
function isInitialChild(
|
|
128
|
+
function isInitialChild(
|
|
129
|
+
value: JsonValue,
|
|
130
|
+
): value is JsonObject & MockupInitialChild {
|
|
127
131
|
return (
|
|
128
|
-
|
|
132
|
+
isObjectValue(value) &&
|
|
129
133
|
isString(value.id) &&
|
|
130
134
|
isString(value.type) &&
|
|
131
|
-
|
|
135
|
+
isObjectValue(value.options)
|
|
132
136
|
);
|
|
133
137
|
}
|
|
134
138
|
|
|
135
|
-
function
|
|
139
|
+
function isInitialChildList(
|
|
140
|
+
value: JsonValue,
|
|
141
|
+
): value is Array<JsonObject & MockupInitialChild> {
|
|
142
|
+
return Array.isArray(value) && value.every(isInitialChild);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function isMeta(
|
|
146
|
+
value: JsonValue,
|
|
147
|
+
): value is JsonObject & MockupBlockType["meta"] {
|
|
136
148
|
return (
|
|
137
|
-
|
|
149
|
+
isObjectValue(value) &&
|
|
138
150
|
isString(value.name) &&
|
|
139
151
|
isOptionalOf(value.icon, isString) &&
|
|
140
152
|
isOptionalOf(value.description, isString) &&
|
|
@@ -142,29 +154,26 @@ function isMeta(value: unknown): value is MockupBlockType["meta"] {
|
|
|
142
154
|
);
|
|
143
155
|
}
|
|
144
156
|
|
|
145
|
-
function isBlockType(value:
|
|
157
|
+
function isBlockType(value: JsonValue): value is JsonObject & MockupBlockType {
|
|
146
158
|
return (
|
|
147
|
-
|
|
159
|
+
isObjectValue(value) &&
|
|
148
160
|
isString(value.type) &&
|
|
149
161
|
isString(value.componentName) &&
|
|
150
162
|
isMeta(value.meta) &&
|
|
151
163
|
isOptionalOf(value.container, isBoolean) &&
|
|
152
164
|
isOptionalOf(value.allowedChildren, isStringList) &&
|
|
153
|
-
|
|
165
|
+
isObjectValue(value.config) &&
|
|
154
166
|
Object.values(value.config).every(isOptionSchema) &&
|
|
155
|
-
|
|
156
|
-
isOptionalOf(
|
|
157
|
-
value.initialChildren,
|
|
158
|
-
(entry) => Array.isArray(entry) && entry.every(isInitialChild),
|
|
159
|
-
)
|
|
167
|
+
isObjectValue(value.defaults) &&
|
|
168
|
+
isOptionalOf(value.initialChildren, isInitialChildList)
|
|
160
169
|
);
|
|
161
170
|
}
|
|
162
171
|
|
|
163
|
-
/** The block types of a catalog answer, those it describes wrongly left out. */
|
|
172
|
+
/** The block types of a catalog answer, those it describes wrongly left out; none when the answer is not a JSON object with a `blocks` list. */
|
|
164
173
|
export function parseBlockCatalog(
|
|
165
174
|
value: unknown,
|
|
166
175
|
): MockupBlockType[] | undefined {
|
|
167
|
-
if (!
|
|
176
|
+
if (!isJsonObject(value) || !Array.isArray(value.blocks)) return undefined;
|
|
168
177
|
return value.blocks.filter(isBlockType);
|
|
169
178
|
}
|
|
170
179
|
|
|
@@ -218,7 +227,7 @@ function placeholderFor(
|
|
|
218
227
|
key: string,
|
|
219
228
|
option: MockupOptionSchema,
|
|
220
229
|
block: MockupBlockType,
|
|
221
|
-
):
|
|
230
|
+
): JsonValue | undefined {
|
|
222
231
|
const [first] = option.enum ?? [];
|
|
223
232
|
if (first !== undefined) return first;
|
|
224
233
|
switch (option.type) {
|
|
@@ -240,8 +249,8 @@ function placeholderFor(
|
|
|
240
249
|
}
|
|
241
250
|
}
|
|
242
251
|
|
|
243
|
-
function startingOptions(block: MockupBlockType):
|
|
244
|
-
const options:
|
|
252
|
+
function startingOptions(block: MockupBlockType): JsonObject {
|
|
253
|
+
const options: JsonObject = { ...block.defaults };
|
|
245
254
|
for (const [key, option] of Object.entries(block.config)) {
|
|
246
255
|
if (option.ui?.initial !== undefined) options[key] = option.ui.initial;
|
|
247
256
|
const isMissing = !option.optional && !Object.hasOwn(options, key);
|
|
@@ -258,8 +267,8 @@ const MAX_NEW_BLOCK_DEPTH = 3;
|
|
|
258
267
|
interface StarterScope {
|
|
259
268
|
catalog: ReadonlyMap<string, MockupBlockType>;
|
|
260
269
|
/** The page's fixtures, new ones included. */
|
|
261
|
-
fixtures:
|
|
262
|
-
added:
|
|
270
|
+
fixtures: JsonObject;
|
|
271
|
+
added: JsonObject;
|
|
263
272
|
}
|
|
264
273
|
|
|
265
274
|
const SAMPLE_ROWS = [
|
|
@@ -286,7 +295,7 @@ function formField(id: string, label: string, component: string) {
|
|
|
286
295
|
*/
|
|
287
296
|
const CONTROLLER_STARTERS = new Map<
|
|
288
297
|
string,
|
|
289
|
-
{ sample:
|
|
298
|
+
{ sample: JsonValue; options: (reference: string) => JsonObject }
|
|
290
299
|
>([
|
|
291
300
|
[
|
|
292
301
|
"TableView",
|
|
@@ -323,7 +332,7 @@ const CONTROLLER_STARTERS = new Map<
|
|
|
323
332
|
* The options a new block starts with beyond its defaults, for a block that
|
|
324
333
|
* draws nothing without them: a form with no fields shows an empty card.
|
|
325
334
|
*/
|
|
326
|
-
const STARTER_OPTIONS = new Map<string,
|
|
335
|
+
const STARTER_OPTIONS = new Map<string, JsonObject>([
|
|
327
336
|
[
|
|
328
337
|
"Form",
|
|
329
338
|
{
|
|
@@ -341,7 +350,7 @@ const STARTER_OPTIONS = new Map<string, Record<string, unknown>>([
|
|
|
341
350
|
]);
|
|
342
351
|
|
|
343
352
|
/** `wanted`, or the first `<wanted>-<n>` the page has no fixture under. */
|
|
344
|
-
function freshKey(fixtures:
|
|
353
|
+
function freshKey(fixtures: JsonObject, wanted: string): string {
|
|
345
354
|
let key = wanted;
|
|
346
355
|
for (let suffix = 2; Object.hasOwn(fixtures, key); suffix += 1) {
|
|
347
356
|
key = `${wanted}-${suffix}`;
|
|
@@ -411,7 +420,7 @@ function startingBlock(
|
|
|
411
420
|
/** A block placed from the catalog: its node and the page fixtures it adds. */
|
|
412
421
|
export interface MockupNewBlock {
|
|
413
422
|
node: MockupSpecNode;
|
|
414
|
-
fixtures:
|
|
423
|
+
fixtures: JsonObject;
|
|
415
424
|
}
|
|
416
425
|
|
|
417
426
|
/**
|
|
@@ -425,7 +434,7 @@ export interface MockupNewBlock {
|
|
|
425
434
|
export function newBlock(
|
|
426
435
|
block: MockupBlockType,
|
|
427
436
|
catalog: ReadonlyMap<string, MockupBlockType>,
|
|
428
|
-
pageFixtures:
|
|
437
|
+
pageFixtures: JsonObject = {},
|
|
429
438
|
): MockupNewBlock {
|
|
430
439
|
const scope: StarterScope = {
|
|
431
440
|
catalog,
|
|
@@ -244,7 +244,7 @@ export function insertionAfter(
|
|
|
244
244
|
selection: string | undefined,
|
|
245
245
|
type: string,
|
|
246
246
|
catalog: ReadonlyMap<string, MockupBlockType>,
|
|
247
|
-
):
|
|
247
|
+
): Pick<MockupDropTarget, "parent" | "index"> {
|
|
248
248
|
const context = { spec, page, blocks: [], paths: {}, catalog };
|
|
249
249
|
let current = selection;
|
|
250
250
|
while (current !== undefined) {
|
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
type MockupSpecNode,
|
|
15
15
|
type MockupSpecPage,
|
|
16
16
|
} from "./mockupSpec";
|
|
17
|
+
import type { JsonValue } from "../../../../dms-core/app/types/json";
|
|
18
|
+
import type { JsonObject } from "./json";
|
|
17
19
|
|
|
18
20
|
/** One change the `/mockup` editor makes to a spec. */
|
|
19
21
|
export type MockupEdit =
|
|
@@ -22,7 +24,7 @@ export type MockupEdit =
|
|
|
22
24
|
pointer: string;
|
|
23
25
|
key: string;
|
|
24
26
|
/** Undefined removes the option. */
|
|
25
|
-
value:
|
|
27
|
+
value: JsonValue | undefined;
|
|
26
28
|
}
|
|
27
29
|
| {
|
|
28
30
|
kind: "insertNode";
|
|
@@ -33,7 +35,7 @@ export type MockupEdit =
|
|
|
33
35
|
index: number;
|
|
34
36
|
node: MockupSpecNode;
|
|
35
37
|
/** Fixtures the node reads, added to the page by the same edit. */
|
|
36
|
-
fixtures?:
|
|
38
|
+
fixtures?: JsonObject;
|
|
37
39
|
}
|
|
38
40
|
| {
|
|
39
41
|
kind: "moveNode";
|
|
@@ -50,7 +52,7 @@ export type MockupEdit =
|
|
|
50
52
|
pointer: string;
|
|
51
53
|
node: MockupSpecNode;
|
|
52
54
|
/** Fixtures the node reads, added to its page by the same edit. */
|
|
53
|
-
fixtures?:
|
|
55
|
+
fixtures?: JsonObject;
|
|
54
56
|
}
|
|
55
57
|
| { kind: "addPage"; title: string }
|
|
56
58
|
| { kind: "updatePage"; page: string; title?: string; id?: string }
|
|
@@ -141,11 +143,11 @@ function withFreeId(
|
|
|
141
143
|
function withOption(
|
|
142
144
|
node: MockupSpecNode,
|
|
143
145
|
key: string,
|
|
144
|
-
value:
|
|
146
|
+
value: JsonValue | undefined,
|
|
145
147
|
): MockupSpecNode {
|
|
146
148
|
const current = node.options ?? {};
|
|
147
149
|
const entries = Object.entries(current).flatMap(
|
|
148
|
-
([name, entry]): Array<[string,
|
|
150
|
+
([name, entry]): Array<[string, JsonValue]> => {
|
|
149
151
|
if (name !== key) return [[name, entry]];
|
|
150
152
|
return value === undefined ? [] : [[name, value]];
|
|
151
153
|
},
|
|
@@ -232,7 +234,7 @@ function insertNode(
|
|
|
232
234
|
function withFixtures(
|
|
233
235
|
spec: MockupSpecDocument,
|
|
234
236
|
page: number,
|
|
235
|
-
added:
|
|
237
|
+
added: JsonObject | undefined,
|
|
236
238
|
): MockupSpecDocument {
|
|
237
239
|
if (!added || !Object.keys(added).length) return spec;
|
|
238
240
|
return {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { JsonValue } from "../../../../dms-core/app/types/json";
|
|
2
|
+
import { isNumber, isString } from "../../../../dms-core/app/utils/type-check";
|
|
1
3
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
isJsonObject,
|
|
5
|
+
isJsonValue,
|
|
6
|
+
isObjectValue,
|
|
7
|
+
type JsonObject,
|
|
8
|
+
} from "./json";
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* `mockups/<name>/spec.json` as the editor reads and writes it: the spec as
|
|
@@ -14,12 +17,12 @@ import {
|
|
|
14
17
|
export interface MockupSpecNode {
|
|
15
18
|
type?: string;
|
|
16
19
|
componentName?: string;
|
|
17
|
-
options?:
|
|
20
|
+
options?: JsonObject;
|
|
18
21
|
children?: MockupSpecNode[];
|
|
19
22
|
id?: string;
|
|
20
23
|
slot?: string;
|
|
21
24
|
colSpan?: number;
|
|
22
|
-
[field: string]:
|
|
25
|
+
[field: string]: JsonValue | MockupSpecNode[] | undefined;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
/** One page of a spec, as written. */
|
|
@@ -27,13 +30,13 @@ export interface MockupSpecPage {
|
|
|
27
30
|
id: string;
|
|
28
31
|
title: string;
|
|
29
32
|
tree: MockupSpecNode[];
|
|
30
|
-
[field: string]:
|
|
33
|
+
[field: string]: JsonValue | MockupSpecNode[];
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
/** The whole spec, as written. */
|
|
34
37
|
export interface MockupSpecDocument {
|
|
35
38
|
pages: MockupSpecPage[];
|
|
36
|
-
[field: string]:
|
|
39
|
+
[field: string]: JsonValue | MockupSpecPage[];
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
/** Where a node sits: its page's index, then its index at each level down. */
|
|
@@ -62,52 +65,55 @@ export function authoredId(node: MockupSpecNode): string | undefined {
|
|
|
62
65
|
: node.id;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
function
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
function isOptional<Value>(
|
|
70
|
-
value: unknown,
|
|
71
|
-
guard: (entry: unknown) => entry is Value,
|
|
72
|
-
): boolean {
|
|
68
|
+
function isOptional<Value extends JsonValue>(
|
|
69
|
+
value: JsonValue | undefined,
|
|
70
|
+
guard: (entry: JsonValue) => entry is Value,
|
|
71
|
+
): value is Value | undefined {
|
|
73
72
|
return value === undefined || guard(value);
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
/** The fixtures a page holds, keyed as written; none when it holds no object of them. */
|
|
77
|
-
export function pageFixtures(page: MockupSpecPage):
|
|
78
|
-
|
|
76
|
+
export function pageFixtures(page: MockupSpecPage): JsonObject {
|
|
77
|
+
const { fixtures } = page;
|
|
78
|
+
return !Array.isArray(fixtures) && isObjectValue(fixtures) ? fixtures : {};
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (!isRecord(value)) return false;
|
|
81
|
+
function isWrittenNode(value: JsonValue): value is JsonObject & MockupSpecNode {
|
|
82
|
+
if (!isObjectValue(value)) return false;
|
|
84
83
|
return (
|
|
85
84
|
isOptional(value.type, isString) &&
|
|
86
85
|
isOptional(value.componentName, isString) &&
|
|
87
|
-
isOptional(value.options,
|
|
86
|
+
isOptional(value.options, isObjectValue) &&
|
|
88
87
|
isOptional(value.id, isString) &&
|
|
89
88
|
isOptional(value.slot, isString) &&
|
|
90
89
|
isOptional(value.colSpan, isNumber) &&
|
|
91
90
|
(value.children === undefined ||
|
|
92
|
-
(Array.isArray(value.children) && value.children.every(
|
|
91
|
+
(Array.isArray(value.children) && value.children.every(isWrittenNode)))
|
|
93
92
|
);
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
/** Whether `value` is JSON, and a node whose known fields have their types, at every depth. */
|
|
96
|
+
export function isMockupSpecNode(value: unknown): value is MockupSpecNode {
|
|
97
|
+
return isJsonValue(value) && isWrittenNode(value);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function isMockupSpecPage(
|
|
101
|
+
value: JsonValue,
|
|
102
|
+
): value is JsonObject & MockupSpecPage {
|
|
97
103
|
return (
|
|
98
|
-
|
|
104
|
+
isObjectValue(value) &&
|
|
99
105
|
isString(value.id) &&
|
|
100
106
|
isString(value.title) &&
|
|
101
107
|
Array.isArray(value.tree) &&
|
|
102
|
-
value.tree.every(
|
|
108
|
+
value.tree.every(isWrittenNode)
|
|
103
109
|
);
|
|
104
110
|
}
|
|
105
111
|
|
|
106
|
-
/** The spec `value` holds, or undefined when it is not
|
|
112
|
+
/** The spec `value` holds, or undefined when it is not JSON or not a spec the editor can change. */
|
|
107
113
|
export function parseMockupSpec(
|
|
108
114
|
value: unknown,
|
|
109
115
|
): MockupSpecDocument | undefined {
|
|
110
|
-
if (!
|
|
116
|
+
if (!isJsonObject(value)) return undefined;
|
|
111
117
|
const { pages } = value;
|
|
112
118
|
if (!Array.isArray(pages) || !pages.every(isMockupSpecPage)) {
|
|
113
119
|
return undefined;
|