@pooder/vue 4.4.5 → 4.5.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/dist/index.es.js +138 -126
- package/dist/index.umd.js +1 -1
- package/dist/vue/src/PooderEditor.vue.d.ts +22 -97
- package/dist/vue/src/index.d.ts +1 -0
- package/dist/vue/src/model.d.ts +148 -0
- package/dist/vue.css +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,89 +1,97 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Pooder as
|
|
1
|
+
import { defineComponent as F, ref as E, onMounted as J, onUnmounted as O, createElementBlock as N, openBlock as P, createElementVNode as K, provide as Q, createVNode as Z } from "vue";
|
|
2
|
+
import { Pooder as ee } from "@pooder/core";
|
|
3
3
|
export * from "@pooder/core";
|
|
4
|
-
import { CanvasService as
|
|
4
|
+
import { CanvasService as te, SceneLayoutService as ne, BackgroundTool as oe, SizeTool as ae, ImageTool as re, WhiteInkTool as ie, DielineTool as ce, RulerTool as se, FeatureTool as de } from "@pooder/kit";
|
|
5
5
|
export * from "@pooder/kit";
|
|
6
|
-
const
|
|
6
|
+
const me = /* @__PURE__ */ F({
|
|
7
7
|
__name: "CanvasArea",
|
|
8
8
|
emits: ["canvas-ready", "resize"],
|
|
9
|
-
setup(
|
|
10
|
-
const m = l,
|
|
11
|
-
let
|
|
12
|
-
return
|
|
13
|
-
if (
|
|
14
|
-
const { clientWidth: u, clientHeight:
|
|
15
|
-
|
|
9
|
+
setup(f, { emit: l }) {
|
|
10
|
+
const m = l, o = E(null), a = E(null);
|
|
11
|
+
let c = null;
|
|
12
|
+
return J(() => {
|
|
13
|
+
if (o.value && a.value) {
|
|
14
|
+
const { clientWidth: u, clientHeight: g } = o.value;
|
|
15
|
+
a.value.width = u, a.value.height = g, m("canvas-ready", a.value), c = new ResizeObserver((v) => {
|
|
16
16
|
for (const p of v) {
|
|
17
17
|
const { width: w, height: y } = p.contentRect;
|
|
18
18
|
m("resize", w, y);
|
|
19
19
|
}
|
|
20
|
-
}),
|
|
20
|
+
}), c.observe(o.value);
|
|
21
21
|
}
|
|
22
22
|
}), O(() => {
|
|
23
|
-
|
|
24
|
-
}), (u,
|
|
23
|
+
c && c.disconnect();
|
|
24
|
+
}), (u, g) => (P(), N("div", {
|
|
25
25
|
ref_key: "container",
|
|
26
|
-
ref:
|
|
26
|
+
ref: o,
|
|
27
27
|
class: "pooder-canvas-area"
|
|
28
28
|
}, [
|
|
29
|
-
|
|
29
|
+
K("canvas", {
|
|
30
30
|
ref_key: "canvas",
|
|
31
|
-
ref:
|
|
31
|
+
ref: a
|
|
32
32
|
}, null, 512)
|
|
33
33
|
], 512));
|
|
34
34
|
}
|
|
35
|
-
}),
|
|
36
|
-
const m =
|
|
37
|
-
for (const [
|
|
38
|
-
m[
|
|
35
|
+
}), k = (f, l) => {
|
|
36
|
+
const m = f.__vccOpts || f;
|
|
37
|
+
for (const [o, a] of l)
|
|
38
|
+
m[o] = a;
|
|
39
39
|
return m;
|
|
40
|
-
},
|
|
40
|
+
}, ue = /* @__PURE__ */ k(me, [["__scopeId", "data-v-203ff8d9"]]), le = { class: "pooder-editor" }, T = "SceneLayoutService", ge = /* @__PURE__ */ F({
|
|
41
41
|
__name: "PooderEditor",
|
|
42
|
-
emits: ["image-change"],
|
|
43
|
-
setup(
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
42
|
+
emits: ["image-state-change", "image-session-notice"],
|
|
43
|
+
setup(f, { expose: l, emit: m }) {
|
|
44
|
+
const o = new ee();
|
|
45
|
+
Q("pooder", o);
|
|
46
|
+
const a = o.getService("CommandService"), c = o.getService("ConfigurationService"), u = o.getService("WorkbenchService"), g = m, v = (e) => {
|
|
47
|
+
g("image-state-change", e);
|
|
48
|
+
}, p = (e) => {
|
|
49
|
+
g("image-session-notice", e);
|
|
50
|
+
};
|
|
51
|
+
o.eventBus.on("image:state:change", v), o.eventBus.on("image:session:notice", p);
|
|
52
|
+
const w = (e) => {
|
|
53
|
+
c.import(e);
|
|
54
|
+
}, y = () => c.export(), R = async (e) => {
|
|
51
55
|
try {
|
|
52
|
-
const t = await
|
|
56
|
+
const t = await a.executeCommand(
|
|
53
57
|
"exportCutImage",
|
|
54
58
|
e
|
|
55
59
|
);
|
|
56
60
|
return t || console.warn("[PooderEditor] generateCutImage returned null", {
|
|
57
61
|
options: e,
|
|
58
|
-
imageCount: (
|
|
59
|
-
hasCanvasService: !!
|
|
62
|
+
imageCount: (c.get("image.items") || []).length,
|
|
63
|
+
hasCanvasService: !!o.getService("CanvasService")
|
|
60
64
|
}), t;
|
|
61
65
|
} catch (t) {
|
|
62
66
|
throw console.error("[PooderEditor] generateCutImage failed", t), t;
|
|
63
67
|
}
|
|
64
|
-
},
|
|
68
|
+
}, _ = async (e, t) => await a.executeCommand("upsertImage", e, {
|
|
65
69
|
id: t?.id,
|
|
66
70
|
mode: t?.mode,
|
|
67
71
|
addOptions: t?.addOptions,
|
|
68
|
-
|
|
69
|
-
}),
|
|
72
|
+
operation: t?.operation
|
|
73
|
+
}), D = async (e, t) => (await _(e, {
|
|
70
74
|
mode: "add",
|
|
71
|
-
addOptions: t
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
addOptions: t
|
|
76
|
+
})).id, U = async (e, t, n) => await a.executeCommand(
|
|
77
|
+
"applyImageOperation",
|
|
78
|
+
e,
|
|
79
|
+
t,
|
|
80
|
+
n
|
|
81
|
+
), z = async () => await a.executeCommand("getImageViewState"), M = async (e, t, n) => await a.executeCommand("setImageTransform", e, t, n), W = (e) => (o.eventBus.on("image:state:change", e), () => o.eventBus.off("image:state:change", e)), L = (e) => (o.eventBus.on("image:session:notice", e), () => o.eventBus.off("image:session:notice", e)), Y = async (e, t) => await a.executeCommand("updateImage", e, t), A = async () => await a.executeCommand("clearImages"), C = async (e) => await a.executeCommand(
|
|
74
82
|
"exportUserCroppedImage",
|
|
75
83
|
e
|
|
76
|
-
),
|
|
77
|
-
|
|
78
|
-
const n = Number(e.imageWidth ?? t?.width ?? 0),
|
|
79
|
-
|
|
84
|
+
), H = async (e, t) => await a.executeCommand("focusImage", e, t), x = (e, t) => {
|
|
85
|
+
c.update("dieline.shape", "custom"), c.update("dieline.pathData", e.pathData);
|
|
86
|
+
const n = Number(e.imageWidth ?? t?.width ?? 0), r = Number(e.imageHeight ?? t?.height ?? 0);
|
|
87
|
+
c.update(
|
|
80
88
|
"dieline.customSourceWidthPx",
|
|
81
89
|
Number.isFinite(n) && n > 0 ? n : void 0
|
|
82
|
-
),
|
|
90
|
+
), c.update(
|
|
83
91
|
"dieline.customSourceHeightPx",
|
|
84
|
-
Number.isFinite(
|
|
85
|
-
),
|
|
86
|
-
}, b = (e) => !!e && Number.isFinite(e.x) && Number.isFinite(e.y) && Number.isFinite(e.width) && Number.isFinite(e.height) && e.width > 0 && e.height > 0,
|
|
92
|
+
Number.isFinite(r) && r > 0 ? r : void 0
|
|
93
|
+
), c.update("size.cutMode", "trim"), c.update("size.cutMarginMm", 0);
|
|
94
|
+
}, b = (e) => !!e && Number.isFinite(e.x) && Number.isFinite(e.y) && Number.isFinite(e.width) && Number.isFinite(e.height) && e.width > 0 && e.height > 0, I = (e, t) => {
|
|
87
95
|
const n = e.rawBounds || e.baseBounds || null;
|
|
88
96
|
if (!n)
|
|
89
97
|
return {
|
|
@@ -95,17 +103,17 @@ const ie = /* @__PURE__ */ B({
|
|
|
95
103
|
coverageX: 0,
|
|
96
104
|
coverageY: 0
|
|
97
105
|
};
|
|
98
|
-
const
|
|
106
|
+
const r = t.width / 2, i = t.height / 2, s = n.x + n.width / 2, d = n.y + n.height / 2;
|
|
99
107
|
return {
|
|
100
108
|
sourceWidth: t.width,
|
|
101
109
|
sourceHeight: t.height,
|
|
102
110
|
detectedBounds: n,
|
|
103
|
-
centerOffsetX: s -
|
|
104
|
-
centerOffsetY: d -
|
|
111
|
+
centerOffsetX: s - r,
|
|
112
|
+
centerOffsetY: d - i,
|
|
105
113
|
coverageX: t.width > 0 ? n.width / t.width : 0,
|
|
106
114
|
coverageY: t.height > 0 ? n.height / t.height : 0
|
|
107
115
|
};
|
|
108
|
-
},
|
|
116
|
+
}, X = (e) => {
|
|
109
117
|
if (!b(e.rawBounds) || !b(e.baseBounds))
|
|
110
118
|
return null;
|
|
111
119
|
const t = e.rawBounds, n = e.baseBounds;
|
|
@@ -115,61 +123,65 @@ const ie = /* @__PURE__ */ B({
|
|
|
115
123
|
right: t.x + t.width - (n.x + n.width),
|
|
116
124
|
bottom: t.y + t.height - (n.y + n.height)
|
|
117
125
|
};
|
|
118
|
-
},
|
|
119
|
-
const
|
|
120
|
-
left:
|
|
121
|
-
top:
|
|
122
|
-
right:
|
|
123
|
-
bottom:
|
|
124
|
-
} : null, d =
|
|
125
|
-
x:
|
|
126
|
-
y:
|
|
126
|
+
}, V = (e, t, n) => {
|
|
127
|
+
const r = I(e, t), i = X(e), s = i ? {
|
|
128
|
+
left: i.left - n,
|
|
129
|
+
top: i.top - n,
|
|
130
|
+
right: i.right - n,
|
|
131
|
+
bottom: i.bottom - n
|
|
132
|
+
} : null, d = i ? {
|
|
133
|
+
x: i.right - i.left,
|
|
134
|
+
y: i.bottom - i.top
|
|
127
135
|
} : null;
|
|
128
136
|
return {
|
|
129
|
-
frame:
|
|
130
|
-
margin:
|
|
137
|
+
frame: r,
|
|
138
|
+
margin: i,
|
|
131
139
|
expectedExpand: n,
|
|
132
140
|
marginDeltaFromExpected: s,
|
|
133
141
|
marginAsymmetry: d
|
|
134
142
|
};
|
|
135
|
-
},
|
|
143
|
+
}, j = async (e, t, n) => {
|
|
136
144
|
if (!e.length) return null;
|
|
137
|
-
const
|
|
145
|
+
const r = await C({
|
|
138
146
|
multiplier: n?.multiplier ?? 2,
|
|
139
147
|
format: n?.format ?? "png",
|
|
140
148
|
imageIds: e
|
|
141
|
-
}),
|
|
142
|
-
if (!
|
|
149
|
+
}), i = r?.url;
|
|
150
|
+
if (!i) return null;
|
|
143
151
|
try {
|
|
144
|
-
const s = await
|
|
152
|
+
const s = await a.executeCommand("detectEdge", i, {
|
|
145
153
|
expand: n?.detect?.expand ?? 0,
|
|
146
154
|
smoothing: n?.detect?.smoothing ?? !0,
|
|
147
155
|
simplifyTolerance: n?.detect?.simplifyTolerance ?? 2,
|
|
148
156
|
threshold: n?.detect?.threshold,
|
|
149
157
|
debug: !1
|
|
150
158
|
});
|
|
151
|
-
return s ?
|
|
159
|
+
return s ? V(
|
|
152
160
|
s,
|
|
153
|
-
|
|
161
|
+
r,
|
|
154
162
|
t
|
|
155
163
|
) : null;
|
|
156
164
|
} finally {
|
|
157
|
-
URL.revokeObjectURL(
|
|
165
|
+
URL.revokeObjectURL(i);
|
|
158
166
|
}
|
|
159
167
|
};
|
|
160
168
|
l({
|
|
161
|
-
importConfig:
|
|
162
|
-
exportConfig:
|
|
163
|
-
getImages: y,
|
|
169
|
+
importConfig: w,
|
|
170
|
+
exportConfig: y,
|
|
164
171
|
generateCutImage: R,
|
|
165
|
-
addImage:
|
|
166
|
-
upsertImage:
|
|
167
|
-
|
|
168
|
-
|
|
172
|
+
addImage: D,
|
|
173
|
+
upsertImage: _,
|
|
174
|
+
getImageState: z,
|
|
175
|
+
onImageStateChange: W,
|
|
176
|
+
onImageSessionNotice: L,
|
|
177
|
+
applyImageOperation: U,
|
|
178
|
+
setImageTransform: M,
|
|
179
|
+
updateImage: Y,
|
|
180
|
+
clearImages: A,
|
|
169
181
|
exportUserCroppedImage: C,
|
|
170
|
-
focusImage:
|
|
182
|
+
focusImage: H,
|
|
171
183
|
detectDieline: async (e) => {
|
|
172
|
-
const t = await
|
|
184
|
+
const t = await a.executeCommand("detectEdge", e, {
|
|
173
185
|
expand: 10,
|
|
174
186
|
// 安全距离(像素)
|
|
175
187
|
smoothing: !0,
|
|
@@ -179,8 +191,8 @@ const ie = /* @__PURE__ */ B({
|
|
|
179
191
|
});
|
|
180
192
|
return t ? (x(t), t.pathData) : null;
|
|
181
193
|
},
|
|
182
|
-
detectDielineFromFrame: async (e) => {
|
|
183
|
-
const t = e?.detect?.debug === !0, n = e?.inspect?.includeCroppedImage === !0,
|
|
194
|
+
detectDielineFromFrame: async (e = {}) => {
|
|
195
|
+
const t = e?.detect?.debug === !0, n = e?.inspect?.includeCroppedImage === !0, r = e?.inspect?.includeDiagnostics === !0, i = Math.max(0, Number(e?.detect?.expand ?? 0)), s = await C({
|
|
184
196
|
multiplier: e?.export?.multiplier ?? 2,
|
|
185
197
|
format: e?.export?.format ?? "png",
|
|
186
198
|
imageIds: e?.export?.imageIds
|
|
@@ -188,26 +200,26 @@ const ie = /* @__PURE__ */ B({
|
|
|
188
200
|
if (!d)
|
|
189
201
|
return console.warn("[PooderEditor] detectDielineFromFrame no source image"), null;
|
|
190
202
|
try {
|
|
191
|
-
const
|
|
203
|
+
const h = await a.executeCommand("detectEdge", d, {
|
|
192
204
|
expand: e?.detect?.expand ?? 0,
|
|
193
205
|
smoothing: e?.detect?.smoothing ?? !0,
|
|
194
206
|
simplifyTolerance: e?.detect?.simplifyTolerance ?? 2,
|
|
195
207
|
threshold: e?.detect?.threshold,
|
|
196
208
|
debug: t
|
|
197
209
|
});
|
|
198
|
-
if (!
|
|
210
|
+
if (!h)
|
|
199
211
|
return console.warn(
|
|
200
212
|
"[PooderEditor] detectDielineFromFrame detectEdge returned null"
|
|
201
213
|
), null;
|
|
202
|
-
const
|
|
214
|
+
const B = I(h, s);
|
|
203
215
|
if (e?.commit === !1)
|
|
204
216
|
return {
|
|
205
|
-
...
|
|
217
|
+
...h,
|
|
206
218
|
...n ? { sourceImage: s } : {},
|
|
207
|
-
...
|
|
219
|
+
...r ? { diagnostics: B } : {}
|
|
208
220
|
};
|
|
209
|
-
x(
|
|
210
|
-
const
|
|
221
|
+
x(h, s);
|
|
222
|
+
const G = {
|
|
211
223
|
multiplier: e?.export?.multiplier ?? 2,
|
|
212
224
|
format: e?.export?.format ?? "png",
|
|
213
225
|
detect: {
|
|
@@ -217,10 +229,10 @@ const ie = /* @__PURE__ */ B({
|
|
|
217
229
|
threshold: e?.detect?.threshold
|
|
218
230
|
}
|
|
219
231
|
};
|
|
220
|
-
let S = await
|
|
232
|
+
let S = await j(
|
|
221
233
|
s.imageIds,
|
|
222
|
-
|
|
223
|
-
|
|
234
|
+
i,
|
|
235
|
+
G
|
|
224
236
|
);
|
|
225
237
|
return S ? console.info(
|
|
226
238
|
"[PooderEditor] detectDielineFromFrame post-commit diagnostics",
|
|
@@ -228,67 +240,67 @@ const ie = /* @__PURE__ */ B({
|
|
|
228
240
|
) : s.imageIds.length > 0 && console.warn(
|
|
229
241
|
"[PooderEditor] detectDielineFromFrame post-commit detectEdge returned null"
|
|
230
242
|
), {
|
|
231
|
-
...
|
|
243
|
+
...h,
|
|
232
244
|
...n ? { sourceImage: s } : {},
|
|
233
|
-
...
|
|
245
|
+
...r ? { diagnostics: B, postCommitDiagnostics: S } : {}
|
|
234
246
|
};
|
|
235
247
|
} finally {
|
|
236
248
|
d && !n && URL.revokeObjectURL(d);
|
|
237
249
|
}
|
|
238
250
|
},
|
|
239
251
|
uploadAndDetectEdge: async (e, t) => {
|
|
240
|
-
const n = await
|
|
252
|
+
const n = await D(e), r = await a.executeCommand("detectEdge", e, {
|
|
241
253
|
expand: t?.expand ?? 10,
|
|
242
254
|
smoothing: t?.smoothing ?? !0,
|
|
243
255
|
simplifyTolerance: t?.simplifyTolerance ?? 2
|
|
244
256
|
});
|
|
245
|
-
return
|
|
257
|
+
return r ? (x(r), { imageId: n, url: e, pathData: r.pathData }) : null;
|
|
246
258
|
},
|
|
247
259
|
activateTool: async (e) => await u.switchTool(e),
|
|
248
260
|
deactivateTool: async () => await u.deactivate(),
|
|
249
|
-
on: (e, t) =>
|
|
250
|
-
off: (e, t) =>
|
|
251
|
-
emit: (e, t) =>
|
|
252
|
-
executeCommand: (e, ...t) =>
|
|
253
|
-
getConfig: (e) =>
|
|
254
|
-
updateConfig: (e, t) =>
|
|
261
|
+
on: (e, t) => o.eventBus.on(e, t),
|
|
262
|
+
off: (e, t) => o.eventBus.off(e, t),
|
|
263
|
+
emit: (e, t) => o.eventBus.emit(e, t),
|
|
264
|
+
executeCommand: (e, ...t) => a.executeCommand(e, ...t),
|
|
265
|
+
getConfig: (e) => c.get(e),
|
|
266
|
+
updateConfig: (e, t) => c.update(e, t),
|
|
255
267
|
services: {
|
|
256
268
|
workbench: u,
|
|
257
|
-
command:
|
|
258
|
-
config:
|
|
269
|
+
command: a,
|
|
270
|
+
config: c
|
|
259
271
|
}
|
|
260
272
|
});
|
|
261
|
-
const
|
|
262
|
-
const t = new
|
|
263
|
-
eventBus:
|
|
273
|
+
const $ = (e) => {
|
|
274
|
+
const t = new te(e, {
|
|
275
|
+
eventBus: o.eventBus
|
|
264
276
|
});
|
|
265
|
-
|
|
266
|
-
new
|
|
267
|
-
new
|
|
268
|
-
new
|
|
277
|
+
o.registerService(t, "CanvasService"), o.registerService(new ne(), T), [
|
|
278
|
+
new oe(),
|
|
279
|
+
new ae(),
|
|
280
|
+
new re(),
|
|
269
281
|
// new FilmTool(),
|
|
270
|
-
new
|
|
282
|
+
new ie(),
|
|
271
283
|
// new MirrorTool(),
|
|
272
|
-
new
|
|
273
|
-
new
|
|
274
|
-
new
|
|
275
|
-
].forEach((
|
|
276
|
-
|
|
284
|
+
new ce(),
|
|
285
|
+
new se(),
|
|
286
|
+
new de()
|
|
287
|
+
].forEach((r) => {
|
|
288
|
+
o.extensionManager.register(r);
|
|
277
289
|
});
|
|
278
|
-
},
|
|
279
|
-
const n =
|
|
290
|
+
}, q = (e, t) => {
|
|
291
|
+
const n = o.getService("CanvasService");
|
|
280
292
|
n && n.resize(e, t);
|
|
281
293
|
};
|
|
282
294
|
return O(() => {
|
|
283
|
-
v.
|
|
284
|
-
}), (e, t) => (
|
|
285
|
-
|
|
286
|
-
onCanvasReady:
|
|
287
|
-
onResize:
|
|
295
|
+
o.eventBus.off("image:state:change", v), o.eventBus.off("image:session:notice", p), o.extensionManager.destroy(), o.unregisterService(T), o.unregisterService("CanvasService");
|
|
296
|
+
}), (e, t) => (P(), N("div", le, [
|
|
297
|
+
Z(ue, {
|
|
298
|
+
onCanvasReady: $,
|
|
299
|
+
onResize: q
|
|
288
300
|
})
|
|
289
301
|
]));
|
|
290
302
|
}
|
|
291
|
-
}),
|
|
303
|
+
}), xe = /* @__PURE__ */ k(ge, [["__scopeId", "data-v-d74921ee"]]);
|
|
292
304
|
export {
|
|
293
|
-
|
|
305
|
+
xe as PooderEditor
|
|
294
306
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(u,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue"),require("@pooder/core"),require("@pooder/kit")):typeof define=="function"&&define.amd?define(["exports","vue","@pooder/core","@pooder/kit"],c):(u=typeof globalThis<"u"?globalThis:u||self,c(u.PooderVue={},u.Vue,u.PooderCore,u.PooderKit))})(this,(function(u,c,x,l){"use strict";const R=c.defineComponent({__name:"CanvasArea",emits:["canvas-ready","resize"],setup(d,{emit:p}){const f=p,o=c.ref(null),r=c.ref(null);let s=null;return c.onMounted(()=>{if(o.value&&r.value){const{clientWidth:h,clientHeight:v}=o.value;r.value.width=h,r.value.height=v,f("canvas-ready",r.value),s=new ResizeObserver(w=>{for(const C of w){const{width:S,height:b}=C.contentRect;f("resize",S,b)}}),s.observe(o.value)}}),c.onUnmounted(()=>{s&&s.disconnect()}),(h,v)=>(c.openBlock(),c.createElementBlock("div",{ref_key:"container",ref:o,class:"pooder-canvas-area"},[c.createElementVNode("canvas",{ref_key:"canvas",ref:r},null,512)],512))}}),B=(d,p)=>{const f=d.__vccOpts||d;for(const[o,r]of p)f[o]=r;return f},U=B(R,[["__scopeId","data-v-203ff8d9"]]),j={class:"pooder-editor"},E="SceneLayoutService",z=B(c.defineComponent({__name:"PooderEditor",emits:["image-state-change","image-session-notice"],setup(d,{expose:p,emit:f}){const o=new x.Pooder;c.provide("pooder",o);const r=o.getService("CommandService"),s=o.getService("ConfigurationService"),h=o.getService("WorkbenchService"),v=f,w=e=>{v("image-state-change",e)},C=e=>{v("image-session-notice",e)};o.eventBus.on("image:state:change",w),o.eventBus.on("image:session:notice",C);const S=e=>{s.import(e)},b=()=>s.export(),M=async e=>{try{const t=await r.executeCommand("exportCutImage",e);return t||console.warn("[PooderEditor] generateCutImage returned null",{options:e,imageCount:(s.get("image.items")||[]).length,hasCanvasService:!!o.getService("CanvasService")}),t}catch(t){throw console.error("[PooderEditor] generateCutImage failed",t),t}},O=async(e,t)=>await r.executeCommand("upsertImage",e,{id:t?.id,mode:t?.mode,addOptions:t?.addOptions,operation:t?.operation}),T=async(e,t)=>(await O(e,{mode:"add",addOptions:t})).id,W=async(e,t,n)=>await r.executeCommand("applyImageOperation",e,t,n),L=async()=>await r.executeCommand("getImageViewState"),V=async(e,t,n)=>await r.executeCommand("setImageTransform",e,t,n),Y=e=>(o.eventBus.on("image:state:change",e),()=>o.eventBus.off("image:state:change",e)),A=e=>(o.eventBus.on("image:session:notice",e),()=>o.eventBus.off("image:session:notice",e)),H=async(e,t)=>await r.executeCommand("updateImage",e,t),X=async()=>await r.executeCommand("clearImages"),_=async e=>await r.executeCommand("exportUserCroppedImage",e),q=async(e,t)=>await r.executeCommand("focusImage",e,t),D=(e,t)=>{s.update("dieline.shape","custom"),s.update("dieline.pathData",e.pathData);const n=Number(e.imageWidth??t?.width??0),a=Number(e.imageHeight??t?.height??0);s.update("dieline.customSourceWidthPx",Number.isFinite(n)&&n>0?n:void 0),s.update("dieline.customSourceHeightPx",Number.isFinite(a)&&a>0?a:void 0),s.update("size.cutMode","trim"),s.update("size.cutMarginMm",0)},P=e=>!!e&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.width)&&Number.isFinite(e.height)&&e.width>0&&e.height>0,F=(e,t)=>{const n=e.rawBounds||e.baseBounds||null;if(!n)return{sourceWidth:t.width,sourceHeight:t.height,detectedBounds:null,centerOffsetX:0,centerOffsetY:0,coverageX:0,coverageY:0};const a=t.width/2,i=t.height/2,m=n.x+n.width/2,g=n.y+n.height/2;return{sourceWidth:t.width,sourceHeight:t.height,detectedBounds:n,centerOffsetX:m-a,centerOffsetY:g-i,coverageX:t.width>0?n.width/t.width:0,coverageY:t.height>0?n.height/t.height:0}},k=e=>{if(!P(e.rawBounds)||!P(e.baseBounds))return null;const t=e.rawBounds,n=e.baseBounds;return{left:n.x-t.x,top:n.y-t.y,right:t.x+t.width-(n.x+n.width),bottom:t.y+t.height-(n.y+n.height)}},K=(e,t,n)=>{const a=F(e,t),i=k(e),m=i?{left:i.left-n,top:i.top-n,right:i.right-n,bottom:i.bottom-n}:null,g=i?{x:i.right-i.left,y:i.bottom-i.top}:null;return{frame:a,margin:i,expectedExpand:n,marginDeltaFromExpected:m,marginAsymmetry:g}},$=async(e,t,n)=>{if(!e.length)return null;const a=await _({multiplier:n?.multiplier??2,format:n?.format??"png",imageIds:e}),i=a?.url;if(!i)return null;try{const m=await r.executeCommand("detectEdge",i,{expand:n?.detect?.expand??0,smoothing:n?.detect?.smoothing??!0,simplifyTolerance:n?.detect?.simplifyTolerance??2,threshold:n?.detect?.threshold,debug:!1});return m?K(m,a,t):null}finally{URL.revokeObjectURL(i)}};p({importConfig:S,exportConfig:b,generateCutImage:M,addImage:T,upsertImage:O,getImageState:L,onImageStateChange:Y,onImageSessionNotice:A,applyImageOperation:W,setImageTransform:V,updateImage:H,clearImages:X,exportUserCroppedImage:_,focusImage:q,detectDieline:async e=>{const t=await r.executeCommand("detectEdge",e,{expand:10,smoothing:!0,simplifyTolerance:2});return t?(D(t),t.pathData):null},detectDielineFromFrame:async(e={})=>{const t=e?.detect?.debug===!0,n=e?.inspect?.includeCroppedImage===!0,a=e?.inspect?.includeDiagnostics===!0,i=Math.max(0,Number(e?.detect?.expand??0)),m=await _({multiplier:e?.export?.multiplier??2,format:e?.export?.format??"png",imageIds:e?.export?.imageIds}),g=m?.url;if(!g)return console.warn("[PooderEditor] detectDielineFromFrame no source image"),null;try{const y=await r.executeCommand("detectEdge",g,{expand:e?.detect?.expand??0,smoothing:e?.detect?.smoothing??!0,simplifyTolerance:e?.detect?.simplifyTolerance??2,threshold:e?.detect?.threshold,debug:t});if(!y)return console.warn("[PooderEditor] detectDielineFromFrame detectEdge returned null"),null;const N=F(y,m);if(e?.commit===!1)return{...y,...n?{sourceImage:m}:{},...a?{diagnostics:N}:{}};D(y,m);const Q={multiplier:e?.export?.multiplier??2,format:e?.export?.format??"png",detect:{expand:e?.detect?.expand??0,smoothing:e?.detect?.smoothing??!0,simplifyTolerance:e?.detect?.simplifyTolerance??2,threshold:e?.detect?.threshold}};let I=await $(m.imageIds,i,Q);return I?console.info("[PooderEditor] detectDielineFromFrame post-commit diagnostics",I):m.imageIds.length>0&&console.warn("[PooderEditor] detectDielineFromFrame post-commit detectEdge returned null"),{...y,...n?{sourceImage:m}:{},...a?{diagnostics:N,postCommitDiagnostics:I}:{}}}finally{g&&!n&&URL.revokeObjectURL(g)}},uploadAndDetectEdge:async(e,t)=>{const n=await T(e),a=await r.executeCommand("detectEdge",e,{expand:t?.expand??10,smoothing:t?.smoothing??!0,simplifyTolerance:t?.simplifyTolerance??2});return a?(D(a),{imageId:n,url:e,pathData:a.pathData}):null},activateTool:async e=>await h.switchTool(e),deactivateTool:async()=>await h.deactivate(),on:(e,t)=>o.eventBus.on(e,t),off:(e,t)=>o.eventBus.off(e,t),emit:(e,t)=>o.eventBus.emit(e,t),executeCommand:(e,...t)=>r.executeCommand(e,...t),getConfig:e=>s.get(e),updateConfig:(e,t)=>s.update(e,t),services:{workbench:h,command:r,config:s}});const G=e=>{const t=new l.CanvasService(e,{eventBus:o.eventBus});o.registerService(t,"CanvasService"),o.registerService(new l.SceneLayoutService,E),[new l.BackgroundTool,new l.SizeTool,new l.ImageTool,new l.WhiteInkTool,new l.DielineTool,new l.RulerTool,new l.FeatureTool].forEach(a=>{o.extensionManager.register(a)})},J=(e,t)=>{const n=o.getService("CanvasService");n&&n.resize(e,t)};return c.onUnmounted(()=>{o.eventBus.off("image:state:change",w),o.eventBus.off("image:session:notice",C),o.extensionManager.destroy(),o.unregisterService(E),o.unregisterService("CanvasService")}),(e,t)=>(c.openBlock(),c.createElementBlock("div",j,[c.createVNode(U,{onCanvasReady:G,onResize:J})]))}}),[["__scopeId","data-v-d74921ee"]]);u.PooderEditor=z,Object.keys(x).forEach(d=>{d!=="default"&&!Object.prototype.hasOwnProperty.call(u,d)&&Object.defineProperty(u,d,{enumerable:!0,get:()=>x[d]})}),Object.keys(l).forEach(d=>{d!=="default"&&!Object.prototype.hasOwnProperty.call(u,d)&&Object.defineProperty(u,d,{enumerable:!0,get:()=>l[d]})}),Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1,112 +1,35 @@
|
|
|
1
1
|
import { CommandService, ConfigurationService, WorkbenchService } from '../../core/src/index.ts';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
y: number;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
}
|
|
8
|
-
interface DetectFrameDiagnostics {
|
|
9
|
-
sourceWidth: number;
|
|
10
|
-
sourceHeight: number;
|
|
11
|
-
detectedBounds: DetectBounds | null;
|
|
12
|
-
centerOffsetX: number;
|
|
13
|
-
centerOffsetY: number;
|
|
14
|
-
coverageX: number;
|
|
15
|
-
coverageY: number;
|
|
16
|
-
}
|
|
17
|
-
interface DetectMarginDiagnostics {
|
|
18
|
-
left: number;
|
|
19
|
-
top: number;
|
|
20
|
-
right: number;
|
|
21
|
-
bottom: number;
|
|
22
|
-
}
|
|
23
|
-
interface DetectPostCommitDiagnostics {
|
|
24
|
-
frame: DetectFrameDiagnostics;
|
|
25
|
-
margin: DetectMarginDiagnostics | null;
|
|
26
|
-
expectedExpand: number;
|
|
27
|
-
marginDeltaFromExpected: DetectMarginDiagnostics | null;
|
|
28
|
-
marginAsymmetry: {
|
|
29
|
-
x: number;
|
|
30
|
-
y: number;
|
|
31
|
-
} | null;
|
|
32
|
-
}
|
|
33
|
-
interface ExportUserCroppedImageResult {
|
|
34
|
-
url: string;
|
|
35
|
-
width: number;
|
|
36
|
-
height: number;
|
|
37
|
-
multiplier: number;
|
|
38
|
-
format: "png" | "jpeg";
|
|
39
|
-
imageIds: string[];
|
|
40
|
-
}
|
|
2
|
+
import { ImageOperation, ImageSessionNotice, ImageTransformUpdates, ImageViewState } from '../../kit/src/index.ts';
|
|
3
|
+
import { PooderDetectDielineFromFrameOptions, PooderDetectDielineFromFrameResult, PooderEditorImageStateChangeHandler, PooderEditorImageSessionNoticeHandler, PooderExportUserCroppedImageOptions, PooderExportUserCroppedImageResult as ExportUserCroppedImageResult, PooderFocusImageOptions, PooderGenerateCutImageOptions, PooderImageTarget, PooderUpsertImageOptions, PooderUploadAndDetectEdgeOptions, PooderUploadAndDetectEdgeResult } from './model';
|
|
41
4
|
declare const _default: import('vue').DefineComponent<{}, {
|
|
42
5
|
importConfig: (config: Record<string, any>) => void;
|
|
43
6
|
exportConfig: () => Record<string, any>;
|
|
44
|
-
|
|
45
|
-
generateCutImage: (options?: {
|
|
46
|
-
debug?: boolean;
|
|
47
|
-
}) => Promise<string | null>;
|
|
7
|
+
generateCutImage: (options?: PooderGenerateCutImageOptions) => Promise<string | null>;
|
|
48
8
|
addImage: (url: string, options?: any) => Promise<any>;
|
|
49
|
-
upsertImage: (url: string, options?:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
9
|
+
upsertImage: (url: string, options?: PooderUpsertImageOptions) => Promise<any>;
|
|
10
|
+
getImageState: () => Promise<ImageViewState>;
|
|
11
|
+
onImageStateChange: (handler: PooderEditorImageStateChangeHandler) => () => void;
|
|
12
|
+
onImageSessionNotice: (handler: PooderEditorImageSessionNoticeHandler) => () => void;
|
|
13
|
+
applyImageOperation: (id: string, operation: ImageOperation, options?: {
|
|
14
|
+
target?: PooderImageTarget;
|
|
15
|
+
}) => Promise<any>;
|
|
16
|
+
setImageTransform: (id: string, updates: ImageTransformUpdates, options?: {
|
|
17
|
+
target?: PooderImageTarget;
|
|
54
18
|
}) => Promise<any>;
|
|
55
19
|
updateImage: (id: string, options?: any) => Promise<any>;
|
|
56
20
|
clearImages: () => Promise<any>;
|
|
57
|
-
exportUserCroppedImage: (options?:
|
|
58
|
-
|
|
59
|
-
format?: "png" | "jpeg";
|
|
60
|
-
imageIds?: string[];
|
|
61
|
-
}) => Promise<ExportUserCroppedImageResult>;
|
|
62
|
-
focusImage: (id: string | null, options?: {
|
|
63
|
-
syncCanvasSelection?: boolean;
|
|
64
|
-
}) => Promise<any>;
|
|
21
|
+
exportUserCroppedImage: (options?: PooderExportUserCroppedImageOptions) => Promise<ExportUserCroppedImageResult>;
|
|
22
|
+
focusImage: (id: string | null, options?: PooderFocusImageOptions) => Promise<any>;
|
|
65
23
|
detectDieline: (url: string) => Promise<string | null>;
|
|
66
|
-
detectDielineFromFrame: (options?:
|
|
67
|
-
|
|
68
|
-
expand?: number;
|
|
69
|
-
smoothing?: boolean;
|
|
70
|
-
simplifyTolerance?: number;
|
|
71
|
-
threshold?: number;
|
|
72
|
-
debug?: boolean;
|
|
73
|
-
};
|
|
74
|
-
export?: {
|
|
75
|
-
multiplier?: number;
|
|
76
|
-
format?: "png" | "jpeg";
|
|
77
|
-
imageIds?: string[];
|
|
78
|
-
};
|
|
79
|
-
inspect?: {
|
|
80
|
-
includeCroppedImage?: boolean;
|
|
81
|
-
includeDiagnostics?: boolean;
|
|
82
|
-
};
|
|
83
|
-
commit?: boolean;
|
|
84
|
-
}) => Promise<{
|
|
85
|
-
diagnostics?: DetectFrameDiagnostics | undefined;
|
|
86
|
-
postCommitDiagnostics?: DetectPostCommitDiagnostics | null | undefined;
|
|
87
|
-
sourceImage?: ExportUserCroppedImageResult | undefined;
|
|
88
|
-
pathData: string;
|
|
89
|
-
rawBounds?: DetectBounds;
|
|
90
|
-
baseBounds?: DetectBounds;
|
|
91
|
-
imageWidth?: number;
|
|
92
|
-
imageHeight?: number;
|
|
93
|
-
} | null>;
|
|
94
|
-
uploadAndDetectEdge: (url: string, options?: {
|
|
95
|
-
expand?: number;
|
|
96
|
-
smoothing?: boolean;
|
|
97
|
-
simplifyTolerance?: number;
|
|
98
|
-
}) => Promise<{
|
|
99
|
-
imageId: any;
|
|
100
|
-
url: string;
|
|
101
|
-
pathData: string;
|
|
102
|
-
} | null>;
|
|
24
|
+
detectDielineFromFrame: (options?: PooderDetectDielineFromFrameOptions) => Promise<PooderDetectDielineFromFrameResult | null>;
|
|
25
|
+
uploadAndDetectEdge: (url: string, options?: PooderUploadAndDetectEdgeOptions) => Promise<PooderUploadAndDetectEdgeResult | null>;
|
|
103
26
|
activateTool: (id: string | null) => Promise<import('../../core/src/services/WorkbenchService').ToolSwitchResult>;
|
|
104
27
|
deactivateTool: () => Promise<import('../../core/src/services/WorkbenchService').ToolSwitchResult>;
|
|
105
28
|
on: (event: string, handler: any) => void;
|
|
106
29
|
off: (event: string, handler: any) => void;
|
|
107
30
|
emit: (event: string, data: any) => void;
|
|
108
|
-
executeCommand: (id: string, ...args: any[]) => Promise<
|
|
109
|
-
getConfig: (key: string) =>
|
|
31
|
+
executeCommand: <T = unknown>(id: string, ...args: any[]) => Promise<T>;
|
|
32
|
+
getConfig: <T = unknown>(key: string) => T;
|
|
110
33
|
updateConfig: (key: string, val: any) => void;
|
|
111
34
|
services: {
|
|
112
35
|
workbench: WorkbenchService;
|
|
@@ -114,8 +37,10 @@ declare const _default: import('vue').DefineComponent<{}, {
|
|
|
114
37
|
config: ConfigurationService;
|
|
115
38
|
};
|
|
116
39
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
117
|
-
"image-change": (
|
|
40
|
+
"image-state-change": (state: ImageViewState) => any;
|
|
41
|
+
"image-session-notice": (notice: ImageSessionNotice | null) => any;
|
|
118
42
|
}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{
|
|
119
|
-
"onImage-change"?: ((
|
|
43
|
+
"onImage-state-change"?: ((state: ImageViewState) => any) | undefined;
|
|
44
|
+
"onImage-session-notice"?: ((notice: ImageSessionNotice | null) => any) | undefined;
|
|
120
45
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
121
46
|
export default _default;
|
package/dist/vue/src/index.d.ts
CHANGED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { CommandService, ConfigurationService, WorkbenchService } from '../../core/src/index.ts';
|
|
2
|
+
import { ImageOperation, ImageSessionNotice, ImageTransformUpdates, ImageViewState } from '../../kit/src/index.ts';
|
|
3
|
+
export type PooderImageTarget = "auto" | "config" | "working";
|
|
4
|
+
export type PooderEditorEventHandler = (data: any) => void;
|
|
5
|
+
export type PooderEditorImageStateChangeHandler = (state: ImageViewState) => void;
|
|
6
|
+
export type PooderEditorImageSessionNoticeHandler = (notice: ImageSessionNotice | null) => void;
|
|
7
|
+
export interface PooderGenerateCutImageOptions {
|
|
8
|
+
debug?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface PooderUpsertImageOptions {
|
|
11
|
+
id?: string;
|
|
12
|
+
mode?: "replace" | "add";
|
|
13
|
+
addOptions?: any;
|
|
14
|
+
operation?: ImageOperation;
|
|
15
|
+
}
|
|
16
|
+
export interface PooderExportUserCroppedImageOptions {
|
|
17
|
+
multiplier?: number;
|
|
18
|
+
format?: "png" | "jpeg";
|
|
19
|
+
imageIds?: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface PooderExportUserCroppedImageResult {
|
|
22
|
+
url: string;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
multiplier: number;
|
|
26
|
+
format: "png" | "jpeg";
|
|
27
|
+
imageIds: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface PooderDetectBounds {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
}
|
|
35
|
+
export interface PooderDetectEdgeResult {
|
|
36
|
+
pathData: string;
|
|
37
|
+
rawBounds?: PooderDetectBounds;
|
|
38
|
+
baseBounds?: PooderDetectBounds;
|
|
39
|
+
imageWidth?: number;
|
|
40
|
+
imageHeight?: number;
|
|
41
|
+
}
|
|
42
|
+
export interface PooderDetectFrameDiagnostics {
|
|
43
|
+
sourceWidth: number;
|
|
44
|
+
sourceHeight: number;
|
|
45
|
+
detectedBounds: PooderDetectBounds | null;
|
|
46
|
+
centerOffsetX: number;
|
|
47
|
+
centerOffsetY: number;
|
|
48
|
+
coverageX: number;
|
|
49
|
+
coverageY: number;
|
|
50
|
+
}
|
|
51
|
+
export interface PooderDetectMarginDiagnostics {
|
|
52
|
+
left: number;
|
|
53
|
+
top: number;
|
|
54
|
+
right: number;
|
|
55
|
+
bottom: number;
|
|
56
|
+
}
|
|
57
|
+
export interface PooderDetectPostCommitDiagnostics {
|
|
58
|
+
frame: PooderDetectFrameDiagnostics;
|
|
59
|
+
margin: PooderDetectMarginDiagnostics | null;
|
|
60
|
+
expectedExpand: number;
|
|
61
|
+
marginDeltaFromExpected: PooderDetectMarginDiagnostics | null;
|
|
62
|
+
marginAsymmetry: {
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
} | null;
|
|
66
|
+
}
|
|
67
|
+
export interface PooderDetectDielineOptions {
|
|
68
|
+
expand?: number;
|
|
69
|
+
smoothing?: boolean;
|
|
70
|
+
simplifyTolerance?: number;
|
|
71
|
+
threshold?: number;
|
|
72
|
+
debug?: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface PooderDetectDielineFromFrameOptions {
|
|
75
|
+
detect?: PooderDetectDielineOptions;
|
|
76
|
+
export?: PooderExportUserCroppedImageOptions;
|
|
77
|
+
inspect?: {
|
|
78
|
+
includeCroppedImage?: boolean;
|
|
79
|
+
includeDiagnostics?: boolean;
|
|
80
|
+
};
|
|
81
|
+
commit?: boolean;
|
|
82
|
+
}
|
|
83
|
+
export interface PooderDetectDielineFromFrameResult extends PooderDetectEdgeResult {
|
|
84
|
+
sourceImage?: PooderExportUserCroppedImageResult;
|
|
85
|
+
diagnostics?: PooderDetectFrameDiagnostics;
|
|
86
|
+
postCommitDiagnostics?: PooderDetectPostCommitDiagnostics | null;
|
|
87
|
+
}
|
|
88
|
+
export interface PooderUploadAndDetectEdgeOptions {
|
|
89
|
+
expand?: number;
|
|
90
|
+
smoothing?: boolean;
|
|
91
|
+
simplifyTolerance?: number;
|
|
92
|
+
}
|
|
93
|
+
export interface PooderUploadAndDetectEdgeResult {
|
|
94
|
+
imageId: string;
|
|
95
|
+
url: string;
|
|
96
|
+
pathData: string;
|
|
97
|
+
}
|
|
98
|
+
export interface PooderFocusImageOptions {
|
|
99
|
+
syncCanvasSelection?: boolean;
|
|
100
|
+
}
|
|
101
|
+
export interface PooderEditorServices {
|
|
102
|
+
workbench: WorkbenchService;
|
|
103
|
+
command: CommandService;
|
|
104
|
+
config: ConfigurationService;
|
|
105
|
+
}
|
|
106
|
+
export interface PooderToolSwitchResult {
|
|
107
|
+
ok: boolean;
|
|
108
|
+
from: string | null;
|
|
109
|
+
to: string | null;
|
|
110
|
+
reason?: string;
|
|
111
|
+
detail?: any;
|
|
112
|
+
}
|
|
113
|
+
export interface PooderEditorExposed {
|
|
114
|
+
importConfig(config: Record<string, any>): void;
|
|
115
|
+
exportConfig(): Record<string, any>;
|
|
116
|
+
generateCutImage(options?: PooderGenerateCutImageOptions): Promise<string | null>;
|
|
117
|
+
addImage(url: string, options?: any): Promise<string>;
|
|
118
|
+
upsertImage(url: string, options?: PooderUpsertImageOptions): Promise<{
|
|
119
|
+
id: string;
|
|
120
|
+
mode: "replace" | "add";
|
|
121
|
+
}>;
|
|
122
|
+
getImageState(): Promise<ImageViewState>;
|
|
123
|
+
onImageStateChange(handler: PooderEditorImageStateChangeHandler): () => void;
|
|
124
|
+
onImageSessionNotice(handler: PooderEditorImageSessionNoticeHandler): () => void;
|
|
125
|
+
applyImageOperation(id: string, operation: ImageOperation, options?: {
|
|
126
|
+
target?: PooderImageTarget;
|
|
127
|
+
}): Promise<void>;
|
|
128
|
+
setImageTransform(id: string, updates: ImageTransformUpdates, options?: {
|
|
129
|
+
target?: PooderImageTarget;
|
|
130
|
+
}): Promise<void>;
|
|
131
|
+
updateImage(id: string, options?: any): Promise<void>;
|
|
132
|
+
clearImages(): Promise<void>;
|
|
133
|
+
exportUserCroppedImage(options?: PooderExportUserCroppedImageOptions): Promise<PooderExportUserCroppedImageResult>;
|
|
134
|
+
focusImage(id: string | null, options?: PooderFocusImageOptions): Promise<any>;
|
|
135
|
+
detectDieline(url: string): Promise<string | null>;
|
|
136
|
+
detectDielineFromFrame(options?: PooderDetectDielineFromFrameOptions): Promise<PooderDetectDielineFromFrameResult | null>;
|
|
137
|
+
uploadAndDetectEdge(url: string, options?: PooderUploadAndDetectEdgeOptions): Promise<PooderUploadAndDetectEdgeResult | null>;
|
|
138
|
+
activateTool(id: string | null): Promise<PooderToolSwitchResult>;
|
|
139
|
+
deactivateTool(): Promise<PooderToolSwitchResult>;
|
|
140
|
+
on(event: string, handler: PooderEditorEventHandler): void;
|
|
141
|
+
off(event: string, handler: PooderEditorEventHandler): void;
|
|
142
|
+
emit(event: string, data: any): void;
|
|
143
|
+
executeCommand<T = unknown>(id: string, ...args: any[]): Promise<T>;
|
|
144
|
+
getConfig<T = unknown>(key: string): T;
|
|
145
|
+
updateConfig(key: string, val: any): void;
|
|
146
|
+
services: PooderEditorServices;
|
|
147
|
+
}
|
|
148
|
+
export type PooderEditorImageApi = Pick<PooderEditorExposed, "addImage" | "upsertImage" | "getImageState" | "onImageStateChange" | "onImageSessionNotice" | "applyImageOperation" | "setImageTransform" | "updateImage" | "clearImages" | "focusImage">;
|
package/dist/vue.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.pooder-canvas-area[data-v-203ff8d9]{flex:1;width:100%;height:100%;min-height:650px;min-width:650px;overflow:hidden;background:#ececec;position:relative}canvas[data-v-203ff8d9]{display:block}.pooder-editor[data-v-
|
|
1
|
+
.pooder-canvas-area[data-v-203ff8d9]{flex:1;width:100%;height:100%;min-height:650px;min-width:650px;overflow:hidden;background:#ececec;position:relative}canvas[data-v-203ff8d9]{display:block}.pooder-editor[data-v-d74921ee]{display:flex;width:100%;height:100%;overflow:hidden}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pooder/vue",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"main": "./dist/index.umd.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@pooder/core": "2.2.
|
|
23
|
-
"@pooder/kit": "6.
|
|
22
|
+
"@pooder/core": "2.2.2",
|
|
23
|
+
"@pooder/kit": "6.3.1"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"vue": "^3.0.0"
|