brick-pdf 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/brick-pdf.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as _, openBlock as s, 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 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" };
@@ -43,7 +43,7 @@ const Fe = /* @__PURE__ */ _({
43
43
  node: {}
44
44
  },
45
45
  setup(e) {
46
- return (t, n) => (s(), c("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,8 +60,8 @@ const Fe = /* @__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
66
  }, He = /* @__PURE__ */ x(Fe, [["__scopeId", "data-v-a7cd1565"]]), Je = { class: "brick-text-editor" }, Ue = /* @__PURE__ */ _({
67
67
  __name: "TextPropertyEditor",
@@ -69,7 +69,7 @@ const Fe = /* @__PURE__ */ _({
69
69
  node: {}
70
70
  },
71
71
  setup(e) {
72
- return (t, n) => (s(), c("div", Je));
72
+ return (t, n) => (a(), c("div", Je));
73
73
  }
74
74
  }), We = {
75
75
  type: "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(), c("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(), c("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(), c("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(), c("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(), c("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), c(C, null, P(e.node.props.body.slice(0, e.node.props.headerRows), (l, a) => (s(), c("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), c(C, null, P(l, (o, u) => (s(), c("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), c(C, null, P(e.node.props.body.slice(e.node.props.headerRows), (l, a) => (s(), c("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), c(C, null, P(l, (o, u) => (s(), c("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
  ])
@@ -282,38 +282,38 @@ function ft(e) {
282
282
  const t = e ? de(e) : ne();
283
283
  for (const d of t.content) Q(d);
284
284
  const n = ze(t);
285
- function l(d, 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 === d)
291
- return { node: g, parent: i, index: y };
292
- if (g.children.length > 0) {
293
- const f = l(d, 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(d) {
300
+ function s(d) {
301
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(d) {
306
+ function p(d) {
307
307
  const r = de(d);
308
- for (const i of r.content) Q(i);
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);
@@ -342,71 +342,75 @@ function W() {
342
342
  throw new Error("useSelection() requires a BrickPdf ancestor component");
343
343
  return e;
344
344
  }
345
- const he = /* @__PURE__ */ Symbol("brick-pdf-element-actions");
345
+ const ve = /* @__PURE__ */ Symbol("brick-pdf-element-actions");
346
346
  let bt = 0;
347
- function ve() {
347
+ function he() {
348
348
  return `el-${Date.now()}-${++bt}`;
349
349
  }
350
350
  function _e(e) {
351
351
  return {
352
352
  ...e,
353
- id: ve(),
353
+ id: he(),
354
354
  props: structuredClone(e.props),
355
355
  style: structuredClone(e.style),
356
356
  children: e.children.map(_e)
357
357
  };
358
358
  }
359
- function ht(e, t) {
360
- function n(d, r, i) {
361
- const y = U(d);
362
- if (!y) return null;
359
+ function vt(e, t) {
360
+ function n(r, l, u) {
361
+ const b = U(r);
362
+ if (!b) return null;
363
363
  t.record();
364
- const g = {
365
- id: ve(),
366
- type: d,
367
- props: y.defaultProps(),
368
- style: y.defaultStyle(),
364
+ const y = {
365
+ id: he(),
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(d) {
376
- const r = e.findNodeById(d);
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(d, r, i) {
380
- const y = e.findNodeById(d);
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(d) {
389
- const r = e.findNodeById(d);
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(d, r) {
396
- const i = e.findNodeById(d);
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(d, r) {
400
- const i = e.findNodeById(d);
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
- function vt(e) {
406
- D(he, e);
409
+ function ht(e) {
410
+ D(ve, e);
407
411
  }
408
- function q() {
409
- const e = L(he);
412
+ function j() {
413
+ const e = L(ve);
410
414
  if (!e)
411
415
  throw new Error("useElementActions() requires a BrickPdf ancestor component");
412
416
  return e;
@@ -414,16 +418,16 @@ 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
  }
@@ -431,7 +435,7 @@ function kt(e) {
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: d };
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 d = p.item, r = d.dataset.elementId, i = d.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 (d.parentNode?.removeChild(d), 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 && (d.parentNode?.removeChild(d), !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 d = u ? e.findNodeById(u)?.node.children : e.document.content;
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;
490
494
  if (!d) return;
491
- const r = d.splice(p.oldIndex, 1)[0];
492
- r && d.splice(p.newIndex, 0, r);
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);
@@ -574,8 +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, d = u.pdfMake?.vfs ?? u.default ?? {}, r = await It();
578
- return p.addVirtualFileSystem({ ...d, ...r.vfs }), p.setFonts({
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({
579
583
  Roboto: {
580
584
  normal: "Roboto-Regular.ttf",
581
585
  bold: "Roboto-Medium.ttf",
@@ -583,21 +587,21 @@ function Rt(e) {
583
587
  bolditalics: "Roboto-MediumItalic.ttf"
584
588
  },
585
589
  ...r.fonts
586
- }), p;
590
+ }), f;
587
591
  }
588
- function l(o) {
589
- const u = t();
590
- n().then((p) => {
591
- 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");
592
596
  });
593
597
  }
594
- function a() {
598
+ function s() {
595
599
  const o = t();
596
- n().then((u) => {
597
- u.createPdf(o).open();
600
+ n().then((p) => {
601
+ p.createPdf(o).open();
598
602
  });
599
603
  }
600
- return { toDocumentDefinition: t, exportPdf: l, openPdf: a };
604
+ return { toDocumentDefinition: t, exportPdf: i, openPdf: s };
601
605
  }
602
606
  function Nt(e) {
603
607
  D(Ce, e);
@@ -623,27 +627,27 @@ function Ee(e) {
623
627
  };
624
628
  }
625
629
  function Lt(e, t) {
626
- const n = E(null), l = E(!1), a = E(null), o = E(!1);
627
- function u(r) {
628
- const i = e.findNodeById(r);
629
- i && (n.value = structuredClone(i.node), l.value = !1, a.value = null, o.value = !0);
630
- }
630
+ const n = E(null), i = E(!1), s = E(null), o = E(!1);
631
631
  function p(r) {
632
- const i = e.findNodeById(r);
633
- 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);
634
+ }
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);
634
638
  }
635
639
  function d(r) {
636
640
  if (!n.value) return;
637
- l.value && a.value && (t.removeElement(a.value), l.value = !1, a.value = null);
638
- const i = Ee(n.value), y = r ? e.findNodeById(r)?.node.children : e.document.content;
639
- 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));
640
644
  }
641
- return { hasClipboard: o, copy: u, cut: p, paste: d };
645
+ return { hasClipboard: o, copy: p, cut: f, paste: d };
642
646
  }
643
647
  function Mt(e) {
644
648
  D(Pe, e);
645
649
  }
646
- function lr() {
650
+ function sr() {
647
651
  const e = L(Pe);
648
652
  if (!e)
649
653
  throw new Error("useClipboard() requires a BrickPdf ancestor component");
@@ -652,28 +656,28 @@ function lr() {
652
656
  const Ie = /* @__PURE__ */ Symbol("brick-pdf-resize");
653
657
  function Bt(e) {
654
658
  const t = E(!1);
655
- function n(l, a, o, u) {
659
+ function n(i, s, o, p) {
656
660
  t.value = !0;
657
- const p = u.clientX, d = u.clientY, r = o.width, i = o.height;
658
- function y(f) {
659
- const b = f.clientX - p, h = f.clientY - d;
660
- let v = r, S = i;
661
- a.includes("e") && (v = r + b), a.includes("w") && (v = r - b), a.includes("s") && (S = i + h), a.includes("n") && (S = i - h), v = Math.max(20, v), S = Math.max(20, S), e.updateStyle(l, {
662
- width: Math.round(v),
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, {
666
+ width: Math.round(h),
663
667
  height: Math.round(S)
664
668
  });
665
669
  }
666
- function g() {
667
- 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);
668
672
  }
669
- document.addEventListener("pointermove", y), document.addEventListener("pointerup", g);
673
+ document.addEventListener("pointermove", u), document.addEventListener("pointerup", b);
670
674
  }
671
675
  return { isResizing: t, startResize: n };
672
676
  }
673
677
  function Ot(e) {
674
678
  D(Ie, e);
675
679
  }
676
- function ir() {
680
+ function ar() {
677
681
  const e = L(Ie);
678
682
  if (!e)
679
683
  throw new Error("useResize() requires a BrickPdf ancestor component");
@@ -685,44 +689,44 @@ const At = { class: "brick-table-editor" }, Vt = { class: "brick-table-editor__g
685
689
  node: {}
686
690
  },
687
691
  setup(e) {
688
- const t = e, n = q();
689
- function l() {
692
+ const t = e, n = j();
693
+ function i() {
690
694
  return t.node.props.body ?? [];
691
695
  }
692
- function a() {
696
+ function s() {
693
697
  return t.node.props.widths ?? [];
694
698
  }
695
- function o(i, y, g) {
696
- const f = l().map((b) => [...b]);
697
- 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 });
698
702
  }
699
- function u() {
700
- const i = l().map((g) => [...g]), y = i[0]?.length ?? 2;
701
- 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 });
702
706
  }
703
- function p(i) {
704
- const y = l().map((f) => [...f]);
705
- if (y.length <= 1) return;
706
- 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 });
707
711
  }
708
712
  function d() {
709
- const i = l().map((g) => [...g, ""]), y = [...a(), "*"];
710
- n.updateProps(t.node.id, { body: i, widths: y });
713
+ const l = i().map((b) => [...b, ""]), u = [...s(), "*"];
714
+ n.updateProps(t.node.id, { body: l, widths: u });
711
715
  }
712
- function r(i) {
713
- const y = l().map((f) => {
714
- const b = [...f];
715
- 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;
716
720
  });
717
- if ((y[0]?.length ?? 0) < 1) return;
718
- const g = [...a()];
719
- 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 });
720
724
  }
721
- return (i, y) => (s(), c("div", At, [
725
+ return (l, u) => (a(), c("div", At, [
722
726
  m("div", { class: "brick-table-editor__actions" }, [
723
727
  m("button", {
724
728
  class: "brick-table-editor__btn",
725
- onClick: u
729
+ onClick: p
726
730
  }, "+ Row"),
727
731
  m("button", {
728
732
  class: "brick-table-editor__btn",
@@ -733,38 +737,38 @@ const At = { class: "brick-table-editor" }, Vt = { class: "brick-table-editor__g
733
737
  m("table", null, [
734
738
  m("thead", null, [
735
739
  m("tr", null, [
736
- y[0] || (y[0] = m("th", { class: "brick-table-editor__corner" }, null, -1)),
737
- (s(!0), c(C, null, P(l()[0] ?? [], (g, f) => (s(), c("th", {
738
- 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,
739
743
  class: "brick-table-editor__col-header"
740
744
  }, [
741
- ie(" Col " + w(f + 1) + " ", 1),
742
- (l()[0]?.length ?? 0) > 1 ? (s(), c("button", {
745
+ ie(" Col " + w(y + 1) + " ", 1),
746
+ (i()[0]?.length ?? 0) > 1 ? (a(), c("button", {
743
747
  key: 0,
744
748
  class: "brick-table-editor__remove-btn",
745
749
  title: "Remove column",
746
- onClick: (b) => r(f)
750
+ onClick: (g) => r(y)
747
751
  }, "x", 8, Ft)) : $("", !0)
748
752
  ]))), 128))
749
753
  ])
750
754
  ]),
751
755
  m("tbody", null, [
752
- (s(!0), c(C, null, P(l(), (g, f) => (s(), c("tr", { key: f }, [
756
+ (a(!0), c(C, null, P(i(), (b, y) => (a(), c("tr", { key: y }, [
753
757
  m("td", Ht, [
754
- ie(w(f + 1) + " ", 1),
755
- l().length > 1 ? (s(), c("button", {
758
+ ie(w(y + 1) + " ", 1),
759
+ i().length > 1 ? (a(), c("button", {
756
760
  key: 0,
757
761
  class: "brick-table-editor__remove-btn",
758
762
  title: "Remove row",
759
- onClick: (b) => p(f)
763
+ onClick: (g) => f(y)
760
764
  }, "x", 8, Jt)) : $("", !0)
761
765
  ]),
762
- (s(!0), c(C, null, P(g, (b, h) => (s(), c("td", { key: h }, [
766
+ (a(!0), c(C, null, P(b, (g, v) => (a(), c("td", { key: v }, [
763
767
  m("input", {
764
768
  class: "brick-table-editor__cell",
765
769
  type: "text",
766
- value: b,
767
- onInput: (v) => o(f, h, v.target.value)
770
+ value: g,
771
+ onInput: (h) => o(y, v, h.target.value)
768
772
  }, null, 40, Ut)
769
773
  ]))), 128))
770
774
  ]))), 128))
@@ -800,16 +804,16 @@ const At = { class: "brick-table-editor" }, Vt = { class: "brick-table-editor__g
800
804
  function qt() {
801
805
  return { src: "", width: 200, height: 150, fit: null };
802
806
  }
803
- function Gt() {
807
+ function Kt() {
804
808
  return {};
805
809
  }
806
- function Xt(e) {
810
+ function Gt(e) {
807
811
  const t = {
808
812
  image: e.props.src
809
813
  };
810
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;
811
815
  }
812
- const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
816
+ const Xt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
813
817
  key: 1,
814
818
  class: "brick-el-image__placeholder"
815
819
  }, en = /* @__PURE__ */ _({
@@ -818,8 +822,8 @@ const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
818
822
  node: {}
819
823
  },
820
824
  setup(e) {
821
- return (t, n) => (s(), c("div", Kt, [
822
- e.node.props.src ? (s(), c("img", {
825
+ return (t, n) => (a(), c("div", Xt, [
826
+ e.node.props.src ? (a(), c("img", {
823
827
  key: 0,
824
828
  src: e.node.props.src,
825
829
  style: N({
@@ -828,7 +832,7 @@ const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
828
832
  objectFit: "contain",
829
833
  opacity: e.node.style.opacity
830
834
  })
831
- }, null, 12, Qt)) : (s(), c("div", Zt, " No image selected "))
835
+ }, null, 12, Qt)) : (a(), c("div", Zt, " No image selected "))
832
836
  ]));
833
837
  }
834
838
  }), tn = /* @__PURE__ */ x(en, [["__scopeId", "data-v-38184258"]]), nn = { class: "brick-image-editor" }, on = /* @__PURE__ */ _({
@@ -837,7 +841,7 @@ const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
837
841
  node: {}
838
842
  },
839
843
  setup(e) {
840
- return (t, n) => (s(), c("div", nn));
844
+ return (t, n) => (a(), c("div", nn));
841
845
  }
842
846
  }), rn = {
843
847
  type: "image",
@@ -845,7 +849,7 @@ const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
845
849
  icon: "🖼",
846
850
  isContainer: !1,
847
851
  defaultProps: qt,
848
- defaultStyle: Gt,
852
+ defaultStyle: Kt,
849
853
  rendererComponent: tn,
850
854
  propertyEditorComponent: on,
851
855
  propertyFields: [
@@ -860,7 +864,7 @@ const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
860
864
  { key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] },
861
865
  { key: "style.opacity", label: "Opacity", section: "advanced", type: "slider", min: 0, max: 1, step: 0.1, defaultValue: 1 }
862
866
  ],
863
- toPdfmake: Xt
867
+ toPdfmake: Gt
864
868
  };
865
869
  function ln() {
866
870
  return { ordered: !1, items: ["Item 1", "Item 2", "Item 3"] };
@@ -869,8 +873,8 @@ function sn() {
869
873
  return { fontSize: 12 };
870
874
  }
871
875
  function an(e) {
872
- const t = e.props.items, l = e.props.ordered ? { ol: t } : { ul: t };
873
- 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;
874
878
  }
875
879
  const cn = /* @__PURE__ */ _({
876
880
  __name: "ListRenderer",
@@ -878,13 +882,13 @@ const cn = /* @__PURE__ */ _({
878
882
  node: {}
879
883
  },
880
884
  setup(e) {
881
- return (t, n) => (s(), c("div", {
885
+ return (t, n) => (a(), c("div", {
882
886
  class: "brick-el-list",
883
887
  style: N({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
884
888
  }, [
885
- (s(), M(te(e.node.props.ordered ? "ol" : "ul"), null, {
886
- default: j(() => [
887
- (s(!0), c(C, null, P(e.node.props.items, (l, a) => (s(), c("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))
888
892
  ]),
889
893
  _: 1
890
894
  }))
@@ -896,7 +900,7 @@ const cn = /* @__PURE__ */ _({
896
900
  node: {}
897
901
  },
898
902
  setup(e) {
899
- return (t, n) => (s(), c("div", un));
903
+ return (t, n) => (a(), c("div", un));
900
904
  }
901
905
  }), fn = {
902
906
  type: "list",
@@ -918,10 +922,10 @@ Item 3` },
918
922
  ],
919
923
  toPdfmake: an
920
924
  };
921
- function mn() {
925
+ function yn() {
922
926
  return { data: "https://example.com", fit: 100 };
923
927
  }
924
- function yn() {
928
+ function mn() {
925
929
  return {};
926
930
  }
927
931
  function gn(e) {
@@ -931,13 +935,13 @@ function gn(e) {
931
935
  };
932
936
  return e.style.alignment && (t.alignment = e.style.alignment), e.style.margin && (t.margin = e.style.margin), t;
933
937
  }
934
- const bn = { class: "brick-el-qr__preview" }, hn = /* @__PURE__ */ _({
938
+ const bn = { class: "brick-el-qr__preview" }, vn = /* @__PURE__ */ _({
935
939
  __name: "QrRenderer",
936
940
  props: {
937
941
  node: {}
938
942
  },
939
943
  setup(e) {
940
- return (t, n) => (s(), c("div", {
944
+ return (t, n) => (a(), c("div", {
941
945
  class: "brick-el-qr",
942
946
  style: N({
943
947
  width: (e.node.props.fit ?? 100) + "px",
@@ -947,22 +951,22 @@ const bn = { class: "brick-el-qr__preview" }, hn = /* @__PURE__ */ _({
947
951
  m("div", bn, "QR: " + w(e.node.props.data), 1)
948
952
  ], 4));
949
953
  }
950
- }), vn = /* @__PURE__ */ x(hn, [["__scopeId", "data-v-f106ba48"]]), _n = { class: "brick-qr-editor" }, kn = /* @__PURE__ */ _({
954
+ }), hn = /* @__PURE__ */ x(vn, [["__scopeId", "data-v-f106ba48"]]), _n = { class: "brick-qr-editor" }, kn = /* @__PURE__ */ _({
951
955
  __name: "QrPropertyEditor",
952
956
  props: {
953
957
  node: {}
954
958
  },
955
959
  setup(e) {
956
- return (t, n) => (s(), c("div", _n));
960
+ return (t, n) => (a(), c("div", _n));
957
961
  }
958
962
  }), Sn = {
959
963
  type: "qr",
960
964
  label: "QR Code",
961
965
  icon: "⊞",
962
966
  isContainer: !1,
963
- defaultProps: mn,
964
- defaultStyle: yn,
965
- rendererComponent: vn,
967
+ defaultProps: yn,
968
+ defaultStyle: mn,
969
+ rendererComponent: hn,
966
970
  propertyEditorComponent: kn,
967
971
  propertyFields: [
968
972
  { key: "props.data", label: "QR Data", section: "content", type: "text", defaultValue: "https://example.com" },
@@ -998,7 +1002,7 @@ const Pn = ["innerHTML"], En = /* @__PURE__ */ _({
998
1002
  node: {}
999
1003
  },
1000
1004
  setup(e) {
1001
- return (t, n) => (s(), c("div", {
1005
+ return (t, n) => (a(), c("div", {
1002
1006
  class: "brick-el-svg",
1003
1007
  style: N({
1004
1008
  width: e.node.props.width + "px",
@@ -1013,7 +1017,7 @@ const Pn = ["innerHTML"], En = /* @__PURE__ */ _({
1013
1017
  node: {}
1014
1018
  },
1015
1019
  setup(e) {
1016
- return (t, n) => (s(), c("div", $n));
1020
+ return (t, n) => (a(), c("div", $n));
1017
1021
  }
1018
1022
  }), Nn = {
1019
1023
  type: "svg",
@@ -1052,7 +1056,7 @@ const Ln = { class: "brick-el-pagebreak" }, Mn = /* @__PURE__ */ _({
1052
1056
  node: {}
1053
1057
  },
1054
1058
  setup(e) {
1055
- return (t, n) => (s(), c("div", Ln, [...n[0] || (n[0] = [
1059
+ return (t, n) => (a(), c("div", Ln, [...n[0] || (n[0] = [
1056
1060
  m("hr", null, null, -1),
1057
1061
  m("span", null, "Page Break", -1),
1058
1062
  m("hr", null, null, -1)
@@ -1064,7 +1068,7 @@ const Ln = { class: "brick-el-pagebreak" }, Mn = /* @__PURE__ */ _({
1064
1068
  node: {}
1065
1069
  },
1066
1070
  setup(e) {
1067
- return (t, n) => (s(), c("div", On, [...n[0] || (n[0] = [
1071
+ return (t, n) => (a(), c("div", On, [...n[0] || (n[0] = [
1068
1072
  m("p", { style: { color: "#999", "font-size": "12px" } }, "No configurable properties.", -1)
1069
1073
  ])]));
1070
1074
  }
@@ -1095,19 +1099,19 @@ const Hn = {
1095
1099
  },
1096
1100
  setup(e) {
1097
1101
  const t = e, n = E(null);
1098
- let l = null;
1099
- const a = xe(), { isDragging: o } = a;
1100
- return me(() => {
1101
- n.value && (l = a.initContainer(n.value, t.parentId));
1102
- }), ye(() => {
1103
- l?.destroy();
1104
- }), (u, p) => (s(), c("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", {
1105
1109
  ref_key: "el",
1106
1110
  ref: n,
1107
1111
  class: ee(["brick-dropzone", { "brick-dropzone--horizontal": e.layout === "horizontal", "brick-dropzone--drag-active": k(o) && e.layout === "horizontal" }])
1108
1112
  }, [
1109
- Z(u.$slots, "default", {}, void 0, !0),
1110
- u.$slots.default ? $("", !0) : (s(), c("div", Hn, " Drop elements here "))
1113
+ Z(p.$slots, "default", {}, void 0, !0),
1114
+ p.$slots.default ? $("", !0) : (a(), c("div", Hn, " Drop elements here "))
1111
1115
  ], 2));
1112
1116
  }
1113
1117
  }), $e = /* @__PURE__ */ x(Jn, [["__scopeId", "data-v-b9596dad"]]), Un = ["data-element-id", "data-element-type"], Wn = {
@@ -1120,52 +1124,52 @@ const Hn = {
1120
1124
  path: {}
1121
1125
  },
1122
1126
  setup(e) {
1123
- 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), d = I(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.height" || f.key === "style.height") : !1);
1124
- function r(f) {
1125
- 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);
1126
1130
  }
1127
- function i(f) {
1128
- f.stopPropagation(), f.preventDefault();
1129
- const b = f.clientX, h = a.value?.offsetWidth ?? 200;
1130
- function v(R) {
1131
- const O = R.clientX - b, T = Math.max(20, h + O);
1132
- o.value?.propertyFields.some((F) => F.key === "props.width") ? l.updateProps(t.node.id, { width: Math.round(T) }) : l.updateStyle(t.node.id, { width: Math.round(T) });
1131
+ function l(y) {
1132
+ y.stopPropagation(), y.preventDefault();
1133
+ const g = y.clientX, v = s.value?.offsetWidth ?? 200;
1134
+ function h(R) {
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) });
1133
1137
  }
1134
1138
  function S() {
1135
- document.removeEventListener("pointermove", v), document.removeEventListener("pointerup", S), document.body.style.cursor = "", document.body.style.userSelect = "";
1139
+ document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", S), document.body.style.cursor = "", document.body.style.userSelect = "";
1136
1140
  }
1137
- document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", v), document.addEventListener("pointerup", S);
1141
+ document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", S);
1138
1142
  }
1139
- function y(f) {
1140
- f.stopPropagation(), f.preventDefault();
1141
- const b = f.clientY, h = a.value?.offsetHeight ?? 100;
1142
- function v(R) {
1143
- const O = R.clientY - b, T = Math.max(20, h + O);
1144
- o.value?.propertyFields.some((F) => F.key === "props.height") ? l.updateProps(t.node.id, { height: Math.round(T) }) : l.updateStyle(t.node.id, { height: Math.round(T) });
1143
+ function u(y) {
1144
+ y.stopPropagation(), y.preventDefault();
1145
+ const g = y.clientY, v = s.value?.offsetHeight ?? 100;
1146
+ function h(R) {
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) });
1145
1149
  }
1146
1150
  function S() {
1147
- document.removeEventListener("pointermove", v), document.removeEventListener("pointerup", S), document.body.style.cursor = "", document.body.style.userSelect = "";
1151
+ document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", S), document.body.style.cursor = "", document.body.style.userSelect = "";
1148
1152
  }
1149
- document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", v), document.addEventListener("pointerup", S);
1153
+ document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", S);
1150
1154
  }
1151
- function g(f) {
1152
- f.stopPropagation(), f.preventDefault();
1153
- const b = f.clientX, h = f.clientY, v = 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;
1154
1158
  function R(T) {
1155
- const G = T.clientX - b, F = T.clientY - h, re = Math.max(20, v + G), le = Math.max(20, S + F), Re = o.value?.propertyFields.some((X) => X.key === "props.width"), Ne = o.value?.propertyFields.some((X) => X.key === "props.height");
1156
- 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) });
1157
1161
  }
1158
1162
  function O() {
1159
1163
  document.removeEventListener("pointermove", R), document.removeEventListener("pointerup", O), document.body.style.cursor = "", document.body.style.userSelect = "";
1160
1164
  }
1161
1165
  document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", R), document.addEventListener("pointerup", O);
1162
1166
  }
1163
- return (f, b) => {
1164
- const h = Te("CanvasElement", !0);
1165
- return s(), c("div", {
1167
+ return (y, g) => {
1168
+ const v = Te("CanvasElement", !0);
1169
+ return a(), c("div", {
1166
1170
  ref_key: "elRef",
1167
- ref: a,
1168
- 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 }]),
1169
1173
  "data-element-id": e.node.id,
1170
1174
  "data-element-type": e.node.type,
1171
1175
  style: N({
@@ -1179,21 +1183,21 @@ const Hn = {
1179
1183
  }),
1180
1184
  onClick: r
1181
1185
  }, [
1182
- o.value ? (s(), M(te(o.value.rendererComponent), {
1186
+ o.value ? (a(), M(te(o.value.rendererComponent), {
1183
1187
  key: 0,
1184
1188
  node: e.node,
1185
1189
  path: e.path
1186
1190
  }, {
1187
- default: j(() => [
1188
- o.value.isContainer ? (s(), M($e, {
1191
+ default: Y(() => [
1192
+ o.value.isContainer ? (a(), M($e, {
1189
1193
  key: 0,
1190
1194
  "parent-id": e.node.id,
1191
1195
  layout: e.node.type === "columns" ? "horizontal" : "vertical"
1192
1196
  }, {
1193
- default: j(() => [
1194
- (s(!0), c(C, null, P(e.node.children, (v, S) => (s(), M(h, {
1195
- key: v.id,
1196
- node: v,
1197
+ default: Y(() => [
1198
+ (a(!0), c(C, null, P(e.node.children, (h, S) => (a(), M(v, {
1199
+ key: h.id,
1200
+ node: h,
1197
1201
  path: [...e.path, S]
1198
1202
  }, null, 8, ["node", "path"]))), 128))
1199
1203
  ]),
@@ -1201,28 +1205,28 @@ const Hn = {
1201
1205
  }, 8, ["parent-id", "layout"])) : $("", !0)
1202
1206
  ]),
1203
1207
  _: 1
1204
- }, 8, ["node", "path"])) : (s(), c("div", Wn, " Unknown element: " + w(e.node.type), 1)),
1205
- u.value ? (s(), c(C, { key: 2 }, [
1206
- p.value ? (s(), c("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", {
1207
1211
  key: 0,
1208
1212
  class: "brick-resize-handle brick-resize-handle--e",
1209
- onPointerdown: i
1213
+ onPointerdown: l
1210
1214
  }, null, 32)) : $("", !0),
1211
- d.value ? (s(), c("div", {
1215
+ d.value ? (a(), c("div", {
1212
1216
  key: 1,
1213
1217
  class: "brick-resize-handle brick-resize-handle--s",
1214
- onPointerdown: y
1218
+ onPointerdown: u
1215
1219
  }, null, 32)) : $("", !0),
1216
- p.value && d.value ? (s(), c("div", {
1220
+ f.value && d.value ? (a(), c("div", {
1217
1221
  key: 2,
1218
1222
  class: "brick-resize-handle brick-resize-handle--se",
1219
- onPointerdown: g
1223
+ onPointerdown: b
1220
1224
  }, null, 32)) : $("", !0)
1221
1225
  ], 64)) : $("", !0)
1222
1226
  ], 14, Un);
1223
1227
  };
1224
1228
  }
1225
- }), 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__ */ _({
1226
1230
  __name: "DocumentSettings",
1227
1231
  setup(e) {
1228
1232
  const t = oe(), n = [
@@ -1232,28 +1236,28 @@ const Hn = {
1232
1236
  { label: "Letter", value: "LETTER" },
1233
1237
  { label: "Legal", value: "LEGAL" }
1234
1238
  ];
1235
- function l(a, o) {
1236
- const u = [...t.document.pageMargins];
1237
- 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;
1238
1242
  }
1239
- return (a, o) => (s(), c("div", qn, [
1240
- m("div", Gn, [
1243
+ return (s, o) => (a(), c("div", qn, [
1244
+ m("div", Kn, [
1241
1245
  o[3] || (o[3] = m("label", null, "Size", -1)),
1242
- K(m("select", {
1243
- "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)
1244
1248
  }, [
1245
- (s(), c(C, null, P(n, (u) => m("option", {
1246
- key: u.value,
1247
- value: u.value
1248
- }, 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))
1249
1253
  ], 512), [
1250
1254
  [se, k(t).document.pageSize]
1251
1255
  ])
1252
1256
  ]),
1253
- m("div", Kn, [
1257
+ m("div", Xn, [
1254
1258
  o[5] || (o[5] = m("label", null, "Orientation", -1)),
1255
- K(m("select", {
1256
- "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)
1257
1261
  }, [...o[4] || (o[4] = [
1258
1262
  m("option", { value: "portrait" }, "Portrait", -1),
1259
1263
  m("option", { value: "landscape" }, "Landscape", -1)
@@ -1264,13 +1268,13 @@ const Hn = {
1264
1268
  m("div", Qn, [
1265
1269
  o[6] || (o[6] = m("label", null, "Margins", -1)),
1266
1270
  m("div", Zn, [
1267
- (s(), c(C, null, P(["L", "T", "R", "B"], (u, p) => m("input", {
1268
- key: p,
1271
+ (a(), c(C, null, P(["L", "T", "R", "B"], (p, f) => m("input", {
1272
+ key: f,
1269
1273
  type: "number",
1270
- placeholder: u,
1271
- title: u,
1272
- value: k(t).document.pageMargins[p],
1273
- onInput: (d) => l(p, Number(d.target.value))
1274
+ placeholder: p,
1275
+ title: p,
1276
+ value: k(t).document.pageMargins[f],
1277
+ onInput: (d) => i(f, Number(d.target.value))
1274
1278
  }, null, 40, eo)), 64))
1275
1279
  ])
1276
1280
  ]),
@@ -1281,7 +1285,7 @@ const Hn = {
1281
1285
  value: k(t).document.defaultStyle?.fontSize ?? 12,
1282
1286
  min: "6",
1283
1287
  max: "72",
1284
- 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))
1285
1289
  }, null, 40, no)
1286
1290
  ])
1287
1291
  ]));
@@ -1289,32 +1293,32 @@ const Hn = {
1289
1293
  }), ro = /* @__PURE__ */ x(oo, [["__scopeId", "data-v-39a2b54f"]]), lo = { class: "brick-canvas" }, V = 0.75, io = /* @__PURE__ */ _({
1290
1294
  __name: "DesignCanvas",
1291
1295
  setup(e) {
1292
- const t = oe(), n = W(), l = {
1296
+ const t = oe(), n = W(), i = {
1293
1297
  A3: [841.89, 1190.55],
1294
1298
  A4: [595.28, 841.89],
1295
1299
  A5: [419.53, 595.28],
1296
1300
  LETTER: [612, 792],
1297
1301
  LEGAL: [612, 1008]
1298
- }, a = I(() => {
1299
- const [p, d] = l[t.document.pageSize] ?? l.A4, r = t.document.pageOrientation === "landscape" ? d : p;
1302
+ }, s = I(() => {
1303
+ const [f, d] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? d : f;
1300
1304
  return Math.round(r * V);
1301
1305
  }), o = I(() => {
1302
- const [p, d] = l[t.document.pageSize] ?? l.A4, r = t.document.pageOrientation === "landscape" ? p : d;
1306
+ const [f, d] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? f : d;
1303
1307
  return Math.round(r * V);
1304
1308
  });
1305
- function u(p) {
1306
- (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();
1307
1311
  }
1308
- return (p, d) => (s(), c("div", lo, [
1312
+ return (f, d) => (a(), c("div", lo, [
1309
1313
  B(ro),
1310
1314
  m("div", {
1311
1315
  class: "brick-canvas__scroll",
1312
- onClick: u
1316
+ onClick: p
1313
1317
  }, [
1314
1318
  m("div", {
1315
1319
  class: "brick-canvas__page",
1316
1320
  style: N({
1317
- width: a.value + "px",
1321
+ width: s.value + "px",
1318
1322
  minHeight: o.value + "px",
1319
1323
  paddingTop: k(t).document.pageMargins[1] * V + "px",
1320
1324
  paddingRight: k(t).document.pageMargins[2] * V + "px",
@@ -1323,11 +1327,11 @@ const Hn = {
1323
1327
  })
1324
1328
  }, [
1325
1329
  B($e, { "parent-id": null }, {
1326
- default: j(() => [
1327
- (s(!0), c(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, {
1328
1332
  key: r.id,
1329
1333
  node: r,
1330
- path: [i]
1334
+ path: [l]
1331
1335
  }, null, 8, ["node", "path"]))), 128))
1332
1336
  ]),
1333
1337
  _: 1
@@ -1341,27 +1345,27 @@ const Hn = {
1341
1345
  setup(e) {
1342
1346
  const t = E(null);
1343
1347
  let n = null;
1344
- const l = xe(), a = Be();
1345
- return me(() => {
1346
- t.value && (n = l.initToolbar(t.value));
1347
- }), ye(() => {
1348
+ const i = xe(), s = Be();
1349
+ return ye(() => {
1350
+ t.value && (n = i.initToolbar(t.value));
1351
+ }), me(() => {
1348
1352
  n?.destroy();
1349
- }), (o, u) => (s(), c("div", {
1353
+ }), (o, p) => (a(), c("div", {
1350
1354
  ref_key: "el",
1351
1355
  ref: t,
1352
1356
  class: "brick-element-list"
1353
1357
  }, [
1354
- (s(!0), c(C, null, P(k(a), (p) => (s(), c("div", {
1355
- key: p.type,
1358
+ (a(!0), c(C, null, P(k(s), (f) => (a(), c("div", {
1359
+ key: f.type,
1356
1360
  class: "brick-element-list__item",
1357
- "data-element-type": p.type
1361
+ "data-element-type": f.type
1358
1362
  }, [
1359
- m("span", co, w(p.icon), 1),
1360
- m("span", uo, w(p.label), 1)
1363
+ m("span", co, w(f.icon), 1),
1364
+ m("span", uo, w(f.label), 1)
1361
1365
  ], 8, ao))), 128))
1362
1366
  ], 512));
1363
1367
  }
1364
- }), fo = /* @__PURE__ */ x(po, [["__scopeId", "data-v-2d0b1dbf"]]), mo = { class: "brick-field" }, yo = { class: "brick-field__label" }, go = ["value"], bo = ["value"], ho = ["value", "min", "max", "step"], vo = ["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 = {
1365
1369
  key: 5,
1366
1370
  class: "brick-field__toggle"
1367
1371
  }, xo = ["checked"], Co = {
@@ -1377,246 +1381,261 @@ const Hn = {
1377
1381
  node: {}
1378
1382
  },
1379
1383
  setup(e) {
1380
- const t = e, n = q(), l = I(() => {
1381
- const d = t.descriptor.key.split("."), r = d[0], i = d[1];
1384
+ const t = e, n = j(), i = I(() => {
1385
+ const d = t.descriptor.key.split("."), r = d[0], l = d[1];
1382
1386
  if (r === "props")
1383
- return t.node.props[i];
1387
+ return t.node.props[l];
1384
1388
  if (r === "style")
1385
- return t.node.style[i];
1386
- }), a = I(() => {
1387
- const d = l.value;
1389
+ return t.node.style[l];
1390
+ }), s = I(() => {
1391
+ const d = i.value;
1388
1392
  return t.descriptor.type === "textarea" && Array.isArray(d) ? d.join(`
1389
1393
  `) : d;
1390
1394
  });
1391
1395
  function o(d) {
1392
- const r = t.descriptor.key.split("."), i = r[0], y = r[1];
1393
- let g = d;
1394
- t.descriptor.type === "textarea" && Array.isArray(l.value) && (g = d.split(`
1395
- `)), i === "props" ? n.updateProps(t.node.id, { [y]: g }) : i === "style" && n.updateStyle(t.node.id, { [y]: g });
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 });
1396
1400
  }
1397
- function u(d, r) {
1398
- const y = [...a.value ?? [0, 0, 0, 0]];
1399
- y[d] = r, o(y);
1401
+ function p(d, r) {
1402
+ const u = [...s.value ?? [0, 0, 0, 0]];
1403
+ u[d] = r, o(u);
1400
1404
  }
1401
- function p(d) {
1402
- const i = d.target.files?.[0];
1403
- if (!i) return;
1404
- const y = new FileReader();
1405
- y.onload = () => {
1406
- o(y.result);
1407
- }, 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);
1408
1412
  }
1409
- return (d, r) => (s(), c("div", mo, [
1410
- m("label", yo, w(e.descriptor.label), 1),
1411
- e.descriptor.type === "text" ? (s(), c("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", {
1412
1416
  key: 0,
1413
1417
  type: "text",
1414
1418
  class: "brick-field__input",
1415
- value: a.value,
1416
- onInput: r[0] || (r[0] = (i) => o(i.target.value))
1417
- }, null, 40, go)) : e.descriptor.type === "textarea" ? (s(), c("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", {
1418
1422
  key: 1,
1419
1423
  class: "brick-field__textarea",
1420
- value: a.value,
1424
+ value: s.value,
1421
1425
  rows: "3",
1422
- onInput: r[1] || (r[1] = (i) => o(i.target.value))
1423
- }, null, 40, bo)) : e.descriptor.type === "number" ? (s(), c("input", {
1426
+ onInput: r[1] || (r[1] = (l) => o(l.target.value))
1427
+ }, null, 40, bo)) : e.descriptor.type === "number" ? (a(), c("input", {
1424
1428
  key: 2,
1425
1429
  type: "number",
1426
1430
  class: "brick-field__input",
1427
- value: a.value,
1431
+ value: s.value,
1428
1432
  min: e.descriptor.min,
1429
1433
  max: e.descriptor.max,
1430
1434
  step: e.descriptor.step,
1431
- onInput: r[2] || (r[2] = (i) => o(Number(i.target.value)))
1432
- }, null, 40, ho)) : e.descriptor.type === "color" ? (s(), c("input", {
1435
+ onInput: r[2] || (r[2] = (l) => o(Number(l.target.value)))
1436
+ }, null, 40, vo)) : e.descriptor.type === "color" ? (a(), c("input", {
1433
1437
  key: 3,
1434
1438
  type: "color",
1435
1439
  class: "brick-field__color",
1436
- value: a.value ?? "#000000",
1437
- onInput: r[3] || (r[3] = (i) => o(i.target.value))
1438
- }, null, 40, vo)) : e.descriptor.type === "select" ? (s(), c("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", {
1439
1443
  key: 4,
1440
1444
  class: "brick-field__select",
1441
- value: a.value,
1442
- 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))
1443
1447
  }, [
1444
- (s(!0), c(C, null, P(e.descriptor.options, (i) => (s(), c("option", {
1445
- key: String(i.value),
1446
- value: i.value
1447
- }, w(i.label), 9, ko))), 128))
1448
- ], 40, _o)) : e.descriptor.type === "toggle" ? (s(), c("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, [
1449
1453
  m("input", {
1450
1454
  type: "checkbox",
1451
- checked: a.value,
1452
- 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))
1453
1457
  }, null, 40, xo),
1454
- m("span", null, w(a.value ? "On" : "Off"), 1)
1455
- ])) : e.descriptor.type === "margin" ? (s(), c("div", Co, [
1456
- (s(), c(C, null, P(["L", "T", "R", "B"], (i, y) => m("input", {
1457
- 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,
1458
1462
  type: "number",
1459
1463
  class: "brick-field__margin-input",
1460
- placeholder: i,
1461
- value: (a.value ?? [0, 0, 0, 0])[y],
1462
- 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))
1463
1467
  }, null, 40, wo)), 64))
1464
- ])) : e.descriptor.type === "slider" ? (s(), c("div", Po, [
1468
+ ])) : e.descriptor.type === "slider" ? (a(), c("div", Po, [
1465
1469
  m("input", {
1466
1470
  type: "range",
1467
- value: a.value,
1471
+ value: s.value,
1468
1472
  min: e.descriptor.min,
1469
1473
  max: e.descriptor.max,
1470
1474
  step: e.descriptor.step,
1471
- onInput: r[6] || (r[6] = (i) => o(Number(i.target.value)))
1475
+ onInput: r[6] || (r[6] = (l) => o(Number(l.target.value)))
1472
1476
  }, null, 40, Eo),
1473
- m("span", Io, w(a.value), 1)
1474
- ])) : e.descriptor.type === "file" ? (s(), c("input", {
1477
+ m("span", Io, w(s.value), 1)
1478
+ ])) : e.descriptor.type === "file" ? (a(), c("input", {
1475
1479
  key: 8,
1476
1480
  type: "file",
1477
1481
  accept: "image/*",
1478
1482
  class: "brick-field__file",
1479
- onChange: p
1483
+ onChange: f
1480
1484
  }, null, 32)) : $("", !0)
1481
1485
  ]));
1482
1486
  }
1483
1487
  }), Ro = /* @__PURE__ */ x($o, [["__scopeId", "data-v-5a3bec1b"]]), No = {
1484
1488
  key: 0,
1485
1489
  class: "brick-property-editor"
1486
- }, zo = { class: "brick-property-editor__type" }, To = {
1490
+ }, zo = { class: "brick-property-editor__type" }, To = { class: "brick-property-editor__key" }, Do = ["value"], Lo = {
1487
1491
  key: 0,
1488
1492
  class: "brick-property-editor__group"
1489
- }, Do = { class: "brick-property-editor__group-title" }, Lo = /* @__PURE__ */ _({
1493
+ }, Mo = { class: "brick-property-editor__group-title" }, Bo = /* @__PURE__ */ _({
1490
1494
  __name: "PropertyEditor",
1491
1495
  setup(e) {
1492
- const t = W(), n = I(() => {
1493
- const u = t.selectedNode.value;
1494
- return u ? U(u.type) : null;
1495
- }), l = I(() => {
1496
- if (!n.value) return {};
1497
- const u = {};
1498
- for (const p of n.value.propertyFields)
1499
- u[p.section] || (u[p.section] = []), u[p.section].push(p);
1500
- return u;
1501
- }), 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 = {
1502
1511
  content: "Content",
1503
1512
  style: "Style",
1504
1513
  layout: "Layout",
1505
1514
  advanced: "Advanced"
1506
- }, o = ["content", "style", "layout", "advanced"];
1507
- return (u, p) => k(t).selectedNode.value && n.value ? (s(), c("div", No, [
1508
- m("div", zo, w(n.value.icon) + " " + w(n.value.label), 1),
1509
- (s(), c(C, null, P(o, (d) => (s(), c(C, { key: d }, [
1510
- l.value[d] ? (s(), c("div", To, [
1511
- m("div", Do, w(a[d]), 1),
1512
- (s(!0), c(C, null, P(l.value[d], (r) => (s(), M(Ro, {
1513
- key: r.key,
1514
- 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,
1515
1534
  node: k(t).selectedNode.value
1516
1535
  }, null, 8, ["descriptor", "node"]))), 128))
1517
1536
  ])) : $("", !0)
1518
1537
  ], 64))), 64)),
1519
- (s(), M(te(n.value.propertyEditorComponent), {
1538
+ (a(), M(te(s.value.propertyEditorComponent), {
1520
1539
  node: k(t).selectedNode.value
1521
1540
  }, null, 8, ["node"]))
1522
1541
  ])) : $("", !0);
1523
1542
  }
1524
- }), 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 = {
1525
1544
  key: 0,
1526
1545
  class: "brick-toolbar__section"
1527
- }, Vo = /* @__PURE__ */ _({
1546
+ }, Ho = /* @__PURE__ */ _({
1528
1547
  __name: "Toolbar",
1529
1548
  setup(e) {
1530
1549
  const t = W();
1531
- return (n, l) => (s(), c("div", Bo, [
1532
- m("div", Oo, [
1533
- 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)),
1534
1553
  B(fo)
1535
1554
  ]),
1536
- k(t).selectedNode.value ? (s(), c("div", Ao, [
1537
- l[1] || (l[1] = m("h3", { class: "brick-toolbar__title" }, "Properties", -1)),
1538
- 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)
1539
1558
  ])) : $("", !0)
1540
1559
  ]));
1541
1560
  }
1542
- }), Fo = /* @__PURE__ */ x(Vo, [["__scopeId", "data-v-0174c069"]]), Ho = { 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__ */ _({
1543
1562
  __name: "ActionBar",
1544
1563
  setup(e) {
1545
- const t = xt(), n = zt(), l = W(), a = q(), o = oe(), u = E("document"), p = E(null);
1564
+ const t = xt(), n = zt(), i = W(), s = j(), o = oe(), p = E("document"), f = E(null);
1546
1565
  function d() {
1547
- const f = l.selectedId.value;
1548
- f && (l.deselect(), a.removeElement(f));
1566
+ const y = i.selectedId.value;
1567
+ y && (i.deselect(), s.removeElement(y));
1549
1568
  }
1550
1569
  function r() {
1551
- const f = u.value.trim() || "document", b = f.endsWith(".pdf") ? f : f + ".pdf";
1552
- n.exportPdf(b);
1570
+ const y = p.value.trim() || "document", g = y.endsWith(".pdf") ? y : y + ".pdf";
1571
+ n.exportPdf(g);
1553
1572
  }
1554
- function i() {
1555
- const f = o.exportDocument(), b = JSON.stringify(f, null, 2), h = new Blob([b], { type: "application/json" }), v = URL.createObjectURL(h), S = document.createElement("a"), R = u.value.trim() || "document";
1556
- S.href = v, S.download = R.endsWith(".json") ? R : R + ".json", S.click(), URL.revokeObjectURL(v);
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";
1575
+ S.href = h, S.download = R.endsWith(".json") ? R : R + ".json", S.click(), URL.revokeObjectURL(h);
1557
1576
  }
1558
- function y() {
1559
- p.value?.click();
1577
+ function u() {
1578
+ f.value?.click();
1560
1579
  }
1561
- function g(f) {
1562
- const b = f.target, h = b.files?.[0];
1563
- if (!h) return;
1564
- const v = new FileReader();
1565
- v.onload = () => {
1580
+ function b(y) {
1581
+ const g = y.target, v = g.files?.[0];
1582
+ if (!v) return;
1583
+ const h = new FileReader();
1584
+ h.onload = () => {
1566
1585
  try {
1567
- const S = JSON.parse(v.result);
1586
+ const S = JSON.parse(h.result);
1568
1587
  if (!S.content || !S.pageSize) {
1569
1588
  alert("Invalid brick-pdf JSON file.");
1570
1589
  return;
1571
1590
  }
1572
- l.deselect(), o.loadDocument(S);
1591
+ i.deselect(), o.loadDocument(S);
1573
1592
  } catch {
1574
1593
  alert("Failed to parse JSON file.");
1575
1594
  }
1576
- }, v.readAsText(h), b.value = "";
1595
+ }, h.readAsText(v), g.value = "";
1577
1596
  }
1578
- return (f, b) => (s(), c("div", Ho, [
1579
- m("div", Jo, [
1580
- K(m("input", {
1581
- "onUpdate:modelValue": b[0] || (b[0] = (h) => u.value = h),
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),
1582
1601
  class: "brick-actionbar__name",
1583
1602
  type: "text",
1584
1603
  placeholder: "Document name",
1585
1604
  title: "Document name (used for export filename)"
1586
1605
  }, null, 512), [
1587
- [De, u.value]
1606
+ [De, p.value]
1588
1607
  ])
1589
1608
  ]),
1590
- m("div", Uo, [
1609
+ m("div", jo, [
1591
1610
  m("button", {
1592
1611
  class: "brick-actionbar__btn",
1593
1612
  disabled: !k(t).canUndo.value,
1594
1613
  title: "Undo",
1595
- onClick: b[1] || (b[1] = (h) => k(t).undo())
1596
- }, " Undo ", 8, Wo),
1614
+ onClick: g[1] || (g[1] = (v) => k(t).undo())
1615
+ }, " Undo ", 8, Yo),
1597
1616
  m("button", {
1598
1617
  class: "brick-actionbar__btn",
1599
1618
  disabled: !k(t).canRedo.value,
1600
1619
  title: "Redo",
1601
- onClick: b[2] || (b[2] = (h) => k(t).redo())
1602
- }, " Redo ", 8, jo),
1620
+ onClick: g[2] || (g[2] = (v) => k(t).redo())
1621
+ }, " Redo ", 8, qo),
1603
1622
  m("button", {
1604
1623
  class: "brick-actionbar__btn brick-actionbar__btn--danger",
1605
- disabled: !k(l).selectedId.value,
1624
+ disabled: !k(i).selectedId.value,
1606
1625
  title: "Delete selected element",
1607
1626
  onClick: d
1608
- }, " Delete ", 8, Yo)
1627
+ }, " Delete ", 8, Ko)
1609
1628
  ]),
1610
- m("div", qo, [
1629
+ m("div", Go, [
1611
1630
  m("button", {
1612
1631
  class: "brick-actionbar__btn",
1613
1632
  title: "Import JSON",
1614
- onClick: y
1633
+ onClick: u
1615
1634
  }, " Import JSON "),
1616
1635
  m("button", {
1617
1636
  class: "brick-actionbar__btn",
1618
1637
  title: "Export JSON",
1619
- onClick: i
1638
+ onClick: l
1620
1639
  }, " Export JSON "),
1621
1640
  m("button", {
1622
1641
  class: "brick-actionbar__btn brick-actionbar__btn--primary",
@@ -1624,90 +1643,90 @@ const Hn = {
1624
1643
  }, " Export PDF "),
1625
1644
  m("button", {
1626
1645
  class: "brick-actionbar__btn",
1627
- onClick: b[3] || (b[3] = (h) => k(n).openPdf())
1646
+ onClick: g[3] || (g[3] = (v) => k(n).openPdf())
1628
1647
  }, " Preview ")
1629
1648
  ]),
1630
1649
  m("input", {
1631
1650
  ref_key: "fileInput",
1632
- ref: p,
1651
+ ref: f,
1633
1652
  type: "file",
1634
1653
  accept: ".json",
1635
1654
  style: { display: "none" },
1636
- onChange: g
1655
+ onChange: b
1637
1656
  }, null, 544)
1638
1657
  ]));
1639
1658
  }
1640
- }), 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__ */ _({
1641
1660
  __name: "BrickPdf",
1642
1661
  props: {
1643
1662
  modelValue: {}
1644
1663
  },
1645
1664
  emits: ["update:modelValue"],
1646
1665
  setup(e, { emit: t }) {
1647
- const n = e, l = t;
1666
+ const n = e, i = t;
1648
1667
  Fn();
1649
- const a = ft(n.modelValue ?? ne());
1650
- mt(a);
1651
- const o = yt(a);
1668
+ const s = ft(n.modelValue ?? ne());
1669
+ yt(s);
1670
+ const o = mt(s);
1652
1671
  gt(o);
1653
- const u = kt(a);
1654
- St(u);
1655
- const p = ht(a, u);
1656
- vt(p);
1657
- const d = Ct(a, p);
1672
+ const p = kt(s);
1673
+ St(p);
1674
+ const f = vt(s, p);
1675
+ ht(f);
1676
+ const d = Ct(s, f);
1658
1677
  wt(d);
1659
- const r = Rt(a);
1678
+ const r = Rt(s);
1660
1679
  Nt(r);
1661
- const i = Lt(a, p);
1662
- Mt(i);
1663
- const y = Bt(p);
1664
- Ot(y);
1665
- const g = Me(), f = g.Delete, b = g.Backspace;
1666
- 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, () => {
1667
1686
  if (!o.selectedId.value) return;
1668
- const h = document.activeElement;
1669
- if (h && (h.tagName === "INPUT" || h.tagName === "TEXTAREA" || h.tagName === "SELECT")) return;
1670
- const v = o.selectedId.value;
1671
- o.deselect(), p.removeElement(v);
1672
- }), ae(b, () => {
1687
+ const v = document.activeElement;
1688
+ if (v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.tagName === "SELECT")) return;
1689
+ const h = o.selectedId.value;
1690
+ o.deselect(), f.removeElement(h);
1691
+ }), ae(g, () => {
1673
1692
  if (!o.selectedId.value) return;
1674
- const h = document.activeElement;
1675
- if (h && (h.tagName === "INPUT" || h.tagName === "TEXTAREA" || h.tagName === "SELECT")) return;
1676
- const v = o.selectedId.value;
1677
- o.deselect(), p.removeElement(v);
1693
+ const v = document.activeElement;
1694
+ if (v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.tagName === "SELECT")) return;
1695
+ const h = o.selectedId.value;
1696
+ o.deselect(), f.removeElement(h);
1678
1697
  }), Le(
1679
- () => a.document,
1698
+ () => s.document,
1680
1699
  () => {
1681
- l("update:modelValue", JSON.parse(JSON.stringify(J(a.document))));
1700
+ i("update:modelValue", JSON.parse(JSON.stringify(J(s.document))));
1682
1701
  },
1683
1702
  { deep: !0 }
1684
- ), (h, v) => (s(), c("div", Ko, [
1685
- B(Xo),
1686
- m("div", Qo, [
1703
+ ), (v, h) => (a(), c("div", Zo, [
1704
+ B(Qo),
1705
+ m("div", er, [
1687
1706
  B(so),
1688
- B(Fo)
1707
+ B(Jo)
1689
1708
  ])
1690
1709
  ]));
1691
1710
  }
1692
- }), er = /* @__PURE__ */ x(Zo, [["__scopeId", "data-v-f9b95ad8"]]), sr = {
1711
+ }), nr = /* @__PURE__ */ x(tr, [["__scopeId", "data-v-f9b95ad8"]]), cr = {
1693
1712
  install(e) {
1694
- e.component("BrickPdf", er);
1713
+ e.component("BrickPdf", nr);
1695
1714
  }
1696
1715
  };
1697
1716
  export {
1698
- er as BrickPdf,
1717
+ nr as BrickPdf,
1699
1718
  ne as createDefaultDocument,
1700
- sr as default,
1719
+ cr as default,
1701
1720
  Be as getAllElementDefinitions,
1702
1721
  U as getElementDefinition,
1703
1722
  z as registerElement,
1704
- rr as unregisterElement,
1705
- lr as useClipboard,
1723
+ ir as unregisterElement,
1724
+ sr as useClipboard,
1706
1725
  oe as useDocumentStore,
1707
1726
  xe as useDragDrop,
1708
- q as useElementActions,
1727
+ j as useElementActions,
1709
1728
  xt as useHistory,
1710
1729
  zt as usePdfExport,
1711
- ir as useResize,
1730
+ ar as useResize,
1712
1731
  W as useSelection
1713
1732
  };