In this section
- GlobalGrid2050 — Plant Page render · globalgrid2050 / plant/index.html lines 1–136
- GlobalGrid2050 Status render · globalgrid2050 / status.html lines 1–56
- Capsule Launch interaction · globalgrid2050 / testcode/202609051344/capsule-launch.js lines 1–13
- Dismissal ingest · globalgrid2050 / testcode/202609051932/tool-layers/dismissal.js lines 1–16
- Viewport render · globalgrid2050 / testcode/202609051945/tool-layers/viewport.js lines 1–16
- Focus Boundary interaction · globalgrid2050 / testcode/202609051948/tool-layers/focus-boundary.js lines 1–24
- Recovery render · globalgrid2050 / testcode/202609051953/tool-layers/recovery.js lines 1–12
- Navigation ingest · globalgrid2050 / testcode/202609052015/tool-layers/navigation.js lines 1–28
- Readiness interaction · globalgrid2050 / testcode/202609052015/tool-layers/readiness.js lines 1–52
- Source Browser interaction · globalgrid2050 / testcode/202609052023/source-browser/source-browser.mjs lines 1–65
- Host render · globalgrid2050 / testcode/202609052023/tool-layers/host.js lines 1–59
- Reported Project transform · globalgrid2050 / testcode/202609060208/reported-project.mjs lines 1–24
- Journey interaction · globalgrid2050 / testcode/202609141423/journey.js lines 1–115
- Testcode — V02 Radial Sunburst Page render · globalgrid2050 / testcode/202609141522/v02-radial-sunburst/index.html lines 1–74
GlobalGrid2050 — Plant Page
A web page. Published at https://globalgrid2050.com/plant/.
renderglobalgrid2050 / plant/index.html · lines 1–136 of 136 · Entry point
- What it does
- It draws its content. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage sub33kv_design (voltage levels 1500V (all 33kV or below)): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: 1500V.
- Inputs & outputs
- In: form fields (user input). Out: web page. Voltage levels named: 1500V.
- Downstream impact
- Used directly by 25 files: Kuiper Grid — I0073 Page (globalgrid2050, https://globalgrid2050.com/kuiper-grid/i0073/); Kuiper Grid — I0083 Page (globalgrid2050, https://globalgrid2050.com/kuiper-grid/i0083/); Kuiper Grid — I0084 Page (globalgrid2050, https://globalgrid2050.com/kuiper-grid/i0084/); Kuiper Grid — I0085 Page (globalgrid2050, https://globalgrid2050.com/kuiper-grid/i0085/); and 21 more. Reached from 84 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); Homepage V037 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v037.html); Homepage V038 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v038.html). It is itself an entry point, published at https://globalgrid2050.com/plant/.
- What it achieves
- Will this string go over 1500 V on the coldest morning?
- Why it matters
- Loaded by the I0073 page at https://globalgrid2050.com/kuiper-grid/i0073/ and 24 other pages.
- Application
- globalgrid2050 · plant · page
- Uses
- Manual (link), GlobalGrid2050 — Kuiper Grid Page (link), Kuiper Grid — I0097 Page (link)
- Used by
- linked from Kuiper Grid — I0073 Page (link), linked from Kuiper Grid — I0083 Page (link), linked from Kuiper Grid — I0084 Page (link), linked from Kuiper Grid — I0085 Page (link), linked from Kuiper Grid — I0086 Page (link), linked from Kuiper Grid — I0087 Page (link), linked from Kuiper Grid — I0088 Page (link), linked from Kuiper Grid — I0089 Page (link), and 17 more
- 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
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 plant/index.html:1-136 · blob ccfca8ffa78248910903910ca7f085f362d7297e · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Will this string go over 1500 V on the coldest morning?</title>
<style>
:root { color-scheme: dark; }
html, body { margin: 0; padding: 0; background: #000; color: #e6e6e6; }
body {
font-family: ui-monospace, Consolas, "Courier New", monospace;
font-size: 16px;
line-height: 1.55;
padding: 20px 16px 48px;
max-width: 44rem;
overflow-x: hidden;
}
h1 { font-size: 1.25rem; line-height: 1.35; margin: 0 0 1rem; font-weight: 700; }
h2 { font-size: 1rem; margin: 2rem 0 0.5rem; font-weight: 700; color: #9fd0ff; }
p { margin: 0 0 1rem; }
a { color: #7fc4ff; }
a:visited { color: #b79bff; }
.warn {
border: 1px solid #ff4d4d;
color: #ff6b6b;
padding: 12px;
margin: 0 0 1.5rem;
font-weight: 700;
}
.lead { font-size: 1.05rem; }
ol.steps { margin: 0 0 1rem; padding-left: 1.4rem; }
ol.steps li { margin: 0 0 0.5rem; }
ul { list-style: none; margin: 0; padding: 0; }
.case { border: 1px solid #333; padding: 12px; margin: 0 0 1.25rem; }
.name { display: block; font-weight: 700; font-size: 1.05rem; margin-bottom: 0.35rem; }
.note { display: block; color: #bdbdbd; margin-bottom: 0.6rem; }
.fault { color: #ffb37a; }
.cmd {
display: block;
width: 100%;
box-sizing: border-box;
background: #0d0d0d;
border: 1px solid #444;
color: #e6e6e6;
font-family: inherit;
font-size: 16px;
line-height: 1.4;
padding: 10px;
min-height: 44px;
resize: vertical;
white-space: pre-wrap;
word-break: break-all;
}
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; margin-top: 10px; }
.btn {
display: inline-flex;
align-items: center;
min-height: 44px;
padding: 0 14px;
border: 1px solid #7fc4ff;
color: #7fc4ff;
text-decoration: none;
font-weight: 700;
}
button.btn { background: transparent; cursor: pointer; font-family: inherit; font-size: 16px; }
.limits li { margin: 0 0 0.6rem; }
footer { margin-top: 2.5rem; border-top: 1px solid #333; padding-top: 1rem; color: #b0b0b0; font-size: 0.9rem; }
footer a { word-break: break-all; }
</style>
</head>
<body>
<h1>Will this string go over 1500 V on the coldest morning — and by how much?</h1>
<p class="lead">Type the module class, how many you put in series and the site’s coldest temperature, and the page draws the plant and tells you, in volts, whether that string sits under the 1500 V equipment rating or over it.</p>
<p class="warn">DEVELOPMENT ENVIRONMENT. A chart, not a design. Not a connection assessment. Consult qualified engineers.</p>
<p><a href="/">home</a> · <a href="/kuiper-grid/manual.html">the manual, read this first</a> · <a href="/kuiper-grid/">all builds</a></p>
<h2>How to use it</h2>
<ol class="steps">
<li>Open the build.</li>
<li>Type one of the commands below into its command box and press Enter.</li>
</ol>
<p>There is no query route yet, so the command has to be typed rather than carried in the link. Copy it here, then open the build.</p>
<h2>Three worth typing</h2>
<ul>
<li class="case">
<span class="name">Thirty in series, coldest −10 °C — passes</span>
<span class="note">Clears the 1500 V rating by <strong>2.5 V</strong>. That is the whole margin: two and a half volts on fifteen hundred.</span>
<textarea class="cmd" rows="2" readonly onclick="this.select()">fire site {"module_class":"T660","modules_in_series":30,"site_min_c":-10}</textarea>
<div class="row">
<button class="btn" type="button" onclick="var t=this.closest('.case').querySelector('.cmd');t.select();document.execCommand('copy');this.textContent='copied';">copy command</button>
<a class="btn" href="/kuiper-grid/i0097/index.html">open the build</a>
</div>
</li>
<li class="case">
<span class="name">Same string, the top bin that actually turned up — fails</span>
<span class="note fault">One bin up, same thirty modules, same −10 °C: <strong>over the rating by 4.0 V</strong>. The delivered bin is what decides it, not the one on the offer.</span>
<textarea class="cmd" rows="2" readonly onclick="this.select()">fire site {"module_class":"T665","modules_in_series":30,"site_min_c":-10}</textarea>
<div class="row">
<button class="btn" type="button" onclick="var t=this.closest('.case').querySelector('.cmd');t.select();document.execCommand('copy');this.textContent='copied';">copy command</button>
<a class="btn" href="/kuiper-grid/i0097/index.html">open the build</a>
</div>
</li>
<li class="case">
<span class="name">A bad input — it refuses</span>
<span class="note">Given a count it cannot stand behind, it says so in words. Nothing is drawn and no default answers in its place.</span>
<textarea class="cmd" rows="2" readonly onclick="this.select()">fire site {"modules_in_series":"thirty"}</textarea>
<div class="row">
<button class="btn" type="button" onclick="var t=this.closest('.case').querySelector('.cmd');t.select();document.execCommand('copy');this.textContent='copied';">copy command</button>
<a class="btn" href="/kuiper-grid/i0097/index.html">open the build</a>
</div>
</li>
</ul>
<h2>What it is not</h2>
<ul class="limits">
<li>It is a <strong>chart, not a design</strong>. It says where to look and where to simulate; it does not say what the simulation will find. It is <strong>not a connection offer</strong>, not a constructability assessment and not a consenting design, and <strong>no output of it is engineering</strong> — engineering carries a named, qualified engineer, and nothing here does.</li>
<li>It measures against <strong>four limits, and two of them have no source</strong> in the evidence base. Two are printed on the source documents: the 1500 V system rating and the 35 A maximum series fuse. Two are not: the 40 A per-input limit is recorded absent from both documents, and the 20 A string-current limit appears nowhere in the evidence base at all. Treat any verdict that turns on th … [line shortened here: 655 characters; full line on GitHub]
<li>Nothing here is a <strong>connection assessment</strong>. It says nothing about what any asset can carry, how much of that is already committed, or what is connected.</li>
<li>Voltage margin does not divide by plant size. One design stamped out N times means every string is identical, and the trigger — a cold morning — reaches the whole site inside the same hour. Scale multiplies the consequence and never the tolerance.</li>
</ul>
<footer>
<p>The build: <a href="/kuiper-grid/i0097/index.html">/kuiper-grid/i0097/index.html</a>. All builds: <a href="/kuiper-grid/index.html">/kuiper-grid/index.html</a>. The manual: <a href="/kuiper-grid/manual.html">/kuiper-grid/manual.html</a>. How the numbers survive a search that destroys most of what it touches: <a href="/kuiper-grid/manual.html#proof">the proof</a>.</p>
<p>No project, site, client or manufacturer is named anywhere in this work.</p>
</footer>
</body>
</html>GlobalGrid2050 Status
A web page covering the Renewable Energy Planning Database (REPD) register and substations, using SHA-256. Published at https://globalgrid2050.com/status.html.
renderglobalgrid2050 / status.html · lines 1–56 of 56 · Entry point
- What it does
- It draws the REPD register and substations. Side effects: changes the web page (DOM).
- 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: the REPD register, substations, 132kV.
- Inputs & outputs
- Out: web page. Voltage levels named: 132kV.
- Downstream impact
- Used directly by 52 files: Live Log (claude); Homepage V037 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v037.html); Homepage V038 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v038.html); Homepage V039 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v039.html); and 48 more. It is itself an entry point, published at https://globalgrid2050.com/status.html.
- What it achieves
- Its code works with 132 kV.
- Why it matters
- Loaded by the Homepage V037 page at https://globalgrid2050.com/homepage_versions/homepage_v037.html and 50 other pages. Also imported by Live Log, from Claude.
- Application
- globalgrid2050 · / · page
- Uses
- none found
- Used by
- named by URL in Live Log (estate URL), linked from Homepage V037 (link), linked from Homepage V038 (link), linked from Homepage V039 (link), linked from Homepage V040 (link), linked from Homepage V041 (link), linked from Homepage V043 (link), linked from Homepage V044 (link), and 44 more
- 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
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 status.html:1-56 · blob a7bbb2a436c49efec4a4c1939567046bc3dd63d5 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>GlobalGrid2050 — build status</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body { background:#000; color:#fff; font-family:Courier,monospace; padding:40px;
max-width:900px; margin:0 auto; font-size:18px; line-height:1.6; }
h1 { margin-top:0; font-size:40px; line-height:1.1; }
h2 { font-size:18px; font-weight:normal; letter-spacing:.14em; text-transform:uppercase;
color:#888; margin:46px 0 6px; }
a { color:#66ccff; text-decoration:none; }
a:hover { text-decoration:underline; }
.lede { color:#cccccc; font-size:16px; }
.written { color:#888; font-size:15px; }
.entry { border-top:1px solid #222; padding-top:12px; margin-top:22px; }
.when { color:#66ccff; font-size:15px; margin:0; }
.bst { color:#6f8f9c; }
.lane { float:right; color:#888; }
.where { margin:2px 0 0; font-size:15px; color:#aaa; }
.repo { color:#fff; }
.commit { color:#8fb6c0; }
.what { margin:6px 0 0; font-size:16px; }
.verified { margin:2px 0 0; font-size:14px; color:#7f9f88; }
ul { padding-left:20px; }
li { margin-top:10px; font-size:16px; color:#ccc; }
@media (max-width:600px) {
body { padding:25px; font-size:16px; }
h1 { font-size:32px; }
.lane { float:none; display:block; }
}
</style>
</head>
<body>
<header>
<h1>Build status</h1>
<p class="lede">What is being built, as it is built. Published at intervals so the
work can be picked up again when a session ends — by a person or by the next model.
Times are UTC first, because stamps in this estate are read from the clock in UTC;
the second time is the same moment in British Summer Time.</p>
<p class="written">Written 2026-09-05 09:36 UTC · 10:36 BST</p>
<p><a href="./">← GlobalGrid2050</a></p>
</header>
<h2>Open</h2>
<ul><li>Not started: the end-owner scope feature - a menu button to click anywhere and analyse nearby substations, and adding substations for optioneering. Decided: session-only, never persisted and never carried in a deep link, so a speculative asset can never be mistaken for a published one.</li><li>The kernel at registry_of_all_content_in_repos_and_dependencies is real but incomplete: generated … [line shortened here: 1,961 characters; full line on GitHub]
<h2>Log</h2>
<article class="entry"><p class="when">2026-09-05 04:10 UTC<span class="bst"> · 05:10 BST</span><span class="lane">lane A</span></p><p class="where"><span class="repo">testcode</span> <span class="commit">882e86c</span></p><p class="what">A mention is not a link. Lane B caught the driver flagging files that name the retired route in order to assert its absence - a proof saying "this must neve … [line shortened here: 14,860 characters; full line on GitHub]
<footer>
<p class="written">Build facts only. This page is public.</p>
</footer>
</body>
</html>Capsule Launch
A JavaScript file in the testcode folder of GlobalGrid2050 that fetches cases.
interactionglobalgrid2050 / testcode/202609051344/capsule-launch.js · lines 1–13 of 13 · version 2026-09-05 13:44 · Not reached from any entry point (candidate for review)
- What it does
- It fetches cases. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
- Inputs & outputs
- In: JSON file cases.json.
- What it achieves
- It reads `./cases.json`. It responds to click events.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609051344 · script
- Uses
- none found
- Used by
- none found
- 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
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609051344/capsule-launch.js:1-13 · blob bc084744dc1e54872aee427a18490133c1f80869 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: experimental · users: none · canonical: unreached_review
(async()=>{
const {cases}=await(await fetch('./cases.json')).json();
document.querySelectorAll('[data-case]').forEach(button=>button.addEventListener('click',()=>{
const c=cases.find(c=>c.case_id===button.dataset.case);const u=new URL('./atlas/',location.href);
u.searchParams.set('testcode_case',c.case_id);u.searchParams.set('testcode_entity_kind',c.kind);u.searchParams.set('testcode_entity_id',c.entity_id);
if(c.kind==='repd'){
u.searchParams.set('repd_ref',c.entity_id);u.searchParams.set('technology',c.technology);u.searchParams.set('project',c.name);
if(c.capacity_mw!=null)u.searchParams.set('capacity_mw',c.capacity_mw);
if(c.has_location){u.searchParams.set('longitude',c.longitude);u.searchParams.set('latitude',c.latitude);}
}
window.open(u.href,'_blank','noopener');
}));
})();Dismissal
A JavaScript module in the tool layers folder of GlobalGrid2050 that works with detach child (`detachChild`).
ingestglobalgrid2050 / testcode/202609051932/tool-layers/dismissal.js · lines 1–16 of 16 · version 2026-09-05 19:32 · pattern detachChild (shared by 2 files)
- What it does
- Defines bindLayerDismissal, handle, detachChild, loaded.
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
- Downstream impact
- Used directly by 2 files: Dismissal Test (testcode); Host (globalgrid2050). Reached from 3 other entry points, including Codex Cartridges Workflow (testcode); Controls Layout Workflow (testcode); Offshore Route Workflow (testcode).
- What it achieves
- It binds layer dismissal (`bindLayerDismissal`) and is built from the handle step (`handle`) and the detach child helper (`detachChild`). Close a visible tool with Escape, including when focus is inside its same-origin app. It responds to keydown and load events.
- Why it matters
- Imported by Host. Checked by Dismissal Test.
- Application
- globalgrid2050 · testcode/202609051932/tool-layers · JavaScript module
- Uses
- none found
- Used by
- imported by Dismissal Test (import), imported by Host (import), mentioned in Standalone (comment link)
- Produces
- bindLayerDismissal
- Defines here
- bindLayerDismissal, handle, detachChild, loaded
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609051932/tool-layers/dismissal.js:1-16 · blob 4ed3e8eab87aceb8b7c97deb25d1fd0efcd3535e · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: experimental · users: none · canonical: production_core
/** Close a visible tool with Escape, including when focus is inside its same-origin app. */
export function bindLayerDismissal(layer, frame, close) {
const handle = event => {
if (event.key !== 'Escape' || event.defaultPrevented || layer.style.display === 'none') return;
event.preventDefault(); close();
};
let child;
const detachChild = () => { child?.removeEventListener('keydown', handle); child = undefined; };
const loaded = () => {
detachChild();
try { child = frame.contentDocument; child?.addEventListener('keydown',handle); } catch { /* Cross-origin navigation keeps the parent close control. */ }
};
layer.addEventListener('keydown', handle);
frame.addEventListener('load',loaded);
return () => {detachChild(); layer.removeEventListener('keydown',handle); frame.removeEventListener('load',loaded);};
}Viewport
A JavaScript module in the tool layers folder of GlobalGrid2050. It applies tool viewport (`applyToolViewport`).
renderglobalgrid2050 / testcode/202609051945/tool-layers/viewport.js · lines 1–16 of 16 · version 2026-09-05 19:45 · Not reached from any entry point (candidate for review)
- What it does
- Defines applyToolViewport. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
- Downstream impact
- Used directly by 1 file: Host (globalgrid2050).
- What it achieves
- Size only the integration frame; the original application's layout remains its own.
- Why it matters
- Imported by Host.
- Application
- globalgrid2050 · testcode/202609051945/tool-layers · JavaScript module
- Uses
- none found
- Used by
- imported by Host (import), mentioned in Standalone (comment link)
- Produces
- applyToolViewport
- Defines here
- applyToolViewport
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609051945/tool-layers/viewport.js:1-16 · blob 1a33f9264143691365ca0e9cae1ca040a9d0ba05 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: unreached_review
/** Size only the integration frame; the original application's layout remains its own. */
export function applyToolViewport(layer, bar, frame) {
Object.assign(layer.style,{boxSizing:'border-box',width:'100%',height:'100%',overflow:'hidden'});
if(globalThis.CSS?.supports('height','100dvh')) layer.style.height='100dvh';
Object.assign(bar.style,{
display:'grid',gridTemplateColumns:'minmax(0,1fr) minmax(100px,auto)',
columnGap:'12px',rowGap:'2px',flexShrink:'0',boxSizing:'border-box',
paddingTop:'max(6px, env(safe-area-inset-top))',paddingBottom:'6px',
paddingLeft:'max(12px, env(safe-area-inset-left))',paddingRight:'max(12px, env(safe-area-inset-right))'
});
const title=bar.querySelector('strong'), status=bar.querySelector('[data-tool-readiness]'), close=bar.querySelector('button');
Object.assign(title.style,{gridColumn:'1',gridRow:'1',minWidth:'0',overflowWrap:'anywhere'});
Object.assign(status.style,{gridColumn:'1',gridRow:'2',fontSize:'12px',minWidth:'0',overflowWrap:'anywhere'});
Object.assign(close.style,{gridColumn:'2',gridRow:'1 / 3',minHeight:'44px',maxWidth:'min(220px,45vw)',whiteSpace:'normal'});
Object.assign(frame.style,{display:'block',minWidth:'0',minHeight:'0',width:'100%',flex:'1 1 0',boxSizing:'border-box'});
}Focus Boundary
A JavaScript module in the tool layers folder of GlobalGrid2050 that keeps keyboard traversal within a same-origin tool without changing its internal tab order.
interactionglobalgrid2050 / testcode/202609051948/tool-layers/focus-boundary.js · lines 1–24 of 24 · version 2026-09-05 19:48 · pattern loaded (shared by 4 files)
- What it does
- It lists and searches its content. Defines bindFocusBoundary, items, handle, loaded. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
- Downstream impact
- Used directly by 2 files: Focus Boundary Test (testcode); Host (globalgrid2050). Reached from 3 other entry points, including Codex Cartridges Workflow (testcode); Controls Layout Workflow (testcode); Offshore Route Workflow (testcode).
- What it achieves
- It is built from the loaded step (`loaded`). Defines `bindFocusBoundary`, `items`, `handle` and 1 more. It responds to keydown and load events.
- Why it matters
- Imported by Host. Checked by Focus Boundary Test.
- Application
- globalgrid2050 · testcode/202609051948/tool-layers · JavaScript module
- Uses
- none found
- Used by
- imported by Focus Boundary Test (import), imported by Host (import), mentioned in Standalone (comment link)
- Produces
- bindFocusBoundary
- Defines here
- bindFocusBoundary, items, handle, loaded
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609051948/tool-layers/focus-boundary.js:1-24 · blob 345eb150d78ffe3e85e610ad7b58426d089b47a0 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
/** Keep keyboard traversal within a same-origin tool without changing its internal tab order. */
export function bindFocusBoundary(layer, frame, close) {
let child;
const items = () => [...(child?.querySelectorAll('a[href],button,input,select,textarea,[tabindex]') || [])]
.filter(node => !node.disabled && node.tabIndex >= 0 && !node.closest('[inert]') && node.getClientRects().length && child.defaultView.getComputedStyle(node).visibility !== 'hidden');
const handle = event => {
if(event.key !== 'Tab' || event.defaultPrevented || layer.style.display === 'none' || !child) return;
const nodes=items(), first=nodes[0], last=nodes.at(-1);
const controls=layer.querySelectorAll ? [...layer.querySelectorAll('button')].filter(node=>!node.disabled && node.tabIndex>=0 && node.getClientRects().length && node.ownerDocument.defaultView.getComputedStyle(node).visibility!=='hidden') : [close];
const firstControl=controls[0] || close, lastControl=controls.at(-1) || close;
let target;
if(event.target===firstControl && event.shiftKey) target=last || lastControl;
else if(event.target===lastControl && !event.shiftKey) target=first || firstControl;
else if(event.shiftKey && event.target===first) target=lastControl;
else if(!event.shiftKey && event.target===last) target=firstControl;
if(target) {event.preventDefault();target.focus();}
};
const loaded = () => {
child?.removeEventListener('keydown',handle); child=undefined;
try {child=frame.contentDocument;child?.addEventListener('keydown',handle);} catch { /* Parent close remains keyboard accessible after cross-origin navigation. */ }
};
layer.addEventListener('keydown',handle);frame.addEventListener('load',loaded);
return () => {child?.removeEventListener('keydown',handle);layer.removeEventListener('keydown',handle);frame.removeEventListener('load',loaded);};
}Recovery
A JavaScript module in the tool layers folder of GlobalGrid2050. It is built from the should offer recovery helper (`shouldOfferRecovery`) and the mount tool recovery helper (`mountToolRecovery`).
renderglobalgrid2050 / testcode/202609051953/tool-layers/recovery.js · lines 1–12 of 12 · version 2026-09-05 19:53 · pattern reflect (shared by 17 files)
- What it does
- It draws its content. Defines shouldOfferRecovery, mountToolRecovery, reflect. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
- Downstream impact
- Used directly by 2 files: Recovery Test (testcode); Host (globalgrid2050). Reached from 3 other entry points, including Codex Cartridges Workflow (testcode); Controls Layout Workflow (testcode); Offshore Route Workflow (testcode).
- What it achieves
- Defines `shouldOfferRecovery`, `mountToolRecovery` and `reflect`. It responds to click events.
- Why it matters
- Imported by Host. Checked by Recovery Test.
- Application
- globalgrid2050 · testcode/202609051953/tool-layers · JavaScript module
- Uses
- none found
- Used by
- imported by Recovery Test (import), imported by Host (import), mentioned in Standalone (comment link)
- Produces
- shouldOfferRecovery, mountToolRecovery
- Defines here
- shouldOfferRecovery, mountToolRecovery, reflect
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609051953/tool-layers/recovery.js:1-12 · blob 1f2229ad5be94744e175a6d4418c7599e67ad598 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
export function shouldOfferRecovery(state) {
return state.interface==='unrecognised' || state.timedOut==='true';
}
/** A retry requests confirmation; it never directly replaces a tool's document. */
export function mountToolRecovery(bar, status, requestConfirmation) {
const button=bar.ownerDocument.createElement('button');button.textContent='Retry tool loading';
Object.assign(button.style,{gridColumn:'1 / -1',minHeight:'44px',justifySelf:'start',cursor:'pointer'});
const reflect=()=>{button.hidden=!shouldOfferRecovery(status.dataset);};
button.addEventListener('click',requestConfirmation);reflect();bar.append(button);
const observer=new MutationObserver(reflect);observer.observe(status,{attributes:true});
return ()=>{observer.disconnect();button.removeEventListener('click',requestConfirmation);button.remove();};
}Navigation
A JavaScript module in the tool layers folder of GlobalGrid2050 that resolves tool destination (`resolveToolDestination`). It resolves tool destination (`resolveToolDestination`) and binds tool navigation (`bindToolNavigation`).
ingestglobalgrid2050 / testcode/202609052015/tool-layers/navigation.js · lines 1–28 of 28 · version 2026-09-05 20:15 · pattern loaded (shared by 4 files)
- What it does
- Defines resolveToolDestination, bindToolNavigation, loaded.
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
- Downstream impact
- Used directly by 2 files: Navigation Test (testcode); Host (globalgrid2050). Reached from 3 other entry points, including Codex Cartridges Workflow (testcode); Controls Layout Workflow (testcode); Offshore Route Workflow (testcode).
- What it achieves
- Bind the visible shell to the current document, keeping original links intact. It responds to load events.
- Why it matters
- Imported by Host. Checked by Navigation Test.
- Application
- globalgrid2050 · testcode/202609052015/tool-layers · JavaScript module
- Uses
- Readiness (import)
- Used by
- imported by Navigation Test (import), imported by Host (import), mentioned in Standalone (comment link)
- Produces
- resolveToolDestination, bindToolNavigation
- Defines here
- resolveToolDestination, bindToolNavigation, loaded
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609052015/tool-layers/navigation.js:1-28 · blob f97a655548a0ec1019697b58ef54b995ceb941ad · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: experimental · users: none · canonical: production_core
import {observeToolReadiness} from './readiness.js';
/** Bind the visible shell to the current document, keeping original links intact. */
export function resolveToolDestination(href, registry, base) {
const current=new URL(href,base);
return registry.find(tool=>{const target=new URL(tool.entry,base);return target.origin===current.origin&&target.pathname===current.pathname;}) || null;
}
export function bindToolNavigation(layer,frame,title,status,registry,base,initial) {
let disposeReadiness=observeToolReadiness(initial,frame,status);
const loaded=()=>{
disposeReadiness();delete status.dataset.timedOut;
let href;try{href=frame.contentWindow.location.href;}catch{}
const tool=href?resolveToolDestination(href,registry,base):null;
layer.dispatchEvent(new Event('tool-document-changed'));
if(tool){
title.textContent=tool.title;frame.title=tool.title;layer.setAttribute('aria-label',tool.title);
layer.dataset.currentTool=tool.id;layer.dataset.currentOwner=JSON.stringify(tool.owner);status.dataset.toolReadiness=tool.id;
if(tool.id==='dc-ac-lv-topology-review'){
status.dataset.interface='unreported';status.dataset.drawing='unreported';status.textContent='Page loaded; drawing readiness unreported';disposeReadiness=()=>{};
}else disposeReadiness=observeToolReadiness(tool,frame,status,{startLoaded:true});
}else{
title.textContent='Linked page';frame.title='Linked page';layer.setAttribute('aria-label','Linked page');
delete layer.dataset.currentTool;delete layer.dataset.currentOwner;delete status.dataset.toolReadiness;
status.dataset.interface='unbound';status.dataset.drawing='unreported';status.textContent='Linked page outside the pinned tool registry';disposeReadiness=()=>{};
}
};
frame.addEventListener('load',loaded);
return ()=>{disposeReadiness();frame.removeEventListener('load',loaded);};
}Readiness
A JavaScript module in the tool layers folder of GlobalGrid2050 that draws on a canvas, covering cables.
interactionglobalgrid2050 / testcode/202609052015/tool-layers/readiness.js · lines 1–52 of 52 · version 2026-09-05 20:15
- What it does
- It draws cables. Defines 6 functions or classes, including inspectToolReadiness, observeToolReadiness, timedOut, started, check. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: cables.
- Inputs & outputs
- Out: canvas drawing.
- Downstream impact
- Used directly by 2 files: Readiness Test (testcode); Navigation (globalgrid2050). Reached from 4 other entry points, including Codex Cartridges Workflow (testcode); Controls Layout Workflow (testcode); Offshore Route Workflow (testcode).
- What it achieves
- It is built from the inspect tool readiness helper (`inspectToolReadiness`), the observe tool readiness helper (`observeToolReadiness`) and the timed out helper (`timedOut`). Interface and drawing readiness are separate: DOM presence is not map completion. It responds to load and tool events.
- Why it matters
- Imported by Navigation. Checked by Readiness Test.
- Application
- globalgrid2050 · testcode/202609052015/tool-layers · JavaScript module
- Uses
- none found
- Used by
- imported by Readiness Test (import), imported by Navigation (import), mentioned in Standalone (comment link)
- Produces
- inspectToolReadiness, observeToolReadiness
- Defines here
- inspectToolReadiness, observeToolReadiness, timedOut, started, check, navigating
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609052015/tool-layers/readiness.js:1-52 · blob 2a19f26a45441322a9eed4eb6449d65effdf88e5 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
/** Interface and drawing readiness are separate: DOM presence is not map completion. */
export function inspectToolReadiness(id, doc) {
if(!doc || doc.readyState !== 'complete') return {interface:'loading',drawing:'pending',label:'Loading tool'};
const identity={'module-layout':'#ml_status','cable-geometry-visualiser':'#route_name','gis-sld-financial-sandbox':'#btn_draw'}[id];
if(identity && !doc.querySelector(identity))return {interface:'unrecognised',drawing:'unreported',label:'Tool interface not recognised'};
if(id==='module-layout') {
const ready=doc.querySelector('#ml_status')?.textContent.includes('Ready. Draw at map centre or pick a site.');
return {interface:'loaded',drawing:ready?'ready':'pending',label:ready?'Map ready':'Loading map'};
}
if(id==='cable-geometry-visualiser') {
const canvases=[...doc.querySelectorAll('canvas')];
const expected=['formation_canvas','trench_canvas','bend_canvas'];
const ready=canvases.length===3 && expected.every(id=>canvases.some(c=>c.id===id)) && canvases.every(canvas=>{
try {const bytes=canvas.getContext('2d').getImageData(0,0,canvas.width,canvas.height).data;
let opaque=0;const colors=new Set();
for(let i=0;i<bytes.length;i+=64) if(bytes[i+3]) {opaque++;colors.add(bytes[i]+','+bytes[i+1]+','+bytes[i+2]);}
return opaque>=8 && colors.size>=2;
} catch {return false;} return false;
});
return {interface:'loaded',drawing:ready?'ready':'pending',label:ready?'Drawings ready':'Loading drawings'};
}
if(id==='gis-sld-financial-sandbox' && doc.querySelector('#btn_draw')) return {interface:'loaded',drawing:'unreported',label:'Interface loaded'};
return {interface:'unrecognised',drawing:'unreported',label:'Tool interface not recognised'};
}
export function observeToolReadiness(tool, frame, status, {timeout=30000,interval=200,startLoaded=false}={}) {
let timer, mutation, disposed=false;
const timedOut=()=>{if(disposed)return;status.textContent='Tool is taking longer to load';status.dataset.timedOut='true';};
const started = () => {
clearTimeout(timer);mutation?.disconnect();delete status.dataset.timedOut;const deadline=Date.now()+timeout;
const check = () => {
if(disposed)return;
clearTimeout(timer);
let result;
try {const doc=frame.contentDocument;result=doc ? inspectToolReadiness(tool.id,doc) : {interface:'unavailable',drawing:'unreported',label:'Tool opened on another site'};} catch {result={interface:'unavailable',drawing:'unreported',label:'Tool opened on another site'};}
status.textContent=result.label;status.dataset.interface=result.interface;status.dataset.drawing=result.drawing;
if(result.drawing==='ready' || result.drawing==='unreported'){mutation?.disconnect();return;}
if(Date.now()>=deadline){mutation?.disconnect();timedOut();return;}
timer=setTimeout(check,interval);
};
try {const marker=frame.contentDocument?.querySelector('#ml_status');
if(tool.id==='module-layout' && marker && globalThis.MutationObserver){mutation=new MutationObserver(check);mutation.observe(marker,{childList:true,characterData:true,subtree:true});}
} catch { /* Inaccessible child is classified by check. */ }
check();
};
const navigating=()=>{clearTimeout(timer);mutation?.disconnect();delete status.dataset.timedOut;status.dataset.interface='loading';status.dataset.drawing='pending';status.textContent='Loading tool';timer=setTimeout(timedOut,timeout);};
status.setAttribute('role','status');navigating();
frame.addEventListener('load',started);
frame.addEventListener('tool-navigation-start',navigating);
if(startLoaded)started();
return () => {disposed=true;clearTimeout(timer);mutation?.disconnect();frame.removeEventListener('load',started);frame.removeEventListener('tool-navigation-start',navigating);};
}Source Browser
A JavaScript module in the testcode folder of GlobalGrid2050 that draws scopes, using SHA-256. It selects tool (`selectTool`).
interactionglobalgrid2050 / testcode/202609052023/source-browser/source-browser.mjs · lines 1–65 of 65 · version 2026-09-05 20:23 · Not reached from any entry point (candidate for review) · pattern option (shared by 6 files)
- What it does
- It draws scopes. Defines option, selectTool. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
- Inputs & outputs
- In: JSON file layer-source-scopes.json.
- What it achieves
- Defines `option` and `selectTool`. It reads `../layer-source-scopes.json`. It responds to click and change events.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609052023/source-browser · JavaScript module
- Uses
- none found
- Used by
- none found
- Produces
- option, selectTool
- Defines here
- option, selectTool
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609052023/source-browser/source-browser.mjs:1-65 · blob 72d48e6384188872119b2f4eff743c7b6ba65747 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: experimental · users: none · canonical: unreached_review
const tool=document.getElementById('tool'),file=document.getElementById('file'),status=document.getElementById('status'),source=document.getElementById('source'),button=document.getElementById('open');
let apps=[],sequence=0;
const option=(value,text)=>{const node=document.createElement('option');
node.value=value;
node.textContent=text;
return node;
};
function selectTool(){sequence++;
source.textContent='';
const app=apps.find(a=>a.id===tool.value);
file.replaceChildren(...app.files.map(f=>option(f.path,`${f.path} (${f.bytes} bytes)`)));
document.getElementById('owner').textContent=`${app.owner.repository} ? ${app.owner.commit} ? release ${app.owner.release}`;
status.textContent='Choose a file to read. External dependencies are declared separately and are not bundled.';
button.disabled=false;
}
button.addEventListener('click',async()=>{const token=++sequence;
source.textContent='';
status.textContent='Checking file bytes';
button.disabled=true;
try{const app=apps.find(a=>a.id===tool.value),member=app.files.find(f=>f.path===file.value);
const url=new URL('../'+member.path,location.href);
if(url.origin!==location.origin||!url.pathname.startsWith(new URL('../layer-apps/',location.href).pathname))throw Error('Source path outside this release');
const response=await fetch(url,{cache:'no-store',redirect:'error'});
if(!response.ok)throw Error('Source response '+response.status);
const bytes=await response.arrayBuffer();
const hash=[...new Uint8Array(await crypto.subtle.digest('SHA-256',bytes))].map(x=>x.toString(16).padStart(2,'0')).join('');
if(bytes.byteLength!==member.bytes||hash!==member.sha256)throw Error('Source does not match the pinned inventory');
if(token!==sequence)return;
source.textContent=new TextDecoder().decode(bytes);
status.textContent=`Verified ${bytes.byteLength} bytes against served inventory ? SHA-256 ${hash}`;
}catch(error){if(token===sequence)status.textContent=String(error);
}finally{if(token===sequence)button.disabled=false;
}});
tool.addEventListener('change',selectTool);
file.addEventListener('change',()=>{sequence++;
source.textContent='';
status.textContent='Choose Read verified file to inspect this member.';
button.disabled=false;
});
try{const response=await fetch('../layer-source-scopes.json',{cache:'no-store',redirect:'error'});
if(!response.ok)throw Error('Source index '+response.status);
const index=await response.json();
if(index.schema!=='ventus.layer-source-scopes.v1'||!index.apps?.length)throw Error('Unsupported source index');
const ids=new Set();
for(const app of index.apps){if(typeof app.id!=='string'||ids.has(app.id)||typeof app.title!=='string'||typeof app.owner?.repository!=='string'||!/^[a-f0-9]{40}$/.test(app.owner.commit||'')||!/^\d{12}$/.test(app.owner.release||'')||!/^[a-f0-9]{64}$/.test(app.owner.manifestSha256||'')||!Array.isArray(app.files)||!app.files.length)throw Error('Invalid tool source record');
ids.add(app.id);
const paths=new Set();
for(const member of app.files){if(typeof member.path!=='string'||paths.has(member.path)||!member.path.startsWith('layer-apps/')||/[\\:%?#]/.test(member.path)||member.path.split('/').some(p=>!p||p==='.'||p==='..')||!Number.isSafeInteger(member.bytes)||member.bytes<0||!/^[a-f0-9]{64}$/.test(member.sha256||''))throw Error('Invalid source member');
paths.add(member.path);
}}apps=index.apps;
tool.replaceChildren(...apps.map(a=>option(a.id,a.title)));
const requested=new URL(location.href).searchParams.get('tool');
if(apps.some(a=>a.id===requested))tool.value=requested;
selectTool();
}catch(error){status.textContent=String(error);
button.disabled=true;
}Host
A JavaScript module in the tool layers folder of GlobalGrid2050 that mounts tool layers (`mountToolLayers`).
renderglobalgrid2050 / testcode/202609052023/tool-layers/host.js · lines 1–59 of 59 · version 2026-09-05 20:23 · Not reached from any entry point (candidate for review)
- What it does
- It draws its content. Defines mountToolLayers, dismiss, sourceReady. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
- Downstream impact
- Used directly by 1 file: Teleprinter Bootstrap (globalgrid2050).
- What it achieves
- It is built from the mount tool layers helper (`mountToolLayers`), the dismiss step (`dismiss`) and the source ready helper (`sourceReady`). Isolated, persistent app layers. Each iframe owns its UI and calculation state. It responds to click and load events.
- Why it matters
- Imported by Teleprinter Bootstrap.
- Application
- globalgrid2050 · testcode/202609052023/tool-layers · JavaScript module
- Uses
- Dismissal (import), Focus Boundary (import), Navigation (import), Viewport (import), Session Restart (import), Recovery (import)
- Used by
- imported by Teleprinter Bootstrap (import)
- Produces
- mountToolLayers
- Defines here
- mountToolLayers, dismiss, sourceReady
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609052023/tool-layers/host.js:1-59 · blob f59f895096901e81953d307e7654ae9e12808792 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: unreached_review
import {bindLayerDismissal} from './dismissal.js';
import {bindFocusBoundary} from './focus-boundary.js';
import {bindToolNavigation} from './navigation.js';
import {applyToolViewport} from './viewport.js';
import {mountSessionRestart} from './session-restart.js';
import {mountToolRecovery} from './recovery.js';
/** Isolated, persistent app layers. Each iframe owns its UI and calculation state. */
export function mountToolLayers(tools, base = import.meta.url, registry = tools) {
const old = document.getElementById('codex-layout-command');
old?.remove();
const tray = document.createElement('nav');
tray.id = 'codex-tool-layers'; tray.setAttribute('aria-label', 'Design tools');
Object.assign(tray.style, {position:'fixed',right:'12px',top:'180px',zIndex:'10000',display:'flex',gap:'6px',flexWrap:'wrap',maxWidth:'calc(100vw - 24px)'});
const layers = new Map();
const disposers = [];
for (const tool of tools) {
const button = document.createElement('button');
button.textContent = tool.title;
Object.assign(button.style,{background:'#092326',color:'#a8ffff',border:'1px solid #367077',padding:'10px',minHeight:'44px',cursor:'pointer'});
button.addEventListener('click', () => {
let layer = layers.get(tool.id);
if (!layer) {
layer = document.createElement('section');
layer.setAttribute('role','dialog'); layer.setAttribute('aria-modal','true'); layer.setAttribute('aria-label',tool.title);
Object.assign(layer.style,{position:'fixed',inset:'0',zIndex:'2147483000',background:'#081218',display:'flex',flexDirection:'column'});
const bar = document.createElement('header');
Object.assign(bar.style,{display:'flex',alignItems:'center',justifyContent:'space-between',color:'#ccffff',background:'#092326',padding:'4px 12px',minHeight:'44px'});
const title = document.createElement('strong'); title.textContent = tool.title;
const close = document.createElement('button'); close.textContent = 'Close - return to GridAtlas';
Object.assign(close.style,{minHeight:'40px',cursor:'pointer'});
const dismiss = () => {layer.dispatchEvent(new Event('tool-layer-dismissed'));layer.style.display='none'; button.focus();};
close.addEventListener('click',dismiss);
const status=document.createElement('span');
status.dataset.toolReadiness=tool.id;
bar.append(title,status,close);
const frame = document.createElement('iframe'); frame.title = tool.title;
frame.src = new URL(tool.entry, base).href;
// Same-origin realm isolation preserves the original application's downloads and links.
Object.assign(frame.style,{border:'0',width:'100%',flex:'1',minHeight:'0'});
applyToolViewport(layer,bar,frame);
disposers.push(bindLayerDismissal(layer,frame,dismiss));
disposers.push(bindFocusBoundary(layer,frame,close));
disposers.push(bindToolNavigation(layer,frame,title,status,registry,base,tool));
const session=mountSessionRestart(layer,bar,frame,()=>{try{return frame.contentWindow.location.href;}catch{return null;}});
disposers.push(session.dispose,mountToolRecovery(bar,status,session.requestConfirmation));
const sourceButton=document.createElement('button');sourceButton.textContent='Source code';sourceButton.disabled=true;sourceButton.style.minHeight='44px';
sourceButton.addEventListener('click',()=>{if(!layer.dataset.currentTool)return;const url=new URL('../source-browser/index.html',base);url.searchParams.set('tool',layer.dataset.currentTool);window.open(url.href,'_blank','noopener');});
const sourceReady=()=>{sourceButton.disabled=!layer.dataset.currentTool;};frame.addEventListener('load',sourceReady);disposers.push(()=>frame.removeEventListener('load',sourceReady));
bar.querySelector('[data-tool-session-actions]').append(sourceButton);
layer.append(bar,frame); document.body.append(layer); layers.set(tool.id,layer);
}
layer.style.display='flex';
layer.querySelector('button').focus();
});
tray.append(button);
}
document.body.append(tray);
return () => {for(const dispose of disposers) dispose(); tray.remove(); for (const layer of layers.values()) layer.remove();};
}Reported Project
A JavaScript module in the testcode folder of GlobalGrid2050. It is built from the validate step (`validate`).
transformglobalgrid2050 / testcode/202609060208/reported-project.mjs · lines 1–24 of 24 · version 2026-09-06 02:08
- What it does
- It calculates its inputs. Defines validateReportedProject, validate.
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
- Downstream impact
- Used directly by 6 files: Reported Project Panel (globalgrid2050); BBC RSS Pipeline Model (globalgrid2050); BBC RSS Pipeline Model (pipelinenews); Reported Project Test (pipelinenews); and 2 more. Reached from 2 other entry points, including PipelineNews Coverage Contract Workflow (pipelinenews); BBC RSS Pipeline Model Test (pipelinenews).
- What it achieves
- A named, attributed report is useful even when it has no validated Renewable Energy Planning Database (REPD) join.
- Why it matters
- Imported by 5 files, including Reported Project Panel, BBC RSS Pipeline Model and Build Reported Project Candidate, from PipelineNews. Checked by Reported Project Test.
- Application
- globalgrid2050 · testcode/202609060208 · JavaScript module
- Uses
- none found
- Used by
- imported by Reported Project Panel (import), imported by BBC RSS Pipeline Model (import), imported by BBC RSS Pipeline Model (import), imported by Reported Project Test (import), imported by BBC RSS Pipeline Model (import), imported by Build Reported Project Candidate (import), mentioned in Standalone (comment link)
- Produces
- validateReportedProject
- Defines here
- validateReportedProject, validate
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609060208/reported-project.mjs:1-24 · blob e4c8b94fa25ee2c7ba092d99dd1afd01ccdcae95 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: experimental · users: none · canonical: production_core
// A named, attributed report is useful even when it has no validated REPD join.
// Never borrow an adjacent article subject's numbers to fill its unknowns.
export function validateReportedProject(project) {
if (project?.schema !== 'pipelinenews.reported-project.v1' || !project.primary_project) throw Error('Invalid project evidence schema');
const url = new URL(project.article_url);
if (url.protocol !== 'https:' || !['www.bbc.co.uk','www.bbc.com'].includes(url.hostname)) throw Error('Invalid publisher URL');
if (!project.publisher || !project.evidence_basis || !project.source_published_at) throw Error('Attribution required');
if (!Array.isArray(project.claims) || !Array.isArray(project.related_projects)) throw Error('Claims required');
const validate = (claims, subject) => {
const metrics = new Set();
for (const claim of claims) {
if (claim.subject !== subject) throw Error('Cross-project attribution rejected');
if (metrics.has(claim.metric)) throw Error('Conflicting metric requires explicit resolution');
metrics.add(claim.metric);
if (!['reported_statement','reported_claim','reported_proposal'].includes(claim.kind)) throw Error('Unsupported evidence class');
if (typeof claim.value === 'number' && (!Number.isFinite(claim.value) || claim.value < 0)) throw Error('Invalid reported number');
if (claim.metric === 'solar_capacity' && claim.unit !== 'MW') throw Error('Capacity must retain MW units');
}
};
validate(project.claims, project.primary_project);
for (const related of project.related_projects) validate(related.claims, related.name);
if (project.repd_ref === null && project.eligible_for_project_signal !== false) throw Error('Unmatched news cannot become a matched project signal');
return structuredClone(project);
}Journey
A JavaScript file in the testcode folder of GlobalGrid2050 that draws blocks (`drawBlocks`) and renders route (`renderRoute`). It draws blocks (`drawBlocks`) and renders route (`renderRoute`).
interactionglobalgrid2050 / testcode/202609141423/journey.js · lines 1–115 of 115 · version 2026-09-14 14:23 · Not reached from any entry point (candidate for review) · pattern relationList (shared by 2 files)
- What it does
- It lists and searches its content. Defines 12 functions or classes, including row, paged, draw, box, link. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
- What it achieves
- Reuses the published universe reader. This view changes navigation, not permanent identities. It responds to click, popstate and hashchange events.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609141423 · script
- Uses
- none found
- Used by
- none found
- Produces
- row, paged, draw, box, link, navigate, route, groupsFor, drawBlocks, relationList, renderRoute, start
- Defines here
- row, paged, draw, box, link, navigate, route, groupsFor, drawBlocks, relationList, renderRoute, start
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609141423/journey.js:1-115 · blob 61b039a2c3f04e62715cc249575c5a99dd2a8605 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: duplicate_candidate
/* Reuses the published universe reader. This view changes navigation, not permanent identities. */
let viewSerial = 0, journeyDepth = 0;
const subject = $('#subject');
const row = (title, detail, act) => el('button', { class: 'row', on: { click: act } }, title, detail ? el('small', {}, detail) : null);
function paged(host, list, render, size = 24) {
let page = 0;
function draw() {
host.replaceChildren();
if (!list.length) { host.append(el('p', { class: 'empty' }, 'None recorded in the published data.')); return; }
const start = page * size, stop = Math.min(start + size, list.length);
const prev = el('button', { 'aria-label': 'Previous page', on: { click: () => { page--; draw(); } } }, '←'); prev.disabled = page === 0;
const next = el('button', { 'aria-label': 'Next page', on: { click: () => { page++; draw(); } } }, '→'); next.disabled = stop === list.length;
host.append(el('div', { class: 'pager' }, prev, el('span', { role: 'status' }, `${start + 1}–${stop} of ${list.length}`), next));
const items = el('div'); host.append(items);
list.slice(start, stop).forEach((item, i) => items.append(render(item, start + i)));
}
draw();
}
function box(title) { const wrapper = el('section', { class: 'box' }, el('h3', {}, title)); const content = el('div'); wrapper.append(content); return { wrapper, content }; }
function link(label, url) {
try { if (!/^https?:$/.test(new URL(url).protocol)) return null; } catch { return null; }
return el('a', { class: 'u-chip', href: url, target: '_blank', rel: 'noopener noreferrer' }, label + ' ↗');
}
function navigate(kind, id) { const hash = kind ? `#${kind}=${encodeURIComponent(id)}` : '#'; if (location.hash === hash) return renderRoute(); history.pushState({ journeyDepth: ++journeyDepth }, '', hash); renderRoute(); }
function route() { const p = new URLSearchParams(location.hash.slice(1)); if (p.has('family')) return ['family', p.get('family')]; if (p.has('block')) return ['block', p.get('block')]; return ['', '']; }
function groupsFor(n) { return Object.entries(U.groups).filter(([, ns]) => ns.includes(Number(n))).map(([sym]) => sym); }
function drawBlocks() {
const q = $('#block-filter').value.toLowerCase(), cat = $('#category').value;
const groups = Object.keys(U.groups).filter(sym => {
const b = U.bySym.get(sym);
return (!cat || (cat === '_unnamed' ? !b : b?.category === cat)) && `${sym} ${blockLabel(sym)}`.toLowerCase().includes(q);
}).sort((a, b) => (U.bySym.get(a)?.number ?? 1e9) - (U.bySym.get(b)?.number ?? 1e9) || a.localeCompare(b));
paged($('#blocks'), groups, sym => row(blockLabel(sym), `${blockFamilies(sym).length} families`, () => navigate('block', sym)), 12);
}
function relationList(title, items, type, go) {
const b = box(`${title} · ${items.length}`);
paged(b.content, items, item => row(item.label, type, () => go(item.id)), 16);
return b.wrapper;
}
async function renderRoute() {
const serial = ++viewSerial;
const [kind, id] = route();
$('#back').disabled = journeyDepth === 0;
$('#trail').replaceChildren(el('a', { href: '#' }, 'GLOBALGRID2050'), kind ? ` › ${kind === 'family' ? '#' + id : blockLabel(id)}` : ' › All blocks');
subject.replaceChildren(); subject.setAttribute('aria-busy', 'true');
try {
if (!kind) {
subject.append(el('h2', { class: 'subject-title' }, 'One journey through the code'), el('p', {}, 'Choose a block or search a function. Follow its permanent keys to the relationships and the exact source at a commit.'), el('p', { class: 'relation-legend' }, 'Contains → families · Uses → dependencies · Used by → callers · Shared lines → matching permanent keys in loaded records'));
const picks = ['Vn', 'Dt', 'Si', 'Cg'].filter(s => U.groups[s]);
subject.append(el('div', { class: 'two' }, picks.map(s => row(blockLabel(s), `${blockFamilies(s).length} families`, () => navigate('block', s)))));
return;
}
if (kind === 'block') {
if (!Object.hasOwn(U.groups, id)) throw Error(`Block or group ${id} is not recorded.`);
const b = U.bySym.get(id), families = blockFamilies(id);
subject.append(el('div', { class: 'block-summary' }, el('h2', { class: 'subject-title' }, blockLabel(id)), el('p', {}, b?.description || 'This group has not yet been given a public block name.'), el('p', { class: 'u-muted' }, `${families.length} function families · all available below`)));
if (b) subject.append(link('Block page', STARS + 'table.html?block=' + encodeURIComponent(id)));
const deps = blockDeps(id), users = (b?.used_by || []).map(x => x.symbol || x).filter(s => Object.hasOwn(U.groups, s));
const relations = el('div', { class: 'two' }, relationList('Depends on', deps.map(s => ({ id: s, label: blockLabel(s) })), 'depends on →', s => navigate('block', s)), relationList('Used by', users.map(s => ({ id: s, label: blockLabel(s) })), '← used by', s => navigate('block', s)));
subject.append(relations);
const f = box(`Contains · ${families.length} families`); subject.append(f.wrapper);
paged(f.content, families, n => {
const button = row('#' + n, 'Open numbered code and relationships', () => navigate('family', n));
family(n).then(rec => { if (rec && button.isConnected) button.firstChild.textContent = `#${n} ${famName(rec)}`; }).catch(() => { if (button.isConnected) button.lastChild.textContent = 'Name could not load; open to retry.'; });
return button;
});
return;
}
if (!/^\d+$/.test(id)) throw Error('The family key must be a non-negative integer.');
const n = Number(id), rec = await family(n);
if (serial !== viewSerial) return;
if (!rec) throw Error(`Family #${n} is not in the published records.`);
subject.append(el('h2', { class: 'subject-title' }, `#${n} ${famName(rec)}`), el('p', { class: 'u-muted' }, `${rec.kind || 'code'} · ${rec.lines.length} permanent numbered lines · ${rec.standalone ? 'self-contained' : 'needs context'}`));
const members = groupsFor(n);
subject.append(el('div', { class: 'u-links' }, members.map(s => row('◂ Contained in ' + blockLabel(s), '', () => navigate('block', s)))));
const links = familyLinks(rec, n); subject.append(el('div', { class: 'u-links' }, link('Function page', links.page), links.gh ? link('File at commit', links.gh) : null, links.live ? link('Recorded live page', links.live) : el('span', { class: 'u-muted' }, 'No live page recorded.')));
subject.append(el('div', { class: 'two' }, relationList('Uses', (rec.uses || []).map(u => ({ id: u.family, label: `#${u.family} ${u.name || ''}` })), 'uses →', m => navigate('family', m)), relationList('Used by', (rec.used_by || []).map(u => ({ id: u.family, label: `#${u.family} ${u.name || ''}` })), '← used by', m => navigate('family', m))));
const code = box('Numbered lines · permanent keys'); subject.append(code.wrapper);
const p = rec.places?.[0];
if (p) code.content.append(el('p', { class: 'source-meta' }, `${p.repo} / ${p.path} · commit ${p.commit} · source lines ${p.first}–${p.last}`));
const pre = el('div', { class: 'u-code', tabindex: '0', 'aria-label': 'Numbered source code' }, 'Fetching the source at its pinned commit…'); code.content.append(pre);
try {
const rows = await familyLines(rec);
if (serial !== viewSerial) return;
pre.replaceChildren(...rows.map(r => el('div', { class: 'u-line' }, el('span', { class: 'u-key' }, String(r.key)), ' │ ' + r.text)));
} catch (error) { pre.textContent = `Source unavailable: ${error.message}. Permanent keys: ${rec.lines.join(', ')}.`; }
if (serial !== viewSerial) return;
const keys = new Set(rec.lines), shared = new Map();
let loaded = 0, failures = 0;
for (const promise of U.buckets.values()) {
let bucket; try { bucket = await promise; loaded++; } catch { failures++; continue; }
if (serial !== viewSerial) return;
for (const [m, r] of Object.entries(bucket)) if (+m !== n) { const hits = (r.lines || []).filter(k => keys.has(k)).length; if (hits) shared.set(+m, { id: +m, label: `#${m} ${famName(r)} · ${hits} shared keys` }); }
}
subject.append(relationList('Shared lines in loaded records', [...shared.values()], 'shares permanent keys', m => navigate('family', m)), el('p', { class: 'u-muted' }, `Searched ${loaded} loaded buckets; ${failures} unavailable. This is a partial search, not the whole code estate.`));
} catch (error) {
if (serial !== viewSerial) return;
subject.replaceChildren(el('div', { class: 'u-fail', role: 'alert' }, error.message), el('button', { on: { click: () => { U.buckets.clear(); U.texts.clear(); renderRoute(); } } }, 'Retry this view'));
} finally { if (serial === viewSerial) subject.setAttribute('aria-busy', 'false'); }
}
$('#back').addEventListener('click', () => history.back());
window.addEventListener('popstate', () => { journeyDepth = history.state?.journeyDepth || 0; renderRoute(); });
window.addEventListener('hashchange', () => { journeyDepth = history.state?.journeyDepth || 0; renderRoute(); });
$('#copy').addEventListener('click', async () => { try { await navigator.clipboard.writeText(location.href); $('#copy-status').textContent = 'Link copied'; } catch { $('#copy-status').textContent = 'Copy the address from the browser bar.'; } });
async function start() {
try {
await loadUniverse();
$('#count').textContent = countsLine();
for (const c of U.cats) $('#category').append(el('option', { value: c.id }, c.title));
$('#category').append(el('option', { value: '_unnamed' }, 'Unnamed groups'));
$('#block-filter').addEventListener('input', drawBlocks); $('#category').addEventListener('change', drawBlocks);
mountSearch($('#search'), n => navigate('family', n)); drawBlocks(); renderRoute();
} catch (e) { fail('#count', e); subject.replaceChildren(el('button', { on: { click: () => location.reload() } }, 'Reload live data')); }
}
start();Testcode — V02 Radial Sunburst Page
A web page in GlobalGrid2050 that shows cat (`showCat`) and block (`showBlock`), opens family (`openFamily`) and draws SVG graphics. Published at https://globalgrid2050.com/testcode/202609141522/v02-radial-sunburst/.
renderglobalgrid2050 / testcode/202609141522/v02-radial-sunburst/index.html · lines 1–74 of 74 · version 2026-09-14 15:22 · Entry point · pattern showCat (shared by 6 files)
- What it does
- It draws its content. Defines 8 functions or classes, including sv, arc, p, ring, centre. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
- Inputs & outputs
- Out: web page; SVG drawing.
- Downstream impact
- It is itself an entry point, published at https://globalgrid2050.com/testcode/202609141522/v02-radial-sunburst/.
- What it achieves
- It shows cat (`showCat`), shows block (`showBlock`) and opens family (`openFamily`). Defines `arc`, `ring`, `centre` and 3 more. It responds to click events.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- globalgrid2050 · testcode/202609141522/v02-radial-sunburst · page
- Uses
- GlobalGrid2050 — Testcode (script src)
- Used by
- mentioned in Standalone (comment link)
- Produces
- sv, arc, p, ring, centre, showCat, showBlock, openFamily
- Defines here
- sv, arc, p, ring, centre, showCat, showBlock, openFamily
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609141522/v02-radial-sunburst/index.html:1-74 · blob eb5f5b723404fc2d11086418eb56db8ab9a2ca5c · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
<!doctype html>
<html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>GLOBALGRID2050 · v02 radial sunburst</title>
<script>window.BUILT='2026-09-14 15:22'</script>
<script src="../core.js"></script>
<style>
#wrap{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-start}
svg{width:min(92vw,640px);height:auto;touch-action:manipulation}
.seg{cursor:pointer;stroke:#0b0d12;stroke-width:1}.seg:hover{filter:brightness(1.35)}
.lbl{fill:#d8dee9;font-size:10px;pointer-events:none}
#side{flex:1;min-width:280px}
</style>
<h1>GLOBALGRID2050</h1><div class="u-count" id="count">Loading the universe…</div>
<div id="search"></div><div id="trail"></div><div id="legend"></div>
<div id="wrap"><svg id="sun" viewBox="-320 -320 640 640"></svg><div id="side"><div class="u-panel" id="panel">Tap a ring segment. The centre goes back one level.</div></div></div>
<script>
const NS = 'http://www.w3.org/2000/svg', S = $('#sun'), P = $('#panel');
const sv = (t, a) => { const e = document.createElementNS(NS, t); for (const k in a) e.setAttribute(k, a[k]); return e; };
function arc(r0, r1, a0, a1) {
const p = (r, a) => [r * Math.cos(a - Math.PI / 2), r * Math.sin(a - Math.PI / 2)];
const big = a1 - a0 > Math.PI ? 1 : 0; const [x0, y0] = p(r1, a0), [x1, y1] = p(r1, a1), [x2, y2] = p(r0, a1), [x3, y3] = p(r0, a0);
return `M${x0},${y0}A${r1},${r1} 0 ${big} 1 ${x1},${y1}L${x2},${y2}A${r0},${r0} 0 ${big} 0 ${x3},${y3}Z`;
}
/* one ring of weighted items; min share so small items stay tappable; labels only when the segment is wide enough */
function ring(items, r0, r1, onClick) {
const tot = items.reduce((s, x) => s + Math.max(x.w, 0.004 * items.reduce((q, y) => q + y.w, 0)), 0); let a = 0;
for (const it of items) {
const w = Math.max(it.w, 0.004 * items.reduce((q, y) => q + y.w, 0)); const da = (w / tot) * Math.PI * 2;
const g = sv('path', { d: arc(r0, r1, a, a + da - 0.002), fill: it.colour, class: 'seg' });
g.append(sv('title', {})); g.firstChild.textContent = `${it.label} (${it.sub})`;
g.addEventListener('click', () => onClick(it)); S.append(g);
if (da > 0.09) { const m = a + da / 2, rr = (r0 + r1) / 2; const t = sv('text', { x: rr * Math.cos(m - Math.PI / 2), y: rr * Math.sin(m - Math.PI / 2), class: 'lbl', 'text-anchor': 'middle', 'dominant-baseline': 'middle' }); t.textContent = it.short || it.label.slice(0, 14); S.append(t); }
it.mid = a + da / 2; a += da;
}
}
function centre(title, sub, onClick) {
const c = sv('circle', { r: 95, fill: '#12151c', stroke: '#00e5ff', 'stroke-width': 2, class: 'seg' }); c.addEventListener('click', onClick); S.append(c);
const t = sv('text', { y: -8, class: 'lbl', 'text-anchor': 'middle', style: 'font-size:15px;fill:#eef2fb' }); t.textContent = title; S.append(t);
const s = sv('text', { y: 14, class: 'lbl', 'text-anchor': 'middle', style: 'fill:#8b93a7' }); s.textContent = sub; S.append(s);
}
window.goHome = function () {
S.innerHTML = '';
const cats = U.cats.map(c => ({ id: c.id, label: c.title, short: c.id, colour: c.colour, w: U.blocks.filter(b => b.category === c.id).length, sub: 'blocks' }));
cats.push({ id: '_unnamed', label: 'Not yet named', short: 'unnamed', colour: '#566079', w: U.unnamed.length / 4, sub: `${U.unnamed.length} groups` });
centre('GLOBALGRID2050', '12 categories · tap a ring', () => {});
ring(cats, 100, 190, c => { trailPush('cat', c.id, c.label); showCat(c.id); });
const outer = []; for (const c of cats) { if (c.id === '_unnamed') continue; for (const b of U.blocks.filter(x => x.category === c.id)) outer.push({ id: b.symbol, label: blockLabel(b.symbol), short: b.symbol, colour: c.colour, w: 1, sub: `${blockFamilies(b.symbol).length} families` }); }
ring(outer, 196, 300, b => showBlock(b.id));
P.innerHTML = `<div class="u-h">GLOBALGRID2050</div><div class="u-muted">${countsLine()}</div><p>Inner ring: categories of blocks. Outer ring: the 207 named blocks. Tap either to go in.</p>`;
};
window.goTo = (k, id) => k === 'cat' ? showCat(id) : k === 'block' ? showBlock(id) : openFamily(id);
function showCat(id) {
S.innerHTML = '';
const list = id === '_unnamed' ? U.unnamed.slice(0, 180).map(g => ({ symbol: g })) : U.blocks.filter(b => b.category === id);
centre(id === '_unnamed' ? 'Not yet named' : catTitle(id), `${list.length} shown · centre = back`, () => { U.trail.pop(); renderTrail(); goHome(); });
ring(list.map(b => ({ id: b.symbol, label: blockLabel(b.symbol), short: b.symbol, colour: catColour(id), w: Math.max(1, Math.sqrt(blockFamilies(b.symbol).length)), sub: `${blockFamilies(b.symbol).length} families` })), 110, 300, b => showBlock(b.id));
P.innerHTML = `<div class="u-h">${esc(id === '_unnamed' ? 'Not yet named' : catTitle(id))}</div><div class="u-muted">Segment size: square root of the family count.</div>`;
}
function showBlock(sym) {
S.innerHTML = ''; trailPush('block', sym, blockLabel(sym));
const b = U.bySym.get(sym) || {}; const fams = blockFamilies(sym); const col = catColour(b.category);
centre(sym, `${fams.length} families · centre = back`, () => { U.trail.pop(); renderTrail(); b.category ? showCat(b.category) : goHome(); });
const shown = fams.slice(0, 180);
ring(shown.map(n => ({ id: n, label: `#${n}`, short: `#${n}`, colour: col, w: 1, sub: 'family' })), 110, 220, f => openFamily(f.id));
const deps = blockDeps(sym).map(s => ({ id: s, label: blockLabel(s), short: s, colour: REL['depends on'], w: 1, sub: 'depends on' }));
const users = blockUsers(sym).slice(0, 60).map(s => ({ id: s, label: blockLabel(s), short: s, colour: REL['used by'], w: 1, sub: 'used by' }));
if (deps.length + users.length) ring([...deps, ...users], 228, 300, x => showBlock(x.id));
P.innerHTML = '';
P.append(el('div', { class: 'u-h' }, blockLabel(sym)), el('div', { class: 'u-muted' }, `${b.description || ''} Inner ring: ${shown.length} of ${fams.length} families. Outer ring: blocks it depends on (yellow) and blocks that use it (pink).`),
b.symbol ? el('a', { class: 'u-chip', href: `${STARS}table.html?block=${sym}`, target: '_blank', rel: 'noopener' }, 'Block page ↗') : null);
}
async function openFamily(n) { await showFamilyPanel(n, P, openFamily, showBlock); P.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); }
loadUniverse().then(() => { $('#count').textContent = countsLine(); legend($('#legend')); mountSearch($('#search'), openFamily); renderTrail(); goHome(); openAddress(); footer('v02-radial-sunburst'); }).catch(e => fail('#count', e));
</script>