@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.
Files changed (236) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/higher-order/compose.js +25 -20
  3. package/build/higher-order/compose.js.map +7 -1
  4. package/build/higher-order/if-condition/index.js +35 -41
  5. package/build/higher-order/if-condition/index.js.map +7 -1
  6. package/build/higher-order/pipe.js +32 -66
  7. package/build/higher-order/pipe.js.map +7 -1
  8. package/build/higher-order/pure/index.js +44 -37
  9. package/build/higher-order/pure/index.js.map +7 -1
  10. package/build/higher-order/with-global-events/index.js +64 -73
  11. package/build/higher-order/with-global-events/index.js.map +7 -1
  12. package/build/higher-order/with-global-events/listener.js +34 -21
  13. package/build/higher-order/with-global-events/listener.js.map +7 -1
  14. package/build/higher-order/with-instance-id/index.js +45 -27
  15. package/build/higher-order/with-instance-id/index.js.map +7 -1
  16. package/build/higher-order/with-safe-timeout/index.js +70 -66
  17. package/build/higher-order/with-safe-timeout/index.js.map +7 -1
  18. package/build/higher-order/with-state/index.js +52 -40
  19. package/build/higher-order/with-state/index.js.map +7 -1
  20. package/build/hooks/use-async-list/index.js +38 -42
  21. package/build/hooks/use-async-list/index.js.map +7 -1
  22. package/build/hooks/use-constrained-tabbing/index.js +54 -75
  23. package/build/hooks/use-constrained-tabbing/index.js.map +7 -1
  24. package/build/hooks/use-copy-on-click/index.js +46 -56
  25. package/build/hooks/use-copy-on-click/index.js.map +7 -1
  26. package/build/hooks/use-copy-to-clipboard/index.js +41 -51
  27. package/build/hooks/use-copy-to-clipboard/index.js.map +7 -1
  28. package/build/hooks/use-debounce/index.js +30 -37
  29. package/build/hooks/use-debounce/index.js.map +7 -1
  30. package/build/hooks/use-debounced-input/index.js +39 -27
  31. package/build/hooks/use-debounced-input/index.js.map +7 -1
  32. package/build/hooks/use-dialog/index.js +63 -55
  33. package/build/hooks/use-dialog/index.js.map +7 -1
  34. package/build/hooks/use-disabled/index.js +74 -82
  35. package/build/hooks/use-disabled/index.js.map +7 -1
  36. package/build/hooks/use-dragging/index.js +51 -48
  37. package/build/hooks/use-dragging/index.js.map +7 -1
  38. package/build/hooks/use-drop-zone/index.js +133 -168
  39. package/build/hooks/use-drop-zone/index.js.map +7 -1
  40. package/build/hooks/use-event/index.js +33 -45
  41. package/build/hooks/use-event/index.js.map +7 -1
  42. package/build/hooks/use-fixed-window-list/index.js +109 -97
  43. package/build/hooks/use-fixed-window-list/index.js.map +7 -1
  44. package/build/hooks/use-focus-on-mount/index.js +44 -57
  45. package/build/hooks/use-focus-on-mount/index.js.map +7 -1
  46. package/build/hooks/use-focus-outside/index.js +44 -102
  47. package/build/hooks/use-focus-outside/index.js.map +7 -1
  48. package/build/hooks/use-focus-return/index.js +35 -56
  49. package/build/hooks/use-focus-return/index.js.map +7 -1
  50. package/build/hooks/use-focusable-iframe/index.js +38 -35
  51. package/build/hooks/use-focusable-iframe/index.js.map +7 -1
  52. package/build/hooks/use-instance-id/index.js +26 -42
  53. package/build/hooks/use-instance-id/index.js.map +7 -1
  54. package/build/hooks/use-isomorphic-layout-effect/index.js +25 -17
  55. package/build/hooks/use-isomorphic-layout-effect/index.js.map +7 -1
  56. package/build/hooks/use-keyboard-shortcut/index.js +72 -69
  57. package/build/hooks/use-keyboard-shortcut/index.js.map +7 -1
  58. package/build/hooks/use-media-query/index.js +39 -35
  59. package/build/hooks/use-media-query/index.js.map +7 -1
  60. package/build/hooks/use-merge-refs/index.js +34 -102
  61. package/build/hooks/use-merge-refs/index.js.map +7 -1
  62. package/build/hooks/use-observable-value/index.js +31 -28
  63. package/build/hooks/use-observable-value/index.js.map +7 -1
  64. package/build/hooks/use-preferred-color-scheme/index.android.js +31 -23
  65. package/build/hooks/use-preferred-color-scheme/index.android.js.map +7 -1
  66. package/build/hooks/use-preferred-color-scheme/index.ios.js +25 -17
  67. package/build/hooks/use-preferred-color-scheme/index.ios.js.map +7 -1
  68. package/build/hooks/use-previous/index.js +26 -25
  69. package/build/hooks/use-previous/index.js.map +7 -1
  70. package/build/hooks/use-reduced-motion/index.js +35 -18
  71. package/build/hooks/use-reduced-motion/index.js.map +7 -1
  72. package/build/hooks/use-ref-effect/index.js +25 -35
  73. package/build/hooks/use-ref-effect/index.js.map +7 -1
  74. package/build/hooks/use-resize-observer/index.js +35 -67
  75. package/build/hooks/use-resize-observer/index.js.map +7 -1
  76. package/build/hooks/use-resize-observer/legacy/index.js +47 -103
  77. package/build/hooks/use-resize-observer/legacy/index.js.map +7 -1
  78. package/build/hooks/use-resize-observer/use-resize-observer.js +44 -36
  79. package/build/hooks/use-resize-observer/use-resize-observer.js.map +7 -1
  80. package/build/hooks/use-state-with-history/index.js +68 -63
  81. package/build/hooks/use-state-with-history/index.js.map +7 -1
  82. package/build/hooks/use-throttle/index.js +30 -37
  83. package/build/hooks/use-throttle/index.js.map +7 -1
  84. package/build/hooks/use-viewport-match/index.js +51 -70
  85. package/build/hooks/use-viewport-match/index.js.map +7 -1
  86. package/build/hooks/use-warn-on-change/index.js +50 -40
  87. package/build/hooks/use-warn-on-change/index.js.map +7 -1
  88. package/build/index.js +156 -358
  89. package/build/index.js.map +7 -1
  90. package/build/utils/create-higher-order-component/index.js +30 -34
  91. package/build/utils/create-higher-order-component/index.js.map +7 -1
  92. package/build/utils/debounce/index.js +38 -99
  93. package/build/utils/debounce/index.js.map +7 -1
  94. package/build/utils/observable-map/index.js +29 -19
  95. package/build/utils/observable-map/index.js.map +7 -1
  96. package/build/utils/throttle/index.js +30 -81
  97. package/build/utils/throttle/index.js.map +7 -1
  98. package/build-module/higher-order/compose.js +6 -15
  99. package/build-module/higher-order/compose.js.map +7 -1
  100. package/build-module/higher-order/if-condition/index.js +16 -37
  101. package/build-module/higher-order/if-condition/index.js.map +7 -1
  102. package/build-module/higher-order/pipe.js +10 -62
  103. package/build-module/higher-order/pipe.js.map +7 -1
  104. package/build-module/higher-order/pure/index.js +12 -29
  105. package/build-module/higher-order/pure/index.js.map +7 -1
  106. package/build-module/higher-order/with-global-events/index.js +34 -67
  107. package/build-module/higher-order/with-global-events/index.js.map +7 -1
  108. package/build-module/higher-order/with-global-events/listener.js +16 -17
  109. package/build-module/higher-order/with-global-events/listener.js.map +7 -1
  110. package/build-module/higher-order/with-instance-id/index.js +17 -22
  111. package/build-module/higher-order/with-instance-id/index.js.map +7 -1
  112. package/build-module/higher-order/with-safe-timeout/index.js +52 -62
  113. package/build-module/higher-order/with-safe-timeout/index.js.map +7 -1
  114. package/build-module/higher-order/with-state/index.js +23 -35
  115. package/build-module/higher-order/with-state/index.js.map +7 -1
  116. package/build-module/hooks/use-async-list/index.js +16 -33
  117. package/build-module/hooks/use-async-list/index.js.map +7 -1
  118. package/build-module/hooks/use-constrained-tabbing/index.js +26 -70
  119. package/build-module/hooks/use-constrained-tabbing/index.js.map +7 -1
  120. package/build-module/hooks/use-copy-on-click/index.js +14 -47
  121. package/build-module/hooks/use-copy-on-click/index.js.map +7 -1
  122. package/build-module/hooks/use-copy-to-clipboard/index.js +11 -44
  123. package/build-module/hooks/use-copy-to-clipboard/index.js.map +7 -1
  124. package/build-module/hooks/use-debounce/index.js +12 -33
  125. package/build-module/hooks/use-debounce/index.js.map +7 -1
  126. package/build-module/hooks/use-debounced-input/index.js +7 -18
  127. package/build-module/hooks/use-debounced-input/index.js.map +7 -1
  128. package/build-module/hooks/use-dialog/index.js +29 -43
  129. package/build-module/hooks/use-dialog/index.js.map +7 -1
  130. package/build-module/hooks/use-disabled/index.js +47 -78
  131. package/build-module/hooks/use-disabled/index.js.map +7 -1
  132. package/build-module/hooks/use-dragging/index.js +19 -39
  133. package/build-module/hooks/use-dragging/index.js.map +7 -1
  134. package/build-module/hooks/use-drop-zone/index.js +100 -158
  135. package/build-module/hooks/use-drop-zone/index.js.map +7 -1
  136. package/build-module/hooks/use-event/index.js +13 -39
  137. package/build-module/hooks/use-event/index.js.map +7 -1
  138. package/build-module/hooks/use-fixed-window-list/index.js +86 -87
  139. package/build-module/hooks/use-fixed-window-list/index.js.map +7 -1
  140. package/build-module/hooks/use-focus-on-mount/index.js +12 -48
  141. package/build-module/hooks/use-focus-on-mount/index.js.map +7 -1
  142. package/build-module/hooks/use-focus-outside/index.js +21 -93
  143. package/build-module/hooks/use-focus-outside/index.js.map +7 -1
  144. package/build-module/hooks/use-focus-return/index.js +13 -48
  145. package/build-module/hooks/use-focus-return/index.js.map +7 -1
  146. package/build-module/hooks/use-focusable-iframe/index.js +11 -31
  147. package/build-module/hooks/use-focusable-iframe/index.js.map +7 -1
  148. package/build-module/hooks/use-instance-id/index.js +7 -36
  149. package/build-module/hooks/use-instance-id/index.js.map +7 -1
  150. package/build-module/hooks/use-isomorphic-layout-effect/index.js +7 -13
  151. package/build-module/hooks/use-isomorphic-layout-effect/index.js.map +7 -1
  152. package/build-module/hooks/use-keyboard-shortcut/index.js +40 -60
  153. package/build-module/hooks/use-keyboard-shortcut/index.js.map +7 -1
  154. package/build-module/hooks/use-media-query/index.js +21 -30
  155. package/build-module/hooks/use-media-query/index.js.map +7 -1
  156. package/build-module/hooks/use-merge-refs/index.js +10 -92
  157. package/build-module/hooks/use-merge-refs/index.js.map +7 -1
  158. package/build-module/hooks/use-observable-value/index.js +13 -24
  159. package/build-module/hooks/use-observable-value/index.js.map +7 -1
  160. package/build-module/hooks/use-preferred-color-scheme/index.android.js +15 -18
  161. package/build-module/hooks/use-preferred-color-scheme/index.android.js.map +7 -1
  162. package/build-module/hooks/use-preferred-color-scheme/index.ios.js +6 -12
  163. package/build-module/hooks/use-preferred-color-scheme/index.ios.js.map +7 -1
  164. package/build-module/hooks/use-previous/index.js +7 -20
  165. package/build-module/hooks/use-previous/index.js.map +7 -1
  166. package/build-module/hooks/use-reduced-motion/index.js +7 -13
  167. package/build-module/hooks/use-reduced-motion/index.js.map +7 -1
  168. package/build-module/hooks/use-ref-effect/index.js +7 -31
  169. package/build-module/hooks/use-ref-effect/index.js.map +7 -1
  170. package/build-module/hooks/use-resize-observer/index.js +7 -61
  171. package/build-module/hooks/use-resize-observer/index.js.map +7 -1
  172. package/build-module/hooks/use-resize-observer/legacy/index.js +28 -96
  173. package/build-module/hooks/use-resize-observer/legacy/index.js.map +7 -1
  174. package/build-module/hooks/use-resize-observer/use-resize-observer.js +10 -28
  175. package/build-module/hooks/use-resize-observer/use-resize-observer.js.map +7 -1
  176. package/build-module/hooks/use-state-with-history/index.js +47 -55
  177. package/build-module/hooks/use-state-with-history/index.js.map +7 -1
  178. package/build-module/hooks/use-throttle/index.js +12 -33
  179. package/build-module/hooks/use-throttle/index.js.map +7 -1
  180. package/build-module/hooks/use-viewport-match/index.js +22 -64
  181. package/build-module/hooks/use-viewport-match/index.js.map +7 -1
  182. package/build-module/hooks/use-warn-on-change/index.js +21 -34
  183. package/build-module/hooks/use-warn-on-change/index.js.map +7 -1
  184. package/build-module/index.js +83 -53
  185. package/build-module/index.js.map +7 -1
  186. package/build-module/utils/create-higher-order-component/index.js +9 -30
  187. package/build-module/utils/create-higher-order-component/index.js.map +7 -1
  188. package/build-module/utils/debounce/index.js +17 -95
  189. package/build-module/utils/debounce/index.js.map +7 -1
  190. package/build-module/utils/observable-map/index.js +8 -16
  191. package/build-module/utils/observable-map/index.js.map +7 -1
  192. package/build-module/utils/throttle/index.js +8 -75
  193. package/build-module/utils/throttle/index.js.map +7 -1
  194. package/package.json +17 -10
  195. package/src/hooks/use-debounce/index.js +1 -1
  196. package/tsconfig.tsbuildinfo +1 -1
  197. package/build/higher-order/with-network-connectivity/index.native.js +0 -27
  198. package/build/higher-order/with-network-connectivity/index.native.js.map +0 -1
  199. package/build/higher-order/with-preferred-color-scheme/index.native.js +0 -37
  200. package/build/higher-order/with-preferred-color-scheme/index.native.js.map +0 -1
  201. package/build/hooks/use-constrained-tabbing/index.native.js +0 -20
  202. package/build/hooks/use-constrained-tabbing/index.native.js.map +0 -1
  203. package/build/hooks/use-focus-outside/index.native.js +0 -175
  204. package/build/hooks/use-focus-outside/index.native.js.map +0 -1
  205. package/build/hooks/use-keyboard-shortcut/index.native.js +0 -9
  206. package/build/hooks/use-keyboard-shortcut/index.native.js.map +0 -1
  207. package/build/hooks/use-network-connectivity/index.native.js +0 -58
  208. package/build/hooks/use-network-connectivity/index.native.js.map +0 -1
  209. package/build/hooks/use-preferred-color-scheme-style/index.native.js +0 -42
  210. package/build/hooks/use-preferred-color-scheme-style/index.native.js.map +0 -1
  211. package/build/hooks/use-resize-observer/index.native.js +0 -14
  212. package/build/hooks/use-resize-observer/index.native.js.map +0 -1
  213. package/build/hooks/use-resize-observer/legacy/index.native.js +0 -62
  214. package/build/hooks/use-resize-observer/legacy/index.native.js.map +0 -1
  215. package/build/index.native.js +0 -297
  216. package/build/index.native.js.map +0 -1
  217. package/build-module/higher-order/with-network-connectivity/index.native.js +0 -19
  218. package/build-module/higher-order/with-network-connectivity/index.native.js.map +0 -1
  219. package/build-module/higher-order/with-preferred-color-scheme/index.native.js +0 -29
  220. package/build-module/higher-order/with-preferred-color-scheme/index.native.js.map +0 -1
  221. package/build-module/hooks/use-constrained-tabbing/index.native.js +0 -13
  222. package/build-module/hooks/use-constrained-tabbing/index.native.js.map +0 -1
  223. package/build-module/hooks/use-focus-outside/index.native.js +0 -169
  224. package/build-module/hooks/use-focus-outside/index.native.js.map +0 -1
  225. package/build-module/hooks/use-keyboard-shortcut/index.native.js +0 -3
  226. package/build-module/hooks/use-keyboard-shortcut/index.native.js.map +0 -1
  227. package/build-module/hooks/use-network-connectivity/index.native.js +0 -52
  228. package/build-module/hooks/use-network-connectivity/index.native.js.map +0 -1
  229. package/build-module/hooks/use-preferred-color-scheme-style/index.native.js +0 -35
  230. package/build-module/hooks/use-preferred-color-scheme-style/index.native.js.map +0 -1
  231. package/build-module/hooks/use-resize-observer/index.native.js +0 -2
  232. package/build-module/hooks/use-resize-observer/index.native.js.map +0 -1
  233. package/build-module/hooks/use-resize-observer/legacy/index.native.js +0 -56
  234. package/build-module/hooks/use-resize-observer/legacy/index.native.js.map +0 -1
  235. package/build-module/index.native.js +0 -45
  236. package/build-module/index.native.js.map +0 -1
