PluginProbe
Gutenberg / 16.5.0
Gutenberg v16.5.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
gutenberg / build / keycodes / index.js

index.js in Gutenberg 16.5.0, at build/keycodes/index.js

948 lines 32.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (() => { // webpackBootstrap
2 /******/ "use strict";
3 /******/ // The require scope
4 /******/ var __webpack_require__ = {};
5 /******/
6 /************************************************************************/
7 /******/ /* webpack/runtime/define property getters */
8 /******/ (() => {
9 /******/ // define getter functions for harmony exports
10 /******/ __webpack_require__.d = (exports, definition) => {
11 /******/ for(var key in definition) {
12 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
13 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
14 /******/ }
15 /******/ }
16 /******/ };
17 /******/ })();
18 /******/
19 /******/ /* webpack/runtime/hasOwnProperty shorthand */
20 /******/ (() => {
21 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
22 /******/ })();
23 /******/
24 /******/ /* webpack/runtime/make namespace object */
25 /******/ (() => {
26 /******/ // define __esModule on exports
27 /******/ __webpack_require__.r = (exports) => {
28 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
29 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
30 /******/ }
31 /******/ Object.defineProperty(exports, '__esModule', { value: true });
32 /******/ };
33 /******/ })();
34 /******/
35 /************************************************************************/
36 var __webpack_exports__ = {};
37 // ESM COMPAT FLAG
38 __webpack_require__.r(__webpack_exports__);
39
40 // EXPORTS
41 __webpack_require__.d(__webpack_exports__, {
42 "ALT": () => (/* binding */ ALT),
43 "BACKSPACE": () => (/* binding */ BACKSPACE),
44 "COMMAND": () => (/* binding */ COMMAND),
45 "CTRL": () => (/* binding */ CTRL),
46 "DELETE": () => (/* binding */ DELETE),
47 "DOWN": () => (/* binding */ DOWN),
48 "END": () => (/* binding */ END),
49 "ENTER": () => (/* binding */ ENTER),
50 "ESCAPE": () => (/* binding */ ESCAPE),
51 "F10": () => (/* binding */ F10),
52 "HOME": () => (/* binding */ HOME),
53 "LEFT": () => (/* binding */ LEFT),
54 "PAGEDOWN": () => (/* binding */ PAGEDOWN),
55 "PAGEUP": () => (/* binding */ PAGEUP),
56 "RIGHT": () => (/* binding */ RIGHT),
57 "SHIFT": () => (/* binding */ SHIFT),
58 "SPACE": () => (/* binding */ SPACE),
59 "TAB": () => (/* binding */ TAB),
60 "UP": () => (/* binding */ UP),
61 "ZERO": () => (/* binding */ ZERO),
62 "displayShortcut": () => (/* binding */ displayShortcut),
63 "displayShortcutList": () => (/* binding */ displayShortcutList),
64 "isAppleOS": () => (/* reexport */ isAppleOS),
65 "isKeyboardEvent": () => (/* binding */ isKeyboardEvent),
66 "modifiers": () => (/* binding */ modifiers),
67 "rawShortcut": () => (/* binding */ rawShortcut),
68 "shortcutAriaLabel": () => (/* binding */ shortcutAriaLabel)
69 });
70
71 ;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
72 /******************************************************************************
73 Copyright (c) Microsoft Corporation.
74
75 Permission to use, copy, modify, and/or distribute this software for any
76 purpose with or without fee is hereby granted.
77
78 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
79 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
80 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
81 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
82 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
83 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
84 PERFORMANCE OF THIS SOFTWARE.
85 ***************************************************************************** */
86 /* global Reflect, Promise, SuppressedError, Symbol */
87
88 var extendStatics = function(d, b) {
89 extendStatics = Object.setPrototypeOf ||
90 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
91 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
92 return extendStatics(d, b);
93 };
94
95 function __extends(d, b) {
96 if (typeof b !== "function" && b !== null)
97 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
98 extendStatics(d, b);
99 function __() { this.constructor = d; }
100 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
101 }
102
103 var __assign = function() {
104 __assign = Object.assign || function __assign(t) {
105 for (var s, i = 1, n = arguments.length; i < n; i++) {
106 s = arguments[i];
107 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
108 }
109 return t;
110 }
111 return __assign.apply(this, arguments);
112 }
113
114 function __rest(s, e) {
115 var t = {};
116 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
117 t[p] = s[p];
118 if (s != null && typeof Object.getOwnPropertySymbols === "function")
119 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
120 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
121 t[p[i]] = s[p[i]];
122 }
123 return t;
124 }
125
126 function __decorate(decorators, target, key, desc) {
127 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
128 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
129 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
130 return c > 3 && r && Object.defineProperty(target, key, r), r;
131 }
132
133 function __param(paramIndex, decorator) {
134 return function (target, key) { decorator(target, key, paramIndex); }
135 }
136
137 function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
138 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
139 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
140 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
141 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
142 var _, done = false;
143 for (var i = decorators.length - 1; i >= 0; i--) {
144 var context = {};
145 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
146 for (var p in contextIn.access) context.access[p] = contextIn.access[p];
147 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
148 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
149 if (kind === "accessor") {
150 if (result === void 0) continue;
151 if (result === null || typeof result !== "object") throw new TypeError("Object expected");
152 if (_ = accept(result.get)) descriptor.get = _;
153 if (_ = accept(result.set)) descriptor.set = _;
154 if (_ = accept(result.init)) initializers.unshift(_);
155 }
156 else if (_ = accept(result)) {
157 if (kind === "field") initializers.unshift(_);
158 else descriptor[key] = _;
159 }
160 }
161 if (target) Object.defineProperty(target, contextIn.name, descriptor);
162 done = true;
163 };
164
165 function __runInitializers(thisArg, initializers, value) {
166 var useValue = arguments.length > 2;
167 for (var i = 0; i < initializers.length; i++) {
168 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
169 }
170 return useValue ? value : void 0;
171 };
172
173 function __propKey(x) {
174 return typeof x === "symbol" ? x : "".concat(x);
175 };
176
177 function __setFunctionName(f, name, prefix) {
178 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
179 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
180 };
181
182 function __metadata(metadataKey, metadataValue) {
183 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
184 }
185
186 function __awaiter(thisArg, _arguments, P, generator) {
187 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
188 return new (P || (P = Promise))(function (resolve, reject) {
189 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
190 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
191 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
192 step((generator = generator.apply(thisArg, _arguments || [])).next());
193 });
194 }
195
196 function __generator(thisArg, body) {
197 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
198 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
199 function verb(n) { return function (v) { return step([n, v]); }; }
200 function step(op) {
201 if (f) throw new TypeError("Generator is already executing.");
202 while (g && (g = 0, op[0] && (_ = 0)), _) try {
203 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
204 if (y = 0, t) op = [op[0] & 2, t.value];
205 switch (op[0]) {
206 case 0: case 1: t = op; break;
207 case 4: _.label++; return { value: op[1], done: false };
208 case 5: _.label++; y = op[1]; op = [0]; continue;
209 case 7: op = _.ops.pop(); _.trys.pop(); continue;
210 default:
211 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
212 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
213 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
214 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
215 if (t[2]) _.ops.pop();
216 _.trys.pop(); continue;
217 }
218 op = body.call(thisArg, _);
219 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
220 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
221 }
222 }
223
224 var __createBinding = Object.create ? (function(o, m, k, k2) {
225 if (k2 === undefined) k2 = k;
226 var desc = Object.getOwnPropertyDescriptor(m, k);
227 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
228 desc = { enumerable: true, get: function() { return m[k]; } };
229 }
230 Object.defineProperty(o, k2, desc);
231 }) : (function(o, m, k, k2) {
232 if (k2 === undefined) k2 = k;
233 o[k2] = m[k];
234 });
235
236 function __exportStar(m, o) {
237 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
238 }
239
240 function __values(o) {
241 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
242 if (m) return m.call(o);
243 if (o && typeof o.length === "number") return {
244 next: function () {
245 if (o && i >= o.length) o = void 0;
246 return { value: o && o[i++], done: !o };
247 }
248 };
249 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
250 }
251
252 function __read(o, n) {
253 var m = typeof Symbol === "function" && o[Symbol.iterator];
254 if (!m) return o;
255 var i = m.call(o), r, ar = [], e;
256 try {
257 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
258 }
259 catch (error) { e = { error: error }; }
260 finally {
261 try {
262 if (r && !r.done && (m = i["return"])) m.call(i);
263 }
264 finally { if (e) throw e.error; }
265 }
266 return ar;
267 }
268
269 /** @deprecated */
270 function __spread() {
271 for (var ar = [], i = 0; i < arguments.length; i++)
272 ar = ar.concat(__read(arguments[i]));
273 return ar;
274 }
275
276 /** @deprecated */
277 function __spreadArrays() {
278 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
279 for (var r = Array(s), k = 0, i = 0; i < il; i++)
280 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
281 r[k] = a[j];
282 return r;
283 }
284
285 function __spreadArray(to, from, pack) {
286 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
287 if (ar || !(i in from)) {
288 if (!ar) ar = Array.prototype.slice.call(from, 0, i);
289 ar[i] = from[i];
290 }
291 }
292 return to.concat(ar || Array.prototype.slice.call(from));
293 }
294
295 function __await(v) {
296 return this instanceof __await ? (this.v = v, this) : new __await(v);
297 }
298
299 function __asyncGenerator(thisArg, _arguments, generator) {
300 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
301 var g = generator.apply(thisArg, _arguments || []), i, q = [];
302 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
303 function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
304 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
305 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
306 function fulfill(value) { resume("next", value); }
307 function reject(value) { resume("throw", value); }
308 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
309 }
310
311 function __asyncDelegator(o) {
312 var i, p;
313 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
314 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
315 }
316
317 function __asyncValues(o) {
318 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
319 var m = o[Symbol.asyncIterator], i;
320 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
321 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
322 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
323 }
324
325 function __makeTemplateObject(cooked, raw) {
326 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
327 return cooked;
328 };
329
330 var __setModuleDefault = Object.create ? (function(o, v) {
331 Object.defineProperty(o, "default", { enumerable: true, value: v });
332 }) : function(o, v) {
333 o["default"] = v;
334 };
335
336 function __importStar(mod) {
337 if (mod && mod.__esModule) return mod;
338 var result = {};
339 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
340 __setModuleDefault(result, mod);
341 return result;
342 }
343
344 function __importDefault(mod) {
345 return (mod && mod.__esModule) ? mod : { default: mod };
346 }
347
348 function __classPrivateFieldGet(receiver, state, kind, f) {
349 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
350 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
351 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
352 }
353
354 function __classPrivateFieldSet(receiver, state, value, kind, f) {
355 if (kind === "m") throw new TypeError("Private method is not writable");
356 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
357 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
358 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
359 }
360
361 function __classPrivateFieldIn(state, receiver) {
362 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
363 return typeof state === "function" ? receiver === state : state.has(receiver);
364 }
365
366 function __addDisposableResource(env, value, async) {
367 if (value !== null && value !== void 0) {
368 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
369 var dispose;
370 if (async) {
371 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
372 dispose = value[Symbol.asyncDispose];
373 }
374 if (dispose === void 0) {
375 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
376 dispose = value[Symbol.dispose];
377 }
378 if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
379 env.stack.push({ value: value, dispose: dispose, async: async });
380 }
381 else if (async) {
382 env.stack.push({ async: true });
383 }
384 return value;
385 }
386
387 var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
388 var e = new Error(message);
389 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
390 };
391
392 function __disposeResources(env) {
393 function fail(e) {
394 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
395 env.hasError = true;
396 }
397 function next() {
398 while (env.stack.length) {
399 var rec = env.stack.pop();
400 try {
401 var result = rec.dispose && rec.dispose.call(rec.value);
402 if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
403 }
404 catch (e) {
405 fail(e);
406 }
407 }
408 if (env.hasError) throw env.error;
409 }
410 return next();
411 }
412
413 /* harmony default export */ const tslib_es6 = ({
414 __extends,
415 __assign,
416 __rest,
417 __decorate,
418 __param,
419 __metadata,
420 __awaiter,
421 __generator,
422 __createBinding,
423 __exportStar,
424 __values,
425 __read,
426 __spread,
427 __spreadArrays,
428 __spreadArray,
429 __await,
430 __asyncGenerator,
431 __asyncDelegator,
432 __asyncValues,
433 __makeTemplateObject,
434 __importStar,
435 __importDefault,
436 __classPrivateFieldGet,
437 __classPrivateFieldSet,
438 __classPrivateFieldIn,
439 __addDisposableResource,
440 __disposeResources,
441 });
442
443 ;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
444 /**
445 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
446 */
447 var SUPPORTED_LOCALE = {
448 tr: {
449 regexp: /\u0130|\u0049|\u0049\u0307/g,
450 map: {
451 İ: "\u0069",
452 I: "\u0131",
453 : "\u0069",
454 },
455 },
456 az: {
457 regexp: /\u0130/g,
458 map: {
459 İ: "\u0069",
460 I: "\u0131",
461 : "\u0069",
462 },
463 },
464 lt: {
465 regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
466 map: {
467 I: "\u0069\u0307",
468 J: "\u006A\u0307",
469 Į: "\u012F\u0307",
470 Ì: "\u0069\u0307\u0300",
471 Í: "\u0069\u0307\u0301",
472 Ĩ: "\u0069\u0307\u0303",
473 },
474 },
475 };
476 /**
477 * Localized lower case.
478 */
479 function localeLowerCase(str, locale) {
480 var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
481 if (lang)
482 return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
483 return lowerCase(str);
484 }
485 /**
486 * Lower case as a function.
487 */
488 function lowerCase(str) {
489 return str.toLowerCase();
490 }
491
492 ;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
493
494 // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
495 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
496 // Remove all non-word characters.
497 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
498 /**
499 * Normalize the string into something other libraries can manipulate easier.
500 */
501 function noCase(input, options) {
502 if (options === void 0) { options = {}; }
503 var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
504 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
505 var start = 0;
506 var end = result.length;
507 // Trim the delimiter from around the output string.
508 while (result.charAt(start) === "\0")
509 start++;
510 while (result.charAt(end - 1) === "\0")
511 end--;
512 // Transform each token independently.
513 return result.slice(start, end).split("\0").map(transform).join(delimiter);
514 }
515 /**
516 * Replace `re` in the input string with the replacement value.
517 */
518 function replace(input, re, value) {
519 if (re instanceof RegExp)
520 return input.replace(re, value);
521 return re.reduce(function (input, re) { return input.replace(re, value); }, input);
522 }
523
524 ;// CONCATENATED MODULE: ./node_modules/upper-case-first/dist.es2015/index.js
525 /**
526 * Upper case the first character of an input string.
527 */
528 function upperCaseFirst(input) {
529 return input.charAt(0).toUpperCase() + input.substr(1);
530 }
531
532 ;// CONCATENATED MODULE: ./node_modules/capital-case/dist.es2015/index.js
533
534
535
536 function capitalCaseTransform(input) {
537 return upperCaseFirst(input.toLowerCase());
538 }
539 function capitalCase(input, options) {
540 if (options === void 0) { options = {}; }
541 return noCase(input, __assign({ delimiter: " ", transform: capitalCaseTransform }, options));
542 }
543
544 ;// CONCATENATED MODULE: external ["wp","i18n"]
545 const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
546 ;// CONCATENATED MODULE: ./packages/keycodes/build-module/platform.js
547 /**
548 * Return true if platform is MacOS.
549 *
550 * @param {Window?} _window window object by default; used for DI testing.
551 *
552 * @return {boolean} True if MacOS; false otherwise.
553 */
554 function isAppleOS(_window = null) {
555 if (!_window) {
556 if (typeof window === 'undefined') {
557 return false;
558 }
559 _window = window;
560 }
561 const {
562 platform
563 } = _window.navigator;
564 return platform.indexOf('Mac') !== -1 || ['iPad', 'iPhone'].includes(platform);
565 }
566
567 ;// CONCATENATED MODULE: ./packages/keycodes/build-module/index.js
568 /**
569 * Note: The order of the modifier keys in many of the [foo]Shortcut()
570 * functions in this file are intentional and should not be changed. They're
571 * designed to fit with the standard menu keyboard shortcuts shown in the
572 * user's platform.
573 *
574 * For example, on MacOS menu shortcuts will place Shift before Command, but
575 * on Windows Control will usually come first. So don't provide your own
576 * shortcut combos directly to keyboardShortcut().
577 */
578
579 /**
580 * External dependencies
581 */
582
583
584 /**
585 * WordPress dependencies
586 */
587
588
589 /**
590 * Internal dependencies
591 */
592
593
594 /** @typedef {typeof ALT | CTRL | COMMAND | SHIFT } WPModifierPart */
595
596 /** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */
597
598 /**
599 * An object of handler functions for each of the possible modifier
600 * combinations. A handler will return a value for a given key.
601 *
602 * @template T
603 *
604 * @typedef {Record<WPKeycodeModifier, T>} WPModifierHandler
605 */
606
607 /**
608 * @template T
609 *
610 * @typedef {(character: string, isApple?: () => boolean) => T} WPKeyHandler
611 */
612 /** @typedef {(event: import('react').KeyboardEvent<HTMLElement> | KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */
613
614 /** @typedef {( isApple: () => boolean ) => WPModifierPart[]} WPModifier */
615
616 /**
617 * Keycode for BACKSPACE key.
618 */
619 const BACKSPACE = 8;
620
621 /**
622 * Keycode for TAB key.
623 */
624 const TAB = 9;
625
626 /**
627 * Keycode for ENTER key.
628 */
629 const ENTER = 13;
630
631 /**
632 * Keycode for ESCAPE key.
633 */
634 const ESCAPE = 27;
635
636 /**
637 * Keycode for SPACE key.
638 */
639 const SPACE = 32;
640
641 /**
642 * Keycode for PAGEUP key.
643 */
644 const PAGEUP = 33;
645
646 /**
647 * Keycode for PAGEDOWN key.
648 */
649 const PAGEDOWN = 34;
650
651 /**
652 * Keycode for END key.
653 */
654 const END = 35;
655
656 /**
657 * Keycode for HOME key.
658 */
659 const HOME = 36;
660
661 /**
662 * Keycode for LEFT key.
663 */
664 const LEFT = 37;
665
666 /**
667 * Keycode for UP key.
668 */
669 const UP = 38;
670
671 /**
672 * Keycode for RIGHT key.
673 */
674 const RIGHT = 39;
675
676 /**
677 * Keycode for DOWN key.
678 */
679 const DOWN = 40;
680
681 /**
682 * Keycode for DELETE key.
683 */
684 const DELETE = 46;
685
686 /**
687 * Keycode for F10 key.
688 */
689 const F10 = 121;
690
691 /**
692 * Keycode for ALT key.
693 */
694 const ALT = 'alt';
695
696 /**
697 * Keycode for CTRL key.
698 */
699 const CTRL = 'ctrl';
700
701 /**
702 * Keycode for COMMAND/META key.
703 */
704 const COMMAND = 'meta';
705
706 /**
707 * Keycode for SHIFT key.
708 */
709 const SHIFT = 'shift';
710
711 /**
712 * Keycode for ZERO key.
713 */
714 const ZERO = 48;
715
716
717 /**
718 * Map the values of an object with a specified callback and return the result object.
719 *
720 * @template {{ [s: string]: any; } | ArrayLike<any>} T
721 *
722 * @param {T} object Object to map values of.
723 * @param {( value: any ) => any} mapFn Mapping function
724 *
725 * @return {any} Active modifier constants.
726 */
727 function mapValues(object, mapFn) {
728 return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, mapFn(value)]));
729 }
730
731 /**
732 * Object that contains functions that return the available modifier
733 * depending on platform.
734 *
735 * @type {WPModifierHandler< ( isApple: () => boolean ) => WPModifierPart[]>}
736 */
737 const modifiers = {
738 primary: _isApple => _isApple() ? [COMMAND] : [CTRL],
739 primaryShift: _isApple => _isApple() ? [SHIFT, COMMAND] : [CTRL, SHIFT],
740 primaryAlt: _isApple => _isApple() ? [ALT, COMMAND] : [CTRL, ALT],
741 secondary: _isApple => _isApple() ? [SHIFT, ALT, COMMAND] : [CTRL, SHIFT, ALT],
742 access: _isApple => _isApple() ? [CTRL, ALT] : [SHIFT, ALT],
743 ctrl: () => [CTRL],
744 alt: () => [ALT],
745 ctrlShift: () => [CTRL, SHIFT],
746 shift: () => [SHIFT],
747 shiftAlt: () => [SHIFT, ALT],
748 undefined: () => []
749 };
750
751 /**
752 * An object that contains functions to get raw shortcuts.
753 *
754 * These are intended for user with the KeyboardShortcuts.
755 *
756 * @example
757 * ```js
758 * // Assuming macOS:
759 * rawShortcut.primary( 'm' )
760 * // "meta+m""
761 * ```
762 *
763 * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to raw
764 * shortcuts.
765 */
766 const rawShortcut = mapValues(modifiers, ( /** @type {WPModifier} */modifier) => {
767 return (/** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => {
768 return [...modifier(_isApple), character.toLowerCase()].join('+');
769 }
770 );
771 });
772
773 /**
774 * Return an array of the parts of a keyboard shortcut chord for display.
775 *
776 * @example
777 * ```js
778 * // Assuming macOS:
779 * displayShortcutList.primary( 'm' );
780 * // [ "⌘", "M" ]
781 * ```
782 *
783 * @type {WPModifierHandler<WPKeyHandler<string[]>>} Keyed map of functions to
784 * shortcut sequences.
785 */
786 const displayShortcutList = mapValues(modifiers, ( /** @type {WPModifier} */modifier) => {
787 return (/** @type {WPKeyHandler<string[]>} */(character, _isApple = isAppleOS) => {
788 const isApple = _isApple();
789 const replacementKeyMap = {
790 [ALT]: isApple ? '' : 'Alt',
791 [CTRL]: isApple ? '' : 'Ctrl',
792 // Make sure ⌃ is the U+2303 UP ARROWHEAD unicode character and not the caret character.
793 [COMMAND]: '',
794 [SHIFT]: isApple ? '' : 'Shift'
795 };
796 const modifierKeys = modifier(_isApple).reduce((accumulator, key) => {
797 var _replacementKeyMap$ke;
798 const replacementKey = (_replacementKeyMap$ke = replacementKeyMap[key]) !== null && _replacementKeyMap$ke !== void 0 ? _replacementKeyMap$ke : key;
799 // If on the Mac, adhere to platform convention and don't show plus between keys.
800 if (isApple) {
801 return [...accumulator, replacementKey];
802 }
803 return [...accumulator, replacementKey, '+'];
804 }, /** @type {string[]} */[]);
805
806 // Symbols (~`,.) are removed by the default regular expression,
807 // so override the rule to allow symbols used for shortcuts.
808 // see: https://github.com/blakeembrey/change-case#options
809 const capitalizedCharacter = capitalCase(character, {
810 stripRegexp: /[^A-Z0-9~`,\.\\\-]/gi
811 });
812 return [...modifierKeys, capitalizedCharacter];
813 }
814 );
815 });
816
817 /**
818 * An object that contains functions to display shortcuts.
819 *
820 * @example
821 * ```js
822 * // Assuming macOS:
823 * displayShortcut.primary( 'm' );
824 * // "⌘M"
825 * ```
826 *
827 * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to
828 * display shortcuts.
829 */
830 const displayShortcut = mapValues(displayShortcutList, ( /** @type {WPKeyHandler<string[]>} */shortcutList) => {
831 return (/** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => shortcutList(character, _isApple).join('')
832 );
833 });
834
835 /**
836 * An object that contains functions to return an aria label for a keyboard
837 * shortcut.
838 *
839 * @example
840 * ```js
841 * // Assuming macOS:
842 * shortcutAriaLabel.primary( '.' );
843 * // "Command + Period"
844 * ```
845 *
846 * @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to
847 * shortcut ARIA labels.
848 */
849 const shortcutAriaLabel = mapValues(modifiers, ( /** @type {WPModifier} */modifier) => {
850 return (/** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => {
851 const isApple = _isApple();
852 /** @type {Record<string,string>} */
853 const replacementKeyMap = {
854 [SHIFT]: 'Shift',
855 [COMMAND]: isApple ? 'Command' : 'Control',
856 [CTRL]: 'Control',
857 [ALT]: isApple ? 'Option' : 'Alt',
858 /* translators: comma as in the character ',' */
859 ',': (0,external_wp_i18n_namespaceObject.__)('Comma'),
860 /* translators: period as in the character '.' */
861 '.': (0,external_wp_i18n_namespaceObject.__)('Period'),
862 /* translators: backtick as in the character '`' */
863 '`': (0,external_wp_i18n_namespaceObject.__)('Backtick'),
864 /* translators: tilde as in the character '~' */
865 '~': (0,external_wp_i18n_namespaceObject.__)('Tilde')
866 };
867 return [...modifier(_isApple), character].map(key => {
868 var _replacementKeyMap$ke2;
869 return capitalCase((_replacementKeyMap$ke2 = replacementKeyMap[key]) !== null && _replacementKeyMap$ke2 !== void 0 ? _replacementKeyMap$ke2 : key);
870 }).join(isApple ? ' ' : ' + ');
871 }
872 );
873 });
874
875 /**
876 * From a given KeyboardEvent, returns an array of active modifier constants for
877 * the event.
878 *
879 * @param {import('react').KeyboardEvent<HTMLElement> | KeyboardEvent} event Keyboard event.
880 *
881 * @return {Array<WPModifierPart>} Active modifier constants.
882 */
883 function getEventModifiers(event) {
884 return (/** @type {WPModifierPart[]} */[ALT, CTRL, COMMAND, SHIFT].filter(key => event[/** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */
885 `${key}Key`])
886 );
887 }
888
889 /**
890 * An object that contains functions to check if a keyboard event matches a
891 * predefined shortcut combination.
892 *
893 * @example
894 * ```js
895 * // Assuming an event for ⌘M key press:
896 * isKeyboardEvent.primary( event, 'm' );
897 * // true
898 * ```
899 *
900 * @type {WPModifierHandler<WPEventKeyHandler>} Keyed map of functions
901 * to match events.
902 */
903 const isKeyboardEvent = mapValues(modifiers, ( /** @type {WPModifier} */getModifiers) => {
904 return (/** @type {WPEventKeyHandler} */(event, character, _isApple = isAppleOS) => {
905 const mods = getModifiers(_isApple);
906 const eventMods = getEventModifiers(event);
907 /** @type {Record<string,string>} */
908 const replacementWithShiftKeyMap = {
909 Comma: ',',
910 Backslash: '\\',
911 // Windows returns `\` for both IntlRo and IntlYen.
912 IntlRo: '\\',
913 IntlYen: '\\'
914 };
915 const modsDiff = mods.filter(mod => !eventMods.includes(mod));
916 const eventModsDiff = eventMods.filter(mod => !mods.includes(mod));
917 if (modsDiff.length > 0 || eventModsDiff.length > 0) {
918 return false;
919 }
920 let key = event.key.toLowerCase();
921 if (!character) {
922 return mods.includes( /** @type {WPModifierPart} */key);
923 }
924 if (event.altKey && character.length === 1) {
925 key = String.fromCharCode(event.keyCode).toLowerCase();
926 }
927
928 // `event.key` returns the value of the key pressed, taking into the state of
929 // modifier keys such as `Shift`. If the shift key is pressed, a different
930 // value may be returned depending on the keyboard layout. It is necessary to
931 // convert to the physical key value that don't take into account keyboard
932 // layout or modifier key state.
933 if (event.shiftKey && character.length === 1 && replacementWithShiftKeyMap[event.code]) {
934 key = replacementWithShiftKeyMap[event.code];
935 }
936
937 // For backwards compatibility.
938 if (character === 'del') {
939 character = 'delete';
940 }
941 return key === character.toLowerCase();
942 }
943 );
944 });
945
946 (window.wp = window.wp || {}).keycodes = __webpack_exports__;
947 /******/ })()
948 ;