memlnaut-nisps/playground/dist/assets/PrimitivesShowcase-D2lYbVrQ.js

3 lines
13 KiB
JavaScript
Raw Normal View History

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,
//# sourceMappingURL=PrimitivesShowcase-D2lYbVrQ.js.map