@antelopejs/dms 0.18.2 → 0.19.1

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 (77) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +1 -1
  3. package/bin/control/backend.mjs +1 -1
  4. package/bin/control/base.mjs +24 -9
  5. package/bin/control/base.test.mjs +88 -0
  6. package/bin/control/browser-client.mjs +1 -1
  7. package/bin/control/commands-stack.mjs +8 -6
  8. package/bin/control/commands-verify.mjs +2 -2
  9. package/bin/control/consumer-install.test.mjs +86 -0
  10. package/bin/control/database.mjs +66 -0
  11. package/bin/control/doctor.mjs +7 -0
  12. package/bin/control/frontend-check.mjs +2 -1
  13. package/bin/control/frontend-mode.test.mjs +24 -0
  14. package/bin/control/identity.mjs +45 -16
  15. package/bin/control/journey.mjs +31 -3
  16. package/bin/control/journey.test.mjs +207 -2
  17. package/bin/control/launch.mjs +123 -0
  18. package/bin/control/module-root.mjs +40 -0
  19. package/bin/control/module-root.test.mjs +67 -0
  20. package/bin/control/mongo-server.test.mjs +91 -0
  21. package/bin/control/mongo.mjs +125 -12
  22. package/bin/control/namespaces.test.mjs +33 -0
  23. package/bin/control/options.mjs +1 -0
  24. package/bin/control/pid-reuse.test.mjs +278 -0
  25. package/bin/control/processes.mjs +91 -29
  26. package/bin/control/renderer.test.mjs +1 -1
  27. package/bin/control/run-copy.mjs +6 -1
  28. package/bin/control/run-state.mjs +31 -12
  29. package/bin/control/stack.mjs +86 -173
  30. package/bin/control/verify/behaviour.test.mjs +36 -23
  31. package/bin/control/verify/decode.mjs +1 -0
  32. package/bin/control/verify/emit.mjs +11 -11
  33. package/bin/control/verify/formal.mjs +29 -15
  34. package/bin/control/verify/formal.test.mjs +15 -0
  35. package/bin/control/verify/map.test.mjs +2 -6
  36. package/bin/control/verify/types.mjs +1 -1
  37. package/bin/control/verify/verdict.mjs +4 -4
  38. package/bin/dms-control.mjs +4 -2
  39. package/dist/attachments/save.js +2 -1
  40. package/dist/attachments/save.js.map +1 -1
  41. package/dist/db/models/userNotifications.model.js +14 -8
  42. package/dist/db/models/userNotifications.model.js.map +1 -1
  43. package/dist/pages/public/auth/not-a-member.d.ts +9 -0
  44. package/dist/pages/public/auth/not-a-member.js +27 -0
  45. package/dist/pages/public/auth/not-a-member.js.map +1 -0
  46. package/dist/pages/public/index.d.ts +1 -0
  47. package/dist/pages/public/index.js +1 -0
  48. package/dist/pages/public/index.js.map +1 -1
  49. package/dist/routes/auth/oauth/identity-resolution.js +10 -0
  50. package/dist/routes/auth/oauth/identity-resolution.js.map +1 -1
  51. package/dist/routes/onboarding.js +1 -5
  52. package/dist/routes/onboarding.js.map +1 -1
  53. package/dist/utils/ensure-default-tenant.js +23 -3
  54. package/dist/utils/ensure-default-tenant.js.map +1 -1
  55. package/frontend-vue/layers/dms-auth/app/build/utils/noWorkspaceRoute.ts +19 -0
  56. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/login.vue +4 -6
  57. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/not-a-member.vue +21 -0
  58. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/oauth-complete.vue +2 -4
  59. package/frontend-vue/layers/dms-auth/i18n/locales/auth-en-GB.json +6 -0
  60. package/frontend-vue/layers/dms-auth/i18n/locales/auth-fr-FR.json +6 -0
  61. package/frontend-vue/layers/dms-core/app/types/live.ts +2 -0
  62. package/frontend-vue/layers/dms-ui/app/build/components/containers/drawer/DynamicDrawer.vue +9 -3
  63. package/frontend-vue/layers/dms-ui/app/build/composables/live/currentPageLive.ts +7 -0
  64. package/frontend-vue/layers/dms-ui/app/build/composables/live/pageLiveController.ts +23 -3
  65. package/frontend-vue/layers/dms-ui/app/build/composables/live/usePageDataRefresh.ts +2 -1
  66. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewRealtime.ts +21 -2
  67. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableLiveHold.ts +4 -3
  68. package/frontend-vue/layers/dms-ui/app/build/utils/accessibilityPreferences.ts +1 -21
  69. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +8 -4
  70. package/frontend-vue/layers/dms-ui/app/build/utils/link.ts +35 -7
  71. package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +51 -8
  72. package/frontend-vue/layers/dms-ui/app/components/kpi/KpiCard.vue +3 -0
  73. package/frontend-vue/layers/dms-ui/app/composables/chart/types.ts +2 -0
  74. package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +1 -1
  75. package/frontend-vue/layers/dms-ui/app/utils/reducedMotion.ts +22 -0
  76. package/package.json +6 -6
  77. package/skills/dms-pages/REFERENCE.md +1 -1
