@wordpress/keycodes 3.39.0 → 3.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 3.40.0 (2023-08-16)
6
+
5
7
  ## 3.39.0 (2023-08-10)
6
8
 
7
9
  ## 3.38.0 (2023-07-20)
package/build/index.js CHANGED
@@ -11,13 +11,9 @@ Object.defineProperty(exports, "isAppleOS", {
11
11
  }
12
12
  });
13
13
  exports.shortcutAriaLabel = exports.rawShortcut = exports.modifiers = exports.isKeyboardEvent = void 0;
14
-
15
14
  var _changeCase = require("change-case");
16
-
17
15
  var _i18n = require("@wordpress/i18n");
18
-
19
16
  var _platform = require("./platform");
20
-
21
17
  /**
22
18
  * Note: The order of the modifier keys in many of the [foo]Shortcut()
23
19
  * functions in this file are intentional and should not be changed. They're
@@ -59,7 +55,6 @@ var _platform = require("./platform");
59
55
  *
60
56
  * @typedef {(character: string, isApple?: () => boolean) => T} WPKeyHandler
61
57
  */
62
-
63
58
  /** @typedef {(event: import('react').KeyboardEvent<HTMLElement> | KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */
64
59
 
65
60
  /** @typedef {( isApple: () => boolean ) => WPModifierPart[]} WPModifier */
@@ -68,122 +63,121 @@ var _platform = require("./platform");
68
63
  * Keycode for BACKSPACE key.
69
64
  */
70
65
  const BACKSPACE = 8;
66
+
71
67
  /**
72
68
  * Keycode for TAB key.
73
69
  */
74
-
75
70
  exports.BACKSPACE = BACKSPACE;
76
71
  const TAB = 9;
72
+
77
73
  /**
78
74
  * Keycode for ENTER key.
79
75
  */
80
-
81
76
  exports.TAB = TAB;
82
77
  const ENTER = 13;
78
+
83
79
  /**
84
80
  * Keycode for ESCAPE key.
85
81
  */
86
-
87
82
  exports.ENTER = ENTER;
88
83
  const ESCAPE = 27;
84
+
89
85
  /**
90
86
  * Keycode for SPACE key.
91
87
  */
92
-
93
88
  exports.ESCAPE = ESCAPE;
94
89
  const SPACE = 32;
90
+
95
91
  /**
96
92
  * Keycode for PAGEUP key.
97
93
  */
98
-
99
94
  exports.SPACE = SPACE;
100
95
  const PAGEUP = 33;
96
+
101
97
  /**
102
98
  * Keycode for PAGEDOWN key.
103
99
  */
104
-
105
100
  exports.PAGEUP = PAGEUP;
106
101
  const PAGEDOWN = 34;
102
+
107
103
  /**
108
104
  * Keycode for END key.
109
105
  */
110
-
111
106
  exports.PAGEDOWN = PAGEDOWN;
112
107
  const END = 35;
108
+
113
109
  /**
114
110
  * Keycode for HOME key.
115
111
  */
116
-
117
112
  exports.END = END;
118
113
  const HOME = 36;
114
+
119
115
  /**
120
116
  * Keycode for LEFT key.
121
117
  */
122
-
123
118
  exports.HOME = HOME;
124
119
  const LEFT = 37;
120
+
125
121
  /**
126
122
  * Keycode for UP key.
127
123
  */
128
-
129
124
  exports.LEFT = LEFT;
130
125
  const UP = 38;
126
+
131
127
  /**
132
128
  * Keycode for RIGHT key.
133
129
  */
134
-
135
130
  exports.UP = UP;
136
131
  const RIGHT = 39;
132
+
137
133
  /**
138
134
  * Keycode for DOWN key.
139
135
  */
140
-
141
136
  exports.RIGHT = RIGHT;
142
137
  const DOWN = 40;
138
+
143
139
  /**
144
140
  * Keycode for DELETE key.
145
141
  */
146
-
147
142
  exports.DOWN = DOWN;
148
143
  const DELETE = 46;
144
+
149
145
  /**
150
146
  * Keycode for F10 key.
151
147
  */
152
-
153
148
  exports.DELETE = DELETE;
154
149
  const F10 = 121;
150
+
155
151
  /**
156
152
  * Keycode for ALT key.
157
153
  */
158
-
159
154
  exports.F10 = F10;
160
155
  const ALT = 'alt';
156
+
161
157
  /**
162
158
  * Keycode for CTRL key.
163
159
  */
164
-
165
160
  exports.ALT = ALT;
166
161
  const CTRL = 'ctrl';
162
+
167
163
  /**
168
164
  * Keycode for COMMAND/META key.
169
165
  */
170
-
171
166
  exports.CTRL = CTRL;
172
167
  const COMMAND = 'meta';
168
+
173
169
  /**
174
170
  * Keycode for SHIFT key.
175
171
  */
176
-
177
172
  exports.COMMAND = COMMAND;
178
173
  const SHIFT = 'shift';
174
+
179
175
  /**
180
176
  * Keycode for ZERO key.
181
177
  */
182
-
183
178
  exports.SHIFT = SHIFT;
184
179
  const ZERO = 48;
185
180
  exports.ZERO = ZERO;
186
-
187
181
  /**
188
182
  * Map the values of an object with a specified callback and return the result object.
189
183
  *
@@ -197,14 +191,13 @@ exports.ZERO = ZERO;
197
191
  function mapValues(object, mapFn) {
198
192
  return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, mapFn(value)]));
199
193
  }
194
+
200
195
  /**
201
196
  * Object that contains functions that return the available modifier
202
197
  * depending on platform.
203
198
  *
204
199
  * @type {WPModifierHandler< ( isApple: () => boolean ) => WPModifierPart[]>}
205
200
  */
