← Commit history

1.1.21: <adom-3d> title= and info="off" for the viewer info bar (component-widgets#2)

Ray ·ad73d769b4 · ·parent f10678f
title (default: heading) and info="off" ride to the wiki's /viewer/3d route as ?title= and ?info=0, so a page with several models can name each one. The route ignores both until the git-wiki half lands; until then nothing changes for readers.
4 files changed +9−4
README.md+1−1
@@ -24,7 +24,7 @@ adom-wiki pkg install adom/component-widgets | `<adom-verified>` | "Verified by" trust mark + verification log; amber when a verified file changes | `verification.json` (adom/verification@1), `tools/verify_log.py` | | `<adom-models>` | Every 3D file on the page: STEP / GLB tabs, top + underside previews, what is unique, freshness | `models.json` (adom/models@1), `tools/models_json.py` | | `<adom-states>` | A component's visible states (an LED off and lit): a toggle, a picture of each state, when it applies, its STEP and GLB | `states.json` (adom/component-states@1) |-| `<adom-3d>` | Any GLB in the canonical Adom 3D Viewer, click to load: a poster until the reader asks, then orbit, view cube and zoom; unloads offscreen and on Unload, releasing the WebGL context | a non-Draco `.glb` (`src`), optional `poster`, `heading`, `caption` |+| `<adom-3d>` | Any GLB in the canonical Adom 3D Viewer, click to load: a poster until the reader asks, then orbit, view cube and zoom; unloads offscreen and on Unload, releasing the WebGL context | a non-Draco `.glb` (`src`), optional `poster`, `heading`, `caption`, `title` (the viewer info bar's name for this model; defaults to `heading`), `info="off"` (hide the info bar) | | `<adom-footprint-variants>` | The footprint's variant family (heatsink vias, solder balls, rounded pads) | `variants.json`, `tools/make-variants.py` |  Each is one custom element: Shadow DOM, no dependencies, light + dark (or
package.json+1−1
@@ -2,7 +2,7 @@   "slug": "component-widgets",   "title": "Component Widgets",   "type": "app",-  "version": "1.1.20",+  "version": "1.1.21",   "changelog": "1.1.20: skill cleanup: a shorter description, so the skill stays visible in a crowded skill listing.",   "description": "Reusable component-page widgets for pinouts, thermal vias, molecule relationships, reviewed chip outlines and image-first LOD caches with an optional zoom-driven 3D preview.",   "license": "MIT",
page.json+1−1
@@ -4,7 +4,7 @@   "type": "app",   "title": "Component Widgets",   "brief": "Reusable component widgets for pinouts, thermal vias, molecule relationships, reviewed chip outlines and lightweight four-level LOD cache listings.",-  "version": "1.1.20",+  "version": "1.1.21",   "changelog": "1.1.20: skill cleanup: a shorter description, so the skill stays visible in a crowded skill listing.",   "visibility": {     "public": true
widgets/model-3d-widget.js+6−1
@@ -8,6 +8,9 @@  *   the widget frame's connect-src does not reach Babylon's decoder CDN, so a Draco GLB cannot decode here.  * - poster: optional still shown until the reader asks for 3D (a render or screenshot of the same model).  * - heading: optional title over the view; caption: optional line under it.+ * - title: the name the viewer's info bar shows for THIS model (default: heading; with neither, the viewer+ *   decides). info="off": hide the viewer's info bar. Both ride to the viewer route as ?title= / ?info=0+ *   (component-widgets#2: a page with several models showed the page title on every one).  *  * Nothing heavy loads on the page path (adom/wiki#1292): the wiki puts every widget in a click-to-load slot, so  * this frame only exists once the reader asked for it, and the model then loads straight away (one click, not@@ -140,7 +143,9 @@         const type = ((await res.json()).page || {}).type;         if (!type) throw new Error('the page ' + m[1] + '/' + m[2] + ' has no type');         // the viewer route's ?model= check addresses the repo by the internal type name (hardware pages are component repos)-        const view = `/viewer/3d/${encodeURIComponent(m[1])}/${encodeURIComponent(type === 'hardware' ? 'component' : type)}/${encodeURIComponent(m[2])}?model=${encodeURIComponent(m[3])}`;+        const name = (this.getAttribute('title') || this.getAttribute('heading') || '').trim().slice(0, 120);+        const view = `/viewer/3d/${encodeURIComponent(m[1])}/${encodeURIComponent(type === 'hardware' ? 'component' : type)}/${encodeURIComponent(m[2])}?model=${encodeURIComponent(m[3])}`+          + (name ? `&title=${encodeURIComponent(name)}` : '') + (/^(off|0|false|no)$/i.test(this.getAttribute('info') || '') ? '&info=0' : '');         this._frame(`<iframe src="${esc(view)}" title="${esc(this.getAttribute('heading') || '3D model')}" allow="fullscreen"></iframe>`,           '<button id="off" type="button">Unload</button>');         this._viewer = { destroy() {} };