@wordpress/compose 6.16.0 → 6.17.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 (207) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/higher-order/compose.js +0 -2
  3. package/build/higher-order/compose.js.map +1 -1
  4. package/build/higher-order/if-condition/index.js +2 -6
  5. package/build/higher-order/if-condition/index.js.map +1 -1
  6. package/build/higher-order/pipe.js +1 -5
  7. package/build/higher-order/pipe.js.map +1 -1
  8. package/build/higher-order/pure/index.js +2 -10
  9. package/build/higher-order/pure/index.js.map +1 -1
  10. package/build/higher-order/with-global-events/index.js +13 -32
  11. package/build/higher-order/with-global-events/index.js.map +1 -1
  12. package/build/higher-order/with-global-events/listener.js +5 -28
  13. package/build/higher-order/with-global-events/listener.js.map +1 -1
  14. package/build/higher-order/with-instance-id/index.js +4 -8
  15. package/build/higher-order/with-instance-id/index.js.map +1 -1
  16. package/build/higher-order/with-preferred-color-scheme/index.native.js +3 -6
  17. package/build/higher-order/with-preferred-color-scheme/index.native.js.map +1 -1
  18. package/build/higher-order/with-safe-timeout/index.js +4 -14
  19. package/build/higher-order/with-safe-timeout/index.js.map +1 -1
  20. package/build/higher-order/with-state/index.js +3 -11
  21. package/build/higher-order/with-state/index.js.map +1 -1
  22. package/build/hooks/use-async-list/index.js +1 -14
  23. package/build/hooks/use-async-list/index.js.map +1 -1
  24. package/build/hooks/use-constrained-tabbing/index.js +14 -30
  25. package/build/hooks/use-constrained-tabbing/index.js.map +1 -1
  26. package/build/hooks/use-constrained-tabbing/index.native.js +4 -4
  27. package/build/hooks/use-constrained-tabbing/index.native.js.map +1 -1
  28. package/build/hooks/use-copy-on-click/index.js +6 -15
  29. package/build/hooks/use-copy-on-click/index.js.map +1 -1
  30. package/build/hooks/use-copy-to-clipboard/index.js +3 -11
  31. package/build/hooks/use-copy-to-clipboard/index.js.map +1 -1
  32. package/build/hooks/use-debounce/index.js +0 -4
  33. package/build/hooks/use-debounce/index.js.map +1 -1
  34. package/build/hooks/use-dialog/index.js +2 -12
  35. package/build/hooks/use-dialog/index.js.map +1 -1
  36. package/build/hooks/use-disabled/index.js +5 -15
  37. package/build/hooks/use-disabled/index.js.map +1 -1
  38. package/build/hooks/use-dragging/index.js +4 -11
  39. package/build/hooks/use-dragging/index.js.map +1 -1
  40. package/build/hooks/use-drop-zone/index.js +27 -66
  41. package/build/hooks/use-drop-zone/index.js.map +1 -1
  42. package/build/hooks/use-fixed-window-list/index.js +8 -34
  43. package/build/hooks/use-fixed-window-list/index.js.map +1 -1
  44. package/build/hooks/use-focus-on-mount/index.js +3 -14
  45. package/build/hooks/use-focus-on-mount/index.js.map +1 -1
  46. package/build/hooks/use-focus-outside/index.js +13 -19
  47. package/build/hooks/use-focus-outside/index.js.map +1 -1
  48. package/build/hooks/use-focus-outside/index.native.js +13 -21
  49. package/build/hooks/use-focus-outside/index.native.js.map +1 -1
  50. package/build/hooks/use-focus-return/index.js +7 -15
  51. package/build/hooks/use-focus-return/index.js.map +1 -1
  52. package/build/hooks/use-focusable-iframe/index.js +1 -5
  53. package/build/hooks/use-focusable-iframe/index.js.map +1 -1
  54. package/build/hooks/use-instance-id/index.js +3 -5
  55. package/build/hooks/use-instance-id/index.js.map +1 -1
  56. package/build/hooks/use-isomorphic-layout-effect/index.js +0 -2
  57. package/build/hooks/use-isomorphic-layout-effect/index.js.map +1 -1
  58. package/build/hooks/use-keyboard-shortcut/index.js +12 -28
  59. package/build/hooks/use-keyboard-shortcut/index.js.map +1 -1
  60. package/build/hooks/use-keyboard-shortcut/index.native.js +0 -2
  61. package/build/hooks/use-keyboard-shortcut/index.native.js.map +1 -1
  62. package/build/hooks/use-media-query/index.js +1 -9
  63. package/build/hooks/use-media-query/index.js.map +1 -1
  64. package/build/hooks/use-merge-refs/index.js +18 -24
  65. package/build/hooks/use-merge-refs/index.js.map +1 -1
  66. package/build/hooks/use-preferred-color-scheme/index.android.js +0 -5
  67. package/build/hooks/use-preferred-color-scheme/index.android.js.map +1 -1
  68. package/build/hooks/use-preferred-color-scheme/index.ios.js +0 -2
  69. package/build/hooks/use-preferred-color-scheme/index.ios.js.map +1 -1
  70. package/build/hooks/use-preferred-color-scheme-style/index.native.js +2 -5
  71. package/build/hooks/use-preferred-color-scheme-style/index.native.js.map +1 -1
  72. package/build/hooks/use-previous/index.js +3 -4
  73. package/build/hooks/use-previous/index.js.map +1 -1
  74. package/build/hooks/use-reduced-motion/index.js +0 -4
  75. package/build/hooks/use-reduced-motion/index.js.map +1 -1
  76. package/build/hooks/use-ref-effect/index.js +0 -2
  77. package/build/hooks/use-ref-effect/index.js.map +1 -1
  78. package/build/hooks/use-resize-observer/index.js +23 -30
  79. package/build/hooks/use-resize-observer/index.js.map +1 -1
  80. package/build/hooks/use-resize-observer/index.native.js +0 -6
  81. package/build/hooks/use-resize-observer/index.native.js.map +1 -1
  82. package/build/hooks/use-throttle/index.js +0 -4
  83. package/build/hooks/use-throttle/index.js.map +1 -1
  84. package/build/hooks/use-viewport-match/index.js +4 -13
  85. package/build/hooks/use-viewport-match/index.js.map +1 -1
  86. package/build/hooks/use-warn-on-change/index.js +4 -14
  87. package/build/hooks/use-warn-on-change/index.js.map +1 -1
  88. package/build/index.js +0 -41
  89. package/build/index.js.map +1 -1
  90. package/build/index.native.js +0 -33
  91. package/build/index.native.js.map +1 -1
  92. package/build/utils/create-higher-order-component/index.js +1 -4
  93. package/build/utils/create-higher-order-component/index.js.map +1 -1
  94. package/build/utils/debounce/index.js +12 -37
  95. package/build/utils/debounce/index.js.map +1 -1
  96. package/build/utils/throttle/index.js +0 -5
  97. package/build/utils/throttle/index.js.map +1 -1
  98. package/build-module/higher-order/compose.js +1 -1
  99. package/build-module/higher-order/compose.js.map +1 -1
  100. package/build-module/higher-order/if-condition/index.js +3 -5
  101. package/build-module/higher-order/if-condition/index.js.map +1 -1
  102. package/build-module/higher-order/pipe.js +1 -4
  103. package/build-module/higher-order/pipe.js.map +1 -1
  104. package/build-module/higher-order/pure/index.js +4 -8
  105. package/build-module/higher-order/pure/index.js.map +1 -1
  106. package/build-module/higher-order/with-global-events/index.js +15 -29
  107. package/build-module/higher-order/with-global-events/index.js.map +1 -1
  108. package/build-module/higher-order/with-global-events/listener.js +5 -27
  109. package/build-module/higher-order/with-global-events/listener.js.map +1 -1
  110. package/build-module/higher-order/with-instance-id/index.js +5 -5
  111. package/build-module/higher-order/with-instance-id/index.js.map +1 -1
  112. package/build-module/higher-order/with-preferred-color-scheme/index.native.js +3 -3
  113. package/build-module/higher-order/with-preferred-color-scheme/index.native.js.map +1 -1
  114. package/build-module/higher-order/with-safe-timeout/index.js +6 -8
  115. package/build-module/higher-order/with-safe-timeout/index.js.map +1 -1
  116. package/build-module/higher-order/with-state/index.js +5 -9
  117. package/build-module/higher-order/with-state/index.js.map +1 -1
  118. package/build-module/hooks/use-async-list/index.js +1 -12
  119. package/build-module/hooks/use-async-list/index.js.map +1 -1
  120. package/build-module/hooks/use-constrained-tabbing/index.js +16 -27
  121. package/build-module/hooks/use-constrained-tabbing/index.js.map +1 -1
  122. package/build-module/hooks/use-constrained-tabbing/index.native.js +3 -3
  123. package/build-module/hooks/use-constrained-tabbing/index.native.js.map +1 -1
  124. package/build-module/hooks/use-copy-on-click/index.js +8 -12
  125. package/build-module/hooks/use-copy-on-click/index.js.map +1 -1
  126. package/build-module/hooks/use-copy-to-clipboard/index.js +6 -9
  127. package/build-module/hooks/use-copy-to-clipboard/index.js.map +1 -1
  128. package/build-module/hooks/use-debounce/index.js +3 -3
  129. package/build-module/hooks/use-debounce/index.js.map +1 -1
  130. package/build-module/hooks/use-dialog/index.js +3 -5
  131. package/build-module/hooks/use-dialog/index.js.map +1 -1
  132. package/build-module/hooks/use-disabled/index.js +6 -12
  133. package/build-module/hooks/use-disabled/index.js.map +1 -1
  134. package/build-module/hooks/use-dragging/index.js +6 -9
  135. package/build-module/hooks/use-dragging/index.js.map +1 -1
  136. package/build-module/hooks/use-drop-zone/index.js +29 -64
  137. package/build-module/hooks/use-drop-zone/index.js.map +1 -1
  138. package/build-module/hooks/use-fixed-window-list/index.js +8 -30
  139. package/build-module/hooks/use-fixed-window-list/index.js.map +1 -1
  140. package/build-module/hooks/use-focus-on-mount/index.js +4 -12
  141. package/build-module/hooks/use-focus-on-mount/index.js.map +1 -1
  142. package/build-module/hooks/use-focus-outside/index.js +14 -18
  143. package/build-module/hooks/use-focus-outside/index.js.map +1 -1
  144. package/build-module/hooks/use-focus-outside/index.native.js +14 -20
  145. package/build-module/hooks/use-focus-outside/index.native.js.map +1 -1
  146. package/build-module/hooks/use-focus-return/index.js +8 -14
  147. package/build-module/hooks/use-focus-return/index.js.map +1 -1
  148. package/build-module/hooks/use-focusable-iframe/index.js +2 -3
  149. package/build-module/hooks/use-focusable-iframe/index.js.map +1 -1
  150. package/build-module/hooks/use-instance-id/index.js +2 -3
  151. package/build-module/hooks/use-instance-id/index.js.map +1 -1
  152. package/build-module/hooks/use-isomorphic-layout-effect/index.js +1 -1
  153. package/build-module/hooks/use-isomorphic-layout-effect/index.js.map +1 -1
  154. package/build-module/hooks/use-keyboard-shortcut/index.js +14 -24
  155. package/build-module/hooks/use-keyboard-shortcut/index.js.map +1 -1
  156. package/build-module/hooks/use-keyboard-shortcut/index.native.js +0 -1
  157. package/build-module/hooks/use-keyboard-shortcut/index.native.js.map +1 -1
  158. package/build-module/hooks/use-media-query/index.js +2 -8
  159. package/build-module/hooks/use-media-query/index.js.map +1 -1
  160. package/build-module/hooks/use-merge-refs/index.js +19 -23
  161. package/build-module/hooks/use-merge-refs/index.js.map +1 -1
  162. package/build-module/hooks/use-preferred-color-scheme/index.android.js +1 -3
  163. package/build-module/hooks/use-preferred-color-scheme/index.android.js.map +1 -1
  164. package/build-module/hooks/use-preferred-color-scheme/index.ios.js +1 -1
  165. package/build-module/hooks/use-preferred-color-scheme/index.ios.js.map +1 -1
  166. package/build-module/hooks/use-preferred-color-scheme-style/index.native.js +3 -3
  167. package/build-module/hooks/use-preferred-color-scheme-style/index.native.js.map +1 -1
  168. package/build-module/hooks/use-previous/index.js +4 -3
  169. package/build-module/hooks/use-previous/index.js.map +1 -1
  170. package/build-module/hooks/use-reduced-motion/index.js +1 -2
  171. package/build-module/hooks/use-reduced-motion/index.js.map +1 -1
  172. package/build-module/hooks/use-ref-effect/index.js +1 -1
  173. package/build-module/hooks/use-ref-effect/index.js.map +1 -1
  174. package/build-module/hooks/use-resize-observer/index.js +22 -30
  175. package/build-module/hooks/use-resize-observer/index.js.map +1 -1
  176. package/build-module/hooks/use-resize-observer/index.native.js +1 -6
  177. package/build-module/hooks/use-resize-observer/index.native.js.map +1 -1
  178. package/build-module/hooks/use-throttle/index.js +3 -3
  179. package/build-module/hooks/use-throttle/index.js.map +1 -1
  180. package/build-module/hooks/use-viewport-match/index.js +6 -11
  181. package/build-module/hooks/use-viewport-match/index.js.map +1 -1
  182. package/build-module/hooks/use-warn-on-change/index.js +6 -12
  183. package/build-module/hooks/use-warn-on-change/index.js.map +1 -1
  184. package/build-module/index.js +10 -7
  185. package/build-module/index.js.map +1 -1
  186. package/build-module/index.native.js +10 -7
  187. package/build-module/index.native.js.map +1 -1
  188. package/build-module/utils/create-higher-order-component/index.js +1 -2
  189. package/build-module/utils/create-higher-order-component/index.js.map +1 -1
  190. package/build-module/utils/debounce/index.js +12 -35
  191. package/build-module/utils/debounce/index.js.map +1 -1
  192. package/build-module/utils/throttle/index.js +0 -3
  193. package/build-module/utils/throttle/index.js.map +1 -1
  194. package/build-types/higher-order/with-instance-id/index.d.ts +1 -1
  195. package/build-types/higher-order/with-instance-id/index.d.ts.map +1 -1
  196. package/build-types/higher-order/with-safe-timeout/index.d.ts +1 -1
  197. package/build-types/higher-order/with-safe-timeout/index.d.ts.map +1 -1
  198. package/build-types/hooks/use-disabled/index.d.ts +1 -1
  199. package/build-types/hooks/use-disabled/index.d.ts.map +1 -1
  200. package/build-types/hooks/use-isomorphic-layout-effect/index.d.ts +1 -1
  201. package/build-types/hooks/use-isomorphic-layout-effect/index.d.ts.map +1 -1
  202. package/build-types/hooks/use-viewport-match/index.d.ts +1 -1
  203. package/package.json +8 -8
  204. package/src/higher-order/with-instance-id/index.tsx +2 -2
  205. package/src/higher-order/with-safe-timeout/index.tsx +2 -2
  206. package/src/hooks/use-resize-observer/index.native.js +0 -1
  207. package/tsconfig.tsbuildinfo +1 -1
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = useResizeAware;
7
-
8
7
  var _element = require("@wordpress/element");
