@wordpress/compose 7.33.1 → 7.34.1-next.2f1c7c01b.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 (204) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/higher-order/compose.js +3 -1
  3. package/build/higher-order/compose.js.map +1 -1
  4. package/build/higher-order/if-condition/index.js +3 -1
  5. package/build/higher-order/if-condition/index.js.map +1 -1
  6. package/build/higher-order/pipe.js +4 -2
  7. package/build/higher-order/pipe.js.map +1 -1
  8. package/build/higher-order/pure/index.js +4 -2
  9. package/build/higher-order/pure/index.js.map +1 -1
  10. package/build/higher-order/with-global-events/index.js +4 -3
  11. package/build/higher-order/with-global-events/index.js.map +2 -2
  12. package/build/higher-order/with-global-events/listener.js +4 -2
  13. package/build/higher-order/with-global-events/listener.js.map +1 -1
  14. package/build/higher-order/with-instance-id/index.js +4 -2
  15. package/build/higher-order/with-instance-id/index.js.map +1 -1
  16. package/build/higher-order/with-safe-timeout/index.js +5 -3
  17. package/build/higher-order/with-safe-timeout/index.js.map +1 -1
  18. package/build/higher-order/with-state/index.js +3 -1
  19. package/build/higher-order/with-state/index.js.map +1 -1
  20. package/build/hooks/use-async-list/index.js +2 -0
  21. package/build/hooks/use-async-list/index.js.map +1 -1
  22. package/build/hooks/use-constrained-tabbing/index.js +2 -0
  23. package/build/hooks/use-constrained-tabbing/index.js.map +1 -1
  24. package/build/hooks/use-copy-on-click/index.js +2 -0
  25. package/build/hooks/use-copy-on-click/index.js.map +2 -2
  26. package/build/hooks/use-copy-to-clipboard/index.js +2 -0
  27. package/build/hooks/use-copy-to-clipboard/index.js.map +1 -1
  28. package/build/hooks/use-debounce/index.js +2 -0
  29. package/build/hooks/use-debounce/index.js.map +1 -1
  30. package/build/hooks/use-debounced-input/index.js +2 -0
  31. package/build/hooks/use-debounced-input/index.js.map +1 -1
  32. package/build/hooks/use-dialog/index.js +2 -0
  33. package/build/hooks/use-dialog/index.js.map +1 -1
  34. package/build/hooks/use-disabled/index.js +2 -0
  35. package/build/hooks/use-disabled/index.js.map +1 -1
  36. package/build/hooks/use-dragging/index.js +2 -0
  37. package/build/hooks/use-dragging/index.js.map +1 -1
  38. package/build/hooks/use-drop-zone/index.js +2 -0
  39. package/build/hooks/use-drop-zone/index.js.map +1 -1
  40. package/build/hooks/use-event/index.js +2 -0
  41. package/build/hooks/use-event/index.js.map +1 -1
  42. package/build/hooks/use-fixed-window-list/index.js +3 -1
  43. package/build/hooks/use-fixed-window-list/index.js.map +1 -1
  44. package/build/hooks/use-focus-on-mount/index.js +2 -0
  45. package/build/hooks/use-focus-on-mount/index.js.map +1 -1
  46. package/build/hooks/use-focus-outside/index.js +3 -1
  47. package/build/hooks/use-focus-outside/index.js.map +1 -1
  48. package/build/hooks/use-focus-return/index.js +3 -1
  49. package/build/hooks/use-focus-return/index.js.map +1 -1
  50. package/build/hooks/use-focusable-iframe/index.js +2 -0
  51. package/build/hooks/use-focusable-iframe/index.js.map +1 -1
  52. package/build/hooks/use-instance-id/index.js +3 -1
  53. package/build/hooks/use-instance-id/index.js.map +1 -1
  54. package/build/hooks/use-isomorphic-layout-effect/index.js +3 -1
  55. package/build/hooks/use-isomorphic-layout-effect/index.js.map +1 -1
  56. package/build/hooks/use-keyboard-shortcut/index.js +3 -4
  57. package/build/hooks/use-keyboard-shortcut/index.js.map +2 -2
  58. package/build/hooks/use-media-query/index.js +3 -1
  59. package/build/hooks/use-media-query/index.js.map +1 -1
  60. package/build/hooks/use-merge-refs/index.js +2 -0
  61. package/build/hooks/use-merge-refs/index.js.map +2 -2
  62. package/build/hooks/use-observable-value/index.js +2 -0
  63. package/build/hooks/use-observable-value/index.js.map +1 -1
  64. package/build/hooks/use-previous/index.js +2 -0
  65. package/build/hooks/use-previous/index.js.map +1 -1
  66. package/build/hooks/use-reduced-motion/index.js +3 -1
  67. package/build/hooks/use-reduced-motion/index.js.map +1 -1
  68. package/build/hooks/use-ref-effect/index.js +2 -0
  69. package/build/hooks/use-ref-effect/index.js.map +1 -1
  70. package/build/hooks/use-resize-observer/index.js +2 -0
  71. package/build/hooks/use-resize-observer/index.js.map +1 -1
  72. package/build/hooks/use-resize-observer/legacy/index.js +6 -4
  73. package/build/hooks/use-resize-observer/legacy/index.js.map +1 -1
  74. package/build/hooks/use-resize-observer/use-resize-observer.js +2 -0
  75. package/build/hooks/use-resize-observer/use-resize-observer.js.map +1 -1
  76. package/build/hooks/use-state-with-history/index.js +2 -0
  77. package/build/hooks/use-state-with-history/index.js.map +1 -1
  78. package/build/hooks/use-throttle/index.js +2 -0
  79. package/build/hooks/use-throttle/index.js.map +1 -1
  80. package/build/hooks/use-viewport-match/index.js +7 -5
  81. package/build/hooks/use-viewport-match/index.js.map +1 -1
  82. package/build/hooks/use-warn-on-change/index.js +2 -0
  83. package/build/hooks/use-warn-on-change/index.js.map +1 -1
  84. package/build/index.js +2 -0
  85. package/build/index.js.map +1 -1
  86. package/build/utils/create-higher-order-component/index.js +3 -1
  87. package/build/utils/create-higher-order-component/index.js.map +1 -1
  88. package/build/utils/debounce/index.js +3 -1
  89. package/build/utils/debounce/index.js.map +1 -1
  90. package/build/utils/observable-map/index.js +2 -0
  91. package/build/utils/observable-map/index.js.map +1 -1
  92. package/build/utils/throttle/index.js +3 -1
  93. package/build/utils/throttle/index.js.map +1 -1
  94. package/build-module/higher-order/compose.js +2 -1
  95. package/build-module/higher-order/compose.js.map +1 -1
  96. package/build-module/higher-order/if-condition/index.js +2 -1
  97. package/build-module/higher-order/if-condition/index.js.map +1 -1
  98. package/build-module/higher-order/pipe.js +3 -2
  99. package/build-module/higher-order/pipe.js.map +1 -1
  100. package/build-module/higher-order/pure/index.js +3 -2
  101. package/build-module/higher-order/pure/index.js.map +1 -1
  102. package/build-module/higher-order/with-global-events/index.js +3 -3
  103. package/build-module/higher-order/with-global-events/index.js.map +2 -2
  104. package/build-module/higher-order/with-global-events/listener.js +3 -2
  105. package/build-module/higher-order/with-global-events/listener.js.map +1 -1
  106. package/build-module/higher-order/with-instance-id/index.js +3 -2
  107. package/build-module/higher-order/with-instance-id/index.js.map +1 -1
  108. package/build-module/higher-order/with-safe-timeout/index.js +3 -2
  109. package/build-module/higher-order/with-safe-timeout/index.js.map +1 -1
  110. package/build-module/higher-order/with-state/index.js +2 -1
  111. package/build-module/higher-order/with-state/index.js.map +1 -1
  112. package/build-module/hooks/use-async-list/index.js +1 -0
  113. package/build-module/hooks/use-async-list/index.js.map +1 -1
  114. package/build-module/hooks/use-constrained-tabbing/index.js +1 -0
  115. package/build-module/hooks/use-constrained-tabbing/index.js.map +1 -1
  116. package/build-module/hooks/use-copy-on-click/index.js +1 -0
  117. package/build-module/hooks/use-copy-on-click/index.js.map +2 -2
  118. package/build-module/hooks/use-copy-to-clipboard/index.js +1 -0
  119. package/build-module/hooks/use-copy-to-clipboard/index.js.map +1 -1
  120. package/build-module/hooks/use-debounce/index.js +1 -0
  121. package/build-module/hooks/use-debounce/index.js.map +1 -1
  122. package/build-module/hooks/use-debounced-input/index.js +1 -0
  123. package/build-module/hooks/use-debounced-input/index.js.map +1 -1
  124. package/build-module/hooks/use-dialog/index.js +1 -0
  125. package/build-module/hooks/use-dialog/index.js.map +1 -1
  126. package/build-module/hooks/use-disabled/index.js +1 -0
  127. package/build-module/hooks/use-disabled/index.js.map +1 -1
  128. package/build-module/hooks/use-dragging/index.js +1 -0
  129. package/build-module/hooks/use-dragging/index.js.map +1 -1
  130. package/build-module/hooks/use-drop-zone/index.js +1 -0
  131. package/build-module/hooks/use-drop-zone/index.js.map +1 -1
  132. package/build-module/hooks/use-event/index.js +1 -0
  133. package/build-module/hooks/use-event/index.js.map +1 -1
  134. package/build-module/hooks/use-fixed-window-list/index.js +2 -1
  135. package/build-module/hooks/use-fixed-window-list/index.js.map +1 -1
  136. package/build-module/hooks/use-focus-on-mount/index.js +1 -0
  137. package/build-module/hooks/use-focus-on-mount/index.js.map +1 -1
  138. package/build-module/hooks/use-focus-outside/index.js +2 -1
  139. package/build-module/hooks/use-focus-outside/index.js.map +1 -1
  140. package/build-module/hooks/use-focus-return/index.js +2 -1
  141. package/build-module/hooks/use-focus-return/index.js.map +1 -1
  142. package/build-module/hooks/use-focusable-iframe/index.js +1 -0
  143. package/build-module/hooks/use-focusable-iframe/index.js.map +1 -1
  144. package/build-module/hooks/use-instance-id/index.js +2 -1
  145. package/build-module/hooks/use-instance-id/index.js.map +1 -1
  146. package/build-module/hooks/use-isomorphic-layout-effect/index.js +2 -1
  147. package/build-module/hooks/use-isomorphic-layout-effect/index.js.map +1 -1
  148. package/build-module/hooks/use-keyboard-shortcut/index.js +2 -4
  149. package/build-module/hooks/use-keyboard-shortcut/index.js.map +2 -2
  150. package/build-module/hooks/use-media-query/index.js +2 -1
  151. package/build-module/hooks/use-media-query/index.js.map +1 -1
  152. package/build-module/hooks/use-merge-refs/index.js +1 -0
  153. package/build-module/hooks/use-merge-refs/index.js.map +2 -2
  154. package/build-module/hooks/use-observable-value/index.js +1 -0
  155. package/build-module/hooks/use-observable-value/index.js.map +1 -1
  156. package/build-module/hooks/use-previous/index.js +1 -0
  157. package/build-module/hooks/use-previous/index.js.map +1 -1
  158. package/build-module/hooks/use-reduced-motion/index.js +2 -1
  159. package/build-module/hooks/use-reduced-motion/index.js.map +1 -1
  160. package/build-module/hooks/use-ref-effect/index.js +1 -0
  161. package/build-module/hooks/use-ref-effect/index.js.map +1 -1
  162. package/build-module/hooks/use-resize-observer/index.js +1 -0
  163. package/build-module/hooks/use-resize-observer/index.js.map +1 -1
  164. package/build-module/hooks/use-resize-observer/legacy/index.js +5 -4
  165. package/build-module/hooks/use-resize-observer/legacy/index.js.map +1 -1
  166. package/build-module/hooks/use-resize-observer/use-resize-observer.js +1 -0
  167. package/build-module/hooks/use-resize-observer/use-resize-observer.js.map +1 -1
  168. package/build-module/hooks/use-state-with-history/index.js +1 -0
  169. package/build-module/hooks/use-state-with-history/index.js.map +1 -1
  170. package/build-module/hooks/use-throttle/index.js +1 -0
  171. package/build-module/hooks/use-throttle/index.js.map +1 -1
  172. package/build-module/hooks/use-viewport-match/index.js +6 -5
  173. package/build-module/hooks/use-viewport-match/index.js.map +1 -1
  174. package/build-module/hooks/use-warn-on-change/index.js +1 -0
  175. package/build-module/hooks/use-warn-on-change/index.js.map +1 -1
  176. package/build-module/index.js +1 -0
  177. package/build-module/index.js.map +1 -1
  178. package/build-module/utils/create-higher-order-component/index.js +2 -1
  179. package/build-module/utils/create-higher-order-component/index.js.map +1 -1
  180. package/build-module/utils/debounce/index.js +2 -1
  181. package/build-module/utils/debounce/index.js.map +1 -1
  182. package/build-module/utils/observable-map/index.js +1 -0
  183. package/build-module/utils/observable-map/index.js.map +1 -1
  184. package/build-module/utils/throttle/index.js +2 -1
  185. package/build-module/utils/throttle/index.js.map +1 -1
  186. package/build-types/higher-order/with-global-events/index.d.ts.map +1 -1
  187. package/build-types/hooks/use-copy-on-click/index.d.ts.map +1 -1
  188. package/build-types/hooks/use-keyboard-shortcut/index.d.ts.map +1 -1
  189. package/build-types/hooks/use-merge-refs/index.d.ts.map +1 -1
  190. package/package.json +9 -9
  191. package/src/higher-order/with-global-events/index.js +0 -2
  192. package/src/hooks/use-copy-on-click/index.js +0 -2
  193. package/src/hooks/use-focus-outside/index.native.js +0 -3
  194. package/src/hooks/use-keyboard-shortcut/index.js +1 -6
  195. package/src/hooks/use-merge-refs/index.js +0 -6
  196. package/tsconfig.tsbuildinfo +1 -1
  197. package/build/hooks/use-preferred-color-scheme/index.android.js +0 -41
  198. package/build/hooks/use-preferred-color-scheme/index.android.js.map +0 -7
  199. package/build/hooks/use-preferred-color-scheme/index.ios.js +0 -27
  200. package/build/hooks/use-preferred-color-scheme/index.ios.js.map +0 -7
  201. package/build-module/hooks/use-preferred-color-scheme/index.android.js +0 -24
  202. package/build-module/hooks/use-preferred-color-scheme/index.android.js.map +0 -7
  203. package/build-module/hooks/use-preferred-color-scheme/index.ios.js +0 -7
  204. package/build-module/hooks/use-preferred-color-scheme/index.ios.js.map +0 -7
