@overglaze/web 0.0.0-stage → 0.9.0

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.
Files changed (51) hide show
  1. package/LICENSE +98 -0
  2. package/README.md +63 -2
  3. package/desktops/desktop.js +40 -0
  4. package/desktops/fonts/DMMono-Medium.woff2 +0 -0
  5. package/desktops/fonts/DMMono-Regular.woff2 +0 -0
  6. package/desktops/fonts/NotoSerif-VF.woff2 +0 -0
  7. package/desktops/fonts/OFL-DMMono.txt +93 -0
  8. package/desktops/fonts/OFL-NotoSerif.txt +93 -0
  9. package/desktops/fonts/OFL-SpaceGrotesk.txt +93 -0
  10. package/desktops/fonts/SpaceGrotesk-Bold.woff2 +0 -0
  11. package/desktops/fonts/SpaceGrotesk-Medium.woff2 +0 -0
  12. package/desktops/fonts/SpaceGrotesk-Regular.woff2 +0 -0
  13. package/desktops/wallpapers.js +227 -0
  14. package/embed.css +53 -0
  15. package/embed.js +6 -0
  16. package/engine/core.js +6 -0
  17. package/engine/cursor.js +6 -0
  18. package/engine/descriptor.js +6 -0
  19. package/engine/files.js +6 -0
  20. package/engine/globals.js +6 -0
  21. package/engine/golden-globals.js +6 -0
  22. package/engine/imgui-ops.js +6 -0
  23. package/engine/keys.js +6 -0
  24. package/engine/modules.js +6 -0
  25. package/engine/naga.wasm +0 -0
  26. package/engine/naga.wasm.notices.txt +2344 -0
  27. package/engine/ops.js +6 -0
  28. package/engine/param-store.js +6 -0
  29. package/engine/plugin-js.wasm +0 -0
  30. package/engine/plugin-js.wasm.notices.txt +4411 -0
  31. package/engine/plugin-storage.js +6 -0
  32. package/engine/session.js +9 -0
  33. package/engine/shaders.js +7 -0
  34. package/engine/tex.js +6 -0
  35. package/engine/uniforms.js +6 -0
  36. package/engine/worker.js +74 -0
  37. package/host/api.js +30 -0
  38. package/host/assets.js +6 -0
  39. package/host/bootstrap.js +7 -0
  40. package/host/imgui.js +6 -0
  41. package/host/params.js +6 -0
  42. package/host/seeded_random.js +6 -0
  43. package/host/storage.js +6 -0
  44. package/host/webio.js +6 -0
  45. package/host/webshim.js +6 -0
  46. package/package.json +19 -4
  47. package/player/fill.js +6 -0
  48. package/player/panel.css +92 -0
  49. package/player/panel.js +6 -0
  50. package/player/player.css +210 -0
  51. package/player/player.js +6 -0
