New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

webgl-media-editor

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webgl-media-editor - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

dist/wrapper-BS2Zi_8p.js

2

dist/vue2.js

@@ -1,2 +0,2 @@

import{j as e,a as r,r as s,d as t,u as o,S as d,C as i,F as a,A as u}from"./wrapper-hVkM_Lpe.js";const n=(d,i,a)=>({name:i,props:{editor:{type:e,required:!0},sourceIndex:{type:Number,default:0},...a},beforeCreate(){this.scope=r(),this._sourceIndex=s(0)},mounted(){this.scope.run((()=>t(d,{editor:o(this.editor),sourceIndex:this._sourceIndex,showAllSources:!1,...this._extraProps},this.$el)))},render:e=>e("div"),watch:{sourceIndex:{handler(e){this._sourceIndex.value=e},immediate:!0},...null!=a},destroyed(){this.scope.stop()}}),p=n(d,"media-editor-preview"),m=n(i,"media-editor-cropper"),c=n(a,"media-editor-filter-menu"),h=n(u,"media-editor-adjustments-menu");export{e as MediaEditor,h as MediaEditorAdjustmentsMenu,m as MediaEditorCropper,c as MediaEditorFilterMenu,p as MediaEditorPreview};
import{i as e,a as r,r as s,d as t,u as o,S as d,C as i,F as a,A as u}from"./wrapper-BS2Zi_8p.js";const n=(d,i,a)=>({name:i,props:{editor:{type:e,required:!0},sourceIndex:{type:Number,default:0},...a},beforeCreate(){this.scope=r(),this._sourceIndex=s(0)},mounted(){this.scope.run((()=>t(d,{editor:o(this.editor),sourceIndex:this._sourceIndex,showAllSources:!1,...this._extraProps},this.$el)))},render:e=>e("div"),watch:{sourceIndex:{handler(e){this._sourceIndex.value=e},immediate:!0},...null!=a},destroyed(){this.scope.stop()}}),p=n(d,"media-editor-preview"),m=n(i,"media-editor-cropper"),c=n(a,"media-editor-filter-menu"),h=n(u,"media-editor-adjustments-menu");export{e as MediaEditor,h as MediaEditorAdjustmentsMenu,m as MediaEditorCropper,c as MediaEditorFilterMenu,p as MediaEditorPreview};
//# sourceMappingURL=vue2.js.map

@@ -1,2 +0,2 @@

