@office-iss/react-native-win32 0.81.2 → 0.82.0-preview.2

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 (209) hide show
  1. package/.flowconfig +3 -11
  2. package/CHANGELOG.json +118 -43
  3. package/CHANGELOG.md +45 -27
  4. package/IntegrationTests/IntegrationTestsApp.js +2 -2
  5. package/IntegrationTests/LayoutEventsTest.js +3 -3
  6. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +7 -3
  7. package/Libraries/Alert/RCTAlertManager.android.js +4 -2
  8. package/Libraries/Animated/Animated.d.ts +2 -0
  9. package/Libraries/Animated/AnimatedEvent.js +1 -1
  10. package/Libraries/Animated/AnimatedExports.js.flow +1 -0
  11. package/Libraries/Animated/AnimatedImplementation.js +4 -2
  12. package/Libraries/Animated/AnimatedMock.js +1 -1
  13. package/Libraries/Animated/Easing.js +2 -0
  14. package/Libraries/Animated/NativeAnimatedAllowlist.js +1 -0
  15. package/Libraries/Animated/animations/Animation.js +19 -20
  16. package/Libraries/Animated/animations/TimingAnimation.js +2 -0
  17. package/Libraries/Animated/components/AnimatedScrollView.js +3 -2
  18. package/Libraries/Animated/components/AnimatedSectionList.js +1 -1
  19. package/Libraries/Animated/nodes/AnimatedColor.js +9 -9
  20. package/Libraries/Animated/nodes/AnimatedInterpolation.js +4 -4
  21. package/Libraries/Animated/nodes/AnimatedNode.js +14 -7
  22. package/Libraries/Animated/nodes/AnimatedObject.js +7 -7
  23. package/Libraries/Animated/nodes/AnimatedProps.js +32 -32
  24. package/Libraries/Animated/nodes/AnimatedStyle.js +23 -21
  25. package/Libraries/Animated/nodes/AnimatedTransform.js +6 -6
  26. package/Libraries/Animated/nodes/AnimatedValue.js +18 -26
  27. package/Libraries/AppState/AppState.js +8 -4
  28. package/Libraries/BatchedBridge/BatchedBridge.js +1 -0
  29. package/Libraries/BatchedBridge/MessageQueue.js +5 -0
  30. package/Libraries/BatchedBridge/NativeModules.js +1 -1
  31. package/Libraries/Blob/BlobManager.js +1 -1
  32. package/Libraries/Blob/URLSearchParams.js +2 -0
  33. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -2
  34. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +2 -2
  35. package/Libraries/Components/Button.js +1 -1
  36. package/Libraries/Components/Button.win32.js +1 -1
  37. package/Libraries/Components/Pressable/Pressable.js +10 -1
  38. package/Libraries/Components/Pressable/Pressable.win32.js +9 -0
  39. package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
  40. package/Libraries/Components/ScrollView/ScrollView.js +13 -4
  41. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
  42. package/Libraries/Components/StatusBar/StatusBar.js +2 -2
  43. package/Libraries/Components/Switch/Switch.js +1 -1
  44. package/Libraries/Components/TextInput/TextInput.flow.js +12 -5
  45. package/Libraries/Components/TextInput/TextInput.flow.win32.js +12 -5
  46. package/Libraries/Components/TextInput/TextInput.js +14 -5
  47. package/Libraries/Components/TextInput/TextInput.win32.js +15 -7
  48. package/Libraries/Components/TextInput/TextInputState.js +1 -1
  49. package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
  50. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +2 -3
  51. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  52. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
  53. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
  54. package/Libraries/Components/Touchable/TouchableOpacity.js +1 -1
  55. package/Libraries/Components/Touchable/TouchableWin32.js +1 -1
  56. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  57. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +3 -3
  58. package/Libraries/Components/View/View.js +81 -167
  59. package/Libraries/Components/View/View.win32.js +3 -1
  60. package/Libraries/Core/Devtools/loadBundleFromServer.js +1 -1
  61. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +1 -1
  62. package/Libraries/Core/ExceptionsManager.js +4 -2
  63. package/Libraries/Core/ReactFiberErrorDialog.js +3 -3
  64. package/Libraries/Core/ReactNativeVersion.js +37 -10
  65. package/Libraries/Core/Timers/JSTimers.js +4 -1
  66. package/Libraries/Core/Timers/NativeTiming.js +1 -0
  67. package/Libraries/Core/Timers/immediateShim.js +2 -1
  68. package/Libraries/Core/Timers/queueMicrotask.js +1 -0
  69. package/Libraries/Core/setUpPerformance.js +3 -4
  70. package/Libraries/Debugging/DebuggingOverlayRegistry.js +5 -3
  71. package/Libraries/Image/Image.android.js +327 -111
  72. package/Libraries/Image/Image.ios.js +6 -1
  73. package/Libraries/Image/Image.win32.js +6 -1
  74. package/Libraries/Image/ImageSourceUtils.js +8 -2
  75. package/Libraries/Image/assetPaths.js +1 -1
  76. package/Libraries/Image/resolveAssetSource.js +1 -1
  77. package/Libraries/Image/resolveAssetSource.win32.js +6 -7
  78. package/Libraries/Interaction/InteractionManager.js +118 -167
  79. package/Libraries/Interaction/PanResponder.js +7 -52
  80. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -0
  81. package/Libraries/Lists/FlatList.js +5 -6
  82. package/Libraries/LogBox/Data/LogBoxData.js +5 -2
  83. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  84. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +2 -2
  85. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -1
  86. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +1 -1
  87. package/Libraries/Modal/Modal.js +3 -3
  88. package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
  89. package/Libraries/NativeComponent/ViewConfig.js +2 -2
  90. package/Libraries/Network/RCTNetworking.android.js +1 -1
  91. package/Libraries/Network/RCTNetworking.ios.js +1 -1
  92. package/Libraries/Network/RCTNetworking.win32.js +1 -1
  93. package/Libraries/Network/XMLHttpRequest.js +20 -5
  94. package/Libraries/Network/convertRequestBody.js +1 -1
  95. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +10 -9
  96. package/Libraries/Pressability/HoverState.js +2 -0
  97. package/Libraries/Pressability/HoverState.win32.js +2 -0
  98. package/Libraries/Pressability/Pressability.js +1 -1
  99. package/Libraries/Pressability/Pressability.win32.js +1 -1
  100. package/Libraries/PushNotificationIOS/PushNotificationIOS.js +2 -2
  101. package/Libraries/ReactNative/AppRegistryImpl.js +4 -2
  102. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -0
  103. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +3 -3
  104. package/Libraries/ReactNative/RendererImplementation.js +116 -116
  105. package/Libraries/ReactNative/UIManager.js +3 -3
  106. package/Libraries/ReactNative/renderApplication.js +1 -0
  107. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -1
  108. package/Libraries/Renderer/implementations/ReactFabric-dev.js +38 -35
  109. package/Libraries/Renderer/implementations/ReactFabric-prod.js +51 -22
  110. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +54 -24
  111. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +36 -33
  112. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5 -5
  113. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5 -5
  114. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
  115. package/Libraries/Share/Share.js +4 -0
  116. package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
  117. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +2 -2
  118. package/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +4 -0
  119. package/Libraries/StyleSheet/StyleSheet.d.ts +7 -22
  120. package/Libraries/StyleSheet/StyleSheetExports.js +2 -8
  121. package/Libraries/StyleSheet/StyleSheetExports.js.flow +11 -18
  122. package/Libraries/StyleSheet/flattenStyle.js +2 -2
  123. package/Libraries/StyleSheet/processAspectRatio.js +2 -0
  124. package/Libraries/StyleSheet/processFilter.js +5 -5
  125. package/Libraries/StyleSheet/splitLayoutProps.js +2 -2
  126. package/Libraries/Text/Text.js +534 -234
  127. package/Libraries/Text/Text.win32.js +647 -274
  128. package/Libraries/Text/TextNativeComponent.js +2 -2
  129. package/Libraries/Text/TextNativeComponent.win32.js +2 -2
  130. package/Libraries/Utilities/Appearance.d.ts +3 -5
  131. package/Libraries/Utilities/Appearance.js +5 -17
  132. package/Libraries/Utilities/HMRClient.js +2 -1
  133. package/Libraries/Utilities/Platform.android.js +3 -3
  134. package/Libraries/Utilities/Platform.d.ts +1 -0
  135. package/Libraries/Utilities/Platform.ios.js +1 -1
  136. package/Libraries/Utilities/Platform.win32.js +3 -3
  137. package/Libraries/Utilities/PlatformTypes.js +1 -1
  138. package/Libraries/Utilities/ReactNativeTestTools.js +12 -0
  139. package/Libraries/Utilities/SceneTracker.js +1 -1
  140. package/Libraries/Utilities/codegenNativeCommands.js +1 -1
  141. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  142. package/Libraries/Utilities/createPerformanceLogger.js +32 -0
  143. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
  144. package/Libraries/Utilities/differ/pointsDiffer.js +1 -1
  145. package/Libraries/Utilities/useMergeRefs.js +1 -1
  146. package/Libraries/WebSocket/WebSocketInterceptor.js +2 -0
  147. package/Libraries/promiseRejectionTrackingOptions.js +17 -31
  148. package/Libraries/vendor/emitter/EventEmitter.js +1 -1
  149. package/flow/bom.js.flow +223 -1
  150. package/flow/prettier.js.flow +14 -0
  151. package/index.js +14 -2
  152. package/index.win32.js +16 -2
  153. package/jest/local-setup.js +2 -2
  154. package/jest/mock.js +1 -1
  155. package/jest/mockComponent.js +9 -9
  156. package/jest/mockNativeComponent.js +3 -2
  157. package/jest/mocks/Modal.js +1 -1
  158. package/jest/mocks/ScrollView.js +1 -1
  159. package/jest/mocks/ViewNativeComponent.js +1 -1
  160. package/jest/setup.js +23 -12
  161. package/overrides.json +23 -23
  162. package/package.json +28 -27
  163. package/saveAssetPlugin.js +2 -2
  164. package/src/private/animated/NativeAnimatedHelper.js +16 -5
  165. package/src/private/animated/NativeAnimatedHelper.win32.js +16 -5
  166. package/src/private/animated/createAnimatedPropsHook.js +11 -60
  167. package/src/private/animated/createAnimatedPropsMemoHook.js +8 -54
  168. package/src/private/components/virtualview/VirtualView.js +43 -12
  169. package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +93 -0
  170. package/src/private/components/virtualview/VirtualViewNativeComponent.js +6 -0
  171. package/src/private/devsupport/devmenu/elementinspector/Inspector.js +2 -2
  172. package/src/private/devsupport/devmenu/elementinspector/ReactDevToolsOverlay.js +2 -2
  173. package/src/private/featureflags/ReactNativeFeatureFlags.js +85 -52
  174. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
  175. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +15 -6
  176. package/src/private/renderer/errorhandling/ErrorHandlers.js +3 -3
  177. package/src/private/setup/{setUpPerformanceObserver.js → setUpPerformanceModern.js} +43 -18
  178. package/src/private/specs_DEPRECATED/modules/NativeTiming.js +1 -0
  179. package/src/private/types/HostInstance.js +4 -1
  180. package/src/private/webapis/dom/nodes/ReactNativeDocument.js +22 -2
  181. package/src/private/webapis/dom/nodes/ReactNativeElement.js +1 -1
  182. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +5 -3
  183. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +16 -13
  184. package/src/private/webapis/dom/nodes/internals/NodeInternals.js +45 -22
  185. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
  186. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +26 -192
  187. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +15 -12
  188. package/src/private/webapis/dom/oldstylecollections/NodeList.js +14 -11
  189. package/src/private/webapis/geometry/DOMRectList.js +2 -2
  190. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +19 -74
  191. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +0 -4
  192. package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
  193. package/src/private/webapis/performance/EventTiming.js +40 -25
  194. package/src/private/webapis/performance/LongTasks.js +35 -2
  195. package/src/private/webapis/performance/Performance.js +347 -166
  196. package/src/private/webapis/performance/PerformanceEntry.js +40 -23
  197. package/src/private/webapis/performance/PerformanceObserver.js +37 -29
  198. package/src/private/webapis/performance/ReactNativeStartupTiming.js +3 -24
  199. package/src/private/webapis/performance/ResourceTiming.js +29 -18
  200. package/src/private/webapis/performance/UserTiming.js +92 -34
  201. package/src/private/webapis/performance/UserTimingExtensibility.js.flow +38 -0
  202. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -4
  203. package/src/private/webapis/performance/internals/Utilities.js +9 -0
  204. package/src/private/webapis/performance/specs/NativePerformance.js +23 -23
  205. package/src/private/webapis/structuredClone/structuredClone.js +10 -10
  206. package/src-win/Libraries/Components/Touchable/TouchableWin32.tsx +1 -1
  207. package/Libraries/Interaction/InteractionManagerStub.js +0 -184
  208. package/Libraries/Interaction/TaskQueue.js +0 -183
  209. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +0 -31
