@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.
- package/.flowconfig +3 -11
- package/CHANGELOG.json +118 -43
- package/CHANGELOG.md +45 -27
- package/IntegrationTests/IntegrationTestsApp.js +2 -2
- package/IntegrationTests/LayoutEventsTest.js +3 -3
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +7 -3
- package/Libraries/Alert/RCTAlertManager.android.js +4 -2
- package/Libraries/Animated/Animated.d.ts +2 -0
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedExports.js.flow +1 -0
- package/Libraries/Animated/AnimatedImplementation.js +4 -2
- package/Libraries/Animated/AnimatedMock.js +1 -1
- package/Libraries/Animated/Easing.js +2 -0
- package/Libraries/Animated/NativeAnimatedAllowlist.js +1 -0
- package/Libraries/Animated/animations/Animation.js +19 -20
- package/Libraries/Animated/animations/TimingAnimation.js +2 -0
- package/Libraries/Animated/components/AnimatedScrollView.js +3 -2
- package/Libraries/Animated/components/AnimatedSectionList.js +1 -1
- package/Libraries/Animated/nodes/AnimatedColor.js +9 -9
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +4 -4
- package/Libraries/Animated/nodes/AnimatedNode.js +14 -7
- package/Libraries/Animated/nodes/AnimatedObject.js +7 -7
- package/Libraries/Animated/nodes/AnimatedProps.js +32 -32
- package/Libraries/Animated/nodes/AnimatedStyle.js +23 -21
- package/Libraries/Animated/nodes/AnimatedTransform.js +6 -6
- package/Libraries/Animated/nodes/AnimatedValue.js +18 -26
- package/Libraries/AppState/AppState.js +8 -4
- package/Libraries/BatchedBridge/BatchedBridge.js +1 -0
- package/Libraries/BatchedBridge/MessageQueue.js +5 -0
- package/Libraries/BatchedBridge/NativeModules.js +1 -1
- package/Libraries/Blob/BlobManager.js +1 -1
- package/Libraries/Blob/URLSearchParams.js +2 -0
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -2
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +2 -2
- package/Libraries/Components/Button.js +1 -1
- package/Libraries/Components/Button.win32.js +1 -1
- package/Libraries/Components/Pressable/Pressable.js +10 -1
- package/Libraries/Components/Pressable/Pressable.win32.js +9 -0
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
- package/Libraries/Components/ScrollView/ScrollView.js +13 -4
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +2 -2
- package/Libraries/Components/Switch/Switch.js +1 -1
- package/Libraries/Components/TextInput/TextInput.flow.js +12 -5
- package/Libraries/Components/TextInput/TextInput.flow.win32.js +12 -5
- package/Libraries/Components/TextInput/TextInput.js +14 -5
- package/Libraries/Components/TextInput/TextInput.win32.js +15 -7
- package/Libraries/Components/TextInput/TextInputState.js +1 -1
- package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +2 -3
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
- package/Libraries/Components/Touchable/TouchableOpacity.js +1 -1
- package/Libraries/Components/Touchable/TouchableWin32.js +1 -1
- package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +3 -3
- package/Libraries/Components/View/View.js +81 -167
- package/Libraries/Components/View/View.win32.js +3 -1
- package/Libraries/Core/Devtools/loadBundleFromServer.js +1 -1
- package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +1 -1
- package/Libraries/Core/ExceptionsManager.js +4 -2
- package/Libraries/Core/ReactFiberErrorDialog.js +3 -3
- package/Libraries/Core/ReactNativeVersion.js +37 -10
- package/Libraries/Core/Timers/JSTimers.js +4 -1
- package/Libraries/Core/Timers/NativeTiming.js +1 -0
- package/Libraries/Core/Timers/immediateShim.js +2 -1
- package/Libraries/Core/Timers/queueMicrotask.js +1 -0
- package/Libraries/Core/setUpPerformance.js +3 -4
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +5 -3
- package/Libraries/Image/Image.android.js +327 -111
- package/Libraries/Image/Image.ios.js +6 -1
- package/Libraries/Image/Image.win32.js +6 -1
- package/Libraries/Image/ImageSourceUtils.js +8 -2
- package/Libraries/Image/assetPaths.js +1 -1
- package/Libraries/Image/resolveAssetSource.js +1 -1
- package/Libraries/Image/resolveAssetSource.win32.js +6 -7
- package/Libraries/Interaction/InteractionManager.js +118 -167
- package/Libraries/Interaction/PanResponder.js +7 -52
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -0
- package/Libraries/Lists/FlatList.js +5 -6
- package/Libraries/LogBox/Data/LogBoxData.js +5 -2
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +2 -2
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +1 -1
- package/Libraries/Modal/Modal.js +3 -3
- package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
- package/Libraries/NativeComponent/ViewConfig.js +2 -2
- package/Libraries/Network/RCTNetworking.android.js +1 -1
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.win32.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +20 -5
- package/Libraries/Network/convertRequestBody.js +1 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +10 -9
- package/Libraries/Pressability/HoverState.js +2 -0
- package/Libraries/Pressability/HoverState.win32.js +2 -0
- package/Libraries/Pressability/Pressability.js +1 -1
- package/Libraries/Pressability/Pressability.win32.js +1 -1
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +2 -2
- package/Libraries/ReactNative/AppRegistryImpl.js +4 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +3 -3
- package/Libraries/ReactNative/RendererImplementation.js +116 -116
- package/Libraries/ReactNative/UIManager.js +3 -3
- package/Libraries/ReactNative/renderApplication.js +1 -0
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +38 -35
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +51 -22
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +54 -24
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +36 -33
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5 -5
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5 -5
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
- package/Libraries/Share/Share.js +4 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +2 -2
- package/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +4 -0
- package/Libraries/StyleSheet/StyleSheet.d.ts +7 -22
- package/Libraries/StyleSheet/StyleSheetExports.js +2 -8
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +11 -18
- package/Libraries/StyleSheet/flattenStyle.js +2 -2
- package/Libraries/StyleSheet/processAspectRatio.js +2 -0
- package/Libraries/StyleSheet/processFilter.js +5 -5
- package/Libraries/StyleSheet/splitLayoutProps.js +2 -2
- package/Libraries/Text/Text.js +534 -234
- package/Libraries/Text/Text.win32.js +647 -274
- package/Libraries/Text/TextNativeComponent.js +2 -2
- package/Libraries/Text/TextNativeComponent.win32.js +2 -2
- package/Libraries/Utilities/Appearance.d.ts +3 -5
- package/Libraries/Utilities/Appearance.js +5 -17
- package/Libraries/Utilities/HMRClient.js +2 -1
- package/Libraries/Utilities/Platform.android.js +3 -3
- package/Libraries/Utilities/Platform.d.ts +1 -0
- package/Libraries/Utilities/Platform.ios.js +1 -1
- package/Libraries/Utilities/Platform.win32.js +3 -3
- package/Libraries/Utilities/PlatformTypes.js +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +12 -0
- package/Libraries/Utilities/SceneTracker.js +1 -1
- package/Libraries/Utilities/codegenNativeCommands.js +1 -1
- package/Libraries/Utilities/codegenNativeComponent.js +1 -1
- package/Libraries/Utilities/createPerformanceLogger.js +32 -0
- package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
- package/Libraries/Utilities/differ/pointsDiffer.js +1 -1
- package/Libraries/Utilities/useMergeRefs.js +1 -1
- package/Libraries/WebSocket/WebSocketInterceptor.js +2 -0
- package/Libraries/promiseRejectionTrackingOptions.js +17 -31
- package/Libraries/vendor/emitter/EventEmitter.js +1 -1
- package/flow/bom.js.flow +223 -1
- package/flow/prettier.js.flow +14 -0
- package/index.js +14 -2
- package/index.win32.js +16 -2
- package/jest/local-setup.js +2 -2
- package/jest/mock.js +1 -1
- package/jest/mockComponent.js +9 -9
- package/jest/mockNativeComponent.js +3 -2
- package/jest/mocks/Modal.js +1 -1
- package/jest/mocks/ScrollView.js +1 -1
- package/jest/mocks/ViewNativeComponent.js +1 -1
- package/jest/setup.js +23 -12
- package/overrides.json +23 -23
- package/package.json +28 -27
- package/saveAssetPlugin.js +2 -2
- package/src/private/animated/NativeAnimatedHelper.js +16 -5
- package/src/private/animated/NativeAnimatedHelper.win32.js +16 -5
- package/src/private/animated/createAnimatedPropsHook.js +11 -60
- package/src/private/animated/createAnimatedPropsMemoHook.js +8 -54
- package/src/private/components/virtualview/VirtualView.js +43 -12
- package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +93 -0
- package/src/private/components/virtualview/VirtualViewNativeComponent.js +6 -0
- package/src/private/devsupport/devmenu/elementinspector/Inspector.js +2 -2
- package/src/private/devsupport/devmenu/elementinspector/ReactDevToolsOverlay.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +85 -52
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +15 -6
- package/src/private/renderer/errorhandling/ErrorHandlers.js +3 -3
- package/src/private/setup/{setUpPerformanceObserver.js → setUpPerformanceModern.js} +43 -18
- package/src/private/specs_DEPRECATED/modules/NativeTiming.js +1 -0
- package/src/private/types/HostInstance.js +4 -1
- package/src/private/webapis/dom/nodes/ReactNativeDocument.js +22 -2
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +1 -1
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +5 -3
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +16 -13
- package/src/private/webapis/dom/nodes/internals/NodeInternals.js +45 -22
- package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +26 -192
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +15 -12
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +14 -11
- package/src/private/webapis/geometry/DOMRectList.js +2 -2
- package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +19 -74
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +0 -4
- package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
- package/src/private/webapis/performance/EventTiming.js +40 -25
- package/src/private/webapis/performance/LongTasks.js +35 -2
- package/src/private/webapis/performance/Performance.js +347 -166
- package/src/private/webapis/performance/PerformanceEntry.js +40 -23
- package/src/private/webapis/performance/PerformanceObserver.js +37 -29
- package/src/private/webapis/performance/ReactNativeStartupTiming.js +3 -24
- package/src/private/webapis/performance/ResourceTiming.js +29 -18
- package/src/private/webapis/performance/UserTiming.js +92 -34
- package/src/private/webapis/performance/UserTimingExtensibility.js.flow +38 -0
- package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -4
- package/src/private/webapis/performance/internals/Utilities.js +9 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +23 -23
- package/src/private/webapis/structuredClone/structuredClone.js +10 -10
- package/src-win/Libraries/Components/Touchable/TouchableWin32.tsx +1 -1
- package/Libraries/Interaction/InteractionManagerStub.js +0 -184
- package/Libraries/Interaction/TaskQueue.js +0 -183
- 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
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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-
|
|
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
|
|
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
|
-
|
|
37
|
-
|
|
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-
|
|
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
|
-
|
|
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;
|