brick-pdf 0.1.1 → 0.1.2

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 a, normalizeStyle as R, toDisplayString as w, renderSlot as X, normalizeClass as K, createElementVNode as f, Fragment as C, renderList as P, reactive as Pe, provide as L, inject as M, toRaw as H, ref as E, computed as $, createTextVNode as ne, createCommentVNode as I, createBlock as B, resolveDynamicComponent as Q, withCtx as W, onMounted as se, onBeforeUnmount as ae, resolveComponent as Ee, withDirectives as G, unref as k, vModelSelect as oe, createVNode as O, vModelText as $e, watch as Ie } from "vue";
1
+ import { defineComponent as _, openBlock as s, createElementBlock as c, normalizeStyle as R, toDisplayString as w, renderSlot as X, normalizeClass as K, createElementVNode as f, Fragment as C, renderList as P, reactive as Pe, provide as N, inject as L, toRaw as H, ref as E, computed as $, createTextVNode as ne, createCommentVNode as I, createBlock as M, resolveDynamicComponent as Q, withCtx as W, onMounted as se, onBeforeUnmount as ae, unref as k, resolveComponent as Ee, withDirectives as G, vModelSelect as oe, createVNode as B, vModelText as $e, watch as Ie } from "vue";
2
2
  import { useMagicKeys as Re, whenever as re } from "@vueuse/core";
3
3
  import le from "sortablejs";
