Block · Features
Patch Bay
A rack panel of jacks with a cable hanging from each source. Carry a plug to where the events should go and it seats with a click; the lamp beside it lights for every event the cable carries.
- Version
- 0.1.0
- Size
- 102.0 KB gzipped
- Access
- With a Pass
- Needs
- patch-bay.mjs + patch-bay.css
- Tests
- 5 tests · 11 states
On this page
Use it
An integrations or routing section that shows what the product does by letting the visitor do it: sources on the left, destinations on the right, one real cable per source to move. Each route is a cable with length and weight that settles into a catenary; a live counter and flashing lamps prove the routes carry something. Every jack is a button: press a source, then a destination; Escape lets a cable hang; the status line says every change.
Copy the patch-bay folder from its package next to your page, link the stylesheets and mount it on an element. Every option has a default; the lab’s Code tab writes the same example at any settings, and for React, Vue, Svelte or a custom element (Using a framework).
<link rel="stylesheet" href="patch-bay/patch-bay.css">
<div id="patch-bay"></div>
<script type="module">
import { mount } from './patch-bay/patch-bay.mjs';
const patchBay = mount(document.getElementById('patch-bay'), {
eyebrow: 'Routes',
heading: 'Patch it in and it runs.',
lede: 'Every source is a jack and so is every place it can go. A cable is a route; the lamp beside it lights for each event it carries. There is no flowchart to draw.',
});
// patchBay.update({ … }); change any option in place
// patchBay.destroy(); and take it away again
</script>Options
| Option | Type | Default | What it does |
|---|---|---|---|
| eyebrow | text | 'Routes' | Eyebrow |
| heading | text | 'Patch it in and it runs.' | Headline |
| lede | text | 'Every source is a jack and so is every place it can go. A cable is a route; the lamp beside it lights for each event it carries. There is no flowchart to draw.' | Lead |
| routes | three · all · none | 'three' | Three cables in and Support hanging loose; all four in; or every cable hanging, waiting for a hand. |
| tally | number, 0 to 999999 | 12480 | Where the counter starts; every event a cable carries adds one. |
| tallyLabel | text | 'Delivered today' | Counter label |
| finish | auto · aluminium · graphite | 'auto' | Auto follows the page’s data-finish, then the visitor’s system. |
| sound | boolean | false | Synthesised, no audio file: a plug seats with a click and a thunk, pulls out with a pop, and a taken jack knocks. Only after a hand moves a cable. |
Methods
mount(element, options)- Builds the block inside the element and returns its handle.
handle.update(next = {})- Change options in place.
handle.routeshandle.tallyhandle.cableshandle.destroy()- Stops it and cleans up after it.
Events it fires, which bubble from the element: change.
States
- At restCables hang still in their curves; the lamps of fed destinations are lit; nothing runs.
- CarriedThe plug follows the hand, the cable swings after it, and the jack under it is ringed.
- SeatedThe plug seats (with sound on: a click and a thunk), the cable swings into its curve, the lamp lights, the status line says so.
- HangingDropped in the air, the cable falls from its source and the spare lies on the desk below the panel.
- RefusedA jack that already holds a cable refuses a second (with sound on: a knock); the status line names the cable in it.
- SignalEvents arrive at each source's rate; each one down a cable flashes the destination's lamp and adds one to the lit counter.
- KeyboardA source jack picks its cable up; a destination seats it; Escape lets it hang; Delete pulls a source's plug.
- AluminiumA bead-blasted panel with screws, a reflective LCD counter, dark cables first.
- GraphiteA soft-touch panel, a vacuum-fluorescent counter, light cables first.
- Off screen or hiddenNo loop and no events.
- Reduced motionCables are drawn at rest at once; lamps are steady.
How it works
Made of: Verlet cable, Catenary settle, Floor contact, Route table, Two step keyboard patch, Poisson events, Container query layout, Finish following, Sleeping loop.
Original. The routes, sources and destinations are placeholders for an invented event router. Cables are Verlet chains of fixed length drawn on one canvas; the jacks are buttons. Fonts: Instrument Sans and Geist Mono, both OFL 1.1, shipped as WOFF2 with their licences.