@shopify/ui-extensions-server-kit 5.4.0 → 5.4.1

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 (227) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/ExtensionServerClient/ExtensionServerClient.d.ts +3 -5
  4. package/dist/ExtensionServerClient/server-types.d.ts +31 -7
  5. package/dist/_virtual/jsx-runtime.cjs.js +1 -0
  6. package/dist/_virtual/jsx-runtime.cjs2.js +1 -0
  7. package/dist/_virtual/jsx-runtime.es.js +5 -0
  8. package/dist/_virtual/jsx-runtime.es2.js +4 -0
  9. package/dist/_virtual/react-jsx-runtime.development.cjs.js +1 -0
  10. package/dist/_virtual/react-jsx-runtime.development.es.js +4 -0
  11. package/dist/_virtual/react-jsx-runtime.production.min.cjs.js +1 -0
  12. package/dist/_virtual/react-jsx-runtime.production.min.es.js +4 -0
  13. package/dist/i18n.d.ts +2 -8
  14. package/dist/index.cjs.js +1 -1
  15. package/dist/index.cjs2.js +1 -1
  16. package/dist/index.es.js +18 -18
  17. package/dist/index.es2.js +3 -3
  18. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.cjs.js +22 -0
  19. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.es.js +604 -0
  20. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.cjs.js +9 -0
  21. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.es.js +28 -0
  22. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.cjs.js +1 -0
  23. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.es.js +10 -0
  24. package/dist/packages/ui-extensions-server-kit/src/ExtensionServerClient/ExtensionServerClient.cjs.js +1 -0
  25. package/dist/{ExtensionServerClient → packages/ui-extensions-server-kit/src/ExtensionServerClient}/ExtensionServerClient.es.js +21 -18
  26. package/dist/packages/ui-extensions-server-kit/src/context/ExtensionServerProvider.cjs.js +1 -0
  27. package/dist/packages/ui-extensions-server-kit/src/context/ExtensionServerProvider.es.js +30 -0
  28. package/dist/{context → packages/ui-extensions-server-kit/src/context}/constants.cjs.js +1 -1
  29. package/dist/packages/ui-extensions-server-kit/src/hooks/useExtensionServerContext.cjs.js +1 -0
  30. package/dist/{hooks → packages/ui-extensions-server-kit/src/hooks}/useExtensionServerContext.es.js +3 -2
  31. package/dist/packages/ui-extensions-server-kit/src/testing/MockExtensionServerProvider.cjs.js +1 -0
  32. package/dist/packages/ui-extensions-server-kit/src/testing/MockExtensionServerProvider.es.js +25 -0
  33. package/dist/packages/ui-extensions-server-kit/src/utilities/isUIExtension.cjs.js +1 -0
  34. package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/isUIExtension.es.js +3 -2
  35. package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/isValidSurface.cjs.js +1 -1
  36. package/dist/packages/ui-extensions-server-kit/src/utilities/isValidSurface.es.js +7 -0
  37. package/dist/types.d.ts +11 -8
  38. package/dist/utilities/isUIExtension.d.ts +1 -1
  39. package/dist/utilities/isValidSurface.d.ts +1 -1
  40. package/dist/utilities/set.d.ts +1 -1
  41. package/node_modules/{@shopify/react-testing/LICENSE.md → @testing-library/react/LICENSE} +2 -3
  42. package/node_modules/@testing-library/react/README.md +692 -0
  43. package/node_modules/@testing-library/react/dist/@testing-library/react.cjs.js +537 -0
  44. package/node_modules/@testing-library/react/dist/@testing-library/react.esm.js +497 -0
  45. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.cjs.js +501 -0
  46. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.esm.js +461 -0
  47. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.js +502 -0
  48. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.js.map +1 -0
  49. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.min.js +2 -0
  50. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.min.js.map +1 -0
  51. package/node_modules/@testing-library/react/dist/@testing-library/react.umd.js +538 -0
  52. package/node_modules/@testing-library/react/dist/@testing-library/react.umd.js.map +1 -0
  53. package/node_modules/@testing-library/react/dist/@testing-library/react.umd.min.js +2 -0
  54. package/node_modules/@testing-library/react/dist/@testing-library/react.umd.min.js.map +1 -0
  55. package/node_modules/@testing-library/react/dist/act-compat.js +80 -0
  56. package/node_modules/@testing-library/react/dist/config.js +33 -0
  57. package/node_modules/@testing-library/react/dist/fire-event.js +70 -0
  58. package/node_modules/@testing-library/react/dist/index.js +52 -0
  59. package/node_modules/@testing-library/react/dist/pure.js +356 -0
  60. package/node_modules/@testing-library/react/dont-cleanup-after-each.js +1 -0
  61. package/node_modules/@testing-library/react/package.json +116 -0
  62. package/node_modules/@testing-library/react/pure.d.ts +1 -0
  63. package/node_modules/@testing-library/react/pure.js +2 -0
  64. package/node_modules/@testing-library/react/types/index.d.ts +287 -0
  65. package/node_modules/@testing-library/react/types/pure.d.ts +1 -0
  66. package/node_modules/@vitejs/plugin-react/README.md +159 -0
  67. package/node_modules/@vitejs/plugin-react/dist/index.d.ts +75 -0
  68. package/node_modules/@vitejs/plugin-react/dist/index.js +401 -0
  69. package/node_modules/@vitejs/plugin-react/dist/refresh-runtime.js +663 -0
  70. package/node_modules/@vitejs/plugin-react/package.json +77 -0
  71. package/node_modules/@vitejs/plugin-react/types/preamble.d.ts +1 -0
  72. package/package.json +8 -9
  73. package/project.json +1 -1
  74. package/src/ExtensionServerClient/ExtensionServerClient.test.ts +6 -5
  75. package/src/ExtensionServerClient/ExtensionServerClient.ts +27 -19
  76. package/src/ExtensionServerClient/server-types.ts +17 -7
  77. package/src/ExtensionServerClient/types.ts +0 -2
  78. package/src/context/ExtensionServerProvider.test.tsx +55 -73
  79. package/src/context/ExtensionServerProvider.tsx +1 -0
  80. package/src/i18n.ts +2 -5
  81. package/src/state/reducers/extensionServerReducer.test.ts +2 -2
  82. package/src/types.ts +11 -6
  83. package/src/utilities/assetToString.ts +0 -1
  84. package/src/utilities/isUIExtension.ts +5 -4
  85. package/src/utilities/isValidSurface.ts +2 -3
  86. package/src/utilities/replaceUpdated.ts +0 -2
  87. package/src/utilities/set.ts +10 -5
  88. package/tests/setup.ts +1 -4
  89. package/vite.config.mts +57 -0
  90. package/dist/ExtensionServerClient/ExtensionServerClient.cjs.js +0 -1
  91. package/dist/context/ExtensionServerProvider.cjs.js +0 -1
  92. package/dist/context/ExtensionServerProvider.es.js +0 -29
  93. package/dist/hooks/useExtensionServerContext.cjs.js +0 -1
  94. package/dist/testing/MockExtensionServerProvider.cjs.js +0 -1
  95. package/dist/testing/MockExtensionServerProvider.es.js +0 -24
  96. package/dist/utilities/isUIExtension.cjs.js +0 -1
  97. package/dist/utilities/isValidSurface.es.js +0 -7
  98. package/node_modules/@shopify/react-testing/README.md +0 -711
  99. package/node_modules/@shopify/react-testing/build/cjs/TestWrapper.js +0 -52
  100. package/node_modules/@shopify/react-testing/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -47
  101. package/node_modules/@shopify/react-testing/build/cjs/compat.js +0 -14
  102. package/node_modules/@shopify/react-testing/build/cjs/destroy.js +0 -13
  103. package/node_modules/@shopify/react-testing/build/cjs/element.js +0 -225
  104. package/node_modules/@shopify/react-testing/build/cjs/index.js +0 -21
  105. package/node_modules/@shopify/react-testing/build/cjs/matchers/components.js +0 -46
  106. package/node_modules/@shopify/react-testing/build/cjs/matchers/context.js +0 -25
  107. package/node_modules/@shopify/react-testing/build/cjs/matchers/index.js +0 -16
  108. package/node_modules/@shopify/react-testing/build/cjs/matchers/props.js +0 -38
  109. package/node_modules/@shopify/react-testing/build/cjs/matchers/strings.js +0 -42
  110. package/node_modules/@shopify/react-testing/build/cjs/matchers/utilities.js +0 -110
  111. package/node_modules/@shopify/react-testing/build/cjs/mount.js +0 -76
  112. package/node_modules/@shopify/react-testing/build/cjs/root.js +0 -284
  113. package/node_modules/@shopify/react-testing/build/cjs/toReactString.js +0 -86
  114. package/node_modules/@shopify/react-testing/build/cjs/types.js +0 -28
  115. package/node_modules/@shopify/react-testing/build/esm/TestWrapper.mjs +0 -44
  116. package/node_modules/@shopify/react-testing/build/esm/_virtual/_rollupPluginBabelHelpers.mjs +0 -42
  117. package/node_modules/@shopify/react-testing/build/esm/compat.mjs +0 -10
  118. package/node_modules/@shopify/react-testing/build/esm/destroy.mjs +0 -9
  119. package/node_modules/@shopify/react-testing/build/esm/element.mjs +0 -221
  120. package/node_modules/@shopify/react-testing/build/esm/index.mjs +0 -5
  121. package/node_modules/@shopify/react-testing/build/esm/matchers/components.mjs +0 -41
  122. package/node_modules/@shopify/react-testing/build/esm/matchers/context.mjs +0 -21
  123. package/node_modules/@shopify/react-testing/build/esm/matchers/index.mjs +0 -14
  124. package/node_modules/@shopify/react-testing/build/esm/matchers/props.mjs +0 -33
  125. package/node_modules/@shopify/react-testing/build/esm/matchers/strings.mjs +0 -37
  126. package/node_modules/@shopify/react-testing/build/esm/matchers/utilities.mjs +0 -101
  127. package/node_modules/@shopify/react-testing/build/esm/mount.mjs +0 -70
  128. package/node_modules/@shopify/react-testing/build/esm/root.mjs +0 -275
  129. package/node_modules/@shopify/react-testing/build/esm/toReactString.mjs +0 -80
  130. package/node_modules/@shopify/react-testing/build/esm/types.mjs +0 -26
  131. package/node_modules/@shopify/react-testing/build/esnext/TestWrapper.esnext +0 -44
  132. package/node_modules/@shopify/react-testing/build/esnext/compat.esnext +0 -10
  133. package/node_modules/@shopify/react-testing/build/esnext/destroy.esnext +0 -9
  134. package/node_modules/@shopify/react-testing/build/esnext/element.esnext +0 -221
  135. package/node_modules/@shopify/react-testing/build/esnext/index.esnext +0 -5
  136. package/node_modules/@shopify/react-testing/build/esnext/matchers/components.esnext +0 -41
  137. package/node_modules/@shopify/react-testing/build/esnext/matchers/context.esnext +0 -21
  138. package/node_modules/@shopify/react-testing/build/esnext/matchers/index.esnext +0 -14
  139. package/node_modules/@shopify/react-testing/build/esnext/matchers/props.esnext +0 -33
  140. package/node_modules/@shopify/react-testing/build/esnext/matchers/strings.esnext +0 -37
  141. package/node_modules/@shopify/react-testing/build/esnext/matchers/utilities.esnext +0 -99
  142. package/node_modules/@shopify/react-testing/build/esnext/mount.esnext +0 -71
  143. package/node_modules/@shopify/react-testing/build/esnext/root.esnext +0 -275
  144. package/node_modules/@shopify/react-testing/build/esnext/toReactString.esnext +0 -80
  145. package/node_modules/@shopify/react-testing/build/esnext/types.esnext +0 -26
  146. package/node_modules/@shopify/react-testing/build/ts/TestWrapper.d.ts +0 -17
  147. package/node_modules/@shopify/react-testing/build/ts/TestWrapper.d.ts.map +0 -1
  148. package/node_modules/@shopify/react-testing/build/ts/compat.d.ts +0 -3
  149. package/node_modules/@shopify/react-testing/build/ts/compat.d.ts.map +0 -1
  150. package/node_modules/@shopify/react-testing/build/ts/destroy.d.ts +0 -2
  151. package/node_modules/@shopify/react-testing/build/ts/destroy.d.ts.map +0 -1
  152. package/node_modules/@shopify/react-testing/build/ts/element.d.ts +0 -42
  153. package/node_modules/@shopify/react-testing/build/ts/element.d.ts.map +0 -1
  154. package/node_modules/@shopify/react-testing/build/ts/index.d.ts +0 -7
  155. package/node_modules/@shopify/react-testing/build/ts/index.d.ts.map +0 -1
  156. package/node_modules/@shopify/react-testing/build/ts/matchers/components.d.ts +0 -12
  157. package/node_modules/@shopify/react-testing/build/ts/matchers/components.d.ts.map +0 -1
  158. package/node_modules/@shopify/react-testing/build/ts/matchers/context.d.ts +0 -8
  159. package/node_modules/@shopify/react-testing/build/ts/matchers/context.d.ts.map +0 -1
  160. package/node_modules/@shopify/react-testing/build/ts/matchers/index.d.ts +0 -20
  161. package/node_modules/@shopify/react-testing/build/ts/matchers/index.d.ts.map +0 -1
  162. package/node_modules/@shopify/react-testing/build/ts/matchers/props.d.ts +0 -10
  163. package/node_modules/@shopify/react-testing/build/ts/matchers/props.d.ts.map +0 -1
  164. package/node_modules/@shopify/react-testing/build/ts/matchers/strings.d.ts +0 -11
  165. package/node_modules/@shopify/react-testing/build/ts/matchers/strings.d.ts.map +0 -1
  166. package/node_modules/@shopify/react-testing/build/ts/matchers/utilities.d.ts +0 -17
  167. package/node_modules/@shopify/react-testing/build/ts/matchers/utilities.d.ts.map +0 -1
  168. package/node_modules/@shopify/react-testing/build/ts/mount.d.ts +0 -39
  169. package/node_modules/@shopify/react-testing/build/ts/mount.d.ts.map +0 -1
  170. package/node_modules/@shopify/react-testing/build/ts/root.d.ts +0 -55
  171. package/node_modules/@shopify/react-testing/build/ts/root.d.ts.map +0 -1
  172. package/node_modules/@shopify/react-testing/build/ts/toReactString.d.ts +0 -5
  173. package/node_modules/@shopify/react-testing/build/ts/toReactString.d.ts.map +0 -1
  174. package/node_modules/@shopify/react-testing/build/ts/types.d.ts +0 -89
  175. package/node_modules/@shopify/react-testing/build/ts/types.d.ts.map +0 -1
  176. package/node_modules/@shopify/react-testing/index.esnext +0 -1
  177. package/node_modules/@shopify/react-testing/index.js +0 -1
  178. package/node_modules/@shopify/react-testing/index.mjs +0 -1
  179. package/node_modules/@shopify/react-testing/matchers.esnext +0 -1
  180. package/node_modules/@shopify/react-testing/matchers.js +0 -1
  181. package/node_modules/@shopify/react-testing/matchers.mjs +0 -1
  182. package/node_modules/@shopify/react-testing/package.json +0 -69
  183. package/node_modules/@shopify/ui-extensions-test-utils/CHANGELOG.md +0 -66
  184. package/node_modules/@shopify/ui-extensions-test-utils/dist/index.d.ts +0 -3
  185. package/node_modules/@shopify/ui-extensions-test-utils/dist/index.js +0 -3
  186. package/node_modules/@shopify/ui-extensions-test-utils/dist/render.d.ts +0 -2
  187. package/node_modules/@shopify/ui-extensions-test-utils/dist/render.js +0 -5
  188. package/node_modules/@shopify/ui-extensions-test-utils/dist/renderHook.d.ts +0 -17
  189. package/node_modules/@shopify/ui-extensions-test-utils/dist/renderHook.js +0 -20
  190. package/node_modules/@shopify/ui-extensions-test-utils/dist/withProviders.d.ts +0 -9
  191. package/node_modules/@shopify/ui-extensions-test-utils/dist/withProviders.js +0 -7
  192. package/node_modules/@shopify/ui-extensions-test-utils/package.json +0 -40
  193. package/node_modules/@shopify/ui-extensions-test-utils/project.json +0 -39
  194. package/node_modules/@vitejs/plugin-react-refresh/README.md +0 -73
  195. package/node_modules/@vitejs/plugin-react-refresh/index.d.ts +0 -14
  196. package/node_modules/@vitejs/plugin-react-refresh/index.js +0 -239
  197. package/node_modules/@vitejs/plugin-react-refresh/package.json +0 -35
  198. /package/dist/{ExtensionServerClient → packages/ui-extensions-server-kit/src/ExtensionServerClient}/types.cjs.js +0 -0
  199. /package/dist/{ExtensionServerClient → packages/ui-extensions-server-kit/src/ExtensionServerClient}/types.es.js +0 -0
  200. /package/dist/{context → packages/ui-extensions-server-kit/src/context}/constants.es.js +0 -0
  201. /package/dist/{hooks → packages/ui-extensions-server-kit/src/hooks}/useExtensionServerState.cjs.js +0 -0
  202. /package/dist/{hooks → packages/ui-extensions-server-kit/src/hooks}/useExtensionServerState.es.js +0 -0
  203. /package/dist/{hooks → packages/ui-extensions-server-kit/src/hooks}/useIsomorphicLayoutEffect.cjs.js +0 -0
  204. /package/dist/{hooks → packages/ui-extensions-server-kit/src/hooks}/useIsomorphicLayoutEffect.es.js +0 -0
  205. /package/dist/{i18n.cjs.js → packages/ui-extensions-server-kit/src/i18n.cjs.js} +0 -0
  206. /package/dist/{i18n.es.js → packages/ui-extensions-server-kit/src/i18n.es.js} +0 -0
  207. /package/dist/{state → packages/ui-extensions-server-kit/src/state}/actions/actions.cjs.js +0 -0
  208. /package/dist/{state → packages/ui-extensions-server-kit/src/state}/actions/actions.es.js +0 -0
  209. /package/dist/{state → packages/ui-extensions-server-kit/src/state}/reducers/constants.cjs.js +0 -0
  210. /package/dist/{state → packages/ui-extensions-server-kit/src/state}/reducers/constants.es.js +0 -0
  211. /package/dist/{state → packages/ui-extensions-server-kit/src/state}/reducers/extensionServerReducer.cjs.js +0 -0
  212. /package/dist/{state → packages/ui-extensions-server-kit/src/state}/reducers/extensionServerReducer.es.js +0 -0
  213. /package/dist/{testing → packages/ui-extensions-server-kit/src/testing}/app.cjs.js +0 -0
  214. /package/dist/{testing → packages/ui-extensions-server-kit/src/testing}/app.es.js +0 -0
  215. /package/dist/{testing → packages/ui-extensions-server-kit/src/testing}/extensions.cjs.js +0 -0
  216. /package/dist/{testing → packages/ui-extensions-server-kit/src/testing}/extensions.es.js +0 -0
  217. /package/dist/{types.cjs.js → packages/ui-extensions-server-kit/src/types.cjs.js} +0 -0
  218. /package/dist/{types.es.js → packages/ui-extensions-server-kit/src/types.es.js} +0 -0
  219. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/assetToString.cjs.js +0 -0
  220. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/assetToString.es.js +0 -0
  221. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/noop.cjs.js +0 -0
  222. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/noop.es.js +0 -0
  223. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/replaceUpdated.cjs.js +0 -0
  224. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/replaceUpdated.es.js +0 -0
  225. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/set.cjs.js +0 -0
  226. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/set.es.js +0 -0
  227. /package/node_modules/@vitejs/{plugin-react-refresh → plugin-react}/LICENSE +0 -0
