Skip to content

Write HTML. Render video. Built for agents.

fix(registry): glass-shard-title renders when mounted, and 4 skipped blocks install again (#4423)

Miguel Ángel8dabc8af63fc
diff --git a/packages/cli/src/registry/validation.test.ts b/packages/cli/src/registry/validation.test.ts
index 28fcb9bd92..fe2c657ac8 100644
--- a/packages/cli/src/registry/validation.test.ts
+++ b/packages/cli/src/registry/validation.test.ts
@@ -1,3 +1,5 @@
+import { existsSync, readFileSync, readdirSync } from "node:fs";
+import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { validRegistryName, validRegistryManifest, validRegistryItem } from "./validation.js";
@@ -39,4 +41,21 @@ describe("registry manifest boundary", () => {
validRegistryManifest({ ...manifest, items: Array(10_001).fill(manifest.items[0]) }),
).toBe(false);
});
+ it("accepts every registry-item.json the repo publishes", () => {
+ const registry = join(import.meta.dirname, "../../../../registry");
+ const rejected = readdirSync(registry, { withFileTypes: true })
+ .filter((dir) => dir.isDirectory())
+ .flatMap((dir) =>
+ readdirSync(join(registry, dir.name)).map((name) => ({ dir: dir.name, name })),
+ )
+ .filter(({ dir, name }) => existsSync(join(registry, dir, name, "registry-item.json")))
+ .filter(({ dir, name }) => {
+ const item = JSON.parse(
+ readFileSync(join(registry, dir, name, "registry-item.json"), "utf8"),
+ );
+ return !validRegistryItem(item, name, item.type);
+ })
+ .map(({ dir, name }) => `${dir}/${name}`);
+ expect(rejected).toEqual([]);
+ });
});
diff --git a/registry/blocks/glass-shard-title/assets/glass-main.js b/registry/blocks/glass-shard-title/assets/glass-main.js
index 485851fc95..dbe9571c4f 100644
--- a/registry/blocks/glass-shard-title/assets/glass-main.js
+++ b/registry/blocks/glass-shard-title/assets/glass-main.js
@@ -3948,7 +3948,7 @@ void main() {
`))&&b<f&&A<_.byteLength;)C+=L,b+=L.length,A+=128,L+=String.fromCharCode.apply(null,new Uint16Array(_.subarray(A,A+128)));return-1<S?(p!==!1&&(_.pos+=b+S+1),C+L.slice(0,S)):!1},i=function(_){let f=/^#\?(\S+)/,p=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,A=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,S=/^\s*FORMAT=(\S+)\s*$/,b=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,C={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0},L,U;for((_.pos>=_.byteLength||!(L=r(_)))&&t(1,"no header found"),(U=L.match(f))||t(3,"bad initial token"),C.valid|=1,C.programtype=U[1],C.string+=L+`
`;L=r(_),L!==!1;){if(C.string+=L+`
`,L.charAt(0)==="#"){C.comments+=L+`
-`;continue}if((U=L.match(p))&&(C.gamma=parseFloat(U[1])),(U=L.match(A))&&(C.exposure=parseFloat(U[1])),(U=L.match(S))&&(C.valid|=2,C.format=U[1]),(U=L.match(b))&&(C.valid|=4,C.height=parseInt(U[1],10),C.width=parseInt(U[2],10)),C.valid&2&&C.valid&4)break}return C.valid&2||t(3,"missing format specifier"),C.valid&4||t(3,"missing image size specifier"),C},a=function(_,f,p){let A=f;if(A<8||A>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);A!==(_[2]<<8|_[3])&&t(3,"wrong scanline width");let S=new Uint8Array(4*f*p);S.length||t(4,"unable to allocate buffer space");let b=0,C=0,L=4*A,U=new Uint8Array(4),B=new Uint8Array(L),M=p;for(;M>0&&C<_.byteLength;){C+4>_.byteLength&&t(1),U[0]=_[C++],U[1]=_[C++],U[2]=_[C++],U[3]=_[C++],(U[0]!=2||U[1]!=2||(U[2]<<8|U[3])!=A)&&t(3,"bad rgbe scanline format");let y=0,R;for(;y<L&&C<_.byteLength;){R=_[C++];let W=R>128;if(W&&(R-=128),(R===0||y+R>L)&&t(3,"bad scanline data"),W){let k=_[C++];for(let ee=0;ee<R;ee++)B[y++]=k}else B.set(_.subarray(C,C+R),y),y+=R,C+=R}let q=A;for(let W=0;W<q;W++){let k=0;S[b]=B[W+k],k+=A,S[b+1]=B[W+k],k+=A,S[b+2]=B[W+k],k+=A,S[b+3]=B[W+k],b+=4}M--}return S},n=function(_,f,p,A){let S=_[f+3],b=Math.pow(2,S-128)/255;p[A+0]=_[f+0]*b,p[A+1]=_[f+1]*b,p[A+2]=_[f+2]*b,p[A+3]=1},s=function(_,f,p,A){let S=_[f+3],b=Math.pow(2,S-128)/255;p[A+0]=ba.toHalfFloat(Math.min(_[f+0]*b,65504)),p[A+1]=ba.toHalfFloat(Math.min(_[f+1]*b,65504)),p[A+2]=ba.toHalfFloat(Math.min(_[f+2]*b,65504)),p[A+3]=ba.toHalfFloat(1)},o=new Uint8Array(e);o.pos=0;let l=i(o),h=l.width,c=l.height,u=a(o.subarray(o.pos),h,c),d,m,x;switch(this.type){case Vt:x=u.length/4;let _=new Float32Array(x*4);for(let p=0;p<x;p++)n(u,p*4,_,p*4);d=_,m=Vt;break;case Qt:x=u.length/4;let f=new Uint16Array(x*4);for(let p=0;p<x;p++)s(u,p*4,f,p*4);d=f,m=Qt;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:h,height:c,data:d,header:l.string,gamma:l.gamma,exposure:l.exposure,type:m}}setDataType(e){return this.type=e,this}load(e,t,r,i){function a(n,s){switch(n.type){case Vt:case Qt:n.colorSpace=Br,n.minFilter=St,n.magFilter=St,n.generateMipmaps=!1,n.flipY=!0;break}t&&t(n,s)}return super.load(e,a,r,i)}};(async()=>{let e=window.__GST,t=e.st;if(window.__gstInstance&&window.__gstInstance.dispose)try{window.__gstInstance.dispose()}catch{}let r=document.getElementById("gst-canvas"),i=new Sg({canvas:r,alpha:!0,antialias:!0,preserveDrawingBuffer:!0});i.setSize(1920,1080,!1),i.setPixelRatio(1),i.setClearColor(657935,1),i.toneMapping=Qs;let a=42,n=5.2,s=.6,o=new mc,l=Math.max(60,n+Math.max(-e.vars.zDist,-e.vars.zOut,0)*1.15+e.vars.sideDist*1.5+12),h=new Nt(a,1920/1080,.1,l);h.position.set(0,0,n);let c=2*(n-s)*Math.tan(a*Math.PI/360),u=c*(1920/1080);o.add(new Eu(16777215,.6));let d=new Mu(16777215,7,0,Math.PI/4,.5,1);d.position.set(0,7.1,2),o.add(d);let m=new Su(13426175,4,0,1);m.position.set(0,-3,1),o.add(m);let x=await new Tg().loadAsync("assets/ferndale_studio_01_1k.hdr"),_=new Hs(i),f=_.fromEquirectangular(x);o.environment=f.texture,o.environmentRotation=new cr(0,.6,0),x.dispose(),_.dispose();let p=await new vu().loadAsync("assets/matcap-1.png");p.colorSpace=Pt,p.wrapS=p.wrapT=Ni;let A=1/.2;p.repeat.set(A,A),p.offset.set((1-A)*.5,(1-A)*.5);try{await Promise.all([document.fonts.load('600 100px "Geist"'),document.fonts.load('400 100px "Geist"')]),await document.fonts.ready}catch{}let S=4096,b=Math.round(S*(c/u)),C=document.createElement("canvas");C.width=S,C.height=b;let L=C.getContext("2d");{L.clearRect(0,0,S,b),L.textAlign="center",L.textBaseline="middle";let O=300;L.font=`600 ${O}px "Geist", ui-sans-serif, sans-serif`,L.letterSpacing=`${-.035*O}px`;let G=L.measureText(e.vars.headline).width,V=S*.7;G>V&&(O=Math.floor(O*V/G)),L.font=`600 ${O}px "Geist", ui-sans-serif, sans-serif`,L.letterSpacing=`${-.035*O}px`,L.fillStyle="#f4f4f8",L.fillText(e.vars.headline,S/2,b/2),e.fontPx=O}let U=new Wo(C);U.colorSpace=Pt,U.anisotropy=16;let B=document.createElement("canvas");B.width=1280,B.height=Math.round(1280*(c/u));let M=B.getContext("2d",{willReadFrequently:!0});{let O=B.width/S;M.clearRect(0,0,B.width,B.height),M.textAlign="center",M.textBaseline="middle",M.font=`600 ${e.fontPx*O}px "Geist", ui-sans-serif, sans-serif`,M.letterSpacing=`${-.035*e.fontPx*O}px`,M.fillStyle="#fff",M.strokeStyle="#fff",M.lineWidth=e.fontPx*O*.22,M.lineJoin="round",M.strokeText(e.vars.headline,B.width/2,B.height/2),M.fillText(e.vars.headline,B.width/2,B.height/2)}let y=M.getImageData(0,0,B.width,B.height).data,R=B.width,q=B.height;function W(O,G){if(!y)return!1;let V=Math.round((O/u+.5)*(R-1)),ue=Math.round((.5-G/c)*(q-1));return V<0||ue<0||V>=R||ue>=q?!1:y[(ue*R+V)*4+3]>24}{L.font=`600 ${e.fontPx}px "Geist", ui-sans-serif, sans-serif`,L.letterSpacing=`${-.035*e.fontPx}px`;let O=L.measureText(e.vars.headline);e.bandW=(O.width+e.fontPx*.2)/S*u,e.bandH=(O.actualBoundingBoxAscent+O.actualBoundingBoxDescent+e.fontPx*.34)/b*c}let k=11,ee=gstMulberry32(k),j=e.bandW/2,le=e.bandH/2,X=e.bandH*(.18+e.vars.padding*.85),ie=j+X,Se=le+X,Ge=gstMulberry32(k*511+3),ze=[];for(let O=2;O<=9;O++)ze.push({k:O,amp:(Ge()*2-1)/Math.sqrt(O),ph:Ge()*Math.PI*2});function it(O,G,V){return O*G/Math.hypot(G*Math.cos(V),O*Math.sin(V))}function tt(O){let G=0;for(let H of ze)G+=H.amp*Math.sin(H.k*O+H.ph);let V=it(ie,Se,O)*(1+e.vars.chaos*2.4*G),ue=Math.abs(Math.cos(O)),g=Math.abs(Math.sin(O)),w=Math.min(ue>1e-6?(j+X*.3)/ue:1e9,g>1e-6?(le+X*.3)/g:1e9);V=Math.max(V,w);let D=Math.abs(Math.cos(O)),I=Math.abs(Math.sin(O)),P=Math.min(D>1e-6?u*.44/D:1e9,I>1e-6?c*.43/I:1e9);return Math.min(V,P)}function K(O,G){return Math.hypot(O,G)<=tt(Math.atan2(G,O))}let fe=0,ce=0,be=0;for(let O=0;O<96;O++){let G=O/96*Math.PI*2,V=tt(G);fe+=.5*V*V*(Math.PI*2/96),ce=Math.max(ce,Math.abs(V*Math.cos(G))),be=Math.max(be,Math.abs(V*Math.sin(G)))}let Ve=Math.max(1,Math.min(400,Math.round(e.vars.tileCount))),Ae=[-ce*1.3,-be*1.3,ce*1.3,be*1.3],je=e.vars.sizeVariance,qe=gstMulberry32(k*977+5),Z=[],T=0;for(;Z.length<4&&T++<400;){let O=(qe()*2-1)*ce,G=(qe()*2-1)*be;K(O,G)&&Z.push([O,G])}function de(O){let G=Math.max(1e-9,O()),V=O();return Math.sqrt(-2*Math.log(G))*Math.cos(2*Math.PI*V)}let se=[],me=0,oe=Math.max(ce,be)*.14;for(;se.length<Ve&&me++<Ve*200;){let O,G;if(Z.length&&ee()<.85*je){let V=Z[Math.floor(ee()*Z.length)%Z.length];O=V[0]+de(ee)*oe,G=V[1]+de(ee)*oe}else O=(ee()*2-1)*ce,G=(ee()*2-1)*be;K(O,G)&&se.push([O,G])}let Ee=se.length,ge=gstMulberry32(k*733+9),Ce=22,We=[];for(let O=0;O<Ce;O++){let G=(O+(ge()-.5)*.72)/Ce*Math.PI*2,V=tt(G)*(1+(ge()-.5)*.09);We.push([V*Math.cos(G),V*Math.sin(G)])}let E=Math.round(3*(1-je));for(let O=0;O<E;O++){let G=d3.Delaunay.from(se).voronoi(Ae);se=se.map((V,ue)=>{let g=G.cellPolygon(ue);if(!g||g.length<3)return V;let w=0,D=0;for(let I of g)w+=I[0],D+=I[1];return[w/g.length,D/g.length]})}function v(O,G,V,ue){let g=(O[0]-G[0])*(V[1]-ue[1])-(O[1]-G[1])*(V[0]-ue[0]);if(Math.abs(g)<1e-9)return null;let w=((O[0]-V[0])*(V[1]-ue[1])-(O[1]-V[1])*(V[0]-ue[0]))/g;return[O[0]+w*(G[0]-O[0]),O[1]+w*(G[1]-O[1])]}function F(O,G){if(G<=0)return O;let V=O.length;if(V<3)return null;let ue=[];for(let I=0;I<V;I++){let P=O[I],H=O[(I+1)%V],ne=H[0]-P[0],he=H[1]-P[1],pe=Math.hypot(ne,he);if(pe<1e-9)continue;let Pe=-he/pe,Ie=ne/pe;ue.push({p1:[P[0]+Pe*G,P[1]+Ie*G],p2:[H[0]+Pe*G,H[1]+Ie*G]})}let g=ue.length;if(g<3)return null;let w=[];for(let I=0;I<g;I++){let P=ue[(I+g-1)%g],H=ue[I];w.push(v(P.p1,P.p2,H.p1,H.p2)||H.p1)}let D=0;for(let I=0;I<w.length;I++){let[P,H]=w[I],[ne,he]=w[(I+1)%w.length];D+=P*he-ne*H}return Math.abs(D)<1e-6?null:w}function Y(O,G,V){let ue=!1;for(let g=0,w=V.length-1;g<V.length;w=g++){let[D,I]=V[g],[P,H]=V[w];I>G!=H>G&&O<(P-D)*(G-I)/(H-I)+D&&(ue=!ue)}return ue}function $(O){let G=1e9,V=1e9,ue=-1e9,g=-1e9;for(let[D,I]of O)D<G&&(G=D),D>ue&&(ue=D),I<V&&(V=I),I>g&&(g=I);let w=7;for(let D=0;D<w;D++)for(let I=0;I<w;I++){let P=G+(D+.5)/w*(ue-G),H=V+(I+.5)/w*(g-V);if(Y(P,H,O)&&W(P,H))return!0}return!1}let J=Math.max(0,e.vars.gap),De=.01+e.vars.roundness*.16,_e=.09;function Re(O){let G=0;for(let V=0;V<O.length;V++){let[ue,g]=O[V],[w,D]=O[(V+1)%O.length];G+=ue*D-w*g}return G/2}function we(O,G){let V=Re(G)>0?1:-1,ue=O;for(let g=0;g<G.length&&ue.length;g++){let w=G[g],D=G[(g+1)%G.length],I=ue;ue=[];let P=H=>V*((D[0]-w[0])*(H[1]-w[1])-(D[1]-w[1])*(H[0]-w[0]))>=-1e-9;for(let H=0;H<I.length;H++){let ne=I[H],he=I[(H+1)%I.length],pe=P(ne),Pe=P(he);pe?(ue.push(ne),Pe||ue.push(v(ne,he,w,D)||he)):Pe&&ue.push(v(ne,he,w,D)||ne)}}return ue}function te(O,G){let V=O;for(let ue=0;ue<3&&V.length>6;ue++){let g=[],w=!1;for(let D=0;D<V.length;D++){let I=V[(D+V.length-1)%V.length],P=V[D],H=V[(D+1)%V.length],ne=P[0]-I[0],he=P[1]-I[1],pe=H[0]-P[0],Pe=H[1]-P[1];if(Math.abs(Math.atan2(ne*Pe-he*pe,ne*pe+he*Pe))<G&&!w&&V.length-1>5){w=!0;continue}w=!1,g.push(P)}if(g.length===V.length)break;V=g}return V}let Te=d3.Delaunay.from(se).voronoi(Ae);function Xe(O){if(!O||O.length<3)return null;let G=[];for(let ue of O){let g=G[G.length-1];g&&Math.hypot(ue[0]-g[0],ue[1]-g[1])<1e-4||G.push(ue)}for(;G.length>1&&Math.hypot(G[0][0]-G[G.length-1][0],G[0][1]-G[G.length-1][1])<1e-4;)G.pop();if(G.length<3)return null;let V=[];for(let ue=0;ue<G.length;ue++){let g=G[(ue+G.length-1)%G.length],w=G[ue],D=G[(ue+1)%G.length],I=(w[0]-g[0])*(D[1]-w[1])-(w[1]-g[1])*(D[0]-w[0]),P=Math.hypot(w[0]-g[0],w[1]-g[1]),H=Math.hypot(D[0]-w[0],D[1]-w[1]);Math.abs(I)<1e-6*Math.max(1e-6,P*H)||V.push(w)}return V.length<3?null:(Re(V)<0&&V.reverse(),V)}function Be(O,G,V,ue){let g=(H,ne,he)=>Math.sign((ne[0]-H[0])*(he[1]-H[1])-(ne[1]-H[1])*(he[0]-H[0])),w=g(O,G,V),D=g(O,G,ue),I=g(V,ue,O),P=g(V,ue,G);return w!==D&&I!==P&&w!==0&&D!==0&&I!==0&&P!==0}function ve(O){let G=O.length;for(let V=0;V<G;V++){let ue=O[V],g=O[(V+1)%G];for(let w=V+1;w<G;w++){if(w===V||(w+1)%G===V||w===(V+1)%G)continue;let D=O[w],I=O[(w+1)%G];if(Be(ue,g,D,I))return!1}}return!0}function He(O,G){let V=Xe(O);return!V||Re(V)<G||!ve(V)?null:V}let N=gstMulberry32(k*31337+7),xe=gstMulberry32(k*9973+1),ae=[],Ue=1/0;for(let O=0;O<Ee;O++){let G=Te.cellPolygon(O);if(!G)continue;let V=G.slice(0,-1),ue=He(te(we(We,V),.14),3e-4);if(!ue){let P=He(V,3e-4);if(!P||!$(P))continue;ue=P}let g=F(ue,J/2);g=g&&He(g,2e-4)||ue;let w=1/0;for(let P=0;P<g.length;P++){let H=g[P],ne=g[(P+1)%g.length],he=Math.hypot(ne[0]-H[0],ne[1]-H[1]);he>1e-6&&he<w&&(w=he)}let D=0,I=0;for(let P of g)D+=P[0],I+=P[1];D/=g.length,I/=g.length,ae.push({cx:D,cy:I,radius:De,local:g.map(P=>[P[0]-D,P[1]-I])})}y=null,B.width=B.height=1;let re=ae.map(O=>{let G=O.cx>=0?1:-1,V=[G*e.vars.sideDist*(.7+N()*.6),e.vars.sideDist===0&&e.vars.zDist===0?0:(N()-.5)*1.7,e.vars.zDist*(.85+N()*.3)],ue=[(N()-.5)*Math.PI*1*e.vars.flyInRotation,(N()-.5)*Math.PI*1.3*e.vars.flyInRotation,(N()-.5)*Math.PI*.5*e.vars.flyInRotation],g=[G*e.vars.sideDist*(.8+N()*.7),e.vars.sideDist===0&&e.vars.zOut===0?0:(N()-.5)*2.2,e.vars.zOut*(.85+N()*.3)],w=[(N()-.5)*Math.PI*1.6*e.vars.flyOutRotation,(N()-.5)*Math.PI*2*e.vars.flyOutRotation,(N()-.5)*Math.PI*.8*e.vars.flyOutRotation];return{cx:O.cx,cy:O.cy,local:O.local,radius:O.radius,baseRot:[(xe()-.5)*.08,(xe()-.5)*.08,(xe()-.5)*.03],wobPhase:xe()*Math.PI*2,wobFreq:.45+xe()*.5,inOff:V,inSpin:ue,outOff:g,outSpin:w,rIn:N(),rOut:N()}}),Q=Math.max(1,re.length-1),Le=re.map((O,G)=>[Math.abs(O.cx),G]).sort((O,G)=>O[0]-G[0]),Fe=e.vars.stagger;Le.forEach((O,G)=>{let V=re[O[1]];V.inDelay=Fe*.85*(G/Q)+V.rIn*.05*Fe,V.inDur=1-V.inDelay}),re.map((O,G)=>[Math.abs(O.cx),G]).sort((O,G)=>G[0]-O[0]).forEach((O,G)=>{let V=re[O[1]];V.outDelay=Fe*.85*(G/Q)+V.rOut*.05*Fe,V.outDur=Math.max(.12,1-V.outDelay)});function gt(O){let G=document.createElement("canvas");G.width=O,G.height=O;let V=G.getContext("2d"),ue=V.createLinearGradient(0,0,O,O);ue.addColorStop(0,"#202020"),ue.addColorStop(.5,"#a0a0a0"),ue.addColorStop(1,"#f0f0f0"),V.fillStyle=ue,V.fillRect(0,0,O,O);let g=V.createRadialGradient(O*.3,O*.4,0,O*.3,O*.4,O*.9);g.addColorStop(0,"rgba(255,255,255,0.4)"),g.addColorStop(1,"rgba(0,0,0,0)"),V.fillStyle=g,V.fillRect(0,0,O,O);let w=new Wo(G);return w.wrapS=w.wrapT=Ni,w}{let O=2*(n+3.5)*Math.tan(a*Math.PI/360),G=new Zt(new Us(O*(1920/1080)*1.05,O*1.05),new vs({color:657935,depthWrite:!1,depthTest:!1}));G.position.z=-3.5,G.renderOrder=-1,o.add(G)}let nt=n-s+.28,Bt=e.vars.fog>0?4.6/Math.max(2,e.vars.fog):0;function Ht(O,G){O.uniforms.uGstFogStart={value:nt},O.uniforms.uGstFogRho={value:Bt},O.uniforms.uGstFogColor={value:new Qe(657935)},O.vertexShader=O.vertexShader.replace("#include <common>",`#include <common>
+`;continue}if((U=L.match(p))&&(C.gamma=parseFloat(U[1])),(U=L.match(A))&&(C.exposure=parseFloat(U[1])),(U=L.match(S))&&(C.valid|=2,C.format=U[1]),(U=L.match(b))&&(C.valid|=4,C.height=parseInt(U[1],10),C.width=parseInt(U[2],10)),C.valid&2&&C.valid&4)break}return C.valid&2||t(3,"missing format specifier"),C.valid&4||t(3,"missing image size specifier"),C},a=function(_,f,p){let A=f;if(A<8||A>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);A!==(_[2]<<8|_[3])&&t(3,"wrong scanline width");let S=new Uint8Array(4*f*p);S.length||t(4,"unable to allocate buffer space");let b=0,C=0,L=4*A,U=new Uint8Array(4),B=new Uint8Array(L),M=p;for(;M>0&&C<_.byteLength;){C+4>_.byteLength&&t(1),U[0]=_[C++],U[1]=_[C++],U[2]=_[C++],U[3]=_[C++],(U[0]!=2||U[1]!=2||(U[2]<<8|U[3])!=A)&&t(3,"bad rgbe scanline format");let y=0,R;for(;y<L&&C<_.byteLength;){R=_[C++];let W=R>128;if(W&&(R-=128),(R===0||y+R>L)&&t(3,"bad scanline data"),W){let k=_[C++];for(let ee=0;ee<R;ee++)B[y++]=k}else B.set(_.subarray(C,C+R),y),y+=R,C+=R}let q=A;for(let W=0;W<q;W++){let k=0;S[b]=B[W+k],k+=A,S[b+1]=B[W+k],k+=A,S[b+2]=B[W+k],k+=A,S[b+3]=B[W+k],b+=4}M--}return S},n=function(_,f,p,A){let S=_[f+3],b=Math.pow(2,S-128)/255;p[A+0]=_[f+0]*b,p[A+1]=_[f+1]*b,p[A+2]=_[f+2]*b,p[A+3]=1},s=function(_,f,p,A){let S=_[f+3],b=Math.pow(2,S-128)/255;p[A+0]=ba.toHalfFloat(Math.min(_[f+0]*b,65504)),p[A+1]=ba.toHalfFloat(Math.min(_[f+1]*b,65504)),p[A+2]=ba.toHalfFloat(Math.min(_[f+2]*b,65504)),p[A+3]=ba.toHalfFloat(1)},o=new Uint8Array(e);o.pos=0;let l=i(o),h=l.width,c=l.height,u=a(o.subarray(o.pos),h,c),d,m,x;switch(this.type){case Vt:x=u.length/4;let _=new Float32Array(x*4);for(let p=0;p<x;p++)n(u,p*4,_,p*4);d=_,m=Vt;break;case Qt:x=u.length/4;let f=new Uint16Array(x*4);for(let p=0;p<x;p++)s(u,p*4,f,p*4);d=f,m=Qt;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:h,height:c,data:d,header:l.string,gamma:l.gamma,exposure:l.exposure,type:m}}setDataType(e){return this.type=e,this}load(e,t,r,i){function a(n,s){switch(n.type){case Vt:case Qt:n.colorSpace=Br,n.minFilter=St,n.magFilter=St,n.generateMipmaps=!1,n.flipY=!0;break}t&&t(n,s)}return super.load(e,a,r,i)}};(async()=>{let e=window.__GST,t=e.st;if(window.__gstInstance&&window.__gstInstance.dispose)try{window.__gstInstance.dispose()}catch{}let r=document.getElementById("gst-canvas"),i=new Sg({canvas:r,alpha:!0,antialias:!0,preserveDrawingBuffer:!0});i.setSize(1920,1080,!1),i.setPixelRatio(1),i.setClearColor(657935,1),i.toneMapping=Qs;let a=42,n=5.2,s=.6,o=new mc,l=Math.max(60,n+Math.max(-e.vars.zDist,-e.vars.zOut,0)*1.15+e.vars.sideDist*1.5+12),h=new Nt(a,1920/1080,.1,l);h.position.set(0,0,n);let c=2*(n-s)*Math.tan(a*Math.PI/360),u=c*(1920/1080);o.add(new Eu(16777215,.6));let d=new Mu(16777215,7,0,Math.PI/4,.5,1);d.position.set(0,7.1,2),o.add(d);let m=new Su(13426175,4,0,1);m.position.set(0,-3,1),o.add(m);let x=await new Tg().loadAsync(document.getElementById("gst-hdr").href),_=new Hs(i),f=_.fromEquirectangular(x);o.environment=f.texture,o.environmentRotation=new cr(0,.6,0),x.dispose(),_.dispose();let p=await new vu().loadAsync(document.getElementById("gst-matcap").href);p.colorSpace=Pt,p.wrapS=p.wrapT=Ni;let A=1/.2;p.repeat.set(A,A),p.offset.set((1-A)*.5,(1-A)*.5);try{await Promise.all([document.fonts.load('600 100px "Geist"'),document.fonts.load('400 100px "Geist"')]),await document.fonts.ready}catch{}let S=4096,b=Math.round(S*(c/u)),C=document.createElement("canvas");C.width=S,C.height=b;let L=C.getContext("2d");{L.clearRect(0,0,S,b),L.textAlign="center",L.textBaseline="middle";let O=300;L.font=`600 ${O}px "Geist", ui-sans-serif, sans-serif`,L.letterSpacing=`${-.035*O}px`;let G=L.measureText(e.vars.headline).width,V=S*.7;G>V&&(O=Math.floor(O*V/G)),L.font=`600 ${O}px "Geist", ui-sans-serif, sans-serif`,L.letterSpacing=`${-.035*O}px`,L.fillStyle="#f4f4f8",L.fillText(e.vars.headline,S/2,b/2),e.fontPx=O}let U=new Wo(C);U.colorSpace=Pt,U.anisotropy=16;let B=document.createElement("canvas");B.width=1280,B.height=Math.round(1280*(c/u));let M=B.getContext("2d",{willReadFrequently:!0});{let O=B.width/S;M.clearRect(0,0,B.width,B.height),M.textAlign="center",M.textBaseline="middle",M.font=`600 ${e.fontPx*O}px "Geist", ui-sans-serif, sans-serif`,M.letterSpacing=`${-.035*e.fontPx*O}px`,M.fillStyle="#fff",M.strokeStyle="#fff",M.lineWidth=e.fontPx*O*.22,M.lineJoin="round",M.strokeText(e.vars.headline,B.width/2,B.height/2),M.fillText(e.vars.headline,B.width/2,B.height/2)}let y=M.getImageData(0,0,B.width,B.height).data,R=B.width,q=B.height;function W(O,G){if(!y)return!1;let V=Math.round((O/u+.5)*(R-1)),ue=Math.round((.5-G/c)*(q-1));return V<0||ue<0||V>=R||ue>=q?!1:y[(ue*R+V)*4+3]>24}{L.font=`600 ${e.fontPx}px "Geist", ui-sans-serif, sans-serif`,L.letterSpacing=`${-.035*e.fontPx}px`;let O=L.measureText(e.vars.headline);e.bandW=(O.width+e.fontPx*.2)/S*u,e.bandH=(O.actualBoundingBoxAscent+O.actualBoundingBoxDescent+e.fontPx*.34)/b*c}let k=11,ee=gstMulberry32(k),j=e.bandW/2,le=e.bandH/2,X=e.bandH*(.18+e.vars.padding*.85),ie=j+X,Se=le+X,Ge=gstMulberry32(k*511+3),ze=[];for(let O=2;O<=9;O++)ze.push({k:O,amp:(Ge()*2-1)/Math.sqrt(O),ph:Ge()*Math.PI*2});function it(O,G,V){return O*G/Math.hypot(G*Math.cos(V),O*Math.sin(V))}function tt(O){let G=0;for(let H of ze)G+=H.amp*Math.sin(H.k*O+H.ph);let V=it(ie,Se,O)*(1+e.vars.chaos*2.4*G),ue=Math.abs(Math.cos(O)),g=Math.abs(Math.sin(O)),w=Math.min(ue>1e-6?(j+X*.3)/ue:1e9,g>1e-6?(le+X*.3)/g:1e9);V=Math.max(V,w);let D=Math.abs(Math.cos(O)),I=Math.abs(Math.sin(O)),P=Math.min(D>1e-6?u*.44/D:1e9,I>1e-6?c*.43/I:1e9);return Math.min(V,P)}function K(O,G){return Math.hypot(O,G)<=tt(Math.atan2(G,O))}let fe=0,ce=0,be=0;for(let O=0;O<96;O++){let G=O/96*Math.PI*2,V=tt(G);fe+=.5*V*V*(Math.PI*2/96),ce=Math.max(ce,Math.abs(V*Math.cos(G))),be=Math.max(be,Math.abs(V*Math.sin(G)))}let Ve=Math.max(1,Math.min(400,Math.round(e.vars.tileCount))),Ae=[-ce*1.3,-be*1.3,ce*1.3,be*1.3],je=e.vars.sizeVariance,qe=gstMulberry32(k*977+5),Z=[],T=0;for(;Z.length<4&&T++<400;){let O=(qe()*2-1)*ce,G=(qe()*2-1)*be;K(O,G)&&Z.push([O,G])}function de(O){let G=Math.max(1e-9,O()),V=O();return Math.sqrt(-2*Math.log(G))*Math.cos(2*Math.PI*V)}let se=[],me=0,oe=Math.max(ce,be)*.14;for(;se.length<Ve&&me++<Ve*200;){let O,G;if(Z.length&&ee()<.85*je){let V=Z[Math.floor(ee()*Z.length)%Z.length];O=V[0]+de(ee)*oe,G=V[1]+de(ee)*oe}else O=(ee()*2-1)*ce,G=(ee()*2-1)*be;K(O,G)&&se.push([O,G])}let Ee=se.length,ge=gstMulberry32(k*733+9),Ce=22,We=[];for(let O=0;O<Ce;O++){let G=(O+(ge()-.5)*.72)/Ce*Math.PI*2,V=tt(G)*(1+(ge()-.5)*.09);We.push([V*Math.cos(G),V*Math.sin(G)])}let E=Math.round(3*(1-je));for(let O=0;O<E;O++){let G=d3.Delaunay.from(se).voronoi(Ae);se=se.map((V,ue)=>{let g=G.cellPolygon(ue);if(!g||g.length<3)return V;let w=0,D=0;for(let I of g)w+=I[0],D+=I[1];return[w/g.length,D/g.length]})}function v(O,G,V,ue){let g=(O[0]-G[0])*(V[1]-ue[1])-(O[1]-G[1])*(V[0]-ue[0]);if(Math.abs(g)<1e-9)return null;let w=((O[0]-V[0])*(V[1]-ue[1])-(O[1]-V[1])*(V[0]-ue[0]))/g;return[O[0]+w*(G[0]-O[0]),O[1]+w*(G[1]-O[1])]}function F(O,G){if(G<=0)return O;let V=O.length;if(V<3)return null;let ue=[];for(let I=0;I<V;I++){let P=O[I],H=O[(I+1)%V],ne=H[0]-P[0],he=H[1]-P[1],pe=Math.hypot(ne,he);if(pe<1e-9)continue;let Pe=-he/pe,Ie=ne/pe;ue.push({p1:[P[0]+Pe*G,P[1]+Ie*G],p2:[H[0]+Pe*G,H[1]+Ie*G]})}let g=ue.length;if(g<3)return null;let w=[];for(let I=0;I<g;I++){let P=ue[(I+g-1)%g],H=ue[I];w.push(v(P.p1,P.p2,H.p1,H.p2)||H.p1)}let D=0;for(let I=0;I<w.length;I++){let[P,H]=w[I],[ne,he]=w[(I+1)%w.length];D+=P*he-ne*H}return Math.abs(D)<1e-6?null:w}function Y(O,G,V){let ue=!1;for(let g=0,w=V.length-1;g<V.length;w=g++){let[D,I]=V[g],[P,H]=V[w];I>G!=H>G&&O<(P-D)*(G-I)/(H-I)+D&&(ue=!ue)}return ue}function $(O){let G=1e9,V=1e9,ue=-1e9,g=-1e9;for(let[D,I]of O)D<G&&(G=D),D>ue&&(ue=D),I<V&&(V=I),I>g&&(g=I);let w=7;for(let D=0;D<w;D++)for(let I=0;I<w;I++){let P=G+(D+.5)/w*(ue-G),H=V+(I+.5)/w*(g-V);if(Y(P,H,O)&&W(P,H))return!0}return!1}let J=Math.max(0,e.vars.gap),De=.01+e.vars.roundness*.16,_e=.09;function Re(O){let G=0;for(let V=0;V<O.length;V++){let[ue,g]=O[V],[w,D]=O[(V+1)%O.length];G+=ue*D-w*g}return G/2}function we(O,G){let V=Re(G)>0?1:-1,ue=O;for(let g=0;g<G.length&&ue.length;g++){let w=G[g],D=G[(g+1)%G.length],I=ue;ue=[];let P=H=>V*((D[0]-w[0])*(H[1]-w[1])-(D[1]-w[1])*(H[0]-w[0]))>=-1e-9;for(let H=0;H<I.length;H++){let ne=I[H],he=I[(H+1)%I.length],pe=P(ne),Pe=P(he);pe?(ue.push(ne),Pe||ue.push(v(ne,he,w,D)||he)):Pe&&ue.push(v(ne,he,w,D)||ne)}}return ue}function te(O,G){let V=O;for(let ue=0;ue<3&&V.length>6;ue++){let g=[],w=!1;for(let D=0;D<V.length;D++){let I=V[(D+V.length-1)%V.length],P=V[D],H=V[(D+1)%V.length],ne=P[0]-I[0],he=P[1]-I[1],pe=H[0]-P[0],Pe=H[1]-P[1];if(Math.abs(Math.atan2(ne*Pe-he*pe,ne*pe+he*Pe))<G&&!w&&V.length-1>5){w=!0;continue}w=!1,g.push(P)}if(g.length===V.length)break;V=g}return V}let Te=d3.Delaunay.from(se).voronoi(Ae);function Xe(O){if(!O||O.length<3)return null;let G=[];for(let ue of O){let g=G[G.length-1];g&&Math.hypot(ue[0]-g[0],ue[1]-g[1])<1e-4||G.push(ue)}for(;G.length>1&&Math.hypot(G[0][0]-G[G.length-1][0],G[0][1]-G[G.length-1][1])<1e-4;)G.pop();if(G.length<3)return null;let V=[];for(let ue=0;ue<G.length;ue++){let g=G[(ue+G.length-1)%G.length],w=G[ue],D=G[(ue+1)%G.length],I=(w[0]-g[0])*(D[1]-w[1])-(w[1]-g[1])*(D[0]-w[0]),P=Math.hypot(w[0]-g[0],w[1]-g[1]),H=Math.hypot(D[0]-w[0],D[1]-w[1]);Math.abs(I)<1e-6*Math.max(1e-6,P*H)||V.push(w)}return V.length<3?null:(Re(V)<0&&V.reverse(),V)}function Be(O,G,V,ue){let g=(H,ne,he)=>Math.sign((ne[0]-H[0])*(he[1]-H[1])-(ne[1]-H[1])*(he[0]-H[0])),w=g(O,G,V),D=g(O,G,ue),I=g(V,ue,O),P=g(V,ue,G);return w!==D&&I!==P&&w!==0&&D!==0&&I!==0&&P!==0}function ve(O){let G=O.length;for(let V=0;V<G;V++){let ue=O[V],g=O[(V+1)%G];for(let w=V+1;w<G;w++){if(w===V||(w+1)%G===V||w===(V+1)%G)continue;let D=O[w],I=O[(w+1)%G];if(Be(ue,g,D,I))return!1}}return!0}function He(O,G){let V=Xe(O);return!V||Re(V)<G||!ve(V)?null:V}let N=gstMulberry32(k*31337+7),xe=gstMulberry32(k*9973+1),ae=[],Ue=1/0;for(let O=0;O<Ee;O++){let G=Te.cellPolygon(O);if(!G)continue;let V=G.slice(0,-1),ue=He(te(we(We,V),.14),3e-4);if(!ue){let P=He(V,3e-4);if(!P||!$(P))continue;ue=P}let g=F(ue,J/2);g=g&&He(g,2e-4)||ue;let w=1/0;for(let P=0;P<g.length;P++){let H=g[P],ne=g[(P+1)%g.length],he=Math.hypot(ne[0]-H[0],ne[1]-H[1]);he>1e-6&&he<w&&(w=he)}let D=0,I=0;for(let P of g)D+=P[0],I+=P[1];D/=g.length,I/=g.length,ae.push({cx:D,cy:I,radius:De,local:g.map(P=>[P[0]-D,P[1]-I])})}y=null,B.width=B.height=1;let re=ae.map(O=>{let G=O.cx>=0?1:-1,V=[G*e.vars.sideDist*(.7+N()*.6),e.vars.sideDist===0&&e.vars.zDist===0?0:(N()-.5)*1.7,e.vars.zDist*(.85+N()*.3)],ue=[(N()-.5)*Math.PI*1*e.vars.flyInRotation,(N()-.5)*Math.PI*1.3*e.vars.flyInRotation,(N()-.5)*Math.PI*.5*e.vars.flyInRotation],g=[G*e.vars.sideDist*(.8+N()*.7),e.vars.sideDist===0&&e.vars.zOut===0?0:(N()-.5)*2.2,e.vars.zOut*(.85+N()*.3)],w=[(N()-.5)*Math.PI*1.6*e.vars.flyOutRotation,(N()-.5)*Math.PI*2*e.vars.flyOutRotation,(N()-.5)*Math.PI*.8*e.vars.flyOutRotation];return{cx:O.cx,cy:O.cy,local:O.local,radius:O.radius,baseRot:[(xe()-.5)*.08,(xe()-.5)*.08,(xe()-.5)*.03],wobPhase:xe()*Math.PI*2,wobFreq:.45+xe()*.5,inOff:V,inSpin:ue,outOff:g,outSpin:w,rIn:N(),rOut:N()}}),Q=Math.max(1,re.length-1),Le=re.map((O,G)=>[Math.abs(O.cx),G]).sort((O,G)=>O[0]-G[0]),Fe=e.vars.stagger;Le.forEach((O,G)=>{let V=re[O[1]];V.inDelay=Fe*.85*(G/Q)+V.rIn*.05*Fe,V.inDur=1-V.inDelay}),re.map((O,G)=>[Math.abs(O.cx),G]).sort((O,G)=>G[0]-O[0]).forEach((O,G)=>{let V=re[O[1]];V.outDelay=Fe*.85*(G/Q)+V.rOut*.05*Fe,V.outDur=Math.max(.12,1-V.outDelay)});function gt(O){let G=document.createElement("canvas");G.width=O,G.height=O;let V=G.getContext("2d"),ue=V.createLinearGradient(0,0,O,O);ue.addColorStop(0,"#202020"),ue.addColorStop(.5,"#a0a0a0"),ue.addColorStop(1,"#f0f0f0"),V.fillStyle=ue,V.fillRect(0,0,O,O);let g=V.createRadialGradient(O*.3,O*.4,0,O*.3,O*.4,O*.9);g.addColorStop(0,"rgba(255,255,255,0.4)"),g.addColorStop(1,"rgba(0,0,0,0)"),V.fillStyle=g,V.fillRect(0,0,O,O);let w=new Wo(G);return w.wrapS=w.wrapT=Ni,w}{let O=2*(n+3.5)*Math.tan(a*Math.PI/360),G=new Zt(new Us(O*(1920/1080)*1.05,O*1.05),new vs({color:657935,depthWrite:!1,depthTest:!1}));G.position.z=-3.5,G.renderOrder=-1,o.add(G)}let nt=n-s+.28,Bt=e.vars.fog>0?4.6/Math.max(2,e.vars.fog):0;function Ht(O,G){O.uniforms.uGstFogStart={value:nt},O.uniforms.uGstFogRho={value:Bt},O.uniforms.uGstFogColor={value:new Qe(657935)},O.vertexShader=O.vertexShader.replace("#include <common>",`#include <common>
varying float vGstDep;`).replace("#include <project_vertex>",`#include <project_vertex>
vGstDep = -mvPosition.z;`),O.fragmentShader=O.fragmentShader.replace("#include <common>",`#include <common>
varying float vGstDep;
diff --git a/registry/blocks/glass-shard-title/assets/glass-main.mjs b/registry/blocks/glass-shard-title/assets/glass-main.mjs
index 9d3745046c..159b8570d6 100644
--- a/registry/blocks/glass-shard-title/assets/glass-main.mjs
+++ b/registry/blocks/glass-shard-title/assets/glass-main.mjs
@@ -67,7 +67,7 @@ point.position.set(0, -3, 1);
scene.add(point);
/* ---- Environment + matcap (glass look) ---- */
-const hdrTex = await new HDRLoader().loadAsync("assets/ferndale_studio_01_1k.hdr");
+const hdrTex = await new HDRLoader().loadAsync(document.getElementById("gst-hdr").href);
const pmrem = new THREE.PMREMGenerator(renderer);
const envRT = pmrem.fromEquirectangular(hdrTex);
scene.environment = envRT.texture;
@@ -75,7 +75,9 @@ scene.environmentRotation = new THREE.Euler(0, 0.6, 0);
hdrTex.dispose();
pmrem.dispose();
-const matcapTex = await new THREE.TextureLoader().loadAsync("assets/matcap-1.png");
+const matcapTex = await new THREE.TextureLoader().loadAsync(
+ document.getElementById("gst-matcap").href,
+);
matcapTex.colorSpace = THREE.SRGBColorSpace;
matcapTex.wrapS = matcapTex.wrapT = THREE.RepeatWrapping;
const mk = 1 / 0.2;
diff --git a/registry/blocks/glass-shard-title/glass-shard-title.html b/registry/blocks/glass-shard-title/glass-shard-title.html
index 0e68be350e..9ac3947be2 100644
--- a/registry/blocks/glass-shard-title/glass-shard-title.html
+++ b/registry/blocks/glass-shard-title/glass-shard-title.html
@@ -4,13 +4,6 @@
data-composition-variables='[{"id":"headline","type":"string","label":"Headline","default":"Designed in glass","maxLength":40},{"id":"tileCount","type":"number","label":"Tiles","default":8,"min":1,"max":400,"step":1},{"id":"roundness","type":"number","label":"Roundness (0-1)","default":0.4,"min":0,"max":1,"step":0.01},{"id":"bevel","type":"number","label":"Bevel (0-1)","default":0.35,"min":0,"max":1,"step":0.01},{"id":"meshSmooth","type":"number","label":"Surface smoothness (0-1)","default":0.6,"min":0,"max":1,"step":0.01},{"id":"flyInTime","type":"number","label":"Fly-in time (s)","default":2.3,"min":0.2,"max":6,"step":0.05},{"id":"flyOutTime","type":"number","label":"Fly-out time (s)","default":2.4,"min":0.2,"max":6,"step":0.05},{"id":"stagger","type":"number","label":"Stagger (0-1)","default":0.27,"min":0,"max":1,"step":0.01},{"id":"flyInRotation","type":"number","label":"Fly-in rotation (0-60)","description":"Amount of inbound tumbling over the entire flight. 0 disables flight rotation; final orientation lands with each shard position.","default":5,"min":0,"max":60,"step":0.1},{"id":"flyOutRotation","type":"number","label":"Fly-out rotation (0-6)","default":6,"min":0,"max":6,"step":0.1},{"id":"chaos","type":"number","label":"Outline chaos (0-1)","default":0.25,"min":0,"max":1,"step":0.01},{"id":"padding","type":"number","label":"Edge padding (0-1)","default":1,"min":0,"max":1,"step":0.01},{"id":"sizeVariance","type":"number","label":"Size variance (0-1)","default":0.35,"min":0,"max":1,"step":0.01},{"id":"gap","type":"number","label":"Tile gap","default":0.03,"min":0,"max":0.3,"step":0.002},{"id":"easePow","type":"number","label":"Fly-in position ease (1-10)","description":"Shapes lateral and depth travel. Rotation uses the same staggered flight window with a gentle settle through arrival.","default":10,"min":1,"max":10,"step":0.1},{"id":"sideDist","type":"number","label":"Side fly distance","default":3,"min":0,"max":60,"step":0.5},{"id":"zDist","type":"number","label":"Z fly-from (negative)","default":-42,"min":-400,"max":0,"step":2},{"id":"zOut","type":"number","label":"Z fly-out to (+ = past camera)","default":14,"min":-400,"max":60,"step":2},{"id":"fog","type":"number","label":"Fog distance (0 = off)","default":36,"min":0,"max":400,"step":2}]'
>
<head>
- <script>
- /* ?play standalone mode only: this file lives in compositions/ but its
- asset paths are project-root-relative (they resolve there when the
- runtime inlines it into the host). Never runs for Studio/render. */
- if (new URLSearchParams(location.search).has("play")) document.write('<base href="../">');
- </script>
-
<meta charset="UTF-8" />
<meta name="viewport" content="width=1920, height=1080" />
<title>Glass Shard Title</title>
@@ -103,6 +96,21 @@
<span data-hf-id="hf-kqtg" style="font-weight: 400">Aa</span
><span data-hf-id="hf-7bxm" style="font-weight: 600">Aa</span>
</div>
+ <!-- glass-main.js reads these hrefs: a mounted block's src/href are rebased, strings in its script are not. -->
+ <link
+ id="gst-hdr"
+ rel="preload"
+ as="fetch"
+ crossorigin="anonymous"
+ href="assets/ferndale_studio_01_1k.hdr"
+ />
+ <link
+ id="gst-matcap"
+ rel="preload"
+ as="image"
+ crossorigin="anonymous"
+ href="assets/matcap-1.png"
+ />
</div>
<script>
diff --git a/registry/blocks/liquid-glass-notification/registry-item.json b/registry/blocks/liquid-glass-notification/registry-item.json
index d321422c3c..3e1d7014d5 100644
--- a/registry/blocks/liquid-glass-notification/registry-item.json
+++ b/registry/blocks/liquid-glass-notification/registry-item.json
@@ -20,12 +20,12 @@
{
"path": "assets/hyperframes-logo-dark.svg",
"target": "compositions/assets/hyperframes-logo-dark.svg",
- "type": "registry:asset"
+ "type": "hyperframes:asset"
},
{
"path": "lib/liquid-glass.iife.js",
"target": "compositions/lib/liquid-glass.iife.js",
- "type": "registry:asset"
+ "type": "hyperframes:asset"
}
],
"preview": {
diff --git a/registry/blocks/liquid-glass-widgets/registry-item.json b/registry/blocks/liquid-glass-widgets/registry-item.json
index 3effd62af0..0c77d0d824 100644
--- a/registry/blocks/liquid-glass-widgets/registry-item.json
+++ b/registry/blocks/liquid-glass-widgets/registry-item.json
@@ -20,12 +20,12 @@
{
"path": "assets/hyperframes-logo-dark.svg",
"target": "compositions/assets/hyperframes-logo-dark.svg",
- "type": "registry:asset"
+ "type": "hyperframes:asset"
},
{
"path": "lib/liquid-glass.iife.js",
"target": "compositions/lib/liquid-glass.iife.js",
- "type": "registry:asset"
+ "type": "hyperframes:asset"
}
],
"preview": {
diff --git a/registry/blocks/lt-neon-border/registry-item.json b/registry/blocks/lt-neon-border/registry-item.json
index ec90a1a48f..6b9113748f 100644
--- a/registry/blocks/lt-neon-border/registry-item.json
+++ b/registry/blocks/lt-neon-border/registry-item.json
@@ -100,7 +100,8 @@
"files": [
{
"path": "lt-neon-border.html",
- "type": "hyperframes:block"
+ "target": "compositions/lt-neon-border.html",
+ "type": "hyperframes:composition"
}
],
"params": [
diff --git a/registry/blocks/vfx-iphone-device/registry-item.json b/registry/blocks/vfx-iphone-device/registry-item.json
index c765210440..5f0ad98c77 100644
--- a/registry/blocks/vfx-iphone-device/registry-item.json
+++ b/registry/blocks/vfx-iphone-device/registry-item.json
@@ -20,22 +20,22 @@
{
"path": "models/iphone.glb",
"target": "models/iphone.glb",
- "type": "asset"
+ "type": "hyperframes:asset"
},
{
"path": "models/macbook.glb",
"target": "models/macbook.glb",
- "type": "asset"
+ "type": "hyperframes:asset"
},
{
"path": "models/hyperframes-mobile.png",
"target": "models/hyperframes-mobile.png",
- "type": "asset"
+ "type": "hyperframes:asset"
},
{
"path": "models/hyperframes-desktop.png",
"target": "models/hyperframes-desktop.png",
- "type": "asset"
+ "type": "hyperframes:asset"
}
],
"preview": {
diff --git a/scripts/catalog-script-inlining.test.ts b/scripts/catalog-script-inlining.test.ts
index 44d15d6b59..33306af555 100644
--- a/scripts/catalog-script-inlining.test.ts
+++ b/scripts/catalog-script-inlining.test.ts
@@ -1,9 +1,9 @@
-import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, it } from "node:test";
import assert from "node:assert/strict";
-import { withHostedRefs } from "./catalog-script-inlining.ts";
+import { inlineCatalogScripts, withHostedRefs } from "./catalog-script-inlining.ts";
const CDN = "https://static.example.com/registry-assets";
@@ -52,3 +52,40 @@ describe("withHostedRefs", () => {
}
});
});
+
+describe("glass-shard-title payload", () => {
+ const scriptTag = `<script src="assets/glass-main.js"></script>`;
+ const withGlassMain = (fn: (dir: string) => void) => {
+ const dir = mkdtempSync(join(tmpdir(), "hf-inlining-"));
+ try {
+ mkdirSync(join(dir, "assets"));
+ writeFileSync(join(dir, "assets/glass-main.js"), "window.GLASS = 1;");
+ fn(dir);
+ } finally {
+ rmSync(dir, { recursive: true, force: true });
+ }
+ };
+
+ it("inlines glass-main.js once the hdr link is a data URL", () => {
+ withGlassMain((dir) => {
+ const html = `<link id="gst-hdr" href="data:image/vnd.radiance;base64,AA">${scriptTag}`;
+ const out = inlineCatalogScripts("glass-shard-title", html, dir, {});
+ assert.ok(out.includes("window.GLASS = 1;"));
+ assert.ok(!out.includes(scriptTag));
+ });
+ });
+
+ it("refuses a payload whose hdr link still points at the local file", () => {
+ withGlassMain((dir) => {
+ for (const link of [
+ `<link id="gst-hdr" href="assets/ferndale_studio_01_1k.hdr">`,
+ `<link id='gst-hdr' href='assets/ferndale_studio_01_1k.hdr'>`,
+ ]) {
+ assert.throws(
+ () => inlineCatalogScripts("glass-shard-title", link + scriptTag, dir, {}),
+ /hdr <link> was not inlined/,
+ );
+ }
+ });
+ });
+});
diff --git a/scripts/catalog-script-inlining.ts b/scripts/catalog-script-inlining.ts
index ac096b829e..94b4b1a286 100644
--- a/scripts/catalog-script-inlining.ts
+++ b/scripts/catalog-script-inlining.ts
@@ -227,21 +227,10 @@ ${gsapLoaderJs(vendorUrls)}
}
function inlineGlassScripts(html: string, projectDir: string): string {
- const hdrRelPath = "assets/ferndale_studio_01_1k.hdr";
- let glassText = withHostedRefs(
- readFileSync(join(projectDir, "assets/glass-main.js"), "utf-8"),
- projectDir,
- );
- if (!glassText.includes(hdrRelPath)) {
- throw new Error(
- `catalog-script-inlining: glass-main.js no longer references "${hdrRelPath}"; ` +
- `the hdr substitution needs updating.`,
- );
+ if (html.includes("assets/ferndale_studio_01_1k.hdr")) {
+ throw new Error("catalog-script-inlining: glass-shard-title's hdr <link> was not inlined.");
}
- const hdrBytes = readFileSync(join(projectDir, hdrRelPath));
- const hdrDataUrl = `data:application/octet-stream;base64,${hdrBytes.toString("base64")}`;
- glassText = glassText.split(hdrRelPath).join(hdrDataUrl);
-
+ const glassText = readFileSync(join(projectDir, "assets/glass-main.js"), "utf-8");
const bootstrap = `<script>(0,eval)(${jsStringLiteral(glassText)});</script>`;
return replaceOnce(
html,