// ─────────── data ─────────── const ART = { 'css-grid-lanes':'note', 'spool':'code', 'ferrotype':'code', 'building-ui-in-gpui':'code', 'the-black-magic-of-canvas-and-text-editing':'note', 'fig-gen-making-generative-art-in-figma':'image', 'writing-with-adhd':'prose', 'design-workshop':'image' }; const KL = { code:'SOURCE', image:'FIGURES', prose:'LONGFORM', note:'NOTE' }; let POSTS = []; const esc = s => s.replace(/[&<>"]/g,c=>({'&':'&','<':'<','>':'>','"':'"'}[c])); const pad = (n,l=2) => String(n).padStart(l,'0'); const iso = d => d.replace(/-/g,'.'); function stats(p){ const d=document.createElement('div');d.innerHTML=p.html; const pres=[...d.querySelectorAll('pre')]; const codeLines=pres.reduce((n,x)=>n+x.querySelectorAll('.line').length,0); pres.forEach(x=>x.remove()); return { words:(d.textContent.match(/\S+/g)||[]).length, codeLines, blocks:pres.length, imgs:d.querySelectorAll('img').length, links:d.querySelectorAll('a').length, h2:d.querySelectorAll('h2').length }; } function kindOf(p){ return ART[p.slug] || (p.s.imgs>=4?'image':p.s.codeLines>=30?'code':p.s.words<320?'note':'prose'); } // ─────────── rulers + crosshair ─────────── const rx=document.getElementById('rx'), ry=document.getElementById('ry'); function buildRulers(){ rx.querySelectorAll('span').forEach(s=>s.remove()); ry.querySelectorAll('span').forEach(s=>s.remove()); for(let x=0;x{ xhv.style.left=e.clientX+'px'; xhh.style.top=e.clientY+'px'; mkx.style.left=(e.clientX-24)+'px'; mky.style.top=(e.clientY-24)+'px'; xr.textContent=`X ${pad(Math.round(e.clientX-24),4)} · Y ${pad(Math.round(e.clientY-24+scrollY),5)}`; xr.style.left=(e.clientX+12)+'px'; xr.style.top=(e.clientY+12)+'px'; }); // ─────────── dimension helper ─────────── function dimension(wrap, el){ wrap.querySelectorAll('.dim-h,.dim-v,.guide').forEach(n=>n.remove()); const r=el.getBoundingClientRect(); const h=document.createElement('div');h.className='dim-h';h.innerHTML=`${Math.round(r.width)} PX`; const v=document.createElement('div');v.className='dim-v';v.style.top='0';v.style.height=r.height+'px';v.innerHTML=`${Math.round(r.height)}`; wrap.append(h,v); const lh=parseFloat(getComputedStyle(el).lineHeight), fs=parseFloat(getComputedStyle(el).fontSize); const lines=Math.max(1,Math.round(r.height/lh)); const g1=document.createElement('div');g1.className='guide';g1.style.top=(lh*.5-fs*.36)+'px';g1.innerHTML='CAP'; const g2=document.createElement('div');g2.className='guide';g2.style.top=((lines-1)*lh+lh*.5+fs*.36)+'px';g2.innerHTML='BASE'; wrap.append(g1,g2); } // ─────────── index ─────────── const app=document.getElementById('app'); let raf=0; function renderIndex(){ document.title='nate.rip — spec sheet'; const latest=POSTS[0].date; app.innerHTML=`
DRAWINGNATE.RIP
SHEET00 / ${pad(POSTS.length)} — INDEX
AUTHORN. BUTLER
SCALE1 : 1
REV${iso(latest)}
UNITSPX · WORDS · LN

nate.rip

Nate Butler — notes on design tools, Rust, canvases and type systems. Every entry below is plotted, measured and tabulated. Hover anything.

