From 8c5d60500f19c4121fb65e12e4b23d944973af3a Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Fri, 5 Jul 2024 11:20:16 -0600 Subject: [PATCH] Updates --- plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.js b/plugin.js index 60402af..51c1924 100644 --- a/plugin.js +++ b/plugin.js @@ -1 +1 @@ -penpot.ui.open("Phosphor Icons",`?theme=${penpot.getTheme()}`,{width:350,height:580});penpot.on("themechange",e=>{i({type:"theme",content:e})});penpot.ui.onMessage(async e=>{const t=JSON.parse(e);switch(t.type){case"inserticon":await h(t);break;default:return}});function i(e){penpot.ui.sendMessage(e)}async function h(e){const{entry:t,svg:o,raw:a,weight:c}=e.content,r=a?await(async()=>{try{return await u(t.name,c)}catch{return o}})():o,s=penpot.viewport.center,n=penpot.createShapeFromSvg(r);n.name=t.pascal_name,n.proportionLock=!0,a||n.resize(24,24),n.x=s.x,n.y=s.y}async function u(e,t){const o=e+(t==="regular"?"":`-${t}`);return(await fetch(`https://raw.githubusercontent.com/phosphor-icons/core/main/raw/${t}/${o}.svg`)).text()} +penpot.ui.open("Phosphor Icons",`/penpot/?theme=${penpot.getTheme()}`,{width:350,height:580});penpot.on("themechange",e=>{i({type:"theme",content:e})});penpot.ui.onMessage(async e=>{const t=JSON.parse(e);switch(t.type){case"inserticon":await h(t);break;default:return}});function i(e){penpot.ui.sendMessage(e)}async function h(e){const{entry:t,svg:o,raw:a,weight:c}=e.content,r=a?await(async()=>{try{return await u(t.name,c)}catch{return o}})():o,s=penpot.viewport.center,n=penpot.createShapeFromSvg(r);n.name=t.pascal_name,n.proportionLock=!0,a||n.resize(24,24),n.x=s.x,n.y=s.y}async function u(e,t){const o=e+(t==="regular"?"":`-${t}`);return(await fetch(`https://raw.githubusercontent.com/phosphor-icons/core/main/raw/${t}/${o}.svg`)).text()}