by adom
The one-stop-shop for publishing a hardware component (or molecule/board) to the Adom Wiki. The whole lifecycle: page anatomy, the clone→edit→preview→push loop and its hard rules, making a great hero image (Hero Component Studio — 16:10, overlay-safe, datasheet-backed), the animated 3D composite, the interactive 3D viewer, ct thumbnails, the datasheet-accuracy audit, and every wiki push/pull gotcha we've hit. Now includes the worked Path B (board) pipeline: STEP-to-GLB, refdes tagging, layer de-
Board viewer template imports the Adom viewer library instead of a bundle copy #3
The board viewer template now imports the Adom viewer library from the wiki instead of fetch-injecting a 13 MB copy of the old Babylon 7 bundle that each page had to carry in viewer/adom-3d-viewer.min.js.
Template (scripts/board-viewer-template.html), three changes:
await import('https://wiki.adom.inc/static/vendor/adom-3d-viewer-babylon9/adom-3d-viewer-babylon9.esm.js')replaces the fetch-inject, andwindow.Adom3DViewerBabylon9replaceswindow.Adom3DViewer.const B = await V.loadBabylon()gives the template the whole engine (it uses Vector3, Color3, Matrix, MeshBuilder, StandardMaterial, DynamicTexture).showHelp: falseininit, because the library's help tip and ? button otherwise sit on top of the template's Pause / Replay / Ground / Labels row.
Checked on rf-mech-molecule-32x32: its viewer with this change applied, the page's own GLB, config and index, and viewer/adom-3d-viewer.min.js deleted, loaded in headless Chrome against viewer 0.12.1. One viewer came up with a clean ready report, the legend filled, and it matched the current page apart from the library's lighter background and its origin axes.
SKILL.md: the file table, the "START HERE" paragraph, the layer table, 5a and 5b say to import the library and never push a bundle into the page. The 5b note about harvesting Matrix from a live instance is replaced by loadBabylon(). Pages built before this keep their copies and keep working; nothing here touches them.
This is part of consolidating the 3D viewers: Adom has one viewer library (adom/adom-3d-viewer, source on GitHub adom-inc/adom-3d-viewer-babylon9), and the skills that tell agents to copy an old bundle or start from the removed gallia/viewer are where new copies come from. The same short "use the Adom viewer" block now goes into each skill that covers viewers.
After merging, publish a new version of the skill so agents pick it up.
🤖 Generated with Claude Code
Diff Skip to comments
@@ -1,1310 +1,1312 @@⋯ 281 unchanged lines ⋯ | `<MPN>.glb` | the canonical 3D model the viewer loads **by name** (see 8b) | for anything 3D | | `<MPN>.insertion.glb` | the animated composite (part drops onto its footprint) — what the timeline viewer loads | composite pages | | `<MPN>-viewer.html` | the **interactive 3D viewer** source (the timeline viewer, §5). Its content is inlined as `srcdoc` into the README; keep the file as the editable source | interactive pages |-| `adom-3d-viewer.min.js` | Colby's shipped viewer bundle (the viewer fetch-injects it by absolute URL) | interactive pages |+| *(no viewer bundle)* | the viewer imports the Adom viewer library from the wiki (§5); never push `adom-3d-viewer.min.js` or any other bundle into the page | never | | `<MPN>.kicad_sym` / `.kicad_mod` | KiCad symbol / footprint source | if it has EDA | | `ct/` | thumbnail bundle: 3D icons + **symbol SVG + footprint SVG** (used inline in the page, since interactive symview/fpview iframes are sandbox-blocked) + manifest (§6) | standard | ⋯ 252 unchanged lines ⋯ The viewer is **not** re-invented per page. Every page's viewer is the SAME base plus a config file. Rebuilding it freehand is how pages drift, and it is the single easiest way to waste a day. -**The base is Colby's shipped bundle** — `adom-3d-viewer.min.js`, exposing `window.Adom3DViewer`-(the same engine as the wiki's own native viewer). It is used **UNMODIFIED**: all our behaviour is-host-page code layered on top, so it stays purely additive and can be offered back upstream. Do not-fork it, patch it, or vendor a different three/Babylon build.+**The base is the Adom viewer library** ([adom/adom-3d-viewer](https://wiki.adom.inc/adom/adom-3d-viewer)),+imported from the wiki at `https://wiki.adom.inc/static/vendor/adom-3d-viewer-babylon9/adom-3d-viewer-babylon9.esm.js`+(no `?v=` pin), exposing `window.Adom3DViewerBabylon9` (the same engine as the wiki's own native+viewer). It is used **UNMODIFIED** and never copied into the page: all our behaviour is host-page code+layered on top, so it stays purely additive and can be offered back upstream. Do not fork it, patch+it, or vendor a different three/Babylon build. (Pages built before 2026-10 carry+`viewer/adom-3d-viewer.min.js`, the old Babylon 7 bundle; do not copy it into a new page.) **Copy the template that matches your path, then edit only its config:** ⋯ 6 unchanged lines ⋯ | Layer | What it is | Do you edit it? | |---|---|---|-| `adom-3d-viewer.min.js` | Colby's engine — scene, camera, picking, GLB load | **NEVER** |+| the Adom viewer library (imported from the wiki) | the engine — scene, camera, picking, GLB load | **NEVER** | | `*-viewer.html` template | our host page: modes, captions, legend, tooltips, timeline | rarely — fix bugs upstream in the template, not per page | | `viewer-config.json` | **the per-page authoring surface** — blocks, order, timings, captions, static toggles | **YES — this is the file you write** | | `<slug>.glb` + `board-index.json` | the geometry and its refdes→section index (§5c) | generated, never hand-edited |⋯ 43 unchanged lines ⋯ > Not the old Static/PnP-only one. It lives in a work dir (`/home/adom/project/in-s42atr-work/…` for > in-s42atr). **Pull it FRESH before every embed/push** — the copy on the wiki goes stale the moment > it's edited. Never re-embed a cached copy. Regeneration is mechanical (steps 4→7 above); the viewer-> already ships the sandbox storage shim + bundle fetch-inject, so no other adaptation is needed.+> already ships the sandbox storage shim + the library import, so no other adaptation is needed. The viewer has three modes via a segmented control: **Timeline** (a ~56 s narrated explainer reel — chapters: the part → powered on → viewing angle → lift off → solder → tape & reel → rest), **Static**⋯ 15 unchanged lines ⋯ measurement stays honest. `tooltip list` tags which tooltips also append measured rows. Do NOT add a way to hand-type a measured value. -### 5b. Load-sequence gotchas (building the host page on Colby's bundle)+### 5b. Load-sequence gotchas (building the host page on the Adom viewer library) - **Storage shim BEFORE the bundle loads.** Wiki blobs render sandboxed (no `allow-same-origin`) → `localStorage`/`sessionStorage` throw on *access* → Colby's `SceneBuilder` aborts (no lights/IBL/ shadows/skybox). Shim both with no-ops first.-- **Fetch-inject the bundle** (don't `<script src>` it): blob `.js` is `application/octet-stream +- nosniff` → refused as a script src. `fetch().text()` → inline `<script>`.+- **Import the library from the wiki** (`await import(VIEWER_URL)`, no `?v=` pin). The wiki serves+ it as JavaScript with CORS, so there is nothing to fetch-inject, and nothing to push into the page. - **Null the model's `rotationQuaternion`** after load: glTF sets a quaternion that overrides the Euler `rotation.z` we animate.-- **Harvest classes not on the bundle's `B`:** `V.BABYLON` exposes only `MeshBuilder,- StandardMaterial, Vector3, Color3, DynamicTexture`; get others from live instances' `.constructor`.- Notably **`Matrix` is absent** and `Vector3.Project` needs one (any DOM label pinned over the 3D- scene) — harvest it as `const Matrix = scene.getTransformMatrix().constructor`, and wrap the- projection in try/catch so a bad frame can't kill the render loop.+- **The whole engine:** `const B = await V.loadBabylon()`. `V.BABYLON` carries only the common+ classes. Wrap `Vector3.Project` (any DOM label pinned over the 3D scene) in try/catch so a bad+ frame can't kill the render loop. - **Camera:** `frameModel()` frames the 5000-unit skybox (mm part → sub-pixel). Run it for its light/ ground setup, then set an explicit mm-scale camera (`cam.target.copyFromFloats(...)`, `cam.radius` ~0.006 static / ~0.026 P&P).⋯ 8 unchanged lines ⋯ it: set mode → pause → seek `t` → wait 2 frames → snap → screenshot. Sample the moments that matter (mid-drop, each chapter, end state) in ONE browser session. On a real GPU (the user's webview) the same page runs at full speed — headless slowness is a harness artifact, not a bug.-- **Match Colby's ground/sky** by inspecting his LIVE native scene (the vendored bundle is older):+- **Match Colby's ground/sky** by inspecting his LIVE native scene: `clearColor` `#2a3340`, `environmentIntensity` 1.0, disable `/^Background/` meshes (no skybox), ground = a `groundFadeTex` radial-fade circle at alpha 0.2. Re-apply after every re-frame AND in the Ground toggle handler (`setGroundVisible` rebuilds the ground opaque).⋯ 644 unchanged lines ⋯ Hit a new wiki issue, a viewer quirk, or a better hero recipe? Add it to the right section (usually §8 gotchas, §3 hero, or §4 composite), bump the version, and open a PR against `adom/adom-hardware-component-publish`. Keep findings **specific and cited**.+@@ -1,489 +1,488 @@⋯ 89 unchanged lines ⋯ try { window[k] && window[k].getItem('x'); } catch (e) { try { Object.defineProperty(window,k,{configurable:true,value:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},key:()=>null,length:0}}); } catch(_){} } }-// Blob storage serves .js as application/octet-stream + nosniff → <script src> is refused.-// Fetch as text, inject inline.-if (!window.Adom3DViewer) {- try {- const code = await (await fetch('./adom-3d-viewer.min.js')).text();- const s = document.createElement('script'); s.textContent = code; document.head.appendChild(s);- } catch (e) { statusEl.textContent = 'viewer bundle fetch failed: ' + e.message; return; }+// The Adom viewer library, imported from the wiki (no ?v= pin). Never copy a bundle into the page.+const VIEWER_URL = 'https://wiki.adom.inc/static/vendor/adom-3d-viewer-babylon9/adom-3d-viewer-babylon9.esm.js';+if (!window.Adom3DViewerBabylon9) {+ try { await import(VIEWER_URL); }+ catch (e) { statusEl.textContent = 'viewer library load failed: ' + e.message; return; } }-const V = window.Adom3DViewer;-if (!V) { statusEl.textContent = 'Adom3DViewer bundle failed to load'; return; }-const B = V.BABYLON;+const V = window.Adom3DViewerBabylon9;+if (!V) { statusEl.textContent = 'Adom viewer library failed to load'; return; }+const B = await V.loadBabylon(); // the whole engine: V.BABYLON carries only the common classes try { // ---------------------------------------------------------------- config + index⋯ 4 unchanged lines ⋯ const BLAB = Object.fromEntries(BLOCKS.map(b => [b.id, b.label])); // ---------------------------------------------------------------- scene-const viewer = V.init(document.getElementById('app'), { zUp:true, showViewCube:true, showGround:true });+const viewer = V.init(document.getElementById('app'), { zUp:true, showViewCube:true, showGround:true, showHelp:false }); await viewer.loadModel('./feeder-reader.board.glb'); const scene = viewer.getScene(); scene.animationGroups.slice().forEach(g => g.dispose()); // we drive all motion⋯ 369 unchanged lines ⋯ } })(); </script>+
Comments
Log in to comment.
No comments yet.