@wordpress/compose 8.4.0 → 8.6.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.
Files changed (221) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/build/higher-order/compose.cjs.map +2 -2
  3. package/build/higher-order/if-condition/index.cjs.map +2 -2
  4. package/build/higher-order/pure/index.cjs.map +2 -2
  5. package/build/higher-order/with-global-events/index.cjs.map +2 -2
  6. package/build/higher-order/with-instance-id/index.cjs.map +2 -2
  7. package/build/higher-order/with-safe-timeout/index.cjs +1 -1
  8. package/build/higher-order/with-safe-timeout/index.cjs.map +2 -2
  9. package/build/higher-order/with-state/index.cjs.map +2 -2
  10. package/build/hooks/use-async-list/index.cjs.map +2 -2
  11. package/build/hooks/use-constrained-tabbing/index.cjs.map +2 -2
  12. package/build/hooks/use-copy-on-click/index.cjs.map +2 -2
  13. package/build/hooks/use-copy-to-clipboard/index.cjs.map +2 -2
  14. package/build/hooks/use-debounce/index.cjs.map +2 -2
  15. package/build/hooks/use-debounced-input/index.cjs.map +2 -2
  16. package/build/hooks/use-dialog/index.cjs.map +2 -2
  17. package/build/hooks/use-disabled/index.cjs.map +2 -2
  18. package/build/hooks/use-dragging/index.cjs.map +2 -2
  19. package/build/hooks/use-drop-zone/index.cjs.map +2 -2
  20. package/build/hooks/use-event/index.cjs.map +2 -2
  21. package/build/hooks/use-fixed-window-list/index.cjs +98 -92
  22. package/build/hooks/use-fixed-window-list/index.cjs.map +3 -3
  23. package/build/hooks/use-focus-outside/index.cjs.map +2 -2
  24. package/build/hooks/use-focus-return/index.cjs.map +2 -2
  25. package/build/hooks/use-focusable-iframe/index.cjs.map +2 -2
  26. package/build/hooks/use-instance-id/index.cjs.map +2 -2
  27. package/build/hooks/use-isomorphic-layout-effect/index.cjs.map +2 -2
  28. package/build/hooks/use-keyboard-shortcut/index.cjs.map +2 -2
  29. package/build/hooks/use-media-query/index.cjs.map +2 -2
  30. package/build/hooks/use-merge-refs/index.cjs.map +2 -2
  31. package/build/hooks/use-observable-value/index.cjs.map +2 -2
  32. package/build/hooks/use-previous/index.cjs.map +2 -2
  33. package/build/hooks/use-reduced-motion/index.cjs.map +2 -2
  34. package/build/hooks/use-ref-effect/index.cjs.map +2 -2
  35. package/build/hooks/use-resize-observer/index.cjs.map +2 -2
  36. package/build/hooks/use-resize-observer/legacy/index.cjs.map +2 -2
  37. package/build/hooks/use-resize-observer/use-resize-observer.cjs.map +2 -2
  38. package/build/hooks/use-state-with-history/index.cjs.map +2 -2
  39. package/build/hooks/use-throttle/index.cjs.map +2 -2
  40. package/build/hooks/use-viewport-match/index.cjs +1 -1
  41. package/build/hooks/use-viewport-match/index.cjs.map +2 -2
  42. package/build/hooks/use-warn-on-change/index.cjs.map +2 -2
  43. package/build/lock-unlock.cjs.map +2 -2
  44. package/build/private-apis.cjs.map +2 -2
  45. package/build/utils/create-higher-order-component/index.cjs.map +2 -2
  46. package/build/utils/throttle/index.cjs.map +2 -2
  47. package/build-module/higher-order/compose.mjs.map +2 -2
  48. package/build-module/higher-order/if-condition/index.mjs.map +2 -2
  49. package/build-module/higher-order/pure/index.mjs.map +2 -2
  50. package/build-module/higher-order/with-global-events/index.mjs.map +2 -2
  51. package/build-module/higher-order/with-instance-id/index.mjs.map +2 -2
  52. package/build-module/higher-order/with-safe-timeout/index.mjs +1 -1
  53. package/build-module/higher-order/with-safe-timeout/index.mjs.map +2 -2
  54. package/build-module/higher-order/with-state/index.mjs.map +2 -2
  55. package/build-module/hooks/use-async-list/index.mjs.map +2 -2
  56. package/build-module/hooks/use-constrained-tabbing/index.mjs.map +2 -2
  57. package/build-module/hooks/use-copy-on-click/index.mjs.map +2 -2
  58. package/build-module/hooks/use-copy-to-clipboard/index.mjs.map +2 -2
  59. package/build-module/hooks/use-debounce/index.mjs.map +2 -2
  60. package/build-module/hooks/use-debounced-input/index.mjs.map +2 -2
  61. package/build-module/hooks/use-dialog/index.mjs.map +2 -2
  62. package/build-module/hooks/use-disabled/index.mjs.map +2 -2
  63. package/build-module/hooks/use-dragging/index.mjs.map +2 -2
  64. package/build-module/hooks/use-drop-zone/index.mjs.map +2 -2
  65. package/build-module/hooks/use-event/index.mjs.map +2 -2
  66. package/build-module/hooks/use-fixed-window-list/index.mjs +89 -93
  67. package/build-module/hooks/use-fixed-window-list/index.mjs.map +2 -2
  68. package/build-module/hooks/use-focus-outside/index.mjs.map +2 -2
  69. package/build-module/hooks/use-focus-return/index.mjs.map +2 -2
  70. package/build-module/hooks/use-focusable-iframe/index.mjs.map +2 -2
  71. package/build-module/hooks/use-instance-id/index.mjs.map +2 -2
  72. package/build-module/hooks/use-isomorphic-layout-effect/index.mjs.map +2 -2
  73. package/build-module/hooks/use-keyboard-shortcut/index.mjs.map +2 -2
  74. package/build-module/hooks/use-media-query/index.mjs.map +2 -2
  75. package/build-module/hooks/use-merge-refs/index.mjs.map +2 -2
  76. package/build-module/hooks/use-observable-value/index.mjs.map +2 -2
  77. package/build-module/hooks/use-previous/index.mjs.map +2 -2
  78. package/build-module/hooks/use-reduced-motion/index.mjs.map +2 -2
  79. package/build-module/hooks/use-ref-effect/index.mjs.map +2 -2
  80. package/build-module/hooks/use-resize-observer/index.mjs.map +2 -2
  81. package/build-module/hooks/use-resize-observer/legacy/index.mjs.map +2 -2
  82. package/build-module/hooks/use-resize-observer/use-resize-observer.mjs.map +2 -2
  83. package/build-module/hooks/use-state-with-history/index.mjs.map +2 -2
  84. package/build-module/hooks/use-throttle/index.mjs.map +2 -2
  85. package/build-module/hooks/use-viewport-match/index.mjs +1 -1
  86. package/build-module/hooks/use-viewport-match/index.mjs.map +2 -2
  87. package/build-module/hooks/use-warn-on-change/index.mjs.map +2 -2
  88. package/build-module/lock-unlock.mjs.map +2 -2
  89. package/build-module/private-apis.mjs.map +2 -2
  90. package/build-module/utils/create-higher-order-component/index.mjs.map +2 -2
  91. package/build-module/utils/throttle/index.mjs.map +2 -2
  92. package/build-types/higher-order/compose.d.ts.map +1 -1
  93. package/build-types/higher-order/if-condition/index.d.ts +0 -3
  94. package/build-types/higher-order/if-condition/index.d.ts.map +1 -1
  95. package/build-types/higher-order/pure/index.d.ts +0 -3
  96. package/build-types/higher-order/pure/index.d.ts.map +1 -1
  97. package/build-types/higher-order/with-global-events/index.d.ts.map +1 -1
  98. package/build-types/higher-order/with-instance-id/index.d.ts +0 -3
  99. package/build-types/higher-order/with-instance-id/index.d.ts.map +1 -1
  100. package/build-types/higher-order/with-safe-timeout/index.d.ts +0 -3
  101. package/build-types/higher-order/with-safe-timeout/index.d.ts.map +1 -1
  102. package/build-types/higher-order/with-state/index.d.ts.map +1 -1
  103. package/build-types/hooks/use-async-list/index.d.ts.map +1 -1
  104. package/build-types/hooks/use-constrained-tabbing/index.d.ts.map +1 -1
  105. package/build-types/hooks/use-copy-on-click/index.d.ts.map +1 -1
  106. package/build-types/hooks/use-copy-to-clipboard/index.d.ts.map +1 -1
  107. package/build-types/hooks/use-debounce/index.d.ts.map +1 -1
  108. package/build-types/hooks/use-debounced-input/index.d.ts.map +1 -1
  109. package/build-types/hooks/use-dialog/index.d.ts +0 -3
  110. package/build-types/hooks/use-dialog/index.d.ts.map +1 -1
  111. package/build-types/hooks/use-disabled/index.d.ts.map +1 -1
  112. package/build-types/hooks/use-dragging/index.d.ts.map +1 -1
  113. package/build-types/hooks/use-drop-zone/index.d.ts.map +1 -1
  114. package/build-types/hooks/use-event/index.d.ts.map +1 -1
  115. package/build-types/hooks/use-fixed-window-list/index.d.ts +1 -1
  116. package/build-types/hooks/use-fixed-window-list/index.d.ts.map +1 -1
  117. package/build-types/hooks/use-focus-outside/index.d.ts.map +1 -1
  118. package/build-types/hooks/use-focus-return/index.d.ts.map +1 -1
  119. package/build-types/hooks/use-focusable-iframe/index.d.ts +0 -3
  120. package/build-types/hooks/use-focusable-iframe/index.d.ts.map +1 -1
  121. package/build-types/hooks/use-instance-id/index.d.ts.map +1 -1
  122. package/build-types/hooks/use-isomorphic-layout-effect/index.d.ts +0 -3
  123. package/build-types/hooks/use-isomorphic-layout-effect/index.d.ts.map +1 -1
  124. package/build-types/hooks/use-keyboard-shortcut/index.d.ts +0 -3
  125. package/build-types/hooks/use-keyboard-shortcut/index.d.ts.map +1 -1
  126. package/build-types/hooks/use-media-query/index.d.ts.map +1 -1
  127. package/build-types/hooks/use-merge-refs/index.d.ts.map +1 -1
  128. package/build-types/hooks/use-observable-value/index.d.ts +0 -3
  129. package/build-types/hooks/use-observable-value/index.d.ts.map +1 -1
  130. package/build-types/hooks/use-previous/index.d.ts.map +1 -1
  131. package/build-types/hooks/use-reduced-motion/index.d.ts.map +1 -1
  132. package/build-types/hooks/use-ref-effect/index.d.ts +0 -3
  133. package/build-types/hooks/use-ref-effect/index.d.ts.map +1 -1
  134. package/build-types/hooks/use-resize-observer/index.d.ts +1 -4
  135. package/build-types/hooks/use-resize-observer/index.d.ts.map +1 -1
  136. package/build-types/hooks/use-resize-observer/legacy/index.d.ts +0 -3
  137. package/build-types/hooks/use-resize-observer/legacy/index.d.ts.map +1 -1
  138. package/build-types/hooks/use-resize-observer/use-resize-observer.d.ts.map +1 -1
  139. package/build-types/hooks/use-state-with-history/index.d.ts.map +1 -1
  140. package/build-types/hooks/use-throttle/index.d.ts.map +1 -1
  141. package/build-types/hooks/use-viewport-match/index.d.ts.map +1 -1
  142. package/build-types/hooks/use-warn-on-change/index.d.ts.map +1 -1
  143. package/build-types/lock-unlock.d.ts.map +1 -1
  144. package/build-types/private-apis.d.ts.map +1 -1
  145. package/build-types/utils/create-higher-order-component/index.d.ts.map +1 -1
  146. package/build-types/utils/throttle/index.d.ts +0 -39
  147. package/build-types/utils/throttle/index.d.ts.map +1 -1
  148. package/package.json +10 -10
  149. package/src/higher-order/compose.ts +0 -3
  150. package/src/higher-order/if-condition/index.tsx +0 -7
  151. package/src/higher-order/pure/index.tsx +0 -11
  152. package/src/higher-order/pure/test/index.js +0 -11
  153. package/src/higher-order/test/compose.ts +0 -3
  154. package/src/higher-order/test/pipe.ts +0 -3
  155. package/src/higher-order/with-global-events/index.js +0 -8
  156. package/src/higher-order/with-global-events/test/index.js +0 -11
  157. package/src/higher-order/with-global-events/test/listener.js +0 -3
  158. package/src/higher-order/with-instance-id/README.md +0 -3
  159. package/src/higher-order/with-instance-id/index.tsx +1 -4
  160. package/src/higher-order/with-instance-id/test/index.js +0 -7
  161. package/src/higher-order/with-safe-timeout/README.md +0 -3
  162. package/src/higher-order/with-safe-timeout/index.tsx +1 -8
  163. package/src/higher-order/with-state/README.md +0 -3
  164. package/src/higher-order/with-state/index.js +0 -7
  165. package/src/higher-order/with-state/test/index.js +0 -7
  166. package/src/hooks/use-async-list/index.ts +0 -3
  167. package/src/hooks/use-constrained-tabbing/index.ts +0 -7
  168. package/src/hooks/use-copy-on-click/index.ts +0 -7
  169. package/src/hooks/use-copy-on-click/test/index.tsx +0 -11
  170. package/src/hooks/use-copy-to-clipboard/index.ts +0 -7
  171. package/src/hooks/use-copy-to-clipboard/test/index.tsx +0 -7
  172. package/src/hooks/use-debounce/index.ts +0 -11
  173. package/src/hooks/use-debounced-input/index.ts +0 -7
  174. package/src/hooks/use-dialog/index.ts +0 -11
  175. package/src/hooks/use-dialog/test/index.tsx +0 -7
  176. package/src/hooks/use-disabled/index.ts +0 -3
  177. package/src/hooks/use-disabled/test/index.js +0 -11
  178. package/src/hooks/use-dragging/README.md +0 -3
  179. package/src/hooks/use-dragging/index.ts +0 -7
  180. package/src/hooks/use-drop-zone/index.ts +0 -3
  181. package/src/hooks/use-drop-zone/test/index.js +0 -11
  182. package/src/hooks/use-event/index.ts +0 -3
  183. package/src/hooks/use-fixed-window-list/index.ts +128 -116
  184. package/src/hooks/use-focus-outside/index.ts +0 -3
  185. package/src/hooks/use-focus-outside/test/index.js +0 -7
  186. package/src/hooks/use-focus-return/index.ts +0 -3
  187. package/src/hooks/use-focusable-iframe/index.ts +0 -7
  188. package/src/hooks/use-instance-id/README.md +0 -3
  189. package/src/hooks/use-instance-id/index.ts +0 -3
  190. package/src/hooks/use-instance-id/test/index.js +0 -7
  191. package/src/hooks/use-isomorphic-layout-effect/index.ts +0 -3
  192. package/src/hooks/use-keyboard-shortcut/index.ts +0 -7
  193. package/src/hooks/use-media-query/index.ts +0 -3
  194. package/src/hooks/use-media-query/test/index.js +0 -7
  195. package/src/hooks/use-media-query/test/ssr.js +0 -8
  196. package/src/hooks/use-merge-refs/index.ts +0 -3
  197. package/src/hooks/use-merge-refs/test/index.js +0 -11
  198. package/src/hooks/use-observable-value/index.ts +0 -7
  199. package/src/hooks/use-observable-value/test/index.js +0 -7
  200. package/src/hooks/use-previous/README.md +0 -3
  201. package/src/hooks/use-previous/index.ts +0 -3
  202. package/src/hooks/use-reduced-motion/index.ts +0 -3
  203. package/src/hooks/use-ref-effect/index.ts +0 -7
  204. package/src/hooks/use-resize-observer/index.ts +1 -7
  205. package/src/hooks/use-resize-observer/legacy/index.tsx +0 -10
  206. package/src/hooks/use-resize-observer/use-resize-observer.ts +0 -6
  207. package/src/hooks/use-state-with-history/index.ts +0 -3
  208. package/src/hooks/use-state-with-history/test/index.js +0 -7
  209. package/src/hooks/use-throttle/index.ts +0 -11
  210. package/src/hooks/use-viewport-match/index.ts +3 -8
  211. package/src/hooks/use-viewport-match/test/index.js +6 -15
  212. package/src/hooks/use-warn-on-change/index.ts +0 -3
  213. package/src/lock-unlock.ts +0 -3
  214. package/src/private-apis.ts +0 -3
  215. package/src/utils/create-higher-order-component/index.ts +0 -3
  216. package/src/utils/create-higher-order-component/test/index.js +0 -7
  217. package/src/utils/debounce/test/index.ts +0 -3
  218. package/src/utils/observable-map/test/index.js +0 -3
  219. package/src/utils/subscribe-delegated-listener/test/index.js +0 -3
  220. package/src/utils/throttle/index.ts +0 -4
  221. package/src/utils/throttle/test/index.ts +0 -3
