@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.
- package/dist-lib/{DraggableChildrenTable-BkqtkJuz.js → DraggableChildrenTable-G4Sw1XAD.js} +43 -43
- package/dist-lib/{Grid-CTxov4x2.js → Grid-CXn-IK3H.js} +2 -2
- package/dist-lib/{LayoutRenderer-Cbh-pY26.js → LayoutRenderer-DX8pFS5A.js} +906 -861
- package/dist-lib/MarkdownRenderer-CreI9x2m.js +85 -0
- package/dist-lib/{MonacoJson-BfpzZ1iT.js → MonacoJson-BG3S3GHX.js} +1 -1
- package/dist-lib/{RefreshControl-DG2kMABB.js → RefreshControl-DFh0-gCb.js} +59 -61
- package/dist-lib/{SmartDetailPage.impl-DCJ_V-Nh.js → SmartDetailPage.impl-K6Jj1-9z.js} +545 -545
- package/dist-lib/{SmartRecordListPage.impl-sYCMQw8V.js → SmartRecordListPage.impl-DQW_uVfL.js} +250 -250
- package/dist-lib/declarion-react.css +2 -2
- package/dist-lib/embed/useEmbedNavigate.d.ts +1 -1
- package/dist-lib/hooks/usePageStateTtl.d.ts +1 -1
- package/dist-lib/index.d.ts +1 -1
- package/dist-lib/index.js +1217 -1217
- package/dist-lib/lib/brand-tokens.d.ts +1 -1
- package/dist-lib/lib/evidence-verdict.d.ts +0 -1
- package/dist-lib/lib/safe-url.d.ts +14 -0
- package/dist-lib/{registry-DbZX1hy8.js → registry-r4hiflwC.js} +502 -502
- package/dist-lib/testing.js +43 -43
- package/dist-lib/types/api.d.ts +1 -1
- package/dist-lib/{useCurrentScreen-C33VZcNn.js → useCurrentScreen-CpQjVmrT.js} +1409 -1292
- package/dist-lib/{useProperties-BgAEk8X9.js → useProperties-CULxrNT4.js} +44 -44
- package/dist-lib/{value-VOi8Svry.js → value-fUHxMV4r.js} +20 -20
- package/package.json +23 -23
- package/dist-lib/MarkdownRenderer-DeguFsZL.js +0 -98
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ut as c } from "./registry-
|
|
1
|
+
import { Gt as e, In as t, Kt as n, bt as r, pn as i, pt as a, rt as o, wn as s } from "./useCurrentScreen-CpQjVmrT.js";
|
|
2
|
+
import { ut as c } from "./registry-r4hiflwC.js";
|
|
3
3
|
import { useEffect as l, useLayoutEffect as u, useMemo as d } from "react";
|
|
4
|
-
import { useSearchParams as f } from "react-router
|
|
4
|
+
import { useSearchParams as f } from "react-router";
|
|
5
5
|
import { useInfiniteQuery as p, useMutation as m, useQueryClient as h } from "@tanstack/react-query";
|
|
6
6
|
//#region src/api/entities.ts
|
|
7
7
|
function g(e, t) {
|
|
@@ -46,18 +46,18 @@ var x = class {
|
|
|
46
46
|
constructor(e, t) {
|
|
47
47
|
this.entity = e, this.refs = t ?? new y();
|
|
48
48
|
}
|
|
49
|
-
async get(
|
|
50
|
-
let n = new URLSearchParams(typeof
|
|
51
|
-
return v((await
|
|
49
|
+
async get(t) {
|
|
50
|
+
let n = new URLSearchParams(typeof t == "string" ? { id: t } : t);
|
|
51
|
+
return v((await e(`/api/data/${this.entity}?${n.toString()}`)).data);
|
|
52
52
|
}
|
|
53
|
-
async list(
|
|
53
|
+
async list(t = {}) {
|
|
54
54
|
let n, r = !1;
|
|
55
55
|
try {
|
|
56
|
-
n = await
|
|
56
|
+
n = await e(b(this.entity, t));
|
|
57
57
|
} catch (a) {
|
|
58
|
-
if (
|
|
59
|
-
let { after: i, ...a } =
|
|
60
|
-
n = await
|
|
58
|
+
if (t.after && i(a)) {
|
|
59
|
+
let { after: i, ...a } = t;
|
|
60
|
+
n = await e(b(this.entity, a)), r = !0;
|
|
61
61
|
} else throw a;
|
|
62
62
|
}
|
|
63
63
|
return this.refs.merge(n.$refs), {
|
|
@@ -72,7 +72,7 @@ var x = class {
|
|
|
72
72
|
}
|
|
73
73
|
async createMany(e) {
|
|
74
74
|
if (e.length === 0) return [];
|
|
75
|
-
let t = await
|
|
75
|
+
let t = await n("system.batch", {
|
|
76
76
|
actions: e.map((e) => ({
|
|
77
77
|
action: `${this.entity}.__create`,
|
|
78
78
|
params: {
|
|
@@ -92,7 +92,7 @@ var x = class {
|
|
|
92
92
|
}
|
|
93
93
|
async updateMany(e) {
|
|
94
94
|
if (e.length === 0) return [];
|
|
95
|
-
let t = await
|
|
95
|
+
let t = await n("system.batch", {
|
|
96
96
|
actions: e.map(({ id: e, ...t }) => ({
|
|
97
97
|
action: `${this.entity}.__update`,
|
|
98
98
|
params: {
|
|
@@ -109,7 +109,7 @@ var x = class {
|
|
|
109
109
|
await this.deleteMany([e]);
|
|
110
110
|
}
|
|
111
111
|
async deleteMany(e) {
|
|
112
|
-
return e.length === 0 ? { count: 0 } : { count: (await
|
|
112
|
+
return e.length === 0 ? { count: 0 } : { count: (await r(`${this.entity}.__delete`, {
|
|
113
113
|
object_ids: e,
|
|
114
114
|
entity: this.entity
|
|
115
115
|
})).object_count ?? e.length };
|
|
@@ -118,7 +118,7 @@ var x = class {
|
|
|
118
118
|
await this.restoreMany([e]);
|
|
119
119
|
}
|
|
120
120
|
async restoreMany(e) {
|
|
121
|
-
return e.length === 0 ? { count: 0 } : { count: (await
|
|
121
|
+
return e.length === 0 ? { count: 0 } : { count: (await r(`${this.entity}.__restore`, {
|
|
122
122
|
object_ids: e,
|
|
123
123
|
entity: this.entity
|
|
124
124
|
})).object_count ?? e.length };
|
|
@@ -128,7 +128,7 @@ var x = class {
|
|
|
128
128
|
}
|
|
129
129
|
async upsertMany(e, t) {
|
|
130
130
|
if (e.length === 0) return [];
|
|
131
|
-
let
|
|
131
|
+
let r = await n("system.batch", {
|
|
132
132
|
actions: e.map((e) => ({
|
|
133
133
|
action: `${this.entity}.__upsert`,
|
|
134
134
|
params: {
|
|
@@ -139,7 +139,7 @@ var x = class {
|
|
|
139
139
|
})),
|
|
140
140
|
atomic: !0
|
|
141
141
|
});
|
|
142
|
-
return S(
|
|
142
|
+
return S(r, `${this.entity}.__upsert`), r.results.map((e) => v(w(e)));
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
function S(e, t) {
|
|
@@ -263,9 +263,9 @@ function j(e, t, n, r) {
|
|
|
263
263
|
i.enabled
|
|
264
264
|
]);
|
|
265
265
|
}
|
|
266
|
-
function M(e, t,
|
|
267
|
-
let
|
|
268
|
-
j(t ?
|
|
266
|
+
function M(e, t, n) {
|
|
267
|
+
let r = e?.route, i = t ? s(e?.display?.name) || s(t.display.name_plural) : "", a = e?.display?.icon || t?.display.icon;
|
|
268
|
+
j(t ? r : void 0, i, a, n);
|
|
269
269
|
}
|
|
270
270
|
//#endregion
|
|
271
271
|
//#region src/lib/filters.ts
|
|
@@ -328,18 +328,18 @@ function z(e) {
|
|
|
328
328
|
function B(e) {
|
|
329
329
|
return z(e).length;
|
|
330
330
|
}
|
|
331
|
-
function V(
|
|
332
|
-
if (!
|
|
333
|
-
let r = F[
|
|
334
|
-
if (N.has(
|
|
335
|
-
let i =
|
|
331
|
+
function V(e, n) {
|
|
332
|
+
if (!e.field || !e.op) return "";
|
|
333
|
+
let r = F[e.op] || e.op;
|
|
334
|
+
if (N.has(e.op)) return `${r}`;
|
|
335
|
+
let i = e.field, a = (e) => {
|
|
336
336
|
if (n) {
|
|
337
|
-
let
|
|
338
|
-
return
|
|
337
|
+
let t = n(i, e);
|
|
338
|
+
return t.label != null && (t.status === "special" || t.status === "resolved") ? t.label : t.raw;
|
|
339
339
|
}
|
|
340
|
-
return e
|
|
340
|
+
return t(e);
|
|
341
341
|
};
|
|
342
|
-
return `${r} ${Array.isArray(
|
|
342
|
+
return `${r} ${Array.isArray(e.value) ? e.value.map(a).join(", ") : a(e.value)}`;
|
|
343
343
|
}
|
|
344
344
|
function H(e, t) {
|
|
345
345
|
return {
|
|
@@ -373,18 +373,18 @@ function U(e, t) {
|
|
|
373
373
|
}
|
|
374
374
|
//#endregion
|
|
375
375
|
//#region src/api/status.ts
|
|
376
|
-
async function W(e, t, n,
|
|
377
|
-
let
|
|
376
|
+
async function W(e, t, n, i, a) {
|
|
377
|
+
let o = {
|
|
378
378
|
status_group_code: n,
|
|
379
|
-
status_code:
|
|
379
|
+
status_code: i
|
|
380
380
|
};
|
|
381
|
-
|
|
382
|
-
let
|
|
381
|
+
a != null && (o.note = a);
|
|
382
|
+
let s = (await r(`${e}.__update`, {
|
|
383
383
|
object_ids: [t],
|
|
384
384
|
entity: e,
|
|
385
|
-
fields: { $statuses: [
|
|
385
|
+
fields: { $statuses: [o] }
|
|
386
386
|
})).result?.rows?.[0]?.$statuses ?? [];
|
|
387
|
-
return
|
|
387
|
+
return s.find((e) => e.group_code === n) ?? s[0];
|
|
388
388
|
}
|
|
389
389
|
//#endregion
|
|
390
390
|
//#region src/hooks/useObjectStatus.ts
|
|
@@ -396,25 +396,25 @@ function G(e, t) {
|
|
|
396
396
|
n.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
397
397
|
},
|
|
398
398
|
onError: (e) => {
|
|
399
|
-
|
|
399
|
+
o.error(e.message);
|
|
400
400
|
}
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
403
|
//#endregion
|
|
404
404
|
//#region src/api/properties.ts
|
|
405
|
-
async function K(e, t, n,
|
|
406
|
-
let
|
|
405
|
+
async function K(e, t, n, i) {
|
|
406
|
+
let a = (await r(`${e}.__update`, {
|
|
407
407
|
object_ids: [t],
|
|
408
408
|
entity: e,
|
|
409
409
|
fields: { $properties: [{
|
|
410
410
|
property_code: n,
|
|
411
|
-
value:
|
|
411
|
+
value: i
|
|
412
412
|
}] }
|
|
413
413
|
})).result?.rows?.[0]?.$properties ?? [];
|
|
414
|
-
return
|
|
414
|
+
return a.find((e) => e.property_code === n) ?? a[0];
|
|
415
415
|
}
|
|
416
416
|
async function q(e, t, n) {
|
|
417
|
-
await
|
|
417
|
+
await r(`${e}.__update`, {
|
|
418
418
|
object_ids: [t],
|
|
419
419
|
entity: e,
|
|
420
420
|
fields: { $properties: [{
|
|
@@ -433,7 +433,7 @@ function J(e, t) {
|
|
|
433
433
|
n.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
434
434
|
},
|
|
435
435
|
onError: (e) => {
|
|
436
|
-
|
|
436
|
+
o.error(e.message);
|
|
437
437
|
}
|
|
438
438
|
});
|
|
439
439
|
}
|
|
@@ -445,7 +445,7 @@ function Y(e, t) {
|
|
|
445
445
|
n.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
446
446
|
},
|
|
447
447
|
onError: (e) => {
|
|
448
|
-
|
|
448
|
+
o.error(e.message);
|
|
449
449
|
}
|
|
450
450
|
});
|
|
451
451
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $t as e, en as t, rn as n } from "./useCurrentScreen-CpQjVmrT.js";
|
|
2
2
|
import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
|
|
3
3
|
//#region src/embed/file-src.ts
|
|
4
4
|
var s = "/api/files";
|
|
@@ -29,17 +29,17 @@ function d(e, t) {
|
|
|
29
29
|
function f(e) {
|
|
30
30
|
return `${e}${e.includes("?") ? "&" : "?"}disposition=attachment`;
|
|
31
31
|
}
|
|
32
|
-
async function p(
|
|
33
|
-
let i = await e(), a = await fetch(
|
|
32
|
+
async function p(n, r) {
|
|
33
|
+
let i = await e(), a = await fetch(n, d(i, r));
|
|
34
34
|
if (a.status !== 401) return a;
|
|
35
|
-
|
|
35
|
+
t();
|
|
36
36
|
let o = await e();
|
|
37
|
-
return fetch(
|
|
37
|
+
return fetch(n, d(o, r));
|
|
38
38
|
}
|
|
39
|
-
async function m(e,
|
|
40
|
-
if (!
|
|
41
|
-
let i = await p(l(e,
|
|
42
|
-
if (i.status === 202 && typeof
|
|
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
43
|
if (!i.ok) throw Error(`embed file url request failed: ${i.status} ${i.statusText}`);
|
|
44
44
|
let a = await i.json();
|
|
45
45
|
if (!c(a)) throw Error("embed file url response is malformed");
|
|
@@ -48,7 +48,7 @@ async function m(e, n, r) {
|
|
|
48
48
|
kind: "direct"
|
|
49
49
|
};
|
|
50
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(
|
|
51
|
+
let o = await p(t === "download" ? f(a.url) : a.url, r);
|
|
52
52
|
if (!o.ok) throw Error(`embed file proxy fetch failed: ${o.status} ${o.statusText}`);
|
|
53
53
|
let s = await o.blob();
|
|
54
54
|
return {
|
|
@@ -148,23 +148,23 @@ 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(e,
|
|
152
|
-
let a = k(
|
|
151
|
+
function j(e, t, r) {
|
|
152
|
+
let a = k(t), [s, c] = o(() => n() ? void 0 : r);
|
|
153
153
|
return i(() => {
|
|
154
|
-
|
|
154
|
+
n() || c(r);
|
|
155
155
|
}, [r]), i(() => {
|
|
156
|
-
if (!
|
|
156
|
+
if (!n()) return;
|
|
157
157
|
if (!e) {
|
|
158
158
|
c(void 0);
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
|
-
let
|
|
161
|
+
let t = null, r = !1, i = new AbortController();
|
|
162
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" && (
|
|
167
|
+
e.kind === "blob" && (t = e.url), c(e.url);
|
|
168
168
|
}).catch((e) => {
|
|
169
169
|
if (!r) {
|
|
170
170
|
if (e instanceof u) {
|
|
@@ -174,7 +174,7 @@ function j(e, n, r) {
|
|
|
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(),
|
|
177
|
+
r = !0, i.abort(), t && URL.revokeObjectURL(t);
|
|
178
178
|
};
|
|
179
179
|
}, [e, a]), s;
|
|
180
180
|
}
|
|
@@ -183,12 +183,12 @@ function M() {
|
|
|
183
183
|
return i(() => () => {
|
|
184
184
|
for (let t of e.current) URL.revokeObjectURL(t);
|
|
185
185
|
e.current = [];
|
|
186
|
-
}, []), { open: r((
|
|
187
|
-
if (!
|
|
186
|
+
}, []), { open: r((t, r, i) => {
|
|
187
|
+
if (!n()) {
|
|
188
188
|
i && window.open(i, "_blank", "noopener");
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
t && m(t, r).then((t) => {
|
|
192
192
|
t.kind === "blob" && e.current.push(t.url), window.open(t.url, "_blank", "noopener");
|
|
193
193
|
}).catch((e) => {
|
|
194
194
|
e instanceof u || console.error("[declarion-embed] file open failed:", e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@declarion/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
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.
|
|
62
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
63
|
-
"@radix-ui/react-dropdown-menu": "^2.1.
|
|
64
|
-
"@radix-ui/react-label": "^2.1.
|
|
65
|
-
"@radix-ui/react-select": "^2.3.
|
|
66
|
-
"@radix-ui/react-separator": "^1.1.
|
|
67
|
-
"@radix-ui/react-slot": "^1.3.
|
|
68
|
-
"@tanstack/react-query": "^5.101.
|
|
61
|
+
"@radix-ui/react-alert-dialog": "^1.1.22",
|
|
62
|
+
"@radix-ui/react-dialog": "^1.1.22",
|
|
63
|
+
"@radix-ui/react-dropdown-menu": "^2.1.23",
|
|
64
|
+
"@radix-ui/react-label": "^2.1.14",
|
|
65
|
+
"@radix-ui/react-select": "^2.3.6",
|
|
66
|
+
"@radix-ui/react-separator": "^1.1.14",
|
|
67
|
+
"@radix-ui/react-slot": "^1.3.2",
|
|
68
|
+
"@tanstack/react-query": "^5.101.4",
|
|
69
69
|
"@tanstack/react-table": "^8.21.3",
|
|
70
|
-
"@tanstack/react-virtual": "^3.14.
|
|
70
|
+
"@tanstack/react-virtual": "^3.14.8",
|
|
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.
|
|
74
|
+
"lucide-react": "^1.26.0",
|
|
75
75
|
"mdast-util-to-string": "^4.0.0",
|
|
76
|
-
"monaco-editor": "^0.
|
|
76
|
+
"monaco-editor": "^0.56.0",
|
|
77
77
|
"react-markdown": "^10.1.0",
|
|
78
|
-
"react-router
|
|
78
|
+
"react-router": "^8.3.0",
|
|
79
79
|
"react-textarea-autosize": "^8.5.9",
|
|
80
|
-
"recharts": "^3.
|
|
80
|
+
"recharts": "^3.10.0",
|
|
81
81
|
"remark-breaks": "^4.0.0",
|
|
82
82
|
"remark-gfm": "^4.0.1",
|
|
83
83
|
"remark-parse": "^11.0.0",
|
|
@@ -90,28 +90,28 @@
|
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@axe-core/react": "^4.12.1",
|
|
92
92
|
"@tailwindcss/typography": "^0.5.20",
|
|
93
|
-
"@tailwindcss/vite": "^4.3.
|
|
93
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
94
94
|
"@testing-library/dom": "^10.4.1",
|
|
95
|
-
"@testing-library/jest-dom": "^
|
|
95
|
+
"@testing-library/jest-dom": "^7.0.0",
|
|
96
96
|
"@testing-library/react": "^16.3.2",
|
|
97
97
|
"@testing-library/user-event": "^14.6.1",
|
|
98
98
|
"@types/react": "^19.2.17",
|
|
99
99
|
"@types/react-dom": "^19.2.3",
|
|
100
|
-
"@vitejs/plugin-react": "^6.0.
|
|
100
|
+
"@vitejs/plugin-react": "^6.0.4",
|
|
101
101
|
"@vitest/coverage-v8": "^4.1.10",
|
|
102
102
|
"axe-core": "^4.12.1",
|
|
103
103
|
"eslint": "^10.7.0",
|
|
104
104
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
105
105
|
"jsdom": "^29.1.1",
|
|
106
106
|
"msw": "^2.15.0",
|
|
107
|
-
"publint": "^0.3.
|
|
108
|
-
"react": "^19.2.
|
|
109
|
-
"react-dom": "^19.2.
|
|
110
|
-
"tailwindcss": "^4.3.
|
|
107
|
+
"publint": "^0.3.22",
|
|
108
|
+
"react": "^19.2.8",
|
|
109
|
+
"react-dom": "^19.2.8",
|
|
110
|
+
"tailwindcss": "^4.3.3",
|
|
111
111
|
"tsc-alias": "^1.9.1",
|
|
112
112
|
"typescript": "^6.0.3",
|
|
113
|
-
"typescript-eslint": "^8.
|
|
114
|
-
"vite": "^8.1.
|
|
113
|
+
"typescript-eslint": "^8.65.0",
|
|
114
|
+
"vite": "^8.1.5",
|
|
115
115
|
"vitest": "^4.1.10"
|
|
116
116
|
},
|
|
117
117
|
"scripts": {
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { H as e } from "./useCurrentScreen-C33VZcNn.js";
|
|
2
|
-
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
-
import r, { defaultUrlTransform as i } from "react-markdown";
|
|
4
|
-
import a from "remark-breaks";
|
|
5
|
-
import o from "remark-gfm";
|
|
6
|
-
//#region src/components/shared/MarkdownRenderer.tsx
|
|
7
|
-
var s = "prose prose-sm dark:prose-invert max-w-none break-words overflow-hidden", c = [a], l = [o];
|
|
8
|
-
function u(e) {
|
|
9
|
-
return e.startsWith("declarion://file/") ? e : i(e);
|
|
10
|
-
}
|
|
11
|
-
function d(e) {
|
|
12
|
-
return e.startsWith("/") || e.startsWith("https://") || e.startsWith("http://") ? e : null;
|
|
13
|
-
}
|
|
14
|
-
function f(e) {
|
|
15
|
-
if (!e) return !1;
|
|
16
|
-
if (e.startsWith("//")) return !0;
|
|
17
|
-
let t = typeof window < "u" ? window.location.href : "http://localhost/", n;
|
|
18
|
-
try {
|
|
19
|
-
n = new URL(e, t);
|
|
20
|
-
} catch {
|
|
21
|
-
return !1;
|
|
22
|
-
}
|
|
23
|
-
if (n.protocol !== "http:" && n.protocol !== "https:") return !0;
|
|
24
|
-
let r = typeof window < "u" ? window.location.origin : "http://localhost";
|
|
25
|
-
return n.origin !== r;
|
|
26
|
-
}
|
|
27
|
-
function p({ href: e, children: n }) {
|
|
28
|
-
return f(e) ? /* @__PURE__ */ t("a", {
|
|
29
|
-
href: e,
|
|
30
|
-
target: "_blank",
|
|
31
|
-
rel: "noopener noreferrer",
|
|
32
|
-
children: n
|
|
33
|
-
}) : /* @__PURE__ */ t("a", {
|
|
34
|
-
href: e,
|
|
35
|
-
children: n
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function m(r) {
|
|
39
|
-
return {
|
|
40
|
-
img({ src: i, alt: a }) {
|
|
41
|
-
let o = e(i);
|
|
42
|
-
if (!o) return /* @__PURE__ */ t("img", {
|
|
43
|
-
src: i,
|
|
44
|
-
alt: a ?? ""
|
|
45
|
-
});
|
|
46
|
-
let s = r[o], c = s?.presigned_url ?? s?.url, l = c ? d(c) : null;
|
|
47
|
-
return l ? /* @__PURE__ */ t("img", {
|
|
48
|
-
src: l,
|
|
49
|
-
alt: a ?? s.filename ?? ""
|
|
50
|
-
}) : /* @__PURE__ */ n("span", {
|
|
51
|
-
style: {
|
|
52
|
-
color: "var(--warn)",
|
|
53
|
-
fontSize: 12
|
|
54
|
-
},
|
|
55
|
-
children: ["Missing image ", o]
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
a({ href: i, children: a }) {
|
|
59
|
-
let o = e(i);
|
|
60
|
-
if (!o) return /* @__PURE__ */ t(p, {
|
|
61
|
-
href: i,
|
|
62
|
-
children: a
|
|
63
|
-
});
|
|
64
|
-
let s = r[o], c = s?.presigned_url ?? s?.url, l = c ? d(c) : null;
|
|
65
|
-
return l ? /* @__PURE__ */ t("a", {
|
|
66
|
-
href: l,
|
|
67
|
-
target: "_blank",
|
|
68
|
-
rel: "noreferrer",
|
|
69
|
-
children: a
|
|
70
|
-
}) : /* @__PURE__ */ n("span", {
|
|
71
|
-
style: {
|
|
72
|
-
color: "var(--warn)",
|
|
73
|
-
fontSize: 12
|
|
74
|
-
},
|
|
75
|
-
children: ["Missing file ", o]
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function h({ content: e, plugins: n = "breaks", files: i, components: a, skipHtml: o = !0, prose: d = !0 }) {
|
|
81
|
-
let f = /* @__PURE__ */ t(r, {
|
|
82
|
-
skipHtml: o,
|
|
83
|
-
remarkPlugins: n === "gfm" ? l : c,
|
|
84
|
-
components: {
|
|
85
|
-
a: p,
|
|
86
|
-
...i ? m(i) : {},
|
|
87
|
-
...a
|
|
88
|
-
},
|
|
89
|
-
urlTransform: i ? u : void 0,
|
|
90
|
-
children: e
|
|
91
|
-
});
|
|
92
|
-
return d ? /* @__PURE__ */ t("div", {
|
|
93
|
-
className: s,
|
|
94
|
-
children: f
|
|
95
|
-
}) : f;
|
|
96
|
-
}
|
|
97
|
-
//#endregion
|
|
98
|
-
export { h as MarkdownRenderer };
|