@flare-engine/input 0.4.5 → 0.4.7
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.d.mts +34 -52
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +34 -52
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Signal } from "@flare-engine/events";
|
|
2
2
|
import { Vec2 } from "@flare-engine/math";
|
|
3
|
-
//#region src/gamepad.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Gamepad — poll-based state for a single connected controller.
|
|
6
5
|
*
|
|
@@ -9,7 +8,7 @@ import { Vec2 } from "@flare-engine/math";
|
|
|
9
8
|
* snapshots into `updateGamepadFromSnapshot`.
|
|
10
9
|
*/
|
|
11
10
|
/** W3C Standard Gamepad button indices. */
|
|
12
|
-
declare const GamepadButton: {
|
|
11
|
+
export declare const GamepadButton: {
|
|
13
12
|
readonly A: 0;
|
|
14
13
|
readonly B: 1;
|
|
15
14
|
readonly X: 2;
|
|
@@ -30,7 +29,7 @@ declare const GamepadButton: {
|
|
|
30
29
|
};
|
|
31
30
|
type GamepadButtonId = (typeof GamepadButton)[keyof typeof GamepadButton];
|
|
32
31
|
/** W3C Standard Gamepad axes. */
|
|
33
|
-
declare const GamepadAxis: {
|
|
32
|
+
export declare const GamepadAxis: {
|
|
34
33
|
readonly LeftX: 0;
|
|
35
34
|
readonly LeftY: 1;
|
|
36
35
|
readonly RightX: 2;
|
|
@@ -65,7 +64,7 @@ interface GamepadSnapshot {
|
|
|
65
64
|
axes: number[];
|
|
66
65
|
timestamp: number;
|
|
67
66
|
}
|
|
68
|
-
declare function createGamepadState(index?: number, buttonCount?: number, axisCount?: number): GamepadState;
|
|
67
|
+
export declare function createGamepadState(index?: number, buttonCount?: number, axisCount?: number): GamepadState;
|
|
69
68
|
/**
|
|
70
69
|
* Apply a fresh snapshot to an existing `GamepadState` in place. Derived
|
|
71
70
|
* `justPressed` / `justReleased` flags are recomputed from the
|
|
@@ -73,15 +72,13 @@ declare function createGamepadState(index?: number, buttonCount?: number, axisCo
|
|
|
73
72
|
*
|
|
74
73
|
* `deadZone` in [0, 1). Values at or below are treated as 0.
|
|
75
74
|
*/
|
|
76
|
-
declare function updateGamepadFromSnapshot(state: GamepadState, snapshot: GamepadSnapshot | null, deadZone?: number): void;
|
|
75
|
+
export declare function updateGamepadFromSnapshot(state: GamepadState, snapshot: GamepadSnapshot | null, deadZone?: number): void;
|
|
77
76
|
/** Reset just the per-frame edge flags. Call when advancing a frame without a fresh snapshot. */
|
|
78
|
-
declare function resetGamepadFrame(state: GamepadState): void;
|
|
79
|
-
declare function isButtonDown(state: GamepadState, button: number): boolean;
|
|
80
|
-
declare function wasButtonPressed(state: GamepadState, button: number): boolean;
|
|
81
|
-
declare function wasButtonReleased(state: GamepadState, button: number): boolean;
|
|
82
|
-
declare function getAxis(state: GamepadState, axis: number): number;
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/gamepad-source.d.ts
|
|
77
|
+
export declare function resetGamepadFrame(state: GamepadState): void;
|
|
78
|
+
export declare function isButtonDown(state: GamepadState, button: number): boolean;
|
|
79
|
+
export declare function wasButtonPressed(state: GamepadState, button: number): boolean;
|
|
80
|
+
export declare function wasButtonReleased(state: GamepadState, button: number): boolean;
|
|
81
|
+
export declare function getAxis(state: GamepadState, axis: number): number;
|
|
85
82
|
/**
|
|
86
83
|
* Platform abstraction for sampling connected gamepads.
|
|
87
84
|
*
|
|
@@ -118,9 +115,7 @@ interface WebGamepad {
|
|
|
118
115
|
* Wrap `navigator.getGamepads()` (W3C Gamepad API). If `nav` is not supplied,
|
|
119
116
|
* uses `globalThis.navigator`. Returns an empty array when the API is absent.
|
|
120
117
|
*/
|
|
121
|
-
declare function createWebGamepadSource(nav?: NavigatorLike): GamepadSource;
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region src/gestures.d.ts
|
|
118
|
+
export declare function createWebGamepadSource(nav?: NavigatorLike): GamepadSource;
|
|
124
119
|
/** Swipe direction. */
|
|
125
120
|
type SwipeDirection = 'left' | 'right' | 'up' | 'down';
|
|
126
121
|
/** Gesture detection configuration. */
|
|
@@ -153,7 +148,7 @@ interface PinchEvent {
|
|
|
153
148
|
* GestureDetector recognizes tap, long press, swipe, and pinch gestures
|
|
154
149
|
* from raw pointer events.
|
|
155
150
|
*/
|
|
156
|
-
declare class GestureDetector {
|
|
151
|
+
export declare class GestureDetector {
|
|
157
152
|
readonly onTap: Signal<Vec2>;
|
|
158
153
|
readonly onLongPress: Signal<Vec2>;
|
|
159
154
|
readonly onSwipe: Signal<SwipeEvent>;
|
|
@@ -201,8 +196,6 @@ declare class GestureDetector {
|
|
|
201
196
|
/** Call when pinch ends (fewer than 2 touches). */
|
|
202
197
|
pinchEnd(): void;
|
|
203
198
|
}
|
|
204
|
-
//#endregion
|
|
205
|
-
//#region src/keyboard.d.ts
|
|
206
199
|
/** Minimal keyboard event shape — no DOM type dep. */
|
|
207
200
|
interface KeyboardEventLike {
|
|
208
201
|
readonly code: string;
|
|
@@ -240,7 +233,7 @@ interface KeyboardState {
|
|
|
240
233
|
clear(): void;
|
|
241
234
|
}
|
|
242
235
|
/** Create a fresh keyboard state. */
|
|
243
|
-
declare function createKeyboard(): KeyboardState;
|
|
236
|
+
export declare function createKeyboard(): KeyboardState;
|
|
244
237
|
/**
|
|
245
238
|
* Web turnkey adapter: registers `keydown`, `keyup`, and `blur` listeners on
|
|
246
239
|
* `target`. `blur` calls `kb.clear()` (stuck-key guard). Returns a detach fn.
|
|
@@ -253,7 +246,7 @@ declare function createKeyboard(): KeyboardState;
|
|
|
253
246
|
* move DOM focus. For game-mode input, attach your own listener that calls
|
|
254
247
|
* `preventDefault` for game keys and forwards `kb.keyDown(ev.code)`.
|
|
255
248
|
*/
|
|
256
|
-
declare function attachKeyboardListeners(kb: KeyboardState, target: KeyboardEventTargetLike): () => void;
|
|
249
|
+
export declare function attachKeyboardListeners(kb: KeyboardState, target: KeyboardEventTargetLike): () => void;
|
|
257
250
|
/**
|
|
258
251
|
* Action → code binding map. Keys are action names; values are arrays of
|
|
259
252
|
* `KeyboardEvent.code` strings. Multiple codes OR-reduce (any bound key
|
|
@@ -261,16 +254,14 @@ declare function attachKeyboardListeners(kb: KeyboardState, target: KeyboardEven
|
|
|
261
254
|
*/
|
|
262
255
|
type KeyBindings = Readonly<Record<string, readonly string[]>>;
|
|
263
256
|
/** True if any bound code for `action` is currently held. */
|
|
264
|
-
declare function isActionDown(kb: KeyboardState, bindings: KeyBindings, action: string): boolean;
|
|
257
|
+
export declare function isActionDown(kb: KeyboardState, bindings: KeyBindings, action: string): boolean;
|
|
265
258
|
/** True if any bound code for `action` was pressed this frame. */
|
|
266
|
-
declare function wasActionPressed(kb: KeyboardState, bindings: KeyBindings, action: string): boolean;
|
|
259
|
+
export declare function wasActionPressed(kb: KeyboardState, bindings: KeyBindings, action: string): boolean;
|
|
267
260
|
/**
|
|
268
261
|
* True if any bound code for `action` was released this frame AND no bound
|
|
269
262
|
* code is still held. Release fires only when the last held bound key lifts.
|
|
270
263
|
*/
|
|
271
|
-
declare function wasActionReleased(kb: KeyboardState, bindings: KeyBindings, action: string): boolean;
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region src/pointer.d.ts
|
|
264
|
+
export declare function wasActionReleased(kb: KeyboardState, bindings: KeyBindings, action: string): boolean;
|
|
274
265
|
/** State of a single pointer (primary touch or mouse). */
|
|
275
266
|
interface Pointer {
|
|
276
267
|
/** Current position in screen coordinates. */
|
|
@@ -294,20 +285,18 @@ interface TouchPoint {
|
|
|
294
285
|
isDown: boolean;
|
|
295
286
|
}
|
|
296
287
|
/** Create a default pointer state. */
|
|
297
|
-
declare function createPointer(): Pointer;
|
|
288
|
+
export declare function createPointer(): Pointer;
|
|
298
289
|
/**
|
|
299
290
|
* Update pointer state for a new frame.
|
|
300
291
|
* Call this at the start of each frame to clear per-frame flags.
|
|
301
292
|
*/
|
|
302
|
-
declare function resetPointerFrame(pointer: Pointer): void;
|
|
293
|
+
export declare function resetPointerFrame(pointer: Pointer): void;
|
|
303
294
|
/** Feed a pointer-down event into the pointer state. */
|
|
304
|
-
declare function pointerDown(pointer: Pointer, x: number, y: number): void;
|
|
295
|
+
export declare function pointerDown(pointer: Pointer, x: number, y: number): void;
|
|
305
296
|
/** Feed a pointer-move event into the pointer state. */
|
|
306
|
-
declare function pointerMove(pointer: Pointer, x: number, y: number): void;
|
|
297
|
+
export declare function pointerMove(pointer: Pointer, x: number, y: number): void;
|
|
307
298
|
/** Feed a pointer-up event into the pointer state. */
|
|
308
|
-
declare function pointerUp(pointer: Pointer, x: number, y: number): void;
|
|
309
|
-
//#endregion
|
|
310
|
-
//#region src/remap.d.ts
|
|
299
|
+
export declare function pointerUp(pointer: Pointer, x: number, y: number): void;
|
|
311
300
|
/**
|
|
312
301
|
* Button / axis remap table.
|
|
313
302
|
*
|
|
@@ -326,9 +315,9 @@ interface RemapTable {
|
|
|
326
315
|
buttons: number[];
|
|
327
316
|
axes: AxisMap[];
|
|
328
317
|
}
|
|
329
|
-
declare function createIdentityRemap(buttonCount?: number, axisCount?: number): RemapTable;
|
|
318
|
+
export declare function createIdentityRemap(buttonCount?: number, axisCount?: number): RemapTable;
|
|
330
319
|
/** Apply a remap table to a raw snapshot, returning a new snapshot with logical ordering. */
|
|
331
|
-
declare function applyRemap(snapshot: GamepadSnapshot, table: RemapTable): GamepadSnapshot;
|
|
320
|
+
export declare function applyRemap(snapshot: GamepadSnapshot, table: RemapTable): GamepadSnapshot;
|
|
332
321
|
/**
|
|
333
322
|
* Minimal storage contract — matches `@flare-engine/storage` `StorageAdapter`,
|
|
334
323
|
* but declared locally so this package does not take a hard dep on storage.
|
|
@@ -338,18 +327,16 @@ interface RemapStore {
|
|
|
338
327
|
set(key: string, value: string): Promise<void>;
|
|
339
328
|
}
|
|
340
329
|
/** Persist a remap table under the given key. Throws on invalid table shape. */
|
|
341
|
-
declare function saveRemap(store: RemapStore, key: string, table: RemapTable): Promise<void>;
|
|
330
|
+
export declare function saveRemap(store: RemapStore, key: string, table: RemapTable): Promise<void>;
|
|
342
331
|
/** Load a remap table. Returns `null` if absent or malformed. */
|
|
343
|
-
declare function loadRemap(store: RemapStore, key: string): Promise<RemapTable | null>;
|
|
344
|
-
//#endregion
|
|
345
|
-
//#region src/input-manager.d.ts
|
|
332
|
+
export declare function loadRemap(store: RemapStore, key: string): Promise<RemapTable | null>;
|
|
346
333
|
/**
|
|
347
334
|
* InputManager provides a polling-based input model.
|
|
348
335
|
*
|
|
349
336
|
* Call `update()` once per frame (before game logic) to snapshot input state.
|
|
350
337
|
* Feed events from the platform (RN touch/gesture handlers) via the on* methods.
|
|
351
338
|
*/
|
|
352
|
-
declare class InputManager {
|
|
339
|
+
export declare class InputManager {
|
|
353
340
|
/**
|
|
354
341
|
* Primary pointer — the touch that started the current gesture (first
|
|
355
342
|
* `onPointerDown` while no touch was active), or the mouse.
|
|
@@ -392,8 +379,6 @@ declare class InputManager {
|
|
|
392
379
|
private _addOrUpdateTouch;
|
|
393
380
|
private _removeTouch;
|
|
394
381
|
}
|
|
395
|
-
//#endregion
|
|
396
|
-
//#region src/virtual-button.d.ts
|
|
397
382
|
/** Virtual button state — pure data, no UI. */
|
|
398
383
|
interface VirtualButtonState {
|
|
399
384
|
/** Whether the button is currently pressed. */
|
|
@@ -404,15 +389,13 @@ interface VirtualButtonState {
|
|
|
404
389
|
justReleased: boolean;
|
|
405
390
|
}
|
|
406
391
|
/** Create a default button state. */
|
|
407
|
-
declare function createButtonState(): VirtualButtonState;
|
|
392
|
+
export declare function createButtonState(): VirtualButtonState;
|
|
408
393
|
/** Call at the start of each frame to reset per-frame flags. */
|
|
409
|
-
declare function resetButtonFrame(state: VirtualButtonState): void;
|
|
394
|
+
export declare function resetButtonFrame(state: VirtualButtonState): void;
|
|
410
395
|
/** Call when the button is pressed. */
|
|
411
|
-
declare function pressButton(state: VirtualButtonState): void;
|
|
396
|
+
export declare function pressButton(state: VirtualButtonState): void;
|
|
412
397
|
/** Call when the button is released. */
|
|
413
|
-
declare function releaseButton(state: VirtualButtonState): void;
|
|
414
|
-
//#endregion
|
|
415
|
-
//#region src/virtual-joystick.d.ts
|
|
398
|
+
export declare function releaseButton(state: VirtualButtonState): void;
|
|
416
399
|
/** Virtual joystick configuration. */
|
|
417
400
|
interface VirtualJoystickConfig {
|
|
418
401
|
/** Dead zone radius in pixels (default 10). */
|
|
@@ -432,7 +415,7 @@ interface VirtualJoystickState {
|
|
|
432
415
|
offset: Vec2;
|
|
433
416
|
}
|
|
434
417
|
/** Create a default joystick state. */
|
|
435
|
-
declare function createJoystickState(): VirtualJoystickState;
|
|
418
|
+
export declare function createJoystickState(): VirtualJoystickState;
|
|
436
419
|
/**
|
|
437
420
|
* Update joystick state from a touch event.
|
|
438
421
|
*
|
|
@@ -443,9 +426,8 @@ declare function createJoystickState(): VirtualJoystickState;
|
|
|
443
426
|
* @param touchY The current touch Y in screen pixels.
|
|
444
427
|
* @param config Joystick configuration.
|
|
445
428
|
*/
|
|
446
|
-
declare function updateJoystick(state: VirtualJoystickState, centerX: number, centerY: number, touchX: number, touchY: number, config?: VirtualJoystickConfig): void;
|
|
429
|
+
export declare function updateJoystick(state: VirtualJoystickState, centerX: number, centerY: number, touchX: number, touchY: number, config?: VirtualJoystickConfig): void;
|
|
447
430
|
/** Reset joystick state when touch is released. */
|
|
448
|
-
declare function releaseJoystick(state: VirtualJoystickState): void;
|
|
449
|
-
|
|
450
|
-
export { type AxisMap, GamepadAxis, type GamepadAxisId, GamepadButton, type GamepadButtonId, type GamepadButtonState, type GamepadSnapshot, type GamepadSource, type GamepadState, type GestureConfig, GestureDetector, InputManager, type KeyBindings, type KeyboardEventLike, type KeyboardEventTargetLike, type KeyboardState, type PinchEvent, type Pointer, type RemapStore, type RemapTable, type SwipeDirection, type SwipeEvent, type TouchPoint, type VirtualButtonState, type VirtualJoystickConfig, type VirtualJoystickState, applyRemap, attachKeyboardListeners, createButtonState, createGamepadState, createIdentityRemap, createJoystickState, createKeyboard, createPointer, createWebGamepadSource, getAxis, isActionDown, isButtonDown, loadRemap, pointerDown, pointerMove, pointerUp, pressButton, releaseButton, releaseJoystick, resetButtonFrame, resetGamepadFrame, resetPointerFrame, saveRemap, updateGamepadFromSnapshot, updateJoystick, wasActionPressed, wasActionReleased, wasButtonPressed, wasButtonReleased };
|
|
431
|
+
export declare function releaseJoystick(state: VirtualJoystickState): void;
|
|
432
|
+
export type { AxisMap, GamepadAxisId, GamepadButtonId, GamepadButtonState, GamepadSnapshot, GamepadSource, GamepadState, GestureConfig, KeyBindings, KeyboardEventLike, KeyboardEventTargetLike, KeyboardState, PinchEvent, Pointer, RemapStore, RemapTable, SwipeDirection, SwipeEvent, TouchPoint, VirtualButtonState, VirtualJoystickConfig, VirtualJoystickState };
|
|
451
433
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/gamepad.ts","../src/gamepad-source.ts","../src/gestures.ts","../src/keyboard.ts","../src/pointer.ts","../src/remap.ts","../src/input-manager.ts","../src/virtual-button.ts","../src/virtual-joystick.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/gamepad.ts","../src/gamepad-source.ts","../src/gestures.ts","../src/keyboard.ts","../src/pointer.ts","../src/remap.ts","../src/input-manager.ts","../src/virtual-button.ts","../src/virtual-joystick.ts"],"mappings":";;;;;;;;;;qBAsBa;;;;;;;;;;;;;;;;;;;KAmBD,0BAA0B,4BAA4B;;qBAGrD;;;;;;KAMD,wBAAwB,0BAA0B;UAE7C;EACf;EACA;;EAEA;;EAEA;;UAGe;EACf;EACA;EACA;EACA,SAAS;EACT;;EAEA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3
|
-
//#region src/gamepad.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Gamepad — poll-based state for a single connected controller.
|
|
6
5
|
*
|
|
@@ -9,7 +8,7 @@ import { Vec2 } from "@flare-engine/math";
|
|
|
9
8
|
* snapshots into `updateGamepadFromSnapshot`.
|
|
10
9
|
*/
|
|
11
10
|
/** W3C Standard Gamepad button indices. */
|
|
12
|
-
declare const GamepadButton: {
|
|
11
|
+
export declare const GamepadButton: {
|
|
13
12
|
readonly A: 0;
|
|
14
13
|
readonly B: 1;
|
|
15
14
|
readonly X: 2;
|
|
@@ -30,7 +29,7 @@ declare const GamepadButton: {
|
|
|
30
29
|
};
|
|
31
30
|
type GamepadButtonId = (typeof GamepadButton)[keyof typeof GamepadButton];
|
|
32
31
|
/** W3C Standard Gamepad axes. */
|
|
33
|
-
declare const GamepadAxis: {
|
|
32
|
+
export declare const GamepadAxis: {
|
|
34
33
|
readonly LeftX: 0;
|
|
35
34
|
readonly LeftY: 1;
|
|
36
35
|
readonly RightX: 2;
|
|
@@ -65,7 +64,7 @@ interface GamepadSnapshot {
|
|
|
65
64
|
axes: number[];
|
|
66
65
|
timestamp: number;
|
|
67
66
|
}
|
|
68
|
-
declare function createGamepadState(index?: number, buttonCount?: number, axisCount?: number): GamepadState;
|
|
67
|
+
export declare function createGamepadState(index?: number, buttonCount?: number, axisCount?: number): GamepadState;
|
|
69
68
|
/**
|
|
70
69
|
* Apply a fresh snapshot to an existing `GamepadState` in place. Derived
|
|
71
70
|
* `justPressed` / `justReleased` flags are recomputed from the
|
|
@@ -73,15 +72,13 @@ declare function createGamepadState(index?: number, buttonCount?: number, axisCo
|
|
|
73
72
|
*
|
|
74
73
|
* `deadZone` in [0, 1). Values at or below are treated as 0.
|
|
75
74
|
*/
|
|
76
|
-
declare function updateGamepadFromSnapshot(state: GamepadState, snapshot: GamepadSnapshot | null, deadZone?: number): void;
|
|
75
|
+
export declare function updateGamepadFromSnapshot(state: GamepadState, snapshot: GamepadSnapshot | null, deadZone?: number): void;
|
|
77
76
|
/** Reset just the per-frame edge flags. Call when advancing a frame without a fresh snapshot. */
|
|
78
|
-
declare function resetGamepadFrame(state: GamepadState): void;
|
|
79
|
-
declare function isButtonDown(state: GamepadState, button: number): boolean;
|
|
80
|
-
declare function wasButtonPressed(state: GamepadState, button: number): boolean;
|
|
81
|
-
declare function wasButtonReleased(state: GamepadState, button: number): boolean;
|
|
82
|
-
declare function getAxis(state: GamepadState, axis: number): number;
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/gamepad-source.d.ts
|
|
77
|
+
export declare function resetGamepadFrame(state: GamepadState): void;
|
|
78
|
+
export declare function isButtonDown(state: GamepadState, button: number): boolean;
|
|
79
|
+
export declare function wasButtonPressed(state: GamepadState, button: number): boolean;
|
|
80
|
+
export declare function wasButtonReleased(state: GamepadState, button: number): boolean;
|
|
81
|
+
export declare function getAxis(state: GamepadState, axis: number): number;
|
|
85
82
|
/**
|
|
86
83
|
* Platform abstraction for sampling connected gamepads.
|
|
87
84
|
*
|
|
@@ -118,9 +115,7 @@ interface WebGamepad {
|
|
|
118
115
|
* Wrap `navigator.getGamepads()` (W3C Gamepad API). If `nav` is not supplied,
|
|
119
116
|
* uses `globalThis.navigator`. Returns an empty array when the API is absent.
|
|
120
117
|
*/
|
|
121
|
-
declare function createWebGamepadSource(nav?: NavigatorLike): GamepadSource;
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region src/gestures.d.ts
|
|
118
|
+
export declare function createWebGamepadSource(nav?: NavigatorLike): GamepadSource;
|
|
124
119
|
/** Swipe direction. */
|
|
125
120
|
type SwipeDirection = 'left' | 'right' | 'up' | 'down';
|
|
126
121
|
/** Gesture detection configuration. */
|
|
@@ -153,7 +148,7 @@ interface PinchEvent {
|
|
|
153
148
|
* GestureDetector recognizes tap, long press, swipe, and pinch gestures
|
|
154
149
|
* from raw pointer events.
|
|
155
150
|
*/
|
|
156
|
-
declare class GestureDetector {
|
|
151
|
+
export declare class GestureDetector {
|
|
157
152
|
readonly onTap: Signal<Vec2>;
|
|
158
153
|
readonly onLongPress: Signal<Vec2>;
|
|
159
154
|
readonly onSwipe: Signal<SwipeEvent>;
|
|
@@ -201,8 +196,6 @@ declare class GestureDetector {
|
|
|
201
196
|
/** Call when pinch ends (fewer than 2 touches). */
|
|
202
197
|
pinchEnd(): void;
|
|
203
198
|
}
|
|
204
|
-
//#endregion
|
|
205
|
-
//#region src/keyboard.d.ts
|
|
206
199
|
/** Minimal keyboard event shape — no DOM type dep. */
|
|
207
200
|
interface KeyboardEventLike {
|
|
208
201
|
readonly code: string;
|
|
@@ -240,7 +233,7 @@ interface KeyboardState {
|
|
|
240
233
|
clear(): void;
|
|
241
234
|
}
|
|
242
235
|
/** Create a fresh keyboard state. */
|
|
243
|
-
declare function createKeyboard(): KeyboardState;
|
|
236
|
+
export declare function createKeyboard(): KeyboardState;
|
|
244
237
|
/**
|
|
245
238
|
* Web turnkey adapter: registers `keydown`, `keyup`, and `blur` listeners on
|
|
246
239
|
* `target`. `blur` calls `kb.clear()` (stuck-key guard). Returns a detach fn.
|
|
@@ -253,7 +246,7 @@ declare function createKeyboard(): KeyboardState;
|
|
|
253
246
|
* move DOM focus. For game-mode input, attach your own listener that calls
|
|
254
247
|
* `preventDefault` for game keys and forwards `kb.keyDown(ev.code)`.
|
|
255
248
|
*/
|
|
256
|
-
declare function attachKeyboardListeners(kb: KeyboardState, target: KeyboardEventTargetLike): () => void;
|
|
249
|
+
export declare function attachKeyboardListeners(kb: KeyboardState, target: KeyboardEventTargetLike): () => void;
|
|
257
250
|
/**
|
|
258
251
|
* Action → code binding map. Keys are action names; values are arrays of
|
|
259
252
|
* `KeyboardEvent.code` strings. Multiple codes OR-reduce (any bound key
|
|
@@ -261,16 +254,14 @@ declare function attachKeyboardListeners(kb: KeyboardState, target: KeyboardEven
|
|
|
261
254
|
*/
|
|
262
255
|
type KeyBindings = Readonly<Record<string, readonly string[]>>;
|
|
263
256
|
/** True if any bound code for `action` is currently held. */
|
|
264
|
-
declare function isActionDown(kb: KeyboardState, bindings: KeyBindings, action: string): boolean;
|
|
257
|
+
export declare function isActionDown(kb: KeyboardState, bindings: KeyBindings, action: string): boolean;
|
|
265
258
|
/** True if any bound code for `action` was pressed this frame. */
|
|
266
|
-
declare function wasActionPressed(kb: KeyboardState, bindings: KeyBindings, action: string): boolean;
|
|
259
|
+
export declare function wasActionPressed(kb: KeyboardState, bindings: KeyBindings, action: string): boolean;
|
|
267
260
|
/**
|
|
268
261
|
* True if any bound code for `action` was released this frame AND no bound
|
|
269
262
|
* code is still held. Release fires only when the last held bound key lifts.
|
|
270
263
|
*/
|
|
271
|
-
declare function wasActionReleased(kb: KeyboardState, bindings: KeyBindings, action: string): boolean;
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region src/pointer.d.ts
|
|
264
|
+
export declare function wasActionReleased(kb: KeyboardState, bindings: KeyBindings, action: string): boolean;
|
|
274
265
|
/** State of a single pointer (primary touch or mouse). */
|
|
275
266
|
interface Pointer {
|
|
276
267
|
/** Current position in screen coordinates. */
|
|
@@ -294,20 +285,18 @@ interface TouchPoint {
|
|
|
294
285
|
isDown: boolean;
|
|
295
286
|
}
|
|
296
287
|
/** Create a default pointer state. */
|
|
297
|
-
declare function createPointer(): Pointer;
|
|
288
|
+
export declare function createPointer(): Pointer;
|
|
298
289
|
/**
|
|
299
290
|
* Update pointer state for a new frame.
|
|
300
291
|
* Call this at the start of each frame to clear per-frame flags.
|
|
301
292
|
*/
|
|
302
|
-
declare function resetPointerFrame(pointer: Pointer): void;
|
|
293
|
+
export declare function resetPointerFrame(pointer: Pointer): void;
|
|
303
294
|
/** Feed a pointer-down event into the pointer state. */
|
|
304
|
-
declare function pointerDown(pointer: Pointer, x: number, y: number): void;
|
|
295
|
+
export declare function pointerDown(pointer: Pointer, x: number, y: number): void;
|
|
305
296
|
/** Feed a pointer-move event into the pointer state. */
|
|
306
|
-
declare function pointerMove(pointer: Pointer, x: number, y: number): void;
|
|
297
|
+
export declare function pointerMove(pointer: Pointer, x: number, y: number): void;
|
|
307
298
|
/** Feed a pointer-up event into the pointer state. */
|
|
308
|
-
declare function pointerUp(pointer: Pointer, x: number, y: number): void;
|
|
309
|
-
//#endregion
|
|
310
|
-
//#region src/remap.d.ts
|
|
299
|
+
export declare function pointerUp(pointer: Pointer, x: number, y: number): void;
|
|
311
300
|
/**
|
|
312
301
|
* Button / axis remap table.
|
|
313
302
|
*
|
|
@@ -326,9 +315,9 @@ interface RemapTable {
|
|
|
326
315
|
buttons: number[];
|
|
327
316
|
axes: AxisMap[];
|
|
328
317
|
}
|
|
329
|
-
declare function createIdentityRemap(buttonCount?: number, axisCount?: number): RemapTable;
|
|
318
|
+
export declare function createIdentityRemap(buttonCount?: number, axisCount?: number): RemapTable;
|
|
330
319
|
/** Apply a remap table to a raw snapshot, returning a new snapshot with logical ordering. */
|
|
331
|
-
declare function applyRemap(snapshot: GamepadSnapshot, table: RemapTable): GamepadSnapshot;
|
|
320
|
+
export declare function applyRemap(snapshot: GamepadSnapshot, table: RemapTable): GamepadSnapshot;
|
|
332
321
|
/**
|
|
333
322
|
* Minimal storage contract — matches `@flare-engine/storage` `StorageAdapter`,
|
|
334
323
|
* but declared locally so this package does not take a hard dep on storage.
|
|
@@ -338,18 +327,16 @@ interface RemapStore {
|
|
|
338
327
|
set(key: string, value: string): Promise<void>;
|
|
339
328
|
}
|
|
340
329
|
/** Persist a remap table under the given key. Throws on invalid table shape. */
|
|
341
|
-
declare function saveRemap(store: RemapStore, key: string, table: RemapTable): Promise<void>;
|
|
330
|
+
export declare function saveRemap(store: RemapStore, key: string, table: RemapTable): Promise<void>;
|
|
342
331
|
/** Load a remap table. Returns `null` if absent or malformed. */
|
|
343
|
-
declare function loadRemap(store: RemapStore, key: string): Promise<RemapTable | null>;
|
|
344
|
-
//#endregion
|
|
345
|
-
//#region src/input-manager.d.ts
|
|
332
|
+
export declare function loadRemap(store: RemapStore, key: string): Promise<RemapTable | null>;
|
|
346
333
|
/**
|
|
347
334
|
* InputManager provides a polling-based input model.
|
|
348
335
|
*
|
|
349
336
|
* Call `update()` once per frame (before game logic) to snapshot input state.
|
|
350
337
|
* Feed events from the platform (RN touch/gesture handlers) via the on* methods.
|
|
351
338
|
*/
|
|
352
|
-
declare class InputManager {
|
|
339
|
+
export declare class InputManager {
|
|
353
340
|
/**
|
|
354
341
|
* Primary pointer — the touch that started the current gesture (first
|
|
355
342
|
* `onPointerDown` while no touch was active), or the mouse.
|
|
@@ -392,8 +379,6 @@ declare class InputManager {
|
|
|
392
379
|
private _addOrUpdateTouch;
|
|
393
380
|
private _removeTouch;
|
|
394
381
|
}
|
|
395
|
-
//#endregion
|
|
396
|
-
//#region src/virtual-button.d.ts
|
|
397
382
|
/** Virtual button state — pure data, no UI. */
|
|
398
383
|
interface VirtualButtonState {
|
|
399
384
|
/** Whether the button is currently pressed. */
|
|
@@ -404,15 +389,13 @@ interface VirtualButtonState {
|
|
|
404
389
|
justReleased: boolean;
|
|
405
390
|
}
|
|
406
391
|
/** Create a default button state. */
|
|
407
|
-
declare function createButtonState(): VirtualButtonState;
|
|
392
|
+
export declare function createButtonState(): VirtualButtonState;
|
|
408
393
|
/** Call at the start of each frame to reset per-frame flags. */
|
|
409
|
-
declare function resetButtonFrame(state: VirtualButtonState): void;
|
|
394
|
+
export declare function resetButtonFrame(state: VirtualButtonState): void;
|
|
410
395
|
/** Call when the button is pressed. */
|
|
411
|
-
declare function pressButton(state: VirtualButtonState): void;
|
|
396
|
+
export declare function pressButton(state: VirtualButtonState): void;
|
|
412
397
|
/** Call when the button is released. */
|
|
413
|
-
declare function releaseButton(state: VirtualButtonState): void;
|
|
414
|
-
//#endregion
|
|
415
|
-
//#region src/virtual-joystick.d.ts
|
|
398
|
+
export declare function releaseButton(state: VirtualButtonState): void;
|
|
416
399
|
/** Virtual joystick configuration. */
|
|
417
400
|
interface VirtualJoystickConfig {
|
|
418
401
|
/** Dead zone radius in pixels (default 10). */
|
|
@@ -432,7 +415,7 @@ interface VirtualJoystickState {
|
|
|
432
415
|
offset: Vec2;
|
|
433
416
|
}
|
|
434
417
|
/** Create a default joystick state. */
|
|
435
|
-
declare function createJoystickState(): VirtualJoystickState;
|
|
418
|
+
export declare function createJoystickState(): VirtualJoystickState;
|
|
436
419
|
/**
|
|
437
420
|
* Update joystick state from a touch event.
|
|
438
421
|
*
|
|
@@ -443,9 +426,8 @@ declare function createJoystickState(): VirtualJoystickState;
|
|
|
443
426
|
* @param touchY The current touch Y in screen pixels.
|
|
444
427
|
* @param config Joystick configuration.
|
|
445
428
|
*/
|
|
446
|
-
declare function updateJoystick(state: VirtualJoystickState, centerX: number, centerY: number, touchX: number, touchY: number, config?: VirtualJoystickConfig): void;
|
|
429
|
+
export declare function updateJoystick(state: VirtualJoystickState, centerX: number, centerY: number, touchX: number, touchY: number, config?: VirtualJoystickConfig): void;
|
|
447
430
|
/** Reset joystick state when touch is released. */
|
|
448
|
-
declare function releaseJoystick(state: VirtualJoystickState): void;
|
|
449
|
-
|
|
450
|
-
export { type AxisMap, GamepadAxis, type GamepadAxisId, GamepadButton, type GamepadButtonId, type GamepadButtonState, type GamepadSnapshot, type GamepadSource, type GamepadState, type GestureConfig, GestureDetector, InputManager, type KeyBindings, type KeyboardEventLike, type KeyboardEventTargetLike, type KeyboardState, type PinchEvent, type Pointer, type RemapStore, type RemapTable, type SwipeDirection, type SwipeEvent, type TouchPoint, type VirtualButtonState, type VirtualJoystickConfig, type VirtualJoystickState, applyRemap, attachKeyboardListeners, createButtonState, createGamepadState, createIdentityRemap, createJoystickState, createKeyboard, createPointer, createWebGamepadSource, getAxis, isActionDown, isButtonDown, loadRemap, pointerDown, pointerMove, pointerUp, pressButton, releaseButton, releaseJoystick, resetButtonFrame, resetGamepadFrame, resetPointerFrame, saveRemap, updateGamepadFromSnapshot, updateJoystick, wasActionPressed, wasActionReleased, wasButtonPressed, wasButtonReleased };
|
|
431
|
+
export declare function releaseJoystick(state: VirtualJoystickState): void;
|
|
432
|
+
export type { AxisMap, GamepadAxisId, GamepadButtonId, GamepadButtonState, GamepadSnapshot, GamepadSource, GamepadState, GestureConfig, KeyBindings, KeyboardEventLike, KeyboardEventTargetLike, KeyboardState, PinchEvent, Pointer, RemapStore, RemapTable, SwipeDirection, SwipeEvent, TouchPoint, VirtualButtonState, VirtualJoystickConfig, VirtualJoystickState };
|
|
451
433
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/gamepad.ts","../src/gamepad-source.ts","../src/gestures.ts","../src/keyboard.ts","../src/pointer.ts","../src/remap.ts","../src/input-manager.ts","../src/virtual-button.ts","../src/virtual-joystick.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/gamepad.ts","../src/gamepad-source.ts","../src/gestures.ts","../src/keyboard.ts","../src/pointer.ts","../src/remap.ts","../src/input-manager.ts","../src/virtual-button.ts","../src/virtual-joystick.ts"],"mappings":";;;;;;;;;;qBAsBa;;;;;;;;;;;;;;;;;;;KAmBD,0BAA0B,4BAA4B;;qBAGrD;;;;;;KAMD,wBAAwB,0BAA0B;UAE7C;EACf;EACA;;EAEA;;EAEA;;UAGe;EACf;EACA;EACA;EACA,SAAS;EACT;;EAEA;;;UAIe;EACf;EACA;EACA;IAAW;IAAkB;;EAC7B;EACA;;wBAGc,mBAAmB,gBAAW,sBAAkB,qBAAgB;;;;;;;;wBAwChE,0BACd,OAAO,cACP,UAAU,wBACV;;wBAyDc,kBAAkB,OAAO;wBAoBzB,aAAa,OAAO,cAAc;wBAIlC,iBAAiB,OAAO,cAAc;wBAItC,kBAAkB,OAAO,cAAc;wBAIvC,QAAQ,OAAO,cAAc;;;;;;;;;;;;;;;;UCnM5B;EACf,SAAS;;UAGD;EACR,qBAAqB;;UAGb;EACR;EACA;EACA;EACA;EACA;IAAoB;IAAkB;;EACtC;;;;;;wBAOc,uBAAuB,MAAM,gBAAgB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I,aAAa,gBAAgB;;;wBAIb,UAAU,OAAO,YAAY,aAAa,OAAO,aAAa;;wBAK9D,UAAU,OAAO,YAAY,cAAc,QAAQ;;;;;;;qBCpC5D;;;;;;;;;;;;;;WAcF,SAAS;;WAGT,UAAU;;WAGV,SAAS;UAEV;UACA;UACA;UACA;UACA;;EAGR;;EAUA,cAAc,YAAY,WAAW;;EAWrC,cAAc,YAAY,WAAW;;EAQrC,YAAY,YAAY,WAAW;;EASnC,QAAQ,gBAAgB;;EAUxB,mBAAmB;;EAKnB,gBAAgB,eAAe,OAAO;;EAMtC,aAAa,QAAQ;UAeb;UAaA;;;UC7IO;;EAEf;;EAEA;;EAEA;;;wBAIc,qBAAqB;;wBASrB,iBAAiB,OAAO;;wBAMxB,YAAY,OAAO;;wBAQnB,cAAc,OAAO;;UCnBpB;;EAEf;;EAEA;;;UAIe;;EAEf;;EAEA,WAAW;;EAEX;;EAEA,QAAQ;;;wBAOM,uBAAuB;;;;;;;;;;;wBAmBvB,eACd,OAAO,sBACP,iBACA,iBACA,gBACA,gBACA,SAAS;;wBA8DK,gBAAgB,OAAO"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let _flare_engine_events = require("@flare-engine/events");
|
|
3
|
-
|
|
3
|
+
// src/gamepad.ts
|
|
4
4
|
/**
|
|
5
5
|
* Gamepad — poll-based state for a single connected controller.
|
|
6
6
|
*
|
|
@@ -157,8 +157,7 @@ function wasButtonReleased(state, button) {
|
|
|
157
157
|
function getAxis(state, axis) {
|
|
158
158
|
return state.axes[axis] ?? 0;
|
|
159
159
|
}
|
|
160
|
-
|
|
161
|
-
//#region src/gamepad-source.ts
|
|
160
|
+
// src/gamepad-source.ts
|
|
162
161
|
/**
|
|
163
162
|
* Wrap `navigator.getGamepads()` (W3C Gamepad API). If `nav` is not supplied,
|
|
164
163
|
* uses `globalThis.navigator`. Returns an empty array when the API is absent.
|
|
@@ -199,8 +198,7 @@ function webGamepadToSnapshot(p) {
|
|
|
199
198
|
axes
|
|
200
199
|
};
|
|
201
200
|
}
|
|
202
|
-
|
|
203
|
-
//#region src/gestures.ts
|
|
201
|
+
// src/gestures.ts
|
|
204
202
|
const DEFAULT_TAP_MAX_DURATION = .3;
|
|
205
203
|
const DEFAULT_TAP_MAX_DISTANCE = 20;
|
|
206
204
|
const DEFAULT_LONG_PRESS_MIN_DURATION = .5;
|
|
@@ -341,8 +339,7 @@ var GestureDetector = class {
|
|
|
341
339
|
this._pinchStartDistance = 0;
|
|
342
340
|
}
|
|
343
341
|
};
|
|
344
|
-
|
|
345
|
-
//#region src/virtual-button.ts
|
|
342
|
+
// src/virtual-button.ts
|
|
346
343
|
/** Create a default button state. */
|
|
347
344
|
function createButtonState() {
|
|
348
345
|
return {
|
|
@@ -370,8 +367,7 @@ function releaseButton(state) {
|
|
|
370
367
|
state.justReleased = true;
|
|
371
368
|
}
|
|
372
369
|
}
|
|
373
|
-
|
|
374
|
-
//#region src/keyboard.ts
|
|
370
|
+
// src/keyboard.ts
|
|
375
371
|
/** Create a fresh keyboard state. */
|
|
376
372
|
function createKeyboard() {
|
|
377
373
|
const states = [];
|
|
@@ -473,8 +469,7 @@ function wasActionReleased(kb, bindings, action) {
|
|
|
473
469
|
}
|
|
474
470
|
return anyReleased;
|
|
475
471
|
}
|
|
476
|
-
|
|
477
|
-
//#region src/pointer.ts
|
|
472
|
+
// src/pointer.ts
|
|
478
473
|
/** Create a default pointer state. */
|
|
479
474
|
function createPointer() {
|
|
480
475
|
return {
|
|
@@ -527,8 +522,7 @@ function pointerUp(pointer, x, y) {
|
|
|
527
522
|
pointer.position.x = x;
|
|
528
523
|
pointer.position.y = y;
|
|
529
524
|
}
|
|
530
|
-
|
|
531
|
-
//#region src/remap.ts
|
|
525
|
+
// src/remap.ts
|
|
532
526
|
function createIdentityRemap(buttonCount = 17, axisCount = 4) {
|
|
533
527
|
const buttons = new Array(buttonCount);
|
|
534
528
|
for (let i = 0; i < buttonCount; i++) buttons[i] = i;
|
|
@@ -561,7 +555,8 @@ function applyRemap(snapshot, table) {
|
|
|
561
555
|
invert: false,
|
|
562
556
|
scale: 1
|
|
563
557
|
};
|
|
564
|
-
|
|
558
|
+
const raw = snapshot.axes[map.index] ?? 0;
|
|
559
|
+
axes[logical] = raw * map.scale * (map.invert ? -1 : 1);
|
|
565
560
|
}
|
|
566
561
|
return {
|
|
567
562
|
id: snapshot.id,
|
|
@@ -599,8 +594,7 @@ function isRemapTable(value) {
|
|
|
599
594
|
}
|
|
600
595
|
return true;
|
|
601
596
|
}
|
|
602
|
-
|
|
603
|
-
//#region src/input-manager.ts
|
|
597
|
+
// src/input-manager.ts
|
|
604
598
|
/**
|
|
605
599
|
* InputManager provides a polling-based input model.
|
|
606
600
|
*
|
|
@@ -713,8 +707,7 @@ var InputManager = class {
|
|
|
713
707
|
if (idx !== -1) this.touches.splice(idx, 1);
|
|
714
708
|
}
|
|
715
709
|
};
|
|
716
|
-
|
|
717
|
-
//#region src/virtual-joystick.ts
|
|
710
|
+
// src/virtual-joystick.ts
|
|
718
711
|
/**
|
|
719
712
|
* Dev-flag access for the config guard in `updateJoystick`, which runs once per
|
|
720
713
|
* frame while a stick is held. Read as a `globalThis` property, not as a bare
|
|
@@ -795,7 +788,6 @@ function releaseJoystick(state) {
|
|
|
795
788
|
state.offset.x = 0;
|
|
796
789
|
state.offset.y = 0;
|
|
797
790
|
}
|
|
798
|
-
//#endregion
|
|
799
791
|
exports.GamepadAxis = GamepadAxis;
|
|
800
792
|
exports.GamepadButton = GamepadButton;
|
|
801
793
|
exports.GestureDetector = GestureDetector;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["G","Signal"],"sources":["../src/gamepad.ts","../src/gamepad-source.ts","../src/gestures.ts","../src/virtual-button.ts","../src/keyboard.ts","../src/pointer.ts","../src/remap.ts","../src/input-manager.ts","../src/virtual-joystick.ts"],"sourcesContent":["/**\n * Gamepad — poll-based state for a single connected controller.\n *\n * Buttons and axes are indexed against the W3C \"Standard Gamepad\" mapping by\n * default. Callers can translate raw indices via `remap.ts` before feeding\n * snapshots into `updateGamepadFromSnapshot`.\n */\n\n/**\n * Dev-flag access for the dead-zone guard, which runs per axis per frame. Read\n * as a `globalThis` property rather than a bare `__DEV__` identifier for the\n * reason measured in PERF-10 (~0.46 ns vs ~270 ns on JSC).\n */\nconst G = globalThis as { __DEV__?: boolean };\n\n/** Warn at most once per process; a bad dead zone repeats every frame. */\nlet _warnedDeadZone = false;\n\n/** Largest dead zone that still leaves the rescale well-defined. */\nconst MAX_DEAD_ZONE = 0.99;\n\n/** W3C Standard Gamepad button indices. */\nexport const GamepadButton = {\n A: 0,\n B: 1,\n X: 2,\n Y: 3,\n LB: 4,\n RB: 5,\n LT: 6,\n RT: 7,\n Back: 8,\n Start: 9,\n LS: 10,\n RS: 11,\n DpadUp: 12,\n DpadDown: 13,\n DpadLeft: 14,\n DpadRight: 15,\n Home: 16,\n} as const;\nexport type GamepadButtonId = (typeof GamepadButton)[keyof typeof GamepadButton];\n\n/** W3C Standard Gamepad axes. */\nexport const GamepadAxis = {\n LeftX: 0,\n LeftY: 1,\n RightX: 2,\n RightY: 3,\n} as const;\nexport type GamepadAxisId = (typeof GamepadAxis)[keyof typeof GamepadAxis];\n\nexport interface GamepadButtonState {\n pressed: boolean;\n value: number;\n /** True for exactly one frame after a press. */\n justPressed: boolean;\n /** True for exactly one frame after a release. */\n justReleased: boolean;\n}\n\nexport interface GamepadState {\n connected: boolean;\n id: string;\n index: number;\n buttons: GamepadButtonState[];\n axes: number[];\n /** Monotonically increasing timestamp from the source (ms). */\n timestamp: number;\n}\n\n/** Raw snapshot from a `GamepadSource` — values only, no derived state. */\nexport interface GamepadSnapshot {\n id: string;\n index: number;\n buttons: { pressed: boolean; value: number }[];\n axes: number[];\n timestamp: number;\n}\n\nexport function createGamepadState(index = 0, buttonCount = 17, axisCount = 4): GamepadState {\n const buttons: GamepadButtonState[] = new Array(buttonCount);\n for (let i = 0; i < buttonCount; i++) {\n buttons[i] = { pressed: false, value: 0, justPressed: false, justReleased: false };\n }\n const axes = new Array<number>(axisCount).fill(0);\n return { connected: false, id: '', index, buttons, axes, timestamp: 0 };\n}\n\nfunction applyDeadZone(value: number, deadZone: number): number {\n // The documented contract is [0, 1). At exactly 1 the rescale below divides by\n // zero and returns ±Infinity for any out-of-range axis, which then propagates\n // into every consumer reading the stick. Correct rather than propagate.\n let dz = deadZone;\n if (!(dz >= 0 && dz < 1)) {\n if (G.__DEV__ && !_warnedDeadZone) {\n _warnedDeadZone = true;\n console.warn(\n `[flare-engine/input] deadZone=${deadZone} is outside [0, 1); clamping. ` +\n 'Values at or above 1 would suppress the axis entirely.',\n );\n }\n dz = dz >= 1 ? MAX_DEAD_ZONE : 0;\n }\n const abs = Math.abs(value);\n // `!(abs > dz)` rather than `abs <= dz` so a non-finite axis returns 0 instead\n // of falling through to produce NaN.\n if (!(abs > dz)) return 0;\n const sign = value < 0 ? -1 : 1;\n // Rescale [deadZone, 1] -> [0, 1] so inputs remain smooth past the dead zone.\n return sign * ((abs - dz) / (1 - dz));\n}\n\n/**\n * Apply a fresh snapshot to an existing `GamepadState` in place. Derived\n * `justPressed` / `justReleased` flags are recomputed from the\n * previous `pressed` value.\n *\n * `deadZone` in [0, 1). Values at or below are treated as 0.\n */\nexport function updateGamepadFromSnapshot(\n state: GamepadState,\n snapshot: GamepadSnapshot | null,\n deadZone = 0,\n): void {\n if (snapshot === null) {\n if (!state.connected && !anyButtonDown(state)) {\n clearFrameFlags(state);\n return;\n }\n // Disconnect: clear edge flags, keep sticky pressed=false for released-edge.\n for (let i = 0; i < state.buttons.length; i++) {\n const b = state.buttons[i];\n if (!b) continue;\n b.justPressed = false;\n b.justReleased = b.pressed;\n b.pressed = false;\n b.value = 0;\n }\n for (let i = 0; i < state.axes.length; i++) state.axes[i] = 0;\n state.connected = false;\n state.id = '';\n return;\n }\n\n state.connected = true;\n state.id = snapshot.id;\n state.index = snapshot.index;\n state.timestamp = snapshot.timestamp;\n\n const srcButtons = snapshot.buttons;\n const bLen = Math.min(state.buttons.length, srcButtons.length);\n for (let i = 0; i < bLen; i++) {\n const prev = state.buttons[i];\n const src = srcButtons[i];\n if (!prev || !src) continue;\n const wasDown = prev.pressed;\n prev.pressed = src.pressed;\n prev.value = src.value;\n prev.justPressed = src.pressed && !wasDown;\n prev.justReleased = !src.pressed && wasDown;\n }\n // Buttons beyond the snapshot length: clear edges, keep prior pressed false.\n for (let i = bLen; i < state.buttons.length; i++) {\n const b = state.buttons[i];\n if (!b) continue;\n b.justPressed = false;\n b.justReleased = b.pressed;\n b.pressed = false;\n b.value = 0;\n }\n\n const aLen = Math.min(state.axes.length, snapshot.axes.length);\n for (let i = 0; i < aLen; i++) {\n state.axes[i] = applyDeadZone(snapshot.axes[i] ?? 0, deadZone);\n }\n for (let i = aLen; i < state.axes.length; i++) state.axes[i] = 0;\n}\n\n/** Reset just the per-frame edge flags. Call when advancing a frame without a fresh snapshot. */\nexport function resetGamepadFrame(state: GamepadState): void {\n clearFrameFlags(state);\n}\n\nfunction clearFrameFlags(state: GamepadState): void {\n for (let i = 0; i < state.buttons.length; i++) {\n const b = state.buttons[i];\n if (!b) continue;\n b.justPressed = false;\n b.justReleased = false;\n }\n}\n\nfunction anyButtonDown(state: GamepadState): boolean {\n for (let i = 0; i < state.buttons.length; i++) {\n if (state.buttons[i]?.pressed) return true;\n }\n return false;\n}\n\nexport function isButtonDown(state: GamepadState, button: number): boolean {\n return state.buttons[button]?.pressed ?? false;\n}\n\nexport function wasButtonPressed(state: GamepadState, button: number): boolean {\n return state.buttons[button]?.justPressed ?? false;\n}\n\nexport function wasButtonReleased(state: GamepadState, button: number): boolean {\n return state.buttons[button]?.justReleased ?? false;\n}\n\nexport function getAxis(state: GamepadState, axis: number): number {\n return state.axes[axis] ?? 0;\n}\n","import type { GamepadSnapshot } from './gamepad.js';\n\n/**\n * Platform abstraction for sampling connected gamepads.\n *\n * `poll()` returns one snapshot per slot (typically up to 4). Unconnected\n * slots return `null`. Implementations:\n *\n * - `createWebGamepadSource()` wraps the W3C `navigator.getGamepads` API.\n * - Native implementations (e.g., `react-native-gamepad`) inject their own\n * via the `GamepadSource` interface — the package itself ships no native deps.\n *\n * **Freshness contract:** each call returns fresh objects. An implementation\n * must not reuse or mutate a snapshot (or its `buttons`/`axes` arrays) that a\n * previous `poll()` call returned. A caller may therefore retain a returned\n * snapshot across frames without it changing out from under them.\n */\nexport interface GamepadSource {\n poll(): (GamepadSnapshot | null)[];\n}\n\ninterface NavigatorLike {\n getGamepads?: () => (WebGamepad | null)[];\n}\n\ninterface WebGamepad {\n id: string;\n index: number;\n connected: boolean;\n timestamp: number;\n buttons: readonly { pressed: boolean; value: number }[];\n axes: readonly number[];\n}\n\n/**\n * Wrap `navigator.getGamepads()` (W3C Gamepad API). If `nav` is not supplied,\n * uses `globalThis.navigator`. Returns an empty array when the API is absent.\n */\nexport function createWebGamepadSource(nav?: NavigatorLike): GamepadSource {\n const source: NavigatorLike | undefined =\n nav ??\n (typeof globalThis === 'undefined'\n ? undefined\n : (globalThis as { navigator?: NavigatorLike }).navigator);\n\n return {\n poll(): (GamepadSnapshot | null)[] {\n if (!source?.getGamepads) return [];\n const pads = source.getGamepads();\n const out: (GamepadSnapshot | null)[] = new Array(pads.length);\n for (let i = 0; i < pads.length; i++) {\n const p = pads[i];\n if (!p?.connected) {\n out[i] = null;\n continue;\n }\n out[i] = webGamepadToSnapshot(p);\n }\n return out;\n },\n };\n}\n\nfunction webGamepadToSnapshot(p: WebGamepad): GamepadSnapshot {\n const buttons = new Array<{ pressed: boolean; value: number }>(p.buttons.length);\n for (let i = 0; i < p.buttons.length; i++) {\n const b = p.buttons[i];\n buttons[i] = { pressed: b?.pressed ?? false, value: b?.value ?? 0 };\n }\n const axes = new Array<number>(p.axes.length);\n for (let i = 0; i < p.axes.length; i++) axes[i] = p.axes[i] ?? 0;\n return { id: p.id, index: p.index, timestamp: p.timestamp, buttons, axes };\n}\n","import { Signal } from '@flare-engine/events';\nimport type { Vec2 } from '@flare-engine/math';\n\n/** Swipe direction. */\nexport type SwipeDirection = 'left' | 'right' | 'up' | 'down';\n\n/** Gesture detection configuration. */\nexport interface GestureConfig {\n /** Max time (seconds) for a tap (default 0.3). */\n tapMaxDuration?: number;\n /** Max distance (px) for a tap (default 20). */\n tapMaxDistance?: number;\n /** Min time (seconds) for a long press (default 0.5). */\n longPressMinDuration?: number;\n /** Min distance (px) for a swipe (default 50). */\n swipeMinDistance?: number;\n /** Max time (seconds) for a swipe (default 0.4). */\n swipeMaxDuration?: number;\n}\n\n/** Swipe event data. */\nexport interface SwipeEvent {\n direction: SwipeDirection;\n distance: number;\n duration: number;\n}\n\n/** Pinch event data. */\nexport interface PinchEvent {\n /** Scale factor (>1 = spread, <1 = pinch). */\n scale: number;\n /** Center point between the two touches. */\n center: Vec2;\n}\n\nconst DEFAULT_TAP_MAX_DURATION = 0.3;\nconst DEFAULT_TAP_MAX_DISTANCE = 20;\nconst DEFAULT_LONG_PRESS_MIN_DURATION = 0.5;\nconst DEFAULT_SWIPE_MIN_DISTANCE = 50;\nconst DEFAULT_SWIPE_MAX_DURATION = 0.4;\n\n/**\n * GestureDetector recognizes tap, long press, swipe, and pinch gestures\n * from raw pointer events.\n */\nexport class GestureDetector {\n readonly onTap = new Signal<Vec2>();\n readonly onLongPress = new Signal<Vec2>();\n readonly onSwipe = new Signal<SwipeEvent>();\n readonly onPinch = new Signal<PinchEvent>();\n\n private tapMaxDuration: number;\n private tapMaxDistance: number;\n private longPressMinDuration: number;\n private swipeMinDistance: number;\n private swipeMaxDuration: number;\n\n // Single-touch tracking\n private _startPos: Vec2 = { x: 0, y: 0 };\n /** Elapsed time (seconds) since `pointerDown` for the in-progress press. */\n private _elapsed = 0;\n private _isTracking = false;\n private _longPressFired = false;\n\n // Pinch tracking\n private _pinchStartDistance = 0;\n private _pinchTouches: [Vec2, Vec2] | null = null;\n\n constructor(config?: GestureConfig) {\n this.tapMaxDuration = config?.tapMaxDuration ?? DEFAULT_TAP_MAX_DURATION;\n this.tapMaxDistance = config?.tapMaxDistance ?? DEFAULT_TAP_MAX_DISTANCE;\n this.longPressMinDuration = config?.longPressMinDuration ?? DEFAULT_LONG_PRESS_MIN_DURATION;\n this.swipeMinDistance = config?.swipeMinDistance ?? DEFAULT_SWIPE_MIN_DISTANCE;\n this.swipeMaxDuration = config?.swipeMaxDuration ?? DEFAULT_SWIPE_MAX_DURATION;\n }\n\n /** Feed a pointer-down event. */\n pointerDown(x: number, y: number): void {\n this._startPos = { x, y };\n this._elapsed = 0;\n this._isTracking = true;\n this._longPressFired = false;\n }\n\n /**\n * Feed a pointer-up event.\n *\n * `elapsedSinceDown` is optional: pass it when the host tracks its own\n * timestamps (e.g. event-driven, no per-frame `update()` calls); omit it\n * to use the elapsed time already accumulated via `update(dt, ...)`. Either\n * way there is one clock per press — passing it here re-syncs the same\n * accumulator `update()` advances, rather than racing it. If a long press\n * already fired for this press, tap/swipe are suppressed so one press\n * yields exactly one gesture.\n */\n pointerUp(x: number, y: number, elapsedSinceDown?: number): void {\n if (!this._isTracking) return;\n this._isTracking = false;\n if (elapsedSinceDown !== undefined) this._elapsed = elapsedSinceDown;\n if (this._longPressFired) return;\n\n const dx = x - this._startPos.x;\n const dy = y - this._startPos.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n const duration = this._elapsed;\n\n // Check swipe first (requires min distance)\n if (dist >= this.swipeMinDistance && duration <= this.swipeMaxDuration) {\n const absDx = Math.abs(dx);\n const absDy = Math.abs(dy);\n let direction: SwipeDirection;\n if (absDx > absDy) {\n direction = dx > 0 ? 'right' : 'left';\n } else {\n direction = dy > 0 ? 'down' : 'up';\n }\n this.onSwipe.emit({ direction, distance: dist, duration });\n return;\n }\n\n // Check tap (short press, small movement)\n if (dist <= this.tapMaxDistance && duration <= this.tapMaxDuration) {\n this.onTap.emit({ x, y });\n return;\n }\n }\n\n /**\n * Update gesture tracking. Call each frame with dt.\n * @param dt Delta time in seconds.\n * @param currentX Current pointer X.\n * @param currentY Current pointer Y.\n */\n update(dt: number, currentX: number, currentY: number): void {\n if (!this._isTracking) return;\n this._elapsed += dt;\n\n // Long press detection\n if (!this._longPressFired && this._elapsed >= this.longPressMinDuration) {\n const dx = currentX - this._startPos.x;\n const dy = currentY - this._startPos.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n if (dist <= this.tapMaxDistance) {\n this._longPressFired = true;\n this.onLongPress.emit({ x: currentX, y: currentY });\n }\n }\n }\n\n /**\n * Feed a two-finger pinch update. Call when two touches are active.\n * @param t1 First touch position.\n * @param t2 Second touch position.\n */\n pinchUpdate(t1: Vec2, t2: Vec2): void {\n const dx = t2.x - t1.x;\n const dy = t2.y - t1.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n\n if (this._pinchTouches === null) {\n // Start pinch\n this._pinchStartDistance = dist;\n this._pinchTouches = [{ ...t1 }, { ...t2 }];\n return;\n }\n\n if (this._pinchStartDistance > 0) {\n const scale = dist / this._pinchStartDistance;\n const center: Vec2 = {\n x: (t1.x + t2.x) / 2,\n y: (t1.y + t2.y) / 2,\n };\n this.onPinch.emit({ scale, center });\n }\n }\n\n /** Call when pinch ends (fewer than 2 touches). */\n pinchEnd(): void {\n this._pinchTouches = null;\n this._pinchStartDistance = 0;\n }\n}\n","/** Virtual button state — pure data, no UI. */\nexport interface VirtualButtonState {\n /** Whether the button is currently pressed. */\n isPressed: boolean;\n /** Whether the button was just pressed this frame. */\n justPressed: boolean;\n /** Whether the button was just released this frame. */\n justReleased: boolean;\n}\n\n/** Create a default button state. */\nexport function createButtonState(): VirtualButtonState {\n return {\n isPressed: false,\n justPressed: false,\n justReleased: false,\n };\n}\n\n/** Call at the start of each frame to reset per-frame flags. */\nexport function resetButtonFrame(state: VirtualButtonState): void {\n state.justPressed = false;\n state.justReleased = false;\n}\n\n/** Call when the button is pressed. */\nexport function pressButton(state: VirtualButtonState): void {\n if (!state.isPressed) {\n state.isPressed = true;\n state.justPressed = true;\n }\n}\n\n/** Call when the button is released. */\nexport function releaseButton(state: VirtualButtonState): void {\n if (state.isPressed) {\n state.isPressed = false;\n state.justReleased = true;\n }\n}\n","import {\n createButtonState,\n pressButton,\n releaseButton,\n resetButtonFrame,\n type VirtualButtonState,\n} from './virtual-button.js';\n\n/** Minimal keyboard event shape — no DOM type dep. */\nexport interface KeyboardEventLike {\n readonly code: string;\n readonly type: string;\n /** Optional — real DOM events have it; synthetic feeds may not. */\n preventDefault?(): void;\n}\n\n/** Minimal event target shape for attaching keyboard listeners. */\nexport interface KeyboardEventTargetLike {\n addEventListener(type: string, handler: (ev: KeyboardEventLike) => void): void;\n removeEventListener(type: string, handler: (ev: KeyboardEventLike) => void): void;\n}\n\n/**\n * Buffered per-frame keyboard state.\n *\n * Edge flags (`wasPressed`, `wasReleased`) clear each frame via `reset()`.\n * `keyDown` / `keyUp` are the platform-neutral injection points: web feeds\n * them via `attachKeyboardListeners`; mobile/RN feeds them from a\n * hardware-keyboard native module or an on-screen source.\n */\nexport interface KeyboardState {\n /** True while the key is physically held. */\n isDown(code: string): boolean;\n /** True only on the frame the key was pressed. */\n wasPressed(code: string): boolean;\n /** True only on the frame the key was released. */\n wasReleased(code: string): boolean;\n /** Platform-neutral injection. OS auto-repeat is de-edged by the pressButton guard. */\n keyDown(code: string): void;\n /** Platform-neutral injection. */\n keyUp(code: string): void;\n /** Frame-start edge clear. Zero-alloc. */\n reset(): void;\n /** Blur/stuck-key guard: emits a release edge for every held code, then drops held. */\n clear(): void;\n}\n\n/** Create a fresh keyboard state. */\nexport function createKeyboard(): KeyboardState {\n const states: VirtualButtonState[] = [];\n const codeIndex = new Map<string, number>();\n\n return {\n isDown(code: string): boolean {\n const i = codeIndex.get(code);\n if (i === undefined) return false;\n return states[i]?.isPressed ?? false;\n },\n\n wasPressed(code: string): boolean {\n const i = codeIndex.get(code);\n if (i === undefined) return false;\n return states[i]?.justPressed ?? false;\n },\n\n wasReleased(code: string): boolean {\n const i = codeIndex.get(code);\n if (i === undefined) return false;\n return states[i]?.justReleased ?? false;\n },\n\n keyDown(code: string): void {\n let i = codeIndex.get(code);\n if (i === undefined) {\n i = states.length;\n states.push(createButtonState());\n codeIndex.set(code, i);\n }\n pressButton(states[i]!);\n },\n\n keyUp(code: string): void {\n const i = codeIndex.get(code);\n if (i === undefined) return;\n releaseButton(states[i]!);\n },\n\n reset(): void {\n for (let i = 0; i < states.length; i++) {\n resetButtonFrame(states[i]!);\n }\n },\n\n clear(): void {\n for (let i = 0; i < states.length; i++) {\n releaseButton(states[i]!);\n }\n },\n };\n}\n\n/**\n * Web turnkey adapter: registers `keydown`, `keyup`, and `blur` listeners on\n * `target`. `blur` calls `kb.clear()` (stuck-key guard). Returns a detach fn.\n *\n * `target` is structural `{ addEventListener, removeEventListener }` — no DOM\n * types dep. On web, pass `window`; for mobile/RN, feed `keyDown`/`keyUp`\n * directly from a hardware-keyboard native module or an on-screen source.\n *\n * Does NOT call `preventDefault` — bare use lets Space/arrows scroll and Tab\n * move DOM focus. For game-mode input, attach your own listener that calls\n * `preventDefault` for game keys and forwards `kb.keyDown(ev.code)`.\n */\nexport function attachKeyboardListeners(\n kb: KeyboardState,\n target: KeyboardEventTargetLike,\n): () => void {\n const onKeyDown = (ev: KeyboardEventLike): void => {\n kb.keyDown(ev.code);\n };\n const onKeyUp = (ev: KeyboardEventLike): void => {\n kb.keyUp(ev.code);\n };\n const onBlur = (_ev: KeyboardEventLike): void => {\n kb.clear();\n };\n\n target.addEventListener('keydown', onKeyDown);\n target.addEventListener('keyup', onKeyUp);\n target.addEventListener('blur', onBlur);\n\n return (): void => {\n target.removeEventListener('keydown', onKeyDown);\n target.removeEventListener('keyup', onKeyUp);\n target.removeEventListener('blur', onBlur);\n };\n}\n\n/**\n * Action → code binding map. Keys are action names; values are arrays of\n * `KeyboardEvent.code` strings. Multiple codes OR-reduce (any bound key\n * triggers the action).\n */\nexport type KeyBindings = Readonly<Record<string, readonly string[]>>;\n\n/** True if any bound code for `action` is currently held. */\nexport function isActionDown(kb: KeyboardState, bindings: KeyBindings, action: string): boolean {\n const codes = bindings[action];\n if (!codes) return false;\n for (let i = 0; i < codes.length; i++) {\n if (kb.isDown(codes[i]!)) return true;\n }\n return false;\n}\n\n/** True if any bound code for `action` was pressed this frame. */\nexport function wasActionPressed(\n kb: KeyboardState,\n bindings: KeyBindings,\n action: string,\n): boolean {\n const codes = bindings[action];\n if (!codes) return false;\n for (let i = 0; i < codes.length; i++) {\n if (kb.wasPressed(codes[i]!)) return true;\n }\n return false;\n}\n\n/**\n * True if any bound code for `action` was released this frame AND no bound\n * code is still held. Release fires only when the last held bound key lifts.\n */\nexport function wasActionReleased(\n kb: KeyboardState,\n bindings: KeyBindings,\n action: string,\n): boolean {\n const codes = bindings[action];\n if (!codes) return false;\n let anyReleased = false;\n for (let i = 0; i < codes.length; i++) {\n if (kb.isDown(codes[i]!)) return false;\n if (kb.wasReleased(codes[i]!)) anyReleased = true;\n }\n return anyReleased;\n}\n","import type { Vec2 } from '@flare-engine/math';\n\n/** State of a single pointer (primary touch or mouse). */\nexport interface Pointer {\n /** Current position in screen coordinates. */\n position: Vec2;\n /** Position delta since last frame. */\n delta: Vec2;\n /** Whether the pointer is currently held down. */\n isDown: boolean;\n /** True only on the frame the pointer was pressed. */\n justPressed: boolean;\n /** True only on the frame the pointer was released. */\n justReleased: boolean;\n}\n\n/** State of a single touch point in a multitouch scenario. */\nexport interface TouchPoint {\n /** Unique touch identifier. */\n id: number;\n /** Current position in screen coordinates. */\n position: Vec2;\n /** Whether this touch is currently active. */\n isDown: boolean;\n}\n\n/** Create a default pointer state. */\nexport function createPointer(): Pointer {\n return {\n position: { x: 0, y: 0 },\n delta: { x: 0, y: 0 },\n isDown: false,\n justPressed: false,\n justReleased: false,\n };\n}\n\n/**\n * Update pointer state for a new frame.\n * Call this at the start of each frame to clear per-frame flags.\n */\nexport function resetPointerFrame(pointer: Pointer): void {\n pointer.delta.x = 0;\n pointer.delta.y = 0;\n pointer.justPressed = false;\n pointer.justReleased = false;\n}\n\n/** Feed a pointer-down event into the pointer state. */\nexport function pointerDown(pointer: Pointer, x: number, y: number): void {\n const wasDown = pointer.isDown;\n pointer.isDown = true;\n if (!wasDown) {\n pointer.justPressed = true;\n }\n pointer.delta.x += x - pointer.position.x;\n pointer.delta.y += y - pointer.position.y;\n pointer.position.x = x;\n pointer.position.y = y;\n}\n\n/** Feed a pointer-move event into the pointer state. */\nexport function pointerMove(pointer: Pointer, x: number, y: number): void {\n pointer.delta.x += x - pointer.position.x;\n pointer.delta.y += y - pointer.position.y;\n pointer.position.x = x;\n pointer.position.y = y;\n}\n\n/** Feed a pointer-up event into the pointer state. */\nexport function pointerUp(pointer: Pointer, x: number, y: number): void {\n pointer.isDown = false;\n pointer.justReleased = true;\n pointer.delta.x += x - pointer.position.x;\n pointer.delta.y += y - pointer.position.y;\n pointer.position.x = x;\n pointer.position.y = y;\n}\n","import type { GamepadSnapshot } from './gamepad.js';\n\n/**\n * Button / axis remap table.\n *\n * `buttons[logicalId] = physicalIndex` — to poll A, read\n * `snapshot.buttons[table.buttons[GamepadButton.A]]`.\n *\n * `axes` maps logical axis id → `{ index, invert, scale }`. Most games invert\n * Y on some controllers; `scale` supports half-range triggers.\n */\nexport interface AxisMap {\n index: number;\n invert: boolean;\n scale: number;\n}\n\nexport interface RemapTable {\n buttons: number[];\n axes: AxisMap[];\n}\n\nexport function createIdentityRemap(buttonCount = 17, axisCount = 4): RemapTable {\n const buttons = new Array<number>(buttonCount);\n for (let i = 0; i < buttonCount; i++) buttons[i] = i;\n const axes = new Array<AxisMap>(axisCount);\n for (let i = 0; i < axisCount; i++) axes[i] = { index: i, invert: false, scale: 1 };\n return { buttons, axes };\n}\n\n/** Apply a remap table to a raw snapshot, returning a new snapshot with logical ordering. */\nexport function applyRemap(snapshot: GamepadSnapshot, table: RemapTable): GamepadSnapshot {\n const buttons = new Array<{ pressed: boolean; value: number }>(table.buttons.length);\n for (let logical = 0; logical < table.buttons.length; logical++) {\n const physical = table.buttons[logical] ?? logical;\n const src = snapshot.buttons[physical];\n buttons[logical] = { pressed: src?.pressed ?? false, value: src?.value ?? 0 };\n }\n const axes = new Array<number>(table.axes.length);\n for (let logical = 0; logical < table.axes.length; logical++) {\n const map = table.axes[logical] ?? { index: logical, invert: false, scale: 1 };\n const raw = snapshot.axes[map.index] ?? 0;\n axes[logical] = raw * map.scale * (map.invert ? -1 : 1);\n }\n return { id: snapshot.id, index: snapshot.index, timestamp: snapshot.timestamp, buttons, axes };\n}\n\n/**\n * Minimal storage contract — matches `@flare-engine/storage` `StorageAdapter`,\n * but declared locally so this package does not take a hard dep on storage.\n */\nexport interface RemapStore {\n get(key: string): Promise<string | null>;\n set(key: string, value: string): Promise<void>;\n}\n\n/** Persist a remap table under the given key. Throws on invalid table shape. */\nexport async function saveRemap(store: RemapStore, key: string, table: RemapTable): Promise<void> {\n await store.set(key, JSON.stringify(table));\n}\n\n/** Load a remap table. Returns `null` if absent or malformed. */\nexport async function loadRemap(store: RemapStore, key: string): Promise<RemapTable | null> {\n const raw = await store.get(key);\n if (raw === null) return null;\n try {\n const parsed = JSON.parse(raw) as unknown;\n if (!isRemapTable(parsed)) return null;\n return parsed;\n } catch {\n return null;\n }\n}\n\nfunction isRemapTable(value: unknown): value is RemapTable {\n if (typeof value !== 'object' || value === null) return false;\n const obj = value as { buttons?: unknown; axes?: unknown };\n if (!Array.isArray(obj.buttons) || !Array.isArray(obj.axes)) return false;\n for (const b of obj.buttons) if (typeof b !== 'number') return false;\n for (const a of obj.axes) {\n if (typeof a !== 'object' || a === null) return false;\n const ax = a as { index?: unknown; invert?: unknown; scale?: unknown };\n if (\n typeof ax.index !== 'number' ||\n typeof ax.invert !== 'boolean' ||\n typeof ax.scale !== 'number'\n ) {\n return false;\n }\n }\n return true;\n}\n","import {\n createGamepadState,\n type GamepadState,\n resetGamepadFrame,\n updateGamepadFromSnapshot,\n} from './gamepad.js';\nimport type { GamepadSource } from './gamepad-source.js';\nimport { createKeyboard, type KeyboardState } from './keyboard.js';\nimport {\n createPointer,\n type Pointer,\n pointerDown,\n pointerMove,\n pointerUp,\n resetPointerFrame,\n type TouchPoint,\n} from './pointer.js';\nimport type { RemapTable } from './remap.js';\nimport { applyRemap } from './remap.js';\n\n/**\n * InputManager provides a polling-based input model.\n *\n * Call `update()` once per frame (before game logic) to snapshot input state.\n * Feed events from the platform (RN touch/gesture handlers) via the on* methods.\n */\nexport class InputManager {\n /**\n * Primary pointer — the touch that started the current gesture (first\n * `onPointerDown` while no touch was active), or the mouse.\n *\n * Once assigned, the primary id stays fixed to that touch until it lifts;\n * it does NOT transfer to a remaining finger. While a second finger is\n * down, its events reach only `touches` — `pointer` neither moves nor\n * releases because of it. When the primary lifts, `pointer.isDown` goes\n * false even if other fingers remain down, and a new primary is assigned\n * only once every touch has lifted and a fresh `onPointerDown` arrives.\n * This keeps `pointer` a single continuous stream with no mid-gesture\n * teleport; read `touches` for anything beyond one finger.\n */\n readonly pointer: Pointer = createPointer();\n\n /** Buffered keyboard state. Feed via `attachKeyboardListeners` (web) or `keyboard.keyDown`/`keyUp` (mobile/RN). */\n readonly keyboard: KeyboardState = createKeyboard();\n\n /** All active touch points. */\n readonly touches: TouchPoint[] = [];\n\n private _touchMap = new Map<number, TouchPoint>();\n private _primaryTouchId: number | null = null;\n private _gamepads: GamepadState[] = [];\n private _gamepadDeadZone = 0.15;\n private _gamepadRemaps = new Map<number, RemapTable>();\n\n /** Call once per frame to reset per-frame flags. */\n update(): void {\n resetPointerFrame(this.pointer);\n this.keyboard.reset();\n for (let i = 0; i < this._gamepads.length; i++) {\n const pad = this._gamepads[i];\n if (pad) resetGamepadFrame(pad);\n }\n }\n\n /** Feed a touch/pointer begin event. */\n onPointerDown(id: number, x: number, y: number): void {\n if (this._touchMap.size === 0) {\n this._primaryTouchId = id;\n }\n if (id === this._primaryTouchId) {\n pointerDown(this.pointer, x, y);\n }\n this._addOrUpdateTouch(id, x, y, true);\n }\n\n /** Feed a touch/pointer move event. */\n onPointerMove(id: number, x: number, y: number): void {\n if (id === this._primaryTouchId) {\n pointerMove(this.pointer, x, y);\n }\n this._addOrUpdateTouch(id, x, y, true);\n }\n\n /** Feed a touch/pointer end event. */\n onPointerUp(id: number, x: number, y: number): void {\n if (id === this._primaryTouchId) {\n pointerUp(this.pointer, x, y);\n this._primaryTouchId = null;\n }\n this._removeTouch(id);\n }\n\n /** Access the gamepad state at `index`. Allocates on first access. */\n gamepad(index: number): GamepadState {\n let pad = this._gamepads[index];\n if (!pad) {\n pad = createGamepadState(index);\n this._gamepads[index] = pad;\n }\n return pad;\n }\n\n /** Dead zone in [0, 1). Axes at or below this magnitude read as 0. */\n setGamepadDeadZone(deadZone: number): void {\n this._gamepadDeadZone = Math.max(0, Math.min(0.95, deadZone));\n }\n\n /** Install a remap table for a specific gamepad index. Pass `null` to clear. */\n setGamepadRemap(index: number, table: RemapTable | null): void {\n if (table === null) this._gamepadRemaps.delete(index);\n else this._gamepadRemaps.set(index, table);\n }\n\n /** Poll all gamepads from the given source, applying remap + dead zones. */\n pollGamepads(source: GamepadSource): void {\n const snapshots = source.poll();\n for (let i = 0; i < snapshots.length; i++) {\n const pad = this.gamepad(i);\n const snap = snapshots[i] ?? null;\n const remapped =\n snap !== null\n ? this._gamepadRemaps.get(i)\n ? applyRemap(snap, this._gamepadRemaps.get(i) as RemapTable)\n : snap\n : null;\n updateGamepadFromSnapshot(pad, remapped, this._gamepadDeadZone);\n }\n }\n\n private _addOrUpdateTouch(id: number, x: number, y: number, isDown: boolean): void {\n let touch = this._touchMap.get(id);\n if (!touch) {\n touch = { id, position: { x, y }, isDown };\n this._touchMap.set(id, touch);\n this.touches.push(touch);\n } else {\n touch.position.x = x;\n touch.position.y = y;\n touch.isDown = isDown;\n }\n }\n\n private _removeTouch(id: number): void {\n const touch = this._touchMap.get(id);\n if (!touch) return;\n this._touchMap.delete(id);\n const idx = this.touches.indexOf(touch);\n if (idx !== -1) {\n this.touches.splice(idx, 1);\n }\n }\n}\n","import type { Vec2 } from '@flare-engine/math';\n\n/**\n * Dev-flag access for the config guard in `updateJoystick`, which runs once per\n * frame while a stick is held. Read as a `globalThis` property, not as a bare\n * `__DEV__` identifier: on JSC an unresolvable global costs ~270 ns per\n * evaluation where a property miss is inline-cached at ~0.46 ns. Same reasoning\n * as `@flare-engine/core`'s `Pool` — see PERF-10.\n */\nconst G = globalThis as { __DEV__?: boolean };\n\n/** Warn at most once per process; a bad config repeats every frame. */\nlet _warnedConfig = false;\n\n/** Virtual joystick configuration. */\nexport interface VirtualJoystickConfig {\n /** Dead zone radius in pixels (default 10). */\n deadZone?: number;\n /** Maximum radius in pixels (default 50). */\n maxRadius?: number;\n}\n\n/** Virtual joystick state — pure data, no UI. */\nexport interface VirtualJoystickState {\n /** Whether the joystick is currently being touched. */\n active: boolean;\n /** Normalized direction vector (-1 to 1 per axis). */\n direction: Vec2;\n /** Magnitude 0-1 (0 = center/dead zone, 1 = max radius). */\n magnitude: number;\n /** Raw offset from center in pixels. */\n offset: Vec2;\n}\n\nconst DEFAULT_DEAD_ZONE = 10;\nconst DEFAULT_MAX_RADIUS = 50;\n\n/** Create a default joystick state. */\nexport function createJoystickState(): VirtualJoystickState {\n return {\n active: false,\n direction: { x: 0, y: 0 },\n magnitude: 0,\n offset: { x: 0, y: 0 },\n };\n}\n\n/**\n * Update joystick state from a touch event.\n *\n * @param state The joystick state to update.\n * @param centerX The joystick center X in screen pixels.\n * @param centerY The joystick center Y in screen pixels.\n * @param touchX The current touch X in screen pixels.\n * @param touchY The current touch Y in screen pixels.\n * @param config Joystick configuration.\n */\nexport function updateJoystick(\n state: VirtualJoystickState,\n centerX: number,\n centerY: number,\n touchX: number,\n touchY: number,\n config?: VirtualJoystickConfig,\n): void {\n let deadZone = config?.deadZone ?? DEFAULT_DEAD_ZONE;\n let maxRadius = config?.maxRadius ?? DEFAULT_MAX_RADIUS;\n\n // Out-of-contract config is corrected rather than propagated. Left alone, a\n // NaN deadZone defeats the early return below and a maxRadius equal to\n // deadZone divides by zero at `normalizedDist` — either way `state.direction`\n // becomes NaN and, because the state is reused across frames, the stick never\n // recovers. The whole check sits behind one comparison on the healthy path.\n if (!(deadZone >= 0 && maxRadius > deadZone)) {\n if (G.__DEV__ && !_warnedConfig) {\n _warnedConfig = true;\n console.warn(\n `[flare-engine/input] updateJoystick: invalid config (deadZone=${deadZone}, maxRadius=${maxRadius}); ` +\n 'expected 0 <= deadZone < maxRadius. Falling back to defaults for this call.',\n );\n }\n if (!(deadZone >= 0)) deadZone = DEFAULT_DEAD_ZONE;\n if (!(maxRadius > deadZone)) maxRadius = deadZone + DEFAULT_MAX_RADIUS;\n }\n\n const dx = touchX - centerX;\n const dy = touchY - centerY;\n const dist = Math.sqrt(dx * dx + dy * dy);\n\n state.active = true;\n\n // `!(dist >= deadZone)` rather than `dist < deadZone` so a non-finite touch\n // coordinate takes the centred branch instead of falling through to the maths.\n if (!(dist >= deadZone)) {\n state.direction.x = 0;\n state.direction.y = 0;\n state.magnitude = 0;\n // dist is non-finite only when a touch coordinate was, in which case dx/dy\n // are too — report a centred offset rather than writing NaN into the state.\n const centred = dist === 0 || !Number.isFinite(dist);\n state.offset.x = centred ? 0 : dx;\n state.offset.y = centred ? 0 : dy;\n return;\n }\n\n // Clamp to max radius\n const clampedDist = Math.min(dist, maxRadius);\n const normalizedDist = (clampedDist - deadZone) / (maxRadius - deadZone);\n\n // Direction is always the full normalized direction. `dist` is > 0 here —\n // a zero distance cannot pass the guard above once deadZone >= 0 — but the\n // reciprocal is guarded anyway, because `deadZone: 0` makes `dist === 0`\n // reachable and `1 / 0` would put Infinity into direction.\n const invDist = dist > 0 ? 1 / dist : 0;\n state.direction.x = dx * invDist;\n state.direction.y = dy * invDist;\n state.magnitude = Math.min(normalizedDist, 1);\n\n // Offset clamped to max radius\n const scale = dist > 0 ? clampedDist / dist : 0;\n state.offset.x = dx * scale;\n state.offset.y = dy * scale;\n}\n\n/** Reset joystick state when touch is released. */\nexport function releaseJoystick(state: VirtualJoystickState): void {\n state.active = false;\n state.direction.x = 0;\n state.direction.y = 0;\n state.magnitude = 0;\n state.offset.x = 0;\n state.offset.y = 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAMA,MAAI;;AAGV,IAAI,kBAAkB;;AAGtB,MAAM,gBAAgB;;AAGtB,MAAa,gBAAgB;CAC3B,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM;CACN,OAAO;CACP,IAAI;CACJ,IAAI;CACJ,QAAQ;CACR,UAAU;CACV,UAAU;CACV,WAAW;CACX,MAAM;AACR;;AAIA,MAAa,cAAc;CACzB,OAAO;CACP,OAAO;CACP,QAAQ;CACR,QAAQ;AACV;AA+BA,SAAgB,mBAAmB,QAAQ,GAAG,cAAc,IAAI,YAAY,GAAiB;CAC3F,MAAM,UAAgC,IAAI,MAAM,WAAW;CAC3D,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,KAC/B,QAAQ,KAAK;EAAE,SAAS;EAAO,OAAO;EAAG,aAAa;EAAO,cAAc;CAAM;CAGnF,OAAO;EAAE,WAAW;EAAO,IAAI;EAAI;EAAO;EAAS,MADtC,IAAI,MAAc,SAAS,CAAC,CAAC,KAAK,CACO;EAAG,WAAW;CAAE;AACxE;AAEA,SAAS,cAAc,OAAe,UAA0B;CAI9D,IAAI,KAAK;CACT,IAAI,EAAE,MAAM,KAAK,KAAK,IAAI;EACxB,IAAIA,IAAE,WAAW,CAAC,iBAAiB;GACjC,kBAAkB;GAClB,QAAQ,KACN,iCAAiC,SAAS,qFAE5C;EACF;EACA,KAAK,MAAM,IAAI,gBAAgB;CACjC;CACA,MAAM,MAAM,KAAK,IAAI,KAAK;CAG1B,IAAI,EAAE,MAAM,KAAK,OAAO;CAGxB,QAFa,QAAQ,IAAI,KAAK,OAEd,MAAM,OAAO,IAA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ACF;EACA,IAAI,EAAE,YAAY,IAAI,WAAW;EACjC,IAAI,EAAE,YAAY,WAAW,YAAY,WAAW;CACtD;CAEA,MAAM,KAAK,SAAS;CACpB,MAAM,KAAK,SAAS;CACpB,MAAM,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK,EAAE;CAExC,MAAM,SAAS;CAIf,IAAI,EAAE,QAAQ,WAAW;EACvB,MAAM,UAAU,IAAI;EACpB,MAAM,UAAU,IAAI;EACpB,MAAM,YAAY;EAGlB,MAAM,UAAU,SAAS,KAAK,CAAC,OAAO,SAAS,IAAI;EACnD,MAAM,OAAO,IAAI,UAAU,IAAI;EAC/B,MAAM,OAAO,IAAI,UAAU,IAAI;EAC/B;CACF;CAGA,MAAM,cAAc,KAAK,IAAI,MAAM,SAAS;CAC5C,MAAM,kBAAkB,cAAc,aAAa,YAAY;CAM/D,MAAM,UAAU,OAAO,IAAI,IAAI,OAAO;CACtC,MAAM,UAAU,IAAI,KAAK;CACzB,MAAM,UAAU,IAAI,KAAK;CACzB,MAAM,YAAY,KAAK,IAAI,gBAAgB,CAAC;CAG5C,MAAM,QAAQ,OAAO,IAAI,cAAc,OAAO;CAC9C,MAAM,OAAO,IAAI,KAAK;CACtB,MAAM,OAAO,IAAI,KAAK;AACxB;;AAGA,SAAgB,gBAAgB,OAAmC;CACjE,MAAM,SAAS;CACf,MAAM,UAAU,IAAI;CACpB,MAAM,UAAU,IAAI;CACpB,MAAM,YAAY;CAClB,MAAM,OAAO,IAAI;CACjB,MAAM,OAAO,IAAI;AACnB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["G","Signal"],"sources":["../src/gamepad.ts","../src/gamepad-source.ts","../src/gestures.ts","../src/virtual-button.ts","../src/keyboard.ts","../src/pointer.ts","../src/remap.ts","../src/input-manager.ts","../src/virtual-joystick.ts"],"sourcesContent":["/**\n * Gamepad — poll-based state for a single connected controller.\n *\n * Buttons and axes are indexed against the W3C \"Standard Gamepad\" mapping by\n * default. Callers can translate raw indices via `remap.ts` before feeding\n * snapshots into `updateGamepadFromSnapshot`.\n */\n\n/**\n * Dev-flag access for the dead-zone guard, which runs per axis per frame. Read\n * as a `globalThis` property rather than a bare `__DEV__` identifier for the\n * reason measured in PERF-10 (~0.46 ns vs ~270 ns on JSC).\n */\nconst G = globalThis as { __DEV__?: boolean };\n\n/** Warn at most once per process; a bad dead zone repeats every frame. */\nlet _warnedDeadZone = false;\n\n/** Largest dead zone that still leaves the rescale well-defined. */\nconst MAX_DEAD_ZONE = 0.99;\n\n/** W3C Standard Gamepad button indices. */\nexport const GamepadButton = {\n A: 0,\n B: 1,\n X: 2,\n Y: 3,\n LB: 4,\n RB: 5,\n LT: 6,\n RT: 7,\n Back: 8,\n Start: 9,\n LS: 10,\n RS: 11,\n DpadUp: 12,\n DpadDown: 13,\n DpadLeft: 14,\n DpadRight: 15,\n Home: 16,\n} as const;\nexport type GamepadButtonId = (typeof GamepadButton)[keyof typeof GamepadButton];\n\n/** W3C Standard Gamepad axes. */\nexport const GamepadAxis = {\n LeftX: 0,\n LeftY: 1,\n RightX: 2,\n RightY: 3,\n} as const;\nexport type GamepadAxisId = (typeof GamepadAxis)[keyof typeof GamepadAxis];\n\nexport interface GamepadButtonState {\n pressed: boolean;\n value: number;\n /** True for exactly one frame after a press. */\n justPressed: boolean;\n /** True for exactly one frame after a release. */\n justReleased: boolean;\n}\n\nexport interface GamepadState {\n connected: boolean;\n id: string;\n index: number;\n buttons: GamepadButtonState[];\n axes: number[];\n /** Monotonically increasing timestamp from the source (ms). */\n timestamp: number;\n}\n\n/** Raw snapshot from a `GamepadSource` — values only, no derived state. */\nexport interface GamepadSnapshot {\n id: string;\n index: number;\n buttons: { pressed: boolean; value: number }[];\n axes: number[];\n timestamp: number;\n}\n\nexport function createGamepadState(index = 0, buttonCount = 17, axisCount = 4): GamepadState {\n const buttons: GamepadButtonState[] = new Array(buttonCount);\n for (let i = 0; i < buttonCount; i++) {\n buttons[i] = { pressed: false, value: 0, justPressed: false, justReleased: false };\n }\n const axes = new Array<number>(axisCount).fill(0);\n return { connected: false, id: '', index, buttons, axes, timestamp: 0 };\n}\n\nfunction applyDeadZone(value: number, deadZone: number): number {\n // The documented contract is [0, 1). At exactly 1 the rescale below divides by\n // zero and returns ±Infinity for any out-of-range axis, which then propagates\n // into every consumer reading the stick. Correct rather than propagate.\n let dz = deadZone;\n if (!(dz >= 0 && dz < 1)) {\n if (G.__DEV__ && !_warnedDeadZone) {\n _warnedDeadZone = true;\n console.warn(\n `[flare-engine/input] deadZone=${deadZone} is outside [0, 1); clamping. ` +\n 'Values at or above 1 would suppress the axis entirely.',\n );\n }\n dz = dz >= 1 ? MAX_DEAD_ZONE : 0;\n }\n const abs = Math.abs(value);\n // `!(abs > dz)` rather than `abs <= dz` so a non-finite axis returns 0 instead\n // of falling through to produce NaN.\n if (!(abs > dz)) return 0;\n const sign = value < 0 ? -1 : 1;\n // Rescale [deadZone, 1] -> [0, 1] so inputs remain smooth past the dead zone.\n return sign * ((abs - dz) / (1 - dz));\n}\n\n/**\n * Apply a fresh snapshot to an existing `GamepadState` in place. Derived\n * `justPressed` / `justReleased` flags are recomputed from the\n * previous `pressed` value.\n *\n * `deadZone` in [0, 1). Values at or below are treated as 0.\n */\nexport function updateGamepadFromSnapshot(\n state: GamepadState,\n snapshot: GamepadSnapshot | null,\n deadZone = 0,\n): void {\n if (snapshot === null) {\n if (!state.connected && !anyButtonDown(state)) {\n clearFrameFlags(state);\n return;\n }\n // Disconnect: clear edge flags, keep sticky pressed=false for released-edge.\n for (let i = 0; i < state.buttons.length; i++) {\n const b = state.buttons[i];\n if (!b) continue;\n b.justPressed = false;\n b.justReleased = b.pressed;\n b.pressed = false;\n b.value = 0;\n }\n for (let i = 0; i < state.axes.length; i++) state.axes[i] = 0;\n state.connected = false;\n state.id = '';\n return;\n }\n\n state.connected = true;\n state.id = snapshot.id;\n state.index = snapshot.index;\n state.timestamp = snapshot.timestamp;\n\n const srcButtons = snapshot.buttons;\n const bLen = Math.min(state.buttons.length, srcButtons.length);\n for (let i = 0; i < bLen; i++) {\n const prev = state.buttons[i];\n const src = srcButtons[i];\n if (!prev || !src) continue;\n const wasDown = prev.pressed;\n prev.pressed = src.pressed;\n prev.value = src.value;\n prev.justPressed = src.pressed && !wasDown;\n prev.justReleased = !src.pressed && wasDown;\n }\n // Buttons beyond the snapshot length: clear edges, keep prior pressed false.\n for (let i = bLen; i < state.buttons.length; i++) {\n const b = state.buttons[i];\n if (!b) continue;\n b.justPressed = false;\n b.justReleased = b.pressed;\n b.pressed = false;\n b.value = 0;\n }\n\n const aLen = Math.min(state.axes.length, snapshot.axes.length);\n for (let i = 0; i < aLen; i++) {\n state.axes[i] = applyDeadZone(snapshot.axes[i] ?? 0, deadZone);\n }\n for (let i = aLen; i < state.axes.length; i++) state.axes[i] = 0;\n}\n\n/** Reset just the per-frame edge flags. Call when advancing a frame without a fresh snapshot. */\nexport function resetGamepadFrame(state: GamepadState): void {\n clearFrameFlags(state);\n}\n\nfunction clearFrameFlags(state: GamepadState): void {\n for (let i = 0; i < state.buttons.length; i++) {\n const b = state.buttons[i];\n if (!b) continue;\n b.justPressed = false;\n b.justReleased = false;\n }\n}\n\nfunction anyButtonDown(state: GamepadState): boolean {\n for (let i = 0; i < state.buttons.length; i++) {\n if (state.buttons[i]?.pressed) return true;\n }\n return false;\n}\n\nexport function isButtonDown(state: GamepadState, button: number): boolean {\n return state.buttons[button]?.pressed ?? false;\n}\n\nexport function wasButtonPressed(state: GamepadState, button: number): boolean {\n return state.buttons[button]?.justPressed ?? false;\n}\n\nexport function wasButtonReleased(state: GamepadState, button: number): boolean {\n return state.buttons[button]?.justReleased ?? false;\n}\n\nexport function getAxis(state: GamepadState, axis: number): number {\n return state.axes[axis] ?? 0;\n}\n","import type { GamepadSnapshot } from './gamepad.js';\n\n/**\n * Platform abstraction for sampling connected gamepads.\n *\n * `poll()` returns one snapshot per slot (typically up to 4). Unconnected\n * slots return `null`. Implementations:\n *\n * - `createWebGamepadSource()` wraps the W3C `navigator.getGamepads` API.\n * - Native implementations (e.g., `react-native-gamepad`) inject their own\n * via the `GamepadSource` interface — the package itself ships no native deps.\n *\n * **Freshness contract:** each call returns fresh objects. An implementation\n * must not reuse or mutate a snapshot (or its `buttons`/`axes` arrays) that a\n * previous `poll()` call returned. A caller may therefore retain a returned\n * snapshot across frames without it changing out from under them.\n */\nexport interface GamepadSource {\n poll(): (GamepadSnapshot | null)[];\n}\n\ninterface NavigatorLike {\n getGamepads?: () => (WebGamepad | null)[];\n}\n\ninterface WebGamepad {\n id: string;\n index: number;\n connected: boolean;\n timestamp: number;\n buttons: readonly { pressed: boolean; value: number }[];\n axes: readonly number[];\n}\n\n/**\n * Wrap `navigator.getGamepads()` (W3C Gamepad API). If `nav` is not supplied,\n * uses `globalThis.navigator`. Returns an empty array when the API is absent.\n */\nexport function createWebGamepadSource(nav?: NavigatorLike): GamepadSource {\n const source: NavigatorLike | undefined =\n nav ??\n (typeof globalThis === 'undefined'\n ? undefined\n : (globalThis as { navigator?: NavigatorLike }).navigator);\n\n return {\n poll(): (GamepadSnapshot | null)[] {\n if (!source?.getGamepads) return [];\n const pads = source.getGamepads();\n const out: (GamepadSnapshot | null)[] = new Array(pads.length);\n for (let i = 0; i < pads.length; i++) {\n const p = pads[i];\n if (!p?.connected) {\n out[i] = null;\n continue;\n }\n out[i] = webGamepadToSnapshot(p);\n }\n return out;\n },\n };\n}\n\nfunction webGamepadToSnapshot(p: WebGamepad): GamepadSnapshot {\n const buttons = new Array<{ pressed: boolean; value: number }>(p.buttons.length);\n for (let i = 0; i < p.buttons.length; i++) {\n const b = p.buttons[i];\n buttons[i] = { pressed: b?.pressed ?? false, value: b?.value ?? 0 };\n }\n const axes = new Array<number>(p.axes.length);\n for (let i = 0; i < p.axes.length; i++) axes[i] = p.axes[i] ?? 0;\n return { id: p.id, index: p.index, timestamp: p.timestamp, buttons, axes };\n}\n","import { Signal } from '@flare-engine/events';\nimport type { Vec2 } from '@flare-engine/math';\n\n/** Swipe direction. */\nexport type SwipeDirection = 'left' | 'right' | 'up' | 'down';\n\n/** Gesture detection configuration. */\nexport interface GestureConfig {\n /** Max time (seconds) for a tap (default 0.3). */\n tapMaxDuration?: number;\n /** Max distance (px) for a tap (default 20). */\n tapMaxDistance?: number;\n /** Min time (seconds) for a long press (default 0.5). */\n longPressMinDuration?: number;\n /** Min distance (px) for a swipe (default 50). */\n swipeMinDistance?: number;\n /** Max time (seconds) for a swipe (default 0.4). */\n swipeMaxDuration?: number;\n}\n\n/** Swipe event data. */\nexport interface SwipeEvent {\n direction: SwipeDirection;\n distance: number;\n duration: number;\n}\n\n/** Pinch event data. */\nexport interface PinchEvent {\n /** Scale factor (>1 = spread, <1 = pinch). */\n scale: number;\n /** Center point between the two touches. */\n center: Vec2;\n}\n\nconst DEFAULT_TAP_MAX_DURATION = 0.3;\nconst DEFAULT_TAP_MAX_DISTANCE = 20;\nconst DEFAULT_LONG_PRESS_MIN_DURATION = 0.5;\nconst DEFAULT_SWIPE_MIN_DISTANCE = 50;\nconst DEFAULT_SWIPE_MAX_DURATION = 0.4;\n\n/**\n * GestureDetector recognizes tap, long press, swipe, and pinch gestures\n * from raw pointer events.\n */\nexport class GestureDetector {\n readonly onTap = new Signal<Vec2>();\n readonly onLongPress = new Signal<Vec2>();\n readonly onSwipe = new Signal<SwipeEvent>();\n readonly onPinch = new Signal<PinchEvent>();\n\n private tapMaxDuration: number;\n private tapMaxDistance: number;\n private longPressMinDuration: number;\n private swipeMinDistance: number;\n private swipeMaxDuration: number;\n\n // Single-touch tracking\n private _startPos: Vec2 = { x: 0, y: 0 };\n /** Elapsed time (seconds) since `pointerDown` for the in-progress press. */\n private _elapsed = 0;\n private _isTracking = false;\n private _longPressFired = false;\n\n // Pinch tracking\n private _pinchStartDistance = 0;\n private _pinchTouches: [Vec2, Vec2] | null = null;\n\n constructor(config?: GestureConfig) {\n this.tapMaxDuration = config?.tapMaxDuration ?? DEFAULT_TAP_MAX_DURATION;\n this.tapMaxDistance = config?.tapMaxDistance ?? DEFAULT_TAP_MAX_DISTANCE;\n this.longPressMinDuration = config?.longPressMinDuration ?? DEFAULT_LONG_PRESS_MIN_DURATION;\n this.swipeMinDistance = config?.swipeMinDistance ?? DEFAULT_SWIPE_MIN_DISTANCE;\n this.swipeMaxDuration = config?.swipeMaxDuration ?? DEFAULT_SWIPE_MAX_DURATION;\n }\n\n /** Feed a pointer-down event. */\n pointerDown(x: number, y: number): void {\n this._startPos = { x, y };\n this._elapsed = 0;\n this._isTracking = true;\n this._longPressFired = false;\n }\n\n /**\n * Feed a pointer-up event.\n *\n * `elapsedSinceDown` is optional: pass it when the host tracks its own\n * timestamps (e.g. event-driven, no per-frame `update()` calls); omit it\n * to use the elapsed time already accumulated via `update(dt, ...)`. Either\n * way there is one clock per press — passing it here re-syncs the same\n * accumulator `update()` advances, rather than racing it. If a long press\n * already fired for this press, tap/swipe are suppressed so one press\n * yields exactly one gesture.\n */\n pointerUp(x: number, y: number, elapsedSinceDown?: number): void {\n if (!this._isTracking) return;\n this._isTracking = false;\n if (elapsedSinceDown !== undefined) this._elapsed = elapsedSinceDown;\n if (this._longPressFired) return;\n\n const dx = x - this._startPos.x;\n const dy = y - this._startPos.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n const duration = this._elapsed;\n\n // Check swipe first (requires min distance)\n if (dist >= this.swipeMinDistance && duration <= this.swipeMaxDuration) {\n const absDx = Math.abs(dx);\n const absDy = Math.abs(dy);\n let direction: SwipeDirection;\n if (absDx > absDy) {\n direction = dx > 0 ? 'right' : 'left';\n } else {\n direction = dy > 0 ? 'down' : 'up';\n }\n this.onSwipe.emit({ direction, distance: dist, duration });\n return;\n }\n\n // Check tap (short press, small movement)\n if (dist <= this.tapMaxDistance && duration <= this.tapMaxDuration) {\n this.onTap.emit({ x, y });\n return;\n }\n }\n\n /**\n * Update gesture tracking. Call each frame with dt.\n * @param dt Delta time in seconds.\n * @param currentX Current pointer X.\n * @param currentY Current pointer Y.\n */\n update(dt: number, currentX: number, currentY: number): void {\n if (!this._isTracking) return;\n this._elapsed += dt;\n\n // Long press detection\n if (!this._longPressFired && this._elapsed >= this.longPressMinDuration) {\n const dx = currentX - this._startPos.x;\n const dy = currentY - this._startPos.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n if (dist <= this.tapMaxDistance) {\n this._longPressFired = true;\n this.onLongPress.emit({ x: currentX, y: currentY });\n }\n }\n }\n\n /**\n * Feed a two-finger pinch update. Call when two touches are active.\n * @param t1 First touch position.\n * @param t2 Second touch position.\n */\n pinchUpdate(t1: Vec2, t2: Vec2): void {\n const dx = t2.x - t1.x;\n const dy = t2.y - t1.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n\n if (this._pinchTouches === null) {\n // Start pinch\n this._pinchStartDistance = dist;\n this._pinchTouches = [{ ...t1 }, { ...t2 }];\n return;\n }\n\n if (this._pinchStartDistance > 0) {\n const scale = dist / this._pinchStartDistance;\n const center: Vec2 = {\n x: (t1.x + t2.x) / 2,\n y: (t1.y + t2.y) / 2,\n };\n this.onPinch.emit({ scale, center });\n }\n }\n\n /** Call when pinch ends (fewer than 2 touches). */\n pinchEnd(): void {\n this._pinchTouches = null;\n this._pinchStartDistance = 0;\n }\n}\n","/** Virtual button state — pure data, no UI. */\nexport interface VirtualButtonState {\n /** Whether the button is currently pressed. */\n isPressed: boolean;\n /** Whether the button was just pressed this frame. */\n justPressed: boolean;\n /** Whether the button was just released this frame. */\n justReleased: boolean;\n}\n\n/** Create a default button state. */\nexport function createButtonState(): VirtualButtonState {\n return {\n isPressed: false,\n justPressed: false,\n justReleased: false,\n };\n}\n\n/** Call at the start of each frame to reset per-frame flags. */\nexport function resetButtonFrame(state: VirtualButtonState): void {\n state.justPressed = false;\n state.justReleased = false;\n}\n\n/** Call when the button is pressed. */\nexport function pressButton(state: VirtualButtonState): void {\n if (!state.isPressed) {\n state.isPressed = true;\n state.justPressed = true;\n }\n}\n\n/** Call when the button is released. */\nexport function releaseButton(state: VirtualButtonState): void {\n if (state.isPressed) {\n state.isPressed = false;\n state.justReleased = true;\n }\n}\n","import {\n createButtonState,\n pressButton,\n releaseButton,\n resetButtonFrame,\n type VirtualButtonState,\n} from './virtual-button.js';\n\n/** Minimal keyboard event shape — no DOM type dep. */\nexport interface KeyboardEventLike {\n readonly code: string;\n readonly type: string;\n /** Optional — real DOM events have it; synthetic feeds may not. */\n preventDefault?(): void;\n}\n\n/** Minimal event target shape for attaching keyboard listeners. */\nexport interface KeyboardEventTargetLike {\n addEventListener(type: string, handler: (ev: KeyboardEventLike) => void): void;\n removeEventListener(type: string, handler: (ev: KeyboardEventLike) => void): void;\n}\n\n/**\n * Buffered per-frame keyboard state.\n *\n * Edge flags (`wasPressed`, `wasReleased`) clear each frame via `reset()`.\n * `keyDown` / `keyUp` are the platform-neutral injection points: web feeds\n * them via `attachKeyboardListeners`; mobile/RN feeds them from a\n * hardware-keyboard native module or an on-screen source.\n */\nexport interface KeyboardState {\n /** True while the key is physically held. */\n isDown(code: string): boolean;\n /** True only on the frame the key was pressed. */\n wasPressed(code: string): boolean;\n /** True only on the frame the key was released. */\n wasReleased(code: string): boolean;\n /** Platform-neutral injection. OS auto-repeat is de-edged by the pressButton guard. */\n keyDown(code: string): void;\n /** Platform-neutral injection. */\n keyUp(code: string): void;\n /** Frame-start edge clear. Zero-alloc. */\n reset(): void;\n /** Blur/stuck-key guard: emits a release edge for every held code, then drops held. */\n clear(): void;\n}\n\n/** Create a fresh keyboard state. */\nexport function createKeyboard(): KeyboardState {\n const states: VirtualButtonState[] = [];\n const codeIndex = new Map<string, number>();\n\n return {\n isDown(code: string): boolean {\n const i = codeIndex.get(code);\n if (i === undefined) return false;\n return states[i]?.isPressed ?? false;\n },\n\n wasPressed(code: string): boolean {\n const i = codeIndex.get(code);\n if (i === undefined) return false;\n return states[i]?.justPressed ?? false;\n },\n\n wasReleased(code: string): boolean {\n const i = codeIndex.get(code);\n if (i === undefined) return false;\n return states[i]?.justReleased ?? false;\n },\n\n keyDown(code: string): void {\n let i = codeIndex.get(code);\n if (i === undefined) {\n i = states.length;\n states.push(createButtonState());\n codeIndex.set(code, i);\n }\n pressButton(states[i]!);\n },\n\n keyUp(code: string): void {\n const i = codeIndex.get(code);\n if (i === undefined) return;\n releaseButton(states[i]!);\n },\n\n reset(): void {\n for (let i = 0; i < states.length; i++) {\n resetButtonFrame(states[i]!);\n }\n },\n\n clear(): void {\n for (let i = 0; i < states.length; i++) {\n releaseButton(states[i]!);\n }\n },\n };\n}\n\n/**\n * Web turnkey adapter: registers `keydown`, `keyup`, and `blur` listeners on\n * `target`. `blur` calls `kb.clear()` (stuck-key guard). Returns a detach fn.\n *\n * `target` is structural `{ addEventListener, removeEventListener }` — no DOM\n * types dep. On web, pass `window`; for mobile/RN, feed `keyDown`/`keyUp`\n * directly from a hardware-keyboard native module or an on-screen source.\n *\n * Does NOT call `preventDefault` — bare use lets Space/arrows scroll and Tab\n * move DOM focus. For game-mode input, attach your own listener that calls\n * `preventDefault` for game keys and forwards `kb.keyDown(ev.code)`.\n */\nexport function attachKeyboardListeners(\n kb: KeyboardState,\n target: KeyboardEventTargetLike,\n): () => void {\n const onKeyDown = (ev: KeyboardEventLike): void => {\n kb.keyDown(ev.code);\n };\n const onKeyUp = (ev: KeyboardEventLike): void => {\n kb.keyUp(ev.code);\n };\n const onBlur = (_ev: KeyboardEventLike): void => {\n kb.clear();\n };\n\n target.addEventListener('keydown', onKeyDown);\n target.addEventListener('keyup', onKeyUp);\n target.addEventListener('blur', onBlur);\n\n return (): void => {\n target.removeEventListener('keydown', onKeyDown);\n target.removeEventListener('keyup', onKeyUp);\n target.removeEventListener('blur', onBlur);\n };\n}\n\n/**\n * Action → code binding map. Keys are action names; values are arrays of\n * `KeyboardEvent.code` strings. Multiple codes OR-reduce (any bound key\n * triggers the action).\n */\nexport type KeyBindings = Readonly<Record<string, readonly string[]>>;\n\n/** True if any bound code for `action` is currently held. */\nexport function isActionDown(kb: KeyboardState, bindings: KeyBindings, action: string): boolean {\n const codes = bindings[action];\n if (!codes) return false;\n for (let i = 0; i < codes.length; i++) {\n if (kb.isDown(codes[i]!)) return true;\n }\n return false;\n}\n\n/** True if any bound code for `action` was pressed this frame. */\nexport function wasActionPressed(\n kb: KeyboardState,\n bindings: KeyBindings,\n action: string,\n): boolean {\n const codes = bindings[action];\n if (!codes) return false;\n for (let i = 0; i < codes.length; i++) {\n if (kb.wasPressed(codes[i]!)) return true;\n }\n return false;\n}\n\n/**\n * True if any bound code for `action` was released this frame AND no bound\n * code is still held. Release fires only when the last held bound key lifts.\n */\nexport function wasActionReleased(\n kb: KeyboardState,\n bindings: KeyBindings,\n action: string,\n): boolean {\n const codes = bindings[action];\n if (!codes) return false;\n let anyReleased = false;\n for (let i = 0; i < codes.length; i++) {\n if (kb.isDown(codes[i]!)) return false;\n if (kb.wasReleased(codes[i]!)) anyReleased = true;\n }\n return anyReleased;\n}\n","import type { Vec2 } from '@flare-engine/math';\n\n/** State of a single pointer (primary touch or mouse). */\nexport interface Pointer {\n /** Current position in screen coordinates. */\n position: Vec2;\n /** Position delta since last frame. */\n delta: Vec2;\n /** Whether the pointer is currently held down. */\n isDown: boolean;\n /** True only on the frame the pointer was pressed. */\n justPressed: boolean;\n /** True only on the frame the pointer was released. */\n justReleased: boolean;\n}\n\n/** State of a single touch point in a multitouch scenario. */\nexport interface TouchPoint {\n /** Unique touch identifier. */\n id: number;\n /** Current position in screen coordinates. */\n position: Vec2;\n /** Whether this touch is currently active. */\n isDown: boolean;\n}\n\n/** Create a default pointer state. */\nexport function createPointer(): Pointer {\n return {\n position: { x: 0, y: 0 },\n delta: { x: 0, y: 0 },\n isDown: false,\n justPressed: false,\n justReleased: false,\n };\n}\n\n/**\n * Update pointer state for a new frame.\n * Call this at the start of each frame to clear per-frame flags.\n */\nexport function resetPointerFrame(pointer: Pointer): void {\n pointer.delta.x = 0;\n pointer.delta.y = 0;\n pointer.justPressed = false;\n pointer.justReleased = false;\n}\n\n/** Feed a pointer-down event into the pointer state. */\nexport function pointerDown(pointer: Pointer, x: number, y: number): void {\n const wasDown = pointer.isDown;\n pointer.isDown = true;\n if (!wasDown) {\n pointer.justPressed = true;\n }\n pointer.delta.x += x - pointer.position.x;\n pointer.delta.y += y - pointer.position.y;\n pointer.position.x = x;\n pointer.position.y = y;\n}\n\n/** Feed a pointer-move event into the pointer state. */\nexport function pointerMove(pointer: Pointer, x: number, y: number): void {\n pointer.delta.x += x - pointer.position.x;\n pointer.delta.y += y - pointer.position.y;\n pointer.position.x = x;\n pointer.position.y = y;\n}\n\n/** Feed a pointer-up event into the pointer state. */\nexport function pointerUp(pointer: Pointer, x: number, y: number): void {\n pointer.isDown = false;\n pointer.justReleased = true;\n pointer.delta.x += x - pointer.position.x;\n pointer.delta.y += y - pointer.position.y;\n pointer.position.x = x;\n pointer.position.y = y;\n}\n","import type { GamepadSnapshot } from './gamepad.js';\n\n/**\n * Button / axis remap table.\n *\n * `buttons[logicalId] = physicalIndex` — to poll A, read\n * `snapshot.buttons[table.buttons[GamepadButton.A]]`.\n *\n * `axes` maps logical axis id → `{ index, invert, scale }`. Most games invert\n * Y on some controllers; `scale` supports half-range triggers.\n */\nexport interface AxisMap {\n index: number;\n invert: boolean;\n scale: number;\n}\n\nexport interface RemapTable {\n buttons: number[];\n axes: AxisMap[];\n}\n\nexport function createIdentityRemap(buttonCount = 17, axisCount = 4): RemapTable {\n const buttons = new Array<number>(buttonCount);\n for (let i = 0; i < buttonCount; i++) buttons[i] = i;\n const axes = new Array<AxisMap>(axisCount);\n for (let i = 0; i < axisCount; i++) axes[i] = { index: i, invert: false, scale: 1 };\n return { buttons, axes };\n}\n\n/** Apply a remap table to a raw snapshot, returning a new snapshot with logical ordering. */\nexport function applyRemap(snapshot: GamepadSnapshot, table: RemapTable): GamepadSnapshot {\n const buttons = new Array<{ pressed: boolean; value: number }>(table.buttons.length);\n for (let logical = 0; logical < table.buttons.length; logical++) {\n const physical = table.buttons[logical] ?? logical;\n const src = snapshot.buttons[physical];\n buttons[logical] = { pressed: src?.pressed ?? false, value: src?.value ?? 0 };\n }\n const axes = new Array<number>(table.axes.length);\n for (let logical = 0; logical < table.axes.length; logical++) {\n const map = table.axes[logical] ?? { index: logical, invert: false, scale: 1 };\n const raw = snapshot.axes[map.index] ?? 0;\n axes[logical] = raw * map.scale * (map.invert ? -1 : 1);\n }\n return { id: snapshot.id, index: snapshot.index, timestamp: snapshot.timestamp, buttons, axes };\n}\n\n/**\n * Minimal storage contract — matches `@flare-engine/storage` `StorageAdapter`,\n * but declared locally so this package does not take a hard dep on storage.\n */\nexport interface RemapStore {\n get(key: string): Promise<string | null>;\n set(key: string, value: string): Promise<void>;\n}\n\n/** Persist a remap table under the given key. Throws on invalid table shape. */\nexport async function saveRemap(store: RemapStore, key: string, table: RemapTable): Promise<void> {\n await store.set(key, JSON.stringify(table));\n}\n\n/** Load a remap table. Returns `null` if absent or malformed. */\nexport async function loadRemap(store: RemapStore, key: string): Promise<RemapTable | null> {\n const raw = await store.get(key);\n if (raw === null) return null;\n try {\n const parsed = JSON.parse(raw) as unknown;\n if (!isRemapTable(parsed)) return null;\n return parsed;\n } catch {\n return null;\n }\n}\n\nfunction isRemapTable(value: unknown): value is RemapTable {\n if (typeof value !== 'object' || value === null) return false;\n const obj = value as { buttons?: unknown; axes?: unknown };\n if (!Array.isArray(obj.buttons) || !Array.isArray(obj.axes)) return false;\n for (const b of obj.buttons) if (typeof b !== 'number') return false;\n for (const a of obj.axes) {\n if (typeof a !== 'object' || a === null) return false;\n const ax = a as { index?: unknown; invert?: unknown; scale?: unknown };\n if (\n typeof ax.index !== 'number' ||\n typeof ax.invert !== 'boolean' ||\n typeof ax.scale !== 'number'\n ) {\n return false;\n }\n }\n return true;\n}\n","import {\n createGamepadState,\n type GamepadState,\n resetGamepadFrame,\n updateGamepadFromSnapshot,\n} from './gamepad.js';\nimport type { GamepadSource } from './gamepad-source.js';\nimport { createKeyboard, type KeyboardState } from './keyboard.js';\nimport {\n createPointer,\n type Pointer,\n pointerDown,\n pointerMove,\n pointerUp,\n resetPointerFrame,\n type TouchPoint,\n} from './pointer.js';\nimport type { RemapTable } from './remap.js';\nimport { applyRemap } from './remap.js';\n\n/**\n * InputManager provides a polling-based input model.\n *\n * Call `update()` once per frame (before game logic) to snapshot input state.\n * Feed events from the platform (RN touch/gesture handlers) via the on* methods.\n */\nexport class InputManager {\n /**\n * Primary pointer — the touch that started the current gesture (first\n * `onPointerDown` while no touch was active), or the mouse.\n *\n * Once assigned, the primary id stays fixed to that touch until it lifts;\n * it does NOT transfer to a remaining finger. While a second finger is\n * down, its events reach only `touches` — `pointer` neither moves nor\n * releases because of it. When the primary lifts, `pointer.isDown` goes\n * false even if other fingers remain down, and a new primary is assigned\n * only once every touch has lifted and a fresh `onPointerDown` arrives.\n * This keeps `pointer` a single continuous stream with no mid-gesture\n * teleport; read `touches` for anything beyond one finger.\n */\n readonly pointer: Pointer = createPointer();\n\n /** Buffered keyboard state. Feed via `attachKeyboardListeners` (web) or `keyboard.keyDown`/`keyUp` (mobile/RN). */\n readonly keyboard: KeyboardState = createKeyboard();\n\n /** All active touch points. */\n readonly touches: TouchPoint[] = [];\n\n private _touchMap = new Map<number, TouchPoint>();\n private _primaryTouchId: number | null = null;\n private _gamepads: GamepadState[] = [];\n private _gamepadDeadZone = 0.15;\n private _gamepadRemaps = new Map<number, RemapTable>();\n\n /** Call once per frame to reset per-frame flags. */\n update(): void {\n resetPointerFrame(this.pointer);\n this.keyboard.reset();\n for (let i = 0; i < this._gamepads.length; i++) {\n const pad = this._gamepads[i];\n if (pad) resetGamepadFrame(pad);\n }\n }\n\n /** Feed a touch/pointer begin event. */\n onPointerDown(id: number, x: number, y: number): void {\n if (this._touchMap.size === 0) {\n this._primaryTouchId = id;\n }\n if (id === this._primaryTouchId) {\n pointerDown(this.pointer, x, y);\n }\n this._addOrUpdateTouch(id, x, y, true);\n }\n\n /** Feed a touch/pointer move event. */\n onPointerMove(id: number, x: number, y: number): void {\n if (id === this._primaryTouchId) {\n pointerMove(this.pointer, x, y);\n }\n this._addOrUpdateTouch(id, x, y, true);\n }\n\n /** Feed a touch/pointer end event. */\n onPointerUp(id: number, x: number, y: number): void {\n if (id === this._primaryTouchId) {\n pointerUp(this.pointer, x, y);\n this._primaryTouchId = null;\n }\n this._removeTouch(id);\n }\n\n /** Access the gamepad state at `index`. Allocates on first access. */\n gamepad(index: number): GamepadState {\n let pad = this._gamepads[index];\n if (!pad) {\n pad = createGamepadState(index);\n this._gamepads[index] = pad;\n }\n return pad;\n }\n\n /** Dead zone in [0, 1). Axes at or below this magnitude read as 0. */\n setGamepadDeadZone(deadZone: number): void {\n this._gamepadDeadZone = Math.max(0, Math.min(0.95, deadZone));\n }\n\n /** Install a remap table for a specific gamepad index. Pass `null` to clear. */\n setGamepadRemap(index: number, table: RemapTable | null): void {\n if (table === null) this._gamepadRemaps.delete(index);\n else this._gamepadRemaps.set(index, table);\n }\n\n /** Poll all gamepads from the given source, applying remap + dead zones. */\n pollGamepads(source: GamepadSource): void {\n const snapshots = source.poll();\n for (let i = 0; i < snapshots.length; i++) {\n const pad = this.gamepad(i);\n const snap = snapshots[i] ?? null;\n const remapped =\n snap !== null\n ? this._gamepadRemaps.get(i)\n ? applyRemap(snap, this._gamepadRemaps.get(i) as RemapTable)\n : snap\n : null;\n updateGamepadFromSnapshot(pad, remapped, this._gamepadDeadZone);\n }\n }\n\n private _addOrUpdateTouch(id: number, x: number, y: number, isDown: boolean): void {\n let touch = this._touchMap.get(id);\n if (!touch) {\n touch = { id, position: { x, y }, isDown };\n this._touchMap.set(id, touch);\n this.touches.push(touch);\n } else {\n touch.position.x = x;\n touch.position.y = y;\n touch.isDown = isDown;\n }\n }\n\n private _removeTouch(id: number): void {\n const touch = this._touchMap.get(id);\n if (!touch) return;\n this._touchMap.delete(id);\n const idx = this.touches.indexOf(touch);\n if (idx !== -1) {\n this.touches.splice(idx, 1);\n }\n }\n}\n","import type { Vec2 } from '@flare-engine/math';\n\n/**\n * Dev-flag access for the config guard in `updateJoystick`, which runs once per\n * frame while a stick is held. Read as a `globalThis` property, not as a bare\n * `__DEV__` identifier: on JSC an unresolvable global costs ~270 ns per\n * evaluation where a property miss is inline-cached at ~0.46 ns. Same reasoning\n * as `@flare-engine/core`'s `Pool` — see PERF-10.\n */\nconst G = globalThis as { __DEV__?: boolean };\n\n/** Warn at most once per process; a bad config repeats every frame. */\nlet _warnedConfig = false;\n\n/** Virtual joystick configuration. */\nexport interface VirtualJoystickConfig {\n /** Dead zone radius in pixels (default 10). */\n deadZone?: number;\n /** Maximum radius in pixels (default 50). */\n maxRadius?: number;\n}\n\n/** Virtual joystick state — pure data, no UI. */\nexport interface VirtualJoystickState {\n /** Whether the joystick is currently being touched. */\n active: boolean;\n /** Normalized direction vector (-1 to 1 per axis). */\n direction: Vec2;\n /** Magnitude 0-1 (0 = center/dead zone, 1 = max radius). */\n magnitude: number;\n /** Raw offset from center in pixels. */\n offset: Vec2;\n}\n\nconst DEFAULT_DEAD_ZONE = 10;\nconst DEFAULT_MAX_RADIUS = 50;\n\n/** Create a default joystick state. */\nexport function createJoystickState(): VirtualJoystickState {\n return {\n active: false,\n direction: { x: 0, y: 0 },\n magnitude: 0,\n offset: { x: 0, y: 0 },\n };\n}\n\n/**\n * Update joystick state from a touch event.\n *\n * @param state The joystick state to update.\n * @param centerX The joystick center X in screen pixels.\n * @param centerY The joystick center Y in screen pixels.\n * @param touchX The current touch X in screen pixels.\n * @param touchY The current touch Y in screen pixels.\n * @param config Joystick configuration.\n */\nexport function updateJoystick(\n state: VirtualJoystickState,\n centerX: number,\n centerY: number,\n touchX: number,\n touchY: number,\n config?: VirtualJoystickConfig,\n): void {\n let deadZone = config?.deadZone ?? DEFAULT_DEAD_ZONE;\n let maxRadius = config?.maxRadius ?? DEFAULT_MAX_RADIUS;\n\n // Out-of-contract config is corrected rather than propagated. Left alone, a\n // NaN deadZone defeats the early return below and a maxRadius equal to\n // deadZone divides by zero at `normalizedDist` — either way `state.direction`\n // becomes NaN and, because the state is reused across frames, the stick never\n // recovers. The whole check sits behind one comparison on the healthy path.\n if (!(deadZone >= 0 && maxRadius > deadZone)) {\n if (G.__DEV__ && !_warnedConfig) {\n _warnedConfig = true;\n console.warn(\n `[flare-engine/input] updateJoystick: invalid config (deadZone=${deadZone}, maxRadius=${maxRadius}); ` +\n 'expected 0 <= deadZone < maxRadius. Falling back to defaults for this call.',\n );\n }\n if (!(deadZone >= 0)) deadZone = DEFAULT_DEAD_ZONE;\n if (!(maxRadius > deadZone)) maxRadius = deadZone + DEFAULT_MAX_RADIUS;\n }\n\n const dx = touchX - centerX;\n const dy = touchY - centerY;\n const dist = Math.sqrt(dx * dx + dy * dy);\n\n state.active = true;\n\n // `!(dist >= deadZone)` rather than `dist < deadZone` so a non-finite touch\n // coordinate takes the centred branch instead of falling through to the maths.\n if (!(dist >= deadZone)) {\n state.direction.x = 0;\n state.direction.y = 0;\n state.magnitude = 0;\n // dist is non-finite only when a touch coordinate was, in which case dx/dy\n // are too — report a centred offset rather than writing NaN into the state.\n const centred = dist === 0 || !Number.isFinite(dist);\n state.offset.x = centred ? 0 : dx;\n state.offset.y = centred ? 0 : dy;\n return;\n }\n\n // Clamp to max radius\n const clampedDist = Math.min(dist, maxRadius);\n const normalizedDist = (clampedDist - deadZone) / (maxRadius - deadZone);\n\n // Direction is always the full normalized direction. `dist` is > 0 here —\n // a zero distance cannot pass the guard above once deadZone >= 0 — but the\n // reciprocal is guarded anyway, because `deadZone: 0` makes `dist === 0`\n // reachable and `1 / 0` would put Infinity into direction.\n const invDist = dist > 0 ? 1 / dist : 0;\n state.direction.x = dx * invDist;\n state.direction.y = dy * invDist;\n state.magnitude = Math.min(normalizedDist, 1);\n\n // Offset clamped to max radius\n const scale = dist > 0 ? clampedDist / dist : 0;\n state.offset.x = dx * scale;\n state.offset.y = dy * scale;\n}\n\n/** Reset joystick state when touch is released. */\nexport function releaseJoystick(state: VirtualJoystickState): void {\n state.active = false;\n state.direction.x = 0;\n state.direction.y = 0;\n state.magnitude = 0;\n state.offset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ACpB,MAAM,KAAK,SAAS;CACpB,MAAM,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK,EAAE;CAExC,MAAM,SAAS;CAIf,IAAI,EAAE,QAAQ,WAAW;EACvB,MAAM,UAAU,IAAI;EACpB,MAAM,UAAU,IAAI;EACpB,MAAM,YAAY;EAGlB,MAAM,UAAU,SAAS,KAAK,CAAC,OAAO,SAAS,IAAI;EACnD,MAAM,OAAO,IAAI,UAAU,IAAI;EAC/B,MAAM,OAAO,IAAI,UAAU,IAAI;EAC/B;CACF;CAGA,MAAM,cAAc,KAAK,IAAI,MAAM,SAAS;CAC5C,MAAM,kBAAkB,cAAc,aAAa,YAAY;CAM/D,MAAM,UAAU,OAAO,IAAI,IAAI,OAAO;CACtC,MAAM,UAAU,IAAI,KAAK;CACzB,MAAM,UAAU,IAAI,KAAK;CACzB,MAAM,YAAY,KAAK,IAAI,gBAAgB,CAAC;CAG5C,MAAM,QAAQ,OAAO,IAAI,cAAc,OAAO;CAC9C,MAAM,OAAO,IAAI,KAAK;CACtB,MAAM,OAAO,IAAI,KAAK;AACxB;;AAGA,SAAgB,gBAAgB,OAAmC;CACjE,MAAM,SAAS;CACf,MAAM,UAAU,IAAI;CACpB,MAAM,UAAU,IAAI;CACpB,MAAM,YAAY;CAClB,MAAM,OAAO,IAAI;CACjB,MAAM,OAAO,IAAI;AACnB"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Signal } from "@flare-engine/events";
|
|
2
|
-
|
|
2
|
+
// src/gamepad.ts
|
|
3
3
|
/**
|
|
4
4
|
* Gamepad — poll-based state for a single connected controller.
|
|
5
5
|
*
|
|
@@ -156,8 +156,7 @@ function wasButtonReleased(state, button) {
|
|
|
156
156
|
function getAxis(state, axis) {
|
|
157
157
|
return state.axes[axis] ?? 0;
|
|
158
158
|
}
|
|
159
|
-
|
|
160
|
-
//#region src/gamepad-source.ts
|
|
159
|
+
// src/gamepad-source.ts
|
|
161
160
|
/**
|
|
162
161
|
* Wrap `navigator.getGamepads()` (W3C Gamepad API). If `nav` is not supplied,
|
|
163
162
|
* uses `globalThis.navigator`. Returns an empty array when the API is absent.
|
|
@@ -198,8 +197,7 @@ function webGamepadToSnapshot(p) {
|
|
|
198
197
|
axes
|
|
199
198
|
};
|
|
200
199
|
}
|
|
201
|
-
|
|
202
|
-
//#region src/gestures.ts
|
|
200
|
+
// src/gestures.ts
|
|
203
201
|
const DEFAULT_TAP_MAX_DURATION = .3;
|
|
204
202
|
const DEFAULT_TAP_MAX_DISTANCE = 20;
|
|
205
203
|
const DEFAULT_LONG_PRESS_MIN_DURATION = .5;
|
|
@@ -340,8 +338,7 @@ var GestureDetector = class {
|
|
|
340
338
|
this._pinchStartDistance = 0;
|
|
341
339
|
}
|
|
342
340
|
};
|
|
343
|
-
|
|
344
|
-
//#region src/virtual-button.ts
|
|
341
|
+
// src/virtual-button.ts
|
|
345
342
|
/** Create a default button state. */
|
|
346
343
|
function createButtonState() {
|
|
347
344
|
return {
|
|
@@ -369,8 +366,7 @@ function releaseButton(state) {
|
|
|
369
366
|
state.justReleased = true;
|
|
370
367
|
}
|
|
371
368
|
}
|
|
372
|
-
|
|
373
|
-
//#region src/keyboard.ts
|
|
369
|
+
// src/keyboard.ts
|
|
374
370
|
/** Create a fresh keyboard state. */
|
|
375
371
|
function createKeyboard() {
|
|
376
372
|
const states = [];
|
|
@@ -472,8 +468,7 @@ function wasActionReleased(kb, bindings, action) {
|
|
|
472
468
|
}
|
|
473
469
|
return anyReleased;
|
|
474
470
|
}
|
|
475
|
-
|
|
476
|
-
//#region src/pointer.ts
|
|
471
|
+
// src/pointer.ts
|
|
477
472
|
/** Create a default pointer state. */
|
|
478
473
|
function createPointer() {
|
|
479
474
|
return {
|
|
@@ -526,8 +521,7 @@ function pointerUp(pointer, x, y) {
|
|
|
526
521
|
pointer.position.x = x;
|
|
527
522
|
pointer.position.y = y;
|
|
528
523
|
}
|
|
529
|
-
|
|
530
|
-
//#region src/remap.ts
|
|
524
|
+
// src/remap.ts
|
|
531
525
|
function createIdentityRemap(buttonCount = 17, axisCount = 4) {
|
|
532
526
|
const buttons = new Array(buttonCount);
|
|
533
527
|
for (let i = 0; i < buttonCount; i++) buttons[i] = i;
|
|
@@ -560,7 +554,8 @@ function applyRemap(snapshot, table) {
|
|
|
560
554
|
invert: false,
|
|
561
555
|
scale: 1
|
|
562
556
|
};
|
|
563
|
-
|
|
557
|
+
const raw = snapshot.axes[map.index] ?? 0;
|
|
558
|
+
axes[logical] = raw * map.scale * (map.invert ? -1 : 1);
|
|
564
559
|
}
|
|
565
560
|
return {
|
|
566
561
|
id: snapshot.id,
|
|
@@ -598,8 +593,7 @@ function isRemapTable(value) {
|
|
|
598
593
|
}
|
|
599
594
|
return true;
|
|
600
595
|
}
|
|
601
|
-
|
|
602
|
-
//#region src/input-manager.ts
|
|
596
|
+
// src/input-manager.ts
|
|
603
597
|
/**
|
|
604
598
|
* InputManager provides a polling-based input model.
|
|
605
599
|
*
|
|
@@ -712,8 +706,7 @@ var InputManager = class {
|
|
|
712
706
|
if (idx !== -1) this.touches.splice(idx, 1);
|
|
713
707
|
}
|
|
714
708
|
};
|
|
715
|
-
|
|
716
|
-
//#region src/virtual-joystick.ts
|
|
709
|
+
// src/virtual-joystick.ts
|
|
717
710
|
/**
|
|
718
711
|
* Dev-flag access for the config guard in `updateJoystick`, which runs once per
|
|
719
712
|
* frame while a stick is held. Read as a `globalThis` property, not as a bare
|
|
@@ -794,7 +787,6 @@ function releaseJoystick(state) {
|
|
|
794
787
|
state.offset.x = 0;
|
|
795
788
|
state.offset.y = 0;
|
|
796
789
|
}
|
|
797
|
-
//#endregion
|
|
798
790
|
export { GamepadAxis, GamepadButton, GestureDetector, InputManager, applyRemap, attachKeyboardListeners, createButtonState, createGamepadState, createIdentityRemap, createJoystickState, createKeyboard, createPointer, createWebGamepadSource, getAxis, isActionDown, isButtonDown, loadRemap, pointerDown, pointerMove, pointerUp, pressButton, releaseButton, releaseJoystick, resetButtonFrame, resetGamepadFrame, resetPointerFrame, saveRemap, updateGamepadFromSnapshot, updateJoystick, wasActionPressed, wasActionReleased, wasButtonPressed, wasButtonReleased };
|
|
799
791
|
|
|
800
792
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["G"],"sources":["../src/gamepad.ts","../src/gamepad-source.ts","../src/gestures.ts","../src/virtual-button.ts","../src/keyboard.ts","../src/pointer.ts","../src/remap.ts","../src/input-manager.ts","../src/virtual-joystick.ts"],"sourcesContent":["/**\n * Gamepad — poll-based state for a single connected controller.\n *\n * Buttons and axes are indexed against the W3C \"Standard Gamepad\" mapping by\n * default. Callers can translate raw indices via `remap.ts` before feeding\n * snapshots into `updateGamepadFromSnapshot`.\n */\n\n/**\n * Dev-flag access for the dead-zone guard, which runs per axis per frame. Read\n * as a `globalThis` property rather than a bare `__DEV__` identifier for the\n * reason measured in PERF-10 (~0.46 ns vs ~270 ns on JSC).\n */\nconst G = globalThis as { __DEV__?: boolean };\n\n/** Warn at most once per process; a bad dead zone repeats every frame. */\nlet _warnedDeadZone = false;\n\n/** Largest dead zone that still leaves the rescale well-defined. */\nconst MAX_DEAD_ZONE = 0.99;\n\n/** W3C Standard Gamepad button indices. */\nexport const GamepadButton = {\n A: 0,\n B: 1,\n X: 2,\n Y: 3,\n LB: 4,\n RB: 5,\n LT: 6,\n RT: 7,\n Back: 8,\n Start: 9,\n LS: 10,\n RS: 11,\n DpadUp: 12,\n DpadDown: 13,\n DpadLeft: 14,\n DpadRight: 15,\n Home: 16,\n} as const;\nexport type GamepadButtonId = (typeof GamepadButton)[keyof typeof GamepadButton];\n\n/** W3C Standard Gamepad axes. */\nexport const GamepadAxis = {\n LeftX: 0,\n LeftY: 1,\n RightX: 2,\n RightY: 3,\n} as const;\nexport type GamepadAxisId = (typeof GamepadAxis)[keyof typeof GamepadAxis];\n\nexport interface GamepadButtonState {\n pressed: boolean;\n value: number;\n /** True for exactly one frame after a press. */\n justPressed: boolean;\n /** True for exactly one frame after a release. */\n justReleased: boolean;\n}\n\nexport interface GamepadState {\n connected: boolean;\n id: string;\n index: number;\n buttons: GamepadButtonState[];\n axes: number[];\n /** Monotonically increasing timestamp from the source (ms). */\n timestamp: number;\n}\n\n/** Raw snapshot from a `GamepadSource` — values only, no derived state. */\nexport interface GamepadSnapshot {\n id: string;\n index: number;\n buttons: { pressed: boolean; value: number }[];\n axes: number[];\n timestamp: number;\n}\n\nexport function createGamepadState(index = 0, buttonCount = 17, axisCount = 4): GamepadState {\n const buttons: GamepadButtonState[] = new Array(buttonCount);\n for (let i = 0; i < buttonCount; i++) {\n buttons[i] = { pressed: false, value: 0, justPressed: false, justReleased: false };\n }\n const axes = new Array<number>(axisCount).fill(0);\n return { connected: false, id: '', index, buttons, axes, timestamp: 0 };\n}\n\nfunction applyDeadZone(value: number, deadZone: number): number {\n // The documented contract is [0, 1). At exactly 1 the rescale below divides by\n // zero and returns ±Infinity for any out-of-range axis, which then propagates\n // into every consumer reading the stick. Correct rather than propagate.\n let dz = deadZone;\n if (!(dz >= 0 && dz < 1)) {\n if (G.__DEV__ && !_warnedDeadZone) {\n _warnedDeadZone = true;\n console.warn(\n `[flare-engine/input] deadZone=${deadZone} is outside [0, 1); clamping. ` +\n 'Values at or above 1 would suppress the axis entirely.',\n );\n }\n dz = dz >= 1 ? MAX_DEAD_ZONE : 0;\n }\n const abs = Math.abs(value);\n // `!(abs > dz)` rather than `abs <= dz` so a non-finite axis returns 0 instead\n // of falling through to produce NaN.\n if (!(abs > dz)) return 0;\n const sign = value < 0 ? -1 : 1;\n // Rescale [deadZone, 1] -> [0, 1] so inputs remain smooth past the dead zone.\n return sign * ((abs - dz) / (1 - dz));\n}\n\n/**\n * Apply a fresh snapshot to an existing `GamepadState` in place. Derived\n * `justPressed` / `justReleased` flags are recomputed from the\n * previous `pressed` value.\n *\n * `deadZone` in [0, 1). Values at or below are treated as 0.\n */\nexport function updateGamepadFromSnapshot(\n state: GamepadState,\n snapshot: GamepadSnapshot | null,\n deadZone = 0,\n): void {\n if (snapshot === null) {\n if (!state.connected && !anyButtonDown(state)) {\n clearFrameFlags(state);\n return;\n }\n // Disconnect: clear edge flags, keep sticky pressed=false for released-edge.\n for (let i = 0; i < state.buttons.length; i++) {\n const b = state.buttons[i];\n if (!b) continue;\n b.justPressed = false;\n b.justReleased = b.pressed;\n b.pressed = false;\n b.value = 0;\n }\n for (let i = 0; i < state.axes.length; i++) state.axes[i] = 0;\n state.connected = false;\n state.id = '';\n return;\n }\n\n state.connected = true;\n state.id = snapshot.id;\n state.index = snapshot.index;\n state.timestamp = snapshot.timestamp;\n\n const srcButtons = snapshot.buttons;\n const bLen = Math.min(state.buttons.length, srcButtons.length);\n for (let i = 0; i < bLen; i++) {\n const prev = state.buttons[i];\n const src = srcButtons[i];\n if (!prev || !src) continue;\n const wasDown = prev.pressed;\n prev.pressed = src.pressed;\n prev.value = src.value;\n prev.justPressed = src.pressed && !wasDown;\n prev.justReleased = !src.pressed && wasDown;\n }\n // Buttons beyond the snapshot length: clear edges, keep prior pressed false.\n for (let i = bLen; i < state.buttons.length; i++) {\n const b = state.buttons[i];\n if (!b) continue;\n b.justPressed = false;\n b.justReleased = b.pressed;\n b.pressed = false;\n b.value = 0;\n }\n\n const aLen = Math.min(state.axes.length, snapshot.axes.length);\n for (let i = 0; i < aLen; i++) {\n state.axes[i] = applyDeadZone(snapshot.axes[i] ?? 0, deadZone);\n }\n for (let i = aLen; i < state.axes.length; i++) state.axes[i] = 0;\n}\n\n/** Reset just the per-frame edge flags. Call when advancing a frame without a fresh snapshot. */\nexport function resetGamepadFrame(state: GamepadState): void {\n clearFrameFlags(state);\n}\n\nfunction clearFrameFlags(state: GamepadState): void {\n for (let i = 0; i < state.buttons.length; i++) {\n const b = state.buttons[i];\n if (!b) continue;\n b.justPressed = false;\n b.justReleased = false;\n }\n}\n\nfunction anyButtonDown(state: GamepadState): boolean {\n for (let i = 0; i < state.buttons.length; i++) {\n if (state.buttons[i]?.pressed) return true;\n }\n return false;\n}\n\nexport function isButtonDown(state: GamepadState, button: number): boolean {\n return state.buttons[button]?.pressed ?? false;\n}\n\nexport function wasButtonPressed(state: GamepadState, button: number): boolean {\n return state.buttons[button]?.justPressed ?? false;\n}\n\nexport function wasButtonReleased(state: GamepadState, button: number): boolean {\n return state.buttons[button]?.justReleased ?? false;\n}\n\nexport function getAxis(state: GamepadState, axis: number): number {\n return state.axes[axis] ?? 0;\n}\n","import type { GamepadSnapshot } from './gamepad.js';\n\n/**\n * Platform abstraction for sampling connected gamepads.\n *\n * `poll()` returns one snapshot per slot (typically up to 4). Unconnected\n * slots return `null`. Implementations:\n *\n * - `createWebGamepadSource()` wraps the W3C `navigator.getGamepads` API.\n * - Native implementations (e.g., `react-native-gamepad`) inject their own\n * via the `GamepadSource` interface — the package itself ships no native deps.\n *\n * **Freshness contract:** each call returns fresh objects. An implementation\n * must not reuse or mutate a snapshot (or its `buttons`/`axes` arrays) that a\n * previous `poll()` call returned. A caller may therefore retain a returned\n * snapshot across frames without it changing out from under them.\n */\nexport interface GamepadSource {\n poll(): (GamepadSnapshot | null)[];\n}\n\ninterface NavigatorLike {\n getGamepads?: () => (WebGamepad | null)[];\n}\n\ninterface WebGamepad {\n id: string;\n index: number;\n connected: boolean;\n timestamp: number;\n buttons: readonly { pressed: boolean; value: number }[];\n axes: readonly number[];\n}\n\n/**\n * Wrap `navigator.getGamepads()` (W3C Gamepad API). If `nav` is not supplied,\n * uses `globalThis.navigator`. Returns an empty array when the API is absent.\n */\nexport function createWebGamepadSource(nav?: NavigatorLike): GamepadSource {\n const source: NavigatorLike | undefined =\n nav ??\n (typeof globalThis === 'undefined'\n ? undefined\n : (globalThis as { navigator?: NavigatorLike }).navigator);\n\n return {\n poll(): (GamepadSnapshot | null)[] {\n if (!source?.getGamepads) return [];\n const pads = source.getGamepads();\n const out: (GamepadSnapshot | null)[] = new Array(pads.length);\n for (let i = 0; i < pads.length; i++) {\n const p = pads[i];\n if (!p?.connected) {\n out[i] = null;\n continue;\n }\n out[i] = webGamepadToSnapshot(p);\n }\n return out;\n },\n };\n}\n\nfunction webGamepadToSnapshot(p: WebGamepad): GamepadSnapshot {\n const buttons = new Array<{ pressed: boolean; value: number }>(p.buttons.length);\n for (let i = 0; i < p.buttons.length; i++) {\n const b = p.buttons[i];\n buttons[i] = { pressed: b?.pressed ?? false, value: b?.value ?? 0 };\n }\n const axes = new Array<number>(p.axes.length);\n for (let i = 0; i < p.axes.length; i++) axes[i] = p.axes[i] ?? 0;\n return { id: p.id, index: p.index, timestamp: p.timestamp, buttons, axes };\n}\n","import { Signal } from '@flare-engine/events';\nimport type { Vec2 } from '@flare-engine/math';\n\n/** Swipe direction. */\nexport type SwipeDirection = 'left' | 'right' | 'up' | 'down';\n\n/** Gesture detection configuration. */\nexport interface GestureConfig {\n /** Max time (seconds) for a tap (default 0.3). */\n tapMaxDuration?: number;\n /** Max distance (px) for a tap (default 20). */\n tapMaxDistance?: number;\n /** Min time (seconds) for a long press (default 0.5). */\n longPressMinDuration?: number;\n /** Min distance (px) for a swipe (default 50). */\n swipeMinDistance?: number;\n /** Max time (seconds) for a swipe (default 0.4). */\n swipeMaxDuration?: number;\n}\n\n/** Swipe event data. */\nexport interface SwipeEvent {\n direction: SwipeDirection;\n distance: number;\n duration: number;\n}\n\n/** Pinch event data. */\nexport interface PinchEvent {\n /** Scale factor (>1 = spread, <1 = pinch). */\n scale: number;\n /** Center point between the two touches. */\n center: Vec2;\n}\n\nconst DEFAULT_TAP_MAX_DURATION = 0.3;\nconst DEFAULT_TAP_MAX_DISTANCE = 20;\nconst DEFAULT_LONG_PRESS_MIN_DURATION = 0.5;\nconst DEFAULT_SWIPE_MIN_DISTANCE = 50;\nconst DEFAULT_SWIPE_MAX_DURATION = 0.4;\n\n/**\n * GestureDetector recognizes tap, long press, swipe, and pinch gestures\n * from raw pointer events.\n */\nexport class GestureDetector {\n readonly onTap = new Signal<Vec2>();\n readonly onLongPress = new Signal<Vec2>();\n readonly onSwipe = new Signal<SwipeEvent>();\n readonly onPinch = new Signal<PinchEvent>();\n\n private tapMaxDuration: number;\n private tapMaxDistance: number;\n private longPressMinDuration: number;\n private swipeMinDistance: number;\n private swipeMaxDuration: number;\n\n // Single-touch tracking\n private _startPos: Vec2 = { x: 0, y: 0 };\n /** Elapsed time (seconds) since `pointerDown` for the in-progress press. */\n private _elapsed = 0;\n private _isTracking = false;\n private _longPressFired = false;\n\n // Pinch tracking\n private _pinchStartDistance = 0;\n private _pinchTouches: [Vec2, Vec2] | null = null;\n\n constructor(config?: GestureConfig) {\n this.tapMaxDuration = config?.tapMaxDuration ?? DEFAULT_TAP_MAX_DURATION;\n this.tapMaxDistance = config?.tapMaxDistance ?? DEFAULT_TAP_MAX_DISTANCE;\n this.longPressMinDuration = config?.longPressMinDuration ?? DEFAULT_LONG_PRESS_MIN_DURATION;\n this.swipeMinDistance = config?.swipeMinDistance ?? DEFAULT_SWIPE_MIN_DISTANCE;\n this.swipeMaxDuration = config?.swipeMaxDuration ?? DEFAULT_SWIPE_MAX_DURATION;\n }\n\n /** Feed a pointer-down event. */\n pointerDown(x: number, y: number): void {\n this._startPos = { x, y };\n this._elapsed = 0;\n this._isTracking = true;\n this._longPressFired = false;\n }\n\n /**\n * Feed a pointer-up event.\n *\n * `elapsedSinceDown` is optional: pass it when the host tracks its own\n * timestamps (e.g. event-driven, no per-frame `update()` calls); omit it\n * to use the elapsed time already accumulated via `update(dt, ...)`. Either\n * way there is one clock per press — passing it here re-syncs the same\n * accumulator `update()` advances, rather than racing it. If a long press\n * already fired for this press, tap/swipe are suppressed so one press\n * yields exactly one gesture.\n */\n pointerUp(x: number, y: number, elapsedSinceDown?: number): void {\n if (!this._isTracking) return;\n this._isTracking = false;\n if (elapsedSinceDown !== undefined) this._elapsed = elapsedSinceDown;\n if (this._longPressFired) return;\n\n const dx = x - this._startPos.x;\n const dy = y - this._startPos.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n const duration = this._elapsed;\n\n // Check swipe first (requires min distance)\n if (dist >= this.swipeMinDistance && duration <= this.swipeMaxDuration) {\n const absDx = Math.abs(dx);\n const absDy = Math.abs(dy);\n let direction: SwipeDirection;\n if (absDx > absDy) {\n direction = dx > 0 ? 'right' : 'left';\n } else {\n direction = dy > 0 ? 'down' : 'up';\n }\n this.onSwipe.emit({ direction, distance: dist, duration });\n return;\n }\n\n // Check tap (short press, small movement)\n if (dist <= this.tapMaxDistance && duration <= this.tapMaxDuration) {\n this.onTap.emit({ x, y });\n return;\n }\n }\n\n /**\n * Update gesture tracking. Call each frame with dt.\n * @param dt Delta time in seconds.\n * @param currentX Current pointer X.\n * @param currentY Current pointer Y.\n */\n update(dt: number, currentX: number, currentY: number): void {\n if (!this._isTracking) return;\n this._elapsed += dt;\n\n // Long press detection\n if (!this._longPressFired && this._elapsed >= this.longPressMinDuration) {\n const dx = currentX - this._startPos.x;\n const dy = currentY - this._startPos.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n if (dist <= this.tapMaxDistance) {\n this._longPressFired = true;\n this.onLongPress.emit({ x: currentX, y: currentY });\n }\n }\n }\n\n /**\n * Feed a two-finger pinch update. Call when two touches are active.\n * @param t1 First touch position.\n * @param t2 Second touch position.\n */\n pinchUpdate(t1: Vec2, t2: Vec2): void {\n const dx = t2.x - t1.x;\n const dy = t2.y - t1.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n\n if (this._pinchTouches === null) {\n // Start pinch\n this._pinchStartDistance = dist;\n this._pinchTouches = [{ ...t1 }, { ...t2 }];\n return;\n }\n\n if (this._pinchStartDistance > 0) {\n const scale = dist / this._pinchStartDistance;\n const center: Vec2 = {\n x: (t1.x + t2.x) / 2,\n y: (t1.y + t2.y) / 2,\n };\n this.onPinch.emit({ scale, center });\n }\n }\n\n /** Call when pinch ends (fewer than 2 touches). */\n pinchEnd(): void {\n this._pinchTouches = null;\n this._pinchStartDistance = 0;\n }\n}\n","/** Virtual button state — pure data, no UI. */\nexport interface VirtualButtonState {\n /** Whether the button is currently pressed. */\n isPressed: boolean;\n /** Whether the button was just pressed this frame. */\n justPressed: boolean;\n /** Whether the button was just released this frame. */\n justReleased: boolean;\n}\n\n/** Create a default button state. */\nexport function createButtonState(): VirtualButtonState {\n return {\n isPressed: false,\n justPressed: false,\n justReleased: false,\n };\n}\n\n/** Call at the start of each frame to reset per-frame flags. */\nexport function resetButtonFrame(state: VirtualButtonState): void {\n state.justPressed = false;\n state.justReleased = false;\n}\n\n/** Call when the button is pressed. */\nexport function pressButton(state: VirtualButtonState): void {\n if (!state.isPressed) {\n state.isPressed = true;\n state.justPressed = true;\n }\n}\n\n/** Call when the button is released. */\nexport function releaseButton(state: VirtualButtonState): void {\n if (state.isPressed) {\n state.isPressed = false;\n state.justReleased = true;\n }\n}\n","import {\n createButtonState,\n pressButton,\n releaseButton,\n resetButtonFrame,\n type VirtualButtonState,\n} from './virtual-button.js';\n\n/** Minimal keyboard event shape — no DOM type dep. */\nexport interface KeyboardEventLike {\n readonly code: string;\n readonly type: string;\n /** Optional — real DOM events have it; synthetic feeds may not. */\n preventDefault?(): void;\n}\n\n/** Minimal event target shape for attaching keyboard listeners. */\nexport interface KeyboardEventTargetLike {\n addEventListener(type: string, handler: (ev: KeyboardEventLike) => void): void;\n removeEventListener(type: string, handler: (ev: KeyboardEventLike) => void): void;\n}\n\n/**\n * Buffered per-frame keyboard state.\n *\n * Edge flags (`wasPressed`, `wasReleased`) clear each frame via `reset()`.\n * `keyDown` / `keyUp` are the platform-neutral injection points: web feeds\n * them via `attachKeyboardListeners`; mobile/RN feeds them from a\n * hardware-keyboard native module or an on-screen source.\n */\nexport interface KeyboardState {\n /** True while the key is physically held. */\n isDown(code: string): boolean;\n /** True only on the frame the key was pressed. */\n wasPressed(code: string): boolean;\n /** True only on the frame the key was released. */\n wasReleased(code: string): boolean;\n /** Platform-neutral injection. OS auto-repeat is de-edged by the pressButton guard. */\n keyDown(code: string): void;\n /** Platform-neutral injection. */\n keyUp(code: string): void;\n /** Frame-start edge clear. Zero-alloc. */\n reset(): void;\n /** Blur/stuck-key guard: emits a release edge for every held code, then drops held. */\n clear(): void;\n}\n\n/** Create a fresh keyboard state. */\nexport function createKeyboard(): KeyboardState {\n const states: VirtualButtonState[] = [];\n const codeIndex = new Map<string, number>();\n\n return {\n isDown(code: string): boolean {\n const i = codeIndex.get(code);\n if (i === undefined) return false;\n return states[i]?.isPressed ?? false;\n },\n\n wasPressed(code: string): boolean {\n const i = codeIndex.get(code);\n if (i === undefined) return false;\n return states[i]?.justPressed ?? false;\n },\n\n wasReleased(code: string): boolean {\n const i = codeIndex.get(code);\n if (i === undefined) return false;\n return states[i]?.justReleased ?? false;\n },\n\n keyDown(code: string): void {\n let i = codeIndex.get(code);\n if (i === undefined) {\n i = states.length;\n states.push(createButtonState());\n codeIndex.set(code, i);\n }\n pressButton(states[i]!);\n },\n\n keyUp(code: string): void {\n const i = codeIndex.get(code);\n if (i === undefined) return;\n releaseButton(states[i]!);\n },\n\n reset(): void {\n for (let i = 0; i < states.length; i++) {\n resetButtonFrame(states[i]!);\n }\n },\n\n clear(): void {\n for (let i = 0; i < states.length; i++) {\n releaseButton(states[i]!);\n }\n },\n };\n}\n\n/**\n * Web turnkey adapter: registers `keydown`, `keyup`, and `blur` listeners on\n * `target`. `blur` calls `kb.clear()` (stuck-key guard). Returns a detach fn.\n *\n * `target` is structural `{ addEventListener, removeEventListener }` — no DOM\n * types dep. On web, pass `window`; for mobile/RN, feed `keyDown`/`keyUp`\n * directly from a hardware-keyboard native module or an on-screen source.\n *\n * Does NOT call `preventDefault` — bare use lets Space/arrows scroll and Tab\n * move DOM focus. For game-mode input, attach your own listener that calls\n * `preventDefault` for game keys and forwards `kb.keyDown(ev.code)`.\n */\nexport function attachKeyboardListeners(\n kb: KeyboardState,\n target: KeyboardEventTargetLike,\n): () => void {\n const onKeyDown = (ev: KeyboardEventLike): void => {\n kb.keyDown(ev.code);\n };\n const onKeyUp = (ev: KeyboardEventLike): void => {\n kb.keyUp(ev.code);\n };\n const onBlur = (_ev: KeyboardEventLike): void => {\n kb.clear();\n };\n\n target.addEventListener('keydown', onKeyDown);\n target.addEventListener('keyup', onKeyUp);\n target.addEventListener('blur', onBlur);\n\n return (): void => {\n target.removeEventListener('keydown', onKeyDown);\n target.removeEventListener('keyup', onKeyUp);\n target.removeEventListener('blur', onBlur);\n };\n}\n\n/**\n * Action → code binding map. Keys are action names; values are arrays of\n * `KeyboardEvent.code` strings. Multiple codes OR-reduce (any bound key\n * triggers the action).\n */\nexport type KeyBindings = Readonly<Record<string, readonly string[]>>;\n\n/** True if any bound code for `action` is currently held. */\nexport function isActionDown(kb: KeyboardState, bindings: KeyBindings, action: string): boolean {\n const codes = bindings[action];\n if (!codes) return false;\n for (let i = 0; i < codes.length; i++) {\n if (kb.isDown(codes[i]!)) return true;\n }\n return false;\n}\n\n/** True if any bound code for `action` was pressed this frame. */\nexport function wasActionPressed(\n kb: KeyboardState,\n bindings: KeyBindings,\n action: string,\n): boolean {\n const codes = bindings[action];\n if (!codes) return false;\n for (let i = 0; i < codes.length; i++) {\n if (kb.wasPressed(codes[i]!)) return true;\n }\n return false;\n}\n\n/**\n * True if any bound code for `action` was released this frame AND no bound\n * code is still held. Release fires only when the last held bound key lifts.\n */\nexport function wasActionReleased(\n kb: KeyboardState,\n bindings: KeyBindings,\n action: string,\n): boolean {\n const codes = bindings[action];\n if (!codes) return false;\n let anyReleased = false;\n for (let i = 0; i < codes.length; i++) {\n if (kb.isDown(codes[i]!)) return false;\n if (kb.wasReleased(codes[i]!)) anyReleased = true;\n }\n return anyReleased;\n}\n","import type { Vec2 } from '@flare-engine/math';\n\n/** State of a single pointer (primary touch or mouse). */\nexport interface Pointer {\n /** Current position in screen coordinates. */\n position: Vec2;\n /** Position delta since last frame. */\n delta: Vec2;\n /** Whether the pointer is currently held down. */\n isDown: boolean;\n /** True only on the frame the pointer was pressed. */\n justPressed: boolean;\n /** True only on the frame the pointer was released. */\n justReleased: boolean;\n}\n\n/** State of a single touch point in a multitouch scenario. */\nexport interface TouchPoint {\n /** Unique touch identifier. */\n id: number;\n /** Current position in screen coordinates. */\n position: Vec2;\n /** Whether this touch is currently active. */\n isDown: boolean;\n}\n\n/** Create a default pointer state. */\nexport function createPointer(): Pointer {\n return {\n position: { x: 0, y: 0 },\n delta: { x: 0, y: 0 },\n isDown: false,\n justPressed: false,\n justReleased: false,\n };\n}\n\n/**\n * Update pointer state for a new frame.\n * Call this at the start of each frame to clear per-frame flags.\n */\nexport function resetPointerFrame(pointer: Pointer): void {\n pointer.delta.x = 0;\n pointer.delta.y = 0;\n pointer.justPressed = false;\n pointer.justReleased = false;\n}\n\n/** Feed a pointer-down event into the pointer state. */\nexport function pointerDown(pointer: Pointer, x: number, y: number): void {\n const wasDown = pointer.isDown;\n pointer.isDown = true;\n if (!wasDown) {\n pointer.justPressed = true;\n }\n pointer.delta.x += x - pointer.position.x;\n pointer.delta.y += y - pointer.position.y;\n pointer.position.x = x;\n pointer.position.y = y;\n}\n\n/** Feed a pointer-move event into the pointer state. */\nexport function pointerMove(pointer: Pointer, x: number, y: number): void {\n pointer.delta.x += x - pointer.position.x;\n pointer.delta.y += y - pointer.position.y;\n pointer.position.x = x;\n pointer.position.y = y;\n}\n\n/** Feed a pointer-up event into the pointer state. */\nexport function pointerUp(pointer: Pointer, x: number, y: number): void {\n pointer.isDown = false;\n pointer.justReleased = true;\n pointer.delta.x += x - pointer.position.x;\n pointer.delta.y += y - pointer.position.y;\n pointer.position.x = x;\n pointer.position.y = y;\n}\n","import type { GamepadSnapshot } from './gamepad.js';\n\n/**\n * Button / axis remap table.\n *\n * `buttons[logicalId] = physicalIndex` — to poll A, read\n * `snapshot.buttons[table.buttons[GamepadButton.A]]`.\n *\n * `axes` maps logical axis id → `{ index, invert, scale }`. Most games invert\n * Y on some controllers; `scale` supports half-range triggers.\n */\nexport interface AxisMap {\n index: number;\n invert: boolean;\n scale: number;\n}\n\nexport interface RemapTable {\n buttons: number[];\n axes: AxisMap[];\n}\n\nexport function createIdentityRemap(buttonCount = 17, axisCount = 4): RemapTable {\n const buttons = new Array<number>(buttonCount);\n for (let i = 0; i < buttonCount; i++) buttons[i] = i;\n const axes = new Array<AxisMap>(axisCount);\n for (let i = 0; i < axisCount; i++) axes[i] = { index: i, invert: false, scale: 1 };\n return { buttons, axes };\n}\n\n/** Apply a remap table to a raw snapshot, returning a new snapshot with logical ordering. */\nexport function applyRemap(snapshot: GamepadSnapshot, table: RemapTable): GamepadSnapshot {\n const buttons = new Array<{ pressed: boolean; value: number }>(table.buttons.length);\n for (let logical = 0; logical < table.buttons.length; logical++) {\n const physical = table.buttons[logical] ?? logical;\n const src = snapshot.buttons[physical];\n buttons[logical] = { pressed: src?.pressed ?? false, value: src?.value ?? 0 };\n }\n const axes = new Array<number>(table.axes.length);\n for (let logical = 0; logical < table.axes.length; logical++) {\n const map = table.axes[logical] ?? { index: logical, invert: false, scale: 1 };\n const raw = snapshot.axes[map.index] ?? 0;\n axes[logical] = raw * map.scale * (map.invert ? -1 : 1);\n }\n return { id: snapshot.id, index: snapshot.index, timestamp: snapshot.timestamp, buttons, axes };\n}\n\n/**\n * Minimal storage contract — matches `@flare-engine/storage` `StorageAdapter`,\n * but declared locally so this package does not take a hard dep on storage.\n */\nexport interface RemapStore {\n get(key: string): Promise<string | null>;\n set(key: string, value: string): Promise<void>;\n}\n\n/** Persist a remap table under the given key. Throws on invalid table shape. */\nexport async function saveRemap(store: RemapStore, key: string, table: RemapTable): Promise<void> {\n await store.set(key, JSON.stringify(table));\n}\n\n/** Load a remap table. Returns `null` if absent or malformed. */\nexport async function loadRemap(store: RemapStore, key: string): Promise<RemapTable | null> {\n const raw = await store.get(key);\n if (raw === null) return null;\n try {\n const parsed = JSON.parse(raw) as unknown;\n if (!isRemapTable(parsed)) return null;\n return parsed;\n } catch {\n return null;\n }\n}\n\nfunction isRemapTable(value: unknown): value is RemapTable {\n if (typeof value !== 'object' || value === null) return false;\n const obj = value as { buttons?: unknown; axes?: unknown };\n if (!Array.isArray(obj.buttons) || !Array.isArray(obj.axes)) return false;\n for (const b of obj.buttons) if (typeof b !== 'number') return false;\n for (const a of obj.axes) {\n if (typeof a !== 'object' || a === null) return false;\n const ax = a as { index?: unknown; invert?: unknown; scale?: unknown };\n if (\n typeof ax.index !== 'number' ||\n typeof ax.invert !== 'boolean' ||\n typeof ax.scale !== 'number'\n ) {\n return false;\n }\n }\n return true;\n}\n","import {\n createGamepadState,\n type GamepadState,\n resetGamepadFrame,\n updateGamepadFromSnapshot,\n} from './gamepad.js';\nimport type { GamepadSource } from './gamepad-source.js';\nimport { createKeyboard, type KeyboardState } from './keyboard.js';\nimport {\n createPointer,\n type Pointer,\n pointerDown,\n pointerMove,\n pointerUp,\n resetPointerFrame,\n type TouchPoint,\n} from './pointer.js';\nimport type { RemapTable } from './remap.js';\nimport { applyRemap } from './remap.js';\n\n/**\n * InputManager provides a polling-based input model.\n *\n * Call `update()` once per frame (before game logic) to snapshot input state.\n * Feed events from the platform (RN touch/gesture handlers) via the on* methods.\n */\nexport class InputManager {\n /**\n * Primary pointer — the touch that started the current gesture (first\n * `onPointerDown` while no touch was active), or the mouse.\n *\n * Once assigned, the primary id stays fixed to that touch until it lifts;\n * it does NOT transfer to a remaining finger. While a second finger is\n * down, its events reach only `touches` — `pointer` neither moves nor\n * releases because of it. When the primary lifts, `pointer.isDown` goes\n * false even if other fingers remain down, and a new primary is assigned\n * only once every touch has lifted and a fresh `onPointerDown` arrives.\n * This keeps `pointer` a single continuous stream with no mid-gesture\n * teleport; read `touches` for anything beyond one finger.\n */\n readonly pointer: Pointer = createPointer();\n\n /** Buffered keyboard state. Feed via `attachKeyboardListeners` (web) or `keyboard.keyDown`/`keyUp` (mobile/RN). */\n readonly keyboard: KeyboardState = createKeyboard();\n\n /** All active touch points. */\n readonly touches: TouchPoint[] = [];\n\n private _touchMap = new Map<number, TouchPoint>();\n private _primaryTouchId: number | null = null;\n private _gamepads: GamepadState[] = [];\n private _gamepadDeadZone = 0.15;\n private _gamepadRemaps = new Map<number, RemapTable>();\n\n /** Call once per frame to reset per-frame flags. */\n update(): void {\n resetPointerFrame(this.pointer);\n this.keyboard.reset();\n for (let i = 0; i < this._gamepads.length; i++) {\n const pad = this._gamepads[i];\n if (pad) resetGamepadFrame(pad);\n }\n }\n\n /** Feed a touch/pointer begin event. */\n onPointerDown(id: number, x: number, y: number): void {\n if (this._touchMap.size === 0) {\n this._primaryTouchId = id;\n }\n if (id === this._primaryTouchId) {\n pointerDown(this.pointer, x, y);\n }\n this._addOrUpdateTouch(id, x, y, true);\n }\n\n /** Feed a touch/pointer move event. */\n onPointerMove(id: number, x: number, y: number): void {\n if (id === this._primaryTouchId) {\n pointerMove(this.pointer, x, y);\n }\n this._addOrUpdateTouch(id, x, y, true);\n }\n\n /** Feed a touch/pointer end event. */\n onPointerUp(id: number, x: number, y: number): void {\n if (id === this._primaryTouchId) {\n pointerUp(this.pointer, x, y);\n this._primaryTouchId = null;\n }\n this._removeTouch(id);\n }\n\n /** Access the gamepad state at `index`. Allocates on first access. */\n gamepad(index: number): GamepadState {\n let pad = this._gamepads[index];\n if (!pad) {\n pad = createGamepadState(index);\n this._gamepads[index] = pad;\n }\n return pad;\n }\n\n /** Dead zone in [0, 1). Axes at or below this magnitude read as 0. */\n setGamepadDeadZone(deadZone: number): void {\n this._gamepadDeadZone = Math.max(0, Math.min(0.95, deadZone));\n }\n\n /** Install a remap table for a specific gamepad index. Pass `null` to clear. */\n setGamepadRemap(index: number, table: RemapTable | null): void {\n if (table === null) this._gamepadRemaps.delete(index);\n else this._gamepadRemaps.set(index, table);\n }\n\n /** Poll all gamepads from the given source, applying remap + dead zones. */\n pollGamepads(source: GamepadSource): void {\n const snapshots = source.poll();\n for (let i = 0; i < snapshots.length; i++) {\n const pad = this.gamepad(i);\n const snap = snapshots[i] ?? null;\n const remapped =\n snap !== null\n ? this._gamepadRemaps.get(i)\n ? applyRemap(snap, this._gamepadRemaps.get(i) as RemapTable)\n : snap\n : null;\n updateGamepadFromSnapshot(pad, remapped, this._gamepadDeadZone);\n }\n }\n\n private _addOrUpdateTouch(id: number, x: number, y: number, isDown: boolean): void {\n let touch = this._touchMap.get(id);\n if (!touch) {\n touch = { id, position: { x, y }, isDown };\n this._touchMap.set(id, touch);\n this.touches.push(touch);\n } else {\n touch.position.x = x;\n touch.position.y = y;\n touch.isDown = isDown;\n }\n }\n\n private _removeTouch(id: number): void {\n const touch = this._touchMap.get(id);\n if (!touch) return;\n this._touchMap.delete(id);\n const idx = this.touches.indexOf(touch);\n if (idx !== -1) {\n this.touches.splice(idx, 1);\n }\n }\n}\n","import type { Vec2 } from '@flare-engine/math';\n\n/**\n * Dev-flag access for the config guard in `updateJoystick`, which runs once per\n * frame while a stick is held. Read as a `globalThis` property, not as a bare\n * `__DEV__` identifier: on JSC an unresolvable global costs ~270 ns per\n * evaluation where a property miss is inline-cached at ~0.46 ns. Same reasoning\n * as `@flare-engine/core`'s `Pool` — see PERF-10.\n */\nconst G = globalThis as { __DEV__?: boolean };\n\n/** Warn at most once per process; a bad config repeats every frame. */\nlet _warnedConfig = false;\n\n/** Virtual joystick configuration. */\nexport interface VirtualJoystickConfig {\n /** Dead zone radius in pixels (default 10). */\n deadZone?: number;\n /** Maximum radius in pixels (default 50). */\n maxRadius?: number;\n}\n\n/** Virtual joystick state — pure data, no UI. */\nexport interface VirtualJoystickState {\n /** Whether the joystick is currently being touched. */\n active: boolean;\n /** Normalized direction vector (-1 to 1 per axis). */\n direction: Vec2;\n /** Magnitude 0-1 (0 = center/dead zone, 1 = max radius). */\n magnitude: number;\n /** Raw offset from center in pixels. */\n offset: Vec2;\n}\n\nconst DEFAULT_DEAD_ZONE = 10;\nconst DEFAULT_MAX_RADIUS = 50;\n\n/** Create a default joystick state. */\nexport function createJoystickState(): VirtualJoystickState {\n return {\n active: false,\n direction: { x: 0, y: 0 },\n magnitude: 0,\n offset: { x: 0, y: 0 },\n };\n}\n\n/**\n * Update joystick state from a touch event.\n *\n * @param state The joystick state to update.\n * @param centerX The joystick center X in screen pixels.\n * @param centerY The joystick center Y in screen pixels.\n * @param touchX The current touch X in screen pixels.\n * @param touchY The current touch Y in screen pixels.\n * @param config Joystick configuration.\n */\nexport function updateJoystick(\n state: VirtualJoystickState,\n centerX: number,\n centerY: number,\n touchX: number,\n touchY: number,\n config?: VirtualJoystickConfig,\n): void {\n let deadZone = config?.deadZone ?? DEFAULT_DEAD_ZONE;\n let maxRadius = config?.maxRadius ?? DEFAULT_MAX_RADIUS;\n\n // Out-of-contract config is corrected rather than propagated. Left alone, a\n // NaN deadZone defeats the early return below and a maxRadius equal to\n // deadZone divides by zero at `normalizedDist` — either way `state.direction`\n // becomes NaN and, because the state is reused across frames, the stick never\n // recovers. The whole check sits behind one comparison on the healthy path.\n if (!(deadZone >= 0 && maxRadius > deadZone)) {\n if (G.__DEV__ && !_warnedConfig) {\n _warnedConfig = true;\n console.warn(\n `[flare-engine/input] updateJoystick: invalid config (deadZone=${deadZone}, maxRadius=${maxRadius}); ` +\n 'expected 0 <= deadZone < maxRadius. Falling back to defaults for this call.',\n );\n }\n if (!(deadZone >= 0)) deadZone = DEFAULT_DEAD_ZONE;\n if (!(maxRadius > deadZone)) maxRadius = deadZone + DEFAULT_MAX_RADIUS;\n }\n\n const dx = touchX - centerX;\n const dy = touchY - centerY;\n const dist = Math.sqrt(dx * dx + dy * dy);\n\n state.active = true;\n\n // `!(dist >= deadZone)` rather than `dist < deadZone` so a non-finite touch\n // coordinate takes the centred branch instead of falling through to the maths.\n if (!(dist >= deadZone)) {\n state.direction.x = 0;\n state.direction.y = 0;\n state.magnitude = 0;\n // dist is non-finite only when a touch coordinate was, in which case dx/dy\n // are too — report a centred offset rather than writing NaN into the state.\n const centred = dist === 0 || !Number.isFinite(dist);\n state.offset.x = centred ? 0 : dx;\n state.offset.y = centred ? 0 : dy;\n return;\n }\n\n // Clamp to max radius\n const clampedDist = Math.min(dist, maxRadius);\n const normalizedDist = (clampedDist - deadZone) / (maxRadius - deadZone);\n\n // Direction is always the full normalized direction. `dist` is > 0 here —\n // a zero distance cannot pass the guard above once deadZone >= 0 — but the\n // reciprocal is guarded anyway, because `deadZone: 0` makes `dist === 0`\n // reachable and `1 / 0` would put Infinity into direction.\n const invDist = dist > 0 ? 1 / dist : 0;\n state.direction.x = dx * invDist;\n state.direction.y = dy * invDist;\n state.magnitude = Math.min(normalizedDist, 1);\n\n // Offset clamped to max radius\n const scale = dist > 0 ? clampedDist / dist : 0;\n state.offset.x = dx * scale;\n state.offset.y = dy * scale;\n}\n\n/** Reset joystick state when touch is released. */\nexport function releaseJoystick(state: VirtualJoystickState): void {\n state.active = false;\n state.direction.x = 0;\n state.direction.y = 0;\n state.magnitude = 0;\n state.offset.x = 0;\n state.offset.y = 0;\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAMA,MAAI;;AAGV,IAAI,kBAAkB;;AAGtB,MAAM,gBAAgB;;AAGtB,MAAa,gBAAgB;CAC3B,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM;CACN,OAAO;CACP,IAAI;CACJ,IAAI;CACJ,QAAQ;CACR,UAAU;CACV,UAAU;CACV,WAAW;CACX,MAAM;AACR;;AAIA,MAAa,cAAc;CACzB,OAAO;CACP,OAAO;CACP,QAAQ;CACR,QAAQ;AACV;AA+BA,SAAgB,mBAAmB,QAAQ,GAAG,cAAc,IAAI,YAAY,GAAiB;CAC3F,MAAM,UAAgC,IAAI,MAAM,WAAW;CAC3D,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,KAC/B,QAAQ,KAAK;EAAE,SAAS;EAAO,OAAO;EAAG,aAAa;EAAO,cAAc;CAAM;CAGnF,OAAO;EAAE,WAAW;EAAO,IAAI;EAAI;EAAO;EAAS,MADtC,IAAI,MAAc,SAAS,CAAC,CAAC,KAAK,CACO;EAAG,WAAW;CAAE;AACxE;A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,IAAI;CACjB,MAAM,OAAO,IAAI;AACnB"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["G"],"sources":["../src/gamepad.ts","../src/gamepad-source.ts","../src/gestures.ts","../src/virtual-button.ts","../src/keyboard.ts","../src/pointer.ts","../src/remap.ts","../src/input-manager.ts","../src/virtual-joystick.ts"],"sourcesContent":["/**\n * Gamepad — poll-based state for a single connected controller.\n *\n * Buttons and axes are indexed against the W3C \"Standard Gamepad\" mapping by\n * default. Callers can translate raw indices via `remap.ts` before feeding\n * snapshots into `updateGamepadFromSnapshot`.\n */\n\n/**\n * Dev-flag access for the dead-zone guard, which runs per axis per frame. Read\n * as a `globalThis` property rather than a bare `__DEV__` identifier for the\n * reason measured in PERF-10 (~0.46 ns vs ~270 ns on JSC).\n */\nconst G = globalThis as { __DEV__?: boolean };\n\n/** Warn at most once per process; a bad dead zone repeats every frame. */\nlet _warnedDeadZone = false;\n\n/** Largest dead zone that still leaves the rescale well-defined. */\nconst MAX_DEAD_ZONE = 0.99;\n\n/** W3C Standard Gamepad button indices. */\nexport const GamepadButton = {\n A: 0,\n B: 1,\n X: 2,\n Y: 3,\n LB: 4,\n RB: 5,\n LT: 6,\n RT: 7,\n Back: 8,\n Start: 9,\n LS: 10,\n RS: 11,\n DpadUp: 12,\n DpadDown: 13,\n DpadLeft: 14,\n DpadRight: 15,\n Home: 16,\n} as const;\nexport type GamepadButtonId = (typeof GamepadButton)[keyof typeof GamepadButton];\n\n/** W3C Standard Gamepad axes. */\nexport const GamepadAxis = {\n LeftX: 0,\n LeftY: 1,\n RightX: 2,\n RightY: 3,\n} as const;\nexport type GamepadAxisId = (typeof GamepadAxis)[keyof typeof GamepadAxis];\n\nexport interface GamepadButtonState {\n pressed: boolean;\n value: number;\n /** True for exactly one frame after a press. */\n justPressed: boolean;\n /** True for exactly one frame after a release. */\n justReleased: boolean;\n}\n\nexport interface GamepadState {\n connected: boolean;\n id: string;\n index: number;\n buttons: GamepadButtonState[];\n axes: number[];\n /** Monotonically increasing timestamp from the source (ms). */\n timestamp: number;\n}\n\n/** Raw snapshot from a `GamepadSource` — values only, no derived state. */\nexport interface GamepadSnapshot {\n id: string;\n index: number;\n buttons: { pressed: boolean; value: number }[];\n axes: number[];\n timestamp: number;\n}\n\nexport function createGamepadState(index = 0, buttonCount = 17, axisCount = 4): GamepadState {\n const buttons: GamepadButtonState[] = new Array(buttonCount);\n for (let i = 0; i < buttonCount; i++) {\n buttons[i] = { pressed: false, value: 0, justPressed: false, justReleased: false };\n }\n const axes = new Array<number>(axisCount).fill(0);\n return { connected: false, id: '', index, buttons, axes, timestamp: 0 };\n}\n\nfunction applyDeadZone(value: number, deadZone: number): number {\n // The documented contract is [0, 1). At exactly 1 the rescale below divides by\n // zero and returns ±Infinity for any out-of-range axis, which then propagates\n // into every consumer reading the stick. Correct rather than propagate.\n let dz = deadZone;\n if (!(dz >= 0 && dz < 1)) {\n if (G.__DEV__ && !_warnedDeadZone) {\n _warnedDeadZone = true;\n console.warn(\n `[flare-engine/input] deadZone=${deadZone} is outside [0, 1); clamping. ` +\n 'Values at or above 1 would suppress the axis entirely.',\n );\n }\n dz = dz >= 1 ? MAX_DEAD_ZONE : 0;\n }\n const abs = Math.abs(value);\n // `!(abs > dz)` rather than `abs <= dz` so a non-finite axis returns 0 instead\n // of falling through to produce NaN.\n if (!(abs > dz)) return 0;\n const sign = value < 0 ? -1 : 1;\n // Rescale [deadZone, 1] -> [0, 1] so inputs remain smooth past the dead zone.\n return sign * ((abs - dz) / (1 - dz));\n}\n\n/**\n * Apply a fresh snapshot to an existing `GamepadState` in place. Derived\n * `justPressed` / `justReleased` flags are recomputed from the\n * previous `pressed` value.\n *\n * `deadZone` in [0, 1). Values at or below are treated as 0.\n */\nexport function updateGamepadFromSnapshot(\n state: GamepadState,\n snapshot: GamepadSnapshot | null,\n deadZone = 0,\n): void {\n if (snapshot === null) {\n if (!state.connected && !anyButtonDown(state)) {\n clearFrameFlags(state);\n return;\n }\n // Disconnect: clear edge flags, keep sticky pressed=false for released-edge.\n for (let i = 0; i < state.buttons.length; i++) {\n const b = state.buttons[i];\n if (!b) continue;\n b.justPressed = false;\n b.justReleased = b.pressed;\n b.pressed = false;\n b.value = 0;\n }\n for (let i = 0; i < state.axes.length; i++) state.axes[i] = 0;\n state.connected = false;\n state.id = '';\n return;\n }\n\n state.connected = true;\n state.id = snapshot.id;\n state.index = snapshot.index;\n state.timestamp = snapshot.timestamp;\n\n const srcButtons = snapshot.buttons;\n const bLen = Math.min(state.buttons.length, srcButtons.length);\n for (let i = 0; i < bLen; i++) {\n const prev = state.buttons[i];\n const src = srcButtons[i];\n if (!prev || !src) continue;\n const wasDown = prev.pressed;\n prev.pressed = src.pressed;\n prev.value = src.value;\n prev.justPressed = src.pressed && !wasDown;\n prev.justReleased = !src.pressed && wasDown;\n }\n // Buttons beyond the snapshot length: clear edges, keep prior pressed false.\n for (let i = bLen; i < state.buttons.length; i++) {\n const b = state.buttons[i];\n if (!b) continue;\n b.justPressed = false;\n b.justReleased = b.pressed;\n b.pressed = false;\n b.value = 0;\n }\n\n const aLen = Math.min(state.axes.length, snapshot.axes.length);\n for (let i = 0; i < aLen; i++) {\n state.axes[i] = applyDeadZone(snapshot.axes[i] ?? 0, deadZone);\n }\n for (let i = aLen; i < state.axes.length; i++) state.axes[i] = 0;\n}\n\n/** Reset just the per-frame edge flags. Call when advancing a frame without a fresh snapshot. */\nexport function resetGamepadFrame(state: GamepadState): void {\n clearFrameFlags(state);\n}\n\nfunction clearFrameFlags(state: GamepadState): void {\n for (let i = 0; i < state.buttons.length; i++) {\n const b = state.buttons[i];\n if (!b) continue;\n b.justPressed = false;\n b.justReleased = false;\n }\n}\n\nfunction anyButtonDown(state: GamepadState): boolean {\n for (let i = 0; i < state.buttons.length; i++) {\n if (state.buttons[i]?.pressed) return true;\n }\n return false;\n}\n\nexport function isButtonDown(state: GamepadState, button: number): boolean {\n return state.buttons[button]?.pressed ?? false;\n}\n\nexport function wasButtonPressed(state: GamepadState, button: number): boolean {\n return state.buttons[button]?.justPressed ?? false;\n}\n\nexport function wasButtonReleased(state: GamepadState, button: number): boolean {\n return state.buttons[button]?.justReleased ?? false;\n}\n\nexport function getAxis(state: GamepadState, axis: number): number {\n return state.axes[axis] ?? 0;\n}\n","import type { GamepadSnapshot } from './gamepad.js';\n\n/**\n * Platform abstraction for sampling connected gamepads.\n *\n * `poll()` returns one snapshot per slot (typically up to 4). Unconnected\n * slots return `null`. Implementations:\n *\n * - `createWebGamepadSource()` wraps the W3C `navigator.getGamepads` API.\n * - Native implementations (e.g., `react-native-gamepad`) inject their own\n * via the `GamepadSource` interface — the package itself ships no native deps.\n *\n * **Freshness contract:** each call returns fresh objects. An implementation\n * must not reuse or mutate a snapshot (or its `buttons`/`axes` arrays) that a\n * previous `poll()` call returned. A caller may therefore retain a returned\n * snapshot across frames without it changing out from under them.\n */\nexport interface GamepadSource {\n poll(): (GamepadSnapshot | null)[];\n}\n\ninterface NavigatorLike {\n getGamepads?: () => (WebGamepad | null)[];\n}\n\ninterface WebGamepad {\n id: string;\n index: number;\n connected: boolean;\n timestamp: number;\n buttons: readonly { pressed: boolean; value: number }[];\n axes: readonly number[];\n}\n\n/**\n * Wrap `navigator.getGamepads()` (W3C Gamepad API). If `nav` is not supplied,\n * uses `globalThis.navigator`. Returns an empty array when the API is absent.\n */\nexport function createWebGamepadSource(nav?: NavigatorLike): GamepadSource {\n const source: NavigatorLike | undefined =\n nav ??\n (typeof globalThis === 'undefined'\n ? undefined\n : (globalThis as { navigator?: NavigatorLike }).navigator);\n\n return {\n poll(): (GamepadSnapshot | null)[] {\n if (!source?.getGamepads) return [];\n const pads = source.getGamepads();\n const out: (GamepadSnapshot | null)[] = new Array(pads.length);\n for (let i = 0; i < pads.length; i++) {\n const p = pads[i];\n if (!p?.connected) {\n out[i] = null;\n continue;\n }\n out[i] = webGamepadToSnapshot(p);\n }\n return out;\n },\n };\n}\n\nfunction webGamepadToSnapshot(p: WebGamepad): GamepadSnapshot {\n const buttons = new Array<{ pressed: boolean; value: number }>(p.buttons.length);\n for (let i = 0; i < p.buttons.length; i++) {\n const b = p.buttons[i];\n buttons[i] = { pressed: b?.pressed ?? false, value: b?.value ?? 0 };\n }\n const axes = new Array<number>(p.axes.length);\n for (let i = 0; i < p.axes.length; i++) axes[i] = p.axes[i] ?? 0;\n return { id: p.id, index: p.index, timestamp: p.timestamp, buttons, axes };\n}\n","import { Signal } from '@flare-engine/events';\nimport type { Vec2 } from '@flare-engine/math';\n\n/** Swipe direction. */\nexport type SwipeDirection = 'left' | 'right' | 'up' | 'down';\n\n/** Gesture detection configuration. */\nexport interface GestureConfig {\n /** Max time (seconds) for a tap (default 0.3). */\n tapMaxDuration?: number;\n /** Max distance (px) for a tap (default 20). */\n tapMaxDistance?: number;\n /** Min time (seconds) for a long press (default 0.5). */\n longPressMinDuration?: number;\n /** Min distance (px) for a swipe (default 50). */\n swipeMinDistance?: number;\n /** Max time (seconds) for a swipe (default 0.4). */\n swipeMaxDuration?: number;\n}\n\n/** Swipe event data. */\nexport interface SwipeEvent {\n direction: SwipeDirection;\n distance: number;\n duration: number;\n}\n\n/** Pinch event data. */\nexport interface PinchEvent {\n /** Scale factor (>1 = spread, <1 = pinch). */\n scale: number;\n /** Center point between the two touches. */\n center: Vec2;\n}\n\nconst DEFAULT_TAP_MAX_DURATION = 0.3;\nconst DEFAULT_TAP_MAX_DISTANCE = 20;\nconst DEFAULT_LONG_PRESS_MIN_DURATION = 0.5;\nconst DEFAULT_SWIPE_MIN_DISTANCE = 50;\nconst DEFAULT_SWIPE_MAX_DURATION = 0.4;\n\n/**\n * GestureDetector recognizes tap, long press, swipe, and pinch gestures\n * from raw pointer events.\n */\nexport class GestureDetector {\n readonly onTap = new Signal<Vec2>();\n readonly onLongPress = new Signal<Vec2>();\n readonly onSwipe = new Signal<SwipeEvent>();\n readonly onPinch = new Signal<PinchEvent>();\n\n private tapMaxDuration: number;\n private tapMaxDistance: number;\n private longPressMinDuration: number;\n private swipeMinDistance: number;\n private swipeMaxDuration: number;\n\n // Single-touch tracking\n private _startPos: Vec2 = { x: 0, y: 0 };\n /** Elapsed time (seconds) since `pointerDown` for the in-progress press. */\n private _elapsed = 0;\n private _isTracking = false;\n private _longPressFired = false;\n\n // Pinch tracking\n private _pinchStartDistance = 0;\n private _pinchTouches: [Vec2, Vec2] | null = null;\n\n constructor(config?: GestureConfig) {\n this.tapMaxDuration = config?.tapMaxDuration ?? DEFAULT_TAP_MAX_DURATION;\n this.tapMaxDistance = config?.tapMaxDistance ?? DEFAULT_TAP_MAX_DISTANCE;\n this.longPressMinDuration = config?.longPressMinDuration ?? DEFAULT_LONG_PRESS_MIN_DURATION;\n this.swipeMinDistance = config?.swipeMinDistance ?? DEFAULT_SWIPE_MIN_DISTANCE;\n this.swipeMaxDuration = config?.swipeMaxDuration ?? DEFAULT_SWIPE_MAX_DURATION;\n }\n\n /** Feed a pointer-down event. */\n pointerDown(x: number, y: number): void {\n this._startPos = { x, y };\n this._elapsed = 0;\n this._isTracking = true;\n this._longPressFired = false;\n }\n\n /**\n * Feed a pointer-up event.\n *\n * `elapsedSinceDown` is optional: pass it when the host tracks its own\n * timestamps (e.g. event-driven, no per-frame `update()` calls); omit it\n * to use the elapsed time already accumulated via `update(dt, ...)`. Either\n * way there is one clock per press — passing it here re-syncs the same\n * accumulator `update()` advances, rather than racing it. If a long press\n * already fired for this press, tap/swipe are suppressed so one press\n * yields exactly one gesture.\n */\n pointerUp(x: number, y: number, elapsedSinceDown?: number): void {\n if (!this._isTracking) return;\n this._isTracking = false;\n if (elapsedSinceDown !== undefined) this._elapsed = elapsedSinceDown;\n if (this._longPressFired) return;\n\n const dx = x - this._startPos.x;\n const dy = y - this._startPos.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n const duration = this._elapsed;\n\n // Check swipe first (requires min distance)\n if (dist >= this.swipeMinDistance && duration <= this.swipeMaxDuration) {\n const absDx = Math.abs(dx);\n const absDy = Math.abs(dy);\n let direction: SwipeDirection;\n if (absDx > absDy) {\n direction = dx > 0 ? 'right' : 'left';\n } else {\n direction = dy > 0 ? 'down' : 'up';\n }\n this.onSwipe.emit({ direction, distance: dist, duration });\n return;\n }\n\n // Check tap (short press, small movement)\n if (dist <= this.tapMaxDistance && duration <= this.tapMaxDuration) {\n this.onTap.emit({ x, y });\n return;\n }\n }\n\n /**\n * Update gesture tracking. Call each frame with dt.\n * @param dt Delta time in seconds.\n * @param currentX Current pointer X.\n * @param currentY Current pointer Y.\n */\n update(dt: number, currentX: number, currentY: number): void {\n if (!this._isTracking) return;\n this._elapsed += dt;\n\n // Long press detection\n if (!this._longPressFired && this._elapsed >= this.longPressMinDuration) {\n const dx = currentX - this._startPos.x;\n const dy = currentY - this._startPos.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n if (dist <= this.tapMaxDistance) {\n this._longPressFired = true;\n this.onLongPress.emit({ x: currentX, y: currentY });\n }\n }\n }\n\n /**\n * Feed a two-finger pinch update. Call when two touches are active.\n * @param t1 First touch position.\n * @param t2 Second touch position.\n */\n pinchUpdate(t1: Vec2, t2: Vec2): void {\n const dx = t2.x - t1.x;\n const dy = t2.y - t1.y;\n const dist = Math.sqrt(dx * dx + dy * dy);\n\n if (this._pinchTouches === null) {\n // Start pinch\n this._pinchStartDistance = dist;\n this._pinchTouches = [{ ...t1 }, { ...t2 }];\n return;\n }\n\n if (this._pinchStartDistance > 0) {\n const scale = dist / this._pinchStartDistance;\n const center: Vec2 = {\n x: (t1.x + t2.x) / 2,\n y: (t1.y + t2.y) / 2,\n };\n this.onPinch.emit({ scale, center });\n }\n }\n\n /** Call when pinch ends (fewer than 2 touches). */\n pinchEnd(): void {\n this._pinchTouches = null;\n this._pinchStartDistance = 0;\n }\n}\n","/** Virtual button state — pure data, no UI. */\nexport interface VirtualButtonState {\n /** Whether the button is currently pressed. */\n isPressed: boolean;\n /** Whether the button was just pressed this frame. */\n justPressed: boolean;\n /** Whether the button was just released this frame. */\n justReleased: boolean;\n}\n\n/** Create a default button state. */\nexport function createButtonState(): VirtualButtonState {\n return {\n isPressed: false,\n justPressed: false,\n justReleased: false,\n };\n}\n\n/** Call at the start of each frame to reset per-frame flags. */\nexport function resetButtonFrame(state: VirtualButtonState): void {\n state.justPressed = false;\n state.justReleased = false;\n}\n\n/** Call when the button is pressed. */\nexport function pressButton(state: VirtualButtonState): void {\n if (!state.isPressed) {\n state.isPressed = true;\n state.justPressed = true;\n }\n}\n\n/** Call when the button is released. */\nexport function releaseButton(state: VirtualButtonState): void {\n if (state.isPressed) {\n state.isPressed = false;\n state.justReleased = true;\n }\n}\n","import {\n createButtonState,\n pressButton,\n releaseButton,\n resetButtonFrame,\n type VirtualButtonState,\n} from './virtual-button.js';\n\n/** Minimal keyboard event shape — no DOM type dep. */\nexport interface KeyboardEventLike {\n readonly code: string;\n readonly type: string;\n /** Optional — real DOM events have it; synthetic feeds may not. */\n preventDefault?(): void;\n}\n\n/** Minimal event target shape for attaching keyboard listeners. */\nexport interface KeyboardEventTargetLike {\n addEventListener(type: string, handler: (ev: KeyboardEventLike) => void): void;\n removeEventListener(type: string, handler: (ev: KeyboardEventLike) => void): void;\n}\n\n/**\n * Buffered per-frame keyboard state.\n *\n * Edge flags (`wasPressed`, `wasReleased`) clear each frame via `reset()`.\n * `keyDown` / `keyUp` are the platform-neutral injection points: web feeds\n * them via `attachKeyboardListeners`; mobile/RN feeds them from a\n * hardware-keyboard native module or an on-screen source.\n */\nexport interface KeyboardState {\n /** True while the key is physically held. */\n isDown(code: string): boolean;\n /** True only on the frame the key was pressed. */\n wasPressed(code: string): boolean;\n /** True only on the frame the key was released. */\n wasReleased(code: string): boolean;\n /** Platform-neutral injection. OS auto-repeat is de-edged by the pressButton guard. */\n keyDown(code: string): void;\n /** Platform-neutral injection. */\n keyUp(code: string): void;\n /** Frame-start edge clear. Zero-alloc. */\n reset(): void;\n /** Blur/stuck-key guard: emits a release edge for every held code, then drops held. */\n clear(): void;\n}\n\n/** Create a fresh keyboard state. */\nexport function createKeyboard(): KeyboardState {\n const states: VirtualButtonState[] = [];\n const codeIndex = new Map<string, number>();\n\n return {\n isDown(code: string): boolean {\n const i = codeIndex.get(code);\n if (i === undefined) return false;\n return states[i]?.isPressed ?? false;\n },\n\n wasPressed(code: string): boolean {\n const i = codeIndex.get(code);\n if (i === undefined) return false;\n return states[i]?.justPressed ?? false;\n },\n\n wasReleased(code: string): boolean {\n const i = codeIndex.get(code);\n if (i === undefined) return false;\n return states[i]?.justReleased ?? false;\n },\n\n keyDown(code: string): void {\n let i = codeIndex.get(code);\n if (i === undefined) {\n i = states.length;\n states.push(createButtonState());\n codeIndex.set(code, i);\n }\n pressButton(states[i]!);\n },\n\n keyUp(code: string): void {\n const i = codeIndex.get(code);\n if (i === undefined) return;\n releaseButton(states[i]!);\n },\n\n reset(): void {\n for (let i = 0; i < states.length; i++) {\n resetButtonFrame(states[i]!);\n }\n },\n\n clear(): void {\n for (let i = 0; i < states.length; i++) {\n releaseButton(states[i]!);\n }\n },\n };\n}\n\n/**\n * Web turnkey adapter: registers `keydown`, `keyup`, and `blur` listeners on\n * `target`. `blur` calls `kb.clear()` (stuck-key guard). Returns a detach fn.\n *\n * `target` is structural `{ addEventListener, removeEventListener }` — no DOM\n * types dep. On web, pass `window`; for mobile/RN, feed `keyDown`/`keyUp`\n * directly from a hardware-keyboard native module or an on-screen source.\n *\n * Does NOT call `preventDefault` — bare use lets Space/arrows scroll and Tab\n * move DOM focus. For game-mode input, attach your own listener that calls\n * `preventDefault` for game keys and forwards `kb.keyDown(ev.code)`.\n */\nexport function attachKeyboardListeners(\n kb: KeyboardState,\n target: KeyboardEventTargetLike,\n): () => void {\n const onKeyDown = (ev: KeyboardEventLike): void => {\n kb.keyDown(ev.code);\n };\n const onKeyUp = (ev: KeyboardEventLike): void => {\n kb.keyUp(ev.code);\n };\n const onBlur = (_ev: KeyboardEventLike): void => {\n kb.clear();\n };\n\n target.addEventListener('keydown', onKeyDown);\n target.addEventListener('keyup', onKeyUp);\n target.addEventListener('blur', onBlur);\n\n return (): void => {\n target.removeEventListener('keydown', onKeyDown);\n target.removeEventListener('keyup', onKeyUp);\n target.removeEventListener('blur', onBlur);\n };\n}\n\n/**\n * Action → code binding map. Keys are action names; values are arrays of\n * `KeyboardEvent.code` strings. Multiple codes OR-reduce (any bound key\n * triggers the action).\n */\nexport type KeyBindings = Readonly<Record<string, readonly string[]>>;\n\n/** True if any bound code for `action` is currently held. */\nexport function isActionDown(kb: KeyboardState, bindings: KeyBindings, action: string): boolean {\n const codes = bindings[action];\n if (!codes) return false;\n for (let i = 0; i < codes.length; i++) {\n if (kb.isDown(codes[i]!)) return true;\n }\n return false;\n}\n\n/** True if any bound code for `action` was pressed this frame. */\nexport function wasActionPressed(\n kb: KeyboardState,\n bindings: KeyBindings,\n action: string,\n): boolean {\n const codes = bindings[action];\n if (!codes) return false;\n for (let i = 0; i < codes.length; i++) {\n if (kb.wasPressed(codes[i]!)) return true;\n }\n return false;\n}\n\n/**\n * True if any bound code for `action` was released this frame AND no bound\n * code is still held. Release fires only when the last held bound key lifts.\n */\nexport function wasActionReleased(\n kb: KeyboardState,\n bindings: KeyBindings,\n action: string,\n): boolean {\n const codes = bindings[action];\n if (!codes) return false;\n let anyReleased = false;\n for (let i = 0; i < codes.length; i++) {\n if (kb.isDown(codes[i]!)) return false;\n if (kb.wasReleased(codes[i]!)) anyReleased = true;\n }\n return anyReleased;\n}\n","import type { Vec2 } from '@flare-engine/math';\n\n/** State of a single pointer (primary touch or mouse). */\nexport interface Pointer {\n /** Current position in screen coordinates. */\n position: Vec2;\n /** Position delta since last frame. */\n delta: Vec2;\n /** Whether the pointer is currently held down. */\n isDown: boolean;\n /** True only on the frame the pointer was pressed. */\n justPressed: boolean;\n /** True only on the frame the pointer was released. */\n justReleased: boolean;\n}\n\n/** State of a single touch point in a multitouch scenario. */\nexport interface TouchPoint {\n /** Unique touch identifier. */\n id: number;\n /** Current position in screen coordinates. */\n position: Vec2;\n /** Whether this touch is currently active. */\n isDown: boolean;\n}\n\n/** Create a default pointer state. */\nexport function createPointer(): Pointer {\n return {\n position: { x: 0, y: 0 },\n delta: { x: 0, y: 0 },\n isDown: false,\n justPressed: false,\n justReleased: false,\n };\n}\n\n/**\n * Update pointer state for a new frame.\n * Call this at the start of each frame to clear per-frame flags.\n */\nexport function resetPointerFrame(pointer: Pointer): void {\n pointer.delta.x = 0;\n pointer.delta.y = 0;\n pointer.justPressed = false;\n pointer.justReleased = false;\n}\n\n/** Feed a pointer-down event into the pointer state. */\nexport function pointerDown(pointer: Pointer, x: number, y: number): void {\n const wasDown = pointer.isDown;\n pointer.isDown = true;\n if (!wasDown) {\n pointer.justPressed = true;\n }\n pointer.delta.x += x - pointer.position.x;\n pointer.delta.y += y - pointer.position.y;\n pointer.position.x = x;\n pointer.position.y = y;\n}\n\n/** Feed a pointer-move event into the pointer state. */\nexport function pointerMove(pointer: Pointer, x: number, y: number): void {\n pointer.delta.x += x - pointer.position.x;\n pointer.delta.y += y - pointer.position.y;\n pointer.position.x = x;\n pointer.position.y = y;\n}\n\n/** Feed a pointer-up event into the pointer state. */\nexport function pointerUp(pointer: Pointer, x: number, y: number): void {\n pointer.isDown = false;\n pointer.justReleased = true;\n pointer.delta.x += x - pointer.position.x;\n pointer.delta.y += y - pointer.position.y;\n pointer.position.x = x;\n pointer.position.y = y;\n}\n","import type { GamepadSnapshot } from './gamepad.js';\n\n/**\n * Button / axis remap table.\n *\n * `buttons[logicalId] = physicalIndex` — to poll A, read\n * `snapshot.buttons[table.buttons[GamepadButton.A]]`.\n *\n * `axes` maps logical axis id → `{ index, invert, scale }`. Most games invert\n * Y on some controllers; `scale` supports half-range triggers.\n */\nexport interface AxisMap {\n index: number;\n invert: boolean;\n scale: number;\n}\n\nexport interface RemapTable {\n buttons: number[];\n axes: AxisMap[];\n}\n\nexport function createIdentityRemap(buttonCount = 17, axisCount = 4): RemapTable {\n const buttons = new Array<number>(buttonCount);\n for (let i = 0; i < buttonCount; i++) buttons[i] = i;\n const axes = new Array<AxisMap>(axisCount);\n for (let i = 0; i < axisCount; i++) axes[i] = { index: i, invert: false, scale: 1 };\n return { buttons, axes };\n}\n\n/** Apply a remap table to a raw snapshot, returning a new snapshot with logical ordering. */\nexport function applyRemap(snapshot: GamepadSnapshot, table: RemapTable): GamepadSnapshot {\n const buttons = new Array<{ pressed: boolean; value: number }>(table.buttons.length);\n for (let logical = 0; logical < table.buttons.length; logical++) {\n const physical = table.buttons[logical] ?? logical;\n const src = snapshot.buttons[physical];\n buttons[logical] = { pressed: src?.pressed ?? false, value: src?.value ?? 0 };\n }\n const axes = new Array<number>(table.axes.length);\n for (let logical = 0; logical < table.axes.length; logical++) {\n const map = table.axes[logical] ?? { index: logical, invert: false, scale: 1 };\n const raw = snapshot.axes[map.index] ?? 0;\n axes[logical] = raw * map.scale * (map.invert ? -1 : 1);\n }\n return { id: snapshot.id, index: snapshot.index, timestamp: snapshot.timestamp, buttons, axes };\n}\n\n/**\n * Minimal storage contract — matches `@flare-engine/storage` `StorageAdapter`,\n * but declared locally so this package does not take a hard dep on storage.\n */\nexport interface RemapStore {\n get(key: string): Promise<string | null>;\n set(key: string, value: string): Promise<void>;\n}\n\n/** Persist a remap table under the given key. Throws on invalid table shape. */\nexport async function saveRemap(store: RemapStore, key: string, table: RemapTable): Promise<void> {\n await store.set(key, JSON.stringify(table));\n}\n\n/** Load a remap table. Returns `null` if absent or malformed. */\nexport async function loadRemap(store: RemapStore, key: string): Promise<RemapTable | null> {\n const raw = await store.get(key);\n if (raw === null) return null;\n try {\n const parsed = JSON.parse(raw) as unknown;\n if (!isRemapTable(parsed)) return null;\n return parsed;\n } catch {\n return null;\n }\n}\n\nfunction isRemapTable(value: unknown): value is RemapTable {\n if (typeof value !== 'object' || value === null) return false;\n const obj = value as { buttons?: unknown; axes?: unknown };\n if (!Array.isArray(obj.buttons) || !Array.isArray(obj.axes)) return false;\n for (const b of obj.buttons) if (typeof b !== 'number') return false;\n for (const a of obj.axes) {\n if (typeof a !== 'object' || a === null) return false;\n const ax = a as { index?: unknown; invert?: unknown; scale?: unknown };\n if (\n typeof ax.index !== 'number' ||\n typeof ax.invert !== 'boolean' ||\n typeof ax.scale !== 'number'\n ) {\n return false;\n }\n }\n return true;\n}\n","import {\n createGamepadState,\n type GamepadState,\n resetGamepadFrame,\n updateGamepadFromSnapshot,\n} from './gamepad.js';\nimport type { GamepadSource } from './gamepad-source.js';\nimport { createKeyboard, type KeyboardState } from './keyboard.js';\nimport {\n createPointer,\n type Pointer,\n pointerDown,\n pointerMove,\n pointerUp,\n resetPointerFrame,\n type TouchPoint,\n} from './pointer.js';\nimport type { RemapTable } from './remap.js';\nimport { applyRemap } from './remap.js';\n\n/**\n * InputManager provides a polling-based input model.\n *\n * Call `update()` once per frame (before game logic) to snapshot input state.\n * Feed events from the platform (RN touch/gesture handlers) via the on* methods.\n */\nexport class InputManager {\n /**\n * Primary pointer — the touch that started the current gesture (first\n * `onPointerDown` while no touch was active), or the mouse.\n *\n * Once assigned, the primary id stays fixed to that touch until it lifts;\n * it does NOT transfer to a remaining finger. While a second finger is\n * down, its events reach only `touches` — `pointer` neither moves nor\n * releases because of it. When the primary lifts, `pointer.isDown` goes\n * false even if other fingers remain down, and a new primary is assigned\n * only once every touch has lifted and a fresh `onPointerDown` arrives.\n * This keeps `pointer` a single continuous stream with no mid-gesture\n * teleport; read `touches` for anything beyond one finger.\n */\n readonly pointer: Pointer = createPointer();\n\n /** Buffered keyboard state. Feed via `attachKeyboardListeners` (web) or `keyboard.keyDown`/`keyUp` (mobile/RN). */\n readonly keyboard: KeyboardState = createKeyboard();\n\n /** All active touch points. */\n readonly touches: TouchPoint[] = [];\n\n private _touchMap = new Map<number, TouchPoint>();\n private _primaryTouchId: number | null = null;\n private _gamepads: GamepadState[] = [];\n private _gamepadDeadZone = 0.15;\n private _gamepadRemaps = new Map<number, RemapTable>();\n\n /** Call once per frame to reset per-frame flags. */\n update(): void {\n resetPointerFrame(this.pointer);\n this.keyboard.reset();\n for (let i = 0; i < this._gamepads.length; i++) {\n const pad = this._gamepads[i];\n if (pad) resetGamepadFrame(pad);\n }\n }\n\n /** Feed a touch/pointer begin event. */\n onPointerDown(id: number, x: number, y: number): void {\n if (this._touchMap.size === 0) {\n this._primaryTouchId = id;\n }\n if (id === this._primaryTouchId) {\n pointerDown(this.pointer, x, y);\n }\n this._addOrUpdateTouch(id, x, y, true);\n }\n\n /** Feed a touch/pointer move event. */\n onPointerMove(id: number, x: number, y: number): void {\n if (id === this._primaryTouchId) {\n pointerMove(this.pointer, x, y);\n }\n this._addOrUpdateTouch(id, x, y, true);\n }\n\n /** Feed a touch/pointer end event. */\n onPointerUp(id: number, x: number, y: number): void {\n if (id === this._primaryTouchId) {\n pointerUp(this.pointer, x, y);\n this._primaryTouchId = null;\n }\n this._removeTouch(id);\n }\n\n /** Access the gamepad state at `index`. Allocates on first access. */\n gamepad(index: number): GamepadState {\n let pad = this._gamepads[index];\n if (!pad) {\n pad = createGamepadState(index);\n this._gamepads[index] = pad;\n }\n return pad;\n }\n\n /** Dead zone in [0, 1). Axes at or below this magnitude read as 0. */\n setGamepadDeadZone(deadZone: number): void {\n this._gamepadDeadZone = Math.max(0, Math.min(0.95, deadZone));\n }\n\n /** Install a remap table for a specific gamepad index. Pass `null` to clear. */\n setGamepadRemap(index: number, table: RemapTable | null): void {\n if (table === null) this._gamepadRemaps.delete(index);\n else this._gamepadRemaps.set(index, table);\n }\n\n /** Poll all gamepads from the given source, applying remap + dead zones. */\n pollGamepads(source: GamepadSource): void {\n const snapshots = source.poll();\n for (let i = 0; i < snapshots.length; i++) {\n const pad = this.gamepad(i);\n const snap = snapshots[i] ?? null;\n const remapped =\n snap !== null\n ? this._gamepadRemaps.get(i)\n ? applyRemap(snap, this._gamepadRemaps.get(i) as RemapTable)\n : snap\n : null;\n updateGamepadFromSnapshot(pad, remapped, this._gamepadDeadZone);\n }\n }\n\n private _addOrUpdateTouch(id: number, x: number, y: number, isDown: boolean): void {\n let touch = this._touchMap.get(id);\n if (!touch) {\n touch = { id, position: { x, y }, isDown };\n this._touchMap.set(id, touch);\n this.touches.push(touch);\n } else {\n touch.position.x = x;\n touch.position.y = y;\n touch.isDown = isDown;\n }\n }\n\n private _removeTouch(id: number): void {\n const touch = this._touchMap.get(id);\n if (!touch) return;\n this._touchMap.delete(id);\n const idx = this.touches.indexOf(touch);\n if (idx !== -1) {\n this.touches.splice(idx, 1);\n }\n }\n}\n","import type { Vec2 } from '@flare-engine/math';\n\n/**\n * Dev-flag access for the config guard in `updateJoystick`, which runs once per\n * frame while a stick is held. Read as a `globalThis` property, not as a bare\n * `__DEV__` identifier: on JSC an unresolvable global costs ~270 ns per\n * evaluation where a property miss is inline-cached at ~0.46 ns. Same reasoning\n * as `@flare-engine/core`'s `Pool` — see PERF-10.\n */\nconst G = globalThis as { __DEV__?: boolean };\n\n/** Warn at most once per process; a bad config repeats every frame. */\nlet _warnedConfig = false;\n\n/** Virtual joystick configuration. */\nexport interface VirtualJoystickConfig {\n /** Dead zone radius in pixels (default 10). */\n deadZone?: number;\n /** Maximum radius in pixels (default 50). */\n maxRadius?: number;\n}\n\n/** Virtual joystick state — pure data, no UI. */\nexport interface VirtualJoystickState {\n /** Whether the joystick is currently being touched. */\n active: boolean;\n /** Normalized direction vector (-1 to 1 per axis). */\n direction: Vec2;\n /** Magnitude 0-1 (0 = center/dead zone, 1 = max radius). */\n magnitude: number;\n /** Raw offset from center in pixels. */\n offset: Vec2;\n}\n\nconst DEFAULT_DEAD_ZONE = 10;\nconst DEFAULT_MAX_RADIUS = 50;\n\n/** Create a default joystick state. */\nexport function createJoystickState(): VirtualJoystickState {\n return {\n active: false,\n direction: { x: 0, y: 0 },\n magnitude: 0,\n offset: { x: 0, y: 0 },\n };\n}\n\n/**\n * Update joystick state from a touch event.\n *\n * @param state The joystick state to update.\n * @param centerX The joystick center X in screen pixels.\n * @param centerY The joystick center Y in screen pixels.\n * @param touchX The current touch X in screen pixels.\n * @param touchY The current touch Y in screen pixels.\n * @param config Joystick configuration.\n */\nexport function updateJoystick(\n state: VirtualJoystickState,\n centerX: number,\n centerY: number,\n touchX: number,\n touchY: number,\n config?: VirtualJoystickConfig,\n): void {\n let deadZone = config?.deadZone ?? DEFAULT_DEAD_ZONE;\n let maxRadius = config?.maxRadius ?? DEFAULT_MAX_RADIUS;\n\n // Out-of-contract config is corrected rather than propagated. Left alone, a\n // NaN deadZone defeats the early return below and a maxRadius equal to\n // deadZone divides by zero at `normalizedDist` — either way `state.direction`\n // becomes NaN and, because the state is reused across frames, the stick never\n // recovers. The whole check sits behind one comparison on the healthy path.\n if (!(deadZone >= 0 && maxRadius > deadZone)) {\n if (G.__DEV__ && !_warnedConfig) {\n _warnedConfig = true;\n console.warn(\n `[flare-engine/input] updateJoystick: invalid config (deadZone=${deadZone}, maxRadius=${maxRadius}); ` +\n 'expected 0 <= deadZone < maxRadius. Falling back to defaults for this call.',\n );\n }\n if (!(deadZone >= 0)) deadZone = DEFAULT_DEAD_ZONE;\n if (!(maxRadius > deadZone)) maxRadius = deadZone + DEFAULT_MAX_RADIUS;\n }\n\n const dx = touchX - centerX;\n const dy = touchY - centerY;\n const dist = Math.sqrt(dx * dx + dy * dy);\n\n state.active = true;\n\n // `!(dist >= deadZone)` rather than `dist < deadZone` so a non-finite touch\n // coordinate takes the centred branch instead of falling through to the maths.\n if (!(dist >= deadZone)) {\n state.direction.x = 0;\n state.direction.y = 0;\n state.magnitude = 0;\n // dist is non-finite only when a touch coordinate was, in which case dx/dy\n // are too — report a centred offset rather than writing NaN into the state.\n const centred = dist === 0 || !Number.isFinite(dist);\n state.offset.x = centred ? 0 : dx;\n state.offset.y = centred ? 0 : dy;\n return;\n }\n\n // Clamp to max radius\n const clampedDist = Math.min(dist, maxRadius);\n const normalizedDist = (clampedDist - deadZone) / (maxRadius - deadZone);\n\n // Direction is always the full normalized direction. `dist` is > 0 here —\n // a zero distance cannot pass the guard above once deadZone >= 0 — but the\n // reciprocal is guarded anyway, because `deadZone: 0` makes `dist === 0`\n // reachable and `1 / 0` would put Infinity into direction.\n const invDist = dist > 0 ? 1 / dist : 0;\n state.direction.x = dx * invDist;\n state.direction.y = dy * invDist;\n state.magnitude = Math.min(normalizedDist, 1);\n\n // Offset clamped to max radius\n const scale = dist > 0 ? clampedDist / dist : 0;\n state.offset.x = dx * scale;\n state.offset.y = dy * scale;\n}\n\n/** Reset joystick state when touch is released. */\nexport function releaseJoystick(state: VirtualJoystickState): void {\n state.active = false;\n state.direction.x = 0;\n state.direction.y = 0;\n state.magnitude = 0;\n state.offset.x = 0;\n state.offset.y = 0;\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAMA,MAAI;;AAGV,IAAI,kBAAkB;;AAGtB,MAAM,gBAAgB;;AAGtB,MAAa,gBAAgB;CAC3B,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM;CACN,OAAO;CACP,IAAI;CACJ,IAAI;CACJ,QAAQ;CACR,UAAU;CACV,UAAU;CACV,WAAW;CACX,MAAM;AACR;;AAIA,MAAa,cAAc;CACzB,OAAO;CACP,OAAO;CACP,QAAQ;CACR,QAAQ;AACV;AA+BA,SAAgB,mBAAmB,QAAQ,GAAG,cAAc,IAAI,YAAY,GAAiB;CAC3F,MAAM,UAAgC,IAAI,MAAM,WAAW;CAC3D,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,KAC/B,QAAQ,KAAK;EAAE,SAAS;EAAO,OAAO;EAAG,aAAa;EAAO,cAAc;CAAM;CAGnF,OAAO;EAAE,WAAW;EAAO,IAAI;EAAI;EAAO;EAAS,MADtC,IAAI,MAAc,SAAS,CAAC,CAAC,KAAK,CACO;EAAG,WAAW;CAAE;AACxE;AAEA,SAAS,cAAc,OAAe,UAA0B;CAI9D,IAAI,KAAK;CACT,IAAI,EAAE,MAAM,KAAK,KAAK,IAAI;EACxB,IAAIA,IAAE,WAAW,CAAC,iBAAiB;GACjC,kBAAkB;GAClB,QAAQ,KACN,i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|
+
"version": "0.4.7",
|
|
4
4
|
"description": "InputManager, VirtualJoystick, gesture handling",
|
|
5
5
|
"keywords": ["flare-engine", "input", "joystick", "gestures"],
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"typecheck": "tsc --noEmit"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@flare-engine/events": "^0.4.
|
|
41
|
-
"@flare-engine/math": "^0.4.
|
|
40
|
+
"@flare-engine/events": "^0.4.7",
|
|
41
|
+
"@flare-engine/math": "^0.4.7"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=20"
|