← Commit history

Seed the registry (adom/wiki#152): the four component-widgets, schema docs, the tag contract

Colby Knox ·1d09e85c81 ·1mo ago ·parent 2ead457
2 files changed +58−1
README.md+44−1
@@ -1,3 +1,46 @@ # Widget Registry -The reviewed registry of widgets renderable from plain markdown on any wiki page+The reviewed list of widgets any wiki page can render from plain markdown (adom/wiki#152). Only widgets in `widgets.json` on THIS page render; adding one is an edit someone reads. That list is the entire trust model, so this page stays org-owned.++## Using a widget++On its own line in any `README.md`:++```markdown+::adom-pinout{src="/ray/stm32f103c8t6/render/pinout.json" layout="dual"}+```++It renders in place as a sandboxed frame: opaque origin, storage shimmed, `connect-src` limited to the wiki (plus a backend widget's registered origin). An unregistered tag renders as nothing for readers; pushing a README with one gets a `WIDGET_TAG_UNREGISTERED` hint.++Data files: pass `src` as an absolute path on the wiki, usually your own page's render route (`/OWNER/SLUG/render/FILE.json`). Relative paths resolve against the widget frame's route and will not find your file.++## Registering a widget++Append an entry to `widgets.json`:++```json+{ "name": "adom-example", "mode": "frontend",+  "script": "https://wiki.adom.inc/OWNER/SLUG/render/widget.js",+  "element": "adom-example", "attrs": ["src"] }+```++- `name`: the markdown tag (slug-safe, max 32 chars)+- `mode`: `frontend` (wiki-served script) or `backend` (adds `origin`)+- `script`: https URL of the script that defines the custom element+- `element`: the dashed custom-element name the script defines+- `attrs`: allowlist of attributes the tag may set (escaped, length-capped); anything else in a tag is dropped+- `origin` (backend only): the PUBLIC https origin the frame's `connect-src` widens to; the widget_connect rules apply (no IP literals, loopback, or private TLDs)+- `height`: `auto` (default, frames self-report via readme-height) or a fixed pixel number++Registry caps: 32 widgets, 12 attrs each. A malformed entry is dropped, never breaks rendering.++## Current widgets++All four load from adom/component-widgets and take a JSON `src`:++| tag | shows |+|---|---|+| `::adom-pinout{src="..."}` | interactive pinout diagram |+| `::adom-chip-thumbnail{src="..."}` | chip render thumbnail |+| `::adom-molecule{src="..."}` | molecule viewer |+| `::adom-heatsink-via{src="..."}` | thermal via layout |
widgets.jsonadded+14
@@ -0,0 +1,14 @@+[+  { "name": "adom-pinout", "mode": "frontend",+    "script": "https://wiki.adom.inc/adom/component-widgets/render/widgets/pinout-widget.js",+    "element": "adom-pinout", "attrs": ["src", "layout", "heading"] },+  { "name": "adom-chip-thumbnail", "mode": "frontend",+    "script": "https://wiki.adom.inc/adom/component-widgets/render/widgets/chip-thumbnail-widget.js",+    "element": "adom-chip-thumbnail", "attrs": ["src", "mpn", "package"] },+  { "name": "adom-molecule", "mode": "frontend",+    "script": "https://wiki.adom.inc/adom/component-widgets/render/widgets/molecule-widget.js",+    "element": "adom-molecule", "attrs": ["src"] },+  { "name": "adom-heatsink-via", "mode": "frontend",+    "script": "https://wiki.adom.inc/adom/component-widgets/render/widgets/heatsink-via-widget.js",+    "element": "adom-heatsink-via", "attrs": ["src"] }+]