@printstack/print-studio 0.1.0 → 0.1.1
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 +7 -0
- package/assets/{render.worker-Cfbk18NW.js → render.worker-Ch4qWx3S.js} +2 -2
- package/{cloneDeep-C5UZRjbH.js → cloneDeep-PCw2ErRl.js} +1 -0
- package/components/print-s-logo/print-s-logo.vue.d.ts +1 -1
- package/core.js +2 -2
- package/designer/components/dialogs/preview-dialog.vue.d.ts +10 -1
- package/designer/components/dialogs/print-preview-dialog.vue.d.ts +14 -0
- package/designer/components/dialogs/print-preview-source.d.ts +22 -0
- package/designer/components/dialogs/use-document-preview.d.ts +5 -1
- package/designer/components/dialogs/use-preview-renderer.d.ts +2 -0
- package/designer/components/dialogs/use-print-preview.d.ts +33 -0
- package/designer/facade/output.d.ts +2 -2
- package/designer/frame/print-designer-frame.vue.d.ts +2 -2
- package/designer/frame/shared.d.ts +2 -0
- package/designer/frame/view.d.ts +7 -0
- package/designer/mount-print-preview.d.ts +5 -0
- package/designer/print-designer.vue.d.ts +2 -2
- package/designer/print-preview.vue.d.ts +4 -0
- package/designer.js +2 -2
- package/{document-model-DC9sn2WV.js → document-model-GhFP9OGp.js} +1 -1
- package/host-CuGR8rD6.js +123 -0
- package/index.js +5 -5
- package/locales/runtime.d.ts +1 -0
- package/locales/translations/zh-CN/app.json.d.ts +1 -0
- package/{mount-print-designer-BzHLGlv-.js → mount-print-designer-BLgVZOnm.js} +3 -2
- package/mount-print-preview-D7M-1AqH.js +65 -0
- package/package.json +1 -1
- package/presets-D3WhkbZK.js +13 -0
- package/{registries-BOU8RLim.js → registries-dZq8MewR.js} +31 -15
- package/runtime/browser-output.d.ts +2 -0
- package/runtime.js +4 -4
- package/{saas-B3fJOgHX.js → saas-B1H161e1.js} +1 -1
- package/saas.js +1 -1
- package/{studio-C_rqbJ9q.js → studio-BFQYHZsg.js} +53 -51
- package/studio-types.d.ts +2 -1
- package/vue.js +274 -273
- package/presets-Cwp20ef6.js +0 -133
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { S as t } from "./document-model-
|
|
3
|
-
import { V as n, t as r, z as i } from "./studio-
|
|
1
|
+
import { Z as e } from "./registries-dZq8MewR.js";
|
|
2
|
+
import { S as t } from "./document-model-GhFP9OGp.js";
|
|
3
|
+
import { V as n, t as r, z as i } from "./studio-BFQYHZsg.js";
|
|
4
4
|
import { t as a } from "./types-Vh_6jhVV.js";
|
|
5
|
-
import { B as o } from "./cloneDeep-
|
|
6
|
-
import { i as s, n as c, r as l, t as u } from "./saas-
|
|
5
|
+
import { B as o } from "./cloneDeep-PCw2ErRl.js";
|
|
6
|
+
import { i as s, n as c, r as l, t as u } from "./saas-B1H161e1.js";
|
|
7
7
|
// src/designer/plugins/sandbox-plugin.ts
|
|
8
8
|
function d(e) {
|
|
9
9
|
let t = new URL(e.url, globalThis.location?.href);
|
package/locales/runtime.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { n as e } from "./rolldown-runtime-QGRDbDUS.js";
|
|
2
|
-
import { a as t, i as n, t as r } from "./studio-
|
|
3
|
-
import {
|
|
2
|
+
import { a as t, i as n, t as r } from "./studio-BFQYHZsg.js";
|
|
3
|
+
import { t as i } from "./host-CuGR8rD6.js";
|
|
4
|
+
import { t as a } from "./presets-D3WhkbZK.js";
|
|
4
5
|
// src/designer/mount-print-designer.ts
|
|
5
6
|
var o = /* @__PURE__ */ e({ mountPrintDesigner: () => c }), s = /* @__PURE__ */ new WeakMap();
|
|
6
7
|
function c(e, o = {}) {
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { P as e, t } from "./cloneDeep-PCw2ErRl.js";
|
|
2
|
+
import { X as n } from "./registries-dZq8MewR.js";
|
|
3
|
+
import { t as r } from "./host-CuGR8rD6.js";
|
|
4
|
+
// src/designer/mount-print-preview.ts
|
|
5
|
+
function i(i, a, o = {}) {
|
|
6
|
+
return n(async (n) => {
|
|
7
|
+
let s = i.store(), c = o.container ?? document.body, l = c.ownerDocument.createElement("div");
|
|
8
|
+
l.className = "print-studio-preview", l.style.cssText = o.container ? "width:100%;height:100%;position:relative" : "position:fixed;inset:0;z-index:2147483647";
|
|
9
|
+
let u = !1, d, f, p = [], m = () => {}, h;
|
|
10
|
+
function g() {
|
|
11
|
+
u || (u = !0, n.removeEventListener("abort", g), m(n.reason ?? new DOMException("Preview closed before ready", "AbortError")), d?.(), l.remove());
|
|
12
|
+
}
|
|
13
|
+
let _ = {
|
|
14
|
+
close: g,
|
|
15
|
+
get element() {
|
|
16
|
+
if (!f) throw Error("Preview is not ready");
|
|
17
|
+
return f;
|
|
18
|
+
},
|
|
19
|
+
get warnings() {
|
|
20
|
+
return p;
|
|
21
|
+
}
|
|
22
|
+
}, v = {
|
|
23
|
+
capture(e) {
|
|
24
|
+
return i.errors.capture(e, { source: "preview.render" });
|
|
25
|
+
},
|
|
26
|
+
close: g,
|
|
27
|
+
getSampleInput() {
|
|
28
|
+
return e(a.document);
|
|
29
|
+
},
|
|
30
|
+
name: a.document.name,
|
|
31
|
+
print(e) {
|
|
32
|
+
i.commands.dispatch("preview.print", e);
|
|
33
|
+
},
|
|
34
|
+
render(e, n) {
|
|
35
|
+
return s.rendering.html(t(a.document), t(e), void 0, n);
|
|
36
|
+
},
|
|
37
|
+
request: { previewInput: a.input },
|
|
38
|
+
revision: 0
|
|
39
|
+
};
|
|
40
|
+
try {
|
|
41
|
+
return h = i.output?.track(_) ?? _, n.addEventListener("abort", g, { once: !0 }), n.throwIfAborted(), c.append(l), await new Promise((e, t) => {
|
|
42
|
+
m = t, d = r(l, {
|
|
43
|
+
onDispose: g,
|
|
44
|
+
onError(e) {
|
|
45
|
+
t(e), i.errors.capture(e, { source: "preview.mount" });
|
|
46
|
+
},
|
|
47
|
+
onReady() {},
|
|
48
|
+
preview: {
|
|
49
|
+
onError: t,
|
|
50
|
+
onReady(t, n) {
|
|
51
|
+
f = t, p = n, e();
|
|
52
|
+
},
|
|
53
|
+
source: v,
|
|
54
|
+
timeoutMs: o.timeoutMs
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}), n.throwIfAborted(), h;
|
|
58
|
+
} catch (e) {
|
|
59
|
+
throw g(), e;
|
|
60
|
+
} finally {
|
|
61
|
+
n.removeEventListener("abort", g);
|
|
62
|
+
}
|
|
63
|
+
}, o);
|
|
64
|
+
}
|
|
65
|
+
export { i as mountPrintPreview };
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { B as e, t } from "./cloneDeep-PCw2ErRl.js";
|
|
2
|
+
import { s as n, u as r } from "./document-model-GhFP9OGp.js";
|
|
3
|
+
// src/designer/presets.ts
|
|
4
|
+
function i(i = {}) {
|
|
5
|
+
return {
|
|
6
|
+
dataSources: t(i.dataSources ?? []),
|
|
7
|
+
name: e("core.documentModel.defaultDocumentName"),
|
|
8
|
+
pages: [r()],
|
|
9
|
+
templates: [n()],
|
|
10
|
+
version: "1.0"
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export { i as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as e, r as t, t as n } from "./rolldown-runtime-QGRDbDUS.js";
|
|
2
|
-
import { $ as r, C as i, F as a, G as o, J as s, K as c, M as l, N as u, Q as d, R as f, S as p, T as m, U as h, W as g, X as _, Y as v, Z as y, _ as b, at as x, b as S, et as C, f as ee, it as w, k as T, l as E, o as D, ot as te, q as O, r as ne, rt as k, tt as A, v as re, w as j, x as ie, y as ae } from "./document-model-
|
|
3
|
-
import { A as M, B as N, L as oe, R as se, j as ce } from "./cloneDeep-
|
|
2
|
+
import { $ as r, C as i, F as a, G as o, J as s, K as c, M as l, N as u, Q as d, R as f, S as p, T as m, U as h, W as g, X as _, Y as v, Z as y, _ as b, at as x, b as S, et as C, f as ee, it as w, k as T, l as E, o as D, ot as te, q as O, r as ne, rt as k, tt as A, v as re, w as j, x as ie, y as ae } from "./document-model-GhFP9OGp.js";
|
|
3
|
+
import { A as M, B as N, L as oe, R as se, j as ce } from "./cloneDeep-PCw2ErRl.js";
|
|
4
4
|
// src/components/error-fallback/exceptions/SilentException.ts
|
|
5
5
|
var le = Symbol.for("portable-error-handling.SilentException"), ue = class extends Error {
|
|
6
6
|
[le] = !0;
|
|
@@ -532,7 +532,7 @@ function Re(e, t) {
|
|
|
532
532
|
function L(e) {
|
|
533
533
|
if (typeof e != "object" || !e) return !1;
|
|
534
534
|
let t = Object.getPrototypeOf(e);
|
|
535
|
-
return t === Object.prototype || t === null;
|
|
535
|
+
return t === null || t === Object.prototype || Object.getPrototypeOf(t) === null && Object.prototype.toString.call(e) === "[object Object]";
|
|
536
536
|
}
|
|
537
537
|
function ze(e) {
|
|
538
538
|
let t = [], n = /([^[.\]]+)|\[(\d+)\]/g, r;
|
|
@@ -9394,7 +9394,7 @@ var Ra = /* @__PURE__ */ e({ RenderWorkerClient: () => za }), za = class {
|
|
|
9394
9394
|
worker;
|
|
9395
9395
|
constructor(e = () => new Worker(new URL(
|
|
9396
9396
|
/* @vite-ignore */
|
|
9397
|
-
new URL("assets/render.worker-
|
|
9397
|
+
new URL("assets/render.worker-Ch4qWx3S.js", import.meta.url).href,
|
|
9398
9398
|
"" + import.meta.url
|
|
9399
9399
|
), { type: "module" })) {
|
|
9400
9400
|
this.factory = e;
|
|
@@ -9651,7 +9651,22 @@ function Ua() {
|
|
|
9651
9651
|
n.clear();
|
|
9652
9652
|
}
|
|
9653
9653
|
}
|
|
9654
|
-
|
|
9654
|
+
function a(t) {
|
|
9655
|
+
if (r) throw t.close(), Error("Print studio has been disposed");
|
|
9656
|
+
let n = {
|
|
9657
|
+
close() {
|
|
9658
|
+
t.close(), e.delete(n);
|
|
9659
|
+
},
|
|
9660
|
+
get element() {
|
|
9661
|
+
return t.element;
|
|
9662
|
+
},
|
|
9663
|
+
get warnings() {
|
|
9664
|
+
return t.warnings;
|
|
9665
|
+
}
|
|
9666
|
+
};
|
|
9667
|
+
return e.add(n), n;
|
|
9668
|
+
}
|
|
9669
|
+
async function o(n, i = {}, a = !1) {
|
|
9655
9670
|
if (r) throw Error("Print studio has been disposed");
|
|
9656
9671
|
i.signal?.throwIfAborted();
|
|
9657
9672
|
let o = new AbortController(), s = () => o.abort(i.signal?.reason);
|
|
@@ -9685,25 +9700,26 @@ function Ua() {
|
|
|
9685
9700
|
t.delete(o), i.signal?.removeEventListener("abort", s);
|
|
9686
9701
|
}
|
|
9687
9702
|
}
|
|
9688
|
-
async function
|
|
9689
|
-
let r = await
|
|
9703
|
+
async function s(e, t) {
|
|
9704
|
+
let r = await o(e, t, !0), i = r.element.contentWindow;
|
|
9690
9705
|
if (!i) throw r.close(), new M(N("core.output.windowUnavailable"), { code: "print.frame-unavailable" });
|
|
9691
|
-
function
|
|
9692
|
-
s && (clearTimeout(s), n.delete(s)), i?.removeEventListener("afterprint",
|
|
9706
|
+
function a() {
|
|
9707
|
+
s && (clearTimeout(s), n.delete(s)), i?.removeEventListener("afterprint", a), r.close();
|
|
9693
9708
|
}
|
|
9694
|
-
i.addEventListener("afterprint",
|
|
9695
|
-
let s = setTimeout(
|
|
9709
|
+
i.addEventListener("afterprint", a, { once: !0 });
|
|
9710
|
+
let s = setTimeout(a, Ha);
|
|
9696
9711
|
n.add(s);
|
|
9697
9712
|
try {
|
|
9698
9713
|
return i.focus(), i.print(), r.warnings;
|
|
9699
9714
|
} catch (e) {
|
|
9700
|
-
throw
|
|
9715
|
+
throw a(), e;
|
|
9701
9716
|
}
|
|
9702
9717
|
}
|
|
9703
9718
|
return {
|
|
9704
9719
|
dispose: i,
|
|
9705
|
-
preview:
|
|
9706
|
-
print:
|
|
9720
|
+
preview: o,
|
|
9721
|
+
print: s,
|
|
9722
|
+
track: a
|
|
9707
9723
|
};
|
|
9708
9724
|
}
|
|
9709
9725
|
// src/runtime/registries.ts
|
|
@@ -9718,4 +9734,4 @@ function Wa(e = {}) {
|
|
|
9718
9734
|
parsers: n
|
|
9719
9735
|
};
|
|
9720
9736
|
}
|
|
9721
|
-
export { ft as A, R as B, Tr as C, vt as D, mr as E, Le as F, F as G, ze as H, nt as I, P as J, _e as K, L, Ke as M, Ye as N, gt as O, Re as P,
|
|
9737
|
+
export { de as $, ft as A, R as B, Tr as C, vt as D, mr as E, Le as F, F as G, ze as H, nt as I, P as J, _e as K, L, Ke as M, Ye as N, gt as O, Re as P, ue as Q, qe as R, ti as S, vr as T, Ie as U, Ze as V, Ce as W, me as X, he as Y, pe as Z, li as _, Na as a, hi as b, fa as c, J as d, qi as f, gi as g, K as h, Ra as i, ot as j, lt as k, X as l, Oi as m, Ua as n, wa as o, bi as p, ge as q, Va as r, pa as s, Wa as t, Ji as u, ui as v, wr as w, mi as x, fi as y, z };
|
|
@@ -5,6 +5,7 @@ export interface PreviewHandle {
|
|
|
5
5
|
}
|
|
6
6
|
export interface BrowserOutputOptions {
|
|
7
7
|
container?: HTMLElement;
|
|
8
|
+
/** 仅 studio.preview() 使用,其他浏览器输出入口忽略此选项。 */
|
|
8
9
|
mode?: 'designer' | 'iframe';
|
|
9
10
|
signal?: AbortSignal;
|
|
10
11
|
timeoutMs?: number;
|
|
@@ -13,4 +14,5 @@ export declare function createBrowserOutput(): {
|
|
|
13
14
|
dispose: () => void;
|
|
14
15
|
preview: (html: string, options?: BrowserOutputOptions, hidden?: boolean) => Promise<PreviewHandle>;
|
|
15
16
|
print: (html: string, options?: BrowserOutputOptions) => Promise<string[]>;
|
|
17
|
+
track: (handle: PreviewHandle) => PreviewHandle;
|
|
16
18
|
};
|
package/runtime.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as e } from "./cloneDeep-
|
|
2
|
-
import { O as t,
|
|
1
|
+
import { t as e } from "./cloneDeep-PCw2ErRl.js";
|
|
2
|
+
import { O as t, Y as n, Z as r, n as i, r as a, t as o } from "./registries-dZq8MewR.js";
|
|
3
3
|
// src/runtime/print-renderer.ts
|
|
4
4
|
function s(s = {}) {
|
|
5
|
-
let c = t(s), l = s.errors ??
|
|
5
|
+
let c = t(s), l = s.errors ?? r(), u = o(s), d = a({
|
|
6
6
|
...u,
|
|
7
7
|
config: () => c.rendering,
|
|
8
8
|
snapshot: e
|
|
9
|
-
}), f = i(), p = !1, m =
|
|
9
|
+
}), f = i(), p = !1, m = n(d, f, () => {
|
|
10
10
|
if (p) throw Error("Print renderer has been disposed");
|
|
11
11
|
});
|
|
12
12
|
async function h(e, t) {
|
package/saas.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { i as SaasHttpError, t as createSaasClient, n as createSaasPlugin, r as createSaasTemplateProvider } from "./saas-
|
|
1
|
+
export { i as SaasHttpError, t as createSaasClient, n as createSaasPlugin, r as createSaasTemplateProvider } from "./saas-B1H161e1.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
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,
|
|
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 te, N as ne, O as P, P as re, Q as ie, T as ae, _ as oe, a as F, c as se, ct as ce, d as le, dt as ue, et as de, f as fe, ft as pe, g as me, gt as he, h as ge, ht as _e, i as ve, j as ye, l as I, lt as be, m as xe, mt as Se, nt as L, o as R, ot as z, p as B, pt as Ce, r as we, s as Te, st as Ee, t as De, tt as Oe, u as ke, ut as Ae, v as je, x as Me, y as Ne, z as Pe } from "./document-model-
|
|
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-dZq8MewR.js";
|
|
3
|
+
import { A as x, B as S, N as C, P as w, R as T, t as E } from "./cloneDeep-PCw2ErRl.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 te, N as ne, O as P, P as re, Q as ie, T as ae, _ as oe, a as F, c as se, ct as ce, d as le, dt as ue, et as de, f as fe, ft as pe, g as me, gt as he, h as ge, ht as _e, i as ve, j as ye, l as I, lt as be, m as xe, mt as Se, nt as L, o as R, ot as z, p as B, pt as Ce, r as we, s as Te, st as Ee, t as De, tt as Oe, u as ke, ut as Ae, v as je, x as Me, y as Ne, z as Pe } from "./document-model-GhFP9OGp.js";
|
|
5
5
|
import { createPinia as Fe, defineStore as V, disposePinia as Ie, getActivePinia as Le, setActivePinia as Re } from "pinia";
|
|
6
|
-
import { computed as H, hasInjectionContext as ze, markRaw as Be,
|
|
6
|
+
import { computed as H, hasInjectionContext as ze, markRaw as Be, onScopeDispose as Ve, reactive as He, ref as U, shallowReactive as Ue, shallowRef as W, toRefs as G, watch as K } from "vue";
|
|
7
7
|
// node_modules/.pnpm/mitt@3.0.1/node_modules/mitt/dist/mitt.mjs
|
|
8
|
-
function
|
|
8
|
+
function We(e) {
|
|
9
9
|
return {
|
|
10
10
|
all: e ||= /* @__PURE__ */ new Map(),
|
|
11
11
|
on: function(t, n) {
|
|
@@ -27,8 +27,8 @@ function Ge(e) {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
// src/core/events.ts
|
|
30
|
-
var
|
|
31
|
-
emitter =
|
|
30
|
+
var Ge = class {
|
|
31
|
+
emitter = We();
|
|
32
32
|
wildcard = /* @__PURE__ */ new Set();
|
|
33
33
|
emit(e, t) {
|
|
34
34
|
this.emitter.emit(e, t);
|
|
@@ -53,17 +53,17 @@ var Ke = class {
|
|
|
53
53
|
});
|
|
54
54
|
return n;
|
|
55
55
|
}
|
|
56
|
-
},
|
|
57
|
-
function
|
|
58
|
-
return
|
|
56
|
+
}, Ke = null;
|
|
57
|
+
function qe() {
|
|
58
|
+
return Ke ||= new Ge(), Ke;
|
|
59
59
|
}
|
|
60
60
|
// src/designer/commands/command-registry.ts
|
|
61
|
-
var
|
|
61
|
+
var Je = class {
|
|
62
62
|
bus;
|
|
63
63
|
commands = /* @__PURE__ */ new Map();
|
|
64
64
|
getContext;
|
|
65
65
|
version = W(0);
|
|
66
|
-
constructor(e, t =
|
|
66
|
+
constructor(e, t = qe()) {
|
|
67
67
|
this.getContext = e, this.bus = t;
|
|
68
68
|
}
|
|
69
69
|
byGroup(e) {
|
|
@@ -173,8 +173,7 @@ var Ye = class {
|
|
|
173
173
|
trackVersion() {
|
|
174
174
|
return this.version.value;
|
|
175
175
|
}
|
|
176
|
-
};
|
|
177
|
-
// src/designer/commands/domain-commands.ts
|
|
176
|
+
}, Ye = /* @__PURE__ */ e({ installDomainCommands: () => Xe });
|
|
178
177
|
function q(e, t, n, r = {}) {
|
|
179
178
|
return {
|
|
180
179
|
...r,
|
|
@@ -276,15 +275,18 @@ function Xe(e, t = !1) {
|
|
|
276
275
|
q("canvas.setBackground", n, (e) => e.view.setCanvasBackground),
|
|
277
276
|
q("output.html", o, (e) => (t, n, r) => e.rendering.html(e.document.data, t ?? w(e.document.data), n, r)),
|
|
278
277
|
q("output.pdf", o, (e) => (t, n, r) => e.rendering.pdf(e.document.data, t ?? w(e.document.data), n, r)),
|
|
279
|
-
...["preview", "print"].map((t) => q(`output.${t}`, o, (n) => async (r, i) =>
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
278
|
+
...["preview", "print"].map((t) => q(`output.${t}`, o, (n) => async (r, i) => {
|
|
279
|
+
if (t === "preview" && i?.mode === "designer") {
|
|
280
|
+
let t = {
|
|
281
|
+
document: n.document.getDocument(),
|
|
282
|
+
input: E(r ?? w(n.document.data))
|
|
283
|
+
}, { mountPrintPreview: a } = await import("./mount-print-preview-D7M-1AqH.js");
|
|
284
|
+
return a(e, t, i);
|
|
285
|
+
}
|
|
286
|
+
return p(n.rendering, e.output, () => {
|
|
287
|
+
e.store();
|
|
288
|
+
})[t](n.document.data, r ?? w(n.document.data), i);
|
|
289
|
+
}))
|
|
288
290
|
];
|
|
289
291
|
return e.commands.registerScoped(t ? c.filter((t) => !e.commands.has(t.id)) : c);
|
|
290
292
|
}
|
|
@@ -294,7 +296,7 @@ function Ze(e, t) {
|
|
|
294
296
|
t.emit("elements:changed", {});
|
|
295
297
|
});
|
|
296
298
|
}
|
|
297
|
-
function Qe(e, t =
|
|
299
|
+
function Qe(e, t = qe()) {
|
|
298
300
|
let n = tt(e, t), r = $e(e, t), i = {
|
|
299
301
|
canvas: e.canvas,
|
|
300
302
|
clipboard: e.clipboard,
|
|
@@ -1061,7 +1063,7 @@ function Ut() {
|
|
|
1061
1063
|
shortcut: "p",
|
|
1062
1064
|
toHtml({ props: e }) {
|
|
1063
1065
|
let t = Mt(e), n = t.closed ? String(e.fill ?? "none") : "none";
|
|
1064
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 ${t.viewWidth} ${t.viewHeight}" preserveAspectRatio="none" style="overflow:visible"><path d="${jt(t.anchors, t.closed)}" fill="${
|
|
1066
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 ${t.viewWidth} ${t.viewHeight}" preserveAspectRatio="none" style="overflow:visible"><path d="${jt(t.anchors, t.closed)}" fill="${f(n)}" stroke="${f(e.stroke ?? "#333333")}" stroke-width="${zt(e)}" stroke-linecap="round" stroke-linejoin="round" /></svg>`;
|
|
1065
1067
|
},
|
|
1066
1068
|
toPdf({ draw: e, node: t, pdf: n, props: r }) {
|
|
1067
1069
|
let a = Mt(r), o = a.anchors[0], s = a.closed && !i(r.fill), c = !i(r.stroke);
|
|
@@ -1130,7 +1132,7 @@ async function Yt(e) {
|
|
|
1130
1132
|
let t = document.createElement("iframe");
|
|
1131
1133
|
t.id = "print-studio-print-frame", t.style.position = "fixed", t.style.right = "0", t.style.bottom = "0", t.style.width = "0", t.style.height = "0", t.style.border = "0", t.style.visibility = "hidden", document.body.appendChild(t);
|
|
1132
1134
|
try {
|
|
1133
|
-
await
|
|
1135
|
+
await d(t, e);
|
|
1134
1136
|
let n = t.contentWindow;
|
|
1135
1137
|
n && (n.focus(), n.print());
|
|
1136
1138
|
} catch (e) {
|
|
@@ -1682,7 +1684,7 @@ var rn = class {
|
|
|
1682
1684
|
}
|
|
1683
1685
|
}, an = 2e3, on = "designer.errorHandling.unexpectedErrorMessage", sn = null;
|
|
1684
1686
|
function cn() {
|
|
1685
|
-
return sn ||=
|
|
1687
|
+
return sn ||= m({ report: ln }), sn;
|
|
1686
1688
|
}
|
|
1687
1689
|
function ln(e, t) {}
|
|
1688
1690
|
function un(e) {
|
|
@@ -3151,7 +3153,7 @@ function gr(e) {
|
|
|
3151
3153
|
i.value = !1, c = void 0;
|
|
3152
3154
|
}), c;
|
|
3153
3155
|
}
|
|
3154
|
-
return
|
|
3156
|
+
return Ve(() => clearTimeout(u)), {
|
|
3155
3157
|
beginPreview: y,
|
|
3156
3158
|
beginTemporary: w,
|
|
3157
3159
|
create: p,
|
|
@@ -3873,7 +3875,7 @@ function Nr(e) {
|
|
|
3873
3875
|
// src/designer/stores/layout-store.ts
|
|
3874
3876
|
function Pr(e) {
|
|
3875
3877
|
return V("editor-layout", () => {
|
|
3876
|
-
let t =
|
|
3878
|
+
let t = Ue(/* @__PURE__ */ new Map());
|
|
3877
3879
|
function n(e, n) {
|
|
3878
3880
|
let r = t.get(e);
|
|
3879
3881
|
return t.set(e, Be(n)), () => {
|
|
@@ -4107,7 +4109,7 @@ function Kr(e, t, n, r) {
|
|
|
4107
4109
|
}
|
|
4108
4110
|
function qr(e = !0, t) {
|
|
4109
4111
|
return V("editor-panel", ({ action: n }) => {
|
|
4110
|
-
let r =
|
|
4112
|
+
let r = Ue({}), i = /* @__PURE__ */ new Map(), a = U(e ? Hr(t) : {
|
|
4111
4113
|
columns: [],
|
|
4112
4114
|
version: 1
|
|
4113
4115
|
}), o = U(null), s = U(null), c = U(null), l = H(() => a.value.columns.filter((e) => !e.floating)), u = H(() => a.value.columns.filter((e) => e.floating)), d = H(() => function(e) {
|
|
@@ -4342,34 +4344,34 @@ function Yr(e) {
|
|
|
4342
4344
|
parsers: e.parsers,
|
|
4343
4345
|
snapshot: E
|
|
4344
4346
|
});
|
|
4345
|
-
async function
|
|
4347
|
+
async function d(e, n, r, i) {
|
|
4346
4348
|
let a = E(e), o = n === void 0 ? void 0 : E(n), s = await g((e) => l.html(a, o, r, {
|
|
4347
4349
|
...i,
|
|
4348
4350
|
...e,
|
|
4349
4351
|
onProgress: (e) => {
|
|
4350
4352
|
h(e), i?.onProgress?.(e);
|
|
4351
4353
|
},
|
|
4352
|
-
waitIfPaused:
|
|
4354
|
+
waitIfPaused: p
|
|
4353
4355
|
}), i);
|
|
4354
4356
|
return t.value = s.execution, s;
|
|
4355
4357
|
}
|
|
4356
|
-
async function
|
|
4358
|
+
async function f(e, n, r, i) {
|
|
4357
4359
|
let a = E(e), o = n === void 0 ? void 0 : E(n), s = await g((e) => l.pdf(a, o, r, {
|
|
4358
4360
|
...i,
|
|
4359
4361
|
...e,
|
|
4360
4362
|
onProgress: (e) => {
|
|
4361
4363
|
h(e), i?.onProgress?.(e);
|
|
4362
4364
|
},
|
|
4363
|
-
waitIfPaused:
|
|
4365
|
+
waitIfPaused: p
|
|
4364
4366
|
}), i);
|
|
4365
4367
|
return t.value = s.execution, s;
|
|
4366
4368
|
}
|
|
4367
|
-
async function
|
|
4369
|
+
async function p() {
|
|
4368
4370
|
a.value && await new Promise((e) => {
|
|
4369
4371
|
c = e;
|
|
4370
4372
|
});
|
|
4371
4373
|
}
|
|
4372
|
-
function
|
|
4374
|
+
function m(e) {
|
|
4373
4375
|
return g((t) => {
|
|
4374
4376
|
if (!t.signal) throw Error("Missing render cancellation signal");
|
|
4375
4377
|
return e(t.signal);
|
|
@@ -4396,7 +4398,7 @@ function Yr(e) {
|
|
|
4396
4398
|
}
|
|
4397
4399
|
}
|
|
4398
4400
|
function _() {
|
|
4399
|
-
n.value?.abort(new
|
|
4401
|
+
n.value?.abort(new u("Render cancelled")), c?.(), c = void 0;
|
|
4400
4402
|
}
|
|
4401
4403
|
function y() {
|
|
4402
4404
|
n.value && o.value && (a.value = !0);
|
|
@@ -4406,20 +4408,20 @@ function Yr(e) {
|
|
|
4406
4408
|
}
|
|
4407
4409
|
return K(() => e.config.data.rendering.worker, (e) => {
|
|
4408
4410
|
e || l.dispose();
|
|
4409
|
-
}, { flush: "sync" }),
|
|
4411
|
+
}, { flush: "sync" }), Ve(() => {
|
|
4410
4412
|
_(), l.dispose();
|
|
4411
4413
|
}), {
|
|
4412
4414
|
active: i,
|
|
4413
4415
|
cancel: _,
|
|
4414
|
-
html:
|
|
4416
|
+
html: d,
|
|
4415
4417
|
lastExecution: t,
|
|
4416
4418
|
pausable: o,
|
|
4417
4419
|
pause: y,
|
|
4418
4420
|
paused: a,
|
|
4419
|
-
pdf:
|
|
4421
|
+
pdf: f,
|
|
4420
4422
|
progress: s,
|
|
4421
4423
|
resume: b,
|
|
4422
|
-
runExternal:
|
|
4424
|
+
runExternal: m
|
|
4423
4425
|
};
|
|
4424
4426
|
})();
|
|
4425
4427
|
}
|
|
@@ -4884,7 +4886,7 @@ function ei(e) {
|
|
|
4884
4886
|
function C(e) {
|
|
4885
4887
|
l.value = Math.max(200, e);
|
|
4886
4888
|
}
|
|
4887
|
-
return
|
|
4889
|
+
return Ve(() => y(!1)), {
|
|
4888
4890
|
close: m,
|
|
4889
4891
|
course: f,
|
|
4890
4892
|
courseId: n,
|
|
@@ -4946,7 +4948,7 @@ function ti(e) {
|
|
|
4946
4948
|
function y(e) {
|
|
4947
4949
|
g.value += 1, h.value = e;
|
|
4948
4950
|
}
|
|
4949
|
-
|
|
4951
|
+
Ve(() => {
|
|
4950
4952
|
for (let e of v.values()) clearTimeout(e);
|
|
4951
4953
|
v.clear();
|
|
4952
4954
|
});
|
|
@@ -5107,7 +5109,7 @@ function ai(e) {
|
|
|
5107
5109
|
h: [],
|
|
5108
5110
|
pageId: "",
|
|
5109
5111
|
v: []
|
|
5110
|
-
}), p =
|
|
5112
|
+
}), p = He({
|
|
5111
5113
|
clickToCreate: !1,
|
|
5112
5114
|
gridSize: 5,
|
|
5113
5115
|
guidesLocked: !1,
|
|
@@ -5121,7 +5123,7 @@ function ai(e) {
|
|
|
5121
5123
|
snapToGrid: !1,
|
|
5122
5124
|
snapToGuides: !0,
|
|
5123
5125
|
snapToMargins: !0
|
|
5124
|
-
}), m =
|
|
5126
|
+
}), m = He({
|
|
5125
5127
|
spacing: null,
|
|
5126
5128
|
target: "selection"
|
|
5127
5129
|
});
|
|
@@ -5341,7 +5343,7 @@ var li = class {
|
|
|
5341
5343
|
// src/designer/stores/z-index-store.ts
|
|
5342
5344
|
function ui() {
|
|
5343
5345
|
return V("editor-z-index", () => {
|
|
5344
|
-
let e =
|
|
5346
|
+
let e = He(ci()), t = new li(e), n = H(() => t.initialZIndex), r = H(() => t.currentZIndex), i = H(() => t.get.bind(t)), a = H(() => t.isTop.bind(t));
|
|
5345
5347
|
function o(e) {
|
|
5346
5348
|
t.configure(e);
|
|
5347
5349
|
}
|
|
@@ -5588,7 +5590,7 @@ function di(e = {}) {
|
|
|
5588
5590
|
view: h,
|
|
5589
5591
|
zIndex: o
|
|
5590
5592
|
};
|
|
5591
|
-
return
|
|
5593
|
+
return Ve(() => {
|
|
5592
5594
|
for (let e of Object.values(k)) e.$dispose();
|
|
5593
5595
|
}), k;
|
|
5594
5596
|
});
|
|
@@ -5654,7 +5656,7 @@ var vi = /* @__PURE__ */ e({
|
|
|
5654
5656
|
createEditorRuntime: () => bi
|
|
5655
5657
|
}), yi = Symbol("editor-context");
|
|
5656
5658
|
function bi(e = {}, t) {
|
|
5657
|
-
let n = ze() ? void 0 : Le(), r = Fe(), i = new
|
|
5659
|
+
let n = ze() ? void 0 : Le(), r = Fe(), i = new Ge(), a = e.errors ?? m(), o = g(), s = new bt(), c = new bn(e.persistPreferences ? e.preferenceStorage ?? {
|
|
5658
5660
|
get: (e) => localStorage.getItem(e),
|
|
5659
5661
|
set: (e, t) => localStorage.setItem(e, t)
|
|
5660
5662
|
} : void 0), l, u;
|
|
@@ -5670,7 +5672,7 @@ function bi(e = {}, t) {
|
|
|
5670
5672
|
})(r);
|
|
5671
5673
|
vn(d, n.elements), gn(d, a), En(d), d.config.configure(e);
|
|
5672
5674
|
let f = !1, p = {
|
|
5673
|
-
commands: new
|
|
5675
|
+
commands: new Je(() => p, i),
|
|
5674
5676
|
dispose() {
|
|
5675
5677
|
f ||= (_i(p), p.plugins.close(), u?.(), o.dispose(), i.offAll(), Ie(r), !0);
|
|
5676
5678
|
},
|
|
@@ -6103,7 +6105,7 @@ function Ii(e, t = {}, n) {
|
|
|
6103
6105
|
let t = b(e.el);
|
|
6104
6106
|
a = !0;
|
|
6105
6107
|
try {
|
|
6106
|
-
let { mountPrintDesigner: n } = await import("./mount-print-designer-
|
|
6108
|
+
let { mountPrintDesigner: n } = await import("./mount-print-designer-BLgVZOnm.js").then((e) => e.n);
|
|
6107
6109
|
if (r) throw Error("Print studio has been disposed");
|
|
6108
6110
|
if (o) throw new DOMException("Designer unmounted before ready", "AbortError");
|
|
6109
6111
|
let s = n(t, {
|
|
@@ -6239,4 +6241,4 @@ function Li(e = {}) {
|
|
|
6239
6241
|
throw t.dispose?.(), e;
|
|
6240
6242
|
}
|
|
6241
6243
|
}
|
|
6242
|
-
export { Ht as A, bt as B, fn as C, Jt as D, qt as E, Rt as F, Je as G, _t as H, jt as I, zt as L, Bt as M, J as N, Yt as O, At as P, Mt as R, yn as S, rn as T,
|
|
6244
|
+
export { Ht as A, bt as B, fn 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, yn as S, rn as T, Ye as U, yt as V, Xe as W, Un as _, wi as a, bn as b, vi as c, fi as d, ni as f, Fn as g, Nn as h, Ei as i, Ut as j, Vt as k, mi as l, zn as m, Ii as n, yi as o, pr as p, xi as r, bi as s, Li as t, pi as u, Tn as v, cn as w, pn as x, xn as y, Et as z };
|
package/studio-types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { RenderExecution } from './parser/render-runtime';
|
|
|
10
10
|
import { BrowserOutputOptions, PreviewHandle } from './runtime/browser-output';
|
|
11
11
|
import { RegistryOptions } from './runtime/registries';
|
|
12
12
|
export type { StudioMountOptions };
|
|
13
|
+
export type PreviewOptions = BrowserOutputOptions;
|
|
13
14
|
export interface DocumentStorage {
|
|
14
15
|
get(): null | string;
|
|
15
16
|
set(document: string): void;
|
|
@@ -162,7 +163,7 @@ export interface DesignStudio {
|
|
|
162
163
|
update(reference: EntityReference, patch: PagePatch): void;
|
|
163
164
|
};
|
|
164
165
|
readonly plugins: Pick<PluginManager, 'disable' | 'dispose' | 'enable' | 'has' | 'install' | 'list' | 'load' | 'status' | 'uninstall'>;
|
|
165
|
-
preview(input?: Record<string, unknown>, options?:
|
|
166
|
+
preview(input?: Record<string, unknown>, options?: PreviewOptions): Promise<PreviewHandle>;
|
|
166
167
|
print(input?: Record<string, unknown>, options?: BrowserOutputOptions): Promise<{
|
|
167
168
|
warnings: string[];
|
|
168
169
|
}>;
|