author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:52:52 +0200 | |
changeset 22 | 8c2e4d02f4ef |
parent 21 | 48c4eec2b7e6 |
permissions | -rw-r--r-- |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1 |
/******/ (() => { // webpackBootstrap |
19 | 2 |
/******/ "use strict"; |
3 |
/******/ // The require scope |
|
4 |
/******/ var __webpack_require__ = {}; |
|
5 |
/******/ |
|
6 |
/************************************************************************/ |
|
7 |
/******/ /* webpack/runtime/define property getters */ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
8 |
/******/ (() => { |
19 | 9 |
/******/ // define getter functions for harmony exports |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
10 |
/******/ __webpack_require__.d = (exports, definition) => { |
19 | 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 |
/******/ } |
|
9 | 16 |
/******/ }; |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
17 |
/******/ })(); |
19 | 18 |
/******/ |
19 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
20 |
/******/ (() => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
21 |
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
22 |
/******/ })(); |
19 | 23 |
/******/ |
24 |
/******/ /* webpack/runtime/make namespace object */ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
25 |
/******/ (() => { |
19 | 26 |
/******/ // define __esModule on exports |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
27 |
/******/ __webpack_require__.r = (exports) => { |
19 | 28 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
29 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
30 |
/******/ } |
|
31 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
32 |
/******/ }; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
33 |
/******/ })(); |
19 | 34 |
/******/ |
9 | 35 |
/************************************************************************/ |
19 | 36 |
var __webpack_exports__ = {}; |
16 | 37 |
// ESM COMPAT FLAG |
9 | 38 |
__webpack_require__.r(__webpack_exports__); |
39 |
||
16 | 40 |
// EXPORTS |
19 | 41 |
__webpack_require__.d(__webpack_exports__, { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
42 |
ALT: () => (/* binding */ ALT), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
43 |
BACKSPACE: () => (/* binding */ BACKSPACE), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
44 |
COMMAND: () => (/* binding */ COMMAND), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
45 |
CTRL: () => (/* binding */ CTRL), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
46 |
DELETE: () => (/* binding */ DELETE), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
47 |
DOWN: () => (/* binding */ DOWN), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
48 |
END: () => (/* binding */ END), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
49 |
ENTER: () => (/* binding */ ENTER), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
50 |
ESCAPE: () => (/* binding */ ESCAPE), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
51 |
F10: () => (/* binding */ F10), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
52 |
HOME: () => (/* binding */ HOME), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
53 |
LEFT: () => (/* binding */ LEFT), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
54 |
PAGEDOWN: () => (/* binding */ PAGEDOWN), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
55 |
PAGEUP: () => (/* binding */ PAGEUP), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
56 |
RIGHT: () => (/* binding */ RIGHT), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
57 |
SHIFT: () => (/* binding */ SHIFT), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
58 |
SPACE: () => (/* binding */ SPACE), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
59 |
TAB: () => (/* binding */ TAB), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
60 |
UP: () => (/* binding */ UP), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
61 |
ZERO: () => (/* binding */ ZERO), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
62 |
displayShortcut: () => (/* binding */ displayShortcut), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
63 |
displayShortcutList: () => (/* binding */ displayShortcutList), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
64 |
isAppleOS: () => (/* reexport */ isAppleOS), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
65 |
isKeyboardEvent: () => (/* binding */ isKeyboardEvent), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
66 |
modifiers: () => (/* binding */ modifiers), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
67 |
rawShortcut: () => (/* binding */ rawShortcut), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
68 |
shortcutAriaLabel: () => (/* binding */ shortcutAriaLabel) |
19 | 69 |
}); |
16 | 70 |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
71 |
;// external ["wp","i18n"] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
72 |
const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
73 |
;// ./node_modules/@wordpress/keycodes/build-module/platform.js |
9 | 74 |
/** |
75 |
* Return true if platform is MacOS. |
|
76 |
* |
|
18 | 77 |
* @param {Window?} _window window object by default; used for DI testing. |
9 | 78 |
* |
18 | 79 |
* @return {boolean} True if MacOS; false otherwise. |
9 | 80 |
*/ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
81 |
function isAppleOS(_window = null) { |
18 | 82 |
if (!_window) { |
83 |
if (typeof window === 'undefined') { |
|
84 |
return false; |
|
85 |
} |
|
86 |
_window = window; |
|
87 |
} |
|
88 |
const { |
|
89 |
platform |
|
90 |
} = _window.navigator; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
91 |
return platform.indexOf('Mac') !== -1 || ['iPad', 'iPhone'].includes(platform); |
9 | 92 |
} |
93 |
||
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
94 |
;// ./node_modules/@wordpress/keycodes/build-module/index.js |
9 | 95 |
/** |
96 |
* Note: The order of the modifier keys in many of the [foo]Shortcut() |
|
97 |
* functions in this file are intentional and should not be changed. They're |
|
98 |
* designed to fit with the standard menu keyboard shortcuts shown in the |
|
99 |
* user's platform. |
|
100 |
* |
|
101 |
* For example, on MacOS menu shortcuts will place Shift before Command, but |
|
102 |
* on Windows Control will usually come first. So don't provide your own |
|
103 |
* shortcut combos directly to keyboardShortcut(). |
|
104 |
*/ |
|
105 |
||
106 |
/** |
|
107 |
* WordPress dependencies |
|
108 |
*/ |
|
109 |
||
110 |
||
111 |
/** |
|
112 |
* Internal dependencies |
|
113 |
*/ |
|
114 |
||
115 |
||
18 | 116 |
/** @typedef {typeof ALT | CTRL | COMMAND | SHIFT } WPModifierPart */ |
117 |
||
19 | 118 |
/** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */ |
16 | 119 |
|
120 |
/** |
|
121 |
* An object of handler functions for each of the possible modifier |
|
122 |
* combinations. A handler will return a value for a given key. |
|
123 |
* |
|
18 | 124 |
* @template T |
125 |
* |
|
126 |
* @typedef {Record<WPKeycodeModifier, T>} WPModifierHandler |
|
16 | 127 |
*/ |
128 |
||
129 |
/** |
|
18 | 130 |
* @template T |
131 |
* |
|
132 |
* @typedef {(character: string, isApple?: () => boolean) => T} WPKeyHandler |
|
133 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
134 |
/** @typedef {(event: import('react').KeyboardEvent<HTMLElement> | KeyboardEvent, character: string, isApple?: () => boolean) => boolean} WPEventKeyHandler */ |
18 | 135 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
136 |
/** @typedef {( isApple: () => boolean ) => WPModifierPart[]} WPModifier */ |
18 | 137 |
|
138 |
/** |
|
9 | 139 |
* Keycode for BACKSPACE key. |
140 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
141 |
const BACKSPACE = 8; |
9 | 142 |
|
143 |
/** |
|
144 |
* Keycode for TAB key. |
|
145 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
146 |
const TAB = 9; |
9 | 147 |
|
148 |
/** |
|
149 |
* Keycode for ENTER key. |
|
150 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
151 |
const ENTER = 13; |
9 | 152 |
|
153 |
/** |
|
154 |
* Keycode for ESCAPE key. |
|
155 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
156 |
const ESCAPE = 27; |
9 | 157 |
|
158 |
/** |
|
159 |
* Keycode for SPACE key. |
|
160 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
161 |
const SPACE = 32; |
9 | 162 |
|
163 |
/** |
|
19 | 164 |
* Keycode for PAGEUP key. |
165 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
166 |
const PAGEUP = 33; |
19 | 167 |
|
168 |
/** |
|
169 |
* Keycode for PAGEDOWN key. |
|
170 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
171 |
const PAGEDOWN = 34; |
19 | 172 |
|
173 |
/** |
|
174 |
* Keycode for END key. |
|
175 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
176 |
const END = 35; |
19 | 177 |
|
178 |
/** |
|
179 |
* Keycode for HOME key. |
|
180 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
181 |
const HOME = 36; |
19 | 182 |
|
183 |
/** |
|
9 | 184 |
* Keycode for LEFT key. |
185 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
186 |
const LEFT = 37; |
9 | 187 |
|
188 |
/** |
|
189 |
* Keycode for UP key. |
|
190 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
191 |
const UP = 38; |
9 | 192 |
|
193 |
/** |
|
194 |
* Keycode for RIGHT key. |
|
195 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
196 |
const RIGHT = 39; |
9 | 197 |
|
198 |
/** |
|
199 |
* Keycode for DOWN key. |
|
200 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
201 |
const DOWN = 40; |
9 | 202 |
|
203 |
/** |
|
204 |
* Keycode for DELETE key. |
|
205 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
206 |
const DELETE = 46; |
9 | 207 |
|
208 |
/** |
|
209 |
* Keycode for F10 key. |
|
210 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
211 |
const F10 = 121; |
9 | 212 |
|
213 |
/** |
|
214 |
* Keycode for ALT key. |
|
215 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
216 |
const ALT = 'alt'; |
9 | 217 |
|
218 |
/** |
|
219 |
* Keycode for CTRL key. |
|
220 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
221 |
const CTRL = 'ctrl'; |
9 | 222 |
|
223 |
/** |
|
224 |
* Keycode for COMMAND/META key. |
|
225 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
226 |
const COMMAND = 'meta'; |
9 | 227 |
|
228 |
/** |
|
229 |
* Keycode for SHIFT key. |
|
230 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
231 |
const SHIFT = 'shift'; |
9 | 232 |
|
233 |
/** |
|
16 | 234 |
* Keycode for ZERO key. |
235 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
236 |
const ZERO = 48; |
16 | 237 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
238 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
239 |
/** |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
240 |
* Capitalise the first character of a string. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
241 |
* @param {string} string String to capitalise. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
242 |
* @return {string} Capitalised string. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
243 |
*/ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
244 |
function capitaliseFirstCharacter(string) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
245 |
return string.length < 2 ? string.toUpperCase() : string.charAt(0).toUpperCase() + string.slice(1); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
246 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
247 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
248 |
/** |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
249 |
* Map the values of an object with a specified callback and return the result object. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
250 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
251 |
* @template {{ [s: string]: any; } | ArrayLike<any>} T |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
252 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
253 |
* @param {T} object Object to map values of. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
254 |
* @param {( value: any ) => any} mapFn Mapping function |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
255 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
256 |
* @return {any} Active modifier constants. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
257 |
*/ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
258 |
function mapValues(object, mapFn) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
259 |
return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, mapFn(value)])); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
260 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
261 |
|
16 | 262 |
/** |
9 | 263 |
* Object that contains functions that return the available modifier |
264 |
* depending on platform. |
|
265 |
* |
|
18 | 266 |
* @type {WPModifierHandler< ( isApple: () => boolean ) => WPModifierPart[]>} |
9 | 267 |
*/ |
18 | 268 |
const modifiers = { |
269 |
primary: _isApple => _isApple() ? [COMMAND] : [CTRL], |
|
270 |
primaryShift: _isApple => _isApple() ? [SHIFT, COMMAND] : [CTRL, SHIFT], |
|
271 |
primaryAlt: _isApple => _isApple() ? [ALT, COMMAND] : [CTRL, ALT], |
|
272 |
secondary: _isApple => _isApple() ? [SHIFT, ALT, COMMAND] : [CTRL, SHIFT, ALT], |
|
273 |
access: _isApple => _isApple() ? [CTRL, ALT] : [SHIFT, ALT], |
|
274 |
ctrl: () => [CTRL], |
|
275 |
alt: () => [ALT], |
|
276 |
ctrlShift: () => [CTRL, SHIFT], |
|
277 |
shift: () => [SHIFT], |
|
19 | 278 |
shiftAlt: () => [SHIFT, ALT], |
279 |
undefined: () => [] |
|
9 | 280 |
}; |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
281 |
|
9 | 282 |
/** |
283 |
* An object that contains functions to get raw shortcuts. |
|
18 | 284 |
* |
285 |
* These are intended for user with the KeyboardShortcuts. |
|
9 | 286 |
* |
18 | 287 |
* @example |
288 |
* ```js |
|
289 |
* // Assuming macOS: |
|
290 |
* rawShortcut.primary( 'm' ) |
|
291 |
* // "meta+m"" |
|
292 |
* ``` |
|
9 | 293 |
* |
18 | 294 |
* @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to raw |
295 |
* shortcuts. |
|
9 | 296 |
*/ |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
297 |
const rawShortcut = /* @__PURE__ */ |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
298 |
mapValues(modifiers, (/** @type {WPModifier} */modifier) => { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
299 |
return /** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
300 |
return [...modifier(_isApple), character.toLowerCase()].join('+'); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
301 |
}; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
302 |
}); |
9 | 303 |
|
18 | 304 |
/** |
305 |
* Return an array of the parts of a keyboard shortcut chord for display. |
|
306 |
* |
|
307 |
* @example |
|
308 |
* ```js |
|
309 |
* // Assuming macOS: |
|
310 |
* displayShortcutList.primary( 'm' ); |
|
311 |
* // [ "⌘", "M" ] |
|
312 |
* ``` |
|
313 |
* |
|
314 |
* @type {WPModifierHandler<WPKeyHandler<string[]>>} Keyed map of functions to |
|
315 |
* shortcut sequences. |
|
316 |
*/ |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
317 |
const displayShortcutList = /* @__PURE__ */ |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
318 |
mapValues(modifiers, (/** @type {WPModifier} */modifier) => { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
319 |
return /** @type {WPKeyHandler<string[]>} */(character, _isApple = isAppleOS) => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
320 |
const isApple = _isApple(); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
321 |
const replacementKeyMap = { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
322 |
[ALT]: isApple ? '⌥' : 'Alt', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
323 |
[CTRL]: isApple ? '⌃' : 'Ctrl', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
324 |
// Make sure ⌃ is the U+2303 UP ARROWHEAD unicode character and not the caret character. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
325 |
[COMMAND]: '⌘', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
326 |
[SHIFT]: isApple ? '⇧' : 'Shift' |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
327 |
}; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
328 |
const modifierKeys = modifier(_isApple).reduce((accumulator, key) => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
329 |
var _replacementKeyMap$ke; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
330 |
const replacementKey = (_replacementKeyMap$ke = replacementKeyMap[key]) !== null && _replacementKeyMap$ke !== void 0 ? _replacementKeyMap$ke : key; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
331 |
// If on the Mac, adhere to platform convention and don't show plus between keys. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
332 |
if (isApple) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
333 |
return [...accumulator, replacementKey]; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
334 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
335 |
return [...accumulator, replacementKey, '+']; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
336 |
}, /** @type {string[]} */[]); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
337 |
return [...modifierKeys, capitaliseFirstCharacter(character)]; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
338 |
}; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
339 |
}); |
9 | 340 |
|
341 |
/** |
|
342 |
* An object that contains functions to display shortcuts. |
|
343 |
* |
|
18 | 344 |
* @example |
345 |
* ```js |
|
346 |
* // Assuming macOS: |
|
347 |
* displayShortcut.primary( 'm' ); |
|
348 |
* // "⌘M" |
|
349 |
* ``` |
|
350 |
* |
|
351 |
* @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to |
|
352 |
* display shortcuts. |
|
9 | 353 |
*/ |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
354 |
const displayShortcut = /* @__PURE__ */ |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
355 |
mapValues(displayShortcutList, (/** @type {WPKeyHandler<string[]>} */shortcutList) => { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
356 |
return /** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => shortcutList(character, _isApple).join(''); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
357 |
}); |
9 | 358 |
|
359 |
/** |
|
18 | 360 |
* An object that contains functions to return an aria label for a keyboard |
361 |
* shortcut. |
|
16 | 362 |
* |
18 | 363 |
* @example |
364 |
* ```js |
|
365 |
* // Assuming macOS: |
|
366 |
* shortcutAriaLabel.primary( '.' ); |
|
367 |
* // "Command + Period" |
|
368 |
* ``` |
|
369 |
* |
|
370 |
* @type {WPModifierHandler<WPKeyHandler<string>>} Keyed map of functions to |
|
371 |
* shortcut ARIA labels. |
|
9 | 372 |
*/ |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
373 |
const shortcutAriaLabel = /* @__PURE__ */ |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
374 |
mapValues(modifiers, (/** @type {WPModifier} */modifier) => { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
375 |
return /** @type {WPKeyHandler<string>} */(character, _isApple = isAppleOS) => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
376 |
const isApple = _isApple(); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
377 |
/** @type {Record<string,string>} */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
378 |
const replacementKeyMap = { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
379 |
[SHIFT]: 'Shift', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
380 |
[COMMAND]: isApple ? 'Command' : 'Control', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
381 |
[CTRL]: 'Control', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
382 |
[ALT]: isApple ? 'Option' : 'Alt', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
383 |
/* translators: comma as in the character ',' */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
384 |
',': (0,external_wp_i18n_namespaceObject.__)('Comma'), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
385 |
/* translators: period as in the character '.' */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
386 |
'.': (0,external_wp_i18n_namespaceObject.__)('Period'), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
387 |
/* translators: backtick as in the character '`' */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
388 |
'`': (0,external_wp_i18n_namespaceObject.__)('Backtick'), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
389 |
/* translators: tilde as in the character '~' */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
390 |
'~': (0,external_wp_i18n_namespaceObject.__)('Tilde') |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
391 |
}; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
392 |
return [...modifier(_isApple), character].map(key => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
393 |
var _replacementKeyMap$ke2; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
394 |
return capitaliseFirstCharacter((_replacementKeyMap$ke2 = replacementKeyMap[key]) !== null && _replacementKeyMap$ke2 !== void 0 ? _replacementKeyMap$ke2 : key); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
395 |
}).join(isApple ? ' ' : ' + '); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
396 |
}; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
397 |
}); |
9 | 398 |
|
399 |
/** |
|
16 | 400 |
* From a given KeyboardEvent, returns an array of active modifier constants for |
401 |
* the event. |
|
402 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
403 |
* @param {import('react').KeyboardEvent<HTMLElement> | KeyboardEvent} event Keyboard event. |
16 | 404 |
* |
18 | 405 |
* @return {Array<WPModifierPart>} Active modifier constants. |
16 | 406 |
*/ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
407 |
function getEventModifiers(event) { |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
408 |
return /** @type {WPModifierPart[]} */[ALT, CTRL, COMMAND, SHIFT].filter(key => event[(/** @type {'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'} */ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
409 |
`${key}Key`)]); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
410 |
} |
16 | 411 |
|
412 |
/** |
|
9 | 413 |
* An object that contains functions to check if a keyboard event matches a |
414 |
* predefined shortcut combination. |
|
415 |
* |
|
18 | 416 |
* @example |
417 |
* ```js |
|
418 |
* // Assuming an event for ⌘M key press: |
|
419 |
* isKeyboardEvent.primary( event, 'm' ); |
|
420 |
* // true |
|
421 |
* ``` |
|
422 |
* |
|
423 |
* @type {WPModifierHandler<WPEventKeyHandler>} Keyed map of functions |
|
424 |
* to match events. |
|
9 | 425 |
*/ |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
426 |
const isKeyboardEvent = /* @__PURE__ */ |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
427 |
mapValues(modifiers, (/** @type {WPModifier} */getModifiers) => { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
428 |
return /** @type {WPEventKeyHandler} */(event, character, _isApple = isAppleOS) => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
429 |
const mods = getModifiers(_isApple); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
430 |
const eventMods = getEventModifiers(event); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
431 |
/** @type {Record<string,string>} */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
432 |
const replacementWithShiftKeyMap = { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
433 |
Comma: ',', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
434 |
Backslash: '\\', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
435 |
// Windows returns `\` for both IntlRo and IntlYen. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
436 |
IntlRo: '\\', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
437 |
IntlYen: '\\' |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
438 |
}; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
439 |
const modsDiff = mods.filter(mod => !eventMods.includes(mod)); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
440 |
const eventModsDiff = eventMods.filter(mod => !mods.includes(mod)); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
441 |
if (modsDiff.length > 0 || eventModsDiff.length > 0) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
442 |
return false; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
443 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
444 |
let key = event.key.toLowerCase(); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
445 |
if (!character) { |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
446 |
return mods.includes(/** @type {WPModifierPart} */key); |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
447 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
448 |
if (event.altKey && character.length === 1) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
449 |
key = String.fromCharCode(event.keyCode).toLowerCase(); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
450 |
} |
19 | 451 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
452 |
// `event.key` returns the value of the key pressed, taking into the state of |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
453 |
// modifier keys such as `Shift`. If the shift key is pressed, a different |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
454 |
// value may be returned depending on the keyboard layout. It is necessary to |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
455 |
// convert to the physical key value that don't take into account keyboard |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
456 |
// layout or modifier key state. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
457 |
if (event.shiftKey && character.length === 1 && replacementWithShiftKeyMap[event.code]) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
458 |
key = replacementWithShiftKeyMap[event.code]; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
459 |
} |
19 | 460 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
461 |
// For backwards compatibility. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
462 |
if (character === 'del') { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
463 |
character = 'delete'; |
9 | 464 |
} |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
465 |
return key === character.toLowerCase(); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
466 |
}; |
9 | 467 |
}); |
468 |
||
19 | 469 |
(window.wp = window.wp || {}).keycodes = __webpack_exports__; |
470 |
/******/ })() |
|
471 |
; |