@pooder/vue 3.1.0 → 3.2.0
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 +54 -52
- package/dist/index.umd.js +1 -1
- package/dist/vue/src/PooderEditor.vue.d.ts +3 -1
- package/dist/vue.css +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,85 +1,87 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Pooder as
|
|
1
|
+
import { defineComponent as f, ref as p, onMounted as h, onUnmounted as _, createElementBlock as C, openBlock as S, createElementVNode as y, provide as k, createVNode as T } from "vue";
|
|
2
|
+
import { Pooder as z } from "@pooder/core";
|
|
3
3
|
export * from "@pooder/core";
|
|
4
|
-
import { CanvasService as
|
|
4
|
+
import { CanvasService as E, BackgroundTool as R, MirrorTool as M, DielineTool as b, RulerTool as B, ImageTool as O, HoleTool as P } from "@pooder/kit";
|
|
5
5
|
export * from "@pooder/kit";
|
|
6
|
-
const
|
|
6
|
+
const A = /* @__PURE__ */ f({
|
|
7
7
|
__name: "CanvasArea",
|
|
8
8
|
emits: ["canvas-ready", "resize"],
|
|
9
|
-
setup(
|
|
10
|
-
const e = r,
|
|
11
|
-
let
|
|
12
|
-
return
|
|
13
|
-
if (
|
|
14
|
-
const { clientWidth: i, clientHeight: v } =
|
|
15
|
-
|
|
16
|
-
for (const
|
|
17
|
-
const { width:
|
|
18
|
-
e("resize",
|
|
9
|
+
setup(s, { emit: r }) {
|
|
10
|
+
const e = r, n = p(null), t = p(null);
|
|
11
|
+
let c = null;
|
|
12
|
+
return h(() => {
|
|
13
|
+
if (n.value && t.value) {
|
|
14
|
+
const { clientWidth: i, clientHeight: v } = n.value;
|
|
15
|
+
t.value.width = i, t.value.height = v, e("canvas-ready", t.value), c = new ResizeObserver((l) => {
|
|
16
|
+
for (const u of l) {
|
|
17
|
+
const { width: g, height: d } = u.contentRect;
|
|
18
|
+
e("resize", g, d);
|
|
19
19
|
}
|
|
20
|
-
}),
|
|
20
|
+
}), c.observe(n.value);
|
|
21
21
|
}
|
|
22
|
-
}),
|
|
23
|
-
|
|
24
|
-
}), (i, v) => (
|
|
22
|
+
}), _(() => {
|
|
23
|
+
c && c.disconnect();
|
|
24
|
+
}), (i, v) => (S(), C("div", {
|
|
25
25
|
ref_key: "container",
|
|
26
|
-
ref:
|
|
26
|
+
ref: n,
|
|
27
27
|
class: "pooder-canvas-area"
|
|
28
28
|
}, [
|
|
29
|
-
|
|
29
|
+
y("canvas", {
|
|
30
30
|
ref_key: "canvas",
|
|
31
|
-
ref:
|
|
31
|
+
ref: t
|
|
32
32
|
}, null, 512)
|
|
33
33
|
], 512));
|
|
34
34
|
}
|
|
35
|
-
}),
|
|
36
|
-
const e =
|
|
37
|
-
for (const [
|
|
38
|
-
e[
|
|
35
|
+
}), x = (s, r) => {
|
|
36
|
+
const e = s.__vccOpts || s;
|
|
37
|
+
for (const [n, t] of r)
|
|
38
|
+
e[n] = t;
|
|
39
39
|
return e;
|
|
40
|
-
},
|
|
40
|
+
}, D = /* @__PURE__ */ x(A, [["__scopeId", "data-v-dc60e8d6"]]), H = { class: "pooder-editor" }, N = /* @__PURE__ */ f({
|
|
41
41
|
__name: "PooderEditor",
|
|
42
|
-
setup(
|
|
43
|
-
const e = new
|
|
44
|
-
|
|
45
|
-
const
|
|
42
|
+
setup(s, { expose: r }) {
|
|
43
|
+
const e = new z();
|
|
44
|
+
k("pooder", e), e.getService("CanvasService");
|
|
45
|
+
const n = e.getService("CommandService"), t = e.getService("ConfigurationService");
|
|
46
46
|
r({
|
|
47
47
|
importConfig: (o) => {
|
|
48
|
-
|
|
48
|
+
t.import(o);
|
|
49
49
|
},
|
|
50
|
-
exportConfig: () =>
|
|
51
|
-
generateCutImage: async () => await
|
|
52
|
-
|
|
50
|
+
exportConfig: () => t.export(),
|
|
51
|
+
generateCutImage: async () => await n.executeCommand("exportCutImage"),
|
|
52
|
+
addImage: async (o, a) => await n.executeCommand("addImage", o, a),
|
|
53
|
+
updateImage: async (o, a) => await n.executeCommand("updateImage", o, a),
|
|
54
|
+
clearImages: async () => await n.executeCommand("clearImages")
|
|
53
55
|
});
|
|
54
56
|
const d = (o) => {
|
|
55
|
-
const
|
|
56
|
-
e.registerService(
|
|
57
|
-
new
|
|
58
|
-
new
|
|
57
|
+
const a = new E(o);
|
|
58
|
+
e.registerService(a, "CanvasService"), [
|
|
59
|
+
new R(),
|
|
60
|
+
new M(),
|
|
59
61
|
// new FilmTool(),
|
|
60
62
|
// new WhiteInkTool(),
|
|
61
|
-
new R(),
|
|
62
63
|
new b(),
|
|
63
|
-
new
|
|
64
|
-
new
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
new B(),
|
|
65
|
+
new O(),
|
|
66
|
+
new P()
|
|
67
|
+
].forEach((I) => {
|
|
68
|
+
e.extensionManager.register(I);
|
|
67
69
|
});
|
|
68
|
-
},
|
|
69
|
-
const
|
|
70
|
-
|
|
70
|
+
}, w = (o, a) => {
|
|
71
|
+
const m = e.getService("CanvasService");
|
|
72
|
+
m && m.canvas.setDimensions({ width: o, height: a });
|
|
71
73
|
};
|
|
72
|
-
return
|
|
74
|
+
return _(() => {
|
|
73
75
|
const o = e.getService("CanvasService");
|
|
74
76
|
o && o.dispose(), e.extensionManager.destroy();
|
|
75
|
-
}), (o,
|
|
76
|
-
|
|
77
|
+
}), (o, a) => (S(), C("div", H, [
|
|
78
|
+
T(D, {
|
|
77
79
|
onCanvasReady: d,
|
|
78
|
-
onResize:
|
|
80
|
+
onResize: w
|
|
79
81
|
})
|
|
80
82
|
]));
|
|
81
83
|
}
|
|
82
|
-
}),
|
|
84
|
+
}), $ = /* @__PURE__ */ x(N, [["__scopeId", "data-v-903d7337"]]);
|
|
83
85
|
export {
|
|
84
|
-
|
|
86
|
+
$ as PooderEditor
|
|
85
87
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@pooder/core"),require("@pooder/kit")):typeof define=="function"&&define.amd?define(["exports","vue","@pooder/core","@pooder/kit"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.PooderVue={},t.Vue,t.PooderCore,t.PooderKit))})(this,(function(t,e,
|
|
1
|
+
(function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@pooder/core"),require("@pooder/kit")):typeof define=="function"&&define.amd?define(["exports","vue","@pooder/core","@pooder/kit"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.PooderVue={},t.Vue,t.PooderCore,t.PooderKit))})(this,(function(t,e,m,s){"use strict";const S=e.defineComponent({__name:"CanvasArea",emits:["canvas-ready","resize"],setup(n,{emit:d}){const o=d,a=e.ref(null),c=e.ref(null);let l=null;return e.onMounted(()=>{if(a.value&&c.value){const{clientWidth:u,clientHeight:f}=a.value;c.value.width=u,c.value.height=f,o("canvas-ready",c.value),l=new ResizeObserver(_=>{for(const y of _){const{width:C,height:p}=y.contentRect;o("resize",C,p)}}),l.observe(a.value)}}),e.onUnmounted(()=>{l&&l.disconnect()}),(u,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"container",ref:a,class:"pooder-canvas-area"},[e.createElementVNode("canvas",{ref_key:"canvas",ref:c},null,512)],512))}}),g=(n,d)=>{const o=n.__vccOpts||n;for(const[a,c]of d)o[a]=c;return o},h=g(S,[["__scopeId","data-v-dc60e8d6"]]),w={class:"pooder-editor"},I=g(e.defineComponent({__name:"PooderEditor",setup(n,{expose:d}){const o=new m.Pooder;e.provide("pooder",o),o.getService("CanvasService");const a=o.getService("CommandService"),c=o.getService("ConfigurationService");d({importConfig:r=>{c.import(r)},exportConfig:()=>c.export(),generateCutImage:async()=>await a.executeCommand("exportCutImage"),addImage:async(r,i)=>await a.executeCommand("addImage",r,i),updateImage:async(r,i)=>await a.executeCommand("updateImage",r,i),clearImages:async()=>await a.executeCommand("clearImages")});const p=r=>{const i=new s.CanvasService(r);o.registerService(i,"CanvasService"),[new s.BackgroundTool,new s.MirrorTool,new s.DielineTool,new s.RulerTool,new s.ImageTool,new s.HoleTool].forEach(O=>{o.extensionManager.register(O)})},x=(r,i)=>{const v=o.getService("CanvasService");v&&v.canvas.setDimensions({width:r,height:i})};return e.onUnmounted(()=>{const r=o.getService("CanvasService");r&&r.dispose(),o.extensionManager.destroy()}),(r,i)=>(e.openBlock(),e.createElementBlock("div",w,[e.createVNode(h,{onCanvasReady:p,onResize:x})]))}}),[["__scopeId","data-v-903d7337"]]);t.PooderEditor=I,Object.keys(m).forEach(n=>{n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:()=>m[n]})}),Object.keys(s).forEach(n=>{n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:()=>s[n]})}),Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -2,6 +2,8 @@ declare const _default: import('vue').DefineComponent<{}, {
|
|
|
2
2
|
importConfig: (config: Record<string, any>) => void;
|
|
3
3
|
exportConfig: () => Record<string, any>;
|
|
4
4
|
generateCutImage: () => Promise<any>;
|
|
5
|
-
|
|
5
|
+
addImage: (url: string, options?: any) => Promise<any>;
|
|
6
|
+
updateImage: (id: string, options?: any) => Promise<any>;
|
|
7
|
+
clearImages: () => Promise<any>;
|
|
6
8
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
7
9
|
export default _default;
|
package/dist/vue.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.pooder-canvas-area[data-v-dc60e8d6]{flex:1;width:100%;height:100%;min-height:650px;min-width:650px;overflow:hidden;background:#f5f5f5;position:relative}canvas[data-v-dc60e8d6]{display:block}.pooder-editor[data-v-
|
|
1
|
+
.pooder-canvas-area[data-v-dc60e8d6]{flex:1;width:100%;height:100%;min-height:650px;min-width:650px;overflow:hidden;background:#f5f5f5;position:relative}canvas[data-v-dc60e8d6]{display:block}.pooder-editor[data-v-903d7337]{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": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
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/
|
|
23
|
-
"@pooder/
|
|
22
|
+
"@pooder/kit": "3.2.0",
|
|
23
|
+
"@pooder/core": "1.2.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"vue": "^3.0.0"
|