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