Closed general

Component pages: native Schematics section from render/manifest.json sheets[]

Colby Knox · 2mo ago ·closed by Colby Knox

Routed from adom/adom-wiki-cli#14 (Drew, split from adom/molecule-pipeline#3, Barrett's live-browser find). The ask is page-template work, so it belongs on this tracker.

Boards publish as type: component. The component page template renders the 3D model and the Symbol & Footprint section (render/pcb.svg), but has no slot for schematics, so the pipeline's render/sheet-000..NNN.svg files are invisible except as file downloads.

Ask: when a component page carries render/manifest.json with a non-empty sheets[] array, render a Schematics section: one sub-view per sheet, labeled from sheets[] (index order matches the names array), sourced from render/sheet-NNN.svg, with the same zoom/pan treatment as the footprint viewer. This is the same data APM's hierarchical schematic view already reads, so no new contract is needed.

Live examples to verify against: adom/uv-current-monitor-board (11 sheets) and adom/uv-led-panel (1 sheet). Both currently work around the gap via README embeds (molecule-publish 2.3.1); a native section supersedes those.

CLI side is adding the complementary publish lint (sheets[] entries vs actual sheet-NNN.svg files present) so broken manifests get caught at publish rather than rendering a half-empty section.

1 Reply

Colby Knox · 2mo ago

Shipped and verified on prod.

When a component page carries render/manifest.json with a non-empty sheets[] array, the overview now renders a Schematics section: the new native /viewer/schematic/{owner}/{type}/{slug} route (bare legacy form included), one sub-view per sheet, labeled from sheets[] in index order, sourced from render/sheet-NNN.svg, with drag-pan, scroll-zoom (click-to-engage in embeds, same as the 2D viewers), pinch, and Fit. Sheet chips inside the viewer switch sheets; the page section itself needs no script. Open full view and Download are there too.

Implementation notes:

  • The viewer document is trusted wiki HTML like the other native viewers, but the sheet SVG loads via img from the session-gated files route: publisher SVG bytes are never inlined into a same-origin document (SVG can carry scripts), and the img fetch carries the viewer's session, so private pages work.
  • Sheets render on a white card: pipeline SVGs are authored for light backgrounds and would vanish on the dark canvas.
  • An over-declared sheet (manifest entry with no SVG) renders a named empty state; a manifest whose declared sheets have no SVGs at all drops the section. Complements the CLI-side publish lint.
  • component.viewers.schematic is honored as a custom override slot, consistent with the other slots.

Verified against both live examples: adom/uv-current-monitor-board renders all 11 sheets (viewer reports sheet 1 of 11) and adom/uv-led-panel serves its single sheet. 25-assert regression suite at test/viewers/schematic-viewer.test.mjs covers resolution, clamping, empty states, section presence, both route forms, and the private-page auth matrix. The README embeds from molecule-publish 2.3.1 can be dropped whenever convenient.

Log in to reply.