@declarion/react 0.34.0 → 0.35.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 (40) hide show
  1. package/README.md +1 -1
  2. package/dist-lib/{ActionRunner-UGGvGypS.js → ActionRunner-Bkkb_YMa.js} +1176 -1287
  3. package/dist-lib/{DraggableChildrenTable-CljdYXd_.js → DraggableChildrenTable-TNni9y0Q.js} +39 -39
  4. package/dist-lib/{Grid-5Y_iPqNW.js → Grid-DOtBLx3n.js} +2 -2
  5. package/dist-lib/{JsonEditor-KelPV-OQ.js → JsonEditor-DoNmyrYd.js} +2 -2
  6. package/dist-lib/{LayoutRenderer-CoTMmvNW.js → LayoutRenderer-CMuVgKev.js} +407 -405
  7. package/dist-lib/{MarkdownRenderer-unbncYEV.js → MarkdownRenderer-DWOlvx8k.js} +1 -1
  8. package/dist-lib/{MonacoJson-DVjwsaBK.js → MonacoJson-BfpzZ1iT.js} +1 -1
  9. package/dist-lib/{RefreshControl-oeKhCjEC.js → RefreshControl-CgU8mNEp.js} +92 -94
  10. package/dist-lib/{SmartDetailPage.impl-Caxd97q6.js → SmartDetailPage.impl-Bjl7EFzU.js} +321 -318
  11. package/dist-lib/{SmartRecordListPage.impl-BF_ieDc2.js → SmartRecordListPage.impl-D2eE-g5J.js} +248 -248
  12. package/dist-lib/assets/OFL-Inter.txt +93 -0
  13. package/dist-lib/assets/OFL-JetBrainsMono.txt +93 -0
  14. package/dist-lib/assets/inter-latin-ext-wght-normal.woff2 +0 -0
  15. package/dist-lib/assets/inter-latin-wght-normal.woff2 +0 -0
  16. package/dist-lib/assets/jetbrains-mono-latin-ext-wght-normal.woff2 +0 -0
  17. package/dist-lib/assets/jetbrains-mono-latin-wght-normal.woff2 +0 -0
  18. package/dist-lib/components/fields/cells/factories/host-icons.d.ts +9 -1
  19. package/dist-lib/components/layout/TopBar.d.ts +2 -1
  20. package/dist-lib/components/pages/list/DataCell.d.ts +1 -2
  21. package/dist-lib/components/primitives/Btn.d.ts +1 -1
  22. package/dist-lib/declarion-react.css +1 -1
  23. package/dist-lib/embed/theme.d.ts +8 -8
  24. package/dist-lib/hooks/useBrandingChrome.d.ts +28 -2
  25. package/dist-lib/hooks/useResponsiveMode.d.ts +17 -1
  26. package/dist-lib/index.js +1971 -1936
  27. package/dist-lib/lib/brand-tokens.d.ts +43 -0
  28. package/dist-lib/lib/html-state.d.ts +11 -0
  29. package/dist-lib/lib/versionTracker.d.ts +6 -0
  30. package/dist-lib/{registry-DnPK3Msj.js → registry-GTwsJEYp.js} +1425 -1299
  31. package/dist-lib/stores/page-state.d.ts +1 -1
  32. package/dist-lib/stores/preferences.d.ts +37 -0
  33. package/dist-lib/testing.js +25 -25
  34. package/dist-lib/types/api.d.ts +96 -16
  35. package/dist-lib/types/schema.d.ts +15 -0
  36. package/dist-lib/{useProperties-CgRhBh0k.js → useProperties-oNGJ7HwM.js} +41 -41
  37. package/dist-lib/{value-GmL5BVFm.js → value-DNs5L0Ad.js} +97 -97
  38. package/dist-lib/vite/fingerprint-plugin.d.ts +1 -1
  39. package/package.json +17 -16
  40. package/dist-lib/stores/appearance.d.ts +0 -37
@@ -1,11 +1,68 @@
1
- import { Ht as e, Rt as t, zt as n } from "./ActionRunner-UGGvGypS.js";
1
+ import { Lt as e, Rt as t, Vt as n } from "./ActionRunner-Bkkb_YMa.js";
2
2
  import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
