@voltro/client 0.67.0 → 0.69.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/CHANGELOG.md +437 -0
- package/dist/form.d.ts +3 -1
- package/dist/form.js +1 -1
- package/dist/{formData-He_L4ozH.js → formData-dGz5aoUR.js} +99 -94
- package/dist/index.d.ts +23 -2
- package/dist/index.js +735 -715
- package/package.json +2 -2
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { JSONSchema as e, Schema as t } from "effect";
|
|
2
2
|
import * as n from "effect/SchemaAST";
|
|
3
3
|
//#region src/schemaFields.ts
|
|
4
|
-
var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/^./, (e) => e.toUpperCase()), o = (e
|
|
4
|
+
var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/^./, (e) => e.toUpperCase()), o = /^[a-z][A-Za-z0-9]*(\(.*\))?$/, s = (e) => {
|
|
5
|
+
let t = e.title;
|
|
6
|
+
if (typeof t != "string") return;
|
|
7
|
+
let n = t.trim();
|
|
8
|
+
return n === "" || o.test(n) ? void 0 : n;
|
|
9
|
+
}, c = (e, t) => {
|
|
5
10
|
let n = e;
|
|
6
11
|
for (let e = 0; e < 8; e += 1) {
|
|
7
12
|
let e = n.$ref;
|
|
@@ -11,13 +16,13 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
11
16
|
n = r;
|
|
12
17
|
}
|
|
13
18
|
return n;
|
|
14
|
-
},
|
|
19
|
+
}, l = (e) => {
|
|
15
20
|
if (!e || typeof e != "object") return !1;
|
|
16
21
|
let t = e;
|
|
17
22
|
if (t.type === "null" || t.const === null) return !0;
|
|
18
23
|
let n = t.enum;
|
|
19
24
|
return Array.isArray(n) && n.length === 1 && n[0] === null;
|
|
20
|
-
},
|
|
25
|
+
}, u = (e, t) => {
|
|
21
26
|
let n = e.type;
|
|
22
27
|
if (Array.isArray(n) && n.includes("null")) {
|
|
23
28
|
let t = n.filter((e) => e !== "null");
|
|
@@ -32,9 +37,9 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
32
37
|
for (let n of ["anyOf", "oneOf"]) {
|
|
33
38
|
let r = e[n];
|
|
34
39
|
if (!Array.isArray(r)) continue;
|
|
35
|
-
let i = r.filter((e) => !
|
|
40
|
+
let i = r.filter((e) => !l(e));
|
|
36
41
|
if (i.length !== r.length) return i.length === 1 ? {
|
|
37
|
-
node:
|
|
42
|
+
node: c(i[0], t),
|
|
38
43
|
nullable: !0
|
|
39
44
|
} : {
|
|
40
45
|
node: {
|
|
@@ -48,14 +53,14 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
48
53
|
node: e,
|
|
49
54
|
nullable: !1
|
|
50
55
|
};
|
|
51
|
-
},
|
|
56
|
+
}, d = (e) => e.map((e) => ({
|
|
52
57
|
value: String(e),
|
|
53
58
|
label: a(String(e))
|
|
54
|
-
})),
|
|
59
|
+
})), f = (e) => {
|
|
55
60
|
let t = e.enum;
|
|
56
61
|
if (Array.isArray(t) && t.length > 0) return {
|
|
57
62
|
widget: "select",
|
|
58
|
-
options:
|
|
63
|
+
options: d(t)
|
|
59
64
|
};
|
|
60
65
|
let n = e.type, r = Array.isArray(n) ? n.find((e) => e !== "null") : n, i = e.format;
|
|
61
66
|
switch (r) {
|
|
@@ -72,27 +77,27 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
72
77
|
let n = t.slice(8);
|
|
73
78
|
if (/DateTime/i.test(n) || /Timestamp/i.test(n)) return "datetime";
|
|
74
79
|
if (/Date/.test(n)) return "date";
|
|
75
|
-
},
|
|
76
|
-
let { node:
|
|
77
|
-
if (g.type === "object" && y !== void 0 &&
|
|
80
|
+
}, p = (e) => typeof e["x-voltro"] == "object" && e["x-voltro"] !== null ? e["x-voltro"] : {}, te = 4, m = (e, t, n, r = "", i, o = 0) => Object.entries(e).flatMap(([e, l]) => {
|
|
81
|
+
let { node: d, nullable: h } = u(c(l, n), n), g = c(d, n), _ = p(g), v = r === "" ? e : `${r}.${e}`, y = g.properties;
|
|
82
|
+
if (g.type === "object" && y !== void 0 && o < te && _.widget === void 0) return m(y, new Set(Array.isArray(g.required) ? g.required : []), n, v, {
|
|
78
83
|
path: _.section ?? v,
|
|
79
|
-
label: _.label ?? a(e)
|
|
80
|
-
},
|
|
81
|
-
let b = ee(l), { widget: x, options: S } =
|
|
84
|
+
label: _.label ?? s(g) ?? a(e)
|
|
85
|
+
}, o + 1);
|
|
86
|
+
let b = ee(l), { widget: x, options: S } = f(g);
|
|
82
87
|
b !== void 0 && (x = b);
|
|
83
88
|
let C;
|
|
84
89
|
if (g.type === "array") {
|
|
85
90
|
let e = g.items;
|
|
86
91
|
if (typeof e == "object" && e && !Array.isArray(e)) {
|
|
87
|
-
let t =
|
|
88
|
-
t.type === "object" && r !== void 0 && (x = "array", C =
|
|
92
|
+
let t = c(e, n), r = t.properties;
|
|
93
|
+
t.type === "object" && r !== void 0 && (x = "array", C = m(r, new Set(Array.isArray(t.required) ? t.required : []), n));
|
|
89
94
|
}
|
|
90
95
|
}
|
|
91
96
|
_.widget !== void 0 && (x = _.widget), _.reference !== void 0 && _.widget === void 0 && (x = "reference");
|
|
92
97
|
let w = typeof g.description == "string" ? g.description : void 0, T = _.section ?? i?.path;
|
|
93
98
|
return [{
|
|
94
99
|
name: v,
|
|
95
|
-
label: _.label ?? a(e),
|
|
100
|
+
label: _.label ?? s(g) ?? a(e),
|
|
96
101
|
widget: x,
|
|
97
102
|
required: t.has(e),
|
|
98
103
|
nullable: h,
|
|
@@ -107,27 +112,27 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
107
112
|
...C === void 0 ? {} : { item: C },
|
|
108
113
|
..._.reference === void 0 ? {} : { reference: _.reference }
|
|
109
114
|
}];
|
|
110
|
-
}),
|
|
115
|
+
}), h = (e) => e.map((e, t) => [e, t]).sort((e, t) => (e[0].order ?? e[1]) - (t[0].order ?? t[1]) || e[1] - t[1]).map(([e]) => e), g = (t) => {
|
|
111
116
|
try {
|
|
112
117
|
return e.make(t);
|
|
113
118
|
} catch {
|
|
114
119
|
return;
|
|
115
120
|
}
|
|
116
|
-
}, g = (e) => {
|
|
117
|
-
let t = h(e);
|
|
118
|
-
if (t === void 0) return [];
|
|
119
|
-
let n = t.$defs ?? {}, r = o(t, n), i = r.properties;
|
|
120
|
-
return i ? m(p(i, new Set(Array.isArray(r.required) ? r.required : []), n)) : [];
|
|
121
121
|
}, _ = (e) => {
|
|
122
|
-
let t =
|
|
122
|
+
let t = g(e);
|
|
123
|
+
if (t === void 0) return [];
|
|
124
|
+
let n = t.$defs ?? {}, r = c(t, n), i = r.properties;
|
|
125
|
+
return i ? h(m(i, new Set(Array.isArray(r.required) ? r.required : []), n)) : [];
|
|
126
|
+
}, v = (e) => {
|
|
127
|
+
let t = g(e);
|
|
123
128
|
if (t === void 0) return [];
|
|
124
|
-
let n = t.$defs ?? {}, r =
|
|
129
|
+
let n = t.$defs ?? {}, r = c(t, n);
|
|
125
130
|
if (r.type !== "array") return [];
|
|
126
131
|
let i = r.items;
|
|
127
132
|
if (!i || typeof i != "object") return [];
|
|
128
|
-
let a =
|
|
129
|
-
return
|
|
130
|
-
},
|
|
133
|
+
let a = c(i, n), o = a.properties;
|
|
134
|
+
return o ? m(o, new Set(Array.isArray(a.required) ? a.required : []), n) : [];
|
|
135
|
+
}, y = (e) => {
|
|
131
136
|
let t = [];
|
|
132
137
|
for (let n of e) {
|
|
133
138
|
let e = t[t.length - 1];
|
|
@@ -142,7 +147,7 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
142
147
|
});
|
|
143
148
|
}
|
|
144
149
|
return t;
|
|
145
|
-
},
|
|
150
|
+
}, b = {
|
|
146
151
|
en: {
|
|
147
152
|
"validation.required": "Required",
|
|
148
153
|
"validation.invalid": "Invalid value",
|
|
@@ -187,21 +192,21 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
187
192
|
"validation.invalidFileType": "Dieser Dateityp ist nicht erlaubt",
|
|
188
193
|
"validation.fileTooLarge": "Die Datei ist zu groß"
|
|
189
194
|
}
|
|
190
|
-
},
|
|
195
|
+
}, x = (e, t) => {
|
|
191
196
|
let n = !1, r = e.replace(/\{(\w+)\}/g, (e, r) => {
|
|
192
197
|
let i = t?.[r];
|
|
193
198
|
return i === void 0 ? (n = !0, e) : String(i);
|
|
194
199
|
});
|
|
195
200
|
return n ? void 0 : r;
|
|
196
|
-
},
|
|
201
|
+
}, S = () => {
|
|
197
202
|
let e = globalThis.document?.documentElement?.lang ?? "";
|
|
198
203
|
return e === "" ? "en" : e;
|
|
199
|
-
},
|
|
204
|
+
}, C = (e, t) => {
|
|
200
205
|
let n = t?.messages?.(e.id, e.params, e.fallback);
|
|
201
206
|
if (n !== void 0) return n;
|
|
202
|
-
let r =
|
|
203
|
-
return (r === void 0 ? void 0 :
|
|
204
|
-
},
|
|
207
|
+
let r = b[(t?.locale ?? S()).toLowerCase().split("-")[0] ?? "en"]?.[e.id] ?? b.en?.[e.id];
|
|
208
|
+
return (r === void 0 ? void 0 : x(r, e.params)) ?? e.fallback;
|
|
209
|
+
}, w = (e) => {
|
|
205
210
|
let t = /^([a-z][\w-]*(?:\.[\w-]+)+)\|(\{.*\})$/.exec(e);
|
|
206
211
|
if (t !== null && t[1] !== void 0 && t[2] !== void 0) try {
|
|
207
212
|
return {
|
|
@@ -217,13 +222,13 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
217
222
|
id: "validation.custom",
|
|
218
223
|
fallback: e
|
|
219
224
|
};
|
|
220
|
-
},
|
|
225
|
+
}, T = {
|
|
221
226
|
email: "validation.invalidEmail",
|
|
222
227
|
"idn-email": "validation.invalidEmail",
|
|
223
228
|
uri: "validation.invalidUrl",
|
|
224
229
|
url: "validation.invalidUrl",
|
|
225
230
|
uuid: "validation.invalidUuid"
|
|
226
|
-
},
|
|
231
|
+
}, ne = (e, t) => {
|
|
227
232
|
let r = e.ast;
|
|
228
233
|
for (let e of t.split(".")) {
|
|
229
234
|
if (r === void 0) return {};
|
|
@@ -261,7 +266,7 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
261
266
|
params: { amount: i.minLength }
|
|
262
267
|
};
|
|
263
268
|
case t.PatternSchemaId: {
|
|
264
|
-
let e = typeof i.format == "string" ?
|
|
269
|
+
let e = typeof i.format == "string" ? T[i.format] : void 0;
|
|
265
270
|
return e === void 0 ? {
|
|
266
271
|
id: "validation.pattern",
|
|
267
272
|
params: { pattern: i.pattern }
|
|
@@ -332,7 +337,7 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
332
337
|
fallback: i
|
|
333
338
|
});
|
|
334
339
|
}, r = (e, t) => {
|
|
335
|
-
let r =
|
|
340
|
+
let r = w(t);
|
|
336
341
|
n(e, r.id, r.params, r.fallback);
|
|
337
342
|
}, i = (e, t) => {
|
|
338
343
|
switch (e._tag) {
|
|
@@ -418,7 +423,7 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
418
423
|
};
|
|
419
424
|
let a = k(i.left).map((t) => {
|
|
420
425
|
if (t.id !== "validation.minLength" && t.id !== "validation.maxLength") return t;
|
|
421
|
-
let n =
|
|
426
|
+
let n = ne(e, t.path);
|
|
422
427
|
return n.min === void 0 || n.max === void 0 ? t : n.min === n.max ? {
|
|
423
428
|
...t,
|
|
424
429
|
id: "validation.exactLength",
|
|
@@ -432,7 +437,7 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
432
437
|
}
|
|
433
438
|
};
|
|
434
439
|
}), o = {};
|
|
435
|
-
for (let e of a) e.path !== "" && !(e.path in o) && (o[e.path] =
|
|
440
|
+
for (let e of a) e.path !== "" && !(e.path in o) && (o[e.path] = C(e, r));
|
|
436
441
|
return {
|
|
437
442
|
valid: !1,
|
|
438
443
|
errors: o,
|
|
@@ -443,47 +448,47 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
443
448
|
"italic",
|
|
444
449
|
"code",
|
|
445
450
|
"strike"
|
|
446
|
-
],
|
|
451
|
+
], P = 5e3, re = (e) => {
|
|
447
452
|
let t = "";
|
|
448
453
|
for (let n of e) {
|
|
449
454
|
let e = n.codePointAt(0) ?? 0;
|
|
450
455
|
e > 32 && e !== 127 && (t += n);
|
|
451
456
|
}
|
|
452
457
|
return t.toLowerCase();
|
|
453
|
-
},
|
|
454
|
-
let t =
|
|
458
|
+
}, F = (e) => {
|
|
459
|
+
let t = re(e);
|
|
455
460
|
return t.length === 0 ? !1 : t.startsWith("#") || t.startsWith("/") ? !t.startsWith("//") : t.startsWith("https://") || t.startsWith("http://") || t.startsWith("mailto:");
|
|
456
|
-
},
|
|
461
|
+
}, I = t.String.pipe(t.filter((e) => F(e) || "href must be http(s), mailto:, a #fragment or a /path")), L = t.Struct({
|
|
457
462
|
type: t.Literal("text"),
|
|
458
463
|
text: t.String,
|
|
459
464
|
marks: t.optional(t.Array(t.Literal(...N)))
|
|
460
|
-
}),
|
|
465
|
+
}), R = t.Struct({
|
|
461
466
|
type: t.Literal("link"),
|
|
462
|
-
href:
|
|
463
|
-
content: t.Array(F)
|
|
464
|
-
}), L = t.Union(F, I), R = t.Struct({
|
|
465
|
-
type: t.Literal("listItem"),
|
|
467
|
+
href: I,
|
|
466
468
|
content: t.Array(L)
|
|
467
|
-
}), z = t.Union(t.Struct({
|
|
469
|
+
}), z = t.Union(L, R), B = t.Struct({
|
|
470
|
+
type: t.Literal("listItem"),
|
|
471
|
+
content: t.Array(z)
|
|
472
|
+
}), V = t.Union(t.Struct({
|
|
468
473
|
type: t.Literal("paragraph"),
|
|
469
|
-
content: t.Array(
|
|
474
|
+
content: t.Array(z)
|
|
470
475
|
}), t.Struct({
|
|
471
476
|
type: t.Literal("heading"),
|
|
472
477
|
level: t.Literal(1, 2, 3),
|
|
473
|
-
content: t.Array(
|
|
478
|
+
content: t.Array(z)
|
|
474
479
|
}), t.Struct({
|
|
475
480
|
type: t.Literal("blockquote"),
|
|
476
|
-
content: t.Array(
|
|
481
|
+
content: t.Array(z)
|
|
477
482
|
}), t.Struct({
|
|
478
483
|
type: t.Literal("bulletList"),
|
|
479
|
-
content: t.Array(
|
|
484
|
+
content: t.Array(B)
|
|
480
485
|
}), t.Struct({
|
|
481
486
|
type: t.Literal("orderedList"),
|
|
482
|
-
content: t.Array(
|
|
487
|
+
content: t.Array(B)
|
|
483
488
|
}), t.Struct({
|
|
484
489
|
type: t.Literal("codeBlock"),
|
|
485
490
|
text: t.String
|
|
486
|
-
})),
|
|
491
|
+
})), H = (e) => {
|
|
487
492
|
let t = 1, n = (e) => {
|
|
488
493
|
for (let r of e) {
|
|
489
494
|
t += 1;
|
|
@@ -492,38 +497,38 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
492
497
|
}
|
|
493
498
|
};
|
|
494
499
|
return n(e.content), t;
|
|
495
|
-
},
|
|
500
|
+
}, U = t.Struct({
|
|
496
501
|
type: t.Literal("doc"),
|
|
497
|
-
content: t.Array(
|
|
498
|
-
}).pipe(t.filter((e) =>
|
|
502
|
+
content: t.Array(V)
|
|
503
|
+
}).pipe(t.filter((e) => H(e) <= 5e3 || "rich text document exceeds 5000 nodes"), t.annotations(r({ widget: "rich-text" }))), W = {
|
|
499
504
|
type: "doc",
|
|
500
505
|
content: []
|
|
501
|
-
},
|
|
506
|
+
}, G = (e) => typeof e == "object" && !!e && e.type === "doc" && Array.isArray(e.content), K = /(\*\*([^*]+)\*\*)|(~~([^~]+)~~)|(\*([^*]+)\*)|(`([^`]+)`)|(\[([^\]]*)\]\(([^)\s]+)\))/, q = (e, t) => t && t.length > 0 ? {
|
|
502
507
|
type: "text",
|
|
503
508
|
text: e,
|
|
504
509
|
marks: t
|
|
505
510
|
} : {
|
|
506
511
|
type: "text",
|
|
507
512
|
text: e
|
|
508
|
-
},
|
|
513
|
+
}, J = (e) => {
|
|
509
514
|
let t = [], n = e;
|
|
510
515
|
for (;;) {
|
|
511
|
-
let e =
|
|
516
|
+
let e = K.exec(n);
|
|
512
517
|
if (e === null || e.index === void 0) break;
|
|
513
|
-
e.index > 0 && t.push(
|
|
518
|
+
e.index > 0 && t.push(q(n.slice(0, e.index))), e[2] === void 0 ? e[4] === void 0 ? e[6] === void 0 ? e[8] === void 0 ? e[11] !== void 0 && (F(e[11]) ? t.push({
|
|
514
519
|
type: "link",
|
|
515
520
|
href: e[11],
|
|
516
521
|
content: [{
|
|
517
522
|
type: "text",
|
|
518
523
|
text: e[10] ?? ""
|
|
519
524
|
}]
|
|
520
|
-
}) : t.push(
|
|
525
|
+
}) : t.push(q(e[0]))) : t.push(q(e[8], ["code"])) : t.push(q(e[6], ["italic"])) : t.push(q(e[4], ["strike"])) : t.push(q(e[2], ["bold"])), n = n.slice(e.index + e[0].length);
|
|
521
526
|
}
|
|
522
|
-
return n.length > 0 && t.push(
|
|
523
|
-
},
|
|
527
|
+
return n.length > 0 && t.push(q(n)), t;
|
|
528
|
+
}, Y = (e, t) => e.map((e) => ({
|
|
524
529
|
type: "listItem",
|
|
525
|
-
content:
|
|
526
|
-
})),
|
|
530
|
+
content: J(e.replace(t, ""))
|
|
531
|
+
})), ie = (e) => {
|
|
527
532
|
if (e.length === 0) return null;
|
|
528
533
|
let t = e[0];
|
|
529
534
|
if (t.startsWith("```")) return {
|
|
@@ -533,24 +538,24 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
533
538
|
let n = /^(#{1,3})\s+(.*)$/.exec(t);
|
|
534
539
|
return n === null ? e.every((e) => /^[-*]\s+/.test(e)) ? {
|
|
535
540
|
type: "bulletList",
|
|
536
|
-
content:
|
|
541
|
+
content: Y(e, /^[-*]\s+/)
|
|
537
542
|
} : e.every((e) => /^\d+\.\s+/.test(e)) ? {
|
|
538
543
|
type: "orderedList",
|
|
539
|
-
content:
|
|
544
|
+
content: Y(e, /^\d+\.\s+/)
|
|
540
545
|
} : e.every((e) => e.startsWith(">")) ? {
|
|
541
546
|
type: "blockquote",
|
|
542
|
-
content:
|
|
547
|
+
content: J(e.map((e) => e.replace(/^>\s?/, "")).join(" "))
|
|
543
548
|
} : {
|
|
544
549
|
type: "paragraph",
|
|
545
|
-
content:
|
|
550
|
+
content: J(e.join(" "))
|
|
546
551
|
} : {
|
|
547
552
|
type: "heading",
|
|
548
553
|
level: n[1].length,
|
|
549
|
-
content:
|
|
554
|
+
content: J(n[2])
|
|
550
555
|
};
|
|
551
|
-
},
|
|
556
|
+
}, X = (e) => {
|
|
552
557
|
let t = [], n = [], r = () => {
|
|
553
|
-
let e =
|
|
558
|
+
let e = ie(n);
|
|
554
559
|
e !== null && t.push(e), n = [];
|
|
555
560
|
};
|
|
556
561
|
for (let t of e.replace(/\r\n/g, "\n").split("\n")) t.trim() === "" ? r() : n.push(t);
|
|
@@ -558,25 +563,25 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
558
563
|
type: "doc",
|
|
559
564
|
content: t
|
|
560
565
|
};
|
|
561
|
-
},
|
|
566
|
+
}, Z = (e) => e.map((e) => {
|
|
562
567
|
if (e.type === "link") return `[${e.content.map((e) => e.text).join("")}](${e.href})`;
|
|
563
568
|
let t = e.marks ?? [];
|
|
564
569
|
return t.includes("bold") ? `**${e.text}**` : t.includes("strike") ? `~~${e.text}~~` : t.includes("italic") ? `*${e.text}*` : t.includes("code") ? `\`${e.text}\`` : e.text;
|
|
565
|
-
}).join(""),
|
|
570
|
+
}).join(""), ae = (e) => G(e) ? e.content.map((e) => {
|
|
566
571
|
switch (e.type) {
|
|
567
|
-
case "heading": return `${"#".repeat(e.level)} ${
|
|
568
|
-
case "bulletList": return e.content.map((e) => `- ${
|
|
569
|
-
case "orderedList": return e.content.map((e, t) => `${t + 1}. ${
|
|
570
|
-
case "blockquote": return `> ${
|
|
572
|
+
case "heading": return `${"#".repeat(e.level)} ${Z(e.content)}`;
|
|
573
|
+
case "bulletList": return e.content.map((e) => `- ${Z(e.content)}`).join("\n");
|
|
574
|
+
case "orderedList": return e.content.map((e, t) => `${t + 1}. ${Z(e.content)}`).join("\n");
|
|
575
|
+
case "blockquote": return `> ${Z(e.content)}`;
|
|
571
576
|
case "codeBlock": return [
|
|
572
577
|
"```",
|
|
573
578
|
e.text,
|
|
574
579
|
"```"
|
|
575
580
|
].join("\n");
|
|
576
|
-
default: return
|
|
581
|
+
default: return Z(e.content);
|
|
577
582
|
}
|
|
578
|
-
}).join("\n\n") : "",
|
|
579
|
-
if (!
|
|
583
|
+
}).join("\n\n") : "", oe = (e) => {
|
|
584
|
+
if (!G(e)) return "";
|
|
580
585
|
let t = (e) => e.map((e) => e.type === "link" ? e.content.map((e) => e.text).join("") : e.text).join("");
|
|
581
586
|
return e.content.map((e) => {
|
|
582
587
|
switch (e.type) {
|
|
@@ -586,26 +591,26 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
586
591
|
default: return t(e.content);
|
|
587
592
|
}
|
|
588
593
|
}).join("\n\n");
|
|
589
|
-
},
|
|
594
|
+
}, se = "__voltro_form_flash__", Q = "/form/", ce = (e) => `${Q}${encodeURIComponent(e)}`, le = "__voltro_form", ue = "__voltro_redirect", $ = (e) => {
|
|
590
595
|
let t = Number(e);
|
|
591
596
|
return Number.isNaN(t) ? e : t;
|
|
592
|
-
},
|
|
597
|
+
}, de = (e) => {
|
|
593
598
|
let t = e.jsonSchema.items;
|
|
594
599
|
if (!t || typeof t != "object") return;
|
|
595
600
|
let n = t.type;
|
|
596
601
|
return typeof n == "string" ? n : void 0;
|
|
597
|
-
},
|
|
602
|
+
}, fe = (e, t) => {
|
|
598
603
|
switch (e.widget) {
|
|
599
604
|
case "rich-text": return t === "" ? {
|
|
600
605
|
type: "doc",
|
|
601
606
|
content: []
|
|
602
|
-
} :
|
|
607
|
+
} : X(t);
|
|
603
608
|
case "number": return t === "" ? void 0 : $(t);
|
|
604
609
|
case "date":
|
|
605
610
|
case "datetime": return t === "" ? void 0 : t;
|
|
606
611
|
default: return t;
|
|
607
612
|
}
|
|
608
|
-
},
|
|
613
|
+
}, pe = (e, t) => {
|
|
609
614
|
let n = /* @__PURE__ */ new Map();
|
|
610
615
|
for (let [e, r] of t) {
|
|
611
616
|
let t = n.get(e);
|
|
@@ -622,7 +627,7 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
622
627
|
}
|
|
623
628
|
i[n[n.length - 1]] = t;
|
|
624
629
|
};
|
|
625
|
-
for (let t of
|
|
630
|
+
for (let t of _(e)) {
|
|
626
631
|
if (t.widget === "array") continue;
|
|
627
632
|
let e = n.get(t.name);
|
|
628
633
|
if (t.widget === "checkbox" || t.widget === "switch") {
|
|
@@ -630,15 +635,15 @@ var r = (e) => ({ jsonSchema: { "x-voltro": e } }), i = "#/$defs/", a = (e) => e
|
|
|
630
635
|
continue;
|
|
631
636
|
}
|
|
632
637
|
if (t.widget === "multi-select") {
|
|
633
|
-
let n =
|
|
638
|
+
let n = de(t), r = e ?? [];
|
|
634
639
|
i(t.name, n === "number" || n === "integer" ? r.filter((e) => e !== "").map($) : r.filter((e) => e !== ""));
|
|
635
640
|
continue;
|
|
636
641
|
}
|
|
637
642
|
if (e === void 0) continue;
|
|
638
|
-
let r =
|
|
643
|
+
let r = fe(t, e[0]);
|
|
639
644
|
r !== void 0 && i(t.name, r);
|
|
640
645
|
}
|
|
641
646
|
return r;
|
|
642
647
|
};
|
|
643
648
|
//#endregion
|
|
644
|
-
export {
|
|
649
|
+
export { v as C, y as S, S as _, ce as a, M as b, P as c, G as d, F as f, k as g, ae as h, ue as i, U as l, oe as m, le as n, pe as o, X as p, Q as r, N as s, se as t, W as u, C as v, _ as w, r as x, j as y };
|
package/dist/index.d.ts
CHANGED
|
@@ -631,7 +631,7 @@ export declare interface ClientDiagnosticEvent {
|
|
|
631
631
|
readonly fields: Readonly<Record<string, ClientDiagnosticValue>>;
|
|
632
632
|
}
|
|
633
633
|
|
|
634
|
-
export declare type ClientDiagnosticKind = 'runtime.build-started' | 'runtime.resolved' | 'runtime.failed' | 'runtime.capabilities' | 'runtime.swapped' | 'runtime.disposed' | 'socket.created' | 'socket.raw-open' | 'socket.close' | 'socket.error' | 'socket.connect-timeout' | 'socket.retry-scheduled' | 'socket.frames' | 'protocol.ready' | 'subscription.transport-failed' | 'subscription.reissue-started' | 'subscription.reissue-skipped' | 'subscription.first-delivery' | 'subscription.recovery-stuck' | 'subscription.recovery-timer-late' | 'subscription.health-cleared' | 'event.gap' | 'connection.status' | 'recovery.state' | 'fault.transport-cut';
|
|
634
|
+
export declare type ClientDiagnosticKind = 'runtime.build-started' | 'runtime.resolved' | 'runtime.failed' | 'runtime.capabilities' | 'runtime.surface-mismatch' | 'runtime.swapped' | 'runtime.disposed' | 'socket.created' | 'socket.raw-open' | 'socket.close' | 'socket.error' | 'socket.connect-timeout' | 'socket.retry-scheduled' | 'socket.frames' | 'protocol.ready' | 'subscription.transport-failed' | 'subscription.reissue-started' | 'subscription.reissue-skipped' | 'subscription.first-delivery' | 'subscription.recovery-stuck' | 'subscription.recovery-timer-late' | 'subscription.health-cleared' | 'event.gap' | 'connection.status' | 'recovery.state' | 'fault.transport-cut';
|
|
635
635
|
|
|
636
636
|
export declare interface ClientDiagnosticsSnapshot {
|
|
637
637
|
readonly version: 1;
|
|
@@ -1121,7 +1121,9 @@ export declare interface FailedCall {
|
|
|
1121
1121
|
export declare interface FieldDescriptor {
|
|
1122
1122
|
/** Property name on the input object. */
|
|
1123
1123
|
readonly name: string;
|
|
1124
|
-
/** Human label —
|
|
1124
|
+
/** Human label — `formField({ label })`, else an AUTHORED Schema `title`
|
|
1125
|
+
* annotation, else the humanised property name. See `authoredTitle` for what
|
|
1126
|
+
* makes a title authored: effect writes its own into the same field. */
|
|
1125
1127
|
readonly label: string;
|
|
1126
1128
|
/** The default widget kind. `'custom'` ⇒ supply a render-prop. */
|
|
1127
1129
|
readonly widget: WidgetKind;
|
|
@@ -1512,6 +1514,22 @@ export declare const getMutations: () => ReadonlyArray<MutationEvent>;
|
|
|
1512
1514
|
*/
|
|
1513
1515
|
export declare const globalContext: <T>(key: string, initial: T) => Context<T>;
|
|
1514
1516
|
|
|
1517
|
+
/**
|
|
1518
|
+
* The snapshot a coordinator has at construction, frozen and shared.
|
|
1519
|
+
*
|
|
1520
|
+
* This is what `useSyncExternalStore` must hand back as the SERVER snapshot, and
|
|
1521
|
+
* the reason is a defect the browser checks caught the first time they ran: the
|
|
1522
|
+
* hook passed `getSnapshot` for both arguments, so the server rendered whatever
|
|
1523
|
+
* the LIVE coordinator held at that instant while the client's hydration render
|
|
1524
|
+
* read a coordinator that had already progressed. React reports that as
|
|
1525
|
+
* "server rendered text didn't match the client" — a console error in a browser
|
|
1526
|
+
* and nowhere else, on any SSR page rendering a connection status.
|
|
1527
|
+
*
|
|
1528
|
+
* One frozen object rather than a factory: `getServerSnapshot` must return a
|
|
1529
|
+
* stable REFERENCE or React re-renders forever looking for a fixed point.
|
|
1530
|
+
*/
|
|
1531
|
+
export declare const INITIAL_RECOVERY_SNAPSHOT: RecoverySnapshot;
|
|
1532
|
+
|
|
1515
1533
|
/** True when `value` is structurally a rich-text document (a cheap render-side
|
|
1516
1534
|
* guard; the decode remains the boundary). */
|
|
1517
1535
|
export declare const isRichTextDocument: (value: unknown) => value is RichTextDocument;
|
|
@@ -2110,6 +2128,9 @@ export declare class RecoveryCoordinator {
|
|
|
2110
2128
|
/** Ends on login/logout, tenant change or API disposal, not ordinary reconnect. */
|
|
2111
2129
|
get subjectSignal(): AbortSignal;
|
|
2112
2130
|
getSnapshot: () => RecoverySnapshot;
|
|
2131
|
+
/** The SSR / hydration snapshot — see INITIAL_RECOVERY_SNAPSHOT. Stable by
|
|
2132
|
+
* reference, so both renders agree and React swaps to the live one after. */
|
|
2133
|
+
getServerSnapshot: () => RecoverySnapshot;
|
|
2113
2134
|
subscribe: (listener: () => void) => (() => void);
|
|
2114
2135
|
onVisibleError(listener: RpcErrorListener): () => void;
|
|
2115
2136
|
/** Called from the socket seam before request fibers report their errors. */
|