brick-pdf 0.1.1 → 0.2.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 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 d, normalizeStyle as z, toDisplayString as w, renderSlot as X, normalizeClass as K, createElementVNode as m, Fragment as C, renderList as E, reactive as Ee, provide as D, inject as L, toRaw as H, ref as P, 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 Pe, 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() {
@@ -14,25 +14,25 @@ function ce() {
14
14
  };
15
15
  }
16
16
  const J = /* @__PURE__ */ new Map();
17
- function z(e) {
17
+ function T(e) {
18
18
  J.set(e.type, e);
19
19
  }
20
20
  function F(e) {
21
21
  return J.get(e);
22
22
  }
23
- function De() {
23
+ function ze() {
24
24
  return Array.from(J.values());
25
25
  }
26
- function or(e) {
26
+ function Go(e) {
27
27
  return J.delete(e);
28
28
  }
29
- function ze() {
29
+ function Te() {
30
30
  return { text: "New Text" };
31
31
  }
32
- function Te() {
32
+ function Ne() {
33
33
  return { fontSize: 12 };
34
34
  }
35
- function Ne(e) {
35
+ function De(e) {
36
36
  const t = { text: e.props.text }, n = e.style;
37
37
  return n.fontSize && (t.fontSize = n.fontSize), n.bold && (t.bold = n.bold), n.italics && (t.italics = n.italics), n.color && (t.color = n.color), n.alignment && (t.alignment = n.alignment), n.margin && (t.margin = n.margin), n.font && (t.font = n.font), n.lineHeight && (t.lineHeight = n.lineHeight), n.characterSpacing && (t.characterSpacing = n.characterSpacing), n.decoration && (t.decoration = n.decoration), n.decorationStyle && (t.decorationStyle = n.decorationStyle), n.decorationColor && (t.decorationColor = n.decorationColor), n.background && (t.background = n.background), n.link && (t.link = n.link), n.opacity !== void 0 && (t.opacity = n.opacity), t;
38
38
  }
@@ -42,9 +42,9 @@ const Le = /* @__PURE__ */ _({
42
42
  node: {}
43
43
  },
44
44
  setup(e) {
45
- return (t, n) => (s(), a("div", {
45
+ return (t, n) => (s(), d("div", {
46
46
  class: "brick-el-text",
47
- style: R({
47
+ style: z({
48
48
  fontSize: (e.node.style.fontSize ?? 12) + "px",
49
49
  fontWeight: e.node.style.bold ? "bold" : "normal",
50
50
  fontStyle: e.node.style.italics ? "italic" : "normal",
@@ -68,15 +68,15 @@ 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(), d("div", Be));
72
72
  }
73
- }), Ve = {
73
+ }), Ae = {
74
74
  type: "text",
75
75
  label: "Text",
76
76
  icon: "T",
77
77
  isContainer: !1,
78
- defaultProps: ze,
79
- defaultStyle: Te,
78
+ defaultProps: Te,
79
+ defaultStyle: Ne,
80
80
  rendererComponent: Me,
81
81
  propertyEditorComponent: Oe,
82
82
  propertyFields: [
@@ -103,9 +103,9 @@ const Le = /* @__PURE__ */ _({
103
103
  { key: "style.link", label: "Link URL", section: "advanced", type: "text" },
104
104
  { key: "style.opacity", label: "Opacity", section: "advanced", type: "slider", min: 0, max: 1, step: 0.1, defaultValue: 1 }
105
105
  ],
106
- toPdfmake: Ne
106
+ toPdfmake: De
107
107
  };
108
- function Ae() {
108
+ function Ve() {
109
109
  return {};
110
110
  }
111
111
  function He() {
@@ -124,9 +124,9 @@ const Ue = /* @__PURE__ */ _({
124
124
  path: {}
125
125
  },
126
126
  setup(e) {
127
- return (t, n) => (s(), a("div", {
127
+ return (t, n) => (s(), d("div", {
128
128
  class: "brick-el-stack",
129
- style: R({ backgroundColor: e.node.style.fillColor })
129
+ style: z({ backgroundColor: e.node.style.fillColor })
130
130
  }, [
131
131
  X(t.$slots, "default", {}, void 0, !0)
132
132
  ], 4));
@@ -137,15 +137,15 @@ 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(), d("div", Je));
141
141
  }
142
- }), qe = {
142
+ }), je = {
143
143
  type: "stack",
144
144
  label: "Stack",
145
145
  icon: "☰",
146
146
  isContainer: !0,
147
147
  acceptsChildTypes: null,
148
- defaultProps: Ae,
148
+ defaultProps: Ve,
149
149
  defaultStyle: He,
150
150
  rendererComponent: We,
151
151
  propertyEditorComponent: Ye,
@@ -155,7 +155,7 @@ const Ue = /* @__PURE__ */ _({
155
155
  ],
156
156
  toPdfmake: Fe
157
157
  };
158
- function je() {
158
+ function qe() {
159
159
  return { columnGap: 10 };
160
160
  }
161
161
  function Ge() {
@@ -175,9 +175,9 @@ const Ke = /* @__PURE__ */ _({
175
175
  path: {}
176
176
  },
177
177
  setup(e) {
178
- return (t, n) => (s(), a("div", {
178
+ return (t, n) => (s(), d("div", {
179
179
  class: "brick-el-columns",
180
- style: R({ "--column-gap": (e.node.props.columnGap ?? 10) + "px" })
180
+ style: z({ "--column-gap": (e.node.props.columnGap ?? 10) + "px" })
181
181
  }, [
182
182
  X(t.$slots, "default", {}, void 0, !0)
183
183
  ], 4));
@@ -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(), d("div", Ze));
192
192
  }
193
193
  }), tt = {
194
194
  type: "columns",
@@ -196,7 +196,7 @@ const Ke = /* @__PURE__ */ _({
196
196
  icon: "▥",
197
197
  isContainer: !0,
198
198
  acceptsChildTypes: null,
199
- defaultProps: je,
199
+ defaultProps: qe,
200
200
  defaultStyle: Ge,
201
201
  rendererComponent: Qe,
202
202
  propertyEditorComponent: et,
@@ -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(), d("div", {
242
242
  class: K(["brick-el-table", "brick-el-table--" + (e.node.props.layout ?? "lightHorizontalLines")]),
243
- style: R({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
243
+ style: z({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
244
244
  }, [
245
- f("table", null, [
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", {
245
+ m("table", null, [
246
+ m("thead", null, [
247
+ (s(!0), d(C, null, E(e.node.props.body.slice(0, e.node.props.headerRows), (i, c) => (s(), d("tr", {
248
248
  key: "h" + c
249
249
  }, [
250
- (s(!0), a(C, null, P(i, (o, d) => (s(), a("th", { key: d }, w(o), 1))), 128))
250
+ (s(!0), d(C, null, E(i, (o, u) => (s(), d("th", { key: u }, w(o), 1))), 128))
251
251
  ]))), 128))
252
252
  ]),
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", {
253
+ m("tbody", null, [
254
+ (s(!0), d(C, null, E(e.node.props.body.slice(e.node.props.headerRows), (i, c) => (s(), d("tr", {
255
255
  key: "b" + c
256
256
  }, [
257
- (s(!0), a(C, null, P(i, (o, d) => (s(), a("td", { key: d }, w(o), 1))), 128))
257
+ (s(!0), d(C, null, E(i, (o, u) => (s(), d("td", { key: u }, w(o), 1))), 128))
258
258
  ]))), 128))
259
259
  ])
260
260
  ])
@@ -262,48 +262,48 @@ const lt = /* @__PURE__ */ _({
262
262
  }
263
263
  }), it = /* @__PURE__ */ S(lt, [["__scopeId", "data-v-b863b05d"]]), de = /* @__PURE__ */ Symbol("brick-pdf-document-store");
264
264
  function st(e) {
265
- const t = Pe(e ?? ce());
266
- function n(u, p) {
265
+ const t = Ee(e ?? ce());
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
284
  function c() {
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: c, loadDocument: o, exportDocument: u };
294
294
  }
295
295
  function at(e) {
296
- L(de, e);
296
+ D(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;
303
303
  }
304
304
  const ue = /* @__PURE__ */ Symbol("brick-pdf-selection");
305
305
  function ct(e) {
306
- const t = E(null), n = $(() => t.value ? e.findNodeById(t.value)?.node ?? null : null);
306
+ const t = P(null), n = $(() => t.value ? e.findNodeById(t.value)?.node ?? null : null);
307
307
  function i(o) {
308
308
  t.value = o;
309
309
  }
@@ -313,10 +313,10 @@ function ct(e) {
313
313
  return { selectedId: t, selectedNode: n, select: i, deselect: c };
314
314
  }
315
315
  function dt(e) {
316
- L(ue, e);
316
+ D(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;
@@ -346,10 +346,10 @@ function pt(e, t) {
346
346
  props: y.defaultProps(),
347
347
  style: y.defaultStyle(),
348
348
  children: []
349
- }, m = r ? e.findNodeById(r)?.node.children : e.document.content;
350
- if (!m) return null;
351
- const g = l ?? m.length;
352
- return m.splice(g, 0, b), b;
349
+ }, f = r ? e.findNodeById(r)?.node.children : e.document.content;
350
+ if (!f) return null;
351
+ const g = l ?? f.length;
352
+ return f.splice(g, 0, b), b;
353
353
  }
354
354
  function i(p) {
355
355
  const r = e.findNodeById(p);
@@ -361,8 +361,8 @@ function pt(e, t) {
361
361
  t.record();
362
362
  const b = y.parent.splice(y.index, 1)[0];
363
363
  if (!b) return;
364
- const m = r ? e.findNodeById(r)?.node.children : e.document.content;
365
- m && m.splice(l, 0, b);
364
+ const f = r ? e.findNodeById(r)?.node.children : e.document.content;
365
+ f && f.splice(l, 0, b);
366
366
  }
367
367
  function o(p) {
368
368
  const r = e.findNodeById(p);
@@ -371,38 +371,38 @@ 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: c, duplicateElement: o, updateProps: u, updateStyle: a };
383
383
  }
384
384
  function ft(e) {
385
- L(pe, e);
385
+ D(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;
392
392
  }
393
393
  const ye = /* @__PURE__ */ Symbol("brick-pdf-history"), mt = 50;
394
394
  function yt(e) {
395
- const t = E([]), n = E([]);
395
+ const t = P([]), n = P([]);
396
396
  let i = 0;
397
397
  const c = $(() => t.value.length > 0), o = $(() => n.value.length > 0);
398
- function d() {
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,76 @@ 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: c, canRedo: o, record: u, undo: a, redo: p };
414
414
  }
415
415
  function gt(e) {
416
- L(ye, e);
416
+ D(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 = P(!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 c(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))
448
- return;
449
- }
450
- }
451
- t.addElement(p, o, d.newIndex);
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.elementId, l = p.dataset.elementType, y = (b) => {
453
+ if (!u || !b) return !1;
454
+ const f = e.findNodeById(u);
455
+ if (!f) return !1;
456
+ const g = F(f.node.type);
457
+ return !!(g?.acceptsChildTypes && !g.acceptsChildTypes.includes(b));
458
+ };
459
+ if (r) {
460
+ if (p.parentNode?.removeChild(p), y(l)) return;
461
+ t.moveElement(r, u, a.newIndex ?? 0);
462
+ return;
452
463
  }
464
+ l && (p.parentNode?.removeChild(p), !y(l) && t.addElement(l, u, a.newIndex));
453
465
  },
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);
466
+ onEnd(a) {
467
+ if (n.value = !1, a.from === a.to && a.oldIndex !== void 0 && a.newIndex !== void 0 && a.oldIndex !== a.newIndex && a.item.dataset.elementId) {
468
+ const p = u ? e.findNodeById(u)?.node.children : e.document.content;
469
+ if (!p) return;
470
+ const r = p.splice(a.oldIndex, 1)[0];
471
+ r && p.splice(a.newIndex, 0, r);
460
472
  }
461
473
  }
462
474
  });
463
475
  }
464
- return { initToolbar: n, initContainer: i };
476
+ return { initToolbar: i, initContainer: c, isDragging: n };
465
477
  }
466
478
  function ht(e) {
467
- L(ge, e);
479
+ D(ge, e);
468
480
  }
469
481
  function be() {
470
- const e = M(ge);
482
+ const e = L(ge);
471
483
  if (!e)
472
484
  throw new Error("useDragDrop() requires a BrickPdf ancestor component");
473
485
  return e;
@@ -493,28 +505,28 @@ function kt(e) {
493
505
  };
494
506
  }
495
507
  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;
508
+ const o = await import("pdfmake/build/pdfmake"), u = await import("pdfmake/build/vfs_fonts"), a = o.default || o, p = u.pdfMake;
509
+ return p && p.vfs ? a.vfs = p.vfs : u.default && (a.vfs = u.default), a;
498
510
  }
499
511
  function i(o) {
500
- const d = t();
501
- n().then((u) => {
502
- u.createPdf(d).download(o ?? "document.pdf");
512
+ const u = t();
513
+ n().then((a) => {
514
+ a.createPdf(u).download(o ?? "document.pdf");
503
515
  });
504
516
  }
505
517
  function c() {
506
518
  const o = t();
507
- n().then((d) => {
508
- d.createPdf(o).open();
519
+ n().then((u) => {
520
+ u.createPdf(o).open();
509
521
  });
510
522
  }
511
523
  return { toDocumentDefinition: t, exportPdf: i, openPdf: c };
512
524
  }
513
525
  function xt(e) {
514
- L(ve, e);
526
+ D(ve, e);
515
527
  }
516
528
  function St() {
517
- const e = M(ve);
529
+ const e = L(ve);
518
530
  if (!e)
519
531
  throw new Error("usePdfExport() requires a BrickPdf ancestor component");
520
532
  return e;
@@ -533,13 +545,13 @@ function ke(e) {
533
545
  children: e.children.map(ke)
534
546
  };
535
547
  }
536
- function Pt(e, t) {
537
- const n = E(null), i = E(!1), c = E(null), o = E(!1);
538
- function d(r) {
548
+ function Et(e, t) {
549
+ const n = P(null), i = P(!1), c = P(null), o = P(!1);
550
+ function u(r) {
539
551
  const l = e.findNodeById(r);
540
552
  l && (n.value = structuredClone(l.node), i.value = !1, c.value = null, o.value = !0);
541
553
  }
542
- function u(r) {
554
+ function a(r) {
543
555
  const l = e.findNodeById(r);
544
556
  l && (n.value = structuredClone(l.node), i.value = !0, c.value = r, o.value = !0);
545
557
  }
@@ -549,25 +561,25 @@ function Pt(e, t) {
549
561
  const l = ke(n.value), y = r ? e.findNodeById(r)?.node.children : e.document.content;
550
562
  y && (y.push(l), i.value && (n.value = null, o.value = !1));
551
563
  }
552
- return { hasClipboard: o, copy: d, cut: u, paste: p };
564
+ return { hasClipboard: o, copy: u, cut: a, paste: p };
553
565
  }
554
- function Et(e) {
555
- L(_e, e);
566
+ function Pt(e) {
567
+ D(_e, e);
556
568
  }
557
- function rr() {
558
- const e = M(_e);
569
+ function Xo() {
570
+ const e = L(_e);
559
571
  if (!e)
560
572
  throw new Error("useClipboard() requires a BrickPdf ancestor component");
561
573
  return e;
562
574
  }
563
575
  const xe = /* @__PURE__ */ Symbol("brick-pdf-resize");
564
576
  function $t(e) {
565
- const t = E(!1);
566
- function n(i, c, o, d) {
577
+ const t = P(!1);
578
+ function n(i, c, o, u) {
567
579
  t.value = !0;
568
- const u = d.clientX, p = d.clientY, r = o.width, l = o.height;
569
- function y(m) {
570
- const g = m.clientX - u, v = m.clientY - p;
580
+ const a = u.clientX, p = u.clientY, r = o.width, l = o.height;
581
+ function y(f) {
582
+ const g = f.clientX - a, v = f.clientY - p;
571
583
  let h = r, x = l;
572
584
  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, {
573
585
  width: Math.round(h),
@@ -582,15 +594,15 @@ function $t(e) {
582
594
  return { isResizing: t, startResize: n };
583
595
  }
584
596
  function It(e) {
585
- L(xe, e);
597
+ D(xe, e);
586
598
  }
587
- function lr() {
588
- const e = M(xe);
599
+ function Ko() {
600
+ const e = L(xe);
589
601
  if (!e)
590
602
  throw new Error("useResize() requires a BrickPdf ancestor component");
591
603
  return e;
592
604
  }
593
- const Rt = { class: "brick-table-editor" }, Dt = { class: "brick-table-editor__grid" }, zt = ["onClick"], Tt = { class: "brick-table-editor__row-header" }, Nt = ["onClick"], Lt = ["value", "onInput"], Mt = /* @__PURE__ */ _({
605
+ const Rt = { class: "brick-table-editor" }, zt = { class: "brick-table-editor__grid" }, Tt = ["onClick"], Nt = { class: "brick-table-editor__row-header" }, Dt = ["onClick"], Lt = ["value", "onInput"], Mt = /* @__PURE__ */ _({
594
606
  __name: "TablePropertyEditor",
595
607
  props: {
596
608
  node: {}
@@ -604,15 +616,15 @@ const Rt = { class: "brick-table-editor" }, Dt = { class: "brick-table-editor__g
604
616
  return t.node.props.widths ?? [];
605
617
  }
606
618
  function o(l, y, b) {
607
- const m = i().map((g) => [...g]);
608
- m[l][y] = b, n.updateProps(t.node.id, { body: m });
619
+ const f = i().map((g) => [...g]);
620
+ f[l][y] = b, n.updateProps(t.node.id, { body: f });
609
621
  }
610
- function d() {
622
+ function u() {
611
623
  const l = i().map((b) => [...b]), y = l[0]?.length ?? 2;
612
624
  l.push(Array(y).fill("")), n.updateProps(t.node.id, { body: l });
613
625
  }
614
- function u(l) {
615
- const y = i().map((m) => [...m]);
626
+ function a(l) {
627
+ const y = i().map((f) => [...f]);
616
628
  if (y.length <= 1) return;
617
629
  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
630
  }
@@ -621,61 +633,61 @@ const Rt = { class: "brick-table-editor" }, Dt = { class: "brick-table-editor__g
621
633
  n.updateProps(t.node.id, { body: l, widths: y });
622
634
  }
623
635
  function r(l) {
624
- const y = i().map((m) => {
625
- const g = [...m];
636
+ const y = i().map((f) => {
637
+ const g = [...f];
626
638
  return g.splice(l, 1), g;
627
639
  });
628
640
  if ((y[0]?.length ?? 0) < 1) return;
629
641
  const b = [...c()];
630
642
  b.splice(l, 1), n.updateProps(t.node.id, { body: y, widths: b });
631
643
  }
632
- return (l, y) => (s(), a("div", Rt, [
633
- f("div", { class: "brick-table-editor__actions" }, [
634
- f("button", {
644
+ return (l, y) => (s(), d("div", Rt, [
645
+ m("div", { class: "brick-table-editor__actions" }, [
646
+ m("button", {
635
647
  class: "brick-table-editor__btn",
636
- onClick: d
648
+ onClick: u
637
649
  }, "+ Row"),
638
- f("button", {
650
+ m("button", {
639
651
  class: "brick-table-editor__btn",
640
652
  onClick: p
641
653
  }, "+ Column")
642
654
  ]),
643
- f("div", Dt, [
644
- f("table", null, [
645
- f("thead", null, [
646
- f("tr", null, [
647
- 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", {
649
- key: m,
655
+ m("div", zt, [
656
+ m("table", null, [
657
+ m("thead", null, [
658
+ m("tr", null, [
659
+ y[0] || (y[0] = m("th", { class: "brick-table-editor__corner" }, null, -1)),
660
+ (s(!0), d(C, null, E(i()[0] ?? [], (b, f) => (s(), d("th", {
661
+ key: f,
650
662
  class: "brick-table-editor__col-header"
651
663
  }, [
652
- ne(" Col " + w(m + 1) + " ", 1),
653
- (i()[0]?.length ?? 0) > 1 ? (s(), a("button", {
664
+ ne(" Col " + w(f + 1) + " ", 1),
665
+ (i()[0]?.length ?? 0) > 1 ? (s(), d("button", {
654
666
  key: 0,
655
667
  class: "brick-table-editor__remove-btn",
656
668
  title: "Remove column",
657
- onClick: (g) => r(m)
658
- }, "x", 8, zt)) : I("", !0)
669
+ onClick: (g) => r(f)
670
+ }, "x", 8, Tt)) : I("", !0)
659
671
  ]))), 128))
660
672
  ])
661
673
  ]),
662
- f("tbody", null, [
663
- (s(!0), a(C, null, P(i(), (b, m) => (s(), a("tr", { key: m }, [
664
- f("td", Tt, [
665
- ne(w(m + 1) + " ", 1),
666
- i().length > 1 ? (s(), a("button", {
674
+ m("tbody", null, [
675
+ (s(!0), d(C, null, E(i(), (b, f) => (s(), d("tr", { key: f }, [
676
+ m("td", Nt, [
677
+ ne(w(f + 1) + " ", 1),
678
+ i().length > 1 ? (s(), d("button", {
667
679
  key: 0,
668
680
  class: "brick-table-editor__remove-btn",
669
681
  title: "Remove row",
670
- onClick: (g) => u(m)
671
- }, "x", 8, Nt)) : I("", !0)
682
+ onClick: (g) => a(f)
683
+ }, "x", 8, Dt)) : I("", !0)
672
684
  ]),
673
- (s(!0), a(C, null, P(b, (g, v) => (s(), a("td", { key: v }, [
674
- f("input", {
685
+ (s(!0), d(C, null, E(b, (g, v) => (s(), d("td", { key: v }, [
686
+ m("input", {
675
687
  class: "brick-table-editor__cell",
676
688
  type: "text",
677
689
  value: g,
678
- onInput: (h) => o(m, v, h.target.value)
690
+ onInput: (h) => o(f, v, h.target.value)
679
691
  }, null, 40, Lt)
680
692
  ]))), 128))
681
693
  ]))), 128))
@@ -708,10 +720,10 @@ const Rt = { class: "brick-table-editor" }, Dt = { class: "brick-table-editor__g
708
720
  ],
709
721
  toPdfmake: rt
710
722
  };
711
- function Vt() {
723
+ function At() {
712
724
  return { src: "", width: 200, height: 150, fit: null };
713
725
  }
714
- function At() {
726
+ function Vt() {
715
727
  return {};
716
728
  }
717
729
  function Ht(e) {
@@ -729,36 +741,36 @@ const Ft = { class: "brick-el-image" }, Ut = ["src"], Wt = {
729
741
  node: {}
730
742
  },
731
743
  setup(e) {
732
- return (t, n) => (s(), a("div", Ft, [
733
- e.node.props.src ? (s(), a("img", {
744
+ return (t, n) => (s(), d("div", Ft, [
745
+ e.node.props.src ? (s(), d("img", {
734
746
  key: 0,
735
747
  src: e.node.props.src,
736
- style: R({
748
+ style: z({
737
749
  width: e.node.props.width + "px",
738
750
  height: e.node.props.height + "px",
739
751
  objectFit: "contain",
740
752
  opacity: e.node.style.opacity
741
753
  })
742
- }, null, 12, Ut)) : (s(), a("div", Wt, " No image selected "))
754
+ }, null, 12, Ut)) : (s(), d("div", Wt, " No image selected "))
743
755
  ]));
744
756
  }
745
- }), Yt = /* @__PURE__ */ S(Jt, [["__scopeId", "data-v-38184258"]]), qt = { class: "brick-image-editor" }, jt = /* @__PURE__ */ _({
757
+ }), Yt = /* @__PURE__ */ S(Jt, [["__scopeId", "data-v-38184258"]]), jt = { class: "brick-image-editor" }, qt = /* @__PURE__ */ _({
746
758
  __name: "ImagePropertyEditor",
747
759
  props: {
748
760
  node: {}
749
761
  },
750
762
  setup(e) {
751
- return (t, n) => (s(), a("div", qt));
763
+ return (t, n) => (s(), d("div", jt));
752
764
  }
753
765
  }), Gt = {
754
766
  type: "image",
755
767
  label: "Image",
756
768
  icon: "🖼",
757
769
  isContainer: !1,
758
- defaultProps: Vt,
759
- defaultStyle: At,
770
+ defaultProps: At,
771
+ defaultStyle: Vt,
760
772
  rendererComponent: Yt,
761
- propertyEditorComponent: jt,
773
+ propertyEditorComponent: qt,
762
774
  propertyFields: [
763
775
  { key: "props.src", label: "Image (Base64)", section: "content", type: "file" },
764
776
  { key: "props.width", label: "Width", section: "layout", type: "number", min: 10, max: 1e3, step: 10, defaultValue: 200 },
@@ -789,13 +801,13 @@ const Zt = /* @__PURE__ */ _({
789
801
  node: {}
790
802
  },
791
803
  setup(e) {
792
- return (t, n) => (s(), a("div", {
804
+ return (t, n) => (s(), d("div", {
793
805
  class: "brick-el-list",
794
- style: R({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
806
+ style: z({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
795
807
  }, [
796
- (s(), B(Q(e.node.props.ordered ? "ol" : "ul"), null, {
808
+ (s(), M(Q(e.node.props.ordered ? "ol" : "ul"), null, {
797
809
  default: W(() => [
798
- (s(!0), a(C, null, P(e.node.props.items, (i, c) => (s(), a("li", { key: c }, w(i), 1))), 128))
810
+ (s(!0), d(C, null, E(e.node.props.items, (i, c) => (s(), d("li", { key: c }, w(i), 1))), 128))
799
811
  ]),
800
812
  _: 1
801
813
  }))
@@ -807,7 +819,7 @@ const Zt = /* @__PURE__ */ _({
807
819
  node: {}
808
820
  },
809
821
  setup(e) {
810
- return (t, n) => (s(), a("div", tn));
822
+ return (t, n) => (s(), d("div", tn));
811
823
  }
812
824
  }), on = {
813
825
  type: "list",
@@ -848,14 +860,14 @@ const an = { class: "brick-el-qr__preview" }, cn = /* @__PURE__ */ _({
848
860
  node: {}
849
861
  },
850
862
  setup(e) {
851
- return (t, n) => (s(), a("div", {
863
+ return (t, n) => (s(), d("div", {
852
864
  class: "brick-el-qr",
853
- style: R({
865
+ style: z({
854
866
  width: (e.node.props.fit ?? 100) + "px",
855
867
  height: (e.node.props.fit ?? 100) + "px"
856
868
  })
857
869
  }, [
858
- f("div", an, "QR: " + w(e.node.props.data), 1)
870
+ m("div", an, "QR: " + w(e.node.props.data), 1)
859
871
  ], 4));
860
872
  }
861
873
  }), dn = /* @__PURE__ */ S(cn, [["__scopeId", "data-v-f106ba48"]]), un = { class: "brick-qr-editor" }, pn = /* @__PURE__ */ _({
@@ -864,7 +876,7 @@ const an = { class: "brick-el-qr__preview" }, cn = /* @__PURE__ */ _({
864
876
  node: {}
865
877
  },
866
878
  setup(e) {
867
- return (t, n) => (s(), a("div", un));
879
+ return (t, n) => (s(), d("div", un));
868
880
  }
869
881
  }), fn = {
870
882
  type: "qr",
@@ -909,9 +921,9 @@ const bn = ["innerHTML"], vn = /* @__PURE__ */ _({
909
921
  node: {}
910
922
  },
911
923
  setup(e) {
912
- return (t, n) => (s(), a("div", {
924
+ return (t, n) => (s(), d("div", {
913
925
  class: "brick-el-svg",
914
- style: R({
926
+ style: z({
915
927
  width: e.node.props.width + "px",
916
928
  height: e.node.props.height + "px"
917
929
  }),
@@ -924,7 +936,7 @@ const bn = ["innerHTML"], vn = /* @__PURE__ */ _({
924
936
  node: {}
925
937
  },
926
938
  setup(e) {
927
- return (t, n) => (s(), a("div", _n));
939
+ return (t, n) => (s(), d("div", _n));
928
940
  }
929
941
  }), xn = {
930
942
  type: "svg",
@@ -949,195 +961,137 @@ const bn = ["innerHTML"], vn = /* @__PURE__ */ _({
949
961
  toPdfmake: gn
950
962
  };
951
963
  function Sn() {
952
- return {
953
- commands: [
954
- { type: "rect", x: 0, y: 0, w: 200, h: 100, color: "#eeeeee" }
955
- ],
956
- width: 200,
957
- height: 100
958
- };
964
+ return {};
959
965
  }
960
966
  function Cn() {
961
967
  return {};
962
968
  }
963
969
  function wn(e) {
964
- const t = {
965
- canvas: e.props.commands
966
- };
967
- return e.style.margin && (t.margin = e.style.margin), t;
968
- }
969
- const Pn = /* @__PURE__ */ _({
970
- __name: "CanvasDrawRenderer",
971
- props: {
972
- node: {}
973
- },
974
- setup(e) {
975
- return (t, n) => (s(), a("div", {
976
- class: "brick-el-canvas",
977
- style: R({
978
- width: (e.node.props.width ?? 200) + "px",
979
- height: (e.node.props.height ?? 100) + "px"
980
- })
981
- }, [...n[0] || (n[0] = [
982
- f("div", { class: "brick-el-canvas__label" }, "Canvas Drawing", -1)
983
- ])], 4));
984
- }
985
- }), En = /* @__PURE__ */ S(Pn, [["__scopeId", "data-v-1b986707"]]), $n = { class: "brick-canvas-editor" }, In = /* @__PURE__ */ _({
986
- __name: "CanvasDrawPropertyEditor",
987
- props: {
988
- node: {}
989
- },
990
- setup(e) {
991
- return (t, n) => (s(), a("div", $n));
992
- }
993
- }), Rn = {
994
- type: "canvas",
995
- label: "Canvas",
996
- icon: "△",
997
- isContainer: !1,
998
- defaultProps: Sn,
999
- defaultStyle: Cn,
1000
- rendererComponent: En,
1001
- propertyEditorComponent: In,
1002
- propertyFields: [
1003
- { key: "props.width", label: "Width", section: "layout", type: "number", min: 10, max: 1e3, step: 10, defaultValue: 200 },
1004
- { key: "props.height", label: "Height", section: "layout", type: "number", min: 10, max: 1e3, step: 10, defaultValue: 100 },
1005
- { key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
1006
- ],
1007
- toPdfmake: wn
1008
- };
1009
- function Dn() {
1010
- return {};
1011
- }
1012
- function zn() {
1013
- return {};
1014
- }
1015
- function Tn(e) {
1016
970
  return { text: "", pageBreak: "after" };
1017
971
  }
1018
- const Nn = { class: "brick-el-pagebreak" }, Ln = /* @__PURE__ */ _({
972
+ const En = { class: "brick-el-pagebreak" }, Pn = /* @__PURE__ */ _({
1019
973
  __name: "PageBreakRenderer",
1020
974
  props: {
1021
975
  node: {}
1022
976
  },
1023
977
  setup(e) {
1024
- return (t, n) => (s(), a("div", Nn, [...n[0] || (n[0] = [
1025
- f("hr", null, null, -1),
1026
- f("span", null, "Page Break", -1),
1027
- f("hr", null, null, -1)
978
+ return (t, n) => (s(), d("div", En, [...n[0] || (n[0] = [
979
+ m("hr", null, null, -1),
980
+ m("span", null, "Page Break", -1),
981
+ m("hr", null, null, -1)
1028
982
  ])]));
1029
983
  }
1030
- }), Mn = /* @__PURE__ */ S(Ln, [["__scopeId", "data-v-60c05148"]]), Bn = { class: "brick-pagebreak-editor" }, On = /* @__PURE__ */ _({
984
+ }), $n = /* @__PURE__ */ S(Pn, [["__scopeId", "data-v-60c05148"]]), In = { class: "brick-pagebreak-editor" }, Rn = /* @__PURE__ */ _({
1031
985
  __name: "PageBreakPropertyEditor",
1032
986
  props: {
1033
987
  node: {}
1034
988
  },
1035
989
  setup(e) {
1036
- return (t, n) => (s(), a("div", Bn, [...n[0] || (n[0] = [
1037
- f("p", { style: { color: "#999", "font-size": "12px" } }, "No configurable properties.", -1)
990
+ return (t, n) => (s(), d("div", In, [...n[0] || (n[0] = [
991
+ m("p", { style: { color: "#999", "font-size": "12px" } }, "No configurable properties.", -1)
1038
992
  ])]));
1039
993
  }
1040
- }), Vn = {
994
+ }), zn = {
1041
995
  type: "pageBreak",
1042
996
  label: "Page Break",
1043
997
  icon: "⏎",
1044
998
  isContainer: !1,
1045
- defaultProps: Dn,
1046
- defaultStyle: zn,
1047
- rendererComponent: Mn,
1048
- propertyEditorComponent: On,
999
+ defaultProps: Sn,
1000
+ defaultStyle: Cn,
1001
+ rendererComponent: $n,
1002
+ propertyEditorComponent: Rn,
1049
1003
  propertyFields: [],
1050
- toPdfmake: Tn
1004
+ toPdfmake: wn
1051
1005
  };
1052
1006
  let ie = !1;
1053
- function An() {
1054
- ie || (ie = !0, z(Ve), z(qe), z(tt), z(Ot), z(Gt), z(on), z(fn), z(xn), z(Rn), z(Vn));
1007
+ function Tn() {
1008
+ ie || (ie = !0, T(Ae), T(je), T(tt), T(Ot), T(Gt), T(on), T(fn), T(xn), T(zn));
1055
1009
  }
1056
- const Hn = {
1010
+ const Nn = {
1057
1011
  key: 0,
1058
1012
  class: "brick-dropzone__empty"
1059
- }, Fn = /* @__PURE__ */ _({
1013
+ }, Dn = /* @__PURE__ */ _({
1060
1014
  __name: "DropZone",
1061
1015
  props: {
1062
1016
  parentId: {},
1063
1017
  layout: {}
1064
1018
  },
1065
1019
  setup(e) {
1066
- const t = e, n = E(null);
1020
+ const t = e, n = P(null);
1067
1021
  let i = null;
1068
- const c = be();
1022
+ const c = be(), { isDragging: o } = c;
1069
1023
  return se(() => {
1070
1024
  n.value && (i = c.initContainer(n.value, t.parentId));
1071
1025
  }), ae(() => {
1072
1026
  i?.destroy();
1073
- }), (o, d) => (s(), a("div", {
1027
+ }), (u, a) => (s(), d("div", {
1074
1028
  ref_key: "el",
1075
1029
  ref: n,
1076
- class: K(["brick-dropzone", { "brick-dropzone--horizontal": e.layout === "horizontal" }])
1030
+ class: K(["brick-dropzone", { "brick-dropzone--horizontal": e.layout === "horizontal", "brick-dropzone--drag-active": k(o) && e.layout === "horizontal" }])
1077
1031
  }, [
1078
- X(o.$slots, "default", {}, void 0, !0),
1079
- o.$slots.default ? I("", !0) : (s(), a("div", Hn, " Drop elements here "))
1032
+ X(u.$slots, "default", {}, void 0, !0),
1033
+ u.$slots.default ? I("", !0) : (s(), d("div", Nn, " Drop elements here "))
1080
1034
  ], 2));
1081
1035
  }
1082
- }), Se = /* @__PURE__ */ S(Fn, [["__scopeId", "data-v-c33d3667"]]), Un = ["data-element-id", "data-element-type"], Wn = {
1036
+ }), Se = /* @__PURE__ */ S(Dn, [["__scopeId", "data-v-b9596dad"]]), Ln = ["data-element-id", "data-element-type"], Mn = {
1083
1037
  key: 1,
1084
1038
  class: "brick-canvas-element__unknown"
1085
- }, Jn = /* @__PURE__ */ _({
1039
+ }, Bn = /* @__PURE__ */ _({
1086
1040
  __name: "CanvasElement",
1087
1041
  props: {
1088
1042
  node: {},
1089
1043
  path: {}
1090
1044
  },
1091
1045
  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);
1093
- function r(m) {
1094
- m.stopPropagation(), n.select(t.node.id);
1046
+ const t = e, n = U(), i = Y(), c = P(null), o = $(() => F(t.node.type)), u = $(() => n.selectedId.value === t.node.id), a = $(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.width" || f.key === "style.width") : !1), p = $(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.height" || f.key === "style.height") : !1);
1047
+ function r(f) {
1048
+ f.stopPropagation(), n.select(t.node.id);
1095
1049
  }
1096
- function l(m) {
1097
- m.stopPropagation(), m.preventDefault();
1098
- const g = m.clientX, v = c.value?.offsetWidth ?? 200;
1099
- function h(D) {
1100
- const V = D.clientX - g, T = Math.max(20, v + V);
1101
- 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) });
1050
+ function l(f) {
1051
+ f.stopPropagation(), f.preventDefault();
1052
+ const g = f.clientX, v = c.value?.offsetWidth ?? 200;
1053
+ function h(R) {
1054
+ const O = R.clientX - g, N = Math.max(20, v + O);
1055
+ o.value?.propertyFields.some((V) => V.key === "props.width") ? i.updateProps(t.node.id, { width: Math.round(N) }) : i.updateStyle(t.node.id, { width: Math.round(N) });
1102
1056
  }
1103
1057
  function x() {
1104
1058
  document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", x), document.body.style.cursor = "", document.body.style.userSelect = "";
1105
1059
  }
1106
1060
  document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", x);
1107
1061
  }
1108
- function y(m) {
1109
- m.stopPropagation(), m.preventDefault();
1110
- const g = m.clientY, v = c.value?.offsetHeight ?? 100;
1111
- function h(D) {
1112
- const V = D.clientY - g, T = Math.max(20, v + V);
1113
- 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) });
1062
+ function y(f) {
1063
+ f.stopPropagation(), f.preventDefault();
1064
+ const g = f.clientY, v = c.value?.offsetHeight ?? 100;
1065
+ function h(R) {
1066
+ const O = R.clientY - g, N = Math.max(20, v + O);
1067
+ o.value?.propertyFields.some((V) => V.key === "props.height") ? i.updateProps(t.node.id, { height: Math.round(N) }) : i.updateStyle(t.node.id, { height: Math.round(N) });
1114
1068
  }
1115
1069
  function x() {
1116
1070
  document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", x), document.body.style.cursor = "", document.body.style.userSelect = "";
1117
1071
  }
1118
1072
  document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", x);
1119
1073
  }
1120
- function b(m) {
1121
- m.stopPropagation(), m.preventDefault();
1122
- const g = m.clientX, v = m.clientY, h = c.value?.offsetWidth ?? 200, x = c.value?.offsetHeight ?? 100;
1123
- function D(T) {
1124
- 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");
1074
+ function b(f) {
1075
+ f.stopPropagation(), f.preventDefault();
1076
+ const g = f.clientX, v = f.clientY, h = c.value?.offsetWidth ?? 200, x = c.value?.offsetHeight ?? 100;
1077
+ function R(N) {
1078
+ const j = N.clientX - g, V = N.clientY - v, ee = Math.max(20, h + j), te = Math.max(20, x + V), Ce = o.value?.propertyFields.some((q) => q.key === "props.width"), we = o.value?.propertyFields.some((q) => q.key === "props.height");
1125
1079
  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
1080
  }
1127
- function V() {
1128
- document.removeEventListener("pointermove", D), document.removeEventListener("pointerup", V), document.body.style.cursor = "", document.body.style.userSelect = "";
1081
+ function O() {
1082
+ document.removeEventListener("pointermove", R), document.removeEventListener("pointerup", O), document.body.style.cursor = "", document.body.style.userSelect = "";
1129
1083
  }
1130
- document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", D), document.addEventListener("pointerup", V);
1084
+ document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", R), document.addEventListener("pointerup", O);
1131
1085
  }
1132
- return (m, g) => {
1133
- const v = Ee("CanvasElement", !0);
1134
- return s(), a("div", {
1086
+ return (f, g) => {
1087
+ const v = Pe("CanvasElement", !0);
1088
+ return s(), d("div", {
1135
1089
  ref_key: "elRef",
1136
1090
  ref: c,
1137
- class: K(["brick-canvas-element", { "brick-canvas-element--selected": d.value }]),
1091
+ class: K(["brick-canvas-element", { "brick-canvas-element--selected": u.value }]),
1138
1092
  "data-element-id": e.node.id,
1139
1093
  "data-element-type": e.node.type,
1140
- style: R({
1094
+ style: z({
1141
1095
  width: typeof e.node.style.width == "number" ? e.node.style.width + "px" : e.node.props.width ? e.node.props.width + "px" : e.node.style.width,
1142
1096
  height: e.node.style.height ? e.node.style.height + "px" : e.node.props.height ? e.node.props.height + "px" : void 0,
1143
1097
  marginTop: e.node.style.margin?.[1] + "px",
@@ -1148,19 +1102,19 @@ const Hn = {
1148
1102
  }),
1149
1103
  onClick: r
1150
1104
  }, [
1151
- o.value ? (s(), B(Q(o.value.rendererComponent), {
1105
+ o.value ? (s(), M(Q(o.value.rendererComponent), {
1152
1106
  key: 0,
1153
1107
  node: e.node,
1154
1108
  path: e.path
1155
1109
  }, {
1156
1110
  default: W(() => [
1157
- o.value.isContainer ? (s(), B(Se, {
1111
+ o.value.isContainer ? (s(), M(Se, {
1158
1112
  key: 0,
1159
1113
  "parent-id": e.node.id,
1160
1114
  layout: e.node.type === "columns" ? "horizontal" : "vertical"
1161
1115
  }, {
1162
1116
  default: W(() => [
1163
- (s(!0), a(C, null, P(e.node.children, (h, x) => (s(), B(v, {
1117
+ (s(!0), d(C, null, E(e.node.children, (h, x) => (s(), M(v, {
1164
1118
  key: h.id,
1165
1119
  node: h,
1166
1120
  path: [...e.path, x]
@@ -1170,28 +1124,28 @@ const Hn = {
1170
1124
  }, 8, ["parent-id", "layout"])) : I("", !0)
1171
1125
  ]),
1172
1126
  _: 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", {
1127
+ }, 8, ["node", "path"])) : (s(), d("div", Mn, " Unknown element: " + w(e.node.type), 1)),
1128
+ u.value ? (s(), d(C, { key: 2 }, [
1129
+ a.value ? (s(), d("div", {
1176
1130
  key: 0,
1177
1131
  class: "brick-resize-handle brick-resize-handle--e",
1178
1132
  onPointerdown: l
1179
1133
  }, null, 32)) : I("", !0),
1180
- p.value ? (s(), a("div", {
1134
+ p.value ? (s(), d("div", {
1181
1135
  key: 1,
1182
1136
  class: "brick-resize-handle brick-resize-handle--s",
1183
1137
  onPointerdown: y
1184
1138
  }, null, 32)) : I("", !0),
1185
- u.value && p.value ? (s(), a("div", {
1139
+ a.value && p.value ? (s(), d("div", {
1186
1140
  key: 2,
1187
1141
  class: "brick-resize-handle brick-resize-handle--se",
1188
1142
  onPointerdown: b
1189
1143
  }, null, 32)) : I("", !0)
1190
1144
  ], 64)) : I("", !0)
1191
- ], 14, Un);
1145
+ ], 14, Ln);
1192
1146
  };
1193
1147
  }
1194
- }), Yn = /* @__PURE__ */ S(Jn, [["__scopeId", "data-v-6b9cadc1"]]), qn = { class: "brick-doc-bar" }, jn = { class: "brick-doc-bar__field" }, Gn = ["value"], Xn = { class: "brick-doc-bar__field" }, Kn = { class: "brick-doc-bar__field brick-doc-bar__field--margins" }, Qn = { class: "brick-doc-bar__margins" }, Zn = ["placeholder", "title", "value", "onInput"], eo = { class: "brick-doc-bar__field" }, to = ["value"], no = /* @__PURE__ */ _({
1148
+ }), On = /* @__PURE__ */ S(Bn, [["__scopeId", "data-v-6b9cadc1"]]), An = { class: "brick-doc-bar" }, Vn = { class: "brick-doc-bar__field" }, Hn = ["value"], Fn = { class: "brick-doc-bar__field" }, Un = { class: "brick-doc-bar__field brick-doc-bar__field--margins" }, Wn = { class: "brick-doc-bar__margins" }, Jn = ["placeholder", "title", "value", "onInput"], Yn = { class: "brick-doc-bar__field" }, jn = ["value"], qn = /* @__PURE__ */ _({
1195
1149
  __name: "DocumentSettings",
1196
1150
  setup(e) {
1197
1151
  const t = Z(), n = [
@@ -1202,60 +1156,60 @@ const Hn = {
1202
1156
  { label: "Legal", value: "LEGAL" }
1203
1157
  ];
1204
1158
  function i(c, o) {
1205
- const d = [...t.document.pageMargins];
1206
- d[c] = o, t.document.pageMargins = d;
1159
+ const u = [...t.document.pageMargins];
1160
+ u[c] = o, t.document.pageMargins = u;
1207
1161
  }
1208
- return (c, o) => (s(), a("div", qn, [
1209
- f("div", jn, [
1210
- o[3] || (o[3] = f("label", null, "Size", -1)),
1211
- G(f("select", {
1212
- "onUpdate:modelValue": o[0] || (o[0] = (d) => k(t).document.pageSize = d)
1162
+ return (c, o) => (s(), d("div", An, [
1163
+ m("div", Vn, [
1164
+ o[3] || (o[3] = m("label", null, "Size", -1)),
1165
+ G(m("select", {
1166
+ "onUpdate:modelValue": o[0] || (o[0] = (u) => k(t).document.pageSize = u)
1213
1167
  }, [
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))
1168
+ (s(), d(C, null, E(n, (u) => m("option", {
1169
+ key: u.value,
1170
+ value: u.value
1171
+ }, w(u.label), 9, Hn)), 64))
1218
1172
  ], 512), [
1219
1173
  [oe, k(t).document.pageSize]
1220
1174
  ])
1221
1175
  ]),
1222
- f("div", Xn, [
1223
- o[5] || (o[5] = f("label", null, "Orientation", -1)),
1224
- G(f("select", {
1225
- "onUpdate:modelValue": o[1] || (o[1] = (d) => k(t).document.pageOrientation = d)
1176
+ m("div", Fn, [
1177
+ o[5] || (o[5] = m("label", null, "Orientation", -1)),
1178
+ G(m("select", {
1179
+ "onUpdate:modelValue": o[1] || (o[1] = (u) => k(t).document.pageOrientation = u)
1226
1180
  }, [...o[4] || (o[4] = [
1227
- f("option", { value: "portrait" }, "Portrait", -1),
1228
- f("option", { value: "landscape" }, "Landscape", -1)
1181
+ m("option", { value: "portrait" }, "Portrait", -1),
1182
+ m("option", { value: "landscape" }, "Landscape", -1)
1229
1183
  ])], 512), [
1230
1184
  [oe, k(t).document.pageOrientation]
1231
1185
  ])
1232
1186
  ]),
1233
- f("div", Kn, [
1234
- o[6] || (o[6] = f("label", null, "Margins", -1)),
1235
- f("div", Qn, [
1236
- (s(), a(C, null, P(["L", "T", "R", "B"], (d, u) => f("input", {
1237
- key: u,
1187
+ m("div", Un, [
1188
+ o[6] || (o[6] = m("label", null, "Margins", -1)),
1189
+ m("div", Wn, [
1190
+ (s(), d(C, null, E(["L", "T", "R", "B"], (u, a) => m("input", {
1191
+ key: a,
1238
1192
  type: "number",
1239
- placeholder: d,
1240
- title: d,
1241
- value: k(t).document.pageMargins[u],
1242
- onInput: (p) => i(u, Number(p.target.value))
1243
- }, null, 40, Zn)), 64))
1193
+ placeholder: u,
1194
+ title: u,
1195
+ value: k(t).document.pageMargins[a],
1196
+ onInput: (p) => i(a, Number(p.target.value))
1197
+ }, null, 40, Jn)), 64))
1244
1198
  ])
1245
1199
  ]),
1246
- f("div", eo, [
1247
- o[7] || (o[7] = f("label", null, "Font Size", -1)),
1248
- f("input", {
1200
+ m("div", Yn, [
1201
+ o[7] || (o[7] = m("label", null, "Font Size", -1)),
1202
+ m("input", {
1249
1203
  type: "number",
1250
1204
  value: k(t).document.defaultStyle.fontSize ?? 12,
1251
1205
  min: "6",
1252
1206
  max: "72",
1253
- onInput: o[2] || (o[2] = (d) => k(t).document.defaultStyle.fontSize = Number(d.target.value))
1254
- }, null, 40, to)
1207
+ onInput: o[2] || (o[2] = (u) => k(t).document.defaultStyle.fontSize = Number(u.target.value))
1208
+ }, null, 40, jn)
1255
1209
  ])
1256
1210
  ]));
1257
1211
  }
1258
- }), oo = /* @__PURE__ */ S(no, [["__scopeId", "data-v-f05c1083"]]), ro = { class: "brick-canvas" }, N = 0.75, lo = /* @__PURE__ */ _({
1212
+ }), Gn = /* @__PURE__ */ S(qn, [["__scopeId", "data-v-f05c1083"]]), Xn = { class: "brick-canvas" }, A = 0.75, Kn = /* @__PURE__ */ _({
1259
1213
  __name: "DesignCanvas",
1260
1214
  setup(e) {
1261
1215
  const t = Z(), n = U(), i = {
@@ -1265,38 +1219,35 @@ const Hn = {
1265
1219
  LETTER: [612, 792],
1266
1220
  LEGAL: [612, 1008]
1267
1221
  }, c = $(() => {
1268
- const [u, p] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? p : u;
1269
- return Math.round(r * N);
1222
+ const [a, p] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? p : a;
1223
+ return Math.round(r * A);
1270
1224
  }), o = $(() => {
1271
- const [u, p] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? u : p;
1272
- return Math.round(r * N);
1225
+ const [a, p] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? a : p;
1226
+ return Math.round(r * A);
1273
1227
  });
1274
- function d(u) {
1275
- (u.target === u.currentTarget || u.target.classList.contains("brick-canvas__page")) && n.deselect();
1228
+ function u(a) {
1229
+ (a.target === a.currentTarget || a.target.classList.contains("brick-canvas__page")) && n.deselect();
1276
1230
  }
1277
- return (u, p) => (s(), a("div", ro, [
1278
- O(oo),
1279
- f("div", {
1231
+ return (a, p) => (s(), d("div", Xn, [
1232
+ B(Gn),
1233
+ m("div", {
1280
1234
  class: "brick-canvas__scroll",
1281
- onClick: d
1235
+ onClick: u
1282
1236
  }, [
1283
- f("div", {
1237
+ m("div", {
1284
1238
  class: "brick-canvas__page",
1285
- style: R({
1239
+ style: z({
1286
1240
  width: c.value + "px",
1287
1241
  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"
1242
+ paddingTop: k(t).document.pageMargins[1] * A + "px",
1243
+ paddingRight: k(t).document.pageMargins[2] * A + "px",
1244
+ paddingBottom: k(t).document.pageMargins[3] * A + "px",
1245
+ paddingLeft: k(t).document.pageMargins[0] * A + "px"
1295
1246
  })
1296
1247
  }, [
1297
- O(Se, { "parent-id": null }, {
1248
+ B(Se, { "parent-id": null }, {
1298
1249
  default: W(() => [
1299
- (s(!0), a(C, null, P(k(t).document.content, (r, l) => (s(), B(Yn, {
1250
+ (s(!0), d(C, null, E(k(t).document.content, (r, l) => (s(), M(On, {
1300
1251
  key: r.id,
1301
1252
  node: r,
1302
1253
  path: [l]
@@ -1308,41 +1259,41 @@ const Hn = {
1308
1259
  ])
1309
1260
  ]));
1310
1261
  }
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__ */ _({
1262
+ }), Qn = /* @__PURE__ */ S(Kn, [["__scopeId", "data-v-364329ec"]]), Zn = ["data-element-type"], eo = { class: "brick-element-list__icon" }, to = { class: "brick-element-list__label" }, no = /* @__PURE__ */ _({
1312
1263
  __name: "ToolbarElementList",
1313
1264
  setup(e) {
1314
- const t = E(null);
1265
+ const t = P(null);
1315
1266
  let n = null;
1316
- const i = be(), c = De();
1267
+ const i = be(), c = ze();
1317
1268
  return se(() => {
1318
1269
  t.value && (n = i.initToolbar(t.value));
1319
1270
  }), ae(() => {
1320
1271
  n?.destroy();
1321
- }), (o, d) => (s(), a("div", {
1272
+ }), (o, u) => (s(), d("div", {
1322
1273
  ref_key: "el",
1323
1274
  ref: t,
1324
1275
  class: "brick-element-list"
1325
1276
  }, [
1326
- (s(!0), a(C, null, P(k(c), (u) => (s(), a("div", {
1327
- key: u.type,
1277
+ (s(!0), d(C, null, E(k(c), (a) => (s(), d("div", {
1278
+ key: a.type,
1328
1279
  class: "brick-element-list__item",
1329
- "data-element-type": u.type
1280
+ "data-element-type": a.type
1330
1281
  }, [
1331
- f("span", ao, w(u.icon), 1),
1332
- f("span", co, w(u.label), 1)
1333
- ], 8, so))), 128))
1282
+ m("span", eo, w(a.icon), 1),
1283
+ m("span", to, w(a.label), 1)
1284
+ ], 8, Zn))), 128))
1334
1285
  ], 512));
1335
1286
  }
1336
- }), po = /* @__PURE__ */ S(uo, [["__scopeId", "data-v-d86ebba4"]]), fo = { class: "brick-field" }, mo = { class: "brick-field__label" }, yo = ["value"], go = ["value"], bo = ["value", "min", "max", "step"], vo = ["value"], ho = ["value"], _o = ["value"], ko = {
1287
+ }), oo = /* @__PURE__ */ S(no, [["__scopeId", "data-v-2d0b1dbf"]]), ro = { class: "brick-field" }, lo = { class: "brick-field__label" }, io = ["value"], so = ["value"], ao = ["value", "min", "max", "step"], co = ["value"], uo = ["value"], po = ["value"], fo = {
1337
1288
  key: 5,
1338
1289
  class: "brick-field__toggle"
1339
- }, xo = ["checked"], So = {
1290
+ }, mo = ["checked"], yo = {
1340
1291
  key: 6,
1341
1292
  class: "brick-field__margin"
1342
- }, Co = ["placeholder", "value", "onInput"], wo = {
1293
+ }, go = ["placeholder", "value", "onInput"], bo = {
1343
1294
  key: 7,
1344
1295
  class: "brick-field__slider"
1345
- }, Po = ["value", "min", "max", "step"], Eo = { class: "brick-field__slider-value" }, $o = /* @__PURE__ */ _({
1296
+ }, vo = ["value", "min", "max", "step"], ho = { class: "brick-field__slider-value" }, _o = /* @__PURE__ */ _({
1346
1297
  __name: "PropertyField",
1347
1298
  props: {
1348
1299
  descriptor: {},
@@ -1366,11 +1317,11 @@ const Hn = {
1366
1317
  t.descriptor.type === "textarea" && Array.isArray(i.value) && (b = p.split(`
1367
1318
  `)), l === "props" ? n.updateProps(t.node.id, { [y]: b }) : l === "style" && n.updateStyle(t.node.id, { [y]: b });
1368
1319
  }
1369
- function d(p, r) {
1320
+ function u(p, r) {
1370
1321
  const y = [...c.value ?? [0, 0, 0, 0]];
1371
1322
  y[p] = r, o(y);
1372
1323
  }
1373
- function u(p) {
1324
+ function a(p) {
1374
1325
  const l = p.target.files?.[0];
1375
1326
  if (!l) return;
1376
1327
  const y = new FileReader();
@@ -1378,21 +1329,21 @@ const Hn = {
1378
1329
  o(y.result);
1379
1330
  }, y.readAsDataURL(l);
1380
1331
  }
1381
- return (p, r) => (s(), a("div", fo, [
1382
- f("label", mo, w(e.descriptor.label), 1),
1383
- e.descriptor.type === "text" ? (s(), a("input", {
1332
+ return (p, r) => (s(), d("div", ro, [
1333
+ m("label", lo, w(e.descriptor.label), 1),
1334
+ e.descriptor.type === "text" ? (s(), d("input", {
1384
1335
  key: 0,
1385
1336
  type: "text",
1386
1337
  class: "brick-field__input",
1387
1338
  value: c.value,
1388
1339
  onInput: r[0] || (r[0] = (l) => o(l.target.value))
1389
- }, null, 40, yo)) : e.descriptor.type === "textarea" ? (s(), a("textarea", {
1340
+ }, null, 40, io)) : e.descriptor.type === "textarea" ? (s(), d("textarea", {
1390
1341
  key: 1,
1391
1342
  class: "brick-field__textarea",
1392
1343
  value: c.value,
1393
1344
  rows: "3",
1394
1345
  onInput: r[1] || (r[1] = (l) => o(l.target.value))
1395
- }, null, 40, go)) : e.descriptor.type === "number" ? (s(), a("input", {
1346
+ }, null, 40, so)) : e.descriptor.type === "number" ? (s(), d("input", {
1396
1347
  key: 2,
1397
1348
  type: "number",
1398
1349
  class: "brick-field__input",
@@ -1401,137 +1352,137 @@ const Hn = {
1401
1352
  max: e.descriptor.max,
1402
1353
  step: e.descriptor.step,
1403
1354
  onInput: r[2] || (r[2] = (l) => o(Number(l.target.value)))
1404
- }, null, 40, bo)) : e.descriptor.type === "color" ? (s(), a("input", {
1355
+ }, null, 40, ao)) : e.descriptor.type === "color" ? (s(), d("input", {
1405
1356
  key: 3,
1406
1357
  type: "color",
1407
1358
  class: "brick-field__color",
1408
1359
  value: c.value ?? "#000000",
1409
1360
  onInput: r[3] || (r[3] = (l) => o(l.target.value))
1410
- }, null, 40, vo)) : e.descriptor.type === "select" ? (s(), a("select", {
1361
+ }, null, 40, co)) : e.descriptor.type === "select" ? (s(), d("select", {
1411
1362
  key: 4,
1412
1363
  class: "brick-field__select",
1413
1364
  value: c.value,
1414
1365
  onChange: r[4] || (r[4] = (l) => o(l.target.value || void 0))
1415
1366
  }, [
1416
- (s(!0), a(C, null, P(e.descriptor.options, (l) => (s(), a("option", {
1367
+ (s(!0), d(C, null, E(e.descriptor.options, (l) => (s(), d("option", {
1417
1368
  key: String(l.value),
1418
1369
  value: l.value
1419
- }, w(l.label), 9, _o))), 128))
1420
- ], 40, ho)) : e.descriptor.type === "toggle" ? (s(), a("label", ko, [
1421
- f("input", {
1370
+ }, w(l.label), 9, po))), 128))
1371
+ ], 40, uo)) : e.descriptor.type === "toggle" ? (s(), d("label", fo, [
1372
+ m("input", {
1422
1373
  type: "checkbox",
1423
1374
  checked: c.value,
1424
1375
  onChange: r[5] || (r[5] = (l) => o(l.target.checked))
1425
- }, 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", {
1376
+ }, null, 40, mo),
1377
+ m("span", null, w(c.value ? "On" : "Off"), 1)
1378
+ ])) : e.descriptor.type === "margin" ? (s(), d("div", yo, [
1379
+ (s(), d(C, null, E(["L", "T", "R", "B"], (l, y) => m("input", {
1429
1380
  key: l,
1430
1381
  type: "number",
1431
1382
  class: "brick-field__margin-input",
1432
1383
  placeholder: l,
1433
1384
  value: (c.value ?? [0, 0, 0, 0])[y],
1434
- onInput: (b) => d(y, Number(b.target.value))
1435
- }, null, 40, Co)), 64))
1436
- ])) : e.descriptor.type === "slider" ? (s(), a("div", wo, [
1437
- f("input", {
1385
+ onInput: (b) => u(y, Number(b.target.value))
1386
+ }, null, 40, go)), 64))
1387
+ ])) : e.descriptor.type === "slider" ? (s(), d("div", bo, [
1388
+ m("input", {
1438
1389
  type: "range",
1439
1390
  value: c.value,
1440
1391
  min: e.descriptor.min,
1441
1392
  max: e.descriptor.max,
1442
1393
  step: e.descriptor.step,
1443
1394
  onInput: r[6] || (r[6] = (l) => o(Number(l.target.value)))
1444
- }, null, 40, Po),
1445
- f("span", Eo, w(c.value), 1)
1446
- ])) : e.descriptor.type === "file" ? (s(), a("input", {
1395
+ }, null, 40, vo),
1396
+ m("span", ho, w(c.value), 1)
1397
+ ])) : e.descriptor.type === "file" ? (s(), d("input", {
1447
1398
  key: 8,
1448
1399
  type: "file",
1449
1400
  accept: "image/*",
1450
1401
  class: "brick-field__file",
1451
- onChange: u
1402
+ onChange: a
1452
1403
  }, null, 32)) : I("", !0)
1453
1404
  ]));
1454
1405
  }
1455
- }), Io = /* @__PURE__ */ S($o, [["__scopeId", "data-v-e5d6e8b6"]]), Ro = {
1406
+ }), ko = /* @__PURE__ */ S(_o, [["__scopeId", "data-v-5a3bec1b"]]), xo = {
1456
1407
  key: 0,
1457
1408
  class: "brick-property-editor"
1458
- }, Do = { class: "brick-property-editor__type" }, zo = {
1409
+ }, So = { class: "brick-property-editor__type" }, Co = {
1459
1410
  key: 0,
1460
1411
  class: "brick-property-editor__group"
1461
- }, To = { class: "brick-property-editor__group-title" }, No = /* @__PURE__ */ _({
1412
+ }, wo = { class: "brick-property-editor__group-title" }, Eo = /* @__PURE__ */ _({
1462
1413
  __name: "PropertyEditor",
1463
1414
  setup(e) {
1464
1415
  const t = U(), n = $(() => {
1465
- const d = t.selectedNode.value;
1466
- return d ? F(d.type) : null;
1416
+ const u = t.selectedNode.value;
1417
+ return u ? F(u.type) : null;
1467
1418
  }), i = $(() => {
1468
1419
  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;
1420
+ const u = {};
1421
+ for (const a of n.value.propertyFields)
1422
+ u[a.section] || (u[a.section] = []), u[a.section].push(a);
1423
+ return u;
1473
1424
  }), c = {
1474
1425
  content: "Content",
1475
1426
  style: "Style",
1476
1427
  layout: "Layout",
1477
1428
  advanced: "Advanced"
1478
1429
  }, o = ["content", "style", "layout", "advanced"];
1479
- return (d, u) => k(t).selectedNode.value && n.value ? (s(), a("div", Ro, [
1480
- 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, {
1430
+ return (u, a) => k(t).selectedNode.value && n.value ? (s(), d("div", xo, [
1431
+ m("div", So, w(n.value.icon) + " " + w(n.value.label), 1),
1432
+ (s(), d(C, null, E(o, (p) => (s(), d(C, { key: p }, [
1433
+ i.value[p] ? (s(), d("div", Co, [
1434
+ m("div", wo, w(c[p]), 1),
1435
+ (s(!0), d(C, null, E(i.value[p], (r) => (s(), M(ko, {
1485
1436
  key: r.key,
1486
1437
  descriptor: r,
1487
1438
  node: k(t).selectedNode.value
1488
1439
  }, null, 8, ["descriptor", "node"]))), 128))
1489
1440
  ])) : I("", !0)
1490
1441
  ], 64))), 64)),
1491
- (s(), B(Q(n.value.propertyEditorComponent), {
1442
+ (s(), M(Q(n.value.propertyEditorComponent), {
1492
1443
  node: k(t).selectedNode.value
1493
1444
  }, null, 8, ["node"]))
1494
1445
  ])) : I("", !0);
1495
1446
  }
1496
- }), Lo = /* @__PURE__ */ S(No, [["__scopeId", "data-v-4d129dac"]]), Mo = { class: "brick-toolbar" }, Bo = { class: "brick-toolbar__section" }, Oo = {
1447
+ }), Po = /* @__PURE__ */ S(Eo, [["__scopeId", "data-v-4d129dac"]]), $o = { class: "brick-toolbar" }, Io = { class: "brick-toolbar__section" }, Ro = {
1497
1448
  key: 0,
1498
1449
  class: "brick-toolbar__section"
1499
- }, Vo = /* @__PURE__ */ _({
1450
+ }, zo = /* @__PURE__ */ _({
1500
1451
  __name: "Toolbar",
1501
1452
  setup(e) {
1502
1453
  const t = U();
1503
- return (n, i) => (s(), a("div", Mo, [
1504
- f("div", Bo, [
1505
- i[0] || (i[0] = f("h3", { class: "brick-toolbar__title" }, "Elements", -1)),
1506
- O(po)
1454
+ return (n, i) => (s(), d("div", $o, [
1455
+ m("div", Io, [
1456
+ i[0] || (i[0] = m("h3", { class: "brick-toolbar__title" }, "Elements", -1)),
1457
+ B(oo)
1507
1458
  ]),
1508
- k(t).selectedNode.value ? (s(), a("div", Oo, [
1509
- i[1] || (i[1] = f("h3", { class: "brick-toolbar__title" }, "Properties", -1)),
1510
- O(Lo)
1459
+ k(t).selectedNode.value ? (s(), d("div", Ro, [
1460
+ i[1] || (i[1] = m("h3", { class: "brick-toolbar__title" }, "Properties", -1)),
1461
+ B(Po)
1511
1462
  ])) : I("", !0)
1512
1463
  ]));
1513
1464
  }
1514
- }), 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__ */ _({
1465
+ }), To = /* @__PURE__ */ S(zo, [["__scopeId", "data-v-0174c069"]]), No = { class: "brick-actionbar" }, Do = { class: "brick-actionbar__group" }, Lo = { class: "brick-actionbar__group" }, Mo = ["disabled"], Bo = ["disabled"], Oo = ["disabled"], Ao = { class: "brick-actionbar__group" }, Vo = /* @__PURE__ */ _({
1515
1466
  __name: "ActionBar",
1516
1467
  setup(e) {
1517
- const t = bt(), n = St(), i = U(), c = Y(), o = Z(), d = E("document"), u = E(null);
1468
+ const t = bt(), n = St(), i = U(), c = Y(), o = Z(), u = P("document"), a = P(null);
1518
1469
  function p() {
1519
- const m = i.selectedId.value;
1520
- m && (i.deselect(), c.removeElement(m));
1470
+ const f = i.selectedId.value;
1471
+ f && (i.deselect(), c.removeElement(f));
1521
1472
  }
1522
1473
  function r() {
1523
- const m = d.value.trim() || "document", g = m.endsWith(".pdf") ? m : m + ".pdf";
1474
+ const f = u.value.trim() || "document", g = f.endsWith(".pdf") ? f : f + ".pdf";
1524
1475
  n.exportPdf(g);
1525
1476
  }
1526
1477
  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";
1528
- x.href = h, x.download = D.endsWith(".json") ? D : D + ".json", x.click(), URL.revokeObjectURL(h);
1478
+ const f = o.exportDocument(), g = JSON.stringify(f, null, 2), v = new Blob([g], { type: "application/json" }), h = URL.createObjectURL(v), x = document.createElement("a"), R = u.value.trim() || "document";
1479
+ x.href = h, x.download = R.endsWith(".json") ? R : R + ".json", x.click(), URL.revokeObjectURL(h);
1529
1480
  }
1530
1481
  function y() {
1531
- u.value?.click();
1482
+ a.value?.click();
1532
1483
  }
1533
- function b(m) {
1534
- const g = m.target, v = g.files?.[0];
1484
+ function b(f) {
1485
+ const g = f.target, v = g.files?.[0];
1535
1486
  if (!v) return;
1536
1487
  const h = new FileReader();
1537
1488
  h.onload = () => {
@@ -1547,61 +1498,61 @@ const Hn = {
1547
1498
  }
1548
1499
  }, h.readAsText(v), g.value = "";
1549
1500
  }
1550
- return (m, g) => (s(), a("div", Ho, [
1551
- f("div", Fo, [
1552
- G(f("input", {
1553
- "onUpdate:modelValue": g[0] || (g[0] = (v) => d.value = v),
1501
+ return (f, g) => (s(), d("div", No, [
1502
+ m("div", Do, [
1503
+ G(m("input", {
1504
+ "onUpdate:modelValue": g[0] || (g[0] = (v) => u.value = v),
1554
1505
  class: "brick-actionbar__name",
1555
1506
  type: "text",
1556
1507
  placeholder: "Document name",
1557
1508
  title: "Document name (used for export filename)"
1558
1509
  }, null, 512), [
1559
- [$e, d.value]
1510
+ [$e, u.value]
1560
1511
  ])
1561
1512
  ]),
1562
- f("div", Uo, [
1563
- f("button", {
1513
+ m("div", Lo, [
1514
+ m("button", {
1564
1515
  class: "brick-actionbar__btn",
1565
1516
  disabled: !k(t).canUndo.value,
1566
1517
  title: "Undo",
1567
1518
  onClick: g[1] || (g[1] = (v) => k(t).undo())
1568
- }, " Undo ", 8, Wo),
1569
- f("button", {
1519
+ }, " Undo ", 8, Mo),
1520
+ m("button", {
1570
1521
  class: "brick-actionbar__btn",
1571
1522
  disabled: !k(t).canRedo.value,
1572
1523
  title: "Redo",
1573
1524
  onClick: g[2] || (g[2] = (v) => k(t).redo())
1574
- }, " Redo ", 8, Jo),
1575
- f("button", {
1525
+ }, " Redo ", 8, Bo),
1526
+ m("button", {
1576
1527
  class: "brick-actionbar__btn brick-actionbar__btn--danger",
1577
1528
  disabled: !k(i).selectedId.value,
1578
1529
  title: "Delete selected element",
1579
1530
  onClick: p
1580
- }, " Delete ", 8, Yo)
1531
+ }, " Delete ", 8, Oo)
1581
1532
  ]),
1582
- f("div", qo, [
1583
- f("button", {
1533
+ m("div", Ao, [
1534
+ m("button", {
1584
1535
  class: "brick-actionbar__btn",
1585
1536
  title: "Import JSON",
1586
1537
  onClick: y
1587
1538
  }, " Import JSON "),
1588
- f("button", {
1539
+ m("button", {
1589
1540
  class: "brick-actionbar__btn",
1590
1541
  title: "Export JSON",
1591
1542
  onClick: l
1592
1543
  }, " Export JSON "),
1593
- f("button", {
1544
+ m("button", {
1594
1545
  class: "brick-actionbar__btn brick-actionbar__btn--primary",
1595
1546
  onClick: r
1596
1547
  }, " Export PDF "),
1597
- f("button", {
1548
+ m("button", {
1598
1549
  class: "brick-actionbar__btn",
1599
1550
  onClick: g[3] || (g[3] = (v) => k(n).openPdf())
1600
1551
  }, " Preview ")
1601
1552
  ]),
1602
- f("input", {
1553
+ m("input", {
1603
1554
  ref_key: "fileInput",
1604
- ref: u,
1555
+ ref: a,
1605
1556
  type: "file",
1606
1557
  accept: ".json",
1607
1558
  style: { display: "none" },
@@ -1609,7 +1560,7 @@ const Hn = {
1609
1560
  }, null, 544)
1610
1561
  ]));
1611
1562
  }
1612
- }), Go = /* @__PURE__ */ S(jo, [["__scopeId", "data-v-be915a0f"]]), Xo = { class: "brick-pdf" }, Ko = { class: "brick-pdf__workspace" }, Qo = /* @__PURE__ */ _({
1563
+ }), Ho = /* @__PURE__ */ S(Vo, [["__scopeId", "data-v-be915a0f"]]), Fo = { class: "brick-pdf" }, Uo = { class: "brick-pdf__workspace" }, Wo = /* @__PURE__ */ _({
1613
1564
  __name: "BrickPdf",
1614
1565
  props: {
1615
1566
  modelValue: {}
@@ -1617,69 +1568,69 @@ const Hn = {
1617
1568
  emits: ["update:modelValue"],
1618
1569
  setup(e, { emit: t }) {
1619
1570
  const n = e, i = t;
1620
- An();
1571
+ Tn();
1621
1572
  const c = st(n.modelValue ?? ce());
1622
1573
  at(c);
1623
1574
  const o = ct(c);
1624
1575
  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);
1576
+ const u = yt(c);
1577
+ gt(u);
1578
+ const a = pt(c, u);
1579
+ ft(a);
1580
+ const p = vt(c, a);
1630
1581
  ht(p);
1631
1582
  const r = kt(c);
1632
1583
  xt(r);
1633
- const l = Pt(c, u);
1634
- Et(l);
1635
- const y = $t(u);
1584
+ const l = Et(c, a);
1585
+ Pt(l);
1586
+ const y = $t(a);
1636
1587
  It(y);
1637
- const b = Re(), m = b.Delete, g = b.Backspace;
1638
- return re(m, () => {
1588
+ const b = Re(), f = b.Delete, g = b.Backspace;
1589
+ return re(f, () => {
1639
1590
  if (!o.selectedId.value) return;
1640
1591
  const v = document.activeElement;
1641
1592
  if (v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.tagName === "SELECT")) return;
1642
1593
  const h = o.selectedId.value;
1643
- o.deselect(), u.removeElement(h);
1594
+ o.deselect(), a.removeElement(h);
1644
1595
  }), re(g, () => {
1645
1596
  if (!o.selectedId.value) return;
1646
1597
  const v = document.activeElement;
1647
1598
  if (v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.tagName === "SELECT")) return;
1648
1599
  const h = o.selectedId.value;
1649
- o.deselect(), u.removeElement(h);
1600
+ o.deselect(), a.removeElement(h);
1650
1601
  }), Ie(
1651
1602
  () => c.document,
1652
1603
  () => {
1653
1604
  i("update:modelValue", JSON.parse(JSON.stringify(H(c.document))));
1654
1605
  },
1655
1606
  { deep: !0 }
1656
- ), (v, h) => (s(), a("div", Xo, [
1657
- O(Go),
1658
- f("div", Ko, [
1659
- O(io),
1660
- O(Ao)
1607
+ ), (v, h) => (s(), d("div", Fo, [
1608
+ B(Ho),
1609
+ m("div", Uo, [
1610
+ B(Qn),
1611
+ B(To)
1661
1612
  ])
1662
1613
  ]));
1663
1614
  }
1664
- }), Zo = /* @__PURE__ */ S(Qo, [["__scopeId", "data-v-f9b95ad8"]]), ir = {
1615
+ }), Jo = /* @__PURE__ */ S(Wo, [["__scopeId", "data-v-f9b95ad8"]]), Qo = {
1665
1616
  install(e) {
1666
- e.component("BrickPdf", Zo);
1617
+ e.component("BrickPdf", Jo);
1667
1618
  }
1668
1619
  };
1669
1620
  export {
1670
- Zo as BrickPdf,
1621
+ Jo as BrickPdf,
1671
1622
  ce as createDefaultDocument,
1672
- ir as default,
1673
- De as getAllElementDefinitions,
1623
+ Qo as default,
1624
+ ze as getAllElementDefinitions,
1674
1625
  F as getElementDefinition,
1675
- z as registerElement,
1676
- or as unregisterElement,
1677
- rr as useClipboard,
1626
+ T as registerElement,
1627
+ Go as unregisterElement,
1628
+ Xo as useClipboard,
1678
1629
  Z as useDocumentStore,
1679
1630
  be as useDragDrop,
1680
1631
  Y as useElementActions,
1681
1632
  bt as useHistory,
1682
1633
  St as usePdfExport,
1683
- lr as useResize,
1634
+ Ko as useResize,
1684
1635
  U as useSelection
1685
1636
  };