@printstack/print-studio 0.1.1 → 0.1.2
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 +121 -160
- package/assets/render.worker-DkH7TepL.js +109 -0
- package/{cloneDeep-PCw2ErRl.js → cloneDeep-waBDTGc3.js} +9 -4
- 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/page-extensions.d.ts +1 -1
- package/core/types.d.ts +8 -0
- package/core.js +2 -2
- 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 +1156 -22
- 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 +770 -14
- package/designer/stores/page-store.d.ts +25 -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/{document-model-GhFP9OGp.js → document-model-Cc5RoO4j.js} +160 -179
- package/elements/table/table-style.d.ts +3 -10
- package/host-OAp3gFDx.js +123 -0
- package/index.js +5 -5
- 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-DnHTrBE9.js} +4 -4
- package/{mount-print-preview-D7M-1AqH.js → mount-print-preview-Bcb08lJ-.js} +4 -3
- package/package.json +1 -1
- package/{presets-D3WhkbZK.js → presets-BunYODhE.js} +2 -2
- package/{registries-dZq8MewR.js → registries-sg39PGF1.js} +767 -780
- package/runtime.js +2 -2
- package/{saas-B1H161e1.js → saas-D-q51uTz.js} +1 -1
- package/saas.js +1 -1
- package/{studio-BFQYHZsg.js → studio-B3B6zI06.js} +796 -722
- package/studio-types.d.ts +1 -1
- package/style.css +1 -1
- package/vue.js +786 -693
- package/assets/render.worker-Ch4qWx3S.js +0 -109
- package/host-CuGR8rD6.js +0 -123
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as e } from "./rolldown-runtime-QGRDbDUS.js";
|
|
2
|
-
import { A as t, B as n, D as r, G as i, J as a, K as o, N as s, O as c, P as l, Q as u, U as d, W as f, Y as p, Z as m, k as h, n as g, q as _, r as v, t as y, z as b } from "./registries-
|
|
3
|
-
import { A as x, B as S, N as C, P as w, R as T, t as E } from "./cloneDeep-
|
|
4
|
-
import { $ as D, A as O, B as k, D as A, E as j, G as M, I as N, L as ee, M as
|
|
5
|
-
import { createPinia as
|
|
6
|
-
import { computed as
|
|
2
|
+
import { A as t, B as n, D as r, G as i, J as a, K as o, N as s, O as c, P as l, Q as u, U as d, W as f, Y as p, Z as m, k as h, n as g, q as _, r as v, t as y, z as b } from "./registries-sg39PGF1.js";
|
|
3
|
+
import { A as x, B as S, N as C, P as w, R as T, t as E } from "./cloneDeep-waBDTGc3.js";
|
|
4
|
+
import { $ as D, A as O, B as k, D as A, E as j, G as M, I as N, L as ee, M as P, N as te, O as ne, P as re, Q as F, T as I, Z as ie, _ as ae, a as oe, at as L, c as se, ct as ce, d as le, dt as ue, et as de, f as fe, ft as pe, g as me, h as R, ht as he, i as ge, j as _e, l as z, lt as ve, m as ye, mt as be, o as xe, ot as Se, p as B, pt as Ce, r as we, s as Te, st as Ee, t as De, tt as V, u as Oe, ut as ke, v as Ae, x as je, y as Me, z as Ne } from "./document-model-Cc5RoO4j.js";
|
|
5
|
+
import { createPinia as Pe, defineStore as H, disposePinia as Fe, getActivePinia as Ie, setActivePinia as Le } from "pinia";
|
|
6
|
+
import { computed as U, hasInjectionContext as Re, markRaw as ze, onScopeDispose as Be, reactive as Ve, ref as W, shallowReactive as He, shallowRef as Ue, toRefs as G, watch as K } from "vue";
|
|
7
7
|
// node_modules/.pnpm/mitt@3.0.1/node_modules/mitt/dist/mitt.mjs
|
|
8
8
|
function We(e) {
|
|
9
9
|
return {
|
|
@@ -62,7 +62,7 @@ var Je = class {
|
|
|
62
62
|
bus;
|
|
63
63
|
commands = /* @__PURE__ */ new Map();
|
|
64
64
|
getContext;
|
|
65
|
-
version =
|
|
65
|
+
version = Ue(0);
|
|
66
66
|
constructor(e, t = qe()) {
|
|
67
67
|
this.getContext = e, this.bus = t;
|
|
68
68
|
}
|
|
@@ -280,7 +280,7 @@ function Xe(e, t = !1) {
|
|
|
280
280
|
let t = {
|
|
281
281
|
document: n.document.getDocument(),
|
|
282
282
|
input: E(r ?? w(n.document.data))
|
|
283
|
-
}, { mountPrintPreview: a } = await import("./mount-print-preview-
|
|
283
|
+
}, { mountPrintPreview: a } = await import("./mount-print-preview-Bcb08lJ-.js");
|
|
284
284
|
return a(e, t, i);
|
|
285
285
|
}
|
|
286
286
|
return p(n.rendering, e.output, () => {
|
|
@@ -752,7 +752,7 @@ var vt = {
|
|
|
752
752
|
}, yt = "1.0", bt = class {
|
|
753
753
|
#e = /* @__PURE__ */ new Map();
|
|
754
754
|
#t = /* @__PURE__ */ new Map();
|
|
755
|
-
#n =
|
|
755
|
+
#n = Ue(0);
|
|
756
756
|
contribute(e, t) {
|
|
757
757
|
e.signal.throwIfAborted();
|
|
758
758
|
let n = this.#t.get(t.point);
|
|
@@ -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() {
|
|
@@ -1450,20 +1450,7 @@ var en = class {
|
|
|
1450
1450
|
function tn(e) {
|
|
1451
1451
|
return !!e && typeof e == "object" && "then" in e;
|
|
1452
1452
|
}
|
|
1453
|
-
|
|
1454
|
-
return "manifest" in e && e.manifest ? e.manifest : {
|
|
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
|
-
};
|
|
1465
|
-
}
|
|
1466
|
-
var rn = class {
|
|
1453
|
+
var nn = class {
|
|
1467
1454
|
getContext;
|
|
1468
1455
|
policy;
|
|
1469
1456
|
#e = !1;
|
|
@@ -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,7 +1543,7 @@ 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);
|
|
@@ -1575,7 +1557,7 @@ 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);
|
|
@@ -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($t(this.getContext(), e.manifest, t)) : "manifest" in r ? r.setup($t(this.getContext(), e.manifest, t)) : r.setup(this.
|
|
1578
|
+
if (i = typeof r == "function" ? r($t(this.getContext(), e.manifest, t)) : "manifest" in r ? r.setup($t(this.getContext(), e.manifest, t)) : r.setup(this.createHostContext(t)), tn(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
|
}
|
|
@@ -1682,16 +1677,16 @@ var rn = class {
|
|
|
1682
1677
|
for (let t of e.permissions ?? []) if (!this.policy.permissions.includes(t)) throw Error(`Host denied permission ${t} for ${e.id}`);
|
|
1683
1678
|
}
|
|
1684
1679
|
}
|
|
1685
|
-
},
|
|
1686
|
-
function
|
|
1687
|
-
return
|
|
1680
|
+
}, rn = 2e3, an = "designer.errorHandling.unexpectedErrorMessage", on = null;
|
|
1681
|
+
function sn() {
|
|
1682
|
+
return on ||= m({ report: cn }), on;
|
|
1688
1683
|
}
|
|
1689
|
-
function
|
|
1690
|
-
function
|
|
1684
|
+
function cn(e, t) {}
|
|
1685
|
+
function ln(e) {
|
|
1691
1686
|
let t = /* @__PURE__ */ new Map();
|
|
1692
1687
|
function n(e, n) {
|
|
1693
1688
|
let r = t.get(e);
|
|
1694
|
-
return r !== void 0 && n - r <
|
|
1689
|
+
return r !== void 0 && n - r < rn ? !1 : (t.set(e, n), !0);
|
|
1695
1690
|
}
|
|
1696
1691
|
return {
|
|
1697
1692
|
handle: async function(t) {
|
|
@@ -1711,12 +1706,12 @@ function un(e) {
|
|
|
1711
1706
|
}
|
|
1712
1707
|
};
|
|
1713
1708
|
}
|
|
1714
|
-
function
|
|
1709
|
+
function un(e) {
|
|
1715
1710
|
let t = 0;
|
|
1716
1711
|
return {
|
|
1717
1712
|
handle: async function() {
|
|
1718
1713
|
let n = Date.now();
|
|
1719
|
-
return n - t >=
|
|
1714
|
+
return n - t >= rn && (t = n, e.store().ui.toast(S(an), "error")), {
|
|
1720
1715
|
code: "unexpected-toast",
|
|
1721
1716
|
handled: !0
|
|
1722
1717
|
};
|
|
@@ -1726,13 +1721,13 @@ function dn(e) {
|
|
|
1726
1721
|
}
|
|
1727
1722
|
};
|
|
1728
1723
|
}
|
|
1729
|
-
var
|
|
1724
|
+
var dn = {
|
|
1730
1725
|
get description() {
|
|
1731
1726
|
return S("designer.errorHandling.pluginDescription");
|
|
1732
1727
|
},
|
|
1733
1728
|
name: "builtin:error-handling",
|
|
1734
1729
|
setup: function(e) {
|
|
1735
|
-
let t = e.errors, n = t.addRule(
|
|
1730
|
+
let t = e.errors, n = t.addRule(ln(e), { prepend: !0 }), r = t.addRule(un(e)), i = e.events.on("command:error", (t) => {
|
|
1736
1731
|
e.errors.capture(t.error, {
|
|
1737
1732
|
metadata: { commandId: t.id },
|
|
1738
1733
|
source: "command"
|
|
@@ -1742,26 +1737,26 @@ var fn = {
|
|
|
1742
1737
|
n(), r(), i();
|
|
1743
1738
|
};
|
|
1744
1739
|
}
|
|
1745
|
-
},
|
|
1746
|
-
bindEditorElements: () =>
|
|
1747
|
-
bindEditorErrors: () =>
|
|
1748
|
-
getEditorElements: () =>
|
|
1749
|
-
getEditorErrors: () =>
|
|
1750
|
-
}),
|
|
1751
|
-
function
|
|
1752
|
-
|
|
1740
|
+
}, fn = /* @__PURE__ */ e({
|
|
1741
|
+
bindEditorElements: () => _n,
|
|
1742
|
+
bindEditorErrors: () => hn,
|
|
1743
|
+
getEditorElements: () => vn,
|
|
1744
|
+
getEditorErrors: () => gn
|
|
1745
|
+
}), pn = /* @__PURE__ */ new WeakMap(), mn = /* @__PURE__ */ new WeakMap();
|
|
1746
|
+
function hn(e, t) {
|
|
1747
|
+
mn.set(e, t);
|
|
1753
1748
|
}
|
|
1754
|
-
function
|
|
1755
|
-
return
|
|
1749
|
+
function gn(e) {
|
|
1750
|
+
return mn.get(e) ?? sn();
|
|
1756
1751
|
}
|
|
1757
|
-
function
|
|
1758
|
-
|
|
1752
|
+
function _n(e, t) {
|
|
1753
|
+
pn.set(e, t);
|
|
1759
1754
|
}
|
|
1760
|
-
function
|
|
1761
|
-
return
|
|
1755
|
+
function vn(e) {
|
|
1756
|
+
return pn.get(e) ?? M;
|
|
1762
1757
|
}
|
|
1763
1758
|
// src/designer/services/preference-storage.ts
|
|
1764
|
-
var
|
|
1759
|
+
var yn = class {
|
|
1765
1760
|
fallback;
|
|
1766
1761
|
#e = [];
|
|
1767
1762
|
constructor(e) {
|
|
@@ -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 bn(e, t) {
|
|
1780
|
+
return {
|
|
1781
|
+
x: t.x - e.x,
|
|
1782
|
+
y: t.y - e.y
|
|
1783
|
+
};
|
|
1784
|
+
}
|
|
1785
|
+
function xn(e, t) {
|
|
1786
|
+
return {
|
|
1787
|
+
x: t.x + e.x,
|
|
1788
|
+
y: t.y + e.y
|
|
1789
|
+
};
|
|
1790
|
+
}
|
|
1791
|
+
function Sn(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 Cn = /* @__PURE__ */ e({
|
|
1799
|
+
bindStageService: () => On,
|
|
1800
|
+
contentMmFromClient: () => kn,
|
|
1801
|
+
createStageService: () => wn,
|
|
1802
|
+
getScrollElement: () => An,
|
|
1803
|
+
getStageController: () => jn,
|
|
1804
|
+
getStageService: () => Dn,
|
|
1805
|
+
registerStageController: () => Mn,
|
|
1806
|
+
registerStageElements: () => Nn,
|
|
1807
|
+
scrollToContentPoint: () => Pn
|
|
1792
1808
|
});
|
|
1793
|
-
function
|
|
1794
|
-
let e =
|
|
1809
|
+
function wn() {
|
|
1810
|
+
let e = Ue(null), t = Ue(null), n = Ue(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 = de * r;
|
|
1830
|
+
return Sn(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 = de * 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 Tn = /* @__PURE__ */ new WeakMap(), En = wn();
|
|
1851
|
+
function Dn(e) {
|
|
1852
|
+
return e ? Tn.get(e) ?? En : En;
|
|
1837
1853
|
}
|
|
1838
|
-
function
|
|
1839
|
-
|
|
1854
|
+
function On(e) {
|
|
1855
|
+
Tn.set(e, wn());
|
|
1840
1856
|
}
|
|
1841
|
-
var { contentMmFromClient:
|
|
1857
|
+
var { contentMmFromClient: kn, getScrollElement: An, getStageController: jn, registerStageController: Mn, registerStageElements: Nn, scrollToContentPoint: Pn } = En, Fn = [
|
|
1842
1858
|
{
|
|
1843
1859
|
height: 297,
|
|
1844
1860
|
id: "delivery",
|
|
@@ -1858,8 +1874,8 @@ var { contentMmFromClient: Dn, getScrollElement: On, getStageController: kn, reg
|
|
|
1858
1874
|
width: 148
|
|
1859
1875
|
}
|
|
1860
1876
|
];
|
|
1861
|
-
function
|
|
1862
|
-
let e =
|
|
1877
|
+
function In() {
|
|
1878
|
+
let e = Oe();
|
|
1863
1879
|
return e.templateId = we, {
|
|
1864
1880
|
dataSources: [],
|
|
1865
1881
|
name: S("designer.tutorial.practiceName"),
|
|
@@ -1868,12 +1884,12 @@ function Pn() {
|
|
|
1868
1884
|
version: "1.0"
|
|
1869
1885
|
};
|
|
1870
1886
|
}
|
|
1871
|
-
function
|
|
1887
|
+
function Ln(e, t) {
|
|
1872
1888
|
let n = e[0].toUpperCase() + e.slice(1), r = t[0].toUpperCase() + t.slice(1);
|
|
1873
1889
|
return S(`designer.tutorial.courses${n}${r}`);
|
|
1874
1890
|
}
|
|
1875
1891
|
function X(e, t) {
|
|
1876
|
-
return
|
|
1892
|
+
return Ln(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 Rn(e, t) {
|
|
1898
1914
|
e.page.update(e.document.data.pages[0].id, {
|
|
1899
1915
|
height: t.height,
|
|
1900
1916
|
margins: {
|
|
@@ -1908,7 +1924,7 @@ function In(e, t) {
|
|
|
1908
1924
|
width: t.width
|
|
1909
1925
|
});
|
|
1910
1926
|
}
|
|
1911
|
-
function
|
|
1927
|
+
function zn(e, t) {
|
|
1912
1928
|
let n = e.template.create({
|
|
1913
1929
|
id: "tutorial-template",
|
|
1914
1930
|
name: X(t, "templateName")
|
|
@@ -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 Bn(e, t) {
|
|
1943
1959
|
e.template.exitEdit();
|
|
1944
1960
|
let n = e.document.data.pages[0];
|
|
1945
1961
|
e.page.setActive(n.id);
|
|
@@ -1999,7 +2015,7 @@ function Rn(e, t) {
|
|
|
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 Vn = "tutorial-details", Hn = 50, Un = 22, Wn = 5, Gn = [
|
|
2003
2019
|
{
|
|
2004
2020
|
align: "left",
|
|
2005
2021
|
bind: "name",
|
|
@@ -2016,25 +2032,25 @@ var zn = "tutorial-details", Bn = 50, Vn = 22, Hn = 5, Un = [
|
|
|
2016
2032
|
key: "columnAmount"
|
|
2017
2033
|
}
|
|
2018
2034
|
];
|
|
2019
|
-
function
|
|
2035
|
+
function Kn(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: Un,
|
|
2039
|
+
id: Vn,
|
|
2024
2040
|
name: X(t, "detailsName"),
|
|
2025
2041
|
width: t.width - 36,
|
|
2026
2042
|
x: 18,
|
|
2027
|
-
y:
|
|
2043
|
+
y: Hn
|
|
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: Gn.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
|
|
2053
|
+
function qn(e, t) {
|
|
2038
2054
|
let n = e.document.data.pages[0], r = Z(e, n.id, S("designer.tutorial.documentTotal", { amount: "{{ bill.total | currency }}" }), 18, 77, t.width - 36, { props: {
|
|
2039
2055
|
fontWeight: "700",
|
|
2040
2056
|
textAlign: "right"
|
|
@@ -2042,9 +2058,9 @@ function Gn(e, t) {
|
|
|
2042
2058
|
if (!e.followBlock.create(n.id, [r.id, i.id], {
|
|
2043
2059
|
id: "tutorial-details",
|
|
2044
2060
|
kind: "element"
|
|
2045
|
-
},
|
|
2061
|
+
}, Wn, S("designer.tutorial.documentSummary"))) throw Error("Tutorial follow block could not be created");
|
|
2046
2062
|
}
|
|
2047
|
-
function
|
|
2063
|
+
function Jn(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,
|
|
@@ -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 Yn(e) {
|
|
2064
2080
|
e.view.updateSettings({ previewWithData: !0 });
|
|
2065
2081
|
}
|
|
2066
|
-
var
|
|
2082
|
+
var Xn = [
|
|
2067
2083
|
{
|
|
2068
2084
|
id: "welcome",
|
|
2069
2085
|
target: "menu"
|
|
2070
2086
|
},
|
|
2071
2087
|
{
|
|
2072
|
-
apply:
|
|
2088
|
+
apply: Rn,
|
|
2073
2089
|
id: "page",
|
|
2074
2090
|
target: "canvas"
|
|
2075
2091
|
},
|
|
2076
2092
|
{
|
|
2077
|
-
apply:
|
|
2093
|
+
apply: zn,
|
|
2078
2094
|
id: "template",
|
|
2079
2095
|
target: "canvas"
|
|
2080
2096
|
},
|
|
2081
2097
|
{
|
|
2082
|
-
apply:
|
|
2098
|
+
apply: Bn,
|
|
2083
2099
|
id: "data",
|
|
2084
2100
|
target: "canvas"
|
|
2085
2101
|
},
|
|
2086
2102
|
{
|
|
2087
|
-
apply:
|
|
2103
|
+
apply: Kn,
|
|
2088
2104
|
id: "table",
|
|
2089
2105
|
target: "canvas"
|
|
2090
2106
|
},
|
|
2091
2107
|
{
|
|
2092
|
-
apply:
|
|
2108
|
+
apply: qn,
|
|
2093
2109
|
id: "follow",
|
|
2094
2110
|
target: "canvas"
|
|
2095
2111
|
},
|
|
2096
2112
|
{
|
|
2097
|
-
apply:
|
|
2113
|
+
apply: Jn,
|
|
2098
2114
|
id: "pages",
|
|
2099
2115
|
target: "canvas"
|
|
2100
2116
|
},
|
|
2101
2117
|
{
|
|
2102
|
-
apply:
|
|
2118
|
+
apply: Yn,
|
|
2103
2119
|
id: "preview",
|
|
2104
2120
|
target: "canvas"
|
|
2105
2121
|
}
|
|
2106
2122
|
];
|
|
2107
2123
|
// src/designer/stores/canvas-store.ts
|
|
2108
|
-
function
|
|
2124
|
+
function Zn(e) {
|
|
2109
2125
|
let n = e.elements ?? M;
|
|
2110
|
-
return
|
|
2111
|
-
let r =
|
|
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,
|
|
@@ -2125,18 +2141,18 @@ function Yn(e) {
|
|
|
2125
2141
|
d.elements = n;
|
|
2126
2142
|
let f = e.repeatGroup.getByPage(r.id), p = /* @__PURE__ */ new Map();
|
|
2127
2143
|
return i.map((e) => {
|
|
2128
|
-
let r =
|
|
2144
|
+
let r = P(o, e, n);
|
|
2129
2145
|
a.resetSize && (r = {
|
|
2130
2146
|
...r,
|
|
2131
2147
|
height: 0
|
|
2132
2148
|
});
|
|
2133
|
-
let i =
|
|
2149
|
+
let i = Qn(r, n);
|
|
2134
2150
|
if (i) return i;
|
|
2135
2151
|
if (!c) {
|
|
2136
2152
|
let e = new Set(n.get(r.type)?.previewExpressionKeys);
|
|
2137
2153
|
return l ? t(r, l, u, e) : r;
|
|
2138
2154
|
}
|
|
2139
|
-
let s =
|
|
2155
|
+
let s = $n(r, d, f, p);
|
|
2140
2156
|
return b(r, s, u, "preview");
|
|
2141
2157
|
});
|
|
2142
2158
|
}
|
|
@@ -2146,7 +2162,7 @@ function Yn(e) {
|
|
|
2146
2162
|
};
|
|
2147
2163
|
})();
|
|
2148
2164
|
}
|
|
2149
|
-
function
|
|
2165
|
+
function Qn(e, t) {
|
|
2150
2166
|
let n = t.get(e.type);
|
|
2151
2167
|
if (!n?.resolvePreviewProps) return;
|
|
2152
2168
|
let r = {
|
|
@@ -2165,7 +2181,7 @@ function Xn(e, t) {
|
|
|
2165
2181
|
...i
|
|
2166
2182
|
};
|
|
2167
2183
|
}
|
|
2168
|
-
function
|
|
2184
|
+
function $n(e, t, r, i) {
|
|
2169
2185
|
let a = r.find((t) => t.elementIds.includes(e.id));
|
|
2170
2186
|
if (!a?.collection) return t;
|
|
2171
2187
|
let o = i.get(a.id);
|
|
@@ -2180,7 +2196,7 @@ function Zn(e, t, r, i) {
|
|
|
2180
2196
|
});
|
|
2181
2197
|
}
|
|
2182
2198
|
// src/core/layout-references.ts
|
|
2183
|
-
function
|
|
2199
|
+
function er(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 tr(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
|
+
nr(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 nr(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], Ce(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 rr(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) => xe(e)), c.value = E(e.document.data.templates ?? []), l.value = er(e.document.data, t.map((e) => e.id)), r(S("designer.clipboardStore.selectionCopiedMessage", { count: t.length })));
|
|
2249
2265
|
}, "copy"), d = t(() => {
|
|
2250
2266
|
u(), i();
|
|
2251
2267
|
}, "cut"), f = t(() => {
|
|
@@ -2254,27 +2270,27 @@ 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 = xe(r);
|
|
2274
|
+
a.id = z("el"), Object.assign(a, F(a, 3, 3)), ne(e.document.data, r, a, e.elements ?? M, {
|
|
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) && tr(e.document.data, l.value, i, t.id, z), e.selection.set(n), o(), r(S("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 ir() {
|
|
2292
|
+
return H("editor-config", () => {
|
|
2293
|
+
let e = W(c());
|
|
2278
2294
|
function t(t) {
|
|
2279
2295
|
e.value = c({ rendering: {
|
|
2280
2296
|
...e.value.rendering,
|
|
@@ -2292,9 +2308,9 @@ 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 ar(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
|
}
|
|
@@ -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 or = /* @__PURE__ */ e({
|
|
2342
|
+
dataSources: () => sr,
|
|
2343
|
+
default: () => dr,
|
|
2344
|
+
name: () => cr,
|
|
2345
|
+
pages: () => lr,
|
|
2346
|
+
templates: () => ur,
|
|
2331
2347
|
version: () => "1.0"
|
|
2332
|
-
}),
|
|
2348
|
+
}), sr = [], cr = "欢迎模板(横向 A4)", lr = [{
|
|
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
|
+
}], ur = [{
|
|
2964
2980
|
builtin: !0,
|
|
2965
2981
|
id: "template-blank",
|
|
2966
2982
|
name: "空白模板",
|
|
@@ -2973,24 +2989,24 @@ var ir = /* @__PURE__ */ e({
|
|
|
2973
2989
|
name: "空白模板",
|
|
2974
2990
|
width: 297
|
|
2975
2991
|
}
|
|
2976
|
-
}],
|
|
2977
|
-
dataSources:
|
|
2978
|
-
name:
|
|
2979
|
-
pages:
|
|
2980
|
-
templates:
|
|
2992
|
+
}], dr = {
|
|
2993
|
+
dataSources: sr,
|
|
2994
|
+
name: cr,
|
|
2995
|
+
pages: lr,
|
|
2996
|
+
templates: ur,
|
|
2981
2997
|
version: "1.0"
|
|
2982
|
-
},
|
|
2998
|
+
}, fr = {
|
|
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(() => or)
|
|
2987
3003
|
};
|
|
2988
|
-
function
|
|
2989
|
-
return structuredClone(
|
|
3004
|
+
function pr() {
|
|
3005
|
+
return structuredClone(dr);
|
|
2990
3006
|
}
|
|
2991
|
-
async function
|
|
3007
|
+
async function mr(e) {
|
|
2992
3008
|
try {
|
|
2993
|
-
let t = await
|
|
3009
|
+
let t = await fr[e]();
|
|
2994
3010
|
return structuredClone(t.default);
|
|
2995
3011
|
} catch (t) {
|
|
2996
3012
|
throw new x(S("designer.templateLibrary.builtinFailed", { id: `builtin.${e}` }), {
|
|
@@ -2999,7 +3015,7 @@ async function fr(e) {
|
|
|
2999
3015
|
});
|
|
3000
3016
|
}
|
|
3001
3017
|
}
|
|
3002
|
-
function
|
|
3018
|
+
function hr() {
|
|
3003
3019
|
return {
|
|
3004
3020
|
id: "builtin",
|
|
3005
3021
|
list() {
|
|
@@ -3008,28 +3024,28 @@ function pr() {
|
|
|
3008
3024
|
category: S("designer.templateLibrary.categoryBasic"),
|
|
3009
3025
|
description: S("designer.templateLibrary.welcomeDescription"),
|
|
3010
3026
|
id: "builtin.welcome",
|
|
3011
|
-
load: () =>
|
|
3027
|
+
load: () => mr("welcome"),
|
|
3012
3028
|
name: S("designer.templateLibrary.welcomeName")
|
|
3013
3029
|
},
|
|
3014
3030
|
{
|
|
3015
3031
|
category: S("designer.templateLibrary.categoryBusiness"),
|
|
3016
3032
|
description: S("designer.templateLibrary.purchaseOrderDescription"),
|
|
3017
3033
|
id: "builtin.purchaseOrder",
|
|
3018
|
-
load: () =>
|
|
3034
|
+
load: () => mr("purchaseOrder"),
|
|
3019
3035
|
name: S("designer.templateLibrary.purchaseOrderName")
|
|
3020
3036
|
},
|
|
3021
3037
|
{
|
|
3022
3038
|
category: S("designer.templateLibrary.categoryBusiness"),
|
|
3023
3039
|
description: S("designer.templateLibrary.costSheetDescription"),
|
|
3024
3040
|
id: "builtin.costSheet",
|
|
3025
|
-
load: () =>
|
|
3041
|
+
load: () => mr("costSheet"),
|
|
3026
3042
|
name: S("designer.templateLibrary.costSheetName")
|
|
3027
3043
|
},
|
|
3028
3044
|
{
|
|
3029
3045
|
category: S("designer.templateLibrary.categoryBusiness"),
|
|
3030
3046
|
description: S("designer.templateLibrary.invoiceDescription"),
|
|
3031
3047
|
id: "builtin.invoice",
|
|
3032
|
-
load: () =>
|
|
3048
|
+
load: () => mr("invoice"),
|
|
3033
3049
|
name: S("designer.templateLibrary.invoiceName")
|
|
3034
3050
|
}
|
|
3035
3051
|
];
|
|
@@ -3038,8 +3054,8 @@ function pr() {
|
|
|
3038
3054
|
};
|
|
3039
3055
|
}
|
|
3040
3056
|
// src/designer/stores/document-store.ts
|
|
3041
|
-
var
|
|
3042
|
-
function
|
|
3057
|
+
var gr = "print-studio:document";
|
|
3058
|
+
function _r(e) {
|
|
3043
3059
|
if (e.initialDocument) {
|
|
3044
3060
|
let t = B(E(e.initialDocument), e.elements);
|
|
3045
3061
|
if (e.strictInitialDocument && t.skippedTypes.length > 0) throw new x(S("designer.documentStore.skippedElementTypesMessage", { elementTypes: t.skippedTypes.join(", ") }), { code: "document.unsupported-elements" });
|
|
@@ -3047,7 +3063,7 @@ function hr(e) {
|
|
|
3047
3063
|
}
|
|
3048
3064
|
try {
|
|
3049
3065
|
let t = null;
|
|
3050
|
-
if (e.storage ? t = e.storage.get() : e.storage !== !1 && (t = localStorage.getItem(
|
|
3066
|
+
if (e.storage ? t = e.storage.get() : e.storage !== !1 && (t = localStorage.getItem(gr)), t) {
|
|
3051
3067
|
let { document: n, skippedTypes: r } = B(JSON.parse(t), e.elements);
|
|
3052
3068
|
return r.length > 0 && console.warn(S("designer.documentStore.skippedElementTypesDetail", { elementTypes: r.join(", ") })), n;
|
|
3053
3069
|
}
|
|
@@ -3057,14 +3073,14 @@ function hr(e) {
|
|
|
3057
3073
|
code: "document.restore-failed",
|
|
3058
3074
|
detail: S("designer.documentStore.autoSaveRestoreFailedDetail")
|
|
3059
3075
|
});
|
|
3060
|
-
(e.errors ??
|
|
3076
|
+
(e.errors ?? sn()).capture(n, { source: "store.init" });
|
|
3061
3077
|
}
|
|
3062
|
-
let t = e.createDocument?.() ?? B(
|
|
3063
|
-
return
|
|
3078
|
+
let t = e.createDocument?.() ?? B(pr(), e.elements).document;
|
|
3079
|
+
return oe(t), t;
|
|
3064
3080
|
}
|
|
3065
|
-
function
|
|
3066
|
-
return
|
|
3067
|
-
let t = e.ui.toast, n =
|
|
3081
|
+
function vr(e) {
|
|
3082
|
+
return H("editor-document", () => {
|
|
3083
|
+
let t = e.ui.toast, n = W(_r(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,19 +3095,19 @@ 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(gr, JSON.stringify(n.value));
|
|
3083
3099
|
} catch (t) {
|
|
3084
3100
|
let n = new x(S("designer.documentStore.autoSaveFailed"), {
|
|
3085
3101
|
cause: t,
|
|
3086
3102
|
code: "document.autosave-failed"
|
|
3087
3103
|
});
|
|
3088
|
-
(e.errors ??
|
|
3104
|
+
(e.errors ?? sn()).capture(n, { source: "store.autosave" });
|
|
3089
3105
|
}
|
|
3090
3106
|
}, 600));
|
|
3091
3107
|
}, { deep: !0 });
|
|
3092
3108
|
function p() {
|
|
3093
3109
|
let r = e.createDocument?.() ?? le();
|
|
3094
|
-
|
|
3110
|
+
oe(r), l += 1, n.value = r, n.value.pages[0].elements = [], n.value.pages[0].name = S("designer.documentStore.initialPageName"), e.resetSession(), e.commitHistory(), t(S("designer.documentStore.documentCreatedMessage"));
|
|
3095
3111
|
}
|
|
3096
3112
|
function m(i) {
|
|
3097
3113
|
let a;
|
|
@@ -3132,7 +3148,7 @@ function gr(e) {
|
|
|
3132
3148
|
}
|
|
3133
3149
|
function w(t) {
|
|
3134
3150
|
if (o.value || i.value) throw Error("Document session is busy");
|
|
3135
|
-
|
|
3151
|
+
oe(t), clearTimeout(u), o.value = {
|
|
3136
3152
|
document: _(),
|
|
3137
3153
|
savedSnapshot: r.value
|
|
3138
3154
|
}, l += 1, n.value = E(t), e.resetSession(), e.resetHistory();
|
|
@@ -3153,7 +3169,7 @@ function gr(e) {
|
|
|
3153
3169
|
i.value = !1, c = void 0;
|
|
3154
3170
|
}), c;
|
|
3155
3171
|
}
|
|
3156
|
-
return
|
|
3172
|
+
return Be(() => clearTimeout(u)), {
|
|
3157
3173
|
beginPreview: y,
|
|
3158
3174
|
beginTemporary: w,
|
|
3159
3175
|
create: p,
|
|
@@ -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 yr(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 R(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 = R(n.value, e);
|
|
3214
|
+
return t ? ce(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 Ee(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 : ke(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 = ve(n.value, l.id, z, o), f = ce(l, s.value);
|
|
3235
|
+
if (!ue(f, u, d)) return null;
|
|
3236
|
+
Se(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
|
-
he(d, t) && (
|
|
3242
|
+
let u = [...r.elementIds], d = ce(i, s.value);
|
|
3243
|
+
he(d, t) && (Se(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 br = {
|
|
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
|
+
}, xr = 1e-6;
|
|
3299
|
+
function Sr(e) {
|
|
3300
|
+
return br[e];
|
|
3285
3301
|
}
|
|
3286
|
-
function
|
|
3302
|
+
function Cr(e) {
|
|
3287
3303
|
return e === "h" ? "x" : "y";
|
|
3288
3304
|
}
|
|
3289
|
-
function
|
|
3305
|
+
function wr(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 Tr(e, t) {
|
|
3315
|
+
let { end: n, start: r } = wr(e, br[t]);
|
|
3300
3316
|
return t === "left" || t === "top" ? r : t === "right" || t === "bottom" ? n : (r + n) / 2;
|
|
3301
3317
|
}
|
|
3302
|
-
function
|
|
3318
|
+
function Er(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) > xr && t.set(n, r);
|
|
3305
3321
|
return t;
|
|
3306
3322
|
}
|
|
3307
|
-
function
|
|
3323
|
+
function Dr(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 D(e.map((e) => e.box));
|
|
3315
3331
|
}
|
|
3316
|
-
function
|
|
3332
|
+
function Or(e, t, n = {}) {
|
|
3317
3333
|
if (e.length === 0) return /* @__PURE__ */ new Map();
|
|
3318
|
-
let r =
|
|
3334
|
+
let r = Dr(e, n);
|
|
3319
3335
|
if (!r) return /* @__PURE__ */ new Map();
|
|
3320
|
-
let i =
|
|
3321
|
-
return
|
|
3336
|
+
let i = Tr(r, t);
|
|
3337
|
+
return Er(e.map((e) => [e.id, i - Tr(e.box, t)]));
|
|
3322
3338
|
}
|
|
3323
|
-
function
|
|
3339
|
+
function kr(e, t, n = {}) {
|
|
3324
3340
|
if (e.length < 3) return null;
|
|
3325
|
-
let r =
|
|
3341
|
+
let r = br[t], i = e.map((e) => ({
|
|
3326
3342
|
item: e,
|
|
3327
|
-
point:
|
|
3343
|
+
point: Tr(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 = wr(n.pageBounds, r), t = wr(a.item.box, r), i = wr(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 Er(i.map(({ item: e, point: t }, n) => [e.id, s + l * n - t]));
|
|
3335
3351
|
}
|
|
3336
|
-
function
|
|
3337
|
-
let r =
|
|
3352
|
+
function Ar(e, t, n = {}) {
|
|
3353
|
+
let r = Cr(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
|
+
...wr(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 = wr(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,28 +3370,28 @@ 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 Er(a.map((e, t) => [e.item.id, s[t] - e.start]));
|
|
3358
3374
|
}
|
|
3359
3375
|
// src/designer/stores/element-store.ts
|
|
3360
|
-
function
|
|
3376
|
+
function jr(e) {
|
|
3361
3377
|
let t = e.elements ?? M;
|
|
3362
|
-
return
|
|
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 R(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, Ne(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, Ne(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 ye(r.value, e);
|
|
3379
3395
|
}
|
|
3380
3396
|
function g(e) {
|
|
3381
3397
|
return h(e)?.node;
|
|
@@ -3390,17 +3406,17 @@ function kr(e) {
|
|
|
3390
3406
|
let s = o ? l(o) : i.value;
|
|
3391
3407
|
if (!s) return null;
|
|
3392
3408
|
let c = se(e, n, t);
|
|
3393
|
-
return s.elements.push(c),
|
|
3409
|
+
return s.elements.push(c), _e(r.value, c, t), a(), c;
|
|
3394
3410
|
}, "add"), b = 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 = k(i, t), r =
|
|
3401
|
-
n && r > i.width && i.x <
|
|
3416
|
+
let e = k(i, t), r = L(Math.max(i.width, e.width)), a = L(Math.max(i.height, e.height));
|
|
3417
|
+
n && r > i.width && i.x < L(n.x) && (i.x = L(n.x - r)), n && a > i.height && i.y < L(n.y) && (i.y = L(n.y - a)), i.width = r, i.height = a;
|
|
3402
3418
|
}
|
|
3403
|
-
return o.elements.push(i),
|
|
3419
|
+
return o.elements.push(i), _e(r.value, i, t), e.selection.set([i.id]), a(), i;
|
|
3404
3420
|
}, "commitDraft");
|
|
3405
3421
|
function x(e, n) {
|
|
3406
3422
|
let i = h(e);
|
|
@@ -3409,7 +3425,7 @@ function kr(e) {
|
|
|
3409
3425
|
let a = {
|
|
3410
3426
|
...i.node,
|
|
3411
3427
|
...n
|
|
3412
|
-
}, o =
|
|
3428
|
+
}, o = P(r.value, a, t);
|
|
3413
3429
|
return o !== a && (n = {
|
|
3414
3430
|
...n,
|
|
3415
3431
|
bindings: o.bindings,
|
|
@@ -3417,7 +3433,7 @@ function kr(e) {
|
|
|
3417
3433
|
}), j(r.value, {
|
|
3418
3434
|
...i.node,
|
|
3419
3435
|
...n
|
|
3420
|
-
}, t), Object.assign(i.node,
|
|
3436
|
+
}, t), Object.assign(i.node, Ne(i.node, n, t)), ("props" in n || "type" in n || "bindings" in n) && (_e(r.value, i.node, t), O(r.value, t)), "props" in n && ge(i.node, t.get(i.node.type)), !0;
|
|
3421
3437
|
}
|
|
3422
3438
|
function C(e) {
|
|
3423
3439
|
return e.y !== void 0 && !w(e);
|
|
@@ -3428,7 +3444,7 @@ function kr(e) {
|
|
|
3428
3444
|
let T = n((n, i = {}, o = []) => {
|
|
3429
3445
|
for (let { id: e, patch: i } of n) {
|
|
3430
3446
|
let n = g(e);
|
|
3431
|
-
n && (A(r.value, n, i), j(r.value,
|
|
3447
|
+
n && (A(r.value, n, i), j(r.value, P(r.value, {
|
|
3432
3448
|
...n,
|
|
3433
3449
|
...i
|
|
3434
3450
|
}, t), t));
|
|
@@ -3443,68 +3459,68 @@ function kr(e) {
|
|
|
3443
3459
|
return i.transient || a(), l;
|
|
3444
3460
|
}, "updateMany"), E = n((t, n, r = {}) => {
|
|
3445
3461
|
x(t, n) && (e.layout.apply(C(n) ? [t] : [], w(n) ? [t] : []), r.transient || a());
|
|
3446
|
-
}, "update"),
|
|
3462
|
+
}, "update"), D = n((n, i, o = {}) => {
|
|
3447
3463
|
let s = h(n);
|
|
3448
3464
|
if (!s || s.node.locked) return;
|
|
3449
|
-
let c =
|
|
3465
|
+
let c = P(r.value, {
|
|
3450
3466
|
...s.node,
|
|
3451
3467
|
props: {
|
|
3452
3468
|
...s.node.props,
|
|
3453
3469
|
...i
|
|
3454
3470
|
}
|
|
3455
3471
|
}, t);
|
|
3456
|
-
j(r.value, c, t), s.node.props = c.props,
|
|
3457
|
-
}, "updateProps"),
|
|
3472
|
+
j(r.value, c, t), s.node.props = c.props, _e(r.value, s.node, t), O(r.value, t), ge(s.node, t.get(s.node.type)), e.layout.apply(), o.transient || a();
|
|
3473
|
+
}, "updateProps"), M = n((t, n = {}) => {
|
|
3458
3474
|
if (t.length === 0) return;
|
|
3459
3475
|
for (let e of t) {
|
|
3460
3476
|
let t = g(e);
|
|
3461
3477
|
t && A(r.value, t);
|
|
3462
3478
|
}
|
|
3463
3479
|
let i = new Set(t);
|
|
3464
|
-
for (let e of
|
|
3465
|
-
O(r.value),
|
|
3480
|
+
for (let e of ae(r.value)) e.elements = e.elements.filter((e) => !i.has(e.id));
|
|
3481
|
+
O(r.value), Ce(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
3484
|
})).filter((e) => e.elementIds.length > 0)), e.selection.set(o.value.filter((e) => !i.has(e))), N(r.value), e.selection.setEditingId(null), n.transient || a();
|
|
3469
|
-
}, "removeIds"),
|
|
3470
|
-
|
|
3485
|
+
}, "removeIds"), ee = n(() => {
|
|
3486
|
+
M(o.value.filter((e) => {
|
|
3471
3487
|
let t = h(e);
|
|
3472
3488
|
return t ? !t.node.locked : !1;
|
|
3473
3489
|
}));
|
|
3474
|
-
}, "removeSelected"),
|
|
3475
|
-
let s =
|
|
3490
|
+
}, "removeSelected"), te = n((n, i = 3, o = {}) => {
|
|
3491
|
+
let s = er(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 = xe(n.node);
|
|
3496
|
+
a.id = z("el"), a.name = S("designer.elementStore.duplicateName", { elementName: n.node.name }), Object.assign(a, F(a, i, i)), ne(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) tr(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, z);
|
|
3490
3506
|
e.selection.set(c), o.transient || a();
|
|
3491
3507
|
}
|
|
3492
|
-
}, "duplicate"),
|
|
3508
|
+
}, "duplicate"), re = 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, F(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 = ce(e, r.value.elementGroups ?? []);
|
|
3517
|
+
return t(n) ? (Se(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 = V(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,7 +3541,7 @@ 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) => be(t, r, e));
|
|
3529
3545
|
}
|
|
3530
3546
|
a();
|
|
3531
3547
|
}
|
|
@@ -3533,17 +3549,17 @@ function kr(e) {
|
|
|
3533
3549
|
ue({ offset: e });
|
|
3534
3550
|
}, "reorder"), fe = n((e) => {
|
|
3535
3551
|
ue({ edge: e });
|
|
3536
|
-
}, "sendTo"),
|
|
3552
|
+
}, "sendTo"), me = n((e, t, n) => {
|
|
3537
3553
|
let i = _(e).filter((e) => e[t] !== n);
|
|
3538
3554
|
if (i.length !== 0) {
|
|
3539
3555
|
if (t === "visible") for (let e of i) A(r.value, e, { visible: n });
|
|
3540
3556
|
for (let e of i) e[t] = n;
|
|
3541
3557
|
a();
|
|
3542
3558
|
}
|
|
3543
|
-
}, "setFlag"),
|
|
3559
|
+
}, "setFlag"), he = n((e, t) => {
|
|
3544
3560
|
let n = h(e);
|
|
3545
3561
|
n && (t === "visible" && A(r.value, n.node, { visible: !n.node.visible }), n.node[t] = !n.node[t], a());
|
|
3546
|
-
}, "toggleFlag"),
|
|
3562
|
+
}, "toggleFlag"), ve = n((e, t) => {
|
|
3547
3563
|
let n = h(e);
|
|
3548
3564
|
n && t.trim() && (n.node.name = t.trim(), a());
|
|
3549
3565
|
}, "rename");
|
|
@@ -3572,7 +3588,7 @@ function kr(e) {
|
|
|
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" ? F(r, i, 0) : F(r, 0, i);
|
|
3576
3592
|
Object.assign(r, a);
|
|
3577
3593
|
}
|
|
3578
3594
|
e.layout.apply(n === "y" ? [...r.keys()] : []), a();
|
|
@@ -3582,31 +3598,31 @@ function kr(e) {
|
|
|
3582
3598
|
align: n((e, t = {}) => {
|
|
3583
3599
|
let n = B();
|
|
3584
3600
|
if (!n) return;
|
|
3585
|
-
let r =
|
|
3601
|
+
let r = Or(n.items, e, {
|
|
3586
3602
|
...t,
|
|
3587
3603
|
pageBounds: n.pageBounds
|
|
3588
3604
|
});
|
|
3589
|
-
we(n.nodes,
|
|
3605
|
+
we(n.nodes, Sr(e), r);
|
|
3590
3606
|
}, "align"),
|
|
3591
3607
|
cancelDraft: m,
|
|
3592
3608
|
commitDraft: b,
|
|
3593
3609
|
distribute: n((e, t = {}) => {
|
|
3594
3610
|
let n = B();
|
|
3595
3611
|
if (!n) return;
|
|
3596
|
-
let r =
|
|
3612
|
+
let r = kr(n.items, e, {
|
|
3597
3613
|
...t,
|
|
3598
3614
|
pageBounds: n.pageBounds
|
|
3599
3615
|
});
|
|
3600
|
-
r ? we(n.nodes,
|
|
3616
|
+
r ? we(n.nodes, Sr(e), r) : c(S("designer.elementStore.insufficientDistributionSelection"));
|
|
3601
3617
|
}, "distribute"),
|
|
3602
3618
|
distributeSpacing: n((e, t = {}) => {
|
|
3603
3619
|
let n = B();
|
|
3604
3620
|
if (!n) return;
|
|
3605
|
-
let r =
|
|
3621
|
+
let r = Ar(n.items, e, {
|
|
3606
3622
|
...t,
|
|
3607
3623
|
pageBounds: n.pageBounds
|
|
3608
3624
|
});
|
|
3609
|
-
if (r) we(n.nodes,
|
|
3625
|
+
if (r) we(n.nodes, Cr(e), r);
|
|
3610
3626
|
else {
|
|
3611
3627
|
let e = typeof t.spacing == "number" && Number.isFinite(t.spacing);
|
|
3612
3628
|
c(S(e ? "designer.elementStore.insufficientSpacingSelection" : "designer.elementStore.insufficientDistributionSelection"));
|
|
@@ -3614,40 +3630,40 @@ function kr(e) {
|
|
|
3614
3630
|
}, "distributeSpacing"),
|
|
3615
3631
|
draftElement: u,
|
|
3616
3632
|
draftPageId: d,
|
|
3617
|
-
duplicate:
|
|
3618
|
-
find:
|
|
3619
|
-
get:
|
|
3620
|
-
getByPage:
|
|
3621
|
-
getMany:
|
|
3622
|
-
moveByDisplayIndex:
|
|
3633
|
+
duplicate: te,
|
|
3634
|
+
find: U(() => h),
|
|
3635
|
+
get: U(() => g),
|
|
3636
|
+
getByPage: U(() => v),
|
|
3637
|
+
getMany: U(() => _),
|
|
3638
|
+
moveByDisplayIndex: oe,
|
|
3623
3639
|
moveLayerNodes: le,
|
|
3624
|
-
nudge:
|
|
3625
|
-
removeIds:
|
|
3626
|
-
removeSelected:
|
|
3627
|
-
rename:
|
|
3640
|
+
nudge: re,
|
|
3641
|
+
removeIds: M,
|
|
3642
|
+
removeSelected: ee,
|
|
3643
|
+
rename: ve,
|
|
3628
3644
|
reorder: de,
|
|
3629
3645
|
sendTo: fe,
|
|
3630
3646
|
setDraft: f,
|
|
3631
|
-
setFlag:
|
|
3632
|
-
toggleFlag:
|
|
3647
|
+
setFlag: me,
|
|
3648
|
+
toggleFlag: he,
|
|
3633
3649
|
update: E,
|
|
3634
3650
|
updateDraft: p,
|
|
3635
3651
|
updateMany: T,
|
|
3636
|
-
updateProps:
|
|
3652
|
+
updateProps: D
|
|
3637
3653
|
};
|
|
3638
3654
|
})();
|
|
3639
3655
|
}
|
|
3640
3656
|
// src/designer/stores/follow-block-store.ts
|
|
3641
|
-
function
|
|
3642
|
-
return
|
|
3643
|
-
let t =
|
|
3657
|
+
function Mr(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)), i = 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
|
-
}), s =
|
|
3663
|
+
}), s = 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
|
-
}), c =
|
|
3666
|
+
}), c = 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
|
}));
|
|
@@ -3681,7 +3697,7 @@ function Ar(e) {
|
|
|
3681
3697
|
let i = e.document.data, o = i.pages.find((e) => e.id === t), s = ee(i, t, r)?.elementIds ?? [], c = a((o?.elements ?? []).filter((e) => n.includes(e.id))), l = a((o?.elements ?? []).filter((e) => s.includes(e.id)));
|
|
3682
3698
|
return !c || !l ? 0 : c.y - l.y - l.height;
|
|
3683
3699
|
}
|
|
3684
|
-
function m(e, t, r, i = 2, a = S("designer.followBlock.defaultName"), o =
|
|
3700
|
+
function m(e, t, r, i = 2, a = S("designer.followBlock.defaultName"), o = z("follow")) {
|
|
3685
3701
|
if (n.value(o)) throw Error(`Follow block already exists: ${o}`);
|
|
3686
3702
|
let s = {
|
|
3687
3703
|
elementIds: [...t],
|
|
@@ -3736,13 +3752,13 @@ function Ar(e) {
|
|
|
3736
3752
|
})();
|
|
3737
3753
|
}
|
|
3738
3754
|
// src/designer/stores/guide-store.ts
|
|
3739
|
-
function
|
|
3740
|
-
return
|
|
3755
|
+
function Nr(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: z("guide"),
|
|
3767
3783
|
orientation: t,
|
|
3768
|
-
position:
|
|
3784
|
+
position: L(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 = L(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 Pr = 100;
|
|
3814
|
+
function Fr(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 > Pr && 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,19 +3889,19 @@ function Nr(e) {
|
|
|
3873
3889
|
})();
|
|
3874
3890
|
}
|
|
3875
3891
|
// src/designer/stores/layout-store.ts
|
|
3876
|
-
function
|
|
3877
|
-
return
|
|
3878
|
-
let t =
|
|
3892
|
+
function Ir(e) {
|
|
3893
|
+
return H("editor-layout", () => {
|
|
3894
|
+
let t = He(/* @__PURE__ */ new Map());
|
|
3879
3895
|
function n(e, n) {
|
|
3880
3896
|
let r = t.get(e);
|
|
3881
|
-
return t.set(e,
|
|
3897
|
+
return t.set(e, ze(n)), () => {
|
|
3882
3898
|
t.get(e) === n && (r ? t.set(e, r) : t.delete(e));
|
|
3883
3899
|
};
|
|
3884
3900
|
}
|
|
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 = ye(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 Lr(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 Rr(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 && R(t.value, o.id)) throw Error(`Page already exists: ${o.id}`);
|
|
3977
|
+
let s = Ae(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 = Oe(e, r, a ?? S("designer.pageStore.numberedPageName", { pageNumber: t.value.pages.length + 1 }), {
|
|
3966
3982
|
...o,
|
|
3967
3983
|
...s
|
|
3968
3984
|
});
|
|
@@ -3971,23 +3987,23 @@ 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 = er(t.value, o.elements.map((e) => e.id)), c = {
|
|
3991
|
+
...I(o),
|
|
3976
3992
|
background: o.background,
|
|
3977
3993
|
elements: o.elements.map((e) => ({
|
|
3978
|
-
...
|
|
3979
|
-
id:
|
|
3994
|
+
...xe(e),
|
|
3995
|
+
id: z("el")
|
|
3980
3996
|
})),
|
|
3981
3997
|
guides: o.guides.map((e) => ({
|
|
3982
3998
|
...e,
|
|
3983
|
-
id:
|
|
3999
|
+
id: z("guide")
|
|
3984
4000
|
})),
|
|
3985
|
-
id:
|
|
4001
|
+
id: z("page"),
|
|
3986
4002
|
name: S("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()) ne(t.value, r, c.elements[n], e.elements ?? M);
|
|
4006
|
+
t.value.pages.splice(a + 1, 0, c), tr(t.value, s, new Map(o.elements.map((e, t) => [e.id, c.elements[t].id])), c.id, z), i.value = c.id, n();
|
|
3991
4007
|
}
|
|
3992
4008
|
function h(e) {
|
|
3993
4009
|
if (!o.value) {
|
|
@@ -4004,9 +4020,19 @@ function Ir(e) {
|
|
|
4004
4020
|
let a = {
|
|
4005
4021
|
...i,
|
|
4006
4022
|
...r
|
|
4007
|
-
}, o =
|
|
4023
|
+
}, o = Ae(t.value, a);
|
|
4008
4024
|
Object.assign(i, a, o), n();
|
|
4009
4025
|
}
|
|
4026
|
+
function _(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, L(t.x, 2)),
|
|
4032
|
+
y: Math.max(0, L(t.y, 2))
|
|
4033
|
+
}, n();
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
4010
4036
|
return {
|
|
4011
4037
|
active: u,
|
|
4012
4038
|
activeId: d,
|
|
@@ -4014,12 +4040,13 @@ 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,
|
|
4049
|
+
move: _,
|
|
4023
4050
|
remove: h,
|
|
4024
4051
|
setActive: f,
|
|
4025
4052
|
update: g
|
|
@@ -4027,32 +4054,32 @@ function Ir(e) {
|
|
|
4027
4054
|
})();
|
|
4028
4055
|
}
|
|
4029
4056
|
// src/designer/stores/panel-store.ts
|
|
4030
|
-
var
|
|
4031
|
-
function
|
|
4057
|
+
var zr = "print-studio:panel-layout";
|
|
4058
|
+
function Br(e) {
|
|
4032
4059
|
return {
|
|
4033
4060
|
activeId: e[0] ?? "",
|
|
4034
|
-
id:
|
|
4061
|
+
id: z("panel-group"),
|
|
4035
4062
|
panelIds: e,
|
|
4036
4063
|
weight: 1
|
|
4037
4064
|
};
|
|
4038
4065
|
}
|
|
4039
|
-
function
|
|
4066
|
+
function Vr(e) {
|
|
4040
4067
|
return {
|
|
4041
4068
|
collapsed: !1,
|
|
4042
4069
|
floating: !1,
|
|
4043
4070
|
groups: e,
|
|
4044
4071
|
height: 480,
|
|
4045
|
-
id:
|
|
4072
|
+
id: z("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 Hr(e, t, n, r) {
|
|
4080
|
+
return typeof e == "number" && Number.isFinite(e) ? V(e, n, r) : t;
|
|
4054
4081
|
}
|
|
4055
|
-
function
|
|
4082
|
+
function Ur(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 = Vr([]);
|
|
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 = Br(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 = Hr(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 = Hr(i.width, 280, 240, 560), e.railWidth = Hr(i.railWidth, 112, 36, 180), e.height = Hr(i.height, 480, 180, 1600), e.x = Hr(i.x, 80, 0, 1e4), e.y = Hr(i.y, 100, 0, 1e4), t.columns.push(e));
|
|
4074
4101
|
}
|
|
4075
4102
|
return t;
|
|
4076
4103
|
}
|
|
4077
|
-
function
|
|
4104
|
+
function Wr(e) {
|
|
4078
4105
|
try {
|
|
4079
|
-
return
|
|
4106
|
+
return Ur(JSON.parse((e ? e.get(zr) : localStorage.getItem(zr)) ?? "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 Gr(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 Kr(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), Gr(e, t, n), n.panelIds = i, n.activeId = t[0];
|
|
4093
4120
|
}
|
|
4094
|
-
function
|
|
4121
|
+
function qr(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 Jr(e, t, n, r) {
|
|
4129
|
+
let i = Vr(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 = V(n.x ?? 80, 0, Math.max(0, window.innerWidth - e)), i.y = V(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 =
|
|
4137
|
+
function Yr(e = !0, t) {
|
|
4138
|
+
return H("editor-panel", ({ action: n }) => {
|
|
4139
|
+
let r = He({}), i = /* @__PURE__ */ new Map(), a = W(e ? Wr(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(zr, JSON.stringify(a.value));
|
|
4124
4151
|
else try {
|
|
4125
|
-
localStorage.setItem(
|
|
4152
|
+
localStorage.setItem(zr, JSON.stringify(a.value));
|
|
4126
4153
|
} catch {
|
|
4127
4154
|
return;
|
|
4128
4155
|
}
|
|
@@ -4131,13 +4158,13 @@ function qr(e = !0, t) {
|
|
|
4131
4158
|
function m(e) {
|
|
4132
4159
|
let t = {
|
|
4133
4160
|
...e,
|
|
4134
|
-
component:
|
|
4161
|
+
component: ze(e.component)
|
|
4135
4162
|
};
|
|
4136
4163
|
r[e.id] = 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 = Vr([]), a.value.columns.push(t)), t.groups.push(Br([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(zr) && (a.value = Wr(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(V(t, 36, 180)) : r.width = Math.round(V(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 * V(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 = V(t, 240, 560), r.height = V(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 = V(t.x ?? n.x, 0, Math.max(0, window.innerWidth - e)), n.y = V(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) Kr(o, s, i, t.panelId);
|
|
4254
4281
|
else {
|
|
4255
|
-
let c = e.panelId ? [
|
|
4282
|
+
let c = e.panelId ? [Br(s)] : o.map((e) => ({
|
|
4256
4283
|
...e,
|
|
4257
4284
|
panelIds: [...e.panelIds]
|
|
4258
4285
|
}));
|
|
4259
|
-
if (
|
|
4286
|
+
if (Gr(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 = Jr(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
|
+
qr(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(Vr(e.map((e) => Br([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 Xr() {
|
|
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,9 +4359,9 @@ function Jr() {
|
|
|
4332
4359
|
})();
|
|
4333
4360
|
}
|
|
4334
4361
|
// src/designer/stores/rendering-store.ts
|
|
4335
|
-
function
|
|
4336
|
-
return
|
|
4337
|
-
let t =
|
|
4362
|
+
function Zr(e) {
|
|
4363
|
+
return H("editor-rendering", () => {
|
|
4364
|
+
let t = W(null), n = W(null), i = W(!1), a = W(!1), o = W(!0), s = W({
|
|
4338
4365
|
completed: 0,
|
|
4339
4366
|
stage: "prepare",
|
|
4340
4367
|
total: 1
|
|
@@ -4408,7 +4435,7 @@ function Yr(e) {
|
|
|
4408
4435
|
}
|
|
4409
4436
|
return K(() => e.config.data.rendering.worker, (e) => {
|
|
4410
4437
|
e || l.dispose();
|
|
4411
|
-
}, { flush: "sync" }),
|
|
4438
|
+
}, { flush: "sync" }), Be(() => {
|
|
4412
4439
|
_(), l.dispose();
|
|
4413
4440
|
}), {
|
|
4414
4441
|
active: i,
|
|
@@ -4426,9 +4453,9 @@ function Yr(e) {
|
|
|
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 Qr(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,7 +4483,7 @@ 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 =
|
|
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), g = U(() => f(i.value));
|
|
4460
4487
|
function _(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);
|
|
@@ -4480,7 +4507,7 @@ function Xr(e) {
|
|
|
4480
4507
|
direction: "vertical",
|
|
4481
4508
|
gapX: 2,
|
|
4482
4509
|
gapY: 2,
|
|
4483
|
-
id:
|
|
4510
|
+
id: z("group"),
|
|
4484
4511
|
name: S("designer.repeatGroupStore.numberedGroupName", { groupNumber: c.value.length + 1 }),
|
|
4485
4512
|
...i,
|
|
4486
4513
|
elementIds: f,
|
|
@@ -4499,12 +4526,12 @@ function Xr(e) {
|
|
|
4499
4526
|
activePageGroups: g,
|
|
4500
4527
|
applyToSelection: b,
|
|
4501
4528
|
create: y,
|
|
4502
|
-
find:
|
|
4503
|
-
findByElement:
|
|
4504
|
-
getApplyTarget:
|
|
4505
|
-
getByElements:
|
|
4506
|
-
getByPage:
|
|
4507
|
-
getMembers:
|
|
4529
|
+
find: U(() => u),
|
|
4530
|
+
findByElement: U(() => d),
|
|
4531
|
+
getApplyTarget: U(() => _),
|
|
4532
|
+
getByElements: U(() => p),
|
|
4533
|
+
getByPage: U(() => f),
|
|
4534
|
+
getMembers: U(() => m),
|
|
4508
4535
|
list: c,
|
|
4509
4536
|
remove: C,
|
|
4510
4537
|
selected: h,
|
|
@@ -4513,9 +4540,9 @@ function Xr(e) {
|
|
|
4513
4540
|
})();
|
|
4514
4541
|
}
|
|
4515
4542
|
// src/designer/stores/scope-store.ts
|
|
4516
|
-
function
|
|
4517
|
-
return
|
|
4518
|
-
let t =
|
|
4543
|
+
function $r(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,60 +4573,64 @@ function Zr(e) {
|
|
|
4546
4573
|
})();
|
|
4547
4574
|
}
|
|
4548
4575
|
// src/designer/stores/selection-store.ts
|
|
4549
|
-
function
|
|
4550
|
-
return
|
|
4551
|
-
|
|
4576
|
+
function ei(e, t) {
|
|
4577
|
+
return e.length === t.length && e.every((e, n) => t[n] === e);
|
|
4578
|
+
}
|
|
4579
|
+
function ti(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 ae(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 (R(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 : D(e.map((e) => ie({
|
|
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
|
+
ei(n, i.value) || (i.value = n);
|
|
4611
|
+
} else ei(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
|
-
}, "clear"),
|
|
4615
|
+
}, "clear"), O = 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"),
|
|
4618
|
+
}, "all"), k = U(() => {
|
|
4588
4619
|
let t = s.value;
|
|
4589
4620
|
return t ? e.guide.find(t) : null;
|
|
4590
|
-
}),
|
|
4621
|
+
}), A = t((e) => {
|
|
4591
4622
|
s.value = e, e && (i.value = [], u.value = null, C.value = null);
|
|
4592
4623
|
}, "selectGuide");
|
|
4593
4624
|
K(i, (e) => {
|
|
4594
4625
|
e.length > 0 && (s.value = null);
|
|
4595
|
-
}), K(
|
|
4626
|
+
}), K(k, (e) => {
|
|
4596
4627
|
s.value && !e && (s.value = null);
|
|
4597
4628
|
}, { flush: "sync" });
|
|
4598
|
-
function
|
|
4629
|
+
function j() {
|
|
4599
4630
|
E(), c.value = null, u.value = null, l.value = null;
|
|
4600
4631
|
}
|
|
4601
4632
|
return {
|
|
4602
|
-
all:
|
|
4633
|
+
all: O,
|
|
4603
4634
|
bounds: S,
|
|
4604
4635
|
clear: E,
|
|
4605
4636
|
editingId: u,
|
|
@@ -4613,11 +4644,11 @@ function Qr(e) {
|
|
|
4613
4644
|
nodes: m,
|
|
4614
4645
|
primary: h,
|
|
4615
4646
|
renamingId: l,
|
|
4616
|
-
reset:
|
|
4647
|
+
reset: j,
|
|
4617
4648
|
sameType: g,
|
|
4618
|
-
selectedGuide:
|
|
4649
|
+
selectedGuide: k,
|
|
4619
4650
|
selectedGuideId: s,
|
|
4620
|
-
selectGuide:
|
|
4651
|
+
selectGuide: A,
|
|
4621
4652
|
set: T,
|
|
4622
4653
|
setEditingId: p,
|
|
4623
4654
|
setHoverId: d,
|
|
@@ -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 ni(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 ? me(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);
|
|
@@ -4661,13 +4692,13 @@ function $r(e) {
|
|
|
4661
4692
|
let n = d(e.id);
|
|
4662
4693
|
if (n) return n;
|
|
4663
4694
|
let r = E(e);
|
|
4664
|
-
return
|
|
4695
|
+
return te(r), je({
|
|
4665
4696
|
...t.value,
|
|
4666
4697
|
templates: [...o.value, r]
|
|
4667
4698
|
}, r), v(r), r;
|
|
4668
4699
|
}
|
|
4669
4700
|
function b(n = {}) {
|
|
4670
|
-
if (n.id && (d(n.id) ||
|
|
4701
|
+
if (n.id && (d(n.id) || R(t.value, n.id))) throw Error(`Template already exists: ${n.id}`);
|
|
4671
4702
|
let r = e.page.active, i = fe(n.name ?? S("designer.templateStore.newTemplateName", { templateNumber: s.value.length }), r ? {
|
|
4672
4703
|
height: r.height,
|
|
4673
4704
|
width: r.width
|
|
@@ -4679,29 +4710,29 @@ function $r(e) {
|
|
|
4679
4710
|
if (!n) return null;
|
|
4680
4711
|
let i = fe(S("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 = xe(n);
|
|
4714
|
+
return r.id = z("el"), ne(t.value, n, r, e.elements ?? M), r;
|
|
4684
4715
|
}), i.page.guides = n.guides.map((e) => ({
|
|
4685
4716
|
...e,
|
|
4686
|
-
id:
|
|
4717
|
+
id: z("guide")
|
|
4687
4718
|
})), v(i), r(S("designer.templateStore.createdFromPageMessage")), i;
|
|
4688
4719
|
}
|
|
4689
4720
|
function w(e, t) {
|
|
4690
4721
|
let r = d(e);
|
|
4691
4722
|
r && t.trim() && (D(r, t.trim()), n());
|
|
4692
4723
|
}
|
|
4693
|
-
function T(e, r) {
|
|
4694
|
-
let
|
|
4695
|
-
if (
|
|
4696
|
-
if (r.baseTemplateId && d(r.baseTemplateId)?.owner ||
|
|
4724
|
+
function T(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 x(S("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
|
+
je(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 = Oe(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 && D(a, r.name), (r.facingPages !== void 0 || r.oddPages !== void 0 || r.evenPages !== void 0) && A(a.id), i.transient || n();
|
|
4705
4736
|
}
|
|
4706
4737
|
}
|
|
4707
4738
|
function D(e, t) {
|
|
@@ -4715,7 +4746,7 @@ function $r(e) {
|
|
|
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
|
-
O(t.value),
|
|
4749
|
+
O(t.value), Ce(t.value), A(De), n();
|
|
4719
4750
|
}
|
|
4720
4751
|
}
|
|
4721
4752
|
function A(e, n) {
|
|
@@ -4726,9 +4757,9 @@ function $r(e) {
|
|
|
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 = I(a.page);
|
|
4732
4763
|
r.push({
|
|
4733
4764
|
dimensions: o,
|
|
4734
4765
|
page: i
|
|
@@ -4757,21 +4788,21 @@ 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, I(n.page));
|
|
4762
4793
|
}
|
|
4763
4794
|
n();
|
|
4764
4795
|
}
|
|
4765
|
-
function
|
|
4796
|
+
function P(e) {
|
|
4766
4797
|
d(e) && (i.value = e, a.value = d(e)?.page.id ?? null);
|
|
4767
4798
|
}
|
|
4768
4799
|
function re(e) {
|
|
4769
4800
|
l.value.some((t) => t.id === e) && (a.value = e);
|
|
4770
4801
|
}
|
|
4771
|
-
function
|
|
4802
|
+
function F(e, r) {
|
|
4772
4803
|
let i = _(e), a = i ? me(i).find((t) => t.id === e) : void 0;
|
|
4773
4804
|
if (!a) return;
|
|
4774
|
-
let s =
|
|
4805
|
+
let s = I({
|
|
4775
4806
|
...a,
|
|
4776
4807
|
...r
|
|
4777
4808
|
});
|
|
@@ -4790,17 +4821,17 @@ function $r(e) {
|
|
|
4790
4821
|
} : t)
|
|
4791
4822
|
}, i.id), Object.assign(a, r, s), i && A(i.id), i && r.name !== void 0 && D(i, r.name), n();
|
|
4792
4823
|
}
|
|
4793
|
-
function
|
|
4824
|
+
function ie() {
|
|
4794
4825
|
i.value = null, a.value = null;
|
|
4795
4826
|
}
|
|
4796
|
-
function
|
|
4827
|
+
function ae(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 = xe(n);
|
|
4834
|
+
return r.id = z("el"), ne(t.value, n, r, e.elements ?? M), r;
|
|
4804
4835
|
});
|
|
4805
4836
|
i.elements.unshift(...o), i.background = a.background ?? i.background, i.templateId = we, n();
|
|
4806
4837
|
}
|
|
@@ -4809,37 +4840,37 @@ function $r(e) {
|
|
|
4809
4840
|
applyToPages: ee,
|
|
4810
4841
|
create: b,
|
|
4811
4842
|
createFromPage: C,
|
|
4812
|
-
detach:
|
|
4843
|
+
detach: ae,
|
|
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:
|
|
4848
|
+
effectiveBackground: U(() => m),
|
|
4849
|
+
effectiveTemplate: U(() => p),
|
|
4850
|
+
enterEdit: P,
|
|
4851
|
+
exitEdit: ie,
|
|
4852
|
+
get: U(() => d),
|
|
4853
|
+
getByPage: U(() => _),
|
|
4823
4854
|
import: y,
|
|
4824
|
-
isContainer:
|
|
4855
|
+
isContainer: U(() => g),
|
|
4825
4856
|
list: s,
|
|
4826
4857
|
remove: k,
|
|
4827
4858
|
rename: w,
|
|
4828
|
-
resolveFor:
|
|
4859
|
+
resolveFor: U(() => f),
|
|
4829
4860
|
syncPageDimensions: N,
|
|
4830
4861
|
update: T,
|
|
4831
|
-
updatePage:
|
|
4832
|
-
usageCount:
|
|
4862
|
+
updatePage: F,
|
|
4863
|
+
usageCount: U(() => h)
|
|
4833
4864
|
};
|
|
4834
4865
|
})();
|
|
4835
4866
|
}
|
|
4836
4867
|
// src/designer/stores/tutorial-store.ts
|
|
4837
|
-
function
|
|
4838
|
-
return
|
|
4839
|
-
let t =
|
|
4868
|
+
function ri(e) {
|
|
4869
|
+
return H("editor-tutorial", () => {
|
|
4870
|
+
let t = W("idle"), n = W(null), r = W(0), i = Ue([]), 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(() => Fn.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
|
+
Fn.find((e) => e.id === l) && t.value === "list" && e.beginSession() && (d.value = E(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(Ln(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 = Xn[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(Ln(n.value, "title")), e.view.updateSettings({
|
|
4870
4901
|
previewWithData: !1,
|
|
4871
4902
|
showMargins: !0
|
|
4872
4903
|
}), r.value = i) : y(!1));
|
|
@@ -4886,7 +4917,7 @@ function ei(e) {
|
|
|
4886
4917
|
function C(e) {
|
|
4887
4918
|
l.value = Math.max(200, e);
|
|
4888
4919
|
}
|
|
4889
|
-
return
|
|
4920
|
+
return Be(() => y(!1)), {
|
|
4890
4921
|
close: m,
|
|
4891
4922
|
course: f,
|
|
4892
4923
|
courseId: n,
|
|
@@ -4912,85 +4943,105 @@ function ei(e) {
|
|
|
4912
4943
|
})();
|
|
4913
4944
|
}
|
|
4914
4945
|
// src/designer/stores/ui-store.ts
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4946
|
+
var ii = "print-studio:theme-mode";
|
|
4947
|
+
function ai(e, t) {
|
|
4948
|
+
try {
|
|
4949
|
+
let t = e ? e.get(ii) : localStorage.getItem(ii);
|
|
4950
|
+
return t === "light" || t === "dark" || t === "system" ? t : "dark";
|
|
4951
|
+
} catch (e) {
|
|
4952
|
+
return t(e), "dark";
|
|
4953
|
+
}
|
|
4954
|
+
}
|
|
4955
|
+
function oi(e) {
|
|
4956
|
+
return H("editor-ui", ({ action: t }) => {
|
|
4957
|
+
let n = W(e.persistPreferences === !1 ? "dark" : ai(e.preferenceStorage, e.capturePreferenceError));
|
|
4958
|
+
function r() {
|
|
4959
|
+
n.value = e.persistPreferences === !1 ? "dark" : ai(e.preferenceStorage, e.capturePreferenceError);
|
|
4960
|
+
}
|
|
4961
|
+
function i(t) {
|
|
4962
|
+
if (n.value = t, e.persistPreferences !== !1) try {
|
|
4963
|
+
e.preferenceStorage ? e.preferenceStorage.set(ii, t) : localStorage.setItem(ii, 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);
|
|
4932
4983
|
}
|
|
4933
|
-
function
|
|
4934
|
-
|
|
4984
|
+
function l() {
|
|
4985
|
+
o.value && (o.value.completed = !0);
|
|
4935
4986
|
}
|
|
4936
|
-
function
|
|
4937
|
-
|
|
4938
|
-
}
|
|
4939
|
-
let
|
|
4940
|
-
let t =
|
|
4941
|
-
return
|
|
4942
|
-
dialog:
|
|
4943
|
-
elementId:
|
|
4944
|
-
elementIds:
|
|
4945
|
-
id:
|
|
4987
|
+
function u() {
|
|
4988
|
+
o.value = null;
|
|
4989
|
+
}
|
|
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
|
-
|
|
4952
|
-
for (let e of
|
|
4953
|
-
|
|
5002
|
+
Be(() => {
|
|
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,65 +5049,68 @@ 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 ee() {
|
|
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: ee,
|
|
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 si = [
|
|
5060
5114
|
{
|
|
5061
5115
|
color: "var(--color-canvas)",
|
|
5062
5116
|
id: "default",
|
|
@@ -5092,24 +5146,24 @@ var ni = [
|
|
|
5092
5146
|
return S("designer.canvasBackground.lightGrayLabel");
|
|
5093
5147
|
}
|
|
5094
5148
|
}
|
|
5095
|
-
],
|
|
5096
|
-
function
|
|
5097
|
-
return e === "custom" ||
|
|
5149
|
+
], ci = "#4d4d4d";
|
|
5150
|
+
function li(e) {
|
|
5151
|
+
return e === "custom" || si.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 ui(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: []
|
|
5112
|
-
}), p =
|
|
5166
|
+
}), p = Ve({
|
|
5113
5167
|
clickToCreate: !1,
|
|
5114
5168
|
gridSize: 5,
|
|
5115
5169
|
guidesLocked: !1,
|
|
@@ -5123,7 +5177,7 @@ function ai(e) {
|
|
|
5123
5177
|
snapToGrid: !1,
|
|
5124
5178
|
snapToGuides: !0,
|
|
5125
5179
|
snapToMargins: !0
|
|
5126
|
-
}), m =
|
|
5180
|
+
}), m = Ve({
|
|
5127
5181
|
spacing: null,
|
|
5128
5182
|
target: "selection"
|
|
5129
5183
|
});
|
|
@@ -5150,24 +5204,24 @@ 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() : ci;
|
|
5208
|
+
if (li(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: ci,
|
|
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 =
|
|
5170
|
-
function
|
|
5223
|
+
let T = U(() => C.value.preset), E = U(() => C.value.customColor), O = U(() => C.value.preset === "custom" ? C.value.customColor : si.find((e) => e.id === C.value.preset)?.color ?? "#4d4d4d");
|
|
5224
|
+
function k(t, n) {
|
|
5171
5225
|
if (C.value = {
|
|
5172
5226
|
customColor: t === "custom" ? n ?? C.value.customColor : C.value.customColor,
|
|
5173
5227
|
preset: t
|
|
@@ -5178,7 +5232,7 @@ function ai(e) {
|
|
|
5178
5232
|
} catch {}
|
|
5179
5233
|
}
|
|
5180
5234
|
}
|
|
5181
|
-
let
|
|
5235
|
+
let A = U(() => 96 / 25.4 * i.value), j = 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
|
-
}),
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5268
|
+
}), M = U(() => j.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
|
+
})), N = U(() => new Map(M.value.map((e) => [e.page.id, e]))), ee = U(() => function(e) {
|
|
5276
|
+
return N.value.get(e);
|
|
5277
|
+
}), P = U(() => function(e) {
|
|
5278
|
+
let t = N.value.get(e);
|
|
5279
|
+
return t ? {
|
|
5280
|
+
x: t.x,
|
|
5281
|
+
y: t.y
|
|
5282
|
+
} : void 0;
|
|
5283
|
+
}), te = U(() => function(e, t) {
|
|
5284
|
+
let n = P.value(e);
|
|
5285
|
+
return n ? bn(n, t) : void 0;
|
|
5286
|
+
}), ne = U(() => function(e, t) {
|
|
5287
|
+
let n = P.value(e);
|
|
5288
|
+
return n ? xn(n, t) : void 0;
|
|
5289
|
+
}), re = U(() => {
|
|
5290
|
+
let e = M.value;
|
|
5218
5291
|
if (e.length === 0) return {
|
|
5219
5292
|
height: 1e3,
|
|
5220
5293
|
width: 1e3
|
|
@@ -5224,59 +5297,62 @@ 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
|
+
}), F = U(() => {
|
|
5301
|
+
let e = M.value;
|
|
5302
|
+
return e.length === 0 ? null : D(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 I(t) {
|
|
5237
5310
|
a.value = t, t !== "select" && e.selection.setEditingId(null);
|
|
5238
5311
|
}
|
|
5239
|
-
function
|
|
5240
|
-
i.value = L(
|
|
5312
|
+
function ie(e) {
|
|
5313
|
+
i.value = V(L(e, 4), .05, 8);
|
|
5241
5314
|
}
|
|
5242
|
-
function
|
|
5315
|
+
function ae(e) {
|
|
5243
5316
|
u.value = e;
|
|
5244
5317
|
}
|
|
5245
|
-
function
|
|
5318
|
+
function oe(e) {
|
|
5246
5319
|
d.value = e;
|
|
5247
5320
|
}
|
|
5248
|
-
function
|
|
5321
|
+
function se(e) {
|
|
5249
5322
|
f.value = e;
|
|
5250
5323
|
}
|
|
5251
5324
|
return {
|
|
5252
5325
|
activeTool: a,
|
|
5253
5326
|
alignPanel: m,
|
|
5254
|
-
canvasBackground:
|
|
5327
|
+
canvasBackground: O,
|
|
5255
5328
|
canvasBackgroundPreset: T,
|
|
5256
|
-
contentSizeMm:
|
|
5329
|
+
contentSizeMm: re,
|
|
5257
5330
|
cursorContent: s,
|
|
5258
5331
|
customCanvasColor: E,
|
|
5259
5332
|
draggingGuide: d,
|
|
5260
|
-
getLayout:
|
|
5333
|
+
getLayout: ee,
|
|
5261
5334
|
marquee: u,
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5335
|
+
originOf: P,
|
|
5336
|
+
pageLayouts: M,
|
|
5337
|
+
pagesBoundsMm: F,
|
|
5338
|
+
pxPerMm: A,
|
|
5265
5339
|
restorePreferences: w,
|
|
5266
5340
|
scrollPos: c,
|
|
5267
|
-
setCanvasBackground:
|
|
5341
|
+
setCanvasBackground: k,
|
|
5268
5342
|
setCursorContent: v,
|
|
5269
|
-
setDraggingGuide:
|
|
5270
|
-
setMarquee:
|
|
5343
|
+
setDraggingGuide: oe,
|
|
5344
|
+
setMarquee: ae,
|
|
5271
5345
|
setScrollPos: y,
|
|
5272
|
-
setSnapLines:
|
|
5346
|
+
setSnapLines: se,
|
|
5273
5347
|
setSpacePanning: _,
|
|
5274
5348
|
settings: p,
|
|
5275
|
-
setTool:
|
|
5349
|
+
setTool: I,
|
|
5276
5350
|
setViewportSize: b,
|
|
5277
|
-
setZoom:
|
|
5351
|
+
setZoom: ie,
|
|
5278
5352
|
snapLines: f,
|
|
5279
5353
|
spacePanning: o,
|
|
5354
|
+
toGlobal: ne,
|
|
5355
|
+
toLocal: te,
|
|
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 di = 2e3;
|
|
5365
|
+
function fi(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 pi(e = di) {
|
|
5369
|
+
return fi(e), {
|
|
5294
5370
|
currentZIndex: e,
|
|
5295
5371
|
entries: [],
|
|
5296
5372
|
initialZIndex: e,
|
|
5297
5373
|
sequence: 0
|
|
5298
5374
|
};
|
|
5299
5375
|
}
|
|
5300
|
-
var
|
|
5376
|
+
var mi = 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
|
+
fi(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 fi(e), this.state.currentZIndex = e, e;
|
|
5331
5407
|
}
|
|
5332
5408
|
open(e = {}) {
|
|
5333
5409
|
let t = e.zIndex ?? this.nextZIndex();
|
|
5334
|
-
|
|
5410
|
+
fi(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 =
|
|
5420
|
+
function hi() {
|
|
5421
|
+
return H("editor-z-index", () => {
|
|
5422
|
+
let e = Ve(pi()), t = new mi(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 gi(e = {}) {
|
|
5454
|
+
return H("editor", () => {
|
|
5455
|
+
let t = ir(), n = Zr({
|
|
5380
5456
|
config: t,
|
|
5381
5457
|
elements: e.elements,
|
|
5382
5458
|
parsers: e.parsers
|
|
5383
|
-
}), r =
|
|
5459
|
+
}), r = oi({
|
|
5460
|
+
capturePreferenceError(t) {
|
|
5461
|
+
(e.errors ?? sn()).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 = Yr(e.persistPreferences, e.preferenceStorage), a = Xr(), o = hi(), s = vr({
|
|
5391
5472
|
...e,
|
|
5392
5473
|
beginPreviewHistory() {
|
|
5393
5474
|
c.beginPreview();
|
|
@@ -5413,7 +5494,7 @@ function di(e = {}) {
|
|
|
5413
5494
|
O(!0);
|
|
5414
5495
|
},
|
|
5415
5496
|
ui: r
|
|
5416
|
-
}), c =
|
|
5497
|
+
}), c = Fr({
|
|
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 = Ir({ document: s }), u = Rr({
|
|
5425
5506
|
document: s,
|
|
5426
5507
|
elements: e.elements,
|
|
5427
5508
|
history: c,
|
|
5428
5509
|
ui: r
|
|
5429
|
-
}), d =
|
|
5510
|
+
}), d = ni({
|
|
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 = $r([{
|
|
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 = Nr({
|
|
5457
5538
|
history: c,
|
|
5458
5539
|
scope: f
|
|
5459
|
-
}), m =
|
|
5540
|
+
}), m = ti({
|
|
5460
5541
|
document: s,
|
|
5461
5542
|
guide: p,
|
|
5462
5543
|
scope: f
|
|
5463
|
-
}), h =
|
|
5544
|
+
}), h = ui({
|
|
5464
5545
|
persistPreferences: e.persistPreferences,
|
|
5465
5546
|
preferenceStorage: e.preferenceStorage,
|
|
5466
5547
|
scope: f,
|
|
5467
5548
|
selection: m
|
|
5468
|
-
}), g =
|
|
5549
|
+
}), g = jr({
|
|
5469
5550
|
document: s,
|
|
5470
5551
|
elements: e.elements,
|
|
5471
5552
|
history: c,
|
|
@@ -5473,13 +5554,13 @@ function di(e = {}) {
|
|
|
5473
5554
|
scope: f,
|
|
5474
5555
|
selection: m,
|
|
5475
5556
|
ui: r
|
|
5476
|
-
}), _ =
|
|
5557
|
+
}), _ = yr({
|
|
5477
5558
|
document: s,
|
|
5478
5559
|
element: g,
|
|
5479
5560
|
history: c,
|
|
5480
5561
|
scope: f,
|
|
5481
5562
|
selection: m
|
|
5482
|
-
}), v =
|
|
5563
|
+
}), v = rr({
|
|
5483
5564
|
document: s,
|
|
5484
5565
|
element: g,
|
|
5485
5566
|
elements: e.elements,
|
|
@@ -5487,36 +5568,36 @@ function di(e = {}) {
|
|
|
5487
5568
|
scope: f,
|
|
5488
5569
|
selection: m,
|
|
5489
5570
|
ui: r
|
|
5490
|
-
}), y =
|
|
5571
|
+
}), y = ar({
|
|
5491
5572
|
document: s,
|
|
5492
5573
|
history: c
|
|
5493
|
-
}), b =
|
|
5574
|
+
}), b = Mr({
|
|
5494
5575
|
document: s,
|
|
5495
5576
|
history: c,
|
|
5496
5577
|
selection: m,
|
|
5497
5578
|
ui: r
|
|
5498
|
-
}), x =
|
|
5579
|
+
}), x = Qr({
|
|
5499
5580
|
document: s,
|
|
5500
5581
|
element: g,
|
|
5501
5582
|
history: c,
|
|
5502
5583
|
page: u,
|
|
5503
5584
|
selection: m,
|
|
5504
5585
|
ui: r
|
|
5505
|
-
}), C =
|
|
5586
|
+
}), C = Zn({
|
|
5506
5587
|
document: s,
|
|
5507
5588
|
elements: e.elements,
|
|
5508
5589
|
repeatGroup: x,
|
|
5509
5590
|
scope: f,
|
|
5510
5591
|
template: d,
|
|
5511
5592
|
view: h
|
|
5512
|
-
}), w =
|
|
5593
|
+
}), w = Lr({
|
|
5513
5594
|
scope: f,
|
|
5514
5595
|
selection: m,
|
|
5515
5596
|
template: d,
|
|
5516
5597
|
ui: r
|
|
5517
|
-
}), T =
|
|
5598
|
+
}), T = W(null), E = ri({
|
|
5518
5599
|
beginSession() {
|
|
5519
|
-
return s.saving ? (r.toast(S("designer.tutorial.waitForSave")), !1) : (T.value = D(), c.beginTemporary(), s.beginTemporary(
|
|
5600
|
+
return s.saving ? (r.toast(S("designer.tutorial.waitForSave")), !1) : (T.value = D(), c.beginTemporary(), s.beginTemporary(In()), h.setTool("select"), !0);
|
|
5520
5601
|
},
|
|
5521
5602
|
dataSource: y,
|
|
5522
5603
|
document: s,
|
|
@@ -5590,12 +5671,12 @@ function di(e = {}) {
|
|
|
5590
5671
|
view: h,
|
|
5591
5672
|
zIndex: o
|
|
5592
5673
|
};
|
|
5593
|
-
return
|
|
5674
|
+
return Be(() => {
|
|
5594
5675
|
for (let e of Object.values(k)) e.$dispose();
|
|
5595
5676
|
}), k;
|
|
5596
5677
|
});
|
|
5597
5678
|
}
|
|
5598
|
-
var
|
|
5679
|
+
var _i = gi(), vi = 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,33 +5717,33 @@ 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
|
+
}, yi = /* @__PURE__ */ e({
|
|
5721
|
+
bindEditorView: () => xi,
|
|
5722
|
+
disposeEditorView: () => Si
|
|
5723
|
+
}), bi = /* @__PURE__ */ new WeakMap();
|
|
5724
|
+
function xi(e, t) {
|
|
5725
|
+
if (bi.has(e)) throw Error("A designer is already mounted for this editor context");
|
|
5645
5726
|
let n = e.root;
|
|
5646
|
-
return
|
|
5647
|
-
|
|
5727
|
+
return bi.set(e, t), e.root = t.root, () => {
|
|
5728
|
+
bi.get(e) === t && (bi.delete(e), e.root = n);
|
|
5648
5729
|
};
|
|
5649
5730
|
}
|
|
5650
|
-
function
|
|
5651
|
-
|
|
5731
|
+
function Si(e) {
|
|
5732
|
+
bi.get(e)?.dispose();
|
|
5652
5733
|
}
|
|
5653
5734
|
// src/designer/context/editor-runtime.ts
|
|
5654
|
-
var
|
|
5655
|
-
EditorContextKey: () =>
|
|
5656
|
-
createEditorRuntime: () =>
|
|
5657
|
-
}),
|
|
5658
|
-
function
|
|
5659
|
-
let n =
|
|
5735
|
+
var Ci = /* @__PURE__ */ e({
|
|
5736
|
+
EditorContextKey: () => wi,
|
|
5737
|
+
createEditorRuntime: () => Ti
|
|
5738
|
+
}), wi = Symbol("editor-context");
|
|
5739
|
+
function Ti(e = {}, t) {
|
|
5740
|
+
let n = Re() ? void 0 : Ie(), r = Pe(), i = new Ge(), a = e.errors ?? m(), o = g(), s = new bt(), c = new yn(e.persistPreferences ? e.preferenceStorage ?? {
|
|
5660
5741
|
get: (e) => localStorage.getItem(e),
|
|
5661
5742
|
set: (e, t) => localStorage.setItem(e, t)
|
|
5662
5743
|
} : void 0), l, u;
|
|
5663
5744
|
try {
|
|
5664
5745
|
u = Gt();
|
|
5665
|
-
let n = y(Kt(e)), d =
|
|
5746
|
+
let n = y(Kt(e)), d = gi({
|
|
5666
5747
|
...e,
|
|
5667
5748
|
...n,
|
|
5668
5749
|
errors: a,
|
|
@@ -5670,11 +5751,11 @@ function bi(e = {}, t) {
|
|
|
5670
5751
|
preferenceStorage: c,
|
|
5671
5752
|
storage: e.storage ?? !1
|
|
5672
5753
|
})(r);
|
|
5673
|
-
|
|
5754
|
+
_n(d, n.elements), hn(d, a), On(d), d.config.configure(e);
|
|
5674
5755
|
let f = !1, p = {
|
|
5675
5756
|
commands: new Je(() => p, i),
|
|
5676
5757
|
dispose() {
|
|
5677
|
-
f ||= (
|
|
5758
|
+
f ||= (Si(p), p.plugins.close(), u?.(), o.dispose(), i.offAll(), Fe(r), !0);
|
|
5678
5759
|
},
|
|
5679
5760
|
elements: n.elements,
|
|
5680
5761
|
errors: a,
|
|
@@ -5690,13 +5771,13 @@ function bi(e = {}, t) {
|
|
|
5690
5771
|
},
|
|
5691
5772
|
output: o,
|
|
5692
5773
|
parsers: n.parsers,
|
|
5693
|
-
plugins: new
|
|
5774
|
+
plugins: new nn(() => p, e.pluginPolicy),
|
|
5694
5775
|
preferences: c,
|
|
5695
5776
|
store() {
|
|
5696
5777
|
if (f) throw Error("Designer has been disposed");
|
|
5697
5778
|
return d;
|
|
5698
5779
|
},
|
|
5699
|
-
templateLibrary: new
|
|
5780
|
+
templateLibrary: new vi(),
|
|
5700
5781
|
get use() {
|
|
5701
5782
|
return p.plugins.use.bind(p.plugins);
|
|
5702
5783
|
},
|
|
@@ -5706,38 +5787,38 @@ function bi(e = {}, t) {
|
|
|
5706
5787
|
};
|
|
5707
5788
|
return l = p, _t(p), t?.(p), p;
|
|
5708
5789
|
} catch (e) {
|
|
5709
|
-
throw l ? l.dispose?.() : (u?.(), o.dispose(), i.offAll(),
|
|
5790
|
+
throw l ? l.dispose?.() : (u?.(), o.dispose(), i.offAll(), Fe(r)), e;
|
|
5710
5791
|
} finally {
|
|
5711
|
-
|
|
5792
|
+
Le(n);
|
|
5712
5793
|
}
|
|
5713
5794
|
}
|
|
5714
5795
|
// 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(),
|
|
5796
|
+
var Ei = /* @__PURE__ */ e({
|
|
5797
|
+
bindStudioContext: () => Ai,
|
|
5798
|
+
getStudioContext: () => ji,
|
|
5799
|
+
onStudioDispose: () => ki,
|
|
5800
|
+
unbindStudioContext: () => Mi
|
|
5801
|
+
}), Di = /* @__PURE__ */ new WeakMap(), Oi = /* @__PURE__ */ new WeakMap();
|
|
5802
|
+
function ki(e, t) {
|
|
5803
|
+
ji(e);
|
|
5804
|
+
let n = Oi.get(e);
|
|
5805
|
+
return n || (n = /* @__PURE__ */ new Set(), Oi.set(e, n)), n.add(t), () => {
|
|
5725
5806
|
n.delete(t);
|
|
5726
5807
|
};
|
|
5727
5808
|
}
|
|
5728
|
-
function
|
|
5729
|
-
|
|
5809
|
+
function Ai(e, t) {
|
|
5810
|
+
Di.set(e, t);
|
|
5730
5811
|
}
|
|
5731
|
-
function
|
|
5732
|
-
let t =
|
|
5812
|
+
function ji(e) {
|
|
5813
|
+
let t = Di.get(e);
|
|
5733
5814
|
if (!t) throw Error("Unknown print studio instance");
|
|
5734
5815
|
return t.store(), t;
|
|
5735
5816
|
}
|
|
5736
|
-
function
|
|
5737
|
-
let t =
|
|
5738
|
-
|
|
5817
|
+
function Mi(e) {
|
|
5818
|
+
let t = Oi.get(e);
|
|
5819
|
+
Oi.delete(e);
|
|
5739
5820
|
for (let e of t ?? []) e();
|
|
5740
|
-
|
|
5821
|
+
Di.delete(e);
|
|
5741
5822
|
}
|
|
5742
5823
|
// src/designer/facade/entities.ts
|
|
5743
5824
|
function Q(e) {
|
|
@@ -5747,7 +5828,7 @@ function Q(e) {
|
|
|
5747
5828
|
function $(e) {
|
|
5748
5829
|
return typeof e == "string" ? e : e.id;
|
|
5749
5830
|
}
|
|
5750
|
-
function
|
|
5831
|
+
function Ni(e) {
|
|
5751
5832
|
let t = !1, n = 0;
|
|
5752
5833
|
function r() {
|
|
5753
5834
|
if (t) throw Error("Print studio facade has been disposed");
|
|
@@ -5779,7 +5860,7 @@ function Oi(e) {
|
|
|
5779
5860
|
store: r
|
|
5780
5861
|
};
|
|
5781
5862
|
}
|
|
5782
|
-
function
|
|
5863
|
+
function Pi(e, t, n) {
|
|
5783
5864
|
function r(t) {
|
|
5784
5865
|
return e.store(), n.list().find((e) => e.id === $(t));
|
|
5785
5866
|
}
|
|
@@ -5826,21 +5907,14 @@ function ki(e, t, n) {
|
|
|
5826
5907
|
};
|
|
5827
5908
|
}
|
|
5828
5909
|
// src/designer/facade/editing.ts
|
|
5829
|
-
|
|
5830
|
-
h: "hcenter",
|
|
5831
|
-
v: "vcenter"
|
|
5832
|
-
};
|
|
5833
|
-
function ji(e) {
|
|
5910
|
+
function Fi(e) {
|
|
5834
5911
|
return {
|
|
5835
5912
|
edit: {
|
|
5836
5913
|
align: (t, n) => e.command("element.align", t, n),
|
|
5837
5914
|
copy: () => e.command("edit.copy"),
|
|
5838
5915
|
cut: () => e.command("edit.cut"),
|
|
5839
5916
|
delete: () => e.command("edit.delete"),
|
|
5840
|
-
distribute: (t, n) =>
|
|
5841
|
-
let r = Ai[t] ?? t;
|
|
5842
|
-
return e.command("element.distribute", r, n);
|
|
5843
|
-
},
|
|
5917
|
+
distribute: (t, n) => e.command("element.distribute", t, n),
|
|
5844
5918
|
distributeSpacing: (t, n) => e.command("element.distributeSpacing", t, n),
|
|
5845
5919
|
duplicate: () => e.command("edit.duplicate"),
|
|
5846
5920
|
nudge: (t, n) => e.command("element.nudge", t, n),
|
|
@@ -5862,13 +5936,13 @@ function ji(e) {
|
|
|
5862
5936
|
};
|
|
5863
5937
|
}
|
|
5864
5938
|
// src/designer/facade/elements.ts
|
|
5865
|
-
function
|
|
5939
|
+
function Ii(e, t, n) {
|
|
5866
5940
|
function r(n) {
|
|
5867
5941
|
let r = $(n);
|
|
5868
5942
|
if (!e.store().element.getByPage(t).some((e) => e.id === r)) throw Error(`Element not found on page ${t}: ${r}`);
|
|
5869
5943
|
return r;
|
|
5870
5944
|
}
|
|
5871
|
-
let i =
|
|
5945
|
+
let i = Pi(e, "element", {
|
|
5872
5946
|
list: () => e.store().element.getByPage(t),
|
|
5873
5947
|
remove: (t) => e.command("element.removeIds", [t]),
|
|
5874
5948
|
update: (t, n) => e.command("element.update", t, n)
|
|
@@ -5929,7 +6003,7 @@ function Mi(e, t, n) {
|
|
|
5929
6003
|
};
|
|
5930
6004
|
}
|
|
5931
6005
|
// src/designer/facade/output.ts
|
|
5932
|
-
function
|
|
6006
|
+
function Li(e) {
|
|
5933
6007
|
function t(t, n, r) {
|
|
5934
6008
|
return e.command("output.html", t, n, r);
|
|
5935
6009
|
}
|
|
@@ -5949,8 +6023,8 @@ function Ni(e) {
|
|
|
5949
6023
|
};
|
|
5950
6024
|
}
|
|
5951
6025
|
// src/designer/facade/pages.ts
|
|
5952
|
-
function
|
|
5953
|
-
let n =
|
|
6026
|
+
function Ri(e, t) {
|
|
6027
|
+
let n = Pi(e, "page", {
|
|
5954
6028
|
list: () => e.store().page.list,
|
|
5955
6029
|
remove: (t) => e.command("page.remove", t),
|
|
5956
6030
|
update: (t, n) => e.command("page.update", t, n)
|
|
@@ -5961,7 +6035,7 @@ function Pi(e, t) {
|
|
|
5961
6035
|
get data() {
|
|
5962
6036
|
return i.data;
|
|
5963
6037
|
},
|
|
5964
|
-
elements:
|
|
6038
|
+
elements: Ii(e, i.id, t),
|
|
5965
6039
|
id: i.id,
|
|
5966
6040
|
remove: i.remove,
|
|
5967
6041
|
update: i.update
|
|
@@ -5994,8 +6068,8 @@ function Pi(e, t) {
|
|
|
5994
6068
|
};
|
|
5995
6069
|
}
|
|
5996
6070
|
// src/designer/facade/state.ts
|
|
5997
|
-
function
|
|
5998
|
-
let n = t.store(), r = /* @__PURE__ */ new Set(), i =
|
|
6071
|
+
function zi(e, t) {
|
|
6072
|
+
let n = t.store(), r = /* @__PURE__ */ new Set(), i = U(() => Object.freeze({
|
|
5999
6073
|
activePageId: n.page.active?.id,
|
|
6000
6074
|
canRedo: n.history.canRedo,
|
|
6001
6075
|
canUndo: n.history.canUndo,
|
|
@@ -6028,12 +6102,12 @@ function Fi(e, t) {
|
|
|
6028
6102
|
};
|
|
6029
6103
|
}
|
|
6030
6104
|
// src/designer/facade/print-studio.ts
|
|
6031
|
-
function
|
|
6032
|
-
let r = !1, i, a = !1, o = !1, s =
|
|
6105
|
+
function Bi(e, t = {}, n) {
|
|
6106
|
+
let r = !1, i, a = !1, o = !1, s = Ni(e), c = zi(e, s), l = t.defaultElementType ?? "text", u = Ri(s, l), d = Pi(s, "template", {
|
|
6033
6107
|
list: () => s.store().template.list,
|
|
6034
6108
|
remove: (e) => s.command("template.remove", e),
|
|
6035
6109
|
update: (e, t) => s.command("template.update", e, t)
|
|
6036
|
-
}), f =
|
|
6110
|
+
}), f = Pi(s, "repeatGroup", {
|
|
6037
6111
|
list: () => s.store().repeatGroup.list,
|
|
6038
6112
|
remove: (e) => s.command("repeatGroup.remove", e),
|
|
6039
6113
|
update: (e, t) => {
|
|
@@ -6049,7 +6123,7 @@ function Ii(e, t = {}, n) {
|
|
|
6049
6123
|
if (t && t.id !== n) throw Error(`Element already belongs to repeat group: ${a}`);
|
|
6050
6124
|
}
|
|
6051
6125
|
}
|
|
6052
|
-
let m =
|
|
6126
|
+
let m = Pi(s, "followBlock", {
|
|
6053
6127
|
list: () => s.store().followBlock.list,
|
|
6054
6128
|
remove: (e) => s.command("followBlock.remove", e),
|
|
6055
6129
|
update: (e, t) => {
|
|
@@ -6069,7 +6143,7 @@ function Ii(e, t = {}, n) {
|
|
|
6069
6143
|
let e = s.store().template.getByPage(i), t = e?.page.id === i ? e.page : e?.evenPage;
|
|
6070
6144
|
return t ? E(t) : void 0;
|
|
6071
6145
|
},
|
|
6072
|
-
elements:
|
|
6146
|
+
elements: Ii(s, i, l),
|
|
6073
6147
|
id: i,
|
|
6074
6148
|
update(e) {
|
|
6075
6149
|
s.run("template.updatePage", () => s.command("template.updatePage", i, E(e)));
|
|
@@ -6094,18 +6168,18 @@ function Ii(e, t = {}, n) {
|
|
|
6094
6168
|
};
|
|
6095
6169
|
}
|
|
6096
6170
|
function _() {
|
|
6097
|
-
r || (r = !0, v(), c.dispose(), s.dispose(),
|
|
6171
|
+
r || (r = !0, v(), c.dispose(), s.dispose(), Mi(x), n?.());
|
|
6098
6172
|
}
|
|
6099
6173
|
function v(e = i) {
|
|
6100
6174
|
!e && a ? o = !0 : (e?.unmount(), i === e && (i = void 0));
|
|
6101
6175
|
}
|
|
6102
6176
|
async function y(e) {
|
|
6103
6177
|
if (r) throw Error("Print studio has been disposed");
|
|
6104
|
-
if (a ||
|
|
6178
|
+
if (a || ji(x).root) throw Error("A designer is already mounted for this studio");
|
|
6105
6179
|
let t = b(e.el);
|
|
6106
6180
|
a = !0;
|
|
6107
6181
|
try {
|
|
6108
|
-
let {
|
|
6182
|
+
let { attachDesigner: n } = await import("./mount-print-designer-DnHTrBE9.js").then((e) => e.n);
|
|
6109
6183
|
if (r) throw Error("Print studio has been disposed");
|
|
6110
6184
|
if (o) throw new DOMException("Designer unmounted before ready", "AbortError");
|
|
6111
6185
|
let s = n(t, {
|
|
@@ -6227,18 +6301,18 @@ function Ii(e, t = {}, n) {
|
|
|
6227
6301
|
},
|
|
6228
6302
|
unmount: () => v(),
|
|
6229
6303
|
use: e.plugins.use.bind(e.plugins),
|
|
6230
|
-
...
|
|
6231
|
-
...
|
|
6304
|
+
...Li(s),
|
|
6305
|
+
...Fi(s)
|
|
6232
6306
|
};
|
|
6233
|
-
return
|
|
6307
|
+
return Ai(x, e), ze(x);
|
|
6234
6308
|
}
|
|
6235
6309
|
// src/studio.ts
|
|
6236
|
-
function
|
|
6237
|
-
let t =
|
|
6310
|
+
function Vi(e = {}) {
|
|
6311
|
+
let t = Ti(e);
|
|
6238
6312
|
try {
|
|
6239
|
-
return
|
|
6313
|
+
return Bi(t, e, () => t.dispose?.());
|
|
6240
6314
|
} catch (e) {
|
|
6241
6315
|
throw t.dispose?.(), e;
|
|
6242
6316
|
}
|
|
6243
6317
|
}
|
|
6244
|
-
export { Ht as A, bt as B,
|
|
6318
|
+
export { Ht as A, bt as B, dn as C, Jt as D, qt as E, Rt as F, Je as G, _t as H, jt as I, qe as K, zt as L, Bt as M, J as N, Yt as O, At as P, Mt as R, vn as S, nn as T, Ye as U, yt as V, Xe as W, Gn as _, ki as a, yn as b, Ci as c, _i as d, si as f, Ln as g, Fn as h, ji as i, Ut as j, Vt as k, yi as l, Vn as m, Bi as n, wi as o, hr as p, Ei as r, Ti as s, Vi as t, vi as u, Dn as v, sn as w, fn as x, Cn as y, Et as z };
|