brick-pdf 0.1.2 → 0.2.1

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,7 +1,7 @@
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
- import { useMagicKeys as Re, whenever as re } from "@vueuse/core";
3
- import le from "sortablejs";
4
- function ce() {
1
+ import { defineComponent as _, openBlock as s, createElementBlock as d, normalizeStyle as R, toDisplayString as w, renderSlot as K, normalizeClass as Q, createElementVNode as m, Fragment as C, renderList as E, reactive as $e, provide as D, inject as L, toRaw as H, ref as P, computed as $, createTextVNode as re, createCommentVNode as I, createBlock as M, resolveDynamicComponent as Z, withCtx as W, onMounted as de, onBeforeUnmount as ue, unref as k, resolveComponent as Ie, withDirectives as G, vModelSelect as le, createVNode as B, vModelText as ze, watch as Re } from "vue";
2
+ import { useMagicKeys as Te, whenever as ie } from "@vueuse/core";
3
+ import se from "sortablejs";
4
+ function ee() {
5
5
  return {
6
6
  pageSize: "A4",
7
7
  pageOrientation: "portrait",
@@ -14,35 +14,35 @@ 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 Ne() {
24
24
  return Array.from(J.values());
25
25
  }
26
- function or(e) {
26
+ function Ko(e) {
27
27
  return J.delete(e);
28
28
  }
29
- function ze() {
29
+ function De() {
30
30
  return { text: "New Text" };
31
31
  }
32
- function Te() {
32
+ function Le() {
33
33
  return { fontSize: 12 };
34
34
  }
35
- function Ne(e) {
35
+ function Me(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
  }
39
- const Le = /* @__PURE__ */ _({
39
+ const Be = /* @__PURE__ */ _({
40
40
  __name: "TextRenderer",
41
41
  props: {
42
42
  node: {}
43
43
  },
44
44
  setup(e) {
45
- return (t, n) => (s(), c("div", {
45
+ return (t, n) => (s(), d("div", {
46
46
  class: "brick-el-text",
47
47
  style: R({
48
48
  fontSize: (e.node.style.fontSize ?? 12) + "px",
@@ -57,28 +57,28 @@ const Le = /* @__PURE__ */ _({
57
57
  })
58
58
  }, w(e.node.props.text), 5));
59
59
  }
60
- }), S = (e, t) => {
60
+ }), x = (e, t) => {
61
61
  const n = e.__vccOpts || e;
62
- for (const [i, d] of t)
63
- n[i] = d;
62
+ for (const [i, c] of t)
63
+ n[i] = c;
64
64
  return n;
65
- }, Me = /* @__PURE__ */ S(Le, [["__scopeId", "data-v-a7cd1565"]]), Be = { class: "brick-text-editor" }, Oe = /* @__PURE__ */ _({
65
+ }, Oe = /* @__PURE__ */ x(Be, [["__scopeId", "data-v-a7cd1565"]]), Ae = { class: "brick-text-editor" }, Ve = /* @__PURE__ */ _({
66
66
  __name: "TextPropertyEditor",
67
67
  props: {
68
68
  node: {}
69
69
  },
70
70
  setup(e) {
71
- return (t, n) => (s(), c("div", Be));
71
+ return (t, n) => (s(), d("div", Ae));
72
72
  }
73
- }), Ve = {
73
+ }), He = {
74
74
  type: "text",
75
75
  label: "Text",
76
76
  icon: "T",
77
77
  isContainer: !1,
78
- defaultProps: ze,
79
- defaultStyle: Te,
80
- rendererComponent: Me,
81
- propertyEditorComponent: Oe,
78
+ defaultProps: De,
79
+ defaultStyle: Le,
80
+ rendererComponent: Oe,
81
+ propertyEditorComponent: Ve,
82
82
  propertyFields: [
83
83
  { key: "props.text", label: "Text Content", section: "content", type: "textarea", defaultValue: "New Text" },
84
84
  { key: "style.fontSize", label: "Font Size", section: "style", type: "number", min: 6, max: 72, step: 1, defaultValue: 12 },
@@ -103,110 +103,110 @@ 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: Me
107
107
  };
108
- function Ae() {
108
+ function Fe() {
109
109
  return {};
110
110
  }
111
- function He() {
111
+ function Ue() {
112
112
  return {};
113
113
  }
114
- function Fe(e, t) {
114
+ function We(e, t) {
115
115
  const n = {
116
116
  stack: t(e.children)
117
117
  };
118
118
  return e.style.margin && (n.margin = e.style.margin), e.style.fillColor && (n.fillColor = e.style.fillColor), n;
119
119
  }
120
- const Ue = /* @__PURE__ */ _({
120
+ const Je = /* @__PURE__ */ _({
121
121
  __name: "StackRenderer",
122
122
  props: {
123
123
  node: {},
124
124
  path: {}
125
125
  },
126
126
  setup(e) {
127
- return (t, n) => (s(), c("div", {
127
+ return (t, n) => (s(), d("div", {
128
128
  class: "brick-el-stack",
129
129
  style: R({ backgroundColor: e.node.style.fillColor })
130
130
  }, [
131
- X(t.$slots, "default", {}, void 0, !0)
131
+ K(t.$slots, "default", {}, void 0, !0)
132
132
  ], 4));
133
133
  }
134
- }), We = /* @__PURE__ */ S(Ue, [["__scopeId", "data-v-c59e7405"]]), Je = { class: "brick-stack-editor" }, Ye = /* @__PURE__ */ _({
134
+ }), Ye = /* @__PURE__ */ x(Je, [["__scopeId", "data-v-c59e7405"]]), je = { class: "brick-stack-editor" }, qe = /* @__PURE__ */ _({
135
135
  __name: "StackPropertyEditor",
136
136
  props: {
137
137
  node: {}
138
138
  },
139
139
  setup(e) {
140
- return (t, n) => (s(), c("div", Je));
140
+ return (t, n) => (s(), d("div", je));
141
141
  }
142
- }), qe = {
142
+ }), Ge = {
143
143
  type: "stack",
144
144
  label: "Stack",
145
145
  icon: "☰",
146
146
  isContainer: !0,
147
147
  acceptsChildTypes: null,
148
- defaultProps: Ae,
149
- defaultStyle: He,
150
- rendererComponent: We,
151
- propertyEditorComponent: Ye,
148
+ defaultProps: Fe,
149
+ defaultStyle: Ue,
150
+ rendererComponent: Ye,
151
+ propertyEditorComponent: qe,
152
152
  propertyFields: [
153
153
  { key: "style.fillColor", label: "Fill Color", section: "style", type: "color" },
154
154
  { key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
155
155
  ],
156
- toPdfmake: Fe
156
+ toPdfmake: We
157
157
  };
158
- function je() {
158
+ function Xe() {
159
159
  return { columnGap: 10 };
160
160
  }
161
- function Ge() {
161
+ function Ke() {
162
162
  return {};
163
163
  }
164
- function Xe(e, t) {
164
+ function Qe(e, t) {
165
165
  const n = {
166
166
  columns: t(e.children),
167
167
  columnGap: e.props.columnGap ?? 10
168
168
  };
169
169
  return e.style.margin && (n.margin = e.style.margin), n;
170
170
  }
171
- const Ke = /* @__PURE__ */ _({
171
+ const Ze = /* @__PURE__ */ _({
172
172
  __name: "ColumnsRenderer",
173
173
  props: {
174
174
  node: {},
175
175
  path: {}
176
176
  },
177
177
  setup(e) {
178
- return (t, n) => (s(), c("div", {
178
+ return (t, n) => (s(), d("div", {
179
179
  class: "brick-el-columns",
180
180
  style: R({ "--column-gap": (e.node.props.columnGap ?? 10) + "px" })
181
181
  }, [
182
- X(t.$slots, "default", {}, void 0, !0)
182
+ K(t.$slots, "default", {}, void 0, !0)
183
183
  ], 4));
184
184
  }
185
- }), Qe = /* @__PURE__ */ S(Ke, [["__scopeId", "data-v-217dd721"]]), Ze = { class: "brick-columns-editor" }, et = /* @__PURE__ */ _({
185
+ }), et = /* @__PURE__ */ x(Ze, [["__scopeId", "data-v-217dd721"]]), tt = { class: "brick-columns-editor" }, nt = /* @__PURE__ */ _({
186
186
  __name: "ColumnsPropertyEditor",
187
187
  props: {
188
188
  node: {}
189
189
  },
190
190
  setup(e) {
191
- return (t, n) => (s(), c("div", Ze));
191
+ return (t, n) => (s(), d("div", tt));
192
192
  }
193
- }), tt = {
193
+ }), ot = {
194
194
  type: "columns",
195
195
  label: "Columns",
196
196
  icon: "▥",
197
197
  isContainer: !0,
198
198
  acceptsChildTypes: null,
199
- defaultProps: je,
200
- defaultStyle: Ge,
201
- rendererComponent: Qe,
202
- propertyEditorComponent: et,
199
+ defaultProps: Xe,
200
+ defaultStyle: Ke,
201
+ rendererComponent: et,
202
+ propertyEditorComponent: nt,
203
203
  propertyFields: [
204
204
  { key: "props.columnGap", label: "Column Gap", section: "layout", type: "number", min: 0, max: 50, step: 1, defaultValue: 10 },
205
205
  { key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
206
206
  ],
207
- toPdfmake: Xe
207
+ toPdfmake: Qe
208
208
  };
209
- function nt() {
209
+ function rt() {
210
210
  return {
211
211
  headerRows: 1,
212
212
  widths: ["*", "*"],
@@ -217,215 +217,235 @@ function nt() {
217
217
  layout: "lightHorizontalLines"
218
218
  };
219
219
  }
220
- function ot() {
220
+ function lt() {
221
221
  return { fontSize: 12 };
222
222
  }
223
- function rt(e) {
223
+ function it(e) {
224
224
  const t = e.props.body, n = {
225
225
  table: {
226
226
  headerRows: e.props.headerRows,
227
227
  widths: e.props.widths,
228
228
  body: t.map(
229
- (d) => d.map((o) => ({ text: o }))
229
+ (c) => c.map((o) => ({ text: o }))
230
230
  )
231
231
  }
232
232
  }, i = e.props.layout;
233
233
  return i && i !== "none" && (n.layout = i), e.style.fontSize && (n.fontSize = e.style.fontSize), e.style.color && (n.color = e.style.color), e.style.margin && (n.margin = e.style.margin), n;
234
234
  }
235
- const lt = /* @__PURE__ */ _({
235
+ const st = /* @__PURE__ */ _({
236
236
  __name: "TableRenderer",
237
237
  props: {
238
238
  node: {}
239
239
  },
240
240
  setup(e) {
241
- return (t, n) => (s(), c("div", {
242
- class: K(["brick-el-table", "brick-el-table--" + (e.node.props.layout ?? "lightHorizontalLines")]),
241
+ return (t, n) => (s(), d("div", {
242
+ class: Q(["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
- f("table", null, [
246
- f("thead", null, [
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
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
+ key: "h" + c
249
249
  }, [
250
- (s(!0), c(C, null, P(i, (o, u) => (s(), c("th", { key: u }, 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), c(C, null, P(e.node.props.body.slice(e.node.props.headerRows), (i, d) => (s(), c("tr", {
255
- key: "b" + d
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
+ key: "b" + c
256
256
  }, [
257
- (s(!0), c(C, null, P(i, (o, u) => (s(), c("td", { key: u }, 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
  ])
261
261
  ], 6));
262
262
  }
263
- }), it = /* @__PURE__ */ S(lt, [["__scopeId", "data-v-b863b05d"]]), de = /* @__PURE__ */ Symbol("brick-pdf-document-store");
264
- function st(e) {
265
- const t = Pe(e ?? ce());
266
- function n(a, p) {
267
- const r = p ?? t.content;
268
- for (let l = 0; l < r.length; l++) {
269
- const y = r[l];
270
- if (y) {
271
- if (y.id === a)
272
- return { node: y, parent: r, index: l };
273
- if (y.children.length > 0) {
274
- const b = n(a, y.children);
275
- if (b) return b;
263
+ }), at = /* @__PURE__ */ x(st, [["__scopeId", "data-v-b863b05d"]]), pe = /* @__PURE__ */ Symbol("brick-pdf-document-store");
264
+ function ae(e) {
265
+ const t = ee();
266
+ return {
267
+ pageSize: e.pageSize ?? t.pageSize,
268
+ pageOrientation: e.pageOrientation ?? t.pageOrientation,
269
+ pageMargins: e.pageMargins ?? t.pageMargins,
270
+ defaultStyle: e.defaultStyle ?? t.defaultStyle,
271
+ styles: e.styles ?? t.styles,
272
+ content: e.content ?? t.content
273
+ };
274
+ }
275
+ function X(e) {
276
+ e.props = e.props ?? {}, e.style = e.style ?? {}, e.children = e.children ?? [];
277
+ for (const t of e.children) X(t);
278
+ return e;
279
+ }
280
+ function ct(e) {
281
+ const t = e ? ae(e) : ee();
282
+ for (const a of t.content) X(a);
283
+ const n = $e(t);
284
+ function i(a, r) {
285
+ const l = r ?? n.content;
286
+ for (let y = 0; y < l.length; y++) {
287
+ const g = l[y];
288
+ if (g) {
289
+ if (g.id === a)
290
+ return { node: g, parent: l, index: y };
291
+ if (g.children.length > 0) {
292
+ const f = i(a, g.children);
293
+ if (f) return f;
276
294
  }
277
295
  }
278
296
  }
279
297
  return null;
280
298
  }
281
- function i(a) {
282
- t.content.splice(0, t.content.length, ...a);
299
+ function c(a) {
300
+ n.content.splice(0, n.content.length, ...a);
283
301
  }
284
- function d() {
285
- return JSON.parse(JSON.stringify(H(t.content)));
302
+ function o() {
303
+ return JSON.parse(JSON.stringify(H(n.content)));
286
304
  }
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);
305
+ function u(a) {
306
+ const r = ae(a);
307
+ for (const l of r.content) X(l);
308
+ n.pageSize = r.pageSize, n.pageOrientation = r.pageOrientation, n.pageMargins = r.pageMargins, n.defaultStyle = r.defaultStyle, n.styles = r.styles, n.content.splice(0, n.content.length, ...r.content);
289
309
  }
290
- function u() {
291
- return JSON.parse(JSON.stringify(H(t)));
310
+ function p() {
311
+ return JSON.parse(JSON.stringify(H(n)));
292
312
  }
293
- return { document: t, findNodeById: n, replaceContent: i, snapshotContent: d, loadDocument: o, exportDocument: u };
313
+ return { document: n, findNodeById: i, replaceContent: c, snapshotContent: o, loadDocument: u, exportDocument: p };
294
314
  }
295
- function at(e) {
296
- N(de, e);
315
+ function dt(e) {
316
+ D(pe, e);
297
317
  }
298
- function Z() {
299
- const e = L(de);
318
+ function te() {
319
+ const e = L(pe);
300
320
  if (!e)
301
321
  throw new Error("useDocumentStore() requires a BrickPdf ancestor component");
302
322
  return e;
303
323
  }
304
- const ue = /* @__PURE__ */ Symbol("brick-pdf-selection");
305
- function ct(e) {
306
- const t = E(null), n = $(() => t.value ? e.findNodeById(t.value)?.node ?? null : null);
324
+ const fe = /* @__PURE__ */ Symbol("brick-pdf-selection");
325
+ function ut(e) {
326
+ const t = P(null), n = $(() => t.value ? e.findNodeById(t.value)?.node ?? null : null);
307
327
  function i(o) {
308
328
  t.value = o;
309
329
  }
310
- function d() {
330
+ function c() {
311
331
  t.value = null;
312
332
  }
313
- return { selectedId: t, selectedNode: n, select: i, deselect: d };
333
+ return { selectedId: t, selectedNode: n, select: i, deselect: c };
314
334
  }
315
- function dt(e) {
316
- N(ue, e);
335
+ function pt(e) {
336
+ D(fe, e);
317
337
  }
318
338
  function U() {
319
- const e = L(ue);
339
+ const e = L(fe);
320
340
  if (!e)
321
341
  throw new Error("useSelection() requires a BrickPdf ancestor component");
322
342
  return e;
323
343
  }
324
- const pe = /* @__PURE__ */ Symbol("brick-pdf-element-actions");
325
- let ut = 0;
326
- function fe() {
327
- return `el-${Date.now()}-${++ut}`;
344
+ const me = /* @__PURE__ */ Symbol("brick-pdf-element-actions");
345
+ let ft = 0;
346
+ function ye() {
347
+ return `el-${Date.now()}-${++ft}`;
328
348
  }
329
- function me(e) {
349
+ function ge(e) {
330
350
  return {
331
351
  ...e,
332
- id: fe(),
352
+ id: ye(),
333
353
  props: structuredClone(e.props),
334
354
  style: structuredClone(e.style),
335
- children: e.children.map(me)
355
+ children: e.children.map(ge)
336
356
  };
337
357
  }
338
- function pt(e, t) {
339
- function n(p, r, l) {
340
- const y = F(p);
358
+ function mt(e, t) {
359
+ function n(a, r, l) {
360
+ const y = F(a);
341
361
  if (!y) return null;
342
362
  t.record();
343
- const b = {
344
- id: fe(),
345
- type: p,
363
+ const g = {
364
+ id: ye(),
365
+ type: a,
346
366
  props: y.defaultProps(),
347
367
  style: y.defaultStyle(),
348
368
  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;
369
+ }, f = r ? e.findNodeById(r)?.node.children : e.document.content;
370
+ if (!f) return null;
371
+ const b = l ?? f.length;
372
+ return f.splice(b, 0, g), g;
353
373
  }
354
- function i(p) {
355
- const r = e.findNodeById(p);
374
+ function i(a) {
375
+ const r = e.findNodeById(a);
356
376
  r && (t.record(), r.parent.splice(r.index, 1));
357
377
  }
358
- function d(p, r, l) {
359
- const y = e.findNodeById(p);
378
+ function c(a, r, l) {
379
+ const y = e.findNodeById(a);
360
380
  if (!y) return;
361
381
  t.record();
362
- const b = y.parent.splice(y.index, 1)[0];
363
- if (!b) return;
364
- const m = r ? e.findNodeById(r)?.node.children : e.document.content;
365
- m && m.splice(l, 0, b);
382
+ const g = y.parent.splice(y.index, 1)[0];
383
+ if (!g) return;
384
+ const f = r ? e.findNodeById(r)?.node.children : e.document.content;
385
+ f && f.splice(l, 0, g);
366
386
  }
367
- function o(p) {
368
- const r = e.findNodeById(p);
387
+ function o(a) {
388
+ const r = e.findNodeById(a);
369
389
  if (!r) return null;
370
390
  t.record();
371
- const l = me(r.node);
391
+ const l = ge(r.node);
372
392
  return r.parent.splice(r.index + 1, 0, l), l;
373
393
  }
374
- function u(p, r) {
375
- const l = e.findNodeById(p);
394
+ function u(a, r) {
395
+ const l = e.findNodeById(a);
376
396
  l && (t.record(), Object.assign(l.node.props, r));
377
397
  }
378
- function a(p, r) {
379
- const l = e.findNodeById(p);
398
+ function p(a, r) {
399
+ const l = e.findNodeById(a);
380
400
  l && (t.record(), Object.assign(l.node.style, r));
381
401
  }
382
- return { addElement: n, removeElement: i, moveElement: d, duplicateElement: o, updateProps: u, updateStyle: a };
402
+ return { addElement: n, removeElement: i, moveElement: c, duplicateElement: o, updateProps: u, updateStyle: p };
383
403
  }
384
- function ft(e) {
385
- N(pe, e);
404
+ function yt(e) {
405
+ D(me, e);
386
406
  }
387
407
  function Y() {
388
- const e = L(pe);
408
+ const e = L(me);
389
409
  if (!e)
390
410
  throw new Error("useElementActions() requires a BrickPdf ancestor component");
391
411
  return e;
392
412
  }
393
- const ye = /* @__PURE__ */ Symbol("brick-pdf-history"), mt = 50;
394
- function yt(e) {
395
- const t = E([]), n = E([]);
413
+ const be = /* @__PURE__ */ Symbol("brick-pdf-history"), gt = 50;
414
+ function bt(e) {
415
+ const t = P([]), n = P([]);
396
416
  let i = 0;
397
- const d = $(() => t.value.length > 0), o = $(() => n.value.length > 0);
417
+ const c = $(() => t.value.length > 0), o = $(() => n.value.length > 0);
398
418
  function u() {
399
419
  const r = Date.now();
400
420
  if (r - i < 100) return;
401
421
  i = r;
402
422
  const l = e.snapshotContent();
403
- t.value.push(l), t.value.length > mt && t.value.shift(), n.value = [];
423
+ t.value.push(l), t.value.length > gt && t.value.shift(), n.value = [];
404
424
  }
405
- function a() {
425
+ function p() {
406
426
  const r = t.value.pop();
407
427
  r && (n.value.push(e.snapshotContent()), e.replaceContent(r));
408
428
  }
409
- function p() {
429
+ function a() {
410
430
  const r = n.value.pop();
411
431
  r && (t.value.push(e.snapshotContent()), e.replaceContent(r));
412
432
  }
413
- return { canUndo: d, canRedo: o, record: u, undo: a, redo: p };
433
+ return { canUndo: c, canRedo: o, record: u, undo: p, redo: a };
414
434
  }
415
- function gt(e) {
416
- N(ye, e);
435
+ function vt(e) {
436
+ D(be, e);
417
437
  }
418
- function bt() {
419
- const e = L(ye);
438
+ function ht() {
439
+ const e = L(be);
420
440
  if (!e)
421
441
  throw new Error("useHistory() requires a BrickPdf ancestor component");
422
442
  return e;
423
443
  }
424
- const ge = /* @__PURE__ */ Symbol("brick-pdf-drag-drop");
425
- function vt(e, t) {
426
- const n = E(!1);
444
+ const ve = /* @__PURE__ */ Symbol("brick-pdf-drag-drop");
445
+ function _t(e, t) {
446
+ const n = P(!1);
427
447
  function i(o) {
428
- return le.create(o, {
448
+ return se.create(o, {
429
449
  group: { name: "brick-elements", pull: "clone", put: !1 },
430
450
  sort: !1,
431
451
  animation: 150,
@@ -437,8 +457,8 @@ function vt(e, t) {
437
457
  }
438
458
  });
439
459
  }
440
- function d(o, u) {
441
- return le.create(o, {
460
+ function c(o, u) {
461
+ return se.create(o, {
442
462
  group: { name: "brick-elements", put: !0 },
443
463
  animation: 150,
444
464
  fallbackOnBody: !0,
@@ -448,50 +468,51 @@ function vt(e, t) {
448
468
  onStart() {
449
469
  n.value = !0;
450
470
  },
451
- onAdd(a) {
452
- const p = a.item, r = p.dataset.elementType;
471
+ onAdd(p) {
472
+ const a = p.item, r = a.dataset.elementId, l = a.dataset.elementType, y = (g) => {
473
+ if (!u || !g) return !1;
474
+ const f = e.findNodeById(u);
475
+ if (!f) return !1;
476
+ const b = F(f.node.type);
477
+ return !!(b?.acceptsChildTypes && !b.acceptsChildTypes.includes(g));
478
+ };
453
479
  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))
459
- return;
460
- }
461
- }
462
- t.addElement(r, u, a.newIndex);
480
+ if (a.parentNode?.removeChild(a), y(l)) return;
481
+ t.moveElement(r, u, p.newIndex ?? 0);
482
+ return;
463
483
  }
484
+ l && (a.parentNode?.removeChild(a), !y(l) && t.addElement(l, u, p.newIndex));
464
485
  },
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);
486
+ onEnd(p) {
487
+ if (n.value = !1, p.from === p.to && p.oldIndex !== void 0 && p.newIndex !== void 0 && p.oldIndex !== p.newIndex && p.item.dataset.elementId) {
488
+ const a = u ? e.findNodeById(u)?.node.children : e.document.content;
489
+ if (!a) return;
490
+ const r = a.splice(p.oldIndex, 1)[0];
491
+ r && a.splice(p.newIndex, 0, r);
471
492
  }
472
493
  }
473
494
  });
474
495
  }
475
- return { initToolbar: i, initContainer: d, isDragging: n };
496
+ return { initToolbar: i, initContainer: c, isDragging: n };
476
497
  }
477
- function ht(e) {
478
- N(ge, e);
498
+ function kt(e) {
499
+ D(ve, e);
479
500
  }
480
- function be() {
481
- const e = L(ge);
501
+ function he() {
502
+ const e = L(ve);
482
503
  if (!e)
483
504
  throw new Error("useDragDrop() requires a BrickPdf ancestor component");
484
505
  return e;
485
506
  }
486
- const ve = /* @__PURE__ */ Symbol("brick-pdf-export");
487
- function _t(e) {
488
- return e.map(he);
507
+ const _e = /* @__PURE__ */ Symbol("brick-pdf-export");
508
+ function St(e) {
509
+ return e.map(ke);
489
510
  }
490
- function he(e) {
511
+ function ke(e) {
491
512
  const t = F(e.type);
492
- return t ? t.toPdfmake(e, _t) : { text: `[Unknown: ${e.type}]` };
513
+ return t ? t.toPdfmake(e, St) : { text: `[Unknown: ${e.type}]` };
493
514
  }
494
- function kt(e) {
515
+ function xt(e) {
495
516
  function t() {
496
517
  const o = e.document;
497
518
  return {
@@ -500,108 +521,108 @@ function kt(e) {
500
521
  pageMargins: o.pageMargins,
501
522
  defaultStyle: JSON.parse(JSON.stringify(H(o.defaultStyle))),
502
523
  styles: JSON.parse(JSON.stringify(H(o.styles))),
503
- content: o.content.map(he)
524
+ content: o.content.map(ke)
504
525
  };
505
526
  }
506
527
  async function n() {
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;
528
+ const o = await import("pdfmake/build/pdfmake"), u = await import("pdfmake/build/vfs_fonts"), p = o.default || o, a = u.pdfMake;
529
+ return a && a.vfs ? p.vfs = a.vfs : u.default && (p.vfs = u.default), p;
509
530
  }
510
531
  function i(o) {
511
532
  const u = t();
512
- n().then((a) => {
513
- a.createPdf(u).download(o ?? "document.pdf");
533
+ n().then((p) => {
534
+ p.createPdf(u).download(o ?? "document.pdf");
514
535
  });
515
536
  }
516
- function d() {
537
+ function c() {
517
538
  const o = t();
518
539
  n().then((u) => {
519
540
  u.createPdf(o).open();
520
541
  });
521
542
  }
522
- return { toDocumentDefinition: t, exportPdf: i, openPdf: d };
543
+ return { toDocumentDefinition: t, exportPdf: i, openPdf: c };
523
544
  }
524
- function xt(e) {
525
- N(ve, e);
545
+ function Ct(e) {
546
+ D(_e, e);
526
547
  }
527
- function St() {
528
- const e = L(ve);
548
+ function wt() {
549
+ const e = L(_e);
529
550
  if (!e)
530
551
  throw new Error("usePdfExport() requires a BrickPdf ancestor component");
531
552
  return e;
532
553
  }
533
- const _e = /* @__PURE__ */ Symbol("brick-pdf-clipboard");
534
- let Ct = 0;
535
- function wt() {
536
- return `el-${Date.now()}-${++Ct}`;
554
+ const Se = /* @__PURE__ */ Symbol("brick-pdf-clipboard");
555
+ let Et = 0;
556
+ function Pt() {
557
+ return `el-${Date.now()}-${++Et}`;
537
558
  }
538
- function ke(e) {
559
+ function xe(e) {
539
560
  return {
540
561
  ...e,
541
- id: wt(),
562
+ id: Pt(),
542
563
  props: structuredClone(e.props),
543
564
  style: structuredClone(e.style),
544
- children: e.children.map(ke)
565
+ children: e.children.map(xe)
545
566
  };
546
567
  }
547
- function Pt(e, t) {
548
- const n = E(null), i = E(!1), d = E(null), o = E(!1);
568
+ function $t(e, t) {
569
+ const n = P(null), i = P(!1), c = P(null), o = P(!1);
549
570
  function u(r) {
550
571
  const l = e.findNodeById(r);
551
- l && (n.value = structuredClone(l.node), i.value = !1, d.value = null, o.value = !0);
572
+ l && (n.value = structuredClone(l.node), i.value = !1, c.value = null, o.value = !0);
552
573
  }
553
- function a(r) {
574
+ function p(r) {
554
575
  const l = e.findNodeById(r);
555
- l && (n.value = structuredClone(l.node), i.value = !0, d.value = r, o.value = !0);
576
+ l && (n.value = structuredClone(l.node), i.value = !0, c.value = r, o.value = !0);
556
577
  }
557
- function p(r) {
578
+ function a(r) {
558
579
  if (!n.value) return;
559
- i.value && d.value && (t.removeElement(d.value), i.value = !1, d.value = null);
560
- const l = ke(n.value), y = r ? e.findNodeById(r)?.node.children : e.document.content;
580
+ i.value && c.value && (t.removeElement(c.value), i.value = !1, c.value = null);
581
+ const l = xe(n.value), y = r ? e.findNodeById(r)?.node.children : e.document.content;
561
582
  y && (y.push(l), i.value && (n.value = null, o.value = !1));
562
583
  }
563
- return { hasClipboard: o, copy: u, cut: a, paste: p };
584
+ return { hasClipboard: o, copy: u, cut: p, paste: a };
564
585
  }
565
- function Et(e) {
566
- N(_e, e);
586
+ function It(e) {
587
+ D(Se, e);
567
588
  }
568
- function rr() {
569
- const e = L(_e);
589
+ function Qo() {
590
+ const e = L(Se);
570
591
  if (!e)
571
592
  throw new Error("useClipboard() requires a BrickPdf ancestor component");
572
593
  return e;
573
594
  }
574
- const xe = /* @__PURE__ */ Symbol("brick-pdf-resize");
575
- function $t(e) {
576
- const t = E(!1);
577
- function n(i, d, o, u) {
595
+ const Ce = /* @__PURE__ */ Symbol("brick-pdf-resize");
596
+ function zt(e) {
597
+ const t = P(!1);
598
+ function n(i, c, o, u) {
578
599
  t.value = !0;
579
- const a = u.clientX, p = u.clientY, r = o.width, l = o.height;
580
- function y(m) {
581
- const g = m.clientX - a, v = m.clientY - p;
582
- let h = r, x = l;
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, {
600
+ const p = u.clientX, a = u.clientY, r = o.width, l = o.height;
601
+ function y(f) {
602
+ const b = f.clientX - p, v = f.clientY - a;
603
+ let h = r, S = l;
604
+ c.includes("e") && (h = r + b), c.includes("w") && (h = r - b), c.includes("s") && (S = l + v), c.includes("n") && (S = l - v), h = Math.max(20, h), S = Math.max(20, S), e.updateStyle(i, {
584
605
  width: Math.round(h),
585
- height: Math.round(x)
606
+ height: Math.round(S)
586
607
  });
587
608
  }
588
- function b() {
589
- t.value = !1, document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", b);
609
+ function g() {
610
+ t.value = !1, document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", g);
590
611
  }
591
- document.addEventListener("pointermove", y), document.addEventListener("pointerup", b);
612
+ document.addEventListener("pointermove", y), document.addEventListener("pointerup", g);
592
613
  }
593
614
  return { isResizing: t, startResize: n };
594
615
  }
595
- function It(e) {
596
- N(xe, e);
616
+ function Rt(e) {
617
+ D(Ce, e);
597
618
  }
598
- function lr() {
599
- const e = L(xe);
619
+ function Zo() {
620
+ const e = L(Ce);
600
621
  if (!e)
601
622
  throw new Error("useResize() requires a BrickPdf ancestor component");
602
623
  return e;
603
624
  }
604
- 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__ */ _({
625
+ const Tt = { class: "brick-table-editor" }, Nt = { class: "brick-table-editor__grid" }, Dt = ["onClick"], Lt = { class: "brick-table-editor__row-header" }, Mt = ["onClick"], Bt = ["value", "onInput"], Ot = /* @__PURE__ */ _({
605
626
  __name: "TablePropertyEditor",
606
627
  props: {
607
628
  node: {}
@@ -611,83 +632,83 @@ const Rt = { class: "brick-table-editor" }, Dt = { class: "brick-table-editor__g
611
632
  function i() {
612
633
  return t.node.props.body ?? [];
613
634
  }
614
- function d() {
635
+ function c() {
615
636
  return t.node.props.widths ?? [];
616
637
  }
617
- function o(l, y, b) {
618
- const m = i().map((g) => [...g]);
619
- m[l][y] = b, n.updateProps(t.node.id, { body: m });
638
+ function o(l, y, g) {
639
+ const f = i().map((b) => [...b]);
640
+ f[l][y] = g, n.updateProps(t.node.id, { body: f });
620
641
  }
621
642
  function u() {
622
- const l = i().map((b) => [...b]), y = l[0]?.length ?? 2;
643
+ const l = i().map((g) => [...g]), y = l[0]?.length ?? 2;
623
644
  l.push(Array(y).fill("")), n.updateProps(t.node.id, { body: l });
624
645
  }
625
- function a(l) {
626
- const y = i().map((m) => [...m]);
646
+ function p(l) {
647
+ const y = i().map((f) => [...f]);
627
648
  if (y.length <= 1) return;
628
649
  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 });
629
650
  }
630
- function p() {
631
- const l = i().map((b) => [...b, ""]), y = [...d(), "*"];
651
+ function a() {
652
+ const l = i().map((g) => [...g, ""]), y = [...c(), "*"];
632
653
  n.updateProps(t.node.id, { body: l, widths: y });
633
654
  }
634
655
  function r(l) {
635
- const y = i().map((m) => {
636
- const g = [...m];
637
- return g.splice(l, 1), g;
656
+ const y = i().map((f) => {
657
+ const b = [...f];
658
+ return b.splice(l, 1), b;
638
659
  });
639
660
  if ((y[0]?.length ?? 0) < 1) return;
640
- const b = [...d()];
641
- b.splice(l, 1), n.updateProps(t.node.id, { body: y, widths: b });
661
+ const g = [...c()];
662
+ g.splice(l, 1), n.updateProps(t.node.id, { body: y, widths: g });
642
663
  }
643
- return (l, y) => (s(), c("div", Rt, [
644
- f("div", { class: "brick-table-editor__actions" }, [
645
- f("button", {
664
+ return (l, y) => (s(), d("div", Tt, [
665
+ m("div", { class: "brick-table-editor__actions" }, [
666
+ m("button", {
646
667
  class: "brick-table-editor__btn",
647
668
  onClick: u
648
669
  }, "+ Row"),
649
- f("button", {
670
+ m("button", {
650
671
  class: "brick-table-editor__btn",
651
- onClick: p
672
+ onClick: a
652
673
  }, "+ Column")
653
674
  ]),
654
- f("div", Dt, [
655
- f("table", null, [
656
- f("thead", null, [
657
- f("tr", null, [
658
- y[0] || (y[0] = f("th", { class: "brick-table-editor__corner" }, null, -1)),
659
- (s(!0), c(C, null, P(i()[0] ?? [], (b, m) => (s(), c("th", {
660
- key: m,
675
+ m("div", Nt, [
676
+ m("table", null, [
677
+ m("thead", null, [
678
+ m("tr", null, [
679
+ y[0] || (y[0] = m("th", { class: "brick-table-editor__corner" }, null, -1)),
680
+ (s(!0), d(C, null, E(i()[0] ?? [], (g, f) => (s(), d("th", {
681
+ key: f,
661
682
  class: "brick-table-editor__col-header"
662
683
  }, [
663
- ne(" Col " + w(m + 1) + " ", 1),
664
- (i()[0]?.length ?? 0) > 1 ? (s(), c("button", {
684
+ re(" Col " + w(f + 1) + " ", 1),
685
+ (i()[0]?.length ?? 0) > 1 ? (s(), d("button", {
665
686
  key: 0,
666
687
  class: "brick-table-editor__remove-btn",
667
688
  title: "Remove column",
668
- onClick: (g) => r(m)
669
- }, "x", 8, zt)) : I("", !0)
689
+ onClick: (b) => r(f)
690
+ }, "x", 8, Dt)) : I("", !0)
670
691
  ]))), 128))
671
692
  ])
672
693
  ]),
673
- f("tbody", null, [
674
- (s(!0), c(C, null, P(i(), (b, m) => (s(), c("tr", { key: m }, [
675
- f("td", Tt, [
676
- ne(w(m + 1) + " ", 1),
677
- i().length > 1 ? (s(), c("button", {
694
+ m("tbody", null, [
695
+ (s(!0), d(C, null, E(i(), (g, f) => (s(), d("tr", { key: f }, [
696
+ m("td", Lt, [
697
+ re(w(f + 1) + " ", 1),
698
+ i().length > 1 ? (s(), d("button", {
678
699
  key: 0,
679
700
  class: "brick-table-editor__remove-btn",
680
701
  title: "Remove row",
681
- onClick: (g) => a(m)
682
- }, "x", 8, Nt)) : I("", !0)
702
+ onClick: (b) => p(f)
703
+ }, "x", 8, Mt)) : I("", !0)
683
704
  ]),
684
- (s(!0), c(C, null, P(b, (g, v) => (s(), c("td", { key: v }, [
685
- f("input", {
705
+ (s(!0), d(C, null, E(g, (b, v) => (s(), d("td", { key: v }, [
706
+ m("input", {
686
707
  class: "brick-table-editor__cell",
687
708
  type: "text",
688
- value: g,
689
- onInput: (h) => o(m, v, h.target.value)
690
- }, null, 40, Lt)
709
+ value: b,
710
+ onInput: (h) => o(f, v, h.target.value)
711
+ }, null, 40, Bt)
691
712
  ]))), 128))
692
713
  ]))), 128))
693
714
  ])
@@ -695,15 +716,15 @@ const Rt = { class: "brick-table-editor" }, Dt = { class: "brick-table-editor__g
695
716
  ])
696
717
  ]));
697
718
  }
698
- }), Bt = /* @__PURE__ */ S(Mt, [["__scopeId", "data-v-4895020c"]]), Ot = {
719
+ }), At = /* @__PURE__ */ x(Ot, [["__scopeId", "data-v-4895020c"]]), Vt = {
699
720
  type: "table",
700
721
  label: "Table",
701
722
  icon: "▦",
702
723
  isContainer: !1,
703
- defaultProps: nt,
704
- defaultStyle: ot,
705
- rendererComponent: it,
706
- propertyEditorComponent: Bt,
724
+ defaultProps: rt,
725
+ defaultStyle: lt,
726
+ rendererComponent: at,
727
+ propertyEditorComponent: At,
707
728
  propertyFields: [
708
729
  { key: "props.headerRows", label: "Header Rows", section: "content", type: "number", min: 0, max: 10, step: 1, defaultValue: 1 },
709
730
  { key: "props.layout", label: "Border Style", section: "style", type: "select", options: [
@@ -717,31 +738,31 @@ const Rt = { class: "brick-table-editor" }, Dt = { class: "brick-table-editor__g
717
738
  { key: "style.color", label: "Text Color", section: "style", type: "color", defaultValue: "#000000" },
718
739
  { key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
719
740
  ],
720
- toPdfmake: rt
741
+ toPdfmake: it
721
742
  };
722
- function Vt() {
743
+ function Ht() {
723
744
  return { src: "", width: 200, height: 150, fit: null };
724
745
  }
725
- function At() {
746
+ function Ft() {
726
747
  return {};
727
748
  }
728
- function Ht(e) {
749
+ function Ut(e) {
729
750
  const t = {
730
751
  image: e.props.src
731
752
  };
732
753
  return e.props.width && (t.width = e.props.width), e.props.height && (t.height = e.props.height), e.props.fit && (t.fit = e.props.fit), e.style.margin && (t.margin = e.style.margin), e.style.alignment && (t.alignment = e.style.alignment), e.style.opacity !== void 0 && (t.opacity = e.style.opacity), t;
733
754
  }
734
- const Ft = { class: "brick-el-image" }, Ut = ["src"], Wt = {
755
+ const Wt = { class: "brick-el-image" }, Jt = ["src"], Yt = {
735
756
  key: 1,
736
757
  class: "brick-el-image__placeholder"
737
- }, Jt = /* @__PURE__ */ _({
758
+ }, jt = /* @__PURE__ */ _({
738
759
  __name: "ImageRenderer",
739
760
  props: {
740
761
  node: {}
741
762
  },
742
763
  setup(e) {
743
- return (t, n) => (s(), c("div", Ft, [
744
- e.node.props.src ? (s(), c("img", {
764
+ return (t, n) => (s(), d("div", Wt, [
765
+ e.node.props.src ? (s(), d("img", {
745
766
  key: 0,
746
767
  src: e.node.props.src,
747
768
  style: R({
@@ -750,26 +771,26 @@ const Ft = { class: "brick-el-image" }, Ut = ["src"], Wt = {
750
771
  objectFit: "contain",
751
772
  opacity: e.node.style.opacity
752
773
  })
753
- }, null, 12, Ut)) : (s(), c("div", Wt, " No image selected "))
774
+ }, null, 12, Jt)) : (s(), d("div", Yt, " No image selected "))
754
775
  ]));
755
776
  }
756
- }), Yt = /* @__PURE__ */ S(Jt, [["__scopeId", "data-v-38184258"]]), qt = { class: "brick-image-editor" }, jt = /* @__PURE__ */ _({
777
+ }), qt = /* @__PURE__ */ x(jt, [["__scopeId", "data-v-38184258"]]), Gt = { class: "brick-image-editor" }, Xt = /* @__PURE__ */ _({
757
778
  __name: "ImagePropertyEditor",
758
779
  props: {
759
780
  node: {}
760
781
  },
761
782
  setup(e) {
762
- return (t, n) => (s(), c("div", qt));
783
+ return (t, n) => (s(), d("div", Gt));
763
784
  }
764
- }), Gt = {
785
+ }), Kt = {
765
786
  type: "image",
766
787
  label: "Image",
767
788
  icon: "🖼",
768
789
  isContainer: !1,
769
- defaultProps: Vt,
770
- defaultStyle: At,
771
- rendererComponent: Yt,
772
- propertyEditorComponent: jt,
790
+ defaultProps: Ht,
791
+ defaultStyle: Ft,
792
+ rendererComponent: qt,
793
+ propertyEditorComponent: Xt,
773
794
  propertyFields: [
774
795
  { key: "props.src", label: "Image (Base64)", section: "content", type: "file" },
775
796
  { key: "props.width", label: "Width", section: "layout", type: "number", min: 10, max: 1e3, step: 10, defaultValue: 200 },
@@ -782,53 +803,53 @@ const Ft = { class: "brick-el-image" }, Ut = ["src"], Wt = {
782
803
  { key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] },
783
804
  { key: "style.opacity", label: "Opacity", section: "advanced", type: "slider", min: 0, max: 1, step: 0.1, defaultValue: 1 }
784
805
  ],
785
- toPdfmake: Ht
806
+ toPdfmake: Ut
786
807
  };
787
- function Xt() {
808
+ function Qt() {
788
809
  return { ordered: !1, items: ["Item 1", "Item 2", "Item 3"] };
789
810
  }
790
- function Kt() {
811
+ function Zt() {
791
812
  return { fontSize: 12 };
792
813
  }
793
- function Qt(e) {
814
+ function en(e) {
794
815
  const t = e.props.items, i = e.props.ordered ? { ol: t } : { ul: t };
795
816
  return e.style.fontSize && (i.fontSize = e.style.fontSize), e.style.color && (i.color = e.style.color), e.style.margin && (i.margin = e.style.margin), i;
796
817
  }
797
- const Zt = /* @__PURE__ */ _({
818
+ const tn = /* @__PURE__ */ _({
798
819
  __name: "ListRenderer",
799
820
  props: {
800
821
  node: {}
801
822
  },
802
823
  setup(e) {
803
- return (t, n) => (s(), c("div", {
824
+ return (t, n) => (s(), d("div", {
804
825
  class: "brick-el-list",
805
826
  style: R({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
806
827
  }, [
807
- (s(), M(Q(e.node.props.ordered ? "ol" : "ul"), null, {
828
+ (s(), M(Z(e.node.props.ordered ? "ol" : "ul"), null, {
808
829
  default: W(() => [
809
- (s(!0), c(C, null, P(e.node.props.items, (i, d) => (s(), c("li", { key: d }, w(i), 1))), 128))
830
+ (s(!0), d(C, null, E(e.node.props.items, (i, c) => (s(), d("li", { key: c }, w(i), 1))), 128))
810
831
  ]),
811
832
  _: 1
812
833
  }))
813
834
  ], 4));
814
835
  }
815
- }), en = /* @__PURE__ */ S(Zt, [["__scopeId", "data-v-8107f859"]]), tn = { class: "brick-list-editor" }, nn = /* @__PURE__ */ _({
836
+ }), nn = /* @__PURE__ */ x(tn, [["__scopeId", "data-v-8107f859"]]), on = { class: "brick-list-editor" }, rn = /* @__PURE__ */ _({
816
837
  __name: "ListPropertyEditor",
817
838
  props: {
818
839
  node: {}
819
840
  },
820
841
  setup(e) {
821
- return (t, n) => (s(), c("div", tn));
842
+ return (t, n) => (s(), d("div", on));
822
843
  }
823
- }), on = {
844
+ }), ln = {
824
845
  type: "list",
825
846
  label: "List",
826
847
  icon: "☰",
827
848
  isContainer: !1,
828
- defaultProps: Xt,
829
- defaultStyle: Kt,
830
- rendererComponent: en,
831
- propertyEditorComponent: nn,
849
+ defaultProps: Qt,
850
+ defaultStyle: Zt,
851
+ rendererComponent: nn,
852
+ propertyEditorComponent: rn,
832
853
  propertyFields: [
833
854
  { key: "props.ordered", label: "Ordered", section: "content", type: "toggle", defaultValue: !1 },
834
855
  { key: "props.items", label: "Items", section: "content", type: "textarea", defaultValue: `Item 1
@@ -838,54 +859,54 @@ Item 3` },
838
859
  { key: "style.color", label: "Color", section: "style", type: "color", defaultValue: "#000000" },
839
860
  { key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
840
861
  ],
841
- toPdfmake: Qt
862
+ toPdfmake: en
842
863
  };
843
- function rn() {
864
+ function sn() {
844
865
  return { data: "https://example.com", fit: 100 };
845
866
  }
846
- function ln() {
867
+ function an() {
847
868
  return {};
848
869
  }
849
- function sn(e) {
870
+ function cn(e) {
850
871
  const t = {
851
872
  qr: e.props.data,
852
873
  fit: e.props.fit ?? 100
853
874
  };
854
875
  return e.style.alignment && (t.alignment = e.style.alignment), e.style.margin && (t.margin = e.style.margin), t;
855
876
  }
856
- const an = { class: "brick-el-qr__preview" }, cn = /* @__PURE__ */ _({
877
+ const dn = { class: "brick-el-qr__preview" }, un = /* @__PURE__ */ _({
857
878
  __name: "QrRenderer",
858
879
  props: {
859
880
  node: {}
860
881
  },
861
882
  setup(e) {
862
- return (t, n) => (s(), c("div", {
883
+ return (t, n) => (s(), d("div", {
863
884
  class: "brick-el-qr",
864
885
  style: R({
865
886
  width: (e.node.props.fit ?? 100) + "px",
866
887
  height: (e.node.props.fit ?? 100) + "px"
867
888
  })
868
889
  }, [
869
- f("div", an, "QR: " + w(e.node.props.data), 1)
890
+ m("div", dn, "QR: " + w(e.node.props.data), 1)
870
891
  ], 4));
871
892
  }
872
- }), dn = /* @__PURE__ */ S(cn, [["__scopeId", "data-v-f106ba48"]]), un = { class: "brick-qr-editor" }, pn = /* @__PURE__ */ _({
893
+ }), pn = /* @__PURE__ */ x(un, [["__scopeId", "data-v-f106ba48"]]), fn = { class: "brick-qr-editor" }, mn = /* @__PURE__ */ _({
873
894
  __name: "QrPropertyEditor",
874
895
  props: {
875
896
  node: {}
876
897
  },
877
898
  setup(e) {
878
- return (t, n) => (s(), c("div", un));
899
+ return (t, n) => (s(), d("div", fn));
879
900
  }
880
- }), fn = {
901
+ }), yn = {
881
902
  type: "qr",
882
903
  label: "QR Code",
883
904
  icon: "⊞",
884
905
  isContainer: !1,
885
- defaultProps: rn,
886
- defaultStyle: ln,
887
- rendererComponent: dn,
888
- propertyEditorComponent: pn,
906
+ defaultProps: sn,
907
+ defaultStyle: an,
908
+ rendererComponent: pn,
909
+ propertyEditorComponent: mn,
889
910
  propertyFields: [
890
911
  { key: "props.data", label: "QR Data", section: "content", type: "text", defaultValue: "https://example.com" },
891
912
  { key: "props.fit", label: "Size (px)", section: "layout", type: "number", min: 50, max: 500, step: 10, defaultValue: 100 },
@@ -896,56 +917,56 @@ const an = { class: "brick-el-qr__preview" }, cn = /* @__PURE__ */ _({
896
917
  ] },
897
918
  { key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
898
919
  ],
899
- toPdfmake: sn
920
+ toPdfmake: cn
900
921
  };
901
- function mn() {
922
+ function gn() {
902
923
  return {
903
924
  svg: '<svg viewBox="0 0 100 100"><rect width="100" height="100" fill="#eee" /><text x="50" y="55" text-anchor="middle" font-size="12">SVG</text></svg>',
904
925
  width: 200,
905
926
  height: 200
906
927
  };
907
928
  }
908
- function yn() {
929
+ function bn() {
909
930
  return {};
910
931
  }
911
- function gn(e) {
932
+ function vn(e) {
912
933
  const t = {
913
934
  svg: e.props.svg
914
935
  };
915
936
  return e.props.width && (t.width = e.props.width), e.props.height && (t.height = e.props.height), e.style.margin && (t.margin = e.style.margin), e.style.alignment && (t.alignment = e.style.alignment), t;
916
937
  }
917
- const bn = ["innerHTML"], vn = /* @__PURE__ */ _({
938
+ const hn = ["innerHTML"], _n = /* @__PURE__ */ _({
918
939
  __name: "SvgRenderer",
919
940
  props: {
920
941
  node: {}
921
942
  },
922
943
  setup(e) {
923
- return (t, n) => (s(), c("div", {
944
+ return (t, n) => (s(), d("div", {
924
945
  class: "brick-el-svg",
925
946
  style: R({
926
947
  width: e.node.props.width + "px",
927
948
  height: e.node.props.height + "px"
928
949
  }),
929
950
  innerHTML: e.node.props.svg
930
- }, null, 12, bn));
951
+ }, null, 12, hn));
931
952
  }
932
- }), hn = /* @__PURE__ */ S(vn, [["__scopeId", "data-v-5e9f3319"]]), _n = { class: "brick-svg-editor" }, kn = /* @__PURE__ */ _({
953
+ }), kn = /* @__PURE__ */ x(_n, [["__scopeId", "data-v-5e9f3319"]]), Sn = { class: "brick-svg-editor" }, xn = /* @__PURE__ */ _({
933
954
  __name: "SvgPropertyEditor",
934
955
  props: {
935
956
  node: {}
936
957
  },
937
958
  setup(e) {
938
- return (t, n) => (s(), c("div", _n));
959
+ return (t, n) => (s(), d("div", Sn));
939
960
  }
940
- }), xn = {
961
+ }), Cn = {
941
962
  type: "svg",
942
963
  label: "SVG",
943
964
  icon: "◇",
944
965
  isContainer: !1,
945
- defaultProps: mn,
946
- defaultStyle: yn,
947
- rendererComponent: hn,
948
- propertyEditorComponent: kn,
966
+ defaultProps: gn,
967
+ defaultStyle: bn,
968
+ rendererComponent: kn,
969
+ propertyEditorComponent: xn,
949
970
  propertyFields: [
950
971
  { key: "props.svg", label: "SVG Markup", section: "content", type: "textarea" },
951
972
  { key: "props.width", label: "Width", section: "layout", type: "number", min: 10, max: 1e3, step: 10, defaultValue: 200 },
@@ -957,195 +978,137 @@ const bn = ["innerHTML"], vn = /* @__PURE__ */ _({
957
978
  ] },
958
979
  { key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
959
980
  ],
960
- toPdfmake: gn
981
+ toPdfmake: vn
961
982
  };
962
- function Sn() {
963
- return {
964
- commands: [
965
- { type: "rect", x: 0, y: 0, w: 200, h: 100, color: "#eeeeee" }
966
- ],
967
- width: 200,
968
- height: 100
969
- };
970
- }
971
- function Cn() {
983
+ function wn() {
972
984
  return {};
973
985
  }
974
- function wn(e) {
975
- const t = {
976
- canvas: e.props.commands
977
- };
978
- return e.style.margin && (t.margin = e.style.margin), t;
979
- }
980
- const Pn = /* @__PURE__ */ _({
981
- __name: "CanvasDrawRenderer",
982
- props: {
983
- node: {}
984
- },
985
- setup(e) {
986
- return (t, n) => (s(), c("div", {
987
- class: "brick-el-canvas",
988
- style: R({
989
- width: (e.node.props.width ?? 200) + "px",
990
- height: (e.node.props.height ?? 100) + "px"
991
- })
992
- }, [...n[0] || (n[0] = [
993
- f("div", { class: "brick-el-canvas__label" }, "Canvas Drawing", -1)
994
- ])], 4));
995
- }
996
- }), En = /* @__PURE__ */ S(Pn, [["__scopeId", "data-v-1b986707"]]), $n = { class: "brick-canvas-editor" }, In = /* @__PURE__ */ _({
997
- __name: "CanvasDrawPropertyEditor",
998
- props: {
999
- node: {}
1000
- },
1001
- setup(e) {
1002
- return (t, n) => (s(), c("div", $n));
1003
- }
1004
- }), Rn = {
1005
- type: "canvas",
1006
- label: "Canvas",
1007
- icon: "△",
1008
- isContainer: !1,
1009
- defaultProps: Sn,
1010
- defaultStyle: Cn,
1011
- rendererComponent: En,
1012
- propertyEditorComponent: In,
1013
- propertyFields: [
1014
- { key: "props.width", label: "Width", section: "layout", type: "number", min: 10, max: 1e3, step: 10, defaultValue: 200 },
1015
- { key: "props.height", label: "Height", section: "layout", type: "number", min: 10, max: 1e3, step: 10, defaultValue: 100 },
1016
- { key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
1017
- ],
1018
- toPdfmake: wn
1019
- };
1020
- function Dn() {
1021
- return {};
1022
- }
1023
- function zn() {
986
+ function En() {
1024
987
  return {};
1025
988
  }
1026
- function Tn(e) {
989
+ function Pn(e) {
1027
990
  return { text: "", pageBreak: "after" };
1028
991
  }
1029
- const Nn = { class: "brick-el-pagebreak" }, Ln = /* @__PURE__ */ _({
992
+ const $n = { class: "brick-el-pagebreak" }, In = /* @__PURE__ */ _({
1030
993
  __name: "PageBreakRenderer",
1031
994
  props: {
1032
995
  node: {}
1033
996
  },
1034
997
  setup(e) {
1035
- return (t, n) => (s(), c("div", Nn, [...n[0] || (n[0] = [
1036
- f("hr", null, null, -1),
1037
- f("span", null, "Page Break", -1),
1038
- f("hr", null, null, -1)
998
+ return (t, n) => (s(), d("div", $n, [...n[0] || (n[0] = [
999
+ m("hr", null, null, -1),
1000
+ m("span", null, "Page Break", -1),
1001
+ m("hr", null, null, -1)
1039
1002
  ])]));
1040
1003
  }
1041
- }), Mn = /* @__PURE__ */ S(Ln, [["__scopeId", "data-v-60c05148"]]), Bn = { class: "brick-pagebreak-editor" }, On = /* @__PURE__ */ _({
1004
+ }), zn = /* @__PURE__ */ x(In, [["__scopeId", "data-v-60c05148"]]), Rn = { class: "brick-pagebreak-editor" }, Tn = /* @__PURE__ */ _({
1042
1005
  __name: "PageBreakPropertyEditor",
1043
1006
  props: {
1044
1007
  node: {}
1045
1008
  },
1046
1009
  setup(e) {
1047
- return (t, n) => (s(), c("div", Bn, [...n[0] || (n[0] = [
1048
- f("p", { style: { color: "#999", "font-size": "12px" } }, "No configurable properties.", -1)
1010
+ return (t, n) => (s(), d("div", Rn, [...n[0] || (n[0] = [
1011
+ m("p", { style: { color: "#999", "font-size": "12px" } }, "No configurable properties.", -1)
1049
1012
  ])]));
1050
1013
  }
1051
- }), Vn = {
1014
+ }), Nn = {
1052
1015
  type: "pageBreak",
1053
1016
  label: "Page Break",
1054
1017
  icon: "⏎",
1055
1018
  isContainer: !1,
1056
- defaultProps: Dn,
1057
- defaultStyle: zn,
1058
- rendererComponent: Mn,
1059
- propertyEditorComponent: On,
1019
+ defaultProps: wn,
1020
+ defaultStyle: En,
1021
+ rendererComponent: zn,
1022
+ propertyEditorComponent: Tn,
1060
1023
  propertyFields: [],
1061
- toPdfmake: Tn
1024
+ toPdfmake: Pn
1062
1025
  };
1063
- let ie = !1;
1064
- function An() {
1065
- ie || (ie = !0, z(Ve), z(qe), z(tt), z(Ot), z(Gt), z(on), z(fn), z(xn), z(Rn), z(Vn));
1026
+ let ce = !1;
1027
+ function Dn() {
1028
+ ce || (ce = !0, T(He), T(Ge), T(ot), T(Vt), T(Kt), T(ln), T(yn), T(Cn), T(Nn));
1066
1029
  }
1067
- const Hn = {
1030
+ const Ln = {
1068
1031
  key: 0,
1069
1032
  class: "brick-dropzone__empty"
1070
- }, Fn = /* @__PURE__ */ _({
1033
+ }, Mn = /* @__PURE__ */ _({
1071
1034
  __name: "DropZone",
1072
1035
  props: {
1073
1036
  parentId: {},
1074
1037
  layout: {}
1075
1038
  },
1076
1039
  setup(e) {
1077
- const t = e, n = E(null);
1040
+ const t = e, n = P(null);
1078
1041
  let i = null;
1079
- const d = be(), { isDragging: o } = d;
1080
- return se(() => {
1081
- n.value && (i = d.initContainer(n.value, t.parentId));
1082
- }), ae(() => {
1042
+ const c = he(), { isDragging: o } = c;
1043
+ return de(() => {
1044
+ n.value && (i = c.initContainer(n.value, t.parentId));
1045
+ }), ue(() => {
1083
1046
  i?.destroy();
1084
- }), (u, a) => (s(), c("div", {
1047
+ }), (u, p) => (s(), d("div", {
1085
1048
  ref_key: "el",
1086
1049
  ref: n,
1087
- class: K(["brick-dropzone", { "brick-dropzone--horizontal": e.layout === "horizontal", "brick-dropzone--drag-active": k(o) }])
1050
+ class: Q(["brick-dropzone", { "brick-dropzone--horizontal": e.layout === "horizontal", "brick-dropzone--drag-active": k(o) && e.layout === "horizontal" }])
1088
1051
  }, [
1089
- X(u.$slots, "default", {}, void 0, !0),
1090
- u.$slots.default ? I("", !0) : (s(), c("div", Hn, " Drop elements here "))
1052
+ K(u.$slots, "default", {}, void 0, !0),
1053
+ u.$slots.default ? I("", !0) : (s(), d("div", Ln, " Drop elements here "))
1091
1054
  ], 2));
1092
1055
  }
1093
- }), Se = /* @__PURE__ */ S(Fn, [["__scopeId", "data-v-edee28d4"]]), Un = ["data-element-id", "data-element-type"], Wn = {
1056
+ }), we = /* @__PURE__ */ x(Mn, [["__scopeId", "data-v-b9596dad"]]), Bn = ["data-element-id", "data-element-type"], On = {
1094
1057
  key: 1,
1095
1058
  class: "brick-canvas-element__unknown"
1096
- }, Jn = /* @__PURE__ */ _({
1059
+ }, An = /* @__PURE__ */ _({
1097
1060
  __name: "CanvasElement",
1098
1061
  props: {
1099
1062
  node: {},
1100
1063
  path: {}
1101
1064
  },
1102
1065
  setup(e) {
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);
1104
- function r(m) {
1105
- m.stopPropagation(), n.select(t.node.id);
1066
+ const t = e, n = U(), i = Y(), c = P(null), o = $(() => F(t.node.type)), u = $(() => n.selectedId.value === t.node.id), p = $(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.width" || f.key === "style.width") : !1), a = $(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.height" || f.key === "style.height") : !1);
1067
+ function r(f) {
1068
+ f.stopPropagation(), n.select(t.node.id);
1106
1069
  }
1107
- function l(m) {
1108
- m.stopPropagation(), m.preventDefault();
1109
- const g = m.clientX, v = d.value?.offsetWidth ?? 200;
1110
- function h(D) {
1111
- const O = D.clientX - g, T = Math.max(20, v + O);
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) });
1070
+ function l(f) {
1071
+ f.stopPropagation(), f.preventDefault();
1072
+ const b = f.clientX, v = c.value?.offsetWidth ?? 200;
1073
+ function h(z) {
1074
+ const O = z.clientX - b, N = Math.max(20, v + O);
1075
+ 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) });
1113
1076
  }
1114
- function x() {
1115
- document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", x), document.body.style.cursor = "", document.body.style.userSelect = "";
1077
+ function S() {
1078
+ document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", S), document.body.style.cursor = "", document.body.style.userSelect = "";
1116
1079
  }
1117
- document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", x);
1080
+ document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", S);
1118
1081
  }
1119
- function y(m) {
1120
- m.stopPropagation(), m.preventDefault();
1121
- const g = m.clientY, v = d.value?.offsetHeight ?? 100;
1122
- function h(D) {
1123
- const O = D.clientY - g, T = Math.max(20, v + O);
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) });
1082
+ function y(f) {
1083
+ f.stopPropagation(), f.preventDefault();
1084
+ const b = f.clientY, v = c.value?.offsetHeight ?? 100;
1085
+ function h(z) {
1086
+ const O = z.clientY - b, N = Math.max(20, v + O);
1087
+ 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) });
1125
1088
  }
1126
- function x() {
1127
- document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", x), document.body.style.cursor = "", document.body.style.userSelect = "";
1089
+ function S() {
1090
+ document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", S), document.body.style.cursor = "", document.body.style.userSelect = "";
1128
1091
  }
1129
- document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", x);
1092
+ document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", S);
1130
1093
  }
1131
- function b(m) {
1132
- m.stopPropagation(), m.preventDefault();
1133
- const g = m.clientX, v = m.clientY, h = d.value?.offsetWidth ?? 200, x = d.value?.offsetHeight ?? 100;
1134
- function D(T) {
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");
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) });
1094
+ function g(f) {
1095
+ f.stopPropagation(), f.preventDefault();
1096
+ const b = f.clientX, v = f.clientY, h = c.value?.offsetWidth ?? 200, S = c.value?.offsetHeight ?? 100;
1097
+ function z(N) {
1098
+ const j = N.clientX - b, V = N.clientY - v, ne = Math.max(20, h + j), oe = Math.max(20, S + V), Ee = o.value?.propertyFields.some((q) => q.key === "props.width"), Pe = o.value?.propertyFields.some((q) => q.key === "props.height");
1099
+ Ee ? i.updateProps(t.node.id, { width: Math.round(ne) }) : i.updateStyle(t.node.id, { width: Math.round(ne) }), Pe ? i.updateProps(t.node.id, { height: Math.round(oe) }) : i.updateStyle(t.node.id, { height: Math.round(oe) });
1137
1100
  }
1138
1101
  function O() {
1139
- document.removeEventListener("pointermove", D), document.removeEventListener("pointerup", O), document.body.style.cursor = "", document.body.style.userSelect = "";
1102
+ document.removeEventListener("pointermove", z), document.removeEventListener("pointerup", O), document.body.style.cursor = "", document.body.style.userSelect = "";
1140
1103
  }
1141
- document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", D), document.addEventListener("pointerup", O);
1104
+ document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", z), document.addEventListener("pointerup", O);
1142
1105
  }
1143
- return (m, g) => {
1144
- const v = Ee("CanvasElement", !0);
1145
- return s(), c("div", {
1106
+ return (f, b) => {
1107
+ const v = Ie("CanvasElement", !0);
1108
+ return s(), d("div", {
1146
1109
  ref_key: "elRef",
1147
- ref: d,
1148
- class: K(["brick-canvas-element", { "brick-canvas-element--selected": u.value }]),
1110
+ ref: c,
1111
+ class: Q(["brick-canvas-element", { "brick-canvas-element--selected": u.value }]),
1149
1112
  "data-element-id": e.node.id,
1150
1113
  "data-element-type": e.node.type,
1151
1114
  style: R({
@@ -1159,152 +1122,152 @@ const Hn = {
1159
1122
  }),
1160
1123
  onClick: r
1161
1124
  }, [
1162
- o.value ? (s(), M(Q(o.value.rendererComponent), {
1125
+ o.value ? (s(), M(Z(o.value.rendererComponent), {
1163
1126
  key: 0,
1164
1127
  node: e.node,
1165
1128
  path: e.path
1166
1129
  }, {
1167
1130
  default: W(() => [
1168
- o.value.isContainer ? (s(), M(Se, {
1131
+ o.value.isContainer ? (s(), M(we, {
1169
1132
  key: 0,
1170
1133
  "parent-id": e.node.id,
1171
1134
  layout: e.node.type === "columns" ? "horizontal" : "vertical"
1172
1135
  }, {
1173
1136
  default: W(() => [
1174
- (s(!0), c(C, null, P(e.node.children, (h, x) => (s(), M(v, {
1137
+ (s(!0), d(C, null, E(e.node.children, (h, S) => (s(), M(v, {
1175
1138
  key: h.id,
1176
1139
  node: h,
1177
- path: [...e.path, x]
1140
+ path: [...e.path, S]
1178
1141
  }, null, 8, ["node", "path"]))), 128))
1179
1142
  ]),
1180
1143
  _: 1
1181
1144
  }, 8, ["parent-id", "layout"])) : I("", !0)
1182
1145
  ]),
1183
1146
  _: 1
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", {
1147
+ }, 8, ["node", "path"])) : (s(), d("div", On, " Unknown element: " + w(e.node.type), 1)),
1148
+ u.value ? (s(), d(C, { key: 2 }, [
1149
+ p.value ? (s(), d("div", {
1187
1150
  key: 0,
1188
1151
  class: "brick-resize-handle brick-resize-handle--e",
1189
1152
  onPointerdown: l
1190
1153
  }, null, 32)) : I("", !0),
1191
- p.value ? (s(), c("div", {
1154
+ a.value ? (s(), d("div", {
1192
1155
  key: 1,
1193
1156
  class: "brick-resize-handle brick-resize-handle--s",
1194
1157
  onPointerdown: y
1195
1158
  }, null, 32)) : I("", !0),
1196
- a.value && p.value ? (s(), c("div", {
1159
+ p.value && a.value ? (s(), d("div", {
1197
1160
  key: 2,
1198
1161
  class: "brick-resize-handle brick-resize-handle--se",
1199
- onPointerdown: b
1162
+ onPointerdown: g
1200
1163
  }, null, 32)) : I("", !0)
1201
1164
  ], 64)) : I("", !0)
1202
- ], 14, Un);
1165
+ ], 14, Bn);
1203
1166
  };
1204
1167
  }
1205
- }), 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__ */ _({
1168
+ }), Vn = /* @__PURE__ */ x(An, [["__scopeId", "data-v-6b9cadc1"]]), Hn = { class: "brick-doc-bar" }, Fn = { class: "brick-doc-bar__field" }, Un = ["value"], Wn = { class: "brick-doc-bar__field" }, Jn = { class: "brick-doc-bar__field brick-doc-bar__field--margins" }, Yn = { class: "brick-doc-bar__margins" }, jn = ["placeholder", "title", "value", "onInput"], qn = { class: "brick-doc-bar__field" }, Gn = ["value"], Xn = /* @__PURE__ */ _({
1206
1169
  __name: "DocumentSettings",
1207
1170
  setup(e) {
1208
- const t = Z(), n = [
1171
+ const t = te(), n = [
1209
1172
  { label: "A3", value: "A3" },
1210
1173
  { label: "A4", value: "A4" },
1211
1174
  { label: "A5", value: "A5" },
1212
1175
  { label: "Letter", value: "LETTER" },
1213
1176
  { label: "Legal", value: "LEGAL" }
1214
1177
  ];
1215
- function i(d, o) {
1178
+ function i(c, o) {
1216
1179
  const u = [...t.document.pageMargins];
1217
- u[d] = o, t.document.pageMargins = u;
1180
+ u[c] = o, t.document.pageMargins = u;
1218
1181
  }
1219
- return (d, o) => (s(), c("div", qn, [
1220
- f("div", jn, [
1221
- o[3] || (o[3] = f("label", null, "Size", -1)),
1222
- G(f("select", {
1182
+ return (c, o) => (s(), d("div", Hn, [
1183
+ m("div", Fn, [
1184
+ o[3] || (o[3] = m("label", null, "Size", -1)),
1185
+ G(m("select", {
1223
1186
  "onUpdate:modelValue": o[0] || (o[0] = (u) => k(t).document.pageSize = u)
1224
1187
  }, [
1225
- (s(), c(C, null, P(n, (u) => f("option", {
1188
+ (s(), d(C, null, E(n, (u) => m("option", {
1226
1189
  key: u.value,
1227
1190
  value: u.value
1228
- }, w(u.label), 9, Gn)), 64))
1191
+ }, w(u.label), 9, Un)), 64))
1229
1192
  ], 512), [
1230
- [oe, k(t).document.pageSize]
1193
+ [le, k(t).document.pageSize]
1231
1194
  ])
1232
1195
  ]),
1233
- f("div", Xn, [
1234
- o[5] || (o[5] = f("label", null, "Orientation", -1)),
1235
- G(f("select", {
1196
+ m("div", Wn, [
1197
+ o[5] || (o[5] = m("label", null, "Orientation", -1)),
1198
+ G(m("select", {
1236
1199
  "onUpdate:modelValue": o[1] || (o[1] = (u) => k(t).document.pageOrientation = u)
1237
1200
  }, [...o[4] || (o[4] = [
1238
- f("option", { value: "portrait" }, "Portrait", -1),
1239
- f("option", { value: "landscape" }, "Landscape", -1)
1201
+ m("option", { value: "portrait" }, "Portrait", -1),
1202
+ m("option", { value: "landscape" }, "Landscape", -1)
1240
1203
  ])], 512), [
1241
- [oe, k(t).document.pageOrientation]
1204
+ [le, k(t).document.pageOrientation]
1242
1205
  ])
1243
1206
  ]),
1244
- f("div", Kn, [
1245
- o[6] || (o[6] = f("label", null, "Margins", -1)),
1246
- f("div", Qn, [
1247
- (s(), c(C, null, P(["L", "T", "R", "B"], (u, a) => f("input", {
1248
- key: a,
1207
+ m("div", Jn, [
1208
+ o[6] || (o[6] = m("label", null, "Margins", -1)),
1209
+ m("div", Yn, [
1210
+ (s(), d(C, null, E(["L", "T", "R", "B"], (u, p) => m("input", {
1211
+ key: p,
1249
1212
  type: "number",
1250
1213
  placeholder: u,
1251
1214
  title: u,
1252
- value: k(t).document.pageMargins[a],
1253
- onInput: (p) => i(a, Number(p.target.value))
1254
- }, null, 40, Zn)), 64))
1215
+ value: k(t).document.pageMargins[p],
1216
+ onInput: (a) => i(p, Number(a.target.value))
1217
+ }, null, 40, jn)), 64))
1255
1218
  ])
1256
1219
  ]),
1257
- f("div", eo, [
1258
- o[7] || (o[7] = f("label", null, "Font Size", -1)),
1259
- f("input", {
1220
+ m("div", qn, [
1221
+ o[7] || (o[7] = m("label", null, "Font Size", -1)),
1222
+ m("input", {
1260
1223
  type: "number",
1261
- value: k(t).document.defaultStyle.fontSize ?? 12,
1224
+ value: k(t).document.defaultStyle?.fontSize ?? 12,
1262
1225
  min: "6",
1263
1226
  max: "72",
1264
- onInput: o[2] || (o[2] = (u) => k(t).document.defaultStyle.fontSize = Number(u.target.value))
1265
- }, null, 40, to)
1227
+ onInput: o[2] || (o[2] = (u) => (k(t).document.defaultStyle ??= {}).fontSize = Number(u.target.value))
1228
+ }, null, 40, Gn)
1266
1229
  ])
1267
1230
  ]));
1268
1231
  }
1269
- }), oo = /* @__PURE__ */ S(no, [["__scopeId", "data-v-f05c1083"]]), ro = { class: "brick-canvas" }, V = 0.75, lo = /* @__PURE__ */ _({
1232
+ }), Kn = /* @__PURE__ */ x(Xn, [["__scopeId", "data-v-39a2b54f"]]), Qn = { class: "brick-canvas" }, A = 0.75, Zn = /* @__PURE__ */ _({
1270
1233
  __name: "DesignCanvas",
1271
1234
  setup(e) {
1272
- const t = Z(), n = U(), i = {
1235
+ const t = te(), n = U(), i = {
1273
1236
  A3: [841.89, 1190.55],
1274
1237
  A4: [595.28, 841.89],
1275
1238
  A5: [419.53, 595.28],
1276
1239
  LETTER: [612, 792],
1277
1240
  LEGAL: [612, 1008]
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);
1241
+ }, c = $(() => {
1242
+ const [p, a] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? a : p;
1243
+ return Math.round(r * A);
1281
1244
  }), o = $(() => {
1282
- const [a, p] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? a : p;
1283
- return Math.round(r * V);
1245
+ const [p, a] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? p : a;
1246
+ return Math.round(r * A);
1284
1247
  });
1285
- function u(a) {
1286
- (a.target === a.currentTarget || a.target.classList.contains("brick-canvas__page")) && n.deselect();
1248
+ function u(p) {
1249
+ (p.target === p.currentTarget || p.target.classList.contains("brick-canvas__page")) && n.deselect();
1287
1250
  }
1288
- return (a, p) => (s(), c("div", ro, [
1289
- B(oo),
1290
- f("div", {
1251
+ return (p, a) => (s(), d("div", Qn, [
1252
+ B(Kn),
1253
+ m("div", {
1291
1254
  class: "brick-canvas__scroll",
1292
1255
  onClick: u
1293
1256
  }, [
1294
- f("div", {
1257
+ m("div", {
1295
1258
  class: "brick-canvas__page",
1296
1259
  style: R({
1297
- width: d.value + "px",
1260
+ width: c.value + "px",
1298
1261
  minHeight: o.value + "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"
1262
+ paddingTop: k(t).document.pageMargins[1] * A + "px",
1263
+ paddingRight: k(t).document.pageMargins[2] * A + "px",
1264
+ paddingBottom: k(t).document.pageMargins[3] * A + "px",
1265
+ paddingLeft: k(t).document.pageMargins[0] * A + "px"
1303
1266
  })
1304
1267
  }, [
1305
- B(Se, { "parent-id": null }, {
1268
+ B(we, { "parent-id": null }, {
1306
1269
  default: W(() => [
1307
- (s(!0), c(C, null, P(k(t).document.content, (r, l) => (s(), M(Yn, {
1270
+ (s(!0), d(C, null, E(k(t).document.content, (r, l) => (s(), M(Vn, {
1308
1271
  key: r.id,
1309
1272
  node: r,
1310
1273
  path: [l]
@@ -1316,41 +1279,41 @@ const Hn = {
1316
1279
  ])
1317
1280
  ]));
1318
1281
  }
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__ */ _({
1282
+ }), eo = /* @__PURE__ */ x(Zn, [["__scopeId", "data-v-364329ec"]]), to = ["data-element-type"], no = { class: "brick-element-list__icon" }, oo = { class: "brick-element-list__label" }, ro = /* @__PURE__ */ _({
1320
1283
  __name: "ToolbarElementList",
1321
1284
  setup(e) {
1322
- const t = E(null);
1285
+ const t = P(null);
1323
1286
  let n = null;
1324
- const i = be(), d = De();
1325
- return se(() => {
1287
+ const i = he(), c = Ne();
1288
+ return de(() => {
1326
1289
  t.value && (n = i.initToolbar(t.value));
1327
- }), ae(() => {
1290
+ }), ue(() => {
1328
1291
  n?.destroy();
1329
- }), (o, u) => (s(), c("div", {
1292
+ }), (o, u) => (s(), d("div", {
1330
1293
  ref_key: "el",
1331
1294
  ref: t,
1332
1295
  class: "brick-element-list"
1333
1296
  }, [
1334
- (s(!0), c(C, null, P(k(d), (a) => (s(), c("div", {
1335
- key: a.type,
1297
+ (s(!0), d(C, null, E(k(c), (p) => (s(), d("div", {
1298
+ key: p.type,
1336
1299
  class: "brick-element-list__item",
1337
- "data-element-type": a.type
1300
+ "data-element-type": p.type
1338
1301
  }, [
1339
- f("span", ao, w(a.icon), 1),
1340
- f("span", co, w(a.label), 1)
1341
- ], 8, so))), 128))
1302
+ m("span", no, w(p.icon), 1),
1303
+ m("span", oo, w(p.label), 1)
1304
+ ], 8, to))), 128))
1342
1305
  ], 512));
1343
1306
  }
1344
- }), 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 = {
1307
+ }), lo = /* @__PURE__ */ x(ro, [["__scopeId", "data-v-2d0b1dbf"]]), io = { class: "brick-field" }, so = { class: "brick-field__label" }, ao = ["value"], co = ["value"], uo = ["value", "min", "max", "step"], po = ["value"], fo = ["value"], mo = ["value"], yo = {
1345
1308
  key: 5,
1346
1309
  class: "brick-field__toggle"
1347
- }, xo = ["checked"], So = {
1310
+ }, go = ["checked"], bo = {
1348
1311
  key: 6,
1349
1312
  class: "brick-field__margin"
1350
- }, Co = ["placeholder", "value", "onInput"], wo = {
1313
+ }, vo = ["placeholder", "value", "onInput"], ho = {
1351
1314
  key: 7,
1352
1315
  class: "brick-field__slider"
1353
- }, Po = ["value", "min", "max", "step"], Eo = { class: "brick-field__slider-value" }, $o = /* @__PURE__ */ _({
1316
+ }, _o = ["value", "min", "max", "step"], ko = { class: "brick-field__slider-value" }, So = /* @__PURE__ */ _({
1354
1317
  __name: "PropertyField",
1355
1318
  props: {
1356
1319
  descriptor: {},
@@ -1358,115 +1321,115 @@ const Hn = {
1358
1321
  },
1359
1322
  setup(e) {
1360
1323
  const t = e, n = Y(), i = $(() => {
1361
- const p = t.descriptor.key.split("."), r = p[0], l = p[1];
1324
+ const a = t.descriptor.key.split("."), r = a[0], l = a[1];
1362
1325
  if (r === "props")
1363
1326
  return t.node.props[l];
1364
1327
  if (r === "style")
1365
1328
  return t.node.style[l];
1366
- }), d = $(() => {
1367
- const p = i.value;
1368
- return t.descriptor.type === "textarea" && Array.isArray(p) ? p.join(`
1369
- `) : p;
1329
+ }), c = $(() => {
1330
+ const a = i.value;
1331
+ return t.descriptor.type === "textarea" && Array.isArray(a) ? a.join(`
1332
+ `) : a;
1370
1333
  });
1371
- function o(p) {
1334
+ function o(a) {
1372
1335
  const r = t.descriptor.key.split("."), l = r[0], y = r[1];
1373
- let b = p;
1374
- t.descriptor.type === "textarea" && Array.isArray(i.value) && (b = p.split(`
1375
- `)), l === "props" ? n.updateProps(t.node.id, { [y]: b }) : l === "style" && n.updateStyle(t.node.id, { [y]: b });
1336
+ let g = a;
1337
+ t.descriptor.type === "textarea" && Array.isArray(i.value) && (g = a.split(`
1338
+ `)), l === "props" ? n.updateProps(t.node.id, { [y]: g }) : l === "style" && n.updateStyle(t.node.id, { [y]: g });
1376
1339
  }
1377
- function u(p, r) {
1378
- const y = [...d.value ?? [0, 0, 0, 0]];
1379
- y[p] = r, o(y);
1340
+ function u(a, r) {
1341
+ const y = [...c.value ?? [0, 0, 0, 0]];
1342
+ y[a] = r, o(y);
1380
1343
  }
1381
- function a(p) {
1382
- const l = p.target.files?.[0];
1344
+ function p(a) {
1345
+ const l = a.target.files?.[0];
1383
1346
  if (!l) return;
1384
1347
  const y = new FileReader();
1385
1348
  y.onload = () => {
1386
1349
  o(y.result);
1387
1350
  }, y.readAsDataURL(l);
1388
1351
  }
1389
- return (p, r) => (s(), c("div", fo, [
1390
- f("label", mo, w(e.descriptor.label), 1),
1391
- e.descriptor.type === "text" ? (s(), c("input", {
1352
+ return (a, r) => (s(), d("div", io, [
1353
+ m("label", so, w(e.descriptor.label), 1),
1354
+ e.descriptor.type === "text" ? (s(), d("input", {
1392
1355
  key: 0,
1393
1356
  type: "text",
1394
1357
  class: "brick-field__input",
1395
- value: d.value,
1358
+ value: c.value,
1396
1359
  onInput: r[0] || (r[0] = (l) => o(l.target.value))
1397
- }, null, 40, yo)) : e.descriptor.type === "textarea" ? (s(), c("textarea", {
1360
+ }, null, 40, ao)) : e.descriptor.type === "textarea" ? (s(), d("textarea", {
1398
1361
  key: 1,
1399
1362
  class: "brick-field__textarea",
1400
- value: d.value,
1363
+ value: c.value,
1401
1364
  rows: "3",
1402
1365
  onInput: r[1] || (r[1] = (l) => o(l.target.value))
1403
- }, null, 40, go)) : e.descriptor.type === "number" ? (s(), c("input", {
1366
+ }, null, 40, co)) : e.descriptor.type === "number" ? (s(), d("input", {
1404
1367
  key: 2,
1405
1368
  type: "number",
1406
1369
  class: "brick-field__input",
1407
- value: d.value,
1370
+ value: c.value,
1408
1371
  min: e.descriptor.min,
1409
1372
  max: e.descriptor.max,
1410
1373
  step: e.descriptor.step,
1411
1374
  onInput: r[2] || (r[2] = (l) => o(Number(l.target.value)))
1412
- }, null, 40, bo)) : e.descriptor.type === "color" ? (s(), c("input", {
1375
+ }, null, 40, uo)) : e.descriptor.type === "color" ? (s(), d("input", {
1413
1376
  key: 3,
1414
1377
  type: "color",
1415
1378
  class: "brick-field__color",
1416
- value: d.value ?? "#000000",
1379
+ value: c.value ?? "#000000",
1417
1380
  onInput: r[3] || (r[3] = (l) => o(l.target.value))
1418
- }, null, 40, vo)) : e.descriptor.type === "select" ? (s(), c("select", {
1381
+ }, null, 40, po)) : e.descriptor.type === "select" ? (s(), d("select", {
1419
1382
  key: 4,
1420
1383
  class: "brick-field__select",
1421
- value: d.value,
1384
+ value: c.value,
1422
1385
  onChange: r[4] || (r[4] = (l) => o(l.target.value || void 0))
1423
1386
  }, [
1424
- (s(!0), c(C, null, P(e.descriptor.options, (l) => (s(), c("option", {
1387
+ (s(!0), d(C, null, E(e.descriptor.options, (l) => (s(), d("option", {
1425
1388
  key: String(l.value),
1426
1389
  value: l.value
1427
- }, w(l.label), 9, _o))), 128))
1428
- ], 40, ho)) : e.descriptor.type === "toggle" ? (s(), c("label", ko, [
1429
- f("input", {
1390
+ }, w(l.label), 9, mo))), 128))
1391
+ ], 40, fo)) : e.descriptor.type === "toggle" ? (s(), d("label", yo, [
1392
+ m("input", {
1430
1393
  type: "checkbox",
1431
- checked: d.value,
1394
+ checked: c.value,
1432
1395
  onChange: r[5] || (r[5] = (l) => o(l.target.checked))
1433
- }, null, 40, xo),
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", {
1396
+ }, null, 40, go),
1397
+ m("span", null, w(c.value ? "On" : "Off"), 1)
1398
+ ])) : e.descriptor.type === "margin" ? (s(), d("div", bo, [
1399
+ (s(), d(C, null, E(["L", "T", "R", "B"], (l, y) => m("input", {
1437
1400
  key: l,
1438
1401
  type: "number",
1439
1402
  class: "brick-field__margin-input",
1440
1403
  placeholder: l,
1441
- value: (d.value ?? [0, 0, 0, 0])[y],
1442
- onInput: (b) => u(y, Number(b.target.value))
1443
- }, null, 40, Co)), 64))
1444
- ])) : e.descriptor.type === "slider" ? (s(), c("div", wo, [
1445
- f("input", {
1404
+ value: (c.value ?? [0, 0, 0, 0])[y],
1405
+ onInput: (g) => u(y, Number(g.target.value))
1406
+ }, null, 40, vo)), 64))
1407
+ ])) : e.descriptor.type === "slider" ? (s(), d("div", ho, [
1408
+ m("input", {
1446
1409
  type: "range",
1447
- value: d.value,
1410
+ value: c.value,
1448
1411
  min: e.descriptor.min,
1449
1412
  max: e.descriptor.max,
1450
1413
  step: e.descriptor.step,
1451
1414
  onInput: r[6] || (r[6] = (l) => o(Number(l.target.value)))
1452
- }, null, 40, Po),
1453
- f("span", Eo, w(d.value), 1)
1454
- ])) : e.descriptor.type === "file" ? (s(), c("input", {
1415
+ }, null, 40, _o),
1416
+ m("span", ko, w(c.value), 1)
1417
+ ])) : e.descriptor.type === "file" ? (s(), d("input", {
1455
1418
  key: 8,
1456
1419
  type: "file",
1457
1420
  accept: "image/*",
1458
1421
  class: "brick-field__file",
1459
- onChange: a
1422
+ onChange: p
1460
1423
  }, null, 32)) : I("", !0)
1461
1424
  ]));
1462
1425
  }
1463
- }), Io = /* @__PURE__ */ S($o, [["__scopeId", "data-v-e5d6e8b6"]]), Ro = {
1426
+ }), xo = /* @__PURE__ */ x(So, [["__scopeId", "data-v-5a3bec1b"]]), Co = {
1464
1427
  key: 0,
1465
1428
  class: "brick-property-editor"
1466
- }, Do = { class: "brick-property-editor__type" }, zo = {
1429
+ }, wo = { class: "brick-property-editor__type" }, Eo = {
1467
1430
  key: 0,
1468
1431
  class: "brick-property-editor__group"
1469
- }, To = { class: "brick-property-editor__group-title" }, No = /* @__PURE__ */ _({
1432
+ }, Po = { class: "brick-property-editor__group-title" }, $o = /* @__PURE__ */ _({
1470
1433
  __name: "PropertyEditor",
1471
1434
  setup(e) {
1472
1435
  const t = U(), n = $(() => {
@@ -1475,149 +1438,149 @@ const Hn = {
1475
1438
  }), i = $(() => {
1476
1439
  if (!n.value) return {};
1477
1440
  const u = {};
1478
- for (const a of n.value.propertyFields)
1479
- u[a.section] || (u[a.section] = []), u[a.section].push(a);
1441
+ for (const p of n.value.propertyFields)
1442
+ u[p.section] || (u[p.section] = []), u[p.section].push(p);
1480
1443
  return u;
1481
- }), d = {
1444
+ }), c = {
1482
1445
  content: "Content",
1483
1446
  style: "Style",
1484
1447
  layout: "Layout",
1485
1448
  advanced: "Advanced"
1486
1449
  }, o = ["content", "style", "layout", "advanced"];
1487
- return (u, a) => k(t).selectedNode.value && n.value ? (s(), c("div", Ro, [
1488
- f("div", Do, w(n.value.icon) + " " + w(n.value.label), 1),
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, {
1450
+ return (u, p) => k(t).selectedNode.value && n.value ? (s(), d("div", Co, [
1451
+ m("div", wo, w(n.value.icon) + " " + w(n.value.label), 1),
1452
+ (s(), d(C, null, E(o, (a) => (s(), d(C, { key: a }, [
1453
+ i.value[a] ? (s(), d("div", Eo, [
1454
+ m("div", Po, w(c[a]), 1),
1455
+ (s(!0), d(C, null, E(i.value[a], (r) => (s(), M(xo, {
1493
1456
  key: r.key,
1494
1457
  descriptor: r,
1495
1458
  node: k(t).selectedNode.value
1496
1459
  }, null, 8, ["descriptor", "node"]))), 128))
1497
1460
  ])) : I("", !0)
1498
1461
  ], 64))), 64)),
1499
- (s(), M(Q(n.value.propertyEditorComponent), {
1462
+ (s(), M(Z(n.value.propertyEditorComponent), {
1500
1463
  node: k(t).selectedNode.value
1501
1464
  }, null, 8, ["node"]))
1502
1465
  ])) : I("", !0);
1503
1466
  }
1504
- }), Lo = /* @__PURE__ */ S(No, [["__scopeId", "data-v-4d129dac"]]), Mo = { class: "brick-toolbar" }, Bo = { class: "brick-toolbar__section" }, Oo = {
1467
+ }), Io = /* @__PURE__ */ x($o, [["__scopeId", "data-v-4d129dac"]]), zo = { class: "brick-toolbar" }, Ro = { class: "brick-toolbar__section" }, To = {
1505
1468
  key: 0,
1506
1469
  class: "brick-toolbar__section"
1507
- }, Vo = /* @__PURE__ */ _({
1470
+ }, No = /* @__PURE__ */ _({
1508
1471
  __name: "Toolbar",
1509
1472
  setup(e) {
1510
1473
  const t = U();
1511
- return (n, i) => (s(), c("div", Mo, [
1512
- f("div", Bo, [
1513
- i[0] || (i[0] = f("h3", { class: "brick-toolbar__title" }, "Elements", -1)),
1514
- B(po)
1474
+ return (n, i) => (s(), d("div", zo, [
1475
+ m("div", Ro, [
1476
+ i[0] || (i[0] = m("h3", { class: "brick-toolbar__title" }, "Elements", -1)),
1477
+ B(lo)
1515
1478
  ]),
1516
- k(t).selectedNode.value ? (s(), c("div", Oo, [
1517
- i[1] || (i[1] = f("h3", { class: "brick-toolbar__title" }, "Properties", -1)),
1518
- B(Lo)
1479
+ k(t).selectedNode.value ? (s(), d("div", To, [
1480
+ i[1] || (i[1] = m("h3", { class: "brick-toolbar__title" }, "Properties", -1)),
1481
+ B(Io)
1519
1482
  ])) : I("", !0)
1520
1483
  ]));
1521
1484
  }
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__ */ _({
1485
+ }), Do = /* @__PURE__ */ x(No, [["__scopeId", "data-v-0174c069"]]), Lo = { class: "brick-actionbar" }, Mo = { class: "brick-actionbar__group" }, Bo = { class: "brick-actionbar__group" }, Oo = ["disabled"], Ao = ["disabled"], Vo = ["disabled"], Ho = { class: "brick-actionbar__group" }, Fo = /* @__PURE__ */ _({
1523
1486
  __name: "ActionBar",
1524
1487
  setup(e) {
1525
- const t = bt(), n = St(), i = U(), d = Y(), o = Z(), u = E("document"), a = E(null);
1526
- function p() {
1527
- const m = i.selectedId.value;
1528
- m && (i.deselect(), d.removeElement(m));
1488
+ const t = ht(), n = wt(), i = U(), c = Y(), o = te(), u = P("document"), p = P(null);
1489
+ function a() {
1490
+ const f = i.selectedId.value;
1491
+ f && (i.deselect(), c.removeElement(f));
1529
1492
  }
1530
1493
  function r() {
1531
- const m = u.value.trim() || "document", g = m.endsWith(".pdf") ? m : m + ".pdf";
1532
- n.exportPdf(g);
1494
+ const f = u.value.trim() || "document", b = f.endsWith(".pdf") ? f : f + ".pdf";
1495
+ n.exportPdf(b);
1533
1496
  }
1534
1497
  function l() {
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";
1536
- x.href = h, x.download = D.endsWith(".json") ? D : D + ".json", x.click(), URL.revokeObjectURL(h);
1498
+ const f = o.exportDocument(), b = JSON.stringify(f, null, 2), v = new Blob([b], { type: "application/json" }), h = URL.createObjectURL(v), S = document.createElement("a"), z = u.value.trim() || "document";
1499
+ S.href = h, S.download = z.endsWith(".json") ? z : z + ".json", S.click(), URL.revokeObjectURL(h);
1537
1500
  }
1538
1501
  function y() {
1539
- a.value?.click();
1502
+ p.value?.click();
1540
1503
  }
1541
- function b(m) {
1542
- const g = m.target, v = g.files?.[0];
1504
+ function g(f) {
1505
+ const b = f.target, v = b.files?.[0];
1543
1506
  if (!v) return;
1544
1507
  const h = new FileReader();
1545
1508
  h.onload = () => {
1546
1509
  try {
1547
- const x = JSON.parse(h.result);
1548
- if (!x.content || !x.pageSize) {
1510
+ const S = JSON.parse(h.result);
1511
+ if (!S.content || !S.pageSize) {
1549
1512
  alert("Invalid brick-pdf JSON file.");
1550
1513
  return;
1551
1514
  }
1552
- i.deselect(), o.loadDocument(x);
1515
+ i.deselect(), o.loadDocument(S);
1553
1516
  } catch {
1554
1517
  alert("Failed to parse JSON file.");
1555
1518
  }
1556
- }, h.readAsText(v), g.value = "";
1519
+ }, h.readAsText(v), b.value = "";
1557
1520
  }
1558
- return (m, g) => (s(), c("div", Ho, [
1559
- f("div", Fo, [
1560
- G(f("input", {
1561
- "onUpdate:modelValue": g[0] || (g[0] = (v) => u.value = v),
1521
+ return (f, b) => (s(), d("div", Lo, [
1522
+ m("div", Mo, [
1523
+ G(m("input", {
1524
+ "onUpdate:modelValue": b[0] || (b[0] = (v) => u.value = v),
1562
1525
  class: "brick-actionbar__name",
1563
1526
  type: "text",
1564
1527
  placeholder: "Document name",
1565
1528
  title: "Document name (used for export filename)"
1566
1529
  }, null, 512), [
1567
- [$e, u.value]
1530
+ [ze, u.value]
1568
1531
  ])
1569
1532
  ]),
1570
- f("div", Uo, [
1571
- f("button", {
1533
+ m("div", Bo, [
1534
+ m("button", {
1572
1535
  class: "brick-actionbar__btn",
1573
1536
  disabled: !k(t).canUndo.value,
1574
1537
  title: "Undo",
1575
- onClick: g[1] || (g[1] = (v) => k(t).undo())
1576
- }, " Undo ", 8, Wo),
1577
- f("button", {
1538
+ onClick: b[1] || (b[1] = (v) => k(t).undo())
1539
+ }, " Undo ", 8, Oo),
1540
+ m("button", {
1578
1541
  class: "brick-actionbar__btn",
1579
1542
  disabled: !k(t).canRedo.value,
1580
1543
  title: "Redo",
1581
- onClick: g[2] || (g[2] = (v) => k(t).redo())
1582
- }, " Redo ", 8, Jo),
1583
- f("button", {
1544
+ onClick: b[2] || (b[2] = (v) => k(t).redo())
1545
+ }, " Redo ", 8, Ao),
1546
+ m("button", {
1584
1547
  class: "brick-actionbar__btn brick-actionbar__btn--danger",
1585
1548
  disabled: !k(i).selectedId.value,
1586
1549
  title: "Delete selected element",
1587
- onClick: p
1588
- }, " Delete ", 8, Yo)
1550
+ onClick: a
1551
+ }, " Delete ", 8, Vo)
1589
1552
  ]),
1590
- f("div", qo, [
1591
- f("button", {
1553
+ m("div", Ho, [
1554
+ m("button", {
1592
1555
  class: "brick-actionbar__btn",
1593
1556
  title: "Import JSON",
1594
1557
  onClick: y
1595
1558
  }, " Import JSON "),
1596
- f("button", {
1559
+ m("button", {
1597
1560
  class: "brick-actionbar__btn",
1598
1561
  title: "Export JSON",
1599
1562
  onClick: l
1600
1563
  }, " Export JSON "),
1601
- f("button", {
1564
+ m("button", {
1602
1565
  class: "brick-actionbar__btn brick-actionbar__btn--primary",
1603
1566
  onClick: r
1604
1567
  }, " Export PDF "),
1605
- f("button", {
1568
+ m("button", {
1606
1569
  class: "brick-actionbar__btn",
1607
- onClick: g[3] || (g[3] = (v) => k(n).openPdf())
1570
+ onClick: b[3] || (b[3] = (v) => k(n).openPdf())
1608
1571
  }, " Preview ")
1609
1572
  ]),
1610
- f("input", {
1573
+ m("input", {
1611
1574
  ref_key: "fileInput",
1612
- ref: a,
1575
+ ref: p,
1613
1576
  type: "file",
1614
1577
  accept: ".json",
1615
1578
  style: { display: "none" },
1616
- onChange: b
1579
+ onChange: g
1617
1580
  }, null, 544)
1618
1581
  ]));
1619
1582
  }
1620
- }), Go = /* @__PURE__ */ S(jo, [["__scopeId", "data-v-be915a0f"]]), Xo = { class: "brick-pdf" }, Ko = { class: "brick-pdf__workspace" }, Qo = /* @__PURE__ */ _({
1583
+ }), Uo = /* @__PURE__ */ x(Fo, [["__scopeId", "data-v-be915a0f"]]), Wo = { class: "brick-pdf" }, Jo = { class: "brick-pdf__workspace" }, Yo = /* @__PURE__ */ _({
1621
1584
  __name: "BrickPdf",
1622
1585
  props: {
1623
1586
  modelValue: {}
@@ -1625,69 +1588,69 @@ const Hn = {
1625
1588
  emits: ["update:modelValue"],
1626
1589
  setup(e, { emit: t }) {
1627
1590
  const n = e, i = t;
1628
- An();
1629
- const d = st(n.modelValue ?? ce());
1630
- at(d);
1631
- const o = ct(d);
1632
- dt(o);
1633
- const u = yt(d);
1634
- gt(u);
1635
- const a = pt(d, u);
1636
- ft(a);
1637
- const p = vt(d, a);
1638
- ht(p);
1639
- const r = kt(d);
1640
- xt(r);
1641
- const l = Pt(d, a);
1642
- Et(l);
1643
- const y = $t(a);
1644
- It(y);
1645
- const b = Re(), m = b.Delete, g = b.Backspace;
1646
- return re(m, () => {
1591
+ Dn();
1592
+ const c = ct(n.modelValue ?? ee());
1593
+ dt(c);
1594
+ const o = ut(c);
1595
+ pt(o);
1596
+ const u = bt(c);
1597
+ vt(u);
1598
+ const p = mt(c, u);
1599
+ yt(p);
1600
+ const a = _t(c, p);
1601
+ kt(a);
1602
+ const r = xt(c);
1603
+ Ct(r);
1604
+ const l = $t(c, p);
1605
+ It(l);
1606
+ const y = zt(p);
1607
+ Rt(y);
1608
+ const g = Te(), f = g.Delete, b = g.Backspace;
1609
+ return ie(f, () => {
1647
1610
  if (!o.selectedId.value) return;
1648
1611
  const v = document.activeElement;
1649
1612
  if (v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.tagName === "SELECT")) return;
1650
1613
  const h = o.selectedId.value;
1651
- o.deselect(), a.removeElement(h);
1652
- }), re(g, () => {
1614
+ o.deselect(), p.removeElement(h);
1615
+ }), ie(b, () => {
1653
1616
  if (!o.selectedId.value) return;
1654
1617
  const v = document.activeElement;
1655
1618
  if (v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.tagName === "SELECT")) return;
1656
1619
  const h = o.selectedId.value;
1657
- o.deselect(), a.removeElement(h);
1658
- }), Ie(
1659
- () => d.document,
1620
+ o.deselect(), p.removeElement(h);
1621
+ }), Re(
1622
+ () => c.document,
1660
1623
  () => {
1661
- i("update:modelValue", JSON.parse(JSON.stringify(H(d.document))));
1624
+ i("update:modelValue", JSON.parse(JSON.stringify(H(c.document))));
1662
1625
  },
1663
1626
  { deep: !0 }
1664
- ), (v, h) => (s(), c("div", Xo, [
1665
- B(Go),
1666
- f("div", Ko, [
1667
- B(io),
1668
- B(Ao)
1627
+ ), (v, h) => (s(), d("div", Wo, [
1628
+ B(Uo),
1629
+ m("div", Jo, [
1630
+ B(eo),
1631
+ B(Do)
1669
1632
  ])
1670
1633
  ]));
1671
1634
  }
1672
- }), Zo = /* @__PURE__ */ S(Qo, [["__scopeId", "data-v-f9b95ad8"]]), ir = {
1635
+ }), jo = /* @__PURE__ */ x(Yo, [["__scopeId", "data-v-f9b95ad8"]]), er = {
1673
1636
  install(e) {
1674
- e.component("BrickPdf", Zo);
1637
+ e.component("BrickPdf", jo);
1675
1638
  }
1676
1639
  };
1677
1640
  export {
1678
- Zo as BrickPdf,
1679
- ce as createDefaultDocument,
1680
- ir as default,
1681
- De as getAllElementDefinitions,
1641
+ jo as BrickPdf,
1642
+ ee as createDefaultDocument,
1643
+ er as default,
1644
+ Ne as getAllElementDefinitions,
1682
1645
  F as getElementDefinition,
1683
- z as registerElement,
1684
- or as unregisterElement,
1685
- rr as useClipboard,
1686
- Z as useDocumentStore,
1687
- be as useDragDrop,
1646
+ T as registerElement,
1647
+ Ko as unregisterElement,
1648
+ Qo as useClipboard,
1649
+ te as useDocumentStore,
1650
+ he as useDragDrop,
1688
1651
  Y as useElementActions,
1689
- bt as useHistory,
1690
- St as usePdfExport,
1691
- lr as useResize,
1652
+ ht as useHistory,
1653
+ wt as usePdfExport,
1654
+ Zo as useResize,
1692
1655
  U as useSelection
1693
1656
  };