@@ -27,13 +27,13 @@ import type {NativeIntersectionObserverToken} from '../specs/NativeIntersectionO
27
27
 
28
28
  import * as Systrace from '../../../../../Libraries/Performance/Systrace';
29
29
  import warnOnce from '../../../../../Libraries/Utilities/warnOnce';
30
- import * as ReactNativeFeatureFlags from '../../../featureflags/ReactNativeFeatureFlags';
31
30
  import {
32
31
  getInstanceHandle,
33
32
  getNativeNodeReference,
34
33
  } from '../../dom/nodes/internals/NodeInternals';
35
34
  import {createIntersectionObserverEntry} from '../IntersectionObserverEntry';
36
35
  import NativeIntersectionObserver from '../specs/NativeIntersectionObserver';
36
+ import nullthrows from 'nullthrows';
37
37
 
38
38
  export type IntersectionObserverId = number;
39
39
 
@@ -69,36 +69,11 @@ function setTargetForInstanceHandle(
69
69
  instanceHandleToTargetMap.set(key, target);
70
70
  }
71
71
 
72
- // The mapping between ReactNativeElement and their corresponding shadow node
73
- // also needs to be kept here because React removes the link when unmounting.
74
- const targetToShadowNodeMap: WeakMap<
75
- ReactNativeElement,
76
- ReturnType<typeof getNativeNodeReference>,
77
- > = new WeakMap();
78
-
79
72
  const targetToTokenMap: WeakMap<
