@pooder/vue 0.0.2

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.
@@ -0,0 +1,2 @@
1
+ export * from './vue/src/index'
2
+ export {}
@@ -0,0 +1,296 @@
1
+ import { defineComponent as v, ref as k, onMounted as A, onBeforeUnmount as M, createElementBlock as p, openBlock as h, createElementVNode as l, computed as T, toDisplayString as $, watch as N, isReactive as P, reactive as E, resolveComponent as V, createCommentVNode as O, Fragment as C, renderList as S, createVNode as y, shallowRef as L } from "vue";
2
+ import { BackgroundTool as W, ImageTool as B, WhiteInkTool as F, DielineTool as H, HoleTool as R, FilmTool as U } from "@pooder/kit";
3
+ import { PooderEditor as j } from "@pooder/core";
4
+ const q = v({
5
+ name: "CanvasArea",
6
+ props: {
7
+ width: {
8
+ type: Number,
9
+ required: !0
10
+ },
11
+ height: {
12
+ type: Number,
13
+ required: !0
14
+ }
15
+ },
16
+ emits: ["init"],
17
+ setup(t, { emit: o }) {
18
+ const d = k(null);
19
+ let s = null;
20
+ return A(() => {
21
+ d.value && (d.value.width = t.width, d.value.height = t.height, s = new j(d.value, {
22
+ width: t.width,
23
+ height: t.height
24
+ }), o("init", s));
25
+ }), M(() => {
26
+ s && s.destroy();
27
+ }), {
28
+ canvasRef: d
29
+ };
30
+ }
31
+ }), I = (t, o) => {
32
+ const d = t.__vccOpts || t;
33
+ for (const [s, f] of o)
34
+ d[s] = f;
35
+ return d;
36
+ }, D = { class: "canvas-area" }, z = { class: "canvas-wrapper" }, G = { ref: "canvasRef" };
37
+ function J(t, o, d, s, f, _) {
38
+ return h(), p("div", D, [
39
+ l("div", z, [
40
+ l("canvas", G, null, 512)
41
+ ])
42
+ ]);
43
+ }
44
+ const K = /* @__PURE__ */ I(q, [["render", J], ["__scopeId", "data-v-9f998bd0"]]), Q = v({
45
+ name: "ColorPicker",
46
+ props: {
47
+ modelValue: {
48
+ type: String,
49
+ default: "#000000"
50
+ }
51
+ },
52
+ emits: ["update:modelValue", "change"],
53
+ setup(t, { emit: o }) {
54
+ const d = (r) => {
55
+ if (!r) return "#000000";
56
+ const n = String(r);
57
+ if (n.startsWith("#")) {
58
+ if (n.length === 9) return n.slice(0, 7);
59
+ if (n.length === 7) return n;
60
+ if (n.length === 4) return "#" + n[1] + n[1] + n[2] + n[2] + n[3] + n[3];
61
+ }
62
+ if (n.startsWith("rgb")) {
63
+ const e = n.match(/\d+(\.\d+)?/g);
64
+ if (e && e.length >= 3) {
65
+ const u = parseInt(e[0]), i = parseInt(e[1]), c = parseInt(e[2]), g = (b) => {
66
+ const w = b.toString(16);
67
+ return w.length === 1 ? "0" + w : w;
68
+ };
69
+ return `#${g(u)}${g(i)}${g(c)}`;
70
+ }
71
+ }
72
+ return "#000000";
73
+ }, s = (r) => {
74
+ if (!r) return 1;
75
+ const n = String(r);
76
+ if (n.startsWith("#"))
77
+ return n.length === 9 ? parseInt(n.slice(7), 16) / 255 : 1;
78
+ if (n.startsWith("rgba")) {
79
+ const e = n.match(/\d+(\.\d+)?/g);
80
+ if (e && e.length >= 4) return parseFloat(e[3]);
81
+ }
82
+ return 1;
83
+ }, f = T(() => d(t.modelValue)), _ = T(() => Math.round(s(t.modelValue) * 100));
84
+ return {
85
+ hexValue: f,
86
+ alphaValue: _,
87
+ updateColor: (r) => {
88
+ const n = r.target.value, e = s(t.modelValue), u = parseInt(n.slice(1, 3), 16), i = parseInt(n.slice(3, 5), 16), c = parseInt(n.slice(5, 7), 16), g = `rgba(${u}, ${i}, ${c}, ${e})`;
89
+ o("update:modelValue", g), o("change", g);
90
+ },
91
+ updateAlpha: (r) => {
92
+ const n = r.target.value, e = parseInt(n) / 100, u = d(t.modelValue), i = parseInt(u.slice(1, 3), 16), c = parseInt(u.slice(3, 5), 16), g = parseInt(u.slice(5, 7), 16), b = `rgba(${i}, ${c}, ${g}, ${e})`;
93
+ o("update:modelValue", b), o("change", b);
94
+ }
95
+ };
96
+ }
97
+ }), X = { class: "color-picker" }, Y = ["value"], Z = { class: "alpha-slider-wrap" }, x = ["value"], ee = { class: "alpha-value" };
98
+ function te(t, o, d, s, f, _) {
99
+ return h(), p("div", X, [
100
+ l("input", {
101
+ type: "color",
102
+ value: t.hexValue,
103
+ onInput: o[0] || (o[0] = (...m) => t.updateColor && t.updateColor(...m))
104
+ }, null, 40, Y),
105
+ l("div", Z, [
106
+ o[2] || (o[2] = l("span", { class: "alpha-label" }, "A:", -1)),
107
+ l("input", {
108
+ type: "range",
109
+ min: "0",
110
+ max: "100",
111
+ step: "1",
112
+ value: t.alphaValue,
113
+ onInput: o[1] || (o[1] = (...m) => t.updateAlpha && t.updateAlpha(...m))
114
+ }, null, 40, x),
115
+ l("span", ee, $(t.alphaValue) + "%", 1)
116
+ ])
117
+ ]);
118
+ }
119
+ const ne = /* @__PURE__ */ I(Q, [["render", te], ["__scopeId", "data-v-ae754a79"]]), oe = v({
120
+ name: "ToolPanel",
121
+ components: { ColorPicker: ne },
122
+ props: {
123
+ editor: {
124
+ type: Object,
125
+ default: null
126
+ }
127
+ },
128
+ setup(t) {
129
+ const o = k([]), d = () => {
130
+ t.editor ? o.value = Array.from(t.editor.getExtensions().map((e) => (e.options && !P(e.options) && (e.options = E(e.options)), e))) : o.value = [];
131
+ };
132
+ N(() => t.editor, (e) => {
133
+ d();
134
+ }, { immediate: !0 });
135
+ const s = (e, u) => e.schema?.[u];
136
+ return {
137
+ extensionList: o,
138
+ getInputType: (e, u, i) => {
139
+ const c = s(e, u);
140
+ if (c && c.type) return c.type;
141
+ if (typeof i == "boolean") return "checkbox";
142
+ if (typeof i == "number") return "number";
143
+ if (typeof i == "string") {
144
+ const g = u.toLowerCase();
145
+ return g.includes("color") || g.includes("fill") || g.includes("stroke") || i.startsWith("#") || i.startsWith("rgb") ? "color" : "text";
146
+ }
147
+ return "text";
148
+ },
149
+ updateOption: (e, u, i) => {
150
+ e.options && (e.options[String(u)] = i, t.editor && t.editor.updateState((c) => ({ ...c })));
151
+ },
152
+ getMinMax: (e, u, i) => {
153
+ const c = s(e, u);
154
+ return c ? {
155
+ min: c.min ?? 0,
156
+ max: c.max ?? 100,
157
+ step: c.step ?? 1
158
+ } : i <= 1 && i >= 0 ? { min: 0, max: 1, step: 0.01 } : { min: 0, max: Math.max(1e3, i * 2), step: 1 };
159
+ },
160
+ formatNumber: (e) => typeof e == "number" ? Number.isInteger(e) ? e : e.toFixed(2) : e,
161
+ getLabel: (e, u) => {
162
+ const i = s(e, u);
163
+ return i && i.label ? i.label : u.charAt(0).toUpperCase() + u.slice(1);
164
+ },
165
+ getSelectOptions: (e, u) => {
166
+ const i = s(e, u);
167
+ return !i || !i.options ? [] : i.options.map((c) => typeof c == "string" ? { label: c, value: c } : c);
168
+ }
169
+ };
170
+ }
171
+ }), se = {
172
+ key: 0,
173
+ class: "tool-panel"
174
+ }, re = { key: 0 }, ae = { key: 0 }, ie = ["value", "onChange"], le = ["value"], ue = { key: 1 }, ce = { key: 2 }, de = ["value", "onInput"], pe = { class: "slider-container" }, he = ["min", "max", "step", "value", "onInput"], ge = { class: "slider-value" }, me = { key: 3 }, fe = { class: "switch-wrapper" }, _e = { class: "switch" }, $e = ["checked", "onChange"], be = { key: 4 }, ve = { class: "checkbox-wrapper" }, Ie = ["checked", "onChange"], we = { key: 5 }, Ce = ["value", "onInput"];
175
+ function Se(t, o, d, s, f, _) {
176
+ const m = V("ColorPicker");
177
+ return t.editor ? (h(), p("div", se, [
178
+ (h(!0), p(C, null, S(t.extensionList, (a) => (h(), p("div", {
179
+ class: "plugin-section",
180
+ key: a.name
181
+ }, [
182
+ l("h3", null, $(a.name), 1),
183
+ a.options ? (h(), p("div", re, [
184
+ (h(!0), p(C, null, S(a.options, (r, n) => (h(), p("div", {
185
+ key: n,
186
+ class: "config-item"
187
+ }, [
188
+ l("label", null, $(t.getLabel(a, String(n))), 1),
189
+ t.getInputType(a, String(n), r) === "select" ? (h(), p("div", ae, [
190
+ l("select", {
191
+ value: r,
192
+ onChange: (e) => t.updateOption(a, n, e.target.value)
193
+ }, [
194
+ (h(!0), p(C, null, S(t.getSelectOptions(a, String(n)), (e) => (h(), p("option", {
195
+ key: e.value,
196
+ value: e.value
197
+ }, $(e.label), 9, le))), 128))
198
+ ], 40, ie)
199
+ ])) : t.getInputType(a, String(n), r) === "color" ? (h(), p("div", ue, [
200
+ y(m, {
201
+ modelValue: String(r),
202
+ "onUpdate:modelValue": (e) => t.updateOption(a, n, e)
203
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
204
+ ])) : t.getInputType(a, String(n), r) === "number" ? (h(), p("div", ce, [
205
+ l("input", {
206
+ type: "number",
207
+ value: r,
208
+ onInput: (e) => t.updateOption(a, n, Number(e.target.value))
209
+ }, null, 40, de),
210
+ l("div", pe, [
211
+ l("input", {
212
+ type: "range",
213
+ min: t.getMinMax(a, String(n), r).min,
214
+ max: t.getMinMax(a, String(n), r).max,
215
+ step: t.getMinMax(a, String(n), r).step,
216
+ value: r,
217
+ onInput: (e) => t.updateOption(a, n, Number(e.target.value))
218
+ }, null, 40, he),
219
+ l("span", ge, $(t.formatNumber(r)), 1)
220
+ ])
221
+ ])) : t.getInputType(a, String(n), r) === "boolean" ? (h(), p("div", me, [
222
+ l("div", fe, [
223
+ l("label", _e, [
224
+ l("input", {
225
+ type: "checkbox",
226
+ checked: !!r,
227
+ onChange: (e) => t.updateOption(a, n, e.target.checked)
228
+ }, null, 40, $e),
229
+ o[0] || (o[0] = l("span", { class: "slider" }, null, -1))
230
+ ])
231
+ ])
232
+ ])) : t.getInputType(a, String(n), r) === "checkbox" ? (h(), p("div", be, [
233
+ l("div", ve, [
234
+ l("input", {
235
+ type: "checkbox",
236
+ checked: !!r,
237
+ onChange: (e) => t.updateOption(a, n, e.target.checked)
238
+ }, null, 40, Ie)
239
+ ])
240
+ ])) : (h(), p("div", we, [
241
+ l("input", {
242
+ type: "text",
243
+ value: r,
244
+ onInput: (e) => t.updateOption(a, n, e.target.value)
245
+ }, null, 40, Ce)
246
+ ]))
247
+ ]))), 128))
248
+ ])) : O("", !0)
249
+ ]))), 128))
250
+ ])) : O("", !0);
251
+ }
252
+ const Ve = /* @__PURE__ */ I(oe, [["render", Se], ["__scopeId", "data-v-97375248"]]), ye = v({
253
+ name: "PooderEditor",
254
+ components: {
255
+ CanvasArea: K,
256
+ ToolPanel: Ve
257
+ },
258
+ props: {
259
+ width: {
260
+ type: Number,
261
+ default: 1200
262
+ },
263
+ height: {
264
+ type: Number,
265
+ default: 600
266
+ }
267
+ },
268
+ setup(t) {
269
+ const o = L(null);
270
+ return {
271
+ editor: o,
272
+ onInit: (s) => {
273
+ s.use(new W()), s.use(new B()), s.use(new F()), s.use(new H()), s.use(new R()), s.use(new U()), o.value = s, console.log(s.getObjects());
274
+ }
275
+ };
276
+ }
277
+ }), Te = { class: "pooder-editor" }, Oe = { class: "center-area" }, ke = { class: "right-panel" };
278
+ function Ae(t, o, d, s, f, _) {
279
+ const m = V("CanvasArea"), a = V("ToolPanel");
280
+ return h(), p("div", Te, [
281
+ l("div", Oe, [
282
+ y(m, {
283
+ width: t.width,
284
+ height: t.height,
285
+ onInit: t.onInit
286
+ }, null, 8, ["width", "height", "onInit"])
287
+ ]),
288
+ l("div", ke, [
289
+ y(a, { editor: t.editor }, null, 8, ["editor"])
290
+ ])
291
+ ]);
292
+ }
293
+ const Ee = /* @__PURE__ */ I(ye, [["render", Ae], ["__scopeId", "data-v-c3077c4c"]]);
294
+ export {
295
+ Ee as PooderEditor
296
+ };
@@ -0,0 +1 @@
1
+ (function(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@pooder/kit"),require("@pooder/core")):typeof define=="function"&&define.amd?define(["exports","vue","@pooder/kit","@pooder/core"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m.PooderVue={},m.Vue,m.PooderKit,m.PooderCore))})(this,(function(m,e,f,b){"use strict";const k=e.defineComponent({name:"CanvasArea",props:{width:{type:Number,required:!0},height:{type:Number,required:!0}},emits:["init"],setup(n,{emit:r}){const p=e.ref(null);let s=null;return e.onMounted(()=>{p.value&&(p.value.width=n.width,p.value.height=n.height,s=new b.PooderEditor(p.value,{width:n.width,height:n.height}),r("init",s))}),e.onBeforeUnmount(()=>{s&&s.destroy()}),{canvasRef:p}}}),V=(n,r)=>{const p=n.__vccOpts||n;for(const[s,g]of r)p[s]=g;return p},B={class:"canvas-area"},I={class:"canvas-wrapper"},N={ref:"canvasRef"};function C(n,r,p,s,g,_){return e.openBlock(),e.createElementBlock("div",B,[e.createElementVNode("div",I,[e.createElementVNode("canvas",N,null,512)])])}const y=V(k,[["render",C],["__scopeId","data-v-9f998bd0"]]),S=e.defineComponent({name:"ColorPicker",props:{modelValue:{type:String,default:"#000000"}},emits:["update:modelValue","change"],setup(n,{emit:r}){const p=a=>{if(!a)return"#000000";const o=String(a);if(o.startsWith("#")){if(o.length===9)return o.slice(0,7);if(o.length===7)return o;if(o.length===4)return"#"+o[1]+o[1]+o[2]+o[2]+o[3]+o[3]}if(o.startsWith("rgb")){const t=o.match(/\d+(\.\d+)?/g);if(t&&t.length>=3){const c=parseInt(t[0]),i=parseInt(t[1]),d=parseInt(t[2]),u=E=>{const $=E.toString(16);return $.length===1?"0"+$:$};return`#${u(c)}${u(i)}${u(d)}`}}return"#000000"},s=a=>{if(!a)return 1;const o=String(a);if(o.startsWith("#"))return o.length===9?parseInt(o.slice(7),16)/255:1;if(o.startsWith("rgba")){const t=o.match(/\d+(\.\d+)?/g);if(t&&t.length>=4)return parseFloat(t[3])}return 1},g=e.computed(()=>p(n.modelValue)),_=e.computed(()=>Math.round(s(n.modelValue)*100));return{hexValue:g,alphaValue:_,updateColor:a=>{const o=a.target.value,t=s(n.modelValue),c=parseInt(o.slice(1,3),16),i=parseInt(o.slice(3,5),16),d=parseInt(o.slice(5,7),16),u=`rgba(${c}, ${i}, ${d}, ${t})`;r("update:modelValue",u),r("change",u)},updateAlpha:a=>{const o=a.target.value,t=parseInt(o)/100,c=p(n.modelValue),i=parseInt(c.slice(1,3),16),d=parseInt(c.slice(3,5),16),u=parseInt(c.slice(5,7),16),E=`rgba(${i}, ${d}, ${u}, ${t})`;r("update:modelValue",E),r("change",E)}}}}),w={class:"color-picker"},T=["value"],O={class:"alpha-slider-wrap"},P=["value"],M={class:"alpha-value"};function A(n,r,p,s,g,_){return e.openBlock(),e.createElementBlock("div",w,[e.createElementVNode("input",{type:"color",value:n.hexValue,onInput:r[0]||(r[0]=(...h)=>n.updateColor&&n.updateColor(...h))},null,40,T),e.createElementVNode("div",O,[r[2]||(r[2]=e.createElementVNode("span",{class:"alpha-label"},"A:",-1)),e.createElementVNode("input",{type:"range",min:"0",max:"100",step:"1",value:n.alphaValue,onInput:r[1]||(r[1]=(...h)=>n.updateAlpha&&n.updateAlpha(...h))},null,40,P),e.createElementVNode("span",M,e.toDisplayString(n.alphaValue)+"%",1)])])}const L=V(S,[["render",A],["__scopeId","data-v-ae754a79"]]),W=e.defineComponent({name:"ToolPanel",components:{ColorPicker:L},props:{editor:{type:Object,default:null}},setup(n){const r=e.ref([]),p=()=>{n.editor?r.value=Array.from(n.editor.getExtensions().map(t=>(t.options&&!e.isReactive(t.options)&&(t.options=e.reactive(t.options)),t))):r.value=[]};e.watch(()=>n.editor,t=>{p()},{immediate:!0});const s=(t,c)=>t.schema?.[c];return{extensionList:r,getInputType:(t,c,i)=>{const d=s(t,c);if(d&&d.type)return d.type;if(typeof i=="boolean")return"checkbox";if(typeof i=="number")return"number";if(typeof i=="string"){const u=c.toLowerCase();return u.includes("color")||u.includes("fill")||u.includes("stroke")||i.startsWith("#")||i.startsWith("rgb")?"color":"text"}return"text"},updateOption:(t,c,i)=>{t.options&&(t.options[String(c)]=i,n.editor&&n.editor.updateState(d=>({...d})))},getMinMax:(t,c,i)=>{const d=s(t,c);return d?{min:d.min??0,max:d.max??100,step:d.step??1}:i<=1&&i>=0?{min:0,max:1,step:.01}:{min:0,max:Math.max(1e3,i*2),step:1}},formatNumber:t=>typeof t=="number"?Number.isInteger(t)?t:t.toFixed(2):t,getLabel:(t,c)=>{const i=s(t,c);return i&&i.label?i.label:c.charAt(0).toUpperCase()+c.slice(1)},getSelectOptions:(t,c)=>{const i=s(t,c);return!i||!i.options?[]:i.options.map(d=>typeof d=="string"?{label:d,value:d}:d)}}}}),D={key:0,class:"tool-panel"},F={key:0},q={key:0},j=["value","onChange"],H=["value"],R={key:1},U={key:2},K=["value","onInput"],z={class:"slider-container"},G=["min","max","step","value","onInput"],J={class:"slider-value"},Q={key:3},X={class:"switch-wrapper"},Y={class:"switch"},Z=["checked","onChange"],x={key:4},v={class:"checkbox-wrapper"},ee=["checked","onChange"],te={key:5},ne=["value","onInput"];function oe(n,r,p,s,g,_){const h=e.resolveComponent("ColorPicker");return n.editor?(e.openBlock(),e.createElementBlock("div",D,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.extensionList,l=>(e.openBlock(),e.createElementBlock("div",{class:"plugin-section",key:l.name},[e.createElementVNode("h3",null,e.toDisplayString(l.name),1),l.options?(e.openBlock(),e.createElementBlock("div",F,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,(a,o)=>(e.openBlock(),e.createElementBlock("div",{key:o,class:"config-item"},[e.createElementVNode("label",null,e.toDisplayString(n.getLabel(l,String(o))),1),n.getInputType(l,String(o),a)==="select"?(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("select",{value:a,onChange:t=>n.updateOption(l,o,t.target.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.getSelectOptions(l,String(o)),t=>(e.openBlock(),e.createElementBlock("option",{key:t.value,value:t.value},e.toDisplayString(t.label),9,H))),128))],40,j)])):n.getInputType(l,String(o),a)==="color"?(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(h,{modelValue:String(a),"onUpdate:modelValue":t=>n.updateOption(l,o,t)},null,8,["modelValue","onUpdate:modelValue"])])):n.getInputType(l,String(o),a)==="number"?(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("input",{type:"number",value:a,onInput:t=>n.updateOption(l,o,Number(t.target.value))},null,40,K),e.createElementVNode("div",z,[e.createElementVNode("input",{type:"range",min:n.getMinMax(l,String(o),a).min,max:n.getMinMax(l,String(o),a).max,step:n.getMinMax(l,String(o),a).step,value:a,onInput:t=>n.updateOption(l,o,Number(t.target.value))},null,40,G),e.createElementVNode("span",J,e.toDisplayString(n.formatNumber(a)),1)])])):n.getInputType(l,String(o),a)==="boolean"?(e.openBlock(),e.createElementBlock("div",Q,[e.createElementVNode("div",X,[e.createElementVNode("label",Y,[e.createElementVNode("input",{type:"checkbox",checked:!!a,onChange:t=>n.updateOption(l,o,t.target.checked)},null,40,Z),r[0]||(r[0]=e.createElementVNode("span",{class:"slider"},null,-1))])])])):n.getInputType(l,String(o),a)==="checkbox"?(e.openBlock(),e.createElementBlock("div",x,[e.createElementVNode("div",v,[e.createElementVNode("input",{type:"checkbox",checked:!!a,onChange:t=>n.updateOption(l,o,t.target.checked)},null,40,ee)])])):(e.openBlock(),e.createElementBlock("div",te,[e.createElementVNode("input",{type:"text",value:a,onInput:t=>n.updateOption(l,o,t.target.value)},null,40,ne)]))]))),128))])):e.createCommentVNode("",!0)]))),128))])):e.createCommentVNode("",!0)}const re=V(W,[["render",oe],["__scopeId","data-v-97375248"]]),se=e.defineComponent({name:"PooderEditor",components:{CanvasArea:y,ToolPanel:re},props:{width:{type:Number,default:1200},height:{type:Number,default:600}},setup(n){const r=e.shallowRef(null);return{editor:r,onInit:s=>{s.use(new f.BackgroundTool),s.use(new f.ImageTool),s.use(new f.WhiteInkTool),s.use(new f.DielineTool),s.use(new f.HoleTool),s.use(new f.FilmTool),r.value=s,console.log(s.getObjects())}}}}),ae={class:"pooder-editor"},le={class:"center-area"},ie={class:"right-panel"};function ce(n,r,p,s,g,_){const h=e.resolveComponent("CanvasArea"),l=e.resolveComponent("ToolPanel");return e.openBlock(),e.createElementBlock("div",ae,[e.createElementVNode("div",le,[e.createVNode(h,{width:n.width,height:n.height,onInit:n.onInit},null,8,["width","height","onInit"])]),e.createElementVNode("div",ie,[e.createVNode(l,{editor:n.editor},null,8,["editor"])])])}const de=V(se,[["render",ce],["__scopeId","data-v-c3077c4c"]]);m.PooderEditor=de,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1,125 @@
1
+ import { Editor } from '../../core/src/index.ts';
2
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
3
+ width: {
4
+ type: NumberConstructor;
5
+ default: number;
6
+ };
7
+ height: {
8
+ type: NumberConstructor;
9
+ default: number;
10
+ };
11
+ }>, {
12
+ editor: import('vue').ShallowRef<Editor | null, Editor | null>;
13
+ onInit: (instance: Editor) => void;
14
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
15
+ width: {
16
+ type: NumberConstructor;
17
+ default: number;
18
+ };
19
+ height: {
20
+ type: NumberConstructor;
21
+ default: number;
22
+ };
23
+ }>> & Readonly<{}>, {
24
+ width: number;
25
+ height: number;
26
+ }, {}, {
27
+ CanvasArea: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
28
+ width: {
29
+ type: NumberConstructor;
30
+ required: true;
31
+ };
32
+ height: {
33
+ type: NumberConstructor;
34
+ required: true;
35
+ };
36
+ }>, {
37
+ canvasRef: import('vue').Ref<HTMLCanvasElement | null, HTMLCanvasElement | null>;
38
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "init"[], "init", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
39
+ width: {
40
+ type: NumberConstructor;
41
+ required: true;
42
+ };
43
+ height: {
44
+ type: NumberConstructor;
45
+ required: true;
46
+ };
47
+ }>> & Readonly<{
48
+ onInit?: ((...args: any[]) => any) | undefined;
49
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
50
+ ToolPanel: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
51
+ editor: {
52
+ type: import('vue').PropType<Editor | null>;
53
+ default: null;
54
+ };
55
+ }>, {
56
+ extensionList: import('vue').Ref<{
57
+ name: string;
58
+ priority?: number | undefined;
59
+ options?: import('../../core/src/index.ts').ExtensionOptions | undefined;
60
+ schema?: Record<string | number, import('../../core/src/index.ts').OptionSchema> | undefined;
61
+ enabled?: boolean | undefined;
62
+ onCreate?: ((editor: Editor) => void) | undefined;
63
+ onMount?: ((editor: Editor) => void) | undefined;
64
+ onUpdate?: ((editor: Editor, state: import('../../core/src/index.ts').EditorState) => void) | undefined;
65
+ onUnmount?: ((editor: Editor) => void) | undefined;
66
+ onDestroy?: ((editor: Editor) => void) | undefined;
67
+ commands?: Record<string, import('../../core/src/index.ts').Command> | undefined;
68
+ }[], import('../../core/src/index.ts').Extension<import('../../core/src/index.ts').ExtensionOptions>[] | {
69
+ name: string;
70
+ priority?: number | undefined;
71
+ options?: import('../../core/src/index.ts').ExtensionOptions | undefined;
72
+ schema?: Record<string | number, import('../../core/src/index.ts').OptionSchema> | undefined;
73
+ enabled?: boolean | undefined;
74
+ onCreate?: ((editor: Editor) => void) | undefined;
75
+ onMount?: ((editor: Editor) => void) | undefined;
76
+ onUpdate?: ((editor: Editor, state: import('../../core/src/index.ts').EditorState) => void) | undefined;
77
+ onUnmount?: ((editor: Editor) => void) | undefined;
78
+ onDestroy?: ((editor: Editor) => void) | undefined;
79
+ commands?: Record<string, import('../../core/src/index.ts').Command> | undefined;
80
+ }[]>;
81
+ getInputType: (ext: import('../../core/src/index.ts').Extension, key: string, value: any) => string;
82
+ updateOption: (ext: import('../../core/src/index.ts').Extension, key: string | number, value: any) => void;
83
+ getMinMax: (ext: import('../../core/src/index.ts').Extension, key: string, val: number) => {
84
+ min: number;
85
+ max: number;
86
+ step: number;
87
+ };
88
+ formatNumber: (val: any) => any;
89
+ getLabel: (ext: import('../../core/src/index.ts').Extension, key: string) => string;
90
+ getSelectOptions: (ext: import('../../core/src/index.ts').Extension, key: string) => {
91
+ label: string;
92
+ value: any;
93
+ }[];
94
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
95
+ editor: {
96
+ type: import('vue').PropType<Editor | null>;
97
+ default: null;
98
+ };
99
+ }>> & Readonly<{}>, {
100
+ editor: Editor | null;
101
+ }, {}, {
102
+ ColorPicker: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
103
+ modelValue: {
104
+ type: StringConstructor;
105
+ default: string;
106
+ };
107
+ }>, {
108
+ hexValue: import('vue').ComputedRef<string>;
109
+ alphaValue: import('vue').ComputedRef<number>;
110
+ updateColor: (e: Event) => void;
111
+ updateAlpha: (e: Event) => void;
112
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
113
+ modelValue: {
114
+ type: StringConstructor;
115
+ default: string;
116
+ };
117
+ }>> & Readonly<{
118
+ onChange?: ((...args: any[]) => any) | undefined;
119
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
120
+ }>, {
121
+ modelValue: string;
122
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
123
+ }, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
124
+ }, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
125
+ export default _default;
@@ -0,0 +1,24 @@
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ width: {
3
+ type: NumberConstructor;
4
+ required: true;
5
+ };
6
+ height: {
7
+ type: NumberConstructor;
8
+ required: true;
9
+ };
10
+ }>, {
11
+ canvasRef: import('vue').Ref<HTMLCanvasElement | null, HTMLCanvasElement | null>;
12
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "init"[], "init", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
13
+ width: {
14
+ type: NumberConstructor;
15
+ required: true;
16
+ };
17
+ height: {
18
+ type: NumberConstructor;
19
+ required: true;
20
+ };
21
+ }>> & Readonly<{
22
+ onInit?: ((...args: any[]) => any) | undefined;
23
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
24
+ export default _default;
@@ -0,0 +1,22 @@
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ modelValue: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ }>, {
7
+ hexValue: import('vue').ComputedRef<string>;
8
+ alphaValue: import('vue').ComputedRef<number>;
9
+ updateColor: (e: Event) => void;
10
+ updateAlpha: (e: Event) => void;
11
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
12
+ modelValue: {
13
+ type: StringConstructor;
14
+ default: string;
15
+ };
16
+ }>> & Readonly<{
17
+ onChange?: ((...args: any[]) => any) | undefined;
18
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
19
+ }>, {
20
+ modelValue: string;
21
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
22
+ export default _default;
@@ -0,0 +1,77 @@
1
+ import { PropType } from 'vue';
2
+ import { Editor, Extension, OptionSchema } from '../../../core/src/index.ts';
3
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
4
+ editor: {
5
+ type: PropType<Editor | null>;
6
+ default: null;
7
+ };
8
+ }>, {
9
+ extensionList: import('vue').Ref<{
10
+ name: string;
11
+ priority?: number | undefined;
12
+ options?: import('../../../core/src/index.ts').ExtensionOptions | undefined;
13
+ schema?: Record<string | number, OptionSchema> | undefined;
14
+ enabled?: boolean | undefined;
15
+ onCreate?: ((editor: Editor) => void) | undefined;
16
+ onMount?: ((editor: Editor) => void) | undefined;
17
+ onUpdate?: ((editor: Editor, state: import('../../../core/src/index.ts').EditorState) => void) | undefined;
18
+ onUnmount?: ((editor: Editor) => void) | undefined;
19
+ onDestroy?: ((editor: Editor) => void) | undefined;
20
+ commands?: Record<string, import('../../../core/src/index.ts').Command> | undefined;
21
+ }[], Extension<import('../../../core/src/index.ts').ExtensionOptions>[] | {
22
+ name: string;
23
+ priority?: number | undefined;
24
+ options?: import('../../../core/src/index.ts').ExtensionOptions | undefined;
25
+ schema?: Record<string | number, OptionSchema> | undefined;
26
+ enabled?: boolean | undefined;
27
+ onCreate?: ((editor: Editor) => void) | undefined;
28
+ onMount?: ((editor: Editor) => void) | undefined;
29
+ onUpdate?: ((editor: Editor, state: import('../../../core/src/index.ts').EditorState) => void) | undefined;
30
+ onUnmount?: ((editor: Editor) => void) | undefined;
31
+ onDestroy?: ((editor: Editor) => void) | undefined;
32
+ commands?: Record<string, import('../../../core/src/index.ts').Command> | undefined;
33
+ }[]>;
34
+ getInputType: (ext: Extension, key: string, value: any) => string;
35
+ updateOption: (ext: Extension, key: string | number, value: any) => void;
36
+ getMinMax: (ext: Extension, key: string, val: number) => {
37
+ min: number;
38
+ max: number;
39
+ step: number;
40
+ };
41
+ formatNumber: (val: any) => any;
42
+ getLabel: (ext: Extension, key: string) => string;
43
+ getSelectOptions: (ext: Extension, key: string) => {
44
+ label: string;
45
+ value: any;
46
+ }[];
47
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
48
+ editor: {
49
+ type: PropType<Editor | null>;
50
+ default: null;
51
+ };
52
+ }>> & Readonly<{}>, {
53
+ editor: Editor | null;
54
+ }, {}, {
55
+ ColorPicker: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
56
+ modelValue: {
57
+ type: StringConstructor;
58
+ default: string;
59
+ };
60
+ }>, {
61
+ hexValue: import('vue').ComputedRef<string>;
62
+ alphaValue: import('vue').ComputedRef<number>;
63
+ updateColor: (e: Event) => void;
64
+ updateAlpha: (e: Event) => void;
65
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
66
+ modelValue: {
67
+ type: StringConstructor;
68
+ default: string;
69
+ };
70
+ }>> & Readonly<{
71
+ onChange?: ((...args: any[]) => any) | undefined;
72
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
73
+ }>, {
74
+ modelValue: string;
75
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
76
+ }, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
77
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { default as PooderEditor } from './PooderEditor.vue';
2
+ export { PooderEditor };
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vite').UserConfig;
2
+ export default _default;
package/dist/vue.css ADDED
@@ -0,0 +1 @@
1
+ .canvas-area[data-v-9f998bd0]{flex:1;background:#e0e0e0;display:flex;align-items:center;justify-content:center;overflow:auto;padding:20px}.canvas-wrapper[data-v-9f998bd0]{background:#fff;box-shadow:0 0 10px #0000001a}.color-picker[data-v-ae754a79]{display:flex;flex-direction:column}.color-picker input[type=color][data-v-ae754a79]{width:100%;height:30px;padding:0;border:none;cursor:pointer}.alpha-slider-wrap[data-v-ae754a79]{display:flex;align-items:center;margin-top:5px}.alpha-label[data-v-ae754a79]{font-size:12px;color:#666;margin-right:5px;width:15px}.alpha-slider-wrap input[type=range][data-v-ae754a79]{flex:1;margin-right:5px}.alpha-value[data-v-ae754a79]{font-size:12px;color:#666;width:30px;text-align:right}.tool-panel[data-v-97375248]{padding:15px;overflow-x:auto;overflow-y:hidden;height:100%;display:flex;flex-direction:row;background:#f9f9f9}.plugin-section[data-v-97375248]{width:300px;flex-shrink:0;margin-right:20px;border-right:1px solid #eee;padding-right:20px;height:100%;overflow-y:auto}.plugin-section h3[data-v-97375248]{margin-top:0;margin-bottom:15px;font-size:16px;color:#333;border-bottom:2px solid #ddd;padding-bottom:5px}.config-item[data-v-97375248]{margin-bottom:15px}.config-item label[data-v-97375248]{display:block;margin-bottom:5px;font-size:14px;font-weight:500;color:#555}.config-item input[type=text][data-v-97375248],.config-item input[type=number][data-v-97375248],.config-item select[data-v-97375248]{width:100%;padding:8px;border:1px solid #ddd;border-radius:4px;box-sizing:border-box;font-size:14px}.config-item input[type=checkbox][data-v-97375248]{transform:scale(1.2)}.checkbox-wrapper[data-v-97375248]{padding:5px 0}.slider-container[data-v-97375248]{display:flex;align-items:center;margin-top:5px}.slider-container input[type=range][data-v-97375248]{flex:1;margin-right:10px}.slider-value[data-v-97375248]{font-size:12px;color:#666;width:35px;text-align:right}.switch-wrapper[data-v-97375248]{padding:5px 0}.switch[data-v-97375248]{position:relative;display:inline-block;width:40px;height:20px}.switch input[data-v-97375248]{opacity:0;width:0;height:0}.slider[data-v-97375248]{position:absolute;cursor:pointer;inset:0;background-color:#ccc;transition:.4s;border-radius:20px}.slider[data-v-97375248]:before{position:absolute;content:"";height:16px;width:16px;left:2px;bottom:2px;background-color:#fff;transition:.4s;border-radius:50%}input:checked+.slider[data-v-97375248]{background-color:#2196f3}input:checked+.slider[data-v-97375248]:before{transform:translate(20px)}.pooder-editor[data-v-c3077c4c]{display:flex;flex-direction:column;width:100%;height:100%;background:#f0f2f5;box-sizing:border-box}.center-area[data-v-c3077c4c]{flex:1;display:flex;flex-direction:column;position:relative;overflow:hidden}.right-panel[data-v-c3077c4c]{width:100%;height:320px;background:#fff;border-top:1px solid #ddd;display:flex;flex-direction:column;z-index:10}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@pooder/vue",
3
+ "version": "0.0.2",
4
+ "main": "./dist/index.umd.js",
5
+ "module": "./dist/index.es.js",
6
+ "types": "./dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.es.js",
14
+ "require": "./dist/index.umd.js"
15
+ },
16
+ "./dist/vue.css": "./dist/vue.css"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "dependencies": {
22
+ "fabric": "^7.0.0",
23
+ "@pooder/core": "0.0.2",
24
+ "@pooder/kit": "0.0.2"
25
+ },
26
+ "peerDependencies": {
27
+ "vue": "^3.0.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^25.0.3",
31
+ "@vitejs/plugin-vue": "^5.2.4",
32
+ "tsup": "^8.0.0",
33
+ "typescript": "^5.0.0",
34
+ "vite": "^7.3.0",
35
+ "vite-plugin-dts": "^4.5.4",
36
+ "vue": "^3.0.0"
37
+ },
38
+ "scripts": {
39
+ "build": "vite build",
40
+ "dev": "vite build --watch"
41
+ }
42
+ }