brick-pdf 0.4.1 → 0.4.2

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