@printstack/print-studio 0.1.2 → 0.1.3
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/README.md +8 -2
- package/assets/{render.worker-DkH7TepL.js → render.worker-Dl59Xk1a.js} +11 -11
- package/components/button-group/ButtonGroup.d.ts +1 -1
- package/core/index.d.ts +1 -0
- package/core.js +10 -10
- package/designer/facade/entities.d.ts +4 -4
- package/designer/facade/use-print-studio.d.ts +1 -1
- package/designer/stores/editor-store.d.ts +2 -2
- package/designer/stores/selection-store.d.ts +1 -1
- package/designer.js +1 -1
- package/elements/index.d.ts +2 -4
- package/{registries-sg39PGF1.js → elements-YX-XUHtf.js} +2480 -3026
- package/host-oKlYakgn.js +123 -0
- package/index.d.ts +3 -1
- package/index.js +9 -8
- package/{mount-print-designer-DnHTrBE9.js → mount-print-designer-CAqO0T0k.js} +3 -3
- package/{mount-print-preview-Bcb08lJ-.js → mount-print-preview-DgDHL3E8.js} +2 -2
- package/package.json +19 -2
- package/parser/index.d.ts +1 -1
- package/parser/registry.d.ts +8 -0
- package/parser/render-runtime.d.ts +1 -1
- package/{presets-BunYODhE.js → presets-DmCp_Doe.js} +1 -1
- package/printer.d.ts +17 -0
- package/printer.js +3 -0
- package/registries-CyjYSHA7.js +1841 -0
- package/runtime/print-renderer.d.ts +3 -2
- package/runtime/registries.d.ts +1 -0
- package/runtime.js +31 -27
- package/{studio-B3B6zI06.js → studio-DHusmJyL.js} +1035 -1032
- package/studio.d.ts +1 -1
- package/style.css +1 -1
- package/vue.d.ts +1 -1
- package/vue.js +3158 -3158
- package/document-model-Cc5RoO4j.js +0 -1283
- package/host-OAp3gFDx.js +0 -123
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { n as e } from "./rolldown-runtime-QGRDbDUS.js";
|
|
2
|
-
import {
|
|
3
|
-
import { A as
|
|
4
|
-
import { $ as D,
|
|
5
|
-
import { createPinia as
|
|
6
|
-
import { computed as U, hasInjectionContext as
|
|
2
|
+
import { _ as t, c as n, d as r, f as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, s as f, t as p, v as m } from "./registries-CyjYSHA7.js";
|
|
3
|
+
import { A as h, B as g, N as _, P as v, R as y, t as b } from "./cloneDeep-waBDTGc3.js";
|
|
4
|
+
import { $ as x, At as S, B as C, Bt as w, Ct as T, Et as E, Ft as D, It as O, Lt as k, M as A, Mt as j, Nt as M, Pt as N, Rt as P, St as ee, Ut as te, V as ne, Vt as re, Wt as ie, Yt as F, _n as ae, _t as I, bt as L, cn as R, ct as oe, dn as se, dt as z, en as ce, fn as le, ft as ue, gn as de, gt as fe, hn as pe, ht as me, in as B, j as he, jt as ge, ln as _e, lt as ve, mn as ye, mt as V, nn as be, ot as xe, pn as Se, pt as Ce, rn as we, rt as Te, t as Ee, tn as De, un as Oe, ut as ke, vn as Ae, vt as je, wt as Me, xt as Ne, yt as Pe } from "./elements-YX-XUHtf.js";
|
|
5
|
+
import { createPinia as Fe, defineStore as H, disposePinia as Ie, getActivePinia as Le, setActivePinia as Re } from "pinia";
|
|
6
|
+
import { computed as U, hasInjectionContext as ze, markRaw as Be, onScopeDispose as Ve, reactive as He, ref as W, shallowReactive as Ue, shallowRef as We, toRefs as G, watch as K } from "vue";
|
|
7
7
|
// node_modules/.pnpm/mitt@3.0.1/node_modules/mitt/dist/mitt.mjs
|
|
8
|
-
function
|
|
8
|
+
function Ge(e) {
|
|
9
9
|
return {
|
|
10
10
|
all: e ||= /* @__PURE__ */ new Map(),
|
|
11
11
|
on: function(t, n) {
|
|
@@ -27,8 +27,8 @@ function We(e) {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
// src/core/events.ts
|
|
30
|
-
var
|
|
31
|
-
emitter =
|
|
30
|
+
var Ke = class {
|
|
31
|
+
emitter = Ge();
|
|
32
32
|
wildcard = /* @__PURE__ */ new Set();
|
|
33
33
|
emit(e, t) {
|
|
34
34
|
this.emitter.emit(e, t);
|
|
@@ -53,17 +53,17 @@ var Ge = class {
|
|
|
53
53
|
});
|
|
54
54
|
return n;
|
|
55
55
|
}
|
|
56
|
-
},
|
|
57
|
-
function
|
|
58
|
-
return
|
|
56
|
+
}, qe = null;
|
|
57
|
+
function Je() {
|
|
58
|
+
return qe ||= new Ke(), qe;
|
|
59
59
|
}
|
|
60
60
|
// src/designer/commands/command-registry.ts
|
|
61
|
-
var
|
|
61
|
+
var Ye = class {
|
|
62
62
|
bus;
|
|
63
63
|
commands = /* @__PURE__ */ new Map();
|
|
64
64
|
getContext;
|
|
65
|
-
version =
|
|
66
|
-
constructor(e, t =
|
|
65
|
+
version = We(0);
|
|
66
|
+
constructor(e, t = Je()) {
|
|
67
67
|
this.getContext = e, this.bus = t;
|
|
68
68
|
}
|
|
69
69
|
byGroup(e) {
|
|
@@ -94,7 +94,7 @@ var Je = class {
|
|
|
94
94
|
invoke(e, ...t) {
|
|
95
95
|
let n = this.commands.get(e)?.definition;
|
|
96
96
|
try {
|
|
97
|
-
if (!n) throw this.bus.emit("command:unknown", { id: e }), Error(
|
|
97
|
+
if (!n) throw this.bus.emit("command:unknown", { id: e }), Error(g("designer.commandRegistry.unregisteredCommand", { commandId: e }));
|
|
98
98
|
this.bus.emit("command:before", {
|
|
99
99
|
args: t,
|
|
100
100
|
id: e
|
|
@@ -173,7 +173,7 @@ var Je = class {
|
|
|
173
173
|
trackVersion() {
|
|
174
174
|
return this.version.value;
|
|
175
175
|
}
|
|
176
|
-
},
|
|
176
|
+
}, Xe = /* @__PURE__ */ e({ installDomainCommands: () => Ze });
|
|
177
177
|
function q(e, t, n, r = {}) {
|
|
178
178
|
return {
|
|
179
179
|
...r,
|
|
@@ -184,18 +184,18 @@ function q(e, t, n, r = {}) {
|
|
|
184
184
|
}
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
let n = () =>
|
|
189
|
-
q("preview.print", () =>
|
|
187
|
+
function Ze(e, t = !1) {
|
|
188
|
+
let n = () => g("designer.builtins.pageSettingsTitle"), r = () => g("designer.builtins.renameTitle"), i = () => g("designer.builtins.groupTitle"), o = () => g("designer.pagesPanel.templatesSection"), s = () => g("designer.types.data"), c = () => g("designer.types.edit"), l = [
|
|
189
|
+
q("preview.print", () => g("designer.builtins.printTitle"), () => (e) => {
|
|
190
190
|
e.focus(), e.print();
|
|
191
191
|
}),
|
|
192
|
-
q("file.new",
|
|
193
|
-
q("document.load",
|
|
194
|
-
q("document.loadJson",
|
|
195
|
-
q("document.rename",
|
|
196
|
-
q("document.save",
|
|
197
|
-
q("history.commit",
|
|
198
|
-
q("output.json",
|
|
192
|
+
q("file.new", c, (e) => e.document.create),
|
|
193
|
+
q("document.load", c, (e) => e.document.load),
|
|
194
|
+
q("document.loadJson", c, (e) => e.document.loadJson),
|
|
195
|
+
q("document.rename", c, (e) => e.document.rename),
|
|
196
|
+
q("document.save", c, (e) => e.document.save),
|
|
197
|
+
q("history.commit", c, (e) => e.history.commit),
|
|
198
|
+
q("output.json", c, (e) => () => JSON.stringify(e.document.getDocument(), null, 2)),
|
|
199
199
|
q("page.create", n, (e) => e.page.add),
|
|
200
200
|
q("page.update", n, (e) => e.page.update),
|
|
201
201
|
q("page.activate", n, (e) => (t) => {
|
|
@@ -204,35 +204,35 @@ function Xe(e, t = !1) {
|
|
|
204
204
|
q("page.copy", n, (e) => e.page.copy),
|
|
205
205
|
q("page.remove", n, (e) => e.page.remove),
|
|
206
206
|
q("scope.updatePage", n, (e) => e.scope.updatePage),
|
|
207
|
-
q("continuation.editLayout",
|
|
208
|
-
q("template.create",
|
|
209
|
-
q("template.createFromPage",
|
|
210
|
-
q("template.import",
|
|
211
|
-
q("template.update",
|
|
207
|
+
q("continuation.editLayout", o, (e) => e.navigation.enterTemplate),
|
|
208
|
+
q("template.create", o, (e) => e.template.create),
|
|
209
|
+
q("template.createFromPage", o, (e) => e.template.createFromPage),
|
|
210
|
+
q("template.import", o, (e) => e.template.import),
|
|
211
|
+
q("template.update", o, (e) => e.template.update),
|
|
212
212
|
q("template.updatePage", n, (e) => e.template.updatePage),
|
|
213
|
-
q("template.rename",
|
|
214
|
-
q("template.remove", () =>
|
|
213
|
+
q("template.rename", o, (e) => e.template.rename),
|
|
214
|
+
q("template.remove", () => g("designer.pagesPanel.removeTemplateTitle"), (e) => e.template.remove, {
|
|
215
215
|
danger: !0,
|
|
216
216
|
icon: "trash"
|
|
217
217
|
}),
|
|
218
|
-
q("template.enterEdit", () =>
|
|
219
|
-
q("template.exitEdit",
|
|
220
|
-
q("template.detach",
|
|
221
|
-
q("template.apply",
|
|
222
|
-
q("template.applyRange", () =>
|
|
218
|
+
q("template.enterEdit", () => g("designer.pagesPanel.editTemplateTitle"), (e) => e.navigation.enterTemplate, { icon: "rename" }),
|
|
219
|
+
q("template.exitEdit", o, (e) => e.navigation.returnFromTemplate),
|
|
220
|
+
q("template.detach", o, (e) => e.template.detach),
|
|
221
|
+
q("template.apply", o, (e) => e.template.applyToPages),
|
|
222
|
+
q("template.applyRange", () => g("designer.pagesPanel.applyRangeTitle"), (e) => (t) => {
|
|
223
223
|
e.ui.openDialog("apply-template", void 0, void 0, void 0, { applyTemplateTemplateId: t });
|
|
224
224
|
}, { icon: "apply-template" }),
|
|
225
|
-
q("dataSource.upsert",
|
|
226
|
-
q("dataSource.remove",
|
|
227
|
-
q("followBlock.create",
|
|
228
|
-
q("followBlock.update",
|
|
229
|
-
q("followBlock.addMembers",
|
|
230
|
-
q("followBlock.removeMembers",
|
|
231
|
-
q("followBlock.remove",
|
|
232
|
-
q("repeatGroup.create",
|
|
233
|
-
q("repeatGroup.applyToSelection",
|
|
234
|
-
q("repeatGroup.update",
|
|
235
|
-
q("repeatGroup.remove",
|
|
225
|
+
q("dataSource.upsert", s, (e) => e.dataSource.upsert),
|
|
226
|
+
q("dataSource.remove", s, (e) => e.dataSource.remove),
|
|
227
|
+
q("followBlock.create", s, (e) => e.followBlock.create),
|
|
228
|
+
q("followBlock.update", s, (e) => e.followBlock.update),
|
|
229
|
+
q("followBlock.addMembers", s, (e) => e.followBlock.addMembers),
|
|
230
|
+
q("followBlock.removeMembers", s, (e) => e.followBlock.removeMembers),
|
|
231
|
+
q("followBlock.remove", s, (e) => e.followBlock.remove),
|
|
232
|
+
q("repeatGroup.create", s, (e) => e.repeatGroup.create),
|
|
233
|
+
q("repeatGroup.applyToSelection", s, (e) => e.repeatGroup.applyToSelection),
|
|
234
|
+
q("repeatGroup.update", s, (e) => e.repeatGroup.update),
|
|
235
|
+
q("repeatGroup.remove", s, (e) => e.repeatGroup.remove),
|
|
236
236
|
q("guide.create", n, (e) => e.guide.add),
|
|
237
237
|
q("guide.move", n, (e) => e.guide.move),
|
|
238
238
|
q("element.add", r, (e) => e.element.add),
|
|
@@ -262,42 +262,42 @@ function Xe(e, t = !1) {
|
|
|
262
262
|
q("element.toggleVisibility", r, (e) => (t = e.selection.primary?.id) => {
|
|
263
263
|
t && e.element.toggleFlag(t, "visible");
|
|
264
264
|
}),
|
|
265
|
-
q("edit.copy",
|
|
266
|
-
q("edit.cut",
|
|
267
|
-
q("edit.paste",
|
|
268
|
-
q("edit.delete",
|
|
269
|
-
q("edit.duplicate",
|
|
270
|
-
q("edit.selectAll",
|
|
271
|
-
q("edit.undo",
|
|
272
|
-
q("edit.redo",
|
|
273
|
-
q("selection.set",
|
|
274
|
-
q("selection.clear",
|
|
265
|
+
q("edit.copy", c, (e) => e.clipboard.copy),
|
|
266
|
+
q("edit.cut", c, (e) => e.clipboard.cut),
|
|
267
|
+
q("edit.paste", c, (e) => e.clipboard.paste),
|
|
268
|
+
q("edit.delete", c, (e) => e.element.removeSelected),
|
|
269
|
+
q("edit.duplicate", c, (e) => () => e.element.duplicate([...e.selection.ids])),
|
|
270
|
+
q("edit.selectAll", c, (e) => e.selection.all),
|
|
271
|
+
q("edit.undo", c, (e) => e.history.undo),
|
|
272
|
+
q("edit.redo", c, (e) => e.history.redo),
|
|
273
|
+
q("selection.set", c, (e) => e.selection.set),
|
|
274
|
+
q("selection.clear", c, (e) => e.selection.clear),
|
|
275
275
|
q("canvas.setBackground", n, (e) => e.view.setCanvasBackground),
|
|
276
|
-
q("output.html",
|
|
277
|
-
q("output.pdf",
|
|
278
|
-
...["preview", "print"].map((t) => q(`output.${t}`,
|
|
276
|
+
q("output.html", s, (e) => (t, n, r) => e.rendering.html(e.document.data, t ?? v(e.document.data), n, r)),
|
|
277
|
+
q("output.pdf", s, (e) => (t, n, r) => e.rendering.pdf(e.document.data, t ?? v(e.document.data), n, r)),
|
|
278
|
+
...["preview", "print"].map((t) => q(`output.${t}`, s, (n) => async (r, i) => {
|
|
279
279
|
if (t === "preview" && i?.mode === "designer") {
|
|
280
280
|
let t = {
|
|
281
281
|
document: n.document.getDocument(),
|
|
282
|
-
input:
|
|
283
|
-
}, { mountPrintPreview: a } = await import("./mount-print-preview-
|
|
282
|
+
input: b(r ?? v(n.document.data))
|
|
283
|
+
}, { mountPrintPreview: a } = await import("./mount-print-preview-DgDHL3E8.js");
|
|
284
284
|
return a(e, t, i);
|
|
285
285
|
}
|
|
286
|
-
return
|
|
286
|
+
return a(n.rendering, e.output, () => {
|
|
287
287
|
e.store();
|
|
288
|
-
})[t](n.document.data, r ??
|
|
288
|
+
})[t](n.document.data, r ?? v(n.document.data), i);
|
|
289
289
|
}))
|
|
290
290
|
];
|
|
291
|
-
return e.commands.registerScoped(t ?
|
|
291
|
+
return e.commands.registerScoped(t ? l.filter((t) => !e.commands.has(t.id)) : l);
|
|
292
292
|
}
|
|
293
293
|
// src/designer/events/store-event-bindings.ts
|
|
294
|
-
function
|
|
294
|
+
function Qe(e, t) {
|
|
295
295
|
return e.subscribe(() => {
|
|
296
296
|
t.emit("elements:changed", {});
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
|
-
function
|
|
300
|
-
let n =
|
|
299
|
+
function $e(e, t = Je()) {
|
|
300
|
+
let n = nt(e, t), r = et(e, t), i = {
|
|
301
301
|
canvas: e.canvas,
|
|
302
302
|
clipboard: e.clipboard,
|
|
303
303
|
config: e.config,
|
|
@@ -324,15 +324,15 @@ function Qe(e, t = qe()) {
|
|
|
324
324
|
zIndex: e.zIndex
|
|
325
325
|
}, a = {
|
|
326
326
|
canvas: {},
|
|
327
|
-
clipboard:
|
|
327
|
+
clipboard: rt(e, t),
|
|
328
328
|
config: {},
|
|
329
|
-
dataSource:
|
|
330
|
-
document:
|
|
331
|
-
element:
|
|
332
|
-
elementGroup:
|
|
333
|
-
followBlock:
|
|
334
|
-
guide:
|
|
335
|
-
history:
|
|
329
|
+
dataSource: ct(t),
|
|
330
|
+
document: lt(t),
|
|
331
|
+
element: it(e, t, r),
|
|
332
|
+
elementGroup: dt(t),
|
|
333
|
+
followBlock: pt(e, t, r),
|
|
334
|
+
guide: at(t),
|
|
335
|
+
history: ot(e, t),
|
|
336
336
|
layout: { apply: () => (n) => {
|
|
337
337
|
for (let { id: r, patch: i } of n) t.emit("element:updated", {
|
|
338
338
|
node: e.element.get(r) ?? null,
|
|
@@ -341,24 +341,24 @@ function Qe(e, t = qe()) {
|
|
|
341
341
|
});
|
|
342
342
|
} },
|
|
343
343
|
navigation: {},
|
|
344
|
-
page:
|
|
344
|
+
page: st(e, t, r),
|
|
345
345
|
panel: {},
|
|
346
|
-
plugin:
|
|
346
|
+
plugin: ut(t),
|
|
347
347
|
rendering: {},
|
|
348
|
-
repeatGroup:
|
|
348
|
+
repeatGroup: ft(t, r),
|
|
349
349
|
scope: {},
|
|
350
350
|
selection: {},
|
|
351
|
-
template:
|
|
351
|
+
template: mt(t),
|
|
352
352
|
tutorial: {},
|
|
353
|
-
ui:
|
|
353
|
+
ui: ht(e, t),
|
|
354
354
|
view: {},
|
|
355
355
|
zIndex: {}
|
|
356
|
-
}, o = Object.entries(i).map(([e, n]) =>
|
|
356
|
+
}, o = Object.entries(i).map(([e, n]) => tt(e, n, a[e], t));
|
|
357
357
|
return () => {
|
|
358
358
|
for (let e of [...n, ...o]) e();
|
|
359
359
|
};
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function et(e, t) {
|
|
362
362
|
let n = /* @__PURE__ */ new WeakSet(), r = /* @__PURE__ */ new WeakSet();
|
|
363
363
|
return (i = !1) => {
|
|
364
364
|
let a = [...e.repeatGroup.list], o = [...e.followBlock.list];
|
|
@@ -371,7 +371,7 @@ function $e(e, t) {
|
|
|
371
371
|
};
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function tt(e, t, n, r) {
|
|
375
375
|
return t.$onAction(({ after: t, args: i, name: a, onError: o }) => {
|
|
376
376
|
let s = (Object.hasOwn(n, a) ? n[a] : void 0)?.(...i), c = `${e}.${a}`;
|
|
377
377
|
o((e) => {
|
|
@@ -390,7 +390,7 @@ function et(e, t, n, r) {
|
|
|
390
390
|
});
|
|
391
391
|
}, !0);
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
function nt(e, t) {
|
|
394
394
|
return [
|
|
395
395
|
K(() => [
|
|
396
396
|
e.page.active?.id,
|
|
@@ -434,7 +434,7 @@ function tt(e, t) {
|
|
|
434
434
|
}, { deep: !0 })
|
|
435
435
|
];
|
|
436
436
|
}
|
|
437
|
-
function
|
|
437
|
+
function rt(e, t) {
|
|
438
438
|
return {
|
|
439
439
|
copy() {
|
|
440
440
|
let n = [...e.selection.nodes];
|
|
@@ -447,7 +447,7 @@ function nt(e, t) {
|
|
|
447
447
|
paste: () => () => t.emit("clipboard:pasted", { nodes: e.selection.nodes })
|
|
448
448
|
};
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function it(e, t, n) {
|
|
451
451
|
function r(n, r, i) {
|
|
452
452
|
return () => t.emit("element:updated", {
|
|
453
453
|
node: e.element.get(n) ?? null,
|
|
@@ -522,7 +522,7 @@ function rt(e, t, n) {
|
|
|
522
522
|
updateProps: r
|
|
523
523
|
};
|
|
524
524
|
}
|
|
525
|
-
function
|
|
525
|
+
function at(e) {
|
|
526
526
|
return {
|
|
527
527
|
add: (t) => (n) => {
|
|
528
528
|
n && e.emit("guide:added", {
|
|
@@ -542,7 +542,7 @@ function it(e) {
|
|
|
542
542
|
})
|
|
543
543
|
};
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function ot(e, t) {
|
|
546
546
|
function n() {
|
|
547
547
|
return () => t.emit("history:changed", {
|
|
548
548
|
canRedo: e.history.canRedo,
|
|
@@ -558,7 +558,7 @@ function at(e, t) {
|
|
|
558
558
|
undo: n
|
|
559
559
|
};
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function st(e, t, n) {
|
|
562
562
|
return {
|
|
563
563
|
add: () => () => t.emit("page:added", { pageId: e.page.activeId }),
|
|
564
564
|
copy: (n) => () => t.emit("page:copied", {
|
|
@@ -583,20 +583,20 @@ function ot(e, t, n) {
|
|
|
583
583
|
})
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function ct(e) {
|
|
587
587
|
return {
|
|
588
588
|
remove: (t) => () => e.emit("datasource:removed", { key: t }),
|
|
589
589
|
upsert: (t) => () => e.emit("datasource:upserted", { source: t })
|
|
590
590
|
};
|
|
591
591
|
}
|
|
592
|
-
function
|
|
592
|
+
function lt(e) {
|
|
593
593
|
return {
|
|
594
594
|
create: () => () => e.emit("document:new", {}),
|
|
595
595
|
loadJson: () => () => e.emit("document:loaded", {}),
|
|
596
596
|
rename: (t) => () => e.emit("document:renamed", { name: t })
|
|
597
597
|
};
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function ut(e) {
|
|
600
600
|
return {
|
|
601
601
|
add: (t) => () => e.emit("plugin:registered", { name: t }),
|
|
602
602
|
remove: (t) => () => e.emit("plugin:disposed", { name: t }),
|
|
@@ -606,7 +606,7 @@ function lt(e) {
|
|
|
606
606
|
})
|
|
607
607
|
};
|
|
608
608
|
}
|
|
609
|
-
function
|
|
609
|
+
function dt(e) {
|
|
610
610
|
return {
|
|
611
611
|
create: () => (t) => {
|
|
612
612
|
t && e.emit("element-group:created", { group: t });
|
|
@@ -625,7 +625,7 @@ function ut(e) {
|
|
|
625
625
|
})
|
|
626
626
|
};
|
|
627
627
|
}
|
|
628
|
-
function
|
|
628
|
+
function ft(e, t) {
|
|
629
629
|
return {
|
|
630
630
|
applyToSelection: () => {
|
|
631
631
|
let n = t(!1);
|
|
@@ -643,7 +643,7 @@ function dt(e, t) {
|
|
|
643
643
|
})
|
|
644
644
|
};
|
|
645
645
|
}
|
|
646
|
-
function
|
|
646
|
+
function pt(e, t, n) {
|
|
647
647
|
return {
|
|
648
648
|
addMembers: (n) => (r) => {
|
|
649
649
|
let i = e.followBlock.find(n);
|
|
@@ -685,7 +685,7 @@ function ft(e, t, n) {
|
|
|
685
685
|
}
|
|
686
686
|
};
|
|
687
687
|
}
|
|
688
|
-
function
|
|
688
|
+
function mt(e) {
|
|
689
689
|
return {
|
|
690
690
|
applyToPages: (t, n) => () => e.emit("template:applied", {
|
|
691
691
|
pageIds: [...t],
|
|
@@ -708,7 +708,7 @@ function pt(e) {
|
|
|
708
708
|
})
|
|
709
709
|
};
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function ht(e, t) {
|
|
712
712
|
return {
|
|
713
713
|
closeContextMenu: () => () => t.emit("context-menu:closed", {}),
|
|
714
714
|
closeDialog: () => () => t.emit("dialog:closed", {}),
|
|
@@ -724,35 +724,35 @@ function mt(e, t) {
|
|
|
724
724
|
};
|
|
725
725
|
}
|
|
726
726
|
// src/designer/plugins/follow-layout.ts
|
|
727
|
-
var
|
|
727
|
+
var gt = {
|
|
728
728
|
name: "builtin:follow-layout",
|
|
729
729
|
setup(e) {
|
|
730
|
-
let t = e.store(), n = t.layout.register("follow", (e, n, r) => ((n.length > 0 || r.length > 0) && t.followBlock.syncGaps(n, r),
|
|
730
|
+
let t = e.store(), n = t.layout.register("follow", (e, n, r) => ((n.length > 0 || r.length > 0) && t.followBlock.syncGaps(n, r), d(e)));
|
|
731
731
|
return t.layout.apply(), !t.history.canUndo && !t.history.canRedo ? t.history.reset() : t.history.commit(), n;
|
|
732
732
|
}
|
|
733
|
-
},
|
|
733
|
+
}, _t = {
|
|
734
734
|
name: "builtin:events",
|
|
735
735
|
setup(e) {
|
|
736
|
-
let t = [
|
|
736
|
+
let t = [$e(e.store(), e.events), Qe(e.elements, e.events)];
|
|
737
737
|
return () => {
|
|
738
738
|
for (let e of t.reverse()) e();
|
|
739
739
|
};
|
|
740
740
|
}
|
|
741
741
|
};
|
|
742
|
-
function
|
|
742
|
+
function vt(e) {
|
|
743
743
|
for (let t of [
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
744
|
+
_t,
|
|
745
|
+
yt,
|
|
746
|
+
gt
|
|
747
747
|
]) e.plugins.has(t.name) || (e.plugins.trustHostPlugin(t), e.plugins.use(t));
|
|
748
748
|
}
|
|
749
|
-
var
|
|
749
|
+
var yt = {
|
|
750
750
|
name: "builtin:domain-commands",
|
|
751
|
-
setup:
|
|
752
|
-
},
|
|
751
|
+
setup: Ze
|
|
752
|
+
}, bt = "1.0", xt = class {
|
|
753
753
|
#e = /* @__PURE__ */ new Map();
|
|
754
754
|
#t = /* @__PURE__ */ new Map();
|
|
755
|
-
#n =
|
|
755
|
+
#n = We(0);
|
|
756
756
|
contribute(e, t) {
|
|
757
757
|
e.signal.throwIfAborted();
|
|
758
758
|
let n = this.#t.get(t.point);
|
|
@@ -800,17 +800,17 @@ var vt = {
|
|
|
800
800
|
}
|
|
801
801
|
};
|
|
802
802
|
// src/locales/utils.ts
|
|
803
|
-
function
|
|
803
|
+
function St(e) {
|
|
804
804
|
return typeof e == "string" && /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]+)*$/.test(e);
|
|
805
805
|
}
|
|
806
|
-
function
|
|
806
|
+
function Ct(e) {
|
|
807
807
|
return typeof e != "object" || !e || Array.isArray(e) ? !1 : Object.entries(e).every(([e, t]) => ![
|
|
808
808
|
"__proto__",
|
|
809
809
|
"constructor",
|
|
810
810
|
"prototype"
|
|
811
|
-
].includes(e) && (typeof t == "string" ||
|
|
811
|
+
].includes(e) && (typeof t == "string" || Ct(t)));
|
|
812
812
|
}
|
|
813
|
-
function
|
|
813
|
+
function wt(e) {
|
|
814
814
|
let t = {};
|
|
815
815
|
for (let n of e) for (let [e, r] of Object.entries(n)) if (![
|
|
816
816
|
"__proto__",
|
|
@@ -820,57 +820,57 @@ function Ct(e) {
|
|
|
820
820
|
if (typeof r == "string") t[e] = r;
|
|
821
821
|
else {
|
|
822
822
|
let n = t[e];
|
|
823
|
-
t[e] =
|
|
823
|
+
t[e] = wt([typeof n == "object" ? n : {}, r]);
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
826
|
return t;
|
|
827
827
|
}
|
|
828
828
|
// src/locales/plugin-locales.ts
|
|
829
|
-
var
|
|
830
|
-
function
|
|
829
|
+
var Tt = /* @__PURE__ */ new Map();
|
|
830
|
+
function Et(e) {
|
|
831
831
|
return `pluginLocale_${Array.from(e, (e) => e.codePointAt(0)?.toString(16)).join("_")}`;
|
|
832
832
|
}
|
|
833
|
-
function
|
|
833
|
+
function Dt(e, t) {
|
|
834
834
|
if (!e.trim()) throw Error("Plugin locale ID must not be empty");
|
|
835
|
-
let n =
|
|
835
|
+
let n = Et(e);
|
|
836
836
|
return {
|
|
837
837
|
id: e,
|
|
838
838
|
messages: t,
|
|
839
839
|
trans(e, t) {
|
|
840
|
-
return
|
|
840
|
+
return g(`${n}.${e}`, t);
|
|
841
841
|
}
|
|
842
842
|
};
|
|
843
843
|
}
|
|
844
|
-
function
|
|
844
|
+
function Ot(e, t) {
|
|
845
845
|
for (let n of [...e.registrations].reverse()) if (n.messages[t]) return n.messages[t];
|
|
846
846
|
return e.previous.get(t);
|
|
847
847
|
}
|
|
848
|
-
function
|
|
849
|
-
let n = { ...
|
|
850
|
-
r === void 0 ? delete n[e.namespace] : n[e.namespace] = r,
|
|
848
|
+
function kt(e, t) {
|
|
849
|
+
let n = { ...y.global.getLocaleMessage(t) }, r = Ot(e, t);
|
|
850
|
+
r === void 0 ? delete n[e.namespace] : n[e.namespace] = r, y.global.setLocaleMessage(t, n);
|
|
851
851
|
}
|
|
852
|
-
function
|
|
852
|
+
function At(e) {
|
|
853
853
|
let t = e.id;
|
|
854
854
|
if (!t.trim()) throw Error("Plugin locale ID must not be empty");
|
|
855
855
|
let n = {};
|
|
856
856
|
for (let [t, r] of Object.entries(e.messages)) {
|
|
857
|
-
if (!
|
|
858
|
-
n[t] =
|
|
857
|
+
if (!St(t) || !Ct(r)) throw Error(`Invalid plugin locale: ${e.id}/${t}`);
|
|
858
|
+
n[t] = wt([r]);
|
|
859
859
|
}
|
|
860
|
-
let r =
|
|
860
|
+
let r = Tt.get(t);
|
|
861
861
|
r || (r = {
|
|
862
|
-
namespace:
|
|
862
|
+
namespace: Et(t),
|
|
863
863
|
previous: /* @__PURE__ */ new Map(),
|
|
864
864
|
registrations: []
|
|
865
|
-
},
|
|
865
|
+
}, Tt.set(t, r));
|
|
866
866
|
let i = { messages: n };
|
|
867
867
|
r.registrations.push(i);
|
|
868
868
|
for (let e of Object.keys(n)) {
|
|
869
869
|
if (!r.previous.has(e)) {
|
|
870
|
-
let t =
|
|
870
|
+
let t = y.global.getLocaleMessage(e);
|
|
871
871
|
r.previous.set(e, t[r.namespace]);
|
|
872
872
|
}
|
|
873
|
-
|
|
873
|
+
kt(r, e);
|
|
874
874
|
}
|
|
875
875
|
let a = r, o = !0;
|
|
876
876
|
return () => {
|
|
@@ -878,19 +878,19 @@ function kt(e) {
|
|
|
878
878
|
o = !1;
|
|
879
879
|
let e = a.registrations.indexOf(i);
|
|
880
880
|
a.registrations.splice(e, 1);
|
|
881
|
-
for (let e of Object.keys(n))
|
|
882
|
-
a.registrations.length === 0 &&
|
|
881
|
+
for (let e of Object.keys(n)) kt(a, e);
|
|
882
|
+
a.registrations.length === 0 && Tt.delete(t);
|
|
883
883
|
};
|
|
884
884
|
}
|
|
885
885
|
// src/plugins/pen/geometry.ts
|
|
886
|
-
function
|
|
886
|
+
function jt(e) {
|
|
887
887
|
return {
|
|
888
888
|
incoming: { ...e },
|
|
889
889
|
outgoing: { ...e },
|
|
890
890
|
point: { ...e }
|
|
891
891
|
};
|
|
892
892
|
}
|
|
893
|
-
function
|
|
893
|
+
function Mt(e, t = !1) {
|
|
894
894
|
let n = e[0];
|
|
895
895
|
if (!n) return "";
|
|
896
896
|
let r = [`M ${n.point.x} ${n.point.y}`], i = t ? e.length : e.length - 1;
|
|
@@ -900,29 +900,29 @@ function jt(e, t = !1) {
|
|
|
900
900
|
}
|
|
901
901
|
return t && r.push("Z"), r.join(" ");
|
|
902
902
|
}
|
|
903
|
-
function
|
|
903
|
+
function Nt(e) {
|
|
904
904
|
return {
|
|
905
|
-
anchors: (Array.isArray(e.anchors) ? e.anchors : []).filter((e) =>
|
|
905
|
+
anchors: (Array.isArray(e.anchors) ? e.anchors : []).filter((e) => It(e)),
|
|
906
906
|
closed: e.closed === !0,
|
|
907
|
-
viewHeight:
|
|
908
|
-
viewWidth:
|
|
907
|
+
viewHeight: Pt(e.viewHeight, 1),
|
|
908
|
+
viewWidth: Pt(e.viewWidth, 1)
|
|
909
909
|
};
|
|
910
910
|
}
|
|
911
|
-
function
|
|
911
|
+
function Pt(e, t) {
|
|
912
912
|
let n = Number(e);
|
|
913
913
|
return Number.isFinite(n) && n > 0 ? n : t;
|
|
914
914
|
}
|
|
915
|
-
function
|
|
915
|
+
function Ft(e) {
|
|
916
916
|
return typeof e == "object" && !!e && "x" in e && "y" in e && Number.isFinite(e.x) && Number.isFinite(e.y);
|
|
917
917
|
}
|
|
918
|
-
function
|
|
919
|
-
return typeof e == "object" && !!e && "point" in e && "incoming" in e && "outgoing" in e &&
|
|
918
|
+
function It(e) {
|
|
919
|
+
return typeof e == "object" && !!e && "point" in e && "incoming" in e && "outgoing" in e && Ft(e.point) && Ft(e.incoming) && Ft(e.outgoing);
|
|
920
920
|
}
|
|
921
|
-
function
|
|
921
|
+
function Lt(e, t, n, r, i) {
|
|
922
922
|
let a = 1 - i;
|
|
923
923
|
return a ** 3 * e + 3 * a ** 2 * i * t + 3 * a * i ** 2 * n + i ** 3 * r;
|
|
924
924
|
}
|
|
925
|
-
function
|
|
925
|
+
function Rt(e, t, n, r) {
|
|
926
926
|
let i = -e + 3 * t - 3 * n + r, a = 2 * (e - 2 * t + n), o = t - e, s = 2 ** -52 * Math.max(Math.abs(i), Math.abs(a), Math.abs(o)) * 8, c = [];
|
|
927
927
|
if (Math.abs(i) <= s) Math.abs(a) > s && (c = [-o / a]);
|
|
928
928
|
else {
|
|
@@ -932,13 +932,13 @@ function Lt(e, t, n, r) {
|
|
|
932
932
|
c = t === 0 ? [-a / (2 * i)] : [t / i, o / t];
|
|
933
933
|
}
|
|
934
934
|
}
|
|
935
|
-
return c.filter((e) => e > 0 && e < 1).map((i) =>
|
|
935
|
+
return c.filter((e) => e > 0 && e < 1).map((i) => Lt(e, t, n, r, i));
|
|
936
936
|
}
|
|
937
|
-
function
|
|
937
|
+
function zt(e, t) {
|
|
938
938
|
let n = e.map((e) => e.point), r = t ? e.length : e.length - 1;
|
|
939
939
|
for (let t = 0; t < r; t += 1) {
|
|
940
940
|
let r = e[t], i = e[(t + 1) % e.length];
|
|
941
|
-
for (let e of ["x", "y"]) for (let t of
|
|
941
|
+
for (let e of ["x", "y"]) for (let t of Rt(r.point[e], r.outgoing[e], i.incoming[e], i.point[e])) n.push({
|
|
942
942
|
...r.point,
|
|
943
943
|
[e]: t
|
|
944
944
|
});
|
|
@@ -971,11 +971,11 @@ function Rt(e, t) {
|
|
|
971
971
|
y: o
|
|
972
972
|
};
|
|
973
973
|
}
|
|
974
|
-
function
|
|
975
|
-
return
|
|
974
|
+
function Bt(e) {
|
|
975
|
+
return Pt(e.strokeWidth, .4);
|
|
976
976
|
}
|
|
977
977
|
// src/plugins/pen/locale.ts
|
|
978
|
-
var
|
|
978
|
+
var Vt = Dt("print-studio:pen-tool", { "zh-CN": {
|
|
979
979
|
tool: "钢笔",
|
|
980
980
|
path: "钢笔路径",
|
|
981
981
|
stroke: "描边颜色",
|
|
@@ -991,11 +991,11 @@ var Bt = Et("print-studio:pen-tool", { "zh-CN": {
|
|
|
991
991
|
help: "单击添加锚点,按住拖动创建曲线;点击起点闭合,双击或 Enter 完成,Backspace 回退,Esc 取消。"
|
|
992
992
|
} });
|
|
993
993
|
function J(e) {
|
|
994
|
-
return
|
|
994
|
+
return Vt.trans(e);
|
|
995
995
|
}
|
|
996
996
|
// src/plugins/pen/element.ts
|
|
997
|
-
var
|
|
998
|
-
function
|
|
997
|
+
var Ht = "pen-path", Ut = `element:${Ht}`;
|
|
998
|
+
function Wt() {
|
|
999
999
|
return {
|
|
1000
1000
|
createProps() {
|
|
1001
1001
|
return {
|
|
@@ -1062,47 +1062,47 @@ function Ut() {
|
|
|
1062
1062
|
order: 45,
|
|
1063
1063
|
shortcut: "p",
|
|
1064
1064
|
toHtml({ props: e }) {
|
|
1065
|
-
let t =
|
|
1066
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 ${t.viewWidth} ${t.viewHeight}" preserveAspectRatio="none" style="overflow:visible"><path d="${
|
|
1065
|
+
let t = Nt(e), n = t.closed ? String(e.fill ?? "none") : "none";
|
|
1066
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 ${t.viewWidth} ${t.viewHeight}" preserveAspectRatio="none" style="overflow:visible"><path d="${Mt(t.anchors, t.closed)}" fill="${Te(n)}" stroke="${Te(e.stroke ?? "#333333")}" stroke-width="${Bt(e)}" stroke-linecap="round" stroke-linejoin="round" /></svg>`;
|
|
1067
1067
|
},
|
|
1068
1068
|
toPdf({ draw: e, node: t, pdf: n, props: r }) {
|
|
1069
|
-
let
|
|
1070
|
-
if (!
|
|
1071
|
-
let
|
|
1072
|
-
c: [t.x +
|
|
1069
|
+
let i = Nt(r), a = i.anchors[0], o = i.closed && !x(r.fill), s = !x(r.stroke);
|
|
1070
|
+
if (!a || !o && !s) return;
|
|
1071
|
+
let c = t.width / i.viewWidth, l = t.height / i.viewHeight, u = [{
|
|
1072
|
+
c: [t.x + a.point.x * c, t.y + a.point.y * l],
|
|
1073
1073
|
op: "m"
|
|
1074
|
-
}],
|
|
1075
|
-
for (let e = 0; e <
|
|
1076
|
-
let n =
|
|
1077
|
-
|
|
1074
|
+
}], d = i.closed ? i.anchors.length : i.anchors.length - 1;
|
|
1075
|
+
for (let e = 0; e < d; e += 1) {
|
|
1076
|
+
let n = i.anchors[e], r = i.anchors[(e + 1) % i.anchors.length];
|
|
1077
|
+
u.push({
|
|
1078
1078
|
c: [
|
|
1079
|
-
t.x + n.outgoing.x *
|
|
1080
|
-
t.y + n.outgoing.y *
|
|
1081
|
-
t.x + r.incoming.x *
|
|
1082
|
-
t.y + r.incoming.y *
|
|
1083
|
-
t.x + r.point.x *
|
|
1084
|
-
t.y + r.point.y *
|
|
1079
|
+
t.x + n.outgoing.x * c,
|
|
1080
|
+
t.y + n.outgoing.y * l,
|
|
1081
|
+
t.x + r.incoming.x * c,
|
|
1082
|
+
t.y + r.incoming.y * l,
|
|
1083
|
+
t.x + r.point.x * c,
|
|
1084
|
+
t.y + r.point.y * l
|
|
1085
1085
|
],
|
|
1086
1086
|
op: "c"
|
|
1087
1087
|
});
|
|
1088
1088
|
}
|
|
1089
|
-
|
|
1089
|
+
i.closed && u.push({
|
|
1090
1090
|
c: [],
|
|
1091
1091
|
op: "h"
|
|
1092
|
-
}), n.saveGraphicsState(), e.setDash([]), e.setStrokeWidth(
|
|
1092
|
+
}), n.saveGraphicsState(), e.setDash([]), e.setStrokeWidth(Bt(r) * Math.sqrt(c * l)), n.setLineCap("round"), n.setLineJoin("round"), o && e.setFillColor(String(r.fill)), s && e.setStrokeColor(String(r.stroke)), n.path(u), o && s ? n.fillStroke() : o ? n.fill() : n.stroke(), n.restoreGraphicsState();
|
|
1093
1093
|
},
|
|
1094
|
-
type:
|
|
1094
|
+
type: Ht
|
|
1095
1095
|
};
|
|
1096
1096
|
}
|
|
1097
1097
|
// src/designer/plugins/plugin-bootstrap.ts
|
|
1098
|
-
var
|
|
1099
|
-
elements: () => [
|
|
1100
|
-
locales: [
|
|
1098
|
+
var Gt = [{
|
|
1099
|
+
elements: () => [Wt()],
|
|
1100
|
+
locales: [Vt]
|
|
1101
1101
|
}];
|
|
1102
|
-
function
|
|
1102
|
+
function Kt(e = Gt) {
|
|
1103
1103
|
let t = [];
|
|
1104
1104
|
try {
|
|
1105
|
-
for (let n of e) for (let e of n.locales ?? []) t.push(
|
|
1105
|
+
for (let n of e) for (let e of n.locales ?? []) t.push(At(e));
|
|
1106
1106
|
} catch (e) {
|
|
1107
1107
|
for (let e of t.reverse()) e();
|
|
1108
1108
|
throw e;
|
|
@@ -1111,28 +1111,28 @@ function Gt(e = Wt) {
|
|
|
1111
1111
|
for (let e of t.reverse()) e();
|
|
1112
1112
|
};
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1114
|
+
function qt(e, t = Gt) {
|
|
1115
1115
|
return {
|
|
1116
1116
|
...e,
|
|
1117
1117
|
elements: [...t.flatMap((e) => e.elements()), ...e.elements ?? []]
|
|
1118
1118
|
};
|
|
1119
1119
|
}
|
|
1120
1120
|
// src/designer/services/file-service.ts
|
|
1121
|
-
function
|
|
1121
|
+
function Jt(e, t) {
|
|
1122
1122
|
let n = URL.createObjectURL(t), r = document.createElement("a");
|
|
1123
1123
|
r.href = n, r.download = e, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => {
|
|
1124
1124
|
URL.revokeObjectURL(n);
|
|
1125
1125
|
}, 4e3);
|
|
1126
1126
|
}
|
|
1127
|
-
function
|
|
1128
|
-
|
|
1127
|
+
function Yt(e, t, n = "application/json") {
|
|
1128
|
+
Jt(e, new Blob([t], { type: `${n};charset=utf-8` }));
|
|
1129
1129
|
}
|
|
1130
|
-
async function
|
|
1130
|
+
async function Xt(e) {
|
|
1131
1131
|
document.getElementById("print-studio-print-frame")?.remove();
|
|
1132
1132
|
let t = document.createElement("iframe");
|
|
1133
1133
|
t.id = "print-studio-print-frame", t.style.position = "fixed", t.style.right = "0", t.style.bottom = "0", t.style.width = "0", t.style.height = "0", t.style.border = "0", t.style.visibility = "hidden", document.body.appendChild(t);
|
|
1134
1134
|
try {
|
|
1135
|
-
await
|
|
1135
|
+
await r(t, e);
|
|
1136
1136
|
let n = t.contentWindow;
|
|
1137
1137
|
n && (n.focus(), n.print());
|
|
1138
1138
|
} catch (e) {
|
|
@@ -1144,7 +1144,7 @@ async function Yt(e) {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
1146
|
// src/designer/plugins/plugin-canvas.ts
|
|
1147
|
-
function
|
|
1147
|
+
function Zt(e, t, n) {
|
|
1148
1148
|
return {
|
|
1149
1149
|
activate(t) {
|
|
1150
1150
|
n("canvas"), e.store().scope.activate(t);
|
|
@@ -1154,20 +1154,20 @@ function Xt(e, t, n) {
|
|
|
1154
1154
|
},
|
|
1155
1155
|
add(t, r, i) {
|
|
1156
1156
|
n("canvas"), n("document:write");
|
|
1157
|
-
let a = e.store().element.add(t,
|
|
1157
|
+
let a = e.store().element.add(t, b(r), i);
|
|
1158
1158
|
a && e.store().selection.set([a.id]);
|
|
1159
1159
|
},
|
|
1160
1160
|
beginEdit(r) {
|
|
1161
1161
|
n("canvas"), n("document:write");
|
|
1162
1162
|
let i = e.store(), a = i.element.get(r);
|
|
1163
1163
|
if (!a || a.locked || !a.visible || i.view.settings.previewWithData) return;
|
|
1164
|
-
let o =
|
|
1164
|
+
let o = b(a), s = /* @__PURE__ */ new Set(), c = !0;
|
|
1165
1165
|
function l() {
|
|
1166
1166
|
return c && i.element.get(r) === a;
|
|
1167
1167
|
}
|
|
1168
1168
|
let u = t.track(() => {
|
|
1169
1169
|
if (l()) {
|
|
1170
|
-
let e = Object.fromEntries([...s].map((e) => [e,
|
|
1170
|
+
let e = Object.fromEntries([...s].map((e) => [e, b(o[e])]));
|
|
1171
1171
|
i.element.update(r, e, { transient: !0 });
|
|
1172
1172
|
}
|
|
1173
1173
|
c = !1;
|
|
@@ -1180,12 +1180,12 @@ function Xt(e, t, n) {
|
|
|
1180
1180
|
update(e) {
|
|
1181
1181
|
if (n("canvas"), n("document:write"), !l() || a.locked || !a.visible) return !1;
|
|
1182
1182
|
for (let t of Object.keys(e)) s.add(t);
|
|
1183
|
-
return i.element.update(r,
|
|
1183
|
+
return i.element.update(r, b(e), { transient: !0 }), !0;
|
|
1184
1184
|
}
|
|
1185
1185
|
};
|
|
1186
1186
|
},
|
|
1187
1187
|
get pages() {
|
|
1188
|
-
return n("canvas"),
|
|
1188
|
+
return n("canvas"), b(e.store().scope.pages);
|
|
1189
1189
|
},
|
|
1190
1190
|
get panning() {
|
|
1191
1191
|
return n("canvas"), e.store().view.spacePanning;
|
|
@@ -1204,7 +1204,7 @@ function Xt(e, t, n) {
|
|
|
1204
1204
|
});
|
|
1205
1205
|
},
|
|
1206
1206
|
get selection() {
|
|
1207
|
-
return n("canvas"),
|
|
1207
|
+
return n("canvas"), b(e.getSelection().nodes);
|
|
1208
1208
|
},
|
|
1209
1209
|
setTool(t) {
|
|
1210
1210
|
n("canvas"), e.store().view.setTool(t);
|
|
@@ -1223,7 +1223,7 @@ var Y = {
|
|
|
1223
1223
|
tab: "designer.tabs",
|
|
1224
1224
|
tool: "designer.tools"
|
|
1225
1225
|
};
|
|
1226
|
-
function
|
|
1226
|
+
function Qt(e) {
|
|
1227
1227
|
let t = (e) => typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && !!e.id && "title" in e && typeof e.title == "string" && "run" in e && typeof e.run == "function";
|
|
1228
1228
|
for (let [n, r] of Object.entries(Y)) n === "panel" || n === "tab" ? e.extensions.define({
|
|
1229
1229
|
apiVersion: "1.0",
|
|
@@ -1235,10 +1235,10 @@ function Zt(e) {
|
|
|
1235
1235
|
}) : e.extensions.define({
|
|
1236
1236
|
apiVersion: "1.0",
|
|
1237
1237
|
id: r,
|
|
1238
|
-
kind:
|
|
1238
|
+
kind: $t(n),
|
|
1239
1239
|
mount: (t, n) => e.commands.registerScoped([{
|
|
1240
1240
|
...t,
|
|
1241
|
-
run: (e, ...r) => (n.signal.throwIfAborted(), t.run(n.context, ...
|
|
1241
|
+
run: (e, ...r) => (n.signal.throwIfAborted(), t.run(n.context, ...b(r))),
|
|
1242
1242
|
get title() {
|
|
1243
1243
|
return t.title;
|
|
1244
1244
|
}
|
|
@@ -1254,10 +1254,10 @@ function Zt(e) {
|
|
|
1254
1254
|
validate: (e) => typeof e == "object" && !!e && "component" in e && !!e.component
|
|
1255
1255
|
});
|
|
1256
1256
|
}
|
|
1257
|
-
function
|
|
1257
|
+
function $t(e) {
|
|
1258
1258
|
return e === "menu" ? "menu" : e === "override" ? "override" : "button";
|
|
1259
1259
|
}
|
|
1260
|
-
function
|
|
1260
|
+
function en(e, t, n) {
|
|
1261
1261
|
let r = new Set(t.permissions ?? []), i = (e) => {
|
|
1262
1262
|
if (n.assertActive(), e && !r.has(e)) throw Error(`Plugin ${t.id} is not allowed to access ${e}`);
|
|
1263
1263
|
}, a = (r) => {
|
|
@@ -1271,7 +1271,7 @@ function $t(e, t, n) {
|
|
|
1271
1271
|
i("commands");
|
|
1272
1272
|
let r = t.run, o = {
|
|
1273
1273
|
...t,
|
|
1274
|
-
run: (e, ...t) => (n.assertActive(), r(c, ...
|
|
1274
|
+
run: (e, ...t) => (n.assertActive(), r(c, ...b(t))),
|
|
1275
1275
|
get title() {
|
|
1276
1276
|
return t.title;
|
|
1277
1277
|
}
|
|
@@ -1284,7 +1284,7 @@ function $t(e, t, n) {
|
|
|
1284
1284
|
});
|
|
1285
1285
|
}, s = ((r, a) => (i("events"), n.track(e.events.on(r, (...n) => {
|
|
1286
1286
|
try {
|
|
1287
|
-
let r = Reflect.apply(a, void 0,
|
|
1287
|
+
let r = Reflect.apply(a, void 0, b(n));
|
|
1288
1288
|
r && typeof r == "object" && "then" in r && Promise.resolve(r).catch((n) => {
|
|
1289
1289
|
e.errors.capture(n, {
|
|
1290
1290
|
metadata: { pluginId: t.id },
|
|
@@ -1299,11 +1299,11 @@ function $t(e, t, n) {
|
|
|
1299
1299
|
}
|
|
1300
1300
|
})))), c = {
|
|
1301
1301
|
apiVersion: "1.0",
|
|
1302
|
-
canvas:
|
|
1302
|
+
canvas: Zt(e, n, i),
|
|
1303
1303
|
commands: {
|
|
1304
1304
|
execute: async (n, ...r) => {
|
|
1305
1305
|
if (i("commands"), !Object.values(Y).some((r) => e.extensions.list(r).some((e) => e.pluginId === t.id && typeof e.value == "object" && e.value !== null && "id" in e.value && e.value.id === n)) && !t.commands?.includes(n)) throw Error(`Plugin ${t.id} cannot execute host command ${n}`);
|
|
1306
|
-
return e.commands.execute(n, ...
|
|
1306
|
+
return e.commands.execute(n, ...b(r));
|
|
1307
1307
|
},
|
|
1308
1308
|
get(t) {
|
|
1309
1309
|
i("commands");
|
|
@@ -1330,7 +1330,7 @@ function $t(e, t, n) {
|
|
|
1330
1330
|
apiVersion: "1.0",
|
|
1331
1331
|
id: t,
|
|
1332
1332
|
point: e,
|
|
1333
|
-
value:
|
|
1333
|
+
value: b(n)
|
|
1334
1334
|
}) },
|
|
1335
1335
|
document: {
|
|
1336
1336
|
getDocument() {
|
|
@@ -1340,10 +1340,10 @@ function $t(e, t, n) {
|
|
|
1340
1340
|
return i("document:read"), e.store().document.getPersistentDocument();
|
|
1341
1341
|
},
|
|
1342
1342
|
load(t) {
|
|
1343
|
-
i("document:write"), e.store().document.load(
|
|
1343
|
+
i("document:write"), e.store().document.load(b(t));
|
|
1344
1344
|
},
|
|
1345
1345
|
normalize(t) {
|
|
1346
|
-
return i("document:read"),
|
|
1346
|
+
return i("document:read"), je(b(t), e.elements);
|
|
1347
1347
|
},
|
|
1348
1348
|
suspendPersistence() {
|
|
1349
1349
|
return i("document:write"), n.track(e.store().document.suspendPersistence());
|
|
@@ -1355,12 +1355,12 @@ function $t(e, t, n) {
|
|
|
1355
1355
|
hooks: { on: s },
|
|
1356
1356
|
locales: { register(e) {
|
|
1357
1357
|
if (i("locales"), e.id !== t.id) throw Error("Plugin locale ID must match the plugin manifest");
|
|
1358
|
-
return n.track(
|
|
1358
|
+
return n.track(At(e));
|
|
1359
1359
|
} },
|
|
1360
1360
|
menu: { add: (e) => o(Y.menu, e) },
|
|
1361
1361
|
onDispose: (e) => n.track(e),
|
|
1362
1362
|
output: { download(e, t) {
|
|
1363
|
-
i("ui"),
|
|
1363
|
+
i("ui"), Jt(e, t);
|
|
1364
1364
|
} },
|
|
1365
1365
|
overrides: { command: (e) => o(Y.override, e) },
|
|
1366
1366
|
panels: { register: (e) => a({
|
|
@@ -1420,7 +1420,7 @@ function $t(e, t, n) {
|
|
|
1420
1420
|
return Object.freeze(c);
|
|
1421
1421
|
}
|
|
1422
1422
|
// src/designer/plugins/plugin-scope.ts
|
|
1423
|
-
var
|
|
1423
|
+
var tn = class {
|
|
1424
1424
|
report;
|
|
1425
1425
|
controller = new AbortController();
|
|
1426
1426
|
#e = /* @__PURE__ */ new Set();
|
|
@@ -1447,10 +1447,10 @@ var en = class {
|
|
|
1447
1447
|
}
|
|
1448
1448
|
};
|
|
1449
1449
|
// src/designer/plugins/plugin-manager.ts
|
|
1450
|
-
function
|
|
1450
|
+
function nn(e) {
|
|
1451
1451
|
return !!e && typeof e == "object" && "then" in e;
|
|
1452
1452
|
}
|
|
1453
|
-
var
|
|
1453
|
+
var rn = class {
|
|
1454
1454
|
getContext;
|
|
1455
1455
|
policy;
|
|
1456
1456
|
#e = !1;
|
|
@@ -1486,7 +1486,7 @@ var nn = class {
|
|
|
1486
1486
|
}
|
|
1487
1487
|
if (!t.definition) {
|
|
1488
1488
|
this.setStatus(t, "loading");
|
|
1489
|
-
let n = new
|
|
1489
|
+
let n = new tn((e) => this.report(t, e));
|
|
1490
1490
|
t.scope = n;
|
|
1491
1491
|
let r = this.loadDefinition(t).then(() => {
|
|
1492
1492
|
if (!(this.#n.get(e) !== t || this.#e || n.controller.signal.aborted)) return this.activate(t);
|
|
@@ -1498,7 +1498,7 @@ var nn = class {
|
|
|
1498
1498
|
return t.pending = r, r;
|
|
1499
1499
|
}
|
|
1500
1500
|
let n = this.activate(t);
|
|
1501
|
-
if (
|
|
1501
|
+
if (nn(n)) return t.pending = n.finally(() => {
|
|
1502
1502
|
t.pending = void 0;
|
|
1503
1503
|
}), t.pending;
|
|
1504
1504
|
}
|
|
@@ -1549,7 +1549,7 @@ var nn = class {
|
|
|
1549
1549
|
let i = this.#n.get(r);
|
|
1550
1550
|
try {
|
|
1551
1551
|
let e = this.enable(r);
|
|
1552
|
-
if (
|
|
1552
|
+
if (nn(e)) return e.catch((e) => {
|
|
1553
1553
|
throw this.removeFailedInstallation(r, i), e;
|
|
1554
1554
|
});
|
|
1555
1555
|
} catch (e) {
|
|
@@ -1562,11 +1562,11 @@ var nn = class {
|
|
|
1562
1562
|
let n = this.use(e), r = this.#n.get(t), i = () => {
|
|
1563
1563
|
this.#n.get(t) === r && this.dispose(t);
|
|
1564
1564
|
};
|
|
1565
|
-
return
|
|
1565
|
+
return nn(n) ? n.then(() => i) : i;
|
|
1566
1566
|
}
|
|
1567
1567
|
activate(e) {
|
|
1568
|
-
this.checkDependencies(e, []), this.#r ||= (
|
|
1569
|
-
let t = new
|
|
1568
|
+
this.checkDependencies(e, []), this.#r ||= (Qt(this.getContext()), !0), this.setStatus(e, "enabling");
|
|
1569
|
+
let t = new tn((t) => this.report(e, t));
|
|
1570
1570
|
e.scope = t;
|
|
1571
1571
|
let n = (n) => {
|
|
1572
1572
|
n && t.track(n), t.controller.signal.aborted || this.#n.get(e.manifest.id) !== e || this.setStatus(e, "enabled");
|
|
@@ -1575,7 +1575,7 @@ var nn = class {
|
|
|
1575
1575
|
let r = e.definition;
|
|
1576
1576
|
if (!r) throw Error(`Plugin was not loaded: ${e.manifest.id}`);
|
|
1577
1577
|
let i;
|
|
1578
|
-
if (i = typeof r == "function" ? r(
|
|
1578
|
+
if (i = typeof r == "function" ? r(en(this.getContext(), e.manifest, t)) : "manifest" in r ? r.setup(en(this.getContext(), e.manifest, t)) : r.setup(this.createHostContext(t)), nn(i)) return i.then(n).catch((t) => {
|
|
1579
1579
|
throw this.fail(e, t), t;
|
|
1580
1580
|
});
|
|
1581
1581
|
n(i);
|
|
@@ -1677,21 +1677,21 @@ var nn = class {
|
|
|
1677
1677
|
for (let t of e.permissions ?? []) if (!this.policy.permissions.includes(t)) throw Error(`Host denied permission ${t} for ${e.id}`);
|
|
1678
1678
|
}
|
|
1679
1679
|
}
|
|
1680
|
-
},
|
|
1681
|
-
function
|
|
1682
|
-
return
|
|
1680
|
+
}, an = 2e3, on = "designer.errorHandling.unexpectedErrorMessage", sn = null;
|
|
1681
|
+
function cn() {
|
|
1682
|
+
return sn ||= t({ report: ln }), sn;
|
|
1683
1683
|
}
|
|
1684
|
-
function
|
|
1685
|
-
function
|
|
1684
|
+
function ln(e, t) {}
|
|
1685
|
+
function un(e) {
|
|
1686
1686
|
let t = /* @__PURE__ */ new Map();
|
|
1687
1687
|
function n(e, n) {
|
|
1688
1688
|
let r = t.get(e);
|
|
1689
|
-
return r !== void 0 && n - r <
|
|
1689
|
+
return r !== void 0 && n - r < an ? !1 : (t.set(e, n), !0);
|
|
1690
1690
|
}
|
|
1691
1691
|
return {
|
|
1692
1692
|
handle: async function(t) {
|
|
1693
1693
|
let r = t.error;
|
|
1694
|
-
return
|
|
1694
|
+
return _(r) ? (n(r.userMessage, Date.now()) && e.store().ui.toast(r.userMessage, "error"), {
|
|
1695
1695
|
code: "designer-toast",
|
|
1696
1696
|
handled: !0,
|
|
1697
1697
|
report: !1
|
|
@@ -1702,16 +1702,16 @@ function ln(e) {
|
|
|
1702
1702
|
};
|
|
1703
1703
|
},
|
|
1704
1704
|
match: function(e) {
|
|
1705
|
-
return
|
|
1705
|
+
return _(e.error);
|
|
1706
1706
|
}
|
|
1707
1707
|
};
|
|
1708
1708
|
}
|
|
1709
|
-
function
|
|
1709
|
+
function dn(e) {
|
|
1710
1710
|
let t = 0;
|
|
1711
1711
|
return {
|
|
1712
1712
|
handle: async function() {
|
|
1713
1713
|
let n = Date.now();
|
|
1714
|
-
return n - t >=
|
|
1714
|
+
return n - t >= an && (t = n, e.store().ui.toast(g(on), "error")), {
|
|
1715
1715
|
code: "unexpected-toast",
|
|
1716
1716
|
handled: !0
|
|
1717
1717
|
};
|
|
@@ -1721,13 +1721,13 @@ function un(e) {
|
|
|
1721
1721
|
}
|
|
1722
1722
|
};
|
|
1723
1723
|
}
|
|
1724
|
-
var
|
|
1724
|
+
var fn = {
|
|
1725
1725
|
get description() {
|
|
1726
|
-
return
|
|
1726
|
+
return g("designer.errorHandling.pluginDescription");
|
|
1727
1727
|
},
|
|
1728
1728
|
name: "builtin:error-handling",
|
|
1729
1729
|
setup: function(e) {
|
|
1730
|
-
let t = e.errors, n = t.addRule(
|
|
1730
|
+
let t = e.errors, n = t.addRule(un(e), { prepend: !0 }), r = t.addRule(dn(e)), i = e.events.on("command:error", (t) => {
|
|
1731
1731
|
e.errors.capture(t.error, {
|
|
1732
1732
|
metadata: { commandId: t.id },
|
|
1733
1733
|
source: "command"
|
|
@@ -1737,26 +1737,26 @@ var dn = {
|
|
|
1737
1737
|
n(), r(), i();
|
|
1738
1738
|
};
|
|
1739
1739
|
}
|
|
1740
|
-
},
|
|
1741
|
-
bindEditorElements: () =>
|
|
1742
|
-
bindEditorErrors: () =>
|
|
1743
|
-
getEditorElements: () =>
|
|
1744
|
-
getEditorErrors: () =>
|
|
1745
|
-
}),
|
|
1746
|
-
function
|
|
1747
|
-
|
|
1740
|
+
}, pn = /* @__PURE__ */ e({
|
|
1741
|
+
bindEditorElements: () => vn,
|
|
1742
|
+
bindEditorErrors: () => gn,
|
|
1743
|
+
getEditorElements: () => yn,
|
|
1744
|
+
getEditorErrors: () => _n
|
|
1745
|
+
}), mn = /* @__PURE__ */ new WeakMap(), hn = /* @__PURE__ */ new WeakMap();
|
|
1746
|
+
function gn(e, t) {
|
|
1747
|
+
hn.set(e, t);
|
|
1748
1748
|
}
|
|
1749
|
-
function
|
|
1750
|
-
return
|
|
1749
|
+
function _n(e) {
|
|
1750
|
+
return hn.get(e) ?? cn();
|
|
1751
1751
|
}
|
|
1752
|
-
function
|
|
1753
|
-
|
|
1752
|
+
function vn(e, t) {
|
|
1753
|
+
mn.set(e, t);
|
|
1754
1754
|
}
|
|
1755
|
-
function
|
|
1756
|
-
return
|
|
1755
|
+
function yn(e) {
|
|
1756
|
+
return mn.get(e) ?? F;
|
|
1757
1757
|
}
|
|
1758
1758
|
// src/designer/services/preference-storage.ts
|
|
1759
|
-
var
|
|
1759
|
+
var bn = class {
|
|
1760
1760
|
fallback;
|
|
1761
1761
|
#e = [];
|
|
1762
1762
|
constructor(e) {
|
|
@@ -1776,38 +1776,38 @@ var yn = class {
|
|
|
1776
1776
|
}
|
|
1777
1777
|
};
|
|
1778
1778
|
// src/core/coordinate-space.ts
|
|
1779
|
-
function
|
|
1779
|
+
function xn(e, t) {
|
|
1780
1780
|
return {
|
|
1781
1781
|
x: t.x - e.x,
|
|
1782
1782
|
y: t.y - e.y
|
|
1783
1783
|
};
|
|
1784
1784
|
}
|
|
1785
|
-
function
|
|
1785
|
+
function Sn(e, t) {
|
|
1786
1786
|
return {
|
|
1787
1787
|
x: t.x + e.x,
|
|
1788
1788
|
y: t.y + e.y
|
|
1789
1789
|
};
|
|
1790
1790
|
}
|
|
1791
|
-
function
|
|
1791
|
+
function Cn(e, t, n) {
|
|
1792
1792
|
return {
|
|
1793
1793
|
x: (t.x - e.left) / n,
|
|
1794
1794
|
y: (t.y - e.top) / n
|
|
1795
1795
|
};
|
|
1796
1796
|
}
|
|
1797
1797
|
// src/designer/services/stage-service.ts
|
|
1798
|
-
var
|
|
1799
|
-
bindStageService: () =>
|
|
1800
|
-
contentMmFromClient: () =>
|
|
1801
|
-
createStageService: () =>
|
|
1802
|
-
getScrollElement: () =>
|
|
1803
|
-
getStageController: () =>
|
|
1804
|
-
getStageService: () =>
|
|
1805
|
-
registerStageController: () =>
|
|
1806
|
-
registerStageElements: () =>
|
|
1807
|
-
scrollToContentPoint: () =>
|
|
1798
|
+
var wn = /* @__PURE__ */ e({
|
|
1799
|
+
bindStageService: () => kn,
|
|
1800
|
+
contentMmFromClient: () => An,
|
|
1801
|
+
createStageService: () => Tn,
|
|
1802
|
+
getScrollElement: () => jn,
|
|
1803
|
+
getStageController: () => Mn,
|
|
1804
|
+
getStageService: () => On,
|
|
1805
|
+
registerStageController: () => Nn,
|
|
1806
|
+
registerStageElements: () => Pn,
|
|
1807
|
+
scrollToContentPoint: () => Fn
|
|
1808
1808
|
});
|
|
1809
|
-
function
|
|
1810
|
-
let e =
|
|
1809
|
+
function Tn() {
|
|
1810
|
+
let e = We(null), t = We(null), n = We(null);
|
|
1811
1811
|
function r(n, r) {
|
|
1812
1812
|
e.value = n, t.value = r;
|
|
1813
1813
|
}
|
|
@@ -1826,8 +1826,8 @@ function wn() {
|
|
|
1826
1826
|
x: 0,
|
|
1827
1827
|
y: 0
|
|
1828
1828
|
};
|
|
1829
|
-
let a = i.getBoundingClientRect(), o =
|
|
1830
|
-
return
|
|
1829
|
+
let a = i.getBoundingClientRect(), o = we * r;
|
|
1830
|
+
return Cn(a, {
|
|
1831
1831
|
x: e,
|
|
1832
1832
|
y: n
|
|
1833
1833
|
}, o);
|
|
@@ -1835,7 +1835,7 @@ function wn() {
|
|
|
1835
1835
|
function c(t, n, r, i) {
|
|
1836
1836
|
let a = e.value;
|
|
1837
1837
|
if (!a) return;
|
|
1838
|
-
let o =
|
|
1838
|
+
let o = we * i;
|
|
1839
1839
|
a.scrollLeft = t.x * o - n, a.scrollTop = t.y * o - r;
|
|
1840
1840
|
}
|
|
1841
1841
|
return {
|
|
@@ -1847,14 +1847,14 @@ function wn() {
|
|
|
1847
1847
|
scrollToContentPoint: c
|
|
1848
1848
|
};
|
|
1849
1849
|
}
|
|
1850
|
-
var
|
|
1851
|
-
function Dn(e) {
|
|
1852
|
-
return e ? Tn.get(e) ?? En : En;
|
|
1853
|
-
}
|
|
1850
|
+
var En = /* @__PURE__ */ new WeakMap(), Dn = Tn();
|
|
1854
1851
|
function On(e) {
|
|
1855
|
-
|
|
1852
|
+
return e ? En.get(e) ?? Dn : Dn;
|
|
1853
|
+
}
|
|
1854
|
+
function kn(e) {
|
|
1855
|
+
En.set(e, Tn());
|
|
1856
1856
|
}
|
|
1857
|
-
var { contentMmFromClient:
|
|
1857
|
+
var { contentMmFromClient: An, getScrollElement: jn, getStageController: Mn, registerStageController: Nn, registerStageElements: Pn, scrollToContentPoint: Fn } = Dn, In = [
|
|
1858
1858
|
{
|
|
1859
1859
|
height: 297,
|
|
1860
1860
|
id: "delivery",
|
|
@@ -1874,22 +1874,22 @@ var { contentMmFromClient: kn, getScrollElement: An, getStageController: jn, reg
|
|
|
1874
1874
|
width: 148
|
|
1875
1875
|
}
|
|
1876
1876
|
];
|
|
1877
|
-
function
|
|
1878
|
-
let e =
|
|
1879
|
-
return e.templateId =
|
|
1877
|
+
function Ln() {
|
|
1878
|
+
let e = me();
|
|
1879
|
+
return e.templateId = oe, {
|
|
1880
1880
|
dataSources: [],
|
|
1881
|
-
name:
|
|
1881
|
+
name: g("designer.tutorial.practiceName"),
|
|
1882
1882
|
pages: [e],
|
|
1883
|
-
templates: [
|
|
1883
|
+
templates: [ue()],
|
|
1884
1884
|
version: "1.0"
|
|
1885
1885
|
};
|
|
1886
1886
|
}
|
|
1887
|
-
function
|
|
1887
|
+
function Rn(e, t) {
|
|
1888
1888
|
let n = e[0].toUpperCase() + e.slice(1), r = t[0].toUpperCase() + t.slice(1);
|
|
1889
|
-
return
|
|
1889
|
+
return g(`designer.tutorial.courses${n}${r}`);
|
|
1890
1890
|
}
|
|
1891
1891
|
function X(e, t) {
|
|
1892
|
-
return
|
|
1892
|
+
return Rn(e.id, t);
|
|
1893
1893
|
}
|
|
1894
1894
|
function Z(e, t, n, r, i, a, o = {}) {
|
|
1895
1895
|
let s = e.element.add("text", {
|
|
@@ -1910,7 +1910,7 @@ function Z(e, t, n, r, i, a, o = {}) {
|
|
|
1910
1910
|
if (!s) throw Error(`Tutorial page missing: ${t}`);
|
|
1911
1911
|
return s;
|
|
1912
1912
|
}
|
|
1913
|
-
function
|
|
1913
|
+
function zn(e, t) {
|
|
1914
1914
|
e.page.update(e.document.data.pages[0].id, {
|
|
1915
1915
|
height: t.height,
|
|
1916
1916
|
margins: {
|
|
@@ -1920,17 +1920,17 @@ function Rn(e, t) {
|
|
|
1920
1920
|
top: 30
|
|
1921
1921
|
},
|
|
1922
1922
|
name: X(t, "title"),
|
|
1923
|
-
templateId:
|
|
1923
|
+
templateId: oe,
|
|
1924
1924
|
width: t.width
|
|
1925
1925
|
});
|
|
1926
1926
|
}
|
|
1927
|
-
function
|
|
1927
|
+
function Bn(e, t) {
|
|
1928
1928
|
let n = e.template.create({
|
|
1929
1929
|
id: "tutorial-template",
|
|
1930
1930
|
name: X(t, "templateName")
|
|
1931
1931
|
});
|
|
1932
1932
|
e.template.update(n.id, { facingPages: !0 });
|
|
1933
|
-
for (let r of
|
|
1933
|
+
for (let r of Ne(n)) {
|
|
1934
1934
|
let i = r.id, a = r.id === n.page.id, o = a ? 18 : 12, s = a ? 12 : 18;
|
|
1935
1935
|
e.template.updatePage(i, { margins: {
|
|
1936
1936
|
bottom: 18,
|
|
@@ -1944,7 +1944,7 @@ function zn(e, t) {
|
|
|
1944
1944
|
fontSize: 20,
|
|
1945
1945
|
fontWeight: "700"
|
|
1946
1946
|
}
|
|
1947
|
-
}), Z(e, i,
|
|
1947
|
+
}), Z(e, i, g("designer.tutorial.documentFooter"), o, t.height - 13, t.width - 30, {
|
|
1948
1948
|
height: 6,
|
|
1949
1949
|
props: {
|
|
1950
1950
|
color: "#64748b",
|
|
@@ -1955,7 +1955,7 @@ function zn(e, t) {
|
|
|
1955
1955
|
}
|
|
1956
1956
|
e.template.applyToPages([e.document.data.pages[0].id], n.id), e.template.enterEdit(n.id);
|
|
1957
1957
|
}
|
|
1958
|
-
function
|
|
1958
|
+
function Vn(e, t) {
|
|
1959
1959
|
e.template.exitEdit();
|
|
1960
1960
|
let n = e.document.data.pages[0];
|
|
1961
1961
|
e.page.setActive(n.id);
|
|
@@ -2010,12 +2010,12 @@ function Bn(e, t) {
|
|
|
2010
2010
|
type: "array"
|
|
2011
2011
|
}
|
|
2012
2012
|
]
|
|
2013
|
-
}), Z(e, n.id,
|
|
2013
|
+
}), Z(e, n.id, g("designer.tutorial.documentNumber", {
|
|
2014
2014
|
date: "{{ bill.date }}",
|
|
2015
2015
|
number: "{{ bill.number }}"
|
|
2016
2016
|
}), 18, 33, t.width - 30), Z(e, n.id, `${X(t, "partnerLabel")}:{{ bill.partner }}`, 18, 41, t.width - 30);
|
|
2017
2017
|
}
|
|
2018
|
-
var
|
|
2018
|
+
var Hn = "tutorial-details", Un = 50, Wn = 22, Gn = 5, Kn = [
|
|
2019
2019
|
{
|
|
2020
2020
|
align: "left",
|
|
2021
2021
|
bind: "name",
|
|
@@ -2032,35 +2032,35 @@ var Vn = "tutorial-details", Hn = 50, Un = 22, Wn = 5, Gn = [
|
|
|
2032
2032
|
key: "columnAmount"
|
|
2033
2033
|
}
|
|
2034
2034
|
];
|
|
2035
|
-
function
|
|
2035
|
+
function qn(e, t) {
|
|
2036
2036
|
let n = e.document.data.pages[0], r = e.element.add("table", {
|
|
2037
2037
|
bindings: { rows: "bill.items" },
|
|
2038
|
-
height:
|
|
2039
|
-
id:
|
|
2038
|
+
height: Wn,
|
|
2039
|
+
id: Hn,
|
|
2040
2040
|
name: X(t, "detailsName"),
|
|
2041
2041
|
width: t.width - 36,
|
|
2042
2042
|
x: 18,
|
|
2043
|
-
y:
|
|
2043
|
+
y: Un
|
|
2044
2044
|
}, n.id);
|
|
2045
2045
|
if (!r) throw Error(`Tutorial page missing: ${n.id}`);
|
|
2046
|
-
e.element.updateProps(r.id, { columns:
|
|
2046
|
+
e.element.updateProps(r.id, { columns: Kn.map((e, n) => ({
|
|
2047
2047
|
align: e.align,
|
|
2048
2048
|
bind: e.bind,
|
|
2049
2049
|
title: X(t, e.key),
|
|
2050
2050
|
width: n === 0 ? 2 : 1
|
|
2051
2051
|
})) });
|
|
2052
2052
|
}
|
|
2053
|
-
function
|
|
2054
|
-
let n = e.document.data.pages[0], r = Z(e, n.id,
|
|
2053
|
+
function Jn(e, t) {
|
|
2054
|
+
let n = e.document.data.pages[0], r = Z(e, n.id, g("designer.tutorial.documentTotal", { amount: "{{ bill.total | currency }}" }), 18, 77, t.width - 36, { props: {
|
|
2055
2055
|
fontWeight: "700",
|
|
2056
2056
|
textAlign: "right"
|
|
2057
2057
|
} }), i = Z(e, n.id, X(t, "signature"), 18, 88, t.width - 36);
|
|
2058
2058
|
if (!e.followBlock.create(n.id, [r.id, i.id], {
|
|
2059
2059
|
id: "tutorial-details",
|
|
2060
2060
|
kind: "element"
|
|
2061
|
-
},
|
|
2061
|
+
}, Gn, g("designer.tutorial.documentSummary"))) throw Error("Tutorial follow block could not be created");
|
|
2062
2062
|
}
|
|
2063
|
-
function
|
|
2063
|
+
function Yn(e, t) {
|
|
2064
2064
|
let n = e.page.add(t.width, t.height, X(t, "attachmentTitle"), { templateId: "tutorial-template" });
|
|
2065
2065
|
Z(e, n.id, X(t, "attachmentTitle"), 18, 35, t.width - 36, {
|
|
2066
2066
|
height: 12,
|
|
@@ -2068,7 +2068,7 @@ function Jn(e, t) {
|
|
|
2068
2068
|
fontSize: 16,
|
|
2069
2069
|
fontWeight: "700"
|
|
2070
2070
|
}
|
|
2071
|
-
}), Z(e, n.id,
|
|
2071
|
+
}), Z(e, n.id, g("designer.tutorial.documentNumber", {
|
|
2072
2072
|
date: "{{ bill.date }}",
|
|
2073
2073
|
number: "{{ bill.number }}"
|
|
2074
2074
|
}), 18, 49, t.width - 36), Z(e, n.id, X(t, "attachmentBody"), 18, 61, t.width - 36, {
|
|
@@ -2076,53 +2076,53 @@ function Jn(e, t) {
|
|
|
2076
2076
|
props: { lineHeight: 1.8 }
|
|
2077
2077
|
}), Z(e, n.id, X(t, "signature"), 18, 105, t.width - 36);
|
|
2078
2078
|
}
|
|
2079
|
-
function
|
|
2079
|
+
function Xn(e) {
|
|
2080
2080
|
e.view.updateSettings({ previewWithData: !0 });
|
|
2081
2081
|
}
|
|
2082
|
-
var
|
|
2082
|
+
var Zn = [
|
|
2083
2083
|
{
|
|
2084
2084
|
id: "welcome",
|
|
2085
2085
|
target: "menu"
|
|
2086
2086
|
},
|
|
2087
2087
|
{
|
|
2088
|
-
apply:
|
|
2088
|
+
apply: zn,
|
|
2089
2089
|
id: "page",
|
|
2090
2090
|
target: "canvas"
|
|
2091
2091
|
},
|
|
2092
2092
|
{
|
|
2093
|
-
apply:
|
|
2093
|
+
apply: Bn,
|
|
2094
2094
|
id: "template",
|
|
2095
2095
|
target: "canvas"
|
|
2096
2096
|
},
|
|
2097
2097
|
{
|
|
2098
|
-
apply:
|
|
2098
|
+
apply: Vn,
|
|
2099
2099
|
id: "data",
|
|
2100
2100
|
target: "canvas"
|
|
2101
2101
|
},
|
|
2102
2102
|
{
|
|
2103
|
-
apply:
|
|
2103
|
+
apply: qn,
|
|
2104
2104
|
id: "table",
|
|
2105
2105
|
target: "canvas"
|
|
2106
2106
|
},
|
|
2107
2107
|
{
|
|
2108
|
-
apply:
|
|
2108
|
+
apply: Jn,
|
|
2109
2109
|
id: "follow",
|
|
2110
2110
|
target: "canvas"
|
|
2111
2111
|
},
|
|
2112
2112
|
{
|
|
2113
|
-
apply:
|
|
2113
|
+
apply: Yn,
|
|
2114
2114
|
id: "pages",
|
|
2115
2115
|
target: "canvas"
|
|
2116
2116
|
},
|
|
2117
2117
|
{
|
|
2118
|
-
apply:
|
|
2118
|
+
apply: Xn,
|
|
2119
2119
|
id: "preview",
|
|
2120
2120
|
target: "canvas"
|
|
2121
2121
|
}
|
|
2122
2122
|
];
|
|
2123
2123
|
// src/designer/stores/canvas-store.ts
|
|
2124
|
-
function
|
|
2125
|
-
let
|
|
2124
|
+
function Qn(e) {
|
|
2125
|
+
let t = e.elements ?? F;
|
|
2126
2126
|
return H("editor-canvas", () => {
|
|
2127
2127
|
let r = U(() => e.scope.pages.map((e) => ({
|
|
2128
2128
|
...e,
|
|
@@ -2137,23 +2137,23 @@ function Zn(e) {
|
|
|
2137
2137
|
pageCount: o.pages.length,
|
|
2138
2138
|
pageName: r.name,
|
|
2139
2139
|
pageNumber: o.pages.findIndex((e) => e.id === r.id) + 1
|
|
2140
|
-
}, u = new
|
|
2141
|
-
d.elements =
|
|
2140
|
+
}, u = new he(), d = n(c ? v(o) : {}, l);
|
|
2141
|
+
d.elements = t;
|
|
2142
2142
|
let f = e.repeatGroup.getByPage(r.id), p = /* @__PURE__ */ new Map();
|
|
2143
2143
|
return i.map((e) => {
|
|
2144
|
-
let
|
|
2145
|
-
a.resetSize && (
|
|
2146
|
-
...
|
|
2144
|
+
let n = O(o, e, t);
|
|
2145
|
+
a.resetSize && (n = {
|
|
2146
|
+
...n,
|
|
2147
2147
|
height: 0
|
|
2148
2148
|
});
|
|
2149
|
-
let
|
|
2150
|
-
if (
|
|
2149
|
+
let r = $n(n, t);
|
|
2150
|
+
if (r) return r;
|
|
2151
2151
|
if (!c) {
|
|
2152
|
-
let e = new Set(
|
|
2153
|
-
return l ?
|
|
2152
|
+
let e = new Set(t.get(n.type)?.previewExpressionKeys);
|
|
2153
|
+
return l ? s(n, l, u, e) : n;
|
|
2154
2154
|
}
|
|
2155
|
-
let
|
|
2156
|
-
return
|
|
2155
|
+
let i = er(n, d, f, p);
|
|
2156
|
+
return C(n, i, u, "preview");
|
|
2157
2157
|
});
|
|
2158
2158
|
}
|
|
2159
2159
|
return {
|
|
@@ -2162,7 +2162,7 @@ function Zn(e) {
|
|
|
2162
2162
|
};
|
|
2163
2163
|
})();
|
|
2164
2164
|
}
|
|
2165
|
-
function
|
|
2165
|
+
function $n(e, t) {
|
|
2166
2166
|
let n = t.get(e.type);
|
|
2167
2167
|
if (!n?.resolvePreviewProps) return;
|
|
2168
2168
|
let r = {
|
|
@@ -2181,22 +2181,22 @@ function Qn(e, t) {
|
|
|
2181
2181
|
...i
|
|
2182
2182
|
};
|
|
2183
2183
|
}
|
|
2184
|
-
function
|
|
2185
|
-
let
|
|
2186
|
-
if (!
|
|
2187
|
-
let
|
|
2188
|
-
if (!
|
|
2189
|
-
let e =
|
|
2190
|
-
|
|
2184
|
+
function er(e, t, n, r) {
|
|
2185
|
+
let i = n.find((t) => t.elementIds.includes(e.id));
|
|
2186
|
+
if (!i?.collection) return t;
|
|
2187
|
+
let a = r.get(i.id);
|
|
2188
|
+
if (!a) {
|
|
2189
|
+
let e = ne(t, i.collection);
|
|
2190
|
+
a = Array.isArray(e) ? e : [], r.set(i.id, a);
|
|
2191
2191
|
}
|
|
2192
|
-
return
|
|
2193
|
-
collectionPath:
|
|
2192
|
+
return a.length === 0 ? t : A(t, {
|
|
2193
|
+
collectionPath: i.collection,
|
|
2194
2194
|
index: 0,
|
|
2195
|
-
item:
|
|
2195
|
+
item: a[0]
|
|
2196
2196
|
});
|
|
2197
2197
|
}
|
|
2198
2198
|
// src/core/layout-references.ts
|
|
2199
|
-
function
|
|
2199
|
+
function tr(e, t) {
|
|
2200
2200
|
let n = new Set(t);
|
|
2201
2201
|
return JSON.parse(JSON.stringify({
|
|
2202
2202
|
elementGroups: (e.elementGroups ?? []).filter((e) => e.elementIds.every((e) => n.has(e))),
|
|
@@ -2204,7 +2204,7 @@ function er(e, t) {
|
|
|
2204
2204
|
repeatGroups: (e.repeatGroups ?? []).filter((e) => e.elementIds.every((e) => n.has(e)))
|
|
2205
2205
|
}));
|
|
2206
2206
|
}
|
|
2207
|
-
function
|
|
2207
|
+
function nr(e, t, n, r, i) {
|
|
2208
2208
|
function a(e, t) {
|
|
2209
2209
|
let n = e.get(t);
|
|
2210
2210
|
if (!n) throw Error(`Missing copied layout reference: ${t}`);
|
|
@@ -2234,9 +2234,9 @@ function tr(e, t, n, r, i) {
|
|
|
2234
2234
|
d = !1;
|
|
2235
2235
|
for (let e of l) u.has(e.id) && e.target.kind === "followBlock" && !u.has(e.target.id) && (u.delete(e.id), d = !0);
|
|
2236
2236
|
}
|
|
2237
|
-
|
|
2237
|
+
rr(e, t.elementGroups ?? [], n, r, i), c.length > 0 && (e.repeatGroups = [...e.repeatGroups ?? [], ...c]), u.size > 0 && (e.followBlocks = [...e.followBlocks ?? [], ...l.filter((e) => u.has(e.id))]);
|
|
2238
2238
|
}
|
|
2239
|
-
function
|
|
2239
|
+
function rr(e, t, n, r, i) {
|
|
2240
2240
|
if (t.length === 0) return;
|
|
2241
2241
|
let a = new Map(t.map((e) => [e.id, i("layer-group")])), o = [];
|
|
2242
2242
|
for (let e of t) {
|
|
@@ -2250,10 +2250,10 @@ function nr(e, t, n, r, i) {
|
|
|
2250
2250
|
let s = e.parentId ? a.get(e.parentId) : void 0;
|
|
2251
2251
|
s && (i.parentId = s), o.push(i);
|
|
2252
2252
|
}
|
|
2253
|
-
e.elementGroups = [...e.elementGroups ?? [], ...o],
|
|
2253
|
+
e.elementGroups = [...e.elementGroups ?? [], ...o], de(e);
|
|
2254
2254
|
}
|
|
2255
2255
|
// src/designer/stores/clipboard-store.ts
|
|
2256
|
-
function
|
|
2256
|
+
function ir(e) {
|
|
2257
2257
|
return H("editor-clipboard", ({ action: t }) => {
|
|
2258
2258
|
let { unlockedNodes: n } = G(e.selection), r = e.ui.toast, i = e.element.removeSelected, { active: a } = G(e.scope), o = e.history.commit, s = W([]), c = W([]), l = W({
|
|
2259
2259
|
elementGroups: [],
|
|
@@ -2261,7 +2261,7 @@ function rr(e) {
|
|
|
2261
2261
|
repeatGroups: []
|
|
2262
2262
|
}), u = t(() => {
|
|
2263
2263
|
let t = n.value;
|
|
2264
|
-
t.length !== 0 && (s.value = t.map((e) =>
|
|
2264
|
+
t.length !== 0 && (s.value = t.map((e) => z(e)), c.value = b(e.document.data.templates ?? []), l.value = tr(e.document.data, t.map((e) => e.id)), r(g("designer.clipboardStore.selectionCopiedMessage", { count: t.length })));
|
|
2265
2265
|
}, "copy"), d = t(() => {
|
|
2266
2266
|
u(), i();
|
|
2267
2267
|
}, "cut"), f = t(() => {
|
|
@@ -2270,13 +2270,13 @@ function rr(e) {
|
|
|
2270
2270
|
if (!t) return;
|
|
2271
2271
|
let n = [], i = /* @__PURE__ */ new Map();
|
|
2272
2272
|
for (let r of s.value) {
|
|
2273
|
-
let a =
|
|
2274
|
-
a.id =
|
|
2273
|
+
let a = z(r);
|
|
2274
|
+
a.id = V("el"), Object.assign(a, De(a, 3, 3)), M(e.document.data, r, a, e.elements ?? F, {
|
|
2275
2275
|
...e.document.data,
|
|
2276
2276
|
templates: c.value
|
|
2277
2277
|
}), t.elements.push(a), n.push(a.id), i.set(r.id, a.id);
|
|
2278
2278
|
}
|
|
2279
|
-
e.document.data.pages.some((e) => e.id === t.id) &&
|
|
2279
|
+
e.document.data.pages.some((e) => e.id === t.id) && nr(e.document.data, l.value, i, t.id, V), e.selection.set(n), o(), r(g("designer.clipboardStore.selectionPastedMessage", { count: n.length }), "success");
|
|
2280
2280
|
}, "paste");
|
|
2281
2281
|
return {
|
|
2282
2282
|
copy: u,
|
|
@@ -2288,17 +2288,17 @@ function rr(e) {
|
|
|
2288
2288
|
})();
|
|
2289
2289
|
}
|
|
2290
2290
|
// src/designer/stores/config-store.ts
|
|
2291
|
-
function
|
|
2291
|
+
function ar() {
|
|
2292
2292
|
return H("editor-config", () => {
|
|
2293
|
-
let e = W(
|
|
2293
|
+
let e = W(f());
|
|
2294
2294
|
function t(t) {
|
|
2295
|
-
e.value =
|
|
2295
|
+
e.value = f({ rendering: {
|
|
2296
2296
|
...e.value.rendering,
|
|
2297
2297
|
...t.rendering
|
|
2298
2298
|
} });
|
|
2299
2299
|
}
|
|
2300
2300
|
function n() {
|
|
2301
|
-
e.value =
|
|
2301
|
+
e.value = f();
|
|
2302
2302
|
}
|
|
2303
2303
|
return {
|
|
2304
2304
|
configure: t,
|
|
@@ -2308,7 +2308,7 @@ function ir() {
|
|
|
2308
2308
|
})();
|
|
2309
2309
|
}
|
|
2310
2310
|
// src/designer/stores/data-source-store.ts
|
|
2311
|
-
function
|
|
2311
|
+
function or(e) {
|
|
2312
2312
|
return H("editor-dataSource", () => {
|
|
2313
2313
|
let { data: t } = G(e.document), n = e.history.commit, r = U(() => t.value.dataSources ?? []);
|
|
2314
2314
|
function i(e) {
|
|
@@ -2317,7 +2317,7 @@ function ar(e) {
|
|
|
2317
2317
|
function a(e, r = e.key) {
|
|
2318
2318
|
let i = t.value.dataSources ?? (t.value.dataSources = []), a = i.findIndex((e) => e.key === r);
|
|
2319
2319
|
if (r !== e.key) {
|
|
2320
|
-
if (i.some((t) => t.key === e.key)) throw new
|
|
2320
|
+
if (i.some((t) => t.key === e.key)) throw new h(g("designer.dataSourceDialog.duplicateKeyError", { sourceKey: e.key }));
|
|
2321
2321
|
if (a < 0) throw Error(`Data source not found: ${r}`);
|
|
2322
2322
|
}
|
|
2323
2323
|
a >= 0 ? i.splice(a, 1, e) : i.push(e), n();
|
|
@@ -2338,14 +2338,14 @@ function ar(e) {
|
|
|
2338
2338
|
})();
|
|
2339
2339
|
}
|
|
2340
2340
|
// src/designer/template-library/builtin/welcome.json
|
|
2341
|
-
var
|
|
2342
|
-
dataSources: () =>
|
|
2343
|
-
default: () =>
|
|
2344
|
-
name: () =>
|
|
2345
|
-
pages: () =>
|
|
2346
|
-
templates: () =>
|
|
2341
|
+
var sr = /* @__PURE__ */ e({
|
|
2342
|
+
dataSources: () => cr,
|
|
2343
|
+
default: () => fr,
|
|
2344
|
+
name: () => lr,
|
|
2345
|
+
pages: () => ur,
|
|
2346
|
+
templates: () => dr,
|
|
2347
2347
|
version: () => "1.0"
|
|
2348
|
-
}),
|
|
2348
|
+
}), cr = [], lr = "欢迎模板(横向 A4)", ur = [{
|
|
2349
2349
|
background: "#f5f3ee",
|
|
2350
2350
|
elements: [
|
|
2351
2351
|
{
|
|
@@ -2976,7 +2976,7 @@ var or = /* @__PURE__ */ e({
|
|
|
2976
2976
|
name: "横向 A4",
|
|
2977
2977
|
templateId: "template-blank",
|
|
2978
2978
|
width: 297
|
|
2979
|
-
}],
|
|
2979
|
+
}], dr = [{
|
|
2980
2980
|
builtin: !0,
|
|
2981
2981
|
id: "template-blank",
|
|
2982
2982
|
name: "空白模板",
|
|
@@ -2989,98 +2989,98 @@ var or = /* @__PURE__ */ e({
|
|
|
2989
2989
|
name: "空白模板",
|
|
2990
2990
|
width: 297
|
|
2991
2991
|
}
|
|
2992
|
-
}],
|
|
2993
|
-
dataSources:
|
|
2994
|
-
name:
|
|
2995
|
-
pages:
|
|
2996
|
-
templates:
|
|
2992
|
+
}], fr = {
|
|
2993
|
+
dataSources: cr,
|
|
2994
|
+
name: lr,
|
|
2995
|
+
pages: ur,
|
|
2996
|
+
templates: dr,
|
|
2997
2997
|
version: "1.0"
|
|
2998
|
-
},
|
|
2998
|
+
}, pr = {
|
|
2999
2999
|
costSheet: () => import("./cost-sheet-Dwg0rt_l.js"),
|
|
3000
3000
|
invoice: () => import("./invoice-DuBN6ZCM.js"),
|
|
3001
3001
|
purchaseOrder: () => import("./purchase-order-DNBFPpEZ.js"),
|
|
3002
|
-
welcome: () => Promise.resolve().then(() =>
|
|
3002
|
+
welcome: () => Promise.resolve().then(() => sr)
|
|
3003
3003
|
};
|
|
3004
|
-
function
|
|
3005
|
-
return structuredClone(
|
|
3004
|
+
function mr() {
|
|
3005
|
+
return structuredClone(fr);
|
|
3006
3006
|
}
|
|
3007
|
-
async function
|
|
3007
|
+
async function hr(e) {
|
|
3008
3008
|
try {
|
|
3009
|
-
let t = await
|
|
3009
|
+
let t = await pr[e]();
|
|
3010
3010
|
return structuredClone(t.default);
|
|
3011
3011
|
} catch (t) {
|
|
3012
|
-
throw new
|
|
3012
|
+
throw new h(g("designer.templateLibrary.builtinFailed", { id: `builtin.${e}` }), {
|
|
3013
3013
|
cause: t,
|
|
3014
3014
|
code: "template-library.builtin-failed"
|
|
3015
3015
|
});
|
|
3016
3016
|
}
|
|
3017
3017
|
}
|
|
3018
|
-
function
|
|
3018
|
+
function gr() {
|
|
3019
3019
|
return {
|
|
3020
3020
|
id: "builtin",
|
|
3021
3021
|
list() {
|
|
3022
3022
|
return [
|
|
3023
3023
|
{
|
|
3024
|
-
category:
|
|
3025
|
-
description:
|
|
3024
|
+
category: g("designer.templateLibrary.categoryBasic"),
|
|
3025
|
+
description: g("designer.templateLibrary.welcomeDescription"),
|
|
3026
3026
|
id: "builtin.welcome",
|
|
3027
|
-
load: () =>
|
|
3028
|
-
name:
|
|
3027
|
+
load: () => hr("welcome"),
|
|
3028
|
+
name: g("designer.templateLibrary.welcomeName")
|
|
3029
3029
|
},
|
|
3030
3030
|
{
|
|
3031
|
-
category:
|
|
3032
|
-
description:
|
|
3031
|
+
category: g("designer.templateLibrary.categoryBusiness"),
|
|
3032
|
+
description: g("designer.templateLibrary.purchaseOrderDescription"),
|
|
3033
3033
|
id: "builtin.purchaseOrder",
|
|
3034
|
-
load: () =>
|
|
3035
|
-
name:
|
|
3034
|
+
load: () => hr("purchaseOrder"),
|
|
3035
|
+
name: g("designer.templateLibrary.purchaseOrderName")
|
|
3036
3036
|
},
|
|
3037
3037
|
{
|
|
3038
|
-
category:
|
|
3039
|
-
description:
|
|
3038
|
+
category: g("designer.templateLibrary.categoryBusiness"),
|
|
3039
|
+
description: g("designer.templateLibrary.costSheetDescription"),
|
|
3040
3040
|
id: "builtin.costSheet",
|
|
3041
|
-
load: () =>
|
|
3042
|
-
name:
|
|
3041
|
+
load: () => hr("costSheet"),
|
|
3042
|
+
name: g("designer.templateLibrary.costSheetName")
|
|
3043
3043
|
},
|
|
3044
3044
|
{
|
|
3045
|
-
category:
|
|
3046
|
-
description:
|
|
3045
|
+
category: g("designer.templateLibrary.categoryBusiness"),
|
|
3046
|
+
description: g("designer.templateLibrary.invoiceDescription"),
|
|
3047
3047
|
id: "builtin.invoice",
|
|
3048
|
-
load: () =>
|
|
3049
|
-
name:
|
|
3048
|
+
load: () => hr("invoice"),
|
|
3049
|
+
name: g("designer.templateLibrary.invoiceName")
|
|
3050
3050
|
}
|
|
3051
3051
|
];
|
|
3052
3052
|
},
|
|
3053
|
-
title: () =>
|
|
3053
|
+
title: () => g("designer.templateLibrary.builtinTitle")
|
|
3054
3054
|
};
|
|
3055
3055
|
}
|
|
3056
3056
|
// src/designer/stores/document-store.ts
|
|
3057
|
-
var
|
|
3058
|
-
function
|
|
3057
|
+
var _r = "print-studio:document";
|
|
3058
|
+
function vr(e) {
|
|
3059
3059
|
if (e.initialDocument) {
|
|
3060
|
-
let t =
|
|
3061
|
-
if (e.strictInitialDocument && t.skippedTypes.length > 0) throw new
|
|
3060
|
+
let t = je(b(e.initialDocument), e.elements);
|
|
3061
|
+
if (e.strictInitialDocument && t.skippedTypes.length > 0) throw new h(g("designer.documentStore.skippedElementTypesMessage", { elementTypes: t.skippedTypes.join(", ") }), { code: "document.unsupported-elements" });
|
|
3062
3062
|
return t.document;
|
|
3063
3063
|
}
|
|
3064
3064
|
try {
|
|
3065
3065
|
let t = null;
|
|
3066
|
-
if (e.storage ? t = e.storage.get() : e.storage !== !1 && (t = localStorage.getItem(
|
|
3067
|
-
let { document: n, skippedTypes: r } =
|
|
3068
|
-
return r.length > 0 && console.warn(
|
|
3066
|
+
if (e.storage ? t = e.storage.get() : e.storage !== !1 && (t = localStorage.getItem(_r)), t) {
|
|
3067
|
+
let { document: n, skippedTypes: r } = je(JSON.parse(t), e.elements);
|
|
3068
|
+
return r.length > 0 && console.warn(g("designer.documentStore.skippedElementTypesDetail", { elementTypes: r.join(", ") })), n;
|
|
3069
3069
|
}
|
|
3070
3070
|
} catch (t) {
|
|
3071
|
-
let n = new
|
|
3071
|
+
let n = new h(g("designer.documentStore.autoSaveRestoreFailed"), {
|
|
3072
3072
|
cause: t,
|
|
3073
3073
|
code: "document.restore-failed",
|
|
3074
|
-
detail:
|
|
3074
|
+
detail: g("designer.documentStore.autoSaveRestoreFailedDetail")
|
|
3075
3075
|
});
|
|
3076
|
-
(e.errors ??
|
|
3076
|
+
(e.errors ?? cn()).capture(n, { source: "store.init" });
|
|
3077
3077
|
}
|
|
3078
|
-
let t = e.createDocument?.() ??
|
|
3079
|
-
return
|
|
3078
|
+
let t = e.createDocument?.() ?? je(mr(), e.elements).document;
|
|
3079
|
+
return ke(t), t;
|
|
3080
3080
|
}
|
|
3081
|
-
function
|
|
3081
|
+
function yr(e) {
|
|
3082
3082
|
return H("editor-document", () => {
|
|
3083
|
-
let t = e.ui.toast, n = W(
|
|
3083
|
+
let t = e.ui.toast, n = W(vr(e)), r = W(JSON.stringify(n.value)), i = W(!1), a = W([]), o = W(null), s = U(() => JSON.stringify(a.value[0] ?? n.value) !== r.value), c, l = 0, u, d = 0;
|
|
3084
3084
|
function f() {
|
|
3085
3085
|
d += 1, clearTimeout(u);
|
|
3086
3086
|
let e = !1;
|
|
@@ -3095,95 +3095,95 @@ function vr(e) {
|
|
|
3095
3095
|
], () => {
|
|
3096
3096
|
clearTimeout(u), o.value || a.value.length > 0 || e.storage === !1 || d > 0 || (u = setTimeout(() => {
|
|
3097
3097
|
if (!(d > 0)) try {
|
|
3098
|
-
e.storage ? e.storage.set(JSON.stringify(n.value)) : localStorage.setItem(
|
|
3098
|
+
e.storage ? e.storage.set(JSON.stringify(n.value)) : localStorage.setItem(_r, JSON.stringify(n.value));
|
|
3099
3099
|
} catch (t) {
|
|
3100
|
-
let n = new
|
|
3100
|
+
let n = new h(g("designer.documentStore.autoSaveFailed"), {
|
|
3101
3101
|
cause: t,
|
|
3102
3102
|
code: "document.autosave-failed"
|
|
3103
3103
|
});
|
|
3104
|
-
(e.errors ??
|
|
3104
|
+
(e.errors ?? cn()).capture(n, { source: "store.autosave" });
|
|
3105
3105
|
}
|
|
3106
3106
|
}, 600));
|
|
3107
3107
|
}, { deep: !0 });
|
|
3108
3108
|
function p() {
|
|
3109
|
-
let r = e.createDocument?.() ??
|
|
3110
|
-
|
|
3109
|
+
let r = e.createDocument?.() ?? fe();
|
|
3110
|
+
ke(r), l += 1, n.value = r, n.value.pages[0].elements = [], n.value.pages[0].name = g("designer.documentStore.initialPageName"), e.resetSession(), e.commitHistory(), t(g("designer.documentStore.documentCreatedMessage"));
|
|
3111
3111
|
}
|
|
3112
3112
|
function m(i) {
|
|
3113
3113
|
let a;
|
|
3114
3114
|
try {
|
|
3115
3115
|
a = JSON.parse(i);
|
|
3116
3116
|
} catch (e) {
|
|
3117
|
-
throw new
|
|
3117
|
+
throw new h(g("designer.documentStore.invalidDocumentMessage"), {
|
|
3118
3118
|
cause: e,
|
|
3119
3119
|
code: "document.invalid"
|
|
3120
3120
|
});
|
|
3121
3121
|
}
|
|
3122
|
-
let { document: o, skippedTypes: s } =
|
|
3123
|
-
l += 1, n.value = o, r.value = JSON.stringify(o), e.resetSession(), e.resetHistory(), s.length > 0 ? t(
|
|
3122
|
+
let { document: o, skippedTypes: s } = je(a, e.elements);
|
|
3123
|
+
l += 1, n.value = o, r.value = JSON.stringify(o), e.resetSession(), e.resetHistory(), s.length > 0 ? t(g("designer.documentStore.skippedElementTypesMessage", { elementTypes: s.join(", ") }), "error") : t(g("designer.documentStore.documentOpenedMessage", { documentName: o.name }), "success");
|
|
3124
3124
|
}
|
|
3125
|
-
function
|
|
3125
|
+
function _(t) {
|
|
3126
3126
|
t.trim() && (n.value.name = t.trim(), e.commitHistory());
|
|
3127
3127
|
}
|
|
3128
|
-
function
|
|
3128
|
+
function v(e) {
|
|
3129
3129
|
m(JSON.stringify(e));
|
|
3130
3130
|
}
|
|
3131
|
-
function
|
|
3132
|
-
return
|
|
3131
|
+
function y() {
|
|
3132
|
+
return b(a.value[0] ?? n.value);
|
|
3133
3133
|
}
|
|
3134
|
-
function
|
|
3135
|
-
return
|
|
3134
|
+
function x() {
|
|
3135
|
+
return b(o.value?.document ?? a.value[0] ?? n.value);
|
|
3136
3136
|
}
|
|
3137
|
-
function
|
|
3138
|
-
clearTimeout(u), e.beginPreviewHistory(), a.value.push(
|
|
3137
|
+
function S() {
|
|
3138
|
+
clearTimeout(u), e.beginPreviewHistory(), a.value.push(b(n.value));
|
|
3139
3139
|
}
|
|
3140
|
-
function
|
|
3140
|
+
function C() {
|
|
3141
3141
|
let t = a.value.at(-1);
|
|
3142
3142
|
t && (e.resetPreviewSession(() => {
|
|
3143
|
-
n.value =
|
|
3143
|
+
n.value = b(t);
|
|
3144
3144
|
}), e.resetHistory());
|
|
3145
3145
|
}
|
|
3146
|
-
function C(t) {
|
|
3147
|
-
a.value.length !== 0 && (t || b(), a.value.pop(), e.finishPreviewHistory(t));
|
|
3148
|
-
}
|
|
3149
3146
|
function w(t) {
|
|
3147
|
+
a.value.length !== 0 && (t || C(), a.value.pop(), e.finishPreviewHistory(t));
|
|
3148
|
+
}
|
|
3149
|
+
function T(t) {
|
|
3150
3150
|
if (o.value || i.value) throw Error("Document session is busy");
|
|
3151
|
-
|
|
3152
|
-
document:
|
|
3151
|
+
ke(t), clearTimeout(u), o.value = {
|
|
3152
|
+
document: y(),
|
|
3153
3153
|
savedSnapshot: r.value
|
|
3154
|
-
}, l += 1, n.value =
|
|
3154
|
+
}, l += 1, n.value = b(t), e.resetSession(), e.resetHistory();
|
|
3155
3155
|
}
|
|
3156
|
-
function
|
|
3156
|
+
function E(t) {
|
|
3157
3157
|
let i = o.value;
|
|
3158
3158
|
i && (l += 1, t || (n.value = i.document), r.value = i.savedSnapshot, o.value = null, e.resetSession());
|
|
3159
3159
|
}
|
|
3160
3160
|
function D() {
|
|
3161
|
-
if (o.value) return t(
|
|
3161
|
+
if (o.value) return t(g("designer.documentStore.saveAfterTemporarySession")), Promise.resolve();
|
|
3162
3162
|
if (c) return c;
|
|
3163
3163
|
let n = e.onSave;
|
|
3164
3164
|
if (!n) throw Error("No template save handler configured");
|
|
3165
|
-
let a =
|
|
3165
|
+
let a = y(), s = JSON.stringify(a), u = l;
|
|
3166
3166
|
return i.value = !0, c = Promise.resolve().then(() => n(a)).then(() => {
|
|
3167
3167
|
u === l && (r.value = s);
|
|
3168
3168
|
}).finally(() => {
|
|
3169
3169
|
i.value = !1, c = void 0;
|
|
3170
3170
|
}), c;
|
|
3171
3171
|
}
|
|
3172
|
-
return
|
|
3173
|
-
beginPreview:
|
|
3174
|
-
beginTemporary:
|
|
3172
|
+
return Ve(() => clearTimeout(u)), {
|
|
3173
|
+
beginPreview: S,
|
|
3174
|
+
beginTemporary: T,
|
|
3175
3175
|
create: p,
|
|
3176
3176
|
data: n,
|
|
3177
3177
|
dirty: s,
|
|
3178
|
-
finishPreview:
|
|
3179
|
-
finishTemporary:
|
|
3180
|
-
getDocument:
|
|
3181
|
-
getPersistentDocument:
|
|
3178
|
+
finishPreview: w,
|
|
3179
|
+
finishTemporary: E,
|
|
3180
|
+
getDocument: y,
|
|
3181
|
+
getPersistentDocument: x,
|
|
3182
3182
|
hasSaveHandler: !!e.onSave,
|
|
3183
|
-
load:
|
|
3183
|
+
load: v,
|
|
3184
3184
|
loadJson: m,
|
|
3185
|
-
rename:
|
|
3186
|
-
resetPreview:
|
|
3185
|
+
rename: _,
|
|
3186
|
+
resetPreview: C,
|
|
3187
3187
|
save: D,
|
|
3188
3188
|
saving: i,
|
|
3189
3189
|
suspendPersistence: f
|
|
@@ -3191,14 +3191,14 @@ function vr(e) {
|
|
|
3191
3191
|
})();
|
|
3192
3192
|
}
|
|
3193
3193
|
// src/designer/stores/element-group-store.ts
|
|
3194
|
-
function
|
|
3194
|
+
function br(e) {
|
|
3195
3195
|
return H("editor-elementGroup", ({ action: t }) => {
|
|
3196
3196
|
let { data: n } = G(e.document), { active: r } = G(e.scope), { ids: i } = G(e.selection), a = e.history.commit, o = W([]), s = U(() => n.value.elementGroups ?? []);
|
|
3197
3197
|
function c(e) {
|
|
3198
3198
|
return s.value.find((t) => t.id === e);
|
|
3199
3199
|
}
|
|
3200
3200
|
function l(e) {
|
|
3201
|
-
return
|
|
3201
|
+
return L(n.value, e.pageId);
|
|
3202
3202
|
}
|
|
3203
3203
|
function u(e) {
|
|
3204
3204
|
return s.value.filter((t) => t.pageId === e);
|
|
@@ -3210,14 +3210,14 @@ function yr(e) {
|
|
|
3210
3210
|
return n.elements.filter((e) => r.has(e.id));
|
|
3211
3211
|
}
|
|
3212
3212
|
function f(e) {
|
|
3213
|
-
let t =
|
|
3214
|
-
return t ?
|
|
3213
|
+
let t = L(n.value, e);
|
|
3214
|
+
return t ? se(t, s.value) : [];
|
|
3215
3215
|
}
|
|
3216
3216
|
function p(e) {
|
|
3217
3217
|
return o.value.includes(e);
|
|
3218
3218
|
}
|
|
3219
3219
|
function m(e) {
|
|
3220
|
-
return
|
|
3220
|
+
return Oe(f(e), p);
|
|
3221
3221
|
}
|
|
3222
3222
|
function h(e) {
|
|
3223
3223
|
let t = s.value.filter((t) => t.elementIds.includes(e)), n;
|
|
@@ -3228,19 +3228,19 @@ function yr(e) {
|
|
|
3228
3228
|
let n = d(e);
|
|
3229
3229
|
return n.length > 0 && n.every((e) => e[t]);
|
|
3230
3230
|
}
|
|
3231
|
-
let _ = U(() => i.value.length === 0 ? null :
|
|
3231
|
+
let _ = U(() => i.value.length === 0 ? null : Se(f(r.value.id), i.value) ?? null), v = t((t, o) => {
|
|
3232
3232
|
let l = r.value, u = (t ?? i.value).filter((e) => l.elements.some((t) => t.id === e));
|
|
3233
3233
|
if (u.length === 0) return null;
|
|
3234
|
-
let d =
|
|
3235
|
-
if (!
|
|
3236
|
-
|
|
3234
|
+
let d = le(n.value, l.id, V, o), f = se(l, s.value);
|
|
3235
|
+
if (!ye(f, u, d)) return null;
|
|
3236
|
+
_e(n.value, l, f);
|
|
3237
3237
|
let p = c(d.id);
|
|
3238
3238
|
return p ? (e.selection.set([...p.elementIds]), a(), p) : null;
|
|
3239
3239
|
}, "create"), y = t((t) => {
|
|
3240
3240
|
let r = c(t), i = r ? l(r) : void 0;
|
|
3241
3241
|
if (!r || !i) return;
|
|
3242
|
-
let u = [...r.elementIds], d =
|
|
3243
|
-
|
|
3242
|
+
let u = [...r.elementIds], d = se(i, s.value);
|
|
3243
|
+
Ae(d, t) && (_e(n.value, i, d), o.value = o.value.filter((e) => e !== t), e.selection.set(u), a());
|
|
3244
3244
|
}, "ungroup"), b = t((t, n = !1) => {
|
|
3245
3245
|
let r = c(t);
|
|
3246
3246
|
r && (n ? e.element.removeIds([...r.elementIds]) : y(t));
|
|
@@ -3288,21 +3288,21 @@ function yr(e) {
|
|
|
3288
3288
|
})();
|
|
3289
3289
|
}
|
|
3290
3290
|
// src/core/align.ts
|
|
3291
|
-
var
|
|
3291
|
+
var xr = {
|
|
3292
3292
|
bottom: "y",
|
|
3293
3293
|
hcenter: "x",
|
|
3294
3294
|
left: "x",
|
|
3295
3295
|
right: "x",
|
|
3296
3296
|
top: "y",
|
|
3297
3297
|
vcenter: "y"
|
|
3298
|
-
},
|
|
3299
|
-
function Sr(e) {
|
|
3300
|
-
return br[e];
|
|
3301
|
-
}
|
|
3298
|
+
}, Sr = 1e-6;
|
|
3302
3299
|
function Cr(e) {
|
|
3300
|
+
return xr[e];
|
|
3301
|
+
}
|
|
3302
|
+
function wr(e) {
|
|
3303
3303
|
return e === "h" ? "x" : "y";
|
|
3304
3304
|
}
|
|
3305
|
-
function
|
|
3305
|
+
function Tr(e, t) {
|
|
3306
3306
|
return t === "x" ? {
|
|
3307
3307
|
end: e.x + e.width,
|
|
3308
3308
|
start: e.x
|
|
@@ -3311,55 +3311,55 @@ function wr(e, t) {
|
|
|
3311
3311
|
start: e.y
|
|
3312
3312
|
};
|
|
3313
3313
|
}
|
|
3314
|
-
function
|
|
3315
|
-
let { end: n, start: r } =
|
|
3314
|
+
function Er(e, t) {
|
|
3315
|
+
let { end: n, start: r } = Tr(e, xr[t]);
|
|
3316
3316
|
return t === "left" || t === "top" ? r : t === "right" || t === "bottom" ? n : (r + n) / 2;
|
|
3317
3317
|
}
|
|
3318
|
-
function
|
|
3318
|
+
function Dr(e) {
|
|
3319
3319
|
let t = /* @__PURE__ */ new Map();
|
|
3320
|
-
for (let [n, r] of e) Math.abs(r) >
|
|
3320
|
+
for (let [n, r] of e) Math.abs(r) > Sr && t.set(n, r);
|
|
3321
3321
|
return t;
|
|
3322
3322
|
}
|
|
3323
|
-
function
|
|
3323
|
+
function Or(e, t) {
|
|
3324
3324
|
let { keyId: n, pageBounds: r, target: i = "selection" } = t;
|
|
3325
3325
|
if (r && (i === "page" || i === "selection" && e.length === 1)) return r;
|
|
3326
3326
|
if (i === "key") {
|
|
3327
3327
|
let t = e.find((e) => e.id === n);
|
|
3328
3328
|
if (t) return t.box;
|
|
3329
3329
|
}
|
|
3330
|
-
return
|
|
3330
|
+
return be(e.map((e) => e.box));
|
|
3331
3331
|
}
|
|
3332
|
-
function
|
|
3332
|
+
function kr(e, t, n = {}) {
|
|
3333
3333
|
if (e.length === 0) return /* @__PURE__ */ new Map();
|
|
3334
|
-
let r =
|
|
3334
|
+
let r = Or(e, n);
|
|
3335
3335
|
if (!r) return /* @__PURE__ */ new Map();
|
|
3336
|
-
let i =
|
|
3337
|
-
return
|
|
3336
|
+
let i = Er(r, t);
|
|
3337
|
+
return Dr(e.map((e) => [e.id, i - Er(e.box, t)]));
|
|
3338
3338
|
}
|
|
3339
|
-
function
|
|
3339
|
+
function Ar(e, t, n = {}) {
|
|
3340
3340
|
if (e.length < 3) return null;
|
|
3341
|
-
let r =
|
|
3341
|
+
let r = xr[t], i = e.map((e) => ({
|
|
3342
3342
|
item: e,
|
|
3343
|
-
point:
|
|
3343
|
+
point: Er(e.box, t)
|
|
3344
3344
|
})).sort((e, t) => e.point - t.point), a = i[0], o = i[i.length - 1], s = a.point, c = o.point;
|
|
3345
3345
|
if (n.target === "page" && n.pageBounds) {
|
|
3346
|
-
let e =
|
|
3346
|
+
let e = Tr(n.pageBounds, r), t = Tr(a.item.box, r), i = Tr(o.item.box, r);
|
|
3347
3347
|
s = e.start + (a.point - t.start), c = e.end - (i.end - o.point);
|
|
3348
3348
|
}
|
|
3349
3349
|
let l = (c - s) / (i.length - 1);
|
|
3350
|
-
return
|
|
3350
|
+
return Dr(i.map(({ item: e, point: t }, n) => [e.id, s + l * n - t]));
|
|
3351
3351
|
}
|
|
3352
|
-
function
|
|
3353
|
-
let r =
|
|
3352
|
+
function jr(e, t, n = {}) {
|
|
3353
|
+
let r = wr(t), i = typeof n.spacing == "number" && Number.isFinite(n.spacing) ? n.spacing : null;
|
|
3354
3354
|
if (e.length < (i === null ? 3 : 2)) return null;
|
|
3355
3355
|
let a = e.map((e) => ({
|
|
3356
3356
|
item: e,
|
|
3357
|
-
...
|
|
3357
|
+
...Tr(e.box, r)
|
|
3358
3358
|
})).sort((e, t) => e.start - t.start || e.end - t.end), o = a.map((e) => e.end - e.start), s = [];
|
|
3359
3359
|
if (i === null) {
|
|
3360
3360
|
let e = a[0], t = a[a.length - 1], i = e.start, c = t.end;
|
|
3361
3361
|
if (n.target === "page" && n.pageBounds) {
|
|
3362
|
-
let e =
|
|
3362
|
+
let e = Tr(n.pageBounds, r);
|
|
3363
3363
|
i = e.start, c = e.end;
|
|
3364
3364
|
}
|
|
3365
3365
|
let l = o.reduce((e, t) => e + t, 0), u = (c - i - l) / (a.length - 1), d = i;
|
|
@@ -3370,156 +3370,156 @@ function Ar(e, t, n = {}) {
|
|
|
3370
3370
|
for (let e = t + 1; e < a.length; e++) s[e] = s[e - 1] + o[e - 1] + i;
|
|
3371
3371
|
for (let e = t - 1; e >= 0; e--) s[e] = s[e + 1] - i - o[e];
|
|
3372
3372
|
}
|
|
3373
|
-
return
|
|
3373
|
+
return Dr(a.map((e, t) => [e.item.id, s[t] - e.start]));
|
|
3374
3374
|
}
|
|
3375
3375
|
// src/designer/stores/element-store.ts
|
|
3376
|
-
function
|
|
3377
|
-
let t = e.elements ??
|
|
3376
|
+
function Mr(e) {
|
|
3377
|
+
let t = e.elements ?? F;
|
|
3378
3378
|
return H("editor-element", ({ action: n }) => {
|
|
3379
3379
|
let { data: r } = G(e.document), { active: i } = G(e.scope), a = e.history.commit, { ids: o, nodes: s } = G(e.selection), c = e.ui.toast;
|
|
3380
3380
|
function l(e) {
|
|
3381
|
-
return
|
|
3381
|
+
return L(r.value, e);
|
|
3382
3382
|
}
|
|
3383
3383
|
let u = W(null), d = W("");
|
|
3384
3384
|
function f(e, n) {
|
|
3385
|
-
Object.assign(e,
|
|
3385
|
+
Object.assign(e, te(e, { width: e.width }, t, { enforceMinimum: !1 })), u.value = e, d.value = n;
|
|
3386
3386
|
}
|
|
3387
3387
|
function p(e) {
|
|
3388
|
-
u.value && Object.assign(u.value,
|
|
3388
|
+
u.value && Object.assign(u.value, te(u.value, e, t, { enforceMinimum: !1 }));
|
|
3389
3389
|
}
|
|
3390
3390
|
let m = n(() => {
|
|
3391
3391
|
u.value = null, d.value = "";
|
|
3392
3392
|
}, "cancelDraft");
|
|
3393
3393
|
function h(e) {
|
|
3394
|
-
return
|
|
3394
|
+
return Pe(r.value, e);
|
|
3395
3395
|
}
|
|
3396
|
-
function
|
|
3396
|
+
function _(e) {
|
|
3397
3397
|
return h(e)?.node;
|
|
3398
3398
|
}
|
|
3399
|
-
function
|
|
3400
|
-
return e.map((e) =>
|
|
3399
|
+
function v(e) {
|
|
3400
|
+
return e.map((e) => _(e)).filter((e) => e !== void 0);
|
|
3401
3401
|
}
|
|
3402
|
-
function
|
|
3402
|
+
function y(e, t = {}) {
|
|
3403
3403
|
return (l(e)?.elements ?? []).filter((e) => (t.visible === void 0 || e.visible === t.visible) && (t.locked === void 0 || e.locked === t.locked));
|
|
3404
3404
|
}
|
|
3405
|
-
let
|
|
3405
|
+
let b = n((e, n = {}, o) => {
|
|
3406
3406
|
let s = o ? l(o) : i.value;
|
|
3407
3407
|
if (!s) return null;
|
|
3408
|
-
let c =
|
|
3409
|
-
return s.elements.push(c),
|
|
3410
|
-
}, "add"),
|
|
3408
|
+
let c = Ce(e, n, t);
|
|
3409
|
+
return s.elements.push(c), D(r.value, c, t), a(), c;
|
|
3410
|
+
}, "add"), x = n((n) => {
|
|
3411
3411
|
let i = u.value;
|
|
3412
3412
|
if (!i || !d.value) return u.value = null, d.value = "", null;
|
|
3413
3413
|
let o = l(d.value);
|
|
3414
3414
|
if (u.value = null, d.value = "", !o) return null;
|
|
3415
3415
|
if (!t.get(i.type)?.pointBased) {
|
|
3416
|
-
let e =
|
|
3417
|
-
n && r > i.width && i.x <
|
|
3416
|
+
let e = ie(i, t), r = R(Math.max(i.width, e.width)), a = R(Math.max(i.height, e.height));
|
|
3417
|
+
n && r > i.width && i.x < R(n.x) && (i.x = R(n.x - r)), n && a > i.height && i.y < R(n.y) && (i.y = R(n.y - a)), i.width = r, i.height = a;
|
|
3418
3418
|
}
|
|
3419
|
-
return o.elements.push(i),
|
|
3419
|
+
return o.elements.push(i), D(r.value, i, t), e.selection.set([i.id]), a(), i;
|
|
3420
3420
|
}, "commitDraft");
|
|
3421
|
-
function
|
|
3421
|
+
function S(e, n) {
|
|
3422
3422
|
let i = h(e);
|
|
3423
3423
|
if (!i || i.node.locked) return !1;
|
|
3424
|
-
|
|
3424
|
+
j(r.value, i.node, n);
|
|
3425
3425
|
let a = {
|
|
3426
3426
|
...i.node,
|
|
3427
3427
|
...n
|
|
3428
|
-
}, o =
|
|
3428
|
+
}, o = O(r.value, a, t);
|
|
3429
3429
|
return o !== a && (n = {
|
|
3430
3430
|
...n,
|
|
3431
3431
|
bindings: o.bindings,
|
|
3432
3432
|
props: o.props
|
|
3433
|
-
}),
|
|
3433
|
+
}), ge(r.value, {
|
|
3434
3434
|
...i.node,
|
|
3435
3435
|
...n
|
|
3436
|
-
}, t), Object.assign(i.node,
|
|
3436
|
+
}, t), Object.assign(i.node, te(i.node, n, t)), ("props" in n || "type" in n || "bindings" in n) && (D(r.value, i.node, t), N(r.value, t)), "props" in n && ve(i.node, t.get(i.node.type)), !0;
|
|
3437
3437
|
}
|
|
3438
3438
|
function C(e) {
|
|
3439
|
-
return e.y !== void 0 && !
|
|
3439
|
+
return e.y !== void 0 && !T(e);
|
|
3440
3440
|
}
|
|
3441
|
-
function
|
|
3441
|
+
function T(e) {
|
|
3442
3442
|
return e.rotation !== void 0 || e.width !== void 0 || e.height !== void 0;
|
|
3443
3443
|
}
|
|
3444
|
-
let
|
|
3444
|
+
let E = n((n, i = {}, o = []) => {
|
|
3445
3445
|
for (let { id: e, patch: i } of n) {
|
|
3446
|
-
let n =
|
|
3447
|
-
n && (
|
|
3446
|
+
let n = _(e);
|
|
3447
|
+
n && (j(r.value, n, i), ge(r.value, O(r.value, {
|
|
3448
3448
|
...n,
|
|
3449
3449
|
...i
|
|
3450
3450
|
}, t), t));
|
|
3451
3451
|
}
|
|
3452
3452
|
for (let { geometry: e, id: t } of o) {
|
|
3453
|
-
let n =
|
|
3453
|
+
let n = _(t);
|
|
3454
3454
|
n && Object.assign(n, e);
|
|
3455
3455
|
}
|
|
3456
3456
|
let s = [], c = [];
|
|
3457
|
-
for (let { id: e, patch: t } of n)
|
|
3457
|
+
for (let { id: e, patch: t } of n) S(e, t) && (C(t) ? s.push(e) : T(t) && c.push(e));
|
|
3458
3458
|
let l = e.layout.apply(s, c);
|
|
3459
3459
|
return i.transient || a(), l;
|
|
3460
|
-
}, "updateMany"),
|
|
3461
|
-
|
|
3462
|
-
}, "update"),
|
|
3460
|
+
}, "updateMany"), k = n((t, n, r = {}) => {
|
|
3461
|
+
S(t, n) && (e.layout.apply(C(n) ? [t] : [], T(n) ? [t] : []), r.transient || a());
|
|
3462
|
+
}, "update"), A = n((n, i, o = {}) => {
|
|
3463
3463
|
let s = h(n);
|
|
3464
3464
|
if (!s || s.node.locked) return;
|
|
3465
|
-
let c =
|
|
3465
|
+
let c = O(r.value, {
|
|
3466
3466
|
...s.node,
|
|
3467
3467
|
props: {
|
|
3468
3468
|
...s.node.props,
|
|
3469
3469
|
...i
|
|
3470
3470
|
}
|
|
3471
3471
|
}, t);
|
|
3472
|
-
|
|
3473
|
-
}, "updateProps"),
|
|
3472
|
+
ge(r.value, c, t), s.node.props = c.props, D(r.value, s.node, t), N(r.value, t), ve(s.node, t.get(s.node.type)), e.layout.apply(), o.transient || a();
|
|
3473
|
+
}, "updateProps"), P = n((t, n = {}) => {
|
|
3474
3474
|
if (t.length === 0) return;
|
|
3475
3475
|
for (let e of t) {
|
|
3476
|
-
let t =
|
|
3477
|
-
t &&
|
|
3476
|
+
let t = _(e);
|
|
3477
|
+
t && j(r.value, t);
|
|
3478
3478
|
}
|
|
3479
3479
|
let i = new Set(t);
|
|
3480
|
-
for (let e of
|
|
3481
|
-
|
|
3480
|
+
for (let e of ee(r.value)) e.elements = e.elements.filter((e) => !i.has(e.id));
|
|
3481
|
+
N(r.value), de(r.value), r.value.repeatGroups?.length && (r.value.repeatGroups = r.value.repeatGroups.map((e) => ({
|
|
3482
3482
|
...e,
|
|
3483
3483
|
elementIds: e.elementIds.filter((e) => !i.has(e))
|
|
3484
|
-
})).filter((e) => e.elementIds.length > 0)), e.selection.set(o.value.filter((e) => !i.has(e))),
|
|
3485
|
-
}, "removeIds"),
|
|
3486
|
-
|
|
3484
|
+
})).filter((e) => e.elementIds.length > 0)), e.selection.set(o.value.filter((e) => !i.has(e))), w(r.value), e.selection.setEditingId(null), n.transient || a();
|
|
3485
|
+
}, "removeIds"), ne = n(() => {
|
|
3486
|
+
P(o.value.filter((e) => {
|
|
3487
3487
|
let t = h(e);
|
|
3488
3488
|
return t ? !t.node.locked : !1;
|
|
3489
3489
|
}));
|
|
3490
|
-
}, "removeSelected"),
|
|
3491
|
-
let s =
|
|
3490
|
+
}, "removeSelected"), re = n((n, i = 3, o = {}) => {
|
|
3491
|
+
let s = tr(r.value, n), c = [], l = /* @__PURE__ */ new Map();
|
|
3492
3492
|
for (let e of n) {
|
|
3493
3493
|
let n = h(e);
|
|
3494
3494
|
if (!n) continue;
|
|
3495
|
-
let a =
|
|
3496
|
-
a.id =
|
|
3495
|
+
let a = z(n.node);
|
|
3496
|
+
a.id = V("el"), a.name = g("designer.elementStore.duplicateName", { elementName: n.node.name }), Object.assign(a, De(a, i, i)), M(r.value, n.node, a, t), n.page.elements.push(a);
|
|
3497
3497
|
let o = l.get(n.page.id) ?? /* @__PURE__ */ new Map();
|
|
3498
3498
|
o.set(e, a.id), l.set(n.page.id, o), c.push(a.id);
|
|
3499
3499
|
}
|
|
3500
3500
|
if (c.length > 0) {
|
|
3501
|
-
for (let [e, t] of l)
|
|
3501
|
+
for (let [e, t] of l) nr(r.value, {
|
|
3502
3502
|
elementGroups: s.elementGroups.filter((t) => t.pageId === e),
|
|
3503
3503
|
followBlocks: s.followBlocks.filter((t) => t.pageId === e),
|
|
3504
3504
|
repeatGroups: s.repeatGroups.filter((t) => t.pageId === e)
|
|
3505
|
-
}, t, e,
|
|
3505
|
+
}, t, e, V);
|
|
3506
3506
|
e.selection.set(c), o.transient || a();
|
|
3507
3507
|
}
|
|
3508
|
-
}, "duplicate"),
|
|
3508
|
+
}, "duplicate"), F = n((t, n) => {
|
|
3509
3509
|
let r = e.selection.unlockedNodes;
|
|
3510
3510
|
if (r.length !== 0) {
|
|
3511
|
-
for (let e of r) Object.assign(e,
|
|
3511
|
+
for (let e of r) Object.assign(e, De(e, t, n));
|
|
3512
3512
|
e.layout.apply(n === 0 ? [] : r.map((e) => e.id)), a({ coalesce: `nudge:${r.map((e) => e.id).join(",")}` });
|
|
3513
3513
|
}
|
|
3514
3514
|
}, "nudge");
|
|
3515
3515
|
function I(e, t) {
|
|
3516
|
-
let n =
|
|
3517
|
-
return t(n) ? (
|
|
3516
|
+
let n = se(e, r.value.elementGroups ?? []);
|
|
3517
|
+
return t(n) ? (_e(r.value, e, n), !0) : !1;
|
|
3518
3518
|
}
|
|
3519
3519
|
let oe = n((e, t, n) => {
|
|
3520
3520
|
let r = l(e);
|
|
3521
3521
|
if (!r || !r.elements.some((e) => e.id === t)) return;
|
|
3522
|
-
let i = [...r.elements].reverse(), o =
|
|
3522
|
+
let i = [...r.elements].reverse(), o = B(n, 0, i.length), s = o < i.length, c = s ? i[o] : i[i.length - 1];
|
|
3523
3523
|
c.id !== t && I(r, (e) => pe(e, [{
|
|
3524
3524
|
id: t,
|
|
3525
3525
|
kind: "element"
|
|
@@ -3541,33 +3541,33 @@ function jr(e) {
|
|
|
3541
3541
|
}
|
|
3542
3542
|
for (let [n, r] of t) {
|
|
3543
3543
|
let t = l(n);
|
|
3544
|
-
t && I(t, (t) =>
|
|
3544
|
+
t && I(t, (t) => ae(t, r, e));
|
|
3545
3545
|
}
|
|
3546
3546
|
a();
|
|
3547
3547
|
}
|
|
3548
|
-
let
|
|
3548
|
+
let fe = n((e) => {
|
|
3549
3549
|
ue({ offset: e });
|
|
3550
|
-
}, "reorder"),
|
|
3550
|
+
}, "reorder"), me = n((e) => {
|
|
3551
3551
|
ue({ edge: e });
|
|
3552
|
-
}, "sendTo"),
|
|
3553
|
-
let i =
|
|
3552
|
+
}, "sendTo"), he = n((e, t, n) => {
|
|
3553
|
+
let i = v(e).filter((e) => e[t] !== n);
|
|
3554
3554
|
if (i.length !== 0) {
|
|
3555
|
-
if (t === "visible") for (let e of i)
|
|
3555
|
+
if (t === "visible") for (let e of i) j(r.value, e, { visible: n });
|
|
3556
3556
|
for (let e of i) e[t] = n;
|
|
3557
3557
|
a();
|
|
3558
3558
|
}
|
|
3559
|
-
}, "setFlag"),
|
|
3559
|
+
}, "setFlag"), ye = n((e, t) => {
|
|
3560
3560
|
let n = h(e);
|
|
3561
|
-
n && (t === "visible" &&
|
|
3562
|
-
}, "toggleFlag"),
|
|
3561
|
+
n && (t === "visible" && j(r.value, n.node, { visible: !n.node.visible }), n.node[t] = !n.node[t], a());
|
|
3562
|
+
}, "toggleFlag"), be = n((e, t) => {
|
|
3563
3563
|
let n = h(e);
|
|
3564
3564
|
n && t.trim() && (n.node.name = t.trim(), a());
|
|
3565
3565
|
}, "rename");
|
|
3566
|
-
function
|
|
3566
|
+
function xe() {
|
|
3567
3567
|
let t = e.selection.unlockedNodes, n = t[0] ? h(t[0].id)?.page : void 0;
|
|
3568
3568
|
return n ? {
|
|
3569
3569
|
items: t.map((e) => ({
|
|
3570
|
-
box:
|
|
3570
|
+
box: ce({
|
|
3571
3571
|
height: e.height,
|
|
3572
3572
|
width: e.width,
|
|
3573
3573
|
x: e.x,
|
|
@@ -3584,86 +3584,86 @@ function jr(e) {
|
|
|
3584
3584
|
}
|
|
3585
3585
|
} : null;
|
|
3586
3586
|
}
|
|
3587
|
-
function
|
|
3587
|
+
function Se(t, n, r) {
|
|
3588
3588
|
for (let [e, i] of r) {
|
|
3589
3589
|
let r = t.get(e);
|
|
3590
3590
|
if (!r) continue;
|
|
3591
|
-
let a = n === "x" ?
|
|
3591
|
+
let a = n === "x" ? De(r, i, 0) : De(r, 0, i);
|
|
3592
3592
|
Object.assign(r, a);
|
|
3593
3593
|
}
|
|
3594
3594
|
e.layout.apply(n === "y" ? [...r.keys()] : []), a();
|
|
3595
3595
|
}
|
|
3596
3596
|
return {
|
|
3597
|
-
add:
|
|
3597
|
+
add: b,
|
|
3598
3598
|
align: n((e, t = {}) => {
|
|
3599
|
-
let n =
|
|
3599
|
+
let n = xe();
|
|
3600
3600
|
if (!n) return;
|
|
3601
|
-
let r =
|
|
3601
|
+
let r = kr(n.items, e, {
|
|
3602
3602
|
...t,
|
|
3603
3603
|
pageBounds: n.pageBounds
|
|
3604
3604
|
});
|
|
3605
|
-
|
|
3605
|
+
Se(n.nodes, Cr(e), r);
|
|
3606
3606
|
}, "align"),
|
|
3607
3607
|
cancelDraft: m,
|
|
3608
|
-
commitDraft:
|
|
3608
|
+
commitDraft: x,
|
|
3609
3609
|
distribute: n((e, t = {}) => {
|
|
3610
|
-
let n =
|
|
3610
|
+
let n = xe();
|
|
3611
3611
|
if (!n) return;
|
|
3612
|
-
let r =
|
|
3612
|
+
let r = Ar(n.items, e, {
|
|
3613
3613
|
...t,
|
|
3614
3614
|
pageBounds: n.pageBounds
|
|
3615
3615
|
});
|
|
3616
|
-
r ?
|
|
3616
|
+
r ? Se(n.nodes, Cr(e), r) : c(g("designer.elementStore.insufficientDistributionSelection"));
|
|
3617
3617
|
}, "distribute"),
|
|
3618
3618
|
distributeSpacing: n((e, t = {}) => {
|
|
3619
|
-
let n =
|
|
3619
|
+
let n = xe();
|
|
3620
3620
|
if (!n) return;
|
|
3621
|
-
let r =
|
|
3621
|
+
let r = jr(n.items, e, {
|
|
3622
3622
|
...t,
|
|
3623
3623
|
pageBounds: n.pageBounds
|
|
3624
3624
|
});
|
|
3625
|
-
if (r)
|
|
3625
|
+
if (r) Se(n.nodes, wr(e), r);
|
|
3626
3626
|
else {
|
|
3627
3627
|
let e = typeof t.spacing == "number" && Number.isFinite(t.spacing);
|
|
3628
|
-
c(
|
|
3628
|
+
c(g(e ? "designer.elementStore.insufficientSpacingSelection" : "designer.elementStore.insufficientDistributionSelection"));
|
|
3629
3629
|
}
|
|
3630
3630
|
}, "distributeSpacing"),
|
|
3631
3631
|
draftElement: u,
|
|
3632
3632
|
draftPageId: d,
|
|
3633
|
-
duplicate:
|
|
3633
|
+
duplicate: re,
|
|
3634
3634
|
find: U(() => h),
|
|
3635
|
-
get: U(() =>
|
|
3636
|
-
getByPage: U(() =>
|
|
3637
|
-
getMany: U(() =>
|
|
3635
|
+
get: U(() => _),
|
|
3636
|
+
getByPage: U(() => y),
|
|
3637
|
+
getMany: U(() => v),
|
|
3638
3638
|
moveByDisplayIndex: oe,
|
|
3639
3639
|
moveLayerNodes: le,
|
|
3640
|
-
nudge:
|
|
3641
|
-
removeIds:
|
|
3642
|
-
removeSelected:
|
|
3643
|
-
rename:
|
|
3644
|
-
reorder:
|
|
3645
|
-
sendTo:
|
|
3640
|
+
nudge: F,
|
|
3641
|
+
removeIds: P,
|
|
3642
|
+
removeSelected: ne,
|
|
3643
|
+
rename: be,
|
|
3644
|
+
reorder: fe,
|
|
3645
|
+
sendTo: me,
|
|
3646
3646
|
setDraft: f,
|
|
3647
|
-
setFlag:
|
|
3648
|
-
toggleFlag:
|
|
3649
|
-
update:
|
|
3647
|
+
setFlag: he,
|
|
3648
|
+
toggleFlag: ye,
|
|
3649
|
+
update: k,
|
|
3650
3650
|
updateDraft: p,
|
|
3651
|
-
updateMany:
|
|
3652
|
-
updateProps:
|
|
3651
|
+
updateMany: E,
|
|
3652
|
+
updateProps: A
|
|
3653
3653
|
};
|
|
3654
3654
|
})();
|
|
3655
3655
|
}
|
|
3656
3656
|
// src/designer/stores/follow-block-store.ts
|
|
3657
|
-
function
|
|
3657
|
+
function Nr(e) {
|
|
3658
3658
|
return H("editor-followBlock", () => {
|
|
3659
|
-
let t = U(() => e.document.data.followBlocks ?? []), n = U(() => (e) => t.value.find((t) => t.id === e)), r = U(() => (e) => t.value.filter((t) => t.pageId === e)),
|
|
3659
|
+
let t = U(() => e.document.data.followBlocks ?? []), n = U(() => (e) => t.value.find((t) => t.id === e)), r = U(() => (e) => t.value.filter((t) => t.pageId === e)), a = U(() => (e) => {
|
|
3660
3660
|
let n = /* @__PURE__ */ new Set();
|
|
3661
3661
|
for (let r of e) for (let e of t.value) e.elementIds.includes(r) && n.add(e);
|
|
3662
3662
|
return [...n];
|
|
3663
|
-
}),
|
|
3663
|
+
}), o = U(() => {
|
|
3664
3664
|
let n = e.selection.ids;
|
|
3665
3665
|
if (n.length !== 0) return t.value.find((e) => n.every((t) => e.elementIds.includes(t)));
|
|
3666
|
-
}),
|
|
3666
|
+
}), s = U(() => (e) => t.value.filter((t) => {
|
|
3667
3667
|
let n = l(t, e);
|
|
3668
3668
|
return n.elementIds.length > t.elementIds.length && !u(n);
|
|
3669
3669
|
}));
|
|
@@ -3679,25 +3679,25 @@ function Mr(e) {
|
|
|
3679
3679
|
followBlocks: [...t.value.filter((e) => e.id !== n.id), n]
|
|
3680
3680
|
};
|
|
3681
3681
|
for (let e of r.followBlocks) {
|
|
3682
|
-
let t =
|
|
3682
|
+
let t = P(r, e);
|
|
3683
3683
|
if (t) return t;
|
|
3684
3684
|
}
|
|
3685
3685
|
}
|
|
3686
3686
|
function d(t, r = []) {
|
|
3687
|
-
for (let { gap:
|
|
3688
|
-
let e = n.value(
|
|
3689
|
-
e && (e.gap =
|
|
3687
|
+
for (let { gap: a, id: o } of i(e.document.data, t, r)) {
|
|
3688
|
+
let e = n.value(o);
|
|
3689
|
+
e && (e.gap = a);
|
|
3690
3690
|
}
|
|
3691
3691
|
}
|
|
3692
3692
|
function f(r) {
|
|
3693
3693
|
let i = n.value(r.id), a = u(r);
|
|
3694
|
-
return a ? (e.ui.toast(
|
|
3694
|
+
return a ? (e.ui.toast(g(`core.followBlock.${a}`), "error"), !1) : (i ? Object.assign(i, JSON.parse(JSON.stringify(r))) : e.document.data.followBlocks = [...t.value, JSON.parse(JSON.stringify(r))], e.history.commit(), !0);
|
|
3695
3695
|
}
|
|
3696
3696
|
function p(t, n, r) {
|
|
3697
|
-
let i = e.document.data,
|
|
3698
|
-
return !
|
|
3697
|
+
let i = e.document.data, a = i.pages.find((e) => e.id === t), o = re(i, t, r)?.elementIds ?? [], s = c((a?.elements ?? []).filter((e) => n.includes(e.id))), l = c((a?.elements ?? []).filter((e) => o.includes(e.id)));
|
|
3698
|
+
return !s || !l ? 0 : s.y - l.y - l.height;
|
|
3699
3699
|
}
|
|
3700
|
-
function m(e, t, r, i = 2, a =
|
|
3700
|
+
function m(e, t, r, i = 2, a = g("designer.followBlock.defaultName"), o = V("follow")) {
|
|
3701
3701
|
if (n.value(o)) throw Error(`Follow block already exists: ${o}`);
|
|
3702
3702
|
let s = {
|
|
3703
3703
|
elementIds: [...t],
|
|
@@ -3716,16 +3716,16 @@ function Mr(e) {
|
|
|
3716
3716
|
...t
|
|
3717
3717
|
}) : !1;
|
|
3718
3718
|
}
|
|
3719
|
-
function
|
|
3720
|
-
n.value(r) && (e.document.data.followBlocks = t.value.filter((e) => e.id !== r),
|
|
3719
|
+
function _(r) {
|
|
3720
|
+
n.value(r) && (e.document.data.followBlocks = t.value.filter((e) => e.id !== r), w(e.document.data), e.history.commit());
|
|
3721
3721
|
}
|
|
3722
|
-
function
|
|
3722
|
+
function v(e, t) {
|
|
3723
3723
|
let r = n.value(e);
|
|
3724
3724
|
if (!r) return !1;
|
|
3725
3725
|
let i = l(r, t);
|
|
3726
3726
|
return i.elementIds.length !== r.elementIds.length && f(i);
|
|
3727
3727
|
}
|
|
3728
|
-
function
|
|
3728
|
+
function y(n) {
|
|
3729
3729
|
let r = new Set(n), i = !1, a = t.value.flatMap((e) => {
|
|
3730
3730
|
let t = e.elementIds.filter((e) => !r.has(e));
|
|
3731
3731
|
return t.length === e.elementIds.length ? [e] : (i = !0, t.length ? [{
|
|
@@ -3733,26 +3733,26 @@ function Mr(e) {
|
|
|
3733
3733
|
elementIds: t
|
|
3734
3734
|
}] : []);
|
|
3735
3735
|
});
|
|
3736
|
-
i && (e.document.data.followBlocks = a,
|
|
3736
|
+
i && (e.document.data.followBlocks = a, w(e.document.data), e.history.commit());
|
|
3737
3737
|
}
|
|
3738
3738
|
return {
|
|
3739
|
-
addMembers:
|
|
3739
|
+
addMembers: v,
|
|
3740
3740
|
create: m,
|
|
3741
3741
|
find: n,
|
|
3742
|
-
getByElements:
|
|
3742
|
+
getByElements: a,
|
|
3743
3743
|
getByPage: r,
|
|
3744
|
-
getJoinable:
|
|
3744
|
+
getJoinable: s,
|
|
3745
3745
|
list: t,
|
|
3746
|
-
remove:
|
|
3747
|
-
removeMembers:
|
|
3748
|
-
selected:
|
|
3746
|
+
remove: _,
|
|
3747
|
+
removeMembers: y,
|
|
3748
|
+
selected: o,
|
|
3749
3749
|
syncGaps: d,
|
|
3750
3750
|
update: h
|
|
3751
3751
|
};
|
|
3752
3752
|
})();
|
|
3753
3753
|
}
|
|
3754
3754
|
// src/designer/stores/guide-store.ts
|
|
3755
|
-
function
|
|
3755
|
+
function Pr(e) {
|
|
3756
3756
|
return H("editor-guide", () => {
|
|
3757
3757
|
let { pages: t } = G(e.scope), n = e.history.commit;
|
|
3758
3758
|
function r(t) {
|
|
@@ -3779,15 +3779,15 @@ function Nr(e) {
|
|
|
3779
3779
|
let o = r(e);
|
|
3780
3780
|
if (!o) return null;
|
|
3781
3781
|
let s = {
|
|
3782
|
-
id:
|
|
3782
|
+
id: V("guide"),
|
|
3783
3783
|
orientation: t,
|
|
3784
|
-
position:
|
|
3784
|
+
position: R(i)
|
|
3785
3785
|
};
|
|
3786
3786
|
return o.guides.push(s), a.transient || n(), s;
|
|
3787
3787
|
}
|
|
3788
3788
|
function l(e, t, r, i = {}) {
|
|
3789
3789
|
let a = o(e, t);
|
|
3790
|
-
a && (a.position =
|
|
3790
|
+
a && (a.position = R(r), i.transient || n());
|
|
3791
3791
|
}
|
|
3792
3792
|
function u(e, t, i = {}) {
|
|
3793
3793
|
let a = r(e);
|
|
@@ -3810,8 +3810,8 @@ function Nr(e) {
|
|
|
3810
3810
|
})();
|
|
3811
3811
|
}
|
|
3812
3812
|
// src/designer/stores/history-store.ts
|
|
3813
|
-
var
|
|
3814
|
-
function
|
|
3813
|
+
var Fr = 100;
|
|
3814
|
+
function Ir(e) {
|
|
3815
3815
|
return H("editor-history", ({ action: t }) => {
|
|
3816
3816
|
let { data: n } = G(e.document), r = W([]), i = W(-1), a = W([]), o = W(null), s = U(() => i.value > 0), c = U(() => i.value < r.value.length - 1);
|
|
3817
3817
|
function l() {
|
|
@@ -3830,7 +3830,7 @@ function Fr(e) {
|
|
|
3830
3830
|
let n = l();
|
|
3831
3831
|
if (r.value[i.value] === n) return;
|
|
3832
3832
|
let a = Date.now();
|
|
3833
|
-
t.coalesce !== void 0 && t.coalesce === u && a - d < 800 && i.value === r.value.length - 1 ? (r.value[i.value] = n, d = a) : (u = t.coalesce ?? null, d = a, r.value = r.value.slice(0, i.value + 1), r.value.push(n), r.value.length >
|
|
3833
|
+
t.coalesce !== void 0 && t.coalesce === u && a - d < 800 && i.value === r.value.length - 1 ? (r.value[i.value] = n, d = a) : (u = t.coalesce ?? null, d = a, r.value = r.value.slice(0, i.value + 1), r.value.push(n), r.value.length > Fr && r.value.shift(), i.value = r.value.length - 1);
|
|
3834
3834
|
}, "commit");
|
|
3835
3835
|
function p(t) {
|
|
3836
3836
|
let r = JSON.parse(t);
|
|
@@ -3889,19 +3889,19 @@ function Fr(e) {
|
|
|
3889
3889
|
})();
|
|
3890
3890
|
}
|
|
3891
3891
|
// src/designer/stores/layout-store.ts
|
|
3892
|
-
function
|
|
3892
|
+
function Lr(e) {
|
|
3893
3893
|
return H("editor-layout", () => {
|
|
3894
|
-
let t =
|
|
3894
|
+
let t = Ue(/* @__PURE__ */ new Map());
|
|
3895
3895
|
function n(e, n) {
|
|
3896
3896
|
let r = t.get(e);
|
|
3897
|
-
return t.set(e,
|
|
3897
|
+
return t.set(e, Be(n)), () => {
|
|
3898
3898
|
t.get(e) === n && (r ? t.set(e, r) : t.delete(e));
|
|
3899
3899
|
};
|
|
3900
3900
|
}
|
|
3901
3901
|
function r(n = [], r = []) {
|
|
3902
3902
|
let i = [];
|
|
3903
3903
|
for (let a of t.values()) for (let t of a(e.document.data, n, r)) {
|
|
3904
|
-
let n =
|
|
3904
|
+
let n = Pe(e.document.data, t.id);
|
|
3905
3905
|
n && (Object.assign(n.node, t.patch), i.push(t));
|
|
3906
3906
|
}
|
|
3907
3907
|
return i;
|
|
@@ -3914,7 +3914,7 @@ function Ir(e) {
|
|
|
3914
3914
|
})();
|
|
3915
3915
|
}
|
|
3916
3916
|
// src/designer/stores/navigation-store.ts
|
|
3917
|
-
function
|
|
3917
|
+
function Rr(e) {
|
|
3918
3918
|
return H("editor-navigation", () => {
|
|
3919
3919
|
let t = W([]);
|
|
3920
3920
|
function n(n) {
|
|
@@ -3955,7 +3955,7 @@ function Lr(e) {
|
|
|
3955
3955
|
})();
|
|
3956
3956
|
}
|
|
3957
3957
|
// src/designer/stores/page-store.ts
|
|
3958
|
-
function
|
|
3958
|
+
function zr(e) {
|
|
3959
3959
|
return H("editor-page", () => {
|
|
3960
3960
|
let { data: t } = G(e.document), n = e.history.commit, r = e.ui.toast, i = W(""), a = U(() => t.value.pages), o = U(() => a.value.length > 1), s = U(() => l(d.value));
|
|
3961
3961
|
function c(e) {
|
|
@@ -3973,12 +3973,12 @@ function Rr(e) {
|
|
|
3973
3973
|
c(e) && (i.value = e);
|
|
3974
3974
|
}
|
|
3975
3975
|
function p(e, r, a, o = {}) {
|
|
3976
|
-
if (o.id &&
|
|
3977
|
-
let s =
|
|
3976
|
+
if (o.id && L(t.value, o.id)) throw Error(`Page already exists: ${o.id}`);
|
|
3977
|
+
let s = T(t.value, {
|
|
3978
3978
|
height: r,
|
|
3979
3979
|
width: e,
|
|
3980
3980
|
...o
|
|
3981
|
-
}, t.value.pages.length + 1), c =
|
|
3981
|
+
}, t.value.pages.length + 1), c = me(e, r, a ?? g("designer.pageStore.numberedPageName", { pageNumber: t.value.pages.length + 1 }), {
|
|
3982
3982
|
...o,
|
|
3983
3983
|
...s
|
|
3984
3984
|
});
|
|
@@ -3987,49 +3987,49 @@ function Rr(e) {
|
|
|
3987
3987
|
function m(r) {
|
|
3988
3988
|
let a = l(r);
|
|
3989
3989
|
if (a < 0) return;
|
|
3990
|
-
let o = t.value.pages[a], s =
|
|
3991
|
-
...
|
|
3990
|
+
let o = t.value.pages[a], s = tr(t.value, o.elements.map((e) => e.id)), c = {
|
|
3991
|
+
...S(o),
|
|
3992
3992
|
background: o.background,
|
|
3993
3993
|
elements: o.elements.map((e) => ({
|
|
3994
|
-
...
|
|
3995
|
-
id:
|
|
3994
|
+
...z(e),
|
|
3995
|
+
id: V("el")
|
|
3996
3996
|
})),
|
|
3997
3997
|
guides: o.guides.map((e) => ({
|
|
3998
3998
|
...e,
|
|
3999
|
-
id:
|
|
3999
|
+
id: V("guide")
|
|
4000
4000
|
})),
|
|
4001
|
-
id:
|
|
4002
|
-
name:
|
|
4001
|
+
id: V("page"),
|
|
4002
|
+
name: g("designer.pageStore.duplicatePageName", { pageName: o.name }),
|
|
4003
4003
|
templateId: o.templateId
|
|
4004
4004
|
};
|
|
4005
|
-
for (let [n, r] of o.elements.entries())
|
|
4006
|
-
t.value.pages.splice(a + 1, 0, c),
|
|
4005
|
+
for (let [n, r] of o.elements.entries()) M(t.value, r, c.elements[n], e.elements ?? F);
|
|
4006
|
+
t.value.pages.splice(a + 1, 0, c), nr(t.value, s, new Map(o.elements.map((e, t) => [e.id, c.elements[t].id])), c.id, V), i.value = c.id, n();
|
|
4007
4007
|
}
|
|
4008
|
-
function
|
|
4008
|
+
function _(e) {
|
|
4009
4009
|
if (!o.value) {
|
|
4010
|
-
r(
|
|
4010
|
+
r(g("designer.pageStore.lastPageMessage"));
|
|
4011
4011
|
return;
|
|
4012
4012
|
}
|
|
4013
4013
|
let s = l(e);
|
|
4014
|
-
s < 0 || (d.value === e && (i.value = a.value[s > 0 ? s - 1 : 1].id), t.value.pages.splice(s, 1),
|
|
4014
|
+
s < 0 || (d.value === e && (i.value = a.value[s > 0 ? s - 1 : 1].id), t.value.pages.splice(s, 1), N(t.value), t.value.elementGroups = t.value.elementGroups?.filter((t) => t.pageId !== e), t.value.repeatGroups = t.value.repeatGroups?.filter((t) => t.pageId !== e), w(t.value), n());
|
|
4015
4015
|
}
|
|
4016
|
-
function
|
|
4016
|
+
function v(e, r) {
|
|
4017
4017
|
let i = c(e);
|
|
4018
4018
|
if (!i) return;
|
|
4019
|
-
if (t.value.templates?.find((e) => e.id === r.templateId)?.owner) throw new
|
|
4019
|
+
if (t.value.templates?.find((e) => e.id === r.templateId)?.owner) throw new h(g("core.pageExtensions.internalTemplate"), { code: "template.internal-resource" });
|
|
4020
4020
|
let a = {
|
|
4021
4021
|
...i,
|
|
4022
4022
|
...r
|
|
4023
|
-
}, o =
|
|
4023
|
+
}, o = T(t.value, a);
|
|
4024
4024
|
Object.assign(i, a, o), n();
|
|
4025
4025
|
}
|
|
4026
|
-
function
|
|
4026
|
+
function y(e, t) {
|
|
4027
4027
|
let r = c(e);
|
|
4028
4028
|
if (r) {
|
|
4029
4029
|
if (t && (!Number.isFinite(t.x) || !Number.isFinite(t.y))) throw Error("Page position must contain finite coordinates");
|
|
4030
4030
|
t === null ? delete r.position : r.position = {
|
|
4031
|
-
x: Math.max(0,
|
|
4032
|
-
y: Math.max(0,
|
|
4031
|
+
x: Math.max(0, R(t.x, 2)),
|
|
4032
|
+
y: Math.max(0, R(t.y, 2))
|
|
4033
4033
|
}, n();
|
|
4034
4034
|
}
|
|
4035
4035
|
}
|
|
@@ -4046,40 +4046,40 @@ function Rr(e) {
|
|
|
4046
4046
|
return c(e) !== void 0;
|
|
4047
4047
|
}),
|
|
4048
4048
|
list: a,
|
|
4049
|
-
move:
|
|
4050
|
-
remove:
|
|
4049
|
+
move: y,
|
|
4050
|
+
remove: _,
|
|
4051
4051
|
setActive: f,
|
|
4052
|
-
update:
|
|
4052
|
+
update: v
|
|
4053
4053
|
};
|
|
4054
4054
|
})();
|
|
4055
4055
|
}
|
|
4056
4056
|
// src/designer/stores/panel-store.ts
|
|
4057
|
-
var
|
|
4058
|
-
function
|
|
4057
|
+
var Br = "print-studio:panel-layout";
|
|
4058
|
+
function Vr(e) {
|
|
4059
4059
|
return {
|
|
4060
4060
|
activeId: e[0] ?? "",
|
|
4061
|
-
id:
|
|
4061
|
+
id: V("panel-group"),
|
|
4062
4062
|
panelIds: e,
|
|
4063
4063
|
weight: 1
|
|
4064
4064
|
};
|
|
4065
4065
|
}
|
|
4066
|
-
function
|
|
4066
|
+
function Hr(e) {
|
|
4067
4067
|
return {
|
|
4068
4068
|
collapsed: !1,
|
|
4069
4069
|
floating: !1,
|
|
4070
4070
|
groups: e,
|
|
4071
4071
|
height: 480,
|
|
4072
|
-
id:
|
|
4072
|
+
id: V("panel-column"),
|
|
4073
4073
|
railWidth: 112,
|
|
4074
4074
|
width: 280,
|
|
4075
4075
|
x: 80,
|
|
4076
4076
|
y: 100
|
|
4077
4077
|
};
|
|
4078
4078
|
}
|
|
4079
|
-
function
|
|
4080
|
-
return typeof e == "number" && Number.isFinite(e) ?
|
|
4079
|
+
function Ur(e, t, n, r) {
|
|
4080
|
+
return typeof e == "number" && Number.isFinite(e) ? B(e, n, r) : t;
|
|
4081
4081
|
}
|
|
4082
|
-
function
|
|
4082
|
+
function Wr(e) {
|
|
4083
4083
|
let t = {
|
|
4084
4084
|
columns: [],
|
|
4085
4085
|
version: 1
|
|
@@ -4088,22 +4088,22 @@ function Ur(e) {
|
|
|
4088
4088
|
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
4089
4089
|
for (let i of e.columns) {
|
|
4090
4090
|
if (!i || typeof i != "object" || !Array.isArray(i.groups)) continue;
|
|
4091
|
-
let e =
|
|
4091
|
+
let e = Hr([]);
|
|
4092
4092
|
typeof i.id == "string" && !r.has(i.id) && (e.id = i.id), r.add(e.id);
|
|
4093
4093
|
for (let t of i.groups) {
|
|
4094
4094
|
if (!t || typeof t != "object" || !Array.isArray(t.panelIds)) continue;
|
|
4095
4095
|
let i = t.panelIds.filter((e) => typeof e != "string" || !e || n.has(e) ? !1 : (n.add(e), !0));
|
|
4096
4096
|
if (!i.length) continue;
|
|
4097
|
-
let a =
|
|
4098
|
-
typeof t.id == "string" && !r.has(t.id) && (a.id = t.id), r.add(a.id), a.activeId = i.includes(t.activeId) ? t.activeId : i[0], a.weight =
|
|
4097
|
+
let a = Vr(i);
|
|
4098
|
+
typeof t.id == "string" && !r.has(t.id) && (a.id = t.id), r.add(a.id), a.activeId = i.includes(t.activeId) ? t.activeId : i[0], a.weight = Ur(t.weight, 1, .05, 100), e.groups.push(a);
|
|
4099
4099
|
}
|
|
4100
|
-
e.groups.length && (e.collapsed = i.collapsed === !0, e.floating = i.floating === !0, e.width =
|
|
4100
|
+
e.groups.length && (e.collapsed = i.collapsed === !0, e.floating = i.floating === !0, e.width = Ur(i.width, 280, 240, 560), e.railWidth = Ur(i.railWidth, 112, 36, 180), e.height = Ur(i.height, 480, 180, 1600), e.x = Ur(i.x, 80, 0, 1e4), e.y = Ur(i.y, 100, 0, 1e4), t.columns.push(e));
|
|
4101
4101
|
}
|
|
4102
4102
|
return t;
|
|
4103
4103
|
}
|
|
4104
|
-
function
|
|
4104
|
+
function Gr(e) {
|
|
4105
4105
|
try {
|
|
4106
|
-
return
|
|
4106
|
+
return Wr(JSON.parse((e ? e.get(Br) : localStorage.getItem(Br)) ?? "null"));
|
|
4107
4107
|
} catch {
|
|
4108
4108
|
return {
|
|
4109
4109
|
columns: [],
|
|
@@ -4111,32 +4111,32 @@ function Wr(e) {
|
|
|
4111
4111
|
};
|
|
4112
4112
|
}
|
|
4113
4113
|
}
|
|
4114
|
-
function
|
|
4114
|
+
function Kr(e, t, n) {
|
|
4115
4115
|
for (let r of e) r !== n && (r.panelIds = r.panelIds.filter((e) => !t.includes(e)));
|
|
4116
4116
|
}
|
|
4117
|
-
function
|
|
4117
|
+
function qr(e, t, n, r) {
|
|
4118
4118
|
let i = n.panelIds.filter((e) => !t.includes(e)), a = r ? i.indexOf(r) : -1;
|
|
4119
|
-
i.splice(a < 0 ? i.length : a, 0, ...t),
|
|
4119
|
+
i.splice(a < 0 ? i.length : a, 0, ...t), Kr(e, t, n), n.panelIds = i, n.activeId = t[0];
|
|
4120
4120
|
}
|
|
4121
|
-
function
|
|
4121
|
+
function Jr(e) {
|
|
4122
4122
|
for (let t of e.columns) {
|
|
4123
4123
|
t.groups = t.groups.filter((e) => e.panelIds.length > 0);
|
|
4124
4124
|
for (let e of t.groups) e.panelIds.includes(e.activeId) || (e.activeId = e.panelIds[0]);
|
|
4125
4125
|
}
|
|
4126
4126
|
e.columns = e.columns.filter((e) => e.groups.length > 0);
|
|
4127
4127
|
}
|
|
4128
|
-
function
|
|
4129
|
-
let i =
|
|
4128
|
+
function Yr(e, t, n, r) {
|
|
4129
|
+
let i = Hr(t);
|
|
4130
4130
|
if (i.width = e.width, r && (i.collapsed = e.collapsed, i.railWidth = e.railWidth, i.height = e.height), n.placement === "float") {
|
|
4131
4131
|
i.floating = !0;
|
|
4132
4132
|
let e = i.collapsed ? i.railWidth : i.width;
|
|
4133
|
-
i.x =
|
|
4133
|
+
i.x = B(n.x ?? 80, 0, Math.max(0, window.innerWidth - e)), i.y = B(n.y ?? 100, 0, Math.max(0, window.innerHeight - 180));
|
|
4134
4134
|
}
|
|
4135
4135
|
return i;
|
|
4136
4136
|
}
|
|
4137
|
-
function
|
|
4137
|
+
function Xr(e = !0, t) {
|
|
4138
4138
|
return H("editor-panel", ({ action: n }) => {
|
|
4139
|
-
let r =
|
|
4139
|
+
let r = Ue({}), i = /* @__PURE__ */ new Map(), a = W(e ? Gr(t) : {
|
|
4140
4140
|
columns: [],
|
|
4141
4141
|
version: 1
|
|
4142
4142
|
}), o = W(null), s = W(null), c = W(null), l = U(() => a.value.columns.filter((e) => !e.floating)), u = U(() => a.value.columns.filter((e) => e.floating)), d = U(() => function(e) {
|
|
@@ -4147,9 +4147,9 @@ function Yr(e = !0, t) {
|
|
|
4147
4147
|
});
|
|
4148
4148
|
function p() {
|
|
4149
4149
|
if (e && !c.value) {
|
|
4150
|
-
if (t) t.set(
|
|
4150
|
+
if (t) t.set(Br, JSON.stringify(a.value));
|
|
4151
4151
|
else try {
|
|
4152
|
-
localStorage.setItem(
|
|
4152
|
+
localStorage.setItem(Br, JSON.stringify(a.value));
|
|
4153
4153
|
} catch {
|
|
4154
4154
|
return;
|
|
4155
4155
|
}
|
|
@@ -4158,13 +4158,13 @@ function Yr(e = !0, t) {
|
|
|
4158
4158
|
function m(e) {
|
|
4159
4159
|
let t = {
|
|
4160
4160
|
...e,
|
|
4161
|
-
component:
|
|
4161
|
+
component: Be(e.component)
|
|
4162
4162
|
};
|
|
4163
4163
|
r[e.id] = t;
|
|
4164
4164
|
let n = i.get(e.id) ?? [];
|
|
4165
4165
|
if (n.push(t), i.set(e.id, n), !a.value.columns.some((t) => t.groups.some((t) => t.panelIds.includes(e.id)))) {
|
|
4166
4166
|
let t = l.value[0];
|
|
4167
|
-
t || (t =
|
|
4167
|
+
t || (t = Hr([]), a.value.columns.push(t)), t.groups.push(Vr([e.id]));
|
|
4168
4168
|
}
|
|
4169
4169
|
return function() {
|
|
4170
4170
|
let a = n.indexOf(t);
|
|
@@ -4175,7 +4175,7 @@ function Yr(e = !0, t) {
|
|
|
4175
4175
|
};
|
|
4176
4176
|
}
|
|
4177
4177
|
function h() {
|
|
4178
|
-
t?.get(
|
|
4178
|
+
t?.get(Br) && (a.value = Gr(t));
|
|
4179
4179
|
}
|
|
4180
4180
|
function g(e, t, n = !1) {
|
|
4181
4181
|
for (let r of a.value.columns) {
|
|
@@ -4200,15 +4200,15 @@ function Yr(e = !0, t) {
|
|
|
4200
4200
|
}
|
|
4201
4201
|
function b(e, t, n) {
|
|
4202
4202
|
let r = d.value(e);
|
|
4203
|
-
r && (n ?? r.collapsed ? r.railWidth = Math.round(
|
|
4203
|
+
r && (n ?? r.collapsed ? r.railWidth = Math.round(B(t, 36, 180)) : r.width = Math.round(B(t, 240, 560)));
|
|
4204
4204
|
}
|
|
4205
4205
|
function x(e, t, n, r, i) {
|
|
4206
4206
|
let a = d.value(e), o = a?.groups.find((e) => e.id === t), s = a?.groups.find((e) => e.id === n);
|
|
4207
|
-
o && s && (o.weight = i *
|
|
4207
|
+
o && s && (o.weight = i * B(r, .1, .9), s.weight = i - o.weight);
|
|
4208
4208
|
}
|
|
4209
4209
|
function S(e, t, n) {
|
|
4210
4210
|
let r = d.value(e);
|
|
4211
|
-
r && (r.width =
|
|
4211
|
+
r && (r.width = B(t, 240, 560), r.height = B(n, 180, Math.max(180, window.innerHeight - r.y - 12)));
|
|
4212
4212
|
}
|
|
4213
4213
|
function C(e, t) {
|
|
4214
4214
|
E();
|
|
@@ -4272,26 +4272,26 @@ function Yr(e = !0, t) {
|
|
|
4272
4272
|
if (!n || t.columnId && !r || t.groupId && !i) return;
|
|
4273
4273
|
if (n.floating && !e.groupId && !e.panelId && t.placement === "float") {
|
|
4274
4274
|
let e = n.collapsed ? n.railWidth : n.width;
|
|
4275
|
-
n.x =
|
|
4275
|
+
n.x = B(t.x ?? n.x, 0, Math.max(0, window.innerWidth - e)), n.y = B(t.y ?? n.y, 0, Math.max(0, window.innerHeight - 180)), p();
|
|
4276
4276
|
return;
|
|
4277
4277
|
}
|
|
4278
4278
|
let o = n.groups.filter((t) => !e.groupId || t.id === e.groupId), s = o.flatMap((t) => t.panelIds.filter((t) => !e.panelId || t === e.panelId));
|
|
4279
4279
|
if (!(!s.length || i && o.includes(i) && !e.panelId) && !(t.placement === "tab" && i?.panelIds.includes(e.panelId ?? "") && e.panelId === t.panelId) && (n !== r || e.groupId || t.placement !== "left" && t.placement !== "right")) {
|
|
4280
|
-
if (t.placement === "tab" && i)
|
|
4280
|
+
if (t.placement === "tab" && i) qr(o, s, i, t.panelId);
|
|
4281
4281
|
else {
|
|
4282
|
-
let c = e.panelId ? [
|
|
4282
|
+
let c = e.panelId ? [Vr(s)] : o.map((e) => ({
|
|
4283
4283
|
...e,
|
|
4284
4284
|
panelIds: [...e.panelIds]
|
|
4285
4285
|
}));
|
|
4286
|
-
if (
|
|
4286
|
+
if (Kr(o, s), (t.placement === "top" || t.placement === "bottom") && r && i) {
|
|
4287
4287
|
let e = r.groups.indexOf(i);
|
|
4288
4288
|
r.groups.splice(e + +(t.placement === "bottom"), 0, ...c);
|
|
4289
4289
|
} else {
|
|
4290
|
-
let i =
|
|
4290
|
+
let i = Yr(n, c, t, !e.groupId && !e.panelId), o = r ? a.value.columns.indexOf(r) : a.value.columns.length, s = t.placement === "right" || t.placement === "after";
|
|
4291
4291
|
a.value.columns.splice(o + +!!s, 0, i);
|
|
4292
4292
|
}
|
|
4293
4293
|
}
|
|
4294
|
-
|
|
4294
|
+
Jr(a.value), _(), p();
|
|
4295
4295
|
}
|
|
4296
4296
|
}, "movePanels");
|
|
4297
4297
|
function O() {
|
|
@@ -4304,7 +4304,7 @@ function Yr(e = !0, t) {
|
|
|
4304
4304
|
version: 1
|
|
4305
4305
|
};
|
|
4306
4306
|
let e = Object.keys(r);
|
|
4307
|
-
e.length && a.value.columns.push(
|
|
4307
|
+
e.length && a.value.columns.push(Hr(e.map((e) => Vr([e])))), _(), p();
|
|
4308
4308
|
}
|
|
4309
4309
|
return {
|
|
4310
4310
|
activate: g,
|
|
@@ -4337,7 +4337,7 @@ function Yr(e = !0, t) {
|
|
|
4337
4337
|
})();
|
|
4338
4338
|
}
|
|
4339
4339
|
// src/designer/stores/plugin-store.ts
|
|
4340
|
-
function
|
|
4340
|
+
function Zr() {
|
|
4341
4341
|
return H("editor-plugin", () => {
|
|
4342
4342
|
let e = W([]), t = W({});
|
|
4343
4343
|
function n(e, n) {
|
|
@@ -4359,101 +4359,101 @@ function Xr() {
|
|
|
4359
4359
|
})();
|
|
4360
4360
|
}
|
|
4361
4361
|
// src/designer/stores/rendering-store.ts
|
|
4362
|
-
function
|
|
4362
|
+
function Qr(e) {
|
|
4363
4363
|
return H("editor-rendering", () => {
|
|
4364
|
-
let t = W(null), n = W(null),
|
|
4364
|
+
let t = W(null), n = W(null), r = W(!1), i = W(!1), a = W(!0), s = W({
|
|
4365
4365
|
completed: 0,
|
|
4366
4366
|
stage: "prepare",
|
|
4367
4367
|
total: 1
|
|
4368
|
-
}), c, l =
|
|
4368
|
+
}), c, l = o({
|
|
4369
4369
|
config: () => e.config.data.rendering,
|
|
4370
4370
|
elements: e.elements,
|
|
4371
4371
|
parsers: e.parsers,
|
|
4372
|
-
snapshot:
|
|
4372
|
+
snapshot: b
|
|
4373
4373
|
});
|
|
4374
4374
|
async function d(e, n, r, i) {
|
|
4375
|
-
let a =
|
|
4375
|
+
let a = b(e), o = n === void 0 ? void 0 : b(n), s = await _((e) => l.html(a, o, r, {
|
|
4376
4376
|
...i,
|
|
4377
4377
|
...e,
|
|
4378
4378
|
onProgress: (e) => {
|
|
4379
|
-
|
|
4379
|
+
g(e), i?.onProgress?.(e);
|
|
4380
4380
|
},
|
|
4381
4381
|
waitIfPaused: p
|
|
4382
4382
|
}), i);
|
|
4383
4383
|
return t.value = s.execution, s;
|
|
4384
4384
|
}
|
|
4385
4385
|
async function f(e, n, r, i) {
|
|
4386
|
-
let a =
|
|
4386
|
+
let a = b(e), o = n === void 0 ? void 0 : b(n), s = await _((e) => l.pdf(a, o, r, {
|
|
4387
4387
|
...i,
|
|
4388
4388
|
...e,
|
|
4389
4389
|
onProgress: (e) => {
|
|
4390
|
-
|
|
4390
|
+
g(e), i?.onProgress?.(e);
|
|
4391
4391
|
},
|
|
4392
4392
|
waitIfPaused: p
|
|
4393
4393
|
}), i);
|
|
4394
4394
|
return t.value = s.execution, s;
|
|
4395
4395
|
}
|
|
4396
4396
|
async function p() {
|
|
4397
|
-
|
|
4397
|
+
i.value && await new Promise((e) => {
|
|
4398
4398
|
c = e;
|
|
4399
4399
|
});
|
|
4400
4400
|
}
|
|
4401
|
-
function
|
|
4402
|
-
return
|
|
4401
|
+
function h(e) {
|
|
4402
|
+
return _((t) => {
|
|
4403
4403
|
if (!t.signal) throw Error("Missing render cancellation signal");
|
|
4404
4404
|
return e(t.signal);
|
|
4405
4405
|
}, void 0, !1);
|
|
4406
4406
|
}
|
|
4407
|
-
function
|
|
4407
|
+
function g(e) {
|
|
4408
4408
|
s.value = e;
|
|
4409
4409
|
}
|
|
4410
|
-
async function
|
|
4410
|
+
async function _(e, t, o = !0) {
|
|
4411
4411
|
if (n.value) throw new DOMException("A render task is already running", "InvalidStateError");
|
|
4412
4412
|
t?.signal?.throwIfAborted();
|
|
4413
|
-
let
|
|
4414
|
-
|
|
4413
|
+
let l = new AbortController(), d = () => {
|
|
4414
|
+
l.abort(t?.signal?.reason), x();
|
|
4415
4415
|
};
|
|
4416
|
-
t?.signal?.addEventListener("abort", d, { once: !0 }), n.value =
|
|
4416
|
+
t?.signal?.addEventListener("abort", d, { once: !0 }), n.value = l, r.value = !0, a.value = o, i.value = !1, s.value = {
|
|
4417
4417
|
completed: 0,
|
|
4418
4418
|
stage: "prepare",
|
|
4419
4419
|
total: 1
|
|
4420
4420
|
};
|
|
4421
4421
|
try {
|
|
4422
|
-
return await
|
|
4422
|
+
return await u(l.signal), await e({ signal: l.signal });
|
|
4423
4423
|
} finally {
|
|
4424
|
-
t?.signal?.removeEventListener("abort", d), n.value = null,
|
|
4424
|
+
t?.signal?.removeEventListener("abort", d), n.value = null, r.value = !1, a.value = !0, i.value = !1, c?.(), c = void 0;
|
|
4425
4425
|
}
|
|
4426
4426
|
}
|
|
4427
|
-
function
|
|
4428
|
-
n.value?.abort(new
|
|
4427
|
+
function v() {
|
|
4428
|
+
n.value?.abort(new m("Render cancelled")), c?.(), c = void 0;
|
|
4429
4429
|
}
|
|
4430
4430
|
function y() {
|
|
4431
|
-
n.value &&
|
|
4431
|
+
n.value && a.value && (i.value = !0);
|
|
4432
4432
|
}
|
|
4433
|
-
function
|
|
4434
|
-
|
|
4433
|
+
function x() {
|
|
4434
|
+
i.value = !1, c?.(), c = void 0;
|
|
4435
4435
|
}
|
|
4436
4436
|
return K(() => e.config.data.rendering.worker, (e) => {
|
|
4437
4437
|
e || l.dispose();
|
|
4438
|
-
}, { flush: "sync" }),
|
|
4439
|
-
|
|
4438
|
+
}, { flush: "sync" }), Ve(() => {
|
|
4439
|
+
v(), l.dispose();
|
|
4440
4440
|
}), {
|
|
4441
|
-
active:
|
|
4442
|
-
cancel:
|
|
4441
|
+
active: r,
|
|
4442
|
+
cancel: v,
|
|
4443
4443
|
html: d,
|
|
4444
4444
|
lastExecution: t,
|
|
4445
|
-
pausable:
|
|
4445
|
+
pausable: a,
|
|
4446
4446
|
pause: y,
|
|
4447
|
-
paused:
|
|
4447
|
+
paused: i,
|
|
4448
4448
|
pdf: f,
|
|
4449
4449
|
progress: s,
|
|
4450
|
-
resume:
|
|
4451
|
-
runExternal:
|
|
4450
|
+
resume: x,
|
|
4451
|
+
runExternal: h
|
|
4452
4452
|
};
|
|
4453
4453
|
})();
|
|
4454
4454
|
}
|
|
4455
4455
|
// src/designer/stores/repeat-group-store.ts
|
|
4456
|
-
function
|
|
4456
|
+
function $r(e) {
|
|
4457
4457
|
return H("editor-repeatGroup", ({ action: t }) => {
|
|
4458
4458
|
let { data: n } = G(e.document), { ids: r } = G(e.selection), { activeId: i } = G(e.page), a = e.ui.toast, o = e.history.commit, s = e.element.removeIds, c = U(() => n.value.repeatGroups ?? []), l = U(() => {
|
|
4459
4459
|
let e = /* @__PURE__ */ new Map();
|
|
@@ -4483,8 +4483,8 @@ function Qr(e) {
|
|
|
4483
4483
|
let r = new Set(n.elementIds);
|
|
4484
4484
|
return e.element.getByPage(n.pageId).filter((e) => r.has(e.id));
|
|
4485
4485
|
}
|
|
4486
|
-
let h = U(() => r.value.length === 0 ? null : c.value.find((e) => e.elementIds.length === r.value.length && e.elementIds.every((e) => r.value.includes(e))) ?? null),
|
|
4487
|
-
function
|
|
4486
|
+
let h = U(() => r.value.length === 0 ? null : c.value.find((e) => e.elementIds.length === r.value.length && e.elementIds.every((e) => r.value.includes(e))) ?? null), _ = U(() => f(i.value));
|
|
4487
|
+
function v(t, n) {
|
|
4488
4488
|
let r = new Set(e.element.getByPage(t).map((e) => e.id)), i = new Set(n.filter((e) => r.has(e))), a = p([...i]).filter((e) => e.pageId === t);
|
|
4489
4489
|
for (let e of a) for (let t of e.elementIds) r.has(t) && i.add(t);
|
|
4490
4490
|
return {
|
|
@@ -4492,55 +4492,55 @@ function Qr(e) {
|
|
|
4492
4492
|
groups: a
|
|
4493
4493
|
};
|
|
4494
4494
|
}
|
|
4495
|
-
function
|
|
4495
|
+
function y(t, r, i, s) {
|
|
4496
4496
|
if (i.id && u(i.id)) throw Error("Repeat group already exists: " + i.id);
|
|
4497
4497
|
if (!e.page.get(t) || r.length === 0) return null;
|
|
4498
|
-
let l =
|
|
4498
|
+
let l = v(t, r);
|
|
4499
4499
|
if (r.some((e) => !l.elementIds.includes(e))) return null;
|
|
4500
4500
|
let d = l.groups;
|
|
4501
|
-
if (!s && d.length > 0) return a(
|
|
4501
|
+
if (!s && d.length > 0) return a(g("designer.repeatGroupStore.membersAlreadyGroupedMessage", { groupNames: [...new Set(d.map((e) => e.name))].join("、") })), null;
|
|
4502
4502
|
let f = s ? l.elementIds : [...new Set(r)];
|
|
4503
|
-
if (n.value.followBlocks?.some((e) => e.elementIds.some((e) => f.includes(e)))) return a(
|
|
4503
|
+
if (n.value.followBlocks?.some((e) => e.elementIds.some((e) => f.includes(e)))) return a(g("core.followBlock.memberConflict")), null;
|
|
4504
4504
|
let p = {
|
|
4505
4505
|
collection: "",
|
|
4506
4506
|
columns: 2,
|
|
4507
4507
|
direction: "vertical",
|
|
4508
4508
|
gapX: 2,
|
|
4509
4509
|
gapY: 2,
|
|
4510
|
-
id:
|
|
4511
|
-
name:
|
|
4510
|
+
id: V("group"),
|
|
4511
|
+
name: g("designer.repeatGroupStore.numberedGroupName", { groupNumber: c.value.length + 1 }),
|
|
4512
4512
|
...i,
|
|
4513
4513
|
elementIds: f,
|
|
4514
4514
|
pageId: t
|
|
4515
4515
|
};
|
|
4516
|
-
return n.value.repeatGroups = c.value.filter((e) => !d.includes(e)), n.value.repeatGroups.push(p),
|
|
4516
|
+
return n.value.repeatGroups = c.value.filter((e) => !d.includes(e)), n.value.repeatGroups.push(p), w(n.value), e.selection.set(f), o(), p;
|
|
4517
4517
|
}
|
|
4518
|
-
let
|
|
4518
|
+
let b = t((e, t, n = {}) => y(e, t, n, !1), "create"), x = t((e, t, n = {}) => y(e, t, n, !0), "applyToSelection"), S = t((e, t) => {
|
|
4519
4519
|
let r = u(e);
|
|
4520
|
-
r && (t.elementIds?.some((e) => n.value.followBlocks?.some((t) => t.elementIds.includes(e))) ? a(
|
|
4520
|
+
r && (t.elementIds?.some((e) => n.value.followBlocks?.some((t) => t.elementIds.includes(e))) ? a(g("core.followBlock.memberConflict")) : (Object.assign(r, t), w(n.value), o()));
|
|
4521
4521
|
}, "update"), C = t((e, t = !1) => {
|
|
4522
4522
|
let r = u(e);
|
|
4523
|
-
r && (n.value.repeatGroups = (n.value.repeatGroups ?? []).filter((t) => t.id !== e),
|
|
4523
|
+
r && (n.value.repeatGroups = (n.value.repeatGroups ?? []).filter((t) => t.id !== e), w(n.value), t ? s(r.elementIds) : o());
|
|
4524
4524
|
}, "remove");
|
|
4525
4525
|
return {
|
|
4526
|
-
activePageGroups:
|
|
4527
|
-
applyToSelection:
|
|
4528
|
-
create:
|
|
4526
|
+
activePageGroups: _,
|
|
4527
|
+
applyToSelection: x,
|
|
4528
|
+
create: b,
|
|
4529
4529
|
find: U(() => u),
|
|
4530
4530
|
findByElement: U(() => d),
|
|
4531
|
-
getApplyTarget: U(() =>
|
|
4531
|
+
getApplyTarget: U(() => v),
|
|
4532
4532
|
getByElements: U(() => p),
|
|
4533
4533
|
getByPage: U(() => f),
|
|
4534
4534
|
getMembers: U(() => m),
|
|
4535
4535
|
list: c,
|
|
4536
4536
|
remove: C,
|
|
4537
4537
|
selected: h,
|
|
4538
|
-
update:
|
|
4538
|
+
update: S
|
|
4539
4539
|
};
|
|
4540
4540
|
})();
|
|
4541
4541
|
}
|
|
4542
4542
|
// src/designer/stores/scope-store.ts
|
|
4543
|
-
function
|
|
4543
|
+
function ei(e) {
|
|
4544
4544
|
return H("editor-scope", () => {
|
|
4545
4545
|
let t = U(() => {
|
|
4546
4546
|
for (let t of e) {
|
|
@@ -4573,10 +4573,10 @@ function $r(e) {
|
|
|
4573
4573
|
})();
|
|
4574
4574
|
}
|
|
4575
4575
|
// src/designer/stores/selection-store.ts
|
|
4576
|
-
function
|
|
4576
|
+
function ti(e, t) {
|
|
4577
4577
|
return e.length === t.length && e.every((e, n) => t[n] === e);
|
|
4578
4578
|
}
|
|
4579
|
-
function
|
|
4579
|
+
function ni(e) {
|
|
4580
4580
|
return H("editor-selection", ({ action: t }) => {
|
|
4581
4581
|
let { data: n } = G(e.document), { active: r } = G(e.scope), i = W([]), a = U(() => new Set(i.value)), o = U(() => function(e) {
|
|
4582
4582
|
return a.value.has(e);
|
|
@@ -4588,13 +4588,13 @@ function ti(e) {
|
|
|
4588
4588
|
u.value = e;
|
|
4589
4589
|
}, "setEditingId"), m = U(() => {
|
|
4590
4590
|
let e = [];
|
|
4591
|
-
for (let t of
|
|
4591
|
+
for (let t of ee(n.value)) for (let n of t.elements) o.value(n.id) && e.push(n);
|
|
4592
4592
|
return e;
|
|
4593
4593
|
}), h = U(() => m.value[0] ?? null), g = U(() => m.value.length > 0 && m.value.every((e) => e.type === h.value?.type)), _ = U(() => m.value.length === 1 ? m.value[0] : null), v = U(() => m.value.length === 0), y = U(() => m.value.some((e) => e.locked)), b = U(() => m.value.filter((e) => !e.locked)), x = U(() => function(e, t = {}) {
|
|
4594
|
-
return (
|
|
4594
|
+
return (L(n.value, e)?.elements ?? []).filter((e) => o.value(e.id) && (t.visible === void 0 || e.visible === t.visible) && (t.locked === void 0 || e.locked === t.locked));
|
|
4595
4595
|
}), S = U(() => {
|
|
4596
4596
|
let e = m.value;
|
|
4597
|
-
return e.length === 0 ? null :
|
|
4597
|
+
return e.length === 0 ? null : be(e.map((e) => ce({
|
|
4598
4598
|
height: e.height,
|
|
4599
4599
|
width: e.width,
|
|
4600
4600
|
x: e.x,
|
|
@@ -4607,30 +4607,30 @@ function ti(e) {
|
|
|
4607
4607
|
let t = new Set(i.value);
|
|
4608
4608
|
for (let n of e) t.has(n) ? t.delete(n) : t.add(n);
|
|
4609
4609
|
let n = [...t];
|
|
4610
|
-
|
|
4611
|
-
} else
|
|
4610
|
+
ti(n, i.value) || (i.value = n);
|
|
4611
|
+
} else ti(e, i.value) || (i.value = [...e]);
|
|
4612
4612
|
i.value.length > 0 && (s.value = null, u.value = null), C.value && !i.value.includes(C.value) && (C.value = null);
|
|
4613
4613
|
}, "set"), E = t(() => {
|
|
4614
4614
|
i.value = [], C.value = null, s.value = null;
|
|
4615
|
-
}, "clear"),
|
|
4615
|
+
}, "clear"), D = t(() => {
|
|
4616
4616
|
let e = r.value;
|
|
4617
4617
|
e && (C.value = null, i.value = e.elements.filter((e) => e.visible && !e.locked).map((e) => e.id));
|
|
4618
|
-
}, "all"),
|
|
4618
|
+
}, "all"), O = U(() => {
|
|
4619
4619
|
let t = s.value;
|
|
4620
4620
|
return t ? e.guide.find(t) : null;
|
|
4621
|
-
}),
|
|
4621
|
+
}), k = t((e) => {
|
|
4622
4622
|
s.value = e, e && (i.value = [], u.value = null, C.value = null);
|
|
4623
4623
|
}, "selectGuide");
|
|
4624
4624
|
K(i, (e) => {
|
|
4625
4625
|
e.length > 0 && (s.value = null);
|
|
4626
|
-
}), K(
|
|
4626
|
+
}), K(O, (e) => {
|
|
4627
4627
|
s.value && !e && (s.value = null);
|
|
4628
4628
|
}, { flush: "sync" });
|
|
4629
|
-
function
|
|
4629
|
+
function A() {
|
|
4630
4630
|
E(), c.value = null, u.value = null, l.value = null;
|
|
4631
4631
|
}
|
|
4632
4632
|
return {
|
|
4633
|
-
all:
|
|
4633
|
+
all: D,
|
|
4634
4634
|
bounds: S,
|
|
4635
4635
|
clear: E,
|
|
4636
4636
|
editingId: u,
|
|
@@ -4644,11 +4644,11 @@ function ti(e) {
|
|
|
4644
4644
|
nodes: m,
|
|
4645
4645
|
primary: h,
|
|
4646
4646
|
renamingId: l,
|
|
4647
|
-
reset:
|
|
4647
|
+
reset: A,
|
|
4648
4648
|
sameType: g,
|
|
4649
|
-
selectedGuide:
|
|
4649
|
+
selectedGuide: O,
|
|
4650
4650
|
selectedGuideId: s,
|
|
4651
|
-
selectGuide:
|
|
4651
|
+
selectGuide: k,
|
|
4652
4652
|
set: T,
|
|
4653
4653
|
setEditingId: p,
|
|
4654
4654
|
setHoverId: d,
|
|
@@ -4660,9 +4660,9 @@ function ti(e) {
|
|
|
4660
4660
|
})();
|
|
4661
4661
|
}
|
|
4662
4662
|
// src/designer/stores/template-store.ts
|
|
4663
|
-
function
|
|
4663
|
+
function ri(e) {
|
|
4664
4664
|
return H("editor-template", () => {
|
|
4665
|
-
let { data: t } = G(e.document), n = e.history.commit, r = e.ui.toast, i = W(null), a = W(null), o = U(() => t.value.templates ?? []), s = U(() => o.value.filter((e) => !e.owner)), c = U(() => i.value ? o.value.find((e) => e.id === i.value) : void 0), l = U(() => c.value ?
|
|
4665
|
+
let { data: t } = G(e.document), n = e.history.commit, r = e.ui.toast, i = W(null), a = W(null), o = U(() => t.value.templates ?? []), s = U(() => o.value.filter((e) => !e.owner)), c = U(() => i.value ? o.value.find((e) => e.id === i.value) : void 0), l = U(() => c.value ? Ne(c.value) : []), u = U(() => l.value.find((e) => e.id === a.value) ?? c.value?.page ?? null);
|
|
4666
4666
|
function d(e) {
|
|
4667
4667
|
return o.value.find((t) => t.id === e);
|
|
4668
4668
|
}
|
|
@@ -4676,90 +4676,90 @@ function ni(e) {
|
|
|
4676
4676
|
function m(e) {
|
|
4677
4677
|
return f(e)?.background ?? e.background;
|
|
4678
4678
|
}
|
|
4679
|
-
function
|
|
4679
|
+
function _(e) {
|
|
4680
4680
|
return t.value.pages.filter((t) => (t.templateId ?? "template-blank") === e).length;
|
|
4681
4681
|
}
|
|
4682
|
-
function
|
|
4683
|
-
return
|
|
4682
|
+
function v(e) {
|
|
4683
|
+
return y(e) !== void 0;
|
|
4684
4684
|
}
|
|
4685
|
-
function
|
|
4686
|
-
return o.value.find((t) =>
|
|
4685
|
+
function y(e) {
|
|
4686
|
+
return o.value.find((t) => Ne(t).some((t) => t.id === e));
|
|
4687
4687
|
}
|
|
4688
|
-
function
|
|
4688
|
+
function x(e) {
|
|
4689
4689
|
t.value.templates || (t.value.templates = []), t.value.templates.push(e), n();
|
|
4690
4690
|
}
|
|
4691
|
-
function
|
|
4691
|
+
function C(e) {
|
|
4692
4692
|
let n = d(e.id);
|
|
4693
4693
|
if (n) return n;
|
|
4694
|
-
let r =
|
|
4695
|
-
return
|
|
4694
|
+
let r = b(e);
|
|
4695
|
+
return k(r), E({
|
|
4696
4696
|
...t.value,
|
|
4697
4697
|
templates: [...o.value, r]
|
|
4698
|
-
}, r),
|
|
4698
|
+
}, r), x(r), r;
|
|
4699
4699
|
}
|
|
4700
|
-
function
|
|
4701
|
-
if (n.id && (d(n.id) ||
|
|
4702
|
-
let r = e.page.active, i =
|
|
4700
|
+
function w(n = {}) {
|
|
4701
|
+
if (n.id && (d(n.id) || L(t.value, n.id))) throw Error(`Template already exists: ${n.id}`);
|
|
4702
|
+
let r = e.page.active, i = I(n.name ?? g("designer.templateStore.newTemplateName", { templateNumber: s.value.length }), r ? {
|
|
4703
4703
|
height: r.height,
|
|
4704
4704
|
width: r.width
|
|
4705
4705
|
} : void 0);
|
|
4706
|
-
return n.id !== void 0 && (i.id = n.id, i.page.id = n.id),
|
|
4706
|
+
return n.id !== void 0 && (i.id = n.id, i.page.id = n.id), x(i), i;
|
|
4707
4707
|
}
|
|
4708
|
-
function
|
|
4708
|
+
function T() {
|
|
4709
4709
|
let n = e.page.active;
|
|
4710
4710
|
if (!n) return null;
|
|
4711
|
-
let i =
|
|
4711
|
+
let i = I(g("designer.templateStore.fromPageTemplateName", { pageName: n.name }), n);
|
|
4712
4712
|
return i.background = n.background, i.page.elements = n.elements.map((n) => {
|
|
4713
|
-
let r =
|
|
4714
|
-
return r.id =
|
|
4713
|
+
let r = z(n);
|
|
4714
|
+
return r.id = V("el"), M(t.value, n, r, e.elements ?? F), r;
|
|
4715
4715
|
}), i.page.guides = n.guides.map((e) => ({
|
|
4716
4716
|
...e,
|
|
4717
|
-
id:
|
|
4718
|
-
})),
|
|
4717
|
+
id: V("guide")
|
|
4718
|
+
})), x(i), r(g("designer.templateStore.createdFromPageMessage")), i;
|
|
4719
4719
|
}
|
|
4720
|
-
function
|
|
4720
|
+
function D(e, t) {
|
|
4721
4721
|
let r = d(e);
|
|
4722
|
-
r && t.trim() && (
|
|
4722
|
+
r && t.trim() && (A(r, t.trim()), n());
|
|
4723
4723
|
}
|
|
4724
|
-
function
|
|
4724
|
+
function O(e, r, i = {}) {
|
|
4725
4725
|
let a = d(e);
|
|
4726
4726
|
if (a) {
|
|
4727
|
-
if (r.baseTemplateId && d(r.baseTemplateId)?.owner || a.owner && r.facingPages) throw new
|
|
4727
|
+
if (r.baseTemplateId && d(r.baseTemplateId)?.owner || a.owner && r.facingPages) throw new h(g("core.pageExtensions.internalTemplate"), { code: "template.internal-resource" });
|
|
4728
4728
|
if (r.baseTemplateId !== void 0) {
|
|
4729
4729
|
let e = {
|
|
4730
4730
|
...a,
|
|
4731
4731
|
baseTemplateId: r.baseTemplateId || void 0
|
|
4732
4732
|
};
|
|
4733
|
-
|
|
4733
|
+
E(t.value, e), a.baseTemplateId = e.baseTemplateId;
|
|
4734
4734
|
}
|
|
4735
|
-
r.background !== void 0 && (a.background = r.background || void 0), r.facingPages !== void 0 && (a.facingPages = r.facingPages, a.oddPages = !0, a.evenPages = !0, r.facingPages && !a.evenPage && (a.evenPage =
|
|
4735
|
+
r.background !== void 0 && (a.background = r.background || void 0), r.facingPages !== void 0 && (a.facingPages = r.facingPages, a.oddPages = !0, a.evenPages = !0, r.facingPages && !a.evenPage && (a.evenPage = me(a.page.width, a.page.height, a.name, { margins: a.page.margins }), a.evenPage.id = `${a.id}-even`)), r.oddPages !== void 0 && (a.oddPages = r.oddPages), r.evenPages !== void 0 && (a.evenPages = r.evenPages), r.name !== void 0 && A(a, r.name), (r.facingPages !== void 0 || r.oddPages !== void 0 || r.evenPages !== void 0) && P(a.id), i.transient || n();
|
|
4736
4736
|
}
|
|
4737
4737
|
}
|
|
4738
|
-
function
|
|
4738
|
+
function A(e, t) {
|
|
4739
4739
|
e.name = t, e.page.name = t, e.evenPage && (e.evenPage.name = t);
|
|
4740
4740
|
}
|
|
4741
|
-
function
|
|
4741
|
+
function j(e) {
|
|
4742
4742
|
let r = d(e);
|
|
4743
4743
|
if (r) {
|
|
4744
|
-
if (r.owner) throw new
|
|
4745
|
-
if (r.builtin) throw new
|
|
4744
|
+
if (r.owner) throw new h(g("core.pageExtensions.internalTemplate"), { code: "template.internal-resource" });
|
|
4745
|
+
if (r.builtin) throw new h(g("designer.templateStore.builtinRemoveDenied"), { code: "template.builtin-remove" });
|
|
4746
4746
|
for (let n of t.value.pages) n.templateId === e && (n.templateId = void 0);
|
|
4747
4747
|
i.value === e && (i.value = null, a.value = null), t.value.templates = (t.value.templates ?? []).filter((t) => t.id !== e);
|
|
4748
4748
|
for (let t of o.value) t.baseTemplateId === e && (t.baseTemplateId = void 0);
|
|
4749
|
-
|
|
4749
|
+
N(t.value), de(t.value), P(xe), n();
|
|
4750
4750
|
}
|
|
4751
4751
|
}
|
|
4752
|
-
function
|
|
4753
|
-
let r =
|
|
4752
|
+
function P(e, n) {
|
|
4753
|
+
let r = ee(t.value, e, n);
|
|
4754
4754
|
for (let { dimensions: e, page: t } of r) Object.assign(t, e);
|
|
4755
4755
|
}
|
|
4756
|
-
function
|
|
4756
|
+
function ee(e, t, n) {
|
|
4757
4757
|
let r = [];
|
|
4758
4758
|
for (let i of e.pages) {
|
|
4759
4759
|
if (n && !n.has(i.id) || t && (i.templateId ?? "template-blank") !== t) continue;
|
|
4760
4760
|
let a = Me(e, i);
|
|
4761
4761
|
if (!a) continue;
|
|
4762
|
-
let o =
|
|
4762
|
+
let o = S(a.page);
|
|
4763
4763
|
r.push({
|
|
4764
4764
|
dimensions: o,
|
|
4765
4765
|
page: i
|
|
@@ -4767,19 +4767,19 @@ function ni(e) {
|
|
|
4767
4767
|
}
|
|
4768
4768
|
return r;
|
|
4769
4769
|
}
|
|
4770
|
-
function
|
|
4770
|
+
function te(e) {
|
|
4771
4771
|
let n = e.filter((e) => {
|
|
4772
4772
|
let n = t.value.pages.find((t) => t.id === e);
|
|
4773
4773
|
return n && d(n.templateId ?? "template-blank")?.facingPages;
|
|
4774
4774
|
});
|
|
4775
|
-
|
|
4775
|
+
P(void 0, new Set(n));
|
|
4776
4776
|
}
|
|
4777
|
-
function
|
|
4777
|
+
function ne(e, r) {
|
|
4778
4778
|
let i = d(r);
|
|
4779
4779
|
if (!i && r !== "template-none" || e.length === 0) return;
|
|
4780
|
-
if (i?.owner) throw new
|
|
4780
|
+
if (i?.owner) throw new h(g("core.pageExtensions.internalTemplate"), { code: "template.internal-resource" });
|
|
4781
4781
|
let a = new Set(e);
|
|
4782
|
-
|
|
4782
|
+
ee({
|
|
4783
4783
|
...t.value,
|
|
4784
4784
|
pages: t.value.pages.map((e) => a.has(e.id) ? {
|
|
4785
4785
|
...e,
|
|
@@ -4789,24 +4789,24 @@ function ni(e) {
|
|
|
4789
4789
|
for (let e of t.value.pages) if (a.has(e.id)) {
|
|
4790
4790
|
e.templateId = r;
|
|
4791
4791
|
let n = Me(t.value, e);
|
|
4792
|
-
n && Object.assign(e,
|
|
4792
|
+
n && Object.assign(e, S(n.page));
|
|
4793
4793
|
}
|
|
4794
4794
|
n();
|
|
4795
4795
|
}
|
|
4796
|
-
function
|
|
4796
|
+
function re(e) {
|
|
4797
4797
|
d(e) && (i.value = e, a.value = d(e)?.page.id ?? null);
|
|
4798
4798
|
}
|
|
4799
|
-
function
|
|
4799
|
+
function ie(e) {
|
|
4800
4800
|
l.value.some((t) => t.id === e) && (a.value = e);
|
|
4801
4801
|
}
|
|
4802
|
-
function
|
|
4803
|
-
let i =
|
|
4802
|
+
function ae(e, r) {
|
|
4803
|
+
let i = y(e), a = i ? Ne(i).find((t) => t.id === e) : void 0;
|
|
4804
4804
|
if (!a) return;
|
|
4805
|
-
let s =
|
|
4805
|
+
let s = S({
|
|
4806
4806
|
...a,
|
|
4807
4807
|
...r
|
|
4808
4808
|
});
|
|
4809
|
-
i &&
|
|
4809
|
+
i && ee({
|
|
4810
4810
|
...t.value,
|
|
4811
4811
|
templates: o.value.map((t) => t.id === i.id ? {
|
|
4812
4812
|
...t,
|
|
@@ -4819,58 +4819,58 @@ function ni(e) {
|
|
|
4819
4819
|
...r
|
|
4820
4820
|
} : t.page
|
|
4821
4821
|
} : t)
|
|
4822
|
-
}, i.id), Object.assign(a, r, s), i &&
|
|
4822
|
+
}, i.id), Object.assign(a, r, s), i && P(i.id), i && r.name !== void 0 && A(i, r.name), n();
|
|
4823
4823
|
}
|
|
4824
|
-
function
|
|
4824
|
+
function R() {
|
|
4825
4825
|
i.value = null, a.value = null;
|
|
4826
4826
|
}
|
|
4827
|
-
function
|
|
4827
|
+
function se(r) {
|
|
4828
4828
|
let i = t.value.pages.find((e) => e.id === r);
|
|
4829
4829
|
if (!i) return;
|
|
4830
4830
|
let a = f(i);
|
|
4831
4831
|
if (!a) return;
|
|
4832
4832
|
let o = a.page.elements.map((n) => {
|
|
4833
|
-
let r =
|
|
4834
|
-
return r.id =
|
|
4833
|
+
let r = z(n);
|
|
4834
|
+
return r.id = V("el"), M(t.value, n, r, e.elements ?? F), r;
|
|
4835
4835
|
});
|
|
4836
|
-
i.elements.unshift(...o), i.background = a.background ?? i.background, i.templateId =
|
|
4836
|
+
i.elements.unshift(...o), i.background = a.background ?? i.background, i.templateId = oe, n();
|
|
4837
4837
|
}
|
|
4838
4838
|
return {
|
|
4839
|
-
activatePage:
|
|
4840
|
-
applyToPages:
|
|
4841
|
-
create:
|
|
4842
|
-
createFromPage:
|
|
4843
|
-
detach:
|
|
4839
|
+
activatePage: ie,
|
|
4840
|
+
applyToPages: ne,
|
|
4841
|
+
create: w,
|
|
4842
|
+
createFromPage: T,
|
|
4843
|
+
detach: se,
|
|
4844
4844
|
editingId: i,
|
|
4845
4845
|
editingPage: u,
|
|
4846
4846
|
editingPages: l,
|
|
4847
4847
|
editingTemplate: c,
|
|
4848
4848
|
effectiveBackground: U(() => m),
|
|
4849
4849
|
effectiveTemplate: U(() => p),
|
|
4850
|
-
enterEdit:
|
|
4851
|
-
exitEdit:
|
|
4850
|
+
enterEdit: re,
|
|
4851
|
+
exitEdit: R,
|
|
4852
4852
|
get: U(() => d),
|
|
4853
|
-
getByPage: U(() =>
|
|
4854
|
-
import:
|
|
4855
|
-
isContainer: U(() =>
|
|
4853
|
+
getByPage: U(() => y),
|
|
4854
|
+
import: C,
|
|
4855
|
+
isContainer: U(() => v),
|
|
4856
4856
|
list: s,
|
|
4857
|
-
remove:
|
|
4858
|
-
rename:
|
|
4857
|
+
remove: j,
|
|
4858
|
+
rename: D,
|
|
4859
4859
|
resolveFor: U(() => f),
|
|
4860
|
-
syncPageDimensions:
|
|
4861
|
-
update:
|
|
4862
|
-
updatePage:
|
|
4863
|
-
usageCount: U(() =>
|
|
4860
|
+
syncPageDimensions: te,
|
|
4861
|
+
update: O,
|
|
4862
|
+
updatePage: ae,
|
|
4863
|
+
usageCount: U(() => _)
|
|
4864
4864
|
};
|
|
4865
4865
|
})();
|
|
4866
4866
|
}
|
|
4867
4867
|
// src/designer/stores/tutorial-store.ts
|
|
4868
|
-
function
|
|
4868
|
+
function ii(e) {
|
|
4869
4869
|
return H("editor-tutorial", () => {
|
|
4870
|
-
let t = W("idle"), n = W(null), r = W(0), i =
|
|
4870
|
+
let t = W("idle"), n = W(null), r = W(0), i = We([]), a = U(() => {
|
|
4871
4871
|
let e = i.value;
|
|
4872
4872
|
return typeof e == "function" ? e() : e;
|
|
4873
|
-
}), o = W(!1), s = W(!1), c = W("idle"), l = W(1200), u = U(() => a.value[r.value]), d = W(null), f = U(() =>
|
|
4873
|
+
}), o = W(!1), s = W(!1), c = W("idle"), l = W(1200), u = U(() => a.value[r.value]), d = W(null), f = U(() => In.find((e) => e.id === n.value));
|
|
4874
4874
|
function p() {
|
|
4875
4875
|
t.value !== "running" && t.value !== "finish" && (t.value = "list");
|
|
4876
4876
|
}
|
|
@@ -4878,7 +4878,7 @@ function ri(e) {
|
|
|
4878
4878
|
t.value === "list" && (t.value = "idle");
|
|
4879
4879
|
}
|
|
4880
4880
|
function h(l, u = []) {
|
|
4881
|
-
|
|
4881
|
+
In.find((e) => e.id === l) && t.value === "list" && e.beginSession() && (d.value = b(e.view.settings), n.value = l, r.value = 0, i.value = u, o.value = a.value.length > 0, s.value = !1, c.value = "idle", t.value = "running", e.document.rename(Rn(l, "title")), e.ui.closeDialog(), e.view.updateSettings({
|
|
4882
4882
|
previewWithData: !1,
|
|
4883
4883
|
showMargins: !0
|
|
4884
4884
|
}));
|
|
@@ -4890,14 +4890,14 @@ function ri(e) {
|
|
|
4890
4890
|
n >= a.value.length ? _() : r.value = n;
|
|
4891
4891
|
return;
|
|
4892
4892
|
}
|
|
4893
|
-
let i =
|
|
4893
|
+
let i = Zn[n];
|
|
4894
4894
|
i ? (i.apply?.(e, f.value), r.value = n) : _();
|
|
4895
4895
|
}
|
|
4896
4896
|
function _() {
|
|
4897
4897
|
t.value === "running" && (o.value = !1, e.ui.closeDialog(), t.value = "finish");
|
|
4898
4898
|
}
|
|
4899
4899
|
function v(i, c = !1) {
|
|
4900
|
-
t.value !== "running" || !n.value || s.value || !Number.isInteger(i) || i < 0 || i >= a.value.length || i === r.value && !c || (o.value = !1, e.ui.closeDialog(), e.finishSession(!1), e.beginSession() ? (e.document.rename(
|
|
4900
|
+
t.value !== "running" || !n.value || s.value || !Number.isInteger(i) || i < 0 || i >= a.value.length || i === r.value && !c || (o.value = !1, e.ui.closeDialog(), e.finishSession(!1), e.beginSession() ? (e.document.rename(Rn(n.value, "title")), e.view.updateSettings({
|
|
4901
4901
|
previewWithData: !1,
|
|
4902
4902
|
showMargins: !0
|
|
4903
4903
|
}), r.value = i) : y(!1));
|
|
@@ -4905,19 +4905,19 @@ function ri(e) {
|
|
|
4905
4905
|
function y(r) {
|
|
4906
4906
|
(t.value === "running" || t.value === "finish") && (e.ui.closeDialog(), e.finishSession(r), d.value && e.view.updateSettings(d.value), d.value = null, o.value = !1, s.value = !1, i.value = [], n.value = null, t.value = "idle", c.value = "idle");
|
|
4907
4907
|
}
|
|
4908
|
-
function
|
|
4908
|
+
function x(e) {
|
|
4909
4909
|
o.value = e && t.value === "running" && c.value === "idle";
|
|
4910
4910
|
}
|
|
4911
|
-
function
|
|
4911
|
+
function S(e) {
|
|
4912
4912
|
s.value = e;
|
|
4913
4913
|
}
|
|
4914
|
-
function
|
|
4914
|
+
function C(e) {
|
|
4915
4915
|
c.value = e;
|
|
4916
4916
|
}
|
|
4917
|
-
function
|
|
4917
|
+
function w(e) {
|
|
4918
4918
|
l.value = Math.max(200, e);
|
|
4919
4919
|
}
|
|
4920
|
-
return
|
|
4920
|
+
return Ve(() => y(!1)), {
|
|
4921
4921
|
close: m,
|
|
4922
4922
|
course: f,
|
|
4923
4923
|
courseId: n,
|
|
@@ -4933,34 +4933,34 @@ function ri(e) {
|
|
|
4933
4933
|
playing: o,
|
|
4934
4934
|
requestFinish: _,
|
|
4935
4935
|
seek: v,
|
|
4936
|
-
setExecuting:
|
|
4937
|
-
setInterval:
|
|
4938
|
-
setPlaying:
|
|
4939
|
-
setTransition:
|
|
4936
|
+
setExecuting: S,
|
|
4937
|
+
setInterval: w,
|
|
4938
|
+
setPlaying: x,
|
|
4939
|
+
setTransition: C,
|
|
4940
4940
|
start: h,
|
|
4941
4941
|
transition: c
|
|
4942
4942
|
};
|
|
4943
4943
|
})();
|
|
4944
4944
|
}
|
|
4945
4945
|
// src/designer/stores/ui-store.ts
|
|
4946
|
-
var
|
|
4947
|
-
function
|
|
4946
|
+
var ai = "print-studio:theme-mode";
|
|
4947
|
+
function oi(e, t) {
|
|
4948
4948
|
try {
|
|
4949
|
-
let t = e ? e.get(
|
|
4949
|
+
let t = e ? e.get(ai) : localStorage.getItem(ai);
|
|
4950
4950
|
return t === "light" || t === "dark" || t === "system" ? t : "dark";
|
|
4951
4951
|
} catch (e) {
|
|
4952
4952
|
return t(e), "dark";
|
|
4953
4953
|
}
|
|
4954
4954
|
}
|
|
4955
|
-
function
|
|
4955
|
+
function si(e) {
|
|
4956
4956
|
return H("editor-ui", ({ action: t }) => {
|
|
4957
|
-
let n = W(e.persistPreferences === !1 ? "dark" :
|
|
4957
|
+
let n = W(e.persistPreferences === !1 ? "dark" : oi(e.preferenceStorage, e.capturePreferenceError));
|
|
4958
4958
|
function r() {
|
|
4959
|
-
n.value = e.persistPreferences === !1 ? "dark" :
|
|
4959
|
+
n.value = e.persistPreferences === !1 ? "dark" : oi(e.preferenceStorage, e.capturePreferenceError);
|
|
4960
4960
|
}
|
|
4961
4961
|
function i(t) {
|
|
4962
4962
|
if (n.value = t, e.persistPreferences !== !1) try {
|
|
4963
|
-
e.preferenceStorage ? e.preferenceStorage.set(
|
|
4963
|
+
e.preferenceStorage ? e.preferenceStorage.set(ai, t) : localStorage.setItem(ai, t);
|
|
4964
4964
|
} catch (t) {
|
|
4965
4965
|
e.capturePreferenceError(t);
|
|
4966
4966
|
}
|
|
@@ -4999,7 +4999,7 @@ function oi(e) {
|
|
|
4999
4999
|
function S(e) {
|
|
5000
5000
|
y.value += 1, v.value = e;
|
|
5001
5001
|
}
|
|
5002
|
-
|
|
5002
|
+
Ve(() => {
|
|
5003
5003
|
for (let e of x.values()) clearTimeout(e);
|
|
5004
5004
|
x.clear();
|
|
5005
5005
|
});
|
|
@@ -5072,14 +5072,14 @@ function oi(e) {
|
|
|
5072
5072
|
function N() {
|
|
5073
5073
|
f.value = [];
|
|
5074
5074
|
}
|
|
5075
|
-
function
|
|
5075
|
+
function P() {
|
|
5076
5076
|
d.value = { name: null }, v.value = {};
|
|
5077
5077
|
}
|
|
5078
5078
|
return {
|
|
5079
5079
|
activeDialog: d,
|
|
5080
5080
|
clearSuspendedDialogs: N,
|
|
5081
5081
|
closeContextMenu: O,
|
|
5082
|
-
closeDialog:
|
|
5082
|
+
closeDialog: P,
|
|
5083
5083
|
completeExportDialog: l,
|
|
5084
5084
|
contextMenu: a,
|
|
5085
5085
|
dialogElementId: m,
|
|
@@ -5110,48 +5110,48 @@ function oi(e) {
|
|
|
5110
5110
|
})();
|
|
5111
5111
|
}
|
|
5112
5112
|
// src/designer/config/canvas-background.ts
|
|
5113
|
-
var
|
|
5113
|
+
var ci = [
|
|
5114
5114
|
{
|
|
5115
5115
|
color: "var(--color-canvas)",
|
|
5116
5116
|
id: "default",
|
|
5117
5117
|
get label() {
|
|
5118
|
-
return
|
|
5118
|
+
return g("designer.canvasBackground.defaultLabel");
|
|
5119
5119
|
}
|
|
5120
5120
|
},
|
|
5121
5121
|
{
|
|
5122
5122
|
color: "#000000",
|
|
5123
5123
|
id: "black",
|
|
5124
5124
|
get label() {
|
|
5125
|
-
return
|
|
5125
|
+
return g("designer.canvasBackground.blackLabel");
|
|
5126
5126
|
}
|
|
5127
5127
|
},
|
|
5128
5128
|
{
|
|
5129
5129
|
color: "#333333",
|
|
5130
5130
|
id: "dark-gray",
|
|
5131
5131
|
get label() {
|
|
5132
|
-
return
|
|
5132
|
+
return g("designer.canvasBackground.darkGrayLabel");
|
|
5133
5133
|
}
|
|
5134
5134
|
},
|
|
5135
5135
|
{
|
|
5136
5136
|
color: "#5e5e5e",
|
|
5137
5137
|
id: "medium-gray",
|
|
5138
5138
|
get label() {
|
|
5139
|
-
return
|
|
5139
|
+
return g("designer.canvasBackground.mediumGrayLabel");
|
|
5140
5140
|
}
|
|
5141
5141
|
},
|
|
5142
5142
|
{
|
|
5143
5143
|
color: "#a0a0a0",
|
|
5144
5144
|
id: "light-gray",
|
|
5145
5145
|
get label() {
|
|
5146
|
-
return
|
|
5146
|
+
return g("designer.canvasBackground.lightGrayLabel");
|
|
5147
5147
|
}
|
|
5148
5148
|
}
|
|
5149
|
-
],
|
|
5150
|
-
function
|
|
5151
|
-
return e === "custom" ||
|
|
5149
|
+
], li = "#4d4d4d";
|
|
5150
|
+
function ui(e) {
|
|
5151
|
+
return e === "custom" || ci.some((t) => t.id === e);
|
|
5152
5152
|
}
|
|
5153
5153
|
// src/designer/stores/view-store.ts
|
|
5154
|
-
function
|
|
5154
|
+
function di(e) {
|
|
5155
5155
|
return H("editor-view", () => {
|
|
5156
5156
|
let { layoutMode: t, pageGap: n, pages: r } = G(e.scope), i = W(1), a = W("select"), o = W(!1), s = W(null), c = W({
|
|
5157
5157
|
left: 0,
|
|
@@ -5163,7 +5163,7 @@ function ui(e) {
|
|
|
5163
5163
|
h: [],
|
|
5164
5164
|
pageId: "",
|
|
5165
5165
|
v: []
|
|
5166
|
-
}), p =
|
|
5166
|
+
}), p = He({
|
|
5167
5167
|
clickToCreate: !1,
|
|
5168
5168
|
gridSize: 5,
|
|
5169
5169
|
guidesLocked: !1,
|
|
@@ -5177,7 +5177,7 @@ function ui(e) {
|
|
|
5177
5177
|
snapToGrid: !1,
|
|
5178
5178
|
snapToGuides: !0,
|
|
5179
5179
|
snapToMargins: !0
|
|
5180
|
-
}), m =
|
|
5180
|
+
}), m = He({
|
|
5181
5181
|
spacing: null,
|
|
5182
5182
|
target: "selection"
|
|
5183
5183
|
});
|
|
@@ -5204,15 +5204,15 @@ function ui(e) {
|
|
|
5204
5204
|
try {
|
|
5205
5205
|
let t = null;
|
|
5206
5206
|
if (e.persistPreferences !== !1 && (t = e.preferenceStorage ? e.preferenceStorage.get(x) : localStorage.getItem(x)), t) {
|
|
5207
|
-
let e = JSON.parse(t), n = typeof e.customColor == "string" && e.customColor.trim() !== "" ? e.customColor.trim() :
|
|
5208
|
-
if (
|
|
5207
|
+
let e = JSON.parse(t), n = typeof e.customColor == "string" && e.customColor.trim() !== "" ? e.customColor.trim() : li;
|
|
5208
|
+
if (ui(e.preset)) return {
|
|
5209
5209
|
customColor: n,
|
|
5210
5210
|
preset: e.preset
|
|
5211
5211
|
};
|
|
5212
5212
|
}
|
|
5213
5213
|
} catch {}
|
|
5214
5214
|
return {
|
|
5215
|
-
customColor:
|
|
5215
|
+
customColor: li,
|
|
5216
5216
|
preset: "default"
|
|
5217
5217
|
};
|
|
5218
5218
|
}
|
|
@@ -5220,8 +5220,8 @@ function ui(e) {
|
|
|
5220
5220
|
function w() {
|
|
5221
5221
|
C.value = S();
|
|
5222
5222
|
}
|
|
5223
|
-
let T = U(() => C.value.preset), E = U(() => C.value.customColor),
|
|
5224
|
-
function
|
|
5223
|
+
let T = U(() => C.value.preset), E = U(() => C.value.customColor), D = U(() => C.value.preset === "custom" ? C.value.customColor : ci.find((e) => e.id === C.value.preset)?.color ?? "#4d4d4d");
|
|
5224
|
+
function O(t, n) {
|
|
5225
5225
|
if (C.value = {
|
|
5226
5226
|
customColor: t === "custom" ? n ?? C.value.customColor : C.value.customColor,
|
|
5227
5227
|
preset: t
|
|
@@ -5232,7 +5232,7 @@ function ui(e) {
|
|
|
5232
5232
|
} catch {}
|
|
5233
5233
|
}
|
|
5234
5234
|
}
|
|
5235
|
-
let
|
|
5235
|
+
let k = U(() => 96 / 25.4 * i.value), A = U(() => {
|
|
5236
5236
|
let e = r.value, i = t.value ?? p.pageLayoutMode, a = Math.max(...e.map((e) => e.width), 1), o = Math.max(...e.map((e) => e.height), 1);
|
|
5237
5237
|
if (i === "horizontal") {
|
|
5238
5238
|
let t = 500;
|
|
@@ -5265,29 +5265,29 @@ function ui(e) {
|
|
|
5265
5265
|
};
|
|
5266
5266
|
return s += e.height + 15, t;
|
|
5267
5267
|
});
|
|
5268
|
-
}),
|
|
5268
|
+
}), j = U(() => A.value.map((e) => {
|
|
5269
5269
|
let t = e.page.position;
|
|
5270
5270
|
return t ? {
|
|
5271
5271
|
...e,
|
|
5272
5272
|
x: t.x,
|
|
5273
5273
|
y: t.y
|
|
5274
5274
|
} : e;
|
|
5275
|
-
})),
|
|
5276
|
-
return
|
|
5275
|
+
})), M = U(() => new Map(j.value.map((e) => [e.page.id, e]))), N = U(() => function(e) {
|
|
5276
|
+
return M.value.get(e);
|
|
5277
5277
|
}), P = U(() => function(e) {
|
|
5278
|
-
let t =
|
|
5278
|
+
let t = M.value.get(e);
|
|
5279
5279
|
return t ? {
|
|
5280
5280
|
x: t.x,
|
|
5281
5281
|
y: t.y
|
|
5282
5282
|
} : void 0;
|
|
5283
|
-
}),
|
|
5284
|
-
let n = P.value(e);
|
|
5285
|
-
return n ? bn(n, t) : void 0;
|
|
5286
|
-
}), ne = U(() => function(e, t) {
|
|
5283
|
+
}), ee = U(() => function(e, t) {
|
|
5287
5284
|
let n = P.value(e);
|
|
5288
5285
|
return n ? xn(n, t) : void 0;
|
|
5289
|
-
}),
|
|
5290
|
-
let
|
|
5286
|
+
}), te = U(() => function(e, t) {
|
|
5287
|
+
let n = P.value(e);
|
|
5288
|
+
return n ? Sn(n, t) : void 0;
|
|
5289
|
+
}), ne = U(() => {
|
|
5290
|
+
let e = j.value;
|
|
5291
5291
|
if (e.length === 0) return {
|
|
5292
5292
|
height: 1e3,
|
|
5293
5293
|
width: 1e3
|
|
@@ -5297,62 +5297,62 @@ function ui(e) {
|
|
|
5297
5297
|
height: Math.max(...e.map((e) => e.y + e.page.height)) + 500,
|
|
5298
5298
|
width: t + 500
|
|
5299
5299
|
};
|
|
5300
|
-
}),
|
|
5301
|
-
let e =
|
|
5302
|
-
return e.length === 0 ? null :
|
|
5300
|
+
}), re = U(() => {
|
|
5301
|
+
let e = j.value;
|
|
5302
|
+
return e.length === 0 ? null : be(e.map((e) => ({
|
|
5303
5303
|
height: e.page.height,
|
|
5304
5304
|
width: e.page.width,
|
|
5305
5305
|
x: e.x,
|
|
5306
5306
|
y: e.y
|
|
5307
5307
|
})));
|
|
5308
5308
|
});
|
|
5309
|
-
function
|
|
5309
|
+
function ie(t) {
|
|
5310
5310
|
a.value = t, t !== "select" && e.selection.setEditingId(null);
|
|
5311
5311
|
}
|
|
5312
|
-
function
|
|
5313
|
-
i.value =
|
|
5312
|
+
function F(e) {
|
|
5313
|
+
i.value = B(R(e, 4), .05, 8);
|
|
5314
5314
|
}
|
|
5315
5315
|
function ae(e) {
|
|
5316
5316
|
u.value = e;
|
|
5317
5317
|
}
|
|
5318
|
-
function
|
|
5318
|
+
function I(e) {
|
|
5319
5319
|
d.value = e;
|
|
5320
5320
|
}
|
|
5321
|
-
function
|
|
5321
|
+
function L(e) {
|
|
5322
5322
|
f.value = e;
|
|
5323
5323
|
}
|
|
5324
5324
|
return {
|
|
5325
5325
|
activeTool: a,
|
|
5326
5326
|
alignPanel: m,
|
|
5327
|
-
canvasBackground:
|
|
5327
|
+
canvasBackground: D,
|
|
5328
5328
|
canvasBackgroundPreset: T,
|
|
5329
|
-
contentSizeMm:
|
|
5329
|
+
contentSizeMm: ne,
|
|
5330
5330
|
cursorContent: s,
|
|
5331
5331
|
customCanvasColor: E,
|
|
5332
5332
|
draggingGuide: d,
|
|
5333
|
-
getLayout:
|
|
5333
|
+
getLayout: N,
|
|
5334
5334
|
marquee: u,
|
|
5335
5335
|
originOf: P,
|
|
5336
|
-
pageLayouts:
|
|
5337
|
-
pagesBoundsMm:
|
|
5338
|
-
pxPerMm:
|
|
5336
|
+
pageLayouts: j,
|
|
5337
|
+
pagesBoundsMm: re,
|
|
5338
|
+
pxPerMm: k,
|
|
5339
5339
|
restorePreferences: w,
|
|
5340
5340
|
scrollPos: c,
|
|
5341
|
-
setCanvasBackground:
|
|
5341
|
+
setCanvasBackground: O,
|
|
5342
5342
|
setCursorContent: v,
|
|
5343
|
-
setDraggingGuide:
|
|
5343
|
+
setDraggingGuide: I,
|
|
5344
5344
|
setMarquee: ae,
|
|
5345
5345
|
setScrollPos: y,
|
|
5346
|
-
setSnapLines:
|
|
5346
|
+
setSnapLines: L,
|
|
5347
5347
|
setSpacePanning: _,
|
|
5348
5348
|
settings: p,
|
|
5349
|
-
setTool:
|
|
5349
|
+
setTool: ie,
|
|
5350
5350
|
setViewportSize: b,
|
|
5351
|
-
setZoom:
|
|
5351
|
+
setZoom: F,
|
|
5352
5352
|
snapLines: f,
|
|
5353
5353
|
spacePanning: o,
|
|
5354
|
-
toGlobal:
|
|
5355
|
-
toLocal:
|
|
5354
|
+
toGlobal: te,
|
|
5355
|
+
toLocal: ee,
|
|
5356
5356
|
updateAlignPanel: g,
|
|
5357
5357
|
updateSettings: h,
|
|
5358
5358
|
viewportSize: l,
|
|
@@ -5361,19 +5361,19 @@ function ui(e) {
|
|
|
5361
5361
|
})();
|
|
5362
5362
|
}
|
|
5363
5363
|
// src/core/z-index.ts
|
|
5364
|
-
var
|
|
5365
|
-
function
|
|
5364
|
+
var fi = 2e3;
|
|
5365
|
+
function pi(e) {
|
|
5366
5366
|
if (!Number.isInteger(e) || e < 0 || e > 2147483647) throw Error(`Invalid z-index: ${e}`);
|
|
5367
5367
|
}
|
|
5368
|
-
function
|
|
5369
|
-
return
|
|
5368
|
+
function mi(e = fi) {
|
|
5369
|
+
return pi(e), {
|
|
5370
5370
|
currentZIndex: e,
|
|
5371
5371
|
entries: [],
|
|
5372
5372
|
initialZIndex: e,
|
|
5373
5373
|
sequence: 0
|
|
5374
5374
|
};
|
|
5375
5375
|
}
|
|
5376
|
-
var
|
|
5376
|
+
var hi = class {
|
|
5377
5377
|
state;
|
|
5378
5378
|
get currentZIndex() {
|
|
5379
5379
|
return this.state.currentZIndex;
|
|
@@ -5392,7 +5392,7 @@ var mi = class {
|
|
|
5392
5392
|
this.state.entries = this.state.entries.filter((t) => t.id !== e);
|
|
5393
5393
|
}
|
|
5394
5394
|
configure(e) {
|
|
5395
|
-
|
|
5395
|
+
pi(e), this.state.initialZIndex = e, this.state.currentZIndex = Math.max(e, this.currentZIndex);
|
|
5396
5396
|
}
|
|
5397
5397
|
get(e) {
|
|
5398
5398
|
return this.state.entries.find((t) => t.id === e);
|
|
@@ -5403,11 +5403,11 @@ var mi = class {
|
|
|
5403
5403
|
}
|
|
5404
5404
|
nextZIndex() {
|
|
5405
5405
|
let e = Math.max(this.initialZIndex, this.currentZIndex) + 1;
|
|
5406
|
-
return
|
|
5406
|
+
return pi(e), this.state.currentZIndex = e, e;
|
|
5407
5407
|
}
|
|
5408
5408
|
open(e = {}) {
|
|
5409
5409
|
let t = e.zIndex ?? this.nextZIndex();
|
|
5410
|
-
|
|
5410
|
+
pi(t), this.state.currentZIndex = Math.max(this.currentZIndex, t);
|
|
5411
5411
|
let n = ++this.state.sequence;
|
|
5412
5412
|
return this.state.entries.push({
|
|
5413
5413
|
id: n,
|
|
@@ -5417,9 +5417,9 @@ var mi = class {
|
|
|
5417
5417
|
}
|
|
5418
5418
|
};
|
|
5419
5419
|
// src/designer/stores/z-index-store.ts
|
|
5420
|
-
function
|
|
5420
|
+
function gi() {
|
|
5421
5421
|
return H("editor-z-index", () => {
|
|
5422
|
-
let e =
|
|
5422
|
+
let e = He(mi()), t = new hi(e), n = U(() => t.initialZIndex), r = U(() => t.currentZIndex), i = U(() => t.get.bind(t)), a = U(() => t.isTop.bind(t));
|
|
5423
5423
|
function o(e) {
|
|
5424
5424
|
t.configure(e);
|
|
5425
5425
|
}
|
|
@@ -5450,15 +5450,15 @@ function hi() {
|
|
|
5450
5450
|
})();
|
|
5451
5451
|
}
|
|
5452
5452
|
// src/designer/stores/editor-store.ts
|
|
5453
|
-
function
|
|
5453
|
+
function _i(e = {}) {
|
|
5454
5454
|
return H("editor", () => {
|
|
5455
|
-
let t =
|
|
5455
|
+
let t = ar(), n = Qr({
|
|
5456
5456
|
config: t,
|
|
5457
5457
|
elements: e.elements,
|
|
5458
5458
|
parsers: e.parsers
|
|
5459
|
-
}), r =
|
|
5459
|
+
}), r = si({
|
|
5460
5460
|
capturePreferenceError(t) {
|
|
5461
|
-
(e.errors ??
|
|
5461
|
+
(e.errors ?? cn()).capture(t, { source: "ui.preferences" });
|
|
5462
5462
|
},
|
|
5463
5463
|
getElementId() {
|
|
5464
5464
|
return m.primary?.id;
|
|
@@ -5468,7 +5468,7 @@ function gi(e = {}) {
|
|
|
5468
5468
|
},
|
|
5469
5469
|
persistPreferences: e.persistPreferences,
|
|
5470
5470
|
preferenceStorage: e.preferenceStorage
|
|
5471
|
-
}), i =
|
|
5471
|
+
}), i = Xr(e.persistPreferences, e.preferenceStorage), a = Zr(), o = gi(), s = yr({
|
|
5472
5472
|
...e,
|
|
5473
5473
|
beginPreviewHistory() {
|
|
5474
5474
|
c.beginPreview();
|
|
@@ -5484,7 +5484,7 @@ function gi(e = {}) {
|
|
|
5484
5484
|
},
|
|
5485
5485
|
resetPreviewSession(e) {
|
|
5486
5486
|
let t = [...m.ids];
|
|
5487
|
-
e(),
|
|
5487
|
+
e(), _.cancelDraft(), v.reset(), h.setMarquee(null), h.setDraggingGuide(null), h.setSnapLines({
|
|
5488
5488
|
h: [],
|
|
5489
5489
|
pageId: "",
|
|
5490
5490
|
v: []
|
|
@@ -5494,7 +5494,7 @@ function gi(e = {}) {
|
|
|
5494
5494
|
O(!0);
|
|
5495
5495
|
},
|
|
5496
5496
|
ui: r
|
|
5497
|
-
}), c =
|
|
5497
|
+
}), c = Ir({
|
|
5498
5498
|
applyLayout() {
|
|
5499
5499
|
l.apply();
|
|
5500
5500
|
},
|
|
@@ -5502,18 +5502,18 @@ function gi(e = {}) {
|
|
|
5502
5502
|
resetSession() {
|
|
5503
5503
|
O(!1);
|
|
5504
5504
|
}
|
|
5505
|
-
}), l =
|
|
5505
|
+
}), l = Lr({ document: s }), u = zr({
|
|
5506
5506
|
document: s,
|
|
5507
5507
|
elements: e.elements,
|
|
5508
5508
|
history: c,
|
|
5509
5509
|
ui: r
|
|
5510
|
-
}), d =
|
|
5510
|
+
}), d = ri({
|
|
5511
5511
|
document: s,
|
|
5512
5512
|
elements: e.elements,
|
|
5513
5513
|
history: c,
|
|
5514
5514
|
page: u,
|
|
5515
5515
|
ui: r
|
|
5516
|
-
}), f =
|
|
5516
|
+
}), f = ei([{
|
|
5517
5517
|
activate: d.activatePage,
|
|
5518
5518
|
resolve() {
|
|
5519
5519
|
if (d.editingTemplate) return {
|
|
@@ -5534,19 +5534,19 @@ function gi(e = {}) {
|
|
|
5534
5534
|
};
|
|
5535
5535
|
},
|
|
5536
5536
|
updatePage: u.update
|
|
5537
|
-
}]), p =
|
|
5537
|
+
}]), p = Pr({
|
|
5538
5538
|
history: c,
|
|
5539
5539
|
scope: f
|
|
5540
|
-
}), m =
|
|
5540
|
+
}), m = ni({
|
|
5541
5541
|
document: s,
|
|
5542
5542
|
guide: p,
|
|
5543
5543
|
scope: f
|
|
5544
|
-
}), h =
|
|
5544
|
+
}), h = di({
|
|
5545
5545
|
persistPreferences: e.persistPreferences,
|
|
5546
5546
|
preferenceStorage: e.preferenceStorage,
|
|
5547
5547
|
scope: f,
|
|
5548
5548
|
selection: m
|
|
5549
|
-
}),
|
|
5549
|
+
}), _ = Mr({
|
|
5550
5550
|
document: s,
|
|
5551
5551
|
elements: e.elements,
|
|
5552
5552
|
history: c,
|
|
@@ -5554,60 +5554,60 @@ function gi(e = {}) {
|
|
|
5554
5554
|
scope: f,
|
|
5555
5555
|
selection: m,
|
|
5556
5556
|
ui: r
|
|
5557
|
-
}),
|
|
5557
|
+
}), v = br({
|
|
5558
5558
|
document: s,
|
|
5559
|
-
element:
|
|
5559
|
+
element: _,
|
|
5560
5560
|
history: c,
|
|
5561
5561
|
scope: f,
|
|
5562
5562
|
selection: m
|
|
5563
|
-
}),
|
|
5563
|
+
}), y = ir({
|
|
5564
5564
|
document: s,
|
|
5565
|
-
element:
|
|
5565
|
+
element: _,
|
|
5566
5566
|
elements: e.elements,
|
|
5567
5567
|
history: c,
|
|
5568
5568
|
scope: f,
|
|
5569
5569
|
selection: m,
|
|
5570
5570
|
ui: r
|
|
5571
|
-
}),
|
|
5571
|
+
}), b = or({
|
|
5572
5572
|
document: s,
|
|
5573
5573
|
history: c
|
|
5574
|
-
}),
|
|
5574
|
+
}), x = Nr({
|
|
5575
5575
|
document: s,
|
|
5576
5576
|
history: c,
|
|
5577
5577
|
selection: m,
|
|
5578
5578
|
ui: r
|
|
5579
|
-
}),
|
|
5579
|
+
}), S = $r({
|
|
5580
5580
|
document: s,
|
|
5581
|
-
element:
|
|
5581
|
+
element: _,
|
|
5582
5582
|
history: c,
|
|
5583
5583
|
page: u,
|
|
5584
5584
|
selection: m,
|
|
5585
5585
|
ui: r
|
|
5586
|
-
}), C =
|
|
5586
|
+
}), C = Qn({
|
|
5587
5587
|
document: s,
|
|
5588
5588
|
elements: e.elements,
|
|
5589
|
-
repeatGroup:
|
|
5589
|
+
repeatGroup: S,
|
|
5590
5590
|
scope: f,
|
|
5591
5591
|
template: d,
|
|
5592
5592
|
view: h
|
|
5593
|
-
}), w =
|
|
5593
|
+
}), w = Rr({
|
|
5594
5594
|
scope: f,
|
|
5595
5595
|
selection: m,
|
|
5596
5596
|
template: d,
|
|
5597
5597
|
ui: r
|
|
5598
|
-
}), T = W(null), E =
|
|
5598
|
+
}), T = W(null), E = ii({
|
|
5599
5599
|
beginSession() {
|
|
5600
|
-
return s.saving ? (r.toast(
|
|
5600
|
+
return s.saving ? (r.toast(g("designer.tutorial.waitForSave")), !1) : (T.value = D(), c.beginTemporary(), s.beginTemporary(Ln()), h.setTool("select"), !0);
|
|
5601
5601
|
},
|
|
5602
|
-
dataSource:
|
|
5602
|
+
dataSource: b,
|
|
5603
5603
|
document: s,
|
|
5604
|
-
element:
|
|
5604
|
+
element: _,
|
|
5605
5605
|
finishSession(e) {
|
|
5606
5606
|
s.finishTemporary(e), c.finishTemporary(e);
|
|
5607
5607
|
let t = T.value;
|
|
5608
5608
|
!e && t && (u.setActive(t.pageId), t.templateId && (d.enterEdit(t.templateId), f.activate(t.scopePageId)), m.set(t.selectionIds), h.setTool(t.tool), h.setZoom(t.zoom), h.setScrollPos(t.scroll)), T.value = null;
|
|
5609
5609
|
},
|
|
5610
|
-
followBlock:
|
|
5610
|
+
followBlock: x,
|
|
5611
5611
|
page: u,
|
|
5612
5612
|
template: d,
|
|
5613
5613
|
ui: r,
|
|
@@ -5627,7 +5627,7 @@ function gi(e = {}) {
|
|
|
5627
5627
|
function O(e) {
|
|
5628
5628
|
e && (w.reset(), r.closeDialog());
|
|
5629
5629
|
let t = d.editingId, n = f.active?.id;
|
|
5630
|
-
m.reset(),
|
|
5630
|
+
m.reset(), _.cancelDraft(), v.reset(), d.exitEdit(), !e && w.contexts.length > 0 && t && (d.enterEdit(t), n && f.activate(n)), h.setMarquee(null), h.setDraggingGuide(null), h.setSnapLines({
|
|
5631
5631
|
h: [],
|
|
5632
5632
|
pageId: "",
|
|
5633
5633
|
v: []
|
|
@@ -5636,7 +5636,7 @@ function gi(e = {}) {
|
|
|
5636
5636
|
(e || !i) && u.setActive(s.data.pages[0]?.id ?? "");
|
|
5637
5637
|
}
|
|
5638
5638
|
K(() => [f.id, ...f.pages.map((e) => e.id)], () => {
|
|
5639
|
-
m.reset(),
|
|
5639
|
+
m.reset(), _.cancelDraft(), h.setMarquee(null), h.setDraggingGuide(null), h.setSnapLines({
|
|
5640
5640
|
h: [],
|
|
5641
5641
|
pageId: "",
|
|
5642
5642
|
v: []
|
|
@@ -5647,13 +5647,13 @@ function gi(e = {}) {
|
|
|
5647
5647
|
}, { flush: "sync" }), u.setActive(s.data.pages[0]?.id ?? ""), c.commit();
|
|
5648
5648
|
let k = {
|
|
5649
5649
|
canvas: C,
|
|
5650
|
-
clipboard:
|
|
5650
|
+
clipboard: y,
|
|
5651
5651
|
config: t,
|
|
5652
|
-
dataSource:
|
|
5652
|
+
dataSource: b,
|
|
5653
5653
|
document: s,
|
|
5654
|
-
element:
|
|
5655
|
-
elementGroup:
|
|
5656
|
-
followBlock:
|
|
5654
|
+
element: _,
|
|
5655
|
+
elementGroup: v,
|
|
5656
|
+
followBlock: x,
|
|
5657
5657
|
guide: p,
|
|
5658
5658
|
history: c,
|
|
5659
5659
|
layout: l,
|
|
@@ -5662,7 +5662,7 @@ function gi(e = {}) {
|
|
|
5662
5662
|
panel: i,
|
|
5663
5663
|
plugin: a,
|
|
5664
5664
|
rendering: n,
|
|
5665
|
-
repeatGroup:
|
|
5665
|
+
repeatGroup: S,
|
|
5666
5666
|
scope: f,
|
|
5667
5667
|
selection: m,
|
|
5668
5668
|
template: d,
|
|
@@ -5671,12 +5671,12 @@ function gi(e = {}) {
|
|
|
5671
5671
|
view: h,
|
|
5672
5672
|
zIndex: o
|
|
5673
5673
|
};
|
|
5674
|
-
return
|
|
5674
|
+
return Ve(() => {
|
|
5675
5675
|
for (let e of Object.values(k)) e.$dispose();
|
|
5676
5676
|
}), k;
|
|
5677
5677
|
});
|
|
5678
5678
|
}
|
|
5679
|
-
var
|
|
5679
|
+
var vi = _i(), yi = class {
|
|
5680
5680
|
providers = /* @__PURE__ */ new Map();
|
|
5681
5681
|
async collect() {
|
|
5682
5682
|
let e = this.list(), t = [], n = [], r = await Promise.all(e.map(async (e) => {
|
|
@@ -5717,108 +5717,111 @@ var _i = gi(), vi = class {
|
|
|
5717
5717
|
n < 0 || (t.splice(n, 1), t.length === 0 && this.providers.delete(e.id));
|
|
5718
5718
|
};
|
|
5719
5719
|
}
|
|
5720
|
-
},
|
|
5721
|
-
bindEditorView: () =>
|
|
5722
|
-
disposeEditorView: () =>
|
|
5723
|
-
}),
|
|
5724
|
-
function
|
|
5725
|
-
if (
|
|
5720
|
+
}, bi = /* @__PURE__ */ e({
|
|
5721
|
+
bindEditorView: () => Si,
|
|
5722
|
+
disposeEditorView: () => Ci
|
|
5723
|
+
}), xi = /* @__PURE__ */ new WeakMap();
|
|
5724
|
+
function Si(e, t) {
|
|
5725
|
+
if (xi.has(e)) throw Error("A designer is already mounted for this editor context");
|
|
5726
5726
|
let n = e.root;
|
|
5727
|
-
return
|
|
5728
|
-
|
|
5727
|
+
return xi.set(e, t), e.root = t.root, () => {
|
|
5728
|
+
xi.get(e) === t && (xi.delete(e), e.root = n);
|
|
5729
5729
|
};
|
|
5730
5730
|
}
|
|
5731
|
-
function
|
|
5732
|
-
|
|
5731
|
+
function Ci(e) {
|
|
5732
|
+
xi.get(e)?.dispose();
|
|
5733
5733
|
}
|
|
5734
5734
|
// src/designer/context/editor-runtime.ts
|
|
5735
|
-
var
|
|
5736
|
-
EditorContextKey: () =>
|
|
5737
|
-
createEditorRuntime: () =>
|
|
5738
|
-
}),
|
|
5739
|
-
function
|
|
5740
|
-
let
|
|
5735
|
+
var wi = /* @__PURE__ */ e({
|
|
5736
|
+
EditorContextKey: () => Ti,
|
|
5737
|
+
createEditorRuntime: () => Ei
|
|
5738
|
+
}), Ti = Symbol("editor-context");
|
|
5739
|
+
function Ei(e = {}, n) {
|
|
5740
|
+
let r = ze() ? void 0 : Le(), i = Fe(), a = new Ke(), o = e.errors ?? t(), s = l(), c = new xt(), u = new bn(e.persistPreferences ? e.preferenceStorage ?? {
|
|
5741
5741
|
get: (e) => localStorage.getItem(e),
|
|
5742
5742
|
set: (e, t) => localStorage.setItem(e, t)
|
|
5743
|
-
} : void 0),
|
|
5743
|
+
} : void 0), d, f;
|
|
5744
5744
|
try {
|
|
5745
|
-
|
|
5746
|
-
let
|
|
5745
|
+
f = Kt();
|
|
5746
|
+
let t = p({
|
|
5747
|
+
...qt(e),
|
|
5748
|
+
builtinElements: Ee
|
|
5749
|
+
}), r = _i({
|
|
5747
5750
|
...e,
|
|
5748
|
-
...
|
|
5749
|
-
errors:
|
|
5751
|
+
...t,
|
|
5752
|
+
errors: o,
|
|
5750
5753
|
persistPreferences: !0,
|
|
5751
|
-
preferenceStorage:
|
|
5754
|
+
preferenceStorage: u,
|
|
5752
5755
|
storage: e.storage ?? !1
|
|
5753
|
-
})(
|
|
5754
|
-
|
|
5755
|
-
let
|
|
5756
|
-
commands: new
|
|
5756
|
+
})(i);
|
|
5757
|
+
vn(r, t.elements), gn(r, o), kn(r), r.config.configure(e);
|
|
5758
|
+
let l = !1, m = {
|
|
5759
|
+
commands: new Ye(() => m, a),
|
|
5757
5760
|
dispose() {
|
|
5758
|
-
|
|
5761
|
+
l ||= (Ci(m), m.plugins.close(), f?.(), s.dispose(), a.offAll(), Ie(i), !0);
|
|
5759
5762
|
},
|
|
5760
|
-
elements:
|
|
5761
|
-
errors:
|
|
5762
|
-
events:
|
|
5763
|
-
extensions:
|
|
5763
|
+
elements: t.elements,
|
|
5764
|
+
errors: o,
|
|
5765
|
+
events: a,
|
|
5766
|
+
extensions: c,
|
|
5764
5767
|
getSelection() {
|
|
5765
5768
|
return {
|
|
5766
|
-
bounds:
|
|
5767
|
-
ids: [...
|
|
5768
|
-
nodes:
|
|
5769
|
-
primary:
|
|
5769
|
+
bounds: r.selection.bounds,
|
|
5770
|
+
ids: [...r.selection.ids],
|
|
5771
|
+
nodes: r.selection.nodes,
|
|
5772
|
+
primary: r.selection.primary
|
|
5770
5773
|
};
|
|
5771
5774
|
},
|
|
5772
|
-
output:
|
|
5773
|
-
parsers:
|
|
5774
|
-
plugins: new
|
|
5775
|
-
preferences:
|
|
5775
|
+
output: s,
|
|
5776
|
+
parsers: t.parsers,
|
|
5777
|
+
plugins: new rn(() => m, e.pluginPolicy),
|
|
5778
|
+
preferences: u,
|
|
5776
5779
|
store() {
|
|
5777
|
-
if (
|
|
5778
|
-
return
|
|
5780
|
+
if (l) throw Error("Designer has been disposed");
|
|
5781
|
+
return r;
|
|
5779
5782
|
},
|
|
5780
|
-
templateLibrary: new
|
|
5783
|
+
templateLibrary: new yi(),
|
|
5781
5784
|
get use() {
|
|
5782
|
-
return
|
|
5785
|
+
return m.plugins.use.bind(m.plugins);
|
|
5783
5786
|
},
|
|
5784
5787
|
get zIndex() {
|
|
5785
|
-
return
|
|
5788
|
+
return r.zIndex;
|
|
5786
5789
|
}
|
|
5787
5790
|
};
|
|
5788
|
-
return
|
|
5791
|
+
return d = m, vt(m), n?.(m), m;
|
|
5789
5792
|
} catch (e) {
|
|
5790
|
-
throw
|
|
5793
|
+
throw d ? d.dispose?.() : (f?.(), s.dispose(), a.offAll(), Ie(i)), e;
|
|
5791
5794
|
} finally {
|
|
5792
|
-
|
|
5795
|
+
Re(r);
|
|
5793
5796
|
}
|
|
5794
5797
|
}
|
|
5795
5798
|
// src/designer/facade/bindings.ts
|
|
5796
|
-
var
|
|
5797
|
-
bindStudioContext: () =>
|
|
5798
|
-
getStudioContext: () =>
|
|
5799
|
-
onStudioDispose: () =>
|
|
5800
|
-
unbindStudioContext: () =>
|
|
5801
|
-
}),
|
|
5802
|
-
function
|
|
5803
|
-
|
|
5804
|
-
let n =
|
|
5805
|
-
return n || (n = /* @__PURE__ */ new Set(),
|
|
5799
|
+
var Di = /* @__PURE__ */ e({
|
|
5800
|
+
bindStudioContext: () => ji,
|
|
5801
|
+
getStudioContext: () => Mi,
|
|
5802
|
+
onStudioDispose: () => Ai,
|
|
5803
|
+
unbindStudioContext: () => Ni
|
|
5804
|
+
}), Oi = /* @__PURE__ */ new WeakMap(), ki = /* @__PURE__ */ new WeakMap();
|
|
5805
|
+
function Ai(e, t) {
|
|
5806
|
+
Mi(e);
|
|
5807
|
+
let n = ki.get(e);
|
|
5808
|
+
return n || (n = /* @__PURE__ */ new Set(), ki.set(e, n)), n.add(t), () => {
|
|
5806
5809
|
n.delete(t);
|
|
5807
5810
|
};
|
|
5808
5811
|
}
|
|
5809
|
-
function
|
|
5810
|
-
|
|
5812
|
+
function ji(e, t) {
|
|
5813
|
+
Oi.set(e, t);
|
|
5811
5814
|
}
|
|
5812
|
-
function
|
|
5813
|
-
let t =
|
|
5815
|
+
function Mi(e) {
|
|
5816
|
+
let t = Oi.get(e);
|
|
5814
5817
|
if (!t) throw Error("Unknown print studio instance");
|
|
5815
5818
|
return t.store(), t;
|
|
5816
5819
|
}
|
|
5817
|
-
function
|
|
5818
|
-
let t =
|
|
5819
|
-
|
|
5820
|
+
function Ni(e) {
|
|
5821
|
+
let t = ki.get(e);
|
|
5822
|
+
ki.delete(e);
|
|
5820
5823
|
for (let e of t ?? []) e();
|
|
5821
|
-
|
|
5824
|
+
Oi.delete(e);
|
|
5822
5825
|
}
|
|
5823
5826
|
// src/designer/facade/entities.ts
|
|
5824
5827
|
function Q(e) {
|
|
@@ -5828,7 +5831,7 @@ function Q(e) {
|
|
|
5828
5831
|
function $(e) {
|
|
5829
5832
|
return typeof e == "string" ? e : e.id;
|
|
5830
5833
|
}
|
|
5831
|
-
function
|
|
5834
|
+
function Pi(e) {
|
|
5832
5835
|
let t = !1, n = 0;
|
|
5833
5836
|
function r() {
|
|
5834
5837
|
if (t) throw Error("Print studio facade has been disposed");
|
|
@@ -5860,7 +5863,7 @@ function Ni(e) {
|
|
|
5860
5863
|
store: r
|
|
5861
5864
|
};
|
|
5862
5865
|
}
|
|
5863
|
-
function
|
|
5866
|
+
function Fi(e, t, n) {
|
|
5864
5867
|
function r(t) {
|
|
5865
5868
|
return e.store(), n.list().find((e) => e.id === $(t));
|
|
5866
5869
|
}
|
|
@@ -5871,7 +5874,7 @@ function Pi(e, t, n) {
|
|
|
5871
5874
|
}
|
|
5872
5875
|
function a(r, a) {
|
|
5873
5876
|
e.run(`${t}.update`, () => {
|
|
5874
|
-
i(r), n.update($(r),
|
|
5877
|
+
i(r), n.update($(r), b(a));
|
|
5875
5878
|
});
|
|
5876
5879
|
}
|
|
5877
5880
|
function o(i) {
|
|
@@ -5884,7 +5887,7 @@ function Pi(e, t, n) {
|
|
|
5884
5887
|
return {
|
|
5885
5888
|
get data() {
|
|
5886
5889
|
let e = r(t);
|
|
5887
|
-
return e ?
|
|
5890
|
+
return e ? b(e) : void 0;
|
|
5888
5891
|
},
|
|
5889
5892
|
id: t,
|
|
5890
5893
|
remove() {
|
|
@@ -5907,7 +5910,7 @@ function Pi(e, t, n) {
|
|
|
5907
5910
|
};
|
|
5908
5911
|
}
|
|
5909
5912
|
// src/designer/facade/editing.ts
|
|
5910
|
-
function
|
|
5913
|
+
function Ii(e) {
|
|
5911
5914
|
return {
|
|
5912
5915
|
edit: {
|
|
5913
5916
|
align: (t, n) => e.command("element.align", t, n),
|
|
@@ -5929,20 +5932,20 @@ function Fi(e) {
|
|
|
5929
5932
|
return [...e.store().selection.ids];
|
|
5930
5933
|
},
|
|
5931
5934
|
get nodes() {
|
|
5932
|
-
return
|
|
5935
|
+
return b(e.store().selection.nodes);
|
|
5933
5936
|
},
|
|
5934
5937
|
set: (t) => e.command("selection.set", t.map($))
|
|
5935
5938
|
}
|
|
5936
5939
|
};
|
|
5937
5940
|
}
|
|
5938
5941
|
// src/designer/facade/elements.ts
|
|
5939
|
-
function
|
|
5942
|
+
function Li(e, t, n) {
|
|
5940
5943
|
function r(n) {
|
|
5941
5944
|
let r = $(n);
|
|
5942
5945
|
if (!e.store().element.getByPage(t).some((e) => e.id === r)) throw Error(`Element not found on page ${t}: ${r}`);
|
|
5943
5946
|
return r;
|
|
5944
5947
|
}
|
|
5945
|
-
let i =
|
|
5948
|
+
let i = Fi(e, "element", {
|
|
5946
5949
|
list: () => e.store().element.getByPage(t),
|
|
5947
5950
|
remove: (t) => e.command("element.removeIds", [t]),
|
|
5948
5951
|
update: (t, n) => e.command("element.update", t, n)
|
|
@@ -5951,7 +5954,7 @@ function Ii(e, t, n) {
|
|
|
5951
5954
|
return e.run("element.add", () => {
|
|
5952
5955
|
let a = e.store();
|
|
5953
5956
|
if (r.id && a.element.get(r.id)) throw Error(`Element already exists: ${r.id}`);
|
|
5954
|
-
let o = e.command("element.add", r.type ?? n,
|
|
5957
|
+
let o = e.command("element.add", r.type ?? n, b(r), t);
|
|
5955
5958
|
if (!o) throw Error(`Page not found: ${t}`);
|
|
5956
5959
|
return Q(i.get(o));
|
|
5957
5960
|
});
|
|
@@ -5992,18 +5995,18 @@ function Ii(e, t, n) {
|
|
|
5992
5995
|
},
|
|
5993
5996
|
update(t, n, i) {
|
|
5994
5997
|
e.run("element.update", () => {
|
|
5995
|
-
e.command("element.update", r(t),
|
|
5998
|
+
e.command("element.update", r(t), b(n), i);
|
|
5996
5999
|
});
|
|
5997
6000
|
},
|
|
5998
6001
|
updateProps(t, n, i) {
|
|
5999
6002
|
e.run("element.updateProps", () => {
|
|
6000
|
-
e.command("element.updateProps", r(t),
|
|
6003
|
+
e.command("element.updateProps", r(t), b(n), i);
|
|
6001
6004
|
});
|
|
6002
6005
|
}
|
|
6003
6006
|
};
|
|
6004
6007
|
}
|
|
6005
6008
|
// src/designer/facade/output.ts
|
|
6006
|
-
function
|
|
6009
|
+
function Ri(e) {
|
|
6007
6010
|
function t(t, n, r) {
|
|
6008
6011
|
return e.command("output.html", t, n, r);
|
|
6009
6012
|
}
|
|
@@ -6023,8 +6026,8 @@ function Li(e) {
|
|
|
6023
6026
|
};
|
|
6024
6027
|
}
|
|
6025
6028
|
// src/designer/facade/pages.ts
|
|
6026
|
-
function
|
|
6027
|
-
let n =
|
|
6029
|
+
function zi(e, t) {
|
|
6030
|
+
let n = Fi(e, "page", {
|
|
6028
6031
|
list: () => e.store().page.list,
|
|
6029
6032
|
remove: (t) => e.command("page.remove", t),
|
|
6030
6033
|
update: (t, n) => e.command("page.update", t, n)
|
|
@@ -6035,14 +6038,14 @@ function Ri(e, t) {
|
|
|
6035
6038
|
get data() {
|
|
6036
6039
|
return i.data;
|
|
6037
6040
|
},
|
|
6038
|
-
elements:
|
|
6041
|
+
elements: Li(e, i.id, t),
|
|
6039
6042
|
id: i.id,
|
|
6040
6043
|
remove: i.remove,
|
|
6041
6044
|
update: i.update
|
|
6042
6045
|
};
|
|
6043
6046
|
}
|
|
6044
6047
|
function i(t = {}) {
|
|
6045
|
-
return e.run("page.create", () => Q(r(e.command("page.create", t.width ?? 210, t.height ?? 297, t.name,
|
|
6048
|
+
return e.run("page.create", () => Q(r(e.command("page.create", t.width ?? 210, t.height ?? 297, t.name, b(t)))));
|
|
6046
6049
|
}
|
|
6047
6050
|
return {
|
|
6048
6051
|
get active() {
|
|
@@ -6068,7 +6071,7 @@ function Ri(e, t) {
|
|
|
6068
6071
|
};
|
|
6069
6072
|
}
|
|
6070
6073
|
// src/designer/facade/state.ts
|
|
6071
|
-
function
|
|
6074
|
+
function Bi(e, t) {
|
|
6072
6075
|
let n = t.store(), r = /* @__PURE__ */ new Set(), i = U(() => Object.freeze({
|
|
6073
6076
|
activePageId: n.page.active?.id,
|
|
6074
6077
|
canRedo: n.history.canRedo,
|
|
@@ -6102,12 +6105,12 @@ function zi(e, t) {
|
|
|
6102
6105
|
};
|
|
6103
6106
|
}
|
|
6104
6107
|
// src/designer/facade/print-studio.ts
|
|
6105
|
-
function
|
|
6106
|
-
let r = !1, i, a = !1, o = !1, s =
|
|
6108
|
+
function Vi(e, t = {}, n) {
|
|
6109
|
+
let r = !1, i, a = !1, o = !1, s = Pi(e), c = Bi(e, s), l = t.defaultElementType ?? "text", u = zi(s, l), d = Fi(s, "template", {
|
|
6107
6110
|
list: () => s.store().template.list,
|
|
6108
6111
|
remove: (e) => s.command("template.remove", e),
|
|
6109
6112
|
update: (e, t) => s.command("template.update", e, t)
|
|
6110
|
-
}), f =
|
|
6113
|
+
}), f = Fi(s, "repeatGroup", {
|
|
6111
6114
|
list: () => s.store().repeatGroup.list,
|
|
6112
6115
|
remove: (e) => s.command("repeatGroup.remove", e),
|
|
6113
6116
|
update: (e, t) => {
|
|
@@ -6123,7 +6126,7 @@ function Bi(e, t = {}, n) {
|
|
|
6123
6126
|
if (t && t.id !== n) throw Error(`Element already belongs to repeat group: ${a}`);
|
|
6124
6127
|
}
|
|
6125
6128
|
}
|
|
6126
|
-
let m =
|
|
6129
|
+
let m = Fi(s, "followBlock", {
|
|
6127
6130
|
list: () => s.store().followBlock.list,
|
|
6128
6131
|
remove: (e) => s.command("followBlock.remove", e),
|
|
6129
6132
|
update: (e, t) => {
|
|
@@ -6141,12 +6144,12 @@ function Bi(e, t = {}, n) {
|
|
|
6141
6144
|
return {
|
|
6142
6145
|
get data() {
|
|
6143
6146
|
let e = s.store().template.getByPage(i), t = e?.page.id === i ? e.page : e?.evenPage;
|
|
6144
|
-
return t ?
|
|
6147
|
+
return t ? b(t) : void 0;
|
|
6145
6148
|
},
|
|
6146
|
-
elements:
|
|
6149
|
+
elements: Li(s, i, l),
|
|
6147
6150
|
id: i,
|
|
6148
6151
|
update(e) {
|
|
6149
|
-
s.run("template.updatePage", () => s.command("template.updatePage", i,
|
|
6152
|
+
s.run("template.updatePage", () => s.command("template.updatePage", i, b(e)));
|
|
6150
6153
|
}
|
|
6151
6154
|
};
|
|
6152
6155
|
}
|
|
@@ -6168,43 +6171,43 @@ function Bi(e, t = {}, n) {
|
|
|
6168
6171
|
};
|
|
6169
6172
|
}
|
|
6170
6173
|
function _() {
|
|
6171
|
-
r || (r = !0, v(), c.dispose(), s.dispose(),
|
|
6174
|
+
r || (r = !0, v(), c.dispose(), s.dispose(), Ni(S), n?.());
|
|
6172
6175
|
}
|
|
6173
6176
|
function v(e = i) {
|
|
6174
6177
|
!e && a ? o = !0 : (e?.unmount(), i === e && (i = void 0));
|
|
6175
6178
|
}
|
|
6176
6179
|
async function y(e) {
|
|
6177
6180
|
if (r) throw Error("Print studio has been disposed");
|
|
6178
|
-
if (a ||
|
|
6179
|
-
let t =
|
|
6181
|
+
if (a || Mi(S).root) throw Error("A designer is already mounted for this studio");
|
|
6182
|
+
let t = x(e.el);
|
|
6180
6183
|
a = !0;
|
|
6181
6184
|
try {
|
|
6182
|
-
let { attachDesigner: n } = await import("./mount-print-designer-
|
|
6185
|
+
let { attachDesigner: n } = await import("./mount-print-designer-CAqO0T0k.js").then((e) => e.n);
|
|
6183
6186
|
if (r) throw Error("Print studio has been disposed");
|
|
6184
6187
|
if (o) throw new DOMException("Designer unmounted before ready", "AbortError");
|
|
6185
6188
|
let s = n(t, {
|
|
6186
6189
|
...e,
|
|
6187
|
-
studio:
|
|
6190
|
+
studio: S
|
|
6188
6191
|
});
|
|
6189
6192
|
i = s, await s.ready, a = !1;
|
|
6190
6193
|
} catch (e) {
|
|
6191
6194
|
throw a = !1, o = !1, v(), e;
|
|
6192
6195
|
}
|
|
6193
6196
|
}
|
|
6194
|
-
function
|
|
6197
|
+
function x(e) {
|
|
6195
6198
|
if (typeof document > "u") throw Error("A designer requires an HTML container in a browser");
|
|
6196
6199
|
let t = typeof e == "string" ? document.querySelector(e) : e;
|
|
6197
6200
|
if (!(t instanceof HTMLElement)) throw Error(`Designer mount target not found: ${e}`);
|
|
6198
6201
|
return t;
|
|
6199
6202
|
}
|
|
6200
|
-
let
|
|
6203
|
+
let S = {
|
|
6201
6204
|
dataSource: {
|
|
6202
|
-
get: (e) =>
|
|
6205
|
+
get: (e) => b(s.store().dataSource.get(typeof e == "string" ? e : e.key)),
|
|
6203
6206
|
get list() {
|
|
6204
|
-
return
|
|
6207
|
+
return b(s.store().dataSource.list);
|
|
6205
6208
|
},
|
|
6206
6209
|
remove: (e) => s.run("dataSource.remove", () => s.command("dataSource.remove", typeof e == "string" ? e : e.key)),
|
|
6207
|
-
upsert: (...e) => s.run("dataSource.upsert", () => s.command("dataSource.upsert", ...
|
|
6210
|
+
upsert: (...e) => s.run("dataSource.upsert", () => s.command("dataSource.upsert", ...b(e)))
|
|
6208
6211
|
},
|
|
6209
6212
|
dispose: _,
|
|
6210
6213
|
document: {
|
|
@@ -6225,7 +6228,7 @@ function Bi(e, t = {}, n) {
|
|
|
6225
6228
|
followBlock: {
|
|
6226
6229
|
create(e) {
|
|
6227
6230
|
return s.run("followBlock.create", () => {
|
|
6228
|
-
let t = s.command("followBlock.create", e.pageId, [...e.elementIds],
|
|
6231
|
+
let t = s.command("followBlock.create", e.pageId, [...e.elementIds], b(e.target), e.gap, e.name, e.id);
|
|
6229
6232
|
return t ? m.get(t) : void 0;
|
|
6230
6233
|
});
|
|
6231
6234
|
},
|
|
@@ -6265,7 +6268,7 @@ function Bi(e, t = {}, n) {
|
|
|
6265
6268
|
return s.run("repeatGroup.create", () => {
|
|
6266
6269
|
let { elementIds: t, pageId: n, ...r } = e;
|
|
6267
6270
|
p(n, t);
|
|
6268
|
-
let i = s.command("repeatGroup.create", n, [...t],
|
|
6271
|
+
let i = s.command("repeatGroup.create", n, [...t], b(r));
|
|
6269
6272
|
return i ? f.get(i) : void 0;
|
|
6270
6273
|
});
|
|
6271
6274
|
},
|
|
@@ -6301,18 +6304,18 @@ function Bi(e, t = {}, n) {
|
|
|
6301
6304
|
},
|
|
6302
6305
|
unmount: () => v(),
|
|
6303
6306
|
use: e.plugins.use.bind(e.plugins),
|
|
6304
|
-
...
|
|
6305
|
-
...
|
|
6307
|
+
...Ri(s),
|
|
6308
|
+
...Ii(s)
|
|
6306
6309
|
};
|
|
6307
|
-
return
|
|
6310
|
+
return ji(S, e), Be(S);
|
|
6308
6311
|
}
|
|
6309
6312
|
// src/studio.ts
|
|
6310
|
-
function
|
|
6311
|
-
let t =
|
|
6313
|
+
function Hi(e = {}) {
|
|
6314
|
+
let t = Ei(e);
|
|
6312
6315
|
try {
|
|
6313
|
-
return
|
|
6316
|
+
return Vi(t, e, () => t.dispose?.());
|
|
6314
6317
|
} catch (e) {
|
|
6315
6318
|
throw t.dispose?.(), e;
|
|
6316
6319
|
}
|
|
6317
6320
|
}
|
|
6318
|
-
export {
|
|
6321
|
+
export { Ut as A, xt as B, fn as C, Yt as D, Jt as E, zt as F, Ye as G, vt as H, Mt as I, Je as K, Bt as L, Vt as M, J as N, Xt as O, jt as P, Nt as R, yn as S, rn as T, Xe as U, bt as V, Ze as W, Kn as _, Ai as a, bn as b, wi as c, vi as d, ci as f, Rn as g, In as h, Mi as i, Wt as j, Ht as k, bi as l, Hn as m, Vi as n, Ti as o, gr as p, Di as r, Ei as s, Hi as t, yi as u, On as v, cn as w, pn as x, wn as y, Dt as z };
|