@declarion/react 0.54.0 → 0.54.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 (35) hide show
  1. package/dist-lib/{DraggableChildrenTable-CPoUY99R.js → DraggableChildrenTable-Djc7QDzR.js} +32 -32
  2. package/dist-lib/{Grid--QAEby8k.js → Grid-Bd2r0_4J.js} +45 -45
  3. package/dist-lib/{LayoutRenderer-BxZ7Nd9b.js → LayoutRenderer-V6nf9aa_.js} +716 -714
  4. package/dist-lib/{ListCardsBody-BPV4GPrv.js → ListCardsBody-Cdsvu0Vs.js} +29 -29
  5. package/dist-lib/{MarkdownRenderer-CIKuh_0i.js → MarkdownRenderer-CZo5ZgM7.js} +1 -1
  6. package/dist-lib/{RefreshControl-DMLkZP3R.js → RefreshControl-CJm3vz9p.js} +40 -40
  7. package/dist-lib/{SmartDetailPage.impl-SnNu6Ug-.js → SmartDetailPage.impl-DoIjCzjQ.js} +492 -492
  8. package/dist-lib/{SmartListPage.impl-C73pR7Iw.js → SmartListPage.impl-DnM8e14t.js} +743 -742
  9. package/dist-lib/{SmartRecordListPage.impl-rJjQZe1V.js → SmartRecordListPage.impl-BmHGYbD9.js} +128 -128
  10. package/dist-lib/{SortHeaderMenu-DQ_KrkWk.js → SortHeaderMenu-CA53NerB.js} +1 -1
  11. package/dist-lib/{action-dispatch-DsuUS7ae.js → action-dispatch-JcUrLFaW.js} +177 -177
  12. package/dist-lib/api/events.d.ts +13 -4
  13. package/dist-lib/{cardProjection-BadzqyeQ.js → cardProjection-Q2kwqv8V.js} +19 -19
  14. package/dist-lib/components/pages/list/ListToolbar.d.ts +5 -3
  15. package/dist-lib/components/pages/list/useListQuery.d.ts +1 -5
  16. package/dist-lib/{field-classification-sMkkAEg9.js → field-classification-ssZvtr8J.js} +268 -397
  17. package/dist-lib/{format-count-B5SLlNOb.js → format-count-DHuivNT7.js} +236 -236
  18. package/dist-lib/hooks/useEntityData.d.ts +7 -0
  19. package/dist-lib/hooks/useRealtimeThresholds.d.ts +1 -0
  20. package/dist-lib/hooks/useSSE.d.ts +0 -1
  21. package/dist-lib/index.js +806 -806
  22. package/dist-lib/lib/realtime-query-keys.d.ts +22 -0
  23. package/dist-lib/lib/realtime-reconcile.d.ts +0 -9
  24. package/dist-lib/lib/realtime-resync.d.ts +23 -0
  25. package/dist-lib/{peekDraftStore-CbHFwz_F.js → peekDraftStore-lm9ViVLA.js} +17 -17
  26. package/dist-lib/{registry-D0RhCnEL.js → registry-DsQFhEAD.js} +511 -511
  27. package/dist-lib/stores/realtime.d.ts +86 -19
  28. package/dist-lib/testing.js +40 -40
  29. package/dist-lib/{useCurrentScreen-DVTXCj_K.js → useCurrentScreen-aHx9HH1m.js} +2472 -1963
  30. package/dist-lib/useListQuery-DZn2BAxY.js +96 -0
  31. package/dist-lib/{useProperties-BcIz-MyO.js → useProperties-CAqKmUKg.js} +25 -25
  32. package/dist-lib/{useTabSearchMirror-UYCsopxP.js → useTabSearchMirror-DYW9WoK7.js} +10 -10
  33. package/dist-lib/{value-CQzGOI0F.js → value-CzKQPJOp.js} +4 -4
  34. package/package.json +4 -4
  35. package/dist-lib/useListQuery-C2nq58YV.js +0 -90
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Every list-shaped cache the SDK ships. The REFETCH-ONLY kind is the cursor
3
+ * list, whose cold tables a key does not prune. docs/realtime.md.
4
+ */
5
+ export declare const NARROWED_LIST_CACHE_KEYS: readonly ["entity-data", "entity-data-all"];
6
+ export declare const REFETCH_ONLY_LIST_CACHE_KEYS: readonly ["entity-data-cursor"];
7
+ export declare const LIST_CACHE_KEYS: readonly string[];
8
+ /**
9
+ * The entity code backing RecordDocumentsPanel's realtime flip, declared once
10
+ * so the "generated_document" ↔ RECORD_DOCUMENTS_KEY link is a single fact.
11
+ */
12
+ export declare const GENERATED_DOCUMENT_ENTITY = "generated_document";
13
+ export declare function isListCacheKey(key: readonly unknown[]): boolean;
14
+ export declare function isRefetchOnlyListKey(key: readonly unknown[]): boolean;
15
+ /** A list, count or detail cache: the queries whose rows ARE an entity's rows. */
16
+ export declare function isEntityRowsKey(key: readonly unknown[]): boolean;
17
+ /**
18
+ * The entity whose frames keep this cache fresh, or null when realtime does not
19
+ * keep it - the one list of realtime-backed caches.
20
+ */
21
+ export declare function entityOfRealtimeQueryKey(key: readonly unknown[]): string | null;
22
+ export declare function isRealtimeBackedQueryKey(key: readonly unknown[]): boolean;
@@ -5,14 +5,6 @@
5
5
  */
