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