FIG. 00 — ENTRIES WITHIN 12 YEARS OF NOW · ▲ WORDS · ▼ CODE LINES
${['code','image','prose','note'].map(k=>`${KL[k]}`).join('')}
1 YEAR (LOG)
NO.TITLETYPEDATEWORDSCODEFIGDENSITY
${POSTS.map((p,i)=>{ const on=Math.round(Math.min(1,p.s.words/1900)*16); return `${pad(i+1)}${esc(p.title)}${KL[p.k]}${iso(p.date)}${p.s.words}${p.s.codeLines||'—'}${p.s.imgs||'—'}${Array.from({length:16},(_,j)=>``).join('')}`}).join('')}
DRAWN IN HTML · NOT TO SCALE© ${new Date().getFullYear()} NATE BUTLERSHEET 00
`; document.fonts.ready.then(()=>dimension(document.getElementById('hw'),document.getElementById('ht'))); buildPlot(); app.querySelectorAll('.table a').forEach(a=>{ a.addEventListener('pointerenter',()=>hot(+a.dataset.i)); a.addEventListener('pointerleave',()=>hot(-1)); }); } let HOT=-1, plotState=null; function hot(i){ HOT=i; document.querySelectorAll('#plot g.p').forEach((g,j)=>g.classList.toggle('hot',j===i)); const c=document.getElementById('callout'); if(!c) return; if(i<0){c.classList.remove('on');return;} const p=POSTS[i]; c.className='callout on k-'+p.k; c.innerHTML=`${KL[p.k]} · Nº ${pad(i+1)}

${esc(p.title)}

