GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Electricity markets and data pipelines / globalgrid2050 / uk_renewables_pipeline/202611221243

Renewable Energy Planning Database (REPD) Liquid and 2 more files

A JavaScript module in GlobalGrid2050 that updates slider, zooms to, calculates planar distances and reads inputs for pn liquid format, pn liquid and pn liquid status.

588 lines of JavaScript and CSS from globalgrid2050, in 3 files. Topic: Electricity markets and data pipelines. Section 954 of 2044.

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

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

In this section

  1. Renewable Energy Planning Database (REPD) Liquid energy-data · globalgrid2050 / uk_renewables_pipeline/202611221243/repd-liquid.mjs lines 1–265
  2. Renewable Energy Planning Database (REPD) Liquid energy-data · globalgrid2050 / uk_renewables_pipeline/202611221243/styles/repd-liquid.css lines 1–185
  3. Renewable Energy Planning Database (REPD) Liquid test · globalgrid2050 / uk_renewables_pipeline/202611221243/tests/repd-liquid.mjs lines 1–138

Renewable Energy Planning Database (REPD) Liquid

A JavaScript module in GlobalGrid2050 that updates slider, zooms to, calculates planar distances and reads inputs for pn liquid format, pn liquid and pn liquid status.

energy-dataglobalgrid2050 / uk_renewables_pipeline/202611221243/repd-liquid.mjs · lines 1–265 of 265 · version 2026-11-22 12:43 · Not reached from any entry point (candidate for review) · pattern decorate (shared by 2 files)