206
-
207
-
208
201
  const modifiers = {
209
202
  primary: _isApple => _isApple() ? [COMMAND] : [CTRL],
210
203
  primaryShift: _isApple => _isApple() ? [SHIFT, COMMAND] : [CTRL, SHIFT],
@@ -218,6 +211,7 @@ const modifiers = {
218
211
  shiftAlt: () => [SHIFT, ALT],
219
212
  undefined: () => []
220
213
  };
214
+
221
215
  /**
222
216
  * An object that contains functions to get raw shortcuts.
223
217
  *
@@ -233,18 +227,14 @@ const modifiers = {
233
227
  * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to raw
234
228
  * shortcuts.
235
229
  */
236
-
237
230
  exports.modifiers = modifiers;
238
- const rawShortcut = mapValues(modifiers, (
239
- /** @type {WPModifier} */
240
- modifier) => {
241
- return (
242
- /** @type {WPKeyHandler<string>} */
243
- (character, _isApple = _platform.isAppleOS) => {
231
+ const rawShortcut = mapValues(modifiers, ( /** @type {WPModifier} */modifier) => {
232
+ return (/** @type {WPKeyHandler<string>} */(character, _isApple = _platform.isAppleOS) => {
244
233
  return [...modifier(_isApple), character.toLowerCase()].join('+');
245
234
  }
246
235
  );
247
236
  });
237
+
248
238
  /**
249
239
  * Return an array of the parts of a keyboard shortcut chord for display.
250
240
  *
@@ -258,16 +248,10 @@ modifier) => {
258
248
  * @type {WPModifierHandler<WPKeyHandler<string[]>>} Keyed map of functions to
259
249
  * shortcut sequences.
260
250
  */
261
-
262
251
  exports.rawShortcut = rawShortcut;
263
- const displayShortcutList = mapValues(modifiers, (
264
- /** @type {WPModifier} */
265
- modifier) => {
266
- return (
267
- /** @type {WPKeyHandler<string[]>} */
268
- (character, _isApple = _platform.isAppleOS) => {
252
+ const displayShortcutList = mapValues(modifiers, ( /** @type {WPModifier} */modifier) => {
253
+ return (/** @type {WPKeyHandler<string[]>} */(character, _isApple = _platform.isAppleOS) => {
269
254
  const isApple = _isApple();
270
-
271
255
  const replacementKeyMap = {
272
256
  [ALT]: isApple ? '⌥' : 'Alt',
273
257
  [CTRL]: isApple ? '⌃' : 'Ctrl',
@@ -277,20 +261,17 @@ modifier) => {
277
261
  };
278
262
  const modifierKeys = modifier(_isApple).reduce((accumulator, key) => {
279
263
  var _replacementKeyMap$ke;
280
-
281
- const replacementKey = (_replacementKeyMap$ke = replacementKeyMap[key]) !== null && _replacementKeyMap$ke !== void 0 ? _replacementKeyMap$ke : key; // If on the Mac, adhere to platform convention and don't show plus between keys.
282
-
264
+ const replacementKey = (_replacementKeyMap$ke = replacementKeyMap[key]) !== null && _replacementKeyMap$ke !== void 0 ? _replacementKeyMap$ke : key;
265
+ // If on the Mac, adhere to platform convention and don't show plus between keys.
283
266
  if (isApple) {
284
267
  return [...accumulator, replacementKey];
285
268
  }
286
-
287
269
  return [...accumulator, replacementKey, '+'];
288
- },
289
- /** @type {string[]} */
290
- []); // Symbols (~`,.) are removed by the default regular expression,
270
+ }, /** @type {string[]} */[]);
271
+
272
+ // Symbols (~`,.) are removed by the default regular expression,
291
273
  // so override the rule to allow symbols used for shortcuts.
292
274
  // see: https://github.com/blakeembrey/change-case#options
293
-
294
275
  const capitalizedCharacter = (0, _changeCase.capitalCase)(character, {
295
276
  stripRegexp: /[^A-Z0-9~`,\.\\\-]/gi
296
277
  });
@@ -298,6 +279,7 @@ modifier) => {
298
279
  }
299
280
  );
300
281
  });
282
+
301
283
  /**
302
284
  * An object that contains functions to display shortcuts.
303
285
  *
@@ -311,16 +293,12 @@ modifier) => {
311
293
  * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to
312
294
  * display shortcuts.
313
295
  */
314
-
315
296
  exports.displayShortcutList = displayShortcutList;
316
- const displayShortcut = mapValues(displayShortcutList, (
317
- /** @type {WPKeyHandler<string[]>} */
318
- shortcutList) => {
319
- return (
320
- /** @type {WPKeyHandler<string>} */
321
- (character, _isApple = _platform.isAppleOS) => shortcutList(character, _isApple).join('')
297
+ const displayShortcut = mapValues(displayShortcutList, ( /** @type {WPKeyHandler<string[]>} */shortcutList) => {
298
+ return (/** @type {WPKeyHandler<string>} */(character, _isApple = _platform.isAppleOS) => shortcutList(character, _isApple).join('')
322
299
  );
323
300
  });
301
+
324
302
  /**
325
303
  * An object that contains functions to return an aria label for a keyboard
326
304
  * shortcut.
@@ -335,44 +313,33 @@ shortcutList) => {
335
313
  * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to
336
314
  * shortcut ARIA labels.
337
315
  */
338
-
339
316
  exports.displayShortcut = displayShortcut;
340
- const shortcutAriaLabel = mapValues(modifiers, (
341
- /** @type {WPModifier} */
342
- modifier) => {
343
- return (
344
- /** @type {WPKeyHandler<string>} */
345
- (character, _isApple = _platform.isAppleOS) => {
317
+ const shortcutAriaLabel = mapValues(modifiers, ( /** @type {WPModifier} */modifier) => {
318
+ return (/** @type {WPKeyHandler<string>} */(character, _isApple = _platform.isAppleOS) => {
346
319
  const isApple = _isApple();
347
320
  /** @type {Record<string,string>} */
348
-
349
-
350
321
  const replacementKeyMap = {
351
322
  [SHIFT]: 'Shift',
352
323
  [COMMAND]: isApple ? 'Command' : 'Control',
353
324
  [CTRL]: 'Control',
354
325
  [ALT]: isApple ? 'Option' : 'Alt',
355
-
356
326
  /* translators: comma as in the character ',' */
357
327
  ',': (0, _i18n.__)('Comma'),
358
-
359
328
  /* translators: period as in the character '.' */
360
329
  '.': (0, _i18n.__)('Period'),
361
-
362
330
  /* translators: backtick as in the character '`' */
363
331
  '`': (0, _i18n.__)('Backtick'),
364
-
365
332
  /* translators: tilde as in the character '~' */
366
333
  '~': (0, _i18n.__)('Tilde')
367
334
  };
368
335
  return [...modifier(_isApple), character].map(key => {
369
336
  var _replacementKeyMap$ke2;
370
-
371
337
  return (0, _changeCase.capitalCase)((_replacementKeyMap$ke2 = replacementKeyMap[key]) !== null && _replacementKeyMap$ke2 !== void 0 ? _replacementKeyMap$ke2 : key);
372
338
  }).join(isApple ? ' ' : ' + ');
373
339
  }
374
340
  );
375
341
  });
342
+
376
343
  /**
377
344
  * From a given KeyboardEvent, returns an array of active modifier constants for
378
345
  * the event.
@@ -381,17 +348,13 @@ modifier) => {
381
348
  *
382
349
  * @return {Array<WPModifierPart>} Active modifier constants.
383
350
  */
384
-
385
351
  exports.shortcutAriaLabel = shortcutAriaLabel;
386
-
387
352
  function getEventModifiers(event) {
388
- return (
389
- /** @type {WPModifierPart[]} */
390
- [ALT, CTRL, COMMAND, SHIFT].filter(key => event[
391
- /** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */
353
+ return (/** @type {WPModifierPart[]} */[ALT, CTRL, COMMAND, SHIFT].filter(key => event[/** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */
392
354
  `${key}Key`])
393
355
  );
394
356
  }
357
+
395
358
  /**
396
359
  * An object that contains functions to check if a keyboard event matches a
397
360
  * predefined shortcut combination.
@@ -406,18 +369,11 @@ function getEventModifiers(event) {
406
369
  * @type {WPModifierHandler<WPEventKeyHandler>} Keyed map of functions
407
370
  * to match events.
408
371
  */
409
-
410
-
411
- const isKeyboardEvent = mapValues(modifiers, (
412
- /** @type {WPModifier} */
413
- getModifiers) => {
414
- return (
415
- /** @type {WPEventKeyHandler} */
416
- (event, character, _isApple = _platform.isAppleOS) => {
372
+ const isKeyboardEvent = mapValues(modifiers, ( /** @type {WPModifier} */getModifiers) => {
373
+ return (/** @type {WPEventKeyHandler} */(event, character, _isApple = _platform.isAppleOS) => {
417
374
  const mods = getModifiers(_isApple);
418
375
  const eventMods = getEventModifiers(event);
419
376
  /** @type {Record<string,string>} */
420
-
421
377
  const replacementWithShiftKeyMap = {
422
378
  Comma: ',',
423
379
  Backslash: '\\',
@@ -427,37 +383,30 @@ getModifiers) => {
427
383
  };
428
384
  const modsDiff = mods.filter(mod => !eventMods.includes(mod));
429
385
  const eventModsDiff = eventMods.filter(mod => !mods.includes(mod));
430
-
431
386
  if (modsDiff.length > 0 || eventModsDiff.length > 0) {
432
387
  return false;
433
388
  }
434
-
435
389
  let key = event.key.toLowerCase();
436
-
437
390
  if (!character) {
438
- return mods.includes(
439
- /** @type {WPModifierPart} */
440
- key);
391
+ return mods.includes( /** @type {WPModifierPart} */key);
441
392
  }
442
-
443
393
  if (event.altKey && character.length === 1) {
444
394
  key = String.fromCharCode(event.keyCode).toLowerCase();
445
- } // `event.key` returns the value of the key pressed, taking into the state of
395
+ }
396
+
397
+ // `event.key` returns the value of the key pressed, taking into the state of
446
398
  // modifier keys such as `Shift`. If the shift key is pressed, a different
447
399
  // value may be returned depending on the keyboard layout. It is necessary to
448
400
  // convert to the physical key value that don't take into account keyboard
449
401
  // layout or modifier key state.
450
-
451
-
452
402
  if (event.shiftKey && character.length === 1 && replacementWithShiftKeyMap[event.code]) {
453
403
  key = replacementWithShiftKeyMap[event.code];
454
- } // For backwards compatibility.
455
-
404
+ }
456
405
 
406
+ // For backwards compatibility.
457
407
  if (character === 'del') {
458
408
  character = 'delete';
459
409
  }
460
-
461
410
  return key === character.toLowerCase();
462
411
  }
463
412
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/keycodes/src/index.js"],"names":["BACKSPACE","TAB","ENTER","ESCAPE","SPACE","PAGEUP","PAGEDOWN","END","HOME","LEFT","UP","RIGHT","DOWN","DELETE","F10","ALT","CTRL","COMMAND","SHIFT","ZERO","mapValues","object","mapFn","Object","fromEntries","entries","map","key","value","modifiers","primary","_isApple","primaryShift","primaryAlt","secondary","access","ctrl","alt","ctrlShift","shift","shiftAlt","undefined","rawShortcut","modifier","character","isAppleOS","toLowerCase","join","displayShortcutList","isApple","replacementKeyMap","modifierKeys","reduce","accumulator","replacementKey","capitalizedCharacter","stripRegexp","displayShortcut","shortcutList","shortcutAriaLabel","getEventModifiers","event","filter","isKeyboardEvent","getModifiers","mods","eventMods","replacementWithShiftKeyMap","Comma","Backslash","IntlRo","IntlYen","modsDiff","mod","includes","eventModsDiff","length","altKey","String","fromCharCode","keyCode","shiftKey","code"],"mappings":";;;;;;;;;;;;;;AAcA;;AAKA;;AAKA;;AAxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AACA;;AAEA;;AAEA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,CAAlB;AAEP;AACA;AACA;;;AACO,MAAMC,GAAG,GAAG,CAAZ;AAEP;AACA;AACA;;;AACO,MAAMC,KAAK,GAAG,EAAd;AAEP;AACA;AACA;;;AACO,MAAMC,MAAM,GAAG,EAAf;AAEP;AACA;AACA;;;AACO,MAAMC,KAAK,GAAG,EAAd;AAEP;AACA;AACA;;;AACO,MAAMC,MAAM,GAAG,EAAf;AAEP;AACA;AACA;;;AACO,MAAMC,QAAQ,GAAG,EAAjB;AAEP;AACA;AACA;;;AACO,MAAMC,GAAG,GAAG,EAAZ;AAEP;AACA;AACA;;;AACO,MAAMC,IAAI,GAAG,EAAb;AAEP;AACA;AACA;;;AACO,MAAMC,IAAI,GAAG,EAAb;AAEP;AACA;AACA;;;AACO,MAAMC,EAAE,GAAG,EAAX;AA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,IAEAT,0BAA0B,CAAEN,KAAK,CAACqB,IAAR,CAH3B,EAIE;AACDvD,QAAAA,GAAG,GAAGwC,0BAA0B,CAAEN,KAAK,CAACqB,IAAR,CAAhC;AACA,OA5CG,CA8CJ;;;AACA,UAAKtC,SAAS,KAAK,KAAnB,EAA2B;AAC1BA,QAAAA,SAAS,GAAG,QAAZ;AACA;;AAED,aAAOjB,GAAG,KAAKiB,SAAS,CAACE,WAAV,EAAf;AACA;AAxDD;AAyDA,CA5DsC,CAAjC","sourcesContent":["/**\n * Note: The order of the modifier keys in many of the [foo]Shortcut()\n * functions in this file are intentional and should not be changed. They're\n * designed to fit with the standard menu keyboard shortcuts shown in the\n * user's platform.\n *\n * For example, on MacOS menu shortcuts will place Shift before Command, but\n * on Windows Control will usually come first. So don't provide your own\n * shortcut combos directly to keyboardShortcut().\n */\n\n/**\n * External dependencies\n */\nimport { capitalCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { isAppleOS } from './platform';\n\n/** @typedef {typeof ALT | CTRL | COMMAND | SHIFT } WPModifierPart */\n\n/** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */\n\n/**\n * An object of handler functions for each of the possible modifier\n * combinations. A handler will return a value for a given key.\n *\n * @template T\n *\n * @typedef {Record<WPKeycodeModifier, T>} WPModifierHandler\n */\n\n/**\n * @template T\n *\n * @typedef {(character: string, isApple?: () => boolean) => T} WPKeyHandler\n */\n/** @typedef {(event: import('react').KeyboardEvent<HTMLElement> | KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */\n\n/** @typedef {( isApple: () => boolean ) => WPModifierPart[]} WPModifier */\n\n/**\n * Keycode for BACKSPACE key.\n */\nexport const BACKSPACE = 8;\n\n/**\n * Keycode for TAB key.\n */\nexport const TAB = 9;\n\n/**\n * Keycode for ENTER key.\n */\nexport const ENTER = 13;\n\n/**\n * Keycode for ESCAPE key.\n */\nexport const ESCAPE = 27;\n\n/**\n * Keycode for SPACE key.\n */\nexport const SPACE = 32;\n\n/**\n * Keycode for PAGEUP key.\n */\nexport const PAGEUP = 33;\n\n/**\n * Keycode for PAGEDOWN key.\n */\nexport const PAGEDOWN = 34;\n\n/**\n * Keycode for END key.\n */\nexport const END = 35;\n\n/**\n * Keycode for HOME key.\n */\nexport const HOME = 36;\n\n/**\n * Keycode for LEFT key.\n */\nexport const LEFT = 37;\n\n/**\n * Keycode for UP key.\n */\nexport const UP = 38;\n\n/**\n * Keycode for RIGHT key.\n */\nexport const RIGHT = 39;\n\n/**\n * Keycode for DOWN key.\n */\nexport const DOWN = 40;\n\n/**\n * Keycode for DELETE key.\n */\nexport const DELETE = 46;\n\n/**\n * Keycode for F10 key.\n */\nexport const F10 = 121;\n\n/**\n * Keycode for ALT key.\n */\nexport const ALT = 'alt';\n\n/**\n * Keycode for CTRL key.\n */\nexport const CTRL = 'ctrl';\n\n/**\n * Keycode for COMMAND/META key.\n */\nexport const COMMAND = 'meta';\n\n/**\n * Keycode for SHIFT key.\n */\nexport const SHIFT = 'shift';\n\n/**\n * Keycode for ZERO key.\n */\nexport const ZERO = 48;\n\nexport { isAppleOS };\n\n/**\n * Map the values of an object with a specified callback and return the result object.\n *\n * @template {{ [s: string]: any; } | ArrayLike<any>} T\n *\n * @param {T} object Object to map values of.\n * @param {( value: any ) => any} mapFn Mapping function\n *\n * @return {any} Active modifier constants.\n */\nfunction mapValues( object, mapFn ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).map( ( [ key, value ] ) => [\n\t\t\tkey,\n\t\t\tmapFn( value ),\n\t\t] )\n\t);\n}\n\n/**\n * Object that contains functions that return the available modifier\n * depending on platform.\n *\n * @type {WPModifierHandler< ( isApple: () => boolean ) => WPModifierPart[]>}\n */\nexport const modifiers = {\n\tprimary: ( _isApple ) => ( _isApple() ? [ COMMAND ] : [ CTRL ] ),\n\tprimaryShift: ( _isApple ) =>\n\t\t_isApple() ? [ SHIFT, COMMAND ] : [ CTRL, SHIFT ],\n\tprimaryAlt: ( _isApple ) =>\n\t\t_isApple() ? [ ALT, COMMAND ] : [ CTRL, ALT ],\n\tsecondary: ( _isApple ) =>\n\t\t_isApple() ? [ SHIFT, ALT, COMMAND ] : [ CTRL, SHIFT, ALT ],\n\taccess: ( _isApple ) => ( _isApple() ? [ CTRL, ALT ] : [ SHIFT, ALT ] ),\n\tctrl: () => [ CTRL ],\n\talt: () => [ ALT ],\n\tctrlShift: () => [ CTRL, SHIFT ],\n\tshift: () => [ SHIFT ],\n\tshiftAlt: () => [ SHIFT, ALT ],\n\tundefined: () => [],\n};\n\n/**\n * An object that contains functions to get raw shortcuts.\n *\n * These are intended for user with the KeyboardShortcuts.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * rawShortcut.primary( 'm' )\n * // \"meta+m\"\"\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to raw\n * shortcuts.\n */\nexport const rawShortcut = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ modifier ) => {\n\t\treturn /** @type {WPKeyHandler<string>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\treturn [ ...modifier( _isApple ), character.toLowerCase() ].join(\n\t\t\t\t'+'\n\t\t\t);\n\t\t};\n\t}\n);\n\n/**\n * Return an array of the parts of a keyboard shortcut chord for display.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * displayShortcutList.primary( 'm' );\n * // [ \"⌘\", \"M\" ]\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string[]>>} Keyed map of functions to\n * shortcut sequences.\n */\nexport const displayShortcutList = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ modifier ) => {\n\t\treturn /** @type {WPKeyHandler<string[]>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\tconst isApple = _isApple();\n\t\t\tconst replacementKeyMap = {\n\t\t\t\t[ ALT ]: isApple ? '⌥' : 'Alt',\n\t\t\t\t[ CTRL ]: isApple ? '⌃' : 'Ctrl', // Make sure ⌃ is the U+2303 UP ARROWHEAD unicode character and not the caret character.\n\t\t\t\t[ COMMAND ]: '⌘',\n\t\t\t\t[ SHIFT ]: isApple ? '⇧' : 'Shift',\n\t\t\t};\n\n\t\t\tconst modifierKeys = modifier( _isApple ).reduce(\n\t\t\t\t( accumulator, key ) => {\n\t\t\t\t\tconst replacementKey = replacementKeyMap[ key ] ?? key;\n\t\t\t\t\t// If on the Mac, adhere to platform convention and don't show plus between keys.\n\t\t\t\t\tif ( isApple ) {\n\t\t\t\t\t\treturn [ ...accumulator, replacementKey ];\n\t\t\t\t\t}\n\n\t\t\t\t\treturn [ ...accumulator, replacementKey, '+' ];\n\t\t\t\t},\n\t\t\t\t/** @type {string[]} */ ( [] )\n\t\t\t);\n\n\t\t\t// Symbols (~`,.) are removed by the default regular expression,\n\t\t\t// so override the rule to allow symbols used for shortcuts.\n\t\t\t// see: https://github.com/blakeembrey/change-case#options\n\t\t\tconst capitalizedCharacter = capitalCase( character, {\n\t\t\t\tstripRegexp: /[^A-Z0-9~`,\\.\\\\\\-]/gi,\n\t\t\t} );\n\n\t\t\treturn [ ...modifierKeys, capitalizedCharacter ];\n\t\t};\n\t}\n);\n\n/**\n * An object that contains functions to display shortcuts.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * displayShortcut.primary( 'm' );\n * // \"⌘M\"\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to\n * display shortcuts.\n */\nexport const displayShortcut = mapValues(\n\tdisplayShortcutList,\n\t( /** @type {WPKeyHandler<string[]>} */ shortcutList ) => {\n\t\treturn /** @type {WPKeyHandler<string>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => shortcutList( character, _isApple ).join( '' );\n\t}\n);\n\n/**\n * An object that contains functions to return an aria label for a keyboard\n * shortcut.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * shortcutAriaLabel.primary( '.' );\n * // \"Command + Period\"\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to\n * shortcut ARIA labels.\n */\nexport const shortcutAriaLabel = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ modifier ) => {\n\t\treturn /** @type {WPKeyHandler<string>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\tconst isApple = _isApple();\n\t\t\t/** @type {Record<string,string>} */\n\t\t\tconst replacementKeyMap = {\n\t\t\t\t[ SHIFT ]: 'Shift',\n\t\t\t\t[ COMMAND ]: isApple ? 'Command' : 'Control',\n\t\t\t\t[ CTRL ]: 'Control',\n\t\t\t\t[ ALT ]: isApple ? 'Option' : 'Alt',\n\t\t\t\t/* translators: comma as in the character ',' */\n\t\t\t\t',': __( 'Comma' ),\n\t\t\t\t/* translators: period as in the character '.' */\n\t\t\t\t'.': __( 'Period' ),\n\t\t\t\t/* translators: backtick as in the character '`' */\n\t\t\t\t'`': __( 'Backtick' ),\n\t\t\t\t/* translators: tilde as in the character '~' */\n\t\t\t\t'~': __( 'Tilde' ),\n\t\t\t};\n\n\t\t\treturn [ ...modifier( _isApple ), character ]\n\t\t\t\t.map( ( key ) =>\n\t\t\t\t\tcapitalCase( replacementKeyMap[ key ] ?? key )\n\t\t\t\t)\n\t\t\t\t.join( isApple ? ' ' : ' + ' );\n\t\t};\n\t}\n);\n\n/**\n * From a given KeyboardEvent, returns an array of active modifier constants for\n * the event.\n *\n * @param {import('react').KeyboardEvent<HTMLElement> | KeyboardEvent} event Keyboard event.\n *\n * @return {Array<WPModifierPart>} Active modifier constants.\n */\nfunction getEventModifiers( event ) {\n\treturn /** @type {WPModifierPart[]} */ ( [\n\t\tALT,\n\t\tCTRL,\n\t\tCOMMAND,\n\t\tSHIFT,\n\t] ).filter(\n\t\t( key ) =>\n\t\t\tevent[\n\t\t\t\t/** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */ (\n\t\t\t\t\t`${ key }Key`\n\t\t\t\t)\n\t\t\t]\n\t);\n}\n\n/**\n * An object that contains functions to check if a keyboard event matches a\n * predefined shortcut combination.\n *\n * @example\n * ```js\n * // Assuming an event for ⌘M key press:\n * isKeyboardEvent.primary( event, 'm' );\n * // true\n * ```\n *\n * @type {WPModifierHandler<WPEventKeyHandler>} Keyed map of functions\n * to match events.\n */\nexport const isKeyboardEvent = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ getModifiers ) => {\n\t\treturn /** @type {WPEventKeyHandler} */ (\n\t\t\tevent,\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\tconst mods = getModifiers( _isApple );\n\t\t\tconst eventMods = getEventModifiers( event );\n\t\t\t/** @type {Record<string,string>} */\n\t\t\tconst replacementWithShiftKeyMap = {\n\t\t\t\tComma: ',',\n\t\t\t\tBackslash: '\\\\',\n\t\t\t\t// Windows returns `\\` for both IntlRo and IntlYen.\n\t\t\t\tIntlRo: '\\\\',\n\t\t\t\tIntlYen: '\\\\',\n\t\t\t};\n\n\t\t\tconst modsDiff = mods.filter(\n\t\t\t\t( mod ) => ! eventMods.includes( mod )\n\t\t\t);\n\t\t\tconst eventModsDiff = eventMods.filter(\n\t\t\t\t( mod ) => ! mods.includes( mod )\n\t\t\t);\n\n\t\t\tif ( modsDiff.length > 0 || eventModsDiff.length > 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tlet key = event.key.toLowerCase();\n\n\t\t\tif ( ! character ) {\n\t\t\t\treturn mods.includes( /** @type {WPModifierPart} */ ( key ) );\n\t\t\t}\n\n\t\t\tif ( event.altKey && character.length === 1 ) {\n\t\t\t\tkey = String.fromCharCode( event.keyCode ).toLowerCase();\n\t\t\t}\n\n\t\t\t// `event.key` returns the value of the key pressed, taking into the state of\n\t\t\t// modifier keys such as `Shift`. If the shift key is pressed, a different\n\t\t\t// value may be returned depending on the keyboard layout. It is necessary to\n\t\t\t// convert to the physical key value that don't take into account keyboard\n\t\t\t// layout or modifier key state.\n\t\t\tif (\n\t\t\t\tevent.shiftKey &&\n\t\t\t\tcharacter.length === 1 &&\n\t\t\t\treplacementWithShiftKeyMap[ event.code ]\n\t\t\t) {\n\t\t\t\tkey = replacementWithShiftKeyMap[ event.code ];\n\t\t\t}\n\n\t\t\t// For backwards compatibility.\n\t\t\tif ( character === 'del' ) {\n\t\t\t\tcharacter = 'delete';\n\t\t\t}\n\n\t\t\treturn key === character.toLowerCase();\n\t\t};\n\t}\n);\n"]}
1
+ {"version":3,"names":["_changeCase","require","_i18n","_platform","BACKSPACE","exports","TAB","ENTER","ESCAPE","SPACE","PAGEUP","PAGEDOWN","END","HOME","LEFT","UP","RIGHT","DOWN","DELETE","F10","ALT","CTRL","COMMAND","SHIFT","ZERO","mapValues","object","mapFn","Object","fromEntries","entries","map","key","value","modifiers","primary","_isApple","primaryShift","primaryAlt","secondary","access","ctrl","alt","ctrlShift","shift","shiftAlt","undefined","rawShortcut","modifier","character","isAppleOS","toLowerCase","join","displayShortcutList","isApple","replacementKeyMap","modifierKeys","reduce","accumulator","_replacementKeyMap$ke","replacementKey","capitalizedCharacter","capitalCase","stripRegexp","displayShortcut","shortcutList","shortcutAriaLabel","__","_replacementKeyMap$ke2","getEventModifiers","event","filter","isKeyboardEvent","getModifiers","mods","eventMods","replacementWithShiftKeyMap","Comma","Backslash","IntlRo","IntlYen","modsDiff","mod","includes","eventModsDiff","length","altKey","String","fromCharCode","keyCode","shiftKey","code"],"sources":["@wordpress/keycodes/src/index.js"],"sourcesContent":["/**\n * Note: The order of the modifier keys in many of the [foo]Shortcut()\n * functions in this file are intentional and should not be changed. They're\n * designed to fit with the standard menu keyboard shortcuts shown in the\n * user's platform.\n *\n * For example, on MacOS menu shortcuts will place Shift before Command, but\n * on Windows Control will usually come first. So don't provide your own\n * shortcut combos directly to keyboardShortcut().\n */\n\n/**\n * External dependencies\n */\nimport { capitalCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { isAppleOS } from './platform';\n\n/** @typedef {typeof ALT | CTRL | COMMAND | SHIFT } WPModifierPart */\n\n/** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */\n\n/**\n * An object of handler functions for each of the possible modifier\n * combinations. A handler will return a value for a given key.\n *\n * @template T\n *\n * @typedef {Record<WPKeycodeModifier, T>} WPModifierHandler\n */\n\n/**\n * @template T\n *\n * @typedef {(character: string, isApple?: () => boolean) => T} WPKeyHandler\n */\n/** @typedef {(event: import('react').KeyboardEvent<HTMLElement> | KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */\n\n/** @typedef {( isApple: () => boolean ) => WPModifierPart[]} WPModifier */\n\n/**\n * Keycode for BACKSPACE key.\n */\nexport const BACKSPACE = 8;\n\n/**\n * Keycode for TAB key.\n */\nexport const TAB = 9;\n\n/**\n * Keycode for ENTER key.\n */\nexport const ENTER = 13;\n\n/**\n * Keycode for ESCAPE key.\n */\nexport const ESCAPE = 27;\n\n/**\n * Keycode for SPACE key.\n */\nexport const SPACE = 32;\n\n/**\n * Keycode for PAGEUP key.\n */\nexport const PAGEUP = 33;\n\n/**\n * Keycode for PAGEDOWN key.\n */\nexport const PAGEDOWN = 34;\n\n/**\n * Keycode for END key.\n */\nexport const END = 35;\n\n/**\n * Keycode for HOME key.\n */\nexport const HOME = 36;\n\n/**\n * Keycode for LEFT key.\n */\nexport const LEFT = 37;\n\n/**\n * Keycode for UP key.\n */\nexport const UP = 38;\n\n/**\n * Keycode for RIGHT key.\n */\nexport const RIGHT = 39;\n\n/**\n * Keycode for DOWN key.\n */\nexport const DOWN = 40;\n\n/**\n * Keycode for DELETE key.\n */\nexport const DELETE = 46;\n\n/**\n * Keycode for F10 key.\n */\nexport const F10 = 121;\n\n/**\n * Keycode for ALT key.\n */\nexport const ALT = 'alt';\n\n/**\n * Keycode for CTRL key.\n */\nexport const CTRL = 'ctrl';\n\n/**\n * Keycode for COMMAND/META key.\n */\nexport const COMMAND = 'meta';\n\n/**\n * Keycode for SHIFT key.\n */\nexport const SHIFT = 'shift';\n\n/**\n * Keycode for ZERO key.\n */\nexport const ZERO = 48;\n\nexport { isAppleOS };\n\n/**\n * Map the values of an object with a specified callback and return the result object.\n *\n * @template {{ [s: string]: any; } | ArrayLike<any>} T\n *\n * @param {T} object Object to map values of.\n * @param {( value: any ) => any} mapFn Mapping function\n *\n * @return {any} Active modifier constants.\n */\nfunction mapValues( object, mapFn ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).map( ( [ key, value ] ) => [\n\t\t\tkey,\n\t\t\tmapFn( value ),\n\t\t] )\n\t);\n}\n\n/**\n * Object that contains functions that return the available modifier\n * depending on platform.\n *\n * @type {WPModifierHandler< ( isApple: () => boolean ) => WPModifierPart[]>}\n */\nexport const modifiers = {\n\tprimary: ( _isApple ) => ( _isApple() ? [ COMMAND ] : [ CTRL ] ),\n\tprimaryShift: ( _isApple ) =>\n\t\t_isApple() ? [ SHIFT, COMMAND ] : [ CTRL, SHIFT ],\n\tprimaryAlt: ( _isApple ) =>\n\t\t_isApple() ? [ ALT, COMMAND ] : [ CTRL, ALT ],\n\tsecondary: ( _isApple ) =>\n\t\t_isApple() ? [ SHIFT, ALT, COMMAND ] : [ CTRL, SHIFT, ALT ],\n\taccess: ( _isApple ) => ( _isApple() ? [ CTRL, ALT ] : [ SHIFT, ALT ] ),\n\tctrl: () => [ CTRL ],\n\talt: () => [ ALT ],\n\tctrlShift: () => [ CTRL, SHIFT ],\n\tshift: () => [ SHIFT ],\n\tshiftAlt: () => [ SHIFT, ALT ],\n\tundefined: () => [],\n};\n\n/**\n * An object that contains functions to get raw shortcuts.\n *\n * These are intended for user with the KeyboardShortcuts.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * rawShortcut.primary( 'm' )\n * // \"meta+m\"\"\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to raw\n * shortcuts.\n */\nexport const rawShortcut = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ modifier ) => {\n\t\treturn /** @type {WPKeyHandler<string>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\treturn [ ...modifier( _isApple ), character.toLowerCase() ].join(\n\t\t\t\t'+'\n\t\t\t);\n\t\t};\n\t}\n);\n\n/**\n * Return an array of the parts of a keyboard shortcut chord for display.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * displayShortcutList.primary( 'm' );\n * // [ \"⌘\", \"M\" ]\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string[]>>} Keyed map of functions to\n * shortcut sequences.\n */\nexport const displayShortcutList = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ modifier ) => {\n\t\treturn /** @type {WPKeyHandler<string[]>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\tconst isApple = _isApple();\n\t\t\tconst replacementKeyMap = {\n\t\t\t\t[ ALT ]: isApple ? '⌥' : 'Alt',\n\t\t\t\t[ CTRL ]: isApple ? '⌃' : 'Ctrl', // Make sure ⌃ is the U+2303 UP ARROWHEAD unicode character and not the caret character.\n\t\t\t\t[ COMMAND ]: '⌘',\n\t\t\t\t[ SHIFT ]: isApple ? '⇧' : 'Shift',\n\t\t\t};\n\n\t\t\tconst modifierKeys = modifier( _isApple ).reduce(\n\t\t\t\t( accumulator, key ) => {\n\t\t\t\t\tconst replacementKey = replacementKeyMap[ key ] ?? key;\n\t\t\t\t\t// If on the Mac, adhere to platform convention and don't show plus between keys.\n\t\t\t\t\tif ( isApple ) {\n\t\t\t\t\t\treturn [ ...accumulator, replacementKey ];\n\t\t\t\t\t}\n\n\t\t\t\t\treturn [ ...accumulator, replacementKey, '+' ];\n\t\t\t\t},\n\t\t\t\t/** @type {string[]} */ ( [] )\n\t\t\t);\n\n\t\t\t// Symbols (~`,.) are removed by the default regular expression,\n\t\t\t// so override the rule to allow symbols used for shortcuts.\n\t\t\t// see: https://github.com/blakeembrey/change-case#options\n\t\t\tconst capitalizedCharacter = capitalCase( character, {\n\t\t\t\tstripRegexp: /[^A-Z0-9~`,\\.\\\\\\-]/gi,\n\t\t\t} );\n\n\t\t\treturn [ ...modifierKeys, capitalizedCharacter ];\n\t\t};\n\t}\n);\n\n/**\n * An object that contains functions to display shortcuts.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * displayShortcut.primary( 'm' );\n * // \"⌘M\"\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to\n * display shortcuts.\n */\nexport const displayShortcut = mapValues(\n\tdisplayShortcutList,\n\t( /** @type {WPKeyHandler<string[]>} */ shortcutList ) => {\n\t\treturn /** @type {WPKeyHandler<string>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => shortcutList( character, _isApple ).join( '' );\n\t}\n);\n\n/**\n * An object that contains functions to return an aria label for a keyboard\n * shortcut.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * shortcutAriaLabel.primary( '.' );\n * // \"Command + Period\"\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to\n * shortcut ARIA labels.\n */\nexport const shortcutAriaLabel = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ modifier ) => {\n\t\treturn /** @type {WPKeyHandler<string>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\tconst isApple = _isApple();\n\t\t\t/** @type {Record<string,string>} */\n\t\t\tconst replacementKeyMap = {\n\t\t\t\t[ SHIFT ]: 'Shift',\n\t\t\t\t[ COMMAND ]: isApple ? 'Command' : 'Control',\n\t\t\t\t[ CTRL ]: 'Control',\n\t\t\t\t[ ALT ]: isApple ? 'Option' : 'Alt',\n\t\t\t\t/* translators: comma as in the character ',' */\n\t\t\t\t',': __( 'Comma' ),\n\t\t\t\t/* translators: period as in the character '.' */\n\t\t\t\t'.': __( 'Period' ),\n\t\t\t\t/* translators: backtick as in the character '`' */\n\t\t\t\t'`': __( 'Backtick' ),\n\t\t\t\t/* translators: tilde as in the character '~' */\n\t\t\t\t'~': __( 'Tilde' ),\n\t\t\t};\n\n\t\t\treturn [ ...modifier( _isApple ), character ]\n\t\t\t\t.map( ( key ) =>\n\t\t\t\t\tcapitalCase( replacementKeyMap[ key ] ?? key )\n\t\t\t\t)\n\t\t\t\t.join( isApple ? ' ' : ' + ' );\n\t\t};\n\t}\n);\n\n/**\n * From a given KeyboardEvent, returns an array of active modifier constants for\n * the event.\n *\n * @param {import('react').KeyboardEvent<HTMLElement> | KeyboardEvent} event Keyboard event.\n *\n * @return {Array<WPModifierPart>} Active modifier constants.\n */\nfunction getEventModifiers( event ) {\n\treturn /** @type {WPModifierPart[]} */ ( [\n\t\tALT,\n\t\tCTRL,\n\t\tCOMMAND,\n\t\tSHIFT,\n\t] ).filter(\n\t\t( key ) =>\n\t\t\tevent[\n\t\t\t\t/** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */ (\n\t\t\t\t\t`${ key }Key`\n\t\t\t\t)\n\t\t\t]\n\t);\n}\n\n/**\n * An object that contains functions to check if a keyboard event matches a\n * predefined shortcut combination.\n *\n * @example\n * ```js\n * // Assuming an event for ⌘M key press:\n * isKeyboardEvent.primary( event, 'm' );\n * // true\n * ```\n *\n * @type {WPModifierHandler<WPEventKeyHandler>} Keyed map of functions\n * to match events.\n */\nexport const isKeyboardEvent = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ getModifiers ) => {\n\t\treturn /** @type {WPEventKeyHandler} */ (\n\t\t\tevent,\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\tconst mods = getModifiers( _isApple );\n\t\t\tconst eventMods = getEventModifiers( event );\n\t\t\t/** @type {Record<string,string>} */\n\t\t\tconst replacementWithShiftKeyMap = {\n\t\t\t\tComma: ',',\n\t\t\t\tBackslash: '\\\\',\n\t\t\t\t// Windows returns `\\` for both IntlRo and IntlYen.\n\t\t\t\tIntlRo: '\\\\',\n\t\t\t\tIntlYen: '\\\\',\n\t\t\t};\n\n\t\t\tconst modsDiff = mods.filter(\n\t\t\t\t( mod ) => ! eventMods.includes( mod )\n\t\t\t);\n\t\t\tconst eventModsDiff = eventMods.filter(\n\t\t\t\t( mod ) => ! mods.includes( mod )\n\t\t\t);\n\n\t\t\tif ( modsDiff.length > 0 || eventModsDiff.length > 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tlet key = event.key.toLowerCase();\n\n\t\t\tif ( ! character ) {\n\t\t\t\treturn mods.includes( /** @type {WPModifierPart} */ ( key ) );\n\t\t\t}\n\n\t\t\tif ( event.altKey && character.length === 1 ) {\n\t\t\t\tkey = String.fromCharCode( event.keyCode ).toLowerCase();\n\t\t\t}\n\n\t\t\t// `event.key` returns the value of the key pressed, taking into the state of\n\t\t\t// modifier keys such as `Shift`. If the shift key is pressed, a different\n\t\t\t// value may be returned depending on the keyboard layout. It is necessary to\n\t\t\t// convert to the physical key value that don't take into account keyboard\n\t\t\t// layout or modifier key state.\n\t\t\tif (\n\t\t\t\tevent.shiftKey &&\n\t\t\t\tcharacter.length === 1 &&\n\t\t\t\treplacementWithShiftKeyMap[ event.code ]\n\t\t\t) {\n\t\t\t\tkey = replacementWithShiftKeyMap[ event.code ];\n\t\t\t}\n\n\t\t\t// For backwards compatibility.\n\t\t\tif ( character === 'del' ) {\n\t\t\t\tcharacter = 'delete';\n\t\t\t}\n\n\t\t\treturn key === character.toLowerCase();\n\t\t};\n\t}\n);\n"],"mappings":";;;;;;;;;;;;;AAcA,IAAAA,WAAA,GAAA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MAAM,CACnCW,GAAG,IAAM,CAAER,IAAI,CAACS,QAAQ,CAAED,GAAI,CACjC,CAAC;MAED,IAAKD,QAAQ,CAACI,MAAM,GAAG,CAAC,IAAID,aAAa,CAACC,MAAM,GAAG,CAAC,EAAG;QACtD,OAAO,KAAK;MACb;MAEA,IAAIrD,GAAG,GAAGsC,KAAK,CAACtC,GAAG,CAACmB,WAAW,CAAC,CAAC;MAEjC,IAAK,CAAEF,SAAS,EAAG;QAClB,OAAOyB,IAAI,CAACS,QAAQ,EAAE,6BAAgCnD,GAAM,CAAC;MAC9D;MAEA,IAAKsC,KAAK,CAACgB,MAAM,IAAIrC,SAAS,CAACoC,MAAM,KAAK,CAAC,EAAG;QAC7CrD,GAAG,GAAGuD,MAAM,CAACC,YAAY,CAAElB,KAAK,CAACmB,OAAQ,CAAC,CAACtC,WAAW,CAAC,CAAC;MACzD;;MAEA;MACA;MACA;MACA;MACA;MACA,IACCmB,KAAK,CAACoB,QAAQ,IACdzC,SAAS,CAACoC,MAAM,KAAK,CAAC,IACtBT,0BAA0B,CAAEN,KAAK,CAACqB,IAAI,CAAE,EACvC;QACD3D,GAAG,GAAG4C,0BAA0B,CAAEN,KAAK,CAACqB,IAAI,CAAE;MAC/C;;MAEA;MACA,IAAK1C,SAAS,KAAK,KAAK,EAAG;QAC1BA,SAAS,GAAG,QAAQ;MACrB;MAEA,OAAOjB,GAAG,KAAKiB,SAAS,CAACE,WAAW,CAAC,CAAC;IACvC;EAAC;AACF,CACD,CAAC;AAAC9C,OAAA,CAAAmE,eAAA,GAAAA,eAAA"}
package/build/platform.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isAppleOS = isAppleOS;
7
-
8
7
  /**
9
8
  * Return true if platform is MacOS.
10
9
  *
@@ -17,10 +16,8 @@ function isAppleOS(_window = null) {
17
16
  if (typeof window === 'undefined') {
18
17
  return false;
19
18
  }
20
-
21
19
  _window = window;
22
20
  }
23
-
24
21
  const {
25
22
  platform
26
23
  } = _window.navigator;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/keycodes/src/platform.js"],"names":["isAppleOS","_window","window","platform","navigator","indexOf","includes"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,SAAT,CAAoBC,OAAO,GAAG,IAA9B,EAAqC;AAC3C,MAAK,CAAEA,OAAP,EAAiB;AAChB,QAAK,OAAOC,MAAP,KAAkB,WAAvB,EAAqC;AACpC,aAAO,KAAP;AACA;;AAEDD,IAAAA,OAAO,GAAGC,MAAV;AACA;;AAED,QAAM;AAAEC,IAAAA;AAAF,MAAeF,OAAO,CAACG,SAA7B;AAEA,SACCD,QAAQ,CAACE,OAAT,CAAkB,KAAlB,MAA8B,CAAC,CAA/B,IACA,CAAE,MAAF,EAAU,QAAV,EAAqBC,QAArB,CAA+BH,QAA/B,CAFD;AAIA","sourcesContent":["/**\n * Return true if platform is MacOS.\n *\n * @param {Window?} _window window object by default; used for DI testing.\n *\n * @return {boolean} True if MacOS; false otherwise.\n */\nexport function isAppleOS( _window = null ) {\n\tif ( ! _window ) {\n\t\tif ( typeof window === 'undefined' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t_window = window;\n\t}\n\n\tconst { platform } = _window.navigator;\n\n\treturn (\n\t\tplatform.indexOf( 'Mac' ) !== -1 ||\n\t\t[ 'iPad', 'iPhone' ].includes( platform )\n\t);\n}\n"]}
1
+ {"version":3,"names":["isAppleOS","_window","window","platform","navigator","indexOf","includes"],"sources":["@wordpress/keycodes/src/platform.js"],"sourcesContent":["/**\n * Return true if platform is MacOS.\n *\n * @param {Window?} _window window object by default; used for DI testing.\n *\n * @return {boolean} True if MacOS; false otherwise.\n */\nexport function isAppleOS( _window = null ) {\n\tif ( ! _window ) {\n\t\tif ( typeof window === 'undefined' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t_window = window;\n\t}\n\n\tconst { platform } = _window.navigator;\n\n\treturn (\n\t\tplatform.indexOf( 'Mac' ) !== -1 ||\n\t\t[ 'iPad', 'iPhone' ].includes( platform )\n\t);\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,SAASA,CAAEC,OAAO,GAAG,IAAI,EAAG;EAC3C,IAAK,CAAEA,OAAO,EAAG;IAChB,IAAK,OAAOC,MAAM,KAAK,WAAW,EAAG;MACpC,OAAO,KAAK;IACb;IAEAD,OAAO,GAAGC,MAAM;EACjB;EAEA,MAAM;IAAEC;EAAS,CAAC,GAAGF,OAAO,CAACG,SAAS;EAEtC,OACCD,QAAQ,CAACE,OAAO,CAAE,KAAM,CAAC,KAAK,CAAC,CAAC,IAChC,CAAE,MAAM,EAAE,QAAQ,CAAE,CAACC,QAAQ,CAAEH,QAAS,CAAC;AAE3C"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isAppleOS = isAppleOS;
7
-
8
7
  var _reactNative = require("react-native");
9
-
10
8
  /**
11
9
  * External dependencies
12
10
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/keycodes/src/platform.native.js"],"names":["isAppleOS","Platform","OS"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACO,SAASA,SAAT,GAAqB;AAC3B,SAAOC,sBAASC,EAAT,KAAgB,KAAvB;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { Platform } from 'react-native';\n\n/**\n * Return true if platform is iOS.\n *\n * @return {boolean} True if iOS; false otherwise.\n */\nexport function isAppleOS() {\n\treturn Platform.OS === 'ios';\n}\n"]}
1
+ {"version":3,"names":["_reactNative","require","isAppleOS","Platform","OS"],"sources":["@wordpress/keycodes/src/platform.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Platform } from 'react-native';\n\n/**\n * Return true if platform is iOS.\n *\n * @return {boolean} True if iOS; false otherwise.\n */\nexport function isAppleOS() {\n\treturn Platform.OS === 'ios';\n}\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACO,SAASC,SAASA,CAAA,EAAG;EAC3B,OAAOC,qBAAQ,CAACC,EAAE,KAAK,KAAK;AAC7B"}
@@ -13,16 +13,17 @@
13
13
  * External dependencies
14
14
  */
15
15
  import { capitalCase } from 'change-case';
16
+
16
17
  /**
17
18
  * WordPress dependencies
18
19
  */
19
-
20
20
  import { __ } from '@wordpress/i18n';
21
+
21
22
  /**
22
23
  * Internal dependencies
23
24
  */
24
-
25
25
  import { isAppleOS } from './platform';
26
+
26
27
  /** @typedef {typeof ALT | CTRL | COMMAND | SHIFT } WPModifierPart */
27
28
 
28
29
  /** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */
@@ -41,7 +42,6 @@ import { isAppleOS } from './platform';
41
42
  *
42
43
  * @typedef {(character: string, isApple?: () => boolean) => T} WPKeyHandler
43
44
  */
44
-
45
45
  /** @typedef {(event: import('react').KeyboardEvent<HTMLElement> | KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */
46
46
 
47
47
  /** @typedef {( isApple: () => boolean ) => WPModifierPart[]} WPModifier */
@@ -49,104 +49,104 @@ import { isAppleOS } from './platform';
49
49
  /**
50
50
  * Keycode for BACKSPACE key.
51
51
  */
52
-
53
52
  export const BACKSPACE = 8;
53
+
54
54
  /**
55
55
  * Keycode for TAB key.
56
56
  */
57
-
58
57
  export const TAB = 9;
58
+
59
59
  /**
60
60
  * Keycode for ENTER key.
61
61
  */
62
-
63
62
  export const ENTER = 13;
63
+
64
64
  /**
65
65
  * Keycode for ESCAPE key.
66
66
  */
67
-
68
67
  export const ESCAPE = 27;
68
+
69
69
  /**
70
70
  * Keycode for SPACE key.
71
71
  */
72
-
73
72
  export const SPACE = 32;
73
+
74
74
  /**
75
75
  * Keycode for PAGEUP key.
76
76
  */
77
-
78
77
  export const PAGEUP = 33;
78
+
79
79
  /**
80
80
  * Keycode for PAGEDOWN key.
81
81
  */
82
-
83
82
  export const PAGEDOWN = 34;
83
+
84
84
  /**
85
85
  * Keycode for END key.
86
86
  */
87
-
88
87
  export const END = 35;
88
+
89
89
  /**
90
90
  * Keycode for HOME key.
91
91
  */
92
-
93
92
  export const HOME = 36;
93
+
94
94
  /**
95
95
  * Keycode for LEFT key.
96
96
  */
97
-
98
97
  export const LEFT = 37;
98
+
99
99
  /**
100
100
  * Keycode for UP key.
101
101
  */
102
-
103
102
  export const UP = 38;
103
+
104
104
  /**
105
105
  * Keycode for RIGHT key.
106
106
  */
107
-
108
107
  export const RIGHT = 39;
108
+
109
109
  /**
110
110
  * Keycode for DOWN key.
111
111
  */
112
-
113
112
  export const DOWN = 40;
113
+
114
114
  /**
115
115
  * Keycode for DELETE key.
116
116
  */
117
-
118
117
  export const DELETE = 46;
118
+
119
119
  /**
120
120
  * Keycode for F10 key.
121
121
  */
122
-
123
122
  export const F10 = 121;
123
+
124
124
  /**
125
125
  * Keycode for ALT key.
126
126
  */
127
-
128
127
  export const ALT = 'alt';
128
+
129
129
  /**
130
130
  * Keycode for CTRL key.
131
131
  */
132
-
133
132
  export const CTRL = 'ctrl';
133
+
134
134
  /**
135
135
  * Keycode for COMMAND/META key.
136
136
  */
137
-
138
137
  export const COMMAND = 'meta';
138
+
139
139
  /**
140
140
  * Keycode for SHIFT key.
141
141
  */
142
-
143
142
  export const SHIFT = 'shift';
143
+
144
144
  /**
145
145
  * Keycode for ZERO key.
146
146
  */
147
-
148
147
  export const ZERO = 48;
149
148
  export { isAppleOS };
149
+
150
150
  /**
151
151
  * Map the values of an object with a specified callback and return the result object.
152
152
  *
@@ -157,18 +157,16 @@ export { isAppleOS };
157
157
  *
158
158
  * @return {any} Active modifier constants.
159
159
  */
160
-
161
160
  function mapValues(object, mapFn) {
162
161
  return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, mapFn(value)]));
163
162
  }
163
+
164
164
  /**
165
165
  * Object that contains functions that return the available modifier
166
166
  * depending on platform.
167
167
  *
168
168
  * @type {WPModifierHandler< ( isApple: () => boolean ) => WPModifierPart[]>}
169
169
  */
170
-
171
-
172
170
  export const modifiers = {
173
171
  primary: _isApple => _isApple() ? [COMMAND] : [CTRL],
174
172
  primaryShift: _isApple => _isApple() ? [SHIFT, COMMAND] : [CTRL, SHIFT],
@@ -182,6 +180,7 @@ export const modifiers = {
182
180
  shiftAlt: () => [SHIFT, ALT],
183
181
  undefined: () => []
184
182
  };
183
+
185
184
  /**
186
185
  * An object that contains functions to get raw shortcuts.
187
186
  *
@@ -197,17 +196,13 @@ export const modifiers = {
197
196
  * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to raw
198
197
  * shortcuts.
199
198
  */
200
-
201
- export const rawShortcut = mapValues(modifiers, (
202
- /** @type {WPModifier} */
203
- modifier) => {
204
- return (
205
- /** @type {WPKeyHandler<string>} */
206
- (character, _isApple = isAppleOS) => {
199
+ export const rawShortcut = mapValues(modifiers, ( /** @type {WPModifier} */modifier) => {
200
+ return (/** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => {
207
201
  return [...modifier(_isApple), character.toLowerCase()].join('+');
208
202
  }
209
203
  );
210
204
  });
205
+
211
206
  /**
212
207
  * Return an array of the parts of a keyboard shortcut chord for display.
213
208
  *
@@ -221,15 +216,9 @@ modifier) => {
221
216
  * @type {WPModifierHandler<WPKeyHandler<string[]>>} Keyed map of functions to
222
217
  * shortcut sequences.
223
218
  */
224
-
225
- export const displayShortcutList = mapValues(modifiers, (
226
- /** @type {WPModifier} */
227
- modifier) => {
228
- return (
229
- /** @type {WPKeyHandler<string[]>} */
230
- (character, _isApple = isAppleOS) => {
219
+ export const displayShortcutList = mapValues(modifiers, ( /** @type {WPModifier} */modifier) => {
220
+ return (/** @type {WPKeyHandler<string[]>} */(character, _isApple = isAppleOS) => {
231
221
  const isApple = _isApple();
232
-
233
222
  const replacementKeyMap = {
234
223
  [ALT]: isApple ? '⌥' : 'Alt',
235
224
  [CTRL]: isApple ? '⌃' : 'Ctrl',
@@ -239,20 +228,17 @@ modifier) => {
239
228
  };
240
229
  const modifierKeys = modifier(_isApple).reduce((accumulator, key) => {
241
230
  var _replacementKeyMap$ke;
242
-
243
- const replacementKey = (_replacementKeyMap$ke = replacementKeyMap[key]) !== null && _replacementKeyMap$ke !== void 0 ? _replacementKeyMap$ke : key; // If on the Mac, adhere to platform convention and don't show plus between keys.
244
-
231
+ const replacementKey = (_replacementKeyMap$ke = replacementKeyMap[key]) !== null && _replacementKeyMap$ke !== void 0 ? _replacementKeyMap$ke : key;
232
+ // If on the Mac, adhere to platform convention and don't show plus between keys.
245
233
  if (isApple) {
246
234
  return [...accumulator, replacementKey];
247
235
  }
248
-
249
236
  return [...accumulator, replacementKey, '+'];
250
- },
251
- /** @type {string[]} */
252
- []); // Symbols (~`,.) are removed by the default regular expression,
237
+ }, /** @type {string[]} */[]);
238
+
239
+ // Symbols (~`,.) are removed by the default regular expression,
253
240
  // so override the rule to allow symbols used for shortcuts.
254
241
  // see: https://github.com/blakeembrey/change-case#options
255
-
256
242
  const capitalizedCharacter = capitalCase(character, {
257
243
  stripRegexp: /[^A-Z0-9~`,\.\\\-]/gi
258
244
  });
@@ -260,6 +246,7 @@ modifier) => {
260
246
  }
261
247
  );
262
248
  });
249
+
263
250
  /**
264
251
  * An object that contains functions to display shortcuts.
265
252
  *
@@ -273,15 +260,11 @@ modifier) => {
273
260
  * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to
274
261
  * display shortcuts.
275
262
  */
276
-
277
- export const displayShortcut = mapValues(displayShortcutList, (
278
- /** @type {WPKeyHandler<string[]>} */
279
- shortcutList) => {
280
- return (
281
- /** @type {WPKeyHandler<string>} */
282
- (character, _isApple = isAppleOS) => shortcutList(character, _isApple).join('')
263
+ export const displayShortcut = mapValues(displayShortcutList, ( /** @type {WPKeyHandler<string[]>} */shortcutList) => {
264
+ return (/** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => shortcutList(character, _isApple).join('')
283
265
  );
284
266
  });
267
+
285
268
  /**
286
269
  * An object that contains functions to return an aria label for a keyboard
287
270
  * shortcut.
@@ -296,43 +279,32 @@ shortcutList) => {
296
279
  * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to
297
280
  * shortcut ARIA labels.
298
281
  */
299
-
300
- export const shortcutAriaLabel = mapValues(modifiers, (
301
- /** @type {WPModifier} */
302
- modifier) => {
303
- return (
304
- /** @type {WPKeyHandler<string>} */
305
- (character, _isApple = isAppleOS) => {
282
+ export const shortcutAriaLabel = mapValues(modifiers, ( /** @type {WPModifier} */modifier) => {
283
+ return (/** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => {
306
284
  const isApple = _isApple();
307
285
  /** @type {Record<string,string>} */
308
-
309
-
310
286
  const replacementKeyMap = {
311
287
  [SHIFT]: 'Shift',
312
288
  [COMMAND]: isApple ? 'Command' : 'Control',
313
289
  [CTRL]: 'Control',
314
290
  [ALT]: isApple ? 'Option' : 'Alt',
315
-
316
291
  /* translators: comma as in the character ',' */
317
292
  ',': __('Comma'),
318
-
319
293
  /* translators: period as in the character '.' */
320
294
  '.': __('Period'),
321
-
322
295
  /* translators: backtick as in the character '`' */
323
296
  '`': __('Backtick'),
324
-
325
297
  /* translators: tilde as in the character '~' */
326
298
  '~': __('Tilde')
327
299
  };
328
300
  return [...modifier(_isApple), character].map(key => {
329
301
  var _replacementKeyMap$ke2;
330
-
331
302
  return capitalCase((_replacementKeyMap$ke2 = replacementKeyMap[key]) !== null && _replacementKeyMap$ke2 !== void 0 ? _replacementKeyMap$ke2 : key);
332
303
  }).join(isApple ? ' ' : ' + ');
333
304
  }
334
305
  );
335
306
  });
307
+
336
308
  /**
337
309
  * From a given KeyboardEvent, returns an array of active modifier constants for
338
310
  * the event.
@@ -341,15 +313,12 @@ modifier) => {
341
313
  *
342
314
  * @return {Array<WPModifierPart>} Active modifier constants.
343
315
  */
344
-
345
316
  function getEventModifiers(event) {
346
- return (
347
- /** @type {WPModifierPart[]} */
348
- [ALT, CTRL, COMMAND, SHIFT].filter(key => event[
349
- /** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */
317
+ return (/** @type {WPModifierPart[]} */[ALT, CTRL, COMMAND, SHIFT].filter(key => event[/** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */
350
318
  `${key}Key`])
351
319
  );
352
320
  }
321
+
353
322
  /**
354
323
  * An object that contains functions to check if a keyboard event matches a
355
324
  * predefined shortcut combination.
@@ -364,18 +333,11 @@ function getEventModifiers(event) {
364
333
  * @type {WPModifierHandler<WPEventKeyHandler>} Keyed map of functions
365
334
  * to match events.
366
335
  */
367
-
368
-
369
- export const isKeyboardEvent = mapValues(modifiers, (
370
- /** @type {WPModifier} */
371
- getModifiers) => {
372
- return (
373
- /** @type {WPEventKeyHandler} */
374
- (event, character, _isApple = isAppleOS) => {
336
+ export const isKeyboardEvent = mapValues(modifiers, ( /** @type {WPModifier} */getModifiers) => {
337
+ return (/** @type {WPEventKeyHandler} */(event, character, _isApple = isAppleOS) => {
375
338
  const mods = getModifiers(_isApple);
376
339
  const eventMods = getEventModifiers(event);
377
340
  /** @type {Record<string,string>} */
378
-
379
341
  const replacementWithShiftKeyMap = {
380
342
  Comma: ',',
381
343
  Backslash: '\\',
@@ -385,37 +347,30 @@ getModifiers) => {
385
347
  };
386
348
  const modsDiff = mods.filter(mod => !eventMods.includes(mod));
387
349
  const eventModsDiff = eventMods.filter(mod => !mods.includes(mod));
388
-
389
350
  if (modsDiff.length > 0 || eventModsDiff.length > 0) {
390
351
  return false;
391
352
  }
392
-
393
353
  let key = event.key.toLowerCase();
394
-
395
354
  if (!character) {
396
- return mods.includes(
397
- /** @type {WPModifierPart} */
398
- key);
355
+ return mods.includes( /** @type {WPModifierPart} */key);
399
356
  }
400
-
401
357
  if (event.altKey && character.length === 1) {
402
358
  key = String.fromCharCode(event.keyCode).toLowerCase();
403
- } // `event.key` returns the value of the key pressed, taking into the state of
359
+ }
360
+
361
+ // `event.key` returns the value of the key pressed, taking into the state of
404
362
  // modifier keys such as `Shift`. If the shift key is pressed, a different
405
363
  // value may be returned depending on the keyboard layout. It is necessary to
406
364
  // convert to the physical key value that don't take into account keyboard
407
365
  // layout or modifier key state.
408
-
409
-
410
366
  if (event.shiftKey && character.length === 1 && replacementWithShiftKeyMap[event.code]) {
411
367
  key = replacementWithShiftKeyMap[event.code];
412
- } // For backwards compatibility.
413
-
368
+ }
414
369
 
370
+ // For backwards compatibility.
415
371
  if (character === 'del') {
416
372
  character = 'delete';
417
373
  }
418
-
419
374
  return key === character.toLowerCase();
420
375
  }
421
376
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/keycodes/src/index.js"],"names":["capitalCase","__","isAppleOS","BACKSPACE","TAB","ENTER","ESCAPE","SPACE","PAGEUP","PAGEDOWN","END","HOME","LEFT","UP","RIGHT","DOWN","DELETE","F10","ALT","CTRL","COMMAND","SHIFT","ZERO","mapValues","object","mapFn","Object","fromEntries","entries","map","key","value","modifiers","primary","_isApple","primaryShift","primaryAlt","secondary","access","ctrl","alt","ctrlShift","shift","shiftAlt","undefined","rawShortcut","modifier","character","toLowerCase","join","displayShortcutList","isApple","replacementKeyMap","modifierKeys","reduce","accumulator","replacementKey","capitalizedCharacter","stripRegexp","displayShortcut","shortcutList","shortcutAriaLabel","getEventModifiers","event","filter","isKeyboardEvent","getModifiers","mods","eventMods","replacementWithShiftKeyMap","Comma","Backslash","IntlRo","IntlYen","modsDiff","mod","includes","eventModsDiff","length","altKey","String","fromCharCode","keyCode","shiftKey","code"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,aAA5B;AAEA;AACA;AACA;;AACA,SAAS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of the modifier keys in many of the [foo]Shortcut()\n * functions in this file are intentional and should not be changed. They're\n * designed to fit with the standard menu keyboard shortcuts shown in the\n * user's platform.\n *\n * For example, on MacOS menu shortcuts will place Shift before Command, but\n * on Windows Control will usually come first. So don't provide your own\n * shortcut combos directly to keyboardShortcut().\n */\n\n/**\n * External dependencies\n */\nimport { capitalCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { isAppleOS } from './platform';\n\n/** @typedef {typeof ALT | CTRL | COMMAND | SHIFT } WPModifierPart */\n\n/** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */\n\n/**\n * An object of handler functions for each of the possible modifier\n * combinations. A handler will return a value for a given key.\n *\n * @template T\n *\n * @typedef {Record<WPKeycodeModifier, T>} WPModifierHandler\n */\n\n/**\n * @template T\n *\n * @typedef {(character: string, isApple?: () => boolean) => T} WPKeyHandler\n */\n/** @typedef {(event: import('react').KeyboardEvent<HTMLElement> | KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */\n\n/** @typedef {( isApple: () => boolean ) => WPModifierPart[]} WPModifier */\n\n/**\n * Keycode for BACKSPACE key.\n */\nexport const BACKSPACE = 8;\n\n/**\n * Keycode for TAB key.\n */\nexport const TAB = 9;\n\n/**\n * Keycode for ENTER key.\n */\nexport const ENTER = 13;\n\n/**\n * Keycode for ESCAPE key.\n */\nexport const ESCAPE = 27;\n\n/**\n * Keycode for SPACE key.\n */\nexport const SPACE = 32;\n\n/**\n * Keycode for PAGEUP key.\n */\nexport const PAGEUP = 33;\n\n/**\n * Keycode for PAGEDOWN key.\n */\nexport const PAGEDOWN = 34;\n\n/**\n * Keycode for END key.\n */\nexport const END = 35;\n\n/**\n * Keycode for HOME key.\n */\nexport const HOME = 36;\n\n/**\n * Keycode for LEFT key.\n */\nexport const LEFT = 37;\n\n/**\n * Keycode for UP key.\n */\nexport const UP = 38;\n\n/**\n * Keycode for RIGHT key.\n */\nexport const RIGHT = 39;\n\n/**\n * Keycode for DOWN key.\n */\nexport const DOWN = 40;\n\n/**\n * Keycode for DELETE key.\n */\nexport const DELETE = 46;\n\n/**\n * Keycode for F10 key.\n */\nexport const F10 = 121;\n\n/**\n * Keycode for ALT key.\n */\nexport const ALT = 'alt';\n\n/**\n * Keycode for CTRL key.\n */\nexport const CTRL = 'ctrl';\n\n/**\n * Keycode for COMMAND/META key.\n */\nexport const COMMAND = 'meta';\n\n/**\n * Keycode for SHIFT key.\n */\nexport const SHIFT = 'shift';\n\n/**\n * Keycode for ZERO key.\n */\nexport const ZERO = 48;\n\nexport { isAppleOS };\n\n/**\n * Map the values of an object with a specified callback and return the result object.\n *\n * @template {{ [s: string]: any; } | ArrayLike<any>} T\n *\n * @param {T} object Object to map values of.\n * @param {( value: any ) => any} mapFn Mapping function\n *\n * @return {any} Active modifier constants.\n */\nfunction mapValues( object, mapFn ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).map( ( [ key, value ] ) => [\n\t\t\tkey,\n\t\t\tmapFn( value ),\n\t\t] )\n\t);\n}\n\n/**\n * Object that contains functions that return the available modifier\n * depending on platform.\n *\n * @type {WPModifierHandler< ( isApple: () => boolean ) => WPModifierPart[]>}\n */\nexport const modifiers = {\n\tprimary: ( _isApple ) => ( _isApple() ? [ COMMAND ] : [ CTRL ] ),\n\tprimaryShift: ( _isApple ) =>\n\t\t_isApple() ? [ SHIFT, COMMAND ] : [ CTRL, SHIFT ],\n\tprimaryAlt: ( _isApple ) =>\n\t\t_isApple() ? [ ALT, COMMAND ] : [ CTRL, ALT ],\n\tsecondary: ( _isApple ) =>\n\t\t_isApple() ? [ SHIFT, ALT, COMMAND ] : [ CTRL, SHIFT, ALT ],\n\taccess: ( _isApple ) => ( _isApple() ? [ CTRL, ALT ] : [ SHIFT, ALT ] ),\n\tctrl: () => [ CTRL ],\n\talt: () => [ ALT ],\n\tctrlShift: () => [ CTRL, SHIFT ],\n\tshift: () => [ SHIFT ],\n\tshiftAlt: () => [ SHIFT, ALT ],\n\tundefined: () => [],\n};\n\n/**\n * An object that contains functions to get raw shortcuts.\n *\n * These are intended for user with the KeyboardShortcuts.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * rawShortcut.primary( 'm' )\n * // \"meta+m\"\"\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to raw\n * shortcuts.\n */\nexport const rawShortcut = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ modifier ) => {\n\t\treturn /** @type {WPKeyHandler<string>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\treturn [ ...modifier( _isApple ), character.toLowerCase() ].join(\n\t\t\t\t'+'\n\t\t\t);\n\t\t};\n\t}\n);\n\n/**\n * Return an array of the parts of a keyboard shortcut chord for display.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * displayShortcutList.primary( 'm' );\n * // [ \"⌘\", \"M\" ]\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string[]>>} Keyed map of functions to\n * shortcut sequences.\n */\nexport const displayShortcutList = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ modifier ) => {\n\t\treturn /** @type {WPKeyHandler<string[]>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\tconst isApple = _isApple();\n\t\t\tconst replacementKeyMap = {\n\t\t\t\t[ ALT ]: isApple ? '⌥' : 'Alt',\n\t\t\t\t[ CTRL ]: isApple ? '⌃' : 'Ctrl', // Make sure ⌃ is the U+2303 UP ARROWHEAD unicode character and not the caret character.\n\t\t\t\t[ COMMAND ]: '⌘',\n\t\t\t\t[ SHIFT ]: isApple ? '⇧' : 'Shift',\n\t\t\t};\n\n\t\t\tconst modifierKeys = modifier( _isApple ).reduce(\n\t\t\t\t( accumulator, key ) => {\n\t\t\t\t\tconst replacementKey = replacementKeyMap[ key ] ?? key;\n\t\t\t\t\t// If on the Mac, adhere to platform convention and don't show plus between keys.\n\t\t\t\t\tif ( isApple ) {\n\t\t\t\t\t\treturn [ ...accumulator, replacementKey ];\n\t\t\t\t\t}\n\n\t\t\t\t\treturn [ ...accumulator, replacementKey, '+' ];\n\t\t\t\t},\n\t\t\t\t/** @type {string[]} */ ( [] )\n\t\t\t);\n\n\t\t\t// Symbols (~`,.) are removed by the default regular expression,\n\t\t\t// so override the rule to allow symbols used for shortcuts.\n\t\t\t// see: https://github.com/blakeembrey/change-case#options\n\t\t\tconst capitalizedCharacter = capitalCase( character, {\n\t\t\t\tstripRegexp: /[^A-Z0-9~`,\\.\\\\\\-]/gi,\n\t\t\t} );\n\n\t\t\treturn [ ...modifierKeys, capitalizedCharacter ];\n\t\t};\n\t}\n);\n\n/**\n * An object that contains functions to display shortcuts.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * displayShortcut.primary( 'm' );\n * // \"⌘M\"\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to\n * display shortcuts.\n */\nexport const displayShortcut = mapValues(\n\tdisplayShortcutList,\n\t( /** @type {WPKeyHandler<string[]>} */ shortcutList ) => {\n\t\treturn /** @type {WPKeyHandler<string>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => shortcutList( character, _isApple ).join( '' );\n\t}\n);\n\n/**\n * An object that contains functions to return an aria label for a keyboard\n * shortcut.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * shortcutAriaLabel.primary( '.' );\n * // \"Command + Period\"\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to\n * shortcut ARIA labels.\n */\nexport const shortcutAriaLabel = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ modifier ) => {\n\t\treturn /** @type {WPKeyHandler<string>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\tconst isApple = _isApple();\n\t\t\t/** @type {Record<string,string>} */\n\t\t\tconst replacementKeyMap = {\n\t\t\t\t[ SHIFT ]: 'Shift',\n\t\t\t\t[ COMMAND ]: isApple ? 'Command' : 'Control',\n\t\t\t\t[ CTRL ]: 'Control',\n\t\t\t\t[ ALT ]: isApple ? 'Option' : 'Alt',\n\t\t\t\t/* translators: comma as in the character ',' */\n\t\t\t\t',': __( 'Comma' ),\n\t\t\t\t/* translators: period as in the character '.' */\n\t\t\t\t'.': __( 'Period' ),\n\t\t\t\t/* translators: backtick as in the character '`' */\n\t\t\t\t'`': __( 'Backtick' ),\n\t\t\t\t/* translators: tilde as in the character '~' */\n\t\t\t\t'~': __( 'Tilde' ),\n\t\t\t};\n\n\t\t\treturn [ ...modifier( _isApple ), character ]\n\t\t\t\t.map( ( key ) =>\n\t\t\t\t\tcapitalCase( replacementKeyMap[ key ] ?? key )\n\t\t\t\t)\n\t\t\t\t.join( isApple ? ' ' : ' + ' );\n\t\t};\n\t}\n);\n\n/**\n * From a given KeyboardEvent, returns an array of active modifier constants for\n * the event.\n *\n * @param {import('react').KeyboardEvent<HTMLElement> | KeyboardEvent} event Keyboard event.\n *\n * @return {Array<WPModifierPart>} Active modifier constants.\n */\nfunction getEventModifiers( event ) {\n\treturn /** @type {WPModifierPart[]} */ ( [\n\t\tALT,\n\t\tCTRL,\n\t\tCOMMAND,\n\t\tSHIFT,\n\t] ).filter(\n\t\t( key ) =>\n\t\t\tevent[\n\t\t\t\t/** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */ (\n\t\t\t\t\t`${ key }Key`\n\t\t\t\t)\n\t\t\t]\n\t);\n}\n\n/**\n * An object that contains functions to check if a keyboard event matches a\n * predefined shortcut combination.\n *\n * @example\n * ```js\n * // Assuming an event for ⌘M key press:\n * isKeyboardEvent.primary( event, 'm' );\n * // true\n * ```\n *\n * @type {WPModifierHandler<WPEventKeyHandler>} Keyed map of functions\n * to match events.\n */\nexport const isKeyboardEvent = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ getModifiers ) => {\n\t\treturn /** @type {WPEventKeyHandler} */ (\n\t\t\tevent,\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\tconst mods = getModifiers( _isApple );\n\t\t\tconst eventMods = getEventModifiers( event );\n\t\t\t/** @type {Record<string,string>} */\n\t\t\tconst replacementWithShiftKeyMap = {\n\t\t\t\tComma: ',',\n\t\t\t\tBackslash: '\\\\',\n\t\t\t\t// Windows returns `\\` for both IntlRo and IntlYen.\n\t\t\t\tIntlRo: '\\\\',\n\t\t\t\tIntlYen: '\\\\',\n\t\t\t};\n\n\t\t\tconst modsDiff = mods.filter(\n\t\t\t\t( mod ) => ! eventMods.includes( mod )\n\t\t\t);\n\t\t\tconst eventModsDiff = eventMods.filter(\n\t\t\t\t( mod ) => ! mods.includes( mod )\n\t\t\t);\n\n\t\t\tif ( modsDiff.length > 0 || eventModsDiff.length > 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tlet key = event.key.toLowerCase();\n\n\t\t\tif ( ! character ) {\n\t\t\t\treturn mods.includes( /** @type {WPModifierPart} */ ( key ) );\n\t\t\t}\n\n\t\t\tif ( event.altKey && character.length === 1 ) {\n\t\t\t\tkey = String.fromCharCode( event.keyCode ).toLowerCase();\n\t\t\t}\n\n\t\t\t// `event.key` returns the value of the key pressed, taking into the state of\n\t\t\t// modifier keys such as `Shift`. If the shift key is pressed, a different\n\t\t\t// value may be returned depending on the keyboard layout. It is necessary to\n\t\t\t// convert to the physical key value that don't take into account keyboard\n\t\t\t// layout or modifier key state.\n\t\t\tif (\n\t\t\t\tevent.shiftKey &&\n\t\t\t\tcharacter.length === 1 &&\n\t\t\t\treplacementWithShiftKeyMap[ event.code ]\n\t\t\t) {\n\t\t\t\tkey = replacementWithShiftKeyMap[ event.code ];\n\t\t\t}\n\n\t\t\t// For backwards compatibility.\n\t\t\tif ( character === 'del' ) {\n\t\t\t\tcharacter = 'delete';\n\t\t\t}\n\n\t\t\treturn key === character.toLowerCase();\n\t\t};\n\t}\n);\n"]}
1
+ {"version":3,"names":["capitalCase","__","isAppleOS","BACKSPACE","TAB","ENTER","ESCAPE","SPACE","PAGEUP","PAGEDOWN","END","HOME","LEFT","UP","RIGHT","DOWN","DELETE","F10","ALT","CTRL","COMMAND","SHIFT","ZERO","mapValues","object","mapFn","Object","fromEntries","entries","map","key","value","modifiers","primary","_isApple","primaryShift","primaryAlt","secondary","access","ctrl","alt","ctrlShift","shift","shiftAlt","undefined","rawShortcut","modifier","character","toLowerCase","join","displayShortcutList","isApple","replacementKeyMap","modifierKeys","reduce","accumulator","_replacementKeyMap$ke","replacementKey","capitalizedCharacter","stripRegexp","displayShortcut","shortcutList","shortcutAriaLabel","_replacementKeyMap$ke2","getEventModifiers","event","filter","isKeyboardEvent","getModifiers","mods","eventMods","replacementWithShiftKeyMap","Comma","Backslash","IntlRo","IntlYen","modsDiff","mod","includes","eventModsDiff","length","altKey","String","fromCharCode","keyCode","shiftKey","code"],"sources":["@wordpress/keycodes/src/index.js"],"sourcesContent":["/**\n * Note: The order of the modifier keys in many of the [foo]Shortcut()\n * functions in this file are intentional and should not be changed. They're\n * designed to fit with the standard menu keyboard shortcuts shown in the\n * user's platform.\n *\n * For example, on MacOS menu shortcuts will place Shift before Command, but\n * on Windows Control will usually come first. So don't provide your own\n * shortcut combos directly to keyboardShortcut().\n */\n\n/**\n * External dependencies\n */\nimport { capitalCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { isAppleOS } from './platform';\n\n/** @typedef {typeof ALT | CTRL | COMMAND | SHIFT } WPModifierPart */\n\n/** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */\n\n/**\n * An object of handler functions for each of the possible modifier\n * combinations. A handler will return a value for a given key.\n *\n * @template T\n *\n * @typedef {Record<WPKeycodeModifier, T>} WPModifierHandler\n */\n\n/**\n * @template T\n *\n * @typedef {(character: string, isApple?: () => boolean) => T} WPKeyHandler\n */\n/** @typedef {(event: import('react').KeyboardEvent<HTMLElement> | KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */\n\n/** @typedef {( isApple: () => boolean ) => WPModifierPart[]} WPModifier */\n\n/**\n * Keycode for BACKSPACE key.\n */\nexport const BACKSPACE = 8;\n\n/**\n * Keycode for TAB key.\n */\nexport const TAB = 9;\n\n/**\n * Keycode for ENTER key.\n */\nexport const ENTER = 13;\n\n/**\n * Keycode for ESCAPE key.\n */\nexport const ESCAPE = 27;\n\n/**\n * Keycode for SPACE key.\n */\nexport const SPACE = 32;\n\n/**\n * Keycode for PAGEUP key.\n */\nexport const PAGEUP = 33;\n\n/**\n * Keycode for PAGEDOWN key.\n */\nexport const PAGEDOWN = 34;\n\n/**\n * Keycode for END key.\n */\nexport const END = 35;\n\n/**\n * Keycode for HOME key.\n */\nexport const HOME = 36;\n\n/**\n * Keycode for LEFT key.\n */\nexport const LEFT = 37;\n\n/**\n * Keycode for UP key.\n */\nexport const UP = 38;\n\n/**\n * Keycode for RIGHT key.\n */\nexport const RIGHT = 39;\n\n/**\n * Keycode for DOWN key.\n */\nexport const DOWN = 40;\n\n/**\n * Keycode for DELETE key.\n */\nexport const DELETE = 46;\n\n/**\n * Keycode for F10 key.\n */\nexport const F10 = 121;\n\n/**\n * Keycode for ALT key.\n */\nexport const ALT = 'alt';\n\n/**\n * Keycode for CTRL key.\n */\nexport const CTRL = 'ctrl';\n\n/**\n * Keycode for COMMAND/META key.\n */\nexport const COMMAND = 'meta';\n\n/**\n * Keycode for SHIFT key.\n */\nexport const SHIFT = 'shift';\n\n/**\n * Keycode for ZERO key.\n */\nexport const ZERO = 48;\n\nexport { isAppleOS };\n\n/**\n * Map the values of an object with a specified callback and return the result object.\n *\n * @template {{ [s: string]: any; } | ArrayLike<any>} T\n *\n * @param {T} object Object to map values of.\n * @param {( value: any ) => any} mapFn Mapping function\n *\n * @return {any} Active modifier constants.\n */\nfunction mapValues( object, mapFn ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).map( ( [ key, value ] ) => [\n\t\t\tkey,\n\t\t\tmapFn( value ),\n\t\t] )\n\t);\n}\n\n/**\n * Object that contains functions that return the available modifier\n * depending on platform.\n *\n * @type {WPModifierHandler< ( isApple: () => boolean ) => WPModifierPart[]>}\n */\nexport const modifiers = {\n\tprimary: ( _isApple ) => ( _isApple() ? [ COMMAND ] : [ CTRL ] ),\n\tprimaryShift: ( _isApple ) =>\n\t\t_isApple() ? [ SHIFT, COMMAND ] : [ CTRL, SHIFT ],\n\tprimaryAlt: ( _isApple ) =>\n\t\t_isApple() ? [ ALT, COMMAND ] : [ CTRL, ALT ],\n\tsecondary: ( _isApple ) =>\n\t\t_isApple() ? [ SHIFT, ALT, COMMAND ] : [ CTRL, SHIFT, ALT ],\n\taccess: ( _isApple ) => ( _isApple() ? [ CTRL, ALT ] : [ SHIFT, ALT ] ),\n\tctrl: () => [ CTRL ],\n\talt: () => [ ALT ],\n\tctrlShift: () => [ CTRL, SHIFT ],\n\tshift: () => [ SHIFT ],\n\tshiftAlt: () => [ SHIFT, ALT ],\n\tundefined: () => [],\n};\n\n/**\n * An object that contains functions to get raw shortcuts.\n *\n * These are intended for user with the KeyboardShortcuts.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * rawShortcut.primary( 'm' )\n * // \"meta+m\"\"\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to raw\n * shortcuts.\n */\nexport const rawShortcut = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ modifier ) => {\n\t\treturn /** @type {WPKeyHandler<string>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\treturn [ ...modifier( _isApple ), character.toLowerCase() ].join(\n\t\t\t\t'+'\n\t\t\t);\n\t\t};\n\t}\n);\n\n/**\n * Return an array of the parts of a keyboard shortcut chord for display.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * displayShortcutList.primary( 'm' );\n * // [ \"⌘\", \"M\" ]\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string[]>>} Keyed map of functions to\n * shortcut sequences.\n */\nexport const displayShortcutList = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ modifier ) => {\n\t\treturn /** @type {WPKeyHandler<string[]>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\tconst isApple = _isApple();\n\t\t\tconst replacementKeyMap = {\n\t\t\t\t[ ALT ]: isApple ? '⌥' : 'Alt',\n\t\t\t\t[ CTRL ]: isApple ? '⌃' : 'Ctrl', // Make sure ⌃ is the U+2303 UP ARROWHEAD unicode character and not the caret character.\n\t\t\t\t[ COMMAND ]: '⌘',\n\t\t\t\t[ SHIFT ]: isApple ? '⇧' : 'Shift',\n\t\t\t};\n\n\t\t\tconst modifierKeys = modifier( _isApple ).reduce(\n\t\t\t\t( accumulator, key ) => {\n\t\t\t\t\tconst replacementKey = replacementKeyMap[ key ] ?? key;\n\t\t\t\t\t// If on the Mac, adhere to platform convention and don't show plus between keys.\n\t\t\t\t\tif ( isApple ) {\n\t\t\t\t\t\treturn [ ...accumulator, replacementKey ];\n\t\t\t\t\t}\n\n\t\t\t\t\treturn [ ...accumulator, replacementKey, '+' ];\n\t\t\t\t},\n\t\t\t\t/** @type {string[]} */ ( [] )\n\t\t\t);\n\n\t\t\t// Symbols (~`,.) are removed by the default regular expression,\n\t\t\t// so override the rule to allow symbols used for shortcuts.\n\t\t\t// see: https://github.com/blakeembrey/change-case#options\n\t\t\tconst capitalizedCharacter = capitalCase( character, {\n\t\t\t\tstripRegexp: /[^A-Z0-9~`,\\.\\\\\\-]/gi,\n\t\t\t} );\n\n\t\t\treturn [ ...modifierKeys, capitalizedCharacter ];\n\t\t};\n\t}\n);\n\n/**\n * An object that contains functions to display shortcuts.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * displayShortcut.primary( 'm' );\n * // \"⌘M\"\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to\n * display shortcuts.\n */\nexport const displayShortcut = mapValues(\n\tdisplayShortcutList,\n\t( /** @type {WPKeyHandler<string[]>} */ shortcutList ) => {\n\t\treturn /** @type {WPKeyHandler<string>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => shortcutList( character, _isApple ).join( '' );\n\t}\n);\n\n/**\n * An object that contains functions to return an aria label for a keyboard\n * shortcut.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * shortcutAriaLabel.primary( '.' );\n * // \"Command + Period\"\n * ```\n *\n * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to\n * shortcut ARIA labels.\n */\nexport const shortcutAriaLabel = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ modifier ) => {\n\t\treturn /** @type {WPKeyHandler<string>} */ (\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\tconst isApple = _isApple();\n\t\t\t/** @type {Record<string,string>} */\n\t\t\tconst replacementKeyMap = {\n\t\t\t\t[ SHIFT ]: 'Shift',\n\t\t\t\t[ COMMAND ]: isApple ? 'Command' : 'Control',\n\t\t\t\t[ CTRL ]: 'Control',\n\t\t\t\t[ ALT ]: isApple ? 'Option' : 'Alt',\n\t\t\t\t/* translators: comma as in the character ',' */\n\t\t\t\t',': __( 'Comma' ),\n\t\t\t\t/* translators: period as in the character '.' */\n\t\t\t\t'.': __( 'Period' ),\n\t\t\t\t/* translators: backtick as in the character '`' */\n\t\t\t\t'`': __( 'Backtick' ),\n\t\t\t\t/* translators: tilde as in the character '~' */\n\t\t\t\t'~': __( 'Tilde' ),\n\t\t\t};\n\n\t\t\treturn [ ...modifier( _isApple ), character ]\n\t\t\t\t.map( ( key ) =>\n\t\t\t\t\tcapitalCase( replacementKeyMap[ key ] ?? key )\n\t\t\t\t)\n\t\t\t\t.join( isApple ? ' ' : ' + ' );\n\t\t};\n\t}\n);\n\n/**\n * From a given KeyboardEvent, returns an array of active modifier constants for\n * the event.\n *\n * @param {import('react').KeyboardEvent<HTMLElement> | KeyboardEvent} event Keyboard event.\n *\n * @return {Array<WPModifierPart>} Active modifier constants.\n */\nfunction getEventModifiers( event ) {\n\treturn /** @type {WPModifierPart[]} */ ( [\n\t\tALT,\n\t\tCTRL,\n\t\tCOMMAND,\n\t\tSHIFT,\n\t] ).filter(\n\t\t( key ) =>\n\t\t\tevent[\n\t\t\t\t/** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */ (\n\t\t\t\t\t`${ key }Key`\n\t\t\t\t)\n\t\t\t]\n\t);\n}\n\n/**\n * An object that contains functions to check if a keyboard event matches a\n * predefined shortcut combination.\n *\n * @example\n * ```js\n * // Assuming an event for ⌘M key press:\n * isKeyboardEvent.primary( event, 'm' );\n * // true\n * ```\n *\n * @type {WPModifierHandler<WPEventKeyHandler>} Keyed map of functions\n * to match events.\n */\nexport const isKeyboardEvent = mapValues(\n\tmodifiers,\n\t( /** @type {WPModifier} */ getModifiers ) => {\n\t\treturn /** @type {WPEventKeyHandler} */ (\n\t\t\tevent,\n\t\t\tcharacter,\n\t\t\t_isApple = isAppleOS\n\t\t) => {\n\t\t\tconst mods = getModifiers( _isApple );\n\t\t\tconst eventMods = getEventModifiers( event );\n\t\t\t/** @type {Record<string,string>} */\n\t\t\tconst replacementWithShiftKeyMap = {\n\t\t\t\tComma: ',',\n\t\t\t\tBackslash: '\\\\',\n\t\t\t\t// Windows returns `\\` for both IntlRo and IntlYen.\n\t\t\t\tIntlRo: '\\\\',\n\t\t\t\tIntlYen: '\\\\',\n\t\t\t};\n\n\t\t\tconst modsDiff = mods.filter(\n\t\t\t\t( mod ) => ! eventMods.includes( mod )\n\t\t\t);\n\t\t\tconst eventModsDiff = eventMods.filter(\n\t\t\t\t( mod ) => ! mods.includes( mod )\n\t\t\t);\n\n\t\t\tif ( modsDiff.length > 0 || eventModsDiff.length > 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tlet key = event.key.toLowerCase();\n\n\t\t\tif ( ! character ) {\n\t\t\t\treturn mods.includes( /** @type {WPModifierPart} */ ( key ) );\n\t\t\t}\n\n\t\t\tif ( event.altKey && character.length === 1 ) {\n\t\t\t\tkey = String.fromCharCode( event.keyCode ).toLowerCase();\n\t\t\t}\n\n\t\t\t// `event.key` returns the value of the key pressed, taking into the state of\n\t\t\t// modifier keys such as `Shift`. If the shift key is pressed, a different\n\t\t\t// value may be returned depending on the keyboard layout. It is necessary to\n\t\t\t// convert to the physical key value that don't take into account keyboard\n\t\t\t// layout or modifier key state.\n\t\t\tif (\n\t\t\t\tevent.shiftKey &&\n\t\t\t\tcharacter.length === 1 &&\n\t\t\t\treplacementWithShiftKeyMap[ event.code ]\n\t\t\t) {\n\t\t\t\tkey = replacementWithShiftKeyMap[ event.code ];\n\t\t\t}\n\n\t\t\t// For backwards compatibility.\n\t\t\tif ( character === 'del' ) {\n\t\t\t\tcharacter = 'delete';\n\t\t\t}\n\n\t\t\treturn key === character.toLowerCase();\n\t\t};\n\t}\n);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,aAAa;;AAEzC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,YAAY;;AAEtC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAG,CAAC;;AAE1B;AACA;AACA;AACA,OAAO,MAAMC,GAAG,GAAG,CAAC;;AAE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CAAED,GAAI,CACjC,CAAC;MAED,IAAKD,QAAQ,CAACI,MAAM,GAAG,CAAC,IAAID,aAAa,CAACC,MAAM,GAAG,CAAC,EAAG;QACtD,OAAO,KAAK;MACb;MAEA,IAAIlD,GAAG,GAAGmC,KAAK,CAACnC,GAAG,CAACkB,WAAW,CAAC,CAAC;MAEjC,IAAK,CAAED,SAAS,EAAG;QAClB,OAAOsB,IAAI,CAACS,QAAQ,EAAE,6BAAgChD,GAAM,CAAC;MAC9D;MAEA,IAAKmC,KAAK,CAACgB,MAAM,IAAIlC,SAAS,CAACiC,MAAM,KAAK,CAAC,EAAG;QAC7ClD,GAAG,GAAGoD,MAAM,CAACC,YAAY,CAAElB,KAAK,CAACmB,OAAQ,CAAC,CAACpC,WAAW,CAAC,CAAC;MACzD;;MAEA;MACA;MACA;MACA;MACA;MACA,IACCiB,KAAK,CAACoB,QAAQ,IACdtC,SAAS,CAACiC,MAAM,KAAK,CAAC,IACtBT,0BAA0B,CAAEN,KAAK,CAACqB,IAAI,CAAE,EACvC;QACDxD,GAAG,GAAGyC,0BAA0B,CAAEN,KAAK,CAACqB,IAAI,CAAE;MAC/C;;MAEA;MACA,IAAKvC,SAAS,KAAK,KAAK,EAAG;QAC1BA,SAAS,GAAG,QAAQ;MACrB;MAEA,OAAOjB,GAAG,KAAKiB,SAAS,CAACC,WAAW,CAAC,CAAC;IACvC;EAAC;AACF,CACD,CAAC"}
@@ -10,10 +10,8 @@ export function isAppleOS(_window = null) {
10
10
  if (typeof window === 'undefined') {
11
11
  return false;
12
12
  }
13
-
14
13
  _window = window;
15
14
  }
16
-
17
15
  const {
18
16
  platform
19
17
  } = _window.navigator;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/keycodes/src/platform.js"],"names":["isAppleOS","_window","window","platform","navigator","indexOf","includes"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,SAAT,CAAoBC,OAAO,GAAG,IAA9B,EAAqC;AAC3C,MAAK,CAAEA,OAAP,EAAiB;AAChB,QAAK,OAAOC,MAAP,KAAkB,WAAvB,EAAqC;AACpC,aAAO,KAAP;AACA;;AAEDD,IAAAA,OAAO,GAAGC,MAAV;AACA;;AAED,QAAM;AAAEC,IAAAA;AAAF,MAAeF,OAAO,CAACG,SAA7B;AAEA,SACCD,QAAQ,CAACE,OAAT,CAAkB,KAAlB,MAA8B,CAAC,CAA/B,IACA,CAAE,MAAF,EAAU,QAAV,EAAqBC,QAArB,CAA+BH,QAA/B,CAFD;AAIA","sourcesContent":["/**\n * Return true if platform is MacOS.\n *\n * @param {Window?} _window window object by default; used for DI testing.\n *\n * @return {boolean} True if MacOS; false otherwise.\n */\nexport function isAppleOS( _window = null ) {\n\tif ( ! _window ) {\n\t\tif ( typeof window === 'undefined' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t_window = window;\n\t}\n\n\tconst { platform } = _window.navigator;\n\n\treturn (\n\t\tplatform.indexOf( 'Mac' ) !== -1 ||\n\t\t[ 'iPad', 'iPhone' ].includes( platform )\n\t);\n}\n"]}
1
+ {"version":3,"names":["isAppleOS","_window","window","platform","navigator","indexOf","includes"],"sources":["@wordpress/keycodes/src/platform.js"],"sourcesContent":["/**\n * Return true if platform is MacOS.\n *\n * @param {Window?} _window window object by default; used for DI testing.\n *\n * @return {boolean} True if MacOS; false otherwise.\n */\nexport function isAppleOS( _window = null ) {\n\tif ( ! _window ) {\n\t\tif ( typeof window === 'undefined' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t_window = window;\n\t}\n\n\tconst { platform } = _window.navigator;\n\n\treturn (\n\t\tplatform.indexOf( 'Mac' ) !== -1 ||\n\t\t[ 'iPad', 'iPhone' ].includes( platform )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,SAASA,CAAEC,OAAO,GAAG,IAAI,EAAG;EAC3C,IAAK,CAAEA,OAAO,EAAG;IAChB,IAAK,OAAOC,MAAM,KAAK,WAAW,EAAG;MACpC,OAAO,KAAK;IACb;IAEAD,OAAO,GAAGC,MAAM;EACjB;EAEA,MAAM;IAAEC;EAAS,CAAC,GAAGF,OAAO,CAACG,SAAS;EAEtC,OACCD,QAAQ,CAACE,OAAO,CAAE,KAAM,CAAC,KAAK,CAAC,CAAC,IAChC,CAAE,MAAM,EAAE,QAAQ,CAAE,CAACC,QAAQ,CAAEH,QAAS,CAAC;AAE3C"}
@@ -2,12 +2,12 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { Platform } from 'react-native';
5
+
5
6
  /**
6
7
  * Return true if platform is iOS.
7
8
  *
8
9
  * @return {boolean} True if iOS; false otherwise.
9
10
  */
10
-
11
11
  export function isAppleOS() {
12
12
  return Platform.OS === 'ios';
13
13
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/keycodes/src/platform.native.js"],"names":["Platform","isAppleOS","OS"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,cAAzB;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,SAAT,GAAqB;AAC3B,SAAOD,QAAQ,CAACE,EAAT,KAAgB,KAAvB;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { Platform } from 'react-native';\n\n/**\n * Return true if platform is iOS.\n *\n * @return {boolean} True if iOS; false otherwise.\n */\nexport function isAppleOS() {\n\treturn Platform.OS === 'ios';\n}\n"]}
1
+ {"version":3,"names":["Platform","isAppleOS","OS"],"sources":["@wordpress/keycodes/src/platform.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Platform } from 'react-native';\n\n/**\n * Return true if platform is iOS.\n *\n * @return {boolean} True if iOS; false otherwise.\n */\nexport function isAppleOS() {\n\treturn Platform.OS === 'ios';\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,cAAc;;AAEvC;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAAA,EAAG;EAC3B,OAAOD,QAAQ,CAACE,EAAE,KAAK,KAAK;AAC7B"}
@@ -187,5 +187,5 @@ export type WPModifierHandler<T> = Record<WPKeycodeModifier, T>;
187
187
  export type WPKeyHandler<T> = (character: string, isApple?: () => boolean) => T;
188
188
  export type WPEventKeyHandler = (event: import('react').KeyboardEvent<HTMLElement> | KeyboardEvent, character: string, isApple?: () => boolean) => boolean;
189
189
  export type WPModifier = (isApple: () => boolean) => WPModifierPart[];
190
- import { isAppleOS } from "./platform";
190
+ import { isAppleOS } from './platform';
191
191
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AA0BA,qEAAqE;AAErE,0KAA0K;AAE1K;;;;;;;GAOG;AAEH;;;;GAIG;AACH,8JAA8J;AAE9J,2EAA2E;AAE3E;;GAEG;AACH,0BAA2B;AAE3B;;GAEG;AACH,oBAAqB;AAErB;;GAEG;AACH,uBAAwB;AAExB;;GAEG;AACH,wBAAyB;AAEzB;;GAEG;AACH,uBAAwB;AAExB;;GAEG;AACH,wBAAyB;AAEzB;;GAEG;AACH,0BAA2B;AAE3B;;GAEG;AACH,qBAAsB;AAEtB;;GAEG;AACH,sBAAuB;AAEvB;;GAEG;AACH,sBAAuB;AAEvB;;GAEG;AACH,oBAAqB;AAErB;;GAEG;AACH,uBAAwB;AAExB;;GAEG;AACH,sBAAuB;AAEvB;;GAEG;AACH,wBAAyB;AAEzB;;GAEG;AACH,sBAAuB;AAEvB;;GAEG;AACH,wBAAyB;AAEzB;;GAEG;AACH,0BAA2B;AAE3B;;GAEG;AACH,6BAA8B;AAE9B;;GAEG;AACH,4BAA6B;AAE7B;;GAEG;AACH,sBAAuB;;AAuBvB;;;;;GAKG;AACH,oDAFwC,MAAM,OAAO,KAAM,cAAc,EAAE,EAiBzE;AAEF;;;;;;;;;;;;;;GAcG;AACH,0BAHU,kBAAkB,aAAa,MAAM,CAAC,CAAC,CAe/C;AAEF;;;;;;;;;;;;GAYG;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G;AACH,sBAAuB;AAEvB;;GAEG;AACH,wBAAyB;AAEzB;;GAEG;AACH,0BAA2B;AAE3B;;GAEG;AACH,6BAA8B;AAE9B;;GAEG;AACH,4BAA6B;AAE7B;;GAEG;AACH,sBAAuB;;AAuBvB;;;;;GAKG;AACH,oDAFwC,MAAM,OAAO,KAAM,cAAc,EAAE,EAiBzE;AAEF;;;;;;;;;;;;;;GAcG;AACH,0BAHU,kBAAkB,aAAa,MAAM,CAAC,CAAC,CAe/C;AAEF;;;;;;;;;;;;GAYG;AACH,kCAHU,kBAAkB,aAAa,MAAM,EAAE,CAAC,CAAC,CAyCjD;AAEF;;;;;;;;;;;;GAYG;AACH,8BAHU,kBAAkB,aAAa,MAAM,CAAC,CAAC,CAW/C;AAEF;;;;;;;;;;;;;GAaG;AACH,gCAHU,kBAAkB,aAAa,MAAM,CAAC,CAAC,CAkC/C;AA0BF;;;;;;;;;;;;;GAaG;AACH,8BAHU,kBAAkB,iBAAiB,CAAC,CAgE5C;6BAjaY,UAAU,4BAAyB;gCAEnC,SAAS,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW;;;;;mCAQvI,OAAO,iBAAiB,EAAE,CAAC,CAAC;0CAMhB,MAAM,YAAY,MAAM,OAAO,KAAK,CAAC;wCAExC,OAAO,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,aAAa,aAAa,MAAM,YAAY,MAAM,OAAO,KAAK,OAAO;mCAE/G,MAAM,OAAO,KAAM,cAAc,EAAE;0BAtBlC,YAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/keycodes",
3
- "version": "3.39.0",
3
+ "version": "3.40.1",
4
4
  "description": "Keycodes utilities for WordPress. Used to check for keyboard events across browsers/operating systems.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -28,11 +28,11 @@
28
28
  "sideEffects": false,
29
29
  "dependencies": {
30
30
  "@babel/runtime": "^7.16.0",
31
- "@wordpress/i18n": "^4.39.0",
31
+ "@wordpress/i18n": "^4.40.1",
32
32
  "change-case": "^4.1.2"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "b898cf1dc8e70841d1647ea0994ac6278acc18a7"
37
+ "gitHead": "bb1fbf87bb0f451744530fc6a85de2dff1263bed"
38
38
  }
@@ -1 +1 @@
1
- {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/no-case/dist/index.d.ts","../../node_modules/pascal-case/dist/index.d.ts","../../node_modules/camel-case/dist/index.d.ts","../../node_modules/capital-case/dist/index.d.ts","../../node_modules/constant-case/dist/index.d.ts","../../node_modules/dot-case/dist/index.d.ts","../../node_modules/header-case/dist/index.d.ts","../../node_modules/param-case/dist/index.d.ts","../../node_modules/path-case/dist/index.d.ts","../../node_modules/sentence-case/dist/index.d.ts","../../node_modules/snake-case/dist/index.d.ts","../../node_modules/change-case/dist/index.d.ts","../i18n/build-types/sprintf.d.ts","../hooks/build-types/createaddhook.d.ts","../hooks/build-types/createremovehook.d.ts","../hooks/build-types/createhashook.d.ts","../hooks/build-types/createdoinghook.d.ts","../hooks/build-types/createdidhook.d.ts","../hooks/build-types/index.d.ts","../hooks/build-types/createhooks.d.ts","../i18n/build-types/create-i18n.d.ts","../i18n/build-types/default-i18n.d.ts","../i18n/build-types/index.d.ts","./src/platform.js","../../node_modules/@types/react/global.d.ts","../../node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/scheduler/tracing.d.ts","../../node_modules/@types/react/index.d.ts","./src/index.js"],"fileInfos":[{"version":"8730f4bf322026ff5229336391a18bcaa1f94d4f82416c8b2f3954e2ccaae2ba","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","4b421cbfb3a38a27c279dec1e9112c3d1da296f77a1a85ddadf7e7a425d45d18","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9","746d62152361558ea6d6115cf0da4dd10ede041d14882ede3568bce5dc4b4f1f","d11a03592451da2d1065e09e61f4e2a9bf68f780f4f6623c18b57816a9679d17","aea179452def8a6152f98f63b191b84e7cbd69b0e248c91e61fb2e52328abe8c",{"version":"3aafcb693fe5b5c3bd277bd4c3a617b53db474fe498fc5df067c5603b1eebde7","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"5f406584aef28a331c36523df688ca3650288d14f39c5d2e555c95f0d2ff8f6f","affectsGlobalScope":true},{"version":"22f230e544b35349cfb3bd9110b6ef37b41c6d6c43c3314a31bd0d9652fcec72","affectsGlobalScope":true},{"version":"7ea0b55f6b315cf9ac2ad622b0a7813315bb6e97bf4bb3fbf8f8affbca7dc695","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"eb26de841c52236d8222f87e9e6a235332e0788af8c87a71e9e210314300410a","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"5e5e095c4470c8bab227dbbc61374878ecead104c74ab9960d3adcccfee23205","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"2768ef564cfc0689a1b76106c421a2909bdff0acbe87da010785adab80efdd5c","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"6c55633c733c8378db65ac3da7a767c3cf2cf3057f0565a9124a16a3a2019e87","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"34c839eaaa6d78c8674ae2c37af2236dee6831b13db7b4ef4df3ec889a04d4f2","affectsGlobalScope":true},{"version":"34478567f8a80171f88f2f30808beb7da15eac0538ae91282dd33dce928d98ed","affectsGlobalScope":true},{"version":"ab7d58e6161a550ff92e5aff755dc37fe896245348332cd5f1e1203479fe0ed1","affectsGlobalScope":true},{"version":"6bda95ea27a59a276e46043b7065b55bd4b316c25e70e29b572958fa77565d43","affectsGlobalScope":true},{"version":"aedb8de1abb2ff1095c153854a6df7deae4a5709c37297f9d6e9948b6806fa66","affectsGlobalScope":true},{"version":"a4da0551fd39b90ca7ce5f68fb55d4dc0c1396d589b612e1902f68ee090aaada","affectsGlobalScope":true},{"version":"11ffe3c281f375fff9ffdde8bbec7669b4dd671905509079f866f2354a788064","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"b4e123af1af6049685c93073a15868b50aebdad666d422edc72fa2b585fa8a37","f86c04a744ebcede96bac376f9a2c90f2bd3c422740d91dda4ca6233199d4977","6ae1bddee5c790439bd992abd063b9b46e0cadd676c2a8562268d1869213ff60","606244fc97a6a74b877f2e924ba7e55b233bc6acb57d7bf40ba84a5be2d9adb0","4a1cabac71036b8a14f5db1b753b579f0c901c7d7b9227e6872dadf6efb104e8","062959a1d825b96639d87be35fe497cbd3f89544bf06fdad577bbfb85fcf604c","4c3672dc8f4e4fdd3d18525b22b31f1b5481f5a415db96550d3ac5163a6c3dd3","f9a69ca445010b91fe08f08c06e0f86d79c0d776905f9bdb828477cb2a1eb7fc","ad7fd0e7ee457d4884b3aaecbcbd2a80b6803407c4ce2540c296170d4c7918ef","a50ef21605f41c6acad6c3ef0307e5311b94963c846ca093c764b80cdb5318d6","74b4035dd26d09a417c44ca23ab5ee69b173f8c2f6b2e47350ab0795cf2d4a17","918f86ee2b19cc38cb8b1a4cf8f223eb228aaa39df3604c42f700fac2f0b3ea1","762bc52248d3fab9873c7af564caf622358312cb35de42a4393b71cc36e14621","d02ec79cefaf292fae64b3be5a4416e64b4e420a6429fd458fac6e1bb4c7950e","27abed653f600ea0d5c86e94181beb42824e0f3f16337e2f9e7e9e9c2c392edf","d7871e0e653aa7197fee88886db5678bee6d42164c1f36e4bce9421ddfa7ca49","11ed10bdb3bcc99893570507eac8fece4840add97ee1d4f5a7fbf41cbfdea0d4","429fb571d3db07d3eaa2e74d43eb4190ece3e0de832ed564aeeaf08873e598eb","406d52bf33d618d846aa0d831ee004290567e328edcd4517bbff2937cc977abf","d3060e0810fc0d0dc009e6f086ef413d3c8aeaaf07da25c8d25fd4e181646acf","023747bf4162d5f675dbee1acbfb409a33e70d2358fd218b6a1b22dee8706c1a","08f7e6ffa66c66a636aecc5acbeb998215d9d09ccba0c558afb7df7e218edeaf","f829eb39aea4487f0ff94a42c56a1a73bc5202bbdeb03f7a638e4ab3e290d017",{"version":"c813ac99663202e702fe5f635f7ec2d7b20747c57ff0a85a86af0dadac9170e2","signature":"6270f21b52d381dda2ca953a728f44b5ceb9edf965c97cb55f77ba7a477d77f0"},{"version":"bbdf156fea2fabed31a569445835aeedcc33643d404fcbaa54541f06c109df3f","affectsGlobalScope":true},"381899b8d1d4c1be716f18cb5242ba39f66f4b1e31d45af62a32a99f8edcb39d","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"5917af4ff931b050dba49a1dedd9c00f15f7b3dc4345ad8491bfacd2ec68ed32","affectsGlobalScope":true},{"version":"2e1ec6a4f374a769674b813347f0f9d90d18de8abbb04637263fa7bdb2f41f89","signature":"107e12fd341554e2dbfe86a7d37da590c0db8113923da41c6638e14ac7ba7e63"}],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[80,81,82,83],[57],[56],[56,57,58,59,60,61,62,63,64,65,66],[59],[61],[74],[69,70,71,72,73,74],[69,70,71,72,73,75],[74,75],[76],[68,76,77],[67,78,79,84],[84]],"referencedMap":[[84,1],[58,2],[59,3],[67,4],[60,3],[61,3],[62,5],[63,6],[57,3],[64,6],[65,3],[66,6],[69,7],[73,7],[72,7],[71,7],[75,8],[70,7],[74,9],[76,10],[77,11],[78,12],[85,13]],"exportedModulesMap":[[84,1],[58,2],[59,3],[67,4],[60,3],[61,3],[62,5],[63,6],[57,3],[64,6],[65,3],[66,6],[69,7],[73,7],[72,7],[71,7],[75,8],[70,7],[74,9],[76,10],[77,11],[78,12],[85,14]],"semanticDiagnosticsPerFile":[82,80,84,83,58,59,67,60,81,61,62,56,63,57,64,65,66,11,13,12,2,14,15,16,17,18,19,20,21,3,4,25,22,23,24,26,27,28,5,29,30,31,32,6,36,33,34,35,37,7,38,43,44,39,40,41,42,8,48,45,46,47,49,9,50,51,52,53,54,1,10,55,69,73,72,71,75,70,74,76,77,78,68,85,79],"latestChangedDtsFile":"./build-types/index.d.ts"},"version":"4.9.5"}
1
+ {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/no-case/dist/index.d.ts","../../node_modules/pascal-case/dist/index.d.ts","../../node_modules/camel-case/dist/index.d.ts","../../node_modules/capital-case/dist/index.d.ts","../../node_modules/constant-case/dist/index.d.ts","../../node_modules/dot-case/dist/index.d.ts","../../node_modules/header-case/dist/index.d.ts","../../node_modules/param-case/dist/index.d.ts","../../node_modules/path-case/dist/index.d.ts","../../node_modules/sentence-case/dist/index.d.ts","../../node_modules/snake-case/dist/index.d.ts","../../node_modules/change-case/dist/index.d.ts","../i18n/build-types/sprintf.d.ts","../hooks/build-types/createAddHook.d.ts","../hooks/build-types/createRemoveHook.d.ts","../hooks/build-types/createHasHook.d.ts","../hooks/build-types/createDoingHook.d.ts","../hooks/build-types/createDidHook.d.ts","../hooks/build-types/index.d.ts","../hooks/build-types/createHooks.d.ts","../i18n/build-types/create-i18n.d.ts","../i18n/build-types/default-i18n.d.ts","../i18n/build-types/index.d.ts","./src/platform.js","../../node_modules/@types/react/global.d.ts","../../node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/scheduler/tracing.d.ts","../../node_modules/@types/react/index.d.ts","./src/index.js"],"fileInfos":[{"version":"f59215c5f1d886b05395ee7aca73e0ac69ddfad2843aa88530e797879d511bad","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","f4e736d6c8d69ae5b3ab0ddfcaa3dc365c3e76909d6660af5b4e979b3934ac20","eeeb3aca31fbadef8b82502484499dfd1757204799a6f5b33116201c810676ec",{"version":"3dda5344576193a4ae48b8d03f105c86f20b2f2aff0a1d1fd7935f5d68649654","affectsGlobalScope":true},{"version":"9d9885c728913c1d16e0d2831b40341d6ad9a0ceecaabc55209b306ad9c736a5","affectsGlobalScope":true},{"version":"17bea081b9c0541f39dd1ae9bc8c78bdd561879a682e60e2f25f688c0ecab248","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true},{"version":"f06948deb2a51aae25184561c9640fb66afeddb34531a9212d011792b1d19e0a","affectsGlobalScope":true},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"709efdae0cb5df5f49376cde61daacc95cdd44ae4671da13a540da5088bf3f30","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"61ed9b6d07af959e745fb11f9593ecd743b279418cc8a99448ea3cd5f3b3eb22","affectsGlobalScope":true},{"version":"038a2f66a34ee7a9c2fbc3584c8ab43dff2995f8c68e3f566f4c300d2175e31e","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"f5c92f2c27b06c1a41b88f6db8299205aee52c2a2943f7ed29bd585977f254e8","affectsGlobalScope":true},{"version":"930b0e15811f84e203d3c23508674d5ded88266df4b10abee7b31b2ac77632d2","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"b9ea5778ff8b50d7c04c9890170db34c26a5358cccba36844fe319f50a43a61a","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"25de46552b782d43cb7284df22fe2a265de387cf0248b747a7a1b647d81861f6","affectsGlobalScope":true},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"b4e123af1af6049685c93073a15868b50aebdad666d422edc72fa2b585fa8a37","f86c04a744ebcede96bac376f9a2c90f2bd3c422740d91dda4ca6233199d4977","6ae1bddee5c790439bd992abd063b9b46e0cadd676c2a8562268d1869213ff60","606244fc97a6a74b877f2e924ba7e55b233bc6acb57d7bf40ba84a5be2d9adb0","4a1cabac71036b8a14f5db1b753b579f0c901c7d7b9227e6872dadf6efb104e8","062959a1d825b96639d87be35fe497cbd3f89544bf06fdad577bbfb85fcf604c","4c3672dc8f4e4fdd3d18525b22b31f1b5481f5a415db96550d3ac5163a6c3dd3","f9a69ca445010b91fe08f08c06e0f86d79c0d776905f9bdb828477cb2a1eb7fc","ad7fd0e7ee457d4884b3aaecbcbd2a80b6803407c4ce2540c296170d4c7918ef","a50ef21605f41c6acad6c3ef0307e5311b94963c846ca093c764b80cdb5318d6","74b4035dd26d09a417c44ca23ab5ee69b173f8c2f6b2e47350ab0795cf2d4a17","918f86ee2b19cc38cb8b1a4cf8f223eb228aaa39df3604c42f700fac2f0b3ea1","2f1fe46a7a4e25a4a414d5491c7b39b695a6f37e97a1bdfeb71d430f98c3ed10","faf78d76e0042f05c6ad2eb38ee410cd4ea2854e5f5aff14f9b328d0a8115d62","d238c17667e457cba3da40546d2ef06876c5e5828df09c6b8404f223f189bb7d","a9c883297d78a7255479719aa87fb89b716f10c8c8936642bcb95522de3ca774","4f8ff9897ced0fe4b19defefb2db74f9448f04bca3ded248202fcc1a7bf11f02","c02d9d4c463913d817b35147c866bdb14c8ccba6fd06255877317dace5258781","6110b1abe60e43633e27444dfd81bbc6b5a07468549a985500d0991106b1e998","b3920d0dae5ffb54b3b8a4b6c53ce29e38a67f06b9595fee369ef1e37a3b5db4","fe6d71e5f4b524eab952a9e3cbb0e54abb2d0335cb2b47d91b00095b1613bcff","0beaa0562c80cdd93e5ab0dc9d1b314921afddfa8ee3cb976153ac620c89983f","2a49b24214a9709c04c7d21d99f1473058bd3b4d1310655288347a4c8862da30",{"version":"c813ac99663202e702fe5f635f7ec2d7b20747c57ff0a85a86af0dadac9170e2","signature":"6270f21b52d381dda2ca953a728f44b5ceb9edf965c97cb55f77ba7a477d77f0"},{"version":"bbdf156fea2fabed31a569445835aeedcc33643d404fcbaa54541f06c109df3f","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"5917af4ff931b050dba49a1dedd9c00f15f7b3dc4345ad8491bfacd2ec68ed32","affectsGlobalScope":true},{"version":"2e1ec6a4f374a769674b813347f0f9d90d18de8abbb04637263fa7bdb2f41f89","signature":"0c0505ff93823779fb1ea565c102a91d415d636c7bb92e00533f64508dc6c9cc"}],"root":[84,90],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[85,86,87,88],[62],[61],[61,62,63,64,65,66,67,68,69,70,71],[64],[66],[79],[74,75,76,77,78,79],[74,75,76,77,78,80],[79,80],[81],[73,81,82],[72,83,84,89],[89]],"referencedMap":[[89,1],[63,2],[64,3],[72,4],[65,3],[66,3],[67,5],[68,6],[62,3],[69,6],[70,3],[71,6],[74,7],[78,7],[77,7],[76,7],[80,8],[75,7],[79,9],[81,10],[82,11],[83,12],[90,13]],"exportedModulesMap":[[89,1],[63,2],[64,3],[72,4],[65,3],[66,3],[67,5],[68,6],[62,3],[69,6],[70,3],[71,6],[74,7],[78,7],[77,7],[76,7],[80,8],[75,7],[79,9],[81,10],[82,11],[83,12],[90,14]],"semanticDiagnosticsPerFile":[87,85,89,88,63,64,72,65,86,66,67,61,68,62,69,70,71,59,60,12,14,13,2,15,16,17,18,19,20,21,22,3,4,26,23,24,25,27,28,29,5,30,31,32,33,6,37,34,35,36,38,7,39,44,45,40,41,42,43,8,49,46,47,48,50,9,51,52,53,56,54,55,57,10,1,11,58,74,78,77,76,80,75,79,81,82,83,73,90,84],"latestChangedDtsFile":"./build-types/index.d.ts"},"version":"5.1.6"}