big-threads.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width,initial-scale=1" />
  6. <title>Mono — Thread Triptych, Interactive</title>
  7. <link rel="preconnect" href="https://fonts.googleapis.com">
  8. <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
  9. <style>
  10. :root{--bg:#F0EFEB;--dark:#1C1C1A;--paper:#F0EFEB}
  11. *{margin:0;padding:0;box-sizing:border-box}
  12. body{background:var(--bg);font-family:'Inter',sans-serif;padding:40px;-webkit-font-smoothing:antialiased;
  13. display:flex;justify-content:center}
  14. .card{background:var(--dark);color:var(--paper);border-radius:24px;padding:34px 34px 24px;
  15. width:min(1200px,100%)}
  16. h2{font-weight:700;font-size:19px;letter-spacing:-.02em;margin-bottom:4px}
  17. .sub{font-size:12px;color:#8F8E88;margin-bottom:6px}
  18. .src{font-size:9.5px;color:#55554F;margin-top:12px;letter-spacing:.08em;font-weight:500}
  19. #ch{width:100%;height:74vh;min-height:560px;display:block}
  20. #status{height:34px;display:flex;align-items:center;gap:10px;
  21. font-size:12px;color:#8F8E88;border-top:1px solid #2E2D29;margin-top:6px;padding-top:8px}
  22. #status b{color:var(--paper);font-weight:700}
  23. #status .pin{font-size:9px;letter-spacing:.1em;color:#55554F;font-weight:700}
  24. svg text{font-family:'Inter',sans-serif;user-select:none}
  25. /* thread states */
  26. .thread{transition:opacity .18s ease,stroke-width .18s ease}
  27. .thread.hot{opacity:.95 !important}
  28. svg.focused .thread:not(.hot){opacity:.035 !important}
  29. .nodelab{cursor:pointer;transition:opacity .18s ease}
  30. svg.focused .nodelab:not(.hot){opacity:.25}
  31. .hit{cursor:pointer}
  32. </style>
  33. </head>
  34. <body>
  35. <div class="card">
  36. <h2>Where the data actually goes — now answerable</h2>
  37. <div class="sub">source → processor → destination · one thread per data path · hover to trace a route · hover any label to pull its whole bundle · click to pin, click dark space to release</div>
  38. <svg id="ch" viewBox="0 0 1140 640" preserveAspectRatio="xMidYMid meet"></svg>
  39. <div id="status"><span id="stext">hover a thread or a label</span><span class="pin" id="spin"></span></div>
  40. <div class="src">THREAD TRIPTYCH · INTERACTIVE · DATA MAP</div>
  41. </div>
  42. <script>
  43. const PAPER='#F0EFEB',NS='http://www.w3.org/2000/svg';
  44. const el=(p,t,a)=>{const n=document.createElementNS(NS,t);for(const k in a)n.setAttribute(k,a[k]);p.appendChild(n);return n};
  45. const txt=(p,a,s)=>{const n=el(p,'text',a);n.textContent=s;return n};
  46. const rnd=(i,k)=>Math.abs(((i*73856093)^(k*19349663))%1000)/1000;
  47. // ── the pipeline ──
  48. const SRC=['web-app','ios-app','android','desktop','cli','public-api','webhooks','forms','email-in','chat-widget',
  49. 'billing-ev','auth-ev','search-log','audit-ev','crash-rep','perf-beacon','cdn-log','edge-log','job-ev','sync-ev',
  50. 'import','export-req','admin-ui','partner-api','iot-ping','backfill'];
  51. const MIDV=['parse','validate','dedupe','enrich','geoip','sessionize','pii-mask','score','sample','route',
  52. 'batch','window','join','flatten','filter','hash','encrypt','compact','index','tag'];
  53. const MID=MIDV.flatMap(v=>[v+'-a',v+'-b']); // 40 processors
  54. const DST=['WAREHOUSE','ANALYTICS','CRM','ADS','BILLING','SEARCH','ML PIPE','ARCHIVE','AUDIT','EXPORTS'];
  55. // routes: each source emits 2-3 full paths; volume is long-tailed
  56. const routes=[];
  57. SRC.forEach((s,i)=>{
  58. const n=2+Math.floor(rnd(i+1,5)*2);
  59. for(let k=0;k<n;k++){
  60. const mi=Math.floor(rnd(i*3+k+2,13)*MID.length);
  61. const di=Math.min(9,Math.floor(rnd(i*5+k+4,19)**2*11)); // skew: low dsts hoard
  62. const v=Math.round(1+rnd(i*7+k+6,29)**2*30); // 1..31, long tail
  63. routes.push({s:i,m:mi,d:di,v});
  64. }
  65. });
  66. // ── geometry ──
  67. const X1=180,X2=560,X3=930;
  68. const sy=i=>36+i*22.6, my=i=>30+i*14.6, dy=i=>60+i*57;
  69. const path=r=>`M${X1+6} ${sy(r.s)} C${(X1+X2)/2} ${sy(r.s)} ${(X1+X2)/2} ${my(r.m)} ${X2} ${my(r.m)}`
  70. +` C${(X2+X3)/2} ${my(r.m)} ${(X2+X3)/2} ${dy(r.d)} ${X3-6} ${dy(r.d)}`;
  71. const svg=document.getElementById('ch');
  72. const stext=document.getElementById('stext'),spin=document.getElementById('spin');
  73. const fmt=v=>v+'k ev/day';
  74. let pinned=null;
  75. // column headers
  76. [[X1,'① SOURCE'],[X2,'② PROCESSOR'],[X3,'③ DESTINATION']].forEach(([x,t])=>
  77. txt(svg,{x,y:14,'font-size':9,'font-weight':800,fill:PAPER,'letter-spacing':'.14em','text-anchor':'middle'},t));
  78. // threads (drawn first, under labels)
  79. const gThreads=el(svg,'g',{});
  80. routes.forEach((r,ri)=>{
  81. r.el=el(gThreads,'path',{d:path(r),fill:'none',stroke:PAPER,
  82. 'stroke-width':Math.max(.6,r.v*.14),class:'thread',
  83. opacity:.06+Math.min(.2,r.v*.012),'stroke-linecap':'round'});
  84. // invisible fat twin: the hover/click target
  85. r.hit=el(gThreads,'path',{d:path(r),fill:'none',stroke:'#000','stroke-opacity':0,
  86. 'stroke-width':9,class:'hit'});
  87. r.hit.dataset.route=ri;
  88. });
  89. // node labels + ticks; each carries hit metadata
  90. const mkNode=(x,y,label,anchor,cls,meta,size,fill)=>{
  91. const g=el(svg,'g',{class:'nodelab'});
  92. g.dataset.kind=meta.kind;g.dataset.idx=meta.idx;
  93. el(g,'rect',{x:x-3,y:y-1.6,width:6,height:3.2,fill:PAPER,opacity:.85});
  94. txt(g,{x:anchor==='end'?x-9:x+9,y:y+2.6,'font-size':size,'font-weight':600,
  95. fill,'text-anchor':anchor},label);
  96. // generous invisible hit zone
  97. el(g,'rect',{x:anchor==='end'?x-92:x-6,y:y-6.5,width:98,height:13,fill:'#000','fill-opacity':0,class:'hit'});
  98. return g;
  99. };
  100. SRC.forEach((s,i)=>mkNode(X1,sy(i),s,'end','',{kind:'s',idx:i},7.5,'#B3B0A4'));
  101. MID.forEach((m,i)=>mkNode(X2,my(i),m,'start','',{kind:'m',idx:i},5.4,'#6A6963'));
  102. DST.forEach((d,i)=>{
  103. const g=el(svg,'g',{class:'nodelab'});
  104. g.dataset.kind='d';g.dataset.idx=i;
  105. el(g,'circle',{cx:X3,cy:dy(i),r:3.4,fill:PAPER});
  106. txt(g,{x:X3+12,y:dy(i)+3,'font-size':8.5,'font-weight':700,fill:'#B3B0A4','letter-spacing':'.08em'},d);
  107. el(g,'rect',{x:X3-8,y:dy(i)-10,width:120,height:20,fill:'#000','fill-opacity':0,class:'hit'});
  108. });
  109. // ── highlight machinery ──
  110. const nodeLabs=[...svg.querySelectorAll('.nodelab')];
  111. const clear=()=>{
  112. svg.classList.remove('focused');
  113. routes.forEach(r=>r.el.classList.remove('hot'));
  114. nodeLabs.forEach(n=>n.classList.remove('hot'));
  115. stext.textContent='hover a thread or a label';spin.textContent='';
  116. };
  117. const focusRoutes=(rs,label)=>{
  118. svg.classList.add('focused');
  119. routes.forEach(r=>r.el.classList.toggle('hot',rs.includes(r)));
  120. nodeLabs.forEach(n=>{
  121. const k=n.dataset.kind,ix=+n.dataset.idx;
  122. n.classList.toggle('hot',rs.some(r=>(k==='s'&&r.s===ix)||(k==='m'&&r.m===ix)||(k==='d'&&r.d===ix)));
  123. });
  124. stext.innerHTML=label;
  125. };
  126. const routeLabel=r=>`<b>${SRC[r.s]}</b> → ${MID[r.m]} → <b>${DST[r.d]}</b> · ${fmt(r.v)}`;
  127. const nodeSel=(kind,idx)=>{
  128. const rs=routes.filter(r=>(kind==='s'&&r.s===idx)||(kind==='m'&&r.m===idx)||(kind==='d'&&r.d===idx));
  129. const total=rs.reduce((a,r)=>a+r.v,0);
  130. const name=kind==='s'?SRC[idx]:kind==='m'?MID[idx]:DST[idx];
  131. return [rs,`<b>${name}</b> · ${rs.length} path${rs.length>1?'s':''} · ${fmt(total)} total`];
  132. };
  133. const apply=t=>{
  134. const hit=t.closest?.('.hit');
  135. if(!hit)return null;
  136. const rg=hit.dataset.route,ng=hit.closest('.nodelab');
  137. if(rg!=null){const r=routes[+rg];return()=>focusRoutes([r],routeLabel(r))}
  138. if(ng){const [rs,lab]=nodeSel(ng.dataset.kind,+ng.dataset.idx);return()=>focusRoutes(rs,lab)}
  139. return null;
  140. };
  141. svg.addEventListener('mousemove',e=>{
  142. if(pinned)return;
  143. const f=apply(e.target);
  144. f?f():clear();
  145. });
  146. svg.addEventListener('mouseleave',()=>{if(!pinned)clear()});
  147. svg.addEventListener('click',e=>{
  148. const f=apply(e.target);
  149. if(f){pinned=f;f();spin.textContent='PINNED · CLICK DARK SPACE TO RELEASE'}
  150. else{pinned=null;clear()}
  151. });
  152. </script>
  153. </body>
  154. </html>