@wordpress/keyboard-shortcuts 4.12.0 → 4.12.2
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.
@@ -1,7 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
6
4
|
value: true
|
7
5
|
});
|
@@ -9,8 +7,6 @@ exports.ShortcutProvider = ShortcutProvider;
|
|
9
7
|
|
10
8
|
var _element = require("@wordpress/element");
|
11
9
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
|
-
|
14
10
|
var _context = require("../context");
|
15
11
|
|
16
12
|
/**
|
@@ -46,9 +42,9 @@ function ShortcutProvider(props) {
|
|
46
42
|
|
47
43
|
return (0, _element.createElement)(Provider, {
|
48
44
|
value: keyboardShortcuts
|
49
|
-
}, (0, _element.createElement)("div",
|
45
|
+
}, (0, _element.createElement)("div", { ...props,
|
50
46
|
onKeyDown: onKeyDown
|
51
|
-
}))
|
47
|
+
}));
|
52
48
|
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
53
49
|
}
|
54
50
|
//# sourceMappingURL=shortcut-provider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["@wordpress/keyboard-shortcuts/src/components/shortcut-provider.js"],"names":["Provider","context","ShortcutProvider","props","keyboardShortcuts","Set","onKeyDown","event","keyboardShortcut","current"],"mappings":"
|
1
|
+
{"version":3,"sources":["@wordpress/keyboard-shortcuts/src/components/shortcut-provider.js"],"names":["Provider","context","ShortcutProvider","props","keyboardShortcuts","Set","onKeyDown","event","keyboardShortcut","current"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAM;AAAEA,EAAAA;AAAF,IAAeC,gBAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,gBAAT,CAA2BC,KAA3B,EAAmC;AACzC,QAAMC,iBAAiB,GAAG,qBAAQ,IAAIC,GAAJ,EAAR,CAA1B;;AAEA,WAASC,SAAT,CAAoBC,KAApB,EAA4B;AAC3B,QAAKJ,KAAK,CAACG,SAAX,EAAuBH,KAAK,CAACG,SAAN,CAAiBC,KAAjB;;AAEvB,SAAM,MAAMC,gBAAZ,IAAgCJ,iBAAiB,CAACK,OAAlD,EAA4D;AAC3DD,MAAAA,gBAAgB,CAAED,KAAF,CAAhB;AACA;AACD;AAED;;;AACA,SACC,4BAAC,QAAD;AAAU,IAAA,KAAK,EAAGH;AAAlB,KACC,wCAAUD,KAAV;AAAkB,IAAA,SAAS,EAAGG;AAA9B,IADD,CADD;AAKA;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { context } from '../context';\n\nconst { Provider } = context;\n\n/**\n * Handles callbacks added to context by `useShortcut`.\n *\n * @param {Object} props Props to pass to `div`.\n *\n * @return {import('@wordpress/element').WPElement} Component.\n */\nexport function ShortcutProvider( props ) {\n\tconst keyboardShortcuts = useRef( new Set() );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( props.onKeyDown ) props.onKeyDown( event );\n\n\t\tfor ( const keyboardShortcut of keyboardShortcuts.current ) {\n\t\t\tkeyboardShortcut( event );\n\t\t}\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<Provider value={ keyboardShortcuts }>\n\t\t\t<div { ...props } onKeyDown={ onKeyDown } />\n\t\t</Provider>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n"]}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
1
|
import { createElement } from "@wordpress/element";
|
3
2
|
|
4
3
|
/**
|
@@ -36,9 +35,9 @@ export function ShortcutProvider(props) {
|
|
36
35
|
|
37
36
|
return createElement(Provider, {
|
38
37
|
value: keyboardShortcuts
|
39
|
-
}, createElement("div",
|
38
|
+
}, createElement("div", { ...props,
|
40
39
|
onKeyDown: onKeyDown
|
41
|
-
}))
|
40
|
+
}));
|
42
41
|
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
43
42
|
}
|
44
43
|
//# sourceMappingURL=shortcut-provider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["@wordpress/keyboard-shortcuts/src/components/shortcut-provider.js"],"names":["useRef","context","Provider","ShortcutProvider","props","keyboardShortcuts","Set","onKeyDown","event","keyboardShortcut","current"],"mappings":"
|
1
|
+
{"version":3,"sources":["@wordpress/keyboard-shortcuts/src/components/shortcut-provider.js"],"names":["useRef","context","Provider","ShortcutProvider","props","keyboardShortcuts","Set","onKeyDown","event","keyboardShortcut","current"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,oBAAvB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,YAAxB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAeD,OAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,gBAAT,CAA2BC,KAA3B,EAAmC;AACzC,QAAMC,iBAAiB,GAAGL,MAAM,CAAE,IAAIM,GAAJ,EAAF,CAAhC;;AAEA,WAASC,SAAT,CAAoBC,KAApB,EAA4B;AAC3B,QAAKJ,KAAK,CAACG,SAAX,EAAuBH,KAAK,CAACG,SAAN,CAAiBC,KAAjB;;AAEvB,SAAM,MAAMC,gBAAZ,IAAgCJ,iBAAiB,CAACK,OAAlD,EAA4D;AAC3DD,MAAAA,gBAAgB,CAAED,KAAF,CAAhB;AACA;AACD;AAED;;;AACA,SACC,cAAC,QAAD;AAAU,IAAA,KAAK,EAAGH;AAAlB,KACC,0BAAUD,KAAV;AAAkB,IAAA,SAAS,EAAGG;AAA9B,IADD,CADD;AAKA;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { context } from '../context';\n\nconst { Provider } = context;\n\n/**\n * Handles callbacks added to context by `useShortcut`.\n *\n * @param {Object} props Props to pass to `div`.\n *\n * @return {import('@wordpress/element').WPElement} Component.\n */\nexport function ShortcutProvider( props ) {\n\tconst keyboardShortcuts = useRef( new Set() );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( props.onKeyDown ) props.onKeyDown( event );\n\n\t\tfor ( const keyboardShortcut of keyboardShortcuts.current ) {\n\t\t\tkeyboardShortcut( event );\n\t\t}\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<Provider value={ keyboardShortcuts }>\n\t\t\t<div { ...props } onKeyDown={ onKeyDown } />\n\t\t</Provider>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/keyboard-shortcuts",
|
3
|
-
"version": "4.12.
|
3
|
+
"version": "4.12.2",
|
4
4
|
"description": "Handling keyboard shortcuts.",
|
5
5
|
"author": "The WordPress Contributors",
|
6
6
|
"license": "GPL-2.0-or-later",
|
@@ -26,9 +26,9 @@
|
|
26
26
|
"react-native": "src/index",
|
27
27
|
"dependencies": {
|
28
28
|
"@babel/runtime": "^7.16.0",
|
29
|
-
"@wordpress/data": "^9.5.
|
30
|
-
"@wordpress/element": "^5.12.
|
31
|
-
"@wordpress/keycodes": "^3.35.
|
29
|
+
"@wordpress/data": "^9.5.2",
|
30
|
+
"@wordpress/element": "^5.12.1",
|
31
|
+
"@wordpress/keycodes": "^3.35.1",
|
32
32
|
"rememo": "^4.0.2"
|
33
33
|
},
|
34
34
|
"peerDependencies": {
|
@@ -37,5 +37,5 @@
|
|
37
37
|
"publishConfig": {
|
38
38
|
"access": "public"
|
39
39
|
},
|
40
|
-
"gitHead": "
|
40
|
+
"gitHead": "65fb4cd5187a47ca274c24c04a220bcdb2ddfa67"
|
41
41
|
}
|