@antelopejs/dms 0.20.3 → 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.
Files changed (180) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/implementations/dms-builder/engine/compose-page.js +3 -2
  3. package/dist/implementations/dms-builder/engine/compose-page.js.map +1 -1
  4. package/dist/mcp/page-verify/index.d.ts +1 -0
  5. package/dist/mcp/page-verify/index.js +1 -0
  6. package/dist/mcp/page-verify/index.js.map +1 -1
  7. package/dist/mcp/page-verify/redact-report.d.ts +2 -0
  8. package/dist/mcp/page-verify/redact-report.js +120 -0
  9. package/dist/mcp/page-verify/redact-report.js.map +1 -0
  10. package/dist/mcp/page-verify/render.js +4 -1
  11. package/dist/mcp/page-verify/render.js.map +1 -1
  12. package/dist/mcp/redact.d.ts +87 -0
  13. package/dist/mcp/redact.js +139 -0
  14. package/dist/mcp/redact.js.map +1 -0
  15. package/dist/mcp/tools/builder-compose.js +11 -2
  16. package/dist/mcp/tools/builder-compose.js.map +1 -1
  17. package/dist/mcp/tools/builder-project.js +56 -23
  18. package/dist/mcp/tools/builder-project.js.map +1 -1
  19. package/dist/mcp/tools/builder-queries.js +41 -4
  20. package/dist/mcp/tools/builder-queries.js.map +1 -1
  21. package/dist/mcp/tools/builder-shared.d.ts +3 -1
  22. package/dist/mcp/tools/builder-shared.js +5 -0
  23. package/dist/mcp/tools/builder-shared.js.map +1 -1
  24. package/dist/mcp/tools/database.js +3 -2
  25. package/dist/mcp/tools/database.js.map +1 -1
  26. package/dist/mcp/tools/page-verify.js +3 -2
  27. package/dist/mcp/tools/page-verify.js.map +1 -1
  28. package/frontend-vue/eslint-globals.generated.mjs +259 -942
  29. package/frontend-vue/layers/dms-core/app/build/composables/api-error.ts +46 -23
  30. package/frontend-vue/layers/dms-core/app/build/composables/auth/usePermissionPreview.ts +34 -23
  31. package/frontend-vue/layers/dms-core/app/build/composables/user/preferencesCookie.ts +8 -2
  32. package/frontend-vue/layers/dms-core/app/build/composables/user/tablePreferences.ts +11 -5
  33. package/frontend-vue/layers/dms-core/app/build/utils/crossTab.ts +4 -2
  34. package/frontend-vue/layers/dms-core/app/build/utils/json.ts +31 -0
  35. package/frontend-vue/layers/dms-core/app/build/utils/permission-preview.ts +6 -11
  36. package/frontend-vue/layers/dms-core/app/build/utils/record.ts +4 -0
  37. package/frontend-vue/layers/dms-core/app/build/utils/sharedRealtimeConnection.ts +56 -36
  38. package/frontend-vue/layers/dms-core/app/composables/auth/useApiData.ts +2 -2
  39. package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +6 -1
  40. package/frontend-vue/layers/dms-core/app/composables/auth/useCurrentUser.ts +3 -2
  41. package/frontend-vue/layers/dms-core/app/composables/auth/useLogout.ts +3 -2
  42. package/frontend-vue/layers/dms-core/app/composables/auth/useMultiAccount.ts +15 -14
  43. package/frontend-vue/layers/dms-core/app/composables/auth/useSessionRecovery.ts +21 -8
  44. package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +3 -3
  45. package/frontend-vue/layers/dms-core/app/composables/page/useSiteLayout.ts +11 -9
  46. package/frontend-vue/layers/dms-core/app/composables/period/periodLink.ts +3 -2
  47. package/frontend-vue/layers/dms-core/app/composables/period/usePeriod.ts +2 -2
  48. package/frontend-vue/layers/dms-core/app/composables/realtime/usePageRealtime.ts +10 -3
  49. package/frontend-vue/layers/dms-core/app/composables/realtime/useSseStream.ts +22 -16
  50. package/frontend-vue/layers/dms-core/app/composables/realtime/useUserRealtime.ts +68 -46
  51. package/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts +22 -11
  52. package/frontend-vue/layers/dms-core/app/composables/useEventedAction.ts +4 -1
  53. package/frontend-vue/layers/dms-core/app/composables/useFieldErrors.ts +14 -6
  54. package/frontend-vue/layers/dms-core/app/composables/user/usePreferences.ts +8 -3
  55. package/frontend-vue/layers/dms-core/app/composables/watch/useWatch.ts +17 -8
  56. package/frontend-vue/layers/dms-core/app/types/module-store.ts +3 -1
  57. package/frontend-vue/layers/dms-core/app/types/page.ts +3 -1
  58. package/frontend-vue/layers/dms-core/app/utils/dedupedRefresh.ts +2 -2
  59. package/frontend-vue/layers/dms-core/app/utils/formatter.ts +5 -5
  60. package/frontend-vue/layers/dms-core/app/utils/menu.ts +12 -4
  61. package/frontend-vue/layers/dms-core/app/utils/pageQuery.ts +7 -4
  62. package/frontend-vue/layers/dms-core/app/utils/row-action-rule-evaluator.ts +7 -3
  63. package/frontend-vue/layers/dms-core/app/utils/stringTypeParser.ts +8 -10
  64. package/frontend-vue/layers/dms-core/app/utils/type-check.ts +25 -12
  65. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEditOverlay.vue +2 -2
  66. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupIndex.vue +1 -1
  67. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspector.vue +3 -2
  68. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspectorField.vue +5 -2
  69. package/frontend-vue/layers/dms-ui/app/build/components/containers/drawer/DynamicDrawer.vue +4 -3
  70. package/frontend-vue/layers/dms-ui/app/build/components/containers/modal/DynamicModal.vue +3 -2
  71. package/frontend-vue/layers/dms-ui/app/build/components/containers/row/RowHeader.vue +2 -1
  72. package/frontend-vue/layers/dms-ui/app/build/components/period/PeriodRangeCalendar.vue +10 -7
  73. package/frontend-vue/layers/dms-ui/app/build/components/sortable/SortableList.vue +2 -2
  74. package/frontend-vue/layers/dms-ui/app/build/components/table/FiltersRow.vue +20 -18
  75. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuColumns.vue +2 -5
  76. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuDensity.vue +3 -4
  77. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuFilter.vue +3 -4
  78. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuImport.vue +2 -5
  79. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuPage.vue +2 -5
  80. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuRoot.vue +3 -4
  81. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuSort.vue +2 -5
  82. package/frontend-vue/layers/dms-ui/app/build/components/table/MenuViewMode.vue +21 -19
  83. package/frontend-vue/layers/dms-ui/app/build/components/table/RowSelection.vue +3 -4
  84. package/frontend-vue/layers/dms-ui/app/build/components/table/Table.types.ts +4 -4
  85. package/frontend-vue/layers/dms-ui/app/build/components/table/TableActions.vue +3 -4
  86. package/frontend-vue/layers/dms-ui/app/build/components/table/TableMenu.vue +3 -4
  87. package/frontend-vue/layers/dms-ui/app/build/components/table/TablePagination.vue +3 -4
  88. package/frontend-vue/layers/dms-ui/app/build/components/table/TableRoot.vue +3 -5
  89. package/frontend-vue/layers/dms-ui/app/build/components/table/TableTabs.vue +2 -5
  90. package/frontend-vue/layers/dms-ui/app/build/components/table/TableViews.vue +3 -4
  91. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentFilters.ts +4 -4
  92. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentPreferences.ts +4 -3
  93. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentRows.ts +4 -3
  94. package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentTheme.ts +11 -0
  95. package/frontend-vue/layers/dms-ui/app/build/components/table-view/CardsDisplay.vue +35 -9
  96. package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +1 -1
  97. package/frontend-vue/layers/dms-ui/app/build/mockups/resync.ts +9 -1
  98. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +34 -25
  99. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +52 -26
  100. package/frontend-vue/layers/dms-ui/app/build/utils/calendarDay.ts +4 -1
  101. package/frontend-vue/layers/dms-ui/app/build/utils/characterCount.ts +1 -1
  102. package/frontend-vue/layers/dms-ui/app/build/utils/dispatchQuickActionTarget.ts +16 -11
  103. package/frontend-vue/layers/dms-ui/app/build/utils/fieldOptionsI18n.ts +23 -21
  104. package/frontend-vue/layers/dms-ui/app/build/utils/json.ts +74 -0
  105. package/frontend-vue/layers/dms-ui/app/build/utils/link.ts +2 -2
  106. package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +4 -4
  107. package/frontend-vue/layers/dms-ui/app/build/utils/mockupCatalog.ts +59 -50
  108. package/frontend-vue/layers/dms-ui/app/build/utils/mockupDrop.ts +1 -1
  109. package/frontend-vue/layers/dms-ui/app/build/utils/mockupEdit.ts +8 -6
  110. package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +34 -28
  111. package/frontend-vue/layers/dms-ui/app/build/utils/mockupStamp.ts +11 -3
  112. package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +5 -2
  113. package/frontend-vue/layers/dms-ui/app/build/utils/streamHighlight.ts +8 -6
  114. package/frontend-vue/layers/dms-ui/app/build/utils/urlVariables.ts +2 -1
  115. package/frontend-vue/layers/dms-ui/app/components/RecursiveComponent.vue +3 -6
  116. package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +5 -4
  117. package/frontend-vue/layers/dms-ui/app/components/blocks/BannerBlock.vue +1 -2
  118. package/frontend-vue/layers/dms-ui/app/components/card/NavCard.vue +4 -1
  119. package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +62 -13
  120. package/frontend-vue/layers/dms-ui/app/components/chart/ChartBlock.vue +18 -6
  121. package/frontend-vue/layers/dms-ui/app/components/code-snippet/CodeSnippet.vue +9 -4
  122. package/frontend-vue/layers/dms-ui/app/components/confirm/ConfirmModal.vue +9 -6
  123. package/frontend-vue/layers/dms-ui/app/components/flow-canvas/FlowCanvas.vue +16 -18
  124. package/frontend-vue/layers/dms-ui/app/components/form/FormBlock.vue +4 -9
  125. package/frontend-vue/layers/dms-ui/app/components/form/LocalizedField.vue +2 -2
  126. package/frontend-vue/layers/dms-ui/app/components/form/components/InputAddress.vue +2 -2
  127. package/frontend-vue/layers/dms-ui/app/components/form/components/InputImage.vue +5 -8
  128. package/frontend-vue/layers/dms-ui/app/components/form/components/RichText.vue +3 -2
  129. package/frontend-vue/layers/dms-ui/app/components/master-detail/MasterDetail.vue +3 -1
  130. package/frontend-vue/layers/dms-ui/app/components/period/usePeriodSelectorInteraction.ts +9 -7
  131. package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanBoard.vue +11 -6
  132. package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanDisplay.vue +40 -3
  133. package/frontend-vue/layers/dms-ui/app/composables/chart/apexDatetimeBuckets.ts +9 -5
  134. package/frontend-vue/layers/dms-ui/app/composables/chart/events.ts +6 -3
  135. package/frontend-vue/layers/dms-ui/app/composables/chart/heatmapColors.ts +1 -1
  136. package/frontend-vue/layers/dms-ui/app/composables/chart/localizeSeries.ts +13 -2
  137. package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +27 -4
  138. package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.types.ts +3 -2
  139. package/frontend-vue/layers/dms-ui/app/composables/chart/useChartFetch.ts +3 -4
  140. package/frontend-vue/layers/dms-ui/app/composables/confirm/types.ts +5 -1
  141. package/frontend-vue/layers/dms-ui/app/composables/containers/openDynamicContainer.ts +6 -6
  142. package/frontend-vue/layers/dms-ui/app/composables/containers/types.ts +1 -1
  143. package/frontend-vue/layers/dms-ui/app/composables/containers/useDrawer.ts +8 -5
  144. package/frontend-vue/layers/dms-ui/app/composables/containers/useModal.ts +1 -1
  145. package/frontend-vue/layers/dms-ui/app/composables/form/types/props.ts +5 -2
  146. package/frontend-vue/layers/dms-ui/app/composables/form/useForm.ts +80 -39
  147. package/frontend-vue/layers/dms-ui/app/composables/live/usePageLiveRefresh.ts +1 -1
  148. package/frontend-vue/layers/dms-ui/app/composables/resolveDmsComponent.ts +9 -2
  149. package/frontend-vue/layers/dms-ui/app/composables/tab/useTab.ts +2 -2
  150. package/frontend-vue/layers/dms-ui/app/composables/table-view/shortcuts/tableViewShiftA.ts +2 -2
  151. package/frontend-vue/layers/dms-ui/app/composables/table-view/types/action-target.ts +2 -1
  152. package/frontend-vue/layers/dms-ui/app/composables/table-view/types/column.ts +3 -1
  153. package/frontend-vue/layers/dms-ui/app/composables/table-view/types/display.ts +6 -2
  154. package/frontend-vue/layers/dms-ui/app/composables/table-view/useTableViewExport.ts +6 -5
  155. package/frontend-vue/layers/dms-ui/app/composables/unsaved-changes/useUnsavedChanges.ts +1 -1
  156. package/frontend-vue/layers/dms-ui/app/composables/useExportJob.ts +21 -9
  157. package/frontend-vue/layers/dms-ui/app/utils/blockRefresh.ts +8 -2
  158. package/frontend-vue/layers/dms-ui/app/utils/cascader.ts +18 -8
  159. package/frontend-vue/layers/dms-ui/app/utils/metadataRetry.ts +1 -1
  160. package/frontend-vue/package.json +2 -1
  161. package/frontend-vue/scripts/check-api-error-presentation.mjs +257 -117
  162. package/frontend-vue/scripts/check-autoimport-boundaries.mjs +143 -27
  163. package/frontend-vue/scripts/check-disable-blocks.mjs +26 -4
  164. package/frontend-vue/scripts/check-dms-components.mjs +152 -246
  165. package/frontend-vue/scripts/check-invariants.mjs +100 -42
  166. package/frontend-vue/scripts/check-page-invariants.mjs +103 -40
  167. package/frontend-vue/scripts/dms-components-dependencies.mjs +106 -13
  168. package/frontend-vue/scripts/dms-components-script.mjs +375 -0
  169. package/frontend-vue/scripts/eslint-test-quality.mjs +126 -0
  170. package/frontend-vue/scripts/jsconfig.json +10 -0
  171. package/frontend-vue/scripts/probes/capture-frontend-probe.cjs +4 -2
  172. package/frontend-vue/scripts/probes/frontend-behavior.cjs +217 -47
  173. package/frontend-vue/scripts/probes/frontend-legacy.cjs +159 -8
  174. package/frontend-vue/scripts/probes/frontend-probe-controls.cjs +89 -10
  175. package/frontend-vue/scripts/prove-comment-emit.mjs +33 -4
  176. package/frontend-vue/scripts/prove-component-registration.mjs +110 -24
  177. package/frontend-vue/scripts/test-autoimport-boundaries.mjs +37 -6
  178. package/frontend-vue/scripts/test-dms-components.mjs +51 -2
  179. package/package.json +1 -1
  180. package/frontend-vue/eslint-test-quality.mjs +0 -62