80
73
  ReactNativeElement,
81
74
  NativeIntersectionObserverToken,
82
75
  > = new WeakMap();
83
76
 
84
- let modernNativeIntersectionObserver =
85
- NativeIntersectionObserver == null
86
- ? null
87
- : NativeIntersectionObserver.observeV2 == null ||
88
- NativeIntersectionObserver.unobserveV2 == null
89
- ? null
90
- : {
91
- observe: NativeIntersectionObserver.observeV2,
92
- unobserve: NativeIntersectionObserver.unobserveV2,
93
- };
94
-
95
- if (
96
- modernNativeIntersectionObserver &&
97
- !ReactNativeFeatureFlags.utilizeTokensInIntersectionObserver()
98
- ) {
99
- modernNativeIntersectionObserver = null;
100
- }
101
-
102
77
  /**
103
78
  * Registers the given intersection observer and returns a unique ID for it,
104
79
  * which is required to start observing targets.
@@ -189,34 +164,19 @@ export function observe({
189
164
  // access it even after the instance handle has been unmounted.
190
165
  setTargetForInstanceHandle(instanceHandle, target);
191
166
 
192
- if (modernNativeIntersectionObserver == null) {
193
- // Same for the mapping between the target and its shadow node.
194
- targetToShadowNodeMap.set(target, targetNativeNodeReference);
195
- }
196
-
197
167
  if (!isConnected) {
198
168
  NativeIntersectionObserver.connect(notifyIntersectionObservers);
199
169
  isConnected = true;
200
170
  }
201
171
 
202
- if (modernNativeIntersectionObserver == null) {
203
- NativeIntersectionObserver.observe({
204
- intersectionObserverId,
205
- rootShadowNode: rootNativeNodeReference,
206
- targetShadowNode: targetNativeNodeReference,
207
- thresholds: registeredObserver.observer.thresholds,
208
- rootThresholds: registeredObserver.observer.rnRootThresholds,
209
- });
210
- } else {
211
- const token = modernNativeIntersectionObserver.observe({
212
- intersectionObserverId,
213
- rootShadowNode: rootNativeNodeReference,
214
- targetShadowNode: targetNativeNodeReference,
215
- thresholds: registeredObserver.observer.thresholds,
216
- rootThresholds: registeredObserver.observer.rnRootThresholds,
217
- });
218
- targetToTokenMap.set(target, token);
219
- }
172
+ const token = nullthrows(NativeIntersectionObserver.observeV2)({
173
+ intersectionObserverId,
174
+ rootShadowNode: rootNativeNodeReference,
175
+ targetShadowNode: targetNativeNodeReference,
176
+ thresholds: registeredObserver.observer.thresholds,
177
+ rootThresholds: registeredObserver.observer.rnRootThresholds,
178
+ });
179
+ targetToTokenMap.set(target, token);
220
180
 
221
181
  return true;
222
182
  }
@@ -240,33 +200,18 @@ export function unobserve(
240
200
  return;
241
201
  }
242
202
 
243
- if (modernNativeIntersectionObserver == null) {
244
- const targetNativeNodeReference = targetToShadowNodeMap.get(target);
245
- if (targetNativeNodeReference == null) {
246
- console.error(
247
- 'IntersectionObserverManager: could not find registration data for target',
248
- );
249
- return;
250
- }
251
-
252
- NativeIntersectionObserver.unobserve(
253
- intersectionObserverId,
254
- targetNativeNodeReference,
255
- );
256
- } else {
257
- const targetToken = targetToTokenMap.get(target);
258
- if (targetToken == null) {
259
- console.error(
260
- 'IntersectionObserverManager: could not find registration data for target',
261
- );
262
- return;
263
- }
264
-
265
- modernNativeIntersectionObserver.unobserve(
266
- intersectionObserverId,
267
- targetToken,
203
+ const targetToken = targetToTokenMap.get(target);
204
+ if (targetToken == null) {
205
+ console.error(
206
+ 'IntersectionObserverManager: could not find registration data for target',
268
207
  );
208
+ return;
269
209
  }
210
+
211
+ nullthrows(NativeIntersectionObserver.unobserveV2)(
212
+ intersectionObserverId,
213
+ targetToken,
214
+ );
270
215
  }
271
216
 
272
217
  /**
@@ -34,10 +34,6 @@ export type NativeIntersectionObserverObserveOptions = {
34
34
  export opaque type NativeIntersectionObserverToken = mixed;
35
35
 
36
36
  export interface Spec extends TurboModule {
37
- // TODO(T223605846): Remove legacy observe method
38
- +observe: (options: NativeIntersectionObserverObserveOptions) => void;
39
- // TODO(T223605846): Remove legacy unobserve method
40
- +unobserve: (intersectionObserverId: number, targetShadowNode: mixed) => void;
41
37
  +observeV2?: (
42
38
  options: NativeIntersectionObserverObserveOptions,
43
39
  ) => NativeIntersectionObserverToken;
@@ -111,7 +111,7 @@ export function observe({
111
111
  // the public instance immediately when mutations occur. Otherwise React
112
112
  // could dereference it in the instance handle and we wouldn't be able to
113
113
  // access it.
114
- // $FlowExpectedError[incompatible-call] This is typed as (mixed) => mixed in the native module because the codegen doesn't support the actual types.
114
+ // $FlowExpectedError[incompatible-type] This is typed as (mixed) => mixed in the native module because the codegen doesn't support the actual types.
115
115
  getPublicInstanceFromInternalInstanceHandle,
116
116
  );
117
117
  isConnected = true;
@@ -9,15 +9,17 @@
9
9
  */
