@jetprint/editor-sdk 1.2.1 → 1.2.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/dist/editor-sdk.es.js +133464 -35076
- package/dist/style.css +1 -1
- package/dist/utils/fileToken.d.ts +4 -2
- package/dist/utils/inlineWorkers.d.ts +13 -0
- package/dist/utils/protection/encryptedModules.generated.d.ts +1 -1
- package/dist/utils/workerBase.d.ts +1 -1
- package/dist/wasm/perspectiveLoader.worker.d.ts +5 -4
- package/dist/wasm/wasmInline.generated.d.ts +2 -0
- package/package.json +3 -2
- package/dist/assets/perspective.wasm +0 -0
- package/dist/assets/wasm_exec.js +0 -553
- package/dist/copyDiecuts.worker.js +0 -77
- package/dist/deform.worker.js +0 -760
- package/dist/favicon copy.ico +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/headless.global.js +0 -504
- package/dist/maskWorker.js +0 -51
- package/dist/prefetch.worker.js +0 -16
- package/dist/render.worker.js +0 -27266
- package/dist/renderWorker.js +0 -40389
- package/dist/sdk-workers/copyDiecuts.worker.js +0 -77
- package/dist/sdk-workers/deform.worker.js +0 -760
- package/dist/sdk-workers/maskWorker.js +0 -51
- package/dist/sdk-workers/prefetch.worker.js +0 -16
- package/dist/sdk-workers/render.worker.js +0 -27266
- package/dist/sdk-workers/renderWorker.js +0 -40380
- package/dist/sdk-workers/zoneScreenshotWorker.js +0 -82
- package/dist/vite.svg +0 -1
- package/dist/zoneScreenshotWorker.js +0 -82
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
const D = (e, l, i, o, f, r = 1) => {
|
|
2
|
-
const t = JSON.parse(JSON.stringify(e));
|
|
3
|
-
t.customData || (t.customData = {}), t.customData.id = l;
|
|
4
|
-
const m = T(t), h = (m.minL + m.maxR) / 2, a = (m.minT + m.maxB) / 2, n = !!t.customData?.isPatternRect, p = n ? r : i;
|
|
5
|
-
if (!n)
|
|
6
|
-
i !== 1 && (t.scaleX = (t.scaleX ?? 1) * i, t.scaleY = (t.scaleY ?? 1) * i);
|
|
7
|
-
else if (r !== 1) {
|
|
8
|
-
const s = t.customData;
|
|
9
|
-
Number(s.patternTileWidth) > 0 && (s.patternTileWidth = Number(s.patternTileWidth) * r), Number(s.patternTileHeight) > 0 && (s.patternTileHeight = Number(s.patternTileHeight) * r), Number(t.width) > 0 && (t.width = Number(t.width) * r), Number(t.height) > 0 && (t.height = Number(t.height) * r);
|
|
10
|
-
}
|
|
11
|
-
if (o && f) {
|
|
12
|
-
const s = T(t), d = (s.minL + s.maxR) / 2, y = (s.minT + s.maxB) / 2, g = f.x + (h - o.x) * p, u = f.y + (a - o.y) * p;
|
|
13
|
-
if (t.left = (t.left ?? 0) + g - d, t.top = (t.top ?? 0) + u - y, n && t.customData) {
|
|
14
|
-
const c = t.customData;
|
|
15
|
-
typeof c.patternPhaseX == "number" && (c.patternPhaseX = f.x + (c.patternPhaseX - o.x) * p), typeof c.patternPhaseY == "number" && (c.patternPhaseY = f.y + (c.patternPhaseY - o.y) * p);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return { cloned: t, nextId: l + 1 };
|
|
19
|
-
}, M = (e) => e === "left" || e === "top" ? -0.5 : e === "center" ? 0 : e === "right" || e === "bottom" ? 0.5 : 0, T = (e) => {
|
|
20
|
-
const l = e.left ?? 0, i = e.top ?? 0, o = (e.width ?? 0) * (e.scaleX ?? 1), f = (e.height ?? 0) * (e.scaleY ?? 1), t = (e.angle ?? 0) * Math.PI / 180, m = Math.cos(t), h = Math.sin(t), a = -M(e.originX ?? "left") * o, n = -M(e.originY ?? "top") * f, p = l + a * m - n * h, s = i + a * h + n * m, d = o / 2, y = f / 2, g = [-d, d].flatMap(
|
|
21
|
-
(x) => [-y, y].map((N) => ({
|
|
22
|
-
x: p + x * m - N * h,
|
|
23
|
-
y: s + x * h + N * m
|
|
24
|
-
}))
|
|
25
|
-
);
|
|
26
|
-
let u = 1 / 0, c = 1 / 0, I = -1 / 0, b = -1 / 0;
|
|
27
|
-
for (const x of g)
|
|
28
|
-
x.x < u && (u = x.x), x.y < c && (c = x.y), x.x > I && (I = x.x), x.y > b && (b = x.y);
|
|
29
|
-
return { minL: u, minT: c, maxR: I, maxB: b };
|
|
30
|
-
}, P = (e, l, i) => {
|
|
31
|
-
if (!e.length) return;
|
|
32
|
-
let o = 1 / 0, f = 1 / 0, r = -1 / 0, t = -1 / 0;
|
|
33
|
-
for (const a of e) {
|
|
34
|
-
const n = T(a);
|
|
35
|
-
n.minL < o && (o = n.minL), n.minT < f && (f = n.minT), n.maxR > r && (r = n.maxR), n.maxB > t && (t = n.maxB);
|
|
36
|
-
}
|
|
37
|
-
const m = l - (o + r) / 2, h = i - (f + t) / 2;
|
|
38
|
-
for (const a of e)
|
|
39
|
-
a.left = (a.left ?? 0) + m, a.top = (a.top ?? 0) + h;
|
|
40
|
-
}, w = (e) => {
|
|
41
|
-
const {
|
|
42
|
-
sourceObjects: l,
|
|
43
|
-
targetJsonMap: i,
|
|
44
|
-
objectIndex: o,
|
|
45
|
-
targetScaleMap: f,
|
|
46
|
-
patternScaleMap: r,
|
|
47
|
-
sourceCenter: t,
|
|
48
|
-
targetCenterMap: m,
|
|
49
|
-
canvasCenter: h
|
|
50
|
-
} = e;
|
|
51
|
-
let a = Number.isFinite(o) ? o : 1;
|
|
52
|
-
const n = {};
|
|
53
|
-
return Object.entries(i || {}).forEach(([p, s]) => {
|
|
54
|
-
const d = Array.isArray(s?.objects) ? s.objects : [], y = f?.[p] ?? 1, g = r?.[p] ?? 1, u = m?.[p], c = [];
|
|
55
|
-
l.forEach((I) => {
|
|
56
|
-
const b = D(I, a, y, t, u, g);
|
|
57
|
-
c.push(b.cloned), a = b.nextId;
|
|
58
|
-
}), (!t || !u) && h && c.length && P(c, h.x, h.y), n[p] = { ...s, objects: [...d, ...c] };
|
|
59
|
-
}), { updates: n, nextObjectIndex: a };
|
|
60
|
-
};
|
|
61
|
-
self.onmessage = (e) => {
|
|
62
|
-
const l = e.data;
|
|
63
|
-
try {
|
|
64
|
-
const i = w(l);
|
|
65
|
-
self.postMessage({
|
|
66
|
-
id: l.id,
|
|
67
|
-
ok: !0,
|
|
68
|
-
data: i
|
|
69
|
-
});
|
|
70
|
-
} catch (i) {
|
|
71
|
-
self.postMessage({
|
|
72
|
-
id: l.id,
|
|
73
|
-
ok: !1,
|
|
74
|
-
error: i instanceof Error ? i.message : String(i)
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
};
|