@holtjs/stage 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/headless.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./types-CXsCvp1p.js";
2
- import { n as Game } from "./game-CFxS641c.js";
3
- import { a as requestHeadlessWebGpu, i as openWgpuNativeFfi, r as openDawnWebGpu } from "./renderer-webgpu-q4vdE3kA.js";
2
+ import { n as Game } from "./game-ChUlbQwx.js";
3
+ import { a as openWgpuNativeFfi, i as openDawnWebGpu, o as requestHeadlessWebGpu, r as unpremultiplyRgbaInPlace } from "./renderer-webgpu-B4AvHUEt.js";
4
4
  import { buildSceneDigest } from "./trace.js";
5
5
  // src/headless.ts
6
6
  let pngCrcTable = null;
@@ -266,7 +266,7 @@ function createHeadlessStage(options) {
266
266
  if (game.renderer.type === 2 && game.renderer.gl) {
267
267
  const gl = game.renderer.gl;
268
268
  gl.readPixels(0, 0, cw, ch, gl.RGBA, gl.UNSIGNED_BYTE, dst);
269
- return dst;
269
+ return game.transparent || primaryScene.cameras.main.transparent ? unpremultiplyRgbaInPlace(dst) : dst;
270
270
  }
271
271
  const ctx = rootCanvas.getContext("2d");
272
272
  if (!ctx) throw new Error("HeadlessStage.toRgbaInto: 2D context unavailable");
@@ -282,7 +282,7 @@ function createHeadlessStage(options) {
282
282
  const gl = game.renderer.gl;
283
283
  const out = new Uint8Array(cw * ch * 4);
284
284
  gl.readPixels(0, 0, cw, ch, gl.RGBA, gl.UNSIGNED_BYTE, out);
285
- return out;
285
+ return game.transparent || primaryScene.cameras.main.transparent ? unpremultiplyRgbaInPlace(out) : out;
286
286
  }
287
287
  const ctx = rootCanvas.getContext("2d");
288
288
  if (!ctx) throw new Error("HeadlessStage.toRgba: 2D context unavailable");
@@ -636,25 +636,35 @@ function buildFfmpegRawVideoArgs(options) {
636
636
  const h = Math.max(1, Math.round(options.height));
637
637
  const fps = Math.max(1, Math.round(options.fps));
638
638
  const inFmt = options.inputFormat ?? "rawvideo";
639
+ const wantAlpha = Boolean(options.alpha);
639
640
  const isWebm = /\.webm$/i.test(options.outputPath);
640
- const vCodec = options.videoCodec ?? (isWebm ? "libvpx-vp9" : "libx264");
641
+ const isMov = /\.mov$/i.test(options.outputPath);
642
+ const vCodec = options.videoCodec ?? (wantAlpha ? isMov ? "qtrle" : "libvpx-vp9" : isWebm ? "libvpx-vp9" : "libx264");
641
643
  const isVp9 = vCodec.includes("vp9") || vCodec.includes("vp8");
644
+ const isQtrle = vCodec === "qtrle" || vCodec === "png";
645
+ const isProres = vCodec.includes("prores");
642
646
  const args = ["-y"];
643
647
  if (inFmt === "mjpeg" || inFmt === "png") args.push("-f", "image2pipe", "-vcodec", inFmt, "-r", String(fps), "-i", "pipe:0");
644
648
  else args.push("-f", "rawvideo", "-pix_fmt", "rgba", "-s", `${w}x${h}`, "-r", String(fps), "-i", "pipe:0");
645
649
  if (options.audioWavPath) args.push("-i", options.audioWavPath);
646
650
  args.push("-c:v", vCodec);
647
- if (isVp9) args.push("-b:v", "0", "-crf", String(options.crf ?? 28), "-deadline", "realtime", "-cpu-used", "8", "-pix_fmt", options.outputPixelFormat ?? "yuv420p");
648
- else {
651
+ if (isQtrle) args.push("-pix_fmt", options.outputPixelFormat ?? (vCodec === "png" ? "rgba" : "argb"));
652
+ else if (isProres) args.push("-pix_fmt", options.outputPixelFormat ?? (wantAlpha ? "yuva444p10le" : "yuv422p10le"));
653
+ else if (isVp9) {
654
+ args.push("-b:v", "0", "-crf", String(options.crf ?? (wantAlpha ? 24 : 28)), "-deadline", "realtime", "-cpu-used", "8");
655
+ if (wantAlpha) args.push("-auto-alt-ref", "0");
656
+ args.push("-pix_fmt", options.outputPixelFormat ?? (wantAlpha ? "yuva420p" : "yuv420p"));
657
+ } else {
649
658
  if (options.preset !== "") args.push("-preset", options.preset ?? "veryfast");
650
659
  args.push("-crf", String(options.crf ?? 19), "-pix_fmt", options.outputPixelFormat ?? "yuv420p");
651
660
  }
652
661
  if (options.audioWavPath) args.push("-c:a", options.audioCodec ?? (isWebm ? "libopus" : "aac"), "-b:a", options.audioBitrate ?? "160k", "-shortest");
653
662
  if (options.extraArgs && options.extraArgs.length > 0) args.push(...options.extraArgs);
654
- if (isWebm || isVp9) {
663
+ if (isWebm || isVp9 && !isMov) {
655
664
  if (isWebm) args.push("-f", "webm");
656
665
  args.push(options.outputPath);
657
- } else args.push("-movflags", "+faststart", options.outputPath);
666
+ } else if (isMov || isQtrle || isProres) args.push(options.outputPath);
667
+ else args.push("-movflags", "+faststart", options.outputPath);
658
668
  return args;
659
669
  }
660
670
  const JPEG_ZIGZAG = new Uint8Array([
@@ -1642,8 +1652,10 @@ async function encodeVideoWithFfmpeg(stage, options) {
1642
1652
  }
1643
1653
  }
1644
1654
  const isWebm = /\.webm$/i.test(options.outputPath);
1645
- const resolvedInputFormat = options.inputFormat && options.inputFormat !== "auto" ? options.inputFormat : caps && !caps.rawvideo && caps.image2pipe ? caps.mjpegDec ? "mjpeg" : "png" : "rawvideo";
1646
- const resolvedVideoCodec = options.videoCodec ?? (isWebm ? "libvpx-vp9" : caps?.found && !caps.libx264 && caps.libvpxVp9 ? "libvpx-vp9" : "libx264");
1655
+ const isMov = /\.mov$/i.test(options.outputPath);
1656
+ const wantAlpha = options.alpha !== void 0 ? Boolean(options.alpha) : Boolean((stage.game.transparent || stage.scene.cameras.main.transparent) && (isWebm || isMov));
1657
+ const resolvedInputFormat = options.inputFormat && options.inputFormat !== "auto" ? options.inputFormat : caps && !caps.rawvideo && caps.image2pipe ? wantAlpha ? "png" : caps.mjpegDec ? "mjpeg" : "png" : "rawvideo";
1658
+ const resolvedVideoCodec = options.videoCodec ?? (wantAlpha ? isMov ? "qtrle" : "libvpx-vp9" : isWebm ? "libvpx-vp9" : caps?.found && !caps.libx264 && caps.libvpxVp9 ? "libvpx-vp9" : "libx264");
1647
1659
  const canMuxAudio = Boolean(options.audio) && (!caps?.found || Boolean(options.audioCodec) || caps.aac || caps.libopus);
1648
1660
  let tempWavPath = null;
1649
1661
  let audioWavPath;
@@ -1662,6 +1674,7 @@ async function encodeVideoWithFfmpeg(stage, options) {
1662
1674
  height: ch,
1663
1675
  fps: stage.fps,
1664
1676
  outputPath: options.outputPath,
1677
+ alpha: wantAlpha,
1665
1678
  inputFormat: resolvedInputFormat,
1666
1679
  audioWavPath,
1667
1680
  videoCodec: resolvedVideoCodec,
@@ -1820,4 +1833,314 @@ async function encodeVideoWithFfmpeg(stage, options) {
1820
1833
  } catch {}
1821
1834
  }
1822
1835
  }
1823
- export { buildFfmpegRawVideoArgs, createAudioTimeline, createHeadlessStage, createHeadlessStageAsync, encodeVideoWithFfmpeg, openDawnWebGpu, openHeadlessStage, openWgpuNativeFfi, renderStoryboard, requestHeadlessWebGpu };
1836
+ function summarizeValues(values) {
1837
+ if (values.length === 0) return {
1838
+ min: 0,
1839
+ max: 0,
1840
+ mean: 0,
1841
+ p50: 0,
1842
+ p95: 0,
1843
+ sum: 0
1844
+ };
1845
+ const sorted = [...values].sort((a, b) => a - b);
1846
+ let sum = 0;
1847
+ for (let i = 0; i < sorted.length; i++) sum += sorted[i];
1848
+ const n = sorted.length;
1849
+ const p50Idx = Math.min(n - 1, Math.floor((n - 1) * .5));
1850
+ const p95Idx = Math.min(n - 1, Math.ceil((n - 1) * .95));
1851
+ return {
1852
+ min: sorted[0],
1853
+ max: sorted[n - 1],
1854
+ mean: sum / n,
1855
+ p50: sorted[p50Idx],
1856
+ p95: sorted[p95Idx],
1857
+ sum
1858
+ };
1859
+ }
1860
+ const noop2dCtx = {
1861
+ canvas: {
1862
+ width: 1,
1863
+ height: 1
1864
+ },
1865
+ save() {},
1866
+ restore() {},
1867
+ scale() {},
1868
+ rotate() {},
1869
+ translate() {},
1870
+ transform() {},
1871
+ setTransform() {},
1872
+ resetTransform() {},
1873
+ clearRect() {},
1874
+ fillRect() {},
1875
+ strokeRect() {},
1876
+ beginPath() {},
1877
+ closePath() {},
1878
+ moveTo() {},
1879
+ lineTo() {},
1880
+ arc() {},
1881
+ arcTo() {},
1882
+ ellipse() {},
1883
+ rect() {},
1884
+ quadraticCurveTo() {},
1885
+ bezierCurveTo() {},
1886
+ fill() {},
1887
+ stroke() {},
1888
+ clip() {},
1889
+ drawImage() {},
1890
+ fillText() {},
1891
+ strokeText() {},
1892
+ measureText: (t) => ({ width: String(t).length * 8 }),
1893
+ createLinearGradient: () => ({ addColorStop() {} }),
1894
+ createRadialGradient: () => ({ addColorStop() {} }),
1895
+ createImageData: (w, h) => ({
1896
+ width: w,
1897
+ height: h,
1898
+ data: new Uint8ClampedArray(w * h * 4)
1899
+ }),
1900
+ getImageData: (_x, _y, w, h) => ({
1901
+ width: w,
1902
+ height: h,
1903
+ data: new Uint8ClampedArray(w * h * 4)
1904
+ }),
1905
+ putImageData() {}
1906
+ };
1907
+ function createZeroRasterCanvas(width, height) {
1908
+ return {
1909
+ width,
1910
+ height,
1911
+ getContext() {
1912
+ return noop2dCtx;
1913
+ }
1914
+ };
1915
+ }
1916
+ /**
1917
+ * Execute `N` deterministic zero-rasterization headless game rollouts in a single Node.js, Bun, or Deno process
1918
+ * (`stepSimOnly` / `fastForward` with a zero-overhead stub canvas — zero pixel rasterization or GPU driver required!),
1919
+ * returning per-run results and aggregated `min / max / mean / p50 / p95 / sum` balance statistics.
1920
+ */
1921
+ function runHeadlessRollouts(options) {
1922
+ const seeds = options.seeds;
1923
+ const runCount = Math.max(1, Math.floor(options.runs ?? seeds?.length ?? 16));
1924
+ const baseSeed = options.baseSeed ?? 1;
1925
+ const ticksPerRun = Math.max(1, Math.floor(options.ticksPerRun ?? 1800));
1926
+ const fps = Math.max(1, Math.min(240, options.fps ?? 60));
1927
+ const width = Math.max(1, Math.round(options.width ?? 1280));
1928
+ const height = Math.max(1, Math.round(options.height ?? 720));
1929
+ const t0 = performance.now();
1930
+ const results = [];
1931
+ const metricBuckets = /* @__PURE__ */ new Map();
1932
+ let totalTicks = 0;
1933
+ for (let r = 0; r < runCount; r++) {
1934
+ const seed = seeds && r < seeds.length ? seeds[r] : baseSeed + r;
1935
+ const stage = createHeadlessStage({
1936
+ createCanvas: createZeroRasterCanvas,
1937
+ width,
1938
+ height,
1939
+ fps,
1940
+ scene: options.createScene(r, seed)
1941
+ });
1942
+ let executedTicks = 0;
1943
+ try {
1944
+ if (options.onTick) for (let t = 0; t < ticksPerRun; t++) {
1945
+ if (options.onTick(stage, t, r, seed) === false) break;
1946
+ stage.fastForward(1);
1947
+ executedTicks++;
1948
+ }
1949
+ else {
1950
+ stage.fastForward(ticksPerRun);
1951
+ executedTicks = ticksPerRun;
1952
+ }
1953
+ totalTicks += executedTicks;
1954
+ const snap = stage.game.clock.snapshot();
1955
+ const metrics = options.extractMetrics(stage.scene, snap, r, seed);
1956
+ for (const key of Object.keys(metrics)) {
1957
+ let arr = metricBuckets.get(key);
1958
+ if (!arr) {
1959
+ arr = [];
1960
+ metricBuckets.set(key, arr);
1961
+ }
1962
+ arr.push(Number(metrics[key]) || 0);
1963
+ }
1964
+ results.push({
1965
+ runIndex: r,
1966
+ seed,
1967
+ ticks: executedTicks,
1968
+ simTimeMs: snap.simTimeMs,
1969
+ metrics
1970
+ });
1971
+ } finally {
1972
+ stage.destroy();
1973
+ }
1974
+ }
1975
+ const elapsedMs = Math.max(.001, performance.now() - t0);
1976
+ const summaryObj = {};
1977
+ for (const [key, vals] of metricBuckets.entries()) summaryObj[key] = summarizeValues(vals);
1978
+ return {
1979
+ runsCompleted: results.length,
1980
+ totalTicks,
1981
+ elapsedMs,
1982
+ ticksPerSecond: Math.round(totalTicks / elapsedMs * 1e3),
1983
+ summary: summaryObj,
1984
+ results
1985
+ };
1986
+ }
1987
+ /**
1988
+ * Compile a declarative multi-cut + transparent Alpha Overlay + voiceover/BGM ducking specification
1989
+ * into a deterministic single-pass `ffmpeg` `filter_complex` argument array.
1990
+ */
1991
+ function buildFfmpegCompositeArgs(options) {
1992
+ if (!options.cuts || options.cuts.length === 0) throw new Error("buildFfmpegCompositeArgs: cuts array must contain at least one video cut");
1993
+ const w = Math.max(2, Math.round((options.width ?? 1280) / 2) * 2);
1994
+ const h = Math.max(2, Math.round((options.height ?? 720) / 2) * 2);
1995
+ const fps = Math.max(1, Math.round(options.fps ?? 60));
1996
+ const isWebm = /\.webm$/i.test(options.outputPath);
1997
+ const vCodec = options.videoCodec ?? (isWebm ? "libvpx-vp9" : "libx264");
1998
+ const isVp9 = vCodec.includes("vp9") || vCodec.includes("vp8");
1999
+ const args = ["-y"];
2000
+ const filters = [];
2001
+ let nextInputIdx = 0;
2002
+ const cutLabels = [];
2003
+ for (let i = 0; i < options.cuts.length; i++) {
2004
+ const cut = options.cuts[i];
2005
+ if (cut.startSec !== void 0 && cut.startSec > 0) args.push("-ss", cut.startSec.toFixed(3));
2006
+ if (cut.durationSec !== void 0 && cut.durationSec > 0) args.push("-t", cut.durationSec.toFixed(3));
2007
+ if (/\.png$|\.jpg$|\.jpeg$|\.webp$/i.test(cut.path) && cut.durationSec) args.push("-loop", "1");
2008
+ args.push("-i", cut.path);
2009
+ const idx = nextInputIdx++;
2010
+ const z = Math.max(1, cut.zoom ?? 1);
2011
+ const cy = Math.max(0, Math.min(1, cut.cropY ?? .5));
2012
+ const sw = Math.max(w, Math.round(w * z / 2) * 2);
2013
+ const sh = Math.max(h, Math.round(h * z / 2) * 2);
2014
+ const cropExpr = z > 1.0001 ? `crop=${w}:${h}:(iw-${w})/2:(ih-${h})*${cy.toFixed(4)}` : `crop=${w}:${h}`;
2015
+ const lbl = `[vcut${i}]`;
2016
+ filters.push(`[${idx}:v]scale=${sw}:${sh}:force_original_aspect_ratio=increase,${cropExpr},fps=${fps},setsar=1,format=yuv420p,setpts=PTS-STARTPTS${lbl}`);
2017
+ cutLabels.push(lbl);
2018
+ }
2019
+ let curVideo = cutLabels[0];
2020
+ if (cutLabels.length > 1) {
2021
+ filters.push(`${cutLabels.join("")}concat=n=${cutLabels.length}:v=1:a=0[vcat]`);
2022
+ curVideo = "[vcat]";
2023
+ }
2024
+ const overlays = options.overlays ?? [];
2025
+ for (let j = 0; j < overlays.length; j++) {
2026
+ const ov = overlays[j];
2027
+ const startSec = Math.max(0, ov.startSec ?? 0);
2028
+ if (startSec > 0) args.push("-itsoffset", startSec.toFixed(3));
2029
+ if (/\.webm$/i.test(ov.path)) args.push("-c:v", "libvpx-vp9");
2030
+ else if (/\.png$/i.test(ov.path)) args.push("-loop", "1");
2031
+ args.push("-i", ov.path);
2032
+ const idx = nextInputIdx++;
2033
+ const ox = Math.round(ov.x ?? 0);
2034
+ const oy = Math.round(ov.y ?? 0);
2035
+ let enableOpt = "";
2036
+ if (ov.startSec !== void 0 && ov.endSec !== void 0) enableOpt = `:enable='between(t,${ov.startSec.toFixed(3)},${ov.endSec.toFixed(3)})'`;
2037
+ else if (ov.startSec !== void 0 && ov.startSec > 0) enableOpt = `:enable='gte(t,${ov.startSec.toFixed(3)})'`;
2038
+ else if (ov.endSec !== void 0) enableOpt = `:enable='lte(t,${ov.endSec.toFixed(3)})'`;
2039
+ const nextLbl = `[vov${j}]`;
2040
+ filters.push(`${curVideo}[${idx}:v]overlay=${ox}:${oy}:format=auto:eof_action=pass${enableOpt}${nextLbl}`);
2041
+ curVideo = nextLbl;
2042
+ }
2043
+ filters.push(`${curVideo}format=yuv420p[vout]`);
2044
+ const voTrackLabels = [];
2045
+ if (options.voiceoverPath) {
2046
+ args.push("-i", options.voiceoverPath);
2047
+ const idx = nextInputIdx++;
2048
+ const gain = options.voiceoverGain ?? 1;
2049
+ filters.push(`[${idx}:a]aresample=44100,aformat=sample_fmts=fltp:channel_layouts=stereo,volume=${gain.toFixed(3)}[avofull]`);
2050
+ voTrackLabels.push("[avofull]");
2051
+ }
2052
+ const segs = options.voiceoverSegments ?? [];
2053
+ for (let k = 0; k < segs.length; k++) {
2054
+ const seg = segs[k];
2055
+ args.push("-i", seg.path);
2056
+ const idx = nextInputIdx++;
2057
+ const delayMs = Math.max(0, Math.round(seg.startSec * 1e3));
2058
+ const gain = seg.gain ?? 1;
2059
+ const lbl = `[aseg${k}]`;
2060
+ filters.push(`[${idx}:a]aresample=44100,aformat=sample_fmts=fltp:channel_layouts=stereo,volume=${gain.toFixed(3)},adelay=${delayMs}|${delayMs}${lbl}`);
2061
+ voTrackLabels.push(lbl);
2062
+ }
2063
+ let voBus = null;
2064
+ if (voTrackLabels.length === 1) {
2065
+ filters.push(`${voTrackLabels[0]}apad[avo]`);
2066
+ voBus = "[avo]";
2067
+ } else if (voTrackLabels.length > 1) {
2068
+ filters.push(`${voTrackLabels.join("")}amix=inputs=${voTrackLabels.length}:duration=longest:dropout_transition=0:normalize=0,apad[avo]`);
2069
+ voBus = "[avo]";
2070
+ }
2071
+ let audioOut = null;
2072
+ if (options.bgmPath) {
2073
+ args.push("-stream_loop", "-1", "-i", options.bgmPath);
2074
+ const bgmIdx = nextInputIdx++;
2075
+ const bgmVol = Math.max(0, options.bgmVolume ?? .16);
2076
+ filters.push(`[${bgmIdx}:a]aresample=44100,aformat=sample_fmts=fltp:channel_layouts=stereo,volume=${bgmVol.toFixed(3)}[abgm]`);
2077
+ if (voBus) {
2078
+ if (options.ducking !== false) filters.push(`${voBus}asplit=2[avomain][avosc]`, `[abgm][avosc]sidechaincompress=threshold=0.03:ratio=6:attack=25:release=320[abgmduck]`, `[avomain][abgmduck]amix=inputs=2:duration=first:dropout_transition=0:normalize=0[aout]`);
2079
+ else filters.push(`${voBus}[abgm]amix=inputs=2:duration=first:dropout_transition=0:normalize=0[aout]`);
2080
+ audioOut = "[aout]";
2081
+ } else audioOut = "[abgm]";
2082
+ } else if (voBus) audioOut = voBus;
2083
+ args.push("-filter_complex", filters.join(";"), "-map", "[vout]");
2084
+ if (audioOut) args.push("-map", audioOut);
2085
+ if (options.totalDurationSec !== void 0 && options.totalDurationSec > 0) args.push("-t", options.totalDurationSec.toFixed(3));
2086
+ args.push("-c:v", vCodec);
2087
+ if (isVp9) args.push("-b:v", "0", "-crf", String(options.crf ?? 28), "-deadline", "good", "-cpu-used", "4", "-pix_fmt", "yuv420p");
2088
+ else {
2089
+ if (options.preset !== "") args.push("-preset", options.preset ?? "veryfast");
2090
+ args.push("-crf", String(options.crf ?? 19), "-pix_fmt", "yuv420p");
2091
+ }
2092
+ if (audioOut) args.push("-c:a", isWebm ? "libopus" : "aac", "-b:a", options.audioBitrate ?? "192k", "-shortest");
2093
+ if (isWebm || isVp9) {
2094
+ if (isWebm) args.push("-f", "webm");
2095
+ args.push(options.outputPath);
2096
+ } else args.push("-movflags", "+faststart", options.outputPath);
2097
+ return args;
2098
+ }
2099
+ /**
2100
+ * Execute a single-pass `ffmpeg` layer composite combining external video cuts, transparent `@holtjs/stage`
2101
+ * Alpha Overlays (`yuva420p` WebM / `qtrle` MOV / PNG), sample-accurate voiceover segments, and auto-ducked BGM.
2102
+ */
2103
+ async function composeVideoLayers(options) {
2104
+ const cp = await dynamicImportHeadless("node:child_process");
2105
+ const fs = await dynamicImportHeadless("node:fs");
2106
+ const os = await dynamicImportHeadless("node:os");
2107
+ const path = await dynamicImportHeadless("node:path");
2108
+ let ffmpegBin = options.ffmpegPath ?? "ffmpeg";
2109
+ if (!options.ffmpegPath) {
2110
+ const caps = probeFfmpegCapabilities(cp, ffmpegBin);
2111
+ if (caps && !caps.found) {
2112
+ const pwBin = discoverPlaywrightFfmpeg(fs, os, path);
2113
+ if (pwBin) ffmpegBin = pwBin;
2114
+ }
2115
+ }
2116
+ const ffArgs = buildFfmpegCompositeArgs(options);
2117
+ const w = Math.max(2, Math.round((options.width ?? 1280) / 2) * 2);
2118
+ const h = Math.max(2, Math.round((options.height ?? 720) / 2) * 2);
2119
+ const fps = Math.max(1, Math.round(options.fps ?? 60));
2120
+ await new Promise((resolve, reject) => {
2121
+ const proc = cp.spawn(ffmpegBin, ffArgs, { stdio: [
2122
+ "ignore",
2123
+ "ignore",
2124
+ "pipe"
2125
+ ] });
2126
+ let stderr = "";
2127
+ proc.stderr.on("data", (chunk) => {
2128
+ stderr += chunk.toString();
2129
+ });
2130
+ proc.on("error", reject);
2131
+ proc.on("close", (code) => {
2132
+ if (code === 0) resolve();
2133
+ else reject(/* @__PURE__ */ new Error(`composeVideoLayers: ffmpeg exited with code ${String(code)}:\n${stderr}`));
2134
+ });
2135
+ });
2136
+ return {
2137
+ outputPath: options.outputPath,
2138
+ width: w,
2139
+ height: h,
2140
+ fps,
2141
+ cutsCount: options.cuts.length,
2142
+ overlaysCount: (options.overlays ?? []).length,
2143
+ ffmpegArgs: ffArgs
2144
+ };
2145
+ }
2146
+ export { buildFfmpegCompositeArgs, buildFfmpegRawVideoArgs, composeVideoLayers, createAudioTimeline, createHeadlessStage, createHeadlessStageAsync, encodeVideoWithFfmpeg, openDawnWebGpu, openHeadlessStage, openWgpuNativeFfi, renderStoryboard, requestHeadlessWebGpu, runHeadlessRollouts, unpremultiplyRgbaInPlace };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { $n as Camera, $t as HeadlessWebGpuOptions, A as createInputRecorder, An as Graphics, At as SceneDigestNode, Bn as RectClipMask, Bt as InputPlugin, C as RecordedInputEntry, Cn as DisplayObjectType, D as TimelineClickOptions, Dn as DrawStreamOptions, Dt as SceneDigest, E as StagePlugin, En as DrawStreamObject, Fn as MsdfIconObject, Ft as SceneDigestSurfaceSource, Gn as ShapeBatchStyleDefaults, Gt as RendererWebGpuOptions, Hn as SceneHostLike, Ht as Pointer, In as NineSliceObject, It as SceneDigestSurfaces, Jn as SpritePlayOptions, Jt as WebGpuCanvasContextLike, Kn as SpriteAnimEventListener, Kt as RequestWebGpuOptions, Ln as PanelObject, Lt as buildSceneDigest, M as createInputTimeline, Mn as InstancedBatchObject, Mt as SceneDigestOverlayStats, Nn as InstancedColumns, Nt as SceneDigestSandbox, O as TimelineDragOptions, On as DrawStreamSpriteOptions, Ot as SceneDigestActiveFocus, Pn as MsdfIconConfig, Pt as SceneDigestSurfaceEntry, Qn as TileSpriteObject, Qt as HeadlessWebGpuHandle, Rn as PanelOpenSide, Rt as sanitizeTrackToken, S as InputTimelinePlugin, Sn as DisplayObject, T as StageKernel, Tn as DrawStreamBulkView, Un as ShapeBatchColumns, Ut as PointerSample, Vn as RectangleObject, Vt as KeyboardPlugin, Wn as ShapeBatchObject, Wt as RendererWebGpu, Xn as TextObject, Xt as requestWebGpuDevice, Yn as SyncAttachmentOptions, Yt as WebGpuDeviceLike, Zn as TextStyleConfig, Zt as HeadlessWebGpuBackend, _ as ActionMap, _n as CustomPassCallback, a as GameLoop, an as Renderer2D, b as InputTargetSpec, bn as DirectionalPlayOptions, c as LoaderPlugin, cn as RendererStats, d as SceneCtor, dn as AnchorPose2D, en as OpenDawnWebGpuOptions, er as CameraFollowOptions, f as SceneInput, fn as BindEquipmentOptions, g as ViewportFitResult, gn as ContainerFiltersShim, h as StageRenderer, hn as Container, i as GameConfig$1, in as requestHeadlessWebGpu, j as createInputReplay, jn as ImageObject, jt as SceneDigestOptions, k as TimelineKeyOptions, kn as EquipmentBinding, kt as SceneDigestEngineSandbox, l as ScaleManager, ln as Stage2DCustomImageHandler, m as SceneManager, mn as Bob$1, n as EngineClockSnapshot, nn as openDawnWebGpu, nr as HiDpiScaleLike, o as GameObjectFactory, on as RendererGl, p as SceneLifecycleStats, pn as BlitterObject, qn as SpriteObject, qt as WebGpuBootstrapResult, r as Game, rn as openWgpuNativeFfi, s as JsonCache, sn as RendererGlOptions, t as EngineClock, tn as OpenWgpuNativeFfiOptions, tr as HiDpiConfigureOptions, u as Scene, un as StageRenderTarget, v as InputProvider, vn as CustomPassObject, w as StageInputEvent, wn as DisplaySemantics, x as InputTimelineOptions, xn as DisplayList, y as InputRecorderPlugin, yn as CustomPassOptions, zn as PanelStyleConfig, zt as InputConfig } from "./game-Ce35GTH4.js";
1
+ import { $n as PanelOpenSide, $t as InputConfig, A as RecordedInputEntry, An as Container, B as TimelineDragOptions, Bn as DrawStreamBulkView, C as CameraPanOptions, Cn as RendererStats, D as InputTargetSpec, Dn as BindEquipmentOptions, E as InputRecorderPlugin, En as AnchorPose2D, F as RollbackStats, Fn as DirectionalPlayOptions, G as createInputTimeline, Gn as Graphics, Gt as SceneDigestOptions, H as createCameraDirector, Hn as DrawStreamOptions, Ht as SceneDigestActiveFocus, I as StageInputEvent, In as DisplayList, Jn as InstancedColumns, Jt as SceneDigestSurfaceEntry, K as createRollbackSession, Kn as ImageObject, Kt as SceneDigestOverlayStats, L as StageKernel, Ln as DisplayObject, M as RollbackSession, Mn as CustomPassCallback, N as RollbackSessionOptions, Nn as CustomPassObject, O as InputTimelineOptions, On as BlitterObject, P as RollbackStateCodec, Pn as CustomPassOptions, Qn as PanelObject, Qt as sanitizeTrackToken, R as StagePlugin, Rn as DisplayObjectType, S as CameraFollowCueOptions, Sn as RendererGlOptions, T as InputProvider, Tn as StageRenderTarget, U as createInputRecorder, Un as DrawStreamSpriteOptions, Ut as SceneDigestEngineSandbox, V as TimelineKeyOptions, Vn as DrawStreamObject, Vt as SceneDigest, W as createInputReplay, Wn as EquipmentBinding, Wt as SceneDigestNode, Xn as MsdfIconObject, Xt as SceneDigestSurfaces, Yn as MsdfIconConfig, Yt as SceneDigestSurfaceSource, Zn as NineSliceObject, Zt as buildSceneDigest, _ as ActionMap, _n as openDawnWebGpu, _r as HiDpiScaleLike, a as GameLoop, an as RendererWebGpuOptions, ar as ShapeBatchObject, b as CameraDirectorPlugin, bn as Renderer2D, c as LoaderPlugin, cn as WebGpuCanvasContextLike, cr as SpriteObject, d as SceneCtor, dn as unpremultiplyRgbaInPlace, dr as TextObject, en as InputPlugin, er as PanelStyleConfig, f as SceneInput, fn as HeadlessWebGpuBackend, fr as TextStyleConfig, g as ViewportFitResult, gn as OpenWgpuNativeFfiOptions, gr as HiDpiConfigureOptions, h as StageRenderer, hn as OpenDawnWebGpuOptions, hr as CameraFollowOptions, i as GameConfig$1, in as RendererWebGpu, ir as ShapeBatchColumns, j as RollbackResult, jn as ContainerFiltersShim, k as InputTimelinePlugin, kn as Bob$1, l as ScaleManager, ln as WebGpuDeviceLike, lr as SpritePlayOptions, m as SceneManager, mn as HeadlessWebGpuOptions, mr as Camera, n as EngineClockSnapshot, nn as Pointer, nr as RectangleObject, o as GameObjectFactory, on as RequestWebGpuOptions, or as ShapeBatchStyleDefaults, p as SceneLifecycleStats, pn as HeadlessWebGpuHandle, pr as TileSpriteObject, qn as InstancedBatchObject, qt as SceneDigestSandbox, r as Game, rn as PointerSample, rr as SceneHostLike, s as JsonCache, sn as WebGpuBootstrapResult, sr as SpriteAnimEventListener, t as EngineClock, tn as KeyboardPlugin, tr as RectClipMask, u as Scene, un as requestWebGpuDevice, ur as SyncAttachmentOptions, v as CameraCutOptions, vn as openWgpuNativeFfi, w as CameraSpotlightOptions, wn as Stage2DCustomImageHandler, x as CameraDirectorTarget, xn as RendererGl, y as CameraDirectorOptions, yn as requestHeadlessWebGpu, z as TimelineClickOptions, zn as DisplaySemantics } from "./game-BrYrde7y.js";
2
2
  import { A as FilterModeValue, B as WEBGL, C as AUTO, D as CANVAS, E as BlendModes, F as Scale, G as packColorAbgr, H as WHITE_RGB, I as ScaleMode, K as parseColor, L as Scenes, M as Matrix2D, N as Rect2D, O as EventEmitter, P as RgbaColor, R as TintMode, S as TextureSource, T as BlendMode, U as WorldView2D, V as WEBGPU, W as createMatrix2D, _ as SpriteSheetConfig, a as AtlasClipRule, b as TextureImageSource, c as GenerateFrameNamesConfig, d as AtlasJsonLike, f as CanvasTexture, g as GlTextureHost, h as FrameExtraMeta, i as AtlasAutoAnimOptions, j as HEX_MASK, k as FilterMode, l as GenerateFrameNumbersConfig, m as FrameAnchorTuple, n as AnimationFrameInput, o as CompiledAnimationFrame, p as Frame, q as rgbToCss, r as AnimationManager, s as DirectionalAnimGroup, t as AnimationConfig, u as StageAnimation, v as Texture, w as BLACK_RGB, x as TextureManager, y as TextureImageOptions, z as TintModes } from "./anims-BOvaKn6w.js";
3
+ import { LocomotionFeel, LocomotionFeelInput, LocomotionFeelOptions, LocomotionFeelSample } from "./particles.js";
3
4
  import { FlattenedFlexNode, FlattenedFlexTree, FlexAlign, FlexContainerSpec, FlexDir, FlexIconSpec, FlexItemRect, FlexItemSpec, FlexJustify, FlexNodeSpec, FlexPadding, FlexPanelStyle, FlexResult, FlexTextSpec, MountFlexUiOptions, MountedFlexUi, WrapContainerSpec, WrapItemRect, WrapItemSpec, WrapJustify, WrapResult, computeFlexLayout, computeWrapLayout, flattenFlexTree, mountFlexUi, resolvePadding } from "./flex.js";
4
5
  import { a as SpringHandle, c as TweenManager, i as Easings, l as TweenOptions, n as EasingFn, o as SpringOptions, r as EasingName, s as TweenHandle, t as DisposableOwner, u as TweenStats } from "./tween-BiF1FUvc.js";
5
6
  import { a as ScriptOptions, i as ScriptHandle, o as ScriptScheduler, r as ScriptContext, s as ScriptStats, t as CoroutineGenerator } from "./coroutine-DLgJumtD.js";
@@ -332,4 +333,4 @@ export declare const Stage: {
332
333
  };
333
334
  };
334
335
  };