What it does
It draws the REPD register, interconnectors, solar and battery storage (BESS). Defines 17 functions or classes, including $, esc, date, allRows, mapUrl. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'renewables'): 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, interconnectors, solar, battery storage (BESS).
Inputs & outputs
In: form fields (user input).
What it achieves
It maps URL (`mapUrl`) and updates slider (`updateSlider`). V9.63 individual A4/PDF is untouched. It responds to click, change and input events.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · uk_renewables_pipeline/202611221243 · JavaScript module
Uses
State (import), Testcode — Pipeline (import), Projects V9 8 (import), Atlas Interconnector Link V9 8 (import)
Used by
none found
Produces
$, esc, date, allRows, mapUrl, rowHtml, decorate, dimensions, updateSlider, draw, gap, requestDraw
Defines here
$, esc, date, allRows, mapUrl, rowHtml, decorate, dimensions, updateSlider, draw, gap, requestDraw, zoomTo, sync, show, close, distance
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611221243/repd-liquid.mjs:1-265 · blob cb75df8cf8d1d29e03688bb2d28a097d21912d2f · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
// V9.64: independent A3/A4 liquid HTML overview. V9.63 individual A4/PDF is untouched.
import {state} from './scripts/core/state.js';
import {escapeHtml} from './scripts/core/utils.js';
import {atlasUrlV9_5_1} from './scripts/plugins/projects-v9-8.js';
import {buildAtlasInterconnectorLinkV9_8} from './scripts/core/atlas-interconnector-link-v9-8.js';
(() => {
  'use strict';
  const toolbar=document.getElementById('pnScanToolbar');
  const table=document.getElementById('repdScroll');
  if(!toolbar||!table||document.getElementById('pnLiquidOverview'))return;
  const launch=document.createElement('button');
  launch.id='pnLiquidLaunch'; launch.type='button';launch.textContent='A3 OVERVIEW';
  launch.title='Open the entire filtered REPD register as a scrollable HTML sheet';
  launch.setAttribute('aria-haspopup','dialog');launch.setAttribute('aria-controls','pnLiquidOverview');
  toolbar.append(launch);
  const labels=[
    ['name','PROJECT'],['capacity','MW / MWp'],['county','COUNTY'],['operator','OPERATOR'],
    ['technology','TYPE'],['status','STATUS'],['repd','REPD REF'],['globalgrid','GRID REF'],
    ['updated','REPD UPDATED'],['submitted','SUBMITTED'],['operational','OPERATIONAL'],
    [null,'NOTES'],[null,'MAP']
  ];
  const widths=[14.7,5.6,7,11,7.4,10,5.6,8.3,6.8,6.8,6.8,5.7,4.3];
  const overlay=document.createElement('aside');
  overlay.id='pnLiquidOverview';overlay.hidden=true;
  overlay.setAttribute('role','dialog');overlay.setAttribute('aria-modal','true');
  overlay.setAttribute('aria-label','Entire REPD register liquid HTML overview');
  const header=labels.map(item=>'<th'+(item[0]?' data-liquid-key="'+item[0]+'" aria-sort="none"':'')+'>'+
    (item[0]?'<button type="button" data-liquid-sort="'+item[0]+'">'+item[1]+' <span>↕</span></button>':item[1])+'</th>').join('');
  overlay.innerHTML=[
    '<div class="pn-liquid-controls">',
    '<button type="button" data-liquid-action="close">CLOSE</button><strong>REPD · LIQUID OVERVIEW</strong>',
    '<select id="pnLiquidFormat" aria-label="Sheet size"><option value="a3">A3 LANDSCAPE</option><option value="a4">A4 LANDSCAPE</option></select>',
    '<button type="button" data-liquid-action="minus" aria-label="Zoom out">−</button>',
    '<output id="pnLiquidZoom">100%</output><button type="button" data-liquid-action="plus" aria-label="Zoom in">+</button>',
    '<button type="button" data-liquid-action="fit">FIT</button></div>',
    '<div class="pn-liquid-filters">',
    '<label>SEARCH <input type="search" id="pnLiquidSearch" placeholder="Find projects" aria-label="Search all REPD projects"></label>',
    '<label>STATUS <select id="pnLiquidStatus" aria-label="Official status"></select></label>',
    '<label>COUNTY <select id="pnLiquidCounty" aria-label="County"></select></label>',
    '<label>TYPE <select id="pnLiquidTech" aria-label="Technology"></select></label>',
    '<button type="button" data-liquid-action="clear">RESET</button>',
    '<span id="pnLiquidCount" role="status">Loading REPD…</span></div>',
    '<div id="pnLiquidViewport" role="region" tabindex="0" aria-label="Scroll horizontally and vertically across the whole REPD register">',
    '<div id="pnLiquidSheet"><div class="pn-liquid-masthead">',
    '<span>GLOBALGRID2050 · RENEWABLE ENERGY PLANNING DATABASE</span><span id="pnLiquidSourceDate"></span>',
    '</div><table id="pnLiquidTable" aria-label="All filtered REPD projects with working MAP links">',
    '<colgroup>'+widths.map(width=>'<col style="width:'+width+'%">').join('')+'</colgroup>',
    '<thead><tr>'+header+'</tr></thead><tbody id="pnLiquidBody"></tbody></table></div></div>',
    '<div class="pn-liquid-bottom"><label for="pnLiquidX">COLUMNS ↔</label>',
    '<input type="range" id="pnLiquidX" min="0" max="100" step="0.2" value="0" aria-label="Horizontal column scrollbar">',
    '<span>Swipe across rows · Live HTML, not PDF</span></div>'
  ].join('');
  document.body.append(overlay);
  const $=id=>document.getElementById(id);
  const viewport=$('pnLiquidViewport'),sheet=$('pnLiquidSheet'),body=$('pnLiquidBody'),xslider=$('pnLiquidX');
  const WIDTH={a3:1587,a4:1123},ROW=40,OVERSCAN=14;
  const names={solar:'Solar',bess:'Battery Storage',wind_onshore:'Onshore Wind',
    wind_offshore:'Offshore Wind',interconnector:'Interconnector'};
  let format='a3',zoom=1,open=false,lastStart=-1,lastEnd=-1,lastData=null,raf=0,gesture=null,saved=null,focusBack=null;
  let publishingRows=false;
  const esc=value=>escapeHtml(String(value??''));
  const date=value=>{
    if(!value)return '—';
    const parts=String(value).split('-');
    return parts.length===3?parts[2]+'/'+parts[1]+'/'+parts[0]:String(value);
  };
  const allRows=()=>Array.isArray(state.filtered)?state.filtered:[];
  const mapUrl=project=>{
    try{
      const result=project.technology==='interconnector'?buildAtlasInterconnectorLinkV9_8(project):atlasUrlV9_5_1(project);
      const url=new URL(result);return url.protocol==='https:'?url.href:'';
    }catch{return '';}
  };
  function rowHtml(project,index){
    const name=project.name||'Project not reported',ref=project.repd_ref||'';
    const capacity=Number.isFinite(project.capacity_mw)?
      project.capacity_mw.toLocaleString('en-GB',{maximumFractionDigits:2})+' '+(project.technology==='solar'?'MWp':'MW'):'—';
    const values=[
      name,capacity,project.county||'—',project.operator||'—',
      names[project.technology]||project.technology||'—',project.status||'—',
      ref,project.gg_project_id||'—',date(project.repd_record_updated),
      date(project.planning_application_submitted),date(project.operational)
    ];
    const cells=values.map((value,i)=>'<td title="'+esc(value)+'">'+
      (i===0?'<span class="pn-liquid-row-no">'+(index+1).toLocaleString('en-GB')+'</span> ':'')+
      esc(value)+'</td>').join('');
    const note='<td><button type="button" class="machine-note-button pn-liquid-note" data-note-ref="'+esc(ref)+
      '" data-note-name="'+esc(name)+'" data-note-status="'+esc(project.status||'')+'">NOTE</button></td>';
    const href=mapUrl(project);
    const map=href?'<a class="pn-liquid-map" href="'+esc(href)+
      '" target="_blank" rel="noopener noreferrer" aria-label="Open '+esc(name)+' in GridAtlas">MAP ↗</a>':
      '<span class="pn-liquid-map-unavailable">NO MAP</span>';
    return '<tr class="pn-liquid-project" data-overview-ref="'+esc(ref)+'">'+cells+note+'<td>'+map+'</td></tr>';
  }
  function decorate(){
    const sort=new URLSearchParams(location.search).get('sort')||'capacity_desc';
    for(const th of overlay.querySelectorAll('th[data-liquid-key]')){
      const key=th.dataset.liquidKey;
      const mode=sort===key+'_asc'?'ascending':sort===key+'_desc'?'descending':'none';
      th.setAttribute('aria-sort',mode);
      const span=th.querySelector('span');
      if(span)span.textContent=mode==='ascending'?'▲':mode==='descending'?'▼':'↕';
    }
  }
  function dimensions(){
    sheet.style.setProperty('--pn-liquid-sheet-width',Math.round(WIDTH[format]*zoom)+'px');
    sheet.style.setProperty('--pn-liquid-row-height',ROW*zoom+'px');
    sheet.style.setProperty('--pn-liquid-head-height',43*zoom+'px');
    sheet.style.setProperty('--pn-liquid-font',12*zoom+'px');
    $('pnLiquidZoom').textContent=Math.round(zoom*100)+'%';
    $('pnLiquidFormat').value=format;
  }
  function updateSlider(){
    const max=Math.max(0,viewport.scrollWidth-viewport.clientWidth);
    xslider.disabled=!max;
    xslider.value=max?100*viewport.scrollLeft/max:0;
  }
  function draw(force=false){
    if(!open)return;
    const data=allRows(),n=data.length,rh=ROW*zoom;
    const before=sheet.querySelector('.pn-liquid-masthead').getBoundingClientRect().height+
      sheet.querySelector('thead').getBoundingClientRect().height;
    const start=Math.max(0,Math.floor(Math.max(0,viewport.scrollTop-before)/rh)-OVERSCAN);
    const end=Math.min(n,start+Math.ceil(viewport.clientHeight/rh)+2*OVERSCAN+4);
    if(!force&&start===lastStart&&end===lastEnd&&data===lastData)return;
    lastStart=start;lastEnd=end;lastData=data;
    const gap=px=>'<tr class="pn-liquid-gap" aria-hidden="true"><td colspan="13"><div style="height:'+Math.max(0,px)+'px"></div></td></tr>';
    const originalScrollY=viewport.scrollTop;
    body.innerHTML=gap(start*rh)+data.slice(start,end).map((record,i)=>rowHtml(record,start+i)).join('')+gap((n-end)*rh);
    if(Math.abs(viewport.scrollTop-originalScrollY)>1)viewport.scrollTop=originalScrollY;
    body.dataset.total=String(n);body.dataset.rendered=String(end-start);
    body.dataset.start=String(start);body.dataset.end=String(end);
    $('pnLiquidCount').textContent=n.toLocaleString('en-GB')+' projects · '+(n?start+1:0)+'–'+end+' visible · all matches scrollable';
    decorate();updateSlider();
    publishingRows=true;
    try{window.dispatchEvent(new Event('pipeline-projects-rendered'));}
    finally{publishingRows=false;}
  }
  function requestDraw(){
    if(!open||raf)return;
    raf=requestAnimationFrame(()=>{raf=0;draw();});
  }
  function zoomTo(value,holdPosition=true){
    const next=Math.max(.22,Math.min(2.2,value)),old=zoom;
    const cx=(viewport.scrollLeft+viewport.clientWidth/2)/old;
    const cy=(viewport.scrollTop+viewport.clientHeight/2)/old;
    zoom=next;lastStart=-1;dimensions();
    if(holdPosition){
      viewport.scrollLeft=Math.max(0,cx*zoom-viewport.clientWidth/2);
      viewport.scrollTop=Math.max(0,cy*zoom-viewport.clientHeight/2);
    }
    draw(true);
  }
  function sync(){
    $('pnLiquidSearch').value=document.getElementById('search')?.value||'';
    const originalStatus=$('pnScanStatus');
    if(originalStatus){
      const select=$('pnLiquidStatus');
      select.replaceChildren(...[...originalStatus.options].map(opt=>new Option(opt.textContent,opt.value)));
      select.value=originalStatus.value;
    }
    const originalCounty=$('county');
    if(originalCounty){
      const select=$('pnLiquidCounty');
      select.replaceChildren(...[...originalCounty.options].map(opt=>new Option(opt.textContent,opt.value)));
      select.value=originalCounty.value;
    }
    const buttons=[...document.querySelectorAll('#tech [data-technology]')],select=$('pnLiquidTech');
    select.replaceChildren(...buttons.map(button=>new Option(button.textContent.trim()||button.dataset.technology,button.dataset.technology)));
    const active=buttons.find(button=>button.getAttribute('aria-pressed')==='true');
    if(active)select.value=active.dataset.technology;
    $('pnLiquidSourceDate').textContent=(document.getElementById('repdReportDate')?.textContent||'').trim();
  }
  function show(){
    if(open)return;
    focusBack=document.activeElement;
    saved={body:document.body.style.overflow,html:document.documentElement.style.overflow,
      y:scrollY,x:table.scrollLeft,tableY:table.scrollTop};
    document.body.style.overflow='hidden';document.documentElement.style.overflow='hidden';
    open=true;overlay.hidden=false;format='a3';zoom=1;lastStart=-1;
    dimensions();sync();viewport.scrollLeft=0;viewport.scrollTop=0;draw(true);
    overlay.querySelector('[data-liquid-action="close"]').focus({preventScroll:true});
  }
  function close(){
    if(!open)return;
    open=false;overlay.hidden=true;
    if(raf)cancelAnimationFrame(raf);raf=0;
    lastData=null;lastStart=-1;lastEnd=-1;
    if(saved){
      document.body.style.overflow=saved.body;
      document.documentElement.style.overflow=saved.html;
      const prior=saved;saved=null;
      requestAnimationFrame(()=>{table.scrollLeft=prior.x;table.scrollTop=prior.tableY;scrollTo(0,prior.y)});
    }
    (focusBack||launch).focus({preventScroll:true});
  }
  launch.addEventListener('click',show);
  overlay.addEventListener('click',event=>{
    const action=event.target.closest('[data-liquid-action]');
    if(action){
      const value=action.dataset.liquidAction;
      if(value==='close')close();
      else if(value==='minus'||value==='plus')zoomTo(zoom*(value==='plus'?1.2:1/1.2));
      else if(value==='fit'){zoomTo(Math.max(.22,(viewport.clientWidth-20)/WIDTH[format]),false);
        viewport.scrollLeft=0;viewport.scrollTop=0;draw(true);}
      else if(value==='clear'){$('clearFilters')?.click();sync();draw(true);}
      return;
    }
    const sort=event.target.closest('[data-liquid-sort]');
    if(!sort)return;
    const key=sort.dataset.liquidSort;
    const selector=({updated:'#sortUpdated',submitted:'#sortSubmitted',operational:'#sortOperational'})[key]||
      '[data-column-sort="'+key+'"]';
    const source=document.querySelector('#repdScroll thead '+selector)||document.querySelector(selector);
    if(source){source.click();draw(true);}
  });
  $('pnLiquidFormat').addEventListener('change',event=>{
    const requested=event.target.value;
    if(!Object.hasOwn(WIDTH,requested))return;
    const left=(viewport.scrollLeft+viewport.clientWidth/2)/(WIDTH[format]*zoom);
    format=requested;dimensions();lastStart=-1;
    viewport.scrollLeft=Math.max(0,left*WIDTH[format]*zoom-viewport.clientWidth/2);draw(true);
  });
  $('pnLiquidSearch').addEventListener('input',event=>{
    const source=$('search');if(!source)return;
    source.value=event.target.value;source.dispatchEvent(new Event('input',{bubbles:true}));
    viewport.scrollTop=0;draw(true);
  });
  $('pnLiquidStatus').addEventListener('change',event=>{
    const source=$('pnScanStatus');if(!source)return;
    source.value=event.target.value;source.dispatchEvent(new Event('change',{bubbles:true}));
    viewport.scrollTop=0;draw(true);
  });
  $('pnLiquidCounty').addEventListener('change',event=>{
    const source=$('county');if(!source)return;
    source.value=event.target.value;source.dispatchEvent(new Event('change',{bubbles:true}));
    viewport.scrollTop=0;draw(true);
  });
  $('pnLiquidTech').addEventListener('change',event=>{
    const source=[...document.querySelectorAll('#tech [data-technology]')]
      .find(button=>button.dataset.technology===event.target.value);
    if(source)source.click();
    viewport.scrollTop=0;draw(true);
  });
  viewport.addEventListener('scroll',()=>{requestDraw();updateSlider();},{passive:true});
  xslider.addEventListener('input',()=>{viewport.scrollLeft=Number(xslider.value)/100*
    Math.max(0,viewport.scrollWidth-viewport.clientWidth);});
  window.addEventListener('pipeline-projects-rendered',()=>{if(open&&!publishingRows){sync();requestDraw();}});
  window.addEventListener('resize',()=>{if(open){lastStart=-1;draw(true);}},{passive:true});
  document.addEventListener('keydown',event=>{
    if(event.key==='Escape'&&open){event.preventDefault();event.stopImmediatePropagation();close();}
  },true);
  const distance=touches=>Math.hypot(touches[0].clientX-touches[1].clientX,
    touches[0].clientY-touches[1].clientY);
  viewport.addEventListener('touchstart',event=>{
    if(event.touches.length===2)gesture={distance:distance(event.touches),zoom};
  },{passive:true});
  viewport.addEventListener('touchmove',event=>{
    if(event.touches.length!==2||!gesture)return;
    if(event.cancelable)event.preventDefault();
    zoomTo(gesture.zoom*distance(event.touches)/Math.max(1,gesture.distance));
  },{passive:false});
  viewport.addEventListener('touchend',event=>{if(event.touches.length<2)gesture=null;},{passive:true});
  window.addEventListener('pagehide',()=>{if(open)close();});
})();