@@ -1,48 +1,44 @@
1
- /**
2
- * WordPress dependencies
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 'UNDO':
9
- {
10
- const undoRecord = state.manager.undo();
11
- if (undoRecord) {
12
- return {
13
- ...state,
14
- value: undoRecord[0].changes.prop.from
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
- case 'RECORD':
31
- {
32
- state.manager.addRecord([{
33
- id: 'object',
34
- changes: {
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: action.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
- * useState with undo/redo history.
58
- *
59
- * @param initialValue Initial value.
60
- * @return Value, setValue, hasUndo, hasRedo, undo, redo.
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: 'RECORD',
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
- //# sourceMappingURL=index.js.map
76
+ export {
77
+ useStateWithHistory as default
78
+ };
79
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["createUndoManager","useCallback","useReducer","undoRedoReducer","state","action","type","undoRecord","manager","undo","value","changes","prop","from","redoRecord","redo","to","addRecord","id","isStaged","initReducer","useStateWithHistory","initialValue","dispatch","setValue","newValue","hasUndo","hasRedo"],"sources":["@wordpress/compose/src/hooks/use-state-with-history/index.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,WAAW,EAAEC,UAAU,QAAQ,oBAAoB;AAQ5D,SAASC,eAAeA,CACvBC,KAAyB,EACzBC,MAGkD,EAC7B;EACrB,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,MAAM;MAAE;QACZ,MAAMC,UAAU,GAAGH,KAAK,CAACI,OAAO,CAACC,IAAI,CAAC,CAAC;QACvC,IAAKF,UAAU,EAAG;UACjB,OAAO;YACN,GAAGH,KAAK;YACRM,KAAK,EAAEH,UAAU,CAAE,CAAC,CAAE,CAACI,OAAO,CAACC,IAAI,CAACC;UACrC,CAAC;QACF;QACA,OAAOT,KAAK;MACb;IACA,KAAK,MAAM;MAAE;QACZ,MAAMU,UAAU,GAAGV,KAAK,CAACI,OAAO,CAACO,IAAI,CAAC,CAAC;QACvC,IAAKD,UAAU,EAAG;UACjB,OAAO;YACN,GAAGV,KAAK;YACRM,KAAK,EAAEI,UAAU,CAAE,CAAC,CAAE,CAACH,OAAO,CAACC,IAAI,CAACI;UACrC,CAAC;QACF;QACA,OAAOZ,KAAK;MACb;IACA,KAAK,QAAQ;MAAE;QACdA,KAAK,CAACI,OAAO,CAACS,SAAS,CACtB,CACC;UACCC,EAAE,EAAE,QAAQ;UACZP,OAAO,EAAE;YACRC,IAAI,EAAE;cAAEC,IAAI,EAAET,KAAK,CAACM,KAAK;cAAEM,EAAE,EAAEX,MAAM,CAACK;YAAM;UAC7C;QACD,CAAC,CACD,EACDL,MAAM,CAACc,QACR,CAAC;QACD,OAAO;UACN,GAAGf,KAAK;UACRM,KAAK,EAAEL,MAAM,CAACK;QACf,CAAC;MACF;EACD;EAEA,OAAON,KAAK;AACb;AAEA,SAASgB,WAAWA,CAAOV,KAAQ,EAAG;EACrC,OAAO;IACNF,OAAO,EAAER,iBAAiB,CAAC,CAAC;IAC5BU;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASW,mBAAmBA,CAAOC,YAAe,EAAG;EACnE,MAAM,CAAElB,KAAK,EAAEmB,QAAQ,CAAE,GAAGrB,UAAU,CACrCC,eAAe,EACfmB,YAAY,EACZF,WACD,CAAC;EAED,OAAO;IACNV,KAAK,EAAEN,KAAK,CAACM,KAAK;IAClBc,QAAQ,EAAEvB,WAAW,CAAE,CAAEwB,QAAW,EAAEN,QAAiB,KAAM;MAC5DI,QAAQ,CAAE;QACTjB,IAAI,EAAE,QAAQ;QACdI,KAAK,EAAEe,QAAQ;QACfN;MACD,CAAE,CAAC;IACJ,CAAC,EAAE,EAAG,CAAC;IACPO,OAAO,EAAEtB,KAAK,CAACI,OAAO,CAACkB,OAAO,CAAC,CAAC;IAChCC,OAAO,EAAEvB,KAAK,CAACI,OAAO,CAACmB,OAAO,CAAC,CAAC;IAChClB,IAAI,EAAER,WAAW,CAAE,MAAM;MACxBsB,QAAQ,CAAE;QAAEjB,IAAI,EAAE;MAAO,CAAE,CAAC;IAC7B,CAAC,EAAE,EAAG,CAAC;IACPS,IAAI,EAAEd,WAAW,CAAE,MAAM;MACxBsB,QAAQ,CAAE;QAAEjB,IAAI,EAAE;MAAO,CAAE,CAAC;IAC7B,CAAC,EAAE,EAAG;EACP,CAAC;AACF","ignoreList":[]}
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
- * External dependencies
3
- */
4
- import { useMemoOne } from 'use-memo-one';
5
-
6
- /**
7
- * WordPress dependencies
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
- //# sourceMappingURL=index.js.map
12
+ export {
13
+ useThrottle as default
14
+ };
15
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useMemoOne","useEffect","throttle","useThrottle","fn","wait","options","throttled","cancel"],"sources":["@wordpress/compose/src/hooks/use-throttle/index.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,cAAc;;AAEzC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,oBAAoB;;AAE9C;AACA;AACA;AACA,SAASC,QAAQ,QAAQ,sBAAsB;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,WAAWA,CAAEC,EAAE,EAAEC,IAAI,EAAEC,OAAO,EAAG;EACxD,MAAMC,SAAS,GAAGP,UAAU,CAC3B,MAAME,QAAQ,CAAEE,EAAE,EAAEC,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAI,CAAC,EAAEC,OAAQ,CAAC,EACxC,CAAEF,EAAE,EAAEC,IAAI,EAAEC,OAAO,CACpB,CAAC;EACDL,SAAS,CAAE,MAAM,MAAMM,SAAS,CAACC,MAAM,CAAC,CAAC,EAAE,CAAED,SAAS,CAAG,CAAC;EAC1D,OAAOA,SAAS;AACjB","ignoreList":[]}
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
- * WordPress dependencies
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
- '>=': 'min-width',
44
- '<': 'max-width'
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
- '>=': (breakpointValue, width) => width >= breakpointValue,
54
- '<': (breakpointValue, width) => width < breakpointValue
18
+ ">=": (breakpointValue, width) => width >= breakpointValue,
19
+ "<": (breakpointValue, width) => width < breakpointValue
55
20
  };
56
- const ViewportMatchWidthContext = createContext(/** @type {null | number} */null);
57
- ViewportMatchWidthContext.displayName = 'ViewportMatchWidthContext';
58
-
59
- /**
60
- * Returns true if the viewport matches the given query, or false otherwise.
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 || undefined);
29
+ const mediaQueryResult = useMediaQuery(mediaQuery || void 0);
78
30
  if (simulatedWidth) {
79
- return OPERATOR_EVALUATORS[operator](BREAKPOINTS[breakpoint], simulatedWidth);
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
- export default useViewportMatch;
85
- //# sourceMappingURL=index.js.map
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
- {"version":3,"names":["createContext","useContext","useMediaQuery","BREAKPOINTS","xhuge","huge","wide","xlarge","large","medium","small","mobile","CONDITIONS","OPERATOR_EVALUATORS",">=","breakpointValue","width","<","ViewportMatchWidthContext","displayName","useViewportMatch","breakpoint","operator","simulatedWidth","mediaQuery","mediaQueryResult","undefined","__experimentalWidthProvider","Provider"],"sources":["@wordpress/compose/src/hooks/use-viewport-match/index.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,oBAAoB;;AAE9D;AACA;AACA;AACA,OAAOC,aAAa,MAAM,oBAAoB;;AAE9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAG;EACnBC,KAAK,EAAE,IAAI;EACXC,IAAI,EAAE,IAAI;EACVC,IAAI,EAAE,IAAI;EACVC,MAAM,EAAE,IAAI;EACZC,KAAK,EAAE,GAAG;EACVC,MAAM,EAAE,GAAG;EACXC,KAAK,EAAE,GAAG;EACVC,MAAM,EAAE;AACT,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMC,UAAU,GAAG;EAClB,IAAI,EAAE,WAAW;EACjB,GAAG,EAAE;AACN,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAmB,GAAG;EAC3B,IAAI,EAAEC,CAAEC,eAAe,EAAEC,KAAK,KAAMA,KAAK,IAAID,eAAe;EAC5D,GAAG,EAAEE,CAAEF,eAAe,EAAEC,KAAK,KAAMA,KAAK,GAAGD;AAC5C,CAAC;AAED,MAAMG,yBAAyB,GAAGlB,aAAa,CAC9C,4BAA+B,IAChC,CAAC;AACDkB,yBAAyB,CAACC,WAAW,GAAG,2BAA2B;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAGA,CAAEC,UAAU,EAAEC,QAAQ,GAAG,IAAI,KAAM;EAC3D,MAAMC,cAAc,GAAGtB,UAAU,CAAEiB,yBAA0B,CAAC;EAC9D,MAAMM,UAAU,GACf,CAAED,cAAc,IAChB,IAAKX,UAAU,CAAEU,QAAQ,CAAE,KAAOnB,WAAW,CAAEkB,UAAU,CAAE,KAAM;EAClE,MAAMI,gBAAgB,GAAGvB,aAAa,CAAEsB,UAAU,IAAIE,SAAU,CAAC;EACjE,IAAKH,cAAc,EAAG;IACrB,OAAOV,mBAAmB,CAAES,QAAQ,CAAE,CACrCnB,WAAW,CAAEkB,UAAU,CAAE,EACzBE,cACD,CAAC;EACF;EACA,OAAOE,gBAAgB;AACxB,CAAC;AAEDL,gBAAgB,CAACO,2BAA2B,GAC3CT,yBAAyB,CAACU,QAAQ;AAEnC,eAAeR,gBAAgB","ignoreList":[]}
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
- * Internal dependencies
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 !== null && previousValues !== void 0 ? previousValues : []).forEach(([key, value]) => {
30
- if (value !== object[(/** @type {keyof typeof object} */key)]) {
31
- // eslint-disable-next-line no-console
32
- console.warn(`${prefix}: ${key} key changed:`, value, object[(/** @type {keyof typeof object} */key)]
33
- /* eslint-enable jsdoc/check-types */);
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
- export default useWarnOnChange;
38
- //# sourceMappingURL=index.js.map
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
- {"version":3,"names":["usePrevious","useWarnOnChange","object","prefix","previousValues","Object","entries","forEach","key","value","console","warn"],"sources":["@wordpress/compose/src/hooks/use-warn-on-change/index.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,iBAAiB;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CAAEC,MAAM,EAAEC,MAAM,GAAG,kBAAkB,EAAG;EAC/D,MAAMC,cAAc,GAAGJ,WAAW,CAAEE,MAAO,CAAC;EAE5CG,MAAM,CAACC,OAAO,CAAEF,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAI,EAAG,CAAC,CAACG,OAAO,CAAE,CAAE,CAAEC,GAAG,EAAEC,KAAK,CAAE,KAAM;IACrE,IAAKA,KAAK,KAAKP,MAAM,EAAE,kCAAqCM,GAAG,EAAI,EAAG;MACrE;MACAE,OAAO,CAACC,IAAI,CACX,GAAIR,MAAM,KAAOK,GAAG,eAAgB,EACpCC,KAAK,EACLP,MAAM,EAAE,kCAAqCM,GAAG;MAChD,qCACD,CAAC;IACF;EACD,CAAE,CAAC;AACJ;AAEA,eAAeP,eAAe","ignoreList":[]}
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
+ }
@@ -1,53 +1,83 @@
1
- // The `createHigherOrderComponent` helper and helper types.
2
- export * from './utils/create-higher-order-component';
3
- // The `debounce` helper and its types.
4
- export * from './utils/debounce';
5
- // The `throttle` helper and its types.
6
- export * from './utils/throttle';
7
- // The `ObservableMap` data structure
8
- export * from './utils/observable-map';
9
-
10
- // The `compose` and `pipe` helpers (inspired by `flowRight` and `flow` from Lodash).
11
- export { default as compose } from './higher-order/compose';
12
- export { default as pipe } from './higher-order/pipe';
13
-
14
- // Higher-order components.
15
- export { default as ifCondition } from './higher-order/if-condition';
16
- export { default as pure } from './higher-order/pure';
17
- export { default as withGlobalEvents } from './higher-order/with-global-events';
18
- export { default as withInstanceId } from './higher-order/with-instance-id';
19
- export { default as withSafeTimeout } from './higher-order/with-safe-timeout';
20
- export { default as withState } from './higher-order/with-state';
21
-
22
- // Hooks.
23
- export { default as useConstrainedTabbing } from './hooks/use-constrained-tabbing';
24
- export { default as useCopyOnClick } from './hooks/use-copy-on-click';
25
- export { default as useCopyToClipboard } from './hooks/use-copy-to-clipboard';
26
- export { default as __experimentalUseDialog } from './hooks/use-dialog';
27
- export { default as useDisabled } from './hooks/use-disabled';
28
- export { default as useEvent } from './hooks/use-event';
29
- export { default as __experimentalUseDragging } from './hooks/use-dragging';
30
- export { default as useFocusOnMount } from './hooks/use-focus-on-mount';
31
- export { default as __experimentalUseFocusOutside } from './hooks/use-focus-outside';
32
- export { default as useFocusReturn } from './hooks/use-focus-return';
33
- export { default as useInstanceId } from './hooks/use-instance-id';
34
- export { default as useIsomorphicLayoutEffect } from './hooks/use-isomorphic-layout-effect';
35
- export { default as useKeyboardShortcut } from './hooks/use-keyboard-shortcut';
36
- export { default as useMediaQuery } from './hooks/use-media-query';
37
- export { default as usePrevious } from './hooks/use-previous';
38
- export { default as useReducedMotion } from './hooks/use-reduced-motion';
39
- export { default as useStateWithHistory } from './hooks/use-state-with-history';
40
- export { default as useViewportMatch } from './hooks/use-viewport-match';
41
- export { default as useResizeObserver } from './hooks/use-resize-observer';
42
- export { default as useAsyncList } from './hooks/use-async-list';
43
- export { default as useWarnOnChange } from './hooks/use-warn-on-change';
44
- export { default as useDebounce } from './hooks/use-debounce';
45
- export { default as useDebouncedInput } from './hooks/use-debounced-input';
46
- export { default as useThrottle } from './hooks/use-throttle';
47
- export { default as useMergeRefs } from './hooks/use-merge-refs';
48
- export { default as useRefEffect } from './hooks/use-ref-effect';
49
- export { default as __experimentalUseDropZone } from './hooks/use-drop-zone';
50
- export { default as useFocusableIframe } from './hooks/use-focusable-iframe';
51
- export { default as __experimentalUseFixedWindowList } from './hooks/use-fixed-window-list';
52
- export { default as useObservableValue } from './hooks/use-observable-value';
53
- //# sourceMappingURL=index.js.map
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
- {"version":3,"names":["default","compose","pipe","ifCondition","pure","withGlobalEvents","withInstanceId","withSafeTimeout","withState","useConstrainedTabbing","useCopyOnClick","useCopyToClipboard","__experimentalUseDialog","useDisabled","useEvent","__experimentalUseDragging","useFocusOnMount","__experimentalUseFocusOutside","useFocusReturn","useInstanceId","useIsomorphicLayoutEffect","useKeyboardShortcut","useMediaQuery","usePrevious","useReducedMotion","useStateWithHistory","useViewportMatch","useResizeObserver","useAsyncList","useWarnOnChange","useDebounce","useDebouncedInput","useThrottle","useMergeRefs","useRefEffect","__experimentalUseDropZone","useFocusableIframe","__experimentalUseFixedWindowList","useObservableValue"],"sources":["@wordpress/compose/src/index.js"],"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"],"mappings":"AAAA;AACA,cAAc,uCAAuC;AACrD;AACA,cAAc,kBAAkB;AAChC;AACA,cAAc,kBAAkB;AAChC;AACA,cAAc,wBAAwB;;AAEtC;AACA,SAASA,OAAO,IAAIC,OAAO,QAAQ,wBAAwB;AAC3D,SAASD,OAAO,IAAIE,IAAI,QAAQ,qBAAqB;;AAErD;AACA,SAASF,OAAO,IAAIG,WAAW,QAAQ,6BAA6B;AACpE,SAASH,OAAO,IAAII,IAAI,QAAQ,qBAAqB;AACrD,SAASJ,OAAO,IAAIK,gBAAgB,QAAQ,mCAAmC;AAC/E,SAASL,OAAO,IAAIM,cAAc,QAAQ,iCAAiC;AAC3E,SAASN,OAAO,IAAIO,eAAe,QAAQ,kCAAkC;AAC7E,SAASP,OAAO,IAAIQ,SAAS,QAAQ,2BAA2B;;AAEhE;AACA,SAASR,OAAO,IAAIS,qBAAqB,QAAQ,iCAAiC;AAClF,SAAST,OAAO,IAAIU,cAAc,QAAQ,2BAA2B;AACrE,SAASV,OAAO,IAAIW,kBAAkB,QAAQ,+BAA+B;AAC7E,SAASX,OAAO,IAAIY,uBAAuB,QAAQ,oBAAoB;AACvE,SAASZ,OAAO,IAAIa,WAAW,QAAQ,sBAAsB;AAC7D,SAASb,OAAO,IAAIc,QAAQ,QAAQ,mBAAmB;AACvD,SAASd,OAAO,IAAIe,yBAAyB,QAAQ,sBAAsB;AAC3E,SAASf,OAAO,IAAIgB,eAAe,QAAQ,4BAA4B;AACvE,SAAShB,OAAO,IAAIiB,6BAA6B,QAAQ,2BAA2B;AACpF,SAASjB,OAAO,IAAIkB,cAAc,QAAQ,0BAA0B;AACpE,SAASlB,OAAO,IAAImB,aAAa,QAAQ,yBAAyB;AAClE,SAASnB,OAAO,IAAIoB,yBAAyB,QAAQ,sCAAsC;AAC3F,SAASpB,OAAO,IAAIqB,mBAAmB,QAAQ,+BAA+B;AAC9E,SAASrB,OAAO,IAAIsB,aAAa,QAAQ,yBAAyB;AAClE,SAAStB,OAAO,IAAIuB,WAAW,QAAQ,sBAAsB;AAC7D,SAASvB,OAAO,IAAIwB,gBAAgB,QAAQ,4BAA4B;AACxE,SAASxB,OAAO,IAAIyB,mBAAmB,QAAQ,gCAAgC;AAC/E,SAASzB,OAAO,IAAI0B,gBAAgB,QAAQ,4BAA4B;AACxE,SAAS1B,OAAO,IAAI2B,iBAAiB,QAAQ,6BAA6B;AAC1E,SAAS3B,OAAO,IAAI4B,YAAY,QAAQ,wBAAwB;AAChE,SAAS5B,OAAO,IAAI6B,eAAe,QAAQ,4BAA4B;AACvE,SAAS7B,OAAO,IAAI8B,WAAW,QAAQ,sBAAsB;AAC7D,SAAS9B,OAAO,IAAI+B,iBAAiB,QAAQ,6BAA6B;AAC1E,SAAS/B,OAAO,IAAIgC,WAAW,QAAQ,sBAAsB;AAC7D,SAAShC,OAAO,IAAIiC,YAAY,QAAQ,wBAAwB;AAChE,SAASjC,OAAO,IAAIkC,YAAY,QAAQ,wBAAwB;AAChE,SAASlC,OAAO,IAAImC,yBAAyB,QAAQ,uBAAuB;AAC5E,SAASnC,OAAO,IAAIoC,kBAAkB,QAAQ,8BAA8B;AAC5E,SAASpC,OAAO,IAAIqC,gCAAgC,QAAQ,+BAA+B;AAC3F,SAASrC,OAAO,IAAIsC,kBAAkB,QAAQ,8BAA8B","ignoreList":[]}
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
+ }