@jetprint/editor-sdk 1.0.3 → 1.0.5
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/components/Editor/components/PreviewPanel.vue.d.ts +68 -0
- package/dist/components/Editor/composables/useCopyToDiecuts.d.ts +1 -0
- package/dist/components/Editor/workers/copyDiecuts.worker.d.ts +3 -1
- package/dist/copyDiecuts.worker.js +62 -52
- package/dist/editor-sdk.es.js +18196 -17880
- package/dist/renderWorker.js +1703 -1702
- package/dist/style.css +1 -1
- package/dist/utils/protection/encryptedModules.generated.d.ts +1 -1
- package/package.json +1 -1
|
@@ -122,6 +122,35 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
122
122
|
type: NumberConstructor;
|
|
123
123
|
default: number;
|
|
124
124
|
};
|
|
125
|
+
/** theme1 查看大图:可勾选的具体尺码列表(已去掉 SKU_ALL 等占位) */
|
|
126
|
+
sizeOptions: {
|
|
127
|
+
type: PropType<string[]>;
|
|
128
|
+
default: () => never[];
|
|
129
|
+
};
|
|
130
|
+
/** theme1 查看大图:已设计尺码集合(不在此集合且 isPerSizeDesign 时尺码禁用勾选) */
|
|
131
|
+
designedSizes: {
|
|
132
|
+
type: PropType<string[]>;
|
|
133
|
+
default: () => never[];
|
|
134
|
+
};
|
|
135
|
+
/** theme1 查看大图:是否按尺码区分设计(COMMON 同版共享时为 false,则不禁用任何尺码) */
|
|
136
|
+
isPerSizeDesign: {
|
|
137
|
+
type: BooleanConstructor;
|
|
138
|
+
default: boolean;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* theme1 查看大图:批量出图方法(来自 index.vue renderEffectImagesForSizesColors)。
|
|
142
|
+
* 给定尺码/颜色集合,返回每张成品效果图 { size, color, index(模板序号), blob }。
|
|
143
|
+
*/
|
|
144
|
+
renderEffectImages: {
|
|
145
|
+
type: PropType<(sizes: string[], colors: string[]) => Promise<Array<{
|
|
146
|
+
size: string;
|
|
147
|
+
color: string;
|
|
148
|
+
index: number;
|
|
149
|
+
name?: string;
|
|
150
|
+
blob: Blob;
|
|
151
|
+
}>>>;
|
|
152
|
+
default: null;
|
|
153
|
+
};
|
|
125
154
|
theme1LayersExpanded: {
|
|
126
155
|
type: PropType<boolean>;
|
|
127
156
|
};
|
|
@@ -257,6 +286,35 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
257
286
|
type: NumberConstructor;
|
|
258
287
|
default: number;
|
|
259
288
|
};
|
|
289
|
+
/** theme1 查看大图:可勾选的具体尺码列表(已去掉 SKU_ALL 等占位) */
|
|
290
|
+
sizeOptions: {
|
|
291
|
+
type: PropType<string[]>;
|
|
292
|
+
default: () => never[];
|
|
293
|
+
};
|
|
294
|
+
/** theme1 查看大图:已设计尺码集合(不在此集合且 isPerSizeDesign 时尺码禁用勾选) */
|
|
295
|
+
designedSizes: {
|
|
296
|
+
type: PropType<string[]>;
|
|
297
|
+
default: () => never[];
|
|
298
|
+
};
|
|
299
|
+
/** theme1 查看大图:是否按尺码区分设计(COMMON 同版共享时为 false,则不禁用任何尺码) */
|
|
300
|
+
isPerSizeDesign: {
|
|
301
|
+
type: BooleanConstructor;
|
|
302
|
+
default: boolean;
|
|
303
|
+
};
|
|
304
|
+
/**
|
|
305
|
+
* theme1 查看大图:批量出图方法(来自 index.vue renderEffectImagesForSizesColors)。
|
|
306
|
+
* 给定尺码/颜色集合,返回每张成品效果图 { size, color, index(模板序号), blob }。
|
|
307
|
+
*/
|
|
308
|
+
renderEffectImages: {
|
|
309
|
+
type: PropType<(sizes: string[], colors: string[]) => Promise<Array<{
|
|
310
|
+
size: string;
|
|
311
|
+
color: string;
|
|
312
|
+
index: number;
|
|
313
|
+
name?: string;
|
|
314
|
+
blob: Blob;
|
|
315
|
+
}>>>;
|
|
316
|
+
default: null;
|
|
317
|
+
};
|
|
260
318
|
theme1LayersExpanded: {
|
|
261
319
|
type: PropType<boolean>;
|
|
262
320
|
};
|
|
@@ -279,6 +337,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
279
337
|
selectedColor: string;
|
|
280
338
|
templateIndex: number;
|
|
281
339
|
selectedSize: string;
|
|
340
|
+
sizeOptions: string[];
|
|
282
341
|
colorOptions: string[];
|
|
283
342
|
colorLabelByValue: Record<string, string>;
|
|
284
343
|
loadingDesign: boolean;
|
|
@@ -302,6 +361,15 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
302
361
|
renderInvalidationKey: string | number;
|
|
303
362
|
useLiveWebglPreview: boolean;
|
|
304
363
|
liveWebglInternalRenderSize: number;
|
|
364
|
+
designedSizes: string[];
|
|
365
|
+
isPerSizeDesign: boolean;
|
|
366
|
+
renderEffectImages: (sizes: string[], colors: string[]) => Promise<Array<{
|
|
367
|
+
size: string;
|
|
368
|
+
color: string;
|
|
369
|
+
index: number;
|
|
370
|
+
name?: string;
|
|
371
|
+
blob: Blob;
|
|
372
|
+
}>>;
|
|
305
373
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
306
374
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
307
375
|
export default _default;
|
|
@@ -8,6 +8,8 @@ type CopyDiecutsWorkerRequest = {
|
|
|
8
8
|
targetJsonMap: Record<string, any>;
|
|
9
9
|
objectIndex: number;
|
|
10
10
|
targetScaleMap?: Record<string, number>;
|
|
11
|
+
/** 平铺专用:每个目标分片的「最长边比例」(源最长边/目标最长边),平铺 rect 的瓦片+cover 按此缩放(物理一致) */
|
|
12
|
+
patternScaleMap?: Record<string, number>;
|
|
11
13
|
/** 源分片在画布上 contain-fit 矩形中心;与 targetCenterMap 配合按"在分片内的相对位置"映射 */
|
|
12
14
|
sourceCenter?: Vec2;
|
|
13
15
|
/** 各目标分片在画布上 contain-fit 矩形中心 */
|
|
@@ -20,7 +22,7 @@ type CopyDiecutsWorkerRequest = {
|
|
|
20
22
|
* - 缩放保持原 contain-fit 比例换算(scaleFactor)。
|
|
21
23
|
* - 位置按"在源分片内的相对位置"映射到目标分片对应位置(sourceCenter → targetCenter)。
|
|
22
24
|
*/
|
|
23
|
-
declare const cloneForCopy: (obj: any, startId: number, scaleFactor: number, sourceCenter?: Vec2, targetCenter?: Vec2) => {
|
|
25
|
+
declare const cloneForCopy: (obj: any, startId: number, scaleFactor: number, sourceCenter?: Vec2, targetCenter?: Vec2, patternFactor?: number) => {
|
|
24
26
|
cloned: any;
|
|
25
27
|
nextId: number;
|
|
26
28
|
};
|
|
@@ -1,67 +1,77 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
if (
|
|
6
|
-
|
|
7
|
-
|
|
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);
|
|
8
10
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
15
24
|
}))
|
|
16
25
|
);
|
|
17
|
-
let
|
|
18
|
-
for (const
|
|
19
|
-
|
|
20
|
-
return { minL:
|
|
21
|
-
},
|
|
22
|
-
if (!
|
|
23
|
-
let
|
|
24
|
-
for (const
|
|
25
|
-
const
|
|
26
|
-
|
|
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);
|
|
27
36
|
}
|
|
28
|
-
const
|
|
29
|
-
for (const
|
|
30
|
-
|
|
31
|
-
},
|
|
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) => {
|
|
32
41
|
const {
|
|
33
|
-
sourceObjects:
|
|
34
|
-
targetJsonMap:
|
|
35
|
-
objectIndex:
|
|
36
|
-
targetScaleMap:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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 };
|
|
50
60
|
};
|
|
51
|
-
self.onmessage = (
|
|
52
|
-
const
|
|
61
|
+
self.onmessage = (e) => {
|
|
62
|
+
const l = e.data;
|
|
53
63
|
try {
|
|
54
|
-
const
|
|
64
|
+
const i = w(l);
|
|
55
65
|
self.postMessage({
|
|
56
|
-
id:
|
|
66
|
+
id: l.id,
|
|
57
67
|
ok: !0,
|
|
58
|
-
data:
|
|
68
|
+
data: i
|
|
59
69
|
});
|
|
60
|
-
} catch (
|
|
70
|
+
} catch (i) {
|
|
61
71
|
self.postMessage({
|
|
62
|
-
id:
|
|
72
|
+
id: l.id,
|
|
63
73
|
ok: !1,
|
|
64
|
-
error:
|
|
74
|
+
error: i instanceof Error ? i.message : String(i)
|
|
65
75
|
});
|
|
66
76
|
}
|
|
67
77
|
};
|