@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.
- package/CHANGELOG.md +13 -0
- package/build/higher-order/compose.cjs.map +2 -2
- package/build/higher-order/if-condition/index.cjs.map +2 -2
- package/build/higher-order/pure/index.cjs.map +2 -2
- package/build/higher-order/with-global-events/index.cjs.map +2 -2
- package/build/higher-order/with-instance-id/index.cjs.map +2 -2
- package/build/higher-order/with-safe-timeout/index.cjs +1 -1
- package/build/higher-order/with-safe-timeout/index.cjs.map +2 -2
- package/build/higher-order/with-state/index.cjs.map +2 -2
- package/build/hooks/use-async-list/index.cjs.map +2 -2
- package/build/hooks/use-constrained-tabbing/index.cjs.map +2 -2
- package/build/hooks/use-copy-on-click/index.cjs.map +2 -2
- package/build/hooks/use-copy-to-clipboard/index.cjs.map +2 -2
- package/build/hooks/use-debounce/index.cjs.map +2 -2
- package/build/hooks/use-debounced-input/index.cjs.map +2 -2
- package/build/hooks/use-dialog/index.cjs.map +2 -2
- package/build/hooks/use-disabled/index.cjs.map +2 -2
- package/build/hooks/use-dragging/index.cjs.map +2 -2
- package/build/hooks/use-drop-zone/index.cjs.map +2 -2
- package/build/hooks/use-event/index.cjs.map +2 -2
- package/build/hooks/use-fixed-window-list/index.cjs +98 -92
- package/build/hooks/use-fixed-window-list/index.cjs.map +3 -3
- package/build/hooks/use-focus-outside/index.cjs.map +2 -2
- package/build/hooks/use-focus-return/index.cjs.map +2 -2
- package/build/hooks/use-focusable-iframe/index.cjs.map +2 -2
- package/build/hooks/use-instance-id/index.cjs.map +2 -2
- package/build/hooks/use-isomorphic-layout-effect/index.cjs.map +2 -2
- package/build/hooks/use-keyboard-shortcut/index.cjs.map +2 -2
- package/build/hooks/use-media-query/index.cjs.map +2 -2
- package/build/hooks/use-merge-refs/index.cjs.map +2 -2
- package/build/hooks/use-observable-value/index.cjs.map +2 -2
- package/build/hooks/use-previous/index.cjs.map +2 -2
- package/build/hooks/use-reduced-motion/index.cjs.map +2 -2
- package/build/hooks/use-ref-effect/index.cjs.map +2 -2
- package/build/hooks/use-resize-observer/index.cjs.map +2 -2
- package/build/hooks/use-resize-observer/legacy/index.cjs.map +2 -2
- package/build/hooks/use-resize-observer/use-resize-observer.cjs.map +2 -2
- package/build/hooks/use-state-with-history/index.cjs.map +2 -2
- package/build/hooks/use-throttle/index.cjs.map +2 -2
- package/build/hooks/use-viewport-match/index.cjs +1 -1
- package/build/hooks/use-viewport-match/index.cjs.map +2 -2
- package/build/hooks/use-warn-on-change/index.cjs.map +2 -2
- package/build/lock-unlock.cjs.map +2 -2
- package/build/private-apis.cjs.map +2 -2
- package/build/utils/create-higher-order-component/index.cjs.map +2 -2
- package/build/utils/throttle/index.cjs.map +2 -2
- package/build-module/higher-order/compose.mjs.map +2 -2
- package/build-module/higher-order/if-condition/index.mjs.map +2 -2
- package/build-module/higher-order/pure/index.mjs.map +2 -2
- package/build-module/higher-order/with-global-events/index.mjs.map +2 -2
- package/build-module/higher-order/with-instance-id/index.mjs.map +2 -2
- package/build-module/higher-order/with-safe-timeout/index.mjs +1 -1
- package/build-module/higher-order/with-safe-timeout/index.mjs.map +2 -2
- package/build-module/higher-order/with-state/index.mjs.map +2 -2
- package/build-module/hooks/use-async-list/index.mjs.map +2 -2
- package/build-module/hooks/use-constrained-tabbing/index.mjs.map +2 -2
- package/build-module/hooks/use-copy-on-click/index.mjs.map +2 -2
- package/build-module/hooks/use-copy-to-clipboard/index.mjs.map +2 -2
- package/build-module/hooks/use-debounce/index.mjs.map +2 -2
- package/build-module/hooks/use-debounced-input/index.mjs.map +2 -2
- package/build-module/hooks/use-dialog/index.mjs.map +2 -2
- package/build-module/hooks/use-disabled/index.mjs.map +2 -2
- package/build-module/hooks/use-dragging/index.mjs.map +2 -2
- package/build-module/hooks/use-drop-zone/index.mjs.map +2 -2
- package/build-module/hooks/use-event/index.mjs.map +2 -2
- package/build-module/hooks/use-fixed-window-list/index.mjs +89 -93
- package/build-module/hooks/use-fixed-window-list/index.mjs.map +2 -2
- package/build-module/hooks/use-focus-outside/index.mjs.map +2 -2
- package/build-module/hooks/use-focus-return/index.mjs.map +2 -2
- package/build-module/hooks/use-focusable-iframe/index.mjs.map +2 -2
- package/build-module/hooks/use-instance-id/index.mjs.map +2 -2
- package/build-module/hooks/use-isomorphic-layout-effect/index.mjs.map +2 -2
- package/build-module/hooks/use-keyboard-shortcut/index.mjs.map +2 -2
- package/build-module/hooks/use-media-query/index.mjs.map +2 -2
- package/build-module/hooks/use-merge-refs/index.mjs.map +2 -2
- package/build-module/hooks/use-observable-value/index.mjs.map +2 -2
- package/build-module/hooks/use-previous/index.mjs.map +2 -2
- package/build-module/hooks/use-reduced-motion/index.mjs.map +2 -2
- package/build-module/hooks/use-ref-effect/index.mjs.map +2 -2
- package/build-module/hooks/use-resize-observer/index.mjs.map +2 -2
- package/build-module/hooks/use-resize-observer/legacy/index.mjs.map +2 -2
- package/build-module/hooks/use-resize-observer/use-resize-observer.mjs.map +2 -2
- package/build-module/hooks/use-state-with-history/index.mjs.map +2 -2
- package/build-module/hooks/use-throttle/index.mjs.map +2 -2
- package/build-module/hooks/use-viewport-match/index.mjs +1 -1
- package/build-module/hooks/use-viewport-match/index.mjs.map +2 -2
- package/build-module/hooks/use-warn-on-change/index.mjs.map +2 -2
- package/build-module/lock-unlock.mjs.map +2 -2
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/utils/create-higher-order-component/index.mjs.map +2 -2
- package/build-module/utils/throttle/index.mjs.map +2 -2
- package/build-types/higher-order/compose.d.ts.map +1 -1
- package/build-types/higher-order/if-condition/index.d.ts +0 -3
- package/build-types/higher-order/if-condition/index.d.ts.map +1 -1
- package/build-types/higher-order/pure/index.d.ts +0 -3
- package/build-types/higher-order/pure/index.d.ts.map +1 -1
- package/build-types/higher-order/with-global-events/index.d.ts.map +1 -1
- package/build-types/higher-order/with-instance-id/index.d.ts +0 -3
- 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 +0 -3
- package/build-types/higher-order/with-safe-timeout/index.d.ts.map +1 -1
- package/build-types/higher-order/with-state/index.d.ts.map +1 -1
- package/build-types/hooks/use-async-list/index.d.ts.map +1 -1
- package/build-types/hooks/use-constrained-tabbing/index.d.ts.map +1 -1
- package/build-types/hooks/use-copy-on-click/index.d.ts.map +1 -1
- package/build-types/hooks/use-copy-to-clipboard/index.d.ts.map +1 -1
- package/build-types/hooks/use-debounce/index.d.ts.map +1 -1
- package/build-types/hooks/use-debounced-input/index.d.ts.map +1 -1
- package/build-types/hooks/use-dialog/index.d.ts +0 -3
- package/build-types/hooks/use-dialog/index.d.ts.map +1 -1
- package/build-types/hooks/use-disabled/index.d.ts.map +1 -1
- package/build-types/hooks/use-dragging/index.d.ts.map +1 -1
- package/build-types/hooks/use-drop-zone/index.d.ts.map +1 -1
- package/build-types/hooks/use-event/index.d.ts.map +1 -1
- package/build-types/hooks/use-fixed-window-list/index.d.ts +1 -1
- package/build-types/hooks/use-fixed-window-list/index.d.ts.map +1 -1
- package/build-types/hooks/use-focus-outside/index.d.ts.map +1 -1
- package/build-types/hooks/use-focus-return/index.d.ts.map +1 -1
- package/build-types/hooks/use-focusable-iframe/index.d.ts +0 -3
- package/build-types/hooks/use-focusable-iframe/index.d.ts.map +1 -1
- package/build-types/hooks/use-instance-id/index.d.ts.map +1 -1
- package/build-types/hooks/use-isomorphic-layout-effect/index.d.ts +0 -3
- package/build-types/hooks/use-isomorphic-layout-effect/index.d.ts.map +1 -1
- package/build-types/hooks/use-keyboard-shortcut/index.d.ts +0 -3
- package/build-types/hooks/use-keyboard-shortcut/index.d.ts.map +1 -1
- package/build-types/hooks/use-media-query/index.d.ts.map +1 -1
- package/build-types/hooks/use-merge-refs/index.d.ts.map +1 -1
- package/build-types/hooks/use-observable-value/index.d.ts +0 -3
- package/build-types/hooks/use-observable-value/index.d.ts.map +1 -1
- package/build-types/hooks/use-previous/index.d.ts.map +1 -1
- package/build-types/hooks/use-reduced-motion/index.d.ts.map +1 -1
- package/build-types/hooks/use-ref-effect/index.d.ts +0 -3
- package/build-types/hooks/use-ref-effect/index.d.ts.map +1 -1
- package/build-types/hooks/use-resize-observer/index.d.ts +1 -4
- package/build-types/hooks/use-resize-observer/index.d.ts.map +1 -1
- package/build-types/hooks/use-resize-observer/legacy/index.d.ts +0 -3
- package/build-types/hooks/use-resize-observer/legacy/index.d.ts.map +1 -1
- package/build-types/hooks/use-resize-observer/use-resize-observer.d.ts.map +1 -1
- package/build-types/hooks/use-state-with-history/index.d.ts.map +1 -1
- package/build-types/hooks/use-throttle/index.d.ts.map +1 -1
- package/build-types/hooks/use-viewport-match/index.d.ts.map +1 -1
- package/build-types/hooks/use-warn-on-change/index.d.ts.map +1 -1
- package/build-types/lock-unlock.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/utils/create-higher-order-component/index.d.ts.map +1 -1
- package/build-types/utils/throttle/index.d.ts +0 -39
- package/build-types/utils/throttle/index.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/higher-order/compose.ts +0 -3
- package/src/higher-order/if-condition/index.tsx +0 -7
- package/src/higher-order/pure/index.tsx +0 -11
- package/src/higher-order/pure/test/index.js +0 -11
- package/src/higher-order/test/compose.ts +0 -3
- package/src/higher-order/test/pipe.ts +0 -3
- package/src/higher-order/with-global-events/index.js +0 -8
- package/src/higher-order/with-global-events/test/index.js +0 -11
- package/src/higher-order/with-global-events/test/listener.js +0 -3
- package/src/higher-order/with-instance-id/README.md +0 -3
- package/src/higher-order/with-instance-id/index.tsx +1 -4
- package/src/higher-order/with-instance-id/test/index.js +0 -7
- package/src/higher-order/with-safe-timeout/README.md +0 -3
- package/src/higher-order/with-safe-timeout/index.tsx +1 -8
- package/src/higher-order/with-state/README.md +0 -3
- package/src/higher-order/with-state/index.js +0 -7
- package/src/higher-order/with-state/test/index.js +0 -7
- package/src/hooks/use-async-list/index.ts +0 -3
- package/src/hooks/use-constrained-tabbing/index.ts +0 -7
- package/src/hooks/use-copy-on-click/index.ts +0 -7
- package/src/hooks/use-copy-on-click/test/index.tsx +0 -11
- package/src/hooks/use-copy-to-clipboard/index.ts +0 -7
- package/src/hooks/use-copy-to-clipboard/test/index.tsx +0 -7
- package/src/hooks/use-debounce/index.ts +0 -11
- package/src/hooks/use-debounced-input/index.ts +0 -7
- package/src/hooks/use-dialog/index.ts +0 -11
- package/src/hooks/use-dialog/test/index.tsx +0 -7
- package/src/hooks/use-disabled/index.ts +0 -3
- package/src/hooks/use-disabled/test/index.js +0 -11
- package/src/hooks/use-dragging/README.md +0 -3
- package/src/hooks/use-dragging/index.ts +0 -7
- package/src/hooks/use-drop-zone/index.ts +0 -3
- package/src/hooks/use-drop-zone/test/index.js +0 -11
- package/src/hooks/use-event/index.ts +0 -3
- package/src/hooks/use-fixed-window-list/index.ts +128 -116
- package/src/hooks/use-focus-outside/index.ts +0 -3
- package/src/hooks/use-focus-outside/test/index.js +0 -7
- package/src/hooks/use-focus-return/index.ts +0 -3
- package/src/hooks/use-focusable-iframe/index.ts +0 -7
- package/src/hooks/use-instance-id/README.md +0 -3
- package/src/hooks/use-instance-id/index.ts +0 -3
- package/src/hooks/use-instance-id/test/index.js +0 -7
- package/src/hooks/use-isomorphic-layout-effect/index.ts +0 -3
- package/src/hooks/use-keyboard-shortcut/index.ts +0 -7
- package/src/hooks/use-media-query/index.ts +0 -3
- package/src/hooks/use-media-query/test/index.js +0 -7
- package/src/hooks/use-media-query/test/ssr.js +0 -8
- package/src/hooks/use-merge-refs/index.ts +0 -3
- package/src/hooks/use-merge-refs/test/index.js +0 -11
- package/src/hooks/use-observable-value/index.ts +0 -7
- package/src/hooks/use-observable-value/test/index.js +0 -7
- package/src/hooks/use-previous/README.md +0 -3
- package/src/hooks/use-previous/index.ts +0 -3
- package/src/hooks/use-reduced-motion/index.ts +0 -3
- package/src/hooks/use-ref-effect/index.ts +0 -7
- package/src/hooks/use-resize-observer/index.ts +1 -7
- package/src/hooks/use-resize-observer/legacy/index.tsx +0 -10
- package/src/hooks/use-resize-observer/use-resize-observer.ts +0 -6
- package/src/hooks/use-state-with-history/index.ts +0 -3
- package/src/hooks/use-state-with-history/test/index.js +0 -7
- package/src/hooks/use-throttle/index.ts +0 -11
- package/src/hooks/use-viewport-match/index.ts +3 -8
- package/src/hooks/use-viewport-match/test/index.js +6 -15
- package/src/hooks/use-warn-on-change/index.ts +0 -3
- package/src/lock-unlock.ts +0 -3
- package/src/private-apis.ts +0 -3
- package/src/utils/create-higher-order-component/index.ts +0 -3
- package/src/utils/create-higher-order-component/test/index.js +0 -7
- package/src/utils/debounce/test/index.ts +0 -3
- package/src/utils/observable-map/test/index.js +0 -3
- package/src/utils/subscribe-delegated-listener/test/index.js +0 -3
- package/src/utils/throttle/index.ts +0 -4
- package/src/utils/throttle/test/index.ts +0 -3
|
@@ -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
|
} );
|
package/src/lock-unlock.ts
CHANGED
package/src/private-apis.ts
CHANGED
|
@@ -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 {
|