9
-
10
8
  /**
11
9
  * External dependencies
12
10
  */
@@ -14,6 +12,7 @@ var _element = require("@wordpress/element");
14
12
  /**
15
13
  * WordPress dependencies
16
14
  */
15
+
17
16
  // This of course could've been more streamlined with internal state instead of
18
17
  // refs, but then host hooks / components could not opt out of renders.
19
18
  // This could've been exported to its own module, but the current build doesn't
@@ -24,7 +23,6 @@ function useResolvedElement(subscriber, refOrElement) {
24
23
  const cleanupRef = (0, _element.useRef)();
25
24
  const callSubscriber = (0, _element.useCallback)(() => {
26
25
  let element = null;
27
-
28
26
  if (callbackRefElement.current) {
29
27
  element = callbackRefElement.current;
30
28
  } else if (refOrElement) {
@@ -34,28 +32,27 @@ function useResolvedElement(subscriber, refOrElement) {
34
32
  element = refOrElement.current;
35
33
  }
36
34
  }
37
-
38
35
  if (lastReportRef.current && lastReportRef.current.element === element && lastReportRef.current.reporter === callSubscriber) {
39
36
  return;
40
37
  }
41
-
42
38
  if (cleanupRef.current) {
43
- cleanupRef.current(); // Making sure the cleanup is not called accidentally multiple times.
44
-
39
+ cleanupRef.current();
40
+ // Making sure the cleanup is not called accidentally multiple times.
45
41
  cleanupRef.current = null;
46
42
  }
47
-
48
43
  lastReportRef.current = {
49
44
  reporter: callSubscriber,
50
45
  element
51
- }; // Only calling the subscriber, if there's an actual element to report.
46
+ };
52
47
 
48
+ // Only calling the subscriber, if there's an actual element to report.
53
49
  if (element) {
54
50
  cleanupRef.current = subscriber(element);
55
51
  }
56
- }, [refOrElement, subscriber]); // On each render, we check whether a ref changed, or if we got a new raw
57
- // element.
52
+ }, [refOrElement, subscriber]);
58
53
 
54
+ // On each render, we check whether a ref changed, or if we got a new raw
55
+ // element.
59
56
  (0, _element.useEffect)(() => {
60
57
  // With this we're *technically* supporting cases where ref objects' current value changes, but only if there's a
61
58
  // render accompanying that change as well.
@@ -68,7 +65,6 @@ function useResolvedElement(subscriber, refOrElement) {
68
65
  callSubscriber();
69
66
  }, [callSubscriber]);
70
67
  }
71
-
72
68
  // We're only using the first element of the size sequences, until future versions of the spec solidify on how
73
69
  // exactly it'll be used for fragments in multi-column scenarios:
74
70
  // From the spec:
@@ -104,17 +100,16 @@ const extractSize = (entry, boxProp, sizeType) => {
104
100
  // In real browser implementations of course these objects differ, but the width/height values should be equivalent.
105
101
  return entry.contentRect[sizeType === 'inlineSize' ? 'width' : 'height'];
106
102
  }
107
-
108
103
  return undefined;
109
- } // A couple bytes smaller than calling Array.isArray() and just as effective here.
110
-
104
+ }
111
105
 
112
- return entry[boxProp][0] ? entry[boxProp][0][sizeType] : // TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's current
106
+ // A couple bytes smaller than calling Array.isArray() and just as effective here.
107
+ return entry[boxProp][0] ? entry[boxProp][0][sizeType] :
108
+ // TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's current
113
109
  // behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`.
114
110
  // @ts-ignore
115
111
  entry[boxProp][sizeType];
116
112
  };
117
-
118
113
  function useResizeObserver(opts = {}) {
119
114
  // Saving the callback as a ref. With this, I don't need to put onResize in the
120
115
  // effect dep array, and just passing in an anonymous function without memoising
@@ -122,30 +117,34 @@ function useResizeObserver(opts = {}) {
122
117
  const onResize = opts.onResize;
123
118
  const onResizeRef = (0, _element.useRef)(undefined);
124
119
  onResizeRef.current = onResize;
125
- const round = opts.round || Math.round; // Using a single instance throughout the hook's lifetime
120
+ const round = opts.round || Math.round;
126
121
 
122
+ // Using a single instance throughout the hook's lifetime
127
123
  const resizeObserverRef = (0, _element.useRef)();
128
124
  const [size, setSize] = (0, _element.useState)({
129
125
  width: undefined,
130
126
  height: undefined
131
- }); // In certain edge cases the RO might want to report a size change just after
132
- // the component unmounted.
127
+ });
133
128
 
129
+ // In certain edge cases the RO might want to report a size change just after
130
+ // the component unmounted.
134
131
  const didUnmount = (0, _element.useRef)(false);
135
132
  (0, _element.useEffect)(() => {
136
133
  didUnmount.current = false;
137
134
  return () => {
138
135
  didUnmount.current = true;
139
136
  };
140
- }, []); // Using a ref to track the previous width / height to avoid unnecessary renders.
137
+ }, []);
141
138
 