3
+ //#region src/embed/file-src.ts
4
+ var s = "/api/files";
5
+ function c(e) {
6
+ if (typeof e != "object" || !e) return !1;
7
+ let t = e;
8
+ return typeof t.url == "string" && typeof t.proxy == "boolean";
9
+ }
10
+ function l(e, t) {
11
+ let n = encodeURIComponent(e);
12
+ return typeof t == "object" ? `${s}/${n}/derived/${encodeURIComponent(t.derivation)}/url` : `${s}/${n}/url`;
13
+ }
14
+ var u = class extends Error {
15
+ fileId;
16
+ key;
17
+ constructor(e, t) {
18
+ super(`derivation "${t}" of file ${e} is still generating`), this.fileId = e, this.key = t, this.name = "DerivationPendingError";
19
+ }
20
+ };
21
+ function d(e, t) {
22
+ return {
23
+ method: "GET",
24
+ credentials: "omit",
25
+ headers: { Authorization: `Bearer ${e}` },
26
+ signal: t
27
+ };
28
+ }
29
+ function f(e) {
30
+ return `${e}${e.includes("?") ? "&" : "?"}disposition=attachment`;
31
+ }
32
+ async function p(n, r) {
33
+ let i = await e(), a = await fetch(n, d(i, r));
34
+ if (a.status !== 401) return a;
35
+ t();
36
+ let o = await e();
37
+ return fetch(n, d(o, r));
38
+ }
39
+ async function m(e, t, r) {
40
+ if (!n()) throw Error("resolveEmbedFileSrc called outside embed token mode");
41
+ let i = await p(l(e, t), r);
42
+ if (i.status === 202 && typeof t == "object") throw new u(e, t.derivation);
43
+ if (!i.ok) throw Error(`embed file url request failed: ${i.status} ${i.statusText}`);
44
+ let a = await i.json();
45
+ if (!c(a)) throw Error("embed file url response is malformed");
46
+ if (!a.proxy) return {
47
+ url: a.url,
48
+ kind: "direct"
49
+ };
50
+ if (!a.url.startsWith("/api/files/")) throw Error(`embed file proxy: refusing non-files-route URL ${JSON.stringify(a.url)}`);
51
+ let o = await p(t === "download" ? f(a.url) : a.url, r);
52
+ if (!o.ok) throw Error(`embed file proxy fetch failed: ${o.status} ${o.statusText}`);
53
+ let s = await o.blob();
54
+ return {
55
+ url: URL.createObjectURL(s),
56
+ kind: "blob"
57
+ };
58
+ }
59
+ //#endregion
3
60
  //#region src/components/file-widgets/helpers.ts
