pixijs-input-devices 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +161 -521
- package/dist/index.cjs +1 -354
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +372 -211
- package/dist/index.mjs +1 -354
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -44,14 +44,132 @@ declare class GamepadJoystick {
|
|
|
44
44
|
/** A scalar -1.0 to 1.0 representing the Y-axis position on the stick */
|
|
45
45
|
get y(): number;
|
|
46
46
|
}
|
|
47
|
+
declare class InputDeviceManager {
|
|
48
|
+
static global: InputDeviceManager;
|
|
49
|
+
readonly keyboard: KeyboardDevice;
|
|
50
|
+
private readonly _emitter;
|
|
51
|
+
/** Whether we are a mobile device (including tablets) */
|
|
52
|
+
readonly isMobile: boolean;
|
|
53
|
+
/** Whether a touchscreen is available */
|
|
54
|
+
readonly isTouchCapable: boolean;
|
|
55
|
+
/** Add an event listener */
|
|
56
|
+
on<K extends keyof InputDeviceEvent>(event: K, listener: (event: InputDeviceEvent[K]) => void): this;
|
|
57
|
+
/** Remove an event listener (or all if none provided) */
|
|
58
|
+
off<K extends keyof InputDeviceEvent>(event: K, listener: (event: InputDeviceEvent[K]) => void): this;
|
|
59
|
+
private hasFocus;
|
|
60
|
+
/**
|
|
61
|
+
* Connected gamepads accessible by index.
|
|
62
|
+
*
|
|
63
|
+
* Keep in mind these inputs are only up-to-date from the last update().
|
|
64
|
+
*/
|
|
65
|
+
get gamepads(): readonly GamepadDevice[];
|
|
66
|
+
/**
|
|
67
|
+
* Connected devices.
|
|
68
|
+
*
|
|
69
|
+
* Keep in mind these inputs may only be up-to-date from the last update().
|
|
70
|
+
*/
|
|
71
|
+
get devices(): readonly Device[];
|
|
72
|
+
options: {
|
|
73
|
+
clearInputInBackground: boolean;
|
|
74
|
+
};
|
|
75
|
+
private _devices;
|
|
76
|
+
private _gamepadDevices;
|
|
77
|
+
private _gamepadDeviceMap;
|
|
78
|
+
private constructor();
|
|
79
|
+
/**
|
|
80
|
+
* Performs a poll of latest input from all devices
|
|
81
|
+
*/
|
|
82
|
+
update(): ReadonlyArray<Device>;
|
|
83
|
+
/** Add a custom device. */
|
|
84
|
+
add(device: CustomDevice): void;
|
|
85
|
+
/** Remove a custom device. */
|
|
86
|
+
remove(device: Device): void;
|
|
87
|
+
/**
|
|
88
|
+
* @returns updates connected gamepads, performing a poll of latest input
|
|
89
|
+
*/
|
|
90
|
+
pollGamepads(now: number): ReadonlyArray<GamepadDevice>;
|
|
91
|
+
private removeGamepad;
|
|
92
|
+
}
|
|
93
|
+
declare class NavigationManager {
|
|
94
|
+
static global: NavigationManager;
|
|
95
|
+
/**
|
|
96
|
+
* Set the stage root to automatically handle global
|
|
97
|
+
* navigation intents.
|
|
98
|
+
*/
|
|
99
|
+
stage?: Container;
|
|
100
|
+
/**
|
|
101
|
+
* When enabled, if no pointover/mouseover listeners
|
|
102
|
+
* exist, a default effect will be used instead.
|
|
103
|
+
*/
|
|
104
|
+
fallbackEffects: boolean;
|
|
105
|
+
private _focused?;
|
|
106
|
+
private _responderStack;
|
|
107
|
+
private constructor();
|
|
108
|
+
/**
|
|
109
|
+
* Active global interaction target
|
|
110
|
+
*/
|
|
111
|
+
get firstResponder(): NavigationResponder | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Stack of global interaction targets
|
|
114
|
+
*/
|
|
115
|
+
get responders(): readonly NavigationResponder[];
|
|
116
|
+
/**
|
|
117
|
+
* Emit interaction intent to the first responder,
|
|
118
|
+
* or the global responder if none.
|
|
119
|
+
*/
|
|
120
|
+
commit(intent: NavigationIntent, device: Device): void;
|
|
121
|
+
/**
|
|
122
|
+
* Remove the top-most global interaction target
|
|
123
|
+
*/
|
|
124
|
+
popResponder(): NavigationResponder | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Set the new top-most global interaction target.
|
|
127
|
+
*/
|
|
128
|
+
pushResponder(responder: NavigationResponder): void;
|
|
129
|
+
private _propagateIntent;
|
|
130
|
+
private _handleGlobalIntent;
|
|
131
|
+
private _emitBlur;
|
|
132
|
+
private _emitFocus;
|
|
133
|
+
private _emitTrigger;
|
|
134
|
+
}
|
|
135
|
+
declare const ButtonCode: readonly [
|
|
136
|
+
"A",
|
|
137
|
+
"B",
|
|
138
|
+
"X",
|
|
139
|
+
"Y",
|
|
140
|
+
"LeftShoulder",
|
|
141
|
+
"RightShoulder",
|
|
142
|
+
"LeftTrigger",
|
|
143
|
+
"RightTrigger",
|
|
144
|
+
"Back",
|
|
145
|
+
"Start",
|
|
146
|
+
"LeftStick",
|
|
147
|
+
"RightStick",
|
|
148
|
+
"DPadUp",
|
|
149
|
+
"DPadDown",
|
|
150
|
+
"DPadLeft",
|
|
151
|
+
"DPadRight"
|
|
152
|
+
];
|
|
47
153
|
export declare abstract class CustomDevice {
|
|
48
154
|
readonly id: string;
|
|
49
155
|
readonly type = "custom";
|
|
50
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Associate custom meta data with a device.
|
|
158
|
+
*/
|
|
159
|
+
readonly meta: Record<string, any>;
|
|
51
160
|
lastUpdated: number;
|
|
52
161
|
constructor(id: string);
|
|
53
|
-
|
|
162
|
+
/**
|
|
163
|
+
* (Optional) Clear input.
|
|
164
|
+
*
|
|
165
|
+
* This method is triggered when the window is
|
|
166
|
+
* moved to background.
|
|
167
|
+
*/
|
|
54
168
|
clear(): void;
|
|
169
|
+
/**
|
|
170
|
+
* Triggered during the polling function.
|
|
171
|
+
*/
|
|
172
|
+
abstract update(now: number): void;
|
|
55
173
|
}
|
|
56
174
|
/**
|
|
57
175
|
* A gamepad (game controller).
|
|
@@ -65,21 +183,30 @@ export declare abstract class CustomDevice {
|
|
|
65
183
|
export declare class GamepadDevice {
|
|
66
184
|
source: Gamepad;
|
|
67
185
|
static defaultOptions: {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
186
|
+
/**
|
|
187
|
+
* When set to `"physical"` _(default)_, ABXY refer to the equivalent
|
|
188
|
+
* positions on a standard layout controller.
|
|
189
|
+
*
|
|
190
|
+
* When set to `"accurate"`, ABXY refer to the ABXY buttons on a Nintendo
|
|
191
|
+
* controller.
|
|
192
|
+
*
|
|
193
|
+
* When set to `"none"`, ABXY refer to the unmapped buttons in the 0, 1,
|
|
194
|
+
* 2, and 3 positions respectively.
|
|
195
|
+
*/
|
|
196
|
+
remapNintendoMode: RemapNintendoMode;
|
|
197
|
+
navigation: {
|
|
198
|
+
enabled: boolean;
|
|
199
|
+
binds: Partial<Record<Button, NavigationIntent>>;
|
|
76
200
|
};
|
|
77
|
-
joystickDeadzone: number;
|
|
78
201
|
intent: {
|
|
79
202
|
joystickCommitSensitivity: number;
|
|
80
203
|
firstCooldownMs: number;
|
|
81
204
|
defaultCooldownMs: number;
|
|
82
205
|
};
|
|
206
|
+
vibration: {
|
|
207
|
+
enabled: boolean;
|
|
208
|
+
intensity: number;
|
|
209
|
+
};
|
|
83
210
|
};
|
|
84
211
|
/**
|
|
85
212
|
* Globally unique identifier for this gamepad slot.
|
|
@@ -87,39 +214,24 @@ export declare class GamepadDevice {
|
|
|
87
214
|
*/
|
|
88
215
|
readonly id: string;
|
|
89
216
|
readonly type = "gamepad";
|
|
217
|
+
/**
|
|
218
|
+
* Associate custom meta data with a device.
|
|
219
|
+
*/
|
|
220
|
+
readonly meta: Record<string, any>;
|
|
221
|
+
lastUpdated: number;
|
|
90
222
|
/**
|
|
91
223
|
* Platform of this gamepad, useful for configuring standard
|
|
92
224
|
* button layouts or displaying branded icons.
|
|
93
225
|
* @example "playstation"
|
|
94
226
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
/** Configurable metadata. */
|
|
98
|
-
assignee?: any;
|
|
99
|
-
options: {
|
|
100
|
-
binds: {
|
|
101
|
-
0: "trigger";
|
|
102
|
-
1: "navigateBack";
|
|
103
|
-
8: "navigateBack";
|
|
104
|
-
13: "navigateDown";
|
|
105
|
-
14: "navigateLeft";
|
|
106
|
-
15: "navigateRight";
|
|
107
|
-
12: "navigateUp";
|
|
108
|
-
};
|
|
109
|
-
joystickDeadzone: number;
|
|
110
|
-
intent: {
|
|
111
|
-
joystickCommitSensitivity: number;
|
|
112
|
-
firstCooldownMs: number;
|
|
113
|
-
defaultCooldownMs: number;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
227
|
+
layout: GamepadLayout;
|
|
228
|
+
options: typeof GamepadDevice.defaultOptions;
|
|
116
229
|
private _btnPrevState;
|
|
117
230
|
private _axisIntents;
|
|
118
231
|
private readonly _throttleIdLeftStickX;
|
|
119
232
|
private readonly _throttleIdLeftStickY;
|
|
120
|
-
|
|
233
|
+
private readonly _emitter;
|
|
121
234
|
readonly leftJoystick: GamepadJoystick;
|
|
122
|
-
/** Right Joystick */
|
|
123
235
|
readonly rightJoystick: GamepadJoystick;
|
|
124
236
|
/** A scalar 0.0 to 1.0 representing the trigger pull */
|
|
125
237
|
get leftTrigger(): number;
|
|
@@ -129,86 +241,87 @@ export declare class GamepadDevice {
|
|
|
129
241
|
get leftShoulder(): number;
|
|
130
242
|
/** A scalar 0.0 to 1.0 representing the trigger pull */
|
|
131
243
|
get rightShoulder(): number;
|
|
132
|
-
/**
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
|
|
244
|
+
/** Add an event listener */
|
|
245
|
+
on<K extends keyof GamepadDeviceEvent>(event: K, listener: (event: GamepadDeviceEvent[K]) => void): this;
|
|
246
|
+
/** Remove an event listener (or all if none provided). */
|
|
247
|
+
off<K extends keyof GamepadDeviceEvent>(event: K, listener?: (event: GamepadDeviceEvent[K]) => void): this;
|
|
248
|
+
/** Accessors for buttons */
|
|
249
|
+
button: Record<ButtonCode, boolean>;
|
|
250
|
+
/**
|
|
251
|
+
* Play a vibration effect (if supported).
|
|
252
|
+
*
|
|
253
|
+
* This API only works in browsers that support it.
|
|
254
|
+
* @see https://caniuse.com/mdn-api_gamepad_vibrationactuator
|
|
255
|
+
*/
|
|
256
|
+
playVibration({ duration, weakMagnitude, strongMagnitude, vibrationType, rightTrigger, leftTrigger, startDelay, }?: GamepadVibration): void;
|
|
140
257
|
update(source: Gamepad, now: number): void;
|
|
141
258
|
clear(): void;
|
|
142
259
|
constructor(source: Gamepad);
|
|
143
260
|
private updatePresses;
|
|
144
261
|
}
|
|
145
|
-
export declare class
|
|
146
|
-
static
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
/** Global keyboard. These inputs are always up to date.. */
|
|
150
|
-
readonly keyboard: KeyboardDevice;
|
|
151
|
-
/** Connected gamepads. Keep in mind these inputs are only up-to-date from the last update(). */
|
|
152
|
-
get gamepads(): readonly GamepadDevice[];
|
|
153
|
-
/** Connected devices. Keep in mind these inputs may only be up-to-date from the last update(). */
|
|
154
|
-
get devices(): readonly InputDevice[];
|
|
155
|
-
options: {
|
|
156
|
-
clearInputInBackground: boolean;
|
|
157
|
-
};
|
|
158
|
-
private _devices;
|
|
159
|
-
private _gamepadDevices;
|
|
160
|
-
private _gamepadDeviceMap;
|
|
161
|
-
private constructor();
|
|
262
|
+
export declare class KeyboardDevice {
|
|
263
|
+
static global: KeyboardDevice;
|
|
264
|
+
readonly type = "keyboard";
|
|
265
|
+
readonly id = "keyboard";
|
|
162
266
|
/**
|
|
163
|
-
*
|
|
267
|
+
* Associate custom meta data with a device.
|
|
164
268
|
*/
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
add(device: CustomDevice): void;
|
|
168
|
-
/** Remove a custom device. */
|
|
169
|
-
remove(device: InputDevice): void;
|
|
269
|
+
readonly meta: Record<string, any>;
|
|
270
|
+
lastUpdated: number;
|
|
170
271
|
/**
|
|
171
|
-
*
|
|
272
|
+
* Detect layout from keypresses.
|
|
273
|
+
*
|
|
274
|
+
* This will continuously check "keydown" events until the
|
|
275
|
+
* layout can be determined.
|
|
172
276
|
*/
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
Escape: "navigateBack";
|
|
186
|
-
ArrowDown: "navigateDown";
|
|
187
|
-
ArrowLeft: "navigateLeft";
|
|
188
|
-
ArrowRight: "navigateRight";
|
|
189
|
-
ArrowUp: "navigateUp";
|
|
190
|
-
};
|
|
191
|
-
};
|
|
277
|
+
detectLayoutOnKeypress: boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Keyboard has been detected.
|
|
280
|
+
*/
|
|
281
|
+
detected: boolean;
|
|
282
|
+
private _layout;
|
|
283
|
+
private _layoutSource;
|
|
284
|
+
private _emitter;
|
|
285
|
+
/** Add an event listener. */
|
|
286
|
+
on<K extends keyof KeyboardDeviceEvent>(event: K, listener: (event: KeyboardDeviceEvent[K]) => void): this;
|
|
287
|
+
/** Remove an event listener (or all if none provided). */
|
|
288
|
+
off<K extends keyof KeyboardDeviceEvent>(event: K, listener: (event: KeyboardDeviceEvent[K]) => void): this;
|
|
192
289
|
options: {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
12: "navigateUp";
|
|
290
|
+
/**
|
|
291
|
+
* Keys to prevent default event propagation for.
|
|
292
|
+
*/
|
|
293
|
+
preventDefaultKeys: Set<KeyCode>;
|
|
294
|
+
navigation: {
|
|
295
|
+
enabled: boolean;
|
|
296
|
+
binds: Partial<Record<KeyCode, NavigationIntent>>;
|
|
201
297
|
};
|
|
202
298
|
};
|
|
203
|
-
|
|
299
|
+
private constructor();
|
|
300
|
+
/**
|
|
301
|
+
* Keyboard Layout
|
|
302
|
+
*
|
|
303
|
+
* If not set manually, this is determined by the browser (in
|
|
304
|
+
* browsers that support detection), otherwise layout is inferred
|
|
305
|
+
* on keypress, or from device language.
|
|
306
|
+
*
|
|
307
|
+
* Supports the "big four": `"QWERTY"`, `"AZERTY"`, `"QWERTZ"`,
|
|
308
|
+
* and `"JCUKEN"` - i.e. it does not include specialized layouts
|
|
309
|
+
* (e.g. Dvorak, Colemak, BÉPO), or regional layouts (e.g. Hangeul,
|
|
310
|
+
* Kana) etc.
|
|
311
|
+
*
|
|
312
|
+
* When not set explicitly, this is provided by the browser,
|
|
313
|
+
* or detected by keystrokes, or finally inferred from the
|
|
314
|
+
* browser's language.
|
|
315
|
+
*
|
|
316
|
+
* @example "JCUKEN"
|
|
317
|
+
*/
|
|
318
|
+
get layout(): KeyboardLayout;
|
|
319
|
+
set layout(value: KeyboardLayout);
|
|
320
|
+
/** How the keyboard layout was determined. */
|
|
321
|
+
get layoutSource(): KeyboardLayoutSource;
|
|
322
|
+
private configureEventListeners;
|
|
204
323
|
/** Accessors for keys */
|
|
205
324
|
key: Record<KeyCode, boolean>;
|
|
206
|
-
/** Check whether a key is pressed */
|
|
207
|
-
pressing(key: KeyCode): boolean;
|
|
208
|
-
/** Check whether all buttons in a group are pressed */
|
|
209
|
-
pressingAll(group: KeyCode[]): boolean;
|
|
210
|
-
/** Check whether at least one button in a group is pressed */
|
|
211
|
-
pressingAny(group: KeyCode[]): boolean;
|
|
212
325
|
/**
|
|
213
326
|
* Get the label for the given key code in the current keyboard layout.
|
|
214
327
|
*
|
|
@@ -225,45 +338,6 @@ export declare class KeyboardDevice {
|
|
|
225
338
|
*/
|
|
226
339
|
clear(): void;
|
|
227
340
|
}
|
|
228
|
-
/**
|
|
229
|
-
* Responsible for global navigation interactions.
|
|
230
|
-
*
|
|
231
|
-
* Set stageRoot to enable the global responder behaviors.
|
|
232
|
-
*/
|
|
233
|
-
export declare class Navigation {
|
|
234
|
-
static shared: Navigation;
|
|
235
|
-
/**
|
|
236
|
-
* Set the stage root to automatically handle global
|
|
237
|
-
* navigation intents.
|
|
238
|
-
*/
|
|
239
|
-
stageRoot?: Container;
|
|
240
|
-
private _focused?;
|
|
241
|
-
private _responderStack;
|
|
242
|
-
private constructor();
|
|
243
|
-
/**
|
|
244
|
-
* Active global interaction target
|
|
245
|
-
*/
|
|
246
|
-
get firstResponder(): NavigationResponder | undefined;
|
|
247
|
-
/**
|
|
248
|
-
* Stack of global interaction targets
|
|
249
|
-
*/
|
|
250
|
-
get responders(): readonly NavigationResponder[];
|
|
251
|
-
/**
|
|
252
|
-
* Emit interaction intent to the first responder,
|
|
253
|
-
* or the global responder if none.
|
|
254
|
-
*/
|
|
255
|
-
emit(intent: NavigationIntent, device: InputDevice): void;
|
|
256
|
-
/**
|
|
257
|
-
* Remove the top-most global interaction target
|
|
258
|
-
*/
|
|
259
|
-
popResponder(): NavigationResponder | undefined;
|
|
260
|
-
/**
|
|
261
|
-
* Set the new top-most global interaction target.
|
|
262
|
-
*/
|
|
263
|
-
pushResponder(responder: NavigationResponder): void;
|
|
264
|
-
private _propogateIntent;
|
|
265
|
-
private _handleGlobalIntent;
|
|
266
|
-
}
|
|
267
341
|
export declare const Button: {
|
|
268
342
|
/** A Button (Xbox / Nintendo: "A", PlayStation: "Cross") */
|
|
269
343
|
readonly A: 0;
|
|
@@ -281,9 +355,9 @@ export declare const Button: {
|
|
|
281
355
|
readonly LeftTrigger: 6;
|
|
282
356
|
/** Right Trigger (Xbox: "RT", PlayStation: "R2", Nintendo: "ZR") */
|
|
283
357
|
readonly RightTrigger: 7;
|
|
284
|
-
/**
|
|
358
|
+
/** Back Button (Xbox: "Back", PlayStation: "Share", Nintendo: "Minus") */
|
|
285
359
|
readonly Back: 8;
|
|
286
|
-
/** Start Button (Xbox: "Start", PlayStation: "
|
|
360
|
+
/** Start Button (Xbox: "Start", PlayStation: "Options", Nintendo: "Plus") */
|
|
287
361
|
readonly Start: 9;
|
|
288
362
|
/** Left Stick Press (Xbox / PlayStation: "LS", Nintendo: "L3") */
|
|
289
363
|
readonly LeftStick: 10;
|
|
@@ -298,11 +372,75 @@ export declare const Button: {
|
|
|
298
372
|
/** D-Pad Right */
|
|
299
373
|
readonly DPadRight: 15;
|
|
300
374
|
};
|
|
375
|
+
export declare const InputDevice: InputDeviceManager;
|
|
301
376
|
export declare const KeyCode: {
|
|
377
|
+
readonly AltLeft: "AltLeft";
|
|
378
|
+
readonly AltRight: "AltRight";
|
|
379
|
+
readonly ArrowDown: "ArrowDown";
|
|
302
380
|
readonly ArrowLeft: "ArrowLeft";
|
|
303
381
|
readonly ArrowRight: "ArrowRight";
|
|
304
382
|
readonly ArrowUp: "ArrowUp";
|
|
305
|
-
readonly
|
|
383
|
+
readonly Backquote: "Backquote";
|
|
384
|
+
readonly Backslash: "Backslash";
|
|
385
|
+
readonly Backspace: "Backspace";
|
|
386
|
+
readonly BracketLeft: "BracketLeft";
|
|
387
|
+
readonly BracketRight: "BracketRight";
|
|
388
|
+
readonly CapsLock: "CapsLock";
|
|
389
|
+
readonly Comma: "Comma";
|
|
390
|
+
readonly ContextMenu: "ContextMenu";
|
|
391
|
+
readonly ControlLeft: "ControlLeft";
|
|
392
|
+
readonly ControlRight: "ControlRight";
|
|
393
|
+
readonly Delete: "Delete";
|
|
394
|
+
readonly Digit0: "Digit0";
|
|
395
|
+
readonly Digit1: "Digit1";
|
|
396
|
+
readonly Digit2: "Digit2";
|
|
397
|
+
readonly Digit3: "Digit3";
|
|
398
|
+
readonly Digit4: "Digit4";
|
|
399
|
+
readonly Digit5: "Digit5";
|
|
400
|
+
readonly Digit6: "Digit6";
|
|
401
|
+
readonly Digit7: "Digit7";
|
|
402
|
+
readonly Digit8: "Digit8";
|
|
403
|
+
readonly Digit9: "Digit9";
|
|
404
|
+
readonly End: "End";
|
|
405
|
+
readonly Enter: "Enter";
|
|
406
|
+
readonly Equal: "Equal";
|
|
407
|
+
readonly Escape: "Escape";
|
|
408
|
+
readonly F1: "F1";
|
|
409
|
+
readonly F10: "F10";
|
|
410
|
+
readonly F11: "F11";
|
|
411
|
+
readonly F12: "F12";
|
|
412
|
+
readonly F13: "F13";
|
|
413
|
+
readonly F14: "F14";
|
|
414
|
+
readonly F15: "F15";
|
|
415
|
+
readonly F16: "F16";
|
|
416
|
+
readonly F17: "F17";
|
|
417
|
+
readonly F18: "F18";
|
|
418
|
+
readonly F19: "F19";
|
|
419
|
+
readonly F2: "F2";
|
|
420
|
+
readonly F20: "F20";
|
|
421
|
+
readonly F21: "F21";
|
|
422
|
+
readonly F22: "F22";
|
|
423
|
+
readonly F23: "F23";
|
|
424
|
+
readonly F24: "F24";
|
|
425
|
+
readonly F25: "F25";
|
|
426
|
+
readonly F26: "F26";
|
|
427
|
+
readonly F27: "F27";
|
|
428
|
+
readonly F28: "F28";
|
|
429
|
+
readonly F29: "F29";
|
|
430
|
+
readonly F3: "F3";
|
|
431
|
+
readonly F30: "F30";
|
|
432
|
+
readonly F31: "F31";
|
|
433
|
+
readonly F32: "F32";
|
|
434
|
+
readonly F4: "F4";
|
|
435
|
+
readonly F5: "F5";
|
|
436
|
+
readonly F6: "F6";
|
|
437
|
+
readonly F7: "F7";
|
|
438
|
+
readonly F8: "F8";
|
|
439
|
+
readonly F9: "F9";
|
|
440
|
+
readonly Home: "Home";
|
|
441
|
+
readonly IntlBackslash: "IntlBackslash";
|
|
442
|
+
readonly IntlRo: "IntlRo";
|
|
443
|
+
readonly IntlYen: "IntlYen";
|
|
306
444
|
readonly KeyA: "KeyA";
|
|
307
445
|
readonly KeyB: "KeyB";
|
|
308
446
|
readonly KeyC: "KeyC";
|
|
@@ -329,42 +467,14 @@ export declare const KeyCode: {
|
|
|
329
467
|
readonly KeyX: "KeyX";
|
|
330
468
|
readonly KeyY: "KeyY";
|
|
331
469
|
readonly KeyZ: "KeyZ";
|
|
332
|
-
readonly
|
|
333
|
-
readonly
|
|
334
|
-
readonly
|
|
335
|
-
readonly
|
|
336
|
-
readonly Digit4: "Digit4";
|
|
337
|
-
readonly Digit5: "Digit5";
|
|
338
|
-
readonly Digit6: "Digit6";
|
|
339
|
-
readonly Digit7: "Digit7";
|
|
340
|
-
readonly Digit8: "Digit8";
|
|
341
|
-
readonly Digit9: "Digit9";
|
|
342
|
-
readonly Backquote: "Backquote";
|
|
343
|
-
readonly Backslash: "Backslash";
|
|
344
|
-
readonly Backspace: "Backspace";
|
|
345
|
-
readonly BracketLeft: "BracketLeft";
|
|
346
|
-
readonly BracketRight: "BracketRight";
|
|
347
|
-
readonly Comma: "Comma";
|
|
348
|
-
readonly Delete: "Delete";
|
|
349
|
-
readonly End: "End";
|
|
350
|
-
readonly Enter: "Enter";
|
|
351
|
-
readonly Equal: "Equal";
|
|
352
|
-
readonly Escape: "Escape";
|
|
353
|
-
readonly Home: "Home";
|
|
354
|
-
readonly Minus: "Minus";
|
|
355
|
-
readonly Period: "Period";
|
|
356
|
-
readonly Quote: "Quote";
|
|
357
|
-
readonly Semicolon: "Semicolon";
|
|
358
|
-
readonly Slash: "Slash";
|
|
359
|
-
readonly Space: "Space";
|
|
360
|
-
readonly ShiftRight: "ShiftRight";
|
|
361
|
-
readonly AltRight: "AltRight";
|
|
362
|
-
readonly ControlRight: "ControlRight";
|
|
363
|
-
readonly MetaRight: "MetaRight";
|
|
364
|
-
readonly ShiftLeft: "ShiftLeft";
|
|
365
|
-
readonly AltLeft: "AltLeft";
|
|
366
|
-
readonly ControlLeft: "ControlLeft";
|
|
470
|
+
readonly Lang1: "Lang1";
|
|
471
|
+
readonly Lang2: "Lang2";
|
|
472
|
+
readonly MediaTrackNext: "MediaTrackNext";
|
|
473
|
+
readonly MediaTrackPrevious: "MediaTrackPrevious";
|
|
367
474
|
readonly MetaLeft: "MetaLeft";
|
|
475
|
+
readonly MetaRight: "MetaRight";
|
|
476
|
+
readonly Minus: "Minus";
|
|
477
|
+
readonly NumLock: "NumLock";
|
|
368
478
|
readonly Numpad0: "Numpad0";
|
|
369
479
|
readonly Numpad1: "Numpad1";
|
|
370
480
|
readonly Numpad2: "Numpad2";
|
|
@@ -375,11 +485,38 @@ export declare const KeyCode: {
|
|
|
375
485
|
readonly Numpad7: "Numpad7";
|
|
376
486
|
readonly Numpad8: "Numpad8";
|
|
377
487
|
readonly Numpad9: "Numpad9";
|
|
488
|
+
readonly NumpadAdd: "NumpadAdd";
|
|
489
|
+
readonly NumpadComma: "NumpadComma";
|
|
490
|
+
readonly NumpadDecimal: "NumpadDecimal";
|
|
491
|
+
readonly NumpadDivide: "NumpadDivide";
|
|
492
|
+
readonly NumpadMultiply: "NumpadMultiply";
|
|
493
|
+
readonly NumpadSubtract: "NumpadSubtract";
|
|
494
|
+
readonly OSLeft: "OSLeft";
|
|
495
|
+
readonly Pause: "Pause";
|
|
496
|
+
readonly Period: "Period";
|
|
497
|
+
readonly Quote: "Quote";
|
|
498
|
+
readonly ScrollLock: "ScrollLock";
|
|
499
|
+
readonly Semicolon: "Semicolon";
|
|
500
|
+
readonly ShiftLeft: "ShiftLeft";
|
|
501
|
+
readonly ShiftRight: "ShiftRight";
|
|
502
|
+
readonly Slash: "Slash";
|
|
503
|
+
readonly Space: "Space";
|
|
504
|
+
readonly Tab: "Tab";
|
|
505
|
+
readonly VolumeDown: "VolumeDown";
|
|
506
|
+
readonly VolumeMute: "VolumeMute";
|
|
507
|
+
readonly VolumeUp: "VolumeUp";
|
|
508
|
+
readonly WakeUp: "WakeUp";
|
|
378
509
|
};
|
|
510
|
+
/**
|
|
511
|
+
* Responsible for global navigation interactions.
|
|
512
|
+
*
|
|
513
|
+
* Set stage to enable the global responder behaviors.
|
|
514
|
+
*/
|
|
515
|
+
export declare const Navigation: NavigationManager;
|
|
379
516
|
/**
|
|
380
517
|
* @returns all navigatable containers in some container
|
|
381
518
|
*/
|
|
382
|
-
export declare function getAllNavigatables(
|
|
519
|
+
export declare function getAllNavigatables(target: Container, navigatables?: NavigatableContainer[]): NavigatableContainer[];
|
|
383
520
|
/**
|
|
384
521
|
* @returns the first navigatable container in the given direction
|
|
385
522
|
*/
|
|
@@ -387,11 +524,36 @@ export declare function getFirstNavigatable(root: Container, currentFocus?: Cont
|
|
|
387
524
|
minimumDistance?: number;
|
|
388
525
|
}): NavigatableContainer | undefined;
|
|
389
526
|
/**
|
|
390
|
-
*
|
|
527
|
+
* Register the mixin for PIXI.Container.
|
|
528
|
+
*
|
|
529
|
+
* @param container A reference to `PIXI.Container`.
|
|
391
530
|
*/
|
|
392
|
-
export declare function
|
|
393
|
-
|
|
394
|
-
|
|
531
|
+
export declare function registerPixiJSInputDeviceMixin(container: any): void;
|
|
532
|
+
export interface GamepadButtonPressEvent {
|
|
533
|
+
device: GamepadDevice;
|
|
534
|
+
button: Button;
|
|
535
|
+
buttonCode: ButtonCode;
|
|
536
|
+
}
|
|
537
|
+
export interface InputDeviceEvent {
|
|
538
|
+
deviceadded: {
|
|
539
|
+
device: Device;
|
|
540
|
+
};
|
|
541
|
+
deviceremoved: {
|
|
542
|
+
device: Device;
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
export interface KeyboardDeviceKeydownEvent {
|
|
546
|
+
event: KeyboardEvent;
|
|
547
|
+
device: KeyboardDevice;
|
|
548
|
+
keyCode: KeyCode;
|
|
549
|
+
/** Layout-specific label for key. @example "Ц" // JCUKEN for "KeyW" */
|
|
550
|
+
keyLabel: string;
|
|
551
|
+
}
|
|
552
|
+
export interface KeyboardDeviceLayoutUpdatedEvent {
|
|
553
|
+
device: KeyboardDevice;
|
|
554
|
+
layout: KeyboardLayout;
|
|
555
|
+
layoutSource: KeyboardLayoutSource;
|
|
556
|
+
}
|
|
395
557
|
/**
|
|
396
558
|
* A target that responds to navigation on the stack.
|
|
397
559
|
*/
|
|
@@ -403,7 +565,7 @@ export interface NavigationResponder {
|
|
|
403
565
|
* Unhandled interaction intents will be bubbled up to the next target. You
|
|
404
566
|
* might return `true` here to prevent any intent from being propagated.
|
|
405
567
|
*/
|
|
406
|
-
handledNavigationIntent?(intent: NavigationIntent, device:
|
|
568
|
+
handledNavigationIntent?(intent: NavigationIntent, device: Device): boolean;
|
|
407
569
|
/**
|
|
408
570
|
* This method is triggered when the target became the first responder.
|
|
409
571
|
*
|
|
@@ -419,43 +581,42 @@ export interface NavigationResponder {
|
|
|
419
581
|
resignedAsFirstResponder?(): void;
|
|
420
582
|
}
|
|
421
583
|
export type Button = (typeof Button)[keyof typeof Button];
|
|
422
|
-
|
|
423
|
-
export type
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
[
|
|
427
|
-
|
|
428
|
-
[Button
|
|
429
|
-
[Button.RightShoulder]: GamepadButton;
|
|
430
|
-
[Button.LeftTrigger]: GamepadButton;
|
|
431
|
-
[Button.RightTrigger]: GamepadButton;
|
|
432
|
-
[Button.Back]: GamepadButton;
|
|
433
|
-
[Button.Start]: GamepadButton;
|
|
434
|
-
[Button.LeftStick]: GamepadButton;
|
|
435
|
-
[Button.RightStick]: GamepadButton;
|
|
436
|
-
[Button.DPadUp]: GamepadButton;
|
|
437
|
-
[Button.DPadDown]: GamepadButton;
|
|
438
|
-
[Button.DPadLeft]: GamepadButton;
|
|
439
|
-
[Button.DPadRight]: GamepadButton;
|
|
584
|
+
export type ButtonCode = typeof ButtonCode[number];
|
|
585
|
+
export type Device = GamepadDevice | KeyboardDevice | CustomDevice;
|
|
586
|
+
export type GamepadButtonDownEvent = (gamepad: GamepadDevice, button: Button) => void;
|
|
587
|
+
export type GamepadDeviceEvent = {} & {
|
|
588
|
+
[button in ButtonCode]: GamepadButtonPressEvent;
|
|
589
|
+
} & {
|
|
590
|
+
[button in Button]: GamepadButtonPressEvent;
|
|
440
591
|
};
|
|
441
592
|
export type GamepadDeviceSource = {
|
|
442
593
|
source: Gamepad;
|
|
443
594
|
};
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
* Note: Non-comprehensive list, covers the most brands only.
|
|
448
|
-
*/
|
|
449
|
-
export type GamepadPlatform = "logitech" | "nintendo" | "playstation" | "steam" | "xbox" | "other";
|
|
450
|
-
export type InputDevice = GamepadDevice | KeyboardDevice | CustomDevice;
|
|
595
|
+
export type GamepadVibration = GamepadEffectParameters & {
|
|
596
|
+
vibrationType?: GamepadHapticEffectType;
|
|
597
|
+
};
|
|
451
598
|
export type KeyCode = (typeof KeyCode)[keyof typeof KeyCode];
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
599
|
+
export type KeyboardDeviceEvent = {
|
|
600
|
+
layoutdetected: KeyboardDeviceLayoutUpdatedEvent;
|
|
601
|
+
} & {
|
|
602
|
+
[key in KeyCode]: KeyboardDeviceKeydownEvent;
|
|
603
|
+
};
|
|
455
604
|
export type KeyboardLayout = "QWERTY" | "AZERTY" | "JCUKEN" | "QWERTZ";
|
|
605
|
+
export type KeyboardLayoutSource = "browser" | "lang" | "keypress" | "manual";
|
|
456
606
|
export type NavigatableContainer = Container;
|
|
457
607
|
export type NavigationDirection = "navigateLeft" | "navigateRight" | "navigateUp" | "navigateDown";
|
|
458
608
|
export type NavigationIntent = "navigateBack" | "navigateDown" | "navigateLeft" | "navigateRight" | "navigateUp" | "trigger";
|
|
459
609
|
export type NavigationTargetEvent = "focus" | "blur";
|
|
610
|
+
export type RemapNintendoMode = "none" | "accurate" | "physical";
|
|
611
|
+
/**
|
|
612
|
+
* Common gamepad platform layouts, which may indicate button layout.
|
|
613
|
+
*
|
|
614
|
+
* Note: Non-comprehensive list, covers the most brands only.
|
|
615
|
+
*/
|
|
616
|
+
type GamepadLayout = "logitech" | "nintendo" | "playstation" | "steam" | "xbox" | "generic";
|
|
617
|
+
|
|
618
|
+
export {
|
|
619
|
+
GamepadLayout as GamepadPlatform,
|
|
620
|
+
};
|
|
460
621
|
|
|
461
622
|
export {};
|