@worm-print-platform/canvas 1.5.0 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +124 -355
- package/dist/browser-bundle.d.ts +1 -1
- package/dist/canvas.css +2 -2
- package/dist/canvas.js +119 -81
- package/dist/core/default-template.d.ts +1 -1
- package/dist/core/element-definitions.d.ts +1 -1
- package/dist/core/format.d.ts +1 -1
- package/dist/core/h.d.ts +1 -1
- package/dist/core/icons.d.ts +1 -1
- package/dist/core/plugin.d.ts +1 -1
- package/dist/core/store.d.ts +1 -1
- package/dist/host-contract.d.ts +24 -8
- package/dist/index.cjs +49 -11
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1918 -1678
- package/dist/print-designer.d.ts +32 -5
- package/dist/shell/binding.d.ts +1 -1
- package/dist/shell/canvas.d.ts +1 -1
- package/dist/shell/code.d.ts +1 -1
- package/dist/shell/color-picker.d.ts +1 -1
- package/dist/shell/controls.d.ts +4 -1
- package/dist/shell/crop-anchor.d.ts +1 -1
- package/dist/shell/elements.d.ts +1 -1
- package/dist/shell/expression-editor.d.ts +1 -1
- package/dist/shell/flow-list.d.ts +1 -1
- package/dist/shell/font-select.d.ts +1 -1
- package/dist/shell/format-bar.d.ts +1 -1
- package/dist/shell/help-content/advanced-settings.d.ts +1 -1
- package/dist/shell/help-content/changelog.d.ts +1 -1
- package/dist/shell/help-content/faq.d.ts +1 -1
- package/dist/shell/help-content/features.d.ts +1 -1
- package/dist/shell/help-content/getting-started.d.ts +1 -1
- package/dist/shell/help-content/index.d.ts +1 -1
- package/dist/shell/help-content/shortcuts.d.ts +1 -1
- package/dist/shell/help-modal.d.ts +1 -1
- package/dist/shell/page-extras.d.ts +1 -1
- package/dist/shell/panels.d.ts +1 -1
- package/dist/shell/plugin-ui.d.ts +1 -1
- package/dist/shell/prop-group.d.ts +1 -1
- package/dist/shell/property-panel.d.ts +1 -1
- package/dist/shell/property-search.d.ts +1 -1
- package/dist/shell/ruler.d.ts +1 -1
- package/dist/shell/table-props.d.ts +1 -1
- package/dist/shell/table.d.ts +2 -2
- package/dist/shell/toolbar-overflow.d.ts +1 -1
- package/dist/shell/toolbar.d.ts +1 -1
- package/dist/shell/watermark.d.ts +1 -1
- package/dist/theme-tokens.d.ts +21 -0
- package/dist/version.d.ts +8 -0
- package/dist/vue3/PrintDesigner.d.ts +46 -1
- package/dist/vue3/PrintHtmlPreview.d.ts +1 -1
- package/dist/vue3/index.cjs +2 -2
- package/dist/vue3/index.d.ts +1 -1
- package/dist/vue3/index.js +153 -133
- package/dist/vue3/previewStyle.d.ts +1 -1
- package/dist/vue3/toolbarOverflow.d.ts +1 -1
- package/package.json +5 -5
package/dist/vue3/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as B, ref as y, onMounted as C, onBeforeUnmount as L, watch as c, h as g, computed as D, shallowRef as M, reactive as F, onUnmounted as _, provide as j, inject as V, nextTick as U } from "vue";
|
|
2
2
|
import { definePrintDesigner as Z } from "@worm-print-platform/canvas";
|
|
3
|
-
import { createDefaultTemplate as
|
|
3
|
+
import { createDefaultTemplate as Pe, toRuntimePool as Re } from "@worm-print-platform/canvas";
|
|
4
4
|
import { collectLayoutWarnings as G } from "@worm-print-platform/core";
|
|
5
5
|
import { renderHtmlPages as K, browserCodeRenderer as N } from "@worm-print-platform/core/browser";
|
|
6
|
-
import { browserCodeRenderer as
|
|
7
|
-
import { resolvePrinterDpi as $, zoomPresets as q, paperWidthPx as Y, defaultZoomKey as Q, zoomValueOf as X, viewZoomHint as ee, applyPreviewViewZoom as te, resolveZoomKey as ne, resolveToolbarOverflow as
|
|
8
|
-
import { DEFAULT_DEMO_DATA as
|
|
9
|
-
import { TOOLBAR_OVERFLOW_KEY as
|
|
6
|
+
import { browserCodeRenderer as Se, renderHtmlPages as Ie } from "@worm-print-platform/core/browser";
|
|
7
|
+
import { resolvePrinterDpi as $, zoomPresets as q, paperWidthPx as Y, defaultZoomKey as Q, zoomValueOf as X, viewZoomHint as ee, applyPreviewViewZoom as te, resolveZoomKey as ne, resolveToolbarOverflow as ie } from "@worm-print-platform/core/designer";
|
|
8
|
+
import { DEFAULT_DEMO_DATA as We, getDemoData as Ae } from "@worm-print-platform/core/designer";
|
|
9
|
+
import { TOOLBAR_OVERFLOW_KEY as oe } from "@worm-print-platform/plugin-kit";
|
|
10
10
|
function re(e, a) {
|
|
11
11
|
const v = a.map((s) => ({
|
|
12
12
|
...s,
|
|
@@ -18,7 +18,7 @@ function re(e, a) {
|
|
|
18
18
|
pages: i.map((s, r) => r === 0 ? { ...s, elements: v } : s)
|
|
19
19
|
} : { ...e, elements: v };
|
|
20
20
|
}
|
|
21
|
-
const ae =
|
|
21
|
+
const ae = B({
|
|
22
22
|
name: "PrintDesigner",
|
|
23
23
|
props: {
|
|
24
24
|
initialTemplate: {
|
|
@@ -46,6 +46,10 @@ const ae = L({
|
|
|
46
46
|
},
|
|
47
47
|
/** 是否展示帮助入口;不传时保持元素默认(展示) */
|
|
48
48
|
showHelp: { type: Boolean, default: void 0 },
|
|
49
|
+
/** 是否展示工具栏「预览」按钮;不传时保持元素默认(展示) */
|
|
50
|
+
showPreview: { type: Boolean, default: void 0 },
|
|
51
|
+
/** 是否展示工具栏「保存」按钮;不传时保持元素默认(展示) */
|
|
52
|
+
showSave: { type: Boolean, default: void 0 },
|
|
49
53
|
/** 模板级字体声明,保存 / 导出时写入模板 JSON */
|
|
50
54
|
fonts: {
|
|
51
55
|
type: Array,
|
|
@@ -55,62 +59,78 @@ const ae = L({
|
|
|
55
59
|
designData: {
|
|
56
60
|
type: [Object, Array],
|
|
57
61
|
default: void 0
|
|
58
|
-
}
|
|
62
|
+
},
|
|
63
|
+
/** 主题预设:auto(默认)跟随系统 prefers-color-scheme,light/dark 强制 */
|
|
64
|
+
theme: { type: String, default: void 0 },
|
|
65
|
+
/** 主题色值覆盖:传参优先于预设、系统与 CSS 令牌;只影响外壳,画布纸张不受影响 */
|
|
66
|
+
themeConfig: { type: Object, default: void 0 }
|
|
59
67
|
},
|
|
60
68
|
emits: {
|
|
61
69
|
preview: () => !0,
|
|
62
70
|
save: (e) => typeof e == "string"
|
|
63
71
|
},
|
|
64
72
|
setup(e, { emit: a, expose: v }) {
|
|
65
|
-
const i =
|
|
73
|
+
const i = y(null);
|
|
66
74
|
let s = null, r = null;
|
|
67
75
|
typeof customElements < "u" && Z();
|
|
68
|
-
function
|
|
76
|
+
function f(t) {
|
|
69
77
|
if (e.initialTemplate !== void 0) {
|
|
70
78
|
t.template = e.initialTemplate;
|
|
71
79
|
return;
|
|
72
80
|
}
|
|
73
81
|
if (e.initialElements === void 0) return;
|
|
74
|
-
const
|
|
75
|
-
t.template = re(
|
|
82
|
+
const n = t.getTemplateJson(), m = JSON.parse(n);
|
|
83
|
+
t.template = re(m, e.initialElements);
|
|
76
84
|
}
|
|
77
85
|
function x() {
|
|
78
86
|
const t = i.value;
|
|
79
|
-
t && (
|
|
87
|
+
t && (f(t), e.fields !== void 0 && (t.fields = e.fields), e.fonts !== void 0 && (t.fonts = e.fonts), e.designData !== void 0 && (t.designData = e.designData), t.uploadImage = e.uploadImage, t.uploadDesignBackground = e.uploadDesignBackground, e.isEdit !== void 0 && (t.isEdit = e.isEdit), e.showHelp !== void 0 && (t.showHelp = e.showHelp), e.showPreview !== void 0 && (t.showPreview = e.showPreview), e.showSave !== void 0 && (t.showSave = e.showSave), e.theme !== void 0 && (t.theme = e.theme), e.themeConfig !== void 0 && (t.themeConfig = e.themeConfig));
|
|
80
88
|
}
|
|
81
|
-
return
|
|
89
|
+
return C(() => {
|
|
82
90
|
const t = i.value;
|
|
83
|
-
t && (s = (
|
|
84
|
-
}),
|
|
91
|
+
t && (s = (n) => a("save", n.detail), r = () => a("preview"), t.addEventListener("save", s), t.addEventListener("preview", r), x());
|
|
92
|
+
}), L(() => {
|
|
85
93
|
const t = i.value;
|
|
86
94
|
s && t?.removeEventListener("save", s), r && t?.removeEventListener("preview", r), s = null, r = null;
|
|
87
|
-
}),
|
|
95
|
+
}), c(() => e.initialTemplate, () => {
|
|
88
96
|
const t = i.value;
|
|
89
|
-
t &&
|
|
90
|
-
}),
|
|
97
|
+
t && f(t);
|
|
98
|
+
}), c(() => e.initialElements, () => {
|
|
91
99
|
const t = i.value;
|
|
92
|
-
t &&
|
|
93
|
-
}),
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
}),
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
}),
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
}),
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
}),
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
}),
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
}),
|
|
112
|
-
const
|
|
113
|
-
|
|
100
|
+
t && f(t);
|
|
101
|
+
}), c(() => e.fields, (t) => {
|
|
102
|
+
const n = i.value;
|
|
103
|
+
n && (n.fields = t ?? []);
|
|
104
|
+
}), c(() => e.fonts, (t) => {
|
|
105
|
+
const n = i.value;
|
|
106
|
+
n && (n.fonts = t);
|
|
107
|
+
}), c(() => e.designData, (t) => {
|
|
108
|
+
const n = i.value;
|
|
109
|
+
n && (n.designData = t);
|
|
110
|
+
}), c(() => e.uploadImage, (t) => {
|
|
111
|
+
const n = i.value;
|
|
112
|
+
n && (n.uploadImage = t);
|
|
113
|
+
}), c(() => e.uploadDesignBackground, (t) => {
|
|
114
|
+
const n = i.value;
|
|
115
|
+
n && (n.uploadDesignBackground = t);
|
|
116
|
+
}), c(() => e.isEdit, (t) => {
|
|
117
|
+
const n = i.value;
|
|
118
|
+
n && t !== void 0 && (n.isEdit = t);
|
|
119
|
+
}), c(() => e.showHelp, (t) => {
|
|
120
|
+
const n = i.value;
|
|
121
|
+
n && t !== void 0 && (n.showHelp = t);
|
|
122
|
+
}), c(() => e.showPreview, (t) => {
|
|
123
|
+
const n = i.value;
|
|
124
|
+
n && t !== void 0 && (n.showPreview = t);
|
|
125
|
+
}), c(() => e.showSave, (t) => {
|
|
126
|
+
const n = i.value;
|
|
127
|
+
n && t !== void 0 && (n.showSave = t);
|
|
128
|
+
}), c(() => e.theme, (t) => {
|
|
129
|
+
const n = i.value;
|
|
130
|
+
n && t !== void 0 && (n.theme = t);
|
|
131
|
+
}), c(() => e.themeConfig, (t) => {
|
|
132
|
+
const n = i.value;
|
|
133
|
+
n && t !== void 0 && (n.themeConfig = t);
|
|
114
134
|
}), v({
|
|
115
135
|
getTemplateJson() {
|
|
116
136
|
const t = i.value?.getTemplateJson();
|
|
@@ -124,7 +144,7 @@ const ae = L({
|
|
|
124
144
|
}
|
|
125
145
|
}), () => g("print-designer", { ref: i });
|
|
126
146
|
}
|
|
127
|
-
}),
|
|
147
|
+
}), ge = ae, A = "worm-print-canvas-vue3-preview", le = `
|
|
128
148
|
.pcv3-preview.print-html-preview {
|
|
129
149
|
width: 100%;
|
|
130
150
|
height: 100%;
|
|
@@ -207,11 +227,11 @@ const ae = L({
|
|
|
207
227
|
}
|
|
208
228
|
`;
|
|
209
229
|
function se() {
|
|
210
|
-
if (typeof document > "u" || document.getElementById(
|
|
230
|
+
if (typeof document > "u" || document.getElementById(A)) return;
|
|
211
231
|
const e = document.createElement("style");
|
|
212
|
-
e.id =
|
|
232
|
+
e.id = A, e.textContent = le, document.head.appendChild(e);
|
|
213
233
|
}
|
|
214
|
-
const ue =
|
|
234
|
+
const ue = B({
|
|
215
235
|
name: "PrintHtmlPreview",
|
|
216
236
|
props: {
|
|
217
237
|
/** 模板 JSON(设计器 TemplateData 结构兼容) */
|
|
@@ -239,32 +259,32 @@ const ue = L({
|
|
|
239
259
|
error: (e) => typeof e == "string"
|
|
240
260
|
},
|
|
241
261
|
setup(e, { emit: a, expose: v }) {
|
|
242
|
-
const i =
|
|
262
|
+
const i = y(), s = y(), r = y(!1), f = y(""), x = y([]);
|
|
243
263
|
let E = 0;
|
|
244
|
-
const t = D(() => $(e.templateJson)),
|
|
245
|
-
() => q(t.value,
|
|
246
|
-
),
|
|
264
|
+
const t = D(() => $(e.templateJson)), n = y(0), m = D(
|
|
265
|
+
() => q(t.value, n.value, Y(e.templateJson))
|
|
266
|
+
), p = y(Q(t.value)), k = D(() => X(m.value, p.value)), T = D(() => ee(t.value, p.value));
|
|
247
267
|
function O() {
|
|
248
|
-
|
|
268
|
+
n.value = s.value?.clientWidth ?? 0;
|
|
249
269
|
}
|
|
250
|
-
function
|
|
251
|
-
|
|
270
|
+
function S() {
|
|
271
|
+
p.value = ne(m.value, p.value, t.value);
|
|
252
272
|
}
|
|
253
|
-
function
|
|
254
|
-
te(i.value?.contentWindow?.document,
|
|
273
|
+
function P() {
|
|
274
|
+
te(i.value?.contentWindow?.document, k.value);
|
|
255
275
|
}
|
|
256
|
-
function
|
|
257
|
-
O(),
|
|
276
|
+
function I() {
|
|
277
|
+
O(), P();
|
|
258
278
|
}
|
|
259
|
-
async function
|
|
279
|
+
async function o() {
|
|
260
280
|
if (!e.templateJson) {
|
|
261
|
-
|
|
281
|
+
f.value = "", r.value = !1;
|
|
262
282
|
return;
|
|
263
283
|
}
|
|
264
284
|
const l = ++E;
|
|
265
|
-
r.value = !0,
|
|
285
|
+
r.value = !0, f.value = "", x.value = [];
|
|
266
286
|
try {
|
|
267
|
-
const { html: u, pageCount: b, copies: d, pageLayouts:
|
|
287
|
+
const { html: u, pageCount: b, copies: d, pageLayouts: R } = await K(
|
|
268
288
|
e.templateJson,
|
|
269
289
|
e.printData,
|
|
270
290
|
e.baseUrl,
|
|
@@ -272,37 +292,37 @@ const ue = L({
|
|
|
272
292
|
{ fontBaseUrl: e.fontBaseUrl, renderers: e.renderers }
|
|
273
293
|
);
|
|
274
294
|
if (l !== E) return;
|
|
275
|
-
x.value = G(
|
|
276
|
-
const
|
|
277
|
-
|
|
295
|
+
x.value = G(R ?? []);
|
|
296
|
+
const h = i.value?.contentWindow?.document;
|
|
297
|
+
h && (h.open(), h.write(u), h.close()), O(), S(), P(), a("rendered", b, d);
|
|
278
298
|
} catch (u) {
|
|
279
299
|
if (l !== E) return;
|
|
280
|
-
|
|
300
|
+
f.value = u instanceof Error ? u.message : "未知错误", a("error", f.value);
|
|
281
301
|
} finally {
|
|
282
302
|
l === E && (r.value = !1);
|
|
283
303
|
}
|
|
284
304
|
}
|
|
285
|
-
function
|
|
305
|
+
function w() {
|
|
286
306
|
const l = i.value?.contentWindow;
|
|
287
307
|
l && (l.focus(), l.print());
|
|
288
308
|
}
|
|
289
309
|
function z(l) {
|
|
290
|
-
|
|
310
|
+
m.value.some((u) => u.key === l) && (p.value = l);
|
|
291
311
|
}
|
|
292
|
-
return
|
|
312
|
+
return c(
|
|
293
313
|
() => [e.templateJson, e.printData, e.baseUrl, e.fontBaseUrl, e.renderers],
|
|
294
314
|
() => {
|
|
295
|
-
|
|
315
|
+
o();
|
|
296
316
|
},
|
|
297
317
|
{ deep: !0 }
|
|
298
|
-
),
|
|
299
|
-
se(), O(),
|
|
300
|
-
}),
|
|
301
|
-
E++, window.removeEventListener("resize",
|
|
302
|
-
}), v({ print:
|
|
303
|
-
const l = r.value || !!
|
|
304
|
-
if (
|
|
305
|
-
g("span", null, `预览渲染失败:${
|
|
318
|
+
), c(k, () => P()), C(() => {
|
|
319
|
+
se(), O(), S(), window.addEventListener("resize", I), o();
|
|
320
|
+
}), L(() => {
|
|
321
|
+
E++, window.removeEventListener("resize", I);
|
|
322
|
+
}), v({ print: w, rerender: o, setViewZoom: z, zoomKey: p, presets: m, viewHint: T }), () => {
|
|
323
|
+
const l = r.value || !!f.value, u = [];
|
|
324
|
+
if (f.value ? u.push(g("div", { key: "error", class: "print-html-preview-error" }, [
|
|
325
|
+
g("span", null, `预览渲染失败:${f.value}`)
|
|
306
326
|
])) : r.value && u.push(g("div", { key: "loading", class: "print-html-preview-loading" }, "预览渲染中…")), u.push(g("iframe", {
|
|
307
327
|
key: "iframe",
|
|
308
328
|
ref: i,
|
|
@@ -312,16 +332,16 @@ const ue = L({
|
|
|
312
332
|
})), x.value.length && !l && u.push(g("div", { key: "warn", class: "print-html-preview-warn", role: "status" }, [
|
|
313
333
|
g("span", null, `出纸提示:${x.value.join(";")}`)
|
|
314
334
|
])), e.templateJson && !l) {
|
|
315
|
-
const b =
|
|
335
|
+
const b = m.value.map((d) => g("button", {
|
|
316
336
|
key: d.key,
|
|
317
337
|
type: "button",
|
|
318
338
|
class: {
|
|
319
339
|
"print-html-preview-zoom-btn": !0,
|
|
320
|
-
active: d.key ===
|
|
340
|
+
active: d.key === p.value
|
|
321
341
|
},
|
|
322
342
|
title: d.tip,
|
|
323
343
|
onClick: () => {
|
|
324
|
-
|
|
344
|
+
p.value = d.key;
|
|
325
345
|
}
|
|
326
346
|
}, d.label));
|
|
327
347
|
T.value && b.push(g("span", { class: "print-html-preview-zoom-hint" }, T.value)), b.push(g("span", { class: "print-html-preview-zoom-note" }, "仅屏幕缩放,打印不受影响")), u.push(g("div", { key: "zoom", class: "print-html-preview-zoom" }, b));
|
|
@@ -336,84 +356,84 @@ const ue = L({
|
|
|
336
356
|
function be(e) {
|
|
337
357
|
return `tb-more-slot-${e}`;
|
|
338
358
|
}
|
|
339
|
-
const
|
|
359
|
+
const H = oe, W = 2, de = 74;
|
|
340
360
|
function ve() {
|
|
341
|
-
const e =
|
|
361
|
+
const e = M(null), a = /* @__PURE__ */ new Map(), v = F(/* @__PURE__ */ new Map()), i = /* @__PURE__ */ new Map();
|
|
342
362
|
let s = 0;
|
|
343
|
-
const r =
|
|
363
|
+
const r = y(/* @__PURE__ */ new Set()), f = y(!1), x = D(() => [...v.values()].sort((o, w) => o.order - w.order)), E = D(() => r.value.size > 0);
|
|
344
364
|
function t() {
|
|
345
|
-
for (const [
|
|
346
|
-
const z =
|
|
347
|
-
z > 0 && i.set(
|
|
365
|
+
for (const [o, w] of a) {
|
|
366
|
+
const z = w.offsetWidth;
|
|
367
|
+
z > 0 && i.set(o, z);
|
|
348
368
|
}
|
|
349
369
|
}
|
|
350
|
-
function o
|
|
351
|
-
const
|
|
370
|
+
function n(o) {
|
|
371
|
+
const w = getComputedStyle(o), z = Number.parseFloat(w.gap) || W, l = Number.parseFloat(w.paddingLeft) || 0, u = Number.parseFloat(w.paddingRight) || 0;
|
|
352
372
|
let b = 0;
|
|
353
|
-
for (const d of Array.from(
|
|
373
|
+
for (const d of Array.from(o.children)) {
|
|
354
374
|
if (d.hasAttribute("data-overflow-more") || d.hasAttribute("data-overflow-spacer")) continue;
|
|
355
|
-
const
|
|
356
|
-
|
|
375
|
+
const R = Math.max(d.offsetWidth, d.scrollWidth);
|
|
376
|
+
R <= 0 || (b += R + z);
|
|
357
377
|
}
|
|
358
|
-
return { available:
|
|
378
|
+
return { available: o.clientWidth - l - u, natural: b };
|
|
359
379
|
}
|
|
360
|
-
function
|
|
361
|
-
const
|
|
362
|
-
if (!
|
|
363
|
-
const { available:
|
|
380
|
+
function m() {
|
|
381
|
+
const o = e.value;
|
|
382
|
+
if (!o) return;
|
|
383
|
+
const { available: w, natural: z } = n(o), l = r.value.size > 0;
|
|
364
384
|
l || (s = z, t());
|
|
365
|
-
const u = x.value.map((
|
|
366
|
-
id:
|
|
367
|
-
order:
|
|
368
|
-
width: i.get(
|
|
369
|
-
})), b = u.reduce((
|
|
370
|
-
available:
|
|
385
|
+
const u = x.value.map((h) => ({
|
|
386
|
+
id: h.id,
|
|
387
|
+
order: h.order,
|
|
388
|
+
width: i.get(h.id) ?? 0
|
|
389
|
+
})), b = u.reduce((h, J) => h - J.width - W, s), d = ie({
|
|
390
|
+
available: w,
|
|
371
391
|
pinned: b,
|
|
372
392
|
moreTriggerWidth: de,
|
|
373
|
-
gap:
|
|
393
|
+
gap: W,
|
|
374
394
|
units: u
|
|
375
395
|
});
|
|
376
|
-
d.movedIds.length === r.value.size && d.movedIds.every((
|
|
396
|
+
d.movedIds.length === r.value.size && d.movedIds.every((h) => r.value.has(h)) || (r.value = new Set(d.movedIds)), f.value = d.overflowRemains, l && r.value.size === 0 && U(m);
|
|
377
397
|
}
|
|
378
|
-
let
|
|
379
|
-
function
|
|
380
|
-
|
|
398
|
+
let p = null;
|
|
399
|
+
function k(o) {
|
|
400
|
+
o !== e.value && (p?.disconnect(), e.value = o, o && typeof ResizeObserver < "u" && (p = new ResizeObserver(() => m()), p.observe(o)), U(m));
|
|
381
401
|
}
|
|
382
|
-
function T(
|
|
383
|
-
v.set(
|
|
402
|
+
function T(o, w) {
|
|
403
|
+
v.set(o.id, o), a.set(o.id, w), U(m);
|
|
384
404
|
}
|
|
385
|
-
function O(
|
|
386
|
-
a.delete(
|
|
405
|
+
function O(o) {
|
|
406
|
+
a.delete(o), v.delete(o), i.delete(o), U(m);
|
|
387
407
|
}
|
|
388
|
-
const
|
|
389
|
-
function
|
|
390
|
-
return r.value.has(
|
|
408
|
+
const S = document.createElement("div");
|
|
409
|
+
function P(o) {
|
|
410
|
+
return r.value.has(o);
|
|
391
411
|
}
|
|
392
|
-
function
|
|
393
|
-
return r.value, e.value?.querySelector(`[data-overflow-slot="${
|
|
412
|
+
function I(o) {
|
|
413
|
+
return r.value, e.value?.querySelector(`[data-overflow-slot="${o}"]`) ?? S;
|
|
394
414
|
}
|
|
395
|
-
return _(() =>
|
|
396
|
-
attachRoot:
|
|
415
|
+
return _(() => p?.disconnect()), {
|
|
416
|
+
attachRoot: k,
|
|
397
417
|
registerUnit: T,
|
|
398
418
|
unregisterUnit: O,
|
|
399
|
-
refresh:
|
|
419
|
+
refresh: m,
|
|
400
420
|
movedIds: r,
|
|
401
|
-
overflowRemains:
|
|
421
|
+
overflowRemains: f,
|
|
402
422
|
hasMoved: E,
|
|
403
423
|
chain: x,
|
|
404
|
-
moved:
|
|
405
|
-
slotEl:
|
|
424
|
+
moved: P,
|
|
425
|
+
slotEl: I
|
|
406
426
|
};
|
|
407
427
|
}
|
|
408
428
|
function xe() {
|
|
409
429
|
const e = ve();
|
|
410
|
-
return j(
|
|
430
|
+
return j(H, e), e;
|
|
411
431
|
}
|
|
412
432
|
function Ee() {
|
|
413
|
-
return V(
|
|
433
|
+
return V(H, null);
|
|
414
434
|
}
|
|
415
435
|
function ze() {
|
|
416
|
-
const e =
|
|
436
|
+
const e = y(/* @__PURE__ */ new Set()), a = document.createElement("div");
|
|
417
437
|
return {
|
|
418
438
|
attachRoot: () => {
|
|
419
439
|
},
|
|
@@ -424,7 +444,7 @@ function ze() {
|
|
|
424
444
|
refresh: () => {
|
|
425
445
|
},
|
|
426
446
|
movedIds: e,
|
|
427
|
-
overflowRemains:
|
|
447
|
+
overflowRemains: y(!1),
|
|
428
448
|
hasMoved: D(() => !1),
|
|
429
449
|
chain: D(() => []),
|
|
430
450
|
moved: () => !1,
|
|
@@ -442,19 +462,19 @@ function De(e) {
|
|
|
442
462
|
};
|
|
443
463
|
}
|
|
444
464
|
export {
|
|
445
|
-
|
|
446
|
-
|
|
465
|
+
We as DEFAULT_DEMO_DATA,
|
|
466
|
+
ge as PrintDesigner,
|
|
447
467
|
ye as PrintHtmlPreview,
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
468
|
+
H as TOOLBAR_OVERFLOW,
|
|
469
|
+
Se as browserCodeRenderer,
|
|
470
|
+
Pe as createDefaultTemplate,
|
|
451
471
|
De as createOverflowUnitDirective,
|
|
452
472
|
ve as createToolbarOverflow,
|
|
453
473
|
ze as emptyToolbarOverflow,
|
|
454
|
-
|
|
474
|
+
Ae as getDemoData,
|
|
455
475
|
be as moreSlotId,
|
|
456
476
|
xe as provideToolbarOverflow,
|
|
457
|
-
|
|
458
|
-
|
|
477
|
+
Ie as renderHtmlPages,
|
|
478
|
+
Re as toRuntimePool,
|
|
459
479
|
Ee as useToolbarOverflow
|
|
460
480
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@worm-print-platform/canvas",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
|
-
"description": "
|
|
9
|
+
"description": "打印模板设计器权威实现:零框架原生 Custom Elements + Shadow DOM(vue 为可选 peer,/vue3 子路径提供 Vue 3 门面)",
|
|
10
10
|
"main": "./dist/index.cjs",
|
|
11
11
|
"module": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"framework-agnostic"
|
|
47
47
|
],
|
|
48
48
|
"scripts": {
|
|
49
|
-
"styles": "node scripts/gen-styles.mjs && node scripts/gen-icons.mjs",
|
|
49
|
+
"styles": "node scripts/gen-styles.mjs && node scripts/gen-icons.mjs && node scripts/gen-version.mjs",
|
|
50
50
|
"build": "npm run styles && vite build && vite build -c vite.bundle.config.ts && vite build -c vite.vue3.config.ts && tsc -p tsconfig.build.json && node ../../scripts/inject-license-banner.mjs dist",
|
|
51
51
|
"dev": "npm run styles && vite build --watch",
|
|
52
52
|
"typecheck": "npm run styles && tsc -p tsconfig.json --noEmit",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"pretest": "npm run typecheck"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@worm-print-platform/core": "^1.5.
|
|
58
|
-
"@worm-print-platform/plugin-kit": "^1.5.
|
|
57
|
+
"@worm-print-platform/core": "^1.5.3",
|
|
58
|
+
"@worm-print-platform/plugin-kit": "^1.5.3",
|
|
59
59
|
"dompurify": "^3.4.12",
|
|
60
60
|
"jsbarcode": "^3.12.3",
|
|
61
61
|
"qrcode": "^1.5.4"
|