@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,4 +1,5 @@
1
- import { isUndefined } from "../../utils/type-check";
1
+ import { isRecord } from "../../build/utils/record";
2
+ import { isNull, isString, isUndefined } from "../../utils/type-check";
2
3
  import { ComponentId } from "../../types/watch";
3
4
 
4
5
  function getValueByPath(
@@ -8,8 +9,9 @@ function getValueByPath(
8
9
  const keys = path.split(".");
9
10
  let current: unknown = obj;
10
11
  for (const key of keys) {
11
- if (current === null || current === undefined) return undefined;
12
- current = (current as Record<string, unknown>)[key];
12
+ if (isNull(current) || isUndefined(current)) return undefined;
13
+ const target: unknown = Object(current);
14
+ current = isRecord(target) ? target[key] : undefined;
13
15
  }
14
16
  return current;
15
17
  }
@@ -41,6 +43,13 @@ interface WatchEventDetail {
41
43
 
42
44
  type WatchEvent = Event & Partial<Pick<CustomEvent, "detail">>;
43
45
 
46
+ function isWatchEventDetail(value: unknown): value is WatchEventDetail {
47
+ return (
48
+ isRecord(value) &&
49
+ (isUndefined(value.component) || isString(value.component))
50
+ );
51
+ }
52
+
44
53
  function checkParamConditions(
45
54
  onParam: WatchAction["onParam"],
46
55
  data: WatchEventDetail["data"],
@@ -87,7 +96,7 @@ export function useWatch(
87
96
  */
88
97
  function runMatchingActions(
89
98
  matchingActions: WatchAction[],
90
- event: WatchEvent,
99
+ detail: WatchEventDetail,
91
100
  ) {
92
101
  isLoading.value = true;
93
102
  try {
@@ -98,7 +107,7 @@ export function useWatch(
98
107
  }
99
108
  // prettier-ignore
100
109
  try {
101
- actionFn(action, event.detail, componentState);
110
+ actionFn(action, detail, componentState);
102
111
  } catch {
103
112
  // eslint-disable-line no-empty -- A synchronous action failure does not stop subsequent actions.
104
113
  }
@@ -109,8 +118,8 @@ export function useWatch(
109
118
  }
110
119
 
111
120
  function handleWatchEvent(event: WatchEvent) {
112
- const { detail } = event;
113
- if (!detail) {
121
+ const detail: unknown = event.detail;
122
+ if (!isWatchEventDetail(detail)) {
114
123
  return;
115
124
  }
116
125
 
@@ -122,7 +131,7 @@ export function useWatch(
122
131
  return;
123
132
  }
124
133
 
125
- runMatchingActions(matchingActions, event);
134
+ runMatchingActions(matchingActions, detail);
126
135
  }
127
136
 
128
137
  onMounted(() => {
@@ -1,3 +1,5 @@
1
+ import type { JsonValue } from "./json";
2
+
1
3
  /**
2
4
  * Mirror of the backend's module store listing (`GET /dms/store/listing`,
3
5
  * `src/store/types.ts` in `@antelopejs/dms`).
@@ -133,7 +135,7 @@ export interface StoreDependencyChoice {
133
135
  /** npm package, never a git or local source. */
134
136
  package: string;
135
137
  /** Config written to its antelope.config.ts entry. */
136
- config?: Record<string, unknown>;
138
+ config?: { [key: string]: JsonValue };
137
139
  }
138
140
 
139
141
  /** Body of `POST /dms/store/<kind>`; only an install carries dependencies. */
@@ -1,4 +1,5 @@
1
1
  import type { BlockText } from "#dms-core/app/types/composed-text";
2
+ import type { JsonValue } from "#dms-core/app/types/json";
2
3
  import type { BlockAction } from "#dms-core/app/entries/types/block-action";
3
4
  import type { PageLiveOptions } from "#dms-core/app/types/live";
4
5
  import type { ModuleSourceKind } from "./module-store";
@@ -141,7 +142,8 @@ export interface LayoutBanner {
141
142
  /** Link buttons after the text; the last one leads. */
142
143
  actions?: BlockAction[];
143
144
  component?: string;
144
- props?: Record<string, unknown>;
145
+ /** The props `component` is drawn with, as the backend sends them. */
146
+ props?: { [key: string]: JsonValue };
145
147
  }
146
148
 
147
149
  export type SiteLayout = {
@@ -9,11 +9,11 @@
9
9
  * token out from under each other and log the user out.
10
10
  */
11
11
  export function runDeduped<T>(
12
- holder: Record<PropertyKey, unknown>,
12
+ holder: Record<PropertyKey, Promise<T> | null | undefined>,
13
13
  key: PropertyKey,
14
14
  task: () => Promise<T>,
15
15
  ): Promise<T> {
16
- const existing = holder[key] as Promise<T> | null | undefined;
16
+ const existing = Object.hasOwn(holder, key) ? holder[key] : undefined;
17
17
  if (existing) {
18
18
  return existing;
19
19
  }
@@ -3,7 +3,7 @@ import {
3
3
  regionalDateTimeFormat,
4
4
  regionalDayNumber,
5
5
  } from "./regional";
6
- import { isNumber } from "./type-check";
6
+ import { isDate, isNull, isNumber, isString, isUndefined } from "./type-check";
7
7
  import type { I18nTranslate } from "../composables/translation/useTranslation";
8
8
 
9
9
  const DEFAULT_LOCALE = "en-US";
@@ -183,7 +183,7 @@ export function formatDate(
183
183
  locale: string = DEFAULT_LOCALE,
184
184
  options?: Intl.DateTimeFormatOptions,
185
185
  ): string | null {
186
- if (date === undefined || date === null) {
186
+ if (isUndefined(date) || isNull(date)) {
187
187
  return null;
188
188
  }
189
189
 
@@ -191,10 +191,10 @@ export function formatDate(
191
191
  const formatOptions = options || defaultDateFormatterOptions;
192
192
 
193
193
  try {
194
- if (date instanceof Date) {
194
+ if (isDate(date)) {
195
195
  validDate = date;
196
196
  } else {
197
- validDate = new Date(date as string | number);
197
+ validDate = new Date(isNumber(date) ? date : String(date));
198
198
  }
199
199
 
200
200
  if (Number.isNaN(validDate.getTime())) {
@@ -278,7 +278,7 @@ const CURRENCY_CODE = /^[A-Za-z]{3}$/;
278
278
  */
279
279
  function priceCurrency(options: Intl.NumberFormatOptions | undefined): string {
280
280
  const code = options?.currency;
281
- return typeof code === "string" && CURRENCY_CODE.test(code)
281
+ return isString(code) && CURRENCY_CODE.test(code)
282
282
  ? code.toUpperCase()
283
283
  : DEFAULT_CURRENCY;
284
284
  }
@@ -1,6 +1,7 @@
1
1
  import type { NavigationMenuItem } from "@nuxt/ui";
2
2
  import { parseLinkQuery, stripQueryAndHash } from "./routePath";
3
- import { isString } from "./type-check";
3
+ import { isRecord } from "../build/utils/record";
4
+ import { isString, isUndefined } from "./type-check";
4
5
 
5
6
  export const MENU_STATUS_TEXT_CLASSES: Record<MenuItemStatus, string> = {
6
7
  success: "text-success",
@@ -58,15 +59,22 @@ const matchesRoutePrefix = (currentPath: string, to: string): boolean => {
58
59
  return current === target || current.startsWith(`${target}/`);
59
60
  };
60
61
 
62
+ const isMenuItemTarget = (
63
+ value: NavigationMenuItem["to"],
64
+ ): value is MenuItemTarget =>
65
+ isRecord(value) &&
66
+ isString(value.path) &&
67
+ (isUndefined(value.query) ||
68
+ (isRecord(value.query) && Object.values(value.query).every(isString)));
69
+
61
70
  const resolveItemTarget = (
62
71
  to: NavigationMenuItem["to"],
63
72
  ): MenuItemTarget | null => {
64
73
  if (isString(to)) {
65
74
  return { path: stripQueryAndHash(to), query: parseLinkQuery(to) };
66
75
  }
67
- const target = to as MenuItemTarget | undefined;
68
- if (target && isString(target.path)) {
69
- return { path: target.path, query: target.query };
76
+ if (isMenuItemTarget(to)) {
77
+ return { path: to.path, query: to.query };
70
78
  }
71
79
  return null;
72
80
  };
@@ -1,12 +1,13 @@
1
1
  import { isString } from "#dms-core/app/utils/type-check";
2
+ import type { ValidationRouteContext } from "./query-validation";
2
3
 
3
4
  /** The page query as the server reads it: one value per name, the last one. */
4
5
  export function pageQueryValues(
5
- query: Record<string, unknown> | undefined,
6
+ query: ValidationRouteContext["query"] | undefined,
6
7
  ): Record<string, string> {
7
8
  return Object.fromEntries(
8
9
  Object.entries(query ?? {}).flatMap(([name, value]) => {
9
- const last = Array.isArray(value) ? value.at(-1) : value;
10
+ const last: unknown = Array.isArray(value) ? value.at(-1) : value;
10
11
  return isString(last) ? [[name, last]] : [];
11
12
  }),
12
13
  );
@@ -65,7 +66,7 @@ export function fillRouteParams(
65
66
  params: Record<string, string>,
66
67
  ): string {
67
68
  return layoutUrl.replace(/:([^/]+)/g, (segment, name: string) =>
68
- name in params ? params[name]! : segment,
69
+ Object.hasOwn(params, name) ? params[name]! : segment,
69
70
  );
70
71
  }
71
72
 
@@ -77,6 +78,8 @@ export function isSameRouteParams(
77
78
  const names = Object.keys(left);
78
79
  return (
79
80
  names.length === Object.keys(right).length &&
80
- names.every((name) => left[name] === right[name])
81
+ names.every(
82
+ (name) => Object.hasOwn(right, name) && left[name] === right[name],
83
+ )
81
84
  );
82
85
  }
@@ -22,11 +22,15 @@ export const evaluateRowActionRule: RuleEvaluator = (rule, row) => {
22
22
 
23
23
  if (FIELD_KEY in rule) {
24
24
  const ruleObj: RuleDictionary = rule;
25
- const fieldValue = get(row, rule.field);
25
+ const fieldValue: unknown = get(row, rule.field);
26
26
  for (const [operator, def] of Object.entries(FIELD_OPERATORS)) {
27
27
  if (operator in ruleObj) {
28
- const compare = def.compare;
29
- return compare(fieldValue, ruleObj[operator]);
28
+ const ruleValue = ruleObj[operator];
29
+ if (!def.isArray) return def.compare(fieldValue, ruleValue);
30
+ const ruleValues: unknown[] | undefined = Array.isArray(ruleValue)
31
+ ? ruleValue
32
+ : undefined;
33
+ return ruleValues !== undefined && def.compare(fieldValue, ruleValues);
30
34
  }
31
35
  }
32
36
  }
@@ -1,12 +1,7 @@
1
- export type Primitive =
2
- | string
3
- | number
4
- | boolean
5
- | Date
6
- | null
7
- | undefined
8
- | Record<string, unknown>
9
- | unknown[];
1
+ import { isJsonValue } from "../build/utils/json";
2
+ import type { JsonValue } from "../types/json";
3
+
4
+ export type Primitive = JsonValue | Date | undefined;
10
5
 
11
6
  const KEYWORD_VALUES: Record<
12
7
  Parameters<typeof isKeyword>[0],
@@ -33,7 +28,10 @@ const PARSER_REGISTRY = [
33
28
  },
34
29
  {
35
30
  test: isStringJSON,
36
- parse: (value: string) => JSON.parse(value),
31
+ parse: (value: string): Primitive => {
32
+ const parsed: unknown = JSON.parse(value);
33
+ return isJsonValue(parsed) ? parsed : value;
34
+ },
37
35
  },
38
36
  ];
39
37
 
@@ -1,18 +1,31 @@
1
- type CallableFunction = (...args: any[]) => unknown;
1
+ /** Any function: what it returns is unknown until a guard reads it. */
2
+ type CallableFunction = (...args: any[]) => Parameters<typeof isNull>[0];
3
+
4
+ /** The type each `typeof` result a guard below tests for narrows to. */
5
+ interface TypeofResults {
6
+ string: string;
7
+ number: number;
8
+ boolean: boolean;
9
+ undefined: undefined;
10
+ function: CallableFunction;
11
+ bigint: bigint;
12
+ symbol: symbol;
13
+ }
2
14
 
3
15
  const createTypeGuard =
4
- <T>(type: string) =>
5
- (v: unknown): v is T =>
16
+ <K extends keyof TypeofResults>(type: K) =>
17
+ (v: unknown): v is TypeofResults[K] =>
6
18
  typeof v === type;
7
19
 
8
- export const isString = createTypeGuard<string>("string");
9
- export const isNumber = createTypeGuard<number>("number");
10
- export const isBoolean = createTypeGuard<boolean>("boolean");
11
- export const isUndefined = createTypeGuard<undefined>("undefined");
12
- export const isObject = createTypeGuard<Record<string, unknown>>("object");
13
- export const isFunction = createTypeGuard<CallableFunction>("function");
14
- export const isBigint = createTypeGuard<bigint>("bigint");
15
- export const isSymbol = createTypeGuard<symbol>("symbol");
20
+ export const isString = createTypeGuard("string");
21
+ export const isNumber = createTypeGuard("number");
22
+ export const isBoolean = createTypeGuard("boolean");
23
+ export const isUndefined = createTypeGuard("undefined");
24
+ export const isObject = (v: unknown): v is Record<string, unknown> =>
25
+ typeof v === "object";
26
+ export const isFunction = createTypeGuard("function");
27
+ export const isBigint = createTypeGuard("bigint");
28
+ export const isSymbol = createTypeGuard("symbol");
16
29
 
17
30
  export const isNull = (value: unknown): value is null => value === null;
18
31
 
@@ -24,7 +37,7 @@ export const isJSON = (value: Parameters<typeof isString>[0]): boolean => {
24
37
  return false;
25
38
  }
26
39
  try {
27
- const parsed = JSON.parse(value);
40
+ const parsed: unknown = JSON.parse(value);
28
41
  return isObject(parsed) && !isNull(parsed);
29
42
  } catch {
30
43
  return false;
@@ -61,7 +61,7 @@ watch(
61
61
  },
62
62
  );
63
63
 
64
- function box(rect: PreviewRect): Record<string, string> {
64
+ function box(rect: PreviewRect) {
65
65
  return {
66
66
  left: `${rect.x}px`,
67
67
  top: `${rect.y}px`,
@@ -98,7 +98,7 @@ const textStyle = computed(() => {
98
98
  };
99
99
  });
100
100
 
101
- function pointOf(event: DragEvent): { x: number; y: number } {
101
+ function pointOf(event: DragEvent) {
102
102
  const target = event.currentTarget;
103
103
  const origin =
104
104
  target instanceof Element
@@ -22,7 +22,7 @@ function viewerLink(name: string): string {
22
22
 
23
23
  onMounted(async () => {
24
24
  try {
25
- const answer = await $authFetch(MOCKUP_LIST_ENDPOINT);
25
+ const answer: unknown = await $authFetch(MOCKUP_LIST_ENDPOINT);
26
26
  const list = parseMockupList(answer);
27
27
  hasFailed.value = list === undefined;
28
28
  mockups.value = list ?? [];
@@ -13,6 +13,7 @@ import {
13
13
  type MockupSpecDocument,
14
14
  } from "../../utils/mockupSpec";
15
15
  import type { MockupIssue } from "../../utils/mockup";
16
+ import type { JsonValue } from "../../../../../dms-core/app/types/json";
16
17
  import MockupInspectorField from "./MockupInspectorField.vue";
17
18
  import MockupIssues from "./MockupIssues.vue";
18
19
  import MockupPageInspector from "./MockupPageInspector.vue";
@@ -62,12 +63,12 @@ const hasData = computed(() => {
62
63
  );
63
64
  });
64
65
 
65
- function optionValue(key: string): unknown {
66
+ function optionValue(key: string): JsonValue | undefined {
66
67
  const options = node.value?.options ?? {};
67
68
  return Object.hasOwn(options, key) ? options[key] : undefined;
68
69
  }
69
70
 
70
- function setOption(key: string, value: unknown): void {
71
+ function setOption(key: string, value: JsonValue | undefined): void {
71
72
  const pointer = props.selection;
72
73
  if (!pointer) return;
73
74
  emit("edit", { kind: "setOption", pointer, key, value }, `${pointer}:${key}`);
@@ -5,6 +5,7 @@ import {
5
5
  isNumber,
6
6
  isString,
7
7
  } from "../../../../../dms-core/app/utils/type-check";
8
+ import type { JsonValue } from "../../../../../dms-core/app/types/json";
8
9
  import type { MockupInspectorField } from "../../utils/mockupInspector";
9
10
 
10
11
  /**
@@ -15,7 +16,7 @@ const props = defineProps<{
15
16
  field: MockupInspectorField;
16
17
  value: unknown;
17
18
  }>();
18
- const emit = defineEmits<{ update: [value: unknown] }>();
19
+ const emit = defineEmits<{ update: [value: JsonValue | undefined] }>();
19
20
 
20
21
  const UNSET = "\u0000unset";
21
22
  const COLOR_PATTERN = /^#[0-9a-f]{6}$/i;
@@ -60,7 +61,9 @@ const selected = computed(() =>
60
61
  : UNSET,
61
62
  );
62
63
 
63
- function emitChoice(next: unknown): void {
64
+ function emitChoice(
65
+ next: MockupInspectorField["choices"][number]["value"],
66
+ ): void {
64
67
  emit("update", next === UNSET ? undefined : next);
65
68
  }
66
69
 
@@ -15,6 +15,7 @@ import { useWindowSize } from "@vueuse/core";
15
15
  import type {
16
16
  ContainerColor,
17
17
  ContainerInstance,
18
+ ContainerOptions,
18
19
  DrawerDirection,
19
20
  } from "../../../../composables/containers/types";
20
21
  import type { ModalSize } from "../../../../types/modal";
@@ -42,11 +43,11 @@ interface DynamicDrawerProps {
42
43
  description?: string;
43
44
  containerId: string;
44
45
  component: Component;
45
- componentOptions?: Record<string, unknown>;
46
+ componentOptions?: ContainerOptions["componentOptions"];
46
47
  /** Mounts the body component anew when it changes. */
47
48
  componentKey?: string;
48
49
  headerComponent?: Component;
49
- headerComponentOptions?: Record<string, unknown>;
50
+ headerComponentOptions?: ContainerOptions["headerComponentOptions"];
50
51
  direction?: DrawerDirection;
51
52
  /**
52
53
  * Width a side drawer opens at, from `lg`: a modal's width at that size;
@@ -95,7 +96,7 @@ const NUXT_UI_FORM_KEYS: symbol[] = [
95
96
  ];
96
97
  const drawerInstance = currentInstanceProvides();
97
98
  if (drawerInstance && props.callerProvides) {
98
- drawerInstance.provides = Object.create(toRaw(props.callerProvides));
99
+ drawerInstance.provides = { __proto__: toRaw(props.callerProvides) };
99
100
 
100
101
  for (const key of NUXT_UI_FORM_KEYS) provide(key, undefined);
101
102
  }
@@ -5,6 +5,7 @@ import type { ModalSize } from "../../../../types/modal";
5
5
  import type {
6
6
  ContainerColor,
7
7
  ContainerInstance,
8
+ ContainerOptions,
8
9
  } from "../../../../composables/containers/types";
9
10
  import DmsIconWell from "../../../../components/icon-well/IconWell.vue";
10
11
  import {
@@ -20,11 +21,11 @@ interface DynamicModalProps {
20
21
  size?: ModalSize;
21
22
  containerId: string;
22
23
  component: Component;
23
- componentOptions?: Record<string, unknown>;
24
+ componentOptions?: ContainerOptions["componentOptions"];
24
25
  /** Mounts the body component anew when it changes. */
25
26
  componentKey?: string;
26
27
  headerComponent?: Component;
27
- headerComponentOptions?: Record<string, unknown>;
28
+ headerComponentOptions?: ContainerOptions["headerComponentOptions"];
28
29
  icon?: string;
29
30
  color?: ContainerColor;
30
31
  }
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import { computed } from "vue";
10
10
  import type { Component } from "vue";
11
+ import type { ContainerOptions } from "../../../../composables/containers/types";
11
12
  import type { RowNavigation } from "../../../../types/row-navigation";
12
13
 
13
14
  interface RowHeaderProps {
@@ -25,7 +26,7 @@ interface RowHeaderProps {
25
26
  subtitleClass?: string;
26
27
  /** Drawn under the position line (pills, hints). */
27
28
  component?: Component;
28
- componentOptions?: Record<string, unknown>;
29
+ componentOptions?: ContainerOptions["componentOptions"];
29
30
  }
30
31
 
31
32
  const props = withDefaults(defineProps<RowHeaderProps>(), {
@@ -24,6 +24,7 @@ import {
24
24
  type CalendarRange,
25
25
  isBeyondMaxDays,
26
26
  } from "../../composables/period/periodDisplay";
27
+ import { toCalendarDay } from "../../utils/calendarDay";
27
28
 
28
29
  interface Props {
29
30
  modelValue: CalendarRange | null;
@@ -39,7 +40,8 @@ interface Props {
39
40
  maxDays?: number;
40
41
  }
41
42
 
42
- type WeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6;
43
+ const WEEK_STARTS = [0, 1, 2, 3, 4, 5, 6] as const;
44
+ const MONDAY = 1;
43
45
 
44
46
  const props = withDefaults(defineProps<Props>(), {
45
47
  compareRange: null,
@@ -93,8 +95,8 @@ const rekaValue = computed<DateRange>(() =>
93
95
  );
94
96
 
95
97
  function onUpdate(value: DateRange | null) {
96
- const start = value?.start as CalendarDate | undefined;
97
- const end = value?.end as CalendarDate | undefined;
98
+ const start = toCalendarDay(value?.start);
99
+ const end = toCalendarDay(value?.end);
98
100
  if (start && end) {
99
101
  pendingStart.value = null;
100
102
  emit("pending", null);
@@ -107,9 +109,8 @@ function onUpdate(value: DateRange | null) {
107
109
 
108
110
  function isDateDisabled(date: DateValue): boolean {
109
111
  const picked = pendingStart.value;
110
- return (
111
- !!picked && isBeyondMaxDays(date as CalendarDate, picked, props.maxDays)
112
- );
112
+ const day = toCalendarDay(date);
113
+ return !!picked && !!day && isBeyondMaxDays(day, picked, props.maxDays);
113
114
  }
114
115
 
115
116
  function onPlaceholder(value: DateValue) {
@@ -198,7 +199,9 @@ function triggerClass(date: DateValue): (string | false)[] {
198
199
  ];
199
200
  }
200
201
 
201
- const weekStart = computed(() => props.weekStartsOn as WeekStart);
202
+ const weekStart = computed(
203
+ () => WEEK_STARTS.find((day) => day === props.weekStartsOn) ?? MONDAY,
204
+ );
202
205
  </script>
203
206
 
204
207
  <template>
@@ -10,7 +10,7 @@
10
10
  * `added` from another one, `removed` to another one.
11
11
  */
12
12
  import { useSortable } from "@vueuse/integrations/useSortable";
13
- import { ref, watch } from "vue";
13
+ import { type VNode, ref, watch } from "vue";
14
14
 
15
15
  export interface SortableListChange<Item> {
16
16
  added?: { element: Item; newIndex: number };
@@ -44,7 +44,7 @@ const props = defineProps<{
44
44
  const emit = defineEmits<{ change: [change: SortableListChange<Item>] }>();
45
45
 
46
46
  defineSlots<{
47
- item(props: { element: Item; index: number }): unknown;
47
+ item(props: { element: Item; index: number }): VNode | VNode[];
48
48
  }>();
49
49
 
50
50
  /** What this list reads of SortableJS's events. */
@@ -1,9 +1,10 @@
1
1
  <script setup lang="ts" generic="T extends Data">
2
+ import { themeOverride } from "./tableComponentTheme";
2
3
  import { EYEBROW_CLASS } from "../../utils/eyebrow";
3
4
  import { injectLocal } from "@vueuse/core";
4
5
  import { tv } from "tailwind-variants";
5
6
  import type { ShallowRef } from "vue";
6
- import type { ComponentOptionsData } from "#dms-core/app/types/component";
7
+ import { isJsonObject } from "../../utils/json";
7
8
  import type {
8
9
  Data,
9
10
  TableFilter,
@@ -54,13 +55,11 @@ const tableSharedData =
54
55
  const { t } = useI18n();
55
56
  const { processI18n } = useTranslation();
56
57
 
57
- const appConfig = useDmsAppConfig() as ReturnType<typeof useDmsAppConfig> & {
58
- ui: { tableFiltersRow: Partial<typeof theme> };
59
- };
58
+ const appConfig = useDmsAppConfig();
60
59
 
61
60
  const uiVariant = tv({
62
61
  extend: tv(theme),
63
- ...appConfig.ui?.tableFiltersRow,
62
+ ...themeOverride("tableFiltersRow"),
64
63
  });
65
64
  const ui = computed(() => uiVariant());
66
65
 
@@ -99,13 +98,16 @@ const resolveFilterComponent = (filter: TableFilter) => {
99
98
  ? processI18n(opts.placeholder)
100
99
  : opts.placeholder;
101
100
  const items = Array.isArray(opts.items)
102
- ? opts.items.map((item) => {
103
- const obj = item as ComponentOptionsData;
104
- return {
105
- ...obj,
106
- label: isString(obj.label) ? processI18n(obj.label) : obj.label,
107
- };
108
- })
101
+ ? opts.items.map((item) =>
102
+ isJsonObject(item)
103
+ ? {
104
+ ...item,
105
+ label: isString(item.label)
106
+ ? processI18n(item.label)
107
+ : item.label,
108
+ }
109
+ : item,
110
+ )
109
111
  : opts.items;
110
112
 
111
113
  return { ...candidate, options: { ...opts, placeholder, items } };
@@ -145,8 +147,8 @@ const clearable = computed(
145
147
  const canClear = computed(
146
148
  () => !!clearable.value?.filters || !!clearable.value?.search,
147
149
  );
148
- const reset = () => {
149
- tableSharedData?.value?.resetFilters();
150
+ const reset = async () => {
151
+ await tableSharedData?.value?.resetFilters();
150
152
  };
151
153
 
152
154
  const addFilterOpen = ref(false);
@@ -171,10 +173,10 @@ const itemLabels = (filter: TableFilter): string | undefined => {
171
173
  const values = Array.isArray(filter.value) ? filter.value : [filter.value];
172
174
  const labels = values.map((value) => {
173
175
  const item = items.find(
174
- (candidate) =>
175
- (candidate as Pick<ComponentOptionsData, "value">)?.value === value,
176
- ) as Pick<ComponentOptionsData, "label"> | undefined;
177
- return item?.label !== undefined ? String(item.label) : String(value);
176
+ (candidate) => isJsonObject(candidate) && candidate.value === value,
177
+ );
178
+ const label = isJsonObject(item) ? item.label : undefined;
179
+ return label !== undefined ? String(label) : String(value);
178
180
  });
179
181
  return labels.length ? labels.join(", ") : undefined;
180
182
  };
@@ -6,6 +6,7 @@ import type { ShallowRef } from "vue";
6
6
 
7
7
  import type { TableSharedData, Data } from "./TableRoot.vue";
8
8
  import SortableList from "../sortable/SortableList.vue";
9
+ import { themeOverride } from "./tableComponentTheme";
9
10
 
10
11
  const theme = tv({
11
12
  slots: {
@@ -27,10 +28,6 @@ const tableSharedData =
27
28
 
28
29
  const { t } = useI18n();
29
30
 
30
- const appConfig = useDmsAppConfig() as ReturnType<typeof useDmsAppConfig> & {
31
- ui: { tableMenuColumn: Partial<typeof theme> };
32
- };
33
-
34
31
  const order = computed(
35
32
  () => tableSharedData?.value?.columnOrderState.value || [],
36
33
  );
@@ -88,7 +85,7 @@ function resetColumns() {
88
85
 
89
86
  const uiTableMenuColumnVariant = tv({
90
87
  extend: tv(theme),
91
- ...appConfig.ui?.tableMenuColumn,
88
+ ...themeOverride("tableMenuColumn"),
92
89
  });
93
90
  const uiTableMenuColumn = computed(() => uiTableMenuColumnVariant());
94
91
  </script>