@@ -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?: unknown;
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?: unknown;
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: Record<string, unknown>;
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: Record<string, unknown>;
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 isRecord(value: unknown): value is Record<string, unknown> {
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: unknown,
86
- guard: (entry: unknown) => boolean,
87
- ): boolean {
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: unknown): value is Record<string, string> {
92
- return isRecord(value) && Object.values(value).every(isString);
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: unknown): value is MockupOptionUi {
96
- if (!isRecord(value)) return false;
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: unknown): value is string | number | boolean {
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 isOptionSchema(value: unknown): value is MockupOptionSchema {
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
- isRecord(value) &&
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(value: unknown): value is MockupInitialChild {
128
+ function isInitialChild(
129
+ value: JsonValue,
130
+ ): value is JsonObject & MockupInitialChild {
127
131
  return (
128
- isRecord(value) &&
132
+ isObjectValue(value) &&
129
133
  isString(value.id) &&
130
134
  isString(value.type) &&
131
- isRecord(value.options)
135
+ isObjectValue(value.options)
132
136
  );
133
137
  }
134
138
 
135
- function isMeta(value: unknown): value is MockupBlockType["meta"] {
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
- isRecord(value) &&
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: unknown): value is MockupBlockType {
157
+ function isBlockType(value: JsonValue): value is JsonObject & MockupBlockType {
146
158
  return (
147
- isRecord(value) &&
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
- isRecord(value.config) &&
165
+ isObjectValue(value.config) &&
154
166
  Object.values(value.config).every(isOptionSchema) &&
155
- isRecord(value.defaults) &&
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 (!isRecord(value) || !Array.isArray(value.blocks)) return undefined;
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
- ): unknown {
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): Record<string, unknown> {
244
- const options: Record<string, unknown> = { ...block.defaults };
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: Record<string, unknown>;
262
- added: Record<string, unknown>;
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: unknown; options: (reference: string) => Record<string, unknown> }
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, Record<string, unknown>>([
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: Record<string, unknown>, wanted: string): string {
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: Record<string, unknown>;
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: Record<string, unknown> = {},
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
- ): { parent: string | null; index: number } {
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: unknown;
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?: Record<string, unknown>;
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?: Record<string, unknown>;
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: unknown,
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, unknown]> => {
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: Record<string, unknown> | undefined,
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
- isNumber,
3
- isObject,
4
- isString,
5
- } from "../../../../dms-core/app/utils/type-check";
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?: Record<string, unknown>;
20
+ options?: JsonObject;
18
21
  children?: MockupSpecNode[];
19
22
  id?: string;
20
23
  slot?: string;
21
24
  colSpan?: number;
22
- [field: string]: unknown;
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]: unknown;
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]: unknown;
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 isRecord(value: unknown): value is Record<string, unknown> {
66
- return isObject(value) && value !== null && !Array.isArray(value);
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): Record<string, unknown> {
78
- return isRecord(page.fixtures) ? page.fixtures : {};
76
+ export function pageFixtures(page: MockupSpecPage): JsonObject {
77
+ const { fixtures } = page;
78
+ return !Array.isArray(fixtures) && isObjectValue(fixtures) ? fixtures : {};
79
79
  }
80
80
 
81
- /** Whether `value` is a node whose known fields have their types, at every depth. */
82
- export function isMockupSpecNode(value: unknown): value is MockupSpecNode {
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, isRecord) &&
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(isMockupSpecNode)))
91
+ (Array.isArray(value.children) && value.children.every(isWrittenNode)))
93
92
  );
94
93
  }
