@wordpress/compose 5.0.5 → 5.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/build/higher-order/with-global-events/index.js +3 -1
  2. package/build/higher-order/with-global-events/index.js.map +1 -1
  3. package/build/higher-order/with-state/index.js +2 -1
  4. package/build/higher-order/with-state/index.js.map +1 -1
  5. package/build/hooks/use-async-list/index.js +4 -3
  6. package/build/hooks/use-async-list/index.js.map +1 -1
  7. package/build/hooks/use-constrained-tabbing/index.js +2 -2
  8. package/build/hooks/use-constrained-tabbing/index.js.map +1 -1
  9. package/build/hooks/use-copy-on-click/index.js +8 -5
  10. package/build/hooks/use-copy-on-click/index.js.map +1 -1
  11. package/build/hooks/use-copy-to-clipboard/index.js +4 -3
  12. package/build/hooks/use-copy-to-clipboard/index.js.map +1 -1
  13. package/build/hooks/use-dialog/index.js +2 -2
  14. package/build/hooks/use-dialog/index.js.map +1 -1
  15. package/build/hooks/use-dragging/index.js +12 -11
  16. package/build/hooks/use-dragging/index.js.map +1 -1
  17. package/build/hooks/use-drop-zone/index.js +10 -9
  18. package/build/hooks/use-drop-zone/index.js.map +1 -1
  19. package/build/hooks/use-fixed-window-list/index.js +8 -8
  20. package/build/hooks/use-fixed-window-list/index.js.map +1 -1
  21. package/build/hooks/use-focus-on-mount/index.js +2 -1
  22. package/build/hooks/use-focus-on-mount/index.js.map +1 -1
  23. package/build/hooks/use-instance-id/index.js +2 -1
  24. package/build/hooks/use-instance-id/index.js.map +1 -1
  25. package/build/hooks/use-keyboard-shortcut/index.js +17 -15
  26. package/build/hooks/use-keyboard-shortcut/index.js.map +1 -1
  27. package/build/hooks/use-preferred-color-scheme/index.android.js +4 -3
  28. package/build/hooks/use-preferred-color-scheme/index.android.js.map +1 -1
  29. package/build/hooks/use-resize-observer/index.native.js +4 -3
  30. package/build/hooks/use-resize-observer/index.native.js.map +1 -1
  31. package/build/hooks/use-viewport-match/index.js +2 -1
  32. package/build/hooks/use-viewport-match/index.js.map +1 -1
  33. package/build/hooks/use-warn-on-change/index.js +5 -2
  34. package/build/hooks/use-warn-on-change/index.js.map +1 -1
  35. package/build/index.js +56 -56
  36. package/build/index.native.js +46 -46
  37. package/build-module/higher-order/with-global-events/index.js +3 -1
  38. package/build-module/higher-order/with-global-events/index.js.map +1 -1
  39. package/build-module/higher-order/with-state/index.js +2 -1
  40. package/build-module/higher-order/with-state/index.js.map +1 -1
  41. package/build-module/hooks/use-async-list/index.js +4 -3
  42. package/build-module/hooks/use-async-list/index.js.map +1 -1
  43. package/build-module/hooks/use-constrained-tabbing/index.js +2 -2
  44. package/build-module/hooks/use-constrained-tabbing/index.js.map +1 -1
  45. package/build-module/hooks/use-copy-on-click/index.js +8 -5
  46. package/build-module/hooks/use-copy-on-click/index.js.map +1 -1
  47. package/build-module/hooks/use-copy-to-clipboard/index.js +4 -3
  48. package/build-module/hooks/use-copy-to-clipboard/index.js.map +1 -1
  49. package/build-module/hooks/use-dialog/index.js +2 -2
  50. package/build-module/hooks/use-dialog/index.js.map +1 -1
  51. package/build-module/hooks/use-dragging/index.js +12 -11
  52. package/build-module/hooks/use-dragging/index.js.map +1 -1
  53. package/build-module/hooks/use-drop-zone/index.js +10 -9
  54. package/build-module/hooks/use-drop-zone/index.js.map +1 -1
  55. package/build-module/hooks/use-fixed-window-list/index.js +8 -8
  56. package/build-module/hooks/use-fixed-window-list/index.js.map +1 -1
  57. package/build-module/hooks/use-focus-on-mount/index.js +2 -1
  58. package/build-module/hooks/use-focus-on-mount/index.js.map +1 -1
  59. package/build-module/hooks/use-instance-id/index.js +2 -1
  60. package/build-module/hooks/use-instance-id/index.js.map +1 -1
  61. package/build-module/hooks/use-keyboard-shortcut/index.js +17 -15
  62. package/build-module/hooks/use-keyboard-shortcut/index.js.map +1 -1
  63. package/build-module/hooks/use-preferred-color-scheme/index.android.js +4 -3
  64. package/build-module/hooks/use-preferred-color-scheme/index.android.js.map +1 -1
  65. package/build-module/hooks/use-resize-observer/index.native.js +4 -3
  66. package/build-module/hooks/use-resize-observer/index.native.js.map +1 -1
  67. package/build-module/hooks/use-viewport-match/index.js +2 -1
  68. package/build-module/hooks/use-viewport-match/index.js.map +1 -1
  69. package/build-module/hooks/use-warn-on-change/index.js +5 -2
  70. package/build-module/hooks/use-warn-on-change/index.js.map +1 -1
  71. package/package.json +9 -9
@@ -41,7 +41,9 @@ var _element = require("@wordpress/element");
41
41
  *
42
42
  * @return {boolean} True if MacOS; false otherwise.
43
43
  */
