The shared look and the shared plumbing for fee[dB]ack plugins. Vendored, not depended on.
The rules it enforces are in DESIGN.md: that file is the point of this repository. The code just saves typing.
And assets/gallery.html is how you check the code
against them: every component in every state on one page, with two buttons that
prove what the prose can only assert, No devices strips the glow, the
gradient and the shadows the way a glow-less shop skin does, and Still kills
the motion. Nothing may vanish under either. Serve it from any consuming
plugin, since it is a plain file under assets/:
http://localhost:8000/api/plugins/<id>/assets/gallery.html
assets/gallery.html, rendered at 2x. The two switches at the top are the
ones that prove the rules: No devices strips the glow, the gradients and the
shadows; Still kills the motion.
| Plugin | What it draws with the kit |
|---|---|
| Live Tab | the in-player panel and the whole settings screen |
| Riff Repeater | the drill panel, racks, wells, steppers, the ladder rail, the footswitch, and its settings screen |
Both carry their own copy under src/kit/ and assets/kit.css. If you change
something here, the plugins do not get it until somebody re-vendors it, and
that is deliberate: see below.
Four plugins had each written the same things, differently:
| Where it was written | Cost | |
|---|---|---|
the token bridge, read feedBack.theme.get(), write prefixed vars, follow theme:changed, gate reduced motion |
tidy/src/theme.js 62 lines · riffrepeater/src/theme.js 65 lines · Live Tab's ink()/inkOn() building inline style strings |
three times, three shapes |
| the parked panel and its rail-slot button | riffrepeater/src/ui/mount.js 155 lines · Live Tab ~410 lines across mountControls/panelCSS/repaintControls |
twice, one after two bug reports |
| the settings-panel retry dance | tidy/settings.html:98 and riffrepeater/settings.html:231 |
identical line for line |
| the control taxonomy | Riff Repeater in CSS · Live Tab as style.cssText strings · Crate its own way |
three languages for the same controls |
And the same class of bug kept recurring in each of them. Number(null) is 0
and 0 passes Number.isFinite, so "absent" silently became "zero", a stored
best of 0% on a never-measured passage, an accuracy band colouring red for
"never played", a stepper jumping to its minimum when handed null. Four
instances across two repositories. There is now one num() in
src/controls.js and every number in the kit goes through it.
There is no shared-library mechanism in this host: no import maps, no guaranteed plugin load order, and a plugin can be disabled or simply not installed. A runtime dependency on another plugin means every consumer breaks when one of them is switched off.
So the kit is copied into each plugin and its version is stamped in the header of every file. A plugin stays self-contained: install it, it works.
# from the plugin's root
mkdir -p src/kit
cp -r ../feedBack-plugin-kit/src/*.js src/kit/
cp ../feedBack-plugin-kit/assets/kit.css assets/kit.cssOr as a subtree, if you would rather git tracked it:
git subtree add --prefix src/kit https://github.com/cracklydisc/feedBack-plugin-kit main --squash
# later
git subtree pull --prefix src/kit https://github.com/cracklydisc/feedBack-plugin-kit main --squashEither way assets/kit.css has to be a real file in the plugin, because
install() loads it from the plugin's own asset route, which is exactly
why there is no cross-plugin dependency to break.
import * as kit from './kit/index.js';
kit.install({ id: 'myplugin', version: '1.2.0' }); // stylesheet + theme bridge
const panel = kit.createPanel({
id: 'myplugin',
label: '⏱ My Plugin',
title: 'What this does',
});
panel.attach();
const { controls: c } = kit;
panel.body.appendChild(c.section('What to loop'));
const mode = c.segmented(
[{ value: 'a', label: 'Section' }, { value: 'b', label: 'Bars' }],
(v) => setMode(v),
'Loop grain',
);
panel.body.appendChild(mode.el);
mode.set('a');
/*
* Policy, what you set once and live with, goes in a fold, so it is in the
* panel without being in its default view. The summary keeps the value
* visible; DESIGN.md §15 says why that distinction matters more than it looks.
*/
const how = c.fold({ title: 'How you drill', summary: '80 → 90 → 100' });
how.body.appendChild(myLadderRow);
panel.body.appendChild(how.el);
const off = kit.shortcuts.register(
[{ key: 'd', description: 'do the thing', handler: doTheThing }],
{ name: 'My Plugin', scope: 'player' },
);
// teardown, for plugin-runtime-idempotent.v1
off();
panel.detach();
kit.uninstall('myplugin');A plugin manifest's styles takes one path, so keep declaring your own sheet;
install() injects the kit's alongside it:
{ "styles": "assets/myplugin.css", "scriptType": "module" }Bump the plugin's version whenever either stylesheet changes, both are
cache-busted with ?v=<version>.
| File | |
|---|---|
DESIGN.md |
the rules. Read this one. Three parts: the foundations (the type, space and height scales), the twenty-three rules, and a component reference that says when not to use each class. §15 is the one worth reading first: how to spot a control that is in the wrong tense. §17 is why the height scale changes under a finger. |
assets/gallery.html |
every component in every state, with the two degradation switches |
src/theme.js |
the token bridge: host --fb-* roles → --fbk-* roles, plus the Layer 2 device recipes the host has proposed but not yet shipped |
assets/kit.css |
the panel, the four control families, meters, badges, key caps. No literal colour, no literal glow, no literal gradient, no literal measurement: three tests read this file and enforce all of it |
src/panel.js |
the parked panel and the button in the player's plugin-control slot |
src/controls.js |
builders for the four families, plus num(), band(), readouts, meter rows and fold() |
src/shortcuts.js |
window.registerShortcut with teardown, and taken() so you can check before choosing a key |
src/settings-mount.js |
the settings-panel retry dance |
node --test tests/*.test.js70 tests, no dependencies, no build step, no jsdom, the DOM the builders need is a stub small enough to read. What is pinned is the logic: which control lights up for which state, that an absent number never colours as a failure, that a stepper cannot leave its bounds, and, by reading the source, that no device is written as a literal and no pixel value is off the scales. That last one has an allowlist of the genuine geometry constants (a toggle's 13px knob in its 19px track), so adding one is a deliberate act rather than a drift.
Every role in src/theme.js derives from feedBack.theme.get(), and every
device is a slot named the way core's own docs/host-theme-contract.md
proposes. When the host finally ships static/v3/theme-contract.css, the kit's
Layer 2 becomes a thin alias layer rather than code to throw away. It is not a
fork of the app's design system; it is an early implementation of it.
AGPL-3.0-or-later, matching fee[dB]ack. See LICENSE.
