brick-pdf 0.4.1 → 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 +1155 -853
- 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 te() {
|
|
|
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) => (a(),
|
|
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) => (a(),
|
|
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 Ve = /* @__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) => (a(),
|
|
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) => (a(),
|
|
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) => (a(),
|
|
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) => (a(),
|
|
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 st() {
|
|
|
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
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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),
|
|
288
|
+
y("tbody", null, [
|
|
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 de(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
|
|
316
|
+
function Ot(e) {
|
|
317
|
+
const t = e ? Pe(e) : be();
|
|
318
|
+
for (const s of t.content) ye(s);
|
|
284
319
|
const n = ze(t);
|
|
285
|
-
function i(
|
|
286
|
-
const
|
|
287
|
-
for (let
|
|
288
|
-
const
|
|
289
|
-
if (
|
|
290
|
-
if (
|
|
291
|
-
return { node:
|
|
292
|
-
if (
|
|
293
|
-
const
|
|
294
|
-
if (
|
|
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 s
|
|
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
|
|
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
346
|
function p() {
|
|
312
|
-
return JSON.parse(JSON.stringify(
|
|
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 =
|
|
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 = E(null), n =
|
|
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 =
|
|
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
|
-
}, b =
|
|
405
|
+
}, b = o ? e.findNodeById(o)?.node.children : e.document.content;
|
|
371
406
|
if (!b) return null;
|
|
372
|
-
const
|
|
373
|
-
return b.splice(
|
|
407
|
+
const k = r ?? b.length;
|
|
408
|
+
return b.splice(k, 0, v), v;
|
|
374
409
|
}
|
|
375
|
-
function i(
|
|
376
|
-
const
|
|
377
|
-
|
|
410
|
+
function i(l) {
|
|
411
|
+
const o = e.findNodeById(l);
|
|
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 b =
|
|
386
|
-
b && b.splice(
|
|
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
|
|
389
|
-
const
|
|
390
|
-
if (!
|
|
423
|
+
function d(l) {
|
|
424
|
+
const o = e.findNodeById(l);
|
|
425
|
+
if (!o) return null;
|
|
391
426
|
t.record();
|
|
392
|
-
const
|
|
393
|
-
return
|
|
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 p(
|
|
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 =
|
|
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
|
|
453
|
+
const He = /* @__PURE__ */ Symbol("brick-pdf-history"), Wt = 50;
|
|
454
|
+
function jt(e) {
|
|
420
455
|
const t = E([]), n = E([]);
|
|
421
456
|
let i = 0;
|
|
422
|
-
const
|
|
423
|
-
function
|
|
424
|
-
const
|
|
425
|
-
if (
|
|
426
|
-
i =
|
|
427
|
-
const
|
|
428
|
-
t.value.push(
|
|
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;
|
|
462
|
+
const o = e.snapshotContent();
|
|
463
|
+
t.value.push(o), t.value.length > Wt && t.value.shift(), n.value = [];
|
|
429
464
|
}
|
|
430
465
|
function p() {
|
|
431
|
-
const
|
|
432
|
-
|
|
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 =
|
|
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
|
|
484
|
+
const Fe = /* @__PURE__ */ Symbol("brick-pdf-drag-drop");
|
|
485
|
+
function Kt(e, t) {
|
|
451
486
|
const n = E(!1);
|
|
452
|
-
function i(
|
|
453
|
-
return
|
|
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 xt(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,
|
|
@@ -474,302 +509,300 @@ function xt(e, t) {
|
|
|
474
509
|
n.value = !0;
|
|
475
510
|
},
|
|
476
511
|
onAdd(p) {
|
|
477
|
-
const
|
|
478
|
-
if (!
|
|
479
|
-
const
|
|
480
|
-
if (!
|
|
481
|
-
const b =
|
|
482
|
-
return !!(b?.acceptsChildTypes && !b.acceptsChildTypes.includes(
|
|
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
|
-
|
|
527
|
+
o && (s.parentNode?.removeChild(s), !r(o) && t.addElement(o, m, p.newIndex));
|
|
490
528
|
},
|
|
491
529
|
onEnd(p) {
|
|
492
|
-
|
|
493
|
-
const d = y ? e.findNodeById(y)?.node.children : e.document.content;
|
|
494
|
-
if (!d) return;
|
|
495
|
-
const r = d.splice(p.oldIndex, 1)[0];
|
|
496
|
-
r && d.splice(p.newIndex, 0, r);
|
|
497
|
-
}
|
|
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 =
|
|
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 p.addVirtualFileSystem({ ...
|
|
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
|
-
...
|
|
622
|
+
...l.fonts
|
|
590
623
|
}), p;
|
|
591
624
|
}
|
|
592
|
-
function i(
|
|
593
|
-
const
|
|
625
|
+
function i(d) {
|
|
626
|
+
const m = t();
|
|
594
627
|
n().then((p) => {
|
|
595
|
-
p.createPdf(
|
|
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 =
|
|
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 = E(null), i = E(!1),
|
|
631
|
-
function
|
|
632
|
-
const
|
|
633
|
-
|
|
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 p(
|
|
636
|
-
const
|
|
637
|
-
|
|
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
|
|
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 =
|
|
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
|
|
689
|
+
const Ye = /* @__PURE__ */ Symbol("brick-pdf-resize");
|
|
690
|
+
function cn(e) {
|
|
658
691
|
const t = E(!1);
|
|
659
|
-
function n(i,
|
|
692
|
+
function n(i, f, d, m) {
|
|
660
693
|
t.value = !0;
|
|
661
|
-
const p =
|
|
662
|
-
function
|
|
663
|
-
const b =
|
|
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 =
|
|
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 o
|
|
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
|
|
705
|
-
|
|
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 p(
|
|
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
|
|
714
|
-
n.updateProps(t.node.id, { body:
|
|
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 b = [...
|
|
719
|
-
return b.splice(
|
|
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 (
|
|
726
|
-
|
|
727
|
-
|
|
758
|
+
return (o, r) => (a(), u("div", dn, [
|
|
759
|
+
y("div", { class: "brick-table-editor__actions" }, [
|
|
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
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
(a(!0),
|
|
742
|
-
key:
|
|
769
|
+
y("div", pn, [
|
|
770
|
+
y("table", null, [
|
|
771
|
+
y("thead", null, [
|
|
772
|
+
y("tr", null, [
|
|
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 ? (a(),
|
|
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: (b) =>
|
|
751
|
-
}, "x", 8,
|
|
783
|
+
onClick: (b) => l(v)
|
|
784
|
+
}, "x", 8, fn)) : R("", !0)
|
|
752
785
|
]))), 128))
|
|
753
786
|
])
|
|
754
787
|
]),
|
|
755
|
-
|
|
756
|
-
(a(!0),
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
i().length > 1 ? (a(),
|
|
788
|
+
y("tbody", null, [
|
|
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: (b) => p(
|
|
764
|
-
}, "x", 8,
|
|
796
|
+
onClick: (b) => p(v)
|
|
797
|
+
}, "x", 8, mn)) : R("", !0)
|
|
765
798
|
]),
|
|
766
|
-
(a(!0),
|
|
767
|
-
|
|
799
|
+
(a(!0), u(P, null, T(c, (b, k) => (a(), u("td", { key: k }, [
|
|
800
|
+
y("input", {
|
|
768
801
|
class: "brick-table-editor__cell",
|
|
769
802
|
type: "text",
|
|
770
803
|
value: b,
|
|
771
|
-
onInput: (
|
|
772
|
-
}, null, 40,
|
|
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 Ot = { class: "brick-table-editor" }, At = { 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 Ot = { class: "brick-table-editor" }, At = { 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) => (a(),
|
|
826
|
-
e.node.props.src ? (a(),
|
|
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) => (a(),
|
|
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 Gt = { class: "brick-el-image" }, Xt = ["src"], Qt = {
|
|
|
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) => (a(),
|
|
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
|
-
(a(),
|
|
890
|
-
default:
|
|
891
|
-
(a(!0),
|
|
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) => (a(),
|
|
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) => (a(),
|
|
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
|
-
|
|
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) => (a(),
|
|
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 gn = { class: "brick-el-qr__preview" }, bn = /* @__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) => (a(),
|
|
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) => (a(),
|
|
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,613 +1072,867 @@ const wn = ["innerHTML"], Pn = /* @__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) => (a(),
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1092
|
+
return (t, n) => (a(), u("div", io, [...n[0] || (n[0] = [
|
|
1093
|
+
y("hr", null, null, -1),
|
|
1094
|
+
y("span", null, "Page Break", -1),
|
|
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) => (a(),
|
|
1072
|
-
|
|
1104
|
+
return (t, n) => (a(), u("div", co, [...n[0] || (n[0] = [
|
|
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
|
-
}, Hn = /* @__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
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
|
-
y.$slots.default ? $("", !0) : (a(), c("div", Fn, " 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);
|
|
1183
|
+
}
|
|
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);
|
|
1130
1220
|
}
|
|
1131
|
-
function
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
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
|
|
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 a(),
|
|
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
|
-
}),
|
|
1184
|
-
onClick: r
|
|
1273
|
+
style: L(ie.value),
|
|
1274
|
+
onClick: Ke,
|
|
1275
|
+
onMouseover: fe(c, ["stop"])
|
|
1185
1276
|
}, [
|
|
1186
|
-
|
|
1277
|
+
s.value ? (a(), H(ve(s.value.rendererComponent), {
|
|
1187
1278
|
key: 0,
|
|
1188
1279
|
node: e.node,
|
|
1189
1280
|
path: e.path
|
|
1190
1281
|
}, {
|
|
1191
|
-
default:
|
|
1192
|
-
|
|
1282
|
+
default: se(() => [
|
|
1283
|
+
s.value.isContainer ? (a(), H(qe, {
|
|
1193
1284
|
key: 0,
|
|
1194
1285
|
"parent-id": e.node.id,
|
|
1195
|
-
layout: e.node.type === "columns" ? "horizontal" : "vertical"
|
|
1286
|
+
layout: e.node.type === "columns" ? "horizontal" : "vertical",
|
|
1287
|
+
empty: e.node.children.length === 0
|
|
1196
1288
|
}, {
|
|
1197
|
-
default:
|
|
1198
|
-
(a(!0),
|
|
1199
|
-
key:
|
|
1200
|
-
node:
|
|
1201
|
-
path: [...e.path,
|
|
1202
|
-
|
|
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))
|
|
1203
1296
|
]),
|
|
1204
1297
|
_: 1
|
|
1205
|
-
}, 8, ["parent-id", "layout"])) :
|
|
1298
|
+
}, 8, ["parent-id", "layout", "empty"])) : R("", !0)
|
|
1206
1299
|
]),
|
|
1207
1300
|
_: 1
|
|
1208
|
-
}, 8, ["node", "path"])) : (a(),
|
|
1209
|
-
|
|
1210
|
-
|
|
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", {
|
|
1211
1329
|
key: 0,
|
|
1212
1330
|
class: "brick-resize-handle brick-resize-handle--e",
|
|
1213
|
-
onPointerdown:
|
|
1214
|
-
}, null, 32)) :
|
|
1215
|
-
|
|
1331
|
+
onPointerdown: Xe
|
|
1332
|
+
}, null, 32)) : R("", !0),
|
|
1333
|
+
he.value ? (a(), u("div", {
|
|
1216
1334
|
key: 1,
|
|
1217
1335
|
class: "brick-resize-handle brick-resize-handle--s",
|
|
1218
|
-
onPointerdown:
|
|
1219
|
-
}, null, 32)) :
|
|
1220
|
-
|
|
1336
|
+
onPointerdown: Ge
|
|
1337
|
+
}, null, 32)) : R("", !0),
|
|
1338
|
+
Z.value && he.value ? (a(), u("div", {
|
|
1221
1339
|
key: 2,
|
|
1222
1340
|
class: "brick-resize-handle brick-resize-handle--se",
|
|
1223
|
-
onPointerdown:
|
|
1224
|
-
}, null, 32)) :
|
|
1225
|
-
], 64)) :
|
|
1226
|
-
],
|
|
1341
|
+
onPointerdown: Qe
|
|
1342
|
+
}, null, 32)) : R("", !0)
|
|
1343
|
+
], 64)) : R("", !0)
|
|
1344
|
+
], 46, mo);
|
|
1227
1345
|
};
|
|
1228
1346
|
}
|
|
1229
|
-
}),
|
|
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({
|
|
1230
1355
|
__name: "DocumentSettings",
|
|
1231
1356
|
setup(e) {
|
|
1232
|
-
const t =
|
|
1357
|
+
const t = G(), n = B(le, null), i = [0.5, 0.75, 1, 1.25, 1.5, 2], f = [
|
|
1233
1358
|
{ label: "A3", value: "A3" },
|
|
1234
1359
|
{ label: "A4", value: "A4" },
|
|
1235
1360
|
{ label: "A5", value: "A5" },
|
|
1236
1361
|
{ label: "Letter", value: "LETTER" },
|
|
1237
1362
|
{ label: "Legal", value: "LEGAL" }
|
|
1238
1363
|
];
|
|
1239
|
-
function
|
|
1240
|
-
|
|
1241
|
-
|
|
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;
|
|
1242
1370
|
}
|
|
1243
|
-
return (
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
"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)
|
|
1248
1376
|
}, [
|
|
1249
|
-
(a(),
|
|
1250
|
-
key:
|
|
1251
|
-
value:
|
|
1252
|
-
}, 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))
|
|
1253
1381
|
], 512), [
|
|
1254
|
-
[
|
|
1382
|
+
[Se, g(t).document.pageSize]
|
|
1255
1383
|
])
|
|
1256
1384
|
]),
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
"onUpdate:modelValue":
|
|
1261
|
-
}, [...
|
|
1262
|
-
|
|
1263
|
-
|
|
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] = [
|
|
1390
|
+
y("option", { value: "portrait" }, "Portrait", -1),
|
|
1391
|
+
y("option", { value: "landscape" }, "Landscape", -1)
|
|
1264
1392
|
])], 512), [
|
|
1265
|
-
[
|
|
1393
|
+
[Se, g(t).document.pageOrientation]
|
|
1266
1394
|
])
|
|
1267
1395
|
]),
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
(a(),
|
|
1272
|
-
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,
|
|
1273
1401
|
type: "number",
|
|
1274
|
-
placeholder:
|
|
1275
|
-
title:
|
|
1276
|
-
value:
|
|
1277
|
-
onInput: (
|
|
1278
|
-
}, 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))
|
|
1279
1407
|
])
|
|
1280
1408
|
]),
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1409
|
+
y("div", Eo, [
|
|
1410
|
+
s[9] || (s[9] = y("label", null, "Font Size", -1)),
|
|
1411
|
+
y("input", {
|
|
1284
1412
|
type: "number",
|
|
1285
|
-
value:
|
|
1413
|
+
value: g(t).document.defaultStyle?.fontSize ?? 12,
|
|
1286
1414
|
min: "6",
|
|
1287
1415
|
max: "72",
|
|
1288
|
-
onInput:
|
|
1289
|
-
}, null, 40,
|
|
1290
|
-
])
|
|
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)
|
|
1291
1441
|
]));
|
|
1292
1442
|
}
|
|
1293
|
-
}),
|
|
1443
|
+
}), Lo = /* @__PURE__ */ $(Ro, [["__scopeId", "data-v-6def1a4b"]]), Do = { class: "brick-canvas" }, Ne = 96 / 72, Bo = 24, Mo = /* @__PURE__ */ S({
|
|
1294
1444
|
__name: "DesignCanvas",
|
|
1295
1445
|
setup(e) {
|
|
1296
|
-
const t =
|
|
1446
|
+
const t = G(), n = Q(), i = B(le, null), f = {
|
|
1297
1447
|
A3: [841.89, 1190.55],
|
|
1298
1448
|
A4: [595.28, 841.89],
|
|
1299
1449
|
A5: [419.53, 595.28],
|
|
1300
1450
|
LETTER: [612, 792],
|
|
1301
1451
|
LEGAL: [612, 1008]
|
|
1302
|
-
},
|
|
1303
|
-
const [
|
|
1304
|
-
return
|
|
1305
|
-
}),
|
|
1306
|
-
const
|
|
1307
|
-
|
|
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);
|
|
1460
|
+
});
|
|
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
|
+
};
|
|
1308
1476
|
});
|
|
1309
|
-
function
|
|
1310
|
-
(
|
|
1477
|
+
function o(r) {
|
|
1478
|
+
(r.target === r.currentTarget || r.target.classList.contains("brick-canvas__page")) && n.deselect();
|
|
1311
1479
|
}
|
|
1312
|
-
return (
|
|
1313
|
-
|
|
1314
|
-
|
|
1480
|
+
return (r, c) => (a(), u("div", Do, [
|
|
1481
|
+
j(Lo),
|
|
1482
|
+
y("div", {
|
|
1483
|
+
ref_key: "scrollEl",
|
|
1484
|
+
ref: m,
|
|
1315
1485
|
class: "brick-canvas__scroll",
|
|
1316
|
-
onClick:
|
|
1486
|
+
onClick: o,
|
|
1487
|
+
onMouseover: c[0] || (c[0] = (v) => g(i) && (g(i).hoveredId.value = null))
|
|
1317
1488
|
}, [
|
|
1318
|
-
|
|
1489
|
+
y("div", {
|
|
1319
1490
|
class: "brick-canvas__page",
|
|
1320
|
-
style:
|
|
1321
|
-
width: s.value + "px",
|
|
1322
|
-
minHeight: o.value + "px",
|
|
1323
|
-
paddingTop: k(t).document.pageMargins[1] * V + "px",
|
|
1324
|
-
paddingRight: k(t).document.pageMargins[2] * V + "px",
|
|
1325
|
-
paddingBottom: k(t).document.pageMargins[3] * V + "px",
|
|
1326
|
-
paddingLeft: k(t).document.pageMargins[0] * V + "px"
|
|
1327
|
-
})
|
|
1491
|
+
style: L(l.value)
|
|
1328
1492
|
}, [
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
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]
|
|
1335
1502
|
}, null, 8, ["node", "path"]))), 128))
|
|
1336
1503
|
]),
|
|
1337
1504
|
_: 1
|
|
1338
|
-
})
|
|
1505
|
+
}, 8, ["empty"])
|
|
1339
1506
|
], 4)
|
|
1340
|
-
])
|
|
1507
|
+
], 544)
|
|
1341
1508
|
]));
|
|
1342
1509
|
}
|
|
1343
|
-
}),
|
|
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({
|
|
1344
1511
|
__name: "ToolbarElementList",
|
|
1345
1512
|
setup(e) {
|
|
1346
1513
|
const t = E(null);
|
|
1347
1514
|
let n = null;
|
|
1348
|
-
const i =
|
|
1349
|
-
return
|
|
1515
|
+
const i = ge(), f = st();
|
|
1516
|
+
return Te(() => {
|
|
1350
1517
|
t.value && (n = i.initToolbar(t.value));
|
|
1351
|
-
}),
|
|
1518
|
+
}), Re(() => {
|
|
1352
1519
|
n?.destroy();
|
|
1353
|
-
}), (
|
|
1520
|
+
}), (d, m) => (a(), u("div", {
|
|
1354
1521
|
ref_key: "el",
|
|
1355
1522
|
ref: t,
|
|
1356
1523
|
class: "brick-element-list"
|
|
1357
1524
|
}, [
|
|
1358
|
-
(a(!0),
|
|
1525
|
+
(a(!0), u(P, null, T(g(f), (p) => (a(), u("div", {
|
|
1359
1526
|
key: p.type,
|
|
1360
1527
|
class: "brick-element-list__item",
|
|
1361
1528
|
"data-element-type": p.type
|
|
1362
1529
|
}, [
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
], 8,
|
|
1530
|
+
y("span", Vo, w(p.icon), 1),
|
|
1531
|
+
y("span", Ho, w(p.label), 1)
|
|
1532
|
+
], 8, Ao))), 128))
|
|
1366
1533
|
], 512));
|
|
1367
1534
|
}
|
|
1368
|
-
}),
|
|
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 = {
|
|
1369
1536
|
key: 5,
|
|
1370
1537
|
class: "brick-field__toggle"
|
|
1371
|
-
},
|
|
1538
|
+
}, Zo = ["checked"], er = {
|
|
1372
1539
|
key: 6,
|
|
1373
1540
|
class: "brick-field__margin"
|
|
1374
|
-
},
|
|
1541
|
+
}, tr = ["placeholder", "value", "onInput"], nr = {
|
|
1375
1542
|
key: 7,
|
|
1376
1543
|
class: "brick-field__slider"
|
|
1377
|
-
},
|
|
1544
|
+
}, or = ["value", "min", "max", "step"], rr = { class: "brick-field__slider-value" }, lr = ["accept"], ir = /* @__PURE__ */ S({
|
|
1378
1545
|
__name: "PropertyField",
|
|
1379
1546
|
props: {
|
|
1380
1547
|
descriptor: {},
|
|
1381
1548
|
node: {}
|
|
1382
1549
|
},
|
|
1383
1550
|
setup(e) {
|
|
1384
|
-
const t = e, n =
|
|
1385
|
-
const
|
|
1386
|
-
if (
|
|
1387
|
-
return t.node.props[
|
|
1388
|
-
if (
|
|
1389
|
-
return t.node.style[
|
|
1390
|
-
}),
|
|
1391
|
-
const
|
|
1392
|
-
return t.descriptor.type === "textarea" && Array.isArray(
|
|
1393
|
-
`) :
|
|
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;
|
|
1394
1561
|
});
|
|
1395
|
-
function
|
|
1396
|
-
const
|
|
1397
|
-
let
|
|
1398
|
-
t.descriptor.type === "textarea" && Array.isArray(i.value) && (
|
|
1399
|
-
`)),
|
|
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 });
|
|
1567
|
+
}
|
|
1568
|
+
function m(l) {
|
|
1569
|
+
const o = l.target.value;
|
|
1570
|
+
o.trim() === "" || Number.isNaN(Number(o)) || d(Number(o));
|
|
1400
1571
|
}
|
|
1401
|
-
function
|
|
1402
|
-
const
|
|
1403
|
-
|
|
1572
|
+
function p(l, o) {
|
|
1573
|
+
const c = [...f.value ?? [0, 0, 0, 0]];
|
|
1574
|
+
c[l] = o, d(c);
|
|
1404
1575
|
}
|
|
1405
|
-
function
|
|
1406
|
-
const
|
|
1407
|
-
if (!
|
|
1408
|
-
const
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
},
|
|
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);
|
|
1412
1583
|
}
|
|
1413
|
-
return (
|
|
1414
|
-
|
|
1415
|
-
e.descriptor.type === "text" ? (a(),
|
|
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", {
|
|
1416
1587
|
key: 0,
|
|
1417
1588
|
type: "text",
|
|
1418
1589
|
class: "brick-field__input",
|
|
1419
|
-
value:
|
|
1420
|
-
onInput:
|
|
1421
|
-
}, 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", {
|
|
1422
1593
|
key: 1,
|
|
1423
1594
|
class: "brick-field__textarea",
|
|
1424
|
-
value:
|
|
1595
|
+
value: f.value,
|
|
1425
1596
|
rows: "3",
|
|
1426
|
-
onInput:
|
|
1427
|
-
}, null, 40,
|
|
1597
|
+
onInput: o[1] || (o[1] = (r) => d(r.target.value))
|
|
1598
|
+
}, null, 40, Yo)) : e.descriptor.type === "number" ? (a(), u("input", {
|
|
1428
1599
|
key: 2,
|
|
1429
1600
|
type: "number",
|
|
1430
1601
|
class: "brick-field__input",
|
|
1431
|
-
value:
|
|
1602
|
+
value: f.value,
|
|
1432
1603
|
min: e.descriptor.min,
|
|
1433
1604
|
max: e.descriptor.max,
|
|
1434
1605
|
step: e.descriptor.step,
|
|
1435
|
-
onInput:
|
|
1436
|
-
}, null, 40,
|
|
1606
|
+
onInput: m
|
|
1607
|
+
}, null, 40, qo)) : e.descriptor.type === "color" ? (a(), u("input", {
|
|
1437
1608
|
key: 3,
|
|
1438
1609
|
type: "color",
|
|
1439
1610
|
class: "brick-field__color",
|
|
1440
|
-
value:
|
|
1441
|
-
onInput:
|
|
1442
|
-
}, 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", {
|
|
1443
1614
|
key: 4,
|
|
1444
1615
|
class: "brick-field__select",
|
|
1445
|
-
value:
|
|
1446
|
-
onChange:
|
|
1616
|
+
value: f.value,
|
|
1617
|
+
onChange: o[3] || (o[3] = (r) => d(r.target.value || void 0))
|
|
1447
1618
|
}, [
|
|
1448
|
-
(a(!0),
|
|
1449
|
-
key: String(
|
|
1450
|
-
value:
|
|
1451
|
-
}, w(
|
|
1452
|
-
], 40,
|
|
1453
|
-
|
|
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, [
|
|
1624
|
+
y("input", {
|
|
1454
1625
|
type: "checkbox",
|
|
1455
|
-
checked:
|
|
1456
|
-
onChange:
|
|
1457
|
-
}, null, 40,
|
|
1458
|
-
|
|
1459
|
-
])) : e.descriptor.type === "margin" ? (a(),
|
|
1460
|
-
(a(),
|
|
1461
|
-
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,
|
|
1462
1633
|
type: "number",
|
|
1463
1634
|
class: "brick-field__margin-input",
|
|
1464
|
-
placeholder:
|
|
1465
|
-
value: (
|
|
1466
|
-
onInput: (
|
|
1467
|
-
}, null, 40,
|
|
1468
|
-
])) : e.descriptor.type === "slider" ? (a(),
|
|
1469
|
-
|
|
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, [
|
|
1640
|
+
y("input", {
|
|
1470
1641
|
type: "range",
|
|
1471
|
-
value:
|
|
1642
|
+
value: f.value,
|
|
1472
1643
|
min: e.descriptor.min,
|
|
1473
1644
|
max: e.descriptor.max,
|
|
1474
1645
|
step: e.descriptor.step,
|
|
1475
|
-
onInput:
|
|
1476
|
-
}, null, 40,
|
|
1477
|
-
|
|
1478
|
-
])) : e.descriptor.type === "file" ? (a(),
|
|
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", {
|
|
1479
1650
|
key: 8,
|
|
1480
1651
|
type: "file",
|
|
1481
|
-
accept: "image/*",
|
|
1652
|
+
accept: e.descriptor.accept ?? "image/*",
|
|
1482
1653
|
class: "brick-field__file",
|
|
1483
|
-
onChange:
|
|
1484
|
-
}, null,
|
|
1654
|
+
onChange: s
|
|
1655
|
+
}, null, 40, lr)) : R("", !0)
|
|
1485
1656
|
]));
|
|
1486
1657
|
}
|
|
1487
|
-
}),
|
|
1658
|
+
}), sr = /* @__PURE__ */ $(ir, [["__scopeId", "data-v-e439d522"]]), ar = {
|
|
1488
1659
|
key: 0,
|
|
1489
1660
|
class: "brick-property-editor"
|
|
1490
|
-
},
|
|
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 = {
|
|
1491
1666
|
key: 0,
|
|
1492
1667
|
class: "brick-property-editor__group"
|
|
1493
|
-
},
|
|
1668
|
+
}, mr = { class: "brick-property-editor__group-title" }, vr = /* @__PURE__ */ S({
|
|
1494
1669
|
__name: "PropertyEditor",
|
|
1495
1670
|
setup(e) {
|
|
1496
|
-
const t =
|
|
1497
|
-
|
|
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) {
|
|
1498
1676
|
const r = t.selectedNode.value;
|
|
1499
|
-
r && n.updateKey(r.id,
|
|
1677
|
+
r && n.updateKey(r.id, o.target.value);
|
|
1500
1678
|
}
|
|
1501
|
-
const
|
|
1502
|
-
const
|
|
1503
|
-
return
|
|
1504
|
-
}),
|
|
1505
|
-
if (!
|
|
1506
|
-
const
|
|
1507
|
-
for (const r of
|
|
1508
|
-
|
|
1509
|
-
return
|
|
1510
|
-
}),
|
|
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 = {
|
|
1511
1689
|
content: "Content",
|
|
1512
1690
|
style: "Style",
|
|
1513
1691
|
layout: "Layout",
|
|
1514
1692
|
advanced: "Advanced"
|
|
1515
|
-
},
|
|
1516
|
-
return (
|
|
1517
|
-
|
|
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)),
|
|
1710
|
+
y("input", {
|
|
1521
1711
|
type: "text",
|
|
1522
1712
|
class: "brick-property-editor__key-input",
|
|
1523
|
-
value:
|
|
1713
|
+
value: g(t).selectedNode.value.key ?? "",
|
|
1524
1714
|
placeholder: "(optional identifier)",
|
|
1525
|
-
onInput:
|
|
1526
|
-
}, null, 40,
|
|
1715
|
+
onInput: d
|
|
1716
|
+
}, null, 40, fr)
|
|
1527
1717
|
]),
|
|
1528
|
-
(a(),
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
(a(!0),
|
|
1532
|
-
key:
|
|
1533
|
-
descriptor:
|
|
1534
|
-
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
|
|
1535
1725
|
}, null, 8, ["descriptor", "node"]))), 128))
|
|
1536
|
-
])) :
|
|
1726
|
+
])) : R("", !0)
|
|
1537
1727
|
], 64))), 64)),
|
|
1538
|
-
(a(),
|
|
1539
|
-
node:
|
|
1728
|
+
(a(), H(ve(m.value.propertyEditorComponent), {
|
|
1729
|
+
node: g(t).selectedNode.value
|
|
1540
1730
|
}, null, 8, ["node"]))
|
|
1541
|
-
])) :
|
|
1731
|
+
])) : R("", !0);
|
|
1732
|
+
}
|
|
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
|
+
};
|
|
1542
1792
|
}
|
|
1543
|
-
}),
|
|
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 = {
|
|
1544
1800
|
key: 0,
|
|
1545
1801
|
class: "brick-toolbar__section"
|
|
1546
|
-
},
|
|
1802
|
+
}, Lr = /* @__PURE__ */ S({
|
|
1547
1803
|
__name: "Toolbar",
|
|
1548
1804
|
setup(e) {
|
|
1549
|
-
const t =
|
|
1550
|
-
return (
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
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
|
+
])
|
|
1554
1841
|
]),
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
])) :
|
|
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)
|
|
1559
1846
|
]));
|
|
1560
1847
|
}
|
|
1561
|
-
}),
|
|
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({
|
|
1562
1849
|
__name: "ActionBar",
|
|
1563
1850
|
setup(e) {
|
|
1564
|
-
const t =
|
|
1565
|
-
function
|
|
1566
|
-
const
|
|
1567
|
-
|
|
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));
|
|
1568
1855
|
}
|
|
1569
|
-
function
|
|
1570
|
-
const
|
|
1856
|
+
function l() {
|
|
1857
|
+
const v = m.value.trim() || "document", b = v.endsWith(".pdf") ? v : v + ".pdf";
|
|
1571
1858
|
n.exportPdf(b);
|
|
1572
1859
|
}
|
|
1573
|
-
function
|
|
1574
|
-
const
|
|
1575
|
-
|
|
1860
|
+
function o() {
|
|
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);
|
|
1576
1863
|
}
|
|
1577
|
-
function
|
|
1864
|
+
function r() {
|
|
1578
1865
|
p.value?.click();
|
|
1579
1866
|
}
|
|
1580
|
-
function
|
|
1581
|
-
const b =
|
|
1582
|
-
if (!
|
|
1583
|
-
const
|
|
1584
|
-
|
|
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 = () => {
|
|
1585
1872
|
try {
|
|
1586
|
-
const
|
|
1587
|
-
if (!
|
|
1873
|
+
const _ = JSON.parse(C.result);
|
|
1874
|
+
if (!_.content || !_.pageSize) {
|
|
1588
1875
|
alert("Invalid brick-pdf JSON file.");
|
|
1589
1876
|
return;
|
|
1590
1877
|
}
|
|
1591
|
-
i.deselect(),
|
|
1878
|
+
i.deselect(), d.loadDocument(_);
|
|
1592
1879
|
} catch {
|
|
1593
1880
|
alert("Failed to parse JSON file.");
|
|
1594
1881
|
}
|
|
1595
|
-
},
|
|
1882
|
+
}, C.readAsText(k), b.value = "";
|
|
1596
1883
|
}
|
|
1597
|
-
return (
|
|
1598
|
-
|
|
1599
|
-
|
|
1884
|
+
return (v, b) => (a(), u("div", Br, [
|
|
1885
|
+
y("div", Mr, [
|
|
1886
|
+
y("button", {
|
|
1600
1887
|
class: "brick-actionbar__btn",
|
|
1601
|
-
disabled: !
|
|
1888
|
+
disabled: !g(t).canUndo.value,
|
|
1602
1889
|
title: "Undo",
|
|
1603
|
-
onClick: b[0] || (b[0] = (
|
|
1604
|
-
}, " Undo ", 8,
|
|
1605
|
-
|
|
1890
|
+
onClick: b[0] || (b[0] = (k) => g(t).undo())
|
|
1891
|
+
}, " Undo ", 8, Or),
|
|
1892
|
+
y("button", {
|
|
1606
1893
|
class: "brick-actionbar__btn",
|
|
1607
|
-
disabled: !
|
|
1894
|
+
disabled: !g(t).canRedo.value,
|
|
1608
1895
|
title: "Redo",
|
|
1609
|
-
onClick: b[1] || (b[1] = (
|
|
1610
|
-
}, " Redo ", 8,
|
|
1611
|
-
|
|
1896
|
+
onClick: b[1] || (b[1] = (k) => g(t).redo())
|
|
1897
|
+
}, " Redo ", 8, Ar),
|
|
1898
|
+
y("button", {
|
|
1612
1899
|
class: "brick-actionbar__btn brick-actionbar__btn--danger",
|
|
1613
|
-
disabled: !
|
|
1900
|
+
disabled: !g(i).selectedId.value,
|
|
1614
1901
|
title: "Delete selected element",
|
|
1615
|
-
onClick:
|
|
1616
|
-
}, " Delete ", 8,
|
|
1902
|
+
onClick: s
|
|
1903
|
+
}, " Delete ", 8, Vr)
|
|
1617
1904
|
]),
|
|
1618
|
-
|
|
1619
|
-
|
|
1905
|
+
y("div", Hr, [
|
|
1906
|
+
y("button", {
|
|
1620
1907
|
class: "brick-actionbar__btn",
|
|
1621
1908
|
title: "Import JSON",
|
|
1622
|
-
onClick:
|
|
1909
|
+
onClick: r
|
|
1623
1910
|
}, " Import JSON "),
|
|
1624
|
-
|
|
1911
|
+
y("button", {
|
|
1625
1912
|
class: "brick-actionbar__btn",
|
|
1626
1913
|
title: "Export JSON",
|
|
1627
|
-
onClick:
|
|
1914
|
+
onClick: o
|
|
1628
1915
|
}, " Export JSON "),
|
|
1629
|
-
|
|
1916
|
+
y("button", {
|
|
1630
1917
|
class: "brick-actionbar__btn brick-actionbar__btn--primary",
|
|
1631
|
-
onClick:
|
|
1918
|
+
onClick: l
|
|
1632
1919
|
}, " Export PDF "),
|
|
1633
|
-
|
|
1920
|
+
y("button", {
|
|
1634
1921
|
class: "brick-actionbar__btn",
|
|
1635
|
-
onClick: b[2] || (b[2] = (
|
|
1922
|
+
onClick: b[2] || (b[2] = (k) => g(n).openPdf())
|
|
1636
1923
|
}, " Preview ")
|
|
1637
1924
|
]),
|
|
1638
|
-
|
|
1925
|
+
y("input", {
|
|
1639
1926
|
ref_key: "fileInput",
|
|
1640
1927
|
ref: p,
|
|
1641
1928
|
type: "file",
|
|
1642
1929
|
accept: ".json",
|
|
1643
1930
|
style: { display: "none" },
|
|
1644
|
-
onChange:
|
|
1931
|
+
onChange: c
|
|
1645
1932
|
}, null, 544)
|
|
1646
1933
|
]));
|
|
1647
1934
|
}
|
|
1648
|
-
}),
|
|
1935
|
+
}), Ur = /* @__PURE__ */ $(Fr, [["__scopeId", "data-v-586445a9"]]), Jr = { class: "brick-pdf__workspace" }, Wr = /* @__PURE__ */ S({
|
|
1649
1936
|
__name: "BrickPdf",
|
|
1650
1937
|
props: {
|
|
1651
1938
|
modelValue: {}
|
|
@@ -1653,69 +1940,84 @@ const Fn = {
|
|
|
1653
1940
|
emits: ["update:modelValue"],
|
|
1654
1941
|
setup(e, { emit: t }) {
|
|
1655
1942
|
const n = e, i = t;
|
|
1656
|
-
|
|
1657
|
-
const
|
|
1658
|
-
|
|
1659
|
-
const
|
|
1660
|
-
|
|
1661
|
-
const
|
|
1662
|
-
|
|
1663
|
-
const p =
|
|
1664
|
-
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1667
|
-
const
|
|
1668
|
-
|
|
1669
|
-
const
|
|
1670
|
-
|
|
1671
|
-
const
|
|
1672
|
-
|
|
1673
|
-
const
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
const
|
|
1677
|
-
if (
|
|
1678
|
-
const
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
(
|
|
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,
|
|
1688
1985
|
() => {
|
|
1689
|
-
i("update:modelValue", JSON.parse(JSON.stringify(
|
|
1986
|
+
i("update:modelValue", JSON.parse(JSON.stringify(oe(f.document))));
|
|
1690
1987
|
},
|
|
1691
1988
|
{ deep: !0 }
|
|
1692
|
-
), (
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
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)
|
|
1697
1999
|
])
|
|
1698
|
-
]));
|
|
2000
|
+
], 32));
|
|
1699
2001
|
}
|
|
1700
|
-
}),
|
|
2002
|
+
}), jr = /* @__PURE__ */ $(Wr, [["__scopeId", "data-v-51e3c556"]]), Zr = {
|
|
1701
2003
|
install(e) {
|
|
1702
|
-
e.component("BrickPdf",
|
|
2004
|
+
e.component("BrickPdf", jr);
|
|
1703
2005
|
}
|
|
1704
2006
|
};
|
|
1705
2007
|
export {
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
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
|
|
1721
2023
|
};
|