@@ -1,10 +1,4 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
1
  import { useRef } from '@wordpress/element';
5
- /**
6
- * Internal dependencies
7
- */
8
2
  import useEvent from '../use-event';
9
3
 
10
4
  // This is the current implementation of `useResizeObserver`.
@@ -1,6 +1,3 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
1
  import { createUndoManager } from '@wordpress/undo-manager';
5
2
  import { useCallback, useReducer } from '@wordpress/element';
6
3
  import type { UndoManager } from '@wordpress/undo-manager';
@@ -1,11 +1,4 @@
1
- /**
2
- * External dependencies
3
- */
4
1
  import { screen, render, fireEvent } from '@testing-library/react';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
2
  import useStateWithHistory from '../';
10
3
 
11
4
  const TestComponent = () => {
@@ -1,16 +1,5 @@
1
- /**
2
- * External dependencies
3
- */
4
1
  import { useMemoOne } from 'use-memo-one';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
2
  import { useEffect } from '@wordpress/element';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
3
  import { throttle } from '../../utils/throttle';
15
4
  import type { ThrottleOptions } from '../../utils/throttle';
16
5
  import type { DebouncedFunc } from '../../utils/debounce';
@@ -1,11 +1,4 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
1
  import { createContext, useContext } from '@wordpress/element';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
2
  import useMediaQuery from '../use-media-query';
10
3
 
11
4
  type Breakpoint =
@@ -83,9 +76,11 @@ const useViewportMatch = (
83
76
  : undefined
84
77
  ): boolean => {
85
78
  const simulatedWidth = useContext( ViewportMatchWidthContext );
79
+ // Scoped to `screen` so printing, which matches against the page box,
80
+ // does not read as a narrower viewport.
86
81
  const mediaQuery =
87
82
  ! simulatedWidth &&
88
- `(${ CONDITIONS[ operator ] }: ${ BREAKPOINTS[ breakpoint ] }px)`;
83
+ `screen and (${ CONDITIONS[ operator ] }: ${ BREAKPOINTS[ breakpoint ] }px)`;
89
84
  const mediaQueryResult = useMediaQuery( mediaQuery || undefined, view );
90
85
 
91
86
  if ( simulatedWidth ) {
@@ -1,17 +1,8 @@
1
- /**
2
- * External dependencies
3
- */
4
1
  import { render } from '@testing-library/react';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
2
  import useViewportMatch from '../';
10
-
11
3
  jest.mock( '../../use-media-query', () => {
12
4
  return jest.fn();
13
5
  } );
14
-
15
6
  import useMediaQueryMock from '../../use-media-query';
16
7
 
17
8
  describe( 'useViewportMatch', () => {
@@ -44,17 +35,17 @@ describe( 'useViewportMatch', () => {
44
35
  expect( useMediaQueryMock ).toHaveBeenCalledTimes( 3 );
45
36
  expect( useMediaQueryMock ).toHaveBeenNthCalledWith(
46
37
  1,
47
- '(max-width: 1280px)',
38
+ 'screen and (max-width: 1280px)',
48
39
  window
49
40
  );
50
41
  expect( useMediaQueryMock ).toHaveBeenNthCalledWith(
51
42
  2,
52
- '(min-width: 782px)',
43
+ 'screen and (min-width: 782px)',
53
44
  window
54
45
  );
55
46
  expect( useMediaQueryMock ).toHaveBeenNthCalledWith(
56
47
  3,
57
- '(min-width: 600px)',
48
+ 'screen and (min-width: 600px)',
58
49
  window
59
50
  );
60
51
  } );
@@ -79,17 +70,17 @@ describe( 'useViewportMatch', () => {
79
70
  expect( useMediaQueryMock ).toHaveBeenCalledTimes( 3 );
80
71
  expect( useMediaQueryMock ).toHaveBeenNthCalledWith(
81
72
  1,
82
- '(min-width: 1440px)',
73
+ 'screen and (min-width: 1440px)',
83
74
  window
84
75
  );
85
76
  expect( useMediaQueryMock ).toHaveBeenNthCalledWith(
86
77
  2,
87
- '(max-width: 960px)',
78
+ 'screen and (max-width: 960px)',
88
79
  window
89
80
  );
90
81
  expect( useMediaQueryMock ).toHaveBeenNthCalledWith(
91
82
  3,
92
- '(max-width: 480px)',
83
+ 'screen and (max-width: 480px)',
93
84
  window
94
85
  );
95
86
  } );
@@ -1,6 +1,3 @@
1
- /**
2
- * Internal dependencies
3
- */
4
1
  import usePrevious from '../use-previous';
5
2
 
6
3
  /**
@@ -1,6 +1,3 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
1
  import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
5
2
 
6
3
  export const { lock, unlock } =
@@ -1,6 +1,3 @@
1
- /**
2
- * Internal dependencies
3
- */
4
1
  import { lock } from './lock-unlock';
5
2
  import subscribeDelegatedListener from './utils/subscribe-delegated-listener';
6
3
 
@@ -1,6 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
1
  import { pascalCase } from 'change-case';
5
2
  import type { ComponentType } from 'react';
6
3
 
@@ -1,11 +1,4 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
1
  import { Component } from '@wordpress/element';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
2
  import { createHigherOrderComponent } from '../';
10
3
 
11
4
  describe( 'createHigherOrderComponent', () => {
@@ -1,6 +1,3 @@
1
- /**
2
- * Internal dependencies
3
- */
4
1
  import { debounce } from '../index';
5
2
 
6
3
  const identity = ( value ) => value;
@@ -1,6 +1,3 @@
1
- /**
2
- * Internal dependencies
3
- */
4
1
  import { observableMap } from '..';
5
2
 
6
3
  describe( 'ObservableMap', () => {
@@ -1,6 +1,3 @@
1
- /**
2
- * Internal dependencies
3
- */
4
1
  import subscribeDelegatedListener from '..';
5
2
 
6
3
  describe( 'subscribeDelegatedListener', () => {
@@ -37,10 +37,6 @@
37
37
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38
38
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39
39
  */
40
-
41
- /**
42
- * Internal dependencies
43
- */
44
40
  import { debounce } from '../debounce';
45
41
 
46
42
  export interface ThrottleOptions {
@@ -1,6 +1,3 @@
1
- /**
2
- * Internal dependencies
3
- */
4
1
  import { throttle } from '../index';
5
2
 
6
3
  const identity = ( value ) => value;