From 1c50cc1467426c8963c9716d85460da9b198bee3 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 12 Jul 2026 22:57:03 -0500 Subject: docs(gallery): document widgets.js consumer API; close extraction phase README gains a widget-library section covering the GW builder contract, GW_CSS styling, the tick contract for live meters, named style options, and the CDP probes. The stray waybar-redesign bullet moves back to the prototypes list. todo.org Phase 1 closes as a dated entry. --- docs/prototypes/README.org | 59 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) (limited to 'docs/prototypes') diff --git a/docs/prototypes/README.org b/docs/prototypes/README.org index 674a45d..651636a 100644 --- a/docs/prototypes/README.org +++ b/docs/prototypes/README.org @@ -18,7 +18,62 @@ point at. - [[file:panel-widget-gallery.html][panel-widget-gallery.html]] — the shared instrument-console widget kit (lamps, engraved sections, console keys, needle gauges). The living catalogue: every widget here is the visual + behavioral spec for - its reusable-component ports. + its reusable-component ports. All widgets build from [[file:widgets.js][widgets.js]] (below); + the gallery page is the reference consumer. +- [[file:2026-07-03-waybar-redesign-prototype.html][2026-07-03-waybar-redesign-prototype.html]] — three directions for sprucing up + waybar in the dupre instrument-console aesthetic (future work). + +* Widget library ([[file:widgets.js][widgets.js]]) + +The whole kit lives in =widgets.js= — a classic script (no modules, no build +step) exposing the =GW= namespace with one builder per gallery card. Load it +with == and call builders directly. + +** Builder contract + +=GW.name(host, opts)= → handle ={el, get, set, ...}=. =host= is an empty +element the widget renders into. =opts.onChange(value, text)= fires on every +state change, including the initial paint; =text= is the widget's canonical +readout string. (Exception: live meters whose original init was silent — they +paint on the first =set=/=push=.) + +** Styling + +Widget-internal CSS ships inside =widgets.js= (the =GW_CSS= block, injected +once as =