Spaces:
Running on Zero
Unify into one race card: comparison strip + single reading pane
Browse filesCollapse the two output panes, verdict, progress, and input into one
cohesive component that reads top-to-bottom on mobile:
- Comparison strip shows BOTH models at once (timer + LED + live bar)
with the speedup as a center number β no need to switch to compare.
- One reading pane with a PULPIE/DRIPPER segmented toggle; COPY / DIFF
act on the visible model (diff shows the LCS line-diff inline).
- Input section folded into the same card (select + run + raw-HTML
accordion), so it's a single card, not three stacked components.
- Speedup parsed from the backend verdict and shown large; plain-text
verdicts (bad input / errors) fall back to the status line.
- Mobile: strip stacks vertically into a list and still fits one screen;
toggle stays inline above the reading pane. Palette + streaming
contract untouched.
Co-Authored-By: Claude <noreply@anthropic.com>
- index.html +242 -236
|
@@ -17,9 +17,8 @@
|
|
| 17 |
--green:#2F5A3C; --err:#8A2E16; --err-bg:#FFF3EC;
|
| 18 |
--r:14px; --r-sm:10px; --r-lg:20px;
|
| 19 |
--sh1:0 1px 2px rgba(27,23,20,.05), 0 1px 3px rgba(27,23,20,.04);
|
| 20 |
-
--sh2:0
|
| 21 |
--ring:0 0 0 3px rgba(198,83,29,.22);
|
| 22 |
-
--safe-b:env(safe-area-inset-bottom,0px);
|
| 23 |
--safe-t:env(safe-area-inset-top,0px);
|
| 24 |
color-scheme:light;
|
| 25 |
}
|
|
@@ -27,7 +26,7 @@
|
|
| 27 |
html,body{background:var(--paper);color:var(--ink)}
|
| 28 |
body{font-family:'Inter','Helvetica Neue',Arial,sans-serif;min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-webkit-tap-highlight-color:transparent}
|
| 29 |
.mono{font-family:'IBM Plex Mono',monospace}
|
| 30 |
-
.wrap{width:100%;max-width:
|
| 31 |
::selection{background:rgba(198,83,29,.18)}
|
| 32 |
*{scrollbar-width:thin;scrollbar-color:var(--hairline) transparent}
|
| 33 |
::-webkit-scrollbar{width:9px;height:9px}
|
|
@@ -37,8 +36,8 @@
|
|
| 37 |
a,button,select,textarea{touch-action:manipulation}
|
| 38 |
|
| 39 |
/* ββ Header ββ */
|
| 40 |
-
#header-block{margin-bottom:
|
| 41 |
-
.topbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:
|
| 42 |
#eyebrow{font-family:'IBM Plex Mono',monospace;font-size:11px;letter-spacing:.18em;color:var(--orange);text-transform:uppercase;font-weight:500;line-height:1.3}
|
| 43 |
.pill{display:inline-flex;align-items:center;gap:7px;font-family:'IBM Plex Mono',monospace;font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--soft);background:var(--raised);border:1px solid var(--hairline);padding:6px 11px;border-radius:100px;box-shadow:var(--sh1);transition:all .2s;white-space:nowrap}
|
| 44 |
.pill .dot{width:7px;height:7px;border-radius:50%;background:var(--green);box-shadow:0 0 0 3px rgba(47,90,60,.15)}
|
|
@@ -46,18 +45,22 @@
|
|
| 46 |
.pill.error{color:var(--err);border-color:var(--orange)}
|
| 47 |
.pill.error .dot{background:var(--err);box-shadow:0 0 0 3px rgba(138,46,22,.15)}
|
| 48 |
@keyframes pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.85)}}
|
| 49 |
-
#headline h1{font-weight:700;letter-spacing:-.035em;font-size:
|
| 50 |
-
#lead{font-family:'Lora',serif;font-size:
|
| 51 |
|
| 52 |
-
/* ββ
|
| 53 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
.input-eyebrow{font-family:'IBM Plex Mono',monospace;font-size:10px;letter-spacing:.16em;color:var(--soft);text-transform:uppercase;margin-bottom:11px;display:flex;align-items:center;gap:8px}
|
| 55 |
.input-eyebrow::after{content:"";flex:1;height:1px;background:var(--hairline)}
|
| 56 |
#input-row{display:flex;align-items:stretch;gap:12px}
|
| 57 |
-
#example-select{flex:1;height:
|
| 58 |
#example-select:hover{border-color:var(--orange);box-shadow:var(--sh1)}
|
| 59 |
#example-select:focus-visible{outline:none;box-shadow:var(--ring);border-color:var(--orange)}
|
| 60 |
-
#run-btn{height:
|
| 61 |
#run-btn:hover:not(:disabled){filter:brightness(1.06);transform:translateY(-1px);box-shadow:0 7px 22px -5px rgba(198,83,29,.55)}
|
| 62 |
#run-btn:active:not(:disabled){transform:translateY(0)}
|
| 63 |
#run-btn:focus-visible{outline:none;box-shadow:var(--ring)}
|
|
@@ -68,9 +71,8 @@
|
|
| 68 |
#run-btn.running .bolt{display:none}
|
| 69 |
@keyframes spin{to{transform:rotate(360deg)}}
|
| 70 |
|
| 71 |
-
/* accordion */
|
| 72 |
#html-accordion{margin-top:12px}
|
| 73 |
-
.acc-header{display:flex;align-items:center;gap:9px;padding:
|
| 74 |
.acc-header .chev{font-family:'IBM Plex Mono',monospace;font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--soft);display:flex;align-items:center;gap:7px;transition:color .15s}
|
| 75 |
.acc-header .chev .arw{display:inline-block;transition:transform .22s;color:var(--orange)}
|
| 76 |
.acc-header:hover .chev{color:var(--ink)}
|
|
@@ -78,58 +80,68 @@
|
|
| 78 |
.acc-body{max-height:0;overflow:hidden;transition:max-height .3s ease}
|
| 79 |
#html-accordion.open .acc-body{max-height:300px}
|
| 80 |
.acc-body-inner{padding-top:8px}
|
| 81 |
-
#custom-html{width:100%;min-height:
|
| 82 |
#custom-html:focus-visible{outline:none;border-color:var(--orange);box-shadow:var(--ring)}
|
| 83 |
-
.acc-hint{font-family:'Lora',serif;font-style:italic;color:var(--soft);font-size:
|
| 84 |
-
|
| 85 |
-
/*
|
| 86 |
-
.
|
| 87 |
-
.
|
| 88 |
-
.
|
| 89 |
-
.
|
| 90 |
-
.
|
| 91 |
-
.
|
| 92 |
-
.
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
.
|
| 96 |
-
.
|
| 97 |
-
.
|
| 98 |
-
.
|
| 99 |
-
.pane-head .name{font-family:'IBM Plex Mono',monospace;font-size:11px;letter-spacing:.08em;color:var(--soft);text-transform:uppercase;display:flex;align-items:center;gap:8px;min-width:0}
|
| 100 |
-
.pane-head .name b{color:var(--ink);font-weight:600;letter-spacing:.03em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
| 101 |
-
.pane.pulpie-pane .name .led{background:var(--orange)}
|
| 102 |
-
.pane.dripper-pane .name .led{background:var(--pine)}
|
| 103 |
-
.led{width:8px;height:8px;border-radius:50%;flex:none;opacity:.45;transition:opacity .25s}
|
| 104 |
-
.pane.live .led{opacity:1;box-shadow:0 0 0 4px rgba(198,83,29,.12)}
|
| 105 |
-
.pane.dripper-pane.live .led{box-shadow:0 0 0 4px rgba(47,90,60,.12)}
|
| 106 |
-
.timer{font-family:'IBM Plex Mono',monospace;font-size:12.5px;letter-spacing:.02em;color:var(--ink);font-variant-numeric:tabular-nums;white-space:nowrap}
|
| 107 |
.timer .running{color:var(--green);font-weight:500}
|
| 108 |
-
.
|
| 109 |
-
.bar{height:
|
| 110 |
-
.bar .fill{position:absolute;inset:0 100% 0 0;background:linear-gradient(90deg,var(--orange),var(--orange-hover));transition:right .35s cubic-bezier(.4,0,.2,1)}
|
| 111 |
-
.
|
| 112 |
.bar .fill.indeterminate{animation:indet 1.3s ease-in-out infinite}
|
| 113 |
@keyframes indet{0%{left:-30%;right:100%}50%{right:40%}100%{left:100%;right:-30%}}
|
| 114 |
-
|
| 115 |
-
.
|
| 116 |
-
.
|
| 117 |
-
.
|
| 118 |
-
.
|
| 119 |
-
.
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
.mini-btn{background:var(--paper);color:var(--ink);border:1px solid var(--hairline);font-family:'IBM Plex Mono',monospace;font-size:10.5px;letter-spacing:.08em;padding:8px 12px;cursor:pointer;transition:all .15s;text-transform:uppercase;border-radius:7px;display:inline-flex;align-items:center;gap:6px;min-height:34px}
|
| 125 |
.mini-btn:hover{color:var(--orange);border-color:var(--orange);background:var(--raised)}
|
| 126 |
.mini-btn:focus-visible{outline:none;box-shadow:var(--ring)}
|
| 127 |
.mini-btn:disabled{opacity:.4;cursor:not-allowed}
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
/* markdown */
|
| 131 |
.md h1,.md h2,.md h3,.md h4,.md h5,.md h6{color:var(--ink);font-weight:700;letter-spacing:-.02em;margin:16px 0 7px;line-height:1.22}
|
| 132 |
-
.md h1{font-size:
|
| 133 |
.md h1:first-child,.md h2:first-child{margin-top:0}
|
| 134 |
.md p{font-family:'Lora',serif;color:var(--body-ink);margin:9px 0;line-height:1.62;font-size:15px}
|
| 135 |
.md ul,.md ol{margin:9px 0 9px 22px;font-family:'Lora',serif;color:var(--body-ink);font-size:15px}
|
|
@@ -146,33 +158,17 @@
|
|
| 146 |
.md th{background:var(--sunken)}
|
| 147 |
.md hr{border:none;border-top:1px solid var(--hairline);margin:15px 0}
|
| 148 |
|
| 149 |
-
/*
|
| 150 |
-
#verdict{margin-top:18px}
|
| 151 |
-
.verdict-hero{background:var(--ink);color:var(--paper);border-radius:var(--r);padding:20px 24px;display:flex;align-items:center;justify-content:space-between;gap:20px;box-shadow:var(--sh2);overflow:hidden;position:relative}
|
| 152 |
-
.verdict-hero::before{content:"";position:absolute;inset:0;background:radial-gradient(900px 120px at 100% 0%,rgba(198,83,29,.22),transparent 60%);pointer-events:none}
|
| 153 |
-
.verdict-hero>*{position:relative}
|
| 154 |
-
.verdict-hero .v-left{font-family:'IBM Plex Mono',monospace;font-size:12.5px;letter-spacing:.04em;opacity:.85;line-height:1.7}
|
| 155 |
-
.verdict-hero .v-left b{color:var(--orange-hover);font-weight:600}
|
| 156 |
-
.verdict-hero .v-speed{font-family:'IBM Plex Mono',monospace;font-weight:700;font-size:48px;line-height:1;letter-spacing:-.03em;color:var(--orange-hover);text-shadow:0 0 40px rgba(224,130,58,.4);white-space:nowrap}
|
| 157 |
-
.verdict-hero .v-speed small{font-size:18px;opacity:.7;margin-left:2px}
|
| 158 |
-
.verdict-queued{font-family:'IBM Plex Mono',monospace;font-size:12px;letter-spacing:.08em;color:var(--soft);text-transform:uppercase;padding:12px 0;display:flex;align-items:center;gap:8px}
|
| 159 |
-
.verdict-queued .dot{width:8px;height:8px;border-radius:50%;background:var(--orange);animation:pulse 1.1s infinite}
|
| 160 |
-
.verdict-bar{font-family:'IBM Plex Mono',monospace;font-size:13px;letter-spacing:.05em;padding:13px 0;border-top:1px solid var(--hairline);color:var(--ink)}
|
| 161 |
-
.verdict-bar .speed{color:var(--orange);font-weight:600}
|
| 162 |
-
|
| 163 |
-
.progress-track{height:3px;background:var(--sunken);margin-top:6px;border-radius:3px;overflow:hidden}
|
| 164 |
-
.progress-fill{height:100%;width:0%;background:linear-gradient(90deg,var(--orange),var(--orange-hover));transition:width .35s cubic-bezier(.4,0,.2,1)}
|
| 165 |
-
|
| 166 |
.flash{background:var(--err-bg);color:var(--err);border:1px solid var(--orange);padding:12px 16px;font-family:'IBM Plex Mono',monospace;font-size:12.5px;margin-top:14px;border-radius:var(--r-sm);display:none;align-items:center;gap:10px}
|
| 167 |
.flash.show{display:flex}
|
| 168 |
.flash .x{margin-left:auto;cursor:pointer;opacity:.6;padding:2px 6px}
|
| 169 |
.flash .x:hover{opacity:1}
|
| 170 |
|
| 171 |
/* ββ Bench ββ */
|
| 172 |
-
#bench-well{background:var(--raised);border:1px solid var(--hairline);border-radius:var(--r);padding:
|
| 173 |
-
#bench-well .label{font-family:'IBM Plex Mono',monospace;font-size:10.5px;letter-spacing:.14em;color:var(--soft);margin-bottom:
|
| 174 |
#bench-well .label::after{content:"";flex:1;height:1px;background:var(--hairline)}
|
| 175 |
-
.bench-row{display:grid;grid-template-columns:170px 1fr
|
| 176 |
.bench-row .who{font-family:'Inter',sans-serif;font-size:13.5px;color:var(--ink);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
| 177 |
.bench-row .who .params{color:var(--soft);font-family:'IBM Plex Mono',monospace;font-size:11px;margin-left:6px;font-weight:400}
|
| 178 |
.bench-track{height:10px;background:var(--sunken);border-radius:6px;overflow:hidden}
|
|
@@ -181,49 +177,43 @@
|
|
| 181 |
.bench-row.dim .bench-fill{opacity:.5}
|
| 182 |
.bench-row .score{font-family:'IBM Plex Mono',monospace;font-size:13px;text-align:right;font-variant-numeric:tabular-nums;color:var(--ink)}
|
| 183 |
.bench-row.win .score{color:var(--orange);font-weight:600}
|
| 184 |
-
#bench-well .note{font-family:'Lora',serif;font-style:italic;color:var(--body-ink);margin-top:
|
| 185 |
|
| 186 |
/* footer */
|
| 187 |
-
#footer-mono{font-family:'IBM Plex Mono',monospace;font-size:11.5px;letter-spacing:.06em;color:var(--soft);border-top:1px solid var(--hairline);padding-top:
|
| 188 |
#footer-mono a{color:var(--ink);text-decoration:none;padding:3px;transition:color .15s}
|
| 189 |
#footer-mono a:hover{color:var(--orange)}
|
| 190 |
#footer-mono .sep{opacity:.4;margin:0 5px}
|
| 191 |
|
| 192 |
-
/* ββ Mobile
|
| 193 |
-
@media (max-width:
|
| 194 |
-
.wrap{padding:max(20px,var(--safe-t))
|
| 195 |
-
#headline h1{font-size:
|
| 196 |
-
#lead{font-size:
|
| 197 |
-
.
|
|
|
|
| 198 |
#input-row{flex-direction:column}
|
| 199 |
#example-select,#run-btn{flex:1;width:100%;min-width:0}
|
| 200 |
-
/*
|
| 201 |
-
.
|
| 202 |
-
.
|
| 203 |
-
.
|
| 204 |
-
.
|
| 205 |
-
.
|
| 206 |
-
.
|
| 207 |
-
.
|
|
|
|
|
|
|
|
|
|
| 208 |
.bench-row .who{grid-column:1/3}
|
| 209 |
.bench-row .bench-track{grid-column:1}
|
| 210 |
.bench-row .score{grid-column:2}
|
| 211 |
}
|
| 212 |
-
@media (max-width:
|
| 213 |
#eyebrow{font-size:9.5px}
|
| 214 |
.pill{font-size:9px;padding:5px 9px}
|
| 215 |
-
#headline h1{font-size:
|
| 216 |
-
.
|
| 217 |
-
.verdict-hero .v-speed{font-size:32px}
|
| 218 |
-
}
|
| 219 |
-
|
| 220 |
-
/* sticky mobile run bar (keeps EXTRACT reachable; pointer:coarse = touch devices) */
|
| 221 |
-
.runbar{display:none}
|
| 222 |
-
@media (hover:none) and (pointer:coarse){
|
| 223 |
-
.runbar{position:fixed;left:0;right:0;bottom:0;background:rgba(251,247,240,.92);backdrop-filter:blur(14px) saturate(140%);-webkit-backdrop-filter:blur(14px) saturate(140%);border-top:1px solid var(--hairline);padding:10px 16px calc(10px + var(--safe-b));z-index:50;display:flex;gap:10px;align-items:center}
|
| 224 |
-
.runbar #run-btn{flex:1;min-width:0}
|
| 225 |
-
.runbar .sel-mini{display:none}
|
| 226 |
-
.wrap #run-btn{display:none}
|
| 227 |
}
|
| 228 |
|
| 229 |
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
|
|
@@ -241,81 +231,83 @@
|
|
| 241 |
<div id="lead">Extract main content from HTML. One forward pass, not one token at a time.</div>
|
| 242 |
</div>
|
| 243 |
|
| 244 |
-
<!--
|
| 245 |
-
<div class="
|
| 246 |
-
<
|
| 247 |
-
<div
|
| 248 |
-
<
|
| 249 |
-
|
| 250 |
-
<
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
<
|
| 262 |
-
<
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
<div
|
| 268 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
</div>
|
| 270 |
-
<div class="acc-body"><div class="acc-body-inner">
|
| 271 |
-
<textarea id="custom-html" placeholder="<html>β¦</html> (2 MB max; JS-rendered SPAs will come up empty β nothing static to extract)"></textarea>
|
| 272 |
-
<div class="acc-hint">If set, this overrides the example dropdown. β/Ctrl+Enter to run.</div>
|
| 273 |
-
</div></div>
|
| 274 |
</div>
|
| 275 |
-
</div>
|
| 276 |
|
| 277 |
-
|
| 278 |
-
<div class="seg" role="tablist" aria-label="Model output">
|
| 279 |
-
<button data-seg="pulpie" class="active" role="tab" aria-selected="true"><span class="led"></span>PULPIE</button>
|
| 280 |
-
<button data-seg="dripper" role="tab" aria-selected="false"><span class="led"></span>DRIPPER</button>
|
| 281 |
-
</div>
|
| 282 |
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
|
|
|
|
|
|
| 289 |
</div>
|
| 290 |
-
<div class="
|
| 291 |
-
|
| 292 |
-
<div class="
|
| 293 |
-
<div class="skeleton"><div class="sk-line"></div><div class="sk-line"></div><div class="sk-line"></div><div class="sk-line"></div><div class="sk-line"></div></div>
|
| 294 |
</div>
|
| 295 |
-
<div class="
|
| 296 |
-
<
|
| 297 |
-
|
|
|
|
|
|
|
|
|
|
| 298 |
</div>
|
| 299 |
</div>
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
<div class="result-pane" id="dripper-pane">
|
| 307 |
-
<div class="placeholder">The same labels, one token at a time.</div>
|
| 308 |
-
<div class="skeleton"><div class="sk-line"></div><div class="sk-line"></div><div class="sk-line"></div><div class="sk-line"></div><div class="sk-line"></div></div>
|
| 309 |
-
</div>
|
| 310 |
-
<div class="pane-actions">
|
| 311 |
-
<button class="mini-btn" data-copy="dripper">β§ COPY MD</button>
|
| 312 |
-
<button class="mini-btn" data-diff="dripper">β DIFF</button>
|
| 313 |
</div>
|
|
|
|
|
|
|
|
|
|
| 314 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
</div>
|
| 316 |
|
| 317 |
-
<div class="progress-track"><div class="progress-fill" id="progress-fill"></div></div>
|
| 318 |
-
<div id="verdict"></div>
|
| 319 |
<div class="flash" id="flash"><span id="flash-text"></span><span class="x" id="flash-x">β</span></div>
|
| 320 |
|
| 321 |
<!-- Bench -->
|
|
@@ -338,11 +330,6 @@
|
|
| 338 |
</div>
|
| 339 |
</div>
|
| 340 |
|
| 341 |
-
<!-- Sticky mobile run bar -->
|
| 342 |
-
<div class="runbar">
|
| 343 |
-
<button id="run-btn-mobile">EXTRACT β</button>
|
| 344 |
-
</div>
|
| 345 |
-
|
| 346 |
<script type="module">
|
| 347 |
import { Client } from "https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js";
|
| 348 |
import { marked } from "https://cdn.jsdelivr.net/npm/marked@12/lib/marked.esm.js";
|
|
@@ -351,47 +338,68 @@
|
|
| 351 |
|
| 352 |
const $ = (id) => document.getElementById(id);
|
| 353 |
const runBtn=$("run-btn"), btnLabel=runBtn.querySelector(".btn-label");
|
| 354 |
-
const runBtnMobile=$("run-btn-mobile");
|
| 355 |
const exampleSelect=$("example-select"), customHtml=$("custom-html");
|
| 356 |
-
const
|
| 357 |
-
const
|
| 358 |
const pulpieTimer=$("pulpie-timer"), dripperTimer=$("dripper-timer");
|
| 359 |
const pulpieBar=$("pulpie-bar"), dripperBar=$("dripper-bar");
|
| 360 |
-
const
|
|
|
|
|
|
|
| 361 |
const connPill=$("conn-pill"), connText=$("conn-text");
|
|
|
|
| 362 |
|
| 363 |
const PLACEHOLDERS = {
|
| 364 |
pulpie:'<div class="placeholder">One encoder forward pass over every block.</div>',
|
| 365 |
dripper:'<div class="placeholder">The same labels, one token at a time.</div>',
|
| 366 |
};
|
| 367 |
-
const SKEL = '<div class="
|
| 368 |
let lastMd = { pulpie:"", dripper:"" };
|
| 369 |
-
let
|
| 370 |
|
| 371 |
function renderMarkdown(md){ if(!md) return ""; return DOMPurify.sanitize(marked.parse(md)); }
|
| 372 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 373 |
function setRunning(on){
|
|
|
|
| 374 |
runBtn.classList.toggle("running", on); runBtn.disabled=on;
|
| 375 |
-
if(runBtnMobile) runBtnMobile.disabled = on;
|
| 376 |
btnLabel.textContent = on ? "EXTRACTINGβ¦" : "EXTRACT β";
|
| 377 |
-
if(
|
| 378 |
}
|
| 379 |
function showError(msg){ flashText.textContent=msg; flashEl.classList.add("show"); }
|
| 380 |
function clearError(){ flashEl.classList.remove("show"); }
|
| 381 |
-
function
|
| 382 |
function setBar(bar, pct, indeterminate){
|
| 383 |
bar.classList.toggle("indeterminate", !!indeterminate);
|
| 384 |
if(indeterminate){ bar.style.right=""; }
|
| 385 |
else { bar.style.right = (100-Math.max(0,Math.min(100,pct)))+"%"; }
|
| 386 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
|
| 388 |
function resetPanes(){
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
pulpieCard.classList.remove("live","working"); dripperCard.classList.remove("live","working");
|
| 392 |
pulpieTimer.innerHTML=""; dripperTimer.innerHTML="";
|
| 393 |
-
|
| 394 |
-
|
|
|
|
| 395 |
}
|
| 396 |
|
| 397 |
function normalizeRecord(d){
|
|
@@ -404,20 +412,26 @@
|
|
| 404 |
function applyRecord(rec){
|
| 405 |
if(!rec) return;
|
| 406 |
if(rec.pulpie_md!==undefined && rec.pulpie_md!==""){
|
| 407 |
-
lastMd.pulpie=rec.pulpie_md;
|
| 408 |
-
|
| 409 |
-
|
|
|
|
|
|
|
| 410 |
}
|
| 411 |
if(rec.dripper_md!==undefined && rec.dripper_md!==""){
|
| 412 |
-
lastMd.dripper=rec.dripper_md;
|
| 413 |
-
|
|
|
|
| 414 |
}
|
| 415 |
if(rec.pulpie_timer!==undefined) pulpieTimer.innerHTML=rec.pulpie_timer;
|
| 416 |
if(rec.dripper_timer!==undefined) dripperTimer.innerHTML=rec.dripper_timer;
|
| 417 |
-
|
| 418 |
-
if(rec.
|
| 419 |
-
|
| 420 |
-
|
|
|
|
|
|
|
|
|
|
| 421 |
}
|
| 422 |
|
| 423 |
// ββ Connect ββ
|
|
@@ -434,7 +448,6 @@
|
|
| 434 |
async function run(){
|
| 435 |
if(!client){ showError("Backend not connected. Reload the page."); return; }
|
| 436 |
resetPanes(); setRunning(true);
|
| 437 |
-
pulpieCard.classList.add("working"); dripperCard.classList.add("working");
|
| 438 |
const params = { example_name: exampleSelect.value, custom_html: customHtml.value.trim() };
|
| 439 |
try {
|
| 440 |
const submission = client.submit("/race", params);
|
|
@@ -442,19 +455,17 @@
|
|
| 442 |
for await (const msg of submission){
|
| 443 |
if(msg.type==="status"){
|
| 444 |
if(msg.stage==="pending" && msg.position!=null){
|
| 445 |
-
|
| 446 |
-
} else if(msg.stage==="generating"){ if(!
|
| 447 |
continue;
|
| 448 |
}
|
| 449 |
if(msg.type==="data"){ sawData=true; applyRecord(normalizeRecord(msg.data)); }
|
| 450 |
}
|
| 451 |
if(!sawData) showError("Backend returned no data. Check the /race endpoint and Space logs.");
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
finally { setRunning(false); pulpieCard.classList.remove("working"); dripperCard.classList.remove("working"); }
|
| 455 |
}
|
| 456 |
runBtn.addEventListener("click", run);
|
| 457 |
-
if(runBtnMobile) runBtnMobile.addEventListener("click", run);
|
| 458 |
exampleSelect.addEventListener("keydown", e=>{ if(e.key==="Enter"){ e.preventDefault(); run(); } });
|
| 459 |
customHtml.addEventListener("keydown", e=>{ if(e.key==="Enter" && (e.metaKey||e.ctrlKey)){ e.preventDefault(); run(); } });
|
| 460 |
|
|
@@ -463,48 +474,43 @@
|
|
| 463 |
accToggle.addEventListener("click", ()=>{ const o=acc.classList.toggle("open"); accToggle.setAttribute("aria-expanded", o); });
|
| 464 |
accToggle.addEventListener("keydown", e=>{ if(e.key==="Enter"||e.key===" "){ e.preventDefault(); accToggle.click(); } });
|
| 465 |
|
| 466 |
-
// ββ
|
| 467 |
-
document.querySelectorAll(".seg button").forEach(b=>{
|
| 468 |
b.addEventListener("click", ()=>{
|
| 469 |
-
|
| 470 |
-
document.querySelectorAll(".seg button").forEach(x=>{ const on=x===b; x.classList.toggle("active",on); x.setAttribute("aria-selected",on); });
|
| 471 |
-
|
| 472 |
-
dripperCard.classList.toggle("mobile-active", mobilePane==="dripper");
|
| 473 |
});
|
| 474 |
});
|
| 475 |
|
| 476 |
// ββ Flash dismiss ββ
|
| 477 |
$("flash-x").addEventListener("click", clearError);
|
| 478 |
|
| 479 |
-
// ββ Copy
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
setTimeout(()=>(btn.textContent="β§ COPY MD"), 1400);
|
| 487 |
-
});
|
| 488 |
});
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
btn.addEventListener("click", function revert(){ if(lastMd[which]) targetPane.innerHTML=renderMarkdown(lastMd[which]); btn.textContent="β DIFF"; btn.removeEventListener("click", revert); }, { once:true });
|
| 507 |
-
});
|
| 508 |
});
|
| 509 |
|
| 510 |
function lineDiff(a,b){
|
|
|
|
| 17 |
--green:#2F5A3C; --err:#8A2E16; --err-bg:#FFF3EC;
|
| 18 |
--r:14px; --r-sm:10px; --r-lg:20px;
|
| 19 |
--sh1:0 1px 2px rgba(27,23,20,.05), 0 1px 3px rgba(27,23,20,.04);
|
| 20 |
+
--sh2:0 10px 32px -12px rgba(27,23,20,.18), 0 2px 8px -3px rgba(27,23,20,.07);
|
| 21 |
--ring:0 0 0 3px rgba(198,83,29,.22);
|
|
|
|
| 22 |
--safe-t:env(safe-area-inset-top,0px);
|
| 23 |
color-scheme:light;
|
| 24 |
}
|
|
|
|
| 26 |
html,body{background:var(--paper);color:var(--ink)}
|
| 27 |
body{font-family:'Inter','Helvetica Neue',Arial,sans-serif;min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-webkit-tap-highlight-color:transparent}
|
| 28 |
.mono{font-family:'IBM Plex Mono',monospace}
|
| 29 |
+
.wrap{width:100%;max-width:920px;margin:0 auto;padding:max(30px,var(--safe-t)) 20px 28px;flex:1}
|
| 30 |
::selection{background:rgba(198,83,29,.18)}
|
| 31 |
*{scrollbar-width:thin;scrollbar-color:var(--hairline) transparent}
|
| 32 |
::-webkit-scrollbar{width:9px;height:9px}
|
|
|
|
| 36 |
a,button,select,textarea{touch-action:manipulation}
|
| 37 |
|
| 38 |
/* ββ Header ββ */
|
| 39 |
+
#header-block{margin-bottom:20px}
|
| 40 |
+
.topbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:18px}
|
| 41 |
#eyebrow{font-family:'IBM Plex Mono',monospace;font-size:11px;letter-spacing:.18em;color:var(--orange);text-transform:uppercase;font-weight:500;line-height:1.3}
|
| 42 |
.pill{display:inline-flex;align-items:center;gap:7px;font-family:'IBM Plex Mono',monospace;font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--soft);background:var(--raised);border:1px solid var(--hairline);padding:6px 11px;border-radius:100px;box-shadow:var(--sh1);transition:all .2s;white-space:nowrap}
|
| 43 |
.pill .dot{width:7px;height:7px;border-radius:50%;background:var(--green);box-shadow:0 0 0 3px rgba(47,90,60,.15)}
|
|
|
|
| 45 |
.pill.error{color:var(--err);border-color:var(--orange)}
|
| 46 |
.pill.error .dot{background:var(--err);box-shadow:0 0 0 3px rgba(138,46,22,.15)}
|
| 47 |
@keyframes pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.85)}}
|
| 48 |
+
#headline h1{font-weight:700;letter-spacing:-.035em;font-size:50px;color:var(--ink);line-height:1.02;background:linear-gradient(120deg,var(--ink) 30%,var(--orange) 145%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}
|
| 49 |
+
#lead{font-family:'Lora',serif;font-size:18px;color:var(--body-ink);font-style:italic;max-width:620px;line-height:1.4;margin-top:6px}
|
| 50 |
|
| 51 |
+
/* ββ Unified race card ββ */
|
| 52 |
+
.race-card{background:var(--raised);border:1px solid var(--hairline);border-radius:var(--r-lg);box-shadow:var(--sh2);overflow:hidden;margin-top:20px}
|
| 53 |
+
.card-section{padding:18px}
|
| 54 |
+
.card-divider{height:1px;background:var(--hairline)}
|
| 55 |
+
|
| 56 |
+
/* input section */
|
| 57 |
.input-eyebrow{font-family:'IBM Plex Mono',monospace;font-size:10px;letter-spacing:.16em;color:var(--soft);text-transform:uppercase;margin-bottom:11px;display:flex;align-items:center;gap:8px}
|
| 58 |
.input-eyebrow::after{content:"";flex:1;height:1px;background:var(--hairline)}
|
| 59 |
#input-row{display:flex;align-items:stretch;gap:12px}
|
| 60 |
+
#example-select{flex:1;height:52px;background:var(--paper);border:1px solid var(--hairline);color:var(--ink);font-family:'IBM Plex Mono',monospace;font-size:13px;padding:0 42px 0 16px;cursor:pointer;appearance:none;border-radius:var(--r-sm);transition:all .15s;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23C6531D' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 16px center}
|
| 61 |
#example-select:hover{border-color:var(--orange);box-shadow:var(--sh1)}
|
| 62 |
#example-select:focus-visible{outline:none;box-shadow:var(--ring);border-color:var(--orange)}
|
| 63 |
+
#run-btn{height:52px;min-width:150px;background:linear-gradient(135deg,var(--orange) 0%,#D9642A 100%);color:#FBF7F0;border:none;cursor:pointer;font-family:'IBM Plex Mono',monospace;font-size:13px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;border-radius:var(--r-sm);display:inline-flex;align-items:center;justify-content:center;gap:10px;transition:all .18s;box-shadow:0 4px 14px -4px rgba(198,83,29,.5)}
|
| 64 |
#run-btn:hover:not(:disabled){filter:brightness(1.06);transform:translateY(-1px);box-shadow:0 7px 22px -5px rgba(198,83,29,.55)}
|
| 65 |
#run-btn:active:not(:disabled){transform:translateY(0)}
|
| 66 |
#run-btn:focus-visible{outline:none;box-shadow:var(--ring)}
|
|
|
|
| 71 |
#run-btn.running .bolt{display:none}
|
| 72 |
@keyframes spin{to{transform:rotate(360deg)}}
|
| 73 |
|
|
|
|
| 74 |
#html-accordion{margin-top:12px}
|
| 75 |
+
.acc-header{display:flex;align-items:center;gap:9px;padding:7px 2px;cursor:pointer;user-select:none}
|
| 76 |
.acc-header .chev{font-family:'IBM Plex Mono',monospace;font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--soft);display:flex;align-items:center;gap:7px;transition:color .15s}
|
| 77 |
.acc-header .chev .arw{display:inline-block;transition:transform .22s;color:var(--orange)}
|
| 78 |
.acc-header:hover .chev{color:var(--ink)}
|
|
|
|
| 80 |
.acc-body{max-height:0;overflow:hidden;transition:max-height .3s ease}
|
| 81 |
#html-accordion.open .acc-body{max-height:300px}
|
| 82 |
.acc-body-inner{padding-top:8px}
|
| 83 |
+
#custom-html{width:100%;min-height:120px;background:var(--paper);border:1px solid var(--hairline);color:var(--ink);padding:13px 14px;font-family:'IBM Plex Mono',monospace;font-size:12px;line-height:1.55;resize:vertical;border-radius:var(--r-sm);transition:all .15s}
|
| 84 |
#custom-html:focus-visible{outline:none;border-color:var(--orange);box-shadow:var(--ring)}
|
| 85 |
+
.acc-hint{font-family:'Lora',serif;font-style:italic;color:var(--soft);font-size:12px;margin-top:8px}
|
| 86 |
+
|
| 87 |
+
/* comparison strip */
|
| 88 |
+
.cmp-strip{display:grid;grid-template-columns:1fr auto 1fr;gap:14px;align-items:stretch;padding:16px 18px;background:linear-gradient(180deg,var(--raised),rgba(236,229,215,.4))}
|
| 89 |
+
.chip{background:var(--paper);border:1px solid var(--hairline);border-radius:var(--r-sm);padding:11px 13px;display:flex;flex-direction:column;gap:8px;transition:all .25s;min-width:0}
|
| 90 |
+
.chip.live{border-color:var(--orange);box-shadow:0 0 0 3px rgba(198,83,29,.09)}
|
| 91 |
+
.chip.dripper.live{border-color:var(--pine);box-shadow:0 0 0 3px rgba(47,90,60,.09)}
|
| 92 |
+
.chip-top{display:flex;align-items:center;justify-content:space-between;gap:8px}
|
| 93 |
+
.chip-name{font-family:'IBM Plex Mono',monospace;font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;color:var(--soft);display:flex;align-items:center;gap:7px;min-width:0}
|
| 94 |
+
.chip-name b{color:var(--ink);font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
| 95 |
+
.chip .led{width:8px;height:8px;border-radius:50%;flex:none;opacity:.4;transition:opacity .25s}
|
| 96 |
+
.chip.pulpie .led{background:var(--orange)}
|
| 97 |
+
.chip.dripper .led{background:var(--pine)}
|
| 98 |
+
.chip.live .led{opacity:1;box-shadow:0 0 0 4px rgba(198,83,29,.12)}
|
| 99 |
+
.chip.dripper.live .led{box-shadow:0 0 0 4px rgba(47,90,60,.12)}
|
| 100 |
+
.timer{font-family:'IBM Plex Mono',monospace;font-size:13px;letter-spacing:.02em;color:var(--ink);font-variant-numeric:tabular-nums;white-space:nowrap}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
.timer .running{color:var(--green);font-weight:500}
|
| 102 |
+
.chip.pulpie .timer{color:var(--orange)}
|
| 103 |
+
.bar{height:4px;background:var(--sunken);border-radius:4px;position:relative;overflow:hidden}
|
| 104 |
+
.bar .fill{position:absolute;inset:0 100% 0 0;background:linear-gradient(90deg,var(--orange),var(--orange-hover));border-radius:4px;transition:right .35s cubic-bezier(.4,0,.2,1)}
|
| 105 |
+
.chip.dripper .bar .fill{background:linear-gradient(90deg,var(--pine),#4A7E55)}
|
| 106 |
.bar .fill.indeterminate{animation:indet 1.3s ease-in-out infinite}
|
| 107 |
@keyframes indet{0%{left:-30%;right:100%}50%{right:40%}100%{left:100%;right:-30%}}
|
| 108 |
+
|
| 109 |
+
.cmp-center{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:0 4px;min-width:92px}
|
| 110 |
+
.sp-num{font-family:'IBM Plex Mono',monospace;font-weight:700;font-size:32px;line-height:1;letter-spacing:-.03em;color:var(--orange);transition:all .3s}
|
| 111 |
+
.sp-lbl{font-family:'IBM Plex Mono',monospace;font-size:9px;letter-spacing:.14em;text-transform:uppercase;color:var(--soft);margin-top:7px;line-height:1.3}
|
| 112 |
+
.cmp-center.idle .sp-num{color:var(--hairline);font-size:22px}
|
| 113 |
+
.cmp-center.idle .sp-lbl{opacity:0}
|
| 114 |
+
|
| 115 |
+
/* toolbar (toggle + actions) */
|
| 116 |
+
.read-toolbar{display:flex;align-items:center;gap:10px;padding:11px 18px;border-top:1px solid var(--hairline);border-bottom:1px solid var(--hairline);flex-wrap:wrap;background:rgba(236,229,215,.32)}
|
| 117 |
+
.toggle-seg{display:flex;gap:3px;background:var(--sunken);border:1px solid var(--hairline);padding:3px;border-radius:100px}
|
| 118 |
+
.toggle-seg button{border:none;background:transparent;color:var(--soft);font-family:'IBM Plex Mono',monospace;font-size:10.5px;letter-spacing:.08em;text-transform:uppercase;padding:8px 14px;cursor:pointer;border-radius:100px;transition:all .18s;font-weight:500;display:flex;align-items:center;gap:7px}
|
| 119 |
+
.toggle-seg button .led{width:7px;height:7px;border-radius:50%;opacity:.5}
|
| 120 |
+
.toggle-seg button[data-model="pulpie"] .led{background:var(--orange)}
|
| 121 |
+
.toggle-seg button[data-model="dripper"] .led{background:var(--pine)}
|
| 122 |
+
.toggle-seg button.active{background:var(--raised);color:var(--ink);box-shadow:var(--sh1)}
|
| 123 |
+
.toggle-seg button.active .led{opacity:1}
|
| 124 |
+
.toolbar-spacer{flex:1}
|
| 125 |
.mini-btn{background:var(--paper);color:var(--ink);border:1px solid var(--hairline);font-family:'IBM Plex Mono',monospace;font-size:10.5px;letter-spacing:.08em;padding:8px 12px;cursor:pointer;transition:all .15s;text-transform:uppercase;border-radius:7px;display:inline-flex;align-items:center;gap:6px;min-height:34px}
|
| 126 |
.mini-btn:hover{color:var(--orange);border-color:var(--orange);background:var(--raised)}
|
| 127 |
.mini-btn:focus-visible{outline:none;box-shadow:var(--ring)}
|
| 128 |
.mini-btn:disabled{opacity:.4;cursor:not-allowed}
|
| 129 |
+
|
| 130 |
+
/* single reading pane */
|
| 131 |
+
.read-pane{min-height:280px;max-height:560px;overflow-y:auto;padding:18px 20px;-webkit-overflow-scrolling:touch}
|
| 132 |
+
.read-pane .placeholder{color:var(--soft);font-style:italic;font-family:'Lora',serif;font-size:14.5px;line-height:1.5;display:flex;align-items:center;justify-content:center;min-height:220px;text-align:center;opacity:.85;padding:0 6px}
|
| 133 |
+
.sk-line{height:10px;background:linear-gradient(90deg,var(--sunken),var(--hairline),var(--sunken));background-size:200% 100%;animation:shimmer 1.4s infinite;border-radius:6px;margin:14px 0}
|
| 134 |
+
.sk-line:nth-child(1){width:55%}.sk-line:nth-child(2){width:88%}.sk-line:nth-child(3){width:72%}.sk-line:nth-child(4){width:90%}.sk-line:nth-child(5){width:40%}
|
| 135 |
+
.sk-line:nth-child(2){animation-delay:.1s}.sk-line:nth-child(3){animation-delay:.2s}.sk-line:nth-child(4){animation-delay:.3s}.sk-line:nth-child(5){animation-delay:.4s}
|
| 136 |
+
@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
|
| 137 |
+
|
| 138 |
+
/* status line (errors / bad input) */
|
| 139 |
+
#status-line{font-family:'IBM Plex Mono',monospace;font-size:12px;color:var(--err);padding:0 20px 14px;display:none}
|
| 140 |
+
#status-line.show{display:block}
|
| 141 |
|
| 142 |
/* markdown */
|
| 143 |
.md h1,.md h2,.md h3,.md h4,.md h5,.md h6{color:var(--ink);font-weight:700;letter-spacing:-.02em;margin:16px 0 7px;line-height:1.22}
|
| 144 |
+
.md h1{font-size:25px}.md h2{font-size:20px}.md h3{font-size:18px}.md h4{font-size:15.5px}
|
| 145 |
.md h1:first-child,.md h2:first-child{margin-top:0}
|
| 146 |
.md p{font-family:'Lora',serif;color:var(--body-ink);margin:9px 0;line-height:1.62;font-size:15px}
|
| 147 |
.md ul,.md ol{margin:9px 0 9px 22px;font-family:'Lora',serif;color:var(--body-ink);font-size:15px}
|
|
|
|
| 158 |
.md th{background:var(--sunken)}
|
| 159 |
.md hr{border:none;border-top:1px solid var(--hairline);margin:15px 0}
|
| 160 |
|
| 161 |
+
/* flash */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
.flash{background:var(--err-bg);color:var(--err);border:1px solid var(--orange);padding:12px 16px;font-family:'IBM Plex Mono',monospace;font-size:12.5px;margin-top:14px;border-radius:var(--r-sm);display:none;align-items:center;gap:10px}
|
| 163 |
.flash.show{display:flex}
|
| 164 |
.flash .x{margin-left:auto;cursor:pointer;opacity:.6;padding:2px 6px}
|
| 165 |
.flash .x:hover{opacity:1}
|
| 166 |
|
| 167 |
/* ββ Bench ββ */
|
| 168 |
+
#bench-well{background:var(--raised);border:1px solid var(--hairline);border-radius:var(--r);padding:20px;margin-top:18px;box-shadow:var(--sh1)}
|
| 169 |
+
#bench-well .label{font-family:'IBM Plex Mono',monospace;font-size:10.5px;letter-spacing:.14em;color:var(--soft);margin-bottom:14px;text-transform:uppercase;display:flex;align-items:center;gap:8px}
|
| 170 |
#bench-well .label::after{content:"";flex:1;height:1px;background:var(--hairline)}
|
| 171 |
+
.bench-row{display:grid;grid-template-columns:170px 1fr 80px;align-items:center;gap:14px;padding:8px 0}
|
| 172 |
.bench-row .who{font-family:'Inter',sans-serif;font-size:13.5px;color:var(--ink);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
| 173 |
.bench-row .who .params{color:var(--soft);font-family:'IBM Plex Mono',monospace;font-size:11px;margin-left:6px;font-weight:400}
|
| 174 |
.bench-track{height:10px;background:var(--sunken);border-radius:6px;overflow:hidden}
|
|
|
|
| 177 |
.bench-row.dim .bench-fill{opacity:.5}
|
| 178 |
.bench-row .score{font-family:'IBM Plex Mono',monospace;font-size:13px;text-align:right;font-variant-numeric:tabular-nums;color:var(--ink)}
|
| 179 |
.bench-row.win .score{color:var(--orange);font-weight:600}
|
| 180 |
+
#bench-well .note{font-family:'Lora',serif;font-style:italic;color:var(--body-ink);margin-top:12px;font-size:13.5px;line-height:1.5}
|
| 181 |
|
| 182 |
/* footer */
|
| 183 |
+
#footer-mono{font-family:'IBM Plex Mono',monospace;font-size:11.5px;letter-spacing:.06em;color:var(--soft);border-top:1px solid var(--hairline);padding-top:16px;margin-top:24px;padding-bottom:8px;display:flex;flex-wrap:wrap;gap:3px 0;align-items:center}
|
| 184 |
#footer-mono a{color:var(--ink);text-decoration:none;padding:3px;transition:color .15s}
|
| 185 |
#footer-mono a:hover{color:var(--orange)}
|
| 186 |
#footer-mono .sep{opacity:.4;margin:0 5px}
|
| 187 |
|
| 188 |
+
/* ββ Mobile ββ */
|
| 189 |
+
@media (max-width:600px){
|
| 190 |
+
.wrap{padding:max(20px,var(--safe-t)) 14px 22px}
|
| 191 |
+
#headline h1{font-size:38px}
|
| 192 |
+
#lead{font-size:16px}
|
| 193 |
+
.race-card{border-radius:var(--r)}
|
| 194 |
+
.card-section{padding:15px}
|
| 195 |
#input-row{flex-direction:column}
|
| 196 |
#example-select,#run-btn{flex:1;width:100%;min-width:0}
|
| 197 |
+
/* comparison strip stacks: pulpie / speedup / dripper */
|
| 198 |
+
.cmp-strip{grid-template-columns:1fr;gap:10px;padding:14px}
|
| 199 |
+
.cmp-center{flex-direction:row;gap:12px;min-width:0;padding:2px 0;justify-content:flex-start}
|
| 200 |
+
.cmp-center .sp-num{font-size:24px}
|
| 201 |
+
.cmp-center .sp-lbl{margin-top:0}
|
| 202 |
+
.chip{flex-direction:row;align-items:center;gap:14px;flex-wrap:wrap}
|
| 203 |
+
.chip-top{flex:1;min-width:120px}
|
| 204 |
+
.chip .bar{flex:1;min-width:80px}
|
| 205 |
+
.read-toolbar{padding:10px 14px}
|
| 206 |
+
.read-pane{padding:16px 16px;min-height:240px}
|
| 207 |
+
.bench-row{grid-template-columns:1fr 60px;gap:6px 12px}
|
| 208 |
.bench-row .who{grid-column:1/3}
|
| 209 |
.bench-row .bench-track{grid-column:1}
|
| 210 |
.bench-row .score{grid-column:2}
|
| 211 |
}
|
| 212 |
+
@media (max-width:420px){
|
| 213 |
#eyebrow{font-size:9.5px}
|
| 214 |
.pill{font-size:9px;padding:5px 9px}
|
| 215 |
+
#headline h1{font-size:32px}
|
| 216 |
+
.sp-num{font-size:22px}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
}
|
| 218 |
|
| 219 |
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
|
|
|
|
| 231 |
<div id="lead">Extract main content from HTML. One forward pass, not one token at a time.</div>
|
| 232 |
</div>
|
| 233 |
|
| 234 |
+
<!-- Unified race card -->
|
| 235 |
+
<div class="race-card">
|
| 236 |
+
<!-- input -->
|
| 237 |
+
<div class="card-section">
|
| 238 |
+
<div class="input-eyebrow">EXAMPLE PAGE</div>
|
| 239 |
+
<div id="input-row">
|
| 240 |
+
<select id="example-select" aria-label="Example page">
|
| 241 |
+
<option value="paulgraham.com">paulgraham.com</option>
|
| 242 |
+
<option value="nodejs.dev">nodejs.dev</option>
|
| 243 |
+
<option value="protobuf.dev">protobuf.dev</option>
|
| 244 |
+
<option value="istio.io">istio.io</option>
|
| 245 |
+
<option value="tutorialspoint.com">tutorialspoint.com</option>
|
| 246 |
+
<option value="builtin.com">builtin.com</option>
|
| 247 |
+
<option value="bbc.com">bbc.com</option>
|
| 248 |
+
<option value="theguardian.com">theguardian.com</option>
|
| 249 |
+
<option value="wikipedia.org">wikipedia.org</option>
|
| 250 |
+
<option value="stackoverflow.com">stackoverflow.com</option>
|
| 251 |
+
</select>
|
| 252 |
+
<button id="run-btn">
|
| 253 |
+
<svg class="bolt" viewBox="0 0 24 24" fill="currentColor"><path d="M13 2L4.5 13.5H11l-1 8.5L19.5 10H13z"/></svg>
|
| 254 |
+
<span class="spinner"></span>
|
| 255 |
+
<span class="btn-label">EXTRACT β</span>
|
| 256 |
+
</button>
|
| 257 |
+
</div>
|
| 258 |
+
<div id="html-accordion">
|
| 259 |
+
<div class="acc-header" id="acc-toggle" role="button" tabindex="0" aria-expanded="false">
|
| 260 |
+
<span class="chev"><span class="arw">βΈ</span>OR PASTE RAW HTML</span>
|
| 261 |
+
</div>
|
| 262 |
+
<div class="acc-body"><div class="acc-body-inner">
|
| 263 |
+
<textarea id="custom-html" placeholder="<html>β¦</html> (2 MB max; JS-rendered SPAs will come up empty β nothing static to extract)"></textarea>
|
| 264 |
+
<div class="acc-hint">If set, this overrides the example dropdown. β/Ctrl+Enter to run.</div>
|
| 265 |
+
</div></div>
|
| 266 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
</div>
|
|
|
|
| 268 |
|
| 269 |
+
<div class="card-divider"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
|
| 271 |
+
<!-- comparison strip (both models, always visible) -->
|
| 272 |
+
<div class="cmp-strip">
|
| 273 |
+
<div class="chip pulpie" id="pulpie-chip">
|
| 274 |
+
<div class="chip-top">
|
| 275 |
+
<div class="chip-name"><span class="led"></span>PULPIE <b>210M Β· ENCODER</b></div>
|
| 276 |
+
<div class="timer" id="pulpie-timer"></div>
|
| 277 |
+
</div>
|
| 278 |
+
<div class="bar"><div class="fill" id="pulpie-bar"></div></div>
|
| 279 |
</div>
|
| 280 |
+
<div class="cmp-center idle" id="cmp-center">
|
| 281 |
+
<div class="sp-num" id="sp-num">β</div>
|
| 282 |
+
<div class="sp-lbl" id="sp-lbl">Γ FASTER Β· ON THIS PAGE</div>
|
|
|
|
| 283 |
</div>
|
| 284 |
+
<div class="chip dripper" id="dripper-chip">
|
| 285 |
+
<div class="chip-top">
|
| 286 |
+
<div class="chip-name"><span class="led"></span>DRIPPER <b>0.6B Β· DECODER</b></div>
|
| 287 |
+
<div class="timer" id="dripper-timer"></div>
|
| 288 |
+
</div>
|
| 289 |
+
<div class="bar"><div class="fill" id="dripper-bar"></div></div>
|
| 290 |
</div>
|
| 291 |
</div>
|
| 292 |
+
|
| 293 |
+
<!-- toolbar: toggle + actions -->
|
| 294 |
+
<div class="read-toolbar">
|
| 295 |
+
<div class="toggle-seg" role="tablist" aria-label="Which model to read">
|
| 296 |
+
<button data-model="pulpie" class="active" role="tab" aria-selected="true"><span class="led"></span>PULPIE</button>
|
| 297 |
+
<button data-model="dripper" role="tab" aria-selected="false"><span class="led"></span>DRIPPER</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
</div>
|
| 299 |
+
<div class="toolbar-spacer"></div>
|
| 300 |
+
<button class="mini-btn" id="copy-btn">β§ COPY MD</button>
|
| 301 |
+
<button class="mini-btn" id="diff-btn">β DIFF</button>
|
| 302 |
</div>
|
| 303 |
+
|
| 304 |
+
<!-- single reading pane -->
|
| 305 |
+
<div class="read-pane" id="read-pane">
|
| 306 |
+
<div class="placeholder">One encoder forward pass over every block.</div>
|
| 307 |
+
</div>
|
| 308 |
+
<div id="status-line"></div>
|
| 309 |
</div>
|
| 310 |
|
|
|
|
|
|
|
| 311 |
<div class="flash" id="flash"><span id="flash-text"></span><span class="x" id="flash-x">β</span></div>
|
| 312 |
|
| 313 |
<!-- Bench -->
|
|
|
|
| 330 |
</div>
|
| 331 |
</div>
|
| 332 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
<script type="module">
|
| 334 |
import { Client } from "https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js";
|
| 335 |
import { marked } from "https://cdn.jsdelivr.net/npm/marked@12/lib/marked.esm.js";
|
|
|
|
| 338 |
|
| 339 |
const $ = (id) => document.getElementById(id);
|
| 340 |
const runBtn=$("run-btn"), btnLabel=runBtn.querySelector(".btn-label");
|
|
|
|
| 341 |
const exampleSelect=$("example-select"), customHtml=$("custom-html");
|
| 342 |
+
const readPane=$("read-pane");
|
| 343 |
+
const pulpieChip=$("pulpie-chip"), dripperChip=$("dripper-chip");
|
| 344 |
const pulpieTimer=$("pulpie-timer"), dripperTimer=$("dripper-timer");
|
| 345 |
const pulpieBar=$("pulpie-bar"), dripperBar=$("dripper-bar");
|
| 346 |
+
const cmpCenter=$("cmp-center"), spNum=$("sp-num"), spLbl=$("sp-lbl");
|
| 347 |
+
const statusLine=$("status-line");
|
| 348 |
+
const flashEl=$("flash"), flashText=$("flash-text");
|
| 349 |
const connPill=$("conn-pill"), connText=$("conn-text");
|
| 350 |
+
const copyBtn=$("copy-btn"), diffBtn=$("diff-btn");
|
| 351 |
|
| 352 |
const PLACEHOLDERS = {
|
| 353 |
pulpie:'<div class="placeholder">One encoder forward pass over every block.</div>',
|
| 354 |
dripper:'<div class="placeholder">The same labels, one token at a time.</div>',
|
| 355 |
};
|
| 356 |
+
const SKEL = '<div class="sk-line"></div><div class="sk-line"></div><div class="sk-line"></div><div class="sk-line"></div><div class="sk-line"></div>';
|
| 357 |
let lastMd = { pulpie:"", dripper:"" };
|
| 358 |
+
let running = false, currentModel = "pulpie";
|
| 359 |
|
| 360 |
function renderMarkdown(md){ if(!md) return ""; return DOMPurify.sanitize(marked.parse(md)); }
|
| 361 |
+
function renderRead(){
|
| 362 |
+
const md = lastMd[currentModel];
|
| 363 |
+
if(md) readPane.innerHTML = renderMarkdown(md);
|
| 364 |
+
else if(running) readPane.innerHTML = SKEL;
|
| 365 |
+
else readPane.innerHTML = PLACEHOLDERS[currentModel];
|
| 366 |
+
}
|
| 367 |
function setRunning(on){
|
| 368 |
+
running = on;
|
| 369 |
runBtn.classList.toggle("running", on); runBtn.disabled=on;
|
|
|
|
| 370 |
btnLabel.textContent = on ? "EXTRACTINGβ¦" : "EXTRACT β";
|
| 371 |
+
if(on || lastMd[currentModel]) renderRead();
|
| 372 |
}
|
| 373 |
function showError(msg){ flashText.textContent=msg; flashEl.classList.add("show"); }
|
| 374 |
function clearError(){ flashEl.classList.remove("show"); }
|
| 375 |
+
function setStatus(html){ if(!html){ statusLine.classList.remove("show"); statusLine.innerHTML=""; return; } statusLine.innerHTML=html; statusLine.classList.add("show"); }
|
| 376 |
function setBar(bar, pct, indeterminate){
|
| 377 |
bar.classList.toggle("indeterminate", !!indeterminate);
|
| 378 |
if(indeterminate){ bar.style.right=""; }
|
| 379 |
else { bar.style.right = (100-Math.max(0,Math.min(100,pct)))+"%"; }
|
| 380 |
}
|
| 381 |
+
function setSpeedupIdle(){ cmpCenter.classList.add("idle"); spNum.textContent="β"; spLbl.textContent="Γ FASTER Β· ON THIS PAGE"; }
|
| 382 |
+
function setSpeedup(num){
|
| 383 |
+
cmpCenter.classList.remove("idle");
|
| 384 |
+
spNum.textContent = num;
|
| 385 |
+
spLbl.textContent = "Γ FASTER Β· ON THIS PAGE";
|
| 386 |
+
}
|
| 387 |
+
// Pull the speedup token ("12x" / "9.4x") out of the backend's verdict HTML:
|
| 388 |
+
// <div ...>PULPIE 0.42s β DRIPPER 2.8s Β· <span ...>12x ON THIS PAGE</span></div>
|
| 389 |
+
function applyVerdict(v){
|
| 390 |
+
if(!v){ return; }
|
| 391 |
+
const m = v.match(/<span[^>]*>\s*([\d.]+x)\s+ON THIS PAGE\s*<\/span>/);
|
| 392 |
+
if(m){ setSpeedup(m[1]); setStatus(""); }
|
| 393 |
+
else { setSpeedupIdle(); setStatus(v); } // plain-text verdict (bad input / error)
|
| 394 |
+
}
|
| 395 |
|
| 396 |
function resetPanes(){
|
| 397 |
+
lastMd={pulpie:"",dripper:""};
|
| 398 |
+
pulpieChip.classList.remove("live"); dripperChip.classList.remove("live");
|
|
|
|
| 399 |
pulpieTimer.innerHTML=""; dripperTimer.innerHTML="";
|
| 400 |
+
setBar(pulpieBar,0); setBar(dripperBar,0);
|
| 401 |
+
setSpeedupIdle(); setStatus(""); clearError();
|
| 402 |
+
renderRead();
|
| 403 |
}
|
| 404 |
|
| 405 |
function normalizeRecord(d){
|
|
|
|
| 412 |
function applyRecord(rec){
|
| 413 |
if(!rec) return;
|
| 414 |
if(rec.pulpie_md!==undefined && rec.pulpie_md!==""){
|
| 415 |
+
lastMd.pulpie=rec.pulpie_md;
|
| 416 |
+
pulpieChip.classList.add("live");
|
| 417 |
+
setBar(pulpieBar,100);
|
| 418 |
+
setTimeout(()=>pulpieChip.classList.remove("live"),900);
|
| 419 |
+
if(currentModel==="pulpie") renderRead();
|
| 420 |
}
|
| 421 |
if(rec.dripper_md!==undefined && rec.dripper_md!==""){
|
| 422 |
+
lastMd.dripper=rec.dripper_md;
|
| 423 |
+
dripperChip.classList.add("live");
|
| 424 |
+
if(currentModel==="dripper") renderRead();
|
| 425 |
}
|
| 426 |
if(rec.pulpie_timer!==undefined) pulpieTimer.innerHTML=rec.pulpie_timer;
|
| 427 |
if(rec.dripper_timer!==undefined) dripperTimer.innerHTML=rec.dripper_timer;
|
| 428 |
+
// dripper progress: indeterminate while streaming, full when the verdict lands
|
| 429 |
+
if(rec.dripper_md && !(rec.verdict)){ setBar(dripperBar,0,true); }
|
| 430 |
+
if(rec.verdict!==undefined && rec.verdict!==""){
|
| 431 |
+
applyVerdict(rec.verdict);
|
| 432 |
+
dripperChip.classList.remove("live");
|
| 433 |
+
setBar(dripperBar,100);
|
| 434 |
+
}
|
| 435 |
}
|
| 436 |
|
| 437 |
// ββ Connect ββ
|
|
|
|
| 448 |
async function run(){
|
| 449 |
if(!client){ showError("Backend not connected. Reload the page."); return; }
|
| 450 |
resetPanes(); setRunning(true);
|
|
|
|
| 451 |
const params = { example_name: exampleSelect.value, custom_html: customHtml.value.trim() };
|
| 452 |
try {
|
| 453 |
const submission = client.submit("/race", params);
|
|
|
|
| 455 |
for await (const msg of submission){
|
| 456 |
if(msg.type==="status"){
|
| 457 |
if(msg.stage==="pending" && msg.position!=null){
|
| 458 |
+
setStatus('<span style="color:var(--soft)">QUEUED Β· POSITION '+msg.position+'</span>');
|
| 459 |
+
} else if(msg.stage==="generating"){ if(!sawData) setStatus(""); }
|
| 460 |
continue;
|
| 461 |
}
|
| 462 |
if(msg.type==="data"){ sawData=true; applyRecord(normalizeRecord(msg.data)); }
|
| 463 |
}
|
| 464 |
if(!sawData) showError("Backend returned no data. Check the /race endpoint and Space logs.");
|
| 465 |
+
} catch(e){ showError("Race failed: " + (e?.message||e)); }
|
| 466 |
+
finally { setRunning(false); }
|
|
|
|
| 467 |
}
|
| 468 |
runBtn.addEventListener("click", run);
|
|
|
|
| 469 |
exampleSelect.addEventListener("keydown", e=>{ if(e.key==="Enter"){ e.preventDefault(); run(); } });
|
| 470 |
customHtml.addEventListener("keydown", e=>{ if(e.key==="Enter" && (e.metaKey||e.ctrlKey)){ e.preventDefault(); run(); } });
|
| 471 |
|
|
|
|
| 474 |
accToggle.addEventListener("click", ()=>{ const o=acc.classList.toggle("open"); accToggle.setAttribute("aria-expanded", o); });
|
| 475 |
accToggle.addEventListener("keydown", e=>{ if(e.key==="Enter"||e.key===" "){ e.preventDefault(); accToggle.click(); } });
|
| 476 |
|
| 477 |
+
// ββ Model toggle ββ
|
| 478 |
+
document.querySelectorAll(".toggle-seg button").forEach(b=>{
|
| 479 |
b.addEventListener("click", ()=>{
|
| 480 |
+
currentModel = b.getAttribute("data-model");
|
| 481 |
+
document.querySelectorAll(".toggle-seg button").forEach(x=>{ const on=x===b; x.classList.toggle("active",on); x.setAttribute("aria-selected",on); });
|
| 482 |
+
renderRead();
|
|
|
|
| 483 |
});
|
| 484 |
});
|
| 485 |
|
| 486 |
// ββ Flash dismiss ββ
|
| 487 |
$("flash-x").addEventListener("click", clearError);
|
| 488 |
|
| 489 |
+
// ββ Copy ββ
|
| 490 |
+
copyBtn.addEventListener("click", async ()=>{
|
| 491 |
+
const text = lastMd[currentModel];
|
| 492 |
+
if(!text) return;
|
| 493 |
+
try { await navigator.clipboard.writeText(text); copyBtn.textContent="β COPIED"; }
|
| 494 |
+
catch { copyBtn.textContent="COPY FAILED"; }
|
| 495 |
+
setTimeout(()=>(copyBtn.textContent="β§ COPY MD"), 1400);
|
|
|
|
|
|
|
| 496 |
});
|
| 497 |
+
|
| 498 |
+
// ββ Diff (against the other model, shown in the single reading pane) ββ
|
| 499 |
+
let diffOpen=false, diffForModel=null;
|
| 500 |
+
diffBtn.addEventListener("click", ()=>{
|
| 501 |
+
if(diffOpen && diffForModel===currentModel){ renderRead(); diffOpen=false; diffBtn.textContent="β DIFF"; return; }
|
| 502 |
+
const other = currentModel==="pulpie" ? "dripper" : "pulpie";
|
| 503 |
+
if(!lastMd[currentModel] || !lastMd[other]) return;
|
| 504 |
+
const a=lastMd.pulpie, b=lastMd.dripper, same=a.trim()===b.trim();
|
| 505 |
+
if(same){
|
| 506 |
+
readPane.innerHTML = renderMarkdown(lastMd[currentModel]) +
|
| 507 |
+
'<div style="font-family:\'IBM Plex Mono\',monospace;font-size:11px;color:var(--green);margin-top:14px;border-top:1px solid var(--hairline);padding-top:10px;">β IDENTICAL OUTPUTS β PULPIE & DRIPPER MATCH</div>';
|
| 508 |
+
diffBtn.textContent="IDENTICAL";
|
| 509 |
+
} else {
|
| 510 |
+
readPane.innerHTML = '<pre style="white-space:pre-wrap;font-family:\'IBM Plex Mono\',monospace;font-size:12px;line-height:1.5;background:var(--sunken);border:1px solid var(--hairline);padding:12px;border-radius:8px;">'+escapeHtml(lineDiff(a,b))+'</pre>';
|
| 511 |
+
diffBtn.textContent="β© BACK";
|
| 512 |
+
}
|
| 513 |
+
diffOpen=true; diffForModel=currentModel;
|
|
|
|
|
|
|
| 514 |
});
|
| 515 |
|
| 516 |
function lineDiff(a,b){
|