6
6
  import type { QueryClient } from "@tanstack/react-query";
7
7
  import type { ListParams } from "../types/api";
8
- /**
9
- * Every list-shaped cache the SDK ships, stated once and read by the reconciler
10
- * and its tests alike. The REFETCH-ONLY kind is the cursor list, whose cold
11
- * tables a key does not prune. docs/realtime.md.
12
- */
13
- export declare const NARROWED_LIST_CACHE_KEYS: readonly ["entity-data", "entity-data-all"];
14
- export declare const REFETCH_ONLY_LIST_CACHE_KEYS: readonly ["entity-data-cursor"];
15
- export declare const LIST_CACHE_KEYS: readonly string[];
16
8
  /** One row a frame named, plus whether every frame naming it said `created`. */
17
9
  export interface ChangedRow {
18
10
  pk: Record<string, string>;
@@ -40,4 +32,3 @@ export declare function reconcileListCaches(queryClient: QueryClient, entity: st
40
32
  * inside the deployment's own page ceiling and cannot be clamped.
41
33
  */
42
34
  export declare function narrowedParams(params: ListParams, rows: ChangedRow[]): ListParams;
43
- export declare function isListCacheKey(key: readonly unknown[]): boolean;
@@ -0,0 +1,23 @@
1
+ import { type QueryClient, type QueryKey } from "@tanstack/react-query";
2
+ import { type ResyncScope } from "../stores/realtime";
3
+ export interface ResyncRequest {
4
+ scope: ResyncScope;
5
+ /** The fixed keys of a `keys` scope. */
6
+ keys?: readonly QueryKey[];
7
+ standing?: boolean;
8
+ jitter?: boolean;
9
+ carriedMarks?: ReadonlyMap<string, number>;
10
+ }
11
+ /**
12
+ * Opens a resync over the keys the request names, taking the current fetch
13
+ * generation. An `all` request folds into an `all` resync not yet issued: that
14
+ * one re-reads everything already, and a fold moves its generation forward so
15
+ * nothing fetched before the newer cause satisfies it.
16
+ */
17
+ export declare function openResync(queryClient: QueryClient, request: ResyncRequest): void;
18
+ /**
19
+ * Mounts the engine for this client for as long as the caller is mounted -
20
+ * outside any SSE connection, so a token refresh, a tab hide or a reconnect
21
+ * leaves every obligation where it was.
22
+ */
23
+ export declare function useResyncEngine(queryClient: QueryClient): void;
@@ -1,5 +1,5 @@
1
1
  import { s as e } from "./DynamicIcon-DW5krHuX.js";
2
- import { Dr as t, Ir as n, Mr as r, Yt as i, Zn as a, i as o, ur as s, wr as c } from "./useCurrentScreen-DVTXCj_K.js";
2
+ import { Lr as t, Mr as n, Vr as r, en as i, hr as a, i as o, kr as s, nr as c } from "./useCurrentScreen-aHx9HH1m.js";
3
3
  import { useMemo as l, useRef as u, useState as d } from "react";
4
4
  import { useQuery as f } from "@tanstack/react-query";
5
5
  import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
@@ -21,10 +21,10 @@ function v(e, t) {
21
21
  //#endregion
22
22
  //#region src/components/pages/DocumentsMenu.tsx
23
23
  var y = "document-templates-available";
24
- function b({ entityCode: s, scope: g, objectIds: v = [], viewState: b, selectedIds: w = [], capability: T, canManageTemplates: E = !1 }) {
24
+ function b({ entityCode: a, scope: g, objectIds: v = [], viewState: b, selectedIds: w = [], capability: T, canManageTemplates: E = !1 }) {
25
25
  let { run: D } = o(), O = u(null), [k, A] = d(!1), j = g === "detail" ? !!T?.generate_one : !!T?.generate_many, M = E && !j, { data: N, isLoading: P, error: F } = f({
26
- queryKey: [y, s],
27
- queryFn: async () => (await i("document.templates.available", { entity: s })).result?.templates ?? [],
26
+ queryKey: [y, a],
27
+ queryFn: async () => (await i("document.templates.available", { entity: a })).result?.templates ?? [],
28
28
  enabled: k || M,
29
29
  staleTime: 6e4
30
30
  }), I = P, L = l(() => (N ?? []).filter((e) => g === "detail" ? e.input_mode === "one" || e.input_mode === "global" : e.input_mode === "many" || e.input_mode === "global"), [g, N]), R = M && L.length > 0, z = j || R;
@@ -50,10 +50,10 @@ function b({ entityCode: s, scope: g, objectIds: v = [], viewState: b, selectedI
50
50
  return [];
51
51
  }
52
52
  function H(e, t, n) {
53
- let r = x(e), o = a(e.name) || e.code;
53
+ let r = x(e), a = c(e.name) || e.code;
54
54
  A(!1), D({
55
55
  action: r,
56
- title: o,
56
+ title: a,
57
57
  execute: (r) => {
58
58
  let a = {
59
59
  template_code: e.code,
@@ -67,8 +67,8 @@ function b({ entityCode: s, scope: g, objectIds: v = [], viewState: b, selectedI
67
67
  }
68
68
  });
69
69
  }
70
- let { isPhone: U } = t();
71
- return z ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(n, {
70
+ let { isPhone: U } = n();
71
+ return z ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(r, {
72
72
  ref: O,
73
73
  kind: "ghost",
74
74
  size: "sm",
@@ -78,36 +78,36 @@ function b({ entityCode: s, scope: g, objectIds: v = [], viewState: b, selectedI
78
78
  "aria-label": "Generate",
79
79
  title: "Generate",
80
80
  children: U ? null : "Generate"
81
- }), /* @__PURE__ */ h(r, {
81
+ }), /* @__PURE__ */ h(t, {
82
82
  open: k,
83
83
  anchor: O.current,
84
84
  onClose: () => A(!1),
85
85
  align: "end",
86
86
  width: 300,
87
87
  children: [
88
- I && /* @__PURE__ */ m(c, {
88
+ I && /* @__PURE__ */ m(s, {
89
89
  disabled: !0,
90
90
  icon: /* @__PURE__ */ m(e.loader, { size: 12 }),
91
91
  children: "Loading templates..."
92
92
  }),
93
- F && /* @__PURE__ */ m(c, {
93
+ F && /* @__PURE__ */ m(s, {
94
94
  disabled: !0,
95
95
  icon: /* @__PURE__ */ m(e.warning, { size: 12 }),
96
96
  children: F instanceof Error ? F.message : String(F)
97
97
  }),
98
- !I && !F && L.length === 0 && /* @__PURE__ */ m(c, {
98
+ !I && !F && L.length === 0 && /* @__PURE__ */ m(s, {
99
99
  disabled: !0,
100
100
  icon: /* @__PURE__ */ m(e.file, { size: 12 }),
101
101
  children: "No document templates"
102
102
  }),
103
103
  !I && !F && L.map((t) => {
104
104
  let n = V(t);
105
- return n.length === 0 ? null : S(t).flatMap((r) => n.map((n) => r.available ? /* @__PURE__ */ m(c, {
105
+ return n.length === 0 ? null : S(t).flatMap((r) => n.map((n) => r.available ? /* @__PURE__ */ m(s, {
106
106
  icon: /* @__PURE__ */ m(e.file, { size: 12 }),
107
107
  onClick: () => H(t, n, r.format),
108
- title: a(t.description),
108
+ title: c(t.description),
109
109
  children: C(t, n, r.format)
110
- }, `${t.source}:${t.code}:${n.kind}:${r.format}`) : /* @__PURE__ */ h(c, {
110
+ }, `${t.source}:${t.code}:${n.kind}:${r.format}`) : /* @__PURE__ */ h(s, {
111
111
  disabled: !0,
112
112
  icon: /* @__PURE__ */ m(e.file, { size: 12 }),
113
113
  title: r.disabled_reason,
@@ -122,7 +122,7 @@ function b({ entityCode: s, scope: g, objectIds: v = [], viewState: b, selectedI
122
122
  })] }) : null;
123
123
  }
124
124
  function x(e) {
125
- let t = new s((e.params ?? []).map((e) => ({
125
+ let t = new a((e.params ?? []).map((e) => ({
126
126
  ...e,
127
127
  name: e.name ?? ""
128
128
  })));
@@ -143,7 +143,7 @@ function S(e) {
143
143
  }));
144
144
  }
145
145
  function C(e, t, n) {
146
- let r = a(e.name) || e.code, i = n ? ` (${n.toUpperCase()})` : "";
146
+ let r = c(e.name) || e.code, i = n ? ` (${n.toUpperCase()})` : "";
147
147
  switch (t.kind) {
148
148
  case "one": return `${r}${i}`;
149
149
  case "selected": return `${r}${i} - selected rows`;