Renewable Energy Planning Database (REPD) Liquid

A style sheet in the styles folder of GlobalGrid2050.

energy-dataglobalgrid2050 / uk_renewables_pipeline/202611221243/styles/repd-liquid.css · lines 1–185 of 185 · version 2026-11-22 12:43 · Not reached from any entry point (candidate for review)

What it does
Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'renewables'): 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.
What it achieves
V9.63 individual A4/PDF remains unchanged.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · uk_renewables_pipeline/202611221243/styles · style sheet
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 uk_renewables_pipeline/202611221243/styles/repd-liquid.css:1-185 · blob e60d2a72448b24c962fbb9dd4fab7e74d82ad9f0 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
/* V9.64: A3/A4 liquid HTML overview. V9.63 individual A4/PDF remains unchanged. */
#pnScanToolbar #pnLiquidLaunch{
  flex:0 0 auto!important;min-height:34px!important;padding:5px 10px!important;
  background:#123039!important;color:#c4ffff!important;border:1px solid #6caeb4!important;
  border-radius:3px;font:700 11px/1.2 'Courier New',monospace!important;cursor:pointer;
}
#pnLiquidOverview[hidden]{display:none!important}
#pnLiquidOverview{
  position:fixed!important;inset:0!important;z-index:2147483400!important;
  box-sizing:border-box;width:100%;max-width:none;height:100vh;height:100dvh;
  background:#061017;color:#dbeef2;display:flex;flex-direction:column;overflow:hidden;
  font:12px/1.3 system-ui,-apple-system,sans-serif;isolation:isolate;
}
#pnLiquidOverview .pn-liquid-controls,
#pnLiquidOverview .pn-liquid-filters,
#pnLiquidOverview .pn-liquid-bottom{
  box-sizing:border-box;display:flex;flex:0 0 auto;align-items:center;gap:7px;
  padding:6px 10px;background:#061017;border-bottom:1px solid #35505e;
}
#pnLiquidOverview .pn-liquid-controls{
  overflow-x:auto;white-space:nowrap;min-height:46px;
  padding-top:max(6px,env(safe-area-inset-top));
}
#pnLiquidOverview .pn-liquid-controls strong{
  letter-spacing:.6px;font:700 12px/1.2 'Courier New',monospace;
}
#pnLiquidOverview :is(button,select,input){
  box-sizing:border-box;border:1px solid #45616d;border-radius:3px;
  background:#101e26;color:#eaf5f7;font:12px/1.3 system-ui,sans-serif;
}
#pnLiquidOverview button{
  flex:0 0 auto;min-height:31px;padding:5px 9px;cursor:pointer;
}
#pnLiquidOverview :is(button,select,input):focus-visible{
  outline:2px solid #50ebed;outline-offset:2px;
}
#pnLiquidOverview .pn-liquid-controls select{
  flex:0 0 auto;min-height:33px;max-width:175px;
}
#pnLiquidOverview #pnLiquidZoom{
  min-width:38px;text-align:center;font-variant-numeric:tabular-nums;color:#85d9e8;
}
#pnLiquidOverview .pn-liquid-filters{
  flex-wrap:wrap;row-gap:5px;padding:7px 10px;background:#0b1c23;min-height:42px;
}
#pnLiquidOverview .pn-liquid-filters label{
  display:flex;flex:0 1 auto;align-items:center;gap:5px;
  font:700 10px/1.2 'Courier New',monospace;color:#a3bdc6;
}
#pnLiquidOverview .pn-liquid-filters input{
  width:min(26vw,235px);min-width:90px;height:33px;padding:4px 7px;
}
#pnLiquidOverview .pn-liquid-filters select{
  max-width:150px;height:33px;padding:4px;
}
#pnLiquidOverview #pnLiquidCount{
  font:11px/1.2 system-ui,sans-serif;color:#9bdadf;white-space:nowrap;
}
#pnLiquidViewport{
  flex:1 1 auto;min-height:0;box-sizing:border-box;position:relative;
  overflow:auto!important;-webkit-overflow-scrolling:touch;
  touch-action:pan-x pan-y;overscroll-behavior:contain;
  padding:12px 10px 28px;background:#1a272c;scrollbar-width:auto;
}
#pnLiquidSheet{
  --pn-liquid-sheet-width:1587px;--pn-liquid-row-height:40px;
  --pn-liquid-head-height:43px;--pn-liquid-font:12px;
  width:var(--pn-liquid-sheet-width)!important;max-width:none!important;
  min-height:100%;box-sizing:border-box;background:#f2f5f6;color:#1c303b;
  box-shadow:0 5px 27px #0007;padding:0 8px 12px;overflow:visible;
}
#pnLiquidOverview .pn-liquid-masthead{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  height:38px;box-sizing:border-box;padding:0 10px;
  background:#e2eaed;color:#233d49;border-bottom:2px solid #416979;
  font:700 11px/1.2 'Courier New',monospace;
}
#pnLiquidTable{
  display:table!important;width:100%!important;min-width:0!important;
  max-width:none!important;table-layout:fixed!important;
  border-collapse:separate!important;border-spacing:0!important;
  color:#19303c;background:#fff;margin:0!important;padding:0!important;
  font:var(--pn-liquid-font)/1.25 Arial,Helvetica,sans-serif;
}
#pnLiquidTable :is(thead,tbody,tr){display:revert!important}
#pnLiquidTable :is(th,td){
  box-sizing:border-box!important;display:table-cell!important;
  border:0!important;border-bottom:1px solid #d4dde1!important;
  border-right:1px solid #e2e8eb!important;
  padding:4px 6px!important;max-width:0!important;
  white-space:nowrap!important;overflow:hidden!important;
  text-overflow:ellipsis!important;vertical-align:middle!important;
  color:inherit!important;text-align:left!important;background:inherit!important;
}
#pnLiquidTable thead{background:#d7e2e6!important}
#pnLiquidTable thead th{
  height:var(--pn-liquid-head-height)!important;position:sticky!important;
  top:0!important;z-index:5!important;background:#d7e2e6!important;
  border-bottom:2px solid #3c6c7c!important;
}
#pnLiquidTable thead th button{
  display:flex!important;align-items:center;justify-content:space-between;
  gap:3px;width:100%;max-width:100%;height:100%;min-height:28px;
  border:0!important;background:transparent!important;color:#234252!important;
  padding:2px 1px!important;margin:0!important;
  font:700 10px/1.2 Arial,sans-serif!important;
  overflow:hidden;white-space:normal;text-align:left;
}
#pnLiquidTable th[aria-sort="ascending"] button,
#pnLiquidTable th[aria-sort="descending"] button{color:#00647e!important}
#pnLiquidTable thead th:first-child{
  position:sticky!important;left:0!important;z-index:8!important;
}
#pnLiquidTable .pn-liquid-project{
  height:var(--pn-liquid-row-height)!important;max-height:var(--pn-liquid-row-height)!important;
  background:#fff!important;
}
#pnLiquidTable .pn-liquid-project:nth-child(even){background:#f0f5f7!important}
#pnLiquidTable .pn-liquid-project td{
  height:var(--pn-liquid-row-height)!important;
  max-height:var(--pn-liquid-row-height)!important;line-height:1.2!important;
}
#pnLiquidTable .pn-liquid-project td:first-child{
  position:sticky!important;left:0!important;z-index:3!important;
  font-weight:700!important;background:#fff!important;box-shadow:1px 0 3px #9eabb08c;
}
#pnLiquidTable .pn-liquid-project:nth-child(even) td:first-child{
  background:#f0f5f7!important;
}
#pnLiquidTable .pn-liquid-row-no{
  color:#6b8087;font-size:.83em;margin-right:2px;font-weight:400;
}
#pnLiquidTable .pn-liquid-gap{background:#fff!important}
#pnLiquidTable .pn-liquid-gap td{
  height:auto!important;max-height:none!important;padding:0!important;
  border:none!important;line-height:0!important;overflow:hidden!important;
  position:static!important;box-shadow:none!important;
}
#pnLiquidTable .pn-liquid-gap div{
  display:block;width:1px;min-height:0;padding:0!important;margin:0!important;
}
#pnLiquidTable :is(.pn-liquid-map,.pn-liquid-note){
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  height:calc(var(--pn-liquid-row-height) - 10px)!important;
  min-height:0!important;max-height:32px!important;max-width:100%;
  padding:2px 4px!important;border:1px solid #7ca5b6!important;border-radius:2px!important;
  color:#005e77!important;background:#eef8f9!important;
  text-decoration:underline!important;
  font:700 .94em/1.1 'Courier New',monospace!important;
  cursor:pointer;white-space:nowrap;
}
#pnLiquidTable .pn-liquid-map-unavailable{
  color:#7e858a;font:9px/1 Arial,sans-serif;
}
#pnLiquidOverview .pn-liquid-bottom{
  min-height:43px;border-top:1px solid #35505e;border-bottom:0;
  padding-bottom:max(6px,env(safe-area-inset-bottom));
}
#pnLiquidOverview .pn-liquid-bottom label{
  font:700 10px 'Courier New',monospace;color:#a6cbd2;white-space:nowrap;
}
#pnLiquidOverview #pnLiquidX{
  flex:1 1 auto;min-width:60px;max-width:none;
  border:0;background:transparent;accent-color:#71dbe0;height:28px;
}
#pnLiquidOverview .pn-liquid-bottom span{
  flex:0 0 auto;color:#9caeb7;font:10px/1.2 Arial,sans-serif;
}
@media(max-width:700px){
  #pnLiquidOverview .pn-liquid-filters{gap:5px;padding:5px 7px}
  #pnLiquidOverview .pn-liquid-filters input{width:115px}
  #pnLiquidOverview .pn-liquid-filters select{max-width:100px}
  #pnLiquidOverview #pnLiquidCount{width:100%}
  #pnLiquidOverview .pn-liquid-controls{gap:5px;padding-left:7px;padding-right:7px}
  #pnLiquidOverview .pn-liquid-controls strong{font-size:10px}
  #pnLiquidOverview .pn-liquid-bottom span{display:none}
}
@media(prefers-reduced-motion:reduce){
  #pnLiquidOverview *{scroll-behavior:auto!important}
}

