GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Kuiper, cosmos and drawing engines / galaxies-wafers / iterations/09-deeplink-receiver

Iterations — 10 Ground Bridge Page and 3 more files

A map page in Galaxies Wafers that maps grid 132kV, grid substations, pack and names, and uses data from the GridAtlas repository. Published at https://ventusltd.github.io/galaxies-wafers/iterations/10-ground-bridge/.

415 lines of HTML and CSS and JavaScript from galaxies-wafers, in 4 files. Topic: Kuiper, cosmos and drawing engines. Section 1188 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Iterations — 09 Deeplink Receiver Style Sheet render · galaxies-wafers / iterations/09-deeplink-receiver/style.css lines 1–111
  2. Iterations — 10 Ground Bridge Page render · galaxies-wafers / iterations/10-ground-bridge/index.html lines 1–179
  3. Wafer render · galaxies-wafers / iterations/10-ground-bridge/wafer.html lines 1–41
  4. Iterations — 11 the Bond interaction · galaxies-wafers / iterations/11-the-bond/app.mjs lines 1–84

Iterations — 09 Deeplink Receiver Style Sheet

A style sheet in Galaxies Wafers. Served with the page at https://ventusltd.github.io/galaxies-wafers/iterations/09-deeplink-receiver/.

rendergalaxies-wafers / iterations/09-deeplink-receiver/style.css · lines 1–111 of 111 · Entry point

What it does
Side effects: changes the web page (DOM).
Downstream impact
Used directly by 1 file: Iterations — 09 Deeplink Receiver Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/09-deeplink-receiver/). Reached from 1 other entry point, including Iterations — 45 Deeplink Round Trip Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/45-deeplink-round-trip/). It is itself an entry point, published at https://ventusltd.github.io/galaxies-wafers/iterations/09-deeplink-receiver/.
What it achieves
The Line Wafer. Designed at 430 px first; the desktop is the same layout with more room.
Why it matters
Loaded by the 09 Deeplink Receiver page at https://ventusltd.github.io/galaxies-wafers/iterations/09-deeplink-receiver/.
Application
galaxies-wafers · iterations/09-deeplink-receiver · style sheet
Uses
none found
Used by
loaded by Iterations — 09 Deeplink Receiver Page (stylesheet)
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
galaxies-wafers@5814793812add74605660fa821e6a39b8de80588 iterations/09-deeplink-receiver/style.css:1-111 · blob 6414f9ae41d80fd58c6c8becaeb6d8ba9a22d7a2 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: unknown · users: none · canonical: unknown
/* The Line Wafer. Designed at 430 px first; the desktop is the same layout with
   more room. One canvas, three chrome strips, nothing that scrolls the page. */

:root{
  --ink:#d8dee9; --dim:#8b93a7; --ground:#0b0d12; --edge:#1b2030;
  --lit:#ffd54a; --beam:#5ec8f2;
  --top:env(safe-area-inset-top,0px); --bot:env(safe-area-inset-bottom,0px);
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--ground); color:var(--ink);
  font:13px/1.45 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  overflow:hidden; overscroll-behavior:none; -webkit-text-size-adjust:100%;
}
#stage{position:fixed; inset:0; width:100%; height:100%; display:block; touch-action:none}

#bar{
  position:fixed; left:0; right:0; top:0; z-index:2;
  display:flex; gap:.75rem; align-items:baseline; flex-wrap:wrap;
  padding:calc(var(--top) + .5rem) .75rem .5rem;
  background:linear-gradient(#0b0d12ee,#0b0d1200); pointer-events:none;
}
#wordmark{letter-spacing:.14em; font-size:11px}
.dim{color:var(--dim)}

#beam{
  position:fixed; z-index:3; left:.5rem; right:.5rem;
  bottom:calc(var(--bot) + 3.4rem);
  display:flex; gap:.4rem;
}
#beam input{
  flex:1 1 0; min-width:0; padding:.6rem .55rem;
  background:#11151f; color:var(--ink); border:1px solid var(--edge); border-radius:6px;
  font:inherit; font-size:16px; /* 16px stops iOS zooming the page on focus */
}
#beam input:focus{outline:none; border-color:var(--beam)}
#beam button{
  flex:0 0 auto; padding:.6rem .9rem; border-radius:6px; cursor:pointer;
  background:#11151f; color:var(--beam); border:1px solid var(--beam);
  font:inherit; font-size:13px; letter-spacing:.1em;
}
#beam button:active{background:#16202c}