44
- function isAppleOS(_window = window) {
44
+ function isAppleOS() {
45
+ let _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
46
+
45
47
  const {
46
48
  platform
47
49
  } = _window.navigator;
@@ -62,13 +64,14 @@ function isAppleOS(_window = window) {
62
64
 
63
65
  function useKeyboardShortcut(
64
66
  /* eslint-enable jsdoc/valid-types */
65
- shortcuts, callback, {
66
- bindGlobal = false,
67
- eventName = 'keydown',
68
- isDisabled = false,
69
- // This is important for performance considerations.
70
- target
71
- } = {}) {
67
+ shortcuts, callback) {
68
+ let {
69
+ bindGlobal = false,
70
+ eventName = 'keydown',
71
+ isDisabled = false,
72
+ // This is important for performance considerations.
73
+ target
74
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
72
75
  const currentCallback = (0, _element.useRef)(callback);
73
76
  (0, _element.useEffect)(() => {
74
77
  currentCallback.current = callback;
@@ -101,13 +104,12 @@ shortcuts, callback, {
101
104
 
102
105
  const bindFn = bindGlobal ? 'bindGlobal' : 'bind'; // @ts-ignore `bindGlobal` is an undocumented property
103
106
 
104
- mousetrap[bindFn](shortcut, (
105
- /* eslint-disable jsdoc/valid-types */
106
-
107
- /** @type {[e: import('mousetrap').ExtendedKeyboardEvent, combo: string]} */
108
- ...args) =>
109
- /* eslint-enable jsdoc/valid-types */
110
- currentCallback.current(...args), eventName);
107
+ mousetrap[bindFn](shortcut, function () {
108
+ return (
109
+ /* eslint-enable jsdoc/valid-types */
110
+ currentCallback.current(...arguments)
111
+ );
112
+ }, eventName);
111
113
  });
112
114
  return () => {
113
115
  mousetrap.reset();
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-keyboard-shortcut/index.js"],"names":["isAppleOS","_window","window","platform","navigator","indexOf","useKeyboardShortcut","shortcuts","callback","bindGlobal","eventName","isDisabled","target","currentCallback","current","mousetrap","Mousetrap","document","forEach","shortcut","keys","split","modifiers","Set","filter","value","length","hasAlt","has","hasShift","size","Error","bindFn","args","reset"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAT,CAAoBC,OAAO,GAAGC,MAA9B,EAAuC;AACtC,QAAM;AAAEC,IAAAA;AAAF,MAAeF,OAAO,CAACG,SAA7B;AAEA,SACCD,QAAQ,CAACE,OAAT,CAAkB,KAAlB,MAA8B,CAAC,CAA/B,IACA,sBAAU,CAAE,MAAF,EAAU,QAAV,CAAV,EAAgCF,QAAhC,CAFD;AAIA;AAED;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASG,mBAAT;AACC;AACAC,SAFD,EAGCC,QAHD,EAIC;AACCC,EAAAA,UAAU,GAAG,KADd;AAECC,EAAAA,SAAS,GAAG,SAFb;AAGCC,EAAAA,UAAU,GAAG,KAHd;AAGqB;AACpBC,EAAAA;AAJD,IAKI,EATL,EAUE;AACD,QAAMC,eAAe,GAAG,qBAAQL,QAAR,CAAxB;AACA,0BAAW,MAAM;AAChBK,IAAAA,eAAe,CAACC,OAAhB,GAA0BN,QAA1B;AACA,GAFD,EAEG,CAAEA,QAAF,CAFH;AAIA,0BAAW,MAAM;AAChB,QAAKG,UAAL,EAAkB;AACjB;AACA;;AACD,UAAMI,SAAS,GAAG,IAAIC,kBAAJ,CACjBJ,MAAM,IAAIA,MAAM,CAACE,OAAjB,GACGF,MAAM,CAACE,OADV,GAEG;AACA;AACA;;AACA;;AAAwB;AAAyBG,IAAAA,QANnC,CAAlB;AAQA,2BAAWV,SAAX,EAAuBW,OAAvB,CAAkCC,QAAF,IAAgB;AAC/C,YAAMC,IAAI,GAAGD,QAAQ,CAACE,KAAT,CAAgB,GAAhB,CAAb,CAD+C,CAE/C;AACA;AACA;;AACA,YAAMC,SAAS,GAAG,IAAIC,GAAJ,CACjBH,IAAI,CAACI,MAAL,CAAeC,KAAF,IAAaA,KAAK,CAACC,MAAN,GAAe,CAAzC,CADiB,CAAlB;AAGA,YAAMC,MAAM,GAAGL,SAAS,CAACM,GAAV,CAAe,KAAf,CAAf;AACA,YAAMC,QAAQ,GAAGP,SAAS,CAACM,GAAV,CAAe,OAAf,CAAjB,CAT+C,CAW/C;;AACA,UACC5B,SAAS,OACLsB,SAAS,CAACQ,IAAV,KAAmB,CAAnB,IAAwBH,MAA1B,IACCL,SAAS,CAACQ,IAAV,KAAmB,CAAnB,IAAwBH,MAAxB,IAAkCE,QAF5B,CADV,EAIE;AACD,cAAM,IAAIE,KAAJ,CACJ,eAAeZ,QAAU,iEADrB,CAAN;AAGA;;AAED,YAAMa,MAAM,GAAGvB,UAAU,GAAG,YAAH,GAAkB,MAA3C,CAtB+C,CAuB/C;;AACAM,MAAAA,SAAS,CAAEiB,MAAF,CAAT,CACCb,QADD,EAEC;AACC;;AACA;AAA6E,SAAGc,IAFjF;AAIC;AACApB,MAAAA,eAAe,CAACC,OAAhB,CAAyB,GAAGmB,IAA5B,CAPF,EAQCvB,SARD;AAUA,KAlCD;AAoCA,WAAO,MAAM;AACZK,MAAAA,SAAS,CAACmB,KAAV;AACA,KAFD;AAGA,GAnDD,EAmDG,CAAE3B,SAAF,EAAaE,UAAb,EAAyBC,SAAzB,EAAoCE,MAApC,EAA4CD,UAA5C,CAnDH;AAoDA;;eAEcL,mB","sourcesContent":["/**\n * External dependencies\n */\nimport Mousetrap from 'mousetrap';\nimport 'mousetrap/plugins/global-bind/mousetrap-global-bind';\nimport { includes, castArray } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * A block selection object.\n *\n * @typedef {Object} WPKeyboardShortcutConfig\n *\n * @property {boolean} [bindGlobal] Handle keyboard events anywhere including inside textarea/input fields.\n * @property {string} [eventName] Event name used to trigger the handler, defaults to keydown.\n * @property {boolean} [isDisabled] Disables the keyboard handler if the value is true.\n * @property {import('react').RefObject<HTMLElement>} [target] React reference to the DOM element used to catch the keyboard event.\n */\n\n/**\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 */\nfunction isAppleOS( _window = window ) {\n\tconst { platform } = _window.navigator;\n\n\treturn (\n\t\tplatform.indexOf( 'Mac' ) !== -1 ||\n\t\tincludes( [ 'iPad', 'iPhone' ], platform )\n\t);\n}\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Attach a keyboard shortcut handler.\n *\n * @see https://craig.is/killing/mice#api.bind for information about the `callback` parameter.\n *\n * @param {string[]|string} shortcuts Keyboard Shortcuts.\n * @param {(e: import('mousetrap').ExtendedKeyboardEvent, combo: string) => void} callback Shortcut callback.\n * @param {WPKeyboardShortcutConfig} options Shortcut options.\n */\nfunction useKeyboardShortcut(\n\t/* eslint-enable jsdoc/valid-types */\n\tshortcuts,\n\tcallback,\n\t{\n\t\tbindGlobal = false,\n\t\teventName = 'keydown',\n\t\tisDisabled = false, // This is important for performance considerations.\n\t\ttarget,\n\t} = {}\n) {\n\tconst currentCallback = useRef( callback );\n\tuseEffect( () => {\n\t\tcurrentCallback.current = callback;\n\t}, [ callback ] );\n\n\tuseEffect( () => {\n\t\tif ( isDisabled ) {\n\t\t\treturn;\n\t\t}\n\t\tconst mousetrap = new Mousetrap(\n\t\t\ttarget && target.current\n\t\t\t\t? target.current\n\t\t\t\t: // We were passing `document` here previously, so to successfully cast it to Element we must cast it first to `unknown`.\n\t\t\t\t // Not sure if this is a mistake but it was the behavior previous to the addition of types so we're just doing what's\n\t\t\t\t // necessary to maintain the existing behavior\n\t\t\t\t /** @type {Element} */ (/** @type {unknown} */ ( document ))\n\t\t);\n\t\tcastArray( shortcuts ).forEach( ( shortcut ) => {\n\t\t\tconst keys = shortcut.split( '+' );\n\t\t\t// Determines whether a key is a modifier by the length of the string.\n\t\t\t// E.g. if I add a pass a shortcut Shift+Cmd+M, it'll determine that\n\t\t\t// the modifiers are Shift and Cmd because they're not a single character.\n\t\t\tconst modifiers = new Set(\n\t\t\t\tkeys.filter( ( value ) => value.length > 1 )\n\t\t\t);\n\t\t\tconst hasAlt = modifiers.has( 'alt' );\n\t\t\tconst hasShift = modifiers.has( 'shift' );\n\n\t\t\t// This should be better moved to the shortcut registration instead.\n\t\t\tif (\n\t\t\t\tisAppleOS() &&\n\t\t\t\t( ( modifiers.size === 1 && hasAlt ) ||\n\t\t\t\t\t( modifiers.size === 2 && hasAlt && hasShift ) )\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Cannot bind ${ shortcut }. Alt and Shift+Alt modifiers are reserved for character input.`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst bindFn = bindGlobal ? 'bindGlobal' : 'bind';\n\t\t\t// @ts-ignore `bindGlobal` is an undocumented property\n\t\t\tmousetrap[ bindFn ](\n\t\t\t\tshortcut,\n\t\t\t\t(\n\t\t\t\t\t/* eslint-disable jsdoc/valid-types */\n\t\t\t\t\t/** @type {[e: import('mousetrap').ExtendedKeyboardEvent, combo: string]} */ ...args\n\t\t\t\t) =>\n\t\t\t\t\t/* eslint-enable jsdoc/valid-types */\n\t\t\t\t\tcurrentCallback.current( ...args ),\n\t\t\t\teventName\n\t\t\t);\n\t\t} );\n\n\t\treturn () => {\n\t\t\tmousetrap.reset();\n\t\t};\n\t}, [ shortcuts, bindGlobal, eventName, target, isDisabled ] );\n}\n\nexport default useKeyboardShortcut;\n"]}
1
+ {"version":3,"sources":["@wordpress/compose/src/hooks/use-keyboard-shortcut/index.js"],"names":["isAppleOS","_window","window","platform","navigator","indexOf","useKeyboardShortcut","shortcuts","callback","bindGlobal","eventName","isDisabled","target","currentCallback","current","mousetrap","Mousetrap","document","forEach","shortcut","keys","split","modifiers","Set","filter","value","length","hasAlt","has","hasShift","size","Error","bindFn","reset"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAT,GAAuC;AAAA,MAAnBC,OAAmB,uEAATC,MAAS;;AACtC,QAAM;AAAEC,IAAAA;AAAF,MAAeF,OAAO,CAACG,SAA7B;AAEA,SACCD,QAAQ,CAACE,OAAT,CAAkB,KAAlB,MAA8B,CAAC,CAA/B,IACA,sBAAU,CAAE,MAAF,EAAU,QAAV,CAAV,EAAgCF,QAAhC,CAFD;AAIA;AAED;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASG,mBAAT;AACC;AACAC,SAFD,EAGCC,QAHD,EAUE;AAAA,MAND;AACCC,IAAAA,UAAU,GAAG,KADd;AAECC,IAAAA,SAAS,GAAG,SAFb;AAGCC,IAAAA,UAAU,GAAG,KAHd;AAGqB;AACpBC,IAAAA;AAJD,GAMC,uEADG,EACH;AACD,QAAMC,eAAe,GAAG,qBAAQL,QAAR,CAAxB;AACA,0BAAW,MAAM;AAChBK,IAAAA,eAAe,CAACC,OAAhB,GAA0BN,QAA1B;AACA,GAFD,EAEG,CAAEA,QAAF,CAFH;AAIA,0BAAW,MAAM;AAChB,QAAKG,UAAL,EAAkB;AACjB;AACA;;AACD,UAAMI,SAAS,GAAG,IAAIC,kBAAJ,CACjBJ,MAAM,IAAIA,MAAM,CAACE,OAAjB,GACGF,MAAM,CAACE,OADV,GAEG;AACA;AACA;;AACA;;AAAwB;AAAyBG,IAAAA,QANnC,CAAlB;AAQA,2BAAWV,SAAX,EAAuBW,OAAvB,CAAkCC,QAAF,IAAgB;AAC/C,YAAMC,IAAI,GAAGD,QAAQ,CAACE,KAAT,CAAgB,GAAhB,CAAb,CAD+C,CAE/C;AACA;AACA;;AACA,YAAMC,SAAS,GAAG,IAAIC,GAAJ,CACjBH,IAAI,CAACI,MAAL,CAAeC,KAAF,IAAaA,KAAK,CAACC,MAAN,GAAe,CAAzC,CADiB,CAAlB;AAGA,YAAMC,MAAM,GAAGL,SAAS,CAACM,GAAV,CAAe,KAAf,CAAf;AACA,YAAMC,QAAQ,GAAGP,SAAS,CAACM,GAAV,CAAe,OAAf,CAAjB,CAT+C,CAW/C;;AACA,UACC5B,SAAS,OACLsB,SAAS,CAACQ,IAAV,KAAmB,CAAnB,IAAwBH,MAA1B,IACCL,SAAS,CAACQ,IAAV,KAAmB,CAAnB,IAAwBH,MAAxB,IAAkCE,QAF5B,CADV,EAIE;AACD,cAAM,IAAIE,KAAJ,CACJ,eAAeZ,QAAU,iEADrB,CAAN;AAGA;;AAED,YAAMa,MAAM,GAAGvB,UAAU,GAAG,YAAH,GAAkB,MAA3C,CAtB+C,CAuB/C;;AACAM,MAAAA,SAAS,CAAEiB,MAAF,CAAT,CACCb,QADD,EAEC;AAAA;AAIC;AACAN,UAAAA,eAAe,CAACC,OAAhB,CAAyB,YAAzB;AALD;AAAA,OAFD,EAQCJ,SARD;AAUA,KAlCD;AAoCA,WAAO,MAAM;AACZK,MAAAA,SAAS,CAACkB,KAAV;AACA,KAFD;AAGA,GAnDD,EAmDG,CAAE1B,SAAF,EAAaE,UAAb,EAAyBC,SAAzB,EAAoCE,MAApC,EAA4CD,UAA5C,CAnDH;AAoDA;;eAEcL,mB","sourcesContent":["/**\n * External dependencies\n */\nimport Mousetrap from 'mousetrap';\nimport 'mousetrap/plugins/global-bind/mousetrap-global-bind';\nimport { includes, castArray } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * A block selection object.\n *\n * @typedef {Object} WPKeyboardShortcutConfig\n *\n * @property {boolean} [bindGlobal] Handle keyboard events anywhere including inside textarea/input fields.\n * @property {string} [eventName] Event name used to trigger the handler, defaults to keydown.\n * @property {boolean} [isDisabled] Disables the keyboard handler if the value is true.\n * @property {import('react').RefObject<HTMLElement>} [target] React reference to the DOM element used to catch the keyboard event.\n */\n\n/**\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 */\nfunction isAppleOS( _window = window ) {\n\tconst { platform } = _window.navigator;\n\n\treturn (\n\t\tplatform.indexOf( 'Mac' ) !== -1 ||\n\t\tincludes( [ 'iPad', 'iPhone' ], platform )\n\t);\n}\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Attach a keyboard shortcut handler.\n *\n * @see https://craig.is/killing/mice#api.bind for information about the `callback` parameter.\n *\n * @param {string[]|string} shortcuts Keyboard Shortcuts.\n * @param {(e: import('mousetrap').ExtendedKeyboardEvent, combo: string) => void} callback Shortcut callback.\n * @param {WPKeyboardShortcutConfig} options Shortcut options.\n */\nfunction useKeyboardShortcut(\n\t/* eslint-enable jsdoc/valid-types */\n\tshortcuts,\n\tcallback,\n\t{\n\t\tbindGlobal = false,\n\t\teventName = 'keydown',\n\t\tisDisabled = false, // This is important for performance considerations.\n\t\ttarget,\n\t} = {}\n) {\n\tconst currentCallback = useRef( callback );\n\tuseEffect( () => {\n\t\tcurrentCallback.current = callback;\n\t}, [ callback ] );\n\n\tuseEffect( () => {\n\t\tif ( isDisabled ) {\n\t\t\treturn;\n\t\t}\n\t\tconst mousetrap = new Mousetrap(\n\t\t\ttarget && target.current\n\t\t\t\t? target.current\n\t\t\t\t: // We were passing `document` here previously, so to successfully cast it to Element we must cast it first to `unknown`.\n\t\t\t\t // Not sure if this is a mistake but it was the behavior previous to the addition of types so we're just doing what's\n\t\t\t\t // necessary to maintain the existing behavior\n\t\t\t\t /** @type {Element} */ (/** @type {unknown} */ ( document ))\n\t\t);\n\t\tcastArray( shortcuts ).forEach( ( shortcut ) => {\n\t\t\tconst keys = shortcut.split( '+' );\n\t\t\t// Determines whether a key is a modifier by the length of the string.\n\t\t\t// E.g. if I add a pass a shortcut Shift+Cmd+M, it'll determine that\n\t\t\t// the modifiers are Shift and Cmd because they're not a single character.\n\t\t\tconst modifiers = new Set(\n\t\t\t\tkeys.filter( ( value ) => value.length > 1 )\n\t\t\t);\n\t\t\tconst hasAlt = modifiers.has( 'alt' );\n\t\t\tconst hasShift = modifiers.has( 'shift' );\n\n\t\t\t// This should be better moved to the shortcut registration instead.\n\t\t\tif (\n\t\t\t\tisAppleOS() &&\n\t\t\t\t( ( modifiers.size === 1 && hasAlt ) ||\n\t\t\t\t\t( modifiers.size === 2 && hasAlt && hasShift ) )\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Cannot bind ${ shortcut }. Alt and Shift+Alt modifiers are reserved for character input.`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst bindFn = bindGlobal ? 'bindGlobal' : 'bind';\n\t\t\t// @ts-ignore `bindGlobal` is an undocumented property\n\t\t\tmousetrap[ bindFn ](\n\t\t\t\tshortcut,\n\t\t\t\t(\n\t\t\t\t\t/* eslint-disable jsdoc/valid-types */\n\t\t\t\t\t/** @type {[e: import('mousetrap').ExtendedKeyboardEvent, combo: string]} */ ...args\n\t\t\t\t) =>\n\t\t\t\t\t/* eslint-enable jsdoc/valid-types */\n\t\t\t\t\tcurrentCallback.current( ...args ),\n\t\t\t\teventName\n\t\t\t);\n\t\t} );\n\n\t\treturn () => {\n\t\t\tmousetrap.reset();\n\t\t};\n\t}, [ shortcuts, bindGlobal, eventName, target, isDisabled ] );\n}\n\nexport default useKeyboardShortcut;\n"]}
@@ -21,9 +21,10 @@ var _reactNativeBridge = require("@wordpress/react-native-bridge");
21
21
  function usePreferredColorScheme() {
22
22
  const [currentColorScheme, setCurrentColorScheme] = (0, _element.useState)(_reactNativeBridge.isInitialColorSchemeDark ? 'dark' : 'light');
23
23
  (0, _element.useEffect)(() => {
24
- (0, _reactNativeBridge.subscribePreferredColorScheme)(({
25
- isPreferredColorSchemeDark
26
- }) => {
24
+ (0, _reactNativeBridge.subscribePreferredColorScheme)(_ref => {
25
+ let {
26
+ isPreferredColorSchemeDark
27
+ } = _ref;
27
28
  const colorScheme = isPreferredColorSchemeDark ? 'dark' : 'light';
28
29
 
29
30
  if (colorScheme !== currentColorScheme) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-preferred-color-scheme/index.android.js"],"names":["usePreferredColorScheme","currentColorScheme","setCurrentColorScheme","isInitialColorSchemeDark","isPreferredColorSchemeDark","colorScheme"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA,SAASA,uBAAT,GAAmC;AAClC,QAAM,CAAEC,kBAAF,EAAsBC,qBAAtB,IAAgD,uBACrDC,8CAA2B,MAA3B,GAAoC,OADiB,CAAtD;AAGA,0BAAW,MAAM;AAChB,0DAA+B,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAsC;AACpE,YAAMC,WAAW,GAAGD,0BAA0B,GAAG,MAAH,GAAY,OAA1D;;AACA,UAAKC,WAAW,KAAKJ,kBAArB,EAA0C;AACzCC,QAAAA,qBAAqB,CAAEG,WAAF,CAArB;AACA;AACD,KALD;AAMA,GAPD;AAQA,SAAOJ,kBAAP;AACA;;eAEcD,uB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport {\n\tsubscribePreferredColorScheme,\n\tisInitialColorSchemeDark,\n} from '@wordpress/react-native-bridge';\n\n/**\n * Returns the color scheme value when it changes. Possible values: [ 'light', 'dark' ]\n *\n * @return {string} return current color scheme.\n */\nfunction usePreferredColorScheme() {\n\tconst [ currentColorScheme, setCurrentColorScheme ] = useState(\n\t\tisInitialColorSchemeDark ? 'dark' : 'light'\n\t);\n\tuseEffect( () => {\n\t\tsubscribePreferredColorScheme( ( { isPreferredColorSchemeDark } ) => {\n\t\t\tconst colorScheme = isPreferredColorSchemeDark ? 'dark' : 'light';\n\t\t\tif ( colorScheme !== currentColorScheme ) {\n\t\t\t\tsetCurrentColorScheme( colorScheme );\n\t\t\t}\n\t\t} );\n\t} );\n\treturn currentColorScheme;\n}\n\nexport default usePreferredColorScheme;\n"]}
1
+ {"version":3,"sources":["@wordpress/compose/src/hooks/use-preferred-color-scheme/index.android.js"],"names":["usePreferredColorScheme","currentColorScheme","setCurrentColorScheme","isInitialColorSchemeDark","isPreferredColorSchemeDark","colorScheme"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA,SAASA,uBAAT,GAAmC;AAClC,QAAM,CAAEC,kBAAF,EAAsBC,qBAAtB,IAAgD,uBACrDC,8CAA2B,MAA3B,GAAoC,OADiB,CAAtD;AAGA,0BAAW,MAAM;AAChB,0DAA+B,QAAsC;AAAA,UAApC;AAAEC,QAAAA;AAAF,OAAoC;AACpE,YAAMC,WAAW,GAAGD,0BAA0B,GAAG,MAAH,GAAY,OAA1D;;AACA,UAAKC,WAAW,KAAKJ,kBAArB,EAA0C;AACzCC,QAAAA,qBAAqB,CAAEG,WAAF,CAArB;AACA;AACD,KALD;AAMA,GAPD;AAQA,SAAOJ,kBAAP;AACA;;eAEcD,uB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport {\n\tsubscribePreferredColorScheme,\n\tisInitialColorSchemeDark,\n} from '@wordpress/react-native-bridge';\n\n/**\n * Returns the color scheme value when it changes. Possible values: [ 'light', 'dark' ]\n *\n * @return {string} return current color scheme.\n */\nfunction usePreferredColorScheme() {\n\tconst [ currentColorScheme, setCurrentColorScheme ] = useState(\n\t\tisInitialColorSchemeDark ? 'dark' : 'light'\n\t);\n\tuseEffect( () => {\n\t\tsubscribePreferredColorScheme( ( { isPreferredColorSchemeDark } ) => {\n\t\t\tconst colorScheme = isPreferredColorSchemeDark ? 'dark' : 'light';\n\t\t\tif ( colorScheme !== currentColorScheme ) {\n\t\t\t\tsetCurrentColorScheme( colorScheme );\n\t\t\t}\n\t\t} );\n\t} );\n\treturn currentColorScheme;\n}\n\nexport default usePreferredColorScheme;\n"]}
@@ -40,9 +40,10 @@ var _reactNative = require("react-native");
40
40
  */
41
41
  const useResizeObserver = () => {
42
42
  const [measurements, setMeasurements] = (0, _element.useState)(null);
43
- const onLayout = (0, _element.useCallback)(({
44
- nativeEvent
45
- }) => {
43
+ const onLayout = (0, _element.useCallback)(_ref => {
44
+ let {
45
+ nativeEvent
46
+ } = _ref;
46
47
  const {
47
48
  width,
48
49
  height
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-resize-observer/index.native.js"],"names":["useResizeObserver","measurements","setMeasurements","onLayout","nativeEvent","width","height","layout","prevState","Math","floor","observer","StyleSheet","absoluteFill"],"mappings":";;;;;;;AAOA;;AAJA;;AAHA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,iBAAiB,GAAG,MAAM;AAC/B,QAAM,CAAEC,YAAF,EAAgBC,eAAhB,IAAoC,uBAAU,IAAV,CAA1C;AAEA,QAAMC,QAAQ,GAAG,0BAAa,CAAE;AAAEC,IAAAA;AAAF,GAAF,KAAuB;AACpD,UAAM;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,QAAoBF,WAAW,CAACG,MAAtC;AACAL,IAAAA,eAAe,CAAIM,SAAF,IAAiB;AACjC,UACC,CAAEA,SAAF,IACAA,SAAS,CAACH,KAAV,KAAoBA,KADpB,IAEAG,SAAS,CAACF,MAAV,KAAqBA,MAHtB,EAIE;AACD,eAAO;AACND,UAAAA,KAAK,EAAEI,IAAI,CAACC,KAAL,CAAYL,KAAZ,CADD;AAENC,UAAAA,MAAM,EAAEG,IAAI,CAACC,KAAL,CAAYJ,MAAZ;AAFF,SAAP;AAIA;;AACD,aAAOE,SAAP;AACA,KAZc,CAAf;AAaA,GAfgB,EAed,EAfc,CAAjB;AAiBA,QAAMG,QAAQ,GACb,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGC,wBAAWC,YAAzB;AAAwC,IAAA,QAAQ,EAAGV;AAAnD,IADD;AAIA,SAAO,CAAEQ,QAAF,EAAYV,YAAZ,CAAP;AACA,CAzBD;;eA2BeD,iB","sourcesContent":["/**\n * External dependencies\n */\nimport { View, StyleSheet } from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { useState, useCallback } from '@wordpress/element';\n\n/**\n * Hook which allows to listen the resize event of any target element when it changes sizes.\n *\n * @return {[JSX.Element, { width: number, height: number } | null]} An array of {Element} `resizeListener` and {?Object} `sizes` with properties `width` and `height`\n *\n * @example\n *\n * ```js\n * const App = () => {\n * \tconst [ resizeListener, sizes ] = useResizeObserver();\n *\n * \treturn (\n * \t\t<View>\n * \t\t\t{ resizeListener }\n * \t\t\tYour content here\n * \t\t</View>\n * \t);\n * };\n * ```\n *\n */\nconst useResizeObserver = () => {\n\tconst [ measurements, setMeasurements ] = useState( null );\n\n\tconst onLayout = useCallback( ( { nativeEvent } ) => {\n\t\tconst { width, height } = nativeEvent.layout;\n\t\tsetMeasurements( ( prevState ) => {\n\t\t\tif (\n\t\t\t\t! prevState ||\n\t\t\t\tprevState.width !== width ||\n\t\t\t\tprevState.height !== height\n\t\t\t) {\n\t\t\t\treturn {\n\t\t\t\t\twidth: Math.floor( width ),\n\t\t\t\t\theight: Math.floor( height ),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn prevState;\n\t\t} );\n\t}, [] );\n\n\tconst observer = (\n\t\t<View style={ StyleSheet.absoluteFill } onLayout={ onLayout } />\n\t);\n\n\treturn [ observer, measurements ];\n};\n\nexport default useResizeObserver;\n"]}
1
+ {"version":3,"sources":["@wordpress/compose/src/hooks/use-resize-observer/index.native.js"],"names":["useResizeObserver","measurements","setMeasurements","onLayout","nativeEvent","width","height","layout","prevState","Math","floor","observer","StyleSheet","absoluteFill"],"mappings":";;;;;;;AAOA;;AAJA;;AAHA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,iBAAiB,GAAG,MAAM;AAC/B,QAAM,CAAEC,YAAF,EAAgBC,eAAhB,IAAoC,uBAAU,IAAV,CAA1C;AAEA,QAAMC,QAAQ,GAAG,0BAAa,QAAuB;AAAA,QAArB;AAAEC,MAAAA;AAAF,KAAqB;AACpD,UAAM;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,QAAoBF,WAAW,CAACG,MAAtC;AACAL,IAAAA,eAAe,CAAIM,SAAF,IAAiB;AACjC,UACC,CAAEA,SAAF,IACAA,SAAS,CAACH,KAAV,KAAoBA,KADpB,IAEAG,SAAS,CAACF,MAAV,KAAqBA,MAHtB,EAIE;AACD,eAAO;AACND,UAAAA,KAAK,EAAEI,IAAI,CAACC,KAAL,CAAYL,KAAZ,CADD;AAENC,UAAAA,MAAM,EAAEG,IAAI,CAACC,KAAL,CAAYJ,MAAZ;AAFF,SAAP;AAIA;;AACD,aAAOE,SAAP;AACA,KAZc,CAAf;AAaA,GAfgB,EAed,EAfc,CAAjB;AAiBA,QAAMG,QAAQ,GACb,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGC,wBAAWC,YAAzB;AAAwC,IAAA,QAAQ,EAAGV;AAAnD,IADD;AAIA,SAAO,CAAEQ,QAAF,EAAYV,YAAZ,CAAP;AACA,CAzBD;;eA2BeD,iB","sourcesContent":["/**\n * External dependencies\n */\nimport { View, StyleSheet } from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { useState, useCallback } from '@wordpress/element';\n\n/**\n * Hook which allows to listen the resize event of any target element when it changes sizes.\n *\n * @return {[JSX.Element, { width: number, height: number } | null]} An array of {Element} `resizeListener` and {?Object} `sizes` with properties `width` and `height`\n *\n * @example\n *\n * ```js\n * const App = () => {\n * \tconst [ resizeListener, sizes ] = useResizeObserver();\n *\n * \treturn (\n * \t\t<View>\n * \t\t\t{ resizeListener }\n * \t\t\tYour content here\n * \t\t</View>\n * \t);\n * };\n * ```\n *\n */\nconst useResizeObserver = () => {\n\tconst [ measurements, setMeasurements ] = useState( null );\n\n\tconst onLayout = useCallback( ( { nativeEvent } ) => {\n\t\tconst { width, height } = nativeEvent.layout;\n\t\tsetMeasurements( ( prevState ) => {\n\t\t\tif (\n\t\t\t\t! prevState ||\n\t\t\t\tprevState.width !== width ||\n\t\t\t\tprevState.height !== height\n\t\t\t) {\n\t\t\t\treturn {\n\t\t\t\t\twidth: Math.floor( width ),\n\t\t\t\t\theight: Math.floor( height ),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn prevState;\n\t\t} );\n\t}, [] );\n\n\tconst observer = (\n\t\t<View style={ StyleSheet.absoluteFill } onLayout={ onLayout } />\n\t);\n\n\treturn [ observer, measurements ];\n};\n\nexport default useResizeObserver;\n"]}
@@ -81,7 +81,8 @@ null);
81
81
  * @return {boolean} Whether viewport matches query.
82
82
  */
83
83
 
84
- const useViewportMatch = (breakpoint, operator = '>=') => {
84
+ const useViewportMatch = function (breakpoint) {
85
+ let operator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '>=';
85
86
  const simulatedWidth = (0, _element.useContext)(ViewportMatchWidthContext);
86
87
  const mediaQuery = !simulatedWidth && `(${CONDITIONS[operator]}: ${BREAKPOINTS[breakpoint]}px)`;
87
88
  const mediaQueryResult = (0, _useMediaQuery.default)(mediaQuery || undefined);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-viewport-match/index.js"],"names":["BREAKPOINTS","huge","wide","large","medium","small","mobile","CONDITIONS","OPERATOR_EVALUATORS","breakpointValue","width","ViewportMatchWidthContext","useViewportMatch","breakpoint","operator","simulatedWidth","mediaQuery","mediaQueryResult","undefined","__experimentalWidthProvider","Provider"],"mappings":";;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,WAAW,GAAG;AACnBC,EAAAA,IAAI,EAAE,IADa;AAEnBC,EAAAA,IAAI,EAAE,IAFa;AAGnBC,EAAAA,KAAK,EAAE,GAHY;AAInBC,EAAAA,MAAM,EAAE,GAJW;AAKnBC,EAAAA,KAAK,EAAE,GALY;AAMnBC,EAAAA,MAAM,EAAE;AANW,CAApB;AASA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AACA,MAAMC,UAAU,GAAG;AAClB,QAAM,WADY;AAElB,OAAK;AAFa,CAAnB;AAKA;AACA;AACA;AACA;AACA;;AACA,MAAMC,mBAAmB,GAAG;AAC3B,QAAM,CAAEC,eAAF,EAAmBC,KAAnB,KAA8BA,KAAK,IAAID,eADlB;AAE3B,OAAK,CAAEA,eAAF,EAAmBC,KAAnB,KAA8BA,KAAK,GAAGD;AAFhB,CAA5B;AAKA,MAAME,yBAAyB,GAAG;AACjC;AAA+B,IADE,CAAlC;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,gBAAgB,GAAG,CAAEC,UAAF,EAAcC,QAAQ,GAAG,IAAzB,KAAmC;AAC3D,QAAMC,cAAc,GAAG,yBAAYJ,yBAAZ,CAAvB;AACA,QAAMK,UAAU,GACf,CAAED,cAAF,IACC,IAAIR,UAAU,CAAEO,QAAF,CAAc,KAAKd,WAAW,CAAEa,UAAF,CAAgB,KAF9D;AAGA,QAAMI,gBAAgB,GAAG,4BAAeD,UAAU,IAAIE,SAA7B,CAAzB;;AACA,MAAKH,cAAL,EAAsB;AACrB,WAAOP,mBAAmB,CAAEM,QAAF,CAAnB,CACNd,WAAW,CAAEa,UAAF,CADL,EAENE,cAFM,CAAP;AAIA;;AACD,SAAOE,gBAAP;AACA,CAbD;;AAeAL,gBAAgB,CAACO,2BAAjB,GACCR,yBAAyB,CAACS,QAD3B;eAGeR,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMediaQuery from '../use-media-query';\n\n/**\n * @typedef {\"huge\" | \"wide\" | \"large\" | \"medium\" | \"small\" | \"mobile\"} WPBreakpoint\n */\n\n/**\n * Hash of breakpoint names with pixel width at which it becomes effective.\n *\n * @see _breakpoints.scss\n *\n * @type {Record<WPBreakpoint, number>}\n */\nconst BREAKPOINTS = {\n\thuge: 1440,\n\twide: 1280,\n\tlarge: 960,\n\tmedium: 782,\n\tsmall: 600,\n\tmobile: 480,\n};\n\n/**\n * @typedef {\">=\" | \"<\"} WPViewportOperator\n */\n\n/**\n * Object mapping media query operators to the condition to be used.\n *\n * @type {Record<WPViewportOperator, string>}\n */\nconst CONDITIONS = {\n\t'>=': 'min-width',\n\t'<': 'max-width',\n};\n\n/**\n * Object mapping media query operators to a function that given a breakpointValue and a width evaluates if the operator matches the values.\n *\n * @type {Record<WPViewportOperator, (breakpointValue: number, width: number) => boolean>}\n */\nconst OPERATOR_EVALUATORS = {\n\t'>=': ( breakpointValue, width ) => width >= breakpointValue,\n\t'<': ( breakpointValue, width ) => width < breakpointValue,\n};\n\nconst ViewportMatchWidthContext = createContext(\n\t/** @type {null | number} */ ( null )\n);\n\n/**\n * Returns true if the viewport matches the given query, or false otherwise.\n *\n * @param {WPBreakpoint} breakpoint Breakpoint size name.\n * @param {WPViewportOperator} [operator=\">=\"] Viewport operator.\n *\n * @example\n *\n * ```js\n * useViewportMatch( 'huge', '<' );\n * useViewportMatch( 'medium' );\n * ```\n *\n * @return {boolean} Whether viewport matches query.\n */\nconst useViewportMatch = ( breakpoint, operator = '>=' ) => {\n\tconst simulatedWidth = useContext( ViewportMatchWidthContext );\n\tconst mediaQuery =\n\t\t! simulatedWidth &&\n\t\t`(${ CONDITIONS[ operator ] }: ${ BREAKPOINTS[ breakpoint ] }px)`;\n\tconst mediaQueryResult = useMediaQuery( mediaQuery || undefined );\n\tif ( simulatedWidth ) {\n\t\treturn OPERATOR_EVALUATORS[ operator ](\n\t\t\tBREAKPOINTS[ breakpoint ],\n\t\t\tsimulatedWidth\n\t\t);\n\t}\n\treturn mediaQueryResult;\n};\n\nuseViewportMatch.__experimentalWidthProvider =\n\tViewportMatchWidthContext.Provider;\n\nexport default useViewportMatch;\n"]}
1
+ {"version":3,"sources":["@wordpress/compose/src/hooks/use-viewport-match/index.js"],"names":["BREAKPOINTS","huge","wide","large","medium","small","mobile","CONDITIONS","OPERATOR_EVALUATORS","breakpointValue","width","ViewportMatchWidthContext","useViewportMatch","breakpoint","operator","simulatedWidth","mediaQuery","mediaQueryResult","undefined","__experimentalWidthProvider","Provider"],"mappings":";;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,WAAW,GAAG;AACnBC,EAAAA,IAAI,EAAE,IADa;AAEnBC,EAAAA,IAAI,EAAE,IAFa;AAGnBC,EAAAA,KAAK,EAAE,GAHY;AAInBC,EAAAA,MAAM,EAAE,GAJW;AAKnBC,EAAAA,KAAK,EAAE,GALY;AAMnBC,EAAAA,MAAM,EAAE;AANW,CAApB;AASA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AACA,MAAMC,UAAU,GAAG;AAClB,QAAM,WADY;AAElB,OAAK;AAFa,CAAnB;AAKA;AACA;AACA;AACA;AACA;;AACA,MAAMC,mBAAmB,GAAG;AAC3B,QAAM,CAAEC,eAAF,EAAmBC,KAAnB,KAA8BA,KAAK,IAAID,eADlB;AAE3B,OAAK,CAAEA,eAAF,EAAmBC,KAAnB,KAA8BA,KAAK,GAAGD;AAFhB,CAA5B;AAKA,MAAME,yBAAyB,GAAG;AACjC;AAA+B,IADE,CAAlC;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,gBAAgB,GAAG,UAAEC,UAAF,EAAmC;AAAA,MAArBC,QAAqB,uEAAV,IAAU;AAC3D,QAAMC,cAAc,GAAG,yBAAYJ,yBAAZ,CAAvB;AACA,QAAMK,UAAU,GACf,CAAED,cAAF,IACC,IAAIR,UAAU,CAAEO,QAAF,CAAc,KAAKd,WAAW,CAAEa,UAAF,CAAgB,KAF9D;AAGA,QAAMI,gBAAgB,GAAG,4BAAeD,UAAU,IAAIE,SAA7B,CAAzB;;AACA,MAAKH,cAAL,EAAsB;AACrB,WAAOP,mBAAmB,CAAEM,QAAF,CAAnB,CACNd,WAAW,CAAEa,UAAF,CADL,EAENE,cAFM,CAAP;AAIA;;AACD,SAAOE,gBAAP;AACA,CAbD;;AAeAL,gBAAgB,CAACO,2BAAjB,GACCR,yBAAyB,CAACS,QAD3B;eAGeR,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMediaQuery from '../use-media-query';\n\n/**\n * @typedef {\"huge\" | \"wide\" | \"large\" | \"medium\" | \"small\" | \"mobile\"} WPBreakpoint\n */\n\n/**\n * Hash of breakpoint names with pixel width at which it becomes effective.\n *\n * @see _breakpoints.scss\n *\n * @type {Record<WPBreakpoint, number>}\n */\nconst BREAKPOINTS = {\n\thuge: 1440,\n\twide: 1280,\n\tlarge: 960,\n\tmedium: 782,\n\tsmall: 600,\n\tmobile: 480,\n};\n\n/**\n * @typedef {\">=\" | \"<\"} WPViewportOperator\n */\n\n/**\n * Object mapping media query operators to the condition to be used.\n *\n * @type {Record<WPViewportOperator, string>}\n */\nconst CONDITIONS = {\n\t'>=': 'min-width',\n\t'<': 'max-width',\n};\n\n/**\n * Object mapping media query operators to a function that given a breakpointValue and a width evaluates if the operator matches the values.\n *\n * @type {Record<WPViewportOperator, (breakpointValue: number, width: number) => boolean>}\n */\nconst OPERATOR_EVALUATORS = {\n\t'>=': ( breakpointValue, width ) => width >= breakpointValue,\n\t'<': ( breakpointValue, width ) => width < breakpointValue,\n};\n\nconst ViewportMatchWidthContext = createContext(\n\t/** @type {null | number} */ ( null )\n);\n\n/**\n * Returns true if the viewport matches the given query, or false otherwise.\n *\n * @param {WPBreakpoint} breakpoint Breakpoint size name.\n * @param {WPViewportOperator} [operator=\">=\"] Viewport operator.\n *\n * @example\n *\n * ```js\n * useViewportMatch( 'huge', '<' );\n * useViewportMatch( 'medium' );\n * ```\n *\n * @return {boolean} Whether viewport matches query.\n */\nconst useViewportMatch = ( breakpoint, operator = '>=' ) => {\n\tconst simulatedWidth = useContext( ViewportMatchWidthContext );\n\tconst mediaQuery =\n\t\t! simulatedWidth &&\n\t\t`(${ CONDITIONS[ operator ] }: ${ BREAKPOINTS[ breakpoint ] }px)`;\n\tconst mediaQueryResult = useMediaQuery( mediaQuery || undefined );\n\tif ( simulatedWidth ) {\n\t\treturn OPERATOR_EVALUATORS[ operator ](\n\t\t\tBREAKPOINTS[ breakpoint ],\n\t\t\tsimulatedWidth\n\t\t);\n\t}\n\treturn mediaQueryResult;\n};\n\nuseViewportMatch.__experimentalWidthProvider =\n\tViewportMatchWidthContext.Provider;\n\nexport default useViewportMatch;\n"]}
@@ -35,9 +35,12 @@ var _usePrevious = _interopRequireDefault(require("../use-previous"));
35
35
  * @param {object} object Object which changes to compare.
36
36
  * @param {string} prefix Just a prefix to show when console logging.
37
37
  */
38
- function useWarnOnChange(object, prefix = 'Change detection') {
38
+ function useWarnOnChange(object) {
39
+ let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Change detection';
39
40
  const previousValues = (0, _usePrevious.default)(object);
40
- Object.entries(previousValues !== null && previousValues !== void 0 ? previousValues : []).forEach(([key, value]) => {
41
+ Object.entries(previousValues !== null && previousValues !== void 0 ? previousValues : []).forEach(_ref => {
42
+ let [key, value] = _ref;
43
+
41
44
  if (value !== object[
42
45
  /** @type {keyof typeof object} */
43
46
  key]) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-warn-on-change/index.js"],"names":["useWarnOnChange","object","prefix","previousValues","Object","entries","forEach","key","value","console","warn"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA;AACA;;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAT,CAA0BC,MAA1B,EAAkCC,MAAM,GAAG,kBAA3C,EAAgE;AAC/D,QAAMC,cAAc,GAAG,0BAAaF,MAAb,CAAvB;AAEAG,EAAAA,MAAM,CAACC,OAAP,CAAgBF,cAAhB,aAAgBA,cAAhB,cAAgBA,cAAhB,GAAkC,EAAlC,EAAuCG,OAAvC,CAAgD,CAAE,CAAEC,GAAF,EAAOC,KAAP,CAAF,KAAsB;AACrE,QAAKA,KAAK,KAAKP,MAAM;AAAE;AAAqCM,IAAAA,GAAvC,CAArB,EAAsE;AACrE;AACAE,MAAAA,OAAO,CAACC,IAAR,CACE,GAAGR,MAAQ,KAAKK,GAAK,eADvB,EAECC,KAFD,EAGCP,MAAM;AAAE;AAAqCM,MAAAA,GAAvC;AACN;AAJD;AAMA;AACD,GAVD;AAWA;;eAEcP,e","sourcesContent":["/**\n * Internal dependencies\n */\nimport usePrevious from '../use-previous';\n\n// Disable reason: Object and object are distinctly different types in TypeScript and we mean the lowercase object in thise case\n// but eslint wants to force us to use `Object`. See https://stackoverflow.com/questions/49464634/difference-between-object-and-object-in-typescript\n/* eslint-disable jsdoc/check-types */\n/**\n * Hook that performs a shallow comparison between the preview value of an object\n * and the new one, if there's a difference, it prints it to the console.\n * this is useful in performance related work, to check why a component re-renders.\n *\n * @example\n *\n * ```jsx\n * function MyComponent(props) {\n * useWarnOnChange(props);\n *\n * return \"Something\";\n * }\n * ```\n *\n * @param {object} object Object which changes to compare.\n * @param {string} prefix Just a prefix to show when console logging.\n */\nfunction useWarnOnChange( object, prefix = 'Change detection' ) {\n\tconst previousValues = usePrevious( object );\n\n\tObject.entries( previousValues ?? [] ).forEach( ( [ key, value ] ) => {\n\t\tif ( value !== object[ /** @type {keyof typeof object} */ ( key ) ] ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(\n\t\t\t\t`${ prefix }: ${ key } key changed:`,\n\t\t\t\tvalue,\n\t\t\t\tobject[ /** @type {keyof typeof object} */ ( key ) ]\n\t\t\t\t/* eslint-enable jsdoc/check-types */\n\t\t\t);\n\t\t}\n\t} );\n}\n\nexport default useWarnOnChange;\n"]}
1
+ {"version":3,"sources":["@wordpress/compose/src/hooks/use-warn-on-change/index.js"],"names":["useWarnOnChange","object","prefix","previousValues","Object","entries","forEach","key","value","console","warn"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA;AACA;;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAT,CAA0BC,MAA1B,EAAgE;AAAA,MAA9BC,MAA8B,uEAArB,kBAAqB;AAC/D,QAAMC,cAAc,GAAG,0BAAaF,MAAb,CAAvB;AAEAG,EAAAA,MAAM,CAACC,OAAP,CAAgBF,cAAhB,aAAgBA,cAAhB,cAAgBA,cAAhB,GAAkC,EAAlC,EAAuCG,OAAvC,CAAgD,QAAsB;AAAA,QAApB,CAAEC,GAAF,EAAOC,KAAP,CAAoB;;AACrE,QAAKA,KAAK,KAAKP,MAAM;AAAE;AAAqCM,IAAAA,GAAvC,CAArB,EAAsE;AACrE;AACAE,MAAAA,OAAO,CAACC,IAAR,CACE,GAAGR,MAAQ,KAAKK,GAAK,eADvB,EAECC,KAFD,EAGCP,MAAM;AAAE;AAAqCM,MAAAA,GAAvC;AACN;AAJD;AAMA;AACD,GAVD;AAWA;;eAEcP,e","sourcesContent":["/**\n * Internal dependencies\n */\nimport usePrevious from '../use-previous';\n\n// Disable reason: Object and object are distinctly different types in TypeScript and we mean the lowercase object in thise case\n// but eslint wants to force us to use `Object`. See https://stackoverflow.com/questions/49464634/difference-between-object-and-object-in-typescript\n/* eslint-disable jsdoc/check-types */\n/**\n * Hook that performs a shallow comparison between the preview value of an object\n * and the new one, if there's a difference, it prints it to the console.\n * this is useful in performance related work, to check why a component re-renders.\n *\n * @example\n *\n * ```jsx\n * function MyComponent(props) {\n * useWarnOnChange(props);\n *\n * return \"Something\";\n * }\n * ```\n *\n * @param {object} object Object which changes to compare.\n * @param {string} prefix Just a prefix to show when console logging.\n */\nfunction useWarnOnChange( object, prefix = 'Change detection' ) {\n\tconst previousValues = usePrevious( object );\n\n\tObject.entries( previousValues ?? [] ).forEach( ( [ key, value ] ) => {\n\t\tif ( value !== object[ /** @type {keyof typeof object} */ ( key ) ] ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(\n\t\t\t\t`${ prefix }: ${ key } key changed:`,\n\t\t\t\tvalue,\n\t\t\t\tobject[ /** @type {keyof typeof object} */ ( key ) ]\n\t\t\t\t/* eslint-enable jsdoc/check-types */\n\t\t\t);\n\t\t}\n\t} );\n}\n\nexport default useWarnOnChange;\n"]}
package/build/index.js CHANGED
@@ -5,52 +5,64 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- Object.defineProperty(exports, "createHigherOrderComponent", {
8
+ Object.defineProperty(exports, "__experimentalUseDialog", {
9
9
  enumerable: true,
10
10
  get: function () {
11
- return _createHigherOrderComponent.default;
11
+ return _useDialog.default;
12
12
  }
13
13
  });
14
- Object.defineProperty(exports, "compose", {
14
+ Object.defineProperty(exports, "__experimentalUseDragging", {
15
15
  enumerable: true,
16
16
  get: function () {
17
- return _compose.default;
17
+ return _useDragging.default;
18
18
  }
19
19
  });
20
- Object.defineProperty(exports, "ifCondition", {
20
+ Object.defineProperty(exports, "__experimentalUseDropZone", {
21
21
  enumerable: true,
22
22
  get: function () {
23
- return _ifCondition.default;
23
+ return _useDropZone.default;
24
24
  }
25
25
  });
26
- Object.defineProperty(exports, "pure", {
26
+ Object.defineProperty(exports, "__experimentalUseFixedWindowList", {
27
27
  enumerable: true,
28
28
  get: function () {
29
- return _pure.default;
29
+ return _useFixedWindowList.default;
30
30
  }
31
31
  });
32
- Object.defineProperty(exports, "withGlobalEvents", {
32
+ Object.defineProperty(exports, "__experimentalUseFocusOutside", {
33
33
  enumerable: true,
34
34
  get: function () {
35
- return _withGlobalEvents.default;
35
+ return _useFocusOutside.default;
36
36
  }
37
37
  });
38
- Object.defineProperty(exports, "withInstanceId", {
38
+ Object.defineProperty(exports, "compose", {
39
39
  enumerable: true,
40
40
  get: function () {
41
- return _withInstanceId.default;
41
+ return _compose.default;
42
42
  }
43
43
  });
44
- Object.defineProperty(exports, "withSafeTimeout", {
44
+ Object.defineProperty(exports, "createHigherOrderComponent", {
45
45
  enumerable: true,
46
46
  get: function () {
47
- return _withSafeTimeout.default;
47
+ return _createHigherOrderComponent.default;
48
48
  }
49
49
  });
50
- Object.defineProperty(exports, "withState", {
50
+ Object.defineProperty(exports, "ifCondition", {
51
51
  enumerable: true,
52
52
  get: function () {
53
- return _withState.default;
53
+ return _ifCondition.default;
54
+ }
55
+ });
56
+ Object.defineProperty(exports, "pure", {
57
+ enumerable: true,
58
+ get: function () {
59
+ return _pure.default;
60
+ }
61
+ });
62
+ Object.defineProperty(exports, "useAsyncList", {
63
+ enumerable: true,
64
+ get: function () {
65
+ return _useAsyncList.default;
54
66
  }
55
67
  });
56
68
  Object.defineProperty(exports, "useConstrainedTabbing", {
@@ -71,16 +83,10 @@ Object.defineProperty(exports, "useCopyToClipboard", {
71
83
  return _useCopyToClipboard.default;
72
84
  }
73
85
  });
74
- Object.defineProperty(exports, "__experimentalUseDialog", {
75
- enumerable: true,
76
- get: function () {
77
- return _useDialog.default;
78
- }
79
- });
80
- Object.defineProperty(exports, "__experimentalUseDragging", {
86
+ Object.defineProperty(exports, "useDebounce", {
81
87
  enumerable: true,
82
88
  get: function () {
83
- return _useDragging.default;
89
+ return _useDebounce.default;
84
90
  }
85
91
  });
86
92
  Object.defineProperty(exports, "useFocusOnMount", {
@@ -89,16 +95,16 @@ Object.defineProperty(exports, "useFocusOnMount", {
89
95
  return _useFocusOnMount.default;
90
96
  }
91
97
  });
92
- Object.defineProperty(exports, "__experimentalUseFocusOutside", {
98
+ Object.defineProperty(exports, "useFocusReturn", {
93
99
  enumerable: true,
94
100
  get: function () {
95
- return _useFocusOutside.default;
101
+ return _useFocusReturn.default;
96
102
  }
97
103
  });
98
- Object.defineProperty(exports, "useFocusReturn", {
104
+ Object.defineProperty(exports, "useFocusableIframe", {
99
105
  enumerable: true,
100
106
  get: function () {
101
- return _useFocusReturn.default;
107
+ return _useFocusableIframe.default;
102
108
  }
103
109
  });
104
110
  Object.defineProperty(exports, "useInstanceId", {
@@ -125,6 +131,12 @@ Object.defineProperty(exports, "useMediaQuery", {
125
131
  return _useMediaQuery.default;
126
132
  }
127
133
  });
134
+ Object.defineProperty(exports, "useMergeRefs", {
135
+ enumerable: true,
136
+ get: function () {
137
+ return _useMergeRefs.default;
138
+ }
139
+ });
128
140
  Object.defineProperty(exports, "usePrevious", {
129
141
  enumerable: true,
130
142
  get: function () {
@@ -137,10 +149,10 @@ Object.defineProperty(exports, "useReducedMotion", {
137
149
  return _useReducedMotion.default;
138
150
  }
139
151
  });
140
- Object.defineProperty(exports, "useViewportMatch", {
152
+ Object.defineProperty(exports, "useRefEffect", {
141
153
  enumerable: true,
142
154
  get: function () {
143
- return _useViewportMatch.default;
155
+ return _useRefEffect.default;
144
156
  }
145
157
  });
146
158
  Object.defineProperty(exports, "useResizeObserver", {
@@ -149,58 +161,46 @@ Object.defineProperty(exports, "useResizeObserver", {
149
161
  return _useResizeObserver.default;
150
162
  }
151
163
  });
152
- Object.defineProperty(exports, "useAsyncList", {
153
- enumerable: true,
154
- get: function () {
155
- return _useAsyncList.default;
156
- }
157
- });
158
- Object.defineProperty(exports, "useWarnOnChange", {
159
- enumerable: true,
160
- get: function () {
161
- return _useWarnOnChange.default;
162
- }
163
- });
164
- Object.defineProperty(exports, "useDebounce", {
164
+ Object.defineProperty(exports, "useThrottle", {
165
165
  enumerable: true,
166
166
  get: function () {
167
- return _useDebounce.default;
167
+ return _useThrottle.default;
168
168
  }
169
169
  });
170
- Object.defineProperty(exports, "useThrottle", {
170
+ Object.defineProperty(exports, "useViewportMatch", {
171
171
  enumerable: true,
172
172
  get: function () {
173
- return _useThrottle.default;
173
+ return _useViewportMatch.default;
174
174
  }
175
175
  });
176
- Object.defineProperty(exports, "useMergeRefs", {
176
+ Object.defineProperty(exports, "useWarnOnChange", {
177
177
  enumerable: true,
178
178
  get: function () {
179
- return _useMergeRefs.default;
179
+ return _useWarnOnChange.default;
180
180
  }
181
181
  });
182
- Object.defineProperty(exports, "useRefEffect", {
182
+ Object.defineProperty(exports, "withGlobalEvents", {
183
183
  enumerable: true,
184
184
  get: function () {
185
- return _useRefEffect.default;
185
+ return _withGlobalEvents.default;
186
186
  }
187
187
  });
188
- Object.defineProperty(exports, "__experimentalUseDropZone", {
188
+ Object.defineProperty(exports, "withInstanceId", {
189
189
  enumerable: true,
190
190
  get: function () {
191
- return _useDropZone.default;
191
+ return _withInstanceId.default;
192
192
  }
193
193
  });
194
- Object.defineProperty(exports, "useFocusableIframe", {
194
+ Object.defineProperty(exports, "withSafeTimeout", {
195
195
  enumerable: true,
196
196
  get: function () {
197
- return _useFocusableIframe.default;
197
+ return _withSafeTimeout.default;
198
198
  }
199
199
  });
200
- Object.defineProperty(exports, "__experimentalUseFixedWindowList", {
200
+ Object.defineProperty(exports, "withState", {
201
201
  enumerable: true,
202
202
  get: function () {
203
- return _useFixedWindowList.default;
203
+ return _withState.default;
204
204
  }
205
205
  });
206
206
 
@@ -5,100 +5,100 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- Object.defineProperty(exports, "createHigherOrderComponent", {
8
+ Object.defineProperty(exports, "__experimentalUseDragging", {
9
9
  enumerable: true,
10
10
  get: function () {
11
- return _createHigherOrderComponent.default;
11
+ return _useDragging.default;
12
12
  }
13
13
  });
14
- Object.defineProperty(exports, "compose", {
14
+ Object.defineProperty(exports, "__experimentalUseFocusOutside", {
15
15
  enumerable: true,
16
16
  get: function () {
17
- return _compose.default;
17
+ return _useFocusOutside.default;
18
18
  }
19
19
  });
20
- Object.defineProperty(exports, "ifCondition", {
20
+ Object.defineProperty(exports, "compose", {
21
21
  enumerable: true,
22
22
  get: function () {
23
- return _ifCondition.default;
23
+ return _compose.default;
24
24
  }
25
25
  });
26
- Object.defineProperty(exports, "pure", {
26
+ Object.defineProperty(exports, "createHigherOrderComponent", {
27
27
  enumerable: true,
28
28
  get: function () {
29
- return _pure.default;
29
+ return _createHigherOrderComponent.default;
30
30
  }
31
31
  });
32
- Object.defineProperty(exports, "withGlobalEvents", {
32
+ Object.defineProperty(exports, "ifCondition", {
33
33
  enumerable: true,
34
34
  get: function () {
35
- return _withGlobalEvents.default;
35
+ return _ifCondition.default;
36
36
  }
37
37
  });
38
- Object.defineProperty(exports, "withInstanceId", {
38
+ Object.defineProperty(exports, "pure", {
39
39
  enumerable: true,
40
40
  get: function () {
41
- return _withInstanceId.default;
41
+ return _pure.default;
42
42
  }
43
43
  });
44
- Object.defineProperty(exports, "withSafeTimeout", {
44
+ Object.defineProperty(exports, "useAsyncList", {
45
45
  enumerable: true,
46
46
  get: function () {
47
- return _withSafeTimeout.default;
47
+ return _useAsyncList.default;
48
48
  }
49
49
  });
50
- Object.defineProperty(exports, "withState", {
50
+ Object.defineProperty(exports, "useConstrainedTabbing", {
51
51
  enumerable: true,
52
52
  get: function () {
53
- return _withState.default;
53
+ return _useConstrainedTabbing.default;
54
54
  }
55
55
  });
56
- Object.defineProperty(exports, "withPreferredColorScheme", {
56
+ Object.defineProperty(exports, "useDebounce", {
57
57
  enumerable: true,
58
58
  get: function () {
59
- return _withPreferredColorScheme.default;
59
+ return _useDebounce.default;
60
60
  }
61
61
  });
62
- Object.defineProperty(exports, "useConstrainedTabbing", {
62
+ Object.defineProperty(exports, "useInstanceId", {
63
63
  enumerable: true,
64
64
  get: function () {
65
- return _useConstrainedTabbing.default;
65
+ return _useInstanceId.default;
66
66
  }
67
67
  });
68
- Object.defineProperty(exports, "__experimentalUseDragging", {
68
+ Object.defineProperty(exports, "useIsomorphicLayoutEffect", {
69
69
  enumerable: true,
70
70
  get: function () {
71
- return _useDragging.default;
71
+ return _useIsomorphicLayoutEffect.default;
72
72
  }
73
73
  });
74
- Object.defineProperty(exports, "__experimentalUseFocusOutside", {
74
+ Object.defineProperty(exports, "useKeyboardShortcut", {
75
75
  enumerable: true,
76
76
  get: function () {
77
- return _useFocusOutside.default;
77
+ return _useKeyboardShortcut.default;
78
78
  }
79
79
  });
80
- Object.defineProperty(exports, "useInstanceId", {
80
+ Object.defineProperty(exports, "useMediaQuery", {
81
81
  enumerable: true,
82
82
  get: function () {
83
- return _useInstanceId.default;
83
+ return _useMediaQuery.default;
84
84
  }
85
85
  });
86
- Object.defineProperty(exports, "useIsomorphicLayoutEffect", {
86
+ Object.defineProperty(exports, "useMergeRefs", {
87
87
  enumerable: true,
88
88
  get: function () {
89
- return _useIsomorphicLayoutEffect.default;
89
+ return _useMergeRefs.default;
90
90
  }
91
91
  });
92
- Object.defineProperty(exports, "useKeyboardShortcut", {
92
+ Object.defineProperty(exports, "usePreferredColorScheme", {
93
93
  enumerable: true,
94
94
  get: function () {
95
- return _useKeyboardShortcut.default;
95
+ return _usePreferredColorScheme.default;
96
96
  }
97
97
  });
98
- Object.defineProperty(exports, "useMediaQuery", {
98
+ Object.defineProperty(exports, "usePreferredColorSchemeStyle", {
99
99
  enumerable: true,
100
100
  get: function () {
101
- return _useMediaQuery.default;
101
+ return _usePreferredColorSchemeStyle.default;
102
102
  }
103
103
  });
104
104
  Object.defineProperty(exports, "usePrevious", {
@@ -113,46 +113,46 @@ Object.defineProperty(exports, "useReducedMotion", {
113
113
  return _useReducedMotion.default;
114
114
  }
115
115
  });
116
- Object.defineProperty(exports, "useViewportMatch", {
116
+ Object.defineProperty(exports, "useResizeObserver", {
117
117
  enumerable: true,
118
118
  get: function () {
119
- return _useViewportMatch.default;
119
+ return _useResizeObserver.default;
120
120
  }
121
121
  });
122
- Object.defineProperty(exports, "useAsyncList", {
122
+ Object.defineProperty(exports, "useViewportMatch", {
123
123
  enumerable: true,
124
124
  get: function () {
125
- return _useAsyncList.default;
125
+ return _useViewportMatch.default;
126
126
  }
127
127
  });
128
- Object.defineProperty(exports, "usePreferredColorScheme", {
128
+ Object.defineProperty(exports, "withGlobalEvents", {
129
129
  enumerable: true,
130
130
  get: function () {
131
- return _usePreferredColorScheme.default;
131
+ return _withGlobalEvents.default;
132
132
  }
133
133
  });
134
- Object.defineProperty(exports, "usePreferredColorSchemeStyle", {
134
+ Object.defineProperty(exports, "withInstanceId", {
135
135
  enumerable: true,
136
136
  get: function () {
137
- return _usePreferredColorSchemeStyle.default;
137
+ return _withInstanceId.default;
138
138
  }
139
139
  });
140
- Object.defineProperty(exports, "useResizeObserver", {
140
+ Object.defineProperty(exports, "withPreferredColorScheme", {
141
141
  enumerable: true,
142
142
  get: function () {
143
- return _useResizeObserver.default;
143
+ return _withPreferredColorScheme.default;
144
144
  }
145
145
  });
146
- Object.defineProperty(exports, "useDebounce", {
146
+ Object.defineProperty(exports, "withSafeTimeout", {
147
147
  enumerable: true,
148
148
  get: function () {
149
- return _useDebounce.default;
149
+ return _withSafeTimeout.default;
150
150
  }
151
151
  });
152
- Object.defineProperty(exports, "useMergeRefs", {
152
+ Object.defineProperty(exports, "withState", {
153
153
  enumerable: true,
154
154
  get: function () {
155
- return _useMergeRefs.default;
155
+ return _withState.default;
156
156
  }
157
157
  });
158
158
 
@@ -76,7 +76,9 @@ export default function withGlobalEvents(eventTypesToHandlers) {
76
76
  event) {
77
77
  const handler = eventTypesToHandlers[
78
78
  /** @type {keyof GlobalEventHandlersEventMap} */
79
- event.type];
79
+ event.type
80
+ /* eslint-enable jsdoc/no-undefined-types */
81
+ ];
80
82
 
81
83
  if (typeof this.wrappedRef[handler] === 'function') {
82
84
  this.wrappedRef[handler](event);