In this section
- Assemble transform · globalgrid2050 / kuiper-grid/drawing/assemble.mjs lines 1–249
- Design Record render · globalgrid2050 / kuiper-grid/drawing/design-record.js lines 1–19
- Kuiper Grid — Drawing Page render · globalgrid2050 / kuiper-grid/drawing/index.html lines 1–43
- Kuiper Card render · globalgrid2050 / kuiper-grid/drawing/kuiper-card.js lines 1–277
Assemble
A JavaScript module in the drawing folder of GlobalGrid2050 that calculates planar distances. Served with the page at https://globalgrid2050.com/kuiper-grid/drawing/.
transformglobalgrid2050 / kuiper-grid/drawing/assemble.mjs · lines 1–249 of 249 · Entry point · pattern targets (shared by 2 files)
- What it does
- It calculates its inputs. Defines 13 functions or classes, including ease, step, targets, cluster, ring.
- Why it exists in the grid workflow
- Domain stage agent_infra (path word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Downstream impact
- Used directly by 2 files: Kuiper Programs (globalgrid2050, https://globalgrid2050.com/kuiper-grid/i0073/releases/003100000000-kuiper-shell/); Wafer Development Environment — Proof K0030 Page (globalgrid2050, https://globalgrid2050.com/testcode/wafer-development-environment/202609192238-proof-k0030/). Reached from 90 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); Homepage V037 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v037.html). It is itself an entry point, published at https://globalgrid2050.com/kuiper-grid/drawing/.
- What it achieves
- It is built from the ease step (`ease`), the step step (`step`) and the targets step (`targets`). The one gathering animation of the estate.
- Why it matters
- Loaded by the Proof K0030 page at https://globalgrid2050.com/testcode/wafer-development-environment/202609192238-proof-k0030/. Also imported by Kuiper Programs.
- Application
- globalgrid2050 · kuiper-grid/drawing · JavaScript module
- Uses
- none found
- Used by
- imported by Kuiper Programs (dynamic import), imported by Wafer Development Environment — Proof K0030 Page (dynamic import), mentioned in Standalone (comment link)
- Produces
- MOVE_MS, GOLDEN, SHAPES, ease, step, targets, GLYPHS, raster, selftest
- Defines here
- ease, step, targets, cluster, ring, orbit, clock, put, hand, raster, text, selftest, say
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 kuiper-grid/drawing/assemble.mjs:1-249 · blob 307b4deefc5e84939a3a1e720d3b75e65d25524e · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: agent_infra · users: ai_agent · canonical: production_core
// assemble.mjs - the one gathering animation of the estate. Give it a shape and a count, it gives you places;
// give it where the points were, where they are going and how far along, it gives you where they are now.
//
// import { targets, step, MOVE_MS } from './assemble.mjs';
// const to = targets('cluster', n); // or 'text:GRIDATLAS', 'ring', 'orbit', 'clock'
// each frame: step(from, to, (now - t0) / MOVE_MS, out); // from = the places the points had when the move began
//
// SHAPES, named by a string so a program can ask for any of them:
// 'cluster' one dense round body, every point the same distance from its neighbours (a sunflower disc)
// 'ring' a thin circle
// 'orbit' an ellipse with the centre at one focus, as the wafer's "orbit" draws an app
// 'clock' a dial, twelve ticks and three hands; opts.date sets the time shown (default: now)
// 'text:WORDS' the words in block capitals; a line break is ' / ' or '\n'. A to Z, 0 to 9, space and . , : - & / '
// SHAPES the list above, exported, so a page can offer them without typing them again
//
// WHAT THIS IS LIFTED FROM, AND WHY IT FEELS THE SAME. The Real Systems wafer moves every point by one rule:
// drawn = from + (target - from) * ease(u), u = elapsed / 2000 ms, ease = cubic in and out.
// step() is that rule and nothing else. 'cluster' is the wafer's own core: point j sits at radius sqrt((j + 1/2) / n)
// and angle j * the golden angle, which is how a sunflower packs seeds and why the body has no spokes and no gaps.
// 'orbit' is the wafer's Kepler law, r = p / (1 + e cos angle), e = 0.3. 'clock' is the wafer's clock, share for share.
//
// PURE. No page, no canvas, no globals, no clock of its own, nothing kept between calls: the same arguments give the
// same places on any machine, which is what lets a link name an animation and a test check it. The words are drawn
// from a five by seven block alphabet carried in this file, so 'text:' needs no font and no canvas; a page that wants
// its own lettering passes opts.raster = { w, h, on } (on = Uint8Array of w*h, 1 where there is ink) and gets the
// same placing over its own letters.
//
// UNITS. Places are pairs (x, y) in one Float32Array of 2n, centred on (0, 0), y UP, and every shape fits inside
// radius 1. Multiply by whatever a unit is on your screen. Nothing here knows about pixels.
//
// Provided as is, without warranty of any kind. It decides where dots are SHOWN; it calculates nothing about a network.
export const MOVE_MS = 2000;
export const GOLDEN = Math.PI * (3 - Math.sqrt(5)); // the golden angle, 2.39996... radians
export const SHAPES = ['cluster', 'ring', 'orbit', 'clock', 'text:WORDS'];
/** The wafer's easing: slow out, fast through the middle, slow in. u below 0 is 0, above 1 is 1. */
export function ease(u) {
if (!(u > 0)) return 0;
if (u >= 1) return 1;
return u < 0.5 ? 4 * u * u * u : 1 - Math.pow(-2 * u + 2, 3) / 2;
}
/** Where the points are now. from and to are Float32Array(2n); t runs 0 to 1. Returns out (made if not given).
* from is where the points were WHEN THE MOVE BEGAN, not where they were last frame: that is what makes the end
* state exact and the motion the same at any frame rate. */
export function step(from, to, t, out) {
const n2 = Math.min(from.length, to.length);
const o = out || new Float32Array(n2);
const e = ease(t);
if (e >= 1) { for (let q = 0; q < n2; q++) o[q] = to[q]; return o; }
if (e <= 0) { for (let q = 0; q < n2; q++) o[q] = from[q]; return o; }
for (let q = 0; q < n2; q++) o[q] = from[q] + (to[q] - from[q]) * e;
return o;
}
/** n places for a named shape. Returns Float32Array(2n). An unknown shape is refused, never guessed. */
export function targets(shape, n, opts = {}) {
n = Math.max(0, n | 0);
const name = String(shape || '');
if (name === 'cluster') return cluster(n, opts);
if (name === 'ring') return ring(n, opts);
if (name === 'orbit') return orbit(n, opts);
if (name === 'clock') return clock(n, opts);
if (name.startsWith('text:')) return text(name.slice(5), n, opts);
throw new Error('assemble: no shape called "' + name + '"; the shapes are ' + SHAPES.join(', '));
}
// ---- cluster: the dense body -------------------------------------------------------------------------------
function cluster(n, { radius = 1 } = {}) {
const t = new Float32Array(n * 2);
for (let j = 0; j < n; j++) {
const r = radius * Math.sqrt((j + 0.5) / n), th = j * GOLDEN;
t[2 * j] = r * Math.cos(th); t[2 * j + 1] = r * Math.sin(th);
}
return t;
}
// ---- ring -------------------------------------------------------------------------------------------------
function ring(n, { radius = 1 } = {}) {
const t = new Float32Array(n * 2);
for (let j = 0; j < n; j++) {
const th = j / Math.max(1, n) * 2 * Math.PI;
t[2 * j] = radius * Math.cos(th); t[2 * j + 1] = radius * Math.sin(th);
}
return t;
}
// ---- orbit: r = p / (1 + e cos angle), the centre at the focus; scaled so the far end reaches the radius -----
function orbit(n, { radius = 1, e = 0.3 } = {}) {
const p = radius * (1 - e); // farthest point is p / (1 - e) = radius
const t = new Float32Array(n * 2);
for (let j = 0; j < n; j++) {
const th = j * GOLDEN, r = p / (1 + e * Math.cos(th));
t[2 * j] = r * Math.cos(th); t[2 * j + 1] = r * Math.sin(th);
}
return t;
}
// ---- clock: 45 % dial, 15 % ticks, the rest shared 40 : 35 : 25 between hour, minute and second hands ---------
function clock(n, { radius = 1, date } = {}) {
const d = date instanceof Date ? date : new Date();
const R = radius, t = new Float32Array(n * 2);
let j = 0;
const put = (x, y) => { if (j < n) { t[2 * j] = x; t[2 * j + 1] = y; j++; } };
const dial = Math.floor(n * 0.45), ticks = Math.floor(n * 0.15), hands = n - dial - ticks;
for (let i = 0; i < dial; i++) { const a = i / Math.max(1, dial) * 2 * Math.PI; put(R * Math.cos(a), R * Math.sin(a)); }
for (let i = 0; i < ticks; i++) {
const h = i % 12, u = (Math.floor(i / 12) % 40) / 40, a = Math.PI / 2 - h * Math.PI / 6, r = R * (0.86 + 0.1 * u);
put(r * Math.cos(a), r * Math.sin(a));
}
const s = d.getSeconds(), m = d.getMinutes() + s / 60, h = (d.getHours() % 12) + m / 60;
const hand = (count, turn, len) => {
const a = Math.PI / 2 - turn * 2 * Math.PI;
for (let i = 0; i < count; i++) { const r = R * len * (i + 0.5) / Math.max(1, count); put(r * Math.cos(a), r * Math.sin(a)); }
};
const nh = Math.floor(hands * 0.40), nm = Math.floor(hands * 0.35);
hand(nh, h / 12, 0.5); hand(nm, m / 60, 0.75); hand(hands - nh - nm, s / 60, 0.85);
while (j < n) put(R * Math.cos(j * GOLDEN), R * Math.sin(j * GOLDEN)); // never leave a point unplaced
return t;
}
// ---- text: block capitals, five wide and seven tall, carried here so no font and no canvas is needed --------
// Seven rows of five, top row first, '#' where there is ink. Written as rows so a wrong letter can be SEEN:
// the first version packed each letter into one string of 35, six of them were a character out, and the
// letters came out sheared while every test passed. The self test now checks the shape of every letter.
export const GLYPHS = {
'A': ['.###.', '#...#', '#...#', '#####', '#...#', '#...#', '#...#'],
'B': ['####.', '#...#', '#...#', '####.', '#...#', '#...#', '####.'],
'C': ['.####', '#....', '#....', '#....', '#....', '#....', '.####'],
'D': ['####.', '#...#', '#...#', '#...#', '#...#', '#...#', '####.'],
'E': ['#####', '#....', '#....', '####.', '#....', '#....', '#####'],
'F': ['#####', '#....', '#....', '####.', '#....', '#....', '#....'],
'G': ['.####', '#....', '#....', '#..##', '#...#', '#...#', '.####'],
'H': ['#...#', '#...#', '#...#', '#####', '#...#', '#...#', '#...#'],
'I': ['#####', '..#..', '..#..', '..#..', '..#..', '..#..', '#####'],
'J': ['..###', '...#.', '...#.', '...#.', '...#.', '#..#.', '.##..'],
'K': ['#...#', '#..#.', '#.#..', '##...', '#.#..', '#..#.', '#...#'],
'L': ['#....', '#....', '#....', '#....', '#....', '#....', '#####'],
'M': ['#...#', '##.##', '#.#.#', '#.#.#', '#...#', '#...#', '#...#'],
'N': ['#...#', '##..#', '#.#.#', '#.#.#', '#..##', '#...#', '#...#'],
'O': ['.###.', '#...#', '#...#', '#...#', '#...#', '#...#', '.###.'],
'P': ['####.', '#...#', '#...#', '####.', '#....', '#....', '#....'],
'Q': ['.###.', '#...#', '#...#', '#...#', '#.#.#', '#..#.', '.##.#'],
'R': ['####.', '#...#', '#...#', '####.', '#.#..', '#..#.', '#...#'],
'S': ['.####', '#....', '#....', '.###.', '....#', '....#', '####.'],
'T': ['#####', '..#..', '..#..', '..#..', '..#..', '..#..', '..#..'],
'U': ['#...#', '#...#', '#...#', '#...#', '#...#', '#...#', '.###.'],
'V': ['#...#', '#...#', '#...#', '#...#', '.#.#.', '.#.#.', '..#..'],
'W': ['#...#', '#...#', '#...#', '#.#.#', '#.#.#', '##.##', '#...#'],
'X': ['#...#', '#...#', '.#.#.', '..#..', '.#.#.', '#...#', '#...#'],
'Y': ['#...#', '#...#', '.#.#.', '..#..', '..#..', '..#..', '..#..'],
'Z': ['#####', '....#', '...#.', '..#..', '.#...', '#....', '#####'],
'0': ['.###.', '#...#', '#..##', '#.#.#', '##..#', '#...#', '.###.'],
'1': ['..#..', '.##..', '..#..', '..#..', '..#..', '..#..', '#####'],
'2': ['.###.', '#...#', '....#', '...#.', '..#..', '.#...', '#####'],
'3': ['####.', '....#', '....#', '.###.', '....#', '....#', '####.'],
'4': ['...#.', '..##.', '.#.#.', '#..#.', '#####', '...#.', '...#.'],
'5': ['#####', '#....', '####.', '....#', '....#', '#...#', '.###.'],
'6': ['.###.', '#....', '#....', '####.', '#...#', '#...#', '.###.'],
'7': ['#####', '....#', '...#.', '..#..', '.#...', '.#...', '.#...'],
'8': ['.###.', '#...#', '#...#', '.###.', '#...#', '#...#', '.###.'],
'9': ['.###.', '#...#', '#...#', '.####', '....#', '....#', '.###.'],
' ': ['.....', '.....', '.....', '.....', '.....', '.....', '.....'],
'.': ['.....', '.....', '.....', '.....', '.....', '.##..', '.##..'],
',': ['.....', '.....', '.....', '.....', '.##..', '..#..', '.#...'],
':': ['.....', '.##..', '.##..', '.....', '.##..', '.##..', '.....'],
'-': ['.....', '.....', '.....', '#####', '.....', '.....', '.....'],
'&': ['.##..', '#..#.', '#.#..', '.#...', '#.#.#', '#..#.', '.##.#'],
'/': ['....#', '....#', '...#.', '..#..', '.#...', '#....', '#....'],
"'": ['..#..', '..#..', '.....', '.....', '.....', '.....', '.....'],
};
const GW = 5, GH = 7, GAP = 1, LINE_GAP = 3;
/** The ink of some words as a grid: { w, h, on }. Exported so a page can look at what will be drawn. */
export function raster(words) {
const lines = String(words).toUpperCase().split(/\s+\/\s+|\n/).filter(l => l.length); // ' / ' breaks the line; 'A/B' draws a slash
if (!lines.length) lines.push(' ');
const cols = Math.max(...lines.map(l => l.length * (GW + GAP) - GAP));
const w = cols, h = lines.length * GH + (lines.length - 1) * LINE_GAP;
const on = new Uint8Array(w * h);
lines.forEach((line, li) => {
const x0 = Math.floor((cols - (line.length * (GW + GAP) - GAP)) / 2), y0 = li * (GH + LINE_GAP);
[...line].forEach((ch, ci) => {
const g = GLYPHS[ch] || GLYPHS[' '];
for (let y = 0; y < GH; y++) for (let x = 0; x < GW; x++)
if (g[y][x] === '#') on[(y0 + y) * w + x0 + ci * (GW + GAP) + x] = 1;
});
});
return { w, h, on };
}
function text(words, n, { radius = 1, raster: own } = {}) {
const G = own || raster(words);
const cells = [];
for (let y = 0; y < G.h; y++) for (let x = 0; x < G.w; x++) if (G.on[y * G.w + x]) cells.push(x, y);
const S = cells.length / 2, t = new Float32Array(n * 2);
if (!S) return cluster(n, { radius });
// The words fit inside the radius whichever way they are long. One unit for both directions: never stretched.
const unit = 2 * radius / Math.hypot(G.w, G.h);
// Each inked square takes its share of the points, spread inside the square on a small sunflower of its own, so a
// word made of 5,000 points and one made of 500,000 are both solid, and the same n always lands in the same places.
const per = Math.floor(n / S), extra = n - per * S;
let j = 0;
for (let c = 0; c < S && j < n; c++) {
const k = per + (c < extra ? 1 : 0), cx = cells[2 * c] + 0.5, cy = cells[2 * c + 1] + 0.5;
for (let i = 0; i < k && j < n; i++, j++) {
const r = 0.5 * Math.sqrt((i + 0.5) / k), th = i * GOLDEN;
t[2 * j] = (cx + r * Math.cos(th) - G.w / 2) * unit;
t[2 * j + 1] = (G.h / 2 - (cy + r * Math.sin(th))) * unit; // y up: the top row is the top
}
}
return t;
}
/** A check anyone can run: node -e "import('./assemble.mjs').then(m => console.log(m.selftest()))"
* Every shape must place every point, inside the radius, the same way twice; step must start at from, end at to,
* and pass through the middle; an unknown shape must be refused. Returns { ok, lines }. */
export function selftest() {
const lines = []; let ok = true;
const say = (good, what) => { lines.push((good ? 'pass ' : 'FAIL ') + what); if (!good) ok = false; };
const date = new Date(2026, 8, 19, 10, 8, 30);
for (const shape of ['cluster', 'ring', 'orbit', 'clock', 'text:GRIDATLAS', 'text:VENTUS / CABLES & CONNECTIVITY']) {
const n = 5000, a = targets(shape, n, { date }), b = targets(shape, n, { date });
let finite = true, inside = true, same = true, far = 0;
for (let q = 0; q < a.length; q++) { if (!Number.isFinite(a[q])) finite = false; if (a[q] !== b[q]) same = false; }
for (let j = 0; j < n; j++) { const r = Math.hypot(a[2 * j], a[2 * j + 1]); if (r > far) far = r; if (r > 1.0001) inside = false; }
say(a.length === 2 * n && finite, shape + ': ' + n + ' points, every one placed');
say(inside && far > 0.5, shape + ': fits inside radius 1 and uses it (farthest ' + far.toFixed(3) + ')');
say(same, shape + ': the same places twice');
}
const from = targets('cluster', 100), to = targets('text:GRID', 100);
const s0 = step(from, to, 0), s1 = step(from, to, 1), sh = step(from, to, 0.5);
say(s0.every((v, q) => v === from[q]), 'step at 0 is where the points began');
say(s1.every((v, q) => v === to[q]), 'step at 1 is exactly the target');
say(sh.every((v, q) => Math.abs(v - (from[q] + to[q]) / 2) < 1e-6), 'step at one half is half way');
say(ease(0.25) < 0.25 && ease(0.75) > 0.75, 'the move starts slowly and ends slowly');
const bad = Object.entries(GLYPHS).filter(([, g]) => g.length !== GH || g.some(r => r.length !== GW || /[^#.]/.test(r))).map(([k]) => k);
say(!bad.length, 'every letter is seven rows of five' + (bad.length ? ': wrong ' + bad.join(' ') : ''));
// and a letter must LOOK like itself: an H is two uprights joined in the middle, an O has a hole in it
const H = GLYPHS.H, O = GLYPHS.O;
say(H.every(r => r[0] === '#' && r[4] === '#') && H[3] === '#####' && H[0] === '#...#', 'an H is two uprights joined in the middle');
say(O[3] === '#...#' && O[0] === '.###.' && O[6] === '.###.', 'an O has a hole in it');
let refused = false; try { targets('spiral', 10); } catch { refused = true; }
say(refused, 'an unknown shape is refused, not guessed');
const ink = raster('GRIDATLAS'); let cells = 0; for (const v of ink.on) cells += v;
say(ink.w === 9 * 6 - 1 && ink.h === 7 && cells > 100, 'GRIDATLAS is ' + ink.w + ' by ' + ink.h + ' squares, ' + cells + ' of them inked');
return { ok, lines };
}Design Record
A JavaScript file in the drawing folder of GlobalGrid2050 that draws Kuiper proposed table and cables. Served with the page at https://globalgrid2050.com/kuiper-grid/drawing/.
renderglobalgrid2050 / kuiper-grid/drawing/design-record.js · lines 1–19 of 19 · Entry point
- What it does
- It draws Kuiper proposed table and cables. Defines build. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage agent_infra (path word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief). Domain terms in the code: cables.
- Inputs & outputs
- Out: JSON file kuiper-proposed-table.json; downloaded file kuiper-proposed-table.json.
- Downstream impact
- Used directly by 1 file: Kuiper Grid — Drawing Page (globalgrid2050, https://globalgrid2050.com/kuiper-grid/drawing/). Reached from 109 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); GlobalGrid2050 — Compute Page (globalgrid2050, https://globalgrid2050.com/compute/). It is itself an entry point, published at https://globalgrid2050.com/kuiper-grid/drawing/.
- What it achieves
- Defines `build`.
- Why it matters
- Loaded by the Drawing page at https://globalgrid2050.com/kuiper-grid/drawing/.
- Application
- globalgrid2050 · kuiper-grid/drawing · script
- Uses
- none found
- Used by
- loaded by Kuiper Grid — Drawing Page (script src)
- Produces
- build
- Defines here
- build
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 kuiper-grid/drawing/design-record.js:1-19 · blob 73f56d4364d02e75792c341ef75ecae0dbf9244c · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: production_core
'use strict';
(function boot(){
if(!window.__arrayLab?.engineReady){setTimeout(boot,200);return;}
function build(){
const m=__arrayLab.read(),r=__arrayLab.recipe(),copy=v=>JSON.parse(JSON.stringify(v));
const components=m.modules.map(x=>({id:x.id,kind:'pv-module',lifecycle:'proposed',approval:'unapproved',stringId:x.stringId,pose:copy(x.pose),cornersXYZM:copy(x.corners),thicknessM:x.thicknessM,parameters:copy(r.moduleParameters||{}),ports:[{id:x.id+'-',polarity:'negative',xyzM:copy(x.minus)},{id:x.id+'+',polarity:'positive',xyzM:copy(x.plus)}]}));
const ports=m.inverterInputs.flatMap(x=>[{id:'INV-'+x.stringId+'-',polarity:'negative',xyzM:copy(x.minusXYZ)},{id:'INV-'+x.stringId+'+',polarity:'positive',xyzM:copy(x.plusXYZ)}]);
if(ports.length)components.push({id:'INV-01',kind:'string-inverter-enclosure',lifecycle:'proposed',approval:'unapproved',ports,internalCircuit:null,mpptAssignments:null,portGeometryVerified:false});
const cables=m.links.map(x=>({id:x.key,kind:'intermodule',from:x.from+'+',to:x.to+'-',stringId:x.stringId,routeXYZM:copy(x.points),routeM:x.routeM,requiredWithSlackM:x.needM,availableLeadPairM:x.pairM,extensionShortfallM:x.shortM,lifecycle:'proposed',installed:false}));
for(const x of m.homeRuns)cables.push({id:'HOME/'+x.key,kind:'home-run',from:x.from,to:x.to,stringId:x.stringId,routeXYZM:copy(x.points),routeM:x.routeM,requiredWithSlackM:x.needM,enteredInstalledLengthM:x.installedM,extensionShortfallM:x.shortM,lifecycle:'proposed',installed:false});
const ids=new Set(components.flatMap(x=>x.ports.map(p=>p.id)));
if(cables.some(c=>!ids.has(c.from)||!ids.has(c.to)))throw Error('Cable references an absent terminal.');
return {schema:'kuiper.design-record/1',createdAt:new Date().toISOString(),scope:'current table only',coordinateSystem:{kind:'local Cartesian',units:'m',georeferenced:false},lifecycle:'proposed',approval:'unapproved',components,cables,strings:copy(m.strings),quantities:{modules:m.modules.length,strings:m.strings.length,seriesLinks:m.links.length,homeRuns:m.homeRuns.length,intermoduleRouteM:m.tot … [line shortened here: 687 characters; full line on GitHub]
}
const panel=document.createElement('details');panel.id='design-record';panel.style.cssText='padding:16px;border-top:1px solid #35475a';panel.innerHTML='<summary>Design record · components and connections</summary><p class="note">Export this table’s proposed components, named terminals, cable routes, module parameters and quantities. Stable drawing IDs connect the records. Site-wide quantities and … [line shortened here: 621 characters; full line on GitHub]
document.querySelector('main').append(panel);
panel.querySelector('button').onclick=()=>{try{const record=build(),url=URL.createObjectURL(new Blob([JSON.stringify(record,null,2)],{type:'application/json'})),a=document.createElement('a');a.href=url;a.download='kuiper-proposed-table.json';a.click();setTimeout(()=>URL.revokeObjectURL(url),1000);panel.querySelector('[role=status]').textContent=record.components.length+' components and '+record.c … [line shortened here: 514 characters; full line on GitHub]
window.__designRecord={build};
})();Kuiper Grid — Drawing Page
A web page in GlobalGrid2050 that reads inputs for module, count and rows, covering cables. Published at https://globalgrid2050.com/kuiper-grid/drawing/.
renderglobalgrid2050 / kuiper-grid/drawing/index.html · lines 1–43 of 43 · Entry point
- What it does
- It draws cables. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage agent_infra (path word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief). Domain terms in the code: cables.
- Inputs & outputs
- In: user-supplied file (file picker); form fields (user input). Out: web page.
- Downstream impact
- Used directly by 5 files: GlobalGrid2050 — Kuiper Grid Page (globalgrid2050, https://globalgrid2050.com/kuiper-grid/); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); Homepage Versions — Before Refresh Page (globalgrid2050, https://globalgrid2050.com/homepage_versions/20260922-before-refresh/); Homepage V124 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v124.html); and 1 more. Reached from 104 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 — Compute Page (globalgrid2050, https://globalgrid2050.com/compute/); GlobalGrid2050 — Kuiper Page (globalgrid2050, https://globalgrid2050.com/kuiper/). It is itself an entry point, published at https://globalgrid2050.com/kuiper-grid/drawing/.
- What it achieves
- Solar array drawing.
- Why it matters
- Loaded by the Kuiper Grid page at https://globalgrid2050.com/kuiper-grid/ and 4 other pages.
- Application
- globalgrid2050 · kuiper-grid/drawing · page
- Uses
- GlobalGrid2050 — Kuiper Grid Page (link), Renderer (iframe), Array Lab (script src), Site Scale (script src), View Mode (script src), Design Record (script src), Power Block Planner (script src), Whole Site Routes (script src), and 1 more
- Used by
- linked from GlobalGrid2050 — Kuiper Grid Page (link), linked from GlobalGrid2050 Homepage Before Four Nests (link), linked from Homepage Versions — Before Refresh Page (link), linked from Homepage V124 (link), linked from Homepage V125 (link)
- 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 kuiper-grid/drawing/index.html:1-43 · blob 9d6972e3fa74e3f50a10ddf82ec22f0a6f5187a3 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: production_core
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self'; object-src 'none'">
<title>Kuiper · Solar array drawing</title><link rel="icon" href="data:,">
<style>
:root{color-scheme:dark;font:14px system-ui,sans-serif;background:#080f19;color:#dce6f0}*{box-sizing:border-box}body{margin:0}button,select,input,textarea{font:inherit;color:inherit;background:#111f30;border:1px solid #35475a;border-radius:5px;padding:7px}button{cursor:pointer}button:hover{background:#263c52}button.active{background:#204c66;border-color:#70c8e4}a{color:#96d9f1}header{height:63px;b … [line shortened here: 3,663 characters; full line on GitHub]
</style>
</head>
<body>
<header><div><strong>Kuiper · Solar array drawing</strong><small>Module placement, independent strings and a generic site overview.</small></div><nav><a href="../">Kuiper builds</a> · <a href="./README.md">About & licences</a></nav></header>
<div class="app"><aside>
<h2>Module & table</h2>
<label class="field">Module geometry<select id="module"></select></label>
<div class="pair"><label class="field">Modules / series string<select id="count"><option>24</option><option selected>30</option><option>36</option><option>60</option></select></label><label class="field">Independent strings<input id="rows" type="number" min="1" max="24" value="5"></label></div>
<label class="field">Orientation<select id="orientation"><option value="portrait">Portrait</option><option value="landscape">Landscape</option></select></label>
<label class="field">Physical arrangement<select id="placement"><option value="rows">Straight independent rows</option><option value="patches">5-high patches · 5×6 per 30</option><option value="alternating">Alternate row positions</option><option value="east-west">Opposed east / west faces</option></select></label>
<p class="note">Placement changes keep electrical order. Opposed faces use five-high patches, tilt magnitude and a 0.15 m horizontal face gap; patch spacing is 1 m. Edit faceGapM / patchGapM in the recipe. Individual XYZ placements override a preset. No collision or structural check is implied.</p>
<button id="preset">5 portrait rows × 30 modules</button>
<div class="pair"><label class="field">Module width · m<input id="width" type="number" step="0.001" value="1.303"></label><label class="field">Module length · m<input id="length" type="number" step="0.001" value="2.384"></label></div>
<div class="pair"><label class="field">Across gap · m<input id="gapX" type="number" min="0" step="0.01" value="0.02"></label><label class="field">Up-slope gap · m<input id="gapY" type="number" min="0" step="0.01" value="0.02"></label></div>
<div class="pair"><label class="field">Tilt · degrees<input id="tilt" type="number" min="-80" max="80" step="0.1" value="8"></label><label class="field">Azimuth rotation · degrees<input id="azimuth" type="number" min="0" max="360" step="0.1" value="0"></label></div>
<label class="field">Low-edge height · m<input id="height" type="number" min="0" step="0.1" value="1"></label>
<p class="note">8° is an editable demonstration assumption. Azimuth rotates the table around world +Z; 0° means the module-row axis is +X.</p>
<h2>Electrical path</h2>
<label class="field">Wiring order<select id="wiring"><option value="sequential" selected>Sequential · within each string</option><option value="leapfrog">Leapfrog · each row</option><option value="custom">Custom · recipe order</option></select></label>
<div class="pair"><label class="field">Positive lead · m<input id="leadPlus" type="number" min="0" step="0.01" value="0.35"></label><label class="field">Negative lead · m<input id="leadMinus" type="number" min="0" step="0.01" value="0.28"></label></div>
<div class="pair"><label class="field">Clip offset · m<input id="clip" type="number" min="0" step="0.01" value="0.14"></label><label class="field">Extra slack / link · m<input id="slack" type="number" min="0" step="0.01" value="0.1"></label></div>
<p class="note">Box outlets at 35% / 65% width and mid-length, lead polarity/lengths, height, tilt and clip routing are editable assumptions. Selecting a module imports its outline dimensions only.</p>
<details><summary>Programmable recipe · order / placement / routes</summary><p class="note">Edit each string's own order with “custom”, or set XYZ interior waypoints by link key, e.g. “S01-M01+>S01-M02-”. Move any module independently with modulePlacements: {"S01-M01":{"originXYZ":[4,3,2],"tilt":8,"azimuth":45,"rotation":90}}. Angles are degrees; rotation acts in the module plane. Endpoints sta … [line shortened here: 861 characters; full line on GitHub]
<details><summary>Geometry & assumptions</summary><p id="source-note" class="note"></p><label class="field">Generic module illustration<select id="source-view"><option value="rear">Rear</option><option value="front">Front</option></select></label><img id="source-art" alt="Generic module illustration"><p id="gpu-note" class="note">Generic dimensions loading…</p><p class="note">Generic drawing tool. … [line shortened here: 601 characters; full line on GitHub]
<p id="error" class="error" role="alert"></p>
</aside><main>
<div class="toolbar"><button id="kuiper" class="active">Developed wiring</button><button id="plan">2D plan</button><button id="three">Shallow 3D</button><select id="string-select" aria-label="Selected string" style="width:100px"></select><button id="fit-string">Fit string</button><button id="trace">Trace wiring</button><button id="rear" class="active">Rear wiring</button><button id="front">Front + … [line shortened here: 554 characters; full line on GitHub]
<div class="stage"><iframe id="kuiper-frame" title="Original Kuiper string renderer" src="./renderer.html" style="position:absolute;inset:0;width:100%;height:100%;border:0;z-index:2;background:#090c13"></iframe><canvas id="table-canvas" aria-label="Interactive module table wiring drawing"></canvas><div id="stage-label" class="stage-label"></div><div class="stage-help">Wheel to zoom · drag to pan · … [line shortened here: 479 characters; full line on GitHub]
<div class="legend"><span><i class="key"></i>Lead pair reaches proposed route</span><span><i class="key dashed"></i>Extension required · proposed path</span><span id="trace-note">Trace previews the selected wiring order; it is not electrical current.</span></div>
<div class="summary"><div><strong id="stat-modules">—</strong><small>modules · independent row strings</small></div><div><strong id="stat-links">—</strong><small>series links · no inter-string bridge</small></div><div><strong id="stat-route">—</strong><small>3D intermodule route · excludes slack</small></div><div><strong id="stat-short">—</strong><small>links require extension</small></div></div>
<div class="detail"><section><h2>Selected connection</h2><select id="link-select" aria-label="Selected connection"></select><p id="link-info"></p><p class="note">All views use Kuiper's native renderer. Developed wiring uses the left-to-right electrical convention and schematic curves; rear mirroring applies to physical plan and 3D. Plan and 3D show the proposed XYZ routes. Only XYZ routes supply p … [line shortened here: 950 characters; full line on GitHub]
</main></div><script src="./array-lab.js"></script><script src="./site-scale.js" defer></script><script src="./view-mode.js" defer></script><script src="./design-record.js" defer></script><script src="./power-block-planner.js" defer></script>
<script src="./whole-site-routes.js" defer></script><script src="./whole-site-route-view.js" defer></script>
<footer style="padding:16px 24px;background:#090c13;border-top:1px solid #29483a;color:#53ff4c;font:12px/1.6 monospace"><strong>VENTUS WIRING | CURRENT WORKING RELEASE | 20260922-A</strong><br><a style="color:#53ff4c" href="/ventus/wiring/inverter-48.html">Open DC array drawing</a> · <a style="color:#53ff4c" href="/ventus/wiring/inverter-station.html">Open AC station drawing</a></footer>
</body></html>Kuiper Card
A JavaScript file in the drawing folder of GlobalGrid2050 that converts to world (`toWorld`) and steps anim (`stepAnim`). Served with the page at https://globalgrid2050.com/kuiper-grid/drawing/.
renderglobalgrid2050 / kuiper-grid/drawing/kuiper-card.js · lines 1–277 of 277 · Entry point · pattern revealUnderHead (shared by 3 files)
- What it does
- It draws its content. Defines 19 functions or classes, including toWorld, cardFor, esc, gh, ghLink. Side effects: changes the web page (DOM); reads or writes files; makes network requests.
- Why it exists in the grid workflow
- Domain stage agent_infra (path word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Downstream impact
- Used directly by 1 file: Renderer (globalgrid2050, https://globalgrid2050.com/kuiper-grid/drawing/renderer.html). Reached from 110 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); GlobalGrid2050 — Compute Page (globalgrid2050, https://globalgrid2050.com/compute/). It is itself an entry point, published at https://globalgrid2050.com/kuiper-grid/drawing/.
- What it achieves
- It shows new (`showNew`) and is built from the to world helper (`toWorld`) and the card for helper (`cardFor`). A cartridge of the Kuiper shell. It responds to toggle and click events.
- Why it matters
- Loaded by the Renderer page at https://globalgrid2050.com/kuiper-grid/drawing/renderer.html.
- Application
- globalgrid2050 · kuiper-grid/drawing · script
- VEDIC
- RECENT (GG2050-VEDIC-000041): Kuiper / Code navigation · Computer science / Interactive visualisation. hours, ordered_commits → recent_band_animation_state
- Uses
- none found
- Used by
- loaded by Renderer (script src), mentioned in Standalone (comment link)
- Produces
- toWorld, cardFor, esc, gh, ghLink, el, drow, linkTo, workTable, rawFile, workCode, open
- Defines here
- toWorld, cardFor, esc, gh, ghLink, el, drow, linkTo, workTable, rawFile, workCode, open, revealUnderHead, show, put, goKey, arriveAt, showNew, stepAnim
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 kuiper-grid/drawing/kuiper-card.js:1-277 · blob d76a0c3635a858e4e087db51aa46d419c325cd72 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, network · domain stage: agent_infra · users: ai_agent · canonical: production_core
'use strict';
// kuiper-card.js - a cartridge of the Kuiper shell. Cut from the whole page with no change of behaviour;
// replaced, when it is, by a newer file the pointer names and the composer checks by its hash.
// ------------------------------------------------------------------------------ the controls
function toWorld(px, py){ return [cx + (px - innerWidth/2)/zoom, cy - (py - innerHeight/2)/zoom]; }
// A KEY THAT LANDS IN A CARRIED FILE SHOWS THE CODE. Until every commit's file list is published a
// browser cannot work out which file a key belongs to, so the answer is worked out beforehand, one
// public file at a time, and the page simply looks it up. Where there is no card the page says what
// it knows and does not pretend otherwise.
function cardFor(k){ return cards.find(c => k >= c.k0 && k < c.k0 + c.lines) || null; }
function esc(t){ return String(t).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); }
const CONTEXT = 10;
// THE ONE RULE THAT MAKES THE ADDRESS OF A LINE ON GITHUB, the same rule tools/cards.py writes
// down, so a change of commit ids can be answered by making every link again from the fields.
// The owner used to be written in here by hand: correct by luck, and wrong the first time a
// carried file came from anywhere else.
// ONE RULE, TWO SHAPES. A whole piece of work is a commit; a line is a path inside it. Nothing in
// this page types a GitHub address: every one of them comes out of here, from data, so when the
// commit ids change they can all be made again by rebuilding the data.
function gh(o){
if (!o || !o.owner || !o.repo || !o.commit) return null;
const base = 'https://github.com/' + o.owner + '/' + o.repo;
if (!o.path) return base + '/commit/' + o.commit;
return base + '/blob/' + o.commit + '/' + o.path + (o.line ? '#L' + o.line : '');
}
function ghLink(c, line){
return gh({ owner:c.owner, repo:c.repo, commit:c.commit, path:c.path, line:line });
}
// ===== THE POP CARD =========================================================================
// The card this estate refined over many iterations, brought over rather than approximated again.
// Grid Atlas's popup look, a state chip with ONE writer, and a code window that is one <pre> with
// one text node: the numbers are part of the text, so copying the code copies what is on the
// screen, and the tapped line is marked by a bar placed from the line height.
function el(tag, cls, text){ const e = document.createElement(tag); if (cls) e.className = cls;
if (text != null) e.textContent = text; return e; }
function drow(dl, k, v){ dl.append(el('dt', null, k)); const d = el('dd', null, v); dl.append(d); return d; }
function linkTo(href, text){ const a = el('a', 'cc-link', text); a.href = href; a.target = '_blank'; a.rel = 'noopener'; return a; }
let cardToken = 0, cardSource = null, PG = null, glowBuf = null, glowCount = 0, glowOff = false;
// THE ESTATE'S ONE GATHERING ANIMATION, used as it stands. If it cannot be read the sparks simply stay
// where the work is: the page is quieter, and nothing is pretended.
// THE CODE A PIECE OF WORK CHANGED, THE WAFER'S WAY. The table of what each piece of work changed is one
// small module, asked for the first time a dot is tapped. The file is read from the public repository at
// that exact commit. Nothing is fetched for a repository that is not provably public.
let WORK = null, workWhy = null; const rawCache = new Map();
{ const st = document.createElement('style'); // the look of the other-files buttons travels with this part
st.textContent = '#card .cc-nav{display:flex;gap:.35rem;flex-wrap:wrap;margin:.3rem 0}'
+ '#card .cc-mini{background:#0a0a0a;color:#00ffff;border:1px solid #444;border-radius:3px;font:inherit;font-size:11px;padding:.3rem .5rem;cursor:pointer}'
+ '#card .cc-mini.cc-on{border-color:#00ffff;color:#fff}';
document.head.appendChild(st); }
// Historical source browsing is disabled in this generic drawing release.
function workTable(){return Promise.resolve({});}
function rawFile(){return Promise.reject(new Error('Source browsing is not part of this drawing release.'));}
// THE SAME WINDOW, ASKED FOR BY PLACE. A runner holds this page's code window against the wafer's own card on
// the same lines of the same public files and fails unless the text is the same. This is not a second way of
// showing code: it is the one way (the same file reader, the same window) with the place given from outside.
window.__kuiperCode = async (owner, repo, commit, path, line) => { const lines = await rawFile(owner, repo, commit, path);
const at = Math.min(Math.max(1, line | 0), lines.length), from = Math.max(1, at - CONTEXT), to = Math.min(lines.length, at + CONTEXT);
const rows = codeWindow(lines, from, to, at).node.textContent.split(String.fromCharCode(10));
return { from, to, at, rows:rows.map((t, i) => ({ n:from + i, text:t.slice(8) })) }; };
function workCode(a, r, s){
if (!r.pub) { s.setTag('EMPTY', 'This work is not public, so its code is not shown.'); return; }
const det = card.querySelector('details.cc-q');
if (det && !det.open && !s.asked) { s.asked = true; s.setTag('WAIT', 'open this to read the code this piece of work changed');
det.addEventListener('toggle', () => { if (det.open && s.live()) workCode(a, r, s); }, { once:true }); return; }
s.setTag('LOAD', 'finding what this piece of work changed\u2026');
workTable().then(table => { if (!s.live()) return;
if (!table) { s.setTag('FAIL', 'The list of what each piece of work changed could not be read: ' + workWhy); return; }
const row = table[a.c.sha];
if (!row) { s.setTag('EMPTY', 'This piece of work changed no code a card can show: data, pictures, or files that were only removed.'); return; }
const full = row[0], count = row[1], files = row.slice(2);
const pick = el('div', 'cc-nav'), head = el('div', 'cc-codehead'), holder = el('div');
s.body.append(head, pick, holder);
const open = i => { const path = files[i][0], line = files[i][1], name = path.split('/').pop();
for (const b of pick.children) b.classList.toggle('cc-on', b.getAttribute('data-i') === String(i));
head.textContent = 'This piece of work changed ' + fmt(count) + (count === 1 ? ' file' : ' files') + '. Showing ' + path + '.';
holder.replaceChildren(); cardShown = null;
s.setTag('LOAD', 'reading ' + name + ' as it stood that day\u2026');
rawFile(r.owner, r.name, full, path).then(lines => { if (!s.live()) return;
const at = Math.min(Math.max(1, line), lines.length), from = Math.max(1, at - CONTEXT), to = Math.min(lines.length, at + CONTEXT);
const w = codeWindow(lines, from, to, at); holder.append(w.node);
const src = el('div', 'cc-source'), g = linkTo(gh({ owner:r.owner, repo:r.name, commit:full, path:path, line:at }), 'GitHub'); g.classList.add('cc-gh');
src.append(g); holder.append(src);
cardShown = { work:true, path, line:at, lines, window:w, sheet:s, from, to };
s.setTag('OK', 'lines ' + fmt(from) + ' to ' + fmt(to) + ' of ' + fmt(lines.length) + ', around the first line this work changed (line ' + fmt(at) + ')');
requestAnimationFrame(() => { if (s.live()) revealUnderHead(); }); revealUnderHead(); dirty = true;
}).catch(e => { if (s.live()) s.setTag('FAIL', name + ' could not be read from the public repository: ' + (e && e.message || e) + '. Nothing is shown in its place.'); }); };
files.forEach((f, i) => { const b = el('button', 'cc-mini', f[0].split('/').pop()); b.type = 'button'; b.setAttribute('data-i', i); b.title = f[0];
b.addEventListener('click', e => { e.stopPropagation(); open(i); }); pick.append(b); });
if (count > files.length) pick.append(el('span', 'cc-small', ' and ' + fmt(count - files.length) + ' more'));
if (files.length < 2) pick.style.display = 'none';
open(0);
});
}
// THE CODE IS BROUGHT IN UNDER THE HEAD, never over it: the window's top is put just below the head's foot,
// and then the marked line is brought to the middle of the window.
function revealUnderHead(){ const w = cardShown && cardShown.window; if (!w) return;
const head = card.querySelector('.cc-head'), floor = head ? head.getBoundingClientRect().bottom : card.getBoundingClientRect().top;
card.scrollTop += w.node.getBoundingClientRect().top - (floor + 4);
w.scrollToTarget(); }
{ const st = document.createElement('style');
st.textContent = '#card .cc-head{position:sticky;top:-8px;z-index:2;background:#000;padding-top:8px;margin-top:-8px}'
+ '#card.codeopen .cc-tile-what,#card.codeopen .scada-brand,#card.codeopen .cc-plain,#card.codeopen .cc-links{display:none}'
+ '#card.codeopen .cc-tile{padding:8px 12px;margin:2px 0 6px}#card.codeopen .cc-tile-name{font-size:16px;margin-bottom:.35rem}'
+ '#card.codeopen .cc-tile-open{padding:.4rem 0}#card.codeopen .cc-tile-part{margin-bottom:.15rem}'
+ '@media (max-width:640px){#card.codeopen .cc-code{max-height:24vh}}';
document.head.appendChild(st); }
function show(a){
card.classList.remove('codeopen');
cardShown = null;
if (!a) { closeCard(); return; }
if (a.silent) {
const x = a.next, s = sheet('Nothing was recorded here', '');
s.setTag('EMPTY', 'This point falls between two pieces of work, so no line of code has this address.');
if (x) { const p = el('div', 'cc-row');
const go = el('a', 'cc-link', 'Go to the next work: ' + repos[x.repo].name + ', ' + day(x.unix));
// BESIDE THE ADDRESS BAR, NOT BESIDE THE SHELL. Under the composer the page's base is the shell's own
// folder, and a bare ?key= would lead there instead of to the one address that never changes.
go.href = location.pathname + buildLink({ key:x.k0 }); go.setAttribute('data-key', x.k0);
p.append(go); s.body.append(p); }
return;
}
const r = repos[a.c.repo], c = cardFor(a.k);
litRepo = a.c.repo;
const s = sheet('Line ' + fmt(a.k), c ? ' \u00b7 ' + c.path.split('/').pop() : ' \u00b7 ' + r.name);
// THE ORDER OF THE CARD IS THE ORDER OF THE QUESTIONS A PERSON WHO SIGNS ASKS. What is this for,
// and where do I open it; whose is it; what was done and when. How it is made comes last and
// closed, one tap further in, for the engineer who is in the room but does not sign.
{ const found = r.pub ? appFor(r.owner, r.name, c ? c.path : null) : null;
const det = el('details', 'cc-q'); det.append(el('summary', null, 'See the code behind this'));
for (const kid of Array.from(card.children)) if (!kid.classList.contains('cc-x')) det.append(kid);
let top;
// WHERE TO PUT THE VISITOR. A carried file knows its own page; any other piece of work has the
// page its files agreed on. Where that page is the application's own front door, the tile is the
// application's, as before.
const near = r.pub ? ((c && c.page) || pageOfWork[a.c.sha] || null) : null;
const theApp = found && found.app ? found.app : null;
if (near && !(theApp && theApp.live === near.address)) {
top = el('a', 'cc-tile cc-app cc-page'); top.href = near.address; top.target = '_blank'; top.rel = 'noopener';
top.setAttribute('data-app', theApp ? theApp.app : ''); top.setAttribute('data-page', near.address);
if (theApp) top.append(el('div', 'cc-tile-part', 'part of ' + theApp.button));
top.append(el('div', 'cc-tile-name', near.title || near.address.replace(/^https?:\/\//, '')));
top.append(el('span', 'cc-tile-open', 'OPEN THIS PAGE'));
} else if (found && found.app) {
top = el('a', 'cc-tile cc-app'); top.href = found.app.live; top.target = '_blank'; top.rel = 'noopener';
top.setAttribute('data-app', found.app.app);
top.append(el('div', 'cc-tile-name', found.app.button));
if (whatItDoes[found.app.live]) top.append(el('div', 'cc-tile-what', whatItDoes[found.app.live] + '.'));
top.append(el('span', 'cc-tile-open', 'OPEN ' + found.app.button));
} else {
top = el('div', 'cc-notile cc-app');
top.setAttribute('data-app', found && found.unproved ? '?' : '');
top.append(el('div', null, 'This work has no page of its own yet.'));
}
// THE LINKS A CARD CARRIES, IN THE OPEN AND IN AS FEW WORDS AS THEY NEED: the application (above),
// GitHub as one quiet word for those who know what it is, and the site itself whenever there is
// nothing else to offer, so that no card is ever a dead end.
const links = el('div', 'cc-row cc-links');
{ const gu = r.pub ? gh({ owner:r.owner, repo:r.name, commit:a.c.sha }) : null;
if (!near && !(found && found.app)) {
// the front door of the site this work is served from, where it has one; else the main site
const door = (r.pub && frontOfWork[a.c.sha]) || 'https://www.globalgrid2050.com/';
const hl = linkTo(door, door.replace(/^https?:\/\//, '').replace(/\/$/, ''));
hl.classList.add('cc-home'); links.append(hl); }
// GITHUB IS HUMBLE: one small grey word at the very bottom of the code fold, for those who know
// what it is. Never a sentence, and never in the way of a visitor who does not.
if (gu) { const src = el('div', 'cc-source'); const gl = linkTo(gu, 'source'); gl.classList.add('cc-gh');
src.append(gl); det.append(src); cardSource = src; } }
const brand = el('div', 'scada-brand'), inner = el('div');
inner.append(el('div', 'scada-brand-main', 'Ventus'), el('div', 'scada-brand-sub', 'Cables & Connectivity\u00ae'));
brand.append(inner);
const plain = el('div', 'cc-plain', 'Engineering work in ' + r.name + ', done on ' + day(a.c.unix) + '.');
// THE HEADER IS THE HEADER. It stays at the top of the card whatever is opened under it.
const head = el('div', 'cc-head'); head.append(top, links, brand, plain);
card.append(head, det);
det.open = codeOpen; card.classList.toggle('codeopen', det.open);
det.addEventListener('toggle', () => { card.classList.toggle('codeopen', det.open); });
// ASKED FOR MUST MEAN SEEN. With the tile, the brand and the plain line above it, the code opened
// below the fold of the card on a phone. Opening it brings the window into view, then the line.
det.addEventListener('toggle', () => { if (det.open && cardShown && cardShown.window) revealUnderHead(); dirty = true; }); }
const meta = el('dl', 'cc-dl');
drow(meta, 'work', r.name + ' \u00b7 ' + day(a.c.unix));
const u = r.pub ? gh({ owner:r.owner, repo:r.name, commit:a.c.sha }) : null;
const d = drow(meta, 'history', '');
if (u) { d.append(linkTo(u, 'source')); d.append(' \u00b7 commit ' + a.c.sha.slice(0, 7)); }
else d.textContent = 'not public, so there is no link';
s.body.append(meta);
if (!c) { workCode(a, r, s); return; }
const j = a.k - c.k0;
s.setTag('LOAD', 'reading the lines around it from this site\u2026');
const put = data => {
if (!s.live()) return;
cardShown = { card:c, line:j, data, sheet:s };
const short = c.commit.slice(0, 7), fileName = c.path.split('/').pop();
// THE ARITHMETIC THIS CARD IS ABOUT TO RELY ON, CHECKED BEFORE IT IS RELIED ON. The pack was
// built from git and every line proved against it when it was built; what can still go wrong
// here is the pack and the list disagreeing about the length of the file, and then every number
// below would be a guess.
if (!c.here || data.lines !== c.lines || data.text.length !== c.lines || !(j >= 0 && j < c.lines)) {
s.setTag('FAIL', !c.here
? 'This file is no longer in the repository, so its neighbours today would not be this line\u2019s neighbours. Nothing around it is shown.'
: 'The record says this file has ' + fmt(c.lines) + ' lines and the text carried for it has '
+ fmt(data.text.length) + ', so the numbering cannot be trusted. Nothing around it is shown.');
const h = el('div', 'cc-codehead');
h.append(c.path + ' \u00b7 ' + c.repo + ' @ ' + short + ' \u00b7 line ' + fmt(j + 1) + ' \u00b7 ');
h.append(linkTo(ghLink(c, j + 1), 'source'));
s.body.append(h);
dirty = true; return;
}
const from = Math.max(1, j + 1 - CONTEXT), to = Math.min(data.text.length, j + 1 + CONTEXT);
const head = el('div', 'cc-codehead');
head.append(c.path + ' \u00b7 ' + c.repo + ' @ ' + short + ' \u00b7 line ' + fmt(j + 1)
+ ' \u00b7 showing ' + fmt(from) + '\u2013' + fmt(to) + ' of ' + fmt(data.text.length) + ' \u00b7 ');
head.append(linkTo(ghLink(c, j + 1), 'source'));
s.body.append(head);
s.body.append(el('div', 'cc-check',
'These lines are carried on this site, read from ' + c.repo + ' at commit ' + short
+ ' when this page was built and checked line for line against it then \u00b7 '
+ fmt(j + 1 - from) + ' above, ' + fmt(to - j - 1) + ' below. Scroll inside the window to see them all;'
+ ' a long line scrolls sideways.'));
const w = codeWindow(data.text, from, to, j + 1);
s.body.append(w.node);
cardShown.window = w;
s.setTag('OK', 'the line and the lines around it, as the file stood that day');
s.body.append(el('div', 'cc-disclaimer',
'Provided as is, without warranty of any kind; a chart, not a design.'));
if (cardSource && cardSource.parentNode) cardSource.parentNode.append(cardSource);
requestAnimationFrame(() => { if (s.live()) revealUnderHead(); });
revealUnderHead();
dirty = true;
};
if (cardCache[c.file]) { put(cardCache[c.file]); return; }
fetch('cosmos/cards/' + c.file).then(x => x.json()).then(dd => { cardCache[c.file] = dd; put(dd); })
.catch(e => s.setTag('FAIL', 'the lines around this one could not be read from this site: ' + (e && e.message || e)));
}
function goKey(k){ endIsolate(); const p = keyPlace(k); target = { x:p[0], y:p[1] }; show(address(k)); flyTo(p[0], p[1], 14); }
// ARRIVING BY SOMEBODY ELSE'S LINK. The view flies, the arrow is shot, the card opens: three things
// in that order, because a card that appears over a picture of nine thousand pieces of work asks to
// be taken on trust, and an arrow from the middle of the record to one dot does not.
function arriveAt(k){
endIsolate();
const a = address(k);
if (!a) return;
const p = keyPlace(k);
target = null; arrow = null; arrowTip = null; card.style.display = 'none';
flyTo(p[0], p[1], Math.max(14, zoom));
setTimeout(() => { arrow = { k, t0:performance.now() }; dirty = true; }, 920);
setTimeout(() => { target = { x:p[0], y:p[1] }; show(a); dirty = true; }, 920 + ARROW_MS);
}
// SHOW NEW CODE. "New" is measured from the newest commit, not from the wall clock, so the same
// page gives the same answer tomorrow. Keys run in time order, so what is new is always one
// contiguous band at the rim: the boundary is a single circle, and that circle is drawn.
function showNew(hours){
endIsolate();
const last = commits[commits.length-1].unix, cut = last - hours*3600;
newFrom = findBy('unix', cut - 1) + (commits[0].unix >= cut ? 0 : 1); if (newFrom >= commits.length) newFrom = commits.length - 1;
litRepo = -1; target = null; card.style.display = 'none'; tween = null;
const R = Math.sqrt(SPACE); cx = 0; cy = 0; zoom = (Math.min(cv.width, cv.height)/2) * 0.80 / R;
anim_hours = hours; anim = { t0:performance.now(), hours, R }; dirty = true;
}
function stepAnim(){
const t = (performance.now() - anim.t0) / 1000; dirty = true;
if (t < 1.6) { const u = t/1.6; pulse = anim.R * (u*u*(3-2*u)); flash = 0; }
else if (t < 2.5) { pulse = -1; flash = 1 - 0.45*((t-1.6)/0.9); if (selftest && selftest.wantPixels === undefined) selftest.wantPixels = true; }
else { const c = commits[newFrom], n = commits.length - newFrom; let lines = 0; for (let i = newFrom; i < commits.length; i++) lines += commits[i].lines;
flash = 0.35; anim = null; const p = keyPlace(c.k0); target = { x:p[0], y:p[1], boundary:true };
card.style.display = 'block';
{ const r0 = repos[c.repo], u0 = r0.pub ? gh({ owner:r0.owner, repo:r0.name, commit:c.sha }) : null;
card.classList.remove('sheet');
card.innerHTML = 'NEW CODE · the last ' + anim_hours + ' hours of work, as a band at the rim'
+ '\n<b>' + fmt(n) + '</b> pieces of work, <b>' + fmt(lines) + '</b> lines added'
+ '\nbegins with <b>' + r0.name + '</b>, ' + day(c.unix)
+ (u0 ? '\n<a class="cc-gh" style="color:#666;font-size:10.5px" href="' + u0 + '" target="_blank" rel="noopener">GitHub</a>' : ''); }
flyTo(p[0], p[1], 14);
if (selftest) finishSelftest(c, n, lines); }
}
let anim_hours = 24;
// THE TESTS, run by the page on itself with ?selftest=new, so the verdict is not an opinion.