tiny-essentials 1.20.2 → 1.21.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.
Files changed (123) hide show
  1. package/README.md +13 -11
  2. package/dist/_/numbers.cjs +136 -0
  3. package/dist/_/numbers.d.mts +24 -0
  4. package/dist/_/numbers.mjs +102 -0
  5. package/dist/v1/TinyAdvancedRaffle.min.js +1 -0
  6. package/dist/v1/TinyArrayPaginator.min.js +1 -0
  7. package/dist/v1/TinyBasicsEs.min.js +1 -1
  8. package/dist/v1/TinyCookieConsent.min.js +1 -0
  9. package/dist/v1/TinyDayNightCycle.min.js +1 -0
  10. package/dist/v1/TinyEssentials.min.js +1 -1
  11. package/dist/v1/TinyGamepad.min.js +1 -0
  12. package/dist/v1/TinyI18.min.js +1 -0
  13. package/dist/v1/TinyInventory.min.js +1 -0
  14. package/dist/v1/TinyInventoryTrader.min.js +1 -0
  15. package/dist/v1/TinyLocalStorage.min.js +1 -1
  16. package/dist/v1/TinyRateLimiter.min.js +1 -1
  17. package/dist/v1/TinySmartScroller.min.js +1 -1
  18. package/dist/v1/TinyTextarea.min.js +1 -0
  19. package/dist/v1/TinyToastNotify.min.js +1 -1
  20. package/dist/v1/TinyUploadClicker.min.js +1 -1
  21. package/dist/v1/basics/array.cjs +21 -0
  22. package/dist/v1/basics/array.d.mts +8 -0
  23. package/dist/v1/basics/array.mjs +18 -0
  24. package/dist/v1/basics/index.cjs +2 -8
  25. package/dist/v1/basics/index.d.mts +3 -8
  26. package/dist/v1/basics/index.mjs +2 -3
  27. package/dist/v1/basics/simpleMath.cjs +46 -0
  28. package/dist/v1/basics/simpleMath.d.mts +27 -0
  29. package/dist/v1/basics/simpleMath.mjs +42 -0
  30. package/dist/v1/build/TinyAdvancedRaffle.cjs +7 -0
  31. package/dist/v1/build/TinyAdvancedRaffle.d.mts +3 -0
  32. package/dist/v1/build/TinyAdvancedRaffle.mjs +2 -0
  33. package/dist/v1/build/TinyArrayPaginator.cjs +7 -0
  34. package/dist/v1/build/TinyArrayPaginator.d.mts +3 -0
  35. package/dist/v1/build/TinyArrayPaginator.mjs +2 -0
  36. package/dist/v1/build/TinyCookieConsent.cjs +7 -0
  37. package/dist/v1/build/TinyCookieConsent.d.mts +3 -0
  38. package/dist/v1/build/TinyCookieConsent.mjs +2 -0
  39. package/dist/v1/build/TinyDayNightCycle.cjs +7 -0
  40. package/dist/v1/build/TinyDayNightCycle.d.mts +3 -0
  41. package/dist/v1/build/TinyDayNightCycle.mjs +2 -0
  42. package/dist/v1/build/TinyGamepad.cjs +7 -0
  43. package/dist/v1/build/TinyGamepad.d.mts +3 -0
  44. package/dist/v1/build/TinyGamepad.mjs +2 -0
  45. package/dist/v1/build/TinyI18.cjs +7 -0
  46. package/dist/v1/build/TinyI18.d.mts +3 -0
  47. package/dist/v1/build/TinyI18.mjs +2 -0
  48. package/dist/v1/build/TinyInventory.cjs +7 -0
  49. package/dist/v1/build/TinyInventory.d.mts +3 -0
  50. package/dist/v1/build/TinyInventory.mjs +2 -0
  51. package/dist/v1/build/TinyInventoryTrader.cjs +7 -0
  52. package/dist/v1/build/TinyInventoryTrader.d.mts +3 -0
  53. package/dist/v1/build/TinyInventoryTrader.mjs +2 -0
  54. package/dist/v1/build/TinyTextarea.cjs +7 -0
  55. package/dist/v1/build/TinyTextarea.d.mts +3 -0
  56. package/dist/v1/build/TinyTextarea.mjs +2 -0
  57. package/dist/v1/css/TinyCookieConsent.min.css +1 -0
  58. package/dist/v1/index.cjs +20 -8
  59. package/dist/v1/index.d.mts +12 -8
  60. package/dist/v1/index.mjs +11 -3
  61. package/dist/v1/libs/TinyAdvancedRaffle.cjs +1654 -0
  62. package/dist/v1/libs/TinyAdvancedRaffle.d.mts +851 -0
  63. package/dist/v1/libs/TinyAdvancedRaffle.mjs +1477 -0
  64. package/dist/v1/libs/TinyArrayPaginator.cjs +132 -0
  65. package/dist/v1/libs/TinyArrayPaginator.d.mts +78 -0
  66. package/dist/v1/libs/TinyArrayPaginator.mjs +119 -0
  67. package/dist/v1/libs/TinyCookieConsent.cjs +278 -0
  68. package/dist/v1/libs/TinyCookieConsent.d.mts +142 -0
  69. package/dist/v1/libs/TinyCookieConsent.mjs +248 -0
  70. package/dist/v1/libs/TinyDayNightCycle.cjs +1389 -0
  71. package/dist/v1/libs/TinyDayNightCycle.d.mts +673 -0
  72. package/dist/v1/libs/TinyDayNightCycle.mjs +1232 -0
  73. package/dist/v1/libs/TinyGamepad.cjs +2690 -0
  74. package/dist/v1/libs/TinyGamepad.d.mts +1286 -0
  75. package/dist/v1/libs/TinyGamepad.mjs +2386 -0
  76. package/dist/v1/libs/TinyHtml.d.mts +2 -2
  77. package/dist/v1/libs/TinyI18.cjs +946 -0
  78. package/dist/v1/libs/TinyI18.d.mts +418 -0
  79. package/dist/v1/libs/TinyI18.mjs +873 -0
  80. package/dist/v1/libs/TinyInventory.cjs +1788 -0
  81. package/dist/v1/libs/TinyInventory.d.mts +871 -0
  82. package/dist/v1/libs/TinyInventory.mjs +1650 -0
  83. package/dist/v1/libs/TinyInventoryTrader.cjs +242 -0
  84. package/dist/v1/libs/TinyInventoryTrader.d.mts +95 -0
  85. package/dist/v1/libs/TinyInventoryTrader.mjs +212 -0
  86. package/dist/v1/libs/TinyLocalStorage.cjs +14 -1
  87. package/dist/v1/libs/TinyLocalStorage.mjs +8 -1
  88. package/dist/v1/libs/TinyRateLimiter.cjs +0 -13
  89. package/dist/v1/libs/TinyRateLimiter.d.mts +0 -8
  90. package/dist/v1/libs/TinyRateLimiter.mjs +0 -12
  91. package/dist/v1/libs/TinySmartScroller.cjs +51 -15
  92. package/dist/v1/libs/TinySmartScroller.d.mts +28 -12
  93. package/dist/v1/libs/TinySmartScroller.mjs +44 -14
  94. package/dist/v1/libs/TinyTextarea.cjs +230 -0
  95. package/dist/v1/libs/TinyTextarea.d.mts +128 -0
  96. package/dist/v1/libs/TinyTextarea.mjs +198 -0
  97. package/dist/v1/libs/TinyToastNotify.cjs +2 -2
  98. package/dist/v1/libs/TinyToastNotify.mjs +2 -2
  99. package/dist/v1/libs/TinyUploadClicker.cjs +1 -1
  100. package/docs/v1/Ai-Tips.md +51 -0
  101. package/docs/v1/Personal-Ai-Prompts(portuguese).md +134 -0
  102. package/docs/v1/Personal-Ai-Prompts.md +113 -0
  103. package/docs/v1/README.md +24 -0
  104. package/docs/v1/basics/array.md +17 -0
  105. package/docs/v1/basics/simpleMath.md +73 -0
  106. package/docs/v1/libs/TinyAdvancedRaffle.md +674 -0
  107. package/docs/v1/libs/TinyArrayPaginator.md +150 -0
  108. package/docs/v1/libs/TinyCookieConsent.md +152 -0
  109. package/docs/v1/libs/TinyDayNightCycle.md +711 -0
  110. package/docs/v1/libs/TinyGamepad.md +980 -0
  111. package/docs/v1/libs/TinyI18.md +515 -0
  112. package/docs/v1/libs/TinyInventory.md +777 -0
  113. package/docs/v1/libs/TinyInventoryTrader.md +114 -0
  114. package/docs/v1/libs/TinySmartScroller.md +4 -4
  115. package/docs/v1/libs/TinyTextarea.md +156 -0
  116. package/package.json +7 -5
  117. package/dist/v1/basics/html_deprecated.cjs +0 -124
  118. package/dist/v1/basics/html_deprecated.d.mts +0 -40
  119. package/dist/v1/basics/html_deprecated.mjs +0 -97
  120. package/dist/v1/css/TinyDraggerExample.css +0 -21
  121. package/dist/v1/css/TinyNotify.css +0 -350
  122. package/dist/v1/css/aiMarker.css +0 -4
  123. package/docs/v1/basics/html_deprecated.md +0 -127
