@holtjs/stage 0.10.0 → 0.10.2

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/CHANGELOG.md CHANGED
@@ -6,6 +6,16 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.10.1] - 2026-12-04
10
+
11
+ ### Added & Fixed
12
+ - **Multi-Atlas Collision Diagnostics & Namespace `prefix` (`AnimationManager.createFromAtlas` / `create`, `src/anims.ts`)**:
13
+ - `AnimationManager.createFromAtlas()` and `AnimationManager.create()` now emit a concise `console.warn` when overwriting an existing animation clip key from an earlier atlas (and refresh bare actor/group aliases in lockstep so `survivor/walk` never split-brains across textures).
14
+ - Added `{ prefix?: string, overwrite?: boolean }` to `AtlasAutoAnimOptions` (e.g. `createFromAtlas('npc_sheet', { prefix: 'npc' })`) and `{ overwrite?: boolean }` to `AnimationConfig`.
15
+ - **Occluded `bindEquipment` Transform Parity & `<=64x64` Empty-Placeholder Detection (`src/display.ts`, `src/texture.ts`)**:
16
+ - `SpriteObject.bindEquipment()` now synchronizes `x`, `y`, `flipX`, `flipY`, `scale`, `rotation`, `skew`, `alpha`, and `zIndex` even when the bound layer is hidden on an occluded/missing frame (`visible = false`), ensuring callers reading `toolImage.x/y` always see exact coordinates.
17
+ - Extended `TextureManager.addAtlas()` lazy transparent-placeholder probing from `<=4x4` up to `<=64x64` (`5x5`, `8x8`, `16x16`, `32x32`, `64x64` all-alpha-zero cells automatically set `Frame.empty = true`, memoized per rect).
18
+
9
19
  ## [0.10.0] - 2026-12-04
10
20
 
11
21
  ### Added
@@ -317,6 +317,8 @@ interface AnimationConfig {
317
317
  readonly yoyo?: boolean;
318
318
  /** Declarative map from 0-based frame index to event name(s), e.g. `{ 1: 'footstep', 4: 'footstep' }`. */
319
319
  readonly events?: Readonly<Record<number, string | readonly string[]>>;
320
+ /** Silence duplicate-key overwrite warning when intentionally replacing an existing animation (`default = false`). */
321
+ readonly overwrite?: boolean;
320
322
  }
