@holtjs/stage 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/{game-Cu1G9xgW.js → game-B8UlnEB_.js} +110 -734
- package/dist/{game-GdPaQUqH.d.ts → game-DWELKTnB.d.ts} +29 -10
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/joystick.d.ts +1 -1
- package/dist/kernel.d.ts +1 -1
- package/dist/lighting.d.ts +1 -1
- package/dist/projection.d.ts +1 -1
- package/dist/{renderer-webgpu-BorAD6Kk.js → renderer-webgpu-Djk7FayG.js} +817 -1
- package/dist/renderer-webgpu.d.ts +1 -1
- package/dist/renderer-webgpu.js +1 -1
- package/dist/rig2d.d.ts +1 -1
- package/dist/tilemap.d.ts +1 -1
- package/dist/trace.d.ts +1 -1
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/skills/stage/SKILL.md +5 -1
- package/skills/stage/references/subpaths.md +2 -2
|
@@ -100,6 +100,8 @@ interface TextureImageOptions {
|
|
|
100
100
|
filterMode?: FilterModeValue;
|
|
101
101
|
/** Default `true` for standard premultiplied sprites; set `false` for raw data textures such as MTSDF atlases. */
|
|
102
102
|
premultiplyAlpha?: boolean;
|
|
103
|
+
/** Internal flag for offscreen FBO render targets whose GPU storage is allocated via 9-arg `texImage2D(..., null)`. */
|
|
104
|
+
isRenderTarget?: boolean;
|
|
103
105
|
}
|
|
104
106
|
interface GlTextureHost {
|
|
105
107
|
readonly gl: WebGL2RenderingContext | WebGLRenderingContext | null;
|
|
@@ -123,8 +125,9 @@ declare class TextureSource {
|
|
|
123
125
|
glWidth: number;
|
|
124
126
|
glHeight: number;
|
|
125
127
|
dirty: boolean;
|
|
128
|
+
readonly isRenderTarget: boolean;
|
|
126
129
|
private host;
|
|
127
|
-
constructor(texture: Texture, image: TextureImageSource, filterMode: FilterModeValue, host: GlTextureHost | null, premultiplyAlpha?: boolean);
|
|
130
|
+
constructor(texture: Texture, image: TextureImageSource, filterMode: FilterModeValue, host: GlTextureHost | null, premultiplyAlpha?: boolean, isRenderTarget?: boolean);
|
|
128
131
|
setFilter(mode: FilterModeValue): void;
|
|
129
132
|
setPremultiplyAlpha(on: boolean): void;
|
|
130
133
|
update(): void;
|
|
@@ -154,7 +157,7 @@ declare class Texture {
|
|
|
154
157
|
readonly key: string;
|
|
155
158
|
readonly source: TextureSource[];
|
|
156
159
|
readonly frames: Record<string, Frame>;
|
|
157
|
-
constructor(manager: TextureManager, key: string, image: TextureImageSource, filterMode: FilterModeValue, host: GlTextureHost | null, premultiplyAlpha?: boolean);
|
|
160
|
+
constructor(manager: TextureManager, key: string, image: TextureImageSource, filterMode: FilterModeValue, host: GlTextureHost | null, premultiplyAlpha?: boolean, isRenderTarget?: boolean);
|
|
158
161
|
add(name: string | number, sourceIndex: number, x: number, y: number, width: number, height: number): Frame;
|
|
159
162
|
has(name: string | number): boolean;
|
|
160
163
|
get(name?: string | number): Frame;
|
|
@@ -902,6 +905,7 @@ declare class RendererGl extends EventEmitter implements GlTextureHost {
|
|
|
902
905
|
private readonly maskWorldMat;
|
|
903
906
|
private readonly bindTextSlot0;
|
|
904
907
|
private activeFbo;
|
|
908
|
+
private activeFboTex;
|
|
905
909
|
private instProgram;
|
|
906
910
|
private instUres;
|
|
907
911
|
private instVao;
|
|
@@ -933,8 +937,10 @@ declare class RendererGl extends EventEmitter implements GlTextureHost {
|
|
|
933
937
|
ensureGlTexture(src: TextureSource): WebGLTexture | null;
|
|
934
938
|
getDummyGlTexture(): WebGLTexture | null;
|
|
935
939
|
private ensureBatchState;
|
|
936
|
-
/** Full state restore for external callers that may have mutated viewport/blend/textures/pixelStore/FBO directly. */
|
|
940
|
+
/** Full state restore for external callers that may have mutated viewport/blend/cull/depth/stencil/colorMask/textures/pixelStore/FBO directly. */
|
|
937
941
|
restoreState(): void;
|
|
942
|
+
/** Evict `tex` (and populate any post-restore `null` slots with `dummyTex`) so binding its FBO never forms a GL feedback loop. */
|
|
943
|
+
private evictTextureFromUnits;
|
|
938
944
|
private setBlend;
|
|
939
945
|
private assignTextureUnit;
|
|
940
946
|
private reserve;
|
|
@@ -985,6 +991,13 @@ declare class Renderer2D extends EventEmitter {
|
|
|
985
991
|
private tintCtx;
|
|
986
992
|
private readonly maskWorldMat;
|
|
987
993
|
private readonly pathCache;
|
|
994
|
+
private curDrawCalls;
|
|
995
|
+
private curFlushes;
|
|
996
|
+
private curQuads;
|
|
997
|
+
private curTris;
|
|
998
|
+
private curSdfPanels;
|
|
999
|
+
private curMsdfIcons;
|
|
1000
|
+
private readonly lastStats;
|
|
988
1001
|
constructor(canvas: HTMLCanvasElement, width: number, height: number, existingCtx?: CanvasRenderingContext2D | null);
|
|
989
1002
|
stats(): {
|
|
990
1003
|
drawCalls: number;
|
|
@@ -1140,6 +1153,10 @@ declare class RendererWebGpu extends EventEmitter {
|
|
|
1140
1153
|
private renderGraphics;
|
|
1141
1154
|
private renderNode;
|
|
1142
1155
|
render(displayList: DisplayList, camera: Camera): void;
|
|
1156
|
+
/** Create an offscreen render target backed by a registered Stage `Texture` (`key`) for WebGPU passes (e.g. `Lighting2DSystem`). */
|
|
1157
|
+
createRenderTarget(key: string, width: number, height: number, textures: TextureManager, filterMode?: 0 | 1): StageRenderTarget;
|
|
1158
|
+
/** Render a `DisplayList` (or callback) into an offscreen `StageRenderTarget` and mark its texture dirty for WebGPU upload. */
|
|
1159
|
+
renderToTarget(target: StageRenderTarget, content: DisplayList | ((renderer: Renderer2D, camera: Camera) => void), camera: Camera): void;
|
|
1143
1160
|
destroy(): void;
|
|
1144
1161
|
}
|
|
1145
1162
|
interface PointerSample {
|
|
@@ -1189,18 +1206,19 @@ declare class Pointer {
|
|
|
1189
1206
|
declare class KeyboardPlugin extends EventEmitter {
|
|
1190
1207
|
private readonly win;
|
|
1191
1208
|
private readonly getFrameSeq;
|
|
1209
|
+
private readonly getWriteFrameSeq;
|
|
1192
1210
|
private readonly downCodes;
|
|
1193
|
-
private readonly
|
|
1194
|
-
private readonly
|
|
1211
|
+
private readonly pressedUntil;
|
|
1212
|
+
private readonly releasedUntil;
|
|
1195
1213
|
private readonly onKeyDown;
|
|
1196
1214
|
private readonly onKeyUp;
|
|
1197
1215
|
private readonly onBlur;
|
|
1198
|
-
constructor(win: Window, getFrameSeq?: () => number);
|
|
1199
|
-
/** Returns `true` while `codeOrKey` (e.g. `'KeyW'`, `'W'`, `'ArrowLeft'`, `'Space'`) is held down. */
|
|
1216
|
+
constructor(win: Window, getFrameSeq?: () => number, getWriteFrameSeq?: () => number);
|
|
1217
|
+
/** Returns `true` while `codeOrKey` (e.g. `'KeyW'`, `'W'`, `'ArrowLeft'`, `'Space'`, `' '`) is held down. */
|
|
1200
1218
|
isDown(codeOrKey: string): boolean;
|
|
1201
|
-
/** Returns `true` only
|
|
1219
|
+
/** Returns `true` only through the simulation frame during which `codeOrKey` transitioned up -> down. */
|
|
1202
1220
|
justPressed(codeOrKey: string): boolean;
|
|
1203
|
-
/** Returns `true` only
|
|
1221
|
+
/** Returns `true` only through the simulation frame during which `codeOrKey` transitioned down -> up. */
|
|
1204
1222
|
justReleased(codeOrKey: string): boolean;
|
|
1205
1223
|
/** Synthesize a deterministic key event from an `InputProvider` (headless timeline, replay, or Mod controller). */
|
|
1206
1224
|
injectKey(type: 'keydown' | 'keyup', codeOrKey: string, key?: string): void;
|
|
@@ -1226,7 +1244,7 @@ declare class InputPlugin extends EventEmitter {
|
|
|
1226
1244
|
private readonly coalescedScratch;
|
|
1227
1245
|
private resizeObserver;
|
|
1228
1246
|
private lastTouchMs;
|
|
1229
|
-
constructor(canvas: HTMLCanvasElement, win: Window, getCamera: () => Camera | null, config?: InputConfig, getFrameSeq?: () => number);
|
|
1247
|
+
constructor(canvas: HTMLCanvasElement, win: Window, getCamera: () => Camera | null, config?: InputConfig, getFrameSeq?: () => number, getWriteFrameSeq?: () => number);
|
|
1230
1248
|
setPollAlways(): this;
|
|
1231
1249
|
destroy(): void;
|
|
1232
1250
|
}
|
|
@@ -1791,6 +1809,7 @@ declare class Game {
|
|
|
1791
1809
|
pendingDestroy: boolean;
|
|
1792
1810
|
private destroyed;
|
|
1793
1811
|
private ownedCanvas;
|
|
1812
|
+
private inStep;
|
|
1794
1813
|
constructor(config?: GameConfig);
|
|
1795
1814
|
/** Advance simulation, tweens, kernel plugins, and camera follow by one deterministic tick WITHOUT rendering pixels. */
|
|
1796
1815
|
stepSimOnly(time: number, delta: number): boolean;
|
package/dist/headless.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as SceneDigestOptions, M as SceneDigest, T as StagePlugin, f as SceneInput, n as EngineClockSnapshot, r as Game, u as Scene } from "./game-
|
|
1
|
+
import { I as SceneDigestOptions, M as SceneDigest, T as StagePlugin, f as SceneInput, n as EngineClockSnapshot, r as Game, u as Scene } from "./game-DWELKTnB.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
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as WebGpuCanvasContextLike, $t as FilterMode, A as createInputReplay, At as RectangleObject, B as SceneDigestSurfaceSource, Bt as GlTextureHost, C as StageInputEvent, Ct as MsdfIconConfig, D as TimelineDragOptions, Dt as PanelOpenSide, E as TimelineClickOptions, Et as PanelObject, F as SceneDigestNode, Ft as Camera, G as InputPlugin, Gt as TextureManager, H as buildSceneDigest, Ht as Texture, I as SceneDigestOptions, It as CameraFollowOptions, J as PointerSample, Jt as BLACK_RGB, K as KeyboardPlugin, Kt as TextureSource, L as SceneDigestOverlayStats, Lt as HiDpiScaleLike, M as SceneDigest, Mt as TextObject, N as SceneDigestActiveFocus, Nt as TextStyleConfig, O as TimelineKeyOptions, Ot as PanelStyleConfig, P as SceneDigestEngineSandbox, Pt as TileSpriteObject, Q as WebGpuBootstrapResult, Qt as EventEmitter, R as SceneDigestSandbox, Rt as CanvasTexture, S as RecordedInputEntry, St as InstancedColumns, T as StagePlugin, Tt as NineSliceObject, U as sanitizeTrackToken, Ut as TextureImageOptions, V as SceneDigestSurfaces, Vt as SpriteSheetConfig, W as InputConfig, Wt as TextureImageSource, X as RendererWebGpuOptions, Xt as BlendModes, Y as RendererWebGpu, Yt as BlendMode, Z as RequestWebGpuOptions, Zt as CANVAS, _ as InputProvider, _t as DisplayObjectType, a as GameLoop, an as Scale, at as RendererStats, b as InputTimelineOptions, bt as ImageObject, c as LoaderPlugin, cn as TintModes, ct as BlitterObject, d as SceneCtor, dn as WHITE_RGB, dt as ContainerFiltersShim, en as FilterModeValue, et as WebGpuDeviceLike, f as SceneInput, fn as WorldView2D, ft as CustomPassCallback, g as ActionMap, gn as rgbToCss, gt as DisplayObject, h as StageRenderer, hn as parseColor, ht as DisplayList, i as GameConfig$1, in as RgbaColor, it as RendererGlOptions, j as createInputTimeline, jt as SceneHostLike, k as createInputRecorder, kt as RectClipMask, l as ScaleManager, ln as WEBGL, lt as Bob$1, m as SceneManager, mn as packColorAbgr, mt as CustomPassOptions, n as EngineClockSnapshot, nn as Matrix2D, nt as Renderer2D, o as GameObjectFactory, on as Scenes, ot as Stage2DCustomImageHandler, p as SceneLifecycleStats, pn as createMatrix2D, pt as CustomPassObject, q as Pointer, qt as AUTO, r as Game, rn as Rect2D, rt as RendererGl, s as JsonCache, sn as TintMode, st as StageRenderTarget, t as EngineClock, tn as HEX_MASK, tt as requestWebGpuDevice, u as Scene, un as WEBGPU, ut as Container, v as InputRecorderPlugin, vt as DisplaySemantics, w as StageKernel, wt as MsdfIconObject, x as InputTimelinePlugin, xt as InstancedBatchObject, y as InputTargetSpec, yt as Graphics, z as SceneDigestSurfaceEntry, zt as Frame } from "./game-
|
|
1
|
+
import { $ as WebGpuCanvasContextLike, $t as FilterMode, A as createInputReplay, At as RectangleObject, B as SceneDigestSurfaceSource, Bt as GlTextureHost, C as StageInputEvent, Ct as MsdfIconConfig, D as TimelineDragOptions, Dt as PanelOpenSide, E as TimelineClickOptions, Et as PanelObject, F as SceneDigestNode, Ft as Camera, G as InputPlugin, Gt as TextureManager, H as buildSceneDigest, Ht as Texture, I as SceneDigestOptions, It as CameraFollowOptions, J as PointerSample, Jt as BLACK_RGB, K as KeyboardPlugin, Kt as TextureSource, L as SceneDigestOverlayStats, Lt as HiDpiScaleLike, M as SceneDigest, Mt as TextObject, N as SceneDigestActiveFocus, Nt as TextStyleConfig, O as TimelineKeyOptions, Ot as PanelStyleConfig, P as SceneDigestEngineSandbox, Pt as TileSpriteObject, Q as WebGpuBootstrapResult, Qt as EventEmitter, R as SceneDigestSandbox, Rt as CanvasTexture, S as RecordedInputEntry, St as InstancedColumns, T as StagePlugin, Tt as NineSliceObject, U as sanitizeTrackToken, Ut as TextureImageOptions, V as SceneDigestSurfaces, Vt as SpriteSheetConfig, W as InputConfig, Wt as TextureImageSource, X as RendererWebGpuOptions, Xt as BlendModes, Y as RendererWebGpu, Yt as BlendMode, Z as RequestWebGpuOptions, Zt as CANVAS, _ as InputProvider, _t as DisplayObjectType, a as GameLoop, an as Scale, at as RendererStats, b as InputTimelineOptions, bt as ImageObject, c as LoaderPlugin, cn as TintModes, ct as BlitterObject, d as SceneCtor, dn as WHITE_RGB, dt as ContainerFiltersShim, en as FilterModeValue, et as WebGpuDeviceLike, f as SceneInput, fn as WorldView2D, ft as CustomPassCallback, g as ActionMap, gn as rgbToCss, gt as DisplayObject, h as StageRenderer, hn as parseColor, ht as DisplayList, i as GameConfig$1, in as RgbaColor, it as RendererGlOptions, j as createInputTimeline, jt as SceneHostLike, k as createInputRecorder, kt as RectClipMask, l as ScaleManager, ln as WEBGL, lt as Bob$1, m as SceneManager, mn as packColorAbgr, mt as CustomPassOptions, n as EngineClockSnapshot, nn as Matrix2D, nt as Renderer2D, o as GameObjectFactory, on as Scenes, ot as Stage2DCustomImageHandler, p as SceneLifecycleStats, pn as createMatrix2D, pt as CustomPassObject, q as Pointer, qt as AUTO, r as Game, rn as Rect2D, rt as RendererGl, s as JsonCache, sn as TintMode, st as StageRenderTarget, t as EngineClock, tn as HEX_MASK, tt as requestWebGpuDevice, u as Scene, un as WEBGPU, ut as Container, v as InputRecorderPlugin, vt as DisplaySemantics, w as StageKernel, wt as MsdfIconObject, x as InputTimelinePlugin, xt as InstancedBatchObject, y as InputTargetSpec, yt as Graphics, z as SceneDigestSurfaceEntry, zt as Frame } from "./game-DWELKTnB.js";
|
|
2
2
|
import { FlexAlign, FlexContainerSpec, FlexDir, FlexItemRect, FlexItemSpec, FlexJustify, FlexPadding, FlexResult, WrapContainerSpec, WrapItemRect, WrapItemSpec, WrapJustify, WrapResult, computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
|
|
3
3
|
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
4
|
import { JoystickDpad, JoystickDpadOptions, JoystickState, JoystickVector, JoystickViewport, JoystickZone, JoystickZonePredicate, JoystickZoneRect, VirtualJoystick, VirtualJoystickMode, VirtualJoystickOptions, VirtualJoystickStyle, clampJoystickOrigin, computeJoystickVector, isInJoystickZone, pullJoystickOrigin, quantizeJoystickDpad } from "./joystick.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-DRFB0Klc.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
2
|
+
import { S as TextureSource, _ as Camera, a as JsonCache, b as Texture, 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 CanvasTexture, x as TextureManager, y as Frame } from "./game-B8UlnEB_.js";
|
|
3
|
+
import { _ as TileSpriteObject, a as Container, c as DisplayObject, d as InstancedBatchObject, f as MsdfIconObject, g as TextObject, 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 } from "./renderer-webgpu-Djk7FayG.js";
|
|
4
4
|
import { ActionMap, StageKernel, createInputRecorder, createInputReplay, createInputTimeline } from "./kernel.js";
|
|
5
5
|
import { buildSceneDigest, sanitizeTrackToken } from "./trace.js";
|
|
6
6
|
import { computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
|
package/dist/joystick.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as PanelObject, q as Pointer, u as Scene, ut as Container } from "./game-
|
|
1
|
+
import { Et as PanelObject, q as Pointer, u as Scene, ut as Container } from "./game-DWELKTnB.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 createInputReplay, C as StageInputEvent, D as TimelineDragOptions, E as TimelineClickOptions, O as TimelineKeyOptions, S as RecordedInputEntry, T as StagePlugin, _ as InputProvider, b as InputTimelineOptions, g as ActionMap, j as createInputTimeline, k as createInputRecorder, v as InputRecorderPlugin, w as StageKernel, x as InputTimelinePlugin, y as InputTargetSpec } from "./game-
|
|
1
|
+
import { A as createInputReplay, C as StageInputEvent, D as TimelineDragOptions, E as TimelineClickOptions, O as TimelineKeyOptions, S as RecordedInputEntry, T as StagePlugin, _ as InputProvider, b as InputTimelineOptions, g as ActionMap, j as createInputTimeline, k as createInputRecorder, v as InputRecorderPlugin, w as StageKernel, x as InputTimelinePlugin, y as InputTargetSpec } from "./game-DWELKTnB.js";
|
|
2
2
|
export { ActionMap, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, createInputRecorder, createInputReplay, createInputTimeline };
|
package/dist/lighting.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bt as ImageObject, jt as SceneHostLike, pt as CustomPassObject } from "./game-
|
|
1
|
+
import { bt as ImageObject, jt as SceneHostLike, pt as CustomPassObject } from "./game-DWELKTnB.js";
|
|
2
2
|
export type DayPhase = 'day' | 'dusk' | 'night';
|
|
3
3
|
export interface DayNightConfig {
|
|
4
4
|
dayLengthMs?: number;
|
package/dist/projection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { gt as DisplayObject, jt as SceneHostLike, ut as Container } from "./game-
|
|
1
|
+
import { gt as DisplayObject, jt as SceneHostLike, ut as Container } from "./game-DWELKTnB.js";
|
|
2
2
|
export interface Camera25DConfig {
|
|
3
3
|
viewportWidth: number;
|
|
4
4
|
viewportHeight: number;
|