Playground archived at branch archive/playground-solidjs (tag playground-solidjs-final) and deleted from main. Retargets: - run-all-tests.sh stage 5 → manifold (typecheck + bun test + build + playwright via non-snap node runner, BUILD-PLAN gotcha) - ci.yml playground-tests → manifold-tests; osc-bridge.yml → manifold/osc-bridge (was already broken: playground/osc-bridge no longer existed) - codegen: TS emission target removed (returns at P5 → manifold); golden test now C++-only; TS emitters retained dormant - .gitignore: manifold/osc-bridge paths; drop dead playground faust exception - docs: AGENTS.md gates, README quickstart, MAP.md, ALIGNMENT.md (C15 now archive-only — defect #1 updated), AGENT-REFERENCE.md, specs/MAIN.md Part of docs/specs/plans/one-core-engine-refactor.md P1.
2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
import{c as d,i as o,a as u,S,t as p,b as D,d as x,e as z,s as O,F as R,f as F,V as j,X as V,o as M,g as T,h as P,H as I,P as k,O as L,T as q,D as B,C as H,j as A,k as J,J as G,W as U,G as X,L as W}from"./index-C1-a2ZPT.js";const Y="_root_1attb_1",Z="_header_1attb_9",K="_lede_1attb_21",Q="_grid_1attb_27",ee="_card_1attb_33",te="_cardHead_1attb_44",ne="_cardTitle_1attb_52",ae="_cardDesc_1attb_58",le="_cardBody_1attb_64",b={root:Y,header:Z,lede:K,grid:Q,card:ee,cardHead:te,cardTitle:ne,cardDesc:ae,cardBody:le};var re=p("<div style=display:flex;flex-direction:column;gap:12px;min-width:280px>");const ie=()=>{const[a,i]=d(.5),[r,e]=d(20),[l,t]=d(0);return(()=>{var n=re();return o(n,u(S,{get value(){return a()},onChange:i,min:0,max:1,step:.01,label:"linear"}),null),o(n,u(S,{get value(){return r()},onChange:e,min:1,max:1e3,curve:"exp",label:"exp (1..1000)",unit:"hz"}),null),o(n,u(S,{get value(){return l()},onChange:t,min:-50,max:50,step:1,label:"bipolar (-50..50)"}),null),n})()},oe="_bank_3njyn_1",se="_title_3njyn_11",ce="_section_3njyn_17",ue="_sectionHeader_3njyn_23",de="_caret_3njyn_38",me="_sectionName_3njyn_43",pe="_sectionCount_3njyn_47",ve="_list_3njyn_51",$={bank:oe,title:se,section:ce,sectionHeader:ue,caret:de,sectionName:me,sectionCount:pe,list:ve};var he=p("<h3>"),N=p("<div>"),ge=p("<button type=button><span></span><span></span><span>"),xe=p("<section>");function _e(a){const i=[];let r=null;return a.forEach((e,l)=>{const t=e.section??"";(!r||r.name!==t)&&(r={name:t,items:[]},i.push(r)),r.items.push({cfg:e,index:l})}),i}const fe=a=>{const[i,r]=d(Object.fromEntries((a.collapsedSections??[]).map(t=>[t,!0]))),e=()=>_e(a.sliders),l=t=>{r(n=>({...n,[t]:!n[t]}))};return(()=>{var t=N();return o(t,u(z,{get when(){return a.title},get children(){var n=he();return o(n,()=>a.title),D(()=>x(n,$.title)),n}}),null),o(t,u(R,{get each(){return e()},children:n=>(()=>{var c=xe();return o(c,u(z,{get when(){return n.name},get children(){var m=ge(),s=m.firstChild,h=s.nextSibling,g=h.nextSibling;return m.$$click=()=>l(n.name),o(s,()=>i()[n.name]?"▸":"▾"),o(h,()=>n.name),o(g,()=>n.items.length),D(v=>{var _=$.sectionHeader,f=!i()[n.name],C=$.caret,w=$.sectionName,E=$.sectionCount;return _!==v.e&&x(m,v.e=_),f!==v.t&&O(m,"aria-expanded",v.t=f),C!==v.a&&x(s,v.a=C),w!==v.o&&x(h,v.o=w),E!==v.i&&x(g,v.i=E),v},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),m}}),null),o(c,u(z,{get when(){return!i()[n.name]},get children(){var m=N();return o(m,u(R,{get each(){return n.items},children:({cfg:s,index:h})=>u(S,{get value(){return a.values()[h]??0},onChange:g=>a.onChange(s.id,g,h),get min(){return s.min},get max(){return s.max},get step(){return s.step},get curve(){return s.curve},get curveParam(){return s.curveParam},get label(){return s.label},get unit(){return s.unit}})})),D(()=>x(m,$.list)),m}}),null),D(()=>x(c,$.section)),c})()}),null),D(()=>x(t,$.bank)),t})()};F(["click"]);const ye=[{id:"cutoff",label:"Cutoff",min:20,max:2e4,curve:"exp",section:"Filter",unit:"Hz"},{id:"res",label:"Resonance",min:0,max:1,step:.01,section:"Filter"},{id:"attack",label:"Attack",min:0,max:5,step:.01,section:"Envelope",unit:"s"},{id:"decay",label:"Decay",min:0,max:5,step:.01,section:"Envelope",unit:"s"},{id:"sustain",label:"Sustain",min:0,max:1,step:.01,section:"Envelope"},{id:"release",label:"Release",min:0,max:5,step:.01,section:"Envelope",unit:"s"}],be=()=>{const[a,i]=d([8e3,.3,.05,.4,.7,1]);return u(fe,{sliders:ye,values:a,onChange:(r,e,l)=>i(t=>t.map((n,c)=>c===l?e:n)),title:"Synth",collapsedSections:[]})};var $e=p("<div style=display:flex;flex-direction:column;gap:8px;align-items:center><code style=font-size:11px;color:var(--fg-mute)>x=<!> y=");const Ce=()=>{const[a,i]=d([.5,.5]);return(()=>{var r=$e(),e=r.firstChild,l=e.firstChild,t=l.nextSibling;return t.nextSibling,o(r,u(j,{size:200,position:a,onMove:(n,c)=>i([n,c])}),e),o(e,()=>a()[0].toFixed(3),t),o(e,()=>a()[1].toFixed(3),null),r})()};var De=p("<div style=display:flex;flex-direction:column;gap:8px;align-items:center><code style=font-size:11px;color:var(--fg-mute)>x=<!> y=");const we=()=>{const[a,i]=d([.5,.5]);return(()=>{var r=De(),e=r.firstChild,l=e.firstChild,t=l.nextSibling;return t.nextSibling,o(r,u(V,{size:240,position:a,onMove:(n,c)=>i([n,c])}),e),o(e,()=>a()[0].toFixed(3),t),o(e,()=>a()[1].toFixed(3),null),r})()};var Se=p("<div style=display:flex;flex-direction:column;gap:10px;align-items:center>");const y=16;function Pe(a){const i=new Float32Array(y*y);for(let r=0;r<y;r++)for(let e=0;e<y;e++){const l=(e-y/2)/(y/2),t=(r-y/2)/(y/2),n=Math.sqrt(l*l+t*t),c=.5+.5*Math.sin(n*3+a*.5)*Math.cos(l*4+a);i[r*y+e]=Math.max(0,Math.min(1,c))}return i}const ke=()=>{const[a,i]=d("luminance"),[r,e]=d(0);let l;M(()=>{l=setInterval(()=>e(n=>n+1),200)}),T(()=>clearInterval(l));const t=P(()=>Pe(r()));return(()=>{var n=Se();return o(n,u(I,{samples:t,resolution:y,get colorMode(){return a()},size:240,showGrid:!1}),null),o(n,u(k,{options:[{value:"luminance",label:"Luminance"},{value:"variance",label:"Variance"},{value:"divergence",label:"Divergence"}],value:a,onChange:c=>i(c)}),null),n})()};var Me=p("<div style=display:flex;flex-direction:column;gap:6px>");const Te=()=>{const[a,i]=d(0);let r=0,e=performance.now();const l=n=>{n-e>80&&(i(c=>c+1),e=n),r=requestAnimationFrame(l)};M(()=>{r=requestAnimationFrame(l)}),T(()=>cancelAnimationFrame(r));const t=P(()=>{const n=a(),c=new Float32Array(126);for(let m=0;m<c.length;m++)c[m]=.5+.5*Math.sin(n*.05+m*.21);return c});return(()=>{var n=Me();return o(n,u(L,{values:t,width:320,height:80}),null),o(n,u(L,{values:t,width:320,height:28,compact:!0}),null),n})()},Fe=()=>{const[a,i]=d(3),[r,e]=d(.0123),[l,t]=d(!1),[n,c]=d([]),m=()=>{t(!0),setTimeout(()=>{e(Math.random()*.05),t(!1)},250)};return u(q,{onTrain:m,onRandomize:()=>e(.5),onThumbsUp:()=>{c(s=>[...s,a()]),i(s=>s+1),m()},onThumbsDown:()=>{c(s=>[...s,a()]),e(s=>(s??0)*1.4)},onUndo:()=>{const s=[...n()],h=s.pop();h!==void 0&&i(h),c(s)},exampleCount:a,lastLoss:r,busy:l,canUndo:()=>n().length>0})};var ze=p("<p>Slides in from the left."),He=p("<p>Press Escape, click outside, or click × to close."),Ae=p("<p>Slides in from the right."),Re=p("<p>Mode-specific drawers will use this primitive."),Ee=p("<div style=display:flex;gap:8px;flex-wrap:wrap><button type=button>Open Left</button><button type=button>Open Right");const Le=()=>{const[a,i]=d(!1),[r,e]=d(!1);return(()=>{var l=Ee(),t=l.firstChild,n=t.nextSibling;return t.$$click=()=>e(!0),n.$$click=()=>i(!0),o(l,u(B,{get open(){return r()},onClose:()=>e(!1),side:"left",title:"Left drawer",get children(){return[ze(),He()]}}),null),o(l,u(B,{get open(){return a()},onClose:()=>i(!1),side:"right",title:"Right drawer",get children(){return[Ae(),Re()]}}),null),l})()};F(["click"]);var Be=p("<div style=display:flex;flex-direction:column;gap:10px;min-width:320px>");const Ne=()=>{const[a,i]=d(.5),[r,e]=d(.7),[l,t]=d(.3),[n,c]=d("default"),m=()=>c(null);return(()=>{var s=Be();return o(s,u(H,{label:"Boldness",value:a,onChange:h=>{i(h),m()},preset:n,endpoints:["Caution","Bold"],accentColor:"var(--accent)",onDoubleTap:()=>i(.5)}),null),o(s,u(H,{label:"Memory",value:r,onChange:h=>{e(h),m()},preset:n,endpoints:["Amnesia","Elephant"],accentColor:"var(--accent-2)",onDoubleTap:()=>e(.5)}),null),o(s,u(H,{label:"Precision",value:l,onChange:h=>{t(h),m()},preset:n,endpoints:["Raw","Precise"],accentColor:"var(--good)",onDoubleTap:()=>t(.3)}),null),s})()};var Oe=p("<div style=display:flex;gap:12px;align-items:center>");const je=()=>{const[a,i]=d(0);let r;return M(()=>{r=setInterval(()=>{i(e=>(e+.02)%1)},50)}),T(()=>clearInterval(r)),(()=>{var e=Oe();return o(e,u(A,{progress:a,size:32}),null),o(e,u(A,{progress:a,size:48,color:"var(--accent-2)"}),null),o(e,u(A,{progress:a,size:64,color:"var(--good)",showLabel:!0}),null),e})()};var Ve=p("<div style=display:flex;flex-direction:column;gap:10px;align-items:flex-start>");const Ie=()=>{const[a,i]=d("synth"),[r,e]=d("m");return(()=>{var l=Ve();return o(l,u(k,{options:[{value:"visual",label:"Visual"},{value:"synth",label:"Synth"},{value:"midi",label:"MIDI CC"}],value:a,onChange:i}),null),o(l,u(k,{options:[{value:"s",label:"S"},{value:"m",label:"M"},{value:"l",label:"L"},{value:"xl",label:"XL"}],value:r,onChange:e}),null),l})()},qe={name:"osc1_freq",label:"Osc 1 Freq",hardMin:20,hardMax:8e3,default:440,curve:"exp",group:"oscillators"},Je=()=>{const[a,i]=d({min:100,max:2e3,curve:"exp",muted:!1,pinned:!1,fixedValue:440});return u(J,{param:qe,override:a,onChange:i})};var Ge=p("<div style=display:flex;flex-direction:column;gap:8px;align-items:flex-start><button type=button>");const Ue=()=>{const[a,i]=d(.5),[r,e]=d([.5,.5]),[l,t]=d([]),[n]=d([{id:"p1",x:.6,y:.5,width:.18,height:.18,colorSlot:0},{id:"p2",x:.18,y:.18,width:.12,height:.12,colorSlot:1}]),[c,m]=d(!1);let s=0,h=performance.now();const g=()=>{const v=(performance.now()-h)/1e3,_=.5+.4*Math.sin(v*.4),f=.5+.4*Math.cos(v*.65);e([_,f]),t(C=>[...C,{x:_,y:f,t:performance.now()}].slice(-200)),s=requestAnimationFrame(g)};return M(()=>{s=requestAnimationFrame(g)}),T(()=>cancelAnimationFrame(s)),(()=>{var v=Ge(),_=v.firstChild;return o(v,u(G,{size:220,zoom:a,anchor:r,position:r,trail:l,regionPins:n,noiseRings:()=>[.18,.06],onTrailTap:f=>e([f.x,f.y]),frozen:c}),_),o(v,u(S,{get value(){return a()},onChange:i,min:.01,max:1,label:"zoom"}),_),_.$$click=()=>m(f=>!f),o(_,()=>c()?"Unfreeze":"Freeze"),v})()};F(["click"]);var Xe=p("<div style=display:flex;flex-direction:column;gap:8px;align-items:flex-start>");const We=()=>{const[a,i]=d("healthy"),r=P(()=>{const e=new Array(10).fill(0),l=a();if(l==="dead")e[0]=80,e[1]=12,e[2]=4,e[3]=2;else if(l==="saturating")e[7]=12,e[8]=24,e[9]=60;else for(let t=0;t<10;t++)e[t]=30*Math.exp(-Math.pow((t-4.5)/2.5,2));return e});return(()=>{var e=Xe();return o(e,u(U,{histogram:r,status:a}),null),o(e,u(k,{options:[{value:"healthy",label:"Healthy"},{value:"dead",label:"Dead"},{value:"saturating",label:"Saturating"}],value:a,onChange:l=>i(l)}),null),e})()};var Ye=p("<div style=display:flex;flex-direction:column;gap:8px;align-items:flex-start>");const Ze=()=>{const[a,i]=d("healthy"),r=P(()=>{const l=a();return l==="vanishing"?[1,.4,.15,.04]:l==="exploding"?[.4,.8,1.6,3.2]:[.6,.55,.5,.5]}),e=P(()=>{const l=a();return l==="vanishing"?["healthy","vanishing","vanishing","vanishing"]:l==="exploding"?["healthy","healthy","exploding","exploding"]:["healthy","healthy","healthy","healthy"]});return(()=>{var l=Ye();return o(l,u(X,{layerNorms:r,status:e}),null),o(l,u(k,{options:[{value:"healthy",label:"Healthy"},{value:"vanishing",label:"Vanishing"},{value:"exploding",label:"Exploding"}],value:a,onChange:t=>i(t)}),null),l})()};var Ke=p("<div style=display:flex;flex-direction:column;gap:8px><button type=button>Reset");const Qe=()=>{const[a,i]=d([]);let r,e=0;return M(()=>{r=setInterval(()=>{e+=1;const l=.5*Math.exp(-e*.04)+.005+.02*Math.random();i(t=>[...t,l].slice(-200))},80)}),T(()=>clearInterval(r)),(()=>{var l=Ke(),t=l.firstChild;return o(l,u(W,{history:a,log:!0}),t),t.$$click=()=>{i([]),e=0},l})()};F(["click"]);var et=p("<div><header><h1>Primitive Library</h1><p>Each card is a live demo. Use this page as a sanity-check during the rewrite. Modes (stream 9) and feature parity (stream 10) compose these primitives.</p></header><div>"),tt=p("<article><header><h2></h2><p></p></header><div>");const nt=[{name:"Slider",description:"Single-value slider with optional curve mapping.",Demo:ie},{name:"SliderBank",description:"Vertical stack with collapsible sections.",Demo:be},{name:"VirtualJoystick",description:"Touch + pointer 2D input, returns [0,1]^2.",Demo:Ce},{name:"XYPad",description:"Rectangular 2D input pad.",Demo:we},{name:"Heatmap",description:"NxN colored grid, three color modes.",Demo:ke},{name:"OutputDisplay",description:"Bar chart of N output values.",Demo:Te},{name:"TrainingControls",description:"RL feedback + status panel.",Demo:Fe},{name:"Drawer",description:"Slide-in panel from left/right.",Demo:Le},{name:"ControlAxis",description:"Compound axis slider (Boldness/Memory/Precision shape).",Demo:Ne},{name:"ProgressRing",description:"Circular progress indicator.",Demo:je},{name:"PillToggle",description:"Segmented control.",Demo:Ie},{name:"ParamEditor",description:"Range/curve/mute/pin for one parameter.",Demo:Je},{name:"JoyMap",description:"Zoom minimap with trail, noise rings, region pins.",Demo:Ue},{name:"WeightHealth",description:"Histogram with status glow.",Demo:We},{name:"GradientFlow",description:"Per-layer gradient bars.",Demo:Ze},{name:"LossPlot",description:"Training-loss line chart over time.",Demo:Qe}],lt=()=>(()=>{var a=et(),i=a.firstChild,r=i.firstChild,e=r.nextSibling,l=i.nextSibling;return o(l,u(R,{each:nt,children:t=>(()=>{var n=tt(),c=n.firstChild,m=c.firstChild,s=m.nextSibling,h=c.nextSibling;return o(m,()=>t.name),o(s,()=>t.description),o(h,()=>t.Demo({})),D(g=>{var v=b.card,_=b.cardHead,f=b.cardTitle,C=b.cardDesc,w=b.cardBody;return v!==g.e&&x(n,g.e=v),_!==g.t&&x(c,g.t=_),f!==g.a&&x(m,g.a=f),C!==g.o&&x(s,g.o=C),w!==g.i&&x(h,g.i=w),g},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),n})()})),D(t=>{var n=b.root,c=b.header,m=b.lede,s=b.grid;return n!==t.e&&x(a,t.e=n),c!==t.t&&x(i,t.t=c),m!==t.a&&x(e,t.a=m),s!==t.o&&x(l,t.o=s),t},{e:void 0,t:void 0,a:void 0,o:void 0}),a})();export{lt as default};
|
||
//# sourceMappingURL=PrimitivesShowcase-D2lYbVrQ.js.map
|