@holtjs/stage 0.13.0 → 0.15.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 +25 -0
- package/README.md +1 -1
- package/dist/{anims-n8aqhzxu.d.ts → anims-BOvaKn6w.d.ts} +7 -1
- package/dist/anims.d.ts +1 -1
- package/dist/ecs.d.ts +3 -3
- package/dist/ecs.js +2 -2
- package/dist/{game-CziLa7dv.js → game-CFxS641c.js} +77 -15
- package/dist/{game-C8bz7tay.d.ts → game-Ce35GTH4.d.ts} +95 -32
- package/dist/headless.d.ts +67 -21
- package/dist/headless.js +1230 -40
- package/dist/index.d.ts +2 -2
- 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 +4 -2
- package/dist/lighting.js +40 -29
- package/dist/projection.d.ts +3 -1
- package/dist/projection.js +7 -0
- package/dist/{renderer-webgpu-LDnrpYa0.js → renderer-webgpu-q4vdE3kA.js} +532 -169
- package/dist/renderer-webgpu.d.ts +1 -1
- package/dist/renderer-webgpu.js +1 -1
- package/dist/rig2d.d.ts +2 -2
- package/dist/tilemap.d.ts +2 -2
- package/dist/tilemap.js +228 -69
- package/dist/trace.d.ts +1 -1
- package/dist/world.d.ts +1 -1
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/skills/stage/SKILL.md +1 -1
- package/skills/stage/references/subpaths.md +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $n as
|
|
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-
|
|
1
|
+
import { $n as Camera, $t as HeadlessWebGpuOptions, A as createInputRecorder, An as Graphics, At as SceneDigestNode, Bn as RectClipMask, Bt as InputPlugin, C as RecordedInputEntry, Cn as DisplayObjectType, D as TimelineClickOptions, Dn as DrawStreamOptions, Dt as SceneDigest, E as StagePlugin, En as DrawStreamObject, Fn as MsdfIconObject, Ft as SceneDigestSurfaceSource, Gn as ShapeBatchStyleDefaults, Gt as RendererWebGpuOptions, Hn as SceneHostLike, Ht as Pointer, In as NineSliceObject, It as SceneDigestSurfaces, Jn as SpritePlayOptions, Jt as WebGpuCanvasContextLike, Kn as SpriteAnimEventListener, Kt as RequestWebGpuOptions, Ln as PanelObject, Lt as buildSceneDigest, M as createInputTimeline, Mn as InstancedBatchObject, Mt as SceneDigestOverlayStats, Nn as InstancedColumns, Nt as SceneDigestSandbox, O as TimelineDragOptions, On as DrawStreamSpriteOptions, Ot as SceneDigestActiveFocus, Pn as MsdfIconConfig, Pt as SceneDigestSurfaceEntry, Qn as TileSpriteObject, Qt as HeadlessWebGpuHandle, Rn as PanelOpenSide, Rt as sanitizeTrackToken, S as InputTimelinePlugin, Sn as DisplayObject, T as StageKernel, Tn as DrawStreamBulkView, Un as ShapeBatchColumns, Ut as PointerSample, Vn as RectangleObject, Vt as KeyboardPlugin, Wn as ShapeBatchObject, Wt as RendererWebGpu, Xn as TextObject, Xt as requestWebGpuDevice, Yn as SyncAttachmentOptions, Yt as WebGpuDeviceLike, Zn as TextStyleConfig, Zt as HeadlessWebGpuBackend, _ as ActionMap, _n as CustomPassCallback, a as GameLoop, an as Renderer2D, b as InputTargetSpec, bn as DirectionalPlayOptions, c as LoaderPlugin, cn as RendererStats, d as SceneCtor, dn as AnchorPose2D, en as OpenDawnWebGpuOptions, er as CameraFollowOptions, f as SceneInput, fn as BindEquipmentOptions, g as ViewportFitResult, gn as ContainerFiltersShim, h as StageRenderer, hn as Container, i as GameConfig$1, in as requestHeadlessWebGpu, j as createInputReplay, jn as ImageObject, jt as SceneDigestOptions, k as TimelineKeyOptions, kn as EquipmentBinding, kt as SceneDigestEngineSandbox, l as ScaleManager, ln as Stage2DCustomImageHandler, m as SceneManager, mn as Bob$1, n as EngineClockSnapshot, nn as openDawnWebGpu, nr as HiDpiScaleLike, o as GameObjectFactory, on as RendererGl, p as SceneLifecycleStats, pn as BlitterObject, qn as SpriteObject, qt as WebGpuBootstrapResult, r as Game, rn as openWgpuNativeFfi, s as JsonCache, sn as RendererGlOptions, t as EngineClock, tn as OpenWgpuNativeFfiOptions, tr as HiDpiConfigureOptions, u as Scene, un as StageRenderTarget, v as InputProvider, vn as CustomPassObject, w as StageInputEvent, wn as DisplaySemantics, x as InputTimelineOptions, xn as DisplayList, y as InputRecorderPlugin, yn as CustomPassOptions, zn as PanelStyleConfig, zt as InputConfig } from "./game-Ce35GTH4.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-BOvaKn6w.js";
|
|
3
3
|
import { FlattenedFlexNode, FlattenedFlexTree, FlexAlign, FlexContainerSpec, FlexDir, FlexIconSpec, FlexItemRect, FlexItemSpec, FlexJustify, FlexNodeSpec, FlexPadding, FlexPanelStyle, FlexResult, FlexTextSpec, MountFlexUiOptions, MountedFlexUi, WrapContainerSpec, WrapItemRect, WrapItemSpec, WrapJustify, WrapResult, computeFlexLayout, computeWrapLayout, flattenFlexTree, mountFlexUi, 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 { a as ScriptOptions, i as ScriptHandle, o as ScriptScheduler, r as ScriptContext, s as ScriptStats, t as CoroutineGenerator } from "./coroutine-DLgJumtD.js";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
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-CFxS641c.js";
|
|
3
3
|
import { AnimationManager } from "./anims.js";
|
|
4
|
-
import { a as requestHeadlessWebGpu, i as openWgpuNativeFfi, n as requestWebGpuDevice, o as Renderer2D, r as openDawnWebGpu, s as Camera, t as RendererWebGpu } from "./renderer-webgpu-
|
|
4
|
+
import { a as requestHeadlessWebGpu, i as openWgpuNativeFfi, n as requestWebGpuDevice, o as Renderer2D, r as openDawnWebGpu, s as Camera, t as RendererWebGpu } from "./renderer-webgpu-q4vdE3kA.js";
|
|
5
5
|
import { _ as TileSpriteObject, a as DisplayObject, c as ImageObject, d as NineSliceObject, f as PanelObject, g as TextObject, h as SpriteObject, i as DisplayList, l as InstancedBatchObject, m as ShapeBatchObject, n as Container, o as DrawStreamObject, p as RectangleObject, r as CustomPassObject, s as Graphics, t as BlitterObject, u as MsdfIconObject } from "./display-CVjvA8ZO.js";
|
|
6
6
|
import { ActionMap, StageKernel, createInputRecorder, createInputReplay, createInputTimeline } from "./kernel.js";
|
|
7
7
|
import { buildSceneDigest, sanitizeTrackToken } from "./trace.js";
|
package/dist/joystick.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ht as Pointer, Ln as PanelObject, hn as Container, u as Scene } from "./game-Ce35GTH4.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,3 +1,3 @@
|
|
|
1
1
|
import { a as ScriptOptions, i as ScriptHandle, o as ScriptScheduler, r as ScriptContext, s as ScriptStats, t as CoroutineGenerator } from "./coroutine-DLgJumtD.js";
|
|
2
|
-
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-
|
|
2
|
+
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-Ce35GTH4.js";
|
|
3
3
|
export { ActionMap, type CoroutineGenerator, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, type ScriptContext, type ScriptHandle, type ScriptOptions, ScriptScheduler, type ScriptStats, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, createInputRecorder, createInputReplay, createInputTimeline };
|
package/dist/lighting.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Hn as SceneHostLike, Sn as DisplayObject, hn as Container, jn as ImageObject, un as StageRenderTarget, vn as CustomPassObject } from "./game-Ce35GTH4.js";
|
|
2
2
|
export type DayPhase = 'day' | 'dusk' | 'night';
|
|
3
3
|
export interface DayNightConfig {
|
|
4
4
|
dayLengthMs?: number;
|
|
@@ -112,7 +112,9 @@ export declare class Lighting2DSystem {
|
|
|
112
112
|
readonly overlayImage: ImageObject;
|
|
113
113
|
/** Screen-space `BlendModes.ADD` container right above `overlayImage` so emissive flames/eyes shine crisp in pitch-black night! */
|
|
114
114
|
readonly emissiveLayer: Container;
|
|
115
|
-
|
|
115
|
+
renderTarget: StageRenderTarget;
|
|
116
|
+
private readonly baseRtKey;
|
|
117
|
+
private resizeSeq;
|
|
116
118
|
private readonly lightGraphics;
|
|
117
119
|
private glowBatch;
|
|
118
120
|
private glowCap;
|
package/dist/lighting.js
CHANGED
|
@@ -247,34 +247,39 @@ const RADIAL_GLOW_SIZE = 128;
|
|
|
247
247
|
function ensureRadialGlowTexture(textures) {
|
|
248
248
|
if (textures.exists(RADIAL_GLOW_KEY)) return true;
|
|
249
249
|
try {
|
|
250
|
-
const
|
|
251
|
-
if (!ct) return false;
|
|
252
|
-
const ctx = ct.canvas.getContext("2d");
|
|
253
|
-
if (!ctx || typeof ctx.createImageData !== "function" || typeof ctx.putImageData !== "function") {
|
|
254
|
-
textures.remove(RADIAL_GLOW_KEY);
|
|
255
|
-
return false;
|
|
256
|
-
}
|
|
257
|
-
const img = ctx.createImageData(RADIAL_GLOW_SIZE, RADIAL_GLOW_SIZE);
|
|
258
|
-
const data = img.data;
|
|
250
|
+
const raw = /* @__PURE__ */ new Uint8Array(65536);
|
|
259
251
|
const half = 63.5;
|
|
260
252
|
const invR = 1 / half;
|
|
261
253
|
for (let y = 0; y < RADIAL_GLOW_SIZE; y++) for (let x = 0; x < RADIAL_GLOW_SIZE; x++) {
|
|
262
254
|
const r = Math.hypot(x - half, y - half) * invR;
|
|
263
255
|
const idx = (y * RADIAL_GLOW_SIZE + x) * 4;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
if (r >= 1)
|
|
256
|
+
raw[idx] = 255;
|
|
257
|
+
raw[idx + 1] = 255;
|
|
258
|
+
raw[idx + 2] = 255;
|
|
259
|
+
if (r >= 1) raw[idx + 3] = 0;
|
|
268
260
|
else {
|
|
269
261
|
const u = 1 - r;
|
|
270
262
|
const falloff = u * u * (.78 + .22 * u * u);
|
|
271
|
-
|
|
263
|
+
raw[idx + 3] = Math.round(falloff * 255);
|
|
272
264
|
}
|
|
273
265
|
}
|
|
274
|
-
|
|
275
|
-
ct.
|
|
276
|
-
ct.
|
|
277
|
-
|
|
266
|
+
const ct = textures.createCanvas(RADIAL_GLOW_KEY, RADIAL_GLOW_SIZE, RADIAL_GLOW_SIZE);
|
|
267
|
+
const ctx = ct?.canvas.getContext?.("2d");
|
|
268
|
+
if (ct && ctx && typeof ctx.createImageData === "function" && typeof ctx.putImageData === "function") {
|
|
269
|
+
const img = ctx.createImageData(RADIAL_GLOW_SIZE, RADIAL_GLOW_SIZE);
|
|
270
|
+
img.data.set(raw);
|
|
271
|
+
ctx.putImageData(img, 0, 0);
|
|
272
|
+
ct.refresh();
|
|
273
|
+
ct.source[0]?.setFilter(FilterMode.LINEAR);
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
if (ct) textures.remove(RADIAL_GLOW_KEY);
|
|
277
|
+
const dataTex = textures.addImage(RADIAL_GLOW_KEY, {
|
|
278
|
+
width: RADIAL_GLOW_SIZE,
|
|
279
|
+
height: RADIAL_GLOW_SIZE,
|
|
280
|
+
data: raw
|
|
281
|
+
}, { filterMode: FilterMode.LINEAR });
|
|
282
|
+
return Boolean(dataTex);
|
|
278
283
|
} catch {
|
|
279
284
|
if (textures.exists(RADIAL_GLOW_KEY)) textures.remove(RADIAL_GLOW_KEY);
|
|
280
285
|
return false;
|
|
@@ -340,6 +345,8 @@ var Lighting2DSystem = class {
|
|
|
340
345
|
/** Screen-space `BlendModes.ADD` container right above `overlayImage` so emissive flames/eyes shine crisp in pitch-black night! */
|
|
341
346
|
emissiveLayer;
|
|
342
347
|
renderTarget;
|
|
348
|
+
baseRtKey;
|
|
349
|
+
resizeSeq = 0;
|
|
343
350
|
lightGraphics;
|
|
344
351
|
glowBatch = null;
|
|
345
352
|
glowCap = 128;
|
|
@@ -375,6 +382,7 @@ var Lighting2DSystem = class {
|
|
|
375
382
|
this.viewportW = Math.max(1, Math.round(opts.width));
|
|
376
383
|
this.viewportH = Math.max(1, Math.round(opts.height));
|
|
377
384
|
const rtKey = opts.key ?? `__stage_lightmap_${Math.random().toString(36).slice(2, 8)}`;
|
|
385
|
+
this.baseRtKey = rtKey;
|
|
378
386
|
const rtW = Math.max(2, Math.round(this.viewportW * this.resScale));
|
|
379
387
|
const rtH = Math.max(2, Math.round(this.viewportH * this.resScale));
|
|
380
388
|
const rtHost = scene.renderer;
|
|
@@ -502,17 +510,20 @@ var Lighting2DSystem = class {
|
|
|
502
510
|
this.manualAmbientRgb = rgb;
|
|
503
511
|
}
|
|
504
512
|
resize(width, height) {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
513
|
+
const nextW = Math.max(1, Math.round(width));
|
|
514
|
+
const nextH = Math.max(1, Math.round(height));
|
|
515
|
+
this.viewportW = nextW;
|
|
516
|
+
this.viewportH = nextH;
|
|
517
|
+
const rtW = Math.max(2, Math.round(nextW * this.resScale));
|
|
518
|
+
const rtH = Math.max(2, Math.round(nextH * this.resScale));
|
|
519
|
+
if (rtW !== this.renderTarget.width || rtH !== this.renderTarget.height) {
|
|
520
|
+
this.renderTarget.destroy();
|
|
521
|
+
const newKey = `${this.baseRtKey}_r${++this.resizeSeq}`;
|
|
522
|
+
const rtHost = this.scene.renderer;
|
|
523
|
+
this.renderTarget = rtHost.createRenderTarget(newKey, rtW, rtH, this.scene.textures, FilterMode.LINEAR);
|
|
524
|
+
this.overlayImage.setTexture(newKey);
|
|
525
|
+
}
|
|
526
|
+
this.overlayImage.setDisplaySize(nextW, nextH);
|
|
516
527
|
}
|
|
517
528
|
syncEmissiveBindings() {
|
|
518
529
|
let idx = 0;
|
package/dist/projection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Hn as SceneHostLike, Sn as DisplayObject, hn as Container } from "./game-Ce35GTH4.js";
|
|
2
2
|
export interface Camera25DConfig {
|
|
3
3
|
viewportWidth: number;
|
|
4
4
|
viewportHeight: number;
|
|
@@ -130,6 +130,8 @@ export interface MountStage25DOptions {
|
|
|
130
130
|
trackId?: string;
|
|
131
131
|
/** Enable real-time oblique sun-cast silhouette shadows (`true` or `Shadow25DConfig`). */
|
|
132
132
|
shadows?: boolean | Shadow25DConfig;
|
|
133
|
+
/** Automatically sync `camera.resize(w, h)` whenever `scene.scale` emits `'resize'` (`default = true`). */
|
|
134
|
+
autoResize?: boolean;
|
|
133
135
|
}
|
|
134
136
|
export interface Stage25DRig {
|
|
135
137
|
readonly camera: Camera25D;
|
package/dist/projection.js
CHANGED
|
@@ -402,6 +402,12 @@ function mountStage25D(scene, camera, opts = {}) {
|
|
|
402
402
|
}
|
|
403
403
|
};
|
|
404
404
|
sync();
|
|
405
|
+
const scaleBus = scene.scale;
|
|
406
|
+
const onScaleResize = opts.autoResize !== false && scaleBus && typeof scaleBus.on === "function" ? (size) => {
|
|
407
|
+
camera.resize(size.width, size.height);
|
|
408
|
+
sync();
|
|
409
|
+
} : null;
|
|
410
|
+
if (onScaleResize && scaleBus?.on) scaleBus.on("resize", onScaleResize);
|
|
405
411
|
return {
|
|
406
412
|
camera,
|
|
407
413
|
root,
|
|
@@ -454,6 +460,7 @@ function mountStage25D(scene, camera, opts = {}) {
|
|
|
454
460
|
sync();
|
|
455
461
|
},
|
|
456
462
|
destroy() {
|
|
463
|
+
if (onScaleResize && scaleBus?.off) scaleBus.off("resize", onScaleResize);
|
|
457
464
|
for (let i = 0; i < entries.length; i++) destroyShadowRecord(entries[i]);
|
|
458
465
|
entries.length = 0;
|
|
459
466
|
shadowMap.clear();
|