brick-pdf 0.3.0 → 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/brick-pdf.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as _, openBlock as s, createElementBlock as d, normalizeStyle as N, toDisplayString as w, renderSlot as Z, normalizeClass as ee, createElementVNode as m, Fragment as C, renderList as P, reactive as ze, provide as D, inject as L, toRaw as J, ref as E, computed as I, createTextVNode as ie, createCommentVNode as $, createBlock as M, resolveDynamicComponent as te, withCtx as j, onMounted as me, onBeforeUnmount as ye, unref as k, resolveComponent as Te, withDirectives as K, vModelSelect as se, createVNode as B, vModelText as De, watch as Le } from "vue";
1
+ import { defineComponent as _, openBlock as a, createElementBlock as c, normalizeStyle as N, toDisplayString as w, renderSlot as Z, normalizeClass as ee, createElementVNode as m, Fragment as C, renderList as P, reactive as ze, provide as D, inject as L, toRaw as J, ref as E, computed as I, createTextVNode as ie, createCommentVNode as $, createBlock as M, resolveDynamicComponent as te, withCtx as Y, onMounted as ye, onBeforeUnmount as me, unref as k, resolveComponent as Te, withDirectives as X, vModelSelect as se, createVNode as B, vModelText as De, watch as Le } from "vue";
2
2
  import { useMagicKeys as Me, whenever as ae } from "@vueuse/core";
3
3
  import ce from "sortablejs";
4
4
  function ne() {
@@ -14,18 +14,18 @@ function ne() {
14
14
  content: []
15
15
  };
16
16
  }
17
- const Y = /* @__PURE__ */ new Map();
17
+ const q = /* @__PURE__ */ new Map();
18
18
  function z(e) {
19
- Y.set(e.type, e);
19
+ q.set(e.type, e);
20
20
  }
21
21
  function U(e) {
22
- return Y.get(e);
22
+ return q.get(e);
23
23
  }
24
24
  function Be() {
25
- return Array.from(Y.values());
25
+ return Array.from(q.values());
26
26
  }
