Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

UI: the job card continues where it is when you come back to it

Gabriele Lozupone3a9983c315e8
diff --git a/marketing/video/src/mocks/jobMotion.ts b/marketing/video/src/mocks/jobMotion.ts
index 5b73b81..9c4dc3c 100644
--- a/marketing/video/src/mocks/jobMotion.ts
+++ b/marketing/video/src/mocks/jobMotion.ts
@@ -8,6 +8,12 @@ import { useCard } from "./card";
export const PROMPT_HOLD_MS = 2200;
export const PROMPT_FADE_MS = 700;
+// The card never leaves the stage in a video: a fresh memory each time, read by nothing here.
+export type { CardMemory } from "../../../../src/components/jobMotion";
+export function cardMemory(): import("../../../../src/components/jobMotion").CardMemory {
+ return { startedAt: null, runningAt: null, phase: { key: "", at: 0 }, step: { key: "", at: 0 }, target: 0, value: 0, typed: 0, typingFrom: null, promptDoneAt: null, promptGone: false, progressShown: false, formStart: { at: null } };
+}
+
export function useJobPercent(_job: JobView, request: GenerationRequest | null | undefined, _learn = false): { pct: number; clock: JobClock } {
const c = useCard();
const clock: JobClock = { elapsed: c.t, inPhase: c.t, inRunning: c.t, sinceStep: 0, enhance: !!request?.enhance, loadSeconds: 20, enhancerSecondsPerWord: 0.015 };
diff --git a/src/components/Cocoon.tsx b/src/components/Cocoon.tsx
index 97a98b7..74f5c62 100644
--- a/src/components/Cocoon.tsx
+++ b/src/components/Cocoon.tsx
@@ -210,8 +210,9 @@ export function drawCocoon(ctx: CanvasRenderingContext2D, threads: Thread[], o:
/** The cocoon behind a job in progress (`pct` 0..100). For an edit the source shows in black
* and white inside it, coming into focus, until the silk fills in. `form` turns the filled
- * cocoon into the whole logo (set just before the image is ready). */
-export function Cocoon({ src, pct, form, dim }: { src?: string; pct: number; form?: boolean; dim?: boolean }) {
+ * cocoon into the whole logo (set just before the image is ready); `formStart` keeps when that
+ * began across mounts, so a card coming back does not form the logo again. */
+export function Cocoon({ src, pct, form, dim, formStart: formAt }: { src?: string; pct: number; form?: boolean; dim?: boolean; formStart?: { at: number | null } }) {
const wrap = useRef<HTMLDivElement>(null);
const canvas = useRef<HTMLCanvasElement>(null);
const [size, setSize] = useState({ w: 0, h: 0 });
@@ -238,7 +239,7 @@ export function Cocoon({ src, pct, form, dim }: { src?: string; pct: number; for
const still = reducedMotion();
let ink = getComputedStyle(document.documentElement).getPropertyValue("--mark").trim() || "#9a9a9a";
let lastInk = 0;
- let formStart: number | null = null;
+ const formed = formAt ?? { at: null };
let raf = 0;
const t0 = performance.now();
@@ -249,10 +250,10 @@ export function Cocoon({ src, pct, form, dim }: { src?: string; pct: number; for
lastInk = now;
}
const { pct: pctNow, form: formNow } = live.current;
- if (formNow && formStart === null) formStart = now;
- if (formStart !== null && now - formStart >= FORM_MS) logoFormedAt = now;
- drawCocoon(ctx, threads, { w: size.w, h: size.h, dpr, ink, t, pct: pctNow, formMs: formStart === null ? null : now - formStart, still });
- if (!still || formStart === null) raf = requestAnimationFrame(draw);
+ if (formNow && formed.at === null) formed.at = now;
+ if (formed.at !== null && now - formed.at >= FORM_MS) logoFormedAt = now;
+ drawCocoon(ctx, threads, { w: size.w, h: size.h, dpr, ink, t, pct: pctNow, formMs: formed.at === null ? null : now - formed.at, still });
+ if (!still || formed.at === null) raf = requestAnimationFrame(draw);
};
raf = requestAnimationFrame(draw);
return () => cancelAnimationFrame(raf);
diff --git a/src/components/Stage.tsx b/src/components/Stage.tsx
index ee1a4f1..98eea29 100644
--- a/src/components/Stage.tsx
+++ b/src/components/Stage.tsx
@@ -14,7 +14,7 @@ import {
import type { GenerationRecord, GenerationRequest, JobView, LutEntry, Mode, Size } from "../lib/types";
import { Cocoon, Hatch } from "./Cocoon";
import { CompareFrame, CompareFullscreen } from "./Compare";
-import { PROMPT_FADE_MS, usePromptLeave, useTypewriter, useJobPercent, wordStyle } from "./jobMotion";
+import { PROMPT_FADE_MS, cardMemory, usePromptLeave, useTypewriter, useJobPercent, wordStyle, type CardMemory } from "./jobMotion";
import { DevelopImg } from "./Develop";
import { LutBar, LutButton, LutOverlay } from "./Lut";
import { IconButton, Popover, useFit } from "./ui";
@@ -70,7 +70,8 @@ function Empty() {
/** A version in progress. With the prompt enhancer, the prompt it writes first takes the whole
* frame, appearing word by word; a couple of seconds after the last word it fades and the
- * completion percentage takes over, over the cocoon (components/Cocoon.tsx). */
+ * completion percentage takes over, over the cocoon (components/Cocoon.tsx). Looking at another
+ * version unmounts the card; coming back continues from where it is (`cardMemory`). */
function Pending({ job, item, labels }: { job: JobView; item: SessionItem; labels: Record<string, string> }) {
const o = job.plan?.output;
const { ref, box } = useFit(o ? o.width / o.height : 1);
@@ -84,12 +85,13 @@ function Pending({ job, item, labels }: { job: JobView; item: SessionItem; label
// The source keeps its own shape inside an expansion; elsewhere it fills the frame.
const outpaint = item.request?.outpaint;
const { pct, clock } = useJobPercent(job, item.request, true);
- const [promptGone, setPromptGone] = useState(false);
+ const [card] = useState(() => cardMemory(job.id));
+ const [promptGone, setPromptGone] = useState(card.promptGone);
const promptPhase = job.enhanced_prompt != null && !promptGone;
return (
<div className="stage-frame" ref={ref}>
<div className={`pending ${promptPhase ? "prompt-phase" : ""}`} style={{ width: box.w, height: box.h }}>
- <Cocoon src={src && !outpaint ? urls.source(src) : undefined} pct={pct} form={pct >= 92} dim={promptPhase} />
+ <Cocoon src={src && !outpaint ? urls.source(src) : undefined} pct={pct} form={pct >= 92} formStart={card.formStart} dim={promptPhase} />
{promptPhase ? (
<PromptPhase
title={title}
@@ -97,19 +99,28 @@ function Pending({ job, item, labels }: { job: JobView; item: SessionItem; label
streaming={job.status === "enhancing_prompt"}
withImage={!!src || item.request?.mode === "compose"}
budget={job.plan?.estimated_seconds || null}
+ card={card}
onCancel={() => cancelJob(job.id)}
- onGone={() => setPromptGone(true)}
+ onGone={() => {
+ card.promptGone = true;
+ setPromptGone(true);
+ }}
/>
) : (
- <ProgressPhase job={job} title={title} pct={pct} clock={clock} />
+ <ProgressPhase job={job} title={title} pct={pct} clock={clock} card={card} />
)}
</div>
</div>
);
}
-function ProgressPhase({ job, title, pct, clock }: { job: JobView; title: string; pct: number; clock: JobClock }) {
+function ProgressPhase({ job, title, pct, clock, card }: { job: JobView; title: string; pct: number; clock: JobClock; card: CardMemory }) {
const o = job.plan?.output;
+ // It fades in the first time only, not when the card comes back.
+ const [resumed] = useState(card.progressShown);
+ useEffect(() => {
+ card.progressShown = true;
+ }, [card]);
const remain = remainingSeconds(job, clock);
const canCancel = !["done", "failed", "cancelled"].includes(job.status);
const notes = job.notes.join(" ");
@@ -117,7 +128,7 @@ function ProgressPhase({ job, title, pct, clock }: { job: JobView; title: string
// Stop keeps its icon, the size and the notes hide (styles.css, @container pending). Hover
// still shows the whole title and the notes.
return (
- <div className="progress-phase">
+ <div className={`progress-phase ${resumed ? "resumed" : ""}`}>
<span className="pending-title" title={title}>
{title}
</span>
@@ -152,19 +163,21 @@ function ProgressPhase({ job, title, pct, clock }: { job: JobView; title: string
* model writes it in a second or two and the image starts right away, so the text keeps
* appearing while the image is made: reading it fills the wait. It never runs ahead of the text
* that has arrived. */
-function PromptPhase(props: { title: string; text: string; streaming: boolean; withImage: boolean; budget: number | null; onCancel: () => void; onGone: () => void }) {
+function PromptPhase(props: { title: string; text: string; streaming: boolean; withImage: boolean; budget: number | null; card: CardMemory; onCancel: () => void; onGone: () => void }) {
const { text, streaming } = props;
- const shown = useTypewriter(text, streaming, props.budget);
+ const shown = useTypewriter(text, streaming, props.budget, props.card);
+ // Words already on screen when the card came back don't fade in again.
+ const [seen] = useState(shown);
const ref = useRef<HTMLDivElement>(null);
const words = useMemo(() => text.split(/(\s+)/), [text]);
const writing = streaming || shown < text.length;
- const leave = usePromptLeave(writing, text, props.onGone);
+ const leave = usePromptLeave(writing, text, props.onGone, props.card);
// Whole words up to the revealed length; each new one fades in once (stable keys).
const visible: React.ReactNode[] = [];
let at = 0;
for (let i = 0; i < words.length && at < shown; i++) {
const w = words[i];
- visible.push(/^\s+$/.test(w) ? w : <span key={i} className="w" style={wordStyle(at, shown)}>{w}</span>);
+ visible.push(/^\s+$/.test(w) ? w : <span key={i} className={at < seen ? "w seen" : "w"} style={wordStyle(at, shown)}>{w}</span>);
at += w.length;
}
// Follow the new words only while the reader is at the bottom; scrolling up to reread stays put.
@@ -948,7 +961,7 @@ export function Stage() {
) : job.status === "failed" || job.status === "cancelled" ? (
<Failed job={job} item={item} />
) : (
- <Pending job={job} item={item} labels={labels} />
+ <Pending key={job.id} job={job} item={item} labels={labels} />
);
} else {
const src = item.gen ? urls.gen(item.gen.id) : urls.input(item.input!.id);
diff --git a/src/components/jobMotion.test.ts b/src/components/jobMotion.test.ts
new file mode 100644
index 0000000..cdd8028
--- /dev/null
+++ b/src/components/jobMotion.test.ts
@@ -0,0 +1,54 @@
+import { describe, expect, it } from "vitest";
+import { cardMemory, forgetCard, newCardMemory, revealedOnReturn } from "./jobMotion";
+
+describe("card memory", () => {
+ it("gives the same memory back for a job until it is forgotten", () => {
+ const m = cardMemory("job-a");
+ m.typed = 42;
+ m.promptGone = true;
+ expect(cardMemory("job-a")).toBe(m);
+ forgetCard("job-a");
+ const fresh = cardMemory("job-a");
+ expect(fresh).not.toBe(m);
+ expect(fresh.typed).toBe(0);
+ expect(fresh.promptGone).toBe(false);
+ forgetCard("job-a");
+ });
+
+ it("keeps a handful of jobs, dropping the oldest", () => {
+ const first = cardMemory("old-0");
+ for (let i = 1; i <= 16; i++) cardMemory(`old-${i}`);
+ expect(cardMemory("old-16")).toBe(cardMemory("old-16"));
+ expect(cardMemory("old-0")).not.toBe(first);
+ for (let i = 0; i <= 16; i++) forgetCard(`old-${i}`);
+ });
+});
+
+describe("prompt shown when the card comes back", () => {
+ const text = "x".repeat(320); // 10 s at 32 characters a second
+
+ it("shows what was revealed when nothing has started yet", () => {
+ const m = newCardMemory(0);
+ expect(revealedOnReturn(m, text, null, 5000)).toBe(0);
+ m.typed = 12;
+ expect(revealedOnReturn(m, text, null, 5000)).toBe(12);
+ });
+
+ it("goes on from where the reveal is now, never back", () => {
+ const m = newCardMemory(0);
+ m.typingFrom = 1000;
+ m.typed = 50;
+ // 5 s of 10 s since the reveal started: half the text.
+ expect(revealedOnReturn(m, text, null, 6000)).toBe(160);
+ // Back right away: what was on screen stays.
+ expect(revealedOnReturn(m, text, null, 1100)).toBe(50);
+ });
+
+ it("shows the whole prompt once its time has passed", () => {
+ const m = newCardMemory(0);
+ m.typingFrom = 0;
+ expect(revealedOnReturn(m, text, null, 60_000)).toBe(text.length);
+ // A quick image shortens the reveal (half its estimate, at least 4 s).
+ expect(revealedOnReturn(m, text, 8, 4000)).toBe(text.length);
+ });
+});
diff --git a/src/components/jobMotion.ts b/src/components/jobMotion.ts
index 3f3e8d5..2200760 100644
--- a/src/components/jobMotion.ts
+++ b/src/components/jobMotion.ts
@@ -29,53 +29,98 @@ function rememberProgress(m: Partial<ProgressMemory>) {
const ENHANCED_MODES = new Set(["generate", "compose", "edit", "multi_reference"]);
+/** What a job's card has shown so far. The card unmounts while another version is on the stage,
+ * so coming back continues from here instead of replaying the percentage and the prompt.
+ * Times are `performance.now()`, valid for this page. */
+export interface CardMemory {
+ startedAt: number | null;
+ runningAt: number | null;
+ phase: { key: string; at: number };
+ step: { key: string; at: number };
+ target: number;
+ value: number;
+ /** Characters of the prompt revealed, and when the reveal started. */
+ typed: number;
+ typingFrom: number | null;
+ /** When the whole prompt was on screen; the prompt's hold counts from here. */
+ promptDoneAt: number | null;
+ promptGone: boolean;
+ progressShown: boolean;
+ formStart: { at: number | null };
+}
+
+export function newCardMemory(now = performance.now()): CardMemory {
+ return { startedAt: null, runningAt: null, phase: { key: "", at: now }, step: { key: "", at: now }, target: 0, value: 0, typed: 0, typingFrom: null, promptDoneAt: null, promptGone: false, progressShown: false, formStart: { at: null } };
+}
+
+/** Cards remembered by job id: the jobs in progress, a handful at most. */
+const cards = new Map<string, CardMemory>();
+const MAX_CARDS = 16;
+
+/** The memory of job `id`'s main card, made on first use. */
+export function cardMemory(id: string): CardMemory {
+ let m = cards.get(id);
+ if (!m) {
+ m = newCardMemory();
+ cards.set(id, m);
+ // Oldest first: a job that never reported its end does not stay forever.
+ for (const k of cards.keys()) {
+ if (cards.size <= MAX_CARDS) break;
+ cards.delete(k);
+ }
+ }
+ return m;
+}
+
+export function forgetCard(id: string) {
+ cards.delete(id);
+}
+
/** Live percentage of a whole job (`jobPercent`), computed a few times a second, only ever going
* up, and eased so it counts up smoothly. Tracks when the job and each phase started; `learn`
- * (the main card only) remembers how long the model load and the prompt enhancer took. */
+ * (the main card only) remembers how long the model load and the prompt enhancer took, and keeps
+ * the card's clock and percentage in `cardMemory` so they continue after the card comes back. */
export function useJobPercent(job: JobView, request: GenerationRequest | null | undefined, learn = false): { pct: number; clock: JobClock } {
const enhance = !!request?.enhance && ENHANCED_MODES.has(job.plan?.mode ?? request?.mode ?? "");
- const [shown, setShown] = useState<{ pct: number; clock: JobClock }>(() => ({ pct: 0, clock: { elapsed: 0, inPhase: 0, inRunning: 0, sinceStep: 0, enhance, ...progressMemory() } }));
+ const [card] = useState(() => (learn ? cardMemory(job.id) : newCardMemory()));
+ const [shown, setShown] = useState<{ pct: number; clock: JobClock }>(() => ({ pct: card.value, clock: { elapsed: 0, inPhase: 0, inRunning: 0, sinceStep: 0, enhance, ...progressMemory() } }));
const live = useRef({ job, enhance });
live.current = { job, enhance };
useEffect(() => {
const mem = progressMemory();
- let startedAt: number | null = null;
- let runningAt: number | null = null;
- let phase = { key: "", at: performance.now() };
- let step = { key: "", at: performance.now() };
- let target = 0;
- let value = 0;
+ const c = card;
const id = window.setInterval(() => {
const { job: j, enhance: e } = live.current;
const now = performance.now();
- if (startedAt === null && j.status !== "queued") startedAt = now;
- if (runningAt === null && j.status === "running") runningAt = now;
+ if (c.startedAt === null && j.status !== "queued") c.startedAt = now;
+ if (c.runningAt === null && j.status === "running") c.runningAt = now;
const key = `${j.status}|${j.stage ?? ""}`;
- if (key !== phase.key) {
+ if (key !== c.phase.key) {
// Learn the phases the plan does not estimate, when they end.
- const took = (now - phase.at) / 1000;
- const was = phase.key.split("|")[0];
+ const took = (now - c.phase.at) / 1000;
+ const was = c.phase.key.split("|")[0];
if (learn && was === "starting_backend" && took > 1) rememberProgress({ loadSeconds: took });
if (learn && was === "enhancing_prompt" && j.enhanced_prompt) {
const words = j.enhanced_prompt.split(/\s+/).filter(Boolean).length;
if (words >= 5) rememberProgress({ enhancerSecondsPerWord: took / words });
}
- phase = { key, at: now };
+ c.phase = { key, at: now };
}
+ if (learn && (j.status === "done" || j.status === "failed" || j.status === "cancelled")) forgetCard(j.id);
const stepKey = j.step ? `${j.stage}|${j.step[0]}/${j.step[1]}` : "";
- if (stepKey !== step.key) step = { key: stepKey, at: now };
+ if (stepKey !== c.step.key) c.step = { key: stepKey, at: now };
const clock: JobClock = {
- elapsed: startedAt === null ? 0 : (now - startedAt) / 1000,
- inPhase: (now - phase.at) / 1000,
- inRunning: runningAt === null ? 0 : (now - runningAt) / 1000,
- sinceStep: (now - step.at) / 1000,
+ elapsed: c.startedAt === null ? 0 : (now - c.startedAt) / 1000,
+ inPhase: (now - c.phase.at) / 1000,
+ inRunning: c.runningAt === null ? 0 : (now - c.runningAt) / 1000,
+ sinceStep: (now - c.step.at) / 1000,
enhance: e,
...mem,
};
- target = Math.max(target, jobPercent(j, clock));
- value += (target - value) * (reducedMotion() ? 1 : 0.18);
- if (target - value < 0.05) value = target;
- setShown({ pct: value, clock });
+ c.target = Math.max(c.target, jobPercent(j, clock));
+ c.value += (c.target - c.value) * (reducedMotion() ? 1 : 0.18);
+ if (c.target - c.value < 0.05) c.value = c.target;
+ setShown({ pct: c.value, clock });
}, 60);
return () => window.clearInterval(id);
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -88,16 +133,21 @@ export const PROMPT_HOLD_MS = 2200;
export const PROMPT_FADE_MS = 700;
/** Once the whole prompt is on screen it holds, then fades (`leaving`, styled by
- * `.prompt-stage.leaving`), then `onGone`. `style` is for a clock other than the browser's. */
-export function usePromptLeave(writing: boolean, text: string, onGone: () => void): { leaving: boolean; style?: CSSProperties } {
- const [leaving, setLeaving] = useState(false);
+ * `.prompt-stage.leaving`), then `onGone`. With `card`, the hold counts from when the prompt was
+ * first complete, also on an earlier mount. `style` is for a clock other than the browser's. */
+export function usePromptLeave(writing: boolean, text: string, onGone: () => void, card?: CardMemory): { leaving: boolean; style?: CSSProperties } {
+ const [leaving, setLeaving] = useState(() => card?.promptDoneAt != null && performance.now() - card.promptDoneAt >= PROMPT_HOLD_MS);
const gone = useRef(onGone);
gone.current = onGone;
useEffect(() => {
if (writing || !text) return;
- const hold = window.setTimeout(() => setLeaving(true), PROMPT_HOLD_MS);
- const end = window.setTimeout(() => gone.current(), PROMPT_HOLD_MS + PROMPT_FADE_MS);
+ const now = performance.now();
+ if (card && card.promptDoneAt === null) card.promptDoneAt = now;
+ const since = card?.promptDoneAt != null ? now - card.promptDoneAt : 0;
+ const hold = window.setTimeout(() => setLeaving(true), Math.max(0, PROMPT_HOLD_MS - since));
+ const end = window.setTimeout(() => gone.current(), Math.max(0, PROMPT_HOLD_MS + PROMPT_FADE_MS - since));
return () => (window.clearTimeout(hold), window.clearTimeout(end));
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [writing, text]);
return { leaving };
}
@@ -111,30 +161,60 @@ export function wordStyle(_at: number, _shown: number): CSSProperties | undefine
/** Calm reading pace of the prompt (characters a second). */
const TYPE_CHARS_PER_S = 32;
+/** Seconds the whole prompt takes to appear: ~32 characters a second, within 4-12 s (and half
+ * the time a quick image takes). */
+function typingSeconds(length: number, budget: number | null): number {
+ const cap = Math.max(4, Math.min(12, budget ? budget * 0.5 : 12));
+ return Math.min(cap, Math.max(4, length / TYPE_CHARS_PER_S));
+}
+
+/** Characters of `text` a card coming back at `now` shows at once: what it had revealed, or what
+ * the reveal has reached meanwhile, whichever is more. */
+export function revealedOnReturn(card: CardMemory, text: string, budget: number | null, now: number): number {
+ if (card.typingFrom === null || !text) return Math.min(text.length, card.typed);
+ const due = (text.length * (now - card.typingFrom)) / 1000 / typingSeconds(text.length, budget);
+ return Math.min(text.length, Math.max(card.typed, due));
+}
+
/** How many characters of `text` to show now: ~32 a second, faster when needed to finish in
- * 4-12 s (and in half the time a quick image takes), never past `text`. */
-export function useTypewriter(text: string, streaming: boolean, budget: number | null): number {
- const [shown, setShown] = useState(() => (reducedMotion() ? text.length : 0));
+ * 4-12 s (and in half the time a quick image takes), never past `text`. With `card`, a card
+ * coming back starts where the reveal is now (`revealedOnReturn`). */
+export function useTypewriter(text: string, streaming: boolean, budget: number | null, card?: CardMemory): number {
+ const [from] = useState(() => {
+ if (!card) return 0;
+ const now = performance.now();
+ const n = revealedOnReturn(card, text, budget, now);
+ card.typed = n;
+ // Finished while the card was away: the prompt's hold counts from then.
+ if (n >= text.length && text && !streaming && card.promptDoneAt === null && card.typingFrom !== null) {
+ card.promptDoneAt = Math.min(now, card.typingFrom + typingSeconds(text.length, budget) * 1000);
+ }
+ return n;
+ });
+ const [shown, setShown] = useState(() => (reducedMotion() ? text.length : from));
const target = useRef({ text, streaming, budget });
target.current = { text, streaming, budget };
- const start = useRef<number | null>(null);
+ const start = useRef<number | null>(card?.typingFrom ?? null);
useEffect(() => {
if (reducedMotion()) return;
let raf = 0;
let last = performance.now();
- let n = 0;
+ let n = from;
const tick = (now: number) => {
const { text: t, streaming: s, budget: b } = target.current;
const dt = Math.min(0.1, (now - last) / 1000);
last = now;
if (t.length > 0 && start.current === null) start.current = now;
if (n < t.length) {
- const cap = Math.max(4, Math.min(12, b ? b * 0.5 : 12));
- const total = Math.min(cap, Math.max(4, t.length / TYPE_CHARS_PER_S));
+ const total = typingSeconds(t.length, b);
const left = Math.max(0.4, total - (now - (start.current ?? now)) / 1000);
const speed = Math.max(s ? 20 : TYPE_CHARS_PER_S, (t.length - n) / left);
n = Math.min(t.length, n + speed * dt);
setShown(n);
+ if (card) {
+ card.typed = n;
+ card.typingFrom = start.current;
+ }
}
// Done once everything has arrived and is on screen.
if (s || n < t.length) raf = requestAnimationFrame(tick);
diff --git a/src/styles.css b/src/styles.css
index e9809de..6f9cfde 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -248,6 +248,7 @@ svg { display: block; flex: none; }
fits above it and the percentage under it at any card size, in container units. */
.progress-phase { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 3.5cqh 6cqw 5.5cqh; color: var(--text-2); font-size: 13px; text-align: center; animation: phase-in 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes phase-in { from { opacity: 0; filter: blur(4px); } to { opacity: 1; filter: none; } }
+.progress-phase.resumed { animation: none; }
.progress-phase .stop-corner { position: absolute; top: 3.5cqh; right: 3cqw; height: 28px; font-size: 12px; }
.progress-foot { display: flex; flex-direction: column; align-items: center; gap: clamp(4px, 1.6cqh, 8px); width: 100%; }
.progress-detail { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@@ -281,6 +282,8 @@ svg { display: block; flex: none; }
.enhanced-label { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12px; letter-spacing: 0.02em; }
/* each word arrives out of a soft blur */
.prompt-text .w { animation: word-in 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
+/* Already read before the card came back (Stage.tsx PromptPhase). */
+.prompt-text .w.seen { animation: none; }
@keyframes word-in { from { opacity: 0; filter: blur(6px); } 40% { opacity: 0.55; } to { opacity: 1; filter: blur(0); } }
.shimmer { background: linear-gradient(90deg, var(--text-3) 0%, var(--text-3) 35%, var(--text) 50%, var(--text-3) 65%, var(--text-3) 100%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2s linear infinite; }
.shimmer svg { color: var(--text-2); }