@printstack/print-studio 0.1.1 → 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 +129 -162
- package/assets/{render.worker-Ch4qWx3S.js → render.worker-Dl59Xk1a.js} +9 -9
- package/{cloneDeep-PCw2ErRl.js → cloneDeep-waBDTGc3.js} +9 -4
- package/components/button-group/ButtonGroup.d.ts +1 -1
- package/components/print-s-logo/print-s-logo.vue.d.ts +1 -1
- package/components/s-form/types.d.ts +1 -1
- package/core/coordinate-space.d.ts +16 -0
- package/core/document-model.d.ts +1 -1
- package/core/element-registry.d.ts +3 -8
- package/core/index.d.ts +1 -0
- package/core/page-extensions.d.ts +1 -1
- package/core/types.d.ts +8 -0
- package/core.js +10 -10
- package/designer/commands/menu-adapter.d.ts +3 -3
- package/designer/commands/menu-types.d.ts +8 -1
- package/designer/commands/types.d.ts +2 -0
- package/designer/components/fields/use-table-draft.d.ts +0 -4
- package/designer/components/panels/layer-row-types.d.ts +37 -0
- package/designer/components/panels/layer-row.vue.d.ts +17 -0
- package/designer/components/stage/marquee-overlay.vue.d.ts +8 -0
- package/designer/components/stage/node-style.d.ts +3 -0
- package/designer/components/stage/selection-member.vue.d.ts +14 -0
- package/designer/composables/use-theme.d.ts +3 -0
- package/designer/facade/editing.d.ts +2 -2
- package/designer/facade/entities.d.ts +1160 -26
- package/designer/facade/use-print-studio.d.ts +1 -1
- package/designer/frame/view.d.ts +2 -0
- package/designer/interactions/marquee.d.ts +1 -1
- package/designer/interactions/move.d.ts +3 -1
- package/designer/mount-print-designer.d.ts +1 -1
- package/designer/plugins/plugin-manager.d.ts +3 -3
- package/designer/plugins/types.d.ts +1 -1
- package/designer/stores/document-store.d.ts +72 -0
- package/designer/stores/editor-store.d.ts +772 -16
- package/designer/stores/page-store.d.ts +25 -1
- package/designer/stores/selection-store.d.ts +1 -1
- package/designer/stores/template-store.d.ts +52 -4
- package/designer/stores/types.d.ts +1 -0
- package/designer/stores/ui-store.d.ts +232 -3
- package/designer/stores/view-store.d.ts +10 -1
- package/designer.d.ts +1 -1
- package/designer.js +3 -3
- package/elements/index.d.ts +2 -4
- package/elements/table/table-style.d.ts +3 -10
- package/{registries-dZq8MewR.js → elements-YX-XUHtf.js} +2510 -3069
- package/host-oKlYakgn.js +123 -0
- package/index.d.ts +3 -1
- package/index.js +9 -8
- package/locales/runtime.d.ts +7 -2
- package/locales/translations/zh-CN/designer.json.d.ts +9 -4
- package/{mount-print-designer-BLgVZOnm.js → mount-print-designer-CAqO0T0k.js} +4 -4
- package/{mount-print-preview-D7M-1AqH.js → mount-print-preview-DgDHL3E8.js} +4 -3
- 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-D3WhkbZK.js → presets-DmCp_Doe.js} +2 -2
- 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 +32 -28
- package/{saas-B1H161e1.js → saas-D-q51uTz.js} +1 -1
- package/saas.js +1 -1
- package/{studio-BFQYHZsg.js → studio-DHusmJyL.js} +1264 -1187
- package/studio-types.d.ts +1 -1
- package/studio.d.ts +1 -1
- package/style.css +1 -1
- package/vue.d.ts +1 -1
- package/vue.js +3672 -3579
- package/document-model-GhFP9OGp.js +0 -1302
- package/host-CuGR8rD6.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 Fe, defineStore as
|
|
6
|
-
import { computed 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({
|
|
@@ -1373,7 +1373,7 @@ function $t(e, t, n) {
|
|
|
1373
1373
|
preferences: { register(t) {
|
|
1374
1374
|
i("preferences");
|
|
1375
1375
|
let r = n.track(e.preferences.register(t));
|
|
1376
|
-
return e.store().view.restorePreferences(), e.store().panel.restorePreferences(), r;
|
|
1376
|
+
return e.store().view.restorePreferences(), e.store().panel.restorePreferences(), e.store().ui.restorePreferences(), r;
|
|
1377
1377
|
} },
|
|
1378
1378
|
rendering: {
|
|
1379
1379
|
get active() {
|
|
@@ -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,21 +1447,8 @@ var en = class {
|
|
|
1447
1447
|
}
|
|
1448
1448
|
};
|
|
1449
1449
|
// src/designer/plugins/plugin-manager.ts
|
|
1450
|
-
function tn(e) {
|
|
1451
|
-
return !!e && typeof e == "object" && "then" in e;
|
|
1452
|
-
}
|
|
1453
1450
|
function nn(e) {
|
|
1454
|
-
return
|
|
1455
|
-
apiVersion: "1.0",
|
|
1456
|
-
id: e.name,
|
|
1457
|
-
permissions: typeof e == "function" ? [
|
|
1458
|
-
"commands",
|
|
1459
|
-
"events",
|
|
1460
|
-
"panels",
|
|
1461
|
-
"templates"
|
|
1462
|
-
] : [],
|
|
1463
|
-
version: "1.0.0"
|
|
1464
|
-
};
|
|
1451
|
+
return !!e && typeof e == "object" && "then" in e;
|
|
1465
1452
|
}
|
|
1466
1453
|
var rn = class {
|
|
1467
1454
|
getContext;
|
|
@@ -1499,7 +1486,7 @@ var rn = class {
|
|
|
1499
1486
|
}
|
|
1500
1487
|
if (!t.definition) {
|
|
1501
1488
|
this.setStatus(t, "loading");
|
|
1502
|
-
let n = new
|
|
1489
|
+
let n = new tn((e) => this.report(t, e));
|
|
1503
1490
|
t.scope = n;
|
|
1504
1491
|
let r = this.loadDefinition(t).then(() => {
|
|
1505
1492
|
if (!(this.#n.get(e) !== t || this.#e || n.controller.signal.aborted)) return this.activate(t);
|
|
@@ -1511,7 +1498,7 @@ var rn = class {
|
|
|
1511
1498
|
return t.pending = r, r;
|
|
1512
1499
|
}
|
|
1513
1500
|
let n = this.activate(t);
|
|
1514
|
-
if (
|
|
1501
|
+
if (nn(n)) return t.pending = n.finally(() => {
|
|
1515
1502
|
t.pending = void 0;
|
|
1516
1503
|
}), t.pending;
|
|
1517
1504
|
}
|
|
@@ -1520,7 +1507,7 @@ var rn = class {
|
|
|
1520
1507
|
}
|
|
1521
1508
|
install(e) {
|
|
1522
1509
|
if (this.#e) throw Error("Plugin manager has been disposed");
|
|
1523
|
-
let t =
|
|
1510
|
+
let t = this.manifestOf(e);
|
|
1524
1511
|
if (this.validate(t), this.#n.has(t.id)) return t.id;
|
|
1525
1512
|
let n = {
|
|
1526
1513
|
manifest: Object.freeze({
|
|
@@ -1531,18 +1518,13 @@ var rn = class {
|
|
|
1531
1518
|
}),
|
|
1532
1519
|
status: "installed"
|
|
1533
1520
|
};
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
name: e.name,
|
|
1542
|
-
setup: e.setup
|
|
1543
|
-
};
|
|
1544
|
-
}
|
|
1545
|
-
return this.#n.set(t.id, n), this.getContext().store().plugin.add(t.id), this.setStatus(n, "installed"), t.id;
|
|
1521
|
+
return "load" in e ? n.loader = e.load : n.definition = typeof e == "function" ? e : "manifest" in e ? {
|
|
1522
|
+
manifest: n.manifest,
|
|
1523
|
+
setup: e.setup
|
|
1524
|
+
} : {
|
|
1525
|
+
name: e.name,
|
|
1526
|
+
setup: e.setup
|
|
1527
|
+
}, this.#n.set(t.id, n), this.getContext().store().plugin.add(t.id), this.setStatus(n, "installed"), t.id;
|
|
1546
1528
|
}
|
|
1547
1529
|
list() {
|
|
1548
1530
|
return [...this.#n.keys()];
|
|
@@ -1561,13 +1543,13 @@ var rn = class {
|
|
|
1561
1543
|
return this.dispose(e);
|
|
1562
1544
|
}
|
|
1563
1545
|
use(e, t) {
|
|
1564
|
-
let n = "createPlugin" in e ? e.createPlugin(t) : e, r =
|
|
1546
|
+
let n = "createPlugin" in e ? e.createPlugin(t) : e, r = this.manifestOf(n).id;
|
|
1565
1547
|
if (this.has(r)) return this.enable(r);
|
|
1566
1548
|
this.install(n);
|
|
1567
1549
|
let i = this.#n.get(r);
|
|
1568
1550
|
try {
|
|
1569
1551
|
let e = this.enable(r);
|
|
1570
|
-
if (
|
|
1552
|
+
if (nn(e)) return e.catch((e) => {
|
|
1571
1553
|
throw this.removeFailedInstallation(r, i), e;
|
|
1572
1554
|
});
|
|
1573
1555
|
} catch (e) {
|
|
@@ -1575,16 +1557,16 @@ var rn = class {
|
|
|
1575
1557
|
}
|
|
1576
1558
|
}
|
|
1577
1559
|
useScoped(e) {
|
|
1578
|
-
let t =
|
|
1560
|
+
let t = this.manifestOf(e).id;
|
|
1579
1561
|
if (this.has(t)) return () => {};
|
|
1580
1562
|
let n = this.use(e), r = this.#n.get(t), i = () => {
|
|
1581
1563
|
this.#n.get(t) === r && this.dispose(t);
|
|
1582
1564
|
};
|
|
1583
|
-
return
|
|
1565
|
+
return nn(n) ? n.then(() => i) : i;
|
|
1584
1566
|
}
|
|
1585
1567
|
activate(e) {
|
|
1586
|
-
this.checkDependencies(e, []), this.#r ||= (
|
|
1587
|
-
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));
|
|
1588
1570
|
e.scope = t;
|
|
1589
1571
|
let n = (n) => {
|
|
1590
1572
|
n && t.track(n), t.controller.signal.aborted || this.#n.get(e.manifest.id) !== e || this.setStatus(e, "enabled");
|
|
@@ -1593,7 +1575,7 @@ var rn = class {
|
|
|
1593
1575
|
let r = e.definition;
|
|
1594
1576
|
if (!r) throw Error(`Plugin was not loaded: ${e.manifest.id}`);
|
|
1595
1577
|
let i;
|
|
1596
|
-
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) => {
|
|
1597
1579
|
throw this.fail(e, t), t;
|
|
1598
1580
|
});
|
|
1599
1581
|
n(i);
|
|
@@ -1615,7 +1597,7 @@ var rn = class {
|
|
|
1615
1597
|
}
|
|
1616
1598
|
}
|
|
1617
1599
|
}
|
|
1618
|
-
|
|
1600
|
+
createHostContext(e) {
|
|
1619
1601
|
let t = this.getContext(), n = new Proxy(t.commands, { get(t, n) {
|
|
1620
1602
|
if (n === "register") return (n) => {
|
|
1621
1603
|
e.track(t.registerScoped([n]));
|
|
@@ -1653,6 +1635,19 @@ var rn = class {
|
|
|
1653
1635
|
setup: n.setup
|
|
1654
1636
|
};
|
|
1655
1637
|
}
|
|
1638
|
+
manifestOf(e) {
|
|
1639
|
+
if ("manifest" in e) {
|
|
1640
|
+
if (!e.manifest) throw Error("Plugins require a manifest");
|
|
1641
|
+
return e.manifest;
|
|
1642
|
+
}
|
|
1643
|
+
if (!this.#t.has(e)) throw Error("Plugins require a manifest");
|
|
1644
|
+
return {
|
|
1645
|
+
apiVersion: "1.0",
|
|
1646
|
+
id: e.name,
|
|
1647
|
+
permissions: [],
|
|
1648
|
+
version: "1.0.0"
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1656
1651
|
removeFailedInstallation(e, t) {
|
|
1657
1652
|
this.#n.get(e) === t && (this.#n.delete(e), this.getContext().store().plugin.remove(e));
|
|
1658
1653
|
}
|
|
@@ -1684,7 +1679,7 @@ var rn = class {
|
|
|
1684
1679
|
}
|
|
1685
1680
|
}, an = 2e3, on = "designer.errorHandling.unexpectedErrorMessage", sn = null;
|
|
1686
1681
|
function cn() {
|
|
1687
|
-
return sn ||=
|
|
1682
|
+
return sn ||= t({ report: ln }), sn;
|
|
1688
1683
|
}
|
|
1689
1684
|
function ln(e, t) {}
|
|
1690
1685
|
function un(e) {
|
|
@@ -1696,7 +1691,7 @@ function un(e) {
|
|
|
1696
1691
|
return {
|
|
1697
1692
|
handle: async function(t) {
|
|
1698
1693
|
let r = t.error;
|
|
1699
|
-
return
|
|
1694
|
+
return _(r) ? (n(r.userMessage, Date.now()) && e.store().ui.toast(r.userMessage, "error"), {
|
|
1700
1695
|
code: "designer-toast",
|
|
1701
1696
|
handled: !0,
|
|
1702
1697
|
report: !1
|
|
@@ -1707,7 +1702,7 @@ function un(e) {
|
|
|
1707
1702
|
};
|
|
1708
1703
|
},
|
|
1709
1704
|
match: function(e) {
|
|
1710
|
-
return
|
|
1705
|
+
return _(e.error);
|
|
1711
1706
|
}
|
|
1712
1707
|
};
|
|
1713
1708
|
}
|
|
@@ -1716,7 +1711,7 @@ function dn(e) {
|
|
|
1716
1711
|
return {
|
|
1717
1712
|
handle: async function() {
|
|
1718
1713
|
let n = Date.now();
|
|
1719
|
-
return n - t >= an && (t = n, e.store().ui.toast(
|
|
1714
|
+
return n - t >= an && (t = n, e.store().ui.toast(g(on), "error")), {
|
|
1720
1715
|
code: "unexpected-toast",
|
|
1721
1716
|
handled: !0
|
|
1722
1717
|
};
|
|
@@ -1728,7 +1723,7 @@ function dn(e) {
|
|
|
1728
1723
|
}
|
|
1729
1724
|
var fn = {
|
|
1730
1725
|
get description() {
|
|
1731
|
-
return
|
|
1726
|
+
return g("designer.errorHandling.pluginDescription");
|
|
1732
1727
|
},
|
|
1733
1728
|
name: "builtin:error-handling",
|
|
1734
1729
|
setup: function(e) {
|
|
@@ -1758,7 +1753,7 @@ function vn(e, t) {
|
|
|
1758
1753
|
mn.set(e, t);
|
|
1759
1754
|
}
|
|
1760
1755
|
function yn(e) {
|
|
1761
|
-
return mn.get(e) ??
|
|
1756
|
+
return mn.get(e) ?? F;
|
|
1762
1757
|
}
|
|
1763
1758
|
// src/designer/services/preference-storage.ts
|
|
1764
1759
|
var bn = class {
|
|
@@ -1779,19 +1774,40 @@ var bn = class {
|
|
|
1779
1774
|
set(e, t) {
|
|
1780
1775
|
(this.#e.at(-1) ?? this.fallback)?.set(e, t);
|
|
1781
1776
|
}
|
|
1782
|
-
}
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1777
|
+
};
|
|
1778
|
+
// src/core/coordinate-space.ts
|
|
1779
|
+
function xn(e, t) {
|
|
1780
|
+
return {
|
|
1781
|
+
x: t.x - e.x,
|
|
1782
|
+
y: t.y - e.y
|
|
1783
|
+
};
|
|
1784
|
+
}
|
|
1785
|
+
function Sn(e, t) {
|
|
1786
|
+
return {
|
|
1787
|
+
x: t.x + e.x,
|
|
1788
|
+
y: t.y + e.y
|
|
1789
|
+
};
|
|
1790
|
+
}
|
|
1791
|
+
function Cn(e, t, n) {
|
|
1792
|
+
return {
|
|
1793
|
+
x: (t.x - e.left) / n,
|
|
1794
|
+
y: (t.y - e.top) / n
|
|
1795
|
+
};
|
|
1796
|
+
}
|
|
1797
|
+
// src/designer/services/stage-service.ts
|
|
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
|
|
1792
1808
|
});
|
|
1793
|
-
function
|
|
1794
|
-
let e =
|
|
1809
|
+
function Tn() {
|
|
1810
|
+
let e = We(null), t = We(null), n = We(null);
|
|
1795
1811
|
function r(n, r) {
|
|
1796
1812
|
e.value = n, t.value = r;
|
|
1797
1813
|
}
|
|
@@ -1810,16 +1826,16 @@ function Sn() {
|
|
|
1810
1826
|
x: 0,
|
|
1811
1827
|
y: 0
|
|
1812
1828
|
};
|
|
1813
|
-
let a = i.getBoundingClientRect(), o =
|
|
1814
|
-
return {
|
|
1815
|
-
x:
|
|
1816
|
-
y:
|
|
1817
|
-
};
|
|
1829
|
+
let a = i.getBoundingClientRect(), o = we * r;
|
|
1830
|
+
return Cn(a, {
|
|
1831
|
+
x: e,
|
|
1832
|
+
y: n
|
|
1833
|
+
}, o);
|
|
1818
1834
|
}
|
|
1819
1835
|
function c(t, n, r, i) {
|
|
1820
1836
|
let a = e.value;
|
|
1821
1837
|
if (!a) return;
|
|
1822
|
-
let o =
|
|
1838
|
+
let o = we * i;
|
|
1823
1839
|
a.scrollLeft = t.x * o - n, a.scrollTop = t.y * o - r;
|
|
1824
1840
|
}
|
|
1825
1841
|
return {
|
|
@@ -1831,14 +1847,14 @@ function Sn() {
|
|
|
1831
1847
|
scrollToContentPoint: c
|
|
1832
1848
|
};
|
|
1833
1849
|
}
|
|
1834
|
-
var
|
|
1835
|
-
function
|
|
1836
|
-
return e ?
|
|
1850
|
+
var En = /* @__PURE__ */ new WeakMap(), Dn = Tn();
|
|
1851
|
+
function On(e) {
|
|
1852
|
+
return e ? En.get(e) ?? Dn : Dn;
|
|
1837
1853
|
}
|
|
1838
|
-
function
|
|
1839
|
-
|
|
1854
|
+
function kn(e) {
|
|
1855
|
+
En.set(e, Tn());
|
|
1840
1856
|
}
|
|
1841
|
-
var { contentMmFromClient:
|
|
1857
|
+
var { contentMmFromClient: An, getScrollElement: jn, getStageController: Mn, registerStageController: Nn, registerStageElements: Pn, scrollToContentPoint: Fn } = Dn, In = [
|
|
1842
1858
|
{
|
|
1843
1859
|
height: 297,
|
|
1844
1860
|
id: "delivery",
|
|
@@ -1858,22 +1874,22 @@ var { contentMmFromClient: Dn, getScrollElement: On, getStageController: kn, reg
|
|
|
1858
1874
|
width: 148
|
|
1859
1875
|
}
|
|
1860
1876
|
];
|
|
1861
|
-
function
|
|
1862
|
-
let e =
|
|
1863
|
-
return e.templateId =
|
|
1877
|
+
function Ln() {
|
|
1878
|
+
let e = me();
|
|
1879
|
+
return e.templateId = oe, {
|
|
1864
1880
|
dataSources: [],
|
|
1865
|
-
name:
|
|
1881
|
+
name: g("designer.tutorial.practiceName"),
|
|
1866
1882
|
pages: [e],
|
|
1867
|
-
templates: [
|
|
1883
|
+
templates: [ue()],
|
|
1868
1884
|
version: "1.0"
|
|
1869
1885
|
};
|
|
1870
1886
|
}
|
|
1871
|
-
function
|
|
1887
|
+
function Rn(e, t) {
|
|
1872
1888
|
let n = e[0].toUpperCase() + e.slice(1), r = t[0].toUpperCase() + t.slice(1);
|
|
1873
|
-
return
|
|
1889
|
+
return g(`designer.tutorial.courses${n}${r}`);
|
|
1874
1890
|
}
|
|
1875
1891
|
function X(e, t) {
|
|
1876
|
-
return
|
|
1892
|
+
return Rn(e.id, t);
|
|
1877
1893
|
}
|
|
1878
1894
|
function Z(e, t, n, r, i, a, o = {}) {
|
|
1879
1895
|
let s = e.element.add("text", {
|
|
@@ -1894,7 +1910,7 @@ function Z(e, t, n, r, i, a, o = {}) {
|
|
|
1894
1910
|
if (!s) throw Error(`Tutorial page missing: ${t}`);
|
|
1895
1911
|
return s;
|
|
1896
1912
|
}
|
|
1897
|
-
function
|
|
1913
|
+
function zn(e, t) {
|
|
1898
1914
|
e.page.update(e.document.data.pages[0].id, {
|
|
1899
1915
|
height: t.height,
|
|
1900
1916
|
margins: {
|
|
@@ -1904,17 +1920,17 @@ function In(e, t) {
|
|
|
1904
1920
|
top: 30
|
|
1905
1921
|
},
|
|
1906
1922
|
name: X(t, "title"),
|
|
1907
|
-
templateId:
|
|
1923
|
+
templateId: oe,
|
|
1908
1924
|
width: t.width
|
|
1909
1925
|
});
|
|
1910
1926
|
}
|
|
1911
|
-
function
|
|
1927
|
+
function Bn(e, t) {
|
|
1912
1928
|
let n = e.template.create({
|
|
1913
1929
|
id: "tutorial-template",
|
|
1914
1930
|
name: X(t, "templateName")
|
|
1915
1931
|
});
|
|
1916
1932
|
e.template.update(n.id, { facingPages: !0 });
|
|
1917
|
-
for (let r of
|
|
1933
|
+
for (let r of Ne(n)) {
|
|
1918
1934
|
let i = r.id, a = r.id === n.page.id, o = a ? 18 : 12, s = a ? 12 : 18;
|
|
1919
1935
|
e.template.updatePage(i, { margins: {
|
|
1920
1936
|
bottom: 18,
|
|
@@ -1928,7 +1944,7 @@ function Ln(e, t) {
|
|
|
1928
1944
|
fontSize: 20,
|
|
1929
1945
|
fontWeight: "700"
|
|
1930
1946
|
}
|
|
1931
|
-
}), Z(e, i,
|
|
1947
|
+
}), Z(e, i, g("designer.tutorial.documentFooter"), o, t.height - 13, t.width - 30, {
|
|
1932
1948
|
height: 6,
|
|
1933
1949
|
props: {
|
|
1934
1950
|
color: "#64748b",
|
|
@@ -1939,7 +1955,7 @@ function Ln(e, t) {
|
|
|
1939
1955
|
}
|
|
1940
1956
|
e.template.applyToPages([e.document.data.pages[0].id], n.id), e.template.enterEdit(n.id);
|
|
1941
1957
|
}
|
|
1942
|
-
function
|
|
1958
|
+
function Vn(e, t) {
|
|
1943
1959
|
e.template.exitEdit();
|
|
1944
1960
|
let n = e.document.data.pages[0];
|
|
1945
1961
|
e.page.setActive(n.id);
|
|
@@ -1994,12 +2010,12 @@ function Rn(e, t) {
|
|
|
1994
2010
|
type: "array"
|
|
1995
2011
|
}
|
|
1996
2012
|
]
|
|
1997
|
-
}), Z(e, n.id,
|
|
2013
|
+
}), Z(e, n.id, g("designer.tutorial.documentNumber", {
|
|
1998
2014
|
date: "{{ bill.date }}",
|
|
1999
2015
|
number: "{{ bill.number }}"
|
|
2000
2016
|
}), 18, 33, t.width - 30), Z(e, n.id, `${X(t, "partnerLabel")}:{{ bill.partner }}`, 18, 41, t.width - 30);
|
|
2001
2017
|
}
|
|
2002
|
-
var
|
|
2018
|
+
var Hn = "tutorial-details", Un = 50, Wn = 22, Gn = 5, Kn = [
|
|
2003
2019
|
{
|
|
2004
2020
|
align: "left",
|
|
2005
2021
|
bind: "name",
|
|
@@ -2016,35 +2032,35 @@ var zn = "tutorial-details", Bn = 50, Vn = 22, Hn = 5, Un = [
|
|
|
2016
2032
|
key: "columnAmount"
|
|
2017
2033
|
}
|
|
2018
2034
|
];
|
|
2019
|
-
function
|
|
2035
|
+
function qn(e, t) {
|
|
2020
2036
|
let n = e.document.data.pages[0], r = e.element.add("table", {
|
|
2021
2037
|
bindings: { rows: "bill.items" },
|
|
2022
|
-
height:
|
|
2023
|
-
id:
|
|
2038
|
+
height: Wn,
|
|
2039
|
+
id: Hn,
|
|
2024
2040
|
name: X(t, "detailsName"),
|
|
2025
2041
|
width: t.width - 36,
|
|
2026
2042
|
x: 18,
|
|
2027
|
-
y:
|
|
2043
|
+
y: Un
|
|
2028
2044
|
}, n.id);
|
|
2029
2045
|
if (!r) throw Error(`Tutorial page missing: ${n.id}`);
|
|
2030
|
-
e.element.updateProps(r.id, { columns:
|
|
2046
|
+
e.element.updateProps(r.id, { columns: Kn.map((e, n) => ({
|
|
2031
2047
|
align: e.align,
|
|
2032
2048
|
bind: e.bind,
|
|
2033
2049
|
title: X(t, e.key),
|
|
2034
2050
|
width: n === 0 ? 2 : 1
|
|
2035
2051
|
})) });
|
|
2036
2052
|
}
|
|
2037
|
-
function
|
|
2038
|
-
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: {
|
|
2039
2055
|
fontWeight: "700",
|
|
2040
2056
|
textAlign: "right"
|
|
2041
2057
|
} }), i = Z(e, n.id, X(t, "signature"), 18, 88, t.width - 36);
|
|
2042
2058
|
if (!e.followBlock.create(n.id, [r.id, i.id], {
|
|
2043
2059
|
id: "tutorial-details",
|
|
2044
2060
|
kind: "element"
|
|
2045
|
-
},
|
|
2061
|
+
}, Gn, g("designer.tutorial.documentSummary"))) throw Error("Tutorial follow block could not be created");
|
|
2046
2062
|
}
|
|
2047
|
-
function
|
|
2063
|
+
function Yn(e, t) {
|
|
2048
2064
|
let n = e.page.add(t.width, t.height, X(t, "attachmentTitle"), { templateId: "tutorial-template" });
|
|
2049
2065
|
Z(e, n.id, X(t, "attachmentTitle"), 18, 35, t.width - 36, {
|
|
2050
2066
|
height: 12,
|
|
@@ -2052,7 +2068,7 @@ function Kn(e, t) {
|
|
|
2052
2068
|
fontSize: 16,
|
|
2053
2069
|
fontWeight: "700"
|
|
2054
2070
|
}
|
|
2055
|
-
}), Z(e, n.id,
|
|
2071
|
+
}), Z(e, n.id, g("designer.tutorial.documentNumber", {
|
|
2056
2072
|
date: "{{ bill.date }}",
|
|
2057
2073
|
number: "{{ bill.number }}"
|
|
2058
2074
|
}), 18, 49, t.width - 36), Z(e, n.id, X(t, "attachmentBody"), 18, 61, t.width - 36, {
|
|
@@ -2060,60 +2076,60 @@ function Kn(e, t) {
|
|
|
2060
2076
|
props: { lineHeight: 1.8 }
|
|
2061
2077
|
}), Z(e, n.id, X(t, "signature"), 18, 105, t.width - 36);
|
|
2062
2078
|
}
|
|
2063
|
-
function
|
|
2079
|
+
function Xn(e) {
|
|
2064
2080
|
e.view.updateSettings({ previewWithData: !0 });
|
|
2065
2081
|
}
|
|
2066
|
-
var
|
|
2082
|
+
var Zn = [
|
|
2067
2083
|
{
|
|
2068
2084
|
id: "welcome",
|
|
2069
2085
|
target: "menu"
|
|
2070
2086
|
},
|
|
2071
2087
|
{
|
|
2072
|
-
apply:
|
|
2088
|
+
apply: zn,
|
|
2073
2089
|
id: "page",
|
|
2074
2090
|
target: "canvas"
|
|
2075
2091
|
},
|
|
2076
2092
|
{
|
|
2077
|
-
apply:
|
|
2093
|
+
apply: Bn,
|
|
2078
2094
|
id: "template",
|
|
2079
2095
|
target: "canvas"
|
|
2080
2096
|
},
|
|
2081
2097
|
{
|
|
2082
|
-
apply:
|
|
2098
|
+
apply: Vn,
|
|
2083
2099
|
id: "data",
|
|
2084
2100
|
target: "canvas"
|
|
2085
2101
|
},
|
|
2086
2102
|
{
|
|
2087
|
-
apply:
|
|
2103
|
+
apply: qn,
|
|
2088
2104
|
id: "table",
|
|
2089
2105
|
target: "canvas"
|
|
2090
2106
|
},
|
|
2091
2107
|
{
|
|
2092
|
-
apply:
|
|
2108
|
+
apply: Jn,
|
|
2093
2109
|
id: "follow",
|
|
2094
2110
|
target: "canvas"
|
|
2095
2111
|
},
|
|
2096
2112
|
{
|
|
2097
|
-
apply:
|
|
2113
|
+
apply: Yn,
|
|
2098
2114
|
id: "pages",
|
|
2099
2115
|
target: "canvas"
|
|
2100
2116
|
},
|
|
2101
2117
|
{
|
|
2102
|
-
apply:
|
|
2118
|
+
apply: Xn,
|
|
2103
2119
|
id: "preview",
|
|
2104
2120
|
target: "canvas"
|
|
2105
2121
|
}
|
|
2106
2122
|
];
|
|
2107
2123
|
// src/designer/stores/canvas-store.ts
|
|
2108
|
-
function
|
|
2109
|
-
let
|
|
2110
|
-
return
|
|
2111
|
-
let r =
|
|
2124
|
+
function Qn(e) {
|
|
2125
|
+
let t = e.elements ?? F;
|
|
2126
|
+
return H("editor-canvas", () => {
|
|
2127
|
+
let r = U(() => e.scope.pages.map((e) => ({
|
|
2112
2128
|
...e,
|
|
2113
2129
|
elements: o(e, e.elements)
|
|
2114
|
-
}))), i =
|
|
2130
|
+
}))), i = U(() => function(e) {
|
|
2115
2131
|
return r.value.find((t) => t.id === e);
|
|
2116
|
-
}), a =
|
|
2132
|
+
}), a = U(() => o);
|
|
2117
2133
|
function o(r, i, a = {}) {
|
|
2118
2134
|
let o = e.document.data, c = a.withData ?? e.view.settings.previewWithData, l = e.template.editingId ? void 0 : {
|
|
2119
2135
|
documentName: o.name,
|
|
@@ -2121,23 +2137,23 @@ function Yn(e) {
|
|
|
2121
2137
|
pageCount: o.pages.length,
|
|
2122
2138
|
pageName: r.name,
|
|
2123
2139
|
pageNumber: o.pages.findIndex((e) => e.id === r.id) + 1
|
|
2124
|
-
}, u = new
|
|
2125
|
-
d.elements =
|
|
2140
|
+
}, u = new he(), d = n(c ? v(o) : {}, l);
|
|
2141
|
+
d.elements = t;
|
|
2126
2142
|
let f = e.repeatGroup.getByPage(r.id), p = /* @__PURE__ */ new Map();
|
|
2127
2143
|
return i.map((e) => {
|
|
2128
|
-
let
|
|
2129
|
-
a.resetSize && (
|
|
2130
|
-
...
|
|
2144
|
+
let n = O(o, e, t);
|
|
2145
|
+
a.resetSize && (n = {
|
|
2146
|
+
...n,
|
|
2131
2147
|
height: 0
|
|
2132
2148
|
});
|
|
2133
|
-
let
|
|
2134
|
-
if (
|
|
2149
|
+
let r = $n(n, t);
|
|
2150
|
+
if (r) return r;
|
|
2135
2151
|
if (!c) {
|
|
2136
|
-
let e = new Set(
|
|
2137
|
-
return l ?
|
|
2152
|
+
let e = new Set(t.get(n.type)?.previewExpressionKeys);
|
|
2153
|
+
return l ? s(n, l, u, e) : n;
|
|
2138
2154
|
}
|
|
2139
|
-
let
|
|
2140
|
-
return
|
|
2155
|
+
let i = er(n, d, f, p);
|
|
2156
|
+
return C(n, i, u, "preview");
|
|
2141
2157
|
});
|
|
2142
2158
|
}
|
|
2143
2159
|
return {
|
|
@@ -2146,7 +2162,7 @@ function Yn(e) {
|
|
|
2146
2162
|
};
|
|
2147
2163
|
})();
|
|
2148
2164
|
}
|
|
2149
|
-
function
|
|
2165
|
+
function $n(e, t) {
|
|
2150
2166
|
let n = t.get(e.type);
|
|
2151
2167
|
if (!n?.resolvePreviewProps) return;
|
|
2152
2168
|
let r = {
|
|
@@ -2165,22 +2181,22 @@ function Xn(e, t) {
|
|
|
2165
2181
|
...i
|
|
2166
2182
|
};
|
|
2167
2183
|
}
|
|
2168
|
-
function
|
|
2169
|
-
let
|
|
2170
|
-
if (!
|
|
2171
|
-
let
|
|
2172
|
-
if (!
|
|
2173
|
-
let e =
|
|
2174
|
-
|
|
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);
|
|
2175
2191
|
}
|
|
2176
|
-
return
|
|
2177
|
-
collectionPath:
|
|
2192
|
+
return a.length === 0 ? t : A(t, {
|
|
2193
|
+
collectionPath: i.collection,
|
|
2178
2194
|
index: 0,
|
|
2179
|
-
item:
|
|
2195
|
+
item: a[0]
|
|
2180
2196
|
});
|
|
2181
2197
|
}
|
|
2182
2198
|
// src/core/layout-references.ts
|
|
2183
|
-
function
|
|
2199
|
+
function tr(e, t) {
|
|
2184
2200
|
let n = new Set(t);
|
|
2185
2201
|
return JSON.parse(JSON.stringify({
|
|
2186
2202
|
elementGroups: (e.elementGroups ?? []).filter((e) => e.elementIds.every((e) => n.has(e))),
|
|
@@ -2188,7 +2204,7 @@ function Qn(e, t) {
|
|
|
2188
2204
|
repeatGroups: (e.repeatGroups ?? []).filter((e) => e.elementIds.every((e) => n.has(e)))
|
|
2189
2205
|
}));
|
|
2190
2206
|
}
|
|
2191
|
-
function
|
|
2207
|
+
function nr(e, t, n, r, i) {
|
|
2192
2208
|
function a(e, t) {
|
|
2193
2209
|
let n = e.get(t);
|
|
2194
2210
|
if (!n) throw Error(`Missing copied layout reference: ${t}`);
|
|
@@ -2218,9 +2234,9 @@ function $n(e, t, n, r, i) {
|
|
|
2218
2234
|
d = !1;
|
|
2219
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);
|
|
2220
2236
|
}
|
|
2221
|
-
|
|
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))]);
|
|
2222
2238
|
}
|
|
2223
|
-
function
|
|
2239
|
+
function rr(e, t, n, r, i) {
|
|
2224
2240
|
if (t.length === 0) return;
|
|
2225
2241
|
let a = new Map(t.map((e) => [e.id, i("layer-group")])), o = [];
|
|
2226
2242
|
for (let e of t) {
|
|
@@ -2234,18 +2250,18 @@ function er(e, t, n, r, i) {
|
|
|
2234
2250
|
let s = e.parentId ? a.get(e.parentId) : void 0;
|
|
2235
2251
|
s && (i.parentId = s), o.push(i);
|
|
2236
2252
|
}
|
|
2237
|
-
e.elementGroups = [...e.elementGroups ?? [], ...o],
|
|
2253
|
+
e.elementGroups = [...e.elementGroups ?? [], ...o], de(e);
|
|
2238
2254
|
}
|
|
2239
2255
|
// src/designer/stores/clipboard-store.ts
|
|
2240
|
-
function
|
|
2241
|
-
return
|
|
2242
|
-
let { unlockedNodes: n } = G(e.selection), r = e.ui.toast, i = e.element.removeSelected, { active: a } = G(e.scope), o = e.history.commit, s =
|
|
2256
|
+
function ir(e) {
|
|
2257
|
+
return H("editor-clipboard", ({ action: t }) => {
|
|
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({
|
|
2243
2259
|
elementGroups: [],
|
|
2244
2260
|
followBlocks: [],
|
|
2245
2261
|
repeatGroups: []
|
|
2246
2262
|
}), u = t(() => {
|
|
2247
2263
|
let t = n.value;
|
|
2248
|
-
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 })));
|
|
2249
2265
|
}, "copy"), d = t(() => {
|
|
2250
2266
|
u(), i();
|
|
2251
2267
|
}, "cut"), f = t(() => {
|
|
@@ -2254,35 +2270,35 @@ function tr(e) {
|
|
|
2254
2270
|
if (!t) return;
|
|
2255
2271
|
let n = [], i = /* @__PURE__ */ new Map();
|
|
2256
2272
|
for (let r of s.value) {
|
|
2257
|
-
let a =
|
|
2258
|
-
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, {
|
|
2259
2275
|
...e.document.data,
|
|
2260
2276
|
templates: c.value
|
|
2261
2277
|
}), t.elements.push(a), n.push(a.id), i.set(r.id, a.id);
|
|
2262
2278
|
}
|
|
2263
|
-
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");
|
|
2264
2280
|
}, "paste");
|
|
2265
2281
|
return {
|
|
2266
2282
|
copy: u,
|
|
2267
2283
|
cut: d,
|
|
2268
|
-
isEmpty:
|
|
2284
|
+
isEmpty: U(() => s.value.length === 0),
|
|
2269
2285
|
nodes: s,
|
|
2270
2286
|
paste: f
|
|
2271
2287
|
};
|
|
2272
2288
|
})();
|
|
2273
2289
|
}
|
|
2274
2290
|
// src/designer/stores/config-store.ts
|
|
2275
|
-
function
|
|
2276
|
-
return
|
|
2277
|
-
let e =
|
|
2291
|
+
function ar() {
|
|
2292
|
+
return H("editor-config", () => {
|
|
2293
|
+
let e = W(f());
|
|
2278
2294
|
function t(t) {
|
|
2279
|
-
e.value =
|
|
2295
|
+
e.value = f({ rendering: {
|
|
2280
2296
|
...e.value.rendering,
|
|
2281
2297
|
...t.rendering
|
|
2282
2298
|
} });
|
|
2283
2299
|
}
|
|
2284
2300
|
function n() {
|
|
2285
|
-
e.value =
|
|
2301
|
+
e.value = f();
|
|
2286
2302
|
}
|
|
2287
2303
|
return {
|
|
2288
2304
|
configure: t,
|
|
@@ -2292,16 +2308,16 @@ function nr() {
|
|
|
2292
2308
|
})();
|
|
2293
2309
|
}
|
|
2294
2310
|
// src/designer/stores/data-source-store.ts
|
|
2295
|
-
function
|
|
2296
|
-
return
|
|
2297
|
-
let { data: t } = G(e.document), n = e.history.commit, r =
|
|
2311
|
+
function or(e) {
|
|
2312
|
+
return H("editor-dataSource", () => {
|
|
2313
|
+
let { data: t } = G(e.document), n = e.history.commit, r = U(() => t.value.dataSources ?? []);
|
|
2298
2314
|
function i(e) {
|
|
2299
2315
|
return r.value.find((t) => t.key === e);
|
|
2300
2316
|
}
|
|
2301
2317
|
function a(e, r = e.key) {
|
|
2302
2318
|
let i = t.value.dataSources ?? (t.value.dataSources = []), a = i.findIndex((e) => e.key === r);
|
|
2303
2319
|
if (r !== e.key) {
|
|
2304
|
-
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 }));
|
|
2305
2321
|
if (a < 0) throw Error(`Data source not found: ${r}`);
|
|
2306
2322
|
}
|
|
2307
2323
|
a >= 0 ? i.splice(a, 1, e) : i.push(e), n();
|
|
@@ -2311,8 +2327,8 @@ function rr(e) {
|
|
|
2311
2327
|
r && (t.value.dataSources = r.filter((t) => t.key !== e), n());
|
|
2312
2328
|
}
|
|
2313
2329
|
return {
|
|
2314
|
-
get:
|
|
2315
|
-
has:
|
|
2330
|
+
get: U(() => i),
|
|
2331
|
+
has: U(() => function(e) {
|
|
2316
2332
|
return i(e) !== void 0;
|
|
2317
2333
|
}),
|
|
2318
2334
|
list: r,
|
|
@@ -2322,14 +2338,14 @@ function rr(e) {
|
|
|
2322
2338
|
})();
|
|
2323
2339
|
}
|
|
2324
2340
|
// src/designer/template-library/builtin/welcome.json
|
|
2325
|
-
var
|
|
2326
|
-
dataSources: () =>
|
|
2327
|
-
default: () =>
|
|
2328
|
-
name: () =>
|
|
2329
|
-
pages: () =>
|
|
2330
|
-
templates: () =>
|
|
2341
|
+
var sr = /* @__PURE__ */ e({
|
|
2342
|
+
dataSources: () => cr,
|
|
2343
|
+
default: () => fr,
|
|
2344
|
+
name: () => lr,
|
|
2345
|
+
pages: () => ur,
|
|
2346
|
+
templates: () => dr,
|
|
2331
2347
|
version: () => "1.0"
|
|
2332
|
-
}),
|
|
2348
|
+
}), cr = [], lr = "欢迎模板(横向 A4)", ur = [{
|
|
2333
2349
|
background: "#f5f3ee",
|
|
2334
2350
|
elements: [
|
|
2335
2351
|
{
|
|
@@ -2960,7 +2976,7 @@ var ir = /* @__PURE__ */ e({
|
|
|
2960
2976
|
name: "横向 A4",
|
|
2961
2977
|
templateId: "template-blank",
|
|
2962
2978
|
width: 297
|
|
2963
|
-
}],
|
|
2979
|
+
}], dr = [{
|
|
2964
2980
|
builtin: !0,
|
|
2965
2981
|
id: "template-blank",
|
|
2966
2982
|
name: "空白模板",
|
|
@@ -2973,98 +2989,98 @@ var ir = /* @__PURE__ */ e({
|
|
|
2973
2989
|
name: "空白模板",
|
|
2974
2990
|
width: 297
|
|
2975
2991
|
}
|
|
2976
|
-
}],
|
|
2977
|
-
dataSources:
|
|
2978
|
-
name:
|
|
2979
|
-
pages:
|
|
2980
|
-
templates:
|
|
2992
|
+
}], fr = {
|
|
2993
|
+
dataSources: cr,
|
|
2994
|
+
name: lr,
|
|
2995
|
+
pages: ur,
|
|
2996
|
+
templates: dr,
|
|
2981
2997
|
version: "1.0"
|
|
2982
|
-
},
|
|
2998
|
+
}, pr = {
|
|
2983
2999
|
costSheet: () => import("./cost-sheet-Dwg0rt_l.js"),
|
|
2984
3000
|
invoice: () => import("./invoice-DuBN6ZCM.js"),
|
|
2985
3001
|
purchaseOrder: () => import("./purchase-order-DNBFPpEZ.js"),
|
|
2986
|
-
welcome: () => Promise.resolve().then(() =>
|
|
3002
|
+
welcome: () => Promise.resolve().then(() => sr)
|
|
2987
3003
|
};
|
|
2988
|
-
function
|
|
2989
|
-
return structuredClone(
|
|
3004
|
+
function mr() {
|
|
3005
|
+
return structuredClone(fr);
|
|
2990
3006
|
}
|
|
2991
|
-
async function
|
|
3007
|
+
async function hr(e) {
|
|
2992
3008
|
try {
|
|
2993
|
-
let t = await
|
|
3009
|
+
let t = await pr[e]();
|
|
2994
3010
|
return structuredClone(t.default);
|
|
2995
3011
|
} catch (t) {
|
|
2996
|
-
throw new
|
|
3012
|
+
throw new h(g("designer.templateLibrary.builtinFailed", { id: `builtin.${e}` }), {
|
|
2997
3013
|
cause: t,
|
|
2998
3014
|
code: "template-library.builtin-failed"
|
|
2999
3015
|
});
|
|
3000
3016
|
}
|
|
3001
3017
|
}
|
|
3002
|
-
function
|
|
3018
|
+
function gr() {
|
|
3003
3019
|
return {
|
|
3004
3020
|
id: "builtin",
|
|
3005
3021
|
list() {
|
|
3006
3022
|
return [
|
|
3007
3023
|
{
|
|
3008
|
-
category:
|
|
3009
|
-
description:
|
|
3024
|
+
category: g("designer.templateLibrary.categoryBasic"),
|
|
3025
|
+
description: g("designer.templateLibrary.welcomeDescription"),
|
|
3010
3026
|
id: "builtin.welcome",
|
|
3011
|
-
load: () =>
|
|
3012
|
-
name:
|
|
3027
|
+
load: () => hr("welcome"),
|
|
3028
|
+
name: g("designer.templateLibrary.welcomeName")
|
|
3013
3029
|
},
|
|
3014
3030
|
{
|
|
3015
|
-
category:
|
|
3016
|
-
description:
|
|
3031
|
+
category: g("designer.templateLibrary.categoryBusiness"),
|
|
3032
|
+
description: g("designer.templateLibrary.purchaseOrderDescription"),
|
|
3017
3033
|
id: "builtin.purchaseOrder",
|
|
3018
|
-
load: () =>
|
|
3019
|
-
name:
|
|
3034
|
+
load: () => hr("purchaseOrder"),
|
|
3035
|
+
name: g("designer.templateLibrary.purchaseOrderName")
|
|
3020
3036
|
},
|
|
3021
3037
|
{
|
|
3022
|
-
category:
|
|
3023
|
-
description:
|
|
3038
|
+
category: g("designer.templateLibrary.categoryBusiness"),
|
|
3039
|
+
description: g("designer.templateLibrary.costSheetDescription"),
|
|
3024
3040
|
id: "builtin.costSheet",
|
|
3025
|
-
load: () =>
|
|
3026
|
-
name:
|
|
3041
|
+
load: () => hr("costSheet"),
|
|
3042
|
+
name: g("designer.templateLibrary.costSheetName")
|
|
3027
3043
|
},
|
|
3028
3044
|
{
|
|
3029
|
-
category:
|
|
3030
|
-
description:
|
|
3045
|
+
category: g("designer.templateLibrary.categoryBusiness"),
|
|
3046
|
+
description: g("designer.templateLibrary.invoiceDescription"),
|
|
3031
3047
|
id: "builtin.invoice",
|
|
3032
|
-
load: () =>
|
|
3033
|
-
name:
|
|
3048
|
+
load: () => hr("invoice"),
|
|
3049
|
+
name: g("designer.templateLibrary.invoiceName")
|
|
3034
3050
|
}
|
|
3035
3051
|
];
|
|
3036
3052
|
},
|
|
3037
|
-
title: () =>
|
|
3053
|
+
title: () => g("designer.templateLibrary.builtinTitle")
|
|
3038
3054
|
};
|
|
3039
3055
|
}
|
|
3040
3056
|
// src/designer/stores/document-store.ts
|
|
3041
|
-
var
|
|
3042
|
-
function
|
|
3057
|
+
var _r = "print-studio:document";
|
|
3058
|
+
function vr(e) {
|
|
3043
3059
|
if (e.initialDocument) {
|
|
3044
|
-
let t =
|
|
3045
|
-
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" });
|
|
3046
3062
|
return t.document;
|
|
3047
3063
|
}
|
|
3048
3064
|
try {
|
|
3049
3065
|
let t = null;
|
|
3050
|
-
if (e.storage ? t = e.storage.get() : e.storage !== !1 && (t = localStorage.getItem(
|
|
3051
|
-
let { document: n, skippedTypes: r } =
|
|
3052
|
-
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;
|
|
3053
3069
|
}
|
|
3054
3070
|
} catch (t) {
|
|
3055
|
-
let n = new
|
|
3071
|
+
let n = new h(g("designer.documentStore.autoSaveRestoreFailed"), {
|
|
3056
3072
|
cause: t,
|
|
3057
3073
|
code: "document.restore-failed",
|
|
3058
|
-
detail:
|
|
3074
|
+
detail: g("designer.documentStore.autoSaveRestoreFailedDetail")
|
|
3059
3075
|
});
|
|
3060
3076
|
(e.errors ?? cn()).capture(n, { source: "store.init" });
|
|
3061
3077
|
}
|
|
3062
|
-
let t = e.createDocument?.() ??
|
|
3063
|
-
return
|
|
3078
|
+
let t = e.createDocument?.() ?? je(mr(), e.elements).document;
|
|
3079
|
+
return ke(t), t;
|
|
3064
3080
|
}
|
|
3065
|
-
function
|
|
3066
|
-
return
|
|
3067
|
-
let t = e.ui.toast, n =
|
|
3081
|
+
function yr(e) {
|
|
3082
|
+
return H("editor-document", () => {
|
|
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;
|
|
3068
3084
|
function f() {
|
|
3069
3085
|
d += 1, clearTimeout(u);
|
|
3070
3086
|
let e = !1;
|
|
@@ -3079,9 +3095,9 @@ function gr(e) {
|
|
|
3079
3095
|
], () => {
|
|
3080
3096
|
clearTimeout(u), o.value || a.value.length > 0 || e.storage === !1 || d > 0 || (u = setTimeout(() => {
|
|
3081
3097
|
if (!(d > 0)) try {
|
|
3082
|
-
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));
|
|
3083
3099
|
} catch (t) {
|
|
3084
|
-
let n = new
|
|
3100
|
+
let n = new h(g("designer.documentStore.autoSaveFailed"), {
|
|
3085
3101
|
cause: t,
|
|
3086
3102
|
code: "document.autosave-failed"
|
|
3087
3103
|
});
|
|
@@ -3090,63 +3106,63 @@ function gr(e) {
|
|
|
3090
3106
|
}, 600));
|
|
3091
3107
|
}, { deep: !0 });
|
|
3092
3108
|
function p() {
|
|
3093
|
-
let r = e.createDocument?.() ??
|
|
3094
|
-
|
|
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"));
|
|
3095
3111
|
}
|
|
3096
3112
|
function m(i) {
|
|
3097
3113
|
let a;
|
|
3098
3114
|
try {
|
|
3099
3115
|
a = JSON.parse(i);
|
|
3100
3116
|
} catch (e) {
|
|
3101
|
-
throw new
|
|
3117
|
+
throw new h(g("designer.documentStore.invalidDocumentMessage"), {
|
|
3102
3118
|
cause: e,
|
|
3103
3119
|
code: "document.invalid"
|
|
3104
3120
|
});
|
|
3105
3121
|
}
|
|
3106
|
-
let { document: o, skippedTypes: s } =
|
|
3107
|
-
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");
|
|
3108
3124
|
}
|
|
3109
|
-
function
|
|
3125
|
+
function _(t) {
|
|
3110
3126
|
t.trim() && (n.value.name = t.trim(), e.commitHistory());
|
|
3111
3127
|
}
|
|
3112
|
-
function
|
|
3128
|
+
function v(e) {
|
|
3113
3129
|
m(JSON.stringify(e));
|
|
3114
3130
|
}
|
|
3115
|
-
function
|
|
3116
|
-
return
|
|
3131
|
+
function y() {
|
|
3132
|
+
return b(a.value[0] ?? n.value);
|
|
3117
3133
|
}
|
|
3118
|
-
function
|
|
3119
|
-
return
|
|
3134
|
+
function x() {
|
|
3135
|
+
return b(o.value?.document ?? a.value[0] ?? n.value);
|
|
3120
3136
|
}
|
|
3121
|
-
function
|
|
3122
|
-
clearTimeout(u), e.beginPreviewHistory(), a.value.push(
|
|
3137
|
+
function S() {
|
|
3138
|
+
clearTimeout(u), e.beginPreviewHistory(), a.value.push(b(n.value));
|
|
3123
3139
|
}
|
|
3124
|
-
function
|
|
3140
|
+
function C() {
|
|
3125
3141
|
let t = a.value.at(-1);
|
|
3126
3142
|
t && (e.resetPreviewSession(() => {
|
|
3127
|
-
n.value =
|
|
3143
|
+
n.value = b(t);
|
|
3128
3144
|
}), e.resetHistory());
|
|
3129
3145
|
}
|
|
3130
|
-
function C(t) {
|
|
3131
|
-
a.value.length !== 0 && (t || b(), a.value.pop(), e.finishPreviewHistory(t));
|
|
3132
|
-
}
|
|
3133
3146
|
function w(t) {
|
|
3147
|
+
a.value.length !== 0 && (t || C(), a.value.pop(), e.finishPreviewHistory(t));
|
|
3148
|
+
}
|
|
3149
|
+
function T(t) {
|
|
3134
3150
|
if (o.value || i.value) throw Error("Document session is busy");
|
|
3135
|
-
|
|
3136
|
-
document:
|
|
3151
|
+
ke(t), clearTimeout(u), o.value = {
|
|
3152
|
+
document: y(),
|
|
3137
3153
|
savedSnapshot: r.value
|
|
3138
|
-
}, l += 1, n.value =
|
|
3154
|
+
}, l += 1, n.value = b(t), e.resetSession(), e.resetHistory();
|
|
3139
3155
|
}
|
|
3140
|
-
function
|
|
3156
|
+
function E(t) {
|
|
3141
3157
|
let i = o.value;
|
|
3142
3158
|
i && (l += 1, t || (n.value = i.document), r.value = i.savedSnapshot, o.value = null, e.resetSession());
|
|
3143
3159
|
}
|
|
3144
3160
|
function D() {
|
|
3145
|
-
if (o.value) return t(
|
|
3161
|
+
if (o.value) return t(g("designer.documentStore.saveAfterTemporarySession")), Promise.resolve();
|
|
3146
3162
|
if (c) return c;
|
|
3147
3163
|
let n = e.onSave;
|
|
3148
3164
|
if (!n) throw Error("No template save handler configured");
|
|
3149
|
-
let a =
|
|
3165
|
+
let a = y(), s = JSON.stringify(a), u = l;
|
|
3150
3166
|
return i.value = !0, c = Promise.resolve().then(() => n(a)).then(() => {
|
|
3151
3167
|
u === l && (r.value = s);
|
|
3152
3168
|
}).finally(() => {
|
|
@@ -3154,20 +3170,20 @@ function gr(e) {
|
|
|
3154
3170
|
}), c;
|
|
3155
3171
|
}
|
|
3156
3172
|
return Ve(() => clearTimeout(u)), {
|
|
3157
|
-
beginPreview:
|
|
3158
|
-
beginTemporary:
|
|
3173
|
+
beginPreview: S,
|
|
3174
|
+
beginTemporary: T,
|
|
3159
3175
|
create: p,
|
|
3160
3176
|
data: n,
|
|
3161
3177
|
dirty: s,
|
|
3162
|
-
finishPreview:
|
|
3163
|
-
finishTemporary:
|
|
3164
|
-
getDocument:
|
|
3165
|
-
getPersistentDocument:
|
|
3178
|
+
finishPreview: w,
|
|
3179
|
+
finishTemporary: E,
|
|
3180
|
+
getDocument: y,
|
|
3181
|
+
getPersistentDocument: x,
|
|
3166
3182
|
hasSaveHandler: !!e.onSave,
|
|
3167
|
-
load:
|
|
3183
|
+
load: v,
|
|
3168
3184
|
loadJson: m,
|
|
3169
|
-
rename:
|
|
3170
|
-
resetPreview:
|
|
3185
|
+
rename: _,
|
|
3186
|
+
resetPreview: C,
|
|
3171
3187
|
save: D,
|
|
3172
3188
|
saving: i,
|
|
3173
3189
|
suspendPersistence: f
|
|
@@ -3175,14 +3191,14 @@ function gr(e) {
|
|
|
3175
3191
|
})();
|
|
3176
3192
|
}
|
|
3177
3193
|
// src/designer/stores/element-group-store.ts
|
|
3178
|
-
function
|
|
3179
|
-
return
|
|
3180
|
-
let { data: n } = G(e.document), { active: r } = G(e.scope), { ids: i } = G(e.selection), a = e.history.commit, o =
|
|
3194
|
+
function br(e) {
|
|
3195
|
+
return H("editor-elementGroup", ({ action: t }) => {
|
|
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 ?? []);
|
|
3181
3197
|
function c(e) {
|
|
3182
3198
|
return s.value.find((t) => t.id === e);
|
|
3183
3199
|
}
|
|
3184
3200
|
function l(e) {
|
|
3185
|
-
return
|
|
3201
|
+
return L(n.value, e.pageId);
|
|
3186
3202
|
}
|
|
3187
3203
|
function u(e) {
|
|
3188
3204
|
return s.value.filter((t) => t.pageId === e);
|
|
@@ -3194,14 +3210,14 @@ function _r(e) {
|
|
|
3194
3210
|
return n.elements.filter((e) => r.has(e.id));
|
|
3195
3211
|
}
|
|
3196
3212
|
function f(e) {
|
|
3197
|
-
let t =
|
|
3198
|
-
return t ?
|
|
3213
|
+
let t = L(n.value, e);
|
|
3214
|
+
return t ? se(t, s.value) : [];
|
|
3199
3215
|
}
|
|
3200
3216
|
function p(e) {
|
|
3201
3217
|
return o.value.includes(e);
|
|
3202
3218
|
}
|
|
3203
3219
|
function m(e) {
|
|
3204
|
-
return
|
|
3220
|
+
return Oe(f(e), p);
|
|
3205
3221
|
}
|
|
3206
3222
|
function h(e) {
|
|
3207
3223
|
let t = s.value.filter((t) => t.elementIds.includes(e)), n;
|
|
@@ -3212,19 +3228,19 @@ function _r(e) {
|
|
|
3212
3228
|
let n = d(e);
|
|
3213
3229
|
return n.length > 0 && n.every((e) => e[t]);
|
|
3214
3230
|
}
|
|
3215
|
-
let _ =
|
|
3231
|
+
let _ = U(() => i.value.length === 0 ? null : Se(f(r.value.id), i.value) ?? null), v = t((t, o) => {
|
|
3216
3232
|
let l = r.value, u = (t ?? i.value).filter((e) => l.elements.some((t) => t.id === e));
|
|
3217
3233
|
if (u.length === 0) return null;
|
|
3218
|
-
let d =
|
|
3219
|
-
if (!
|
|
3220
|
-
|
|
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);
|
|
3221
3237
|
let p = c(d.id);
|
|
3222
3238
|
return p ? (e.selection.set([...p.elementIds]), a(), p) : null;
|
|
3223
3239
|
}, "create"), y = t((t) => {
|
|
3224
3240
|
let r = c(t), i = r ? l(r) : void 0;
|
|
3225
3241
|
if (!r || !i) return;
|
|
3226
|
-
let u = [...r.elementIds], d =
|
|
3227
|
-
|
|
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());
|
|
3228
3244
|
}, "ungroup"), b = t((t, n = !1) => {
|
|
3229
3245
|
let r = c(t);
|
|
3230
3246
|
r && (n ? e.element.removeIds([...r.elementIds]) : y(t));
|
|
@@ -3249,15 +3265,15 @@ function _r(e) {
|
|
|
3249
3265
|
}, "selectMembers");
|
|
3250
3266
|
return {
|
|
3251
3267
|
create: v,
|
|
3252
|
-
find:
|
|
3253
|
-
findByElement:
|
|
3254
|
-
getByPage:
|
|
3255
|
-
getMembers:
|
|
3256
|
-
getRows:
|
|
3257
|
-
getTree:
|
|
3258
|
-
isCollapsed:
|
|
3259
|
-
isLocked:
|
|
3260
|
-
isVisible:
|
|
3268
|
+
find: U(() => c),
|
|
3269
|
+
findByElement: U(() => h),
|
|
3270
|
+
getByPage: U(() => u),
|
|
3271
|
+
getMembers: U(() => d),
|
|
3272
|
+
getRows: U(() => m),
|
|
3273
|
+
getTree: U(() => f),
|
|
3274
|
+
isCollapsed: U(() => p),
|
|
3275
|
+
isLocked: U(() => (e) => g(e, "locked")),
|
|
3276
|
+
isVisible: U(() => (e) => g(e, "visible")),
|
|
3261
3277
|
list: s,
|
|
3262
3278
|
remove: b,
|
|
3263
3279
|
rename: x,
|
|
@@ -3272,21 +3288,21 @@ function _r(e) {
|
|
|
3272
3288
|
})();
|
|
3273
3289
|
}
|
|
3274
3290
|
// src/core/align.ts
|
|
3275
|
-
var
|
|
3291
|
+
var xr = {
|
|
3276
3292
|
bottom: "y",
|
|
3277
3293
|
hcenter: "x",
|
|
3278
3294
|
left: "x",
|
|
3279
3295
|
right: "x",
|
|
3280
3296
|
top: "y",
|
|
3281
3297
|
vcenter: "y"
|
|
3282
|
-
},
|
|
3283
|
-
function
|
|
3284
|
-
return
|
|
3298
|
+
}, Sr = 1e-6;
|
|
3299
|
+
function Cr(e) {
|
|
3300
|
+
return xr[e];
|
|
3285
3301
|
}
|
|
3286
|
-
function
|
|
3302
|
+
function wr(e) {
|
|
3287
3303
|
return e === "h" ? "x" : "y";
|
|
3288
3304
|
}
|
|
3289
|
-
function
|
|
3305
|
+
function Tr(e, t) {
|
|
3290
3306
|
return t === "x" ? {
|
|
3291
3307
|
end: e.x + e.width,
|
|
3292
3308
|
start: e.x
|
|
@@ -3295,55 +3311,55 @@ function Sr(e, t) {
|
|
|
3295
3311
|
start: e.y
|
|
3296
3312
|
};
|
|
3297
3313
|
}
|
|
3298
|
-
function
|
|
3299
|
-
let { end: n, start: r } =
|
|
3314
|
+
function Er(e, t) {
|
|
3315
|
+
let { end: n, start: r } = Tr(e, xr[t]);
|
|
3300
3316
|
return t === "left" || t === "top" ? r : t === "right" || t === "bottom" ? n : (r + n) / 2;
|
|
3301
3317
|
}
|
|
3302
|
-
function
|
|
3318
|
+
function Dr(e) {
|
|
3303
3319
|
let t = /* @__PURE__ */ new Map();
|
|
3304
|
-
for (let [n, r] of e) Math.abs(r) >
|
|
3320
|
+
for (let [n, r] of e) Math.abs(r) > Sr && t.set(n, r);
|
|
3305
3321
|
return t;
|
|
3306
3322
|
}
|
|
3307
|
-
function
|
|
3323
|
+
function Or(e, t) {
|
|
3308
3324
|
let { keyId: n, pageBounds: r, target: i = "selection" } = t;
|
|
3309
3325
|
if (r && (i === "page" || i === "selection" && e.length === 1)) return r;
|
|
3310
3326
|
if (i === "key") {
|
|
3311
3327
|
let t = e.find((e) => e.id === n);
|
|
3312
3328
|
if (t) return t.box;
|
|
3313
3329
|
}
|
|
3314
|
-
return
|
|
3330
|
+
return be(e.map((e) => e.box));
|
|
3315
3331
|
}
|
|
3316
|
-
function
|
|
3332
|
+
function kr(e, t, n = {}) {
|
|
3317
3333
|
if (e.length === 0) return /* @__PURE__ */ new Map();
|
|
3318
|
-
let r =
|
|
3334
|
+
let r = Or(e, n);
|
|
3319
3335
|
if (!r) return /* @__PURE__ */ new Map();
|
|
3320
|
-
let i =
|
|
3321
|
-
return
|
|
3336
|
+
let i = Er(r, t);
|
|
3337
|
+
return Dr(e.map((e) => [e.id, i - Er(e.box, t)]));
|
|
3322
3338
|
}
|
|
3323
|
-
function
|
|
3339
|
+
function Ar(e, t, n = {}) {
|
|
3324
3340
|
if (e.length < 3) return null;
|
|
3325
|
-
let r =
|
|
3341
|
+
let r = xr[t], i = e.map((e) => ({
|
|
3326
3342
|
item: e,
|
|
3327
|
-
point:
|
|
3343
|
+
point: Er(e.box, t)
|
|
3328
3344
|
})).sort((e, t) => e.point - t.point), a = i[0], o = i[i.length - 1], s = a.point, c = o.point;
|
|
3329
3345
|
if (n.target === "page" && n.pageBounds) {
|
|
3330
|
-
let e =
|
|
3346
|
+
let e = Tr(n.pageBounds, r), t = Tr(a.item.box, r), i = Tr(o.item.box, r);
|
|
3331
3347
|
s = e.start + (a.point - t.start), c = e.end - (i.end - o.point);
|
|
3332
3348
|
}
|
|
3333
3349
|
let l = (c - s) / (i.length - 1);
|
|
3334
|
-
return
|
|
3350
|
+
return Dr(i.map(({ item: e, point: t }, n) => [e.id, s + l * n - t]));
|
|
3335
3351
|
}
|
|
3336
|
-
function
|
|
3337
|
-
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;
|
|
3338
3354
|
if (e.length < (i === null ? 3 : 2)) return null;
|
|
3339
3355
|
let a = e.map((e) => ({
|
|
3340
3356
|
item: e,
|
|
3341
|
-
...
|
|
3357
|
+
...Tr(e.box, r)
|
|
3342
3358
|
})).sort((e, t) => e.start - t.start || e.end - t.end), o = a.map((e) => e.end - e.start), s = [];
|
|
3343
3359
|
if (i === null) {
|
|
3344
3360
|
let e = a[0], t = a[a.length - 1], i = e.start, c = t.end;
|
|
3345
3361
|
if (n.target === "page" && n.pageBounds) {
|
|
3346
|
-
let e =
|
|
3362
|
+
let e = Tr(n.pageBounds, r);
|
|
3347
3363
|
i = e.start, c = e.end;
|
|
3348
3364
|
}
|
|
3349
3365
|
let l = o.reduce((e, t) => e + t, 0), u = (c - i - l) / (a.length - 1), d = i;
|
|
@@ -3354,157 +3370,157 @@ function Or(e, t, n = {}) {
|
|
|
3354
3370
|
for (let e = t + 1; e < a.length; e++) s[e] = s[e - 1] + o[e - 1] + i;
|
|
3355
3371
|
for (let e = t - 1; e >= 0; e--) s[e] = s[e + 1] - i - o[e];
|
|
3356
3372
|
}
|
|
3357
|
-
return
|
|
3373
|
+
return Dr(a.map((e, t) => [e.item.id, s[t] - e.start]));
|
|
3358
3374
|
}
|
|
3359
3375
|
// src/designer/stores/element-store.ts
|
|
3360
|
-
function
|
|
3361
|
-
let t = e.elements ??
|
|
3362
|
-
return
|
|
3376
|
+
function Mr(e) {
|
|
3377
|
+
let t = e.elements ?? F;
|
|
3378
|
+
return H("editor-element", ({ action: n }) => {
|
|
3363
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;
|
|
3364
3380
|
function l(e) {
|
|
3365
|
-
return
|
|
3381
|
+
return L(r.value, e);
|
|
3366
3382
|
}
|
|
3367
|
-
let u =
|
|
3383
|
+
let u = W(null), d = W("");
|
|
3368
3384
|
function f(e, n) {
|
|
3369
|
-
Object.assign(e,
|
|
3385
|
+
Object.assign(e, te(e, { width: e.width }, t, { enforceMinimum: !1 })), u.value = e, d.value = n;
|
|
3370
3386
|
}
|
|
3371
3387
|
function p(e) {
|
|
3372
|
-
u.value && Object.assign(u.value,
|
|
3388
|
+
u.value && Object.assign(u.value, te(u.value, e, t, { enforceMinimum: !1 }));
|
|
3373
3389
|
}
|
|
3374
3390
|
let m = n(() => {
|
|
3375
3391
|
u.value = null, d.value = "";
|
|
3376
3392
|
}, "cancelDraft");
|
|
3377
3393
|
function h(e) {
|
|
3378
|
-
return
|
|
3394
|
+
return Pe(r.value, e);
|
|
3379
3395
|
}
|
|
3380
|
-
function
|
|
3396
|
+
function _(e) {
|
|
3381
3397
|
return h(e)?.node;
|
|
3382
3398
|
}
|
|
3383
|
-
function
|
|
3384
|
-
return e.map((e) =>
|
|
3399
|
+
function v(e) {
|
|
3400
|
+
return e.map((e) => _(e)).filter((e) => e !== void 0);
|
|
3385
3401
|
}
|
|
3386
|
-
function
|
|
3402
|
+
function y(e, t = {}) {
|
|
3387
3403
|
return (l(e)?.elements ?? []).filter((e) => (t.visible === void 0 || e.visible === t.visible) && (t.locked === void 0 || e.locked === t.locked));
|
|
3388
3404
|
}
|
|
3389
|
-
let
|
|
3405
|
+
let b = n((e, n = {}, o) => {
|
|
3390
3406
|
let s = o ? l(o) : i.value;
|
|
3391
3407
|
if (!s) return null;
|
|
3392
|
-
let c =
|
|
3393
|
-
return s.elements.push(c),
|
|
3394
|
-
}, "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) => {
|
|
3395
3411
|
let i = u.value;
|
|
3396
3412
|
if (!i || !d.value) return u.value = null, d.value = "", null;
|
|
3397
3413
|
let o = l(d.value);
|
|
3398
3414
|
if (u.value = null, d.value = "", !o) return null;
|
|
3399
3415
|
if (!t.get(i.type)?.pointBased) {
|
|
3400
|
-
let e =
|
|
3401
|
-
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;
|
|
3402
3418
|
}
|
|
3403
|
-
return o.elements.push(i),
|
|
3419
|
+
return o.elements.push(i), D(r.value, i, t), e.selection.set([i.id]), a(), i;
|
|
3404
3420
|
}, "commitDraft");
|
|
3405
|
-
function
|
|
3421
|
+
function S(e, n) {
|
|
3406
3422
|
let i = h(e);
|
|
3407
3423
|
if (!i || i.node.locked) return !1;
|
|
3408
|
-
|
|
3424
|
+
j(r.value, i.node, n);
|
|
3409
3425
|
let a = {
|
|
3410
3426
|
...i.node,
|
|
3411
3427
|
...n
|
|
3412
|
-
}, o =
|
|
3428
|
+
}, o = O(r.value, a, t);
|
|
3413
3429
|
return o !== a && (n = {
|
|
3414
3430
|
...n,
|
|
3415
3431
|
bindings: o.bindings,
|
|
3416
3432
|
props: o.props
|
|
3417
|
-
}),
|
|
3433
|
+
}), ge(r.value, {
|
|
3418
3434
|
...i.node,
|
|
3419
3435
|
...n
|
|
3420
|
-
}, 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;
|
|
3421
3437
|
}
|
|
3422
3438
|
function C(e) {
|
|
3423
|
-
return e.y !== void 0 && !
|
|
3439
|
+
return e.y !== void 0 && !T(e);
|
|
3424
3440
|
}
|
|
3425
|
-
function
|
|
3441
|
+
function T(e) {
|
|
3426
3442
|
return e.rotation !== void 0 || e.width !== void 0 || e.height !== void 0;
|
|
3427
3443
|
}
|
|
3428
|
-
let
|
|
3444
|
+
let E = n((n, i = {}, o = []) => {
|
|
3429
3445
|
for (let { id: e, patch: i } of n) {
|
|
3430
|
-
let n =
|
|
3431
|
-
n && (
|
|
3446
|
+
let n = _(e);
|
|
3447
|
+
n && (j(r.value, n, i), ge(r.value, O(r.value, {
|
|
3432
3448
|
...n,
|
|
3433
3449
|
...i
|
|
3434
3450
|
}, t), t));
|
|
3435
3451
|
}
|
|
3436
3452
|
for (let { geometry: e, id: t } of o) {
|
|
3437
|
-
let n =
|
|
3453
|
+
let n = _(t);
|
|
3438
3454
|
n && Object.assign(n, e);
|
|
3439
3455
|
}
|
|
3440
3456
|
let s = [], c = [];
|
|
3441
|
-
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));
|
|
3442
3458
|
let l = e.layout.apply(s, c);
|
|
3443
3459
|
return i.transient || a(), l;
|
|
3444
|
-
}, "updateMany"),
|
|
3445
|
-
|
|
3446
|
-
}, "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 = {}) => {
|
|
3447
3463
|
let s = h(n);
|
|
3448
3464
|
if (!s || s.node.locked) return;
|
|
3449
|
-
let c =
|
|
3465
|
+
let c = O(r.value, {
|
|
3450
3466
|
...s.node,
|
|
3451
3467
|
props: {
|
|
3452
3468
|
...s.node.props,
|
|
3453
3469
|
...i
|
|
3454
3470
|
}
|
|
3455
3471
|
}, t);
|
|
3456
|
-
|
|
3457
|
-
}, "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 = {}) => {
|
|
3458
3474
|
if (t.length === 0) return;
|
|
3459
3475
|
for (let e of t) {
|
|
3460
|
-
let t =
|
|
3461
|
-
t &&
|
|
3476
|
+
let t = _(e);
|
|
3477
|
+
t && j(r.value, t);
|
|
3462
3478
|
}
|
|
3463
3479
|
let i = new Set(t);
|
|
3464
|
-
for (let e of
|
|
3465
|
-
|
|
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) => ({
|
|
3466
3482
|
...e,
|
|
3467
3483
|
elementIds: e.elementIds.filter((e) => !i.has(e))
|
|
3468
|
-
})).filter((e) => e.elementIds.length > 0)), e.selection.set(o.value.filter((e) => !i.has(e))),
|
|
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();
|
|
3469
3485
|
}, "removeIds"), ne = n(() => {
|
|
3470
|
-
|
|
3486
|
+
P(o.value.filter((e) => {
|
|
3471
3487
|
let t = h(e);
|
|
3472
3488
|
return t ? !t.node.locked : !1;
|
|
3473
3489
|
}));
|
|
3474
3490
|
}, "removeSelected"), re = n((n, i = 3, o = {}) => {
|
|
3475
|
-
let s =
|
|
3491
|
+
let s = tr(r.value, n), c = [], l = /* @__PURE__ */ new Map();
|
|
3476
3492
|
for (let e of n) {
|
|
3477
3493
|
let n = h(e);
|
|
3478
3494
|
if (!n) continue;
|
|
3479
|
-
let a =
|
|
3480
|
-
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);
|
|
3481
3497
|
let o = l.get(n.page.id) ?? /* @__PURE__ */ new Map();
|
|
3482
3498
|
o.set(e, a.id), l.set(n.page.id, o), c.push(a.id);
|
|
3483
3499
|
}
|
|
3484
3500
|
if (c.length > 0) {
|
|
3485
|
-
for (let [e, t] of l)
|
|
3501
|
+
for (let [e, t] of l) nr(r.value, {
|
|
3486
3502
|
elementGroups: s.elementGroups.filter((t) => t.pageId === e),
|
|
3487
3503
|
followBlocks: s.followBlocks.filter((t) => t.pageId === e),
|
|
3488
3504
|
repeatGroups: s.repeatGroups.filter((t) => t.pageId === e)
|
|
3489
|
-
}, t, e,
|
|
3505
|
+
}, t, e, V);
|
|
3490
3506
|
e.selection.set(c), o.transient || a();
|
|
3491
3507
|
}
|
|
3492
|
-
}, "duplicate"),
|
|
3508
|
+
}, "duplicate"), F = n((t, n) => {
|
|
3493
3509
|
let r = e.selection.unlockedNodes;
|
|
3494
3510
|
if (r.length !== 0) {
|
|
3495
|
-
for (let e of r) Object.assign(e,
|
|
3511
|
+
for (let e of r) Object.assign(e, De(e, t, n));
|
|
3496
3512
|
e.layout.apply(n === 0 ? [] : r.map((e) => e.id)), a({ coalesce: `nudge:${r.map((e) => e.id).join(",")}` });
|
|
3497
3513
|
}
|
|
3498
3514
|
}, "nudge");
|
|
3499
|
-
function
|
|
3500
|
-
let n =
|
|
3501
|
-
return t(n) ? (
|
|
3515
|
+
function I(e, t) {
|
|
3516
|
+
let n = se(e, r.value.elementGroups ?? []);
|
|
3517
|
+
return t(n) ? (_e(r.value, e, n), !0) : !1;
|
|
3502
3518
|
}
|
|
3503
|
-
let
|
|
3519
|
+
let oe = n((e, t, n) => {
|
|
3504
3520
|
let r = l(e);
|
|
3505
3521
|
if (!r || !r.elements.some((e) => e.id === t)) return;
|
|
3506
|
-
let i = [...r.elements].reverse(), o =
|
|
3507
|
-
c.id !== t &&
|
|
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
|
+
c.id !== t && I(r, (e) => pe(e, [{
|
|
3508
3524
|
id: t,
|
|
3509
3525
|
kind: "element"
|
|
3510
3526
|
}], {
|
|
@@ -3513,7 +3529,7 @@ function kr(e) {
|
|
|
3513
3529
|
}, s ? "above" : "below")), a();
|
|
3514
3530
|
}, "moveByDisplayIndex"), le = n((e, t, n, r) => {
|
|
3515
3531
|
let i = l(e);
|
|
3516
|
-
i &&
|
|
3532
|
+
i && I(i, (e) => pe(e, t, n, r)) && a();
|
|
3517
3533
|
}, "moveLayerNodes");
|
|
3518
3534
|
function ue(e) {
|
|
3519
3535
|
let t = /* @__PURE__ */ new Map();
|
|
@@ -3525,33 +3541,33 @@ function kr(e) {
|
|
|
3525
3541
|
}
|
|
3526
3542
|
for (let [n, r] of t) {
|
|
3527
3543
|
let t = l(n);
|
|
3528
|
-
t &&
|
|
3544
|
+
t && I(t, (t) => ae(t, r, e));
|
|
3529
3545
|
}
|
|
3530
3546
|
a();
|
|
3531
3547
|
}
|
|
3532
|
-
let
|
|
3548
|
+
let fe = n((e) => {
|
|
3533
3549
|
ue({ offset: e });
|
|
3534
|
-
}, "reorder"),
|
|
3550
|
+
}, "reorder"), me = n((e) => {
|
|
3535
3551
|
ue({ edge: e });
|
|
3536
|
-
}, "sendTo"),
|
|
3537
|
-
let i =
|
|
3552
|
+
}, "sendTo"), he = n((e, t, n) => {
|
|
3553
|
+
let i = v(e).filter((e) => e[t] !== n);
|
|
3538
3554
|
if (i.length !== 0) {
|
|
3539
|
-
if (t === "visible") for (let e of i)
|
|
3555
|
+
if (t === "visible") for (let e of i) j(r.value, e, { visible: n });
|
|
3540
3556
|
for (let e of i) e[t] = n;
|
|
3541
3557
|
a();
|
|
3542
3558
|
}
|
|
3543
|
-
}, "setFlag"),
|
|
3559
|
+
}, "setFlag"), ye = n((e, t) => {
|
|
3544
3560
|
let n = h(e);
|
|
3545
|
-
n && (t === "visible" &&
|
|
3546
|
-
}, "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) => {
|
|
3547
3563
|
let n = h(e);
|
|
3548
3564
|
n && t.trim() && (n.node.name = t.trim(), a());
|
|
3549
3565
|
}, "rename");
|
|
3550
|
-
function
|
|
3566
|
+
function xe() {
|
|
3551
3567
|
let t = e.selection.unlockedNodes, n = t[0] ? h(t[0].id)?.page : void 0;
|
|
3552
3568
|
return n ? {
|
|
3553
3569
|
items: t.map((e) => ({
|
|
3554
|
-
box:
|
|
3570
|
+
box: ce({
|
|
3555
3571
|
height: e.height,
|
|
3556
3572
|
width: e.width,
|
|
3557
3573
|
x: e.x,
|
|
@@ -3568,86 +3584,86 @@ function kr(e) {
|
|
|
3568
3584
|
}
|
|
3569
3585
|
} : null;
|
|
3570
3586
|
}
|
|
3571
|
-
function
|
|
3587
|
+
function Se(t, n, r) {
|
|
3572
3588
|
for (let [e, i] of r) {
|
|
3573
3589
|
let r = t.get(e);
|
|
3574
3590
|
if (!r) continue;
|
|
3575
|
-
let a = n === "x" ?
|
|
3591
|
+
let a = n === "x" ? De(r, i, 0) : De(r, 0, i);
|
|
3576
3592
|
Object.assign(r, a);
|
|
3577
3593
|
}
|
|
3578
3594
|
e.layout.apply(n === "y" ? [...r.keys()] : []), a();
|
|
3579
3595
|
}
|
|
3580
3596
|
return {
|
|
3581
|
-
add:
|
|
3597
|
+
add: b,
|
|
3582
3598
|
align: n((e, t = {}) => {
|
|
3583
|
-
let n =
|
|
3599
|
+
let n = xe();
|
|
3584
3600
|
if (!n) return;
|
|
3585
|
-
let r =
|
|
3601
|
+
let r = kr(n.items, e, {
|
|
3586
3602
|
...t,
|
|
3587
3603
|
pageBounds: n.pageBounds
|
|
3588
3604
|
});
|
|
3589
|
-
|
|
3605
|
+
Se(n.nodes, Cr(e), r);
|
|
3590
3606
|
}, "align"),
|
|
3591
3607
|
cancelDraft: m,
|
|
3592
|
-
commitDraft:
|
|
3608
|
+
commitDraft: x,
|
|
3593
3609
|
distribute: n((e, t = {}) => {
|
|
3594
|
-
let n =
|
|
3610
|
+
let n = xe();
|
|
3595
3611
|
if (!n) return;
|
|
3596
|
-
let r =
|
|
3612
|
+
let r = Ar(n.items, e, {
|
|
3597
3613
|
...t,
|
|
3598
3614
|
pageBounds: n.pageBounds
|
|
3599
3615
|
});
|
|
3600
|
-
r ?
|
|
3616
|
+
r ? Se(n.nodes, Cr(e), r) : c(g("designer.elementStore.insufficientDistributionSelection"));
|
|
3601
3617
|
}, "distribute"),
|
|
3602
3618
|
distributeSpacing: n((e, t = {}) => {
|
|
3603
|
-
let n =
|
|
3619
|
+
let n = xe();
|
|
3604
3620
|
if (!n) return;
|
|
3605
|
-
let r =
|
|
3621
|
+
let r = jr(n.items, e, {
|
|
3606
3622
|
...t,
|
|
3607
3623
|
pageBounds: n.pageBounds
|
|
3608
3624
|
});
|
|
3609
|
-
if (r)
|
|
3625
|
+
if (r) Se(n.nodes, wr(e), r);
|
|
3610
3626
|
else {
|
|
3611
3627
|
let e = typeof t.spacing == "number" && Number.isFinite(t.spacing);
|
|
3612
|
-
c(
|
|
3628
|
+
c(g(e ? "designer.elementStore.insufficientSpacingSelection" : "designer.elementStore.insufficientDistributionSelection"));
|
|
3613
3629
|
}
|
|
3614
3630
|
}, "distributeSpacing"),
|
|
3615
3631
|
draftElement: u,
|
|
3616
3632
|
draftPageId: d,
|
|
3617
3633
|
duplicate: re,
|
|
3618
|
-
find:
|
|
3619
|
-
get:
|
|
3620
|
-
getByPage:
|
|
3621
|
-
getMany:
|
|
3622
|
-
moveByDisplayIndex:
|
|
3634
|
+
find: U(() => h),
|
|
3635
|
+
get: U(() => _),
|
|
3636
|
+
getByPage: U(() => y),
|
|
3637
|
+
getMany: U(() => v),
|
|
3638
|
+
moveByDisplayIndex: oe,
|
|
3623
3639
|
moveLayerNodes: le,
|
|
3624
|
-
nudge:
|
|
3625
|
-
removeIds:
|
|
3640
|
+
nudge: F,
|
|
3641
|
+
removeIds: P,
|
|
3626
3642
|
removeSelected: ne,
|
|
3627
|
-
rename:
|
|
3628
|
-
reorder:
|
|
3629
|
-
sendTo:
|
|
3643
|
+
rename: be,
|
|
3644
|
+
reorder: fe,
|
|
3645
|
+
sendTo: me,
|
|
3630
3646
|
setDraft: f,
|
|
3631
|
-
setFlag:
|
|
3632
|
-
toggleFlag:
|
|
3633
|
-
update:
|
|
3647
|
+
setFlag: he,
|
|
3648
|
+
toggleFlag: ye,
|
|
3649
|
+
update: k,
|
|
3634
3650
|
updateDraft: p,
|
|
3635
|
-
updateMany:
|
|
3636
|
-
updateProps:
|
|
3651
|
+
updateMany: E,
|
|
3652
|
+
updateProps: A
|
|
3637
3653
|
};
|
|
3638
3654
|
})();
|
|
3639
3655
|
}
|
|
3640
3656
|
// src/designer/stores/follow-block-store.ts
|
|
3641
|
-
function
|
|
3642
|
-
return
|
|
3643
|
-
let t =
|
|
3657
|
+
function Nr(e) {
|
|
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)), a = U(() => (e) => {
|
|
3644
3660
|
let n = /* @__PURE__ */ new Set();
|
|
3645
3661
|
for (let r of e) for (let e of t.value) e.elementIds.includes(r) && n.add(e);
|
|
3646
3662
|
return [...n];
|
|
3647
|
-
}),
|
|
3663
|
+
}), o = U(() => {
|
|
3648
3664
|
let n = e.selection.ids;
|
|
3649
3665
|
if (n.length !== 0) return t.value.find((e) => n.every((t) => e.elementIds.includes(t)));
|
|
3650
|
-
}),
|
|
3666
|
+
}), s = U(() => (e) => t.value.filter((t) => {
|
|
3651
3667
|
let n = l(t, e);
|
|
3652
3668
|
return n.elementIds.length > t.elementIds.length && !u(n);
|
|
3653
3669
|
}));
|
|
@@ -3663,25 +3679,25 @@ function Ar(e) {
|
|
|
3663
3679
|
followBlocks: [...t.value.filter((e) => e.id !== n.id), n]
|
|
3664
3680
|
};
|
|
3665
3681
|
for (let e of r.followBlocks) {
|
|
3666
|
-
let t =
|
|
3682
|
+
let t = P(r, e);
|
|
3667
3683
|
if (t) return t;
|
|
3668
3684
|
}
|
|
3669
3685
|
}
|
|
3670
3686
|
function d(t, r = []) {
|
|
3671
|
-
for (let { gap:
|
|
3672
|
-
let e = n.value(
|
|
3673
|
-
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);
|
|
3674
3690
|
}
|
|
3675
3691
|
}
|
|
3676
3692
|
function f(r) {
|
|
3677
3693
|
let i = n.value(r.id), a = u(r);
|
|
3678
|
-
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);
|
|
3679
3695
|
}
|
|
3680
3696
|
function p(t, n, r) {
|
|
3681
|
-
let i = e.document.data,
|
|
3682
|
-
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;
|
|
3683
3699
|
}
|
|
3684
|
-
function m(e, t, r, i = 2, a =
|
|
3700
|
+
function m(e, t, r, i = 2, a = g("designer.followBlock.defaultName"), o = V("follow")) {
|
|
3685
3701
|
if (n.value(o)) throw Error(`Follow block already exists: ${o}`);
|
|
3686
3702
|
let s = {
|
|
3687
3703
|
elementIds: [...t],
|
|
@@ -3700,16 +3716,16 @@ function Ar(e) {
|
|
|
3700
3716
|
...t
|
|
3701
3717
|
}) : !1;
|
|
3702
3718
|
}
|
|
3703
|
-
function
|
|
3704
|
-
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());
|
|
3705
3721
|
}
|
|
3706
|
-
function
|
|
3722
|
+
function v(e, t) {
|
|
3707
3723
|
let r = n.value(e);
|
|
3708
3724
|
if (!r) return !1;
|
|
3709
3725
|
let i = l(r, t);
|
|
3710
3726
|
return i.elementIds.length !== r.elementIds.length && f(i);
|
|
3711
3727
|
}
|
|
3712
|
-
function
|
|
3728
|
+
function y(n) {
|
|
3713
3729
|
let r = new Set(n), i = !1, a = t.value.flatMap((e) => {
|
|
3714
3730
|
let t = e.elementIds.filter((e) => !r.has(e));
|
|
3715
3731
|
return t.length === e.elementIds.length ? [e] : (i = !0, t.length ? [{
|
|
@@ -3717,32 +3733,32 @@ function Ar(e) {
|
|
|
3717
3733
|
elementIds: t
|
|
3718
3734
|
}] : []);
|
|
3719
3735
|
});
|
|
3720
|
-
i && (e.document.data.followBlocks = a,
|
|
3736
|
+
i && (e.document.data.followBlocks = a, w(e.document.data), e.history.commit());
|
|
3721
3737
|
}
|
|
3722
3738
|
return {
|
|
3723
|
-
addMembers:
|
|
3739
|
+
addMembers: v,
|
|
3724
3740
|
create: m,
|
|
3725
3741
|
find: n,
|
|
3726
|
-
getByElements:
|
|
3742
|
+
getByElements: a,
|
|
3727
3743
|
getByPage: r,
|
|
3728
|
-
getJoinable:
|
|
3744
|
+
getJoinable: s,
|
|
3729
3745
|
list: t,
|
|
3730
|
-
remove:
|
|
3731
|
-
removeMembers:
|
|
3732
|
-
selected:
|
|
3746
|
+
remove: _,
|
|
3747
|
+
removeMembers: y,
|
|
3748
|
+
selected: o,
|
|
3733
3749
|
syncGaps: d,
|
|
3734
3750
|
update: h
|
|
3735
3751
|
};
|
|
3736
3752
|
})();
|
|
3737
3753
|
}
|
|
3738
3754
|
// src/designer/stores/guide-store.ts
|
|
3739
|
-
function
|
|
3740
|
-
return
|
|
3755
|
+
function Pr(e) {
|
|
3756
|
+
return H("editor-guide", () => {
|
|
3741
3757
|
let { pages: t } = G(e.scope), n = e.history.commit;
|
|
3742
3758
|
function r(t) {
|
|
3743
3759
|
return e.scope.get(t);
|
|
3744
3760
|
}
|
|
3745
|
-
let i =
|
|
3761
|
+
let i = U(() => t.value.some((e) => e.guides.length > 0));
|
|
3746
3762
|
function a(e) {
|
|
3747
3763
|
return r(e)?.guides ?? [];
|
|
3748
3764
|
}
|
|
@@ -3763,15 +3779,15 @@ function jr(e) {
|
|
|
3763
3779
|
let o = r(e);
|
|
3764
3780
|
if (!o) return null;
|
|
3765
3781
|
let s = {
|
|
3766
|
-
id:
|
|
3782
|
+
id: V("guide"),
|
|
3767
3783
|
orientation: t,
|
|
3768
|
-
position:
|
|
3784
|
+
position: R(i)
|
|
3769
3785
|
};
|
|
3770
3786
|
return o.guides.push(s), a.transient || n(), s;
|
|
3771
3787
|
}
|
|
3772
3788
|
function l(e, t, r, i = {}) {
|
|
3773
3789
|
let a = o(e, t);
|
|
3774
|
-
a && (a.position =
|
|
3790
|
+
a && (a.position = R(r), i.transient || n());
|
|
3775
3791
|
}
|
|
3776
3792
|
function u(e, t, i = {}) {
|
|
3777
3793
|
let a = r(e);
|
|
@@ -3784,9 +3800,9 @@ function jr(e) {
|
|
|
3784
3800
|
return {
|
|
3785
3801
|
add: c,
|
|
3786
3802
|
clear: d,
|
|
3787
|
-
find:
|
|
3788
|
-
get:
|
|
3789
|
-
getByPage:
|
|
3803
|
+
find: U(() => s),
|
|
3804
|
+
get: U(() => o),
|
|
3805
|
+
getByPage: U(() => a),
|
|
3790
3806
|
hasAny: i,
|
|
3791
3807
|
move: l,
|
|
3792
3808
|
remove: u
|
|
@@ -3794,10 +3810,10 @@ function jr(e) {
|
|
|
3794
3810
|
})();
|
|
3795
3811
|
}
|
|
3796
3812
|
// src/designer/stores/history-store.ts
|
|
3797
|
-
var
|
|
3798
|
-
function
|
|
3799
|
-
return
|
|
3800
|
-
let { data: n } = G(e.document), r =
|
|
3813
|
+
var Fr = 100;
|
|
3814
|
+
function Ir(e) {
|
|
3815
|
+
return H("editor-history", ({ action: t }) => {
|
|
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);
|
|
3801
3817
|
function l() {
|
|
3802
3818
|
return JSON.stringify({
|
|
3803
3819
|
dataSources: n.value.dataSources ?? [],
|
|
@@ -3814,7 +3830,7 @@ function Nr(e) {
|
|
|
3814
3830
|
let n = l();
|
|
3815
3831
|
if (r.value[i.value] === n) return;
|
|
3816
3832
|
let a = Date.now();
|
|
3817
|
-
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);
|
|
3818
3834
|
}, "commit");
|
|
3819
3835
|
function p(t) {
|
|
3820
3836
|
let r = JSON.parse(t);
|
|
@@ -3873,8 +3889,8 @@ function Nr(e) {
|
|
|
3873
3889
|
})();
|
|
3874
3890
|
}
|
|
3875
3891
|
// src/designer/stores/layout-store.ts
|
|
3876
|
-
function
|
|
3877
|
-
return
|
|
3892
|
+
function Lr(e) {
|
|
3893
|
+
return H("editor-layout", () => {
|
|
3878
3894
|
let t = Ue(/* @__PURE__ */ new Map());
|
|
3879
3895
|
function n(e, n) {
|
|
3880
3896
|
let r = t.get(e);
|
|
@@ -3885,7 +3901,7 @@ function Pr(e) {
|
|
|
3885
3901
|
function r(n = [], r = []) {
|
|
3886
3902
|
let i = [];
|
|
3887
3903
|
for (let a of t.values()) for (let t of a(e.document.data, n, r)) {
|
|
3888
|
-
let n =
|
|
3904
|
+
let n = Pe(e.document.data, t.id);
|
|
3889
3905
|
n && (Object.assign(n.node, t.patch), i.push(t));
|
|
3890
3906
|
}
|
|
3891
3907
|
return i;
|
|
@@ -3898,9 +3914,9 @@ function Pr(e) {
|
|
|
3898
3914
|
})();
|
|
3899
3915
|
}
|
|
3900
3916
|
// src/designer/stores/navigation-store.ts
|
|
3901
|
-
function
|
|
3902
|
-
return
|
|
3903
|
-
let t =
|
|
3917
|
+
function Rr(e) {
|
|
3918
|
+
return H("editor-navigation", () => {
|
|
3919
|
+
let t = W([]);
|
|
3904
3920
|
function n(n) {
|
|
3905
3921
|
e.template.get(n) && e.template.editingId !== n && (t.value.push({
|
|
3906
3922
|
dialogSessionId: e.ui.suspendDialog(),
|
|
@@ -3939,30 +3955,30 @@ function Fr(e) {
|
|
|
3939
3955
|
})();
|
|
3940
3956
|
}
|
|
3941
3957
|
// src/designer/stores/page-store.ts
|
|
3942
|
-
function
|
|
3943
|
-
return
|
|
3944
|
-
let { data: t } = G(e.document), n = e.history.commit, r = e.ui.toast, i =
|
|
3958
|
+
function zr(e) {
|
|
3959
|
+
return H("editor-page", () => {
|
|
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));
|
|
3945
3961
|
function c(e) {
|
|
3946
3962
|
return a.value.find((t) => t.id === e);
|
|
3947
3963
|
}
|
|
3948
3964
|
function l(e) {
|
|
3949
3965
|
return a.value.findIndex((t) => t.id === e);
|
|
3950
3966
|
}
|
|
3951
|
-
let u =
|
|
3967
|
+
let u = U(() => {
|
|
3952
3968
|
let e = c(i.value) ?? a.value[0];
|
|
3953
3969
|
if (!e) throw Error("Document must contain at least one page");
|
|
3954
3970
|
return e;
|
|
3955
|
-
}), d =
|
|
3971
|
+
}), d = U(() => u.value.id);
|
|
3956
3972
|
function f(e) {
|
|
3957
3973
|
c(e) && (i.value = e);
|
|
3958
3974
|
}
|
|
3959
3975
|
function p(e, r, a, o = {}) {
|
|
3960
|
-
if (o.id &&
|
|
3961
|
-
let s =
|
|
3976
|
+
if (o.id && L(t.value, o.id)) throw Error(`Page already exists: ${o.id}`);
|
|
3977
|
+
let s = T(t.value, {
|
|
3962
3978
|
height: r,
|
|
3963
3979
|
width: e,
|
|
3964
3980
|
...o
|
|
3965
|
-
}, 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 }), {
|
|
3966
3982
|
...o,
|
|
3967
3983
|
...s
|
|
3968
3984
|
});
|
|
@@ -3971,42 +3987,52 @@ function Ir(e) {
|
|
|
3971
3987
|
function m(r) {
|
|
3972
3988
|
let a = l(r);
|
|
3973
3989
|
if (a < 0) return;
|
|
3974
|
-
let o = t.value.pages[a], s =
|
|
3975
|
-
...
|
|
3990
|
+
let o = t.value.pages[a], s = tr(t.value, o.elements.map((e) => e.id)), c = {
|
|
3991
|
+
...S(o),
|
|
3976
3992
|
background: o.background,
|
|
3977
3993
|
elements: o.elements.map((e) => ({
|
|
3978
|
-
...
|
|
3979
|
-
id:
|
|
3994
|
+
...z(e),
|
|
3995
|
+
id: V("el")
|
|
3980
3996
|
})),
|
|
3981
3997
|
guides: o.guides.map((e) => ({
|
|
3982
3998
|
...e,
|
|
3983
|
-
id:
|
|
3999
|
+
id: V("guide")
|
|
3984
4000
|
})),
|
|
3985
|
-
id:
|
|
3986
|
-
name:
|
|
4001
|
+
id: V("page"),
|
|
4002
|
+
name: g("designer.pageStore.duplicatePageName", { pageName: o.name }),
|
|
3987
4003
|
templateId: o.templateId
|
|
3988
4004
|
};
|
|
3989
|
-
for (let [n, r] of o.elements.entries())
|
|
3990
|
-
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();
|
|
3991
4007
|
}
|
|
3992
|
-
function
|
|
4008
|
+
function _(e) {
|
|
3993
4009
|
if (!o.value) {
|
|
3994
|
-
r(
|
|
4010
|
+
r(g("designer.pageStore.lastPageMessage"));
|
|
3995
4011
|
return;
|
|
3996
4012
|
}
|
|
3997
4013
|
let s = l(e);
|
|
3998
|
-
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());
|
|
3999
4015
|
}
|
|
4000
|
-
function
|
|
4016
|
+
function v(e, r) {
|
|
4001
4017
|
let i = c(e);
|
|
4002
4018
|
if (!i) return;
|
|
4003
|
-
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" });
|
|
4004
4020
|
let a = {
|
|
4005
4021
|
...i,
|
|
4006
4022
|
...r
|
|
4007
|
-
}, o =
|
|
4023
|
+
}, o = T(t.value, a);
|
|
4008
4024
|
Object.assign(i, a, o), n();
|
|
4009
4025
|
}
|
|
4026
|
+
function y(e, t) {
|
|
4027
|
+
let r = c(e);
|
|
4028
|
+
if (r) {
|
|
4029
|
+
if (t && (!Number.isFinite(t.x) || !Number.isFinite(t.y))) throw Error("Page position must contain finite coordinates");
|
|
4030
|
+
t === null ? delete r.position : r.position = {
|
|
4031
|
+
x: Math.max(0, R(t.x, 2)),
|
|
4032
|
+
y: Math.max(0, R(t.y, 2))
|
|
4033
|
+
}, n();
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
4010
4036
|
return {
|
|
4011
4037
|
active: u,
|
|
4012
4038
|
activeId: d,
|
|
@@ -4014,45 +4040,46 @@ function Ir(e) {
|
|
|
4014
4040
|
add: p,
|
|
4015
4041
|
canRemove: o,
|
|
4016
4042
|
copy: m,
|
|
4017
|
-
get:
|
|
4018
|
-
getIndex:
|
|
4019
|
-
has:
|
|
4043
|
+
get: U(() => c),
|
|
4044
|
+
getIndex: U(() => l),
|
|
4045
|
+
has: U(() => function(e) {
|
|
4020
4046
|
return c(e) !== void 0;
|
|
4021
4047
|
}),
|
|
4022
4048
|
list: a,
|
|
4023
|
-
|
|
4049
|
+
move: y,
|
|
4050
|
+
remove: _,
|
|
4024
4051
|
setActive: f,
|
|
4025
|
-
update:
|
|
4052
|
+
update: v
|
|
4026
4053
|
};
|
|
4027
4054
|
})();
|
|
4028
4055
|
}
|
|
4029
4056
|
// src/designer/stores/panel-store.ts
|
|
4030
|
-
var
|
|
4031
|
-
function
|
|
4057
|
+
var Br = "print-studio:panel-layout";
|
|
4058
|
+
function Vr(e) {
|
|
4032
4059
|
return {
|
|
4033
4060
|
activeId: e[0] ?? "",
|
|
4034
|
-
id:
|
|
4061
|
+
id: V("panel-group"),
|
|
4035
4062
|
panelIds: e,
|
|
4036
4063
|
weight: 1
|
|
4037
4064
|
};
|
|
4038
4065
|
}
|
|
4039
|
-
function
|
|
4066
|
+
function Hr(e) {
|
|
4040
4067
|
return {
|
|
4041
4068
|
collapsed: !1,
|
|
4042
4069
|
floating: !1,
|
|
4043
4070
|
groups: e,
|
|
4044
4071
|
height: 480,
|
|
4045
|
-
id:
|
|
4072
|
+
id: V("panel-column"),
|
|
4046
4073
|
railWidth: 112,
|
|
4047
4074
|
width: 280,
|
|
4048
4075
|
x: 80,
|
|
4049
4076
|
y: 100
|
|
4050
4077
|
};
|
|
4051
4078
|
}
|
|
4052
|
-
function
|
|
4053
|
-
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;
|
|
4054
4081
|
}
|
|
4055
|
-
function
|
|
4082
|
+
function Wr(e) {
|
|
4056
4083
|
let t = {
|
|
4057
4084
|
columns: [],
|
|
4058
4085
|
version: 1
|
|
@@ -4061,22 +4088,22 @@ function Vr(e) {
|
|
|
4061
4088
|
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
4062
4089
|
for (let i of e.columns) {
|
|
4063
4090
|
if (!i || typeof i != "object" || !Array.isArray(i.groups)) continue;
|
|
4064
|
-
let e =
|
|
4091
|
+
let e = Hr([]);
|
|
4065
4092
|
typeof i.id == "string" && !r.has(i.id) && (e.id = i.id), r.add(e.id);
|
|
4066
4093
|
for (let t of i.groups) {
|
|
4067
4094
|
if (!t || typeof t != "object" || !Array.isArray(t.panelIds)) continue;
|
|
4068
4095
|
let i = t.panelIds.filter((e) => typeof e != "string" || !e || n.has(e) ? !1 : (n.add(e), !0));
|
|
4069
4096
|
if (!i.length) continue;
|
|
4070
|
-
let a =
|
|
4071
|
-
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);
|
|
4072
4099
|
}
|
|
4073
|
-
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));
|
|
4074
4101
|
}
|
|
4075
4102
|
return t;
|
|
4076
4103
|
}
|
|
4077
|
-
function
|
|
4104
|
+
function Gr(e) {
|
|
4078
4105
|
try {
|
|
4079
|
-
return
|
|
4106
|
+
return Wr(JSON.parse((e ? e.get(Br) : localStorage.getItem(Br)) ?? "null"));
|
|
4080
4107
|
} catch {
|
|
4081
4108
|
return {
|
|
4082
4109
|
columns: [],
|
|
@@ -4084,45 +4111,45 @@ function Hr(e) {
|
|
|
4084
4111
|
};
|
|
4085
4112
|
}
|
|
4086
4113
|
}
|
|
4087
|
-
function
|
|
4114
|
+
function Kr(e, t, n) {
|
|
4088
4115
|
for (let r of e) r !== n && (r.panelIds = r.panelIds.filter((e) => !t.includes(e)));
|
|
4089
4116
|
}
|
|
4090
|
-
function
|
|
4117
|
+
function qr(e, t, n, r) {
|
|
4091
4118
|
let i = n.panelIds.filter((e) => !t.includes(e)), a = r ? i.indexOf(r) : -1;
|
|
4092
|
-
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];
|
|
4093
4120
|
}
|
|
4094
|
-
function
|
|
4121
|
+
function Jr(e) {
|
|
4095
4122
|
for (let t of e.columns) {
|
|
4096
4123
|
t.groups = t.groups.filter((e) => e.panelIds.length > 0);
|
|
4097
4124
|
for (let e of t.groups) e.panelIds.includes(e.activeId) || (e.activeId = e.panelIds[0]);
|
|
4098
4125
|
}
|
|
4099
4126
|
e.columns = e.columns.filter((e) => e.groups.length > 0);
|
|
4100
4127
|
}
|
|
4101
|
-
function
|
|
4102
|
-
let i =
|
|
4128
|
+
function Yr(e, t, n, r) {
|
|
4129
|
+
let i = Hr(t);
|
|
4103
4130
|
if (i.width = e.width, r && (i.collapsed = e.collapsed, i.railWidth = e.railWidth, i.height = e.height), n.placement === "float") {
|
|
4104
4131
|
i.floating = !0;
|
|
4105
4132
|
let e = i.collapsed ? i.railWidth : i.width;
|
|
4106
|
-
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));
|
|
4107
4134
|
}
|
|
4108
4135
|
return i;
|
|
4109
4136
|
}
|
|
4110
|
-
function
|
|
4111
|
-
return
|
|
4112
|
-
let r = Ue({}), i = /* @__PURE__ */ new Map(), a =
|
|
4137
|
+
function Xr(e = !0, t) {
|
|
4138
|
+
return H("editor-panel", ({ action: n }) => {
|
|
4139
|
+
let r = Ue({}), i = /* @__PURE__ */ new Map(), a = W(e ? Gr(t) : {
|
|
4113
4140
|
columns: [],
|
|
4114
4141
|
version: 1
|
|
4115
|
-
}), o =
|
|
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) {
|
|
4116
4143
|
return a.value.columns.find((t) => t.id === e);
|
|
4117
|
-
}), f =
|
|
4144
|
+
}), f = U(() => function(e) {
|
|
4118
4145
|
let t = d.value(e.columnId);
|
|
4119
4146
|
return t ? !e.groupId || t.groups.length === 1 && t.groups[0].id === e.groupId && (!e.panelId || t.groups[0].panelIds.length === 1) : !1;
|
|
4120
4147
|
});
|
|
4121
4148
|
function p() {
|
|
4122
4149
|
if (e && !c.value) {
|
|
4123
|
-
if (t) t.set(
|
|
4150
|
+
if (t) t.set(Br, JSON.stringify(a.value));
|
|
4124
4151
|
else try {
|
|
4125
|
-
localStorage.setItem(
|
|
4152
|
+
localStorage.setItem(Br, JSON.stringify(a.value));
|
|
4126
4153
|
} catch {
|
|
4127
4154
|
return;
|
|
4128
4155
|
}
|
|
@@ -4137,7 +4164,7 @@ function qr(e = !0, t) {
|
|
|
4137
4164
|
let n = i.get(e.id) ?? [];
|
|
4138
4165
|
if (n.push(t), i.set(e.id, n), !a.value.columns.some((t) => t.groups.some((t) => t.panelIds.includes(e.id)))) {
|
|
4139
4166
|
let t = l.value[0];
|
|
4140
|
-
t || (t =
|
|
4167
|
+
t || (t = Hr([]), a.value.columns.push(t)), t.groups.push(Vr([e.id]));
|
|
4141
4168
|
}
|
|
4142
4169
|
return function() {
|
|
4143
4170
|
let a = n.indexOf(t);
|
|
@@ -4148,7 +4175,7 @@ function qr(e = !0, t) {
|
|
|
4148
4175
|
};
|
|
4149
4176
|
}
|
|
4150
4177
|
function h() {
|
|
4151
|
-
t?.get(
|
|
4178
|
+
t?.get(Br) && (a.value = Gr(t));
|
|
4152
4179
|
}
|
|
4153
4180
|
function g(e, t, n = !1) {
|
|
4154
4181
|
for (let r of a.value.columns) {
|
|
@@ -4173,15 +4200,15 @@ function qr(e = !0, t) {
|
|
|
4173
4200
|
}
|
|
4174
4201
|
function b(e, t, n) {
|
|
4175
4202
|
let r = d.value(e);
|
|
4176
|
-
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)));
|
|
4177
4204
|
}
|
|
4178
4205
|
function x(e, t, n, r, i) {
|
|
4179
4206
|
let a = d.value(e), o = a?.groups.find((e) => e.id === t), s = a?.groups.find((e) => e.id === n);
|
|
4180
|
-
o && s && (o.weight = i *
|
|
4207
|
+
o && s && (o.weight = i * B(r, .1, .9), s.weight = i - o.weight);
|
|
4181
4208
|
}
|
|
4182
4209
|
function S(e, t, n) {
|
|
4183
4210
|
let r = d.value(e);
|
|
4184
|
-
r && (r.width =
|
|
4211
|
+
r && (r.width = B(t, 240, 560), r.height = B(n, 180, Math.max(180, window.innerHeight - r.y - 12)));
|
|
4185
4212
|
}
|
|
4186
4213
|
function C(e, t) {
|
|
4187
4214
|
E();
|
|
@@ -4199,21 +4226,21 @@ function qr(e = !0, t) {
|
|
|
4199
4226
|
version: 1
|
|
4200
4227
|
};
|
|
4201
4228
|
let r = n;
|
|
4202
|
-
if (f.value(e)) n.floating
|
|
4229
|
+
if (f.value(e)) !n.floating && !t.collapsed && (n.height = t.height);
|
|
4203
4230
|
else {
|
|
4204
4231
|
D(e, {
|
|
4205
4232
|
placement: "float",
|
|
4206
4233
|
x: t.x,
|
|
4207
4234
|
y: t.y
|
|
4208
4235
|
});
|
|
4209
|
-
let
|
|
4210
|
-
if (!
|
|
4236
|
+
let i = u.value.at(-1);
|
|
4237
|
+
if (!i) {
|
|
4211
4238
|
E();
|
|
4212
4239
|
return;
|
|
4213
4240
|
}
|
|
4214
|
-
r =
|
|
4241
|
+
r = i, r.height = t.collapsed ? n.height : t.height;
|
|
4215
4242
|
}
|
|
4216
|
-
r.floating = !0, r.x = t.x, r.y = t.y, s.value = {
|
|
4243
|
+
r.collapsed = t.collapsed, t.collapsed ? r.railWidth = t.width : r.width = t.width, r.floating = !0, r.x = t.x, r.y = t.y, s.value = {
|
|
4217
4244
|
columnId: r.id,
|
|
4218
4245
|
target: null,
|
|
4219
4246
|
x: e.x,
|
|
@@ -4245,26 +4272,26 @@ function qr(e = !0, t) {
|
|
|
4245
4272
|
if (!n || t.columnId && !r || t.groupId && !i) return;
|
|
4246
4273
|
if (n.floating && !e.groupId && !e.panelId && t.placement === "float") {
|
|
4247
4274
|
let e = n.collapsed ? n.railWidth : n.width;
|
|
4248
|
-
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();
|
|
4249
4276
|
return;
|
|
4250
4277
|
}
|
|
4251
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));
|
|
4252
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")) {
|
|
4253
|
-
if (t.placement === "tab" && i)
|
|
4280
|
+
if (t.placement === "tab" && i) qr(o, s, i, t.panelId);
|
|
4254
4281
|
else {
|
|
4255
|
-
let c = e.panelId ? [
|
|
4282
|
+
let c = e.panelId ? [Vr(s)] : o.map((e) => ({
|
|
4256
4283
|
...e,
|
|
4257
4284
|
panelIds: [...e.panelIds]
|
|
4258
4285
|
}));
|
|
4259
|
-
if (
|
|
4286
|
+
if (Kr(o, s), (t.placement === "top" || t.placement === "bottom") && r && i) {
|
|
4260
4287
|
let e = r.groups.indexOf(i);
|
|
4261
4288
|
r.groups.splice(e + +(t.placement === "bottom"), 0, ...c);
|
|
4262
4289
|
} else {
|
|
4263
|
-
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";
|
|
4264
4291
|
a.value.columns.splice(o + +!!s, 0, i);
|
|
4265
4292
|
}
|
|
4266
4293
|
}
|
|
4267
|
-
|
|
4294
|
+
Jr(a.value), _(), p();
|
|
4268
4295
|
}
|
|
4269
4296
|
}, "movePanels");
|
|
4270
4297
|
function O() {
|
|
@@ -4277,7 +4304,7 @@ function qr(e = !0, t) {
|
|
|
4277
4304
|
version: 1
|
|
4278
4305
|
};
|
|
4279
4306
|
let e = Object.keys(r);
|
|
4280
|
-
e.length && a.value.columns.push(
|
|
4307
|
+
e.length && a.value.columns.push(Hr(e.map((e) => Vr([e])))), _(), p();
|
|
4281
4308
|
}
|
|
4282
4309
|
return {
|
|
4283
4310
|
activate: g,
|
|
@@ -4310,9 +4337,9 @@ function qr(e = !0, t) {
|
|
|
4310
4337
|
})();
|
|
4311
4338
|
}
|
|
4312
4339
|
// src/designer/stores/plugin-store.ts
|
|
4313
|
-
function
|
|
4314
|
-
return
|
|
4315
|
-
let e =
|
|
4340
|
+
function Zr() {
|
|
4341
|
+
return H("editor-plugin", () => {
|
|
4342
|
+
let e = W([]), t = W({});
|
|
4316
4343
|
function n(e, n) {
|
|
4317
4344
|
t.value[e] = n;
|
|
4318
4345
|
}
|
|
@@ -4332,103 +4359,103 @@ function Jr() {
|
|
|
4332
4359
|
})();
|
|
4333
4360
|
}
|
|
4334
4361
|
// src/designer/stores/rendering-store.ts
|
|
4335
|
-
function
|
|
4336
|
-
return
|
|
4337
|
-
let t =
|
|
4362
|
+
function Qr(e) {
|
|
4363
|
+
return H("editor-rendering", () => {
|
|
4364
|
+
let t = W(null), n = W(null), r = W(!1), i = W(!1), a = W(!0), s = W({
|
|
4338
4365
|
completed: 0,
|
|
4339
4366
|
stage: "prepare",
|
|
4340
4367
|
total: 1
|
|
4341
|
-
}), c, l =
|
|
4368
|
+
}), c, l = o({
|
|
4342
4369
|
config: () => e.config.data.rendering,
|
|
4343
4370
|
elements: e.elements,
|
|
4344
4371
|
parsers: e.parsers,
|
|
4345
|
-
snapshot:
|
|
4372
|
+
snapshot: b
|
|
4346
4373
|
});
|
|
4347
4374
|
async function d(e, n, r, i) {
|
|
4348
|
-
let a =
|
|
4375
|
+
let a = b(e), o = n === void 0 ? void 0 : b(n), s = await _((e) => l.html(a, o, r, {
|
|
4349
4376
|
...i,
|
|
4350
4377
|
...e,
|
|
4351
4378
|
onProgress: (e) => {
|
|
4352
|
-
|
|
4379
|
+
g(e), i?.onProgress?.(e);
|
|
4353
4380
|
},
|
|
4354
4381
|
waitIfPaused: p
|
|
4355
4382
|
}), i);
|
|
4356
4383
|
return t.value = s.execution, s;
|
|
4357
4384
|
}
|
|
4358
4385
|
async function f(e, n, r, i) {
|
|
4359
|
-
let a =
|
|
4386
|
+
let a = b(e), o = n === void 0 ? void 0 : b(n), s = await _((e) => l.pdf(a, o, r, {
|
|
4360
4387
|
...i,
|
|
4361
4388
|
...e,
|
|
4362
4389
|
onProgress: (e) => {
|
|
4363
|
-
|
|
4390
|
+
g(e), i?.onProgress?.(e);
|
|
4364
4391
|
},
|
|
4365
4392
|
waitIfPaused: p
|
|
4366
4393
|
}), i);
|
|
4367
4394
|
return t.value = s.execution, s;
|
|
4368
4395
|
}
|
|
4369
4396
|
async function p() {
|
|
4370
|
-
|
|
4397
|
+
i.value && await new Promise((e) => {
|
|
4371
4398
|
c = e;
|
|
4372
4399
|
});
|
|
4373
4400
|
}
|
|
4374
|
-
function
|
|
4375
|
-
return
|
|
4401
|
+
function h(e) {
|
|
4402
|
+
return _((t) => {
|
|
4376
4403
|
if (!t.signal) throw Error("Missing render cancellation signal");
|
|
4377
4404
|
return e(t.signal);
|
|
4378
4405
|
}, void 0, !1);
|
|
4379
4406
|
}
|
|
4380
|
-
function
|
|
4407
|
+
function g(e) {
|
|
4381
4408
|
s.value = e;
|
|
4382
4409
|
}
|
|
4383
|
-
async function
|
|
4410
|
+
async function _(e, t, o = !0) {
|
|
4384
4411
|
if (n.value) throw new DOMException("A render task is already running", "InvalidStateError");
|
|
4385
4412
|
t?.signal?.throwIfAborted();
|
|
4386
|
-
let
|
|
4387
|
-
|
|
4413
|
+
let l = new AbortController(), d = () => {
|
|
4414
|
+
l.abort(t?.signal?.reason), x();
|
|
4388
4415
|
};
|
|
4389
|
-
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 = {
|
|
4390
4417
|
completed: 0,
|
|
4391
4418
|
stage: "prepare",
|
|
4392
4419
|
total: 1
|
|
4393
4420
|
};
|
|
4394
4421
|
try {
|
|
4395
|
-
return await
|
|
4422
|
+
return await u(l.signal), await e({ signal: l.signal });
|
|
4396
4423
|
} finally {
|
|
4397
|
-
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;
|
|
4398
4425
|
}
|
|
4399
4426
|
}
|
|
4400
|
-
function
|
|
4401
|
-
n.value?.abort(new
|
|
4427
|
+
function v() {
|
|
4428
|
+
n.value?.abort(new m("Render cancelled")), c?.(), c = void 0;
|
|
4402
4429
|
}
|
|
4403
4430
|
function y() {
|
|
4404
|
-
n.value &&
|
|
4431
|
+
n.value && a.value && (i.value = !0);
|
|
4405
4432
|
}
|
|
4406
|
-
function
|
|
4407
|
-
|
|
4433
|
+
function x() {
|
|
4434
|
+
i.value = !1, c?.(), c = void 0;
|
|
4408
4435
|
}
|
|
4409
4436
|
return K(() => e.config.data.rendering.worker, (e) => {
|
|
4410
4437
|
e || l.dispose();
|
|
4411
4438
|
}, { flush: "sync" }), Ve(() => {
|
|
4412
|
-
|
|
4439
|
+
v(), l.dispose();
|
|
4413
4440
|
}), {
|
|
4414
|
-
active:
|
|
4415
|
-
cancel:
|
|
4441
|
+
active: r,
|
|
4442
|
+
cancel: v,
|
|
4416
4443
|
html: d,
|
|
4417
4444
|
lastExecution: t,
|
|
4418
|
-
pausable:
|
|
4445
|
+
pausable: a,
|
|
4419
4446
|
pause: y,
|
|
4420
|
-
paused:
|
|
4447
|
+
paused: i,
|
|
4421
4448
|
pdf: f,
|
|
4422
4449
|
progress: s,
|
|
4423
|
-
resume:
|
|
4424
|
-
runExternal:
|
|
4450
|
+
resume: x,
|
|
4451
|
+
runExternal: h
|
|
4425
4452
|
};
|
|
4426
4453
|
})();
|
|
4427
4454
|
}
|
|
4428
4455
|
// src/designer/stores/repeat-group-store.ts
|
|
4429
|
-
function
|
|
4430
|
-
return
|
|
4431
|
-
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 =
|
|
4456
|
+
function $r(e) {
|
|
4457
|
+
return H("editor-repeatGroup", ({ action: t }) => {
|
|
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(() => {
|
|
4432
4459
|
let e = /* @__PURE__ */ new Map();
|
|
4433
4460
|
for (let t of c.value) for (let n of t.elementIds) e.has(n) || e.set(n, t);
|
|
4434
4461
|
return e;
|
|
@@ -4456,8 +4483,8 @@ function Xr(e) {
|
|
|
4456
4483
|
let r = new Set(n.elementIds);
|
|
4457
4484
|
return e.element.getByPage(n.pageId).filter((e) => r.has(e.id));
|
|
4458
4485
|
}
|
|
4459
|
-
let h =
|
|
4460
|
-
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) {
|
|
4461
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);
|
|
4462
4489
|
for (let e of a) for (let t of e.elementIds) r.has(t) && i.add(t);
|
|
4463
4490
|
return {
|
|
@@ -4465,57 +4492,57 @@ function Xr(e) {
|
|
|
4465
4492
|
groups: a
|
|
4466
4493
|
};
|
|
4467
4494
|
}
|
|
4468
|
-
function
|
|
4495
|
+
function y(t, r, i, s) {
|
|
4469
4496
|
if (i.id && u(i.id)) throw Error("Repeat group already exists: " + i.id);
|
|
4470
4497
|
if (!e.page.get(t) || r.length === 0) return null;
|
|
4471
|
-
let l =
|
|
4498
|
+
let l = v(t, r);
|
|
4472
4499
|
if (r.some((e) => !l.elementIds.includes(e))) return null;
|
|
4473
4500
|
let d = l.groups;
|
|
4474
|
-
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;
|
|
4475
4502
|
let f = s ? l.elementIds : [...new Set(r)];
|
|
4476
|
-
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;
|
|
4477
4504
|
let p = {
|
|
4478
4505
|
collection: "",
|
|
4479
4506
|
columns: 2,
|
|
4480
4507
|
direction: "vertical",
|
|
4481
4508
|
gapX: 2,
|
|
4482
4509
|
gapY: 2,
|
|
4483
|
-
id:
|
|
4484
|
-
name:
|
|
4510
|
+
id: V("group"),
|
|
4511
|
+
name: g("designer.repeatGroupStore.numberedGroupName", { groupNumber: c.value.length + 1 }),
|
|
4485
4512
|
...i,
|
|
4486
4513
|
elementIds: f,
|
|
4487
4514
|
pageId: t
|
|
4488
4515
|
};
|
|
4489
|
-
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;
|
|
4490
4517
|
}
|
|
4491
|
-
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) => {
|
|
4492
4519
|
let r = u(e);
|
|
4493
|
-
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()));
|
|
4494
4521
|
}, "update"), C = t((e, t = !1) => {
|
|
4495
4522
|
let r = u(e);
|
|
4496
|
-
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());
|
|
4497
4524
|
}, "remove");
|
|
4498
4525
|
return {
|
|
4499
|
-
activePageGroups:
|
|
4500
|
-
applyToSelection:
|
|
4501
|
-
create:
|
|
4502
|
-
find:
|
|
4503
|
-
findByElement:
|
|
4504
|
-
getApplyTarget:
|
|
4505
|
-
getByElements:
|
|
4506
|
-
getByPage:
|
|
4507
|
-
getMembers:
|
|
4526
|
+
activePageGroups: _,
|
|
4527
|
+
applyToSelection: x,
|
|
4528
|
+
create: b,
|
|
4529
|
+
find: U(() => u),
|
|
4530
|
+
findByElement: U(() => d),
|
|
4531
|
+
getApplyTarget: U(() => v),
|
|
4532
|
+
getByElements: U(() => p),
|
|
4533
|
+
getByPage: U(() => f),
|
|
4534
|
+
getMembers: U(() => m),
|
|
4508
4535
|
list: c,
|
|
4509
4536
|
remove: C,
|
|
4510
4537
|
selected: h,
|
|
4511
|
-
update:
|
|
4538
|
+
update: S
|
|
4512
4539
|
};
|
|
4513
4540
|
})();
|
|
4514
4541
|
}
|
|
4515
4542
|
// src/designer/stores/scope-store.ts
|
|
4516
|
-
function
|
|
4517
|
-
return
|
|
4518
|
-
let t =
|
|
4543
|
+
function ei(e) {
|
|
4544
|
+
return H("editor-scope", () => {
|
|
4545
|
+
let t = U(() => {
|
|
4519
4546
|
for (let t of e) {
|
|
4520
4547
|
let e = t.resolve();
|
|
4521
4548
|
if (e) return {
|
|
@@ -4524,7 +4551,7 @@ function Zr(e) {
|
|
|
4524
4551
|
};
|
|
4525
4552
|
}
|
|
4526
4553
|
throw Error("No editing scope available");
|
|
4527
|
-
}), n =
|
|
4554
|
+
}), n = U(() => t.value.scope.id), r = U(() => t.value.scope.pages), i = U(() => t.value.scope.layoutMode), a = U(() => t.value.scope.pageGap), o = U(() => r.value.find((e) => e.id === t.value.scope.activeId) ?? r.value[0]), s = U(() => function(e) {
|
|
4528
4555
|
return r.value.find((t) => t.id === e);
|
|
4529
4556
|
});
|
|
4530
4557
|
function c(e) {
|
|
@@ -4546,45 +4573,49 @@ function Zr(e) {
|
|
|
4546
4573
|
})();
|
|
4547
4574
|
}
|
|
4548
4575
|
// src/designer/stores/selection-store.ts
|
|
4549
|
-
function
|
|
4550
|
-
return
|
|
4551
|
-
|
|
4576
|
+
function ti(e, t) {
|
|
4577
|
+
return e.length === t.length && e.every((e, n) => t[n] === e);
|
|
4578
|
+
}
|
|
4579
|
+
function ni(e) {
|
|
4580
|
+
return H("editor-selection", ({ action: t }) => {
|
|
4581
|
+
let { data: n } = G(e.document), { active: r } = G(e.scope), i = W([]), a = U(() => new Set(i.value)), o = U(() => function(e) {
|
|
4552
4582
|
return a.value.has(e);
|
|
4553
|
-
}), s =
|
|
4583
|
+
}), s = W(null), c = W(null), l = W(null), u = W(null), d = t((e) => {
|
|
4554
4584
|
c.value = e;
|
|
4555
4585
|
}, "setHoverId"), f = t((e) => {
|
|
4556
4586
|
l.value = e;
|
|
4557
4587
|
}, "setRenamingId"), p = t((e) => {
|
|
4558
4588
|
u.value = e;
|
|
4559
|
-
}, "setEditingId"), m =
|
|
4589
|
+
}, "setEditingId"), m = U(() => {
|
|
4560
4590
|
let e = [];
|
|
4561
|
-
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);
|
|
4562
4592
|
return e;
|
|
4563
|
-
}), h =
|
|
4564
|
-
return (
|
|
4565
|
-
}), S =
|
|
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 (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
|
+
}), S = U(() => {
|
|
4566
4596
|
let e = m.value;
|
|
4567
|
-
return e.length === 0 ? null :
|
|
4597
|
+
return e.length === 0 ? null : be(e.map((e) => ce({
|
|
4568
4598
|
height: e.height,
|
|
4569
4599
|
width: e.width,
|
|
4570
4600
|
x: e.x,
|
|
4571
4601
|
y: e.y
|
|
4572
4602
|
}, e.rotation)));
|
|
4573
|
-
}), C =
|
|
4603
|
+
}), C = W(null), w = t((e) => {
|
|
4574
4604
|
(e === null || o.value(e)) && (C.value = e);
|
|
4575
4605
|
}, "setKeyId"), T = t((e, t = !1) => {
|
|
4576
4606
|
if (t) {
|
|
4577
4607
|
let t = new Set(i.value);
|
|
4578
4608
|
for (let n of e) t.has(n) ? t.delete(n) : t.add(n);
|
|
4579
|
-
|
|
4580
|
-
|
|
4609
|
+
let n = [...t];
|
|
4610
|
+
ti(n, i.value) || (i.value = n);
|
|
4611
|
+
} else ti(e, i.value) || (i.value = [...e]);
|
|
4581
4612
|
i.value.length > 0 && (s.value = null, u.value = null), C.value && !i.value.includes(C.value) && (C.value = null);
|
|
4582
4613
|
}, "set"), E = t(() => {
|
|
4583
4614
|
i.value = [], C.value = null, s.value = null;
|
|
4584
4615
|
}, "clear"), D = t(() => {
|
|
4585
4616
|
let e = r.value;
|
|
4586
4617
|
e && (C.value = null, i.value = e.elements.filter((e) => e.visible && !e.locked).map((e) => e.id));
|
|
4587
|
-
}, "all"), O =
|
|
4618
|
+
}, "all"), O = U(() => {
|
|
4588
4619
|
let t = s.value;
|
|
4589
4620
|
return t ? e.guide.find(t) : null;
|
|
4590
4621
|
}), k = t((e) => {
|
|
@@ -4629,14 +4660,14 @@ function Qr(e) {
|
|
|
4629
4660
|
})();
|
|
4630
4661
|
}
|
|
4631
4662
|
// src/designer/stores/template-store.ts
|
|
4632
|
-
function
|
|
4633
|
-
return
|
|
4634
|
-
let { data: t } = G(e.document), n = e.history.commit, r = e.ui.toast, i =
|
|
4663
|
+
function ri(e) {
|
|
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 ? Ne(c.value) : []), u = U(() => l.value.find((e) => e.id === a.value) ?? c.value?.page ?? null);
|
|
4635
4666
|
function d(e) {
|
|
4636
4667
|
return o.value.find((t) => t.id === e);
|
|
4637
4668
|
}
|
|
4638
4669
|
function f(e, n) {
|
|
4639
|
-
return
|
|
4670
|
+
return Me(t.value, e, n);
|
|
4640
4671
|
}
|
|
4641
4672
|
function p(e) {
|
|
4642
4673
|
let t = f(e);
|
|
@@ -4645,90 +4676,90 @@ function $r(e) {
|
|
|
4645
4676
|
function m(e) {
|
|
4646
4677
|
return f(e)?.background ?? e.background;
|
|
4647
4678
|
}
|
|
4648
|
-
function
|
|
4679
|
+
function _(e) {
|
|
4649
4680
|
return t.value.pages.filter((t) => (t.templateId ?? "template-blank") === e).length;
|
|
4650
4681
|
}
|
|
4651
|
-
function
|
|
4652
|
-
return
|
|
4682
|
+
function v(e) {
|
|
4683
|
+
return y(e) !== void 0;
|
|
4653
4684
|
}
|
|
4654
|
-
function
|
|
4655
|
-
return o.value.find((t) =>
|
|
4685
|
+
function y(e) {
|
|
4686
|
+
return o.value.find((t) => Ne(t).some((t) => t.id === e));
|
|
4656
4687
|
}
|
|
4657
|
-
function
|
|
4688
|
+
function x(e) {
|
|
4658
4689
|
t.value.templates || (t.value.templates = []), t.value.templates.push(e), n();
|
|
4659
4690
|
}
|
|
4660
|
-
function
|
|
4691
|
+
function C(e) {
|
|
4661
4692
|
let n = d(e.id);
|
|
4662
4693
|
if (n) return n;
|
|
4663
|
-
let r =
|
|
4664
|
-
return
|
|
4694
|
+
let r = b(e);
|
|
4695
|
+
return k(r), E({
|
|
4665
4696
|
...t.value,
|
|
4666
4697
|
templates: [...o.value, r]
|
|
4667
|
-
}, r),
|
|
4698
|
+
}, r), x(r), r;
|
|
4668
4699
|
}
|
|
4669
|
-
function
|
|
4670
|
-
if (n.id && (d(n.id) ||
|
|
4671
|
-
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 ? {
|
|
4672
4703
|
height: r.height,
|
|
4673
4704
|
width: r.width
|
|
4674
4705
|
} : void 0);
|
|
4675
|
-
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;
|
|
4676
4707
|
}
|
|
4677
|
-
function
|
|
4708
|
+
function T() {
|
|
4678
4709
|
let n = e.page.active;
|
|
4679
4710
|
if (!n) return null;
|
|
4680
|
-
let i =
|
|
4711
|
+
let i = I(g("designer.templateStore.fromPageTemplateName", { pageName: n.name }), n);
|
|
4681
4712
|
return i.background = n.background, i.page.elements = n.elements.map((n) => {
|
|
4682
|
-
let r =
|
|
4683
|
-
return r.id =
|
|
4713
|
+
let r = z(n);
|
|
4714
|
+
return r.id = V("el"), M(t.value, n, r, e.elements ?? F), r;
|
|
4684
4715
|
}), i.page.guides = n.guides.map((e) => ({
|
|
4685
4716
|
...e,
|
|
4686
|
-
id:
|
|
4687
|
-
})),
|
|
4717
|
+
id: V("guide")
|
|
4718
|
+
})), x(i), r(g("designer.templateStore.createdFromPageMessage")), i;
|
|
4688
4719
|
}
|
|
4689
|
-
function
|
|
4720
|
+
function D(e, t) {
|
|
4690
4721
|
let r = d(e);
|
|
4691
|
-
r && t.trim() && (
|
|
4722
|
+
r && t.trim() && (A(r, t.trim()), n());
|
|
4692
4723
|
}
|
|
4693
|
-
function
|
|
4694
|
-
let
|
|
4695
|
-
if (
|
|
4696
|
-
if (r.baseTemplateId && d(r.baseTemplateId)?.owner ||
|
|
4724
|
+
function O(e, r, i = {}) {
|
|
4725
|
+
let a = d(e);
|
|
4726
|
+
if (a) {
|
|
4727
|
+
if (r.baseTemplateId && d(r.baseTemplateId)?.owner || a.owner && r.facingPages) throw new h(g("core.pageExtensions.internalTemplate"), { code: "template.internal-resource" });
|
|
4697
4728
|
if (r.baseTemplateId !== void 0) {
|
|
4698
4729
|
let e = {
|
|
4699
|
-
...
|
|
4730
|
+
...a,
|
|
4700
4731
|
baseTemplateId: r.baseTemplateId || void 0
|
|
4701
4732
|
};
|
|
4702
|
-
|
|
4733
|
+
E(t.value, e), a.baseTemplateId = e.baseTemplateId;
|
|
4703
4734
|
}
|
|
4704
|
-
r.background !== void 0 && (
|
|
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();
|
|
4705
4736
|
}
|
|
4706
4737
|
}
|
|
4707
|
-
function
|
|
4738
|
+
function A(e, t) {
|
|
4708
4739
|
e.name = t, e.page.name = t, e.evenPage && (e.evenPage.name = t);
|
|
4709
4740
|
}
|
|
4710
|
-
function
|
|
4741
|
+
function j(e) {
|
|
4711
4742
|
let r = d(e);
|
|
4712
4743
|
if (r) {
|
|
4713
|
-
if (r.owner) throw new
|
|
4714
|
-
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" });
|
|
4715
4746
|
for (let n of t.value.pages) n.templateId === e && (n.templateId = void 0);
|
|
4716
4747
|
i.value === e && (i.value = null, a.value = null), t.value.templates = (t.value.templates ?? []).filter((t) => t.id !== e);
|
|
4717
4748
|
for (let t of o.value) t.baseTemplateId === e && (t.baseTemplateId = void 0);
|
|
4718
|
-
|
|
4749
|
+
N(t.value), de(t.value), P(xe), n();
|
|
4719
4750
|
}
|
|
4720
4751
|
}
|
|
4721
|
-
function
|
|
4722
|
-
let r =
|
|
4752
|
+
function P(e, n) {
|
|
4753
|
+
let r = ee(t.value, e, n);
|
|
4723
4754
|
for (let { dimensions: e, page: t } of r) Object.assign(t, e);
|
|
4724
4755
|
}
|
|
4725
|
-
function
|
|
4756
|
+
function ee(e, t, n) {
|
|
4726
4757
|
let r = [];
|
|
4727
4758
|
for (let i of e.pages) {
|
|
4728
4759
|
if (n && !n.has(i.id) || t && (i.templateId ?? "template-blank") !== t) continue;
|
|
4729
|
-
let a =
|
|
4760
|
+
let a = Me(e, i);
|
|
4730
4761
|
if (!a) continue;
|
|
4731
|
-
let o =
|
|
4762
|
+
let o = S(a.page);
|
|
4732
4763
|
r.push({
|
|
4733
4764
|
dimensions: o,
|
|
4734
4765
|
page: i
|
|
@@ -4736,19 +4767,19 @@ function $r(e) {
|
|
|
4736
4767
|
}
|
|
4737
4768
|
return r;
|
|
4738
4769
|
}
|
|
4739
|
-
function
|
|
4770
|
+
function te(e) {
|
|
4740
4771
|
let n = e.filter((e) => {
|
|
4741
4772
|
let n = t.value.pages.find((t) => t.id === e);
|
|
4742
4773
|
return n && d(n.templateId ?? "template-blank")?.facingPages;
|
|
4743
4774
|
});
|
|
4744
|
-
|
|
4775
|
+
P(void 0, new Set(n));
|
|
4745
4776
|
}
|
|
4746
|
-
function
|
|
4777
|
+
function ne(e, r) {
|
|
4747
4778
|
let i = d(r);
|
|
4748
4779
|
if (!i && r !== "template-none" || e.length === 0) return;
|
|
4749
|
-
if (i?.owner) throw new
|
|
4780
|
+
if (i?.owner) throw new h(g("core.pageExtensions.internalTemplate"), { code: "template.internal-resource" });
|
|
4750
4781
|
let a = new Set(e);
|
|
4751
|
-
|
|
4782
|
+
ee({
|
|
4752
4783
|
...t.value,
|
|
4753
4784
|
pages: t.value.pages.map((e) => a.has(e.id) ? {
|
|
4754
4785
|
...e,
|
|
@@ -4757,25 +4788,25 @@ function $r(e) {
|
|
|
4757
4788
|
}, void 0, a);
|
|
4758
4789
|
for (let e of t.value.pages) if (a.has(e.id)) {
|
|
4759
4790
|
e.templateId = r;
|
|
4760
|
-
let n =
|
|
4761
|
-
n && Object.assign(e,
|
|
4791
|
+
let n = Me(t.value, e);
|
|
4792
|
+
n && Object.assign(e, S(n.page));
|
|
4762
4793
|
}
|
|
4763
4794
|
n();
|
|
4764
4795
|
}
|
|
4765
|
-
function
|
|
4796
|
+
function re(e) {
|
|
4766
4797
|
d(e) && (i.value = e, a.value = d(e)?.page.id ?? null);
|
|
4767
4798
|
}
|
|
4768
|
-
function
|
|
4799
|
+
function ie(e) {
|
|
4769
4800
|
l.value.some((t) => t.id === e) && (a.value = e);
|
|
4770
4801
|
}
|
|
4771
|
-
function
|
|
4772
|
-
let i =
|
|
4802
|
+
function ae(e, r) {
|
|
4803
|
+
let i = y(e), a = i ? Ne(i).find((t) => t.id === e) : void 0;
|
|
4773
4804
|
if (!a) return;
|
|
4774
|
-
let s =
|
|
4805
|
+
let s = S({
|
|
4775
4806
|
...a,
|
|
4776
4807
|
...r
|
|
4777
4808
|
});
|
|
4778
|
-
i &&
|
|
4809
|
+
i && ee({
|
|
4779
4810
|
...t.value,
|
|
4780
4811
|
templates: o.value.map((t) => t.id === i.id ? {
|
|
4781
4812
|
...t,
|
|
@@ -4788,58 +4819,58 @@ function $r(e) {
|
|
|
4788
4819
|
...r
|
|
4789
4820
|
} : t.page
|
|
4790
4821
|
} : t)
|
|
4791
|
-
}, 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();
|
|
4792
4823
|
}
|
|
4793
|
-
function
|
|
4824
|
+
function R() {
|
|
4794
4825
|
i.value = null, a.value = null;
|
|
4795
4826
|
}
|
|
4796
|
-
function
|
|
4827
|
+
function se(r) {
|
|
4797
4828
|
let i = t.value.pages.find((e) => e.id === r);
|
|
4798
4829
|
if (!i) return;
|
|
4799
4830
|
let a = f(i);
|
|
4800
4831
|
if (!a) return;
|
|
4801
4832
|
let o = a.page.elements.map((n) => {
|
|
4802
|
-
let r =
|
|
4803
|
-
return r.id =
|
|
4833
|
+
let r = z(n);
|
|
4834
|
+
return r.id = V("el"), M(t.value, n, r, e.elements ?? F), r;
|
|
4804
4835
|
});
|
|
4805
|
-
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();
|
|
4806
4837
|
}
|
|
4807
4838
|
return {
|
|
4808
|
-
activatePage:
|
|
4809
|
-
applyToPages:
|
|
4810
|
-
create:
|
|
4811
|
-
createFromPage:
|
|
4812
|
-
detach:
|
|
4839
|
+
activatePage: ie,
|
|
4840
|
+
applyToPages: ne,
|
|
4841
|
+
create: w,
|
|
4842
|
+
createFromPage: T,
|
|
4843
|
+
detach: se,
|
|
4813
4844
|
editingId: i,
|
|
4814
4845
|
editingPage: u,
|
|
4815
4846
|
editingPages: l,
|
|
4816
4847
|
editingTemplate: c,
|
|
4817
|
-
effectiveBackground:
|
|
4818
|
-
effectiveTemplate:
|
|
4819
|
-
enterEdit:
|
|
4820
|
-
exitEdit:
|
|
4821
|
-
get:
|
|
4822
|
-
getByPage:
|
|
4823
|
-
import:
|
|
4824
|
-
isContainer:
|
|
4848
|
+
effectiveBackground: U(() => m),
|
|
4849
|
+
effectiveTemplate: U(() => p),
|
|
4850
|
+
enterEdit: re,
|
|
4851
|
+
exitEdit: R,
|
|
4852
|
+
get: U(() => d),
|
|
4853
|
+
getByPage: U(() => y),
|
|
4854
|
+
import: C,
|
|
4855
|
+
isContainer: U(() => v),
|
|
4825
4856
|
list: s,
|
|
4826
|
-
remove:
|
|
4827
|
-
rename:
|
|
4828
|
-
resolveFor:
|
|
4829
|
-
syncPageDimensions:
|
|
4830
|
-
update:
|
|
4831
|
-
updatePage:
|
|
4832
|
-
usageCount:
|
|
4857
|
+
remove: j,
|
|
4858
|
+
rename: D,
|
|
4859
|
+
resolveFor: U(() => f),
|
|
4860
|
+
syncPageDimensions: te,
|
|
4861
|
+
update: O,
|
|
4862
|
+
updatePage: ae,
|
|
4863
|
+
usageCount: U(() => _)
|
|
4833
4864
|
};
|
|
4834
4865
|
})();
|
|
4835
4866
|
}
|
|
4836
4867
|
// src/designer/stores/tutorial-store.ts
|
|
4837
|
-
function
|
|
4838
|
-
return
|
|
4839
|
-
let t =
|
|
4868
|
+
function ii(e) {
|
|
4869
|
+
return H("editor-tutorial", () => {
|
|
4870
|
+
let t = W("idle"), n = W(null), r = W(0), i = We([]), a = U(() => {
|
|
4840
4871
|
let e = i.value;
|
|
4841
4872
|
return typeof e == "function" ? e() : e;
|
|
4842
|
-
}), o =
|
|
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));
|
|
4843
4874
|
function p() {
|
|
4844
4875
|
t.value !== "running" && t.value !== "finish" && (t.value = "list");
|
|
4845
4876
|
}
|
|
@@ -4847,7 +4878,7 @@ function ei(e) {
|
|
|
4847
4878
|
t.value === "list" && (t.value = "idle");
|
|
4848
4879
|
}
|
|
4849
4880
|
function h(l, u = []) {
|
|
4850
|
-
|
|
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({
|
|
4851
4882
|
previewWithData: !1,
|
|
4852
4883
|
showMargins: !0
|
|
4853
4884
|
}));
|
|
@@ -4859,14 +4890,14 @@ function ei(e) {
|
|
|
4859
4890
|
n >= a.value.length ? _() : r.value = n;
|
|
4860
4891
|
return;
|
|
4861
4892
|
}
|
|
4862
|
-
let i =
|
|
4893
|
+
let i = Zn[n];
|
|
4863
4894
|
i ? (i.apply?.(e, f.value), r.value = n) : _();
|
|
4864
4895
|
}
|
|
4865
4896
|
function _() {
|
|
4866
4897
|
t.value === "running" && (o.value = !1, e.ui.closeDialog(), t.value = "finish");
|
|
4867
4898
|
}
|
|
4868
4899
|
function v(i, c = !1) {
|
|
4869
|
-
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({
|
|
4870
4901
|
previewWithData: !1,
|
|
4871
4902
|
showMargins: !0
|
|
4872
4903
|
}), r.value = i) : y(!1));
|
|
@@ -4874,16 +4905,16 @@ function ei(e) {
|
|
|
4874
4905
|
function y(r) {
|
|
4875
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");
|
|
4876
4907
|
}
|
|
4877
|
-
function
|
|
4908
|
+
function x(e) {
|
|
4878
4909
|
o.value = e && t.value === "running" && c.value === "idle";
|
|
4879
4910
|
}
|
|
4880
|
-
function
|
|
4911
|
+
function S(e) {
|
|
4881
4912
|
s.value = e;
|
|
4882
4913
|
}
|
|
4883
|
-
function
|
|
4914
|
+
function C(e) {
|
|
4884
4915
|
c.value = e;
|
|
4885
4916
|
}
|
|
4886
|
-
function
|
|
4917
|
+
function w(e) {
|
|
4887
4918
|
l.value = Math.max(200, e);
|
|
4888
4919
|
}
|
|
4889
4920
|
return Ve(() => y(!1)), {
|
|
@@ -4902,95 +4933,115 @@ function ei(e) {
|
|
|
4902
4933
|
playing: o,
|
|
4903
4934
|
requestFinish: _,
|
|
4904
4935
|
seek: v,
|
|
4905
|
-
setExecuting:
|
|
4906
|
-
setInterval:
|
|
4907
|
-
setPlaying:
|
|
4908
|
-
setTransition:
|
|
4936
|
+
setExecuting: S,
|
|
4937
|
+
setInterval: w,
|
|
4938
|
+
setPlaying: x,
|
|
4939
|
+
setTransition: C,
|
|
4909
4940
|
start: h,
|
|
4910
4941
|
transition: c
|
|
4911
4942
|
};
|
|
4912
4943
|
})();
|
|
4913
4944
|
}
|
|
4914
4945
|
// src/designer/stores/ui-store.ts
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4946
|
+
var ai = "print-studio:theme-mode";
|
|
4947
|
+
function oi(e, t) {
|
|
4948
|
+
try {
|
|
4949
|
+
let t = e ? e.get(ai) : localStorage.getItem(ai);
|
|
4950
|
+
return t === "light" || t === "dark" || t === "system" ? t : "dark";
|
|
4951
|
+
} catch (e) {
|
|
4952
|
+
return t(e), "dark";
|
|
4953
|
+
}
|
|
4954
|
+
}
|
|
4955
|
+
function si(e) {
|
|
4956
|
+
return H("editor-ui", ({ action: t }) => {
|
|
4957
|
+
let n = W(e.persistPreferences === !1 ? "dark" : oi(e.preferenceStorage, e.capturePreferenceError));
|
|
4958
|
+
function r() {
|
|
4959
|
+
n.value = e.persistPreferences === !1 ? "dark" : oi(e.preferenceStorage, e.capturePreferenceError);
|
|
4960
|
+
}
|
|
4961
|
+
function i(t) {
|
|
4962
|
+
if (n.value = t, e.persistPreferences !== !1) try {
|
|
4963
|
+
e.preferenceStorage ? e.preferenceStorage.set(ai, t) : localStorage.setItem(ai, t);
|
|
4964
|
+
} catch (t) {
|
|
4965
|
+
e.capturePreferenceError(t);
|
|
4966
|
+
}
|
|
4967
|
+
}
|
|
4968
|
+
let a = W({
|
|
4918
4969
|
items: [],
|
|
4919
4970
|
open: !1,
|
|
4920
4971
|
x: 0,
|
|
4921
4972
|
y: 0
|
|
4922
|
-
}),
|
|
4923
|
-
function
|
|
4924
|
-
|
|
4973
|
+
}), o = W(null);
|
|
4974
|
+
function s(e) {
|
|
4975
|
+
o.value = {
|
|
4925
4976
|
completed: !1,
|
|
4926
4977
|
format: e,
|
|
4927
4978
|
minimized: !1
|
|
4928
4979
|
};
|
|
4929
4980
|
}
|
|
4930
|
-
function
|
|
4931
|
-
|
|
4981
|
+
function c(e) {
|
|
4982
|
+
o.value && (o.value.minimized = e);
|
|
4983
|
+
}
|
|
4984
|
+
function l() {
|
|
4985
|
+
o.value && (o.value.completed = !0);
|
|
4932
4986
|
}
|
|
4933
|
-
function
|
|
4934
|
-
|
|
4987
|
+
function u() {
|
|
4988
|
+
o.value = null;
|
|
4935
4989
|
}
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
elementId: d.value,
|
|
4944
|
-
elementIds: f.value,
|
|
4945
|
-
id: u.value
|
|
4990
|
+
let d = W({ name: null }), f = W([]), p = W(0), m = W(), h = W([]), g = 0, _ = U(() => function(e) {
|
|
4991
|
+
let t = f.value.filter((t) => t.dialog.name === e);
|
|
4992
|
+
return d.value.name === e && t.push({
|
|
4993
|
+
dialog: d.value,
|
|
4994
|
+
elementId: m.value,
|
|
4995
|
+
elementIds: h.value,
|
|
4996
|
+
id: p.value
|
|
4946
4997
|
}), t;
|
|
4947
|
-
}),
|
|
4948
|
-
function
|
|
4949
|
-
|
|
4998
|
+
}), v = W({}), y = W(0), b = W([]), x = /* @__PURE__ */ new Map();
|
|
4999
|
+
function S(e) {
|
|
5000
|
+
y.value += 1, v.value = e;
|
|
4950
5001
|
}
|
|
4951
5002
|
Ve(() => {
|
|
4952
|
-
for (let e of
|
|
4953
|
-
|
|
5003
|
+
for (let e of x.values()) clearTimeout(e);
|
|
5004
|
+
x.clear();
|
|
4954
5005
|
});
|
|
4955
|
-
function
|
|
5006
|
+
function C(e, t = "info") {
|
|
4956
5007
|
let n = Date.now() + Math.random();
|
|
4957
|
-
|
|
5008
|
+
b.value.push({
|
|
4958
5009
|
id: n,
|
|
4959
5010
|
kind: t,
|
|
4960
5011
|
text: e
|
|
4961
|
-
}),
|
|
5012
|
+
}), E(n);
|
|
4962
5013
|
}
|
|
4963
|
-
function
|
|
4964
|
-
clearTimeout(
|
|
5014
|
+
function w(e) {
|
|
5015
|
+
clearTimeout(x.get(e)), x.delete(e);
|
|
4965
5016
|
}
|
|
4966
|
-
function
|
|
4967
|
-
|
|
5017
|
+
function T(e) {
|
|
5018
|
+
w(e), b.value = b.value.filter((t) => t.id !== e);
|
|
4968
5019
|
}
|
|
4969
|
-
function
|
|
4970
|
-
|
|
4971
|
-
let t =
|
|
5020
|
+
function E(e) {
|
|
5021
|
+
w(e);
|
|
5022
|
+
let t = b.value.find((t) => t.id === e);
|
|
4972
5023
|
if (!t) return;
|
|
4973
5024
|
let n = setTimeout(() => {
|
|
4974
|
-
|
|
5025
|
+
T(e);
|
|
4975
5026
|
}, t.kind === "error" ? 8e3 : 5e3);
|
|
4976
|
-
|
|
5027
|
+
x.set(e, n);
|
|
4977
5028
|
}
|
|
4978
|
-
function
|
|
4979
|
-
|
|
4980
|
-
items:
|
|
5029
|
+
function D(e, t, n) {
|
|
5030
|
+
a.value = {
|
|
5031
|
+
items: n,
|
|
4981
5032
|
open: !0,
|
|
4982
5033
|
x: e,
|
|
4983
5034
|
y: t
|
|
4984
5035
|
};
|
|
4985
5036
|
}
|
|
4986
|
-
function
|
|
4987
|
-
|
|
4988
|
-
...
|
|
5037
|
+
function O() {
|
|
5038
|
+
a.value = {
|
|
5039
|
+
...a.value,
|
|
4989
5040
|
open: !1
|
|
4990
5041
|
};
|
|
4991
5042
|
}
|
|
4992
|
-
function
|
|
4993
|
-
|
|
5043
|
+
function k(t, n, r, i, a) {
|
|
5044
|
+
p.value = ++g, m.value = e.getElementId(), h.value = e.getElementIds?.() ?? [], d.value = {
|
|
4994
5045
|
groupId: r,
|
|
4995
5046
|
guideId: i,
|
|
4996
5047
|
name: t,
|
|
@@ -4998,114 +5049,117 @@ function ti(e) {
|
|
|
4998
5049
|
...a
|
|
4999
5050
|
};
|
|
5000
5051
|
}
|
|
5001
|
-
function
|
|
5002
|
-
if (!
|
|
5003
|
-
let e =
|
|
5004
|
-
return
|
|
5005
|
-
dialog: { ...
|
|
5006
|
-
elementId:
|
|
5007
|
-
elementIds:
|
|
5052
|
+
function A() {
|
|
5053
|
+
if (!d.value.name) return;
|
|
5054
|
+
let e = p.value;
|
|
5055
|
+
return f.value.push({
|
|
5056
|
+
dialog: { ...d.value },
|
|
5057
|
+
elementId: m.value,
|
|
5058
|
+
elementIds: h.value,
|
|
5008
5059
|
id: e
|
|
5009
|
-
}),
|
|
5060
|
+
}), d.value = { name: null }, e;
|
|
5010
5061
|
}
|
|
5011
|
-
function
|
|
5012
|
-
let n =
|
|
5062
|
+
function j(t) {
|
|
5063
|
+
let n = f.value.find((e) => e.id === t);
|
|
5013
5064
|
if (!n) return;
|
|
5014
|
-
|
|
5065
|
+
M(t);
|
|
5015
5066
|
let r = e.getElementIds?.() ?? [], i = n.elementId !== e.getElementId() || !(!n.elementIds?.length || n.elementIds.length === r.length && !n.elementIds.some((e) => !r.includes(e)));
|
|
5016
|
-
n.dialog.name === "element" && i || (
|
|
5067
|
+
n.dialog.name === "element" && i || (d.value = n.dialog, m.value = n.elementId, h.value = n.elementIds ?? [], p.value = n.id);
|
|
5017
5068
|
}
|
|
5018
|
-
let
|
|
5019
|
-
|
|
5069
|
+
let M = t((e) => {
|
|
5070
|
+
f.value = f.value.filter((t) => t.id !== e);
|
|
5020
5071
|
}, "discardSuspendedDialog");
|
|
5021
|
-
function
|
|
5022
|
-
|
|
5072
|
+
function N() {
|
|
5073
|
+
f.value = [];
|
|
5023
5074
|
}
|
|
5024
|
-
function
|
|
5025
|
-
|
|
5075
|
+
function P() {
|
|
5076
|
+
d.value = { name: null }, v.value = {};
|
|
5026
5077
|
}
|
|
5027
5078
|
return {
|
|
5028
|
-
activeDialog:
|
|
5029
|
-
clearSuspendedDialogs:
|
|
5030
|
-
closeContextMenu:
|
|
5031
|
-
closeDialog:
|
|
5032
|
-
completeExportDialog:
|
|
5033
|
-
contextMenu:
|
|
5034
|
-
dialogElementId:
|
|
5035
|
-
dialogSessionId:
|
|
5036
|
-
dialogSessions:
|
|
5037
|
-
discardSuspendedDialog:
|
|
5038
|
-
dismissToast:
|
|
5039
|
-
exportDialog:
|
|
5040
|
-
finishExportDialog:
|
|
5041
|
-
minimizeExportDialog:
|
|
5042
|
-
openContextMenu:
|
|
5043
|
-
openDialog:
|
|
5044
|
-
openExportDialog:
|
|
5045
|
-
pauseToast:
|
|
5046
|
-
restoredState:
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5079
|
+
activeDialog: d,
|
|
5080
|
+
clearSuspendedDialogs: N,
|
|
5081
|
+
closeContextMenu: O,
|
|
5082
|
+
closeDialog: P,
|
|
5083
|
+
completeExportDialog: l,
|
|
5084
|
+
contextMenu: a,
|
|
5085
|
+
dialogElementId: m,
|
|
5086
|
+
dialogSessionId: p,
|
|
5087
|
+
dialogSessions: _,
|
|
5088
|
+
discardSuspendedDialog: M,
|
|
5089
|
+
dismissToast: T,
|
|
5090
|
+
exportDialog: o,
|
|
5091
|
+
finishExportDialog: u,
|
|
5092
|
+
minimizeExportDialog: c,
|
|
5093
|
+
openContextMenu: D,
|
|
5094
|
+
openDialog: k,
|
|
5095
|
+
openExportDialog: s,
|
|
5096
|
+
pauseToast: w,
|
|
5097
|
+
restoredState: v,
|
|
5098
|
+
restorePreferences: r,
|
|
5099
|
+
restoreRevision: y,
|
|
5100
|
+
restoreState: S,
|
|
5101
|
+
resumeDialog: j,
|
|
5102
|
+
resumeToast: E,
|
|
5103
|
+
setThemeMode: i,
|
|
5104
|
+
suspendDialog: A,
|
|
5105
|
+
suspendedDialogs: f,
|
|
5106
|
+
themeMode: n,
|
|
5107
|
+
toast: C,
|
|
5108
|
+
toasts: b
|
|
5055
5109
|
};
|
|
5056
5110
|
})();
|
|
5057
5111
|
}
|
|
5058
5112
|
// src/designer/config/canvas-background.ts
|
|
5059
|
-
var
|
|
5113
|
+
var ci = [
|
|
5060
5114
|
{
|
|
5061
5115
|
color: "var(--color-canvas)",
|
|
5062
5116
|
id: "default",
|
|
5063
5117
|
get label() {
|
|
5064
|
-
return
|
|
5118
|
+
return g("designer.canvasBackground.defaultLabel");
|
|
5065
5119
|
}
|
|
5066
5120
|
},
|
|
5067
5121
|
{
|
|
5068
5122
|
color: "#000000",
|
|
5069
5123
|
id: "black",
|
|
5070
5124
|
get label() {
|
|
5071
|
-
return
|
|
5125
|
+
return g("designer.canvasBackground.blackLabel");
|
|
5072
5126
|
}
|
|
5073
5127
|
},
|
|
5074
5128
|
{
|
|
5075
5129
|
color: "#333333",
|
|
5076
5130
|
id: "dark-gray",
|
|
5077
5131
|
get label() {
|
|
5078
|
-
return
|
|
5132
|
+
return g("designer.canvasBackground.darkGrayLabel");
|
|
5079
5133
|
}
|
|
5080
5134
|
},
|
|
5081
5135
|
{
|
|
5082
5136
|
color: "#5e5e5e",
|
|
5083
5137
|
id: "medium-gray",
|
|
5084
5138
|
get label() {
|
|
5085
|
-
return
|
|
5139
|
+
return g("designer.canvasBackground.mediumGrayLabel");
|
|
5086
5140
|
}
|
|
5087
5141
|
},
|
|
5088
5142
|
{
|
|
5089
5143
|
color: "#a0a0a0",
|
|
5090
5144
|
id: "light-gray",
|
|
5091
5145
|
get label() {
|
|
5092
|
-
return
|
|
5146
|
+
return g("designer.canvasBackground.lightGrayLabel");
|
|
5093
5147
|
}
|
|
5094
5148
|
}
|
|
5095
|
-
],
|
|
5096
|
-
function
|
|
5097
|
-
return e === "custom" ||
|
|
5149
|
+
], li = "#4d4d4d";
|
|
5150
|
+
function ui(e) {
|
|
5151
|
+
return e === "custom" || ci.some((t) => t.id === e);
|
|
5098
5152
|
}
|
|
5099
5153
|
// src/designer/stores/view-store.ts
|
|
5100
|
-
function
|
|
5101
|
-
return
|
|
5102
|
-
let { layoutMode: t, pageGap: n, pages: r } = G(e.scope), i =
|
|
5154
|
+
function di(e) {
|
|
5155
|
+
return H("editor-view", () => {
|
|
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({
|
|
5103
5157
|
left: 0,
|
|
5104
5158
|
top: 0
|
|
5105
|
-
}), l =
|
|
5159
|
+
}), l = W({
|
|
5106
5160
|
height: 0,
|
|
5107
5161
|
width: 0
|
|
5108
|
-
}), u =
|
|
5162
|
+
}), u = W(null), d = W(null), f = W({
|
|
5109
5163
|
h: [],
|
|
5110
5164
|
pageId: "",
|
|
5111
5165
|
v: []
|
|
@@ -5150,23 +5204,23 @@ function ai(e) {
|
|
|
5150
5204
|
try {
|
|
5151
5205
|
let t = null;
|
|
5152
5206
|
if (e.persistPreferences !== !1 && (t = e.preferenceStorage ? e.preferenceStorage.get(x) : localStorage.getItem(x)), t) {
|
|
5153
|
-
let e = JSON.parse(t), n = typeof e.customColor == "string" && e.customColor.trim() !== "" ? e.customColor.trim() :
|
|
5154
|
-
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 {
|
|
5155
5209
|
customColor: n,
|
|
5156
5210
|
preset: e.preset
|
|
5157
5211
|
};
|
|
5158
5212
|
}
|
|
5159
5213
|
} catch {}
|
|
5160
5214
|
return {
|
|
5161
|
-
customColor:
|
|
5215
|
+
customColor: li,
|
|
5162
5216
|
preset: "default"
|
|
5163
5217
|
};
|
|
5164
5218
|
}
|
|
5165
|
-
let C =
|
|
5219
|
+
let C = W(S());
|
|
5166
5220
|
function w() {
|
|
5167
5221
|
C.value = S();
|
|
5168
5222
|
}
|
|
5169
|
-
let T =
|
|
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");
|
|
5170
5224
|
function O(t, n) {
|
|
5171
5225
|
if (C.value = {
|
|
5172
5226
|
customColor: t === "custom" ? n ?? C.value.customColor : C.value.customColor,
|
|
@@ -5178,7 +5232,7 @@ function ai(e) {
|
|
|
5178
5232
|
} catch {}
|
|
5179
5233
|
}
|
|
5180
5234
|
}
|
|
5181
|
-
let k =
|
|
5235
|
+
let k = U(() => 96 / 25.4 * i.value), A = U(() => {
|
|
5182
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);
|
|
5183
5237
|
if (i === "horizontal") {
|
|
5184
5238
|
let t = 500;
|
|
@@ -5211,10 +5265,29 @@ function ai(e) {
|
|
|
5211
5265
|
};
|
|
5212
5266
|
return s += e.height + 15, t;
|
|
5213
5267
|
});
|
|
5214
|
-
}), j =
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5268
|
+
}), j = U(() => A.value.map((e) => {
|
|
5269
|
+
let t = e.page.position;
|
|
5270
|
+
return t ? {
|
|
5271
|
+
...e,
|
|
5272
|
+
x: t.x,
|
|
5273
|
+
y: t.y
|
|
5274
|
+
} : e;
|
|
5275
|
+
})), M = U(() => new Map(j.value.map((e) => [e.page.id, e]))), N = U(() => function(e) {
|
|
5276
|
+
return M.value.get(e);
|
|
5277
|
+
}), P = U(() => function(e) {
|
|
5278
|
+
let t = M.value.get(e);
|
|
5279
|
+
return t ? {
|
|
5280
|
+
x: t.x,
|
|
5281
|
+
y: t.y
|
|
5282
|
+
} : void 0;
|
|
5283
|
+
}), ee = U(() => function(e, t) {
|
|
5284
|
+
let n = P.value(e);
|
|
5285
|
+
return n ? xn(n, t) : void 0;
|
|
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;
|
|
5218
5291
|
if (e.length === 0) return {
|
|
5219
5292
|
height: 1e3,
|
|
5220
5293
|
width: 1e3
|
|
@@ -5224,28 +5297,28 @@ function ai(e) {
|
|
|
5224
5297
|
height: Math.max(...e.map((e) => e.y + e.page.height)) + 500,
|
|
5225
5298
|
width: t + 500
|
|
5226
5299
|
};
|
|
5227
|
-
}),
|
|
5228
|
-
let e =
|
|
5229
|
-
return e.length === 0 ? null :
|
|
5300
|
+
}), re = U(() => {
|
|
5301
|
+
let e = j.value;
|
|
5302
|
+
return e.length === 0 ? null : be(e.map((e) => ({
|
|
5230
5303
|
height: e.page.height,
|
|
5231
5304
|
width: e.page.width,
|
|
5232
5305
|
x: e.x,
|
|
5233
5306
|
y: e.y
|
|
5234
5307
|
})));
|
|
5235
5308
|
});
|
|
5236
|
-
function
|
|
5309
|
+
function ie(t) {
|
|
5237
5310
|
a.value = t, t !== "select" && e.selection.setEditingId(null);
|
|
5238
5311
|
}
|
|
5239
|
-
function
|
|
5240
|
-
i.value =
|
|
5312
|
+
function F(e) {
|
|
5313
|
+
i.value = B(R(e, 4), .05, 8);
|
|
5241
5314
|
}
|
|
5242
|
-
function
|
|
5315
|
+
function ae(e) {
|
|
5243
5316
|
u.value = e;
|
|
5244
5317
|
}
|
|
5245
|
-
function
|
|
5318
|
+
function I(e) {
|
|
5246
5319
|
d.value = e;
|
|
5247
5320
|
}
|
|
5248
|
-
function
|
|
5321
|
+
function L(e) {
|
|
5249
5322
|
f.value = e;
|
|
5250
5323
|
}
|
|
5251
5324
|
return {
|
|
@@ -5253,30 +5326,33 @@ function ai(e) {
|
|
|
5253
5326
|
alignPanel: m,
|
|
5254
5327
|
canvasBackground: D,
|
|
5255
5328
|
canvasBackgroundPreset: T,
|
|
5256
|
-
contentSizeMm:
|
|
5329
|
+
contentSizeMm: ne,
|
|
5257
5330
|
cursorContent: s,
|
|
5258
5331
|
customCanvasColor: E,
|
|
5259
5332
|
draggingGuide: d,
|
|
5260
|
-
getLayout:
|
|
5333
|
+
getLayout: N,
|
|
5261
5334
|
marquee: u,
|
|
5262
|
-
|
|
5263
|
-
|
|
5335
|
+
originOf: P,
|
|
5336
|
+
pageLayouts: j,
|
|
5337
|
+
pagesBoundsMm: re,
|
|
5264
5338
|
pxPerMm: k,
|
|
5265
5339
|
restorePreferences: w,
|
|
5266
5340
|
scrollPos: c,
|
|
5267
5341
|
setCanvasBackground: O,
|
|
5268
5342
|
setCursorContent: v,
|
|
5269
|
-
setDraggingGuide:
|
|
5270
|
-
setMarquee:
|
|
5343
|
+
setDraggingGuide: I,
|
|
5344
|
+
setMarquee: ae,
|
|
5271
5345
|
setScrollPos: y,
|
|
5272
|
-
setSnapLines:
|
|
5346
|
+
setSnapLines: L,
|
|
5273
5347
|
setSpacePanning: _,
|
|
5274
5348
|
settings: p,
|
|
5275
|
-
setTool:
|
|
5349
|
+
setTool: ie,
|
|
5276
5350
|
setViewportSize: b,
|
|
5277
|
-
setZoom:
|
|
5351
|
+
setZoom: F,
|
|
5278
5352
|
snapLines: f,
|
|
5279
5353
|
spacePanning: o,
|
|
5354
|
+
toGlobal: te,
|
|
5355
|
+
toLocal: ee,
|
|
5280
5356
|
updateAlignPanel: g,
|
|
5281
5357
|
updateSettings: h,
|
|
5282
5358
|
viewportSize: l,
|
|
@@ -5285,19 +5361,19 @@ function ai(e) {
|
|
|
5285
5361
|
})();
|
|
5286
5362
|
}
|
|
5287
5363
|
// src/core/z-index.ts
|
|
5288
|
-
var
|
|
5289
|
-
function
|
|
5364
|
+
var fi = 2e3;
|
|
5365
|
+
function pi(e) {
|
|
5290
5366
|
if (!Number.isInteger(e) || e < 0 || e > 2147483647) throw Error(`Invalid z-index: ${e}`);
|
|
5291
5367
|
}
|
|
5292
|
-
function
|
|
5293
|
-
return
|
|
5368
|
+
function mi(e = fi) {
|
|
5369
|
+
return pi(e), {
|
|
5294
5370
|
currentZIndex: e,
|
|
5295
5371
|
entries: [],
|
|
5296
5372
|
initialZIndex: e,
|
|
5297
5373
|
sequence: 0
|
|
5298
5374
|
};
|
|
5299
5375
|
}
|
|
5300
|
-
var
|
|
5376
|
+
var hi = class {
|
|
5301
5377
|
state;
|
|
5302
5378
|
get currentZIndex() {
|
|
5303
5379
|
return this.state.currentZIndex;
|
|
@@ -5316,7 +5392,7 @@ var li = class {
|
|
|
5316
5392
|
this.state.entries = this.state.entries.filter((t) => t.id !== e);
|
|
5317
5393
|
}
|
|
5318
5394
|
configure(e) {
|
|
5319
|
-
|
|
5395
|
+
pi(e), this.state.initialZIndex = e, this.state.currentZIndex = Math.max(e, this.currentZIndex);
|
|
5320
5396
|
}
|
|
5321
5397
|
get(e) {
|
|
5322
5398
|
return this.state.entries.find((t) => t.id === e);
|
|
@@ -5327,11 +5403,11 @@ var li = class {
|
|
|
5327
5403
|
}
|
|
5328
5404
|
nextZIndex() {
|
|
5329
5405
|
let e = Math.max(this.initialZIndex, this.currentZIndex) + 1;
|
|
5330
|
-
return
|
|
5406
|
+
return pi(e), this.state.currentZIndex = e, e;
|
|
5331
5407
|
}
|
|
5332
5408
|
open(e = {}) {
|
|
5333
5409
|
let t = e.zIndex ?? this.nextZIndex();
|
|
5334
|
-
|
|
5410
|
+
pi(t), this.state.currentZIndex = Math.max(this.currentZIndex, t);
|
|
5335
5411
|
let n = ++this.state.sequence;
|
|
5336
5412
|
return this.state.entries.push({
|
|
5337
5413
|
id: n,
|
|
@@ -5341,9 +5417,9 @@ var li = class {
|
|
|
5341
5417
|
}
|
|
5342
5418
|
};
|
|
5343
5419
|
// src/designer/stores/z-index-store.ts
|
|
5344
|
-
function
|
|
5345
|
-
return
|
|
5346
|
-
let e = He(
|
|
5420
|
+
function gi() {
|
|
5421
|
+
return H("editor-z-index", () => {
|
|
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));
|
|
5347
5423
|
function o(e) {
|
|
5348
5424
|
t.configure(e);
|
|
5349
5425
|
}
|
|
@@ -5374,20 +5450,25 @@ function ui() {
|
|
|
5374
5450
|
})();
|
|
5375
5451
|
}
|
|
5376
5452
|
// src/designer/stores/editor-store.ts
|
|
5377
|
-
function
|
|
5378
|
-
return
|
|
5379
|
-
let t =
|
|
5453
|
+
function _i(e = {}) {
|
|
5454
|
+
return H("editor", () => {
|
|
5455
|
+
let t = ar(), n = Qr({
|
|
5380
5456
|
config: t,
|
|
5381
5457
|
elements: e.elements,
|
|
5382
5458
|
parsers: e.parsers
|
|
5383
|
-
}), r =
|
|
5459
|
+
}), r = si({
|
|
5460
|
+
capturePreferenceError(t) {
|
|
5461
|
+
(e.errors ?? cn()).capture(t, { source: "ui.preferences" });
|
|
5462
|
+
},
|
|
5384
5463
|
getElementId() {
|
|
5385
5464
|
return m.primary?.id;
|
|
5386
5465
|
},
|
|
5387
5466
|
getElementIds() {
|
|
5388
5467
|
return [...m.ids];
|
|
5389
|
-
}
|
|
5390
|
-
|
|
5468
|
+
},
|
|
5469
|
+
persistPreferences: e.persistPreferences,
|
|
5470
|
+
preferenceStorage: e.preferenceStorage
|
|
5471
|
+
}), i = Xr(e.persistPreferences, e.preferenceStorage), a = Zr(), o = gi(), s = yr({
|
|
5391
5472
|
...e,
|
|
5392
5473
|
beginPreviewHistory() {
|
|
5393
5474
|
c.beginPreview();
|
|
@@ -5403,7 +5484,7 @@ function di(e = {}) {
|
|
|
5403
5484
|
},
|
|
5404
5485
|
resetPreviewSession(e) {
|
|
5405
5486
|
let t = [...m.ids];
|
|
5406
|
-
e(),
|
|
5487
|
+
e(), _.cancelDraft(), v.reset(), h.setMarquee(null), h.setDraggingGuide(null), h.setSnapLines({
|
|
5407
5488
|
h: [],
|
|
5408
5489
|
pageId: "",
|
|
5409
5490
|
v: []
|
|
@@ -5413,7 +5494,7 @@ function di(e = {}) {
|
|
|
5413
5494
|
O(!0);
|
|
5414
5495
|
},
|
|
5415
5496
|
ui: r
|
|
5416
|
-
}), c =
|
|
5497
|
+
}), c = Ir({
|
|
5417
5498
|
applyLayout() {
|
|
5418
5499
|
l.apply();
|
|
5419
5500
|
},
|
|
@@ -5421,18 +5502,18 @@ function di(e = {}) {
|
|
|
5421
5502
|
resetSession() {
|
|
5422
5503
|
O(!1);
|
|
5423
5504
|
}
|
|
5424
|
-
}), l =
|
|
5505
|
+
}), l = Lr({ document: s }), u = zr({
|
|
5425
5506
|
document: s,
|
|
5426
5507
|
elements: e.elements,
|
|
5427
5508
|
history: c,
|
|
5428
5509
|
ui: r
|
|
5429
|
-
}), d =
|
|
5510
|
+
}), d = ri({
|
|
5430
5511
|
document: s,
|
|
5431
5512
|
elements: e.elements,
|
|
5432
5513
|
history: c,
|
|
5433
5514
|
page: u,
|
|
5434
5515
|
ui: r
|
|
5435
|
-
}), f =
|
|
5516
|
+
}), f = ei([{
|
|
5436
5517
|
activate: d.activatePage,
|
|
5437
5518
|
resolve() {
|
|
5438
5519
|
if (d.editingTemplate) return {
|
|
@@ -5453,19 +5534,19 @@ function di(e = {}) {
|
|
|
5453
5534
|
};
|
|
5454
5535
|
},
|
|
5455
5536
|
updatePage: u.update
|
|
5456
|
-
}]), p =
|
|
5537
|
+
}]), p = Pr({
|
|
5457
5538
|
history: c,
|
|
5458
5539
|
scope: f
|
|
5459
|
-
}), m =
|
|
5540
|
+
}), m = ni({
|
|
5460
5541
|
document: s,
|
|
5461
5542
|
guide: p,
|
|
5462
5543
|
scope: f
|
|
5463
|
-
}), h =
|
|
5544
|
+
}), h = di({
|
|
5464
5545
|
persistPreferences: e.persistPreferences,
|
|
5465
5546
|
preferenceStorage: e.preferenceStorage,
|
|
5466
5547
|
scope: f,
|
|
5467
5548
|
selection: m
|
|
5468
|
-
}),
|
|
5549
|
+
}), _ = Mr({
|
|
5469
5550
|
document: s,
|
|
5470
5551
|
elements: e.elements,
|
|
5471
5552
|
history: c,
|
|
@@ -5473,60 +5554,60 @@ function di(e = {}) {
|
|
|
5473
5554
|
scope: f,
|
|
5474
5555
|
selection: m,
|
|
5475
5556
|
ui: r
|
|
5476
|
-
}),
|
|
5557
|
+
}), v = br({
|
|
5477
5558
|
document: s,
|
|
5478
|
-
element:
|
|
5559
|
+
element: _,
|
|
5479
5560
|
history: c,
|
|
5480
5561
|
scope: f,
|
|
5481
5562
|
selection: m
|
|
5482
|
-
}),
|
|
5563
|
+
}), y = ir({
|
|
5483
5564
|
document: s,
|
|
5484
|
-
element:
|
|
5565
|
+
element: _,
|
|
5485
5566
|
elements: e.elements,
|
|
5486
5567
|
history: c,
|
|
5487
5568
|
scope: f,
|
|
5488
5569
|
selection: m,
|
|
5489
5570
|
ui: r
|
|
5490
|
-
}),
|
|
5571
|
+
}), b = or({
|
|
5491
5572
|
document: s,
|
|
5492
5573
|
history: c
|
|
5493
|
-
}),
|
|
5574
|
+
}), x = Nr({
|
|
5494
5575
|
document: s,
|
|
5495
5576
|
history: c,
|
|
5496
5577
|
selection: m,
|
|
5497
5578
|
ui: r
|
|
5498
|
-
}),
|
|
5579
|
+
}), S = $r({
|
|
5499
5580
|
document: s,
|
|
5500
|
-
element:
|
|
5581
|
+
element: _,
|
|
5501
5582
|
history: c,
|
|
5502
5583
|
page: u,
|
|
5503
5584
|
selection: m,
|
|
5504
5585
|
ui: r
|
|
5505
|
-
}), C =
|
|
5586
|
+
}), C = Qn({
|
|
5506
5587
|
document: s,
|
|
5507
5588
|
elements: e.elements,
|
|
5508
|
-
repeatGroup:
|
|
5589
|
+
repeatGroup: S,
|
|
5509
5590
|
scope: f,
|
|
5510
5591
|
template: d,
|
|
5511
5592
|
view: h
|
|
5512
|
-
}), w =
|
|
5593
|
+
}), w = Rr({
|
|
5513
5594
|
scope: f,
|
|
5514
5595
|
selection: m,
|
|
5515
5596
|
template: d,
|
|
5516
5597
|
ui: r
|
|
5517
|
-
}), T =
|
|
5598
|
+
}), T = W(null), E = ii({
|
|
5518
5599
|
beginSession() {
|
|
5519
|
-
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);
|
|
5520
5601
|
},
|
|
5521
|
-
dataSource:
|
|
5602
|
+
dataSource: b,
|
|
5522
5603
|
document: s,
|
|
5523
|
-
element:
|
|
5604
|
+
element: _,
|
|
5524
5605
|
finishSession(e) {
|
|
5525
5606
|
s.finishTemporary(e), c.finishTemporary(e);
|
|
5526
5607
|
let t = T.value;
|
|
5527
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;
|
|
5528
5609
|
},
|
|
5529
|
-
followBlock:
|
|
5610
|
+
followBlock: x,
|
|
5530
5611
|
page: u,
|
|
5531
5612
|
template: d,
|
|
5532
5613
|
ui: r,
|
|
@@ -5546,7 +5627,7 @@ function di(e = {}) {
|
|
|
5546
5627
|
function O(e) {
|
|
5547
5628
|
e && (w.reset(), r.closeDialog());
|
|
5548
5629
|
let t = d.editingId, n = f.active?.id;
|
|
5549
|
-
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({
|
|
5550
5631
|
h: [],
|
|
5551
5632
|
pageId: "",
|
|
5552
5633
|
v: []
|
|
@@ -5555,7 +5636,7 @@ function di(e = {}) {
|
|
|
5555
5636
|
(e || !i) && u.setActive(s.data.pages[0]?.id ?? "");
|
|
5556
5637
|
}
|
|
5557
5638
|
K(() => [f.id, ...f.pages.map((e) => e.id)], () => {
|
|
5558
|
-
m.reset(),
|
|
5639
|
+
m.reset(), _.cancelDraft(), h.setMarquee(null), h.setDraggingGuide(null), h.setSnapLines({
|
|
5559
5640
|
h: [],
|
|
5560
5641
|
pageId: "",
|
|
5561
5642
|
v: []
|
|
@@ -5566,13 +5647,13 @@ function di(e = {}) {
|
|
|
5566
5647
|
}, { flush: "sync" }), u.setActive(s.data.pages[0]?.id ?? ""), c.commit();
|
|
5567
5648
|
let k = {
|
|
5568
5649
|
canvas: C,
|
|
5569
|
-
clipboard:
|
|
5650
|
+
clipboard: y,
|
|
5570
5651
|
config: t,
|
|
5571
|
-
dataSource:
|
|
5652
|
+
dataSource: b,
|
|
5572
5653
|
document: s,
|
|
5573
|
-
element:
|
|
5574
|
-
elementGroup:
|
|
5575
|
-
followBlock:
|
|
5654
|
+
element: _,
|
|
5655
|
+
elementGroup: v,
|
|
5656
|
+
followBlock: x,
|
|
5576
5657
|
guide: p,
|
|
5577
5658
|
history: c,
|
|
5578
5659
|
layout: l,
|
|
@@ -5581,7 +5662,7 @@ function di(e = {}) {
|
|
|
5581
5662
|
panel: i,
|
|
5582
5663
|
plugin: a,
|
|
5583
5664
|
rendering: n,
|
|
5584
|
-
repeatGroup:
|
|
5665
|
+
repeatGroup: S,
|
|
5585
5666
|
scope: f,
|
|
5586
5667
|
selection: m,
|
|
5587
5668
|
template: d,
|
|
@@ -5595,7 +5676,7 @@ function di(e = {}) {
|
|
|
5595
5676
|
}), k;
|
|
5596
5677
|
});
|
|
5597
5678
|
}
|
|
5598
|
-
var
|
|
5679
|
+
var vi = _i(), yi = class {
|
|
5599
5680
|
providers = /* @__PURE__ */ new Map();
|
|
5600
5681
|
async collect() {
|
|
5601
5682
|
let e = this.list(), t = [], n = [], r = await Promise.all(e.map(async (e) => {
|
|
@@ -5636,108 +5717,111 @@ var fi = di(), pi = class {
|
|
|
5636
5717
|
n < 0 || (t.splice(n, 1), t.length === 0 && this.providers.delete(e.id));
|
|
5637
5718
|
};
|
|
5638
5719
|
}
|
|
5639
|
-
},
|
|
5640
|
-
bindEditorView: () =>
|
|
5641
|
-
disposeEditorView: () =>
|
|
5642
|
-
}),
|
|
5643
|
-
function
|
|
5644
|
-
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");
|
|
5645
5726
|
let n = e.root;
|
|
5646
|
-
return
|
|
5647
|
-
|
|
5727
|
+
return xi.set(e, t), e.root = t.root, () => {
|
|
5728
|
+
xi.get(e) === t && (xi.delete(e), e.root = n);
|
|
5648
5729
|
};
|
|
5649
5730
|
}
|
|
5650
|
-
function
|
|
5651
|
-
|
|
5731
|
+
function Ci(e) {
|
|
5732
|
+
xi.get(e)?.dispose();
|
|
5652
5733
|
}
|
|
5653
5734
|
// src/designer/context/editor-runtime.ts
|
|
5654
|
-
var
|
|
5655
|
-
EditorContextKey: () =>
|
|
5656
|
-
createEditorRuntime: () =>
|
|
5657
|
-
}),
|
|
5658
|
-
function
|
|
5659
|
-
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 ?? {
|
|
5660
5741
|
get: (e) => localStorage.getItem(e),
|
|
5661
5742
|
set: (e, t) => localStorage.setItem(e, t)
|
|
5662
|
-
} : void 0),
|
|
5743
|
+
} : void 0), d, f;
|
|
5663
5744
|
try {
|
|
5664
|
-
|
|
5665
|
-
let
|
|
5745
|
+
f = Kt();
|
|
5746
|
+
let t = p({
|
|
5747
|
+
...qt(e),
|
|
5748
|
+
builtinElements: Ee
|
|
5749
|
+
}), r = _i({
|
|
5666
5750
|
...e,
|
|
5667
|
-
...
|
|
5668
|
-
errors:
|
|
5751
|
+
...t,
|
|
5752
|
+
errors: o,
|
|
5669
5753
|
persistPreferences: !0,
|
|
5670
|
-
preferenceStorage:
|
|
5754
|
+
preferenceStorage: u,
|
|
5671
5755
|
storage: e.storage ?? !1
|
|
5672
|
-
})(
|
|
5673
|
-
vn(
|
|
5674
|
-
let
|
|
5675
|
-
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),
|
|
5676
5760
|
dispose() {
|
|
5677
|
-
|
|
5761
|
+
l ||= (Ci(m), m.plugins.close(), f?.(), s.dispose(), a.offAll(), Ie(i), !0);
|
|
5678
5762
|
},
|
|
5679
|
-
elements:
|
|
5680
|
-
errors:
|
|
5681
|
-
events:
|
|
5682
|
-
extensions:
|
|
5763
|
+
elements: t.elements,
|
|
5764
|
+
errors: o,
|
|
5765
|
+
events: a,
|
|
5766
|
+
extensions: c,
|
|
5683
5767
|
getSelection() {
|
|
5684
5768
|
return {
|
|
5685
|
-
bounds:
|
|
5686
|
-
ids: [...
|
|
5687
|
-
nodes:
|
|
5688
|
-
primary:
|
|
5769
|
+
bounds: r.selection.bounds,
|
|
5770
|
+
ids: [...r.selection.ids],
|
|
5771
|
+
nodes: r.selection.nodes,
|
|
5772
|
+
primary: r.selection.primary
|
|
5689
5773
|
};
|
|
5690
5774
|
},
|
|
5691
|
-
output:
|
|
5692
|
-
parsers:
|
|
5693
|
-
plugins: new rn(() =>
|
|
5694
|
-
preferences:
|
|
5775
|
+
output: s,
|
|
5776
|
+
parsers: t.parsers,
|
|
5777
|
+
plugins: new rn(() => m, e.pluginPolicy),
|
|
5778
|
+
preferences: u,
|
|
5695
5779
|
store() {
|
|
5696
|
-
if (
|
|
5697
|
-
return
|
|
5780
|
+
if (l) throw Error("Designer has been disposed");
|
|
5781
|
+
return r;
|
|
5698
5782
|
},
|
|
5699
|
-
templateLibrary: new
|
|
5783
|
+
templateLibrary: new yi(),
|
|
5700
5784
|
get use() {
|
|
5701
|
-
return
|
|
5785
|
+
return m.plugins.use.bind(m.plugins);
|
|
5702
5786
|
},
|
|
5703
5787
|
get zIndex() {
|
|
5704
|
-
return
|
|
5788
|
+
return r.zIndex;
|
|
5705
5789
|
}
|
|
5706
5790
|
};
|
|
5707
|
-
return
|
|
5791
|
+
return d = m, vt(m), n?.(m), m;
|
|
5708
5792
|
} catch (e) {
|
|
5709
|
-
throw
|
|
5793
|
+
throw d ? d.dispose?.() : (f?.(), s.dispose(), a.offAll(), Ie(i)), e;
|
|
5710
5794
|
} finally {
|
|
5711
|
-
Re(
|
|
5795
|
+
Re(r);
|
|
5712
5796
|
}
|
|
5713
5797
|
}
|
|
5714
5798
|
// src/designer/facade/bindings.ts
|
|
5715
|
-
var
|
|
5716
|
-
bindStudioContext: () =>
|
|
5717
|
-
getStudioContext: () =>
|
|
5718
|
-
onStudioDispose: () =>
|
|
5719
|
-
unbindStudioContext: () =>
|
|
5720
|
-
}),
|
|
5721
|
-
function
|
|
5722
|
-
|
|
5723
|
-
let n =
|
|
5724
|
-
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), () => {
|
|
5725
5809
|
n.delete(t);
|
|
5726
5810
|
};
|
|
5727
5811
|
}
|
|
5728
|
-
function
|
|
5729
|
-
|
|
5812
|
+
function ji(e, t) {
|
|
5813
|
+
Oi.set(e, t);
|
|
5730
5814
|
}
|
|
5731
|
-
function
|
|
5732
|
-
let t =
|
|
5815
|
+
function Mi(e) {
|
|
5816
|
+
let t = Oi.get(e);
|
|
5733
5817
|
if (!t) throw Error("Unknown print studio instance");
|
|
5734
5818
|
return t.store(), t;
|
|
5735
5819
|
}
|
|
5736
|
-
function
|
|
5737
|
-
let t =
|
|
5738
|
-
|
|
5820
|
+
function Ni(e) {
|
|
5821
|
+
let t = ki.get(e);
|
|
5822
|
+
ki.delete(e);
|
|
5739
5823
|
for (let e of t ?? []) e();
|
|
5740
|
-
|
|
5824
|
+
Oi.delete(e);
|
|
5741
5825
|
}
|
|
5742
5826
|
// src/designer/facade/entities.ts
|
|
5743
5827
|
function Q(e) {
|
|
@@ -5747,7 +5831,7 @@ function Q(e) {
|
|
|
5747
5831
|
function $(e) {
|
|
5748
5832
|
return typeof e == "string" ? e : e.id;
|
|
5749
5833
|
}
|
|
5750
|
-
function
|
|
5834
|
+
function Pi(e) {
|
|
5751
5835
|
let t = !1, n = 0;
|
|
5752
5836
|
function r() {
|
|
5753
5837
|
if (t) throw Error("Print studio facade has been disposed");
|
|
@@ -5779,7 +5863,7 @@ function Oi(e) {
|
|
|
5779
5863
|
store: r
|
|
5780
5864
|
};
|
|
5781
5865
|
}
|
|
5782
|
-
function
|
|
5866
|
+
function Fi(e, t, n) {
|
|
5783
5867
|
function r(t) {
|
|
5784
5868
|
return e.store(), n.list().find((e) => e.id === $(t));
|
|
5785
5869
|
}
|
|
@@ -5790,7 +5874,7 @@ function ki(e, t, n) {
|
|
|
5790
5874
|
}
|
|
5791
5875
|
function a(r, a) {
|
|
5792
5876
|
e.run(`${t}.update`, () => {
|
|
5793
|
-
i(r), n.update($(r),
|
|
5877
|
+
i(r), n.update($(r), b(a));
|
|
5794
5878
|
});
|
|
5795
5879
|
}
|
|
5796
5880
|
function o(i) {
|
|
@@ -5803,7 +5887,7 @@ function ki(e, t, n) {
|
|
|
5803
5887
|
return {
|
|
5804
5888
|
get data() {
|
|
5805
5889
|
let e = r(t);
|
|
5806
|
-
return e ?
|
|
5890
|
+
return e ? b(e) : void 0;
|
|
5807
5891
|
},
|
|
5808
5892
|
id: t,
|
|
5809
5893
|
remove() {
|
|
@@ -5826,21 +5910,14 @@ function ki(e, t, n) {
|
|
|
5826
5910
|
};
|
|
5827
5911
|
}
|
|
5828
5912
|
// src/designer/facade/editing.ts
|
|
5829
|
-
|
|
5830
|
-
h: "hcenter",
|
|
5831
|
-
v: "vcenter"
|
|
5832
|
-
};
|
|
5833
|
-
function ji(e) {
|
|
5913
|
+
function Ii(e) {
|
|
5834
5914
|
return {
|
|
5835
5915
|
edit: {
|
|
5836
5916
|
align: (t, n) => e.command("element.align", t, n),
|
|
5837
5917
|
copy: () => e.command("edit.copy"),
|
|
5838
5918
|
cut: () => e.command("edit.cut"),
|
|
5839
5919
|
delete: () => e.command("edit.delete"),
|
|
5840
|
-
distribute: (t, n) =>
|
|
5841
|
-
let r = Ai[t] ?? t;
|
|
5842
|
-
return e.command("element.distribute", r, n);
|
|
5843
|
-
},
|
|
5920
|
+
distribute: (t, n) => e.command("element.distribute", t, n),
|
|
5844
5921
|
distributeSpacing: (t, n) => e.command("element.distributeSpacing", t, n),
|
|
5845
5922
|
duplicate: () => e.command("edit.duplicate"),
|
|
5846
5923
|
nudge: (t, n) => e.command("element.nudge", t, n),
|
|
@@ -5855,20 +5932,20 @@ function ji(e) {
|
|
|
5855
5932
|
return [...e.store().selection.ids];
|
|
5856
5933
|
},
|
|
5857
5934
|
get nodes() {
|
|
5858
|
-
return
|
|
5935
|
+
return b(e.store().selection.nodes);
|
|
5859
5936
|
},
|
|
5860
5937
|
set: (t) => e.command("selection.set", t.map($))
|
|
5861
5938
|
}
|
|
5862
5939
|
};
|
|
5863
5940
|
}
|
|
5864
5941
|
// src/designer/facade/elements.ts
|
|
5865
|
-
function
|
|
5942
|
+
function Li(e, t, n) {
|
|
5866
5943
|
function r(n) {
|
|
5867
5944
|
let r = $(n);
|
|
5868
5945
|
if (!e.store().element.getByPage(t).some((e) => e.id === r)) throw Error(`Element not found on page ${t}: ${r}`);
|
|
5869
5946
|
return r;
|
|
5870
5947
|
}
|
|
5871
|
-
let i =
|
|
5948
|
+
let i = Fi(e, "element", {
|
|
5872
5949
|
list: () => e.store().element.getByPage(t),
|
|
5873
5950
|
remove: (t) => e.command("element.removeIds", [t]),
|
|
5874
5951
|
update: (t, n) => e.command("element.update", t, n)
|
|
@@ -5877,7 +5954,7 @@ function Mi(e, t, n) {
|
|
|
5877
5954
|
return e.run("element.add", () => {
|
|
5878
5955
|
let a = e.store();
|
|
5879
5956
|
if (r.id && a.element.get(r.id)) throw Error(`Element already exists: ${r.id}`);
|
|
5880
|
-
let o = e.command("element.add", r.type ?? n,
|
|
5957
|
+
let o = e.command("element.add", r.type ?? n, b(r), t);
|
|
5881
5958
|
if (!o) throw Error(`Page not found: ${t}`);
|
|
5882
5959
|
return Q(i.get(o));
|
|
5883
5960
|
});
|
|
@@ -5918,18 +5995,18 @@ function Mi(e, t, n) {
|
|
|
5918
5995
|
},
|
|
5919
5996
|
update(t, n, i) {
|
|
5920
5997
|
e.run("element.update", () => {
|
|
5921
|
-
e.command("element.update", r(t),
|
|
5998
|
+
e.command("element.update", r(t), b(n), i);
|
|
5922
5999
|
});
|
|
5923
6000
|
},
|
|
5924
6001
|
updateProps(t, n, i) {
|
|
5925
6002
|
e.run("element.updateProps", () => {
|
|
5926
|
-
e.command("element.updateProps", r(t),
|
|
6003
|
+
e.command("element.updateProps", r(t), b(n), i);
|
|
5927
6004
|
});
|
|
5928
6005
|
}
|
|
5929
6006
|
};
|
|
5930
6007
|
}
|
|
5931
6008
|
// src/designer/facade/output.ts
|
|
5932
|
-
function
|
|
6009
|
+
function Ri(e) {
|
|
5933
6010
|
function t(t, n, r) {
|
|
5934
6011
|
return e.command("output.html", t, n, r);
|
|
5935
6012
|
}
|
|
@@ -5949,8 +6026,8 @@ function Ni(e) {
|
|
|
5949
6026
|
};
|
|
5950
6027
|
}
|
|
5951
6028
|
// src/designer/facade/pages.ts
|
|
5952
|
-
function
|
|
5953
|
-
let n =
|
|
6029
|
+
function zi(e, t) {
|
|
6030
|
+
let n = Fi(e, "page", {
|
|
5954
6031
|
list: () => e.store().page.list,
|
|
5955
6032
|
remove: (t) => e.command("page.remove", t),
|
|
5956
6033
|
update: (t, n) => e.command("page.update", t, n)
|
|
@@ -5961,14 +6038,14 @@ function Pi(e, t) {
|
|
|
5961
6038
|
get data() {
|
|
5962
6039
|
return i.data;
|
|
5963
6040
|
},
|
|
5964
|
-
elements:
|
|
6041
|
+
elements: Li(e, i.id, t),
|
|
5965
6042
|
id: i.id,
|
|
5966
6043
|
remove: i.remove,
|
|
5967
6044
|
update: i.update
|
|
5968
6045
|
};
|
|
5969
6046
|
}
|
|
5970
6047
|
function i(t = {}) {
|
|
5971
|
-
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)))));
|
|
5972
6049
|
}
|
|
5973
6050
|
return {
|
|
5974
6051
|
get active() {
|
|
@@ -5994,8 +6071,8 @@ function Pi(e, t) {
|
|
|
5994
6071
|
};
|
|
5995
6072
|
}
|
|
5996
6073
|
// src/designer/facade/state.ts
|
|
5997
|
-
function
|
|
5998
|
-
let n = t.store(), r = /* @__PURE__ */ new Set(), i =
|
|
6074
|
+
function Bi(e, t) {
|
|
6075
|
+
let n = t.store(), r = /* @__PURE__ */ new Set(), i = U(() => Object.freeze({
|
|
5999
6076
|
activePageId: n.page.active?.id,
|
|
6000
6077
|
canRedo: n.history.canRedo,
|
|
6001
6078
|
canUndo: n.history.canUndo,
|
|
@@ -6028,12 +6105,12 @@ function Fi(e, t) {
|
|
|
6028
6105
|
};
|
|
6029
6106
|
}
|
|
6030
6107
|
// src/designer/facade/print-studio.ts
|
|
6031
|
-
function
|
|
6032
|
-
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", {
|
|
6033
6110
|
list: () => s.store().template.list,
|
|
6034
6111
|
remove: (e) => s.command("template.remove", e),
|
|
6035
6112
|
update: (e, t) => s.command("template.update", e, t)
|
|
6036
|
-
}), f =
|
|
6113
|
+
}), f = Fi(s, "repeatGroup", {
|
|
6037
6114
|
list: () => s.store().repeatGroup.list,
|
|
6038
6115
|
remove: (e) => s.command("repeatGroup.remove", e),
|
|
6039
6116
|
update: (e, t) => {
|
|
@@ -6049,7 +6126,7 @@ function Ii(e, t = {}, n) {
|
|
|
6049
6126
|
if (t && t.id !== n) throw Error(`Element already belongs to repeat group: ${a}`);
|
|
6050
6127
|
}
|
|
6051
6128
|
}
|
|
6052
|
-
let m =
|
|
6129
|
+
let m = Fi(s, "followBlock", {
|
|
6053
6130
|
list: () => s.store().followBlock.list,
|
|
6054
6131
|
remove: (e) => s.command("followBlock.remove", e),
|
|
6055
6132
|
update: (e, t) => {
|
|
@@ -6067,12 +6144,12 @@ function Ii(e, t = {}, n) {
|
|
|
6067
6144
|
return {
|
|
6068
6145
|
get data() {
|
|
6069
6146
|
let e = s.store().template.getByPage(i), t = e?.page.id === i ? e.page : e?.evenPage;
|
|
6070
|
-
return t ?
|
|
6147
|
+
return t ? b(t) : void 0;
|
|
6071
6148
|
},
|
|
6072
|
-
elements:
|
|
6149
|
+
elements: Li(s, i, l),
|
|
6073
6150
|
id: i,
|
|
6074
6151
|
update(e) {
|
|
6075
|
-
s.run("template.updatePage", () => s.command("template.updatePage", i,
|
|
6152
|
+
s.run("template.updatePage", () => s.command("template.updatePage", i, b(e)));
|
|
6076
6153
|
}
|
|
6077
6154
|
};
|
|
6078
6155
|
}
|
|
@@ -6094,43 +6171,43 @@ function Ii(e, t = {}, n) {
|
|
|
6094
6171
|
};
|
|
6095
6172
|
}
|
|
6096
6173
|
function _() {
|
|
6097
|
-
r || (r = !0, v(), c.dispose(), s.dispose(),
|
|
6174
|
+
r || (r = !0, v(), c.dispose(), s.dispose(), Ni(S), n?.());
|
|
6098
6175
|
}
|
|
6099
6176
|
function v(e = i) {
|
|
6100
6177
|
!e && a ? o = !0 : (e?.unmount(), i === e && (i = void 0));
|
|
6101
6178
|
}
|
|
6102
6179
|
async function y(e) {
|
|
6103
6180
|
if (r) throw Error("Print studio has been disposed");
|
|
6104
|
-
if (a ||
|
|
6105
|
-
let t =
|
|
6181
|
+
if (a || Mi(S).root) throw Error("A designer is already mounted for this studio");
|
|
6182
|
+
let t = x(e.el);
|
|
6106
6183
|
a = !0;
|
|
6107
6184
|
try {
|
|
6108
|
-
let {
|
|
6185
|
+
let { attachDesigner: n } = await import("./mount-print-designer-CAqO0T0k.js").then((e) => e.n);
|
|
6109
6186
|
if (r) throw Error("Print studio has been disposed");
|
|
6110
6187
|
if (o) throw new DOMException("Designer unmounted before ready", "AbortError");
|
|
6111
6188
|
let s = n(t, {
|
|
6112
6189
|
...e,
|
|
6113
|
-
studio:
|
|
6190
|
+
studio: S
|
|
6114
6191
|
});
|
|
6115
6192
|
i = s, await s.ready, a = !1;
|
|
6116
6193
|
} catch (e) {
|
|
6117
6194
|
throw a = !1, o = !1, v(), e;
|
|
6118
6195
|
}
|
|
6119
6196
|
}
|
|
6120
|
-
function
|
|
6197
|
+
function x(e) {
|
|
6121
6198
|
if (typeof document > "u") throw Error("A designer requires an HTML container in a browser");
|
|
6122
6199
|
let t = typeof e == "string" ? document.querySelector(e) : e;
|
|
6123
6200
|
if (!(t instanceof HTMLElement)) throw Error(`Designer mount target not found: ${e}`);
|
|
6124
6201
|
return t;
|
|
6125
6202
|
}
|
|
6126
|
-
let
|
|
6203
|
+
let S = {
|
|
6127
6204
|
dataSource: {
|
|
6128
|
-
get: (e) =>
|
|
6205
|
+
get: (e) => b(s.store().dataSource.get(typeof e == "string" ? e : e.key)),
|
|
6129
6206
|
get list() {
|
|
6130
|
-
return
|
|
6207
|
+
return b(s.store().dataSource.list);
|
|
6131
6208
|
},
|
|
6132
6209
|
remove: (e) => s.run("dataSource.remove", () => s.command("dataSource.remove", typeof e == "string" ? e : e.key)),
|
|
6133
|
-
upsert: (...e) => s.run("dataSource.upsert", () => s.command("dataSource.upsert", ...
|
|
6210
|
+
upsert: (...e) => s.run("dataSource.upsert", () => s.command("dataSource.upsert", ...b(e)))
|
|
6134
6211
|
},
|
|
6135
6212
|
dispose: _,
|
|
6136
6213
|
document: {
|
|
@@ -6151,7 +6228,7 @@ function Ii(e, t = {}, n) {
|
|
|
6151
6228
|
followBlock: {
|
|
6152
6229
|
create(e) {
|
|
6153
6230
|
return s.run("followBlock.create", () => {
|
|
6154
|
-
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);
|
|
6155
6232
|
return t ? m.get(t) : void 0;
|
|
6156
6233
|
});
|
|
6157
6234
|
},
|
|
@@ -6191,7 +6268,7 @@ function Ii(e, t = {}, n) {
|
|
|
6191
6268
|
return s.run("repeatGroup.create", () => {
|
|
6192
6269
|
let { elementIds: t, pageId: n, ...r } = e;
|
|
6193
6270
|
p(n, t);
|
|
6194
|
-
let i = s.command("repeatGroup.create", n, [...t],
|
|
6271
|
+
let i = s.command("repeatGroup.create", n, [...t], b(r));
|
|
6195
6272
|
return i ? f.get(i) : void 0;
|
|
6196
6273
|
});
|
|
6197
6274
|
},
|
|
@@ -6227,18 +6304,18 @@ function Ii(e, t = {}, n) {
|
|
|
6227
6304
|
},
|
|
6228
6305
|
unmount: () => v(),
|
|
6229
6306
|
use: e.plugins.use.bind(e.plugins),
|
|
6230
|
-
...
|
|
6231
|
-
...
|
|
6307
|
+
...Ri(s),
|
|
6308
|
+
...Ii(s)
|
|
6232
6309
|
};
|
|
6233
|
-
return
|
|
6310
|
+
return ji(S, e), Be(S);
|
|
6234
6311
|
}
|
|
6235
6312
|
// src/studio.ts
|
|
6236
|
-
function
|
|
6237
|
-
let t =
|
|
6313
|
+
function Hi(e = {}) {
|
|
6314
|
+
let t = Ei(e);
|
|
6238
6315
|
try {
|
|
6239
|
-
return
|
|
6316
|
+
return Vi(t, e, () => t.dispose?.());
|
|
6240
6317
|
} catch (e) {
|
|
6241
6318
|
throw t.dispose?.(), e;
|
|
6242
6319
|
}
|
|
6243
6320
|
}
|
|
6244
|
-
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 };
|