DATE
${iso(p.date)}
WORDS
${p.s.words}
CODE LINES
${p.s.codeLines}
FIGURES
${p.s.imgs}
LINKS
${p.s.links}
READ
${Math.max(1,Math.round(p.s.words/230))} MIN
`; } function buildPlot(){ cancelAnimationFrame(raf); const svg=document.getElementById('plot'); const NS='http://www.w3.org/2000/svg'; const now=new Date(); const ages=POSTS.map(p=>(now-new Date(p.date))/31557600000); const rOf=a=>Math.log(1+a)/Math.log(1+12); const mk=(t,a,parent=svg)=>{const e=document.createElementNS(NS,t);for(const k in a)e.setAttribute(k,a[k]);parent.appendChild(e);return e;}; svg.innerHTML=''; const rings=[1,2,5,10].map(a=>({a,el:mk('polyline',{class:'ring'}),lab:mk('text',{class:'ylab'})})); const spokes=[0,1,2,3].map(()=>mk('line',{class:'spoke'})); const nowDot=mk('circle',{class:'now',r:4}), nowL=mk('text',{class:'nowl'});nowL.textContent='NOW'; const pts=POSTS.map((p,i)=>{ const g=mk('g',{class:'p k-'+p.k}); const drop=mk('line',{class:'drop'},g), stem=mk('line',{class:'stem'},g), base=mk('ellipse',{class:'base',rx:5,ry:2},g); const star=mk('circle',{class:'star',r:3.5},g), bot=mk('circle',{class:'star',r:2.2},g); const lbg=mk('rect',{class:'lbg',height:30},g); const tl=mk('text',{class:'tl'},g); tl.textContent=p.title.length>28?p.title.slice(0,26)+'…':p.title; const dl=mk('text',{class:'dl'},g); dl.textContent=iso(p.date)+' · '+p.s.words+'W'; g.addEventListener('pointerenter',()=>hot(i)); g.addEventListener('pointerleave',()=>hot(-1)); g.addEventListener('click',()=>location.hash=p.slug); return {g,drop,stem,base,star,bot,lbg,tl,dl,r:rOf(ages[i]),th:i*2.399+.6,h:Math.sqrt(p.s.words/1900),d:Math.sqrt(p.s.codeLines/100)}; }); let mx=0; svg.addEventListener('pointermove',e=>{const b=svg.getBoundingClientRect();mx=(e.clientX-b.left)/b.width-.5;}); let yaw=0,t0=performance.now(); function frame(t){ const W=svg.clientWidth,H=svg.clientHeight; if(!W){raf=requestAnimationFrame(frame);return;} const cx=W/2, cy=H*.6, R=Math.min(W*.44,H*1.1), tilt=.26, HH=H*.27; yaw+=((t-t0)/1000*.03+mx*1.2-yaw)*.04; const P=(r,th)=>[cx+Math.cos(th+yaw)*r*R, cy+Math.sin(th+yaw)*r*R*tilt]; rings.forEach(o=>{const r=rOf(o.a);let s='';for(let k=0;k<=96;k++){const[x,y]=P(r,k/96*Math.PI*2);s+=x.toFixed(1)+','+y.toFixed(1)+' ';}o.el.setAttribute('points',s); const[lx,ly]=P(r,Math.PI-yaw);o.lab.setAttribute('x',lx-4);o.lab.setAttribute('y',ly-6);o.lab.setAttribute('text-anchor','end');o.lab.textContent=`${o.a}Y`;}); spokes.forEach((l,k)=>{const[a,b]=P(1.02,k*Math.PI/2),[c,d]=P(1.02,k*Math.PI/2+Math.PI);l.setAttribute('x1',a);l.setAttribute('y1',b);l.setAttribute('x2',c);l.setAttribute('y2',d);}); nowDot.setAttribute('cx',cx);nowDot.setAttribute('cy',cy);nowL.setAttribute('x',cx+8);nowL.setAttribute('y',cy-6); // depth sort const order=pts.map((o,i)=>[Math.sin(o.th+yaw),i]).sort((a,b)=>a[0]-b[0]); order.forEach(([,i])=>svg.appendChild(pts[i].g)); pts.forEach(o=>{ const[x,y]=P(o.r,o.th); const top=y-o.h*HH-20, bot=y+o.d*HH*.5; o.stem.setAttribute('x1',x);o.stem.setAttribute('y1',y);o.stem.setAttribute('x2',x);o.stem.setAttribute('y2',top); o.drop.setAttribute('x1',x);o.drop.setAttribute('y1',y);o.drop.setAttribute('x2',x);o.drop.setAttribute('y2',bot); o.drop.style.display=o.d?'':'none';o.bot.style.display=o.d?'':'none'; o.base.setAttribute('cx',x);o.base.setAttribute('cy',y); o.star.setAttribute('cx',x);o.star.setAttribute('cy',top); o.bot.setAttribute('cx',x);o.bot.setAttribute('cy',bot); o.tl.setAttribute('x',x+7);o.tl.setAttribute('y',top-14);o.dl.setAttribute('x',x+7);o.dl.setAttribute('y',top-1); const w=Math.max(o.tl.getComputedTextLength?o.tl.getComputedTextLength():120,100)+10; o.lbg.setAttribute('x',x+3);o.lbg.setAttribute('y',top-28);o.lbg.setAttribute('width',w); }); raf=requestAnimationFrame(frame); } raf=requestAnimationFrame(frame); } // ─────────── post ─────────── let cleanup=[]; function on(t,ev,fn,o){t.addEventListener(ev,fn,o);cleanup.push(()=>t.removeEventListener(ev,fn,o));} function renderPost(p){ cancelAnimationFrame(raf); const i=POSTS.indexOf(p), prev=POSTS[i+1], next=POSTS[i-1]; document.title=p.title+' — nate.rip'; const fs=Math.max(72,Math.min(125,132-p.title.length*1.5)); app.innerHTML=` ← SHEET 00
SHEET${pad(i+1)} / ${pad(POSTS.length)}
TYPE${KL[p.k]}
DATE${iso(p.date)}
WORDS${p.s.words}
CODE${p.s.codeLines?p.s.codeLines+' LN / '+p.s.blocks+' BLK':'—'}
FIGURES${p.s.imgs||'—'}

${esc(p.title)}

