@wordpress/compose 5.19.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 6.0.0 (2022-12-14)
6
+
7
+ ### Breaking Changes
8
+
9
+ - Updated dependencies to require React 18 ([45235](https://github.com/WordPress/gutenberg/pull/45235))
10
+
11
+ ## 5.20.0 (2022-11-16)
12
+
5
13
  ## 5.19.0 (2022-11-02)
6
14
 
7
15
  ### Internal
@@ -46,9 +46,6 @@ function useConstrainedTabbing() {
46
46
  return (0, _useRefEffect.default)((
47
47
  /** @type {HTMLElement} */
48
48
  node) => {
49
- /** @type {number|undefined} */
50
- let timeoutId;
51
-
52
49
  function onKeyDown(
53
50
  /** @type {KeyboardEvent} */
54
51
  event) {
@@ -80,16 +77,15 @@ function useConstrainedTabbing() {
80
77
  } = node;
81
78
  const trap = ownerDocument.createElement('div');
82
79
  trap.tabIndex = -1;
83
- node[domAction](trap);
84
- trap.focus(); // Remove after the browser moves focus to the next element.
80
+ node[domAction](trap); // Remove itself when the trap loses focus.
85
81
 
86
- timeoutId = setTimeout(() => node.removeChild(trap));
82
+ trap.addEventListener('blur', () => node.removeChild(trap));
83
+ trap.focus();
87
84
  }
88
85
 
89
86
  node.addEventListener('keydown', onKeyDown);
90
87
  return () => {
91
88
  node.removeEventListener('keydown', onKeyDown);
92
- clearTimeout(timeoutId);
93
89
  };
94
90
  }, []);
95
91
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-constrained-tabbing/index.js"],"names":["useConstrainedTabbing","node","timeoutId","onKeyDown","event","keyCode","shiftKey","target","TAB","action","nextElement","focus","tabbable","contains","domAction","ownerDocument","trap","createElement","tabIndex","setTimeout","removeChild","addEventListener","removeEventListener","clearTimeout"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;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,qBAAT,GAAiC;AAChC,SAAO,2BAAc;AAAE;AAA2BC,EAAAA,IAA7B,KAAuC;AAC3D;AACA,QAAIC,SAAJ;;AAEA,aAASC,SAAT;AAAoB;AAA6BC,IAAAA,KAAjD,EAAyD;AACxD,YAAM;AAAEC,QAAAA,OAAF;AAAWC,QAAAA,QAAX;AAAqBC,QAAAA;AAArB,UAAgCH,KAAtC;;AAEA,UAAKC,OAAO,KAAKG,aAAjB,EAAuB;AACtB;AACA;;AAED,YAAMC,MAAM,GAAGH,QAAQ,GAAG,cAAH,GAAoB,UAA3C;AACA,YAAMI,WAAW,GAChBC,WAAMC,QAAN,CAAgBH,MAAhB;AACC;AAA6BF,MAAAA,MAD9B,KAEK,IAHN,CARwD,CAaxD;AACA;AACA;AACA;;AACA,UAAKN,IAAI,CAACY,QAAL,CAAeH,WAAf,CAAL,EAAoC;AACnC;AACA;;AAED,YAAMI,SAAS,GAAGR,QAAQ,GAAG,QAAH,GAAc,SAAxC;AACA,YAAM;AAAES,QAAAA;AAAF,UAAoBd,IAA1B;AACA,YAAMe,IAAI,GAAGD,aAAa,CAACE,aAAd,CAA6B,KAA7B,CAAb;AAEAD,MAAAA,IAAI,CAACE,QAAL,GAAgB,CAAC,CAAjB;AACAjB,MAAAA,IAAI,CAAEa,SAAF,CAAJ,CAAmBE,IAAnB;AACAA,MAAAA,IAAI,CAACL,KAAL,GA3BwD,CA4BxD;;AACAT,MAAAA,SAAS,GAAGiB,UAAU,CAAE,MAAMlB,IAAI,CAACmB,WAAL,CAAkBJ,IAAlB,CAAR,CAAtB;AACA;;AAEDf,IAAAA,IAAI,CAACoB,gBAAL,CAAuB,SAAvB,EAAkClB,SAAlC;AACA,WAAO,MAAM;AACZF,MAAAA,IAAI,CAACqB,mBAAL,CAA0B,SAA1B,EAAqCnB,SAArC;AACAoB,MAAAA,YAAY,CAAErB,SAAF,CAAZ;AACA,KAHD;AAIA,GAzCM,EAyCJ,EAzCI,CAAP;AA0CA;;eAEcF,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { TAB } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport useRefEffect from '../use-ref-effect';\n\n/**\n * In Dialogs/modals, the tabbing must be constrained to the content of\n * the wrapper element. This hook adds the behavior to the returned ref.\n *\n * @return {import('react').RefCallback<Element>} Element Ref.\n *\n * @example\n * ```js\n * import { useConstrainedTabbing } from '@wordpress/compose';\n *\n * const ConstrainedTabbingExample = () => {\n * const constrainedTabbingRef = useConstrainedTabbing()\n * return (\n * <div ref={ constrainedTabbingRef }>\n * <Button />\n * <Button />\n * </div>\n * );\n * }\n * ```\n */\nfunction useConstrainedTabbing() {\n\treturn useRefEffect( ( /** @type {HTMLElement} */ node ) => {\n\t\t/** @type {number|undefined} */\n\t\tlet timeoutId;\n\n\t\tfunction onKeyDown( /** @type {KeyboardEvent} */ event ) {\n\t\t\tconst { keyCode, shiftKey, target } = event;\n\n\t\t\tif ( keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst action = shiftKey ? 'findPrevious' : 'findNext';\n\t\t\tconst nextElement =\n\t\t\t\tfocus.tabbable[ action ](\n\t\t\t\t\t/** @type {HTMLElement} */ ( target )\n\t\t\t\t) || null;\n\n\t\t\t// If the element that is about to receive focus is outside the\n\t\t\t// area, move focus to a div and insert it at the start or end of\n\t\t\t// the area, depending on the direction. Without preventing default\n\t\t\t// behaviour, the browser will then move focus to the next element.\n\t\t\tif ( node.contains( nextElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst domAction = shiftKey ? 'append' : 'prepend';\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst trap = ownerDocument.createElement( 'div' );\n\n\t\t\ttrap.tabIndex = -1;\n\t\t\tnode[ domAction ]( trap );\n\t\t\ttrap.focus();\n\t\t\t// Remove after the browser moves focus to the next element.\n\t\t\ttimeoutId = setTimeout( () => node.removeChild( trap ) );\n\t\t}\n\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tclearTimeout( timeoutId );\n\t\t};\n\t}, [] );\n}\n\nexport default useConstrainedTabbing;\n"]}
1
+ {"version":3,"sources":["@wordpress/compose/src/hooks/use-constrained-tabbing/index.js"],"names":["useConstrainedTabbing","node","onKeyDown","event","keyCode","shiftKey","target","TAB","action","nextElement","focus","tabbable","contains","domAction","ownerDocument","trap","createElement","tabIndex","addEventListener","removeChild","removeEventListener"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;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,qBAAT,GAAiC;AAChC,SAAO,2BAAc;AAAE;AAA2BC,EAAAA,IAA7B,KAAuC;AAC3D,aAASC,SAAT;AAAoB;AAA6BC,IAAAA,KAAjD,EAAyD;AACxD,YAAM;AAAEC,QAAAA,OAAF;AAAWC,QAAAA,QAAX;AAAqBC,QAAAA;AAArB,UAAgCH,KAAtC;;AAEA,UAAKC,OAAO,KAAKG,aAAjB,EAAuB;AACtB;AACA;;AAED,YAAMC,MAAM,GAAGH,QAAQ,GAAG,cAAH,GAAoB,UAA3C;AACA,YAAMI,WAAW,GAChBC,WAAMC,QAAN,CAAgBH,MAAhB;AACC;AAA6BF,MAAAA,MAD9B,KAEK,IAHN,CARwD,CAaxD;AACA;AACA;AACA;;AACA,UAAKL,IAAI,CAACW,QAAL,CAAeH,WAAf,CAAL,EAAoC;AACnC;AACA;;AAED,YAAMI,SAAS,GAAGR,QAAQ,GAAG,QAAH,GAAc,SAAxC;AACA,YAAM;AAAES,QAAAA;AAAF,UAAoBb,IAA1B;AACA,YAAMc,IAAI,GAAGD,aAAa,CAACE,aAAd,CAA6B,KAA7B,CAAb;AAEAD,MAAAA,IAAI,CAACE,QAAL,GAAgB,CAAC,CAAjB;AACAhB,MAAAA,IAAI,CAAEY,SAAF,CAAJ,CAAmBE,IAAnB,EA1BwD,CA4BxD;;AACAA,MAAAA,IAAI,CAACG,gBAAL,CAAuB,MAAvB,EAA+B,MAAMjB,IAAI,CAACkB,WAAL,CAAkBJ,IAAlB,CAArC;AAEAA,MAAAA,IAAI,CAACL,KAAL;AACA;;AAEDT,IAAAA,IAAI,CAACiB,gBAAL,CAAuB,SAAvB,EAAkChB,SAAlC;AACA,WAAO,MAAM;AACZD,MAAAA,IAAI,CAACmB,mBAAL,CAA0B,SAA1B,EAAqClB,SAArC;AACA,KAFD;AAGA,GAvCM,EAuCJ,EAvCI,CAAP;AAwCA;;eAEcF,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { TAB } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport useRefEffect from '../use-ref-effect';\n\n/**\n * In Dialogs/modals, the tabbing must be constrained to the content of\n * the wrapper element. This hook adds the behavior to the returned ref.\n *\n * @return {import('react').RefCallback<Element>} Element Ref.\n *\n * @example\n * ```js\n * import { useConstrainedTabbing } from '@wordpress/compose';\n *\n * const ConstrainedTabbingExample = () => {\n * const constrainedTabbingRef = useConstrainedTabbing()\n * return (\n * <div ref={ constrainedTabbingRef }>\n * <Button />\n * <Button />\n * </div>\n * );\n * }\n * ```\n */\nfunction useConstrainedTabbing() {\n\treturn useRefEffect( ( /** @type {HTMLElement} */ node ) => {\n\t\tfunction onKeyDown( /** @type {KeyboardEvent} */ event ) {\n\t\t\tconst { keyCode, shiftKey, target } = event;\n\n\t\t\tif ( keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst action = shiftKey ? 'findPrevious' : 'findNext';\n\t\t\tconst nextElement =\n\t\t\t\tfocus.tabbable[ action ](\n\t\t\t\t\t/** @type {HTMLElement} */ ( target )\n\t\t\t\t) || null;\n\n\t\t\t// If the element that is about to receive focus is outside the\n\t\t\t// area, move focus to a div and insert it at the start or end of\n\t\t\t// the area, depending on the direction. Without preventing default\n\t\t\t// behaviour, the browser will then move focus to the next element.\n\t\t\tif ( node.contains( nextElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst domAction = shiftKey ? 'append' : 'prepend';\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst trap = ownerDocument.createElement( 'div' );\n\n\t\t\ttrap.tabIndex = -1;\n\t\t\tnode[ domAction ]( trap );\n\n\t\t\t// Remove itself when the trap loses focus.\n\t\t\ttrap.addEventListener( 'blur', () => node.removeChild( trap ) );\n\n\t\t\ttrap.focus();\n\t\t}\n\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n\nexport default useConstrainedTabbing;\n"]}
@@ -120,12 +120,27 @@ function useFocusOutside(onFocusOutside) {
120
120
  */
121
121
 
122
122
  const queueBlurCheck = (0, _element.useCallback)(event => {
123
+ var _event$relatedTarget;
124
+
123
125
  // React does not allow using an event reference asynchronously
124
126
  // due to recycling behavior, except when explicitly persisted.
125
127
  event.persist(); // Skip blur check if clicking button. See `normalizeButtonFocus`.
126
128
 
127
129
  if (preventBlurCheck.current) {
128
130
  return;
131
+ } // The usage of this attribute should be avoided. The only use case
132
+ // would be when we load modals that are not React components and
133
+ // therefore don't exist in the React tree. An example is opening
134
+ // the Media Library modal from another dialog.
135
+ // This attribute should contain a selector of the related target
136
+ // we want to ignore, because we still need to trigger the blur event
137
+ // on all other cases.
138
+
139
+
140
+ const ignoreForRelatedTarget = event.target.getAttribute('data-unstable-ignore-focus-outside-for-relatedtarget');
141
+
142
+ if (ignoreForRelatedTarget && (_event$relatedTarget = event.relatedTarget) !== null && _event$relatedTarget !== void 0 && _event$relatedTarget.closest(ignoreForRelatedTarget)) {
143
+ return;
129
144
  }
130
145
 
131
146
  blurCheckTimeoutId.current = setTimeout(() => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-focus-outside/index.ts"],"names":["INPUT_BUTTON_TYPES","isFocusNormalizedButton","eventTarget","window","HTMLElement","nodeName","includes","type","useFocusOutside","onFocusOutside","currentOnFocusOutside","current","preventBlurCheck","blurCheckTimeoutId","cancelBlurCheck","clearTimeout","normalizeButtonFocus","event","target","isInteractionEnd","queueBlurCheck","persist","setTimeout","document","hasFocus","preventDefault","onFocus","onMouseDown","onMouseUp","onTouchStart","onTouchEnd","onBlur"],"mappings":"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","sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tFocusEventHandler,\n\tEventHandler,\n\tMouseEventHandler,\n\tTouchEventHandler,\n\tFocusEvent,\n\tMouseEvent,\n\tTouchEvent,\n} from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Input types which are classified as button types, for use in considering\n * whether element is a (focus-normalized) button.\n */\nconst INPUT_BUTTON_TYPES = [ 'button', 'submit' ];\n\n/**\n * List of HTML button elements subject to focus normalization\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n */\ntype FocusNormalizedButton =\n\t| HTMLButtonElement\n\t| HTMLLinkElement\n\t| HTMLInputElement;\n\n/**\n * Returns true if the given element is a button element subject to focus\n * normalization, or false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n *\n * @param eventTarget The target from a mouse or touch event.\n *\n * @return Whether the element is a button element subject to focus normalization.\n */\nfunction isFocusNormalizedButton(\n\teventTarget: EventTarget\n): eventTarget is FocusNormalizedButton {\n\tif ( ! ( eventTarget instanceof window.HTMLElement ) ) {\n\t\treturn false;\n\t}\n\tswitch ( eventTarget.nodeName ) {\n\t\tcase 'A':\n\t\tcase 'BUTTON':\n\t\t\treturn true;\n\n\t\tcase 'INPUT':\n\t\t\treturn INPUT_BUTTON_TYPES.includes(\n\t\t\t\t( eventTarget as HTMLInputElement ).type\n\t\t\t);\n\t}\n\n\treturn false;\n}\n\ntype UseFocusOutsideReturn = {\n\tonFocus: FocusEventHandler;\n\tonMouseDown: MouseEventHandler;\n\tonMouseUp: MouseEventHandler;\n\tonTouchStart: TouchEventHandler;\n\tonTouchEnd: TouchEventHandler;\n\tonBlur: FocusEventHandler;\n};\n\n/**\n * A react hook that can be used to check whether focus has moved outside the\n * element the event handlers are bound to.\n *\n * @param onFocusOutside A callback triggered when focus moves outside\n * the element the event handlers are bound to.\n *\n * @return An object containing event handlers. Bind the event handlers to a\n * wrapping element element to capture when focus moves outside that element.\n */\nexport default function useFocusOutside(\n\tonFocusOutside: ( event: FocusEvent ) => void\n): UseFocusOutsideReturn {\n\tconst currentOnFocusOutside = useRef( onFocusOutside );\n\tuseEffect( () => {\n\t\tcurrentOnFocusOutside.current = onFocusOutside;\n\t}, [ onFocusOutside ] );\n\n\tconst preventBlurCheck = useRef( false );\n\n\tconst blurCheckTimeoutId = useRef< number | undefined >();\n\n\t/**\n\t * Cancel a blur check timeout.\n\t */\n\tconst cancelBlurCheck = useCallback( () => {\n\t\tclearTimeout( blurCheckTimeoutId.current );\n\t}, [] );\n\n\t// Cancel blur checks on unmount.\n\tuseEffect( () => {\n\t\treturn () => cancelBlurCheck();\n\t}, [] );\n\n\t// Cancel a blur check if the callback or ref is no longer provided.\n\tuseEffect( () => {\n\t\tif ( ! onFocusOutside ) {\n\t\t\tcancelBlurCheck();\n\t\t}\n\t}, [ onFocusOutside, cancelBlurCheck ] );\n\n\t/**\n\t * Handles a mousedown or mouseup event to respectively assign and\n\t * unassign a flag for preventing blur check on button elements. Some\n\t * browsers, namely Firefox and Safari, do not emit a focus event on\n\t * button elements when clicked, while others do. The logic here\n\t * intends to normalize this as treating click on buttons as focus.\n\t *\n\t * @param event\n\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\t */\n\tconst normalizeButtonFocus: EventHandler< MouseEvent | TouchEvent > =\n\t\tuseCallback( ( event ) => {\n\t\t\tconst { type, target } = event;\n\t\t\tconst isInteractionEnd = [ 'mouseup', 'touchend' ].includes( type );\n\n\t\t\tif ( isInteractionEnd ) {\n\t\t\t\tpreventBlurCheck.current = false;\n\t\t\t} else if ( isFocusNormalizedButton( target ) ) {\n\t\t\t\tpreventBlurCheck.current = true;\n\t\t\t}\n\t\t}, [] );\n\n\t/**\n\t * A callback triggered when a blur event occurs on the element the handler\n\t * is bound to.\n\t *\n\t * Calls the `onFocusOutside` callback in an immediate timeout if focus has\n\t * move outside the bound element and is still within the document.\n\t */\n\tconst queueBlurCheck: FocusEventHandler = useCallback( ( event ) => {\n\t\t// React does not allow using an event reference asynchronously\n\t\t// due to recycling behavior, except when explicitly persisted.\n\t\tevent.persist();\n\n\t\t// Skip blur check if clicking button. See `normalizeButtonFocus`.\n\t\tif ( preventBlurCheck.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tblurCheckTimeoutId.current = setTimeout( () => {\n\t\t\t// If document is not focused then focus should remain\n\t\t\t// inside the wrapped component and therefore we cancel\n\t\t\t// this blur event thereby leaving focus in place.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Document/hasFocus.\n\t\t\tif ( ! document.hasFocus() ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( 'function' === typeof currentOnFocusOutside.current ) {\n\t\t\t\tcurrentOnFocusOutside.current( event );\n\t\t\t}\n\t\t}, 0 );\n\t}, [] );\n\n\treturn {\n\t\tonFocus: cancelBlurCheck,\n\t\tonMouseDown: normalizeButtonFocus,\n\t\tonMouseUp: normalizeButtonFocus,\n\t\tonTouchStart: normalizeButtonFocus,\n\t\tonTouchEnd: normalizeButtonFocus,\n\t\tonBlur: queueBlurCheck,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/compose/src/hooks/use-focus-outside/index.ts"],"names":["INPUT_BUTTON_TYPES","isFocusNormalizedButton","eventTarget","window","HTMLElement","nodeName","includes","type","useFocusOutside","onFocusOutside","currentOnFocusOutside","current","preventBlurCheck","blurCheckTimeoutId","cancelBlurCheck","clearTimeout","normalizeButtonFocus","event","target","isInteractionEnd","queueBlurCheck","persist","ignoreForRelatedTarget","getAttribute","relatedTarget","closest","setTimeout","document","hasFocus","preventDefault","onFocus","onMouseDown","onMouseUp","onTouchStart","onTouchEnd","onBlur"],"mappings":"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","sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tFocusEventHandler,\n\tEventHandler,\n\tMouseEventHandler,\n\tTouchEventHandler,\n\tFocusEvent,\n\tMouseEvent,\n\tTouchEvent,\n} from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Input types which are classified as button types, for use in considering\n * whether element is a (focus-normalized) button.\n */\nconst INPUT_BUTTON_TYPES = [ 'button', 'submit' ];\n\n/**\n * List of HTML button elements subject to focus normalization\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n */\ntype FocusNormalizedButton =\n\t| HTMLButtonElement\n\t| HTMLLinkElement\n\t| HTMLInputElement;\n\n/**\n * Returns true if the given element is a button element subject to focus\n * normalization, or false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n *\n * @param eventTarget The target from a mouse or touch event.\n *\n * @return Whether the element is a button element subject to focus normalization.\n */\nfunction isFocusNormalizedButton(\n\teventTarget: EventTarget\n): eventTarget is FocusNormalizedButton {\n\tif ( ! ( eventTarget instanceof window.HTMLElement ) ) {\n\t\treturn false;\n\t}\n\tswitch ( eventTarget.nodeName ) {\n\t\tcase 'A':\n\t\tcase 'BUTTON':\n\t\t\treturn true;\n\n\t\tcase 'INPUT':\n\t\t\treturn INPUT_BUTTON_TYPES.includes(\n\t\t\t\t( eventTarget as HTMLInputElement ).type\n\t\t\t);\n\t}\n\n\treturn false;\n}\n\ntype UseFocusOutsideReturn = {\n\tonFocus: FocusEventHandler;\n\tonMouseDown: MouseEventHandler;\n\tonMouseUp: MouseEventHandler;\n\tonTouchStart: TouchEventHandler;\n\tonTouchEnd: TouchEventHandler;\n\tonBlur: FocusEventHandler;\n};\n\n/**\n * A react hook that can be used to check whether focus has moved outside the\n * element the event handlers are bound to.\n *\n * @param onFocusOutside A callback triggered when focus moves outside\n * the element the event handlers are bound to.\n *\n * @return An object containing event handlers. Bind the event handlers to a\n * wrapping element element to capture when focus moves outside that element.\n */\nexport default function useFocusOutside(\n\tonFocusOutside: ( event: FocusEvent ) => void\n): UseFocusOutsideReturn {\n\tconst currentOnFocusOutside = useRef( onFocusOutside );\n\tuseEffect( () => {\n\t\tcurrentOnFocusOutside.current = onFocusOutside;\n\t}, [ onFocusOutside ] );\n\n\tconst preventBlurCheck = useRef( false );\n\n\tconst blurCheckTimeoutId = useRef< number | undefined >();\n\n\t/**\n\t * Cancel a blur check timeout.\n\t */\n\tconst cancelBlurCheck = useCallback( () => {\n\t\tclearTimeout( blurCheckTimeoutId.current );\n\t}, [] );\n\n\t// Cancel blur checks on unmount.\n\tuseEffect( () => {\n\t\treturn () => cancelBlurCheck();\n\t}, [] );\n\n\t// Cancel a blur check if the callback or ref is no longer provided.\n\tuseEffect( () => {\n\t\tif ( ! onFocusOutside ) {\n\t\t\tcancelBlurCheck();\n\t\t}\n\t}, [ onFocusOutside, cancelBlurCheck ] );\n\n\t/**\n\t * Handles a mousedown or mouseup event to respectively assign and\n\t * unassign a flag for preventing blur check on button elements. Some\n\t * browsers, namely Firefox and Safari, do not emit a focus event on\n\t * button elements when clicked, while others do. The logic here\n\t * intends to normalize this as treating click on buttons as focus.\n\t *\n\t * @param event\n\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\t */\n\tconst normalizeButtonFocus: EventHandler< MouseEvent | TouchEvent > =\n\t\tuseCallback( ( event ) => {\n\t\t\tconst { type, target } = event;\n\t\t\tconst isInteractionEnd = [ 'mouseup', 'touchend' ].includes( type );\n\n\t\t\tif ( isInteractionEnd ) {\n\t\t\t\tpreventBlurCheck.current = false;\n\t\t\t} else if ( isFocusNormalizedButton( target ) ) {\n\t\t\t\tpreventBlurCheck.current = true;\n\t\t\t}\n\t\t}, [] );\n\n\t/**\n\t * A callback triggered when a blur event occurs on the element the handler\n\t * is bound to.\n\t *\n\t * Calls the `onFocusOutside` callback in an immediate timeout if focus has\n\t * move outside the bound element and is still within the document.\n\t */\n\tconst queueBlurCheck: FocusEventHandler = useCallback( ( event ) => {\n\t\t// React does not allow using an event reference asynchronously\n\t\t// due to recycling behavior, except when explicitly persisted.\n\t\tevent.persist();\n\n\t\t// Skip blur check if clicking button. See `normalizeButtonFocus`.\n\t\tif ( preventBlurCheck.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// The usage of this attribute should be avoided. The only use case\n\t\t// would be when we load modals that are not React components and\n\t\t// therefore don't exist in the React tree. An example is opening\n\t\t// the Media Library modal from another dialog.\n\t\t// This attribute should contain a selector of the related target\n\t\t// we want to ignore, because we still need to trigger the blur event\n\t\t// on all other cases.\n\t\tconst ignoreForRelatedTarget = event.target.getAttribute(\n\t\t\t'data-unstable-ignore-focus-outside-for-relatedtarget'\n\t\t);\n\t\tif (\n\t\t\tignoreForRelatedTarget &&\n\t\t\tevent.relatedTarget?.closest( ignoreForRelatedTarget )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tblurCheckTimeoutId.current = setTimeout( () => {\n\t\t\t// If document is not focused then focus should remain\n\t\t\t// inside the wrapped component and therefore we cancel\n\t\t\t// this blur event thereby leaving focus in place.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Document/hasFocus.\n\t\t\tif ( ! document.hasFocus() ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( 'function' === typeof currentOnFocusOutside.current ) {\n\t\t\t\tcurrentOnFocusOutside.current( event );\n\t\t\t}\n\t\t}, 0 );\n\t}, [] );\n\n\treturn {\n\t\tonFocus: cancelBlurCheck,\n\t\tonMouseDown: normalizeButtonFocus,\n\t\tonMouseUp: normalizeButtonFocus,\n\t\tonTouchStart: normalizeButtonFocus,\n\t\tonTouchEnd: normalizeButtonFocus,\n\t\tonBlur: queueBlurCheck,\n\t};\n}\n"]}
@@ -34,9 +34,6 @@ function useConstrainedTabbing() {
34
34
  return useRefEffect((
35
35
  /** @type {HTMLElement} */
36
36
  node) => {
37
- /** @type {number|undefined} */
38
- let timeoutId;
39
-
40
37
  function onKeyDown(
41
38
  /** @type {KeyboardEvent} */
42
39
  event) {
@@ -68,16 +65,15 @@ function useConstrainedTabbing() {
68
65
  } = node;
69
66
  const trap = ownerDocument.createElement('div');
70
67
  trap.tabIndex = -1;
71
- node[domAction](trap);
72
- trap.focus(); // Remove after the browser moves focus to the next element.
68
+ node[domAction](trap); // Remove itself when the trap loses focus.
73
69
 
74
- timeoutId = setTimeout(() => node.removeChild(trap));
70
+ trap.addEventListener('blur', () => node.removeChild(trap));
71
+ trap.focus();
75
72
  }
76
73
 
77
74
  node.addEventListener('keydown', onKeyDown);
78
75
  return () => {
79
76
  node.removeEventListener('keydown', onKeyDown);
80
- clearTimeout(timeoutId);
81
77
  };
82
78
  }, []);
83
79
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-constrained-tabbing/index.js"],"names":["TAB","focus","useRefEffect","useConstrainedTabbing","node","timeoutId","onKeyDown","event","keyCode","shiftKey","target","action","nextElement","tabbable","contains","domAction","ownerDocument","trap","createElement","tabIndex","setTimeout","removeChild","addEventListener","removeEventListener","clearTimeout"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,qBAApB;AACA,SAASC,KAAT,QAAsB,gBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,mBAAzB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,qBAAT,GAAiC;AAChC,SAAOD,YAAY,CAAE;AAAE;AAA2BE,EAAAA,IAA7B,KAAuC;AAC3D;AACA,QAAIC,SAAJ;;AAEA,aAASC,SAAT;AAAoB;AAA6BC,IAAAA,KAAjD,EAAyD;AACxD,YAAM;AAAEC,QAAAA,OAAF;AAAWC,QAAAA,QAAX;AAAqBC,QAAAA;AAArB,UAAgCH,KAAtC;;AAEA,UAAKC,OAAO,KAAKR,GAAjB,EAAuB;AACtB;AACA;;AAED,YAAMW,MAAM,GAAGF,QAAQ,GAAG,cAAH,GAAoB,UAA3C;AACA,YAAMG,WAAW,GAChBX,KAAK,CAACY,QAAN,CAAgBF,MAAhB;AACC;AAA6BD,MAAAA,MAD9B,KAEK,IAHN,CARwD,CAaxD;AACA;AACA;AACA;;AACA,UAAKN,IAAI,CAACU,QAAL,CAAeF,WAAf,CAAL,EAAoC;AACnC;AACA;;AAED,YAAMG,SAAS,GAAGN,QAAQ,GAAG,QAAH,GAAc,SAAxC;AACA,YAAM;AAAEO,QAAAA;AAAF,UAAoBZ,IAA1B;AACA,YAAMa,IAAI,GAAGD,aAAa,CAACE,aAAd,CAA6B,KAA7B,CAAb;AAEAD,MAAAA,IAAI,CAACE,QAAL,GAAgB,CAAC,CAAjB;AACAf,MAAAA,IAAI,CAAEW,SAAF,CAAJ,CAAmBE,IAAnB;AACAA,MAAAA,IAAI,CAAChB,KAAL,GA3BwD,CA4BxD;;AACAI,MAAAA,SAAS,GAAGe,UAAU,CAAE,MAAMhB,IAAI,CAACiB,WAAL,CAAkBJ,IAAlB,CAAR,CAAtB;AACA;;AAEDb,IAAAA,IAAI,CAACkB,gBAAL,CAAuB,SAAvB,EAAkChB,SAAlC;AACA,WAAO,MAAM;AACZF,MAAAA,IAAI,CAACmB,mBAAL,CAA0B,SAA1B,EAAqCjB,SAArC;AACAkB,MAAAA,YAAY,CAAEnB,SAAF,CAAZ;AACA,KAHD;AAIA,GAzCkB,EAyChB,EAzCgB,CAAnB;AA0CA;;AAED,eAAeF,qBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { TAB } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport useRefEffect from '../use-ref-effect';\n\n/**\n * In Dialogs/modals, the tabbing must be constrained to the content of\n * the wrapper element. This hook adds the behavior to the returned ref.\n *\n * @return {import('react').RefCallback<Element>} Element Ref.\n *\n * @example\n * ```js\n * import { useConstrainedTabbing } from '@wordpress/compose';\n *\n * const ConstrainedTabbingExample = () => {\n * const constrainedTabbingRef = useConstrainedTabbing()\n * return (\n * <div ref={ constrainedTabbingRef }>\n * <Button />\n * <Button />\n * </div>\n * );\n * }\n * ```\n */\nfunction useConstrainedTabbing() {\n\treturn useRefEffect( ( /** @type {HTMLElement} */ node ) => {\n\t\t/** @type {number|undefined} */\n\t\tlet timeoutId;\n\n\t\tfunction onKeyDown( /** @type {KeyboardEvent} */ event ) {\n\t\t\tconst { keyCode, shiftKey, target } = event;\n\n\t\t\tif ( keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst action = shiftKey ? 'findPrevious' : 'findNext';\n\t\t\tconst nextElement =\n\t\t\t\tfocus.tabbable[ action ](\n\t\t\t\t\t/** @type {HTMLElement} */ ( target )\n\t\t\t\t) || null;\n\n\t\t\t// If the element that is about to receive focus is outside the\n\t\t\t// area, move focus to a div and insert it at the start or end of\n\t\t\t// the area, depending on the direction. Without preventing default\n\t\t\t// behaviour, the browser will then move focus to the next element.\n\t\t\tif ( node.contains( nextElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst domAction = shiftKey ? 'append' : 'prepend';\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst trap = ownerDocument.createElement( 'div' );\n\n\t\t\ttrap.tabIndex = -1;\n\t\t\tnode[ domAction ]( trap );\n\t\t\ttrap.focus();\n\t\t\t// Remove after the browser moves focus to the next element.\n\t\t\ttimeoutId = setTimeout( () => node.removeChild( trap ) );\n\t\t}\n\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tclearTimeout( timeoutId );\n\t\t};\n\t}, [] );\n}\n\nexport default useConstrainedTabbing;\n"]}
1
+ {"version":3,"sources":["@wordpress/compose/src/hooks/use-constrained-tabbing/index.js"],"names":["TAB","focus","useRefEffect","useConstrainedTabbing","node","onKeyDown","event","keyCode","shiftKey","target","action","nextElement","tabbable","contains","domAction","ownerDocument","trap","createElement","tabIndex","addEventListener","removeChild","removeEventListener"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,qBAApB;AACA,SAASC,KAAT,QAAsB,gBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,mBAAzB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,qBAAT,GAAiC;AAChC,SAAOD,YAAY,CAAE;AAAE;AAA2BE,EAAAA,IAA7B,KAAuC;AAC3D,aAASC,SAAT;AAAoB;AAA6BC,IAAAA,KAAjD,EAAyD;AACxD,YAAM;AAAEC,QAAAA,OAAF;AAAWC,QAAAA,QAAX;AAAqBC,QAAAA;AAArB,UAAgCH,KAAtC;;AAEA,UAAKC,OAAO,KAAKP,GAAjB,EAAuB;AACtB;AACA;;AAED,YAAMU,MAAM,GAAGF,QAAQ,GAAG,cAAH,GAAoB,UAA3C;AACA,YAAMG,WAAW,GAChBV,KAAK,CAACW,QAAN,CAAgBF,MAAhB;AACC;AAA6BD,MAAAA,MAD9B,KAEK,IAHN,CARwD,CAaxD;AACA;AACA;AACA;;AACA,UAAKL,IAAI,CAACS,QAAL,CAAeF,WAAf,CAAL,EAAoC;AACnC;AACA;;AAED,YAAMG,SAAS,GAAGN,QAAQ,GAAG,QAAH,GAAc,SAAxC;AACA,YAAM;AAAEO,QAAAA;AAAF,UAAoBX,IAA1B;AACA,YAAMY,IAAI,GAAGD,aAAa,CAACE,aAAd,CAA6B,KAA7B,CAAb;AAEAD,MAAAA,IAAI,CAACE,QAAL,GAAgB,CAAC,CAAjB;AACAd,MAAAA,IAAI,CAAEU,SAAF,CAAJ,CAAmBE,IAAnB,EA1BwD,CA4BxD;;AACAA,MAAAA,IAAI,CAACG,gBAAL,CAAuB,MAAvB,EAA+B,MAAMf,IAAI,CAACgB,WAAL,CAAkBJ,IAAlB,CAArC;AAEAA,MAAAA,IAAI,CAACf,KAAL;AACA;;AAEDG,IAAAA,IAAI,CAACe,gBAAL,CAAuB,SAAvB,EAAkCd,SAAlC;AACA,WAAO,MAAM;AACZD,MAAAA,IAAI,CAACiB,mBAAL,CAA0B,SAA1B,EAAqChB,SAArC;AACA,KAFD;AAGA,GAvCkB,EAuChB,EAvCgB,CAAnB;AAwCA;;AAED,eAAeF,qBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { TAB } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport useRefEffect from '../use-ref-effect';\n\n/**\n * In Dialogs/modals, the tabbing must be constrained to the content of\n * the wrapper element. This hook adds the behavior to the returned ref.\n *\n * @return {import('react').RefCallback<Element>} Element Ref.\n *\n * @example\n * ```js\n * import { useConstrainedTabbing } from '@wordpress/compose';\n *\n * const ConstrainedTabbingExample = () => {\n * const constrainedTabbingRef = useConstrainedTabbing()\n * return (\n * <div ref={ constrainedTabbingRef }>\n * <Button />\n * <Button />\n * </div>\n * );\n * }\n * ```\n */\nfunction useConstrainedTabbing() {\n\treturn useRefEffect( ( /** @type {HTMLElement} */ node ) => {\n\t\tfunction onKeyDown( /** @type {KeyboardEvent} */ event ) {\n\t\t\tconst { keyCode, shiftKey, target } = event;\n\n\t\t\tif ( keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst action = shiftKey ? 'findPrevious' : 'findNext';\n\t\t\tconst nextElement =\n\t\t\t\tfocus.tabbable[ action ](\n\t\t\t\t\t/** @type {HTMLElement} */ ( target )\n\t\t\t\t) || null;\n\n\t\t\t// If the element that is about to receive focus is outside the\n\t\t\t// area, move focus to a div and insert it at the start or end of\n\t\t\t// the area, depending on the direction. Without preventing default\n\t\t\t// behaviour, the browser will then move focus to the next element.\n\t\t\tif ( node.contains( nextElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst domAction = shiftKey ? 'append' : 'prepend';\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst trap = ownerDocument.createElement( 'div' );\n\n\t\t\ttrap.tabIndex = -1;\n\t\t\tnode[ domAction ]( trap );\n\n\t\t\t// Remove itself when the trap loses focus.\n\t\t\ttrap.addEventListener( 'blur', () => node.removeChild( trap ) );\n\n\t\t\ttrap.focus();\n\t\t}\n\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n\nexport default useConstrainedTabbing;\n"]}
@@ -112,12 +112,27 @@ export default function useFocusOutside(onFocusOutside) {
112
112
  */
113
113
 
114
114
  const queueBlurCheck = useCallback(event => {
115
+ var _event$relatedTarget;
116
+
115
117
  // React does not allow using an event reference asynchronously
116
118
  // due to recycling behavior, except when explicitly persisted.
117
119
  event.persist(); // Skip blur check if clicking button. See `normalizeButtonFocus`.
118
120
 
119
121
  if (preventBlurCheck.current) {
120
122
  return;
123
+ } // The usage of this attribute should be avoided. The only use case
124
+ // would be when we load modals that are not React components and
125
+ // therefore don't exist in the React tree. An example is opening
126
+ // the Media Library modal from another dialog.
127
+ // This attribute should contain a selector of the related target
128
+ // we want to ignore, because we still need to trigger the blur event
129
+ // on all other cases.
130
+
131
+
132
+ const ignoreForRelatedTarget = event.target.getAttribute('data-unstable-ignore-focus-outside-for-relatedtarget');
133
+
134
+ if (ignoreForRelatedTarget && (_event$relatedTarget = event.relatedTarget) !== null && _event$relatedTarget !== void 0 && _event$relatedTarget.closest(ignoreForRelatedTarget)) {
135
+ return;
121
136
  }
122
137
 
123
138
  blurCheckTimeoutId.current = setTimeout(() => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-focus-outside/index.ts"],"names":["useCallback","useEffect","useRef","INPUT_BUTTON_TYPES","isFocusNormalizedButton","eventTarget","window","HTMLElement","nodeName","includes","type","useFocusOutside","onFocusOutside","currentOnFocusOutside","current","preventBlurCheck","blurCheckTimeoutId","cancelBlurCheck","clearTimeout","normalizeButtonFocus","event","target","isInteractionEnd","queueBlurCheck","persist","setTimeout","document","hasFocus","preventDefault","onFocus","onMouseDown","onMouseUp","onTouchStart","onTouchEnd","onBlur"],"mappings":"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","sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tFocusEventHandler,\n\tEventHandler,\n\tMouseEventHandler,\n\tTouchEventHandler,\n\tFocusEvent,\n\tMouseEvent,\n\tTouchEvent,\n} from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Input types which are classified as button types, for use in considering\n * whether element is a (focus-normalized) button.\n */\nconst INPUT_BUTTON_TYPES = [ 'button', 'submit' ];\n\n/**\n * List of HTML button elements subject to focus normalization\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n */\ntype FocusNormalizedButton =\n\t| HTMLButtonElement\n\t| HTMLLinkElement\n\t| HTMLInputElement;\n\n/**\n * Returns true if the given element is a button element subject to focus\n * normalization, or false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n *\n * @param eventTarget The target from a mouse or touch event.\n *\n * @return Whether the element is a button element subject to focus normalization.\n */\nfunction isFocusNormalizedButton(\n\teventTarget: EventTarget\n): eventTarget is FocusNormalizedButton {\n\tif ( ! ( eventTarget instanceof window.HTMLElement ) ) {\n\t\treturn false;\n\t}\n\tswitch ( eventTarget.nodeName ) {\n\t\tcase 'A':\n\t\tcase 'BUTTON':\n\t\t\treturn true;\n\n\t\tcase 'INPUT':\n\t\t\treturn INPUT_BUTTON_TYPES.includes(\n\t\t\t\t( eventTarget as HTMLInputElement ).type\n\t\t\t);\n\t}\n\n\treturn false;\n}\n\ntype UseFocusOutsideReturn = {\n\tonFocus: FocusEventHandler;\n\tonMouseDown: MouseEventHandler;\n\tonMouseUp: MouseEventHandler;\n\tonTouchStart: TouchEventHandler;\n\tonTouchEnd: TouchEventHandler;\n\tonBlur: FocusEventHandler;\n};\n\n/**\n * A react hook that can be used to check whether focus has moved outside the\n * element the event handlers are bound to.\n *\n * @param onFocusOutside A callback triggered when focus moves outside\n * the element the event handlers are bound to.\n *\n * @return An object containing event handlers. Bind the event handlers to a\n * wrapping element element to capture when focus moves outside that element.\n */\nexport default function useFocusOutside(\n\tonFocusOutside: ( event: FocusEvent ) => void\n): UseFocusOutsideReturn {\n\tconst currentOnFocusOutside = useRef( onFocusOutside );\n\tuseEffect( () => {\n\t\tcurrentOnFocusOutside.current = onFocusOutside;\n\t}, [ onFocusOutside ] );\n\n\tconst preventBlurCheck = useRef( false );\n\n\tconst blurCheckTimeoutId = useRef< number | undefined >();\n\n\t/**\n\t * Cancel a blur check timeout.\n\t */\n\tconst cancelBlurCheck = useCallback( () => {\n\t\tclearTimeout( blurCheckTimeoutId.current );\n\t}, [] );\n\n\t// Cancel blur checks on unmount.\n\tuseEffect( () => {\n\t\treturn () => cancelBlurCheck();\n\t}, [] );\n\n\t// Cancel a blur check if the callback or ref is no longer provided.\n\tuseEffect( () => {\n\t\tif ( ! onFocusOutside ) {\n\t\t\tcancelBlurCheck();\n\t\t}\n\t}, [ onFocusOutside, cancelBlurCheck ] );\n\n\t/**\n\t * Handles a mousedown or mouseup event to respectively assign and\n\t * unassign a flag for preventing blur check on button elements. Some\n\t * browsers, namely Firefox and Safari, do not emit a focus event on\n\t * button elements when clicked, while others do. The logic here\n\t * intends to normalize this as treating click on buttons as focus.\n\t *\n\t * @param event\n\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\t */\n\tconst normalizeButtonFocus: EventHandler< MouseEvent | TouchEvent > =\n\t\tuseCallback( ( event ) => {\n\t\t\tconst { type, target } = event;\n\t\t\tconst isInteractionEnd = [ 'mouseup', 'touchend' ].includes( type );\n\n\t\t\tif ( isInteractionEnd ) {\n\t\t\t\tpreventBlurCheck.current = false;\n\t\t\t} else if ( isFocusNormalizedButton( target ) ) {\n\t\t\t\tpreventBlurCheck.current = true;\n\t\t\t}\n\t\t}, [] );\n\n\t/**\n\t * A callback triggered when a blur event occurs on the element the handler\n\t * is bound to.\n\t *\n\t * Calls the `onFocusOutside` callback in an immediate timeout if focus has\n\t * move outside the bound element and is still within the document.\n\t */\n\tconst queueBlurCheck: FocusEventHandler = useCallback( ( event ) => {\n\t\t// React does not allow using an event reference asynchronously\n\t\t// due to recycling behavior, except when explicitly persisted.\n\t\tevent.persist();\n\n\t\t// Skip blur check if clicking button. See `normalizeButtonFocus`.\n\t\tif ( preventBlurCheck.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tblurCheckTimeoutId.current = setTimeout( () => {\n\t\t\t// If document is not focused then focus should remain\n\t\t\t// inside the wrapped component and therefore we cancel\n\t\t\t// this blur event thereby leaving focus in place.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Document/hasFocus.\n\t\t\tif ( ! document.hasFocus() ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( 'function' === typeof currentOnFocusOutside.current ) {\n\t\t\t\tcurrentOnFocusOutside.current( event );\n\t\t\t}\n\t\t}, 0 );\n\t}, [] );\n\n\treturn {\n\t\tonFocus: cancelBlurCheck,\n\t\tonMouseDown: normalizeButtonFocus,\n\t\tonMouseUp: normalizeButtonFocus,\n\t\tonTouchStart: normalizeButtonFocus,\n\t\tonTouchEnd: normalizeButtonFocus,\n\t\tonBlur: queueBlurCheck,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/compose/src/hooks/use-focus-outside/index.ts"],"names":["useCallback","useEffect","useRef","INPUT_BUTTON_TYPES","isFocusNormalizedButton","eventTarget","window","HTMLElement","nodeName","includes","type","useFocusOutside","onFocusOutside","currentOnFocusOutside","current","preventBlurCheck","blurCheckTimeoutId","cancelBlurCheck","clearTimeout","normalizeButtonFocus","event","target","isInteractionEnd","queueBlurCheck","persist","ignoreForRelatedTarget","getAttribute","relatedTarget","closest","setTimeout","document","hasFocus","preventDefault","onFocus","onMouseDown","onMouseUp","onTouchStart","onTouchEnd","onBlur"],"mappings":"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","sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tFocusEventHandler,\n\tEventHandler,\n\tMouseEventHandler,\n\tTouchEventHandler,\n\tFocusEvent,\n\tMouseEvent,\n\tTouchEvent,\n} from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Input types which are classified as button types, for use in considering\n * whether element is a (focus-normalized) button.\n */\nconst INPUT_BUTTON_TYPES = [ 'button', 'submit' ];\n\n/**\n * List of HTML button elements subject to focus normalization\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n */\ntype FocusNormalizedButton =\n\t| HTMLButtonElement\n\t| HTMLLinkElement\n\t| HTMLInputElement;\n\n/**\n * Returns true if the given element is a button element subject to focus\n * normalization, or false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n *\n * @param eventTarget The target from a mouse or touch event.\n *\n * @return Whether the element is a button element subject to focus normalization.\n */\nfunction isFocusNormalizedButton(\n\teventTarget: EventTarget\n): eventTarget is FocusNormalizedButton {\n\tif ( ! ( eventTarget instanceof window.HTMLElement ) ) {\n\t\treturn false;\n\t}\n\tswitch ( eventTarget.nodeName ) {\n\t\tcase 'A':\n\t\tcase 'BUTTON':\n\t\t\treturn true;\n\n\t\tcase 'INPUT':\n\t\t\treturn INPUT_BUTTON_TYPES.includes(\n\t\t\t\t( eventTarget as HTMLInputElement ).type\n\t\t\t);\n\t}\n\n\treturn false;\n}\n\ntype UseFocusOutsideReturn = {\n\tonFocus: FocusEventHandler;\n\tonMouseDown: MouseEventHandler;\n\tonMouseUp: MouseEventHandler;\n\tonTouchStart: TouchEventHandler;\n\tonTouchEnd: TouchEventHandler;\n\tonBlur: FocusEventHandler;\n};\n\n/**\n * A react hook that can be used to check whether focus has moved outside the\n * element the event handlers are bound to.\n *\n * @param onFocusOutside A callback triggered when focus moves outside\n * the element the event handlers are bound to.\n *\n * @return An object containing event handlers. Bind the event handlers to a\n * wrapping element element to capture when focus moves outside that element.\n */\nexport default function useFocusOutside(\n\tonFocusOutside: ( event: FocusEvent ) => void\n): UseFocusOutsideReturn {\n\tconst currentOnFocusOutside = useRef( onFocusOutside );\n\tuseEffect( () => {\n\t\tcurrentOnFocusOutside.current = onFocusOutside;\n\t}, [ onFocusOutside ] );\n\n\tconst preventBlurCheck = useRef( false );\n\n\tconst blurCheckTimeoutId = useRef< number | undefined >();\n\n\t/**\n\t * Cancel a blur check timeout.\n\t */\n\tconst cancelBlurCheck = useCallback( () => {\n\t\tclearTimeout( blurCheckTimeoutId.current );\n\t}, [] );\n\n\t// Cancel blur checks on unmount.\n\tuseEffect( () => {\n\t\treturn () => cancelBlurCheck();\n\t}, [] );\n\n\t// Cancel a blur check if the callback or ref is no longer provided.\n\tuseEffect( () => {\n\t\tif ( ! onFocusOutside ) {\n\t\t\tcancelBlurCheck();\n\t\t}\n\t}, [ onFocusOutside, cancelBlurCheck ] );\n\n\t/**\n\t * Handles a mousedown or mouseup event to respectively assign and\n\t * unassign a flag for preventing blur check on button elements. Some\n\t * browsers, namely Firefox and Safari, do not emit a focus event on\n\t * button elements when clicked, while others do. The logic here\n\t * intends to normalize this as treating click on buttons as focus.\n\t *\n\t * @param event\n\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\t */\n\tconst normalizeButtonFocus: EventHandler< MouseEvent | TouchEvent > =\n\t\tuseCallback( ( event ) => {\n\t\t\tconst { type, target } = event;\n\t\t\tconst isInteractionEnd = [ 'mouseup', 'touchend' ].includes( type );\n\n\t\t\tif ( isInteractionEnd ) {\n\t\t\t\tpreventBlurCheck.current = false;\n\t\t\t} else if ( isFocusNormalizedButton( target ) ) {\n\t\t\t\tpreventBlurCheck.current = true;\n\t\t\t}\n\t\t}, [] );\n\n\t/**\n\t * A callback triggered when a blur event occurs on the element the handler\n\t * is bound to.\n\t *\n\t * Calls the `onFocusOutside` callback in an immediate timeout if focus has\n\t * move outside the bound element and is still within the document.\n\t */\n\tconst queueBlurCheck: FocusEventHandler = useCallback( ( event ) => {\n\t\t// React does not allow using an event reference asynchronously\n\t\t// due to recycling behavior, except when explicitly persisted.\n\t\tevent.persist();\n\n\t\t// Skip blur check if clicking button. See `normalizeButtonFocus`.\n\t\tif ( preventBlurCheck.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// The usage of this attribute should be avoided. The only use case\n\t\t// would be when we load modals that are not React components and\n\t\t// therefore don't exist in the React tree. An example is opening\n\t\t// the Media Library modal from another dialog.\n\t\t// This attribute should contain a selector of the related target\n\t\t// we want to ignore, because we still need to trigger the blur event\n\t\t// on all other cases.\n\t\tconst ignoreForRelatedTarget = event.target.getAttribute(\n\t\t\t'data-unstable-ignore-focus-outside-for-relatedtarget'\n\t\t);\n\t\tif (\n\t\t\tignoreForRelatedTarget &&\n\t\t\tevent.relatedTarget?.closest( ignoreForRelatedTarget )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tblurCheckTimeoutId.current = setTimeout( () => {\n\t\t\t// If document is not focused then focus should remain\n\t\t\t// inside the wrapped component and therefore we cancel\n\t\t\t// this blur event thereby leaving focus in place.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Document/hasFocus.\n\t\t\tif ( ! document.hasFocus() ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( 'function' === typeof currentOnFocusOutside.current ) {\n\t\t\t\tcurrentOnFocusOutside.current( event );\n\t\t\t}\n\t\t}, 0 );\n\t}, [] );\n\n\treturn {\n\t\tonFocus: cancelBlurCheck,\n\t\tonMouseDown: normalizeButtonFocus,\n\t\tonMouseUp: normalizeButtonFocus,\n\t\tonTouchStart: normalizeButtonFocus,\n\t\tonTouchEnd: normalizeButtonFocus,\n\t\tonBlur: queueBlurCheck,\n\t};\n}\n"]}
@@ -25,12 +25,10 @@ declare const withSafeTimeout: <C extends WithInjectedProps<C, TimeoutProps>>(In
25
25
  setTimeout(fn: () => void, delay: number): number;
26
26
  clearTimeout(id: number): void;
27
27
  render(): JSX.Element;
28
- context: any;
28
+ context: unknown;
29
29
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<WithoutInjectedProps<C, TimeoutProps>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
30
30
  forceUpdate(callback?: (() => void) | undefined): void;
31
- readonly props: Readonly<WithoutInjectedProps<C, TimeoutProps>> & Readonly<{
32
- children?: import("react").ReactNode;
33
- }>;
31
+ readonly props: Readonly<WithoutInjectedProps<C, TimeoutProps>>;
34
32
  state: Readonly<{}>;
35
33
  refs: {
36
34
  [key: string]: import("react").ReactInstance;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/higher-order/with-safe-timeout/index.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAEN,iBAAiB,EACjB,oBAAoB,EACpB,MAAM,2CAA2C,CAAC;AAEnD;;;;;;;GAOG;AACH,UAAU,YAAY;IACrB,UAAU,EAAE,CAAE,EAAE,EAAE,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,KAAM,MAAM,CAAC;IACxD,YAAY,EAAE,CAAE,EAAE,EAAE,MAAM,KAAM,IAAI,CAAC;CACrC;AAED;;;GAGG;AACH,QAAA,MAAM,eAAe;;kBAMR,MAAM,EAAE;;uBAaF,MAAM,IAAI,SAAS,MAAM;yBASvB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;CAkB1B,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/higher-order/with-safe-timeout/index.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAEN,iBAAiB,EACjB,oBAAoB,EACpB,MAAM,2CAA2C,CAAC;AAEnD;;;;;;;GAOG;AACH,UAAU,YAAY;IACrB,UAAU,EAAE,CAAE,EAAE,EAAE,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,KAAM,MAAM,CAAC;IACxD,YAAY,EAAE,CAAE,EAAE,EAAE,MAAM,KAAM,IAAI,CAAC;CACrC;AAED;;;GAGG;AACH,QAAA,MAAM,eAAe;;kBAMR,MAAM,EAAE;;uBAaF,MAAM,IAAI,SAAS,MAAM;yBASvB,MAAM;;;;;;;;;;;;;;;;;;;;;;;CAkB1B,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-constrained-tabbing/index.js"],"names":[],"mappings":";AAWA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,0CAjBY,OAAO,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CA4D/C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-constrained-tabbing/index.js"],"names":[],"mappings":";AAWA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,0CAjBY,OAAO,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CA0D/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-focus-outside/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,iBAAiB,EAEjB,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EAGV,MAAM,OAAO,CAAC;AAqDf,aAAK,qBAAqB,GAAG;IAC5B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,YAAY,EAAE,iBAAiB,CAAC;IAChC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,MAAM,EAAE,iBAAiB,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACtC,cAAc,EAAE,CAAE,KAAK,EAAE,UAAU,KAAM,IAAI,GAC3C,qBAAqB,CA4FvB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-focus-outside/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,iBAAiB,EAEjB,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EAGV,MAAM,OAAO,CAAC;AAqDf,aAAK,qBAAqB,GAAG;IAC5B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,YAAY,EAAE,iBAAiB,CAAC;IAChC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,MAAM,EAAE,iBAAiB,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACtC,cAAc,EAAE,CAAE,KAAK,EAAE,UAAU,KAAM,IAAI,GAC3C,qBAAqB,CA6GvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/compose",
3
- "version": "5.19.0",
3
+ "version": "6.0.0",
4
4
  "description": "WordPress higher-order components (HOCs).",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,22 +31,22 @@
31
31
  "dependencies": {
32
32
  "@babel/runtime": "^7.16.0",
33
33
  "@types/mousetrap": "^1.6.8",
34
- "@wordpress/deprecated": "^3.21.0",
35
- "@wordpress/dom": "^3.21.0",
36
- "@wordpress/element": "^4.19.0",
37
- "@wordpress/is-shallow-equal": "^4.21.0",
38
- "@wordpress/keycodes": "^3.21.0",
39
- "@wordpress/priority-queue": "^2.21.0",
34
+ "@wordpress/deprecated": "^3.23.0",
35
+ "@wordpress/dom": "^3.23.0",
36
+ "@wordpress/element": "^5.0.0",
37
+ "@wordpress/is-shallow-equal": "^4.23.0",
38
+ "@wordpress/keycodes": "^3.23.0",
39
+ "@wordpress/priority-queue": "^2.23.0",
40
40
  "change-case": "^4.1.2",
41
41
  "clipboard": "^2.0.8",
42
42
  "mousetrap": "^1.6.5",
43
43
  "use-memo-one": "^1.1.1"
44
44
  },
45
45
  "peerDependencies": {
46
- "react": "^17.0.0"
46
+ "react": "^18.0.0"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "gitHead": "511f4cc1f0138641bc4394bc1cf36e833109c791"
51
+ "gitHead": "1eb65aabe6738097f4c062e78f69ae8f05879848"
52
52
  }
@@ -36,7 +36,8 @@ describe( 'withGlobalEvents', () => {
36
36
  }
37
37
 
38
38
  render() {
39
- return <div>{ this.props.children }</div>;
39
+ const { children } = this.props;
40
+ return <div>{ children }</div>;
40
41
  }
41
42
  }
42
43
 
@@ -32,9 +32,6 @@ import useRefEffect from '../use-ref-effect';
32
32
  */
33
33
  function useConstrainedTabbing() {
34
34
  return useRefEffect( ( /** @type {HTMLElement} */ node ) => {
35
- /** @type {number|undefined} */
36
- let timeoutId;
37
-
38
35
  function onKeyDown( /** @type {KeyboardEvent} */ event ) {
39
36
  const { keyCode, shiftKey, target } = event;
40
37
 
@@ -62,15 +59,16 @@ function useConstrainedTabbing() {
62
59
 
63
60
  trap.tabIndex = -1;
64
61
  node[ domAction ]( trap );
62
+
63
+ // Remove itself when the trap loses focus.
64
+ trap.addEventListener( 'blur', () => node.removeChild( trap ) );
65
+
65
66
  trap.focus();
66
- // Remove after the browser moves focus to the next element.
67
- timeoutId = setTimeout( () => node.removeChild( trap ) );
68
67
  }
69
68
 
70
69
  node.addEventListener( 'keydown', onKeyDown );
71
70
  return () => {
72
71
  node.removeEventListener( 'keydown', onKeyDown );
73
- clearTimeout( timeoutId );
74
72
  };
75
73
  }, [] );
76
74
  }
@@ -21,7 +21,7 @@ describe( 'useDisabled', () => {
21
21
  <form ref={ ref }>
22
22
  <input />
23
23
  <a href="https://wordpress.org/">A link</a>
24
- <p contentEditable={ true } tabIndex="0"></p>
24
+ <p role="document" contentEditable={ true } tabIndex="0"></p>
25
25
  { showButton && <button>Button</button> }
26
26
  </form>
27
27
  );
@@ -33,11 +33,11 @@ describe( 'useDisabled', () => {
33
33
  }
34
34
 
35
35
  it( 'will disable all fields', () => {
36
- const { container } = render( <DisabledComponent /> );
36
+ render( <DisabledComponent /> );
37
37
 
38
38
  const input = screen.getByRole( 'textbox' );
39
39
  const link = screen.getByRole( 'link' );
40
- const p = container.querySelector( 'p' );
40
+ const p = screen.getByRole( 'document' );
41
41
 
42
42
  expect( input ).toHaveAttribute( 'inert', 'true' );
43
43
  expect( link ).toHaveAttribute( 'inert', 'true' );
@@ -151,6 +151,23 @@ export default function useFocusOutside(
151
151
  return;
152
152
  }
153
153
 
154
+ // The usage of this attribute should be avoided. The only use case
155
+ // would be when we load modals that are not React components and
156
+ // therefore don't exist in the React tree. An example is opening
157
+ // the Media Library modal from another dialog.
158
+ // This attribute should contain a selector of the related target
159
+ // we want to ignore, because we still need to trigger the blur event
160
+ // on all other cases.
161
+ const ignoreForRelatedTarget = event.target.getAttribute(
162
+ 'data-unstable-ignore-focus-outside-for-relatedtarget'
163
+ );
164
+ if (
165
+ ignoreForRelatedTarget &&
166
+ event.relatedTarget?.closest( ignoreForRelatedTarget )
167
+ ) {
168
+ return;
169
+ }
170
+
154
171
  blurCheckTimeoutId.current = setTimeout( () => {
155
172
  // If document is not focused then focus should remain
156
173
  // inside the wrapped component and therefore we cancel
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import ReactDOM from 'react-dom';
4
+ import { render, screen } from '@testing-library/react';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -38,7 +38,7 @@ describe( 'useMergeRefs', () => {
38
38
 
39
39
  function MergedRefs( {
40
40
  count,
41
- tagName: TagName = 'div',
41
+ tagName: TagName = 'ul',
42
42
  disable1,
43
43
  disable2,
44
44
  unused,
@@ -71,31 +71,22 @@ describe( 'useMergeRefs', () => {
71
71
  return <TagName ref={ mergedRefs } />;
72
72
  }
73
73
 
74
- beforeEach( () => {
75
- const rootElement = document.createElement( 'div' );
76
- rootElement.id = 'root';
77
- document.body.appendChild( rootElement );
78
- } );
79
-
80
74
  afterEach( () => {
81
- // Reset all history and DOM.
75
+ // Reset all history.
82
76
  renderCallback.history = [];
83
- document.body.innerHTML = '';
84
77
  } );
85
78
 
86
79
  it( 'should work', () => {
87
- const rootElement = document.getElementById( 'root' );
88
-
89
- ReactDOM.render( <MergedRefs />, rootElement );
80
+ const { rerender, unmount } = render( <MergedRefs /> );
90
81
 
91
- const originalElement = rootElement.firstElementChild;
82
+ const originalElement = screen.getByRole( 'list' );
92
83
 
93
84
  // Render 1: both initial callback functions should be called with node.
94
85
  expect( renderCallback.history ).toEqual( [
95
86
  [ [ originalElement ], [ originalElement ] ],
96
87
  ] );
97
88
 
98
- ReactDOM.render( <MergedRefs />, rootElement );
89
+ rerender( <MergedRefs /> );
99
90
 
100
91
  // Render 2: the new callback functions should not be called! There has
101
92
  // been no dependency change.
@@ -104,7 +95,7 @@ describe( 'useMergeRefs', () => {
104
95
  [ [], [] ],
105
96
  ] );
106
97
 
107
- ReactDOM.render( null, rootElement );
98
+ unmount();
108
99
 
109
100
  // Unmount: the initial callback functions should receive null.
110
101
  expect( renderCallback.history ).toEqual( [
@@ -117,15 +108,13 @@ describe( 'useMergeRefs', () => {
117
108
  } );
118
109
 
119
110
  it( 'should work for node change', () => {
120
- const rootElement = document.getElementById( 'root' );
111
+ const { rerender, unmount } = render( <MergedRefs /> );
121
112
 
122
- ReactDOM.render( <MergedRefs />, rootElement );
113
+ const originalElement = screen.getByRole( 'list' );
123
114
 
124
- const originalElement = rootElement.firstElementChild;
115
+ rerender( <MergedRefs tagName="button" /> );
125
116
 
126
- ReactDOM.render( <MergedRefs tagName="button" />, rootElement );
127
-
128
- const newElement = rootElement.firstElementChild;
117
+ const newElement = screen.getByRole( 'button' );
129
118
 
130
119
  // After a render with the original element and a second render with the
131
120
  // new element, expect the initial callback functions to be called with
@@ -140,7 +129,7 @@ describe( 'useMergeRefs', () => {
140
129
  [ [], [] ],
141
130
  ] );
142
131
 
143
- ReactDOM.render( null, rootElement );
132
+ unmount();
144
133
 
145
134
  // Unmount: the initial callback functions should receive null.
146
135
  expect( renderCallback.history ).toEqual( [
@@ -153,17 +142,15 @@ describe( 'useMergeRefs', () => {
153
142
  } );
154
143
 
155
144
  it( 'should work with dependencies', () => {
156
- const rootElement = document.getElementById( 'root' );
157
-
158
- ReactDOM.render( <MergedRefs count={ 1 } />, rootElement );
145
+ const { rerender, unmount } = render( <MergedRefs count={ 1 } /> );
159
146
 
160
- const originalElement = rootElement.firstElementChild;
147
+ const originalElement = screen.getByRole( 'list' );
161
148
 
162
149
  expect( renderCallback.history ).toEqual( [
163
150
  [ [ originalElement ], [ originalElement ] ],
164
151
  ] );
165
152
 
166
- ReactDOM.render( <MergedRefs count={ 2 } />, rootElement );
153
+ rerender( <MergedRefs count={ 2 } /> );
167
154
 
168
155
  // After a second render with a dependency change, expect the inital
169
156
  // callback function to be called with null and the new callback
@@ -174,7 +161,7 @@ describe( 'useMergeRefs', () => {
174
161
  [ [], [ originalElement ] ],
175
162
  ] );
176
163
 
177
- ReactDOM.render( null, rootElement );
164
+ unmount();
178
165
 
179
166
  // Unmount: current callback functions should be called with null.
180
167
  expect( renderCallback.history ).toEqual( [
@@ -187,22 +174,17 @@ describe( 'useMergeRefs', () => {
187
174
  } );
188
175
 
189
176
  it( 'should simultaneously update node and dependencies', () => {
190
- const rootElement = document.getElementById( 'root' );
177
+ const { rerender, unmount } = render( <MergedRefs count={ 1 } /> );
191
178
 
192
- ReactDOM.render( <MergedRefs count={ 1 } />, rootElement );
193
-
194
- const originalElement = rootElement.firstElementChild;
179
+ const originalElement = screen.getByRole( 'list' );
195
180
 
196
181
  expect( renderCallback.history ).toEqual( [
197
182
  [ [ originalElement ], [ originalElement ] ],
198
183
  ] );
199
184
 
200
- ReactDOM.render(
201
- <MergedRefs count={ 2 } tagName="button" />,
202
- rootElement
203
- );
185
+ rerender( <MergedRefs count={ 2 } tagName="button" /> );
204
186
 
205
- const newElement = rootElement.firstElementChild;
187
+ const newElement = screen.getByRole( 'button' );
206
188
 
207
189
  // Both the node changes and the dependencies update for the second
208
190
  // callback, so expect the old callback function to be called with null
@@ -217,7 +199,7 @@ describe( 'useMergeRefs', () => {
217
199
  [ [], [ newElement ] ],
218
200
  ] );
219
201
 
220
- ReactDOM.render( null, rootElement );
202
+ unmount();
221
203
 
222
204
  // Unmount: current callback functions should be called with null.
223
205
  expect( renderCallback.history ).toEqual( [
@@ -230,15 +212,13 @@ describe( 'useMergeRefs', () => {
230
212
  } );
231
213
 
232
214
  it( 'should work for dependency change after node change', () => {
233
- const rootElement = document.getElementById( 'root' );
234
-
235
- ReactDOM.render( <MergedRefs />, rootElement );
215
+ const { rerender, unmount } = render( <MergedRefs /> );
236
216
 
237
- const originalElement = rootElement.firstElementChild;
217
+ const originalElement = screen.getByRole( 'list' );
238
218
 
239
- ReactDOM.render( <MergedRefs tagName="button" />, rootElement );
219
+ rerender( <MergedRefs tagName="button" /> );
240
220
 
241
- const newElement = rootElement.firstElementChild;
221
+ const newElement = screen.getByRole( 'button' );
242
222
 
243
223
  // After a render with the original element and a second render with the
244
224
  // new element, expect the initial callback functions to be called with
@@ -253,10 +233,7 @@ describe( 'useMergeRefs', () => {
253
233
  [ [], [] ],
254
234
  ] );
255
235
 
256
- ReactDOM.render(
257
- <MergedRefs tagName="button" count={ 1 } />,
258
- rootElement
259
- );
236
+ rerender( <MergedRefs tagName="button" count={ 1 } /> );
260
237
 
261
238
  // After a third render with a dependency change, expect the inital
262
239
  // callback function to be called with null and the new callback
@@ -271,7 +248,7 @@ describe( 'useMergeRefs', () => {
271
248
  [ [], [ newElement ] ],
272
249
  ] );
273
250
 
274
- ReactDOM.render( null, rootElement );
251
+ unmount();
275
252
 
276
253
  // Unmount: current callback functions should be called with null.
277
254
  expect( renderCallback.history ).toEqual( [
@@ -285,18 +262,16 @@ describe( 'useMergeRefs', () => {
285
262
  } );
286
263
 
287
264
  it( 'should allow disabling a ref', () => {
288
- const rootElement = document.getElementById( 'root' );
265
+ const { rerender, unmount } = render( <MergedRefs disable1 /> );
289
266
 
290
- ReactDOM.render( <MergedRefs disable1 />, rootElement );
291
-
292
- const originalElement = rootElement.firstElementChild;
267
+ const originalElement = screen.getByRole( 'list' );
293
268
 
294
269
  // Render 1: ref 1 should be disabled.
295
270
  expect( renderCallback.history ).toEqual( [
296
271
  [ [], [ originalElement ] ],
297
272
  ] );
298
273
 
299
- ReactDOM.render( <MergedRefs disable2 />, rootElement );
274
+ rerender( <MergedRefs disable2 /> );
300
275
 
301
276
  // Render 2: ref 1 should be enabled and receive the ref. Note that the
302
277
  // callback hasn't changed, so the original callback function will be
@@ -306,7 +281,7 @@ describe( 'useMergeRefs', () => {
306
281
  [ [], [] ],
307
282
  ] );
308
283
 
309
- ReactDOM.render( <MergedRefs disable1 count={ 1 } />, rootElement );
284
+ rerender( <MergedRefs disable1 count={ 1 } /> );
310
285
 
311
286
  // Render 3: ref 1 should again be disabled. Ref 2 to should receive a
312
287
  // ref with the new callback function because the count has been
@@ -320,7 +295,7 @@ describe( 'useMergeRefs', () => {
320
295
  [ [], [ originalElement ] ],
321
296
  ] );
322
297
 
323
- ReactDOM.render( null, rootElement );
298
+ unmount();
324
299
 
325
300
  // Unmount: current callback functions should receive null.
326
301
  expect( renderCallback.history ).toEqual( [
@@ -334,18 +309,16 @@ describe( 'useMergeRefs', () => {
334
309
  } );
335
310
 
336
311
  it( 'should allow the hook being unused', () => {
337
- const rootElement = document.getElementById( 'root' );
338
-
339
- ReactDOM.render( <MergedRefs unused />, rootElement );
312
+ const { rerender } = render( <MergedRefs unused /> );
340
313
 
341
- const originalElement = rootElement.firstElementChild;
314
+ const originalElement = screen.getByRole( 'list' );
342
315
 
343
316
  // Render 1: ref 1 should updated, ref 2 should not.
344
317
  expect( renderCallback.history ).toEqual( [
345
318
  [ [ originalElement ], [] ],
346
319
  ] );
347
320
 
348
- ReactDOM.render( <MergedRefs />, rootElement );
321
+ rerender( <MergedRefs /> );
349
322
 
350
323
  // Render 2: ref 2 should be updated as well.
351
324
  expect( renderCallback.history ).toEqual( [
@@ -353,7 +326,7 @@ describe( 'useMergeRefs', () => {
353
326
  [ [], [] ],
354
327
  ] );
355
328
 
356
- ReactDOM.render( <MergedRefs unused />, rootElement );
329
+ rerender( <MergedRefs unused /> );
357
330
 
358
331
  // Render 3: ref 2 should be updated with null
359
332
  expect( renderCallback.history ).toEqual( [
@@ -1 +1 @@
1
- {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/no-case/dist/index.d.ts","../../node_modules/pascal-case/dist/index.d.ts","../../node_modules/camel-case/dist/index.d.ts","../../node_modules/capital-case/dist/index.d.ts","../../node_modules/constant-case/dist/index.d.ts","../../node_modules/dot-case/dist/index.d.ts","../../node_modules/header-case/dist/index.d.ts","../../node_modules/param-case/dist/index.d.ts","../../node_modules/path-case/dist/index.d.ts","../../node_modules/sentence-case/dist/index.d.ts","../../node_modules/snake-case/dist/index.d.ts","../../node_modules/change-case/dist/index.d.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/@types/react/node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/scheduler/tracing.d.ts","../../node_modules/@types/react/index.d.ts","./src/utils/create-higher-order-component/index.ts","./src/utils/debounce/index.ts","./src/utils/throttle/index.ts","./src/higher-order/pipe.ts","./src/higher-order/compose.ts","./src/higher-order/if-condition/index.tsx","../is-shallow-equal/build-types/objects.d.ts","../is-shallow-equal/build-types/arrays.d.ts","../is-shallow-equal/build-types/index.d.ts","../element/build-types/react.d.ts","../element/build-types/create-interpolate-element.d.ts","../../node_modules/@types/react-dom/index.d.ts","../element/build-types/react-platform.d.ts","../element/build-types/utils.d.ts","../element/build-types/platform.d.ts","../element/build-types/serialize.d.ts","../element/build-types/raw-html.d.ts","../element/build-types/index.d.ts","./src/higher-order/pure/index.tsx","../../node_modules/utility-types/dist/aliases-and-guards.d.ts","../../node_modules/utility-types/dist/mapped-types.d.ts","../../node_modules/utility-types/dist/utility-types.d.ts","../../node_modules/utility-types/dist/functional-helpers.d.ts","../../node_modules/utility-types/dist/index.d.ts","../deprecated/build-types/index.d.ts","./src/higher-order/with-global-events/listener.js","./src/higher-order/with-global-events/index.js","./src/hooks/use-instance-id/index.ts","./src/higher-order/with-instance-id/index.tsx","./src/higher-order/with-safe-timeout/index.tsx","./src/higher-order/with-state/index.js","../keycodes/build-types/platform.d.ts","../keycodes/build-types/index.d.ts","../dom/build-types/dom/compute-caret-rect.d.ts","../dom/build-types/dom/document-has-text-selection.d.ts","../dom/build-types/dom/document-has-uncollapsed-selection.d.ts","../dom/build-types/dom/document-has-selection.d.ts","../dom/build-types/dom/get-rectangle-from-range.d.ts","../dom/build-types/dom/get-scroll-container.d.ts","../dom/build-types/dom/get-offset-parent.d.ts","../dom/build-types/dom/is-entirely-selected.d.ts","../dom/build-types/dom/is-form-element.d.ts","../dom/build-types/dom/is-horizontal-edge.d.ts","../dom/build-types/dom/is-number-input.d.ts","../dom/build-types/dom/is-text-field.d.ts","../dom/build-types/dom/is-vertical-edge.d.ts","../dom/build-types/dom/place-caret-at-horizontal-edge.d.ts","../dom/build-types/dom/place-caret-at-vertical-edge.d.ts","../dom/build-types/dom/replace.d.ts","../dom/build-types/dom/remove.d.ts","../dom/build-types/dom/insert-after.d.ts","../dom/build-types/dom/unwrap.d.ts","../dom/build-types/dom/replace-tag.d.ts","../dom/build-types/dom/wrap.d.ts","../dom/build-types/dom/strip-html.d.ts","../dom/build-types/dom/is-empty.d.ts","../dom/build-types/dom/clean-node-list.d.ts","../dom/build-types/dom/remove-invalid-html.d.ts","../dom/build-types/dom/is-rtl.d.ts","../dom/build-types/dom/safe-html.d.ts","../dom/build-types/dom/index.d.ts","../dom/build-types/phrasing-content.d.ts","../dom/build-types/data-transfer.d.ts","../dom/build-types/focusable.d.ts","../dom/build-types/tabbable.d.ts","../dom/build-types/index.d.ts","./src/hooks/use-ref-effect/index.ts","./src/hooks/use-constrained-tabbing/index.js","../../node_modules/clipboard/src/clipboard.d.ts","./src/hooks/use-copy-on-click/index.js","./src/hooks/use-copy-to-clipboard/index.js","./src/hooks/use-focus-on-mount/index.js","./src/hooks/use-focus-return/index.js","./src/hooks/use-focus-outside/index.ts","./src/hooks/use-merge-refs/index.js","./src/hooks/use-dialog/index.ts","./src/hooks/use-disabled/index.ts","./src/hooks/use-isomorphic-layout-effect/index.js","./src/hooks/use-dragging/index.js","../../node_modules/@types/mousetrap/index.d.ts","../../node_modules/@types/mousetrap/plugins/global-bind/mousetrap-global-bind.d.ts","./src/hooks/use-keyboard-shortcut/index.js","./src/hooks/use-media-query/index.js","./src/hooks/use-previous/index.ts","./src/hooks/use-reduced-motion/index.js","./src/hooks/use-viewport-match/index.js","./src/hooks/use-resize-observer/index.tsx","../priority-queue/build-types/index.d.ts","./src/hooks/use-async-list/index.ts","./src/hooks/use-warn-on-change/index.js","../../node_modules/use-memo-one/index.d.ts","./src/hooks/use-debounce/index.js","./src/hooks/use-throttle/index.js","./src/hooks/use-drop-zone/index.js","./src/hooks/use-focusable-iframe/index.ts","./src/hooks/use-fixed-window-list/index.js","./src/index.js","../../typings/gutenberg-env/index.d.ts"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"b4e123af1af6049685c93073a15868b50aebdad666d422edc72fa2b585fa8a37","f86c04a744ebcede96bac376f9a2c90f2bd3c422740d91dda4ca6233199d4977","6ae1bddee5c790439bd992abd063b9b46e0cadd676c2a8562268d1869213ff60","606244fc97a6a74b877f2e924ba7e55b233bc6acb57d7bf40ba84a5be2d9adb0","4a1cabac71036b8a14f5db1b753b579f0c901c7d7b9227e6872dadf6efb104e8","062959a1d825b96639d87be35fe497cbd3f89544bf06fdad577bbfb85fcf604c","4c3672dc8f4e4fdd3d18525b22b31f1b5481f5a415db96550d3ac5163a6c3dd3","f9a69ca445010b91fe08f08c06e0f86d79c0d776905f9bdb828477cb2a1eb7fc","ad7fd0e7ee457d4884b3aaecbcbd2a80b6803407c4ce2540c296170d4c7918ef","a50ef21605f41c6acad6c3ef0307e5311b94963c846ca093c764b80cdb5318d6","74b4035dd26d09a417c44ca23ab5ee69b173f8c2f6b2e47350ab0795cf2d4a17","918f86ee2b19cc38cb8b1a4cf8f223eb228aaa39df3604c42f700fac2f0b3ea1",{"version":"ecf78e637f710f340ec08d5d92b3f31b134a46a4fcf2e758690d8c46ce62cba6","affectsGlobalScope":true},"381899b8d1d4c1be716f18cb5242ba39f66f4b1e31d45af62a32a99f8edcb39d","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"1bc82f5b3bb93df76d19730c84467b0b346187198537135d63a672956f323720","affectsGlobalScope":true},"a411d5c6b281a3820b7b16f4183e7b992e3afe0942d233ec9d25c641fd53476b","f0b28b3d6882f5e1d938ca97e5f33d1b3bd2d0fcf275a95a1ed6e4aae8db3d98","ec17a33de0166cd47421642635272df2893f5aca9e84bf8d08c4af617a6dbe9e","db829c3ac876762865ad7fd84ea0ed5be54823518399db1ca3af4572b6649e87","a41403e55f0a8b7d5b50dd7d1adac61caa18f69d7591c95cbe7e7d5bcaf37177","f9fd6e3ade5a1179d67ba174b2f4219ba5afa7c0b8817cd07e398f0ebccefbe7","5190f1a110a789c2f8ed8dcf2da6ce122dcb74249d0c01d19d1ed0b1c6bb02a1","3650bbe137c9c44bc6b8f44a56353b00eba9654e41a9355e6228f7f0f464c648","9c4f32d2fa2b6efeed4f9fbd98254121b17982110b48edcede96e2dc2af0894d","e59d00012fb20e6746def2f4bc94650526aa6c574c49ad6a50a992f61a3ee675","e47b8ec56eb49bc1c53c9012daa9874de14ad0c5da442485aec333571c74b526","45a63e17814c570ea59407f231ef9c561510bd6edb36f17479b09b44619496c6","5d7018910750d9cb4a912577ad2951fc3fad83c30d637689b69ffc6bbb0c9f5a","d2d9e98a2b167079474768593e1e7125fc3db055add8fbdb5977e3d05a8a3696","6462da67490105ba7d98cf312c2faf8794c425781128b161ea8394d66502eec8","62359da52b6c8d00c50c2e50738fac82e902f916fdf458d8159e7edb1c60c3a8","1e0ac21bc775686383ea8c8e48bd98b385e6195b25c85525a7affd08a2cd38b9","0449615e1ed03c7d54fc435a63b7ef0cb4e5cea5ac40c9a63280a46f7eeae0ff","1dd3d421923d8f03af788abb7e9585e2cf2fe7365958e727928cbab8f691a9e8","bd0d80db12ef1aceefc4f9d3eb88517b9634fa747ae8475981da8655292feab8","55e68fb1618e3f55f7866b8c8415152159309a14b716370081ab0b7af96d876e","bf0491af2455f92282b61807be2be6e7ad7d532e47fac7b698019d3617c28ff7","5d874fb879ab8601c02549817dceb2d0a30729cb7e161625dd6f819bbff1ec0b","ee551a880882770c4f56a0964a9767c9feafe497a5be52652527d098c88d85cb","b192606574769a5566620f9bf19358a3994bc2726ecdeaad9c66f3333b2687c8","cafd444fa9429538f39b36d19967735f4ddd68afdf595ce8d6526b9535a32967","8da8943f5709102a1a172e59ad9ef8efcfad939c3fc3ce0931cee0e74b746415","06344dc54bd683361d1265df562bf28310dee42631351cbc73ec0662067a2662","5cc991dfbc9af88d5fad5edf08593065d9eefea81cd07a8277b28198645db0b6","bfa7ee495d0975bbeeaa6f005db167b9db4f1f92896f0669f2f124f9fb9cbed9","04960fe91185fc317b9f8d2d2604b4547c8ea3ec49563062c28ae95c89e06e3a","e6523d2db6e2ae8cf35fdc53199538d6817add78536b1a986c3a08513b7202e1","ce845faff6db3eb0e1d62ff1c6337f0bb1202b312dde69efd5addd5aa0389b07","cbf4ee77c80de53d71a1d076ea25eddd23541685119a67c43bd4aeaad8533b1f","215f6d27f88aeaa56a4e0fe358a6fe3b8b5f7c76a2f83663035028b0c2595b1f","f8d84deeb6367b306c78f83111f36b14a7cb786af0c3a93168ffc97a2e0916c9","c307c0c1d2a162347fe19da27d37ee9f333617a23686649acbe4190848225970","6bcfd3b6f61aedc9734a19729a0d1a8e7de6aa02621bf519d0a1276601fb1a74","fe43e4fd566293aee946e5db5b055db1215602498d315e468c6adaf1e6917fb4","ea912b91fed2f873b87e24180399baad37c43019b6f51b210e1d9f1d1d0135ba","a1cd2b1943db96616abf3a3f939dfd0eb69fab8149725d195a8acc7f5672a1f9","ddf5e2dd1897b3271acd68a587d43996e18c63ccc51b17f9149763a7d4bbadb7","1466691ae57846e0280465b012fd01aed3c4a4e0b39fcc11276833fbfc72ade7","b3ceffa2a65a5d7a6f0d6daf429d23dd301df58718ad07e397bfa28f7d8a2688","cfa03019dd5cdd18ff1b5f00b3cb37ac762faf9eca2e86ea2c718502285cf67b","4d8d7075a3381162b4ae5147f84b4d2a2ae49398d98bef7c4437b8db0fefb194","a8b1a9f91ecb89faabb130af767e007ee28ac6ca794565d856759bb87e42feb1","1b1c43c378278f5dfea558337b0e3d57944a806eb4f55330baba592967253350","5ad070af2f7e4b7a676a63137c6a6cf670144ee5f23a9a30b21c19e70bb077f3","df060b3639c427e1c09bcf5cc14975f00b296e53192c710ea76e4a658a382aa0","4dd037aee1fed84d54490818e9a32d12e3e2f75d1dd9816d25fb9a0ecacee3b9","ca84eb7ffe779cb8812ee0a6aa151adac3dd25c4dc877767f37d079e5b62151f","f1d5239e0cdfb4ddd24a47727b88871802d3d2b3fda70229b158525753ad643e","af89d09746be737e24c50de49f035f3afea14c11be30ad5d2764d142daaa4078","5422948be7ac69dd13078af8ce2a8d9ea4d79eb510bfc54b75586573185183f9","246fc68fbf5c3ae2fded7eebcc38e6c5bb0f2cb796096916d0e65505cfbe850f","fc35e9bf454dcd7c42bab9e51bdedd4c9a5662b8d9964b1204913e268cb1fe6f","6e278ba8dbcf2617a2c5f5805e3addd1cf1c35b75b7dde3cbdabbccbf926b6fe","a2e36dad616090f5bcb99c4491b8b34bf8f2b5bf2fdcd6b5a43ddfd23f1b8433","c9d56f52ca68c2c86ec5ba05d927ef3892dca4923bd3cebe6593ebbcdd7e70c3","419dd7c5f46e04ddc2a390070fe19423200334f464bcd41a8bac56007127a13d","067b19c3d1fde05a39e5b769cbb5f44e0f6cf201f52fa2cafedc3943ea2e9052","e3ea09f9ea097b88c98df19c52694ac83daab0692e90cea9cf3faff00087899f","02e1dfd21586ad4379dc0d0ab88283694734f786ed4dcffaf5fbe25b23cd4b62","e8764e82f28e0a7acb1edf0cd502de3c667ce0597ec8deefab4bddcb2273e4c7","4a43623f49489a0e0359e905dc2eaeb88c9bc5dce62819b9c04c8c60d79d2782","82e37f3013111a0a7abf743e89b074261bb92655bea624bb07ac77c6f0a94657","0529cc464f3dcf6322b23f37cb2a35bcc52baccb9afe128b38485cda9ea5db7d","d7865f701e0b27e883babea23a4aa1d1a8f37ccc502f7834b81d117401d689f4","2290ccf854da4cabed41ff4013869e463b16772b3f16ae308e382f91d516c895","198ebdc9a229972b281bb98bc86528dbbe00a91f6fd7b1a2d987f0f3f52157d8","50c61f235257b1c9068c41a5a50baeb4274ea5dfc07d2f86c4032617e30d0732","bc4724a288bcb43fb7248fdc5dc371c3faf8fced20033e4bb75f4eb09cfdf01d","5891e1e9e7e581597fe3706134cfefb059d2abea5617bccc5eb973e4be93fa03","fa277bbe15a3e2945be2608ccb159208ef50ae95b5059acc01d8c453b1683fff","2ce70b0c8a1d1babeb3e7eb19b34ed0ecd8f935c26bbd0e8d6affc3fb46b22c3","de3f48d4ddc159b324db68d27fc8fdee4d0153ac872d292ecc05af01b4302d65","98d019534dd7c963b013eed9a2a2e8a96618e70a40730f6920614be6d410ef80","774f781a28c56874e245eadff141e5e52af54e5555d7e083fca45f06348841ed","96520a873073a2f39f922d0a422498cdcc28be9066a769000cdd07ecaba7b645","135aa6d18002bfec723f8697aa80a59648cf0582752d5e089b6eb0770b63a02d","b6eb8e23f4145ddbe22639779de710af7a554c9592f69f257b7ec5c487eb0695","831d99b85c6ced631649a70014e1288d3f927fa262e4009ba1fbcd11b965ce58","38fef887c5b2cae9d244172fe72957e61c3393bacc2be3ae5e2c1bf1e8a69e71","e064325c76ef07fec4cd69a91dabe717fae011bba5e15d81a2486ce25e80a91e","914d7cdcd8c7ebff500b43e8a878164ef0f93168eea0e5246747484a160d730b",{"version":"4169be501cd57005d1c910fa24cef850c2922596632b00096063f58d649ba85a","affectsGlobalScope":true},"abb6d9adcc79c591f712e79c55f769b48690ec66a55b6f6189569a0d357c7e58","e7669752758ae96e591040a264669535d7e65a8ce01f86812211fe39dc7bef6c","8ebd5899eefab0ba9bb82ae4cdd18aca44564a25cebfa51ea5d92db4252b49dd","62540abf0bac8bf8c13c183db0457c5495a2bdad157f9eb03916c3953feb765e","7fe68b17d28662b4c1232c578a3bce0532f2628b443ad541a196b124e4d93087","89eae3e00b2fbde1af73eab56e0ca7960c2dbc02c2ef89f98104ceb75526311b","88d3d5b21760947695c7d812e5992c5a80d938cafaf8ecf687e350bd230f5d25","11fb82c3644a70cf226676762f39dc6de87ef9dc11ed83e5ca52e013425cfd89","2d78a397234d9b3325910135668cffba83af759074ceadc0afd281795ca8b9fc","22f67790611304c6726a7e333265c1b64e472e78bb661f734a4cd715402d3e9f",{"version":"f254c1abf6bb4c92633159831f924588908da902aa5e04ae45c39bd001f62e2e","affectsGlobalScope":true}],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[141],[61],[57,58,59,60],[46],[45],[45,46,47,48,49,50,51,52,53,54,55],[48],[50],[81,82,83,84],[81],[82],[65],[61,62],[61,62,70,79],[62,79,86,87],[62,89],[62,79],[62,79,86],[79,149],[61,94,127,128],[61,79,86,130],[61,79,128,130],[63,79,152],[61,79,94,129,133,134,135,136],[63,128],[61,79,139],[61,79,128],[61,63,79,94,127],[61,79,127],[61,79],[61,128],[79],[61,79,94,141,142],[144],[63,64,79,152],[79,144],[145],[62,63,64,65,66,67,80,88,89,90,91,92,128,129,131,132,133,134,135,136,137,138,139,140,143,144,145,146,147,148,150,151,153,154,155,156,157],[56,61],[63],[85],[95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,121],[118],[122,123,124,125,126],[71],[71,72,74,75,76,77,78],[73],[61,71],[68,69],[70],[93]],"referencedMap":[[142,1],[73,2],[61,3],[47,4],[48,5],[56,6],[49,5],[50,5],[51,7],[52,8],[46,5],[53,8],[54,5],[55,8],[85,9],[82,10],[83,11],[66,12],[67,13],[80,14],[88,15],[90,16],[91,17],[92,18],[150,19],[129,20],[131,21],[132,22],[153,23],[137,24],[138,25],[140,26],[155,27],[157,28],[133,29],[135,30],[134,30],[156,31],[89,32],[139,32],[143,33],[144,32],[136,30],[145,32],[146,34],[128,30],[148,30],[154,35],[147,36],[151,37],[158,38],[62,39],[64,40],[86,41],[122,42],[119,43],[127,44],[72,45],[79,46],[78,2],[74,47],[71,2],[77,48],[70,49],[68,50],[94,51]],"exportedModulesMap":[[142,1],[73,2],[61,3],[47,4],[48,5],[56,6],[49,5],[50,5],[51,7],[52,8],[46,5],[53,8],[54,5],[55,8],[85,9],[82,10],[83,11],[66,12],[67,13],[80,14],[88,15],[90,16],[91,17],[92,18],[150,19],[129,20],[131,21],[132,22],[153,23],[137,24],[138,25],[140,26],[155,27],[157,28],[133,29],[135,30],[134,30],[156,31],[89,32],[139,32],[143,33],[144,32],[136,30],[145,32],[146,34],[128,30],[148,30],[154,35],[147,36],[151,37],[158,38],[62,39],[64,40],[86,41],[122,42],[119,43],[127,44],[72,45],[79,46],[78,2],[74,47],[71,2],[77,48],[70,49],[68,50],[94,51]],"semanticDiagnosticsPerFile":[141,142,59,73,57,61,58,60,47,48,56,130,49,50,51,45,52,46,53,54,55,10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,152,81,84,85,82,83,66,67,65,80,88,87,90,91,92,150,129,131,132,153,137,138,140,155,157,133,135,134,156,89,139,143,144,136,145,146,128,148,154,147,151,158,62,63,64,86,124,118,95,98,96,97,101,99,100,122,112,117,102,103,104,105,120,106,107,108,109,119,111,114,110,121,116,113,115,125,127,123,126,72,79,76,78,74,71,77,75,69,70,68,94,93,149,159]},"version":"4.4.2"}
1
+ {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/no-case/dist/index.d.ts","../../node_modules/pascal-case/dist/index.d.ts","../../node_modules/camel-case/dist/index.d.ts","../../node_modules/capital-case/dist/index.d.ts","../../node_modules/constant-case/dist/index.d.ts","../../node_modules/dot-case/dist/index.d.ts","../../node_modules/header-case/dist/index.d.ts","../../node_modules/param-case/dist/index.d.ts","../../node_modules/path-case/dist/index.d.ts","../../node_modules/sentence-case/dist/index.d.ts","../../node_modules/snake-case/dist/index.d.ts","../../node_modules/change-case/dist/index.d.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/scheduler/tracing.d.ts","../../node_modules/@types/react/index.d.ts","./src/utils/create-higher-order-component/index.ts","./src/utils/debounce/index.ts","./src/utils/throttle/index.ts","./src/higher-order/pipe.ts","./src/higher-order/compose.ts","./src/higher-order/if-condition/index.tsx","../is-shallow-equal/build-types/objects.d.ts","../is-shallow-equal/build-types/arrays.d.ts","../is-shallow-equal/build-types/index.d.ts","../element/node_modules/@types/react/index.d.ts","../element/build-types/react.d.ts","../element/build-types/create-interpolate-element.d.ts","../../node_modules/@types/react-dom/index.d.ts","../element/build-types/react-platform.d.ts","../element/build-types/utils.d.ts","../element/build-types/platform.d.ts","../element/build-types/serialize.d.ts","../element/build-types/raw-html.d.ts","../element/build-types/index.d.ts","./src/higher-order/pure/index.tsx","../../node_modules/utility-types/dist/aliases-and-guards.d.ts","../../node_modules/utility-types/dist/mapped-types.d.ts","../../node_modules/utility-types/dist/utility-types.d.ts","../../node_modules/utility-types/dist/functional-helpers.d.ts","../../node_modules/utility-types/dist/index.d.ts","../deprecated/build-types/index.d.ts","./src/higher-order/with-global-events/listener.js","./src/higher-order/with-global-events/index.js","./src/hooks/use-instance-id/index.ts","./src/higher-order/with-instance-id/index.tsx","./src/higher-order/with-safe-timeout/index.tsx","./src/higher-order/with-state/index.js","../keycodes/build-types/platform.d.ts","../keycodes/build-types/index.d.ts","../dom/build-types/dom/compute-caret-rect.d.ts","../dom/build-types/dom/document-has-text-selection.d.ts","../dom/build-types/dom/document-has-uncollapsed-selection.d.ts","../dom/build-types/dom/document-has-selection.d.ts","../dom/build-types/dom/get-rectangle-from-range.d.ts","../dom/build-types/dom/get-scroll-container.d.ts","../dom/build-types/dom/get-offset-parent.d.ts","../dom/build-types/dom/is-entirely-selected.d.ts","../dom/build-types/dom/is-form-element.d.ts","../dom/build-types/dom/is-horizontal-edge.d.ts","../dom/build-types/dom/is-number-input.d.ts","../dom/build-types/dom/is-text-field.d.ts","../dom/build-types/dom/is-vertical-edge.d.ts","../dom/build-types/dom/place-caret-at-horizontal-edge.d.ts","../dom/build-types/dom/place-caret-at-vertical-edge.d.ts","../dom/build-types/dom/replace.d.ts","../dom/build-types/dom/remove.d.ts","../dom/build-types/dom/insert-after.d.ts","../dom/build-types/dom/unwrap.d.ts","../dom/build-types/dom/replace-tag.d.ts","../dom/build-types/dom/wrap.d.ts","../dom/build-types/dom/strip-html.d.ts","../dom/build-types/dom/is-empty.d.ts","../dom/build-types/dom/clean-node-list.d.ts","../dom/build-types/dom/remove-invalid-html.d.ts","../dom/build-types/dom/is-rtl.d.ts","../dom/build-types/dom/safe-html.d.ts","../dom/build-types/dom/index.d.ts","../dom/build-types/phrasing-content.d.ts","../dom/build-types/data-transfer.d.ts","../dom/build-types/focusable.d.ts","../dom/build-types/tabbable.d.ts","../dom/build-types/index.d.ts","./src/hooks/use-ref-effect/index.ts","./src/hooks/use-constrained-tabbing/index.js","../../node_modules/clipboard/src/clipboard.d.ts","./src/hooks/use-copy-on-click/index.js","./src/hooks/use-copy-to-clipboard/index.js","./src/hooks/use-focus-on-mount/index.js","./src/hooks/use-focus-return/index.js","./src/hooks/use-focus-outside/index.ts","./src/hooks/use-merge-refs/index.js","./src/hooks/use-dialog/index.ts","./src/hooks/use-disabled/index.ts","./src/hooks/use-isomorphic-layout-effect/index.js","./src/hooks/use-dragging/index.js","../../node_modules/@types/mousetrap/index.d.ts","../../node_modules/@types/mousetrap/plugins/global-bind/mousetrap-global-bind.d.ts","./src/hooks/use-keyboard-shortcut/index.js","./src/hooks/use-media-query/index.js","./src/hooks/use-previous/index.ts","./src/hooks/use-reduced-motion/index.js","./src/hooks/use-viewport-match/index.js","./src/hooks/use-resize-observer/index.tsx","../priority-queue/build-types/index.d.ts","./src/hooks/use-async-list/index.ts","./src/hooks/use-warn-on-change/index.js","../../node_modules/use-memo-one/index.d.ts","./src/hooks/use-debounce/index.js","./src/hooks/use-throttle/index.js","./src/hooks/use-drop-zone/index.js","./src/hooks/use-focusable-iframe/index.ts","./src/hooks/use-fixed-window-list/index.js","./src/index.js","../../typings/gutenberg-env/index.d.ts","../element/node_modules/@types/react/global.d.ts"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"b4e123af1af6049685c93073a15868b50aebdad666d422edc72fa2b585fa8a37","f86c04a744ebcede96bac376f9a2c90f2bd3c422740d91dda4ca6233199d4977","6ae1bddee5c790439bd992abd063b9b46e0cadd676c2a8562268d1869213ff60","606244fc97a6a74b877f2e924ba7e55b233bc6acb57d7bf40ba84a5be2d9adb0","4a1cabac71036b8a14f5db1b753b579f0c901c7d7b9227e6872dadf6efb104e8","062959a1d825b96639d87be35fe497cbd3f89544bf06fdad577bbfb85fcf604c","4c3672dc8f4e4fdd3d18525b22b31f1b5481f5a415db96550d3ac5163a6c3dd3","f9a69ca445010b91fe08f08c06e0f86d79c0d776905f9bdb828477cb2a1eb7fc","ad7fd0e7ee457d4884b3aaecbcbd2a80b6803407c4ce2540c296170d4c7918ef","a50ef21605f41c6acad6c3ef0307e5311b94963c846ca093c764b80cdb5318d6","74b4035dd26d09a417c44ca23ab5ee69b173f8c2f6b2e47350ab0795cf2d4a17","918f86ee2b19cc38cb8b1a4cf8f223eb228aaa39df3604c42f700fac2f0b3ea1",{"version":"bbdf156fea2fabed31a569445835aeedcc33643d404fcbaa54541f06c109df3f","affectsGlobalScope":true},"381899b8d1d4c1be716f18cb5242ba39f66f4b1e31d45af62a32a99f8edcb39d","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"5917af4ff931b050dba49a1dedd9c00f15f7b3dc4345ad8491bfacd2ec68ed32","affectsGlobalScope":true},"a411d5c6b281a3820b7b16f4183e7b992e3afe0942d233ec9d25c641fd53476b","f0b28b3d6882f5e1d938ca97e5f33d1b3bd2d0fcf275a95a1ed6e4aae8db3d98","ec17a33de0166cd47421642635272df2893f5aca9e84bf8d08c4af617a6dbe9e","db829c3ac876762865ad7fd84ea0ed5be54823518399db1ca3af4572b6649e87","a41403e55f0a8b7d5b50dd7d1adac61caa18f69d7591c95cbe7e7d5bcaf37177","f9fd6e3ade5a1179d67ba174b2f4219ba5afa7c0b8817cd07e398f0ebccefbe7","5190f1a110a789c2f8ed8dcf2da6ce122dcb74249d0c01d19d1ed0b1c6bb02a1","3650bbe137c9c44bc6b8f44a56353b00eba9654e41a9355e6228f7f0f464c648","9c4f32d2fa2b6efeed4f9fbd98254121b17982110b48edcede96e2dc2af0894d",{"version":"5917af4ff931b050dba49a1dedd9c00f15f7b3dc4345ad8491bfacd2ec68ed32","affectsGlobalScope":true},"e59d00012fb20e6746def2f4bc94650526aa6c574c49ad6a50a992f61a3ee675","e47b8ec56eb49bc1c53c9012daa9874de14ad0c5da442485aec333571c74b526","e4dd91dd4789a109aab51d8a0569a282369fcda9ba6f2b2297bc61bacfb1a042","5d7018910750d9cb4a912577ad2951fc3fad83c30d637689b69ffc6bbb0c9f5a","d2d9e98a2b167079474768593e1e7125fc3db055add8fbdb5977e3d05a8a3696","6462da67490105ba7d98cf312c2faf8794c425781128b161ea8394d66502eec8","62359da52b6c8d00c50c2e50738fac82e902f916fdf458d8159e7edb1c60c3a8","1e0ac21bc775686383ea8c8e48bd98b385e6195b25c85525a7affd08a2cd38b9","0449615e1ed03c7d54fc435a63b7ef0cb4e5cea5ac40c9a63280a46f7eeae0ff","1dd3d421923d8f03af788abb7e9585e2cf2fe7365958e727928cbab8f691a9e8","bd0d80db12ef1aceefc4f9d3eb88517b9634fa747ae8475981da8655292feab8","55e68fb1618e3f55f7866b8c8415152159309a14b716370081ab0b7af96d876e","bf0491af2455f92282b61807be2be6e7ad7d532e47fac7b698019d3617c28ff7","5d874fb879ab8601c02549817dceb2d0a30729cb7e161625dd6f819bbff1ec0b","ee551a880882770c4f56a0964a9767c9feafe497a5be52652527d098c88d85cb","b192606574769a5566620f9bf19358a3994bc2726ecdeaad9c66f3333b2687c8","cafd444fa9429538f39b36d19967735f4ddd68afdf595ce8d6526b9535a32967","8da8943f5709102a1a172e59ad9ef8efcfad939c3fc3ce0931cee0e74b746415","06344dc54bd683361d1265df562bf28310dee42631351cbc73ec0662067a2662","5cc991dfbc9af88d5fad5edf08593065d9eefea81cd07a8277b28198645db0b6","bfa7ee495d0975bbeeaa6f005db167b9db4f1f92896f0669f2f124f9fb9cbed9","04960fe91185fc317b9f8d2d2604b4547c8ea3ec49563062c28ae95c89e06e3a","e6523d2db6e2ae8cf35fdc53199538d6817add78536b1a986c3a08513b7202e1","ce845faff6db3eb0e1d62ff1c6337f0bb1202b312dde69efd5addd5aa0389b07","cbf4ee77c80de53d71a1d076ea25eddd23541685119a67c43bd4aeaad8533b1f","215f6d27f88aeaa56a4e0fe358a6fe3b8b5f7c76a2f83663035028b0c2595b1f","f8d84deeb6367b306c78f83111f36b14a7cb786af0c3a93168ffc97a2e0916c9","c307c0c1d2a162347fe19da27d37ee9f333617a23686649acbe4190848225970","6bcfd3b6f61aedc9734a19729a0d1a8e7de6aa02621bf519d0a1276601fb1a74","fe43e4fd566293aee946e5db5b055db1215602498d315e468c6adaf1e6917fb4","ea912b91fed2f873b87e24180399baad37c43019b6f51b210e1d9f1d1d0135ba","a1cd2b1943db96616abf3a3f939dfd0eb69fab8149725d195a8acc7f5672a1f9","ddf5e2dd1897b3271acd68a587d43996e18c63ccc51b17f9149763a7d4bbadb7","1466691ae57846e0280465b012fd01aed3c4a4e0b39fcc11276833fbfc72ade7","b3ceffa2a65a5d7a6f0d6daf429d23dd301df58718ad07e397bfa28f7d8a2688","cfa03019dd5cdd18ff1b5f00b3cb37ac762faf9eca2e86ea2c718502285cf67b","4d8d7075a3381162b4ae5147f84b4d2a2ae49398d98bef7c4437b8db0fefb194","a8b1a9f91ecb89faabb130af767e007ee28ac6ca794565d856759bb87e42feb1","1b1c43c378278f5dfea558337b0e3d57944a806eb4f55330baba592967253350","5ad070af2f7e4b7a676a63137c6a6cf670144ee5f23a9a30b21c19e70bb077f3","df060b3639c427e1c09bcf5cc14975f00b296e53192c710ea76e4a658a382aa0","4dd037aee1fed84d54490818e9a32d12e3e2f75d1dd9816d25fb9a0ecacee3b9","ca84eb7ffe779cb8812ee0a6aa151adac3dd25c4dc877767f37d079e5b62151f","f1d5239e0cdfb4ddd24a47727b88871802d3d2b3fda70229b158525753ad643e","af89d09746be737e24c50de49f035f3afea14c11be30ad5d2764d142daaa4078","5422948be7ac69dd13078af8ce2a8d9ea4d79eb510bfc54b75586573185183f9","246fc68fbf5c3ae2fded7eebcc38e6c5bb0f2cb796096916d0e65505cfbe850f","fc35e9bf454dcd7c42bab9e51bdedd4c9a5662b8d9964b1204913e268cb1fe6f","6e278ba8dbcf2617a2c5f5805e3addd1cf1c35b75b7dde3cbdabbccbf926b6fe","a2e36dad616090f5bcb99c4491b8b34bf8f2b5bf2fdcd6b5a43ddfd23f1b8433","c9d56f52ca68c2c86ec5ba05d927ef3892dca4923bd3cebe6593ebbcdd7e70c3","419dd7c5f46e04ddc2a390070fe19423200334f464bcd41a8bac56007127a13d","067b19c3d1fde05a39e5b769cbb5f44e0f6cf201f52fa2cafedc3943ea2e9052","e3ea09f9ea097b88c98df19c52694ac83daab0692e90cea9cf3faff00087899f","02e1dfd21586ad4379dc0d0ab88283694734f786ed4dcffaf5fbe25b23cd4b62","e8764e82f28e0a7acb1edf0cd502de3c667ce0597ec8deefab4bddcb2273e4c7","4a43623f49489a0e0359e905dc2eaeb88c9bc5dce62819b9c04c8c60d79d2782","82e37f3013111a0a7abf743e89b074261bb92655bea624bb07ac77c6f0a94657","cf46c72956ce0ad410066196057812424d4ce17f2c4e1436d87fd0da9ee21830","d7865f701e0b27e883babea23a4aa1d1a8f37ccc502f7834b81d117401d689f4","2290ccf854da4cabed41ff4013869e463b16772b3f16ae308e382f91d516c895","198ebdc9a229972b281bb98bc86528dbbe00a91f6fd7b1a2d987f0f3f52157d8","50c61f235257b1c9068c41a5a50baeb4274ea5dfc07d2f86c4032617e30d0732","bc4724a288bcb43fb7248fdc5dc371c3faf8fced20033e4bb75f4eb09cfdf01d","d86f9f4afbec438f732d95dcb99b67b62d9efbf2b711464b65fd2d14ba15f75f","fa277bbe15a3e2945be2608ccb159208ef50ae95b5059acc01d8c453b1683fff","2ce70b0c8a1d1babeb3e7eb19b34ed0ecd8f935c26bbd0e8d6affc3fb46b22c3","de3f48d4ddc159b324db68d27fc8fdee4d0153ac872d292ecc05af01b4302d65","98d019534dd7c963b013eed9a2a2e8a96618e70a40730f6920614be6d410ef80","774f781a28c56874e245eadff141e5e52af54e5555d7e083fca45f06348841ed","96520a873073a2f39f922d0a422498cdcc28be9066a769000cdd07ecaba7b645","135aa6d18002bfec723f8697aa80a59648cf0582752d5e089b6eb0770b63a02d","b6eb8e23f4145ddbe22639779de710af7a554c9592f69f257b7ec5c487eb0695","831d99b85c6ced631649a70014e1288d3f927fa262e4009ba1fbcd11b965ce58","38fef887c5b2cae9d244172fe72957e61c3393bacc2be3ae5e2c1bf1e8a69e71","e064325c76ef07fec4cd69a91dabe717fae011bba5e15d81a2486ce25e80a91e","914d7cdcd8c7ebff500b43e8a878164ef0f93168eea0e5246747484a160d730b",{"version":"4169be501cd57005d1c910fa24cef850c2922596632b00096063f58d649ba85a","affectsGlobalScope":true},"abb6d9adcc79c591f712e79c55f769b48690ec66a55b6f6189569a0d357c7e58","e7669752758ae96e591040a264669535d7e65a8ce01f86812211fe39dc7bef6c","8ebd5899eefab0ba9bb82ae4cdd18aca44564a25cebfa51ea5d92db4252b49dd","62540abf0bac8bf8c13c183db0457c5495a2bdad157f9eb03916c3953feb765e","7fe68b17d28662b4c1232c578a3bce0532f2628b443ad541a196b124e4d93087","89eae3e00b2fbde1af73eab56e0ca7960c2dbc02c2ef89f98104ceb75526311b","88d3d5b21760947695c7d812e5992c5a80d938cafaf8ecf687e350bd230f5d25","11fb82c3644a70cf226676762f39dc6de87ef9dc11ed83e5ca52e013425cfd89","2d78a397234d9b3325910135668cffba83af759074ceadc0afd281795ca8b9fc","22f67790611304c6726a7e333265c1b64e472e78bb661f734a4cd715402d3e9f",{"version":"f254c1abf6bb4c92633159831f924588908da902aa5e04ae45c39bd001f62e2e","affectsGlobalScope":true}],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[142],[61],[57,58,59,60],[46],[45],[45,46,47,48,49,50,51,52,53,54,55],[48],[50],[82,83,84,85],[82],[83],[65],[61,62],[61,62,70,80],[62,80,87,88],[62,90],[62,80],[62,80,87],[80,150],[61,95,128,129],[61,80,87,131],[61,80,129,131],[63,80,153],[61,80,95,130,134,135,136,137],[63,129],[61,80,140],[61,80,129],[61,63,80,95,128],[61,80,128],[61,80],[61,129],[80],[61,80,95,142,143],[145],[63,64,80,153],[80,145],[146],[62,63,64,65,66,67,81,89,90,91,92,93,129,130,132,133,134,135,136,137,138,139,140,141,144,145,146,147,148,149,151,152,154,155,156,157,158],[56,61],[63],[86],[96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,120,121,122],[119],[123,124,125,126,127],[72],[72,73,75,76,77,78,79],[74],[61,72],[58,59,60,161],[68,69],[70],[94]],"referencedMap":[[143,1],[74,2],[61,3],[47,4],[48,5],[56,6],[49,5],[50,5],[51,7],[52,8],[46,5],[53,8],[54,5],[55,8],[86,9],[83,10],[84,11],[66,12],[67,13],[81,14],[89,15],[91,16],[92,17],[93,18],[151,19],[130,20],[132,21],[133,22],[154,23],[138,24],[139,25],[141,26],[156,27],[158,28],[134,29],[136,30],[135,30],[157,31],[90,32],[140,32],[144,33],[145,32],[137,30],[146,32],[147,34],[129,30],[149,30],[155,35],[148,36],[152,37],[159,38],[62,39],[64,40],[87,41],[123,42],[120,43],[128,44],[73,45],[80,46],[79,2],[75,47],[72,2],[78,48],[71,49],[70,50],[68,51],[95,52]],"exportedModulesMap":[[143,1],[74,2],[61,3],[47,4],[48,5],[56,6],[49,5],[50,5],[51,7],[52,8],[46,5],[53,8],[54,5],[55,8],[86,9],[83,10],[84,11],[66,12],[67,13],[81,14],[89,15],[91,16],[92,17],[93,18],[151,19],[130,20],[132,21],[133,22],[154,23],[138,24],[139,25],[141,26],[156,27],[158,28],[134,29],[136,30],[135,30],[157,31],[90,32],[140,32],[144,33],[145,32],[137,30],[146,32],[147,34],[129,30],[149,30],[155,35],[148,36],[152,37],[159,38],[62,39],[64,40],[87,41],[123,42],[120,43],[128,44],[73,45],[80,46],[79,2],[75,47],[72,2],[78,48],[71,49],[70,50],[68,51],[95,52]],"semanticDiagnosticsPerFile":[142,143,59,74,57,61,60,47,48,56,131,49,58,50,51,45,52,46,53,54,55,10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,153,82,85,86,83,84,66,67,65,81,89,88,91,92,93,151,130,132,133,154,138,139,141,156,158,134,136,135,157,90,140,144,145,137,146,147,129,149,155,148,152,159,62,63,64,87,125,119,96,99,97,98,102,100,101,123,113,118,103,104,105,106,121,107,108,109,110,120,112,115,111,122,117,114,116,126,128,124,127,73,80,77,79,75,72,78,76,71,69,70,68,95,94,150,160]},"version":"4.4.2"}