335
- export { AUTO, ActionMap, type AnchorPose2D, type AnimationConfig, type AnimationFrameInput, AnimationManager, type AtlasAutoAnimOptions, type AtlasClipRule, type AtlasJsonLike, BLACK_RGB, type BindEquipmentOptions, type BlendMode, BlendModes, BlitterObject, type Bob$1 as Bob, CANVAS, Camera, type CameraFollowOptions, CanvasTexture, type CompiledAnimationFrame, Container, type ContainerFiltersShim, type CoroutineGenerator, type CustomPassCallback, CustomPassObject, type CustomPassOptions, type DirectionalAnimGroup, type DirectionalPlayOptions, DisplayList, DisplayObject, type DisplayObjectType, type DisplaySemantics, type DisposableOwner, type DrawStreamBulkView, DrawStreamObject, type DrawStreamOptions, type DrawStreamSpriteOptions, type EasingFn, type EasingName, Easings, EngineClock, type EngineClockSnapshot, type EquipmentBinding, EventEmitter, FilterMode, type FilterModeValue, type FlattenedFlexNode, type FlattenedFlexTree, type FlexAlign, type FlexContainerSpec, type FlexDir, type FlexIconSpec, type FlexItemRect, type FlexItemSpec, type FlexJustify, type FlexNodeSpec, type FlexPadding, type FlexPanelStyle, type FlexResult, type FlexTextSpec, Frame, type FrameAnchorTuple, type FrameExtraMeta, Game, type GameConfig$1 as GameConfig, GameLoop, GameObjectFactory, type GenerateFrameNamesConfig, type GenerateFrameNumbersConfig, type GlTextureHost, Graphics, HEX_MASK, type HeadlessWebGpuBackend, type HeadlessWebGpuHandle, type HeadlessWebGpuOptions, type HiDpiConfigureOptions, type HiDpiScaleLike, ImageObject, type InputConfig, InputPlugin, type InputProvider, type InputRecorderPlugin, type InputTargetSpec, type InputTimelineOptions, type InputTimelinePlugin, InstancedBatchObject, type InstancedColumns, type JoystickDpad, type JoystickDpadOptions, type JoystickState, type JoystickVector, type JoystickViewport, type JoystickZone, type JoystickZonePredicate, type JoystickZoneRect, JsonCache, KeyboardPlugin, LoaderPlugin, type Matrix2D, type MountFlexUiOptions, type MountedFlexUi, type MsdfIconConfig, MsdfIconObject, NineSliceObject, type OpenDawnWebGpuOptions, type OpenWgpuNativeFfiOptions, PanelObject, type PanelOpenSide, type PanelStyleConfig, Pointer, type PointerSample, type RecordedInputEntry, type Rect2D, type RectClipMask, RectangleObject, Renderer2D, RendererGl, type RendererGlOptions, type RendererStats, RendererWebGpu, type RendererWebGpuOptions, type RequestWebGpuOptions, type RgbaColor, SURFACE_BAND, Scale, ScaleManager, type ScaleMode, Scene, type SceneCtor, type SceneDigest, type SceneDigestActiveFocus, type SceneDigestEngineSandbox, type SceneDigestNode, type SceneDigestOptions, type SceneDigestOverlayStats, type SceneDigestSandbox, type SceneDigestSurfaceEntry, type SceneDigestSurfaceSource, type SceneDigestSurfaces, type SceneHostLike, type SceneInput, type SceneLifecycleStats, SceneManager, Scenes, type ScriptContext, type ScriptHandle, type ScriptOptions, ScriptScheduler, type ScriptStats, type ShapeBatchColumns, ShapeBatchObject, type ShapeBatchStyleDefaults, type SpringHandle, type SpringOptions, type SpriteAnimEventListener, SpriteObject, type SpritePlayOptions, type SpriteSheetConfig, Stage as default, type Stage2DCustomImageHandler, type StageAnimation, type StageInputEvent, StageKernel, type StagePlugin, type StageRenderTarget, type StageRenderer, type SurfaceBand, type SurfaceBandName, type SurfaceBarrier, type SurfaceCancelContext, type SurfaceCancelDispatchResult, type SurfaceCancelResult, type SurfaceDomEntry, type SurfaceFocusContext, type SurfaceFocusDispatchResult, type SurfaceFocusResult, type SurfaceKeyContext, type SurfaceKeyDispatchResult, type SurfaceKeyResult, type SurfaceNodeInfo, type SurfaceNodeInput, type SurfaceScope, type SurfaceTree, type SyncAttachmentOptions, TextObject, type TextStyleConfig, Texture, type TextureImageOptions, type TextureImageSource, TextureManager, TextureSource, TileSpriteObject, type TimelineClickOptions, type TimelineDragOptions, type TimelineKeyOptions, type TintMode, TintModes, type TweenHandle, TweenManager, type TweenOptions, type TweenStats, type ViewportFitResult, VirtualJoystick, type VirtualJoystickMode, type VirtualJoystickOptions, type VirtualJoystickStyle, WEBGL, WEBGPU, WHITE_RGB, type WebGpuBootstrapResult, type WebGpuCanvasContextLike, type WebGpuDeviceLike, type WorldView2D, type WrapContainerSpec, type WrapItemRect, type WrapItemSpec, type WrapJustify, type WrapResult, buildSceneDigest, clampJoystickOrigin, computeFlexLayout, computeJoystickVector, computeSurfaceDomZ, computeWrapLayout, createInputRecorder, createInputReplay, createInputTimeline, createMatrix2D, createSurfaceTree, flattenFlexTree, isInJoystickZone, mountFlexUi, openDawnWebGpu, openWgpuNativeFfi, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestHeadlessWebGpu, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ };
336
+ export { AUTO, ActionMap, type AnchorPose2D, type AnimationConfig, type AnimationFrameInput, AnimationManager, type AtlasAutoAnimOptions, type AtlasClipRule, type AtlasJsonLike, BLACK_RGB, type BindEquipmentOptions, type BlendMode, BlendModes, BlitterObject, type Bob$1 as Bob, CANVAS, Camera, type CameraCutOptions, type CameraDirectorOptions, type CameraDirectorPlugin, type CameraDirectorTarget, type CameraFollowCueOptions, type CameraFollowOptions, type CameraPanOptions, type CameraSpotlightOptions, CanvasTexture, type CompiledAnimationFrame, Container, type ContainerFiltersShim, type CoroutineGenerator, type CustomPassCallback, CustomPassObject, type CustomPassOptions, type DirectionalAnimGroup, type DirectionalPlayOptions, DisplayList, DisplayObject, type DisplayObjectType, type DisplaySemantics, type DisposableOwner, type DrawStreamBulkView, DrawStreamObject, type DrawStreamOptions, type DrawStreamSpriteOptions, type EasingFn, type EasingName, Easings, EngineClock, type EngineClockSnapshot, type EquipmentBinding, EventEmitter, FilterMode, type FilterModeValue, type FlattenedFlexNode, type FlattenedFlexTree, type FlexAlign, type FlexContainerSpec, type FlexDir, type FlexIconSpec, type FlexItemRect, type FlexItemSpec, type FlexJustify, type FlexNodeSpec, type FlexPadding, type FlexPanelStyle, type FlexResult, type FlexTextSpec, Frame, type FrameAnchorTuple, type FrameExtraMeta, Game, type GameConfig$1 as GameConfig, GameLoop, GameObjectFactory, type GenerateFrameNamesConfig, type GenerateFrameNumbersConfig, type GlTextureHost, Graphics, HEX_MASK, type HeadlessWebGpuBackend, type HeadlessWebGpuHandle, type HeadlessWebGpuOptions, type HiDpiConfigureOptions, type HiDpiScaleLike, ImageObject, type InputConfig, InputPlugin, type InputProvider, type InputRecorderPlugin, type InputTargetSpec, type InputTimelineOptions, type InputTimelinePlugin, InstancedBatchObject, type InstancedColumns, type JoystickDpad, type JoystickDpadOptions, type JoystickState, type JoystickVector, type JoystickViewport, type JoystickZone, type JoystickZonePredicate, type JoystickZoneRect, JsonCache, KeyboardPlugin, LoaderPlugin, LocomotionFeel, type LocomotionFeelInput, type LocomotionFeelOptions, type LocomotionFeelSample, type Matrix2D, type MountFlexUiOptions, type MountedFlexUi, type MsdfIconConfig, MsdfIconObject, NineSliceObject, type OpenDawnWebGpuOptions, type OpenWgpuNativeFfiOptions, PanelObject, type PanelOpenSide, type PanelStyleConfig, Pointer, type PointerSample, type RecordedInputEntry, type Rect2D, type RectClipMask, RectangleObject, Renderer2D, RendererGl, type RendererGlOptions, type RendererStats, RendererWebGpu, type RendererWebGpuOptions, type RequestWebGpuOptions, type RgbaColor, type RollbackResult, RollbackSession, type RollbackSessionOptions, type RollbackStateCodec, type RollbackStats, SURFACE_BAND, Scale, ScaleManager, type ScaleMode, Scene, type SceneCtor, type SceneDigest, type SceneDigestActiveFocus, type SceneDigestEngineSandbox, type SceneDigestNode, type SceneDigestOptions, type SceneDigestOverlayStats, type SceneDigestSandbox, type SceneDigestSurfaceEntry, type SceneDigestSurfaceSource, type SceneDigestSurfaces, type SceneHostLike, type SceneInput, type SceneLifecycleStats, SceneManager, Scenes, type ScriptContext, type ScriptHandle, type ScriptOptions, ScriptScheduler, type ScriptStats, type ShapeBatchColumns, ShapeBatchObject, type ShapeBatchStyleDefaults, type SpringHandle, type SpringOptions, type SpriteAnimEventListener, SpriteObject, type SpritePlayOptions, type SpriteSheetConfig, Stage as default, type Stage2DCustomImageHandler, type StageAnimation, type StageInputEvent, StageKernel, type StagePlugin, type StageRenderTarget, type StageRenderer, type SurfaceBand, type SurfaceBandName, type SurfaceBarrier, type SurfaceCancelContext, type SurfaceCancelDispatchResult, type SurfaceCancelResult, type SurfaceDomEntry, type SurfaceFocusContext, type SurfaceFocusDispatchResult, type SurfaceFocusResult, type SurfaceKeyContext, type SurfaceKeyDispatchResult, type SurfaceKeyResult, type SurfaceNodeInfo, type SurfaceNodeInput, type SurfaceScope, type SurfaceTree, type SyncAttachmentOptions, TextObject, type TextStyleConfig, Texture, type TextureImageOptions, type TextureImageSource, TextureManager, TextureSource, TileSpriteObject, type TimelineClickOptions, type TimelineDragOptions, type TimelineKeyOptions, type TintMode, TintModes, type TweenHandle, TweenManager, type TweenOptions, type TweenStats, type ViewportFitResult, VirtualJoystick, type VirtualJoystickMode, type VirtualJoystickOptions, type VirtualJoystickStyle, WEBGL, WEBGPU, WHITE_RGB, type WebGpuBootstrapResult, type WebGpuCanvasContextLike, type WebGpuDeviceLike, type WorldView2D, type WrapContainerSpec, type WrapItemRect, type WrapItemSpec, type WrapJustify, type WrapResult, buildSceneDigest, clampJoystickOrigin, computeFlexLayout, computeJoystickVector, computeSurfaceDomZ, computeWrapLayout, createCameraDirector, createInputRecorder, createInputReplay, createInputTimeline, createMatrix2D, createRollbackSession, createSurfaceTree, flattenFlexTree, isInJoystickZone, mountFlexUi, openDawnWebGpu, openWgpuNativeFfi, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestHeadlessWebGpu, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ, unpremultiplyRgbaInPlace };
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { _ as rgbToCss, a as EventEmitter, c as Scale, d as WEBGL, f as WEBGPU, g as parseColor, h as packColorAbgr, i as CANVAS, l as Scenes, m as createMatrix2D, n as BLACK_RGB, o as FilterMode, p as WHITE_RGB, r as BlendModes, s as HEX_MASK, t as AUTO, u as TintModes } from "./types-CXsCvp1p.js";
2
- import { _ as CanvasTexture, a as JsonCache, b as TextureManager, c as Scene, d as KeyboardPlugin, f as Pointer, g as SdfPanelBatcher, h as MsdfIconBatcher, i as GameObjectFactory, l as SceneManager, m as PixelAaBatcher, n as Game, o as LoaderPlugin, p as RendererGl, r as GameLoop, s as ScaleManager, t as EngineClock, u as InputPlugin, v as Frame, x as TextureSource, y as Texture } from "./game-CFxS641c.js";
2
+ import { _ as CanvasTexture, a as JsonCache, b as TextureManager, c as Scene, d as KeyboardPlugin, f as Pointer, g as SdfPanelBatcher, h as MsdfIconBatcher, i as GameObjectFactory, l as SceneManager, m as PixelAaBatcher, n as Game, o as LoaderPlugin, p as RendererGl, r as GameLoop, s as ScaleManager, t as EngineClock, u as InputPlugin, v as Frame, x as TextureSource, y as Texture } from "./game-ChUlbQwx.js";
3
3
  import { AnimationManager } from "./anims.js";