4
4
  function ce() {
@@ -42,7 +42,7 @@ const Le = /* @__PURE__ */ _({
42
42
  node: {}
43
43
  },
44
44
  setup(e) {
45
- return (t, n) => (s(), a("div", {
45
+ return (t, n) => (s(), c("div", {
46
46
  class: "brick-el-text",
47
47
  style: R({
48
48
  fontSize: (e.node.style.fontSize ?? 12) + "px",
@@ -59,8 +59,8 @@ const Le = /* @__PURE__ */ _({
59
59
  }
60
60
  }), S = (e, t) => {
61
61
  const n = e.__vccOpts || e;
62
- for (const [i, c] of t)
63
- n[i] = c;
62
+ for (const [i, d] of t)
63
+ n[i] = d;
64
64
  return n;
65
65
  }, Me = /* @__PURE__ */ S(Le, [["__scopeId", "data-v-a7cd1565"]]), Be = { class: "brick-text-editor" }, Oe = /* @__PURE__ */ _({
66
66
  __name: "TextPropertyEditor",
@@ -68,7 +68,7 @@ const Le = /* @__PURE__ */ _({
68
68
  node: {}
69
69
  },
70
70
  setup(e) {
71
- return (t, n) => (s(), a("div", Be));
71
+ return (t, n) => (s(), c("div", Be));
72
72
  }
73
73
  }), Ve = {
74
74
  type: "text",
@@ -124,7 +124,7 @@ const Ue = /* @__PURE__ */ _({
124
124
  path: {}
125
125
  },
126
126
  setup(e) {
127
- return (t, n) => (s(), a("div", {
127
+ return (t, n) => (s(), c("div", {
128
128
  class: "brick-el-stack",
129
129
  style: R({ backgroundColor: e.node.style.fillColor })
130
130
  }, [
@@ -137,7 +137,7 @@ const Ue = /* @__PURE__ */ _({
137
137
  node: {}
138
138
  },
139
139
  setup(e) {
140
- return (t, n) => (s(), a("div", Je));
140
+ return (t, n) => (s(), c("div", Je));
141
141
  }
142
142
  }), qe = {
143
143
  type: "stack",
@@ -175,7 +175,7 @@ const Ke = /* @__PURE__ */ _({
175
175
  path: {}
176
176
  },
177
177
  setup(e) {
178
- return (t, n) => (s(), a("div", {
178
+ return (t, n) => (s(), c("div", {
179
179
  class: "brick-el-columns",
180
180
  style: R({ "--column-gap": (e.node.props.columnGap ?? 10) + "px" })
181
181
  }, [
@@ -188,7 +188,7 @@ const Ke = /* @__PURE__ */ _({
188
188
  node: {}
189
189
  },
190
190
  setup(e) {
191
- return (t, n) => (s(), a("div", Ze));
191
+ return (t, n) => (s(), c("div", Ze));
192
192
  }
193
193
  }), tt = {
194
194
  type: "columns",
@@ -226,7 +226,7 @@ function rt(e) {
226
226
  headerRows: e.props.headerRows,
227
227
  widths: e.props.widths,
228
228
  body: t.map(
229
- (c) => c.map((o) => ({ text: o }))
229
+ (d) => d.map((o) => ({ text: o }))
230
230
  )
231
231
  }
232
232
  }, i = e.props.layout;
@@ -238,23 +238,23 @@ const lt = /* @__PURE__ */ _({
238
238
  node: {}
239
239
  },
240
240
  setup(e) {
241
- return (t, n) => (s(), a("div", {
241
+ return (t, n) => (s(), c("div", {
242
242
  class: K(["brick-el-table", "brick-el-table--" + (e.node.props.layout ?? "lightHorizontalLines")]),
243
243
  style: R({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
244
244
  }, [
245
245
  f("table", null, [
246
246
  f("thead", null, [
247
- (s(!0), a(C, null, P(e.node.props.body.slice(0, e.node.props.headerRows), (i, c) => (s(), a("tr", {
248
- key: "h" + c
247
+ (s(!0), c(C, null, P(e.node.props.body.slice(0, e.node.props.headerRows), (i, d) => (s(), c("tr", {
248
+ key: "h" + d
249
249
  }, [
250
- (s(!0), a(C, null, P(i, (o, d) => (s(), a("th", { key: d }, w(o), 1))), 128))
250
+ (s(!0), c(C, null, P(i, (o, u) => (s(), c("th", { key: u }, w(o), 1))), 128))
251
251
  ]))), 128))
252
252
  ]),
253
253
  f("tbody", null, [
254
- (s(!0), a(C, null, P(e.node.props.body.slice(e.node.props.headerRows), (i, c) => (s(), a("tr", {
255
- key: "b" + c
254
+ (s(!0), c(C, null, P(e.node.props.body.slice(e.node.props.headerRows), (i, d) => (s(), c("tr", {
255
+ key: "b" + d
256
256
  }, [
257
- (s(!0), a(C, null, P(i, (o, d) => (s(), a("td", { key: d }, w(o), 1))), 128))
257
+ (s(!0), c(C, null, P(i, (o, u) => (s(), c("td", { key: u }, w(o), 1))), 128))
258
258
  ]))), 128))
259
259
  ])
260
260
  ])
@@ -263,40 +263,40 @@ const lt = /* @__PURE__ */ _({
263
263
  }), it = /* @__PURE__ */ S(lt, [["__scopeId", "data-v-b863b05d"]]), de = /* @__PURE__ */ Symbol("brick-pdf-document-store");
264
264
  function st(e) {
265
265
  const t = Pe(e ?? ce());
266
- function n(u, p) {
266
+ function n(a, p) {
267
267
  const r = p ?? t.content;
268
268
  for (let l = 0; l < r.length; l++) {
269
269
  const y = r[l];
270
270
  if (y) {
271
- if (y.id === u)
271
+ if (y.id === a)
272
272
  return { node: y, parent: r, index: l };
273
273
  if (y.children.length > 0) {
274
- const b = n(u, y.children);
274
+ const b = n(a, y.children);
275
275
  if (b) return b;
276
276
  }
277
277
  }
278
278
  }
279
279
  return null;
280
280
  }
281
- function i(u) {
282
- t.content.splice(0, t.content.length, ...u);
281
+ function i(a) {
282
+ t.content.splice(0, t.content.length, ...a);
283
283
  }
284
- function c() {
284
+ function d() {
285
285
  return JSON.parse(JSON.stringify(H(t.content)));
286
286
  }
287
- function o(u) {
288
- t.pageSize = u.pageSize, t.pageOrientation = u.pageOrientation, t.pageMargins = u.pageMargins, t.defaultStyle = u.defaultStyle ?? { fontSize: 12 }, t.styles = u.styles ?? {}, t.content.splice(0, t.content.length, ...u.content);
287
+ function o(a) {
288
+ t.pageSize = a.pageSize, t.pageOrientation = a.pageOrientation, t.pageMargins = a.pageMargins, t.defaultStyle = a.defaultStyle ?? { fontSize: 12 }, t.styles = a.styles ?? {}, t.content.splice(0, t.content.length, ...a.content);
289
289
  }
290
- function d() {
290
+ function u() {
291
291
  return JSON.parse(JSON.stringify(H(t)));
292
292
  }
293
- return { document: t, findNodeById: n, replaceContent: i, snapshotContent: c, loadDocument: o, exportDocument: d };
293
+ return { document: t, findNodeById: n, replaceContent: i, snapshotContent: d, loadDocument: o, exportDocument: u };
294
294
  }
295
295
  function at(e) {
296
- L(de, e);
296
+ N(de, e);
297
297
  }
298
298
  function Z() {
299
- const e = M(de);
299
+ const e = L(de);
300
300
  if (!e)
301
301
  throw new Error("useDocumentStore() requires a BrickPdf ancestor component");
302
302
  return e;
@@ -307,16 +307,16 @@ function ct(e) {
307
307
  function i(o) {
308
308
  t.value = o;
309
309
  }
310
- function c() {
310
+ function d() {
311
311
  t.value = null;
312
312
  }
313
- return { selectedId: t, selectedNode: n, select: i, deselect: c };
313
+ return { selectedId: t, selectedNode: n, select: i, deselect: d };
314
314
  }
315
315
  function dt(e) {
316
- L(ue, e);
316
+ N(ue, e);
317
317
  }
318
318
  function U() {
319
- const e = M(ue);
319
+ const e = L(ue);
320
320
  if (!e)
321
321
  throw new Error("useSelection() requires a BrickPdf ancestor component");
322
322
  return e;
@@ -355,7 +355,7 @@ function pt(e, t) {
355
355
  const r = e.findNodeById(p);
356
356
  r && (t.record(), r.parent.splice(r.index, 1));
357
357
  }
358
- function c(p, r, l) {
358
+ function d(p, r, l) {
359
359
  const y = e.findNodeById(p);
360
360
  if (!y) return;
361
361
  t.record();
@@ -371,21 +371,21 @@ function pt(e, t) {
371
371
  const l = me(r.node);
372
372
  return r.parent.splice(r.index + 1, 0, l), l;
373
373
  }
374
- function d(p, r) {
374
+ function u(p, r) {
375
375
  const l = e.findNodeById(p);
376
376
  l && (t.record(), Object.assign(l.node.props, r));
377
377
  }
378
- function u(p, r) {
378
+ function a(p, r) {
379
379
  const l = e.findNodeById(p);
380
380
  l && (t.record(), Object.assign(l.node.style, r));
381
381
  }
382
- return { addElement: n, removeElement: i, moveElement: c, duplicateElement: o, updateProps: d, updateStyle: u };
382
+ return { addElement: n, removeElement: i, moveElement: d, duplicateElement: o, updateProps: u, updateStyle: a };
383
383
  }
384
384
  function ft(e) {
385
- L(pe, e);
385
+ N(pe, e);
386
386
  }
387
387
  function Y() {
388
- const e = M(pe);
388
+ const e = L(pe);
389
389
  if (!e)
390
390
  throw new Error("useElementActions() requires a BrickPdf ancestor component");
391
391
  return e;
@@ -394,15 +394,15 @@ const ye = /* @__PURE__ */ Symbol("brick-pdf-history"), mt = 50;
394
394
  function yt(e) {
395
395
  const t = E([]), n = E([]);
396
396
  let i = 0;
397
- const c = $(() => t.value.length > 0), o = $(() => n.value.length > 0);
398
- function d() {
397
+ const d = $(() => t.value.length > 0), o = $(() => n.value.length > 0);
398
+ function u() {
399
399
  const r = Date.now();
400
400
  if (r - i < 100) return;
401
401
  i = r;
402
402
  const l = e.snapshotContent();
403
403
  t.value.push(l), t.value.length > mt && t.value.shift(), n.value = [];
404
404
  }
405
- function u() {
405
+ function a() {
406
406
  const r = t.value.pop();
407
407
  r && (n.value.push(e.snapshotContent()), e.replaceContent(r));
408
408
  }
@@ -410,64 +410,75 @@ function yt(e) {
410
410
  const r = n.value.pop();
411
411
  r && (t.value.push(e.snapshotContent()), e.replaceContent(r));
412
412
  }
413
- return { canUndo: c, canRedo: o, record: d, undo: u, redo: p };
413
+ return { canUndo: d, canRedo: o, record: u, undo: a, redo: p };
414
414
  }
415
415
  function gt(e) {
416
- L(ye, e);
416
+ N(ye, e);
417
417
  }
418
418
  function bt() {
419
- const e = M(ye);
419
+ const e = L(ye);
420
420
  if (!e)
421
421
  throw new Error("useHistory() requires a BrickPdf ancestor component");
422
422
  return e;
423
423
  }
424
424
  const ge = /* @__PURE__ */ Symbol("brick-pdf-drag-drop");
425
425
  function vt(e, t) {
426
- function n(c) {
427
- return le.create(c, {
426
+ const n = E(!1);
427
+ function i(o) {
428
+ return le.create(o, {
428
429
  group: { name: "brick-elements", pull: "clone", put: !1 },
429
430
  sort: !1,
430
- animation: 150
431
+ animation: 150,
432
+ onStart() {
433
+ n.value = !0;
434
+ },
435
+ onEnd() {
436
+ n.value = !1;
437
+ }
431
438
  });
432
439
  }
433
- function i(c, o) {
434
- return le.create(c, {
440
+ function d(o, u) {
441
+ return le.create(o, {
435
442
  group: { name: "brick-elements", put: !0 },
436
443
  animation: 150,
437
444
  fallbackOnBody: !0,
438
- swapThreshold: 0.65,
439
- emptyInsertThreshold: 80,
440
- onAdd(d) {
441
- const u = d.item, p = u.dataset.elementType;
442
- if (p) {
443
- if (u.parentNode?.removeChild(u), o) {
444
- const r = e.findNodeById(o);
445
- if (r) {
446
- const l = F(r.node.type);
447
- if (l?.acceptsChildTypes && !l.acceptsChildTypes.includes(p))
445
+ swapThreshold: 0.5,
446
+ emptyInsertThreshold: 5,
447
+ ghostClass: "brick-sortable-ghost",
448
+ onStart() {
449
+ n.value = !0;
450
+ },
451
+ onAdd(a) {
452
+ const p = a.item, r = p.dataset.elementType;
453
+ if (r) {
454
+ if (p.parentNode?.removeChild(p), u) {
455
+ const l = e.findNodeById(u);
456
+ if (l) {
457
+ const y = F(l.node.type);
458
+ if (y?.acceptsChildTypes && !y.acceptsChildTypes.includes(r))
448
459
  return;
449
460
  }
450
461
  }
451
- t.addElement(p, o, d.newIndex);
462
+ t.addElement(r, u, a.newIndex);
452
463
  }
453
464
  },
454
- onEnd(d) {
455
- if (d.from === d.to && d.oldIndex !== void 0 && d.newIndex !== void 0) {
456
- const u = o ? e.findNodeById(o)?.node.children : e.document.content;
457
- if (!u || d.oldIndex === d.newIndex) return;
458
- const p = u.splice(d.oldIndex, 1)[0];
459
- p && u.splice(d.newIndex, 0, p);
465
+ onEnd(a) {
466
+ if (n.value = !1, a.from === a.to && a.oldIndex !== void 0 && a.newIndex !== void 0) {
467
+ const p = u ? e.findNodeById(u)?.node.children : e.document.content;
468
+ if (!p || a.oldIndex === a.newIndex) return;
469
+ const r = p.splice(a.oldIndex, 1)[0];
470
+ r && p.splice(a.newIndex, 0, r);
460
471
  }
461
472
  }
462
473
  });
463
474
  }
464
- return { initToolbar: n, initContainer: i };
475
+ return { initToolbar: i, initContainer: d, isDragging: n };
465
476
  }
466
477
  function ht(e) {
467
- L(ge, e);
478
+ N(ge, e);
468
479
  }
469
480
  function be() {
470
- const e = M(ge);
481
+ const e = L(ge);
471
482
  if (!e)
472
483
  throw new Error("useDragDrop() requires a BrickPdf ancestor component");
473
484
  return e;
@@ -493,28 +504,28 @@ function kt(e) {
493
504
  };
494
505
  }
495
506
  async function n() {
496
- const o = await import("pdfmake/build/pdfmake"), d = await import("pdfmake/build/vfs_fonts"), u = o.default || o, p = d.pdfMake;
497
- return p && p.vfs ? u.vfs = p.vfs : d.default && (u.vfs = d.default), u;
507
+ const o = await import("pdfmake/build/pdfmake"), u = await import("pdfmake/build/vfs_fonts"), a = o.default || o, p = u.pdfMake;
508
+ return p && p.vfs ? a.vfs = p.vfs : u.default && (a.vfs = u.default), a;
498
509
  }
499
510
  function i(o) {
500
- const d = t();
501
- n().then((u) => {
502
- u.createPdf(d).download(o ?? "document.pdf");
511
+ const u = t();
512
+ n().then((a) => {
513
+ a.createPdf(u).download(o ?? "document.pdf");
503
514
  });
504
515
  }
505
- function c() {
516
+ function d() {
506
517
  const o = t();
507
- n().then((d) => {
508
- d.createPdf(o).open();
518
+ n().then((u) => {
519
+ u.createPdf(o).open();
509
520
  });
510
521
  }
511
- return { toDocumentDefinition: t, exportPdf: i, openPdf: c };
522
+ return { toDocumentDefinition: t, exportPdf: i, openPdf: d };
512
523
  }
513
524
  function xt(e) {
514
- L(ve, e);
525
+ N(ve, e);
515
526
  }
516
527
  function St() {
517
- const e = M(ve);
528
+ const e = L(ve);
518
529
  if (!e)
519
530
  throw new Error("usePdfExport() requires a BrickPdf ancestor component");
520
531
  return e;
@@ -534,28 +545,28 @@ function ke(e) {
534
545
  };
535
546
  }
536
547
  function Pt(e, t) {
537
- const n = E(null), i = E(!1), c = E(null), o = E(!1);
538
- function d(r) {
548
+ const n = E(null), i = E(!1), d = E(null), o = E(!1);
549
+ function u(r) {
539
550
  const l = e.findNodeById(r);
540
- l && (n.value = structuredClone(l.node), i.value = !1, c.value = null, o.value = !0);
551
+ l && (n.value = structuredClone(l.node), i.value = !1, d.value = null, o.value = !0);
541
552
  }
542
- function u(r) {
553
+ function a(r) {
543
554
  const l = e.findNodeById(r);
544
- l && (n.value = structuredClone(l.node), i.value = !0, c.value = r, o.value = !0);
555
+ l && (n.value = structuredClone(l.node), i.value = !0, d.value = r, o.value = !0);
545
556
  }
546
557
  function p(r) {
547
558
  if (!n.value) return;
548
- i.value && c.value && (t.removeElement(c.value), i.value = !1, c.value = null);
559
+ i.value && d.value && (t.removeElement(d.value), i.value = !1, d.value = null);
549
560
  const l = ke(n.value), y = r ? e.findNodeById(r)?.node.children : e.document.content;
550
561
  y && (y.push(l), i.value && (n.value = null, o.value = !1));
551
562
  }
552
- return { hasClipboard: o, copy: d, cut: u, paste: p };
563
+ return { hasClipboard: o, copy: u, cut: a, paste: p };
553
564
  }
554
565
  function Et(e) {
555
- L(_e, e);
566
+ N(_e, e);
556
567
  }
557
568
  function rr() {
558
- const e = M(_e);
569
+ const e = L(_e);
559
570
  if (!e)
560
571
  throw new Error("useClipboard() requires a BrickPdf ancestor component");
561
572
  return e;
@@ -563,13 +574,13 @@ function rr() {
563
574
  const xe = /* @__PURE__ */ Symbol("brick-pdf-resize");
564
575
  function $t(e) {
565
576
  const t = E(!1);
566
- function n(i, c, o, d) {
577
+ function n(i, d, o, u) {
567
578
  t.value = !0;
568
- const u = d.clientX, p = d.clientY, r = o.width, l = o.height;
579
+ const a = u.clientX, p = u.clientY, r = o.width, l = o.height;
569
580
  function y(m) {
570
- const g = m.clientX - u, v = m.clientY - p;
581
+ const g = m.clientX - a, v = m.clientY - p;
571
582
  let h = r, x = l;
572
- c.includes("e") && (h = r + g), c.includes("w") && (h = r - g), c.includes("s") && (x = l + v), c.includes("n") && (x = l - v), h = Math.max(20, h), x = Math.max(20, x), e.updateStyle(i, {
583
+ d.includes("e") && (h = r + g), d.includes("w") && (h = r - g), d.includes("s") && (x = l + v), d.includes("n") && (x = l - v), h = Math.max(20, h), x = Math.max(20, x), e.updateStyle(i, {
573
584
  width: Math.round(h),
574
585
  height: Math.round(x)
575
586
  });
@@ -582,10 +593,10 @@ function $t(e) {
582
593
  return { isResizing: t, startResize: n };
583
594
  }
584
595
  function It(e) {
585
- L(xe, e);
596
+ N(xe, e);
586
597
  }
587
598
  function lr() {
588
- const e = M(xe);
599
+ const e = L(xe);
589
600
  if (!e)
590
601
  throw new Error("useResize() requires a BrickPdf ancestor component");
591
602
  return e;
@@ -600,24 +611,24 @@ const Rt = { class: "brick-table-editor" }, Dt = { class: "brick-table-editor__g
600
611
  function i() {
601
612
  return t.node.props.body ?? [];
602
613
  }
603
- function c() {
614
+ function d() {
604
615
  return t.node.props.widths ?? [];
605
616
  }
606
617
  function o(l, y, b) {
607
618
  const m = i().map((g) => [...g]);
608
619
  m[l][y] = b, n.updateProps(t.node.id, { body: m });
609
620
  }
610
- function d() {
621
+ function u() {
611
622
  const l = i().map((b) => [...b]), y = l[0]?.length ?? 2;
612
623
  l.push(Array(y).fill("")), n.updateProps(t.node.id, { body: l });
613
624
  }
614
- function u(l) {
625
+ function a(l) {
615
626
  const y = i().map((m) => [...m]);
616
627
  if (y.length <= 1) return;
617
628
  y.splice(l, 1), t.node.props.headerRows > y.length ? n.updateProps(t.node.id, { body: y, headerRows: y.length }) : n.updateProps(t.node.id, { body: y });
618
629
  }
619
630
  function p() {
620
- const l = i().map((b) => [...b, ""]), y = [...c(), "*"];
631
+ const l = i().map((b) => [...b, ""]), y = [...d(), "*"];
621
632
  n.updateProps(t.node.id, { body: l, widths: y });
622
633
  }
623
634
  function r(l) {
@@ -626,14 +637,14 @@ const Rt = { class: "brick-table-editor" }, Dt = { class: "brick-table-editor__g
626
637
  return g.splice(l, 1), g;
627
638
  });
628
639
  if ((y[0]?.length ?? 0) < 1) return;
629
- const b = [...c()];
640
+ const b = [...d()];
630
641
  b.splice(l, 1), n.updateProps(t.node.id, { body: y, widths: b });
631
642
  }
632
- return (l, y) => (s(), a("div", Rt, [
643
+ return (l, y) => (s(), c("div", Rt, [
633
644
  f("div", { class: "brick-table-editor__actions" }, [
634
645
  f("button", {
635
646
  class: "brick-table-editor__btn",
636
- onClick: d
647
+ onClick: u
637
648
  }, "+ Row"),
638
649
  f("button", {
639
650
  class: "brick-table-editor__btn",
@@ -645,12 +656,12 @@ const Rt = { class: "brick-table-editor" }, Dt = { class: "brick-table-editor__g
645
656
  f("thead", null, [
646
657
  f("tr", null, [
647
658
  y[0] || (y[0] = f("th", { class: "brick-table-editor__corner" }, null, -1)),
648
- (s(!0), a(C, null, P(i()[0] ?? [], (b, m) => (s(), a("th", {
659
+ (s(!0), c(C, null, P(i()[0] ?? [], (b, m) => (s(), c("th", {
649
660
  key: m,
650
661
  class: "brick-table-editor__col-header"
651
662
  }, [
652
663
  ne(" Col " + w(m + 1) + " ", 1),
653
- (i()[0]?.length ?? 0) > 1 ? (s(), a("button", {
664
+ (i()[0]?.length ?? 0) > 1 ? (s(), c("button", {
654
665
  key: 0,
655
666
  class: "brick-table-editor__remove-btn",
656
667
  title: "Remove column",
@@ -660,17 +671,17 @@ const Rt = { class: "brick-table-editor" }, Dt = { class: "brick-table-editor__g
660
671
  ])
661
672
  ]),
662
673
  f("tbody", null, [
663
- (s(!0), a(C, null, P(i(), (b, m) => (s(), a("tr", { key: m }, [
674
+ (s(!0), c(C, null, P(i(), (b, m) => (s(), c("tr", { key: m }, [
664
675
  f("td", Tt, [
665
676
  ne(w(m + 1) + " ", 1),
666
- i().length > 1 ? (s(), a("button", {
677
+ i().length > 1 ? (s(), c("button", {
667
678
  key: 0,
668
679
  class: "brick-table-editor__remove-btn",
669
680
  title: "Remove row",
670
- onClick: (g) => u(m)
681
+ onClick: (g) => a(m)
671
682
  }, "x", 8, Nt)) : I("", !0)
672
683
  ]),
673
- (s(!0), a(C, null, P(b, (g, v) => (s(), a("td", { key: v }, [
684
+ (s(!0), c(C, null, P(b, (g, v) => (s(), c("td", { key: v }, [
674
685
  f("input", {
675
686
  class: "brick-table-editor__cell",
676
687
  type: "text",
@@ -729,8 +740,8 @@ const Ft = { class: "brick-el-image" }, Ut = ["src"], Wt = {
729
740
  node: {}
730
741
  },
731
742
  setup(e) {
732
- return (t, n) => (s(), a("div", Ft, [
733
- e.node.props.src ? (s(), a("img", {
743
+ return (t, n) => (s(), c("div", Ft, [
744
+ e.node.props.src ? (s(), c("img", {
734
745
  key: 0,
735
746
  src: e.node.props.src,
736
747
  style: R({
@@ -739,7 +750,7 @@ const Ft = { class: "brick-el-image" }, Ut = ["src"], Wt = {
739
750
  objectFit: "contain",
740
751
  opacity: e.node.style.opacity
741
752
  })
742
- }, null, 12, Ut)) : (s(), a("div", Wt, " No image selected "))
753
+ }, null, 12, Ut)) : (s(), c("div", Wt, " No image selected "))
743
754
  ]));
744
755
  }
745
756
  }), Yt = /* @__PURE__ */ S(Jt, [["__scopeId", "data-v-38184258"]]), qt = { class: "brick-image-editor" }, jt = /* @__PURE__ */ _({
@@ -748,7 +759,7 @@ const Ft = { class: "brick-el-image" }, Ut = ["src"], Wt = {
748
759
  node: {}
749
760
  },
750
761
  setup(e) {
751
- return (t, n) => (s(), a("div", qt));
762
+ return (t, n) => (s(), c("div", qt));
752
763
  }
753
764
  }), Gt = {
754
765
  type: "image",
@@ -789,13 +800,13 @@ const Zt = /* @__PURE__ */ _({
789
800
  node: {}
790
801
  },
791
802
  setup(e) {
792
- return (t, n) => (s(), a("div", {
803
+ return (t, n) => (s(), c("div", {
793
804
  class: "brick-el-list",
794
805
  style: R({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
795
806
  }, [
796
- (s(), B(Q(e.node.props.ordered ? "ol" : "ul"), null, {
807
+ (s(), M(Q(e.node.props.ordered ? "ol" : "ul"), null, {
797
808
  default: W(() => [
798
- (s(!0), a(C, null, P(e.node.props.items, (i, c) => (s(), a("li", { key: c }, w(i), 1))), 128))
809
+ (s(!0), c(C, null, P(e.node.props.items, (i, d) => (s(), c("li", { key: d }, w(i), 1))), 128))
799
810
  ]),
800
811
  _: 1
801
812
  }))
@@ -807,7 +818,7 @@ const Zt = /* @__PURE__ */ _({
807
818
  node: {}
808
819
  },
809
820
  setup(e) {
810
- return (t, n) => (s(), a("div", tn));
821
+ return (t, n) => (s(), c("div", tn));
811
822
  }
812
823
  }), on = {
813
824
  type: "list",
@@ -848,7 +859,7 @@ const an = { class: "brick-el-qr__preview" }, cn = /* @__PURE__ */ _({
848
859
  node: {}
849
860
  },
850
861
  setup(e) {
851
- return (t, n) => (s(), a("div", {
862
+ return (t, n) => (s(), c("div", {
852
863
  class: "brick-el-qr",
853
864
  style: R({
854
865
  width: (e.node.props.fit ?? 100) + "px",
@@ -864,7 +875,7 @@ const an = { class: "brick-el-qr__preview" }, cn = /* @__PURE__ */ _({
864
875
  node: {}
865
876
  },
866
877
  setup(e) {
867
- return (t, n) => (s(), a("div", un));
878
+ return (t, n) => (s(), c("div", un));
868
879
  }
869
880
  }), fn = {
870
881
  type: "qr",
@@ -909,7 +920,7 @@ const bn = ["innerHTML"], vn = /* @__PURE__ */ _({
909
920
  node: {}
910
921
  },
911
922
  setup(e) {
912
- return (t, n) => (s(), a("div", {
923
+ return (t, n) => (s(), c("div", {
913
924
  class: "brick-el-svg",
914
925
  style: R({
915
926
  width: e.node.props.width + "px",
@@ -924,7 +935,7 @@ const bn = ["innerHTML"], vn = /* @__PURE__ */ _({
924
935
  node: {}
925
936
  },
926
937
  setup(e) {
927
- return (t, n) => (s(), a("div", _n));
938
+ return (t, n) => (s(), c("div", _n));
928
939
  }
929
940
  }), xn = {
930
941
  type: "svg",
@@ -972,7 +983,7 @@ const Pn = /* @__PURE__ */ _({
972
983
  node: {}
973
984
  },
974
985
  setup(e) {
975
- return (t, n) => (s(), a("div", {
986
+ return (t, n) => (s(), c("div", {
976
987
  class: "brick-el-canvas",
977
988
  style: R({
978
989
  width: (e.node.props.width ?? 200) + "px",
@@ -988,7 +999,7 @@ const Pn = /* @__PURE__ */ _({
988
999
  node: {}
989
1000
  },
990
1001
  setup(e) {
991
- return (t, n) => (s(), a("div", $n));
1002
+ return (t, n) => (s(), c("div", $n));
992
1003
  }
993
1004
  }), Rn = {
994
1005
  type: "canvas",
@@ -1021,7 +1032,7 @@ const Nn = { class: "brick-el-pagebreak" }, Ln = /* @__PURE__ */ _({
1021
1032
  node: {}
1022
1033
  },
1023
1034
  setup(e) {
1024
- return (t, n) => (s(), a("div", Nn, [...n[0] || (n[0] = [
1035
+ return (t, n) => (s(), c("div", Nn, [...n[0] || (n[0] = [
1025
1036
  f("hr", null, null, -1),
1026
1037
  f("span", null, "Page Break", -1),
1027
1038
  f("hr", null, null, -1)
@@ -1033,7 +1044,7 @@ const Nn = { class: "brick-el-pagebreak" }, Ln = /* @__PURE__ */ _({
1033
1044
  node: {}
1034
1045
  },
1035
1046
  setup(e) {
1036
- return (t, n) => (s(), a("div", Bn, [...n[0] || (n[0] = [
1047
+ return (t, n) => (s(), c("div", Bn, [...n[0] || (n[0] = [
1037
1048
  f("p", { style: { color: "#999", "font-size": "12px" } }, "No configurable properties.", -1)
1038
1049
  ])]));
1039
1050
  }
@@ -1065,21 +1076,21 @@ const Hn = {
1065
1076
  setup(e) {
1066
1077
  const t = e, n = E(null);
1067
1078
  let i = null;
1068
- const c = be();
1079
+ const d = be(), { isDragging: o } = d;
1069
1080
  return se(() => {
1070
- n.value && (i = c.initContainer(n.value, t.parentId));
1081
+ n.value && (i = d.initContainer(n.value, t.parentId));
1071
1082
  }), ae(() => {
1072
1083
  i?.destroy();
1073
- }), (o, d) => (s(), a("div", {
1084
+ }), (u, a) => (s(), c("div", {
1074
1085
  ref_key: "el",
1075
1086
  ref: n,
1076
- class: K(["brick-dropzone", { "brick-dropzone--horizontal": e.layout === "horizontal" }])
1087
+ class: K(["brick-dropzone", { "brick-dropzone--horizontal": e.layout === "horizontal", "brick-dropzone--drag-active": k(o) }])
1077
1088
  }, [
1078
- X(o.$slots, "default", {}, void 0, !0),
1079
- o.$slots.default ? I("", !0) : (s(), a("div", Hn, " Drop elements here "))
1089
+ X(u.$slots, "default", {}, void 0, !0),
1090
+ u.$slots.default ? I("", !0) : (s(), c("div", Hn, " Drop elements here "))
1080
1091
  ], 2));
1081
1092
  }
1082
- }), Se = /* @__PURE__ */ S(Fn, [["__scopeId", "data-v-c33d3667"]]), Un = ["data-element-id", "data-element-type"], Wn = {
1093
+ }), Se = /* @__PURE__ */ S(Fn, [["__scopeId", "data-v-edee28d4"]]), Un = ["data-element-id", "data-element-type"], Wn = {
1083
1094
  key: 1,
1084
1095
  class: "brick-canvas-element__unknown"
1085
1096
  }, Jn = /* @__PURE__ */ _({
@@ -1089,15 +1100,15 @@ const Hn = {
1089
1100
  path: {}
1090
1101
  },
1091
1102
  setup(e) {
1092
- const t = e, n = U(), i = Y(), c = E(null), o = $(() => F(t.node.type)), d = $(() => n.selectedId.value === t.node.id), u = $(() => o.value ? o.value.propertyFields.some((m) => m.key === "props.width" || m.key === "style.width") : !1), p = $(() => o.value ? o.value.propertyFields.some((m) => m.key === "props.height" || m.key === "style.height") : !1);
1103
+ const t = e, n = U(), i = Y(), d = E(null), o = $(() => F(t.node.type)), u = $(() => n.selectedId.value === t.node.id), a = $(() => o.value ? o.value.propertyFields.some((m) => m.key === "props.width" || m.key === "style.width") : !1), p = $(() => o.value ? o.value.propertyFields.some((m) => m.key === "props.height" || m.key === "style.height") : !1);
1093
1104
  function r(m) {
1094
1105
  m.stopPropagation(), n.select(t.node.id);
1095
1106
  }
1096
1107
  function l(m) {
1097
1108
  m.stopPropagation(), m.preventDefault();
1098
- const g = m.clientX, v = c.value?.offsetWidth ?? 200;
1109
+ const g = m.clientX, v = d.value?.offsetWidth ?? 200;
1099
1110
  function h(D) {
1100
- const V = D.clientX - g, T = Math.max(20, v + V);
1111
+ const O = D.clientX - g, T = Math.max(20, v + O);
1101
1112
  o.value?.propertyFields.some((A) => A.key === "props.width") ? i.updateProps(t.node.id, { width: Math.round(T) }) : i.updateStyle(t.node.id, { width: Math.round(T) });
1102
1113
  }
1103
1114
  function x() {
@@ -1107,9 +1118,9 @@ const Hn = {
1107
1118
  }
1108
1119
  function y(m) {
1109
1120
  m.stopPropagation(), m.preventDefault();
1110
- const g = m.clientY, v = c.value?.offsetHeight ?? 100;
1121
+ const g = m.clientY, v = d.value?.offsetHeight ?? 100;
1111
1122
  function h(D) {
1112
- const V = D.clientY - g, T = Math.max(20, v + V);
1123
+ const O = D.clientY - g, T = Math.max(20, v + O);
1113
1124
  o.value?.propertyFields.some((A) => A.key === "props.height") ? i.updateProps(t.node.id, { height: Math.round(T) }) : i.updateStyle(t.node.id, { height: Math.round(T) });
1114
1125
  }
1115
1126
  function x() {
@@ -1119,22 +1130,22 @@ const Hn = {
1119
1130
  }
1120
1131
  function b(m) {
1121
1132
  m.stopPropagation(), m.preventDefault();
1122
- const g = m.clientX, v = m.clientY, h = c.value?.offsetWidth ?? 200, x = c.value?.offsetHeight ?? 100;
1133
+ const g = m.clientX, v = m.clientY, h = d.value?.offsetWidth ?? 200, x = d.value?.offsetHeight ?? 100;
1123
1134
  function D(T) {
1124
1135
  const q = T.clientX - g, A = T.clientY - v, ee = Math.max(20, h + q), te = Math.max(20, x + A), Ce = o.value?.propertyFields.some((j) => j.key === "props.width"), we = o.value?.propertyFields.some((j) => j.key === "props.height");
1125
1136
  Ce ? i.updateProps(t.node.id, { width: Math.round(ee) }) : i.updateStyle(t.node.id, { width: Math.round(ee) }), we ? i.updateProps(t.node.id, { height: Math.round(te) }) : i.updateStyle(t.node.id, { height: Math.round(te) });
1126
1137
  }
1127
- function V() {
1128
- document.removeEventListener("pointermove", D), document.removeEventListener("pointerup", V), document.body.style.cursor = "", document.body.style.userSelect = "";
1138
+ function O() {
1139
+ document.removeEventListener("pointermove", D), document.removeEventListener("pointerup", O), document.body.style.cursor = "", document.body.style.userSelect = "";
1129
1140
  }
1130
- document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", D), document.addEventListener("pointerup", V);
1141
+ document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", D), document.addEventListener("pointerup", O);
1131
1142
  }
1132
1143
  return (m, g) => {
1133
1144
  const v = Ee("CanvasElement", !0);
1134
- return s(), a("div", {
1145
+ return s(), c("div", {
1135
1146
  ref_key: "elRef",
1136
- ref: c,
1137
- class: K(["brick-canvas-element", { "brick-canvas-element--selected": d.value }]),
1147
+ ref: d,
1148
+ class: K(["brick-canvas-element", { "brick-canvas-element--selected": u.value }]),
1138
1149
  "data-element-id": e.node.id,
1139
1150
  "data-element-type": e.node.type,
1140
1151
  style: R({
@@ -1148,19 +1159,19 @@ const Hn = {
1148
1159
  }),
1149
1160
  onClick: r
1150
1161
  }, [
1151
- o.value ? (s(), B(Q(o.value.rendererComponent), {
1162
+ o.value ? (s(), M(Q(o.value.rendererComponent), {
1152
1163
  key: 0,
1153
1164
  node: e.node,
1154
1165
  path: e.path
1155
1166
  }, {
1156
1167
  default: W(() => [
1157
- o.value.isContainer ? (s(), B(Se, {
1168
+ o.value.isContainer ? (s(), M(Se, {
1158
1169
  key: 0,
1159
1170
  "parent-id": e.node.id,
1160
1171
  layout: e.node.type === "columns" ? "horizontal" : "vertical"
1161
1172
  }, {
1162
1173
  default: W(() => [
1163
- (s(!0), a(C, null, P(e.node.children, (h, x) => (s(), B(v, {
1174
+ (s(!0), c(C, null, P(e.node.children, (h, x) => (s(), M(v, {
1164
1175
  key: h.id,
1165
1176
  node: h,
1166
1177
  path: [...e.path, x]
@@ -1170,19 +1181,19 @@ const Hn = {
1170
1181
  }, 8, ["parent-id", "layout"])) : I("", !0)
1171
1182
  ]),
1172
1183
  _: 1
1173
- }, 8, ["node", "path"])) : (s(), a("div", Wn, " Unknown element: " + w(e.node.type), 1)),
1174
- d.value ? (s(), a(C, { key: 2 }, [
1175
- u.value ? (s(), a("div", {
1184
+ }, 8, ["node", "path"])) : (s(), c("div", Wn, " Unknown element: " + w(e.node.type), 1)),
1185
+ u.value ? (s(), c(C, { key: 2 }, [
1186
+ a.value ? (s(), c("div", {
1176
1187
  key: 0,
1177
1188
  class: "brick-resize-handle brick-resize-handle--e",
1178
1189
  onPointerdown: l
1179
1190
  }, null, 32)) : I("", !0),
1180
- p.value ? (s(), a("div", {
1191
+ p.value ? (s(), c("div", {
1181
1192
  key: 1,
1182
1193
  class: "brick-resize-handle brick-resize-handle--s",
1183
1194
  onPointerdown: y
1184
1195
  }, null, 32)) : I("", !0),
1185
- u.value && p.value ? (s(), a("div", {
1196
+ a.value && p.value ? (s(), c("div", {
1186
1197
  key: 2,
1187
1198
  class: "brick-resize-handle brick-resize-handle--se",
1188
1199
  onPointerdown: b
@@ -1201,20 +1212,20 @@ const Hn = {
1201
1212
  { label: "Letter", value: "LETTER" },
1202
1213
  { label: "Legal", value: "LEGAL" }
1203
1214
  ];
1204
- function i(c, o) {
1205
- const d = [...t.document.pageMargins];
1206
- d[c] = o, t.document.pageMargins = d;
1215
+ function i(d, o) {
1216
+ const u = [...t.document.pageMargins];
1217
+ u[d] = o, t.document.pageMargins = u;
1207
1218
  }
1208
- return (c, o) => (s(), a("div", qn, [
1219
+ return (d, o) => (s(), c("div", qn, [
1209
1220
  f("div", jn, [
1210
1221
  o[3] || (o[3] = f("label", null, "Size", -1)),
1211
1222
  G(f("select", {
1212
- "onUpdate:modelValue": o[0] || (o[0] = (d) => k(t).document.pageSize = d)
1223
+ "onUpdate:modelValue": o[0] || (o[0] = (u) => k(t).document.pageSize = u)
1213
1224
  }, [
1214
- (s(), a(C, null, P(n, (d) => f("option", {
1215
- key: d.value,
1216
- value: d.value
1217
- }, w(d.label), 9, Gn)), 64))
1225
+ (s(), c(C, null, P(n, (u) => f("option", {
1226
+ key: u.value,
1227
+ value: u.value
1228
+ }, w(u.label), 9, Gn)), 64))
1218
1229
  ], 512), [
1219
1230
  [oe, k(t).document.pageSize]
1220
1231
  ])
@@ -1222,7 +1233,7 @@ const Hn = {
1222
1233
  f("div", Xn, [
1223
1234
  o[5] || (o[5] = f("label", null, "Orientation", -1)),
1224
1235
  G(f("select", {
1225
- "onUpdate:modelValue": o[1] || (o[1] = (d) => k(t).document.pageOrientation = d)
1236
+ "onUpdate:modelValue": o[1] || (o[1] = (u) => k(t).document.pageOrientation = u)
1226
1237
  }, [...o[4] || (o[4] = [
1227
1238
  f("option", { value: "portrait" }, "Portrait", -1),
1228
1239
  f("option", { value: "landscape" }, "Landscape", -1)
@@ -1233,13 +1244,13 @@ const Hn = {
1233
1244
  f("div", Kn, [
1234
1245
  o[6] || (o[6] = f("label", null, "Margins", -1)),
1235
1246
  f("div", Qn, [
1236
- (s(), a(C, null, P(["L", "T", "R", "B"], (d, u) => f("input", {
1237
- key: u,
1247
+ (s(), c(C, null, P(["L", "T", "R", "B"], (u, a) => f("input", {
1248
+ key: a,
1238
1249
  type: "number",
1239
- placeholder: d,
1240
- title: d,
1241
- value: k(t).document.pageMargins[u],
1242
- onInput: (p) => i(u, Number(p.target.value))
1250
+ placeholder: u,
1251
+ title: u,
1252
+ value: k(t).document.pageMargins[a],
1253
+ onInput: (p) => i(a, Number(p.target.value))
1243
1254
  }, null, 40, Zn)), 64))
1244
1255
  ])
1245
1256
  ]),
@@ -1250,12 +1261,12 @@ const Hn = {
1250
1261
  value: k(t).document.defaultStyle.fontSize ?? 12,
1251
1262
  min: "6",
1252
1263
  max: "72",
1253
- onInput: o[2] || (o[2] = (d) => k(t).document.defaultStyle.fontSize = Number(d.target.value))
1264
+ onInput: o[2] || (o[2] = (u) => k(t).document.defaultStyle.fontSize = Number(u.target.value))
1254
1265
  }, null, 40, to)
1255
1266
  ])
1256
1267
  ]));
1257
1268
  }
1258
- }), oo = /* @__PURE__ */ S(no, [["__scopeId", "data-v-f05c1083"]]), ro = { class: "brick-canvas" }, N = 0.75, lo = /* @__PURE__ */ _({
1269
+ }), oo = /* @__PURE__ */ S(no, [["__scopeId", "data-v-f05c1083"]]), ro = { class: "brick-canvas" }, V = 0.75, lo = /* @__PURE__ */ _({
1259
1270
  __name: "DesignCanvas",
1260
1271
  setup(e) {
1261
1272
  const t = Z(), n = U(), i = {
@@ -1264,39 +1275,36 @@ const Hn = {
1264
1275
  A5: [419.53, 595.28],
1265
1276
  LETTER: [612, 792],
1266
1277
  LEGAL: [612, 1008]
1267
- }, c = $(() => {
1268
- const [u, p] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? p : u;
1269
- return Math.round(r * N);
1278
+ }, d = $(() => {
1279
+ const [a, p] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? p : a;
1280
+ return Math.round(r * V);
1270
1281
  }), o = $(() => {
1271
- const [u, p] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? u : p;
1272
- return Math.round(r * N);
1282
+ const [a, p] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? a : p;
1283
+ return Math.round(r * V);
1273
1284
  });
1274
- function d(u) {
1275
- (u.target === u.currentTarget || u.target.classList.contains("brick-canvas__page")) && n.deselect();
1285
+ function u(a) {
1286
+ (a.target === a.currentTarget || a.target.classList.contains("brick-canvas__page")) && n.deselect();
1276
1287
  }
1277
- return (u, p) => (s(), a("div", ro, [
1278
- O(oo),
1288
+ return (a, p) => (s(), c("div", ro, [
1289
+ B(oo),
1279
1290
  f("div", {
1280
1291
  class: "brick-canvas__scroll",
1281
- onClick: d
1292
+ onClick: u
1282
1293
  }, [
1283
1294
  f("div", {
1284
1295
  class: "brick-canvas__page",
1285
1296
  style: R({
1286
- width: c.value + "px",
1297
+ width: d.value + "px",
1287
1298
  minHeight: o.value + "px",
1288
- "--page-height": o.value + "px",
1289
- "--margin-top": k(t).document.pageMargins[1] * N + "px",
1290
- "--margin-bottom": k(t).document.pageMargins[3] * N + "px",
1291
- paddingTop: k(t).document.pageMargins[1] * N + "px",
1292
- paddingRight: k(t).document.pageMargins[2] * N + "px",
1293
- paddingBottom: k(t).document.pageMargins[3] * N + "px",
1294
- paddingLeft: k(t).document.pageMargins[0] * N + "px"
1299
+ paddingTop: k(t).document.pageMargins[1] * V + "px",
1300
+ paddingRight: k(t).document.pageMargins[2] * V + "px",
1301
+ paddingBottom: k(t).document.pageMargins[3] * V + "px",
1302
+ paddingLeft: k(t).document.pageMargins[0] * V + "px"
1295
1303
  })
1296
1304
  }, [
1297
- O(Se, { "parent-id": null }, {
1305
+ B(Se, { "parent-id": null }, {
1298
1306
  default: W(() => [
1299
- (s(!0), a(C, null, P(k(t).document.content, (r, l) => (s(), B(Yn, {
1307
+ (s(!0), c(C, null, P(k(t).document.content, (r, l) => (s(), M(Yn, {
1300
1308
  key: r.id,
1301
1309
  node: r,
1302
1310
  path: [l]
@@ -1308,28 +1316,28 @@ const Hn = {
1308
1316
  ])
1309
1317
  ]));
1310
1318
  }
1311
- }), io = /* @__PURE__ */ S(lo, [["__scopeId", "data-v-f40597a5"]]), so = ["data-element-type"], ao = { class: "brick-element-list__icon" }, co = { class: "brick-element-list__label" }, uo = /* @__PURE__ */ _({
1319
+ }), io = /* @__PURE__ */ S(lo, [["__scopeId", "data-v-364329ec"]]), so = ["data-element-type"], ao = { class: "brick-element-list__icon" }, co = { class: "brick-element-list__label" }, uo = /* @__PURE__ */ _({
1312
1320
  __name: "ToolbarElementList",
1313
1321
  setup(e) {
1314
1322
  const t = E(null);
1315
1323
  let n = null;
1316
- const i = be(), c = De();
1324
+ const i = be(), d = De();
1317
1325
  return se(() => {
1318
1326
  t.value && (n = i.initToolbar(t.value));
1319
1327
  }), ae(() => {
1320
1328
  n?.destroy();
1321
- }), (o, d) => (s(), a("div", {
1329
+ }), (o, u) => (s(), c("div", {
1322
1330
  ref_key: "el",
1323
1331
  ref: t,
1324
1332
  class: "brick-element-list"
1325
1333
  }, [
1326
- (s(!0), a(C, null, P(k(c), (u) => (s(), a("div", {
1327
- key: u.type,
1334
+ (s(!0), c(C, null, P(k(d), (a) => (s(), c("div", {
1335
+ key: a.type,
1328
1336
  class: "brick-element-list__item",
1329
- "data-element-type": u.type
1337
+ "data-element-type": a.type
1330
1338
  }, [
1331
- f("span", ao, w(u.icon), 1),
1332
- f("span", co, w(u.label), 1)
1339
+ f("span", ao, w(a.icon), 1),
1340
+ f("span", co, w(a.label), 1)
1333
1341
  ], 8, so))), 128))
1334
1342
  ], 512));
1335
1343
  }
@@ -1355,7 +1363,7 @@ const Hn = {
1355
1363
  return t.node.props[l];
1356
1364
  if (r === "style")
1357
1365
  return t.node.style[l];
1358
- }), c = $(() => {
1366
+ }), d = $(() => {
1359
1367
  const p = i.value;
1360
1368
  return t.descriptor.type === "textarea" && Array.isArray(p) ? p.join(`
1361
1369
  `) : p;
@@ -1366,11 +1374,11 @@ const Hn = {
1366
1374
  t.descriptor.type === "textarea" && Array.isArray(i.value) && (b = p.split(`
1367
1375
  `)), l === "props" ? n.updateProps(t.node.id, { [y]: b }) : l === "style" && n.updateStyle(t.node.id, { [y]: b });
1368
1376
  }
1369
- function d(p, r) {
1370
- const y = [...c.value ?? [0, 0, 0, 0]];
1377
+ function u(p, r) {
1378
+ const y = [...d.value ?? [0, 0, 0, 0]];
1371
1379
  y[p] = r, o(y);
1372
1380
  }
1373
- function u(p) {
1381
+ function a(p) {
1374
1382
  const l = p.target.files?.[0];
1375
1383
  if (!l) return;
1376
1384
  const y = new FileReader();
@@ -1378,77 +1386,77 @@ const Hn = {
1378
1386
  o(y.result);
1379
1387
  }, y.readAsDataURL(l);
1380
1388
  }
1381
- return (p, r) => (s(), a("div", fo, [
1389
+ return (p, r) => (s(), c("div", fo, [
1382
1390
  f("label", mo, w(e.descriptor.label), 1),
1383
- e.descriptor.type === "text" ? (s(), a("input", {
1391
+ e.descriptor.type === "text" ? (s(), c("input", {
1384
1392
  key: 0,
1385
1393
  type: "text",
1386
1394
  class: "brick-field__input",
1387
- value: c.value,
1395
+ value: d.value,
1388
1396
  onInput: r[0] || (r[0] = (l) => o(l.target.value))
1389
- }, null, 40, yo)) : e.descriptor.type === "textarea" ? (s(), a("textarea", {
1397
+ }, null, 40, yo)) : e.descriptor.type === "textarea" ? (s(), c("textarea", {
1390
1398
  key: 1,
1391
1399
  class: "brick-field__textarea",
1392
- value: c.value,
1400
+ value: d.value,
1393
1401
  rows: "3",
1394
1402
  onInput: r[1] || (r[1] = (l) => o(l.target.value))
1395
- }, null, 40, go)) : e.descriptor.type === "number" ? (s(), a("input", {
1403
+ }, null, 40, go)) : e.descriptor.type === "number" ? (s(), c("input", {
1396
1404
  key: 2,
1397
1405
  type: "number",
1398
1406
  class: "brick-field__input",
1399
- value: c.value,
1407
+ value: d.value,
1400
1408
  min: e.descriptor.min,
1401
1409
  max: e.descriptor.max,
1402
1410
  step: e.descriptor.step,
1403
1411
  onInput: r[2] || (r[2] = (l) => o(Number(l.target.value)))
1404
- }, null, 40, bo)) : e.descriptor.type === "color" ? (s(), a("input", {
1412
+ }, null, 40, bo)) : e.descriptor.type === "color" ? (s(), c("input", {
1405
1413
  key: 3,
1406
1414
  type: "color",
1407
1415
  class: "brick-field__color",
1408
- value: c.value ?? "#000000",
1416
+ value: d.value ?? "#000000",
1409
1417
  onInput: r[3] || (r[3] = (l) => o(l.target.value))
1410
- }, null, 40, vo)) : e.descriptor.type === "select" ? (s(), a("select", {
1418
+ }, null, 40, vo)) : e.descriptor.type === "select" ? (s(), c("select", {
1411
1419
  key: 4,
1412
1420
  class: "brick-field__select",
1413
- value: c.value,
1421
+ value: d.value,
1414
1422
  onChange: r[4] || (r[4] = (l) => o(l.target.value || void 0))
1415
1423
  }, [
1416
- (s(!0), a(C, null, P(e.descriptor.options, (l) => (s(), a("option", {
1424
+ (s(!0), c(C, null, P(e.descriptor.options, (l) => (s(), c("option", {
1417
1425
  key: String(l.value),
1418
1426
  value: l.value
1419
1427
  }, w(l.label), 9, _o))), 128))
1420
- ], 40, ho)) : e.descriptor.type === "toggle" ? (s(), a("label", ko, [
1428
+ ], 40, ho)) : e.descriptor.type === "toggle" ? (s(), c("label", ko, [
1421
1429
  f("input", {
1422
1430
  type: "checkbox",
1423
- checked: c.value,
1431
+ checked: d.value,
1424
1432
  onChange: r[5] || (r[5] = (l) => o(l.target.checked))
1425
1433
  }, null, 40, xo),
1426
- f("span", null, w(c.value ? "On" : "Off"), 1)
1427
- ])) : e.descriptor.type === "margin" ? (s(), a("div", So, [
1428
- (s(), a(C, null, P(["L", "T", "R", "B"], (l, y) => f("input", {
1434
+ f("span", null, w(d.value ? "On" : "Off"), 1)
1435
+ ])) : e.descriptor.type === "margin" ? (s(), c("div", So, [
1436
+ (s(), c(C, null, P(["L", "T", "R", "B"], (l, y) => f("input", {
1429
1437
  key: l,
1430
1438
  type: "number",
1431
1439
  class: "brick-field__margin-input",
1432
1440
  placeholder: l,
1433
- value: (c.value ?? [0, 0, 0, 0])[y],
1434
- onInput: (b) => d(y, Number(b.target.value))
1441
+ value: (d.value ?? [0, 0, 0, 0])[y],
1442
+ onInput: (b) => u(y, Number(b.target.value))
1435
1443
  }, null, 40, Co)), 64))
1436
- ])) : e.descriptor.type === "slider" ? (s(), a("div", wo, [
1444
+ ])) : e.descriptor.type === "slider" ? (s(), c("div", wo, [
1437
1445
  f("input", {
1438
1446
  type: "range",
1439
- value: c.value,
1447
+ value: d.value,
1440
1448
  min: e.descriptor.min,
1441
1449
  max: e.descriptor.max,
1442
1450
  step: e.descriptor.step,
1443
1451
  onInput: r[6] || (r[6] = (l) => o(Number(l.target.value)))
1444
1452
  }, null, 40, Po),
1445
- f("span", Eo, w(c.value), 1)
1446
- ])) : e.descriptor.type === "file" ? (s(), a("input", {
1453
+ f("span", Eo, w(d.value), 1)
1454
+ ])) : e.descriptor.type === "file" ? (s(), c("input", {
1447
1455
  key: 8,
1448
1456
  type: "file",
1449
1457
  accept: "image/*",
1450
1458
  class: "brick-field__file",
1451
- onChange: u
1459
+ onChange: a
1452
1460
  }, null, 32)) : I("", !0)
1453
1461
  ]));
1454
1462
  }
@@ -1462,33 +1470,33 @@ const Hn = {
1462
1470
  __name: "PropertyEditor",
1463
1471
  setup(e) {
1464
1472
  const t = U(), n = $(() => {
1465
- const d = t.selectedNode.value;
1466
- return d ? F(d.type) : null;
1473
+ const u = t.selectedNode.value;
1474
+ return u ? F(u.type) : null;
1467
1475
  }), i = $(() => {
1468
1476
  if (!n.value) return {};
1469
- const d = {};
1470
- for (const u of n.value.propertyFields)
1471
- d[u.section] || (d[u.section] = []), d[u.section].push(u);
1472
- return d;
1473
- }), c = {
1477
+ const u = {};
1478
+ for (const a of n.value.propertyFields)
1479
+ u[a.section] || (u[a.section] = []), u[a.section].push(a);
1480
+ return u;
1481
+ }), d = {
1474
1482
  content: "Content",
1475
1483
  style: "Style",
1476
1484
  layout: "Layout",
1477
1485
  advanced: "Advanced"
1478
1486
  }, o = ["content", "style", "layout", "advanced"];
1479
- return (d, u) => k(t).selectedNode.value && n.value ? (s(), a("div", Ro, [
1487
+ return (u, a) => k(t).selectedNode.value && n.value ? (s(), c("div", Ro, [
1480
1488
  f("div", Do, w(n.value.icon) + " " + w(n.value.label), 1),
1481
- (s(), a(C, null, P(o, (p) => (s(), a(C, { key: p }, [
1482
- i.value[p] ? (s(), a("div", zo, [
1483
- f("div", To, w(c[p]), 1),
1484
- (s(!0), a(C, null, P(i.value[p], (r) => (s(), B(Io, {
1489
+ (s(), c(C, null, P(o, (p) => (s(), c(C, { key: p }, [
1490
+ i.value[p] ? (s(), c("div", zo, [
1491
+ f("div", To, w(d[p]), 1),
1492
+ (s(!0), c(C, null, P(i.value[p], (r) => (s(), M(Io, {
1485
1493
  key: r.key,
1486
1494
  descriptor: r,
1487
1495
  node: k(t).selectedNode.value
1488
1496
  }, null, 8, ["descriptor", "node"]))), 128))
1489
1497
  ])) : I("", !0)
1490
1498
  ], 64))), 64)),
1491
- (s(), B(Q(n.value.propertyEditorComponent), {
1499
+ (s(), M(Q(n.value.propertyEditorComponent), {
1492
1500
  node: k(t).selectedNode.value
1493
1501
  }, null, 8, ["node"]))
1494
1502
  ])) : I("", !0);
@@ -1500,35 +1508,35 @@ const Hn = {
1500
1508
  __name: "Toolbar",
1501
1509
  setup(e) {
1502
1510
  const t = U();
1503
- return (n, i) => (s(), a("div", Mo, [
1511
+ return (n, i) => (s(), c("div", Mo, [
1504
1512
  f("div", Bo, [
1505
1513
  i[0] || (i[0] = f("h3", { class: "brick-toolbar__title" }, "Elements", -1)),
1506
- O(po)
1514
+ B(po)
1507
1515
  ]),
1508
- k(t).selectedNode.value ? (s(), a("div", Oo, [
1516
+ k(t).selectedNode.value ? (s(), c("div", Oo, [
1509
1517
  i[1] || (i[1] = f("h3", { class: "brick-toolbar__title" }, "Properties", -1)),
1510
- O(Lo)
1518
+ B(Lo)
1511
1519
  ])) : I("", !0)
1512
1520
  ]));
1513
1521
  }
1514
1522
  }), Ao = /* @__PURE__ */ S(Vo, [["__scopeId", "data-v-5bf5f6ab"]]), Ho = { class: "brick-actionbar" }, Fo = { class: "brick-actionbar__group" }, Uo = { class: "brick-actionbar__group" }, Wo = ["disabled"], Jo = ["disabled"], Yo = ["disabled"], qo = { class: "brick-actionbar__group" }, jo = /* @__PURE__ */ _({
1515
1523
  __name: "ActionBar",
1516
1524
  setup(e) {
1517
- const t = bt(), n = St(), i = U(), c = Y(), o = Z(), d = E("document"), u = E(null);
1525
+ const t = bt(), n = St(), i = U(), d = Y(), o = Z(), u = E("document"), a = E(null);
1518
1526
  function p() {
1519
1527
  const m = i.selectedId.value;
1520
- m && (i.deselect(), c.removeElement(m));
1528
+ m && (i.deselect(), d.removeElement(m));
1521
1529
  }
1522
1530
  function r() {
1523
- const m = d.value.trim() || "document", g = m.endsWith(".pdf") ? m : m + ".pdf";
1531
+ const m = u.value.trim() || "document", g = m.endsWith(".pdf") ? m : m + ".pdf";
1524
1532
  n.exportPdf(g);
1525
1533
  }
1526
1534
  function l() {
1527
- const m = o.exportDocument(), g = JSON.stringify(m, null, 2), v = new Blob([g], { type: "application/json" }), h = URL.createObjectURL(v), x = document.createElement("a"), D = d.value.trim() || "document";
1535
+ const m = o.exportDocument(), g = JSON.stringify(m, null, 2), v = new Blob([g], { type: "application/json" }), h = URL.createObjectURL(v), x = document.createElement("a"), D = u.value.trim() || "document";
1528
1536
  x.href = h, x.download = D.endsWith(".json") ? D : D + ".json", x.click(), URL.revokeObjectURL(h);
1529
1537
  }
1530
1538
  function y() {
1531
- u.value?.click();
1539
+ a.value?.click();
1532
1540
  }
1533
1541
  function b(m) {
1534
1542
  const g = m.target, v = g.files?.[0];
@@ -1547,16 +1555,16 @@ const Hn = {
1547
1555
  }
1548
1556
  }, h.readAsText(v), g.value = "";
1549
1557
  }
1550
- return (m, g) => (s(), a("div", Ho, [
1558
+ return (m, g) => (s(), c("div", Ho, [
1551
1559
  f("div", Fo, [
1552
1560
  G(f("input", {
1553
- "onUpdate:modelValue": g[0] || (g[0] = (v) => d.value = v),
1561
+ "onUpdate:modelValue": g[0] || (g[0] = (v) => u.value = v),
1554
1562
  class: "brick-actionbar__name",
1555
1563
  type: "text",
1556
1564
  placeholder: "Document name",
1557
1565
  title: "Document name (used for export filename)"
1558
1566
  }, null, 512), [
1559
- [$e, d.value]
1567
+ [$e, u.value]
1560
1568
  ])
1561
1569
  ]),
1562
1570
  f("div", Uo, [
@@ -1601,7 +1609,7 @@ const Hn = {
1601
1609
  ]),
1602
1610
  f("input", {
1603
1611
  ref_key: "fileInput",
1604
- ref: u,
1612
+ ref: a,
1605
1613
  type: "file",
1606
1614
  accept: ".json",
1607
1615
  style: { display: "none" },
@@ -1618,21 +1626,21 @@ const Hn = {
1618
1626
  setup(e, { emit: t }) {
1619
1627
  const n = e, i = t;
1620
1628
  An();
1621
- const c = st(n.modelValue ?? ce());
1622
- at(c);
1623
- const o = ct(c);
1629
+ const d = st(n.modelValue ?? ce());
1630
+ at(d);
1631
+ const o = ct(d);
1624
1632
  dt(o);
1625
- const d = yt(c);
1626
- gt(d);
1627
- const u = pt(c, d);
1628
- ft(u);
1629
- const p = vt(c, u);
1633
+ const u = yt(d);
1634
+ gt(u);
1635
+ const a = pt(d, u);
1636
+ ft(a);
1637
+ const p = vt(d, a);
1630
1638
  ht(p);
1631
- const r = kt(c);
1639
+ const r = kt(d);
1632
1640
  xt(r);
1633
- const l = Pt(c, u);
1641
+ const l = Pt(d, a);
1634
1642
  Et(l);
1635
- const y = $t(u);
1643
+ const y = $t(a);
1636
1644
  It(y);
1637
1645
  const b = Re(), m = b.Delete, g = b.Backspace;
1638
1646
  return re(m, () => {
@@ -1640,24 +1648,24 @@ const Hn = {
1640
1648
  const v = document.activeElement;
1641
1649
  if (v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.tagName === "SELECT")) return;
1642
1650
  const h = o.selectedId.value;
1643
- o.deselect(), u.removeElement(h);
1651
+ o.deselect(), a.removeElement(h);
1644
1652
  }), re(g, () => {
1645
1653
  if (!o.selectedId.value) return;
1646
1654
  const v = document.activeElement;
1647
1655
  if (v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.tagName === "SELECT")) return;
1648
1656
  const h = o.selectedId.value;
1649
- o.deselect(), u.removeElement(h);
1657
+ o.deselect(), a.removeElement(h);
1650
1658
  }), Ie(
1651
- () => c.document,
1659
+ () => d.document,
1652
1660
  () => {
1653
- i("update:modelValue", JSON.parse(JSON.stringify(H(c.document))));
1661
+ i("update:modelValue", JSON.parse(JSON.stringify(H(d.document))));
1654
1662
  },
1655
1663
  { deep: !0 }
1656
- ), (v, h) => (s(), a("div", Xo, [
1657
- O(Go),
1664
+ ), (v, h) => (s(), c("div", Xo, [
1665
+ B(Go),
1658
1666
  f("div", Ko, [
1659
- O(io),
1660
- O(Ao)
1667
+ B(io),
1668
+ B(Ao)
1661
1669
  ])
1662
1670
  ]));
1663
1671
  }