${KL[p.k]}${Math.max(1,Math.round(p.s.words/230))} MIN READ · WIDTH ${fs.toFixed(0)}% · ARCHIVO ${p.k==='code'?'+ JETBRAINS MONO':''}
${p.html}
`; const body=document.getElementById('body'); build(body,p); document.fonts.ready.then(()=>{dimension(document.getElementById('tw'),document.getElementById('tt'));annotate(body,p);}); body.querySelectorAll('img').forEach(im=>on(im,'load',()=>annotate(body,p))); on(window,'resize',()=>{dimension(document.getElementById('tw'),document.getElementById('tt'));annotate(body,p);}); on(window,'scroll',()=>track(body,p),{passive:true}); setTimeout(()=>track(body,p),50); } function build(body,p){ const h1=body.querySelector('h1');if(h1&&h1.textContent.trim().toLowerCase()===p.title.toLowerCase())h1.remove(); body.querySelectorAll('a[href^="http"]').forEach(a=>{a.target='_blank';a.rel='noopener'}); // link-list note → schematic const strongLinks=body.querySelectorAll('p > a > strong').length; if(p.k==='note' && strongLinks>=4) schematic(body); // sections let n=0; body.querySelectorAll('h2').forEach(h=>{h.dataset.n='§'+pad(++n);h.id=h.id||'s'+n;}); // code figures let c=0; body.querySelectorAll('pre').forEach(pre=>{ c++; const txt=pre.textContent, ln=pre.querySelectorAll('.line').length; const lang=/#\[|fn |let |impl |struct |::|pub /.test(txt)?'RUST':/^\s*(cargo|spool|npm|git)\b/m.test(txt)?'SHELL':/display\s*:|grid-/.test(txt)?'CSS':/type |interface /.test(txt)?'TYPESCRIPT':'TEXT'; const f=document.createElement('figure');f.className='fig-code';f.dataset.lang=lang;f.dataset.ln=ln;f.dataset.no='C-'+pad(c); f.innerHTML=`
FIG. C-${pad(c)}${lang}${ln} LN · ${txt.length} CH
`; pre.replaceWith(f); f.insertBefore(pre,f.children[1]); }); // images let m=0; body.querySelectorAll('img').forEach(img=>{ m++; const host=img.closest('p')||img; const f=document.createElement('figure');f.className='fig-img';f.dataset.no=pad(m); f.innerHTML=`
— PX
FIG. ${pad(m)} ${esc(img.alt||'UNTITLED')}— × —
`; img.loading='lazy'; f.querySelector('.frame').appendChild(img); host.replaceWith(f); }); // live grid-lanes mosaic if(p.slug==='css-grid-lanes'){ const fc=body.querySelector('.fig-code'); const fig=document.createElement('figure');fig.className='mosaic-fig'; const spans=['','h2','w2','','h3','','w2 h2','','h2','','','w2','h2','','']; fig.innerHTML=`
${spans.map((s,i)=>`
${pad(i+1)} ${s?'· '+s.replace(/w2/,'SPAN-C 2').replace(/h(\d)/,'SPAN-R $1'):''}
`).join('')}
FIG. L-01 — .mosaic, LIVE IN THIS PAGE${CSS.supports('display','grid-lanes')?'GRID-LANES ✓':'FALLBACK: GRID + DENSE'}
`; fc&&fc.after(fig); } // measure line on the first paragraph const fp=body.querySelector(':scope > p'); if(fp){const ms=document.createElement('div');ms.className='measure';ms.innerHTML='MEASURE';fp.before(ms);} // toc const toc=document.getElementById('toc'); const hs=[...body.querySelectorAll('h2')]; toc.innerHTML=hs.length?hs.map(h=>`
  • ${h.dataset.n}${esc(h.textContent)}
  • `).join(''):'
  • §01Single section
  • '; toc.querySelectorAll('li[data-id]').forEach(li=>li.onclick=()=>document.getElementById(li.dataset.id).scrollIntoView({behavior:'smooth',block:'start'})); // prose minimap if(p.k==='prose'){ const mm=document.createElement('div');mm.className='minimap'; const blocks=[...body.children].filter(e=>/^(P|H2|H3|UL)$/.test(e.tagName)); mm.innerHTML='
    PARAGRAPH MAP · WIDTH = WORDS
    '+blocks.map(b=>{ const w=(b.textContent.match(/\S+/g)||[]).length; return b.tagName==='H2'?'
    ':`
    `;}).join('')+'
    '; mm._blocks=blocks; document.getElementById('railx').appendChild(mm); } } function schematic(body){ // turn "link / description" pairs into a K.O.-style callout schematic const out=document.createElement('div');out.className='schem'; let grp=null, boxes=null, box=null, g=0, b=0; const kids=[...body.children]; const intro=[]; let started=false, tail=[]; kids.forEach(el=>{ if(el.tagName==='H2'){started=true;g++;grp=document.createElement('div');grp.className='grp';grp.innerHTML=`
    ${pad(g)}${esc(el.textContent)}
    `;out.appendChild(grp);boxes=null;box=null;return;} if(!started){intro.push(el);return;} if(el.tagName==='HR'){tail.push(el);started=false;return;} if(el.tagName==='H3'){const s=document.createElement('div');s.className='sub';s.textContent='└ '+el.textContent.toUpperCase();grp.appendChild(s);boxes=null;return;} if(el.tagName==='P'&&el.querySelector('a > strong')){ if(!boxes){boxes=document.createElement('div');boxes.className='boxes';grp.appendChild(boxes);} b++;box=document.createElement('div');box.className='box'; const links=[...el.querySelectorAll('a')]; const main=links.filter(a=>a.querySelector('strong')); const by=el.textContent.split(/\s[-–]\s/).slice(1).join(' ').trim(); box.innerHTML=`
    REF ${pad(g)}.${pad(b)}
    ${main.map(a=>`${esc(a.textContent)} ↗`).join(' & ')}
    ${by?`
    ${esc(by)}
    `:''}`; boxes.appendChild(box);return; } if(box){box.appendChild(el);return;} grp?grp.appendChild(el):intro.push(el); }); body.innerHTML=''; intro.forEach(e=>body.appendChild(e)); body.appendChild(out); tail.forEach(e=>body.appendChild(e)); // anything after hr const rest=kids.slice(kids.indexOf(tail[0])+1); if(tail.length) rest.forEach(e=>{e.classList.add('schem-foot');body.appendChild(e);}); } function annotate(body,p){ const notes=document.getElementById('notes'); if(!notes) return; notes.innerHTML=''; body.querySelectorAll('.section-dim').forEach(e=>e.remove()); const top0=body.getBoundingClientRect().top; const Y=el=>el.getBoundingClientRect().top-top0; // measure const ms=body.querySelector('.measure'), fp=ms&&ms.nextElementSibling; if(fp){const w=fp.getBoundingClientRect().width, fsz=parseFloat(getComputedStyle(fp).fontSize);ms.querySelector('span').textContent=`MEASURE ${Math.round(w)} PX · ~${Math.round(w/(fsz*.5))} CH · ${fsz}/${(parseFloat(getComputedStyle(fp).lineHeight)).toFixed(0)}`;} // section dimensions const hs=[...body.querySelectorAll('h2')]; hs.forEach((h,i)=>{ const a=Y(h), z=hs[i+1]?Y(hs[i+1])-30:body.offsetHeight; const d=document.createElement('div');d.className='section-dim';d.style.left='-22px';d.style.top=a+'px';d.style.height=(z-a)+'px'; let words=0,el=h.nextElementSibling;while(el&&el.tagName!=='H2'){words+=(el.textContent.match(/\S+/g)||[]).length;el=el.nextElementSibling;} d.innerHTML=`${h.dataset.n} · ${Math.round(z-a)} PX · ${words} W`;body.appendChild(d); }); // figure notes const add=(y,html,k)=>{const n=document.createElement('div');n.className='mnote';n.style.top=y+'px';n.style.setProperty('--k',k);n.innerHTML=html;notes.appendChild(n);}; let lastY=-999; body.querySelectorAll('.fig-code').forEach(f=>{let y=Math.max(Y(f),lastY+70);lastY=y;add(y,`FIG. ${f.dataset.no}${f.dataset.lang}
    ${f.dataset.ln} LINES
    ${Math.round(f.getBoundingClientRect().height)} PX TALL`,'var(--cyan)');}); body.querySelectorAll('.fig-img').forEach(f=>{ const img=f.querySelector('img'), w=Math.round(f.querySelector('.frame').getBoundingClientRect().width); f.querySelector('.wdim span').textContent=w+' PX'; if(img.naturalWidth){f.querySelector('.nat').textContent=`${img.naturalWidth} × ${img.naturalHeight} · ${(img.naturalWidth/img.naturalHeight).toFixed(2)}:1`;} if(p.k!=='image'){let y=Math.max(Y(f),lastY+70);lastY=y;add(y,`FIG. ${f.dataset.no}${esc(img.alt||'—')}
    ${img.naturalWidth||'—'} × ${img.naturalHeight||'—'}`,'var(--yel)');} }); if(p.k==='prose'||p.k==='note'){ body.querySelectorAll(':scope > h2').forEach(h=>{let y=Math.max(Y(h),lastY+60);lastY=y; let words=0,el=h.nextElementSibling,pc=0;while(el&&el.tagName!=='H2'){if(el.tagName==='P')pc++;words+=(el.textContent.match(/\S+/g)||[]).length;el=el.nextElementSibling;} add(y,`${h.dataset.n}${pc} PARAGRAPHS
    ${words} WORDS
    ≈ ${Math.max(1,Math.round(words/230*60))} SEC`,'var(--mag)');}); } } function track(body,p){ const r=body.getBoundingClientRect(), H=r.height, vh=innerHeight; const prog=Math.min(1,Math.max(0,(vh*.4-r.top)/H)); const pg=document.getElementById('prog'); if(!pg) return; pg.style.setProperty('--p',(prog*100)+'%'); const hs=[...body.querySelectorAll('h2')]; let cur=-1; hs.forEach((h,i)=>{if(h.getBoundingClientRect().topli.classList.toggle('on',i===cur||(hs.length===0))); document.getElementById('readout').innerHTML=`SCROLL Y ${pad(Math.round(scrollY),5)} / ${pad(Math.round(document.documentElement.scrollHeight-vh),5)} PX
    SECTION ${cur>=0?hs[cur].dataset.n:'§00'} · ELAPSED ${Math.round(prog*100)}%
    REMAINING ≈ ${Math.max(0,Math.round(p.s.words*(1-prog)/230))} MIN`; const mm=document.querySelector('.minimap'); if(mm){ const rows=[...mm.querySelectorAll('.row')], blocks=mm._blocks; let first=-1,last=-1; blocks.forEach((b,i)=>{const br=b.getBoundingClientRect();const vis=br.bottom>0&&br.top=0){const a=rows[first].offsetTop-3,z=rows[last].offsetTop+rows[last].offsetHeight+3;win.style.top=a+'px';win.style.height=(z-a)+'px';win.style.display='';}else win.style.display='none'; } } // ─────────── router ─────────── function route(){ cleanup.forEach(f=>f());cleanup=[]; const s=document.getElementById('scan');s.classList.remove('go');void s.offsetWidth;s.classList.add('go'); const slug=decodeURIComponent(location.hash.slice(1)); const p=POSTS.find(x=>x.slug===slug); p?renderPost(p):renderIndex(); scrollTo(0,0); } fetch('../content/posts.json').then(r=>r.json()).then(list=>{ POSTS=list.map(p=>{p.s=stats(p);p.k=kindOf(p);return p;}); addEventListener('hashchange',route); route(); });