@declarion/react 0.40.4 → 0.42.0

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 (24) hide show
  1. package/dist-lib/{DraggableChildrenTable-BkqtkJuz.js → DraggableChildrenTable-G4Sw1XAD.js} +43 -43
  2. package/dist-lib/{Grid-CTxov4x2.js → Grid-CXn-IK3H.js} +2 -2
  3. package/dist-lib/{LayoutRenderer-Cbh-pY26.js → LayoutRenderer-DX8pFS5A.js} +906 -861
  4. package/dist-lib/MarkdownRenderer-CreI9x2m.js +85 -0
  5. package/dist-lib/{MonacoJson-BfpzZ1iT.js → MonacoJson-BG3S3GHX.js} +1 -1
  6. package/dist-lib/{RefreshControl-DG2kMABB.js → RefreshControl-DFh0-gCb.js} +59 -61
  7. package/dist-lib/{SmartDetailPage.impl-DCJ_V-Nh.js → SmartDetailPage.impl-K6Jj1-9z.js} +545 -545
  8. package/dist-lib/{SmartRecordListPage.impl-sYCMQw8V.js → SmartRecordListPage.impl-DQW_uVfL.js} +250 -250
  9. package/dist-lib/declarion-react.css +2 -2
  10. package/dist-lib/embed/useEmbedNavigate.d.ts +1 -1
  11. package/dist-lib/hooks/usePageStateTtl.d.ts +1 -1
  12. package/dist-lib/index.d.ts +1 -1
  13. package/dist-lib/index.js +1217 -1217
  14. package/dist-lib/lib/brand-tokens.d.ts +1 -1
  15. package/dist-lib/lib/evidence-verdict.d.ts +0 -1
  16. package/dist-lib/lib/safe-url.d.ts +14 -0
  17. package/dist-lib/{registry-DbZX1hy8.js → registry-r4hiflwC.js} +502 -502
  18. package/dist-lib/testing.js +43 -43
  19. package/dist-lib/types/api.d.ts +1 -1
  20. package/dist-lib/{useCurrentScreen-C33VZcNn.js → useCurrentScreen-CpQjVmrT.js} +1409 -1292
  21. package/dist-lib/{useProperties-BgAEk8X9.js → useProperties-CULxrNT4.js} +44 -44
  22. package/dist-lib/{value-VOi8Svry.js → value-fUHxMV4r.js} +20 -20
  23. package/package.json +23 -23
  24. package/dist-lib/MarkdownRenderer-DeguFsZL.js +0 -98
@@ -0,0 +1,85 @@
1
+ import { H as e, et as t } from "./useCurrentScreen-CpQjVmrT.js";
2
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
3
+ import i, { defaultUrlTransform as a } from "react-markdown";
4
+ import o from "remark-breaks";
5
+ import s from "remark-gfm";
6
+ //#region src/components/shared/MarkdownRenderer.tsx
7
+ var c = "prose prose-sm dark:prose-invert max-w-none break-words overflow-hidden", l = [o], u = [s];
8
+ function d(e) {
9
+ return e.startsWith("declarion://file/") ? e : a(e);
10
+ }
11
+ function f(e) {
12
+ return e.startsWith("/") || e.startsWith("https://") || e.startsWith("http://") ? e : null;
13
+ }
14
+ function p({ href: e, children: r }) {
15
+ return t(e) ? /* @__PURE__ */ n("a", {
16
+ href: e,
17
+ target: "_blank",
18
+ rel: "noopener noreferrer",
19
+ children: r
20
+ }) : /* @__PURE__ */ n("a", {
21
+ href: e,
22
+ children: r
23
+ });
24
+ }
25
+ function m(t) {
26
+ return {
27
+ img({ src: i, alt: a }) {
28
+ let o = e(i);
29
+ if (!o) return /* @__PURE__ */ n("img", {
30
+ src: i,
31
+ alt: a ?? ""
32
+ });
33
+ let s = t[o], c = s?.presigned_url ?? s?.url, l = c ? f(c) : null;
34
+ return l ? /* @__PURE__ */ n("img", {
35
+ src: l,
36
+ alt: a ?? s.filename ?? ""
37
+ }) : /* @__PURE__ */ r("span", {
38
+ style: {
39
+ color: "var(--warn)",
40
+ fontSize: 12
41
+ },
42
+ children: ["Missing image ", o]
43
+ });
44
+ },
45
+ a({ href: i, children: a }) {
46
+ let o = e(i);
47
+ if (!o) return /* @__PURE__ */ n(p, {
48
+ href: i,
49
+ children: a
50
+ });
51
+ let s = t[o], c = s?.presigned_url ?? s?.url, l = c ? f(c) : null;
52
+ return l ? /* @__PURE__ */ n("a", {
53
+ href: l,
54
+ target: "_blank",
55
+ rel: "noreferrer",
56
+ children: a
57
+ }) : /* @__PURE__ */ r("span", {
58
+ style: {
59
+ color: "var(--warn)",
60
+ fontSize: 12
61
+ },
62
+ children: ["Missing file ", o]
63
+ });
64
+ }
65
+ };
66
+ }
67
+ function h({ content: e, plugins: t = "breaks", files: r, components: a, skipHtml: o = !0, prose: s = !0 }) {
68
+ let f = /* @__PURE__ */ n(i, {
69
+ skipHtml: o,
70
+ remarkPlugins: t === "gfm" ? u : l,
71
+ components: {
72
+ a: p,
73
+ ...r ? m(r) : {},
74
+ ...a
75
+ },
76
+ urlTransform: r ? d : void 0,
77
+ children: e
78
+ });
79
+ return s ? /* @__PURE__ */ n("div", {
80
+ className: c,
81
+ children: f
82
+ }) : f;
83
+ }
84
+ //#endregion
85
+ export { h as MarkdownRenderer };
@@ -1,7 +1,7 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import t, { DiffEditor as n, loader as r } from "@monaco-editor/react";
3
3
  import * as i from "monaco-editor";