4
- import { a as requestHeadlessWebGpu, i as openWgpuNativeFfi, n as requestWebGpuDevice, o as Renderer2D, r as openDawnWebGpu, s as Camera, t as RendererWebGpu } from "./renderer-webgpu-q4vdE3kA.js";
4
+ import { a as openWgpuNativeFfi, c as Camera, i as openDawnWebGpu, n as requestWebGpuDevice, o as requestHeadlessWebGpu, r as unpremultiplyRgbaInPlace, s as Renderer2D, t as RendererWebGpu } from "./renderer-webgpu-B4AvHUEt.js";
5
5
  import { _ as TileSpriteObject, a as DisplayObject, c as ImageObject, d as NineSliceObject, f as PanelObject, g as TextObject, h as SpriteObject, i as DisplayList, l as InstancedBatchObject, m as ShapeBatchObject, n as Container, o as DrawStreamObject, p as RectangleObject, r as CustomPassObject, s as Graphics, t as BlitterObject, u as MsdfIconObject } from "./display-CVjvA8ZO.js";
6
- import { ActionMap, StageKernel, createInputRecorder, createInputReplay, createInputTimeline } from "./kernel.js";
6
+ import { ActionMap, RollbackSession, StageKernel, createCameraDirector, createInputRecorder, createInputReplay, createInputTimeline, createRollbackSession } from "./kernel.js";
7
+ import { LocomotionFeel } from "./particles.js";
7
8
  import { buildSceneDigest, sanitizeTrackToken } from "./trace.js";
