@wordpress/compose 7.31.1-next.f56bd8138.0 → 7.32.1-next.47f435fc9.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 +2 -0
- package/build/higher-order/compose.js +25 -20
- package/build/higher-order/compose.js.map +7 -1
- package/build/higher-order/if-condition/index.js +35 -41
- package/build/higher-order/if-condition/index.js.map +7 -1
- package/build/higher-order/pipe.js +32 -66
- package/build/higher-order/pipe.js.map +7 -1
- package/build/higher-order/pure/index.js +44 -37
- package/build/higher-order/pure/index.js.map +7 -1
- package/build/higher-order/with-global-events/index.js +64 -73
- package/build/higher-order/with-global-events/index.js.map +7 -1
- package/build/higher-order/with-global-events/listener.js +34 -21
- package/build/higher-order/with-global-events/listener.js.map +7 -1
- package/build/higher-order/with-instance-id/index.js +45 -27
- package/build/higher-order/with-instance-id/index.js.map +7 -1
- package/build/higher-order/with-safe-timeout/index.js +70 -66
- package/build/higher-order/with-safe-timeout/index.js.map +7 -1
- package/build/higher-order/with-state/index.js +52 -40
- package/build/higher-order/with-state/index.js.map +7 -1
- package/build/hooks/use-async-list/index.js +38 -42
- package/build/hooks/use-async-list/index.js.map +7 -1
- package/build/hooks/use-constrained-tabbing/index.js +54 -75
- package/build/hooks/use-constrained-tabbing/index.js.map +7 -1
- package/build/hooks/use-copy-on-click/index.js +46 -56
- package/build/hooks/use-copy-on-click/index.js.map +7 -1
- package/build/hooks/use-copy-to-clipboard/index.js +41 -51
- package/build/hooks/use-copy-to-clipboard/index.js.map +7 -1
- package/build/hooks/use-debounce/index.js +30 -37
- package/build/hooks/use-debounce/index.js.map +7 -1
- package/build/hooks/use-debounced-input/index.js +39 -27
- package/build/hooks/use-debounced-input/index.js.map +7 -1
- package/build/hooks/use-dialog/index.js +63 -55
- package/build/hooks/use-dialog/index.js.map +7 -1
- package/build/hooks/use-disabled/index.js +74 -82
- package/build/hooks/use-disabled/index.js.map +7 -1
- package/build/hooks/use-dragging/index.js +51 -48
- package/build/hooks/use-dragging/index.js.map +7 -1
- package/build/hooks/use-drop-zone/index.js +133 -168
- package/build/hooks/use-drop-zone/index.js.map +7 -1
- package/build/hooks/use-event/index.js +33 -45
- package/build/hooks/use-event/index.js.map +7 -1
- package/build/hooks/use-fixed-window-list/index.js +109 -97
- package/build/hooks/use-fixed-window-list/index.js.map +7 -1
- package/build/hooks/use-focus-on-mount/index.js +44 -57
- package/build/hooks/use-focus-on-mount/index.js.map +7 -1
- package/build/hooks/use-focus-outside/index.js +44 -102
- package/build/hooks/use-focus-outside/index.js.map +7 -1
- package/build/hooks/use-focus-return/index.js +35 -56
- package/build/hooks/use-focus-return/index.js.map +7 -1
- package/build/hooks/use-focusable-iframe/index.js +38 -35
- package/build/hooks/use-focusable-iframe/index.js.map +7 -1
- package/build/hooks/use-instance-id/index.js +26 -42
- package/build/hooks/use-instance-id/index.js.map +7 -1
- package/build/hooks/use-isomorphic-layout-effect/index.js +25 -17
- package/build/hooks/use-isomorphic-layout-effect/index.js.map +7 -1
- package/build/hooks/use-keyboard-shortcut/index.js +72 -69
- package/build/hooks/use-keyboard-shortcut/index.js.map +7 -1
- package/build/hooks/use-media-query/index.js +39 -35
- package/build/hooks/use-media-query/index.js.map +7 -1
- package/build/hooks/use-merge-refs/index.js +34 -102
- package/build/hooks/use-merge-refs/index.js.map +7 -1
- package/build/hooks/use-observable-value/index.js +31 -28
- package/build/hooks/use-observable-value/index.js.map +7 -1
- package/build/hooks/use-preferred-color-scheme/index.android.js +31 -23
- package/build/hooks/use-preferred-color-scheme/index.android.js.map +7 -1
- package/build/hooks/use-preferred-color-scheme/index.ios.js +25 -17
- package/build/hooks/use-preferred-color-scheme/index.ios.js.map +7 -1
- package/build/hooks/use-previous/index.js +26 -25
- package/build/hooks/use-previous/index.js.map +7 -1
- package/build/hooks/use-reduced-motion/index.js +35 -18
- package/build/hooks/use-reduced-motion/index.js.map +7 -1
- package/build/hooks/use-ref-effect/index.js +25 -35
- package/build/hooks/use-ref-effect/index.js.map +7 -1
- package/build/hooks/use-resize-observer/index.js +35 -67
- package/build/hooks/use-resize-observer/index.js.map +7 -1
- package/build/hooks/use-resize-observer/legacy/index.js +47 -103
- package/build/hooks/use-resize-observer/legacy/index.js.map +7 -1
- package/build/hooks/use-resize-observer/use-resize-observer.js +44 -36
- package/build/hooks/use-resize-observer/use-resize-observer.js.map +7 -1
- package/build/hooks/use-state-with-history/index.js +68 -63
- package/build/hooks/use-state-with-history/index.js.map +7 -1
- package/build/hooks/use-throttle/index.js +30 -37
- package/build/hooks/use-throttle/index.js.map +7 -1
- package/build/hooks/use-viewport-match/index.js +51 -70
- package/build/hooks/use-viewport-match/index.js.map +7 -1
- package/build/hooks/use-warn-on-change/index.js +50 -40
- package/build/hooks/use-warn-on-change/index.js.map +7 -1
- package/build/index.js +156 -358
- package/build/index.js.map +7 -1
- package/build/utils/create-higher-order-component/index.js +30 -34
- package/build/utils/create-higher-order-component/index.js.map +7 -1
- package/build/utils/debounce/index.js +38 -99
- package/build/utils/debounce/index.js.map +7 -1
- package/build/utils/observable-map/index.js +29 -19
- package/build/utils/observable-map/index.js.map +7 -1
- package/build/utils/throttle/index.js +30 -81
- package/build/utils/throttle/index.js.map +7 -1
- package/build-module/higher-order/compose.js +6 -15
- package/build-module/higher-order/compose.js.map +7 -1
- package/build-module/higher-order/if-condition/index.js +16 -37
- package/build-module/higher-order/if-condition/index.js.map +7 -1
- package/build-module/higher-order/pipe.js +10 -62
- package/build-module/higher-order/pipe.js.map +7 -1
- package/build-module/higher-order/pure/index.js +12 -29
- package/build-module/higher-order/pure/index.js.map +7 -1
- package/build-module/higher-order/with-global-events/index.js +34 -67
- package/build-module/higher-order/with-global-events/index.js.map +7 -1
- package/build-module/higher-order/with-global-events/listener.js +16 -17
- package/build-module/higher-order/with-global-events/listener.js.map +7 -1
- package/build-module/higher-order/with-instance-id/index.js +17 -22
- package/build-module/higher-order/with-instance-id/index.js.map +7 -1
- package/build-module/higher-order/with-safe-timeout/index.js +52 -62
- package/build-module/higher-order/with-safe-timeout/index.js.map +7 -1
- package/build-module/higher-order/with-state/index.js +23 -35
- package/build-module/higher-order/with-state/index.js.map +7 -1
- package/build-module/hooks/use-async-list/index.js +16 -33
- package/build-module/hooks/use-async-list/index.js.map +7 -1
- package/build-module/hooks/use-constrained-tabbing/index.js +26 -70
- package/build-module/hooks/use-constrained-tabbing/index.js.map +7 -1
- package/build-module/hooks/use-copy-on-click/index.js +14 -47
- package/build-module/hooks/use-copy-on-click/index.js.map +7 -1
- package/build-module/hooks/use-copy-to-clipboard/index.js +11 -44
- package/build-module/hooks/use-copy-to-clipboard/index.js.map +7 -1
- package/build-module/hooks/use-debounce/index.js +12 -33
- package/build-module/hooks/use-debounce/index.js.map +7 -1
- package/build-module/hooks/use-debounced-input/index.js +7 -18
- package/build-module/hooks/use-debounced-input/index.js.map +7 -1
- package/build-module/hooks/use-dialog/index.js +29 -43
- package/build-module/hooks/use-dialog/index.js.map +7 -1
- package/build-module/hooks/use-disabled/index.js +47 -78
- package/build-module/hooks/use-disabled/index.js.map +7 -1
- package/build-module/hooks/use-dragging/index.js +19 -39
- package/build-module/hooks/use-dragging/index.js.map +7 -1
- package/build-module/hooks/use-drop-zone/index.js +100 -158
- package/build-module/hooks/use-drop-zone/index.js.map +7 -1
- package/build-module/hooks/use-event/index.js +13 -39
- package/build-module/hooks/use-event/index.js.map +7 -1
- package/build-module/hooks/use-fixed-window-list/index.js +86 -87
- package/build-module/hooks/use-fixed-window-list/index.js.map +7 -1
- package/build-module/hooks/use-focus-on-mount/index.js +12 -48
- package/build-module/hooks/use-focus-on-mount/index.js.map +7 -1
- package/build-module/hooks/use-focus-outside/index.js +21 -93
- package/build-module/hooks/use-focus-outside/index.js.map +7 -1
- package/build-module/hooks/use-focus-return/index.js +13 -48
- package/build-module/hooks/use-focus-return/index.js.map +7 -1
- package/build-module/hooks/use-focusable-iframe/index.js +11 -31
- package/build-module/hooks/use-focusable-iframe/index.js.map +7 -1
- package/build-module/hooks/use-instance-id/index.js +7 -36
- package/build-module/hooks/use-instance-id/index.js.map +7 -1
- package/build-module/hooks/use-isomorphic-layout-effect/index.js +7 -13
- package/build-module/hooks/use-isomorphic-layout-effect/index.js.map +7 -1
- package/build-module/hooks/use-keyboard-shortcut/index.js +40 -60
- package/build-module/hooks/use-keyboard-shortcut/index.js.map +7 -1
- package/build-module/hooks/use-media-query/index.js +21 -30
- package/build-module/hooks/use-media-query/index.js.map +7 -1
- package/build-module/hooks/use-merge-refs/index.js +10 -92
- package/build-module/hooks/use-merge-refs/index.js.map +7 -1
- package/build-module/hooks/use-observable-value/index.js +13 -24
- package/build-module/hooks/use-observable-value/index.js.map +7 -1
- package/build-module/hooks/use-preferred-color-scheme/index.android.js +15 -18
- package/build-module/hooks/use-preferred-color-scheme/index.android.js.map +7 -1
- package/build-module/hooks/use-preferred-color-scheme/index.ios.js +6 -12
- package/build-module/hooks/use-preferred-color-scheme/index.ios.js.map +7 -1
- package/build-module/hooks/use-previous/index.js +7 -20
- package/build-module/hooks/use-previous/index.js.map +7 -1
- package/build-module/hooks/use-reduced-motion/index.js +7 -13
- package/build-module/hooks/use-reduced-motion/index.js.map +7 -1
- package/build-module/hooks/use-ref-effect/index.js +7 -31
- package/build-module/hooks/use-ref-effect/index.js.map +7 -1
- package/build-module/hooks/use-resize-observer/index.js +7 -61
- package/build-module/hooks/use-resize-observer/index.js.map +7 -1
- package/build-module/hooks/use-resize-observer/legacy/index.js +28 -96
- package/build-module/hooks/use-resize-observer/legacy/index.js.map +7 -1
- package/build-module/hooks/use-resize-observer/use-resize-observer.js +10 -28
- package/build-module/hooks/use-resize-observer/use-resize-observer.js.map +7 -1
- package/build-module/hooks/use-state-with-history/index.js +47 -55
- package/build-module/hooks/use-state-with-history/index.js.map +7 -1
- package/build-module/hooks/use-throttle/index.js +12 -33
- package/build-module/hooks/use-throttle/index.js.map +7 -1
- package/build-module/hooks/use-viewport-match/index.js +22 -64
- package/build-module/hooks/use-viewport-match/index.js.map +7 -1
- package/build-module/hooks/use-warn-on-change/index.js +21 -34
- package/build-module/hooks/use-warn-on-change/index.js.map +7 -1
- package/build-module/index.js +83 -53
- package/build-module/index.js.map +7 -1
- package/build-module/utils/create-higher-order-component/index.js +9 -30
- package/build-module/utils/create-higher-order-component/index.js.map +7 -1
- package/build-module/utils/debounce/index.js +17 -95
- package/build-module/utils/debounce/index.js.map +7 -1
- package/build-module/utils/observable-map/index.js +8 -16
- package/build-module/utils/observable-map/index.js.map +7 -1
- package/build-module/utils/throttle/index.js +8 -75
- package/build-module/utils/throttle/index.js.map +7 -1
- package/package.json +17 -10
- package/src/hooks/use-debounce/index.js +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/higher-order/with-network-connectivity/index.native.js +0 -27
- package/build/higher-order/with-network-connectivity/index.native.js.map +0 -1
- package/build/higher-order/with-preferred-color-scheme/index.native.js +0 -37
- package/build/higher-order/with-preferred-color-scheme/index.native.js.map +0 -1
- package/build/hooks/use-constrained-tabbing/index.native.js +0 -20
- package/build/hooks/use-constrained-tabbing/index.native.js.map +0 -1
- package/build/hooks/use-focus-outside/index.native.js +0 -175
- package/build/hooks/use-focus-outside/index.native.js.map +0 -1
- package/build/hooks/use-keyboard-shortcut/index.native.js +0 -9
- package/build/hooks/use-keyboard-shortcut/index.native.js.map +0 -1
- package/build/hooks/use-network-connectivity/index.native.js +0 -58
- package/build/hooks/use-network-connectivity/index.native.js.map +0 -1
- package/build/hooks/use-preferred-color-scheme-style/index.native.js +0 -42
- package/build/hooks/use-preferred-color-scheme-style/index.native.js.map +0 -1
- package/build/hooks/use-resize-observer/index.native.js +0 -14
- package/build/hooks/use-resize-observer/index.native.js.map +0 -1
- package/build/hooks/use-resize-observer/legacy/index.native.js +0 -62
- package/build/hooks/use-resize-observer/legacy/index.native.js.map +0 -1
- package/build/index.native.js +0 -297
- package/build/index.native.js.map +0 -1
- package/build-module/higher-order/with-network-connectivity/index.native.js +0 -19
- package/build-module/higher-order/with-network-connectivity/index.native.js.map +0 -1
- package/build-module/higher-order/with-preferred-color-scheme/index.native.js +0 -29
- package/build-module/higher-order/with-preferred-color-scheme/index.native.js.map +0 -1
- package/build-module/hooks/use-constrained-tabbing/index.native.js +0 -13
- package/build-module/hooks/use-constrained-tabbing/index.native.js.map +0 -1
- package/build-module/hooks/use-focus-outside/index.native.js +0 -169
- package/build-module/hooks/use-focus-outside/index.native.js.map +0 -1
- package/build-module/hooks/use-keyboard-shortcut/index.native.js +0 -3
- package/build-module/hooks/use-keyboard-shortcut/index.native.js.map +0 -1
- package/build-module/hooks/use-network-connectivity/index.native.js +0 -52
- package/build-module/hooks/use-network-connectivity/index.native.js.map +0 -1
- package/build-module/hooks/use-preferred-color-scheme-style/index.native.js +0 -35
- package/build-module/hooks/use-preferred-color-scheme-style/index.native.js.map +0 -1
- package/build-module/hooks/use-resize-observer/index.native.js +0 -2
- package/build-module/hooks/use-resize-observer/index.native.js.map +0 -1
- package/build-module/hooks/use-resize-observer/legacy/index.native.js +0 -56
- package/build-module/hooks/use-resize-observer/legacy/index.native.js.map +0 -1
- package/build-module/index.native.js +0 -45
- package/build-module/index.native.js.map +0 -1
|
@@ -1,48 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import { createUndoManager } from '@wordpress/undo-manager';
|
|
5
|
-
import { useCallback, useReducer } from '@wordpress/element';
|
|
1
|
+
import { createUndoManager } from "@wordpress/undo-manager";
|
|
2
|
+
import { useCallback, useReducer } from "@wordpress/element";
|
|
6
3
|
function undoRedoReducer(state, action) {
|
|
7
4
|
switch (action.type) {
|
|
8
|
-
case
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return state;
|
|
18
|
-
}
|
|
19
|
-
case 'REDO':
|
|
20
|
-
{
|
|
21
|
-
const redoRecord = state.manager.redo();
|
|
22
|
-
if (redoRecord) {
|
|
23
|
-
return {
|
|
24
|
-
...state,
|
|
25
|
-
value: redoRecord[0].changes.prop.to
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
return state;
|
|
5
|
+
case "UNDO": {
|
|
6
|
+
const undoRecord = state.manager.undo();
|
|
7
|
+
if (undoRecord) {
|
|
8
|
+
return {
|
|
9
|
+
...state,
|
|
10
|
+
value: undoRecord[0].changes.prop.from
|
|
11
|
+
};
|
|
29
12
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
prop: {
|
|
36
|
-
from: state.value,
|
|
37
|
-
to: action.value
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}], action.isStaged);
|
|
13
|
+
return state;
|
|
14
|
+
}
|
|
15
|
+
case "REDO": {
|
|
16
|
+
const redoRecord = state.manager.redo();
|
|
17
|
+
if (redoRecord) {
|
|
41
18
|
return {
|
|
42
19
|
...state,
|
|
43
|
-
value:
|
|
20
|
+
value: redoRecord[0].changes.prop.to
|
|
44
21
|
};
|
|
45
22
|
}
|
|
23
|
+
return state;
|
|
24
|
+
}
|
|
25
|
+
case "RECORD": {
|
|
26
|
+
state.manager.addRecord(
|
|
27
|
+
[
|
|
28
|
+
{
|
|
29
|
+
id: "object",
|
|
30
|
+
changes: {
|
|
31
|
+
prop: { from: state.value, to: action.value }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
action.isStaged
|
|
36
|
+
);
|
|
37
|
+
return {
|
|
38
|
+
...state,
|
|
39
|
+
value: action.value
|
|
40
|
+
};
|
|
41
|
+
}
|
|
46
42
|
}
|
|
47
43
|
return state;
|
|
48
44
|
}
|
|
@@ -52,20 +48,17 @@ function initReducer(value) {
|
|
|
52
48
|
value
|
|
53
49
|
};
|
|
54
50
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*/
|
|
62
|
-
export default function useStateWithHistory(initialValue) {
|
|
63
|
-
const [state, dispatch] = useReducer(undoRedoReducer, initialValue, initReducer);
|
|
51
|
+
function useStateWithHistory(initialValue) {
|
|
52
|
+
const [state, dispatch] = useReducer(
|
|
53
|
+
undoRedoReducer,
|
|
54
|
+
initialValue,
|
|
55
|
+
initReducer
|
|
56
|
+
);
|
|
64
57
|
return {
|
|
65
58
|
value: state.value,
|
|
66
59
|
setValue: useCallback((newValue, isStaged) => {
|
|
67
60
|
dispatch({
|
|
68
|
-
type:
|
|
61
|
+
type: "RECORD",
|
|
69
62
|
value: newValue,
|
|
70
63
|
isStaged
|
|
71
64
|
});
|
|
@@ -73,15 +66,14 @@ export default function useStateWithHistory(initialValue) {
|
|
|
73
66
|
hasUndo: state.manager.hasUndo(),
|
|
74
67
|
hasRedo: state.manager.hasRedo(),
|
|
75
68
|
undo: useCallback(() => {
|
|
76
|
-
dispatch({
|
|
77
|
-
type: 'UNDO'
|
|
78
|
-
});
|
|
69
|
+
dispatch({ type: "UNDO" });
|
|
79
70
|
}, []),
|
|
80
71
|
redo: useCallback(() => {
|
|
81
|
-
dispatch({
|
|
82
|
-
type: 'REDO'
|
|
83
|
-
});
|
|
72
|
+
dispatch({ type: "REDO" });
|
|
84
73
|
}, [])
|
|
85
74
|
};
|
|
86
75
|
}
|
|
87
|
-
|
|
76
|
+
export {
|
|
77
|
+
useStateWithHistory as default
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/use-state-with-history/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createUndoManager } from '@wordpress/undo-manager';\nimport { useCallback, useReducer } from '@wordpress/element';\nimport type { UndoManager } from '@wordpress/undo-manager';\n\ntype UndoRedoState< T > = {\n\tmanager: UndoManager< T >;\n\tvalue: T;\n};\n\nfunction undoRedoReducer< T >(\n\tstate: UndoRedoState< T >,\n\taction:\n\t\t| { type: 'UNDO' }\n\t\t| { type: 'REDO' }\n\t\t| { type: 'RECORD'; value: T; isStaged: boolean }\n): UndoRedoState< T > {\n\tswitch ( action.type ) {\n\t\tcase 'UNDO': {\n\t\t\tconst undoRecord = state.manager.undo();\n\t\t\tif ( undoRecord ) {\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\tvalue: undoRecord[ 0 ].changes.prop.from,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn state;\n\t\t}\n\t\tcase 'REDO': {\n\t\t\tconst redoRecord = state.manager.redo();\n\t\t\tif ( redoRecord ) {\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\tvalue: redoRecord[ 0 ].changes.prop.to,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn state;\n\t\t}\n\t\tcase 'RECORD': {\n\t\t\tstate.manager.addRecord(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'object',\n\t\t\t\t\t\tchanges: {\n\t\t\t\t\t\t\tprop: { from: state.value, to: action.value },\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\taction.isStaged\n\t\t\t);\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tvalue: action.value,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn state;\n}\n\nfunction initReducer< T >( value: T ) {\n\treturn {\n\t\tmanager: createUndoManager(),\n\t\tvalue,\n\t};\n}\n\n/**\n * useState with undo/redo history.\n *\n * @param initialValue Initial value.\n * @return Value, setValue, hasUndo, hasRedo, undo, redo.\n */\nexport default function useStateWithHistory< T >( initialValue: T ) {\n\tconst [ state, dispatch ] = useReducer(\n\t\tundoRedoReducer,\n\t\tinitialValue,\n\t\tinitReducer\n\t);\n\n\treturn {\n\t\tvalue: state.value,\n\t\tsetValue: useCallback( ( newValue: T, isStaged: boolean ) => {\n\t\t\tdispatch( {\n\t\t\t\ttype: 'RECORD',\n\t\t\t\tvalue: newValue,\n\t\t\t\tisStaged,\n\t\t\t} );\n\t\t}, [] ),\n\t\thasUndo: state.manager.hasUndo(),\n\t\thasRedo: state.manager.hasRedo(),\n\t\tundo: useCallback( () => {\n\t\t\tdispatch( { type: 'UNDO' } );\n\t\t}, [] ),\n\t\tredo: useCallback( () => {\n\t\t\tdispatch( { type: 'REDO' } );\n\t\t}, [] ),\n\t};\n}\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,yBAAyB;AAClC,SAAS,aAAa,kBAAkB;AAQxC,SAAS,gBACR,OACA,QAIqB;AACrB,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK,QAAQ;AACZ,YAAM,aAAa,MAAM,QAAQ,KAAK;AACtC,UAAK,YAAa;AACjB,eAAO;AAAA,UACN,GAAG;AAAA,UACH,OAAO,WAAY,CAAE,EAAE,QAAQ,KAAK;AAAA,QACrC;AAAA,MACD;AACA,aAAO;AAAA,IACR;AAAA,IACA,KAAK,QAAQ;AACZ,YAAM,aAAa,MAAM,QAAQ,KAAK;AACtC,UAAK,YAAa;AACjB,eAAO;AAAA,UACN,GAAG;AAAA,UACH,OAAO,WAAY,CAAE,EAAE,QAAQ,KAAK;AAAA,QACrC;AAAA,MACD;AACA,aAAO;AAAA,IACR;AAAA,IACA,KAAK,UAAU;AACd,YAAM,QAAQ;AAAA,QACb;AAAA,UACC;AAAA,YACC,IAAI;AAAA,YACJ,SAAS;AAAA,cACR,MAAM,EAAE,MAAM,MAAM,OAAO,IAAI,OAAO,MAAM;AAAA,YAC7C;AAAA,UACD;AAAA,QACD;AAAA,QACA,OAAO;AAAA,MACR;AACA,aAAO;AAAA,QACN,GAAG;AAAA,QACH,OAAO,OAAO;AAAA,MACf;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;AAEA,SAAS,YAAkB,OAAW;AACrC,SAAO;AAAA,IACN,SAAS,kBAAkB;AAAA,IAC3B;AAAA,EACD;AACD;AAQe,SAAR,oBAA2C,cAAkB;AACnE,QAAM,CAAE,OAAO,QAAS,IAAI;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,SAAO;AAAA,IACN,OAAO,MAAM;AAAA,IACb,UAAU,YAAa,CAAE,UAAa,aAAuB;AAC5D,eAAU;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,QACP;AAAA,MACD,CAAE;AAAA,IACH,GAAG,CAAC,CAAE;AAAA,IACN,SAAS,MAAM,QAAQ,QAAQ;AAAA,IAC/B,SAAS,MAAM,QAAQ,QAAQ;AAAA,IAC/B,MAAM,YAAa,MAAM;AACxB,eAAU,EAAE,MAAM,OAAO,CAAE;AAAA,IAC5B,GAAG,CAAC,CAAE;AAAA,IACN,MAAM,YAAa,MAAM;AACxB,eAAU,EAAE,MAAM,OAAO,CAAE;AAAA,IAC5B,GAAG,CAAC,CAAE;AAAA,EACP;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,36 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { useEffect } from '@wordpress/element';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { throttle } from '../../utils/throttle';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Throttles a function similar to Lodash's `throttle`. A new throttled function will
|
|
18
|
-
* be returned and any scheduled calls cancelled if any of the arguments change,
|
|
19
|
-
* including the function to throttle, so please wrap functions created on
|
|
20
|
-
* render in components in `useCallback`.
|
|
21
|
-
*
|
|
22
|
-
* @see https://lodash.com/docs/4#throttle
|
|
23
|
-
*
|
|
24
|
-
* @template {(...args: any[]) => void} TFunc
|
|
25
|
-
*
|
|
26
|
-
* @param {TFunc} fn The function to throttle.
|
|
27
|
-
* @param {number} [wait] The number of milliseconds to throttle invocations to.
|
|
28
|
-
* @param {import('../../utils/throttle').ThrottleOptions} [options] The options object. See linked documentation for details.
|
|
29
|
-
* @return {import('../../utils/debounce').DebouncedFunc<TFunc>} Throttled function.
|
|
30
|
-
*/
|
|
31
|
-
export default function useThrottle(fn, wait, options) {
|
|
32
|
-
const throttled = useMemoOne(() => throttle(fn, wait !== null && wait !== void 0 ? wait : 0, options), [fn, wait, options]);
|
|
1
|
+
import { useMemoOne } from "use-memo-one";
|
|
2
|
+
import { useEffect } from "@wordpress/element";
|
|
3
|
+
import { throttle } from "../../utils/throttle";
|
|
4
|
+
function useThrottle(fn, wait, options) {
|
|
5
|
+
const throttled = useMemoOne(
|
|
6
|
+
() => throttle(fn, wait ?? 0, options),
|
|
7
|
+
[fn, wait, options]
|
|
8
|
+
);
|
|
33
9
|
useEffect(() => () => throttled.cancel(), [throttled]);
|
|
34
10
|
return throttled;
|
|
35
11
|
}
|
|
36
|
-
|
|
12
|
+
export {
|
|
13
|
+
useThrottle as default
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/use-throttle/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { useMemoOne } from 'use-memo-one';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { throttle } from '../../utils/throttle';\n\n/**\n * Throttles a function similar to Lodash's `throttle`. A new throttled function will\n * be returned and any scheduled calls cancelled if any of the arguments change,\n * including the function to throttle, so please wrap functions created on\n * render in components in `useCallback`.\n *\n * @see https://lodash.com/docs/4#throttle\n *\n * @template {(...args: any[]) => void} TFunc\n *\n * @param {TFunc} fn The function to throttle.\n * @param {number} [wait] The number of milliseconds to throttle invocations to.\n * @param {import('../../utils/throttle').ThrottleOptions} [options] The options object. See linked documentation for details.\n * @return {import('../../utils/debounce').DebouncedFunc<TFunc>} Throttled function.\n */\nexport default function useThrottle( fn, wait, options ) {\n\tconst throttled = useMemoOne(\n\t\t() => throttle( fn, wait ?? 0, options ),\n\t\t[ fn, wait, options ]\n\t);\n\tuseEffect( () => () => throttled.cancel(), [ throttled ] );\n\treturn throttled;\n}\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,kBAAkB;AAK3B,SAAS,iBAAiB;AAK1B,SAAS,gBAAgB;AAiBV,SAAR,YAA8B,IAAI,MAAM,SAAU;AACxD,QAAM,YAAY;AAAA,IACjB,MAAM,SAAU,IAAI,QAAQ,GAAG,OAAQ;AAAA,IACvC,CAAE,IAAI,MAAM,OAAQ;AAAA,EACrB;AACA,YAAW,MAAM,MAAM,UAAU,OAAO,GAAG,CAAE,SAAU,CAAE;AACzD,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import { createContext, useContext } from '@wordpress/element';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import useMediaQuery from '../use-media-query';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {"xhuge" | "huge" | "wide" | "xlarge" | "large" | "medium" | "small" | "mobile"} WPBreakpoint
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Hash of breakpoint names with pixel width at which it becomes effective.
|
|
17
|
-
*
|
|
18
|
-
* @see _breakpoints.scss
|
|
19
|
-
*
|
|
20
|
-
* @type {Record<WPBreakpoint, number>}
|
|
21
|
-
*/
|
|
1
|
+
import { createContext, useContext } from "@wordpress/element";
|
|
2
|
+
import useMediaQuery from "../use-media-query";
|
|
22
3
|
const BREAKPOINTS = {
|
|
23
4
|
xhuge: 1920,
|
|
24
5
|
huge: 1440,
|
|
@@ -29,57 +10,34 @@ const BREAKPOINTS = {
|
|
|
29
10
|
small: 600,
|
|
30
11
|
mobile: 480
|
|
31
12
|
};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @typedef {">=" | "<"} WPViewportOperator
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Object mapping media query operators to the condition to be used.
|
|
39
|
-
*
|
|
40
|
-
* @type {Record<WPViewportOperator, string>}
|
|
41
|
-
*/
|
|
42
13
|
const CONDITIONS = {
|
|
43
|
-
|
|
44
|
-
|
|
14
|
+
">=": "min-width",
|
|
15
|
+
"<": "max-width"
|
|
45
16
|
};
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Object mapping media query operators to a function that given a breakpointValue and a width evaluates if the operator matches the values.
|
|
49
|
-
*
|
|
50
|
-
* @type {Record<WPViewportOperator, (breakpointValue: number, width: number) => boolean>}
|
|
51
|
-
*/
|
|
52
17
|
const OPERATOR_EVALUATORS = {
|
|
53
|
-
|
|
54
|
-
|
|
18
|
+
">=": (breakpointValue, width) => width >= breakpointValue,
|
|
19
|
+
"<": (breakpointValue, width) => width < breakpointValue
|
|
55
20
|
};
|
|
56
|
-
const ViewportMatchWidthContext = createContext(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
* @param {WPBreakpoint} breakpoint Breakpoint size name.
|
|
63
|
-
* @param {WPViewportOperator} [operator=">="] Viewport operator.
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
*
|
|
67
|
-
* ```js
|
|
68
|
-
* useViewportMatch( 'huge', '<' );
|
|
69
|
-
* useViewportMatch( 'medium' );
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* @return {boolean} Whether viewport matches query.
|
|
73
|
-
*/
|
|
74
|
-
const useViewportMatch = (breakpoint, operator = '>=') => {
|
|
21
|
+
const ViewportMatchWidthContext = createContext(
|
|
22
|
+
/** @type {null | number} */
|
|
23
|
+
null
|
|
24
|
+
);
|
|
25
|
+
ViewportMatchWidthContext.displayName = "ViewportMatchWidthContext";
|
|
26
|
+
const useViewportMatch = (breakpoint, operator = ">=") => {
|
|
75
27
|
const simulatedWidth = useContext(ViewportMatchWidthContext);
|
|
76
28
|
const mediaQuery = !simulatedWidth && `(${CONDITIONS[operator]}: ${BREAKPOINTS[breakpoint]}px)`;
|
|
77
|
-
const mediaQueryResult = useMediaQuery(mediaQuery ||
|
|
29
|
+
const mediaQueryResult = useMediaQuery(mediaQuery || void 0);
|
|
78
30
|
if (simulatedWidth) {
|
|
79
|
-
return OPERATOR_EVALUATORS[operator](
|
|
31
|
+
return OPERATOR_EVALUATORS[operator](
|
|
32
|
+
BREAKPOINTS[breakpoint],
|
|
33
|
+
simulatedWidth
|
|
34
|
+
);
|
|
80
35
|
}
|
|
81
36
|
return mediaQueryResult;
|
|
82
37
|
};
|
|
83
38
|
useViewportMatch.__experimentalWidthProvider = ViewportMatchWidthContext.Provider;
|
|
84
|
-
|
|
85
|
-
|
|
39
|
+
var use_viewport_match_default = useViewportMatch;
|
|
40
|
+
export {
|
|
41
|
+
use_viewport_match_default as default
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/use-viewport-match/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMediaQuery from '../use-media-query';\n\n/**\n * @typedef {\"xhuge\" | \"huge\" | \"wide\" | \"xlarge\" | \"large\" | \"medium\" | \"small\" | \"mobile\"} WPBreakpoint\n */\n\n/**\n * Hash of breakpoint names with pixel width at which it becomes effective.\n *\n * @see _breakpoints.scss\n *\n * @type {Record<WPBreakpoint, number>}\n */\nconst BREAKPOINTS = {\n\txhuge: 1920,\n\thuge: 1440,\n\twide: 1280,\n\txlarge: 1080,\n\tlarge: 960,\n\tmedium: 782,\n\tsmall: 600,\n\tmobile: 480,\n};\n\n/**\n * @typedef {\">=\" | \"<\"} WPViewportOperator\n */\n\n/**\n * Object mapping media query operators to the condition to be used.\n *\n * @type {Record<WPViewportOperator, string>}\n */\nconst CONDITIONS = {\n\t'>=': 'min-width',\n\t'<': 'max-width',\n};\n\n/**\n * Object mapping media query operators to a function that given a breakpointValue and a width evaluates if the operator matches the values.\n *\n * @type {Record<WPViewportOperator, (breakpointValue: number, width: number) => boolean>}\n */\nconst OPERATOR_EVALUATORS = {\n\t'>=': ( breakpointValue, width ) => width >= breakpointValue,\n\t'<': ( breakpointValue, width ) => width < breakpointValue,\n};\n\nconst ViewportMatchWidthContext = createContext(\n\t/** @type {null | number} */ ( null )\n);\nViewportMatchWidthContext.displayName = 'ViewportMatchWidthContext';\n\n/**\n * Returns true if the viewport matches the given query, or false otherwise.\n *\n * @param {WPBreakpoint} breakpoint Breakpoint size name.\n * @param {WPViewportOperator} [operator=\">=\"] Viewport operator.\n *\n * @example\n *\n * ```js\n * useViewportMatch( 'huge', '<' );\n * useViewportMatch( 'medium' );\n * ```\n *\n * @return {boolean} Whether viewport matches query.\n */\nconst useViewportMatch = ( breakpoint, operator = '>=' ) => {\n\tconst simulatedWidth = useContext( ViewportMatchWidthContext );\n\tconst mediaQuery =\n\t\t! simulatedWidth &&\n\t\t`(${ CONDITIONS[ operator ] }: ${ BREAKPOINTS[ breakpoint ] }px)`;\n\tconst mediaQueryResult = useMediaQuery( mediaQuery || undefined );\n\tif ( simulatedWidth ) {\n\t\treturn OPERATOR_EVALUATORS[ operator ](\n\t\t\tBREAKPOINTS[ breakpoint ],\n\t\t\tsimulatedWidth\n\t\t);\n\t}\n\treturn mediaQueryResult;\n};\n\nuseViewportMatch.__experimentalWidthProvider =\n\tViewportMatchWidthContext.Provider;\n\nexport default useViewportMatch;\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,eAAe,kBAAkB;AAK1C,OAAO,mBAAmB;AAa1B,MAAM,cAAc;AAAA,EACnB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AACT;AAWA,MAAM,aAAa;AAAA,EAClB,MAAM;AAAA,EACN,KAAK;AACN;AAOA,MAAM,sBAAsB;AAAA,EAC3B,MAAM,CAAE,iBAAiB,UAAW,SAAS;AAAA,EAC7C,KAAK,CAAE,iBAAiB,UAAW,QAAQ;AAC5C;AAEA,MAAM,4BAA4B;AAAA;AAAA,EACF;AAChC;AACA,0BAA0B,cAAc;AAiBxC,MAAM,mBAAmB,CAAE,YAAY,WAAW,SAAU;AAC3D,QAAM,iBAAiB,WAAY,yBAA0B;AAC7D,QAAM,aACL,CAAE,kBACF,IAAK,WAAY,QAAS,CAAE,KAAM,YAAa,UAAW,CAAE;AAC7D,QAAM,mBAAmB,cAAe,cAAc,MAAU;AAChE,MAAK,gBAAiB;AACrB,WAAO,oBAAqB,QAAS;AAAA,MACpC,YAAa,UAAW;AAAA,MACxB;AAAA,IACD;AAAA,EACD;AACA,SAAO;AACR;AAEA,iBAAiB,8BAChB,0BAA0B;AAE3B,IAAO,6BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,38 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import usePrevious from '../use-previous';
|
|
5
|
-
|
|
6
|
-
// Disable reason: Object and object are distinctly different types in TypeScript and we mean the lowercase object in this case
|
|
7
|
-
// but eslint wants to force us to use `Object`. See https://stackoverflow.com/questions/49464634/difference-between-object-and-object-in-typescript
|
|
8
|
-
/* eslint-disable jsdoc/check-types */
|
|
9
|
-
/**
|
|
10
|
-
* Hook that performs a shallow comparison between the preview value of an object
|
|
11
|
-
* and the new one, if there's a difference, it prints it to the console.
|
|
12
|
-
* this is useful in performance related work, to check why a component re-renders.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
* ```jsx
|
|
17
|
-
* function MyComponent(props) {
|
|
18
|
-
* useWarnOnChange(props);
|
|
19
|
-
*
|
|
20
|
-
* return "Something";
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @param {object} object Object which changes to compare.
|
|
25
|
-
* @param {string} prefix Just a prefix to show when console logging.
|
|
26
|
-
*/
|
|
27
|
-
function useWarnOnChange(object, prefix = 'Change detection') {
|
|
1
|
+
import usePrevious from "../use-previous";
|
|
2
|
+
function useWarnOnChange(object, prefix = "Change detection") {
|
|
28
3
|
const previousValues = usePrevious(object);
|
|
29
|
-
Object.entries(previousValues
|
|
30
|
-
if (value !== object[
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
4
|
+
Object.entries(previousValues ?? []).forEach(([key, value]) => {
|
|
5
|
+
if (value !== object[
|
|
6
|
+
/** @type {keyof typeof object} */
|
|
7
|
+
key
|
|
8
|
+
]) {
|
|
9
|
+
console.warn(
|
|
10
|
+
`${prefix}: ${key} key changed:`,
|
|
11
|
+
value,
|
|
12
|
+
object[
|
|
13
|
+
/** @type {keyof typeof object} */
|
|
14
|
+
key
|
|
15
|
+
]
|
|
16
|
+
/* eslint-enable jsdoc/check-types */
|
|
17
|
+
);
|
|
34
18
|
}
|
|
35
19
|
});
|
|
36
20
|
}
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
var use_warn_on_change_default = useWarnOnChange;
|
|
22
|
+
export {
|
|
23
|
+
use_warn_on_change_default as default
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/use-warn-on-change/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport usePrevious from '../use-previous';\n\n// Disable reason: Object and object are distinctly different types in TypeScript and we mean the lowercase object in this case\n// but eslint wants to force us to use `Object`. See https://stackoverflow.com/questions/49464634/difference-between-object-and-object-in-typescript\n/* eslint-disable jsdoc/check-types */\n/**\n * Hook that performs a shallow comparison between the preview value of an object\n * and the new one, if there's a difference, it prints it to the console.\n * this is useful in performance related work, to check why a component re-renders.\n *\n * @example\n *\n * ```jsx\n * function MyComponent(props) {\n * useWarnOnChange(props);\n *\n * return \"Something\";\n * }\n * ```\n *\n * @param {object} object Object which changes to compare.\n * @param {string} prefix Just a prefix to show when console logging.\n */\nfunction useWarnOnChange( object, prefix = 'Change detection' ) {\n\tconst previousValues = usePrevious( object );\n\n\tObject.entries( previousValues ?? [] ).forEach( ( [ key, value ] ) => {\n\t\tif ( value !== object[ /** @type {keyof typeof object} */ ( key ) ] ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(\n\t\t\t\t`${ prefix }: ${ key } key changed:`,\n\t\t\t\tvalue,\n\t\t\t\tobject[ /** @type {keyof typeof object} */ ( key ) ]\n\t\t\t\t/* eslint-enable jsdoc/check-types */\n\t\t\t);\n\t\t}\n\t} );\n}\n\nexport default useWarnOnChange;\n"],
|
|
5
|
+
"mappings": "AAGA,OAAO,iBAAiB;AAuBxB,SAAS,gBAAiB,QAAQ,SAAS,oBAAqB;AAC/D,QAAM,iBAAiB,YAAa,MAAO;AAE3C,SAAO,QAAS,kBAAkB,CAAC,CAAE,EAAE,QAAS,CAAE,CAAE,KAAK,KAAM,MAAO;AACrE,QAAK,UAAU;AAAA;AAAA,MAA6C;AAAA,IAAM,GAAI;AAErE,cAAQ;AAAA,QACP,GAAI,MAAO,KAAM,GAAI;AAAA,QACrB;AAAA,QACA;AAAA;AAAA,UAA6C;AAAA,QAAM;AAAA;AAAA,MAEpD;AAAA,IACD;AAAA,EACD,CAAE;AACH;AAEA,IAAO,6BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build-module/index.js
CHANGED
|
@@ -1,53 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
export * from
|
|
3
|
-
|
|
4
|
-
export * from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
export * from "./utils/create-higher-order-component";
|
|
2
|
+
export * from "./utils/debounce";
|
|
3
|
+
export * from "./utils/throttle";
|
|
4
|
+
export * from "./utils/observable-map";
|
|
5
|
+
import { default as default2 } from "./higher-order/compose";
|
|
6
|
+
import { default as default3 } from "./higher-order/pipe";
|
|
7
|
+
import { default as default4 } from "./higher-order/if-condition";
|
|
8
|
+
import { default as default5 } from "./higher-order/pure";
|
|
9
|
+
import { default as default6 } from "./higher-order/with-global-events";
|
|
10
|
+
import { default as default7 } from "./higher-order/with-instance-id";
|
|
11
|
+
import { default as default8 } from "./higher-order/with-safe-timeout";
|
|
12
|
+
import { default as default9 } from "./higher-order/with-state";
|
|
13
|
+
import { default as default10 } from "./hooks/use-constrained-tabbing";
|
|
14
|
+
import { default as default11 } from "./hooks/use-copy-on-click";
|
|
15
|
+
import { default as default12 } from "./hooks/use-copy-to-clipboard";
|
|
16
|
+
import { default as default13 } from "./hooks/use-dialog";
|
|
17
|
+
import { default as default14 } from "./hooks/use-disabled";
|
|
18
|
+
import { default as default15 } from "./hooks/use-event";
|
|
19
|
+
import { default as default16 } from "./hooks/use-dragging";
|
|
20
|
+
import { default as default17 } from "./hooks/use-focus-on-mount";
|
|
21
|
+
import { default as default18 } from "./hooks/use-focus-outside";
|
|
22
|
+
import { default as default19 } from "./hooks/use-focus-return";
|
|
23
|
+
import { default as default20 } from "./hooks/use-instance-id";
|
|
24
|
+
import { default as default21 } from "./hooks/use-isomorphic-layout-effect";
|
|
25
|
+
import { default as default22 } from "./hooks/use-keyboard-shortcut";
|
|
26
|
+
import { default as default23 } from "./hooks/use-media-query";
|
|
27
|
+
import { default as default24 } from "./hooks/use-previous";
|
|
28
|
+
import { default as default25 } from "./hooks/use-reduced-motion";
|
|
29
|
+
import { default as default26 } from "./hooks/use-state-with-history";
|
|
30
|
+
import { default as default27 } from "./hooks/use-viewport-match";
|
|
31
|
+
import { default as default28 } from "./hooks/use-resize-observer";
|
|
32
|
+
import { default as default29 } from "./hooks/use-async-list";
|
|
33
|
+
import { default as default30 } from "./hooks/use-warn-on-change";
|
|
34
|
+
import { default as default31 } from "./hooks/use-debounce";
|
|
35
|
+
import { default as default32 } from "./hooks/use-debounced-input";
|
|
36
|
+
import { default as default33 } from "./hooks/use-throttle";
|
|
37
|
+
import { default as default34 } from "./hooks/use-merge-refs";
|
|
38
|
+
import { default as default35 } from "./hooks/use-ref-effect";
|
|
39
|
+
import { default as default36 } from "./hooks/use-drop-zone";
|
|
40
|
+
import { default as default37 } from "./hooks/use-focusable-iframe";
|
|
41
|
+
import { default as default38 } from "./hooks/use-fixed-window-list";
|
|
42
|
+
import { default as default39 } from "./hooks/use-observable-value";
|
|
43
|
+
export {
|
|
44
|
+
default13 as __experimentalUseDialog,
|
|
45
|
+
default16 as __experimentalUseDragging,
|
|
46
|
+
default36 as __experimentalUseDropZone,
|
|
47
|
+
default38 as __experimentalUseFixedWindowList,
|
|
48
|
+
default18 as __experimentalUseFocusOutside,
|
|
49
|
+
default2 as compose,
|
|
50
|
+
default4 as ifCondition,
|
|
51
|
+
default3 as pipe,
|
|
52
|
+
default5 as pure,
|
|
53
|
+
default29 as useAsyncList,
|
|
54
|
+
default10 as useConstrainedTabbing,
|
|
55
|
+
default11 as useCopyOnClick,
|
|
56
|
+
default12 as useCopyToClipboard,
|
|
57
|
+
default31 as useDebounce,
|
|
58
|
+
default32 as useDebouncedInput,
|
|
59
|
+
default14 as useDisabled,
|
|
60
|
+
default15 as useEvent,
|
|
61
|
+
default17 as useFocusOnMount,
|
|
62
|
+
default19 as useFocusReturn,
|
|
63
|
+
default37 as useFocusableIframe,
|
|
64
|
+
default20 as useInstanceId,
|
|
65
|
+
default21 as useIsomorphicLayoutEffect,
|
|
66
|
+
default22 as useKeyboardShortcut,
|
|
67
|
+
default23 as useMediaQuery,
|
|
68
|
+
default34 as useMergeRefs,
|
|
69
|
+
default39 as useObservableValue,
|
|
70
|
+
default24 as usePrevious,
|
|
71
|
+
default25 as useReducedMotion,
|
|
72
|
+
default35 as useRefEffect,
|
|
73
|
+
default28 as useResizeObserver,
|
|
74
|
+
default26 as useStateWithHistory,
|
|
75
|
+
default33 as useThrottle,
|
|
76
|
+
default27 as useViewportMatch,
|
|
77
|
+
default30 as useWarnOnChange,
|
|
78
|
+
default6 as withGlobalEvents,
|
|
79
|
+
default7 as withInstanceId,
|
|
80
|
+
default8 as withSafeTimeout,
|
|
81
|
+
default9 as withState
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.js"],
|
|
4
|
+
"sourcesContent": ["// The `createHigherOrderComponent` helper and helper types.\nexport * from './utils/create-higher-order-component';\n// The `debounce` helper and its types.\nexport * from './utils/debounce';\n// The `throttle` helper and its types.\nexport * from './utils/throttle';\n// The `ObservableMap` data structure\nexport * from './utils/observable-map';\n\n// The `compose` and `pipe` helpers (inspired by `flowRight` and `flow` from Lodash).\nexport { default as compose } from './higher-order/compose';\nexport { default as pipe } from './higher-order/pipe';\n\n// Higher-order components.\nexport { default as ifCondition } from './higher-order/if-condition';\nexport { default as pure } from './higher-order/pure';\nexport { default as withGlobalEvents } from './higher-order/with-global-events';\nexport { default as withInstanceId } from './higher-order/with-instance-id';\nexport { default as withSafeTimeout } from './higher-order/with-safe-timeout';\nexport { default as withState } from './higher-order/with-state';\n\n// Hooks.\nexport { default as useConstrainedTabbing } from './hooks/use-constrained-tabbing';\nexport { default as useCopyOnClick } from './hooks/use-copy-on-click';\nexport { default as useCopyToClipboard } from './hooks/use-copy-to-clipboard';\nexport { default as __experimentalUseDialog } from './hooks/use-dialog';\nexport { default as useDisabled } from './hooks/use-disabled';\nexport { default as useEvent } from './hooks/use-event';\nexport { default as __experimentalUseDragging } from './hooks/use-dragging';\nexport { default as useFocusOnMount } from './hooks/use-focus-on-mount';\nexport { default as __experimentalUseFocusOutside } from './hooks/use-focus-outside';\nexport { default as useFocusReturn } from './hooks/use-focus-return';\nexport { default as useInstanceId } from './hooks/use-instance-id';\nexport { default as useIsomorphicLayoutEffect } from './hooks/use-isomorphic-layout-effect';\nexport { default as useKeyboardShortcut } from './hooks/use-keyboard-shortcut';\nexport { default as useMediaQuery } from './hooks/use-media-query';\nexport { default as usePrevious } from './hooks/use-previous';\nexport { default as useReducedMotion } from './hooks/use-reduced-motion';\nexport { default as useStateWithHistory } from './hooks/use-state-with-history';\nexport { default as useViewportMatch } from './hooks/use-viewport-match';\nexport { default as useResizeObserver } from './hooks/use-resize-observer';\nexport { default as useAsyncList } from './hooks/use-async-list';\nexport { default as useWarnOnChange } from './hooks/use-warn-on-change';\nexport { default as useDebounce } from './hooks/use-debounce';\nexport { default as useDebouncedInput } from './hooks/use-debounced-input';\nexport { default as useThrottle } from './hooks/use-throttle';\nexport { default as useMergeRefs } from './hooks/use-merge-refs';\nexport { default as useRefEffect } from './hooks/use-ref-effect';\nexport { default as __experimentalUseDropZone } from './hooks/use-drop-zone';\nexport { default as useFocusableIframe } from './hooks/use-focusable-iframe';\nexport { default as __experimentalUseFixedWindowList } from './hooks/use-fixed-window-list';\nexport { default as useObservableValue } from './hooks/use-observable-value';\n"],
|
|
5
|
+
"mappings": "AACA,cAAc;AAEd,cAAc;AAEd,cAAc;AAEd,cAAc;AAGd,SAAoB,WAAXA,gBAA0B;AACnC,SAAoB,WAAXA,gBAAuB;AAGhC,SAAoB,WAAXA,gBAA8B;AACvC,SAAoB,WAAXA,gBAAuB;AAChC,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAA4B;AAGrC,SAAoB,WAAXA,iBAAwC;AACjD,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAAqC;AAC9C,SAAoB,WAAXA,iBAA0C;AACnD,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAA2B;AACpC,SAAoB,WAAXA,iBAA4C;AACrD,SAAoB,WAAXA,iBAAkC;AAC3C,SAAoB,WAAXA,iBAAgD;AACzD,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAAgC;AACzC,SAAoB,WAAXA,iBAA4C;AACrD,SAAoB,WAAXA,iBAAsC;AAC/C,SAAoB,WAAXA,iBAAgC;AACzC,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAmC;AAC5C,SAAoB,WAAXA,iBAAsC;AAC/C,SAAoB,WAAXA,iBAAmC;AAC5C,SAAoB,WAAXA,iBAAoC;AAC7C,SAAoB,WAAXA,iBAA+B;AACxC,SAAoB,WAAXA,iBAAkC;AAC3C,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAoC;AAC7C,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAA+B;AACxC,SAAoB,WAAXA,iBAA+B;AACxC,SAAoB,WAAXA,iBAA4C;AACrD,SAAoB,WAAXA,iBAAqC;AAC9C,SAAoB,WAAXA,iBAAmD;AAC5D,SAAoB,WAAXA,iBAAqC;",
|
|
6
|
+
"names": ["default"]
|
|
7
|
+
}
|