@imgly/plugin-qr-code-web 1.68.0-rc.1 → 1.68.0-rc.3
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.mjs +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ var Rt=class{constructor(t,n){this.engine=t,this.key=n}hasData(t){return this.en
|
|
|
17
17
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 13H13V15H15V17H13V21H17V19H19V21H21V19H19V17H21V13H17V15H15V13ZM17 17H15V19H17V17ZM17 17V15H19V17H17Z" fill="currentColor"/>
|
|
18
18
|
</symbol>
|
|
19
19
|
</svg>
|
|
20
|
-
`),l.setTranslations({en:{"ly.img.generate-qr.dock.label":"QR Code",[`panel.${m}`]:"Generate QR Code",[`panel.${m}.description`]:"Enter a URL to automatically generate a QR code for you to embed it in your design.",[`panel.${m}.submit`]:"Generate QR Code",[`panel.${m}.url`]:"URL",[`panel.${m}.foregroundColor`]:"Foreground Color",[`panel.${m}.error`]:"Failed to create QR code block.",[`panel.${v}`]:"Update QR Code",[`panel.${v}.description`]:"Update the URL to automatically refresh the QR code within your design.",[`panel.${v}.asShape`]:"As Shape?",[`panel.${v}.onlyOneBlock`]:"Please select only one block to update the QR code.",[`panel.${v}.noMetadata`]:"Invalid QR code block selected. Missing metadata.",[`panel.${v}.invalidStateShape`]:"Invalid state with no shape found.",[`panel.${v}.invalidStateFill`]:"Invalid state with no fill found.",[`panel.${v}.url`]:"URL",[`panel.${v}.foregroundColor`]:"Foreground Color","ly.img.generate-qr.canvasMenu.edit":"Edit"}}),["ly.img.replace","ly.img.crop","ly.img.fill","ly.img.adjustment","ly.img.shape.options"].forEach(d=>{l.feature.enable(d,({isPreviousEnable:f,engine:e})=>e.block.findAllSelected().every(r=>c.hasData(r)?c.get(r)?.type==="fill":!1)?!1:f())}),l.ui.registerComponent("ly.img.generate-qr.dock",({builder:d})=>{let f=l.ui.isPanelOpen(m);d.Button("ly.img.generate-qr.dock",{label:"ly.img.generate-qr.dock.label",icon:"@imgly/plugin/qr",isSelected:f,onClick:()=>{f?l.ui.closePanel(m):l.ui.openPanel(m)}})}),l.ui.registerComponent("ly.img.update-qr.canvasMenu",({builder:d,engine:f})=>{let e=f.block.findAllSelected();if(e.length!==1)return;let i=e[0];f.block.isAllowedByScope(i,"fill/change")&&c.hasData(i)&&d.Button("ly.img.update-qr.dock",{label:"ly.img.generate-qr.canvasMenu.edit",icon:"@imgly/plugin/qr",onClick:()=>{l.ui.openPanel(v)}})}),l.ui.setCanvasMenuOrder(["ly.img.update-qr.canvasMenu",...l.ui.getCanvasMenuOrder()]),l.ui.registerPanel(m,({builder:d,engine:f,state:e})=>{let i=e("url",""),r=e("color",{r:0,g:0,b:0,a:1}),a=e("asShape",n==="shape");d.Section("ly.img.generate-qr.text.section",{children:()=>{d.Text("ly.img.generate-qr.text",{content:`panel.${m}.description`})}}),d.Section("ly.img.generate-qr.inputs.section",{children:()=>{d.TextInput("ly.img.generate-qr.url",{inputLabel:`panel.${m}.url`,...i}),d.ColorInput("ly.img.generate-qr.foregroundColor",{label:`panel.${m}.foregroundColor`,inputLabel:`panel.${m}.foregroundColor`,...r})}}),d.Section("ly.img.generate-qr.button.section",{children:()=>{d.Button("ly.img.generate-qr.generate",{label:`panel.${m}.submit`,isDisabled:i.value==="",color:"accent",onClick:async()=>{await ki(l,f,i.value,r.value,c,a.value)!=null&&l.ui.closePanel(m)}}),o&&d.Checkbox("ly.img.generate-qr.asShape",{inputLabel:`panel.${v}.asShape`,...a})}})}),l.engine.block.onSelectionChanged(()=>{let d=l.engine.block.findAllSelected();if(d.length!==1){l.ui.isPanelOpen(v)&&l.ui.closePanel(v);return}let f=d[0];c.hasData(f)||l.ui.isPanelOpen(v)&&l.ui.closePanel(v)}),l.ui.registerPanel(v,({builder:d,engine:f})=>{let e=f.block.findAllSelected();if(e.length!==1){d.Section("ly.img.update-qr.only-one-block.section",{children:()=>{d.Text("ly.img.update-qr.only-one-block",{content:`panel.${v}.onlyOneBlock`})}});return}let i=e[0];if(!c.hasData(i)){d.Section("ly.img.update-qr.no-metadata.section",{children:()=>{d.Text("ly.img.update-qr.no-metadata",{content:`panel.${v}.noMetadata`})}});return}let{url:r,color:a,type:s}=c.get(i);d.Section("ly.img.update-qr.section",{children:()=>{d.Text("ly.img.update-qr.text",{content:`panel.${v}.description`}),d.TextInput("ly.img.update-qr.url",{inputLabel:`panel.${v}.url`,value:r,setValue:h=>{c.set(i,{url:h,color:a,type:s}),St(l,f,i,h,a,s)}}),s==="fill"&&d.ColorInput("ly.img.update-qr.foregroundColor",{inputLabel:`panel.${v}.foregroundColor`,inputLabelPosition:"top",value:Ct(a),setValue:h=>{let u=Mi(f,h);c.set(i,{url:r,color:u,type:s}),St(l,f,i,r,u,s)}})}})})}}};function Mi(t,n){let o=typeof n=="string",l;if(o)l=n;else{let c=t.editor.convertColorToColorSpace(n,"sRGB");l=K(c)}return l}async function ki(t,n,o,l,c,d){let f=n.editor.convertColorToColorSpace(l,"sRGB"),e=K(f),{path:i,svg:r,size:a}=J(o,e),s;if(d){if(s=await n.asset.defaultApplyAsset({id:"qr-code",meta:{kind:"shape",vectorPath:i,height:a,width:a,shapeType:"//ly.img.ubq/shape/vector_path"},payload:{}}),s!=null){if(n.block.supportsFill(s)){let h=n.block.getFill(s);n.block.getType(h)==="//ly.img.ubq/fill/color"&&n.block.setColor(h,"fill/color/value",f)}It(n,s)}}else{let h=`data:text/plain;base64,${btoa(r)}`;s=await n.asset.defaultApplyAsset({id:"qr-code",meta:{fillType:"//ly.img.ubq/fill/image",width:a,height:a},payload:{sourceSet:[{uri:h,width:a,height:a}]}})}return s==null?t.ui.showNotification({type:"error",message:`panel.${m}.error`}):c.set(s,{url:o,color:e,type:d?"shape":"fill"}),s}function St(t,n,o,l,c,d){let{path:f,svg:e,size:i}=J(l,c);if(d==="shape"){if(!n.block.supportsShape(o)){t.ui.showNotification({type:"error",message:`panel.${v}.invalidStateShape`});return}let r=n.block.getShape(o);n.block.setString(r,"shape/vector_path/path",f),n.block.setFloat(r,"shape/vector_path/height",i),n.block.setFloat(r,"shape/vector_path/width",i),It(n,o)}else if(d==="fill"){if(!n.block.supportsFill(o)){t.ui.showNotification({type:"error",message:`panel.${v}.invalidStateFill`});return}let r=n.block.getFill(o),a=`data:text/plain;base64,${btoa(e)}`;n.block.setSourceSet(r,"fill/image/sourceSet",[{uri:a,width:i,height:i}])}}function It(t,n){let o=t.block.duplicate(n),l=t.block.getParent(n);if(l!=null){let c=t.block.create("graphic");t.block.setShape(c,t.block.createShape("//ly.img.ubq/shape/rect")),t.block.appendChild(l,c),t.block.setPositionX(c,t.block.getPositionX(n)),t.block.setPositionY(c,t.block.getPositionY(n)),t.block.setWidth(c,t.block.getWidth(n)),t.block.setHeight(c,t.block.getHeight(n));let d=t.block.combine([o,c],"Intersection");t.block.setShape(n,t.block.getShape(d)),t.block.destroy(d)}return n}var Ni=t=>({name:Q,version:"1.68.0-rc.
|
|
20
|
+
`),l.setTranslations({en:{"ly.img.generate-qr.dock.label":"QR Code",[`panel.${m}`]:"Generate QR Code",[`panel.${m}.description`]:"Enter a URL to automatically generate a QR code for you to embed it in your design.",[`panel.${m}.submit`]:"Generate QR Code",[`panel.${m}.url`]:"URL",[`panel.${m}.foregroundColor`]:"Foreground Color",[`panel.${m}.error`]:"Failed to create QR code block.",[`panel.${v}`]:"Update QR Code",[`panel.${v}.description`]:"Update the URL to automatically refresh the QR code within your design.",[`panel.${v}.asShape`]:"As Shape?",[`panel.${v}.onlyOneBlock`]:"Please select only one block to update the QR code.",[`panel.${v}.noMetadata`]:"Invalid QR code block selected. Missing metadata.",[`panel.${v}.invalidStateShape`]:"Invalid state with no shape found.",[`panel.${v}.invalidStateFill`]:"Invalid state with no fill found.",[`panel.${v}.url`]:"URL",[`panel.${v}.foregroundColor`]:"Foreground Color","ly.img.generate-qr.canvasMenu.edit":"Edit"}}),["ly.img.replace","ly.img.crop","ly.img.fill","ly.img.adjustment","ly.img.shape.options"].forEach(d=>{l.feature.enable(d,({isPreviousEnable:f,engine:e})=>e.block.findAllSelected().every(r=>c.hasData(r)?c.get(r)?.type==="fill":!1)?!1:f())}),l.ui.registerComponent("ly.img.generate-qr.dock",({builder:d})=>{let f=l.ui.isPanelOpen(m);d.Button("ly.img.generate-qr.dock",{label:"ly.img.generate-qr.dock.label",icon:"@imgly/plugin/qr",isSelected:f,onClick:()=>{f?l.ui.closePanel(m):l.ui.openPanel(m)}})}),l.ui.registerComponent("ly.img.update-qr.canvasMenu",({builder:d,engine:f})=>{let e=f.block.findAllSelected();if(e.length!==1)return;let i=e[0];f.block.isAllowedByScope(i,"fill/change")&&c.hasData(i)&&d.Button("ly.img.update-qr.dock",{label:"ly.img.generate-qr.canvasMenu.edit",icon:"@imgly/plugin/qr",onClick:()=>{l.ui.openPanel(v)}})}),l.ui.setCanvasMenuOrder(["ly.img.update-qr.canvasMenu",...l.ui.getCanvasMenuOrder()]),l.ui.registerPanel(m,({builder:d,engine:f,state:e})=>{let i=e("url",""),r=e("color",{r:0,g:0,b:0,a:1}),a=e("asShape",n==="shape");d.Section("ly.img.generate-qr.text.section",{children:()=>{d.Text("ly.img.generate-qr.text",{content:`panel.${m}.description`})}}),d.Section("ly.img.generate-qr.inputs.section",{children:()=>{d.TextInput("ly.img.generate-qr.url",{inputLabel:`panel.${m}.url`,...i}),d.ColorInput("ly.img.generate-qr.foregroundColor",{label:`panel.${m}.foregroundColor`,inputLabel:`panel.${m}.foregroundColor`,...r})}}),d.Section("ly.img.generate-qr.button.section",{children:()=>{d.Button("ly.img.generate-qr.generate",{label:`panel.${m}.submit`,isDisabled:i.value==="",color:"accent",onClick:async()=>{await ki(l,f,i.value,r.value,c,a.value)!=null&&l.ui.closePanel(m)}}),o&&d.Checkbox("ly.img.generate-qr.asShape",{inputLabel:`panel.${v}.asShape`,...a})}})}),l.engine.block.onSelectionChanged(()=>{let d=l.engine.block.findAllSelected();if(d.length!==1){l.ui.isPanelOpen(v)&&l.ui.closePanel(v);return}let f=d[0];c.hasData(f)||l.ui.isPanelOpen(v)&&l.ui.closePanel(v)}),l.ui.registerPanel(v,({builder:d,engine:f})=>{let e=f.block.findAllSelected();if(e.length!==1){d.Section("ly.img.update-qr.only-one-block.section",{children:()=>{d.Text("ly.img.update-qr.only-one-block",{content:`panel.${v}.onlyOneBlock`})}});return}let i=e[0];if(!c.hasData(i)){d.Section("ly.img.update-qr.no-metadata.section",{children:()=>{d.Text("ly.img.update-qr.no-metadata",{content:`panel.${v}.noMetadata`})}});return}let{url:r,color:a,type:s}=c.get(i);d.Section("ly.img.update-qr.section",{children:()=>{d.Text("ly.img.update-qr.text",{content:`panel.${v}.description`}),d.TextInput("ly.img.update-qr.url",{inputLabel:`panel.${v}.url`,value:r,setValue:h=>{c.set(i,{url:h,color:a,type:s}),St(l,f,i,h,a,s)}}),s==="fill"&&d.ColorInput("ly.img.update-qr.foregroundColor",{inputLabel:`panel.${v}.foregroundColor`,inputLabelPosition:"top",value:Ct(a),setValue:h=>{let u=Mi(f,h);c.set(i,{url:r,color:u,type:s}),St(l,f,i,r,u,s)}})}})})}}};function Mi(t,n){let o=typeof n=="string",l;if(o)l=n;else{let c=t.editor.convertColorToColorSpace(n,"sRGB");l=K(c)}return l}async function ki(t,n,o,l,c,d){let f=n.editor.convertColorToColorSpace(l,"sRGB"),e=K(f),{path:i,svg:r,size:a}=J(o,e),s;if(d){if(s=await n.asset.defaultApplyAsset({id:"qr-code",meta:{kind:"shape",vectorPath:i,height:a,width:a,shapeType:"//ly.img.ubq/shape/vector_path"},payload:{}}),s!=null){if(n.block.supportsFill(s)){let h=n.block.getFill(s);n.block.getType(h)==="//ly.img.ubq/fill/color"&&n.block.setColor(h,"fill/color/value",f)}It(n,s)}}else{let h=`data:text/plain;base64,${btoa(r)}`;s=await n.asset.defaultApplyAsset({id:"qr-code",meta:{fillType:"//ly.img.ubq/fill/image",width:a,height:a},payload:{sourceSet:[{uri:h,width:a,height:a}]}})}return s==null?t.ui.showNotification({type:"error",message:`panel.${m}.error`}):c.set(s,{url:o,color:e,type:d?"shape":"fill"}),s}function St(t,n,o,l,c,d){let{path:f,svg:e,size:i}=J(l,c);if(d==="shape"){if(!n.block.supportsShape(o)){t.ui.showNotification({type:"error",message:`panel.${v}.invalidStateShape`});return}let r=n.block.getShape(o);n.block.setString(r,"shape/vector_path/path",f),n.block.setFloat(r,"shape/vector_path/height",i),n.block.setFloat(r,"shape/vector_path/width",i),It(n,o)}else if(d==="fill"){if(!n.block.supportsFill(o)){t.ui.showNotification({type:"error",message:`panel.${v}.invalidStateFill`});return}let r=n.block.getFill(o),a=`data:text/plain;base64,${btoa(e)}`;n.block.setSourceSet(r,"fill/image/sourceSet",[{uri:a,width:i,height:i}])}}function It(t,n){let o=t.block.duplicate(n),l=t.block.getParent(n);if(l!=null){let c=t.block.create("graphic");t.block.setShape(c,t.block.createShape("//ly.img.ubq/shape/rect")),t.block.appendChild(l,c),t.block.setPositionX(c,t.block.getPositionX(n)),t.block.setPositionY(c,t.block.getPositionY(n)),t.block.setWidth(c,t.block.getWidth(n)),t.block.setHeight(c,t.block.getHeight(n));let d=t.block.combine([o,c],"Intersection");t.block.setShape(n,t.block.getShape(d)),t.block.destroy(d)}return n}var Ni=t=>({name:Q,version:"1.68.0-rc.3",...Et(t)}),tn=Ni;export{tn as default};
|
|
21
21
|
/*! Bundled license information:
|
|
22
22
|
|
|
23
23
|
lodash-es/lodash.js:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imgly/plugin-qr-code-web",
|
|
3
|
-
"version": "1.68.0-rc.
|
|
3
|
+
"version": "1.68.0-rc.3",
|
|
4
4
|
"description": "QR code generation plugin for the CE.SDK editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CE.SDK",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@imgly/plugin-utils": "0.0.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@cesdk/cesdk-js": "1.68.0-rc.
|
|
47
|
+
"@cesdk/cesdk-js": "1.68.0-rc.3"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"start": "pnpm dev",
|