brick-pdf 0.2.2 → 0.3.1

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