139
+ // Using a ref to track the previous width / height to avoid unnecessary renders.
142
140
  const previous = (0, _element.useRef)({
143
141
  width: undefined,
144
142
  height: undefined
145
- }); // This block is kinda like a useEffect, only it's called whenever a new
143
+ });
144
+
145
+ // This block is kinda like a useEffect, only it's called whenever a new
146
146
  // element could be resolved based on the ref option. It also has a cleanup
147
147
  // function.
148
-
149
148
  const refCallback = useResolvedElement((0, _element.useCallback)(element => {
150
149
  // We only use a single Resize Observer instance, and we're instantiating it on demand, only once there's something to observe.
151
150
  // This instance is also recreated when the `box` option changes, so that a new observation is fired if there was a previously observed element with a different box option.
@@ -156,18 +155,15 @@ function useResizeObserver(opts = {}) {
156
155
  instance: new ResizeObserver(entries => {
157
156
  const entry = entries[0];
158
157
  let boxProp = 'borderBoxSize';
159
-
160
158
  if (opts.box === 'border-box') {
161
159
  boxProp = 'borderBoxSize';
162
160
  } else {
163
161
  boxProp = opts.box === 'device-pixel-content-box' ? 'devicePixelContentBoxSize' : 'contentBoxSize';
164
162
  }
165
-
166
163
  const reportedWidth = extractSize(entry, boxProp, 'inlineSize');
167
164
  const reportedHeight = extractSize(entry, boxProp, 'blockSize');
168
165
  const newWidth = reportedWidth ? round(reportedWidth) : undefined;
169
166
  const newHeight = reportedHeight ? round(reportedHeight) : undefined;
170
-
171
167
  if (previous.current.width !== newWidth || previous.current.height !== newHeight) {
172
168
  const newSize = {
173
169
  width: newWidth,
@@ -175,7 +171,6 @@ function useResizeObserver(opts = {}) {
175
171
  };
176
172
  previous.current.width = newWidth;
177
173
  previous.current.height = newHeight;
178
-
179
174
  if (onResizeRef.current) {
180
175
  onResizeRef.current(newSize);
181
176
  } else if (!didUnmount.current) {
@@ -185,7 +180,6 @@ function useResizeObserver(opts = {}) {
185
180
  })
186
181
  };
187
182
  }
188
-
189
183
  resizeObserverRef.current.instance.observe(element, {
190
184
  box: opts.box
191
185
  });
@@ -201,6 +195,7 @@ function useResizeObserver(opts = {}) {
201
195
  height: size.height
202
196
  }), [refCallback, size ? size.width : null, size ? size.height : null]);
203
197
  }
198
+
204
199
  /**
205
200
  * Hook which allows to listen the resize event of any target element when it changes sizes.
206
201
  * _Note: `useResizeObserver` will report `null` until after first render.
@@ -220,8 +215,6 @@ function useResizeObserver(opts = {}) {
220
215
  * };
221
216
  * ```
222
217
  */
223
-
224
-
225
218
  function useResizeAware() {
226
219
  const {
227
220
  ref,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-resize-observer/index.tsx"],"names":["useResolvedElement","subscriber","refOrElement","callbackRefElement","lastReportRef","cleanupRef","callSubscriber","element","current","HTMLElement","reporter","extractSize","entry","boxProp","sizeType","contentRect","undefined","useResizeObserver","opts","onResize","onResizeRef","round","Math","resizeObserverRef","size","setSize","width","height","didUnmount","previous","refCallback","box","instance","ResizeObserver","entries","reportedWidth","reportedHeight","newWidth","newHeight","newSize","observe","unobserve","ref","useResizeAware","sizes","resizeListener","position","top","left","right","bottom","pointerEvents","opacity","overflow","zIndex"],"mappings":";;;;;;;AAQA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA,SAASA,kBAAT,CACCC,UADD,EAECC,YAFD,EAGoB;AACnB,QAAMC,kBAAkB,GAAG,qBAAoB,IAApB,CAA3B;AACA,QAAMC,aAAa,GAAG,qBAGV,IAHU,CAAtB;AAIA,QAAMC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AI,CAACG;AAHN,GAAR,CADM,EAMN,CAAEG,WAAF,EAAeN,IAAI,GAAGA,IAAI,CAACE,KAAR,GAAgB,IAAnC,EAAyCF,IAAI,GAAGA,IAAI,CAACG,MAAR,GAAiB,IAA9D,CANM,CAAP;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACe,SAASgB,cAAT,GAGb;AACD,QAAM;AAAED,IAAAA,GAAF;AAAOhB,IAAAA,KAAP;AAAcC,IAAAA;AAAd,MAAyBV,iBAAiB,EAAhD;AACA,QAAM2B,KAAK,GAAG,sBAAS,MAAM;AAC5B,WAAO;AAAElB,MAAAA,KAAK,EAAEA,KAAF,aAAEA,KAAF,cAAEA,KAAF,GAAW,IAAlB;AAAwBC,MAAAA,MAAM,EAAEA,MAAF,aAAEA,MAAF,cAAEA,MAAF,GAAY;AAA1C,KAAP;AACA,GAFa,EAEX,CAAED,KAAF,EAASC,MAAT,CAFW,CAAd;AAGA,QAAMkB,cAAc,GACnB;AACC,IAAA,KAAK,EAAG;AACPC,MAAAA,QAAQ,EAAE,UADH;AAEPC,MAAAA,GAAG,EAAE,CAFE;AAGPC,MAAAA,IAAI,EAAE,CAHC;AAIPC,MAAAA,KAAK,EAAE,CAJA;AAKPC,MAAAA,MAAM,EAAE,CALD;AAMPC,MAAAA,aAAa,EAAE,MANR;AAOPC,MAAAA,OAAO,EAAE,CAPF;AAQPC,MAAAA,QAAQ,EAAE,QARH;AASPC,MAAAA,MAAM,EAAE,CAAC;AATF,KADT;AAYC,mBAAY,MAZb;AAaC,IAAA,GAAG,EAAGZ;AAbP,IADD;AAiBA,SAAO,CAAEG,cAAF,EAAkBD,KAAlB,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport type { RefCallback, RefObject } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseMemo,\n\tuseRef,\n\tuseCallback,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\nimport type { WPElement } from '@wordpress/element';\n\ntype SubscriberCleanup = () => void;\ntype SubscriberResponse = SubscriberCleanup | void;\n\n// This of course could've been more streamlined with internal state instead of\n// refs, but then host hooks / components could not opt out of renders.\n// This could've been exported to its own module, but the current build doesn't\n// seem to work with module imports and I had no more time to spend on this...\nfunction useResolvedElement< T extends HTMLElement >(\n\tsubscriber: ( element: T ) => SubscriberResponse,\n\trefOrElement?: T | RefObject< T > | null\n): RefCallback< T > {\n\tconst callbackRefElement = useRef< T | null >( null );\n\tconst lastReportRef = useRef< {\n\t\treporter: () => void;\n\t\telement: T | null;\n\t} | null >( null );\n\tconst cleanupRef = useRef< SubscriberResponse | null >();\n\n\tconst callSubscriber = useCallback( () => {\n\t\tlet element = null;\n\t\tif ( callbackRefElement.current ) {\n\t\t\telement = callbackRefElement.current;\n\t\t} else if ( refOrElement ) {\n\t\t\tif ( refOrElement instanceof HTMLElement ) {\n\t\t\t\telement = refOrElement;\n\t\t\t} else {\n\t\t\t\telement = refOrElement.current;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tlastReportRef.current &&\n\t\t\tlastReportRef.current.element === element &&\n\t\t\tlastReportRef.current.reporter === callSubscriber\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( cleanupRef.current ) {\n\t\t\tcleanupRef.current();\n\t\t\t// Making sure the cleanup is not called accidentally multiple times.\n\t\t\tcleanupRef.current = null;\n\t\t}\n\t\tlastReportRef.current = {\n\t\t\treporter: callSubscriber,\n\t\t\telement,\n\t\t};\n\n\t\t// Only calling the subscriber, if there's an actual element to report.\n\t\tif ( element ) {\n\t\t\tcleanupRef.current = subscriber( element );\n\t\t}\n\t}, [ refOrElement, subscriber ] );\n\n\t// On each render, we check whether a ref changed, or if we got a new raw\n\t// element.\n\tuseEffect( () => {\n\t\t// With this we're *technically* supporting cases where ref objects' current value changes, but only if there's a\n\t\t// render accompanying that change as well.\n\t\t// To guarantee we always have the right element, one must use the ref callback provided instead, but we support\n\t\t// RefObjects to make the hook API more convenient in certain cases.\n\t\tcallSubscriber();\n\t}, [ callSubscriber ] );\n\n\treturn useCallback< RefCallback< T > >(\n\t\t( element ) => {\n\t\t\tcallbackRefElement.current = element;\n\t\t\tcallSubscriber();\n\t\t},\n\t\t[ callSubscriber ]\n\t);\n}\n\ntype ObservedSize = {\n\twidth: number | undefined;\n\theight: number | undefined;\n};\n\ntype ResizeHandler = ( size: ObservedSize ) => void;\n\ntype HookResponse< T extends HTMLElement > = {\n\tref: RefCallback< T >;\n} & ObservedSize;\n\n// Declaring my own type here instead of using the one provided by TS (available since 4.2.2), because this way I'm not\n// forcing consumers to use a specific TS version.\ntype ResizeObserverBoxOptions =\n\t| 'border-box'\n\t| 'content-box'\n\t| 'device-pixel-content-box';\n\ndeclare global {\n\tinterface ResizeObserverEntry {\n\t\treadonly devicePixelContentBoxSize: ReadonlyArray< ResizeObserverSize >;\n\t}\n}\n\n// We're only using the first element of the size sequences, until future versions of the spec solidify on how\n// exactly it'll be used for fragments in multi-column scenarios:\n// From the spec:\n// > The box size properties are exposed as FrozenArray in order to support elements that have multiple fragments,\n// > which occur in multi-column scenarios. However the current definitions of content rect and border box do not\n// > mention how those boxes are affected by multi-column layout. In this spec, there will only be a single\n// > ResizeObserverSize returned in the FrozenArray, which will correspond to the dimensions of the first column.\n// > A future version of this spec will extend the returned FrozenArray to contain the per-fragment size information.\n// (https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface)\n//\n// Also, testing these new box options revealed that in both Chrome and FF everything is returned in the callback,\n// regardless of the \"box\" option.\n// The spec states the following on this:\n// > This does not have any impact on which box dimensions are returned to the defined callback when the event\n// > is fired, it solely defines which box the author wishes to observe layout changes on.\n// (https://drafts.csswg.org/resize-observer/#resize-observer-interface)\n// I'm not exactly clear on what this means, especially when you consider a later section stating the following:\n// > This section is non-normative. An author may desire to observe more than one CSS box.\n// > In this case, author will need to use multiple ResizeObservers.\n// (https://drafts.csswg.org/resize-observer/#resize-observer-interface)\n// Which is clearly not how current browser implementations behave, and seems to contradict the previous quote.\n// For this reason I decided to only return the requested size,\n// even though it seems we have access to results for all box types.\n// This also means that we get to keep the current api, being able to return a simple { width, height } pair,\n// regardless of box option.\nconst extractSize = (\n\tentry: ResizeObserverEntry,\n\tboxProp: 'borderBoxSize' | 'contentBoxSize' | 'devicePixelContentBoxSize',\n\tsizeType: keyof ResizeObserverSize\n): number | undefined => {\n\tif ( ! entry[ boxProp ] ) {\n\t\tif ( boxProp === 'contentBoxSize' ) {\n\t\t\t// The dimensions in `contentBoxSize` and `contentRect` are equivalent according to the spec.\n\t\t\t// See the 6th step in the description for the RO algorithm:\n\t\t\t// https://drafts.csswg.org/resize-observer/#create-and-populate-resizeobserverentry-h\n\t\t\t// > Set this.contentRect to logical this.contentBoxSize given target and observedBox of \"content-box\".\n\t\t\t// In real browser implementations of course these objects differ, but the width/height values should be equivalent.\n\t\t\treturn entry.contentRect[\n\t\t\t\tsizeType === 'inlineSize' ? 'width' : 'height'\n\t\t\t];\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t// A couple bytes smaller than calling Array.isArray() and just as effective here.\n\treturn entry[ boxProp ][ 0 ]\n\t\t? entry[ boxProp ][ 0 ][ sizeType ]\n\t\t: // TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's current\n\t\t // behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`.\n\t\t // @ts-ignore\n\t\t entry[ boxProp ][ sizeType ];\n};\n\ntype RoundingFunction = ( n: number ) => number;\n\nfunction useResizeObserver< T extends HTMLElement >(\n\topts: {\n\t\tref?: RefObject< T > | T | null | undefined;\n\t\tonResize?: ResizeHandler;\n\t\tbox?: ResizeObserverBoxOptions;\n\t\tround?: RoundingFunction;\n\t} = {}\n): HookResponse< T > {\n\t// Saving the callback as a ref. With this, I don't need to put onResize in the\n\t// effect dep array, and just passing in an anonymous function without memoising\n\t// will not reinstantiate the hook's ResizeObserver.\n\tconst onResize = opts.onResize;\n\tconst onResizeRef = useRef< ResizeHandler | undefined >( undefined );\n\tonResizeRef.current = onResize;\n\tconst round = opts.round || Math.round;\n\n\t// Using a single instance throughout the hook's lifetime\n\tconst resizeObserverRef = useRef< {\n\t\tbox?: ResizeObserverBoxOptions;\n\t\tround?: RoundingFunction;\n\t\tinstance: ResizeObserver;\n\t} >();\n\n\tconst [ size, setSize ] = useState< {\n\t\twidth?: number;\n\t\theight?: number;\n\t} >( {\n\t\twidth: undefined,\n\t\theight: undefined,\n\t} );\n\n\t// In certain edge cases the RO might want to report a size change just after\n\t// the component unmounted.\n\tconst didUnmount = useRef( false );\n\tuseEffect( () => {\n\t\tdidUnmount.current = false;\n\t\treturn () => {\n\t\t\tdidUnmount.current = true;\n\t\t};\n\t}, [] );\n\n\t// Using a ref to track the previous width / height to avoid unnecessary renders.\n\tconst previous: {\n\t\tcurrent: {\n\t\t\twidth?: number;\n\t\t\theight?: number;\n\t\t};\n\t} = useRef( {\n\t\twidth: undefined,\n\t\theight: undefined,\n\t} );\n\n\t// This block is kinda like a useEffect, only it's called whenever a new\n\t// element could be resolved based on the ref option. It also has a cleanup\n\t// function.\n\tconst refCallback = useResolvedElement< T >(\n\t\tuseCallback(\n\t\t\t( element ) => {\n\t\t\t\t// We only use a single Resize Observer instance, and we're instantiating it on demand, only once there's something to observe.\n\t\t\t\t// This instance is also recreated when the `box` option changes, so that a new observation is fired if there was a previously observed element with a different box option.\n\t\t\t\tif (\n\t\t\t\t\t! resizeObserverRef.current ||\n\t\t\t\t\tresizeObserverRef.current.box !== opts.box ||\n\t\t\t\t\tresizeObserverRef.current.round !== round\n\t\t\t\t) {\n\t\t\t\t\tresizeObserverRef.current = {\n\t\t\t\t\t\tbox: opts.box,\n\t\t\t\t\t\tround,\n\t\t\t\t\t\tinstance: new ResizeObserver( ( entries ) => {\n\t\t\t\t\t\t\tconst entry = entries[ 0 ];\n\n\t\t\t\t\t\t\tlet boxProp:\n\t\t\t\t\t\t\t\t| 'borderBoxSize'\n\t\t\t\t\t\t\t\t| 'contentBoxSize'\n\t\t\t\t\t\t\t\t| 'devicePixelContentBoxSize' = 'borderBoxSize';\n\t\t\t\t\t\t\tif ( opts.box === 'border-box' ) {\n\t\t\t\t\t\t\t\tboxProp = 'borderBoxSize';\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tboxProp =\n\t\t\t\t\t\t\t\t\topts.box === 'device-pixel-content-box'\n\t\t\t\t\t\t\t\t\t\t? 'devicePixelContentBoxSize'\n\t\t\t\t\t\t\t\t\t\t: 'contentBoxSize';\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst reportedWidth = extractSize(\n\t\t\t\t\t\t\t\tentry,\n\t\t\t\t\t\t\t\tboxProp,\n\t\t\t\t\t\t\t\t'inlineSize'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst reportedHeight = extractSize(\n\t\t\t\t\t\t\t\tentry,\n\t\t\t\t\t\t\t\tboxProp,\n\t\t\t\t\t\t\t\t'blockSize'\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tconst newWidth = reportedWidth\n\t\t\t\t\t\t\t\t? round( reportedWidth )\n\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\tconst newHeight = reportedHeight\n\t\t\t\t\t\t\t\t? round( reportedHeight )\n\t\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tprevious.current.width !== newWidth ||\n\t\t\t\t\t\t\t\tprevious.current.height !== newHeight\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tconst newSize = {\n\t\t\t\t\t\t\t\t\twidth: newWidth,\n\t\t\t\t\t\t\t\t\theight: newHeight,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tprevious.current.width = newWidth;\n\t\t\t\t\t\t\t\tprevious.current.height = newHeight;\n\t\t\t\t\t\t\t\tif ( onResizeRef.current ) {\n\t\t\t\t\t\t\t\t\tonResizeRef.current( newSize );\n\t\t\t\t\t\t\t\t} else if ( ! didUnmount.current ) {\n\t\t\t\t\t\t\t\t\tsetSize( newSize );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} ),\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tresizeObserverRef.current.instance.observe( element, {\n\t\t\t\t\tbox: opts.box,\n\t\t\t\t} );\n\n\t\t\t\treturn () => {\n\t\t\t\t\tif ( resizeObserverRef.current ) {\n\t\t\t\t\t\tresizeObserverRef.current.instance.unobserve( element );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ opts.box, round ]\n\t\t),\n\t\topts.ref\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tref: refCallback,\n\t\t\twidth: size.width,\n\t\t\theight: size.height,\n\t\t} ),\n\t\t[ refCallback, size ? size.width : null, size ? size.height : null ]\n\t);\n}\n\n/**\n * Hook which allows to listen the resize event of any target element when it changes sizes.\n * _Note: `useResizeObserver` will report `null` until after first render.\n *\n * @example\n *\n * ```js\n * const App = () => {\n * \tconst [ resizeListener, sizes ] = useResizeObserver();\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t{ resizeListener }\n * \t\t\tYour content here\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nexport default function useResizeAware(): [\n\tWPElement,\n\t{ width: number | null; height: number | null }\n] {\n\tconst { ref, width, height } = useResizeObserver();\n\tconst sizes = useMemo( () => {\n\t\treturn { width: width ?? null, height: height ?? null };\n\t}, [ width, height ] );\n\tconst resizeListener = (\n\t\t<div\n\t\t\tstyle={ {\n\t\t\t\tposition: 'absolute',\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0,\n\t\t\t\tright: 0,\n\t\t\t\tbottom: 0,\n\t\t\t\tpointerEvents: 'none',\n\t\t\t\topacity: 0,\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tzIndex: -1,\n\t\t\t} }\n\t\t\taria-hidden=\"true\"\n\t\t\tref={ ref }\n\t\t/>\n\t);\n\treturn [ resizeListener, sizes ];\n}\n"]}
1
+ {"version":3,"names":["_element","require","useResolvedElement","subscriber","refOrElement","callbackRefElement","useRef","lastReportRef","cleanupRef","callSubscriber","useCallback","element","current","HTMLElement","reporter","useEffect","extractSize","entry","boxProp","sizeType","contentRect","undefined","useResizeObserver","opts","onResize","onResizeRef","round","Math","resizeObserverRef","size","setSize","useState","width","height","didUnmount","previous","refCallback","box","instance","ResizeObserver","entries","reportedWidth","reportedHeight","newWidth","newHeight","newSize","observe","unobserve","ref","useMemo","useResizeAware","sizes","resizeListener","createElement","style","position","top","left","right","bottom","pointerEvents","opacity","overflow","zIndex"],"sources":["@wordpress/compose/src/hooks/use-resize-observer/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { RefCallback, RefObject } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseMemo,\n\tuseRef,\n\tuseCallback,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\nimport type { WPElement } from '@wordpress/element';\n\ntype SubscriberCleanup = () => void;\ntype SubscriberResponse = SubscriberCleanup | void;\n\n// This of course could've been more streamlined with internal state instead of\n// refs, but then host hooks / components could not opt out of renders.\n// This could've been exported to its own module, but the current build doesn't\n// seem to work with module imports and I had no more time to spend on this...\nfunction useResolvedElement< T extends HTMLElement >(\n\tsubscriber: ( element: T ) => SubscriberResponse,\n\trefOrElement?: T | RefObject< T > | null\n): RefCallback< T > {\n\tconst callbackRefElement = useRef< T | null >( null );\n\tconst lastReportRef = useRef< {\n\t\treporter: () => void;\n\t\telement: T | null;\n\t} | null >( null );\n\tconst cleanupRef = useRef< SubscriberResponse | null >();\n\n\tconst callSubscriber = useCallback( () => {\n\t\tlet element = null;\n\t\tif ( callbackRefElement.current ) {\n\t\t\telement = callbackRefElement.current;\n\t\t} else if ( refOrElement ) {\n\t\t\tif ( refOrElement instanceof HTMLElement ) {\n\t\t\t\telement = refOrElement;\n\t\t\t} else {\n\t\t\t\telement = refOrElement.current;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tlastReportRef.current &&\n\t\t\tlastReportRef.current.element === element &&\n\t\t\tlastReportRef.current.reporter === callSubscriber\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( cleanupRef.current ) {\n\t\t\tcleanupRef.current();\n\t\t\t// Making sure the cleanup is not called accidentally multiple times.\n\t\t\tcleanupRef.current = null;\n\t\t}\n\t\tlastReportRef.current = {\n\t\t\treporter: callSubscriber,\n\t\t\telement,\n\t\t};\n\n\t\t// Only calling the subscriber, if there's an actual element to report.\n\t\tif ( element ) {\n\t\t\tcleanupRef.current = subscriber( element );\n\t\t}\n\t}, [ refOrElement, subscriber ] );\n\n\t// On each render, we check whether a ref changed, or if we got a new raw\n\t// element.\n\tuseEffect( () => {\n\t\t// With this we're *technically* supporting cases where ref objects' current value changes, but only if there's a\n\t\t// render accompanying that change as well.\n\t\t// To guarantee we always have the right element, one must use the ref callback provided instead, but we support\n\t\t// RefObjects to make the hook API more convenient in certain cases.\n\t\tcallSubscriber();\n\t}, [ callSubscriber ] );\n\n\treturn useCallback< RefCallback< T > >(\n\t\t( element ) => {\n\t\t\tcallbackRefElement.current = element;\n\t\t\tcallSubscriber();\n\t\t},\n\t\t[ callSubscriber ]\n\t);\n}\n\ntype ObservedSize = {\n\twidth: number | undefined;\n\theight: number | undefined;\n};\n\ntype ResizeHandler = ( size: ObservedSize ) => void;\n\ntype HookResponse< T extends HTMLElement > = {\n\tref: RefCallback< T >;\n} & ObservedSize;\n\n// Declaring my own type here instead of using the one provided by TS (available since 4.2.2), because this way I'm not\n// forcing consumers to use a specific TS version.\ntype ResizeObserverBoxOptions =\n\t| 'border-box'\n\t| 'content-box'\n\t| 'device-pixel-content-box';\n\ndeclare global {\n\tinterface ResizeObserverEntry {\n\t\treadonly devicePixelContentBoxSize: ReadonlyArray< ResizeObserverSize >;\n\t}\n}\n\n// We're only using the first element of the size sequences, until future versions of the spec solidify on how\n// exactly it'll be used for fragments in multi-column scenarios:\n// From the spec:\n// > The box size properties are exposed as FrozenArray in order to support elements that have multiple fragments,\n// > which occur in multi-column scenarios. However the current definitions of content rect and border box do not\n// > mention how those boxes are affected by multi-column layout. In this spec, there will only be a single\n// > ResizeObserverSize returned in the FrozenArray, which will correspond to the dimensions of the first column.\n// > A future version of this spec will extend the returned FrozenArray to contain the per-fragment size information.\n// (https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface)\n//\n// Also, testing these new box options revealed that in both Chrome and FF everything is returned in the callback,\n// regardless of the \"box\" option.\n// The spec states the following on this:\n// > This does not have any impact on which box dimensions are returned to the defined callback when the event\n// > is fired, it solely defines which box the author wishes to observe layout changes on.\n// (https://drafts.csswg.org/resize-observer/#resize-observer-interface)\n// I'm not exactly clear on what this means, especially when you consider a later section stating the following:\n// > This section is non-normative. An author may desire to observe more than one CSS box.\n// > In this case, author will need to use multiple ResizeObservers.\n// (https://drafts.csswg.org/resize-observer/#resize-observer-interface)\n// Which is clearly not how current browser implementations behave, and seems to contradict the previous quote.\n// For this reason I decided to only return the requested size,\n// even though it seems we have access to results for all box types.\n// This also means that we get to keep the current api, being able to return a simple { width, height } pair,\n// regardless of box option.\nconst extractSize = (\n\tentry: ResizeObserverEntry,\n\tboxProp: 'borderBoxSize' | 'contentBoxSize' | 'devicePixelContentBoxSize',\n\tsizeType: keyof ResizeObserverSize\n): number | undefined => {\n\tif ( ! entry[ boxProp ] ) {\n\t\tif ( boxProp === 'contentBoxSize' ) {\n\t\t\t// The dimensions in `contentBoxSize` and `contentRect` are equivalent according to the spec.\n\t\t\t// See the 6th step in the description for the RO algorithm:\n\t\t\t// https://drafts.csswg.org/resize-observer/#create-and-populate-resizeobserverentry-h\n\t\t\t// > Set this.contentRect to logical this.contentBoxSize given target and observedBox of \"content-box\".\n\t\t\t// In real browser implementations of course these objects differ, but the width/height values should be equivalent.\n\t\t\treturn entry.contentRect[\n\t\t\t\tsizeType === 'inlineSize' ? 'width' : 'height'\n\t\t\t];\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t// A couple bytes smaller than calling Array.isArray() and just as effective here.\n\treturn entry[ boxProp ][ 0 ]\n\t\t? entry[ boxProp ][ 0 ][ sizeType ]\n\t\t: // TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's current\n\t\t // behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`.\n\t\t // @ts-ignore\n\t\t entry[ boxProp ][ sizeType ];\n};\n\ntype RoundingFunction = ( n: number ) => number;\n\nfunction useResizeObserver< T extends HTMLElement >(\n\topts: {\n\t\tref?: RefObject< T > | T | null | undefined;\n\t\tonResize?: ResizeHandler;\n\t\tbox?: ResizeObserverBoxOptions;\n\t\tround?: RoundingFunction;\n\t} = {}\n): HookResponse< T > {\n\t// Saving the callback as a ref. With this, I don't need to put onResize in the\n\t// effect dep array, and just passing in an anonymous function without memoising\n\t// will not reinstantiate the hook's ResizeObserver.\n\tconst onResize = opts.onResize;\n\tconst onResizeRef = useRef< ResizeHandler | undefined >( undefined );\n\tonResizeRef.current = onResize;\n\tconst round = opts.round || Math.round;\n\n\t// Using a single instance throughout the hook's lifetime\n\tconst resizeObserverRef = useRef< {\n\t\tbox?: ResizeObserverBoxOptions;\n\t\tround?: RoundingFunction;\n\t\tinstance: ResizeObserver;\n\t} >();\n\n\tconst [ size, setSize ] = useState< {\n\t\twidth?: number;\n\t\theight?: number;\n\t} >( {\n\t\twidth: undefined,\n\t\theight: undefined,\n\t} );\n\n\t// In certain edge cases the RO might want to report a size change just after\n\t// the component unmounted.\n\tconst didUnmount = useRef( false );\n\tuseEffect( () => {\n\t\tdidUnmount.current = false;\n\t\treturn () => {\n\t\t\tdidUnmount.current = true;\n\t\t};\n\t}, [] );\n\n\t// Using a ref to track the previous width / height to avoid unnecessary renders.\n\tconst previous: {\n\t\tcurrent: {\n\t\t\twidth?: number;\n\t\t\theight?: number;\n\t\t};\n\t} = useRef( {\n\t\twidth: undefined,\n\t\theight: undefined,\n\t} );\n\n\t// This block is kinda like a useEffect, only it's called whenever a new\n\t// element could be resolved based on the ref option. It also has a cleanup\n\t// function.\n\tconst refCallback = useResolvedElement< T >(\n\t\tuseCallback(\n\t\t\t( element ) => {\n\t\t\t\t// We only use a single Resize Observer instance, and we're instantiating it on demand, only once there's something to observe.\n\t\t\t\t// This instance is also recreated when the `box` option changes, so that a new observation is fired if there was a previously observed element with a different box option.\n\t\t\t\tif (\n\t\t\t\t\t! resizeObserverRef.current ||\n\t\t\t\t\tresizeObserverRef.current.box !== opts.box ||\n\t\t\t\t\tresizeObserverRef.current.round !== round\n\t\t\t\t) {\n\t\t\t\t\tresizeObserverRef.current = {\n\t\t\t\t\t\tbox: opts.box,\n\t\t\t\t\t\tround,\n\t\t\t\t\t\tinstance: new ResizeObserver( ( entries ) => {\n\t\t\t\t\t\t\tconst entry = entries[ 0 ];\n\n\t\t\t\t\t\t\tlet boxProp:\n\t\t\t\t\t\t\t\t| 'borderBoxSize'\n\t\t\t\t\t\t\t\t| 'contentBoxSize'\n\t\t\t\t\t\t\t\t| 'devicePixelContentBoxSize' = 'borderBoxSize';\n\t\t\t\t\t\t\tif ( opts.box === 'border-box' ) {\n\t\t\t\t\t\t\t\tboxProp = 'borderBoxSize';\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tboxProp =\n\t\t\t\t\t\t\t\t\topts.box === 'device-pixel-content-box'\n\t\t\t\t\t\t\t\t\t\t? 'devicePixelContentBoxSize'\n\t\t\t\t\t\t\t\t\t\t: 'contentBoxSize';\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst reportedWidth = extractSize(\n\t\t\t\t\t\t\t\tentry,\n\t\t\t\t\t\t\t\tboxProp,\n\t\t\t\t\t\t\t\t'inlineSize'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst reportedHeight = extractSize(\n\t\t\t\t\t\t\t\tentry,\n\t\t\t\t\t\t\t\tboxProp,\n\t\t\t\t\t\t\t\t'blockSize'\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tconst newWidth = reportedWidth\n\t\t\t\t\t\t\t\t? round( reportedWidth )\n\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\tconst newHeight = reportedHeight\n\t\t\t\t\t\t\t\t? round( reportedHeight )\n\t\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tprevious.current.width !== newWidth ||\n\t\t\t\t\t\t\t\tprevious.current.height !== newHeight\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tconst newSize = {\n\t\t\t\t\t\t\t\t\twidth: newWidth,\n\t\t\t\t\t\t\t\t\theight: newHeight,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tprevious.current.width = newWidth;\n\t\t\t\t\t\t\t\tprevious.current.height = newHeight;\n\t\t\t\t\t\t\t\tif ( onResizeRef.current ) {\n\t\t\t\t\t\t\t\t\tonResizeRef.current( newSize );\n\t\t\t\t\t\t\t\t} else if ( ! didUnmount.current ) {\n\t\t\t\t\t\t\t\t\tsetSize( newSize );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} ),\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tresizeObserverRef.current.instance.observe( element, {\n\t\t\t\t\tbox: opts.box,\n\t\t\t\t} );\n\n\t\t\t\treturn () => {\n\t\t\t\t\tif ( resizeObserverRef.current ) {\n\t\t\t\t\t\tresizeObserverRef.current.instance.unobserve( element );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ opts.box, round ]\n\t\t),\n\t\topts.ref\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tref: refCallback,\n\t\t\twidth: size.width,\n\t\t\theight: size.height,\n\t\t} ),\n\t\t[ refCallback, size ? size.width : null, size ? size.height : null ]\n\t);\n}\n\n/**\n * Hook which allows to listen the resize event of any target element when it changes sizes.\n * _Note: `useResizeObserver` will report `null` until after first render.\n *\n * @example\n *\n * ```js\n * const App = () => {\n * \tconst [ resizeListener, sizes ] = useResizeObserver();\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t{ resizeListener }\n * \t\t\tYour content here\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nexport default function useResizeAware(): [\n\tWPElement,\n\t{ width: number | null; height: number | null }\n] {\n\tconst { ref, width, height } = useResizeObserver();\n\tconst sizes = useMemo( () => {\n\t\treturn { width: width ?? null, height: height ?? null };\n\t}, [ width, height ] );\n\tconst resizeListener = (\n\t\t<div\n\t\t\tstyle={ {\n\t\t\t\tposition: 'absolute',\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0,\n\t\t\t\tright: 0,\n\t\t\t\tbottom: 0,\n\t\t\t\tpointerEvents: 'none',\n\t\t\t\topacity: 0,\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tzIndex: -1,\n\t\t\t} }\n\t\t\taria-hidden=\"true\"\n\t\t\tref={ ref }\n\t\t/>\n\t);\n\treturn [ resizeListener, sizes ];\n}\n"],"mappings":";;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAC1BC,UAAgD,EAChDC,YAAwC,EACrB;EACnB,MAAMC,kBAAkB,GAAG,IAAAC,eAAM,EAAc,IAAK,CAAC;EACrD,MAAMC,aAAa,GAAG,IAAAD,eAAM,EAGhB,IAAK,CAAC;EAClB,MAAME,UAAU,GAAG,IAAAF,eAAM,EAA8B,CAAC;EAExD,MAAMG,cAAc,GAAG,IAAAC,oBAAW,EAAE,MAAM;IACzC,IAAIC,OAAO,GAAG,IAAI;IAClB,IAAKN,kBAAkB,CAACO,OAAO,EAAG;MACjCD,OAAO,GAAGN,kBAAkB,CAACO,OAAO;IACrC,CAAC,MAAM,IAAKR,YAAY,EAAG;MAC1B,IAAKA,YAAY,YAAYS,WAAW,EAAG;QAC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EAAEA,MAAM,aAANA,MAAM,cAANA,MAAM,GAAI;IAAK,CAAC;EACxD,CAAC,EAAE,CAAED,KAAK,EAAEC,MAAM,CAAG,CAAC;EACtB,MAAMmB,cAAc,GACnB,IAAApD,QAAA,CAAAqD,aAAA;IACCC,KAAK,EAAG;MACPC,QAAQ,EAAE,UAAU;MACpBC,GAAG,EAAE,CAAC;MACNC,IAAI,EAAE,CAAC;MACPC,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE,CAAC;MACTC,aAAa,EAAE,MAAM;MACrBC,OAAO,EAAE,CAAC;MACVC,QAAQ,EAAE,QAAQ;MAClBC,MAAM,EAAE,CAAC;IACV,CAAG;IACH,eAAY,MAAM;IAClBf,GAAG,EAAGA;EAAK,CACX,CACD;EACD,OAAO,CAAEI,cAAc,EAAED,KAAK,CAAE;AACjC"}
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _element = require("@wordpress/element");
9
-
10
8
  var _reactNative = require("react-native");
11
-
12
9
  /**
13
10
  * External dependencies
14
11
  */
@@ -34,7 +31,6 @@ var _reactNative = require("react-native");
34
31
  * );
35
32
  * };
36
33
  * ```
37
- *
38
34
  */
39
35
  const useResizeObserver = () => {
40
36
  const [measurements, setMeasurements] = (0, _element.useState)(null);
@@ -52,7 +48,6 @@ const useResizeObserver = () => {
52
48
  height: Math.floor(height)
53
49
  };
54
50
  }
55
-
56
51
  return prevState;
57
52
  });
58
53
  }, []);
@@ -63,7 +58,6 @@ const useResizeObserver = () => {
63
58
  });
64
59
  return [observer, measurements];
65
60
  };
66
-
67
61
  var _default = useResizeObserver;
68
62
  exports.default = _default;
69
63
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-resize-observer/index.native.js"],"names":["useResizeObserver","measurements","setMeasurements","onLayout","nativeEvent","width","height","layout","prevState","Math","floor","observer","StyleSheet","absoluteFill"],"mappings":";;;;;;;AAOA;;AAJA;;AAHA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,iBAAiB,GAAG,MAAM;AAC/B,QAAM,CAAEC,YAAF,EAAgBC,eAAhB,IAAoC,uBAAU,IAAV,CAA1C;AAEA,QAAMC,QAAQ,GAAG,0BAAa,CAAE;AAAEC,IAAAA;AAAF,GAAF,KAAuB;AACpD,UAAM;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,QAAoBF,WAAW,CAACG,MAAtC;AACAL,IAAAA,eAAe,CAAIM,SAAF,IAAiB;AACjC,UACC,CAAEA,SAAF,IACAA,SAAS,CAACH,KAAV,KAAoBA,KADpB,IAEAG,SAAS,CAACF,MAAV,KAAqBA,MAHtB,EAIE;AACD,eAAO;AACND,UAAAA,KAAK,EAAEI,IAAI,CAACC,KAAL,CAAYL,KAAZ,CADD;AAENC,UAAAA,MAAM,EAAEG,IAAI,CAACC,KAAL,CAAYJ,MAAZ;AAFF,SAAP;AAIA;;AACD,aAAOE,SAAP;AACA,KAZc,CAAf;AAaA,GAfgB,EAed,EAfc,CAAjB;AAiBA,QAAMG,QAAQ,GACb,4BAAC,iBAAD;AACC,IAAA,MAAM,EAAC,iBADR;AAEC,IAAA,KAAK,EAAGC,wBAAWC,YAFpB;AAGC,IAAA,QAAQ,EAAGV;AAHZ,IADD;AAQA,SAAO,CAAEQ,QAAF,EAAYV,YAAZ,CAAP;AACA,CA7BD;;eA+BeD,iB","sourcesContent":["/**\n * External dependencies\n */\nimport { View, StyleSheet } from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { useState, useCallback } from '@wordpress/element';\n\n/**\n * Hook which allows to listen the resize event of any target element when it changes sizes.\n *\n * @example\n *\n * ```js\n * const App = () => {\n * \tconst [ resizeListener, sizes ] = useResizeObserver();\n *\n * \treturn (\n * \t\t<View>\n * \t\t\t{ resizeListener }\n * \t\t\tYour content here\n * \t\t</View>\n * \t);\n * };\n * ```\n *\n */\nconst useResizeObserver = () => {\n\tconst [ measurements, setMeasurements ] = useState( null );\n\n\tconst onLayout = useCallback( ( { nativeEvent } ) => {\n\t\tconst { width, height } = nativeEvent.layout;\n\t\tsetMeasurements( ( prevState ) => {\n\t\t\tif (\n\t\t\t\t! prevState ||\n\t\t\t\tprevState.width !== width ||\n\t\t\t\tprevState.height !== height\n\t\t\t) {\n\t\t\t\treturn {\n\t\t\t\t\twidth: Math.floor( width ),\n\t\t\t\t\theight: Math.floor( height ),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn prevState;\n\t\t} );\n\t}, [] );\n\n\tconst observer = (\n\t\t<View\n\t\t\ttestID=\"resize-observer\"\n\t\t\tstyle={ StyleSheet.absoluteFill }\n\t\t\tonLayout={ onLayout }\n\t\t/>\n\t);\n\n\treturn [ observer, measurements ];\n};\n\nexport default useResizeObserver;\n"]}
1
+ {"version":3,"names":["_element","require","_reactNative","useResizeObserver","measurements","setMeasurements","useState","onLayout","useCallback","nativeEvent","width","height","layout","prevState","Math","floor","observer","createElement","View","testID","style","StyleSheet","absoluteFill","_default","exports","default"],"sources":["@wordpress/compose/src/hooks/use-resize-observer/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, StyleSheet } from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { useState, useCallback } from '@wordpress/element';\n\n/**\n * Hook which allows to listen the resize event of any target element when it changes sizes.\n *\n * @example\n *\n * ```js\n * const App = () => {\n * \tconst [ resizeListener, sizes ] = useResizeObserver();\n *\n * \treturn (\n * \t\t<View>\n * \t\t\t{ resizeListener }\n * \t\t\tYour content here\n * \t\t</View>\n * \t);\n * };\n * ```\n */\nconst useResizeObserver = () => {\n\tconst [ measurements, setMeasurements ] = useState( null );\n\n\tconst onLayout = useCallback( ( { nativeEvent } ) => {\n\t\tconst { width, height } = nativeEvent.layout;\n\t\tsetMeasurements( ( prevState ) => {\n\t\t\tif (\n\t\t\t\t! prevState ||\n\t\t\t\tprevState.width !== width ||\n\t\t\t\tprevState.height !== height\n\t\t\t) {\n\t\t\t\treturn {\n\t\t\t\t\twidth: Math.floor( width ),\n\t\t\t\t\theight: Math.floor( height ),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn prevState;\n\t\t} );\n\t}, [] );\n\n\tconst observer = (\n\t\t<View\n\t\t\ttestID=\"resize-observer\"\n\t\t\tstyle={ StyleSheet.absoluteFill }\n\t\t\tonLayout={ onLayout }\n\t\t/>\n\t);\n\n\treturn [ observer, measurements ];\n};\n\nexport default useResizeObserver;\n"],"mappings":";;;;;;AAOA,IAAAA,QAAA,GAAAC,OAAA;AAJA,IAAAC,YAAA,GAAAD,OAAA;AAHA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,iBAAiB,GAAGA,CAAA,KAAM;EAC/B,MAAM,CAAEC,YAAY,EAAEC,eAAe,CAAE,GAAG,IAAAC,iBAAQ,EAAE,IAAK,CAAC;EAE1D,MAAMC,QAAQ,GAAG,IAAAC,oBAAW,EAAE,CAAE;IAAEC;EAAY,CAAC,KAAM;IACpD,MAAM;MAAEC,KAAK;MAAEC;IAAO,CAAC,GAAGF,WAAW,CAACG,MAAM;IAC5CP,eAAe,CAAIQ,SAAS,IAAM;MACjC,IACC,CAAEA,SAAS,IACXA,SAAS,CAACH,KAAK,KAAKA,KAAK,IACzBG,SAAS,CAACF,MAAM,KAAKA,MAAM,EAC1B;QACD,OAAO;UACND,KAAK,EAAEI,IAAI,CAACC,KAAK,CAAEL,KAAM,CAAC;UAC1BC,MAAM,EAAEG,IAAI,CAACC,KAAK,CAAEJ,MAAO;QAC5B,CAAC;MACF;MACA,OAAOE,SAAS;IACjB,CAAE,CAAC;EACJ,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMG,QAAQ,GACb,IAAAhB,QAAA,CAAAiB,aAAA,EAACf,YAAA,CAAAgB,IAAI;IACJC,MAAM,EAAC,iBAAiB;IACxBC,KAAK,EAAGC,uBAAU,CAACC,YAAc;IACjCf,QAAQ,EAAGA;EAAU,CACrB,CACD;EAED,OAAO,CAAES,QAAQ,EAAEZ,YAAY,CAAE;AAClC,CAAC;AAAC,IAAAmB,QAAA,GAEapB,iBAAiB;AAAAqB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = useThrottle;
7
-
8
7
  var _useMemoOne = require("use-memo-one");
9
-
10
8
  var _element = require("@wordpress/element");
11
-
12
9
  var _throttle = require("../../utils/throttle");
13
-
14
10
  /**
15
11
  * External dependencies
16
12
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-throttle/index.js"],"names":["useThrottle","fn","wait","options","throttled","cancel"],"mappings":";;;;;;;AAGA;;AAKA;;AAKA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,WAAT,CAAsBC,EAAtB,EAA0BC,IAA1B,EAAgCC,OAAhC,EAA0C;AACxD,QAAMC,SAAS,GAAG,4BACjB,MAAM,wBAAUH,EAAV,EAAcC,IAAd,aAAcA,IAAd,cAAcA,IAAd,GAAsB,CAAtB,EAAyBC,OAAzB,CADW,EAEjB,CAAEF,EAAF,EAAMC,IAAN,EAAYC,OAAZ,CAFiB,CAAlB;AAIA,0BAAW,MAAM,MAAMC,SAAS,CAACC,MAAV,EAAvB,EAA2C,CAAED,SAAF,CAA3C;AACA,SAAOA,SAAP;AACA","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://docs-lodash.com/v4/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"]}
1
+ {"version":3,"names":["_useMemoOne","require","_element","_throttle","useThrottle","fn","wait","options","throttled","useMemoOne","throttle","useEffect","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://docs-lodash.com/v4/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":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAF,OAAA;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,WAAWA,CAAEC,EAAE,EAAEC,IAAI,EAAEC,OAAO,EAAG;EACxD,MAAMC,SAAS,GAAG,IAAAC,sBAAU,EAC3B,MAAM,IAAAC,kBAAQ,EAAEL,EAAE,EAAEC,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAI,CAAC,EAAEC,OAAQ,CAAC,EACxC,CAAEF,EAAE,EAAEC,IAAI,EAAEC,OAAO,CACpB,CAAC;EACD,IAAAI,kBAAS,EAAE,MAAM,MAAMH,SAAS,CAACI,MAAM,CAAC,CAAC,EAAE,CAAEJ,SAAS,CAAG,CAAC;EAC1D,OAAOA,SAAS;AACjB"}
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _element = require("@wordpress/element");
11
-
12
9
  var _useMediaQuery = _interopRequireDefault(require("../use-media-query"));
13
-
14
10
  /**
15
11
  * WordPress dependencies
16
12
  */
@@ -38,6 +34,7 @@ const BREAKPOINTS = {
38
34
  small: 600,
39
35
  mobile: 480
40
36
  };
37
+
41
38
  /**
42
39
  * @typedef {">=" | "<"} WPViewportOperator
43
40
  */
@@ -47,24 +44,22 @@ const BREAKPOINTS = {
47
44
  *
48
45
  * @type {Record<WPViewportOperator, string>}
49
46
  */
50
-
51
47
  const CONDITIONS = {
52
48
  '>=': 'min-width',
53
49
  '<': 'max-width'
54
50
  };
51
+
55
52
  /**
56
53
  * Object mapping media query operators to a function that given a breakpointValue and a width evaluates if the operator matches the values.
57
54
  *
58
55
  * @type {Record<WPViewportOperator, (breakpointValue: number, width: number) => boolean>}
59
56
  */
60
-
61
57
  const OPERATOR_EVALUATORS = {
62
58
  '>=': (breakpointValue, width) => width >= breakpointValue,
63
59
  '<': (breakpointValue, width) => width < breakpointValue
64
60
  };
65
- const ViewportMatchWidthContext = (0, _element.createContext)(
66
- /** @type {null | number} */
67
- null);
61
+ const ViewportMatchWidthContext = (0, _element.createContext)( /** @type {null | number} */null);
62
+
68
63
  /**
69
64
  * Returns true if the viewport matches the given query, or false otherwise.
70
65
  *
@@ -80,19 +75,15 @@ null);
80
75
  *
81
76
  * @return {boolean} Whether viewport matches query.
82
77
  */
83
-
84
78
  const useViewportMatch = (breakpoint, operator = '>=') => {
85
79
  const simulatedWidth = (0, _element.useContext)(ViewportMatchWidthContext);
86
80
  const mediaQuery = !simulatedWidth && `(${CONDITIONS[operator]}: ${BREAKPOINTS[breakpoint]}px)`;
87
81
  const mediaQueryResult = (0, _useMediaQuery.default)(mediaQuery || undefined);
88
-
89
82
  if (simulatedWidth) {
90
83
  return OPERATOR_EVALUATORS[operator](BREAKPOINTS[breakpoint], simulatedWidth);
91
84
  }
92
-
93
85
  return mediaQueryResult;
94
86
  };
95
-
96
87
  useViewportMatch.__experimentalWidthProvider = ViewportMatchWidthContext.Provider;
97
88
  var _default = useViewportMatch;
98
89
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-viewport-match/index.js"],"names":["BREAKPOINTS","huge","wide","large","medium","small","mobile","CONDITIONS","OPERATOR_EVALUATORS","breakpointValue","width","ViewportMatchWidthContext","useViewportMatch","breakpoint","operator","simulatedWidth","mediaQuery","mediaQueryResult","undefined","__experimentalWidthProvider","Provider"],"mappings":";;;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gBAAgB,CAACO,2BAAjB,GACCR,yBAAyB,CAACS,QAD3B;eAGeR,gB","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 {\"huge\" | \"wide\" | \"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\thuge: 1440,\n\twide: 1280,\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);\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"]}
1
+ {"version":3,"names":["_element","require","_useMediaQuery","_interopRequireDefault","BREAKPOINTS","huge","wide","large","medium","small","mobile","CONDITIONS","OPERATOR_EVALUATORS",">=","breakpointValue","width","<","ViewportMatchWidthContext","createContext","useViewportMatch","breakpoint","operator","simulatedWidth","useContext","mediaQuery","mediaQueryResult","useMediaQuery","undefined","__experimentalWidthProvider","Provider","_default","exports","default"],"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 {\"huge\" | \"wide\" | \"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\thuge: 1440,\n\twide: 1280,\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);\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":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,cAAA,GAAAC,sBAAA,CAAAF,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,WAAW,GAAG;EACnBC,IAAI,EAAE,IAAI;EACVC,IAAI,EAAE,IAAI;EACVC,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,GAAG,IAAAC,sBAAa,GAC9C,4BAA+B,IAChC,CAAC;;AAED;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,GAAG,IAAAC,mBAAU,EAAEN,yBAA0B,CAAC;EAC9D,MAAMO,UAAU,GACf,CAAEF,cAAc,IACf,IAAIX,UAAU,CAAEU,QAAQ,CAAI,KAAKjB,WAAW,CAAEgB,UAAU,CAAI,KAAI;EAClE,MAAMK,gBAAgB,GAAG,IAAAC,sBAAa,EAAEF,UAAU,IAAIG,SAAU,CAAC;EACjE,IAAKL,cAAc,EAAG;IACrB,OAAOV,mBAAmB,CAAES,QAAQ,CAAE,CACrCjB,WAAW,CAAEgB,UAAU,CAAE,EACzBE,cACD,CAAC;EACF;EACA,OAAOG,gBAAgB;AACxB,CAAC;AAEDN,gBAAgB,CAACS,2BAA2B,GAC3CX,yBAAyB,CAACY,QAAQ;AAAC,IAAAC,QAAA,GAErBX,gBAAgB;AAAAY,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -1,22 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _usePrevious = _interopRequireDefault(require("../use-previous"));
11
-
12
9
  /**
13
10
  * Internal dependencies
14
11
  */
12
+
15
13
  // Disable reason: Object and object are distinctly different types in TypeScript and we mean the lowercase object in thise case
16
14
  // but eslint wants to force us to use `Object`. See https://stackoverflow.com/questions/49464634/difference-between-object-and-object-in-typescript
17
-
18
15
  /* eslint-disable jsdoc/check-types */
19
-
20
16
  /**
21
17
  * Hook that performs a shallow comparison between the preview value of an object
22
18
  * and the new one, if there's a difference, it prints it to the console.
@@ -38,19 +34,13 @@ var _usePrevious = _interopRequireDefault(require("../use-previous"));
38
34
  function useWarnOnChange(object, prefix = 'Change detection') {
39
35
  const previousValues = (0, _usePrevious.default)(object);
40
36
  Object.entries(previousValues !== null && previousValues !== void 0 ? previousValues : []).forEach(([key, value]) => {
41
- if (value !== object[
42
- /** @type {keyof typeof object} */
43
- key]) {
37
+ if (value !== object[/** @type {keyof typeof object} */key]) {
44
38
  // eslint-disable-next-line no-console
45
- console.warn(`${prefix}: ${key} key changed:`, value, object[
46
- /** @type {keyof typeof object} */
47
- key]
48
- /* eslint-enable jsdoc/check-types */
49
- );
39
+ console.warn(`${prefix}: ${key} key changed:`, value, object[/** @type {keyof typeof object} */key]
40
+ /* eslint-enable jsdoc/check-types */);
50
41
  }
51
42
  });
52
43
  }
53
-
54
44
  var _default = useWarnOnChange;
55
45
  exports.default = _default;
56
46
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/compose/src/hooks/use-warn-on-change/index.js"],"names":["useWarnOnChange","object","prefix","previousValues","Object","entries","forEach","key","value","console","warn"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA;AACA;;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAT,CAA0BC,MAA1B,EAAkCC,MAAM,GAAG,kBAA3C,EAAgE;AAC/D,QAAMC,cAAc,GAAG,0BAAaF,MAAb,CAAvB;AAEAG,EAAAA,MAAM,CAACC,OAAP,CAAgBF,cAAhB,aAAgBA,cAAhB,cAAgBA,cAAhB,GAAkC,EAAlC,EAAuCG,OAAvC,CAAgD,CAAE,CAAEC,GAAF,EAAOC,KAAP,CAAF,KAAsB;AACrE,QAAKA,KAAK,KAAKP,MAAM;AAAE;AAAqCM,IAAAA,GAAvC,CAArB,EAAsE;AACrE;AACAE,MAAAA,OAAO,CAACC,IAAR,CACE,GAAGR,MAAQ,KAAKK,GAAK,eADvB,EAECC,KAFD,EAGCP,MAAM;AAAE;AAAqCM,MAAAA,GAAvC;AACN;AAJD;AAMA;AACD,GAVD;AAWA;;eAEcP,e","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 thise 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"]}
1
+ {"version":3,"names":["_usePrevious","_interopRequireDefault","require","useWarnOnChange","object","prefix","previousValues","usePrevious","Object","entries","forEach","key","value","console","warn","_default","exports","default"],"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 thise 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":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;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,GAAG,IAAAC,oBAAW,EAAEH,MAAO,CAAC;EAE5CI,MAAM,CAACC,OAAO,CAAEH,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAI,EAAG,CAAC,CAACI,OAAO,CAAE,CAAE,CAAEC,GAAG,EAAEC,KAAK,CAAE,KAAM;IACrE,IAAKA,KAAK,KAAKR,MAAM,CAAE,kCAAqCO,GAAG,CAAI,EAAG;MACrE;MACAE,OAAO,CAACC,IAAI,CACV,GAAGT,MAAQ,KAAKM,GAAK,eAAc,EACpCC,KAAK,EACLR,MAAM,CAAE,kCAAqCO,GAAG;MAChD,qCACD,CAAC;IACF;EACD,CAAE,CAAC;AACJ;AAAC,IAAAI,QAAA,GAEcZ,eAAe;AAAAa,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
package/build/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -245,9 +244,7 @@ Object.defineProperty(exports, "withState", {
245
244
  return _withState.default;
246
245
  }
247
246
  });
248
-
249
247
  var _createHigherOrderComponent = require("./utils/create-higher-order-component");
250
-
251
248
  Object.keys(_createHigherOrderComponent).forEach(function (key) {
252
249
  if (key === "default" || key === "__esModule") return;
253
250
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -259,9 +256,7 @@ Object.keys(_createHigherOrderComponent).forEach(function (key) {
259
256
  }
260
257
  });
261
258
  });
262
-
263
259
  var _debounce = require("./utils/debounce");
264
-
265
260
  Object.keys(_debounce).forEach(function (key) {
266
261
  if (key === "default" || key === "__esModule") return;
267
262
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -273,9 +268,7 @@ Object.keys(_debounce).forEach(function (key) {
273
268
  }
274
269
  });
275
270
  });
276
-
277
271
  var _throttle = require("./utils/throttle");
278
-
279
272
  Object.keys(_throttle).forEach(function (key) {
280
273
  if (key === "default" || key === "__esModule") return;
281
274
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -287,72 +280,38 @@ Object.keys(_throttle).forEach(function (key) {
287
280
  }
288
281
  });
289
282
  });
290
-
291
283
  var _compose = _interopRequireDefault(require("./higher-order/compose"));
292
-
293
284
  var _pipe = _interopRequireDefault(require("./higher-order/pipe"));
294
-
295
285
  var _ifCondition = _interopRequireDefault(require("./higher-order/if-condition"));
296
-
297
286
  var _pure = _interopRequireDefault(require("./higher-order/pure"));
298
-
299
287
  var _withGlobalEvents = _interopRequireDefault(require("./higher-order/with-global-events"));
300
-
301
288
  var _withInstanceId = _interopRequireDefault(require("./higher-order/with-instance-id"));
302
-
303
289
  var _withSafeTimeout = _interopRequireDefault(require("./higher-order/with-safe-timeout"));
304
-
305
290
  var _withState = _interopRequireDefault(require("./higher-order/with-state"));
306
-
307
291
  var _useConstrainedTabbing = _interopRequireDefault(require("./hooks/use-constrained-tabbing"));
308
-
309
292
  var _useCopyOnClick = _interopRequireDefault(require("./hooks/use-copy-on-click"));
310
-
311
293
  var _useCopyToClipboard = _interopRequireDefault(require("./hooks/use-copy-to-clipboard"));
312
-
313
294
  var _useDialog = _interopRequireDefault(require("./hooks/use-dialog"));
314
-
315
295
  var _useDisabled = _interopRequireDefault(require("./hooks/use-disabled"));
316
-
317
296
  var _useDragging = _interopRequireDefault(require("./hooks/use-dragging"));
318
-
319
297
  var _useFocusOnMount = _interopRequireDefault(require("./hooks/use-focus-on-mount"));
320
-
321
298
  var _useFocusOutside = _interopRequireDefault(require("./hooks/use-focus-outside"));
322
-
323
299
  var _useFocusReturn = _interopRequireDefault(require("./hooks/use-focus-return"));
324
-
325
300
  var _useInstanceId = _interopRequireDefault(require("./hooks/use-instance-id"));
326
-
327
301
  var _useIsomorphicLayoutEffect = _interopRequireDefault(require("./hooks/use-isomorphic-layout-effect"));
328
-
329
302
  var _useKeyboardShortcut = _interopRequireDefault(require("./hooks/use-keyboard-shortcut"));
330
-
331
303
  var _useMediaQuery = _interopRequireDefault(require("./hooks/use-media-query"));
332
-
333
304
  var _usePrevious = _interopRequireDefault(require("./hooks/use-previous"));
334
-
335
305
  var _useReducedMotion = _interopRequireDefault(require("./hooks/use-reduced-motion"));
336
-
337
306
  var _useViewportMatch = _interopRequireDefault(require("./hooks/use-viewport-match"));
338
-
339
307
  var _useResizeObserver = _interopRequireDefault(require("./hooks/use-resize-observer"));
340
-
341
308
  var _useAsyncList = _interopRequireDefault(require("./hooks/use-async-list"));
342
-
343
309
  var _useWarnOnChange = _interopRequireDefault(require("./hooks/use-warn-on-change"));
344
-
345
310
  var _useDebounce = _interopRequireDefault(require("./hooks/use-debounce"));
346
-
347
311
  var _useThrottle = _interopRequireDefault(require("./hooks/use-throttle"));
348
-
349
312
  var _useMergeRefs = _interopRequireDefault(require("./hooks/use-merge-refs"));
350
-
351
313
  var _useRefEffect = _interopRequireDefault(require("./hooks/use-ref-effect"));
352
-
353
314
  var _useDropZone = _interopRequireDefault(require("./hooks/use-drop-zone"));
354
-
355
315
  var _useFocusableIframe = _interopRequireDefault(require("./hooks/use-focusable-iframe"));
356
-
357
316
  var _useFixedWindowList = _interopRequireDefault(require("./hooks/use-fixed-window-list"));
358
317
  //# sourceMappingURL=index.js.map