AI media harness for planning, generating, and editing locally
TypeScript
Route every timeline, export and generator colour through the palette
Bitticce9938269f1
diff --git a/src/components/ProjectWorkspace.test.ts b/src/components/ProjectWorkspace.test.tsindex fcb12c0..03951bc 100644--- a/src/components/ProjectWorkspace.test.ts+++ b/src/components/ProjectWorkspace.test.ts@@ -1024,6 +1024,46 @@ describe("project workspace timecode", () => {expect(compiled()).toContain("<Subject 2> walks towards the camera on <Subject 2>");});+ it("keeps a word off the citation wherever in the line it is dropped", () => {+ /* The caret has two sides and the insert used to look at one of them. At+ the START of a line there is nothing in front of the token, so nothing+ forced a space after it and the sentence compiled to+ "<Subject 1>walks towards the camera" — a malformed citation, sent to+ the model exactly as written. Between two words it was the same shape.+ At the very END there is no following word, and a trailing space would+ be litter, so that case must stay as it is. */+ const fresh = lampProject();+ const createdAt = fresh.createdAt;+ const references = [+ { id: "ref-woman", kind: "text", name: "Red-haired woman", description: "Dark red hair.", content: "Dark red hair.", intendedUse: ["character"], createdAt },+ ];+ const start = parseProjectConfig({ ...fresh, references, generationJobs: [{ ...fresh.generationJobs[0], shots: [{ id: "shot-a", startSeconds: 0, action: "walks towards the camera and stops." }], referenceIds: [] }] });++ /* Each case drops the same reference at a different caret offset into the+ same untouched line, so the only variable is where it landed. */+ const dropAt = (caret: number): string => {+ let config = start;+ const onChange = vi.fn((next: ProjectConfig) => { config = parseProjectConfig(next); });+ const view = () => createElement(GeneratorView, { config, folderPath: "C:\\Ceramic Lamp", onChange, onOpenTimeline: () => undefined, selectedJobId: start.generationJobs[0].id });+ const app = render(view());+ const field = screen.getByRole("textbox", { name: "What happens in shot 1" }) as HTMLTextAreaElement;+ field.setSelectionRange(caret, caret);+ const event = createEvent.drop(field);+ Object.defineProperty(event, "dataTransfer", { value: { getData: (type: string) => type === REFERENCE_DRAG_TYPE ? "ref-woman" : "", types: [REFERENCE_DRAG_TYPE] } });+ fireEvent(field, event);+ app.unmount();+ return config.generationJobs[0].shots![0].action;+ };++ const line = "walks towards the camera and stops.";+ expect(dropAt(0)).toBe(`@[ref:ref-woman] ${line}`);+ expect(dropAt(line.length)).toBe(`${line} @[ref:ref-woman]`);+ /* Between two words, from either side of the space that separates them:+ one space each side, never two and never none. */+ expect(dropAt("walks towards ".length)).toBe("walks towards @[ref:ref-woman] the camera and stops.");+ expect(dropAt("walks towards".length)).toBe("walks towards @[ref:ref-woman] the camera and stops.");+ });+it("writes a scene of three shots and two references, and compiles the prompt the engine gets", () => {/* The worked example, driven through the real screen rather than throughdiff --git a/src/components/workspace/SceneEditor.tsx b/src/components/workspace/SceneEditor.tsxindex e8db1fc..14606bb 100644--- a/src/components/workspace/SceneEditor.tsx+++ b/src/components/workspace/SceneEditor.tsx@@ -330,11 +330,16 @@ function ShotCard({ shot, index, endsAt, duration, disabled, removable, focused,const at = field ? field.selectionStart : display.length;const before = display.slice(0, at);const after = display.slice(at);+ // Both sides, not just the one in front of the caret. A drop at the START+ // of a line has nothing before it, so `lead` is empty and the token used to+ // fuse to the first word: "<Subject 1>walks towards the camera" — a+ // malformed citation, sent to the model exactly as written.const lead = before && !/\s$/.test(before) ? " " : "";+ const trail = after && !/^\s/.test(after) ? " " : "";// A reference this scene does not cite yet has no number, so the token is// written by id and the number appears once the scene binds it.const token = number > 0 ? `[Reference ${number}]` : referenceToken(referenceId);- onChange({ action: store(`${before}${lead}${token}${after}`) });+ onChange({ action: store(`${before}${lead}${token}${trail}${after}`) });};return <article className={`shot-card ${focused ? "shot-card--focused" : ""}`}>diff --git a/src/styles/export.css b/src/styles/export.cssindex 41d72c2..fead195 100644--- a/src/styles/export.css+++ b/src/styles/export.css@@ -11,7 +11,7 @@overflow-y: auto;padding: var(--space-6) var(--space-7) var(--space-7);background:- radial-gradient(circle at 80% -20%, rgba(47, 69, 107, 0.13), transparent 38%),+ radial-gradient(circle at 80% -20%, var(--glow-accent), transparent 38%),var(--bg);}@@ -87,8 +87,10 @@border: 1px solid var(--line);border-radius: var(--radius-md);/* Deliberately not the project background: the frame paints its own, and a- matching surround would hide where the picture actually ends. */- background: #05070b;+ matching surround would hide where the picture actually ends. Because it+ is black in BOTH themes, everything painted on it uses the --stage-*+ tokens rather than the palette — see tokens.css. */+ background: var(--stage-bg);}.export-stage canvas {@@ -102,7 +104,7 @@max-width: 46ch;margin: 0;padding: var(--space-4);- color: var(--text-muted);+ color: var(--on-stage);font-size: var(--text-xs);line-height: var(--leading-normal);text-align: center;@@ -115,10 +117,10 @@align-items: center;justify-content: center;gap: var(--space-2);- border: 1px solid rgba(236, 125, 134, 0.4);+ border: 1px solid var(--stage-alert-line);border-radius: var(--radius-sm);- color: var(--danger);- background: rgba(12, 8, 10, 0.9);+ color: var(--stage-alert-ink);+ background: var(--stage-alert-bg);text-align: left;}@@ -283,14 +285,14 @@.export-notice {margin-top: var(--space-4);padding: var(--space-3) var(--space-4);- border: 1px solid rgba(227, 168, 98, 0.34);+ border: 1px solid var(--warning-line);border-radius: var(--radius-md);- background: rgba(58, 44, 25, 0.24);+ background: var(--warning-soft);}.export-notice--bad {- border-color: rgba(236, 125, 134, 0.4);- background: rgba(58, 26, 30, 0.26);+ border-color: var(--danger-line);+ background: var(--danger-soft);}.export-notice h3 {@@ -360,8 +362,8 @@}.export-outcome--good {- border-color: rgba(110, 207, 149, 0.36);- background: rgba(26, 48, 36, 0.26);+ border-color: var(--success-line);+ background: var(--success-soft);}.export-outcome h3 {diff --git a/src/styles/generator.css b/src/styles/generator.cssindex 88c5304..ff1c708 100644--- a/src/styles/generator.css+++ b/src/styles/generator.css@@ -146,7 +146,7 @@}.queue-group > button.selected {- border-color: rgba(90, 120, 218, 0.4);+ border-color: var(--accent-line);background: var(--accent-soft);}@@ -343,7 +343,7 @@max-width: var(--content-max);margin: 0 auto var(--space-6);padding: var(--space-5);- border: 1px solid rgba(91, 121, 211, 0.32);+ border: 1px solid var(--accent-line);border-radius: var(--radius-xl);background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 10%, var(--panel-2)), var(--panel-2));box-shadow: var(--shadow-sm);@@ -1205,7 +1205,7 @@background-color: var(--panel-3);background-image: repeating-linear-gradient(135deg,- rgba(255, 255, 255, 0.03) 0 6px,+ var(--hatch) 0 6px,transparent 6px 12px);}@@ -1349,7 +1349,7 @@}.stage-rail li.done i {- color: #fff;+ color: var(--on-accent);border-color: var(--accent-bright);background: var(--accent);}diff --git a/src/styles/timeline.css b/src/styles/timeline.cssindex 466142a..9b482d5 100644--- a/src/styles/timeline.css+++ b/src/styles/timeline.css@@ -168,7 +168,7 @@}.scene-card.selected {- border-color: rgba(101, 129, 222, 0.48);+ border-color: var(--accent-line-strong);background: var(--accent-soft);box-shadow: inset 2px 0 var(--accent-bright);}@@ -184,7 +184,7 @@background-color: var(--panel-3);background-image: repeating-linear-gradient(135deg,- rgba(255, 255, 255, 0.03) 0 6px,+ var(--hatch) 0 6px,transparent 6px 12px);}@@ -196,7 +196,8 @@padding: 2px var(--space-1);border-radius: var(--radius-xs);color: var(--text-secondary);- background: rgba(9, 11, 15, 0.78);+ background: var(--glass);+ backdrop-filter: blur(6px);font: var(--weight-medium) var(--text-2xs) / 1.1 var(--font-mono);font-style: normal;}@@ -242,7 +243,7 @@gap: var(--space-2);margin-top: var(--space-2);padding: var(--space-2) var(--space-3);- border: 1px dashed rgba(107, 141, 255, 0.45);+ border: 1px dashed var(--accent-line-strong);border-radius: var(--radius-md);color: var(--accent-bright);background: var(--accent-soft);@@ -254,7 +255,7 @@.scene-add:hover {color: var(--text-primary);border-color: var(--accent-bright);- background: rgba(60, 105, 239, 0.24);+ background: var(--accent-soft-strong);}/* --- Panel layout toggle ---------------------------------------------------@@ -364,7 +365,7 @@background-color: var(--panel-3);background-image: repeating-linear-gradient(135deg,- rgba(255, 255, 255, 0.03) 0 6px,+ var(--hatch) 0 6px,transparent 6px 12px);}@@ -513,7 +514,7 @@justify-content: center;padding: var(--space-4) var(--space-6);background-color: var(--bg);- background-image: radial-gradient(rgba(255, 255, 255, 0.04) 0.6px, transparent 0.6px);+ background-image: radial-gradient(var(--grid-line) 0.6px, transparent 0.6px);background-size: 12px 12px;}@@ -580,7 +581,7 @@place-items: center;border-radius: var(--radius-sm);color: var(--text-primary);- box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);+ box-shadow: inset 0 0 0 1px var(--line-strong);}.inspector-summary > div {@@ -857,7 +858,7 @@.timeline-transport .play-button {width: var(--control-md);height: var(--control-md);- color: #fff;+ color: var(--on-accent);background: var(--accent);}@@ -1019,12 +1020,12 @@place-items: center;border-radius: var(--radius-sm);color: var(--accent-bright);- background: #27365a;+ background: var(--accent-soft-strong);}.track-kind--audio {- color: #7cc3bc;- background: #1c3939;+ color: var(--audio);+ background: var(--audio-soft);}.track-head .track-name,@@ -1097,7 +1098,7 @@overflow: hidden;border-bottom: 1px solid var(--line);background-color: var(--bg);- background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);+ background-image: linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);background-size: 14.7% 100%;}@@ -1110,7 +1111,7 @@refuse the file (a sound over a video track, or a locked track) stay dark,so the highlight IS the answer to "can this go here?". */.track-lane--drop {- background-color: rgba(60, 105, 239, 0.14);+ background-color: var(--accent-soft);box-shadow: inset 0 0 0 1px var(--accent-bright);}@@ -1122,7 +1123,7 @@cursor: not-allowed;background-image: repeating-linear-gradient(135deg,- rgba(255, 255, 255, 0.05) 0 6px,+ var(--hatch-strong) 0 6px,transparent 6px 12px);opacity: 0.55;@@ -1137,30 +1138,30 @@min-width: 32px;overflow: hidden;padding: 0;- border: 1px solid color-mix(in srgb, var(--clip-color, #516fba) 70%, white 10%);+ border: 1px solid color-mix(in srgb, var(--clip-color, var(--clip-video-default)) 70%, var(--clip-edge) 10%);border-radius: var(--radius-sm);text-align: left;color: var(--text-primary);background: linear-gradient(180deg,- color-mix(in srgb, var(--clip-color, #516fba) 72%, #27303f),- color-mix(in srgb, var(--clip-color, #516fba) 48%, #11151d)+ color-mix(in srgb, var(--clip-color, var(--clip-video-default)) 72%, var(--clip-shade-top)),+ color-mix(in srgb, var(--clip-color, var(--clip-video-default)) 48%, var(--clip-shade-bottom)));- box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);+ box-shadow: inset 0 1px var(--clip-sheen);}.timeline-clip::before {content: "";position: absolute;inset: 0;- background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 18px, transparent 18px 21px);+ background: repeating-linear-gradient(90deg, var(--clip-stripe) 0 18px, transparent 18px 21px);}.timeline-clip--audio {background: linear-gradient(180deg,- color-mix(in srgb, var(--clip-color, #3d817c) 62%, #1d3032),- color-mix(in srgb, var(--clip-color, #3d817c) 38%, #10191b)+ color-mix(in srgb, var(--clip-color, var(--clip-audio-default)) 62%, var(--clip-audio-shade-top)),+ color-mix(in srgb, var(--clip-color, var(--clip-audio-default)) 38%, var(--clip-audio-shade-bottom)));}@@ -1169,8 +1170,8 @@}.timeline-clip.selected {- border-color: #bdcaff;- box-shadow: 0 0 0 2px var(--accent-bright), inset 0 1px rgba(255, 255, 255, 0.17);+ border-color: var(--clip-selected-edge);+ box-shadow: 0 0 0 2px var(--accent-bright), inset 0 1px var(--clip-sheen-strong);z-index: 3;}