by adom
How the Adom Wiki (wiki.adom.inc) works and how to drive it with the adom-wiki CLI: the two storage layers (git page repo vs package registry), hosting source by pushing files (not a tarball), making packages, cutting per-platform releases, and the three-tier skill layout (user skills ship, dev-skills/ and publish-skills/ stay source-only). adom-wiki is the current tool; adompkg is deprecated.
Footprint widget: add pad numbers and join the pin-hover bus at render time
What happens today
On most factory component pages, hovering a pin in the Schematic Symbol viewer lights nothing in the PCB Footprint viewer, and hovering a pad lights nothing in the symbol.
- Reproduce (not patched): https://wiki.adom.inc/adom/atsamd21j17a-aut. Load the viewers and hover symbol pin 1: pad 1 stays dark.
- Patched reference: https://wiki.adom.inc/adom/pic18f4585-e-pt. Hovering pin 1 lights pad 1, and hovering pad 1 lights pin 1.
- Hand-made pages that use the adom-lbr footprint viewer, such as https://wiki.adom.inc/adom/atmega328p, have always worked.
The cause: the footprint viewer on factory pages is the adom-footprint embed, and the embed doesn't take part in the hover protocol the symbol viewer uses. The page already forwards the symbol's messages to the footprint iframe. On atmega328p, hovering a symbol pin lights the matching pad, so the forwarding works. The embed just has nothing that listens or sends.
The protocol the symbol viewer uses (adom-lbr export-viewers)
- Every pin is an element with
data-num="<pin number>". - On
mouseenterit adds classhito every element with thatdata-numin its own document, then sendsparent.postMessage({type: 'lbr-hover', pin: '<number as string>', mpn: <MPN or null>}, '*'). - On
mouseleaveit clears everyhiand sends the same message withpin: null. - It listens with
window.addEventListener('message', ...). Fortype === 'lbr-hover'it clears everyhi, and whenpinis not null it addshito every[data-num="<pin>"].
What the footprint widget would need to do at render time
- Pad numbers. In the embed, each pad is a
<g data-pad="<number>" data-shape=... data-size=... data-mount=...>inside<g class="adom-layer-copper">. Give each of those groupsdata-numwith the same value as itsdata-pad. The number comes from the embed's own data and is never inferred. - Pads with no number. Skip them. On KiCad's own USB-C footprint (USB_C_Receptacle_GCT_USB4105-xx-A_16P_TopMnt_Horizontal), the two unnumbered NPTH holes get no
data-padgroup in the embed, so they stay out naturally. A group with an emptydata-pad=""should be skipped too. - Several pads per pin. Tag them all with the same number, so a hover lights every one: exposed pads split into pieces (aon6407-ms has 8 pieces of pad 9), duplicated tab pads (ap2114ha-2-5trg1 has pad 2 twice), and mounting pads that share a name (afc10-s09qca-00 has two MP pads).
- Hover on a pad. Same as the symbol: on
mouseenter, clear, addhito every[data-num="<n>"], and post{type: 'lbr-hover', pin: '<n>', mpn}toparent. Onmouseleave, clear and postpin: null. - Hover from the symbol. Listen for
messageevents withtype === 'lbr-hover': clear everyhi, and whenpinis not null addhito every[data-num="<pin>"]. - A visible
histyle on the pad's shapes. We use a yellow fill with a white outline.
Pages we've already patched
Our version of all six steps is add_hover_bus in component-factory's inject_layers.py, commit https://github.com/adom-inc/component-factory/commit/198488c. It edits each page's viewers/footprint.html. A patched file contains the marker comment /* lbr-hover bus (component-factory inject_layers) */, once in a <style> block and once in a <script> block, and its pads already carry data-num. The widget can skip binding when the document contains that marker or any [data-num] element, so it never binds twice. Once the widget does this at render time, we'll stop patching pages.
Scale
There are about 108,000 factory component pages on the embed footprint viewer. We're patching the top ~5,000 by the wiki's composite score now. New and rebuilt factory pages get the patch when they're built. A render-time fix would cover the rest at once.