@holtjs/stage 0.10.3 → 0.12.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.
@@ -1,8 +1,9 @@
1
1
  import { _ as rgbToCss, a as EventEmitter, c as Scale, h as packColorAbgr, l as Scenes, m as createMatrix2D, o as FilterMode, p as WHITE_RGB, r as BlendModes, u as TintModes } from "./types-CXsCvp1p.js";
2
2
  import { AnimationManager } from "./anims.js";
3
- import { i as Camera, r as Renderer2D, t as RendererWebGpu } from "./renderer-webgpu-CHJxmCvR.js";
4
- import { c as InstancedBatchObject, d as PanelObject, f as RectangleObject, g as TileSpriteObject, h as TextObject, i as DisplayList, l as MsdfIconObject, m as SpriteObject, n as Container, o as Graphics, p as ShapeBatchObject, r as CustomPassObject, s as ImageObject, t as BlitterObject, u as NineSliceObject } from "./display-DU4edtH-.js";
3
+ import { o as Renderer2D, s as Camera, t as RendererWebGpu } from "./renderer-webgpu-B8vktrUk.js";
4
+ import { _ as TileSpriteObject, 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-CuyQc8oE.js";
5
5
  import { TweenManager } from "./tween.js";
6
+ import { ScriptScheduler } from "./coroutine.js";
6
7
  import { StageKernel } from "./kernel.js";
7
8
  // src/texture.ts
8
9
  var TextureSource = class TextureSource {
@@ -77,6 +78,8 @@ var Frame = class {
77
78
  name;
78
79
  sourceIndex;
79
80
  source;
81
+ /** Dense 0-based registration index inside `texture.frameList` (enables O(1) numeric IDs via `texture.frameIdOf(name)`). */
82
+ index = 0;
80
83
  cutX = 0;
81
84
  cutY = 0;
82
85
  cutWidth = 0;
@@ -210,6 +213,7 @@ var Texture = class {
210
213
  key;
211
214
  source;
212
215
  frames = Object.create(null);
216
+ frameList = [];
213
217
  /** Optional isometric camera azimuth (`yaw` in radians, e.g. `Math.PI / 4` from `@holtjs/craft/three`) used by `SpriteObject.playDirectional()`. */
214
218
  atlasYaw = null;
215
219
  atlasPitch = null;
@@ -223,13 +227,35 @@ var Texture = class {
223
227
  }
224
228
  add(name, sourceIndex, x, y, width, height, meta) {
225
229
  const frame = new Frame(this, name, sourceIndex, x, y, width, height, meta);
226
- this.frames[String(name)] = frame;
230
+ const key = String(name);
231
+ const prev = this.frames[key];
232
+ if (prev) {
233
+ frame.index = prev.index;
234
+ this.frameList[prev.index] = frame;
235
+ } else {
236
+ frame.index = this.frameList.length;
237
+ this.frameList.push(frame);
238
+ }
239
+ this.frames[key] = frame;
227
240
  return frame;
228
241
  }
242
+ /**
243
+ * Resolve a stable negative integer frame handle (`-1 - frame.index`) usable directly in
244
+ * `InstancedColumns.frameIndex` and `DrawStreamObject` across WebGL2, WebGPU, and Canvas2D!
245
+ */
246
+ frameIdOf(name = "__BASE") {
247
+ if (typeof name === "number" && name < 0) return name;
248
+ return -1 - this.get(name).index;
249
+ }
229
250
  has(name) {
251
+ if (typeof name === "number" && name < 0) {
252
+ const idx = -1 - name;
253
+ return idx >= 0 && idx < this.frameList.length;
254
+ }
230
255
  return Object.prototype.hasOwnProperty.call(this.frames, String(name));
231
256
  }
232
257
  get(name = "__BASE") {
258
+ if (typeof name === "number" && name < 0) return this.frameList[-1 - name] ?? this.frames["__BASE"];
233
259
  const key = String(name);
234
260
  return this.frames[key] ?? this.frames["__BASE"];
235
261
  }
@@ -5170,6 +5196,10 @@ var GameObjectFactory = class {
5170
5196
  instancedBatch(key, maxCount = 1024, frame) {
5171
5197
  return this.register(new InstancedBatchObject(this.scene, key, maxCount, frame));
5172
5198
  }
5199
+ /** Create an immediate-mode per-frame `DrawStreamObject` (`sprite()` / `writeBulk()`). */
5200
+ drawStream(key, options) {
5201
+ return this.register(new DrawStreamObject(this.scene, key, options));
5202
+ }
5173
5203
  /** Create a zero-texture GPU analytical SDF shape batch (`circles`, `rings`, `pills`, `rounded rects`). */
5174
5204
  shapeBatch(maxCount = 1024, defaults) {
5175
5205
  return this.register(new ShapeBatchObject(this.scene, maxCount, defaults));
@@ -5272,6 +5302,9 @@ var Scene = class {
5272
5302
  events = new EventEmitter();
5273
5303
  /** Deterministic EngineClock-driven tween & spring manager (auto-stepped in `Game.step()`). */
5274
5304
  tweens = new TweenManager();
5305
+ /** Deterministic EngineClock-driven generator coroutine scheduler (`scene.script(function* (co) { ... })`). */
5306
+ scripts = new ScriptScheduler(this.tweens);
5307
+ _drawStreams = /* @__PURE__ */ new Map();
5275
5308
  _animatedSprites = /* @__PURE__ */ new Set();
5276
5309
  _equippedSprites = /* @__PURE__ */ new Set();
5277
5310
  _nodesCreated = 0;
@@ -5356,6 +5389,27 @@ var Scene = class {
5356
5389
  tweenStats() {
5357
5390
  return this.tweens.stats();
5358
5391
  }
5392
+ /** Launch a deterministic EngineClock-driven generator coroutine (`function* (co) { yield* co.wait(0.35); ... }`). */
5393
+ script(fn, options) {
5394
+ return this.scripts.run(fn, options);
5395
+ }
5396
+ /** Lightweight active/completed/cancelled coroutine counters. */
5397
+ scriptStats() {
5398
+ return this.scripts.stats();
5399
+ }
5400
+ /**
5401
+ * Acquire (or lazily create) a memoized immediate-mode `DrawStreamObject` keyed by `(textureKey, opts?.streamId ?? 'default')`.
5402
+ * Safe to call directly inside `update()` or `preRender()` every frame with zero node allocation!
5403
+ */
5404
+ drawStream(key, options) {
5405
+ const mapKey = `${key}::${options?.streamId ?? "default"}`;
5406
+ let stream = this._drawStreams.get(mapKey);
5407
+ if (!stream || !stream.active) {
5408
+ stream = this.add.drawStream(key, options);
5409
+ this._drawStreams.set(mapKey, stream);
5410
+ }
5411
+ return stream;
5412
+ }
5359
5413
  _registerAnimatedSprite(sprite) {
5360
5414
  this._animatedSprites.add(sprite);
5361
5415
  }
@@ -5404,6 +5458,8 @@ var Scene = class {
5404
5458
  } catch {}
5405
5459
  this._animatedSprites.clear();
5406
5460
  this._equippedSprites.clear();
5461
+ this._drawStreams.clear();
5462
+ this.scripts.clear();
5407
5463
  this.tweens.clear();
5408
5464
  }
5409
5465
  };
@@ -5662,6 +5718,7 @@ var Game = class {
5662
5718
  if (sc.sys.settings.status === Scenes.RUNNING) {
5663
5719
  sc.events.emit("preupdate", time, delta);
5664
5720
  if (sc.tweens.hasActive) sc.tweens.step(this.clock.lastDeltaMs);
5721
+ if (sc.scripts.hasActive) sc.scripts.step(this.clock.lastDeltaMs);
5665
5722
  sc._stepAnimations(this.clock.lastDeltaMs);
5666
5723
  sc.update?.(time, delta);
5667
5724
  this.kernel._updateScene(sc, time, delta);
@@ -1,4 +1,4 @@
1
- import { E as StagePlugin, L as SceneDigestOptions, N as SceneDigest, f as SceneInput, n as EngineClockSnapshot, r as Game, u as Scene } from "./game-CytDvQt9.js";
1
+ import { $t as OpenWgpuNativeFfiOptions, E as StagePlugin, Qt as OpenDawnWebGpuOptions, Tt as SceneDigest, Xt as HeadlessWebGpuHandle, Yt as HeadlessWebGpuBackend, Zt as HeadlessWebGpuOptions, en as openDawnWebGpu, f as SceneInput, kt as SceneDigestOptions, n as EngineClockSnapshot, nn as requestHeadlessWebGpu, qt as WebGpuDeviceLike, r as Game, tn as openWgpuNativeFfi, u as Scene } from "./game-CT_WCPjJ.js";
2
2
  /** Minimal Canvas2D surface compatible with `@napi-rs/canvas`, `node-canvas`, and browser `<canvas>`. */
3
3
  export interface HeadlessCanvasLike {
4
4
  width: number;
@@ -26,6 +26,10 @@ export interface HeadlessStageOptions {
26
26
  readonly pixelArt?: boolean;
27
27
  /** Optional custom WebGL/WebGL2 context when testing GPU shaders headlessly; defaults to `CANVAS` (`Renderer2D`). */
28
28
  readonly glContext?: WebGL2RenderingContext | WebGLRenderingContext | null;
29
+ /** Optional native Headless WebGPU `GPUDevice` (from `await requestHeadlessWebGpu()` via `bun:ffi` / `koffi` `wgpu-native` or Dawn `webgpu`). */
30
+ readonly gpuDevice?: WebGpuDeviceLike | null;
31
+ /** Optional WebGPU offscreen render format when `gpuDevice` is passed (default `'rgba8unorm'`). */
32
+ readonly gpuFormat?: string;
29
33
  /** Optional `StagePlugin[]` (e.g. `createInputTimeline`, `createInputRecorder`) mounted at boot. */
30
34
  readonly plugins?: StagePlugin[];
31
35
  /** Scene instance or constructor to boot synchronously at frame 0. */
@@ -83,12 +87,18 @@ export interface HeadlessStage {
83
87
  keyDown(code: string, key?: string): void;
84
88
  /** Synthesize a deterministic key-up event. */
85
89
  keyUp(code: string, key?: string): void;
86
- /** Read raw W3C RGBA8888 pixels (`width * height * 4` bytes). */
90
+ /** Read raw W3C RGBA8888 pixels (`width * height * 4` bytes; synchronous on Canvas2D, WebGL, and `wgpu-native` FFI). */
87
91
  toRgba(): Uint8Array;
88
92
  /** Copy raw W3C RGBA8888 pixels into an existing `Uint8Array` (avoids per-frame buffer allocation in tight video loops). */
89
93
  toRgbaInto(out: Uint8Array): Uint8Array;
94
+ /** Asynchronously read raw W3C RGBA8888 pixels across ALL renderers (including async Dawn `'webgpu'` and `navigator.gpu`). */
95
+ toRgbaAsync(): Promise<Uint8Array>;
96
+ /** Asynchronously copy raw W3C RGBA8888 pixels into an existing `Uint8Array` across ALL renderers. */
97
+ toRgbaIntoAsync(out: Uint8Array): Promise<Uint8Array>;
90
98
  /** Encode current frame to PNG bytes (requires `canvas.toBuffer('image/png')` such as `@napi-rs/canvas`). */
91
99
  toPng(): Uint8Array;
100
+ /** Asynchronously encode current frame to PNG bytes across ALL renderers (including async Dawn `'webgpu'`). */
101
+ toPngAsync(): Promise<Uint8Array>;
92
102
  /** Capture a zero-PII structured `SceneDigest` for the active scene at the current frame. */
93
103
  digest(options?: SceneDigestOptions): SceneDigest;
94
104
  /** Step and stream raw RGBA frames (e.g. into `ffmpeg`) at deterministic `fps`. */
@@ -230,4 +240,5 @@ export declare function buildFfmpegRawVideoArgs(options: FfmpegRawVideoArgsOptio
230
240
  * Step a `HeadlessStage` in Node.js or Bun and stream raw `RGBA8888` frames (`-f rawvideo -pix_fmt rgba`)
231
241
  * directly into `ffmpeg` stdin with backpressure handling and optional stereo `.wav` audio muxing.
232
242
  */
233
- export declare function encodeVideoWithFfmpeg(stage: HeadlessStage, options: EncodeVideoWithFfmpegOptions): Promise<EncodeVideoResult>;
243
+ export declare function encodeVideoWithFfmpeg(stage: HeadlessStage, options: EncodeVideoWithFfmpegOptions): Promise<EncodeVideoResult>;
244
+ export { type HeadlessWebGpuBackend, type HeadlessWebGpuHandle, type HeadlessWebGpuOptions, type OpenDawnWebGpuOptions, type OpenWgpuNativeFfiOptions, openDawnWebGpu, openWgpuNativeFfi, requestHeadlessWebGpu };
package/dist/headless.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import "./types-CXsCvp1p.js";
2
- import { n as Game } from "./game-D-rfAnoA.js";
2
+ import { n as Game } from "./game-DZoRjZNH.js";
3
+ import { a as requestHeadlessWebGpu, i as openWgpuNativeFfi, r as openDawnWebGpu } from "./renderer-webgpu-B8vktrUk.js";
3
4
  import { buildSceneDigest } from "./trace.js";
4
5
  // src/headless.ts
5
6
  function createVirtualDomHost(createCanvas, width, height) {
@@ -74,9 +75,12 @@ function createHeadlessStage(options) {
74
75
  if (options.Path2D && typeof globalThis.Path2D !== "function") globalThis.Path2D = options.Path2D;
75
76
  const { rootCanvas } = createVirtualDomHost(options.createCanvas, width, height);
76
77
  const game = new Game({
77
- type: options.glContext ? 2 : 1,
78
+ type: options.gpuDevice ? 3 : options.glContext ? 2 : 1,
78
79
  canvas: rootCanvas,
79
80
  context: options.glContext ?? void 0,
81
+ gpuDevice: options.gpuDevice ?? void 0,
82
+ gpuContext: null,
83
+ gpuFormat: options.gpuFormat ?? "rgba8unorm",
80
84
  width,
81
85
  height,
82
86
  backgroundColor: options.backgroundColor ?? "#12161f",
@@ -122,11 +126,23 @@ function createHeadlessStage(options) {
122
126
  }
123
127
  return game.clock.snapshot();
124
128
  };
129
+ const syncGpuPixelsToRootCanvas = (rgba) => {
130
+ const cw = rootCanvas.width || width;
131
+ const ch = rootCanvas.height || height;
132
+ const ctx = rootCanvas.getContext("2d");
133
+ if (!ctx) return;
134
+ if (typeof ctx.createImageData === "function" && typeof ctx.putImageData === "function") {
135
+ const imgData = ctx.createImageData(cw, ch);
136
+ imgData.data.set(rgba.subarray(0, cw * ch * 4));
137
+ ctx.putImageData(imgData, 0, 0);
138
+ }
139
+ };
125
140
  const toRgbaInto = (out) => {
126
141
  const cw = rootCanvas.width || width;
127
142
  const ch = rootCanvas.height || height;
128
143
  const byteLen = cw * ch * 4;
129
144
  const dst = out && out.byteLength >= byteLen ? out : new Uint8Array(byteLen);
145
+ if (game.renderer.type === 3) return game.renderer.readPixelsSync(dst);
130
146
  if (game.renderer.type === 2 && game.renderer.gl) {
131
147
  const gl = game.renderer.gl;
132
148
  gl.readPixels(0, 0, cw, ch, gl.RGBA, gl.UNSIGNED_BYTE, dst);
@@ -141,6 +157,7 @@ function createHeadlessStage(options) {
141
157
  const toRgba = () => {
142
158
  const cw = rootCanvas.width || width;
143
159
  const ch = rootCanvas.height || height;
160
+ if (game.renderer.type === 3) return game.renderer.readPixelsSync();
144
161
  if (game.renderer.type === 2 && game.renderer.gl) {
145
162
  const gl = game.renderer.gl;
146
163
  const out = new Uint8Array(cw * ch * 4);
@@ -152,13 +169,34 @@ function createHeadlessStage(options) {
152
169
  const img = ctx.getImageData(0, 0, cw, ch);
153
170
  return new Uint8Array(img.data.buffer, img.data.byteOffset, img.data.byteLength);
154
171
  };
172
+ const toRgbaIntoAsync = async (out) => {
173
+ if (game.renderer.type === 3) {
174
+ const byteLen = (rootCanvas.width || width) * (rootCanvas.height || height) * 4;
175
+ const dst = out && out.byteLength >= byteLen ? out : new Uint8Array(byteLen);
176
+ return game.renderer.readPixelsAsync(dst);
177
+ }
178
+ return toRgbaInto(out);
179
+ };
180
+ const toRgbaAsync = async () => {
181
+ if (game.renderer.type === 3) return game.renderer.readPixelsAsync();
182
+ return toRgba();
183
+ };
155
184
  const toPng = () => {
185
+ if (game.renderer.type !== 1) syncGpuPixelsToRootCanvas(toRgba());
156
186
  if (typeof rootCanvas.toBuffer === "function") {
157
187
  const buf = rootCanvas.toBuffer("image/png");
158
188
  return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
159
189
  }
160
190
  throw new Error("HeadlessStage.toPng: canvas does not implement toBuffer(\"image/png\"); pass createCanvas from @napi-rs/canvas");
161
191
  };
192
+ const toPngAsync = async () => {
193
+ if (game.renderer.type !== 1) syncGpuPixelsToRootCanvas(await toRgbaAsync());
194
+ if (typeof rootCanvas.toBuffer === "function") {
195
+ const buf = rootCanvas.toBuffer("image/png");
196
+ return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
197
+ }
198
+ throw new Error("HeadlessStage.toPngAsync: canvas does not implement toBuffer(\"image/png\"); pass createCanvas from @napi-rs/canvas");
199
+ };
162
200
  const digest = (digestOpts) => buildSceneDigest(primaryScene, digestOpts);
163
201
  const recordFrames = async (recOpts) => {
164
202
  const totalFrames = recOpts.frames !== void 0 ? Math.max(1, Math.floor(recOpts.frames)) : Math.max(1, Math.round((recOpts.durationMs ?? 1e3) / 1e3 * fps));
@@ -170,12 +208,21 @@ function createHeadlessStage(options) {
170
208
  game.step(simCursorMs, dt);
171
209
  }
172
210
  const snapDigest = digestEvery > 0 && i % digestEvery === 0 ? digest(recOpts.digestOptions) : void 0;
173
- if (sharedRgba) sharedRgba = toRgbaInto(sharedRgba);
211
+ let frameRgba;
212
+ if (game.renderer.type === 3) {
213
+ if (sharedRgba) {
214
+ sharedRgba = await toRgbaIntoAsync(sharedRgba);
215
+ frameRgba = sharedRgba;
216
+ } else frameRgba = await toRgbaAsync();
217
+ } else if (sharedRgba) {
218
+ sharedRgba = toRgbaInto(sharedRgba);
219
+ frameRgba = sharedRgba;
220
+ } else frameRgba = toRgba();
174
221
  await recOpts.onFrame({
175
222
  index: i,
176
223
  frameSeq: game.clock.frameSeq,
177
224
  simTimeMs: Math.round(simCursorMs),
178
- rgba: sharedRgba ?? toRgba(),
225
+ rgba: frameRgba,
179
226
  digest: snapDigest
180
227
  });
181
228
  }
@@ -227,7 +274,10 @@ function createHeadlessStage(options) {
227
274
  }),
228
275
  toRgba,
229
276
  toRgbaInto,
277
+ toRgbaAsync,
278
+ toRgbaIntoAsync,
230
279
  toPng,
280
+ toPngAsync,
231
281
  digest,
232
282
  recordFrames,
233
283
  encodeVideo: (encOpts) => encodeVideoWithFfmpeg(self, encOpts),
@@ -265,6 +315,15 @@ function renderStoryboard(stage, options) {
265
315
  const row = Math.floor(i / cols);
266
316
  const tx = gap + col * (tileW + gap);
267
317
  const ty = gap + row * (tileH + gap);
318
+ if (stage.game.renderer.type !== 1) {
319
+ const c2d = stage.canvas.getContext("2d");
320
+ if (c2d && typeof c2d.createImageData === "function" && typeof c2d.putImageData === "function") {
321
+ const rgba = stage.toRgba();
322
+ const imgData = c2d.createImageData(stage.width, stage.height);
323
+ imgData.data.set(rgba.subarray(0, stage.width * stage.height * 4));
324
+ c2d.putImageData(imgData, 0, 0);
325
+ }
326
+ }
268
327
  ctx.drawImage(stage.canvas, 0, 0, stage.width, stage.height, tx, ty, tileW, tileH);
269
328
  ctx.strokeStyle = "rgba(255, 255, 255, 0.14)";
270
329
  ctx.lineWidth = 1;
@@ -571,4 +630,4 @@ async function encodeVideoWithFfmpeg(stage, options) {
571
630
  } catch {}
572
631
  }
573
632
  }
574
- export { buildFfmpegRawVideoArgs, createAudioTimeline, createHeadlessStage, encodeVideoWithFfmpeg, renderStoryboard };
633
+ export { buildFfmpegRawVideoArgs, createAudioTimeline, createHeadlessStage, encodeVideoWithFfmpeg, openDawnWebGpu, openWgpuNativeFfi, renderStoryboard, requestHeadlessWebGpu };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { $ as WebGpuBootstrapResult, A as createInputRecorder, At as NineSliceObject, B as SceneDigestSurfaceEntry, Bt as SpriteAnimEventListener, C as RecordedInputEntry, Ct as EquipmentBinding, D as TimelineClickOptions, Dt as InstancedColumns, E as StagePlugin, Et as InstancedBatchObject, F as SceneDigestEngineSandbox, Ft as RectangleObject, G as InputConfig, Gt as TextStyleConfig, H as SceneDigestSurfaces, Ht as SpritePlayOptions, I as SceneDigestNode, It as SceneHostLike, J as Pointer, Jt as CameraFollowOptions, K as InputPlugin, Kt as TileSpriteObject, L as SceneDigestOptions, Lt as ShapeBatchColumns, M as createInputTimeline, Mt as PanelOpenSide, N as SceneDigest, Nt as PanelStyleConfig, O as TimelineDragOptions, Ot as MsdfIconConfig, P as SceneDigestActiveFocus, Pt as RectClipMask, Q as RequestWebGpuOptions, R as SceneDigestOverlayStats, Rt as ShapeBatchObject, S as InputTimelinePlugin, St as DisplaySemantics, T as StageKernel, Tt as ImageObject, U as buildSceneDigest, Ut as SyncAttachmentOptions, V as SceneDigestSurfaceSource, Vt as SpriteObject, W as sanitizeTrackToken, Wt as TextObject, X as RendererWebGpu, Xt as HiDpiScaleLike, Y as PointerSample, Yt as HiDpiConfigureOptions, Z as RendererWebGpuOptions, _ as ActionMap, _t as CustomPassOptions, a as GameLoop, at as RendererGlOptions, b as InputTargetSpec, bt as DisplayObject, c as LoaderPlugin, ct as StageRenderTarget, d as SceneCtor, dt as BlitterObject, et as WebGpuCanvasContextLike, f as SceneInput, ft as Bob$1, g as ViewportFitResult, gt as CustomPassObject, h as StageRenderer, ht as CustomPassCallback, i as GameConfig$1, it as RendererGl, j as createInputReplay, jt as PanelObject, k as TimelineKeyOptions, kt as MsdfIconObject, l as ScaleManager, lt as AnchorPose2D, m as SceneManager, mt as ContainerFiltersShim, n as EngineClockSnapshot, nt as requestWebGpuDevice, o as GameObjectFactory, ot as RendererStats, p as SceneLifecycleStats, pt as Container, q as KeyboardPlugin, qt as Camera, r as Game, rt as Renderer2D, s as JsonCache, st as Stage2DCustomImageHandler, t as EngineClock, tt as WebGpuDeviceLike, u as Scene, ut as BindEquipmentOptions, v as InputProvider, vt as DirectionalPlayOptions, w as StageInputEvent, wt as Graphics, x as InputTimelineOptions, xt as DisplayObjectType, y as InputRecorderPlugin, yt as DisplayList, z as SceneDigestSandbox, zt as ShapeBatchStyleDefaults } from "./game-CytDvQt9.js";
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-D9N8w6IM.js";
3
- import { FlexAlign, FlexContainerSpec, FlexDir, FlexItemRect, FlexItemSpec, FlexJustify, FlexPadding, FlexResult, WrapContainerSpec, WrapItemRect, WrapItemSpec, WrapJustify, WrapResult, computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
1
+ import { $n as HiDpiConfigureOptions, $t as OpenWgpuNativeFfiOptions, A as createInputRecorder, An as InstancedBatchObject, At as SceneDigestOverlayStats, Bn as SceneHostLike, Bt as Pointer, C as RecordedInputEntry, Cn as DrawStreamBulkView, D as TimelineClickOptions, Dn as EquipmentBinding, Dt as SceneDigestEngineSandbox, E as StagePlugin, En as DrawStreamSpriteOptions, Et as SceneDigestActiveFocus, Fn as PanelObject, Ft as buildSceneDigest, Gn as SpriteObject, Gt as WebGpuBootstrapResult, Hn as ShapeBatchObject, Ht as RendererWebGpu, In as PanelOpenSide, It as sanitizeTrackToken, Jn as TextObject, Jt as requestWebGpuDevice, Kn as SpritePlayOptions, Kt as WebGpuCanvasContextLike, Ln as PanelStyleConfig, Lt as InputConfig, M as createInputTimeline, Mn as MsdfIconConfig, Mt as SceneDigestSurfaceEntry, Nn as MsdfIconObject, Nt as SceneDigestSurfaceSource, O as TimelineDragOptions, On as Graphics, Ot as SceneDigestNode, Pn as NineSliceObject, Pt as SceneDigestSurfaces, Qn as CameraFollowOptions, Qt as OpenDawnWebGpuOptions, Rn as RectClipMask, Rt as InputPlugin, S as InputTimelinePlugin, Sn as DisplaySemantics, T as StageKernel, Tn as DrawStreamOptions, Tt as SceneDigest, Un as ShapeBatchStyleDefaults, Ut as RendererWebGpuOptions, Vn as ShapeBatchColumns, Vt as PointerSample, Wn as SpriteAnimEventListener, Wt as RequestWebGpuOptions, Xn as TileSpriteObject, Xt as HeadlessWebGpuHandle, Yn as TextStyleConfig, Yt as HeadlessWebGpuBackend, Zn as Camera, Zt as HeadlessWebGpuOptions, _ as ActionMap, _n as CustomPassOptions, a as GameLoop, an as RendererGlOptions, b as InputTargetSpec, bn as DisplayObject, c as LoaderPlugin, cn as StageRenderTarget, d as SceneCtor, dn as BlitterObject, en as openDawnWebGpu, er as HiDpiScaleLike, f as SceneInput, fn as Bob$1, g as ViewportFitResult, gn as CustomPassObject, h as StageRenderer, hn as CustomPassCallback, i as GameConfig$1, in as RendererGl, j as createInputReplay, jn as InstancedColumns, jt as SceneDigestSandbox, k as TimelineKeyOptions, kn as ImageObject, kt as SceneDigestOptions, l as ScaleManager, ln as AnchorPose2D, m as SceneManager, mn as ContainerFiltersShim, n as EngineClockSnapshot, nn as requestHeadlessWebGpu, o as GameObjectFactory, on as RendererStats, p as SceneLifecycleStats, pn as Container, qn as SyncAttachmentOptions, qt as WebGpuDeviceLike, r as Game, rn as Renderer2D, s as JsonCache, sn as Stage2DCustomImageHandler, t as EngineClock, tn as openWgpuNativeFfi, u as Scene, un as BindEquipmentOptions, v as InputProvider, vn as DirectionalPlayOptions, w as StageInputEvent, wn as DrawStreamObject, x as InputTimelineOptions, xn as DisplayObjectType, y as InputRecorderPlugin, yn as DisplayList, zn as RectangleObject, zt as KeyboardPlugin } from "./game-CT_WCPjJ.js";
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-BYBzSNXO.js";
3
+ 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
4
  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
+ import { a as ScriptOptions, i as ScriptHandle, o as ScriptScheduler, r as ScriptContext, s as ScriptStats, t as CoroutineGenerator } from "./coroutine-DLgJumtD.js";
5
6
  import { JoystickDpad, JoystickDpadOptions, JoystickState, JoystickVector, JoystickViewport, JoystickZone, JoystickZonePredicate, JoystickZoneRect, VirtualJoystick, VirtualJoystickMode, VirtualJoystickOptions, VirtualJoystickStyle, clampJoystickOrigin, computeJoystickVector, isInJoystickZone, pullJoystickOrigin, quantizeJoystickDpad } from "./joystick.js";
6
7
  import { SURFACE_BAND, SurfaceBand, SurfaceBandName, SurfaceBarrier, SurfaceCancelContext, SurfaceCancelDispatchResult, SurfaceCancelResult, SurfaceDomEntry, SurfaceFocusContext, SurfaceFocusDispatchResult, SurfaceFocusResult, SurfaceKeyContext, SurfaceKeyDispatchResult, SurfaceKeyResult, SurfaceNodeInfo, SurfaceNodeInput, SurfaceScope, SurfaceTree, computeSurfaceDomZ, createSurfaceTree, resolveSurfacePriority, surfacePriorityToDomZ } from "./surfaces.js";
7
8
  export declare class SdfPanelBatcher {
@@ -331,4 +332,4 @@ export declare const Stage: {
331
332
  };
332
333
  };
333
334
  };
334
- 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 CustomPassCallback, CustomPassObject, type CustomPassOptions, type DirectionalAnimGroup, type DirectionalPlayOptions, DisplayList, DisplayObject, type DisplayObjectType, type DisplaySemantics, type DisposableOwner, type EasingFn, type EasingName, Easings, EngineClock, type EngineClockSnapshot, type EquipmentBinding, EventEmitter, FilterMode, type FilterModeValue, type FlexAlign, type FlexContainerSpec, type FlexDir, type FlexItemRect, type FlexItemSpec, type FlexJustify, type FlexPadding, type FlexResult, Frame, type FrameAnchorTuple, type FrameExtraMeta, Game, type GameConfig$1 as GameConfig, GameLoop, GameObjectFactory, type GenerateFrameNamesConfig, type GenerateFrameNumbersConfig, type GlTextureHost, Graphics, HEX_MASK, 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 MsdfIconConfig, MsdfIconObject, NineSliceObject, 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 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, isInJoystickZone, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ };
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 };
package/dist/index.js CHANGED
@@ -1,12 +1,13 @@
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-D-rfAnoA.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-DZoRjZNH.js";
3
3
  import { AnimationManager } from "./anims.js";
4
- import { i as Camera, n as requestWebGpuDevice, r as Renderer2D, t as RendererWebGpu } from "./renderer-webgpu-CHJxmCvR.js";
5
- import { a as DisplayObject, c as InstancedBatchObject, d as PanelObject, f as RectangleObject, g as TileSpriteObject, h as TextObject, i as DisplayList, l as MsdfIconObject, m as SpriteObject, n as Container, o as Graphics, p as ShapeBatchObject, r as CustomPassObject, s as ImageObject, t as BlitterObject, u as NineSliceObject } from "./display-DU4edtH-.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-B8vktrUk.js";
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-CuyQc8oE.js";
6
6
  import { ActionMap, StageKernel, createInputRecorder, createInputReplay, createInputTimeline } from "./kernel.js";
7
7
  import { buildSceneDigest, sanitizeTrackToken } from "./trace.js";
8
- import { computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
8
+ import { computeFlexLayout, computeWrapLayout, flattenFlexTree, mountFlexUi, resolvePadding } from "./flex.js";
9
9
  import { Easings, TweenManager } from "./tween.js";
10
+ import { ScriptScheduler } from "./coroutine.js";
10
11
  import { VirtualJoystick, clampJoystickOrigin, computeJoystickVector, isInJoystickZone, pullJoystickOrigin, quantizeJoystickDpad } from "./joystick.js";
11
12
  import { SURFACE_BAND, computeSurfaceDomZ, createSurfaceTree, resolveSurfacePriority, surfacePriorityToDomZ } from "./surfaces.js";
12
13
  // src/index.ts
@@ -50,4 +51,4 @@ const Stage2D = {
50
51
  Display: { Canvas: { CanvasPool: { enableSmoothing() {} } } }
51
52
  };
52
53
  const Stage = Stage2D;
53
- export { AUTO, ActionMap, AnimationManager, BLACK_RGB, BlendModes, BlitterObject, CANVAS, Camera, CanvasTexture, Container, CustomPassObject, DisplayList, DisplayObject, 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, 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, isInJoystickZone, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ };
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 };
@@ -1,4 +1,4 @@
1
- import { J as Pointer, jt as PanelObject, pt as Container, u as Scene } from "./game-CytDvQt9.js";
1
+ import { Bt as Pointer, Fn as PanelObject, pn as Container, u as Scene } from "./game-CT_WCPjJ.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,2 +1,3 @@
1
- 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-CytDvQt9.js";
2
- export { ActionMap, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, createInputRecorder, createInputReplay, createInputTimeline };
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-CT_WCPjJ.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 };
package/dist/kernel.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { buildSceneDigest, sanitizeTrackToken } from "./trace.js";
2
2
  import { Easings } from "./tween.js";
3
+ import { ScriptScheduler } from "./coroutine.js";
3
4
  // src/kernel.ts
4
5
  /** Godot-inspired semantic action map binding logical game verbs (`'jump'`, `'interact'`) to key codes. */
5
6
  var ActionMap = class {
@@ -58,6 +59,7 @@ var StageKernel = class {
58
59
  providerOrder = [];
59
60
  inputListeners = [];
60
61
  inputGuard = null;
62
+ boundCatalog = null;
61
63
  disposed = false;
62
64
  constructor(game) {
63
65
  this.game = game;
@@ -68,6 +70,18 @@ var StageKernel = class {
68
70
  this.inputGuard = guard;
69
71
  return this;
70
72
  }
73
+ /** Bind a `WorldCatalogRuntime` so Vite/Bun HMR or AI balance harnesses can hot-reload via `kernel.reloadCatalog()`. */
74
+ bindCatalog(catalogRuntime) {
75
+ this.boundCatalog = catalogRuntime;
76
+ return this;
77
+ }
78
+ /** Hot-reload the bound `WorldCatalogRuntime` in-place without resetting live scene/world state! */
79
+ reloadCatalog(nextCatalog) {
80
+ if (!this.boundCatalog) throw new Error("StageKernel.reloadCatalog: no WorldCatalogRuntime bound (call kernel.bindCatalog(runtime) first)");
81
+ const diff = this.boundCatalog.reload(nextCatalog);
82
+ this.game.events.emit("catalogreloaded", diff, this.boundCatalog.catalog);
83
+ return diff;
84
+ }
71
85
  /** Subscribe to every normalized `StageInputEvent` flowing through the kernel (used by recorders/mods). */
72
86
  onInput(listener) {
73
87
  this.inputListeners.push(listener);
@@ -640,4 +654,4 @@ function createInputReplay(log, id = "stage.input-replay") {
640
654
  };
641
655
  return replay;
642
656
  }
643
- export { ActionMap, StageKernel, createInputRecorder, createInputReplay, createInputTimeline };
657
+ export { ActionMap, ScriptScheduler, StageKernel, createInputRecorder, createInputReplay, createInputTimeline };
@@ -1,4 +1,4 @@
1
- import { It as SceneHostLike, Tt as ImageObject, bt as DisplayObject, gt as CustomPassObject, pt as Container } from "./game-CytDvQt9.js";
1
+ import { Bn as SceneHostLike, bn as DisplayObject, gn as CustomPassObject, kn as ImageObject, pn as Container } from "./game-CT_WCPjJ.js";
2
2
  export type DayPhase = 'day' | 'dusk' | 'night';
3
3
  export interface DayNightConfig {
4
4
  dayLengthMs?: number;
package/dist/lighting.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { m as createMatrix2D, o as FilterMode, r as BlendModes } from "./types-CXsCvp1p.js";
2
- import { c as InstancedBatchObject } from "./display-DU4edtH-.js";
2
+ import { l as InstancedBatchObject } from "./display-CuyQc8oE.js";
3
3
  // src/lighting.ts
4
4
  function lerpChannel(a, b, t) {
5
5
  return Math.round(a + (b - a) * t) & 255;
@@ -1,4 +1,4 @@
1
- import { It as SceneHostLike, bt as DisplayObject, pt as Container } from "./game-CytDvQt9.js";
1
+ import { Bn as SceneHostLike, bn as DisplayObject, pn as Container } from "./game-CT_WCPjJ.js";
2
2
  export interface Camera25DConfig {
3
3
  viewportWidth: number;
4
4
  viewportHeight: number;