#panel{
  position:fixed; z-index:4; left:.5rem; right:.5rem;
  bottom:calc(var(--bot) + 6.6rem);
  max-height:52vh; overflow:auto; -webkit-overflow-scrolling:touch;
  background:#0e121bf2; border:1px solid var(--edge); border-radius:8px;
  padding:.75rem .8rem 1rem;
}
#panel[hidden]{display:none!important}
#close{
  position:absolute; top:.35rem; right:.4rem; width:2rem; height:2rem;
  background:none; border:0; color:var(--dim); font:inherit; font-size:15px; cursor:pointer;
}
#panel h2{margin:0 .5rem .5rem 0; font-size:15px; font-weight:600; letter-spacing:.02em}
#panel h2 .n{color:var(--lit)}
#panel dl{display:grid; grid-template-columns:auto 1fr; gap:.15rem .6rem; margin:.5rem 0}
#panel dt{color:var(--dim)}
#panel dd{margin:0; overflow-wrap:anywhere}
#panel p{margin:.5rem 0 0}
#panel ul{margin:.35rem 0 0; padding-left:1.1rem}
#panel li{margin:.15rem 0}
.fam{color:var(--beam)}
.refuse{color:var(--lit)}

#foot{
  position:fixed; z-index:2; left:0; right:0; bottom:0;
  display:flex; gap:.15rem; flex-direction:column;
  padding:.35rem .75rem calc(var(--bot) + .35rem);
  background:linear-gradient(#0b0d1200,#0b0d12ee); pointer-events:none;
  font-size:10.5px;
}
#hint{text-align:left}
#foot a{color:var(--beam); pointer-events:auto; text-decoration:underline}

@media (min-width:760px){
  #beam{left:auto; right:1rem; width:26rem; bottom:calc(var(--bot) + 2.9rem)}
  #foot{flex-direction:row; gap:.6rem; justify-content:space-between}
  #hint{text-align:right}
  #panel{left:1rem; right:auto; width:26rem; bottom:calc(var(--bot) + 2.5rem); max-height:66vh}
  #foot{font-size:11px}
}

/* ── iteration 09: the arrival card (Atlas grammar: black, monospace, cyan name, amber value) and the emit panel ── */
#leftcol{position:fixed;z-index:6;left:.5rem;top:calc(var(--top) + 2.2rem);display:flex;flex-direction:column;align-items:flex-start;gap:.4rem;max-width:min(24rem,calc(100% - 7rem))}
#linkcard{position:relative;
  background:#000;border:1px solid #00ffff55;border-radius:4px;padding:.45rem .6rem;font-size:12px}