95
94
 
96
- function isMockupSpecPage(value: unknown): value is MockupSpecPage {
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
- isRecord(value) &&
104
+ isObjectValue(value) &&
99
105
  isString(value.id) &&
100
106
  isString(value.title) &&
101
107
  Array.isArray(value.tree) &&
102
- value.tree.every(isMockupSpecNode)
108
+ value.tree.every(isWrittenNode)
103
109
  );
104
110
  }
105
111
 
106
- /** The spec `value` holds, or undefined when it is not one the editor can change. */
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 (!isRecord(value)) return undefined;
116
+ if (!isJsonObject(value)) return undefined;
111
117
  const { pages } = value;
112
118
  if (!Array.isArray(pages) || !pages.every(isMockupSpecPage)) {
113
119
  return undefined;
@@ -1,3 +1,5 @@
1
+ import type { JsonValue } from "../../../../dms-core/app/types/json";
2
+ import type { JsonObject } from "./json";
1
3
  import type { MockupHistory } from "./mockupHistory";
2
4
  import {
3
5
  nodeAt,
@@ -73,9 +75,15 @@ function isSameKind(left: MockupSpecNode, right: MockupSpecNode): boolean {
73
75
  return left.type === right.type && left.componentName === right.componentName;
74
76
  }
75
77
 
76
- function partsOf(node: MockupSpecNode): unknown[] {
78
+ function isHeldObject(
79
+ value: MockupSpecNode[keyof MockupSpecNode],
80
+ ): value is JsonObject | JsonValue[] | MockupSpecNode[] {
81
+ return typeof value === "object" && value !== null;
82
+ }
83
+
84
+ function partsOf(node: MockupSpecNode): object[] {
77
85
  return [
78
- ...Object.values(node).filter((value) => value instanceof Object),
86
+ ...Object.values(node).filter(isHeldObject),
79
87
  ...(node.children ?? []),
80
88
  ];
81
89
  }
@@ -197,7 +205,7 @@ function retyped(
197
205
  if (!node || node.id !== undefined || !isSameKind(node, stamp.node)) {
198
206
  return undefined;
199
207
  }
200
- const restored = JSON.stringify(present, (_key, value: unknown) =>
208
+ const restored = JSON.stringify(present, (_key, value: JsonValue) =>
201
209
  value === node ? stamp.node : value,
202
210
  );
203
211
  return restored === JSON.stringify(base)
@@ -1,4 +1,6 @@
1
+ import type { JsonValue } from "../../../../dms-core/app/types/json";
1
2
  import { isString } from "../../../../dms-core/app/utils/type-check";
3
+ import { isJsonValue } from "./json";
2
4
  import {
3
5
  MOCKUP_ANNOTATIONS_EVENT,
4
6
  MOCKUP_STATE_EVENT,
@@ -29,12 +31,13 @@ interface StreamState {
29
31
  isClosed: boolean;
30
32
  }
31
33
 
32
- function readJson(event: Event): unknown {
34
+ function readJson(event: Event): JsonValue | undefined {
33
35
  if (!(event instanceof MessageEvent) || !isString(event.data)) {
34
36
  return undefined;
35
37
  }
36
38
  try {
37
- return JSON.parse(event.data);
39
+ const parsed: unknown = JSON.parse(event.data);
40
+ return isJsonValue(parsed) ? parsed : undefined;
38
41
  } catch {
39
42
  return undefined;
40
43
  }
@@ -24,10 +24,11 @@ function tagsOf(type: string): Tag[] {
24
24
  const resolved = type.split(" ").flatMap((name) => {
25
25
  let found: Tag[] = [];
26
26
  for (const part of name.split(".")) {
27
- const value = TAG_TABLE[part];
27
+ const value = Object.hasOwn(TAG_TABLE, part)
28
+ ? TAG_TABLE[part]
29
+ : undefined;
28
30
  if (isFunction(value)) found = found.map(value);
29
- else if (value && !found.length)
30
- found = Array.isArray(value) ? [...value] : [value];
31
+ else if (value && !found.length) found = [value];
31
32
  }
32
33
  return found;
33
34
  });
@@ -49,7 +50,8 @@ export function highlightStream<State>(
49
50
  highlighter: Highlighter,
50
51
  put: HighlightedRange,
51
52
  ): void {
52
- const state = parser.startState?.(INDENT_UNIT) ?? (true as State);
53
+ const stateful: StreamParser<State | true> = parser;
54
+ const state = stateful.startState?.(INDENT_UNIT) ?? true;
53
55
  let pending: { from: number; to: number; classes: string } | null = null;
54
56
  const flush = () => {
55
57
  if (pending) put(pending.from, pending.to, pending.classes);
@@ -65,12 +67,12 @@ export function highlightStream<State>(
65
67
 
66
68
  let lineStart = 0;
67
69
  for (const line of code.split("\n")) {
68
- if (!line) parser.blankLine?.(state, INDENT_UNIT);
70
+ if (!line) stateful.blankLine?.(state, INDENT_UNIT);
69
71
  const stream = new StringStream(line, TAB_SIZE, INDENT_UNIT);
70
72
  let emptyTokens = 0;
71
73
  while (!stream.eol()) {
72
74
  stream.start = stream.pos;
73
- const type = parser.token(stream, state);
75
+ const type = stateful.token(stream, state);
74
76
  if (stream.pos === stream.start) {
75
77
  if (++emptyTokens < MAX_EMPTY_TOKENS) continue;
76
78
  stream.next();
@@ -1,6 +1,7 @@
1
1
  import { isString, isNumber } from "../../../../dms-core/app/utils/type-check";
2
2
  import { get } from "@nuxt/ui/runtime/utils/index.js";
3
3
  import type { MenuRouteState } from "#dms-core/app/types/menu";
4
+ import type { JsonObject } from "./json";
4
5
 
5
6
  const PARAM_KEY = String.raw`params\.(\w+(?::\d+)?)`;
6
7
 
@@ -19,7 +20,7 @@ const TOKEN_OPENING = "{{";
19
20
  export interface ReplaceUrlVariablesContext {
20
21
  routeParams?: Record<string, string>;
21
22
  routeQuery: MenuRouteState["query"];
22
- response?: Record<string, unknown>;
23
+ response?: JsonObject;
23
24
  }
24
25
 
25
26
  type EncodeValue = (value: string) => string;
@@ -35,8 +35,8 @@ interface Props {
35
35
  const props = defineProps<Props>();
36
36
 
37
37
  let anchored: ComponentPublicInstance | null = null;
38
- function anchorBlock(instance: Element | ComponentPublicInstance | null): void {
39
- const block = (instance as ComponentPublicInstance | null) ?? null;
38
+ function anchorBlock(instance: ComponentPublicInstance | null): void {
39
+ const block = instance ?? null;
40
40
  registerBlockAnchor(props.layoutPath, block, anchored);
41
41
  anchored = block;
42
42
  }
@@ -72,10 +72,7 @@ function calculateColumnCount(
72
72
  children: ResolvedComponentInfo[] | undefined,
73
73
  ): number {
74
74
  if (!children) return 0;
75
- return children.reduce(
76
- (sum, child) => sum + ((child.colSpan as number) || 1),
77
- 0,
78
- );
75
+ return children.reduce((sum, child) => sum + (Number(child.colSpan) || 1), 0);
79
76
  }
80
77
 
81
78
  function getColSpanStyle(
@@ -95,22 +95,23 @@ function componentFor(node: PreviewResolvedNode): Component | string {
95
95
  return resolveDmsComponent(node.componentName) ?? "div";
96
96
  }
97
97
 
98
- function optionsFor(node: PreviewResolvedNode): Record<string, unknown> {
98
+ function optionsFor(node: PreviewResolvedNode) {
99
99
  if (node.issue) return { issue: node.issue };
100
100
  if (node.sketch) return { sketch: node.sketch };
101
101
  return node.options;
102
102
  }
103
103
 
104
104
  function toPageComponent(node: PreviewResolvedNode): ResolvedComponentInfo {
105
- return {
105
+ const page: ResolvedComponentInfo = {
106
106
  id: node.id,
107
107
  component: componentFor(node),
108
108
  componentName: node.componentName,
109
109
  options: optionsFor(node),
110
110
  children: node.children.map(toPageComponent),
111
- ...(node.slot ? { slot: node.slot } : {}),
112
- ...(node.colSpan === undefined ? {} : { colSpan: node.colSpan }),
113
111
  };
112
+ if (node.slot) page.slot = node.slot;
113
+ if (node.colSpan !== undefined) page.colSpan = node.colSpan;
114
+ return page;
114
115
  }
115
116
 
116
117
  const components = computed(() => resolved.value.map(toPageComponent));
@@ -12,7 +12,6 @@ import {
12
12
  BANNER_TONE_ICONS,
13
13
  type BannerTone,
14
14
  } from "../../utils/bannerToneIcons";
15
- import type { CustomButton } from "../../composables/table-view/types/custom-button";
16
15
  import { useWatch } from "../../../../dms-core/app/composables/watch/useWatch";
17
16
  import { useComposedText } from "../../../../dms-core/app/composables/translation/useComposedText";
18
17
  import type { DefaultComponentProps } from "../../../../dms-core/app/types/component";
@@ -155,7 +154,7 @@ function dismiss(): void {
155
154
  }
156
155
 
157
156
  function press(action: BlockButtonAction): void {
158
- handleCustomButton(action as CustomButton);
157
+ handleCustomButton({ ...action, variant: undefined });
159
158
  }
160
159
  </script>
161
160
 
@@ -5,6 +5,7 @@ import DmsIconWell, { type IconWellTone } from "../icon-well/IconWell.vue";
5
5
  import DmsStatusPill from "../status-pill/StatusPill.vue";
6
6
  import DmsAutoLink from "../link/AutoLink.vue";
7
7
  import type { Tone } from "#dms-core/app/types/tone";
8
+ import { isString } from "#dms-core/app/utils/type-check";
8
9
  import { MONO_TAG_CLASS } from "../../build/utils/monoChip";
9
10
  import { navBadgeClass } from "../../build/utils/navBadge";
10
11
 
@@ -63,7 +64,9 @@ const theme = tv({
63
64
  });
64
65
 
65
66
  const ui = theme();
66
- const rootClass = computed(() => ui.root({ class: attrs.class as string }));
67
+ const rootClass = computed(() =>
68
+ ui.root({ class: isString(attrs.class) ? attrs.class : undefined }),
69
+ );
67
70
  const passthrough = computed(() => {
68
71
  const { class: _class, ...rest } = attrs;
69
72
  return rest;