@holtjs/stage 0.9.0 → 0.10.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,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
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-C_NPwPrE.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";
5
5
  import { TweenManager } from "./tween.js";
6
6
  import { StageKernel } from "./kernel.js";
7
7
  // src/texture.ts
@@ -98,10 +98,13 @@ var Frame = class {
98
98
  emissiveCenter = null;
99
99
  emissivePower = 0;
100
100
  actor = null;
101
+ baseActor = null;
101
102
  clip = null;
102
103
  dir = null;
103
104
  animFrameIndex = null;
104
105
  animLoop = void 0;
106
+ /** True when the frame contains zero visible pixels (`1x1` cell, `<=4x4` all-transparent placeholder, or explicit `empty: true`). */
107
+ empty = false;
105
108
  constructor(texture, name, sourceIndex, x, y, w, h, meta) {
106
109
  this.texture = texture;
107
110
  this.name = name;
@@ -117,6 +120,7 @@ var Frame = class {
117
120
  this.cutHeight = height;
118
121
  this.width = width;
119
122
  this.height = height;
123
+ if (width <= 0 || height <= 0) this.empty = true;
120
124
  if (!this.customPivot) {
121
125
  this.pixelPivotX = width * this.pivotX;
122
126
  this.pixelPivotY = height * this.pivotY;
@@ -142,12 +146,22 @@ var Frame = class {
142
146
  this.pivotY = this.height > 0 ? ay / this.height : .5;
143
147
  return this;
144
148
  }
145
- /** Attach or update a named pixel socket `(x, y)` (with optional projected `angleRad` & front/back `zBias`). */
146
- setAnchor(name, x, y, angleRad, zBias) {
149
+ /** Attach or update a named pixel socket `(x, y)` (with optional `angleRad`, `zBias`, and 2x2 projected basis `[ux, uy, vx, vy]`). */
150
+ setAnchor(name, x, y, angleRad, zBias, ux, uy, vx, vy) {
147
151
  if (!this.anchors) this.anchors = Object.create(null);
148
152
  if (typeof angleRad === "number" && Number.isFinite(angleRad)) {
149
153
  const zb = typeof zBias === "number" && Number.isFinite(zBias) ? zBias >= 0 ? 1 : -1 : 1;
150
- this.anchors[name] = [
154
+ if (typeof ux === "number" && Number.isFinite(ux) && typeof uy === "number" && Number.isFinite(uy) && typeof vx === "number" && Number.isFinite(vx) && typeof vy === "number" && Number.isFinite(vy)) this.anchors[name] = [
155
+ x,
156
+ y,
157
+ angleRad,
158
+ zb,
159
+ ux,
160
+ uy,
161
+ vx,
162
+ vy
163
+ ];
164
+ else this.anchors[name] = [
151
165
  x,
152
166
  y,
153
167
  angleRad,
@@ -166,16 +180,20 @@ var Frame = class {
166
180
  if (typeof meta.ax === "number" && typeof meta.ay === "number") this.setPixelPivot(meta.ax, meta.ay);
167
181
  else if (typeof meta.pivotX === "number" || typeof meta.pivotY === "number") this.setPivot(meta.pivotX ?? .5, meta.pivotY ?? .5);
168
182
  if (meta.anchors) {
169
- for (const [k, pt] of Object.entries(meta.anchors)) if (Array.isArray(pt) && pt.length >= 2) this.setAnchor(k, Number(pt[0]) || 0, Number(pt[1]) || 0, pt.length >= 3 && typeof pt[2] === "number" ? Number(pt[2]) : void 0, pt.length >= 4 && typeof pt[3] === "number" ? Number(pt[3]) : void 0);
183
+ for (const [k, pt] of Object.entries(meta.anchors)) if (Array.isArray(pt) && pt.length >= 2) this.setAnchor(k, Number(pt[0]) || 0, Number(pt[1]) || 0, pt.length >= 3 && typeof pt[2] === "number" ? Number(pt[2]) : void 0, pt.length >= 4 && typeof pt[3] === "number" ? Number(pt[3]) : void 0, pt.length >= 8 && typeof pt[4] === "number" ? Number(pt[4]) : void 0, pt.length >= 8 && typeof pt[5] === "number" ? Number(pt[5]) : void 0, pt.length >= 8 && typeof pt[6] === "number" ? Number(pt[6]) : void 0, pt.length >= 8 && typeof pt[7] === "number" ? Number(pt[7]) : void 0);
170
184
  }
171
185
  if (Array.isArray(meta.emissiveCenter) && meta.emissiveCenter.length >= 2) this.emissiveCenter = [Number(meta.emissiveCenter[0]) || 0, Number(meta.emissiveCenter[1]) || 0];
172
186
  if (typeof meta.emissivePower === "number") this.emissivePower = meta.emissivePower;
173
187
  const actor = meta.actor ?? meta.char;
174
188
  if (typeof actor === "string" && actor.length > 0) this.actor = actor;
189
+ const baseActor = meta.baseActor ?? meta.baseChar;
190
+ if (typeof baseActor === "string" && baseActor.length > 0) this.baseActor = baseActor;
175
191
  if (typeof meta.clip === "string" && meta.clip.length > 0) this.clip = meta.clip;
176
192
  if (typeof meta.dir === "number" || typeof meta.dir === "string") this.dir = meta.dir;
177
193
  if (typeof meta.frame === "number" && Number.isFinite(meta.frame)) this.animFrameIndex = meta.frame;
178
194
  if (typeof meta.loop === "boolean") this.animLoop = meta.loop;
195
+ if (typeof meta.empty === "boolean") this.empty = meta.empty;
196
+ else if (this.cutWidth <= 1 && this.cutHeight <= 1) this.empty = true;
179
197
  return this;
180
198
  }
181
199
  updateUVs() {
@@ -347,6 +365,42 @@ var TextureManager = class {
347
365
  if (typeof root.scale === "number" && Number.isFinite(root.scale)) tex.atlasScale = root.scale;
348
366
  const rawFrames = root.frames ?? atlasData.frames;
349
367
  if (!rawFrames) return tex;
368
+ let probeCtx = null;
369
+ const emptyRectCache = /* @__PURE__ */ new Map();
370
+ const detectEmptyRect = (fx, fy, fw, fh, explicitEmpty) => {
371
+ if (typeof explicitEmpty === "boolean") return explicitEmpty;
372
+ if (fw <= 1 && fh <= 1) return true;
373
+ if (fw > 4 || fh > 4) return false;
374
+ const rectKey = `${fx},${fy},${fw},${fh}`;
375
+ const cached = emptyRectCache.get(rectKey);
376
+ if (cached !== void 0) return cached;
377
+ let isEmpty = false;
378
+ try {
379
+ if (probeCtx === null) {
380
+ 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;
385
+ } else probeCtx = false;
386
+ }
387
+ if (probeCtx) {
388
+ probeCtx.clearRect(0, 0, fw, fh);
389
+ probeCtx.drawImage(source, fx, fy, fw, fh, 0, 0, fw, fh);
390
+ const data = probeCtx.getImageData(0, 0, fw, fh).data;
391
+ let allZero = true;
392
+ for (let i = 3; i < data.length; i += 4) if (data[i] !== 0) {
393
+ allZero = false;
394
+ break;
395
+ }
396
+ isEmpty = allZero;
397
+ }
398
+ } catch {
399
+ isEmpty = false;
400
+ }
401
+ emptyRectCache.set(rectKey, isEmpty);
402
+ return isEmpty;
403
+ };
350
404
  const addEntry = (frameName, entry) => {
351
405
  if (!entry || typeof entry !== "object") return;
352
406
  if (entry.frame && typeof entry.frame === "object" && typeof entry.frame.w === "number") {
@@ -355,7 +409,11 @@ var TextureManager = class {
355
409
  const fy = Number(fr.y) || 0;
356
410
  const fw = Number(fr.w) || 0;
357
411
  const fh = Number(fr.h) || 0;
358
- const meta = {};
412
+ const meta = {
413
+ baseChar: entry.baseChar,
414
+ baseActor: entry.baseActor,
415
+ empty: detectEmptyRect(fx, fy, fw, fh, entry.empty)
416
+ };
359
417
  if (entry.pivot && typeof entry.pivot.x === "number" && typeof entry.pivot.y === "number") {
360
418
  const px = Number(entry.pivot.x);
361
419
  const py = Number(entry.pivot.y);
@@ -385,11 +443,14 @@ var TextureManager = class {
385
443
  emissivePower: entry.emissivePower,
386
444
  char: entry.char,
387
445
  actor: entry.actor,
446
+ baseChar: entry.baseChar,
447
+ baseActor: entry.baseActor,
388
448
  clip: entry.clip,
389
449
  dir: entry.dir,
390
450
  frame: typeof entry.frame === "number" ? entry.frame : void 0,
391
451
  frames: entry.frames,
392
- loop: entry.loop
452
+ loop: entry.loop,
453
+ empty: detectEmptyRect(fx, fy, fw, fh, entry.empty)
393
454
  });
394
455
  };
395
456
  if (Array.isArray(rawFrames)) for (let i = 0; i < rawFrames.length; i++) {
@@ -5225,6 +5286,7 @@ var Scene = class {
5225
5286
  /** Deterministic EngineClock-driven tween & spring manager (auto-stepped in `Game.step()`). */
5226
5287
  tweens = new TweenManager();
5227
5288
  _animatedSprites = /* @__PURE__ */ new Set();
5289
+ _equippedSprites = /* @__PURE__ */ new Set();
5228
5290
  _nodesCreated = 0;
5229
5291
  _nodesDestroyed = 0;
5230
5292
  _disposersRan = 0;
@@ -5318,6 +5380,17 @@ var Scene = class {
5318
5380
  for (const s of this._animatedSprites) if (s.active) s._stepAnim(deltaMs);
5319
5381
  else this._animatedSprites.delete(s);
5320
5382
  }
5383
+ _registerEquippedSprite(sprite) {
5384
+ this._equippedSprites.add(sprite);
5385
+ }
5386
+ _unregisterEquippedSprite(sprite) {
5387
+ this._equippedSprites.delete(sprite);
5388
+ }
5389
+ _syncEquipmentBindings() {
5390
+ if (this._equippedSprites.size === 0) return;
5391
+ for (const s of this._equippedSprites) if (s.active) s._syncEquipment();
5392
+ else this._equippedSprites.delete(s);
5393
+ }
5321
5394
  _invalidateTextGl() {
5322
5395
  const walk = (list) => {
5323
5396
  for (let i = 0; i < list.length; i++) {
@@ -5343,6 +5416,7 @@ var Scene = class {
5343
5416
  snap[i].destroy(true);
5344
5417
  } catch {}
5345
5418
  this._animatedSprites.clear();
5419
+ this._equippedSprites.clear();
5346
5420
  this.tweens.clear();
5347
5421
  }
5348
5422
  };
@@ -5605,6 +5679,7 @@ var Game = class {
5605
5679
  sc.update?.(time, delta);
5606
5680
  this.kernel._updateScene(sc, time, delta);
5607
5681
  sc.cameras.main.stepFollow(this.clock.lastDeltaMs);
5682
+ sc._syncEquipmentBindings();
5608
5683
  sc.events.emit("update", time, delta);
5609
5684
  sc.events.emit("postupdate", time, delta);
5610
5685
  }
@@ -5626,6 +5701,7 @@ var Game = class {
5626
5701
  const sc = scenes[i];
5627
5702
  if (sc.sys.settings.status === Scenes.RUNNING) {
5628
5703
  sc.preRender?.(time, lastDt);
5704
+ sc._syncEquipmentBindings();
5629
5705
  this.kernel._prerenderScene(sc, this.renderer, time, lastDt);
5630
5706
  sc.events.emit("prerender", this.renderer, time, lastDt);
5631
5707
  this.renderer.render(sc._displayList, sc.cameras.main);
@@ -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-DnJYRLZP.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-BbgtwqyW.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-C-yXzyAX.js";
2
+ import { n as Game } from "./game-CUZbJLbR.js";
3
3
  import { buildSceneDigest } from "./trace.js";
4
4
  // src/headless.ts
5
5
  function createVirtualDomHost(createCanvas, width, height) {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as WebGpuBootstrapResult, A as createInputRecorder, At as PanelOpenSide, B as SceneDigestSurfaceEntry, Bt as SpritePlayOptions, C as RecordedInputEntry, Ct as ImageObject, D as TimelineClickOptions, Dt as MsdfIconObject, E as StagePlugin, Et as MsdfIconConfig, F as SceneDigestEngineSandbox, Ft as ShapeBatchColumns, G as InputConfig, Gt as Camera, H as SceneDigestSurfaces, Ht as TextObject, I as SceneDigestNode, It as ShapeBatchObject, J as Pointer, Jt as HiDpiScaleLike, K as InputPlugin, Kt as CameraFollowOptions, L as SceneDigestOptions, Lt as ShapeBatchStyleDefaults, M as createInputTimeline, Mt as RectClipMask, N as SceneDigest, Nt as RectangleObject, O as TimelineDragOptions, Ot as NineSliceObject, P as SceneDigestActiveFocus, Pt as SceneHostLike, Q as RequestWebGpuOptions, R as SceneDigestOverlayStats, Rt as SpriteAnimEventListener, S as InputTimelinePlugin, St as Graphics, T as StageKernel, Tt as InstancedColumns, U as buildSceneDigest, Ut as TextStyleConfig, V as SceneDigestSurfaceSource, Vt as SyncAttachmentOptions, W as sanitizeTrackToken, Wt as TileSpriteObject, X as RendererWebGpu, Y as PointerSample, Z as RendererWebGpuOptions, _ as ActionMap, _t as DirectionalPlayOptions, a as GameLoop, at as RendererGlOptions, b as InputTargetSpec, bt as DisplayObjectType, c as LoaderPlugin, ct as StageRenderTarget, d as SceneCtor, dt as Bob$1, et as WebGpuCanvasContextLike, f as SceneInput, ft as Container, g as ViewportFitResult, gt as CustomPassOptions, h as StageRenderer, ht as CustomPassObject, i as GameConfig$1, it as RendererGl, j as createInputReplay, jt as PanelStyleConfig, k as TimelineKeyOptions, kt as PanelObject, l as ScaleManager, lt as AnchorPose2D, m as SceneManager, mt as CustomPassCallback, n as EngineClockSnapshot, nt as requestWebGpuDevice, o as GameObjectFactory, ot as RendererStats, p as SceneLifecycleStats, pt as ContainerFiltersShim, q as KeyboardPlugin, qt as HiDpiConfigureOptions, r as Game, rt as Renderer2D, s as JsonCache, st as Stage2DCustomImageHandler, t as EngineClock, tt as WebGpuDeviceLike, u as Scene, ut as BlitterObject, v as InputProvider, vt as DisplayList, w as StageInputEvent, wt as InstancedBatchObject, x as InputTimelineOptions, xt as DisplaySemantics, y as InputRecorderPlugin, yt as DisplayObject, z as SceneDigestSandbox, zt as SpriteObject } from "./game-DnJYRLZP.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-ClNi6zZQ.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-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";
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";
@@ -331,4 +331,4 @@ export declare const Stage: {
331
331
  };
332
332
  };
333
333
  };
334
- export { AUTO, ActionMap, type AnchorPose2D, type AnimationConfig, type AnimationFrameInput, AnimationManager, type AtlasAutoAnimOptions, type AtlasClipRule, type AtlasJsonLike, BLACK_RGB, 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, 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 };
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 };
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-C-yXzyAX.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";
3
3
  import { AnimationManager } from "./anims.js";
4
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-C_NPwPrE.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";
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, ft as Container, kt as PanelObject, u as Scene } from "./game-DnJYRLZP.js";
1
+ import { J as Pointer, jt as PanelObject, pt as Container, u as Scene } from "./game-BbgtwqyW.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-DnJYRLZP.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-BbgtwqyW.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 { Ct as ImageObject, Pt as SceneHostLike, ft as Container, ht as CustomPassObject, yt as DisplayObject } from "./game-DnJYRLZP.js";
1
+ import { It as SceneHostLike, Tt as ImageObject, bt as DisplayObject, gt as CustomPassObject, pt as Container } from "./game-BbgtwqyW.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-C_NPwPrE.js";
2
+ import { c as InstancedBatchObject } from "./display-CZb3yen0.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 { Pt as SceneHostLike, ft as Container, yt as DisplayObject } from "./game-DnJYRLZP.js";
1
+ import { It as SceneHostLike, bt as DisplayObject, pt as Container } from "./game-BbgtwqyW.js";
2
2
  export interface Camera25DConfig {
3
3
  viewportWidth: number;
4
4
  viewportHeight: number;
@@ -341,7 +341,12 @@ function mountStage25D(scene, camera, opts = {}) {
341
341
  const nodeAlpha = Math.min(1, effShadowAlpha * e.shadowAlpha * e.node.alpha);
342
342
  if (rec.kind === "image") {
343
343
  const shImg = rec.shadowNode;
344
- syncImageCloneToSource(shImg, e.node, shadowState.color);
344
+ const srcImg = e.node;
345
+ if (srcImg.frame?.empty) {
346
+ shImg.visible = false;
347
+ continue;
348
+ }
349
+ syncImageCloneToSource(shImg, srcImg, shadowState.color);
345
350
  shImg.visible = true;
346
351
  shImg.x = footX;
347
352
  shImg.y = footY;
@@ -372,6 +377,7 @@ function mountStage25D(scene, camera, opts = {}) {
372
377
  if (!child.active || !child.visible || child.alpha <= 0) continue;
373
378
  if (child.type !== "Image" && child.type !== "Sprite") continue;
374
379
  const srcChildImg = child;
380
+ if (srcChildImg.frame?.empty) continue;
375
381
  let clone = rec.childClones[used];
376
382
  if (!clone) {
377
383
  clone = scene.make.image(0, 0, srcChildImg.texture.key, srcChildImg.frame.name);
@@ -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-DnJYRLZP.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-BbgtwqyW.js";
2
2
  export { RendererWebGpu, RendererWebGpuOptions, RequestWebGpuOptions, WebGpuBootstrapResult, WebGpuCanvasContextLike, WebGpuDeviceLike, requestWebGpuDevice };
package/dist/rig2d.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as BlendMode } from "./anims-ClNi6zZQ.js";
2
- import { Ct as ImageObject, Pt as SceneHostLike, St as Graphics, ft as Container } from "./game-DnJYRLZP.js";
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";
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 { Pt as SceneHostLike, ft as Container, ut as BlitterObject } from "./game-DnJYRLZP.js";
1
+ import { It as SceneHostLike, dt as BlitterObject, pt as Container } from "./game-BbgtwqyW.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-DnJYRLZP.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-BbgtwqyW.js";
2
2
  export { SceneDigest, SceneDigestActiveFocus, SceneDigestEngineSandbox, SceneDigestNode, SceneDigestOptions, SceneDigestOverlayStats, SceneDigestSandbox, SceneDigestSurfaceEntry, SceneDigestSurfaceSource, SceneDigestSurfaces, buildSceneDigest, sanitizeTrackToken };
package/llms.txt CHANGED
@@ -5,28 +5,29 @@
5
5
  ## Core Documentation
6
6
 
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
- - [README](https://github.com/botiverse-play/stage/blob/main/README.md): Overview, install, 20-subpath table, quick starts for WebGPU, `StageKernel`, 60 FPS video, and 2.5D survival games.
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.6.0`).
10
+ - [Changelog](https://github.com/botiverse-play/stage/blob/main/CHANGELOG.md): Release history (`0.1.0` – `0.10.0`).
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
14
14
 
15
15
  - [Stage Agent Skill](https://github.com/botiverse-play/stage/blob/main/skills/stage/SKILL.md): Complete recipes, patterns, and pitfalls for building 2D/2.5D games, UI, WebGPU apps, `StageKernel` input timelines, and 60 FPS videos with `@holtjs/stage`.
16
- - [Subpath API Reference](https://github.com/botiverse-play/stage/blob/main/skills/stage/references/subpaths.md): Exact exported functions, classes, and types across all 20 subpaths.
16
+ - [Subpath API Reference](https://github.com/botiverse-play/stage/blob/main/skills/stage/references/subpaths.md): Exact exported functions, classes, and types across all 21 subpaths.
17
17
  - [Contributor Skill](https://github.com/botiverse-play/stage/blob/main/skills/stage-contributor/SKILL.md): Adding subpaths, maintaining `.d.ts` / size / renderer parity invariants, OIDC releases.
18
18
  - [AGENTS.md](https://github.com/botiverse-play/stage/blob/main/AGENTS.md): Repository map and non-negotiable engineering rules.
19
19
 
20
- ## 20 Subpaths (`sideEffects: false`, zero runtime dependencies)
20
+ ## 21 Subpaths (`sideEffects: false`, zero runtime dependencies)
21
21
 
22
- - `@holtjs/stage` (~57.3 kB gz): Full engine barrel (`Game`, `Scene`, `WEBGPU`, `WEBGL`, `CANVAS`, `RendererWebGpu`, `RendererGl`, `Renderer2D`, `InstancedBatchObject`, `StageRenderTarget`, `CustomPassObject`, `PanelObject`, `Graphics`, `Container`, `StageKernel`, `InputPlugin`, `EngineClock`, `TweenManager`, `VirtualJoystick`, `SurfaceTree`, `buildSceneDigest`, `computeFlexLayout`, `computeWrapLayout`).
23
- - `@holtjs/stage/webgpu` (~7.4 kB gz): Native WebGPU renderer (`RendererWebGpu`, `requestWebGpuDevice`) with WGSL quad/poly batching and WGSL analytical SDF `PanelObject` pipelines.
24
- - `@holtjs/stage/kernel` (~4.8 kB gz, no DOM): `StageKernel` (`game.kernel`), `StagePlugin` lifecycle, `ActionMap`, `InputProvider` bus, `createInputTimeline` (`trackId` semantic clicks + virtual cursor), `createInputRecorder`, `createInputReplay`.
25
- - `@holtjs/stage/headless` (~38.6 kB gz, pure Node with `@napi-rs/canvas`): `createHeadlessStage` (`.step()`, `.fastForward()`, `.recordFrames()`), `renderStoryboard`, `createAudioTimeline` stereo WAV mixer.
22
+ - `@holtjs/stage` (~71.3 kB gz): Full engine barrel (`Game`, `Scene`, `WEBGPU`, `WEBGL`, `CANVAS`, `SpriteObject` (`playDirectional`, `bindEquipment`), `ImageObject` (6-DOF `syncAttachment`, `getAnchorPose`), `AnimationManager`, `RendererWebGpu`, `RendererGl`, `Renderer2D`, `ShapeBatchObject`, `InstancedBatchObject`, `StageRenderTarget`, `CustomPassObject`, `PanelObject`, `Graphics`, `Container`, `StageKernel`, `InputPlugin`, `EngineClock`, `TweenManager`, `VirtualJoystick`, `SurfaceTree`, `buildSceneDigest`, `computeFlexLayout`, `computeWrapLayout`).
23
+ - `@holtjs/stage/anims` (~2.9 kB gz, no DOM): `AnimationManager` (`createFromAtlas` with `inheritFrom` + `baseChar` cross-actor rule inheritance, bare aliases, `generateFrameNames`, `generateFrameNumbers`).
24
+ - `@holtjs/stage/webgpu` (~15.9 kB gz): Native WebGPU renderer (`RendererWebGpu`, `requestWebGpuDevice`) with WGSL quad/poly batching and WGSL analytical SDF `PanelObject` & `ShapeBatchObject` pipelines.
25
+ - `@holtjs/stage/kernel` (~4.9 kB gz, no DOM): `StageKernel` (`game.kernel`), `StagePlugin` lifecycle, `ActionMap`, `InputProvider` bus, `createInputTimeline` (`trackId` semantic clicks + virtual cursor), `createInputRecorder`, `createInputReplay`.
26
+ - `@holtjs/stage/headless` (~50.4 kB gz, pure Node with `@napi-rs/canvas`): `createHeadlessStage` (`.step()`, `.fastForward()`, `.toRgbaInto()`, `.recordFrames()`), `renderStoryboard`, `createAudioTimeline` stereo WAV mixer.
26
27
  - `@holtjs/stage/rig2d` (~5.7 kB gz, no DOM): 2D cutout/slot skeletal rig (`defineRig2DSkeleton`, `Rig2DInstance`, `mountRig2D`, `bakeCutoutAtlas`), O(1) equipment/skin swapping, 2-layer base + bone-masked overlay mixer.
27
- - `@holtjs/stage/tilemap` (~3.5 kB gz, no DOM): Sparse `ChunkedTilemap`, Oskar Stålberg 16-tile Dual-Grid autotiler (`computeDualGridMask`, `bakeDualGridTileset`), 47-tile Blob autotiler (`computeBlob47Index`), `createIslandBiomeGenerator`, `mountChunkedTilemap`.
28
- - `@holtjs/stage/projection` (~1.6 kB gz, no DOM): Rotatable oblique `Camera25D` (`worldToScreen` ↔ `screenToGround`, smooth `Q/E` yaw spin) and `mountStage25D` (tilted ground plane + upright cylindrical depth-sorted billboards).
29
- - `@holtjs/stage/lighting` (~4.1 kB gz, no DOM): `DayNightCycle`, Sobel 3×3 `computeNormalMapPixels` / `bakeNormalMapCanvas`, `Lighting2DSystem` (`MULTIPLY` lightmap FBO + flickering torches), WebGL2 `createNormalLitSpritePass`.
28
+ - `@holtjs/stage/tilemap` (~4.0 kB gz, no DOM): Sparse `ChunkedTilemap`, Oskar Stålberg 16-tile Dual-Grid autotiler (`computeDualGridMask`, `bakeDualGridTileset`), 47-tile Blob autotiler (`computeBlob47Index`), `createIslandBiomeGenerator`, chunk-cached `mountChunkedTilemap`.
29
+ - `@holtjs/stage/projection` (~2.8 kB gz, no DOM): Rotatable oblique `Camera25D` (`worldToScreen` ↔ `screenToGround`, smooth `Q/E` yaw spin) and `mountStage25D` (tilted ground plane + oblique sun `shadowLayer` + upright cylindrical depth-sorted billboards).
30
+ - `@holtjs/stage/lighting` (~9.2 kB gz, no DOM): `DayNightCycle`, Sobel 3×3 `computeNormalMapPixels` / `bakeNormalMapCanvas`, `Lighting2DSystem` (zero-band radial `MULTIPLY` lightmap + `bindEmissive` self-lit glow), batched `createSceneNormalLitPass`.
30
31
  - `@holtjs/stage/world` (~2.8 kB gz, no DOM): `ItemRegistry`, `InventoryContainer` (with spoilage), `RecipeRegistry`, `WorkstationInstance` / `WorkstationScheduler` (offline tick catch-up), `WorldDeltaSave` (`HWLD` binary codec).
31
32
  - `@holtjs/stage/flex` (~2.3 kB gz, no DOM): `computeFlexLayout`, `computeWrapLayout`, `resolvePadding`.
32
33
  - `@holtjs/stage/tween` (~1.4 kB gz, no DOM): `TweenManager`, `Easings` (tweens + damped springs).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holtjs/stage",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
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.9.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.0`, 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
 
@@ -154,18 +154,21 @@ stage25.groundWorld.add(mountedTerrain.container);
154
154
  // Automatically aligns trimmed per-frame `ax/ay` pivots, transforms `hand` sockets, preserves walk phase across turns, & fires `footstep` events!
155
155
  scene.textures.addAtlas('actors', bakedCanvas, bakedAtlasJson);
156
156
  scene.anims.createFromAtlas('actors', {
157
+ inheritFrom: { 'held/*': 'survivor' }, // optional cross-actor rule inheritance (`bakeEquipment` also inherits via `baseChar`!)
157
158
  clips: {
158
- walk: { frameRate: 10, events: { 1: 'footstep', 4: 'footstep' } },
159
- attack: { frameRate: 14, repeat: 0, events: { 2: 'hit' } },
159
+ 'survivor/walk': { frameRate: 10, events: { 1: 'footstep', 4: 'footstep' } },
160
+ 'survivor/attack': { frameRate: 14, repeat: 0, events: { 2: 'hit' } },
160
161
  },
161
162
  });
162
163
  const survivor = scene.make.sprite(0, 0, 'actors', 'chars/survivor/idle/d0/f0');
163
164
  survivor.trackId = 'actor.survivor';
164
165
  survivor.onAnimEvent((ev) => { if (ev === 'footstep') playStepSfx(); });
165
166
  stage25.registerBillboard(survivor, 0, 0);
166
- // Inside update(): survivor.playDirectional('survivor/walk', Math.atan2(vy, vx), { cameraYaw: cam25.yaw });
167
- // Attach held weapon with exact 3D->2D projected shaft angle, O(2) blade mirroring & front/back zIndex occlusion:
168
- // survivor.syncAttachment(axeSprite, 'hand', { restAngle: -Math.PI / 2, mirrorBlade: true });
167
+ // Inside update(): survivor.playDirectional('survivor/walk', Math.atan2(vy, vx), { cameraYaw: cam25.yaw, startFrame });
168
+ // Option 1 (exact per-pixel hand/body occlusion via `@holtjs/craft/three` `bakeEquipment`):
169
+ // const equipSlot = survivor.bindEquipment(equipImage, 'equip/axe'); // O(1) swap via equipSlot.setPrefix('equip/spear'), auto-hides 1x1/2x2 empty frames!
170
+ // Option 2 (single-PNG procedural weapon via 8-tuple `handBasisSocket`):
171
+ // survivor.syncAttachment(axeSprite, 'hand', { restAngle: -Math.PI / 2, clipAngles: { walk: 0.66, thrust: 0 } });
169
172
 
170
173
  // 3B. Or 2D Cutout Skeletal Rig: O(1) equipment swap + 2-layer bone-masked overlay animation
171
174
  const rig = new Rig2DInstance(heroSkeleton);
@@ -1,17 +1,17 @@
1
1
  # `@holtjs/stage` Subpath API Quick Reference
2
2
 
3
- All symbols verified against `src/*.ts` (`@holtjs/stage@0.9.0`, 21 subpaths).
3
+ All symbols verified against `src/*.ts` (`@holtjs/stage@0.10.0`, 21 subpaths).
4
4
 
5
- ## `@holtjs/stage` (~69.3 kB gz · Core Engine Barrel)
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()`)
7
- - **Display Graph**: `DisplayList`, `DisplayObject` (reactive `.zIndex`, 6-DOF `.skewX`/`.skewY`/`.setSkew()`), `Container`, `ImageObject` (`.useFramePivot()`, `.getAnchor(name, space?)`, `.getAnchorPose(name, space?)`, `.syncAttachment(child, name, opts?)`), `SpriteObject` (`.play()`, `.playDirectional()`, `.onAnimEvent()`, `.pause()`, `.resume()`, `.stop()`), `NineSliceObject`, `TileSpriteObject`, `RectangleObject`, `PanelObject`, `MsdfIconObject`, `TextObject`, `Graphics` (GPU SDF fast-path + Canvas2D `Path2D` cache), `BlitterObject`, `InstancedBatchObject`, `ShapeBatchObject` (zero-texture SoA analytical SDF shapes), `CustomPassObject` (`restoreState: true` default, VAO-isolated)
8
- - **Renderers & GPU Batchers**: `RendererWebGpu`, `requestWebGpuDevice`, `RendererGl` (`.createRenderTarget()`, `.renderToTarget(rt, content, cam?)`, `.restoreState()`), `StageRenderTarget` (`.camera`, `.readPixels()`), `Renderer2D` (4-corner frustum culling + sprite tint LRU cache), `SdfPanelBatcher`, `MsdfIconBatcher`, `PixelAaBatcher`, `Camera` (`.configureHiDpi()`, `.setBounds()`, `.clearBounds()`, `.startFollow()`, `.stopFollow()`, `.screenToWorld()`, `.worldToScreen()`, `.logicalToWorld()`, `.worldToLogical()`, `.clientToWorld()`), `Texture` (`.atlasYaw`), `CanvasTexture`, `TextureSource`, `Frame` (`.setPivot()`, `.setPixelPivot()`, `.setAnchor()`, `.getAnchor()`), `TextureManager` (`.exists()`, `.addAtlas()`, `.addCanvas()`, `.get()`)
7
+ - **Display Graph**: `DisplayList`, `DisplayObject` (reactive `.zIndex`, 6-DOF `.skewX`/`.skewY`/`.setSkew()`), `Container`, `ImageObject` (`.useFramePivot()`, `.getAnchor(name, space?)`, `.getAnchorPose(name, space?)`, 6-DOF `.syncAttachment(child, name, opts?)` with 8-tuple `ux/uy/vx/vy` foreshortening, isometric shear & `clipAngles`), `SpriteObject` (`.play()`, `.playDirectional(key, heading, { cameraYaw?, startFrame? })`, `.bindEquipment(target, prefix, opts?)`, `.onAnimEvent()`, `.pause()`, `.resume()`, `.stop()`), `NineSliceObject`, `TileSpriteObject`, `RectangleObject`, `PanelObject`, `MsdfIconObject`, `TextObject`, `Graphics` (GPU SDF fast-path + Canvas2D `Path2D` cache), `BlitterObject`, `InstancedBatchObject`, `ShapeBatchObject` (zero-texture SoA analytical SDF shapes), `CustomPassObject` (`restoreState: true` default, VAO-isolated)
8
+ - **Renderers & GPU Batchers**: `RendererWebGpu`, `requestWebGpuDevice`, `RendererGl` (`.createRenderTarget()`, `.renderToTarget(rt, content, cam?)`, `.restoreState()`), `StageRenderTarget` (`.camera`, `.readPixels()`), `Renderer2D` (4-corner frustum culling + sprite tint LRU cache), `SdfPanelBatcher`, `MsdfIconBatcher`, `PixelAaBatcher`, `Camera` (`.configureHiDpi()`, `.setBounds()`, `.clearBounds()`, `.startFollow()`, `.stopFollow()`, `.screenToWorld()`, `.worldToScreen()`, `.logicalToWorld()`, `.worldToLogical()`, `.clientToWorld()`), `Texture` (`.atlasYaw`), `CanvasTexture`, `TextureSource`, `Frame` (`.empty`, `.baseActor`, `.setPivot()`, `.setPixelPivot()`, `.setAnchor()`, `.getAnchor()`), `TextureManager` (`.exists()`, `.addAtlas()`, `.addCanvas()`, `.get()`)
9
9
  - **Kernel & Input**: `StageKernel`, `ActionMap`, `createInputTimeline`, `createInputRecorder`, `createInputReplay`, `EventEmitter`, `Pointer`, `KeyboardPlugin` (`.isDown()`, `.justPressed()`, `.justReleased()`, `.injectKey()`), `InputPlugin`
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.6 kB gz · zero DOM)
14
- - `AnimationManager`: `.create(cfg)`, `.createFromAtlas(textureKey, opts?)`, `.generateFrameNames(key, cfg?)`, `.generateFrameNumbers(key, cfg?)`, `.exists(key)`, `.get(key)`, `.getDirectionalGroup(baseKey)`, `.listKeys()`, `.listDirectionalGroups()`
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()`
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)