@bambamboole/pdf-ua-template-builder 0.3.1 → 0.4.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/api/pdfUaApi.d.ts +10 -0
- package/dist/html-editor/HtmlCodeEditor.d.ts +4 -0
- package/dist/html-editor/HtmlEditor.d.ts +22 -0
- package/dist/html-editor/HtmlEditorContext.d.ts +25 -0
- package/dist/html-editor/HtmlPreview.d.ts +4 -0
- package/dist/html-editor/defaultHtml.d.ts +2 -0
- package/dist/html-editor/useHtmlPreview.d.ts +13 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.js +851 -655
- package/dist/index.js.map +1 -1
- package/dist/render/previewChrome.d.ts +19 -0
- package/dist/style.css +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -9,24 +9,25 @@ import { jsonSchema as ne } from "codemirror-json-schema";
|
|
|
9
9
|
import { HighlightStyle as O, syntaxHighlighting as k } from "@codemirror/language";
|
|
10
10
|
import { EditorView as re } from "@codemirror/view";
|
|
11
11
|
import { tags as A } from "@lezer/highlight";
|
|
12
|
+
import { html as ie } from "@codemirror/lang-html";
|
|
12
13
|
//#region src/api/pdfUaApi.ts
|
|
13
|
-
function
|
|
14
|
+
function ae(e) {
|
|
14
15
|
return e ?? "";
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function oe(e, t) {
|
|
17
18
|
return `${e.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}`;
|
|
18
19
|
}
|
|
19
|
-
async function
|
|
20
|
+
async function se(e) {
|
|
20
21
|
let t = e.headers.get("content-type") ?? "", n = `${e.status} ${e.statusText || "Request failed"}`;
|
|
21
22
|
return t.includes("application/json") ? (await e.json()).error || n : (await e.text()).trim() || n;
|
|
22
23
|
}
|
|
23
|
-
async function
|
|
24
|
-
let t = await fetch(
|
|
25
|
-
if (!t.ok) throw Error(await
|
|
24
|
+
async function ce(e) {
|
|
25
|
+
let t = await fetch(oe(e, "/schema"), { headers: { Accept: "application/json" } });
|
|
26
|
+
if (!t.ok) throw Error(await se(t));
|
|
26
27
|
return await t.json();
|
|
27
28
|
}
|
|
28
|
-
async function
|
|
29
|
-
let n = await fetch(
|
|
29
|
+
async function le(e, t) {
|
|
30
|
+
let n = await fetch(oe(e, "/render/template"), {
|
|
30
31
|
method: "POST",
|
|
31
32
|
headers: {
|
|
32
33
|
Accept: "application/pdf",
|
|
@@ -38,12 +39,24 @@ async function ce(e, t) {
|
|
|
38
39
|
...t
|
|
39
40
|
})
|
|
40
41
|
});
|
|
41
|
-
if (!n.ok) throw Error(await
|
|
42
|
+
if (!n.ok) throw Error(await se(n));
|
|
43
|
+
return n.blob();
|
|
44
|
+
}
|
|
45
|
+
async function ue(e, t) {
|
|
46
|
+
let n = await fetch(oe(e, "/convert"), {
|
|
47
|
+
method: "POST",
|
|
48
|
+
headers: {
|
|
49
|
+
Accept: "application/pdf",
|
|
50
|
+
"Content-Type": "application/json"
|
|
51
|
+
},
|
|
52
|
+
body: JSON.stringify(t)
|
|
53
|
+
});
|
|
54
|
+
if (!n.ok) throw Error(await se(n));
|
|
42
55
|
return n.blob();
|
|
43
56
|
}
|
|
44
57
|
//#endregion
|
|
45
58
|
//#region src/builder/blocks/blockChrome.ts
|
|
46
|
-
var
|
|
59
|
+
var de = {
|
|
47
60
|
heading: {
|
|
48
61
|
chip: "H",
|
|
49
62
|
label: "Heading"
|
|
@@ -77,18 +90,18 @@ var le = {
|
|
|
77
90
|
label: "Divider"
|
|
78
91
|
}
|
|
79
92
|
};
|
|
80
|
-
function
|
|
81
|
-
return
|
|
93
|
+
function fe(e) {
|
|
94
|
+
return de[e] ?? {
|
|
82
95
|
chip: "?",
|
|
83
|
-
label:
|
|
96
|
+
label: me(e)
|
|
84
97
|
};
|
|
85
98
|
}
|
|
86
|
-
function
|
|
99
|
+
function pe(e) {
|
|
87
100
|
switch (e.type) {
|
|
88
101
|
case "heading":
|
|
89
|
-
case "text": return
|
|
90
|
-
case "html": return
|
|
91
|
-
case "image": return
|
|
102
|
+
case "text": return j(e.text);
|
|
103
|
+
case "html": return j(e.html);
|
|
104
|
+
case "image": return j(e.alt ?? e.src);
|
|
92
105
|
case "key-value": {
|
|
93
106
|
let t = e.config?.fields ?? [];
|
|
94
107
|
return t.length > 0 ? `${t.length} field${t.length === 1 ? "" : "s"}` : "";
|
|
@@ -108,17 +121,17 @@ function de(e) {
|
|
|
108
121
|
default: return "";
|
|
109
122
|
}
|
|
110
123
|
}
|
|
111
|
-
function
|
|
124
|
+
function j(e, t = 56) {
|
|
112
125
|
if (!e) return "";
|
|
113
126
|
let n = e.replace(/\s+/g, " ").trim();
|
|
114
127
|
return n.length > t ? `${n.slice(0, t - 1)}…` : n;
|
|
115
128
|
}
|
|
116
|
-
function
|
|
129
|
+
function me(e) {
|
|
117
130
|
return e.split("-").filter(Boolean).map((e) => `${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(" ");
|
|
118
131
|
}
|
|
119
132
|
//#endregion
|
|
120
133
|
//#region src/builder/primitives/Chip.tsx
|
|
121
|
-
function
|
|
134
|
+
function M({ children: e, wide: t = !1 }) {
|
|
122
135
|
return /* @__PURE__ */ b("span", {
|
|
123
136
|
className: `inline-grid h-[22px] place-items-center rounded bg-surface-muted font-mono text-2xs font-semibold text-fg-muted ${t ? "min-w-[22px] px-1" : "w-[22px]"}`,
|
|
124
137
|
"aria-hidden": "true",
|
|
@@ -127,13 +140,13 @@ function j({ children: e, wide: t = !1 }) {
|
|
|
127
140
|
}
|
|
128
141
|
//#endregion
|
|
129
142
|
//#region src/builder/canvas/BlockCardPreview.tsx
|
|
130
|
-
function
|
|
131
|
-
let r =
|
|
143
|
+
function he({ type: e, summary: t, prefix: n }) {
|
|
144
|
+
let r = fe(e);
|
|
132
145
|
return /* @__PURE__ */ b("div", {
|
|
133
146
|
className: "pointer-events-none origin-top-left rotate-[1.5deg] scale-[1.02] cursor-grabbing drop-shadow-drag",
|
|
134
147
|
children: /* @__PURE__ */ x("div", {
|
|
135
148
|
className: "inline-flex min-w-[180px] max-w-[360px] items-center gap-2 rounded-lg border border-solid border-border-strong bg-surface px-3 py-2 text-sm font-medium",
|
|
136
|
-
children: [/* @__PURE__ */ b(
|
|
149
|
+
children: [/* @__PURE__ */ b(M, { children: r.chip }), /* @__PURE__ */ x("span", {
|
|
137
150
|
className: "inline-flex items-baseline gap-2",
|
|
138
151
|
children: [/* @__PURE__ */ x("span", {
|
|
139
152
|
className: "font-medium",
|
|
@@ -148,36 +161,36 @@ function me({ type: e, summary: t, prefix: n }) {
|
|
|
148
161
|
}
|
|
149
162
|
//#endregion
|
|
150
163
|
//#region src/builder/lib/sensors.ts
|
|
151
|
-
function
|
|
164
|
+
function ge() {
|
|
152
165
|
return c(s(r, { activationConstraint: { distance: 4 } }), s(n, { coordinateGetter: w }));
|
|
153
166
|
}
|
|
154
167
|
//#endregion
|
|
155
168
|
//#region src/builder/lib/records.ts
|
|
156
|
-
function
|
|
169
|
+
function N(e) {
|
|
157
170
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
158
171
|
}
|
|
159
|
-
function
|
|
172
|
+
function _e(e, t) {
|
|
160
173
|
if (!(t in e)) return e;
|
|
161
174
|
let n = { ...e };
|
|
162
175
|
return delete n[t], n;
|
|
163
176
|
}
|
|
164
|
-
function
|
|
177
|
+
function ve(e, t, n) {
|
|
165
178
|
if (!(t in e)) return e;
|
|
166
179
|
let r = {};
|
|
167
180
|
for (let [i, a] of Object.entries(e)) r[i === t ? n : i] = a;
|
|
168
181
|
return r;
|
|
169
182
|
}
|
|
170
|
-
function
|
|
183
|
+
function ye(e, t) {
|
|
171
184
|
let n = e.length + 1;
|
|
172
185
|
for (; e.includes(`${t}${n}`);) n += 1;
|
|
173
186
|
return n;
|
|
174
187
|
}
|
|
175
188
|
//#endregion
|
|
176
189
|
//#region src/builder/state/dragDrop.ts
|
|
177
|
-
function
|
|
178
|
-
return
|
|
190
|
+
function P(e) {
|
|
191
|
+
return N(e) ? e : {};
|
|
179
192
|
}
|
|
180
|
-
function
|
|
193
|
+
function be(e, t, n) {
|
|
181
194
|
return t === "new-row" ? {
|
|
182
195
|
rowUid: null,
|
|
183
196
|
index: 0,
|
|
@@ -188,7 +201,7 @@ function ye(e, t, n) {
|
|
|
188
201
|
area: "footer"
|
|
189
202
|
} : n.type === "block" && n.rowUid && n.blockUid ? {
|
|
190
203
|
rowUid: n.rowUid,
|
|
191
|
-
index:
|
|
204
|
+
index: F(e, n.blockUid),
|
|
192
205
|
area: n.area ?? "body"
|
|
193
206
|
} : n.type === "row" && n.rowUid ? {
|
|
194
207
|
rowUid: n.rowUid,
|
|
@@ -200,13 +213,13 @@ function ye(e, t, n) {
|
|
|
200
213
|
area: "body"
|
|
201
214
|
};
|
|
202
215
|
}
|
|
203
|
-
function
|
|
216
|
+
function xe(e, t, n) {
|
|
204
217
|
let r = (n.type === "row" || n.type === "block") && n.rowUid ? n.rowUid : String(t), i = e.rows.findIndex((e) => e.uid === r);
|
|
205
218
|
if (i !== -1) return i;
|
|
206
219
|
let a = e.footerRows.findIndex((e) => e.uid === r);
|
|
207
220
|
return a === -1 ? null : a;
|
|
208
221
|
}
|
|
209
|
-
function
|
|
222
|
+
function F(e, t) {
|
|
210
223
|
for (let n of [...e.rows, ...e.footerRows]) {
|
|
211
224
|
let e = n.blocks.findIndex((e) => e.uid === t);
|
|
212
225
|
if (e !== -1) return e;
|
|
@@ -218,85 +231,85 @@ function Se(e, t) {
|
|
|
218
231
|
}
|
|
219
232
|
//#endregion
|
|
220
233
|
//#region src/builder/state/editorModel.ts
|
|
221
|
-
var
|
|
222
|
-
function
|
|
234
|
+
var Ce = 1;
|
|
235
|
+
function we(e) {
|
|
223
236
|
let { rows: t = [], ...n } = e, r = n.config?.page?.footer?.rows ?? [];
|
|
224
237
|
return {
|
|
225
|
-
template:
|
|
226
|
-
rows: t.map((e) =>
|
|
227
|
-
footerRows: r.map((e) =>
|
|
238
|
+
template: Ue(et(n)),
|
|
239
|
+
rows: t.map((e) => Ge(e)),
|
|
240
|
+
footerRows: r.map((e) => Ge(e))
|
|
228
241
|
};
|
|
229
242
|
}
|
|
230
|
-
function
|
|
231
|
-
let t =
|
|
243
|
+
function Te(e) {
|
|
244
|
+
let t = We(et(e.template), e.footerRows);
|
|
232
245
|
return e.rows.length === 0 ? t : {
|
|
233
246
|
...t,
|
|
234
|
-
rows: e.rows.map((e) => ({ blocks: e.blocks.map((e) =>
|
|
247
|
+
rows: e.rows.map((e) => ({ blocks: e.blocks.map((e) => $e(e.block)) }))
|
|
235
248
|
};
|
|
236
249
|
}
|
|
237
|
-
function
|
|
238
|
-
return
|
|
239
|
-
uid:
|
|
240
|
-
blocks: [
|
|
250
|
+
function Ee(e, t, n = "body") {
|
|
251
|
+
return I(e, n, (e) => [...e, {
|
|
252
|
+
uid: tt("row"),
|
|
253
|
+
blocks: [Ke(t)]
|
|
241
254
|
}]);
|
|
242
255
|
}
|
|
243
|
-
function
|
|
244
|
-
let i =
|
|
245
|
-
return i ?
|
|
256
|
+
function De(e, t, n, r) {
|
|
257
|
+
let i = He(e, t);
|
|
258
|
+
return i ? I(e, i, (e) => e.map((e) => e.uid === t ? {
|
|
246
259
|
...e,
|
|
247
|
-
blocks:
|
|
260
|
+
blocks: Qe(e.blocks, Ke(n), r)
|
|
248
261
|
} : e)) : e;
|
|
249
262
|
}
|
|
250
|
-
function
|
|
251
|
-
return
|
|
263
|
+
function Oe(e, t) {
|
|
264
|
+
return L(e, (e) => e.map((e) => ({
|
|
252
265
|
...e,
|
|
253
266
|
blocks: e.blocks.filter((e) => e.uid !== t)
|
|
254
267
|
})).filter((e) => e.blocks.length > 0));
|
|
255
268
|
}
|
|
256
|
-
function
|
|
257
|
-
let a =
|
|
269
|
+
function ke(e, t, n, r, i = "body") {
|
|
270
|
+
let a = qe(e, t);
|
|
258
271
|
if (!a) return e;
|
|
259
|
-
if (n === null) return
|
|
272
|
+
if (n === null) return I(L(e, (e) => e.map((e) => ({
|
|
260
273
|
...e,
|
|
261
274
|
blocks: e.blocks.filter((e) => e.uid !== t)
|
|
262
275
|
})).filter((e) => e.blocks.length > 0)), i, (e) => [...e, {
|
|
263
|
-
uid:
|
|
276
|
+
uid: tt("row"),
|
|
264
277
|
blocks: [a]
|
|
265
278
|
}]);
|
|
266
|
-
let o =
|
|
267
|
-
return o ? I(
|
|
279
|
+
let o = He(e, n);
|
|
280
|
+
return o ? L(I(L(e, (e) => e.map((e) => ({
|
|
268
281
|
...e,
|
|
269
282
|
blocks: e.blocks.filter((e) => e.uid !== t)
|
|
270
283
|
}))), o, (e) => e.map((e) => e.uid === n ? {
|
|
271
284
|
...e,
|
|
272
|
-
blocks:
|
|
285
|
+
blocks: Qe(e.blocks, a, r)
|
|
273
286
|
} : e)), (e) => e.filter((e) => e.blocks.length > 0)) : e;
|
|
274
287
|
}
|
|
275
|
-
function
|
|
276
|
-
let r =
|
|
277
|
-
return r ?
|
|
288
|
+
function Ae(e, t, n) {
|
|
289
|
+
let r = He(e, t);
|
|
290
|
+
return r ? I(e, r, (e) => {
|
|
278
291
|
let r = e.find((e) => e.uid === t);
|
|
279
|
-
return r ?
|
|
292
|
+
return r ? Qe(e.filter((e) => e.uid !== t), r, n) : e;
|
|
280
293
|
}) : e;
|
|
281
294
|
}
|
|
282
|
-
function
|
|
283
|
-
return
|
|
295
|
+
function je(e, t, n) {
|
|
296
|
+
return L(e, (e) => e.map((e) => ({
|
|
284
297
|
...e,
|
|
285
298
|
blocks: e.blocks.map((e) => e.uid === t ? {
|
|
286
299
|
...e,
|
|
287
|
-
block:
|
|
300
|
+
block: $e(n)
|
|
288
301
|
} : e)
|
|
289
302
|
})));
|
|
290
303
|
}
|
|
291
|
-
function
|
|
304
|
+
function Me(e, t) {
|
|
292
305
|
return {
|
|
293
306
|
...e,
|
|
294
|
-
template:
|
|
307
|
+
template: we(t).template
|
|
295
308
|
};
|
|
296
309
|
}
|
|
297
|
-
function
|
|
310
|
+
function Ne(e) {
|
|
298
311
|
let t = e.template.config?.page?.size;
|
|
299
|
-
return
|
|
312
|
+
return Fe(t) ? {
|
|
300
313
|
format: "A4",
|
|
301
314
|
orientation: "portrait",
|
|
302
315
|
custom: t
|
|
@@ -306,7 +319,7 @@ function Me(e) {
|
|
|
306
319
|
custom: null
|
|
307
320
|
};
|
|
308
321
|
}
|
|
309
|
-
function
|
|
322
|
+
function Pe(e, t, n) {
|
|
310
323
|
let r = {
|
|
311
324
|
format: t,
|
|
312
325
|
orientation: n
|
|
@@ -325,24 +338,24 @@ function Ne(e, t, n) {
|
|
|
325
338
|
}
|
|
326
339
|
};
|
|
327
340
|
}
|
|
328
|
-
function
|
|
341
|
+
function Fe(e) {
|
|
329
342
|
return typeof e == "object" && !!e && "width" in e && "height" in e && typeof e.width == "number" && typeof e.height == "number";
|
|
330
343
|
}
|
|
331
|
-
function
|
|
332
|
-
let r =
|
|
333
|
-
return r ?
|
|
344
|
+
function Ie(e, t, n) {
|
|
345
|
+
let r = He(e, t);
|
|
346
|
+
return r ? I(e, r, (e) => e.map((e) => e.uid === t ? {
|
|
334
347
|
...e,
|
|
335
348
|
blocks: e.blocks.map((e, t) => ({
|
|
336
349
|
...e,
|
|
337
|
-
block:
|
|
350
|
+
block: Ze(e.block, n[t])
|
|
338
351
|
}))
|
|
339
352
|
} : e)) : e;
|
|
340
353
|
}
|
|
341
|
-
function
|
|
354
|
+
function Le(e) {
|
|
342
355
|
return e.template.config?.page?.footer?.repeat !== !1;
|
|
343
356
|
}
|
|
344
|
-
function
|
|
345
|
-
return
|
|
357
|
+
function Re(e, t) {
|
|
358
|
+
return Ve(e, (e) => {
|
|
346
359
|
let n = {
|
|
347
360
|
...e.footer,
|
|
348
361
|
repeat: t
|
|
@@ -353,12 +366,12 @@ function Le(e, t) {
|
|
|
353
366
|
};
|
|
354
367
|
});
|
|
355
368
|
}
|
|
356
|
-
function
|
|
369
|
+
function ze(e) {
|
|
357
370
|
let t = e.template.config?.page?.pageNumbers;
|
|
358
371
|
return t?.enabled === !0 ? t.position ?? "center" : "disabled";
|
|
359
372
|
}
|
|
360
|
-
function
|
|
361
|
-
return
|
|
373
|
+
function Be(e, t) {
|
|
374
|
+
return Ve(e, (e) => {
|
|
362
375
|
if (t === "disabled") {
|
|
363
376
|
let t = {
|
|
364
377
|
...e.pageNumbers,
|
|
@@ -379,7 +392,7 @@ function ze(e, t) {
|
|
|
379
392
|
};
|
|
380
393
|
});
|
|
381
394
|
}
|
|
382
|
-
function
|
|
395
|
+
function Ve(e, t) {
|
|
383
396
|
let n = e.template.config ?? {}, r = t(n.page ?? {}), i = {
|
|
384
397
|
...n,
|
|
385
398
|
page: r
|
|
@@ -392,10 +405,10 @@ function Be(e, t) {
|
|
|
392
405
|
}
|
|
393
406
|
};
|
|
394
407
|
}
|
|
395
|
-
function
|
|
408
|
+
function He(e, t) {
|
|
396
409
|
return e.rows.some((e) => e.uid === t) ? "body" : e.footerRows.some((e) => e.uid === t) ? "footer" : null;
|
|
397
410
|
}
|
|
398
|
-
function
|
|
411
|
+
function I(e, t, n) {
|
|
399
412
|
return t === "body" ? {
|
|
400
413
|
...e,
|
|
401
414
|
rows: n(e.rows)
|
|
@@ -404,14 +417,14 @@ function F(e, t, n) {
|
|
|
404
417
|
footerRows: n(e.footerRows)
|
|
405
418
|
};
|
|
406
419
|
}
|
|
407
|
-
function
|
|
420
|
+
function L(e, t) {
|
|
408
421
|
return {
|
|
409
422
|
...e,
|
|
410
423
|
rows: t(e.rows),
|
|
411
424
|
footerRows: t(e.footerRows)
|
|
412
425
|
};
|
|
413
426
|
}
|
|
414
|
-
function
|
|
427
|
+
function Ue(e) {
|
|
415
428
|
let t = e.config?.page?.footer;
|
|
416
429
|
if (!t) return e;
|
|
417
430
|
let { rows: n, ...r } = t, i = Object.keys(r).length === 0 ? void 0 : r, a = {
|
|
@@ -426,10 +439,10 @@ function He(e) {
|
|
|
426
439
|
}
|
|
427
440
|
};
|
|
428
441
|
}
|
|
429
|
-
function
|
|
442
|
+
function We(e, t) {
|
|
430
443
|
let n = e.config?.page ?? {}, r = n.footer ?? {};
|
|
431
444
|
if (!(t.length > 0 || r.repeat !== void 0)) return e;
|
|
432
|
-
let i = t.map((e) => ({ blocks: e.blocks.map((e) =>
|
|
445
|
+
let i = t.map((e) => ({ blocks: e.blocks.map((e) => $e(e.block)) })), a = {
|
|
433
446
|
...r,
|
|
434
447
|
...i.length > 0 ? { rows: i } : {}
|
|
435
448
|
}, o = {
|
|
@@ -444,34 +457,34 @@ function Ue(e, t) {
|
|
|
444
457
|
}
|
|
445
458
|
};
|
|
446
459
|
}
|
|
447
|
-
function
|
|
460
|
+
function Ge(e) {
|
|
448
461
|
return {
|
|
449
|
-
uid:
|
|
450
|
-
blocks: e.blocks.map((e) =>
|
|
462
|
+
uid: tt("row"),
|
|
463
|
+
blocks: e.blocks.map((e) => Ke(e))
|
|
451
464
|
};
|
|
452
465
|
}
|
|
453
|
-
function
|
|
466
|
+
function Ke(e) {
|
|
454
467
|
return {
|
|
455
|
-
uid:
|
|
456
|
-
block:
|
|
468
|
+
uid: tt("block"),
|
|
469
|
+
block: $e(e)
|
|
457
470
|
};
|
|
458
471
|
}
|
|
459
|
-
function Ke(e, t) {
|
|
460
|
-
return [...e.rows, ...e.footerRows].flatMap((e) => e.blocks).find((e) => e.uid === t);
|
|
461
|
-
}
|
|
462
472
|
function qe(e, t) {
|
|
463
|
-
return
|
|
473
|
+
return [...e.rows, ...e.footerRows].flatMap((e) => e.blocks).find((e) => e.uid === t);
|
|
464
474
|
}
|
|
465
475
|
function Je(e, t) {
|
|
466
|
-
return qe(e, t)
|
|
476
|
+
return t ? qe(e, t) ?? null : null;
|
|
467
477
|
}
|
|
468
478
|
function Ye(e, t) {
|
|
469
|
-
|
|
479
|
+
return Je(e, t) ? t : null;
|
|
480
|
+
}
|
|
481
|
+
function Xe(e, t) {
|
|
482
|
+
let n = Te(e), r = [...n.rows ?? [], ...n.config?.page?.footer?.rows ?? []], i = new Set(r.flatMap((e) => e.blocks.map((e) => e.id).filter((e) => typeof e == "string" && e.length > 0))), a = 1;
|
|
470
483
|
for (; i.has(`${t}-${a}`);) a += 1;
|
|
471
484
|
return `${t}-${a}`;
|
|
472
485
|
}
|
|
473
|
-
function
|
|
474
|
-
let n =
|
|
486
|
+
function Ze(e, t) {
|
|
487
|
+
let n = $e(e), r = { ...n.config };
|
|
475
488
|
if (t === void 0 || t === "" ? delete r.width : r.width = t, Object.keys(r).length === 0) {
|
|
476
489
|
let { config: e, ...t } = n;
|
|
477
490
|
return t;
|
|
@@ -481,29 +494,29 @@ function Xe(e, t) {
|
|
|
481
494
|
config: r
|
|
482
495
|
};
|
|
483
496
|
}
|
|
484
|
-
function
|
|
497
|
+
function Qe(e, t, n) {
|
|
485
498
|
let r = [...e], i = Math.max(0, Math.min(n, r.length));
|
|
486
499
|
return r.splice(i, 0, t), r;
|
|
487
500
|
}
|
|
488
|
-
function
|
|
489
|
-
return
|
|
501
|
+
function $e(e) {
|
|
502
|
+
return et(e);
|
|
490
503
|
}
|
|
491
|
-
function
|
|
504
|
+
function et(e) {
|
|
492
505
|
return structuredClone(e);
|
|
493
506
|
}
|
|
494
|
-
function
|
|
495
|
-
let t = `${e}-${
|
|
496
|
-
return
|
|
507
|
+
function tt(e) {
|
|
508
|
+
let t = `${e}-${Ce}`;
|
|
509
|
+
return Ce += 1, t;
|
|
497
510
|
}
|
|
498
511
|
//#endregion
|
|
499
512
|
//#region src/builder/hooks/useBuilderDragDrop.ts
|
|
500
|
-
function
|
|
513
|
+
function nt(e, t, n) {
|
|
501
514
|
let [r, i] = v(null);
|
|
502
515
|
return {
|
|
503
516
|
activeDrag: r,
|
|
504
|
-
sensors:
|
|
517
|
+
sensors: ge(),
|
|
505
518
|
onDragStart: f((e) => {
|
|
506
|
-
let t =
|
|
519
|
+
let t = P(e.active.data.current);
|
|
507
520
|
if (t.source === "palette" && t.type) {
|
|
508
521
|
i({
|
|
509
522
|
kind: "palette",
|
|
@@ -516,7 +529,7 @@ function et(e, t, n) {
|
|
|
516
529
|
return;
|
|
517
530
|
}
|
|
518
531
|
if (t.type === "block" && t.blockUid) {
|
|
519
|
-
let e =
|
|
532
|
+
let e = qe(n.current, t.blockUid);
|
|
520
533
|
i(e ? {
|
|
521
534
|
kind: "block",
|
|
522
535
|
block: e.block
|
|
@@ -525,7 +538,7 @@ function et(e, t, n) {
|
|
|
525
538
|
}, [n]),
|
|
526
539
|
onDragEnd: f((n) => {
|
|
527
540
|
if (i(null), !n.over) return;
|
|
528
|
-
let r =
|
|
541
|
+
let r = P(n.active.data.current), a = P(n.over.data.current);
|
|
529
542
|
if (r.source === "palette" && r.type && e) {
|
|
530
543
|
t({
|
|
531
544
|
type: "dropFromPalette",
|
|
@@ -559,21 +572,21 @@ function et(e, t, n) {
|
|
|
559
572
|
}
|
|
560
573
|
//#endregion
|
|
561
574
|
//#region src/render/usePdfUaApi.ts
|
|
562
|
-
function
|
|
575
|
+
function rt({ initialApiUrl: e, apiUrl: t, onRendered: n, loadSchemaOnMount: r = !0 }) {
|
|
563
576
|
let [i, a] = v(null), [o, s] = v(!1), [c, l] = v(null), [u, d] = v(!1), [p, h] = v(null), g = _(e), y = _(0), b = _(0), x = _(null), S = _(n);
|
|
564
577
|
m(() => {
|
|
565
578
|
S.current = n;
|
|
566
579
|
}, [n]), m(() => () => {
|
|
567
|
-
|
|
580
|
+
it(x.current), x.current = null;
|
|
568
581
|
}, []);
|
|
569
582
|
let C = f(async (e) => {
|
|
570
583
|
let t = y.current + 1;
|
|
571
584
|
y.current = t, s(!0), h(null);
|
|
572
585
|
try {
|
|
573
|
-
let n = await
|
|
586
|
+
let n = await ce(e);
|
|
574
587
|
t === y.current && a(n);
|
|
575
588
|
} catch (e) {
|
|
576
|
-
t === y.current && h(
|
|
589
|
+
t === y.current && h(at(e));
|
|
577
590
|
} finally {
|
|
578
591
|
t === y.current && s(!1);
|
|
579
592
|
}
|
|
@@ -591,106 +604,106 @@ function tt({ initialApiUrl: e, apiUrl: t, onRendered: n, loadSchemaOnMount: r =
|
|
|
591
604
|
let r = b.current + 1;
|
|
592
605
|
b.current = r, d(!0), h(null);
|
|
593
606
|
try {
|
|
594
|
-
let i = await
|
|
607
|
+
let i = await le(t, {
|
|
595
608
|
template: e,
|
|
596
609
|
data: n,
|
|
597
610
|
options: { title: "Template Preview" }
|
|
598
611
|
}), a = URL.createObjectURL(i);
|
|
599
612
|
if (r !== b.current) {
|
|
600
|
-
|
|
613
|
+
it(a);
|
|
601
614
|
return;
|
|
602
615
|
}
|
|
603
|
-
l((e) => (
|
|
616
|
+
l((e) => (it(e), x.current = a, a)), S.current?.(i);
|
|
604
617
|
} catch (e) {
|
|
605
|
-
r === b.current && h(
|
|
618
|
+
r === b.current && h(at(e));
|
|
606
619
|
} finally {
|
|
607
620
|
r === b.current && d(!1);
|
|
608
621
|
}
|
|
609
622
|
}, [t])
|
|
610
623
|
};
|
|
611
624
|
}
|
|
612
|
-
function
|
|
625
|
+
function it(e) {
|
|
613
626
|
e && URL.revokeObjectURL(e);
|
|
614
627
|
}
|
|
615
|
-
function
|
|
628
|
+
function at(e) {
|
|
616
629
|
return e instanceof Error ? e.message : String(e);
|
|
617
630
|
}
|
|
618
631
|
//#endregion
|
|
619
632
|
//#region src/render/RenderContext.tsx
|
|
620
|
-
var
|
|
621
|
-
function
|
|
622
|
-
return /* @__PURE__ */ b(
|
|
633
|
+
var ot = u(null);
|
|
634
|
+
function st({ value: e, children: t }) {
|
|
635
|
+
return /* @__PURE__ */ b(ot.Provider, {
|
|
623
636
|
value: e,
|
|
624
637
|
children: t
|
|
625
638
|
});
|
|
626
639
|
}
|
|
627
|
-
function
|
|
628
|
-
let e = p(
|
|
640
|
+
function ct() {
|
|
641
|
+
let e = p(ot);
|
|
629
642
|
if (!e) throw Error("useRenderContext must be used within a render provider.");
|
|
630
643
|
return e;
|
|
631
644
|
}
|
|
632
645
|
//#endregion
|
|
633
646
|
//#region src/builder/schema/schemaAdapter.ts
|
|
634
|
-
function
|
|
635
|
-
return
|
|
647
|
+
function lt(e) {
|
|
648
|
+
return xt(e["x-pdfUa"]);
|
|
636
649
|
}
|
|
637
|
-
function
|
|
650
|
+
function ut(e, t) {
|
|
638
651
|
if (!t.startsWith("#/")) throw Error(`Unsupported schema ref: ${t}`);
|
|
639
652
|
let n = t.slice(2).split("/").reduce((e, t) => {
|
|
640
|
-
if (R(e)) return e[
|
|
653
|
+
if (R(e)) return e[Ct(t)];
|
|
641
654
|
}, e);
|
|
642
655
|
if (!R(n)) throw Error(`Schema ref not found: ${t}`);
|
|
643
656
|
return n;
|
|
644
657
|
}
|
|
645
|
-
function
|
|
646
|
-
let t =
|
|
658
|
+
function dt(e) {
|
|
659
|
+
let t = mt(e).map((e) => gt(e)).filter((e) => e !== void 0), n = new Set(t), r = lt(e).blockOrder.filter((e) => n.has(e)), i = t.filter((e) => !r.includes(e));
|
|
647
660
|
return [...r, ...i];
|
|
648
661
|
}
|
|
649
|
-
function
|
|
650
|
-
return
|
|
662
|
+
function ft(e, t) {
|
|
663
|
+
return mt(e).find((e) => gt(e) === t);
|
|
651
664
|
}
|
|
652
|
-
function
|
|
653
|
-
let r =
|
|
665
|
+
function pt(e, t, n) {
|
|
666
|
+
let r = ht(e, t), i = _t(r), a = {
|
|
654
667
|
type: t,
|
|
655
668
|
id: n
|
|
656
669
|
};
|
|
657
|
-
for (let t of
|
|
670
|
+
for (let t of bt(r.required)) {
|
|
658
671
|
if (t === "type" || t === "config" || t === "id" || a[t] !== void 0) continue;
|
|
659
672
|
let n = i[t];
|
|
660
|
-
R(n) && (a[t] =
|
|
673
|
+
R(n) && (a[t] = vt(e, n));
|
|
661
674
|
}
|
|
662
675
|
return a;
|
|
663
676
|
}
|
|
664
|
-
function
|
|
677
|
+
function mt(e) {
|
|
665
678
|
let t = e.$defs, n = R(t) ? t.block : void 0;
|
|
666
679
|
return (R(n) && Array.isArray(n.oneOf) ? n.oneOf : []).map((t) => {
|
|
667
680
|
if (!R(t)) return;
|
|
668
681
|
let n = t.$ref;
|
|
669
|
-
return typeof n == "string" ?
|
|
682
|
+
return typeof n == "string" ? ut(e, n) : t;
|
|
670
683
|
}).filter((e) => e !== void 0);
|
|
671
684
|
}
|
|
672
|
-
function
|
|
673
|
-
let n =
|
|
685
|
+
function ht(e, t) {
|
|
686
|
+
let n = ft(e, t);
|
|
674
687
|
if (!n) throw Error(`Unknown block type: ${t}`);
|
|
675
688
|
return n;
|
|
676
689
|
}
|
|
677
|
-
function
|
|
678
|
-
let t =
|
|
690
|
+
function gt(e) {
|
|
691
|
+
let t = _t(e).type;
|
|
679
692
|
if (R(t)) return typeof t.const == "string" ? t.const : void 0;
|
|
680
693
|
}
|
|
681
|
-
function
|
|
694
|
+
function _t(e) {
|
|
682
695
|
return R(e.properties) ? e.properties : {};
|
|
683
696
|
}
|
|
684
|
-
function
|
|
697
|
+
function vt(e, t) {
|
|
685
698
|
if ("default" in t) return t.default;
|
|
686
699
|
if (Array.isArray(t.enum)) return t.enum.find((e) => e !== null);
|
|
687
700
|
if (typeof t.const == "string" || typeof t.const == "number") return t.const;
|
|
688
|
-
if (typeof t.$ref == "string") return
|
|
701
|
+
if (typeof t.$ref == "string") return vt(e, ut(e, t.$ref));
|
|
689
702
|
if (Array.isArray(t.oneOf)) {
|
|
690
703
|
let n = t.oneOf.find((e) => R(e) && e.type !== "null");
|
|
691
|
-
return R(n) ?
|
|
704
|
+
return R(n) ? vt(e, n) : void 0;
|
|
692
705
|
}
|
|
693
|
-
switch (
|
|
706
|
+
switch (yt(t.type)) {
|
|
694
707
|
case "string": return "";
|
|
695
708
|
case "integer":
|
|
696
709
|
case "number": return 0;
|
|
@@ -700,36 +713,36 @@ function gt(e, t) {
|
|
|
700
713
|
default: return;
|
|
701
714
|
}
|
|
702
715
|
}
|
|
703
|
-
function
|
|
716
|
+
function yt(e) {
|
|
704
717
|
if (typeof e == "string") return e;
|
|
705
718
|
if (Array.isArray(e)) return e.find((e) => typeof e == "string" && e !== "null");
|
|
706
719
|
}
|
|
707
|
-
function
|
|
720
|
+
function bt(e) {
|
|
708
721
|
return Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
|
|
709
722
|
}
|
|
710
|
-
function
|
|
711
|
-
if (!R(e) || !
|
|
723
|
+
function xt(e) {
|
|
724
|
+
if (!R(e) || !St(e.blockOrder)) throw Error("Invalid template schema metadata");
|
|
712
725
|
return e;
|
|
713
726
|
}
|
|
714
|
-
function
|
|
727
|
+
function St(e) {
|
|
715
728
|
return Array.isArray(e) && e.every((e) => typeof e == "string");
|
|
716
729
|
}
|
|
717
730
|
function R(e) {
|
|
718
|
-
return
|
|
731
|
+
return N(e);
|
|
719
732
|
}
|
|
720
|
-
function
|
|
733
|
+
function Ct(e) {
|
|
721
734
|
return e.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
722
735
|
}
|
|
723
736
|
//#endregion
|
|
724
737
|
//#region src/builder/state/editorReducer.ts
|
|
725
|
-
function
|
|
738
|
+
function wt(e, t) {
|
|
726
739
|
return {
|
|
727
|
-
model:
|
|
740
|
+
model: we(e),
|
|
728
741
|
data: t,
|
|
729
742
|
selectedBlockUid: null
|
|
730
743
|
};
|
|
731
744
|
}
|
|
732
|
-
function
|
|
745
|
+
function Tt(e, t) {
|
|
733
746
|
switch (t.type) {
|
|
734
747
|
case "selectBlock": return {
|
|
735
748
|
...e,
|
|
@@ -739,31 +752,31 @@ function Ct(e, t) {
|
|
|
739
752
|
...e,
|
|
740
753
|
selectedBlockUid: null
|
|
741
754
|
};
|
|
742
|
-
case "changeBlock": return z(e,
|
|
743
|
-
case "removeBlock": return z(e,
|
|
744
|
-
case "changeTemplateSettings": return z(e,
|
|
745
|
-
case "setRowWidths": return z(e,
|
|
746
|
-
case "addBlock": return z(e,
|
|
747
|
-
case "setFormat": return z(e,
|
|
748
|
-
case "setOrientation": return z(e,
|
|
749
|
-
case "setFooterRepeat": return z(e,
|
|
750
|
-
case "setPageNumbers": return z(e,
|
|
755
|
+
case "changeBlock": return z(e, je(e.model, t.blockUid, t.block));
|
|
756
|
+
case "removeBlock": return z(e, Oe(e.model, t.blockUid));
|
|
757
|
+
case "changeTemplateSettings": return z(e, Me(e.model, t.template));
|
|
758
|
+
case "setRowWidths": return z(e, Ie(e.model, t.rowUid, t.widths));
|
|
759
|
+
case "addBlock": return z(e, Ee(e.model, Et(e.model, t)));
|
|
760
|
+
case "setFormat": return z(e, Pe(e.model, t.format, Ne(e.model).orientation));
|
|
761
|
+
case "setOrientation": return z(e, Pe(e.model, Ne(e.model).format, t.orientation));
|
|
762
|
+
case "setFooterRepeat": return z(e, Re(e.model, t.repeat));
|
|
763
|
+
case "setPageNumbers": return z(e, Be(e.model, t.value));
|
|
751
764
|
case "setData": return {
|
|
752
765
|
...e,
|
|
753
766
|
data: t.data
|
|
754
767
|
};
|
|
755
|
-
case "loadExample": return
|
|
768
|
+
case "loadExample": return wt(t.template, t.data);
|
|
756
769
|
case "dropFromPalette": {
|
|
757
|
-
let n =
|
|
758
|
-
return z(e, n.rowUid === null ?
|
|
770
|
+
let n = be(e.model, t.overId, t.overData), r = Et(e.model, t);
|
|
771
|
+
return z(e, n.rowUid === null ? Ee(e.model, r, n.area) : De(e.model, n.rowUid, r, n.index));
|
|
759
772
|
}
|
|
760
773
|
case "moveRowTo": {
|
|
761
|
-
let n =
|
|
762
|
-
return n === null ? e : z(e,
|
|
774
|
+
let n = xe(e.model, t.overId, t.overData);
|
|
775
|
+
return n === null ? e : z(e, Ae(e.model, t.rowUid, n));
|
|
763
776
|
}
|
|
764
777
|
case "moveBlockTo": {
|
|
765
|
-
let n =
|
|
766
|
-
return z(e,
|
|
778
|
+
let n = be(e.model, t.overId, t.overData);
|
|
779
|
+
return z(e, ke(e.model, t.blockUid, n.rowUid, n.index, n.area));
|
|
767
780
|
}
|
|
768
781
|
}
|
|
769
782
|
}
|
|
@@ -771,35 +784,35 @@ function z(e, t) {
|
|
|
771
784
|
return {
|
|
772
785
|
...e,
|
|
773
786
|
model: t,
|
|
774
|
-
selectedBlockUid:
|
|
787
|
+
selectedBlockUid: Ye(t, e.selectedBlockUid)
|
|
775
788
|
};
|
|
776
789
|
}
|
|
777
|
-
function
|
|
778
|
-
return
|
|
790
|
+
function Et(e, t) {
|
|
791
|
+
return pt(t.schema, t.blockType, Xe(e, t.blockType));
|
|
779
792
|
}
|
|
780
793
|
//#endregion
|
|
781
794
|
//#region src/builder/context/BuilderContext.tsx
|
|
782
|
-
var
|
|
783
|
-
function
|
|
784
|
-
let e = p(
|
|
795
|
+
var Dt = { version: 1 }, Ot = u(null), kt = u(null);
|
|
796
|
+
function At() {
|
|
797
|
+
let e = p(Ot);
|
|
785
798
|
if (!e) throw Error("useBuilderState must be used within a <TemplateBuilderProvider>.");
|
|
786
799
|
return e;
|
|
787
800
|
}
|
|
788
|
-
function
|
|
789
|
-
let e = p(
|
|
801
|
+
function jt() {
|
|
802
|
+
let e = p(kt);
|
|
790
803
|
if (!e) throw Error("useBuilderActions must be used within a <TemplateBuilderProvider>.");
|
|
791
804
|
return e;
|
|
792
805
|
}
|
|
793
|
-
function
|
|
806
|
+
function Mt() {
|
|
794
807
|
return {
|
|
795
|
-
...
|
|
796
|
-
...
|
|
808
|
+
...At(),
|
|
809
|
+
...jt()
|
|
797
810
|
};
|
|
798
811
|
}
|
|
799
|
-
function
|
|
800
|
-
let l =
|
|
812
|
+
function Nt({ apiUrl: n, initialTemplate: r, initialData: a, onChange: o, onRendered: s, children: c }) {
|
|
813
|
+
let l = ae(n), [u, d] = g(Tt, void 0, () => wt(r ?? Dt, a ?? {})), { model: p, data: v, selectedBlockUid: y } = u, S = _(p);
|
|
801
814
|
S.current = p;
|
|
802
|
-
let { schema: C, schemaLoading: w, pdfUrl: T, pdfLoading: E, error: D, renderPdf: ee } =
|
|
815
|
+
let { schema: C, schemaLoading: w, pdfUrl: T, pdfLoading: E, error: D, renderPdf: ee } = rt({
|
|
803
816
|
initialApiUrl: l,
|
|
804
817
|
apiUrl: l,
|
|
805
818
|
onRendered: s
|
|
@@ -807,7 +820,7 @@ function jt({ apiUrl: n, initialTemplate: r, initialData: a, onChange: o, onRend
|
|
|
807
820
|
m(() => {
|
|
808
821
|
te.current = o;
|
|
809
822
|
}, [o]);
|
|
810
|
-
let O = h(() =>
|
|
823
|
+
let O = h(() => Te(p), [p]);
|
|
811
824
|
m(() => {
|
|
812
825
|
if (ne.current) {
|
|
813
826
|
ne.current = !1;
|
|
@@ -815,13 +828,13 @@ function jt({ apiUrl: n, initialTemplate: r, initialData: a, onChange: o, onRend
|
|
|
815
828
|
}
|
|
816
829
|
te.current?.(O, v);
|
|
817
830
|
}, [O, v]);
|
|
818
|
-
let k = C, re = h(() => k ?
|
|
819
|
-
|
|
831
|
+
let k = C, re = h(() => k ? dt(k) : [], [k]), A = h(() => Je(p, y), [p, y]), ie = _(O);
|
|
832
|
+
ie.current = O;
|
|
820
833
|
let oe = _(v);
|
|
821
834
|
oe.current = v;
|
|
822
835
|
let se = _(k);
|
|
823
836
|
se.current = k;
|
|
824
|
-
let { activeDrag: ce, sensors: le, onDragStart: ue, onDragEnd: de, onDragCancel: fe } =
|
|
837
|
+
let { activeDrag: ce, sensors: le, onDragStart: ue, onDragEnd: de, onDragCancel: fe } = nt(k, d, S), pe = f((e) => {
|
|
825
838
|
d({
|
|
826
839
|
type: "loadExample",
|
|
827
840
|
template: e.template,
|
|
@@ -838,30 +851,30 @@ function jt({ apiUrl: n, initialTemplate: r, initialData: a, onChange: o, onRend
|
|
|
838
851
|
type: "changeTemplateSettings",
|
|
839
852
|
template: e
|
|
840
853
|
});
|
|
841
|
-
}, []),
|
|
854
|
+
}, []), M = f((e) => {
|
|
842
855
|
d({
|
|
843
856
|
type: "removeBlock",
|
|
844
857
|
blockUid: e
|
|
845
858
|
});
|
|
846
|
-
}, []),
|
|
859
|
+
}, []), he = f((e) => {
|
|
847
860
|
d({
|
|
848
861
|
type: "selectBlock",
|
|
849
862
|
blockUid: e
|
|
850
863
|
});
|
|
851
864
|
}, []), ge = f(() => {
|
|
852
865
|
d({ type: "deselect" });
|
|
853
|
-
}, []),
|
|
866
|
+
}, []), N = f((e, t) => {
|
|
854
867
|
d({
|
|
855
868
|
type: "setRowWidths",
|
|
856
869
|
rowUid: e,
|
|
857
870
|
widths: t
|
|
858
871
|
});
|
|
859
|
-
}, []),
|
|
872
|
+
}, []), _e = f((e) => {
|
|
860
873
|
d({
|
|
861
874
|
type: "setData",
|
|
862
875
|
data: e
|
|
863
876
|
});
|
|
864
|
-
}, []),
|
|
877
|
+
}, []), ve = f((e) => {
|
|
865
878
|
let t = se.current;
|
|
866
879
|
t && d({
|
|
867
880
|
type: "addBlock",
|
|
@@ -873,54 +886,54 @@ function jt({ apiUrl: n, initialTemplate: r, initialData: a, onChange: o, onRend
|
|
|
873
886
|
type: "setFormat",
|
|
874
887
|
format: e
|
|
875
888
|
});
|
|
876
|
-
}, []),
|
|
889
|
+
}, []), P = f((e) => {
|
|
877
890
|
d({
|
|
878
891
|
type: "setOrientation",
|
|
879
892
|
orientation: e
|
|
880
893
|
});
|
|
881
|
-
}, []),
|
|
894
|
+
}, []), be = f((e) => {
|
|
882
895
|
d({
|
|
883
896
|
type: "setFooterRepeat",
|
|
884
897
|
repeat: e
|
|
885
898
|
});
|
|
886
|
-
}, []),
|
|
899
|
+
}, []), xe = f((e) => {
|
|
887
900
|
d({
|
|
888
901
|
type: "setPageNumbers",
|
|
889
902
|
value: e
|
|
890
903
|
});
|
|
891
|
-
}, []),
|
|
892
|
-
ee(
|
|
893
|
-
}, [ee]),
|
|
894
|
-
renderPdf:
|
|
904
|
+
}, []), F = f(() => {
|
|
905
|
+
ee(ie.current, oe.current);
|
|
906
|
+
}, [ee]), Se = h(() => ({
|
|
907
|
+
renderPdf: F,
|
|
895
908
|
loadExample: pe,
|
|
896
|
-
addBlock:
|
|
909
|
+
addBlock: ve,
|
|
897
910
|
changeBlock: j,
|
|
898
911
|
changeTemplateSettings: me,
|
|
899
|
-
removeBlock:
|
|
900
|
-
selectBlock:
|
|
912
|
+
removeBlock: M,
|
|
913
|
+
selectBlock: he,
|
|
901
914
|
deselect: ge,
|
|
902
|
-
setRowWidths:
|
|
903
|
-
changeData:
|
|
915
|
+
setRowWidths: N,
|
|
916
|
+
changeData: _e,
|
|
904
917
|
changeFormat: ye,
|
|
905
|
-
changeOrientation:
|
|
906
|
-
toggleFooterRepeat:
|
|
907
|
-
changePageNumbers:
|
|
918
|
+
changeOrientation: P,
|
|
919
|
+
toggleFooterRepeat: be,
|
|
920
|
+
changePageNumbers: xe
|
|
908
921
|
}), [
|
|
909
|
-
|
|
922
|
+
F,
|
|
910
923
|
pe,
|
|
911
|
-
|
|
924
|
+
ve,
|
|
912
925
|
j,
|
|
913
926
|
me,
|
|
914
|
-
he,
|
|
915
927
|
M,
|
|
928
|
+
he,
|
|
916
929
|
ge,
|
|
930
|
+
N,
|
|
917
931
|
_e,
|
|
918
|
-
ve,
|
|
919
932
|
ye,
|
|
933
|
+
P,
|
|
920
934
|
be,
|
|
921
|
-
xe
|
|
922
|
-
|
|
923
|
-
]), Te = h(() => ({
|
|
935
|
+
xe
|
|
936
|
+
]), Ce = h(() => ({
|
|
924
937
|
schema: C,
|
|
925
938
|
schemaLoading: w,
|
|
926
939
|
model: p,
|
|
@@ -929,9 +942,9 @@ function jt({ apiUrl: n, initialTemplate: r, initialData: a, onChange: o, onRend
|
|
|
929
942
|
selectedBlockUid: y,
|
|
930
943
|
selectedBlock: A,
|
|
931
944
|
blockTypes: re,
|
|
932
|
-
pageSize:
|
|
933
|
-
footerRepeat:
|
|
934
|
-
pageNumbers:
|
|
945
|
+
pageSize: Ne(p),
|
|
946
|
+
footerRepeat: Le(p),
|
|
947
|
+
pageNumbers: ze(p),
|
|
935
948
|
pdfUrl: T,
|
|
936
949
|
pdfLoading: E,
|
|
937
950
|
error: D
|
|
@@ -947,13 +960,13 @@ function jt({ apiUrl: n, initialTemplate: r, initialData: a, onChange: o, onRend
|
|
|
947
960
|
T,
|
|
948
961
|
E,
|
|
949
962
|
D
|
|
950
|
-
]),
|
|
963
|
+
]), we = h(() => ({
|
|
951
964
|
template: O,
|
|
952
965
|
data: v,
|
|
953
966
|
pdfUrl: T,
|
|
954
967
|
pdfLoading: E,
|
|
955
968
|
error: D,
|
|
956
|
-
renderPdf:
|
|
969
|
+
renderPdf: F,
|
|
957
970
|
renderDisabled: !C || E
|
|
958
971
|
}), [
|
|
959
972
|
O,
|
|
@@ -961,42 +974,42 @@ function jt({ apiUrl: n, initialTemplate: r, initialData: a, onChange: o, onRend
|
|
|
961
974
|
T,
|
|
962
975
|
E,
|
|
963
976
|
D,
|
|
964
|
-
|
|
977
|
+
F,
|
|
965
978
|
C
|
|
966
979
|
]);
|
|
967
|
-
return /* @__PURE__ */ b(
|
|
968
|
-
value:
|
|
969
|
-
children: /* @__PURE__ */ b(
|
|
970
|
-
value:
|
|
980
|
+
return /* @__PURE__ */ b(kt.Provider, {
|
|
981
|
+
value: Se,
|
|
982
|
+
children: /* @__PURE__ */ b(Ot.Provider, {
|
|
983
|
+
value: Ce,
|
|
971
984
|
children: /* @__PURE__ */ x(e, {
|
|
972
985
|
sensors: le,
|
|
973
986
|
collisionDetection: i,
|
|
974
987
|
onDragStart: ue,
|
|
975
988
|
onDragEnd: de,
|
|
976
989
|
onDragCancel: fe,
|
|
977
|
-
children: [/* @__PURE__ */ b(
|
|
978
|
-
value:
|
|
990
|
+
children: [/* @__PURE__ */ b(st, {
|
|
991
|
+
value: we,
|
|
979
992
|
children: c
|
|
980
993
|
}), /* @__PURE__ */ b(t, {
|
|
981
994
|
dropAnimation: null,
|
|
982
|
-
children: ce ? /* @__PURE__ */ b(
|
|
995
|
+
children: ce ? /* @__PURE__ */ b(Pt, { drag: ce }) : null
|
|
983
996
|
})]
|
|
984
997
|
})
|
|
985
998
|
})
|
|
986
999
|
});
|
|
987
1000
|
}
|
|
988
|
-
function
|
|
989
|
-
return e.kind === "palette" ? /* @__PURE__ */ b(
|
|
1001
|
+
function Pt({ drag: e }) {
|
|
1002
|
+
return e.kind === "palette" ? /* @__PURE__ */ b(he, {
|
|
990
1003
|
type: e.type,
|
|
991
1004
|
prefix: "+ "
|
|
992
|
-
}) : e.kind === "block" ? /* @__PURE__ */ b(
|
|
1005
|
+
}) : e.kind === "block" ? /* @__PURE__ */ b(he, {
|
|
993
1006
|
type: e.block.type,
|
|
994
|
-
summary:
|
|
1007
|
+
summary: pe(e.block)
|
|
995
1008
|
}) : /* @__PURE__ */ b("div", {
|
|
996
1009
|
className: "pointer-events-none origin-top-left rotate-[1.5deg] scale-[1.02] cursor-grabbing drop-shadow-drag",
|
|
997
1010
|
children: /* @__PURE__ */ x("div", {
|
|
998
1011
|
className: "inline-flex min-w-[180px] max-w-[360px] items-center gap-2 rounded-lg border border-solid border-border-strong bg-surface px-3 py-2 text-sm font-medium",
|
|
999
|
-
children: [/* @__PURE__ */ b(
|
|
1012
|
+
children: [/* @__PURE__ */ b(M, { children: "⋮⋮" }), /* @__PURE__ */ b("span", {
|
|
1000
1013
|
className: "font-medium",
|
|
1001
1014
|
children: "Row"
|
|
1002
1015
|
})]
|
|
@@ -1005,49 +1018,49 @@ function Mt({ drag: e }) {
|
|
|
1005
1018
|
}
|
|
1006
1019
|
//#endregion
|
|
1007
1020
|
//#region src/builder/controls/inputs.tsx
|
|
1008
|
-
var
|
|
1009
|
-
function
|
|
1021
|
+
var Ft = "min-w-0 rounded-md border border-solid border-border bg-surface text-fg outline-none transition-colors hover:border-border-strong focus-visible:border-accent focus-visible:ring-3 focus-visible:ring-accent/20";
|
|
1022
|
+
function It(...e) {
|
|
1010
1023
|
return e.filter(Boolean).join(" ");
|
|
1011
1024
|
}
|
|
1012
1025
|
function B({ className: e, ...t }) {
|
|
1013
1026
|
return /* @__PURE__ */ b("input", {
|
|
1014
|
-
className:
|
|
1027
|
+
className: It("h-8 w-full px-3", Ft, e),
|
|
1015
1028
|
...t
|
|
1016
1029
|
});
|
|
1017
1030
|
}
|
|
1018
|
-
function
|
|
1031
|
+
function Lt({ className: e, ...t }) {
|
|
1019
1032
|
return /* @__PURE__ */ b("textarea", {
|
|
1020
|
-
className:
|
|
1033
|
+
className: It("min-h-24 w-full px-3 py-2 font-mono text-xs", Ft, e),
|
|
1021
1034
|
...t
|
|
1022
1035
|
});
|
|
1023
1036
|
}
|
|
1024
|
-
function
|
|
1037
|
+
function Rt({ className: e, ...t }) {
|
|
1025
1038
|
return /* @__PURE__ */ b("select", {
|
|
1026
|
-
className:
|
|
1039
|
+
className: It("h-8 cursor-pointer pl-3 pr-7 appearance-none bg-[linear-gradient(45deg,transparent_50%,var(--pdfua-fg-muted)_50%),linear-gradient(135deg,var(--pdfua-fg-muted)_50%,transparent_50%)] bg-[length:5px_5px,5px_5px] bg-[position:calc(100%-14px)_50%,calc(100%-9px)_50%] bg-no-repeat", Ft, e),
|
|
1027
1040
|
...t
|
|
1028
1041
|
});
|
|
1029
1042
|
}
|
|
1030
|
-
function
|
|
1043
|
+
function zt({ className: e, ...t }) {
|
|
1031
1044
|
return /* @__PURE__ */ b("input", {
|
|
1032
1045
|
type: "checkbox",
|
|
1033
|
-
className:
|
|
1046
|
+
className: It("h-3.5 w-3.5 accent-accent", e),
|
|
1034
1047
|
...t
|
|
1035
1048
|
});
|
|
1036
1049
|
}
|
|
1037
1050
|
//#endregion
|
|
1038
1051
|
//#region src/builder/controls/fieldConverters.ts
|
|
1039
|
-
function
|
|
1052
|
+
function Bt(e, t) {
|
|
1040
1053
|
if (!(e === "" && t === "undefined")) return e;
|
|
1041
1054
|
}
|
|
1042
|
-
function
|
|
1055
|
+
function Vt(e, t) {
|
|
1043
1056
|
if (!(e === "" || Number.isNaN(t))) return t;
|
|
1044
1057
|
}
|
|
1045
|
-
function
|
|
1058
|
+
function Ht(e, t) {
|
|
1046
1059
|
if (e !== "") return t.find((t) => t.value === e)?.value;
|
|
1047
1060
|
}
|
|
1048
1061
|
//#endregion
|
|
1049
1062
|
//#region src/builder/controls/BuilderField.tsx
|
|
1050
|
-
function
|
|
1063
|
+
function Ut({ value: e, placeholder: t, emptyValue: n = "empty-string", autoComplete: r, onChange: i, ...a }) {
|
|
1051
1064
|
let o = W(a);
|
|
1052
1065
|
return /* @__PURE__ */ b(U, {
|
|
1053
1066
|
...a,
|
|
@@ -1061,15 +1074,15 @@ function Vt({ value: e, placeholder: t, emptyValue: n = "empty-string", autoComp
|
|
|
1061
1074
|
disabled: a.disabled,
|
|
1062
1075
|
"aria-describedby": o.describedBy,
|
|
1063
1076
|
"aria-invalid": o.invalid || void 0,
|
|
1064
|
-
onChange: (e) => i(
|
|
1077
|
+
onChange: (e) => i(Bt(e.currentTarget.value, n))
|
|
1065
1078
|
})
|
|
1066
1079
|
});
|
|
1067
1080
|
}
|
|
1068
|
-
function
|
|
1081
|
+
function Wt({ value: e, placeholder: t, emptyValue: n = "empty-string", rows: r = 4, onChange: i, ...a }) {
|
|
1069
1082
|
let o = W(a);
|
|
1070
1083
|
return /* @__PURE__ */ b(U, {
|
|
1071
1084
|
...a,
|
|
1072
|
-
children: /* @__PURE__ */ b(
|
|
1085
|
+
children: /* @__PURE__ */ b(Lt, {
|
|
1073
1086
|
id: o.id,
|
|
1074
1087
|
name: a.name,
|
|
1075
1088
|
value: e ?? "",
|
|
@@ -1078,7 +1091,7 @@ function Ht({ value: e, placeholder: t, emptyValue: n = "empty-string", rows: r
|
|
|
1078
1091
|
disabled: a.disabled,
|
|
1079
1092
|
"aria-describedby": o.describedBy,
|
|
1080
1093
|
"aria-invalid": o.invalid || void 0,
|
|
1081
|
-
onChange: (e) => i(
|
|
1094
|
+
onChange: (e) => i(Bt(e.currentTarget.value, n))
|
|
1082
1095
|
})
|
|
1083
1096
|
});
|
|
1084
1097
|
}
|
|
@@ -1098,7 +1111,7 @@ function V({ value: e, min: t, max: n, step: r, placeholder: i, onChange: a, ...
|
|
|
1098
1111
|
disabled: o.disabled,
|
|
1099
1112
|
"aria-describedby": s.describedBy,
|
|
1100
1113
|
"aria-invalid": s.invalid || void 0,
|
|
1101
|
-
onChange: (e) => a(
|
|
1114
|
+
onChange: (e) => a(Vt(e.currentTarget.value, e.currentTarget.valueAsNumber))
|
|
1102
1115
|
})
|
|
1103
1116
|
});
|
|
1104
1117
|
}
|
|
@@ -1106,7 +1119,7 @@ function H({ value: e, options: t, optional: n = !1, emptyLabel: r = "", onChang
|
|
|
1106
1119
|
let o = W(a);
|
|
1107
1120
|
return /* @__PURE__ */ b(U, {
|
|
1108
1121
|
...a,
|
|
1109
|
-
children: /* @__PURE__ */ x(
|
|
1122
|
+
children: /* @__PURE__ */ x(Rt, {
|
|
1110
1123
|
id: o.id,
|
|
1111
1124
|
className: "w-full",
|
|
1112
1125
|
name: a.name,
|
|
@@ -1114,7 +1127,7 @@ function H({ value: e, options: t, optional: n = !1, emptyLabel: r = "", onChang
|
|
|
1114
1127
|
disabled: a.disabled,
|
|
1115
1128
|
"aria-describedby": o.describedBy,
|
|
1116
1129
|
"aria-invalid": o.invalid || void 0,
|
|
1117
|
-
onChange: (e) => i(
|
|
1130
|
+
onChange: (e) => i(Ht(e.currentTarget.value, t)),
|
|
1118
1131
|
children: [n ? /* @__PURE__ */ b("option", {
|
|
1119
1132
|
value: "",
|
|
1120
1133
|
children: r
|
|
@@ -1126,7 +1139,7 @@ function H({ value: e, options: t, optional: n = !1, emptyLabel: r = "", onChang
|
|
|
1126
1139
|
})
|
|
1127
1140
|
});
|
|
1128
1141
|
}
|
|
1129
|
-
function
|
|
1142
|
+
function Gt({ value: e, fallbackValue: t = "#000000", onChange: n, ...r }) {
|
|
1130
1143
|
let i = W(r);
|
|
1131
1144
|
return /* @__PURE__ */ b(U, {
|
|
1132
1145
|
...r,
|
|
@@ -1139,11 +1152,11 @@ function Ut({ value: e, fallbackValue: t = "#000000", onChange: n, ...r }) {
|
|
|
1139
1152
|
disabled: r.disabled,
|
|
1140
1153
|
"aria-describedby": i.describedBy,
|
|
1141
1154
|
"aria-invalid": i.invalid || void 0,
|
|
1142
|
-
onChange: (e) => n(
|
|
1155
|
+
onChange: (e) => n(Bt(e.currentTarget.value, "undefined"))
|
|
1143
1156
|
})
|
|
1144
1157
|
});
|
|
1145
1158
|
}
|
|
1146
|
-
function
|
|
1159
|
+
function Kt({ value: e, placeholder: t = "auto, 50%, 80mm", emptyValue: n = "undefined", readOnly: r = !1, onChange: i, ...a }) {
|
|
1147
1160
|
let o = W(a);
|
|
1148
1161
|
return /* @__PURE__ */ b(U, {
|
|
1149
1162
|
...a,
|
|
@@ -1160,7 +1173,7 @@ function Wt({ value: e, placeholder: t = "auto, 50%, 80mm", emptyValue: n = "und
|
|
|
1160
1173
|
disabled: a.disabled,
|
|
1161
1174
|
"aria-describedby": o.describedBy,
|
|
1162
1175
|
"aria-invalid": o.invalid || void 0,
|
|
1163
|
-
onChange: r ? void 0 : (e) => i?.(
|
|
1176
|
+
onChange: r ? void 0 : (e) => i?.(Bt(e.currentTarget.value, n))
|
|
1164
1177
|
})
|
|
1165
1178
|
});
|
|
1166
1179
|
}
|
|
@@ -1173,7 +1186,7 @@ function U({ name: e, label: t, help: n, error: r, id: i, className: a, children
|
|
|
1173
1186
|
id: i
|
|
1174
1187
|
}), c = n ? `${s.id}-help` : void 0, l = r ? `${s.id}-error` : void 0;
|
|
1175
1188
|
return /* @__PURE__ */ x("div", {
|
|
1176
|
-
className:
|
|
1189
|
+
className: Jt("grid min-w-0 gap-1", a),
|
|
1177
1190
|
children: [
|
|
1178
1191
|
/* @__PURE__ */ b("label", {
|
|
1179
1192
|
className: "text-2xs font-medium text-fg-muted",
|
|
@@ -1199,17 +1212,17 @@ function U({ name: e, label: t, help: n, error: r, id: i, className: a, children
|
|
|
1199
1212
|
});
|
|
1200
1213
|
}
|
|
1201
1214
|
function W({ name: e, help: t, error: n, id: r }) {
|
|
1202
|
-
let i = r ??
|
|
1215
|
+
let i = r ?? qt(e);
|
|
1203
1216
|
return {
|
|
1204
1217
|
id: i,
|
|
1205
1218
|
describedBy: [t ? `${i}-help` : void 0, n ? `${i}-error` : void 0].filter(Boolean).join(" ") || void 0,
|
|
1206
1219
|
invalid: n != null && n !== ""
|
|
1207
1220
|
};
|
|
1208
1221
|
}
|
|
1209
|
-
function
|
|
1222
|
+
function qt(e) {
|
|
1210
1223
|
return `builder-field-${e.replace(/[^A-Za-z0-9_-]+/g, "-")}`;
|
|
1211
1224
|
}
|
|
1212
|
-
function
|
|
1225
|
+
function Jt(...e) {
|
|
1213
1226
|
return e.filter((e) => !!e).join(" ");
|
|
1214
1227
|
}
|
|
1215
1228
|
//#endregion
|
|
@@ -1222,10 +1235,10 @@ function G({ label: e, children: t }) {
|
|
|
1222
1235
|
}
|
|
1223
1236
|
//#endregion
|
|
1224
1237
|
//#region src/builder/controls/AlignSelect.tsx
|
|
1225
|
-
function
|
|
1238
|
+
function Yt({ name: e, value: t, label: n = "Align", onChange: r }) {
|
|
1226
1239
|
return /* @__PURE__ */ b(G, {
|
|
1227
1240
|
label: n,
|
|
1228
|
-
children: /* @__PURE__ */ x(
|
|
1241
|
+
children: /* @__PURE__ */ x(Rt, {
|
|
1229
1242
|
className: "w-full",
|
|
1230
1243
|
name: e,
|
|
1231
1244
|
value: t,
|
|
@@ -1250,26 +1263,26 @@ function qt({ name: e, value: t, label: n = "Align", onChange: r }) {
|
|
|
1250
1263
|
}
|
|
1251
1264
|
//#endregion
|
|
1252
1265
|
//#region src/builder/primitives/Button.tsx
|
|
1253
|
-
var
|
|
1266
|
+
var Xt = "inline-flex h-8 cursor-pointer items-center rounded-md border border-solid font-medium transition-colors disabled:cursor-not-allowed focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-accent/20", Zt = {
|
|
1254
1267
|
default: "border-border bg-surface text-fg hover:border-border-strong hover:bg-surface-muted focus-visible:border-accent disabled:bg-surface disabled:text-fg-subtle",
|
|
1255
1268
|
primary: "border-primary bg-primary font-semibold text-on-dark hover:border-primary-strong hover:bg-primary-strong disabled:border-border-strong disabled:bg-surface-muted disabled:text-fg-subtle",
|
|
1256
1269
|
danger: "border-danger bg-danger-soft text-danger hover:border-danger hover:bg-danger hover:text-on-dark",
|
|
1257
1270
|
ghost: "border-transparent bg-transparent text-fg hover:border-border hover:bg-surface-muted focus-visible:border-accent"
|
|
1258
1271
|
};
|
|
1259
|
-
function
|
|
1272
|
+
function Qt({ variant: e = "default", icon: t = !1, type: n = "button", className: r, children: i, ...a }) {
|
|
1260
1273
|
return /* @__PURE__ */ b("button", {
|
|
1261
1274
|
type: n,
|
|
1262
1275
|
className: [
|
|
1263
|
-
|
|
1276
|
+
Xt,
|
|
1264
1277
|
t ? "w-8 justify-center p-0" : "gap-2 whitespace-nowrap px-3",
|
|
1265
|
-
|
|
1278
|
+
Zt[e],
|
|
1266
1279
|
r
|
|
1267
1280
|
].filter(Boolean).join(" "),
|
|
1268
1281
|
...a,
|
|
1269
1282
|
children: i
|
|
1270
1283
|
});
|
|
1271
1284
|
}
|
|
1272
|
-
function
|
|
1285
|
+
function $t({ type: e = "button", className: t, children: n, ...r }) {
|
|
1273
1286
|
return /* @__PURE__ */ b("button", {
|
|
1274
1287
|
type: e,
|
|
1275
1288
|
className: ["h-7 w-fit cursor-pointer rounded-md border border-dashed border-border-strong bg-transparent px-3 text-2xs text-fg-muted transition-colors hover:border-accent hover:text-accent disabled:cursor-not-allowed disabled:opacity-50", t].filter(Boolean).join(" "),
|
|
@@ -1279,18 +1292,18 @@ function Zt({ type: e = "button", className: t, children: n, ...r }) {
|
|
|
1279
1292
|
}
|
|
1280
1293
|
//#endregion
|
|
1281
1294
|
//#region src/builder/blocks/BlockPalette.tsx
|
|
1282
|
-
function
|
|
1295
|
+
function en({ blockTypes: e, onAdd: t }) {
|
|
1283
1296
|
return /* @__PURE__ */ b("div", {
|
|
1284
1297
|
className: "flex min-w-0 gap-1 overflow-x-auto [scrollbar-width:thin]",
|
|
1285
1298
|
"aria-label": "Block palette",
|
|
1286
|
-
children: e.map((e) => /* @__PURE__ */ b(
|
|
1299
|
+
children: e.map((e) => /* @__PURE__ */ b(tn, {
|
|
1287
1300
|
type: e,
|
|
1288
1301
|
onAdd: t
|
|
1289
1302
|
}, e))
|
|
1290
1303
|
});
|
|
1291
1304
|
}
|
|
1292
|
-
function
|
|
1293
|
-
let n =
|
|
1305
|
+
function tn({ type: e, onAdd: t }) {
|
|
1306
|
+
let n = fe(e), { attributes: r, listeners: i, setNodeRef: o, transform: s, isDragging: c } = a({
|
|
1294
1307
|
id: `palette:${e}`,
|
|
1295
1308
|
data: {
|
|
1296
1309
|
source: "palette",
|
|
@@ -1309,13 +1322,13 @@ function $t({ type: e, onAdd: t }) {
|
|
|
1309
1322
|
"aria-label": `Add ${n.label}`,
|
|
1310
1323
|
...i,
|
|
1311
1324
|
...r,
|
|
1312
|
-
children: [/* @__PURE__ */ b(
|
|
1325
|
+
children: [/* @__PURE__ */ b(M, { children: n.chip }), /* @__PURE__ */ b("span", { children: n.label })]
|
|
1313
1326
|
});
|
|
1314
1327
|
}
|
|
1315
1328
|
//#endregion
|
|
1316
1329
|
//#region src/builder/blocks/Palette.tsx
|
|
1317
|
-
function
|
|
1318
|
-
let { blockTypes: n, schema: r } =
|
|
1330
|
+
function nn({ className: e, examples: t } = {}) {
|
|
1331
|
+
let { blockTypes: n, schema: r } = At(), { addBlock: i, loadExample: a } = jt(), o = t ? Object.entries(t) : [];
|
|
1319
1332
|
return /* @__PURE__ */ b("aside", {
|
|
1320
1333
|
className: `flex h-[56px] min-w-0 items-center overflow-hidden border-0 border-b border-solid border-border bg-surface px-4${e ? ` ${e}` : ""}`,
|
|
1321
1334
|
"aria-label": "Block palette",
|
|
@@ -1326,13 +1339,13 @@ function en({ className: e, examples: t } = {}) {
|
|
|
1326
1339
|
className: "m-0 flex-none text-2xs font-medium uppercase tracking-[0.06em] text-fg-subtle",
|
|
1327
1340
|
children: "Blocks"
|
|
1328
1341
|
}),
|
|
1329
|
-
/* @__PURE__ */ b(
|
|
1342
|
+
/* @__PURE__ */ b(en, {
|
|
1330
1343
|
blockTypes: n,
|
|
1331
1344
|
onAdd: i
|
|
1332
1345
|
}),
|
|
1333
1346
|
o.length > 0 ? /* @__PURE__ */ b("div", {
|
|
1334
1347
|
className: "ml-auto flex-none",
|
|
1335
|
-
children: /* @__PURE__ */ b(
|
|
1348
|
+
children: /* @__PURE__ */ b(rn, {
|
|
1336
1349
|
entries: o,
|
|
1337
1350
|
disabled: !r,
|
|
1338
1351
|
onLoad: a
|
|
@@ -1342,16 +1355,16 @@ function en({ className: e, examples: t } = {}) {
|
|
|
1342
1355
|
})
|
|
1343
1356
|
});
|
|
1344
1357
|
}
|
|
1345
|
-
function
|
|
1358
|
+
function rn({ entries: e, disabled: t, onLoad: n }) {
|
|
1346
1359
|
if (e.length === 1) {
|
|
1347
1360
|
let [, r] = e[0];
|
|
1348
|
-
return /* @__PURE__ */ b(
|
|
1361
|
+
return /* @__PURE__ */ b(Qt, {
|
|
1349
1362
|
onClick: () => n(r),
|
|
1350
1363
|
disabled: t,
|
|
1351
1364
|
children: "Load example"
|
|
1352
1365
|
});
|
|
1353
1366
|
}
|
|
1354
|
-
return /* @__PURE__ */ x(
|
|
1367
|
+
return /* @__PURE__ */ x(Rt, {
|
|
1355
1368
|
className: "w-auto py-0",
|
|
1356
1369
|
value: "",
|
|
1357
1370
|
disabled: t,
|
|
@@ -1372,13 +1385,13 @@ function tn({ entries: e, disabled: t, onLoad: n }) {
|
|
|
1372
1385
|
}
|
|
1373
1386
|
//#endregion
|
|
1374
1387
|
//#region src/builder/lib/displayScale.ts
|
|
1375
|
-
var
|
|
1376
|
-
function
|
|
1377
|
-
return Math.round(e /
|
|
1388
|
+
var an = 96, on = 25.4;
|
|
1389
|
+
function sn(e) {
|
|
1390
|
+
return Math.round(e / on * an);
|
|
1378
1391
|
}
|
|
1379
1392
|
//#endregion
|
|
1380
1393
|
//#region src/builder/lib/pageSizes.ts
|
|
1381
|
-
var
|
|
1394
|
+
var cn = {
|
|
1382
1395
|
A3: [297, 420],
|
|
1383
1396
|
A4: [210, 297],
|
|
1384
1397
|
A5: [148, 210],
|
|
@@ -1387,74 +1400,74 @@ var on = {
|
|
|
1387
1400
|
Legal: [215.9, 355.6],
|
|
1388
1401
|
Tabloid: [279.4, 431.8]
|
|
1389
1402
|
};
|
|
1390
|
-
function
|
|
1391
|
-
let n =
|
|
1403
|
+
function ln(e, t = "portrait") {
|
|
1404
|
+
let n = cn[e ?? "A4"] ?? cn.A4;
|
|
1392
1405
|
return t === "landscape" ? [n[1], n[0]] : n;
|
|
1393
1406
|
}
|
|
1394
1407
|
//#endregion
|
|
1395
1408
|
//#region src/builder/canvas/columns.ts
|
|
1396
|
-
var
|
|
1397
|
-
function
|
|
1409
|
+
var un = "0.375rem", dn = 5, fn = 100;
|
|
1410
|
+
function pn(e, t) {
|
|
1398
1411
|
if (t <= 0) return [];
|
|
1399
|
-
if (!e || e.length !== t) return
|
|
1400
|
-
let n = e.map(
|
|
1401
|
-
return n.every((e) => Number.isFinite(e)) ? n :
|
|
1412
|
+
if (!e || e.length !== t) return xn(t);
|
|
1413
|
+
let n = e.map(Sn);
|
|
1414
|
+
return n.every((e) => Number.isFinite(e)) ? n : xn(t);
|
|
1402
1415
|
}
|
|
1403
|
-
function
|
|
1416
|
+
function mn(e) {
|
|
1404
1417
|
return e.map((e) => `${e}%`);
|
|
1405
1418
|
}
|
|
1406
|
-
function
|
|
1407
|
-
return e ?
|
|
1419
|
+
function hn(e, t) {
|
|
1420
|
+
return e ? pn(e, t).map((e) => `minmax(0, ${e}fr)`).join(` ${un} `) : null;
|
|
1408
1421
|
}
|
|
1409
|
-
function
|
|
1422
|
+
function gn(e, t, n) {
|
|
1410
1423
|
let r = t + 1;
|
|
1411
1424
|
if (t < 0 || r >= e.length) return [...e];
|
|
1412
|
-
let i = e[t] + e[r], a = Math.min(
|
|
1425
|
+
let i = e[t] + e[r], a = Math.min(dn, i), o = Math.max(a, i - dn), s = Math.round(Cn(n, a, o)), c = [...e];
|
|
1413
1426
|
return c[t] = s, c[r] = i - s, c;
|
|
1414
1427
|
}
|
|
1415
|
-
function
|
|
1416
|
-
let n = e == null ? NaN :
|
|
1417
|
-
return Math.round(
|
|
1428
|
+
function _n(e, t = 30) {
|
|
1429
|
+
let n = e == null ? NaN : Sn(e);
|
|
1430
|
+
return Math.round(Cn(Number.isFinite(n) ? n : t, dn, fn - dn));
|
|
1418
1431
|
}
|
|
1419
|
-
function
|
|
1432
|
+
function vn(e) {
|
|
1420
1433
|
if (e == null) return null;
|
|
1421
|
-
let t =
|
|
1434
|
+
let t = Sn(e);
|
|
1422
1435
|
return Number.isFinite(t) ? t : null;
|
|
1423
1436
|
}
|
|
1424
|
-
function
|
|
1437
|
+
function yn(e, t) {
|
|
1425
1438
|
if (e <= 0) return [];
|
|
1426
1439
|
let n = Math.floor(t / e), r = Array.from({ length: e }, () => n);
|
|
1427
1440
|
return r[e - 1] += t - n * e, r;
|
|
1428
1441
|
}
|
|
1429
|
-
function
|
|
1430
|
-
let n = t ?
|
|
1442
|
+
function bn(e, t) {
|
|
1443
|
+
let n = t ? fn - 5 : fn, r = e.map((e) => vn(e)), i = e.length > 0 && r.every((e) => e !== null) ? r : yn(e.length, n);
|
|
1431
1444
|
return {
|
|
1432
1445
|
tracks: t ? [5, ...i] : [...i],
|
|
1433
1446
|
data: i
|
|
1434
1447
|
};
|
|
1435
1448
|
}
|
|
1436
|
-
function
|
|
1437
|
-
return
|
|
1449
|
+
function xn(e) {
|
|
1450
|
+
return yn(e, fn);
|
|
1438
1451
|
}
|
|
1439
|
-
function
|
|
1452
|
+
function Sn(e) {
|
|
1440
1453
|
if (typeof e == "number") return e;
|
|
1441
1454
|
let t = e.trim().match(/^([+-]?\d+(?:\.\d+)?)%$/);
|
|
1442
1455
|
return t ? Number.parseFloat(t[1] ?? "") : NaN;
|
|
1443
1456
|
}
|
|
1444
|
-
function
|
|
1457
|
+
function Cn(e, t, n) {
|
|
1445
1458
|
return Math.min(Math.max(e, t), n);
|
|
1446
1459
|
}
|
|
1447
1460
|
//#endregion
|
|
1448
1461
|
//#region src/builder/canvas/ColumnResizer.tsx
|
|
1449
|
-
function
|
|
1462
|
+
function wn({ widths: e, count: t, leftIndex: n, containerRef: r, onResize: i, label: a }) {
|
|
1450
1463
|
function o(a) {
|
|
1451
1464
|
let o = r.current?.getBoundingClientRect();
|
|
1452
1465
|
if (!o || o.width <= 0) return;
|
|
1453
1466
|
let s = o;
|
|
1454
1467
|
a.preventDefault(), a.currentTarget.setPointerCapture(a.pointerId);
|
|
1455
|
-
let c =
|
|
1468
|
+
let c = pn(e, t), l = c.slice(0, n).reduce((e, t) => e + t, 0);
|
|
1456
1469
|
function u(e) {
|
|
1457
|
-
i(
|
|
1470
|
+
i(mn(gn(c, n, (e.clientX - s.left) / s.width * 100 - l)));
|
|
1458
1471
|
}
|
|
1459
1472
|
function d() {
|
|
1460
1473
|
window.removeEventListener("pointermove", u), window.removeEventListener("pointerup", d);
|
|
@@ -1471,12 +1484,12 @@ function Sn({ widths: e, count: t, leftIndex: n, containerRef: r, onResize: i, l
|
|
|
1471
1484
|
}
|
|
1472
1485
|
//#endregion
|
|
1473
1486
|
//#region src/builder/canvas/PageSheet.tsx
|
|
1474
|
-
function
|
|
1475
|
-
let [i] =
|
|
1487
|
+
function Tn({ format: e, orientation: t, children: n, showMeta: r = !0 }) {
|
|
1488
|
+
let [i] = ln(e, t);
|
|
1476
1489
|
return /* @__PURE__ */ x("div", {
|
|
1477
1490
|
"data-theme": "light",
|
|
1478
1491
|
className: "mx-auto grid w-full gap-3 rounded-xl border border-solid border-border bg-page p-6 shadow-page transition-[max-width] duration-200",
|
|
1479
|
-
style: { maxWidth: `${
|
|
1492
|
+
style: { maxWidth: `${sn(i)}px` },
|
|
1480
1493
|
children: [r ? /* @__PURE__ */ x("div", {
|
|
1481
1494
|
className: "mb-2 flex items-center justify-between text-2xs uppercase tracking-[0.06em] text-fg-subtle",
|
|
1482
1495
|
children: [/* @__PURE__ */ x("span", { children: [
|
|
@@ -1490,27 +1503,27 @@ function Cn({ format: e, orientation: t, children: n, showMeta: r = !0 }) {
|
|
|
1490
1503
|
//#endregion
|
|
1491
1504
|
//#region src/builder/state/configUpdates.ts
|
|
1492
1505
|
function K(e, t, n) {
|
|
1493
|
-
return
|
|
1506
|
+
return An(e, q(e.config, t, n));
|
|
1494
1507
|
}
|
|
1495
|
-
function
|
|
1496
|
-
return
|
|
1508
|
+
function En(e, t, n) {
|
|
1509
|
+
return jn(e, "typography", q(e.config?.typography, t, n));
|
|
1497
1510
|
}
|
|
1498
|
-
function
|
|
1499
|
-
return
|
|
1511
|
+
function Dn(e, t, n) {
|
|
1512
|
+
return jn(e, "spacing", q(e.config?.spacing, t, n));
|
|
1500
1513
|
}
|
|
1501
|
-
function
|
|
1514
|
+
function On(e, t, n) {
|
|
1502
1515
|
let r = q(e.config?.typography, t, n);
|
|
1503
|
-
return
|
|
1516
|
+
return Mn(e, q(e.config, "typography", r));
|
|
1504
1517
|
}
|
|
1505
|
-
function
|
|
1518
|
+
function kn(e, t, n) {
|
|
1506
1519
|
let r = q(e.config?.page?.margins, t, n), i = q(e.config?.page, "margins", r);
|
|
1507
|
-
return
|
|
1520
|
+
return Mn(e, q(e.config, "page", i));
|
|
1508
1521
|
}
|
|
1509
1522
|
function q(e, t, n) {
|
|
1510
1523
|
let r = { ...e };
|
|
1511
|
-
return
|
|
1524
|
+
return Pn(n) ? delete r[t] : r[t] = n, Nn(r);
|
|
1512
1525
|
}
|
|
1513
|
-
function
|
|
1526
|
+
function An(e, t) {
|
|
1514
1527
|
if (t === void 0) {
|
|
1515
1528
|
let { config: t, ...n } = e;
|
|
1516
1529
|
return n;
|
|
@@ -1520,10 +1533,10 @@ function On(e, t) {
|
|
|
1520
1533
|
config: t
|
|
1521
1534
|
};
|
|
1522
1535
|
}
|
|
1523
|
-
function
|
|
1524
|
-
return
|
|
1536
|
+
function jn(e, t, n) {
|
|
1537
|
+
return An(e, q(e.config, t, n));
|
|
1525
1538
|
}
|
|
1526
|
-
function
|
|
1539
|
+
function Mn(e, t) {
|
|
1527
1540
|
if (t === void 0) {
|
|
1528
1541
|
let { config: t, ...n } = e;
|
|
1529
1542
|
return n;
|
|
@@ -1533,65 +1546,65 @@ function An(e, t) {
|
|
|
1533
1546
|
config: t
|
|
1534
1547
|
};
|
|
1535
1548
|
}
|
|
1536
|
-
function
|
|
1549
|
+
function Nn(e) {
|
|
1537
1550
|
return Object.keys(e).length === 0 ? void 0 : e;
|
|
1538
1551
|
}
|
|
1539
|
-
function
|
|
1552
|
+
function Pn(e) {
|
|
1540
1553
|
return e === "" || e == null;
|
|
1541
1554
|
}
|
|
1542
1555
|
//#endregion
|
|
1543
1556
|
//#region src/builder/canvas/BlockDataPreview.tsx
|
|
1544
|
-
var
|
|
1545
|
-
function
|
|
1557
|
+
var Fn = "m-0 line-clamp-3 overflow-hidden text-sm leading-[1.45] text-fg-muted [display:-webkit-box] [-webkit-box-orient:vertical]", In = "m-0 line-clamp-2 overflow-hidden text-[17px] font-semibold leading-[1.25] text-fg [display:-webkit-box] [-webkit-box-orient:vertical]";
|
|
1558
|
+
function Ln({ children: e }) {
|
|
1546
1559
|
return /* @__PURE__ */ b("p", {
|
|
1547
1560
|
className: "m-0 text-sm text-fg-subtle",
|
|
1548
1561
|
children: e
|
|
1549
1562
|
});
|
|
1550
1563
|
}
|
|
1551
|
-
function
|
|
1564
|
+
function Rn({ block: e, rowData: t, onChange: n }) {
|
|
1552
1565
|
switch (e.type) {
|
|
1553
|
-
case "heading": return /* @__PURE__ */ b(
|
|
1566
|
+
case "heading": return /* @__PURE__ */ b(zn, {
|
|
1554
1567
|
block: e,
|
|
1555
1568
|
variant: "heading"
|
|
1556
1569
|
});
|
|
1557
|
-
case "text": return /* @__PURE__ */ b(
|
|
1570
|
+
case "text": return /* @__PURE__ */ b(zn, {
|
|
1558
1571
|
block: e,
|
|
1559
1572
|
variant: "text"
|
|
1560
1573
|
});
|
|
1561
|
-
case "html": return /* @__PURE__ */ b(
|
|
1562
|
-
case "image": return /* @__PURE__ */ b(
|
|
1563
|
-
case "key-value": return /* @__PURE__ */ b(
|
|
1574
|
+
case "html": return /* @__PURE__ */ b(Bn, { block: e });
|
|
1575
|
+
case "image": return /* @__PURE__ */ b(Vn, { block: e });
|
|
1576
|
+
case "key-value": return /* @__PURE__ */ b(Hn, {
|
|
1564
1577
|
block: e,
|
|
1565
1578
|
rowData: t,
|
|
1566
1579
|
onChange: n
|
|
1567
1580
|
});
|
|
1568
|
-
case "table": return /* @__PURE__ */ b(
|
|
1581
|
+
case "table": return /* @__PURE__ */ b(Un, {
|
|
1569
1582
|
block: e,
|
|
1570
1583
|
rowData: t,
|
|
1571
1584
|
onChange: n
|
|
1572
1585
|
});
|
|
1573
|
-
case "spacer": return /* @__PURE__ */ b(
|
|
1574
|
-
case "divider": return /* @__PURE__ */ b(
|
|
1586
|
+
case "spacer": return /* @__PURE__ */ b(Wn, { block: e });
|
|
1587
|
+
case "divider": return /* @__PURE__ */ b(Gn, { block: e });
|
|
1575
1588
|
default: return null;
|
|
1576
1589
|
}
|
|
1577
1590
|
}
|
|
1578
|
-
function
|
|
1591
|
+
function zn({ block: e, variant: t }) {
|
|
1579
1592
|
let n = e.text.trim();
|
|
1580
|
-
return n.length === 0 ? /* @__PURE__ */ b(
|
|
1581
|
-
className: t === "heading" ?
|
|
1593
|
+
return n.length === 0 ? /* @__PURE__ */ b(Ln, { children: "No text yet" }) : /* @__PURE__ */ b("p", {
|
|
1594
|
+
className: t === "heading" ? In : Fn,
|
|
1582
1595
|
children: n
|
|
1583
1596
|
});
|
|
1584
1597
|
}
|
|
1585
|
-
function
|
|
1586
|
-
let t =
|
|
1587
|
-
return t.length === 0 ? /* @__PURE__ */ b(
|
|
1588
|
-
className:
|
|
1598
|
+
function Bn({ block: e }) {
|
|
1599
|
+
let t = Yn(e.html).trim();
|
|
1600
|
+
return t.length === 0 ? /* @__PURE__ */ b(Ln, { children: "No HTML content yet" }) : /* @__PURE__ */ b("p", {
|
|
1601
|
+
className: Fn,
|
|
1589
1602
|
children: t
|
|
1590
1603
|
});
|
|
1591
1604
|
}
|
|
1592
|
-
function
|
|
1605
|
+
function Vn({ block: e }) {
|
|
1593
1606
|
let t = e.src.trim();
|
|
1594
|
-
return t.length === 0 ? /* @__PURE__ */ b(
|
|
1607
|
+
return t.length === 0 ? /* @__PURE__ */ b(Ln, { children: "No image selected" }) : /* @__PURE__ */ b("div", {
|
|
1595
1608
|
className: "grid min-h-[72px] place-items-center overflow-hidden rounded-md border border-solid border-border bg-surface-muted",
|
|
1596
1609
|
children: /* @__PURE__ */ b("img", {
|
|
1597
1610
|
className: "block max-h-[120px] max-w-full object-contain",
|
|
@@ -1600,18 +1613,18 @@ function zn({ block: e }) {
|
|
|
1600
1613
|
})
|
|
1601
1614
|
});
|
|
1602
1615
|
}
|
|
1603
|
-
function
|
|
1604
|
-
let r = _(null), i = e.config?.fields ?? [], a =
|
|
1616
|
+
function Hn({ block: e, rowData: t, onChange: n }) {
|
|
1617
|
+
let r = _(null), i = e.config?.fields ?? [], a = Kn(e.values, t), o = i.length > 0 ? i.map((e) => ({
|
|
1605
1618
|
key: e.key,
|
|
1606
1619
|
label: e.label || e.key,
|
|
1607
|
-
value:
|
|
1620
|
+
value: Jn(a[e.key])
|
|
1608
1621
|
})) : Object.entries(a).map(([e, t]) => ({
|
|
1609
1622
|
key: e,
|
|
1610
1623
|
label: e,
|
|
1611
|
-
value:
|
|
1624
|
+
value: Jn(t)
|
|
1612
1625
|
}));
|
|
1613
|
-
if (o.length === 0) return /* @__PURE__ */ b(
|
|
1614
|
-
let s =
|
|
1626
|
+
if (o.length === 0) return /* @__PURE__ */ b(Ln, { children: "No fields yet" });
|
|
1627
|
+
let s = _n(e.config?.labelWidth), c = { gridTemplateColumns: `${s}% minmax(0, 1fr)` };
|
|
1615
1628
|
return /* @__PURE__ */ x("dl", {
|
|
1616
1629
|
ref: r,
|
|
1617
1630
|
className: "relative m-0 grid gap-0.5",
|
|
@@ -1628,8 +1641,8 @@ function Bn({ block: e, rowData: t, onChange: n }) {
|
|
|
1628
1641
|
}, e.key)), n ? /* @__PURE__ */ b("div", {
|
|
1629
1642
|
className: "absolute inset-y-0 flex -translate-x-1/2",
|
|
1630
1643
|
style: { left: `${s}%` },
|
|
1631
|
-
children: /* @__PURE__ */ b(
|
|
1632
|
-
widths:
|
|
1644
|
+
children: /* @__PURE__ */ b(wn, {
|
|
1645
|
+
widths: mn([s, 100 - s]),
|
|
1633
1646
|
count: 2,
|
|
1634
1647
|
leftIndex: 0,
|
|
1635
1648
|
containerRef: r,
|
|
@@ -1639,10 +1652,10 @@ function Bn({ block: e, rowData: t, onChange: n }) {
|
|
|
1639
1652
|
}) : null]
|
|
1640
1653
|
});
|
|
1641
1654
|
}
|
|
1642
|
-
function
|
|
1643
|
-
let r = _(null), i = e.config?.columns ?? [], a = e.config?.numberRows === !0, o = Array.isArray(t) ? t.filter(
|
|
1644
|
-
if (i.length === 0) return /* @__PURE__ */ b(
|
|
1645
|
-
let { tracks: s, data: c } =
|
|
1655
|
+
function Un({ block: e, rowData: t, onChange: n }) {
|
|
1656
|
+
let r = _(null), i = e.config?.columns ?? [], a = e.config?.numberRows === !0, o = Array.isArray(t) ? t.filter(N) : [];
|
|
1657
|
+
if (i.length === 0) return /* @__PURE__ */ b(Ln, { children: "No columns yet" });
|
|
1658
|
+
let { tracks: s, data: c } = bn(i.map((e) => e.width), a), l = mn(s), u = +!!a;
|
|
1646
1659
|
return /* @__PURE__ */ x("div", {
|
|
1647
1660
|
ref: r,
|
|
1648
1661
|
className: "relative min-w-0 overflow-hidden rounded-md border border-solid border-border",
|
|
@@ -1664,9 +1677,9 @@ function Vn({ block: e, rowData: t, onChange: n }) {
|
|
|
1664
1677
|
children: t + 1
|
|
1665
1678
|
}) : null, i.map((t) => /* @__PURE__ */ b("td", {
|
|
1666
1679
|
className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap border-0 border-b border-solid border-border px-2 py-[5px] text-left text-fg-muted",
|
|
1667
|
-
children:
|
|
1680
|
+
children: Jn(e[t.key]) || "—"
|
|
1668
1681
|
}, t.key))]
|
|
1669
|
-
},
|
|
1682
|
+
}, qn(e, i))) : /* @__PURE__ */ b("tr", { children: /* @__PURE__ */ b("td", {
|
|
1670
1683
|
colSpan: i.length + u,
|
|
1671
1684
|
className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap border-0 px-2 py-[5px] text-left text-fg-muted",
|
|
1672
1685
|
children: "No runtime rows yet"
|
|
@@ -1677,7 +1690,7 @@ function Vn({ block: e, rowData: t, onChange: n }) {
|
|
|
1677
1690
|
return /* @__PURE__ */ b("div", {
|
|
1678
1691
|
className: "absolute inset-y-0 flex -translate-x-1/2",
|
|
1679
1692
|
style: { left: `${s.slice(0, c + 1).reduce((e, t) => e + t, 0)}%` },
|
|
1680
|
-
children: /* @__PURE__ */ b(
|
|
1693
|
+
children: /* @__PURE__ */ b(wn, {
|
|
1681
1694
|
widths: l,
|
|
1682
1695
|
count: s.length,
|
|
1683
1696
|
leftIndex: c,
|
|
@@ -1692,32 +1705,32 @@ function Vn({ block: e, rowData: t, onChange: n }) {
|
|
|
1692
1705
|
}) : null]
|
|
1693
1706
|
});
|
|
1694
1707
|
}
|
|
1695
|
-
function
|
|
1708
|
+
function Wn({ block: e }) {
|
|
1696
1709
|
let t = e.config?.height;
|
|
1697
1710
|
return /* @__PURE__ */ b("div", {
|
|
1698
1711
|
className: "grid h-9 place-items-center rounded-md border border-dashed border-border-strong text-2xs text-fg-subtle",
|
|
1699
1712
|
children: typeof t == "number" ? `${t}mm spacer` : "Spacer"
|
|
1700
1713
|
});
|
|
1701
1714
|
}
|
|
1702
|
-
function
|
|
1715
|
+
function Gn({ block: e }) {
|
|
1703
1716
|
let t = e.config?.style ?? "solid";
|
|
1704
1717
|
return /* @__PURE__ */ b("div", { className: `my-2 border-0 border-t border-border-strong ${t === "dashed" ? "border-dashed" : t === "dotted" ? "border-dotted" : t === "double" ? "border-double border-t-[3px]" : t === "none" ? "border-t-transparent" : "border-solid"}` });
|
|
1705
1718
|
}
|
|
1706
|
-
function
|
|
1707
|
-
return Object.assign({}, e,
|
|
1719
|
+
function Kn(e, t) {
|
|
1720
|
+
return Object.assign({}, e, N(t) ? t : void 0);
|
|
1708
1721
|
}
|
|
1709
|
-
function
|
|
1710
|
-
return t?.map((t) =>
|
|
1722
|
+
function qn(e, t) {
|
|
1723
|
+
return t?.map((t) => Jn(e[t.key])).join("|") ?? "";
|
|
1711
1724
|
}
|
|
1712
|
-
function
|
|
1725
|
+
function Jn(e) {
|
|
1713
1726
|
return e == null ? "" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : "";
|
|
1714
1727
|
}
|
|
1715
|
-
function
|
|
1728
|
+
function Yn(e) {
|
|
1716
1729
|
return e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ");
|
|
1717
1730
|
}
|
|
1718
1731
|
//#endregion
|
|
1719
1732
|
//#region src/builder/canvas/SortableBlock.tsx
|
|
1720
|
-
function
|
|
1733
|
+
function Xn({ rowUid: e, area: t, editorBlock: n, data: r, selected: i, onRemoveBlock: a, onSelect: o, onChangeBlock: s, style: c }) {
|
|
1721
1734
|
let { attributes: l, listeners: u, setActivatorNodeRef: d, setNodeRef: f, transform: p, transition: m, isDragging: h } = T({
|
|
1722
1735
|
id: n.uid,
|
|
1723
1736
|
data: {
|
|
@@ -1775,7 +1788,7 @@ function Jn({ rowUid: e, area: t, editorBlock: n, data: r, selected: i, onRemove
|
|
|
1775
1788
|
})]
|
|
1776
1789
|
}), /* @__PURE__ */ b("div", {
|
|
1777
1790
|
className: "grid min-w-0 bg-surface p-3",
|
|
1778
|
-
children: /* @__PURE__ */ b(
|
|
1791
|
+
children: /* @__PURE__ */ b(Rn, {
|
|
1779
1792
|
block: n.block,
|
|
1780
1793
|
rowData: _,
|
|
1781
1794
|
onChange: (e) => s(n.uid, e)
|
|
@@ -1785,18 +1798,18 @@ function Jn({ rowUid: e, area: t, editorBlock: n, data: r, selected: i, onRemove
|
|
|
1785
1798
|
}
|
|
1786
1799
|
//#endregion
|
|
1787
1800
|
//#region src/builder/canvas/BuilderCanvas.tsx
|
|
1788
|
-
function
|
|
1789
|
-
let [h] =
|
|
1801
|
+
function Zn({ model: e, data: t, format: n, orientation: r, footerRepeat: i, pageNumbers: a, selectedBlockUid: o, onRemoveBlock: s, onSelectBlock: c, onChangeBlock: l, onDeselect: u, onSetRowWidths: d, onToggleFooterRepeat: f, onChangePageNumbers: p, className: m }) {
|
|
1802
|
+
let [h] = ln(n, r), g = { maxWidth: `${sn(h)}px` };
|
|
1790
1803
|
return /* @__PURE__ */ x("div", {
|
|
1791
1804
|
className: `grid content-start gap-4 min-w-0 min-h-0 overflow-auto bg-canvas px-4 pb-8 pt-6${m ? ` ${m}` : ""}`,
|
|
1792
1805
|
onPointerDown: (e) => {
|
|
1793
1806
|
e.target === e.currentTarget && u();
|
|
1794
1807
|
},
|
|
1795
1808
|
children: [
|
|
1796
|
-
/* @__PURE__ */ b(
|
|
1809
|
+
/* @__PURE__ */ b(Tn, {
|
|
1797
1810
|
format: n,
|
|
1798
1811
|
orientation: r,
|
|
1799
|
-
children: /* @__PURE__ */ b(
|
|
1812
|
+
children: /* @__PURE__ */ b(Qn, {
|
|
1800
1813
|
area: "body",
|
|
1801
1814
|
rows: e.rows,
|
|
1802
1815
|
data: t,
|
|
@@ -1810,7 +1823,7 @@ function Yn({ model: e, data: t, format: n, orientation: r, footerRepeat: i, pag
|
|
|
1810
1823
|
onSetRowWidths: d
|
|
1811
1824
|
})
|
|
1812
1825
|
}),
|
|
1813
|
-
/* @__PURE__ */ x(
|
|
1826
|
+
/* @__PURE__ */ x(Tn, {
|
|
1814
1827
|
format: n,
|
|
1815
1828
|
orientation: r,
|
|
1816
1829
|
showMeta: !1,
|
|
@@ -1822,12 +1835,12 @@ function Yn({ model: e, data: t, format: n, orientation: r, footerRepeat: i, pag
|
|
|
1822
1835
|
children: "Footer"
|
|
1823
1836
|
}), /* @__PURE__ */ x("label", {
|
|
1824
1837
|
className: "inline-flex items-center gap-2 text-xs font-medium text-fg-muted",
|
|
1825
|
-
children: [/* @__PURE__ */ b(
|
|
1838
|
+
children: [/* @__PURE__ */ b(zt, {
|
|
1826
1839
|
checked: i,
|
|
1827
1840
|
onChange: (e) => f(e.currentTarget.checked)
|
|
1828
1841
|
}), "Repeat on every page"]
|
|
1829
1842
|
})]
|
|
1830
|
-
}), /* @__PURE__ */ b(
|
|
1843
|
+
}), /* @__PURE__ */ b(Qn, {
|
|
1831
1844
|
area: "footer",
|
|
1832
1845
|
rows: e.footerRows,
|
|
1833
1846
|
data: t,
|
|
@@ -1846,7 +1859,7 @@ function Yn({ model: e, data: t, format: n, orientation: r, footerRepeat: i, pag
|
|
|
1846
1859
|
style: g,
|
|
1847
1860
|
children: /* @__PURE__ */ x("label", {
|
|
1848
1861
|
className: "inline-flex items-center gap-3 text-2xs font-medium uppercase tracking-[0.06em] text-fg-muted",
|
|
1849
|
-
children: ["Page numbers", /* @__PURE__ */ x(
|
|
1862
|
+
children: ["Page numbers", /* @__PURE__ */ x(Rt, {
|
|
1850
1863
|
className: "w-auto py-0 text-sm font-normal normal-case tracking-normal",
|
|
1851
1864
|
value: a,
|
|
1852
1865
|
onChange: (e) => p(e.currentTarget.value),
|
|
@@ -1874,7 +1887,7 @@ function Yn({ model: e, data: t, format: n, orientation: r, footerRepeat: i, pag
|
|
|
1874
1887
|
]
|
|
1875
1888
|
});
|
|
1876
1889
|
}
|
|
1877
|
-
function
|
|
1890
|
+
function Qn({ area: e, rows: t, data: n, selectedBlockUid: r, newRowId: i, emptyLabel: a, fillLabel: s, onRemoveBlock: c, onSelectBlock: l, onChangeBlock: u, onSetRowWidths: d }) {
|
|
1878
1891
|
let { setNodeRef: f, isOver: p } = o({
|
|
1879
1892
|
id: i,
|
|
1880
1893
|
data: {
|
|
@@ -1887,7 +1900,7 @@ function Xn({ area: e, rows: t, data: n, selectedBlockUid: r, newRowId: i, empty
|
|
|
1887
1900
|
children: [/* @__PURE__ */ b(S, {
|
|
1888
1901
|
items: t.map((e) => e.uid),
|
|
1889
1902
|
strategy: E,
|
|
1890
|
-
children: t.map((t) => /* @__PURE__ */ b(
|
|
1903
|
+
children: t.map((t) => /* @__PURE__ */ b($n, {
|
|
1891
1904
|
row: t,
|
|
1892
1905
|
area: e,
|
|
1893
1906
|
data: n,
|
|
@@ -1904,7 +1917,7 @@ function Xn({ area: e, rows: t, data: n, selectedBlockUid: r, newRowId: i, empty
|
|
|
1904
1917
|
})]
|
|
1905
1918
|
});
|
|
1906
1919
|
}
|
|
1907
|
-
function
|
|
1920
|
+
function $n({ row: e, area: t, data: n, selectedBlockUid: r, onRemoveBlock: i, onSelectBlock: a, onChangeBlock: o, onSetRowWidths: s }) {
|
|
1908
1921
|
let c = _(null), { attributes: u, listeners: d, setActivatorNodeRef: f, setNodeRef: p, transform: m, transition: h, isDragging: g } = T({
|
|
1909
1922
|
id: e.uid,
|
|
1910
1923
|
data: {
|
|
@@ -1912,7 +1925,7 @@ function Zn({ row: e, area: t, data: n, selectedBlockUid: r, onRemoveBlock: i, o
|
|
|
1912
1925
|
rowUid: e.uid,
|
|
1913
1926
|
area: t
|
|
1914
1927
|
}
|
|
1915
|
-
}), v =
|
|
1928
|
+
}), v = er(e), y = e.blocks.length > 1, C = hn(y ? v ?? [] : v, e.blocks.length), w = {
|
|
1916
1929
|
transform: D.Transform.toString(m),
|
|
1917
1930
|
transition: h
|
|
1918
1931
|
};
|
|
@@ -1937,7 +1950,7 @@ function Zn({ row: e, area: t, data: n, selectedBlockUid: r, onRemoveBlock: i, o
|
|
|
1937
1950
|
style: C ? { gridTemplateColumns: C } : void 0,
|
|
1938
1951
|
children: /* @__PURE__ */ b(S, {
|
|
1939
1952
|
items: e.blocks.map((e) => e.uid),
|
|
1940
|
-
children: e.blocks.map((u, d) => /* @__PURE__ */ x(l, { children: [/* @__PURE__ */ b(
|
|
1953
|
+
children: e.blocks.map((u, d) => /* @__PURE__ */ x(l, { children: [/* @__PURE__ */ b(Xn, {
|
|
1941
1954
|
rowUid: e.uid,
|
|
1942
1955
|
area: t,
|
|
1943
1956
|
editorBlock: u,
|
|
@@ -1946,7 +1959,7 @@ function Zn({ row: e, area: t, data: n, selectedBlockUid: r, onRemoveBlock: i, o
|
|
|
1946
1959
|
onRemoveBlock: i,
|
|
1947
1960
|
onSelect: a,
|
|
1948
1961
|
onChangeBlock: o
|
|
1949
|
-
}), y && d < e.blocks.length - 1 ? /* @__PURE__ */ b(
|
|
1962
|
+
}), y && d < e.blocks.length - 1 ? /* @__PURE__ */ b(wn, {
|
|
1950
1963
|
widths: v,
|
|
1951
1964
|
count: e.blocks.length,
|
|
1952
1965
|
leftIndex: d,
|
|
@@ -1957,15 +1970,15 @@ function Zn({ row: e, area: t, data: n, selectedBlockUid: r, onRemoveBlock: i, o
|
|
|
1957
1970
|
})]
|
|
1958
1971
|
});
|
|
1959
1972
|
}
|
|
1960
|
-
function
|
|
1973
|
+
function er(e) {
|
|
1961
1974
|
let t = e.blocks.map((e) => e.block.config?.width);
|
|
1962
1975
|
return t.every((e) => typeof e == "string") ? t : null;
|
|
1963
1976
|
}
|
|
1964
1977
|
//#endregion
|
|
1965
1978
|
//#region src/builder/canvas/Canvas.tsx
|
|
1966
|
-
function
|
|
1967
|
-
let { schema: t, schemaLoading: n, model: r, data: i, pageSize: a, footerRepeat: o, pageNumbers: s, selectedBlockUid: c } =
|
|
1968
|
-
return t ? /* @__PURE__ */ b(
|
|
1979
|
+
function tr({ className: e } = {}) {
|
|
1980
|
+
let { schema: t, schemaLoading: n, model: r, data: i, pageSize: a, footerRepeat: o, pageNumbers: s, selectedBlockUid: c } = At(), { removeBlock: l, selectBlock: u, changeBlock: d, deselect: f, setRowWidths: p, toggleFooterRepeat: m, changePageNumbers: h } = jt();
|
|
1981
|
+
return t ? /* @__PURE__ */ b(Zn, {
|
|
1969
1982
|
className: e,
|
|
1970
1983
|
model: r,
|
|
1971
1984
|
data: i,
|
|
@@ -1991,7 +2004,7 @@ function $n({ className: e } = {}) {
|
|
|
1991
2004
|
}
|
|
1992
2005
|
//#endregion
|
|
1993
2006
|
//#region src/builder/inspector/editors/ImageBlockEditor.tsx
|
|
1994
|
-
function
|
|
2007
|
+
function nr({ block: e, onChangeBlock: t }) {
|
|
1995
2008
|
let n = e, r = n.src ?? "", i = n.alt ?? "";
|
|
1996
2009
|
function a(e) {
|
|
1997
2010
|
let r = e.currentTarget.files?.[0];
|
|
@@ -2061,7 +2074,7 @@ function er({ block: e, onChangeBlock: t }) {
|
|
|
2061
2074
|
}
|
|
2062
2075
|
//#endregion
|
|
2063
2076
|
//#region src/builder/inspector/InspectorShell.tsx
|
|
2064
|
-
var
|
|
2077
|
+
var rr = d(function({ ariaLabel: e, className: t, onKeyDown: n, children: r }, i) {
|
|
2065
2078
|
return /* @__PURE__ */ b("aside", {
|
|
2066
2079
|
ref: i,
|
|
2067
2080
|
tabIndex: -1,
|
|
@@ -2071,7 +2084,7 @@ var tr = d(function({ ariaLabel: e, className: t, onKeyDown: n, children: r }, i
|
|
|
2071
2084
|
children: r
|
|
2072
2085
|
});
|
|
2073
2086
|
});
|
|
2074
|
-
function
|
|
2087
|
+
function ir({ title: e, chip: t, subtitle: n, action: r }) {
|
|
2075
2088
|
return /* @__PURE__ */ x("header", {
|
|
2076
2089
|
className: "flex min-w-0 items-start justify-between gap-2",
|
|
2077
2090
|
children: [/* @__PURE__ */ x("div", {
|
|
@@ -2097,8 +2110,8 @@ function J({ title: e, children: t }) {
|
|
|
2097
2110
|
}
|
|
2098
2111
|
//#endregion
|
|
2099
2112
|
//#region src/builder/inspector/editors/SortableList.tsx
|
|
2100
|
-
function
|
|
2101
|
-
let a =
|
|
2113
|
+
function ar({ count: t, onReorder: n, children: r }) {
|
|
2114
|
+
let a = ge();
|
|
2102
2115
|
function o(e) {
|
|
2103
2116
|
let { active: t, over: r } = e;
|
|
2104
2117
|
if (!r || t.id === r.id) return;
|
|
@@ -2118,7 +2131,7 @@ function rr({ count: t, onReorder: n, children: r }) {
|
|
|
2118
2131
|
}
|
|
2119
2132
|
//#endregion
|
|
2120
2133
|
//#region src/builder/inspector/editors/SortableRow.tsx
|
|
2121
|
-
function
|
|
2134
|
+
function or({ id: e, dragLabel: t, removeLabel: n, removeName: r, onRemove: i, children: a }) {
|
|
2122
2135
|
let { attributes: o, listeners: s, setActivatorNodeRef: c, setNodeRef: l, transform: u, transition: d, isDragging: f } = T({ id: e });
|
|
2123
2136
|
return /* @__PURE__ */ x("div", {
|
|
2124
2137
|
ref: l,
|
|
@@ -2152,47 +2165,47 @@ function ir({ id: e, dragLabel: t, removeLabel: n, removeName: r, onRemove: i, c
|
|
|
2152
2165
|
}
|
|
2153
2166
|
//#endregion
|
|
2154
2167
|
//#region src/builder/inspector/editors/KeyValueBlockEditor.tsx
|
|
2155
|
-
function
|
|
2168
|
+
function sr(e, t, n) {
|
|
2156
2169
|
return C([...e], t, n);
|
|
2157
2170
|
}
|
|
2158
|
-
function
|
|
2159
|
-
let t = Y(e), n = X(e), r =
|
|
2171
|
+
function cr(e) {
|
|
2172
|
+
let t = Y(e), n = X(e), r = ye(t.map((e) => e.key), "field");
|
|
2160
2173
|
return Z(e, [...t, {
|
|
2161
2174
|
key: `field${r}`,
|
|
2162
2175
|
label: `Field ${r}`
|
|
2163
2176
|
}], n);
|
|
2164
2177
|
}
|
|
2165
|
-
function
|
|
2178
|
+
function lr(e, t) {
|
|
2166
2179
|
let n = Y(e), r = n[t];
|
|
2167
|
-
return r ? Z(e, n.filter((e, n) => n !== t),
|
|
2180
|
+
return r ? Z(e, n.filter((e, n) => n !== t), _e(X(e), r.key)) : e;
|
|
2168
2181
|
}
|
|
2169
|
-
function
|
|
2182
|
+
function ur(e, t, n) {
|
|
2170
2183
|
let r = Y(e), i = r[t];
|
|
2171
2184
|
return !i || i.key === n || r.some((e, r) => r !== t && e.key === n) ? e : Z(e, r.map((e, r) => r === t ? {
|
|
2172
2185
|
...e,
|
|
2173
2186
|
key: n
|
|
2174
|
-
} : e),
|
|
2187
|
+
} : e), ve(X(e), i.key, n));
|
|
2175
2188
|
}
|
|
2176
|
-
function
|
|
2189
|
+
function dr(e, t, n) {
|
|
2177
2190
|
return Z(e, Y(e).map((e, r) => r === t ? {
|
|
2178
2191
|
...e,
|
|
2179
2192
|
label: n
|
|
2180
2193
|
} : e), X(e));
|
|
2181
2194
|
}
|
|
2182
|
-
function
|
|
2195
|
+
function fr(e, t, n) {
|
|
2183
2196
|
return Z(e, Y(e), {
|
|
2184
2197
|
...X(e),
|
|
2185
2198
|
[t]: n
|
|
2186
2199
|
});
|
|
2187
2200
|
}
|
|
2188
|
-
function
|
|
2189
|
-
return Z(e,
|
|
2201
|
+
function pr(e, t, n) {
|
|
2202
|
+
return Z(e, sr(Y(e), t, n), X(e));
|
|
2190
2203
|
}
|
|
2191
|
-
function
|
|
2204
|
+
function mr({ block: e, onChangeBlock: t }) {
|
|
2192
2205
|
let n = e, r = Y(n), i = X(n);
|
|
2193
2206
|
return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(J, {
|
|
2194
2207
|
title: "Fields",
|
|
2195
|
-
children: /* @__PURE__ */ b(
|
|
2208
|
+
children: /* @__PURE__ */ b(hr, {
|
|
2196
2209
|
block: n,
|
|
2197
2210
|
fields: r,
|
|
2198
2211
|
onChangeBlock: t
|
|
@@ -2205,31 +2218,31 @@ function fr({ block: e, onChangeBlock: t }) {
|
|
|
2205
2218
|
name: `values.${e.key}`,
|
|
2206
2219
|
type: "text",
|
|
2207
2220
|
value: String(i[e.key] ?? ""),
|
|
2208
|
-
onChange: (r) => t(
|
|
2221
|
+
onChange: (r) => t(fr(n, e.key, r.currentTarget.value))
|
|
2209
2222
|
})
|
|
2210
2223
|
}, e.key))
|
|
2211
2224
|
}) : null] });
|
|
2212
2225
|
}
|
|
2213
|
-
function
|
|
2214
|
-
return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(
|
|
2226
|
+
function hr({ block: e, fields: t, onChangeBlock: n }) {
|
|
2227
|
+
return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(ar, {
|
|
2215
2228
|
count: t.length,
|
|
2216
|
-
onReorder: (t, r) => n(
|
|
2217
|
-
children: t.map((t, r) => /* @__PURE__ */ b(
|
|
2229
|
+
onReorder: (t, r) => n(pr(e, t, r)),
|
|
2230
|
+
children: t.map((t, r) => /* @__PURE__ */ b(gr, {
|
|
2218
2231
|
id: String(r),
|
|
2219
2232
|
index: r,
|
|
2220
2233
|
field: t,
|
|
2221
|
-
onChangeKey: (t) => n(
|
|
2222
|
-
onChangeLabel: (t) => n(
|
|
2223
|
-
onRemove: () => n(
|
|
2224
|
-
},
|
|
2225
|
-
}), /* @__PURE__ */ b(
|
|
2234
|
+
onChangeKey: (t) => n(ur(e, r, t)),
|
|
2235
|
+
onChangeLabel: (t) => n(dr(e, r, t)),
|
|
2236
|
+
onRemove: () => n(lr(e, r))
|
|
2237
|
+
}, _r(t, r)))
|
|
2238
|
+
}), /* @__PURE__ */ b($t, {
|
|
2226
2239
|
"data-name": "add-field",
|
|
2227
|
-
onClick: () => n(
|
|
2240
|
+
onClick: () => n(cr(e)),
|
|
2228
2241
|
children: "Add field"
|
|
2229
2242
|
})] });
|
|
2230
2243
|
}
|
|
2231
|
-
function
|
|
2232
|
-
return /* @__PURE__ */ b(
|
|
2244
|
+
function gr({ id: e, index: t, field: n, onChangeKey: r, onChangeLabel: i, onRemove: a }) {
|
|
2245
|
+
return /* @__PURE__ */ b(or, {
|
|
2233
2246
|
id: e,
|
|
2234
2247
|
dragLabel: `Drag to reorder field ${t + 1}`,
|
|
2235
2248
|
removeLabel: `Remove field ${t + 1}`,
|
|
@@ -2257,7 +2270,7 @@ function mr({ id: e, index: t, field: n, onChangeKey: r, onChangeLabel: i, onRem
|
|
|
2257
2270
|
})
|
|
2258
2271
|
});
|
|
2259
2272
|
}
|
|
2260
|
-
function
|
|
2273
|
+
function _r(e, t) {
|
|
2261
2274
|
return e.key.length > 0 ? `key:${e.key}` : `index:${t}`;
|
|
2262
2275
|
}
|
|
2263
2276
|
function Y(e) {
|
|
@@ -2266,7 +2279,7 @@ function Y(e) {
|
|
|
2266
2279
|
}
|
|
2267
2280
|
function X(e) {
|
|
2268
2281
|
let t = e.values;
|
|
2269
|
-
return
|
|
2282
|
+
return N(t) ? t : {};
|
|
2270
2283
|
}
|
|
2271
2284
|
function Z(e, t, n) {
|
|
2272
2285
|
let r = { ...e.config };
|
|
@@ -2279,128 +2292,128 @@ function Z(e, t, n) {
|
|
|
2279
2292
|
}
|
|
2280
2293
|
//#endregion
|
|
2281
2294
|
//#region src/builder/inspector/editors/TableBlockEditor.tsx
|
|
2282
|
-
var
|
|
2283
|
-
function
|
|
2295
|
+
var vr = "m-0 text-2xs text-fg-muted";
|
|
2296
|
+
function yr(e, t, n) {
|
|
2284
2297
|
return C([...e], t, n);
|
|
2285
2298
|
}
|
|
2286
|
-
function
|
|
2299
|
+
function br(e, t, n) {
|
|
2287
2300
|
return C([...e], t, n);
|
|
2288
2301
|
}
|
|
2289
|
-
function
|
|
2290
|
-
let t = Q(e), n =
|
|
2302
|
+
function xr(e) {
|
|
2303
|
+
let t = Q(e), n = ye(t.map((e) => e.key), "column");
|
|
2291
2304
|
return $(e, [...t, {
|
|
2292
2305
|
key: `column${n}`,
|
|
2293
2306
|
label: `Column ${n}`
|
|
2294
2307
|
}]);
|
|
2295
2308
|
}
|
|
2296
|
-
function
|
|
2309
|
+
function Sr(e, t) {
|
|
2297
2310
|
let n = Q(e);
|
|
2298
2311
|
return n[t] ? $(e, n.filter((e, n) => n !== t)) : e;
|
|
2299
2312
|
}
|
|
2300
|
-
function
|
|
2313
|
+
function Cr(e, t, n) {
|
|
2301
2314
|
let r = Q(e), i = r[t];
|
|
2302
2315
|
return !i || i.key === n || r.some((e, r) => r !== t && e.key === n) ? e : $(e, r.map((e, r) => r === t ? {
|
|
2303
2316
|
...e,
|
|
2304
2317
|
key: n
|
|
2305
2318
|
} : e));
|
|
2306
2319
|
}
|
|
2307
|
-
function
|
|
2320
|
+
function wr(e, t, n) {
|
|
2308
2321
|
return $(e, Q(e).map((e, r) => r === t ? {
|
|
2309
2322
|
...e,
|
|
2310
2323
|
label: n
|
|
2311
2324
|
} : e));
|
|
2312
2325
|
}
|
|
2313
|
-
function
|
|
2326
|
+
function Tr(e, t, n) {
|
|
2314
2327
|
return $(e, Q(e).map((e, r) => {
|
|
2315
2328
|
if (r !== t) return e;
|
|
2316
2329
|
let i = { ...e };
|
|
2317
2330
|
return n === "" ? delete i.align : i.align = n, i;
|
|
2318
2331
|
}));
|
|
2319
2332
|
}
|
|
2320
|
-
function
|
|
2333
|
+
function Er(e, t) {
|
|
2321
2334
|
let n = e.config?.numberRows === !0, r = t === !0, i = K(e, "numberRows", t);
|
|
2322
|
-
return n === r ? i :
|
|
2335
|
+
return n === r ? i : Dr(i, r ? -5 : 5);
|
|
2323
2336
|
}
|
|
2324
|
-
function
|
|
2337
|
+
function Dr(e, t) {
|
|
2325
2338
|
let n = Q(e);
|
|
2326
|
-
return n.length === 0 || !n.every((e) =>
|
|
2339
|
+
return n.length === 0 || !n.every((e) => vn(e.width) !== null) ? e : $(e, n.map((e, n) => {
|
|
2327
2340
|
if (n !== 0) return e;
|
|
2328
|
-
let r =
|
|
2341
|
+
let r = vn(e.width) ?? 0, i = Math.max(5, r + t);
|
|
2329
2342
|
return {
|
|
2330
2343
|
...e,
|
|
2331
2344
|
width: `${i}%`
|
|
2332
2345
|
};
|
|
2333
2346
|
}));
|
|
2334
2347
|
}
|
|
2335
|
-
function
|
|
2336
|
-
return $(e,
|
|
2348
|
+
function Or(e, t, n) {
|
|
2349
|
+
return $(e, yr(Q(e), t, n));
|
|
2337
2350
|
}
|
|
2338
|
-
function
|
|
2351
|
+
function kr(e, t) {
|
|
2339
2352
|
let n = Object.fromEntries(t.map((e) => [e.key, ""]));
|
|
2340
2353
|
return [...e, n];
|
|
2341
2354
|
}
|
|
2342
|
-
function
|
|
2355
|
+
function Ar(e, t) {
|
|
2343
2356
|
return e.filter((e, n) => n !== t);
|
|
2344
2357
|
}
|
|
2345
|
-
function
|
|
2358
|
+
function jr(e, t, n, r) {
|
|
2346
2359
|
return e.map((e, i) => i === t ? {
|
|
2347
2360
|
...e,
|
|
2348
2361
|
[n]: r
|
|
2349
2362
|
} : e);
|
|
2350
2363
|
}
|
|
2351
|
-
function
|
|
2352
|
-
return e.map((e) =>
|
|
2364
|
+
function Mr(e, t) {
|
|
2365
|
+
return e.map((e) => _e(e, t));
|
|
2353
2366
|
}
|
|
2354
|
-
function
|
|
2355
|
-
return e.map((e) =>
|
|
2367
|
+
function Nr(e, t, n) {
|
|
2368
|
+
return e.map((e) => ve(e, t, n));
|
|
2356
2369
|
}
|
|
2357
|
-
function
|
|
2358
|
-
let i = e, a = Q(i), o =
|
|
2370
|
+
function Pr({ block: e, rowData: t, onChangeBlock: n, onChangeRowData: r }) {
|
|
2371
|
+
let i = e, a = Q(i), o = Vr(t), s = (typeof i.id == "string" ? i.id : "") !== "" && r !== void 0;
|
|
2359
2372
|
function c(e) {
|
|
2360
2373
|
let t = a[e];
|
|
2361
|
-
t && (n(
|
|
2374
|
+
t && (n(Sr(i, e)), s && r?.(Mr(o, t.key)));
|
|
2362
2375
|
}
|
|
2363
2376
|
function l(e, t) {
|
|
2364
2377
|
let c = a[e];
|
|
2365
|
-
!c || c.key === t || a.some((n, r) => r !== e && n.key === t) || (n(
|
|
2378
|
+
!c || c.key === t || a.some((n, r) => r !== e && n.key === t) || (n(Cr(i, e, t)), s && r?.(Nr(o, c.key, t)));
|
|
2366
2379
|
}
|
|
2367
|
-
return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(
|
|
2380
|
+
return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(Fr, {
|
|
2368
2381
|
block: i,
|
|
2369
2382
|
columns: a,
|
|
2370
2383
|
onChangeBlock: n,
|
|
2371
2384
|
onRemoveColumn: c,
|
|
2372
2385
|
onRenameColumnKey: l
|
|
2373
|
-
}), /* @__PURE__ */ b(
|
|
2386
|
+
}), /* @__PURE__ */ b(Lr, {
|
|
2374
2387
|
canEditRows: s,
|
|
2375
2388
|
rows: o,
|
|
2376
2389
|
columns: a,
|
|
2377
2390
|
onChangeRowData: r
|
|
2378
2391
|
})] });
|
|
2379
2392
|
}
|
|
2380
|
-
function
|
|
2393
|
+
function Fr({ block: e, columns: t, onChangeBlock: n, onRemoveColumn: r, onRenameColumnKey: i }) {
|
|
2381
2394
|
return /* @__PURE__ */ x(J, {
|
|
2382
2395
|
title: "Columns",
|
|
2383
|
-
children: [/* @__PURE__ */ b(
|
|
2396
|
+
children: [/* @__PURE__ */ b(ar, {
|
|
2384
2397
|
count: t.length,
|
|
2385
|
-
onReorder: (t, r) => n(
|
|
2386
|
-
children: t.map((t, a) => /* @__PURE__ */ b(
|
|
2398
|
+
onReorder: (t, r) => n(Or(e, t, r)),
|
|
2399
|
+
children: t.map((t, a) => /* @__PURE__ */ b(Ir, {
|
|
2387
2400
|
id: String(a),
|
|
2388
2401
|
index: a,
|
|
2389
2402
|
column: t,
|
|
2390
2403
|
onChangeKey: (e) => i(a, e),
|
|
2391
|
-
onChangeLabel: (t) => n(
|
|
2392
|
-
onChangeAlign: (t) => n(
|
|
2404
|
+
onChangeLabel: (t) => n(wr(e, a, t)),
|
|
2405
|
+
onChangeAlign: (t) => n(Tr(e, a, t)),
|
|
2393
2406
|
onRemove: () => r(a)
|
|
2394
|
-
},
|
|
2395
|
-
}), /* @__PURE__ */ b(
|
|
2407
|
+
}, zr(t, a)))
|
|
2408
|
+
}), /* @__PURE__ */ b($t, {
|
|
2396
2409
|
"data-name": "add-column",
|
|
2397
|
-
onClick: () => n(
|
|
2410
|
+
onClick: () => n(xr(e)),
|
|
2398
2411
|
children: "Add column"
|
|
2399
2412
|
})]
|
|
2400
2413
|
});
|
|
2401
2414
|
}
|
|
2402
|
-
function
|
|
2403
|
-
return /* @__PURE__ */ b(
|
|
2415
|
+
function Ir({ id: e, index: t, column: n, onChangeKey: r, onChangeLabel: i, onChangeAlign: a, onRemove: o }) {
|
|
2416
|
+
return /* @__PURE__ */ b(or, {
|
|
2404
2417
|
id: e,
|
|
2405
2418
|
dragLabel: `Drag to reorder column ${t + 1}`,
|
|
2406
2419
|
removeLabel: `Remove column ${t + 1}`,
|
|
@@ -2427,7 +2440,7 @@ function Pr({ id: e, index: t, column: n, onChangeKey: r, onChangeLabel: i, onCh
|
|
|
2427
2440
|
onChange: (e) => i(e.currentTarget.value)
|
|
2428
2441
|
})
|
|
2429
2442
|
}),
|
|
2430
|
-
/* @__PURE__ */ b(
|
|
2443
|
+
/* @__PURE__ */ b(Yt, {
|
|
2431
2444
|
name: `column-align-${t}`,
|
|
2432
2445
|
value: n.align ?? "",
|
|
2433
2446
|
onChange: a
|
|
@@ -2436,39 +2449,39 @@ function Pr({ id: e, index: t, column: n, onChangeKey: r, onChangeLabel: i, onCh
|
|
|
2436
2449
|
})
|
|
2437
2450
|
});
|
|
2438
2451
|
}
|
|
2439
|
-
function
|
|
2452
|
+
function Lr({ canEditRows: e, rows: t, columns: n, onChangeRowData: r }) {
|
|
2440
2453
|
return e ? /* @__PURE__ */ x(J, {
|
|
2441
2454
|
title: "Rows",
|
|
2442
2455
|
children: [t.length === 0 ? /* @__PURE__ */ b("p", {
|
|
2443
|
-
className:
|
|
2456
|
+
className: vr,
|
|
2444
2457
|
children: "No rows yet. Add one to seed runtime data for this table."
|
|
2445
|
-
}) : /* @__PURE__ */ b(
|
|
2458
|
+
}) : /* @__PURE__ */ b(ar, {
|
|
2446
2459
|
count: t.length,
|
|
2447
|
-
onReorder: (e, n) => r?.(
|
|
2448
|
-
children: t.map((e, i) => /* @__PURE__ */ b(
|
|
2460
|
+
onReorder: (e, n) => r?.(br(t, e, n)),
|
|
2461
|
+
children: t.map((e, i) => /* @__PURE__ */ b(Rr, {
|
|
2449
2462
|
id: String(i),
|
|
2450
2463
|
index: i,
|
|
2451
2464
|
row: e,
|
|
2452
2465
|
columns: n,
|
|
2453
|
-
onChangeCell: (e, n) => r?.(
|
|
2454
|
-
onRemove: () => r?.(
|
|
2455
|
-
},
|
|
2456
|
-
}), /* @__PURE__ */ b(
|
|
2466
|
+
onChangeCell: (e, n) => r?.(jr(t, i, e, n)),
|
|
2467
|
+
onRemove: () => r?.(Ar(t, i))
|
|
2468
|
+
}, Br(e, n, i)))
|
|
2469
|
+
}), /* @__PURE__ */ b($t, {
|
|
2457
2470
|
"data-name": "add-row",
|
|
2458
2471
|
disabled: n.length === 0,
|
|
2459
|
-
onClick: () => r?.(
|
|
2472
|
+
onClick: () => r?.(kr(t, n)),
|
|
2460
2473
|
children: "Add row"
|
|
2461
2474
|
})]
|
|
2462
2475
|
}) : /* @__PURE__ */ b(J, {
|
|
2463
2476
|
title: "Rows",
|
|
2464
2477
|
children: /* @__PURE__ */ b("p", {
|
|
2465
|
-
className:
|
|
2478
|
+
className: vr,
|
|
2466
2479
|
children: "Give this block an id to edit runtime row data here."
|
|
2467
2480
|
})
|
|
2468
2481
|
});
|
|
2469
2482
|
}
|
|
2470
|
-
function
|
|
2471
|
-
return /* @__PURE__ */ b(
|
|
2483
|
+
function Rr({ id: e, index: t, row: n, columns: r, onChangeCell: i, onRemove: a }) {
|
|
2484
|
+
return /* @__PURE__ */ b(or, {
|
|
2472
2485
|
id: e,
|
|
2473
2486
|
dragLabel: `Drag to reorder row ${t + 1}`,
|
|
2474
2487
|
removeLabel: `Remove row ${t + 1}`,
|
|
@@ -2488,10 +2501,10 @@ function Ir({ id: e, index: t, row: n, columns: r, onChangeCell: i, onRemove: a
|
|
|
2488
2501
|
})
|
|
2489
2502
|
});
|
|
2490
2503
|
}
|
|
2491
|
-
function
|
|
2504
|
+
function zr(e, t) {
|
|
2492
2505
|
return e.key.length > 0 ? `key:${e.key}` : `index:${t}`;
|
|
2493
2506
|
}
|
|
2494
|
-
function
|
|
2507
|
+
function Br(e, t, n) {
|
|
2495
2508
|
let r = t[0], i = r ? e[r.key] : void 0;
|
|
2496
2509
|
return typeof i == "string" && i.length > 0 ? `first:${i}:${n}` : `index:${n}`;
|
|
2497
2510
|
}
|
|
@@ -2499,8 +2512,8 @@ function Q(e) {
|
|
|
2499
2512
|
let t = e.config?.columns;
|
|
2500
2513
|
return Array.isArray(t) ? t : [];
|
|
2501
2514
|
}
|
|
2502
|
-
function
|
|
2503
|
-
return Array.isArray(e) ? e.filter((e) =>
|
|
2515
|
+
function Vr(e) {
|
|
2516
|
+
return Array.isArray(e) ? e.filter((e) => N(e)) : [];
|
|
2504
2517
|
}
|
|
2505
2518
|
function $(e, t) {
|
|
2506
2519
|
let n = { ...e.config };
|
|
@@ -2513,7 +2526,7 @@ function $(e, t) {
|
|
|
2513
2526
|
}
|
|
2514
2527
|
//#endregion
|
|
2515
2528
|
//#region src/builder/inspector/BlockContentControls.tsx
|
|
2516
|
-
var
|
|
2529
|
+
var Hr = [
|
|
2517
2530
|
{
|
|
2518
2531
|
value: "1",
|
|
2519
2532
|
label: "Heading 1"
|
|
@@ -2539,25 +2552,25 @@ var Br = [
|
|
|
2539
2552
|
label: "Heading 6"
|
|
2540
2553
|
}
|
|
2541
2554
|
];
|
|
2542
|
-
function
|
|
2543
|
-
return e.block.type === "key-value" ? /* @__PURE__ */ b(
|
|
2555
|
+
function Ur(e) {
|
|
2556
|
+
return e.block.type === "key-value" ? /* @__PURE__ */ b(mr, {
|
|
2544
2557
|
block: e.block,
|
|
2545
2558
|
onChangeBlock: e.onChangeBlock
|
|
2546
|
-
}) : e.block.type === "table" ? /* @__PURE__ */ b(
|
|
2559
|
+
}) : e.block.type === "table" ? /* @__PURE__ */ b(Pr, {
|
|
2547
2560
|
block: e.block,
|
|
2548
2561
|
rowData: e.rowData,
|
|
2549
2562
|
onChangeBlock: e.onChangeBlock,
|
|
2550
2563
|
onChangeRowData: e.onChangeRowData
|
|
2551
2564
|
}) : /* @__PURE__ */ b(J, {
|
|
2552
2565
|
title: "Content",
|
|
2553
|
-
children:
|
|
2566
|
+
children: Wr(e)
|
|
2554
2567
|
});
|
|
2555
2568
|
}
|
|
2556
|
-
function
|
|
2569
|
+
function Wr({ block: e, onChangeBlock: t }) {
|
|
2557
2570
|
switch (e.type) {
|
|
2558
2571
|
case "text": return /* @__PURE__ */ b("div", {
|
|
2559
2572
|
className: "grid gap-2",
|
|
2560
|
-
children: /* @__PURE__ */ b(
|
|
2573
|
+
children: /* @__PURE__ */ b(Wt, {
|
|
2561
2574
|
name: "text",
|
|
2562
2575
|
label: "Text",
|
|
2563
2576
|
value: e.text,
|
|
@@ -2570,7 +2583,7 @@ function Hr({ block: e, onChangeBlock: t }) {
|
|
|
2570
2583
|
});
|
|
2571
2584
|
case "html": return /* @__PURE__ */ b("div", {
|
|
2572
2585
|
className: "grid gap-2",
|
|
2573
|
-
children: /* @__PURE__ */ b(
|
|
2586
|
+
children: /* @__PURE__ */ b(Wt, {
|
|
2574
2587
|
name: "html",
|
|
2575
2588
|
label: "HTML",
|
|
2576
2589
|
value: e.html,
|
|
@@ -2583,7 +2596,7 @@ function Hr({ block: e, onChangeBlock: t }) {
|
|
|
2583
2596
|
});
|
|
2584
2597
|
case "heading": return /* @__PURE__ */ x("div", {
|
|
2585
2598
|
className: "grid gap-2",
|
|
2586
|
-
children: [/* @__PURE__ */ b(
|
|
2599
|
+
children: [/* @__PURE__ */ b(Ut, {
|
|
2587
2600
|
name: "text",
|
|
2588
2601
|
label: "Text",
|
|
2589
2602
|
value: e.text,
|
|
@@ -2594,14 +2607,14 @@ function Hr({ block: e, onChangeBlock: t }) {
|
|
|
2594
2607
|
}), /* @__PURE__ */ b(H, {
|
|
2595
2608
|
name: "config.level",
|
|
2596
2609
|
label: "Level",
|
|
2597
|
-
value:
|
|
2598
|
-
options:
|
|
2610
|
+
value: Gr(e.config?.level),
|
|
2611
|
+
options: Hr,
|
|
2599
2612
|
optional: !0,
|
|
2600
2613
|
emptyLabel: "Default",
|
|
2601
|
-
onChange: (n) => t(K(e, "level",
|
|
2614
|
+
onChange: (n) => t(K(e, "level", Kr(n)))
|
|
2602
2615
|
})]
|
|
2603
2616
|
});
|
|
2604
|
-
case "image": return /* @__PURE__ */ b(
|
|
2617
|
+
case "image": return /* @__PURE__ */ b(nr, {
|
|
2605
2618
|
block: e,
|
|
2606
2619
|
onChangeBlock: t
|
|
2607
2620
|
});
|
|
@@ -2614,20 +2627,20 @@ function Hr({ block: e, onChangeBlock: t }) {
|
|
|
2614
2627
|
});
|
|
2615
2628
|
}
|
|
2616
2629
|
}
|
|
2617
|
-
function
|
|
2630
|
+
function Gr(e) {
|
|
2618
2631
|
if (e === void 0) return;
|
|
2619
2632
|
let t = String(e);
|
|
2620
|
-
return
|
|
2633
|
+
return qr(t) ? t : void 0;
|
|
2621
2634
|
}
|
|
2622
|
-
function
|
|
2635
|
+
function Kr(e) {
|
|
2623
2636
|
return e === void 0 ? void 0 : Number(e);
|
|
2624
2637
|
}
|
|
2625
|
-
function
|
|
2626
|
-
return
|
|
2638
|
+
function qr(e) {
|
|
2639
|
+
return Hr.some((t) => t.value === e);
|
|
2627
2640
|
}
|
|
2628
2641
|
//#endregion
|
|
2629
2642
|
//#region src/builder/inspector/alignOptions.ts
|
|
2630
|
-
var
|
|
2643
|
+
var Jr = [
|
|
2631
2644
|
{
|
|
2632
2645
|
value: "left",
|
|
2633
2646
|
label: "Left"
|
|
@@ -2640,7 +2653,7 @@ var Kr = [
|
|
|
2640
2653
|
value: "right",
|
|
2641
2654
|
label: "Right"
|
|
2642
2655
|
}
|
|
2643
|
-
],
|
|
2656
|
+
], Yr = [
|
|
2644
2657
|
{
|
|
2645
2658
|
value: "solid",
|
|
2646
2659
|
label: "Solid"
|
|
@@ -2661,7 +2674,7 @@ var Kr = [
|
|
|
2661
2674
|
value: "none",
|
|
2662
2675
|
label: "None"
|
|
2663
2676
|
}
|
|
2664
|
-
],
|
|
2677
|
+
], Xr = [
|
|
2665
2678
|
{
|
|
2666
2679
|
value: "striped",
|
|
2667
2680
|
label: "Striped"
|
|
@@ -2674,19 +2687,19 @@ var Kr = [
|
|
|
2674
2687
|
value: "minimal",
|
|
2675
2688
|
label: "Minimal"
|
|
2676
2689
|
}
|
|
2677
|
-
],
|
|
2690
|
+
], Zr = [{
|
|
2678
2691
|
value: "show",
|
|
2679
2692
|
label: "Show"
|
|
2680
2693
|
}, {
|
|
2681
2694
|
value: "hide",
|
|
2682
2695
|
label: "Hide"
|
|
2683
2696
|
}];
|
|
2684
|
-
function
|
|
2697
|
+
function Qr({ block: e, onChangeBlock: t }) {
|
|
2685
2698
|
return /* @__PURE__ */ x("div", {
|
|
2686
2699
|
className: "grid gap-2",
|
|
2687
2700
|
children: [/* @__PURE__ */ x("div", {
|
|
2688
2701
|
className: "grid grid-cols-2 items-start gap-2",
|
|
2689
|
-
children: [/* @__PURE__ */ b(
|
|
2702
|
+
children: [/* @__PURE__ */ b(Kt, {
|
|
2690
2703
|
name: "config.width",
|
|
2691
2704
|
label: "Width",
|
|
2692
2705
|
value: e.config?.width ?? void 0,
|
|
@@ -2697,15 +2710,15 @@ function Xr({ block: e, onChangeBlock: t }) {
|
|
|
2697
2710
|
name: "config.align",
|
|
2698
2711
|
label: "Align",
|
|
2699
2712
|
value: e.config?.align ?? void 0,
|
|
2700
|
-
options:
|
|
2713
|
+
options: Jr,
|
|
2701
2714
|
optional: !0,
|
|
2702
2715
|
emptyLabel: "Default",
|
|
2703
|
-
onChange: (n) => t(
|
|
2716
|
+
onChange: (n) => t(ei(e, "align", n))
|
|
2704
2717
|
})]
|
|
2705
|
-
}),
|
|
2718
|
+
}), $r(e, t)]
|
|
2706
2719
|
});
|
|
2707
2720
|
}
|
|
2708
|
-
function
|
|
2721
|
+
function $r(e, t) {
|
|
2709
2722
|
switch (e.type) {
|
|
2710
2723
|
case "spacer": return /* @__PURE__ */ b(V, {
|
|
2711
2724
|
name: "config.height",
|
|
@@ -2732,7 +2745,7 @@ function Zr(e, t) {
|
|
|
2732
2745
|
step: .5,
|
|
2733
2746
|
onChange: (n) => t(K(e, "thickness", n))
|
|
2734
2747
|
}),
|
|
2735
|
-
/* @__PURE__ */ b(
|
|
2748
|
+
/* @__PURE__ */ b(Ut, {
|
|
2736
2749
|
name: "config.lineColor",
|
|
2737
2750
|
label: "Line color",
|
|
2738
2751
|
value: e.config?.lineColor,
|
|
@@ -2744,7 +2757,7 @@ function Zr(e, t) {
|
|
|
2744
2757
|
name: "config.style",
|
|
2745
2758
|
label: "Line style",
|
|
2746
2759
|
value: e.config?.style,
|
|
2747
|
-
options:
|
|
2760
|
+
options: Yr,
|
|
2748
2761
|
optional: !0,
|
|
2749
2762
|
emptyLabel: "Default",
|
|
2750
2763
|
onChange: (n) => t(K(e, "style", n))
|
|
@@ -2756,18 +2769,18 @@ function Zr(e, t) {
|
|
|
2756
2769
|
name: "config.style",
|
|
2757
2770
|
label: "Table style",
|
|
2758
2771
|
value: e.config?.style,
|
|
2759
|
-
options:
|
|
2772
|
+
options: Xr,
|
|
2760
2773
|
optional: !0,
|
|
2761
2774
|
emptyLabel: "Default",
|
|
2762
2775
|
onChange: (n) => t(K(e, "style", n))
|
|
2763
2776
|
}), /* @__PURE__ */ b(H, {
|
|
2764
2777
|
name: "config.numberRows",
|
|
2765
2778
|
label: "Row numbers",
|
|
2766
|
-
value:
|
|
2767
|
-
options:
|
|
2779
|
+
value: ti(e.config?.numberRows),
|
|
2780
|
+
options: Zr,
|
|
2768
2781
|
optional: !0,
|
|
2769
2782
|
emptyLabel: "Default",
|
|
2770
|
-
onChange: (n) => t(
|
|
2783
|
+
onChange: (n) => t(Er(e, ni(n)))
|
|
2771
2784
|
})]
|
|
2772
2785
|
});
|
|
2773
2786
|
case "key-value":
|
|
@@ -2776,7 +2789,7 @@ function Zr(e, t) {
|
|
|
2776
2789
|
case "html": return null;
|
|
2777
2790
|
}
|
|
2778
2791
|
}
|
|
2779
|
-
function
|
|
2792
|
+
function ei(e, t, n) {
|
|
2780
2793
|
switch (e.type) {
|
|
2781
2794
|
case "text":
|
|
2782
2795
|
case "html":
|
|
@@ -2788,59 +2801,59 @@ function Qr(e, t, n) {
|
|
|
2788
2801
|
case "table": return K(e, t, n);
|
|
2789
2802
|
}
|
|
2790
2803
|
}
|
|
2791
|
-
function
|
|
2804
|
+
function ti(e) {
|
|
2792
2805
|
if (e !== void 0) return e ? "show" : "hide";
|
|
2793
2806
|
}
|
|
2794
|
-
function
|
|
2807
|
+
function ni(e) {
|
|
2795
2808
|
if (e !== void 0) return e === "show";
|
|
2796
2809
|
}
|
|
2797
2810
|
//#endregion
|
|
2798
2811
|
//#region src/builder/inspector/SpacingControls.tsx
|
|
2799
|
-
var
|
|
2812
|
+
var ri = [
|
|
2800
2813
|
"top",
|
|
2801
2814
|
"right",
|
|
2802
2815
|
"bottom",
|
|
2803
2816
|
"left"
|
|
2804
2817
|
];
|
|
2805
|
-
function
|
|
2818
|
+
function ii(e) {
|
|
2806
2819
|
let t = e.scope === "block" ? e.block.config?.spacing : e.template.config?.page?.margins;
|
|
2807
2820
|
return /* @__PURE__ */ b("div", {
|
|
2808
2821
|
className: "grid min-w-0 grid-cols-2 gap-2",
|
|
2809
|
-
children:
|
|
2810
|
-
name:
|
|
2811
|
-
label:
|
|
2812
|
-
value:
|
|
2822
|
+
children: ri.map((n) => /* @__PURE__ */ b(V, {
|
|
2823
|
+
name: ai(e.scope, n),
|
|
2824
|
+
label: oi(n),
|
|
2825
|
+
value: si(t, n),
|
|
2813
2826
|
min: 0,
|
|
2814
2827
|
step: .5,
|
|
2815
2828
|
onChange: (t) => {
|
|
2816
2829
|
if (e.scope === "block") {
|
|
2817
|
-
e.onChangeBlock(
|
|
2830
|
+
e.onChangeBlock(Dn(e.block, n, t));
|
|
2818
2831
|
return;
|
|
2819
2832
|
}
|
|
2820
|
-
e.onChangeTemplate(
|
|
2833
|
+
e.onChangeTemplate(kn(e.template, n, t));
|
|
2821
2834
|
}
|
|
2822
2835
|
}, n))
|
|
2823
2836
|
});
|
|
2824
2837
|
}
|
|
2825
|
-
function
|
|
2838
|
+
function ai(e, t) {
|
|
2826
2839
|
return e === "block" ? `config.spacing.${t}` : `config.page.margins.${t}`;
|
|
2827
2840
|
}
|
|
2828
|
-
function
|
|
2841
|
+
function oi(e) {
|
|
2829
2842
|
return `${e[0].toUpperCase()}${e.slice(1)} (mm)`;
|
|
2830
2843
|
}
|
|
2831
|
-
function
|
|
2844
|
+
function si(e, t) {
|
|
2832
2845
|
return e?.[t] ?? void 0;
|
|
2833
2846
|
}
|
|
2834
2847
|
//#endregion
|
|
2835
2848
|
//#region src/builder/inspector/TypographyControls.tsx
|
|
2836
|
-
function
|
|
2837
|
-
let t = e.target === "block" ? e.block.config?.typography : e.template.config?.typography, n = e.target === "block" ? "config.typography" : "template.config.typography", r =
|
|
2849
|
+
function ci(e) {
|
|
2850
|
+
let t = e.target === "block" ? e.block.config?.typography : e.template.config?.typography, n = e.target === "block" ? "config.typography" : "template.config.typography", r = li(e.metadata, t?.family ?? void 0);
|
|
2838
2851
|
function i(t, n) {
|
|
2839
2852
|
if (e.target === "block") {
|
|
2840
|
-
e.onChangeBlock(
|
|
2853
|
+
e.onChangeBlock(En(e.block, t, n));
|
|
2841
2854
|
return;
|
|
2842
2855
|
}
|
|
2843
|
-
e.onChangeTemplate(
|
|
2856
|
+
e.onChangeTemplate(On(e.template, t, n));
|
|
2844
2857
|
}
|
|
2845
2858
|
return /* @__PURE__ */ x("div", {
|
|
2846
2859
|
className: "grid min-w-0 gap-2",
|
|
@@ -2859,7 +2872,7 @@ function oi(e) {
|
|
|
2859
2872
|
label: "Align",
|
|
2860
2873
|
value: t?.align ?? void 0,
|
|
2861
2874
|
optional: !0,
|
|
2862
|
-
options:
|
|
2875
|
+
options: Jr,
|
|
2863
2876
|
onChange: (e) => i("align", e)
|
|
2864
2877
|
})]
|
|
2865
2878
|
}), /* @__PURE__ */ x("div", {
|
|
@@ -2883,7 +2896,7 @@ function oi(e) {
|
|
|
2883
2896
|
placeholder: "400",
|
|
2884
2897
|
onChange: (e) => i("weight", e)
|
|
2885
2898
|
}),
|
|
2886
|
-
/* @__PURE__ */ b(
|
|
2899
|
+
/* @__PURE__ */ b(Gt, {
|
|
2887
2900
|
name: `${n}.color`,
|
|
2888
2901
|
label: "Color",
|
|
2889
2902
|
value: t?.color ?? void 0,
|
|
@@ -2893,14 +2906,14 @@ function oi(e) {
|
|
|
2893
2906
|
})]
|
|
2894
2907
|
});
|
|
2895
2908
|
}
|
|
2896
|
-
function
|
|
2897
|
-
let n =
|
|
2909
|
+
function li(e, t) {
|
|
2910
|
+
let n = ui(e);
|
|
2898
2911
|
return t && !n.includes(t) && n.push(t), n.map((e) => ({
|
|
2899
2912
|
value: e,
|
|
2900
2913
|
label: e
|
|
2901
2914
|
}));
|
|
2902
2915
|
}
|
|
2903
|
-
function
|
|
2916
|
+
function ui(e) {
|
|
2904
2917
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
2905
2918
|
for (let r of e?.bundledFonts ?? []) {
|
|
2906
2919
|
let e = r.trim();
|
|
@@ -2910,12 +2923,12 @@ function ci(e) {
|
|
|
2910
2923
|
}
|
|
2911
2924
|
//#endregion
|
|
2912
2925
|
//#region src/builder/inspector/BlockInspector.tsx
|
|
2913
|
-
var
|
|
2926
|
+
var di = [
|
|
2914
2927
|
"Layout",
|
|
2915
2928
|
"Typography",
|
|
2916
2929
|
"Spacing"
|
|
2917
2930
|
];
|
|
2918
|
-
function
|
|
2931
|
+
function fi({ block: e, schema: t, data: n, onChangeBlock: r, onChangeData: i, onRemoveBlock: a, onClose: o, className: s }) {
|
|
2919
2932
|
let c = _(null), l = _(null);
|
|
2920
2933
|
m(() => {
|
|
2921
2934
|
if (e) return l.current = document.activeElement, c.current?.focus(), () => {
|
|
@@ -2925,15 +2938,15 @@ function ui({ block: e, schema: t, data: n, onChangeBlock: r, onChangeData: i, o
|
|
|
2925
2938
|
function u(e) {
|
|
2926
2939
|
e.key === "Escape" && (e.stopPropagation(), o());
|
|
2927
2940
|
}
|
|
2928
|
-
if (!e) return /* @__PURE__ */ x(
|
|
2941
|
+
if (!e) return /* @__PURE__ */ x(rr, {
|
|
2929
2942
|
ariaLabel: "Block inspector",
|
|
2930
2943
|
className: s,
|
|
2931
|
-
children: [/* @__PURE__ */ b(
|
|
2944
|
+
children: [/* @__PURE__ */ b(ir, { title: "Inspector" }), /* @__PURE__ */ b("p", {
|
|
2932
2945
|
className: "m-0 text-xs text-fg-muted",
|
|
2933
2946
|
children: "Select a block to inspect it."
|
|
2934
2947
|
})]
|
|
2935
2948
|
});
|
|
2936
|
-
let d =
|
|
2949
|
+
let d = fe(e.block.type), f = pe(e.block), p = typeof e.block.id == "string" ? e.block.id : null, h = /* @__PURE__ */ b(Ur, {
|
|
2937
2950
|
block: e.block,
|
|
2938
2951
|
rowData: p ? n[p] : void 0,
|
|
2939
2952
|
onChangeBlock: (t) => r(e.uid, t),
|
|
@@ -2942,14 +2955,14 @@ function ui({ block: e, schema: t, data: n, onChangeBlock: r, onChangeData: i, o
|
|
|
2942
2955
|
[p]: e
|
|
2943
2956
|
}) : void 0
|
|
2944
2957
|
});
|
|
2945
|
-
return /* @__PURE__ */ x(
|
|
2958
|
+
return /* @__PURE__ */ x(rr, {
|
|
2946
2959
|
ref: c,
|
|
2947
2960
|
ariaLabel: "Block inspector",
|
|
2948
2961
|
className: s,
|
|
2949
2962
|
onKeyDown: u,
|
|
2950
2963
|
children: [
|
|
2951
|
-
/* @__PURE__ */ b(
|
|
2952
|
-
chip: /* @__PURE__ */ b(
|
|
2964
|
+
/* @__PURE__ */ b(ir, {
|
|
2965
|
+
chip: /* @__PURE__ */ b(M, { children: d.chip }),
|
|
2953
2966
|
title: d.label,
|
|
2954
2967
|
subtitle: f || void 0,
|
|
2955
2968
|
action: /* @__PURE__ */ b("button", {
|
|
@@ -2960,7 +2973,7 @@ function ui({ block: e, schema: t, data: n, onChangeBlock: r, onChangeData: i, o
|
|
|
2960
2973
|
children: "✕"
|
|
2961
2974
|
})
|
|
2962
2975
|
}),
|
|
2963
|
-
/* @__PURE__ */ b(
|
|
2976
|
+
/* @__PURE__ */ b(Ut, {
|
|
2964
2977
|
name: "block.id",
|
|
2965
2978
|
label: "ID",
|
|
2966
2979
|
value: p ?? "",
|
|
@@ -2973,16 +2986,16 @@ function ui({ block: e, schema: t, data: n, onChangeBlock: r, onChangeData: i, o
|
|
|
2973
2986
|
/* @__PURE__ */ x("div", {
|
|
2974
2987
|
className: "grid gap-2",
|
|
2975
2988
|
"aria-label": "Inspector sections",
|
|
2976
|
-
children: [h,
|
|
2989
|
+
children: [h, di.map((n) => /* @__PURE__ */ b(J, {
|
|
2977
2990
|
title: n,
|
|
2978
|
-
children: n === "Layout" ? /* @__PURE__ */ b(
|
|
2991
|
+
children: n === "Layout" ? /* @__PURE__ */ b(Qr, {
|
|
2979
2992
|
block: e.block,
|
|
2980
2993
|
onChangeBlock: (t) => r(e.uid, t)
|
|
2981
|
-
}) : n === "Spacing" ? /* @__PURE__ */ b(
|
|
2994
|
+
}) : n === "Spacing" ? /* @__PURE__ */ b(ii, {
|
|
2982
2995
|
scope: "block",
|
|
2983
2996
|
block: e.block,
|
|
2984
2997
|
onChangeBlock: (t) => r(e.uid, t)
|
|
2985
|
-
}) : /* @__PURE__ */ b(
|
|
2998
|
+
}) : /* @__PURE__ */ b(ci, {
|
|
2986
2999
|
target: "block",
|
|
2987
3000
|
block: e.block,
|
|
2988
3001
|
metadata: t["x-pdfUa"],
|
|
@@ -2992,7 +3005,7 @@ function ui({ block: e, schema: t, data: n, onChangeBlock: r, onChangeData: i, o
|
|
|
2992
3005
|
}),
|
|
2993
3006
|
/* @__PURE__ */ b("footer", {
|
|
2994
3007
|
className: "flex justify-end",
|
|
2995
|
-
children: /* @__PURE__ */ b(
|
|
3008
|
+
children: /* @__PURE__ */ b(Qt, {
|
|
2996
3009
|
variant: "danger",
|
|
2997
3010
|
onClick: () => a(e.uid),
|
|
2998
3011
|
children: "Remove block"
|
|
@@ -3003,11 +3016,11 @@ function ui({ block: e, schema: t, data: n, onChangeBlock: r, onChangeData: i, o
|
|
|
3003
3016
|
}
|
|
3004
3017
|
//#endregion
|
|
3005
3018
|
//#region src/builder/inspector/Inspector.tsx
|
|
3006
|
-
var
|
|
3007
|
-
function
|
|
3008
|
-
let { schema: e, selectedBlock: t, data: n } =
|
|
3009
|
-
return !e || !t ? null : /* @__PURE__ */ b(
|
|
3010
|
-
className:
|
|
3019
|
+
var pi = "absolute inset-y-0 right-0 z-20 w-[min(360px,100%)] border-0 border-l border-solid border-border shadow-pop animate-flyout";
|
|
3020
|
+
function mi() {
|
|
3021
|
+
let { schema: e, selectedBlock: t, data: n } = At(), { changeBlock: r, changeData: i, removeBlock: a, deselect: o } = jt();
|
|
3022
|
+
return !e || !t ? null : /* @__PURE__ */ b(fi, {
|
|
3023
|
+
className: pi,
|
|
3011
3024
|
block: t,
|
|
3012
3025
|
schema: e,
|
|
3013
3026
|
data: n,
|
|
@@ -3019,17 +3032,17 @@ function fi() {
|
|
|
3019
3032
|
}
|
|
3020
3033
|
//#endregion
|
|
3021
3034
|
//#region src/builder/inspector/DocumentSettings.tsx
|
|
3022
|
-
var
|
|
3035
|
+
var hi = Object.keys(cn).map((e) => ({
|
|
3023
3036
|
value: e,
|
|
3024
3037
|
label: e
|
|
3025
|
-
})),
|
|
3038
|
+
})), gi = [{
|
|
3026
3039
|
value: "portrait",
|
|
3027
3040
|
label: "Portrait"
|
|
3028
3041
|
}, {
|
|
3029
3042
|
value: "landscape",
|
|
3030
3043
|
label: "Landscape"
|
|
3031
3044
|
}];
|
|
3032
|
-
function
|
|
3045
|
+
function _i({ template: e, metadata: t, format: n, orientation: r, onChangeTemplate: i, onChangeFormat: a, onChangeOrientation: o, className: s }) {
|
|
3033
3046
|
return /* @__PURE__ */ x("section", {
|
|
3034
3047
|
"aria-label": "Page settings",
|
|
3035
3048
|
className: `grid grid-cols-[repeat(auto-fit,minmax(220px,1fr))] items-start gap-3 border-0 border-b border-solid border-border bg-surface px-4 py-3${s ? ` ${s}` : ""}`,
|
|
@@ -3042,7 +3055,7 @@ function hi({ template: e, metadata: t, format: n, orientation: r, onChangeTempl
|
|
|
3042
3055
|
name: "document.page.size.format",
|
|
3043
3056
|
label: "Page size",
|
|
3044
3057
|
value: n,
|
|
3045
|
-
options:
|
|
3058
|
+
options: hi,
|
|
3046
3059
|
onChange: (e) => {
|
|
3047
3060
|
e && a(e);
|
|
3048
3061
|
}
|
|
@@ -3050,7 +3063,7 @@ function hi({ template: e, metadata: t, format: n, orientation: r, onChangeTempl
|
|
|
3050
3063
|
name: "document.page.size.orientation",
|
|
3051
3064
|
label: "Orientation",
|
|
3052
3065
|
value: r,
|
|
3053
|
-
options:
|
|
3066
|
+
options: gi,
|
|
3054
3067
|
onChange: (e) => {
|
|
3055
3068
|
e && o(e);
|
|
3056
3069
|
}
|
|
@@ -3059,7 +3072,7 @@ function hi({ template: e, metadata: t, format: n, orientation: r, onChangeTempl
|
|
|
3059
3072
|
}),
|
|
3060
3073
|
/* @__PURE__ */ b(J, {
|
|
3061
3074
|
title: "Page margins",
|
|
3062
|
-
children: /* @__PURE__ */ b(
|
|
3075
|
+
children: /* @__PURE__ */ b(ii, {
|
|
3063
3076
|
scope: "page",
|
|
3064
3077
|
template: e,
|
|
3065
3078
|
onChangeTemplate: i
|
|
@@ -3067,7 +3080,7 @@ function hi({ template: e, metadata: t, format: n, orientation: r, onChangeTempl
|
|
|
3067
3080
|
}),
|
|
3068
3081
|
/* @__PURE__ */ b(J, {
|
|
3069
3082
|
title: "Template typography",
|
|
3070
|
-
children: /* @__PURE__ */ b(
|
|
3083
|
+
children: /* @__PURE__ */ b(ci, {
|
|
3071
3084
|
target: "template",
|
|
3072
3085
|
template: e,
|
|
3073
3086
|
metadata: t,
|
|
@@ -3079,9 +3092,9 @@ function hi({ template: e, metadata: t, format: n, orientation: r, onChangeTempl
|
|
|
3079
3092
|
}
|
|
3080
3093
|
//#endregion
|
|
3081
3094
|
//#region src/builder/inspector/PageSettings.tsx
|
|
3082
|
-
function
|
|
3083
|
-
let { schema: t, serializedTemplate: n, pageSize: r } =
|
|
3084
|
-
return t ? /* @__PURE__ */ b(
|
|
3095
|
+
function vi({ className: e } = {}) {
|
|
3096
|
+
let { schema: t, serializedTemplate: n, pageSize: r } = At(), { changeTemplateSettings: i, changeFormat: a, changeOrientation: o } = jt();
|
|
3097
|
+
return t ? /* @__PURE__ */ b(_i, {
|
|
3085
3098
|
className: e,
|
|
3086
3099
|
template: n,
|
|
3087
3100
|
metadata: t["x-pdfUa"],
|
|
@@ -3094,49 +3107,69 @@ function gi({ className: e } = {}) {
|
|
|
3094
3107
|
}
|
|
3095
3108
|
//#endregion
|
|
3096
3109
|
//#region src/builder/Builder.tsx
|
|
3097
|
-
function
|
|
3110
|
+
function yi({ className: e, examples: t } = {}) {
|
|
3098
3111
|
return /* @__PURE__ */ x("section", {
|
|
3099
3112
|
className: `pdfua-template-builder grid h-full min-w-0 min-h-0 bg-app${e ? ` ${e}` : ""}`,
|
|
3100
3113
|
style: { gridTemplateRows: "auto auto 1fr" },
|
|
3101
3114
|
"aria-label": "Template authoring",
|
|
3102
3115
|
children: [
|
|
3103
|
-
/* @__PURE__ */ b(
|
|
3104
|
-
/* @__PURE__ */ b(
|
|
3116
|
+
/* @__PURE__ */ b(vi, {}),
|
|
3117
|
+
/* @__PURE__ */ b(nn, { examples: t }),
|
|
3105
3118
|
/* @__PURE__ */ x("div", {
|
|
3106
3119
|
className: "relative mt-2 min-h-0 min-w-0",
|
|
3107
|
-
children: [/* @__PURE__ */ b(
|
|
3120
|
+
children: [/* @__PURE__ */ b(tr, { className: "h-full" }), /* @__PURE__ */ b(mi, {})]
|
|
3108
3121
|
})
|
|
3109
3122
|
]
|
|
3110
3123
|
});
|
|
3111
3124
|
}
|
|
3112
3125
|
//#endregion
|
|
3113
|
-
//#region src/render/
|
|
3114
|
-
function
|
|
3115
|
-
return
|
|
3116
|
-
type: "button",
|
|
3117
|
-
role: "tab",
|
|
3118
|
-
className: `h-full m-0 cursor-pointer border-0 border-b-2 border-solid bg-transparent px-3 text-sm font-medium tracking-[0.02em] transition-colors hover:text-fg ${e ? "border-fg text-fg" : "border-transparent text-fg-muted"}`,
|
|
3119
|
-
"aria-selected": e,
|
|
3120
|
-
onClick: t,
|
|
3121
|
-
children: n
|
|
3122
|
-
});
|
|
3126
|
+
//#region src/render/previewChrome.tsx
|
|
3127
|
+
function bi(e, t) {
|
|
3128
|
+
return e ? "rendering" : t ? "ready" : "empty";
|
|
3123
3129
|
}
|
|
3124
|
-
|
|
3130
|
+
function xi(e) {
|
|
3131
|
+
return e === "rendering" ? "Rendering…" : e === "ready" ? "Ready" : "Idle";
|
|
3132
|
+
}
|
|
3133
|
+
var Si = {
|
|
3125
3134
|
ready: "bg-success-soft text-success",
|
|
3126
3135
|
rendering: "bg-accent-soft text-accent",
|
|
3127
3136
|
empty: "bg-surface-muted text-fg-muted"
|
|
3128
3137
|
};
|
|
3129
|
-
function
|
|
3138
|
+
function Ci({ status: e, children: t }) {
|
|
3130
3139
|
return /* @__PURE__ */ x("span", {
|
|
3131
|
-
className: `inline-flex items-center gap-2 rounded-full px-3 py-1 text-2xs font-medium ${
|
|
3140
|
+
className: `inline-flex items-center gap-2 rounded-full px-3 py-1 text-2xs font-medium ${Si[e]}`,
|
|
3132
3141
|
children: [/* @__PURE__ */ b("span", {
|
|
3133
3142
|
className: "h-1.5 w-1.5 rounded-full bg-current opacity-60",
|
|
3134
3143
|
"aria-hidden": "true"
|
|
3135
3144
|
}), t]
|
|
3136
3145
|
});
|
|
3137
3146
|
}
|
|
3138
|
-
function
|
|
3139
|
-
|
|
3147
|
+
function wi({ active: e, onClick: t, children: n }) {
|
|
3148
|
+
return /* @__PURE__ */ b("button", {
|
|
3149
|
+
type: "button",
|
|
3150
|
+
role: "tab",
|
|
3151
|
+
className: `h-full m-0 cursor-pointer border-0 border-b-2 border-solid bg-transparent px-3 text-sm font-medium tracking-[0.02em] transition-colors hover:text-fg ${e ? "border-fg text-fg" : "border-transparent text-fg-muted"}`,
|
|
3152
|
+
"aria-selected": e,
|
|
3153
|
+
onClick: t,
|
|
3154
|
+
children: n
|
|
3155
|
+
});
|
|
3156
|
+
}
|
|
3157
|
+
function Ti({ pdfUrl: e, loading: t, emptyLabel: n = "Render the template to preview the PDF here.", loadingLabel: r = "Rendering the latest changes…" }) {
|
|
3158
|
+
return e ? /* @__PURE__ */ b("object", {
|
|
3159
|
+
data: e,
|
|
3160
|
+
type: "application/pdf",
|
|
3161
|
+
"data-theme": "light",
|
|
3162
|
+
className: "h-full w-full min-h-0 rounded-lg border border-solid border-border bg-page shadow-page max-[1080px]:h-[34rem]"
|
|
3163
|
+
}) : /* @__PURE__ */ b("div", {
|
|
3164
|
+
"data-theme": "light",
|
|
3165
|
+
className: "grid h-full place-items-center rounded-lg border border-dashed border-border-strong bg-page p-6 text-center text-sm text-fg-muted max-[1080px]:h-[34rem]",
|
|
3166
|
+
children: t ? r : n
|
|
3167
|
+
});
|
|
3168
|
+
}
|
|
3169
|
+
//#endregion
|
|
3170
|
+
//#region src/render/PdfPane.tsx
|
|
3171
|
+
function Ei({ pdfUrl: e, error: t, loading: n, template: r, data: i, className: a, onRender: o, renderDisabled: s }) {
|
|
3172
|
+
let [c, l] = v("pdf"), u = bi(n, e);
|
|
3140
3173
|
return /* @__PURE__ */ x("aside", {
|
|
3141
3174
|
className: `pdfua-template-builder grid min-w-0 min-h-0 grid-rows-[56px_auto_minmax(0,1fr)] bg-canvas${a ? ` ${a}` : ""}`,
|
|
3142
3175
|
"aria-label": "Output",
|
|
@@ -3148,27 +3181,27 @@ function xi({ pdfUrl: e, error: t, loading: n, template: r, data: i, className:
|
|
|
3148
3181
|
role: "tablist",
|
|
3149
3182
|
"aria-label": "Output view",
|
|
3150
3183
|
children: [
|
|
3151
|
-
/* @__PURE__ */ b(
|
|
3184
|
+
/* @__PURE__ */ b(wi, {
|
|
3152
3185
|
active: c === "pdf",
|
|
3153
3186
|
onClick: () => l("pdf"),
|
|
3154
3187
|
children: "PDF"
|
|
3155
3188
|
}),
|
|
3156
|
-
/* @__PURE__ */ b(
|
|
3189
|
+
/* @__PURE__ */ b(wi, {
|
|
3157
3190
|
active: c === "data",
|
|
3158
3191
|
onClick: () => l("data"),
|
|
3159
3192
|
children: "Data"
|
|
3160
3193
|
}),
|
|
3161
|
-
c === "data" ? /* @__PURE__ */ b(
|
|
3194
|
+
c === "data" ? /* @__PURE__ */ b(Oi, {
|
|
3162
3195
|
template: r,
|
|
3163
3196
|
data: i
|
|
3164
3197
|
}) : null
|
|
3165
3198
|
]
|
|
3166
3199
|
}), /* @__PURE__ */ x("div", {
|
|
3167
3200
|
className: "flex items-center gap-3",
|
|
3168
|
-
children: [/* @__PURE__ */ b(
|
|
3201
|
+
children: [/* @__PURE__ */ b(Ci, {
|
|
3169
3202
|
status: u,
|
|
3170
|
-
children:
|
|
3171
|
-
}), o ? /* @__PURE__ */ b(
|
|
3203
|
+
children: xi(u)
|
|
3204
|
+
}), o ? /* @__PURE__ */ b(Qt, {
|
|
3172
3205
|
variant: "primary",
|
|
3173
3206
|
onClick: o,
|
|
3174
3207
|
disabled: s,
|
|
@@ -3183,10 +3216,12 @@ function xi({ pdfUrl: e, error: t, loading: n, template: r, data: i, className:
|
|
|
3183
3216
|
}) : null,
|
|
3184
3217
|
/* @__PURE__ */ b("div", {
|
|
3185
3218
|
className: "row-start-3 grid min-h-0 p-4",
|
|
3186
|
-
children: c === "pdf" ? /* @__PURE__ */ b(
|
|
3219
|
+
children: c === "pdf" ? /* @__PURE__ */ b(Ti, {
|
|
3187
3220
|
pdfUrl: e,
|
|
3188
|
-
loading: n
|
|
3189
|
-
|
|
3221
|
+
loading: n,
|
|
3222
|
+
loadingLabel: "Rendering the latest template…",
|
|
3223
|
+
emptyLabel: "Render the template to preview the PDF here."
|
|
3224
|
+
}) : /* @__PURE__ */ b(Di, {
|
|
3190
3225
|
template: r,
|
|
3191
3226
|
data: i
|
|
3192
3227
|
})
|
|
@@ -3194,19 +3229,7 @@ function xi({ pdfUrl: e, error: t, loading: n, template: r, data: i, className:
|
|
|
3194
3229
|
]
|
|
3195
3230
|
});
|
|
3196
3231
|
}
|
|
3197
|
-
function
|
|
3198
|
-
return e ? /* @__PURE__ */ b("object", {
|
|
3199
|
-
data: e,
|
|
3200
|
-
type: "application/pdf",
|
|
3201
|
-
"data-theme": "light",
|
|
3202
|
-
className: "h-full w-full min-h-0 rounded-lg border border-solid border-border bg-page shadow-page max-[1080px]:h-[34rem]"
|
|
3203
|
-
}) : /* @__PURE__ */ b("div", {
|
|
3204
|
-
"data-theme": "light",
|
|
3205
|
-
className: "grid h-full place-items-center rounded-lg border border-dashed border-border-strong bg-page p-6 text-center text-sm text-fg-muted max-[1080px]:h-[34rem]",
|
|
3206
|
-
children: t ? "Rendering the latest template…" : "Render the template to preview the PDF here."
|
|
3207
|
-
});
|
|
3208
|
-
}
|
|
3209
|
-
function Ci({ template: e, data: t }) {
|
|
3232
|
+
function Di({ template: e, data: t }) {
|
|
3210
3233
|
return /* @__PURE__ */ b("pre", {
|
|
3211
3234
|
className: "h-full w-full min-h-0 rounded-lg border border-solid border-border bg-surface shadow-page m-0 overflow-auto p-4 font-mono text-sm leading-normal text-fg [tab-size:2] whitespace-pre max-[1080px]:h-[34rem]",
|
|
3212
3235
|
children: /* @__PURE__ */ b("code", { children: JSON.stringify({
|
|
@@ -3215,7 +3238,7 @@ function Ci({ template: e, data: t }) {
|
|
|
3215
3238
|
}, null, 2) })
|
|
3216
3239
|
});
|
|
3217
3240
|
}
|
|
3218
|
-
function
|
|
3241
|
+
function Oi({ template: e, data: t }) {
|
|
3219
3242
|
let [n, r] = v(!1);
|
|
3220
3243
|
function i() {
|
|
3221
3244
|
let n = JSON.stringify({
|
|
@@ -3235,9 +3258,9 @@ function wi({ template: e, data: t }) {
|
|
|
3235
3258
|
}
|
|
3236
3259
|
//#endregion
|
|
3237
3260
|
//#region src/render/Preview.tsx
|
|
3238
|
-
function
|
|
3239
|
-
let { template: t, data: n, pdfUrl: r, pdfLoading: i, error: a, renderPdf: o, renderDisabled: s } =
|
|
3240
|
-
return /* @__PURE__ */ b(
|
|
3261
|
+
function ki({ className: e } = {}) {
|
|
3262
|
+
let { template: t, data: n, pdfUrl: r, pdfLoading: i, error: a, renderPdf: o, renderDisabled: s } = ct();
|
|
3263
|
+
return /* @__PURE__ */ b(Ei, {
|
|
3241
3264
|
className: e,
|
|
3242
3265
|
pdfUrl: r,
|
|
3243
3266
|
error: a,
|
|
@@ -3250,23 +3273,23 @@ function Ti({ className: e } = {}) {
|
|
|
3250
3273
|
}
|
|
3251
3274
|
//#endregion
|
|
3252
3275
|
//#region src/builder/TemplateBuilder.tsx
|
|
3253
|
-
function
|
|
3276
|
+
function Ai({ examples: e, className: t }) {
|
|
3254
3277
|
return /* @__PURE__ */ x("main", {
|
|
3255
3278
|
className: `pdfua-template-builder grid h-screen overflow-hidden bg-app text-fg grid-cols-[minmax(40rem,1.55fr)_minmax(28rem,0.95fr)] max-[1080px]:h-auto max-[1080px]:grid-cols-1 max-[1080px]:overflow-visible${t ? ` ${t}` : ""}`,
|
|
3256
|
-
children: [/* @__PURE__ */ b(
|
|
3279
|
+
children: [/* @__PURE__ */ b(yi, {
|
|
3257
3280
|
examples: e,
|
|
3258
3281
|
className: "border-0 border-r border-solid border-border"
|
|
3259
|
-
}), /* @__PURE__ */ b(
|
|
3282
|
+
}), /* @__PURE__ */ b(ki, {})]
|
|
3260
3283
|
});
|
|
3261
3284
|
}
|
|
3262
|
-
function
|
|
3263
|
-
return /* @__PURE__ */ b(
|
|
3285
|
+
function ji({ apiUrl: e, initialTemplate: t, initialData: n, examples: r, onChange: i, onRendered: a, className: o } = {}) {
|
|
3286
|
+
return /* @__PURE__ */ b(Nt, {
|
|
3264
3287
|
apiUrl: e,
|
|
3265
3288
|
initialTemplate: t,
|
|
3266
3289
|
initialData: n,
|
|
3267
3290
|
onChange: i,
|
|
3268
3291
|
onRendered: a,
|
|
3269
|
-
children: /* @__PURE__ */ b(
|
|
3292
|
+
children: /* @__PURE__ */ b(Ai, {
|
|
3270
3293
|
examples: r,
|
|
3271
3294
|
className: o
|
|
3272
3295
|
})
|
|
@@ -3274,8 +3297,8 @@ function Di({ apiUrl: e, initialTemplate: t, initialData: n, examples: r, onChan
|
|
|
3274
3297
|
}
|
|
3275
3298
|
//#endregion
|
|
3276
3299
|
//#region src/builder/schema/invoiceExample.ts
|
|
3277
|
-
var
|
|
3278
|
-
function
|
|
3300
|
+
var Mi = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNjAiIGhlaWdodD0iNzIiIHZpZXdCb3g9IjAgMCAyNjAgNzIiPjx0ZXh0IHg9IjAiIHk9IjQyIiBmaWxsPSIjMTExODI3IiBmb250LWZhbWlseT0iQXJpYWwsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMzAiIGZvbnQtd2VpZ2h0PSI3MDAiPlBERiBVQSBLaXQ8L3RleHQ+PC9zdmc+";
|
|
3301
|
+
function Ni() {
|
|
3279
3302
|
return {
|
|
3280
3303
|
template: {
|
|
3281
3304
|
version: 1,
|
|
@@ -3333,7 +3356,7 @@ function ki() {
|
|
|
3333
3356
|
{ blocks: [{
|
|
3334
3357
|
type: "image",
|
|
3335
3358
|
id: "logo",
|
|
3336
|
-
src:
|
|
3359
|
+
src: Mi,
|
|
3337
3360
|
alt: "PDF UA Kit GmbH logo",
|
|
3338
3361
|
config: {
|
|
3339
3362
|
width: "58%",
|
|
@@ -3633,7 +3656,7 @@ function ki() {
|
|
|
3633
3656
|
}
|
|
3634
3657
|
//#endregion
|
|
3635
3658
|
//#region src/editor/parseTemplate.ts
|
|
3636
|
-
function
|
|
3659
|
+
function Pi(e) {
|
|
3637
3660
|
if (e.trim() === "") return {
|
|
3638
3661
|
template: null,
|
|
3639
3662
|
error: null
|
|
@@ -3657,14 +3680,14 @@ function Ai(e) {
|
|
|
3657
3680
|
}
|
|
3658
3681
|
//#endregion
|
|
3659
3682
|
//#region src/editor/TemplateEditorContext.tsx
|
|
3660
|
-
var
|
|
3661
|
-
function
|
|
3662
|
-
let e = p(
|
|
3683
|
+
var Fi = { version: 1 }, Ii = {}, Li = u(null);
|
|
3684
|
+
function Ri() {
|
|
3685
|
+
let e = p(Li);
|
|
3663
3686
|
if (!e) throw Error("useTemplateEditor must be used within a <TemplateEditorProvider>.");
|
|
3664
3687
|
return e;
|
|
3665
3688
|
}
|
|
3666
|
-
function
|
|
3667
|
-
let o =
|
|
3689
|
+
function zi({ apiUrl: e, initialTemplate: t, data: n = Ii, onChange: r, onRendered: i, children: a }) {
|
|
3690
|
+
let o = ae(e), [s, c] = v(() => JSON.stringify(t ?? Fi, null, 2)), { template: l, error: u } = h(() => Pi(s), [s]), d = _(r);
|
|
3668
3691
|
m(() => {
|
|
3669
3692
|
d.current = r;
|
|
3670
3693
|
}, [r]);
|
|
@@ -3676,7 +3699,7 @@ function Fi({ apiUrl: e, initialTemplate: t, data: n = Mi, onChange: r, onRender
|
|
|
3676
3699
|
}
|
|
3677
3700
|
d.current?.(l, s);
|
|
3678
3701
|
}, [s, l]);
|
|
3679
|
-
let { pdfUrl: g, pdfLoading: y, error: x, renderPdf: S } =
|
|
3702
|
+
let { pdfUrl: g, pdfLoading: y, error: x, renderPdf: S } = rt({
|
|
3680
3703
|
initialApiUrl: o,
|
|
3681
3704
|
apiUrl: o,
|
|
3682
3705
|
onRendered: i,
|
|
@@ -3714,15 +3737,15 @@ function Fi({ apiUrl: e, initialTemplate: t, data: n = Mi, onChange: r, onRender
|
|
|
3714
3737
|
x,
|
|
3715
3738
|
T
|
|
3716
3739
|
]);
|
|
3717
|
-
return /* @__PURE__ */ b(
|
|
3740
|
+
return /* @__PURE__ */ b(Li.Provider, {
|
|
3718
3741
|
value: E,
|
|
3719
|
-
children: /* @__PURE__ */ b(
|
|
3742
|
+
children: /* @__PURE__ */ b(st, {
|
|
3720
3743
|
value: D,
|
|
3721
3744
|
children: a
|
|
3722
3745
|
})
|
|
3723
3746
|
});
|
|
3724
3747
|
}
|
|
3725
|
-
var
|
|
3748
|
+
var Bi = [re.theme({
|
|
3726
3749
|
"&": {
|
|
3727
3750
|
color: "var(--pdfua-fg)",
|
|
3728
3751
|
backgroundColor: "var(--pdfua-surface)",
|
|
@@ -3764,7 +3787,7 @@ var Ii = [re.theme({
|
|
|
3764
3787
|
tag: [A.punctuation, A.separator],
|
|
3765
3788
|
color: "var(--pdfua-fg-muted)"
|
|
3766
3789
|
}
|
|
3767
|
-
]))],
|
|
3790
|
+
]))], Vi = {
|
|
3768
3791
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
3769
3792
|
$id: "https://pdf-ua-api.com/schemas/template-v1.json",
|
|
3770
3793
|
title: "Template",
|
|
@@ -3888,11 +3911,11 @@ var Ii = [re.theme({
|
|
|
3888
3911
|
};
|
|
3889
3912
|
//#endregion
|
|
3890
3913
|
//#region src/editor/CodeEditor.tsx
|
|
3891
|
-
function
|
|
3892
|
-
let { text: t, setText: n } =
|
|
3914
|
+
function Hi({ className: e } = {}) {
|
|
3915
|
+
let { text: t, setText: n } = Ri(), r = h(() => [
|
|
3893
3916
|
ee(),
|
|
3894
|
-
ne(
|
|
3895
|
-
...
|
|
3917
|
+
ne(Vi),
|
|
3918
|
+
...Bi
|
|
3896
3919
|
], []);
|
|
3897
3920
|
return /* @__PURE__ */ b("div", {
|
|
3898
3921
|
className: `pdfua-template-builder min-w-0 min-h-0 overflow-auto bg-surface${e ? ` ${e}` : ""}`,
|
|
@@ -3913,23 +3936,196 @@ function Ri({ className: e } = {}) {
|
|
|
3913
3936
|
}
|
|
3914
3937
|
//#endregion
|
|
3915
3938
|
//#region src/editor/TemplateEditor.tsx
|
|
3916
|
-
function
|
|
3939
|
+
function Ui({ className: e }) {
|
|
3917
3940
|
return /* @__PURE__ */ x("main", {
|
|
3918
3941
|
className: `pdfua-template-builder grid h-screen overflow-hidden bg-app text-fg grid-cols-[minmax(40rem,1.55fr)_minmax(28rem,0.95fr)] max-[1080px]:h-auto max-[1080px]:grid-cols-1 max-[1080px]:overflow-visible${e ? ` ${e}` : ""}`,
|
|
3919
|
-
children: [/* @__PURE__ */ b(
|
|
3942
|
+
children: [/* @__PURE__ */ b(Hi, { className: "border-0 border-r border-solid border-border" }), /* @__PURE__ */ b(ki, {})]
|
|
3920
3943
|
});
|
|
3921
3944
|
}
|
|
3922
|
-
function
|
|
3923
|
-
return /* @__PURE__ */ b(
|
|
3945
|
+
function Wi({ apiUrl: e, initialTemplate: t, data: n, onChange: r, onRendered: i, className: a } = {}) {
|
|
3946
|
+
return /* @__PURE__ */ b(zi, {
|
|
3924
3947
|
apiUrl: e,
|
|
3925
3948
|
initialTemplate: t,
|
|
3926
3949
|
data: n,
|
|
3927
3950
|
onChange: r,
|
|
3928
3951
|
onRendered: i,
|
|
3929
|
-
children: /* @__PURE__ */ b(
|
|
3952
|
+
children: /* @__PURE__ */ b(Ui, { className: a })
|
|
3953
|
+
});
|
|
3954
|
+
}
|
|
3955
|
+
//#endregion
|
|
3956
|
+
//#region src/html-editor/defaultHtml.ts
|
|
3957
|
+
var Gi = "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Untitled document</title>\n <style>\n body {\n font-family: system-ui, sans-serif;\n margin: 2rem;\n color: #1a1a1a;\n line-height: 1.5;\n }\n h1 {\n font-size: 1.75rem;\n margin-bottom: 0.5rem;\n }\n </style>\n </head>\n <body>\n <h1>Hello, PDF/UA</h1>\n <p>Edit this HTML and render it to preview the accessible PDF.</p>\n </body>\n</html>\n";
|
|
3958
|
+
//#endregion
|
|
3959
|
+
//#region src/html-editor/useHtmlPreview.ts
|
|
3960
|
+
function Ki({ apiUrl: e, baseUrl: t, onRendered: n }) {
|
|
3961
|
+
let [r, i] = v(null), [a, o] = v(!1), [s, c] = v(null), l = _(0), u = _(null), d = _(n);
|
|
3962
|
+
return m(() => {
|
|
3963
|
+
d.current = n;
|
|
3964
|
+
}, [n]), m(() => () => {
|
|
3965
|
+
qi(u.current), u.current = null;
|
|
3966
|
+
}, []), {
|
|
3967
|
+
pdfUrl: r,
|
|
3968
|
+
loading: a,
|
|
3969
|
+
error: s,
|
|
3970
|
+
render: f(async (n) => {
|
|
3971
|
+
let r = l.current + 1;
|
|
3972
|
+
l.current = r, o(!0), c(null);
|
|
3973
|
+
try {
|
|
3974
|
+
let a = await ue(e, {
|
|
3975
|
+
html: n,
|
|
3976
|
+
baseUrl: t
|
|
3977
|
+
}), o = URL.createObjectURL(a);
|
|
3978
|
+
if (r !== l.current) {
|
|
3979
|
+
qi(o);
|
|
3980
|
+
return;
|
|
3981
|
+
}
|
|
3982
|
+
i((e) => (qi(e), u.current = o, o)), d.current?.(a);
|
|
3983
|
+
} catch (e) {
|
|
3984
|
+
r === l.current && c(Ji(e));
|
|
3985
|
+
} finally {
|
|
3986
|
+
r === l.current && o(!1);
|
|
3987
|
+
}
|
|
3988
|
+
}, [e, t])
|
|
3989
|
+
};
|
|
3990
|
+
}
|
|
3991
|
+
function qi(e) {
|
|
3992
|
+
e && URL.revokeObjectURL(e);
|
|
3993
|
+
}
|
|
3994
|
+
function Ji(e) {
|
|
3995
|
+
return e instanceof Error ? e.message : String(e);
|
|
3996
|
+
}
|
|
3997
|
+
//#endregion
|
|
3998
|
+
//#region src/html-editor/HtmlEditorContext.tsx
|
|
3999
|
+
var Yi = u(null);
|
|
4000
|
+
function Xi() {
|
|
4001
|
+
let e = p(Yi);
|
|
4002
|
+
if (!e) throw Error("useHtmlEditor must be used within an <HtmlEditorProvider>.");
|
|
4003
|
+
return e;
|
|
4004
|
+
}
|
|
4005
|
+
function Zi({ apiUrl: e, baseUrl: t, initialHtml: n = Gi, onChange: r, onRendered: i, children: a }) {
|
|
4006
|
+
let o = ae(e), [s, c] = v(n), l = _(r);
|
|
4007
|
+
m(() => {
|
|
4008
|
+
l.current = r;
|
|
4009
|
+
}, [r]);
|
|
4010
|
+
let u = _(!0);
|
|
4011
|
+
m(() => {
|
|
4012
|
+
if (u.current) {
|
|
4013
|
+
u.current = !1;
|
|
4014
|
+
return;
|
|
4015
|
+
}
|
|
4016
|
+
l.current?.(s);
|
|
4017
|
+
}, [s]);
|
|
4018
|
+
let { pdfUrl: d, loading: p, error: g, render: y } = Ki({
|
|
4019
|
+
apiUrl: o,
|
|
4020
|
+
baseUrl: t,
|
|
4021
|
+
onRendered: i
|
|
4022
|
+
}), x = _(s);
|
|
4023
|
+
x.current = s;
|
|
4024
|
+
let S = f(() => {
|
|
4025
|
+
x.current.trim() !== "" && y(x.current);
|
|
4026
|
+
}, [y]), C = h(() => ({
|
|
4027
|
+
html: s,
|
|
4028
|
+
setHtml: c,
|
|
4029
|
+
pdfUrl: d,
|
|
4030
|
+
pdfLoading: p,
|
|
4031
|
+
error: g,
|
|
4032
|
+
renderPdf: S,
|
|
4033
|
+
renderDisabled: s.trim() === "" || p
|
|
4034
|
+
}), [
|
|
4035
|
+
s,
|
|
4036
|
+
d,
|
|
4037
|
+
p,
|
|
4038
|
+
g,
|
|
4039
|
+
S
|
|
4040
|
+
]);
|
|
4041
|
+
return /* @__PURE__ */ b(Yi.Provider, {
|
|
4042
|
+
value: C,
|
|
4043
|
+
children: a
|
|
4044
|
+
});
|
|
4045
|
+
}
|
|
4046
|
+
//#endregion
|
|
4047
|
+
//#region src/html-editor/HtmlCodeEditor.tsx
|
|
4048
|
+
function Qi({ className: e } = {}) {
|
|
4049
|
+
let { html: t, setHtml: n } = Xi(), r = h(() => [ie(), ...Bi], []);
|
|
4050
|
+
return /* @__PURE__ */ b("div", {
|
|
4051
|
+
className: `pdfua-template-builder min-w-0 min-h-0 overflow-auto bg-surface${e ? ` ${e}` : ""}`,
|
|
4052
|
+
"aria-label": "Template HTML editor",
|
|
4053
|
+
children: /* @__PURE__ */ b(te, {
|
|
4054
|
+
value: t,
|
|
4055
|
+
onChange: n,
|
|
4056
|
+
extensions: r,
|
|
4057
|
+
theme: "none",
|
|
4058
|
+
height: "100%",
|
|
4059
|
+
basicSetup: {
|
|
4060
|
+
foldGutter: !0,
|
|
4061
|
+
highlightActiveLine: !0,
|
|
4062
|
+
autocompletion: !0
|
|
4063
|
+
}
|
|
4064
|
+
})
|
|
4065
|
+
});
|
|
4066
|
+
}
|
|
4067
|
+
//#endregion
|
|
4068
|
+
//#region src/html-editor/HtmlPreview.tsx
|
|
4069
|
+
function $i({ className: e } = {}) {
|
|
4070
|
+
let { pdfUrl: t, pdfLoading: n, error: r, renderPdf: i, renderDisabled: a } = Xi(), o = bi(n, t);
|
|
4071
|
+
return /* @__PURE__ */ x("aside", {
|
|
4072
|
+
className: `pdfua-template-builder grid min-w-0 min-h-0 grid-rows-[56px_auto_minmax(0,1fr)] bg-canvas${e ? ` ${e}` : ""}`,
|
|
4073
|
+
"aria-label": "Output",
|
|
4074
|
+
children: [
|
|
4075
|
+
/* @__PURE__ */ x("header", {
|
|
4076
|
+
className: "row-start-1 flex items-center justify-between gap-3 border-0 border-b border-solid border-border bg-surface px-4",
|
|
4077
|
+
children: [/* @__PURE__ */ b("span", {
|
|
4078
|
+
className: "text-sm font-medium tracking-[0.02em] text-fg",
|
|
4079
|
+
children: "PDF preview"
|
|
4080
|
+
}), /* @__PURE__ */ x("div", {
|
|
4081
|
+
className: "flex items-center gap-3",
|
|
4082
|
+
children: [/* @__PURE__ */ b(Ci, {
|
|
4083
|
+
status: o,
|
|
4084
|
+
children: xi(o)
|
|
4085
|
+
}), /* @__PURE__ */ b(Qt, {
|
|
4086
|
+
variant: "primary",
|
|
4087
|
+
onClick: i,
|
|
4088
|
+
disabled: a,
|
|
4089
|
+
children: n ? "Rendering…" : "Render PDF"
|
|
4090
|
+
})]
|
|
4091
|
+
})]
|
|
4092
|
+
}),
|
|
4093
|
+
r ? /* @__PURE__ */ b("p", {
|
|
4094
|
+
className: "row-start-2 mx-4 mt-3 mb-0 rounded border-0 border-l-[3px] border-solid border-danger bg-danger-soft px-3 py-3 text-sm text-danger",
|
|
4095
|
+
role: "alert",
|
|
4096
|
+
children: r
|
|
4097
|
+
}) : null,
|
|
4098
|
+
/* @__PURE__ */ b("div", {
|
|
4099
|
+
className: "row-start-3 grid min-h-0 p-4",
|
|
4100
|
+
children: /* @__PURE__ */ b(Ti, {
|
|
4101
|
+
pdfUrl: t,
|
|
4102
|
+
loading: n,
|
|
4103
|
+
loadingLabel: "Rendering the latest HTML…",
|
|
4104
|
+
emptyLabel: "Render the HTML to preview the PDF here."
|
|
4105
|
+
})
|
|
4106
|
+
})
|
|
4107
|
+
]
|
|
4108
|
+
});
|
|
4109
|
+
}
|
|
4110
|
+
//#endregion
|
|
4111
|
+
//#region src/html-editor/HtmlEditor.tsx
|
|
4112
|
+
function ea({ className: e }) {
|
|
4113
|
+
return /* @__PURE__ */ x("main", {
|
|
4114
|
+
className: `pdfua-template-builder grid h-screen overflow-hidden bg-app text-fg grid-cols-[minmax(40rem,1.55fr)_minmax(28rem,0.95fr)] max-[1080px]:h-auto max-[1080px]:grid-cols-1 max-[1080px]:overflow-visible${e ? ` ${e}` : ""}`,
|
|
4115
|
+
children: [/* @__PURE__ */ b(Qi, { className: "border-0 border-r border-solid border-border" }), /* @__PURE__ */ b($i, {})]
|
|
4116
|
+
});
|
|
4117
|
+
}
|
|
4118
|
+
function ta({ apiUrl: e, baseUrl: t, initialHtml: n, onChange: r, onRendered: i, className: a } = {}) {
|
|
4119
|
+
return /* @__PURE__ */ b(Zi, {
|
|
4120
|
+
apiUrl: e,
|
|
4121
|
+
baseUrl: t,
|
|
4122
|
+
initialHtml: n,
|
|
4123
|
+
onChange: r,
|
|
4124
|
+
onRendered: i,
|
|
4125
|
+
children: /* @__PURE__ */ b(ea, { className: a })
|
|
3930
4126
|
});
|
|
3931
4127
|
}
|
|
3932
4128
|
//#endregion
|
|
3933
|
-
export {
|
|
4129
|
+
export { yi as Builder, Hi as CodeEditor, Qi as HtmlCodeEditor, ta as HtmlEditor, Zi as HtmlEditorProvider, $i as HtmlPreview, cn as PAGE_SIZES_MM, ki as Preview, ji as TemplateBuilder, Nt as TemplateBuilderProvider, Wi as TemplateEditor, zi as TemplateEditorProvider, we as createEditorModel, Ni as createInvoiceExample, ce as fetchTemplateSchema, Le as getFooterRepeat, ze as getPageNumbers, Ne as getPageSize, sn as mmToPx, ln as pageSizeForFormat, ue as renderHtmlPdf, le as renderTemplatePdf, ae as resolveDefaultApiUrl, Te as serializeTemplate, Re as setFooterRepeat, Be as setPageNumbers, Pe as setPageSize, Xi as useHtmlEditor, Mt as useTemplateBuilder, Ri as useTemplateEditor };
|
|
3934
4130
|
|
|
3935
4131
|
//# sourceMappingURL=index.js.map
|