myaiwrapped 0.1.0 → 0.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 -2
- package/package.json +2 -2
- package/src/stats.js +65 -0
- package/web/index.html +375 -354
package/README.md
CHANGED
|
@@ -6,12 +6,19 @@ Spotify Wrapped for your AI coding agents.
|
|
|
6
6
|
npx myaiwrapped
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
It reads the history that **Claude Code**, **Codex**, **OpenCode** and **Cursor** already keep on your computer and
|
|
9
|
+
It reads the history that **Claude Code**, **Codex**, **OpenCode** and **Cursor** already keep on your computer and opens 4 share cards in your browser:
|
|
10
|
+
|
|
11
|
+
- **Your Swear Jar**: how many times you swore at your AI, your top words, and which agent took the most heat
|
|
12
|
+
- **Your Year in AI**: top agents, top models, total tokens, top month
|
|
13
|
+
- **Your AI Self**: your AI coding personality, relationship status, coding place, longest streak, peak hour
|
|
14
|
+
- **Your Numbers**: prompts, hours, agent actions, top language, biggest day, active days
|
|
15
|
+
|
|
16
|
+
Each card is a 1600×900 image made for posting on X. Save it or copy it and post it.
|
|
10
17
|
|
|
11
18
|
## Privacy
|
|
12
19
|
|
|
13
20
|
- Everything is read and computed on your machine. Nothing is uploaded.
|
|
14
|
-
- The
|
|
21
|
+
- The cards never show project names. The Swear Jar shows only the swear words themselves, never your prompts.
|
|
15
22
|
|
|
16
23
|
## Options
|
|
17
24
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myaiwrapped",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Spotify Wrapped for your AI coding agents. Reads your local Claude Code, Codex, OpenCode and Cursor history and turns it into
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Spotify Wrapped for your AI coding agents. Reads your local Claude Code, Codex, OpenCode and Cursor history and turns it into share cards for X. Nothing leaves your machine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"myaiwrapped": "bin/aiwrapped.js"
|
package/src/stats.js
CHANGED
|
@@ -24,6 +24,45 @@ const LANGS = {
|
|
|
24
24
|
|
|
25
25
|
const STOP = new Set(('this that with have make file code want need like just what should also from then them there they will would could into some more when your about only other than which because using does done dont don\'t doesnt can\'t cant it\'s its i\'m im here sure okay yeah yes thats that\'s please thanks make it\'s these those were where while each very much many well same able tell know think look looks see show give take still even every after before over under again were been being let\'s lets give want wanted going gonna into right left first last next back them they\'re there\'s what\'s also only something anything everything nothing other another such into onto upon than then though through thing things stuff kind sort maybe really actually just about above below between both does doing done have having make made making need needs used uses using work works working how why who whom whose when which while with within without would should could shall will can may might must from into your yours mine ours their theirs it this that these those here there now then very also just only even still yet already always never sometimes often again more most less least much many some any each every all both either neither none one two three new old good bad better best great nice cool fine like same different change changes changed update updated add added remove removed fix fixed check run running file files code page please hey hello claude codex cursor opencode https http www com').split(/\s+/));
|
|
26
26
|
|
|
27
|
+
// Swear jar: counted per occurrence, only in things you actually typed (not long pastes)
|
|
28
|
+
// [shown as, pattern, group] f = f-bombs, s = swears, i = insults aimed at the AI, h = Hinglish
|
|
29
|
+
const CURSES = [
|
|
30
|
+
['fuck', /\b(?:f+u+c+k+(?:ing|in|ed|er|ers|s|ery|face|head|wit)?|f+u+k+|fck(?:ing|in)?|fk(?:ing|in)?|fkn|fucking)\b/gi, 'f'],
|
|
31
|
+
['motherfucker', /\b(?:mother\s*f+u+c+k+\w*|mf(?:er|ers)?|mofo)\b/gi, 'f'],
|
|
32
|
+
['wtf', /\bwtf+\b/gi, 'f'],
|
|
33
|
+
['stfu', /\bstfu\b/gi, 'f'],
|
|
34
|
+
['ffs', /\bffs\b/gi, 'f'],
|
|
35
|
+
['shit', /\b(?:shit\w*|sh1t)\b/gi, 's'],
|
|
36
|
+
['bullshit', /\bbull\s*shit\w*/gi, 's'],
|
|
37
|
+
['damn', /\b(?:god)?damn\w*/gi, 's'],
|
|
38
|
+
['bitch', /\bbitch\w*/gi, 's'],
|
|
39
|
+
['ass', /\b(?:ass|asses|asshole\w*|dumbass\w*|jackass\w*)\b/gi, 's'],
|
|
40
|
+
['crap', /\bcrap(?:py|s)?\b/gi, 's'],
|
|
41
|
+
['pissed', /\bpiss(?:ed|ing)?\b/gi, 's'],
|
|
42
|
+
['dick', /\bdick(?:head)?s?\b/gi, 's'],
|
|
43
|
+
['bastard', /\bbastards?\b/gi, 's'],
|
|
44
|
+
['cunt', /\bcunts?\b/gi, 's'],
|
|
45
|
+
['dumb', /\bdumb(?:er|est)?\b/gi, 'i'],
|
|
46
|
+
['stupid', /\bstupid\w*/gi, 'i'],
|
|
47
|
+
['idiot', /\bidiot\w*/gi, 'i'],
|
|
48
|
+
['moron', /\bmoron\w*/gi, 'i'],
|
|
49
|
+
['useless', /\buseless\b/gi, 'i'],
|
|
50
|
+
['retard', /\bretard\w*/gi, 'i'],
|
|
51
|
+
['clown', /\bclowns?\b/gi, 'i'],
|
|
52
|
+
['braindead', /\bbrain\s*dead\b/gi, 'i'],
|
|
53
|
+
['chutiya', /\bchut(?:iya|iye|iyo|iyapa|ya|ye)\w*/gi, 'h'],
|
|
54
|
+
['bhenchod', /\b(?:bhenchod|behenchod|bhencho|bencho|benchod|bhenchodd)\w*/gi, 'h'],
|
|
55
|
+
['madarchod', /\b(?:madarchod|maderchod|madarchood|mdrchod)\w*/gi, 'h'],
|
|
56
|
+
['bsdk', /\b(?:bsdk|bhosdi\w*|bhosda\w*|bhosdike)\b/gi, 'h'],
|
|
57
|
+
['bkl', /\bbkl\b/gi, 'h'],
|
|
58
|
+
['gandu', /\bgaa?ndu\w*/gi, 'h'],
|
|
59
|
+
['lavde', /\b(?:lavde|lawde|lavda|lauda|lodu|lund)\b/gi, 'h'],
|
|
60
|
+
['harami', /\bharami\w*/gi, 'h'],
|
|
61
|
+
['saala', /\b(?:saala|saale)\b/gi, 'h'],
|
|
62
|
+
['kutte', /\b(?:kutte|kutta|kutiya)\b/gi, 'h'],
|
|
63
|
+
];
|
|
64
|
+
const countRx = (t, rx) => (t.match(rx) || []).length;
|
|
65
|
+
|
|
27
66
|
const PERSONAS = {
|
|
28
67
|
'night-owl': ['The Night Owl', 'Your best ideas show up after midnight. So do your agents.'],
|
|
29
68
|
'early-bird': ['The Early Bird', 'Shipping before most people finish their first coffee.'],
|
|
@@ -171,10 +210,27 @@ export function computeStats(c, { from, to, label }) {
|
|
|
171
210
|
|
|
172
211
|
// Vibe
|
|
173
212
|
const v = { please: 0, thanks: 0, sorry: 0, rage: 0, fix: 0, doIt: 0, questions: 0, caps: 0, chars: 0 };
|
|
213
|
+
const jar = { fbombs: 0, insults: 0, swears: 0, byTool: {}, worstDay: null };
|
|
214
|
+
const jarDays = new Map();
|
|
215
|
+
const jarWords = new Map();
|
|
174
216
|
const lens = [];
|
|
175
217
|
const words = new Map();
|
|
176
218
|
for (const p of prompts) {
|
|
177
219
|
const t = p.text;
|
|
220
|
+
if (t.length < 2000 && !/^\s*[{\[<]/.test(t)) {
|
|
221
|
+
let n = 0;
|
|
222
|
+
for (const [word, rx, group] of CURSES) {
|
|
223
|
+
const c = countRx(t, rx);
|
|
224
|
+
if (!c) continue;
|
|
225
|
+
n += c;
|
|
226
|
+
jarWords.set(word, (jarWords.get(word) || 0) + c);
|
|
227
|
+
if (group === 'f') jar.fbombs += c; else if (group === 'i') jar.insults += c; else jar.swears += c;
|
|
228
|
+
}
|
|
229
|
+
if (n) {
|
|
230
|
+
jar.byTool[p.tool] = (jar.byTool[p.tool] || 0) + n;
|
|
231
|
+
const dk = dayKey(p.ts); jarDays.set(dk, (jarDays.get(dk) || 0) + n);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
178
234
|
lens.push(t.length);
|
|
179
235
|
v.chars += t.length;
|
|
180
236
|
if (/\b(please|pls|plz)\b/i.test(t)) v.please++;
|
|
@@ -261,6 +317,15 @@ export function computeStats(c, { from, to, label }) {
|
|
|
261
317
|
streak,
|
|
262
318
|
longest: longest ? { hours: +(longest.ms / 3600000).toFixed(1), project: longest.project, tool: longest.tool, date: dayKey(longest.date) } : null,
|
|
263
319
|
first: first ? { date: dayKey(first.ts), tool: first.tool } : null,
|
|
320
|
+
swearJar: (() => {
|
|
321
|
+
const total = jar.fbombs + jar.insults + jar.swears;
|
|
322
|
+
const top = Object.entries(jar.byTool).sort((a, b) => b[1] - a[1])[0];
|
|
323
|
+
const wd = [...jarDays.entries()].sort((a, b) => b[1] - a[1])[0];
|
|
324
|
+
return { total, fbombs: jar.fbombs, insults: jar.insults, swears: jar.swears,
|
|
325
|
+
words: [...jarWords.entries()].sort((a, b) => b[1] - a[1]).slice(0, 8).map(([word, count]) => ({ word, count })),
|
|
326
|
+
mostCursedAt: top ? { tool: top[0], name: TOOL_META[top[0]].name, count: top[1] } : null,
|
|
327
|
+
worstDay: wd ? { date: wd[0], count: wd[1] } : null };
|
|
328
|
+
})(),
|
|
264
329
|
vibe: { ...v, avgLen, medianLen, topWords, nightShare: +nightShare.toFixed(3), weekendShare: +weekendShare.toFixed(3) },
|
|
265
330
|
persona: { id: personaId, title: PERSONAS[personaId][0], blurb: PERSONAS[personaId][1] },
|
|
266
331
|
};
|
package/web/index.html
CHANGED
|
@@ -29,120 +29,121 @@ body {
|
|
|
29
29
|
}
|
|
30
30
|
button, input { font: inherit; color: inherit; }
|
|
31
31
|
|
|
32
|
-
/* ---------- Stage: a 9
|
|
32
|
+
/* ---------- Stage: a 16:9 landscape story frame, screenshot-ready ---------- */
|
|
33
|
+
:root { --sw: min(100vw, calc(100dvh * 16 / 9)); }
|
|
34
|
+
@media (min-width: 700px) { :root { --sw: min(calc(100vw - 150px), calc((100dvh - 64px) * 16 / 9), 1600px); } }
|
|
33
35
|
.shell { position: fixed; inset: 0; display: grid; place-items: center; }
|
|
34
36
|
.backdrop { position: fixed; inset: -10%; background: var(--page-bg, #111); filter: blur(60px) saturate(1.2); opacity: .55; transition: background .6s; }
|
|
35
37
|
.stage {
|
|
36
|
-
position: relative; container-type: size;
|
|
37
|
-
height: min(100dvh, calc(100vw * 16 / 9)); width: min(100vw, calc(100dvh * 9 / 16));
|
|
38
|
+
position: relative; container-type: size; width: var(--sw); height: calc(var(--sw) * 9 / 16);
|
|
38
39
|
overflow: hidden; background: var(--bg); color: var(--fg); user-select: none;
|
|
39
40
|
}
|
|
40
|
-
@media (min-width: 700px) {
|
|
41
|
-
.stage { height: min(calc(100dvh - 48px), 960px); width: calc(min(calc(100dvh - 48px), 960px) * 9 / 16); border-radius: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
|
|
42
|
-
}
|
|
41
|
+
@media (min-width: 700px) { .stage { border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.5); } }
|
|
43
42
|
.slide {
|
|
44
43
|
position: absolute; inset: 0; background: var(--bg); color: var(--fg);
|
|
45
44
|
opacity: 0; visibility: hidden; transition: opacity .45s ease, visibility 0s linear .45s;
|
|
46
|
-
padding:
|
|
45
|
+
padding: 10cqh 7cqw 11cqh; display: flex; flex-direction: column;
|
|
47
46
|
}
|
|
48
47
|
.slide::before { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
|
|
49
48
|
background:
|
|
50
|
-
radial-gradient(
|
|
51
|
-
radial-gradient(
|
|
52
|
-
radial-gradient(
|
|
53
|
-
box-shadow: inset 0 0
|
|
49
|
+
radial-gradient(90% 90% at 4% 0%, rgba(255,255,255,.20), transparent 55%),
|
|
50
|
+
radial-gradient(70% 80% at 100% 100%, rgba(0,0,0,.30), transparent 60%),
|
|
51
|
+
radial-gradient(40% 55% at 96% 8%, color-mix(in srgb, var(--ac) 30%, transparent), transparent 70%);
|
|
52
|
+
box-shadow: inset 0 0 16cqh rgba(0,0,0,.22); }
|
|
54
53
|
.slide::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .14; mix-blend-mode: multiply;
|
|
55
|
-
background-image: radial-gradient(circle at center, rgba(0,0,0,.9) .
|
|
56
|
-
-webkit-mask-image: linear-gradient(160deg, transparent
|
|
57
|
-
.deco > * { filter: drop-shadow(0
|
|
58
|
-
.
|
|
59
|
-
.col .bar { box-shadow: inset 0 1.4cqw 0 rgba(255,255,255,.22), inset 0 -3cqw 4cqw rgba(0,0,0,.18); }
|
|
54
|
+
background-image: radial-gradient(circle at center, rgba(0,0,0,.9) .28cqh, transparent .38cqh); background-size: 1.7cqh 1.7cqh;
|
|
55
|
+
-webkit-mask-image: linear-gradient(160deg, transparent 50%, #000 100%); mask-image: linear-gradient(160deg, transparent 50%, #000 100%); }
|
|
56
|
+
.deco > * { filter: drop-shadow(0 1.6cqh 2.6cqh rgba(0,0,0,.28)); }
|
|
57
|
+
.col .bar { box-shadow: inset 0 1cqh 0 rgba(255,255,255,.22), inset 0 -2cqh 3cqh rgba(0,0,0,.18); }
|
|
60
58
|
.slide.active { opacity: 1; visibility: visible; transition: opacity .45s ease; z-index: 2; }
|
|
61
59
|
.grain { position: absolute; inset: 0; pointer-events: none; z-index: 5; opacity: .32; mix-blend-mode: overlay;
|
|
62
60
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
|
|
63
61
|
|
|
64
62
|
/* progress + chrome */
|
|
65
|
-
.bars { position: absolute; top: 3.
|
|
66
|
-
.bars i { flex: 1; height: .
|
|
63
|
+
.bars { position: absolute; top: 3.2cqh; left: 3cqw; right: 3cqw; display: flex; gap: .5cqw; z-index: 20; }
|
|
64
|
+
.bars i { flex: 1; height: .6cqh; min-height: 3px; border-radius: 9px; background: color-mix(in srgb, var(--cur-fg, #fff) 28%, transparent); overflow: hidden; }
|
|
67
65
|
.bars i b { display: block; height: 100%; width: 0; background: var(--cur-fg, #fff); border-radius: 9px; }
|
|
68
66
|
.bars i.done b { width: 100%; }
|
|
69
|
-
.brand { position: absolute; left:
|
|
70
|
-
font-family: var(--mono); font-size: 2.
|
|
71
|
-
.brand .logo { display: flex; align-items: center; gap: 1.
|
|
72
|
-
.brand .logo svg { width:
|
|
67
|
+
.brand { position: absolute; left: 7cqw; right: 7cqw; bottom: 4.2cqh; display: flex; justify-content: space-between; align-items: center; z-index: 6;
|
|
68
|
+
font-family: var(--mono); font-size: 2.2cqh; letter-spacing: .04em; opacity: .8; }
|
|
69
|
+
.brand .logo { display: flex; align-items: center; gap: 1.2cqh; font-weight: 700; }
|
|
70
|
+
.brand .logo svg { width: 3cqh; height: 3cqh; }
|
|
73
71
|
.tap { position: absolute; top: 0; bottom: 0; z-index: 10; }
|
|
74
72
|
.tap.l { left: 0; width: 30%; } .tap.r { right: 0; width: 70%; }
|
|
75
|
-
.mute-hint { position: fixed; bottom:
|
|
73
|
+
.mute-hint { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-size: 12px; opacity: .45; z-index: 1; color: #fff; }
|
|
76
74
|
@media (max-width: 699px) { .mute-hint { display: none; } }
|
|
77
75
|
|
|
76
|
+
/* layout */
|
|
77
|
+
.content { position: relative; z-index: 2; display: flex; flex-direction: column; flex: 1; min-height: 0; }
|
|
78
|
+
.content.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 7cqw; align-items: center; }
|
|
79
|
+
.content.one { justify-content: center; }
|
|
80
|
+
.L, .R { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
|
|
81
|
+
|
|
78
82
|
/* type */
|
|
79
|
-
.kicker { font-family: var(--mono); font-size:
|
|
80
|
-
.h1 { font-size:
|
|
81
|
-
.h2 { font-size:
|
|
82
|
-
.big { font-size:
|
|
83
|
-
.huge { font-size:
|
|
84
|
-
.sub { font-size:
|
|
85
|
-
.small { font-size:
|
|
83
|
+
.kicker { font-family: var(--mono); font-size: 2.7cqh; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--ac); }
|
|
84
|
+
.h1 { font-size: 8.4cqh; line-height: .95; font-weight: 800; letter-spacing: -.04em; }
|
|
85
|
+
.h2 { font-size: 5.6cqh; line-height: 1.02; font-weight: 800; letter-spacing: -.035em; }
|
|
86
|
+
.big { font-size: 19cqh; line-height: .85; font-weight: 800; letter-spacing: -.06em; font-variation-settings: 'opsz' 96; }
|
|
87
|
+
.huge { font-size: 25cqh; line-height: .82; font-weight: 800; letter-spacing: -.065em; font-variation-settings: 'opsz' 96; }
|
|
88
|
+
.sub { font-size: 3.6cqh; line-height: 1.22; font-weight: 500; letter-spacing: -.015em; opacity: .92; }
|
|
89
|
+
.small { font-size: 2.6cqh; line-height: 1.35; font-weight: 500; opacity: .85; }
|
|
86
90
|
.accent { color: var(--ac); }
|
|
87
|
-
.gap-s { height:
|
|
88
|
-
.hl { background: var(--ac); color: var(--bg); padding: 0
|
|
91
|
+
.gap-s { height: 2cqh; } .gap-m { height: 4cqh; } .gap-l { height: 7cqh; } .grow { flex: 1; }
|
|
92
|
+
.hl { background: var(--ac); color: var(--bg); padding: 0 1cqh; border-radius: 1cqh; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
|
|
89
93
|
|
|
90
94
|
/* entrance animation */
|
|
91
95
|
.in { opacity: 0; }
|
|
92
96
|
.slide.active .in { animation: rise .9s cubic-bezier(.16,1,.3,1) both; animation-delay: var(--d, 0s); }
|
|
93
97
|
.slide.active .pop { animation: pop .9s cubic-bezier(.34,1.56,.64,1) both; animation-delay: var(--d, 0s); }
|
|
94
|
-
@keyframes rise { from { opacity: 0; transform: translateY(
|
|
98
|
+
@keyframes rise { from { opacity: 0; transform: translateY(5cqh); } to { opacity: 1; transform: none; } }
|
|
95
99
|
@keyframes pop { from { opacity: 0; transform: scale(.6) rotate(-4deg); } to { opacity: 1; transform: none; } }
|
|
96
100
|
|
|
97
101
|
/* decorative shapes */
|
|
98
102
|
.deco { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
|
|
99
103
|
.deco > * { position: absolute; }
|
|
100
|
-
.content { position: relative; z-index: 2; display: flex; flex-direction: column; flex: 1; min-height: 0; }
|
|
101
104
|
.spin { animation: spin 40s linear infinite; }
|
|
102
105
|
.spin-r { animation: spin 55s linear infinite reverse; }
|
|
103
106
|
.float { animation: float 7s ease-in-out infinite; }
|
|
104
107
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
105
|
-
@keyframes float { 50% { transform: translateY(-
|
|
106
|
-
.slide.active .deco > * { animation-play-state: running; }
|
|
108
|
+
@keyframes float { 50% { transform: translateY(-2cqh) rotate(6deg); } }
|
|
107
109
|
|
|
108
110
|
/* lists (top 5) */
|
|
109
|
-
.list { display: flex; flex-direction: column; gap:
|
|
110
|
-
.row { display: grid; grid-template-columns:
|
|
111
|
-
.row .n { font-size:
|
|
112
|
-
.row .t { font-size:
|
|
113
|
-
.row .v { font-family: var(--mono); font-size:
|
|
114
|
-
.row.first .t { font-size:
|
|
115
|
-
.redact { display: inline-block; height: .75em; border-radius: .2em; background: currentColor; opacity: .85; vertical-align: -.05em; }
|
|
111
|
+
.list { display: flex; flex-direction: column; gap: 2.4cqh; }
|
|
112
|
+
.row { display: grid; grid-template-columns: 6cqh 1fr auto; align-items: baseline; gap: 1.6cqh; }
|
|
113
|
+
.row .n { font-size: 5cqh; font-weight: 800; color: var(--ac); letter-spacing: -.04em; }
|
|
114
|
+
.row .t { font-size: 4.6cqh; font-weight: 700; letter-spacing: -.03em; line-height: 1.05; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
115
|
+
.row .v { font-family: var(--mono); font-size: 2.3cqh; opacity: .75; white-space: nowrap; }
|
|
116
|
+
.row.first .t { font-size: 6cqh; }
|
|
116
117
|
|
|
117
118
|
/* bars chart */
|
|
118
|
-
.cols { display: flex; align-items: flex-end; gap:
|
|
119
|
-
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap:
|
|
120
|
-
.col .pct { font-size:
|
|
121
|
-
.col .bar { width: 100%; border-radius:
|
|
119
|
+
.cols { display: flex; align-items: flex-end; gap: 2cqh; height: 56cqh; }
|
|
120
|
+
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 1.4cqh; min-width: 0; }
|
|
121
|
+
.col .pct { font-size: 5cqh; font-weight: 800; letter-spacing: -.04em; }
|
|
122
|
+
.col .bar { width: 100%; border-radius: 2cqh 2cqh .8cqh .8cqh; transform-origin: bottom; transform: scaleY(0); min-height: 1.4cqh; }
|
|
122
123
|
.slide.active .col .bar { animation: grow 1.2s cubic-bezier(.16,1,.3,1) both; animation-delay: var(--d, .3s); }
|
|
123
124
|
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
|
|
124
|
-
.col .lbl { font-family: var(--mono); font-size: 2.
|
|
125
|
+
.col .lbl { font-family: var(--mono); font-size: 2.1cqh; font-weight: 700; text-align: center; line-height: 1.15; max-width: 100%; min-height: 2.3em; }
|
|
125
126
|
|
|
126
|
-
/*
|
|
127
|
-
.hist { display: flex; align-items: flex-end; gap: .
|
|
128
|
-
.hist i { flex: 1; background: color-mix(in srgb, var(--fg) 35%, transparent); border-radius: .
|
|
127
|
+
/* histogram */
|
|
128
|
+
.hist { display: flex; align-items: flex-end; gap: .5cqh; height: 42cqh; }
|
|
129
|
+
.hist i { flex: 1; background: color-mix(in srgb, var(--fg) 35%, transparent); border-radius: .6cqh; transform-origin: bottom; transform: scaleY(0); min-height: .6cqh; }
|
|
129
130
|
.hist i.peak { background: var(--ac); }
|
|
130
131
|
.slide.active .hist i { animation: grow 1s cubic-bezier(.16,1,.3,1) both; }
|
|
131
|
-
.hist-axis { display: flex; justify-content: space-between; font-family: var(--mono); font-size:
|
|
132
|
+
.hist-axis { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 2cqh; opacity: .65; margin-top: 1.2cqh; }
|
|
132
133
|
|
|
133
134
|
/* stat grid */
|
|
134
|
-
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap:
|
|
135
|
-
.cell .lbl { font-family: var(--mono); font-size: 2.
|
|
136
|
-
.cell .val { font-size:
|
|
137
|
-
.cell .val.sm { font-size:
|
|
135
|
+
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4.5cqh 4cqh; }
|
|
136
|
+
.cell .lbl { font-family: var(--mono); font-size: 2.1cqh; text-transform: uppercase; letter-spacing: .06em; opacity: .7; margin-bottom: .8cqh; }
|
|
137
|
+
.cell .val { font-size: 7.6cqh; font-weight: 800; letter-spacing: -.045em; line-height: .95; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
138
|
+
.cell .val.sm { font-size: 5cqh; line-height: 1.05; }
|
|
138
139
|
|
|
139
140
|
/* vibe rows */
|
|
140
|
-
.vibes { display: flex; flex-direction: column; gap:
|
|
141
|
-
.vibe { display: flex; align-items: baseline; justify-content: space-between; border-bottom: .
|
|
142
|
-
.vibe .w { font-size:
|
|
143
|
-
.vibe .c { font-size:
|
|
144
|
-
.chips { display: flex; flex-wrap: wrap; gap:
|
|
145
|
-
.chip { font-size:
|
|
141
|
+
.vibes { display: flex; flex-direction: column; gap: 1.5cqh; }
|
|
142
|
+
.vibe { display: flex; align-items: baseline; justify-content: space-between; border-bottom: .25cqh solid color-mix(in srgb, var(--fg) 22%, transparent); padding-bottom: 1.4cqh; }
|
|
143
|
+
.vibe .w { font-size: 4.2cqh; font-weight: 700; letter-spacing: -.03em; }
|
|
144
|
+
.vibe .c { font-size: 5.4cqh; font-weight: 800; letter-spacing: -.04em; color: var(--ac); }
|
|
145
|
+
.chips { display: flex; flex-wrap: wrap; gap: 1.4cqh; }
|
|
146
|
+
.chip { font-size: 3.4cqh; font-weight: 700; padding: 1cqh 2.4cqh; border-radius: 99px; background: var(--fg); color: var(--bg); }
|
|
146
147
|
|
|
147
148
|
/* summary card */
|
|
148
149
|
.card { background: var(--fg); color: var(--bg); border-radius: 5cqw; padding: 6cqw; display: flex; flex-direction: column; gap: 4.5cqw; position: relative; overflow: hidden; }
|
|
@@ -176,10 +177,32 @@ button, input { font: inherit; color: inherit; }
|
|
|
176
177
|
.nav-btn { position: fixed; top: 50%; transform: translateY(-50%); z-index: 50; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; display: none; place-items: center; backdrop-filter: blur(8px); }
|
|
177
178
|
.nav-btn:hover { background: rgba(255,255,255,.22); }
|
|
178
179
|
@media (min-width: 700px) { .nav-btn { display: grid; } }
|
|
179
|
-
.nav-btn.prev { left: calc(50% - (
|
|
180
|
-
.nav-btn.next { right: calc(50% - (
|
|
180
|
+
.nav-btn.prev { left: max(8px, calc(50% - var(--sw) / 2 - 62px)); }
|
|
181
|
+
.nav-btn.next { right: max(8px, calc(50% - var(--sw) / 2 - 62px)); }
|
|
181
182
|
.paused .bars i.cur b { animation-play-state: paused !important; }
|
|
182
|
-
.
|
|
183
|
+
.t-card { padding: 0; }
|
|
184
|
+
.t-card .brand { display: none; }
|
|
185
|
+
.t-card::after { display: none; }
|
|
186
|
+
.panel { position: absolute; left: 0; top: 0; width: 50%; height: 100%; z-index: 0; }
|
|
187
|
+
.rc { position: absolute; left: 51.5%; right: 5.5%; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: center; z-index: 2; color: var(--fg); }
|
|
188
|
+
.rc .kicker { font-size: 2.3cqh; letter-spacing: .1em; color: var(--ac); }
|
|
189
|
+
.ttl { font-size: 7.6cqh; font-weight: 800; letter-spacing: -.04em; line-height: 1; margin: 1.6cqh 0 5cqh; }
|
|
190
|
+
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4.4cqh 3cqw; }
|
|
191
|
+
.st { min-width: 0; }
|
|
192
|
+
.st .lb { font-size: 2.8cqh; font-weight: 500; color: var(--ac); opacity: .82; margin-bottom: .8cqh; }
|
|
193
|
+
.st .vl { font-size: 5.6cqh; font-weight: 800; letter-spacing: -.035em; line-height: 1.04; color: var(--ac); }
|
|
194
|
+
.st .vl.num { font-size: 10cqh; letter-spacing: -.05em; line-height: .95; }
|
|
195
|
+
.st .vl.mid { font-size: 6.6cqh; }
|
|
196
|
+
.st .ls { font-size: 4cqh; font-weight: 700; line-height: 1.32; color: var(--ac); letter-spacing: -.02em; }
|
|
197
|
+
.st .ls div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
198
|
+
.st .note { font-size: 2.6cqh; opacity: .7; margin-top: .8cqh; color: var(--fg); }
|
|
199
|
+
.st.wide { grid-column: 1 / -1; }
|
|
200
|
+
.lead { font-size: 3.8cqh; line-height: 1.3; font-weight: 500; opacity: .92; max-width: 92%; }
|
|
201
|
+
.hint { margin-top: 4cqh; font: 700 2.2cqh var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ac); opacity: .8; }
|
|
202
|
+
.rc .foot { position: absolute; left: 0; right: 0; bottom: 6cqh; display: flex; justify-content: space-between; align-items: center; font-size: 3.1cqh; font-weight: 800; color: var(--ac); letter-spacing: -.01em; }
|
|
203
|
+
.rc .foot .lg { width: 5.8cqh; height: 5.8cqh; border-radius: 50%; background: var(--ac); color: #1d1c1f; display: grid; place-items: center; }
|
|
204
|
+
.rc .foot .lg svg { width: 60%; height: 60%; }
|
|
205
|
+
.holo-bg { position: absolute; right: -6%; top: -8%; width: 68%; height: 116%; z-index: 0; filter: blur(.6cqh) saturate(1.15); pointer-events: none; transform: scaleX(-1); }
|
|
183
206
|
.s-summary { padding: 12cqw 0 0; background: #141316; }
|
|
184
207
|
.s-summary .brand { display: none; }
|
|
185
208
|
.final-c { align-items: stretch; }
|
|
@@ -200,6 +223,28 @@ button, input { font: inherit; color: inherit; }
|
|
|
200
223
|
.sheet.open { transform: none; }
|
|
201
224
|
.sheet .grab { width: 12cqw; height: 1.1cqw; border-radius: 9px; background: rgba(255,255,255,.25); align-self: center; margin-bottom: 1.6cqw; }
|
|
202
225
|
.sheet-title { font-size: 5.4cqw; font-weight: 800; letter-spacing: -.02em; margin-bottom: 1cqw; }
|
|
226
|
+
.studio { position: fixed; inset: 0; z-index: 70; background: #131215; color: #f4f1e8; display: flex; flex-direction: column; justify-content: center; opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility 0s linear .5s; overflow: hidden; --cw: min(88vw, 1000px, calc((100dvh - 240px) * 16 / 9)); }
|
|
227
|
+
.studio.open { opacity: 1; visibility: visible; transition: opacity .5s ease; }
|
|
228
|
+
.studio-in { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; width: 100%; }
|
|
229
|
+
.studio .ftitle { font-size: clamp(26px, 3.4vw, 46px); }
|
|
230
|
+
.studio .carousel { width: 100%; padding: 0 calc((100vw - var(--cw)) / 2); gap: 28px; margin-top: clamp(14px, 2.6vh, 30px); }
|
|
231
|
+
.studio .cw { flex: 0 0 var(--cw); }
|
|
232
|
+
.studio .cw:not(.on) { transform: scale(.92); opacity: .4; }
|
|
233
|
+
.studio .cw canvas { border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
|
|
234
|
+
.studio .dots { gap: 10px; margin-top: 18px; }
|
|
235
|
+
.studio .dots i { width: 9px; height: 9px; }
|
|
236
|
+
.studio .sharebtn { margin-top: 20px; padding: 14px 56px; font-size: 22px; }
|
|
237
|
+
.studio .swipe-hint { margin-top: 14px; font: 500 13px var(--mono); opacity: .6; }
|
|
238
|
+
.linkbtn { background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
|
|
239
|
+
.studio .glow { bottom: -30vh; height: 70vh; left: -10%; right: -10%; filter: blur(80px); opacity: .28; }
|
|
240
|
+
.studio .sheet { left: 50%; right: auto; width: min(460px, 94vw); transform: translate(-50%, 110%); border-radius: 24px 24px 0 0; padding: 12px 22px 26px; gap: 12px; }
|
|
241
|
+
.studio .sheet.open { transform: translate(-50%, 0); }
|
|
242
|
+
.studio .sheet .grab { width: 44px; height: 4px; margin-bottom: 6px; }
|
|
243
|
+
.studio .sheet-title { font-size: 21px; margin-bottom: 4px; }
|
|
244
|
+
.studio .btnrow { gap: 10px; }
|
|
245
|
+
.studio .btn { font-size: 15px; padding: 13px 10px; gap: 8px; }
|
|
246
|
+
.studio .btn svg { width: 17px; height: 17px; }
|
|
247
|
+
.studio .btn.alt { box-shadow: inset 0 0 0 1.5px rgba(244,241,232,.4); }
|
|
203
248
|
@media (prefers-reduced-motion: reduce) { .spin, .spin-r, .float { animation: none !important; } }
|
|
204
249
|
</style>
|
|
205
250
|
</head>
|
|
@@ -216,6 +261,7 @@ button, input { font: inherit; color: inherit; }
|
|
|
216
261
|
<button class="nav-btn prev" id="prevBtn" aria-label="Previous"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M15 18l-6-6 6-6"/></svg></button>
|
|
217
262
|
<button class="nav-btn next" id="nextBtn" aria-label="Next"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M9 18l6-6-6-6"/></svg></button>
|
|
218
263
|
<div class="mute-hint">← → or tap · hold to pause</div>
|
|
264
|
+
<div class="studio" id="studio" aria-hidden="true"></div>
|
|
219
265
|
<div class="toast" id="toast"></div>
|
|
220
266
|
<svg width="0" height="0" style="position:absolute" aria-hidden="true"><defs>
|
|
221
267
|
<linearGradient id="aw-shade" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#fff" stop-opacity=".38"/><stop offset=".45" stop-color="#fff" stop-opacity="0"/><stop offset="1" stop-color="#000" stop-opacity=".32"/></linearGradient>
|
|
@@ -240,6 +286,8 @@ const THEMES = {
|
|
|
240
286
|
grape: { bg: '#5B1A8C', fg: '#FCEFFF', ac: '#CDF564' },
|
|
241
287
|
sun: { bg: '#FFD23F', fg: '#161616', ac: '#E8195E' },
|
|
242
288
|
night: { bg: '#101A3A', fg: '#E9EEFF', ac: '#FFD23F' },
|
|
289
|
+
blood: { bg: '#B3121F', fg: '#FFF1E6', ac: '#FFD23F' },
|
|
290
|
+
card: { bg: '#1d1c1f', fg: '#F4F1E8', ac: '#CDF564' },
|
|
243
291
|
};
|
|
244
292
|
|
|
245
293
|
// ---------- helpers ----------
|
|
@@ -297,259 +345,148 @@ function buildSlides(S) {
|
|
|
297
345
|
const stack = S.stack || [];
|
|
298
346
|
const topTool = stack[0];
|
|
299
347
|
const who = S.name ? esc(S.name) + ', ' : '';
|
|
348
|
+
PANELS = [];
|
|
349
|
+
|
|
350
|
+
// Every slide is a landscape card: holographic texture + cover tile on the left, stats on the right.
|
|
351
|
+
const kick = `Your ${esc(year)} AI Wrapped`;
|
|
352
|
+
const seed0 = (T.prompts * 31 + T.hours * 7) | 0;
|
|
353
|
+
let n = 0;
|
|
354
|
+
const card = (key, o) => {
|
|
355
|
+
n++;
|
|
356
|
+
const art = { art: o.art || 'tile', tile: o.tile, accent: o.accent, palette: o.palette, seed: seed0 + n * 17 };
|
|
357
|
+
PANELS.push(art);
|
|
358
|
+
add('card', `
|
|
359
|
+
<canvas class="panel" width="800" height="900" data-p="${PANELS.length - 1}"></canvas>
|
|
360
|
+
<div class="rc" style="--ac:${o.accent}">
|
|
361
|
+
<div class="kicker in" style="--d:.1s">${o.kicker || kick}</div>
|
|
362
|
+
<div class="ttl in" style="--d:.2s${o.big ? ';font-size:13cqh' : ''}">${o.title}</div>
|
|
363
|
+
<div class="body">${o.body}</div>
|
|
364
|
+
<div class="foot"><span class="lg">${LOGO}</span><span>NPX MYAIWRAPPED</span></div>
|
|
365
|
+
</div>`, key);
|
|
366
|
+
};
|
|
367
|
+
let d = .35;
|
|
368
|
+
const nextD = () => (d += .1).toFixed(2);
|
|
369
|
+
const st = (label, value, { num = false, mid = false, note = '', wide = false } = {}) =>
|
|
370
|
+
`<div class="st in${wide ? ' wide' : ''}" style="--d:${nextD()}s"><div class="lb">${label}</div><div class="vl${num ? ' num' : mid ? ' mid' : ''}">${value}</div>${note ? `<div class="note">${note}</div>` : ''}</div>`;
|
|
371
|
+
const ls = (label, items, { wide = false } = {}) =>
|
|
372
|
+
`<div class="st in${wide ? ' wide' : ''}" style="--d:${nextD()}s"><div class="lb">${label}</div><div class="ls">${items.map((t) => `<div>${t}</div>`).join('')}</div></div>`;
|
|
373
|
+
const g2 = (...cells) => { const h = `<div class="g2">${cells.filter(Boolean).join('')}</div>`; d = .35; return h; };
|
|
300
374
|
|
|
301
375
|
// 1. Intro
|
|
302
|
-
|
|
303
|
-
<
|
|
304
|
-
|
|
305
|
-
<div class="content">
|
|
306
|
-
<div class="kicker in" style="--d:.1s">${S.shared ? (S.name ? esc(S.name) + "'s" : 'Someone\'s') : 'Your'} ${esc(year)}</div>
|
|
307
|
-
<div class="grow"></div>
|
|
308
|
-
<div class="huge in" style="--d:.25s;font-size:23cqw">AI<br><span class="accent">Wrapped</span></div>
|
|
309
|
-
<div class="gap-m"></div>
|
|
310
|
-
<div class="sub in" style="--d:.5s">${S.shared ? 'A year of prompts, tokens and late nights with AI coding agents.' : `${who}let's look back at your year with your AI coding agents.`}</div>
|
|
311
|
-
<div class="gap-l"></div>
|
|
312
|
-
</div>`, 'intro');
|
|
376
|
+
card('intro', { accent: '#CDF564', palette: PAL.acid, art: 'sticker', big: true, kicker: `Your ${esc(year)}`,
|
|
377
|
+
title: 'AI<br>Wrapped',
|
|
378
|
+
body: `<div class="lead in" style="--d:.5s">${who}let's look back at your year with your AI coding agents.</div><div class="hint in" style="--d:.8s">Press → or tap to start</div>` });
|
|
313
379
|
|
|
314
380
|
// 2. Prompts
|
|
315
381
|
const perDay = T.activeDays ? Math.round(T.prompts / T.activeDays) : 0;
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
<div class="kicker in" style="--d:.1s">${S.shared ? 'They' : 'You'} talked to ${S.shared ? 'their' : 'your'} agents</div>
|
|
320
|
-
<div class="gap-m"></div>
|
|
321
|
-
<div class="big pop" style="--d:.3s">${count(T.prompts)}</div>
|
|
322
|
-
<div class="h2 in" style="--d:.5s">times ${when}.</div>
|
|
323
|
-
<div class="grow"></div>
|
|
324
|
-
<div class="sub in" style="--d:.8s">Across <b>${int(T.sessions)} sessions</b> on <b>${int(T.activeDays)} different days</b>.${perDay ? ` That's about <span class="hl">${perDay} prompts</span> every day ${S.shared ? 'they' : 'you'} showed up.` : ''}</div>
|
|
325
|
-
</div>`, 'prompts');
|
|
382
|
+
card('prompts', { accent: '#B8A6FF', palette: PAL.ocean, tile: { color: '#3D2BFF', label: 'PROMPTS SENT', text: int(T.prompts) },
|
|
383
|
+
title: 'You talked to your agents',
|
|
384
|
+
body: g2(st('Prompts', count(T.prompts), { num: true }), st('Sessions', count(T.sessions), { num: true }), st('Days you showed up', count(T.activeDays), { num: true }), st('Prompts a day', count(perDay), { num: true })) });
|
|
326
385
|
|
|
327
386
|
// 3. Hours
|
|
328
387
|
const days = T.hours / 24;
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
<div class="kicker in" style="--d:.1s" >Time together</div>
|
|
334
|
-
<div class="gap-m"></div>
|
|
335
|
-
<div class="huge pop" style="--d:.3s">${count(T.hours)}</div>
|
|
336
|
-
<div class="h1 in" style="--d:.5s">hours</div>
|
|
337
|
-
<div class="gap-s"></div>
|
|
338
|
-
<div class="sub in" style="--d:.7s">pair-programming with AI.</div>
|
|
339
|
-
<div class="grow"></div>
|
|
340
|
-
<div class="sub in" style="--d:1s;position:relative;z-index:3;color:#1a0d08">${days >= 2 ? `That's <b>${days.toFixed(days >= 10 ? 0 : 1)} days</b> straight. No sleep. No snacks.` : `That's <b>${weeks.toFixed(1)} work weeks</b> of focus.`}${weeks >= 1 && days >= 2 ? ` Or ${Math.round(weeks)} full work weeks.` : ''}</div>
|
|
341
|
-
</div>`, 'hours');
|
|
388
|
+
card('hours', { accent: '#FF8F7D', palette: PAL.sunset, tile: { color: '#FF5E3A', label: 'HOURS WITH AI', text: int(T.hours) },
|
|
389
|
+
title: 'Time together',
|
|
390
|
+
body: g2(st('Hours with AI', count(T.hours), { num: true }), st("That's", `${days.toFixed(days >= 10 ? 0 : 1)} days`, { mid: true, note: 'straight. No sleep. No snacks.' }),
|
|
391
|
+
st('Work weeks', count(Math.round(T.hours / 40)), { num: true }), S.peakMonth != null ? st('Busiest month', MONTHS_FULL[S.peakMonth], { mid: true, note: `${int(S.months[S.peakMonth])} prompts` }) : '') });
|
|
342
392
|
|
|
343
393
|
// 4. Tokens
|
|
344
394
|
if (T.tokens) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
<div class="gap-l"></div>
|
|
350
|
-
<div class="huge pop accent" style="--d:.3s">${count(T.tokens, 'compact')}</div>
|
|
351
|
-
<div class="h1 in" style="--d:.5s">tokens</div>
|
|
352
|
-
<div class="grow"></div>
|
|
353
|
-
${T.outputTokens ? `<div class="sub in" style="--d:.8s">${S.shared ? 'Their' : 'Your'} agents wrote <b>${compact(T.outputTokens)}</b> of them back.</div>
|
|
354
|
-
<div class="gap-s"></div>
|
|
355
|
-
<div class="sub in" style="--d:1s">That's roughly <span class="hl">${int(Math.max(1, Math.round(T.novels)))} novel${Math.round(T.novels) === 1 ? '' : 's'}</span> worth of words.</div>` : ''}
|
|
356
|
-
</div>`, 'tokens');
|
|
395
|
+
card('tokens', { accent: '#CDF564', palette: PAL.acid, tile: { color: '#1E8F5E', label: 'TOKENS', text: compact(T.tokens) },
|
|
396
|
+
title: 'Together you pushed',
|
|
397
|
+
body: g2(st('Total tokens', count(T.tokens, 'compact'), { num: true }), T.outputTokens ? st('Written back by AI', count(T.outputTokens, 'compact'), { num: true }) : '',
|
|
398
|
+
T.outputTokens ? st("That's roughly", `${int(Math.max(1, Math.round(T.novels)))} novels`, { mid: true, note: 'worth of words', wide: true }) : '') });
|
|
357
399
|
}
|
|
358
400
|
|
|
359
401
|
// 5. AI stack
|
|
360
402
|
if (stack.length) {
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
<div class="content">
|
|
366
|
-
<div class="kicker in" style="--d:.1s">The AI stack</div>
|
|
367
|
-
<div class="gap-s"></div>
|
|
368
|
-
<div class="h1 in" style="--d:.25s">${head}</div>
|
|
369
|
-
<div class="grow"></div>
|
|
370
|
-
<div class="cols">
|
|
371
|
-
${stack.map((s, i) => `<div class="col">
|
|
372
|
-
<div class="pct in" style="--d:${.5 + i * .12}s">${pct(s.share)}</div>
|
|
373
|
-
<div class="bar" style="height:${Math.max(4, (s.share / max) * 100)}%;background:${TOOL_COLORS[s.id] || '#888'};--d:${.4 + i * .12}s"></div>
|
|
374
|
-
<div class="lbl in" style="--d:${.6 + i * .12}s">${esc(s.name)}</div>
|
|
375
|
-
</div>`).join('')}
|
|
376
|
-
</div>
|
|
377
|
-
<div class="gap-m"></div>
|
|
378
|
-
<div class="small in" style="--d:1.1s">Share of prompts. ${esc(topTool.name)}: ${int(topTool.prompts)} prompts, ${int(topTool.hours)} hours.</div>
|
|
379
|
-
</div>`, 'stack');
|
|
403
|
+
const head = stack.length === 1 ? `Loyal to ${esc(topTool.name)}` : topTool.share >= .6 ? `${esc(topTool.name)} was the ride or die` : stack.filter((s) => s.share >= .12).length >= 3 ? 'Kept every option open' : 'A two-agent household';
|
|
404
|
+
card('stack', { accent: '#FF8F7D', palette: PAL.sunset, art: 'agent', title: head,
|
|
405
|
+
body: g2(ls('Top Agents', stack.slice(0, 5).map((s, i) => `${esc(s.name)} · ${pct(s.share)}`), { wide: true }),
|
|
406
|
+
st('Relationship status', esc(relationship(S)), { mid: true, wide: true })) });
|
|
380
407
|
}
|
|
381
408
|
|
|
382
409
|
// 6. Models
|
|
383
410
|
if (S.models && S.models.length) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
<div class="h1 in" style="--d:.25s">Top models</div>
|
|
390
|
-
<div class="gap-l"></div>
|
|
391
|
-
<div class="list">
|
|
392
|
-
${S.models.slice(0, 5).map((m, i) => `<div class="row ${i === 0 ? 'first' : ''} in" style="--d:${.45 + i * .12}s"><div class="n">${i + 1}</div><div class="t">${esc(model(m.name))}</div><div class="v">${compact(m.tokens)} tok</div></div>`).join('')}
|
|
393
|
-
</div>
|
|
394
|
-
<div class="grow"></div>
|
|
395
|
-
<div class="sub in" style="--d:1.2s"><b>${esc(model(S.models[0].name))}</b> did the heavy lifting${S.models.length > 1 ? `, ${Math.round((S.models[0].tokens / S.models.reduce((a, m) => a + m.tokens, 0)) * 100)}% of the top 5's tokens` : ''}.</div>
|
|
396
|
-
</div>`, 'models');
|
|
411
|
+
const m0 = S.models[0];
|
|
412
|
+
card('models', { accent: '#B8A6FF', palette: PAL.ocean, tile: { color: '#5B1A8C', label: 'NO.1 MODEL', text: model(m0.name) },
|
|
413
|
+
title: 'On heavy rotation',
|
|
414
|
+
body: g2(ls('Top Models', S.models.slice(0, 5).map((m, i) => `${esc(model(m.name))} · ${compact(m.tokens)}`), { wide: true }),
|
|
415
|
+
st('Did the heavy lifting', `${Math.round((m0.tokens / S.models.reduce((a, m) => a + m.tokens, 0)) * 100)}%`, { num: true, note: `of tokens went to ${esc(model(m0.name))}`, wide: true })) });
|
|
397
416
|
}
|
|
398
417
|
|
|
399
|
-
// 7. Projects
|
|
418
|
+
// 7. Projects (your own story only, never on share cards)
|
|
400
419
|
if (S.projects && S.projects.length && S.projects[0].name) {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
<div class="kicker in" style="--d:.1s">Where the magic happened</div>
|
|
406
|
-
<div class="gap-s"></div>
|
|
407
|
-
<div class="h1 in" style="--d:.25s">Top projects</div>
|
|
408
|
-
<div class="gap-l"></div>
|
|
409
|
-
<div class="list">
|
|
410
|
-
${S.projects.slice(0, 5).map((p, i) => `<div class="row ${i === 0 ? 'first' : ''} in" style="--d:${.45 + i * .12}s"><div class="n">${i + 1}</div><div class="t">${p.name ? esc(p.name) : `<span class="redact" style="width:${[52, 38, 46, 30, 42][i]}cqw"></span>`}</div><div class="v">${p.hours ? p.hours + 'h' : int(p.prompts) + ' prompts'}</div></div>`).join('')}
|
|
411
|
-
</div>
|
|
412
|
-
<div class="grow"></div>
|
|
413
|
-
<div class="sub in" style="--d:1.2s">${int(T.projects)} projects in total.${p0.name ? ` <b>${esc(p0.name)}</b> got ${p0.hours} hours.` : ' Names kept secret.'}</div>
|
|
414
|
-
</div>`, 'projects');
|
|
420
|
+
card('projects', { accent: '#CDF564', palette: PAL.acid, tile: { color: '#3D2BFF', label: 'NO.1 PROJECT', text: S.projects[0].name },
|
|
421
|
+
title: 'Where the magic happened',
|
|
422
|
+
body: g2(ls('Top Projects', S.projects.slice(0, 5).map((p, i) => `${esc(p.name)} · ${p.hours}h`), { wide: true }),
|
|
423
|
+
st('Projects', count(T.projects), { num: true })) });
|
|
415
424
|
}
|
|
416
425
|
|
|
417
426
|
// 8. What agents did
|
|
418
427
|
const A = S.actions || {};
|
|
419
428
|
if (T.toolCalls) {
|
|
420
|
-
const cells = [['Commands run', A.run], ['Files read', A.read], ['Edits made', A.edit], ['Web lookups', A.web], ['Searches', A.search], ['
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
<div class="kicker in" style="--d:.1s">Meanwhile, ${S.shared ? 'their' : 'your'} agents</div>
|
|
425
|
-
<div class="gap-m"></div>
|
|
426
|
-
<div class="big pop" style="--d:.3s">${count(T.toolCalls, 'compact')}</div>
|
|
427
|
-
<div class="h2 in" style="--d:.45s">actions taken.</div>
|
|
428
|
-
<div class="gap-l"></div>
|
|
429
|
-
<div class="grid2">
|
|
430
|
-
${cells.slice(0, 6).map(([l, v], i) => `<div class="cell in" style="--d:${.6 + i * .08}s"><div class="lbl">${l}</div><div class="val">${compact(v)}</div></div>`).join('')}
|
|
431
|
-
</div>
|
|
432
|
-
<div class="grow"></div>
|
|
433
|
-
${T.filesEdited ? `<div class="sub in" style="--d:1.2s">They touched <span class="hl" style="color:#0E4D41">${int(T.filesEdited)} files</span>.</div>` : ''}
|
|
434
|
-
</div>`, 'actions');
|
|
429
|
+
const cells = [['Commands run', A.run], ['Files read', A.read], ['Edits made', A.edit], ['Web lookups', A.web], ['Searches', A.search], ['Files touched', T.filesEdited]].filter(([, v]) => v).slice(0, 6);
|
|
430
|
+
card('actions', { accent: '#7CE0C3', palette: PAL.ocean, tile: { color: '#0E4D41', label: 'AGENT ACTIONS', text: compact(T.toolCalls) },
|
|
431
|
+
title: 'Meanwhile, your agents',
|
|
432
|
+
body: g2(...cells.map(([l, v]) => st(l, count(v, 'compact'), { num: true }))) });
|
|
435
433
|
}
|
|
436
434
|
|
|
437
435
|
// 9. Languages
|
|
438
436
|
if (S.langs && S.langs.length) {
|
|
439
437
|
const L = S.langs;
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
<div class="content">
|
|
444
|
-
<div class="kicker in" style="--d:.1s">${S.shared ? 'They' : 'You'} mostly spoke</div>
|
|
445
|
-
<div class="gap-s"></div>
|
|
446
|
-
<div class="big pop" style="--d:.3s;font-size:${Math.min(22, 84 / (L[0].name.length * .58)).toFixed(1)}cqw">${esc(L[0].name)}</div>
|
|
447
|
-
<div class="gap-l"></div>
|
|
448
|
-
<div class="list" style="gap:2.6cqw">
|
|
449
|
-
${L.map((l, i) => `<div class="in" style="--d:${.5 + i * .1}s">
|
|
450
|
-
<div style="display:flex;justify-content:space-between;font-weight:700;font-size:4.6cqw;margin-bottom:1cqw"><span>${esc(l.name)}</span><span style="font-family:var(--mono);font-size:3.2cqw;opacity:.7">${int(l.files)} files</span></div>
|
|
451
|
-
<div style="height:2.4cqw;border-radius:9px;background:rgba(0,0,0,.12)"><div style="height:100%;width:${Math.max(4, (l.files / maxL) * 100)}%;border-radius:9px;background:${i === 0 ? '#E8195E' : '#161616'}"></div></div>
|
|
452
|
-
</div>`).join('')}
|
|
453
|
-
</div>
|
|
454
|
-
<div class="grow"></div>
|
|
455
|
-
<div class="sub in" style="--d:1.2s">${L.length >= 5 ? 'A true polyglot.' : L.length >= 3 ? 'Fluent in a few.' : 'Focused.'}</div>
|
|
456
|
-
</div>`, 'langs');
|
|
438
|
+
card('langs', { accent: '#FFD23F', palette: PAL.sunset, tile: { color: '#E8195E', label: 'NO.1 LANGUAGE', text: L[0].name },
|
|
439
|
+
title: 'You mostly spoke',
|
|
440
|
+
body: g2(ls('Top Languages', L.slice(0, 6).map((l, i) => `${esc(l.name)} · ${int(l.files)} files`), { wide: true })) });
|
|
457
441
|
}
|
|
458
442
|
|
|
459
443
|
// 10. Clock
|
|
460
|
-
const H = S.hours || [];
|
|
461
|
-
const maxH = Math.max(1, ...H);
|
|
462
444
|
const night = (S.vibe && S.vibe.nightShare) || 0;
|
|
463
445
|
const ph = S.peakHour;
|
|
464
|
-
const clockHead = night >= .22 ? 'The moon saw a lot of these
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
<div class="huge pop" style="--d:.3s">${hourLabel(ph).replace(' ', '<span style="font-size:.45em;letter-spacing:-.02em"> ')}</span></div>
|
|
471
|
-
<div class="gap-m"></div>
|
|
472
|
-
<div class="h2 in" style="--d:.5s">${clockHead}</div>
|
|
473
|
-
<div class="grow"></div>
|
|
474
|
-
<div class="hist">${H.map((v, i) => `<i class="${i === ph ? 'peak' : ''}" style="height:${(v / maxH) * 100}%;animation-delay:${.6 + i * .025}s"></i>`).join('')}</div>
|
|
475
|
-
<div class="hist-axis"><span>12A</span><span>6A</span><span>12P</span><span>6P</span><span>11P</span></div>
|
|
476
|
-
<div class="gap-m"></div>
|
|
477
|
-
<div class="small in" style="--d:1.2s">${Math.round(night * 100)}% of prompts after 10 PM. ${Math.round(((S.vibe && S.vibe.weekendShare) || 0) * 100)}% on weekends.</div>
|
|
478
|
-
</div>`, 'clock');
|
|
479
|
-
|
|
480
|
-
// 11. Streak + busiest day + longest session
|
|
446
|
+
const clockHead = night >= .22 ? 'The moon saw a lot of these' : ph >= 5 && ph <= 10 ? 'Up early, shipping early' : ph >= 18 ? 'Evenings were for building' : 'A 9-to-5 with extra steps';
|
|
447
|
+
card('clock', { accent: '#B8A6FF', palette: PAL.ocean, art: 'clock', title: clockHead,
|
|
448
|
+
body: g2(st('Peak hour', hourLabel(ph), { num: true }), st('Coding place', esc(codingPlace(ph)), { mid: true }),
|
|
449
|
+
st('After 10 PM', `${Math.round(night * 100)}%`, { num: true }), st('On weekends', `${Math.round(((S.vibe && S.vibe.weekendShare) || 0) * 100)}%`, { num: true })) });
|
|
450
|
+
|
|
451
|
+
// 11. Streak
|
|
481
452
|
if (S.streak && S.streak.days) {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
<div class="h1 in" style="--d:.45s">days in a row</div>
|
|
489
|
-
<div class="gap-s"></div>
|
|
490
|
-
<div class="sub in" style="--d:.6s">${dateLabel(S.streak.from)} → ${dateLabel(S.streak.to)}. Didn't miss a day.</div>
|
|
491
|
-
<div class="grow"></div>
|
|
492
|
-
<div class="grid2">
|
|
493
|
-
${S.busiestDay ? `<div class="cell in" style="--d:.9s"><div class="lbl">Biggest day</div><div class="val sm">${dateLabel(S.busiestDay.date)}</div><div class="small">${int(S.busiestDay.prompts)} prompts</div></div>` : ''}
|
|
494
|
-
${S.longest && S.longest.hours ? `<div class="cell in" style="--d:1s"><div class="lbl">Longest session</div><div class="val sm">${S.longest.hours}h</div><div class="small">${S.longest.project ? esc(S.longest.project) + ' · ' : ''}${esc(TOOL_NAMES[S.longest.tool] || '')}</div></div>` : ''}
|
|
495
|
-
${S.peakMonth != null && S.months ? `<div class="cell in" style="--d:1.1s"><div class="lbl">Busiest month</div><div class="val sm">${MONTHS_FULL[S.peakMonth]}</div><div class="small">${int(S.months[S.peakMonth])} prompts</div></div>` : ''}
|
|
496
|
-
${S.first ? `<div class="cell in" style="--d:1.2s"><div class="lbl">First prompt</div><div class="val sm">${dateLabel(S.first.date)}</div><div class="small">in ${esc(TOOL_NAMES[S.first.tool] || '')}</div></div>` : ''}
|
|
497
|
-
</div>
|
|
498
|
-
</div>`, 'streak');
|
|
453
|
+
card('streak', { accent: '#FF9BD2', palette: PAL.acid, tile: { color: '#E63E9B', label: 'DAYS IN A ROW', text: String(S.streak.days) },
|
|
454
|
+
title: 'Longest streak',
|
|
455
|
+
body: g2(st('Days in a row', count(S.streak.days), { num: true, note: `${dateLabel(S.streak.from)} → ${dateLabel(S.streak.to)}` }),
|
|
456
|
+
S.busiestDay ? st('Biggest day', dateLabel(S.busiestDay.date), { mid: true, note: `${int(S.busiestDay.prompts)} prompts` }) : '',
|
|
457
|
+
S.longest && S.longest.hours ? st('Longest session', `${S.longest.hours}h`, { mid: true, note: esc(TOOL_NAMES[S.longest.tool] || '') }) : '',
|
|
458
|
+
S.first ? st('First prompt', dateLabel(S.first.date), { mid: true, note: `in ${esc(TOOL_NAMES[S.first.tool] || '')}` }) : '') });
|
|
499
459
|
}
|
|
500
460
|
|
|
501
461
|
// 12. Vibe check
|
|
502
462
|
const V = S.vibe || {};
|
|
503
|
-
const
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
</div>
|
|
520
|
-
<div class="grow"></div>
|
|
521
|
-
${V.topWords && V.topWords.length ? `<div class="kicker in" style="--d:1.1s;color:inherit;opacity:.8">Words of the year</div><div class="gap-s"></div><div class="chips in" style="--d:1.2s">${V.topWords.slice(0, 4).map((w) => `<span class="chip">${esc(w)}</span>`).join('')}</div>` : `<div class="sub in" style="--d:1.1s">Average prompt: <b>${int(V.avgLen || 0)} characters</b>.</div>`}
|
|
522
|
-
</div>`, 'vibe');
|
|
463
|
+
const jt = (S.swearJar && S.swearJar.total) || 0;
|
|
464
|
+
const polite = (V.please || 0) + (V.thanks || 0);
|
|
465
|
+
const vibeHead = polite > jt * 1.5 ? 'Polite to the machines' : jt > polite * 2 ? 'Tough love' : 'Honest feedback only';
|
|
466
|
+
card('vibe', { accent: '#FFD23F', palette: PAL.sunset, art: 'sticker', title: vibeHead,
|
|
467
|
+
body: g2(st('"please"', count(V.please || 0), { num: true }), st('"thanks"', count(V.thanks || 0), { num: true }),
|
|
468
|
+
st('"fix"', count(V.fix || 0), { num: true }), st('Questions asked', count(V.questions || 0), { num: true }),
|
|
469
|
+
V.topWords && V.topWords.length ? st('Words of the year', V.topWords.slice(0, 4).map(esc).join(' · '), { mid: true, wide: true }) : '') });
|
|
470
|
+
|
|
471
|
+
// 13. Swear jar: the actual words
|
|
472
|
+
const J = S.swearJar;
|
|
473
|
+
if (J && J.total > 0) {
|
|
474
|
+
const w = J.words || [];
|
|
475
|
+
card('jar', { accent: '#FF6A5C', palette: PAL.sunset, art: 'jar', title: 'Your Swear Jar',
|
|
476
|
+
body: g2(st('Times you swore at AI', count(J.total), { num: true }), J.mostCursedAt ? st('Most cursed at', esc(J.mostCursedAt.name), { mid: true, note: `${int(J.mostCursedAt.count)} times` }) : '',
|
|
477
|
+
ls('Top Words', w.slice(0, 4).map((x, i) => `${esc(x.word)} · ${int(x.count)}`)),
|
|
478
|
+
w.length > 4 ? ls('Also Said', w.slice(4, 8).map((x, i) => `${esc(x.word)} · ${int(x.count)}`)) : (J.worstDay ? st('Worst day', dateLabel(J.worstDay.date), { mid: true, note: `${int(J.worstDay.count)} in one day` }) : '')) });
|
|
523
479
|
}
|
|
524
480
|
|
|
525
|
-
//
|
|
481
|
+
// 14. Persona
|
|
526
482
|
const P = S.persona || { title: 'The Vibe Coder', blurb: '' };
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
<div class="huge pop" style="--d:.6s;font-size:${Math.min(21, 84 / (Math.max(...P.title.split(' ').map((w) => w.length)) * .6)).toFixed(1)}cqw;color:#CDF564">${esc(P.title)}</div>
|
|
535
|
-
<div class="gap-m"></div>
|
|
536
|
-
<div class="sub in" style="--d:1s">${esc(P.blurb)}</div>
|
|
537
|
-
<div class="grow"></div>
|
|
538
|
-
</div>`, 'persona');
|
|
539
|
-
|
|
540
|
-
// 14. Share cards: swipe through, save the one you like
|
|
541
|
-
const cards = cardSpecs(S);
|
|
542
|
-
CARDS = cards;
|
|
543
|
-
add('ink', `
|
|
544
|
-
<div class="glow" id="glow" style="--card-ac:${cards[0].accent}"></div>
|
|
545
|
-
<div class="content final-c">
|
|
546
|
-
<div class="ftitle" id="ftitle" style="color:${cards[0].accent}">${cards[0].title}</div>
|
|
547
|
-
<div class="carousel" id="carousel">${cards.map((c, i) => `<div class="cw${i ? '' : ' on'}" data-i="${i}"><canvas width="1080" height="1920" role="img" aria-label="${esc(c.title)} card"></canvas></div>`).join('')}</div>
|
|
548
|
-
<div class="dots" id="dots">${cards.map((c, i) => `<i class="${i ? '' : 'on'}"></i>`).join('')}</div>
|
|
549
|
-
<button class="sharebtn" id="shareBtn">Share</button>
|
|
550
|
-
<div class="swipe-hint">Swipe for more</div>
|
|
551
|
-
</div>
|
|
552
|
-
<div class="sheet" id="sheet"></div>`, 'summary');
|
|
483
|
+
card('persona', { accent: '#CDF564', palette: PAL.acid, art: 'sticker', title: 'Your AI coding personality',
|
|
484
|
+
body: g2(st('You are', esc(P.title), { mid: true, note: esc(P.blurb), wide: true }),
|
|
485
|
+
st('Relationship status', esc(relationship(S)), { mid: true }), st('Longest streak', `${S.streak ? S.streak.days : 0} days`, { mid: true })) });
|
|
486
|
+
|
|
487
|
+
// 14. Share screen lives outside the story frame (full window, landscape cards)
|
|
488
|
+
CARDS = cardSpecs(S);
|
|
489
|
+
add('ink', '<div class="content"></div>', 'summary');
|
|
553
490
|
|
|
554
491
|
return slides;
|
|
555
492
|
}
|
|
@@ -581,7 +518,7 @@ function makeNoise(seed) {
|
|
|
581
518
|
function fbm(n, x, y) { let s = 0, a = .5, f = 1; for (let i = 0; i < 3; i++) { s += a * n(x * f, y * f); f *= 2.03; a *= .5; } return s; }
|
|
582
519
|
|
|
583
520
|
// Thermal-camera style liquid gradient with an organic edge that melts into the dark below.
|
|
584
|
-
function holo(w, h, seed, palette, fadeDown = 1.05) {
|
|
521
|
+
function holo(w, h, seed, palette, fadeDown = 1.05, dir = 'down') {
|
|
585
522
|
const n1 = makeNoise(seed), n2 = makeNoise(seed * 7 + 3);
|
|
586
523
|
const cv = document.createElement('canvas'); cv.width = w; cv.height = h;
|
|
587
524
|
const ctx = cv.getContext('2d'); const img = ctx.createImageData(w, h); const d = img.data;
|
|
@@ -595,7 +532,7 @@ function holo(w, h, seed, palette, fadeDown = 1.05) {
|
|
|
595
532
|
const t = ((v * 2.3 + qx * 1.1) % 1 + 1) % 1;
|
|
596
533
|
const fi = t * N, i0 = Math.floor(fi) % N, i1 = (i0 + 1) % N, f = fi - Math.floor(fi);
|
|
597
534
|
const c0 = pal[i0], c1 = pal[i1];
|
|
598
|
-
const m = fbm(n1, nx * .55 + 9, ny * .55) * 2.2 + .72 - (y / h) * fadeDown;
|
|
535
|
+
const m = fbm(n1, nx * .55 + 9, ny * .55) * 2.2 + .72 - (dir === 'right' ? x / w : y / h) * fadeDown;
|
|
599
536
|
const a = Math.max(0, Math.min(1, (m - .02) / .22));
|
|
600
537
|
const k = (y * w + x) * 4;
|
|
601
538
|
d[k] = c0[0] + (c1[0] - c0[0]) * f; d[k + 1] = c0[1] + (c1[1] - c0[1]) * f; d[k + 2] = c0[2] + (c1[2] - c0[2]) * f;
|
|
@@ -632,13 +569,16 @@ function codingPlace(h) {
|
|
|
632
569
|
if (h <= 21) return 'The after-hours side project';
|
|
633
570
|
return 'The midnight shift';
|
|
634
571
|
}
|
|
572
|
+
function jarVerdict(n) {
|
|
573
|
+
return n >= 500 ? 'Your agents need therapy.' : n >= 150 ? 'HR has been notified.' : n >= 30 ? 'A little spicy.' : 'Mostly civil.';
|
|
574
|
+
}
|
|
635
575
|
function cardSpecs(S) {
|
|
636
|
-
const T = S.totals, st = S.stack || [], M = S.models || [];
|
|
576
|
+
const T = S.totals, st = S.stack || [], M = S.models || [], J = S.swearJar;
|
|
637
577
|
const seed = (T.prompts * 31 + T.hours * 7 + ((S.streak && S.streak.days) || 0)) | 0;
|
|
638
|
-
|
|
578
|
+
const cards = [
|
|
639
579
|
{ key: 'year', title: 'Your Year in AI', accent: '#FF8F7D', palette: PAL.sunset, seed: seed + 1, art: 'agent',
|
|
640
580
|
rows: [
|
|
641
|
-
[{ label: 'Top Agents', list: st.slice(0, 5).map((s, i) => `${
|
|
581
|
+
[{ label: 'Top Agents', list: st.slice(0, 5).map((s, i) => `${s.name}`) }, { label: 'Top Models', list: M.slice(0, 5).map((m, i) => `${model(m.name)}`) }],
|
|
642
582
|
[{ label: 'Total Tokens', value: compact(T.tokens) }, { label: 'Top Month', value: S.peakMonth != null ? MONTHS_FULL[S.peakMonth] : '—' }],
|
|
643
583
|
] },
|
|
644
584
|
{ key: 'self', title: 'Your AI Self', accent: '#CDF564', palette: PAL.acid, seed: seed + 2, art: 'sticker',
|
|
@@ -654,6 +594,15 @@ function cardSpecs(S) {
|
|
|
654
594
|
[{ label: 'Biggest Day', value: S.busiestDay ? dateLabel(S.busiestDay.date) : '—' }, { label: 'Active Days', value: int(T.activeDays) }],
|
|
655
595
|
] },
|
|
656
596
|
];
|
|
597
|
+
if (J && J.total > 0) {
|
|
598
|
+
cards.unshift({ key: 'jar', title: 'Your Swear Jar', accent: '#FF6A5C', palette: PAL.sunset, seed: seed + 4, art: 'jar',
|
|
599
|
+
rows: [
|
|
600
|
+
[{ label: 'Top Words', list: (J.words || []).slice(0, 4).map((w, i) => `${w.word} · ${int(w.count)}`) },
|
|
601
|
+
{ label: (J.words || []).length > 4 ? 'Also Said' : 'Most Cursed At', list: (J.words || []).length > 4 ? J.words.slice(4, 8).map((w, i) => `${w.word} · ${int(w.count)}`) : [J.mostCursedAt ? J.mostCursedAt.name : '—'] }],
|
|
602
|
+
[{ label: 'Most Cursed At', value: J.mostCursedAt ? J.mostCursedAt.name : '—' }, { label: 'Worst Day', value: J.worstDay ? dateLabel(J.worstDay.date) : '—' }],
|
|
603
|
+
] });
|
|
604
|
+
}
|
|
605
|
+
return cards;
|
|
657
606
|
}
|
|
658
607
|
function wrapLines(ctx, text, maxW) {
|
|
659
608
|
const words = String(text).split(' '); const lines = []; let line = '';
|
|
@@ -675,114 +624,175 @@ function fillShaded(ctx, path, color, x0, y0, x1, y1) {
|
|
|
675
624
|
ctx.save(); ctx.clip(path);
|
|
676
625
|
const g = ctx.createLinearGradient(x0, y0, x1, y1);
|
|
677
626
|
g.addColorStop(0, 'rgba(255,255,255,.42)'); g.addColorStop(.5, 'rgba(255,255,255,0)'); g.addColorStop(1, 'rgba(0,0,0,.34)');
|
|
678
|
-
ctx.fillStyle = g; ctx.fillRect(0, 0,
|
|
627
|
+
ctx.fillStyle = g; ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); ctx.restore();
|
|
679
628
|
}
|
|
680
|
-
const FONT = (w, s) => `${w} ${s}px "Bricolage Grotesque"`;
|
|
681
|
-
const MONO = (s) => `700 ${s}px "JetBrains Mono"`;
|
|
629
|
+
const FONT = (w, s) => `${w} ${Math.round(s)}px "Bricolage Grotesque"`;
|
|
630
|
+
const MONO = (s) => `700 ${Math.round(s)}px "JetBrains Mono"`;
|
|
682
631
|
|
|
683
|
-
|
|
684
|
-
|
|
632
|
+
// Cover art, centred at (cx, cy), SZ px square. Coordinates are relative so it scales.
|
|
633
|
+
function drawArt(ctx, c, S, cx, cy, SZ) {
|
|
634
|
+
const X = cx - SZ / 2, Y = cy - SZ / 2, u = SZ / 600;
|
|
635
|
+
const sheen = () => {
|
|
636
|
+
const g = ctx.createLinearGradient(X, Y, X + SZ, Y + SZ); g.addColorStop(0, 'rgba(255,255,255,.26)'); g.addColorStop(.5, 'rgba(255,255,255,0)'); g.addColorStop(1, 'rgba(0,0,0,.3)');
|
|
637
|
+
ctx.fillStyle = g; ctx.fillRect(X, Y, SZ, SZ);
|
|
638
|
+
};
|
|
685
639
|
ctx.save();
|
|
686
|
-
ctx.shadowColor = 'rgba(0,0,0,.55)'; ctx.shadowBlur = 70; ctx.shadowOffsetY = 30;
|
|
640
|
+
ctx.shadowColor = 'rgba(0,0,0,.55)'; ctx.shadowBlur = 70 * u; ctx.shadowOffsetY = 30 * u;
|
|
687
641
|
if (c.art === 'sticker') {
|
|
688
|
-
const p = new Path2D(); p.arc(
|
|
642
|
+
const p = new Path2D(); p.arc(X + 300 * u, Y + 300 * u, SZ / 2, 0, Math.PI * 2);
|
|
689
643
|
ctx.fillStyle = '#BFD6F2'; ctx.fill(p); ctx.restore();
|
|
690
644
|
ctx.save(); ctx.clip(p);
|
|
691
|
-
const g = ctx.createRadialGradient(
|
|
645
|
+
const g = ctx.createRadialGradient(X + 180 * u, Y + 130 * u, 20 * u, X + 300 * u, Y + 300 * u, 420 * u); g.addColorStop(0, 'rgba(255,255,255,.55)'); g.addColorStop(1, 'rgba(0,0,0,.12)');
|
|
692
646
|
ctx.fillStyle = g; ctx.fillRect(X, Y, SZ, SZ);
|
|
693
|
-
fillShaded(ctx, shapePath(P_BURST,
|
|
694
|
-
fillShaded(ctx, shapePath(P_STAR,
|
|
695
|
-
const o = new Path2D(); o.arc(
|
|
696
|
-
fillShaded(ctx, o, '#FF5E3A',
|
|
697
|
-
ctx.fillStyle = '#F4F1E8'; ctx.font = FONT(800, 92); ctx.textAlign = 'center';
|
|
698
|
-
ctx.shadowColor = 'rgba(0,0,0,.35)'; ctx.shadowBlur = 20; ctx.shadowOffsetY = 6;
|
|
699
|
-
ctx.fillText('AI',
|
|
647
|
+
fillShaded(ctx, shapePath(P_BURST, X + 360 * u, Y + 360 * u, 520 * u, 12), '#3D2BFF', X + 140 * u, Y + 100 * u, X + 580 * u, Y + 620 * u);
|
|
648
|
+
fillShaded(ctx, shapePath(P_STAR, X + 160 * u, Y + 160 * u, 230 * u), '#CDF564', X + 60 * u, Y + 50 * u, X + 260 * u, Y + 270 * u);
|
|
649
|
+
const o = new Path2D(); o.arc(X + 460 * u, Y + 130 * u, 62 * u, 0, Math.PI * 2);
|
|
650
|
+
fillShaded(ctx, o, '#FF5E3A', X + 400 * u, Y + 70 * u, X + 520 * u, Y + 190 * u);
|
|
651
|
+
ctx.fillStyle = '#F4F1E8'; ctx.font = FONT(800, 92 * u); ctx.textAlign = 'center';
|
|
652
|
+
ctx.shadowColor = 'rgba(0,0,0,.35)'; ctx.shadowBlur = 20 * u; ctx.shadowOffsetY = 6 * u;
|
|
653
|
+
ctx.fillText('AI', X + 360 * u, Y + 400 * u);
|
|
654
|
+
ctx.restore();
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
const tile = new Path2D(); tile.roundRect(X, Y, SZ, SZ, 18 * u);
|
|
658
|
+
if (c.art === 'tile') {
|
|
659
|
+
const t = c.tile || {};
|
|
660
|
+
ctx.fillStyle = t.color || '#3D2BFF'; ctx.fill(tile); ctx.restore();
|
|
661
|
+
ctx.save(); ctx.clip(tile);
|
|
662
|
+
fillShaded(ctx, shapePath(P_BURST, X + 520 * u, Y + 160 * u, 560 * u, 8), 'rgba(0,0,0,.22)', X + 260 * u, Y - 100 * u, X + 760 * u, Y + 440 * u);
|
|
663
|
+
fillShaded(ctx, shapePath(P_STAR, X + 90 * u, Y + 100 * u, 150 * u), '#F4F1E8', X + 20 * u, Y + 30 * u, X + 160 * u, Y + 170 * u);
|
|
664
|
+
sheen();
|
|
665
|
+
ctx.fillStyle = '#F4F1E8';
|
|
666
|
+
const words = String(t.text || '').split(' ');
|
|
667
|
+
const lines = words.length > 2 ? [words.slice(0, Math.ceil(words.length / 2)).join(' '), words.slice(Math.ceil(words.length / 2)).join(' ')] : words.length === 2 && words.join(' ').length > 9 ? words : [words.join(' ')];
|
|
668
|
+
let size = (lines.length > 1 ? 132 : 190) * u; ctx.font = FONT(800, size);
|
|
669
|
+
while (lines.some((w) => ctx.measureText(w).width > SZ - 80 * u) && size > 30) { size -= 6; ctx.font = FONT(800, size); }
|
|
670
|
+
lines.forEach((w, i) => ctx.fillText(w, X + 40 * u, Y + SZ - 44 * u - (lines.length - 1 - i) * size * .9));
|
|
671
|
+
ctx.font = MONO(26 * u); ctx.fillText(t.label || '', X + 46 * u, Y + SZ - 44 * u - (lines.length - 1) * size * .9 - size * .78 - 26 * u);
|
|
700
672
|
ctx.restore();
|
|
701
673
|
return;
|
|
702
674
|
}
|
|
703
|
-
|
|
704
|
-
|
|
675
|
+
if (c.art === 'agent' || c.art === 'jar') {
|
|
676
|
+
const isJar = c.art === 'jar';
|
|
705
677
|
const t = (S.stack || [])[0] || { id: 'claude', name: 'Your agent' };
|
|
706
|
-
|
|
707
|
-
ctx.fillStyle = base; ctx.fill(tile); ctx.restore();
|
|
678
|
+
ctx.fillStyle = isJar ? '#E5392B' : (TOOL_COLORS[t.id] || '#D97757'); ctx.fill(tile); ctx.restore();
|
|
708
679
|
ctx.save(); ctx.clip(tile);
|
|
709
|
-
fillShaded(ctx, shapePath(P_BURST,
|
|
710
|
-
fillShaded(ctx, shapePath(P_STAR,
|
|
711
|
-
|
|
712
|
-
ctx.fillStyle = g; ctx.fillRect(X, Y, SZ, SZ);
|
|
713
|
-
const words = t.name.split(' ').slice(-2);
|
|
714
|
-
let size = 132; ctx.font = FONT(800, size);
|
|
715
|
-
while (words.some((w) => ctx.measureText(w).width > SZ - 88) && size > 60) { size -= 6; ctx.font = FONT(800, size); }
|
|
680
|
+
fillShaded(ctx, shapePath(P_BURST, X + 520 * u, Y + 160 * u, 560 * u, 8), 'rgba(0,0,0,.22)', X + 260 * u, Y - 100 * u, X + 760 * u, Y + 440 * u);
|
|
681
|
+
if (!isJar) fillShaded(ctx, shapePath(P_STAR, X + 90 * u, Y + 100 * u, 150 * u), '#F4F1E8', X + 20 * u, Y + 30 * u, X + 160 * u, Y + 170 * u);
|
|
682
|
+
sheen();
|
|
716
683
|
ctx.fillStyle = '#F4F1E8';
|
|
717
|
-
|
|
718
|
-
|
|
684
|
+
if (isJar) {
|
|
685
|
+
ctx.font = FONT(800, 84 * u); ctx.fillText('#@$%&!', X + 40 * u, Y + 120 * u);
|
|
686
|
+
const n = int(S.swearJar.total);
|
|
687
|
+
let size = 250 * u; ctx.font = FONT(800, size);
|
|
688
|
+
while (ctx.measureText(n).width > SZ - 80 * u && size > 60) { size -= 8; ctx.font = FONT(800, size); }
|
|
689
|
+
ctx.fillText(n, X + 36 * u, Y + SZ - 48 * u);
|
|
690
|
+
ctx.font = MONO(26 * u); ctx.fillText('TIMES YOU SWORE AT AI', X + 44 * u, Y + SZ - 48 * u - size * .8 - 22 * u);
|
|
691
|
+
} else {
|
|
692
|
+
const words = t.name.split(' ').slice(-2);
|
|
693
|
+
let size = 132 * u; ctx.font = FONT(800, size);
|
|
694
|
+
while (words.some((w) => ctx.measureText(w).width > SZ - 88 * u) && size > 40) { size -= 6; ctx.font = FONT(800, size); }
|
|
695
|
+
words.forEach((w, i) => ctx.fillText(w, X + 40 * u, Y + SZ - 44 * u - (words.length - 1 - i) * size * .9));
|
|
696
|
+
ctx.font = MONO(26 * u); ctx.fillText('NO.1 AGENT', X + 46 * u, Y + SZ - 44 * u - (words.length - 1) * size * .9 - size * .78 - 26 * u);
|
|
697
|
+
}
|
|
719
698
|
ctx.restore();
|
|
720
699
|
return;
|
|
721
700
|
}
|
|
722
701
|
// clock: the hour-of-day histogram as cover art
|
|
723
702
|
ctx.fillStyle = '#121a36'; ctx.fill(tile); ctx.restore();
|
|
724
703
|
ctx.save(); ctx.clip(tile);
|
|
725
|
-
const H = S.hours || [], mx = Math.max(1, ...H), bw = (SZ - 88) / 24;
|
|
704
|
+
const H = S.hours || [], mx = Math.max(1, ...H), bw = (SZ - 88 * u) / 24;
|
|
726
705
|
H.forEach((v, i) => {
|
|
727
|
-
const bh = Math.max(6, (v / mx) * 340);
|
|
728
|
-
const r = new Path2D(); r.roundRect(X + 44 + i * bw + 2, Y + SZ - 96 - bh, bw - 5, bh, 6);
|
|
706
|
+
const bh = Math.max(6 * u, (v / mx) * 340 * u);
|
|
707
|
+
const r = new Path2D(); r.roundRect(X + 44 * u + i * bw + 2 * u, Y + SZ - 96 * u - bh, bw - 5 * u, bh, 6 * u);
|
|
729
708
|
ctx.fillStyle = i === S.peakHour ? '#F4F1E8' : c.accent; ctx.globalAlpha = i === S.peakHour ? 1 : .85; ctx.fill(r);
|
|
730
709
|
});
|
|
731
710
|
ctx.globalAlpha = 1;
|
|
732
|
-
ctx.fillStyle = 'rgba(244,241,232,.6)'; ctx.font = MONO(22);
|
|
733
|
-
[['12A', 0], ['6A', 6], ['12P', 12], ['6P', 18]].forEach(([l, h]) => ctx.fillText(l, X + 44 + h * bw, Y + SZ - 56));
|
|
734
|
-
ctx.fillStyle = '#F4F1E8'; ctx.font = MONO(26); ctx.fillText('WHEN YOU PROMPT', X + 44, Y + 70);
|
|
735
|
-
ctx.font = FONT(800, 84); ctx.fillText(hourLabel(S.peakHour), X + 40, Y + 160);
|
|
736
|
-
|
|
737
|
-
ctx.fillStyle = g; ctx.fillRect(X, Y, SZ, SZ);
|
|
711
|
+
ctx.fillStyle = 'rgba(244,241,232,.6)'; ctx.font = MONO(22 * u);
|
|
712
|
+
[['12A', 0], ['6A', 6], ['12P', 12], ['6P', 18]].forEach(([l, h]) => ctx.fillText(l, X + 44 * u + h * bw, Y + SZ - 56 * u));
|
|
713
|
+
ctx.fillStyle = '#F4F1E8'; ctx.font = MONO(26 * u); ctx.fillText('WHEN YOU PROMPT', X + 44 * u, Y + 70 * u);
|
|
714
|
+
ctx.font = FONT(800, 84 * u); ctx.fillText(hourLabel(S.peakHour), X + 40 * u, Y + 160 * u);
|
|
715
|
+
sheen();
|
|
738
716
|
ctx.restore();
|
|
739
717
|
}
|
|
740
718
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
ctx.save(); ctx.imageSmoothingQuality = 'high'; ctx.filter = 'blur(5px) saturate(1.15)'; ctx.drawImage(h, -40, -40, W + 80, 1100); ctx.restore();
|
|
747
|
-
drawArt(ctx, c, S);
|
|
748
|
-
if ('letterSpacing' in ctx) ctx.letterSpacing = '-1px';
|
|
749
|
-
let y = 1010;
|
|
750
|
-
const XS = [110, 575], CW = 400;
|
|
719
|
+
// Lays out (and optionally draws) the stat rows; returns the height used.
|
|
720
|
+
function layoutRows(ctx, c, RX, y0, k, draw) {
|
|
721
|
+
const XS = [RX, RX + 370], CW = 340, WIDE = 700;
|
|
722
|
+
let y = y0;
|
|
723
|
+
ctx.fillStyle = c.accent;
|
|
751
724
|
for (const row of c.rows) {
|
|
752
725
|
let rowH = 0;
|
|
753
726
|
row.forEach((cell, i) => {
|
|
754
|
-
const x = XS[i], w = cell.wide ?
|
|
755
|
-
ctx.
|
|
756
|
-
|
|
727
|
+
const x = XS[i], w = cell.wide ? WIDE : CW;
|
|
728
|
+
ctx.font = FONT(500, 26 * k);
|
|
729
|
+
if (draw) { ctx.globalAlpha = .82; ctx.fillText(cell.label, x, y + 26 * k); ctx.globalAlpha = 1; }
|
|
730
|
+
let yy = y + 30 * k;
|
|
757
731
|
if (cell.list) {
|
|
758
|
-
ctx.font = FONT(700,
|
|
759
|
-
cell.list.forEach((l) => { yy +=
|
|
760
|
-
yy +=
|
|
732
|
+
ctx.font = FONT(700, 36 * k);
|
|
733
|
+
cell.list.forEach((l) => { yy += 45 * k; if (draw) ctx.fillText(ellipsize(ctx, l, w), x, yy); });
|
|
734
|
+
yy += 6 * k;
|
|
761
735
|
} else {
|
|
762
736
|
const v = String(cell.value);
|
|
763
737
|
const numeric = /^[\d.,]+[KMB]?$|^\d+ days$|^\d+ (AM|PM)$/.test(v) || v.length <= 6;
|
|
764
|
-
let size = numeric ?
|
|
738
|
+
let size = (numeric ? 92 : 54) * k;
|
|
765
739
|
ctx.font = FONT(800, size);
|
|
766
740
|
let lines = wrapLines(ctx, v, w);
|
|
767
|
-
while ((lines.length > 2 || lines.some((l) => ctx.measureText(l).width > w)) && size >
|
|
768
|
-
lines.slice(0, 2).forEach((l) => { yy += size * .96; ctx.fillText(l, x, yy); });
|
|
769
|
-
yy +=
|
|
741
|
+
while ((lines.length > 2 || lines.some((l) => ctx.measureText(l).width > w)) && size > 28) { size -= 3; ctx.font = FONT(800, size); lines = wrapLines(ctx, v, w); }
|
|
742
|
+
lines.slice(0, 2).forEach((l) => { yy += size * .96; if (draw) ctx.fillText(l, x, yy); });
|
|
743
|
+
yy += 4 * k;
|
|
770
744
|
}
|
|
771
745
|
rowH = Math.max(rowH, yy - y);
|
|
772
746
|
});
|
|
773
|
-
y += rowH +
|
|
747
|
+
y += rowH + 38 * k;
|
|
774
748
|
}
|
|
749
|
+
return y - y0 - 38 * k;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// Left half of every story slide: the same texture + cover art as the share cards.
|
|
753
|
+
function drawPanel(cv, spec, S) {
|
|
754
|
+
const ctx = cv.getContext('2d'), W = cv.width, H = cv.height;
|
|
755
|
+
ctx.fillStyle = '#1d1c1f'; ctx.fillRect(0, 0, W, H);
|
|
756
|
+
const h = holo(150, 170, spec.seed, spec.palette, 1.0, 'right');
|
|
757
|
+
ctx.save(); ctx.imageSmoothingQuality = 'high'; ctx.filter = 'blur(5px) saturate(1.15)'; ctx.drawImage(h, -40, -40, 930, 980); ctx.restore();
|
|
758
|
+
const fade = ctx.createLinearGradient(640, 0, W, 0); fade.addColorStop(0, 'rgba(29,28,31,0)'); fade.addColorStop(1, 'rgba(29,28,31,1)');
|
|
759
|
+
ctx.fillStyle = fade; ctx.fillRect(640, 0, W - 640, H);
|
|
760
|
+
drawArt(ctx, spec, S, 400, 450, 500);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// 1600x900 (16:9) so it fills a post on X: texture + art on the left, stats on the right.
|
|
764
|
+
function renderCard(cv, c, S) {
|
|
765
|
+
const W = 1600, H = 900, ctx = cv.getContext('2d');
|
|
766
|
+
ctx.clearRect(0, 0, W, H);
|
|
767
|
+
ctx.fillStyle = '#1d1c1f'; ctx.fillRect(0, 0, W, H);
|
|
768
|
+
const h = holo(150, 170, c.seed, c.palette, 1.0, 'right');
|
|
769
|
+
ctx.save(); ctx.imageSmoothingQuality = 'high'; ctx.filter = 'blur(5px) saturate(1.15)'; ctx.drawImage(h, -40, -40, 930, 980); ctx.restore();
|
|
770
|
+
// keep the stats side clean: fade the texture out before the text column
|
|
771
|
+
const fade = ctx.createLinearGradient(640, 0, 810, 0); fade.addColorStop(0, 'rgba(29,28,31,0)'); fade.addColorStop(1, 'rgba(29,28,31,1)');
|
|
772
|
+
ctx.fillStyle = fade; ctx.fillRect(640, 0, 170, H);
|
|
773
|
+
ctx.fillStyle = '#1d1c1f'; ctx.fillRect(810, 0, W - 810, H);
|
|
774
|
+
drawArt(ctx, c, S, 400, 450, 500);
|
|
775
|
+
const RX = 830;
|
|
776
|
+
if ('letterSpacing' in ctx) ctx.letterSpacing = '1px';
|
|
777
|
+
ctx.fillStyle = c.accent; ctx.font = MONO(22); ctx.fillText(`MY ${S.label} AI WRAPPED`.toUpperCase(), RX, 110);
|
|
778
|
+
if ('letterSpacing' in ctx) ctx.letterSpacing = '-2px';
|
|
779
|
+
ctx.fillStyle = '#F4F1E8'; ctx.font = FONT(800, 70); ctx.fillText(c.title, RX - 3, 188);
|
|
780
|
+
if ('letterSpacing' in ctx) ctx.letterSpacing = '-1px';
|
|
781
|
+
const top = 250, avail = 520;
|
|
782
|
+
let k = 1;
|
|
783
|
+
while (k > .62 && layoutRows(ctx, c, RX, top, k, false) > avail) k -= .05;
|
|
784
|
+
layoutRows(ctx, c, RX, top, k, true);
|
|
775
785
|
if ('letterSpacing' in ctx) ctx.letterSpacing = '0px';
|
|
776
786
|
// footer
|
|
777
|
-
const lg = new Path2D(); lg.arc(
|
|
787
|
+
const lg = new Path2D(); lg.arc(RX + 28, 830, 28, 0, Math.PI * 2);
|
|
778
788
|
ctx.fillStyle = c.accent; ctx.fill(lg);
|
|
779
|
-
ctx.fillStyle = '#1d1c1f'; ctx.fill(shapePath(P_STAR,
|
|
780
|
-
ctx.textAlign = 'right'; ctx.fillStyle = c.accent; ctx.font = FONT(800,
|
|
789
|
+
ctx.fillStyle = '#1d1c1f'; ctx.fill(shapePath(P_STAR, RX + 28, 830, 33));
|
|
790
|
+
ctx.textAlign = 'right'; ctx.fillStyle = c.accent; ctx.font = FONT(800, 30); ctx.fillText('NPX MYAIWRAPPED', W - 80, 841); ctx.textAlign = 'left';
|
|
781
791
|
addGrain(ctx, W, H, 44);
|
|
782
792
|
}
|
|
783
793
|
|
|
784
794
|
// ---------- player ----------
|
|
785
|
-
let S = null, CARDS = [], cardIdx = 0, slides = [], idx = 0, timer = null, startAt = 0, remaining = SLIDE_MS, paused = false;
|
|
795
|
+
let PANELS = [], goCardFn = null, S = null, CARDS = [], cardIdx = 0, slides = [], idx = 0, timer = null, startAt = 0, remaining = SLIDE_MS, paused = false;
|
|
786
796
|
const $ = (id) => document.getElementById(id);
|
|
787
797
|
const toast = (msg) => { const t = $('toast'); t.textContent = msg; t.classList.add('show'); clearTimeout(t._h); t._h = setTimeout(() => t.classList.remove('show'), 2200); };
|
|
788
798
|
|
|
@@ -795,17 +805,22 @@ function setTheme(name) {
|
|
|
795
805
|
}
|
|
796
806
|
|
|
797
807
|
function render() {
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
808
|
+
// Just the share cards: no story slides.
|
|
809
|
+
CARDS = cardSpecs(S);
|
|
810
|
+
['.shell', '.backdrop', '#prevBtn', '#nextBtn', '.mute-hint'].forEach((q) => { const el = document.querySelector(q); if (el) el.remove(); });
|
|
811
|
+
$('studio').innerHTML = `
|
|
812
|
+
<div class="glow" id="glow" style="--card-ac:${CARDS[0].accent}"></div><div class="grain"></div>
|
|
813
|
+
<div class="studio-in">
|
|
814
|
+
<div class="ftitle" id="ftitle" style="color:${CARDS[0].accent}">${CARDS[0].title}</div>
|
|
815
|
+
<div class="carousel" id="carousel">${CARDS.map((c, i) => `<div class="cw${i ? '' : ' on'}" data-i="${i}"><canvas width="1600" height="900" role="img" aria-label="${esc(c.title)} card"></canvas></div>`).join('')}</div>
|
|
816
|
+
<div class="dots" id="dots">${CARDS.map((c, i) => `<i class="${i ? '' : 'on'}"></i>`).join('')}</div>
|
|
817
|
+
<button class="sharebtn" id="shareBtn">Share</button>
|
|
818
|
+
<div class="swipe-hint">Swipe or press ← → for more cards</div>
|
|
819
|
+
</div>
|
|
820
|
+
<div class="sheet" id="sheet"></div>`;
|
|
807
821
|
drawCards();
|
|
808
|
-
|
|
822
|
+
$('studio').classList.add('open');
|
|
823
|
+
$('studio').setAttribute('aria-hidden', 'false');
|
|
809
824
|
}
|
|
810
825
|
|
|
811
826
|
function animateCounts(el) {
|
|
@@ -830,6 +845,8 @@ function go(i) {
|
|
|
830
845
|
const last = i === slides.length - 1;
|
|
831
846
|
$('tapL').style.display = $('tapR').style.display = last ? 'none' : '';
|
|
832
847
|
if ($('sheet')) $('sheet').classList.remove('open');
|
|
848
|
+
$('studio').classList.toggle('open', last);
|
|
849
|
+
$('studio').setAttribute('aria-hidden', last ? 'false' : 'true');
|
|
833
850
|
const secs = document.querySelectorAll('.slide');
|
|
834
851
|
secs.forEach((s, j) => {
|
|
835
852
|
s.classList.toggle('active', j === i);
|
|
@@ -880,10 +897,15 @@ $('prevBtn').onclick = () => go(idx - 1);
|
|
|
880
897
|
$('nextBtn').onclick = () => go(idx + 1);
|
|
881
898
|
document.addEventListener('keydown', (e) => {
|
|
882
899
|
if (e.target.tagName === 'INPUT') return;
|
|
900
|
+
if ($('studio').classList.contains('open')) {
|
|
901
|
+
if (e.key === 'ArrowRight') { e.preventDefault(); goCardFn && goCardFn(Math.min(CARDS.length - 1, cardIdx + 1)); }
|
|
902
|
+
if (e.key === 'ArrowLeft') { e.preventDefault(); if (cardIdx > 0) goCardFn(cardIdx - 1); }
|
|
903
|
+
if (e.key === 'Escape') { $('sheet').classList.remove('open'); }
|
|
904
|
+
return;
|
|
905
|
+
}
|
|
883
906
|
if (e.key === 'ArrowRight' || e.key === ' ') { e.preventDefault(); go(idx + 1); }
|
|
884
907
|
if (e.key === 'ArrowLeft') go(idx - 1);
|
|
885
908
|
});
|
|
886
|
-
document.addEventListener('visibilitychange', () => (document.hidden ? pause() : resume()));
|
|
887
909
|
|
|
888
910
|
// ---------- share actions ----------
|
|
889
911
|
const ICONS = {
|
|
@@ -909,6 +931,7 @@ function drawCards() {
|
|
|
909
931
|
$('glow').style.setProperty('--card-ac', c.accent);
|
|
910
932
|
};
|
|
911
933
|
const goCard = (i) => car.scrollTo({ left: i * step(), behavior: 'smooth' });
|
|
934
|
+
goCardFn = goCard;
|
|
912
935
|
car.addEventListener('scroll', () => {
|
|
913
936
|
const i = Math.max(0, Math.min(CARDS.length - 1, Math.round(car.scrollLeft / step())));
|
|
914
937
|
if (i !== cardIdx) setCard(i);
|
|
@@ -928,13 +951,11 @@ function openSheet() {
|
|
|
928
951
|
</div>
|
|
929
952
|
<div class="btnrow">
|
|
930
953
|
<button class="btn alt" id="bX">${ICONS.x}Post on X</button>
|
|
931
|
-
<button class="btn alt" id="bReplay">${ICONS.replay}Replay</button>
|
|
932
954
|
</div>
|
|
933
955
|
<div class="btnrow"><button class="btn alt" id="bDone">Done</button></div>`;
|
|
934
956
|
$('bImg').onclick = saveImage;
|
|
935
957
|
$('bCopyImg').onclick = copyImage;
|
|
936
958
|
$('bX').onclick = postX;
|
|
937
|
-
$('bReplay').onclick = () => go(0);
|
|
938
959
|
$('bDone').onclick = () => sh.classList.remove('open');
|
|
939
960
|
requestAnimationFrame(() => sh.classList.add('open'));
|
|
940
961
|
}
|
|
@@ -944,7 +965,7 @@ function cardBlob() {
|
|
|
944
965
|
}
|
|
945
966
|
async function saveImage() {
|
|
946
967
|
const blob = await cardBlob();
|
|
947
|
-
const file = new File([blob], `
|
|
968
|
+
const file = new File([blob], `myaiwrapped-${S.label}-${CARDS[cardIdx].key}.png`, { type: 'image/png' });
|
|
948
969
|
if (matchMedia('(pointer:coarse)').matches && navigator.canShare && navigator.canShare({ files: [file] })) {
|
|
949
970
|
try { await navigator.share({ files: [file], text: tweetText() }); return; } catch {}
|
|
950
971
|
}
|