10
10
 
11
11
  // flowlint unsafe-getters-setters:off
12
-
13
12
  import type {
14
13
  DOMHighResTimeStamp,
14
+ PerformanceEntryInit,
15
15
  PerformanceEntryJSON,
16
16
  } from './PerformanceEntry';
17
17
 
18
- import {warnNoNativePerformance} from './internals/Utilities';
19
18
  import {PerformanceEntry} from './PerformanceEntry';
20
- import NativePerformance from './specs/NativePerformance';
19
+ import MaybeNativePerformance from './specs/NativePerformance';
20
+ import nullthrows from 'nullthrows';
21
+
22
+ const NativePerformance = nullthrows(MaybeNativePerformance);
21
23
 
22
24
  export type PerformanceEventTimingJSON = {
23
25
  ...PerformanceEntryJSON,
@@ -27,25 +29,20 @@ export type PerformanceEventTimingJSON = {
27
29
  ...
28
30
  };
29
31
 
32
+ export interface PerformanceEventTimingInit extends PerformanceEntryInit {
33
+ +processingStart?: DOMHighResTimeStamp;
34
+ +processingEnd?: DOMHighResTimeStamp;
35
+ +interactionId?: number;
36
+ }
37
+
30
38
  export class PerformanceEventTiming extends PerformanceEntry {
31
39
  #processingStart: DOMHighResTimeStamp;
32
40
  #processingEnd: DOMHighResTimeStamp;
33
41
  #interactionId: number;
34
42
 
35
- constructor(init: {
36
- name: string,
37
- startTime?: DOMHighResTimeStamp,
38
- duration?: DOMHighResTimeStamp,
39
- processingStart?: DOMHighResTimeStamp,
40
- processingEnd?: DOMHighResTimeStamp,
41
- interactionId?: number,
42
- }) {
43
- super({
44
- name: init.name,
45
- entryType: 'event',
46
- startTime: init.startTime ?? 0,
47
- duration: init.duration ?? 0,
48
- });
43
+ constructor(init: PerformanceEventTimingInit) {
44
+ super('event', init);
45
+
49
46
  this.#processingStart = init.processingStart ?? 0;
50
47
  this.#processingEnd = init.processingEnd ?? 0;
51
48
  this.#interactionId = init.interactionId ?? 0;
@@ -73,6 +70,18 @@ export class PerformanceEventTiming extends PerformanceEntry {
73
70
  }
74
71
  }
75
72
 
73
+ export const PerformanceEventTiming_public: typeof PerformanceEventTiming =
74
+ /* eslint-disable no-shadow */
75
+ // $FlowExpectedError[incompatible-type]
76
+ function PerformanceEventTiming() {
77
+ throw new TypeError(
78
+ "Failed to construct 'PerformanceEventTiming': Illegal constructor",
79
+ );
80
+ };
81
+
82
+ // $FlowExpectedError[prop-missing]
83
+ PerformanceEventTiming_public.prototype = PerformanceEventTiming.prototype;
84
+
76
85
  type EventCountsForEachCallbackType =
77
86
  | (() => void)
78
87
  | ((value: number) => void)
@@ -86,18 +95,12 @@ function getCachedEventCounts(): Map<string, number> {
86
95
  return cachedEventCounts;
87
96
  }
88
97
 
89
- if (!NativePerformance || !NativePerformance?.getEventCounts) {
90
- warnNoNativePerformance();
91
- cachedEventCounts = new Map();
92
- return cachedEventCounts;
93
- }
94
-
95
98
  const eventCounts = new Map<string, number>(
96
- NativePerformance.getEventCounts?.() ?? [],
99
+ NativePerformance.getEventCounts() ?? [],
97
100
  );
98
101
  cachedEventCounts = eventCounts;
99
102
 
100
- // $FlowFixMe[incompatible-call]
103
+ // $FlowFixMe[incompatible-type]
101
104
  global.queueMicrotask(() => {
102
105
  // To be consistent with the calls to the API from the same task,
103
106
  // but also not to refetch the data from native too often,
@@ -143,3 +146,15 @@ export class EventCounts {
143
146
  return getCachedEventCounts().values();
144
147
  }
145
148
  }
149
+
150
+ export const EventCounts_public: typeof EventCounts =
151
+ /* eslint-disable no-shadow */
152
+ // $FlowExpectedError[incompatible-type]
153
+ function EventCounts() {
154
+ throw new TypeError(
155
+ "Failed to construct 'EventCounts': Illegal constructor",
156
+ );
157
+ };
158
+
159
+ // $FlowExpectedError[prop-missing]
160
+ EventCounts_public.prototype = EventCounts.prototype;
@@ -9,8 +9,10 @@
9
9
  */
10
10
 
11
11
  // flowlint unsafe-getters-setters:off
12
-
13
- import type {PerformanceEntryJSON} from './PerformanceEntry';
12
+ import type {
13
+ PerformanceEntryInit,
14
+ PerformanceEntryJSON,
15
+ } from './PerformanceEntry';
14
16
 
15
17
  import {PerformanceEntry} from './PerformanceEntry';
16
18
 
@@ -22,10 +24,28 @@ export type PerformanceLongTaskTimingJSON = {
22
24
 
23
25
  export class TaskAttributionTiming extends PerformanceEntry {}
24
26
 
27
+ export const TaskAttributionTiming_public: typeof TaskAttributionTiming =
28
+ /* eslint-disable no-shadow */
29
+ // $FlowExpectedError[incompatible-type]
30
+ function TaskAttributionTiming() {
31
+ throw new TypeError(
32
+ "Failed to construct 'TaskAttributionTiming': Illegal constructor",
33
+ );
34
+ };
35
+
36
+ // $FlowExpectedError[prop-missing]
37
+ TaskAttributionTiming_public.prototype = TaskAttributionTiming.prototype;
38
+
25
39
  const EMPTY_ATTRIBUTION: $ReadOnlyArray<TaskAttributionTiming> =
26
40
  Object.preventExtensions([]);
27
41
 
42
+ export interface PerformanceLongTaskTimingInit extends PerformanceEntryInit {}
43
+
28
44
  export class PerformanceLongTaskTiming extends PerformanceEntry {
45
+ constructor(init: PerformanceEntryInit) {
46
+ super('longtask', init);
47
+ }
48
+
29
49
  get attribution(): $ReadOnlyArray<TaskAttributionTiming> {
30
50
  return EMPTY_ATTRIBUTION;
31
51
  }
@@ -37,3 +57,16 @@ export class PerformanceLongTaskTiming extends PerformanceEntry {
37
57
  };
38
58
  }
39
59
  }
60
+
61
+ export const PerformanceLongTaskTiming_public: typeof PerformanceLongTaskTiming =
62
+ /* eslint-disable no-shadow */
63
+ // $FlowExpectedError[incompatible-type]
64
+ function PerformanceLongTaskTiming() {
65
+ throw new TypeError(
66
+ "Failed to construct 'PerformanceLongTaskTiming': Illegal constructor",
67
+ );
68
+ };
69
+
70
+ // $FlowExpectedError[prop-missing]
71
+ PerformanceLongTaskTiming_public.prototype =
72
+ PerformanceLongTaskTiming.prototype;