← Commit history

wiki-component: component states (adom/component-states@1, states.json, ::adom-states); LEDs need off and on models

John Lauer ·58bbb5ca8a ·18d ago ·parent 670ac57
1 file changed +46−1
skills/wiki-component/SKILL.md+46−1
@@ -725,11 +725,56 @@ from the datasheet and redistribute it, but it must be exact:  ## Component widgets live in the adom org -Widgets meant for every component page (`adom-verified`, `adom-models`, `adom-footprint-variants`, pinout,+Widgets meant for every component page (`adom-verified`, `adom-models`, `adom-states`, `adom-footprint-variants`, pinout, chip thumbnail, heat-sink via, molecule, table) live in **adom/component-widgets**, with the tools that write their JSON in its `tools/`, and are registered in adom/widgets. Never host an ecosystem widget on a personal page (john/...): build it there and move it before anyone embeds it (John, 2026-10-04). +## Component states: `states.json` and the `::adom-states` widget (LEDs: off and on)++A part that LOOKS different when it is working carries one 3D model per state, so a viewer, a board render or a+probing simulation can show it as it should look (John, 2026-10-06). **Every LED page must have it**: almost every+board has LEDs, and the probing simulator (adom-aiflow-probing `states`) reads it to show each LED off or lit in+every planned test. Other kinds (a relay open and closed, a switch, a display segment) use the same file.++The file, `states.json` at the page root (schema `adom/component-states@1`), with `component.states: "states.json"`+in page.json:++```json+{ "schema": "adom/component-states@1", "mpn": "IN-S63BTG", "kind": "led", "default": "off",+  "states": [+    { "id": "off", "label": "Off", "summary": "No current: the clear lens as built, unlit.",+      "models": { "step": "IN-S63BTG-uncoloured.step", "glb": "states/IN-S63BTG-off.glb" },+      "image": "states/IN-S63BTG-state-off.png",+      "when": { "text": "no forward current (unpowered, reverse biased, or below about 0.1 mA)" } },+    { "id": "on", "label": "On (green, 527 nm)", "summary": "Forward current flowing: the lens lit green.",+      "models": { "step": "IN-S63BTG.step", "glb": "states/IN-S63BTG-on.glb" },+      "image": "states/IN-S63BTG-state-on.png",+      "look": { "lit": "the materials the off model does not have (the lens)", "emissive_strength": 1.3, "glow": "#46e08a", "light": "point" },+      "when": { "forward_current_mA": [0.1, 25], "text": "forward current A to K above about 0.1 mA, up to 25 mA; (rail - Vf) / R sets it" } } ],+  "electrical": { "vf_V": 3.2, "if_max_mA": 25, "lambda_d_nm": 527, "source": "datasheet p.2, p.3" },+  "pins": { "anode": "2", "cathode": "1" } }+```++Rules (an LED page is not done without them):+- **Two models, one per state, each with its own STEP and GLB.** Off = the plain model: the lens as built, unlit+  (clear, white or the tinted epoxy the part really has). On = the coloured model: the lens in the emitted colour+  (hue from the datasheet's dominant wavelength). The on model differs from the off model ONLY in the lens+  materials: viewers find the glowing parts by that difference, so the terminals and the body must be identical.+- **Check, never trust a slot name:** `model_3d_plain` once pointed at a green GLB. Open both GLBs and confirm off+  is unlit and on is coloured before you write the file.+- **`look`** says how a viewer lights the on state (emissive strength, glow colour, a small point light). **`when`**+  is the rule a simulator uses (forward current window) plus a sentence for people. **`electrical`** carries Vf,+  If max and the dominant wavelength with datasheet pages; the simulator computes (rail - Vf) / R from it and+  warns when an LED runs dim (under about 2 mA).+- **`image`**: a picture of each state (640 x 640, framed on the part, the on state glowing): render each GLB with+  the Adom 3D Viewer, lighting only the materials the off model does not have.+- **Show it** with `::adom-states{src="/OWNER/SLUG/render/states.json"}` in a `## States` section near the top (after+  Key specs): a toggle per state, the picture, the rule, the STEP and GLB of each state. Reference page:+  adom/in-s63btg.+- A page without `states.json` is read by adom-aiflow-probing from page.json's `model_3d_step_plain` (off) and+  `model_3d_step` (on), with a hint to publish the file. Publish it; the derivation is a fallback.+ ## Every 3D file described: `models.json` and the `::adom-models` widget  A component page soon carries several STEPs and GLBs (the maker's or datasheet-built original, an etched copy, an