@@ -0,0 +1,502 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom'), require('react-dom/client'), require('@testing-library/dom'), require('react-dom/test-utils')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom', 'react-dom/client', '@testing-library/dom', 'react-dom/test-utils'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TestingLibraryReact = {}, global.React, global.ReactDOM, global.ReactDOMClient, global.dom, global.ReactTestUtils));
5
+ })(this, (function (exports, React, ReactDOM, ReactDOMClient, dom, DeprecatedReactTestUtils) { 'use strict';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n["default"] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
+ var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
29
+ var ReactDOMClient__namespace = /*#__PURE__*/_interopNamespace(ReactDOMClient);
30
+ var DeprecatedReactTestUtils__namespace = /*#__PURE__*/_interopNamespace(DeprecatedReactTestUtils);
31
+
32
+ const reactAct = typeof React__namespace.act === 'function' ? React__namespace.act : DeprecatedReactTestUtils__namespace.act;
33
+ function getGlobalThis() {
34
+ /* istanbul ignore else */
35
+ if (typeof globalThis !== 'undefined') {
36
+ return globalThis;
37
+ }
38
+ /* istanbul ignore next */
39
+ if (typeof self !== 'undefined') {
40
+ return self;
41
+ }
42
+ /* istanbul ignore next */
43
+ if (typeof window !== 'undefined') {
44
+ return window;
45
+ }
46
+ /* istanbul ignore next */
47
+ if (typeof global !== 'undefined') {
48
+ return global;
49
+ }
50
+ /* istanbul ignore next */
51
+ throw new Error('unable to locate global object');
52
+ }
53
+ function setIsReactActEnvironment(isReactActEnvironment) {
54
+ getGlobalThis().IS_REACT_ACT_ENVIRONMENT = isReactActEnvironment;
55
+ }
56
+ function getIsReactActEnvironment() {
57
+ return getGlobalThis().IS_REACT_ACT_ENVIRONMENT;
58
+ }
59
+ function withGlobalActEnvironment(actImplementation) {
60
+ return callback => {
61
+ const previousActEnvironment = getIsReactActEnvironment();
62
+ setIsReactActEnvironment(true);
63
+ try {
64
+ // The return value of `act` is always a thenable.
65
+ let callbackNeedsToBeAwaited = false;
66
+ const actResult = actImplementation(() => {
67
+ const result = callback();
68
+ if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
69
+ callbackNeedsToBeAwaited = true;
70
+ }
71
+ return result;
72
+ });
73
+ if (callbackNeedsToBeAwaited) {
74
+ const thenable = actResult;
75
+ return {
76
+ then: (resolve, reject) => {
77
+ thenable.then(returnValue => {
78
+ setIsReactActEnvironment(previousActEnvironment);
79
+ resolve(returnValue);
80
+ }, error => {
81
+ setIsReactActEnvironment(previousActEnvironment);
82
+ reject(error);
83
+ });
84
+ }
85
+ };
86
+ } else {
87
+ setIsReactActEnvironment(previousActEnvironment);
88
+ return actResult;
89
+ }
90
+ } catch (error) {
91
+ // Can't be a `finally {}` block since we don't know if we have to immediately restore IS_REACT_ACT_ENVIRONMENT
92
+ // or if we have to await the callback first.
93
+ setIsReactActEnvironment(previousActEnvironment);
94
+ throw error;
95
+ }
96
+ };
97
+ }
98
+ const act = withGlobalActEnvironment(reactAct);
99
+
100
+ /* eslint no-console:0 */
101
+
102
+ // react-testing-library's version of fireEvent will call
103
+ // dom-testing-library's version of fireEvent. The reason
104
+ // we make this distinction however is because we have
105
+ // a few extra events that work a bit differently
106
+ const fireEvent = (...args) => dom.fireEvent(...args);
107
+ Object.keys(dom.fireEvent).forEach(key => {
108
+ fireEvent[key] = (...args) => dom.fireEvent[key](...args);
109
+ });
110
+
111
+ // React event system tracks native mouseOver/mouseOut events for
112
+ // running onMouseEnter/onMouseLeave handlers
113
+ // @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/EnterLeaveEventPlugin.js#L24-L31
114
+ const mouseEnter = fireEvent.mouseEnter;
115
+ const mouseLeave = fireEvent.mouseLeave;
116
+ fireEvent.mouseEnter = (...args) => {
117
+ mouseEnter(...args);
118
+ return fireEvent.mouseOver(...args);
119
+ };
120
+ fireEvent.mouseLeave = (...args) => {
121
+ mouseLeave(...args);
122
+ return fireEvent.mouseOut(...args);
123
+ };
124
+ const pointerEnter = fireEvent.pointerEnter;
125
+ const pointerLeave = fireEvent.pointerLeave;
126
+ fireEvent.pointerEnter = (...args) => {
127
+ pointerEnter(...args);
128
+ return fireEvent.pointerOver(...args);
129
+ };
130
+ fireEvent.pointerLeave = (...args) => {
131
+ pointerLeave(...args);
132
+ return fireEvent.pointerOut(...args);
133
+ };
134
+ const select = fireEvent.select;
135
+ fireEvent.select = (node, init) => {
136
+ select(node, init);
137
+ // React tracks this event only on focused inputs
138
+ node.focus();
139
+
140
+ // React creates this event when one of the following native events happens
141
+ // - contextMenu
142
+ // - mouseUp
143
+ // - dragEnd
144
+ // - keyUp
145
+ // - keyDown
146
+ // so we can use any here
147
+ // @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/SelectEventPlugin.js#L203-L224
148
+ fireEvent.keyUp(node, init);
149
+ };
150
+
151
+ // React event system tracks native focusout/focusin events for
152
+ // running blur/focus handlers
153
+ // @link https://github.com/facebook/react/pull/19186
154
+ const blur = fireEvent.blur;
155
+ const focus = fireEvent.focus;
156
+ fireEvent.blur = (...args) => {
157
+ fireEvent.focusOut(...args);
158
+ return blur(...args);
159
+ };
160
+ fireEvent.focus = (...args) => {
161
+ fireEvent.focusIn(...args);
162
+ return focus(...args);
163
+ };
164
+
165
+ let configForRTL = {
166
+ reactStrictMode: false
167
+ };
168
+ function getConfig() {
169
+ return {
170
+ ...dom.getConfig(),
171
+ ...configForRTL
172
+ };
173
+ }
174
+ function configure(newConfig) {
175
+ if (typeof newConfig === 'function') {
176
+ // Pass the existing config out to the provided function
177
+ // and accept a delta in return
178
+ newConfig = newConfig(getConfig());
179
+ }
180
+ const {
181
+ reactStrictMode,
182
+ ...configForDTL
183
+ } = newConfig;
184
+ dom.configure(configForDTL);
185
+ configForRTL = {
186
+ ...configForRTL,
187
+ reactStrictMode
188
+ };
189
+ }
190
+
191
+ function jestFakeTimersAreEnabled() {
192
+ /* istanbul ignore else */
193
+ if (typeof jest !== 'undefined' && jest !== null) {
194
+ return (
195
+ // legacy timers
196
+ setTimeout._isMockFunction === true ||
197
+ // modern timers
198
+ // eslint-disable-next-line prefer-object-has-own -- No Object.hasOwn in all target environments we support.
199
+ Object.prototype.hasOwnProperty.call(setTimeout, 'clock')
200
+ );
201
+ } // istanbul ignore next
202
+
203
+ return false;
204
+ }
205
+ dom.configure({
206
+ unstable_advanceTimersWrapper: cb => {
207
+ return act(cb);
208
+ },
209
+ // We just want to run `waitFor` without IS_REACT_ACT_ENVIRONMENT
210
+ // But that's not necessarily how `asyncWrapper` is used since it's a public method.
211
+ // Let's just hope nobody else is using it.
212
+ asyncWrapper: async cb => {
213
+ const previousActEnvironment = getIsReactActEnvironment();
214
+ setIsReactActEnvironment(false);
215
+ try {
216
+ const result = await cb();
217
+ // Drain microtask queue.
218
+ // Otherwise we'll restore the previous act() environment, before we resolve the `waitFor` call.
219
+ // The caller would have no chance to wrap the in-flight Promises in `act()`
220
+ await new Promise(resolve => {
221
+ setTimeout(() => {
222
+ resolve();
223
+ }, 0);
224
+ if (jestFakeTimersAreEnabled()) {
225
+ jest.advanceTimersByTime(0);
226
+ }
227
+ });
228
+ return result;
229
+ } finally {
230
+ setIsReactActEnvironment(previousActEnvironment);
231
+ }
232
+ },
233
+ eventWrapper: cb => {
234
+ let result;
235
+ act(() => {
236
+ result = cb();
237
+ });
238
+ return result;
239
+ }
240
+ });
241
+
242
+ // Ideally we'd just use a WeakMap where containers are keys and roots are values.
243
+ // We use two variables so that we can bail out in constant time when we render with a new container (most common use case)
244
+ /**
245
+ * @type {Set<import('react-dom').Container>}
246
+ */
247
+ const mountedContainers = new Set();
248
+ /**
249
+ * @type Array<{container: import('react-dom').Container, root: ReturnType<typeof createConcurrentRoot>}>
250
+ */
251
+ const mountedRootEntries = [];
252
+ function strictModeIfNeeded(innerElement, reactStrictMode) {
253
+ return reactStrictMode ?? getConfig().reactStrictMode ? /*#__PURE__*/React__namespace.createElement(React__namespace.StrictMode, null, innerElement) : innerElement;
254
+ }
255
+ function wrapUiIfNeeded(innerElement, wrapperComponent) {
256
+ return wrapperComponent ? /*#__PURE__*/React__namespace.createElement(wrapperComponent, null, innerElement) : innerElement;
257
+ }
258
+ function createConcurrentRoot(container, {
259
+ hydrate,
260
+ onCaughtError,
261
+ onRecoverableError,
262
+ ui,
263
+ wrapper: WrapperComponent,
264
+ reactStrictMode
265
+ }) {
266
+ let root;
267
+ if (hydrate) {
268
+ act(() => {
269
+ root = ReactDOMClient__namespace.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent), reactStrictMode), {
270
+ onCaughtError,
271
+ onRecoverableError
272
+ });
273
+ });
274
+ } else {
275
+ root = ReactDOMClient__namespace.createRoot(container, {
276
+ onCaughtError,
277
+ onRecoverableError
278
+ });
279
+ }
280
+ return {
281
+ hydrate() {
282
+ /* istanbul ignore if */
283
+ if (!hydrate) {
284
+ throw new Error('Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.');
285
+ }
286
+ // Nothing to do since hydration happens when creating the root object.
287
+ },
288
+ render(element) {
289
+ root.render(element);
290
+ },
291
+ unmount() {
292
+ root.unmount();
293
+ }
294
+ };
295
+ }
296
+ function createLegacyRoot(container) {
297
+ return {
298
+ hydrate(element) {
299
+ ReactDOM__default["default"].hydrate(element, container);
300
+ },
301
+ render(element) {
302
+ ReactDOM__default["default"].render(element, container);
303
+ },
304
+ unmount() {
305
+ ReactDOM__default["default"].unmountComponentAtNode(container);
306
+ }
307
+ };
308
+ }
309
+ function renderRoot(ui, {
310
+ baseElement,
311
+ container,
312
+ hydrate,
313
+ queries,
314
+ root,
315
+ wrapper: WrapperComponent,
316
+ reactStrictMode
317
+ }) {
318
+ act(() => {
319
+ if (hydrate) {
320
+ root.hydrate(strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent), reactStrictMode), container);
321
+ } else {
322
+ root.render(strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent), reactStrictMode), container);
323
+ }
324
+ });
325
+ return {
326
+ container,
327
+ baseElement,
328
+ debug: (el = baseElement, maxLength, options) => Array.isArray(el) ?
329
+ // eslint-disable-next-line no-console
330
+ el.forEach(e => console.log(dom.prettyDOM(e, maxLength, options))) :
331
+ // eslint-disable-next-line no-console,
332
+ console.log(dom.prettyDOM(el, maxLength, options)),
333
+ unmount: () => {
334
+ act(() => {
335
+ root.unmount();
336
+ });
337
+ },
338
+ rerender: rerenderUi => {
339
+ renderRoot(rerenderUi, {
340
+ container,
341
+ baseElement,
342
+ root,
343
+ wrapper: WrapperComponent,
344
+ reactStrictMode
345
+ });
346
+ // Intentionally do not return anything to avoid unnecessarily complicating the API.
347
+ // folks can use all the same utilities we return in the first place that are bound to the container
348
+ },
349
+ asFragment: () => {
350
+ /* istanbul ignore else (old jsdom limitation) */
351
+ if (typeof document.createRange === 'function') {
352
+ return document.createRange().createContextualFragment(container.innerHTML);
353
+ } else {
354
+ const template = document.createElement('template');
355
+ template.innerHTML = container.innerHTML;
356
+ return template.content;
357
+ }
358
+ },
359
+ ...dom.getQueriesForElement(baseElement, queries)
360
+ };
361
+ }
362
+ function render(ui, {
363
+ container,
364
+ baseElement = container,
365
+ legacyRoot = false,
366
+ onCaughtError,
367
+ onUncaughtError,
368
+ onRecoverableError,
369
+ queries,
370
+ hydrate = false,
371
+ wrapper,
372
+ reactStrictMode
373
+ } = {}) {
374
+ if (onUncaughtError !== undefined) {
375
+ throw new Error('onUncaughtError is not supported. The `render` call will already throw on uncaught errors.');
376
+ }
377
+ if (legacyRoot && typeof ReactDOM__default["default"].render !== 'function') {
378
+ const error = new Error('`legacyRoot: true` is not supported in this version of React. ' + 'If your app runs React 19 or later, you should remove this flag. ' + 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.');
379
+ Error.captureStackTrace(error, render);
380
+ throw error;
381
+ }
382
+ if (!baseElement) {
383
+ // default to document.body instead of documentElement to avoid output of potentially-large
384
+ // head elements (such as JSS style blocks) in debug output
385
+ baseElement = document.body;
386
+ }
387
+ if (!container) {
388
+ container = baseElement.appendChild(document.createElement('div'));
389
+ }
390
+ let root;
391
+ // eslint-disable-next-line no-negated-condition -- we want to map the evolution of this over time. The root is created first. Only later is it re-used so we don't want to read the case that happens later first.
392
+ if (!mountedContainers.has(container)) {
393
+ const createRootImpl = legacyRoot ? createLegacyRoot : createConcurrentRoot;
394
+ root = createRootImpl(container, {
395
+ hydrate,
396
+ onCaughtError,
397
+ onRecoverableError,
398
+ ui,
399
+ wrapper,
400
+ reactStrictMode
401
+ });
402
+ mountedRootEntries.push({
403
+ container,
404
+ root
405
+ });
406
+ // we'll add it to the mounted containers regardless of whether it's actually
407
+ // added to document.body so the cleanup method works regardless of whether
408
+ // they're passing us a custom container or not.
409
+ mountedContainers.add(container);
410
+ } else {
411
+ mountedRootEntries.forEach(rootEntry => {
412
+ // Else is unreachable since `mountedContainers` has the `container`.
413
+ // Only reachable if one would accidentally add the container to `mountedContainers` but not the root to `mountedRootEntries`
414
+ /* istanbul ignore else */
415
+ if (rootEntry.container === container) {
416
+ root = rootEntry.root;
417
+ }
418
+ });
419
+ }
420
+ return renderRoot(ui, {
421
+ container,
422
+ baseElement,
423
+ queries,
424
+ hydrate,
425
+ wrapper,
426
+ root,
427
+ reactStrictMode
428
+ });
429
+ }
430
+ function cleanup() {
431
+ mountedRootEntries.forEach(({
432
+ root,
433
+ container
434
+ }) => {
435
+ act(() => {
436
+ root.unmount();
437
+ });
438
+ if (container.parentNode === document.body) {
439
+ document.body.removeChild(container);
440
+ }
441
+ });
442
+ mountedRootEntries.length = 0;
443
+ mountedContainers.clear();
444
+ }
445
+ function renderHook(renderCallback, options = {}) {
446
+ const {
447
+ initialProps,
448
+ ...renderOptions
449
+ } = options;
450
+ if (renderOptions.legacyRoot && typeof ReactDOM__default["default"].render !== 'function') {
451
+ const error = new Error('`legacyRoot: true` is not supported in this version of React. ' + 'If your app runs React 19 or later, you should remove this flag. ' + 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.');
452
+ Error.captureStackTrace(error, renderHook);
453
+ throw error;
454
+ }
455
+ const result = /*#__PURE__*/React__namespace.createRef();
456
+ function TestComponent({
457
+ renderCallbackProps
458
+ }) {
459
+ const pendingResult = renderCallback(renderCallbackProps);
460
+ React__namespace.useEffect(() => {
461
+ result.current = pendingResult;
462
+ });
463
+ return null;
464
+ }
465
+ const {
466
+ rerender: baseRerender,
467
+ unmount
468
+ } = render(/*#__PURE__*/React__namespace.createElement(TestComponent, {
469
+ renderCallbackProps: initialProps
470
+ }), renderOptions);
471
+ function rerender(rerenderCallbackProps) {
472
+ return baseRerender(/*#__PURE__*/React__namespace.createElement(TestComponent, {
473
+ renderCallbackProps: rerenderCallbackProps
474
+ }));
475
+ }
476
+ return {
477
+ result,
478
+ rerender,
479
+ unmount
480
+ };
481
+ }
482
+
483
+ /* eslint func-name-matching:0 */
484
+
485
+ exports.act = act;
486
+ exports.cleanup = cleanup;
487
+ exports.configure = configure;
488
+ exports.fireEvent = fireEvent;
489
+ exports.getConfig = getConfig;
490
+ exports.render = render;
491
+ exports.renderHook = renderHook;
492
+ Object.keys(dom).forEach(function (k) {
493
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
494
+ enumerable: true,
495
+ get: function () { return dom[k]; }
496
+ });
497
+ });
498
+
499
+ Object.defineProperty(exports, '__esModule', { value: true });
500
+
501
+ }));
502
+ //# sourceMappingURL=react.pure.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.pure.umd.js","sources":["../../src/act-compat.js","../../src/fire-event.js","../../src/config.js","../../src/pure.js"],"sourcesContent":["import * as React from 'react'\nimport * as DeprecatedReactTestUtils from 'react-dom/test-utils'\n\nconst reactAct =\n typeof React.act === 'function' ? React.act : DeprecatedReactTestUtils.act\n\nfunction getGlobalThis() {\n /* istanbul ignore else */\n if (typeof globalThis !== 'undefined') {\n return globalThis\n }\n /* istanbul ignore next */\n if (typeof self !== 'undefined') {\n return self\n }\n /* istanbul ignore next */\n if (typeof window !== 'undefined') {\n return window\n }\n /* istanbul ignore next */\n if (typeof global !== 'undefined') {\n return global\n }\n /* istanbul ignore next */\n throw new Error('unable to locate global object')\n}\n\nfunction setIsReactActEnvironment(isReactActEnvironment) {\n getGlobalThis().IS_REACT_ACT_ENVIRONMENT = isReactActEnvironment\n}\n\nfunction getIsReactActEnvironment() {\n return getGlobalThis().IS_REACT_ACT_ENVIRONMENT\n}\n\nfunction withGlobalActEnvironment(actImplementation) {\n return callback => {\n const previousActEnvironment = getIsReactActEnvironment()\n setIsReactActEnvironment(true)\n try {\n // The return value of `act` is always a thenable.\n let callbackNeedsToBeAwaited = false\n const actResult = actImplementation(() => {\n const result = callback()\n if (\n result !== null &&\n typeof result === 'object' &&\n typeof result.then === 'function'\n ) {\n callbackNeedsToBeAwaited = true\n }\n return result\n })\n if (callbackNeedsToBeAwaited) {\n const thenable = actResult\n return {\n then: (resolve, reject) => {\n thenable.then(\n returnValue => {\n setIsReactActEnvironment(previousActEnvironment)\n resolve(returnValue)\n },\n error => {\n setIsReactActEnvironment(previousActEnvironment)\n reject(error)\n },\n )\n },\n }\n } else {\n setIsReactActEnvironment(previousActEnvironment)\n return actResult\n }\n } catch (error) {\n // Can't be a `finally {}` block since we don't know if we have to immediately restore IS_REACT_ACT_ENVIRONMENT\n // or if we have to await the callback first.\n setIsReactActEnvironment(previousActEnvironment)\n throw error\n }\n }\n}\n\nconst act = withGlobalActEnvironment(reactAct)\n\nexport default act\nexport {\n setIsReactActEnvironment as setReactActEnvironment,\n getIsReactActEnvironment,\n}\n\n/* eslint no-console:0 */\n","import {fireEvent as dtlFireEvent} from '@testing-library/dom'\n\n// react-testing-library's version of fireEvent will call\n// dom-testing-library's version of fireEvent. The reason\n// we make this distinction however is because we have\n// a few extra events that work a bit differently\nconst fireEvent = (...args) => dtlFireEvent(...args)\n\nObject.keys(dtlFireEvent).forEach(key => {\n fireEvent[key] = (...args) => dtlFireEvent[key](...args)\n})\n\n// React event system tracks native mouseOver/mouseOut events for\n// running onMouseEnter/onMouseLeave handlers\n// @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/EnterLeaveEventPlugin.js#L24-L31\nconst mouseEnter = fireEvent.mouseEnter\nconst mouseLeave = fireEvent.mouseLeave\nfireEvent.mouseEnter = (...args) => {\n mouseEnter(...args)\n return fireEvent.mouseOver(...args)\n}\nfireEvent.mouseLeave = (...args) => {\n mouseLeave(...args)\n return fireEvent.mouseOut(...args)\n}\n\nconst pointerEnter = fireEvent.pointerEnter\nconst pointerLeave = fireEvent.pointerLeave\nfireEvent.pointerEnter = (...args) => {\n pointerEnter(...args)\n return fireEvent.pointerOver(...args)\n}\nfireEvent.pointerLeave = (...args) => {\n pointerLeave(...args)\n return fireEvent.pointerOut(...args)\n}\n\nconst select = fireEvent.select\nfireEvent.select = (node, init) => {\n select(node, init)\n // React tracks this event only on focused inputs\n node.focus()\n\n // React creates this event when one of the following native events happens\n // - contextMenu\n // - mouseUp\n // - dragEnd\n // - keyUp\n // - keyDown\n // so we can use any here\n // @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/SelectEventPlugin.js#L203-L224\n fireEvent.keyUp(node, init)\n}\n\n// React event system tracks native focusout/focusin events for\n// running blur/focus handlers\n// @link https://github.com/facebook/react/pull/19186\nconst blur = fireEvent.blur\nconst focus = fireEvent.focus\nfireEvent.blur = (...args) => {\n fireEvent.focusOut(...args)\n return blur(...args)\n}\nfireEvent.focus = (...args) => {\n fireEvent.focusIn(...args)\n return focus(...args)\n}\n\nexport {fireEvent}\n","import {\n getConfig as getConfigDTL,\n configure as configureDTL,\n} from '@testing-library/dom'\n\nlet configForRTL = {\n reactStrictMode: false,\n}\n\nfunction getConfig() {\n return {\n ...getConfigDTL(),\n ...configForRTL,\n }\n}\n\nfunction configure(newConfig) {\n if (typeof newConfig === 'function') {\n // Pass the existing config out to the provided function\n // and accept a delta in return\n newConfig = newConfig(getConfig())\n }\n\n const {reactStrictMode, ...configForDTL} = newConfig\n\n configureDTL(configForDTL)\n\n configForRTL = {\n ...configForRTL,\n reactStrictMode,\n }\n}\n\nexport {getConfig, configure}\n","import * as React from 'react'\nimport ReactDOM from 'react-dom'\nimport * as ReactDOMClient from 'react-dom/client'\nimport {\n getQueriesForElement,\n prettyDOM,\n configure as configureDTL,\n} from '@testing-library/dom'\nimport act, {\n getIsReactActEnvironment,\n setReactActEnvironment,\n} from './act-compat'\nimport {fireEvent} from './fire-event'\nimport {getConfig, configure} from './config'\n\nfunction jestFakeTimersAreEnabled() {\n /* istanbul ignore else */\n if (typeof jest !== 'undefined' && jest !== null) {\n return (\n // legacy timers\n setTimeout._isMockFunction === true || // modern timers\n // eslint-disable-next-line prefer-object-has-own -- No Object.hasOwn in all target environments we support.\n Object.prototype.hasOwnProperty.call(setTimeout, 'clock')\n )\n } // istanbul ignore next\n\n return false\n}\n\nconfigureDTL({\n unstable_advanceTimersWrapper: cb => {\n return act(cb)\n },\n // We just want to run `waitFor` without IS_REACT_ACT_ENVIRONMENT\n // But that's not necessarily how `asyncWrapper` is used since it's a public method.\n // Let's just hope nobody else is using it.\n asyncWrapper: async cb => {\n const previousActEnvironment = getIsReactActEnvironment()\n setReactActEnvironment(false)\n try {\n const result = await cb()\n // Drain microtask queue.\n // Otherwise we'll restore the previous act() environment, before we resolve the `waitFor` call.\n // The caller would have no chance to wrap the in-flight Promises in `act()`\n await new Promise(resolve => {\n setTimeout(() => {\n resolve()\n }, 0)\n\n if (jestFakeTimersAreEnabled()) {\n jest.advanceTimersByTime(0)\n }\n })\n\n return result\n } finally {\n setReactActEnvironment(previousActEnvironment)\n }\n },\n eventWrapper: cb => {\n let result\n act(() => {\n result = cb()\n })\n return result\n },\n})\n\n// Ideally we'd just use a WeakMap where containers are keys and roots are values.\n// We use two variables so that we can bail out in constant time when we render with a new container (most common use case)\n/**\n * @type {Set<import('react-dom').Container>}\n */\nconst mountedContainers = new Set()\n/**\n * @type Array<{container: import('react-dom').Container, root: ReturnType<typeof createConcurrentRoot>}>\n */\nconst mountedRootEntries = []\n\nfunction strictModeIfNeeded(innerElement, reactStrictMode) {\n return reactStrictMode ?? getConfig().reactStrictMode\n ? React.createElement(React.StrictMode, null, innerElement)\n : innerElement\n}\n\nfunction wrapUiIfNeeded(innerElement, wrapperComponent) {\n return wrapperComponent\n ? React.createElement(wrapperComponent, null, innerElement)\n : innerElement\n}\n\nfunction createConcurrentRoot(\n container,\n {\n hydrate,\n onCaughtError,\n onRecoverableError,\n ui,\n wrapper: WrapperComponent,\n reactStrictMode,\n },\n) {\n let root\n if (hydrate) {\n act(() => {\n root = ReactDOMClient.hydrateRoot(\n container,\n strictModeIfNeeded(\n wrapUiIfNeeded(ui, WrapperComponent),\n reactStrictMode,\n ),\n {onCaughtError, onRecoverableError},\n )\n })\n } else {\n root = ReactDOMClient.createRoot(container, {\n onCaughtError,\n onRecoverableError,\n })\n }\n\n return {\n hydrate() {\n /* istanbul ignore if */\n if (!hydrate) {\n throw new Error(\n 'Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.',\n )\n }\n // Nothing to do since hydration happens when creating the root object.\n },\n render(element) {\n root.render(element)\n },\n unmount() {\n root.unmount()\n },\n }\n}\n\nfunction createLegacyRoot(container) {\n return {\n hydrate(element) {\n ReactDOM.hydrate(element, container)\n },\n render(element) {\n ReactDOM.render(element, container)\n },\n unmount() {\n ReactDOM.unmountComponentAtNode(container)\n },\n }\n}\n\nfunction renderRoot(\n ui,\n {\n baseElement,\n container,\n hydrate,\n queries,\n root,\n wrapper: WrapperComponent,\n reactStrictMode,\n },\n) {\n act(() => {\n if (hydrate) {\n root.hydrate(\n strictModeIfNeeded(\n wrapUiIfNeeded(ui, WrapperComponent),\n reactStrictMode,\n ),\n container,\n )\n } else {\n root.render(\n strictModeIfNeeded(\n wrapUiIfNeeded(ui, WrapperComponent),\n reactStrictMode,\n ),\n container,\n )\n }\n })\n\n return {\n container,\n baseElement,\n debug: (el = baseElement, maxLength, options) =>\n Array.isArray(el)\n ? // eslint-disable-next-line no-console\n el.forEach(e => console.log(prettyDOM(e, maxLength, options)))\n : // eslint-disable-next-line no-console,\n console.log(prettyDOM(el, maxLength, options)),\n unmount: () => {\n act(() => {\n root.unmount()\n })\n },\n rerender: rerenderUi => {\n renderRoot(rerenderUi, {\n container,\n baseElement,\n root,\n wrapper: WrapperComponent,\n reactStrictMode,\n })\n // Intentionally do not return anything to avoid unnecessarily complicating the API.\n // folks can use all the same utilities we return in the first place that are bound to the container\n },\n asFragment: () => {\n /* istanbul ignore else (old jsdom limitation) */\n if (typeof document.createRange === 'function') {\n return document\n .createRange()\n .createContextualFragment(container.innerHTML)\n } else {\n const template = document.createElement('template')\n template.innerHTML = container.innerHTML\n return template.content\n }\n },\n ...getQueriesForElement(baseElement, queries),\n }\n}\n\nfunction render(\n ui,\n {\n container,\n baseElement = container,\n legacyRoot = false,\n onCaughtError,\n onUncaughtError,\n onRecoverableError,\n queries,\n hydrate = false,\n wrapper,\n reactStrictMode,\n } = {},\n) {\n if (onUncaughtError !== undefined) {\n throw new Error(\n 'onUncaughtError is not supported. The `render` call will already throw on uncaught errors.',\n )\n }\n if (legacyRoot && typeof ReactDOM.render !== 'function') {\n const error = new Error(\n '`legacyRoot: true` is not supported in this version of React. ' +\n 'If your app runs React 19 or later, you should remove this flag. ' +\n 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.',\n )\n Error.captureStackTrace(error, render)\n throw error\n }\n\n if (!baseElement) {\n // default to document.body instead of documentElement to avoid output of potentially-large\n // head elements (such as JSS style blocks) in debug output\n baseElement = document.body\n }\n if (!container) {\n container = baseElement.appendChild(document.createElement('div'))\n }\n\n let root\n // eslint-disable-next-line no-negated-condition -- we want to map the evolution of this over time. The root is created first. Only later is it re-used so we don't want to read the case that happens later first.\n if (!mountedContainers.has(container)) {\n const createRootImpl = legacyRoot ? createLegacyRoot : createConcurrentRoot\n root = createRootImpl(container, {\n hydrate,\n onCaughtError,\n onRecoverableError,\n ui,\n wrapper,\n reactStrictMode,\n })\n\n mountedRootEntries.push({container, root})\n // we'll add it to the mounted containers regardless of whether it's actually\n // added to document.body so the cleanup method works regardless of whether\n // they're passing us a custom container or not.\n mountedContainers.add(container)\n } else {\n mountedRootEntries.forEach(rootEntry => {\n // Else is unreachable since `mountedContainers` has the `container`.\n // Only reachable if one would accidentally add the container to `mountedContainers` but not the root to `mountedRootEntries`\n /* istanbul ignore else */\n if (rootEntry.container === container) {\n root = rootEntry.root\n }\n })\n }\n\n return renderRoot(ui, {\n container,\n baseElement,\n queries,\n hydrate,\n wrapper,\n root,\n reactStrictMode,\n })\n}\n\nfunction cleanup() {\n mountedRootEntries.forEach(({root, container}) => {\n act(() => {\n root.unmount()\n })\n if (container.parentNode === document.body) {\n document.body.removeChild(container)\n }\n })\n mountedRootEntries.length = 0\n mountedContainers.clear()\n}\n\nfunction renderHook(renderCallback, options = {}) {\n const {initialProps, ...renderOptions} = options\n\n if (renderOptions.legacyRoot && typeof ReactDOM.render !== 'function') {\n const error = new Error(\n '`legacyRoot: true` is not supported in this version of React. ' +\n 'If your app runs React 19 or later, you should remove this flag. ' +\n 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.',\n )\n Error.captureStackTrace(error, renderHook)\n throw error\n }\n\n const result = React.createRef()\n\n function TestComponent({renderCallbackProps}) {\n const pendingResult = renderCallback(renderCallbackProps)\n\n React.useEffect(() => {\n result.current = pendingResult\n })\n\n return null\n }\n\n const {rerender: baseRerender, unmount} = render(\n <TestComponent renderCallbackProps={initialProps} />,\n renderOptions,\n )\n\n function rerender(rerenderCallbackProps) {\n return baseRerender(\n <TestComponent renderCallbackProps={rerenderCallbackProps} />,\n )\n }\n\n return {result, rerender, unmount}\n}\n\n// just re-export everything from dom-testing-library\nexport * from '@testing-library/dom'\nexport {render, renderHook, cleanup, act, fireEvent, getConfig, configure}\n\n/* eslint func-name-matching:0 */\n"],"names":["reactAct","React","act","DeprecatedReactTestUtils","getGlobalThis","globalThis","self","window","global","Error","setIsReactActEnvironment","isReactActEnvironment","IS_REACT_ACT_ENVIRONMENT","getIsReactActEnvironment","withGlobalActEnvironment","actImplementation","callback","previousActEnvironment","callbackNeedsToBeAwaited","actResult","result","then","thenable","resolve","reject","returnValue","error","fireEvent","args","dtlFireEvent","Object","keys","forEach","key","mouseEnter","mouseLeave","mouseOver","mouseOut","pointerEnter","pointerLeave","pointerOver","pointerOut","select","node","init","focus","keyUp","blur","focusOut","focusIn","configForRTL","reactStrictMode","getConfig","getConfigDTL","configure","newConfig","configForDTL","configureDTL","jestFakeTimersAreEnabled","jest","setTimeout","_isMockFunction","prototype","hasOwnProperty","call","unstable_advanceTimersWrapper","cb","asyncWrapper","setReactActEnvironment","Promise","advanceTimersByTime","eventWrapper","mountedContainers","Set","mountedRootEntries","strictModeIfNeeded","innerElement","createElement","StrictMode","wrapUiIfNeeded","wrapperComponent","createConcurrentRoot","container","hydrate","onCaughtError","onRecoverableError","ui","wrapper","WrapperComponent","root","ReactDOMClient","hydrateRoot","createRoot","render","element","unmount","createLegacyRoot","ReactDOM","unmountComponentAtNode","renderRoot","baseElement","queries","debug","el","maxLength","options","Array","isArray","e","console","log","prettyDOM","rerender","rerenderUi","asFragment","document","createRange","createContextualFragment","innerHTML","template","content","getQueriesForElement","legacyRoot","onUncaughtError","undefined","captureStackTrace","body","appendChild","has","createRootImpl","push","add","rootEntry","cleanup","parentNode","removeChild","length","clear","renderHook","renderCallback","initialProps","renderOptions","createRef","TestComponent","renderCallbackProps","pendingResult","useEffect","current","baseRerender","rerenderCallbackProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGA,MAAMA,QAAQ,GACZ,OAAOC,gBAAK,CAACC,GAAG,KAAK,UAAU,GAAGD,gBAAK,CAACC,GAAG,GAAGC,mCAAwB,CAACD,GAAG,CAAA;EAE5E,SAASE,aAAaA,GAAG;EACvB;EACA,EAAA,IAAI,OAAOC,UAAU,KAAK,WAAW,EAAE;EACrC,IAAA,OAAOA,UAAU,CAAA;EACnB,GAAA;EACA;EACA,EAAA,IAAI,OAAOC,IAAI,KAAK,WAAW,EAAE;EAC/B,IAAA,OAAOA,IAAI,CAAA;EACb,GAAA;EACA;EACA,EAAA,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;EACjC,IAAA,OAAOA,MAAM,CAAA;EACf,GAAA;EACA;EACA,EAAA,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;EACjC,IAAA,OAAOA,MAAM,CAAA;EACf,GAAA;EACA;EACA,EAAA,MAAM,IAAIC,KAAK,CAAC,gCAAgC,CAAC,CAAA;EACnD,CAAA;EAEA,SAASC,wBAAwBA,CAACC,qBAAqB,EAAE;EACvDP,EAAAA,aAAa,EAAE,CAACQ,wBAAwB,GAAGD,qBAAqB,CAAA;EAClE,CAAA;EAEA,SAASE,wBAAwBA,GAAG;EAClC,EAAA,OAAOT,aAAa,EAAE,CAACQ,wBAAwB,CAAA;EACjD,CAAA;EAEA,SAASE,wBAAwBA,CAACC,iBAAiB,EAAE;EACnD,EAAA,OAAOC,QAAQ,IAAI;EACjB,IAAA,MAAMC,sBAAsB,GAAGJ,wBAAwB,EAAE,CAAA;MACzDH,wBAAwB,CAAC,IAAI,CAAC,CAAA;MAC9B,IAAI;EACF;QACA,IAAIQ,wBAAwB,GAAG,KAAK,CAAA;EACpC,MAAA,MAAMC,SAAS,GAAGJ,iBAAiB,CAAC,MAAM;EACxC,QAAA,MAAMK,MAAM,G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B,IAAAA,OAAAA;KAAQ,CAAA;EACpC,CAAA;;EAMA;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("react-dom/client"),require("@testing-library/dom"),require("react-dom/test-utils")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","react-dom/client","@testing-library/dom","react-dom/test-utils"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TestingLibraryReact={},e.React,e.ReactDOM,e.ReactDOMClient,e.dom,e.ReactTestUtils)}(this,function(e,t,r,n,o,a){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var i=u(t),s=c(r),l=u(n),d=u(a);const f="function"==typeof i.act?i.act:d.act;function p(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}function y(e){p().IS_REACT_ACT_ENVIRONMENT=e}function m(){return p().IS_REACT_ACT_ENVIRONMENT}const h=(g=f,e=>{const t=m();y(!0);try{let r=!1;const n=g(()=>{const t=e();return null!==t&&"object"==typeof t&&"function"==typeof t.then&&(r=!0),t});return r?{then:(e,r)=>{n.then(r=>{y(t),e(r)},e=>{y(t),r(e)})}}:(y(t),n)}catch(e){throw y(t),e}});var g;const b=(...e)=>o.fireEvent(...e);Object.keys(o.fireEvent).forEach(e=>{b[e]=(...t)=>o.fireEvent[e](...t)});const E=b.mouseEnter,v=b.mouseLeave;b.mouseEnter=(...e)=>(E(...e),b.mouseOver(...e)),b.mouseLeave=(...e)=>(v(...e),b.mouseOut(...e));const w=b.pointerEnter,R=b.pointerLeave;b.pointerEnter=(...e)=>(w(...e),b.pointerOver(...e)),b.pointerLeave=(...e)=>(R(...e),b.pointerOut(...e));const T=b.select;b.select=(e,t)=>{T(e,t),e.focus(),b.keyUp(e,t)};const O=b.blur,M=b.focus;b.blur=(...e)=>(b.focusOut(...e),O(...e)),b.focus=(...e)=>(b.focusIn(...e),M(...e));let C={reactStrictMode:!1};function j(){return{...o.getConfig(),...C}}o.configure({unstable_advanceTimersWrapper:e=>h(e),asyncWrapper:async e=>{const t=m();y(!1);try{const t=await e();return await new Promise(e=>{setTimeout(()=>{e()},0),"undefined"==typeof jest||null===jest||!0!==setTimeout._isMockFunction&&!Object.prototype.hasOwnProperty.call(setTimeout,"clock")||jest.advanceTimersByTime(0)}),t}finally{y(t)}},eventWrapper:e=>{let t;return h(()=>{t=e()}),t}});const S=new Set,k=[];function _(e,t){return t??j().reactStrictMode?i.createElement(i.StrictMode,null,e):e}function P(e,t){return t?i.createElement(t,null,e):e}function I(e,{hydrate:t,onCaughtError:r,onRecoverableError:n,ui:o,wrapper:a,reactStrictMode:c}){let u;return t?h(()=>{u=l.hydrateRoot(e,_(P(o,a),c),{onCaughtError:r,onRecoverableError:n})}):u=l.createRoot(e,{onCaughtError:r,onRecoverableError:n}),{hydrate(){if(!t)throw new Error("Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.")},render(e){u.render(e)},unmount(){u.unmount()}}}function q(e){return{hydrate(t){s.default.hydrate(t,e)},render(t){s.default.render(t,e)},unmount(){s.default.unmountComponentAtNode(e)}}}function A(e,{baseElement:t,container:r,hydrate:n,queries:a,root:c,wrapper:u,reactStrictMode:i}){return h(()=>{n?c.hydrate(_(P(e,u),i),r):c.render(_(P(e,u),i),r)}),{container:r,baseElement:t,debug:(e=t,r,n)=>Array.isArray(e)?e.forEach(e=>console.log(o.prettyDOM(e,r,n))):console.log(o.prettyDOM(e,r,n)),unmount:()=>{h(()=>{c.unmount()})},rerender:e=>{A(e,{container:r,baseElement:t,root:c,wrapper:u,reactStrictMode:i})},asFragment:()=>{if("function"==typeof document.createRange)return document.createRange().createContextualFragment(r.innerHTML);{const e=document.createElement("template");return e.innerHTML=r.innerHTML,e.content}},...o.getQueriesForElement(t,a)}}function L(e,{container:t,baseElement:r=t,legacyRoot:n=!1,onCaughtError:o,onUncaughtError:a,onRecoverableError:c,queries:u,hydrate:i=!1,wrapper:l,reactStrictMode:d}={}){if(void 0!==a)throw new Error("onUncaughtError is not supported. The `render` call will already throw on uncaught errors.");if(n&&"function"!=typeof s.default.render){const e=new Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");throw Error.captureStackTrace(e,L),e}let f;if(r||(r=document.body),t||(t=r.appendChild(document.createElement("div"))),S.has(t))k.forEach(e=>{e.container===t&&(f=e.root)});else{f=(n?q:I)(t,{hydrate:i,onCaughtError:o,onRecoverableError:c,ui:e,wrapper:l,reactStrictMode:d}),k.push({container:t,root:f}),S.add(t)}return A(e,{container:t,baseElement:r,queries:u,hydrate:i,wrapper:l,root:f,reactStrictMode:d})}e.act=h,e.cleanup=function(){k.forEach(({root:e,container:t})=>{h(()=>{e.unmount()}),t.parentNode===document.body&&document.body.removeChild(t)}),k.length=0,S.clear()},e.configure=function(e){"function"==typeof e&&(e=e(j()));const{reactStrictMode:t,...r}=e;o.configure(r),C={...C,reactStrictMode:t}},e.fireEvent=b,e.getConfig=j,e.render=L,e.renderHook=function e(t,r={}){const{initialProps:n,...o}=r;if(o.legacyRoot&&"function"!=typeof s.default.render){const t=new Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");throw Error.captureStackTrace(t,e),t}const a=i.createRef();function c({renderCallbackProps:e}){const r=t(e);return i.useEffect(()=>{a.current=r}),null}const{rerender:u,unmount:l}=L(i.createElement(c,{renderCallbackProps:n}),o);return{result:a,rerender:function(e){return u(i.createElement(c,{renderCallbackProps:e}))},unmount:l}},Object.keys(o).forEach(function(t){"default"===t||e.hasOwnProperty(t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})}),Object.defineProperty(e,"__esModule",{value:!0})});
2
+ //# sourceMappingURL=react.pure.umd.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.pure.umd.min.js","sources":["../../src/act-compat.js","../../src/fire-event.js","../../src/config.js","../../src/pure.js"],"sourcesContent":["import * as React from 'react'\nimport * as DeprecatedReactTestUtils from 'react-dom/test-utils'\n\nconst reactAct =\n typeof React.act === 'function' ? React.act : DeprecatedReactTestUtils.act\n\nfunction getGlobalThis() {\n /* istanbul ignore else */\n if (typeof globalThis !== 'undefined') {\n return globalThis\n }\n /* istanbul ignore next */\n if (typeof self !== 'undefined') {\n return self\n }\n /* istanbul ignore next */\n if (typeof window !== 'undefined') {\n return window\n }\n /* istanbul ignore next */\n if (typeof global !== 'undefined') {\n return global\n }\n /* istanbul ignore next */\n throw new Error('unable to locate global object')\n}\n\nfunction setIsReactActEnvironment(isReactActEnvironment) {\n getGlobalThis().IS_REACT_ACT_ENVIRONMENT = isReactActEnvironment\n}\n\nfunction getIsReactActEnvironment() {\n return getGlobalThis().IS_REACT_ACT_ENVIRONMENT\n}\n\nfunction withGlobalActEnvironment(actImplementation) {\n return callback => {\n const previousActEnvironment = getIsReactActEnvironment()\n setIsReactActEnvironment(true)\n try {\n // The return value of `act` is always a thenable.\n let callbackNeedsToBeAwaited = false\n const actResult = actImplementation(() => {\n const result = callback()\n if (\n result !== null &&\n typeof result === 'object' &&\n typeof result.then === 'function'\n ) {\n callbackNeedsToBeAwaited = true\n }\n return result\n })\n if (callbackNeedsToBeAwaited) {\n const thenable = actResult\n return {\n then: (resolve, reject) => {\n thenable.then(\n returnValue => {\n setIsReactActEnvironment(previousActEnvironment)\n resolve(returnValue)\n },\n error => {\n setIsReactActEnvironment(previousActEnvironment)\n reject(error)\n },\n )\n },\n }\n } else {\n setIsReactActEnvironment(previousActEnvironment)\n return actResult\n }\n } catch (error) {\n // Can't be a `finally {}` block since we don't know if we have to immediately restore IS_REACT_ACT_ENVIRONMENT\n // or if we have to await the callback first.\n setIsReactActEnvironment(previousActEnvironment)\n throw error\n }\n }\n}\n\nconst act = withGlobalActEnvironment(reactAct)\n\nexport default act\nexport {\n setIsReactActEnvironment as setReactActEnvironment,\n getIsReactActEnvironment,\n}\n\n/* eslint no-console:0 */\n","import {fireEvent as dtlFireEvent} from '@testing-library/dom'\n\n// react-testing-library's version of fireEvent will call\n// dom-testing-library's version of fireEvent. The reason\n// we make this distinction however is because we have\n// a few extra events that work a bit differently\nconst fireEvent = (...args) => dtlFireEvent(...args)\n\nObject.keys(dtlFireEvent).forEach(key => {\n fireEvent[key] = (...args) => dtlFireEvent[key](...args)\n})\n\n// React event system tracks native mouseOver/mouseOut events for\n// running onMouseEnter/onMouseLeave handlers\n// @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/EnterLeaveEventPlugin.js#L24-L31\nconst mouseEnter = fireEvent.mouseEnter\nconst mouseLeave = fireEvent.mouseLeave\nfireEvent.mouseEnter = (...args) => {\n mouseEnter(...args)\n return fireEvent.mouseOver(...args)\n}\nfireEvent.mouseLeave = (...args) => {\n mouseLeave(...args)\n return fireEvent.mouseOut(...args)\n}\n\nconst pointerEnter = fireEvent.pointerEnter\nconst pointerLeave = fireEvent.pointerLeave\nfireEvent.pointerEnter = (...args) => {\n pointerEnter(...args)\n return fireEvent.pointerOver(...args)\n}\nfireEvent.pointerLeave = (...args) => {\n pointerLeave(...args)\n return fireEvent.pointerOut(...args)\n}\n\nconst select = fireEvent.select\nfireEvent.select = (node, init) => {\n select(node, init)\n // React tracks this event only on focused inputs\n node.focus()\n\n // React creates this event when one of the following native events happens\n // - contextMenu\n // - mouseUp\n // - dragEnd\n // - keyUp\n // - keyDown\n // so we can use any here\n // @link https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/events/SelectEventPlugin.js#L203-L224\n fireEvent.keyUp(node, init)\n}\n\n// React event system tracks native focusout/focusin events for\n// running blur/focus handlers\n// @link https://github.com/facebook/react/pull/19186\nconst blur = fireEvent.blur\nconst focus = fireEvent.focus\nfireEvent.blur = (...args) => {\n fireEvent.focusOut(...args)\n return blur(...args)\n}\nfireEvent.focus = (...args) => {\n fireEvent.focusIn(...args)\n return focus(...args)\n}\n\nexport {fireEvent}\n","import {\n getConfig as getConfigDTL,\n configure as configureDTL,\n} from '@testing-library/dom'\n\nlet configForRTL = {\n reactStrictMode: false,\n}\n\nfunction getConfig() {\n return {\n ...getConfigDTL(),\n ...configForRTL,\n }\n}\n\nfunction configure(newConfig) {\n if (typeof newConfig === 'function') {\n // Pass the existing config out to the provided function\n // and accept a delta in return\n newConfig = newConfig(getConfig())\n }\n\n const {reactStrictMode, ...configForDTL} = newConfig\n\n configureDTL(configForDTL)\n\n configForRTL = {\n ...configForRTL,\n reactStrictMode,\n }\n}\n\nexport {getConfig, configure}\n","import * as React from 'react'\nimport ReactDOM from 'react-dom'\nimport * as ReactDOMClient from 'react-dom/client'\nimport {\n getQueriesForElement,\n prettyDOM,\n configure as configureDTL,\n} from '@testing-library/dom'\nimport act, {\n getIsReactActEnvironment,\n setReactActEnvironment,\n} from './act-compat'\nimport {fireEvent} from './fire-event'\nimport {getConfig, configure} from './config'\n\nfunction jestFakeTimersAreEnabled() {\n /* istanbul ignore else */\n if (typeof jest !== 'undefined' && jest !== null) {\n return (\n // legacy timers\n setTimeout._isMockFunction === true || // modern timers\n // eslint-disable-next-line prefer-object-has-own -- No Object.hasOwn in all target environments we support.\n Object.prototype.hasOwnProperty.call(setTimeout, 'clock')\n )\n } // istanbul ignore next\n\n return false\n}\n\nconfigureDTL({\n unstable_advanceTimersWrapper: cb => {\n return act(cb)\n },\n // We just want to run `waitFor` without IS_REACT_ACT_ENVIRONMENT\n // But that's not necessarily how `asyncWrapper` is used since it's a public method.\n // Let's just hope nobody else is using it.\n asyncWrapper: async cb => {\n const previousActEnvironment = getIsReactActEnvironment()\n setReactActEnvironment(false)\n try {\n const result = await cb()\n // Drain microtask queue.\n // Otherwise we'll restore the previous act() environment, before we resolve the `waitFor` call.\n // The caller would have no chance to wrap the in-flight Promises in `act()`\n await new Promise(resolve => {\n setTimeout(() => {\n resolve()\n }, 0)\n\n if (jestFakeTimersAreEnabled()) {\n jest.advanceTimersByTime(0)\n }\n })\n\n return result\n } finally {\n setReactActEnvironment(previousActEnvironment)\n }\n },\n eventWrapper: cb => {\n let result\n act(() => {\n result = cb()\n })\n return result\n },\n})\n\n// Ideally we'd just use a WeakMap where containers are keys and roots are values.\n// We use two variables so that we can bail out in constant time when we render with a new container (most common use case)\n/**\n * @type {Set<import('react-dom').Container>}\n */\nconst mountedContainers = new Set()\n/**\n * @type Array<{container: import('react-dom').Container, root: ReturnType<typeof createConcurrentRoot>}>\n */\nconst mountedRootEntries = []\n\nfunction strictModeIfNeeded(innerElement, reactStrictMode) {\n return reactStrictMode ?? getConfig().reactStrictMode\n ? React.createElement(React.StrictMode, null, innerElement)\n : innerElement\n}\n\nfunction wrapUiIfNeeded(innerElement, wrapperComponent) {\n return wrapperComponent\n ? React.createElement(wrapperComponent, null, innerElement)\n : innerElement\n}\n\nfunction createConcurrentRoot(\n container,\n {\n hydrate,\n onCaughtError,\n onRecoverableError,\n ui,\n wrapper: WrapperComponent,\n reactStrictMode,\n },\n) {\n let root\n if (hydrate) {\n act(() => {\n root = ReactDOMClient.hydrateRoot(\n container,\n strictModeIfNeeded(\n wrapUiIfNeeded(ui, WrapperComponent),\n reactStrictMode,\n ),\n {onCaughtError, onRecoverableError},\n )\n })\n } else {\n root = ReactDOMClient.createRoot(container, {\n onCaughtError,\n onRecoverableError,\n })\n }\n\n return {\n hydrate() {\n /* istanbul ignore if */\n if (!hydrate) {\n throw new Error(\n 'Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.',\n )\n }\n // Nothing to do since hydration happens when creating the root object.\n },\n render(element) {\n root.render(element)\n },\n unmount() {\n root.unmount()\n },\n }\n}\n\nfunction createLegacyRoot(container) {\n return {\n hydrate(element) {\n ReactDOM.hydrate(element, container)\n },\n render(element) {\n ReactDOM.render(element, container)\n },\n unmount() {\n ReactDOM.unmountComponentAtNode(container)\n },\n }\n}\n\nfunction renderRoot(\n ui,\n {\n baseElement,\n container,\n hydrate,\n queries,\n root,\n wrapper: WrapperComponent,\n reactStrictMode,\n },\n) {\n act(() => {\n if (hydrate) {\n root.hydrate(\n strictModeIfNeeded(\n wrapUiIfNeeded(ui, WrapperComponent),\n reactStrictMode,\n ),\n container,\n )\n } else {\n root.render(\n strictModeIfNeeded(\n wrapUiIfNeeded(ui, WrapperComponent),\n reactStrictMode,\n ),\n container,\n )\n }\n })\n\n return {\n container,\n baseElement,\n debug: (el = baseElement, maxLength, options) =>\n Array.isArray(el)\n ? // eslint-disable-next-line no-console\n el.forEach(e => console.log(prettyDOM(e, maxLength, options)))\n : // eslint-disable-next-line no-console,\n console.log(prettyDOM(el, maxLength, options)),\n unmount: () => {\n act(() => {\n root.unmount()\n })\n },\n rerender: rerenderUi => {\n renderRoot(rerenderUi, {\n container,\n baseElement,\n root,\n wrapper: WrapperComponent,\n reactStrictMode,\n })\n // Intentionally do not return anything to avoid unnecessarily complicating the API.\n // folks can use all the same utilities we return in the first place that are bound to the container\n },\n asFragment: () => {\n /* istanbul ignore else (old jsdom limitation) */\n if (typeof document.createRange === 'function') {\n return document\n .createRange()\n .createContextualFragment(container.innerHTML)\n } else {\n const template = document.createElement('template')\n template.innerHTML = container.innerHTML\n return template.content\n }\n },\n ...getQueriesForElement(baseElement, queries),\n }\n}\n\nfunction render(\n ui,\n {\n container,\n baseElement = container,\n legacyRoot = false,\n onCaughtError,\n onUncaughtError,\n onRecoverableError,\n queries,\n hydrate = false,\n wrapper,\n reactStrictMode,\n } = {},\n) {\n if (onUncaughtError !== undefined) {\n throw new Error(\n 'onUncaughtError is not supported. The `render` call will already throw on uncaught errors.',\n )\n }\n if (legacyRoot && typeof ReactDOM.render !== 'function') {\n const error = new Error(\n '`legacyRoot: true` is not supported in this version of React. ' +\n 'If your app runs React 19 or later, you should remove this flag. ' +\n 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.',\n )\n Error.captureStackTrace(error, render)\n throw error\n }\n\n if (!baseElement) {\n // default to document.body instead of documentElement to avoid output of potentially-large\n // head elements (such as JSS style blocks) in debug output\n baseElement = document.body\n }\n if (!container) {\n container = baseElement.appendChild(document.createElement('div'))\n }\n\n let root\n // eslint-disable-next-line no-negated-condition -- we want to map the evolution of this over time. The root is created first. Only later is it re-used so we don't want to read the case that happens later first.\n if (!mountedContainers.has(container)) {\n const createRootImpl = legacyRoot ? createLegacyRoot : createConcurrentRoot\n root = createRootImpl(container, {\n hydrate,\n onCaughtError,\n onRecoverableError,\n ui,\n wrapper,\n reactStrictMode,\n })\n\n mountedRootEntries.push({container, root})\n // we'll add it to the mounted containers regardless of whether it's actually\n // added to document.body so the cleanup method works regardless of whether\n // they're passing us a custom container or not.\n mountedContainers.add(container)\n } else {\n mountedRootEntries.forEach(rootEntry => {\n // Else is unreachable since `mountedContainers` has the `container`.\n // Only reachable if one would accidentally add the container to `mountedContainers` but not the root to `mountedRootEntries`\n /* istanbul ignore else */\n if (rootEntry.container === container) {\n root = rootEntry.root\n }\n })\n }\n\n return renderRoot(ui, {\n container,\n baseElement,\n queries,\n hydrate,\n wrapper,\n root,\n reactStrictMode,\n })\n}\n\nfunction cleanup() {\n mountedRootEntries.forEach(({root, container}) => {\n act(() => {\n root.unmount()\n })\n if (container.parentNode === document.body) {\n document.body.removeChild(container)\n }\n })\n mountedRootEntries.length = 0\n mountedContainers.clear()\n}\n\nfunction renderHook(renderCallback, options = {}) {\n const {initialProps, ...renderOptions} = options\n\n if (renderOptions.legacyRoot && typeof ReactDOM.render !== 'function') {\n const error = new Error(\n '`legacyRoot: true` is not supported in this version of React. ' +\n 'If your app runs React 19 or later, you should remove this flag. ' +\n 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.',\n )\n Error.captureStackTrace(error, renderHook)\n throw error\n }\n\n const result = React.createRef()\n\n function TestComponent({renderCallbackProps}) {\n const pendingResult = renderCallback(renderCallbackProps)\n\n React.useEffect(() => {\n result.current = pendingResult\n })\n\n return null\n }\n\n const {rerender: baseRerender, unmount} = render(\n <TestComponent renderCallbackProps={initialProps} />,\n renderOptions,\n )\n\n function rerender(rerenderCallbackProps) {\n return baseRerender(\n <TestComponent renderCallbackProps={rerenderCallbackProps} />,\n )\n }\n\n return {result, rerender, unmount}\n}\n\n// just re-export everything from dom-testing-library\nexport * from '@testing-library/dom'\nexport {render, renderHook, cleanup, act, fireEvent, getConfig, configure}\n\n/* eslint func-name-matching:0 */\n"],"names":["reactAct","React","act","DeprecatedReactTestUtils","getGlobalThis","globalThis","self","window","global","Error","setIsReactActEnvironment","isReactActEnvironment","IS_REACT_ACT_ENVIRONMENT","getIsReactActEnvironment","actImplementation","callback","previousActEnvironment","callbackNeedsToBeAwaited","actResult","result","then","resolve","reject","returnValue","error","fireEvent","args","dtlFireEvent","Object","keys","forEach","key","mouseEnter","mouseLeave","mouseOver","mouseOut","pointerEnter","pointerLeave","pointerOver","pointerOut","select","node","init","focus","keyUp","blur","focusOut","focusIn","configForRTL","reactStrictMode","getConfig","getConfigDTL","configureDTL","unstable_advanceTimersWrapper","cb","asyncWrapper","async","setReactActEnvironment","Promise","setTimeout","jest","_isMockFunction","prototype","hasOwnProperty","call","advanceTimersByTime","eventWrapper","mountedContainers","Set","mountedRootEntries","strictModeIfNeeded","innerElement","createElement","StrictMode","wrapUiIfNeeded","wrapperComponent","createConcurrentRoot","container","hydrate","onCaughtError","onRecoverableError","ui","wrapper","WrapperComponent","root","ReactDOMClient","hydrateRoot","createRoot","render","element","unmount","createLegacyRoot","ReactDOM","unmountComponentAtNode","renderRoot","baseElement","queries","debug","el","maxLength","options","Array","isArray","e","console","log","prettyDOM","rerender","rerenderUi","asFragment","document","createRange","createContextualFragment","innerHTML","template","content","getQueriesForElement","legacyRoot","onUncaughtError","undefined","captureStackTrace","body","appendChild","has","rootEntry","push","add","parentNode","removeChild","length","clear","newConfig","configForDTL","configure","renderHook","renderCallback","initialProps","renderOptions","createRef","TestComponent","renderCallbackProps","pendingResult","useEffect","current","baseRerender","rerenderCallbackProps"],"mappings":"25BAGA,MAAMA,EACiB,mBAAdC,EAAMC,IAAqBD,EAAMC,IAAMC,EAAyBD,IAEzE,SAASE,IAEP,GAA0B,oBAAfC,WACT,OAAOA,WAGT,GAAoB,oBAATC,KACT,OAAOA,KAGT,GAAsB,oBAAXC,OACT,OAAOA,OAGT,GAAsB,oBAAXC,OACT,OAAOA,OAGT,MAAM,IAAIC,MAAM,iCAClB,CAEA,SAASC,EAAyBC,GAChCP,IAAgBQ,yBAA2BD,CAC7C,CAEA,SAASE,IACP,OAAOT,IAAgBQ,wBACzB,CAiDA,MAAMV,GA/C4BY,EA+CGd,EA9C5Be,IACL,MAAMC,EAAyBH,IAC/BH,GAAyB,GACzB,IAEE,IAAIO,GAA2B,EAC/B,MAAMC,EAAYJ,EAAkB,KAClC,MAAMK,EAASJ,IAQf,OANa,OAAXI,GACkB,iBAAXA,GACgB,mBAAhBA,EAAOC,OAEdH,GAA2B,GAEtBE,IAET,OAAIF,EAEK,CACLG,KAAMA,CAACC,EAASC,KAFDJ,EAGJE,KACPG,IACEb,EAAyBM,GACzBK,EAAQE,IAEVC,IACEd,EAAyBM,GACzBM,EAAOE,QAMfd,EAAyBM,GAClBE,EAEV,CAAC,MAAOM,GAIP,MADAd,EAAyBM,GACnBQ,CACR,IA3CJ,IAAkCV,EC7B5BW,MAAAA,EAAYA,IAAIC,IAASC,EAAYF,aAAIC,GAE/CE,OAAOC,KAAKF,EAAAA,WAAcG,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