4
- var s = ["thumb_200", "thumb_300"];
5
- function c() {
61
+ var h = ["thumb_200", "thumb_300"];
62
+ function g() {
6
63
  return typeof navigator > "u" ? ["en"] : (navigator.languages?.length ? navigator.languages : [navigator.language]).filter((e) => typeof e == "string" && e.length > 0);
7
64
  }
8
- function l(e, t) {
65
+ function _(e, t) {
9
66
  for (let n of t) {
10
67
  if (e[n]) return e[n];
11
68
  let t = n.split("-")[0];
@@ -13,17 +70,17 @@ function l(e, t) {
13
70
  }
14
71
  for (let t of Object.values(e)) if (typeof t == "string" && t.length > 0) return t;
15
72
  }
16
- function u(e, t, n) {
73
+ function v(e, t, n) {
17
74
  if (t) return t;
18
75
  let r = e?.metadata?.alt_text;
19
76
  if (typeof r == "string" && r.length > 0) return r;
20
77
  if (r && typeof r == "object" && !Array.isArray(r)) {
21
- let e = l(Object.fromEntries(Object.entries(r).filter((e) => e[0].length > 0 && typeof e[1] == "string")), c());
78
+ let e = _(Object.fromEntries(Object.entries(r).filter((e) => e[0].length > 0 && typeof e[1] == "string")), g());
22
79
  if (e) return e;
23
80
  }
24
81
  return n;
25
82
  }
26
- var d = /* @__PURE__ */ new Set([
83
+ var y = /* @__PURE__ */ new Set([
27
84
  "image/png",
28
85
  "image/jpeg",
29
86
  "image/webp",
@@ -31,30 +88,30 @@ var d = /* @__PURE__ */ new Set([
31
88
  "image/avif",
32
89
  "application/pdf"
33
90
  ]);
34
- function f(e) {
91
+ function b(e) {
35
92
  let t = e.content_type?.toLowerCase().split(";")[0]?.trim() ?? "";
36
- return d.has(t);
93
+ return y.has(t);
37
94
  }
38
- function p(e) {
95
+ function x(e) {
39
96
  return e.url ?? e.presigned_url;
40
97
  }
41
- function m(e) {
42
- return e.url ? _(e.url, "attachment") : e.presigned_url;
98
+ function S(e) {
99
+ return e.url ? T(e.url, "attachment") : e.presigned_url;
43
100
  }
44
- function h(e, t) {
101
+ function C(e, t) {
45
102
  if (!e) return;
46
103
  let n = e.derivations ?? {};
47
104
  if (t && n[t]) return n[t];
48
- for (let e of s) if (n[e]) return n[e];
105
+ for (let e of h) if (n[e]) return n[e];
49
106
  return e.url ?? e.presigned_url;
50
107
  }
51
- function g(e, t) {
108
+ function w(e, t) {
52
109
  let n = e?.derivations ?? {};
53
110
  if (t && n[t]) return { derivation: t };
54
- for (let e of s) if (n[e]) return { derivation: e };
111
+ for (let e of h) if (n[e]) return { derivation: e };
55
112
  return "preview";
56
113
  }
57
- function _(e, t) {
114
+ function T(e, t) {
58
115
  try {
59
116
  let n = new URL(e, typeof window < "u" ? window.location.origin : "http://localhost");
60
117
  return n.searchParams.set("disposition", t), /^https?:\/\//i.test(e) ? n.toString() : `${n.pathname}${n.search}${n.hash}`;
@@ -62,7 +119,7 @@ function _(e, t) {
62
119
  return `${e}${e.includes("?") ? "&" : "?"}disposition=${t}`;
63
120
  }
64
121
  }
65
- function v(e) {
122
+ function E(e) {
66
123
  let t = e?.metadata?.focal_point;
67
124
  if (!t || typeof t != "object" || Array.isArray(t)) return null;
68
125
  let n = t, r = typeof n.x == "number" ? n.x : NaN, i = typeof n.y == "number" ? n.y : NaN;
@@ -71,10 +128,10 @@ function v(e) {
71
128
  y: i
72
129
  };
73
130
  }
74
- function y(e) {
131
+ function D(e) {
75
132
  if (e) return `${e.x * 100}% ${e.y * 100}%`;
76
133
  }
77
- function b(e, t) {
134
+ function O(e, t) {
78
135
  return {
79
136
  ...e,
80
137
  metadata: {
@@ -84,63 +141,6 @@ function b(e, t) {
84
141
  };
85
142
  }
86
143
  //#endregion
87
- //#region src/embed/file-src.ts
88
- var x = "/api/files";
89
- function S(e) {
90
- if (typeof e != "object" || !e) return !1;
91
- let t = e;
92
- return typeof t.url == "string" && typeof t.proxy == "boolean";
93
- }
94
- function C(e, t) {
95
- let n = encodeURIComponent(e);
96
- return typeof t == "object" ? `${x}/${n}/derived/${encodeURIComponent(t.derivation)}/url` : `${x}/${n}/url`;
97
- }
98
- var w = class extends Error {
99
- fileId;
100
- key;
101
- constructor(e, t) {
102
- super(`derivation "${t}" of file ${e} is still generating`), this.fileId = e, this.key = t, this.name = "DerivationPendingError";
103
- }
104
- };
105
- function T(e, t) {
106
- return {
107
- method: "GET",
108
- credentials: "omit",
109
- headers: { Authorization: `Bearer ${e}` },
110
- signal: t
111
- };
112
- }
113
- function E(e) {
114
- return `${e}${e.includes("?") ? "&" : "?"}disposition=attachment`;
115
- }
116
- async function D(e, r) {
117
- let i = await t(), a = await fetch(e, T(i, r));
118
- if (a.status !== 401) return a;
119
- n();
120
- let o = await t();
121
- return fetch(e, T(o, r));
122
- }
123
- async function O(t, n, r) {
124
- if (!e()) throw Error("resolveEmbedFileSrc called outside embed token mode");
125
- let i = await D(C(t, n), r);
126
- if (i.status === 202 && typeof n == "object") throw new w(t, n.derivation);
127
- if (!i.ok) throw Error(`embed file url request failed: ${i.status} ${i.statusText}`);
128
- let a = await i.json();
129
- if (!S(a)) throw Error("embed file url response is malformed");
130
- if (!a.proxy) return {
131
- url: a.url,
132
- kind: "direct"
133
- };
134
- if (!a.url.startsWith("/api/files/")) throw Error(`embed file proxy: refusing non-files-route URL ${JSON.stringify(a.url)}`);
135
- let o = await D(n === "download" ? E(a.url) : a.url, r);
136
- if (!o.ok) throw Error(`embed file proxy fetch failed: ${o.status} ${o.statusText}`);
137
- let s = await o.blob();
138
- return {
139
- url: URL.createObjectURL(s),
140
- kind: "blob"
141
- };
142
- }
143
- //#endregion
144
144
  //#region src/components/file-widgets/useEmbedFileSrc.ts
145
145
  function k(e) {
146
146
  return typeof e == "object" ? `derivation:${e.derivation}` : e;
@@ -148,50 +148,50 @@ function k(e) {
148
148
  function A(e) {
149
149
  return e.startsWith("derivation:") ? { derivation: e.slice(11) } : e === "download" ? "download" : "preview";
150
150
  }
151
- function j(t, n, r) {
152
- let a = k(n), [s, c] = o(() => e() ? void 0 : r);
151
+ function j(e, t, r) {
152
+ let a = k(t), [s, c] = o(() => n() ? void 0 : r);
153
153
  return i(() => {
154
- e() || c(r);
154
+ n() || c(r);
155
155
  }, [r]), i(() => {
156
- if (!e()) return;
157
- if (!t) {
156
+ if (!n()) return;
157
+ if (!e) {
158
158
  c(void 0);
159
159
  return;
160
160
  }
161
- let n = null, r = !1, i = new AbortController();
162
- return c(void 0), O(t, A(a), i.signal).then((e) => {
161
+ let t = null, r = !1, i = new AbortController();
162
+ return c(void 0), m(e, A(a), i.signal).then((e) => {
163
163
  if (r) {
164
164
  e.kind === "blob" && URL.revokeObjectURL(e.url);
165
165
  return;
166
166
  }
167
- e.kind === "blob" && (n = e.url), c(e.url);
167
+ e.kind === "blob" && (t = e.url), c(e.url);
168
168
  }).catch((e) => {
169
169
  if (!r) {
170
- if (e instanceof w) {
170
+ if (e instanceof u) {
171
171
  c(void 0);
172
172
  return;
173
173
  }
174
174
  e instanceof DOMException && e.name === "AbortError" || (console.error("[declarion-embed] file src resolution failed:", e), c(void 0));
175
175
  }
176
176
  }), () => {
177
- r = !0, i.abort(), n && URL.revokeObjectURL(n);
177
+ r = !0, i.abort(), t && URL.revokeObjectURL(t);
178
178
  };
179
- }, [t, a]), s;
179
+ }, [e, a]), s;
180
180
  }
181
181
  function M() {
182
- let t = a([]);
182
+ let e = a([]);
183
183
  return i(() => () => {
184
- for (let e of t.current) URL.revokeObjectURL(e);
185
- t.current = [];
186
- }, []), { open: r((n, r, i) => {
187
- if (!e()) {
184
+ for (let t of e.current) URL.revokeObjectURL(t);
185
+ e.current = [];
186
+ }, []), { open: r((t, r, i) => {
187
+ if (!n()) {
188
188
  i && window.open(i, "_blank", "noopener");
189
189
  return;
190
190
  }
191
- n && O(n, r).then((e) => {
192
- e.kind === "blob" && t.current.push(e.url), window.open(e.url, "_blank", "noopener");
191
+ t && m(t, r).then((t) => {
192
+ t.kind === "blob" && e.current.push(t.url), window.open(t.url, "_blank", "noopener");
193
193
  }).catch((e) => {
194
- e instanceof w || console.error("[declarion-embed] file open failed:", e);
194
+ e instanceof u || console.error("[declarion-embed] file open failed:", e);
195
195
  });
196
196
  }, []) };
197
197
  }
@@ -207,4 +207,4 @@ function F(e) {
207
207
  return e ? Array.isArray(e) ? e.filter(N) : N(e) ? [e] : [] : [];
208
208
  }
209
209
  //#endregion
210
- export { f as a, h as c, v as d, u as f, j as i, g as l, P as n, m as o, b as p, M as r, y as s, F as t, p as u };
210
+ export { b as a, C as c, E as d, v as f, j as i, w as l, P as n, S as o, O as p, M as r, D as s, F as t, x as u };
@@ -1,4 +1,4 @@
1
- import type { Plugin } from "vite";
1
+ import type { Plugin } from "../vite";
2
2
  export interface DeclarionFingerprintPluginOptions {
3
3
  /**
4
4
  * Subdirectory of `outDir` to walk. Defaults to "assets" — Vite's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declarion/react",
3
- "version": "0.34.0",
3
+ "version": "0.35.1",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "React SDK for Declarion, the schema-driven business apps platform.",
@@ -58,26 +58,26 @@
58
58
  "@dnd-kit/sortable": "^10.0.0",
59
59
  "@dnd-kit/utilities": "^3.2.2",
60
60
  "@monaco-editor/react": "^4.7.0",
61
- "@radix-ui/react-alert-dialog": "^1.1.17",
62
- "@radix-ui/react-dialog": "^1.1.17",
63
- "@radix-ui/react-dropdown-menu": "^2.1.18",
64
- "@radix-ui/react-label": "^2.1.10",
65
- "@radix-ui/react-select": "^2.3.1",
66
- "@radix-ui/react-separator": "^1.1.10",
61
+ "@radix-ui/react-alert-dialog": "^1.1.18",
62
+ "@radix-ui/react-dialog": "^1.1.18",
63
+ "@radix-ui/react-dropdown-menu": "^2.1.19",
64
+ "@radix-ui/react-label": "^2.1.11",
65
+ "@radix-ui/react-select": "^2.3.2",
66
+ "@radix-ui/react-separator": "^1.1.11",
67
67
  "@radix-ui/react-slot": "^1.3.0",
68
68
  "@tanstack/react-query": "^5.101.2",
69
69
  "@tanstack/react-table": "^8.21.3",
70
- "@tanstack/react-virtual": "^3.14.4",
70
+ "@tanstack/react-virtual": "^3.14.5",
71
71
  "class-variance-authority": "^0.7.1",
72
72
  "clsx": "^2.1.1",
73
73
  "date-fns": "^4.4.0",
74
- "lucide-react": "^1.22.0",
74
+ "lucide-react": "^1.23.0",
75
75
  "mdast-util-to-string": "^4.0.0",
76
76
  "monaco-editor": "^0.55.1",
77
77
  "react-markdown": "^10.1.0",
78
78
  "react-router-dom": "^7.18.1",
79
79
  "react-textarea-autosize": "^8.5.9",
80
- "recharts": "^3.9.0",
80
+ "recharts": "^3.9.2",
81
81
  "remark-breaks": "^4.0.0",
82
82
  "remark-gfm": "^4.0.1",
83
83
  "remark-parse": "^11.0.0",
@@ -98,7 +98,7 @@
98
98
  "@types/react": "^19.2.17",
99
99
  "@types/react-dom": "^19.2.3",
100
100
  "@vitejs/plugin-react": "^6.0.3",
101
- "@vitest/coverage-v8": "^4.1.9",
101
+ "@vitest/coverage-v8": "^4.1.10",
102
102
  "axe-core": "^4.12.1",
103
103
  "eslint": "^10.6.0",
104
104
  "eslint-plugin-react-hooks": "^7.1.1",
@@ -108,17 +108,18 @@
108
108
  "react": "^19.2.7",
109
109
  "react-dom": "^19.2.7",
110
110
  "tailwindcss": "^4.3.2",
111
- "tsc-alias": "^1.8.17",
111
+ "tsc-alias": "^1.9.0",
112
112
  "typescript": "^6.0.3",
113
- "typescript-eslint": "^8.62.1",
114
- "vite": "^8.1.0",
115
- "vitest": "^4.1.9"
113
+ "typescript-eslint": "^8.63.0",
114
+ "vite": "^8.1.3",
115
+ "vitest": "^4.1.10"
116
116
  },
117
117
  "scripts": {
118
118
  "dev": "vite",
119
119
  "build": "tsc -p tsconfig.app.json --noEmit && vite build",
120
- "build:lib": "vite build --config vite.lib.config.ts && vite build --config vite.plugin.config.ts && tsc -p tsconfig.lib.json && tsc-alias -p tsconfig.lib.json && pnpm run check:bundle && pnpm run check:pkg",
120
+ "build:lib": "vite build --config vite.lib.config.ts && vite build --config vite.plugin.config.ts && tsc -p tsconfig.lib.json && tsc-alias -p tsconfig.lib.json && pnpm run check:bundle && pnpm run check:fonts && pnpm run check:pkg",
121
121
  "check:bundle": "node scripts/check-eager-bundle.mjs",
122
+ "check:fonts": "node scripts/check-fonts.mjs",
122
123
  "check:pkg": "publint run",
123
124
  "lint": "tsc --noEmit && eslint src --max-warnings=0",
124
125
  "test": "vitest run",
@@ -1,37 +0,0 @@
1
- export type ThemeId = "light" | "dark";
2
- export type AccentId = "violet" | "blue" | "teal" | "amber" | "rose";
3
- export type Density = "compact" | "comfortable" | "cozy";
4
- export type SidebarMode = "wide" | "collapsed";
5
- export type TabsPosition = "top" | "bottom";
6
- export type AiSurface = "command" | "panel" | "both" | "off";
7
- export type FaviconSource = "google" | "direct" | "none";
8
- export type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
9
- export interface Appearance {
10
- theme: ThemeId;
11
- accent: AccentId;
12
- density: Density;
13
- sidebar: SidebarMode;
14
- tabsPosition: TabsPosition;
15
- tabsMaxOpen: number;
16
- /** When false, tabs are not persisted across reloads (mirrors ui_tabs_persist). */
17
- tabsPersist: boolean;
18
- radius: number;
19
- zebra: boolean;
20
- aiSurface: AiSurface;
21
- /** Favicon source for unknown hosts in URL cells. See ui_favicon_source. */
22
- faviconSource: FaviconSource;
23
- /** Where toasts appear. Read by <Toaster> in app.tsx. See ui_toast_position. */
24
- toastPosition: ToastPosition;
25
- }
26
- export declare function applyAppearance(a: Appearance): void;
27
- interface AppearanceState extends Appearance {
28
- set: <K extends keyof Appearance>(key: K, value: Appearance[K]) => void;
29
- setMany: (patch: Partial<Appearance>) => void;
30
- /** Apply tenant defaults from server params. ONLY fills keys the user has
31
- * not already set locally — any field present in localStorage wins.
32
- * That preserves the user's Tweaks choices across reloads while still
33
- * picking up tenant defaults on first visit. */
34
- hydrateFromParams: (params: Record<string, unknown>) => void;
35
- }
36
- export declare const useAppearanceStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AppearanceState>>;
37
- export {};