@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 +30 -0
- package/dist/anims-CS0rfUIz.d.ts +389 -0
- package/dist/anims.d.ts +2 -0
- package/dist/anims.js +436 -0
- package/dist/{game-DWELKTnB.d.ts → game-3L9wS-Bv.d.ts} +279 -205
- package/dist/{game-B8UlnEB_.js → game-BnSWR44q.js} +642 -285
- package/dist/headless.d.ts +5 -1
- package/dist/headless.js +19 -3
- package/dist/index.d.ts +22 -2
- package/dist/index.js +7 -4
- package/dist/joystick.d.ts +1 -1
- package/dist/joystick.js +1 -1
- package/dist/kernel.d.ts +1 -1
- package/dist/kernel.js +4 -0
- package/dist/lighting.d.ts +1 -1
- package/dist/lighting.js +4 -9
- package/dist/projection.d.ts +1 -1
- package/dist/{renderer-webgpu-Djk7FayG.js → renderer-webgpu-alSDj9RR.js} +1298 -96
- package/dist/renderer-webgpu.d.ts +1 -1
- package/dist/renderer-webgpu.js +1 -1
- package/dist/rig2d.d.ts +2 -1
- package/dist/rig2d.js +1 -1
- package/dist/tilemap.d.ts +14 -3
- package/dist/tilemap.js +85 -11
- package/dist/trace.d.ts +1 -1
- package/dist/trace.js +8 -2
- package/dist/{types-DRFB0Klc.js → types-CXsCvp1p.js} +5 -1
- package/llms.txt +1 -1
- package/package.json +5 -1
- package/skills/stage/SKILL.md +38 -12
- package/skills/stage/references/subpaths.md +11 -7
package/dist/headless.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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-3L9wS-Bv.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;
|
|
@@ -52,6 +52,8 @@ export interface RecordFramesOptions {
|
|
|
52
52
|
readonly digestEvery?: number;
|
|
53
53
|
/** Options forwarded to `buildSceneDigest()`. */
|
|
54
54
|
readonly digestOptions?: SceneDigestOptions;
|
|
55
|
+
/** Reuse a single preallocated `Uint8Array(width * height * 4)` across `onFrame` callbacks to avoid multi-GB GC churn on long 60 FPS video encodes (default `false`). */
|
|
56
|
+
readonly reuseFrameBuffer?: boolean;
|
|
55
57
|
/** Streaming frame consumer (may be sync or async, e.g. backpressure-aware `ffmpeg.stdin.write`). */
|
|
56
58
|
readonly onFrame: (frame: HeadlessRecordedFrame) => void | Promise<void>;
|
|
57
59
|
}
|
|
@@ -83,6 +85,8 @@ export interface HeadlessStage {
|
|
|
83
85
|
keyUp(code: string, key?: string): void;
|
|
84
86
|
/** Read raw W3C RGBA8888 pixels (`width * height * 4` bytes). */
|
|
85
87
|
toRgba(): Uint8Array;
|
|
88
|
+
/** Copy raw W3C RGBA8888 pixels into an existing `Uint8Array` (avoids per-frame buffer allocation in tight video loops). */
|
|
89
|
+
toRgbaInto(out: Uint8Array): Uint8Array;
|
|
86
90
|
/** Encode current frame to PNG bytes (requires `canvas.toBuffer('image/png')` such as `@napi-rs/canvas`). */
|
|
87
91
|
toPng(): Uint8Array;
|
|
88
92
|
/** Capture a zero-PII structured `SceneDigest` for the active scene at the current frame. */
|
package/dist/headless.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./types-
|
|
2
|
-
import { n as Game } from "./game-
|
|
1
|
+
import "./types-CXsCvp1p.js";
|
|
2
|
+
import { n as Game } from "./game-BnSWR44q.js";
|
|
3
3
|
import { buildSceneDigest } from "./trace.js";
|
|
4
4
|
// src/headless.ts
|
|
5
5
|
function createVirtualDomHost(createCanvas, width, height) {
|
|
@@ -122,6 +122,20 @@ function createHeadlessStage(options) {
|
|
|
122
122
|
}
|
|
123
123
|
return game.clock.snapshot();
|
|
124
124
|
};
|
|
125
|
+
const toRgbaInto = (out) => {
|
|
126
|
+
const byteLen = width * height * 4;
|
|
127
|
+
const dst = out && out.byteLength >= byteLen ? out : new Uint8Array(byteLen);
|
|
128
|
+
if (game.renderer.type === 2 && game.renderer.gl) {
|
|
129
|
+
const gl = game.renderer.gl;
|
|
130
|
+
gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, dst);
|
|
131
|
+
return dst;
|
|
132
|
+
}
|
|
133
|
+
const ctx = rootCanvas.getContext("2d");
|
|
134
|
+
if (!ctx) throw new Error("HeadlessStage.toRgbaInto: 2D context unavailable");
|
|
135
|
+
const img = ctx.getImageData(0, 0, width, height);
|
|
136
|
+
dst.set(img.data.subarray(0, byteLen));
|
|
137
|
+
return dst;
|
|
138
|
+
};
|
|
125
139
|
const toRgba = () => {
|
|
126
140
|
if (game.renderer.type === 2 && game.renderer.gl) {
|
|
127
141
|
const gl = game.renderer.gl;
|
|
@@ -145,6 +159,7 @@ function createHeadlessStage(options) {
|
|
|
145
159
|
const recordFrames = async (recOpts) => {
|
|
146
160
|
const totalFrames = recOpts.frames !== void 0 ? Math.max(1, Math.floor(recOpts.frames)) : Math.max(1, Math.round((recOpts.durationMs ?? 1e3) / 1e3 * fps));
|
|
147
161
|
const digestEvery = Math.max(0, Math.floor(recOpts.digestEvery ?? 0));
|
|
162
|
+
const sharedRgba = recOpts.reuseFrameBuffer ? new Uint8Array(width * height * 4) : null;
|
|
148
163
|
for (let i = 0; i < totalFrames; i++) {
|
|
149
164
|
if (i > 0 || game.clock.frameSeq === 0) {
|
|
150
165
|
simCursorMs += dt;
|
|
@@ -155,7 +170,7 @@ function createHeadlessStage(options) {
|
|
|
155
170
|
index: i,
|
|
156
171
|
frameSeq: game.clock.frameSeq,
|
|
157
172
|
simTimeMs: Math.round(simCursorMs),
|
|
158
|
-
rgba: toRgba(),
|
|
173
|
+
rgba: sharedRgba ? toRgbaInto(sharedRgba) : toRgba(),
|
|
159
174
|
digest: snapDigest
|
|
160
175
|
});
|
|
161
176
|
}
|
|
@@ -206,6 +221,7 @@ function createHeadlessStage(options) {
|
|
|
206
221
|
source: "headless"
|
|
207
222
|
}),
|
|
208
223
|
toRgba,
|
|
224
|
+
toRgbaInto,
|
|
209
225
|
toPng,
|
|
210
226
|
digest,
|
|
211
227
|
recordFrames,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as WebGpuBootstrapResult, A as createInputRecorder, At as PanelStyleConfig, B as SceneDigestSurfaceEntry, Bt as TextObject, C as RecordedInputEntry, Ct as InstancedBatchObject, D as TimelineClickOptions, Dt as NineSliceObject, E as StagePlugin, Et as MsdfIconObject, F as SceneDigestEngineSandbox, Ft as ShapeBatchObject, G as InputConfig, Gt as HiDpiConfigureOptions, H as SceneDigestSurfaces, Ht as TileSpriteObject, I as SceneDigestNode, It as ShapeBatchStyleDefaults, J as Pointer, K as InputPlugin, Kt as HiDpiScaleLike, L as SceneDigestOptions, Lt as SpriteAnimEventListener, M as createInputTimeline, Mt as RectangleObject, N as SceneDigest, Nt as SceneHostLike, O as TimelineDragOptions, Ot as PanelObject, P as SceneDigestActiveFocus, Pt as ShapeBatchColumns, Q as RequestWebGpuOptions, R as SceneDigestOverlayStats, Rt as SpriteObject, S as InputTimelinePlugin, St as ImageObject, T as StageKernel, Tt as MsdfIconConfig, U as buildSceneDigest, Ut as Camera, V as SceneDigestSurfaceSource, Vt as TextStyleConfig, W as sanitizeTrackToken, Wt as CameraFollowOptions, X as RendererWebGpu, Y as PointerSample, Z as RendererWebGpuOptions, _ as ActionMap, _t as DisplayList, a as GameLoop, at as RendererGlOptions, b as InputTargetSpec, bt as DisplaySemantics, c as LoaderPlugin, ct as StageRenderTarget, d as SceneCtor, dt as Container, et as WebGpuCanvasContextLike, f as SceneInput, ft as ContainerFiltersShim, g as ViewportFitResult, gt as DirectionalPlayOptions, h as StageRenderer, ht as CustomPassOptions, i as GameConfig$1, it as RendererGl, j as createInputReplay, jt as RectClipMask, k as TimelineKeyOptions, kt as PanelOpenSide, l as ScaleManager, lt as BlitterObject, m as SceneManager, mt as CustomPassObject, n as EngineClockSnapshot, nt as requestWebGpuDevice, o as GameObjectFactory, ot as RendererStats, p as SceneLifecycleStats, pt as CustomPassCallback, q as KeyboardPlugin, r as Game, rt as Renderer2D, s as JsonCache, st as Stage2DCustomImageHandler, t as EngineClock, tt as WebGpuDeviceLike, u as Scene, ut as Bob$1, v as InputProvider, vt as DisplayObject, w as StageInputEvent, wt as InstancedColumns, x as InputTimelineOptions, xt as Graphics, y as InputRecorderPlugin, yt as DisplayObjectType, z as SceneDigestSandbox, zt as SpritePlayOptions } from "./game-3L9wS-Bv.js";
|
|
2
|
+
import { A as HEX_MASK, B as WEBGPU, C as BLACK_RGB, D as EventEmitter, E as CANVAS, F as ScaleMode, G as parseColor, H as WorldView2D, I as Scenes, K as rgbToCss, L as TintMode, M as Rect2D, N as RgbaColor, O as FilterMode, P as Scale, R as TintModes, S as AUTO, T as BlendModes, U as createMatrix2D, V as WHITE_RGB, W as packColorAbgr, _ as Texture, a as AtlasClipRule, b as TextureManager, c as GenerateFrameNamesConfig, d as AtlasJsonLike, f as CanvasTexture, g as SpriteSheetConfig, h as GlTextureHost, i as AtlasAutoAnimOptions, j as Matrix2D, k as FilterModeValue, l as GenerateFrameNumbersConfig, m as FrameExtraMeta, n as AnimationFrameInput, o as CompiledAnimationFrame, p as Frame, r as AnimationManager, s as DirectionalAnimGroup, t as AnimationConfig, u as StageAnimation, v as TextureImageOptions, w as BlendMode, x as TextureSource, y as TextureImageSource, z as WEBGL } from "./anims-CS0rfUIz.js";
|
|
2
3
|
import { FlexAlign, FlexContainerSpec, FlexDir, FlexItemRect, FlexItemSpec, FlexJustify, FlexPadding, FlexResult, WrapContainerSpec, WrapItemRect, WrapItemSpec, WrapJustify, WrapResult, computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
|
|
3
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";
|
|
4
5
|
import { JoystickDpad, JoystickDpadOptions, JoystickState, JoystickVector, JoystickViewport, JoystickZone, JoystickZonePredicate, JoystickZoneRect, VirtualJoystick, VirtualJoystickMode, VirtualJoystickOptions, VirtualJoystickStyle, clampJoystickOrigin, computeJoystickVector, isInJoystickZone, pullJoystickOrigin, quantizeJoystickDpad } from "./joystick.js";
|
|
@@ -25,6 +26,11 @@ export declare class SdfPanelBatcher {
|
|
|
25
26
|
initGl(sharedQuadIbo: WebGLBuffer): void;
|
|
26
27
|
private setupAttribs;
|
|
27
28
|
push(m: Matrix2D, ox: number, oy: number, w: number, h: number, rTL: number, rTR: number, rBR: number, rBL: number, fillColor: number, fillAlpha: number, borderColor: number, borderAlpha: number, borderWidth: number, pixelStep: number, openSide: number, topGlintColor: number, topGlintAlpha: number, topGlintHeight: number, resW: number, resH: number): void;
|
|
29
|
+
/**
|
|
30
|
+
* Fast-path SDF quad emitter for symmetric-radius shapes (`Graphics` circles/rounded-rects & `ShapeBatchObject`)
|
|
31
|
+
* with `pxScale` precomputed once per node/matrix. Caller ensures `pending < MAX_SDF_BATCH_QUADS` before calling.
|
|
32
|
+
*/
|
|
33
|
+
pushSimple(m: Matrix2D, pxScale: number, rx: number, ry: number, w: number, h: number, radius: number, fillAbgr: number, borderAbgr: number, borderWidth: number, pixelStep?: number): void;
|
|
28
34
|
flush(resW: number, resH: number): boolean;
|
|
29
35
|
onContextLost(): void;
|
|
30
36
|
destroy(contextLost: boolean): void;
|
|
@@ -115,6 +121,7 @@ export declare namespace Stage2D {
|
|
|
115
121
|
namespace GameObjects {
|
|
116
122
|
type GameObject = DisplayObject;
|
|
117
123
|
type Image = ImageObject;
|
|
124
|
+
type Sprite = SpriteObject;
|
|
118
125
|
type MsdfIcon = MsdfIconObject;
|
|
119
126
|
type NineSlice = NineSliceObject;
|
|
120
127
|
type Panel = PanelObject;
|
|
@@ -123,6 +130,8 @@ export declare namespace Stage2D {
|
|
|
123
130
|
type Text = TextObject;
|
|
124
131
|
type Graphics = Stage2DGraphicsType;
|
|
125
132
|
type Blitter = BlitterObject;
|
|
133
|
+
type InstancedBatch = InstancedBatchObject;
|
|
134
|
+
type ShapeBatch = ShapeBatchObject;
|
|
126
135
|
type Bob = Bob$1;
|
|
127
136
|
type Container = Stage2DContainerType;
|
|
128
137
|
type CustomPass = CustomPassObject;
|
|
@@ -148,6 +157,8 @@ export declare const Stage2D: {
|
|
|
148
157
|
};
|
|
149
158
|
readonly Scale: {
|
|
150
159
|
readonly NONE: 0;
|
|
160
|
+
readonly FIT: 1;
|
|
161
|
+
readonly RESIZE: 2;
|
|
151
162
|
};
|
|
152
163
|
readonly Scenes: {
|
|
153
164
|
readonly PENDING: 0;
|
|
@@ -181,6 +192,7 @@ export declare const Stage2D: {
|
|
|
181
192
|
readonly GameObjects: {
|
|
182
193
|
readonly GameObject: typeof DisplayObject;
|
|
183
194
|
readonly Image: typeof ImageObject;
|
|
195
|
+
readonly Sprite: typeof SpriteObject;
|
|
184
196
|
readonly MsdfIcon: typeof MsdfIconObject;
|
|
185
197
|
readonly NineSlice: typeof NineSliceObject;
|
|
186
198
|
readonly Panel: typeof PanelObject;
|
|
@@ -190,6 +202,7 @@ export declare const Stage2D: {
|
|
|
190
202
|
readonly Graphics: typeof Graphics;
|
|
191
203
|
readonly Blitter: typeof BlitterObject;
|
|
192
204
|
readonly InstancedBatch: typeof InstancedBatchObject;
|
|
205
|
+
readonly ShapeBatch: typeof ShapeBatchObject;
|
|
193
206
|
readonly Container: typeof Container;
|
|
194
207
|
readonly CustomPass: typeof CustomPassObject;
|
|
195
208
|
};
|
|
@@ -222,6 +235,7 @@ export declare namespace Stage {
|
|
|
222
235
|
namespace GameObjects {
|
|
223
236
|
type GameObject = DisplayObject;
|
|
224
237
|
type Image = ImageObject;
|
|
238
|
+
type Sprite = SpriteObject;
|
|
225
239
|
type MsdfIcon = MsdfIconObject;
|
|
226
240
|
type NineSlice = NineSliceObject;
|
|
227
241
|
type Panel = PanelObject;
|
|
@@ -230,6 +244,8 @@ export declare namespace Stage {
|
|
|
230
244
|
type Text = TextObject;
|
|
231
245
|
type Graphics = Stage2DGraphicsType;
|
|
232
246
|
type Blitter = BlitterObject;
|
|
247
|
+
type InstancedBatch = InstancedBatchObject;
|
|
248
|
+
type ShapeBatch = ShapeBatchObject;
|
|
233
249
|
type Bob = Bob$1;
|
|
234
250
|
type Container = Stage2DContainerType;
|
|
235
251
|
type CustomPass = CustomPassObject;
|
|
@@ -255,6 +271,8 @@ export declare const Stage: {
|
|
|
255
271
|
};
|
|
256
272
|
readonly Scale: {
|
|
257
273
|
readonly NONE: 0;
|
|
274
|
+
readonly FIT: 1;
|
|
275
|
+
readonly RESIZE: 2;
|
|
258
276
|
};
|
|
259
277
|
readonly Scenes: {
|
|
260
278
|
readonly PENDING: 0;
|
|
@@ -288,6 +306,7 @@ export declare const Stage: {
|
|
|
288
306
|
readonly GameObjects: {
|
|
289
307
|
readonly GameObject: typeof DisplayObject;
|
|
290
308
|
readonly Image: typeof ImageObject;
|
|
309
|
+
readonly Sprite: typeof SpriteObject;
|
|
291
310
|
readonly MsdfIcon: typeof MsdfIconObject;
|
|
292
311
|
readonly NineSlice: typeof NineSliceObject;
|
|
293
312
|
readonly Panel: typeof PanelObject;
|
|
@@ -297,6 +316,7 @@ export declare const Stage: {
|
|
|
297
316
|
readonly Graphics: typeof Graphics;
|
|
298
317
|
readonly Blitter: typeof BlitterObject;
|
|
299
318
|
readonly InstancedBatch: typeof InstancedBatchObject;
|
|
319
|
+
readonly ShapeBatch: typeof ShapeBatchObject;
|
|
300
320
|
readonly Container: typeof Container;
|
|
301
321
|
readonly CustomPass: typeof CustomPassObject;
|
|
302
322
|
};
|
|
@@ -311,4 +331,4 @@ export declare const Stage: {
|
|
|
311
331
|
};
|
|
312
332
|
};
|
|
313
333
|
};
|
|
314
|
-
export { AUTO, ActionMap, BLACK_RGB, type BlendMode, BlendModes, BlitterObject, type Bob$1 as Bob, CANVAS, Camera, type CameraFollowOptions, CanvasTexture, Container, type ContainerFiltersShim, type CustomPassCallback, CustomPassObject, type CustomPassOptions, 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, Game, type GameConfig$1 as GameConfig, GameLoop, GameObjectFactory, type GlTextureHost, Graphics, HEX_MASK, 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, 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 SpringHandle, type SpringOptions, type SpriteSheetConfig, Stage as default, type Stage2DCustomImageHandler, 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, 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, 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 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 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, 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,6 +1,7 @@
|
|
|
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-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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-BnSWR44q.js";
|
|
3
|
+
import { AnimationManager } from "./anims.js";
|
|
4
|
+
import { _ as SpriteObject, a as Container, b as Camera, c as DisplayObject, d as InstancedBatchObject, f as MsdfIconObject, g as ShapeBatchObject, h as RectangleObject, i as BlitterObject, l as Graphics, m as PanelObject, n as requestWebGpuDevice, o as CustomPassObject, p as NineSliceObject, r as Renderer2D, s as DisplayList, t as RendererWebGpu, u as ImageObject, v as TextObject, y as TileSpriteObject } from "./renderer-webgpu-alSDj9RR.js";
|
|
4
5
|
import { ActionMap, StageKernel, createInputRecorder, createInputReplay, createInputTimeline } from "./kernel.js";
|
|
5
6
|
import { buildSceneDigest, sanitizeTrackToken } from "./trace.js";
|
|
6
7
|
import { computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
|
|
@@ -30,6 +31,7 @@ const Stage2D = {
|
|
|
30
31
|
GameObjects: {
|
|
31
32
|
GameObject: DisplayObject,
|
|
32
33
|
Image: ImageObject,
|
|
34
|
+
Sprite: SpriteObject,
|
|
33
35
|
MsdfIcon: MsdfIconObject,
|
|
34
36
|
NineSlice: NineSliceObject,
|
|
35
37
|
Panel: PanelObject,
|
|
@@ -39,6 +41,7 @@ const Stage2D = {
|
|
|
39
41
|
Graphics,
|
|
40
42
|
Blitter: BlitterObject,
|
|
41
43
|
InstancedBatch: InstancedBatchObject,
|
|
44
|
+
ShapeBatch: ShapeBatchObject,
|
|
42
45
|
Container,
|
|
43
46
|
CustomPass: CustomPassObject
|
|
44
47
|
},
|
|
@@ -46,4 +49,4 @@ const Stage2D = {
|
|
|
46
49
|
Display: { Canvas: { CanvasPool: { enableSmoothing() {} } } }
|
|
47
50
|
};
|
|
48
51
|
const Stage = Stage2D;
|
|
49
|
-
export { AUTO, ActionMap, BLACK_RGB, BlendModes, BlitterObject, CANVAS, Camera, CanvasTexture, Container, CustomPassObject, DisplayList, DisplayObject, Easings, EngineClock, EventEmitter, FilterMode, Frame, Game, GameLoop, GameObjectFactory, Graphics, HEX_MASK, ImageObject, InputPlugin, InstancedBatchObject, JsonCache, KeyboardPlugin, LoaderPlugin, MsdfIconBatcher, MsdfIconObject, NineSliceObject, PanelObject, PixelAaBatcher, Pointer, RectangleObject, Renderer2D, RendererGl, RendererWebGpu, SURFACE_BAND, Scale, ScaleManager, Scene, SceneManager, Scenes, SdfPanelBatcher, Stage, Stage as default, Stage2D, StageKernel, TextObject, Texture, TextureManager, TextureSource, TileSpriteObject, TintModes, TweenManager, VirtualJoystick, WEBGL, WEBGPU, WHITE_RGB, buildSceneDigest, clampJoystickOrigin, computeFlexLayout, computeJoystickVector, computeSurfaceDomZ, computeWrapLayout, createInputRecorder, createInputReplay, createInputTimeline, createMatrix2D, createSurfaceTree, isInJoystickZone, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ };
|
|
52
|
+
export { AUTO, ActionMap, AnimationManager, BLACK_RGB, BlendModes, BlitterObject, CANVAS, Camera, CanvasTexture, Container, CustomPassObject, DisplayList, DisplayObject, Easings, EngineClock, EventEmitter, FilterMode, Frame, Game, GameLoop, GameObjectFactory, Graphics, HEX_MASK, ImageObject, InputPlugin, InstancedBatchObject, JsonCache, KeyboardPlugin, LoaderPlugin, MsdfIconBatcher, MsdfIconObject, NineSliceObject, PanelObject, PixelAaBatcher, Pointer, RectangleObject, Renderer2D, RendererGl, RendererWebGpu, SURFACE_BAND, Scale, ScaleManager, Scene, SceneManager, Scenes, SdfPanelBatcher, ShapeBatchObject, SpriteObject, Stage, Stage as default, Stage2D, StageKernel, TextObject, Texture, TextureManager, TextureSource, TileSpriteObject, TintModes, TweenManager, VirtualJoystick, WEBGL, WEBGPU, WHITE_RGB, buildSceneDigest, clampJoystickOrigin, computeFlexLayout, computeJoystickVector, computeSurfaceDomZ, computeWrapLayout, createInputRecorder, createInputReplay, createInputTimeline, createMatrix2D, createSurfaceTree, isInJoystickZone, packColorAbgr, parseColor, pullJoystickOrigin, quantizeJoystickDpad, requestWebGpuDevice, resolvePadding, resolveSurfacePriority, rgbToCss, sanitizeTrackToken, surfacePriorityToDomZ };
|
package/dist/joystick.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { J as Pointer, Ot as PanelObject, dt as Container, u as Scene } from "./game-3L9wS-Bv.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/joystick.js
CHANGED
package/dist/kernel.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
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-3L9wS-Bv.js";
|
|
2
2
|
export { ActionMap, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, createInputRecorder, createInputReplay, createInputTimeline };
|
package/dist/kernel.js
CHANGED
|
@@ -197,6 +197,10 @@ var StageKernel = class {
|
|
|
197
197
|
_updateScene(scene, timeMs, deltaMs) {
|
|
198
198
|
for (let i = 0; i < this.pluginOrder.length; i++) this.pluginOrder[i].plugin.update?.(scene, timeMs, deltaMs);
|
|
199
199
|
}
|
|
200
|
+
/** Internal per-scene prerender hook invoked ONLY by `Game.step()` (skipped during `stepSimOnly` / `fastForward`). */
|
|
201
|
+
_prerenderScene(scene, renderer, timeMs, deltaMs) {
|
|
202
|
+
for (let i = 0; i < this.pluginOrder.length; i++) this.pluginOrder[i].plugin.prerender?.(scene, renderer, timeMs, deltaMs);
|
|
203
|
+
}
|
|
200
204
|
/** Internal postrender hook invoked by `Game.step()`. */
|
|
201
205
|
_postrender(renderer) {
|
|
202
206
|
for (let i = 0; i < this.pluginOrder.length; i++) this.pluginOrder[i].plugin.postrender?.(renderer);
|
package/dist/lighting.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nt as SceneHostLike, St as ImageObject, mt as CustomPassObject } from "./game-3L9wS-Bv.js";
|
|
2
2
|
export type DayPhase = 'day' | 'dusk' | 'night';
|
|
3
3
|
export interface DayNightConfig {
|
|
4
4
|
dayLengthMs?: number;
|
package/dist/lighting.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as FilterMode, r as BlendModes } from "./types-
|
|
1
|
+
import { o as FilterMode, r as BlendModes } from "./types-CXsCvp1p.js";
|
|
2
2
|
// src/lighting.ts
|
|
3
3
|
function lerpChannel(a, b, t) {
|
|
4
4
|
return Math.round(a + (b - a) * t) & 255;
|
|
@@ -347,14 +347,9 @@ var Lighting2DSystem = class {
|
|
|
347
347
|
g.fillCircle(sx, sy, rad * frac);
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
cam.transparent = false;
|
|
354
|
-
cam.setBackgroundColor(amb);
|
|
355
|
-
this.scene.renderer.renderToTarget(this.renderTarget, { sorted: () => [g] }, cam);
|
|
356
|
-
cam.transparent = prevTrans;
|
|
357
|
-
cam.backgroundColor = prevBg;
|
|
350
|
+
const rtCam = this.renderTarget.camera;
|
|
351
|
+
rtCam.setBackgroundColor(amb);
|
|
352
|
+
this.scene.renderer.renderToTarget(this.renderTarget, { sorted: () => [g] }, rtCam);
|
|
358
353
|
this.overlayImage.setDisplaySize(this.viewportW, this.viewportH);
|
|
359
354
|
return state;
|
|
360
355
|
}
|
package/dist/projection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nt as SceneHostLike, dt as Container, vt as DisplayObject } from "./game-3L9wS-Bv.js";
|
|
2
2
|
export interface Camera25DConfig {
|
|
3
3
|
viewportWidth: number;
|
|
4
4
|
viewportHeight: number;
|