@web-noise/core 0.0.16-alpha.1 → 0.0.16-alpha.2
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.
- package/dist/cjs/components.js +1 -1
- package/dist/cjs/components.js.map +1 -1
- package/dist/esm/components.js.map +1 -1
- package/dist/main.js +16 -16
- package/dist/main.js.map +1 -1
- package/dist/module.js +5 -5
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/module.js
CHANGED
|
@@ -254,7 +254,7 @@ let e,o;import{jsx as t,jsxs as n,Fragment as r}from"react/jsx-runtime";import{w
|
|
|
254
254
|
height: 8rem;
|
|
255
255
|
`,e2=c.div`
|
|
256
256
|
font-size: 2rem;
|
|
257
|
-
`;var e3=({isOpen:e,closeMenu:o})=>{let r=eC();ex(({setGraph:e})=>e),ex(e=>e.setEditorState);let i=ex(e=>e.addFile),l=f(null),a=u(async e=>{let[t]=e||[],n=await eK(t);i({type:"audio",id:`audio-file-${+new Date}`,name:t.name,file:n}),o()},[i,o]);return e?t(eD,{onClose:o,children:n(eQ,{theme:r,children:[t("input",{onChange:({target:{files:e}})=>a(e),ref:l,type:"file",className:"hidden",style:{display:"none"},accept:".wav,.mp3,.ogg"}),t(K,{className:"drop-zone-wrapper",targetClassName:"drop-zone",draggingOverTargetClassName:"drop-zone-drag-over",onTargetClick:()=>{l.current?.click()},onDrop:e=>a(e),children:n(e0,{theme:r,children:[t(e1,{}),t(e2,{children:"click or drop file here"})]})})]})}):null};let e6="editor-menu";var e4=({editorContextMenu:e=[]})=>{let o=eC(),[i,l]=h({x:0,y:0}),[a,s]=h(!1),[d,c]=h(!1),p=u((e,o)=>{l({x:e,y:o}),s(!0)},[s]),f=ex(e=>e.pasteBuffer),{screenToFlowPosition:v}=S(),b=u(e=>{let{x:o,y:t}=v(e);f(o,t)},[s,v]),y=ex(({clearGraph:e})=>e),x=u(()=>{window.confirm("This action will delete all nodes in this patch. Continue?")&&y()},[y]),w=ex(e=>e.toggleHelp),C=ex(e=>e.history.back),k=ex(e=>e.history.forward),$=ex(e=>e.history.pointer),P=ex(e=>e.history.buffer),N=ex(e=>e.copySelectedItems),z=ex(e=>e.nodes),F=m(()=>z.filter(({selected:e})=>e),[z]),E=ex(e=>e.copyBuffer);return S(),g(()=>(Z("command+shift+a",()=>(p(200,50),!1)),Z("shift+/",()=>(w(),!1)),Z("command+z",()=>(C(),!1)),Z("command+shift+z",()=>(k(),!1)),Z("command+c",()=>(N(),!1)),Z("command+v",()=>(b({x:200,y:50}),!1)),()=>{Z.unbind()}),[p,b]),n(r,{children:[t(eq,{isOpen:a,closeMenu:()=>s(!1),mousePosition:i}),t(e3,{isOpen:d,closeMenu:()=>c(!1)}),n(eP,{id:e6,animation:!1,colors:o.colors,children:[t(ek,{onClick:({triggerEvent:{clientX:e,clientY:o}})=>p(e,o),children:"Add Node (⌘+⇧+A)"}),t(J,{}),t(e$,{onClick:x,children:"Delete All"}),t(J,{}),t(ek,{onClick:()=>c(!0),children:"Upload Audio File"}),t(J,{}),t(ek,{disabled:0===$,onClick:C,children:"Undo (⌘+z)"}),t(ek,{disabled:$===P.length,onClick:k,children:"Redo (⌘+⇧+Z)"}),t(J,{}),t(ek,{disabled:!F.length,onClick:N,children:"Copy Selected (⌘+c)"}),t(ek,{disabled:!E.nodes.length,onClick:({triggerEvent:{clientX:e,clientY:o}})=>b({x:e,y:o}),children:"Paste (⌘+v)"}),t(J,{}),e.map((e,o)=>null===e?t(J,{},o):t(ek,{children:e},o)),t(J,{}),t(ek,{onClick:w,children:"Help (⇧+?)"})]})]})};let
|
|
257
|
+
`;var e3=({isOpen:e,closeMenu:o})=>{let r=eC();ex(({setGraph:e})=>e),ex(e=>e.setEditorState);let i=ex(e=>e.addFile),l=f(null),a=u(async e=>{let[t]=e||[],n=await eK(t);i({type:"audio",id:`audio-file-${+new Date}`,name:t.name,file:n}),o()},[i,o]);return e?t(eD,{onClose:o,children:n(eQ,{theme:r,children:[t("input",{onChange:({target:{files:e}})=>a(e),ref:l,type:"file",className:"hidden",style:{display:"none"},accept:".wav,.mp3,.ogg"}),t(K,{className:"drop-zone-wrapper",targetClassName:"drop-zone",draggingOverTargetClassName:"drop-zone-drag-over",onTargetClick:()=>{l.current?.click()},onDrop:e=>a(e),children:n(e0,{theme:r,children:[t(e1,{}),t(e2,{children:"click or drop file here"})]})})]})}):null};let e6="editor-menu";var e4=({editorContextMenu:e=[]})=>{let o=eC(),[i,l]=h({x:0,y:0}),[a,s]=h(!1),[d,c]=h(!1),p=u((e,o)=>{l({x:e,y:o}),s(!0)},[s]),f=ex(e=>e.pasteBuffer),{screenToFlowPosition:v}=S(),b=u(e=>{let{x:o,y:t}=v(e);f(o,t)},[s,v]),y=ex(({clearGraph:e})=>e),x=u(()=>{window.confirm("This action will delete all nodes in this patch. Continue?")&&y()},[y]),w=ex(e=>e.toggleHelp),C=ex(e=>e.history.back),k=ex(e=>e.history.forward),$=ex(e=>e.history.pointer),P=ex(e=>e.history.buffer),N=ex(e=>e.copySelectedItems),z=ex(e=>e.nodes),F=m(()=>z.filter(({selected:e})=>e),[z]),E=ex(e=>e.copyBuffer);return S(),g(()=>(Z("command+shift+a",()=>(p(200,50),!1)),Z("shift+/",()=>(w(),!1)),Z("command+z",()=>(C(),!1)),Z("command+shift+z",()=>(k(),!1)),Z("command+c",()=>(N(),!1)),Z("command+v",()=>(b({x:200,y:50}),!1)),()=>{Z.unbind()}),[p,b]),n(r,{children:[t(eq,{isOpen:a,closeMenu:()=>s(!1),mousePosition:i}),t(e3,{isOpen:d,closeMenu:()=>c(!1)}),n(eP,{id:e6,animation:!1,colors:o.colors,children:[t(ek,{onClick:({triggerEvent:{clientX:e,clientY:o}})=>p(e,o),children:"Add Node (⌘+⇧+A)"}),t(J,{}),t(e$,{onClick:x,children:"Delete All"}),t(J,{}),t(ek,{onClick:()=>c(!0),children:"Upload Audio File"}),t(J,{}),t(ek,{disabled:0===$,onClick:C,children:"Undo (⌘+z)"}),t(ek,{disabled:$===P.length,onClick:k,children:"Redo (⌘+⇧+Z)"}),t(J,{}),t(ek,{disabled:!F.length,onClick:N,children:"Copy Selected (⌘+c)"}),t(ek,{disabled:!E.nodes.length,onClick:({triggerEvent:{clientX:e,clientY:o}})=>b({x:e,y:o}),children:"Paste (⌘+v)"}),t(J,{}),e.map((e,o)=>null===e?t(J,{},o):t(ek,{children:e},o)),t(J,{}),t(ek,{onClick:w,children:"Help (⇧+?)"})]})]})};let e8="editor-node-menu";var e9=e=>{let o=eC(),i=ex(e=>e.removeNodes),l=ex(e=>e.addNodeToControlPanel),a=ex(e=>e.removeNodeFromControlPanel),s=ex(e=>e.copy),d=ex(e=>e.nodesConfiguration),c=ex(e=>e.controlPanel.nodes),p=u(({props:e})=>!!e?.node.type&&!!c.find(({id:o})=>o===e.node.id),[c]),h=u(({props:e})=>{if(!e?.node.type)return!1;let o=d[e.node.type];return!!o?.controlPanelNode},[d]);return t(r,{children:n(eP,{id:e8,animation:!1,colors:o.colors,children:[t(ek,{onClick:e=>i([e.props.node]),children:"Delete Node (DEL)"}),t(ek,{hidden:(...e)=>!h(...e)||p(...e),onClick:e=>l(e.props.node),children:"Add To Control Panel"}),t(ek,{hidden:(...e)=>!h(...e)||!p(...e),onClick:e=>a(e.props.node),children:"Remove From Control Panel"}),t(ek,{onClick:e=>s({nodes:[e.props.node],edges:[]}),children:"Copy (⌘+c)"})]})})},e7=e=>ex(({patch:e})=>e).audioNodes.get(e),e5=e=>{let o=ex(({updateNodeData:e})=>e);return{updateNodeValues:u(t=>o(e,{values:t}),[e,o]),updateNodeConfig:u(t=>o(e,{config:t}),[e,o]),updateNodeLabel:u(t=>o(e,{label:t}),[e,o])}};let oe=c.input`
|
|
258
258
|
width: 100%;
|
|
259
259
|
background: none;
|
|
260
260
|
border: none;
|
|
@@ -636,7 +636,7 @@ let e,o;import{jsx as t,jsxs as n,Fragment as r}from"react/jsx-runtime";import{w
|
|
|
636
636
|
svg {
|
|
637
637
|
color: ${({theme:e})=>e.colors.elevation2};
|
|
638
638
|
}
|
|
639
|
-
`),o2=(e,o)=>console.log("drag stop",o),o3=(e,o)=>console.log("click",o),o6=[20,20],o4=({editorState:e,plugins:o=[],editorContextMenu:r=[],onChange:i=()=>{},...l})=>{let a=m(()=>({wire:o0}),[]),{nodes:s,edges:d,controlPanel:c,onNodesChange:p,onNodesDelete:f,onEdgesChange:v,onEdgesDelete:b,onConnect:y,setPlugins:x,setViewport:w,viewport:C}=ex(),k=ex(({config:e})=>e),$=ex(({nodeTypes:e})=>e);g(()=>{x(o)},[o]);let[P,N]=h(null);g(()=>{P&&i({nodes:s,edges:d,controlPanel:c,viewport:C})},[s,d,c,C]);let z=u(e=>{P||(N(e),console.log("flow loaded:",e))},[P]),{onContextMenu:M}=(()=>{let{show:e}=G({id:e6});return{onContextMenu:e}})(),{onContextMenu:S}=(()=>{let{show:e}=G({id:
|
|
639
|
+
`),o2=(e,o)=>console.log("drag stop",o),o3=(e,o)=>console.log("click",o),o6=[20,20],o4=({editorState:e,plugins:o=[],editorContextMenu:r=[],onChange:i=()=>{},...l})=>{let a=m(()=>({wire:o0}),[]),{nodes:s,edges:d,controlPanel:c,onNodesChange:p,onNodesDelete:f,onEdgesChange:v,onEdgesDelete:b,onConnect:y,setPlugins:x,setViewport:w,viewport:C}=ex(),k=ex(({config:e})=>e),$=ex(({nodeTypes:e})=>e);g(()=>{console.log(8888,o),x(o)},[o]);let[P,N]=h(null);g(()=>{P&&i({nodes:s,edges:d,controlPanel:c,viewport:C})},[s,d,c,C]);let z=u(e=>{P||(N(e),console.log("flow loaded:",e))},[P]),{onContextMenu:M}=(()=>{let{show:e}=G({id:e6});return{onContextMenu:e}})(),{onContextMenu:S}=(()=>{let{show:e}=G({id:e8});return{onContextMenu:u((o,t)=>{o.stopPropagation(),e(o,{props:{node:t}})},[])}})(),{onContextMenu:A}=(()=>{let{show:e}=G({id:eN});return{onContextMenu:u((o,t)=>{o.stopPropagation(),e(o,{props:{edge:t}})},[e])}})();return g(()=>{C&&P?.setViewport(C)},[C,P]),F({onEnd:w}),n(E,{nodes:s,edges:d,onNodesChange:p,onNodesDelete:f,onEdgesChange:v,onConnect:y,onNodeDragStop:o2,onEdgesDelete:b,onInit:z,onNodeClick:o3,onContextMenu:M,onNodeContextMenu:S,onEdgeContextMenu:A,nodeTypes:$,edgeTypes:a,snapGrid:o6,defaultViewport:e?.viewport,defaultEdgeOptions:{type:"wire"},snapToGrid:!0,fitView:!0,disableKeyboardA11y:!0,children:[t(j,{variant:D.Dots,gap:12}),k.showMinimap?t(T,{}):null,n(o1,{showInteractive:!1,position:"bottom-right",children:[t(oQ,{}),t(oX,{})]}),t(oK,{}),t(oO,{}),t(oG,{}),t(e4,{editorContextMenu:r}),t(e9,{}),t(ez,{})]})},o8=e=>t(M,{children:t(o4,{...e})}),o9={nodes:[],edges:[],controlPanel:{nodes:[],show:!1,size:{width:200,height:100}},viewport:{x:0,y:0,zoom:1.5}},o7=i(c.div`
|
|
640
640
|
display: flex;
|
|
641
641
|
flex-direction: column;
|
|
642
642
|
height: 100%;
|
|
@@ -677,7 +677,7 @@ let e,o;import{jsx as t,jsxs as n,Fragment as r}from"react/jsx-runtime";import{w
|
|
|
677
677
|
align-items: center;
|
|
678
678
|
justify-content: center;
|
|
679
679
|
font-size: 6rem;
|
|
680
|
-
`),tn=e=>{let o=ex(e=>e.pullEditorChanges),i=ex(e=>e.currentFileIndex),l=ex(e=>e.project),[a,s]=h(!0);g(()=>{e.onChange?.(l)},[l,e.onChange]),g(()=>{s(!0),setTimeout(()=>{s(!1)},1600)},[i]);let{file:d}=e;return d?"audio"===d.type?t(to,{children:t("audio",{src:d.file,controls:!0})}):n(r,{children:[t(
|
|
680
|
+
`),tn=e=>{let o=ex(e=>e.pullEditorChanges),i=ex(e=>e.currentFileIndex),l=ex(e=>e.project),[a,s]=h(!0);g(()=>{e.onChange?.(l)},[l,e.onChange]),g(()=>{s(!0),setTimeout(()=>{s(!1)},1600)},[i]);let{file:d}=e;return d?"audio"===d.type?t(to,{children:t("audio",{src:d.file,controls:!0})}):n(r,{children:[t(o8,{...e,onChange:e=>{o()},editorState:d.file||o9}),t(tt,{show:a,children:"Loading..."})]}):null},tr=i(c.div`
|
|
681
681
|
height: 2rem;
|
|
682
682
|
display: flex;
|
|
683
683
|
align-items: center;
|
|
@@ -721,7 +721,7 @@ let e,o;import{jsx as t,jsxs as n,Fragment as r}from"react/jsx-runtime";import{w
|
|
|
721
721
|
&:hover {
|
|
722
722
|
color: ${({theme:e})=>e.colors.whitePrimary};
|
|
723
723
|
}
|
|
724
|
-
`),td=()=>({file:
|
|
724
|
+
`),td=()=>({file:o9,name:"Unnamed",type:"patch",id:p()});var tc=({...e})=>{let{projectState:o,theme:r}=e,i=ex(e=>e.currentFileIndex),d=ex(e=>e.project.files[e.currentFileIndex]),c=ex(e=>e.setCurrentFileIndex),p=ex(e=>e.project),m=ex(e=>e.setProject),u=ex(e=>e.getProject),f=ex(e=>e.updateFileName),v=ex(e=>e.addFile),b=ex(e=>e.deleteFile),y=ex(e=>e.syncEditorWithCurrentFile),x=ex(e=>e.setEditorState);ex(e=>e.pullEditorChanges);let[w,k]=h(!1);return g(()=>{m(o||{files:[td()]});let e=o?.files[0];e?.file&&e?.type!=="audio"&&x(e.file)},[o]),g(()=>(C("project://*",async(...e)=>{let o=new Request(...e),t=u().files,n=o.url.replace("project://",""),r=t.find(({id:e})=>e===n);return r?ef(r)?new Response(JSON.stringify(r.file??null)):ev(r)?fetch(r.file):new Response(null):new Response(`File not found: ${o.url}`,{status:404})}),()=>{}),[u]),g(()=>{y()},[i,y]),n(l,{theme:r||ew,children:[t(a,{styles:s`
|
|
725
725
|
:root {
|
|
726
726
|
--leva-colors-elevation1: #292d39;
|
|
727
727
|
--leva-colors-elevation2: #181c20;
|
|
@@ -778,5 +778,5 @@ let e,o;import{jsx as t,jsxs as n,Fragment as r}from"react/jsx-runtime";import{w
|
|
|
778
778
|
--leva-fontWeights-folder: normal;
|
|
779
779
|
--leva-fontWeights-button: normal;
|
|
780
780
|
}
|
|
781
|
-
`}),n(o7,{onDragOver:e=>{e.preventDefault(),e.stopPropagation(),k(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),k(!1)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),k(!1),Array.from(e.dataTransfer.files).forEach(async e=>{if("application/json"===e.type){let o=JSON.parse(await e.text());if(o.files&&o.files.length){if(!window.confirm("This action will replace your current project. Continue?"))return;m(o),c(0),y();return}v({...td(),file:{...o,controlPanel:{...
|
|
781
|
+
`}),n(o7,{onDragOver:e=>{e.preventDefault(),e.stopPropagation(),k(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),k(!1)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),k(!1),Array.from(e.dataTransfer.files).forEach(async e=>{if("application/json"===e.type){let o=JSON.parse(await e.text());if(o.files&&o.files.length){if(!window.confirm("This action will replace your current project. Continue?"))return;m(o),c(0),y();return}v({...td(),file:{...o,controlPanel:{...o9.controlPanel,...o.controlPanel}},name:e.name},e.name);return}if(e.type.match(/^audio\//)){let o=await eK(e);v({type:"audio",id:`audio-file-${+new Date}`,name:e.name,file:o});return}console.error("Unsupported file type",e)})},children:[n(tr,{children:[p.files.map((e,o)=>n(ti,{onClick:()=>{c(o)},active:o===i,children:[t(oo,{onChange:e=>f(o,e),value:e.name||"Unnamed"}),t(ts,{onClick:e=>{e.stopPropagation(),window.confirm("Do you really want to delete this file?")&&(b(o),1===p.files.length&&(v(td()),c(0),y()))}})]},o)),t(tl,{onClick:()=>{v(td()),c(p.files.length)},children:t(ta,{})})]}),t(te,{children:t(tn,{file:d,...e})}),w&&t(o5,{children:"Drop file(s) to upload to the project"})]})]})};export{tc as Editor,o9 as EDITOR_DEFAULTS,o0 as Wire,ok as WNNode,ow as TitleBar,op as PortsPanel,og as OutputPorts,ox as OutputHandle,oh as InputPorts,ob as InputHandle,om as Port,eD as Modal,oo as EditableLabel,e7 as useAudioNode,e5 as useNode,eC as useTheme,ex as useStore,ew as theme,ev as isAudio,ef as isPatch,ey as PortType};
|
|
782
782
|
//# sourceMappingURL=module.js.map
|