#linkcard[hidden]{display:none!important}
#linkcard[data-state="refused"]{border-color:#ff8a80}
#linkcard .lctitle{color:#00ffff;font-size:13px;display:block;margin-right:1.4rem}
#linkcard[data-state="refused"] .lctitle{color:#ff8a80}
#linkcard .lcwhy{color:#ffae00;margin:.25rem 0}
#linkcard .lcdim{color:#666}
#linkcard .lcdrop{color:#ffae00}
#linkcard dl{display:grid;grid-template-columns:auto 1fr;gap:.1rem .5rem;margin:.3rem 0 0}
#linkcard dt{color:#888}#linkcard dd{margin:0;overflow-wrap:anywhere}
#linkcard .lcclose{position:absolute;top:.2rem;right:.3rem;background:none;border:0;color:#888;font:inherit;cursor:pointer}
#emit{font-size:12px;width:100%}
#emit[hidden]{display:none!important}
#emitToggle{background:#11151f;color:#ff2bd6;border:1px solid #ff2bd6;border-radius:6px;padding:.35rem .7rem;font:inherit;letter-spacing:.1em;cursor:pointer}
#emitBody{margin-top:.4rem;background:#0e121bf4;border:1px solid var(--edge);border-radius:8px;padding:.5rem .6rem;max-height:50vh;overflow:auto}
#emitBody[hidden]{display:none!important}
.egroup{color:var(--dim);font-size:10.5px;letter-spacing:.08em;margin:.45rem 0 .2rem}
.erow{display:flex;gap:.35rem}
#emitBody input,#emitBody select{flex:1 1 0;min-width:0;width:100%;background:#11151f;color:var(--ink);border:1px solid var(--edge);border-radius:5px;font:inherit;padding:.3rem .4rem}
#emitBody select{margin-top:.35rem}
#emitCopy{background:none;border:1px solid var(--beam);color:var(--beam);border-radius:4px;font:inherit;font-size:10px;padding:0 .35rem;cursor:pointer}
.eurl{overflow-wrap:anywhere;color:var(--beam)}.eurl.eerr{color:#ff8a80}
.estat{margin-top:.5rem;font-size:10.5px}.estat.OK{color:#7fd6a2}.estat.FAIL{color:#ff8a80}

Iterations — 10 Ground Bridge Page

A map page in Galaxies Wafers that maps grid 132kV, grid substations, pack and names, and uses data from the GridAtlas repository. Published at https://ventusltd.github.io/galaxies-wafers/iterations/10-ground-bridge/.

rendergalaxies-wafers / iterations/10-ground-bridge/index.html · lines 1–179 of 179 · Entry point · pattern layers (shared by 3 files)

What it does
It maps grid 132kV, grid substations, pack and names. Defines 15 functions or classes, including $, fmt, waferWin, layers, counts. Side effects: changes the web page (DOM); makes network requests.
Why it exists in the grid workflow
Domain stage upstream_foresight (voltage levels 132kV (all 132kV or above)): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: 132kV. README: "The page (`index.html`, `app.mjs`, `lib.mjs`) is inherited unchanged from testcode/202609151339."
Inputs & outputs
In: data source: gridatlas data; GeoJSON file grid_132kv.geojson; GeoJSON file grid_substations.geojson; JSON file style.json; JSON file pack.json; JSON file names.json. Out: web page; interactive map. Voltage levels named: 132kV.
Downstream impact
It is itself an entry point, published at https://ventusltd.github.io/galaxies-wafers/iterations/10-ground-bridge/.
What it achieves
It is built from the fmt step (`fmt`), the wafer win helper (`waferWin`) and the layers step (`layers`). The Ground Bridge — the wafer and the ground, one tap apart. Its code works with 132 kV. It responds to load events.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
galaxies-wafers · iterations/10-ground-bridge · page
Uses
Wafer (iframe), https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.css, https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.js
Used by
none found
Produces
$, fmt, waferWin, layers, counts, json, bin, say, symOf, lightFor, onSubstation, onProject
Defines here
$, fmt, waferWin, layers, counts, json, bin, say, symOf, lightFor, onSubstation, onProject, km, onRoute, wait
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
galaxies-wafers@5814793812add74605660fa821e6a39b8de80588 iterations/10-ground-bridge/index.html:1-179 · blob d1184cdc8528fbe2ac8ae8f8e3541275f1b1a4c2 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, network · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unknown
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="color-scheme" content="dark">
<title>The Ground Bridge — the wafer and the ground, one tap apart</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.css">
<style>
  :root{--ink:#d8dee9;--dim:#8b93a7;--ground:#0b0d12;--edge:#1b2030;--beam:#5ec8f2;--lit:#ffd54a}
  *{box-sizing:border-box} html,body{height:100%}
  body{margin:0;background:var(--ground);color:var(--ink);font:12px/1.4 ui-monospace,Menlo,Consolas,monospace;overflow:hidden}
  #panes{display:grid;grid-template-columns:1fr 14rem 1fr;height:100%}
  #wafer{border:0;width:100%;height:100%;display:block;background:var(--ground)}
  #strip{border-left:1px solid var(--edge);border-right:1px solid var(--edge);padding:.7rem .6rem;overflow:auto;
         display:flex;flex-direction:column;gap:.6rem}
  #strip h1{font-size:11px;letter-spacing:.14em;font-weight:400;margin:0}
  #counts{color:var(--ink)} .dim{color:var(--dim)} #said{color:var(--lit);overflow-wrap:anywhere}
  #said .sym{color:var(--beam);font-weight:700}
  #map{width:100%;height:100%}
  .maplibregl-ctrl-attrib{font:10px ui-monospace,monospace;background:#0b0d12cc!important;color:var(--dim)}
  .maplibregl-ctrl-attrib a{color:var(--beam)}
  @media (max-width:760px){
    body{overflow:auto} #panes{grid-template-columns:1fr;grid-template-rows:60vh auto 60vh;height:auto}
    #strip{border:0;border-top:1px solid var(--edge);border-bottom:1px solid var(--edge)}
  }
</style>
</head>
<body>
<div id="panes">
  <iframe id="wafer" src="wafer.html" title="The Line Wafer: every numbered line of the estate"></iframe>
  <aside id="strip">
    <h1>THE GROUND BRIDGE</h1>
    <div id="counts" class="dim">counting…</div>
    <div id="said" aria-live="polite"></div>
    <div class="dim">Tap a substation or a project on the map: the wafer lights the routes of the modules that draw it. Tap a lit route on the wafer: the map flies to the substation nearest its centre and names the module.</div>
    <div class="dim">map layers lifted from Grid Atlas v9 (release 202608300453) · projects from the Atlas pack (testcode 202609151428) · basemap CARTO dark matter · © OpenStreetMap contributors</div>
  </aside>
  <div id="map"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.js"></script>
<script>
const RELEASE = 'https://ventusltd.github.io/gridatlas/atlas/releases/202608300453-atlas-v9/';
const PACK = 'https://globalgrid2050.com/testcode/202609151428/data/';

/* Lifted verbatim from atlas/index.html (the Atlas v9 `ukConfig`). */
const L132 = { id: "132",  label: "132kV", color: "#00cc00", type: "line", width: 1.5, url: "data/grid_132kv.geojson" };
const SUBS = { id: "subs", label: "Subs",  color: "#ffffff", type: "point", radius: ['interpolate', ['linear'], ['zoom'], 5, 3, 10, 5, 14, 10, 18, 22], url: "data/grid_substations.geojson" };
/* The Atlas's REPD capacity breakpoints: ventus-corev8engine.js, the default circlePaint. */
const CAPACITY_RADIUS = ['interpolate',['linear'],['coalesce',['get','capacity'],0],0,8,10,10,50,13,200,17,500,22,1000,28];

/* Which estate modules draw which kind of thing on the ground. */
const DRAWN_BY = { substation: ['module-Vn', 'module-Si'], project: ['module-Ra', 'module-Si'] };

const $ = id => document.getElementById(id);
const fmt = n => Number(n).toLocaleString('en-GB');
const G = { subs: null, projects: 0, names: null, tech: null };
const waferWin = () => $('wafer').contentWindow;
const layers = () => waferWin()?.__layers ?? null;

const map = new maplibregl.Map({
  container: 'map',
  style: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json',
  center: [-2.5, 54.3], zoom: 5.2, attributionControl: true
});
map.addControl(new maplibregl.NavigationControl({ showCompass: false }), 'bottom-right');

function counts() {
  const L = layers();
  const routes = L ? L.ids().filter(id => id.startsWith('module-')).length : null;
  $('counts').textContent =
    `${G.subs ? fmt(G.subs.length) : '…'} substations, ${G.projects ? fmt(G.projects) : '…'} projects, ` +
    `${routes === null ? '…' : fmt(routes)} module routes on the wafer`;
}

async function json(u) { const r = await fetch(u, { cache: 'default' }); if (!r.ok) throw new Error(u + ' HTTP ' + r.status); return r.json(); }
async function bin(name, Kind) { const r = await fetch(PACK + name, { cache: 'default' }); if (!r.ok) throw new Error(name + ' HTTP ' + r.status); return new Kind(await r.arrayBuffer()); }

map.on('load', async () => {
  map.addSource('src-projects', { type: 'geojson', data: { type: 'FeatureCollection', features: [] } });
  map.addLayer({ id: 'l-projects', type: 'circle', source: 'src-projects',
    paint: { 'circle-color': '#ffcc00', 'circle-radius': CAPACITY_RADIUS, 'circle-stroke-width': 1.5, 'circle-stroke-color': '#000', 'circle-opacity': 0.35 } });
  for (const l of [L132, SUBS]) {
    map.addSource('src-' + l.id, { type: 'geojson', data: { type: 'FeatureCollection', features: [] } });
    const base = { id: 'l-' + l.id, source: 'src-' + l.id };
    if (l.type === 'line') map.addLayer({ ...base, type: 'line', paint: { 'line-color': l.color, 'line-width': l.width, 'line-opacity': 0.9 } });
    else map.addLayer({ ...base, type: 'circle', paint: { 'circle-color': l.color, 'circle-radius': l.radius, 'circle-opacity': 0.85, 'circle-stroke-color': '#0b0d12', 'circle-stroke-width': 0.6 } });
  }
  map.on('click', 'l-subs', onSubstation);
  map.on('click', 'l-projects', onProject);
  for (const id of ['l-subs', 'l-projects']) {
    map.on('mouseenter', id, () => { map.getCanvas().style.cursor = 'pointer'; });
    map.on('mouseleave', id, () => { map.getCanvas().style.cursor = ''; });
  }

  const jobs = [
    json(RELEASE + SUBS.url).then(d => { G.subs = d.features || []; map.getSource('src-subs').setData({ type: 'FeatureCollection', features: G.subs }); counts(); }),
    json(RELEASE + L132.url).then(d => map.getSource('src-132').setData({ type: 'FeatureCollection', features: d.features || [] })),
    (async () => {
      const [meta, lat, lon, mw, tech] = await Promise.all([json(PACK + 'pack.json'),
        bin('lat.bin', Float32Array), bin('lon.bin', Float32Array), bin('mw.bin', Float32Array), bin('tech.bin', Uint8Array)]);
      const n = lat.length;
      if (meta.projects !== n) throw new Error(`pack says ${meta.projects} projects, lat.bin holds ${n}`);
      const feats = new Array(n);
      for (let i = 0; i < n; i++) feats[i] = { type: 'Feature', id: i, geometry: { type: 'Point', coordinates: [lon[i], lat[i]] },
        properties: { i, capacity: mw[i], tech: meta.technologies[tech[i]] ?? null } };
      map.getSource('src-projects').setData({ type: 'FeatureCollection', features: feats });
      G.projects = n; counts();
      json(PACK + 'names.json').then(ns => { G.names = ns; }).catch(() => {});
    })()
  ];
  for (const j of jobs) j.catch(e => { $('said').textContent = 'could not load: ' + e.message; });
});

/* ── ground → wafer ─────────────────────────────────────────────────────── */

function say(parts) {
  $('said').replaceChildren(...parts.map(p => {
    if (typeof p === 'string') return document.createTextNode(p);
    const s = document.createElement('span'); s.className = 'sym'; s.textContent = p.sym; return s;
  }));
}
const symOf = id => id.replace(/^module-/, '');

async function lightFor(kind, what) {
  const ids = DRAWN_BY[kind];
  say([what + ' — drawn by ', ...ids.flatMap((id, k) => [k ? ' and ' : '', { sym: symOf(id) }]), '; lighting their routes on the wafer…']);
  const L = layers();
  if (!L) { say(['the wafer has not finished loading; tap again in a moment']); return; }
  await L.light(ids);
  say([what + ' — drawn by ', ...ids.flatMap((id, k) => [k ? ' and ' : '', { sym: symOf(id) }, ` [${L.status(id)}]`]), ' on the wafer']);
}

function onSubstation(e) {
  const f = e.features && e.features[0]; if (!f) return;
  const p = f.properties || {};
  lightFor('substation', `substation ${p.name || '(unnamed)'}${p.voltage ? ' · ' + p.voltage + ' V' : ''}`);
}
function onProject(e) {
  const f = e.features && e.features[0]; if (!f) return;
  const p = f.properties || {};
  const name = G.names ? G.names[p.i] : `project ${p.i}`;
  lightFor('project', `project ${name} · ${fmt(Number(p.capacity).toFixed(1))} MW${p.tech ? ' · ' + p.tech : ''}`);
}

/* ── wafer → ground ─────────────────────────────────────────────────────── */

function km(a, b) {
  const R = 6371.0088, rad = Math.PI / 180;
  const dLat = (b[1] - a[1]) * rad, dLon = (b[0] - a[0]) * rad;
  const h = Math.sin(dLat / 2) ** 2 + Math.cos(a[1] * rad) * Math.cos(b[1] * rad) * Math.sin(dLon / 2) ** 2;
  return 2 * R * Math.asin(Math.sqrt(h));
}

function onRoute(layerId) {
  const L = layers();
  const label = (L && L.label(layerId)) || layerId;
  if (!G.subs || !G.subs.length) { say(['that route belongs to ', { sym: symOf(layerId) }, ' — substations are still loading']); return; }
  const c = map.getCenter(), here = [c.lng, c.lat];
  let best = null, bestD = Infinity;
  for (const f of G.subs) { const d = km(here, f.geometry.coordinates); if (d < bestD) { bestD = d; best = f; } }
  map.flyTo({ center: best.geometry.coordinates, zoom: Math.max(map.getZoom(), 9) });
  say(['that route belongs to module ', { sym: symOf(layerId) }, ` (${label}) · map flown to the nearest substation to its centre: ${best.properties.name || '(unnamed)'}, ${bestD.toFixed(1)} km away`]);
}

(function hook() {
  const L = layers();
  if (!L) { setTimeout(hook, 200); return; }
  L.onPick.add(id => onRoute(id));
  const wait = () => { if (L.ids().length) counts(); else setTimeout(wait, 200); };
  wait();
})();
$('wafer').addEventListener('load', counts);

/* for tests: the real handlers, so a click can be fired with a real feature */
window.__bridge = Object.freeze({ onSubstation, onProject, onRoute, map });
</script>
</body>
</html>

Wafer

A web page in the iterations folder of Galaxies Wafers. Published at https://ventusltd.github.io/galaxies-wafers/iterations/10-ground-bridge/wafer.html.

rendergalaxies-wafers / iterations/10-ground-bridge/wafer.html · lines 1–41 of 41 · Entry point

What it does
It draws its content. Side effects: changes the web page (DOM).
Inputs & outputs
In: form fields (user input). Out: web page.
Downstream impact
Used directly by 1 file: Iterations — 10 Ground Bridge Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/10-ground-bridge/). It is itself an entry point, published at https://ventusltd.github.io/galaxies-wafers/iterations/10-ground-bridge/wafer.html.
What it achieves
The Line Wafer — every numbered line of the estate, on one surface.
Why it matters
Loaded by the 10 Ground Bridge map page at https://ventusltd.github.io/galaxies-wafers/iterations/10-ground-bridge/.
Application
galaxies-wafers · iterations/10-ground-bridge · page
Uses
Iterations — 07 Code Card Style Sheet (stylesheet), Galaxies Wafers — Proof Page (link), Iterations — 01 Route Alpha (script src), Layers Panel (script src)
Used by
embedded by Iterations — 10 Ground Bridge Page (iframe)
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
galaxies-wafers@5814793812add74605660fa821e6a39b8de80588 iterations/10-ground-bridge/wafer.html:1-41 · blob 28931f9f1186073a710f3d45570ab8653c8f14b8 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: unknown · users: none · canonical: unknown
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, maximum-scale=5">
<meta name="color-scheme" content="dark">
<title>The Line Wafer — every numbered line of the estate, on one surface</title>
<link rel="stylesheet" href="style.css">
</head>
<body>

<canvas id="stage" aria-label="Every permanently numbered line of code in the estate, placed by its own number."></canvas>

<header id="bar">
  <span id="wordmark">THE LINE WAFER</span>
  <span id="count" class="dim">loading the numbered database…</span>
</header>

<form id="beam" autocomplete="off">
  <input id="a" inputmode="numeric" pattern="[0-9]*" placeholder="line number" aria-label="line number to fly to">
  <input id="b" inputmode="numeric" pattern="[0-9]*" placeholder="connect to…" aria-label="second line number to connect to">
  <button id="go" type="submit">FLY</button>
</form>

<section id="panel" hidden>
  <button id="close" type="button" aria-label="close">✕</button>
  <div id="panelbody"></div>
</section>

<footer id="foot">
  <span id="prov" class="dim">provenance loading</span>
  <span id="hint" class="dim">drag to steer · pinch or scroll to focus the beam · tap a line</span>
  <a id="proofs" href="../../proof/">check every claim on this page</a>
</footer>

<noscript><p class="dim" style="padding:1rem">This surface is drawn from the numbered database at run time, so it needs JavaScript. Nothing here is typed into the page.</p></noscript>

<script type="module" src="app.mjs"></script>
<script type="module" src="layers-panel.mjs"></script>
</body>
</html>

Iterations — 11 the Bond

A JavaScript module in Galaxies Wafers that draws on a canvas. Served with the page at https://ventusltd.github.io/galaxies-wafers/iterations/11-the-bond/.

interactiongalaxies-wafers / iterations/11-the-bond/app.mjs · lines 1–84 of 84 · Entry point · pattern string (shared by 2 files)

What it does
It draws its content. Defines 10 functions or classes, including $, number, make, string, field. Side effects: changes the web page (DOM); makes network requests.
Why it exists in the grid workflow
README: "Required browser files: `index.html`, `style.css`, `app.mjs`, `model.mjs`, `report.json`, and unchanged `wafer.mjs`."
Inputs & outputs
In: JSON file report.json. Out: canvas drawing.
Downstream impact
Used directly by 1 file: Iterations — 11 the Bond Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/11-the-bond/). It is itself an entry point, published at https://ventusltd.github.io/galaxies-wafers/iterations/11-the-bond/.
What it achieves
It is built from the number step (`number`), the make step (`make`) and the string step (`string`). The README says: Required browser files: `index.html`, `style.css`, `app.mjs`, `model.mjs`, `report.json`, and unchanged `wafer.mjs`. It reads `./report.json`. It responds to click, input and change events.
Why it matters
Loaded by the page of the same name at https://ventusltd.github.io/galaxies-wafers/iterations/11-the-bond/.
Application
galaxies-wafers · iterations/11-the-bond · JavaScript module
Uses
Wafer (import), Model (import)
Used by
loaded by Iterations — 11 the Bond Page (script src)
Produces
$, number, make, string, field, inspect, filter, draw, plot, start
Defines here
$, number, make, string, field, inspect, filter, draw, plot, start
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
galaxies-wafers@5814793812add74605660fa821e6a39b8de80588 iterations/11-the-bond/app.mjs:1-84 · blob 4d9d609ab00594b80bdbc9e90a95ffd3262f8e96 · GitHub at these lines
State
achieves: readme · context: readme_derived · stage: output · effects: dom, network · domain stage: unknown · users: none · canonical: duplicate_candidate
import { place } from './wafer.mjs';
import { validateReport, filterRows, summarise, selectionFromHash, layerHash } from './model.mjs';

const $ = id => document.getElementById(id);
const state = { report: null, selected: null };
const number = n => Number(n || 0).toLocaleString('en-GB');
const make = (tag, text, className) => { const n = document.createElement(tag); if (text !== undefined) n.textContent = text; if (className) n.className = className; return n; };
const string = value => typeof value === 'string' ? value : JSON.stringify(value);
function field(parent, title, value) { const box = make('div'); box.append(make('dt', title), make('dd', number(value))); parent.append(box); }
function inspect(row) {
  state.selected = row.layer_id;
  history.replaceState(null, '', layerHash(row.layer_id));
  const panel = $('inspection'); panel.replaceChildren(make('h2', row.layer_id), make('p', row.status));
  const back = make('button', 'Back to layers'); back.type = 'button';
  back.addEventListener('click', () => { $('search').focus(); $('search').scrollIntoView({block:'center'}); }); panel.append(back);
  const permalink = make('a', 'Link to this layer'); permalink.href = layerHash(row.layer_id); const linkBox = make('p'); linkBox.append(permalink); panel.append(linkBox);
  panel.append(make('h3', 'The claim'), make('p', row.claim_text || 'No claim text supplied.'));
  if (row.first_deviation) { panel.append(make('h3','First contradiction'), make('pre',JSON.stringify(row.first_deviation,null,2))); }
  const predicateDetails = make('details'); predicateDetails.open = row.status === 'CONTRADICTED';
  predicateDetails.append(make('summary', `${number(row.predicates.length)} predicate results — expand to inspect`));
  for (const predicate of row.predicates || []) {
    const card = make('section', undefined, 'predicate');
    card.append(make('strong', predicate.text || predicate.id), make('p', `${predicate.status} · ${number(predicate.checked)} of ${number(predicate.total)} checked`));
    if (predicate.first_deviation) card.append(make('pre', JSON.stringify(predicate.first_deviation, null, 2)));
    predicateDetails.append(card);
  }
  if (row.disclosed?.length) { const details = make('details'); details.append(make('summary', `DISCLOSED · ${number(row.disclosed.length)} gap records`)); for (const item of row.disclosed) details.append(make('p', `${item.field}: ${string(item.value)}`)); panel.append(details); }
  if (row.not_evaluated?.length) { const details = make('details'); details.open = true; details.append(make('summary', `NOT EVALUATED · ${number(row.not_evaluated.length)} statements`)); for (const item of row.not_evaluated) { const box = make('div', undefined, 'predicate'); box.append(make('p', item.text || item.field), make('p', item.reason, 'dim')); details.append(box); } panel.append(details)  … [line shortened here: 403 characters; full line on GitHub]
  panel.append(predicateDetails);
  for (const button of $('layers').querySelectorAll('button')) button.setAttribute('aria-pressed', String(button.dataset.layer === row.layer_id));
  draw();
}
function filter() {
  const q = $('search').value.toLowerCase().trim(), result = $('status').value;
  const rows = filterRows(state.report.rows, q, result);
  const fragment = document.createDocumentFragment();
  for (const row of rows) {
    const button = make('button', undefined, 'layer'); button.type = 'button'; button.dataset.layer = row.layer_id;
    button.setAttribute('aria-pressed', String(row.layer_id === state.selected));
    button.append(make('strong', row.layer_id), make('span', row.status, 'state'));
    const predicates = row.predicates || [], passed = predicates.filter(p => p.status === 'PASSED').length;
    button.append(make('p', `${number(passed)} passing predicates · ${number(row.not_evaluated?.length)} statements not evaluated · ${number(row.disclosed?.length)} gap records`));
    button.addEventListener('click', () => { inspect(row); $('inspection').scrollIntoView({block:'start'}); $('inspection').focus({preventScroll:true}); }); fragment.append(button);
  }
  $('layers').replaceChildren(fragment); $('shown').textContent = `${number(rows.length)} of ${number(state.report.rows.length)} layers shown`;
}
function draw() {
  if (!state.report) return;
  const canvas = $('wafer'), rect = canvas.getBoundingClientRect(), ratio = Math.min(devicePixelRatio || 1, 2);
  canvas.width = Math.round(rect.width * ratio); canvas.height = Math.round(rect.height * ratio);
  const ctx = canvas.getContext('2d'); if (!ctx) { $('map-note').textContent = 'Canvas unavailable; all audit evidence remains readable below.'; return; }
  ctx.setTransform(ratio, 0, 0, ratio, 0, 0); ctx.clearRect(0, 0, rect.width, rect.height);
  const samples = state.report.preview?.anchors || [], max = state.report.preview?.max_key || 1;
  const scale = Math.min(rect.width, rect.height) * .46 / Math.sqrt(max);
  const plot = (key, radius) => { const [x, y] = place(key); ctx.beginPath(); ctx.arc(rect.width / 2 + x * scale, rect.height / 2 - y * scale, radius, 0, Math.PI * 2); ctx.fill(); };
  ctx.fillStyle = '#677083'; for (const sample of samples) for (const key of sample.keys) plot(key, 1.15);
  const selected = samples.find(s => s.layer_id === state.selected);
  ctx.fillStyle = '#5ec8f2'; for (const key of selected?.keys || []) plot(key, 2.5);
  const count = samples.reduce((n, s) => n + s.keys.length, 0);
  $('map-note').textContent = `${number(count)} sampled layer anchors · frozen wafer.v1 placement${selected ? ` · ${selected.layer_id} selected` : ''}. Marks are not a verdict colour scale.`;
}
async function start() {
  try {
    const response = await fetch('./report.json'); if (!response.ok) throw new Error(`Audit file returned ${response.status}`);
    const report = validateReport(await response.json());
    state.report = report;
    const totals = $('totals');
    const summary = summarise(report.rows);
    field(totals, 'Layers inspected', summary.layers);
    field(totals, 'Contradicted', summary.statuses.CONTRADICTED);
    field(totals, 'Statements not evaluated', summary.statements);
    field(totals, 'Disclosed gap records', summary.gapRecords);
    $('coverage').textContent = `${number(summary.checked)} of ${number(summary.total)} check units evaluated. These mix structural and semantic checks; this is not a percentage of claims proved.`;
    $('load').hidden = true; $('workspace').hidden = false;
    const provenance = report.provenance || {};
    $('provenance').textContent = `Snapshot ${provenance.generated_utc || 'time not recorded'} · source ${provenance.commit || 'not recorded'} · values counted from this audit, not current live state.`;
    if (/^[0-9a-f]{40}$/.test(provenance.commit || '')) $('source').href = `https://github.com/Ventusltd/galaxies-wafers/tree/${provenance.commit}`;
    $('search').addEventListener('input', filter); $('status').addEventListener('change', filter); window.addEventListener('resize', draw);
    const applySelection = () => { const selected = selectionFromHash(location.hash,report.rows); $('selection-note').textContent = selected.why; if (selected.row) { inspect(selected.row); $('inspection').scrollIntoView({block:'start'}); } else { state.selected = null; $('inspection').replaceChildren(make('h2','Select a layer'),make('p',selected.why || 'Its claim, evaluated predicates and gaps app  … [line shortened here: 436 characters; full line on GitHub]
    window.addEventListener('hashchange',applySelection);
    filter(); draw(); applySelection();
  } catch (error) { $('workspace').hidden = true; $('load').hidden = false; $('load').textContent = `Audit unavailable: ${error.message}. No result has been inferred.`; }
}
start();