@@ -0,0 +1,1286 @@
1
+ export default TinyGamepad;
2
+ /**
3
+ * Describes the status of a key or button.
4
+ */
5
+ export type KeyStatus = {
6
+ /**
7
+ * - Whether the key is currently pressed.
8
+ */
9
+ pressed: boolean;
10
+ /**
11
+ * - Optional analog value associated with the key.
12
+ */
13
+ value?: number | undefined;
14
+ /**
15
+ * - Optional second analog value.
16
+ */
17
+ value2?: number | undefined;
18
+ };
19
+ /**
20
+ * Defines the available input modes.
21
+ */
22
+ export type InputMode = "gamepad-only" | "keyboard-only" | "both";
23
+ /**
24
+ * A callback function that is invoked when a mapped logical input is activated or deactivated.
25
+ *
26
+ * This function receives the logical name associated with the input (e.g., "Jump", "Shoot", "Menu")
27
+ * and can be used to handle input-related actions such as triggering game mechanics or UI behavior.
28
+ */
29
+ export type MappedInputCallback = (payload: {
30
+ logicalName: string;
31
+ activeTime: number;
32
+ comboTime: number;
33
+ }) => void;
34
+ /**
35
+ * A callback function that is invoked when a mapped key is activated or deactivated.
36
+ *
37
+ * This function receives the key name associated with the input (e.g., "KeyA", "KeyB", "KeyC")
38
+ * and can be used to handle input-related actions such as triggering game mechanics or UI behavior.
39
+ */
40
+ export type MappedKeyCallback = (payload: {
41
+ key: string;
42
+ activeTime: number;
43
+ }) => void;
44
+ /**
45
+ * Callback for handling input events.
46
+ */
47
+ export type PayloadCallback = (payload: InputPayload | InputAnalogPayload) => void;
48
+ /**
49
+ * Callback for handling gamepad connection events.
50
+ */
51
+ export type ConnectionCallback = (payload: ConnectionPayload) => void;
52
+ /**
53
+ * A callback function that is triggered when a registered input sequence is fully activated.
54
+ */
55
+ export type InputSequenceCallback = (timestamp: number) => any;
56
+ /**
57
+ * A callback function that is triggered when a registered key sequence is fully activated.
58
+ */
59
+ export type KeySequenceCallback = (timestamp: number) => any;
60
+ /**
61
+ * Represents any valid callback type used in the TinyGamepad event system.
62
+ * This is a union of all supported callback signatures.
63
+ */
64
+ export type CallbackList = ConnectionCallback | PayloadCallback | MappedInputCallback | MappedKeyCallback;
65
+ /**
66
+ * Represents a specific input source from a gamepad.
67
+ * - 'gamepad-analog' refers to analog sticks or analog triggers.
68
+ * - 'gamepad-button' refers to digital buttons on the gamepad.
69
+ */
70
+ export type GamepadDeviceSource = "gamepad-analog" | "gamepad-button";
71
+ /**
72
+ * Represents any possible physical device source that can be used for input.
73
+ * - 'mouse': Input from a mouse.
74
+ * - 'keyboard': Input from a keyboard.
75
+ * - 'gamepad-analog': Analog input from a gamepad (e.g., sticks, triggers).
76
+ * - 'gamepad-button': Digital button input from a gamepad.
77
+ */
78
+ export type DeviceSource = "mouse" | "keyboard" | GamepadDeviceSource;
79
+ /**
80
+ * Represents the type of input interaction detected.
81
+ * - 'up': Input was released.
82
+ * - 'down': Input was pressed.
83
+ * - 'hold': Input is being held.
84
+ * - 'change': Input value changed (e.g., pressure or axis).
85
+ * - 'move': Analog movement detected (e.g., joystick motion).
86
+ */
87
+ export type DeviceInputType = "up" | "down" | "hold" | "change" | "move";
88
+ /**
89
+ * Structure for digital button input payload.
90
+ */
91
+ export type InputPayload = {
92
+ /**
93
+ * - Unique identifier for the input.
94
+ */
95
+ id: string;
96
+ /**
97
+ * - Optional DOM event reference.
98
+ */
99
+ event?: Event | undefined;
100
+ /**
101
+ * - Type of input event (down, up, hold).
102
+ */
103
+ type: DeviceInputType;
104
+ /**
105
+ * - Input source (keyboard, mouse, gamepad).
106
+ */
107
+ source: DeviceSource;
108
+ /**
109
+ * - Physical input identifier.
110
+ */
111
+ key: string;
112
+ /**
113
+ * - Whether the input is pressure sensitive.
114
+ */
115
+ isPressure: boolean;
116
+ /**
117
+ * - Logical name associated with the input.
118
+ */
119
+ logicalName: string;
120
+ /**
121
+ * - Primary analog value.
122
+ */
123
+ value: number;
124
+ /**
125
+ * - Secondary analog value.
126
+ */
127
+ value2: number;
128
+ /**
129
+ * - Current pressed status.
130
+ */
131
+ pressed: boolean;
132
+ /**
133
+ * - Previous pressed status.
134
+ */
135
+ prevPressed?: boolean | null | undefined;
136
+ /**
137
+ * - Timestamp of the event.
138
+ */
139
+ timestamp: number;
140
+ /**
141
+ * - Reference to the originating Gamepad.
142
+ */
143
+ gp?: Gamepad | undefined;
144
+ };
145
+ /**
146
+ * Structure for analog input payload.
147
+ */
148
+ export type InputAnalogPayload = {
149
+ /**
150
+ * - Unique identifier for the input.
151
+ */
152
+ id: string;
153
+ /**
154
+ * - Optional DOM event reference.
155
+ */
156
+ event?: Event | undefined;
157
+ /**
158
+ * - Type of input event (change).
159
+ */
160
+ type: DeviceInputType;
161
+ /**
162
+ * - Input source.
163
+ */
164
+ source: DeviceSource;
165
+ /**
166
+ * - Physical input identifier.
167
+ */
168
+ key: string;
169
+ /**
170
+ * - Logical name associated with the input.
171
+ */
172
+ logicalName: string;
173
+ /**
174
+ * - Analog value.
175
+ */
176
+ value: number;
177
+ /**
178
+ * - Secondary analog value.
179
+ */
180
+ value2: number;
181
+ /**
182
+ * - Timestamp of the event.
183
+ */
184
+ timestamp: number;
185
+ /**
186
+ * - Reference to the originating Gamepad.
187
+ */
188
+ gp?: Gamepad | undefined;
189
+ };
190
+ /**
191
+ * Internal structure for digital input events.
192
+ */
193
+ export type InputEvents = {
194
+ /**
195
+ * - Unique identifier for the input.
196
+ */
197
+ id: string;
198
+ /**
199
+ * - Optional DOM event reference.
200
+ */
201
+ event?: Event | undefined;
202
+ /**
203
+ * - Input key identifier.
204
+ */
205
+ key: string;
206
+ /**
207
+ * - Source of the input.
208
+ */
209
+ source: DeviceSource;
210
+ /**
211
+ * - Value of the input.
212
+ */
213
+ value: number;
214
+ /**
215
+ * - Secondary value.
216
+ */
217
+ value2: number;
218
+ /**
219
+ * - Type of input event.
220
+ */
221
+ type: DeviceInputType;
222
+ /**
223
+ * - Whether it is pressure-sensitive.
224
+ */
225
+ isPressure: boolean;
226
+ /**
227
+ * - Pressed status.
228
+ */
229
+ pressed: boolean;
230
+ /**
231
+ * - Previous pressed status.
232
+ */
233
+ prevPressed?: boolean | null | undefined;
234
+ /**
235
+ * - Timestamp of the event.
236
+ */
237
+ timestamp: number;
238
+ /**
239
+ * - Reference to the gamepad.
240
+ */
241
+ gp?: Gamepad | undefined;
242
+ };
243
+ /**
244
+ * Internal structure for analog input events.
245
+ */
246
+ export type InputAnalogEvents = {
247
+ /**
248
+ * - Unique identifier for the input.
249
+ */
250
+ id: string;
251
+ /**
252
+ * - Optional DOM event reference.
253
+ */
254
+ event?: Event | undefined;
255
+ /**
256
+ * - Analog key.
257
+ */
258
+ key: string;
259
+ /**
260
+ * - Source of input.
261
+ */
262
+ source: DeviceSource;
263
+ /**
264
+ * - Main analog value.
265
+ */
266
+ value: number;
267
+ /**
268
+ * - Secondary analog value.
269
+ */
270
+ value2: number;
271
+ /**
272
+ * - Type of event.
273
+ */
274
+ type: DeviceInputType;
275
+ /**
276
+ * - Timestamp.
277
+ */
278
+ timestamp: number;
279
+ /**
280
+ * - Gamepad reference.
281
+ */
282
+ gp?: Gamepad | undefined;
283
+ };
284
+ /**
285
+ * Payload for connection-related events.
286
+ */
287
+ export type ConnectionPayload = {
288
+ /**
289
+ * - ID of the gamepad.
290
+ */
291
+ id: string;
292
+ /**
293
+ * - Timestamp of the event.
294
+ */
295
+ timestamp: number;
296
+ /**
297
+ * - Gamepad instance.
298
+ */
299
+ gp: Gamepad;
300
+ };
301
+ export type ExportedConfig = {
302
+ /**
303
+ * - The expected identifier for a specific gamepad device, or null if not set.
304
+ */
305
+ expectedId: string | null;
306
+ /**
307
+ * - Array of device IDs to be ignored (excluded from input detection).
308
+ */
309
+ ignoreIds: string[];
310
+ /**
311
+ * - The threshold value below which analog stick inputs are ignored (dead zone).
312
+ */
313
+ deadZone: number;
314
+ /**
315
+ * - Time in milliseconds allowed between consecutive inputs in a combo sequence before it resets.
316
+ */
317
+ timeoutComboKeys: number;
318
+ /**
319
+ * - Sensitivity threshold for detecting significant analog axis movement (0 = most sensitive, 1 = least sensitive).
320
+ */
321
+ axisActiveSensitivity: number;
322
+ /**
323
+ * - Array of key-value pairs representing the mapping between logical input names and physical input(s).
324
+ */
325
+ inputMap: [string, string | string[]][];
326
+ };
327
+ /**
328
+ * @typedef {Object} KeyStatus
329
+ * Describes the status of a key or button.
330
+ * @property {boolean} pressed - Whether the key is currently pressed.
331
+ * @property {number} [value] - Optional analog value associated with the key.
332
+ * @property {number} [value2] - Optional second analog value.
333
+ */
334
+ /**
335
+ * @typedef {'gamepad-only' | 'keyboard-only' | 'both'} InputMode
336
+ * Defines the available input modes.
337
+ */
338
+ /**
339
+ * A callback function that is invoked when a mapped logical input is activated or deactivated.
340
+ *
341
+ * This function receives the logical name associated with the input (e.g., "Jump", "Shoot", "Menu")
342
+ * and can be used to handle input-related actions such as triggering game mechanics or UI behavior.
343
+ *
344
+ * @typedef {(payload: { logicalName: string, activeTime: number, comboTime: number }) => void} MappedInputCallback
345
+ */
346
+ /**
347
+ * A callback function that is invoked when a mapped key is activated or deactivated.
348
+ *
349
+ * This function receives the key name associated with the input (e.g., "KeyA", "KeyB", "KeyC")
350
+ * and can be used to handle input-related actions such as triggering game mechanics or UI behavior.
351
+ *
352
+ * @typedef {(payload: { key: string, activeTime: number }) => void} MappedKeyCallback
353
+ */
354
+ /**
355
+ * @typedef {(payload: InputPayload|InputAnalogPayload) => void} PayloadCallback
356
+ * Callback for handling input events.
357
+ */
358
+ /**
359
+ * @typedef {(payload: ConnectionPayload) => void} ConnectionCallback
360
+ * Callback for handling gamepad connection events.
361
+ */
362
+ /**
363
+ * A callback function that is triggered when a registered input sequence is fully activated.
364
+ *
365
+ * @callback InputSequenceCallback
366
+ * @param {number} timestamp - The moment in milliseconds when the sequence was successfully detected.
367
+ */
368
+ /**
369
+ * A callback function that is triggered when a registered key sequence is fully activated.
370
+ *
371
+ * @callback KeySequenceCallback
372
+ * @param {number} timestamp - The moment in milliseconds when the sequence was successfully detected.
373
+ */
374
+ /**
375
+ * Represents any valid callback type used in the TinyGamepad event system.
376
+ * This is a union of all supported callback signatures.
377
+ * @typedef {ConnectionCallback | PayloadCallback | MappedInputCallback | MappedKeyCallback} CallbackList
378
+ */
379
+ /**
380
+ * Represents a specific input source from a gamepad.
381
+ * - 'gamepad-analog' refers to analog sticks or analog triggers.
382
+ * - 'gamepad-button' refers to digital buttons on the gamepad.
383
+ * @typedef {'gamepad-analog'|'gamepad-button'} GamepadDeviceSource
384
+ */
385
+ /**
386
+ * Represents any possible physical device source that can be used for input.
387
+ * - 'mouse': Input from a mouse.
388
+ * - 'keyboard': Input from a keyboard.
389
+ * - 'gamepad-analog': Analog input from a gamepad (e.g., sticks, triggers).
390
+ * - 'gamepad-button': Digital button input from a gamepad.
391
+ * @typedef {'mouse'|'keyboard'|GamepadDeviceSource} DeviceSource
392
+ */
393
+ /**
394
+ * Represents the type of input interaction detected.
395
+ * - 'up': Input was released.
396
+ * - 'down': Input was pressed.
397
+ * - 'hold': Input is being held.
398
+ * - 'change': Input value changed (e.g., pressure or axis).
399
+ * - 'move': Analog movement detected (e.g., joystick motion).
400
+ * @typedef {'up'|'down'|'hold'|'change'|'move'} DeviceInputType
401
+ */
402
+ /**
403
+ * @typedef {Object} InputPayload
404
+ * Structure for digital button input payload.
405
+ * @property {string} id - Unique identifier for the input.
406
+ * @property {Event} [event] - Optional DOM event reference.
407
+ * @property {DeviceInputType} type - Type of input event (down, up, hold).
408
+ * @property {DeviceSource} source - Input source (keyboard, mouse, gamepad).
409
+ * @property {string} key - Physical input identifier.
410
+ * @property {boolean} isPressure - Whether the input is pressure sensitive.
411
+ * @property {string} logicalName - Logical name associated with the input.
412
+ * @property {number} value - Primary analog value.
413
+ * @property {number} value2 - Secondary analog value.
414
+ * @property {boolean} pressed - Current pressed status.
415
+ * @property {boolean|null} [prevPressed] - Previous pressed status.
416
+ * @property {number} timestamp - Timestamp of the event.
417
+ * @property {Gamepad} [gp] - Reference to the originating Gamepad.
418
+ */
419
+ /**
420
+ * @typedef {Object} InputAnalogPayload
421
+ * Structure for analog input payload.
422
+ * @property {string} id - Unique identifier for the input.
423
+ * @property {Event} [event] - Optional DOM event reference.
424
+ * @property {DeviceInputType} type - Type of input event (change).
425
+ * @property {DeviceSource} source - Input source.
426
+ * @property {string} key - Physical input identifier.
427
+ * @property {string} logicalName - Logical name associated with the input.
428
+ * @property {number} value - Analog value.
429
+ * @property {number} value2 - Secondary analog value.
430
+ * @property {number} timestamp - Timestamp of the event.
431
+ * @property {Gamepad} [gp] - Reference to the originating Gamepad.
432
+ */
433
+ /**
434
+ * @typedef {Object} InputEvents
435
+ * Internal structure for digital input events.
436
+ * @property {string} id - Unique identifier for the input.
437
+ * @property {Event} [event] - Optional DOM event reference.
438
+ * @property {string} key - Input key identifier.
439
+ * @property {DeviceSource} source - Source of the input.
440
+ * @property {number} value - Value of the input.
441
+ * @property {number} value2 - Secondary value.
442
+ * @property {DeviceInputType} type - Type of input event.
443
+ * @property {boolean} isPressure - Whether it is pressure-sensitive.
444
+ * @property {boolean} pressed - Pressed status.
445
+ * @property {boolean|null} [prevPressed] - Previous pressed status.
446
+ * @property {number} timestamp - Timestamp of the event.
447
+ * @property {Gamepad} [gp] - Reference to the gamepad.
448
+ */
449
+ /**
450
+ * @typedef {Object} InputAnalogEvents
451
+ * Internal structure for analog input events.
452
+ * @property {string} id - Unique identifier for the input.
453
+ * @property {Event} [event] - Optional DOM event reference.
454
+ * @property {string} key - Analog key.
455
+ * @property {DeviceSource} source - Source of input.
456
+ * @property {number} value - Main analog value.
457
+ * @property {number} value2 - Secondary analog value.
458
+ * @property {DeviceInputType} type - Type of event.
459
+ * @property {number} timestamp - Timestamp.
460
+ * @property {Gamepad} [gp] - Gamepad reference.
461
+ */
462
+ /**
463
+ * @typedef {Object} ConnectionPayload
464
+ * Payload for connection-related events.
465
+ * @property {string} id - ID of the gamepad.
466
+ * @property {number} timestamp - Timestamp of the event.
467
+ * @property {Gamepad} gp - Gamepad instance.
468
+ */
469
+ /**
470
+ * @typedef {Object} ExportedConfig
471
+ * @property {string | null} expectedId - The expected identifier for a specific gamepad device, or null if not set.
472
+ * @property {string[]} ignoreIds - Array of device IDs to be ignored (excluded from input detection).
473
+ * @property {number} deadZone - The threshold value below which analog stick inputs are ignored (dead zone).
474
+ * @property {number} timeoutComboKeys - Time in milliseconds allowed between consecutive inputs in a combo sequence before it resets.
475
+ * @property {number} axisActiveSensitivity - Sensitivity threshold for detecting significant analog axis movement (0 = most sensitive, 1 = least sensitive).
476
+ * @property {[string, string | string[]][]} inputMap - Array of key-value pairs representing the mapping between logical input names and physical input(s).
477
+ */
478
+ /**
479
+ * TinyGamepad is a high-level and extensible input management system
480
+ * designed for professional-level control schemes in games or applications.
481
+ *
482
+ * It supports input from gamepads, keyboards, and optionally mouse devices.
483
+ * Key features include:
484
+ * - Input mapping from physical controls to logical action names
485
+ * - Pressure-sensitive trigger and button support
486
+ * - Dead zone configuration for analog inputs
487
+ * - Event-based input handling (start, hold, end)
488
+ * - Multiple logical names per input binding
489
+ * - Unified control model for both digital and analog inputs
490
+ *
491
+ * TinyGamepad allows seamless integration of fallback control types,
492
+ * detailed input feedback, and JSON-based profile serialization for saving and restoring mappings.
493
+ */
494
+ declare class TinyGamepad {
495
+ /** @type {Record<string, string>} */
496
+ static "__#22@#specialMap": Record<string, string>;
497
+ /**
498
+ * Add or update a special key mapping.
499
+ * @param {string} char - The character to map.
500
+ * @param {string} code - The corresponding key code.
501
+ */
502
+ static addSpecialKey(char: string, code: string): void;
503
+ /**
504
+ * Remove a special key mapping.
505
+ * @param {string} char - The character to remove from mapping.
506
+ */
507
+ static removeSpecialKey(char: string): void;
508
+ /**
509
+ * Get the mapped code for a special character.
510
+ * @param {string} char - The character to look up.
511
+ * @returns {string | undefined} - The mapped code or undefined if not found.
512
+ */
513
+ static getSpecialKey(char: string): string | undefined;
514
+ /**
515
+ * Get all current special key mappings.
516
+ * @returns {Record<string, string>}
517
+ */
518
+ static getAllSpecialKeys(): Record<string, string>;
519
+ /**
520
+ * Converts a string into an array of TinyGamepad-style key codes.
521
+ * Example: "pudding" → ['KeyP', 'KeyU', 'KeyD', 'KeyD', 'KeyI', 'KeyN', 'KeyG']
522
+ * @param {string} text - Input text.
523
+ * @returns {string[]} Array of key codes.
524
+ */
525
+ static stringToKeys(text: string): string[];
526
+ /**
527
+ * Initializes a new instance of TinyGamepad with customizable input behavior.
528
+ *
529
+ * This constructor allows configuring the expected device ID, the type of inputs to listen for
530
+ * (keyboard, gamepad, or both), analog dead zone sensitivity, and whether to allow mouse input.
531
+ * It also supports filtering out specific devices by ID.
532
+ *
533
+ * @param {Object} options - Configuration object for TinyGamepad behavior.
534
+ * @param {string | null} [options.expectedId=null] - Specific controller ID to expect.
535
+ * @param {InputMode} [options.inputMode='both'] - Mode of input to use.
536
+ * @param {string[]} [options.ignoreIds=[]] - List of device IDs to ignore.
537
+ * @param {number} [options.deadZone=0.1] - Analog stick dead zone threshold.
538
+ * @param {boolean} [options.allowMouse=false] - Whether mouse events should be treated as input triggers.
539
+ * @param {number} [options.timeoutComboKeys=500] - Maximum time (in milliseconds) allowed between inputs in a key sequence before the reset time.
540
+ * @param {number} [options.axisActiveSensitivity=0.3] - Threshold to detect meaningful axis movement (0 = most sensitive, 1 = least sensitive).
541
+ * @param {Window|Element} [options.elementBase=window] - The DOM element or window to bind keyboard and mouse events to.
542
+ */
543
+ constructor({ expectedId, inputMode, ignoreIds, deadZone, axisActiveSensitivity, timeoutComboKeys, allowMouse, elementBase, }?: {
544
+ expectedId?: string | null | undefined;
545
+ inputMode?: InputMode | undefined;
546
+ ignoreIds?: string[] | undefined;
547
+ deadZone?: number | undefined;
548
+ allowMouse?: boolean | undefined;
549
+ timeoutComboKeys?: number | undefined;
550
+ axisActiveSensitivity?: number | undefined;
551
+ elementBase?: Element | Window | undefined;
552
+ });
553
+ /**
554
+ * Waits for a single input event from the user and resolves with detailed input information.
555
+ * This is typically used in control configuration screens to allow the user to choose an input
556
+ * (keyboard, mouse, or gamepad) that will be mapped to a logical action.
557
+ *
558
+ * The function listens for the first eligible input (ignores 'MouseMove') and returns the key,
559
+ * input source, and the Gamepad object if applicable. If no input is received before the timeout,
560
+ * the promise resolves with a `null` key and source.
561
+ *
562
+ * @param {object} [options] - Optional configuration for input capture behavior.
563
+ * @param {number} [options.timeout=10000] - Timeout in milliseconds before the promise resolves automatically with null values.
564
+ * @param {string} [options.eventName='MappingInput'] - The temporary logical event name used internally to listen for input.
565
+ * @param {boolean} [options.canMove=false] - Whether movement-based inputs (e.g., mouse movement) are allowed.
566
+ * @returns {Promise<{ key: string | null, source: DeviceSource | null, gp?: Gamepad }>}
567
+ * A promise that resolves with an object containing:
568
+ * - `key`: the identifier of the pressed input (e.g., "KeyW", "Button0", "LeftClick"),
569
+ * - `source`: the origin of the input ("keyboard", "mouse", "gamepad-button", or "gamepad-analog"),
570
+ * - `gp`: the Gamepad object (only if the input source is a gamepad).
571
+ */
572
+ awaitInputMapping({ timeout, eventName, canMove }?: {
573
+ timeout?: number | undefined;
574
+ eventName?: string | undefined;
575
+ canMove?: boolean | undefined;
576
+ }): Promise<{
577
+ key: string | null;
578
+ source: DeviceSource | null;
579
+ gp?: Gamepad;
580
+ }>;
581
+ /**
582
+ * Assigns a physical input to a logical name (e.g., "Jump" => "Button1")
583
+ * @param {string} logicalName
584
+ * @param {string|string[]} physicalInput
585
+ */
586
+ mapInput(logicalName: string, physicalInput: string | string[]): void;
587
+ /**
588
+ * Removes a logical input mapping
589
+ * @param {string} logicalName
590
+ */
591
+ unmapInput(logicalName: string): void;
592
+ /**
593
+ * Checks if a logical name is mapped to any physical input.
594
+ * @param {string} logicalName
595
+ * @returns {boolean}
596
+ */
597
+ hasMappedInput(logicalName: string): boolean;
598
+ /**
599
+ * Returns the physical input(s) mapped to a given logical name.
600
+ * @param {string} logicalName
601
+ * @returns {string | string[]}
602
+ */
603
+ getMappedInput(logicalName: string): string | string[];
604
+ /**
605
+ * Clears all mappings for all logical inputs.
606
+ */
607
+ clearMapInputs(): void;
608
+ /**
609
+ * Registers a sequence of logical inputs that triggers a specific callback.
610
+ * @param {string[]} sequence - Ordered list of logical input names (e.g., ['Jump', 'Action'])
611
+ * @param {InputSequenceCallback} callback - Function to invoke when the sequence is fully held
612
+ */
613
+ registerInputSequence(sequence: string[], callback: InputSequenceCallback): void;
614
+ /**
615
+ * Unregisters a previously registered input sequence.
616
+ * @param {string[]} sequence - The sequence to remove from detection
617
+ */
618
+ unregisterInputSequence(sequence: string[]): void;
619
+ /**
620
+ * Removes all registered input sequences.
621
+ */
622
+ unregisterAllInputSequences(): void;
623
+ /**
624
+ * Checks whether a given input sequence is currently registered.
625
+ * @param {string[]} sequence - The sequence to check
626
+ * @returns {boolean}
627
+ */
628
+ hasInputSequence(sequence: string[]): boolean;
629
+ /**
630
+ * Registers a sequence of logical inputs that triggers a specific callback.
631
+ * @param {string[]} sequence - Ordered list of logical input names (e.g., ['Jump', 'Action'])
632
+ * @param {InputSequenceCallback} callback - Function to invoke when the sequence is fully held
633
+ */
634
+ registerKeySequence(sequence: string[], callback: InputSequenceCallback): void;
635
+ /**
636
+ * Unregisters a previously registered input sequence.
637
+ * @param {string[]} sequence - The sequence to remove from detection
638
+ */
639
+ unregisterKeySequence(sequence: string[]): void;
640
+ /**
641
+ * Removes all registered input sequences.
642
+ */
643
+ unregisterAllKeySequences(): void;
644
+ /**
645
+ * Checks whether a given input sequence is currently registered.
646
+ * @param {string[]} sequence - The sequence to check
647
+ * @returns {boolean}
648
+ */
649
+ hasKeySequence(sequence: string[]): boolean;
650
+ /**
651
+ * Renew the currently held combo logical keys.
652
+ */
653
+ renewComboMapped(): void;
654
+ /**
655
+ * Resets the currently held key combo logical inputs.
656
+ */
657
+ resetComboMapped(): void;
658
+ /**
659
+ * Registers a callback for when a mapped key is activated (pressed down)
660
+ * @param {MappedInputCallback} callback
661
+ */
662
+ onMappedKeyStart(callback: MappedInputCallback): void;
663
+ /**
664
+ * Registers a one-time callback for the "mapped-key-start" event.
665
+ * The callback will be automatically removed after it runs once.
666
+ * @param {MappedInputCallback} callback
667
+ */
668
+ onceMappedKeyStart(callback: MappedInputCallback): void;
669
+ /**
670
+ * Prepends a callback to the "mapped-key-start" event.
671
+ * @param {MappedInputCallback} callback
672
+ */
673
+ prependMappedKeyStart(callback: MappedInputCallback): void;
674
+ /**
675
+ * Removes a callback from the "mapped-key-start" event.
676
+ * @param {MappedInputCallback} callback
677
+ */
678
+ offMappedKeyStart(callback: MappedInputCallback): void;
679
+ /**
680
+ * Removes all callbacks from the "mapped-key-start" event.
681
+ */
682
+ offAllMappedKeyStart(): void;
683
+ /**
684
+ * Registers a callback for when a mapped key is deactivated (released)
685
+ * @param {MappedInputCallback} callback
686
+ */
687
+ onMappedKeyEnd(callback: MappedInputCallback): void;
688
+ /**
689
+ * Registers a one-time callback for the "mapped-key-end" event.
690
+ * The callback will be automatically removed after it runs once.
691
+ * @param {MappedInputCallback} callback
692
+ */
693
+ onceMappedKeyEnd(callback: MappedInputCallback): void;
694
+ /**
695
+ * Prepends a callback to the "mapped-key-end" event.
696
+ * @param {MappedInputCallback} callback
697
+ */
698
+ prependMappedKeyEnd(callback: MappedInputCallback): void;
699
+ /**
700
+ * Removes a callback from the "mapped-key-end" event.
701
+ * @param {MappedInputCallback} callback
702
+ */
703
+ offMappedKeyEnd(callback: MappedInputCallback): void;
704
+ /**
705
+ * Removes all callbacks from the "mapped-key-end" event.
706
+ */
707
+ offAllMappedKeyEnd(): void;
708
+ /**
709
+ * Registers a callback for when a mapped input is activated (pressed down)
710
+ * @param {MappedInputCallback} callback
711
+ */
712
+ onMappedInputStart(callback: MappedInputCallback): void;
713
+ /**
714
+ * Registers a one-time callback for the "mapped-input-start" event.
715
+ * The callback will be automatically removed after it runs once.
716
+ * @param {MappedInputCallback} callback
717
+ */
718
+ onceMappedInputStart(callback: MappedInputCallback): void;
719
+ /**
720
+ * Prepends a callback to the "mapped-input-start" event.
721
+ * @param {MappedInputCallback} callback
722
+ */
723
+ prependMappedInputStart(callback: MappedInputCallback): void;
724
+ /**
725
+ * Removes a callback from the "mapped-input-start" event.
726
+ * @param {MappedInputCallback} callback
727
+ */
728
+ offMappedInputStart(callback: MappedInputCallback): void;
729
+ /**
730
+ * Removes all callbacks from the "mapped-input-start" event.
731
+ */
732
+ offAllMappedInputStart(): void;
733
+ /**
734
+ * Registers a callback for when a mapped input is deactivated (released)
735
+ * @param {MappedInputCallback} callback
736
+ */
737
+ onMappedInputEnd(callback: MappedInputCallback): void;
738
+ /**
739
+ * Registers a one-time callback for the "mapped-input-end" event.
740
+ * The callback will be automatically removed after it runs once.
741
+ * @param {MappedInputCallback} callback
742
+ */
743
+ onceMappedInputEnd(callback: MappedInputCallback): void;
744
+ /**
745
+ * Prepends a callback to the "mapped-input-end" event.
746
+ * @param {MappedInputCallback} callback
747
+ */
748
+ prependMappedInputEnd(callback: MappedInputCallback): void;
749
+ /**
750
+ * Removes a callback from the "mapped-input-end" event.
751
+ * @param {MappedInputCallback} callback
752
+ */
753
+ offMappedInputEnd(callback: MappedInputCallback): void;
754
+ /**
755
+ * Removes all callbacks from the "mapped-input-end" event.
756
+ */
757
+ offAllMappedInputEnd(): void;
758
+ /**
759
+ * Registers a callback for a logical input
760
+ * @param {string} logicalName
761
+ * @param {PayloadCallback} callback
762
+ */
763
+ onInput(logicalName: string, callback: PayloadCallback): void;
764
+ /**
765
+ * Registers a one-time callback for a logical input.
766
+ * The callback is removed after the first invocation.
767
+ * @param {string} logicalName
768
+ * @param {PayloadCallback} callback
769
+ */
770
+ onceInput(logicalName: string, callback: PayloadCallback): void;
771
+ /**
772
+ * Prepends a callback to the input event list.
773
+ * @param {string} logicalName
774
+ * @param {PayloadCallback} callback
775
+ */
776
+ prependInput(logicalName: string, callback: PayloadCallback): void;
777
+ /**
778
+ * Removes a callback from a specific logical input event.
779
+ * @param {string} logicalName
780
+ * @param {PayloadCallback} callback
781
+ */
782
+ offInput(logicalName: string, callback: PayloadCallback): void;
783
+ /**
784
+ * Registers a callback for the "input-start" event of a logical name
785
+ * @param {string} logicalName
786
+ * @param {PayloadCallback} callback
787
+ */
788
+ onInputStart(logicalName: string, callback: PayloadCallback): void;
789
+ /**
790
+ * Registers a one-time callback for the "input-start" event.
791
+ * @param {string} logicalName
792
+ * @param {PayloadCallback} callback
793
+ */
794
+ onceInputStart(logicalName: string, callback: PayloadCallback): void;
795
+ /**
796
+ * Prepends a callback to the "input-start" event list.
797
+ * @param {string} logicalName
798
+ * @param {PayloadCallback} callback
799
+ */
800
+ prependInputStart(logicalName: string, callback: PayloadCallback): void;
801
+ /**
802
+ * Removes a callback from a specific logical "input-start" event.
803
+ * @param {string} logicalName
804
+ * @param {PayloadCallback} callback
805
+ */
806
+ offInputStart(logicalName: string, callback: PayloadCallback): void;
807
+ /**
808
+ * Registers a callback for the "input-end" event of a logical name
809
+ * @param {string} logicalName
810
+ * @param {PayloadCallback} callback
811
+ */
812
+ onInputEnd(logicalName: string, callback: PayloadCallback): void;
813
+ /**
814
+ * Registers a one-time callback for the "input-end" event.
815
+ * @param {string} logicalName
816
+ * @param {PayloadCallback} callback
817
+ */
818
+ onceInputEnd(logicalName: string, callback: PayloadCallback): void;
819
+ /**
820
+ * Prepends a callback to the "input-end" event list.
821
+ * @param {string} logicalName
822
+ * @param {PayloadCallback} callback
823
+ */
824
+ prependInputEnd(logicalName: string, callback: PayloadCallback): void;
825
+ /**
826
+ * Removes a callback from a specific logical "input-end" event.
827
+ * @param {string} logicalName
828
+ * @param {PayloadCallback} callback
829
+ */
830
+ offInputEnd(logicalName: string, callback: PayloadCallback): void;
831
+ /**
832
+ * Registers a callback for the "input-hold" event of a logical name
833
+ * @param {string} logicalName
834
+ * @param {PayloadCallback} callback
835
+ */
836
+ onInputHold(logicalName: string, callback: PayloadCallback): void;
837
+ /**
838
+ * Registers a one-time callback for the "input-hold" event.
839
+ * @param {string} logicalName
840
+ * @param {PayloadCallback} callback
841
+ */
842
+ onceInputHold(logicalName: string, callback: PayloadCallback): void;
843
+ /**
844
+ * Prepends a callback to the "input-hold" event list.
845
+ * @param {string} logicalName
846
+ * @param {PayloadCallback} callback
847
+ */
848
+ prependInputHold(logicalName: string, callback: PayloadCallback): void;
849
+ /**
850
+ * Removes a callback from a specific logical "input-hold" event.
851
+ * @param {string} logicalName
852
+ * @param {PayloadCallback} callback
853
+ */
854
+ offInputHold(logicalName: string, callback: PayloadCallback): void;
855
+ /**
856
+ * Registers a callback for the "input-change" event of a logical name
857
+ * @param {string} logicalName
858
+ * @param {PayloadCallback} callback
859
+ */
860
+ onInputChange(logicalName: string, callback: PayloadCallback): void;
861
+ /**
862
+ * Registers a one-time callback for the "input-change" event.
863
+ * @param {string} logicalName
864
+ * @param {PayloadCallback} callback
865
+ */
866
+ onceInputChange(logicalName: string, callback: PayloadCallback): void;
867
+ /**
868
+ * Prepends a callback to the "input-change" event list.
869
+ * @param {string} logicalName
870
+ * @param {PayloadCallback} callback
871
+ */
872
+ prependInputChange(logicalName: string, callback: PayloadCallback): void;
873
+ /**
874
+ * Removes a callback from a specific logical "input-change" event.
875
+ * @param {string} logicalName
876
+ * @param {PayloadCallback} callback
877
+ */
878
+ offInputChange(logicalName: string, callback: PayloadCallback): void;
879
+ /**
880
+ * Registers a callback for the "input-move" event of a logical name
881
+ * @param {string} logicalName
882
+ * @param {PayloadCallback} callback
883
+ */
884
+ onInputMove(logicalName: string, callback: PayloadCallback): void;
885
+ /**
886
+ * Registers a one-time callback for the "input-move" event.
887
+ * @param {string} logicalName
888
+ * @param {PayloadCallback} callback
889
+ */
890
+ onceInputMove(logicalName: string, callback: PayloadCallback): void;
891
+ /**
892
+ * Prepends a callback to the "input-move" event list.
893
+ * @param {string} logicalName
894
+ * @param {PayloadCallback} callback
895
+ */
896
+ prependInputMove(logicalName: string, callback: PayloadCallback): void;
897
+ /**
898
+ * Removes a callback from a specific logical "input-move" event.
899
+ * @param {string} logicalName
900
+ * @param {PayloadCallback} callback
901
+ */
902
+ offInputMove(logicalName: string, callback: PayloadCallback): void;
903
+ /**
904
+ * Returns a shallow clone of the callback list for a given logical input and event type.
905
+ * @param {string} logicalName
906
+ * @param {'all' | 'start' | 'end' | 'hold' | 'change' | 'move'} [type='all']
907
+ * @returns {Function[]}
908
+ */
909
+ getCalls(logicalName: string, type?: "all" | "start" | "end" | "hold" | "change" | "move"): Function[];
910
+ /**
911
+ * Removes all callbacks for a specific logical input event.
912
+ * @param {string} logicalName
913
+ * @param {'all'| 'start' | 'end' | 'hold' | 'change' | 'move'} [type='all']
914
+ */
915
+ offAllInputs(logicalName: string, type?: "all" | "start" | "end" | "hold" | "change" | "move"): void;
916
+ /**
917
+ * Returns the number of registered callbacks for a specific logical input and type.
918
+ * @param {string} logicalName
919
+ * @param {'all' | 'start' | 'end' | 'hold' | 'change' | 'move'} [type='all']
920
+ * @returns {number}
921
+ */
922
+ getCallSize(logicalName: string, type?: "all" | "start" | "end" | "hold" | "change" | "move"): number;
923
+ /**
924
+ * Returns the current default haptic feedback effect configuration.
925
+ *
926
+ * This includes the effect type (e.g., 'dual-rumble') and its parameters
927
+ * such as duration, delay, and vibration intensities (weak and strong).
928
+ *
929
+ * The returned object is a shallow clone to prevent external mutation.
930
+ *
931
+ * @returns {{ type: GamepadHapticEffectType; params: GamepadEffectParameters; }} The default haptic effect settings.
932
+ */
933
+ get defaultHapticEffect(): {
934
+ type: GamepadHapticEffectType;
935
+ params: GamepadEffectParameters;
936
+ };
937
+ /**
938
+ * Sets the default haptic feedback effect configuration.
939
+ * @param {GamepadHapticEffectType} type - Type of effect.
940
+ * @param {GamepadEffectParameters} params - Effect parameters.
941
+ */
942
+ setDefaultHapticEffect(type: GamepadHapticEffectType, params: GamepadEffectParameters): void;
943
+ /**
944
+ * Checks if the connected gamepad supports haptic feedback.
945
+ * @returns {boolean}
946
+ */
947
+ hasHapticEffect(): boolean;
948
+ /**
949
+ * Triggers a haptic feedback vibration using provided or default settings.
950
+ * @param {GamepadEffectParameters} [params] - Custom parameters.
951
+ * @param {GamepadHapticEffectType} [type] - Custom type.
952
+ * @returns {Promise<GamepadHapticsResult>}
953
+ */
954
+ vibrate(params?: GamepadEffectParameters, type?: GamepadHapticEffectType): Promise<GamepadHapticsResult>;
955
+ /**
956
+ * Adds an ID to the ignored list
957
+ * @param {string} id
958
+ */
959
+ ignoreId(id: string): void;
960
+ /**
961
+ * Removes an ID from the ignored list
962
+ * @param {string} id
963
+ */
964
+ unignoreId(id: string): void;
965
+ /**
966
+ * Registers a callback for the "connected" event
967
+ * @param {ConnectionCallback} callback
968
+ */
969
+ onConnected(callback: ConnectionCallback): void;
970
+ /**
971
+ * Registers a one-time callback for the "connected" event.
972
+ * The callback will be automatically removed after it runs once.
973
+ * @param {ConnectionCallback} callback
974
+ */
975
+ onceConnected(callback: ConnectionCallback): void;
976
+ /**
977
+ * Prepends a callback to the "connected" event.
978
+ * @param {ConnectionCallback} callback
979
+ */
980
+ prependConnected(callback: ConnectionCallback): void;
981
+ /**
982
+ * Removes a callback from the "connected" event.
983
+ * @param {ConnectionCallback} callback
984
+ */
985
+ offConnected(callback: ConnectionCallback): void;
986
+ /**
987
+ * Removes all callbacks from the "connected" event.
988
+ */
989
+ offAllConnected(): void;
990
+ /**
991
+ * Registers a callback for the "disconnected" event
992
+ * @param {ConnectionCallback} callback
993
+ */
994
+ onDisconnected(callback: ConnectionCallback): void;
995
+ /**
996
+ * Registers a one-time callback for the "disconnected" event.
997
+ * The callback will be automatically removed after it runs once.
998
+ * @param {ConnectionCallback} callback
999
+ */
1000
+ onceDisconnected(callback: ConnectionCallback): void;
1001
+ /**
1002
+ * Prepends a callback to the "disconnected" event.
1003
+ * @param {ConnectionCallback} callback
1004
+ */
1005
+ prependDisconnected(callback: ConnectionCallback): void;
1006
+ /**
1007
+ * Removes a callback from the "disconnected" event.
1008
+ * @param {ConnectionCallback} callback
1009
+ */
1010
+ offDisconnected(callback: ConnectionCallback): void;
1011
+ /**
1012
+ * Removes all callbacks from the "disconnected" event.
1013
+ */
1014
+ offAllDisconnected(): void;
1015
+ /**
1016
+ * Returns whether a gamepad is currently connected.
1017
+ * @returns {boolean}
1018
+ */
1019
+ hasGamepad(): boolean;
1020
+ /**
1021
+ * Returns the currently connected Gamepad instance.
1022
+ * Throws if no gamepad is connected.
1023
+ * @returns {Gamepad}
1024
+ */
1025
+ getGamepad(): Gamepad;
1026
+ /**
1027
+ * Checks if there is a recorded last state for a given button index.
1028
+ * @param {number} index - The index of the button to check.
1029
+ * @returns {boolean} True if a last state exists for the specified button index; otherwise, false.
1030
+ */
1031
+ hasLastButtonState(index: number): boolean;
1032
+ /**
1033
+ * Retrieves the last recorded state for a given button index.
1034
+ * Throws an error if the button index has no recorded state.
1035
+ * @param {number} index - The index of the button to retrieve.
1036
+ * @returns {KeyStatus} A copy of the last known state for the specified button index.
1037
+ * @throws {Error} If no last state exists for the specified button index.
1038
+ */
1039
+ getLastButtonState(index: number): KeyStatus;
1040
+ /**
1041
+ * Exports the current TinyGamepad configuration as a plain object suitable for serialization.
1042
+ * Includes device filters, input mappings, and various sensitivity settings.
1043
+ * @returns {ExportedConfig} The current configuration snapshot.
1044
+ */
1045
+ exportConfig(): ExportedConfig;
1046
+ /**
1047
+ * Imports and applies a configuration object or JSON string to update TinyGamepad settings.
1048
+ * Validates the input to ensure proper types and throws if invalid.
1049
+ * @param {string | ExportedConfig} json - JSON string or configuration object to apply.
1050
+ * @throws {TypeError} Throws if the provided argument is not a valid JSON string or configuration object,
1051
+ * or if any property has an incorrect type.
1052
+ */
1053
+ importConfig(json: string | ExportedConfig): void;
1054
+ /**
1055
+ * Returns a cloned list of the "mapped-key-start" event callbacks.
1056
+ * @returns {MappedInputCallback[]}
1057
+ */
1058
+ get mappedKeyStartCalls(): MappedInputCallback[];
1059
+ /**
1060
+ * Returns a cloned list of the "mapped-key-end" event callbacks.
1061
+ * @returns {MappedInputCallback[]}
1062
+ */
1063
+ get mappedKeyEndCalls(): MappedInputCallback[];
1064
+ /**
1065
+ * Returns a clone of currently held key combo logical inputs.
1066
+ * @returns {string[]}
1067
+ */
1068
+ get comboMappedKeys(): string[];
1069
+ /**
1070
+ * Returns a clone of currently held combo logical inputs.
1071
+ * @returns {string[]}
1072
+ */
1073
+ get comboMappedInputs(): string[];
1074
+ /**
1075
+ * Returns the number of input sequences currently registered.
1076
+ * @returns {number}
1077
+ */
1078
+ get keySequenceSize(): number;
1079
+ /**
1080
+ * Returns a shallow clone of all input sequences and their associated data.
1081
+ * @returns {InputSequenceCallback[]}
1082
+ */
1083
+ get keySequences(): InputSequenceCallback[];
1084
+ /**
1085
+ * Returns a clone of currently held mapped logical keys.
1086
+ * @returns {string[]}
1087
+ */
1088
+ get activeMappedKeys(): string[];
1089
+ /**
1090
+ * Returns a cloned list of the "mapped-input-start" event callbacks.
1091
+ * @returns {MappedInputCallback[]}
1092
+ */
1093
+ get mappedInputStartCalls(): MappedInputCallback[];
1094
+ /**
1095
+ * Returns a cloned list of the "mapped-input-end" event callbacks.
1096
+ * @returns {MappedInputCallback[]}
1097
+ */
1098
+ get mappedInputEndCalls(): MappedInputCallback[];
1099
+ /**
1100
+ * Returns the number of input sequences currently registered.
1101
+ * @returns {number}
1102
+ */
1103
+ get inputSequenceSize(): number;
1104
+ /**
1105
+ * Returns a shallow clone of all input sequences and their associated data.
1106
+ * @returns {InputSequenceCallback[]}
1107
+ */
1108
+ get inputSequences(): InputSequenceCallback[];
1109
+ /**
1110
+ * Returns a clone of currently held mapped logical inputs.
1111
+ * @returns {string[]}
1112
+ */
1113
+ get activeMappedInputs(): string[];
1114
+ /**
1115
+ * Returns a shallow clone of all logical-to-physical input mappings as a plain object.
1116
+ * @returns {{ [logicalName: string]: string | string[] }}
1117
+ */
1118
+ get mappedInputs(): {
1119
+ [logicalName: string]: string | string[];
1120
+ };
1121
+ /**
1122
+ * Returns the number of logical inputs currently mapped.
1123
+ * @returns {number}
1124
+ */
1125
+ get mappedInputSize(): number;
1126
+ /**
1127
+ * Returns a cloned list of the "connected" event callbacks.
1128
+ * @returns {ConnectionCallback[]}
1129
+ */
1130
+ get connectedCalls(): ConnectionCallback[];
1131
+ /**
1132
+ * Returns a cloned list of the "disconnected" event callbacks.
1133
+ * @returns {ConnectionCallback[]}
1134
+ */
1135
+ get disconnectedCalls(): ConnectionCallback[];
1136
+ /**
1137
+ * Returns a shallow clone of the set of ignored device IDs.
1138
+ * @returns {string[]}
1139
+ */
1140
+ get ignoredDeviceIds(): string[];
1141
+ /**
1142
+ * Returns a shallow clone of the currently held keys.
1143
+ * @returns {string[]}
1144
+ */
1145
+ get heldKeys(): string[];
1146
+ /**
1147
+ * Returns the total number of sub event keys inside all events currently registered.
1148
+ * @returns {number}
1149
+ */
1150
+ get eventsSize(): number;
1151
+ /**
1152
+ * Returns the total number of unique event keys currently registered.
1153
+ * @returns {number}
1154
+ */
1155
+ get callSize(): number;
1156
+ /**
1157
+ * Returns the number of callbacks registered for the "connected" event.
1158
+ * @returns {number}
1159
+ */
1160
+ get connectedCallSize(): number;
1161
+ /**
1162
+ * Returns the number of callbacks registered for the "disconnected" event.
1163
+ * @returns {number}
1164
+ */
1165
+ get disconnectedCallSize(): number;
1166
+ /**
1167
+ * Returns the number of callbacks registered for the "mapped-key-start" event.
1168
+ * @returns {number}
1169
+ */
1170
+ get mappedKeyStartCallSize(): number;
1171
+ /**
1172
+ * Returns the number of callbacks registered for the "mapped-key-end" event.
1173
+ * @returns {number}
1174
+ */
1175
+ get mappedKeyEndCallSize(): number;
1176
+ /**
1177
+ * Returns the number of callbacks registered for the "mapped-input-start" event.
1178
+ * @returns {number}
1179
+ */
1180
+ get mappedInputStartCallSize(): number;
1181
+ /**
1182
+ * Returns the number of callbacks registered for the "mapped-input-end" event.
1183
+ * @returns {number}
1184
+ */
1185
+ get mappedInputEndCallSize(): number;
1186
+ /**
1187
+ * Retrieves a snapshot of the most recent button states.
1188
+ * Each element represents the status of a specific button at the last update cycle.
1189
+ * @returns {KeyStatus[]} An array of button states from the last poll.
1190
+ */
1191
+ get lastButtonStates(): KeyStatus[];
1192
+ /**
1193
+ * Retrieves a snapshot of the most recent axis values.
1194
+ * Each element is a numeric value representing the position or tilt of a specific axis at the last update cycle.
1195
+ * @returns {number[]} An array of axis values from the last poll.
1196
+ */
1197
+ get lastAxes(): number[];
1198
+ /**
1199
+ * Returns the current input mode (e.g., 'keyboard-only', 'gamepad-only', or 'both').
1200
+ * @returns {InputMode}
1201
+ */
1202
+ get inputMode(): InputMode;
1203
+ /**
1204
+ * Returns the base element or window used for event binding.
1205
+ * @returns {Window|Element}
1206
+ */
1207
+ get elementBase(): Window | Element;
1208
+ /**
1209
+ * Returns the timestamp of the last mapped input combo.
1210
+ * @returns {number}
1211
+ */
1212
+ get timeComboInputs(): number;
1213
+ /**
1214
+ * Returns the timestamp of the last raw key combo.
1215
+ * @returns {number}
1216
+ */
1217
+ get timeComboKeys(): number;
1218
+ /**
1219
+ * Returns the timestamp of the last mapped input activity.
1220
+ * @returns {number}
1221
+ */
1222
+ get timeMappedInputs(): number;
1223
+ /**
1224
+ * Sets the timeout duration (in milliseconds) before raw key combos are reset.
1225
+ * Must be a positive number.
1226
+ * @param {number} value
1227
+ */
1228
+ set timeoutComboKeys(value: number);
1229
+ /**
1230
+ * Returns the timeout duration (in milliseconds) before raw key combos are reset.
1231
+ * @returns {number}
1232
+ */
1233
+ get timeoutComboKeys(): number;
1234
+ /**
1235
+ * Sets the sensitivity threshold used to detect active axis input.
1236
+ * This value defines how far an analog axis (such as a thumbstick or trigger) must move from its rest position
1237
+ * before being considered as a valid input.
1238
+ *
1239
+ * Values must be between 0 and 1. An error is thrown if the value is outside this range or not a number.
1240
+ *
1241
+ * @param {number} value - The new sensitivity value between 0 and 1.
1242
+ */
1243
+ set axisActiveSensitivity(value: number);
1244
+ /**
1245
+ * Gets the sensitivity threshold used to detect when an axis (like a thumbstick or trigger)
1246
+ * is considered "actively moved". This helps distinguish minor noise from intentional input.
1247
+ *
1248
+ * A value of 0 means even the slightest movement is detected; a value closer to 1 means only strong input is accepted.
1249
+ *
1250
+ * @returns {number} The current axis activity sensitivity (between 0 and 1).
1251
+ */
1252
+ get axisActiveSensitivity(): number;
1253
+ /**
1254
+ * Sets a new dead zone threshold for analog inputs.
1255
+ * Must be a number between 0 and 1.
1256
+ * @param {number} value
1257
+ */
1258
+ set deadZone(value: number);
1259
+ /**
1260
+ * Returns the current dead zone threshold for analog inputs.
1261
+ * @returns {number}
1262
+ */
1263
+ get deadZone(): number;
1264
+ /**
1265
+ * Sets the expected device ID.
1266
+ * @returns {string}
1267
+ */
1268
+ set expectedId(value: string | null);
1269
+ /**
1270
+ * Returns the expected device ID, or null if any is accepted.
1271
+ * @returns {string|null}
1272
+ */
1273
+ get expectedId(): string | null;
1274
+ /**
1275
+ * Returns whether the instance has been destroyed
1276
+ * @returns {boolean}
1277
+ */
1278
+ get isDestroyed(): boolean;
1279
+ /**
1280
+ * Clears internal state and stops any ongoing input monitoring or loops.
1281
+ * Marks the instance as destroyed.
1282
+ */
1283
+ destroy(): void;
1284
+ #private;
1285
+ }
1286
+ //# sourceMappingURL=TinyGamepad.d.mts.map