@holtjs/stage 0.5.2 → 0.6.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 +16 -0
- package/dist/{game-DWELKTnB.d.ts → game-Blm49zGH.d.ts} +175 -11
- package/dist/{game-B8UlnEB_.js → game-Ds-cn2YI.js} +464 -281
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +2 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +5 -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-DJVQHR70.js} +889 -68
- package/dist/renderer-webgpu.d.ts +1 -1
- package/dist/renderer-webgpu.js +1 -1
- package/dist/rig2d.d.ts +1 -1
- package/dist/rig2d.js +1 -1
- package/dist/tilemap.d.ts +1 -1
- package/dist/tilemap.js +1 -1
- package/dist/trace.d.ts +1 -1
- package/dist/trace.js +1 -1
- package/dist/{types-DRFB0Klc.js → types-CXsCvp1p.js} +5 -1
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/skills/stage/SKILL.md +17 -7
- package/skills/stage/references/subpaths.md +5 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as WebGpuBootstrapResult, Q as RequestWebGpuOptions, X as RendererWebGpu, Z as RendererWebGpuOptions, et as WebGpuCanvasContextLike, nt as requestWebGpuDevice, tt as WebGpuDeviceLike } from "./game-Blm49zGH.js";
|
|
2
2
|
export { RendererWebGpu, RendererWebGpuOptions, RequestWebGpuOptions, WebGpuBootstrapResult, WebGpuCanvasContextLike, WebGpuDeviceLike, requestWebGpuDevice };
|
package/dist/renderer-webgpu.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as RendererWebGpu, n as requestWebGpuDevice } from "./renderer-webgpu-
|
|
1
|
+
export { t as RendererWebGpu, n as requestWebGpuDevice } from "./renderer-webgpu-DJVQHR70.js";
|
package/dist/rig2d.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mt as SceneHostLike, bt as Graphics, dt as Container, en as BlendMode, xt as ImageObject } from "./game-Blm49zGH.js";
|
|
2
2
|
export type RigCurveKind = 'linear' | 'step' | 'smoothstep' | 'outBack';
|
|
3
3
|
export interface RigBoneDef {
|
|
4
4
|
name: string;
|
package/dist/rig2d.js
CHANGED
package/dist/tilemap.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mt as SceneHostLike, dt as Container, lt as BlitterObject } from "./game-Blm49zGH.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/tilemap.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as FilterMode } from "./types-
|
|
1
|
+
import { o as FilterMode } from "./types-CXsCvp1p.js";
|
|
2
2
|
// src/tilemap.ts
|
|
3
3
|
/** Pack signed 16-bit chunk coordinates `[-32768..32767]` into a single 32-bit integer Map key (zero string allocation). */
|
|
4
4
|
function packChunkKey(cx, cy) {
|
package/dist/trace.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { B as
|
|
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-Blm49zGH.js";
|
|
2
2
|
export { SceneDigest, SceneDigestActiveFocus, SceneDigestEngineSandbox, SceneDigestNode, SceneDigestOptions, SceneDigestOverlayStats, SceneDigestSandbox, SceneDigestSurfaceEntry, SceneDigestSurfaceSource, SceneDigestSurfaces, buildSceneDigest, sanitizeTrackToken };
|
package/dist/trace.js
CHANGED
package/llms.txt
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- [Official Docs & Live Playground](https://holt.js.org): Interactive KAPLAY-green playground, WebGPU & Kernel guide, 2.5D Survival Sandbox guide, and subpath references.
|
|
8
8
|
- [README](https://github.com/botiverse-play/stage/blob/main/README.md): Overview, install, 20-subpath table, quick starts for WebGPU, `StageKernel`, 60 FPS video, and 2.5D survival games.
|
|
9
9
|
- [Architecture](https://github.com/botiverse-play/stage/blob/main/docs/architecture.md): WebGPU/WebGL2/Canvas2D batchers, `StageKernel`, DPR/camera contracts, LIFO disposal, `SurfaceTree`, tracing-first observability.
|
|
10
|
-
- [Changelog](https://github.com/botiverse-play/stage/blob/main/CHANGELOG.md): Release history (`0.1.0` – `0.
|
|
10
|
+
- [Changelog](https://github.com/botiverse-play/stage/blob/main/CHANGELOG.md): Release history (`0.1.0` – `0.6.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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holtjs/stage",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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.",
|
package/skills/stage/SKILL.md
CHANGED
|
@@ -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.
|
|
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.6.0`, 20 subpaths).
|
|
9
9
|
|
|
10
10
|
For the exhaustive exported symbol list across all 20 subpaths, see [references/subpaths.md](references/subpaths.md).
|
|
11
11
|
|
|
@@ -19,7 +19,7 @@ pnpm add @holtjs/stage
|
|
|
19
19
|
|
|
20
20
|
| Need | Import path | Works in Node/Worker (no DOM)? |
|
|
21
21
|
|---|---|---|
|
|
22
|
-
| Core engine (`Game`, `Scene`, `WEBGPU`/`WEBGL`/`CANVAS`, `InstancedBatch`, `Panel`, `Graphics`, `Container`, `Text`) | `@holtjs/stage` | Browser |
|
|
22
|
+
| Core engine (`Game`, `Scene`, `WEBGPU`/`WEBGL`/`CANVAS`, `ShapeBatch`, `InstancedBatch`, `Panel`, `Graphics`, `Container`, `Text`) | `@holtjs/stage` | Browser |
|
|
23
23
|
| Native WebGPU WGSL batch & analytical SDF renderer (`RendererWebGpu`, `requestWebGpuDevice`) | `@holtjs/stage/webgpu` | Browser WebGPU |
|
|
24
24
|
| `StageKernel` plugins, `ActionMap`, semantic `createInputTimeline`, recorder/replay | `@holtjs/stage/kernel` | Yes |
|
|
25
25
|
| Zero-browser 60 FPS Node PNG, storyboard & stereo video (`createHeadlessStage`) | `@holtjs/stage/headless` | Yes (`@napi-rs/canvas`) |
|
|
@@ -56,9 +56,15 @@ class MyScene extends Scene {
|
|
|
56
56
|
const maxDpr = this.game.renderer?.type === WEBGL || this.game.renderer?.type === WEBGPU ? 2 : 1;
|
|
57
57
|
this.vw = Math.max(320, Math.round(parentEl.clientWidth || 960));
|
|
58
58
|
this.vh = Math.max(240, Math.round(parentEl.clientHeight || 540));
|
|
59
|
-
this.dpr = this.cameras.main.configureHiDpi(this.scale, this.vw, this.vh, window.devicePixelRatio || 1, maxDpr);
|
|
60
|
-
// Optional smooth camera follow:
|
|
61
|
-
// this.cameras.main.startFollow(player, { lerpX: 0.12, lerpY: 0.12, deadzoneWidth: 64, deadzoneHeight: 48 });
|
|
59
|
+
this.dpr = this.cameras.main.configureHiDpi(this.scale, this.vw, this.vh, window.devicePixelRatio || 1, maxDpr, { fit: true });
|
|
60
|
+
// Optional smooth camera follow clamped to world bounds:
|
|
61
|
+
// this.cameras.main.startFollow(player, { lerpX: 0.12, lerpY: 0.12, deadzoneWidth: 64, deadzoneHeight: 48, bounds: { x: 0, y: 0, width: 3200, height: 2400 } });
|
|
62
|
+
}
|
|
63
|
+
update(_t: number, dtMs: number) {
|
|
64
|
+
// Pure simulation logic (runs on both live frames AND HeadlessStage.fastForward!)
|
|
65
|
+
}
|
|
66
|
+
preRender() {
|
|
67
|
+
// Presentation-only buffer updates (automatically skipped during stepSimOnly / fastForward!)
|
|
62
68
|
}
|
|
63
69
|
}
|
|
64
70
|
|
|
@@ -178,6 +184,10 @@ import { ParticlePool, JuiceController, drawParticlePool } from '@holtjs/stage/p
|
|
|
178
184
|
|
|
179
185
|
// IMPORTANT: flowField.sample(slot, x, y, tx, ty, dist, { out }) returns WORLD WAYPOINT [wx, wy] when an
|
|
180
186
|
// obstacle blocks LOS, or null when direct LOS is clear (steer straight toward tx, ty).
|
|
187
|
+
|
|
188
|
+
// Zero-texture GPU analytical SDF crowd/particle rendering (1 quad = 2 tris per circle/pill, no atlas needed):
|
|
189
|
+
const dots = scene.add.shapeBatch(5000, { width: 10, height: 10, radius: 5 });
|
|
190
|
+
dots.setColumns({ count: world.count, x: pos.x, y: pos.y, fillColor: col.rgb });
|
|
181
191
|
```
|
|
182
192
|
|
|
183
193
|
## 6. Canvas UI, Layout, Springs & `SurfaceTree` Barrier Recipe
|
|
@@ -255,5 +265,5 @@ stage.destroy();
|
|
|
255
265
|
- Destroying a parent `Container` unwinds children and disposers in strict LIFO order.
|
|
256
266
|
5. **Respect `SurfaceTree` barriers everywhere & keep `trackId` PII-free**:
|
|
257
267
|
- Gate world input on `!surfaces.isWorldBlocked()` and keep `trackId` static semantic tokens (`'craft.torch'`, `'hud.inventory'`). `buildSceneDigest()` never scrapes `TextObject.text`.
|
|
258
|
-
6.
|
|
259
|
-
-
|
|
268
|
+
6. **`StageRenderTarget` owns a default 1:1 transparent `rt.camera` and top-down `rt.readPixels()`**:
|
|
269
|
+
- Call `renderer.renderToTarget(rt, content)` with `camera` omitted for 1:1 offscreen passes (pass `scene.cameras.main` only when you intentionally want world scroll/zoom), and call `rt.readPixels()` for cross-backend `RGBA8` inspection.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# `@holtjs/stage` Subpath API Quick Reference
|
|
2
2
|
|
|
3
|
-
All symbols verified against `src/*.ts` (`@holtjs/stage@0.
|
|
3
|
+
All symbols verified against `src/*.ts` (`@holtjs/stage@0.6.0`, 20 subpaths).
|
|
4
4
|
|
|
5
|
-
## `@holtjs/stage` (~
|
|
6
|
-
- **Bootstrap & Lifecycle**: `Stage` / `Stage2D` (namespaces), `AUTO`, `WEBGPU`, `WEBGL`, `CANVAS`, `Scale`, `Scenes`, `Game` (`.stepSimOnly()`, `.kernel`), `Scene
|
|
7
|
-
- **Display Graph**: `DisplayList`, `DisplayObject`, `Container`, `ImageObject`, `NineSliceObject`, `TileSpriteObject`, `RectangleObject`, `PanelObject`, `MsdfIconObject`, `TextObject`, `Graphics
|
|
8
|
-
- **Renderers & GPU Batchers**: `RendererWebGpu`, `requestWebGpuDevice`, `RendererGl` (`.createRenderTarget()`, `.renderToTarget()`, `.restoreState()`), `Renderer2D`, `SdfPanelBatcher`, `MsdfIconBatcher`, `PixelAaBatcher`, `Camera` (`.configureHiDpi()`, `.startFollow()`, `.stopFollow()`, `.screenToWorld()`, `.worldToScreen()`), `Texture`, `CanvasTexture`, `TextureSource`, `Frame`, `TextureManager` (`.exists()`, `.addCanvas()`, `.get()`)
|
|
5
|
+
## `@holtjs/stage` (~59.5 kB gz · Core Engine Barrel)
|
|
6
|
+
- **Bootstrap & Lifecycle**: `Stage` / `Stage2D` (namespaces), `AUTO`, `WEBGPU`, `WEBGL`, `CANVAS`, `Scale` (`NONE`, `FIT`, `RESIZE`), `Scenes`, `Game` (`.stepSimOnly()`, `.kernel`), `Scene` (`.update()` simulation + `.preRender()` presentation), `SceneManager`, `ScaleManager` (`.fitToContainer()`), `GameLoop`, `EngineClock`, `LoaderPlugin`, `JsonCache`, `GameObjectFactory` (`scene.add.shapeBatch`, `instancedBatch`, `customPass`, `panel`, `blitter`, etc.)
|
|
7
|
+
- **Display Graph**: `DisplayList`, `DisplayObject`, `Container`, `ImageObject`, `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)
|
|
8
|
+
- **Renderers & GPU Batchers**: `RendererWebGpu`, `requestWebGpuDevice`, `RendererGl` (`.createRenderTarget()`, `.renderToTarget(rt, content, cam?)`, `.restoreState()`), `StageRenderTarget` (`.camera`, `.readPixels()`), `Renderer2D`, `SdfPanelBatcher`, `MsdfIconBatcher`, `PixelAaBatcher`, `Camera` (`.configureHiDpi()`, `.setBounds()`, `.clearBounds()`, `.startFollow()`, `.stopFollow()`, `.screenToWorld()`, `.worldToScreen()`, `.logicalToWorld()`, `.worldToLogical()`, `.clientToWorld()`), `Texture`, `CanvasTexture`, `TextureSource`, `Frame`, `TextureManager` (`.exists()`, `.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`
|