ticktoon 1.0.2 → 1.0.4
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 +16 -17
- package/dist/ENGINE_VERSION.txt +1 -1
- package/dist/chunks/{chunk-OM5YJEVM.js → chunk-R7N4M4Z7.js} +56 -16
- package/dist/chunks/chunk-R7N4M4Z7.js.map +7 -0
- package/dist/clip/code-clip.d.ts +2 -0
- package/dist/clip/code-clip.d.ts.map +1 -1
- package/dist/clip/code-clip.js +1 -0
- package/dist/clip/code-clip.js.map +1 -1
- package/dist/export-page.js +1 -1
- package/dist/preview-panel.js +1 -1
- package/dist/protocol.d.ts +3 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/runtime/resource-pool.d.ts +12 -3
- package/dist/runtime/resource-pool.d.ts.map +1 -1
- package/dist/runtime/resource-pool.js +61 -14
- package/dist/runtime/resource-pool.js.map +1 -1
- package/dist/runtime/resources.d.ts +2 -1
- package/dist/runtime/resources.d.ts.map +1 -1
- package/dist/runtime/resources.js +4 -0
- package/dist/runtime/resources.js.map +1 -1
- package/dist/runtime/validate.js +1 -1
- package/dist/runtime/validate.js.map +1 -1
- package/docs/README.zh-CN.md +16 -17
- package/package.json +4 -4
- package/dist/chunks/chunk-OM5YJEVM.js.map +0 -7
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/
|
|
4
|
-
<img src="https://raw.githubusercontent.com/
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ticktoon/ticktoon/main/assets/ticktoon_logo.png">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/ticktoon/ticktoon/main/assets/ticktoon_logo_dark_text.png" alt="Ticktoon" width="640">
|
|
5
5
|
</picture>
|
|
6
6
|
|
|
7
7
|
<p><strong>Programmable video. Rendered in a browser.</strong></p>
|
|
@@ -9,30 +9,28 @@
|
|
|
9
9
|
<p>
|
|
10
10
|
<a href="https://www.typescriptlang.org/"><img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-5.9-3178C6?style=flat-square&logo=typescript&logoColor=white"></a>
|
|
11
11
|
<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebCodecs_API"><img alt="Canvas and WebCodecs" src="https://img.shields.io/badge/Canvas%20%2B%20WebCodecs-browser-08A9E6?style=flat-square"></a>
|
|
12
|
-
<a href="https://github.com/
|
|
13
|
-
<a href="https://github.com/
|
|
14
|
-
<a href="https://github.com/
|
|
12
|
+
<a href="https://github.com/ticktoon/ticktoon/tree/main/examples"><img alt="Platform: Chrome" src="https://img.shields.io/badge/Platform-Chrome-263238?style=flat-square&logo=googlechrome&logoColor=white"></a>
|
|
13
|
+
<a href="https://github.com/ticktoon/ticktoon/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/ticktoon/ticktoon?style=flat-square&logo=github&label=Stars"></a>
|
|
14
|
+
<a href="https://github.com/ticktoon/ticktoon/blob/main/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/License-Apache--2.0-27C9A5?style=flat-square"></a>
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
|
-
<p><strong>English</strong> · <a href="https://github.com/
|
|
17
|
+
<p><strong>English</strong> · <a href="https://github.com/ticktoon/ticktoon/blob/main/docs/README.zh-CN.md">简体中文</a></p>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
20
|
**Ticktoon is a video rendering engine for AI video creation.**
|
|
21
21
|
|
|
22
|
-
**Ticktoon is a stable canvas rendering core.** The protocol and public API are frozen at v1.0; feature development and AI workflow tooling live in [`ticktoon-skill`](https://github.com/shidongdi/ticktoon-skill).
|
|
23
|
-
|
|
24
22
|
The authoring layer can use AI models such as Claude Opus 5.5 to generate Canvas code; Ticktoon previews and exports video through canvas video rendering and WebCodecs. At the core of the engine:
|
|
25
23
|
|
|
26
24
|
- One function, `tick(t)` — give it a time, get that frame back synchronously. Export and preview call the same one.
|
|
27
25
|
- Everything drawn on canvas — no Playwright capture, no external FFmpeg executable, just a browser.
|
|
28
26
|
|
|
29
|
-
Once the cut exists, reviewing it (play, step, pen annotations), style packages and voice-over live in the sibling repo [`ticktoon-skill`](https://github.com/
|
|
27
|
+
Once the cut exists, reviewing it (play, step, pen annotations), style packages and voice-over live in the sibling repo [`ticktoon-skill`](https://github.com/ticktoon/ticktoon-skill).
|
|
30
28
|
|
|
31
|
-
**Demo** — play, step, and in-browser export, recorded from the [`examples`](https://github.com/
|
|
29
|
+
**Demo** — play, step, and in-browser export, recorded from the [`examples`](https://github.com/ticktoon/ticktoon/tree/main/examples) page:
|
|
32
30
|
|
|
33
|
-

|
|
34
32
|
|
|
35
|
-
To run the example, preview frames, and export video: [`examples`](https://github.com/
|
|
33
|
+
To run the example, preview frames, and export video: [`examples`](https://github.com/ticktoon/ticktoon/tree/main/examples).
|
|
36
34
|
|
|
37
35
|
## Install
|
|
38
36
|
|
|
@@ -63,16 +61,17 @@ const mp4 = await exportComposition(composition);
|
|
|
63
61
|
|
|
64
62
|
```bash
|
|
65
63
|
# Chrome 120+ only, for now
|
|
66
|
-
git clone https://github.com/
|
|
64
|
+
git clone https://github.com/ticktoon/ticktoon
|
|
67
65
|
cd ticktoon && npm install && npm run build
|
|
68
66
|
```
|
|
69
67
|
|
|
70
68
|
## Details
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
*
|
|
74
|
-
*
|
|
70
|
+
**Ticktoon is a stable canvas rendering core.** Content protocol **v1.0** and its public API compatibility contract are frozen; feature development and AI workflow tooling live in [`ticktoon-skill`](https://github.com/ticktoon/ticktoon-skill).
|
|
71
|
+
* Engine guide and SDK usage: [English](https://github.com/ticktoon/ticktoon/blob/main/docs/engine.md) · [简体中文](https://github.com/ticktoon/ticktoon/blob/main/docs/engine.zh-CN.md).
|
|
72
|
+
* Content protocol and preview integration: [`spec/v1.0.md`](https://github.com/ticktoon/ticktoon/blob/main/docs/spec/v1.0.md) · [简体中文](https://github.com/ticktoon/ticktoon/blob/main/docs/spec/v1.0.zh-CN.md).
|
|
73
|
+
* Writing scene code: [English](https://github.com/ticktoon/ticktoon/blob/main/docs/scene.md) · [简体中文](https://github.com/ticktoon/ticktoon/blob/main/docs/scene.zh-CN.md).
|
|
75
74
|
|
|
76
75
|
## License
|
|
77
76
|
|
|
78
|
-
Ticktoon source is Apache-2.0; see [`LICENSE`](https://github.com/
|
|
77
|
+
Ticktoon source is Apache-2.0; see [`LICENSE`](https://github.com/ticktoon/ticktoon/blob/main/LICENSE) and [`NOTICE`](https://github.com/ticktoon/ticktoon/blob/main/NOTICE). Commercial use, closed-source forks and bundling into your own product are allowed without a separate software license. Third-party keep their own licenses, tracked in [`THIRD_PARTY_LICENSES.md`](https://github.com/ticktoon/ticktoon/blob/main/THIRD_PARTY_LICENSES.md)
|
package/dist/ENGINE_VERSION.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
2026-11-
|
|
1
|
+
2026-11-23T05:46:50.903Z
|
|
2
2
|
source: ticktoon protocol v1.0
|
|
@@ -96,7 +96,7 @@ function validateResources(resources, sceneId) {
|
|
|
96
96
|
for (const resource of resources) {
|
|
97
97
|
const value = record(resource, "Resource must be an object");
|
|
98
98
|
const type = nonEmptyString(value.type, "resource.type", sceneId);
|
|
99
|
-
if (type !== "image" && type !== "font" && type !== "video") {
|
|
99
|
+
if (type !== "image" && type !== "font" && type !== "video" && type !== "data") {
|
|
100
100
|
fail(`Unknown resource type: ${type}`, sceneId);
|
|
101
101
|
}
|
|
102
102
|
const name = nonEmptyString(value.name, "resource.name", sceneId);
|
|
@@ -262,21 +262,29 @@ async function defaultFontLoader(resource) {
|
|
|
262
262
|
fontSizes.set(font, bytes.byteLength);
|
|
263
263
|
return font;
|
|
264
264
|
}
|
|
265
|
+
async function defaultDataLoader(resource) {
|
|
266
|
+
const response = await fetch(resource.src);
|
|
267
|
+
if (!response.ok) throw new Error(`Data fetch failed: HTTP ${response.status}`);
|
|
268
|
+
return response.text();
|
|
269
|
+
}
|
|
265
270
|
var ResourcePool = class {
|
|
266
|
-
|
|
267
|
-
|
|
271
|
+
imagesBySrc = /* @__PURE__ */ new Map();
|
|
272
|
+
fontsBySrc = /* @__PURE__ */ new Map();
|
|
273
|
+
dataBySrc = /* @__PURE__ */ new Map();
|
|
268
274
|
imageLoader;
|
|
269
275
|
fontLoader;
|
|
276
|
+
dataLoader;
|
|
270
277
|
disposed = false;
|
|
271
278
|
constructor(options = {}) {
|
|
272
279
|
this.imageLoader = options.imageLoader ?? defaultImageLoader;
|
|
273
280
|
this.fontLoader = options.fontLoader ?? defaultFontLoader;
|
|
281
|
+
this.dataLoader = options.dataLoader ?? defaultDataLoader;
|
|
274
282
|
}
|
|
275
283
|
/** Idempotent per source; concurrent callers share one load. Video is not loaded here. */
|
|
276
284
|
acquire(resource, sceneId) {
|
|
277
285
|
if (this.disposed) return Promise.reject(new Error(`Resource pool is disposed (scene ${sceneId})`));
|
|
278
286
|
if (resource.type === "video") return Promise.resolve();
|
|
279
|
-
const table = resource.type
|
|
287
|
+
const table = this.tableFor(resource.type);
|
|
280
288
|
const existing = table.get(resource.src);
|
|
281
289
|
if (existing) return existing.promise ?? Promise.resolve();
|
|
282
290
|
const entry = { value: null, bytes: 0, promise: null };
|
|
@@ -291,6 +299,13 @@ var ResourcePool = class {
|
|
|
291
299
|
entry.bytes = estimateImageBytes(image);
|
|
292
300
|
return;
|
|
293
301
|
}
|
|
302
|
+
if (resource.type === "data") {
|
|
303
|
+
const text = await this.dataLoader(resource);
|
|
304
|
+
if (this.disposed) return;
|
|
305
|
+
entry.value = text;
|
|
306
|
+
entry.bytes = estimateDataBytes(text);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
294
309
|
const font = await this.fontLoader(resource);
|
|
295
310
|
if (this.disposed) {
|
|
296
311
|
releaseValue("font", font);
|
|
@@ -301,7 +316,7 @@ var ResourcePool = class {
|
|
|
301
316
|
};
|
|
302
317
|
entry.promise = load().catch((error) => {
|
|
303
318
|
table.delete(resource.src);
|
|
304
|
-
throw asTicktoonError(error, `${resource.type
|
|
319
|
+
throw asTicktoonError(error, `${this.labelFor(resource.type)} load failed`, {
|
|
305
320
|
sceneId,
|
|
306
321
|
resourceId: resource.name
|
|
307
322
|
});
|
|
@@ -310,31 +325,48 @@ var ResourcePool = class {
|
|
|
310
325
|
return entry.promise;
|
|
311
326
|
}
|
|
312
327
|
image(src) {
|
|
313
|
-
const value = this.
|
|
328
|
+
const value = this.imagesBySrc.get(src)?.value;
|
|
314
329
|
return value == null ? null : value;
|
|
315
330
|
}
|
|
316
331
|
font(src) {
|
|
317
|
-
const value = this.
|
|
332
|
+
const value = this.fontsBySrc.get(src)?.value;
|
|
318
333
|
return value == null ? null : value;
|
|
319
334
|
}
|
|
335
|
+
/** Raw text of a data resource; no parsing is performed by the engine. */
|
|
336
|
+
data(src) {
|
|
337
|
+
const value = this.dataBySrc.get(src)?.value;
|
|
338
|
+
return typeof value === "string" ? value : null;
|
|
339
|
+
}
|
|
320
340
|
/** True while this source is resident, loaded or in flight. */
|
|
321
341
|
has(src) {
|
|
322
|
-
return this.
|
|
342
|
+
return this.imagesBySrc.has(src) || this.fontsBySrc.has(src) || this.dataBySrc.has(src);
|
|
323
343
|
}
|
|
324
344
|
/** Read-only accounting. Nothing in the engine makes decisions from it. */
|
|
325
345
|
stats() {
|
|
326
346
|
let bytes = 0;
|
|
327
|
-
for (const entry of this.
|
|
328
|
-
for (const entry of this.
|
|
329
|
-
|
|
347
|
+
for (const entry of this.imagesBySrc.values()) bytes += entry.bytes;
|
|
348
|
+
for (const entry of this.fontsBySrc.values()) bytes += entry.bytes;
|
|
349
|
+
for (const entry of this.dataBySrc.values()) bytes += entry.bytes;
|
|
350
|
+
return { images: this.imagesBySrc.size, fonts: this.fontsBySrc.size, data: this.dataBySrc.size, bytes };
|
|
330
351
|
}
|
|
331
352
|
dispose() {
|
|
332
353
|
if (this.disposed) return;
|
|
333
354
|
this.disposed = true;
|
|
334
|
-
for (const entry of this.
|
|
335
|
-
for (const entry of this.
|
|
336
|
-
this.
|
|
337
|
-
this.
|
|
355
|
+
for (const entry of this.imagesBySrc.values()) releaseValue("image", entry.value);
|
|
356
|
+
for (const entry of this.fontsBySrc.values()) releaseValue("font", entry.value);
|
|
357
|
+
this.imagesBySrc.clear();
|
|
358
|
+
this.fontsBySrc.clear();
|
|
359
|
+
this.dataBySrc.clear();
|
|
360
|
+
}
|
|
361
|
+
tableFor(type) {
|
|
362
|
+
if (type === "image") return this.imagesBySrc;
|
|
363
|
+
if (type === "data") return this.dataBySrc;
|
|
364
|
+
return this.fontsBySrc;
|
|
365
|
+
}
|
|
366
|
+
labelFor(type) {
|
|
367
|
+
if (type === "image") return "Image";
|
|
368
|
+
if (type === "data") return "Data";
|
|
369
|
+
return "Font";
|
|
338
370
|
}
|
|
339
371
|
};
|
|
340
372
|
function estimateImageBytes(image) {
|
|
@@ -346,6 +378,9 @@ function estimateImageBytes(image) {
|
|
|
346
378
|
function estimateFontBytes(font) {
|
|
347
379
|
return fontBytes(font);
|
|
348
380
|
}
|
|
381
|
+
function estimateDataBytes(text) {
|
|
382
|
+
return typeof TextEncoder !== "undefined" ? new TextEncoder().encode(text).byteLength : text.length;
|
|
383
|
+
}
|
|
349
384
|
function releaseValue(type, value) {
|
|
350
385
|
if (value === null) return;
|
|
351
386
|
if (type === "font") {
|
|
@@ -397,6 +432,10 @@ var ResourceStore = class {
|
|
|
397
432
|
const resource = this.byName.get(name);
|
|
398
433
|
return resource ? this.pool.font(resource.src) : null;
|
|
399
434
|
}
|
|
435
|
+
data(name) {
|
|
436
|
+
const resource = this.byName.get(name);
|
|
437
|
+
return resource ? this.pool.data(resource.src) : null;
|
|
438
|
+
}
|
|
400
439
|
video(name) {
|
|
401
440
|
return this.videos.get(name) ?? null;
|
|
402
441
|
}
|
|
@@ -688,6 +727,7 @@ var CodeClip = class {
|
|
|
688
727
|
seed: this.data.seed,
|
|
689
728
|
rng: () => createSeededRng(this.data.seed),
|
|
690
729
|
img: (name) => this.resources.image(name),
|
|
730
|
+
data: (name) => this.resources.data(name),
|
|
691
731
|
video: (name) => this.videoFrame(name, t),
|
|
692
732
|
canvas: (width, height) => this.createCanvas(width, height),
|
|
693
733
|
THREE: this.three,
|
|
@@ -982,4 +1022,4 @@ export {
|
|
|
982
1022
|
videoResourceBindings,
|
|
983
1023
|
loadThree
|
|
984
1024
|
};
|
|
985
|
-
//# sourceMappingURL=chunk-
|
|
1025
|
+
//# sourceMappingURL=chunk-R7N4M4Z7.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/protocol.ts", "../../src/runtime/errors.ts", "../../src/runtime/validate.ts", "../../src/runtime/canvas.ts", "../../src/runtime/deterministic.ts", "../../src/runtime/resource-pool.ts", "../../src/runtime/resources.ts", "../../src/runtime/video-frames.ts", "../../src/clip/three-layer.ts", "../../src/clip/code-clip.ts", "../../src/compositor/canvas-compositor.ts", "../../preview/three-loader.ts", "../../src/io/media/audio-gain.ts", "../../src/io/media/video-resources.ts"],
|
|
4
|
+
"sourcesContent": ["export const PROTOCOL_VERSION = '1.0' as const;\n\nexport interface CueChar {\n text: string;\n start: number;\n end: number;\n}\n\nexport interface Cue {\n text: string;\n start: number;\n end: number;\n /** Scene-relative character timing for caption templates and other code scenes. */\n chars: readonly CueChar[];\n}\n\nexport type ClipResourceType = 'image' | 'font' | 'video' | 'data';\n\n/**\n * An external asset a scene reads synchronously. Video is declared here too:\n * `api.video(name)` returns the decoded frame at the current scene time.\n * Data resources are fetched as raw text; parsing is left to the scene's own code.\n */\nexport interface ClipResource {\n type: ClipResourceType;\n /** Lookup key for api.img() / api.data() / api.video(), or FontFace family for fonts. */\n name: string;\n src: string;\n /** Video only: source-time offset in seconds this scene starts reading from. Defaults to 0. */\n start?: number;\n}\n\n/** Host capabilities a scene can require. The host loads them before the scene runs. */\nexport type SceneCapability = 'three';\n\n/**\n * Authored scene: one contiguous slice of the picture. Scenes carry no absolute\n * start; their order defines the timeline and `duration` defines its length.\n */\nexport interface Scene {\n id: string;\n duration: number;\n /** Canvas fill behind the scene. Use 'transparent' to let the host background through. */\n background?: string;\n /** Deterministic seed for api.rng(). */\n seed?: number;\n code: string;\n cues?: Cue[];\n resources?: ClipResource[];\n /** Capabilities this scene needs, e.g. ['three']. Empty or absent means Canvas 2D only. */\n needs?: SceneCapability[];\n}\n\n/**\n * Sound event on the audio timeline. Audio is not a scene resource: no frame\n * reads it, the mixer does. Overlapping events simply sum.\n */\nexport interface AudioEvent {\n /** Optional stable label used in error messages. */\n id?: string;\n src: string;\n /** Composition-absolute start in seconds. */\n at: number;\n duration: number;\n role?: 'narration' | 'bgm' | 'sfx';\n /** Normalized to [0, 1]. Defaults to 1. */\n volume?: number;\n /** Source-time offset in seconds. Defaults to 0. */\n sourceStart?: number;\n /** Linear ramp in seconds from the event start. Defaults to 0. */\n fadeIn?: number;\n /** Linear ramp in seconds ending at the event end. Defaults to 0. */\n fadeOut?: number;\n}\n\n/** Scene as the runtime sees it: absolute start and picture size resolved. */\nexport interface RuntimeScene {\n id: string;\n start: number;\n duration: number;\n width: number;\n height: number;\n background: string;\n seed: number;\n code: string;\n cues: Cue[];\n resources?: ClipResource[];\n needs: SceneCapability[];\n}\n\n/** Audio event with every default applied. */\nexport interface RuntimeAudioEvent {\n id: string;\n src: string;\n at: number;\n duration: number;\n role: 'narration' | 'bgm' | 'sfx';\n volume: number;\n sourceStart: number;\n fadeIn: number;\n fadeOut: number;\n}\n\n/** Composition as the runtime sees it: every default applied, scenes timed. */\nexport interface RuntimeComposition {\n version: typeof PROTOCOL_VERSION;\n width: number;\n height: number;\n fps: number;\n duration: number;\n /** Picture, in playback order. Scenes are contiguous and cover the full duration. */\n scenes: RuntimeScene[];\n /** Sound, as a flat event list. Order is irrelevant; overlaps mix. */\n audio: RuntimeAudioEvent[];\n}\n\n/**\n * Composition as an author writes it: no absolute times, no resolved sizes.\n * Both hosts and generated code can produce this shape directly.\n */\nexport interface Composition {\n version?: typeof PROTOCOL_VERSION;\n width: number;\n height: number;\n fps?: number;\n duration: number;\n scenes: Scene[];\n audio?: AudioEvent[];\n}\n", "import { PROTOCOL_VERSION } from '../protocol.js';\n\nexport interface ErrorContext {\n sceneId?: string;\n /** Audio event id. Scenes carry no separate clip identity, so audio is the only event kind. */\n audioEventId?: string;\n time?: number;\n resourceId?: string;\n}\n\nexport class TicktoonError extends Error {\n readonly protocolVersion = PROTOCOL_VERSION;\n readonly sceneId: string | undefined;\n readonly audioEventId: string | undefined;\n readonly time: number | undefined;\n readonly resourceId: string | undefined;\n\n constructor(message: string, context: ErrorContext = {}, options?: ErrorOptions) {\n const location = [\n context.sceneId ? `scene=${context.sceneId}` : '',\n context.audioEventId ? `audio=${context.audioEventId}` : '',\n context.time !== undefined ? `t=${context.time}` : '',\n context.resourceId ? `resource=${context.resourceId}` : '',\n ].filter(Boolean).join(', ');\n super(`[ticktoon v${PROTOCOL_VERSION}] ${message}${location ? ` (${location})` : ''}`, options);\n this.name = 'TicktoonError';\n this.sceneId = context.sceneId;\n this.audioEventId = context.audioEventId;\n this.time = context.time;\n this.resourceId = context.resourceId;\n }\n}\n\nexport function asTicktoonError(error: unknown, message: string, context: ErrorContext = {}): TicktoonError {\n if (error instanceof TicktoonError) return error;\n const detail = error instanceof Error ? error.message : String(error);\n return new TicktoonError(`${message}: ${detail}`, context, { cause: error });\n}\n", "import {\n PROTOCOL_VERSION,\n type AudioEvent,\n type ClipResource,\n type Cue,\n type RuntimeAudioEvent,\n type RuntimeComposition,\n type RuntimeScene,\n type Scene,\n} from '../protocol.js';\nimport { TicktoonError } from './errors.js';\n\nconst TIME_EPSILON = 1e-6;\nconst DEFAULT_BACKGROUND = '#000000';\nconst DEFAULT_ROLE = 'narration';\nconst DEFAULT_VOLUME = 1;\n\n/**\n * Validates runtime input, applying only documented defaults. Scenes are ordered:\n * their starts are accumulated here so authored data never carries absolute time.\n */\nexport function validateComposition(input: unknown): RuntimeComposition {\n const root = record(input, 'Composition must be an object');\n const version = root.version === undefined ? PROTOCOL_VERSION : root.version;\n if (version !== PROTOCOL_VERSION) fail(`Unsupported protocol version: ${String(version)}`);\n const width = positive(root.width, 'width');\n const height = positive(root.height, 'height');\n const fps = root.fps === undefined ? 30 : positive(root.fps, 'fps');\n if (!Number.isInteger(fps)) fail('fps must be an integer');\n const duration = positive(root.duration, 'duration');\n if (!Array.isArray(root.scenes)) fail('scenes must be an array');\n if (root.scenes.length === 0) fail('scenes must contain at least one scene');\n\n const scenes: RuntimeScene[] = [];\n const sceneIds = new Set<string>();\n let cursor = 0;\n for (const rawScene of root.scenes) {\n const scene = validateScene(rawScene, width, height);\n if (sceneIds.has(scene.id)) fail(`Duplicate scene id: ${scene.id}`, scene.id);\n sceneIds.add(scene.id);\n scenes.push({ ...scene, start: cursor, width, height });\n cursor += scene.duration;\n }\n if (Math.abs(cursor - duration) > TIME_EPSILON) {\n fail(`duration ${duration} does not match the sum of scene durations ${cursor}`);\n }\n\n const audio = validateAudio(root.audio, duration);\n\n return { version: PROTOCOL_VERSION, width, height, fps, duration, scenes, audio };\n}\n\n/** Scene shape after defaults, before the runtime adds start and picture size. */\ninterface AuthoredScene {\n id: string;\n duration: number;\n background: string;\n seed: number;\n code: string;\n cues: Cue[];\n resources?: ClipResource[];\n needs: RuntimeScene['needs'];\n}\n\nfunction validateScene(input: unknown, width: number, height: number): AuthoredScene {\n const scene = record(input, 'Scene must be an object');\n const id = nonEmptyString(scene.id, 'scene.id');\n const duration = positive(scene.duration, 'scene.duration', id);\n if (typeof scene.code !== 'string') fail('scene.code must be a string', id);\n const background = scene.background === undefined\n ? DEFAULT_BACKGROUND\n : nonEmptyString(scene.background, 'scene.background', id);\n const seed = scene.seed === undefined ? 0 : finite(scene.seed, 'scene.seed', id);\n const cues = scene.cues === undefined ? [] : validateCues(scene.cues, duration, id);\n validateNeeds(scene.needs, id);\n validateResources(scene.resources, id);\n\n return {\n id,\n duration,\n code: scene.code,\n background,\n seed,\n cues,\n ...(Array.isArray(scene.resources) ? { resources: scene.resources as ClipResource[] } : {}),\n needs: Array.isArray(scene.needs) ? scene.needs as RuntimeScene['needs'] : [],\n };\n}\n\nfunction validateNeeds(needs: unknown, sceneId: string): void {\n if (needs === undefined) return;\n if (!Array.isArray(needs)) fail('scene.needs must be an array', sceneId);\n for (const need of needs) {\n if (need !== 'three') fail(`Unknown required capability: ${String(need)}`, sceneId);\n }\n}\n\nfunction validateResources(resources: unknown, sceneId: string): void {\n if (resources === undefined) return;\n if (!Array.isArray(resources)) fail('scene.resources must be an array', sceneId);\n const names = new Set<string>();\n for (const resource of resources) {\n const value = record(resource, 'Resource must be an object');\n const type = nonEmptyString(value.type, 'resource.type', sceneId);\n if (type !== 'image' && type !== 'font' && type !== 'video' && type !== 'data') {\n fail(`Unknown resource type: ${type}`, sceneId);\n }\n const name = nonEmptyString(value.name, 'resource.name', sceneId);\n const key = `${type}:${name}`;\n if (names.has(key)) fail(`Duplicate ${type} resource name: ${name}`, sceneId);\n names.add(key);\n nonEmptyString(value.src, 'resource.src', sceneId);\n if (value.start !== undefined) {\n if (type !== 'video') fail('resource.start is only valid for video resources', sceneId);\n nonNegative(value.start, 'resource.start', sceneId);\n }\n }\n}\n\nfunction validateCues(input: unknown, limit: number, sceneId: string): Cue[] {\n if (!Array.isArray(input)) fail('scene.cues must be an array', sceneId);\n for (const rawCue of input) {\n const cue = record(rawCue, 'Cue must be an object') as unknown as Cue;\n if (typeof cue.text !== 'string') fail('cue.text must be a string', sceneId);\n const start = nonNegative(cue.start, 'cue.start', sceneId);\n const end = nonNegative(cue.end, 'cue.end', sceneId);\n if (end < start || end > limit + TIME_EPSILON) fail(`Invalid cue interval [${start}, ${end}]`, sceneId);\n if (!Array.isArray(cue.chars)) fail('cue.chars must be an array', sceneId);\n for (const rawChar of cue.chars) {\n const char = record(rawChar, 'Cue char must be an object');\n if (typeof char.text !== 'string') fail('cue.char.text must be a string', sceneId);\n const charStart = nonNegative(char.start, 'cue.char.start', sceneId);\n const charEnd = nonNegative(char.end, 'cue.char.end', sceneId);\n if (charStart < start - TIME_EPSILON || charEnd < charStart || charEnd > end + TIME_EPSILON) {\n fail(`Invalid cue char interval [${charStart}, ${charEnd}] within [${start}, ${end}]`, sceneId);\n }\n }\n }\n return input as Cue[];\n}\n\nfunction validateAudio(input: unknown, duration: number): RuntimeAudioEvent[] {\n if (input === undefined) return [];\n if (!Array.isArray(input)) fail('audio must be an array');\n const ids = new Set<string>();\n const output: RuntimeAudioEvent[] = [];\n for (let index = 0; index < input.length; index += 1) {\n const event = record(input[index], 'Audio event must be an object') as unknown as AudioEvent;\n const id = event.id === undefined ? `audio[${index}]` : nonEmptyString(event.id, 'audio.id');\n if (ids.has(id)) fail(`Duplicate audio event id: ${id}`, id);\n ids.add(id);\n const src = nonEmptyString(event.src, 'audio.src', id);\n const at = nonNegative(event.at, 'audio.at', id);\n const length = positive(event.duration, 'audio.duration', id);\n if (at + length > duration + TIME_EPSILON) fail('Audio event ends after composition duration', id);\n const role = event.role === undefined ? DEFAULT_ROLE : event.role;\n if (!['narration', 'bgm', 'sfx'].includes(String(role))) fail(`Unknown audio role: ${String(role)}`, id);\n const volume = event.volume === undefined ? DEFAULT_VOLUME : finite(event.volume, 'audio.volume', id);\n if (volume < 0 || volume > 1) fail('audio.volume must be normalized to [0, 1]', id);\n const sourceStart = event.sourceStart === undefined ? 0 : nonNegative(event.sourceStart, 'audio.sourceStart', id);\n const fadeIn = event.fadeIn === undefined ? 0 : nonNegative(event.fadeIn, 'audio.fadeIn', id);\n const fadeOut = event.fadeOut === undefined ? 0 : nonNegative(event.fadeOut, 'audio.fadeOut', id);\n output.push({\n id,\n src,\n at,\n duration: length,\n role: role as RuntimeAudioEvent['role'],\n volume,\n sourceStart,\n fadeIn,\n fadeOut,\n });\n }\n return output;\n}\n\nfunction record(value: unknown, message: string): Record<string, unknown> {\n if (!value || typeof value !== 'object' || Array.isArray(value)) fail(message);\n return value as Record<string, unknown>;\n}\n\nfunction finite(value: unknown, field: string, sceneId?: string): number {\n if (typeof value !== 'number' || !Number.isFinite(value)) fail(`${field} must be finite`, sceneId);\n return value;\n}\n\nfunction positive(value: unknown, field: string, sceneId?: string): number {\n const number = finite(value, field, sceneId);\n if (number <= 0) fail(`${field} must be > 0`, sceneId);\n return number;\n}\n\nfunction nonNegative(value: unknown, field: string, sceneId?: string): number {\n const number = finite(value, field, sceneId);\n if (number < 0) fail(`${field} must be >= 0`, sceneId);\n return number;\n}\n\nfunction nonEmptyString(value: unknown, field: string, sceneId?: string): string {\n if (typeof value !== 'string' || !value.trim()) fail(`${field} must be a non-empty string`, sceneId);\n return value;\n}\n\nfunction fail(message: string, sceneId?: string): never {\n throw new TicktoonError(message, { ...(sceneId !== undefined ? { sceneId } : {}) });\n}\n", "export type CanvasFactory = (width: number, height: number) => HTMLCanvasElement;\n\nexport const defaultCanvasFactory: CanvasFactory = (width, height) => {\n if (typeof document === 'undefined') {\n throw new Error('No browser document is available; inject a CanvasFactory for this host');\n }\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n return canvas;\n};\n\ntype ResettableContext = CanvasRenderingContext2D & { reset?: () => void };\n\n/** Clear pixels and drawing state, including an unbalanced scene save() stack where supported. */\nexport function resetCanvas(ctx: CanvasRenderingContext2D): void {\n const resettable = ctx as ResettableContext;\n if (typeof resettable.reset === 'function') {\n resettable.reset();\n return;\n }\n\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n ctx.globalAlpha = 1;\n ctx.globalCompositeOperation = 'source-over';\n ctx.filter = 'none';\n ctx.shadowColor = 'transparent';\n ctx.shadowBlur = 0;\n ctx.shadowOffsetX = 0;\n ctx.shadowOffsetY = 0;\n}\n", "/** Linear congruential generator kept identical to the legacy deterministic sequence. */\nexport function createSeededRng(seed: number): () => number {\n let state = seed >>> 0;\n return () => {\n state = (state * 1664525 + 1013904223) >>> 0;\n return state / 4294967296;\n };\n}\n\nexport function clampTime(time: number, duration: number): number {\n if (!Number.isFinite(time)) throw new TypeError(`Frame time must be finite, received ${time}`);\n return Math.min(duration, Math.max(0, time));\n}\n", "import type { ClipResource } from '../protocol.js';\nimport { asTicktoonError } from './errors.js';\n\nexport type ImageLoader = (resource: ClipResource) => Promise<CanvasImageSource>;\nexport type FontLoader = (resource: ClipResource) => Promise<FontFace>;\nexport type DataLoader = (resource: ClipResource) => Promise<string>;\n\nasync function defaultImageLoader(resource: ClipResource): Promise<HTMLImageElement> {\n if (typeof Image === 'undefined') throw new Error('Image loading requires a browser host');\n const image = new Image();\n image.crossOrigin = 'anonymous';\n image.decoding = 'async';\n await new Promise<void>((resolve, reject) => {\n image.onload = () => resolve();\n image.onerror = () => reject(new Error(`Unable to load image: ${resource.src}`));\n image.src = resource.src;\n });\n return image;\n}\n\n/** File size of a font loaded by the default loader; 0 for custom loaders. */\nconst fontSizes = new WeakMap<FontFace, number>();\n\nexport function fontBytes(font: FontFace): number {\n return fontSizes.get(font) ?? 0;\n}\n\n/**\n * Fonts are fetched once as bytes instead of handing the URL to FontFace: the\n * byte length is the only cheap size signal we have, and it avoids a second\n * download of the same file.\n */\nasync function defaultFontLoader(resource: ClipResource): Promise<FontFace> {\n if (typeof FontFace === 'undefined' || typeof document === 'undefined') {\n throw new Error('Font loading requires a browser host');\n }\n const response = await fetch(resource.src);\n if (!response.ok) throw new Error(`Font fetch failed: HTTP ${response.status}`);\n const bytes = await response.arrayBuffer();\n const font = new FontFace(resource.name, bytes);\n await font.load();\n document.fonts.add(font);\n fontSizes.set(font, bytes.byteLength);\n return font;\n}\n\n/**\n * Data resources are fetched as raw text with no parsing: the engine does not\n * know whether the file is JSON, CSV or prose. Scene code interprets the text,\n * so the engine stays format-agnostic and deterministic (no per-frame IO).\n */\nasync function defaultDataLoader(resource: ClipResource): Promise<string> {\n const response = await fetch(resource.src);\n if (!response.ok) throw new Error(`Data fetch failed: HTTP ${response.status}`);\n return response.text();\n}\n\ntype Value = CanvasImageSource | FontFace | string;\n\ninterface Entry {\n value: Value | null;\n bytes: number;\n /** Shared by every concurrent caller, so one source is fetched once. */\n promise: Promise<void> | null;\n}\n\nexport interface ResourcePoolOptions {\n imageLoader?: ImageLoader;\n fontLoader?: FontLoader;\n dataLoader?: DataLoader;\n}\n\nexport interface ResourcePoolStats {\n images: number;\n fonts: number;\n data: number;\n /** Estimated decoded bytes. Fonts and data count their file size, a lower bound. */\n bytes: number;\n}\n\n/**\n * Composition-wide cache of loaded media, keyed by source rather than by name.\n * Nothing loads until a scene is prepared, and a later scene naming the same\n * source reuses the decoded result. Entries live until the pool is disposed:\n * the cache never evicts, because a scrubbed timeline can return to any scene.\n */\nexport class ResourcePool {\n private readonly imagesBySrc = new Map<string, Entry>();\n private readonly fontsBySrc = new Map<string, Entry>();\n private readonly dataBySrc = new Map<string, Entry>();\n private readonly imageLoader: ImageLoader;\n private readonly fontLoader: FontLoader;\n private readonly dataLoader: DataLoader;\n private disposed = false;\n\n constructor(options: ResourcePoolOptions = {}) {\n this.imageLoader = options.imageLoader ?? defaultImageLoader;\n this.fontLoader = options.fontLoader ?? defaultFontLoader;\n this.dataLoader = options.dataLoader ?? defaultDataLoader;\n }\n\n /** Idempotent per source; concurrent callers share one load. Video is not loaded here. */\n acquire(resource: ClipResource, sceneId: string): Promise<void> {\n if (this.disposed) return Promise.reject(new Error(`Resource pool is disposed (scene ${sceneId})`));\n if (resource.type === 'video') return Promise.resolve();\n const table = this.tableFor(resource.type);\n const existing = table.get(resource.src);\n if (existing) return existing.promise ?? Promise.resolve();\n\n const entry: Entry = { value: null, bytes: 0, promise: null };\n const load = async (): Promise<void> => {\n if (resource.type === 'image') {\n const image = await this.imageLoader(resource);\n if (this.disposed) {\n releaseValue('image', image);\n return;\n }\n entry.value = image;\n entry.bytes = estimateImageBytes(image);\n return;\n }\n if (resource.type === 'data') {\n const text = await this.dataLoader(resource);\n if (this.disposed) return;\n entry.value = text;\n entry.bytes = estimateDataBytes(text);\n return;\n }\n const font = await this.fontLoader(resource);\n if (this.disposed) {\n releaseValue('font', font);\n return;\n }\n entry.value = font;\n entry.bytes = estimateFontBytes(font);\n };\n // Publish the entry before awaiting so a concurrent acquire joins this load.\n entry.promise = load().catch((error) => {\n table.delete(resource.src);\n throw asTicktoonError(error, `${this.labelFor(resource.type)} load failed`, {\n sceneId,\n resourceId: resource.name,\n });\n });\n table.set(resource.src, entry);\n return entry.promise;\n }\n\n image(src: string): CanvasImageSource | null {\n const value = this.imagesBySrc.get(src)?.value;\n return value == null ? null : value as CanvasImageSource;\n }\n\n font(src: string): FontFace | null {\n const value = this.fontsBySrc.get(src)?.value;\n return value == null ? null : value as FontFace;\n }\n\n /** Raw text of a data resource; no parsing is performed by the engine. */\n data(src: string): string | null {\n const value = this.dataBySrc.get(src)?.value;\n return typeof value === 'string' ? value : null;\n }\n\n /** True while this source is resident, loaded or in flight. */\n has(src: string): boolean {\n return this.imagesBySrc.has(src) || this.fontsBySrc.has(src) || this.dataBySrc.has(src);\n }\n\n /** Read-only accounting. Nothing in the engine makes decisions from it. */\n stats(): ResourcePoolStats {\n let bytes = 0;\n for (const entry of this.imagesBySrc.values()) bytes += entry.bytes;\n for (const entry of this.fontsBySrc.values()) bytes += entry.bytes;\n for (const entry of this.dataBySrc.values()) bytes += entry.bytes;\n return { images: this.imagesBySrc.size, fonts: this.fontsBySrc.size, data: this.dataBySrc.size, bytes };\n }\n\n dispose(): void {\n if (this.disposed) return;\n this.disposed = true;\n for (const entry of this.imagesBySrc.values()) releaseValue('image', entry.value as CanvasImageSource | null);\n for (const entry of this.fontsBySrc.values()) releaseValue('font', entry.value as FontFace | null);\n this.imagesBySrc.clear();\n this.fontsBySrc.clear();\n this.dataBySrc.clear();\n }\n\n private tableFor(type: ClipResource['type']): Map<string, Entry> {\n if (type === 'image') return this.imagesBySrc;\n if (type === 'data') return this.dataBySrc;\n return this.fontsBySrc;\n }\n\n private labelFor(type: ClipResource['type']): string {\n if (type === 'image') return 'Image';\n if (type === 'data') return 'Data';\n return 'Font';\n }\n}\n\nfunction estimateImageBytes(image: CanvasImageSource): number {\n const source = image as { naturalWidth?: number; naturalHeight?: number; width?: number; height?: number };\n const width = source.naturalWidth ?? (typeof source.width === 'number' ? source.width : 0);\n const height = source.naturalHeight ?? (typeof source.height === 'number' ? source.height : 0);\n return Math.max(0, width * height * 4);\n}\n\nfunction estimateFontBytes(font: FontFace): number {\n return fontBytes(font);\n}\n\nfunction estimateDataBytes(text: string): number {\n return typeof TextEncoder !== 'undefined' ? new TextEncoder().encode(text).byteLength : text.length;\n}\n\nfunction releaseValue(type: 'image' | 'font', value: CanvasImageSource | FontFace | null): void {\n if (value === null) return;\n if (type === 'font') {\n if (typeof document !== 'undefined') document.fonts.delete(value as FontFace);\n return;\n }\n if (typeof ImageBitmap !== 'undefined' && value instanceof ImageBitmap) value.close();\n}\n", "import type { ClipResource } from '../protocol.js';\nimport { asTicktoonError } from './errors.js';\nimport { ResourcePool, type ResourcePoolOptions } from './resource-pool.js';\n\nexport { ResourcePool, fontBytes } from './resource-pool.js';\nexport type { DataLoader, FontLoader, ImageLoader, ResourcePoolOptions, ResourcePoolStats } from './resource-pool.js';\n\n/** Video resources are descriptors only: decoding belongs to the host's frame sources. */\nexport interface VideoResourceRef {\n src: string;\n start: number;\n}\n\n/** Loaders belong to the shared pool, not to a single scene. */\nexport type ResourceStoreOptions = ResourcePoolOptions;\n\n/**\n * Per-scene view of the shared pool. Declaring is synchronous and free; nothing\n * is fetched until acquire() runs, which is what makes loading lazy per scene.\n */\nexport class ResourceStore {\n private readonly byName = new Map<string, ClipResource>();\n private readonly videos = new Map<string, VideoResourceRef>();\n private readonly pool: ResourcePool;\n private readonly sceneId: string;\n private pending: Promise<void> | null = null;\n private disposed = false;\n\n constructor(pool: ResourcePool, sceneId: string) {\n this.pool = pool;\n this.sceneId = sceneId;\n }\n\n /** Validates and records names only. Call acquire() before the scene runs. */\n declare(resources: ClipResource[] | undefined): void {\n if (this.disposed) throw new Error(`Resource store for scene ${this.sceneId} is disposed`);\n const entries = resources ?? [];\n assertUniqueNames(entries, this.sceneId);\n for (const resource of entries) {\n if (resource.type === 'video') {\n this.videos.set(resource.name, { src: resource.src, start: resource.start ?? 0 });\n continue;\n }\n this.byName.set(resource.name, resource);\n }\n }\n\n /** Idempotent. Concurrent callers wait on the same load. */\n acquire(): Promise<void> {\n if (this.pending) return this.pending;\n if (this.disposed) return Promise.reject(new Error(`Resource store for scene ${this.sceneId} is disposed`));\n this.pending = Promise.all(\n [...this.byName.values()].map((resource) => this.pool.acquire(resource, this.sceneId)),\n ).then(() => undefined);\n return this.pending;\n }\n\n image(name: string): CanvasImageSource | null {\n const resource = this.byName.get(name);\n return resource ? this.pool.image(resource.src) : null;\n }\n\n font(name: string): FontFace | null {\n const resource = this.byName.get(name);\n return resource ? this.pool.font(resource.src) : null;\n }\n\n data(name: string): string | null {\n const resource = this.byName.get(name);\n return resource ? this.pool.data(resource.src) : null;\n }\n\n video(name: string): VideoResourceRef | null {\n return this.videos.get(name) ?? null;\n }\n\n dispose(): void {\n if (this.disposed) return;\n this.disposed = true;\n this.byName.clear();\n this.videos.clear();\n }\n}\n\nfunction assertUniqueNames(resources: ClipResource[], sceneId: string): void {\n const names = new Set<string>();\n for (const resource of resources) {\n const key = `${resource.type}:${resource.name}`;\n if (names.has(key)) {\n throw asTicktoonError(new Error(resource.name), `Duplicate ${resource.type} resource name`, {\n sceneId,\n resourceId: resource.name,\n });\n }\n names.add(key);\n }\n}\n", "/**\n * Synchronous decoded-frame lookup. Hosts decode asynchronously and publish the\n * frame for the current instant before calling tick, so scene code can read it.\n */\nexport type VideoFrameSource = (sourceTime: number) => CanvasImageSource | null;\nexport type VideoFrameSources = Record<string, VideoFrameSource>;\n\n/** Frame-source key for a video declared in a scene's resources. */\nexport function videoResourceFrameKey(sceneId: string, name: string): string {\n return JSON.stringify(['resource', sceneId, name]);\n}\n", "import { TicktoonError } from '../runtime/errors.js';\r\n\r\ninterface ThreeObject {\r\n geometry?: { dispose(): void };\r\n material?: ThreeMaterial | ThreeMaterial[];\r\n}\r\ninterface ThreeMaterial { dispose(): void; [key: string]: unknown }\r\n\r\nexport interface ThreeScene {\r\n background: unknown;\r\n traverse(callback: (object: ThreeObject) => void): void;\r\n}\r\n\r\nexport interface ThreeCamera {\r\n lookAt(x: number, y: number, z: number): void;\r\n}\r\n\r\nexport interface ThreeRenderer {\r\n readonly domElement: HTMLCanvasElement;\r\n setPixelRatio(value: number): void;\r\n setSize(width: number, height: number, updateStyle?: boolean): void;\r\n /** WebGL viewport/scissor coordinates use CSS pixels with a bottom-left origin. */\r\n setViewport(x: number, y: number, width: number, height: number): void;\r\n setScissor(x: number, y: number, width: number, height: number): void;\r\n setScissorTest(enabled: boolean): void;\r\n setClearColor(color: number, alpha: number): void;\r\n outputColorSpace: unknown;\r\n compile(scene: ThreeScene, camera: ThreeCamera): void;\r\n render(scene: ThreeScene, camera: ThreeCamera): void;\r\n dispose(): void;\r\n forceContextLoss(): void;\r\n}\r\n\r\n/** Host contract, deliberately independent of a specific Three package version. */\r\nexport interface ThreeModule {\r\n Scene: new () => ThreeScene;\r\n PerspectiveCamera: new (fov: number, aspect: number, near: number, far: number) => ThreeCamera;\r\n WebGLRenderer: new (options: Record<string, unknown>) => ThreeRenderer;\r\n Color: new (value: string) => unknown;\r\n SRGBColorSpace?: unknown;\r\n [key: string]: unknown;\r\n}\r\n\r\nexport interface ThreeLayerRect {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n}\r\n\r\nexport interface ThreeLayerOptions {\r\n /** Destination rectangle in logical scene coordinates. Defaults to the full scene. */\r\n rect?: ThreeLayerRect;\r\n /** Vertical field of view in degrees. */\r\n fov?: number;\r\n near?: number;\r\n far?: number;\r\n /** Opaque background for this layer only; omit to keep the layer transparent. */\r\n background?: string;\r\n}\r\n\r\nexport interface ThreeLayer {\r\n readonly scene: ThreeScene;\r\n readonly camera: ThreeCamera;\r\n readonly rect: ThreeLayerRect;\r\n /** Renders this layer and composites it into the 2D context at its own rect. */\r\n draw(ctx: CanvasRenderingContext2D): void;\r\n dispose(): void;\r\n}\r\n\r\nexport interface ThreeLayerHost {\r\n three: ThreeModule;\r\n renderer: ThreeRenderer;\r\n /** Logical scene size, used to resolve the default rect and pixel scaling. */\r\n width: number;\r\n height: number;\r\n sceneId: string;\r\n}\r\n\r\n/**\r\n * A 3D rectangle inside a Canvas scene. Every layer owns its camera and aspect\r\n * ratio, but all layers of a composition share one WebGL context through\r\n * viewport and scissor, so a scene can place several independent 3D views.\r\n */\r\nexport function createThreeLayer(host: ThreeLayerHost, options: ThreeLayerOptions = {}): ThreeLayer {\r\n return new Layer(host, options);\r\n}\r\n\r\nclass Layer implements ThreeLayer {\r\n readonly scene: ThreeScene;\r\n readonly camera: ThreeCamera;\r\n readonly rect: ThreeLayerRect;\r\n\r\n private readonly host: ThreeLayerHost;\r\n private disposed = false;\r\n\r\n constructor(host: ThreeLayerHost, options: ThreeLayerOptions) {\r\n this.host = host;\r\n this.rect = Object.freeze(resolveRect(options.rect, host.width, host.height));\r\n if (this.rect.width <= 0 || this.rect.height <= 0) {\r\n throw new TicktoonError('Three layer rect must have a positive size', { sceneId: host.sceneId });\r\n }\r\n this.scene = new host.three.Scene();\r\n if (options.background) this.scene.background = new host.three.Color(options.background);\r\n this.camera = new host.three.PerspectiveCamera(\r\n options.fov ?? 38,\r\n this.rect.width / this.rect.height,\r\n options.near ?? 0.1,\r\n options.far ?? 100,\r\n );\r\n }\r\n\r\n draw(ctx: CanvasRenderingContext2D): void {\r\n if (this.disposed) throw new TicktoonError('Cannot draw a disposed Three layer', { sceneId: this.host.sceneId });\r\n const renderer = this.host.renderer;\r\n const target = renderer.domElement;\r\n const pixelWidth = Math.max(1, ctx.canvas.width);\r\n const pixelHeight = Math.max(1, ctx.canvas.height);\r\n if (target.width !== pixelWidth || target.height !== pixelHeight) {\r\n renderer.setSize(pixelWidth, pixelHeight, false);\r\n }\r\n\r\n const scaleX = pixelWidth / this.host.width;\r\n const scaleY = pixelHeight / this.host.height;\r\n const x = clamp(Math.round(this.rect.x * scaleX), 0, pixelWidth - 1);\r\n const y = clamp(Math.round(this.rect.y * scaleY), 0, pixelHeight - 1);\r\n const width = clamp(Math.round(this.rect.width * scaleX), 1, pixelWidth - x);\r\n const height = clamp(Math.round(this.rect.height * scaleY), 1, pixelHeight - y);\r\n\r\n // A scissored render clears and rasterizes only this layer, so neighbouring\r\n // layers on the shared context stay untouched.\r\n renderer.setViewport(x, pixelHeight - y - height, width, height);\r\n renderer.setScissor(x, pixelHeight - y - height, width, height);\r\n renderer.setScissorTest(true);\r\n try {\r\n renderer.render(this.scene, this.camera);\r\n } finally {\r\n renderer.setScissorTest(false);\r\n }\r\n\r\n ctx.save();\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n ctx.drawImage(target, x, y, width, height, x, y, width, height);\r\n ctx.restore();\r\n }\r\n\r\n dispose(): void {\r\n if (this.disposed) return;\r\n this.disposed = true;\r\n const geometries = new Set<unknown>();\r\n const materials = new Set<ThreeMaterial>();\r\n const textures = new Set<{ dispose(): void }>();\r\n this.scene.traverse((object) => {\r\n if (object.geometry) geometries.add(object.geometry);\r\n for (const material of Array.isArray(object.material) ? object.material : [object.material]) {\r\n if (material) materials.add(material);\r\n }\r\n });\r\n for (const material of materials) {\r\n for (const value of Object.values(material)) {\r\n if (value && typeof value === 'object' && 'isTexture' in value && 'dispose' in value) {\r\n textures.add(value as { dispose(): void });\r\n }\r\n }\r\n }\r\n for (const geometry of geometries) (geometry as { dispose(): void }).dispose();\r\n for (const texture of textures) texture.dispose();\r\n for (const material of materials) material.dispose();\r\n }\r\n}\r\n\r\nfunction resolveRect(rect: ThreeLayerRect | undefined, width: number, height: number): ThreeLayerRect {\r\n if (!rect) return { x: 0, y: 0, width, height };\r\n const x = finite(rect.x);\r\n const y = finite(rect.y);\r\n const w = finite(rect.width);\r\n const h = finite(rect.height);\r\n if (w <= 0 || h <= 0) {\r\n throw new TicktoonError(`Three layer rect must have a positive size, received ${w}x${h}`);\r\n }\r\n return { x, y, width: w, height: h };\r\n}\r\n\r\nfunction finite(value: number): number {\r\n if (typeof value !== 'number' || !Number.isFinite(value)) {\r\n throw new TicktoonError(`Three layer rect values must be finite, received ${String(value)}`);\r\n }\r\n return value;\r\n}\r\n\r\nfunction clamp(value: number, min: number, max: number): number {\r\n return Math.min(Math.max(value, min), max);\r\n}\r\n", "import type { Cue, RuntimeScene } from '../protocol.js';\nimport { defaultCanvasFactory, resetCanvas, type CanvasFactory } from '../runtime/canvas.js';\nimport { clampTime, createSeededRng } from '../runtime/deterministic.js';\nimport { asTicktoonError, TicktoonError } from '../runtime/errors.js';\nimport { ResourceStore, type ResourceStoreOptions } from '../runtime/resources.js';\nimport { ResourcePool } from '../runtime/resource-pool.js';\nimport { videoResourceFrameKey, type VideoFrameSources } from '../runtime/video-frames.js';\nimport {\n createThreeLayer,\n type ThreeLayer,\n type ThreeLayerOptions,\n type ThreeModule,\n type ThreeRenderer,\n} from './three-layer.js';\nimport type { IFrameClip } from './frame-clip.js';\n\n/**\n * Scratch-canvas supersampling factor used when the host specifies none.\n *\n * Deliberately 1: a host that does not think about scale gets exactly the\n * logical coordinates it drew, with no hidden magnification and no surprise\n * memory bill. Quality is an explicit host decision \u2014 the preview host passes 1,\n * the export host passes the largest factor its pixel budget allows (see\n * `exportRenderScale`). This constant is a fallback, not a tuning knob.\n */\nexport const FALLBACK_RENDER_SCALE = 1;\n\nexport interface CodeSceneApi {\n readonly t: number;\n readonly d: number;\n readonly W: number;\n readonly H: number;\n readonly cues: readonly Cue[];\n readonly seed: number;\n rng(): () => number;\n img(name: string): CanvasImageSource | null;\n /** Raw text of a data resource, fetched once at prepare time; no parsing by the engine. */\n data(name: string): string | null;\n /**\n * Decoded frame of a video resource at the current scene time, or null while\n * the host has not published it yet. The scene decides placement, crop, and masking.\n */\n video(name: string): CanvasImageSource | null;\n /** Offscreen 2D surface in scene coordinates. Build once in setup, reuse every frame. */\n canvas(width: number, height: number): SceneCanvas;\n /** Host-injected Three module, undefined unless the scene declares needs: ['three']. */\n readonly THREE: ThreeModule | undefined;\n /** Creates a 3D layer composited at its own rect and camera. Setup only. */\n three(options?: ThreeLayerOptions): ThreeLayer;\n}\n\n/**\n * An offscreen drawing surface expressed in the scene's own coordinates.\n *\n * The backing canvas is allocated at the scene pixel scale so text and vector\n * art stay as sharp as the main surface, but that scale never reaches scene\n * code: `ctx` is pre-transformed, `width`/`height` are the logical numbers the\n * caller asked for, and `blit()` is the only supported way back.\n */\nexport interface SceneCanvas {\n /** Native canvas for texture upload; its pixel size is the logical size times the scene scale. */\n readonly canvas: HTMLCanvasElement;\n /** Scene-space context; already transformed, draw with logical coordinates. */\n readonly ctx: CanvasRenderingContext2D;\n readonly width: number;\n readonly height: number;\n /** Composites this surface into `target` at the logical size, keeping pixels 1:1. */\n blit(target: CanvasRenderingContext2D, x: number, y: number): void;\n}\n\n/** Setup returns a draw function to become two-phase; returning nothing keeps per-frame mode. */\ntype SceneRun = (ctx: CanvasRenderingContext2D, api: CodeSceneApi) => unknown;\n\n/**\n * The 2D surface a scene paints its frame into.\n *\n * Every tick repaints from scratch (determinism forbids cross-frame history), and\n * the compositor copies the result out immediately, so a single surface can serve\n * the whole sequence. Sharing it turns per-scene memory from `scenes \u00D7 pixelSize`\n * into one allocation, which is what a twenty-scene composition needs.\n */\nexport interface SceneSurface {\n readonly canvas: HTMLCanvasElement;\n readonly ctx: CanvasRenderingContext2D;\n}\n\nexport interface CodeClipOptions extends ResourceStoreOptions {\n renderScale?: number;\n canvasFactory?: CanvasFactory;\n three?: ThreeModule;\n renderer?: ThreeRenderer;\n /** Host-owned decoded frames, keyed by videoResourceFrameKey(). */\n videoFrames?: VideoFrameSources;\n /** Composition-wide cache; a clip that omits it gets a private pool. */\n resourcePool?: ResourcePool;\n /** Compositor-owned scratch surface; a clip that omits it allocates a canvas of its own. */\n surface?: SceneSurface;\n}\n\n/**\n * A Canvas-only deterministic scene clip. Construction compiles the scene code;\n * call prepare() to load resources and run setup, then tick() is synchronous.\n */\nexport class CodeClip implements IFrameClip {\n readonly id: string;\n readonly meta: { width: number; height: number; duration: number };\n /** Compilation is synchronous, so this only marks the clip as constructible. */\n readonly ready: Promise<void> = Promise.resolve();\n readonly canvas: HTMLCanvasElement;\n\n private readonly ctx: CanvasRenderingContext2D;\n private readonly data: RuntimeScene;\n private readonly renderScale: number;\n private readonly canvasFactory: CanvasFactory;\n private readonly ownsCanvas: boolean;\n private readonly run: SceneRun;\n private draw: SceneRun;\n private readonly resources: ResourceStore;\n private readonly pool: ResourcePool;\n private readonly ownsPool: boolean;\n private readonly cues: readonly Cue[];\n private readonly three: ThreeModule | undefined;\n private readonly renderer: ThreeRenderer | undefined;\n private readonly videoFrames: VideoFrameSources;\n private readonly layers: ThreeLayer[] = [];\n private preparing: Promise<void> | null = null;\n private inSetup = true;\n private prepared = false;\n private disposed = false;\n\n constructor(data: RuntimeScene, options: CodeClipOptions = {}) {\n this.data = data;\n this.id = data.id;\n this.renderScale = options.renderScale ?? FALLBACK_RENDER_SCALE;\n if (!Number.isFinite(this.renderScale) || this.renderScale <= 0) {\n throw new TicktoonError(`Invalid renderScale: ${this.renderScale}`, this.context());\n }\n this.meta = { width: data.width, height: data.height, duration: data.duration };\n this.three = options.three;\n this.renderer = options.renderer;\n this.videoFrames = options.videoFrames ?? {};\n\n this.canvasFactory = options.canvasFactory ?? defaultCanvasFactory;\n const width = Math.max(1, Math.round(data.width * this.renderScale));\n const height = Math.max(1, Math.round(data.height * this.renderScale));\n if (options.surface) {\n // Shared surfaces are created once at the composition size. A mismatch means\n // the host paired the surface with a different renderScale or canvas size.\n if (options.surface.canvas.width !== width || options.surface.canvas.height !== height) {\n throw new TicktoonError(\n `Shared surface is ${options.surface.canvas.width}\u00D7${options.surface.canvas.height}, scene ${data.id} needs ${width}\u00D7${height}`,\n this.context(),\n );\n }\n this.canvas = options.surface.canvas;\n this.ctx = options.surface.ctx;\n this.ownsCanvas = false;\n } else {\n this.canvas = this.canvasFactory(width, height);\n const ownContext = this.canvas.getContext('2d', { alpha: true });\n if (!ownContext) throw new TicktoonError('Unable to create a 2D canvas context', this.context());\n this.ctx = ownContext;\n this.ownsCanvas = true;\n }\n\n try {\n // Scene code is trusted authoring input. Restrictive CSP must allow this explicit host capability.\n this.run = new Function('ctx', 'api', data.code) as SceneRun;\n } catch (error) {\n throw asTicktoonError(error, 'Scene code compilation failed', this.context());\n }\n this.draw = this.run;\n\n this.ownsPool = options.resourcePool === undefined;\n this.pool = options.resourcePool ?? new ResourcePool(options);\n this.resources = new ResourceStore(this.pool, data.id);\n try {\n this.resources.declare(data.resources);\n } catch (error) {\n throw asTicktoonError(error, 'Resource declaration failed', this.context());\n }\n this.cues = Object.freeze(data.cues.map((cue) => Object.freeze({\n ...cue,\n chars: Object.freeze(cue.chars.map((char) => Object.freeze({ ...char }))),\n })));\n }\n\n /** True once resources are loaded and setup has run; tick() is valid after this. */\n get isPrepared(): boolean {\n return this.prepared;\n }\n\n /**\n * Loads this scene's resources (shared with any scene naming the same source)\n * and runs setup once. Idempotent; safe to call again after it resolved.\n */\n prepare(): Promise<void> {\n if (this.prepared) return Promise.resolve();\n if (this.preparing) return this.preparing;\n if (this.disposed) return Promise.reject(new TicktoonError('Cannot prepare a disposed clip', this.context()));\n this.preparing = this.resources.acquire().then(() => {\n if (this.disposed) throw new TicktoonError('Clip was disposed during preparation', this.context());\n this.enter();\n this.prepared = true;\n this.preparing = null;\n }).catch((error) => {\n this.preparing = null;\n throw error;\n });\n return this.preparing;\n }\n\n /** Synchronously draws any scene-local time without depending on prior frames. */\n tick(time: number): HTMLCanvasElement {\n if (this.disposed) throw new TicktoonError('Cannot tick a disposed clip', this.context(time));\n if (!this.prepared) {\n throw new TicktoonError('Await clip.prepare() before requesting frames', this.context(time));\n }\n const t = clampTime(time, this.data.duration);\n // A fresh frozen API and random generator make scene-local mutation frame-independent.\n const api = this.api(t);\n\n resetCanvas(this.ctx);\n const scaleX = this.canvas.width / this.data.width;\n const scaleY = this.canvas.height / this.data.height;\n this.ctx.setTransform(scaleX, 0, 0, scaleY, 0, 0);\n if (this.data.background !== 'transparent') {\n this.ctx.fillStyle = this.data.background;\n this.ctx.fillRect(0, 0, this.data.width, this.data.height);\n }\n\n this.ctx.save();\n try {\n const result = this.draw(this.ctx, api);\n if (result && typeof (result as PromiseLike<unknown>).then === 'function') {\n throw new Error('Scene frame returned a Promise; tick(t) must remain synchronous');\n }\n } catch (error) {\n throw asTicktoonError(error, 'Scene frame evaluation failed', this.context(t));\n } finally {\n this.ctx.restore();\n }\n return this.canvas;\n }\n\n dispose(): void {\n if (this.disposed) return;\n this.disposed = true;\n this.prepared = false;\n for (const layer of this.layers) layer.dispose();\n this.layers.length = 0;\n this.resources.dispose();\n if (this.ownsPool) this.pool.dispose();\n if (this.ownsCanvas) {\n this.canvas.width = 1;\n this.canvas.height = 1;\n }\n }\n\n /** Runs the scene body once so it can build persistent state, including 3D layers. */\n private enter(): void {\n let result: unknown;\n try {\n result = this.run(this.ctx, this.api(0));\n } catch (error) {\n throw asTicktoonError(error, 'Scene setup failed', this.context(0));\n }\n if (typeof result === 'function') this.draw = result as SceneRun;\n this.inSetup = false;\n resetCanvas(this.ctx);\n }\n\n private api(t: number): CodeSceneApi {\n const api: CodeSceneApi = {\n t,\n d: this.data.duration,\n W: this.data.width,\n H: this.data.height,\n cues: this.cues,\n seed: this.data.seed,\n rng: () => createSeededRng(this.data.seed),\n img: (name: string) => this.resources.image(name),\n data: (name: string) => this.resources.data(name),\n video: (name: string) => this.videoFrame(name, t),\n canvas: (width: number, height: number) => this.createCanvas(width, height),\n THREE: this.three,\n three: (options?: ThreeLayerOptions) => this.createLayer(options),\n };\n return Object.freeze(api);\n }\n\n /**\n * Allocates at the scene pixel scale and hands back a scene-space view of it.\n *\n * Callers pass the numbers they would use on the main canvas, so the render\n * scale stays entirely inside the engine. Compositing through `blit()` keeps\n * the extra pixels instead of resampling them away.\n */\n private createCanvas(width: number, height: number): SceneCanvas {\n const w = Math.max(1, Math.round(width));\n const h = Math.max(1, Math.round(height));\n const pixelWidth = Math.max(1, Math.round(w * this.renderScale));\n const pixelHeight = Math.max(1, Math.round(h * this.renderScale));\n const canvas = this.canvasFactory(pixelWidth, pixelHeight);\n const ctx = canvas.getContext('2d', { alpha: true });\n if (!ctx) throw new TicktoonError('Unable to create an offscreen 2D context', this.context());\n ctx.setTransform(pixelWidth / w, 0, 0, pixelHeight / h, 0, 0);\n return Object.freeze({\n canvas,\n ctx,\n width: w,\n height: h,\n blit(target: CanvasRenderingContext2D, x: number, y: number): void {\n target.drawImage(canvas, x, y, w, h);\n },\n });\n }\n\n /** Returns null instead of throwing so a late-published frame never breaks a tick. */\n private videoFrame(name: string, t: number): CanvasImageSource | null {\n const ref = this.resources.video(name);\n if (!ref) return null;\n const source = this.videoFrames[videoResourceFrameKey(this.id, name)];\n if (!source) return null;\n try {\n return source(ref.start + t);\n } catch (error) {\n throw asTicktoonError(error, 'Video resource frame read failed', {\n ...this.context(t),\n resourceId: name,\n });\n }\n }\n\n private createLayer(options: ThreeLayerOptions = {}): ThreeLayer {\n if (!this.inSetup) {\n throw new TicktoonError(\n 'three() builds a persistent layer, so it may only run in setup; return (ctx, api) => {} from the scene body',\n this.context(),\n );\n }\n if (!this.three || !this.renderer) {\n throw new TicktoonError(\"Scene calls three() but the scene does not declare needs: ['three']\", this.context());\n }\n const layer = createThreeLayer({\n three: this.three,\n renderer: this.renderer,\n width: this.data.width,\n height: this.data.height,\n sceneId: this.id,\n }, options);\n this.layers.push(layer);\n return layer;\n }\n\n private context(time?: number) {\n return {\n sceneId: this.id,\n ...(time !== undefined ? { time } : {}),\n };\n }\n}\n", "import { CodeClip, FALLBACK_RENDER_SCALE, type CodeClipOptions, type SceneSurface } from '../clip/code-clip.js';\nimport type { IFrameClip } from '../clip/frame-clip.js';\nimport type { ThreeModule, ThreeRenderer } from '../clip/three-layer.js';\nimport type { RuntimeComposition, RuntimeScene } from '../protocol.js';\nimport { defaultCanvasFactory, resetCanvas, type CanvasFactory } from '../runtime/canvas.js';\nimport { clampTime } from '../runtime/deterministic.js';\nimport { TicktoonError } from '../runtime/errors.js';\nimport { ResourcePool, type ResourcePoolStats } from '../runtime/resource-pool.js';\nimport { validateComposition } from '../runtime/validate.js';\nimport type { VideoFrameSources } from '../runtime/video-frames.js';\n\nexport { videoResourceFrameKey } from '../runtime/video-frames.js';\nexport type { VideoFrameSource, VideoFrameSources } from '../runtime/video-frames.js';\n\nexport interface CanvasCompositorOptions extends Omit<CodeClipOptions, 'canvasFactory' | 'videoFrames'> {\n canvasFactory?: CanvasFactory;\n three?: ThreeModule;\n videoSources?: VideoFrameSources;\n resourcePool?: ResourcePool;\n}\n\nexport interface PrepareOptions {\n /**\n * Also start loading the next scene in the background. Only playback should\n * ask for it: scrubbing across twenty scenes must not arm twenty loads.\n */\n prefetch?: boolean;\n}\n\ninterface SceneEntry {\n clip: IFrameClip;\n data: RuntimeScene;\n index: number;\n}\n\n/**\n * Deterministic scene-sequence compositor. Picture is one ordered list of\n * scenes; sound is a separate event list handled by the mixer. Media adapters\n * provide synchronous decoded frames.\n */\nexport class CanvasCompositor {\n readonly composition: RuntimeComposition;\n readonly canvas: HTMLCanvasElement;\n /** First frame is drawable: construction finished and the opening scene is prepared. */\n readonly ready: Promise<void>;\n\n private readonly ctx: CanvasRenderingContext2D;\n private readonly scenes: SceneEntry[] = [];\n private readonly pool: ResourcePool;\n private readonly ownsPool: boolean;\n private readonly sceneSurface: SceneSurface;\n private threeRenderer: ThreeRenderer | null = null;\n private isReady = false;\n private disposed = false;\n\n constructor(input: unknown, options: CanvasCompositorOptions = {}) {\n this.composition = validateComposition(input);\n this.pool = options.resourcePool ?? new ResourcePool(options);\n this.ownsPool = options.resourcePool === undefined;\n const factory = options.canvasFactory ?? defaultCanvasFactory;\n this.canvas = factory(this.composition.width, this.composition.height);\n const ctx = this.canvas.getContext('2d', { alpha: true });\n if (!ctx) throw new TicktoonError('Unable to create the composition 2D context');\n this.ctx = ctx;\n this.sceneSurface = createSceneSurface(\n factory,\n this.composition.width,\n this.composition.height,\n options.renderScale ?? FALLBACK_RENDER_SCALE,\n );\n\n try {\n const needsThree = this.composition.scenes.some((scene) => scene.needs.includes('three'));\n if (needsThree) {\n if (!options.three) {\n throw new TicktoonError(\"A scene declares needs: ['three'] but the host did not inject the THREE module\");\n }\n const renderer = new options.three.WebGLRenderer({\n canvas: factory(this.composition.width, this.composition.height),\n alpha: true,\n antialias: true,\n preserveDrawingBuffer: true,\n powerPreference: 'high-performance',\n });\n this.threeRenderer = renderer;\n renderer.setPixelRatio(1);\n if (options.three.SRGBColorSpace !== undefined) renderer.outputColorSpace = options.three.SRGBColorSpace;\n renderer.setClearColor(0, 0);\n }\n\n this.composition.scenes.forEach((data, index) => {\n const clip = new CodeClip(data, {\n ...options,\n canvasFactory: factory,\n videoFrames: options.videoSources ?? {},\n resourcePool: this.pool,\n surface: this.sceneSurface,\n renderScale: options.renderScale ?? FALLBACK_RENDER_SCALE,\n ...(this.threeRenderer ? { renderer: this.threeRenderer } : {}),\n });\n this.scenes.push({ clip, data, index });\n });\n } catch (error) {\n this.dispose();\n throw error;\n }\n\n // Only the opening scene is prepared up front; later scenes load when reached.\n this.ready = this.prepare(0).then(() => {\n if (this.disposed) throw new TicktoonError('Compositor was disposed during preload');\n this.isReady = true;\n }).catch((error) => {\n this.dispose();\n throw error;\n });\n }\n\n /**\n * Loads the resources of whichever scene covers `time`. Idempotent per scene\n * and shared across scenes that name the same source, so callers may invoke\n * it on every frame. With `prefetch`, the following scene starts loading too.\n */\n prepare(time: number, options: PrepareOptions = {}): Promise<void> {\n if (this.disposed) return Promise.reject(new TicktoonError('Cannot prepare a disposed compositor'));\n const t = clampTime(time, this.composition.duration);\n const active = this.activeScene(t);\n if (options.prefetch) {\n const next = this.scenes[active.index + 1];\n // A failed prefetch must not surface here; the real scene load reports it.\n if (next && !next.clip.isPrepared) void next.clip.prepare().catch(() => {});\n }\n return active.clip.prepare();\n }\n\n /** Synchronous readiness check for scrub paths that must not start async work. */\n isPrepared(time: number): boolean {\n if (this.disposed || !this.isReady) return false;\n return this.activeScene(clampTime(time, this.composition.duration)).clip.isPrepared;\n }\n\n /** Preview and export call this path after their adapters prepare the current video frames. */\n tick(time: number): HTMLCanvasElement {\n if (this.disposed) throw new TicktoonError('Cannot tick a disposed compositor');\n if (!this.isReady) throw new TicktoonError('Await compositor.ready before requesting frames');\n const t = clampTime(time, this.composition.duration);\n const active = this.activeScene(t);\n const frame = active.clip.tick(t - active.data.start);\n\n resetCanvas(this.ctx);\n this.ctx.imageSmoothingEnabled = true;\n this.ctx.imageSmoothingQuality = 'high';\n this.ctx.drawImage(frame, 0, 0, this.composition.width, this.composition.height);\n return this.canvas;\n }\n\n inspect(time: number): {\n compositionTime: number;\n sceneId: string;\n sceneIndex: number;\n sceneTime: number;\n sceneDuration: number;\n } {\n if (this.disposed) throw new TicktoonError('Cannot inspect a disposed compositor');\n const t = clampTime(time, this.composition.duration);\n const active = this.activeScene(t);\n return {\n compositionTime: t,\n sceneId: active.data.id,\n sceneIndex: active.index,\n sceneTime: t - active.data.start,\n sceneDuration: active.data.duration,\n };\n }\n\n /** Read-only resource accounting for diagnostics. */\n resourceStats(): ResourcePoolStats {\n return this.pool.stats();\n }\n\n dispose(): void {\n if (this.disposed) return;\n this.disposed = true;\n this.isReady = false;\n for (const entry of this.scenes) entry.clip.dispose();\n if (this.ownsPool) this.pool.dispose();\n if (this.threeRenderer) {\n this.threeRenderer.dispose();\n this.threeRenderer.forceContextLoss();\n this.threeRenderer.domElement.width = 1;\n this.threeRenderer.domElement.height = 1;\n this.threeRenderer = null;\n }\n this.canvas.width = 1;\n this.canvas.height = 1;\n this.sceneSurface.canvas.width = 1;\n this.sceneSurface.canvas.height = 1;\n }\n\n private activeScene(time: number): SceneEntry {\n for (let index = 0; index < this.scenes.length; index += 1) {\n const entry = this.scenes[index]!;\n const isFinalFrame = index === this.scenes.length - 1 && time === this.composition.duration;\n if ((time >= entry.data.start && time < entry.data.start + entry.data.duration) || isFinalFrame) return entry;\n }\n throw new TicktoonError(`No active scene at t=${time}`);\n }\n}\n\n/**\n * One scratch surface for the whole sequence. A scene repaints every tick and the\n * compositor copies the result out before the next tick, so scenes never need a\n * canvas of their own; `scenes \u00D7 18 MB` collapses into a single allocation.\n */\nfunction createSceneSurface(\n factory: CanvasFactory,\n width: number,\n height: number,\n scale: number,\n): SceneSurface {\n const canvas = factory(\n Math.max(1, Math.round(width * scale)),\n Math.max(1, Math.round(height * scale)),\n );\n const ctx = canvas.getContext('2d', { alpha: true });\n if (!ctx) throw new TicktoonError('Unable to create the shared scene 2D context');\n return { canvas, ctx };\n}\n", "import type { ThreeModule } from '../src/clip/three-layer.js';\n\nexport async function loadThree(): Promise<ThreeModule> {\n const scope = globalThis as unknown as { THREE?: ThreeModule };\n if (scope.THREE) return scope.THREE;\n const moduleUrl = '/three.module.js';\n const module = await import(/* @vite-ignore */ moduleUrl) as ThreeModule;\n scope.THREE = module;\n return module;\n}\n", "/** Envelope fields shared by authored and runtime audio events. */\nexport interface GainShape {\n duration: number;\n volume: number;\n fadeIn?: number;\n fadeOut?: number;\n}\n\n/**\n * Linear fade envelope as a pure function of event-local time. Preview and\n * export both use this so an event never sounds different in the two paths.\n */\nexport function audioGain(data: GainShape, localTime: number): number {\n const duration = data.duration;\n const fadeIn = clampFade(data.fadeIn, duration);\n const fadeOut = clampFade(data.fadeOut, duration);\n let gain = data.volume;\n if (fadeIn > 0 && localTime < fadeIn) {\n gain *= Math.max(0, localTime) / fadeIn;\n }\n if (fadeOut > 0 && localTime > duration - fadeOut) {\n gain *= Math.max(0, (duration - localTime) / fadeOut);\n }\n return gain;\n}\n\nfunction clampFade(value: number | undefined, duration: number): number {\n if (value === undefined || !Number.isFinite(value) || value <= 0) return 0;\n return Math.min(value, duration);\n}\n", "import type { RuntimeComposition } from '../../protocol.js';\nimport { videoResourceFrameKey } from '../../runtime/video-frames.js';\n\n/**\n * A video resource behaves like a playback window owned by its scene, so hosts\n * can reuse one prefetch and seek schedule regardless of whether the frame is\n * drawn by scene code or composited by the engine.\n */\nexport interface VideoResourceBinding {\n sceneId: string;\n src: string;\n sourceKey: string;\n /** Composition-absolute window and source offset for this resource. */\n start: number;\n duration: number;\n sourceStart: number;\n}\n\n/** Reads the composition rather than live clips, so hosts can build a schedule up front. */\nexport function videoResourceBindings(composition: RuntimeComposition): VideoResourceBinding[] {\n const bindings: VideoResourceBinding[] = [];\n for (const scene of composition.scenes) {\n for (const resource of scene.resources ?? []) {\n if (resource.type !== 'video') continue;\n bindings.push({\n sceneId: scene.id,\n src: resource.src,\n sourceKey: videoResourceFrameKey(scene.id, resource.name),\n start: scene.start,\n duration: scene.duration,\n sourceStart: resource.start ?? 0,\n });\n }\n }\n return bindings;\n}\n"],
|
|
5
|
+
"mappings": ";AAAO,IAAM,mBAAmB;;;ACUzB,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B,kBAAkB;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,SAAiB,UAAwB,CAAC,GAAG,SAAwB;AAC/E,UAAM,WAAW;AAAA,MACf,QAAQ,UAAU,SAAS,QAAQ,OAAO,KAAK;AAAA,MAC/C,QAAQ,eAAe,SAAS,QAAQ,YAAY,KAAK;AAAA,MACzD,QAAQ,SAAS,SAAY,KAAK,QAAQ,IAAI,KAAK;AAAA,MACnD,QAAQ,aAAa,YAAY,QAAQ,UAAU,KAAK;AAAA,IAC1D,EAAE,OAAO,OAAO,EAAE,KAAK,IAAI;AAC3B,UAAM,cAAc,gBAAgB,KAAK,OAAO,GAAG,WAAW,KAAK,QAAQ,MAAM,EAAE,IAAI,OAAO;AAC9F,SAAK,OAAO;AACZ,SAAK,UAAU,QAAQ;AACvB,SAAK,eAAe,QAAQ;AAC5B,SAAK,OAAO,QAAQ;AACpB,SAAK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I,UAAU,UAAa,CAAC,OAAO,SAAS,KAAK,KAAK,SAAS,EAAG,QAAO;AACzE,SAAO,KAAK,IAAI,OAAO,QAAQ;AACjC;;;ACVO,SAAS,sBAAsB,aAAyD;AAC7F,QAAM,WAAmC,CAAC;AAC1C,aAAW,SAAS,YAAY,QAAQ;AACtC,eAAW,YAAY,MAAM,aAAa,CAAC,GAAG;AAC5C,UAAI,SAAS,SAAS,QAAS;AAC/B,eAAS,KAAK;AAAA,QACZ,SAAS,MAAM;AAAA,QACf,KAAK,SAAS;AAAA,QACd,WAAW,sBAAsB,MAAM,IAAI,SAAS,IAAI;AAAA,QACxD,OAAO,MAAM;AAAA,QACb,UAAU,MAAM;AAAA,QAChB,aAAa,SAAS,SAAS;AAAA,MACjC,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
|
+
"names": ["finite"]
|
|
7
|
+
}
|
package/dist/clip/code-clip.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export interface CodeSceneApi {
|
|
|
24
24
|
readonly seed: number;
|
|
25
25
|
rng(): () => number;
|
|
26
26
|
img(name: string): CanvasImageSource | null;
|
|
27
|
+
/** Raw text of a data resource, fetched once at prepare time; no parsing by the engine. */
|
|
28
|
+
data(name: string): string | null;
|
|
27
29
|
/**
|
|
28
30
|
* Decoded frame of a video resource at the current scene time, or null while
|
|
29
31
|
* the host has not published it yet. The scene decides placement, crop, and masking.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-clip.d.ts","sourceRoot":"","sources":["../../src/clip/code-clip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG7F,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3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AAC,QAAQ,CAAC,UAAU,CAAU;IACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAW;IAC/B,OAAO,CAAC,IAAI,CAAW;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IAC1C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAe;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiB;IACtC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA0B;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4B;IACrD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;gBAEb,IAAI,EAAE,YAAY,EAAE,OAAO,GAAE,eAAoB;IAyD7D,oFAAoF;IACpF,IAAI,UAAU,IAAI,OAAO,CAExB;IAED;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBxB,kFAAkF;IAClF,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB;IAgCrC,OAAO,IAAI,IAAI;IAcf,sFAAsF;IACtF,OAAO,CAAC,KAAK;IAYb,OAAO,CAAC,GAAG;IAmBX;;;;;;OAMG;IACH,OAAO,CAAC,YAAY;IAoBpB,sFAAsF;IACtF,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,WAAW;IAqBnB,OAAO,CAAC,OAAO;CAMhB"}
|
package/dist/clip/code-clip.js
CHANGED
|
@@ -198,6 +198,7 @@ export class CodeClip {
|
|
|
198
198
|
seed: this.data.seed,
|
|
199
199
|
rng: () => createSeededRng(this.data.seed),
|
|
200
200
|
img: (name) => this.resources.image(name),
|
|
201
|
+
data: (name) => this.resources.data(name),
|
|
201
202
|
video: (name) => this.videoFrame(name, t),
|
|
202
203
|
canvas: (width, height) => this.createCanvas(width, height),
|
|
203
204
|
THREE: this.three,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-clip.js","sourceRoot":"","sources":["../../src/clip/code-clip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAsB,MAAM,sBAAsB,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,aAAa,EAA6B,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAA0B,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EACL,gBAAgB,GAKjB,MAAM,kBAAkB,CAAC;AAG1B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAwEvC;;;GAGG;AACH,MAAM,OAAO,QAAQ;IACV,EAAE,CAAS;IACX,IAAI,CAAsD;IACnE,gFAAgF;IACvE,KAAK,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IACzC,MAAM,CAAoB;IAElB,GAAG,CAA2B;IAC9B,IAAI,CAAe;IACnB,WAAW,CAAS;IACpB,aAAa,CAAgB;IAC7B,UAAU,CAAU;IACpB,GAAG,CAAW;IACvB,IAAI,CAAW;IACN,SAAS,CAAgB;IACzB,IAAI,CAAe;IACnB,QAAQ,CAAU;IAClB,IAAI,CAAiB;IACrB,KAAK,CAA0B;IAC/B,QAAQ,CAA4B;IACpC,WAAW,CAAoB;IAC/B,MAAM,GAAiB,EAAE,CAAC;IACnC,SAAS,GAAyB,IAAI,CAAC;IACvC,OAAO,GAAG,IAAI,CAAC;IACf,QAAQ,GAAG,KAAK,CAAC;IACjB,QA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EAAE,CAAC,CAAC;QACjH,CAAC;QACD,MAAM,KAAK,GAAG,gBAAgB,CAAC;YAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;YACtB,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM;YACxB,OAAO,EAAE,IAAI,CAAC,EAAE;SACjB,EAAE,OAAO,CAAC,CAAC;QACZ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,OAAO,CAAC,IAAa;QAC3B,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,EAAE;YAChB,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACxC,CAAC;IACJ,CAAC;CACF"}
|
package/dist/export-page.js
CHANGED
package/dist/preview-panel.js
CHANGED
package/dist/protocol.d.ts
CHANGED
|
@@ -11,14 +11,15 @@ export interface Cue {
|
|
|
11
11
|
/** Scene-relative character timing for caption templates and other code scenes. */
|
|
12
12
|
chars: readonly CueChar[];
|
|
13
13
|
}
|
|
14
|
-
export type ClipResourceType = 'image' | 'font' | 'video';
|
|
14
|
+
export type ClipResourceType = 'image' | 'font' | 'video' | 'data';
|
|
15
15
|
/**
|
|
16
16
|
* An external asset a scene reads synchronously. Video is declared here too:
|
|
17
17
|
* `api.video(name)` returns the decoded frame at the current scene time.
|
|
18
|
+
* Data resources are fetched as raw text; parsing is left to the scene's own code.
|
|
18
19
|
*/
|
|
19
20
|
export interface ClipResource {
|
|
20
21
|
type: ClipResourceType;
|
|
21
|
-
/** Lookup key for api.img() / api.video(), or FontFace family for fonts. */
|
|
22
|
+
/** Lookup key for api.img() / api.data() / api.video(), or FontFace family for fonts. */
|
|
22
23
|
name: string;
|
|
23
24
|
src: string;
|
|
24
25
|
/** Video only: source-time offset in seconds this scene starts reading from. Defaults to 0. */
|
package/dist/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAG,KAAc,CAAC;AAE/C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,mFAAmF;IACnF,KAAK,EAAE,SAAS,OAAO,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAG,KAAc,CAAC;AAE/C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,mFAAmF;IACnF,KAAK,EAAE,SAAS,OAAO,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEnE;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,yFAAyF;IACzF,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,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