@wordpress/compose 5.0.1 → 5.0.5
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/README.md +12 -3
- package/build/higher-order/if-condition/index.js.map +1 -1
- package/build/higher-order/pure/index.js.map +1 -1
- package/build/higher-order/with-instance-id/index.js.map +1 -1
- package/build/higher-order/with-safe-timeout/index.js.map +1 -1
- package/build/hooks/use-constrained-tabbing/index.js +46 -43
- package/build/hooks/use-constrained-tabbing/index.js.map +1 -1
- package/build/hooks/use-debounce/index.js +1 -1
- package/build/hooks/use-debounce/index.js.map +1 -1
- package/build/hooks/use-drop-zone/index.js +12 -6
- package/build/hooks/use-drop-zone/index.js.map +1 -1
- package/build/hooks/use-fixed-window-list/index.js +175 -0
- package/build/hooks/use-fixed-window-list/index.js.map +1 -0
- package/build/hooks/use-focusable-iframe/index.js +50 -0
- package/build/hooks/use-focusable-iframe/index.js.map +1 -0
- package/build/hooks/use-previous/index.js +3 -14
- package/build/hooks/use-previous/index.js.map +1 -1
- package/build/hooks/use-reduced-motion/index.js +1 -7
- package/build/hooks/use-reduced-motion/index.js.map +1 -1
- package/build/hooks/use-throttle/index.js +1 -1
- package/build/hooks/use-throttle/index.js.map +1 -1
- package/build/index.js +16 -0
- package/build/index.js.map +1 -1
- package/build-module/higher-order/if-condition/index.js +1 -1
- package/build-module/higher-order/if-condition/index.js.map +1 -1
- package/build-module/higher-order/pure/index.js +1 -1
- package/build-module/higher-order/pure/index.js.map +1 -1
- package/build-module/higher-order/with-instance-id/index.js +1 -2
- package/build-module/higher-order/with-instance-id/index.js.map +1 -1
- package/build-module/higher-order/with-safe-timeout/index.js +1 -1
- package/build-module/higher-order/with-safe-timeout/index.js.map +1 -1
- package/build-module/hooks/use-constrained-tabbing/index.js +41 -40
- package/build-module/hooks/use-constrained-tabbing/index.js.map +1 -1
- package/build-module/hooks/use-debounce/index.js +1 -1
- package/build-module/hooks/use-debounce/index.js.map +1 -1
- package/build-module/hooks/use-drop-zone/index.js +12 -6
- package/build-module/hooks/use-drop-zone/index.js.map +1 -1
- package/build-module/hooks/use-fixed-window-list/index.js +164 -0
- package/build-module/hooks/use-fixed-window-list/index.js.map +1 -0
- package/build-module/hooks/use-focusable-iframe/index.js +40 -0
- package/build-module/hooks/use-focusable-iframe/index.js.map +1 -0
- package/build-module/hooks/use-previous/index.js +3 -14
- package/build-module/hooks/use-previous/index.js.map +1 -1
- package/build-module/hooks/use-reduced-motion/index.js +2 -8
- package/build-module/hooks/use-reduced-motion/index.js.map +1 -1
- package/build-module/hooks/use-throttle/index.js +1 -1
- package/build-module/hooks/use-throttle/index.js.map +1 -1
- package/build-module/index.js +2 -0
- package/build-module/index.js.map +1 -1
- package/build-types/higher-order/if-condition/index.d.ts.map +1 -1
- package/build-types/higher-order/pure/index.d.ts.map +1 -1
- package/build-types/higher-order/with-instance-id/index.d.ts.map +1 -1
- package/build-types/higher-order/with-safe-timeout/index.d.ts.map +1 -1
- package/build-types/hooks/use-constrained-tabbing/index.d.ts.map +1 -1
- package/build-types/hooks/use-debounce/index.d.ts +2 -2
- package/build-types/hooks/use-debounce/index.d.ts.map +1 -1
- package/build-types/hooks/use-drop-zone/index.d.ts.map +1 -1
- package/build-types/hooks/use-fixed-window-list/index.d.ts +57 -0
- package/build-types/hooks/use-fixed-window-list/index.d.ts.map +1 -0
- package/build-types/hooks/use-focus-outside/index.d.ts +3 -3
- package/build-types/hooks/use-focus-outside/index.d.ts.map +1 -1
- package/build-types/hooks/use-focusable-iframe/index.d.ts +8 -0
- package/build-types/hooks/use-focusable-iframe/index.d.ts.map +1 -0
- package/build-types/hooks/use-previous/index.d.ts +2 -4
- package/build-types/hooks/use-previous/index.d.ts.map +1 -1
- package/build-types/hooks/use-reduced-motion/index.d.ts +5 -0
- package/build-types/hooks/use-reduced-motion/index.d.ts.map +1 -1
- package/build-types/hooks/use-throttle/index.d.ts +2 -2
- package/build-types/hooks/use-throttle/index.d.ts.map +1 -1
- package/build-types/hooks/use-viewport-match/index.d.ts +2 -2
- package/build-types/hooks/use-viewport-match/index.d.ts.map +1 -1
- package/build-types/index.d.ts +2 -0
- package/package.json +9 -9
- package/src/higher-order/if-condition/index.tsx +0 -1
- package/src/higher-order/pure/index.tsx +0 -1
- package/src/higher-order/with-instance-id/index.tsx +0 -1
- package/src/higher-order/with-safe-timeout/index.tsx +0 -1
- package/src/hooks/use-constrained-tabbing/index.js +39 -33
- package/src/hooks/use-debounce/index.js +1 -1
- package/src/hooks/use-drop-zone/index.js +11 -9
- package/src/hooks/use-fixed-window-list/index.js +174 -0
- package/src/hooks/use-focusable-iframe/README.md +29 -0
- package/src/hooks/use-focusable-iframe/index.js +34 -0
- package/src/hooks/use-previous/index.ts +24 -0
- package/src/hooks/use-reduced-motion/index.js +2 -13
- package/src/hooks/use-throttle/index.js +1 -1
- package/src/index.js +2 -0
- package/tsconfig.tsbuildinfo +1 -1694
- package/src/hooks/use-previous/index.js +0 -31
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useEffect, useRef } from '@wordpress/element';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Use something's value from the previous render.
|
|
8
|
-
* Based on https://usehooks.com/usePrevious/.
|
|
9
|
-
*
|
|
10
|
-
* @template T
|
|
11
|
-
*
|
|
12
|
-
* @param {T} value The value to track.
|
|
13
|
-
*
|
|
14
|
-
* @return {T | undefined} The value from the previous render.
|
|
15
|
-
*/
|
|
16
|
-
export default function usePrevious( value ) {
|
|
17
|
-
// Disable reason: without an explicit type detail, the type of ref will be
|
|
18
|
-
// inferred based on the initial useRef argument, which is undefined.
|
|
19
|
-
// https://github.com/WordPress/gutenberg/pull/22597#issuecomment-633588366
|
|
20
|
-
/* eslint-disable jsdoc/no-undefined-types */
|
|
21
|
-
const ref = useRef( /** @type {T | undefined} */ ( undefined ) );
|
|
22
|
-
/* eslint-enable jsdoc/no-undefined-types */
|
|
23
|
-
|
|
24
|
-
// Store current value in ref.
|
|
25
|
-
useEffect( () => {
|
|
26
|
-
ref.current = value;
|
|
27
|
-
}, [ value ] ); // Re-run when value changes.
|
|
28
|
-
|
|
29
|
-
// Return previous value (happens before update in useEffect above).
|
|
30
|
-
return ref.current;
|
|
31
|
-
}
|