import{h as e,t,r as s,c as r,E as o,C as n,A as a,F as u,g as c,a as d,M as l,b as h,d as v,e as m,f as p,w as f,u as w,S as b}from"./wrapper-hVkM_Lpe.js";export{i as EffectOpType,j as MediaEditor}from"./wrapper-hVkM_Lpe.js";const g=t=>e("svg",{className:"icon",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...t,children:e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[e("path",{d:"M8 5v10a1 1 0 0 0 1 1h10"}),e("path",{d:"M5 8h10a1 1 0 0 1 1 1v10"})]})}),x=t=>e("svg",{className:"icon",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...t,children:e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[e("path",{d:"M7 8a5 5 0 1 0 10 0A5 5 0 1 0 7 8"}),e("path",{d:"M8 11a5 5 0 1 0 3.998 1.997"}),e("path",{d:"M12.002 19.003A5 5 0 1 0 16 11"})]})}),E=t=>e("svg",{className:"icon",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...t,children:e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 21L21 6l-3-3L3 18zm9-15l3 3M9 3a2 2 0 0 0 2 2a2 2 0 0 0-2 2a2 2 0 0 0-2-2a2 2 0 0 0 2-2m10 10a2 2 0 0 0 2 2a2 2 0 0 0-2 2a2 2 0 0 0-2-2a2 2 0 0 0 2-2"})}),I=i=>{const{editor:d,view:l}=i,{sources:h}=d,v=t(i.sourceIndex??s(0)),m=r((()=>h.value[v.value])),p=r((()=>m.value?.effect.value??-1));if(null==c())throw new Error("[miru] must be run in scope");const f=r((()=>{const e=m.value?.adjustments.value;return null!=e&&!!(e.brightness||e.contrast||e.saturation)})),w={[o.Crop]:()=>e(n,{editor:d,sourceIndex:v}),[o.Adjust]:()=>e(a,{editor:d,sourceIndex:v,showPreviews:!0}),[o.Filter]:()=>e(u,{editor:d,sourceIndex:v,showPreviews:!0})};return e("div",{class:"miru--main",children:[e("div",{class:"miru--center",children:()=>w[l.value]?.()}),e("p",{class:"miru--menu",children:e("p",{class:"miru--menu__row",children:[{view:o.Crop,Icon:g,active:()=>!!m.value?.crop.value,label:"Crop"},{view:o.Adjust,Icon:x,active:()=>f.value,label:"Adjust"},{view:o.Filter,Icon:E,active:()=>-1!==p.value&&0!==(m.value?.intensity.value??0),label:"Filter"}].map((({view:t,Icon:s,active:i,label:r})=>e("button",{type:"button",class:()=>["miru--button",l.value==t&&"miru--acc",i()&&"miru--enabled"],onClick:()=>l.value=t,children:[e(s,{class:"miru--button__icon"}),e("span",{class:"miru--button__label",children:r})]})))})})]})},k=["sources","effects","view","assetsPath"],L=f.HTMLElement??Object;class C extends L{static observedAttributes=k;#e=d();#t;#s=s([]);#i;#r;#o=s(o.Crop);get sources(){return this.#t.sourceInputs.value}set sources(e){this.#t.sourceInputs.value=e??[]}get editStates(){return this.#t.sources.value.map((e=>e.getState()))}set editStates(e){this.#t.editStatesIn.value=e}get effects(){return this.#s.value}set effects(e){this.#s.value=e??[]}get view(){return this.#o.value}set view(e){null!=e&&(this.#o.value=e)}get isLoading(){return!!this.#t.isLoading}constructor(){super(),this.#t=this.#e.run((()=>new l({effects:this.#s,onEdit:(e,t)=>this.#n("miruedit",{index:e,...t}),onRenderPreview:()=>{}}))),this.#s.value=h("/assets/"),this.#i=this.#e.run((()=>v(I,{editor:this.#t,view:this.#o},this)))}attributeChangedCallback(e,t,s){if(s??="","sources"===e){if(s.trimStart().startsWith("["))try{return void(this.sources=JSON.parse(s))}catch{}this.sources=s?[s]:[]}else"effects"===e?this.#s.value=s&&JSON.parse(s):"assetsPath"===e?this.#s.value=h(s||void 0):this[e]=s}connectedCallback(){clearTimeout(this.#r)}disconnectedCallback(){this.#r=setTimeout(this.#i,500)}#n(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}async ready(){if(this.isLoading)return new Promise((e=>{this.#e.run((()=>{const t=m((()=>{this.#t.isLoading||(e(),t())}))}))}))}async toBlob(e,t){return this.#t.toBlob(e,t??{})}renderPreviewTo(e,t){return this.#t.renderPreviewTo(e,t)}async download(e,{filename:t="edited.jpeg",type:s="image/jpeg",quality:i=.9}={}){const r=this.#t,o=await r.toBlob(e,{type:s,quality:i});return p(o,t),!0}dispose(){this.#t.dispose(),this.#i()}}class y extends HTMLElement{sourceIndex=s(0);set editor(e){v(b,{editor:w(e),sourceIndex:this.sourceIndex},this)}}class M extends HTMLElement{sourceIndex=s(0);set editor(e){v(u,{editor:w(e),sourceIndex:this.sourceIndex},this)}}"undefined"!=typeof customElements&&"define"in customElements&&(customElements.define("media-editor",C),customElements.define("media-editor-preview",y),customElements.define("media-editor-filter-menu",M));export{C as MediaEditorElement,h as getDefaultFilters};
import{h as e,t,r as s,c as r,C as o,A as n,F as a,g as u,a as c,M as d,b as l,d as h,e as v,f as m,w as p,u as f,S as w}from"./wrapper-BS2Zi_8p.js";export{i as MediaEditor}from"./wrapper-BS2Zi_8p.js";var b=(e=>(e.Filter="filter",e.Adjust="adjust",e.Crop="crop",e))(b||{});const g=t=>e("svg",{className:"icon",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...t,children:e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[e("path",{d:"M8 5v10a1 1 0 0 0 1 1h10"}),e("path",{d:"M5 8h10a1 1 0 0 1 1 1v10"})]})}),x=t=>e("svg",{className:"icon",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...t,children:e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[e("path",{d:"M7 8a5 5 0 1 0 10 0A5 5 0 1 0 7 8"}),e("path",{d:"M8 11a5 5 0 1 0 3.998 1.997"}),e("path",{d:"M12.002 19.003A5 5 0 1 0 16 11"})]})}),I=t=>e("svg",{className:"icon",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...t,children:e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 21L21 6l-3-3L3 18zm9-15l3 3M9 3a2 2 0 0 0 2 2a2 2 0 0 0-2 2a2 2 0 0 0-2-2a2 2 0 0 0 2-2m10 10a2 2 0 0 0 2 2a2 2 0 0 0-2 2a2 2 0 0 0-2-2a2 2 0 0 0 2-2"})}),k=i=>{const{editor:c,view:d}=i,{sources:l}=c,h=t(i.sourceIndex??s(0)),v=r((()=>l.value[h.value])),m=r((()=>v.value?.effect.value??-1));if(null==u())throw new Error("[miru] must be run in scope");const p=r((()=>{const e=v.value?.adjustments.value;return null!=e&&!!(e.brightness||e.contrast||e.saturation)})),f={[b.Crop]:()=>e(o,{editor:c,sourceIndex:h}),[b.Adjust]:()=>e(n,{editor:c,sourceIndex:h,showPreviews:!0}),[b.Filter]:()=>e(a,{editor:c,sourceIndex:h,showPreviews:!0})};return e("div",{class:"miru--main",children:[e("div",{class:"miru--center",children:()=>f[d.value]?.()}),e("p",{class:"miru--menu",children:e("p",{class:"miru--menu__row",children:[{view:b.Crop,Icon:g,active:()=>!!v.value?.crop.value,label:"Crop"},{view:b.Adjust,Icon:x,active:()=>p.value,label:"Adjust"},{view:b.Filter,Icon:I,active:()=>-1!==m.value&&0!==(v.value?.intensity.value??0),label:"Filter"}].map((({view:t,Icon:s,active:i,label:r})=>e("button",{type:"button",class:()=>["miru--button",d.value==t&&"miru--acc",i()&&"miru--enabled"],onClick:()=>d.value=t,children:[e(s,{class:"miru--button__icon"}),e("span",{class:"miru--button__label",children:r})]})))})})]})},C=["sources","effects","view","assetsPath"],E=p.HTMLElement??Object;class L extends E{static observedAttributes=C;#e=c();#t;#s=s([]);#i;#r;#o=s(b.Crop);get sources(){return this.#t.sourceInputs.value}set sources(e){this.#t.sourceInputs.value=e??[]}get editStates(){return this.#t.sources.value.map((e=>e.getState()))}set editStates(e){this.#t.editStatesIn.value=e}get effects(){return this.#s.value}set effects(e){this.#s.value=e??[]}get view(){return this.#o.value}set view(e){null!=e&&(this.#o.value=e)}get isLoading(){return!!this.#t.isLoading}constructor(){super(),this.#t=this.#e.run((()=>new d({effects:this.#s,onEdit:(e,t)=>this.#n("miruedit",{index:e,...t}),onRenderPreview:()=>{}}))),this.#s.value=l("/assets/"),this.#i=this.#e.run((()=>h(k,{editor:this.#t,view:this.#o},this)))}attributeChangedCallback(e,t,s){if(s??="","sources"===e){if(s.trimStart().startsWith("["))try{return void(this.sources=JSON.parse(s))}catch{}this.sources=s?[s]:[]}else"effects"===e?this.#s.value=s&&JSON.parse(s):"assetsPath"===e?this.#s.value=l(s||void 0):this[e]=s}connectedCallback(){clearTimeout(this.#r)}disconnectedCallback(){this.#r=setTimeout(this.#i,500)}#n(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}async ready(){if(this.isLoading)return new Promise((e=>{this.#e.run((()=>{const t=v((()=>{this.#t.isLoading||(e(),t())}))}))}))}async toBlob(e,t){return this.#t.toBlob(e,t??{})}renderPreviewTo(e,t){return this.#t.renderPreviewTo(e,t)}async download(e,{filename:t="edited.jpeg",type:s="image/jpeg",quality:i=.9}={}){const r=this.#t,o=await r.toBlob(e,{type:s,quality:i});return m(o,t),!0}dispose(){this.#t.dispose(),this.#i()}}class j extends HTMLElement{sourceIndex=s(0);set editor(e){h(w,{editor:f(e),sourceIndex:this.sourceIndex},this)}}class y extends HTMLElement{sourceIndex=s(0);set editor(e){h(a,{editor:f(e),sourceIndex:this.sourceIndex},this)}}"undefined"!=typeof customElements&&"define"in customElements&&(customElements.define("media-editor",L),customElements.define("media-editor-preview",j),customElements.define("media-editor-filter-menu",y));export{L as MediaEditorElement,l as getDefaultFilters};
//# sourceMappingURL=webgl-media-editor.js.map
{
"name": "webgl-media-editor",
"description": "A simple image editor with cropping, rotation, and WebGL filters",
"version": "0.0.0",
"version": "0.0.1",
"type": "module",

@@ -38,2 +38,5 @@ "module": "dist/webgl-media-editor.js",

},
"devDependencies": {
"twgl.js": "^5.5.4"
},
"exports": {

@@ -40,0 +43,0 @@ ".": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc