@superjackfruitlabs/vibekit-frame 0.0.0-bootstrap.0 → 0.0.16

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE +26 -0
  3. package/README.md +98 -1
  4. package/package.json +42 -5
  5. package/src/brand/agentpod.svg +1 -0
  6. package/src/brand/captain-jack.svg +138 -0
  7. package/src/brand/lab.svg +25 -0
  8. package/src/brand/salaam.svg +1 -0
  9. package/src/brand/superdispatch.svg +1 -0
  10. package/src/brand/superexchange.svg +1 -0
  11. package/src/brand/superlibrary.svg +1 -0
  12. package/src/brand/supermessage.svg +1 -0
  13. package/src/brand/superpipeline.svg +1 -0
  14. package/src/brand/supertoolkit.svg +1 -0
  15. package/src/brand/superwitness.svg +1 -0
  16. package/src/client/backdrop-core.d.ts +2 -0
  17. package/src/client/backdrop-core.js +398 -0
  18. package/src/client/backdrop.ts +16 -0
  19. package/src/client/claims.ts +19 -0
  20. package/src/client/doorway.ts +140 -0
  21. package/src/client/footer.ts +34 -0
  22. package/src/client/header.ts +55 -0
  23. package/src/client/index.ts +54 -0
  24. package/src/client/jack-rig.ts +30 -0
  25. package/src/client/jack.ts +257 -0
  26. package/src/client/micro.ts +87 -0
  27. package/src/client/release.ts +31 -0
  28. package/src/client/theme-core.d.ts +19 -0
  29. package/src/client/theme-core.js +46 -0
  30. package/src/client/theme.ts +76 -0
  31. package/src/components/Claims.astro +30 -0
  32. package/src/components/Footer.astro +75 -0
  33. package/src/components/Frame.astro +29 -0
  34. package/src/components/ProductHeader.astro +38 -0
  35. package/src/components/SuiteBar.astro +44 -0
  36. package/src/components/SuiteHead.astro +26 -0
  37. package/src/components/early.js +94 -0
  38. package/src/components/shadow.ts +46 -0
  39. package/src/components/styles/bar.css +23 -0
  40. package/src/components/styles/claims.css +20 -0
  41. package/src/components/styles/footer.css +46 -0
  42. package/src/components/styles/header.css +35 -0
  43. package/src/components/styles/jack.css +28 -0
  44. package/src/components/styles/tokens.css +10 -0
  45. package/src/data/ledger.snapshot.json +617 -0
  46. package/src/data/ledger.ts +36 -0
  47. package/src/data/products.ts +119 -0
  48. package/src/data/release.ts +63 -0
  49. package/src/vendor/captain-jack/README.txt +3 -0
  50. package/src/vendor/captain-jack/THIRD_PARTY_NOTICES.txt +43 -0
  51. package/src/vendor/captain-jack/avatar.css +50 -0
  52. package/src/vendor/captain-jack/captain-jack.js +185 -0
  53. package/src/vendor/logo-motion.d.ts +2 -0
  54. package/src/vendor/logo-motion.js +142 -0
@@ -0,0 +1,398 @@
1
+ // A procedural background behind each product page, one motif per product, in three layers:
2
+ // passive always moving, quietly, whatever the visitor does
3
+ // active rare, faint events the motif starts by itself (background life, never a show)
4
+ // reactive the pointer's influence, which fades out once the pointer rests
5
+ //
6
+ // supermessage conversation: dots drift up like chatter; now and then one point sends a
7
+ // ring and another replies; the pointer sends rings as it moves
8
+ // superpipeline stages: dashes flow through lanes; a card crosses, waits at the gate
9
+ // column, then goes on; the flow bends around the pointer
10
+ // superlibrary catalogue: a grid of dots breathing in a slow wave; a shelf lights up
11
+ // dot by dot as something is filed; dots near the pointer lift
12
+ // superwitness witnesses: strokes that follow a wandering point and blink in a wave
13
+ // every so often; they turn to watch the pointer while it moves
14
+ // agentpod fleet: drifting nodes linked to their neighbours; a dispatch pulse runs
15
+ // along the links; nodes near the pointer link to it
16
+ // salaam lanterns: warm glows drifting and breathing; one rises and brightens now
17
+ // and then; they lean towards the pointer
18
+ // superdispatch placement: cards drift in from the left; now and then one is held for a
19
+ // slot on the right, a thin line between them, and settles; slots lean to the pointer
20
+ // superexchange rooms: pairs of points across a seam pass a packet there and back; the
21
+ // pointer opens a pair near it
22
+ // supertoolkit tools: small marks turn slowly on a grid; now and then one row clicks into
23
+ // line, like a tool unfolding; marks near the pointer turn to face it
24
+ // lab the suite: soft facets, the lab's amber and each product's hue,
25
+ // drifting slowly; now and then one brightens; they part around the pointer
26
+ //
27
+ // It sits behind the page (position:fixed, z-index:-1, no pointer events), follows the page's
28
+ // light or dark theme, pauses while the tab is hidden, draws one still frame for reduced
29
+ // motion, and caps its resolution so it stays cheap.
30
+ export function mountBackdrop({ product, color, theme, palette = [] }) {
31
+ const canvas = document.createElement('canvas');
32
+ canvas.setAttribute('aria-hidden', 'true');
33
+ canvas.style.cssText = 'position:fixed;inset:0;width:100vw;height:100vh;z-index:-1;pointer-events:none';
34
+ document.body.prepend(canvas);
35
+ const ctx = canvas.getContext('2d');
36
+ const still = matchMedia('(prefers-reduced-motion: reduce)');
37
+ const [cr, cg, cb] = hex(color);
38
+ let light = theme() === 'light';
39
+ // On a light page the product colour is deepened (a third of the way to black) and drawn
40
+ // stronger, or pale grounds wash it out; the neutral marks get darker ink to match.
41
+ const deep = [cr, cg, cb].map((v) => Math.round(v * 0.68));
42
+ const ink = (a) => (light ? `rgba(${deep[0]},${deep[1]},${deep[2]},${Math.min(1, Math.max(0, a) * 1.55)})` : `rgba(${cr},${cg},${cb},${Math.max(0, a)})`);
43
+ // the same treatment for any colour of the palette (the lab draws every product's hue)
44
+ const tint = (rgb) => (a) => (light ? `rgba(${rgb.map((v) => Math.round(v * 0.68)).join(',')},${Math.min(1, Math.max(0, a) * 1.55)})` : `rgba(${rgb.join(',')},${Math.max(0, a)})`);
45
+ const soft = (a) => (light ? `rgba(35,28,22,${Math.min(1, a * 1.5)})` : `rgba(255,255,255,${a})`);
46
+
47
+ let W = 0, H = 0, dpr = 1;
48
+ // presence: 1 while the pointer moves, easing to 0 over ~2s once it rests.
49
+ const pointer = { x: -9999, y: -9999, px: -9999, py: -9999, moved: -1e9, presence: 0 };
50
+ function size() {
51
+ dpr = Math.min(devicePixelRatio || 1, 1.5);
52
+ W = innerWidth; H = innerHeight;
53
+ canvas.width = Math.round(W * dpr); canvas.height = Math.round(H * dpr);
54
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
55
+ motif.resize?.();
56
+ }
57
+ const move = (x, y) => { pointer.px = pointer.x; pointer.py = pointer.y; pointer.x = x; pointer.y = y; pointer.moved = performance.now(); };
58
+ addEventListener('pointermove', (e) => move(e.clientX, e.clientY), { passive: true });
59
+ addEventListener('touchmove', (e) => e.touches[0] && move(e.touches[0].clientX, e.touches[0].clientY), { passive: true });
60
+ document.addEventListener('pointerleave', () => (pointer.moved = -1e9));
61
+
62
+ const rand = (a, b) => a + Math.random() * (b - a);
63
+ const near = (x, y, r) => { const dx = x - pointer.x, dy = y - pointer.y; const d = Math.hypot(dx, dy); return { d, dx, dy, k: Math.max(0, 1 - d / r) * pointer.presence }; };
64
+ const every = (ms) => { let next = performance.now() + rand(ms * 0.3, ms); return (t) => (t > next ? ((next = t + rand(ms * 0.7, ms * 1.3)), true) : false); };
65
+
66
+ const MOTIFS = {
67
+ supermessage() {
68
+ // Water. A small height field (one cell per 8px) runs the classic two-buffer ripple
69
+ // equation: every cell moves towards the average of its neighbours, the difference
70
+ // becomes the next wave, and damping lets it die away. The pointer drags a soft wake
71
+ // through it, now and then a "message" lands as a drop with a reply a moment later,
72
+ // and only the surface's slope is drawn, as faint light and shade in the product
73
+ // colour, scaled up smoothly so it reads as water, never as rings over the text.
74
+ const CELL = 8, DAMP = 0.955;
75
+ let gw = 0, gh = 0, a = null, b = null, img = null, off = null, octx = null;
76
+ const talk = every(5200);
77
+ const drops = [];
78
+ const drop = (x, y, power, r = 2) => {
79
+ const cx = Math.round(x / CELL), cy = Math.round(y / CELL);
80
+ for (let dy = -r; dy <= r; dy++) for (let dx = -r; dx <= r; dx++) {
81
+ const gx = cx + dx, gy = cy + dy;
82
+ if (gx < 1 || gy < 1 || gx >= gw - 1 || gy >= gh - 1) continue;
83
+ const f = 1 - Math.hypot(dx, dy) / (r + 1);
84
+ if (f > 0) a[gy * gw + gx] += power * f;
85
+ }
86
+ };
87
+ return {
88
+ resize() {
89
+ gw = Math.ceil(W / CELL) + 2; gh = Math.ceil(H / CELL) + 2;
90
+ a = new Float32Array(gw * gh); b = new Float32Array(gw * gh);
91
+ off = document.createElement('canvas'); off.width = gw; off.height = gh;
92
+ octx = off.getContext('2d'); img = octx.createImageData(gw, gh);
93
+ },
94
+ frame(t) {
95
+ // the pointer's wake: strength follows speed, capped, so a fast sweep is a swell,
96
+ // not a storm
97
+ if (pointer.presence > 0.6 && pointer.px > -999) {
98
+ const sp = Math.min(1, Math.hypot(pointer.x - pointer.px, pointer.y - pointer.py) / 30);
99
+ if (sp > 0.02) drop(pointer.x, pointer.y, 80 * sp, 2);
100
+ pointer.px = pointer.x; pointer.py = pointer.y;
101
+ }
102
+ // a message lands; a reply follows somewhere else
103
+ if (talk(t)) {
104
+ drops.push({ x: rand(W * 0.1, W * 0.9), y: rand(H * 0.15, H * 0.85), at: t, p: 90 });
105
+ drops.push({ x: rand(W * 0.1, W * 0.9), y: rand(H * 0.15, H * 0.85), at: t + 900, p: 70 });
106
+ }
107
+ for (let i = drops.length - 1; i >= 0; i--) if (t >= drops[i].at) { drop(drops[i].x, drops[i].y, drops[i].p, 2); drops.splice(i, 1); }
108
+ // one step of the wave equation
109
+ for (let y = 1; y < gh - 1; y++) for (let x = 1; x < gw - 1; x++) {
110
+ const k = y * gw + x;
111
+ b[k] = ((a[k - 1] + a[k + 1] + a[k - gw] + a[k + gw]) / 2 - b[k]) * DAMP;
112
+ }
113
+ [a, b] = [b, a];
114
+ // shade by slope: light where the surface faces up-left, shadow where it falls away
115
+ const d = img.data, [r0, g0, b0] = light ? deep : [cr, cg, cb];
116
+ for (let y = 1; y < gh - 1; y++) for (let x = 1; x < gw - 1; x++) {
117
+ const k = y * gw + x, slope = (a[k - 1] - a[k + 1]) + (a[k - gw] - a[k + gw]);
118
+ const v = Math.max(0, Math.min(1, Math.abs(slope) / 80));
119
+ const o = k * 4;
120
+ if (slope > 0) { d[o] = r0; d[o + 1] = g0; d[o + 2] = b0; } else { d[o] = light ? 255 : 0; d[o + 1] = light ? 255 : 0; d[o + 2] = light ? 255 : 0; }
121
+ d[o + 3] = v * (slope > 0 ? (light ? 75 : 55) : (light ? 40 : 35));
122
+ }
123
+ octx.putImageData(img, 0, 0);
124
+ ctx.imageSmoothingEnabled = true;
125
+ ctx.imageSmoothingQuality = 'high';
126
+ ctx.drawImage(off, -CELL, -CELL, gw * CELL, gh * CELL);
127
+ },
128
+ };
129
+ },
130
+ superpipeline() {
131
+ const lanes = 9, parts = [], cards = [];
132
+ const send = every(9000);
133
+ const add = () => parts.push({ lane: Math.floor(rand(0, lanes)), x: rand(-50, W), v: rand(0.4, 1), off: 0 });
134
+ return {
135
+ resize() { parts.length = 0; for (let i = 0; i < 80; i++) add(); },
136
+ frame(t) {
137
+ const gap = H / (lanes + 1), gate = W * 0.68;
138
+ for (let l = 1; l <= lanes; l++) { ctx.fillStyle = soft(0.03); ctx.fillRect(0, l * gap, W, 1); }
139
+ ctx.fillStyle = ink(0.07); ctx.fillRect(gate, gap * 0.5, 2, H - gap);
140
+ for (const p of parts) {
141
+ const baseY = (p.lane + 1) * gap;
142
+ const n = near(p.x, baseY + p.off, 160);
143
+ p.off += ((n.k ? Math.sign(n.dy || 1) * n.k * 70 : 0) - p.off) * 0.08;
144
+ p.x += p.v * (1 - n.k * 0.6);
145
+ if (p.x > W + 20) { p.x = -20; p.lane = Math.floor(rand(0, lanes)); }
146
+ ctx.fillStyle = ink(0.2 + n.k * 0.5); ctx.fillRect(p.x, baseY + p.off - 1.5, 14, 3);
147
+ }
148
+ // A card crosses its lane, waits at the gate for a person, then carries on.
149
+ if (send(t)) cards.push({ lane: Math.floor(rand(0, lanes)), x: -60, held: 0 });
150
+ for (let i = cards.length - 1; i >= 0; i--) {
151
+ const c = cards[i], y = (c.lane + 1) * gap;
152
+ if (c.x < gate - 46 || c.held > 140) c.x += 0.9; else c.held++;
153
+ if (c.x > W + 60) { cards.splice(i, 1); continue; }
154
+ const waiting = c.held > 0 && c.held <= 140;
155
+ ctx.fillStyle = ink(waiting ? 0.2 + 0.04 * Math.sin(t / 600) : 0.16); ctx.fillRect(c.x, y - 5, 30, 10);
156
+ if (waiting) { ctx.strokeStyle = ink(0.16); ctx.strokeRect(gate - 4, y - 10, 10, 20); }
157
+ }
158
+ },
159
+ };
160
+ },
161
+ superlibrary() {
162
+ const step = 28;
163
+ const file = every(8000);
164
+ let shelf = null;
165
+ return {
166
+ frame(t) {
167
+ if (file(t)) shelf = { row: Math.floor(rand(1, H / step - 1)), start: t, from: Math.floor(rand(0, W / step / 2)) };
168
+ for (let yi = 0, y = step / 2; y < H; y += step, yi++) {
169
+ for (let xi = 0, x = step / 2; x < W; x += step, xi++) {
170
+ const n = near(x, y, 170), lift = n.k * n.k;
171
+ const wave = 0.5 + 0.5 * Math.sin(t / 1400 - x / 160 - y / 220);
172
+ let lit = 0;
173
+ if (shelf && yi === shelf.row && xi >= shelf.from) { const s = (t - shelf.start) / 90 - (xi - shelf.from); lit = s > 0 && s < 26 ? 0.4 * Math.sin((s / 26) * Math.PI) : 0; }
174
+ const glow = Math.max(lift, lit * 0.8);
175
+ ctx.fillStyle = glow > 0.02 ? ink(0.15 + glow * 0.65) : soft(0.045 + wave * 0.06);
176
+ ctx.beginPath(); ctx.arc(x, y - lift * 6, 1 + wave * 0.35 + glow * 2.2, 0, 6.28); ctx.fill();
177
+ }
178
+ }
179
+ },
180
+ };
181
+ },
182
+ superwitness() {
183
+ const step = 34;
184
+ const blinkEvery = every(11000);
185
+ let ax = 0, ay = 0, blink = null;
186
+ return {
187
+ frame(t) {
188
+ const wx = W / 2 + Math.cos(t / 3100) * W * 0.32, wy = H / 2 + Math.sin(t / 2300) * H * 0.28;
189
+ const p = pointer.presence;
190
+ const tx = wx + (pointer.x - wx) * p, ty = wy + (pointer.y - wy) * p;
191
+ ax += (tx - ax) * 0.06; ay += (ty - ay) * 0.06;
192
+ // A blink travels across the field from a random side.
193
+ if (blinkEvery(t)) blink = { t, x: rand(0, W) };
194
+ ctx.lineCap = 'round';
195
+ for (let y = step / 2; y < H; y += step) {
196
+ for (let x = step / 2; x < W; x += step) {
197
+ const a = Math.atan2(ay - y, ax - x), d = Math.hypot(ax - x, ay - y);
198
+ const k = Math.max(0, 1 - d / 280);
199
+ let open = 1;
200
+ if (blink) { const s = (t - blink.t) / 900 - Math.abs(x - blink.x) / W; open = s > 0 && s < 0.25 ? Math.abs(Math.cos((s / 0.25) * Math.PI)) : 1; }
201
+ const len = (5 + k * 6) * Math.max(0.12, open);
202
+ ctx.strokeStyle = k > 0.02 ? ink(0.14 + k * 0.5) : soft(0.09);
203
+ ctx.lineWidth = 1.3;
204
+ ctx.beginPath(); ctx.moveTo(x - Math.cos(a) * len / 2, y - Math.sin(a) * len / 2); ctx.lineTo(x + Math.cos(a) * len / 2, y + Math.sin(a) * len / 2); ctx.stroke();
205
+ }
206
+ }
207
+ if (blink && t - blink.t > 2200) blink = null;
208
+ },
209
+ };
210
+ },
211
+ agentpod() {
212
+ const nodes = [], pulses = [];
213
+ const dispatch = every(5500);
214
+ return {
215
+ resize() { nodes.length = 0; const n = Math.round((W * H) / 24000); for (let i = 0; i < n; i++) nodes.push({ x: rand(0, W), y: rand(0, H), vx: rand(-0.2, 0.2), vy: rand(-0.2, 0.2) }); },
216
+ frame(t) {
217
+ for (const p of nodes) { p.x += p.vx; p.y += p.vy; if (p.x < 0 || p.x > W) p.vx *= -1; if (p.y < 0 || p.y > H) p.vy *= -1; }
218
+ // The fleet's own links, always faintly there.
219
+ const links = [];
220
+ for (let i = 0; i < nodes.length; i++) for (let j = i + 1; j < nodes.length; j++) {
221
+ const a = nodes[i], b = nodes[j], d = Math.hypot(a.x - b.x, a.y - b.y);
222
+ if (d < 110) { links.push([a, b]); ctx.strokeStyle = soft(0.05 * (1 - d / 110)); ctx.lineWidth = 1; ctx.beginPath(); ctx.moveTo(a.x, a.y); ctx.lineTo(b.x, b.y); ctx.stroke(); }
223
+ }
224
+ // A dispatch runs from node to node along the links.
225
+ if (dispatch(t) && links.length) { const [a, b] = links[Math.floor(rand(0, links.length))]; pulses.push({ a, b, t, hops: 2 }); }
226
+ for (let i = pulses.length - 1; i >= 0; i--) {
227
+ const p = pulses[i], s = (t - p.t) / 1100;
228
+ if (s >= 1) {
229
+ const next = links.filter(([u, v]) => (u === p.b || v === p.b) && u !== p.a && v !== p.a);
230
+ if (p.hops > 0 && next.length) { const [u, v] = next[Math.floor(rand(0, next.length))]; pulses[i] = { a: p.b, b: u === p.b ? v : u, t, hops: p.hops - 1 }; } else pulses.splice(i, 1);
231
+ continue;
232
+ }
233
+ ctx.strokeStyle = ink(0.14); ctx.lineWidth = 1; ctx.beginPath(); ctx.moveTo(p.a.x, p.a.y); ctx.lineTo(p.b.x, p.b.y); ctx.stroke();
234
+ ctx.fillStyle = ink(0.35); ctx.beginPath(); ctx.arc(p.a.x + (p.b.x - p.a.x) * s, p.a.y + (p.b.y - p.a.y) * s, 1.8, 0, 6.28); ctx.fill();
235
+ }
236
+ for (const a of nodes) {
237
+ const n = near(a.x, a.y, 220);
238
+ if (n.k > 0) { ctx.strokeStyle = ink(0.35 * n.k); ctx.beginPath(); ctx.moveTo(a.x, a.y); ctx.lineTo(pointer.x, pointer.y); ctx.stroke(); }
239
+ ctx.fillStyle = n.k ? ink(0.3 + n.k * 0.6) : soft(0.14);
240
+ ctx.beginPath(); ctx.arc(a.x, a.y, 1.6 + n.k * 1.6, 0, 6.28); ctx.fill();
241
+ }
242
+ },
243
+ };
244
+ },
245
+ salaam() {
246
+ const glows = [];
247
+ const rise = every(10000);
248
+ return {
249
+ resize() { glows.length = 0; for (let i = 0; i < 12; i++) glows.push({ x: rand(0, W), y: rand(0, H), r: rand(60, 150), ph: rand(0, 6.28), vx: 0, vy: 0, lift: 0 }); },
250
+ frame(t) {
251
+ // Now and then one lantern brightens and rises a little before settling.
252
+ if (rise(t)) glows[Math.floor(rand(0, glows.length))].lift = 0.45;
253
+ for (const g of glows) {
254
+ const n = near(g.x, g.y, 520);
255
+ g.vx += (-n.dx / (n.d || 1)) * n.k * 0.05 + Math.cos(t / 4000 + g.ph) * 0.012;
256
+ g.vy += (-n.dy / (n.d || 1)) * n.k * 0.05 + Math.sin(t / 5000 + g.ph) * 0.012 - g.lift * 0.03;
257
+ g.vx *= 0.96; g.vy *= 0.96; g.x += g.vx; g.y += g.vy; g.lift *= 0.985;
258
+ if (g.y < -g.r) g.y = H + g.r; if (g.y > H + g.r) g.y = -g.r; if (g.x < -g.r) g.x = W + g.r; if (g.x > W + g.r) g.x = -g.r;
259
+ const pulse = 0.7 + 0.3 * Math.sin(t / 1600 + g.ph);
260
+ const grad = ctx.createRadialGradient(g.x, g.y, 0, g.x, g.y, g.r * (1 + g.lift * 0.4));
261
+ grad.addColorStop(0, ink(0.15 * pulse + n.k * 0.1 + g.lift * 0.18));
262
+ grad.addColorStop(1, ink(0));
263
+ ctx.fillStyle = grad; ctx.beginPath(); ctx.arc(g.x, g.y, g.r * (1 + g.lift * 0.4), 0, 6.28); ctx.fill();
264
+ }
265
+ },
266
+ };
267
+ },
268
+ superdispatch() {
269
+ const slots = [], cards = [];
270
+ const place = every(6000);
271
+ let hold = null;
272
+ return {
273
+ resize() {
274
+ slots.length = 0; cards.length = 0;
275
+ const n = Math.max(3, Math.round(H / 120));
276
+ for (let i = 0; i < n; i++) slots.push({ x: W * 0.82, y: (H / (n + 1)) * (i + 1), ph: rand(0, 6.28) });
277
+ for (let i = 0; i < Math.round(W / 90); i++) cards.push({ x: rand(0, W * 0.7), y: rand(0, H), v: rand(0.15, 0.35) });
278
+ },
279
+ frame(t) {
280
+ for (const c of cards) {
281
+ c.x += c.v; if (c.x > W * 0.7) { c.x = -10; c.y = rand(0, H); }
282
+ const n = near(c.x, c.y, 200);
283
+ ctx.fillStyle = n.k ? ink(0.18 + n.k * 0.4) : soft(0.1);
284
+ ctx.fillRect(c.x - 5, c.y - 3.5, 10, 7);
285
+ }
286
+ // Now and then a card is held for one slot: a line, then it settles there.
287
+ if (place(t) && cards.length && slots.length) hold = { t, c: cards[Math.floor(rand(0, cards.length))], s: slots[Math.floor(rand(0, slots.length))] };
288
+ if (hold) {
289
+ const s = Math.min(1, (t - hold.t) / 2400), { c } = hold, x = c.x + (hold.s.x - c.x) * s, y = c.y + (hold.s.y - c.y) * s;
290
+ ctx.strokeStyle = ink(0.1 * (1 - s * 0.5)); ctx.lineWidth = 1; ctx.setLineDash([3, 5]);
291
+ ctx.beginPath(); ctx.moveTo(c.x, c.y); ctx.lineTo(hold.s.x, hold.s.y); ctx.stroke(); ctx.setLineDash([]);
292
+ ctx.fillStyle = ink(0.45); ctx.fillRect(x - 5, y - 3.5, 10, 7);
293
+ if (t - hold.t > 3400) hold = null;
294
+ }
295
+ for (const sl of slots) {
296
+ const n = near(sl.x, sl.y, 260), r = 6 + Math.sin(t / 1800 + sl.ph) * 0.8 + n.k * 2.5;
297
+ ctx.strokeStyle = n.k ? ink(0.18 + n.k * 0.3) : soft(0.07); ctx.lineWidth = 1;
298
+ ctx.beginPath(); ctx.arc(sl.x - n.dx * n.k * 0.04, sl.y - n.dy * n.k * 0.04, r, 0, 6.28); ctx.stroke();
299
+ }
300
+ },
301
+ };
302
+ },
303
+ superexchange() {
304
+ const pairs = [];
305
+ const send = every(4500);
306
+ return {
307
+ resize() { pairs.length = 0; const n = Math.round(H / 70); for (let i = 0; i < n; i++) pairs.push({ y: (H / (n + 1)) * (i + 1) + rand(-12, 12), a: W * rand(0.12, 0.38), b: W * rand(0.62, 0.88), t: -1e9 }); },
308
+ frame(t) {
309
+ if (send(t) && pairs.length) pairs[Math.floor(rand(0, pairs.length))].t = t;
310
+ ctx.strokeStyle = soft(0.06); ctx.lineWidth = 1;
311
+ ctx.beginPath(); ctx.moveTo(W / 2, 0); ctx.lineTo(W / 2, H); ctx.stroke();
312
+ for (const p of pairs) {
313
+ const n = Math.max(near(p.a, p.y, 220).k, near(p.b, p.y, 220).k);
314
+ const s = (t - p.t) / 2600;
315
+ if (n > 0 && s > 1.4) p.t = t;
316
+ const live = s >= 0 && s < 1;
317
+ ctx.strokeStyle = live || n ? ink(0.1 + n * 0.25) : soft(0.05);
318
+ ctx.beginPath(); ctx.moveTo(p.a, p.y); ctx.lineTo(p.b, p.y); ctx.stroke();
319
+ for (const x of [p.a, p.b]) { ctx.fillStyle = live || n ? ink(0.3 + n * 0.4) : soft(0.13); ctx.beginPath(); ctx.arc(x, p.y, 2.2, 0, 6.28); ctx.fill(); }
320
+ if (live) {
321
+ // there and back: out to the far side, then the answer returns
322
+ const u = s < 0.5 ? s * 2 : 2 - s * 2, x = p.a + (p.b - p.a) * (u * u * (3 - 2 * u));
323
+ ctx.fillStyle = ink(0.5); ctx.beginPath(); ctx.arc(x, p.y, 2.6, 0, 6.28); ctx.fill();
324
+ }
325
+ }
326
+ },
327
+ };
328
+ },
329
+ supertoolkit() {
330
+ const step = 46;
331
+ const align = every(9000);
332
+ let row = null;
333
+ return {
334
+ frame(t) {
335
+ if (align(t)) row = { t, y: Math.floor(rand(0, H / step)) };
336
+ ctx.lineCap = 'round';
337
+ for (let j = 0, y = step / 2; y < H; y += step, j++) {
338
+ for (let x = step / 2; x < W; x += step) {
339
+ const n = near(x, y, 220);
340
+ let a = Math.sin(x * 0.013 + y * 0.021 + t / 5000) * 1.2;
341
+ if (n.k > 0) a = a * (1 - n.k) + Math.atan2(n.dy, n.dx) * n.k;
342
+ let on = 0;
343
+ if (row && row.y === j) { const s = (t - row.t) / 1600; on = s > 0 && s < 1 ? Math.sin(s * Math.PI) : 0; a = a * (1 - on); }
344
+ const len = 6 + n.k * 4;
345
+ ctx.strokeStyle = n.k || on ? ink(0.16 + n.k * 0.4 + on * 0.3) : soft(0.08);
346
+ ctx.lineWidth = 1.4;
347
+ ctx.beginPath(); ctx.moveTo(x - Math.cos(a) * len / 2, y - Math.sin(a) * len / 2); ctx.lineTo(x + Math.cos(a) * len / 2, y + Math.sin(a) * len / 2); ctx.stroke();
348
+ }
349
+ }
350
+ if (row && t - row.t > 1700) row = null;
351
+ },
352
+ };
353
+ },
354
+ lab() {
355
+ // The salaam lanterns' physics, quieter, one hue each: the amber twice, every product once.
356
+ const hues = [color, ...palette, color].map((h) => tint(hex(h)));
357
+ const glows = [];
358
+ const wake = every(12000);
359
+ return {
360
+ resize() { glows.length = 0; hues.forEach((ink, i) => glows.push({ ink, x: rand(0, W), y: rand(0, H), r: rand(120, 240), ph: i * 0.9, vx: 0, vy: 0, lift: 0 })); },
361
+ frame(t) {
362
+ if (wake(t)) glows[Math.floor(rand(0, glows.length))].lift = 0.4;
363
+ for (const g of glows) {
364
+ const n = near(g.x, g.y, 420);
365
+ g.vx += (n.dx / (n.d || 1)) * n.k * 0.03 + Math.cos(t / 6000 + g.ph) * 0.008;
366
+ g.vy += (n.dy / (n.d || 1)) * n.k * 0.03 + Math.sin(t / 7000 + g.ph) * 0.008;
367
+ g.vx *= 0.96; g.vy *= 0.96; g.x += g.vx; g.y += g.vy; g.lift *= 0.985;
368
+ if (g.y < -g.r) g.y = H + g.r; if (g.y > H + g.r) g.y = -g.r; if (g.x < -g.r) g.x = W + g.r; if (g.x > W + g.r) g.x = -g.r;
369
+ const pulse = 0.75 + 0.25 * Math.sin(t / 2200 + g.ph);
370
+ const grad = ctx.createRadialGradient(g.x, g.y, 0, g.x, g.y, g.r);
371
+ grad.addColorStop(0, g.ink(0.09 * pulse + g.lift * 0.12));
372
+ grad.addColorStop(1, g.ink(0));
373
+ ctx.fillStyle = grad; ctx.beginPath(); ctx.arc(g.x, g.y, g.r, 0, 6.28); ctx.fill();
374
+ }
375
+ },
376
+ };
377
+ },
378
+ };
379
+ const motif = (MOTIFS[product] ?? MOTIFS.superlibrary)();
380
+ size();
381
+ addEventListener('resize', size);
382
+
383
+ let raf = 0;
384
+ const draw = (t) => {
385
+ const idle = t - pointer.moved;
386
+ pointer.presence = idle < 400 ? 1 : Math.max(0, 1 - (idle - 400) / 1800);
387
+ ctx.clearRect(0, 0, W, H);
388
+ motif.frame(t);
389
+ };
390
+ const loop = (t) => { draw(t); raf = requestAnimationFrame(loop); };
391
+ const start = () => { cancelAnimationFrame(raf); if (still.matches) draw(performance.now()); else raf = requestAnimationFrame(loop); };
392
+ document.addEventListener('visibilitychange', () => (document.hidden ? cancelAnimationFrame(raf) : start()));
393
+ still.addEventListener('change', start);
394
+ start();
395
+ return { setTheme(t) { light = t === 'light'; if (still.matches) draw(performance.now()); } };
396
+ }
397
+
398
+ function hex(h) { const n = parseInt(h.slice(1), 16); return [(n >> 16) & 255, (n >> 8) & 255, n & 255]; }
@@ -0,0 +1,16 @@
1
+ // The procedural background behind the page, one motif per product and one for the lab (backdrop-core.js, ported
2
+ // unchanged from the prototype, SuperMessage's water at its tuned values). It follows the suite
3
+ // theme the head script sets on <html> as data-sjl-theme.
4
+ import { ORDER, PRODUCTS, SITES, type Site } from '../data/products';
5
+ import { mountBackdrop as core } from './backdrop-core.js';
6
+
7
+ const theme = (): 'light' | 'dark' => (document.documentElement.dataset.sjlTheme === 'light' ? 'light' : 'dark');
8
+
9
+ export function mountBackdrop(product: Site): HTMLCanvasElement | null {
10
+ if (!document.body || document.querySelector('canvas[data-sjl-backdrop]')) return null;
11
+ const b = core({ product, color: SITES[product].color, theme, palette: product === 'lab' ? ORDER.map((s) => PRODUCTS[s].color) : [] });
12
+ const canvas = document.body.querySelector<HTMLCanvasElement>(':scope > canvas[aria-hidden]');
13
+ canvas?.setAttribute('data-sjl-backdrop', '');
14
+ new MutationObserver(() => b.setTheme(theme())).observe(document.documentElement, { attributes: true, attributeFilter: ['data-sjl-theme'] });
15
+ return canvas;
16
+ }
@@ -0,0 +1,19 @@
1
+ // Claims are <details>, so they open without JS. The client adds aria-expanded, slides the
2
+ // caveat open (not under reduced motion), and hands "Ask Captain Jack about this" to onAsk.
3
+ const still = (): boolean => matchMedia('(prefers-reduced-motion: reduce)').matches;
4
+
5
+ export function mountClaims(root: ShadowRoot, opts: { onAsk: (question: string) => void }): void {
6
+ root.querySelectorAll<HTMLDetailsElement>('details.claim').forEach((d) => {
7
+ const head = d.querySelector('summary');
8
+ const more = d.querySelector<HTMLElement>('.more');
9
+ const sync = () => head?.setAttribute('aria-expanded', String(d.open));
10
+ sync();
11
+ d.addEventListener('toggle', () => {
12
+ sync();
13
+ if (d.open && more && !still()) {
14
+ more.animate([{ opacity: 0, transform: 'translateY(-4px)' }, { opacity: 1, transform: 'none' }], { duration: 300, easing: 'cubic-bezier(.2,.8,.2,1)' });
15
+ }
16
+ });
17
+ });
18
+ root.querySelectorAll<HTMLButtonElement>('.askit').forEach((b) => b.addEventListener('click', () => opts.onAsk(b.dataset.q ?? '')));
19
+ }
@@ -0,0 +1,140 @@
1
+ // Moving between products crosses origins, so no View Transition can carry the page across.
2
+ // Both sides draw the same doorway instead (the destination's logo and name on its glow): the
3
+ // leaving page fades it in (leaveTo), the arriving page raises it before first paint (early.js)
4
+ // and opens it once the page is ready (revealArrival). Nothing travels in the URL except the
5
+ // theme fragment. Ported from the prototype's frame.js go(), arrival block and prefetch.
6
+ import supermessage from '../brand/supermessage.svg?raw';
7
+ import superpipeline from '../brand/superpipeline.svg?raw';
8
+ import superlibrary from '../brand/superlibrary.svg?raw';
9
+ import superwitness from '../brand/superwitness.svg?raw';
10
+ import agentpod from '../brand/agentpod.svg?raw';
11
+ import salaam from '../brand/salaam.svg?raw';
12
+ import superdispatch from '../brand/superdispatch.svg?raw';
13
+ import superexchange from '../brand/superexchange.svg?raw';
14
+ import supertoolkit from '../brand/supertoolkit.svg?raw';
15
+ import lab from '../brand/lab.svg?raw';
16
+ import { hrefOf, PRODUCTS, slugOf, STATIC_MARK, type Site, type Slug } from '../data/products';
17
+ import { carryFragment } from './theme';
18
+
19
+ const MARKS: Record<Site, string> = { supermessage, superpipeline, superlibrary, superwitness, agentpod, salaam, superdispatch, superexchange, supertoolkit, lab };
20
+
21
+ interface Door {
22
+ el: HTMLElement;
23
+ mark: HTMLElement;
24
+ failsafe?: ReturnType<typeof setTimeout>;
25
+ fade(to: boolean, ms: number): Promise<unknown>;
26
+ remove(): void;
27
+ }
28
+ interface Early { doorway(slug: Site, logo?: string): Door; arrival: Door | null; from: Site | null }
29
+ export const early = (): Early | null => (globalThis as { __sjlFrameEarly?: Early }).__sjlFrameEarly ?? null;
30
+
31
+ // ---- logo motion: the brand pack's bundle, loaded after first paint, never before ----
32
+ type Motion = { create(container: Element, slug: string): { play(): void } };
33
+ let motion: Promise<Motion | null> | null = null;
34
+ function loadMotion(): Promise<Motion | null> {
35
+ motion ??= import('../vendor/logo-motion.js')
36
+ .then(() => (globalThis as { SJLLogoMotion?: Motion }).SJLLogoMotion ?? null)
37
+ .catch(() => null);
38
+ return motion;
39
+ }
40
+ const afterPaint = (): Promise<void> => new Promise((r) => requestAnimationFrame(() => setTimeout(r, 0)));
41
+
42
+ /** Replaces a doorway's static mark with the brand motion, if the motion bundle loads. */
43
+ async function animate(door: Door, slug: Slug): Promise<void> {
44
+ if (STATIC_MARK.has(slug)) return;
45
+ const m = await loadMotion();
46
+ if (!m || !door.el.isConnected) return;
47
+ try {
48
+ const box = document.createElement('div');
49
+ box.style.cssText = 'width:100%;height:100%';
50
+ const logo = m.create(box, slug);
51
+ door.mark.replaceChildren(box);
52
+ logo.play();
53
+ } catch { /* the static mark stays */ }
54
+ }
55
+
56
+ /** Fades in the destination's doorway over this page (260ms), then leaves for it. */
57
+ let leaving = false;
58
+ export async function leaveTo(slug: Slug): Promise<void> {
59
+ if (leaving) return; // a second click while the doorway closes changes nothing
60
+ leaving = true;
61
+ try {
62
+ await go(slug);
63
+ } catch {
64
+ leaving = false; // a failed leave must not lock every later click out
65
+ location.href = hrefOf(slug, location) + carryFragment();
66
+ }
67
+ }
68
+
69
+ async function go(slug: Slug): Promise<void> {
70
+ const to = hrefOf(slug, location) + carryFragment();
71
+ const e = early();
72
+ if (!e) { location.href = to; return; }
73
+ const door = e.doorway(slug, MARKS[slug]);
74
+ void animate(door, slug);
75
+ await door.fade(true, 260);
76
+ location.href = to;
77
+ }
78
+
79
+ /** Opens the arriving doorway when fonts, load and the frame are ready, ≥650ms after navigation start, ≤1.4s. */
80
+ export function revealArrival(): void {
81
+ const e = early();
82
+ const door = e?.arrival;
83
+ if (!door) return;
84
+ // Whatever happens below (a synchronous throw, a rejected promise), the doorway comes down:
85
+ // an opaque doorway left standing would hide the whole page.
86
+ try {
87
+ const here = slugOf(location.href);
88
+ if (here) afterPaint().then(() => animate(door, here)).catch(() => {});
89
+ const loaded = new Promise<void>((r) => (document.readyState === 'complete' ? r() : addEventListener('load', () => r(), { once: true })));
90
+ // The frame's claims are rendered at build time: they are ready once the document is parsed.
91
+ const frame = new Promise<void>((r) => (document.readyState === 'loading' ? addEventListener('DOMContentLoaded', () => r(), { once: true }) : r()));
92
+ const idle = (): Promise<void> => new Promise((r) => ('requestIdleCallback' in window ? requestIdleCallback(() => r(), { timeout: 250 }) : setTimeout(r, 60)));
93
+ // The logo's motion gets 650ms on its own, then keeps playing as the doorway fades.
94
+ const beat = new Promise((r) => setTimeout(r, Math.max(0, 650 - performance.now())));
95
+ const cap = new Promise((r) => setTimeout(r, Math.max(0, 1400 - performance.now())));
96
+ Promise.race([Promise.all([document.fonts?.ready, loaded, frame, beat]).then(idle), cap])
97
+ .then(() => door.fade(false, 450))
98
+ .catch(() => {})
99
+ .then(() => door.remove(), () => door.remove());
100
+ } catch {
101
+ door.remove();
102
+ }
103
+ clearTimeout(door.failsafe); // claimed only once the chain exists: the client owns the reveal (and its own 1.4s cap)
104
+ }
105
+
106
+ // Back from the next product: the page comes out of the back/forward cache with the doorway still standing.
107
+ function clearOnPageshow(): void {
108
+ addEventListener('pageshow', (ev) => { if (ev.persisted) { leaving = false; document.getElementById('sjl-doorway')?.remove(); } });
109
+ }
110
+
111
+ const prefetched = new Set<Slug>();
112
+ function prefetch(slug: Slug): void {
113
+ if (prefetched.has(slug)) return;
114
+ prefetched.add(slug);
115
+ const l = document.createElement('link');
116
+ l.rel = 'prefetch';
117
+ l.href = hrefOf(slug, location);
118
+ document.head.append(l);
119
+ }
120
+
121
+ /** Product links under `root` (a[data-s]): prefetch on intent, leave through the doorway on click. */
122
+ export function prefetchOnIntent(root: ParentNode): void {
123
+ const here = slugOf(location.href);
124
+ root.querySelectorAll<HTMLAnchorElement>('a[data-s]').forEach((a) => {
125
+ const slug = a.dataset.s as Slug;
126
+ if (!PRODUCTS[slug] || slug === here) return;
127
+ for (const ev of ['pointerenter', 'focus']) a.addEventListener(ev, () => prefetch(slug));
128
+ a.addEventListener('click', (ev) => {
129
+ if (ev.defaultPrevented || ev.button !== 0 || ev.metaKey || ev.ctrlKey || ev.shiftKey || ev.altKey) return;
130
+ ev.preventDefault();
131
+ void leaveTo(slug);
132
+ });
133
+ });
134
+ }
135
+
136
+ /** Arrival reveal and bfcache cleanup; run once per page. */
137
+ export function mountDoorway(): void {
138
+ revealArrival();
139
+ clearOnPageshow();
140
+ }
@@ -0,0 +1,34 @@
1
+ // The footer's behaviour: visits remembered per site in localStorage 'sjl-seen' (plus the
2
+ // product the visitor came from) show as a small tick on each visited product, the releases
3
+ // link picks up a newer version, and the Ask Captain Jack button appears (it needs JavaScript).
4
+ import type { Site } from '../data/products';
5
+ import { liveRelease, releasedOn } from './release';
6
+
7
+ const SEEN = 'sjl-seen';
8
+
9
+ export function remember(here: Site, from: Site | null): Set<string> {
10
+ let seen: string[] = [];
11
+ try { const v = JSON.parse(localStorage.getItem(SEEN) ?? '[]'); if (Array.isArray(v)) seen = v.filter((s) => typeof s === 'string'); } catch { /* none */ }
12
+ const set = new Set([...seen, ...(from ? [from] : []), here]);
13
+ try { localStorage.setItem(SEEN, JSON.stringify([...set])); } catch { /* private mode */ }
14
+ return set;
15
+ }
16
+
17
+ export function mountFooter(root: ShadowRoot, opts: { product: Site; from: Site | null; onAsk?: (question?: string) => void }): void {
18
+ const seen = remember(opts.product, opts.from);
19
+ root.querySelectorAll<HTMLElement>('a.tile[data-s]').forEach((t) => { if (seen.has(t.dataset.s ?? '')) t.classList.add('seen'); });
20
+
21
+ const ask = root.getElementById('ask') as HTMLButtonElement | null;
22
+ if (ask && opts.onAsk) {
23
+ ask.hidden = false;
24
+ ask.addEventListener('click', () => opts.onAsk?.());
25
+ }
26
+
27
+ const rel = root.getElementById('rel');
28
+ if (rel) void liveRelease(opts.product).then((r) => {
29
+ if (!r) return;
30
+ rel.textContent = `Releases · ${r.tag}`;
31
+ const on = releasedOn(r);
32
+ if (on) rel.title = on;
33
+ });
34
+ }