4
- import a from "monaco-editor/esm/vs/editor/editor.worker.js?worker";
4
+ import a from "monaco-editor/editor/editor.worker.js?worker";
5
5
  //#region src/components/detail-layout/widgets/monacoBootstrap.ts
6
6
  var o = !1;
7
7
  function s() {
@@ -1,7 +1,7 @@
1
1
  import { s as e } from "./DynamicIcon-DeRpAaXm.js";
2
- import { Ct as t, In as n, Kt as r, Mt as i, Tn as a, Xn as o, Yn as s, cr as c, ht as l, i as u, ir as d, mt as f, or as p, sr as m, xt as h } from "./useCurrentScreen-C33VZcNn.js";
2
+ import { Gt as t, Ln as n, St as r, Xn as i, Zn as a, ar as o, bt as s, cr as c, i as l, jt as u, lr as d, mt as f, pt as p, sr as m, wn as h } from "./useCurrentScreen-CpQjVmrT.js";
3
3
  import { useCallback as g, useEffect as _, useId as v, useMemo as y, useRef as b, useState as x } from "react";
4
- import { useLocation as S } from "react-router-dom";
4
+ import { useLocation as S } from "react-router";
5
5
  import { useQuery as C, useQueryClient as w } from "@tanstack/react-query";
6
6
  import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
7
7
  import { createPortal as ee } from "react-dom";
@@ -182,70 +182,70 @@ function le(e) {
182
182
  //#endregion
183
183
  //#region src/api/params.ts
184
184
  async function ue() {
185
- let e = (await r("/api/params/public")).data;
185
+ let e = (await t("/api/params/public")).data;
186
186
  if (Array.isArray(e)) return { parameters: e };
187
- let t = e ?? {};
187
+ let n = e ?? {};
188
188
  return {
189
- parameters: t.parameters ?? [],
190
- accents: t.accents,
191
- messages: t.messages,
192
- meta: t.meta
189
+ parameters: n.parameters ?? [],
190
+ accents: n.accents,
191
+ messages: n.messages,
192
+ meta: n.meta
193
193
  };
194
194
  }
195
195
  async function z(e) {
196
- return (await r(`/api/params/${encodeURIComponent(e)}`)).data;
196
+ return (await t(`/api/params/${encodeURIComponent(e)}`)).data;
197
197
  }
198
198
  async function de(e) {
199
- return (await r(`/api/params${e === "tenant" ? "?resolution=tenant" : ""}`)).data ?? [];
199
+ return (await t(`/api/params${e === "tenant" ? "?resolution=tenant" : ""}`)).data ?? [];
200
200
  }
201
201
  //#endregion
202
202
  //#region src/hooks/useParams.ts
203
203
  var B = "$params";
204
- function fe({ carrierEntityCode: e, rowId: n, enabled: r = !0, onWritten: i }) {
205
- let a = w(), [o, s] = x(null), c = C({
204
+ function fe({ carrierEntityCode: e, rowId: t, enabled: n = !0, onWritten: i }) {
205
+ let a = w(), [o, c] = x(null), l = C({
206
206
  queryKey: [
207
207
  "params-carrier-detail",
208
208
  e,
209
- n
209
+ t
210
210
  ],
211
- queryFn: () => t(e, n),
212
- enabled: r && !!n,
211
+ queryFn: () => r(e, t),
212
+ enabled: n && !!t,
213
213
  staleTime: 30 * 1e3
214
- }), l = c.data?.data, u = !!l && !("$params" in l), d = y(() => Array.isArray(l?.$params) ? l[B] : [], [l]), f = y(() => new Map(d.map((e) => [e.param_code, e])), [d]), p = g(async (t) => {
215
- s(null);
214
+ }), u = l.data?.data, d = !!u && !("$params" in u), f = y(() => Array.isArray(u?.$params) ? u[B] : [], [u]), p = y(() => new Map(f.map((e) => [e.param_code, e])), [f]), m = g(async (n) => {
215
+ c(null);
216
216
  try {
217
- await h(`${e}.__update`, {
218
- object_ids: [n],
217
+ await s(`${e}.__update`, {
218
+ object_ids: [t],
219
219
  entity: e,
220
- fields: { [B]: t }
220
+ fields: { [B]: n }
221
221
  }), await a.invalidateQueries({ queryKey: ["params-all"] }), await a.invalidateQueries({ queryKey: [
222
222
  "params-carrier-detail",
223
223
  e,
224
- n
224
+ t
225
225
  ] }), i?.();
226
226
  } catch (e) {
227
- s(e instanceof Error ? e.message : "Failed to save parameter.");
227
+ c(e instanceof Error ? e.message : "Failed to save parameter.");
228
228
  }
229
229
  }, [
230
230
  e,
231
- n,
231
+ t,
232
232
  a,
233
233
  i
234
- ]), m = g((e, t) => {
235
- let n = d.filter((t) => t.param_code !== e.code);
234
+ ]), h = g((e, t) => {
235
+ let n = f.filter((t) => t.param_code !== e.code);
236
236
  return n.push({
237
237
  param_code: e.code,
238
238
  value: t
239
- }), p(n);
240
- }, [d, p]), _ = g((e) => p(d.filter((t) => t.param_code !== e.code)), [d, p]), v = g(() => s(null), []);
239
+ }), m(n);
240
+ }, [f, m]), _ = g((e) => m(f.filter((t) => t.param_code !== e.code)), [f, m]), v = g(() => c(null), []);
241
241
  return {
242
- overrides: d,
243
- overrideByCode: f,
244
- missingParams: u,
245
- isLoading: c.isLoading,
242
+ overrides: f,
243
+ overrideByCode: p,
244
+ missingParams: d,
245
+ isLoading: l.isLoading,
246
246
  error: o,
247
247
  clearError: v,
248
- save: m,
248
+ save: h,
249
249
  reset: _
250
250
  };
251
251
  }
@@ -273,7 +273,7 @@ function me(e, t = {}) {
273
273
  });
274
274
  }
275
275
  function H(e) {
276
- let t = i((e) => e.isAuthenticated), n = V(), r = me(e, { enabled: t }), a = he(n.data?.parameters, e);
276
+ let t = u((e) => e.isAuthenticated), n = V(), r = me(e, { enabled: t }), i = he(n.data?.parameters, e);
277
277
  if (t && r.data?.found) return {
278
278
  value: r.data.value,
279
279
  found: !0,
@@ -281,11 +281,11 @@ function H(e) {
281
281
  loading: !1,
282
282
  error: null
283
283
  };
284
- let o = a !== void 0;
284
+ let a = i !== void 0;
285
285
  return {
286
- value: a?.value,
287
- found: o,
288
- source: o ? "public" : void 0,
286
+ value: i?.value,
287
+ found: a,
288
+ source: a ? "public" : void 0,
289
289
  loading: n.isLoading || t && r.isLoading && !r.data && !r.error,
290
290
  error: r.error ?? n.error ?? null
291
291
  };
@@ -454,7 +454,7 @@ function ye(e) {
454
454
  }
455
455
  function Q(e) {
456
456
  let t = ye(e.pathname), n = e.search ?? "", r = n.startsWith("?") ? n.slice(1) : n, i = new URLSearchParams(r);
457
- for (let e of l) i.delete(e);
457
+ for (let e of f) i.delete(e);
458
458
  i.sort();
459
459
  let a = i.toString();
460
460
  return a ? `${t}?${a}` : t;
@@ -512,11 +512,11 @@ var Oe = "record-documents";
512
512
  //#endregion
513
513
  //#region src/hooks/useBrandingChrome.ts
514
514
  function ke() {
515
- let e = f(), t = G();
515
+ let e = p(), t = G();
516
516
  return (e.enabled ? t?.embed?.viewport : t?.full?.viewport) ?? "auto";
517
517
  }
518
518
  function Ae(e) {
519
- let t = f(), n = G();
519
+ let t = p(), n = G();
520
520
  return y(() => {
521
521
  let r = { ...t.enabled ? n?.embed?.surfaces?.[e] : n?.full?.surfaces?.[e] };
522
522
  return {
@@ -558,10 +558,10 @@ function Pe(e, t) {
558
558
  //#endregion
559
559
  //#region src/components/pages/DocumentsMenu.tsx
560
560
  var Fe = "document-templates-available";
561
- function Ie({ entityCode: t, scope: n, objectIds: r = [], viewState: i, selectedIds: s = [], capability: l, canManageTemplates: f = !1 }) {
562
- let { run: p } = u(), m = b(null), [g, _] = x(!1), v = n === "detail" ? !!l?.generate_one : !!l?.generate_many, S = f && !v, { data: w, isLoading: ee, error: O } = C({
561
+ function Ie({ entityCode: t, scope: n, objectIds: r = [], viewState: i, selectedIds: c = [], capability: u, canManageTemplates: f = !1 }) {
562
+ let { run: p } = l(), m = b(null), [g, _] = x(!1), v = n === "detail" ? !!u?.generate_one : !!u?.generate_many, S = f && !v, { data: w, isLoading: ee, error: O } = C({
563
563
  queryKey: [Fe, t],
564
- queryFn: async () => (await h("document.templates.available", { entity: t })).result?.templates ?? [],
564
+ queryFn: async () => (await s("document.templates.available", { entity: t })).result?.templates ?? [],
565
565
  enabled: g || S,
566
566
  staleTime: 6e4
567
567
  }), k = ee, A = y(() => (w ?? []).filter((e) => n === "detail" ? e.input_mode === "one" || e.input_mode === "global" : e.input_mode === "many" || e.input_mode === "global"), [n, w]), j = S && A.length > 0, M = v || j;
@@ -579,15 +579,15 @@ function Ie({ entityCode: t, scope: n, objectIds: r = [], viewState: i, selected
579
579
  return i && e.push({
580
580
  kind: "current_view",
581
581
  query: Ne(i)
582
- }), s.length > 0 && e.push({
582
+ }), c.length > 0 && e.push({
583
583
  kind: "selected",
584
- objectIds: s
584
+ objectIds: c
585
585
  }), e;
586
586
  }
587
587
  return [];
588
588
  }
589
589
  function F(e, t, n) {
590
- let r = Le(e), i = a(e.name) || e.code;
590
+ let r = Le(e), i = h(e.name) || e.code;
591
591
  _(!1), p({
592
592
  action: r,
593
593
  title: i,
@@ -600,11 +600,11 @@ function Ie({ entityCode: t, scope: n, objectIds: r = [], viewState: i, selected
600
600
  return Object.keys(r).length > 0 && (i.params = r), "objectIds" in t && (i.object_ids = t.objectIds), "query" in t && (i.query = {
601
601
  scope: "current_view",
602
602
  query: t.query
603
- }), h("document.generate", i);
603
+ }), s("document.generate", i);
604
604
  }
605
605
  });
606
606
  }
607
- return M ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(c, {
607
+ return M ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(d, {
608
608
  ref: m,
609
609
  kind: "ghost",
610
610
  size: "sm",
@@ -612,36 +612,36 @@ function Ie({ entityCode: t, scope: n, objectIds: r = [], viewState: i, selected
612
612
  onClick: N,
613
613
  disabled: k,
614
614
  children: "Generate"
615
- }), /* @__PURE__ */ D(d, {
615
+ }), /* @__PURE__ */ D(o, {
616
616
  open: g,
617
617
  anchor: m.current,
618
618
  onClose: () => _(!1),
619
619
  align: "end",
620
620
  width: 300,
621
621
  children: [
622
- k && /* @__PURE__ */ E(o, {
622
+ k && /* @__PURE__ */ E(a, {
623
623
  disabled: !0,
624
624
  icon: /* @__PURE__ */ E(e.loader, { size: 12 }),
625
625
  children: "Loading templates..."
626
626
  }),
627
- O && /* @__PURE__ */ E(o, {
627
+ O && /* @__PURE__ */ E(a, {
628
628
  disabled: !0,
629
629
  icon: /* @__PURE__ */ E(e.warning, { size: 12 }),
630
630
  children: O instanceof Error ? O.message : String(O)
631
631
  }),
632
- !k && !O && A.length === 0 && /* @__PURE__ */ E(o, {
632
+ !k && !O && A.length === 0 && /* @__PURE__ */ E(a, {
633
633
  disabled: !0,
634
634
  icon: /* @__PURE__ */ E(e.file, { size: 12 }),
635
635
  children: "No document templates"
636
636
  }),
637
637
  !k && !O && A.map((t) => {
638
638
  let n = P(t);
639
- return n.length === 0 ? null : Re(t).flatMap((r) => n.map((n) => r.available ? /* @__PURE__ */ E(o, {
639
+ return n.length === 0 ? null : Re(t).flatMap((r) => n.map((n) => r.available ? /* @__PURE__ */ E(a, {
640
640
  icon: /* @__PURE__ */ E(e.file, { size: 12 }),
641
641
  onClick: () => F(t, n, r.format),
642
- title: a(t.description),
642
+ title: h(t.description),
643
643
  children: ze(t, n, r.format)
644
- }, `${t.source}:${t.code}:${n.kind}:${r.format}`) : /* @__PURE__ */ D(o, {
644
+ }, `${t.source}:${t.code}:${n.kind}:${r.format}`) : /* @__PURE__ */ D(a, {
645
645
  disabled: !0,
646
646
  icon: /* @__PURE__ */ E(e.file, { size: 12 }),
647
647
  title: r.disabled_reason,
@@ -677,7 +677,7 @@ function Re(e) {
677
677
  }));
678
678
  }
679
679
  function ze(e, t, n) {
680
- let r = a(e.name) || e.code, i = n ? ` (${n.toUpperCase()})` : "";
680
+ let r = h(e.name) || e.code, i = n ? ` (${n.toUpperCase()})` : "";
681
681
  switch (t.kind) {
682
682
  case "one": return `${r}${i}`;
683
683
  case "selected": return `${r}${i} - selected rows`;
@@ -864,14 +864,12 @@ var nt = {
864
864
  verified: "Verified",
865
865
  unverified: "Not yet verified",
866
866
  tampered: "Tampered",
867
- erased: "Lawfully erased",
868
867
  indeterminate: "Cannot verify",
869
868
  outside_coverage: "Outside coverage"
870
869
  }, rt = {
871
870
  verified: "emerald",
872
871
  unverified: "slate",
873
872
  tampered: "rose",
874
- erased: "slate",
875
873
  indeterminate: "amber",
876
874
  outside_coverage: "slate"
877
875
  };
@@ -890,11 +888,11 @@ function ot({ liveObject: t, realtime: n = !0 }) {
890
888
  alignItems: "center",
891
889
  gap: 8
892
890
  },
893
- children: [/* @__PURE__ */ E(m, {
891
+ children: [/* @__PURE__ */ E(c, {
894
892
  icon: t.isFetching ? /* @__PURE__ */ E("span", {
895
893
  "data-testid": "refresh-spinner",
896
894
  style: { display: "inline-flex" },
897
- children: /* @__PURE__ */ E(s, { size: 14 })
895
+ children: /* @__PURE__ */ E(i, { size: 14 })
898
896
  }) : /* @__PURE__ */ E(e.refresh, { size: 14 }),
899
897
  title: "Refresh",
900
898
  disabled: t.isLoading || t.isFetching,
@@ -904,7 +902,7 @@ function ot({ liveObject: t, realtime: n = !0 }) {
904
902
  }), n && /* @__PURE__ */ E("span", {
905
903
  "data-testid": "live-indicator",
906
904
  title: t.isLive ? "This view updates automatically in realtime." : "Realtime updates are paused. Refresh manually to load the latest data.",
907
- children: /* @__PURE__ */ E(p, {
905
+ children: /* @__PURE__ */ E(m, {
908
906
  tone: t.isLive ? "emerald" : "amber",
909
907
  size: "xs",
910
908
  dot: !0,