@yagejs/core 0.4.0 → 0.5.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/dist/index.cjs +47 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +114 -5
- package/dist/index.d.ts +114 -5
- package/dist/index.js +43 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -550,6 +550,12 @@ interface EngineEvents {
|
|
|
550
550
|
};
|
|
551
551
|
"engine:started": undefined;
|
|
552
552
|
"engine:stopped": undefined;
|
|
553
|
+
"screen:fullscreen": {
|
|
554
|
+
active: boolean;
|
|
555
|
+
};
|
|
556
|
+
"screen:orientation": {
|
|
557
|
+
type: OrientationType;
|
|
558
|
+
};
|
|
553
559
|
}
|
|
554
560
|
/** Typed publish/subscribe event bus. */
|
|
555
561
|
declare class EventBus<E = EventMap> {
|
|
@@ -840,6 +846,22 @@ declare function createRandomService(seed?: number): RandomService;
|
|
|
840
846
|
*/
|
|
841
847
|
declare const globalRandom: RandomService;
|
|
842
848
|
|
|
849
|
+
/**
|
|
850
|
+
* Mirrors `GamepadAxisKey` from `@yagejs/input` as a local union so the
|
|
851
|
+
* Inspector contract gets compile-time literal checking without taking a
|
|
852
|
+
* runtime dependency on the input package.
|
|
853
|
+
*/
|
|
854
|
+
type InspectorGamepadAxisKey = "leftX" | "leftY" | "rightX" | "rightY" | "leftTrigger" | "rightTrigger";
|
|
855
|
+
/**
|
|
856
|
+
* Options for synthetic pointer injection. Pass `id` / `type` / `isPrimary`
|
|
857
|
+
* to drive a non-primary, touch, or pen pointer in deterministic tests. All
|
|
858
|
+
* fields are optional and default to a primary mouse pointer with `id: 1`.
|
|
859
|
+
*/
|
|
860
|
+
interface InspectorPointerOpts {
|
|
861
|
+
id?: number;
|
|
862
|
+
type?: "mouse" | "pen" | "touch";
|
|
863
|
+
isPrimary?: boolean;
|
|
864
|
+
}
|
|
843
865
|
/** Backward-compatible summary snapshot returned by query helpers. */
|
|
844
866
|
interface EntitySnapshot {
|
|
845
867
|
id: number;
|
|
@@ -955,19 +977,48 @@ interface CameraSnapshot {
|
|
|
955
977
|
zoom: number;
|
|
956
978
|
rotation: number;
|
|
957
979
|
}
|
|
980
|
+
/**
|
|
981
|
+
* Per-pointer entry in {@link InputStateSnapshot.pointers}. Mirrors the runtime
|
|
982
|
+
* `PointerInfo` shape from `@yagejs/input`. Touch pointers vanish from the
|
|
983
|
+
* array once their last button releases; mouse pointers persist.
|
|
984
|
+
*/
|
|
985
|
+
interface PointerSnapshot {
|
|
986
|
+
/** `PointerEvent.pointerId`, or the synthetic id passed via `firePointer*`. */
|
|
987
|
+
id: number;
|
|
988
|
+
x: number;
|
|
989
|
+
y: number;
|
|
990
|
+
type: "mouse" | "pen" | "touch";
|
|
991
|
+
isPrimary: boolean;
|
|
992
|
+
buttons: number[];
|
|
993
|
+
down: boolean;
|
|
994
|
+
}
|
|
958
995
|
interface InputStateSnapshot {
|
|
959
996
|
keys: string[];
|
|
960
997
|
actions: string[];
|
|
998
|
+
/**
|
|
999
|
+
* Aggregate / primary-pointer view, retained for back-compat. `x` / `y` track
|
|
1000
|
+
* the primary pointer's screen position; `buttons` / `down` reflect the
|
|
1001
|
+
* any-pointer aggregate that drives the `MouseLeft`/`Middle`/`Right` action codes.
|
|
1002
|
+
*
|
|
1003
|
+
* For multi-touch state, read {@link InputStateSnapshot.pointers}.
|
|
1004
|
+
*/
|
|
961
1005
|
mouse: {
|
|
962
1006
|
x: number;
|
|
963
1007
|
y: number;
|
|
964
1008
|
buttons: number[];
|
|
965
1009
|
down: boolean;
|
|
966
1010
|
};
|
|
1011
|
+
/** All currently-tracked pointers (one per active mouse, pen, or finger). */
|
|
1012
|
+
pointers: PointerSnapshot[];
|
|
967
1013
|
gamepad: {
|
|
968
|
-
|
|
1014
|
+
/** Currently-held gamepad codes (e.g. `"GamepadA"`, `"GamepadLT"`). */
|
|
1015
|
+
buttons: string[];
|
|
1016
|
+
/**
|
|
1017
|
+
* Axis state keyed by `${padIndex}:${axisName}` (axisName is a
|
|
1018
|
+
* `GamepadAxisKey` from `@yagejs/input`).
|
|
1019
|
+
*/
|
|
969
1020
|
axes: Array<{
|
|
970
|
-
|
|
1021
|
+
key: string;
|
|
971
1022
|
value: number;
|
|
972
1023
|
}>;
|
|
973
1024
|
};
|
|
@@ -1039,8 +1090,23 @@ declare class Inspector {
|
|
|
1039
1090
|
mouseMove: (x: number, y: number) => void;
|
|
1040
1091
|
mouseDown: (button?: 0 | 1 | 2) => void;
|
|
1041
1092
|
mouseUp: (button?: 0 | 1 | 2) => void;
|
|
1042
|
-
|
|
1043
|
-
|
|
1093
|
+
/**
|
|
1094
|
+
* Inject a synthetic pointer-move with full pointer addressing. Pass `opts`
|
|
1095
|
+
* with `id` / `type: "touch"` to drive a specific finger; defaults match
|
|
1096
|
+
* the primary mouse pointer (same as `mouseMove`).
|
|
1097
|
+
*/
|
|
1098
|
+
pointerMove: (x: number, y: number, opts?: InspectorPointerOpts) => void;
|
|
1099
|
+
/**
|
|
1100
|
+
* Inject a synthetic pointer-down. With `opts.id` and `opts.type: "touch"`
|
|
1101
|
+
* this drives a multi-touch contact, exercising `getPointers()`,
|
|
1102
|
+
* per-pointer event hooks, and the any-pointer aggregate for `MouseLeft`.
|
|
1103
|
+
*/
|
|
1104
|
+
pointerDown: (button?: 0 | 1 | 2, opts?: InspectorPointerOpts) => void;
|
|
1105
|
+
pointerUp: (button?: 0 | 1 | 2, opts?: {
|
|
1106
|
+
id?: number;
|
|
1107
|
+
}) => void;
|
|
1108
|
+
gamepadButton: (code: string, pressed: boolean) => void;
|
|
1109
|
+
gamepadAxis: (side: InspectorGamepadAxisKey, value: number) => void;
|
|
1044
1110
|
tap: (code: string, frames?: number) => void;
|
|
1045
1111
|
hold: (code: string, frames: number) => void;
|
|
1046
1112
|
fireAction: (name: string, frames?: number) => void;
|
|
@@ -2230,6 +2296,19 @@ interface RendererAdapter {
|
|
|
2230
2296
|
x: number;
|
|
2231
2297
|
y: number;
|
|
2232
2298
|
};
|
|
2299
|
+
/**
|
|
2300
|
+
* Hit-test at virtual-space coordinates and return `true` when the topmost
|
|
2301
|
+
* interactive container under `(x, y)` is parented (directly or through any
|
|
2302
|
+
* ancestor) to a container marked via {@link markPointerConsumeContainer}.
|
|
2303
|
+
* Optional — when absent, the input plugin's UI auto-consume fallback is a
|
|
2304
|
+
* no-op.
|
|
2305
|
+
*
|
|
2306
|
+
* Implemented by `@yagejs/renderer` over Pixi's `EventBoundary`. The input
|
|
2307
|
+
* plugin calls this on `pointerdown` drains to auto-claim presses that land
|
|
2308
|
+
* on UI surfaces (UIPanel backgrounds, decorative UIText, etc.) without
|
|
2309
|
+
* requiring per-component handler boilerplate.
|
|
2310
|
+
*/
|
|
2311
|
+
hitTestUI?(x: number, y: number): boolean;
|
|
2233
2312
|
}
|
|
2234
2313
|
/**
|
|
2235
2314
|
* Well-known service key for the current renderer's pointer-input adapter.
|
|
@@ -2239,6 +2318,36 @@ interface RendererAdapter {
|
|
|
2239
2318
|
*/
|
|
2240
2319
|
declare const RendererAdapterKey: ServiceKey<RendererAdapter>;
|
|
2241
2320
|
|
|
2321
|
+
/**
|
|
2322
|
+
* Cross-package WeakSet for marking display containers (Pixi `Container`s in
|
|
2323
|
+
* the canonical setup) as "swallow pointer input." The `@yagejs/input`
|
|
2324
|
+
* package's drain step consults this set via the renderer's optional
|
|
2325
|
+
* `hitTestUI(x, y)` — when the topmost interactive container under a
|
|
2326
|
+
* `pointerdown` is parented to a marked container, the pointer is auto-claimed
|
|
2327
|
+
* (`consumePointer`-equivalent), so the press never propagates to gameplay
|
|
2328
|
+
* action-map edges like `MouseLeft`.
|
|
2329
|
+
*
|
|
2330
|
+
* Lives in `@yagejs/core` so the renderer (read side) and the UI / sprite
|
|
2331
|
+
* components (write side) can both reach it without circular imports.
|
|
2332
|
+
*
|
|
2333
|
+
* Untyped on `Container` to keep `@yagejs/core` free of any Pixi dependency.
|
|
2334
|
+
* Callers pass their `Pixi.Container` instances directly; `WeakSet` accepts
|
|
2335
|
+
* any object reference.
|
|
2336
|
+
*/
|
|
2337
|
+
/**
|
|
2338
|
+
* Mark a display container as a UI-input surface. Idempotent. Call from a
|
|
2339
|
+
* component's `onAdd` (or equivalent) after the underlying Pixi container is
|
|
2340
|
+
* created.
|
|
2341
|
+
*/
|
|
2342
|
+
declare function markPointerConsumeContainer(container: object): void;
|
|
2343
|
+
/**
|
|
2344
|
+
* Remove the mark. Call from a component's `onDestroy` for symmetry, or to
|
|
2345
|
+
* implement an opt-out (`consumeInput: false`) escape hatch on UI primitives.
|
|
2346
|
+
*/
|
|
2347
|
+
declare function unmarkPointerConsumeContainer(container: object): void;
|
|
2348
|
+
/** Whether a container has been marked as a UI-input surface. */
|
|
2349
|
+
declare function isPointerConsumeContainer(container: object): boolean;
|
|
2350
|
+
|
|
2242
2351
|
/** Create a fully wired Engine for integration tests. */
|
|
2243
2352
|
declare function createTestEngine(config?: EngineConfig): Promise<Engine>;
|
|
2244
2353
|
/** Create a lightweight mock scene with EngineContext for unit tests. */
|
|
@@ -2257,4 +2366,4 @@ declare function advanceFrames(engine: Engine, n: number, dtMs?: number): void;
|
|
|
2257
2366
|
|
|
2258
2367
|
declare const VERSION = "0.0.0";
|
|
2259
2368
|
|
|
2260
|
-
export { AssetHandle, type AssetLoader, AssetManager, AssetManagerKey, type Blueprint, type CameraSnapshot, Component, type ComponentClass, ComponentFixedUpdateSystem, type ComponentStateSnapshot, ComponentUpdateSystem, type EasingFunction, Engine, type EngineConfig, EngineContext, type EngineEvents, EngineKey, type EngineSnapshot, Entity, type EntityCallbacks, type EntityFilter, type EntitySnapshot, ErrorBoundary, ErrorBoundaryKey, type ErrorSnapshot, EventBus, EventBusKey, type EventLogEntry, type EventMap, EventToken, GameLoop, type GameLoopCallbacks, type GameLoopConfig, GameLoopKey, type InputStateSnapshot, Inspector, InspectorKey, type InspectorTimeController, type Interpolatable, type Keyframe, type KeyframeAnimationDef, KeyframeAnimator, type KeyframeTrackOptions, LoadingScene, type LogEntry, LogLevel, Logger, type LoggerConfig, LoggerKey, MathUtils, Phase, type PhysicsSnapshot, type Plugin, Process, ProcessComponent, type ProcessOptions, ProcessSlot, type ProcessSlotConfig, ProcessSystem, ProcessSystemKey, QueryCache, QueryCacheKey, QueryResult, RandomKey, type RandomService, type RendererAdapter, RendererAdapterKey, SERIALIZABLE_KEY, Scene, SceneHookRegistry, SceneHookRegistryKey, type SceneHooks, SceneManager, SceneManagerKey, type SceneSnapshot, type SceneTransition, type SceneTransitionContext, type SceneTransitionKind, type SceneTransitionOptions, type ScopedProcessQueue, Sequence, SerializableRegistry, ServiceKey, type ServiceKeyOptions, type ServiceScope, type SmoothDampResult, type SnapshotResolver, System, SystemScheduler, SystemSchedulerKey, type SystemSnapshot, TimerEntity, TraitToken, Transform, type TransformData, Tween, type UINodeSnapshot, type UITreeSnapshot, VERSION, Vec2, type Vec2Like, type WorldEntitySnapshot, type WorldSceneSnapshot, _resetEntityIdCounter, advanceFrames, createDefaultRandomSeed, createKeyframeTrack, createMockEntity, createMockScene, createRandomService, createTestEngine, defineBlueprint, defineEvent, defineTrait, easeInOutQuad, easeInQuad, easeLinear, easeOutBounce, easeOutQuad, filterEntities, getSerializableType, globalRandom, interpolate, isSerializable, makeEntityScopedQueue, makeGlobalScopedQueue, makeSceneScopedQueue, normalizeSeed, resolveTransition, serializable, trait };
|
|
2369
|
+
export { AssetHandle, type AssetLoader, AssetManager, AssetManagerKey, type Blueprint, type CameraSnapshot, Component, type ComponentClass, ComponentFixedUpdateSystem, type ComponentStateSnapshot, ComponentUpdateSystem, type EasingFunction, Engine, type EngineConfig, EngineContext, type EngineEvents, EngineKey, type EngineSnapshot, Entity, type EntityCallbacks, type EntityFilter, type EntitySnapshot, ErrorBoundary, ErrorBoundaryKey, type ErrorSnapshot, EventBus, EventBusKey, type EventLogEntry, type EventMap, EventToken, GameLoop, type GameLoopCallbacks, type GameLoopConfig, GameLoopKey, type InputStateSnapshot, Inspector, InspectorKey, type InspectorTimeController, type Interpolatable, type Keyframe, type KeyframeAnimationDef, KeyframeAnimator, type KeyframeTrackOptions, LoadingScene, type LogEntry, LogLevel, Logger, type LoggerConfig, LoggerKey, MathUtils, Phase, type PhysicsSnapshot, type Plugin, type PointerSnapshot, Process, ProcessComponent, type ProcessOptions, ProcessSlot, type ProcessSlotConfig, ProcessSystem, ProcessSystemKey, QueryCache, QueryCacheKey, QueryResult, RandomKey, type RandomService, type RendererAdapter, RendererAdapterKey, SERIALIZABLE_KEY, Scene, SceneHookRegistry, SceneHookRegistryKey, type SceneHooks, SceneManager, SceneManagerKey, type SceneSnapshot, type SceneTransition, type SceneTransitionContext, type SceneTransitionKind, type SceneTransitionOptions, type ScopedProcessQueue, Sequence, SerializableRegistry, ServiceKey, type ServiceKeyOptions, type ServiceScope, type SmoothDampResult, type SnapshotResolver, System, SystemScheduler, SystemSchedulerKey, type SystemSnapshot, TimerEntity, TraitToken, Transform, type TransformData, Tween, type UINodeSnapshot, type UITreeSnapshot, VERSION, Vec2, type Vec2Like, type WorldEntitySnapshot, type WorldSceneSnapshot, _resetEntityIdCounter, advanceFrames, createDefaultRandomSeed, createKeyframeTrack, createMockEntity, createMockScene, createRandomService, createTestEngine, defineBlueprint, defineEvent, defineTrait, easeInOutQuad, easeInQuad, easeLinear, easeOutBounce, easeOutQuad, filterEntities, getSerializableType, globalRandom, interpolate, isPointerConsumeContainer, isSerializable, makeEntityScopedQueue, makeGlobalScopedQueue, makeSceneScopedQueue, markPointerConsumeContainer, normalizeSeed, resolveTransition, serializable, trait, unmarkPointerConsumeContainer };
|
package/dist/index.d.ts
CHANGED
|
@@ -550,6 +550,12 @@ interface EngineEvents {
|
|
|
550
550
|
};
|
|
551
551
|
"engine:started": undefined;
|
|
552
552
|
"engine:stopped": undefined;
|
|
553
|
+
"screen:fullscreen": {
|
|
554
|
+
active: boolean;
|
|
555
|
+
};
|
|
556
|
+
"screen:orientation": {
|
|
557
|
+
type: OrientationType;
|
|
558
|
+
};
|
|
553
559
|
}
|
|
554
560
|
/** Typed publish/subscribe event bus. */
|
|
555
561
|
declare class EventBus<E = EventMap> {
|
|
@@ -840,6 +846,22 @@ declare function createRandomService(seed?: number): RandomService;
|
|
|
840
846
|
*/
|
|
841
847
|
declare const globalRandom: RandomService;
|
|
842
848
|
|
|
849
|
+
/**
|
|
850
|
+
* Mirrors `GamepadAxisKey` from `@yagejs/input` as a local union so the
|
|
851
|
+
* Inspector contract gets compile-time literal checking without taking a
|
|
852
|
+
* runtime dependency on the input package.
|
|
853
|
+
*/
|
|
854
|
+
type InspectorGamepadAxisKey = "leftX" | "leftY" | "rightX" | "rightY" | "leftTrigger" | "rightTrigger";
|
|
855
|
+
/**
|
|
856
|
+
* Options for synthetic pointer injection. Pass `id` / `type` / `isPrimary`
|
|
857
|
+
* to drive a non-primary, touch, or pen pointer in deterministic tests. All
|
|
858
|
+
* fields are optional and default to a primary mouse pointer with `id: 1`.
|
|
859
|
+
*/
|
|
860
|
+
interface InspectorPointerOpts {
|
|
861
|
+
id?: number;
|
|
862
|
+
type?: "mouse" | "pen" | "touch";
|
|
863
|
+
isPrimary?: boolean;
|
|
864
|
+
}
|
|
843
865
|
/** Backward-compatible summary snapshot returned by query helpers. */
|
|
844
866
|
interface EntitySnapshot {
|
|
845
867
|
id: number;
|
|
@@ -955,19 +977,48 @@ interface CameraSnapshot {
|
|
|
955
977
|
zoom: number;
|
|
956
978
|
rotation: number;
|
|
957
979
|
}
|
|
980
|
+
/**
|
|
981
|
+
* Per-pointer entry in {@link InputStateSnapshot.pointers}. Mirrors the runtime
|
|
982
|
+
* `PointerInfo` shape from `@yagejs/input`. Touch pointers vanish from the
|
|
983
|
+
* array once their last button releases; mouse pointers persist.
|
|
984
|
+
*/
|
|
985
|
+
interface PointerSnapshot {
|
|
986
|
+
/** `PointerEvent.pointerId`, or the synthetic id passed via `firePointer*`. */
|
|
987
|
+
id: number;
|
|
988
|
+
x: number;
|
|
989
|
+
y: number;
|
|
990
|
+
type: "mouse" | "pen" | "touch";
|
|
991
|
+
isPrimary: boolean;
|
|
992
|
+
buttons: number[];
|
|
993
|
+
down: boolean;
|
|
994
|
+
}
|
|
958
995
|
interface InputStateSnapshot {
|
|
959
996
|
keys: string[];
|
|
960
997
|
actions: string[];
|
|
998
|
+
/**
|
|
999
|
+
* Aggregate / primary-pointer view, retained for back-compat. `x` / `y` track
|
|
1000
|
+
* the primary pointer's screen position; `buttons` / `down` reflect the
|
|
1001
|
+
* any-pointer aggregate that drives the `MouseLeft`/`Middle`/`Right` action codes.
|
|
1002
|
+
*
|
|
1003
|
+
* For multi-touch state, read {@link InputStateSnapshot.pointers}.
|
|
1004
|
+
*/
|
|
961
1005
|
mouse: {
|
|
962
1006
|
x: number;
|
|
963
1007
|
y: number;
|
|
964
1008
|
buttons: number[];
|
|
965
1009
|
down: boolean;
|
|
966
1010
|
};
|
|
1011
|
+
/** All currently-tracked pointers (one per active mouse, pen, or finger). */
|
|
1012
|
+
pointers: PointerSnapshot[];
|
|
967
1013
|
gamepad: {
|
|
968
|
-
|
|
1014
|
+
/** Currently-held gamepad codes (e.g. `"GamepadA"`, `"GamepadLT"`). */
|
|
1015
|
+
buttons: string[];
|
|
1016
|
+
/**
|
|
1017
|
+
* Axis state keyed by `${padIndex}:${axisName}` (axisName is a
|
|
1018
|
+
* `GamepadAxisKey` from `@yagejs/input`).
|
|
1019
|
+
*/
|
|
969
1020
|
axes: Array<{
|
|
970
|
-
|
|
1021
|
+
key: string;
|
|
971
1022
|
value: number;
|
|
972
1023
|
}>;
|
|
973
1024
|
};
|
|
@@ -1039,8 +1090,23 @@ declare class Inspector {
|
|
|
1039
1090
|
mouseMove: (x: number, y: number) => void;
|
|
1040
1091
|
mouseDown: (button?: 0 | 1 | 2) => void;
|
|
1041
1092
|
mouseUp: (button?: 0 | 1 | 2) => void;
|
|
1042
|
-
|
|
1043
|
-
|
|
1093
|
+
/**
|
|
1094
|
+
* Inject a synthetic pointer-move with full pointer addressing. Pass `opts`
|
|
1095
|
+
* with `id` / `type: "touch"` to drive a specific finger; defaults match
|
|
1096
|
+
* the primary mouse pointer (same as `mouseMove`).
|
|
1097
|
+
*/
|
|
1098
|
+
pointerMove: (x: number, y: number, opts?: InspectorPointerOpts) => void;
|
|
1099
|
+
/**
|
|
1100
|
+
* Inject a synthetic pointer-down. With `opts.id` and `opts.type: "touch"`
|
|
1101
|
+
* this drives a multi-touch contact, exercising `getPointers()`,
|
|
1102
|
+
* per-pointer event hooks, and the any-pointer aggregate for `MouseLeft`.
|
|
1103
|
+
*/
|
|
1104
|
+
pointerDown: (button?: 0 | 1 | 2, opts?: InspectorPointerOpts) => void;
|
|
1105
|
+
pointerUp: (button?: 0 | 1 | 2, opts?: {
|
|
1106
|
+
id?: number;
|
|
1107
|
+
}) => void;
|
|
1108
|
+
gamepadButton: (code: string, pressed: boolean) => void;
|
|
1109
|
+
gamepadAxis: (side: InspectorGamepadAxisKey, value: number) => void;
|
|
1044
1110
|
tap: (code: string, frames?: number) => void;
|
|
1045
1111
|
hold: (code: string, frames: number) => void;
|
|
1046
1112
|
fireAction: (name: string, frames?: number) => void;
|
|
@@ -2230,6 +2296,19 @@ interface RendererAdapter {
|
|
|
2230
2296
|
x: number;
|
|
2231
2297
|
y: number;
|
|
2232
2298
|
};
|
|
2299
|
+
/**
|
|
2300
|
+
* Hit-test at virtual-space coordinates and return `true` when the topmost
|
|
2301
|
+
* interactive container under `(x, y)` is parented (directly or through any
|
|
2302
|
+
* ancestor) to a container marked via {@link markPointerConsumeContainer}.
|
|
2303
|
+
* Optional — when absent, the input plugin's UI auto-consume fallback is a
|
|
2304
|
+
* no-op.
|
|
2305
|
+
*
|
|
2306
|
+
* Implemented by `@yagejs/renderer` over Pixi's `EventBoundary`. The input
|
|
2307
|
+
* plugin calls this on `pointerdown` drains to auto-claim presses that land
|
|
2308
|
+
* on UI surfaces (UIPanel backgrounds, decorative UIText, etc.) without
|
|
2309
|
+
* requiring per-component handler boilerplate.
|
|
2310
|
+
*/
|
|
2311
|
+
hitTestUI?(x: number, y: number): boolean;
|
|
2233
2312
|
}
|
|
2234
2313
|
/**
|
|
2235
2314
|
* Well-known service key for the current renderer's pointer-input adapter.
|
|
@@ -2239,6 +2318,36 @@ interface RendererAdapter {
|
|
|
2239
2318
|
*/
|
|
2240
2319
|
declare const RendererAdapterKey: ServiceKey<RendererAdapter>;
|
|
2241
2320
|
|
|
2321
|
+
/**
|
|
2322
|
+
* Cross-package WeakSet for marking display containers (Pixi `Container`s in
|
|
2323
|
+
* the canonical setup) as "swallow pointer input." The `@yagejs/input`
|
|
2324
|
+
* package's drain step consults this set via the renderer's optional
|
|
2325
|
+
* `hitTestUI(x, y)` — when the topmost interactive container under a
|
|
2326
|
+
* `pointerdown` is parented to a marked container, the pointer is auto-claimed
|
|
2327
|
+
* (`consumePointer`-equivalent), so the press never propagates to gameplay
|
|
2328
|
+
* action-map edges like `MouseLeft`.
|
|
2329
|
+
*
|
|
2330
|
+
* Lives in `@yagejs/core` so the renderer (read side) and the UI / sprite
|
|
2331
|
+
* components (write side) can both reach it without circular imports.
|
|
2332
|
+
*
|
|
2333
|
+
* Untyped on `Container` to keep `@yagejs/core` free of any Pixi dependency.
|
|
2334
|
+
* Callers pass their `Pixi.Container` instances directly; `WeakSet` accepts
|
|
2335
|
+
* any object reference.
|
|
2336
|
+
*/
|
|
2337
|
+
/**
|
|
2338
|
+
* Mark a display container as a UI-input surface. Idempotent. Call from a
|
|
2339
|
+
* component's `onAdd` (or equivalent) after the underlying Pixi container is
|
|
2340
|
+
* created.
|
|
2341
|
+
*/
|
|
2342
|
+
declare function markPointerConsumeContainer(container: object): void;
|
|
2343
|
+
/**
|
|
2344
|
+
* Remove the mark. Call from a component's `onDestroy` for symmetry, or to
|
|
2345
|
+
* implement an opt-out (`consumeInput: false`) escape hatch on UI primitives.
|
|
2346
|
+
*/
|
|
2347
|
+
declare function unmarkPointerConsumeContainer(container: object): void;
|
|
2348
|
+
/** Whether a container has been marked as a UI-input surface. */
|
|
2349
|
+
declare function isPointerConsumeContainer(container: object): boolean;
|
|
2350
|
+
|
|
2242
2351
|
/** Create a fully wired Engine for integration tests. */
|
|
2243
2352
|
declare function createTestEngine(config?: EngineConfig): Promise<Engine>;
|
|
2244
2353
|
/** Create a lightweight mock scene with EngineContext for unit tests. */
|
|
@@ -2257,4 +2366,4 @@ declare function advanceFrames(engine: Engine, n: number, dtMs?: number): void;
|
|
|
2257
2366
|
|
|
2258
2367
|
declare const VERSION = "0.0.0";
|
|
2259
2368
|
|
|
2260
|
-
export { AssetHandle, type AssetLoader, AssetManager, AssetManagerKey, type Blueprint, type CameraSnapshot, Component, type ComponentClass, ComponentFixedUpdateSystem, type ComponentStateSnapshot, ComponentUpdateSystem, type EasingFunction, Engine, type EngineConfig, EngineContext, type EngineEvents, EngineKey, type EngineSnapshot, Entity, type EntityCallbacks, type EntityFilter, type EntitySnapshot, ErrorBoundary, ErrorBoundaryKey, type ErrorSnapshot, EventBus, EventBusKey, type EventLogEntry, type EventMap, EventToken, GameLoop, type GameLoopCallbacks, type GameLoopConfig, GameLoopKey, type InputStateSnapshot, Inspector, InspectorKey, type InspectorTimeController, type Interpolatable, type Keyframe, type KeyframeAnimationDef, KeyframeAnimator, type KeyframeTrackOptions, LoadingScene, type LogEntry, LogLevel, Logger, type LoggerConfig, LoggerKey, MathUtils, Phase, type PhysicsSnapshot, type Plugin, Process, ProcessComponent, type ProcessOptions, ProcessSlot, type ProcessSlotConfig, ProcessSystem, ProcessSystemKey, QueryCache, QueryCacheKey, QueryResult, RandomKey, type RandomService, type RendererAdapter, RendererAdapterKey, SERIALIZABLE_KEY, Scene, SceneHookRegistry, SceneHookRegistryKey, type SceneHooks, SceneManager, SceneManagerKey, type SceneSnapshot, type SceneTransition, type SceneTransitionContext, type SceneTransitionKind, type SceneTransitionOptions, type ScopedProcessQueue, Sequence, SerializableRegistry, ServiceKey, type ServiceKeyOptions, type ServiceScope, type SmoothDampResult, type SnapshotResolver, System, SystemScheduler, SystemSchedulerKey, type SystemSnapshot, TimerEntity, TraitToken, Transform, type TransformData, Tween, type UINodeSnapshot, type UITreeSnapshot, VERSION, Vec2, type Vec2Like, type WorldEntitySnapshot, type WorldSceneSnapshot, _resetEntityIdCounter, advanceFrames, createDefaultRandomSeed, createKeyframeTrack, createMockEntity, createMockScene, createRandomService, createTestEngine, defineBlueprint, defineEvent, defineTrait, easeInOutQuad, easeInQuad, easeLinear, easeOutBounce, easeOutQuad, filterEntities, getSerializableType, globalRandom, interpolate, isSerializable, makeEntityScopedQueue, makeGlobalScopedQueue, makeSceneScopedQueue, normalizeSeed, resolveTransition, serializable, trait };
|
|
2369
|
+
export { AssetHandle, type AssetLoader, AssetManager, AssetManagerKey, type Blueprint, type CameraSnapshot, Component, type ComponentClass, ComponentFixedUpdateSystem, type ComponentStateSnapshot, ComponentUpdateSystem, type EasingFunction, Engine, type EngineConfig, EngineContext, type EngineEvents, EngineKey, type EngineSnapshot, Entity, type EntityCallbacks, type EntityFilter, type EntitySnapshot, ErrorBoundary, ErrorBoundaryKey, type ErrorSnapshot, EventBus, EventBusKey, type EventLogEntry, type EventMap, EventToken, GameLoop, type GameLoopCallbacks, type GameLoopConfig, GameLoopKey, type InputStateSnapshot, Inspector, InspectorKey, type InspectorTimeController, type Interpolatable, type Keyframe, type KeyframeAnimationDef, KeyframeAnimator, type KeyframeTrackOptions, LoadingScene, type LogEntry, LogLevel, Logger, type LoggerConfig, LoggerKey, MathUtils, Phase, type PhysicsSnapshot, type Plugin, type PointerSnapshot, Process, ProcessComponent, type ProcessOptions, ProcessSlot, type ProcessSlotConfig, ProcessSystem, ProcessSystemKey, QueryCache, QueryCacheKey, QueryResult, RandomKey, type RandomService, type RendererAdapter, RendererAdapterKey, SERIALIZABLE_KEY, Scene, SceneHookRegistry, SceneHookRegistryKey, type SceneHooks, SceneManager, SceneManagerKey, type SceneSnapshot, type SceneTransition, type SceneTransitionContext, type SceneTransitionKind, type SceneTransitionOptions, type ScopedProcessQueue, Sequence, SerializableRegistry, ServiceKey, type ServiceKeyOptions, type ServiceScope, type SmoothDampResult, type SnapshotResolver, System, SystemScheduler, SystemSchedulerKey, type SystemSnapshot, TimerEntity, TraitToken, Transform, type TransformData, Tween, type UINodeSnapshot, type UITreeSnapshot, VERSION, Vec2, type Vec2Like, type WorldEntitySnapshot, type WorldSceneSnapshot, _resetEntityIdCounter, advanceFrames, createDefaultRandomSeed, createKeyframeTrack, createMockEntity, createMockScene, createRandomService, createTestEngine, defineBlueprint, defineEvent, defineTrait, easeInOutQuad, easeInQuad, easeLinear, easeOutBounce, easeOutQuad, filterEntities, getSerializableType, globalRandom, interpolate, isPointerConsumeContainer, isSerializable, makeEntityScopedQueue, makeGlobalScopedQueue, makeSceneScopedQueue, markPointerConsumeContainer, normalizeSeed, resolveTransition, serializable, trait, unmarkPointerConsumeContainer };
|
package/dist/index.js
CHANGED
|
@@ -1803,11 +1803,30 @@ var Inspector = class {
|
|
|
1803
1803
|
mouseUp: /* @__PURE__ */ __name((button = 0) => {
|
|
1804
1804
|
this.requireInputManager().firePointerUp(button);
|
|
1805
1805
|
}, "mouseUp"),
|
|
1806
|
-
|
|
1807
|
-
|
|
1806
|
+
/**
|
|
1807
|
+
* Inject a synthetic pointer-move with full pointer addressing. Pass `opts`
|
|
1808
|
+
* with `id` / `type: "touch"` to drive a specific finger; defaults match
|
|
1809
|
+
* the primary mouse pointer (same as `mouseMove`).
|
|
1810
|
+
*/
|
|
1811
|
+
pointerMove: /* @__PURE__ */ __name((x, y, opts) => {
|
|
1812
|
+
this.requireInputManager().firePointerMove(x, y, opts);
|
|
1813
|
+
}, "pointerMove"),
|
|
1814
|
+
/**
|
|
1815
|
+
* Inject a synthetic pointer-down. With `opts.id` and `opts.type: "touch"`
|
|
1816
|
+
* this drives a multi-touch contact, exercising `getPointers()`,
|
|
1817
|
+
* per-pointer event hooks, and the any-pointer aggregate for `MouseLeft`.
|
|
1818
|
+
*/
|
|
1819
|
+
pointerDown: /* @__PURE__ */ __name((button = 0, opts) => {
|
|
1820
|
+
this.requireInputManager().firePointerDown(button, opts);
|
|
1821
|
+
}, "pointerDown"),
|
|
1822
|
+
pointerUp: /* @__PURE__ */ __name((button = 0, opts) => {
|
|
1823
|
+
this.requireInputManager().firePointerUp(button, opts);
|
|
1824
|
+
}, "pointerUp"),
|
|
1825
|
+
gamepadButton: /* @__PURE__ */ __name((code, pressed) => {
|
|
1826
|
+
this.requireInputManager().fireGamepadButton(code, pressed);
|
|
1808
1827
|
}, "gamepadButton"),
|
|
1809
|
-
gamepadAxis: /* @__PURE__ */ __name((
|
|
1810
|
-
this.requireInputManager().fireGamepadAxis(
|
|
1828
|
+
gamepadAxis: /* @__PURE__ */ __name((side, value) => {
|
|
1829
|
+
this.requireInputManager().fireGamepadAxis(side, value);
|
|
1811
1830
|
}, "gamepadAxis"),
|
|
1812
1831
|
tap: /* @__PURE__ */ __name((code, frames = 1) => {
|
|
1813
1832
|
this.assertNonNegativeInteger(frames, "Inspector.input.tap(frames)");
|
|
@@ -2366,6 +2385,7 @@ var Inspector = class {
|
|
|
2366
2385
|
keys: [],
|
|
2367
2386
|
actions: [],
|
|
2368
2387
|
mouse: { x: 0, y: 0, buttons: [], down: false },
|
|
2388
|
+
pointers: [],
|
|
2369
2389
|
gamepad: { buttons: [], axes: [] }
|
|
2370
2390
|
};
|
|
2371
2391
|
}
|
|
@@ -4389,6 +4409,21 @@ var RendererAdapterKey = new ServiceKey(
|
|
|
4389
4409
|
"rendererAdapter"
|
|
4390
4410
|
);
|
|
4391
4411
|
|
|
4412
|
+
// src/ui-consume-registry.ts
|
|
4413
|
+
var registry2 = /* @__PURE__ */ new WeakSet();
|
|
4414
|
+
function markPointerConsumeContainer(container) {
|
|
4415
|
+
registry2.add(container);
|
|
4416
|
+
}
|
|
4417
|
+
__name(markPointerConsumeContainer, "markPointerConsumeContainer");
|
|
4418
|
+
function unmarkPointerConsumeContainer(container) {
|
|
4419
|
+
registry2.delete(container);
|
|
4420
|
+
}
|
|
4421
|
+
__name(unmarkPointerConsumeContainer, "unmarkPointerConsumeContainer");
|
|
4422
|
+
function isPointerConsumeContainer(container) {
|
|
4423
|
+
return registry2.has(container);
|
|
4424
|
+
}
|
|
4425
|
+
__name(isPointerConsumeContainer, "isPointerConsumeContainer");
|
|
4426
|
+
|
|
4392
4427
|
// src/test-utils.ts
|
|
4393
4428
|
var _TestScene = class extends Scene {
|
|
4394
4429
|
static {
|
|
@@ -4513,13 +4548,16 @@ export {
|
|
|
4513
4548
|
getSerializableType,
|
|
4514
4549
|
globalRandom,
|
|
4515
4550
|
interpolate,
|
|
4551
|
+
isPointerConsumeContainer,
|
|
4516
4552
|
isSerializable,
|
|
4517
4553
|
makeEntityScopedQueue,
|
|
4518
4554
|
makeGlobalScopedQueue,
|
|
4519
4555
|
makeSceneScopedQueue,
|
|
4556
|
+
markPointerConsumeContainer,
|
|
4520
4557
|
normalizeSeed,
|
|
4521
4558
|
resolveTransition,
|
|
4522
4559
|
serializable,
|
|
4523
|
-
trait
|
|
4560
|
+
trait,
|
|
4561
|
+
unmarkPointerConsumeContainer
|
|
4524
4562
|
};
|
|
4525
4563
|
//# sourceMappingURL=index.js.map
|