@holtjs/stage 0.5.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,36 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.7.0] - 2026-12-04
10
+
11
+ ### Added
12
+ - **First-Class Atlas Pivots, Named Sockets (`anchors`) & `TextureManager.addAtlas` (`src/texture.ts`, `src/display.ts`)**:
13
+ - Extended `Frame` with exact pixel pivots (`customPivot`, `pixelPivotX`, `pixelPivotY`, `pivotX`, `pivotY`), named frame-space pixel sockets (`anchors`, `setAnchor()`, `getAnchor()`), `emissiveCenter` / `emissivePower`, and baker clip metadata (`actor`, `clip`, `dir`, `animFrameIndex`, `animLoop`), plus `Texture.atlasYaw`.
14
+ - Added `TextureManager.addAtlas(key, source, atlasData, opts?)` and `LoaderPlugin.atlas()` natively parsing `@holtjs/craft/three`, `@holtjs/craft/atlas`, and TexturePacker / Aseprite trimmed Hash & Array JSON.
15
+ - Updated `ImageObject` (and `SpriteObject`) so trimmed frames with `customPivot` automatically align `_displayOriginX` / `_displayOriginY` without float drift, mirror around their ground pivot `(ax, ay)` on `flipX` / `flipY` across WebGL2, WebGPU, and Canvas2D, and expose `getAnchor(name, 'local' | 'parent' | 'world')`.
16
+ - **`SpriteObject` (`scene.add.sprite`) & `AnimationManager` (`scene.anims` / `@holtjs/stage/anims`)**:
17
+ - Added `AnimationManager` (`create`, `createFromAtlas`, `generateFrameNames`, `generateFrameNumbers`, `resolveOrThrow`, `resolveDirectionalOrThrow`) auto-discovering 4/8-directional and non-directional clips from baked atlases and registering unambiguous bare actor aliases (e.g. `'chars/survivor'` -> `'survivor/walk'` & `'survivor_walk'`) with fail-fast diagnostics on unknown clip names.
18
+ - Added deterministic simulation-stepped `SpriteObject` (`play`, `playDirectional` with `Camera25D.yaw` + `atlasYaw` compensation and `preservePhase` stride continuity, `onAnimEvent` for `footstep`/`hit` callbacks, `pause`/`resume`/`stop`), advancing identically in `Game.step()` and `Game.stepSimOnly()` / `HeadlessStage.fastForward()`, and surfaced `type: 'Sprite'`, `anim`, and `frame` in zero-PII `buildSceneDigest()`.
19
+ - **Canvas2D Chunk-Surface Tilemap Caching, `Renderer2D` Frustum Culling & Zero-Alloc Headless Readback (`src/tilemap.ts`, `src/renderer-2d.ts`, `src/headless.ts`)**:
20
+ - `mountChunkedTilemap()` now automatically pre-composites all Dual-Grid layers of each `16×16` chunk onto a cached offscreen chunk canvas keyed by `chunk.version` on `CANVAS` / `createHeadlessStage` (collapsing thousands of per-frame rotated tile `drawImage` calls down to ~12 chunk blits; also added `mounted.update(bounds)` convenience overload).
21
+ - Added pure-JS 4-corner `isOffscreen` frustum culling (`stats().culled`) on `Renderer2D` before touching Canvas2D / Skia FFI, plus `HeadlessStage.toRgbaInto(out)` and `RecordFramesOptions.reuseFrameBuffer`.
22
+
23
+ ## [0.6.0] - 2026-12-04
24
+
25
+ ### Added
26
+ - **Unified GPU Analytical SDF Shape Pipeline (`Graphics` SDF Fast-Path + `ShapeBatchObject` + Canvas2D `Path2D` Cache)**:
27
+ - Routed `Graphics` circles, stroked rings, rounded rects, and rects (`!_hasNonSdfOps`) directly through the analytical GPU SDF batcher (`SdfPanelBatcher` raised to `4096` quads/draw on WebGL2 and `16,384` instances/draw on WebGPU) — emitting **1 analytical AA quad (2 tris) per shape** instead of 12–64 CPU-triangulated polygon segments, eliminating per-frame `Graphics.clear() + fillCircle()` re-triangulation bottlenecks without requiring user code changes.
28
+ - Added zero-texture **`ShapeBatchObject` (`scene.add.shapeBatch(maxCount, defaults?)`)** consuming `SoaWorld` `Float32Array` / `Uint32Array` columns (`x`, `y`, `width`, `height`, `radius`, `rotation`, `fillColor`, `fillAlpha`, `borderColor`, `borderAlpha`, `borderWidth`, `order`) across WebGL2, WebGPU, and Canvas2D.
29
+ - Added retained `Path2D` style-run caching on static `Graphics` in `Renderer2D` (zero allocation on 1-shot `clear()` loops; compiles batched `Path2D` runs on frame 2+ when `g.version` is stationary), a coherent 256-entry LRU tinted-sprite cache in `Renderer2D` keyed by `(TextureSource.id, TextureSource.version, frame, rgb, fill)` (eliminating 3×/sprite/frame software compositing passes in `createHeadlessStage` video recording), and precomputed unit-circle LUTs for non-SDF eccentric ellipses.
30
+ - **Simulation vs. Presentation Lifecycle Split (`Scene.preRender` & `StagePlugin.prerender`)**:
31
+ - Added `Scene.preRender?(time, delta)` and `StagePlugin.prerender?(scene, renderer, time, delta)` invoked ONLY on rendered `Game.step()` ticks and skipped during `Game.stepSimOnly()` / `HeadlessStage.fastForward()`, cleanly separating deterministic simulation from display-list/batch authoring.
32
+ - **Self-Contained `StageRenderTarget` (`rt.camera` + Optional `camera` + Cross-Backend `rt.readPixels()`)**:
33
+ - Every `StageRenderTarget` now owns a dedicated `1:1` transparent `rt.camera` (`new Camera(width, height, true)`), used automatically when `renderer.renderToTarget(rt, content)` omits `camera` (and adopted by `Lighting2DSystem` so main-camera HiDPI `zoom` / `scroll` never double-shifts offscreen lightmaps).
34
+ - Added `rt.readPixels(out?: Uint8Array): Uint8Array` returning top-down `RGBA8` pixels (`row 0 = top`) identically across WebGL FBOs and Canvas2D.
35
+ - **Complete `Camera` World Bounds, HiDPI Logical Coordinates & `Scale.FIT` Letterboxing**:
36
+ - Added `Scale.FIT` & `Scale.RESIZE` modes plus `ScaleManager.fitToContainer()` (aspect-preserving CSS letterboxing with `configureHiDpi(..., { fit: true })` integration).
37
+ - Added `Camera.clearBounds()` / `removeBounds()`, `CameraFollowOptions.bounds`, `Camera.dpr`, `Camera.logicalToWorld()` / `worldToLogical()`, and `Camera.clientToWorld(clientX, clientY, canvas)`, and made `centerOn` / `clampX` / `clampY` exact across arbitrary `originX/Y` and `zoom`.
38
+
9
39
  ## [0.5.2] - 2026-12-04