@@ -16,15 +16,17 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/compose/src/hooks/use-resize-observer/legacy/index.tsx
19
21
  var legacy_exports = {};
20
22
  __export(legacy_exports, {
21
23
  default: () => useLegacyResizeObserver
22
24
  });
23
25
  module.exports = __toCommonJS(legacy_exports);
24
- var import_jsx_runtime = require("react/jsx-runtime");
25
26
  var import_element = require("@wordpress/element");
26
27
  var import_use_resize_observer = require("../use-resize-observer");
27
- const extractSize = (entry) => {
28
+ var import_jsx_runtime = require("react/jsx-runtime");
29
+ var extractSize = (entry) => {
28
30
  let entrySize;
29
31
  if (!entry.contentBoxSize) {
30
32
  entrySize = [entry.contentRect.width, entry.contentRect.height];
@@ -38,7 +40,7 @@ const extractSize = (entry) => {
38
40
  const [width, height] = entrySize.map((d) => Math.round(d));
39
41
  return { width, height };
40
42
  };
41
- const RESIZE_ELEMENT_STYLES = {
43
+ var RESIZE_ELEMENT_STYLES = {
42
44
  position: "absolute",
43
45
  top: 0,
44
46
  left: 0,
@@ -66,7 +68,7 @@ function ResizeElement({ onResize }) {
66
68
  function sizeEquals(a, b) {
67
69
  return a.width === b.width && a.height === b.height;
68
70
  }
69
- const NULL_SIZE = { width: null, height: null };
71
+ var NULL_SIZE = { width: null, height: null };
70
72
  function useLegacyResizeObserver() {
71
73
  const [size, setSize] = (0, import_element.useState)(NULL_SIZE);
72
74
  const previousSizeRef = (0, import_element.useRef)(NULL_SIZE);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/hooks/use-resize-observer/legacy/index.tsx"],
4
4
  "sourcesContent": ["/**\n * External dependencies\n */\nimport type { ReactElement } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef, useState } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport { useResizeObserver } from '../use-resize-observer';\n\nexport type ObservedSize = {\n\twidth: number | null;\n\theight: number | null;\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 = ( entry: ResizeObserverEntry ): ObservedSize => {\n\tlet entrySize;\n\tif ( ! entry.contentBoxSize ) {\n\t\t// The dimensions in `contentBoxSize` and `contentRect` are equivalent according to the spec.\n\t\t// See the 6th step in the description for the RO algorithm:\n\t\t// https://drafts.csswg.org/resize-observer/#create-and-populate-resizeobserverentry-h\n\t\t// > Set this.contentRect to logical this.contentBoxSize given target and observedBox of \"content-box\".\n\t\t// In real browser implementations of course these objects differ, but the width/height values should be equivalent.\n\t\tentrySize = [ entry.contentRect.width, entry.contentRect.height ];\n\t} else if ( entry.contentBoxSize[ 0 ] ) {\n\t\tconst contentBoxSize = entry.contentBoxSize[ 0 ];\n\t\tentrySize = [ contentBoxSize.inlineSize, contentBoxSize.blockSize ];\n\t} else {\n\t\t// TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's buggy\n\t\t// behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`.\n\t\tconst contentBoxSize =\n\t\t\tentry.contentBoxSize as unknown as ResizeObserverSize;\n\t\tentrySize = [ contentBoxSize.inlineSize, contentBoxSize.blockSize ];\n\t}\n\n\tconst [ width, height ] = entrySize.map( ( d ) => Math.round( d ) );\n\treturn { width, height };\n};\n\nconst RESIZE_ELEMENT_STYLES = {\n\tposition: 'absolute',\n\ttop: 0,\n\tleft: 0,\n\tright: 0,\n\tbottom: 0,\n\tpointerEvents: 'none',\n\topacity: 0,\n\toverflow: 'hidden',\n\tzIndex: -1,\n} as const;\n\ntype ResizeElementProps = {\n\tonResize: ( s: ObservedSize ) => void;\n};\n\nfunction ResizeElement( { onResize }: ResizeElementProps ) {\n\tconst resizeElementRef = useResizeObserver( ( entries ) => {\n\t\tconst newSize = extractSize( entries.at( -1 )! ); // Entries are never empty.\n\t\tonResize( newSize );\n\t} );\n\n\treturn (\n\t\t<div\n\t\t\tref={ resizeElementRef }\n\t\t\tstyle={ RESIZE_ELEMENT_STYLES }\n\t\t\taria-hidden=\"true\"\n\t\t/>\n\t);\n}\n\nfunction sizeEquals( a: ObservedSize, b: ObservedSize ) {\n\treturn a.width === b.width && a.height === b.height;\n}\n\nconst NULL_SIZE: ObservedSize = { width: null, height: null };\n\n/**\n * Hook which allows to listen to the resize event of any target element when it changes size.\n * _Note: `useResizeObserver` will report `null` sizes 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 useLegacyResizeObserver(): [\n\tReactElement,\n\tObservedSize,\n] {\n\tconst [ size, setSize ] = useState( NULL_SIZE );\n\n\t// Using a ref to track the previous width / height to avoid unnecessary renders.\n\tconst previousSizeRef = useRef( NULL_SIZE );\n\n\tconst handleResize = useCallback( ( newSize: ObservedSize ) => {\n\t\tif ( ! sizeEquals( previousSizeRef.current, newSize ) ) {\n\t\t\tpreviousSizeRef.current = newSize;\n\t\t\tsetSize( newSize );\n\t\t}\n\t}, [] );\n\n\tconst resizeElement = <ResizeElement onResize={ handleResize } />;\n\treturn [ resizeElement, size ];\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2FE;AAnFF,qBAA8C;AAI9C,iCAAkC;AAgClC,MAAM,cAAc,CAAE,UAA8C;AACnE,MAAI;AACJ,MAAK,CAAE,MAAM,gBAAiB;AAM7B,gBAAY,CAAE,MAAM,YAAY,OAAO,MAAM,YAAY,MAAO;AAAA,EACjE,WAAY,MAAM,eAAgB,CAAE,GAAI;AACvC,UAAM,iBAAiB,MAAM,eAAgB,CAAE;AAC/C,gBAAY,CAAE,eAAe,YAAY,eAAe,SAAU;AAAA,EACnE,OAAO;AAGN,UAAM,iBACL,MAAM;AACP,gBAAY,CAAE,eAAe,YAAY,eAAe,SAAU;AAAA,EACnE;AAEA,QAAM,CAAE,OAAO,MAAO,IAAI,UAAU,IAAK,CAAE,MAAO,KAAK,MAAO,CAAE,CAAE;AAClE,SAAO,EAAE,OAAO,OAAO;AACxB;AAEA,MAAM,wBAAwB;AAAA,EAC7B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,SAAS;AAAA,EACT,UAAU;AAAA,EACV,QAAQ;AACT;AAMA,SAAS,cAAe,EAAE,SAAS,GAAwB;AAC1D,QAAM,uBAAmB,8CAAmB,CAAE,YAAa;AAC1D,UAAM,UAAU,YAAa,QAAQ,GAAI,EAAG,CAAG;AAC/C,aAAU,OAAQ;AAAA,E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AAAA,EAC7B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,SAAS;AAAA,EACT,UAAU;AAAA,EACV,QAAQ;AACT;AAMA,SAAS,cAAe,EAAE,SAAS,GAAwB;AAC1D,QAAM,uBAAmB,8CAAmB,CAAE,YAAa;AAC1D,UAAM,UAAU,YAAa,QAAQ,GAAI,EAAG,CAAG;AAC/C,aAAU,OAAQ;AAAA,EACnB,CAAE;AAEF,SACC;AAAA,IAAC;AAAA;AAAA,MACA,KAAM;AAAA,MACN,OAAQ;AAAA,MACR,eAAY;AAAA;AAAA,EACb;AAEF;AAEA,SAAS,WAAY,GAAiB,GAAkB;AACvD,SAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE;AAC9C;AAEA,IAAM,YAA0B,EAAE,OAAO,MAAM,QAAQ,KAAK;AAqB7C,SAAR,0BAGL;AACD,QAAM,CAAE,MAAM,OAAQ,QAAI,yBAAU,SAAU;AAG9C,QAAM,sBAAkB,uBAAQ,SAAU;AAE1C,QAAM,mBAAe,4BAAa,CAAE,YAA2B;AAC9D,QAAK,CAAE,WAAY,gBAAgB,SAAS,OAAQ,GAAI;AACvD,sBAAgB,UAAU;AAC1B,cAAS,OAAQ;AAAA,IAClB;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,gBAAgB,4CAAC,iBAAc,UAAW,cAAe;AAC/D,SAAO,CAAE,eAAe,IAAK;AAC9B;",
6
6
  "names": []
7
7
  }
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/compose/src/hooks/use-resize-observer/use-resize-observer.ts
29
31
  var use_resize_observer_exports = {};
30
32
  __export(use_resize_observer_exports, {
31
33
  useResizeObserver: () => useResizeObserver
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/use-resize-observer/use-resize-observer.ts"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport useEvent from '../use-event';\n\n// This is the current implementation of `useResizeObserver`.\n//\n// The legacy implementation is still supported for backwards compatibility.\n// This is achieved by overloading the exported function with both signatures,\n// and detecting which API is being used at runtime.\nexport function useResizeObserver< T extends HTMLElement >(\n\tcallback: ResizeObserverCallback,\n\tresizeObserverOptions: ResizeObserverOptions = {}\n): ( element?: T | null ) => void {\n\tconst callbackEvent = useEvent( callback );\n\n\tconst observedElementRef = useRef< T | null >();\n\tconst resizeObserverRef = useRef< ResizeObserver >();\n\treturn useEvent( ( element?: T | null ) => {\n\t\tif ( element === observedElementRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set up `ResizeObserver`.\n\t\tresizeObserverRef.current ??= new ResizeObserver( callbackEvent );\n\t\tconst { current: resizeObserver } = resizeObserverRef;\n\n\t\t// Unobserve previous element.\n\t\tif ( observedElementRef.current ) {\n\t\t\tresizeObserver.unobserve( observedElementRef.current );\n\t\t}\n\n\t\t// Observe new element.\n\t\tobservedElementRef.current = element;\n\t\tif ( element ) {\n\t\t\tresizeObserver.observe( element, resizeObserverOptions );\n\t\t}\n\t} );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAuB;AAIvB,uBAAqB;AAOd,SAAS,kBACf,UACA,wBAA+C,CAAC,GACf;AACjC,QAAM,oBAAgB,iBAAAA,SAAU,QAAS;AAEzC,QAAM,yBAAqB,uBAAmB;AAC9C,QAAM,wBAAoB,uBAAyB;AACnD,aAAO,iBAAAA,SAAU,CAAE,YAAwB;AAC1C,QAAK,YAAY,mBAAmB,SAAU;AAC7C;AAAA,IACD;AAGA,sBAAkB,YAAY,IAAI,eAAgB,aAAc;AAChE,UAAM,EAAE,SAAS,eAAe,IAAI;AAGpC,QAAK,mBAAmB,SAAU;AACjC,qBAAe,UAAW,mBAAmB,OAAQ;AAAA,IACtD;AAGA,uBAAmB,UAAU;AAC7B,QAAK,SAAU;AACd,qBAAe,QAAS,SAAS,qBAAsB;AAAA,IACxD;AAAA,EACD,CAAE;AACH;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAuB;AAIvB,uBAAqB;AAOd,SAAS,kBACf,UACA,wBAA+C,CAAC,GACf;AACjC,QAAM,oBAAgB,iBAAAA,SAAU,QAAS;AAEzC,QAAM,yBAAqB,uBAAmB;AAC9C,QAAM,wBAAoB,uBAAyB;AACnD,aAAO,iBAAAA,SAAU,CAAE,YAAwB;AAC1C,QAAK,YAAY,mBAAmB,SAAU;AAC7C;AAAA,IACD;AAGA,sBAAkB,YAAY,IAAI,eAAgB,aAAc;AAChE,UAAM,EAAE,SAAS,eAAe,IAAI;AAGpC,QAAK,mBAAmB,SAAU;AACjC,qBAAe,UAAW,mBAAmB,OAAQ;AAAA,IACtD;AAGA,uBAAmB,UAAU;AAC7B,QAAK,SAAU;AACd,qBAAe,QAAS,SAAS,qBAAsB;AAAA,IACxD;AAAA,EACD,CAAE;AACH;",
6
6
  "names": ["useEvent"]
7
7
  }
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/compose/src/hooks/use-state-with-history/index.ts
19
21
  var use_state_with_history_exports = {};
20
22
  __export(use_state_with_history_exports, {
21
23
  default: () => useStateWithHistory
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/use-state-with-history/index.ts"],
4
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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAkC;AAClC,qBAAwC;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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,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,aAAS,uCAAkB;AAAA,IAC3B;AAAA,EACD;AACD;AAQe,SAAR,oBAA2C,cAAkB;AACnE,QAAM,CAAE,OAAO,QAAS,QAAI;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,SAAO;AAAA,IACN,OAAO,MAAM;AAAA,IACb,cAAU,4BAAa,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,UAAM,4BAAa,MAAM;AACxB,eAAU,EAAE,MAAM,OAAO,CAAE;AAAA,IAC5B,GAAG,CAAC,CAAE;AAAA,IACN,UAAM,4BAAa,MAAM;AACxB,eAAU,EAAE,MAAM,OAAO,CAAE;AAAA,IAC5B,GAAG,CAAC,CAAE;AAAA,EACP;AACD;",
6
6
  "names": []
7
7
  }
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/compose/src/hooks/use-throttle/index.js
19
21
  var use_throttle_exports = {};
20
22
  __export(use_throttle_exports, {
21
23
  default: () => useThrottle
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/use-throttle/index.js"],
4
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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA2B;AAK3B,qBAA0B;AAK1B,sBAAyB;AAiBV,SAAR,YAA8B,IAAI,MAAM,SAAU;AACxD,QAAM,gBAAY;AAAA,IACjB,UAAM,0BAAU,IAAI,QAAQ,GAAG,OAAQ;AAAA,IACvC,CAAE,IAAI,MAAM,OAAQ;AAAA,EACrB;AACA,gCAAW,MAAM,MAAM,UAAU,OAAO,GAAG,CAAE,SAAU,CAAE;AACzD,SAAO;AACR;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA2B;AAK3B,qBAA0B;AAK1B,sBAAyB;AAiBV,SAAR,YAA8B,IAAI,MAAM,SAAU;AACxD,QAAM,gBAAY;AAAA,IACjB,UAAM,0BAAU,IAAI,QAAQ,GAAG,OAAQ;AAAA,IACvC,CAAE,IAAI,MAAM,OAAQ;AAAA,EACrB;AACA,gCAAW,MAAM,MAAM,UAAU,OAAO,GAAG,CAAE,SAAU,CAAE;AACzD,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/compose/src/hooks/use-viewport-match/index.js
29
31
  var use_viewport_match_exports = {};
30
32
  __export(use_viewport_match_exports, {
31
33
  default: () => use_viewport_match_default
@@ -33,7 +35,7 @@ __export(use_viewport_match_exports, {
33
35
  module.exports = __toCommonJS(use_viewport_match_exports);
34
36
  var import_element = require("@wordpress/element");
35
37
  var import_use_media_query = __toESM(require("../use-media-query"));
36
- const BREAKPOINTS = {
38
+ var BREAKPOINTS = {
37
39
  xhuge: 1920,
38
40
  huge: 1440,
39
41
  wide: 1280,
@@ -43,20 +45,20 @@ const BREAKPOINTS = {
43
45
  small: 600,
44
46
  mobile: 480
45
47
  };
46
- const CONDITIONS = {
48
+ var CONDITIONS = {
47
49
  ">=": "min-width",
48
50
  "<": "max-width"
49
51
  };
50
- const OPERATOR_EVALUATORS = {
52
+ var OPERATOR_EVALUATORS = {
51
53
  ">=": (breakpointValue, width) => width >= breakpointValue,
52
54
  "<": (breakpointValue, width) => width < breakpointValue
53
55
  };
54
- const ViewportMatchWidthContext = (0, import_element.createContext)(
56
+ var ViewportMatchWidthContext = (0, import_element.createContext)(
55
57
  /** @type {null | number} */
56
58
  null
57
59
  );
58
60
  ViewportMatchWidthContext.displayName = "ViewportMatchWidthContext";
59
- const useViewportMatch = (breakpoint, operator = ">=") => {
61
+ var useViewportMatch = (breakpoint, operator = ">=") => {
60
62
  const simulatedWidth = (0, import_element.useContext)(ViewportMatchWidthContext);
61
63
  const mediaQuery = !simulatedWidth && `(${CONDITIONS[operator]}: ${BREAKPOINTS[breakpoint]}px)`;
62
64
  const mediaQueryResult = (0, import_use_media_query.default)(mediaQuery || void 0);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/use-viewport-match/index.js"],
4
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA0C;AAK1C,6BAA0B;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,gCAA4B;AAAA;AAAA,EACF;AAChC;AACA,0BAA0B,cAAc;AAiBxC,MAAM,mBAAmB,CAAE,YAAY,WAAW,SAAU;AAC3D,QAAM,qBAAiB,2BAAY,yBAA0B;AAC7D,QAAM,aACL,CAAE,kBACF,IAAK,WAAY,QAAS,CAAE,KAAM,YA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
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/compose/src/hooks/use-warn-on-change/index.js
29
31
  var use_warn_on_change_exports = {};
30
32
  __export(use_warn_on_change_exports, {
31
33
  default: () => use_warn_on_change_default
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/use-warn-on-change/index.js"],
4
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAwB;AAuBxB,SAAS,gBAAiB,QAAQ,SAAS,oBAAqB;AAC/D,QAAM,qBAAiB,oBAAAA,SAAa,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;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAwB;AAuBxB,SAAS,gBAAiB,QAAQ,SAAS,oBAAqB;AAC/D,QAAM,qBAAiB,oBAAAA,SAAa,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
6
  "names": ["usePrevious"]
7
7
  }
package/build/index.js CHANGED
@@ -27,6 +27,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // packages/compose/src/index.js
30
32
  var index_exports = {};
31
33
  __export(index_exports, {
32
34
  __experimentalUseDialog: () => import_use_dialog.default,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.js"],
4
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAc,kDADd;AAGA,0BAAc,6BAHd;AAKA,0BAAc,6BALd;AAOA,0BAAc,mCAPd;AAUA,qBAAmC;AACnC,kBAAgC;AAGhC,0BAAuC;AACvC,kBAAgC;AAChC,gCAA4C;AAC5C,8BAA0C;AAC1C,+BAA2C;AAC3C,wBAAqC;AAGrC,qCAAiD;AACjD,+BAA0C;AAC1C,mCAA8C;AAC9C,wBAAmD;AACnD,0BAAuC;AACvC,uBAAoC;AACpC,0BAAqD;AACrD,gCAA2C;AAC3C,+BAAyD;AACzD,8BAA0C;AAC1C,6BAAyC;AACzC,0CAAqD;AACrD,mCAA+C;AAC/C,6BAAyC;AACzC,0BAAuC;AACvC,gCAA4C;AAC5C,oCAA+C;AAC/C,gCAA4C;AAC5C,iCAA6C;AAC7C,4BAAwC;AACxC,gCAA2C;AAC3C,0BAAuC;AACvC,iCAA6C;AAC7C,0BAAuC;AACvC,4BAAwC;AACxC,4BAAwC;AACxC,2BAAqD;AACrD,kCAA8C;AAC9C,mCAA4D;AAC5D,kCAA8C;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAc,kDADd;AAGA,0BAAc,6BAHd;AAKA,0BAAc,6BALd;AAOA,0BAAc,mCAPd;AAUA,qBAAmC;AACnC,kBAAgC;AAGhC,0BAAuC;AACvC,kBAAgC;AAChC,gCAA4C;AAC5C,8BAA0C;AAC1C,+BAA2C;AAC3C,wBAAqC;AAGrC,qCAAiD;AACjD,+BAA0C;AAC1C,mCAA8C;AAC9C,wBAAmD;AACnD,0BAAuC;AACvC,uBAAoC;AACpC,0BAAqD;AACrD,gCAA2C;AAC3C,+BAAyD;AACzD,8BAA0C;AAC1C,6BAAyC;AACzC,0CAAqD;AACrD,mCAA+C;AAC/C,6BAAyC;AACzC,0BAAuC;AACvC,gCAA4C;AAC5C,oCAA+C;AAC/C,gCAA4C;AAC5C,iCAA6C;AAC7C,4BAAwC;AACxC,gCAA2C;AAC3C,0BAAuC;AACvC,iCAA6C;AAC7C,0BAAuC;AACvC,4BAAwC;AACxC,4BAAwC;AACxC,2BAAqD;AACrD,kCAA8C;AAC9C,mCAA4D;AAC5D,kCAA8C;",
6
6
  "names": []
7
7
  }
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/compose/src/utils/create-higher-order-component/index.ts
19
21
  var create_higher_order_component_exports = {};
20
22
  __export(create_higher_order_component_exports, {
21
23
  createHigherOrderComponent: () => createHigherOrderComponent
@@ -29,7 +31,7 @@ function createHigherOrderComponent(mapComponent, modifierName) {
29
31
  return Outer;
30
32
  };
31
33
  }
32
- const hocName = (name, Inner) => {
34
+ var hocName = (name, Inner) => {
33
35
  const inner = Inner.displayName || Inner.name || "Component";
34
36
  const outer = (0, import_change_case.pascalCase)(name ?? "");
35
37
  return `${outer}(${inner})`;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/create-higher-order-component/index.ts"],
4
4
  "sourcesContent": ["/**\n * External dependencies\n */\nimport { pascalCase } from 'change-case';\nimport type { ComponentType } from 'react';\n\ntype GetProps< C > = C extends ComponentType< infer P > ? P : never;\n\nexport type WithoutInjectedProps< C, I > = Omit< GetProps< C >, keyof I >;\n\nexport type WithInjectedProps< C, I > = ComponentType<\n\tWithoutInjectedProps< C, I > & I\n>;\n\n/**\n * Given a function mapping a component to an enhanced component and modifier\n * name, returns the enhanced component augmented with a generated displayName.\n *\n * @param mapComponent Function mapping component to enhanced component.\n * @param modifierName Seed name from which to generated display name.\n *\n * @return Component class with generated display name assigned.\n */\nexport function createHigherOrderComponent<\n\tTInner extends ComponentType< any >,\n\tTOuter extends ComponentType< any >,\n>( mapComponent: ( Inner: TInner ) => TOuter, modifierName: string ) {\n\treturn ( Inner: TInner ) => {\n\t\tconst Outer = mapComponent( Inner );\n\t\tOuter.displayName = hocName( modifierName, Inner );\n\t\treturn Outer;\n\t};\n}\n\n/**\n * Returns a displayName for a higher-order component, given a wrapper name.\n *\n * @example\n * hocName( 'MyMemo', Widget ) === 'MyMemo(Widget)';\n * hocName( 'MyMemo', <div /> ) === 'MyMemo(Component)';\n *\n * @param name Name assigned to higher-order component's wrapper component.\n * @param Inner Wrapped component inside higher-order component.\n * @return Wrapped name of higher-order component.\n */\nconst hocName = ( name: string, Inner: ComponentType< any > ) => {\n\tconst inner = Inner.displayName || Inner.name || 'Component';\n\tconst outer = pascalCase( name ?? '' );\n\n\treturn `${ outer }(${ inner })`;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAA2B;AAoBpB,SAAS,2BAGb,cAA2C,cAAuB;AACpE,SAAO,CAAE,UAAmB;AAC3B,UAAM,QAAQ,aAAc,KAAM;AAClC,UAAM,cAAc,QAAS,cAAc,KAAM;AACjD,WAAO;AAAA,EACR;AACD;AAaA,MAAM,UAAU,CAAE,MAAc,UAAiC;AAChE,QAAM,QAAQ,MAAM,eAAe,MAAM,QAAQ;AACjD,QAAM,YAAQ,+BAAY,QAAQ,EAAG;AAErC,SAAO,GAAI,KAAM,IAAK,KAAM;AAC7B;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAA2B;AAoBpB,SAAS,2BAGb,cAA2C,cAAuB;AACpE,SAAO,CAAE,UAAmB;AAC3B,UAAM,QAAQ,aAAc,KAAM;AAClC,UAAM,cAAc,QAAS,cAAc,KAAM;AACjD,WAAO;AAAA,EACR;AACD;AAaA,IAAM,UAAU,CAAE,MAAc,UAAiC;AAChE,QAAM,QAAQ,MAAM,eAAe,MAAM,QAAQ;AACjD,QAAM,YAAQ,+BAAY,QAAQ,EAAG;AAErC,SAAO,GAAI,KAAM,IAAK,KAAM;AAC7B;",
6
6
  "names": []
7
7
  }
@@ -16,12 +16,14 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/compose/src/utils/debounce/index.ts
19
21
  var debounce_exports = {};
20
22
  __export(debounce_exports, {
21
23
  debounce: () => debounce
22
24
  });
23
25
  module.exports = __toCommonJS(debounce_exports);
24
- const debounce = (func, wait, options) => {
26
+ var debounce = (func, wait, options) => {
25
27
  let lastArgs;
26
28
  let lastThis;
27
29
  let maxWait = 0;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/debounce/index.ts"],
4
4
  "sourcesContent": ["/**\n * Parts of this source were derived and modified from lodash,\n * released under the MIT license.\n *\n * https://github.com/lodash/lodash\n *\n * Copyright JS Foundation and other contributors <https://js.foundation/>\n *\n * Based on Underscore.js, copyright Jeremy Ashkenas,\n * DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>\n *\n * This software consists of voluntary contributions made by many\n * individuals. For exact contribution history, see the revision history\n * available at https://github.com/lodash/lodash\n *\n * The following license applies to all parts of this software except as\n * documented below:\n *\n * ====\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\nexport interface DebounceOptions {\n\tleading: boolean;\n\tmaxWait: number;\n\ttrailing: boolean;\n}\n\nexport interface DebouncedFunc< T extends ( ...args: any[] ) => any > {\n\t/**\n\t * Call the original function, but applying the debounce rules.\n\t *\n\t * If the debounced function can be run immediately, this calls it and returns its return\n\t * value.\n\t *\n\t * Otherwise, it returns the return value of the last invocation, or undefined if the debounced\n\t * function was not invoked yet.\n\t */\n\t( ...args: Parameters< T > ): ReturnType< T > | undefined;\n\n\t/**\n\t * Throw away any pending invocation of the debounced function.\n\t */\n\tcancel: () => void;\n\n\t/**\n\t * If there is a pending invocation of the debounced function, invoke it immediately and return\n\t * its return value.\n\t *\n\t * Otherwise, return the value from the last invocation, or undefined if the debounced function\n\t * was never invoked.\n\t */\n\tflush: () => ReturnType< T > | undefined;\n}\n\n/**\n * A simplified and properly typed version of lodash's `debounce`, that\n * always uses timers instead of sometimes using rAF.\n *\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel delayed\n * `func` invocations and a `flush` method to immediately invoke them. Provide\n * `options` to indicate whether `func` should be invoked on the leading and/or\n * trailing edge of the `wait` timeout. The `func` is invoked with the last\n * arguments provided to the debounced function. Subsequent calls to the debounced\n * function return the result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * @param {Function} func The function to debounce.\n * @param {number} wait The number of milliseconds to delay.\n * @param {Partial< DebounceOptions >} options The options object.\n * @param {boolean} options.leading Specify invoking on the leading edge of the timeout.\n * @param {number} options.maxWait The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} options.trailing Specify invoking on the trailing edge of the timeout.\n *\n * @return Returns the new debounced function.\n */\nexport const debounce = < FunctionT extends ( ...args: unknown[] ) => unknown >(\n\tfunc: FunctionT,\n\twait: number,\n\toptions?: Partial< DebounceOptions >\n) => {\n\tlet lastArgs: Parameters< FunctionT > | undefined;\n\tlet lastThis: unknown | undefined;\n\tlet maxWait = 0;\n\tlet result: ReturnType< FunctionT >;\n\tlet timerId: ReturnType< typeof setTimeout > | undefined;\n\tlet lastCallTime: number | undefined;\n\n\tlet lastInvokeTime = 0;\n\tlet leading = false;\n\tlet maxing = false;\n\tlet trailing = true;\n\n\tif ( options ) {\n\t\tleading = !! options.leading;\n\t\tmaxing = 'maxWait' in options;\n\t\tif ( options.maxWait !== undefined ) {\n\t\t\tmaxWait = Math.max( options.maxWait, wait );\n\t\t}\n\t\ttrailing = 'trailing' in options ? !! options.trailing : trailing;\n\t}\n\n\tfunction invokeFunc( time: number ) {\n\t\tconst args = lastArgs;\n\t\tconst thisArg = lastThis;\n\n\t\tlastArgs = undefined;\n\t\tlastThis = undefined;\n\t\tlastInvokeTime = time;\n\n\t\tresult = func.apply( thisArg, args! ) as ReturnType< FunctionT >;\n\t\treturn result;\n\t}\n\n\tfunction startTimer(\n\t\tpendingFunc: () => void,\n\t\twaitTime: number | undefined\n\t) {\n\t\ttimerId = setTimeout( pendingFunc, waitTime );\n\t}\n\n\tfunction cancelTimer() {\n\t\tif ( timerId !== undefined ) {\n\t\t\tclearTimeout( timerId );\n\t\t}\n\t}\n\n\tfunction leadingEdge( time: number ) {\n\t\t// Reset any `maxWait` timer.\n\t\tlastInvokeTime = time;\n\t\t// Start the timer for the trailing edge.\n\t\tstartTimer( timerExpired, wait );\n\t\t// Invoke the leading edge.\n\t\treturn leading ? invokeFunc( time ) : result;\n\t}\n\n\tfunction getTimeSinceLastCall( time: number ) {\n\t\treturn time - ( lastCallTime || 0 );\n\t}\n\n\tfunction remainingWait( time: number ) {\n\t\tconst timeSinceLastCall = getTimeSinceLastCall( time );\n\t\tconst timeSinceLastInvoke = time - lastInvokeTime;\n\t\tconst timeWaiting = wait - timeSinceLastCall;\n\n\t\treturn maxing\n\t\t\t? Math.min( timeWaiting, maxWait - timeSinceLastInvoke )\n\t\t\t: timeWaiting;\n\t}\n\n\tfunction shouldInvoke( time: number ) {\n\t\tconst timeSinceLastCall = getTimeSinceLastCall( time );\n\t\tconst timeSinceLastInvoke = time - lastInvokeTime;\n\n\t\t// Either this is the first call, activity has stopped and we're at the\n\t\t// trailing edge, the system time has gone backwards and we're treating\n\t\t// it as the trailing edge, or we've hit the `maxWait` limit.\n\t\treturn (\n\t\t\tlastCallTime === undefined ||\n\t\t\ttimeSinceLastCall >= wait ||\n\t\t\ttimeSinceLastCall < 0 ||\n\t\t\t( maxing && timeSinceLastInvoke >= maxWait )\n\t\t);\n\t}\n\n\tfunction timerExpired() {\n\t\tconst time = Date.now();\n\t\tif ( shouldInvoke( time ) ) {\n\t\t\treturn trailingEdge( time );\n\t\t}\n\t\t// Restart the timer.\n\t\tstartTimer( timerExpired, remainingWait( time ) );\n\t\treturn undefined;\n\t}\n\n\tfunction clearTimer() {\n\t\ttimerId = undefined;\n\t}\n\n\tfunction trailingEdge( time: number ) {\n\t\tclearTimer();\n\n\t\t// Only invoke if we have `lastArgs` which means `func` has been\n\t\t// debounced at least once.\n\t\tif ( trailing && lastArgs ) {\n\t\t\treturn invokeFunc( time );\n\t\t}\n\t\tlastArgs = lastThis = undefined;\n\t\treturn result;\n\t}\n\n\tfunction cancel() {\n\t\tcancelTimer();\n\t\tlastInvokeTime = 0;\n\t\tclearTimer();\n\t\tlastArgs = lastCallTime = lastThis = undefined;\n\t}\n\n\tfunction flush() {\n\t\treturn pending() ? trailingEdge( Date.now() ) : result;\n\t}\n\n\tfunction pending() {\n\t\treturn timerId !== undefined;\n\t}\n\n\tfunction debounced( this: unknown, ...args: Parameters< FunctionT > ) {\n\t\tconst time = Date.now();\n\t\tconst isInvoking = shouldInvoke( time );\n\n\t\tlastArgs = args;\n\t\tlastThis = this;\n\t\tlastCallTime = time;\n\n\t\tif ( isInvoking ) {\n\t\t\tif ( ! pending() ) {\n\t\t\t\treturn leadingEdge( lastCallTime );\n\t\t\t}\n\t\t\tif ( maxing ) {\n\t\t\t\t// Handle invocations in a tight loop.\n\t\t\t\tstartTimer( timerExpired, wait );\n\t\t\t\treturn invokeFunc( lastCallTime );\n\t\t\t}\n\t\t}\n\t\tif ( ! pending() ) {\n\t\t\tstartTimer( timerExpired, wait );\n\t\t}\n\t\treturn result;\n\t}\n\tdebounced.cancel = cancel;\n\td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AuB;AAAA,EAErC;AAEA,WAAS,eAAe;AACvB,UAAM,OAAO,KAAK,IAAI;AACtB,QAAK,aAAc,IAAK,GAAI;AAC3B,aAAO,aAAc,IAAK;AAAA,IAC3B;AAEA,eAAY,cAAc,cAAe,IAAK,CAAE;AAChD,WAAO;AAAA,EACR;AAEA,WAAS,aAAa;AACrB,cAAU;AAAA,EACX;AAEA,WAAS,aAAc,MAAe;AACrC,eAAW;AAIX,QAAK,YAAY,UAAW;AAC3B,aAAO,WAAY,IAAK;AAAA,IACzB;AACA,eAAW,WAAW;AACtB,WAAO;AAAA,EACR;AAEA,WAAS,SAAS;AACjB,gBAAY;AACZ,qBAAiB;AACjB,eAAW;AACX,eAAW,eAAe,WAAW;AAAA,EACtC;AAEA,WAAS,QAAQ;AAChB,WAAO,QAAQ,IAAI,aAAc,KAAK,IAAI,CAAE,IAAI;AAAA,EACjD;AAEA,WAAS,UAAU;AAClB,WAAO,YAAY;AAAA,EACpB;AAEA,WAAS,aAA6B,MAAgC;AACrE,UAAM,OAAO,KAAK,IAAI;AACtB,UAAM,aAAa,aAAc,IAAK;AAEtC,eAAW;AACX,eAAW;AACX,mBAAe;AAEf,QAAK,YAAa;AACjB,UAAK,CAAE,QAAQ,GAAI;AAClB,eAAO,YAAa,YAAa;AAAA,MAClC;AACA,UAAK,QAAS;AAEb,mBAAY,cAAc,IAAK;AAC/B,eAAO,WAAY,YAAa;AAAA,MACjC;AAAA,IACD;AACA,QAAK,CAAE,QAAQ,GAAI;AAClB,iBAAY,cAAc,IAAK;AAAA,IAChC;AACA,WAAO;AAAA,EACR;AACA,YAAU,SAAS;AACnB,YAAU,QAAQ;AAClB,YAAU,UAAU;AACpB,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/compose/src/utils/observable-map/index.ts
19
21
  var observable_map_exports = {};
20
22
  __export(observable_map_exports, {
21
23
  observableMap: () => observableMap
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/observable-map/index.ts"],
4
4
  "sourcesContent": ["export type ObservableMap< K, V > = {\n\tget: ( name: K ) => V | undefined;\n\tset: ( name: K, value: V ) => void;\n\tdelete: ( name: K ) => void;\n\tsubscribe: ( name: K, listener: () => void ) => () => void;\n};\n\n/**\n * A constructor (factory) for `ObservableMap`, a map-like key/value data structure\n * where the individual entries are observable: using the `subscribe` method, you can\n * subscribe to updates for a particular keys. Each subscriber always observes one\n * specific key and is not notified about any unrelated changes (for different keys)\n * in the `ObservableMap`.\n *\n * @template K The type of the keys in the map.\n * @template V The type of the values in the map.\n * @return A new instance of the `ObservableMap` type.\n */\nexport function observableMap< K, V >(): ObservableMap< K, V > {\n\tconst map = new Map< K, V >();\n\tconst listeners = new Map< K, Set< () => void > >();\n\n\tfunction callListeners( name: K ) {\n\t\tconst list = listeners.get( name );\n\t\tif ( ! list ) {\n\t\t\treturn;\n\t\t}\n\t\tfor ( const listener of list ) {\n\t\t\tlistener();\n\t\t}\n\t}\n\n\treturn {\n\t\tget( name ) {\n\t\t\treturn map.get( name );\n\t\t},\n\t\tset( name, value ) {\n\t\t\tmap.set( name, value );\n\t\t\tcallListeners( name );\n\t\t},\n\t\tdelete( name ) {\n\t\t\tmap.delete( name );\n\t\t\tcallListeners( name );\n\t\t},\n\t\tsubscribe( name, listener ) {\n\t\t\tlet list = listeners.get( name );\n\t\t\tif ( ! list ) {\n\t\t\t\tlist = new Set();\n\t\t\t\tlisteners.set( name, list );\n\t\t\t}\n\t\t\tlist.add( listener );\n\n\t\t\treturn () => {\n\t\t\t\tlist.delete( listener );\n\t\t\t\tif ( list.size === 0 ) {\n\t\t\t\t\tlisteners.delete( name );\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t};\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;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IACtB;AAAA,IACA,IAAK,MAAM,OAAQ;AAClB,UAAI,IAAK,MAAM,KAAM;AACrB,oBAAe,IAAK;AAAA,IACrB;AAAA,IACA,OAAQ,MAAO;AACd,UAAI,OAAQ,IAAK;AACjB,oBAAe,IAAK;AAAA,IACrB;AAAA,IACA,UAAW,MAAM,UAAW;AAC3B,UAAI,OAAO,UAAU,IAAK,IAAK;AAC/B,UAAK,CAAE,MAAO;AACb,eAAO,oBAAI,IAAI;AACf,kBAAU,IAAK,MAAM,IAAK;AAAA,MAC3B;AACA,WAAK,IAAK,QAAS;AAEnB,aAAO,MAAM;AACZ,aAAK,OAAQ,QAAS;AACtB,YAAK,KAAK,SAAS,GAAI;AACtB,oBAAU,OAAQ,IAAK;AAAA,QACxB;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -16,13 +16,15 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/compose/src/utils/throttle/index.ts
19
21
  var throttle_exports = {};
20
22
  __export(throttle_exports, {
21
23
  throttle: () => throttle
22
24
  });
23
25
  module.exports = __toCommonJS(throttle_exports);
24
26
  var import_debounce = require("../debounce");
25
- const throttle = (func, wait, options) => {
27
+ var throttle = (func, wait, options) => {
26
28
  let leading = true;
27
29
  let trailing = true;
28
30
  if (options) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/throttle/index.ts"],
4
4
  "sourcesContent": ["/**\n * Parts of this source were derived and modified from lodash,\n * released under the MIT license.\n *\n * https://github.com/lodash/lodash\n *\n * Copyright JS Foundation and other contributors <https://js.foundation/>\n *\n * Based on Underscore.js, copyright Jeremy Ashkenas,\n * DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>\n *\n * This software consists of voluntary contributions made by many\n * individuals. For exact contribution history, see the revision history\n * available at https://github.com/lodash/lodash\n *\n * The following license applies to all parts of this software except as\n * documented below:\n *\n * ====\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * Internal dependencies\n */\nimport { debounce } from '../debounce';\n\nexport interface ThrottleOptions {\n\tleading?: boolean;\n\ttrailing?: boolean;\n}\n\n/**\n * A simplified and properly typed version of lodash's `throttle`, that\n * always uses timers instead of sometimes using rAF.\n *\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return\n * the result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * @param {Function} func The function to throttle.\n * @param {number} wait The number of milliseconds to throttle invocations to.\n * @param {Partial< ThrottleOptions >} options The options object.\n * @param {boolean} options.leading Specify invoking on the leading edge of the timeout.\n * @param {boolean} options.trailing Specify invoking on the trailing edge of the timeout.\n * @return Returns the new throttled function.\n */\nexport const throttle = < FunctionT extends ( ...args: unknown[] ) => unknown >(\n\tfunc: FunctionT,\n\twait: number,\n\toptions?: ThrottleOptions\n) => {\n\tlet leading = true;\n\tlet trailing = true;\n\n\tif ( options ) {\n\t\tleading = 'leading' in options ? !! options.leading : leading;\n\t\ttrailing = 'trailing' in options ? !! options.trailing : trailing;\n\t}\n\treturn debounce( func, wait, {\n\t\tleading,\n\t\ttrailing,\n\t\tmaxWait: wait,\n\t} );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2CA,sBAAyB;AAkClB,MAAM,WAAW,CACvB,MACA,MACA,YACI;AACJ,MAAI,UAAU;AACd,MAAI,WAAW;AAEf,MAAK,SAAU;AACd,cAAU,aAAa,UAAU,CAAC,CAAE,QAAQ,UAAU;AACtD,eAAW,cAAc,UAAU,CAAC,CAAE,QAAQ,WAAW;AAAA,EAC1D;AACA,aAAO,0BAAU,MAAM,MAAM;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,SAAS;AAAA,EACV,CAAE;AACH;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2CA,sBAAyB;AAkClB,IAAM,WAAW,CACvB,MACA,MACA,YACI;AACJ,MAAI,UAAU;AACd,MAAI,WAAW;AAEf,MAAK,SAAU;AACd,cAAU,aAAa,UAAU,CAAC,CAAE,QAAQ,UAAU;AACtD,eAAW,cAAc,UAAU,CAAC,CAAE,QAAQ,WAAW;AAAA,EAC1D;AACA,aAAO,0BAAU,MAAM,MAAM;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,SAAS;AAAA,EACV,CAAE;AACH;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
+ // packages/compose/src/higher-order/compose.ts
1
2
  import { basePipe } from "./pipe";
2
- const compose = basePipe(true);
3
+ var compose = basePipe(true);
3
4
  var compose_default = compose;
4
5
  export {
5
6
  compose_default as default
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/higher-order/compose.ts"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { basePipe } from './pipe';\n\n/**\n * Composes multiple higher-order components into a single higher-order component. Performs right-to-left function\n * composition, where each successive invocation is supplied the return value of the previous.\n *\n * This is inspired by `lodash`'s `flowRight` function.\n *\n * @see https://lodash.com/docs/4#flow-right\n */\nconst compose = basePipe( true );\n\nexport default compose;\n"],
5
- "mappings": "AAGA,SAAS,gBAAgB;AAUzB,MAAM,UAAU,SAAU,IAAK;AAE/B,IAAO,kBAAQ;",
5
+ "mappings": ";AAGA,SAAS,gBAAgB;AAUzB,IAAM,UAAU,SAAU,IAAK;AAE/B,IAAO,kBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // packages/compose/src/higher-order/if-condition/index.tsx
2
2
  import { createHigherOrderComponent } from "../../utils/create-higher-order-component";
3
+ import { jsx } from "react/jsx-runtime";
3
4
  function ifCondition(predicate) {
4
5
  return createHigherOrderComponent(
5
6
  (WrappedComponent) => (props) => {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/higher-order/if-condition/index.tsx"],
4
4
  "sourcesContent": ["/**\n * External dependencies\n */\nimport type { ComponentType } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { createHigherOrderComponent } from '../../utils/create-higher-order-component';\n\n/**\n * Higher-order component creator, creating a new component which renders if\n * the given condition is satisfied or with the given optional prop name.\n *\n * @example\n * ```ts\n * type Props = { foo: string };\n * const Component = ( props: Props ) => <div>{ props.foo }</div>;\n * const ConditionalComponent = ifCondition( ( props: Props ) => props.foo.length !== 0 )( Component );\n * <ConditionalComponent foo=\"\" />; // => null\n * <ConditionalComponent foo=\"bar\" />; // => <div>bar</div>;\n * ```\n *\n * @param predicate Function to test condition.\n *\n * @return Higher-order component.\n */\nfunction ifCondition< Props extends {} >(\n\tpredicate: ( props: Props ) => boolean\n) {\n\treturn createHigherOrderComponent(\n\t\t( WrappedComponent: ComponentType< Props > ) => ( props: Props ) => {\n\t\t\tif ( ! predicate( props ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn <WrappedComponent { ...props } />;\n\t\t},\n\t\t'ifCondition'\n\t);\n}\n\nexport default ifCondition;\n"],
5
- "mappings": "AAoCU;AA5BV,SAAS,kCAAkC;AAmB3C,SAAS,YACR,WACC;AACD,SAAO;AAAA,IACN,CAAE,qBAA8C,CAAE,UAAkB;AACnE,UAAK,CAAE,UAAW,KAAM,GAAI;AAC3B,eAAO;AAAA,MACR;AAEA,aAAO,oBAAC,oBAAmB,GAAG,OAAQ;AAAA,IACvC;AAAA,IACA;AAAA,EACD;AACD;AAEA,IAAO,uBAAQ;",
5
+ "mappings": ";AAQA,SAAS,kCAAkC;AA4BjC;AATV,SAAS,YACR,WACC;AACD,SAAO;AAAA,IACN,CAAE,qBAA8C,CAAE,UAAkB;AACnE,UAAK,CAAE,UAAW,KAAM,GAAI;AAC3B,eAAO;AAAA,MACR;AAEA,aAAO,oBAAC,oBAAmB,GAAG,OAAQ;AAAA,IACvC;AAAA,IACA;AAAA,EACD;AACD;AAEA,IAAO,uBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
- const basePipe = (reverse = false) => (...funcs) => (...args) => {
1
+ // packages/compose/src/higher-order/pipe.ts
2
+ var basePipe = (reverse = false) => (...funcs) => (...args) => {
2
3
  const functions = funcs.flat();
3
4
  if (reverse) {
4
5
  functions.reverse();
@@ -8,7 +9,7 @@ const basePipe = (reverse = false) => (...funcs) => (...args) => {
8
9
  args
9
10
  )[0];
10
11
  };
11
- const pipe = basePipe();
12
+ var pipe = basePipe();
12
13
  var pipe_default = pipe;
13
14
  export {
14
15
  basePipe,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/higher-order/pipe.ts"],
4
4
  "sourcesContent": ["/**\n * Parts of this source were derived and modified from lodash,\n * released under the MIT license.\n *\n * https://github.com/lodash/lodash\n *\n * Copyright JS Foundation and other contributors <https://js.foundation/>\n *\n * Based on Underscore.js, copyright Jeremy Ashkenas,\n * DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>\n *\n * This software consists of voluntary contributions made by many\n * individuals. For exact contribution history, see the revision history\n * available at https://github.com/lodash/lodash\n *\n * The following license applies to all parts of this software except as\n * documented below:\n *\n * ====\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * Creates a pipe function.\n *\n * Allows to choose whether to perform left-to-right or right-to-left composition.\n *\n * @see https://lodash.com/docs/4#flow\n *\n * @param {boolean} reverse True if right-to-left, false for left-to-right composition.\n */\nconst basePipe =\n\t( reverse: boolean = false ) =>\n\t( ...funcs: Function[] ) =>\n\t( ...args: unknown[] ) => {\n\t\tconst functions = funcs.flat();\n\t\tif ( reverse ) {\n\t\t\tfunctions.reverse();\n\t\t}\n\t\treturn functions.reduce(\n\t\t\t( prev, func ) => [ func( ...prev ) ],\n\t\t\targs\n\t\t)[ 0 ];\n\t};\n\n/**\n * Composes multiple higher-order components into a single higher-order component. Performs left-to-right function\n * composition, where each successive invocation is supplied the return value of the previous.\n *\n * This is inspired by `lodash`'s `flow` function.\n *\n * @see https://lodash.com/docs/4#flow\n */\nconst pipe = basePipe();\n\nexport { basePipe };\n\nexport default pipe;\n"],
5
- "mappings": "AAiDA,MAAM,WACL,CAAE,UAAmB,UACrB,IAAK,UACL,IAAK,SAAqB;AACzB,QAAM,YAAY,MAAM,KAAK;AAC7B,MAAK,SAAU;AACd,cAAU,QAAQ;AAAA,EACnB;AACA,SAAO,UAAU;AAAA,IAChB,CAAE,MAAM,SAAU,CAAE,KAAM,GAAG,IAAK,CAAE;AAAA,IACpC;AAAA,EACD,EAAG,CAAE;AACN;AAUD,MAAM,OAAO,SAAS;AAItB,IAAO,eAAQ;",
5
+ "mappings": ";AAiDA,IAAM,WACL,CAAE,UAAmB,UACrB,IAAK,UACL,IAAK,SAAqB;AACzB,QAAM,YAAY,MAAM,KAAK;AAC7B,MAAK,SAAU;AACd,cAAU,QAAQ;AAAA,EACnB;AACA,SAAO,UAAU;AAAA,IAChB,CAAE,MAAM,SAAU,CAAE,KAAM,GAAG,IAAK,CAAE;AAAA,IACpC;AAAA,EACD,EAAG,CAAE;AACN;AAUD,IAAM,OAAO,SAAS;AAItB,IAAO,eAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,8 +1,9 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // packages/compose/src/higher-order/pure/index.tsx
2
2
  import isShallowEqual from "@wordpress/is-shallow-equal";
3
3
  import { Component } from "@wordpress/element";
4
4
  import { createHigherOrderComponent } from "../../utils/create-higher-order-component";
5
- const pure = createHigherOrderComponent(function(WrappedComponent) {
5
+ import { jsx } from "react/jsx-runtime";
6
+ var pure = createHigherOrderComponent(function(WrappedComponent) {
6
7
  if (WrappedComponent.prototype instanceof Component) {
7
8
  return class extends WrappedComponent {
8
9
  shouldComponentUpdate(nextProps, nextState) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/higher-order/pure/index.tsx"],
4
4
  "sourcesContent": ["/**\n * External dependencies\n */\nimport type { ComponentType, ComponentClass } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport isShallowEqual from '@wordpress/is-shallow-equal';\nimport { Component } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { createHigherOrderComponent } from '../../utils/create-higher-order-component';\n\n/**\n * Given a component returns the enhanced component augmented with a component\n * only re-rendering when its props/state change\n *\n * @deprecated Use `memo` or `PureComponent` instead.\n */\nconst pure = createHigherOrderComponent( function < Props extends {} >(\n\tWrappedComponent: ComponentType< Props >\n): ComponentType< Props > {\n\tif ( WrappedComponent.prototype instanceof Component ) {\n\t\treturn class extends ( WrappedComponent as ComponentClass< Props > ) {\n\t\t\tshouldComponentUpdate( nextProps: Props, nextState: any ) {\n\t\t\t\treturn (\n\t\t\t\t\t! isShallowEqual( nextProps, this.props ) ||\n\t\t\t\t\t! isShallowEqual( nextState, this.state )\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\t}\n\n\treturn class extends Component< Props > {\n\t\tshouldComponentUpdate( nextProps: Props ) {\n\t\t\treturn ! isShallowEqual( nextProps, this.props );\n\t\t}\n\n\t\trender() {\n\t\t\treturn <WrappedComponent { ...this.props } />;\n\t\t}\n\t};\n}, 'pure' );\n\nexport default pure;\n"],
5
- "mappings": "AA0CU;AAlCV,OAAO,oBAAoB;AAC3B,SAAS,iBAAiB;AAK1B,SAAS,kCAAkC;AAQ3C,MAAM,OAAO,2BAA4B,SACxC,kBACyB;AACzB,MAAK,iBAAiB,qBAAqB,WAAY;AACtD,WAAO,cAAgB,iBAA8C;AAAA,MACpE,sBAAuB,WAAkB,WAAiB;AACzD,eACC,CAAE,eAAgB,WAAW,KAAK,KAAM,KACxC,CAAE,eAAgB,WAAW,KAAK,KAAM;AAAA,MAE1C;AAAA,IACD;AAAA,EACD;AAEA,SAAO,cAAc,UAAmB;AAAA,IACvC,sBAAuB,WAAmB;AACzC,aAAO,CAAE,eAAgB,WAAW,KAAK,KAAM;AAAA,IAChD;AAAA,IAEA,SAAS;AACR,aAAO,oBAAC,oBAAmB,GAAG,KAAK,OAAQ;AAAA,IAC5C;AAAA,EACD;AACD,GAAG,MAAO;AAEV,IAAO,eAAQ;",
5
+ "mappings": ";AAQA,OAAO,oBAAoB;AAC3B,SAAS,iBAAiB;AAK1B,SAAS,kCAAkC;AA4BjC;AApBV,IAAM,OAAO,2BAA4B,SACxC,kBACyB;AACzB,MAAK,iBAAiB,qBAAqB,WAAY;AACtD,WAAO,cAAgB,iBAA8C;AAAA,MACpE,sBAAuB,WAAkB,WAAiB;AACzD,eACC,CAAE,eAAgB,WAAW,KAAK,KAAM,KACxC,CAAE,eAAgB,WAAW,KAAK,KAAM;AAAA,MAE1C;AAAA,IACD;AAAA,EACD;AAEA,SAAO,cAAc,UAAmB;AAAA,IACvC,sBAAuB,WAAmB;AACzC,aAAO,CAAE,eAAgB,WAAW,KAAK,KAAM;AAAA,IAChD;AAAA,IAEA,SAAS;AACR,aAAO,oBAAC,oBAAmB,GAAG,KAAK,OAAQ;AAAA,IAC5C;AAAA,EACD;AACD,GAAG,MAAO;AAEV,IAAO,eAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,9 +1,10 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // packages/compose/src/higher-order/with-global-events/index.js
2
2
  import { Component, forwardRef } from "@wordpress/element";
3
3
  import deprecated from "@wordpress/deprecated";
4
4
  import { createHigherOrderComponent } from "../../utils/create-higher-order-component";
5
5
  import Listener from "./listener";
6
- const listener = new Listener();
6
+ import { jsx } from "react/jsx-runtime";
7
+ var listener = new Listener();
7
8
  function withGlobalEvents(eventTypesToHandlers) {
8
9
  deprecated("wp.compose.withGlobalEvents", {
9
10
  since: "5.7",
@@ -30,7 +31,6 @@ function withGlobalEvents(eventTypesToHandlers) {
30
31
  const handler = eventTypesToHandlers[
31
32
  /** @type {keyof GlobalEventHandlersEventMap} */
32
33
  event.type
33
- /* eslint-enable jsdoc/no-undefined-types */
34
34
  ];
35
35
  if (typeof this.wrappedRef[handler] === "function") {
36
36
  this.wrappedRef[handler](event);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/higher-order/with-global-events/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Component, forwardRef } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { createHigherOrderComponent } from '../../utils/create-higher-order-component';\nimport Listener from './listener';\n\n/**\n * Listener instance responsible for managing document event handling.\n */\nconst listener = new Listener();\n\n/* eslint-disable jsdoc/no-undefined-types */\n/**\n * Higher-order component creator which, given an object of DOM event types and\n * values corresponding to a callback function name on the component, will\n * create or update a window event handler to invoke the callback when an event\n * occurs. On behalf of the consuming developer, the higher-order component\n * manages unbinding when the component unmounts, and binding at most a single\n * event handler for the entire application.\n *\n * @deprecated\n *\n * @param {Record<keyof GlobalEventHandlersEventMap, string>} eventTypesToHandlers Object with keys of DOM\n * event type, the value a\n * name of the function on\n * the original component's\n * instance which handles\n * the event.\n *\n * @return {any} Higher-order component.\n */\nexport default function withGlobalEvents( eventTypesToHandlers ) {\n\tdeprecated( 'wp.compose.withGlobalEvents', {\n\t\tsince: '5.7',\n\t\talternative: 'useEffect',\n\t} );\n\n\t// @ts-ignore We don't need to fix the type-related issues because this is deprecated.\n\treturn createHigherOrderComponent( ( WrappedComponent ) => {\n\t\tclass Wrapper extends Component {\n\t\t\tconstructor( /** @type {any} */ props ) {\n\t\t\t\tsuper( props );\n\n\t\t\t\tthis.handleEvent = this.handleEvent.bind( this );\n\t\t\t\tthis.handleRef = this.handleRef.bind( this );\n\t\t\t}\n\n\t\t\tcomponentDidMount() {\n\t\t\t\tObject.keys( eventTypesToHandlers ).forEach( ( eventType ) => {\n\t\t\t\t\tlistener.add( eventType, this );\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcomponentWillUnmount() {\n\t\t\t\tObject.keys( eventTypesToHandlers ).forEach( ( eventType ) => {\n\t\t\t\t\tlistener.remove( eventType, this );\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\thandleEvent( /** @type {any} */ event ) {\n\t\t\t\tconst handler =\n\t\t\t\t\teventTypesToHandlers[\n\t\t\t\t\t\t/** @type {keyof GlobalEventHandlersEventMap} */ (\n\t\t\t\t\t\t\tevent.type\n\t\t\t\t\t\t)\n\t\t\t\t\t\t/* eslint-enable jsdoc/no-undefined-types */\n\t\t\t\t\t];\n\t\t\t\tif ( typeof this.wrappedRef[ handler ] === 'function' ) {\n\t\t\t\t\tthis.wrappedRef[ handler ]( event );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thandleRef( /** @type {any} */ el ) {\n\t\t\t\tthis.wrappedRef = el;\n\t\t\t\t// Any component using `withGlobalEvents` that is not setting a `ref`\n\t\t\t\t// will cause `this.props.forwardedRef` to be `null`, so we need this\n\t\t\t\t// check.\n\t\t\t\tif ( this.props.forwardedRef ) {\n\t\t\t\t\tthis.props.forwardedRef( el );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trender() {\n\t\t\t\treturn (\n\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t{ ...this.props.ownProps }\n\t\t\t\t\t\tref={ this.handleRef }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn forwardRef( ( props, ref ) => {\n\t\t\treturn <Wrapper ownProps={ props } forwardedRef={ ref } />;\n\t\t} );\n\t}, 'withGlobalEvents' );\n}\n"],
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,oBAAC,WAAQ,UAAW,OAAQ,cAAe,KAAM;AAAA,IACzD,CAAE;AAAA,EACH,GAAG,kBAAmB;AACvB;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Component, forwardRef } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { createHigherOrderComponent } from '../../utils/create-higher-order-component';\nimport Listener from './listener';\n\n/**\n * Listener instance responsible for managing document event handling.\n */\nconst listener = new Listener();\n\n/**\n * Higher-order component creator which, given an object of DOM event types and\n * values corresponding to a callback function name on the component, will\n * create or update a window event handler to invoke the callback when an event\n * occurs. On behalf of the consuming developer, the higher-order component\n * manages unbinding when the component unmounts, and binding at most a single\n * event handler for the entire application.\n *\n * @deprecated\n *\n * @param {Record<keyof GlobalEventHandlersEventMap, string>} eventTypesToHandlers Object with keys of DOM\n * event type, the value a\n * name of the function on\n * the original component's\n * instance which handles\n * the event.\n *\n * @return {any} Higher-order component.\n */\nexport default function withGlobalEvents( eventTypesToHandlers ) {\n\tdeprecated( 'wp.compose.withGlobalEvents', {\n\t\tsince: '5.7',\n\t\talternative: 'useEffect',\n\t} );\n\n\t// @ts-ignore We don't need to fix the type-related issues because this is deprecated.\n\treturn createHigherOrderComponent( ( WrappedComponent ) => {\n\t\tclass Wrapper extends Component {\n\t\t\tconstructor( /** @type {any} */ props ) {\n\t\t\t\tsuper( props );\n\n\t\t\t\tthis.handleEvent = this.handleEvent.bind( this );\n\t\t\t\tthis.handleRef = this.handleRef.bind( this );\n\t\t\t}\n\n\t\t\tcomponentDidMount() {\n\t\t\t\tObject.keys( eventTypesToHandlers ).forEach( ( eventType ) => {\n\t\t\t\t\tlistener.add( eventType, this );\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcomponentWillUnmount() {\n\t\t\t\tObject.keys( eventTypesToHandlers ).forEach( ( eventType ) => {\n\t\t\t\t\tlistener.remove( eventType, this );\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\thandleEvent( /** @type {any} */ event ) {\n\t\t\t\tconst handler =\n\t\t\t\t\teventTypesToHandlers[\n\t\t\t\t\t\t/** @type {keyof GlobalEventHandlersEventMap} */ (\n\t\t\t\t\t\t\tevent.type\n\t\t\t\t\t\t)\n\t\t\t\t\t];\n\t\t\t\tif ( typeof this.wrappedRef[ handler ] === 'function' ) {\n\t\t\t\t\tthis.wrappedRef[ handler ]( event );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thandleRef( /** @type {any} */ el ) {\n\t\t\t\tthis.wrappedRef = el;\n\t\t\t\t// Any component using `withGlobalEvents` that is not setting a `ref`\n\t\t\t\t// will cause `this.props.forwardedRef` to be `null`, so we need this\n\t\t\t\t// check.\n\t\t\t\tif ( this.props.forwardedRef ) {\n\t\t\t\t\tthis.props.forwardedRef( el );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trender() {\n\t\t\t\treturn (\n\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t{ ...this.props.ownProps }\n\t\t\t\t\t\tref={ this.handleRef }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn forwardRef( ( props, ref ) => {\n\t\t\treturn <Wrapper ownProps={ props } forwardedRef={ ref } />;\n\t\t} );\n\t}, 'withGlobalEvents' );\n}\n"],
5
+ "mappings": ";AAGA,SAAS,WAAW,kBAAkB;AACtC,OAAO,gBAAgB;AAKvB,SAAS,kCAAkC;AAC3C,OAAO,cAAc;AA8EhB;AAzEL,IAAM,WAAW,IAAI,SAAS;AAqBf,SAAR,iBAAmC,sBAAuB;AAChE,aAAY,+BAA+B;AAAA,IAC1C,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAGF,SAAO,2BAA4B,CAAE,qBAAsB;AAAA,IAC1D,MAAM,gBAAgB,UAAU;AAAA,MAC/B,YAAgC,OAAQ;AACvC,cAAO,KAAM;AAEb,aAAK,cAAc,KAAK,YAAY,KAAM,IAAK;AAC/C,aAAK,YAAY,KAAK,UAAU,KAAM,IAAK;AAAA,MAC5C;AAAA,MAEA,oBAAoB;AACnB,eAAO,KAAM,oBAAqB,EAAE,QAAS,CAAE,cAAe;AAC7D,mBAAS,IAAK,WAAW,IAAK;AAAA,QAC/B,CAAE;AAAA,MACH;AAAA,MAEA,uBAAuB;AACtB,eAAO,KAAM,oBAAqB,EAAE,QAAS,CAAE,cAAe;AAC7D,mBAAS,OAAQ,WAAW,IAAK;AAAA,QAClC,CAAE;AAAA,MACH;AAAA,MAEA,YAAgC,OAAQ;AACvC,cAAM,UACL;AAAA;AAAA,UAEE,MAAM;AAAA,QAER;AACD,YAAK,OAAO,KAAK,WAAY,OAAQ,MAAM,YAAa;AACvD,eAAK,WAAY,OAAQ,EAAG,KAAM;AAAA,QACnC;AAAA,MACD;AAAA,MAEA,UAA8B,IAAK;AAClC,aAAK,aAAa;AAIlB,YAAK,KAAK,MAAM,cAAe;AAC9B,eAAK,MAAM,aAAc,EAAG;AAAA,QAC7B;AAAA,MACD;AAAA,MAEA,SAAS;AACR,eACC;AAAA,UAAC;AAAA;AAAA,YACE,GAAG,KAAK,MAAM;AAAA,YAChB,KAAM,KAAK;AAAA;AAAA,QACZ;AAAA,MAEF;AAAA,IACD;AAEA,WAAO,WAAY,CAAE,OAAO,QAAS;AACpC,aAAO,oBAAC,WAAQ,UAAW,OAAQ,cAAe,KAAM;AAAA,IACzD,CAAE;AAAA,EACH,GAAG,kBAAmB;AACvB;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
- class Listener {
1
+ // packages/compose/src/higher-order/with-global-events/listener.js
2
+ var Listener = class {
2
3
  constructor() {
3
4
  this.listeners = {};
4
5
  this.handleEvent = this.handleEvent.bind(this);
@@ -29,7 +30,7 @@ class Listener {
29
30
  }
30
31
  );
31
32
  }
32
- }
33
+ };
33
34
  var listener_default = Listener;
34
35
  export {
35
36
  listener_default as default
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/higher-order/with-global-events/listener.js"],
4
4
  "sourcesContent": ["/**\n * Class responsible for orchestrating event handling on the global window,\n * binding a single event to be shared across all handling instances, and\n * removing the handler when no instances are listening for the event.\n */\nclass Listener {\n\tconstructor() {\n\t\t/** @type {any} */\n\t\tthis.listeners = {};\n\n\t\tthis.handleEvent = this.handleEvent.bind( this );\n\t}\n\n\tadd( /** @type {any} */ eventType, /** @type {any} */ instance ) {\n\t\tif ( ! this.listeners[ eventType ] ) {\n\t\t\t// Adding first listener for this type, so bind event.\n\t\t\twindow.addEventListener( eventType, this.handleEvent );\n\t\t\tthis.listeners[ eventType ] = [];\n\t\t}\n\n\t\tthis.listeners[ eventType ].push( instance );\n\t}\n\n\tremove( /** @type {any} */ eventType, /** @type {any} */ instance ) {\n\t\tif ( ! this.listeners[ eventType ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.listeners[ eventType ] = this.listeners[ eventType ].filter(\n\t\t\t( /** @type {any} */ listener ) => listener !== instance\n\t\t);\n\n\t\tif ( ! this.listeners[ eventType ].length ) {\n\t\t\t// Removing last listener for this type, so unbind event.\n\t\t\twindow.removeEventListener( eventType, this.handleEvent );\n\t\t\tdelete this.listeners[ eventType ];\n\t\t}\n\t}\n\n\thandleEvent( /** @type {any} */ event ) {\n\t\tthis.listeners[ event.type ]?.forEach(\n\t\t\t( /** @type {any} */ instance ) => {\n\t\t\t\tinstance.handleEvent( event );\n\t\t\t}\n\t\t);\n\t}\n}\n\nexport default Listener;\n"],
5
- "mappings": "AAKA,MAAM,SAAS;AAAA,EACd,cAAc;AAEb,SAAK,YAAY,CAAC;AAElB,SAAK,cAAc,KAAK,YAAY,KAAM,IAAK;AAAA,EAChD;AAAA,EAEA,IAAwB,WAA8B,UAAW;AAChE,QAAK,CAAE,KAAK,UAAW,SAAU,GAAI;AAEpC,aAAO,iBAAkB,WAAW,KAAK,WAAY;AACrD,WAAK,UAAW,SAAU,IAAI,CAAC;AAAA,IAChC;AAEA,SAAK,UAAW,SAAU,EAAE,KAAM,Q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