create custom logic nodes for the scavenger patchbay - each node is a tiny program - init / onReceive / teardown over the ctx api
build it here, test it in the rig, then export a .scv - a self-contained file that holds your node's full definition in plain html
drop it on the patchbay to register it and place an instance - nodes run arbitrary js - treat any .scv file and bay like a program
to update every node instance keeping its wiring intact, re-drop the updated .scv onto the board - every instance will live update
init(ctx)called once when the node connectsonReceive(value, ctx)called when a value arrives on the wireteardown(ctx)called when the node is removedplaceholder: 'text'input placeholder (default none)openWidth: 400node width in px when openlabel: 'text'hover tooltip (modes override)inputType: 'number''text' or 'number'ctx.emit(v)sends a value through the wirectx.showFloat(v)shows overlay text above nodectx.flashError(label, err)flashes red border + console warnctx.valuethe node's stored valuectx.append(el, x, y)adds an element to the boardctx.remove(el)removes a spawned elementctx.el / ctx.icon / ctx.inputthe node's root / icon / inputctx.el.classListtoggle state classes: .active .node-pulse .scv-node-errorctx.id / ctx.typeunique id / registered type namectx.x / ctx.yx/y position on the boardctx.setPosition(x, y)repositions the nodemodes: [{id, icon, label, color}]declares toggleable node modesctx.modethe active mode idonMode(id, ctx)called when the mode changes
author live html components for the scavenger patchbay - <div> / <style> / <script> - compile wraps it in a self-contained element
build it here, test it in the rig, then export a .scv - a self-contained file holding your component's full definition in plain html
drop it onto the patchbay to register it and place an instance - authored components keep their scripts and can run arbitrary js code
to update every instance keeping data and wiring intact, re-drop the updated .scv on the board - instances update to the new template
data-scv-slot="name"marks a field's data - kept across a re-drop, matched by nametext > htmleditable text captured as htmlimg > srcan image keeps its sourceinput > valuea field keeps its valuecheckbox > checkeda toggle keeps its stateunmarkedpure layout - replaced freely on re-droprootthe shadow root - query and mutate your markuphostelement itself - listen for scv-receive to take wired valueemit(v)sends a value out the wireaddEventListenerbind events here - on* is stripped, delegate on root to survive a re-dropdata-scv-emits="ch"the element's output - its value travels out on channel chdata-scv-receives="ch"an input - values on channel ch land in the elementdata-scv-action="ch"runs the element when a signal arrives on ch