@anu3ev/fabric-image-editor 0.5.32 → 0.5.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anu3ev/fabric-image-editor",
3
- "version": "0.5.32",
3
+ "version": "0.5.34",
4
4
  "description": "JavaScript image editor built on FabricJS, allowing you to create instances with an integrated montage area and providing an API to modify and manage state.",
5
5
  "module": "dist/main.js",
6
6
  "files": [
@@ -1,2 +0,0 @@
1
- var u=(g,o,r)=>new Promise((i,e)=>{var d=t=>{try{n(r.next(t))}catch(c){e(c)}},l=t=>{try{n(r.throw(t))}catch(c){e(c)}},n=t=>t.done?i(t.value):Promise.resolve(t.value).then(d,l);n((r=r.apply(g,o)).next())});(function(){"use strict";self.onmessage=g=>u(null,null,function*(){const{action:o,payload:r,requestId:i}=g.data;try{switch(o){case"resizeImage":{const{dataURL:e,maxWidth:d,maxHeight:l,minWidth:n,minHeight:t,sizeType:c}=r,h=yield createImageBitmap(yield(yield fetch(e)).blob());let{width:a,height:s}=h,w=Math.min(d/a,l/s);c==="min"&&(w=Math.max(n/a,t/s)),a=Math.floor(a*w),s=Math.floor(s*w);const m=new OffscreenCanvas(a,s),f=m.getContext("2d");if(!f)throw new Error("Failed to get 2D context from OffscreenCanvas");f.drawImage(h,0,0,a,s);const b=yield m.convertToBlob();self.postMessage({requestId:i,action:o,success:!0,data:b});break}case"toDataURL":{const{bitmap:e,format:d,quality:l,returnBlob:n}=r,{width:t,height:c}=e,h=new OffscreenCanvas(e.width,e.height),a=h.getContext("2d");if(!a)throw new Error("Failed to get 2D context from OffscreenCanvas");a.drawImage(e,0,0,t,c);const s=yield h.convertToBlob({type:d,quality:l});if(n){self.postMessage({requestId:i,action:o,success:!0,data:s});break}const w=yield new Promise(m=>{const f=new FileReader;f.onload=()=>m(f.result),f.readAsDataURL(s)});self.postMessage({requestId:i,action:o,success:!0,data:w});break}default:throw new Error(`Unknown action ${o}`)}}catch(e){self.postMessage({requestId:i,action:o,success:!1,error:e.message})}})})();
2
- //# sourceMappingURL=worker-CN39s7P7.js.map