10
40
 
11
41
  ### Fixed
@@ -0,0 +1,389 @@
1
+ declare const AUTO = 0;
2
+ declare const CANVAS = 1;
3
+ declare const WEBGL = 2;
4
+ declare const WEBGPU = 3;
5
+ declare const BlendModes: {
6
+ readonly NORMAL: 0;
7
+ readonly ADD: 1;
8
+ readonly MULTIPLY: 2;
9
+ readonly SCREEN: 3;
10
+ };
11
+ type BlendMode = (typeof BlendModes)[keyof typeof BlendModes];
12
+ declare const TintModes: {
13
+ readonly MULTIPLY: 0;
14
+ readonly FILL: 1;
15
+ };
16
+ type TintMode = (typeof TintModes)[keyof typeof TintModes];
17
+ declare const FilterMode: {
18
+ readonly LINEAR: 0;
19
+ readonly NEAREST: 1;
20
+ };
21
+ type FilterModeValue = (typeof FilterMode)[keyof typeof FilterMode];
22
+ declare const Scale: {
23
+ readonly NONE: 0;
24
+ readonly FIT: 1;
25
+ readonly RESIZE: 2;
26
+ };
27
+ type ScaleMode = (typeof Scale)[keyof typeof Scale];
28
+ declare const Scenes: {
29
+ readonly PENDING: 0;
30
+ readonly INIT: 1;
31
+ readonly START: 2;
32
+ readonly LOADING: 3;
33
+ readonly CREATING: 4;
34
+ readonly RUNNING: 5;
35
+ readonly PAUSED: 6;
36
+ readonly SLEEPING: 7;
37
+ readonly SHUTDOWN: 8;
38
+ readonly DESTROYED: 9;
39
+ };
40
+ /** Canonical neutral white & black integers (kept here once for color-check cleanliness). */
41
+ declare const WHITE_RGB = 16777215;
42
+ declare const BLACK_RGB = 0;
43
+ declare const HEX_MASK = 16777215;
44
+ interface Rect2D {
45
+ x: number;
46
+ y: number;
47
+ width: number;
48
+ height: number;
49
+ left: number;
50
+ right: number;
51
+ top: number;
52
+ bottom: number;
53
+ }
54
+ interface WorldView2D {
55
+ x: number;
56
+ y: number;
57
+ width: number;
58
+ height: number;
59
+ right: number;
60
+ bottom: number;
61
+ }
62
+ interface Matrix2D {
63
+ a: number;
64
+ b: number;
65
+ c: number;
66
+ d: number;
67
+ tx: number;
68
+ ty: number;
69
+ scaleX: number;
70
+ scaleY: number;
71
+ }
72
+ interface RgbaColor {
73
+ r: number;
74
+ g: number;
75
+ b: number;
76
+ a: number;
77
+ }
78
+ declare function createMatrix2D(): Matrix2D;
79
+ /** Parse a CSS hex/rgb(a) string or 0xRRGGBB number into normalized [0..1] RGBA. */
80
+ declare function parseColor(input: string | number | null | undefined, fallbackAlpha?: number): RgbaColor;
81
+ /** Convert 0xRRGGBB + alpha [0..1] into a CSS rgba(...) string. */
82
+ declare function rgbToCss(color: number, alpha?: number): string;
83
+ /** Pack 0xRRGGBB + alpha [0..1] into little-endian ABGR Uint32 (matches GL UNSIGNED_BYTE vec4 r,g,b,a). */
84
+ declare function packColorAbgr(rgb: number, alpha: number): number;
85
+ /** Lightweight, allocation-conscious event emitter compatible with Phaser's EventEmitter surface. */
86
+ declare class EventEmitter {
87
+ private readonly map;
88
+ on(event: string, fn: (...args: any[]) => void, ctx?: unknown): this;
89
+ once(event: string, fn: (...args: any[]) => void, ctx?: unknown): this;
90
+ off(event: string, fn?: (...args: any[]) => void, ctx?: unknown): this;
91
+ emit(event: string, ...args: any[]): boolean;
92
+ removeAllListeners(event?: string): this;
93
+ }
94
+ type TextureImageSource = HTMLImageElement | HTMLCanvasElement | ImageBitmap;
95
+ interface SpriteSheetConfig {
96
+ frameWidth: number;
97
+ frameHeight: number;
98
+ margin?: number;
99
+ spacing?: number;
100
+ }
101
+ interface FrameExtraMeta {
102
+ /** Exact pixel pivot X from trimmed frame top-left `(0, 0)` (takes precedence over `pivotX` to avoid float drift). */
103
+ ax?: number;
104
+ /** Exact pixel pivot Y from trimmed frame top-left `(0, 0)` (takes precedence over `pivotY` to avoid float drift). */
105
+ ay?: number;
106
+ /** Normalized horizontal pivot `[0..1]` relative to `width`. */
107
+ pivotX?: number;
108
+ /** Normalized vertical pivot `[0..1]` relative to `height`. */
109
+ pivotY?: number;
110
+ /** Named frame-local pixel sockets relative to trimmed frame top-left `(0, 0)`, e.g. `{ hand: [28, 34] }`. */
111
+ anchors?: Readonly<Record<string, readonly [number, number]>>;
112
+ /** Self-lit emissive centroid `[x, y]` in frame-local pixels (from `@holtjs/craft/three`). */
113
+ emissiveCenter?: readonly [number, number];
114
+ /** Normalized emissive coverage/intensity `[0..1]`. */
115
+ emissivePower?: number;
116
+ /** Optional character/actor identifier from offline baker metadata (e.g. `'chars/survivor'` or `'survivor'`). */
117
+ char?: string;
118
+ actor?: string;
119
+ /** Optional animation clip name from offline baker metadata (e.g. `'walk'`, `'idle'`, `'attack'`). */
120
+ clip?: string;
121
+ /** Optional discrete direction index (`0 .. dirs - 1`) or label (`'down'`, `'right'`, ...). */
122
+ dir?: number | string;
123
+ /** Optional 0-based animation frame index within `(char, clip, dir)`. */
124
+ frame?: number;
125
+ /** Optional total frame count in `(char, clip, dir)`. */
126
+ frames?: number;
127
+ /** Optional loop hint from offline baker (`true` for locomotion/idle, `false` for one-shot actions). */
128
+ loop?: boolean;
129
+ }
130
+ interface AtlasJsonLike {
131
+ readonly yaw?: number;
132
+ readonly pitch?: number;
133
+ readonly scale?: number;
134
+ readonly frames?: Record<string, any> | ReadonlyArray<any>;
135
+ readonly json?: {
136
+ readonly yaw?: number;
137
+ readonly pitch?: number;
138
+ readonly scale?: number;
139
+ readonly frames?: Record<string, any> | ReadonlyArray<any>;
140
+ };
141
+ }
142
+ interface TextureImageOptions {
143
+ filterMode?: FilterModeValue;
144
+ /** Default `true` for standard premultiplied sprites; set `false` for raw data textures such as MTSDF atlases. */
145
+ premultiplyAlpha?: boolean;
146
+ /** Internal flag for offscreen FBO render targets whose GPU storage is allocated via 9-arg `texImage2D(..., null)`. */
147
+ isRenderTarget?: boolean;
148
+ }
149
+ interface GlTextureHost {
150
+ readonly gl: WebGL2RenderingContext | WebGLRenderingContext | null;
151
+ readonly contextLost: boolean;
152
+ uploadTextureSource(src: TextureSource): void;
153
+ deleteTextureSource(src: TextureSource): void;
154
+ setTextureFilter(src: TextureSource): void;
155
+ }
156
+ declare class TextureSource {
157
+ private static nextId;
158
+ readonly id: number;
159
+ version: number;
160
+ readonly texture: Texture;
161
+ image: TextureImageSource;
162
+ width: number;
163
+ height: number;
164
+ resolution: number;
165
+ filterMode: FilterModeValue;
166
+ premultiplyAlpha: boolean;
167
+ glPremultiplyAlpha: boolean;
168
+ repeat: boolean;
169
+ glRepeat: boolean;
170
+ glTexture: WebGLTexture | null;
171
+ glWidth: number;
172
+ glHeight: number;
173
+ dirty: boolean;
174
+ readonly isRenderTarget: boolean;
175
+ private host;
176
+ constructor(texture: Texture, image: TextureImageSource, filterMode: FilterModeValue, host: GlTextureHost | null, premultiplyAlpha?: boolean, isRenderTarget?: boolean);
177
+ setFilter(mode: FilterModeValue): void;
178
+ setPremultiplyAlpha(on: boolean): void;
179
+ update(): void;
180
+ destroy(): void;
181
+ }
182
+ declare class Frame {
183
+ readonly texture: Texture;
184
+ readonly name: string | number;
185
+ readonly sourceIndex: number;
186
+ readonly source: TextureSource;
187
+ cutX: number;
188
+ cutY: number;
189
+ cutWidth: number;
190
+ cutHeight: number;
191
+ width: number;
192
+ height: number;
193
+ u0: number;
194
+ v0: number;
195
+ u1: number;
196
+ v1: number;
197
+ /** True when the atlas/baker specified an explicit per-frame pivot (`ax/ay` or `pivotX/pivotY`). */
198
+ customPivot: boolean;
199
+ pivotX: number;
200
+ pivotY: number;
201
+ pixelPivotX: number;
202
+ pixelPivotY: number;
203
+ /** Named frame-space pixel sockets relative to trimmed `(0, 0)`, e.g. `{ hand: [28, 34] }`. */
204
+ anchors: Record<string, readonly [number, number]> | null;
205
+ emissiveCenter: readonly [number, number] | null;
206
+ emissivePower: number;
207
+ actor: string | null;
208
+ clip: string | null;
209
+ dir: number | string | null;
210
+ animFrameIndex: number | null;
211
+ animLoop: boolean | undefined;
212
+ constructor(texture: Texture, name: string | number, sourceIndex: number, x: number, y: number, w: number, h: number, meta?: FrameExtraMeta);
213
+ setSize(width: number, height: number, x?: number, y?: number): this;
214
+ /** Set normalized `[0..1]` per-frame pivot (marks `customPivot = true`). */
215
+ setPivot(pivotX: number, pivotY: number): this;
216
+ /** Set exact pixel pivot `(ax, ay)` from trimmed frame top-left `(0, 0)` (avoids float rounding drift). */
217
+ setPixelPivot(ax: number, ay: number): this;
218
+ /** Attach or update a named pixel socket `(x, y)` relative to trimmed frame top-left `(0, 0)`. */
219
+ setAnchor(name: string, x: number, y: number): this;
220
+ /** Read a named pixel socket `[x, y]` (falls back to `emissiveCenter` when `name === 'emissive'`). */
221
+ getAnchor(name: string): readonly [number, number] | null;
222
+ applyMeta(meta: FrameExtraMeta): this;
223
+ updateUVs(): void;
224
+ }
225
+ declare class Texture {
226
+ readonly manager: TextureManager;
227
+ readonly key: string;
228
+ readonly source: TextureSource[];
229
+ readonly frames: Record<string, Frame>;
230
+ /** Optional isometric camera azimuth (`yaw` in radians, e.g. `Math.PI / 4` from `@holtjs/craft/three`) used by `SpriteObject.playDirectional()`. */
231
+ atlasYaw: number | null;
232
+ atlasPitch: number | null;
233
+ atlasScale: number | null;
234
+ constructor(manager: TextureManager, key: string, image: TextureImageSource, filterMode: FilterModeValue, host: GlTextureHost | null, premultiplyAlpha?: boolean, isRenderTarget?: boolean);
235
+ add(name: string | number, sourceIndex: number, x: number, y: number, width: number, height: number, meta?: FrameExtraMeta): Frame;
236
+ has(name: string | number): boolean;
237
+ get(name?: string | number): Frame;
238
+ remove(name: string | number): boolean;
239
+ setFilter(mode: FilterModeValue): this;
240
+ setPremultiplyAlpha(on: boolean): this;
241
+ getSourceImage(sourceIndex?: number): TextureImageSource;
242
+ destroy(): void;
243
+ }
244
+ declare class CanvasTexture extends Texture {
245
+ readonly canvas: HTMLCanvasElement;
246
+ readonly context: CanvasRenderingContext2D;
247
+ constructor(manager: TextureManager, key: string, canvas: HTMLCanvasElement, filterMode: FilterModeValue, host: GlTextureHost | null);
248
+ getContext(): CanvasRenderingContext2D;
249
+ refresh(): this;
250
+ }
251
+ declare class TextureManager {
252
+ readonly list: Record<string, Texture>;
253
+ private defaultFilter;
254
+ private host;
255
+ private readonly doc;
256
+ constructor(pixelArt: boolean, host: GlTextureHost | null, doc?: Document);
257
+ private initBuiltins;
258
+ exists(key: string): boolean;
259
+ get(key: string): Texture;
260
+ addImage(key: string, source: TextureImageSource, options?: TextureImageOptions): Texture | null;
261
+ addCanvas(key: string, canvas: HTMLCanvasElement): CanvasTexture | null;
262
+ createCanvas(key: string, width: number, height: number): CanvasTexture | null;
263
+ addSpriteSheet(key: string, source: TextureImageSource, config: SpriteSheetConfig): Texture | null;
264
+ /**
265
+ * Register a packed sprite atlas (`@holtjs/craft/three`, `@holtjs/craft/atlas`, or TexturePacker / Aseprite JSON Hash & Array)
266
+ * preserving per-frame trimmed pivots (`ax/ay` or `pivot`), named sockets (`anchors`), `emissiveCenter`, and `atlasYaw`!
267
+ */
268
+ addAtlas(key: string, source: TextureImageSource, atlasData: AtlasJsonLike, options?: TextureImageOptions): Texture | null;
269
+ remove(key: string): boolean;
270
+ invalidateAllGl(): void;
271
+ destroy(): void;
272
+ }
273
+ interface AnimationFrameInput {
274
+ readonly key?: string;
275
+ readonly frame: string | number;
276
+ /** Optional explicit duration override for this specific frame in milliseconds. */
277
+ readonly duration?: number;
278
+ /** Optional event(s) emitted immediately when playback enters or crosses this frame. */
279
+ readonly events?: string | readonly string[];
280
+ }
281
+ interface CompiledAnimationFrame {
282
+ readonly index: number;
283
+ readonly textureKey: string;
284
+ readonly frameName: string | number;
285
+ readonly durationMs: number;
286
+ /** Cumulative start timestamp in ms within one forward pass `[0 .. totalDurationMs)`. */
287
+ readonly offsetMs: number;
288
+ readonly events: readonly string[];
289
+ }
290
+ interface AnimationConfig {
291
+ readonly key: string;
292
+ readonly frames: ReadonlyArray<AnimationFrameInput>;
293
+ /** Default texture key when individual frame entries omit `key`. */
294
+ readonly defaultTextureKey?: string;
295
+ /** Frames per second (default `10` unless `duration` is specified). */
296
+ readonly frameRate?: number;
297
+ /** Total forward pass duration in milliseconds (used when `frameRate` is omitted). */
298
+ readonly duration?: number;
299
+ /** Number of repeats (`-1` = infinite loop, `0` = play once, `N > 0` = play `1 + N` times; default `0`). */
300
+ readonly repeat?: number;
301
+ /** Ping-pong back from last frame to frame 0 before completing/repeating (default `false`). */
302
+ readonly yoyo?: boolean;
303
+ /** Declarative map from 0-based frame index to event name(s), e.g. `{ 1: 'footstep', 4: 'footstep' }`. */
304
+ readonly events?: Readonly<Record<number, string | readonly string[]>>;
305
+ }
306
+ interface StageAnimation {
307
+ readonly key: string;
308
+ readonly frames: ReadonlyArray<CompiledAnimationFrame>;
309
+ readonly frameRate: number;
310
+ readonly msPerFrame: number;
311
+ readonly totalDurationMs: number;
312
+ readonly repeat: number;
313
+ readonly yoyo: boolean;
314
+ }
315
+ interface GenerateFrameNamesConfig {
316
+ readonly prefix?: string;
317
+ readonly start?: number;
318
+ readonly end?: number;
319
+ readonly suffix?: string;
320
+ readonly zeroPad?: number;
321
+ readonly frames?: ReadonlyArray<string | number>;
322
+ }
323
+ interface GenerateFrameNumbersConfig {
324
+ readonly start?: number;
325
+ readonly end?: number;
326
+ readonly frames?: readonly number[];
327
+ }
328
+ interface AtlasClipRule {
329
+ readonly frameRate?: number;
330
+ readonly duration?: number;
331
+ /** `-1` for loop, `0` for one-shot, `N > 0` for N repeats. */
332
+ readonly repeat?: number;
333
+ readonly yoyo?: boolean;
334
+ /** Frame-index -> event name(s), e.g. `{ 1: 'footstep', 4: 'footstep' }`. */
335
+ readonly events?: Readonly<Record<number, string | readonly string[]>>;
336
+ }
337
+ interface AtlasAutoAnimOptions {
338
+ /** Default playback rate in Hz when a clip rule omits `frameRate` (default `10`). */
339
+ readonly defaultFrameRate?: number;
340
+ /** Default `repeat` when neither clip rule nor baker `frame.animLoop` specifies loop behavior (`undefined` infers `-1` for idle/walk/run/move/fly/swim/burn, `0` otherwise). */
341
+ readonly defaultRepeat?: number;
342
+ /** Per-clip or per-`actor/clip` overrides, e.g. `{ walk: { frameRate: 10, events: { 1: 'footstep', 4: 'footstep' } } }`. */
343
+ readonly clips?: Readonly<Record<string, AtlasClipRule>>;
344
+ }
345
+ interface DirectionalAnimGroup {
346
+ readonly baseKey: string;
347
+ readonly actor: string;
348
+ readonly clip: string;
349
+ readonly textureKey: string;
350
+ /** Ordered animation clips for discrete directions `0 .. directions - 1`. */
351
+ readonly dirClips: ReadonlyArray<StageAnimation>;
352
+ readonly directions: number;
353
+ /** Isometric camera yaw baked into the atlas (`Math.PI / 4` for `craft/three` & `craft/hd3d`, `0` for cardinal sheets). */
354
+ readonly atlasYaw: number;
355
+ }
356
+ declare class AnimationManager {
357
+ private readonly textures;
358
+ private readonly anims;
359
+ private readonly aliases;
360
+ private readonly dirGroups;
361
+ constructor(textures: TextureManager);
362
+ exists(key: string): boolean;
363
+ get(key: string): StageAnimation | null;
364
+ /** Resolve an animation by key or throw a fail-fast diagnostic listing valid animations. */
365
+ resolveOrThrow(key: string | StageAnimation): StageAnimation;
366
+ getDirectionalGroup(baseKey: string): DirectionalAnimGroup | null;
367
+ /** Resolve a directional clip group (`'survivor/walk'` or `'survivor_walk'`) or throw a fail-fast diagnostic. */
368
+ resolveDirectionalOrThrow(baseKey: string): DirectionalAnimGroup;
369
+ listKeys(): string[];
370
+ listDirectionalGroups(): string[];
371
+ create(config: AnimationConfig): StageAnimation;
372
+ /** Register an alias key pointing to an existing `StageAnimation` (does not overwrite explicit primary keys). */
373
+ registerAlias(aliasKey: string, target: StageAnimation): void;
374
+ /** Register a directional animation group (and optional alias keys such as bare `'survivor/walk'` & `'survivor_walk'`). */
375
+ registerDirectionalGroup(group: DirectionalAnimGroup, aliases?: readonly string[]): void;
376
+ remove(key: string): boolean;
377
+ clear(): void;
378
+ generateFrameNames(textureKey: string, config?: GenerateFrameNamesConfig): AnimationFrameInput[];
379
+ generateFrameNumbers(textureKey: string, config?: GenerateFrameNumbersConfig): AnimationFrameInput[];
380
+ /**
381
+ * Auto-discover and compile all animations (both 4/8-directional character clips and non-directional prop strips)
382
+ * directly from an atlas texture registered via `textures.addAtlas` or `registerThreeAtlasOnStage`!
383
+ *
384
+ * Automatically registers bare actor aliases (e.g. `chars/survivor` -> `survivor/walk` AND `survivor_walk`)
385
+ * whenever the basename is unambiguous across the atlas, eliminating manual frame-table indexing bugs.
386
+ */
387
+ createFromAtlas(textureKey: string, options?: AtlasAutoAnimOptions): StageAnimation[];
388
+ }
389
+ export { HEX_MASK as A, WEBGPU as B, BLACK_RGB as C, EventEmitter as D, CANVAS as E, ScaleMode as F, parseColor as G, WorldView2D as H, Scenes as I, rgbToCss as K, TintMode as L, Rect2D as M, RgbaColor as N, FilterMode as O, Scale as P, TintModes as R, AUTO as S, BlendModes as T, createMatrix2D as U, WHITE_RGB as V, packColorAbgr as W, Texture as _, AtlasClipRule as a, TextureManager as b, GenerateFrameNamesConfig as c, AtlasJsonLike as d, CanvasTexture as f, SpriteSheetConfig as g, GlTextureHost as h, AtlasAutoAnimOptions as i, Matrix2D as j, FilterModeValue as k, GenerateFrameNumbersConfig as l, FrameExtraMeta as m, AnimationFrameInput as n, CompiledAnimationFrame as o, Frame as p, AnimationManager as r, DirectionalAnimGroup as s, AnimationConfig as t, StageAnimation as u, TextureImageOptions as v, BlendMode as w, TextureSource as x, TextureImageSource as y, WEBGL as z };
@@ -0,0 +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-CS0rfUIz.js";
2
+ export { AnimationConfig, AnimationFrameInput, AnimationManager, AtlasAutoAnimOptions, AtlasClipRule, CompiledAnimationFrame, DirectionalAnimGroup, GenerateFrameNamesConfig, GenerateFrameNumbersConfig, StageAnimation };