wrapped-agents 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/SKILL.md +7 -5
- package/package.json +10 -3
- package/page/story.html +213 -83
- package/src/cli.mjs +18 -2
- package/src/readers/_sqlite.mjs +43 -0
- package/src/readers/_util.mjs +21 -0
- package/src/readers/cursor.mjs +325 -0
- package/src/readers/gemini-cli.mjs +323 -0
- package/src/readers/index.mjs +6 -2
- package/src/readers/opencode.mjs +343 -0
- package/src/readers/qwen-code.mjs +8 -0
- package/src/site.mjs +5 -4
- package/src/stats/awards.mjs +12 -1
- package/src/stats/compare.mjs +24 -0
- package/src/stats/index.mjs +29 -5
- package/src/stats/roast.mjs +1 -1
- package/src/stats/tiers.mjs +11 -8
- package/src/stats/twin.mjs +2 -2
package/page/story.html
CHANGED
|
@@ -11,7 +11,11 @@ html{background:#070707}
|
|
|
11
11
|
body{color:var(--fg);font-family:var(--body);-webkit-font-smoothing:antialiased;overscroll-behavior-y:none}
|
|
12
12
|
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;-webkit-tap-highlight-color:transparent}
|
|
13
13
|
/* ---------- the stage: one 9:16 frame ---------- */
|
|
14
|
-
#stage{position:relative;height:100vh;height:100dvh;display:grid;place-items:center;overflow:hidden;
|
|
14
|
+
#stage{position:relative;height:100vh;height:100dvh;display:grid;place-items:center;overflow:hidden;isolation:isolate}
|
|
15
|
+
/* the world behind the frame: the skin's own background, blurred and dimmed, lit by its accents (never part of an export) */
|
|
16
|
+
#stage::before{content:"";position:absolute;inset:-90px;z-index:-2;transform:translateZ(0);filter:blur(44px) saturate(1.35) brightness(var(--wdim,.6));background:radial-gradient(44% 54% at 14% 20%,color-mix(in srgb,var(--li) 55%,transparent),transparent 72%),radial-gradient(48% 58% at 88% 82%,color-mix(in srgb,var(--pk) 50%,transparent),transparent 72%),radial-gradient(38% 42% at 78% 8%,color-mix(in srgb,var(--lv) 34%,transparent),transparent 72%),var(--bg)}
|
|
17
|
+
#stage::after{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(80% 90% at 50% 50%,transparent 40%,#0008)}
|
|
18
|
+
#stage.full::before,#stage.full::after{display:none}
|
|
15
19
|
#frame{position:relative;overflow:hidden;background:var(--bg);user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;touch-action:pan-y;-webkit-tap-highlight-color:transparent;contain:layout paint}
|
|
16
20
|
#frame.boxed{border-radius:22px;box-shadow:0 40px 120px #000a,0 0 0 1px #ffffff14}
|
|
17
21
|
#view{position:absolute;left:0;top:0;transform-origin:0 0}
|
|
@@ -23,10 +27,14 @@ button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;-webki
|
|
|
23
27
|
#b-save{right:12px}
|
|
24
28
|
#toast{position:absolute;z-index:7;left:50%;bottom:22px;transform:translate(-50%,20px);opacity:0;pointer-events:none;background:var(--pp);color:var(--opp);font:600 14px/1 var(--fm);padding:12px 16px;border-radius:99px;white-space:nowrap;transition:opacity .25s,transform .35s cubic-bezier(.2,.9,.3,1.2)}
|
|
25
29
|
#toast.on{opacity:1;transform:translate(-50%,0)}
|
|
26
|
-
.nav{position:absolute;top:50%;width:52px;height:52px;margin-top:-26px;border-radius:50%;display:grid;place-items:center;color:#fff;background:#
|
|
27
|
-
.nav:hover{opacity:1;background:#
|
|
30
|
+
.nav{position:absolute;top:50%;width:52px;height:52px;margin-top:-26px;border-radius:50%;display:grid;place-items:center;color:#fff;background:#00000059;box-shadow:inset 0 0 0 1px #ffffff26;opacity:.8;transition:opacity .2s,background .2s}
|
|
31
|
+
.nav:hover{opacity:1;background:#000000a6}.nav svg{width:22px;height:22px}
|
|
28
32
|
.nav[hidden]{display:none}
|
|
29
|
-
#cue{position:absolute;bottom:10px;left:50%;margin-left:-14px;width:28px;height:28px;color:#fff;opacity:.
|
|
33
|
+
#cue{position:absolute;bottom:10px;left:50%;margin-left:-14px;width:28px;height:28px;color:#fff;opacity:.6;filter:drop-shadow(0 1px 2px #000c)}
|
|
34
|
+
button:focus-visible{outline:3px solid var(--chrome,var(--fg));outline-offset:3px}
|
|
35
|
+
.nav:focus-visible,.wbar button:focus-visible{outline-color:#fff;opacity:1}
|
|
36
|
+
.slide button:focus-visible{outline:7px solid var(--fg);outline-offset:6px}
|
|
37
|
+
html.embed,html.embed body{overflow:hidden;height:100%}html.embed #report,html.embed #cue,html.embed [data-act=report]{display:none!important}
|
|
30
38
|
/* ---------- slides: 1080 wide, 1920+ tall, scaled into the frame ---------- */
|
|
31
39
|
.slide{position:absolute;inset:0;overflow:hidden;background:var(--bg);color:var(--fg);display:flex;flex-direction:column;padding:104px 44px 44px;font-family:var(--body);font-variant-numeric:tabular-nums;-webkit-font-smoothing:antialiased;text-rendering:geometricPrecision}
|
|
32
40
|
.slide.x{padding-top:60px}
|
|
@@ -43,16 +51,17 @@ button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;-webki
|
|
|
43
51
|
.lab{font-size:30px;opacity:.62}
|
|
44
52
|
.pill{display:inline-block;border-radius:99px;padding:14px 28px;font-size:30px;background:var(--pp);color:var(--opp);white-space:nowrap}
|
|
45
53
|
.fit{white-space:nowrap}
|
|
46
|
-
.top{flex:none;display:flex;justify-content:space-between;align-items:center;font-size:30px;margin-bottom:46px}
|
|
54
|
+
.top{flex:none;display:flex;justify-content:space-between;align-items:center;font-size:30px;margin-bottom:46px;padding-right:70px}
|
|
55
|
+
.caret{display:inline-block;width:.55em;height:1.05em;margin-left:4px;vertical-align:-.18em;background:currentColor;animation:caret 1.1s steps(1) infinite}@keyframes caret{50%{opacity:0}}
|
|
47
56
|
.foot{flex:none;margin-top:auto;padding-top:34px;display:flex;justify-content:space-between;align-items:center;gap:20px}
|
|
48
57
|
.gh{display:inline-flex;align-items:center;gap:12px;white-space:nowrap}
|
|
49
58
|
.gh svg{fill:currentColor;flex:none}
|
|
50
59
|
.logo{flex:none;border-radius:calc(var(--r) * 1.2);background:var(--lg);display:grid;grid-template-columns:repeat(5,1fr);gap:9px;padding:30px}
|
|
51
60
|
.logo i{border-radius:7px}
|
|
52
|
-
.logo{overflow:hidden}
|
|
61
|
+
.logo{overflow:hidden;color:var(--lgc,var(--ink))}
|
|
53
62
|
.logo .lw{grid-column:1/-1;grid-row:1/-1;padding:14px;display:grid;min-width:0;min-height:0;overflow:hidden}
|
|
54
63
|
.logo .lw svg,.mark svg{display:block;width:100%;height:100%;min-height:0}
|
|
55
|
-
.mark{display:grid;place-items:center;flex:none}
|
|
64
|
+
.mark{display:grid;place-items:center;flex:none;color:var(--mkc,var(--fg))}
|
|
56
65
|
.mark svg{width:100%;height:100%}
|
|
57
66
|
.bar{display:block;height:100%;transform-origin:0 50%}
|
|
58
67
|
.hl{background:var(--ink);color:var(--li);padding:0 14px;border-radius:12px;font-weight:800}
|
|
@@ -68,16 +77,22 @@ button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;-webki
|
|
|
68
77
|
.heat b{flex:1;display:flex;flex-direction:column;gap:4px}
|
|
69
78
|
.heat i{aspect-ratio:1;border-radius:3px;background:var(--sf)}
|
|
70
79
|
/* receipt */
|
|
71
|
-
.paper{background:var(--paper);color:#111;border-radius:6px;padding:
|
|
80
|
+
.paper{background:var(--paper);color:#111;border-radius:6px;padding:50px 60px 66px;font:600 31px/1.45 "JetBrains Mono","Commit Mono",monospace;-webkit-mask:radial-gradient(14px at 50% 100%,#0000 98%,#000) 0 0/40px 100%;mask:radial-gradient(14px at 50% 100%,#0000 98%,#000) 0 0/40px 100%;display:flex;flex-direction:column}
|
|
72
81
|
.paper .ln{display:flex;justify-content:space-between;gap:20px}
|
|
73
82
|
.paper .sub{opacity:.55;font-size:25px;margin-bottom:10px}
|
|
74
83
|
.paper hr{border:0;border-top:4px dashed #111;margin:26px 0}
|
|
84
|
+
/* quiz */
|
|
85
|
+
.qz{display:flex;align-items:center;gap:30px;width:100%;height:190px;padding:0 44px;background:var(--sf);color:var(--fg);text-align:left;transition:background .3s,color .3s,opacity .3s}
|
|
86
|
+
.qz .qs{opacity:0;transition:opacity .3s}
|
|
87
|
+
.qz.qy{background:var(--li);color:var(--ink)}.qz.qy .qs{opacity:1}
|
|
88
|
+
.qz.qn{opacity:.4}
|
|
75
89
|
/* share controls */
|
|
76
90
|
.btn{display:flex;align-items:center;justify-content:center;gap:16px;border-radius:calc(var(--r) * .7 + 10px);font-size:40px;height:118px;padding:0 34px;cursor:pointer;white-space:nowrap}
|
|
77
91
|
.btn svg{width:40px;height:40px;flex:none}
|
|
78
92
|
.seg3{display:flex;border-radius:99px;background:var(--sf);padding:8px;gap:6px}
|
|
79
|
-
.seg3 button{flex:1;height:84px;border-radius:99px;font-size:30px;font-family:var(--fm);font-weight:600;letter-spacing:.04em;opacity:.7}
|
|
80
|
-
.seg3 button
|
|
93
|
+
.seg3 button{flex:1;height:84px;border-radius:99px;font-size:30px;font-family:var(--fm);font-weight:600;letter-spacing:.04em;opacity:.7;transition:opacity .2s}
|
|
94
|
+
.seg3 button:hover{opacity:1}
|
|
95
|
+
.seg3 button[aria-pressed=true]{background:var(--pp);color:var(--opp);opacity:1}
|
|
81
96
|
.sw{width:64px;height:64px;border-radius:50%;flex:none;box-shadow:inset 0 0 0 3px #ffffff30}
|
|
82
97
|
.sw[aria-pressed=true]{outline:5px solid var(--fg);outline-offset:6px}
|
|
83
98
|
.tog{display:flex;align-items:center;gap:22px;font-size:32px}
|
|
@@ -110,7 +125,7 @@ button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;-webki
|
|
|
110
125
|
.rl b{font-weight:700;min-width:140px}
|
|
111
126
|
.rl span{opacity:.7}
|
|
112
127
|
#host{position:fixed;left:-40000px;top:0;pointer-events:none;contain:strict}
|
|
113
|
-
@media (prefers-reduced-motion:reduce){#toast,.tog i,.tog i::after{transition:none}}
|
|
128
|
+
@media (prefers-reduced-motion:reduce){.caret{animation:none}#toast,.tog i,.tog i::after,.qz,.qz .qs{transition:none}}
|
|
114
129
|
</style>
|
|
115
130
|
</head><body>
|
|
116
131
|
<main id="stage">
|
|
@@ -250,9 +265,9 @@ if (typeof location !== 'undefined' && /[?&]embed=1/.test(location.search)) docu
|
|
|
250
265
|
typeof addEventListener === 'function' && addEventListener('message', e => { const m = e.data; if (m && m.awSkin && window.AW && window.AW.setSkin) window.AW.setSkin(m.awSkin); });
|
|
251
266
|
const SITE = 'https://leonardodaviti.github.io/agent-wrapped/', REPO = 'leonardodaviti/agent-wrapped';
|
|
252
267
|
const HARNESS = { 'claude-code': 'Claude Code', codex: 'Codex', pi: 'Pi', 'mistral-vibe': 'Mistral Vibe', opencode: 'OpenCode', hermes: 'Hermes', 'gemini-cli': 'Gemini CLI', cursor: 'Cursor', copilot: 'Copilot CLI', goose: 'Goose', aider: 'Aider', cline: 'Cline' };
|
|
253
|
-
const LABELS = { harness: 'Harness of the Year', model: 'Model of the Year', tokens: 'Tokens', spendings: 'Spendings', prompts: 'Prompts', sessions: 'Sessions', streak: 'Streak', marathon: 'Marathon', swarm: 'Swarm', peakHour: 'Peak hour', politeness: 'Politeness', backseat: 'Backseat driver', lines: 'Lines written', mostResumed: 'Most resumed', wordOfYear: 'Word of the Year', agentClass: 'Agent class', tier: 'Top X%', skill: 'Skill of the Year', rateLimits: 'Rate limits', age: 'Agentic Age', twin: 'Agent Twin', youreRight: '“You’re right”', modelRace: 'Model race', caps: 'ALL CAPS', screenshots: 'Screenshots', compactions: 'Compactions', prs: 'Shipped', ctrlZ: 'Ctrl+Z Award', roast: 'Roast' };
|
|
268
|
+
const LABELS = { harness: 'Harness of the Year', model: 'Model of the Year', tokens: 'Tokens', spendings: 'Spendings', prompts: 'Prompts', sessions: 'Sessions', streak: 'Streak', marathon: 'Marathon', swarm: 'Swarm', peakHour: 'Peak hour', politeness: 'Politeness', backseat: 'Backseat driver', lines: 'Lines written', mostResumed: 'Most resumed', wordOfYear: 'Word of the Year', agentClass: 'Agent class', tier: 'Top X%', skill: 'Skill of the Year', tool: 'Tool of the Year', rateLimits: 'Rate limits', age: 'Agentic Age', twin: 'Agent Twin', youreRight: '“You’re right”', modelRace: 'Model race', caps: 'ALL CAPS', screenshots: 'Screenshots', compactions: 'Compactions', prs: 'Shipped', ctrlZ: 'Ctrl+Z Award', roast: 'Roast' };
|
|
254
269
|
// order in which award values ride along in the QR link (most wanted first)
|
|
255
|
-
const QR_AWARDS = ['peakHour', 'politeness', 'backseat', 'youreRight', 'spendings', 'marathon', 'wordOfYear', 'lines', 'ctrlZ', 'prs', '
|
|
270
|
+
const QR_AWARDS = ['tool', 'skill', 'peakHour', 'politeness', 'backseat', 'youreRight', 'spendings', 'marathon', 'wordOfYear', 'lines', 'ctrlZ', 'prs', 'rateLimits', 'mostResumed', 'screenshots', 'caps', 'compactions', 'modelRace'];
|
|
256
271
|
|
|
257
272
|
/** the compact subset that travels in the #d= fragment; drops optional fields until the QR fits (v15, ECC M) */
|
|
258
273
|
function compact(W, maxBytes = QR.capacity(15)) {
|
|
@@ -273,6 +288,11 @@ function compact(W, maxBytes = QR.capacity(15)) {
|
|
|
273
288
|
...QR_AWARDS.map(id => o => aw[id] && ((o.a = o.a || {})[id] = aw[id])),
|
|
274
289
|
o => W.twin?.why && (o.X = [W.twin.name, W.twin.match, W.twin.why]),
|
|
275
290
|
o => W.spendings?.usd && (o.u = [W.spendings.usd, W.spendings.perDay || 0]),
|
|
291
|
+
o => W.compare?.text && (o.c = W.compare.text),
|
|
292
|
+
o => W.quiz?.choices?.includes(W.quiz.answer) && (o.q = [...W.quiz.choices.slice(0, 3), W.quiz.choices.indexOf(W.quiz.answer)]),
|
|
293
|
+
o => W.busiest?.date && (o.b = [W.busiest.date, W.busiest.prompts ?? null, W.busiest.peakHour ?? null]),
|
|
294
|
+
o => W.busiest?.date && W.dayLine && (o.b = [W.busiest.date, W.busiest.prompts ?? null, W.busiest.peakHour ?? null, W.dayLine]),
|
|
295
|
+
o => W.roastBy && (o.w = W.roastBy),
|
|
276
296
|
];
|
|
277
297
|
const size = o => SITE.length + 3 + B64U.enc(JSON.stringify(o)).length;
|
|
278
298
|
let o = base;
|
|
@@ -293,7 +313,9 @@ function expand(c) {
|
|
|
293
313
|
models: (c.M || []).map(([label, s]) => ({ label, share: s / 100 })),
|
|
294
314
|
series: {}, spendings: c.u ? { usd: c.u[0], perDay: c.u[1], byModel: [] } : null,
|
|
295
315
|
tier: c.T ? { label: c.T[0], power: c.T[1] || '' } : null, age: c.A != null ? { years: c.A, why: [] } : null,
|
|
296
|
-
twin: c.X ? { name: c.X[0], match: c.X[1], why: c.X[2] || '' } : null, awards, roast: c.r || null,
|
|
316
|
+
twin: c.X ? { name: c.X[0], match: c.X[1], why: c.X[2] || '' } : null, awards, roast: c.r || null, compare: c.c ? { text: c.c } : null,
|
|
317
|
+
quiz: c.q ? { choices: c.q.slice(0, -1), answer: c.q[c.q.at(-1)], share: (c.M?.[0]?.[0] === c.q[c.q.at(-1)] ? c.M[0][1] : 0) / 100 } : null,
|
|
318
|
+
busiest: c.b ? { date: c.b[0], prompts: c.b[1], peakHour: c.b[2] } : null, dayLine: c.b?.[3] || null, roastBy: c.w || null, privacy: { projectsHidden: true } };
|
|
297
319
|
}
|
|
298
320
|
// </share>
|
|
299
321
|
|
|
@@ -326,12 +348,22 @@ if (W?.theme?.yours && typeof W.theme.yours === 'object') {
|
|
|
326
348
|
const SKINS = Object.keys(SK);
|
|
327
349
|
// free bundled faces stand in when a brand face is not installed (all OFL, inlined by render.mjs)
|
|
328
350
|
const withFallback = v => v.replace(/(^|,)\s*Inter\b(?![^,]*")/, '$1Inter,"Mona Sans"').replace(/"JetBrains Mono"/, '"JetBrains Mono","Commit Mono"').replace(/"EB Garamond"/, '"EB Garamond",Lora');
|
|
351
|
+
// WCAG contrast between two CSS colours (a gradient counts as its last, solid layer); best(bg, a, b…) → the option that reads best on bg
|
|
352
|
+
const lum = v => { let h = (String(v || '').match(/#[0-9a-f]{3,8}\b/gi) || []).pop(); if (!h) return null; h = h.slice(1); if (h.length < 6) h = [...h].map(c => c + c).join(''); return [0, 2, 4].reduce((s, i, n) => { const c = parseInt(h.slice(i, i + 2), 16) / 255; return s + (c <= .03928 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4) * [.2126, .7152, .0722][n]; }, 0); };
|
|
353
|
+
const contrast = (a, b) => { const x = lum(a), y = lum(b); return x == null || y == null ? 0 : (Math.max(x, y) + .05) / (Math.min(x, y) + .05); };
|
|
354
|
+
const best = (bg, ...opts) => opts.reduce((a, b) => contrast(b, bg) > contrast(a, bg) ? b : a);
|
|
329
355
|
let skin = SK[Q.get('skin')] ? Q.get('skin') : SK[W?.theme?.skin] ? W.theme.skin : 'wrapped';
|
|
330
356
|
function applySkin(name) {
|
|
331
357
|
skin = SK[name] ? name : 'wrapped';
|
|
332
358
|
const st = document.documentElement.style, k = SK[skin];
|
|
333
359
|
TOKENS.forEach(t => st.removeProperty('--' + t));
|
|
334
360
|
for (const [a, b] of Object.entries(k)) if (a !== 'logo') st.setProperty('--' + a, a === 'fd' || a === 'fm' ? withFallback(b) : b);
|
|
361
|
+
// derived: what a currentColor logo wears on the logo tile (--lg) and on an ink badge, and for "yours" the text on its pill / blue tile
|
|
362
|
+
const cs = getComputedStyle(document.documentElement), g = t => cs.getPropertyValue('--' + t).trim();
|
|
363
|
+
st.setProperty('--lgc', best(g('lg'), g('ink'), g('fg'))); st.setProperty('--mkc', best(g('ink'), g('fg'), g('lg')));
|
|
364
|
+
st.setProperty('--lit', contrast(g('li'), g('bg')) >= 2.2 ? g('li') : ['gr', 'bl', 'or', 'pk', 'lv'].map(g).find(c => contrast(c, g('bg')) >= 2.5) || g('fg')); // accent text on the slide background
|
|
365
|
+
st.setProperty('--wdim', lum(g('bg')) > .35 ? '.82' : '.6'); // a light skin keeps a light world
|
|
366
|
+
if (skin === 'yours') { k.opp || st.setProperty('--opp', best(g('pp'), g('ink'), g('fg'))); k.obl || st.setProperty('--obl', best(g('bl'), g('ink'), g('fg'))); }
|
|
335
367
|
document.documentElement.dataset.skin = skin;
|
|
336
368
|
}
|
|
337
369
|
|
|
@@ -365,7 +397,28 @@ const logoTile = (px = 264) => {
|
|
|
365
397
|
};
|
|
366
398
|
const top = (dark) => `<div class="top M N in"${dark ? ' style="color:var(--ink)"' : ''}><span class="gh">${GH(32)}${esc(handle())}${W.year ? `<span style="opacity:.55">· ${W.year}</span>` : ''}</span></div>`;
|
|
367
399
|
const INSTALL = 'npx wrapped-agents';
|
|
368
|
-
const
|
|
400
|
+
const CTA = () => `wrap my ${W?.year || 'year'}`;
|
|
401
|
+
// the call to action under every card, on one line: the hook, then the exact command in a code pill
|
|
402
|
+
// the CTA typed into the current skin's own agent input box (one box, one line; caret blinks live, still in exports)
|
|
403
|
+
const CHAT = {
|
|
404
|
+
'claude-code': { box: 'border:3px solid #8a8a8a;border-radius:18px;padding:20px 28px', p: '<b style="color:#8a8a8a">></b>', cmd: '#d77757' },
|
|
405
|
+
codex: { box: 'background:color-mix(in srgb,currentColor 9%,transparent);padding:22px 28px', p: '<b>›</b>', cmd: null },
|
|
406
|
+
'gemini-cli': { box: 'border:3px solid transparent;border-radius:16px;padding:20px 28px;background:linear-gradient(#0b0b0b,#0b0b0b) padding-box,linear-gradient(90deg,#4796e4,#847ace,#c3677f) border-box;color:#f3f0e8', p: '<b style="color:#847ace">></b>', cmd: '#4796e4' },
|
|
407
|
+
'mistral-vibe': { box: 'border:3px solid transparent;border-radius:6px;padding:20px 28px;background:linear-gradient(#000,#000) padding-box,linear-gradient(90deg,#ffd800,#ff8205,#e10500) border-box;color:#fff', p: '<b style="color:#ff8205">></b>', cmd: '#ffd800' },
|
|
408
|
+
opencode: { box: 'border-left:8px solid #fab283;background:color-mix(in srgb,currentColor 8%,transparent);padding:22px 28px', p: '', cmd: '#fab283', meta: 'Build · wrapped-agents' },
|
|
409
|
+
pi: { box: 'border-top:3px solid currentColor;border-bottom:3px solid currentColor;padding:18px 4px', p: '', cmd: null },
|
|
410
|
+
cursor: { box: 'background:#1d1d1d;color:#e4e4e4;border:2px solid #343434;border-radius:22px;padding:22px 28px', p: '', cmd: '#e4e4e4', meta: 'Agent ▾ Auto', send: '#e4e4e4;color:#1d1d1d' },
|
|
411
|
+
anthropic: { box: 'background:#fff;color:#141413;border:2px solid #e3dfd5;border-radius:28px;padding:22px 28px;box-shadow:0 6px 20px rgba(0,0,0,.08)', p: '', cmd: '#c6613f', sans: 1, send: '#c6613f;color:#fff' },
|
|
412
|
+
};
|
|
413
|
+
const foot = () => {
|
|
414
|
+
const c = CHAT[skin === 'qwen-code' ? 'gemini-cli' : skin] || { box: 'border:3px solid currentColor;border-radius:16px;padding:20px 28px', p: '<b>❯</b>', cmd: null };
|
|
415
|
+
const font = c.sans ? 'font:500 34px/1.25 var(--body)' : 'font:500 31px/1.25 var(--fm)';
|
|
416
|
+
const text = `${CTA()} with <span style="${c.cmd ? `color:${c.cmd};` : ''}font-weight:700">${INSTALL}</span><span class="caret"${c.sans ? ' style="width:3px"' : ''}></span>`;
|
|
417
|
+
const send = c.send ? `<span style="flex:none;margin-left:auto;width:54px;height:54px;border-radius:${c.sans ? 14 : 99}px;display:grid;place-items:center;background:${c.send};font:700 30px/1 var(--body)">↑</span>` : '';
|
|
418
|
+
return `<div class="foot" style="display:block;white-space:nowrap"><div class="chat" style="${c.box};${font};letter-spacing:0;text-transform:none;text-align:left">
|
|
419
|
+
<div style="display:flex;align-items:center;gap:16px">${c.p ? `<span style="flex:none">${c.p}</span>` : ''}<span style="overflow:hidden;text-overflow:ellipsis">${text}</span>${c.meta ? '' : send}</div>
|
|
420
|
+
${c.meta ? `<div style="display:flex;align-items:center;gap:16px;margin-top:14px;font-size:22px;opacity:.6">${c.meta}${send ? `<span style="margin-left:auto;opacity:1">${send}</span>` : ''}</div>` : ''}</div></div>`;
|
|
421
|
+
};
|
|
369
422
|
const cnt = (v, f = 'n', to = v) => `<span data-n="${v}" data-f="${f}" data-to="${to}">${FMT[f](v, to)}</span>`;
|
|
370
423
|
const COLORS = ['li', 'pk', 'lv', 'or', 'bl'];
|
|
371
424
|
|
|
@@ -376,10 +429,15 @@ const S = {};
|
|
|
376
429
|
S.tokens = {
|
|
377
430
|
ok: () => T().tokens > 0, dur: 5500, chrome: 'ink',
|
|
378
431
|
html: () => {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
const
|
|
432
|
+
// the comparison comes from the stats engine (a different work each run, counted on input + output only); old wrap files fall back to the fixed line
|
|
433
|
+
const t = T().tokens, hp = t / 1.45e6, cmp = typeof W.compare?.text === 'string' && W.compare.text.trim(), hl = x => `<b class="hl">${x}</b>`;
|
|
434
|
+
// highlight the multiple: the engine's own number when the text carries it (a title like "1984" must not win), else the number before "times", else the first one
|
|
435
|
+
const x2 = +(+W.compare?.times || 0).toPrecision(2), opt = cmp && (W.compare.options || []).find(o => o?.times && cmp.includes(o.work) && cmp.includes(o.times));
|
|
436
|
+
const want = opt ? String(opt.times) : x2 >= 100 ? N(x2) : x2 >= 10 ? x2.toFixed(0) : x2 ? x2.toFixed(1) : '', re = want && new RegExp('(?<![\\d,.])' + want.replace('.', '\\.') + '(?![\\d,])');
|
|
437
|
+
const line = cmp ? esc(cmp).replace(re && re.test(cmp) ? re : /\d[\d,.]*(?=\s+times)/.test(cmp) ? /\d[\d,.]*(?=\s+times)/ : /\d[\d,.]*\d|\d/, hl)
|
|
438
|
+
: hp >= 10 ? `That’s every Harry Potter book, read ${hl(N(+hp.toPrecision(2)))} times.`
|
|
439
|
+
: `That’s ${hl(N(Math.max(1, t / 1.2e5)))} novels’ worth of words.`;
|
|
440
|
+
const pills = [T().toolCalls ? N(T().toolCalls) + ' tool calls' : ''].filter(Boolean);
|
|
383
441
|
return `<div class="slide" style="background:var(--li);color:var(--ink)">${top(1)}
|
|
384
442
|
<div class="M in" style="font-size:40px">This year your agents burned</div><div class="grow"></div>
|
|
385
443
|
<div class="H fit in" style="font-size:300px">${cnt(t, 'b')}</div><div class="H in" style="font-size:130px;margin-top:14px">tokens.</div>
|
|
@@ -411,6 +469,39 @@ S.harness = {
|
|
|
411
469
|
run: el => $$('.bar', el).forEach((b, i) => grow(b, 'scaleX', 500 + i * 120)),
|
|
412
470
|
};
|
|
413
471
|
|
|
472
|
+
// guess your #1 model: three choices, then the race is the reveal
|
|
473
|
+
let quizDone = false, STILL = false; // STILL: building an export, slides render their final state
|
|
474
|
+
S.quiz = {
|
|
475
|
+
ok: () => { const q = W.quiz; return Array.isArray(q?.choices) && q.choices.length > 1 && q.choices.includes(q.answer); },
|
|
476
|
+
dur: 8000, reset: () => { quizDone = false; }, end: () => quizReveal(),
|
|
477
|
+
html: () => {
|
|
478
|
+
const q = W.quiz, open = STATIC || STILL || quizDone, ask = String(q.question || 'Which model did you use most?');
|
|
479
|
+
return `<div class="slide">${top()}
|
|
480
|
+
<div class="M lab in">Before the reveal</div><div class="H in" style="font-size:${ask.length > 34 ? 112 : 140}px;margin-top:24px">${esc(ask)}</div>
|
|
481
|
+
<div class="grow" style="min-height:40px"></div>
|
|
482
|
+
<div class="col" style="gap:22px">${q.choices.slice(0, 3).map((c, i) => `<button class="qz tile in ctl${open ? (c === q.answer ? ' qy' : ' qn') : ''}" data-quiz="${i}"><span class="M" style="font-size:30px;opacity:.55;flex:none">${i + 1}</span><span class="H fit" style="font-size:92px;flex:1;min-width:0">${esc(c)}</span>${c === q.answer && q.share ? `<span class="M qs" style="font-size:34px;flex:none">${pct(q.share)}</span>` : ''}</button>`).join('')}</div>
|
|
483
|
+
<div class="M in qa" style="font-size:32px;margin-top:40px;min-height:44px">${open ? esc(quizLine()) : 'Pick one'}</div>
|
|
484
|
+
${foot()}</div>`;
|
|
485
|
+
},
|
|
486
|
+
};
|
|
487
|
+
const quizLine = say => `${say ? say + ' ' : ''}${W.quiz.answer}${W.quiz.share ? ' · ' + pct(W.quiz.share) + ' of your tokens' : ''}`;
|
|
488
|
+
/** pick = the chosen label, or undefined when the countdown ran out */
|
|
489
|
+
function quizReveal(pick) {
|
|
490
|
+
const el = $('.slide.live', view), q = W.quiz;
|
|
491
|
+
if (!el || el.dataset.key !== 'quiz' || quizDone) return;
|
|
492
|
+
quizDone = true;
|
|
493
|
+
const motion = !STATIC && !reduced();
|
|
494
|
+
$$('[data-quiz]', el).forEach(b => {
|
|
495
|
+
const c = q.choices[+b.dataset.quiz], right = c === q.answer; b.classList.add(right ? 'qy' : 'qn');
|
|
496
|
+
if (!motion) return;
|
|
497
|
+
if (right) b.animate([{ transform: 'scale(.96)' }, { transform: 'none' }], { duration: SP.pop.ms, easing: SP.pop.easing });
|
|
498
|
+
else if (c === pick) b.animate([0, -24, 20, -14, 8, 0].map(x => ({ transform: `translateX(${x}px)` })), { duration: 420, easing: 'ease-out' });
|
|
499
|
+
});
|
|
500
|
+
const qa = $('.qa', el); if (qa) qa.textContent = quizLine(pick === undefined ? 'Time’s up.' : pick === q.answer ? 'You knew it.' : 'Not quite.');
|
|
501
|
+
if (prog) { prog.onfinish = null; prog.finish(); }
|
|
502
|
+
after(1900, next);
|
|
503
|
+
}
|
|
504
|
+
|
|
414
505
|
// model race: month by month, then the year
|
|
415
506
|
function raceFrames() {
|
|
416
507
|
const R = W.series?.race;
|
|
@@ -432,11 +523,11 @@ S.race = {
|
|
|
432
523
|
const col = i => C(COLORS[rank.indexOf(i) % 5]), tot = F.at(-1).tot || fin.reduce((a, b) => a + b, 0) || 1, mx = Math.max(...fin) || 1;
|
|
433
524
|
const win = models[rank[0]], wm = (W.models || []).find(m => m.label === win);
|
|
434
525
|
return `<div class="slide">${top()}
|
|
435
|
-
<div class="M lab in">Model race · ${W.year || ''}</div><div class="H in" style="font-size:150px;margin-top:24px">Who ruled<br><span class="rm" style="color:var(--li)">${esc(F.at(-1).label)}</span>?</div>
|
|
526
|
+
<div class="M lab in">Model race · ${W.year || ''}</div><div class="H in" style="font-size:150px;margin-top:24px">Who ruled<br><span class="rm" style="color:var(--lit,var(--li))">${esc(F.at(-1).label)}</span>?</div>
|
|
436
527
|
<div class="race in grow" style="margin-top:80px;min-height:${n * RACE_ROW}px">${rank.slice(0, n).map((i, r) => `<div class="rr" data-i="${i}" style="transform:translateY(${r * RACE_ROW}px)">
|
|
437
528
|
<div class="rn H"><span class="fit" style="min-width:0">${esc(models[i])}</span><span class="M rv">${Math.round(fin[i] / tot * 100)}%</span></div>
|
|
438
529
|
<div class="rt"><i style="background:${col(i)};transform:scaleX(${Math.max(.02, fin[i] / mx)})"></i></div></div>`).join('')}</div>
|
|
439
|
-
<div class="row in" style="align-items:baseline;justify-content:space-between;margin-top:20px"><span class="M lab">Model of the Year</span><span class="H fit" style="font-size:64px;color:var(--li)">${esc(win)}${wm?.share ? ` · ${Math.round(wm.share * 100)}%` : ''}</span></div>
|
|
530
|
+
<div class="row in" style="align-items:baseline;justify-content:space-between;margin-top:20px"><span class="M lab" style="flex:none">Model of the Year</span><span class="H fit" style="font-size:64px;color:var(--lit,var(--li));flex:1;min-width:0;text-align:right">${esc(win)}${wm?.share ? ` · ${Math.round(wm.share * 100)}%` : ''}</span></div>
|
|
440
531
|
${foot()}</div>`;
|
|
441
532
|
},
|
|
442
533
|
run: el => {
|
|
@@ -463,7 +554,7 @@ S.race = {
|
|
|
463
554
|
};
|
|
464
555
|
const order = vals => vals.map((v, i) => [v, i]).sort((a, b) => b[0] - a[0] || a[1] - b[1]).map(x => x[1]);
|
|
465
556
|
|
|
466
|
-
//
|
|
557
|
+
// the card: "My {year}", the bento of the year's awards. It is a story slide, the share-slide preview and what Save card exports
|
|
467
558
|
function heatCells() {
|
|
468
559
|
const days = W.series?.days, y = W.year;
|
|
469
560
|
if (!days || !y || !Object.keys(days).length) return null;
|
|
@@ -479,29 +570,45 @@ function heatCells() {
|
|
|
479
570
|
}
|
|
480
571
|
return cols;
|
|
481
572
|
}
|
|
482
|
-
const head = (w) => `<div class="row" style="align-items:center;gap:40px;margin-bottom:30px;flex:none">${logoTile(
|
|
573
|
+
const head = (w, px = 236) => `<div class="row" style="align-items:center;gap:40px;margin-bottom:30px;flex:none">${logoTile(px)}<div style="min-width:0;flex:1">
|
|
483
574
|
<div class="H fit in" style="font-size:150px">${w}</div><div class="row in" style="gap:24px;align-items:center;margin-top:22px;flex-wrap:wrap">
|
|
484
|
-
<span class="M N gh" style="font-size:36px">${GH(40)}
|
|
575
|
+
<span class="M N gh" style="font-size:36px;max-width:100%;min-width:0">${GH(40)}<span style="overflow:hidden;text-overflow:ellipsis">${esc(handle())}</span></span>${W.tier?.label ? `<span class="pill M">${esc(W.tier.label)}</span>` : ''}</div></div></div>`;
|
|
576
|
+
const pct = x => { const p = Math.round((x || 0) * 100); return p < 1 && x > 0 ? '<1%' : p + '%'; };
|
|
577
|
+
function ballot() {
|
|
578
|
+
const h = W.harnesses?.[0], m = W.models?.[0], pick = (id, fb) => { const a = AW(id); return a?.value ? a : fb || null; };
|
|
579
|
+
return [['Harness', pick('harness', h && { value: h.label || HARNESS[h.id] || h.id, detail: h.share ? pct(h.share) + ' of prompts' : '' })],
|
|
580
|
+
['Model', pick('model', m && { value: m.label, detail: m.share ? pct(m.share) + ' of tokens' : '' })],
|
|
581
|
+
['Skill', pick('skill')]].filter(r => r[1]);
|
|
582
|
+
}
|
|
583
|
+
// a long one-word value (a skill id) breaks once, near its middle, so fit() can keep it large
|
|
584
|
+
const two = v => { v = String(v ?? ''); if (v.length < 10) return esc(v); let at = -1; [...v].forEach((c, i) => { if (/[-_ /.:]/.test(c) && i < v.length - 1 && Math.abs(i + 1 - v.length / 2) < Math.abs(at + 1 - v.length / 2)) at = i; }); return at < 0 ? esc(v) : esc(v.slice(0, at + 1)) + '<br>' + esc(v.slice(at + 1).trim()); };
|
|
485
585
|
S.bento = {
|
|
486
|
-
ok: () => T().prompts > 0, dur: 6500,
|
|
586
|
+
ok: () => T().prompts > 0 || ballot().length > 0, dur: 6500,
|
|
487
587
|
html: () => {
|
|
488
|
-
const t = T(),
|
|
489
|
-
const
|
|
588
|
+
const t = T(), heat = heatCells(), rows = Object.fromEntries(ballot()), H = (W.harnesses || []).slice(0, 12), mx = Math.max(...H.map(h => h.share || 0), .01);
|
|
589
|
+
const tok = AW('tokens')?.value || (t.tokens > 0 ? BIG(t.tokens) : ''), usd = AW('spendings')?.value || (W.spendings?.usd ? '≈ ' + USD(W.spendings.usd) : ''), sw = AW('swarm'), agents = num(sw?.value) ?? t.subagents, rl = AW('rateLimits');
|
|
590
|
+
// THE FIVE TILES, in one place. Two big ones: { value, detail }. Three small ones: [label, value html, detail, colour token]; an entry with no value is left out.
|
|
591
|
+
const hw = rows.Harness, mw = rows.Model, share = W.models?.[0]?.share ?? (num(mw?.detail) ?? 0) / 100;
|
|
592
|
+
const small = [
|
|
593
|
+
['Skill of the Year', rows.Skill && two(rows.Skill.value), rows.Skill?.detail, 'lv'],
|
|
594
|
+
rl && num(rl.value) != null ? ['Limits reached', cnt(num(rl.value)), rl.detail, 'or'] : ['Agents spawned', agents != null && cnt(agents), sw?.detail, 'or'],
|
|
595
|
+
['Tokens', t.tokens > 0 ? cnt(t.tokens, 'b') : esc(tok), usd, 'bl'],
|
|
596
|
+
].filter(x => x[1]);
|
|
490
597
|
const cls = W.tier?.power || AW('agentClass')?.value, slogan = AW('agentClass')?.detail;
|
|
491
598
|
return `<div class="slide">
|
|
492
599
|
${head('My ' + (W.year || ''))}
|
|
493
600
|
<div class="col grow" style="gap:26px">
|
|
494
601
|
<div class="row" style="flex:1.5;min-height:0">
|
|
495
|
-
<div class="tile in" style="flex:1.35;background:var(--li);color:var(--ink);display:flex;flex-direction:column"
|
|
496
|
-
${
|
|
497
|
-
|
|
498
|
-
|
|
602
|
+
<div class="tile in" style="flex:1.35;min-width:0;background:var(--li);color:var(--ink);display:flex;flex-direction:column">${hw ? `<div class="M" style="font-size:28px">Harness of the Year</div><div class="H fit" style="font-size:150px;margin-top:40px">${esc(hw.value)}</div>${hw.detail ? `<div style="font-size:42px;font-weight:800;margin-top:16px">${esc(hw.detail)}</div>` : ''}
|
|
603
|
+
${H.length > 1 ? `<div class="mb" style="margin-top:auto;display:flex;gap:8px;align-items:flex-end;height:110px">${H.map(h => `<i class="bar" style="flex:1;height:${Math.max(8, (h.share || 0) / mx * 110)}px;border-radius:6px;background:var(--ink);opacity:${(.25 + (h.share || 0) / mx * .75).toFixed(2)};transform-origin:50% 100%"></i>`).join('')}</div>` : ''}`
|
|
604
|
+
: `<div class="M" style="font-size:28px">Prompts</div><div class="H fit" style="font-size:150px;margin-top:40px">${cnt(t.prompts)}</div>`}</div>
|
|
605
|
+
${mw ? `<div class="tile in" style="flex:1;min-width:0;background:var(--pk);color:var(--ink);display:flex;flex-direction:column"><div class="M" style="font-size:28px">Model of the Year</div><div class="H fit" style="font-size:190px;margin-top:30px">${esc(mw.value)}</div>${mw.detail ? `<div style="font-size:42px;font-weight:800;margin-top:16px">${esc(mw.detail)}</div>` : ''}
|
|
606
|
+
${share > 0 ? `<div class="sq" style="margin-top:auto;display:flex;gap:10px">${Array.from({ length: 5 }, (_, i) => { const f = Math.round(Math.max(0, Math.min(1, share * 5 - i)) * 100); return `<i style="width:44px;height:44px;border-radius:12px;background:linear-gradient(90deg,var(--ink) ${f}%,color-mix(in srgb,var(--ink) 22%,transparent) ${f}%)"></i>`; }).join('')}</div>` : ''}</div>` : ''}
|
|
499
607
|
</div>
|
|
500
|
-
${small.length ? `<div class="row" style="flex:1;min-height:0">${small.map(([a, v, c]) => `<div class="tile in" style="flex:1;background:${C(c)};color:${c === 'bl' ? 'var(--obl)' : 'var(--ink)'};display:flex;flex-direction:column;justify-content:space-between"><div class="M" style="font-size:26px">${a}</div><div class="H fit" style="font-size:88px">${
|
|
608
|
+
${small.length ? `<div class="row" style="flex:1;min-height:0">${small.map(([a, v, d, c]) => `<div class="tile in" style="flex:1 1 0;min-width:0;background:${C(c)};color:${c === 'bl' ? 'var(--obl)' : 'var(--ink)'};display:flex;flex-direction:column;justify-content:space-between"><div class="M" style="font-size:26px">${a}</div><div><div class="H fit" style="font-size:88px;line-height:.95">${v}</div>${d ? `<div class="M N" style="font-size:22px;opacity:.75;margin-top:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">${esc(d)}</div>` : ''}</div></div>`).join('')}</div>` : ''}
|
|
501
609
|
${cls ? `<div class="tile in" style="flex:none;border:4px solid var(--fg);padding:28px 40px;display:flex;justify-content:space-between;align-items:center;gap:30px"><div class="col" style="flex:none;gap:10px"><span class="M" style="font-size:28px">Agent class</span>${slogan ? `<span style="font-size:26px;opacity:.7;max-width:420px">${esc(slogan)}</span>` : ''}</div><span class="H fit" style="font-size:68px;min-width:0;text-align:right">${esc(cls)}</span></div>` : ''}
|
|
502
610
|
</div>
|
|
503
611
|
${heat ? `<div class="heat in" style="margin-top:30px">${heat.map(c => `<b>${c.map(s => `<i${s ? ` style="${s}"` : ''}></i>`).join('')}</b>`).join('')}</div>` : ''}
|
|
504
|
-
${W.coverage?.length ? `<div class="M N in" style="font-size:24px;opacity:.55;margin-top:22px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">${W.coverage.map(c => `${esc(c.label)} since ${md(c.from)}`).join(' · ')}</div>` : ''}
|
|
505
612
|
${foot()}</div>`;
|
|
506
613
|
},
|
|
507
614
|
run: el => {
|
|
@@ -511,29 +618,40 @@ S.bento = {
|
|
|
511
618
|
},
|
|
512
619
|
};
|
|
513
620
|
|
|
514
|
-
//
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
|
|
621
|
+
// the busiest day of the year (and the hour it peaked)
|
|
622
|
+
const DAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
623
|
+
const agentName = () => W.roastBy || W.harnesses?.[0]?.label || 'your agent';
|
|
624
|
+
S.day = {
|
|
625
|
+
ok: () => /^\d{4}-\d\d-\d\d/.test(W.busiest?.date || ''), dur: () => W.dayLine ? 7500 : 5500, chrome: 'ink',
|
|
518
626
|
html: () => {
|
|
519
|
-
const
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
627
|
+
const b = W.busiest, d = new Date(b.date.slice(0, 10) + 'T12:00:00'), wd = isNaN(d) ? '' : DAYS[d.getDay()];
|
|
628
|
+
const line = typeof W.dayLine === 'string' && W.dayLine.trim(), hour = Number.isFinite(+b.peakHour) && b.peakHour != null ? String(Math.round(+b.peakHour)).padStart(2, '0') + ':00' : '';
|
|
629
|
+
return `<div class="slide" style="background:var(--lv);color:var(--ink)">${top(1)}
|
|
630
|
+
<div class="M in" style="font-size:40px">Your busiest day</div><div class="grow"></div>
|
|
631
|
+
<div class="H fit in" style="font-size:340px">${md(b.date)}</div>
|
|
632
|
+
${wd ? `<div class="H in" style="font-size:110px;margin-top:14px">a ${wd}.</div>` : ''}
|
|
633
|
+
<div class="grow"></div>
|
|
634
|
+
<div class="row in" style="gap:22px">
|
|
635
|
+
${b.prompts != null ? `<div class="tile" style="flex:1.25 1 0;min-width:0;background:var(--ink);color:var(--lv)"><div class="M" style="font-size:28px">prompts in one day</div><div class="H fit" style="font-size:150px;margin-top:26px">${cnt(b.prompts)}</div></div>` : ''}
|
|
636
|
+
${hour ? `<div class="tile" style="flex:1 1 0;min-width:0;box-shadow:inset 0 0 0 5px var(--ink)"><div class="M" style="font-size:28px">mostly at</div><div class="H fit" style="font-size:150px;margin-top:26px">${hour}</div></div>` : ''}
|
|
637
|
+
</div>
|
|
638
|
+
${line ? `<div class="in" style="margin-top:44px"><div style="font-size:50px;font-weight:700;line-height:1.2">“${esc(line)}”</div><div class="M" style="font-size:26px;margin-top:18px;opacity:.7">— ${esc(agentName())}’s guess</div></div>` : ''}
|
|
639
|
+
${foot()}</div>`;
|
|
640
|
+
},
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
// top 5 skills and models, Spotify-style
|
|
644
|
+
S.top5 = {
|
|
645
|
+
ok: () => ['skills', 'models'].some(k => Array.isArray(W.top5?.[k]) && W.top5[k].length > 0), dur: 7500,
|
|
646
|
+
html: () => {
|
|
647
|
+
const t = W.top5, L = (k, title, f) => Array.isArray(t[k]) && t[k].length ? { title, rows: t[k].slice(0, 5).filter(r => Array.isArray(r)).map(([n, v]) => [n, f(v)]) } : null;
|
|
648
|
+
const cols = [L('skills', 'Skills', v => N(v) + ' runs'), L('models', 'Models', v => pct(v) + ' of tokens')].filter(Boolean), wide = cols.length < 2, fs = wide ? 110 : 76;
|
|
649
|
+
const col = c => `<div class="col" style="flex:1 1 0;min-width:0;justify-content:space-between;gap:30px"><div class="in"><span class="pill M">${c.title}</span></div>${c.rows.map(([n, v], i) => `<div class="row in" style="gap:20px;align-items:baseline"><span class="H" style="font-size:${fs}px;line-height:1;opacity:.35;flex:none;width:${wide ? 96 : 62}px">${i + 1}</span><div style="min-width:0;flex:1"><div class="H fit" style="font-size:${fs}px;line-height:1.05${i ? '' : ';color:var(--lit,var(--li))'}">${esc(n)}</div><div class="M N" style="font-size:${wide ? 30 : 26}px;opacity:.6;margin-top:10px">${v}</div></div></div>`).join('')}</div>`;
|
|
525
650
|
return `<div class="slide">${top()}
|
|
526
|
-
<div class="M lab in">
|
|
527
|
-
<div class="grow
|
|
528
|
-
<svg viewBox="-500 -500 1000 1000" style="width:min(100%,900px);height:min(100%,900px);overflow:visible">
|
|
529
|
-
${[0, 6, 12, 18].map(k => { const a = k / 24 * Math.PI * 2 - Math.PI / 2; return `<text x="${(Math.cos(a) * 180).toFixed(1)}" y="${(Math.sin(a) * 180 + 10).toFixed(1)}" text-anchor="middle" font-size="28" fill="currentColor" opacity=".45" style="font-family:var(--fm)">${String(k).padStart(2, '0')}</text>`; }).join('')}
|
|
530
|
-
${(h || Array.from({ length: 24 }, (_, k) => k === peak ? 1 : .12)).map((v, k) => `<g transform="rotate(${k * 15 - 90})"><rect class="hb" x="230" y="-15" width="${Math.max(30, v / mx * 250).toFixed(1)}" height="30" rx="15" fill="${top3.includes(k) ? C('li') : C('lv')}" style="transform-box:fill-box;transform-origin:0 50%"/></g>`).join('')}
|
|
531
|
-
<text y="-6" text-anchor="middle" font-size="120" fill="currentColor" style="font-family:var(--fd);font-weight:var(--fw);letter-spacing:var(--ls);font-style:var(--fst)">${String(peak).padStart(2, '0')}:00</text>
|
|
532
|
-
<text y="58" text-anchor="middle" font-size="28" fill="currentColor" opacity=".6" letter-spacing="5" style="font-family:var(--fm)">PEAK HOUR</text></svg></div>
|
|
533
|
-
<div class="row in" style="justify-content:space-between;align-items:baseline;flex-wrap:wrap;gap:10px 30px"><span class="M" style="font-size:32px">${esc(nightTxt)}</span>${bd ? `<span class="M" style="font-size:32px;opacity:.6">Busiest on ${bd}</span>` : ''}</div>
|
|
651
|
+
<div class="M lab in">On repeat</div><div class="H in" style="font-size:170px;margin-top:24px">Top 5</div>
|
|
652
|
+
<div class="row grow" style="gap:44px;margin-top:64px;max-height:1150px">${cols.map(col).join('')}</div>
|
|
534
653
|
${foot()}</div>`;
|
|
535
654
|
},
|
|
536
|
-
run: el => $$('.hb', el).forEach((b, i) => grow(b, 'scaleX', 400 + i * 28)),
|
|
537
655
|
};
|
|
538
656
|
|
|
539
657
|
// manners: please vs Esc
|
|
@@ -575,17 +693,17 @@ S.age = {
|
|
|
575
693
|
const wp = why.map(w => /(\d+)-word prompts/.exec(w)).find(Boolean), late = why.some(w => /after 2[2-4]/.test(w));
|
|
576
694
|
const line = [wp ? `Old enough for <span style="white-space:nowrap">${wp[1]}-word</span> prompts.` : '', late ? 'Young enough to code at 2 a.m.' : ''].filter(Boolean).join(' ');
|
|
577
695
|
return `<div class="slide" style="padding:0">
|
|
578
|
-
${A ? `<div class="col pt" style="flex
|
|
696
|
+
${A ? `<div class="col pt" style="flex:1;background:var(--pk);color:var(--ink);padding:104px 44px 50px;min-height:0">${top(1)}
|
|
579
697
|
<div class="M in" style="font-size:34px">Your agentic age is</div>
|
|
580
|
-
<div class="row" style="align-items:flex-end;gap:40px;flex:1;min-height:0"><div class="H in" style="font-size:${X ? 460 : 640}px;letter-spacing:-.07em;line-height:.8">${cnt(A.years)}</div>
|
|
581
|
-
${line ? `<div class="in" style="font-size:46px;font-weight:800;line-height:1.12;padding-bottom:20px">${line}</div>` : ''}</div>
|
|
698
|
+
<div class="row" style="align-items:flex-end;gap:40px;flex:1;min-height:0"><div class="H in" style="flex:none;font-size:${Math.round((X ? 460 : 640) * Math.min(1, 2 / String(Math.round(A.years)).length))}px;letter-spacing:-.07em;line-height:.8">${cnt(A.years)}</div>
|
|
699
|
+
${line ? `<div class="in" style="min-width:0;font-size:46px;font-weight:800;line-height:1.12;padding-bottom:20px">${line}</div>` : ''}</div>
|
|
582
700
|
${why.length ? `<div class="row in" style="flex-wrap:wrap;gap:14px;margin-top:34px">${why.map(w => `<span class="pill M N" style="font-size:28px;background:var(--ink);color:var(--pk)">${esc(w)}</span>`).join('')}</div>` : ''}</div>` : ''}
|
|
583
701
|
${X ? `<div class="col${A ? '' : ' pt'}" style="flex:1;padding:${A ? 60 : 104}px 44px 44px;min-height:0">${A ? '' : top()}
|
|
584
702
|
<div class="M lab in">Your agent twin</div><div class="H fit in" style="font-size:120px;margin-top:20px">${esc(X.name)}</div>
|
|
585
|
-
<div class="row" style="gap:30px;margin-top:
|
|
586
|
-
<div class="tile in" style="flex:1;background:var(--li);color:var(--ink);transform:rotate(-3deg);display:flex;flex-direction:column;justify-content:space-between"><span class="M" style="font-size:26px">you</span><span class="H" style="font-size:150px">✦</span><span class="M N gh" style="font-size:26px">${GH(26)}
|
|
703
|
+
<div class="row" style="gap:30px;margin-top:36px;flex:1;min-height:240px;max-height:420px">
|
|
704
|
+
<div class="tile in" style="flex:1;background:var(--li);color:var(--ink);transform:rotate(-3deg);display:flex;flex-direction:column;justify-content:space-between"><span class="M" style="font-size:26px">you</span><span class="H" style="font-size:150px">✦</span><span class="M N gh" style="font-size:26px;max-width:100%">${GH(26)}<span style="overflow:hidden;text-overflow:ellipsis">${esc(handle())}</span></span></div>
|
|
587
705
|
<div class="tile in" style="flex:1;background:var(--lv);color:var(--ink);transform:rotate(3deg);display:flex;flex-direction:column;justify-content:space-between"><span class="M" style="font-size:26px">twin</span><span class="H" style="font-size:150px">∞</span><span class="M N" style="font-size:26px">${esc(X.why || X.name)}</span></div></div>
|
|
588
|
-
<div class="row in" style="align-items:baseline;gap:20px;margin-top:
|
|
706
|
+
<div class="row in" style="align-items:baseline;gap:20px;margin-top:28px"><span class="H" style="font-size:150px">${cnt(X.match || 0)}</span><span class="M" style="font-size:34px">% match</span></div>
|
|
589
707
|
${foot()}</div>` : ''}
|
|
590
708
|
${X ? '' : `<div style="padding:0 44px 44px">${foot()}</div>`}</div>`;
|
|
591
709
|
},
|
|
@@ -607,8 +725,8 @@ S.spend = {
|
|
|
607
725
|
<div class="paper" style="width:840px;max-height:100%"><div style="text-align:center;font-size:46px;font-weight:800">SPENDINGS ${W.year || ''}</div><div style="text-align:center;opacity:.6;font-size:26px">${esc(handle())} · AT API LIST PRICES</div><hr>
|
|
608
726
|
${shown.map(([a, b, c]) => `<div class="ln"><span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap">${esc(a)}</span><span style="flex:none">${b}</span></div>${c ? `<div class="sub"> ${c}</div>` : ''}`).join('')}${more > 0 ? `<div class="sub">+ ${more} more</div>` : ''}
|
|
609
727
|
<hr><div class="ln" style="font-size:46px;font-weight:800"><span>TOTAL</span><span>${esc(total)}</span></div>
|
|
610
|
-
${s.perDay ? `<div class="tot" style="margin:
|
|
611
|
-
<div style="height:
|
|
728
|
+
${s.perDay ? `<div class="tot" style="margin:26px 0 22px;background:#111;color:var(--li);text-align:center;border-radius:20px;padding:30px"><div class="H fit" style="font-size:110px">${USD(s.perDay)}/day</div><div style="font-size:26px;margin-top:8px">IF YOU PAID PER TOKEN</div></div>` : ''}
|
|
729
|
+
<div style="height:80px;flex:none;margin-top:${s.perDay ? 0 : 30}px;background:repeating-linear-gradient(90deg,#111 0 4px,transparent 4px 9px,#111 9px 11px,transparent 11px 17px)"></div>
|
|
612
730
|
<div style="text-align:center;opacity:.6;font-size:22px;margin-top:10px">${[pd && 'LIST PRICES ' + pd, cache].filter(Boolean).join(' · ')}</div></div></div>
|
|
613
731
|
${foot()}</div>`;
|
|
614
732
|
},
|
|
@@ -650,7 +768,7 @@ S.share = {
|
|
|
650
768
|
<div class="row grow" style="margin-top:56px;gap:40px;align-items:center;min-height:620px">
|
|
651
769
|
<button class="in ctl" data-act="wall" aria-label="Wall" style="flex:none;width:346px;height:615px;position:relative;border-radius:calc(var(--r) * .6 + 8px);overflow:hidden;transform:rotate(-3deg);box-shadow:0 40px 120px #0009"><div class="mini" style="position:absolute;left:0;top:0;width:1080px;height:1920px;transform:scale(.3204);transform-origin:0 0;pointer-events:none">${miniCard() || wallHTML({ mini: 1 })}</div></button>
|
|
652
770
|
<div class="col in" style="flex:1;min-width:0;gap:26px;align-items:flex-start">
|
|
653
|
-
${VIEWER ? `<div class="H" style="font-size:72px"
|
|
771
|
+
${VIEWER ? `<div class="H" style="font-size:72px">${CTA()}</div><div class="M N" style="font-size:30px;line-height:1.5;overflow-wrap:anywhere;opacity:.8">${INSTALL}</div>`
|
|
654
772
|
: `<div class="qr" style="width:100%;max-width:420px;aspect-ratio:1">${qrSVG(shareURL(W))}</div><div class="M N" style="font-size:30px;display:flex;gap:14px;align-items:center"><svg viewBox="0 0 24 24" style="width:38px;height:38px" fill="none" stroke="currentColor" stroke-width="2"><rect x="6" y="2" width="12" height="20" rx="3"/><path d="M10 18h4"/></svg>→ phone</div>`}
|
|
655
773
|
</div></div>
|
|
656
774
|
<div class="seg3 in ctl" role="group" aria-label="Size" style="margin-top:46px">${Object.entries(SIZES).map(([k, [w, h, l]]) => `<button data-size="${k}" aria-pressed="${k === size}">${l} <span style="opacity:.55">${w}×${h}</span></button>`).join('')}</div>
|
|
@@ -667,7 +785,8 @@ S.share = {
|
|
|
667
785
|
// wall: every award on one card (the share image)
|
|
668
786
|
function miniCard() { try { return S.bento.html().replace('<div class="slide', '<div class="slide x'); } catch { return ''; } }
|
|
669
787
|
function wallHTML({ mini } = {}) {
|
|
670
|
-
const
|
|
788
|
+
const first = ['harness', 'model', 'skill', 'tool'], rank = a => first.indexOf(a.id) + 1 || 9; // the four awards lead; no sessions / active days / subagents tiles
|
|
789
|
+
const aw = (W.awards || []).filter(a => a.value && !['sessions', 'activeDays', 'subagents'].includes(a.id)).sort((a, b) => rank(a) - rank(b)).map(a => [a.label || LABELS[a.id] || a.id, red(a.value)]);
|
|
671
790
|
if (W.roast) aw.push(['Roast', '“' + (W.roast.split(/(?<=[.!?])\s/)[0] || W.roast).slice(0, 40) + '”']);
|
|
672
791
|
const hs = (W.harnesses || []).map(h => h.label || HARNESS[h.id] || h.id).slice(0, 4).join(' · ');
|
|
673
792
|
return `<div class="slide${mini ? ' x' : ''}" style="padding-top:${mini ? 60 : ''}px">${head(String(W.year || ''))}
|
|
@@ -700,9 +819,11 @@ const grow = (el, axis, delay) => anim(el, [{ transform: `${axis}(0)` }, { trans
|
|
|
700
819
|
// a tiny clock for JS-driven tweens (count-ups, race). Runs only while a tween is alive; freezes on pause
|
|
701
820
|
const TK = { list: [], raf: 0, t: 0, last: 0 };
|
|
702
821
|
function tween(ms, fn, delay = 0) { if (STATIC) return fn(1, 0); if (reduced()) return fn(1, 0); TK.list.push({ start: TK.t + delay, ms, fn, done: false }); kick(); }
|
|
703
|
-
|
|
822
|
+
// a one-shot on the same clock, so it waits while the story is paused (unlike setTimeout) and dies with its slide
|
|
823
|
+
function after(ms, fn) { if (STATIC) return; TK.list.push({ start: TK.t + ms, ms: 1, fn: p => p >= 1 && fn() }); kick(); }
|
|
824
|
+
function kick() { if (!TK.raf && !paused()) { TK.last = 0; TK.raf = requestAnimationFrame(tick); } } // the first frame after a (re)start only sets the clock
|
|
704
825
|
function tick(now) {
|
|
705
|
-
TK.raf = 0; const dt = Math.min(50, now - TK.last); TK.last = now; TK.t += dt;
|
|
826
|
+
TK.raf = 0; const dt = TK.last ? Math.max(0, Math.min(50, now - TK.last)) : 0; TK.last = now; TK.t += dt;
|
|
706
827
|
TK.list = TK.list.filter(tw => { const p = (TK.t - tw.start) / tw.ms; if (p < 0) return true; tw.fn(Math.min(1, p), dt); return p < 1; });
|
|
707
828
|
if (TK.list.length && !paused()) TK.raf = requestAnimationFrame(tick);
|
|
708
829
|
}
|
|
@@ -726,11 +847,13 @@ function enter(el, def) {
|
|
|
726
847
|
function fit(root) {
|
|
727
848
|
$$('.fit', root).forEach(el => {
|
|
728
849
|
if (el.dataset.fs) el.style.fontSize = el.dataset.fs; else el.dataset.fs = el.style.fontSize || getComputedStyle(el).fontSize;
|
|
729
|
-
let fs = parseFloat(getComputedStyle(el).fontSize);
|
|
850
|
+
let fs = parseFloat(getComputedStyle(el).fontSize); const min = Math.ceil(fs * .4); // below 40% a name is unreadable: stop shrinking and end it with an ellipsis
|
|
730
851
|
for (let i = 0; i < 5; i++) {
|
|
731
852
|
const max = el.clientWidth || el.parentElement.clientWidth, w = el.scrollWidth;
|
|
732
853
|
if (!max || w <= max + 1) break;
|
|
733
|
-
fs = Math.floor(fs * max / w * .985);
|
|
854
|
+
fs = Math.floor(fs * max / w * .985);
|
|
855
|
+
if (fs <= min) { el.style.fontSize = min + 'px'; el.style.overflow = 'hidden'; el.style.textOverflow = 'ellipsis'; break; }
|
|
856
|
+
el.style.fontSize = fs + 'px';
|
|
734
857
|
}
|
|
735
858
|
});
|
|
736
859
|
}
|
|
@@ -741,8 +864,9 @@ let list = [], cur = 0, prog = null, LW = 1080, LH = 1920;
|
|
|
741
864
|
const why = new Set();
|
|
742
865
|
const paused = () => why.size > 0;
|
|
743
866
|
const durOf = d => typeof d.dur === 'function' ? d.dur() : d.dur;
|
|
867
|
+
const ORDER = ['tokens', 'quiz', 'race', 'harness', 'day', 'top5', 'manners', 'right', 'age', 'spend', 'roast', 'bento', 'share'];
|
|
744
868
|
function build() {
|
|
745
|
-
list =
|
|
869
|
+
list = ORDER.filter(key => { try { return S[key].ok(); } catch (e) { return false; } }).map(key => ({ key, ...S[key] }));
|
|
746
870
|
segEl.innerHTML = list.map(() => '<b><i></i></b>').join('');
|
|
747
871
|
}
|
|
748
872
|
function slideHTML(key) { return key === 'wall' ? wallHTML() : S[key].html(); }
|
|
@@ -759,6 +883,7 @@ function mount(i, animate) {
|
|
|
759
883
|
function go(i, dir = 1, animate = !STATIC) {
|
|
760
884
|
i = Math.max(0, Math.min(list.length - 1, i));
|
|
761
885
|
TK.list.length = 0; cur = i;
|
|
886
|
+
list[i].reset && list[i].reset();
|
|
762
887
|
const old = $$('.slide.live', view);
|
|
763
888
|
const el = mount(i, animate);
|
|
764
889
|
old.forEach(o => {
|
|
@@ -772,7 +897,7 @@ function go(i, dir = 1, animate = !STATIC) {
|
|
|
772
897
|
progress();
|
|
773
898
|
$('#b-prev').hidden = cur === 0; $('#b-next').hidden = cur === list.length - 1;
|
|
774
899
|
$('#b-save').hidden = false;
|
|
775
|
-
if (paused()) pauseSlide(
|
|
900
|
+
if (paused()) pauseSlide();
|
|
776
901
|
}
|
|
777
902
|
const next = () => cur < list.length - 1 && go(cur + 1, 1);
|
|
778
903
|
const prev = () => go(cur - 1, -1);
|
|
@@ -782,18 +907,21 @@ function progress() {
|
|
|
782
907
|
segs.forEach((s, k) => s.style.transform = k < cur || (k === cur && (!d || STATIC)) ? 'scaleX(1)' : 'scaleX(0)');
|
|
783
908
|
if (!d || STATIC) return;
|
|
784
909
|
prog = segs[cur].animate([{ transform: 'scaleX(0)' }, { transform: 'scaleX(1)' }], { duration: d, easing: 'linear', fill: 'forwards' });
|
|
785
|
-
prog.onfinish = () => next();
|
|
786
|
-
if (paused()) prog
|
|
787
|
-
}
|
|
788
|
-
function pauseSlide(on) {
|
|
789
|
-
const el = $('.slide.live', view);
|
|
790
|
-
el && el.getAnimations({ subtree: true }).forEach(a => on ? a.pause() : a.play());
|
|
910
|
+
prog.onfinish = () => (list[cur].end ? list[cur].end() : next());
|
|
911
|
+
if (paused()) hold(prog);
|
|
791
912
|
}
|
|
913
|
+
// pause()/play() only take effect on the next frame, and a hidden tab paints none: the pause stayed pending, play() on return
|
|
914
|
+
// dropped it, and every animation jumped ahead by the time spent away. Setting currentTime completes the pause at once.
|
|
915
|
+
// Only what was really running is held, so finished fill:both animations are never replayed on resume.
|
|
916
|
+
const held = new Set();
|
|
917
|
+
const hold = a => { if (!a || a.playState !== 'running') return; a.pause(); try { a.currentTime = a.currentTime; } catch (e) { } held.add(a); };
|
|
918
|
+
const release = () => { for (const a of held) a.playState === 'paused' && a.play(); held.clear(); };
|
|
919
|
+
function pauseSlide() { const el = $('.slide.live', view); el && el.getAnimations({ subtree: true }).forEach(hold); }
|
|
792
920
|
function setPause(reason, on) {
|
|
793
921
|
const was = paused(); on ? why.add(reason) : why.delete(reason);
|
|
794
922
|
if (was === paused()) return;
|
|
795
|
-
if (paused()) { prog
|
|
796
|
-
else {
|
|
923
|
+
if (paused()) { hold(prog); pauseSlide(); cancelAnimationFrame(TK.raf); TK.raf = 0; }
|
|
924
|
+
else { release(); TK.list.length && kick(); }
|
|
797
925
|
}
|
|
798
926
|
function remountCurrent() { if (!list[cur]) return; const el = $('.slide.live', view); el && el.remove(); mount(cur, false); }
|
|
799
927
|
function setSkin(k) {
|
|
@@ -807,6 +935,7 @@ function layout() {
|
|
|
807
935
|
let fw, fh;
|
|
808
936
|
if (r <= 9 / 16 + .001) { fw = vw; LW = 1080; LH = Math.min(2400, Math.round(1080 * vh / vw)); fh = Math.round(fw * LH / LW); frame.classList.remove('boxed'); }
|
|
809
937
|
else { const m = vw > 700 ? 48 : 0; fh = vh - m; fw = Math.round(fh * 9 / 16); LW = 1080; LH = 1920; frame.classList.toggle('boxed', m > 0); }
|
|
938
|
+
$('#stage').classList.toggle('full', fw >= vw && fh >= vh);
|
|
810
939
|
const s = fw / LW;
|
|
811
940
|
frame.style.width = fw + 'px'; frame.style.height = fh + 'px';
|
|
812
941
|
view.style.width = LW + 'px'; view.style.height = LH + 'px'; view.style.transform = `scale(${s})`;
|
|
@@ -828,6 +957,7 @@ frame.addEventListener('pointerdown', e => {
|
|
|
828
957
|
frame.addEventListener('pointermove', e => { if (ptr && Math.hypot(e.clientX - ptr.x, e.clientY - ptr.y) > 14) cancelPtr(); });
|
|
829
958
|
const cancelPtr = () => { clearTimeout(holdT); if (ptr?.held) setPause('hold', false); ptr = null; };
|
|
830
959
|
frame.addEventListener('pointercancel', cancelPtr);
|
|
960
|
+
addEventListener('blur', cancelPtr); // a press that ends in another window never sends pointerup
|
|
831
961
|
frame.addEventListener('pointerleave', e => e.pointerType === 'mouse' && cancelPtr());
|
|
832
962
|
frame.addEventListener('pointerup', e => {
|
|
833
963
|
if (!ptr) return; clearTimeout(holdT);
|
|
@@ -840,7 +970,8 @@ frame.addEventListener('contextmenu', e => e.preventDefault());
|
|
|
840
970
|
$('#b-prev').onclick = () => prev(); $('#b-next').onclick = () => next();
|
|
841
971
|
$('#b-save').onclick = () => saveCurrent();
|
|
842
972
|
document.addEventListener('click', e => {
|
|
843
|
-
const b = e.target.closest('[data-act],[data-size],[data-skin]'); if (!b) return;
|
|
973
|
+
const b = e.target.closest('[data-act],[data-size],[data-skin],[data-quiz]'); if (!b) return;
|
|
974
|
+
if (b.dataset.quiz) return quizReveal(W.quiz.choices[+b.dataset.quiz]);
|
|
844
975
|
if (b.dataset.size) { size = b.dataset.size; $$('[data-size]').forEach(x => x.setAttribute('aria-pressed', x.dataset.size === size)); return; }
|
|
845
976
|
if (b.dataset.skin) { setSkin(b.dataset.skin); return; }
|
|
846
977
|
const a = b.dataset.act;
|
|
@@ -862,6 +993,7 @@ addEventListener('keydown', e => {
|
|
|
862
993
|
if (k === 's') return $('#wall').hidden ? saveCurrent() : save('wall');
|
|
863
994
|
if (k === 'r') return $('#report').scrollIntoView({ behavior: reduced() ? 'auto' : 'smooth' });
|
|
864
995
|
if (!inStory || !$('#wall').hidden) return;
|
|
996
|
+
if (list[cur]?.key === 'quiz' && W.quiz.choices[+k - 1] != null && +k <= 3) return quizReveal(W.quiz.choices[+k - 1]);
|
|
865
997
|
if (k === 'ArrowRight' || k === ' ' || k === 'l') { e.preventDefault(); next(); }
|
|
866
998
|
else if (k === 'ArrowLeft' || k === 'h') { e.preventDefault(); prev(); }
|
|
867
999
|
else if (k === 'p' || k === 'k') setPause('user', !why.has('user'));
|
|
@@ -898,21 +1030,19 @@ function fontsFor(css) {
|
|
|
898
1030
|
}
|
|
899
1031
|
function vars() {
|
|
900
1032
|
const cs = getComputedStyle(document.documentElement);
|
|
901
|
-
return ['paper', 'body', ...TOKENS].map(t => `--${t}:${cs.getPropertyValue('--' + t).trim()}`).filter(s => !/:$/.test(s)).join(';');
|
|
1033
|
+
return ['paper', 'body', 'lgc', 'mkc', 'lit', ...TOKENS].map(t => `--${t}:${cs.getPropertyValue('--' + t).trim()}`).filter(s => !/:$/.test(s)).join(';');
|
|
902
1034
|
}
|
|
903
1035
|
function buildSVG(key, sz = size) {
|
|
904
1036
|
const [w, h] = SIZES[sz] || sz, lw = Math.round(1920 * w / h), lh = 1920;
|
|
905
1037
|
const host = $('#host'); host.style.width = lw + 'px'; host.style.height = lh + 'px';
|
|
906
|
-
host.innerHTML = slideHTML(key);
|
|
1038
|
+
STILL = true; try { host.innerHTML = slideHTML(key); } finally { STILL = false; }
|
|
907
1039
|
const el = host.firstElementChild; el.classList.add('x');
|
|
908
1040
|
fit(el);
|
|
909
1041
|
const v = vars(), css = $('#aw-css').textContent;
|
|
910
1042
|
const fonts = fontsFor(getComputedStyle(document.documentElement).getPropertyValue('--fd') + ',' + getComputedStyle(document.documentElement).getPropertyValue('--fm') + ',"JetBrains Mono"');
|
|
911
1043
|
const xhtml = new XMLSerializer().serializeToString(el);
|
|
912
1044
|
host.innerHTML = '';
|
|
913
|
-
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 ${lw} ${lh}"><foreignObject x="0" y="0" width="${lw}" height="${lh}"><div xmlns="http://www.w3.org/1999/xhtml" style="position:relative;width:${lw}px;height:${lh}px;${esc(v)}"><style><![CDATA[${fonts}\n${css}]]
|
|
914
|
-
html.embed,html.embed body{overflow:hidden;height:100%}html.embed #report,html.embed [data-a="report"]{display:none!important}
|
|
915
|
-
</style>${xhtml}</div></foreignObject></svg>`;
|
|
1045
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 ${lw} ${lh}"><foreignObject x="0" y="0" width="${lw}" height="${lh}"><div xmlns="http://www.w3.org/1999/xhtml" style="position:relative;width:${lw}px;height:${lh}px;${esc(v)}"><style><![CDATA[${fonts}\n${css}]]></style>${xhtml}</div></foreignObject></svg>`;
|
|
916
1046
|
return { svg, w, h };
|
|
917
1047
|
}
|
|
918
1048
|
async function exportPNG(key, sz = size) {
|
|
@@ -930,7 +1060,7 @@ function download(blob, name) {
|
|
|
930
1060
|
const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = name;
|
|
931
1061
|
document.body.appendChild(a); a.click(); a.remove(); setTimeout(() => URL.revokeObjectURL(a.href), 5000);
|
|
932
1062
|
}
|
|
933
|
-
const CAPTION = () => `my ${W.year || ''} with AI agents 🫠
|
|
1063
|
+
const CAPTION = () => `my ${W.year || ''} with AI agents 🫠 wrap yours: ${INSTALL}`;
|
|
934
1064
|
async function copyCaption() {
|
|
935
1065
|
try { await navigator.clipboard.writeText(CAPTION()); return true; }
|
|
936
1066
|
catch (e) { const t = document.createElement('textarea'); t.value = CAPTION(); t.style.cssText = 'position:fixed;opacity:0'; document.body.appendChild(t); t.select(); let ok = false; try { ok = document.execCommand('copy'); } catch (_) { } t.remove(); return ok; }
|