27
- function rr(e) {
28
- return Y.delete(e);
27
+ function ir(e) {
28
+ return q.delete(e);
29
29
  }
30
30
  function Oe() {
31
31
  return { text: "New Text" };
@@ -37,13 +37,13 @@ function Ve(e) {
37
37
  const t = { text: e.props.text }, n = e.style;
38
38
  return n.fontSize && (t.fontSize = n.fontSize), n.bold && (t.bold = n.bold), n.italics && (t.italics = n.italics), n.color && (t.color = n.color), n.alignment && (t.alignment = n.alignment), n.margin && (t.margin = n.margin), n.font && (t.font = n.font), n.lineHeight && (t.lineHeight = n.lineHeight), n.characterSpacing && (t.characterSpacing = n.characterSpacing), n.decoration && (t.decoration = n.decoration), n.decorationStyle && (t.decorationStyle = n.decorationStyle), n.decorationColor && (t.decorationColor = n.decorationColor), n.background && (t.background = n.background), n.link && (t.link = n.link), n.opacity !== void 0 && (t.opacity = n.opacity), t;
39
39
  }
40
- const He = /* @__PURE__ */ _({
40
+ const Fe = /* @__PURE__ */ _({
41
41
  __name: "TextRenderer",
42
42
  props: {
43
43
  node: {}
44
44
  },
45
45
  setup(e) {
46
- return (t, n) => (s(), d("div", {
46
+ return (t, n) => (a(), c("div", {
47
47
  class: "brick-el-text",
48
48
  style: N({
49
49
  fontSize: (e.node.style.fontSize ?? 12) + "px",
@@ -60,16 +60,16 @@ const He = /* @__PURE__ */ _({
60
60
  }
61
61
  }), x = (e, t) => {
62
62
  const n = e.__vccOpts || e;
63
- for (const [l, a] of t)
64
- n[l] = a;
63
+ for (const [i, s] of t)
64
+ n[i] = s;
65
65
  return n;
66
- }, Fe = /* @__PURE__ */ x(He, [["__scopeId", "data-v-a7cd1565"]]), Je = { class: "brick-text-editor" }, Ue = /* @__PURE__ */ _({
66
+ }, He = /* @__PURE__ */ x(Fe, [["__scopeId", "data-v-a7cd1565"]]), Je = { class: "brick-text-editor" }, Ue = /* @__PURE__ */ _({
67
67
  __name: "TextPropertyEditor",
68
68
  props: {
69
69
  node: {}
70
70
  },
71
71
  setup(e) {
72
- return (t, n) => (s(), d("div", Je));
72
+ return (t, n) => (a(), c("div", Je));
73
73
  }
74
74
  }), We = {
75
75
  type: "text",
@@ -78,7 +78,7 @@ const He = /* @__PURE__ */ _({
78
78
  isContainer: !1,
79
79
  defaultProps: Oe,
80
80
  defaultStyle: Ae,
81
- rendererComponent: Fe,
81
+ rendererComponent: He,
82
82
  propertyEditorComponent: Ue,
83
83
  propertyFields: [
84
84
  { key: "props.text", label: "Text Content", section: "content", type: "textarea", defaultValue: "New Text" },
@@ -118,27 +118,27 @@ function qe(e, t) {
118
118
  };
119
119
  return e.style.margin && (n.margin = e.style.margin), e.style.fillColor && (n.fillColor = e.style.fillColor), n;
120
120
  }
121
- const Ge = /* @__PURE__ */ _({
121
+ const Ke = /* @__PURE__ */ _({
122
122
  __name: "StackRenderer",
123
123
  props: {
124
124
  node: {},
125
125
  path: {}
126
126
  },
127
127
  setup(e) {
128
- return (t, n) => (s(), d("div", {
128
+ return (t, n) => (a(), c("div", {
129
129
  class: "brick-el-stack",
130
130
  style: N({ backgroundColor: e.node.style.fillColor })
131
131
  }, [
132
132
  Z(t.$slots, "default", {}, void 0, !0)
133
133
  ], 4));
134
134
  }
135
- }), Xe = /* @__PURE__ */ x(Ge, [["__scopeId", "data-v-c59e7405"]]), Ke = { class: "brick-stack-editor" }, Qe = /* @__PURE__ */ _({
135
+ }), Ge = /* @__PURE__ */ x(Ke, [["__scopeId", "data-v-c59e7405"]]), Xe = { class: "brick-stack-editor" }, Qe = /* @__PURE__ */ _({
136
136
  __name: "StackPropertyEditor",
137
137
  props: {
138
138
  node: {}
139
139
  },
140
140
  setup(e) {
141
- return (t, n) => (s(), d("div", Ke));
141
+ return (t, n) => (a(), c("div", Xe));
142
142
  }
143
143
  }), Ze = {
144
144
  type: "stack",
@@ -148,7 +148,7 @@ const Ge = /* @__PURE__ */ _({
148
148
  acceptsChildTypes: null,
149
149
  defaultProps: je,
150
150
  defaultStyle: Ye,
151
- rendererComponent: Xe,
151
+ rendererComponent: Ge,
152
152
  propertyEditorComponent: Qe,
153
153
  propertyFields: [
154
154
  { key: "style.fillColor", label: "Fill Color", section: "style", type: "color" },
@@ -176,7 +176,7 @@ const ot = /* @__PURE__ */ _({
176
176
  path: {}
177
177
  },
178
178
  setup(e) {
179
- return (t, n) => (s(), d("div", {
179
+ return (t, n) => (a(), c("div", {
180
180
  class: "brick-el-columns",
181
181
  style: N({ "--column-gap": (e.node.props.columnGap ?? 10) + "px" })
182
182
  }, [
@@ -189,7 +189,7 @@ const ot = /* @__PURE__ */ _({
189
189
  node: {}
190
190
  },
191
191
  setup(e) {
192
- return (t, n) => (s(), d("div", lt));
192
+ return (t, n) => (a(), c("div", lt));
193
193
  }
194
194
  }), st = {
195
195
  type: "columns",
@@ -227,11 +227,11 @@ function dt(e) {
227
227
  headerRows: e.props.headerRows,
228
228
  widths: e.props.widths,
229
229
  body: t.map(
230
- (a) => a.map((o) => ({ text: o }))
230
+ (s) => s.map((o) => ({ text: o }))
231
231
  )
232
232
  }
233
- }, l = e.props.layout;
234
- return l && l !== "none" && (n.layout = l), e.style.fontSize && (n.fontSize = e.style.fontSize), e.style.color && (n.color = e.style.color), e.style.margin && (n.margin = e.style.margin), n;
233
+ }, i = e.props.layout;
234
+ return i && i !== "none" && (n.layout = i), e.style.fontSize && (n.fontSize = e.style.fontSize), e.style.color && (n.color = e.style.color), e.style.margin && (n.margin = e.style.margin), n;
235
235
  }
236
236
  const ut = /* @__PURE__ */ _({
237
237
  __name: "TableRenderer",
@@ -239,23 +239,23 @@ const ut = /* @__PURE__ */ _({
239
239
  node: {}
240
240
  },
241
241
  setup(e) {
242
- return (t, n) => (s(), d("div", {
242
+ return (t, n) => (a(), c("div", {
243
243
  class: ee(["brick-el-table", "brick-el-table--" + (e.node.props.layout ?? "lightHorizontalLines")]),
244
244
  style: N({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
245
245
  }, [
246
246
  m("table", null, [
247
247
  m("thead", null, [
248
- (s(!0), d(C, null, P(e.node.props.body.slice(0, e.node.props.headerRows), (l, a) => (s(), d("tr", {
249
- key: "h" + a
248
+ (a(!0), c(C, null, P(e.node.props.body.slice(0, e.node.props.headerRows), (i, s) => (a(), c("tr", {
249
+ key: "h" + s
250
250
  }, [
251
- (s(!0), d(C, null, P(l, (o, u) => (s(), d("th", { key: u }, w(o), 1))), 128))
251
+ (a(!0), c(C, null, P(i, (o, p) => (a(), c("th", { key: p }, w(o), 1))), 128))
252
252
  ]))), 128))
253
253
  ]),
254
254
  m("tbody", null, [
255
- (s(!0), d(C, null, P(e.node.props.body.slice(e.node.props.headerRows), (l, a) => (s(), d("tr", {
256
- key: "b" + a
255
+ (a(!0), c(C, null, P(e.node.props.body.slice(e.node.props.headerRows), (i, s) => (a(), c("tr", {
256
+ key: "b" + s
257
257
  }, [
258
- (s(!0), d(C, null, P(l, (o, u) => (s(), d("td", { key: u }, w(o), 1))), 128))
258
+ (a(!0), c(C, null, P(i, (o, p) => (a(), c("td", { key: p }, w(o), 1))), 128))
259
259
  ]))), 128))
260
260
  ])
261
261
  ])
@@ -280,40 +280,40 @@ function Q(e) {
280
280
  }
281
281
  function ft(e) {
282
282
  const t = e ? de(e) : ne();
283
- for (const c of t.content) Q(c);
283
+ for (const d of t.content) Q(d);
284
284
  const n = ze(t);
285
- function l(c, r) {
286
- const i = r ?? n.content;
287
- for (let y = 0; y < i.length; y++) {
288
- const g = i[y];
289
- if (g) {
290
- if (g.id === c)
291
- return { node: g, parent: i, index: y };
292
- if (g.children.length > 0) {
293
- const f = l(c, g.children);
294
- if (f) return f;
285
+ function i(d, r) {
286
+ const l = r ?? n.content;
287
+ for (let u = 0; u < l.length; u++) {
288
+ const b = l[u];
289
+ if (b) {
290
+ if (b.id === d)
291
+ return { node: b, parent: l, index: u };
292
+ if (b.children.length > 0) {
293
+ const y = i(d, b.children);
294
+ if (y) return y;
295
295
  }
296
296
  }
297
297
  }
298
298
  return null;
299
299
  }
300
- function a(c) {
301
- n.content.splice(0, n.content.length, ...c);
300
+ function s(d) {
301
+ n.content.splice(0, n.content.length, ...d);
302
302
  }
303
303
  function o() {
304
304
  return JSON.parse(JSON.stringify(J(n.content)));
305
305
  }
306
- function u(c) {
307
- const r = de(c);
308
- for (const i of r.content) Q(i);
306
+ function p(d) {
307
+ const r = de(d);
308
+ for (const l of r.content) Q(l);
309
309
  n.pageSize = r.pageSize, n.pageOrientation = r.pageOrientation, n.pageMargins = r.pageMargins, n.defaultStyle = r.defaultStyle, n.styles = r.styles, n.content.splice(0, n.content.length, ...r.content);
310
310
  }
311
- function p() {
311
+ function f() {
312
312
  return JSON.parse(JSON.stringify(J(n)));
313
313
  }
314
- return { document: n, findNodeById: l, replaceContent: a, snapshotContent: o, loadDocument: u, exportDocument: p };
314
+ return { document: n, findNodeById: i, replaceContent: s, snapshotContent: o, loadDocument: p, exportDocument: f };
315
315
  }
316
- function mt(e) {
316
+ function yt(e) {
317
317
  D(ge, e);
318
318
  }
319
319
  function oe() {
@@ -323,15 +323,15 @@ function oe() {
323
323
  return e;
324
324
  }
325
325
  const be = /* @__PURE__ */ Symbol("brick-pdf-selection");
326
- function yt(e) {
326
+ function mt(e) {
327
327
  const t = E(null), n = I(() => t.value ? e.findNodeById(t.value)?.node ?? null : null);
328
- function l(o) {
328
+ function i(o) {
329
329
  t.value = o;
330
330
  }
331
- function a() {
331
+ function s() {
332
332
  t.value = null;
333
333
  }
334
- return { selectedId: t, selectedNode: n, select: l, deselect: a };
334
+ return { selectedId: t, selectedNode: n, select: i, deselect: s };
335
335
  }
336
336
  function gt(e) {
337
337
  D(be, e);
@@ -357,55 +357,59 @@ function _e(e) {
357
357
  };
358
358
  }
359
359
  function vt(e, t) {
360
- function n(c, r, i) {
361
- const y = U(c);
362
- if (!y) return null;
360
+ function n(r, l, u) {
361
+ const b = U(r);
362
+ if (!b) return null;
363
363
  t.record();
364
- const g = {
364
+ const y = {
365
365
  id: he(),
366
- type: c,
367
- props: y.defaultProps(),
368
- style: y.defaultStyle(),
366
+ type: r,
367
+ props: b.defaultProps(),
368
+ style: b.defaultStyle(),
369
369
  children: []
370
- }, f = r ? e.findNodeById(r)?.node.children : e.document.content;
371
- if (!f) return null;
372
- const b = i ?? f.length;
373
- return f.splice(b, 0, g), g;
370
+ }, g = l ? e.findNodeById(l)?.node.children : e.document.content;
371
+ if (!g) return null;
372
+ const v = u ?? g.length;
373
+ return g.splice(v, 0, y), y;
374
374
  }
375
- function l(c) {
376
- const r = e.findNodeById(c);
377
- r && (t.record(), r.parent.splice(r.index, 1));
375
+ function i(r) {
376
+ const l = e.findNodeById(r);
377
+ l && (t.record(), l.parent.splice(l.index, 1));
378
378
  }
379
- function a(c, r, i) {
380
- const y = e.findNodeById(c);
381
- if (!y) return;
379
+ function s(r, l, u) {
380
+ const b = e.findNodeById(r);
381
+ if (!b) return;
382
382
  t.record();
383
- const g = y.parent.splice(y.index, 1)[0];
384
- if (!g) return;
385
- const f = r ? e.findNodeById(r)?.node.children : e.document.content;
386
- f && f.splice(i, 0, g);
383
+ const y = b.parent.splice(b.index, 1)[0];
384
+ if (!y) return;
385
+ const g = l ? e.findNodeById(l)?.node.children : e.document.content;
386
+ g && g.splice(u, 0, y);
387
387
  }
388
- function o(c) {
389
- const r = e.findNodeById(c);
390
- if (!r) return null;
388
+ function o(r) {
389
+ const l = e.findNodeById(r);
390
+ if (!l) return null;
391
391
  t.record();
392
- const i = _e(r.node);
393
- return r.parent.splice(r.index + 1, 0, i), i;
392
+ const u = _e(l.node);
393
+ return l.parent.splice(l.index + 1, 0, u), u;
394
394
  }
395
- function u(c, r) {
396
- const i = e.findNodeById(c);
397
- i && (t.record(), Object.assign(i.node.props, r));
395
+ function p(r, l) {
396
+ const u = e.findNodeById(r);
397
+ u && (t.record(), Object.assign(u.node.props, l));
398
398
  }
399
- function p(c, r) {
400
- const i = e.findNodeById(c);
401
- i && (t.record(), Object.assign(i.node.style, r));
399
+ function f(r, l) {
400
+ const u = e.findNodeById(r);
401
+ u && (t.record(), Object.assign(u.node.style, l));
402
402
  }
403
- return { addElement: n, removeElement: l, moveElement: a, duplicateElement: o, updateProps: u, updateStyle: p };
403
+ function d(r, l) {
404
+ const u = e.findNodeById(r);
405
+ u && (t.record(), l ? u.node.key = l : delete u.node.key);
406
+ }
407
+ return { addElement: n, removeElement: i, moveElement: s, duplicateElement: o, updateProps: p, updateStyle: f, updateKey: d };
404
408
  }
405
409
  function ht(e) {
406
410
  D(ve, e);
407
411
  }
408
- function q() {
412
+ function j() {
409
413
  const e = L(ve);
410
414
  if (!e)
411
415
  throw new Error("useElementActions() requires a BrickPdf ancestor component");
@@ -414,24 +418,24 @@ function q() {
414
418
  const ke = /* @__PURE__ */ Symbol("brick-pdf-history"), _t = 50;
415
419
  function kt(e) {
416
420
  const t = E([]), n = E([]);
417
- let l = 0;
418
- const a = I(() => t.value.length > 0), o = I(() => n.value.length > 0);
419
- function u() {
421
+ let i = 0;
422
+ const s = I(() => t.value.length > 0), o = I(() => n.value.length > 0);
423
+ function p() {
420
424
  const r = Date.now();
421
- if (r - l < 100) return;
422
- l = r;
423
- const i = e.snapshotContent();
424
- t.value.push(i), t.value.length > _t && t.value.shift(), n.value = [];
425
+ if (r - i < 100) return;
426
+ i = r;
427
+ const l = e.snapshotContent();
428
+ t.value.push(l), t.value.length > _t && t.value.shift(), n.value = [];
425
429
  }
426
- function p() {
430
+ function f() {
427
431
  const r = t.value.pop();
428
432
  r && (n.value.push(e.snapshotContent()), e.replaceContent(r));
429
433
  }
430
- function c() {
434
+ function d() {
431
435
  const r = n.value.pop();
432
436
  r && (t.value.push(e.snapshotContent()), e.replaceContent(r));
433
437
  }
434
- return { canUndo: a, canRedo: o, record: u, undo: p, redo: c };
438
+ return { canUndo: s, canRedo: o, record: p, undo: f, redo: d };
435
439
  }
436
440
  function St(e) {
437
441
  D(ke, e);
@@ -445,7 +449,7 @@ function xt() {
445
449
  const Se = /* @__PURE__ */ Symbol("brick-pdf-drag-drop");
446
450
  function Ct(e, t) {
447
451
  const n = E(!1);
448
- function l(o) {
452
+ function i(o) {
449
453
  return ce.create(o, {
450
454
  group: { name: "brick-elements", pull: "clone", put: !1 },
451
455
  sort: !1,
@@ -458,7 +462,7 @@ function Ct(e, t) {
458
462
  }
459
463
  });
460
464
  }
461
- function a(o, u) {
465
+ function s(o, p) {
462
466
  return ce.create(o, {
463
467
  group: { name: "brick-elements", put: !0 },
464
468
  animation: 150,
@@ -469,32 +473,32 @@ function Ct(e, t) {
469
473
  onStart() {
470
474
  n.value = !0;
471
475
  },
472
- onAdd(p) {
473
- const c = p.item, r = c.dataset.elementId, i = c.dataset.elementType, y = (g) => {
474
- if (!u || !g) return !1;
475
- const f = e.findNodeById(u);
476
- if (!f) return !1;
477
- const b = U(f.node.type);
478
- return !!(b?.acceptsChildTypes && !b.acceptsChildTypes.includes(g));
476
+ onAdd(f) {
477
+ const d = f.item, r = d.dataset.elementId, l = d.dataset.elementType, u = (b) => {
478
+ if (!p || !b) return !1;
479
+ const y = e.findNodeById(p);
480
+ if (!y) return !1;
481
+ const g = U(y.node.type);
482
+ return !!(g?.acceptsChildTypes && !g.acceptsChildTypes.includes(b));
479
483
  };
480
484
  if (r) {
481
- if (c.parentNode?.removeChild(c), y(i)) return;
482
- t.moveElement(r, u, p.newIndex ?? 0);
485
+ if (d.parentNode?.removeChild(d), u(l)) return;
486
+ t.moveElement(r, p, f.newIndex ?? 0);
483
487
  return;
484
488
  }
485
- i && (c.parentNode?.removeChild(c), !y(i) && t.addElement(i, u, p.newIndex));
489
+ l && (d.parentNode?.removeChild(d), !u(l) && t.addElement(l, p, f.newIndex));
486
490
  },
487
- onEnd(p) {
488
- if (n.value = !1, p.from === p.to && p.oldIndex !== void 0 && p.newIndex !== void 0 && p.oldIndex !== p.newIndex && p.item.dataset.elementId) {
489
- const c = u ? e.findNodeById(u)?.node.children : e.document.content;
490
- if (!c) return;
491
- const r = c.splice(p.oldIndex, 1)[0];
492
- r && c.splice(p.newIndex, 0, r);
491
+ onEnd(f) {
492
+ if (n.value = !1, f.from === f.to && f.oldIndex !== void 0 && f.newIndex !== void 0 && f.oldIndex !== f.newIndex && f.item.dataset.elementId) {
493
+ const d = p ? e.findNodeById(p)?.node.children : e.document.content;
494
+ if (!d) return;
495
+ const r = d.splice(f.oldIndex, 1)[0];
496
+ r && d.splice(f.newIndex, 0, r);
493
497
  }
494
498
  }
495
499
  });
496
500
  }
497
- return { initToolbar: l, initContainer: a, isDragging: n };
501
+ return { initToolbar: i, initContainer: s, isDragging: n };
498
502
  }
499
503
  function wt(e) {
500
504
  D(Se, e);
@@ -514,12 +518,12 @@ const ue = {
514
518
  }, Pt = "NotoSansJP";
515
519
  function Et(e) {
516
520
  const t = new Uint8Array(e), n = 32768;
517
- let l = "";
518
- for (let a = 0; a < t.length; a += n) {
519
- const o = t.subarray(a, a + n);
520
- l += String.fromCharCode.apply(null, Array.from(o));
521
+ let i = "";
522
+ for (let s = 0; s < t.length; s += n) {
523
+ const o = t.subarray(s, s + n);
524
+ i += String.fromCharCode.apply(null, Array.from(o));
521
525
  }
522
- return btoa(l);
526
+ return btoa(i);
523
527
  }
524
528
  async function pe(e) {
525
529
  const t = await fetch(e);
@@ -528,9 +532,9 @@ async function pe(e) {
528
532
  const n = await t.arrayBuffer();
529
533
  return Et(n);
530
534
  }
531
- let F = null;
535
+ let H = null;
532
536
  function It() {
533
- return F || (F = (async () => {
537
+ return H || (H = (async () => {
534
538
  const [e, t] = await Promise.all([
535
539
  pe(ue.regular),
536
540
  pe(ue.bold)
@@ -550,8 +554,8 @@ function It() {
550
554
  }
551
555
  };
552
556
  })().catch((e) => {
553
- throw F = null, e;
554
- }), F);
557
+ throw H = null, e;
558
+ }), H);
555
559
  }
556
560
  const Ce = /* @__PURE__ */ Symbol("brick-pdf-export");
557
561
  function $t(e) {
@@ -574,10 +578,8 @@ function Rt(e) {
574
578
  };
575
579
  }
576
580
  async function n() {
577
- const o = await import("pdfmake/build/pdfmake"), u = await import("pdfmake/build/vfs_fonts"), p = o.default || o, c = u.pdfMake;
578
- c && c.vfs ? p.vfs = c.vfs : u.default && (p.vfs = u.default);
579
- const r = await It();
580
- return p.vfs = { ...p.vfs, ...r.vfs }, p.fonts = {
581
+ const o = await import("pdfmake/build/pdfmake"), p = await import("pdfmake/build/vfs_fonts"), f = o.default || o, d = p.pdfMake?.vfs ?? p.default ?? {}, r = await It();
582
+ return f.addVirtualFileSystem({ ...d, ...r.vfs }), f.setFonts({
581
583
  Roboto: {
582
584
  normal: "Roboto-Regular.ttf",
583
585
  bold: "Roboto-Medium.ttf",
@@ -585,21 +587,21 @@ function Rt(e) {
585
587
  bolditalics: "Roboto-MediumItalic.ttf"
586
588
  },
587
589
  ...r.fonts
588
- }, p;
590
+ }), f;
589
591
  }
590
- function l(o) {
591
- const u = t();
592
- n().then((p) => {
593
- p.createPdf(u).download(o ?? "document.pdf");
592
+ function i(o) {
593
+ const p = t();
594
+ n().then((f) => {
595
+ f.createPdf(p).download(o ?? "document.pdf");
594
596
  });
595
597
  }
596
- function a() {
598
+ function s() {
597
599
  const o = t();
598
- n().then((u) => {
599
- u.createPdf(o).open();
600
+ n().then((p) => {
601
+ p.createPdf(o).open();
600
602
  });
601
603
  }
602
- return { toDocumentDefinition: t, exportPdf: l, openPdf: a };
604
+ return { toDocumentDefinition: t, exportPdf: i, openPdf: s };
603
605
  }
604
606
  function Nt(e) {
605
607
  D(Ce, e);
@@ -625,27 +627,27 @@ function Ee(e) {
625
627
  };
626
628
  }
627
629
  function Lt(e, t) {
628
- const n = E(null), l = E(!1), a = E(null), o = E(!1);
629
- function u(r) {
630
- const i = e.findNodeById(r);
631
- i && (n.value = structuredClone(i.node), l.value = !1, a.value = null, o.value = !0);
632
- }
630
+ const n = E(null), i = E(!1), s = E(null), o = E(!1);
633
631
  function p(r) {
634
- const i = e.findNodeById(r);
635
- i && (n.value = structuredClone(i.node), l.value = !0, a.value = r, o.value = !0);
632
+ const l = e.findNodeById(r);
633
+ l && (n.value = structuredClone(l.node), i.value = !1, s.value = null, o.value = !0);
636
634
  }
637
- function c(r) {
635
+ function f(r) {
636
+ const l = e.findNodeById(r);
637
+ l && (n.value = structuredClone(l.node), i.value = !0, s.value = r, o.value = !0);
638
+ }
639
+ function d(r) {
638
640
  if (!n.value) return;
639
- l.value && a.value && (t.removeElement(a.value), l.value = !1, a.value = null);
640
- const i = Ee(n.value), y = r ? e.findNodeById(r)?.node.children : e.document.content;
641
- y && (y.push(i), l.value && (n.value = null, o.value = !1));
641
+ i.value && s.value && (t.removeElement(s.value), i.value = !1, s.value = null);
642
+ const l = Ee(n.value), u = r ? e.findNodeById(r)?.node.children : e.document.content;
643
+ u && (u.push(l), i.value && (n.value = null, o.value = !1));
642
644
  }
643
- return { hasClipboard: o, copy: u, cut: p, paste: c };
645
+ return { hasClipboard: o, copy: p, cut: f, paste: d };
644
646
  }
645
647
  function Mt(e) {
646
648
  D(Pe, e);
647
649
  }
648
- function lr() {
650
+ function sr() {
649
651
  const e = L(Pe);
650
652
  if (!e)
651
653
  throw new Error("useClipboard() requires a BrickPdf ancestor component");
@@ -654,119 +656,119 @@ function lr() {
654
656
  const Ie = /* @__PURE__ */ Symbol("brick-pdf-resize");
655
657
  function Bt(e) {
656
658
  const t = E(!1);
657
- function n(l, a, o, u) {
659
+ function n(i, s, o, p) {
658
660
  t.value = !0;
659
- const p = u.clientX, c = u.clientY, r = o.width, i = o.height;
660
- function y(f) {
661
- const b = f.clientX - p, v = f.clientY - c;
662
- let h = r, S = i;
663
- a.includes("e") && (h = r + b), a.includes("w") && (h = r - b), a.includes("s") && (S = i + v), a.includes("n") && (S = i - v), h = Math.max(20, h), S = Math.max(20, S), e.updateStyle(l, {
661
+ const f = p.clientX, d = p.clientY, r = o.width, l = o.height;
662
+ function u(y) {
663
+ const g = y.clientX - f, v = y.clientY - d;
664
+ let h = r, S = l;
665
+ s.includes("e") && (h = r + g), s.includes("w") && (h = r - g), s.includes("s") && (S = l + v), s.includes("n") && (S = l - v), h = Math.max(20, h), S = Math.max(20, S), e.updateStyle(i, {
664
666
  width: Math.round(h),
665
667
  height: Math.round(S)
666
668
  });
667
669
  }
668
- function g() {
669
- t.value = !1, document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", g);
670
+ function b() {
671
+ t.value = !1, document.removeEventListener("pointermove", u), document.removeEventListener("pointerup", b);
670
672
  }
671
- document.addEventListener("pointermove", y), document.addEventListener("pointerup", g);
673
+ document.addEventListener("pointermove", u), document.addEventListener("pointerup", b);
672
674
  }
673
675
  return { isResizing: t, startResize: n };
674
676
  }
675
677
  function Ot(e) {
676
678
  D(Ie, e);
677
679
  }
678
- function ir() {
680
+ function ar() {
679
681
  const e = L(Ie);
680
682
  if (!e)
681
683
  throw new Error("useResize() requires a BrickPdf ancestor component");
682
684
  return e;
683
685
  }
684
- const At = { class: "brick-table-editor" }, Vt = { class: "brick-table-editor__grid" }, Ht = ["onClick"], Ft = { class: "brick-table-editor__row-header" }, Jt = ["onClick"], Ut = ["value", "onInput"], Wt = /* @__PURE__ */ _({
686
+ const At = { class: "brick-table-editor" }, Vt = { class: "brick-table-editor__grid" }, Ft = ["onClick"], Ht = { class: "brick-table-editor__row-header" }, Jt = ["onClick"], Ut = ["value", "onInput"], Wt = /* @__PURE__ */ _({
685
687
  __name: "TablePropertyEditor",
686
688
  props: {
687
689
  node: {}
688
690
  },
689
691
  setup(e) {
690
- const t = e, n = q();
691
- function l() {
692
+ const t = e, n = j();
693
+ function i() {
692
694
  return t.node.props.body ?? [];
693
695
  }
694
- function a() {
696
+ function s() {
695
697
  return t.node.props.widths ?? [];
696
698
  }
697
- function o(i, y, g) {
698
- const f = l().map((b) => [...b]);
699
- f[i][y] = g, n.updateProps(t.node.id, { body: f });
699
+ function o(l, u, b) {
700
+ const y = i().map((g) => [...g]);
701
+ y[l][u] = b, n.updateProps(t.node.id, { body: y });
700
702
  }
701
- function u() {
702
- const i = l().map((g) => [...g]), y = i[0]?.length ?? 2;
703
- i.push(Array(y).fill("")), n.updateProps(t.node.id, { body: i });
703
+ function p() {
704
+ const l = i().map((b) => [...b]), u = l[0]?.length ?? 2;
705
+ l.push(Array(u).fill("")), n.updateProps(t.node.id, { body: l });
704
706
  }
705
- function p(i) {
706
- const y = l().map((f) => [...f]);
707
- if (y.length <= 1) return;
708
- y.splice(i, 1), t.node.props.headerRows > y.length ? n.updateProps(t.node.id, { body: y, headerRows: y.length }) : n.updateProps(t.node.id, { body: y });
707
+ function f(l) {
708
+ const u = i().map((y) => [...y]);
709
+ if (u.length <= 1) return;
710
+ u.splice(l, 1), t.node.props.headerRows > u.length ? n.updateProps(t.node.id, { body: u, headerRows: u.length }) : n.updateProps(t.node.id, { body: u });
709
711
  }
710
- function c() {
711
- const i = l().map((g) => [...g, ""]), y = [...a(), "*"];
712
- n.updateProps(t.node.id, { body: i, widths: y });
712
+ function d() {
713
+ const l = i().map((b) => [...b, ""]), u = [...s(), "*"];
714
+ n.updateProps(t.node.id, { body: l, widths: u });
713
715
  }
714
- function r(i) {
715
- const y = l().map((f) => {
716
- const b = [...f];
717
- return b.splice(i, 1), b;
716
+ function r(l) {
717
+ const u = i().map((y) => {
718
+ const g = [...y];
719
+ return g.splice(l, 1), g;
718
720
  });
719
- if ((y[0]?.length ?? 0) < 1) return;
720
- const g = [...a()];
721
- g.splice(i, 1), n.updateProps(t.node.id, { body: y, widths: g });
721
+ if ((u[0]?.length ?? 0) < 1) return;
722
+ const b = [...s()];
723
+ b.splice(l, 1), n.updateProps(t.node.id, { body: u, widths: b });
722
724
  }
723
- return (i, y) => (s(), d("div", At, [
725
+ return (l, u) => (a(), c("div", At, [
724
726
  m("div", { class: "brick-table-editor__actions" }, [
725
727
  m("button", {
726
728
  class: "brick-table-editor__btn",
727
- onClick: u
729
+ onClick: p
728
730
  }, "+ Row"),
729
731
  m("button", {
730
732
  class: "brick-table-editor__btn",
731
- onClick: c
733
+ onClick: d
732
734
  }, "+ Column")
733
735
  ]),
734
736
  m("div", Vt, [
735
737
  m("table", null, [
736
738
  m("thead", null, [
737
739
  m("tr", null, [
738
- y[0] || (y[0] = m("th", { class: "brick-table-editor__corner" }, null, -1)),
739
- (s(!0), d(C, null, P(l()[0] ?? [], (g, f) => (s(), d("th", {
740
- key: f,
740
+ u[0] || (u[0] = m("th", { class: "brick-table-editor__corner" }, null, -1)),
741
+ (a(!0), c(C, null, P(i()[0] ?? [], (b, y) => (a(), c("th", {
742
+ key: y,
741
743
  class: "brick-table-editor__col-header"
742
744
  }, [
743
- ie(" Col " + w(f + 1) + " ", 1),
744
- (l()[0]?.length ?? 0) > 1 ? (s(), d("button", {
745
+ ie(" Col " + w(y + 1) + " ", 1),
746
+ (i()[0]?.length ?? 0) > 1 ? (a(), c("button", {
745
747
  key: 0,
746
748
  class: "brick-table-editor__remove-btn",
747
749
  title: "Remove column",
748
- onClick: (b) => r(f)
749
- }, "x", 8, Ht)) : $("", !0)
750
+ onClick: (g) => r(y)
751
+ }, "x", 8, Ft)) : $("", !0)
750
752
  ]))), 128))
751
753
  ])
752
754
  ]),
753
755
  m("tbody", null, [
754
- (s(!0), d(C, null, P(l(), (g, f) => (s(), d("tr", { key: f }, [
755
- m("td", Ft, [
756
- ie(w(f + 1) + " ", 1),
757
- l().length > 1 ? (s(), d("button", {
756
+ (a(!0), c(C, null, P(i(), (b, y) => (a(), c("tr", { key: y }, [
757
+ m("td", Ht, [
758
+ ie(w(y + 1) + " ", 1),
759
+ i().length > 1 ? (a(), c("button", {
758
760
  key: 0,
759
761
  class: "brick-table-editor__remove-btn",
760
762
  title: "Remove row",
761
- onClick: (b) => p(f)
763
+ onClick: (g) => f(y)
762
764
  }, "x", 8, Jt)) : $("", !0)
763
765
  ]),
764
- (s(!0), d(C, null, P(g, (b, v) => (s(), d("td", { key: v }, [
766
+ (a(!0), c(C, null, P(b, (g, v) => (a(), c("td", { key: v }, [
765
767
  m("input", {
766
768
  class: "brick-table-editor__cell",
767
769
  type: "text",
768
- value: b,
769
- onInput: (h) => o(f, v, h.target.value)
770
+ value: g,
771
+ onInput: (h) => o(y, v, h.target.value)
770
772
  }, null, 40, Ut)
771
773
  ]))), 128))
772
774
  ]))), 128))
@@ -802,16 +804,16 @@ const At = { class: "brick-table-editor" }, Vt = { class: "brick-table-editor__g
802
804
  function qt() {
803
805
  return { src: "", width: 200, height: 150, fit: null };
804
806
  }
805
- function Gt() {
807
+ function Kt() {
806
808
  return {};
807
809
  }
808
- function Xt(e) {
810
+ function Gt(e) {
809
811
  const t = {
810
812
  image: e.props.src
811
813
  };
812
814
  return e.props.width && (t.width = e.props.width), e.props.height && (t.height = e.props.height), e.props.fit && (t.fit = e.props.fit), e.style.margin && (t.margin = e.style.margin), e.style.alignment && (t.alignment = e.style.alignment), e.style.opacity !== void 0 && (t.opacity = e.style.opacity), t;
813
815
  }
814
- const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
816
+ const Xt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
815
817
  key: 1,
816
818
  class: "brick-el-image__placeholder"
817
819
  }, en = /* @__PURE__ */ _({
@@ -820,8 +822,8 @@ const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
820
822
  node: {}
821
823
  },
822
824
  setup(e) {
823
- return (t, n) => (s(), d("div", Kt, [
824
- e.node.props.src ? (s(), d("img", {
825
+ return (t, n) => (a(), c("div", Xt, [
826
+ e.node.props.src ? (a(), c("img", {
825
827
  key: 0,
826
828
  src: e.node.props.src,
827
829
  style: N({
@@ -830,7 +832,7 @@ const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
830
832
  objectFit: "contain",
831
833
  opacity: e.node.style.opacity
832
834
  })
833
- }, null, 12, Qt)) : (s(), d("div", Zt, " No image selected "))
835
+ }, null, 12, Qt)) : (a(), c("div", Zt, " No image selected "))
834
836
  ]));
835
837
  }
836
838
  }), tn = /* @__PURE__ */ x(en, [["__scopeId", "data-v-38184258"]]), nn = { class: "brick-image-editor" }, on = /* @__PURE__ */ _({
@@ -839,7 +841,7 @@ const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
839
841
  node: {}
840
842
  },
841
843
  setup(e) {
842
- return (t, n) => (s(), d("div", nn));
844
+ return (t, n) => (a(), c("div", nn));
843
845
  }
844
846
  }), rn = {
845
847
  type: "image",
@@ -847,7 +849,7 @@ const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
847
849
  icon: "🖼",
848
850
  isContainer: !1,
849
851
  defaultProps: qt,
850
- defaultStyle: Gt,
852
+ defaultStyle: Kt,
851
853
  rendererComponent: tn,
852
854
  propertyEditorComponent: on,
853
855
  propertyFields: [
@@ -862,7 +864,7 @@ const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
862
864
  { key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] },
863
865
  { key: "style.opacity", label: "Opacity", section: "advanced", type: "slider", min: 0, max: 1, step: 0.1, defaultValue: 1 }
864
866
  ],
865
- toPdfmake: Xt
867
+ toPdfmake: Gt
866
868
  };
867
869
  function ln() {
868
870
  return { ordered: !1, items: ["Item 1", "Item 2", "Item 3"] };
@@ -871,8 +873,8 @@ function sn() {
871
873
  return { fontSize: 12 };
872
874
  }
873
875
  function an(e) {
874
- const t = e.props.items, l = e.props.ordered ? { ol: t } : { ul: t };
875
- return e.style.fontSize && (l.fontSize = e.style.fontSize), e.style.color && (l.color = e.style.color), e.style.margin && (l.margin = e.style.margin), l;
876
+ const t = e.props.items, i = e.props.ordered ? { ol: t } : { ul: t };
877
+ return e.style.fontSize && (i.fontSize = e.style.fontSize), e.style.color && (i.color = e.style.color), e.style.margin && (i.margin = e.style.margin), i;
876
878
  }
877
879
  const cn = /* @__PURE__ */ _({
878
880
  __name: "ListRenderer",
@@ -880,13 +882,13 @@ const cn = /* @__PURE__ */ _({
880
882
  node: {}
881
883
  },
882
884
  setup(e) {
883
- return (t, n) => (s(), d("div", {
885
+ return (t, n) => (a(), c("div", {
884
886
  class: "brick-el-list",
885
887
  style: N({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
886
888
  }, [
887
- (s(), M(te(e.node.props.ordered ? "ol" : "ul"), null, {
888
- default: j(() => [
889
- (s(!0), d(C, null, P(e.node.props.items, (l, a) => (s(), d("li", { key: a }, w(l), 1))), 128))
889
+ (a(), M(te(e.node.props.ordered ? "ol" : "ul"), null, {
890
+ default: Y(() => [
891
+ (a(!0), c(C, null, P(e.node.props.items, (i, s) => (a(), c("li", { key: s }, w(i), 1))), 128))
890
892
  ]),
891
893
  _: 1
892
894
  }))
@@ -898,7 +900,7 @@ const cn = /* @__PURE__ */ _({
898
900
  node: {}
899
901
  },
900
902
  setup(e) {
901
- return (t, n) => (s(), d("div", un));
903
+ return (t, n) => (a(), c("div", un));
902
904
  }
903
905
  }), fn = {
904
906
  type: "list",
@@ -920,10 +922,10 @@ Item 3` },
920
922
  ],
921
923
  toPdfmake: an
922
924
  };
923
- function mn() {
925
+ function yn() {
924
926
  return { data: "https://example.com", fit: 100 };
925
927
  }
926
- function yn() {
928
+ function mn() {
927
929
  return {};
928
930
  }
929
931
  function gn(e) {
@@ -939,7 +941,7 @@ const bn = { class: "brick-el-qr__preview" }, vn = /* @__PURE__ */ _({
939
941
  node: {}
940
942
  },
941
943
  setup(e) {
942
- return (t, n) => (s(), d("div", {
944
+ return (t, n) => (a(), c("div", {
943
945
  class: "brick-el-qr",
944
946
  style: N({
945
947
  width: (e.node.props.fit ?? 100) + "px",
@@ -955,15 +957,15 @@ const bn = { class: "brick-el-qr__preview" }, vn = /* @__PURE__ */ _({
955
957
  node: {}
956
958
  },
957
959
  setup(e) {
958
- return (t, n) => (s(), d("div", _n));
960
+ return (t, n) => (a(), c("div", _n));
959
961
  }
960
962
  }), Sn = {
961
963
  type: "qr",
962
964
  label: "QR Code",
963
965
  icon: "⊞",
964
966
  isContainer: !1,
965
- defaultProps: mn,
966
- defaultStyle: yn,
967
+ defaultProps: yn,
968
+ defaultStyle: mn,
967
969
  rendererComponent: hn,
968
970
  propertyEditorComponent: kn,
969
971
  propertyFields: [
@@ -1000,7 +1002,7 @@ const Pn = ["innerHTML"], En = /* @__PURE__ */ _({
1000
1002
  node: {}
1001
1003
  },
1002
1004
  setup(e) {
1003
- return (t, n) => (s(), d("div", {
1005
+ return (t, n) => (a(), c("div", {
1004
1006
  class: "brick-el-svg",
1005
1007
  style: N({
1006
1008
  width: e.node.props.width + "px",
@@ -1015,7 +1017,7 @@ const Pn = ["innerHTML"], En = /* @__PURE__ */ _({
1015
1017
  node: {}
1016
1018
  },
1017
1019
  setup(e) {
1018
- return (t, n) => (s(), d("div", $n));
1020
+ return (t, n) => (a(), c("div", $n));
1019
1021
  }
1020
1022
  }), Nn = {
1021
1023
  type: "svg",
@@ -1054,7 +1056,7 @@ const Ln = { class: "brick-el-pagebreak" }, Mn = /* @__PURE__ */ _({
1054
1056
  node: {}
1055
1057
  },
1056
1058
  setup(e) {
1057
- return (t, n) => (s(), d("div", Ln, [...n[0] || (n[0] = [
1059
+ return (t, n) => (a(), c("div", Ln, [...n[0] || (n[0] = [
1058
1060
  m("hr", null, null, -1),
1059
1061
  m("span", null, "Page Break", -1),
1060
1062
  m("hr", null, null, -1)
@@ -1066,7 +1068,7 @@ const Ln = { class: "brick-el-pagebreak" }, Mn = /* @__PURE__ */ _({
1066
1068
  node: {}
1067
1069
  },
1068
1070
  setup(e) {
1069
- return (t, n) => (s(), d("div", On, [...n[0] || (n[0] = [
1071
+ return (t, n) => (a(), c("div", On, [...n[0] || (n[0] = [
1070
1072
  m("p", { style: { color: "#999", "font-size": "12px" } }, "No configurable properties.", -1)
1071
1073
  ])]));
1072
1074
  }
@@ -1083,10 +1085,10 @@ const Ln = { class: "brick-el-pagebreak" }, Mn = /* @__PURE__ */ _({
1083
1085
  toPdfmake: Dn
1084
1086
  };
1085
1087
  let fe = !1;
1086
- function Hn() {
1088
+ function Fn() {
1087
1089
  fe || (fe = !0, z(We), z(Ze), z(st), z(Yt), z(rn), z(fn), z(Sn), z(Nn), z(Vn));
1088
1090
  }
1089
- const Fn = {
1091
+ const Hn = {
1090
1092
  key: 0,
1091
1093
  class: "brick-dropzone__empty"
1092
1094
  }, Jn = /* @__PURE__ */ _({
@@ -1097,19 +1099,19 @@ const Fn = {
1097
1099
  },
1098
1100
  setup(e) {
1099
1101
  const t = e, n = E(null);
1100
- let l = null;
1101
- const a = xe(), { isDragging: o } = a;
1102
- return me(() => {
1103
- n.value && (l = a.initContainer(n.value, t.parentId));
1104
- }), ye(() => {
1105
- l?.destroy();
1106
- }), (u, p) => (s(), d("div", {
1102
+ let i = null;
1103
+ const s = xe(), { isDragging: o } = s;
1104
+ return ye(() => {
1105
+ n.value && (i = s.initContainer(n.value, t.parentId));
1106
+ }), me(() => {
1107
+ i?.destroy();
1108
+ }), (p, f) => (a(), c("div", {
1107
1109
  ref_key: "el",
1108
1110
  ref: n,
1109
1111
  class: ee(["brick-dropzone", { "brick-dropzone--horizontal": e.layout === "horizontal", "brick-dropzone--drag-active": k(o) && e.layout === "horizontal" }])
1110
1112
  }, [
1111
- Z(u.$slots, "default", {}, void 0, !0),
1112
- u.$slots.default ? $("", !0) : (s(), d("div", Fn, " Drop elements here "))
1113
+ Z(p.$slots, "default", {}, void 0, !0),
1114
+ p.$slots.default ? $("", !0) : (a(), c("div", Hn, " Drop elements here "))
1113
1115
  ], 2));
1114
1116
  }
1115
1117
  }), $e = /* @__PURE__ */ x(Jn, [["__scopeId", "data-v-b9596dad"]]), Un = ["data-element-id", "data-element-type"], Wn = {
@@ -1122,52 +1124,52 @@ const Fn = {
1122
1124
  path: {}
1123
1125
  },
1124
1126
  setup(e) {
1125
- const t = e, n = W(), l = q(), a = E(null), o = I(() => U(t.node.type)), u = I(() => n.selectedId.value === t.node.id), p = I(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.width" || f.key === "style.width") : !1), c = I(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.height" || f.key === "style.height") : !1);
1126
- function r(f) {
1127
- f.stopPropagation(), n.select(t.node.id);
1127
+ const t = e, n = W(), i = j(), s = E(null), o = I(() => U(t.node.type)), p = I(() => n.selectedId.value === t.node.id), f = I(() => o.value ? o.value.propertyFields.some((y) => y.key === "props.width" || y.key === "style.width") : !1), d = I(() => o.value ? o.value.propertyFields.some((y) => y.key === "props.height" || y.key === "style.height") : !1);
1128
+ function r(y) {
1129
+ y.stopPropagation(), n.select(t.node.id);
1128
1130
  }
1129
- function i(f) {
1130
- f.stopPropagation(), f.preventDefault();
1131
- const b = f.clientX, v = a.value?.offsetWidth ?? 200;
1131
+ function l(y) {
1132
+ y.stopPropagation(), y.preventDefault();
1133
+ const g = y.clientX, v = s.value?.offsetWidth ?? 200;
1132
1134
  function h(R) {
1133
- const O = R.clientX - b, T = Math.max(20, v + O);
1134
- o.value?.propertyFields.some((H) => H.key === "props.width") ? l.updateProps(t.node.id, { width: Math.round(T) }) : l.updateStyle(t.node.id, { width: Math.round(T) });
1135
+ const O = R.clientX - g, T = Math.max(20, v + O);
1136
+ o.value?.propertyFields.some((F) => F.key === "props.width") ? i.updateProps(t.node.id, { width: Math.round(T) }) : i.updateStyle(t.node.id, { width: Math.round(T) });
1135
1137
  }
1136
1138
  function S() {
1137
1139
  document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", S), document.body.style.cursor = "", document.body.style.userSelect = "";
1138
1140
  }
1139
1141
  document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", S);
1140
1142
  }
1141
- function y(f) {
1142
- f.stopPropagation(), f.preventDefault();
1143
- const b = f.clientY, v = a.value?.offsetHeight ?? 100;
1143
+ function u(y) {
1144
+ y.stopPropagation(), y.preventDefault();
1145
+ const g = y.clientY, v = s.value?.offsetHeight ?? 100;
1144
1146
  function h(R) {
1145
- const O = R.clientY - b, T = Math.max(20, v + O);
1146
- o.value?.propertyFields.some((H) => H.key === "props.height") ? l.updateProps(t.node.id, { height: Math.round(T) }) : l.updateStyle(t.node.id, { height: Math.round(T) });
1147
+ const O = R.clientY - g, T = Math.max(20, v + O);
1148
+ o.value?.propertyFields.some((F) => F.key === "props.height") ? i.updateProps(t.node.id, { height: Math.round(T) }) : i.updateStyle(t.node.id, { height: Math.round(T) });
1147
1149
  }
1148
1150
  function S() {
1149
1151
  document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", S), document.body.style.cursor = "", document.body.style.userSelect = "";
1150
1152
  }
1151
1153
  document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", S);
1152
1154
  }
1153
- function g(f) {
1154
- f.stopPropagation(), f.preventDefault();
1155
- const b = f.clientX, v = f.clientY, h = a.value?.offsetWidth ?? 200, S = a.value?.offsetHeight ?? 100;
1155
+ function b(y) {
1156
+ y.stopPropagation(), y.preventDefault();
1157
+ const g = y.clientX, v = y.clientY, h = s.value?.offsetWidth ?? 200, S = s.value?.offsetHeight ?? 100;
1156
1158
  function R(T) {
1157
- const G = T.clientX - b, H = T.clientY - v, re = Math.max(20, h + G), le = Math.max(20, S + H), Re = o.value?.propertyFields.some((X) => X.key === "props.width"), Ne = o.value?.propertyFields.some((X) => X.key === "props.height");
1158
- Re ? l.updateProps(t.node.id, { width: Math.round(re) }) : l.updateStyle(t.node.id, { width: Math.round(re) }), Ne ? l.updateProps(t.node.id, { height: Math.round(le) }) : l.updateStyle(t.node.id, { height: Math.round(le) });
1159
+ const K = T.clientX - g, F = T.clientY - v, re = Math.max(20, h + K), le = Math.max(20, S + F), Re = o.value?.propertyFields.some((G) => G.key === "props.width"), Ne = o.value?.propertyFields.some((G) => G.key === "props.height");
1160
+ Re ? i.updateProps(t.node.id, { width: Math.round(re) }) : i.updateStyle(t.node.id, { width: Math.round(re) }), Ne ? i.updateProps(t.node.id, { height: Math.round(le) }) : i.updateStyle(t.node.id, { height: Math.round(le) });
1159
1161
  }
1160
1162
  function O() {
1161
1163
  document.removeEventListener("pointermove", R), document.removeEventListener("pointerup", O), document.body.style.cursor = "", document.body.style.userSelect = "";
1162
1164
  }
1163
1165
  document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", R), document.addEventListener("pointerup", O);
1164
1166
  }
1165
- return (f, b) => {
1167
+ return (y, g) => {
1166
1168
  const v = Te("CanvasElement", !0);
1167
- return s(), d("div", {
1169
+ return a(), c("div", {
1168
1170
  ref_key: "elRef",
1169
- ref: a,
1170
- class: ee(["brick-canvas-element", { "brick-canvas-element--selected": u.value }]),
1171
+ ref: s,
1172
+ class: ee(["brick-canvas-element", { "brick-canvas-element--selected": p.value }]),
1171
1173
  "data-element-id": e.node.id,
1172
1174
  "data-element-type": e.node.type,
1173
1175
  style: N({
@@ -1181,19 +1183,19 @@ const Fn = {
1181
1183
  }),
1182
1184
  onClick: r
1183
1185
  }, [
1184
- o.value ? (s(), M(te(o.value.rendererComponent), {
1186
+ o.value ? (a(), M(te(o.value.rendererComponent), {
1185
1187
  key: 0,
1186
1188
  node: e.node,
1187
1189
  path: e.path
1188
1190
  }, {
1189
- default: j(() => [
1190
- o.value.isContainer ? (s(), M($e, {
1191
+ default: Y(() => [
1192
+ o.value.isContainer ? (a(), M($e, {
1191
1193
  key: 0,
1192
1194
  "parent-id": e.node.id,
1193
1195
  layout: e.node.type === "columns" ? "horizontal" : "vertical"
1194
1196
  }, {
1195
- default: j(() => [
1196
- (s(!0), d(C, null, P(e.node.children, (h, S) => (s(), M(v, {
1197
+ default: Y(() => [
1198
+ (a(!0), c(C, null, P(e.node.children, (h, S) => (a(), M(v, {
1197
1199
  key: h.id,
1198
1200
  node: h,
1199
1201
  path: [...e.path, S]
@@ -1203,28 +1205,28 @@ const Fn = {
1203
1205
  }, 8, ["parent-id", "layout"])) : $("", !0)
1204
1206
  ]),
1205
1207
  _: 1
1206
- }, 8, ["node", "path"])) : (s(), d("div", Wn, " Unknown element: " + w(e.node.type), 1)),
1207
- u.value ? (s(), d(C, { key: 2 }, [
1208
- p.value ? (s(), d("div", {
1208
+ }, 8, ["node", "path"])) : (a(), c("div", Wn, " Unknown element: " + w(e.node.type), 1)),
1209
+ p.value ? (a(), c(C, { key: 2 }, [
1210
+ f.value ? (a(), c("div", {
1209
1211
  key: 0,
1210
1212
  class: "brick-resize-handle brick-resize-handle--e",
1211
- onPointerdown: i
1213
+ onPointerdown: l
1212
1214
  }, null, 32)) : $("", !0),
1213
- c.value ? (s(), d("div", {
1215
+ d.value ? (a(), c("div", {
1214
1216
  key: 1,
1215
1217
  class: "brick-resize-handle brick-resize-handle--s",
1216
- onPointerdown: y
1218
+ onPointerdown: u
1217
1219
  }, null, 32)) : $("", !0),
1218
- p.value && c.value ? (s(), d("div", {
1220
+ f.value && d.value ? (a(), c("div", {
1219
1221
  key: 2,
1220
1222
  class: "brick-resize-handle brick-resize-handle--se",
1221
- onPointerdown: g
1223
+ onPointerdown: b
1222
1224
  }, null, 32)) : $("", !0)
1223
1225
  ], 64)) : $("", !0)
1224
1226
  ], 14, Un);
1225
1227
  };
1226
1228
  }
1227
- }), Yn = /* @__PURE__ */ x(jn, [["__scopeId", "data-v-6b9cadc1"]]), qn = { class: "brick-doc-bar" }, Gn = { class: "brick-doc-bar__field" }, Xn = ["value"], Kn = { class: "brick-doc-bar__field" }, Qn = { class: "brick-doc-bar__field brick-doc-bar__field--margins" }, Zn = { class: "brick-doc-bar__margins" }, eo = ["placeholder", "title", "value", "onInput"], to = { class: "brick-doc-bar__field" }, no = ["value"], oo = /* @__PURE__ */ _({
1229
+ }), Yn = /* @__PURE__ */ x(jn, [["__scopeId", "data-v-6b9cadc1"]]), qn = { class: "brick-doc-bar" }, Kn = { class: "brick-doc-bar__field" }, Gn = ["value"], Xn = { class: "brick-doc-bar__field" }, Qn = { class: "brick-doc-bar__field brick-doc-bar__field--margins" }, Zn = { class: "brick-doc-bar__margins" }, eo = ["placeholder", "title", "value", "onInput"], to = { class: "brick-doc-bar__field" }, no = ["value"], oo = /* @__PURE__ */ _({
1228
1230
  __name: "DocumentSettings",
1229
1231
  setup(e) {
1230
1232
  const t = oe(), n = [
@@ -1234,28 +1236,28 @@ const Fn = {
1234
1236
  { label: "Letter", value: "LETTER" },
1235
1237
  { label: "Legal", value: "LEGAL" }
1236
1238
  ];
1237
- function l(a, o) {
1238
- const u = [...t.document.pageMargins];
1239
- u[a] = o, t.document.pageMargins = u;
1239
+ function i(s, o) {
1240
+ const p = [...t.document.pageMargins];
1241
+ p[s] = o, t.document.pageMargins = p;
1240
1242
  }
1241
- return (a, o) => (s(), d("div", qn, [
1242
- m("div", Gn, [
1243
+ return (s, o) => (a(), c("div", qn, [
1244
+ m("div", Kn, [
1243
1245
  o[3] || (o[3] = m("label", null, "Size", -1)),
1244
- K(m("select", {
1245
- "onUpdate:modelValue": o[0] || (o[0] = (u) => k(t).document.pageSize = u)
1246
+ X(m("select", {
1247
+ "onUpdate:modelValue": o[0] || (o[0] = (p) => k(t).document.pageSize = p)
1246
1248
  }, [
1247
- (s(), d(C, null, P(n, (u) => m("option", {
1248
- key: u.value,
1249
- value: u.value
1250
- }, w(u.label), 9, Xn)), 64))
1249
+ (a(), c(C, null, P(n, (p) => m("option", {
1250
+ key: p.value,
1251
+ value: p.value
1252
+ }, w(p.label), 9, Gn)), 64))
1251
1253
  ], 512), [
1252
1254
  [se, k(t).document.pageSize]
1253
1255
  ])
1254
1256
  ]),
1255
- m("div", Kn, [
1257
+ m("div", Xn, [
1256
1258
  o[5] || (o[5] = m("label", null, "Orientation", -1)),
1257
- K(m("select", {
1258
- "onUpdate:modelValue": o[1] || (o[1] = (u) => k(t).document.pageOrientation = u)
1259
+ X(m("select", {
1260
+ "onUpdate:modelValue": o[1] || (o[1] = (p) => k(t).document.pageOrientation = p)
1259
1261
  }, [...o[4] || (o[4] = [
1260
1262
  m("option", { value: "portrait" }, "Portrait", -1),
1261
1263
  m("option", { value: "landscape" }, "Landscape", -1)
@@ -1266,13 +1268,13 @@ const Fn = {
1266
1268
  m("div", Qn, [
1267
1269
  o[6] || (o[6] = m("label", null, "Margins", -1)),
1268
1270
  m("div", Zn, [
1269
- (s(), d(C, null, P(["L", "T", "R", "B"], (u, p) => m("input", {
1270
- key: p,
1271
+ (a(), c(C, null, P(["L", "T", "R", "B"], (p, f) => m("input", {
1272
+ key: f,
1271
1273
  type: "number",
1272
- placeholder: u,
1273
- title: u,
1274
- value: k(t).document.pageMargins[p],
1275
- onInput: (c) => l(p, Number(c.target.value))
1274
+ placeholder: p,
1275
+ title: p,
1276
+ value: k(t).document.pageMargins[f],
1277
+ onInput: (d) => i(f, Number(d.target.value))
1276
1278
  }, null, 40, eo)), 64))
1277
1279
  ])
1278
1280
  ]),
@@ -1283,7 +1285,7 @@ const Fn = {
1283
1285
  value: k(t).document.defaultStyle?.fontSize ?? 12,
1284
1286
  min: "6",
1285
1287
  max: "72",
1286
- onInput: o[2] || (o[2] = (u) => (k(t).document.defaultStyle ??= {}).fontSize = Number(u.target.value))
1288
+ onInput: o[2] || (o[2] = (p) => (k(t).document.defaultStyle ??= {}).fontSize = Number(p.target.value))
1287
1289
  }, null, 40, no)
1288
1290
  ])
1289
1291
  ]));
@@ -1291,32 +1293,32 @@ const Fn = {
1291
1293
  }), ro = /* @__PURE__ */ x(oo, [["__scopeId", "data-v-39a2b54f"]]), lo = { class: "brick-canvas" }, V = 0.75, io = /* @__PURE__ */ _({
1292
1294
  __name: "DesignCanvas",
1293
1295
  setup(e) {
1294
- const t = oe(), n = W(), l = {
1296
+ const t = oe(), n = W(), i = {
1295
1297
  A3: [841.89, 1190.55],
1296
1298
  A4: [595.28, 841.89],
1297
1299
  A5: [419.53, 595.28],
1298
1300
  LETTER: [612, 792],
1299
1301
  LEGAL: [612, 1008]
1300
- }, a = I(() => {
1301
- const [p, c] = l[t.document.pageSize] ?? l.A4, r = t.document.pageOrientation === "landscape" ? c : p;
1302
+ }, s = I(() => {
1303
+ const [f, d] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? d : f;
1302
1304
  return Math.round(r * V);
1303
1305
  }), o = I(() => {
1304
- const [p, c] = l[t.document.pageSize] ?? l.A4, r = t.document.pageOrientation === "landscape" ? p : c;
1306
+ const [f, d] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? f : d;
1305
1307
  return Math.round(r * V);
1306
1308
  });
1307
- function u(p) {
1308
- (p.target === p.currentTarget || p.target.classList.contains("brick-canvas__page")) && n.deselect();
1309
+ function p(f) {
1310
+ (f.target === f.currentTarget || f.target.classList.contains("brick-canvas__page")) && n.deselect();
1309
1311
  }
1310
- return (p, c) => (s(), d("div", lo, [
1312
+ return (f, d) => (a(), c("div", lo, [
1311
1313
  B(ro),
1312
1314
  m("div", {
1313
1315
  class: "brick-canvas__scroll",
1314
- onClick: u
1316
+ onClick: p
1315
1317
  }, [
1316
1318
  m("div", {
1317
1319
  class: "brick-canvas__page",
1318
1320
  style: N({
1319
- width: a.value + "px",
1321
+ width: s.value + "px",
1320
1322
  minHeight: o.value + "px",
1321
1323
  paddingTop: k(t).document.pageMargins[1] * V + "px",
1322
1324
  paddingRight: k(t).document.pageMargins[2] * V + "px",
@@ -1325,11 +1327,11 @@ const Fn = {
1325
1327
  })
1326
1328
  }, [
1327
1329
  B($e, { "parent-id": null }, {
1328
- default: j(() => [
1329
- (s(!0), d(C, null, P(k(t).document.content, (r, i) => (s(), M(Yn, {
1330
+ default: Y(() => [
1331
+ (a(!0), c(C, null, P(k(t).document.content, (r, l) => (a(), M(Yn, {
1330
1332
  key: r.id,
1331
1333
  node: r,
1332
- path: [i]
1334
+ path: [l]
1333
1335
  }, null, 8, ["node", "path"]))), 128))
1334
1336
  ]),
1335
1337
  _: 1
@@ -1343,27 +1345,27 @@ const Fn = {
1343
1345
  setup(e) {
1344
1346
  const t = E(null);
1345
1347
  let n = null;
1346
- const l = xe(), a = Be();
1347
- return me(() => {
1348
- t.value && (n = l.initToolbar(t.value));
1349
- }), ye(() => {
1348
+ const i = xe(), s = Be();
1349
+ return ye(() => {
1350
+ t.value && (n = i.initToolbar(t.value));
1351
+ }), me(() => {
1350
1352
  n?.destroy();
1351
- }), (o, u) => (s(), d("div", {
1353
+ }), (o, p) => (a(), c("div", {
1352
1354
  ref_key: "el",
1353
1355
  ref: t,
1354
1356
  class: "brick-element-list"
1355
1357
  }, [
1356
- (s(!0), d(C, null, P(k(a), (p) => (s(), d("div", {
1357
- key: p.type,
1358
+ (a(!0), c(C, null, P(k(s), (f) => (a(), c("div", {
1359
+ key: f.type,
1358
1360
  class: "brick-element-list__item",
1359
- "data-element-type": p.type
1361
+ "data-element-type": f.type
1360
1362
  }, [
1361
- m("span", co, w(p.icon), 1),
1362
- m("span", uo, w(p.label), 1)
1363
+ m("span", co, w(f.icon), 1),
1364
+ m("span", uo, w(f.label), 1)
1363
1365
  ], 8, ao))), 128))
1364
1366
  ], 512));
1365
1367
  }
1366
- }), fo = /* @__PURE__ */ x(po, [["__scopeId", "data-v-2d0b1dbf"]]), mo = { class: "brick-field" }, yo = { class: "brick-field__label" }, go = ["value"], bo = ["value"], vo = ["value", "min", "max", "step"], ho = ["value"], _o = ["value"], ko = ["value"], So = {
1368
+ }), fo = /* @__PURE__ */ x(po, [["__scopeId", "data-v-2d0b1dbf"]]), yo = { class: "brick-field" }, mo = { class: "brick-field__label" }, go = ["value"], bo = ["value"], vo = ["value", "min", "max", "step"], ho = ["value"], _o = ["value"], ko = ["value"], So = {
1367
1369
  key: 5,
1368
1370
  class: "brick-field__toggle"
1369
1371
  }, xo = ["checked"], Co = {
@@ -1379,189 +1381,204 @@ const Fn = {
1379
1381
  node: {}
1380
1382
  },
1381
1383
  setup(e) {
1382
- const t = e, n = q(), l = I(() => {
1383
- const c = t.descriptor.key.split("."), r = c[0], i = c[1];
1384
+ const t = e, n = j(), i = I(() => {
1385
+ const d = t.descriptor.key.split("."), r = d[0], l = d[1];
1384
1386
  if (r === "props")
1385
- return t.node.props[i];
1387
+ return t.node.props[l];
1386
1388
  if (r === "style")
1387
- return t.node.style[i];
1388
- }), a = I(() => {
1389
- const c = l.value;
1390
- return t.descriptor.type === "textarea" && Array.isArray(c) ? c.join(`
1391
- `) : c;
1389
+ return t.node.style[l];
1390
+ }), s = I(() => {
1391
+ const d = i.value;
1392
+ return t.descriptor.type === "textarea" && Array.isArray(d) ? d.join(`
1393
+ `) : d;
1392
1394
  });
1393
- function o(c) {
1394
- const r = t.descriptor.key.split("."), i = r[0], y = r[1];
1395
- let g = c;
1396
- t.descriptor.type === "textarea" && Array.isArray(l.value) && (g = c.split(`
1397
- `)), i === "props" ? n.updateProps(t.node.id, { [y]: g }) : i === "style" && n.updateStyle(t.node.id, { [y]: g });
1395
+ function o(d) {
1396
+ const r = t.descriptor.key.split("."), l = r[0], u = r[1];
1397
+ let b = d;
1398
+ t.descriptor.type === "textarea" && Array.isArray(i.value) && (b = d.split(`
1399
+ `)), l === "props" ? n.updateProps(t.node.id, { [u]: b }) : l === "style" && n.updateStyle(t.node.id, { [u]: b });
1398
1400
  }
1399
- function u(c, r) {
1400
- const y = [...a.value ?? [0, 0, 0, 0]];
1401
- y[c] = r, o(y);
1401
+ function p(d, r) {
1402
+ const u = [...s.value ?? [0, 0, 0, 0]];
1403
+ u[d] = r, o(u);
1402
1404
  }
1403
- function p(c) {
1404
- const i = c.target.files?.[0];
1405
- if (!i) return;
1406
- const y = new FileReader();
1407
- y.onload = () => {
1408
- o(y.result);
1409
- }, y.readAsDataURL(i);
1405
+ function f(d) {
1406
+ const l = d.target.files?.[0];
1407
+ if (!l) return;
1408
+ const u = new FileReader();
1409
+ u.onload = () => {
1410
+ o(u.result);
1411
+ }, u.readAsDataURL(l);
1410
1412
  }
1411
- return (c, r) => (s(), d("div", mo, [
1412
- m("label", yo, w(e.descriptor.label), 1),
1413
- e.descriptor.type === "text" ? (s(), d("input", {
1413
+ return (d, r) => (a(), c("div", yo, [
1414
+ m("label", mo, w(e.descriptor.label), 1),
1415
+ e.descriptor.type === "text" ? (a(), c("input", {
1414
1416
  key: 0,
1415
1417
  type: "text",
1416
1418
  class: "brick-field__input",
1417
- value: a.value,
1418
- onInput: r[0] || (r[0] = (i) => o(i.target.value))
1419
- }, null, 40, go)) : e.descriptor.type === "textarea" ? (s(), d("textarea", {
1419
+ value: s.value,
1420
+ onInput: r[0] || (r[0] = (l) => o(l.target.value))
1421
+ }, null, 40, go)) : e.descriptor.type === "textarea" ? (a(), c("textarea", {
1420
1422
  key: 1,
1421
1423
  class: "brick-field__textarea",
1422
- value: a.value,
1424
+ value: s.value,
1423
1425
  rows: "3",
1424
- onInput: r[1] || (r[1] = (i) => o(i.target.value))
1425
- }, null, 40, bo)) : e.descriptor.type === "number" ? (s(), d("input", {
1426
+ onInput: r[1] || (r[1] = (l) => o(l.target.value))
1427
+ }, null, 40, bo)) : e.descriptor.type === "number" ? (a(), c("input", {
1426
1428
  key: 2,
1427
1429
  type: "number",
1428
1430
  class: "brick-field__input",
1429
- value: a.value,
1431
+ value: s.value,
1430
1432
  min: e.descriptor.min,
1431
1433
  max: e.descriptor.max,
1432
1434
  step: e.descriptor.step,
1433
- onInput: r[2] || (r[2] = (i) => o(Number(i.target.value)))
1434
- }, null, 40, vo)) : e.descriptor.type === "color" ? (s(), d("input", {
1435
+ onInput: r[2] || (r[2] = (l) => o(Number(l.target.value)))
1436
+ }, null, 40, vo)) : e.descriptor.type === "color" ? (a(), c("input", {
1435
1437
  key: 3,
1436
1438
  type: "color",
1437
1439
  class: "brick-field__color",
1438
- value: a.value ?? "#000000",
1439
- onInput: r[3] || (r[3] = (i) => o(i.target.value))
1440
- }, null, 40, ho)) : e.descriptor.type === "select" ? (s(), d("select", {
1440
+ value: s.value ?? "#000000",
1441
+ onInput: r[3] || (r[3] = (l) => o(l.target.value))
1442
+ }, null, 40, ho)) : e.descriptor.type === "select" ? (a(), c("select", {
1441
1443
  key: 4,
1442
1444
  class: "brick-field__select",
1443
- value: a.value,
1444
- onChange: r[4] || (r[4] = (i) => o(i.target.value || void 0))
1445
+ value: s.value,
1446
+ onChange: r[4] || (r[4] = (l) => o(l.target.value || void 0))
1445
1447
  }, [
1446
- (s(!0), d(C, null, P(e.descriptor.options, (i) => (s(), d("option", {
1447
- key: String(i.value),
1448
- value: i.value
1449
- }, w(i.label), 9, ko))), 128))
1450
- ], 40, _o)) : e.descriptor.type === "toggle" ? (s(), d("label", So, [
1448
+ (a(!0), c(C, null, P(e.descriptor.options, (l) => (a(), c("option", {
1449
+ key: String(l.value),
1450
+ value: l.value
1451
+ }, w(l.label), 9, ko))), 128))
1452
+ ], 40, _o)) : e.descriptor.type === "toggle" ? (a(), c("label", So, [
1451
1453
  m("input", {
1452
1454
  type: "checkbox",
1453
- checked: a.value,
1454
- onChange: r[5] || (r[5] = (i) => o(i.target.checked))
1455
+ checked: s.value,
1456
+ onChange: r[5] || (r[5] = (l) => o(l.target.checked))
1455
1457
  }, null, 40, xo),
1456
- m("span", null, w(a.value ? "On" : "Off"), 1)
1457
- ])) : e.descriptor.type === "margin" ? (s(), d("div", Co, [
1458
- (s(), d(C, null, P(["L", "T", "R", "B"], (i, y) => m("input", {
1459
- key: i,
1458
+ m("span", null, w(s.value ? "On" : "Off"), 1)
1459
+ ])) : e.descriptor.type === "margin" ? (a(), c("div", Co, [
1460
+ (a(), c(C, null, P(["L", "T", "R", "B"], (l, u) => m("input", {
1461
+ key: l,
1460
1462
  type: "number",
1461
1463
  class: "brick-field__margin-input",
1462
- placeholder: i,
1463
- value: (a.value ?? [0, 0, 0, 0])[y],
1464
- onInput: (g) => u(y, Number(g.target.value))
1464
+ placeholder: l,
1465
+ value: (s.value ?? [0, 0, 0, 0])[u],
1466
+ onInput: (b) => p(u, Number(b.target.value))
1465
1467
  }, null, 40, wo)), 64))
1466
- ])) : e.descriptor.type === "slider" ? (s(), d("div", Po, [
1468
+ ])) : e.descriptor.type === "slider" ? (a(), c("div", Po, [
1467
1469
  m("input", {
1468
1470
  type: "range",
1469
- value: a.value,
1471
+ value: s.value,
1470
1472
  min: e.descriptor.min,
1471
1473
  max: e.descriptor.max,
1472
1474
  step: e.descriptor.step,
1473
- onInput: r[6] || (r[6] = (i) => o(Number(i.target.value)))
1475
+ onInput: r[6] || (r[6] = (l) => o(Number(l.target.value)))
1474
1476
  }, null, 40, Eo),
1475
- m("span", Io, w(a.value), 1)
1476
- ])) : e.descriptor.type === "file" ? (s(), d("input", {
1477
+ m("span", Io, w(s.value), 1)
1478
+ ])) : e.descriptor.type === "file" ? (a(), c("input", {
1477
1479
  key: 8,
1478
1480
  type: "file",
1479
1481
  accept: "image/*",
1480
1482
  class: "brick-field__file",
1481
- onChange: p
1483
+ onChange: f
1482
1484
  }, null, 32)) : $("", !0)
1483
1485
  ]));
1484
1486
  }
1485
1487
  }), Ro = /* @__PURE__ */ x($o, [["__scopeId", "data-v-5a3bec1b"]]), No = {
1486
1488
  key: 0,
1487
1489
  class: "brick-property-editor"
1488
- }, zo = { class: "brick-property-editor__type" }, To = {
1490
+ }, zo = { class: "brick-property-editor__type" }, To = { class: "brick-property-editor__key" }, Do = ["value"], Lo = {
1489
1491
  key: 0,
1490
1492
  class: "brick-property-editor__group"
1491
- }, Do = { class: "brick-property-editor__group-title" }, Lo = /* @__PURE__ */ _({
1493
+ }, Mo = { class: "brick-property-editor__group-title" }, Bo = /* @__PURE__ */ _({
1492
1494
  __name: "PropertyEditor",
1493
1495
  setup(e) {
1494
- const t = W(), n = I(() => {
1495
- const u = t.selectedNode.value;
1496
- return u ? U(u.type) : null;
1497
- }), l = I(() => {
1498
- if (!n.value) return {};
1499
- const u = {};
1500
- for (const p of n.value.propertyFields)
1501
- u[p.section] || (u[p.section] = []), u[p.section].push(p);
1502
- return u;
1503
- }), a = {
1496
+ const t = W(), n = j();
1497
+ function i(d) {
1498
+ const r = t.selectedNode.value;
1499
+ r && n.updateKey(r.id, d.target.value);
1500
+ }
1501
+ const s = I(() => {
1502
+ const d = t.selectedNode.value;
1503
+ return d ? U(d.type) : null;
1504
+ }), o = I(() => {
1505
+ if (!s.value) return {};
1506
+ const d = {};
1507
+ for (const r of s.value.propertyFields)
1508
+ d[r.section] || (d[r.section] = []), d[r.section].push(r);
1509
+ return d;
1510
+ }), p = {
1504
1511
  content: "Content",
1505
1512
  style: "Style",
1506
1513
  layout: "Layout",
1507
1514
  advanced: "Advanced"
1508
- }, o = ["content", "style", "layout", "advanced"];
1509
- return (u, p) => k(t).selectedNode.value && n.value ? (s(), d("div", No, [
1510
- m("div", zo, w(n.value.icon) + " " + w(n.value.label), 1),
1511
- (s(), d(C, null, P(o, (c) => (s(), d(C, { key: c }, [
1512
- l.value[c] ? (s(), d("div", To, [
1513
- m("div", Do, w(a[c]), 1),
1514
- (s(!0), d(C, null, P(l.value[c], (r) => (s(), M(Ro, {
1515
- key: r.key,
1516
- descriptor: r,
1515
+ }, f = ["content", "style", "layout", "advanced"];
1516
+ return (d, r) => k(t).selectedNode.value && s.value ? (a(), c("div", No, [
1517
+ m("div", zo, w(s.value.icon) + " " + w(s.value.label), 1),
1518
+ m("div", To, [
1519
+ r[0] || (r[0] = m("label", { class: "brick-property-editor__key-label" }, "Key", -1)),
1520
+ m("input", {
1521
+ type: "text",
1522
+ class: "brick-property-editor__key-input",
1523
+ value: k(t).selectedNode.value.key ?? "",
1524
+ placeholder: "(optional identifier)",
1525
+ onInput: i
1526
+ }, null, 40, Do)
1527
+ ]),
1528
+ (a(), c(C, null, P(f, (l) => (a(), c(C, { key: l }, [
1529
+ o.value[l] ? (a(), c("div", Lo, [
1530
+ m("div", Mo, w(p[l]), 1),
1531
+ (a(!0), c(C, null, P(o.value[l], (u) => (a(), M(Ro, {
1532
+ key: u.key,
1533
+ descriptor: u,
1517
1534
  node: k(t).selectedNode.value
1518
1535
  }, null, 8, ["descriptor", "node"]))), 128))
1519
1536
  ])) : $("", !0)
1520
1537
  ], 64))), 64)),
1521
- (s(), M(te(n.value.propertyEditorComponent), {
1538
+ (a(), M(te(s.value.propertyEditorComponent), {
1522
1539
  node: k(t).selectedNode.value
1523
1540
  }, null, 8, ["node"]))
1524
1541
  ])) : $("", !0);
1525
1542
  }
1526
- }), Mo = /* @__PURE__ */ x(Lo, [["__scopeId", "data-v-4d129dac"]]), Bo = { class: "brick-toolbar" }, Oo = { class: "brick-toolbar__section" }, Ao = {
1543
+ }), Oo = /* @__PURE__ */ x(Bo, [["__scopeId", "data-v-e49ddc4f"]]), Ao = { class: "brick-toolbar" }, Vo = { class: "brick-toolbar__section" }, Fo = {
1527
1544
  key: 0,
1528
1545
  class: "brick-toolbar__section"
1529
- }, Vo = /* @__PURE__ */ _({
1546
+ }, Ho = /* @__PURE__ */ _({
1530
1547
  __name: "Toolbar",
1531
1548
  setup(e) {
1532
1549
  const t = W();
1533
- return (n, l) => (s(), d("div", Bo, [
1534
- m("div", Oo, [
1535
- l[0] || (l[0] = m("h3", { class: "brick-toolbar__title" }, "Elements", -1)),
1550
+ return (n, i) => (a(), c("div", Ao, [
1551
+ m("div", Vo, [
1552
+ i[0] || (i[0] = m("h3", { class: "brick-toolbar__title" }, "Elements", -1)),
1536
1553
  B(fo)
1537
1554
  ]),
1538
- k(t).selectedNode.value ? (s(), d("div", Ao, [
1539
- l[1] || (l[1] = m("h3", { class: "brick-toolbar__title" }, "Properties", -1)),
1540
- B(Mo)
1555
+ k(t).selectedNode.value ? (a(), c("div", Fo, [
1556
+ i[1] || (i[1] = m("h3", { class: "brick-toolbar__title" }, "Properties", -1)),
1557
+ B(Oo)
1541
1558
  ])) : $("", !0)
1542
1559
  ]));
1543
1560
  }
1544
- }), Ho = /* @__PURE__ */ x(Vo, [["__scopeId", "data-v-0174c069"]]), Fo = { class: "brick-actionbar" }, Jo = { class: "brick-actionbar__group" }, Uo = { class: "brick-actionbar__group" }, Wo = ["disabled"], jo = ["disabled"], Yo = ["disabled"], qo = { class: "brick-actionbar__group" }, Go = /* @__PURE__ */ _({
1561
+ }), Jo = /* @__PURE__ */ x(Ho, [["__scopeId", "data-v-0174c069"]]), Uo = { class: "brick-actionbar" }, Wo = { class: "brick-actionbar__group" }, jo = { class: "brick-actionbar__group" }, Yo = ["disabled"], qo = ["disabled"], Ko = ["disabled"], Go = { class: "brick-actionbar__group" }, Xo = /* @__PURE__ */ _({
1545
1562
  __name: "ActionBar",
1546
1563
  setup(e) {
1547
- const t = xt(), n = zt(), l = W(), a = q(), o = oe(), u = E("document"), p = E(null);
1548
- function c() {
1549
- const f = l.selectedId.value;
1550
- f && (l.deselect(), a.removeElement(f));
1564
+ const t = xt(), n = zt(), i = W(), s = j(), o = oe(), p = E("document"), f = E(null);
1565
+ function d() {
1566
+ const y = i.selectedId.value;
1567
+ y && (i.deselect(), s.removeElement(y));
1551
1568
  }
1552
1569
  function r() {
1553
- const f = u.value.trim() || "document", b = f.endsWith(".pdf") ? f : f + ".pdf";
1554
- n.exportPdf(b);
1570
+ const y = p.value.trim() || "document", g = y.endsWith(".pdf") ? y : y + ".pdf";
1571
+ n.exportPdf(g);
1555
1572
  }
1556
- function i() {
1557
- const f = o.exportDocument(), b = JSON.stringify(f, null, 2), v = new Blob([b], { type: "application/json" }), h = URL.createObjectURL(v), S = document.createElement("a"), R = u.value.trim() || "document";
1573
+ function l() {
1574
+ const y = o.exportDocument(), g = JSON.stringify(y, null, 2), v = new Blob([g], { type: "application/json" }), h = URL.createObjectURL(v), S = document.createElement("a"), R = p.value.trim() || "document";
1558
1575
  S.href = h, S.download = R.endsWith(".json") ? R : R + ".json", S.click(), URL.revokeObjectURL(h);
1559
1576
  }
1560
- function y() {
1561
- p.value?.click();
1577
+ function u() {
1578
+ f.value?.click();
1562
1579
  }
1563
- function g(f) {
1564
- const b = f.target, v = b.files?.[0];
1580
+ function b(y) {
1581
+ const g = y.target, v = g.files?.[0];
1565
1582
  if (!v) return;
1566
1583
  const h = new FileReader();
1567
1584
  h.onload = () => {
@@ -1571,54 +1588,54 @@ const Fn = {
1571
1588
  alert("Invalid brick-pdf JSON file.");
1572
1589
  return;
1573
1590
  }
1574
- l.deselect(), o.loadDocument(S);
1591
+ i.deselect(), o.loadDocument(S);
1575
1592
  } catch {
1576
1593
  alert("Failed to parse JSON file.");
1577
1594
  }
1578
- }, h.readAsText(v), b.value = "";
1595
+ }, h.readAsText(v), g.value = "";
1579
1596
  }
1580
- return (f, b) => (s(), d("div", Fo, [
1581
- m("div", Jo, [
1582
- K(m("input", {
1583
- "onUpdate:modelValue": b[0] || (b[0] = (v) => u.value = v),
1597
+ return (y, g) => (a(), c("div", Uo, [
1598
+ m("div", Wo, [
1599
+ X(m("input", {
1600
+ "onUpdate:modelValue": g[0] || (g[0] = (v) => p.value = v),
1584
1601
  class: "brick-actionbar__name",
1585
1602
  type: "text",
1586
1603
  placeholder: "Document name",
1587
1604
  title: "Document name (used for export filename)"
1588
1605
  }, null, 512), [
1589
- [De, u.value]
1606
+ [De, p.value]
1590
1607
  ])
1591
1608
  ]),
1592
- m("div", Uo, [
1609
+ m("div", jo, [
1593
1610
  m("button", {
1594
1611
  class: "brick-actionbar__btn",
1595
1612
  disabled: !k(t).canUndo.value,
1596
1613
  title: "Undo",
1597
- onClick: b[1] || (b[1] = (v) => k(t).undo())
1598
- }, " Undo ", 8, Wo),
1614
+ onClick: g[1] || (g[1] = (v) => k(t).undo())
1615
+ }, " Undo ", 8, Yo),
1599
1616
  m("button", {
1600
1617
  class: "brick-actionbar__btn",
1601
1618
  disabled: !k(t).canRedo.value,
1602
1619
  title: "Redo",
1603
- onClick: b[2] || (b[2] = (v) => k(t).redo())
1604
- }, " Redo ", 8, jo),
1620
+ onClick: g[2] || (g[2] = (v) => k(t).redo())
1621
+ }, " Redo ", 8, qo),
1605
1622
  m("button", {
1606
1623
  class: "brick-actionbar__btn brick-actionbar__btn--danger",
1607
- disabled: !k(l).selectedId.value,
1624
+ disabled: !k(i).selectedId.value,
1608
1625
  title: "Delete selected element",
1609
- onClick: c
1610
- }, " Delete ", 8, Yo)
1626
+ onClick: d
1627
+ }, " Delete ", 8, Ko)
1611
1628
  ]),
1612
- m("div", qo, [
1629
+ m("div", Go, [
1613
1630
  m("button", {
1614
1631
  class: "brick-actionbar__btn",
1615
1632
  title: "Import JSON",
1616
- onClick: y
1633
+ onClick: u
1617
1634
  }, " Import JSON "),
1618
1635
  m("button", {
1619
1636
  class: "brick-actionbar__btn",
1620
1637
  title: "Export JSON",
1621
- onClick: i
1638
+ onClick: l
1622
1639
  }, " Export JSON "),
1623
1640
  m("button", {
1624
1641
  class: "brick-actionbar__btn brick-actionbar__btn--primary",
@@ -1626,90 +1643,90 @@ const Fn = {
1626
1643
  }, " Export PDF "),
1627
1644
  m("button", {
1628
1645
  class: "brick-actionbar__btn",
1629
- onClick: b[3] || (b[3] = (v) => k(n).openPdf())
1646
+ onClick: g[3] || (g[3] = (v) => k(n).openPdf())
1630
1647
  }, " Preview ")
1631
1648
  ]),
1632
1649
  m("input", {
1633
1650
  ref_key: "fileInput",
1634
- ref: p,
1651
+ ref: f,
1635
1652
  type: "file",
1636
1653
  accept: ".json",
1637
1654
  style: { display: "none" },
1638
- onChange: g
1655
+ onChange: b
1639
1656
  }, null, 544)
1640
1657
  ]));
1641
1658
  }
1642
- }), Xo = /* @__PURE__ */ x(Go, [["__scopeId", "data-v-be915a0f"]]), Ko = { class: "brick-pdf" }, Qo = { class: "brick-pdf__workspace" }, Zo = /* @__PURE__ */ _({
1659
+ }), Qo = /* @__PURE__ */ x(Xo, [["__scopeId", "data-v-be915a0f"]]), Zo = { class: "brick-pdf" }, er = { class: "brick-pdf__workspace" }, tr = /* @__PURE__ */ _({
1643
1660
  __name: "BrickPdf",
1644
1661
  props: {
1645
1662
  modelValue: {}
1646
1663
  },
1647
1664
  emits: ["update:modelValue"],
1648
1665
  setup(e, { emit: t }) {
1649
- const n = e, l = t;
1650
- Hn();
1651
- const a = ft(n.modelValue ?? ne());
1652
- mt(a);
1653
- const o = yt(a);
1666
+ const n = e, i = t;
1667
+ Fn();
1668
+ const s = ft(n.modelValue ?? ne());
1669
+ yt(s);
1670
+ const o = mt(s);
1654
1671
  gt(o);
1655
- const u = kt(a);
1656
- St(u);
1657
- const p = vt(a, u);
1658
- ht(p);
1659
- const c = Ct(a, p);
1660
- wt(c);
1661
- const r = Rt(a);
1672
+ const p = kt(s);
1673
+ St(p);
1674
+ const f = vt(s, p);
1675
+ ht(f);
1676
+ const d = Ct(s, f);
1677
+ wt(d);
1678
+ const r = Rt(s);
1662
1679
  Nt(r);
1663
- const i = Lt(a, p);
1664
- Mt(i);
1665
- const y = Bt(p);
1666
- Ot(y);
1667
- const g = Me(), f = g.Delete, b = g.Backspace;
1668
- return ae(f, () => {
1680
+ const l = Lt(s, f);
1681
+ Mt(l);
1682
+ const u = Bt(f);
1683
+ Ot(u);
1684
+ const b = Me(), y = b.Delete, g = b.Backspace;
1685
+ return ae(y, () => {
1669
1686
  if (!o.selectedId.value) return;
1670
1687
  const v = document.activeElement;
1671
1688
  if (v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.tagName === "SELECT")) return;
1672
1689
  const h = o.selectedId.value;
1673
- o.deselect(), p.removeElement(h);
1674
- }), ae(b, () => {
1690
+ o.deselect(), f.removeElement(h);
1691
+ }), ae(g, () => {
1675
1692
  if (!o.selectedId.value) return;
1676
1693
  const v = document.activeElement;
1677
1694
  if (v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.tagName === "SELECT")) return;
1678
1695
  const h = o.selectedId.value;
1679
- o.deselect(), p.removeElement(h);
1696
+ o.deselect(), f.removeElement(h);
1680
1697
  }), Le(
1681
- () => a.document,
1698
+ () => s.document,
1682
1699
  () => {
1683
- l("update:modelValue", JSON.parse(JSON.stringify(J(a.document))));
1700
+ i("update:modelValue", JSON.parse(JSON.stringify(J(s.document))));
1684
1701
  },
1685
1702
  { deep: !0 }
1686
- ), (v, h) => (s(), d("div", Ko, [
1687
- B(Xo),
1688
- m("div", Qo, [
1703
+ ), (v, h) => (a(), c("div", Zo, [
1704
+ B(Qo),
1705
+ m("div", er, [
1689
1706
  B(so),
1690
- B(Ho)
1707
+ B(Jo)
1691
1708
  ])
1692
1709
  ]));
1693
1710
  }
1694
- }), er = /* @__PURE__ */ x(Zo, [["__scopeId", "data-v-f9b95ad8"]]), sr = {
1711
+ }), nr = /* @__PURE__ */ x(tr, [["__scopeId", "data-v-f9b95ad8"]]), cr = {
1695
1712
  install(e) {
1696
- e.component("BrickPdf", er);
1713
+ e.component("BrickPdf", nr);
1697
1714
  }
1698
1715
  };
1699
1716
  export {
1700
- er as BrickPdf,
1717
+ nr as BrickPdf,
1701
1718
  ne as createDefaultDocument,
1702
- sr as default,
1719
+ cr as default,
1703
1720
  Be as getAllElementDefinitions,
1704
1721
  U as getElementDefinition,
1705
1722
  z as registerElement,
1706
- rr as unregisterElement,
1707
- lr as useClipboard,
1723
+ ir as unregisterElement,
1724
+ sr as useClipboard,
1708
1725
  oe as useDocumentStore,
1709
1726
  xe as useDragDrop,
1710
- q as useElementActions,
1727
+ j as useElementActions,
1711
1728
  xt as useHistory,
1712
1729
  zt as usePdfExport,
1713
- ir as useResize,
1730
+ ar as useResize,
1714
1731
  W as useSelection
1715
1732
  };