321
323
  interface StageAnimation {
322
324
  readonly key: string;
@@ -362,6 +364,10 @@ interface AtlasAutoAnimOptions {
362
364
  * Frames baked via `@holtjs/craft/three` `bakeEquipment` also inherit automatically via frame `baseChar` metadata!
363
365
  */
364
366
  readonly inheritFrom?: Readonly<Record<string, string>>;
367
+ /** Optional namespace prefix prepended to generated clip & directional group keys (e.g. `'npc'` -> `'npc/chars/survivor/walk/d0'`) when loading multiple atlases with overlapping actor/clip names. */
368
+ readonly prefix?: string;
369
+ /** Silence duplicate-key overwrite warning when intentionally replacing animations from an earlier `createFromAtlas` call (`default = false`). */
370
+ readonly overwrite?: boolean;
365
371
  }
366
372
  interface DirectionalAnimGroup {
367
373
  readonly baseKey: string;
@@ -390,6 +396,7 @@ declare class AnimationManager {
390
396
  listKeys(): string[];
391
397
  listDirectionalGroups(): string[];
392
398
  create(config: AnimationConfig): StageAnimation;
399
+ private _createInternal;
393
400
  /** Register an alias key pointing to an existing `StageAnimation` (does not overwrite explicit primary keys). */
394
401
  registerAlias(aliasKey: string, target: StageAnimation): void;
395
402
  /** Register a directional animation group (and optional alias keys such as bare `'survivor/walk'` & `'survivor_walk'`). */
package/dist/anims.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as AtlasClipRule, c as GenerateFrameNamesConfig, i as AtlasAutoAnimOptions, l as GenerateFrameNumbersConfig, n as AnimationFrameInput, o as CompiledAnimationFrame, r as AnimationManager, s as DirectionalAnimGroup, t as AnimationConfig, u as StageAnimation } from "./anims-xOSYNG79.js";
1
+ import { a as AtlasClipRule, c as GenerateFrameNamesConfig, i as AtlasAutoAnimOptions, l as GenerateFrameNumbersConfig, n as AnimationFrameInput, o as CompiledAnimationFrame, r as AnimationManager, s as DirectionalAnimGroup, t as AnimationConfig, u as StageAnimation } from "./anims-D9N8w6IM.js";
2
2
  export { AnimationConfig, AnimationFrameInput, AnimationManager, AtlasAutoAnimOptions, AtlasClipRule, CompiledAnimationFrame, DirectionalAnimGroup, GenerateFrameNamesConfig, GenerateFrameNumbersConfig, StageAnimation };
package/dist/anims.js CHANGED
@@ -203,7 +203,15 @@ var AnimationManager = class {
203
203
  return out;
204
204
  }
205
205
  create(config) {
206
+ return this._createInternal(config, false);
207
+ }
208
+ _createInternal(config, suppressCollisionWarn) {
206
209
  if (!config.frames || config.frames.length === 0) throw new Error(`Stage anims.create("${config.key}"): frames array must not be empty`);
210
+ if (!suppressCollisionWarn && !config.overwrite && this.anims.has(config.key)) {
211
+ const prevTex = this.anims.get(config.key).frames[0]?.textureKey ?? "unknown";
212
+ const nextTex = config.frames[0]?.key ?? config.defaultTextureKey ?? "unknown";
213
+ console.warn(`Stage anims.create("${config.key}"): overwriting existing clip from texture "${prevTex}" with "${nextTex}" (pass { overwrite: true } to silence)`);
214
+ }
207
215
  const count = config.frames.length;
208
216
  const frameRate = config.frameRate !== void 0 && config.frameRate > 0 ? config.frameRate : config.duration !== void 0 && config.duration > 0 ? count * 1e3 / config.duration : 10;
209
217
  const baseMsPerFrame = 1e3 / frameRate;
@@ -243,8 +251,12 @@ var AnimationManager = class {
243
251
  }
244
252
  /** Register a directional animation group (and optional alias keys such as bare `'survivor/walk'` & `'survivor_walk'`). */
245
253
  registerDirectionalGroup(group, aliases = []) {
254
+ const prevGroup = this.dirGroups.get(group.baseKey);
246
255
  this.dirGroups.set(group.baseKey, group);
247
- for (const a of aliases) if (!this.dirGroups.has(a)) this.dirGroups.set(a, group);
256
+ for (const a of aliases) {
257
+ const existing = this.dirGroups.get(a);
258
+ if (!existing || existing === prevGroup) this.dirGroups.set(a, group);
259
+ }
248
260
  }
249
261
  remove(key) {
250
262
  this.aliases.delete(key);
@@ -372,6 +384,22 @@ var AnimationManager = class {
372
384
  }
373
385
  const created = [];
374
386
  const atlasYaw = tex.atlasYaw ?? 0;
387
+ const nsPrefix = options.prefix ? options.prefix.replace(/\/+$/, "") : "";
388
+ const withNs = (k) => nsPrefix ? `${nsPrefix}/${k}` : k;
389
+ const overwrittenKeys = [];
390
+ let overwrittenFromTex = null;
391
+ const createClip = (cfg) => {
392
+ const existing = this.anims.get(cfg.key);
393
+ if (existing && !options.overwrite) {
394
+ overwrittenKeys.push(cfg.key);
395
+ if (!overwrittenFromTex) overwrittenFromTex = existing.frames[0]?.textureKey ?? "unknown";
396
+ }
397
+ const anim = this._createInternal(cfg, true);
398
+ if (existing) {
399
+ for (const [ak, target] of this.aliases.entries()) if (target === existing) this.aliases.set(ak, anim);
400
+ }
401
+ return anim;
402
+ };
375
403
  for (const b of buckets.values()) {
376
404
  const rule = resolveRule(b.actor, b.clip, b.baseActor);
377
405
  const repeat = rule?.repeat !== void 0 ? rule.repeat : options.defaultRepeat !== void 0 ? options.defaultRepeat : b.loopHint !== void 0 ? b.loopHint ? -1 : 0 : LOOP_CLIP_RE.test(b.clip) ? -1 : 0;
@@ -380,9 +408,8 @@ var AnimationManager = class {
380
408
  const canBareAlias = Boolean(bare && bare !== b.actor && (actorsByBase.get(bare)?.size ?? 0) === 1);
381
409
  if (b.byDir.size === 1 && b.byDir.has(null)) {
382
410
  const seq = b.byDir.get(null).sort((a, c) => a.frameIdx - c.frameIdx);
383
- const primaryKey = b.actor ? `${b.actor}/${b.clip}` : b.clip;
384
- const anim = this.create({
385
- key: primaryKey,
411
+ const anim = createClip({
412
+ key: withNs(b.actor ? `${b.actor}/${b.clip}` : b.clip),
386
413
  defaultTextureKey: textureKey,
387
414
  frames: seq.map((s) => ({
388
415
  key: textureKey,
@@ -392,13 +419,14 @@ var AnimationManager = class {
392
419
  duration: rule?.duration,
393
420
  repeat,
394
421
  yoyo: rule?.yoyo,
395
- events: rule?.events
422
+ events: rule?.events,
423
+ overwrite: options.overwrite
396
424
  });
397
425
  created.push(anim);
398
- if (b.actor) this.registerAlias(`${b.actor}_${b.clip}`, anim);
426
+ if (b.actor) this.registerAlias(withNs(`${b.actor}_${b.clip}`), anim);
399
427
  if (canBareAlias) {
400
- this.registerAlias(`${bare}/${b.clip}`, anim);
401
- this.registerAlias(`${bare}_${b.clip}`, anim);
428
+ this.registerAlias(withNs(`${bare}/${b.clip}`), anim);
429
+ this.registerAlias(withNs(`${bare}_${b.clip}`), anim);
402
430
  }
403
431
  continue;
404
432
  }
@@ -422,11 +450,10 @@ var AnimationManager = class {
422
450
  indexedDirs.sort((a, c) => a.dirIdx - c.dirIdx);
423
451
  const dirClips = [];
424
452
  for (const item of indexedDirs) {
425
- const prefixSlash = b.actor ? `${b.actor}/${b.clip}` : b.clip;
426
- const prefixUnder = b.actor ? `${b.actor}_${b.clip}` : b.clip;
427
- const primaryKey = `${prefixSlash}/d${item.dirIdx}`;
428
- const anim = this.create({
429
- key: primaryKey,
453
+ const prefixSlash = withNs(b.actor ? `${b.actor}/${b.clip}` : b.clip);
454
+ const prefixUnder = withNs(b.actor ? `${b.actor}_${b.clip}` : b.clip);
455
+ const anim = createClip({
456
+ key: `${prefixSlash}/d${item.dirIdx}`,
430
457
  defaultTextureKey: textureKey,
431
458
  frames: item.frames.map((s) => ({
432
459
  key: textureKey,
@@ -436,7 +463,8 @@ var AnimationManager = class {
436
463
  duration: rule?.duration,
437
464
  repeat,
438
465
  yoyo: rule?.yoyo,
439
- events: rule?.events
466
+ events: rule?.events,
467
+ overwrite: options.overwrite
440
468
  });
441
469
  created.push(anim);
442
470
  dirClips.push(anim);
@@ -447,21 +475,21 @@ var AnimationManager = class {
447
475
  this.registerAlias(`${prefixUnder}_${item.label}`, anim);
448
476
  }
449
477
  if (canBareAlias) {
450
- this.registerAlias(`${bare}/${b.clip}/d${item.dirIdx}`, anim);
451
- this.registerAlias(`${bare}/${b.clip}/${item.dirIdx}`, anim);
452
- this.registerAlias(`${bare}_${b.clip}_${item.dirIdx}`, anim);
478
+ this.registerAlias(withNs(`${bare}/${b.clip}/d${item.dirIdx}`), anim);
479
+ this.registerAlias(withNs(`${bare}/${b.clip}/${item.dirIdx}`), anim);
480
+ this.registerAlias(withNs(`${bare}_${b.clip}_${item.dirIdx}`), anim);
453
481
  }
454
482
  }
455
483
  if (dirClips.length > 0) {
456
- const baseSlash = b.actor ? `${b.actor}/${b.clip}` : b.clip;
457
- const baseUnder = b.actor ? `${b.actor}_${b.clip}` : b.clip;
484
+ const baseSlash = withNs(b.actor ? `${b.actor}/${b.clip}` : b.clip);
485
+ const baseUnder = withNs(b.actor ? `${b.actor}_${b.clip}` : b.clip);
458
486
  const aliases = [baseUnder];
459
- if (canBareAlias) aliases.push(`${bare}/${b.clip}`, `${bare}_${b.clip}`);
487
+ if (canBareAlias) aliases.push(withNs(`${bare}/${b.clip}`), withNs(`${bare}_${b.clip}`));
460
488
  this.registerAlias(baseSlash, dirClips[0]);
461
489
  this.registerAlias(baseUnder, dirClips[0]);
462
490
  if (canBareAlias) {
463
- this.registerAlias(`${bare}/${b.clip}`, dirClips[0]);
464
- this.registerAlias(`${bare}_${b.clip}`, dirClips[0]);
491
+ this.registerAlias(withNs(`${bare}/${b.clip}`), dirClips[0]);
492
+ this.registerAlias(withNs(`${bare}_${b.clip}`), dirClips[0]);
465
493
  }
466
494
  this.registerDirectionalGroup({
467
495
  baseKey: baseSlash,
@@ -474,6 +502,10 @@ var AnimationManager = class {
474
502
  }, aliases);
475
503
  }
476
504
  }
505
+ if (overwrittenKeys.length > 0 && !options.overwrite) {
506
+ const sample = overwrittenKeys.slice(0, 3).join(", ");
507
+ console.warn(`Stage anims.createFromAtlas("${textureKey}"): overwrote ${overwrittenKeys.length} existing animation key(s) from "${overwrittenFromTex ?? "unknown"}" (${sample}${overwrittenKeys.length > 3 ? ", ..." : ""}); pass { prefix } to namespace or { overwrite: true } to silence.`);
508
+ }
477
509
  return created;
478
510
  }
479
511
  };
@@ -1,4 +1,4 @@
1
- import { I as ScaleMode, M as Matrix2D, N as Rect2D, O as EventEmitter, P as RgbaColor, R as TintMode, S as TextureSource, T as BlendMode, U as WorldView2D, _ as SpriteSheetConfig, d as AtlasJsonLike, g as GlTextureHost, p as Frame, r as AnimationManager, u as StageAnimation, v as Texture, x as TextureManager, y as TextureImageOptions } from "./anims-xOSYNG79.js";
1
+ import { I as ScaleMode, M as Matrix2D, N as Rect2D, O as EventEmitter, P as RgbaColor, R as TintMode, S as TextureSource, T as BlendMode, U as WorldView2D, _ as SpriteSheetConfig, d as AtlasJsonLike, g as GlTextureHost, p as Frame, r as AnimationManager, u as StageAnimation, v as Texture, x as TextureManager, y as TextureImageOptions } from "./anims-D9N8w6IM.js";
2
2
  import { c as TweenManager, u as TweenStats } from "./tween-BiF1FUvc.js";
3
3
  interface CameraFollowOptions {
4
4
  /** Horizontal smoothing factor in `(0, 1]` (`1` = instant lock; default `1`). */
@@ -155,6 +155,12 @@ declare class Camera {
155
155
  stepFollow(deltaMs: number): void;
156
156
  /** Recompute `worldView` and world->canvas `matrixCombined`. */
157
157
  syncMetrics(): void;
158
+ /**
159
+ * Compute the world/HUD -> backing-canvas transform matrix for a root node with `(scrollFactorX, scrollFactorY)`,
160
+ * honoring `configureHiDpi()` (`this.dpr`) so `scrollFactor = 0` HUDs, `mountStage25D.root`, and lightmap overlays
161
+ * remain anchored at logical `(0, 0)..(viewportW, viewportH)` on 2x/3x Retina displays.
162
+ */
163
+ matrixForScrollFactor(sfX: number, sfY: number, out: Matrix2D): Matrix2D;
158
164
  }
159
165
  type DisplayObjectType = 'Image' | 'Sprite' | 'NineSlice' | 'TileSprite' | 'Rectangle' | 'Panel' | 'MsdfIcon' | 'Text' | 'Graphics' | 'Blitter' | 'InstancedBatch' | 'ShapeBatch' | 'Container' | 'CustomPass';
160
166
  type SceneHostLike = Scene;
@@ -1,7 +1,7 @@
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-BZ3J971y.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-CZb3yen0.js";
3
+ import { i as Camera, r as Renderer2D, t as RendererWebGpu } from "./renderer-webgpu-CHw-NNh2.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";
5
5
  import { TweenManager } from "./tween.js";
6
6
  import { StageKernel } from "./kernel.js";
7
7
  // src/texture.ts
@@ -365,12 +365,13 @@ var TextureManager = class {
365
365
  if (typeof root.scale === "number" && Number.isFinite(root.scale)) tex.atlasScale = root.scale;
366
366
  const rawFrames = root.frames ?? atlasData.frames;
367
367
  if (!rawFrames) return tex;
368
+ let probeCanvas = null;
368
369
  let probeCtx = null;
369
370
  const emptyRectCache = /* @__PURE__ */ new Map();
370
371
  const detectEmptyRect = (fx, fy, fw, fh, explicitEmpty) => {
371
372
  if (typeof explicitEmpty === "boolean") return explicitEmpty;
372
373
  if (fw <= 1 && fh <= 1) return true;
373
- if (fw > 4 || fh > 4) return false;
374
+ if (fw > 64 || fh > 64) return false;
374
375
  const rectKey = `${fx},${fy},${fw},${fh}`;
375
376
  const cached = emptyRectCache.get(rectKey);
376
377
  if (cached !== void 0) return cached;
@@ -378,10 +379,10 @@ var TextureManager = class {
378
379
  try {
379
380
  if (probeCtx === null) {
380
381
  if (this.doc && typeof this.doc.createElement === "function") {
381
- const pc = this.doc.createElement("canvas");
382
- pc.width = 4;
383
- pc.height = 4;
384
- probeCtx = pc.getContext("2d", { willReadFrequently: true }) ?? false;
382
+ probeCanvas = this.doc.createElement("canvas");
383
+ probeCanvas.width = 64;
384
+ probeCanvas.height = 64;
385
+ probeCtx = probeCanvas.getContext("2d", { willReadFrequently: true }) ?? false;
385
386
  } else probeCtx = false;
386
387
  }
387
388
  if (probeCtx) {
@@ -4106,21 +4107,7 @@ var RendererGl = class extends EventEmitter {
4106
4107
  let baseMat = parentMat;
4107
4108
  if (!baseMat) {
4108
4109
  if (obj.scrollFactorX === 1 && obj.scrollFactorY === 1) baseMat = camera.matrixCombined;
4109
- else {
4110
- const z = camera.zoom || 1;
4111
- const ox = camera.width * camera.originX;
4112
- const oy = camera.height * camera.originY;
4113
- const sx = camera.roundPixels ? Math.round(camera.scrollX) : camera.scrollX;
4114
- const sy = camera.roundPixels ? Math.round(camera.scrollY) : camera.scrollY;
4115
- const sm = this.sfMat;
4116
- sm.a = z;
4117
- sm.b = 0;
4118
- sm.c = 0;
4119
- sm.d = z;
4120
- sm.tx = (-sx * obj.scrollFactorX - ox) * z + ox + camera.x;
4121
- sm.ty = (-sy * obj.scrollFactorY - oy) * z + oy + camera.y;
4122
- baseMat = sm;
4123
- }
4110
+ else baseMat = camera.matrixForScrollFactor(obj.scrollFactorX, obj.scrollFactorY, this.sfMat);
4124
4111
  }
4125
4112
  let m;
4126
4113
  if (obj.x === 0 && obj.y === 0 && obj.scaleX === 1 && obj.scaleY === 1 && obj.rotation === 0 && obj.skewX === 0 && obj.skewY === 0) m = baseMat;
@@ -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-BbgtwqyW.js";
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-B_hIy548.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;
package/dist/headless.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./types-CXsCvp1p.js";
2
- import { n as Game } from "./game-CUZbJLbR.js";
2
+ import { n as Game } from "./game-BnozPxF8.js";
3
3
  import { buildSceneDigest } from "./trace.js";
4
4
  // src/headless.ts
5
5
  function createVirtualDomHost(createCanvas, width, height) {
@@ -123,29 +123,33 @@ function createHeadlessStage(options) {
123
123
  return game.clock.snapshot();
124
124
  };
125
125
  const toRgbaInto = (out) => {
126
- const byteLen = width * height * 4;
126
+ const cw = rootCanvas.width || width;
127
+ const ch = rootCanvas.height || height;
128
+ const byteLen = cw * ch * 4;
127
129
  const dst = out && out.byteLength >= byteLen ? out : new Uint8Array(byteLen);
128
130
  if (game.renderer.type === 2 && game.renderer.gl) {
129
131
  const gl = game.renderer.gl;
130
- gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, dst);
132
+ gl.readPixels(0, 0, cw, ch, gl.RGBA, gl.UNSIGNED_BYTE, dst);
131
133
  return dst;
132
134
  }
133
135
  const ctx = rootCanvas.getContext("2d");
134
136
  if (!ctx) throw new Error("HeadlessStage.toRgbaInto: 2D context unavailable");
135
- const img = ctx.getImageData(0, 0, width, height);
137
+ const img = ctx.getImageData(0, 0, cw, ch);
136
138
  dst.set(img.data.subarray(0, byteLen));
137
139
  return dst;
138
140
  };
139
141
  const toRgba = () => {
142
+ const cw = rootCanvas.width || width;
143
+ const ch = rootCanvas.height || height;
140
144
  if (game.renderer.type === 2 && game.renderer.gl) {
141
145
  const gl = game.renderer.gl;
142
- const out = new Uint8Array(width * height * 4);
143
- gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, out);
146
+ const out = new Uint8Array(cw * ch * 4);
147
+ gl.readPixels(0, 0, cw, ch, gl.RGBA, gl.UNSIGNED_BYTE, out);
144
148
  return out;
145
149
  }
146
150
  const ctx = rootCanvas.getContext("2d");
147
151
  if (!ctx) throw new Error("HeadlessStage.toRgba: 2D context unavailable");
148
- const img = ctx.getImageData(0, 0, width, height);
152
+ const img = ctx.getImageData(0, 0, cw, ch);
149
153
  return new Uint8Array(img.data.buffer, img.data.byteOffset, img.data.byteLength);
150
154
  };
151
155
  const toPng = () => {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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-BbgtwqyW.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-xOSYNG79.js";
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-B_hIy548.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
3
  import { FlexAlign, FlexContainerSpec, FlexDir, FlexItemRect, FlexItemSpec, FlexJustify, FlexPadding, FlexResult, WrapContainerSpec, WrapItemRect, WrapItemSpec, WrapJustify, WrapResult, computeFlexLayout, computeWrapLayout, 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
5
  import { JoystickDpad, JoystickDpadOptions, JoystickState, JoystickVector, JoystickViewport, JoystickZone, JoystickZonePredicate, JoystickZoneRect, VirtualJoystick, VirtualJoystickMode, VirtualJoystickOptions, VirtualJoystickStyle, clampJoystickOrigin, computeJoystickVector, isInJoystickZone, pullJoystickOrigin, quantizeJoystickDpad } from "./joystick.js";
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
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-CUZbJLbR.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-BnozPxF8.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-BZ3J971y.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-CZb3yen0.js";
4
+ import { i as Camera, n as requestWebGpuDevice, r as Renderer2D, t as RendererWebGpu } from "./renderer-webgpu-CHw-NNh2.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";
6
6
  import { ActionMap, StageKernel, createInputRecorder, createInputReplay, createInputTimeline } from "./kernel.js";
7
7
  import { buildSceneDigest, sanitizeTrackToken } from "./trace.js";
8
8
  import { computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
@@ -1,4 +1,4 @@
1
- import { J as Pointer, jt as PanelObject, pt as Container, u as Scene } from "./game-BbgtwqyW.js";
1
+ import { J as Pointer, jt as PanelObject, pt as Container, u as Scene } from "./game-B_hIy548.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,2 @@
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-BbgtwqyW.js";
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-B_hIy548.js";
2
2
  export { ActionMap, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, 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-BbgtwqyW.js";
1
+ import { It as SceneHostLike, Tt as ImageObject, bt as DisplayObject, gt as CustomPassObject, pt as Container } from "./game-B_hIy548.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-CZb3yen0.js";
2
+ import { c as InstancedBatchObject } from "./display-DU4edtH-.js";
3
3
  // src/lighting.ts
4
4
  function lerpChannel(a, b, t) {
5
5
  return Math.round(a + (b - a) * t) & 255;
@@ -303,15 +303,16 @@ function computeNodeScreenMatrix(node, scene, out) {
303
303
  break;
304
304
  }
305
305
  const cam = scene.cameras.main;
306
+ const invDpr = cam.dpr > 0 && cam.dpr !== 1 ? 1 / cam.dpr : 1;
306
307
  if (sfX === 1 && sfY === 1) {
307
308
  cam.syncMetrics();
308
309
  const cm = cam.matrixCombined;
309
- const na = cm.a * out.a + cm.c * out.b;
310
- const nb = cm.b * out.a + cm.d * out.b;
311
- const nc = cm.a * out.c + cm.c * out.d;
312
- const nd = cm.b * out.c + cm.d * out.d;
313
- const ntx = cm.a * out.tx + cm.c * out.ty + cm.tx;
314
- const nty = cm.b * out.tx + cm.d * out.ty + cm.ty;
310
+ const na = (cm.a * out.a + cm.c * out.b) * invDpr;
311
+ const nb = (cm.b * out.a + cm.d * out.b) * invDpr;
312
+ const nc = (cm.a * out.c + cm.c * out.d) * invDpr;
313
+ const nd = (cm.b * out.c + cm.d * out.d) * invDpr;
314
+ const ntx = (cm.a * out.tx + cm.c * out.ty + cm.tx) * invDpr;
315
+ const nty = (cm.b * out.tx + cm.d * out.ty + cm.ty) * invDpr;
315
316
  out.a = na;
316
317
  out.b = nb;
317
318
  out.c = nc;
@@ -319,19 +320,14 @@ function computeNodeScreenMatrix(node, scene, out) {
319
320
  out.tx = ntx;
320
321
  out.ty = nty;
321
322
  } else if (sfX !== 0 || sfY !== 0) {
322
- const z = cam.zoom || 1;
323
- const ox = cam.width * cam.originX;
324
- const oy = cam.height * cam.originY;
325
- const sx = cam.roundPixels ? Math.round(cam.scrollX) : cam.scrollX;
326
- const sy = cam.roundPixels ? Math.round(cam.scrollY) : cam.scrollY;
327
- const tx = (-sx * sfX - ox) * z + ox + cam.x;
328
- const ty = (-sy * sfY - oy) * z + oy + cam.y;
329
- out.a *= z;
330
- out.b *= z;
331
- out.c *= z;
332
- out.d *= z;
333
- out.tx = out.tx * z + tx;
334
- out.ty = out.ty * z + ty;
323
+ const sm = createMatrix2D();
324
+ cam.matrixForScrollFactor(sfX, sfY, sm);
325
+ out.a = out.a * sm.a * invDpr;
326
+ out.b = out.b * sm.d * invDpr;
327
+ out.c = out.c * sm.a * invDpr;
328
+ out.d = out.d * sm.d * invDpr;
329
+ out.tx = (out.tx * sm.a + sm.tx) * invDpr;
330
+ out.ty = (out.ty * sm.d + sm.ty) * invDpr;
335
331
  }
336
332
  out.scaleX = Math.hypot(out.a, out.b);
337
333
  out.scaleY = Math.hypot(out.c, out.d);
@@ -1,4 +1,4 @@
1
- import { It as SceneHostLike, bt as DisplayObject, pt as Container } from "./game-BbgtwqyW.js";
1
+ import { It as SceneHostLike, bt as DisplayObject, pt as Container } from "./game-B_hIy548.js";
2
2
  export interface Camera25DConfig {
3
3
  viewportWidth: number;
4
4
  viewportHeight: number;
@@ -306,6 +306,32 @@ var Camera = class {
306
306
  m.scaleX = z;
307
307
  m.scaleY = z;
308
308
  }
309
+ /**
310
+ * Compute the world/HUD -> backing-canvas transform matrix for a root node with `(scrollFactorX, scrollFactorY)`,
311
+ * honoring `configureHiDpi()` (`this.dpr`) so `scrollFactor = 0` HUDs, `mountStage25D.root`, and lightmap overlays
312
+ * remain anchored at logical `(0, 0)..(viewportW, viewportH)` on 2x/3x Retina displays.
313
+ */
314
+ matrixForScrollFactor(sfX, sfY, out) {
315
+ const z = this.zoom || 1;
316
+ const dpr = this.dpr > 0 ? this.dpr : 1;
317
+ const ox = this.width * this.originX;
318
+ const oy = this.height * this.originY;
319
+ const sx = this.roundPixels ? Math.round(this.scrollX) : this.scrollX;
320
+ const sy = this.roundPixels ? Math.round(this.scrollY) : this.scrollY;
321
+ const sx0 = dpr !== 1 ? ox / dpr - ox : 0;
322
+ const sy0 = dpr !== 1 ? oy / dpr - oy : 0;
323
+ const effSx = (sx - sx0) * sfX + sx0;
324
+ const effSy = (sy - sy0) * sfY + sy0;
325
+ out.a = z;
326
+ out.b = 0;
327
+ out.c = 0;
328
+ out.d = z;
329
+ out.tx = (-effSx - ox) * z + ox + this.x;
330
+ out.ty = (-effSy - oy) * z + oy + this.y;
331
+ out.scaleX = z;
332
+ out.scaleY = z;
333
+ return out;
334
+ }
309
335
  };
310
336
  // src/renderer-2d.ts
311
337
  function addPerCornerRoundedRectSubpath(ctx, x, y, w, h, tl, tr, br, bl) {
@@ -1382,21 +1408,7 @@ var Renderer2D = class Renderer2D extends EventEmitter {
1382
1408
  let baseMat;
1383
1409
  if (parentMat === null) {
1384
1410
  if (obj.scrollFactorX === 1 && obj.scrollFactorY === 1) baseMat = camera.matrixCombined;
1385
- else {
1386
- const z = camera.zoom || 1;
1387
- const ox = camera.width * camera.originX;
1388
- const oy = camera.height * camera.originY;
1389
- const sx = camera.roundPixels ? Math.round(camera.scrollX) : camera.scrollX;
1390
- const sy = camera.roundPixels ? Math.round(camera.scrollY) : camera.scrollY;
1391
- const rm = this.rootScrollMat;
1392
- rm.a = z;
1393
- rm.b = 0;
1394
- rm.c = 0;
1395
- rm.d = z;
1396
- rm.tx = (-sx * obj.scrollFactorX - ox) * z + ox + camera.x;
1397
- rm.ty = (-sy * obj.scrollFactorY - oy) * z + oy + camera.y;
1398
- baseMat = rm;
1399
- }
1411
+ else baseMat = camera.matrixForScrollFactor(obj.scrollFactorX, obj.scrollFactorY, this.rootScrollMat);
1400
1412
  } else baseMat = parentMat;
1401
1413
  while (depth >= this.matPool.length) this.matPool.push(createMatrix2D());
1402
1414
  const m = this.mulMat(baseMat, obj.x, obj.y, obj.scaleX, obj.scaleY, obj.rotation, this.matPool[depth], obj.skewX, obj.skewY);
@@ -2501,21 +2513,7 @@ var RendererWebGpu = class extends EventEmitter {
2501
2513
  let baseMat = parentMat;
2502
2514
  if (!baseMat) {
2503
2515
  if (obj.scrollFactorX === 1 && obj.scrollFactorY === 1) baseMat = camera.matrixCombined;
2504
- else {
2505
- const z = camera.zoom || 1;
2506
- const ox = camera.width * camera.originX;
2507
- const oy = camera.height * camera.originY;
2508
- const sx = camera.roundPixels ? Math.round(camera.scrollX) : camera.scrollX;
2509
- const sy = camera.roundPixels ? Math.round(camera.scrollY) : camera.scrollY;
2510
- const sm = this.sfMat;
2511
- sm.a = z;
2512
- sm.b = 0;
2513
- sm.c = 0;
2514
- sm.d = z;
2515
- sm.tx = (-sx * obj.scrollFactorX - ox) * z + ox + camera.x;
2516
- sm.ty = (-sy * obj.scrollFactorY - oy) * z + oy + camera.y;
2517
- baseMat = sm;
2518
- }
2516
+ else baseMat = camera.matrixForScrollFactor(obj.scrollFactorX, obj.scrollFactorY, this.sfMat);
2519
2517
  }
2520
2518
  let m;
2521
2519
  if (obj.x === 0 && obj.y === 0 && obj.scaleX === 1 && obj.scaleY === 1 && obj.rotation === 0 && obj.skewX === 0 && obj.skewY === 0) m = baseMat;
@@ -1,2 +1,2 @@
1
- import { $ as WebGpuBootstrapResult, Q as RequestWebGpuOptions, X as RendererWebGpu, Z as RendererWebGpuOptions, et as WebGpuCanvasContextLike, nt as requestWebGpuDevice, tt as WebGpuDeviceLike } from "./game-BbgtwqyW.js";
1
+ import { $ as WebGpuBootstrapResult, Q as RequestWebGpuOptions, X as RendererWebGpu, Z as RendererWebGpuOptions, et as WebGpuCanvasContextLike, nt as requestWebGpuDevice, tt as WebGpuDeviceLike } from "./game-B_hIy548.js";
2
2
  export { RendererWebGpu, RendererWebGpuOptions, RequestWebGpuOptions, WebGpuBootstrapResult, WebGpuCanvasContextLike, WebGpuDeviceLike, requestWebGpuDevice };
@@ -1 +1 @@
1
- export { t as RendererWebGpu, n as requestWebGpuDevice } from "./renderer-webgpu-BZ3J971y.js";
1
+ export { t as RendererWebGpu, n as requestWebGpuDevice } from "./renderer-webgpu-CHw-NNh2.js";
package/dist/rig2d.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as BlendMode } from "./anims-xOSYNG79.js";
2
- import { It as SceneHostLike, Tt as ImageObject, pt as Container, wt as Graphics } from "./game-BbgtwqyW.js";
1
+ import { T as BlendMode } from "./anims-D9N8w6IM.js";
2
+ import { It as SceneHostLike, Tt as ImageObject, pt as Container, wt as Graphics } from "./game-B_hIy548.js";
3
3
  export type RigCurveKind = 'linear' | 'step' | 'smoothstep' | 'outBack';
4
4
  export interface RigBoneDef {
5
5
  name: string;
package/dist/tilemap.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { It as SceneHostLike, dt as BlitterObject, pt as Container } from "./game-BbgtwqyW.js";
1
+ import { It as SceneHostLike, dt as BlitterObject, pt as Container } from "./game-B_hIy548.js";
2
2
  /** Pack signed 16-bit chunk coordinates `[-32768..32767]` into a single 32-bit integer Map key (zero string allocation). */
3
3
  export declare function packChunkKey(cx: number, cy: number): number;
4
4
  export declare function unpackChunkX(key: number): number;
package/dist/trace.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { B as SceneDigestSurfaceEntry, F as SceneDigestEngineSandbox, H as SceneDigestSurfaces, I as SceneDigestNode, L as SceneDigestOptions, N as SceneDigest, P as SceneDigestActiveFocus, R as SceneDigestOverlayStats, U as buildSceneDigest, V as SceneDigestSurfaceSource, W as sanitizeTrackToken, z as SceneDigestSandbox } from "./game-BbgtwqyW.js";
1
+ import { B as SceneDigestSurfaceEntry, F as SceneDigestEngineSandbox, H as SceneDigestSurfaces, I as SceneDigestNode, L as SceneDigestOptions, N as SceneDigest, P as SceneDigestActiveFocus, R as SceneDigestOverlayStats, U as buildSceneDigest, V as SceneDigestSurfaceSource, W as sanitizeTrackToken, z as SceneDigestSandbox } from "./game-B_hIy548.js";
2
2
  export { SceneDigest, SceneDigestActiveFocus, SceneDigestEngineSandbox, SceneDigestNode, SceneDigestOptions, SceneDigestOverlayStats, SceneDigestSandbox, SceneDigestSurfaceEntry, SceneDigestSurfaceSource, SceneDigestSurfaces, buildSceneDigest, sanitizeTrackToken };
package/llms.txt CHANGED
@@ -7,7 +7,7 @@
7
7
  - [Official Docs & Live Playground](https://holt.js.org): Interactive KAPLAY-green playground, WebGPU & Kernel guide, 2.5D Survival Sandbox guide, and subpath references.
8
8
  - [README](https://github.com/botiverse-play/stage/blob/main/README.md): Overview, install, 21-subpath table, quick starts for WebGPU, `StageKernel`, 60 FPS video, and 2.5D survival games.
9
9
  - [Architecture](https://github.com/botiverse-play/stage/blob/main/docs/architecture.md): WebGPU/WebGL2/Canvas2D batchers, `StageKernel`, DPR/camera contracts, LIFO disposal, `SurfaceTree`, tracing-first observability.
10
- - [Changelog](https://github.com/botiverse-play/stage/blob/main/CHANGELOG.md): Release history (`0.1.0` – `0.10.0`).
10
+ - [Changelog](https://github.com/botiverse-play/stage/blob/main/CHANGELOG.md): Release history (`0.1.0` – `0.10.1`).
11
11
  - [Contributing](https://github.com/botiverse-play/stage/blob/main/CONTRIBUTING.md): Setup, invariants, verification gate, PR guidelines.
12
12
 
13
13
  ## AI Agent Skills & Instructions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holtjs/stage",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "Zero-dependency TypeScript stage engine for 2D WebGPU/WebGL2/Canvas2D games, GPU SDF UI, procedural audio, StageKernel plugins, tracing-native observability, and deterministic 60 FPS headless image & video rendering.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Botiverse, Inc.",
@@ -5,7 +5,7 @@ description: Build zero-dependency WebGPU/WebGL2/Canvas2D 2D & 2.5D games, GPU S
5
5
 
6
6
  # Building 2D/2.5D Games, WebGPU UI & 60 FPS Video with `@holtjs/stage`
7
7
 
8
- Use this skill whenever creating or modifying a browser 2D/2.5D game, WebGPU/WebGL2 canvas UI, survival sandbox, automated `InputTimeline` test, or pure-Node headless image/storyboard/60 FPS video pipeline built on `@holtjs/stage` (`v0.10.0`, 21 subpaths).
8
+ Use this skill whenever creating or modifying a browser 2D/2.5D game, WebGPU/WebGL2 canvas UI, survival sandbox, automated `InputTimeline` test, or pure-Node headless image/storyboard/60 FPS video pipeline built on `@holtjs/stage` (`v0.10.1`, 21 subpaths).
9
9
 
10
10
  For the exhaustive exported symbol list across all 21 subpaths, see [references/subpaths.md](references/subpaths.md).
11
11
 
@@ -1,6 +1,6 @@
1
1
  # `@holtjs/stage` Subpath API Quick Reference
2
2
 
3
- All symbols verified against `src/*.ts` (`@holtjs/stage@0.10.0`, 21 subpaths).
3
+ All symbols verified against `src/*.ts` (`@holtjs/stage@0.10.1`, 21 subpaths).
4
4
 
5
5
  ## `@holtjs/stage` (~71.3 kB gz · Core Engine Barrel)
6
6
  - **Bootstrap & Lifecycle**: `Stage` / `Stage2D` (namespaces), `AUTO`, `WEBGPU`, `WEBGL`, `CANVAS`, `Scale` (`NONE`, `FIT`, `RESIZE`), `Scenes`, `Game` (`.stepSimOnly()`, `.kernel`, `.anims`), `Scene` (`.update()` simulation + `.preRender()` presentation, `.anims`), `SceneManager`, `ScaleManager` (`.fitToContainer()`), `GameLoop`, `EngineClock`, `LoaderPlugin` (`.atlas()`), `JsonCache`, `GameObjectFactory` (`scene.add.sprite`, `shapeBatch`, `instancedBatch`, `customPass`, `panel`, `blitter`, etc.), `AnimationManager` (`.create()`, `.createFromAtlas()`, `.generateFrameNames()`, `.generateFrameNumbers()`)
@@ -10,8 +10,8 @@ All symbols verified against `src/*.ts` (`@holtjs/stage@0.10.0`, 21 subpaths).
10
10
  - **Math & Color**: `BlendModes` (`NORMAL`, `ADD`, `MULTIPLY`, `SCREEN`), `TintModes`, `FilterMode`, `WHITE_RGB`, `BLACK_RGB`, `HEX_MASK`, `createMatrix2D`, `parseColor`, `rgbToCss`, `packColorAbgr`
11
11
  - **Bundled UI/Observability Re-exports**: `computeFlexLayout`, `computeWrapLayout`, `resolvePadding`, `Easings`, `TweenManager`, `VirtualJoystick`, `clampJoystickOrigin`, `computeJoystickVector`, `isInJoystickZone`, `pullJoystickOrigin`, `quantizeJoystickDpad`, `SURFACE_BAND`, `createSurfaceTree`, `resolveSurfacePriority`, `surfacePriorityToDomZ`, `computeSurfaceDomZ`, `buildSceneDigest`, `sanitizeTrackToken`
12
12
 
13
- ## `@holtjs/stage/anims` (~2.9 kB gz · zero DOM)
14
- - `AnimationManager`: `.create(cfg)`, `.createFromAtlas(textureKey, { defaultFrameRate?, defaultRepeat?, clips?, inheritFrom? })`, `.generateFrameNames(key, cfg?)`, `.generateFrameNumbers(key, cfg?)`, `.exists(key)`, `.get(key)`, `.getDirectionalGroup(baseKey)`, `.listKeys()`, `.listDirectionalGroups()`
13
+ ## `@holtjs/stage/anims` (~3.1 kB gz · zero DOM)
14
+ - `AnimationManager`: `.create(cfg)`, `.createFromAtlas(textureKey, { defaultFrameRate?, defaultRepeat?, clips?, inheritFrom?, prefix?, overwrite? })`, `.generateFrameNames(key, cfg?)`, `.generateFrameNumbers(key, cfg?)`, `.exists(key)`, `.get(key)`, `.getDirectionalGroup(baseKey)`, `.listKeys()`, `.listDirectionalGroups()`
15
15
  - Types: `AnimationFrameInput`, `CompiledAnimationFrame`, `AnimationConfig`, `StageAnimation`, `GenerateFrameNamesConfig`, `GenerateFrameNumbersConfig`, `AtlasClipRule`, `AtlasAutoAnimOptions`, `DirectionalAnimGroup`
16
16
 
17
17
  ## `@holtjs/stage/webgpu` (~15.4 kB gz · Native WebGPU Renderer)
@@ -985,6 +985,17 @@ var SpriteObject = class extends ImageObject {
985
985
  },
986
986
  sync: () => {
987
987
  if (!target.active || !this.active) return false;
988
+ target.x = this.x + offsetX;
989
+ target.y = this.y + offsetY;
990
+ target.flipX = this.flipX;
991
+ target.flipY = this.flipY;
992
+ target.scaleX = this.scaleX;
993
+ target.scaleY = this.scaleY;
994
+ target.rotation = this.rotation;
995
+ target.skewX = this.skewX;
996
+ target.skewY = this.skewY;
997
+ target.alpha = this.alpha * alphaMul;
998
+ if (zOffset !== false) target.setZIndex(this.zIndex + zOffset);
988
999
  if (!binding.enabled || !curPrefix || !this.visible) {
989
1000
  target.visible = false;
990
1001
  return false;
@@ -1007,17 +1018,6 @@ var SpriteObject = class extends ImageObject {
1007
1018
  return false;
1008
1019
  }
1009
1020
  target.visible = true;
1010
- target.x = this.x + offsetX;
1011
- target.y = this.y + offsetY;
1012
- target.flipX = this.flipX;
1013
- target.flipY = this.flipY;
1014
- target.scaleX = this.scaleX;
1015
- target.scaleY = this.scaleY;
1016
- target.rotation = this.rotation;
1017
- target.skewX = this.skewX;
1018
- target.skewY = this.skewY;
1019
- target.alpha = this.alpha * alphaMul;
1020
- if (zOffset !== false) target.setZIndex(this.zIndex + zOffset);
1021
1021
  return true;
1022
1022
  },
1023
1023
  destroy: () => {