@@ -0,0 +1,227 @@
1
+ /*! Overglaze web engine. Licensed under the PolyForm Noncommercial License 1.0.0
2
+ * <https://polyformproject.org/licenses/noncommercial/1.0.0>
3
+ * Required Notice: Copyright (c) 2026 Svetlozar Kostadinov
4
+ * With an added permission to run it to develop and preview Overglaze plugins: see LICENSE in @overglaze/web
5
+ */
6
+ var vt=Object.defineProperty;var d=(l,e)=>vt(l,"name",{value:e,configurable:!0});function J(l){return()=>{l=l+1831565813|0;let e=Math.imul(l^l>>>15,1|l);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}d(J,"rng");const t=d(l=>Math.round(l*10)/10,"f"),x=1920,K=d(l=>`<defs>
7
+ <filter id="w-blur-l"><feGaussianBlur stdDeviation="110"/></filter>
8
+ <filter id="w-blur-m"><feGaussianBlur stdDeviation="38"/></filter>
9
+ <filter id="w-blur-f"><feGaussianBlur stdDeviation="18"/></filter>
10
+ <filter id="w-blur-c"><feGaussianBlur stdDeviation="10"/></filter>
11
+ <filter id="w-blur-r"><feGaussianBlur stdDeviation="6"/></filter>
12
+ <filter id="w-blur-s"><feGaussianBlur stdDeviation="2.5"/></filter>${l}
13
+ </defs>`,"DEFS"),E=d((l,e)=>`
14
+ <linearGradient id="${l}" x1="0" y1="0" x2="0" y2="1">${e.map(([i,p])=>`
15
+ <stop offset="${i}" style="stop-color: var(--${p})"/>`).join("")}
16
+ </linearGradient>`,"vgrad"),kt=d((l,e)=>E(l,e).replace('x2="0" y2="1"','x2="1" y2="0"'),"hgrad"),O=d(l=>`<svg class="wall" viewBox="0 0 1920 1080" preserveAspectRatio="xMidYMid slice" data-focus="${l}" aria-hidden="true">`,"open");function lt(l,e,i,p,h=10){const u=p.map(()=>l()*Math.PI*2),v=p.reduce((m,[,b])=>m+b,0),z=[];for(let m=-40;m<=x+40;m+=h){const b=m/x;let L=0;p.forEach(([j,g],f)=>L+=g*Math.pow(1-Math.abs(Math.sin(b*j*Math.PI+u[f])),2)),z.push([m,e-i*(L/v+(l()-.5)*.03)])}return z}d(lt,"ridge");const R=d((l,e)=>`M-40 ${e} `+l.map(([i,p])=>`L${t(i)} ${t(p)}`).join(" ")+` L${x+40} ${e} Z`,"poly"),nt=d((l,e)=>l.map(([i,p])=>[i,2*e-p]),"mirror");function T(l,e,i){let p="";for(let h=0;h<e;h++){const u=.8+l()*l()*1.8;p+=`M${t(l()*x)} ${t(Math.pow(l(),1.4)*i)} h${t(u)} v${t(u)} h${t(-u)} Z `}return p}d(T,"stars");function mt(){const l=J(11),e=lt(l,650,270,[[1.7,1],[3.9,.55],[9.5,.22],[23,.07]],8),i=lt(l,760,170,[[2.3,1],[5.1,.5],[12,.18],[27,.06]]),p=lt(l,822,95,[[3.1,1],[7.3,.4],[17,.15]]),h=822,u=1120,v=[u,e.reduce((f,c)=>Math.abs(c[0]-u)<Math.abs(f[0]-u)?c:f)[1]-14],z=540;let m="",b=[];const L=d(()=>{b.length>1&&(m+="M"+b.map(([f,c])=>`${t(f)} ${t(c)}`).join(" L")+" L"+b.slice().reverse().map(([f,,c])=>`${t(f)} ${t(c)}`).join(" L")+" Z "),b=[]},"flush");for(const[f,c]of e){const k=Math.min(z+(l()-.5)*40+Math.sin(f/23)*12,c+26+(z-c)*.9);k>c+1?b.push([f,c,k]):L()}L();const j=Array.from({length:30},()=>{const f=836+Math.pow(l(),1.3)*200;return`<ellipse cx="${t(v[0]+(l()-.5)*(50+(f-830)*1.3))}" cy="${t(f)}" rx="${t(16+l()*80*((f-820)/200))}" ry="1.3" style="fill: var(--sheen)"/>`}).join(`
17
+ `);let g="M-40 1100 L-40 940";for(let f=-40;f<760;){const c=14+l()*16,k=930+(f/760)**2*150,$=(60+l()*90)*(1-f/1e3);g+=` L${t(f+c/2)} ${t(k-$)} L${t(f+c)} ${t(k-$*.25)}`,f+=c}return g+=" L820 1100 Z",{palettes:{light:{"sky-0":"#7d97c9","sky-1":"#e2a8b2","sky-2":"#f7cf98",glow:"#ffd59c",sun:"#fff3da","sun-o":"1",moon:"#eef0f6","moon-o":"0",stars:"0",snow:"#fdf0ea",far:"#b48f9d",haze:"#f4c6b4",mid:"#8a6b92",near:"#4d3f66","lake-0":"#dcaaa8","lake-1":"#4a3d62",sheen:"#fff2dd",shore:"#2a2238"},dark:{"sky-0":"#050a1c","sky-1":"#111b3e","sky-2":"#283262",glow:"#3e4f8f",sun:"#ffffff","sun-o":"0",moon:"#eef0f6","moon-o":"1",stars:"0.9",snow:"#9aa8d4",far:"#2c3667",haze:"#394678",mid:"#1e2650",near:"#131938","lake-0":"#1f2a57","lake-1":"#060a19",sheen:"#b5c2ea",shore:"#060914"}},svg:O("0.56 0.62")+K(E("w-sky",[[0,"sky-0"],[.55,"sky-1"],[1,"sky-2"]])+E("w-lake",[[0,"lake-0"],[1,"lake-1"]]))+`
18
+ <rect width="1920" height="${h}" fill="url(#w-sky)"/>
19
+ <path d="${T(l,260,560)}" style="fill: var(--snow)" opacity="var(--stars)"/>
20
+ <g filter="url(#w-blur-l)">
21
+ <ellipse cx="${v[0]}" cy="600" rx="600" ry="260" style="fill: var(--glow)" opacity="0.9"/>
22
+ </g>
23
+ <g filter="url(#w-blur-f)" opacity="var(--moon-o)">
24
+ <ellipse cx="1300" cy="190" rx="70" ry="70" style="fill: var(--glow)"/>
25
+ </g>
26
+ <ellipse cx="1300" cy="190" rx="30" ry="30" style="fill: var(--moon)" opacity="var(--moon-o)"/>
27
+ <ellipse cx="${v[0]}" cy="${v[1]}" rx="40" ry="40" style="fill: var(--sun)" opacity="var(--sun-o)"/>
28
+ <path d="${R(e,1100)}" style="fill: var(--far)"/>
29
+ <path d="${m}" style="fill: var(--snow)" opacity="0.9"/>
30
+ <g filter="url(#w-blur-m)" opacity="0.55">
31
+ <ellipse cx="960" cy="700" rx="1300" ry="60" style="fill: var(--haze)"/>
32
+ </g>
33
+ <path d="${R(i,1100)}" style="fill: var(--mid)"/>
34
+ <path d="${R(p,1100)}" style="fill: var(--near)"/>
35
+ <rect y="${h}" width="1920" height="${1080-h}" fill="url(#w-lake)"/>
36
+ <g filter="url(#w-blur-r)" opacity="0.45">
37
+ <path d="${R(nt(i,h),h)}" style="fill: var(--mid)"/>
38
+ <path d="${R(nt(p,h),h)}" style="fill: var(--near)"/>
39
+ </g>
40
+ <g filter="url(#w-blur-f)" opacity="0.6">
41
+ <ellipse cx="${v[0]}" cy="856" rx="300" ry="24" style="fill: var(--glow)"/>
42
+ </g>
43
+ <g filter="url(#w-blur-s)" opacity="0.6">
44
+ ${j}
45
+ </g>
46
+ <path d="${g}" style="fill: var(--shore)"/>
47
+ </svg>`}}d(mt,"alpine");function A(l){let e=`${t(l[0][0])} ${t(l[0][1])}`;for(let i=0;i<l.length-1;i++){const p=l[Math.max(0,i-1)],h=l[i],u=l[i+1],v=l[Math.min(l.length-1,i+2)];e+=` C${t(h[0]+(u[0]-p[0])/6)} ${t(h[1]+(u[1]-p[1])/6)} ${t(u[0]-(v[0]-h[0])/6)} ${t(u[1]-(v[1]-h[1])/6)} ${t(u[0])} ${t(u[1])}`}return e}d(A,"smooth");function bt(l,e,i,p,h,u){const v=[],z=Math.round(7+p/30);for(let c=0;c<z;c++){const k=l()-.5,$=Math.pow(Math.max(0,1-4*k*k),.6),o=h*(.22+l()*.3)*(.45+.55*$);v.push([e+k*p,i-o*.6-l()*$*h*.75,o])}v.sort((c,k)=>c[1]-k[1]);let m=u[0]-e,b=u[1]-(i-h/2);const L=Math.hypot(m,b)||1;m=m/L*.6,b=b/L*.6-.5;const j=d((c,k,$,o,w,M)=>`<ellipse cx="${t(c)}" cy="${t(k)}" rx="${t($)}" ry="${t(o)}" style="fill: var(--${w})"${M?` opacity="${M}"`:""}/>`,"e"),g=[],f=[];for(const[c,k,$]of v)g.push(j(c,k+$*.3,$,$*.85,"cloud-shade"));for(const[c,k,$]of v)g.push(j(c,k-$*.08,$*.94,$*.82,"cloud"));g.push(j(e,i-h*.02,p*.5,h*.1,"cloud-shade","0.45"));for(const[c,k,$]of v)k<i-h*.25&&f.push(j(c+m*$*.4,k+b*$*.4,$*.75,$*.62,"cloud-hi"));return{body:g.join(`
48
+ `),light:f.join(`
49
+ `)}}d(bt,"cumulus");function xt(){const l=J(23),e=600,i=[1080,210],p=[[330,300,560,150],[770,150,380,100],[1680,250,480,130],[1440,430,240,60],[250,545,480,44]].map(([r,a,s,n])=>bt(l,r,a,s,n,i)),h=Array.from({length:6},()=>{const r=l()*1700,a=40+l()*130,s=300+l()*420;return`<path d="M${t(r)} ${t(a)} Q${t(r+s/2)} ${t(a-20-l()*30)} ${t(r+s)} ${t(a+(l()-.5)*30)}" fill="none" style="stroke: var(--cirrus)" stroke-width="${t(3+l()*7)}"/>`}).join(`
50
+ `),u=d((r,a,s)=>{const n=[];for(let y=-40;y<=a;y+=40)n.push([y,e-r*Math.pow(Math.sin(Math.PI*(y+40)/(a+40)),.8)*(.8+.2*Math.sin(y/53+s))]);return`M-40 ${e+1} L${A(n)} L${a} ${e+1} Z`},"hills"),v=[[1150,e+1],[1172,588],[1212,569]];for(let r=1260;r<=x+40;r+=60)v.push([r,561-(r-1260)*.014+(l()-.5)*6]);const z=`M${A(v)} L${x+40} ${e+1} Z`,m=[[1236,694],[1240,662],[1236,641],[1242,613],[1249,597],[1262,588],[1274,592],[1280,610],[1284,641],[1281,668],[1287,694]],b="M"+m.map(([r,a])=>`${r} ${a}`).join(" L")+" Z",L="M"+m.slice(0,6).map(([r,a])=>`${r} ${a}`).join(" L")+" L1258 640 L1255 694 Z",j=[[1388,653],[1396,640],[1404,622],[1411,604],[1424,588],[1446,574]],g=[];for(let r=1490;r<=x+40;r+=50)g.push([r,568-(r-1490)*.05+(l()-.5)*6]);const f=`M${j.map(([r,a])=>`${r} ${a}`).join(" L")} L${A(g)} L${x+40} 653 Z`,c=`M${j.map(([r,a])=>`${r} ${a}`).join(" L")} L1490 568 L1452 600 L1440 653 Z`,k=`M1440 575 L${A(g.map(([r,a])=>[r,a-2]))} L${x+40} ${t(g[g.length-1][1]+8)} L${A(g.slice().reverse().map(([r,a])=>[r,a+7]))} Z`,$=d(r=>1470+Math.pow((1100-r)/400,1.5)*200,"faceAt"),o=d(r=>700-(r-1670)*.12,"topAt"),w=[];for(let r=1100;r>=700;r-=12)w.push([$(r)+5*Math.sin(r/17)+3*Math.sin(r/5.3)+(l()-.5)*5+(l()<.08?-10:0),r]);const M=[];for(let r=1690;r<=x+40;r+=30)M.push([r,o(r)+(l()-.5)*6]);const W=`M${w.map(([r,a])=>`${t(r)} ${t(a)}`).join(" L")} L${A(M)} L${x+40} 1100 Z`,D=`M${w.map(([r,a])=>`${t(r)} ${t(a)}`).join(" L")} `+w.slice().reverse().map(([r,a])=>`L${t(r+30+22*Math.sin(a/41)+10)} ${t(a)}`).join(" ")+" Z";let G="",P="";for(let r=740;r<1090;r+=34+l()*40){let a="",s="";const n=$(r)+8;for(let y=n;y<x+40;y+=34){const Z=r-(y-n)*.07+5*Math.sin(y/47+r)+(l()-.5)*5;a+=`${y===n?"M":" L"}${t(y)} ${t(Z)}`,s+=`${y===n?"M":" L"}${t(y)} ${t(Z+3)}`}G+=a+" ",P+=s+" "}let Q="",I="";for(let r=0;r<26;r++){let a=720+l()*340,s=$(a)+12+Math.pow(l(),.8)*(x-$(a));a<o(s)+14&&(a=o(s)+14);const n=3+Math.floor(l()*9);let y=`M${t(s)} ${t(a)}`,Z=`M${t(s-2.5)} ${t(a)}`;for(let H=0;H<n;H++){const B=-.45*Math.exp(-(s-$(a))/160);if(a+=12,s+=B*12+(l()-.5)*7,a>1100||s<$(a)+6)break;y+=` L${t(s)} ${t(a)}`,Z+=` L${t(s-2.5)} ${t(a)}`}Q+=y+" ",I+=Z+" "}const S=d(r=>`M${w.filter(([,a])=>a>=r).map(([a,s])=>`${t(a)} ${t(s)}`).join(" L")} L${x+40} 1100 L${x+40} ${r} Z`,"band"),U=`M${t(w[w.length-1][0]-9)} 699 L${A(M.map(([r,a])=>[r,a-3]))} L${x+40} ${t(M[M.length-1][1]+14)} L${A(M.slice().reverse().map(([r,a])=>[r,a+9+l()*6]))} L${t(w[w.length-1][0]+4)} 710 Z`,F=Array.from({length:22},()=>{const r=1690+l()*250;return`<ellipse cx="${t(r)}" cy="${t(o(r)+6+l()*4)}" rx="${t(8+l()*14)}" ry="${t(4+l()*4)}" style="fill: var(--grass-dark)"/>`}).join(`
51
+ `),Y=Array.from({length:7},()=>{const r=1040+l()*48,a=$(r)-34+l()*40,s=14+l()*22,n=8+l()*8;return`<ellipse cx="${t(a)}" cy="${t(r)}" rx="${t(s)}" ry="${t(n)}" style="fill: var(--cliff-2)"/>
52
+ <ellipse cx="${t(a-s*.25)}" cy="${t(r-n*.35)}" rx="${t(s*.6)}" ry="${t(n*.45)}" style="fill: var(--rock-hi)" opacity="0.35"/>`}).join(`
53
+ `);let N="";for(let r=940;r<1100;r+=6+l()*8){const a=$(r)-6-l()*60;N+=`M${t(a)} ${t(r)} h${t(-(10+l()*40))} `}const ct=Array.from({length:16},()=>{const r=980+l()*100;return`<ellipse cx="${t($(r)-10-l()*50)}" cy="${t(r)}" rx="${t(14+l()*40)}" ry="${t(2+l()*4)}" style="fill: var(--foam)"/>`}).join(`
54
+ `),X={far:"",mid:"",near:""},q={far:"",mid:"",near:""};for(let r=e+5;r<1080;){const a=(r-e)/480,s=r<700?"far":r<850?"mid":"near";for(let n=-40+l()*80;n<x+40;){const y=12+l()*80*(.35+a);X[s]+=`M${t(n)} ${t(r)} h${t(y)} `,l()<.6&&(q[s]+=`M${t(n+y*.3)} ${t(r+2+4*a)} h${t(y*.8)} `),n+=y+18+l()*150}r+=4+a*26+l()*5}const ht=Array.from({length:120},()=>{const r=e+4+Math.pow(l(),1.5)*470,a=20+(r-e)*.5;return`<ellipse cx="${t(i[0]+(l()+l()+l()-1.5)*a)}" cy="${t(r)}" rx="${t(3+l()*30*(.25+(r-e)/420))}" ry="${t(.7+(r-e)/340)}" style="fill: var(--sheen)"/>`}).join(`
55
+ `),V=d(r=>896+204*Math.pow(Math.max(0,r+40)/1020,1.6),"beachY"),C=d((r,a,s,n=20)=>{const y=[];for(let Z=r;Z<=a;Z+=n)y.push([Z,s(Z)]);return y},"span"),_=d(r=>36+34*((r+40)/1020),"wetW"),rt=d(r=>Math.max(4,12+9*Math.sin(r/37+1)+5*Math.sin(r/13)),"washW"),at=C(-40,1e3,V),$t=`M${A(C(-40,1080,r=>V(r)-120+18*Math.sin(r/90)))} L${A(C(-40,1080,r=>V(r)+6).reverse())} Z`,et=[0,1,2].map(r=>{let a="",s="";for(let n=-40+l()*30;n<1060;){const y=30+l()*90,Z=l()*6,H=C(n,Math.min(n+y,1060),B=>V(B)-(22+r*36)*((V(B)-e)/330)+4*Math.sin(B/29+Z)+2*Math.sin(B/7+Z),8);H.length>1&&(a+="M"+H.map(([B,tt])=>`${t(B)} ${t(tt)}`).join(" L")+" ",s+="M"+H.map(([B,tt])=>`${t(B)} ${t(tt-6)}`).join(" L")+" "),n+=y+30+l()*110}return{d:a,lip:s,w:t(4-r*1.2),o:t(.8-r*.25)}}),yt=Array.from({length:40},()=>{const r=-40+l()*1060,a=V(r)-l()*70*((V(r)-e)/330);return`<ellipse cx="${t(r)}" cy="${t(a)}" rx="${t(10+l()*34)}" ry="${t(2+l()*4)}" style="fill: var(--foam)"/>`}).join(`
56
+ `),dt=`M${A(at)} L1000 1100 L-40 1100 Z`,pt=`M${A(C(-40,1e3,r=>V(r)+_(r)))} L1000 1100 L-40 1100 Z`,ut=`M${A(at)} L${A(C(-40,1e3,r=>V(r)+rt(r)).reverse())} Z`,wt=`M${A(C(-40,1e3,r=>V(r)+rt(r)))}`;let ot="";for(let r=-40;r<1e3;){const a=60+l()*200,s=C(r,Math.min(r+a,1e3),V,10);s.length>1&&(ot+="M"+s.map(([n,y])=>`${t(n)} ${t(y)}`).join(" L")+" "),r+=a+6+l()*24}let st="";for(let r=0;r<900;r++){const a=-40+l()*960,s=V(a)+_(a)+6;if(s>1076)continue;const n=1.1+l()*1.4;st+=`M${t(a)} ${t(s+l()*(1080-s))} h${t(n)} v${t(n)} h${t(-n)} Z `}const gt=Array.from({length:16},()=>{const r=l()*880;return`<ellipse cx="${t(r)}" cy="${t(V(r)+10+l()*(_(r)-12))}" rx="${t(1.5+l()*2.5)}" ry="${t(1+l()*1.4)}" style="fill: var(--rock)" opacity="0.45"/>`}).join(`
57
+ `);let it="",ft="";for(let r=0;r<70;r++){const a=-40+Math.pow(l(),1.3)*330,s=(90+l()*130)*(1-(a+40)/520),n=(l()-.35)*s*.6,y=3+l()*3,Z=`M${t(a)} 1100 Q${t(a+n*.2)} ${t(1100-s*.6)} ${t(a+n)} ${t(1090-s)} Q${t(a+y+n*.25)} ${t(1100-s*.55)} ${t(a+y)} 1100 Z `;l()<.5?it+=Z:ft+=Z}return{palettes:{light:{"sky-0":"#2a6cc0","sky-1":"#6fa6de","sky-2":"#d3e9f6",glow:"#ffffff","glow-o":"0.7",orb:"#fffbea","orb-o":"0.95",stars:"0","cloud-hi":"#ffffff",cloud:"#eef3f9","cloud-shade":"#b2c3d6","cloud-o":"1",cirrus:"#ffffff","cirrus-o":"0.45","far-2":"#b3cbdb",far:"#97b4c6","head-3":"#a9bfcd","head-2":"#a3a597","head-2-base":"#7b8682","head-2-lit":"#cbc3a9","grass-2":"#88a27a","sea-0":"#86c8de","sea-1":"#2f8bbd","sea-2":"#0d4c82",haze:"#e4f3fa",sheen:"#ffffff","glit-o":"0.8","rip-o":"0.32","trough-o":"0.22",shallow:"#4fd0c4","shallow-o":"0.5",wash:"#e3f6f4","cliff-0":"#d8c3a0","cliff-1":"#a88d6c","cliff-2":"#5f4c3b",rock:"#4b3d31","rock-hi":"#f6ead2",grass:"#6f9b4b","grass-dark":"#46702f",foam:"#ffffff",sand:"#eedbb3","sand-wet":"#c6ae84",grain:"#b39668",dune:"#8a9450","dune-dark":"#5b6430"},dark:{"sky-0":"#020814","sky-1":"#0a1b31","sky-2":"#1d3c5e",glow:"#6c8dc4","glow-o":"0.35",orb:"#f3f5fa","orb-o":"1",stars:"0.8","cloud-hi":"#6e88aa",cloud:"#3d5677","cloud-shade":"#1a2b42","cloud-o":"0.8",cirrus:"#5a759a","cirrus-o":"0.3","far-2":"#1a3049",far:"#13253a","head-3":"#1b3047","head-2":"#18232f","head-2-base":"#0c141d","head-2-lit":"#2a3646","grass-2":"#152320","sea-0":"#24496d","sea-1":"#10294a","sea-2":"#030b16",haze:"#2a4a70",sheen:"#e0eaff","glit-o":"0.9","rip-o":"0.22","trough-o":"0.3",shallow:"#1d5462","shallow-o":"0.35",wash:"#4a6a8a","cliff-0":"#46505d","cliff-1":"#2a323d","cliff-2":"#10151b",rock:"#080b0f","rock-hi":"#6d7a8b",grass:"#1c3027","grass-dark":"#0f1c16",foam:"#a3b6cf",sand:"#3c404c","sand-wet":"#2a2f3c",grain:"#24272f",dune:"#222d24","dune-dark":"#131a15"}},svg:O("0.65 0.5")+K(E("w-sky",[[0,"sky-0"],[.6,"sky-1"],[1,"sky-2"]])+E("w-sea",[[0,"sea-0"],[.35,"sea-1"],[1,"sea-2"]])+E("w-head2",[[0,"head-2"],[1,"head-2-base"]])+kt("w-cliff",[[0,"cliff-0"],[.45,"cliff-1"],[1,"cliff-1"]]))+`
58
+ <rect width="1920" height="${e}" fill="url(#w-sky)"/>
59
+ <path d="${T(l,160,520)}" style="fill: var(--sheen)" opacity="var(--stars)"/>
60
+ <g filter="url(#w-blur-l)" opacity="var(--glow-o)">
61
+ <ellipse cx="${i[0]}" cy="${i[1]}" rx="380" ry="260" style="fill: var(--glow)"/>
62
+ </g>
63
+ <ellipse cx="${i[0]}" cy="${i[1]}" rx="34" ry="34" style="fill: var(--orb)" opacity="var(--orb-o)"/>
64
+ <g filter="url(#w-blur-r)" opacity="var(--cirrus-o)">
65
+ ${h}
66
+ </g>
67
+ <g filter="url(#w-blur-r)" opacity="var(--cloud-o)">
68
+ ${p.map(r=>r.body).join(`
69
+ `)}
70
+ </g>
71
+ <g filter="url(#w-blur-c)" opacity="var(--cloud-o)">
72
+ ${p.map(r=>r.light).join(`
73
+ `)}
74
+ </g>
75
+ <g filter="url(#w-blur-s)">
76
+ <path d="${u(34,900,1)}" style="fill: var(--far-2)"/>
77
+ <path d="${u(22,560,4)}" style="fill: var(--far)"/>
78
+ <path d="${z}" style="fill: var(--head-3)"/>
79
+ </g>
80
+ <rect y="${e}" width="1920" height="${1080-e}" fill="url(#w-sea)"/>
81
+ <g filter="url(#w-blur-m)" opacity="0.65">
82
+ <ellipse cx="960" cy="${e}" rx="1300" ry="14" style="fill: var(--haze)"/>
83
+ </g>
84
+ <g filter="url(#w-blur-s)" opacity="var(--trough-o)">
85
+ <path d="${q.far}" fill="none" style="stroke: var(--sea-2)" stroke-width="1.2"/>
86
+ <path d="${q.mid}" fill="none" style="stroke: var(--sea-2)" stroke-width="2"/>
87
+ <path d="${q.near}" fill="none" style="stroke: var(--sea-2)" stroke-width="3"/>
88
+ </g>
89
+ <g filter="url(#w-blur-s)" opacity="var(--rip-o)">
90
+ <path d="${X.far}" fill="none" style="stroke: var(--sheen)" stroke-width="1.1"/>
91
+ <path d="${X.mid}" fill="none" style="stroke: var(--sheen)" stroke-width="1.8"/>
92
+ <path d="${X.near}" fill="none" style="stroke: var(--sheen)" stroke-width="2"/>
93
+ </g>
94
+ <g filter="url(#w-blur-s)" opacity="var(--glit-o)">
95
+ ${ht}
96
+ </g>
97
+ <g filter="url(#w-blur-f)" opacity="var(--shallow-o)">
98
+ <path d="${$t}" style="fill: var(--shallow)"/>
99
+ </g>
100
+ <g filter="url(#w-blur-r)" opacity="0.35">
101
+ ${et.map(r=>`<path d="${r.lip}" fill="none" style="stroke: var(--shallow)" stroke-width="7"/>`).join(`
102
+ `)}
103
+ </g>
104
+ <g filter="url(#w-blur-r)" opacity="0.5">
105
+ ${yt}
106
+ </g>
107
+ <g filter="url(#w-blur-s)">
108
+ ${et.map(r=>`<path d="${r.d}" fill="none" style="stroke: var(--foam)" stroke-width="${r.w}" opacity="${r.o}"/>`).join(`
109
+ `)}
110
+ </g>
111
+ <g filter="url(#w-blur-r)" opacity="0.3">
112
+ <rect x="1238" y="694" width="46" height="34" style="fill: var(--sea-2)"/>
113
+ </g>
114
+ <path d="${b}" style="fill: var(--cliff-1)"/>
115
+ <path d="${L}" style="fill: var(--cliff-0)" opacity="0.8"/>
116
+ <ellipse cx="1262" cy="590" rx="15" ry="4.5" style="fill: var(--grass)"/>
117
+ <g filter="url(#w-blur-s)" opacity="0.8">
118
+ <ellipse cx="1261" cy="694" rx="36" ry="4" fill="none" style="stroke: var(--foam)" stroke-width="2.5"/>
119
+ </g>
120
+ <path d="${f}" fill="url(#w-head2)"/>
121
+ <g filter="url(#w-blur-s)" opacity="0.6">
122
+ <path d="${c}" style="fill: var(--head-2-lit)"/>
123
+ </g>
124
+ <path d="${k}" style="fill: var(--grass-2)"/>
125
+ <g filter="url(#w-blur-f)" opacity="0.45">
126
+ <ellipse cx="1660" cy="650" rx="300" ry="12" style="fill: var(--haze)"/>
127
+ </g>
128
+ <g filter="url(#w-blur-s)" opacity="0.7">
129
+ <path d="M1384 653 L1640 653" fill="none" style="stroke: var(--foam)" stroke-width="2"/>
130
+ </g>
131
+ <path d="${W}" fill="url(#w-cliff)"/>
132
+ <g filter="url(#w-blur-s)" opacity="0.4">
133
+ <path d="${D}" style="fill: var(--rock-hi)"/>
134
+ </g>
135
+ <g filter="url(#w-blur-s)" opacity="0.3">
136
+ <path d="${P}" fill="none" style="stroke: var(--rock-hi)" stroke-width="2"/>
137
+ <path d="${I}" fill="none" style="stroke: var(--rock-hi)" stroke-width="1.2"/>
138
+ </g>
139
+ <g filter="url(#w-blur-s)" opacity="0.3">
140
+ <path d="${G}" fill="none" style="stroke: var(--rock)" stroke-width="2.5"/>
141
+ <path d="${Q}" fill="none" style="stroke: var(--rock)" stroke-width="2"/>
142
+ </g>
143
+ <g filter="url(#w-blur-s)">
144
+ <path d="${S(990)}" style="fill: var(--cliff-2)" opacity="0.25"/>
145
+ <path d="${S(1030)}" style="fill: var(--cliff-2)" opacity="0.3"/>
146
+ <path d="${S(1066)}" style="fill: var(--cliff-2)" opacity="0.35"/>
147
+ </g>
148
+ <path d="${U}" style="fill: var(--grass)"/>
149
+ ${F}
150
+ ${Y}
151
+ <g filter="url(#w-blur-s)" opacity="0.75">
152
+ <path d="${N}" fill="none" style="stroke: var(--foam)" stroke-width="2.5"/>
153
+ ${ct}
154
+ </g>
155
+ <path d="${dt}" style="fill: var(--sand-wet)"/>
156
+ <g filter="url(#w-blur-r)">
157
+ <path d="${pt}" style="fill: var(--sand)"/>
158
+ </g>
159
+ <path d="${st}" style="fill: var(--grain)" opacity="0.4"/>
160
+ ${gt}
161
+ <path d="${ut}" style="fill: var(--wash)" opacity="0.55"/>
162
+ <g filter="url(#w-blur-s)" opacity="0.9">
163
+ <path d="${wt}" fill="none" style="stroke: var(--foam)" stroke-width="1.6"/>
164
+ <path d="${ot}" fill="none" style="stroke: var(--foam)" stroke-width="5"/>
165
+ </g>
166
+ <path d="${ft}" style="fill: var(--dune-dark)"/>
167
+ <path d="${it}" style="fill: var(--dune)"/>
168
+ </svg>`}}d(xt,"coast");function Mt(){const l=J(37),i=[[560,40,.5],[640,50,.65],[730,60,.8],[830,70,1],[950,80,1.35]].map(([h,u,v],z)=>{const m=l()*6.28,b=l()*6.28,L=d(g=>h-u*(.6*Math.sin(g/x*Math.PI*(1.3+z*.3)+m)+.4*Math.sin(g/x*Math.PI*(3.1+z)+b)),"curve");let j=`M-40 1100 L-40 ${t(L(-40))}`;for(let g=-40;g<x+40;){const f=(10+l()*12)*v,c=(22+l()*30)*v;j+=` L${t(g+f/2)} ${t(L(g+f/2)-c)} L${t(g+f)} ${t(L(g+f)-c*(.2+l()*.25))}`,g+=f}return j+` L${x+40} 1100 Z`}),p=d((h,u)=>`<g filter="url(#w-blur-m)" opacity="var(--fog-o)">
169
+ <ellipse cx="${t(500+l()*900)}" cy="${h}" rx="1200" ry="${u}" style="fill: var(--fog)"/>
170
+ </g>`,"fog");return{palettes:{light:{"sky-0":"#b4d0d4","sky-1":"#f4efd8",glow:"#fff4d2",orb:"#fffdf2","orb-o":"0.85",stars:"0",h0:"#a6c1b3",h1:"#86a997",h2:"#5e8a75",h3:"#3d6b57",h4:"#234838",fog:"#f5f7f0","fog-o":"0.6"},dark:{"sky-0":"#030e0e","sky-1":"#11302b",glow:"#2e5e56",orb:"#e8f2ea","orb-o":"1",stars:"0.75",h0:"#183532",h1:"#122a27",h2:"#0d211e",h3:"#081715",h4:"#040d0c",fog:"#3d635d","fog-o":"0.32"}},svg:O("0.62 0.6")+K(E("w-sky",[[0,"sky-0"],[1,"sky-1"]]))+`
171
+ <rect width="1920" height="1080" fill="url(#w-sky)"/>
172
+ <path d="${T(l,200,520)}" style="fill: var(--orb)" opacity="var(--stars)"/>
173
+ <g filter="url(#w-blur-l)">
174
+ <ellipse cx="1200" cy="260" rx="520" ry="300" style="fill: var(--glow)" opacity="0.9"/>
175
+ </g>
176
+ <ellipse cx="1200" cy="250" rx="30" ry="30" style="fill: var(--orb)" opacity="var(--orb-o)"/>
177
+ <path d="${i[0]}" style="fill: var(--h0)"/>
178
+ ${p(600,50)}
179
+ <path d="${i[1]}" style="fill: var(--h1)"/>
180
+ ${p(690,55)}
181
+ <path d="${i[2]}" style="fill: var(--h2)"/>
182
+ ${p(790,60)}
183
+ <path d="${i[3]}" style="fill: var(--h3)"/>
184
+ ${p(900,55)}
185
+ <path d="${i[4]}" style="fill: var(--h4)"/>
186
+ </svg>`}}d(Mt,"forest");function Lt(){const l=J(53),e=900,i=d((o,w,M,W)=>{const D=[];for(let G=-30;G<x+30;){const P=M+l()*(W-M);D.push({x:G,w:P,top:e-(o+Math.pow(l(),1.5)*(w-o))}),G+=P+(l()<.3?4+l()*10:0)}return D},"rows"),p=i(180,420,50,120),h=i(120,330,60,140),u=i(70,260,70,170),v=d(o=>{let w=`M${t(o.x)} ${e} V${t(o.top)} H${t(o.x+o.w)} V${e} Z `;if(o.w>90&&l()<.5){const M=o.top-30-l()*40;w+=`M${t(o.x+o.w*.25)} ${t(o.top+1)} V${t(M)} H${t(o.x+o.w*.75)} V${t(o.top+1)} Z `,l()<.6&&(w+=`M${t(o.x+o.w/2-1.5)} ${t(M+1)} V${t(M-40-l()*60)} h3 V${t(M+1)} Z `)}else l()<.25&&(w+=`M${t(o.x+o.w/2-1.5)} ${t(o.top+1)} V${t(o.top-40-l()*60)} h3 V${t(o.top+1)} Z `);return w},"shape"),z=d(o=>o.map(w=>`M${t(w.x+w.w-Math.min(14,w.w*.14))} ${t(w.top)} H${t(w.x+w.w)} V${e} H${t(w.x+w.w-Math.min(14,w.w*.14))} Z`).join(" "),"rims");let m="",b="",L="",j="",g="",f="";const c=d((o,w)=>{const M=Math.floor((o.w-10)/12),W=Math.floor((e-o.top-16)/16);for(let D=0;D<W;D++)for(let G=0;G<M;G++){const P=o.x+7+G*12,Q=o.top+10+D*16,I=`M${t(P)} ${t(Q)} h6 v9 h-6 Z `;if(m+=I,l()<.3){const S=l()<.72;if(S?b+=I:L+=I,w&&l()<.6){const U=e+8+(e-Q)*.55;let F="";for(let Y=0;Y<2;Y++){const N=8+l()*10;F+=`M${t(P-4+(l()-.5)*8)} ${t(U+Y*7+l()*3)} h${t(N)} v2 h${t(-N)} Z `}S?j+=F:g+=F}}}if(w&&l()<.55)if(o.w>100&&l()<.5){const D=o.w*(.4+l()*.3);f+=`<rect x="${t(o.x+(o.w-D)/2)}" y="${t(o.top-16)}" width="${t(D)}" height="12" style="fill: var(--neon-${l()<.5?"a":"b"})"/>
187
+ `}else f+=`<rect x="${t(o.x+(l()<.5?-4:o.w-4))}" y="${t(o.top+30+l()*60)}" width="8" height="${t(50+l()*40)}" style="fill: var(--neon-${l()<.5?"a":"b"})"/>
188
+ `},"windows");h.forEach(o=>c(o,!1)),u.forEach(o=>c(o,!0));const k=u.map(o=>`M${t(o.x)} ${e+6} V${t(e+6+(e-o.top)*.55)} H${t(o.x+o.w)} V${e+6} Z`).join(" "),$=f.replace(/\n\s*$/,"");return{palettes:{light:{"sky-0":"#6f9fc0","sky-1":"#e6d5c3","sky-2":"#f6c08e",glow:"#ffcf96",sun:"#fff1d6","sun-o":"1",moon:"#efe9ff","moon-o":"0",stars:"0",b0:"#cdb7aa",haze:"#f3d6bd","haze-o":"0.6",b1:"#a08780",b2:"#5b4651",rim:"#e9b48a","rim-o":"0.55","rim-mo":"0.35",pane:"#f1d9c4","pane-o":"0.3","lit-a":"#ffd27a","lit-b":"#9fdcff","lit-o":"0","glow-o":"0","neon-a":"#ff4fa3","neon-b":"#43e0ff","neon-o":"0","water-0":"#c4a593","water-1":"#4c3a45","refl-o":"0.5"},dark:{"sky-0":"#06041a","sky-1":"#1b0f3b","sky-2":"#4b1f54",glow:"#a3387c",sun:"#ffffff","sun-o":"0",moon:"#efe9ff","moon-o":"0.9",stars:"0.4",b0:"#291f47",haze:"#5b2a67","haze-o":"0.4",b1:"#1a1535",b2:"#0d0b21",rim:"#6a3a7c","rim-o":"0.25","rim-mo":"0.15",pane:"#2a2750","pane-o":"0.55","lit-a":"#ffc35a","lit-b":"#6fe3ff","lit-o":"1","glow-o":"0.85","neon-a":"#ff4fa3","neon-b":"#43e0ff","neon-o":"1","water-0":"#22183f","water-1":"#060518","refl-o":"0.9"}},svg:O("0.5 0.7")+K(E("w-sky",[[0,"sky-0"],[.65,"sky-1"],[1,"sky-2"]])+E("w-water",[[0,"water-0"],[1,"water-1"]]))+`
189
+ <rect width="1920" height="${e}" fill="url(#w-sky)"/>
190
+ <path d="${T(l,90,420)}" style="fill: var(--moon)" opacity="var(--stars)"/>
191
+ <g filter="url(#w-blur-l)">
192
+ <ellipse cx="1240" cy="760" rx="1150" ry="250" style="fill: var(--glow)" opacity="0.9"/>
193
+ </g>
194
+ <ellipse cx="1180" cy="400" rx="46" ry="46" style="fill: var(--sun)" opacity="var(--sun-o)"/>
195
+ <g filter="url(#w-blur-f)" opacity="var(--moon-o)">
196
+ <ellipse cx="560" cy="150" rx="60" ry="60" style="fill: var(--glow)"/>
197
+ </g>
198
+ <ellipse cx="560" cy="150" rx="26" ry="26" style="fill: var(--moon)" opacity="var(--moon-o)"/>
199
+ <path d="${p.map(v).join("")}" style="fill: var(--b0)"/>
200
+ <g filter="url(#w-blur-m)" opacity="var(--haze-o)">
201
+ <rect x="-100" y="640" width="2120" height="180" style="fill: var(--haze)"/>
202
+ </g>
203
+ <path d="${h.map(v).join("")}" style="fill: var(--b1)"/>
204
+ <path d="${z(h)}" style="fill: var(--rim)" opacity="var(--rim-mo)"/>
205
+ <path d="${u.map(v).join("")}" style="fill: var(--b2)"/>
206
+ <path d="${z(u)}" style="fill: var(--rim)" opacity="var(--rim-o)"/>
207
+ <path d="${m}" style="fill: var(--pane)" opacity="var(--pane-o)"/>
208
+ <g filter="url(#w-blur-r)" opacity="var(--glow-o)">
209
+ <path d="${b}" style="fill: var(--lit-a)"/>
210
+ <path d="${L}" style="fill: var(--lit-b)"/>
211
+ ${$}
212
+ </g>
213
+ <path d="${b}" style="fill: var(--lit-a)" opacity="var(--lit-o)"/>
214
+ <path d="${L}" style="fill: var(--lit-b)" opacity="var(--lit-o)"/>
215
+ <g opacity="var(--neon-o)">
216
+ ${$}
217
+ </g>
218
+ <rect y="${e}" width="1920" height="${1080-e}" fill="url(#w-water)"/>
219
+ <rect y="${e}" width="1920" height="6" style="fill: var(--b2)"/>
220
+ <g filter="url(#w-blur-r)" opacity="var(--refl-o)">
221
+ <path d="${k}" style="fill: var(--b2)" opacity="0.55"/>
222
+ </g>
223
+ <g filter="url(#w-blur-s)" opacity="var(--lit-o)">
224
+ <path d="${j}" style="fill: var(--lit-a)" opacity="0.8"/>
225
+ <path d="${g}" style="fill: var(--lit-b)" opacity="0.8"/>
226
+ </g>
227
+ </svg>`}}d(Lt,"city");const Zt=[{id:"alpine",name:"Alpine lake",draw:mt},{id:"coast",name:"Coast",draw:xt},{id:"forest",name:"Forest",draw:Mt},{id:"city",name:"City",draw:Lt}];export{Zt as SCENES};
package/embed.css ADDED
@@ -0,0 +1,53 @@
1
+ /* The embed's layout around the player: the box, the parameter panel beside it
2
+ where there is room, and the author's diagnostics under both. Plain, as the
3
+ player's own stylesheet is: its look is designed with the website's. */
4
+
5
+ .og-embed {
6
+ --og-diagnostic-line: rgba(127, 127, 127, 0.35);
7
+ --og-diagnostic-warn: #b26a00;
8
+ display: grid;
9
+ grid-template-columns: minmax(0, 1fr);
10
+ gap: 8px;
11
+ }
12
+
13
+ .og-embed:has(> .og-embed-panel) {
14
+ grid-template-columns: minmax(0, 3fr) minmax(200px, 1fr);
15
+ }
16
+
17
+ .og-embed-box {
18
+ min-width: 0;
19
+ }
20
+
21
+ .og-embed-panel {
22
+ min-width: 0;
23
+ overflow: auto;
24
+ }
25
+
26
+ .og-diagnostics {
27
+ grid-column: 1 / -1;
28
+ margin: 0;
29
+ padding: 0;
30
+ list-style: none;
31
+ font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
32
+ }
33
+
34
+ .og-diagnostics[hidden] {
35
+ display: none;
36
+ }
37
+
38
+ .og-diagnostic {
39
+ padding: 4px 8px;
40
+ border-left: 3px solid var(--og-diagnostic-line);
41
+ overflow-wrap: anywhere;
42
+ }
43
+
44
+ .og-diagnostic[data-kind="stopped"],
45
+ .og-diagnostic[data-kind="files"] {
46
+ border-left-color: var(--og-diagnostic-warn);
47
+ }
48
+
49
+ @media (max-width: 640px) {
50
+ .og-embed:has(> .og-embed-panel) {
51
+ grid-template-columns: minmax(0, 1fr);
52
+ }
53
+ }
package/embed.js ADDED
@@ -0,0 +1,6 @@
1
+ /*! Overglaze web engine. Licensed under the PolyForm Noncommercial License 1.0.0
2
+ * <https://polyformproject.org/licenses/noncommercial/1.0.0>
3
+ * Required Notice: Copyright (c) 2026 Svetlozar Kostadinov
4
+ * With an added permission to run it to develop and preview Overglaze plugins: see LICENSE in @overglaze/web
5
+ */
6
+ var B=Object.defineProperty;var n=(e,t)=>B(e,"name",{value:t,configurable:!0});import{Player as O}from"./player/player.js";import{ParamPanel as M}from"./player/panel.js";import{describe as N}from"./engine/descriptor.js";const R=new URL(".",import.meta.url).href,_="overglaze-embed",E="plugins",U=128,x=16,v=3e3,D={trace:"debug",debug:"debug",info:"info",log:"log",warn:"warn",error:"error"},C={unsupported:"This browser cannot run the plugin here",load:"The plugin failed to load",crash:"The plugin kept failing and was stopped",hang:"The plugin stopped responding and was stopped",lost:"The GPU device was lost",error:"The engine failed to start",cancelled:"The load was cancelled",missing:"There is no plugin here"},G={fallback:"A CPU adapter stands in for the GPU: the frames are right, their rate is not",features:"The GPU lacks what the cooked textures need, so they show as the fallback",slow:"The frame rate stays low here"},j={keys:n(()=>"The plugin listens for keys: they reach it here, and the Linux desktop delivers none","keys"),"import-meta":n(e=>e+" is read: here it is a data: URL, on the desktop the file's own","import-meta"),network:n(e=>e+" was loaded from the network: a module imported by URL, which the desktop refuses","network"),shader:n(e=>"The desktop's shader compiler refuses a shader, so it fails here too: "+e,"shader")},A=new WeakMap;let K=0;function y(e,t){const r=document.createElement(e);return t&&(r.className=t),r}n(y,"el");function W(){for(const e of["player/player.css","player/panel.css","embed.css"]){const t=new URL(e,R).href;if([...document.querySelectorAll("link[rel=stylesheet]")].some(o=>o.href===t))continue;const r=document.createElement("link");r.rel="stylesheet",r.href=t,document.head.append(r)}}n(W,"styles");function q(e){let t=String(e);for(;t.startsWith("./");)t=t.slice(2);return!t||t.startsWith("/")||t.includes("\\")||t.includes(":")?null:t.split("/").every(r=>r!==""&&r!=="."&&r!=="..")?t:null}n(q,"fileName");async function z(e){if(typeof e=="string")return new TextEncoder().encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e.slice(0));if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());if(e instanceof URL){const t=await fetch(e);if(!t.ok)throw new Error("HTTP "+t.status+" from "+e.href);return new Uint8Array(await t.arrayBuffer())}throw new Error("is neither text, bytes, a Blob nor a URL")}n(z,"fileBytes");async function H(e,t){const r=new Map;if(!e||typeof e!="object")return r;const o=e instanceof Map?[...e]:Object.entries(e);return await Promise.all(o.map(async([i,f])=>{const h=q(i);if(h===null){t("'"+i+"' is not a file name a plugin can hold, so it is left out");return}try{r.set(h,await z(f))}catch(u){t(h+" is left out: "+(u&&u.message?u.message:String(u)))}})),r}n(H,"gather");const V=n(()=>({read:n(()=>({local:null,params:null}),"read"),write(){}}),"memoryKeep");function S(e){return new Promise((t,r)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>r(e.error)})}n(S,"request");async function X(e){let t;try{const i=indexedDB.open(_,1);i.onupgradeneeded=()=>i.result.createObjectStore(E),t=await Promise.race([S(i),new Promise(f=>setTimeout(()=>f(null),v))])}catch{return null}if(!t)return null;const r=n(i=>t.transaction(E,i).objectStore(E),"store");let o;try{o=await S(r("readonly").get(e))||null}catch{return null}return{read:n(()=>({local:o&&o.local,params:o&&o.params}),"read"),write(i){try{i.local===null&&i.params===null?r("readwrite").delete(e):r("readwrite").put({local:i.local,params:i.params},e)}catch{}}}}n(X,"indexedKeep");class I{static{n(this,"Diagnostics")}constructor(t){this.root=t,this.lines=[],this.kinds=new Map,t.hidden=!0}add(t,r){if(this.lines.some(i=>i.text===r))return;const o=this.kinds.get(t)||{shown:0,over:0,overLine:null};if(this.kinds.set(t,o),o.shown>=x){o.over++;const i=o.over+" more like the line"+(x>1?"s":"")+" above, left out";o.overLine?(o.overLine.li.textContent=i,o.overLine.entry.text=i):o.overLine=this.#e(t,i);return}o.shown++,this.#e(t,r)}#e(t,r){const o={kind:t,text:r};this.lines.push(o);const i=y("li","og-diagnostic");return i.dataset.kind=t,i.textContent=r,this.root.append(i),this.root.hidden=!1,{li:i,entry:o}}}function Z(e,{files:t,entry:r,storage:o,panel:i=!1}={}){if(!(e instanceof Element))throw new TypeError("mount: the first argument must be an element");const f=A.get(e);f&&f.stop(),W(),e.classList.add("og-embed");const h=y("div","og-embed-box"),u=i?y("div","og-embed-panel"):null,b=y("ul","og-diagnostics");b.setAttribute("aria-live","polite"),e.replaceChildren(...[h,u,b].filter(Boolean));const c=new I(b);let p="loading",a=null,k=!1;const P={get state(){return p},get diagnostics(){return c.lines.map(l=>l.text)},pause:n(()=>a&&a.pause(),"pause"),resume:n(()=>a&&a.resume(),"resume"),fullscreen:n(()=>a&&a.fullscreen(),"fullscreen"),theme:n(l=>a&&a.setTheme(l),"theme"),compare:n(l=>a&&a.compare(l==null?null:Number(l)),"compare"),stop(){k=!0,p="stopped",a&&a.stop()}};A.set(e,P);const T=n(l=>{p="stopped",c.add("stopped",l)},"stopped");return(async()=>{const l=await H(t,s=>c.add("files",s)),w=N(l,{entry:r===void 0?void 0:String(r)});for(const s of w.notes)c.add("manifest",s);if(w.error){T("Nothing to run: "+w.error);return}const m=typeof o=="string"&&o&&o.length<=U?o:null;o!=null&&m===null&&c.add("storage","storage must be a name of 1 to "+U+" characters: nothing is kept");let L=V();if(m){const s=await X(m);s?L=s:c.add("storage","This page's origin keeps no storage, so the plugin's lasts as long as the page")}if(k)return;let g=null;u&&(g=new M(u,{write:n((s,d)=>a.session&&a.session.param(s,...d),"write"),reset:n(()=>a.session&&a.session.resetParams(),"reset")})),a=new O(h,{files:l,descriptor:w.descriptor,keep:L,folder:m||"embed-"+ ++K,desktops:new URL("desktops/",R).href,pictures:!1,desktop:"live",remember:m?"overglaze.desktop":null,persistParams:!0,on:{log:n((s,d)=>console[D[d]||"log"](s),"log"),stats:n(s=>{s.frames>0&&p==="loading"&&(p="live")},"stats"),held:n(()=>{p==="loading"&&(p="live")},"held"),desktop:n((s,d)=>{s!=="live"&&c.add("desktop","The live desktop failed, so a stand-in backdrop is shown in its place: "+d)},"desktop"),absent:n(s=>c.add("absent",s+" is not implemented by the web engine; the plugin touched it"),"absent"),gap:n((s,d)=>c.add(s,j[s](d)),"gap"),degraded:n((s,d)=>{s!=="unsupported"&&c.add("degraded",(G[s]||s)+(d?" ("+d+")":""))},"degraded"),stopped:n((s,d)=>{if(s==="stopped"){p="stopped";return}T((C[s]||"Stopped")+": "+d)},"stopped"),params:g?s=>g.model(s):void 0,paramValues:g?s=>g.values(s):void 0}}),!k&&await a.start()})().catch(l=>T("The engine failed to start: "+(l&&l.message?l.message:String(l)))),P}n(Z,"mount");export{Z as mount};
package/engine/core.js ADDED
@@ -0,0 +1,6 @@
1
+ /*! Overglaze web engine. Licensed under the PolyForm Noncommercial License 1.0.0
2
+ * <https://polyformproject.org/licenses/noncommercial/1.0.0>
3
+ * Required Notice: Copyright (c) 2026 Svetlozar Kostadinov
4
+ * With an added permission to run it to develop and preview Overglaze plugins: see LICENSE in @overglaze/web
5
+ */
6
+ var U=Object.defineProperty;var n=(o,r)=>U(o,"name",{value:r,configurable:!0});const e=globalThis,t=Object.freeze({gpu:e.navigator&&e.navigator.gpu,GPUBufferUsage:e.GPUBufferUsage,GPUColorWrite:e.GPUColorWrite,GPUMapMode:e.GPUMapMode,GPUShaderStage:e.GPUShaderStage,GPUTextureUsage:e.GPUTextureUsage,GPUQueue:e.GPUQueue,copyExternalImageToTexture:e.GPUQueue&&e.GPUQueue.prototype.copyExternalImageToTexture,createBuffer:e.GPUDevice&&e.GPUDevice.prototype.createBuffer,createShaderModule:e.GPUDevice&&e.GPUDevice.prototype.createShaderModule,GPUDevice:e.GPUDevice,createImageBitmap:e.createImageBitmap.bind(e),Blob:e.Blob,setTimeout:e.setTimeout.bind(e),clearTimeout:e.clearTimeout.bind(e),setInterval:e.setInterval.bind(e),clearInterval:e.clearInterval.bind(e),requestAnimationFrame:e.requestAnimationFrame?e.requestAnimationFrame.bind(e):null,cancelAnimationFrame:e.cancelAnimationFrame?e.cancelAnimationFrame.bind(e):null,Performance:e.Performance,performance:e.performance,performanceNow:e.performance.now.bind(e.performance),PerformanceObserver:e.PerformanceObserver,DOMException:e.DOMException,AbortController:e.AbortController,AbortSignal:e.AbortSignal,URL:e.URL,URLSearchParams:e.URLSearchParams,TextEncoder:e.TextEncoder,TextDecoder:e.TextDecoder,fetch:e.fetch.bind(e),postMessage:e.postMessage.bind(e),addEventListener:e.addEventListener.bind(e),console:e.console}),f={"ext:deno_webgpu/01_webgpu.js":n(()=>({initGPU(){},gpu:t.gpu,GPUBufferUsage:t.GPUBufferUsage,GPUColorWrite:t.GPUColorWrite,GPUMapMode:t.GPUMapMode,GPUShaderStage:t.GPUShaderStage,GPUTextureUsage:t.GPUTextureUsage,GPUQueue:t.GPUQueue}),"ext:deno_webgpu/01_webgpu.js"),"ext:deno_web/02_timers.js":n(()=>({setTimeout:t.setTimeout,clearTimeout:t.clearTimeout,setInterval:t.setInterval,clearInterval:t.clearInterval}),"ext:deno_web/02_timers.js"),"ext:deno_web/15_performance.js":n(()=>({setTimeOrigin(){},Performance:t.Performance,performance:t.performance}),"ext:deno_web/15_performance.js"),"ext:deno_web/01_dom_exception.js":n(()=>({DOMException:t.DOMException}),"ext:deno_web/01_dom_exception.js"),"ext:deno_web/03_abort_signal.js":n(()=>({AbortController:t.AbortController,AbortSignal:t.AbortSignal}),"ext:deno_web/03_abort_signal.js"),"ext:deno_web/00_url.js":n(()=>({URL:t.URL,URLSearchParams:t.URLSearchParams}),"ext:deno_web/00_url.js"),"ext:deno_web/08_text_encoding.js":n(()=>({TextEncoder:t.TextEncoder,TextDecoder:t.TextDecoder}),"ext:deno_web/08_text_encoding.js")},c=new Map;function d(o){const r=String(o);if(c.has(r))return c.get(r);const a=f[r];if(!a)throw new Error("web core: no answer for '"+r+"' (add it to EXT_SCRIPTS in core.js)");const i=Object.freeze(a());return c.set(r,i),i}n(d,"loadExtScript");function p(o){return()=>d(o)}n(p,"createLazyLoader");let u=Object.create(null),l=n(()=>{},"reportAbsent");const s=new Map;function S(o,r){u=o,l=r}n(S,"attachOps");function P(o){let r=s.get(o);if(!r){let a=!1;r=n(()=>{a||(a=!0,l(o))},"stub"),s.set(o,r)}return r}n(P,"absentOp");const b=new Proxy(Object.create(null),{get(o,r){if(typeof r!="string")return;const a=u[r];return typeof a=="function"?a:P(r)}}),m=new t.TextEncoder,g=new t.TextDecoder,x=n(o=>m.encode(String(o)),"encode"),G=n(o=>g.decode(o),"decode"),v={ops:b,encode:x,decode:G,loadExtScript:d,createLazyLoader:p};export{S as attachOps,v as core,t as natives};
@@ -0,0 +1,6 @@
1
+ /*! Overglaze web engine. Licensed under the PolyForm Noncommercial License 1.0.0
2
+ * <https://polyformproject.org/licenses/noncommercial/1.0.0>
3
+ * Required Notice: Copyright (c) 2026 Svetlozar Kostadinov
4
+ * With an added permission to run it to develop and preview Overglaze plugins: see LICENSE in @overglaze/web
5
+ */
6
+ var h=Object.defineProperty;var c=(a,o)=>h(a,"name",{value:o,configurable:!0});const s=[[0,0],[0,16],[4,12.5],[6.75,18.5],[9.25,17.5],[6.5,11.5],[11.5,11.5]],f=1.25,p=2,d=1,m=4,l=[16,24];async function g(a){const o=Math.min(16,Math.max(.25,a)),e=Math.ceil(m*o),n=document.createElement("canvas");n.width=Math.ceil(l[0]*o)+e,n.height=Math.ceil(l[1]*o)+e;const t=n.getContext("2d");t.translate(e,e),t.scale(o,o),t.beginPath(),t.moveTo(s[0][0],s[0][1]);for(const[i,r]of s.slice(1))t.lineTo(i,r);return t.closePath(),t.lineJoin="round",t.shadowColor="rgba(0, 0, 0, 0.35)",t.shadowBlur=p*o,t.shadowOffsetY=d*o,t.lineWidth=f*2,t.strokeStyle="#16161a",t.stroke(),t.shadowColor="transparent",t.fillStyle="#ffffff",t.fill(),{bitmap:await createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}),hot:[e,e]}}c(g,"cursorShape");export{g as cursorShape};
@@ -0,0 +1,6 @@
1
+ /*! Overglaze web engine. Licensed under the PolyForm Noncommercial License 1.0.0
2
+ * <https://polyformproject.org/licenses/noncommercial/1.0.0>
3
+ * Required Notice: Copyright (c) 2026 Svetlozar Kostadinov
4
+ * With an added permission to run it to develop and preview Overglaze plugins: see LICENSE in @overglaze/web
5
+ */
6
+ var rn=Object.defineProperty;var o=(n,e)=>rn(n,"name",{value:e,configurable:!0});const on="assets";const an=new Set(["alias","array","atomic","bool","break","case","const","continue","default","discard","else","enable","f16","f32","false","fn","for","i32","if","let","loop","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","override","ptr","return","sampler","sampler_comparison","struct","switch","texture_2d","texture_2d_array","texture_cube","true","u32","var","vec2","vec3","vec4","while"]),sn=5,cn=8,M=new Set(["desktopCapture"]),D=new Set(["opaque","transparent","warp"]),un=["index.ts","index.js"],U="index.wgsl",k={name:"overglaze-plugin-sketch",displayName:"Sketch",description:"",mode:"opaque",capabilities:["desktopCapture"]},R="0.2.0",ln=new TextDecoder("utf-8",{fatal:!0}),B=new TextEncoder;function fn(n,e){const t=B.encode(n),r=B.encode(e),i=Math.min(t.length,r.length);for(let a=0;a<i;a++)if(t[a]!==r[a])return t[a]-r[a];return t.length-r.length}o(fn,"byteOrder");function dn(n){return n.split("/").every(e=>e!==""&&e!=="node_modules"&&(!e.startsWith(".")||e===".cooked"))}o(dn,"packaged");function hn(n){let e=1469598103934665603n;for(const t of B.encode(n))e^=BigInt(t),e=e*0x100000001b3n&0xffffffffffffffffn;return e.toString(16).padStart(16,"0")}o(hn,"fnv1a64");function gn(n){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(n)&&!n.startsWith("__")&&n!=="_"&&!an.has(n)}o(gn,"isWgslIdentifier");const X=o(n=>n.replace(/[A-Z]/g,e=>e.toLowerCase()),"asciiLower");function mn(n){const e=n.lastIndexOf(".");return e<=0?n:n.slice(0,e)}o(mn,"stem");function Z(n){const e=n.lastIndexOf(".");return e<=0?"":n.slice(e+1)}o(Z,"extension");const pn=/[\t\n\v\f\r \u0085\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]/,N=o(n=>n!==void 0&&pn.test(n),"isWs");function f(n,e){for(;N(n[e]);)e++;return e}o(f,"skipWs");function T(n){let e=0,t=n.length;for(;e<t&&N(n[e]);)e++;for(;t>e&&N(n[t-1]);)t--;return n.slice(e,t)}o(T,"trimWs");const G=(1n<<64n)-1n,H=new Error("past u64"),c=null,x={start:null,end:null},l=o((n,e,t,r=[])=>({major:n,minor:e,patch:t,pre:r}),"ver"),K={start:{kind:"inc",v:l(0n,0n,0n)},end:{kind:"exc",v:l(0n,0n,0n)}};function $(n){const e=/^(\d+)\.(\d+)\.(\d+)$/.exec(n);return l(BigInt(e[1]),BigInt(e[2]),BigInt(e[3]))}o($,"release");const xn=$(R),vn=o(n=>n!==void 0&&n>="0"&&n<="9","isDigit"),kn=o(n=>n!==void 0&&/[-0-9A-Za-z]/.test(n),"isPart");function wn(n,e){let t=e;for(;vn(n[t]);)t++;if(t===e)return null;const r=BigInt(n.slice(e,t));if(r>G)throw H;return{end:t,v:r}}o(wn,"nr");function W(n,e){return n[e]==="x"||n[e]==="X"||n[e]==="*"?{end:e+1,v:c}:wn(n,e)}o(W,"xr");function q(n,e){const t=[];for(;e<n.length;){let r=e;for(;kn(n[r]);)r++;if(r===e||(t.push(n.slice(e,r)),e=r,n[e]!=="."))break;e++}return t.length?{end:e,v:t}:null}o(q,"parts");function jn(n,e){let t=[];const r=q(n,n[e]==="-"?e+1:e);if(r&&(t=r.v,e=r.end),n[e]==="+"){const i=q(n,e+1);i&&(e=i.end)}return{end:e,pre:t}}o(jn,"qualifier");function w(n,e){n[e]==="v"&&e++;const t=W(n,e);if(!t)return null;e=t.end;let r=c,i=c,a=[],s=!1,g=!1;if(n[e]==="."){const u=W(n,e+1);u&&(r=u.v,e=u.end,s=!0)}if(s&&n[e]==="."){const u=W(n,e+1);u&&(i=u.v,e=u.end,g=!0)}if(g){const u=jn(n,e);a=u.pre,e=u.end}return{end:e,v:{major:t.v,minor:r,patch:i,pre:a}}}o(w,"partial");function Y(n,e){for(const t of[">=","<=","<",">","="])if(n.startsWith(t,e))return{end:e+t.length,v:t};return null}o(Y,"primitiveKind");function J(n,e,t){const r=t.find(i=>n.startsWith(i,e));if(r===void 0)return null;for(e+=r.length;n[e]==="=";)e++;return e=f(n,e),n[e]==="v"&&e++,f(n,e)}o(J,"rawPrefix");function bn(n,e,t){const r=Y(n,e);if(r){const i=f(n,r.end);if(i>r.end){const a=J(n,i,t);if(a!==null)return a}}return J(n,e,t)}o(bn,"prefix");const b=o(n=>/^[0-9]+$/.test(n)&&BigInt(n)<=G,"isNum");function y(n,e){for(const t of["major","minor","patch"])if(n[t]!==e[t])return n[t]<e[t]?-1:1;if(!n.pre.length&&!e.pre.length)return 0;if(!e.pre.length)return-1;if(!n.pre.length)return 1;for(let t=0;;t++){const r=n.pre[t],i=e.pre[t];if(r===void 0&&i===void 0)return 0;if(r===void 0)return-1;if(i===void 0)return 1;if(b(r)&&b(i)){if(BigInt(r)!==BigInt(i))return BigInt(r)<BigInt(i)?-1:1}else{if(b(r))return-1;if(b(i))return 1;if(r!==i)return r<i?-1:1}}}o(y,"cmpVersion");function yn(n,e){if(!n)return e;if(!e)return n;const t=y(n.v,e.v);return t>0?n:t<0?e:n.kind==="exc"?n:e}o(yn,"clampStart");function P(n,e){if(!n)return e;if(!e)return n;const t=y(n.v,e.v);return t>0?e:t<0||n.kind==="exc"?n:e}o(P,"clampEnd");function Sn(n,e){const t=P(n.end,e.end);let r=yn(n.start,e.start);return r&&(r=P(r,t)),{start:r,end:t}}o(Sn,"clamp");const In=o(n=>n.end!==null&&n.end.kind==="exc"&&n.end.v.major===0n&&n.end.v.minor===0n&&n.end.v.patch===0n,"isNone");function Q(n,e){const t=n.start===null?1:y(e,n.start.v),r=n.end===null?-1:y(e,n.end.v);return(t>0||t===0&&n.start.kind==="inc")&&(r<0||r===0&&n.end.kind==="inc")}o(Q,"satisfies");const O=o(n=>n===c?0n:n,"or0"),E=o(n=>({kind:"inc",v:l(O(n.major),O(n.minor),O(n.patch),n.pre)}),"lowerBound");function _n(n){let e=0n,t=0n,r=0n,i="inc";return n.patch===c?(t+=1n,i="exc"):r=n.patch,n.minor===c?(t=0n,e+=1n,i="exc"):t+=n.minor,n.major===c?null:(e+=n.major,{kind:i,v:l(e,t,r,i==="inc"?n.pre:[])})}o(_n,"upperBound");function An(n){if(n.major===c)return x;const e=n.minor===c?l(n.major+1n,0n,0n):l(n.major,n.minor+1n,0n);return{start:E(n),end:{kind:"exc",v:e}}}o(An,"tildeRange");function Wn(n){if(n.major===c)return x;let e;return n.major>0n||n.minor===c?e=l(n.major+1n,0n,0n):n.minor>0n?e=l(0n,n.minor+1n,0n):n.patch===c?e=l(0n,1n,0n):e=l(0n,0n,n.patch+1n),{start:E(n),end:{kind:"exc",v:e}}}o(Wn,"caretRange");function On(n){if(n.major===c)return x;const e=l(n.major,0n,0n),t=l(n.major,0n,0n);n.patch===c?n.minor!==c&&(t.minor+=1n):(e.patch=n.patch,t.patch=n.patch),n.minor===c?t.major+=1n:(e.minor=n.minor,t.minor+=n.minor);const r=e.major===t.major&&e.minor===t.minor&&e.patch===t.patch;return{start:{kind:"inc",v:e},end:{kind:r?"inc":"exc",v:t}}}o(On,"greaterRange");function nn(n){if(n.major===c||n.minor===c||n.patch===c)return On(n);const e=l(n.major,n.minor,n.patch,n.pre);return{start:{kind:"inc",v:e},end:{kind:"inc",v:e}}}o(nn,"equalRange");function F(n,e){if(n.major===c)return e==="inc"?x:K;const t=l(n.major,0n,0n,e==="inc"?n.pre:[]);return n.minor===c?e==="exc"&&(e="inc",t.major+=1n):t.minor=n.minor,n.patch===c?e==="exc"&&(e="inc",t.minor+=1n):(t.patch=n.patch,n.pre.length&&e==="exc"&&(t.pre=n.pre)),{start:{kind:e,v:t},end:null}}o(F,"greaterThan");function V(n,e){if(n.major===c)return e==="inc"?x:K;const t=l(n.major,0n,0n);return n.minor===c?(e==="inc"&&(t.major+=1n),e="exc"):t.minor=n.minor,n.patch===c?(e==="inc"&&(t.minor+=1n),e="exc"):(t.patch=n.patch,n.pre.length&&e==="exc"&&(t.pre=n.pre)),e==="inc"&&(t.pre=n.pre),{start:{kind:"inc",v:l(0n,0n,0n)},end:{kind:e,v:t}}}o(V,"lessThan");const Bn={"=":nn,">":o(n=>F(n,"exc"),">"),">=":o(n=>F(n,"inc"),">="),"<":o(n=>V(n,"exc"),"<"),"<=":o(n=>V(n,"inc"),"<=")};function Nn(n,e){for(const[i,a]of[[["~>","~"],An],[["^"],Wn]]){const s=bn(n,e,i);if(s===null)continue;const g=w(n,s);if(g)return{end:g.end,v:a(g.v)}}const t=Y(n,e);if(t){const i=w(n,f(n,t.end));if(i)return{end:i.end,v:Bn[t.v](i.v)}}const r=w(n,e);return r?{end:r.end,v:nn(r.v)}:null}o(Nn,"simple");function Rn(n,e){const t=w(n,e);if(!t)return null;const r=f(n,t.end);if(r===t.end||n[r]!=="-")return null;const i=f(n,r+1);if(i===r+1)return null;const a=w(n,i);return a?{end:a.end,v:{start:E(t.v),end:_n(a.v)}}:null}o(Rn,"hyphen");function Tn(n,e){const t=Rn(n,e);if(t)return t;let r=x;for(;e<n.length;){const i=Nn(n,e);if(!i)break;r=Sn(r,i.v),e=i.end;const a=f(n,e);if(n.startsWith("&&",a))e=f(n,a+2);else if(n[a]===",")e=f(n,a+1);else if(a>e)e=a;else break}return{end:e,v:r}}o(Tn,"range");function En(n,e){try{const r=Tn(n,e),i=n.slice(r.end);if(i===""||i.slice(f(i,0)).startsWith("||"))return{end:r.end,range:r.v}}catch(r){if(r!==H)throw r}const t=n.indexOf("||",e);return{end:t<0?n.length:t,range:null}}o(En,"branch");function en(n){const e=[];let t=0;for(;t<n.length;){const r=En(n,t);e.push(r),t=r.end;const i=f(n,t);if(!n.startsWith("||",i))break;t=f(n,i+2)}return t!==n.length||e.length===1&&e[0].range===null?null:e.map(r=>r.range).filter(r=>r!==null&&!In(r))}o(en,"rangeSet");function zn(n){const e=typeof n=="string"?T(n):"";if(e==="")return"undeclared";const t=en(e);return t===null?"malformed":t.some(r=>Q(r,xn))?"compatible":"incompatible"}o(zn,"contractVerdict");function qn(n,e){const t=typeof n=="string"?T(n):"",r=t===""?null:en(t);return r===null?null:e.map(i=>r.some(a=>Q(a,$(i))))}o(qn,"rangeAdmits");function Jn(n){const e=JSON.stringify(String(n.engineRange||""));return n.contract==="incompatible"?"[plugins] "+n.package+" declares engines.overglaze "+e+", which excludes this host's plugin contract "+R+"; loading it anyway, but expect breakage":n.contract==="malformed"?"[plugins] "+n.package+" declares engines.overglaze "+e+", which is not a version range; treating the plugin as making no compatibility claim":null}o(Jn,"contractWarning");function Cn(n,e){let t;try{t=ln.decode(n)}catch{return e.push("package.json is not UTF-8: mode, capabilities and the entry take their defaults"),null}t.charCodeAt(0)===65279&&(t=t.slice(1));try{const r=JSON.parse(t);return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch(r){return e.push("package.json is not valid JSON ("+(r&&r.message?r.message:String(r))+"): mode, capabilities and the entry take their defaults"),null}}o(Cn,"readManifest");const p=o(n=>typeof n=="string"?n:void 0,"str"),Ln=o(n=>Array.isArray(n)?n.filter(e=>typeof e=="string"):[],"strings");function Mn(n,e){const t=on+"/",r=n.filter(s=>s.startsWith(t)&&!s.slice(t.length).includes("/")).map(s=>s.slice(t.length)).filter(s=>!s.startsWith(".")&&Z(s)!=="meta");if(!n.some(s=>s.startsWith(".cooked/")))return r.length&&e.push("assets/ holds files but there is no .cooked/, so nothing is auto-bound: the browser cooks nothing, and `npx overglaze pack` cooks them"),[];const i=new Set(n),a=[];for(const s of r){const g=".cooked/"+hn(X(t+s))+".tex";if(!i.has(g))continue;const u=mn(s);if(!gn(u)){e.push("assets/"+s+" is not auto-bound: '"+u+"' is not a name WGSL can bind");continue}a.push({name:u,path:"/plugin/"+t+s})}return a.length>8?(e.push("assets/ has "+a.length+" auto-bindable textures, more than 8, so none is bound"),[]):a}o(Mn,"autoBindings");function Dn(n,e,t){for(const r of n){if(!r.startsWith(".cooked/")||!r.endsWith(".tex"))continue;const i=e.get(r);if(!i||i.length<12||i[0]!==84||i[1]!==69||i[2]!==88||i[3]!==49){t.push(r+" is not a cooked texture");continue}const a=(i[8]|i[9]<<8|i[10]<<16|i[11]<<24)>>>0;if(a>=sn&&a<=cn)return["texture-compression-bc"]}return[]}o(Dn,"gpuFeatures");function Pn(n,{entry:e}={}){const t=[],r=[...n.keys()].filter(dn).sort(fn),i=new Set(r),a=i.has("package.json"),s=a?Cn(n.get("package.json"),t):null,g=o(()=>un.find(m=>i.has(m)),"probe"),u=o(m=>m.startsWith("./")?m.slice(2):m,"clean");let v=s?p(s.main):void 0,d=e!==void 0?String(e):v!==void 0?v:g();if(d===void 0&&!a&&i.has(U)&&(d=U),d===void 0)return{error:'no entry: give package.json a "main", name one with `entry`, or add an index.ts, index.js or (without a package.json) index.wgsl',notes:t};if(d=u(d),!i.has(d))return{error:"the entry '"+d+"' is not among the files",notes:t};e!==void 0&&v!==void 0&&u(v)!==d&&t.push("the entry '"+d+"' stands in for package.json's main '"+v+"'");let h;if(!a&&Z(d).toLowerCase()==="wgsl")h={...k,capabilities:k.capabilities.slice(),engineRange:""},t.push("no package.json: the manifest of the CLI's WGSL template ("+k.capabilities.join(", ")+", "+k.mode+")");else{const m=s&&s.overglaze&&typeof s.overglaze=="object"?s.overglaze:{},z=(s?p(s.name):void 0)??(a?"plugin":k.name),C=Ln(m.capabilities),L=C.filter(A=>!M.has(A));L.length&&t.push("unknown capabilities "+JSON.stringify(L)+" are ignored");const I=p(m.mode),j=I===void 0?void 0:X(T(I));j!==void 0&&!D.has(j)&&t.push("mode '"+I+"' is not one the host knows: opaque");const _=s?s.engines:void 0,tn=(_!==null&&typeof _=="object"?p(_.overglaze):void 0)??"";h={name:z,displayName:p(m.displayName)??z,description:s&&p(s.description)||"",mode:D.has(j)?j:"opaque",capabilities:[...new Set(C.filter(A=>M.has(A)))],engineRange:tn},a||t.push("no package.json: no capabilities, as for a folder the desktop mounts without one, so the plugin sees no desktop")}const S=zn(h.engineRange);return S==="incompatible"?t.push("engines.overglaze "+JSON.stringify(h.engineRange)+" excludes this engine's plugin contract "+R+": the plugin runs anyway, but expect breakage"):S==="malformed"&&t.push("engines.overglaze "+JSON.stringify(h.engineRange)+" is not a version range, so the plugin makes no claim about which contract it was written for"),{descriptor:{package:h.name,displayName:h.displayName,description:h.description,entry:d,mode:h.mode,capabilities:h.capabilities,engineRange:h.engineRange,contract:S,files:r,autoBindings:Mn(r,t),gpuFeatures:Dn(r,n,t),packageImports:{}},notes:t}}o(Pn,"describe");export{R as CONTRACT_VERSION,zn as contractVerdict,Jn as contractWarning,Pn as describe,hn as fnv1a64,qn as rangeAdmits};
@@ -0,0 +1,6 @@
1
+ /*! Overglaze web engine. Licensed under the PolyForm Noncommercial License 1.0.0
2
+ * <https://polyformproject.org/licenses/noncommercial/1.0.0>
3
+ * Required Notice: Copyright (c) 2026 Svetlozar Kostadinov
4
+ * With an added permission to run it to develop and preview Overglaze plugins: see LICENSE in @overglaze/web
5
+ */
6
+ var x=Object.defineProperty;var w=(i,r)=>x(i,"name",{value:r,configurable:!0});import{natives as a}from"./core.js";const A=16384,C=256*1024*1024;function M(i){if(!i.startsWith("/"))return"";let r="",e="";for(let t of i)t==="\\"&&(t="/"),!(t==="/"&&e==="/")&&(r+=t>="A"&&t<="Z"?t.toLowerCase():t,e=t);for(const t of r.split("/"))if(t==="..")return"";return r.includes(":")?"":r}w(M,"normalizeVfs");function T(i){const r=M(i);if(!r)return null;const e=r.slice(1),t=e.indexOf("/");return(t<0?e:e.slice(0,t))!=="plugin"?null:(t<0?"":e.slice(t+1)).split("/").filter(s=>s!==""&&s!==".").join("/")}w(T,"pluginSubpath");const _=w(i=>i.replace(/[A-Z]/g,r=>r.toLowerCase()),"ASCII_LOWER");class P{static{w(this,"PluginFiles")}#o=null;#e=null;#n=new Set;#t=new Map;#s=new Set([""]);#i;constructor(r,e,t){r instanceof Map?this.#e=r:this.#o=r,this.#i=t;for(const o of[...e].sort()){this.#n.add(o);const n=_(o);(!this.#t.has(n)||o===n)&&this.#t.set(n,o);const s=n.split("/");for(let c=1;c<s.length;c++)this.#s.add(s.slice(0,c).join("/"))}}locate(r){const e=this.#t.get(r);return e?{real:e}:this.#s.has(r)?{error:"read error"}:{error:"file not found"}}async read(r){const e=T(r);if(e===null)throw new Error("path did not resolve in VFS");const t=this.locate(e);if(t.error)throw new Error(t.error);return this.#r(t.real)}has(r){return this.#n.has(r)}async source(r){if(!this.has(r))throw new Error("file not found");return this.#r(r)}async raw(r){const e=this.locate(r);if(e.error)return null;try{return await this.#r(e.real)}catch{return null}}async#r(r){if(this.#e){const t=this.#e.get(r);if(!t)throw new Error("file not found");return t.slice()}let e;try{e=await a.fetch(this.#o+r.split("/").map(encodeURIComponent).join("/"))}catch{throw new Error("read error")}if(e.status===404)throw new Error("file not found");if(!e.ok)throw new Error("read error");return new Uint8Array(await e.arrayBuffer())}async decode(r){let e;try{e=await a.createImageBitmap(new a.Blob([r]),{premultiplyAlpha:"none",colorSpaceConversion:"none"})}catch(n){throw new Error("image decode failed: "+(n&&n.message?n.message:String(n)))}const{width:t,height:o}=e;if(t>A||o>A||t*o*4>C)throw e.close(),new Error("image decode failed: "+t+"x"+o+" exceeds the decode limits");try{return{width:t,height:o,rgba:await this.#a(e)}}finally{e.close()}}async#a(r){const e=this.#i,{width:t,height:o}=r,n=new Uint8Array(t*o*4),s=Math.min(e.limits.maxTextureDimension2D,4096),c=a.GPUTextureUsage;for(let l=0;l<o;l+=s)for(let u=0;u<t;u+=s){const f=Math.min(s,t-u),h=Math.min(s,o-l),p=e.createTexture({label:"overglaze.decode",size:[f,h],format:"rgba8unorm",usage:c.COPY_DST|c.COPY_SRC|c.RENDER_ATTACHMENT});a.copyExternalImageToTexture.call(e.queue,{source:r,origin:[u,l]},{texture:p,premultipliedAlpha:!1},[f,h]);const g=Math.ceil(f*4/256)*256,d=a.createBuffer.call(e,{label:"overglaze.decode",size:g*h,usage:a.GPUBufferUsage.MAP_READ|a.GPUBufferUsage.COPY_DST}),y=e.createCommandEncoder();y.copyTextureToBuffer({texture:p},{buffer:d,bytesPerRow:g},[f,h]),e.queue.submit([y.finish()]),await d.mapAsync(a.GPUMapMode.READ);const b=new Uint8Array(d.getMappedRange());for(let m=0;m<h;m++){const E=m*g;n.set(b.subarray(E,E+f*4),((l+m)*t+u)*4)}d.unmap(),d.destroy(),p.destroy()}return n}}export{P as PluginFiles,M as normalizeVfs,T as pluginSubpath};
@@ -0,0 +1,6 @@
1
+ /*! Overglaze web engine. Licensed under the PolyForm Noncommercial License 1.0.0
2
+ * <https://polyformproject.org/licenses/noncommercial/1.0.0>
3
+ * Required Notice: Copyright (c) 2026 Svetlozar Kostadinov
4
+ * With an added permission to run it to develop and preview Overglaze plugins: see LICENSE in @overglaze/web
5
+ */
6
+ var f=Object.defineProperty;var i=(t,r)=>f(t,"name",{value:r,configurable:!0});const l=["VideoFrame","GPUCanvasContext"],h={TEMPORARY:"a WebIDL constant (0) on Chrome's Worker scope prototype, which cannot be deleted",PERSISTENT:"a WebIDL constant (1) on Chrome's Worker scope prototype, which cannot be deleted"},d={Deno:"the desktop runtime's own namespace; a browser has none",__bootstrap:"deno_core's bootstrap namespace, which only that runtime installs",SharedArrayBuffer:"a browser exposes it only to a cross-origin-isolated page (COOP and COEP headers), which a plain static server does not make"},p="a namespace object in a browser, a class with static members in Deno; the members and their values are the same",m={GPUBufferUsage:p,GPUColorWrite:p,GPUMapMode:p,GPUShaderStage:p,GPUTextureUsage:p},b=[["URL","createObjectURL"],["URL","revokeObjectURL"]];function O(){for(const t of l)delete globalThis[t]}i(O,"removeShadowed");function w(t){const r=new Set(t);for(const e of Object.keys(h))r.add(e);const n=[],a=[];for(let e=globalThis;e&&e!==Object.prototype;e=Object.getPrototypeOf(e))a.push(e);for(const e of t){if(Object.hasOwn(globalThis,e))continue;const o=a.find(c=>Object.hasOwn(c,e));o&&Object.defineProperty(globalThis,e,Object.getOwnPropertyDescriptor(o,e))}for(const e of a)for(const o of Object.getOwnPropertyNames(e))r.has(o)||e!==globalThis&&o==="constructor"||delete e[o]||n.push(o);for(const[e,o]of b){const c=globalThis[e];c&&o in c&&!delete c[o]&&n.push(e+"."+o)}const s=[];for(const e of a.slice(1))for(const o of Object.getOwnPropertyNames(e))o==="constructor"||r.has(o)||Object.hasOwn(globalThis,o)||s.includes(o)||s.push(o);return{stuck:n,inherited:s}}i(w,"pruneGlobals");function g(t,r){const n=t.prototype.createBuffer;t.prototype.createBuffer=i(function(s){const e=s||{},o=e.usage;if(Number(o)&r.MAP_READ)throw new TypeError("MAP_READ buffers are unavailable to plugins that declare the desktopCapture capability");return n.call(this,{label:e.label,size:e.size,usage:o,mappedAtCreation:e.mappedAtCreation})},"createBuffer")}i(g,"denyReadback");export{m as DESCRIBED,l as HOST_SHADOWED,h as KEEP,d as LACKS,g as denyReadback,w as pruneGlobals,O as removeShadowed};
@@ -0,0 +1,6 @@
1
+ /*! Overglaze web engine. Licensed under the PolyForm Noncommercial License 1.0.0
2
+ * <https://polyformproject.org/licenses/noncommercial/1.0.0>
3
+ * Required Notice: Copyright (c) 2026 Svetlozar Kostadinov
4
+ * With an added permission to run it to develop and preview Overglaze plugins: see LICENSE in @overglaze/web
5
+ */
6
+ const e=["AbortController","AbortSignal","AggregateError","Array","ArrayBuffer","AsyncDisposableStack","Atomics","BigInt","BigInt64Array","BigUint64Array","Blob","Boolean","CustomEvent","DOMException","DataView","Date","Deno","DisposableStack","Error","EvalError","Event","EventTarget","FinalizationRegistry","Float16Array","Float32Array","Float64Array","Function","GPUBufferUsage","GPUCanvasContext","GPUColorWrite","GPUMapMode","GPUShaderStage","GPUTextureUsage","HTMLCanvasElement","HTMLImageElement","Headers","ImGui","Image","Infinity","Int16Array","Int32Array","Int8Array","Intl","Iterator","JSON","KeyboardEvent","Map","Math","MouseEvent","NaN","Number","Object","Performance","Promise","Proxy","RangeError","ReferenceError","Reflect","RegExp","Request","Response","Set","SharedArrayBuffer","String","SuppressedError","Symbol","SyntaxError","Temporal","TextDecoder","TextEncoder","TypeError","URIError","URL","URLSearchParams","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","VideoFrame","WeakMap","WeakRef","WeakSet","WebAssembly","WheelEvent","addEventListener","assets","cancelAnimationFrame","clearInterval","clearTimeout","console","createImageBitmap","decodeURI","decodeURIComponent","devicePixelRatio","dispatchEvent","document","encodeURI","encodeURIComponent","escape","eval","fetch","frame","globalThis","gpu","innerHeight","innerWidth","isFinite","isNaN","localStorage","navigator","overglaze","params","parseFloat","parseInt","performance","queueMicrotask","removeEventListener","requestAnimationFrame","self","sessionStorage","setInterval","setTimeout","undefined","unescape","window","__bootstrap","__device","__h","__ogAbortInit","__ogAutoPanel","__ogDispatchInput","__ogFlushAnimationFrames","__ogFrame","__ogImGuiStack","__ogInit","__ogPollCompositor","__ogPruneParams","__ogRunInit","__ogRunWasm","__ogRunWgsl","__ogSyncParams","__ogWgslModule","__w"];export{e as GOLDEN_GLOBALS};
@@ -0,0 +1,6 @@
1
+ /*! Overglaze web engine. Licensed under the PolyForm Noncommercial License 1.0.0
2
+ * <https://polyformproject.org/licenses/noncommercial/1.0.0>
3
+ * Required Notice: Copyright (c) 2026 Svetlozar Kostadinov
4
+ * With an added permission to run it to develop and preview Overglaze plugins: see LICENSE in @overglaze/web
5
+ */
6
+ var u=Object.defineProperty;var e=(a,_)=>u(a,"name",{value:_,configurable:!0});const o=Math.fround;const l=e(a=>a!==a?0:a<=-2147483648?-2147483648:a>=2147483647?2147483647:Math.trunc(a),"_i32");const i=e((a,_)=>a!=null&&a[_]!=null?+a[_]:0,"_at"),s={op_overglaze_imgui_beginchild:e(()=>!1,"op_overglaze_imgui_beginchild"),op_overglaze_imgui_endchild:e(()=>{},"op_overglaze_imgui_endchild"),op_overglaze_imgui_getwindowwidth:e(()=>0,"op_overglaze_imgui_getwindowwidth"),op_overglaze_imgui_getwindowheight:e(()=>0,"op_overglaze_imgui_getwindowheight"),op_overglaze_imgui_beginpopup:e(()=>!1,"op_overglaze_imgui_beginpopup"),op_overglaze_imgui_endpopup:e(()=>{},"op_overglaze_imgui_endpopup"),op_overglaze_imgui_openpopup:e(()=>{},"op_overglaze_imgui_openpopup"),op_overglaze_imgui_closecurrentpopup:e(()=>{},"op_overglaze_imgui_closecurrentpopup"),op_overglaze_imgui_ispopupopen:e(()=>!1,"op_overglaze_imgui_ispopupopen"),op_overglaze_imgui_beginpopupcontextitem:e(()=>!1,"op_overglaze_imgui_beginpopupcontextitem"),op_overglaze_imgui_separator:e(()=>{},"op_overglaze_imgui_separator"),op_overglaze_imgui_separatortext:e(()=>{},"op_overglaze_imgui_separatortext"),op_overglaze_imgui_sameline:e(()=>{},"op_overglaze_imgui_sameline"),op_overglaze_imgui_newline:e(()=>{},"op_overglaze_imgui_newline"),op_overglaze_imgui_spacing:e(()=>{},"op_overglaze_imgui_spacing"),op_overglaze_imgui_dummy:e(()=>{},"op_overglaze_imgui_dummy"),op_overglaze_imgui_indent:e(()=>{},"op_overglaze_imgui_indent"),op_overglaze_imgui_unindent:e(()=>{},"op_overglaze_imgui_unindent"),op_overglaze_imgui_begingroup:e(()=>{},"op_overglaze_imgui_begingroup"),op_overglaze_imgui_endgroup:e(()=>{},"op_overglaze_imgui_endgroup"),op_overglaze_imgui_setnextitemwidth:e(()=>{},"op_overglaze_imgui_setnextitemwidth"),op_overglaze_imgui_pushitemwidth:e(()=>{},"op_overglaze_imgui_pushitemwidth"),op_overglaze_imgui_popitemwidth:e(()=>{},"op_overglaze_imgui_popitemwidth"),op_overglaze_imgui_getframeheight:e(()=>0,"op_overglaze_imgui_getframeheight"),op_overglaze_imgui_getframeheightwithspacing:e(()=>0,"op_overglaze_imgui_getframeheightwithspacing"),op_overglaze_imgui_pushid:e(()=>{},"op_overglaze_imgui_pushid"),op_overglaze_imgui_popid:e(()=>{},"op_overglaze_imgui_popid"),op_overglaze_imgui_begintable:e(()=>!1,"op_overglaze_imgui_begintable"),op_overglaze_imgui_endtable:e(()=>{},"op_overglaze_imgui_endtable"),op_overglaze_imgui_tablenextrow:e(()=>{},"op_overglaze_imgui_tablenextrow"),op_overglaze_imgui_tablenextcolumn:e(()=>!1,"op_overglaze_imgui_tablenextcolumn"),op_overglaze_imgui_tablesetcolumnindex:e(()=>!1,"op_overglaze_imgui_tablesetcolumnindex"),op_overglaze_imgui_tablesetupcolumn:e(()=>{},"op_overglaze_imgui_tablesetupcolumn"),op_overglaze_imgui_tablesetupscrollfreeze:e(()=>{},"op_overglaze_imgui_tablesetupscrollfreeze"),op_overglaze_imgui_tableheadersrow:e(()=>{},"op_overglaze_imgui_tableheadersrow"),op_overglaze_imgui_begindisabled:e(()=>{},"op_overglaze_imgui_begindisabled"),op_overglaze_imgui_enddisabled:e(()=>{},"op_overglaze_imgui_enddisabled"),op_overglaze_imgui_textunformatted:e(()=>{},"op_overglaze_imgui_textunformatted"),op_overglaze_imgui_bullet:e(()=>{},"op_overglaze_imgui_bullet"),op_overglaze_imgui_button:e(()=>!1,"op_overglaze_imgui_button"),op_overglaze_imgui_smallbutton:e(()=>!1,"op_overglaze_imgui_smallbutton"),op_overglaze_imgui_invisiblebutton:e(()=>!1,"op_overglaze_imgui_invisiblebutton"),op_overglaze_imgui_checkbox:e((a,_)=>[0,_?1:0],"op_overglaze_imgui_checkbox"),op_overglaze_imgui_radiobutton:e(()=>!1,"op_overglaze_imgui_radiobutton"),op_overglaze_imgui_progressbar:e(()=>{},"op_overglaze_imgui_progressbar"),op_overglaze_imgui_selectable:e(()=>!1,"op_overglaze_imgui_selectable"),op_overglaze_imgui_beginlistbox:e(()=>!1,"op_overglaze_imgui_beginlistbox"),op_overglaze_imgui_endlistbox:e(()=>{},"op_overglaze_imgui_endlistbox"),op_overglaze_imgui_sliderfloat:e((a,_,g,r,m,p)=>[0,o(_)],"op_overglaze_imgui_sliderfloat"),op_overglaze_imgui_sliderfloat2:e((a,_,g,r,m,p)=>[0,o(i(_,0)),o(i(_,1))],"op_overglaze_imgui_sliderfloat2"),op_overglaze_imgui_sliderfloat3:e((a,_,g,r,m,p)=>[0,o(i(_,0)),o(i(_,1)),o(i(_,2))],"op_overglaze_imgui_sliderfloat3"),op_overglaze_imgui_sliderfloat4:e((a,_,g,r,m,p)=>[0,o(i(_,0)),o(i(_,1)),o(i(_,2)),o(i(_,3))],"op_overglaze_imgui_sliderfloat4"),op_overglaze_imgui_sliderint:e((a,_,g,r,m,p)=>[0,l(_)],"op_overglaze_imgui_sliderint"),op_overglaze_imgui_sliderint2:e((a,_,g,r,m,p)=>[0,l(i(_,0)),l(i(_,1))],"op_overglaze_imgui_sliderint2"),op_overglaze_imgui_sliderint3:e((a,_,g,r,m,p)=>[0,l(i(_,0)),l(i(_,1)),l(i(_,2))],"op_overglaze_imgui_sliderint3"),op_overglaze_imgui_sliderint4:e((a,_,g,r,m,p)=>[0,l(i(_,0)),l(i(_,1)),l(i(_,2)),l(i(_,3))],"op_overglaze_imgui_sliderint4"),op_overglaze_imgui_sliderangle:e((a,_,g,r,m,p)=>[0,o(_)],"op_overglaze_imgui_sliderangle"),op_overglaze_imgui_dragfloat:e((a,_,g,r,m,p,t)=>[0,o(_)],"op_overglaze_imgui_dragfloat"),op_overglaze_imgui_dragfloat2:e((a,_,g,r,m,p,t)=>[0,o(i(_,0)),o(i(_,1))],"op_overglaze_imgui_dragfloat2"),op_overglaze_imgui_dragfloat3:e((a,_,g,r,m,p,t)=>[0,o(i(_,0)),o(i(_,1)),o(i(_,2))],"op_overglaze_imgui_dragfloat3"),op_overglaze_imgui_dragfloat4:e((a,_,g,r,m,p,t)=>[0,o(i(_,0)),o(i(_,1)),o(i(_,2)),o(i(_,3))],"op_overglaze_imgui_dragfloat4"),op_overglaze_imgui_dragint:e((a,_,g,r,m,p,t)=>[0,l(_)],"op_overglaze_imgui_dragint"),op_overglaze_imgui_dragint2:e((a,_,g,r,m,p,t)=>[0,l(i(_,0)),l(i(_,1))],"op_overglaze_imgui_dragint2"),op_overglaze_imgui_dragint3:e((a,_,g,r,m,p,t)=>[0,l(i(_,0)),l(i(_,1)),l(i(_,2))],"op_overglaze_imgui_dragint3"),op_overglaze_imgui_dragint4:e((a,_,g,r,m,p,t)=>[0,l(i(_,0)),l(i(_,1)),l(i(_,2)),l(i(_,3))],"op_overglaze_imgui_dragint4"),op_overglaze_imgui_coloredit3:e((a,_,g)=>[0,o(i(_,0)),o(i(_,1)),o(i(_,2))],"op_overglaze_imgui_coloredit3"),op_overglaze_imgui_coloredit4:e((a,_,g)=>[0,o(i(_,0)),o(i(_,1)),o(i(_,2)),o(i(_,3))],"op_overglaze_imgui_coloredit4"),op_overglaze_imgui_colorpicker3:e((a,_,g)=>[0,o(i(_,0)),o(i(_,1)),o(i(_,2))],"op_overglaze_imgui_colorpicker3"),op_overglaze_imgui_colorpicker4:e((a,_,g)=>[0,o(i(_,0)),o(i(_,1)),o(i(_,2)),o(i(_,3))],"op_overglaze_imgui_colorpicker4"),op_overglaze_imgui_treenode:e(()=>!1,"op_overglaze_imgui_treenode"),op_overglaze_imgui_treenodeex:e(()=>!1,"op_overglaze_imgui_treenodeex"),op_overglaze_imgui_treepop:e(()=>{},"op_overglaze_imgui_treepop"),op_overglaze_imgui_collapsingheader:e(()=>!1,"op_overglaze_imgui_collapsingheader"),op_overglaze_imgui_setnextitemopen:e(()=>{},"op_overglaze_imgui_setnextitemopen"),op_overglaze_imgui_begintooltip:e(()=>!1,"op_overglaze_imgui_begintooltip"),op_overglaze_imgui_endtooltip:e(()=>{},"op_overglaze_imgui_endtooltip"),op_overglaze_imgui_begintabbar:e(()=>!1,"op_overglaze_imgui_begintabbar"),op_overglaze_imgui_endtabbar:e(()=>{},"op_overglaze_imgui_endtabbar"),op_overglaze_imgui_begintabitem:e((a,_,g,r)=>[0,_?1:0],"op_overglaze_imgui_begintabitem"),op_overglaze_imgui_endtabitem:e(()=>{},"op_overglaze_imgui_endtabitem"),op_overglaze_imgui_isitemhovered:e(()=>!1,"op_overglaze_imgui_isitemhovered"),op_overglaze_imgui_isitemactive:e(()=>!1,"op_overglaze_imgui_isitemactive"),op_overglaze_imgui_isitemclicked:e(()=>!1,"op_overglaze_imgui_isitemclicked"),op_overglaze_imgui_gettime:e(()=>0,"op_overglaze_imgui_gettime")};export{s as IMGUI_OPS};
package/engine/keys.js ADDED
@@ -0,0 +1,6 @@
1
+ /*! Overglaze web engine. Licensed under the PolyForm Noncommercial License 1.0.0
2
+ * <https://polyformproject.org/licenses/noncommercial/1.0.0>
3
+ * Required Notice: Copyright (c) 2026 Svetlozar Kostadinov
4
+ * With an added permission to run it to develop and preview Overglaze plugins: see LICENSE in @overglaze/web
5
+ */
6
+ var l=Object.defineProperty;var o=(t,e)=>l(t,"name",{value:e,configurable:!0});const r=new Map([["Escape",["Escape",27,0]],["Enter",["Enter",13,0]],["NumpadEnter",["Enter",13,3]],["Tab",["Tab",9,0]],["Backspace",["Backspace",8,0]],["Insert",["Insert",45,0]],["Delete",["Delete",46,0]],["Home",["Home",36,0]],["End",["End",35,0]],["PageUp",["PageUp",33,0]],["PageDown",["PageDown",34,0]],["ArrowLeft",["ArrowLeft",37,0]],["ArrowUp",["ArrowUp",38,0]],["ArrowRight",["ArrowRight",39,0]],["ArrowDown",["ArrowDown",40,0]],["CapsLock",["CapsLock",20,0]],["NumLock",["NumLock",0,0]],["ScrollLock",["ScrollLock",0,0]],["PrintScreen",["PrintScreen",0,0]],["Pause",["Pause",0,0]],["ContextMenu",["ContextMenu",93,0]],["ShiftLeft",["Shift",16,1]],["ShiftRight",["Shift",16,2]],["ControlLeft",["Control",17,1]],["ControlRight",["Control",17,2]],["AltLeft",["Alt",18,1]],["AltRight",["Alt",18,2]],["MetaLeft",["Meta",91,1]],["MetaRight",["Meta",92,2]]]);for(let t=1;t<=24;t++)r.set("F"+t,["F"+t,111+t,0]);function i(t){const e=r.get(t.code);if(!e)return null;const[n,a,c]=e;return{type:t.type==="keyup"?"keyup":"keydown",key:n,code:t.code,keyCode:a,location:c,repeat:t.type==="keydown"&&t.repeat,ctrl:t.ctrlKey,shift:t.shiftKey,alt:t.altKey,meta:t.metaKey,timeStamp:t.timeStamp}}o(i,"keyEdge");export{i as keyEdge};
@@ -0,0 +1,6 @@
1
+ /*! Overglaze web engine. Licensed under the PolyForm Noncommercial License 1.0.0
2
+ * <https://polyformproject.org/licenses/noncommercial/1.0.0>
3
+ * Required Notice: Copyright (c) 2026 Svetlozar Kostadinov
4
+ * With an added permission to run it to develop and preview Overglaze plugins: see LICENSE in @overglaze/web
5
+ */
6
+ var k=Object.defineProperty;var c=(n,t)=>k(n,"name",{value:t,configurable:!0});const C=globalThis.WebAssembly.instantiate.bind(globalThis.WebAssembly),O=globalThis.URL,b=new TextEncoder,S=new TextDecoder,W=new TextDecoder("utf-8",{fatal:!0}),U="file:///plugin/";class A{static{c(this,"PluginJs")}#e;static async load(t){const{instance:i}=await C(t,{});return new A(i.exports)}constructor(t){this.#e=t}module(t,i){const s=this.#e;if(!s)throw new Error("plugin-js.wasm trapped on an earlier file");try{const r=this.#t(b.encode(t)),u=this.#t(b.encode(i)),g=s.og_module(r.ptr,r.len,u.ptr,u.len),h=JSON.parse(S.decode(new Uint8Array(s.memory.buffer,s.og_result(),g)));return s.og_free(r.ptr,r.len),s.og_free(u.ptr,u.len),h}catch(r){throw this.#e=null,new Error("plugin-js.wasm trapped on "+t+": "+(r&&r.message?r.message:String(r)))}}#t(t){const i=this.#e,s=i.og_alloc(t.length);return new Uint8Array(i.memory.buffer,s,t.length).set(t),{ptr:s,len:t.length}}}const _=/[%#'"`\\$\u0000-\u001f\u007f\u2028\u2029]/g,R=c(n=>n.charCodeAt(0)<128?"%"+n.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"):encodeURIComponent(n),"escapeChar");function F(n,t){return"data:"+t+","+n.replace(_,R)}c(F,"dataUrl");function v(n){return n.startsWith("npm:")?!0:!n.includes(":")&&!n.startsWith(".")&&!n.startsWith("/")}c(v,"isPackageImport");async function L({entry:n,js:t,has:i,read:s,packages:r={},lock:u=!1,url:g}){const h=new Map,m=[],x=[];async function y(e){const a=h.get(e);if(a)return a;if(m.includes(e))throw new Error("the imports "+[...m.slice(m.indexOf(e)),e].join(" -> ")+" form a cycle, which the web engine cannot load");m.push(e);let d;try{d=await s(e)}catch(l){throw new Error(e+": "+(l&&l.message?l.message:String(l)))}let w;try{w=W.decode(d)}catch{throw new Error(e+": not UTF-8")}const o=t.module(e,w);if(o.error)throw new Error(e+": "+o.error);if(o.kind==="wasm")throw new Error(e+": a .wasm module, which the web engine does not load as a module");Array.isArray(o.meta)&&o.meta.length&&x.push({path:e,reads:o.meta});let p="",f=0;for(const l of o.imports){const j=await T(l.specifier,e);p+=o.text.slice(f,l.start)+j,f=l.end}p+=o.text.slice(f);const E={url:g(p,o.kind==="json"?"application/json":"text/javascript",e),kind:o.kind};return m.pop(),h.set(e,E),E}c(y,"build");async function T(e,a){if(v(e)){if(Object.hasOwn(r,e))return r[e];throw u?new Error(a+": import '"+e+"' is an npm package, which the web engine does not resolve from a plugin's files"):new Error(a+": import '"+e+"' needs an npm dependency but the plugin has no deno.lock")}let d;try{d=new O(e,U+a)}catch{throw new Error(a+": '"+e+"' is not a URL")}if(d.protocol!=="file:")throw new Error(a+": '"+e+"' is not a local file, which the loader refuses");if(!d.href.startsWith(U))throw new Error(a+": '"+e+"' leaves the plugin, which the loader refuses");const w=decodeURIComponent(d.pathname.slice(8));if(!i(w))throw new Error(a+": '"+e+"' names "+w+", which does not exist");return(await y(w)).url}return c(T,"resolve"),{...await y(n),modules:h.size,meta:x}}c(L,"moduleGraph");export{A as PluginJs,F as dataUrl,v as isPackageImport,L as moduleGraph};
Binary file