8
9
  import { computeFlexLayout, computeWrapLayout, flattenFlexTree, mountFlexUi, resolvePadding } from "./flex.js";
9
10
  import { Easings, TweenManager } from "./tween.js";
@@ -51,4 +52,4 @@ const Stage2D = {
51
52
  Display: { Canvas: { CanvasPool: { enableSmoothing() {} } } }
52
53
  };
53
54
  const Stage = Stage2D;
54
- export { AUTO, ActionMap, AnimationManager, BLACK_RGB, BlendModes, BlitterObject, CANVAS, Camera, CanvasTexture, Container, CustomPassObject, DisplayList, DisplayObject, DrawStreamObject, Easings, EngineClock, EventEmitter, FilterMode, Frame, Game, GameLoop, GameObjectFactory, Graphics, HEX_MASK, ImageObject, InputPlugin, InstancedBatchObject, JsonCache, KeyboardPlugin, LoaderPlugin, MsdfIconBatcher, MsdfIconObject, NineSliceObject, PanelObject, PixelAaBatcher, Pointer, RectangleObject, Renderer2D, RendererGl, RendererWebGpu, SURFACE_BAND, Scale, ScaleManager, Scene, SceneManager, Scenes, ScriptScheduler, SdfPanelBatcher, ShapeBatchObject, SpriteObject, Stage, Stage as default, Stage2D, StageKernel, TextObject, Texture, TextureManager, TextureSource, TileSpriteObject, TintModes, TweenManager, VirtualJoystick, WEBGL, WEBGPU, WHITE_RGB, buildSceneDigest, clampJoystickOrigin, computeFlexLayout, computeJoystickVector, computeSurfaceDomZ, computeWrapLayout, createInputRecorder, createInputReplay, createInputTimeline, createMatrix2D, createSurfaceTree, flattenFlexTree, isInJoystickZone, mountFlexUi, openDawnWebGpu, openWgpuNativeFfi, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestHeadlessWebGpu, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ };
55
+ export { AUTO, ActionMap, AnimationManager, BLACK_RGB, BlendModes, BlitterObject, CANVAS, Camera, CanvasTexture, Container, CustomPassObject, DisplayList, DisplayObject, DrawStreamObject, Easings, EngineClock, EventEmitter, FilterMode, Frame, Game, GameLoop, GameObjectFactory, Graphics, HEX_MASK, ImageObject, InputPlugin, InstancedBatchObject, JsonCache, KeyboardPlugin, LoaderPlugin, LocomotionFeel, MsdfIconBatcher, MsdfIconObject, NineSliceObject, PanelObject, PixelAaBatcher, Pointer, RectangleObject, Renderer2D, RendererGl, RendererWebGpu, RollbackSession, SURFACE_BAND, Scale, ScaleManager, Scene, SceneManager, Scenes, ScriptScheduler, SdfPanelBatcher, ShapeBatchObject, SpriteObject, Stage, Stage as default, Stage2D, StageKernel, TextObject, Texture, TextureManager, TextureSource, TileSpriteObject, TintModes, TweenManager, VirtualJoystick, WEBGL, WEBGPU, WHITE_RGB, buildSceneDigest, clampJoystickOrigin, computeFlexLayout, computeJoystickVector, computeSurfaceDomZ, computeWrapLayout, createCameraDirector, createInputRecorder, createInputReplay, createInputTimeline, createMatrix2D, createRollbackSession, createSurfaceTree, flattenFlexTree, isInJoystickZone, mountFlexUi, openDawnWebGpu, openWgpuNativeFfi, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestHeadlessWebGpu, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ, unpremultiplyRgbaInPlace };
@@ -1,4 +1,4 @@
1
- import { Ht as Pointer, Ln as PanelObject, hn as Container, u as Scene } from "./game-Ce35GTH4.js";
1
+ import { An as Container, Qn as PanelObject, nn as Pointer, u as Scene } from "./game-BrYrde7y.js";
2
2
  export type VirtualJoystickMode = 'floating' | 'fixed';