/* Recycled virtual rows must never re-anchor the user's thumb scroll position. */
#pnLiquidViewport,#pnLiquidSheet,#pnLiquidTable,#pnLiquidTable tbody{
  overflow-anchor:none!important;
}

Renewable Energy Planning Database (REPD) Liquid

A JavaScript module in the tests folder of GlobalGrid2050 that tests the REPD register.

testglobalgrid2050 / uk_renewables_pipeline/202611221243/tests/repd-liquid.mjs · lines 1–138 of 138 · version 2026-11-22 12:43 · Entry point

What it does
It tests the REPD register. Uses libraries node:assert/strict, node:fs/promises, playwright. Side effects: changes the web page (DOM); reads or writes files.
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'renewables'): 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.
Downstream impact
Used directly by 1 file: GlobalGrid2050 Pn V964 Liquid Overview Workflow (globalgrid2050).
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
Run by GlobalGrid2050 Pn V964 Liquid Overview Workflow.
Application
globalgrid2050 · uk_renewables_pipeline/202611221243/tests · JavaScript module
Uses
node:assert/strict, node:fs/promises, playwright, ./scripts/core/state.js, ./scripts/plugins/projects-v9-8.js
Used by
run by GlobalGrid2050 Pn V964 Liquid Overview Workflow (workflow run)
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 uk_renewables_pipeline/202611221243/tests/repd-liquid.mjs:1-138 · blob e1cb6d7f215468c313debe75523111b6d98084ba · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
import assert from 'node:assert/strict';
import {mkdir} from 'node:fs/promises';
import {chromium,webkit} from 'playwright';
const url='http://127.0.0.1:8765/uk_renewables_pipeline/202611221243/';
const out='/tmp/pn-v964-liquid';
await mkdir(out,{recursive:true});
for(const [engine,driver] of [['chromium',chromium],['webkit',webkit]]){
 const browser=await driver.launch({headless:true});
 try{
  for(const size of [{label:'portrait',width:393,height:852},{label:'landscape',width:852,height:393}]){
   const page=await browser.newPage({viewport:{width:size.width,height:size.height},reducedMotion:'reduce'});
   const errors=[];page.on('pageerror',error=>errors.push(error.message));
   try{
    await page.route('https://raw.githubusercontent.com/**',route=>route.abort());
    await page.goto(url,{waitUntil:'domcontentloaded',timeout:60000});
    await page.waitForFunction(()=>document.querySelectorAll('#tbody tr[id^="repd-"]').length===50 &&
      document.querySelectorAll('#tbody .pn-report-launch').length===50 &&
      !!document.getElementById('pnLiquidLaunch'),null,{timeout:90000});
    await page.locator('#pnLiquidLaunch').click();
    await page.waitForSelector('#pnLiquidOverview:not([hidden])');
    const initial=await page.evaluate(async()=>{
      const {state}=await import('./scripts/core/state.js');
      const {atlasUrlV9_5_1}=await import('./scripts/plugins/projects-v9-8.js');
      const wrap=document.getElementById('pnLiquidViewport');
      const body=document.getElementById('pnLiquidBody');
      const project=state.filtered[0];
      return {count:state.filtered.length,all:state.all.length,
        first:project.repd_ref,name:project.name,
        map:atlasUrlV9_5_1(project),rendered:Number(body.dataset.rendered),
        width:document.getElementById('pnLiquidSheet').getBoundingClientRect().width,
        pageWidth:wrap.clientWidth,scrollWidth:wrap.scrollWidth};
    });
    assert.ok(initial.count>50&&initial.all>=initial.count,JSON.stringify(initial));
    assert.ok(initial.rendered>0&&initial.rendered<100,JSON.stringify(initial));
    assert.ok(initial.width>1500&&initial.scrollWidth>initial.pageWidth);
    assert.equal(await page.locator('#pnLiquidTable thead th').count(),13);
    assert.equal(await page.locator('#pnLiquidBody tr.pn-liquid-project').first().getAttribute('data-overview-ref'),initial.first);
    assert.ok((await page.locator('#pnLiquidBody tr.pn-liquid-project').first().textContent()).includes(initial.name));
    if(initial.map){
      assert.equal(await page.locator('#pnLiquidBody tr.pn-liquid-project').first().locator('a.pn-liquid-map').getAttribute('href'),initial.map);
    }
    await page.locator('#pnLiquidBody tr.pn-liquid-project').first().locator('.pn-liquid-note').click();
    await page.waitForSelector('dialog.machine-note-dialog[open]',{timeout:10000});
    assert.ok((await page.locator('#machineNoteBody').textContent()).includes(initial.first));
    await page.locator('.machine-note-close').click();
    await page.locator('[data-liquid-sort="name"]').click();
    await page.waitForFunction(()=>new URLSearchParams(location.search).get('sort')==='name_asc');
    const sorted=await page.evaluate(async()=>{
      const {state}=await import('./scripts/core/state.js');
      return {first:state.filtered[0].repd_ref,name:state.filtered[0].name,last:state.filtered.at(-1).repd_ref};
    });
    assert.equal(await page.locator('#pnLiquidBody tr.pn-liquid-project').first().getAttribute('data-overview-ref'),sorted.first);
    console.log('DEBUG before full scroll',JSON.stringify(await page.evaluate(async()=>{
      const {state}=await import('./scripts/core/state.js');
      const w=document.getElementById('pnLiquidViewport'),b=document.getElementById('pnLiquidBody');
      const last=b.lastElementChild;
      return {n:state.filtered.length,all:state.all.length,
        search:document.getElementById('search')?.value,status:document.getElementById('pnScanStatus')?.value,
        tech:[...document.querySelectorAll('#tech [data-technology]')].filter(x=>x.getAttribute('aria-pressed')==='true').map(x=>x.dataset.technology),
        scrollTop:w.scrollTop,scrollHeight:w.scrollHeight,clientHeight:w.clientHeight,
        bodyHeight:b.getBoundingClientRect().height,lastHeight:last?.getBoundingClientRect().height,
        lastDivHeight:last?.querySelector('div')?.getBoundingClientRect().height,
        rendered:b.dataset.rendered,start:b.dataset.start,end:b.dataset.end,
        url:location.href};
    })));
    // Scroll the complete canonical filtered source, not merely its original first 50 rows.
    await page.locator('#pnLiquidViewport').evaluate(el=>{el.scrollTop=el.scrollHeight;});
    await page.waitForFunction(async()=>{
      const {state}=await import('./scripts/core/state.js');
      const list=[...document.querySelectorAll('#pnLiquidBody tr.pn-liquid-project')];
      return Number(document.getElementById('pnLiquidBody').dataset.start)>0 && list.length&&
        list.at(-1).dataset.overviewRef===state.filtered.at(-1).repd_ref;
    },null,{timeout:30000});
    console.log('DEBUG after full scroll',JSON.stringify(await page.evaluate(async()=>{
      const {state}=await import('./scripts/core/state.js');
      const w=document.getElementById('pnLiquidViewport'),b=document.getElementById('pnLiquidBody');
      return {n:state.filtered.length,scrollTop:w.scrollTop,scrollHeight:w.scrollHeight,
        clientHeight:w.clientHeight,rendered:b.dataset.rendered,start:b.dataset.start,end:b.dataset.end};
    })));
    await page.waitForTimeout(120); // assert rows remain at the destination after rendering settles
    const atEnd=await page.locator('#pnLiquidBody').evaluate(el=>({
      shown:Number(el.dataset.rendered),from:Number(el.dataset.start),to:Number(el.dataset.end)
    }));
    assert.ok(atEnd.from>0&&atEnd.shown<100,JSON.stringify(atEnd));
    assert.equal(await page.locator('#tbody tr[id^="repd-"]').count(),50);
    // The overview can also expose the complete official REPD universe, not only Solar.
    const types=await page.locator('#pnLiquidTech option').evaluateAll(options=>options.map(o=>o.value));
    assert.ok(types.includes('all'),JSON.stringify(types));
    await page.locator('#pnLiquidTech').selectOption('all');
    await page.waitForFunction(async()=>{
      const {state}=await import('./scripts/core/state.js');
      return document.getElementById('pnLiquidBody').dataset.total===String(state.all.length);
    });
    assert.equal(await page.locator('#pnLiquidBody').getAttribute('data-total'),String(initial.all));
    // A4/A3 are live HTML widths, not a screenshot or a generated PDF.
    await page.locator('#pnLiquidFormat').selectOption('a4');
    const a4=await page.locator('#pnLiquidSheet').evaluate(el=>el.getBoundingClientRect().width);
    assert.ok(a4>1120&&a4<1127,a4);
    await page.locator('[data-liquid-action="plus"]').click();
    assert.notEqual(await page.locator('#pnLiquidZoom').textContent(),'100%');
    await page.locator('[data-liquid-action="fit"]').click();
    const fit=await page.locator('#pnLiquidSheet').evaluate(el=>el.getBoundingClientRect().width);
    assert.ok(fit<=a4,JSON.stringify({fit,a4}));
    await page.locator('#pnLiquidFormat').selectOption('a3');
    await page.locator('#pnLiquidX').evaluate(input=>{input.value='100';input.dispatchEvent(new Event('input',{bubbles:true}));});
    const x=await page.locator('#pnLiquidViewport').evaluate(el=>el.scrollLeft);
    assert.ok(x>0,JSON.stringify({x}));
    // User text search delegates to original #search and canonical filtered data.
    await page.locator('#pnLiquidSearch').fill(sorted.name);
    await page.waitForFunction(()=>document.querySelector('#pnLiquidBody').dataset.total===
      document.getElementById('resultsMeta').dataset.filteredCount);
    const searched=await page.evaluate(async()=>{
      const {state}=await import('./scripts/core/state.js');
      return state.filtered.length;
    });
    assert.ok(searched>=1&&searched<=initial.count);
    await page.locator('[data-liquid-action="clear"]').click();
    await page.waitForFunction(()=>document.getElementById('search').value==='');
    assert.equal(await page.locator('#pnLiquidBody').getAttribute('data-total'),String(initial.all));
    await page.screenshot({path:out+'/'+engine+'-'+size.label+'.png'});
    await page.keyboard.press('Escape');
    assert.ok(await page.locator('#pnLiquidOverview').isHidden());
    assert.equal(await page.locator('#tbody tr[id^="repd-"]').count(),50);
    assert.equal(await page.locator('#tbody .pn-report-launch').count(),50);
    // Older individual-project A4 must still work as before, including PDF option.
    await page.locator('#tbody .pn-report-launch').first().click();
    await page.waitForSelector('#pnRepdReport:not([hidden])');
    assert.equal(await page.locator('[data-report-action="pdf"]').count(),1);
    assert.ok((await page.locator('#pnReportMap').isVisible())||(await page.locator('#pnReportNoMap').isVisible()));
    await page.locator('[data-report-action="close"]').click();
    assert.ok(await page.locator('#pnRepdReport').isHidden());
    assert.deepEqual(errors,[]);
    console.log('PASS',engine,size.label,JSON.stringify({all:initial.count,virtual:initial.rendered,
      end:atEnd.to,map:!!initial.map,originalA4:true}));
   }finally{await page.close();}
  }
 }finally{await browser.close();}
}