@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,82 +0,0 @@
|
|
|
1
|
-
async function _(s) {
|
|
2
|
-
const { bitmap: t, quality: e } = s, i = new OffscreenCanvas(t.width, t.height), o = i.getContext("2d");
|
|
3
|
-
if (!o) throw new Error("Failed to create OffscreenCanvas 2d context");
|
|
4
|
-
o.drawImage(t, 0, 0);
|
|
5
|
-
try {
|
|
6
|
-
t.close?.();
|
|
7
|
-
} catch {
|
|
8
|
-
}
|
|
9
|
-
const r = await i.convertToBlob({ type: "image/webp", quality: e });
|
|
10
|
-
return { id: s.id, type: "ENCODE_WEBP_RESULT", blob: r };
|
|
11
|
-
}
|
|
12
|
-
async function A(s) {
|
|
13
|
-
const {
|
|
14
|
-
baseBitmap: t,
|
|
15
|
-
viewportTransform: e,
|
|
16
|
-
canvasWidth: i,
|
|
17
|
-
canvasHeight: o,
|
|
18
|
-
exportExt: r,
|
|
19
|
-
multiplier: c
|
|
20
|
-
} = s, a = e, E = a[0], x = a[4], y = a[5], R = Math.abs(E - 1) < 0.01 && Math.abs(x) < 0.5 && Math.abs(y) < 0.5;
|
|
21
|
-
let d;
|
|
22
|
-
if (R) {
|
|
23
|
-
const h = Math.max(1, Math.round(i * c)), f = Math.max(1, Math.round(o * c));
|
|
24
|
-
d = await createImageBitmap(t, {
|
|
25
|
-
resizeWidth: h,
|
|
26
|
-
resizeHeight: f,
|
|
27
|
-
resizeQuality: "medium"
|
|
28
|
-
});
|
|
29
|
-
} else {
|
|
30
|
-
const h = Math.max(1, r.width), f = Math.max(1, r.height), u = new OffscreenCanvas(h, f), p = u.getContext("2d");
|
|
31
|
-
if (!p) throw new Error("Failed to create OffscreenCanvas context");
|
|
32
|
-
const w = a[0], g = a[1], v = a[2], M = a[3], l = a[4], b = a[5], n = w * M - g * v;
|
|
33
|
-
if (Math.abs(n) < 1e-9) throw new Error("Singular viewport matrix");
|
|
34
|
-
const B = M / n, T = -g / n, O = -v / n, C = w / n, I = (v * b - M * l) / n, S = (g * l - w * b) / n, m = t.width / i || 1;
|
|
35
|
-
p.setTransform(
|
|
36
|
-
B / m,
|
|
37
|
-
T / m,
|
|
38
|
-
O / m,
|
|
39
|
-
C / m,
|
|
40
|
-
I - r.minL,
|
|
41
|
-
S - r.minT
|
|
42
|
-
), p.drawImage(t, 0, 0);
|
|
43
|
-
const W = Math.max(1, Math.round(h * c)), z = Math.max(1, Math.round(f * c));
|
|
44
|
-
d = await createImageBitmap(u, {
|
|
45
|
-
resizeWidth: W,
|
|
46
|
-
resizeHeight: z,
|
|
47
|
-
resizeQuality: "medium"
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return { id: s.id, type: "TRANSFORM_BITMAP_RESULT", bitmap: d };
|
|
51
|
-
}
|
|
52
|
-
self.onmessage = async (s) => {
|
|
53
|
-
const t = s.data;
|
|
54
|
-
if (t) {
|
|
55
|
-
if (t.type === "TRANSFORM_BITMAP") {
|
|
56
|
-
try {
|
|
57
|
-
const e = await A(t);
|
|
58
|
-
self.postMessage(e, [e.bitmap]);
|
|
59
|
-
} catch (e) {
|
|
60
|
-
self.postMessage({
|
|
61
|
-
id: t.id,
|
|
62
|
-
type: "ERROR",
|
|
63
|
-
error: e instanceof Error ? e.message : String(e)
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (t.type === "ENCODE_WEBP") {
|
|
69
|
-
try {
|
|
70
|
-
const e = await _(t);
|
|
71
|
-
self.postMessage(e);
|
|
72
|
-
} catch (e) {
|
|
73
|
-
self.postMessage({
|
|
74
|
-
id: t.id,
|
|
75
|
-
type: "ERROR",
|
|
76
|
-
error: e instanceof Error ? e.message : String(e)
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
package/dist/vite.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
async function _(s) {
|
|
2
|
-
const { bitmap: t, quality: e } = s, i = new OffscreenCanvas(t.width, t.height), o = i.getContext("2d");
|
|
3
|
-
if (!o) throw new Error("Failed to create OffscreenCanvas 2d context");
|
|
4
|
-
o.drawImage(t, 0, 0);
|
|
5
|
-
try {
|
|
6
|
-
t.close?.();
|
|
7
|
-
} catch {
|
|
8
|
-
}
|
|
9
|
-
const r = await i.convertToBlob({ type: "image/webp", quality: e });
|
|
10
|
-
return { id: s.id, type: "ENCODE_WEBP_RESULT", blob: r };
|
|
11
|
-
}
|
|
12
|
-
async function A(s) {
|
|
13
|
-
const {
|
|
14
|
-
baseBitmap: t,
|
|
15
|
-
viewportTransform: e,
|
|
16
|
-
canvasWidth: i,
|
|
17
|
-
canvasHeight: o,
|
|
18
|
-
exportExt: r,
|
|
19
|
-
multiplier: c
|
|
20
|
-
} = s, a = e, E = a[0], x = a[4], y = a[5], R = Math.abs(E - 1) < 0.01 && Math.abs(x) < 0.5 && Math.abs(y) < 0.5;
|
|
21
|
-
let d;
|
|
22
|
-
if (R) {
|
|
23
|
-
const h = Math.max(1, Math.round(i * c)), f = Math.max(1, Math.round(o * c));
|
|
24
|
-
d = await createImageBitmap(t, {
|
|
25
|
-
resizeWidth: h,
|
|
26
|
-
resizeHeight: f,
|
|
27
|
-
resizeQuality: "medium"
|
|
28
|
-
});
|
|
29
|
-
} else {
|
|
30
|
-
const h = Math.max(1, r.width), f = Math.max(1, r.height), u = new OffscreenCanvas(h, f), p = u.getContext("2d");
|
|
31
|
-
if (!p) throw new Error("Failed to create OffscreenCanvas context");
|
|
32
|
-
const w = a[0], g = a[1], v = a[2], M = a[3], l = a[4], b = a[5], n = w * M - g * v;
|
|
33
|
-
if (Math.abs(n) < 1e-9) throw new Error("Singular viewport matrix");
|
|
34
|
-
const B = M / n, T = -g / n, O = -v / n, C = w / n, I = (v * b - M * l) / n, S = (g * l - w * b) / n, m = t.width / i || 1;
|
|
35
|
-
p.setTransform(
|
|
36
|
-
B / m,
|
|
37
|
-
T / m,
|
|
38
|
-
O / m,
|
|
39
|
-
C / m,
|
|
40
|
-
I - r.minL,
|
|
41
|
-
S - r.minT
|
|
42
|
-
), p.drawImage(t, 0, 0);
|
|
43
|
-
const W = Math.max(1, Math.round(h * c)), z = Math.max(1, Math.round(f * c));
|
|
44
|
-
d = await createImageBitmap(u, {
|
|
45
|
-
resizeWidth: W,
|
|
46
|
-
resizeHeight: z,
|
|
47
|
-
resizeQuality: "medium"
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return { id: s.id, type: "TRANSFORM_BITMAP_RESULT", bitmap: d };
|
|
51
|
-
}
|
|
52
|
-
self.onmessage = async (s) => {
|
|
53
|
-
const t = s.data;
|
|
54
|
-
if (t) {
|
|
55
|
-
if (t.type === "TRANSFORM_BITMAP") {
|
|
56
|
-
try {
|
|
57
|
-
const e = await A(t);
|
|
58
|
-
self.postMessage(e, [e.bitmap]);
|
|
59
|
-
} catch (e) {
|
|
60
|
-
self.postMessage({
|
|
61
|
-
id: t.id,
|
|
62
|
-
type: "ERROR",
|
|
63
|
-
error: e instanceof Error ? e.message : String(e)
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (t.type === "ENCODE_WEBP") {
|
|
69
|
-
try {
|
|
70
|
-
const e = await _(t);
|
|
71
|
-
self.postMessage(e);
|
|
72
|
-
} catch (e) {
|
|
73
|
-
self.postMessage({
|
|
74
|
-
id: t.id,
|
|
75
|
-
type: "ERROR",
|
|
76
|
-
error: e instanceof Error ? e.message : String(e)
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|