@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.
Files changed (89) hide show
  1. package/README.md +12 -3
  2. package/build/higher-order/if-condition/index.js.map +1 -1
  3. package/build/higher-order/pure/index.js.map +1 -1
  4. package/build/higher-order/with-instance-id/index.js.map +1 -1
  5. package/build/higher-order/with-safe-timeout/index.js.map +1 -1
  6. package/build/hooks/use-constrained-tabbing/index.js +46 -43
  7. package/build/hooks/use-constrained-tabbing/index.js.map +1 -1
  8. package/build/hooks/use-debounce/index.js +1 -1
  9. package/build/hooks/use-debounce/index.js.map +1 -1
  10. package/build/hooks/use-drop-zone/index.js +12 -6
  11. package/build/hooks/use-drop-zone/index.js.map +1 -1
  12. package/build/hooks/use-fixed-window-list/index.js +175 -0
  13. package/build/hooks/use-fixed-window-list/index.js.map +1 -0
  14. package/build/hooks/use-focusable-iframe/index.js +50 -0
  15. package/build/hooks/use-focusable-iframe/index.js.map +1 -0
  16. package/build/hooks/use-previous/index.js +3 -14
  17. package/build/hooks/use-previous/index.js.map +1 -1
  18. package/build/hooks/use-reduced-motion/index.js +1 -7
  19. package/build/hooks/use-reduced-motion/index.js.map +1 -1
  20. package/build/hooks/use-throttle/index.js +1 -1
  21. package/build/hooks/use-throttle/index.js.map +1 -1
  22. package/build/index.js +16 -0
  23. package/build/index.js.map +1 -1
  24. package/build-module/higher-order/if-condition/index.js +1 -1
  25. package/build-module/higher-order/if-condition/index.js.map +1 -1
  26. package/build-module/higher-order/pure/index.js +1 -1
  27. package/build-module/higher-order/pure/index.js.map +1 -1
  28. package/build-module/higher-order/with-instance-id/index.js +1 -2
  29. package/build-module/higher-order/with-instance-id/index.js.map +1 -1
  30. package/build-module/higher-order/with-safe-timeout/index.js +1 -1
  31. package/build-module/higher-order/with-safe-timeout/index.js.map +1 -1
  32. package/build-module/hooks/use-constrained-tabbing/index.js +41 -40
  33. package/build-module/hooks/use-constrained-tabbing/index.js.map +1 -1
  34. package/build-module/hooks/use-debounce/index.js +1 -1
  35. package/build-module/hooks/use-debounce/index.js.map +1 -1
  36. package/build-module/hooks/use-drop-zone/index.js +12 -6
  37. package/build-module/hooks/use-drop-zone/index.js.map +1 -1
  38. package/build-module/hooks/use-fixed-window-list/index.js +164 -0
  39. package/build-module/hooks/use-fixed-window-list/index.js.map +1 -0
  40. package/build-module/hooks/use-focusable-iframe/index.js +40 -0
  41. package/build-module/hooks/use-focusable-iframe/index.js.map +1 -0
  42. package/build-module/hooks/use-previous/index.js +3 -14
  43. package/build-module/hooks/use-previous/index.js.map +1 -1
  44. package/build-module/hooks/use-reduced-motion/index.js +2 -8
  45. package/build-module/hooks/use-reduced-motion/index.js.map +1 -1
  46. package/build-module/hooks/use-throttle/index.js +1 -1
  47. package/build-module/hooks/use-throttle/index.js.map +1 -1
  48. package/build-module/index.js +2 -0
  49. package/build-module/index.js.map +1 -1
  50. package/build-types/higher-order/if-condition/index.d.ts.map +1 -1
  51. package/build-types/higher-order/pure/index.d.ts.map +1 -1
  52. package/build-types/higher-order/with-instance-id/index.d.ts.map +1 -1
  53. package/build-types/higher-order/with-safe-timeout/index.d.ts.map +1 -1
  54. package/build-types/hooks/use-constrained-tabbing/index.d.ts.map +1 -1
  55. package/build-types/hooks/use-debounce/index.d.ts +2 -2
  56. package/build-types/hooks/use-debounce/index.d.ts.map +1 -1
  57. package/build-types/hooks/use-drop-zone/index.d.ts.map +1 -1
  58. package/build-types/hooks/use-fixed-window-list/index.d.ts +57 -0
  59. package/build-types/hooks/use-fixed-window-list/index.d.ts.map +1 -0
  60. package/build-types/hooks/use-focus-outside/index.d.ts +3 -3
  61. package/build-types/hooks/use-focus-outside/index.d.ts.map +1 -1
  62. package/build-types/hooks/use-focusable-iframe/index.d.ts +8 -0
  63. package/build-types/hooks/use-focusable-iframe/index.d.ts.map +1 -0
  64. package/build-types/hooks/use-previous/index.d.ts +2 -4
  65. package/build-types/hooks/use-previous/index.d.ts.map +1 -1
  66. package/build-types/hooks/use-reduced-motion/index.d.ts +5 -0
  67. package/build-types/hooks/use-reduced-motion/index.d.ts.map +1 -1
  68. package/build-types/hooks/use-throttle/index.d.ts +2 -2
  69. package/build-types/hooks/use-throttle/index.d.ts.map +1 -1
  70. package/build-types/hooks/use-viewport-match/index.d.ts +2 -2
  71. package/build-types/hooks/use-viewport-match/index.d.ts.map +1 -1
  72. package/build-types/index.d.ts +2 -0
  73. package/package.json +9 -9
  74. package/src/higher-order/if-condition/index.tsx +0 -1
  75. package/src/higher-order/pure/index.tsx +0 -1
  76. package/src/higher-order/with-instance-id/index.tsx +0 -1
  77. package/src/higher-order/with-safe-timeout/index.tsx +0 -1
  78. package/src/hooks/use-constrained-tabbing/index.js +39 -33
  79. package/src/hooks/use-debounce/index.js +1 -1
  80. package/src/hooks/use-drop-zone/index.js +11 -9
  81. package/src/hooks/use-fixed-window-list/index.js +174 -0
  82. package/src/hooks/use-focusable-iframe/README.md +29 -0
  83. package/src/hooks/use-focusable-iframe/index.js +34 -0
  84. package/src/hooks/use-previous/index.ts +24 -0
  85. package/src/hooks/use-reduced-motion/index.js +2 -13
  86. package/src/hooks/use-throttle/index.js +1 -1
  87. package/src/index.js +2 -0
  88. package/tsconfig.tsbuildinfo +1 -1694
  89. 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
- }