3
3
  export interface JoystickVector {
4
4
  /** Normalized X axis in [-1, 1] after deadzone remapping. */
package/dist/kernel.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { a as ScriptOptions, i as ScriptHandle, o as ScriptScheduler, r as ScriptContext, s as ScriptStats, t as CoroutineGenerator } from "./coroutine-DLgJumtD.js";
2
- import { A as createInputRecorder, C as RecordedInputEntry, D as TimelineClickOptions, E as StagePlugin, M as createInputTimeline, O as TimelineDragOptions, S as InputTimelinePlugin, T as StageKernel, _ as ActionMap, b as InputTargetSpec, j as createInputReplay, k as TimelineKeyOptions, v as InputProvider, w as StageInputEvent, x as InputTimelineOptions, y as InputRecorderPlugin } from "./game-Ce35GTH4.js";
3
- export { ActionMap, type CoroutineGenerator, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, type ScriptContext, type ScriptHandle, type ScriptOptions, ScriptScheduler, type ScriptStats, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, createInputRecorder, createInputReplay, createInputTimeline };
2
+ import { A as RecordedInputEntry, B as TimelineDragOptions, C as CameraPanOptions, D as InputTargetSpec, E as InputRecorderPlugin, F as RollbackStats, G as createInputTimeline, H as createCameraDirector, I as StageInputEvent, K as createRollbackSession, L as StageKernel, M as RollbackSession, N as RollbackSessionOptions, O as InputTimelineOptions, P as RollbackStateCodec, R as StagePlugin, S as CameraFollowCueOptions, T as InputProvider, U as createInputRecorder, V as TimelineKeyOptions, W as createInputReplay, _ as ActionMap, b as CameraDirectorPlugin, j as RollbackResult, k as InputTimelinePlugin, v as CameraCutOptions, w as CameraSpotlightOptions, x as CameraDirectorTarget, y as CameraDirectorOptions, z as TimelineClickOptions } from "./game-BrYrde7y.js";
3
+ export { ActionMap, CameraCutOptions, CameraDirectorOptions, CameraDirectorPlugin, CameraDirectorTarget, CameraFollowCueOptions, CameraPanOptions, CameraSpotlightOptions, type CoroutineGenerator, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, RollbackResult, RollbackSession, RollbackSessionOptions, RollbackStateCodec, RollbackStats, type ScriptContext, type ScriptHandle, type ScriptOptions, ScriptScheduler, type ScriptStats, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, createCameraDirector, createInputRecorder, createInputReplay, createInputTimeline, createRollbackSession };