@@ -4,6 +4,7 @@ import {
4
4
  computed,
5
5
  defineAsyncComponent,
6
6
  markRaw,
7
+ onBeforeUnmount,
7
8
  onMounted,
8
9
  ref,
9
10
  shallowRef,
@@ -29,8 +30,14 @@ interface Emits {
29
30
 
30
31
  /** The ApexCharts instance the wrapper exposes as `chart`. */
31
32
  interface ApexCore {
32
- /** Apex's own (debounced) window resize handler: redraws at the container width. */
33
- windowResizeHandler: () => void;
33
+ /**
34
+ * Apex's (debounced) redraw at the container width, the one its parent
35
+ * resize observer starts. Unlike its window resize handler it does not
36
+ * read `chart.redrawOnWindowResize`, which only opts out of window resizes.
37
+ */
38
+ _windowResize: () => void;
39
+ /** Apex's state: `animationEnded` is false while the chart is animating. */
40
+ w: { globals: { animationEnded: boolean } };
34
41
  }
35
42
 
36
43
  interface ApexChartInstance {
@@ -57,12 +64,20 @@ const ApexChart = defineAsyncComponent<Component>(async () => {
57
64
  return mod.default ?? mod;
58
65
  });
59
66
 
67
+ const hostRef = ref<HTMLElement | null>(null);
68
+ const chartRef = ref<ApexChartInstance | null>(null);
69
+ let hostResizes: ResizeObserver | undefined;
70
+
60
71
  onMounted(() => {
61
72
  void ensureApexLocale(locale.value).catch(() => undefined);
73
+ if (!hostRef.value) return;
74
+ hostResizes = new ResizeObserver(redrawIfResizedWhileIdle);
75
+ hostResizes.observe(hostRef.value);
62
76
  });
63
77
 
64
- const hostRef = ref<HTMLElement | null>(null);
65
- const chartRef = ref<ApexChartInstance | null>(null);
78
+ onBeforeUnmount(() => {
79
+ hostResizes?.disconnect();
80
+ });
66
81
 
67
82
  /**
68
83
  * A plain, non-reactive copy of a value handed to Apex. Apex writes into the
@@ -96,7 +111,24 @@ function rawApexInput<T extends object>(value: T): T {
96
111
 
97
112
  const apexSeries = computed(() => rawApexInput(props.series ?? []));
98
113
 
99
- const pinnedOptions = shallowRef<Props["options"]>(rawApexInput(props.options));
114
+ /**
115
+ * The options handed to Apex, its parent resize observer off. That observer
116
+ * redraws on any change of the host's size, height included, and a circular
117
+ * chart changes the height itself: Apex draws it at its configured height,
118
+ * then fits its box to the ring and legend, and the redraw that resize starts
119
+ * draws it at the configured height again. The donut redraws every 150ms or
120
+ * so for as long as the page is open, and a screenshot taken mid-redraw
121
+ * shows the ring off centre. The host redraws on width changes instead.
122
+ */
123
+ function apexOptions(options: Props["options"]): Props["options"] {
124
+ const chart = isObject(options.chart) ? options.chart : {};
125
+ return rawApexInput({
126
+ ...options,
127
+ chart: { ...chart, redrawOnParentResize: false },
128
+ });
129
+ }
130
+
131
+ const pinnedOptions = shallowRef<Props["options"]>(apexOptions(props.options));
100
132
 
101
133
  function pushOptionsWithoutGroupBroadcast(
102
134
  instance: ApexChartInstance,
@@ -104,7 +136,7 @@ function pushOptionsWithoutGroupBroadcast(
104
136
  ): void {
105
137
  void instance
106
138
  .updateOptions(
107
- rawApexInput(next),
139
+ apexOptions(next),
108
140
  REDRAW_PATHS,
109
141
  ANIMATE,
110
142
  UPDATE_SYNCED_CHARTS,
@@ -131,7 +163,7 @@ watch(
131
163
  (next, previous) => {
132
164
  const instance = chartRef.value;
133
165
  if (!instance || axisTypeOf(next) !== axisTypeOf(previous)) {
134
- pinnedOptions.value = rawApexInput(next);
166
+ pinnedOptions.value = apexOptions(next);
135
167
  return;
136
168
  }
137
169
  pushOptionsWithoutGroupBroadcast(instance, next);
@@ -160,7 +192,18 @@ function redrawIfResizedWhileAnimating() {
160
192
  const host = hostRef.value;
161
193
  const chart = chartRef.value?.chart;
162
194
  if (!host || !chart || !isDrawnAtStaleWidth(host)) return;
163
- chart.windowResizeHandler();
195
+ chart._windowResize();
196
+ }
197
+
198
+ /**
199
+ * The host's own resize observer, in place of Apex's: a chart drawn at
200
+ * another width than its host redraws, and a change of height alone, such as
201
+ * the one a circular chart makes when it fits its box, redraws nothing. While
202
+ * an animation runs the redraw waits for its end.
203
+ */
204
+ function redrawIfResizedWhileIdle() {
205
+ if (chartRef.value?.chart?.w.globals.animationEnded !== true) return;
206
+ redrawIfResizedWhileAnimating();
164
207
  }
165
208
  </script>
166
209
 
@@ -161,7 +161,10 @@ const hasSparkline = computed(
161
161
  () => props.showSparkline && sparkline.value.length > 0,
162
162
  );
163
163
 
164
+ const caption = computed(() => data.value?.caption);
165
+
164
166
  const footnote = computed(() => {
167
+ if (caption.value) return caption.value;
165
168
  const isComparing = delta.value !== null;
166
169
  const text = (isComparing && props.compareLabel) || props.description;
167
170
  if (text) return processI18n(text);
@@ -101,6 +101,8 @@ export interface KpiCardResponse {
101
101
  delta?: number;
102
102
  previousValue?: number;
103
103
  sparkline?: number[];
104
+ /** Shown in place of the description and the comparison label when non-empty. */
105
+ caption?: string;
104
106
  }
105
107
 
106
108
  export interface TopListItem {
@@ -33,7 +33,7 @@ import {
33
33
  toBucketSeries,
34
34
  type DatetimeBuckets,
35
35
  } from "./apexDatetimeBuckets";
36
- import { isReducedMotionActive } from "../../build/utils/accessibilityPreferences";
36
+ import { isReducedMotionActive } from "../../utils/reducedMotion";
37
37
  import {
38
38
  buildDataLabels,
39
39
  dataLabelOffset,
@@ -0,0 +1,22 @@
1
+ import { isFunction } from "../../../dms-core/app/utils/type-check";
2
+ import {
3
+ REDUCED_MOTION_QUERY,
4
+ reduceMotionFromClasses,
5
+ resolveReducedMotion,
6
+ } from "../build/utils/accessibilityPreferences";
7
+
8
+ /**
9
+ * Whether the page should skip JavaScript-driven motion right now: the
10
+ * `<html>` class when the user pinned a choice, the system otherwise. Always
11
+ * false on the server, which renders no animation.
12
+ */
13
+ export function isReducedMotionActive(): boolean {
14
+ const classList = globalThis.document?.documentElement?.classList;
15
+ if (!classList) return false;
16
+ const systemPrefersReduced =
17
+ isFunction(matchMedia) && matchMedia(REDUCED_MOTION_QUERY).matches;
18
+ return resolveReducedMotion(
19
+ reduceMotionFromClasses(classList),
20
+ systemPrefersReduced,
21
+ );
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/dms",
3
- "version": "0.18.2",
3
+ "version": "0.19.1",
4
4
  "description": "AntelopeJS DMS. Plug in your PostgreSQL, MongoDB or RethinkDB database and your coding agent builds a back office and analytics dashboard as typed TypeScript. Real-time updates on the data the DMS manages.",
5
5
  "keywords": [
6
6
  "antelopejs",
@@ -78,7 +78,7 @@
78
78
  "@antelopejs/interface-data-api": ">=0.6.0 <1.0.0",
79
79
  "@antelopejs/interface-database": ">=0.3.0 <1.0.0",
80
80
  "@antelopejs/interface-database-decorators": ">=0.2.0 <1.0.0",
81
- "@antelopejs/interface-dms": ">=0.12.0 <0.13.0",
81
+ "@antelopejs/interface-dms": ">=0.13.0 <0.14.0",
82
82
  "@antelopejs/interface-email": ">=0.0.6 <1.0.0",
83
83
  "@antelopejs/interface-file-storage": ">=0.1.4 <1.0.0",
84
84
  "archiver": "^7.0.1",
@@ -95,7 +95,7 @@
95
95
  },
96
96
  "devDependencies": {
97
97
  "@antelopejs/core": ">=1.21.0 <2",
98
- "@antelopejs/tooling-configs": "^0.3.3",
98
+ "@antelopejs/tooling-configs": "^0.5.0",
99
99
  "@types/archiver": "^6.0.4",
100
100
  "@types/chai": "^4.3.20",
101
101
  "@types/jsonwebtoken": "^9.0.10",
@@ -112,7 +112,6 @@
112
112
  "oxfmt": "^0.66.0",
113
113
  "oxlint": "1.81.0",
114
114
  "oxlint-tsgolint": "^7.0.2001",
115
- "playwright-core": "~1.56.1",
116
115
  "release-it": "^19.2.4",
117
116
  "release-it-changelogen": "^0.1.0",
118
117
  "rimraf": "^6.1.3",
@@ -140,7 +139,8 @@
140
139
  },
141
140
  "optionalDependencies": {
142
141
  "@antelopejs/interface-dms-automation": ">=0.6.0 <1.0.0",
143
- "@antelopejs/interface-redis": ">=0.0.9 <1.0.0"
142
+ "@antelopejs/interface-redis": ">=0.0.9 <1.0.0",
143
+ "playwright-core": "~1.56.1"
144
144
  },
145
145
  "peerDependencies": {
146
146
  "@antelopejs/core": ">=1.21.0 <2"
@@ -156,7 +156,7 @@
156
156
  "frontend:dev": "pnpm --dir playground frontend:dev",
157
157
  "frontend:build": "pnpm --dir playground frontend:build",
158
158
  "frontend:start": "pnpm --dir playground frontend:start",
159
- "typecheck": "node scripts/unless-prebuilt.mjs pnpm --filter @antelopejs/interface-dms build && tsc --noEmit",
159
+ "typecheck": "node scripts/unless-prebuilt.mjs pnpm --filter @antelopejs/interface-dms exec tsc && tsc --noEmit",
160
160
  "test": "node scripts/unless-prebuilt.mjs pnpm run build && NODE_OPTIONS=\"${NODE_OPTIONS:+$NODE_OPTIONS }--require=\\\"$PWD/scripts/backend-runtime-boundaries.cjs\\\"\" ajs module test .",
161
161
  "test:unit": "node scripts/unless-prebuilt.mjs pnpm run build && node scripts/backend-checks.cjs && node scripts/backend-checks.test.mjs && node scripts/docs-scripts.test.mjs && node scripts/json-record.test.mjs && DMS_TEST_DIR=dist/test/unit NODE_OPTIONS=\"${NODE_OPTIONS:+$NODE_OPTIONS }--require=\\\"$PWD/scripts/backend-runtime-boundaries.cjs\\\"\" ajs module test .",
162
162
  "test:integration": "node scripts/unless-prebuilt.mjs pnpm run build && DMS_TEST_DIR=dist/test/integration NODE_OPTIONS=\"${NODE_OPTIONS:+$NODE_OPTIONS }--require=\\\"$PWD/scripts/backend-runtime-boundaries.cjs\\\"\" ajs module test .",
@@ -138,7 +138,7 @@ row's ⋯ button — `docs/04.components/08.tables/0.index.md#pinned-rows`.
138
138
  an editor reads the default children from the block type's `initialChildren`.
139
139
  A component may draw `<DmsPageToolbarBlock>` and `<DmsLiveToggleBlock>` itself, around controls
140
140
  of its own: neither needs a `componentId` or `pageId` there.
141
- - `liveHold: true` keeps a table's rows while paused, and in Direct while they are on screen (new
141
+ - `liveHold: true` keeps a table's rows while paused, and in Direct while they are on screen unless `whileOnScreen: false` (new
142
142
  rows wait behind a "N new · Show" pill over the rows, counting the rows the table's query matches now beyond those held, through its count route); `liveHold: { whileRowOpen, whileScrolled,
143
143
  whileSearching, whileSorted }` also holds the table alone; `liveHold.missedLabel` words its "N new".
144
144
  Paused, an event counts as its `payload.ids` rows or its `payload.count`, so a module may batch