@office-iss/react-native-win32 0.0.0-canary.258 → 0.0.0-canary.260

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 (142) hide show
  1. package/.flowconfig +2 -4
  2. package/CHANGELOG.json +31 -1
  3. package/CHANGELOG.md +24 -8
  4. package/Libraries/Alert/Alert.js +3 -0
  5. package/Libraries/Animated/AnimatedImplementation.js +7 -7
  6. package/Libraries/Animated/animations/Animation.js +10 -0
  7. package/Libraries/Animated/animations/TimingAnimation.js +1 -0
  8. package/Libraries/Animated/components/AnimatedScrollView.js +2 -2
  9. package/Libraries/Animated/createAnimatedComponent.js +1 -1
  10. package/Libraries/Animated/nodes/AnimatedValue.js +1 -0
  11. package/Libraries/Animated/useAnimatedProps.js +138 -6
  12. package/Libraries/BatchedBridge/NativeModules.js +2 -0
  13. package/Libraries/Blob/FileReader.js +1 -1
  14. package/Libraries/Blob/URL.js +2 -62
  15. package/Libraries/Blob/URLSearchParams.js +71 -0
  16. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
  17. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +1 -1
  18. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +3 -0
  19. package/Libraries/Components/ScrollView/ScrollView.js +5 -5
  20. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +3 -0
  21. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
  22. package/Libraries/Components/StatusBar/StatusBar.js +3 -1
  23. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +3 -0
  24. package/Libraries/Components/TextInput/TextInput.d.ts +32 -2
  25. package/Libraries/Components/TextInput/TextInput.js +220 -80
  26. package/Libraries/Components/TextInput/TextInput.win32.js +220 -86
  27. package/Libraries/Components/View/ReactNativeStyleAttributes.js +22 -0
  28. package/Libraries/Components/View/ReactNativeViewAttributes.js +2 -0
  29. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +2 -0
  30. package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
  31. package/Libraries/Components/View/ViewNativeComponent.js +6 -0
  32. package/Libraries/Components/View/ViewPropTypes.js +14 -0
  33. package/Libraries/Components/View/ViewPropTypes.win32.js +14 -0
  34. package/Libraries/Core/ExceptionsManager.js +2 -0
  35. package/Libraries/Core/InitializeCore.js +1 -1
  36. package/Libraries/Core/ReactFiberErrorDialog.js +3 -0
  37. package/Libraries/Core/ReactNativeVersion.js +1 -1
  38. package/Libraries/Core/setUpErrorHandling.js +7 -1
  39. package/Libraries/Core/setUpReactRefresh.js +0 -4
  40. package/Libraries/Image/AssetSourceResolver.js +28 -1
  41. package/Libraries/Image/Image.android.js +9 -14
  42. package/Libraries/Image/Image.ios.js +11 -22
  43. package/Libraries/Image/Image.win32.js +10 -21
  44. package/Libraries/Image/ImageBackground.js +1 -8
  45. package/Libraries/Image/ImageUtils.js +9 -9
  46. package/Libraries/Image/ImageViewNativeComponent.js +4 -0
  47. package/Libraries/Inspector/NetworkOverlay.js +1 -1
  48. package/Libraries/Interaction/TaskQueue.js +1 -0
  49. package/Libraries/Lists/FlatList.js +1 -1
  50. package/Libraries/Lists/SectionList.js +2 -2
  51. package/Libraries/Lists/SectionListModern.js +1 -1
  52. package/Libraries/LogBox/Data/LogBoxData.js +31 -4
  53. package/Libraries/NativeComponent/BaseViewConfig.android.js +2 -0
  54. package/Libraries/NativeComponent/BaseViewConfig.ios.js +7 -0
  55. package/Libraries/NativeComponent/BaseViewConfig.win32.js +7 -0
  56. package/Libraries/NativeComponent/NativeComponentRegistry.js +9 -2
  57. package/Libraries/Network/XMLHttpRequest.js +4 -2
  58. package/Libraries/ReactNative/BridgelessUIManager.js +1 -0
  59. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +1 -1
  60. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +5 -5
  61. package/Libraries/ReactNative/RendererImplementation.js +24 -2
  62. package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -0
  63. package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -1
  64. package/Libraries/StyleSheet/StyleSheet.js +1 -1
  65. package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
  66. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +57 -19
  67. package/Libraries/StyleSheet/StyleSheetTypes.js +60 -23
  68. package/Libraries/StyleSheet/processBackgroundImage.js +286 -0
  69. package/Libraries/StyleSheet/processBoxShadow.js +211 -0
  70. package/Libraries/StyleSheet/processFilter.js +24 -14
  71. package/Libraries/Text/Text.js +395 -212
  72. package/Libraries/Text/Text.win32.js +443 -245
  73. package/Libraries/Text/TextNativeComponent.js +7 -0
  74. package/Libraries/Text/TextNativeComponent.win32.js +7 -0
  75. package/Libraries/TurboModule/TurboModuleRegistry.js +13 -50
  76. package/Libraries/Types/CodegenTypes.js +3 -1
  77. package/Libraries/Utilities/HMRClient.js +1 -0
  78. package/Libraries/Utilities/Platform.android.js +1 -1
  79. package/Libraries/Utilities/Platform.d.ts +1 -1
  80. package/Libraries/Utilities/Platform.flow.js +2 -2
  81. package/Libraries/Utilities/Platform.flow.win32.js +3 -3
  82. package/Libraries/Utilities/Platform.ios.js +1 -1
  83. package/Libraries/Utilities/Platform.win32.js +1 -1
  84. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  85. package/Libraries/WebSocket/WebSocket.js +1 -1
  86. package/Libraries/vendor/emitter/EventEmitter.js +1 -0
  87. package/flow/jest.js +2 -2
  88. package/index.js +1 -0
  89. package/index.win32.js +1 -0
  90. package/jest/mockModal.js +1 -3
  91. package/jest/mockScrollView.js +1 -1
  92. package/jest/renderer.js +2 -2
  93. package/jest/setup.js +16 -9
  94. package/overrides.json +16 -16
  95. package/package.json +15 -15
  96. package/src/private/{core/components → components}/HScrollViewNativeComponents.js +8 -8
  97. package/src/private/{core/components → components}/VScrollViewNativeComponents.js +7 -7
  98. package/src/private/{core/components → components}/useSyncOnScroll.js +2 -2
  99. package/src/private/featureflags/ReactNativeFeatureFlags.js +143 -19
  100. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +25 -5
  101. package/src/private/hooks/DebouncedEffectImplementation.js +148 -0
  102. package/src/private/hooks/useDebouncedEffect.js +23 -0
  103. package/{Libraries/Core → src/private/renderer/errorhandling}/ErrorHandlers.js +14 -4
  104. package/src/private/setup/setUpDOM.js +28 -0
  105. package/src/private/setup/setUpIntersectionObserver.js +27 -0
  106. package/src/private/setup/setUpMutationObserver.js +26 -0
  107. package/src/private/setup/setUpPerformanceObserver.js +64 -0
  108. package/src/private/specs/modules/NativeDebuggerSessionObserver.js +23 -0
  109. package/src/private/specs/modules/NativeLinkingManager.js +1 -1
  110. package/src/private/specs/modules/NativePlatformConstantsAndroid.js +1 -1
  111. package/src/private/specs/modules/NativePlatformConstantsIOS.js +1 -1
  112. package/src/private/specs/modules/NativePlatformConstantsWin.js +8 -1
  113. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -4
  114. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserver.js +1 -1
  115. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverEntry.js +3 -3
  116. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverManager.js +5 -8
  117. package/src/private/{specs/modules → webapis/intersectionobserver/specs}/NativeIntersectionObserver.js +2 -2
  118. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver/specs}/__mocks__/NativeIntersectionObserver.js +4 -4
  119. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserver.js +1 -1
  120. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserverManager.js +5 -5
  121. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationRecord.js +4 -6
  122. package/src/private/{specs/modules → webapis/mutationobserver/specs}/NativeMutationObserver.js +2 -2
  123. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver/specs}/__mocks__/NativeMutationObserver.js +5 -5
  124. package/src/private/webapis/performance/{EventCounts.js → EventTiming.js} +65 -3
  125. package/src/private/webapis/performance/LongTasks.js +39 -0
  126. package/src/private/webapis/performance/Performance.js +22 -9
  127. package/src/private/webapis/performance/PerformanceEntry.js +36 -18
  128. package/src/private/webapis/performance/PerformanceObserver.js +29 -43
  129. package/src/private/webapis/performance/RawPerformanceEntry.js +24 -1
  130. package/src/private/webapis/performance/UserTiming.js +17 -12
  131. package/src/private/webapis/performance/specs/NativePerformanceObserver.js +1 -1
  132. package/src-win/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
  133. package/types/experimental.d.ts +20 -1
  134. package/Libraries/Core/setUpIntersectionObserver.js +0 -16
  135. package/Libraries/Core/setUpMutationObserver.js +0 -16
  136. package/Libraries/Core/setUpPerformanceObserver.js +0 -18
  137. package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +0 -13
  138. package/Libraries/MutationObserver/NativeMutationObserver.js +0 -13
  139. package/Libraries/Text/TextOptimized.js +0 -538
  140. package/src/private/core/setUpDOM.js +0 -18
  141. package/src/private/webapis/performance/PerformanceEventTiming.js +0 -55
  142. /package/src/private/{core → styles}/composeStyles.js +0 -0
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ import {polyfillGlobal} from '../../../Libraries/Utilities/PolyfillFunctions';
12
+
13
+ let initialized = false;
14
+
15
+ export default function setUpIntersectionObserver() {
16
+ if (initialized) {
17
+ return;
18
+ }
19
+
20
+ initialized = true;
21
+
22
+ polyfillGlobal(
23
+ 'IntersectionObserver',
24
+ () =>
25
+ require('../webapis/intersectionobserver/IntersectionObserver').default,
26
+ );
27
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ import {polyfillGlobal} from '../../../Libraries/Utilities/PolyfillFunctions';
12
+
13
+ let initialized = false;
14
+
15
+ export default function setUpMutationObserver() {
16
+ if (initialized) {
17
+ return;
18
+ }
19
+
20
+ initialized = true;
21
+
22
+ polyfillGlobal(
23
+ 'MutationObserver',
24
+ () => require('../webapis/mutationobserver/MutationObserver').default,
25
+ );
26
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ import {polyfillGlobal} from '../../../Libraries/Utilities/PolyfillFunctions';
12
+
13
+ let initialized = false;
14
+
15
+ export default function setUpPerformanceObserver() {
16
+ if (initialized) {
17
+ return;
18
+ }
19
+
20
+ initialized = true;
21
+
22
+ polyfillGlobal(
23
+ 'PerformanceObserver',
24
+ () =>
25
+ require('../webapis/performance/PerformanceObserver').PerformanceObserver,
26
+ );
27
+
28
+ polyfillGlobal(
29
+ 'PerformanceObserverEntryList',
30
+ () =>
31
+ require('../webapis/performance/PerformanceObserver')
32
+ .PerformanceObserverEntryList,
33
+ );
34
+
35
+ polyfillGlobal(
36
+ 'PerformanceEntry',
37
+ () => require('../webapis/performance/PerformanceEntry').PerformanceEntry,
38
+ );
39
+
40
+ polyfillGlobal(
41
+ 'PerformanceMark',
42
+ () => require('../webapis/performance/UserTiming').PerformanceMark,
43
+ );
44
+
45
+ polyfillGlobal(
46
+ 'PerformanceMeasure',
47
+ () => require('../webapis/performance/UserTiming').PerformanceMeasure,
48
+ );
49
+
50
+ polyfillGlobal(
51
+ 'PerformanceEventTiming',
52
+ () => require('../webapis/performance/EventTiming').PerformanceEventTiming,
53
+ );
54
+
55
+ polyfillGlobal(
56
+ 'TaskAttributionTiming',
57
+ () => require('../webapis/performance/LongTasks').TaskAttributionTiming,
58
+ );
59
+
60
+ polyfillGlobal(
61
+ 'PerformanceLongTaskTiming',
62
+ () => require('../webapis/performance/LongTasks').PerformanceLongTaskTiming,
63
+ );
64
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
13
+
14
+ import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
15
+
16
+ export interface Spec extends TurboModule {
17
+ +hasActiveSession: () => boolean;
18
+ +subscribe: (callback: (hasActiveSession: boolean) => void) => () => void;
19
+ }
20
+
21
+ export default (TurboModuleRegistry.get<Spec>(
22
+ 'NativeDebuggerSessionObserverCxx',
23
+ ): ?Spec);
@@ -14,7 +14,7 @@ import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboMod
14
14
 
15
15
  export interface Spec extends TurboModule {
16
16
  // Common interface
17
- +getInitialURL: () => Promise<string>;
17
+ +getInitialURL: () => Promise<?string>;
18
18
  +canOpenURL: (url: string) => Promise<boolean>;
19
19
  +openURL: (url: string) => Promise<void>;
20
20
  +openSettings: () => Promise<void>;
@@ -16,7 +16,7 @@ export type ReactNativeVersionAndroid = {|
16
16
  major: number,
17
17
  minor: number,
18
18
  patch: number,
19
- prerelease: ?number,
19
+ prerelease: ?string,
20
20
  |};
21
21
 
22
22
  export type PlatformConstantsAndroid = {|
@@ -19,7 +19,7 @@ export type PlatformConstantsIOS = {|
19
19
  major: number,
20
20
  minor: number,
21
21
  patch: number,
22
- prerelease: ?number,
22
+ prerelease: ?string,
23
23
  |},
24
24
  forceTouchAvailable: boolean,
25
25
  osVersion: string,
@@ -12,6 +12,13 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
12
12
 
13
13
  import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
14
14
 
15
+ export type ReactNativeVersionAndroid = {|
16
+ major: number,
17
+ minor: number,
18
+ patch: number,
19
+ prerelease: ?string,
20
+ |};
21
+
15
22
  export type PlatformConstantsWin32 = {|
16
23
  isTesting: boolean,
17
24
  isDisableAnimations?: boolean,
@@ -19,7 +26,7 @@ export type PlatformConstantsWin32 = {|
19
26
  major: number,
20
27
  minor: number,
21
28
  patch: number,
22
- prerelease: ?string | number,
29
+ prerelease: ?string,
23
30
  |},
24
31
  forceTouchAvailable: boolean,
25
32
  osVersion: number,
@@ -304,8 +304,10 @@ function setInstanceHandle(
304
304
  export function getShadowNode(node: ReadOnlyNode): ?ShadowNode {
305
305
  // Lazy import Fabric here to avoid DOM Node APIs classes from having side-effects.
306
306
  // With a static import we can't use these classes for Paper-only variants.
307
- const ReactFabric = require('../../../../../Libraries/Renderer/shims/ReactFabric');
308
- return ReactFabric.getNodeFromInternalInstanceHandle(getInstanceHandle(node));
307
+ const RendererProxy = require('../../../../../Libraries/ReactNative/RendererProxy');
308
+ return RendererProxy.getNodeFromInternalInstanceHandle(
309
+ getInstanceHandle(node),
310
+ );
309
311
  }
310
312
 
311
313
  export function getChildNodes(
@@ -349,9 +351,9 @@ export function getPublicInstanceFromInternalInstanceHandle(
349
351
  ): ?ReadOnlyNode {
350
352
  // Lazy import Fabric here to avoid DOM Node APIs classes from having side-effects.
351
353
  // With a static import we can't use these classes for Paper-only variants.
352
- const ReactFabric = require('../../../../../Libraries/Renderer/shims/ReactFabric');
354
+ const RendererProxy = require('../../../../../Libraries/ReactNative/RendererProxy');
353
355
  const mixedPublicInstance =
354
- ReactFabric.getPublicInstanceFromInternalInstanceHandle(instanceHandle);
356
+ RendererProxy.getPublicInstanceFromInternalInstanceHandle(instanceHandle);
355
357
  // $FlowExpectedError[incompatible-return] React defines public instances as "mixed" because it can't access the definition from React Native.
356
358
  return mixedPublicInstance;
357
359
  }
@@ -13,7 +13,7 @@
13
13
  import type IntersectionObserverEntry from './IntersectionObserverEntry';
14
14
  import type {IntersectionObserverId} from './IntersectionObserverManager';
15
15
 
16
- import ReactNativeElement from '../../src/private/webapis/dom/nodes/ReactNativeElement';
16
+ import ReactNativeElement from '../dom/nodes/ReactNativeElement';
17
17
  import * as IntersectionObserverManager from './IntersectionObserverManager';
18
18
 
19
19
  export type IntersectionObserverCallback = (
@@ -10,10 +10,10 @@
10
10
 
11
11
  // flowlint unsafe-getters-setters:off
12
12
 
13
- import type ReactNativeElement from '../../src/private/webapis/dom/nodes/ReactNativeElement';
14
- import type {NativeIntersectionObserverEntry} from './NativeIntersectionObserver';
13
+ import type ReactNativeElement from '../dom/nodes/ReactNativeElement';
14
+ import type {NativeIntersectionObserverEntry} from './specs/NativeIntersectionObserver';
15
15
 
16
- import DOMRectReadOnly from '../../src/private/webapis/dom/geometry/DOMRectReadOnly';
16
+ import DOMRectReadOnly from '../dom/geometry/DOMRectReadOnly';
17
17
 
18
18
  /**
19
19
  * The [`IntersectionObserverEntry`](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserverEntry)
@@ -18,20 +18,17 @@
18
18
  * the notifications together.
19
19
  */
20
20
 
21
- import type ReactNativeElement from '../../src/private/webapis/dom/nodes/ReactNativeElement';
21
+ import type ReactNativeElement from '../dom/nodes/ReactNativeElement';
22
22
  import type IntersectionObserver, {
23
23
  IntersectionObserverCallback,
24
24
  } from './IntersectionObserver';
25
25
  import type IntersectionObserverEntry from './IntersectionObserverEntry';
26
26
 
27
- import {
28
- getInstanceHandle,
29
- getShadowNode,
30
- } from '../../src/private/webapis/dom/nodes/ReadOnlyNode';
31
- import * as Systrace from '../Performance/Systrace';
32
- import warnOnce from '../Utilities/warnOnce';
27
+ import * as Systrace from '../../../../Libraries/Performance/Systrace';
28
+ import warnOnce from '../../../../Libraries/Utilities/warnOnce';
29
+ import {getInstanceHandle, getShadowNode} from '../dom/nodes/ReadOnlyNode';
33
30
  import {createIntersectionObserverEntry} from './IntersectionObserverEntry';
34
- import NativeIntersectionObserver from './NativeIntersectionObserver';
31
+ import NativeIntersectionObserver from './specs/NativeIntersectionObserver';
35
32
 
36
33
  export type IntersectionObserverId = number;
37
34
 
@@ -8,9 +8,9 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
11
+ import type {TurboModule} from '../../../../../Libraries/TurboModule/RCTExport';
12
12
 
13
- import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
13
+ import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/TurboModuleRegistry';
14
14
 
15
15
  export type NativeIntersectionObserverEntry = {
16
16
  intersectionObserverId: number,
@@ -8,16 +8,16 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type ReactNativeElement from '../../../src/private/webapis/dom/nodes/ReactNativeElement';
12
- import type IntersectionObserver from '../IntersectionObserver';
11
+ import type ReactNativeElement from '../../../dom/nodes/ReactNativeElement';
12
+ import type IntersectionObserver from '../../IntersectionObserver';
13
13
  import type {
14
14
  NativeIntersectionObserverEntry,
15
15
  NativeIntersectionObserverObserveOptions,
16
16
  Spec,
17
17
  } from '../NativeIntersectionObserver';
18
18
 
19
- import {getShadowNode} from '../../../src/private/webapis/dom/nodes/ReadOnlyNode';
20
- import {getFabricUIManager} from '../../ReactNative/__mocks__/FabricUIManager';
19
+ import {getFabricUIManager} from '../../../../../../Libraries/ReactNative/__mocks__/FabricUIManager';
20
+ import {getShadowNode} from '../../../dom/nodes/ReadOnlyNode';
21
21
  import invariant from 'invariant';
22
22
  import nullthrows from 'nullthrows';
23
23
 
@@ -13,7 +13,7 @@
13
13
  import type {MutationObserverId} from './MutationObserverManager';
14
14
  import type MutationRecord from './MutationRecord';
15
15
 
16
- import ReactNativeElement from '../../src/private/webapis/dom/nodes/ReactNativeElement';
16
+ import ReactNativeElement from '../dom/nodes/ReactNativeElement';
17
17
  import * as MutationObserverManager from './MutationObserverManager';
18
18
 
19
19
  export type MutationObserverCallback = (
@@ -18,20 +18,20 @@
18
18
  * the notifications together.
19
19
  */
20
20
 
21
- import type ReactNativeElement from '../../src/private/webapis/dom/nodes/ReactNativeElement';
21
+ import type ReactNativeElement from '../dom/nodes/ReactNativeElement';
22
22
  import type MutationObserver, {
23
23
  MutationObserverCallback,
24
24
  } from './MutationObserver';
25
25
  import type MutationRecord from './MutationRecord';
26
26
 
27
+ import * as Systrace from '../../../../Libraries/Performance/Systrace';
28
+ import warnOnce from '../../../../Libraries/Utilities/warnOnce';
27
29
  import {
28
30
  getPublicInstanceFromInternalInstanceHandle,
29
31
  getShadowNode,
30
- } from '../../src/private/webapis/dom/nodes/ReadOnlyNode';
31
- import * as Systrace from '../Performance/Systrace';
32
- import warnOnce from '../Utilities/warnOnce';
32
+ } from '../dom/nodes/ReadOnlyNode';
33
33
  import {createMutationRecord} from './MutationRecord';
34
- import NativeMutationObserver from './NativeMutationObserver';
34
+ import NativeMutationObserver from './specs/NativeMutationObserver';
35
35
 
36
36
  export type MutationObserverId = number;
37
37
 
@@ -10,13 +10,11 @@
10
10
 
11
11
  // flowlint unsafe-getters-setters:off
12
12
 
13
- import type ReactNativeElement from '../../src/private/webapis/dom/nodes/ReactNativeElement';
14
- import type ReadOnlyNode from '../../src/private/webapis/dom/nodes/ReadOnlyNode';
15
- import type {NativeMutationRecord} from './NativeMutationObserver';
13
+ import type ReactNativeElement from '../dom/nodes/ReactNativeElement';
14
+ import type ReadOnlyNode from '../dom/nodes/ReadOnlyNode';
15
+ import type {NativeMutationRecord} from './specs/NativeMutationObserver';
16
16
 
17
- import NodeList, {
18
- createNodeList,
19
- } from '../../src/private/webapis/dom/oldstylecollections/NodeList';
17
+ import NodeList, {createNodeList} from '../dom/oldstylecollections/NodeList';
20
18
 
21
19
  export type MutationType = 'attributes' | 'characterData' | 'childList';
22
20
 
@@ -8,9 +8,9 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
11
+ import type {TurboModule} from '../../../../../Libraries/TurboModule/RCTExport';
12
12
 
13
- import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
13
+ import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/TurboModuleRegistry';
14
14
 
15
15
  export type MutationObserverId = number;
16
16
 
@@ -15,12 +15,12 @@
15
15
  * JavaScript as an integration test using only public APIs.
16
16
  */
17
17
 
18
- import type {NodeSet} from '../../ReactNative/FabricUIManager';
19
- import type {RootTag} from '../../ReactNative/RootTag';
18
+ import type {NodeSet} from '../../../../../../Libraries/ReactNative/FabricUIManager';
19
+ import type {RootTag} from '../../../../../../Libraries/ReactNative/RootTag';
20
20
  import type {
21
21
  InternalInstanceHandle,
22
22
  Node,
23
- } from '../../Renderer/shims/ReactNativeTypes';
23
+ } from '../../../../../../Libraries/Renderer/shims/ReactNativeTypes';
24
24
  import type {
25
25
  MutationObserverId,
26
26
  NativeMutationObserverObserveOptions,
@@ -28,14 +28,14 @@ import type {
28
28
  Spec,
29
29
  } from '../NativeMutationObserver';
30
30
 
31
- import ReadOnlyNode from '../../../src/private/webapis/dom/nodes/ReadOnlyNode';
32
31
  import {
33
32
  type NodeMock,
34
33
  type UIManagerCommitHook,
35
34
  fromNode,
36
35
  getFabricUIManager,
37
36
  getNodeInChildSet,
38
- } from '../../ReactNative/__mocks__/FabricUIManager';
37
+ } from '../../../../../../Libraries/ReactNative/__mocks__/FabricUIManager';
38
+ import ReadOnlyNode from '../../../dom/nodes/ReadOnlyNode';
39
39
  import invariant from 'invariant';
40
40
  import nullthrows from 'nullthrows';
41
41
 
@@ -4,13 +4,75 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow strict
8
7
  * @format
8
+ * @flow strict
9
9
  */
10
10
 
11
+ // flowlint unsafe-getters-setters:off
12
+
13
+ import type {
14
+ DOMHighResTimeStamp,
15
+ PerformanceEntryJSON,
16
+ } from './PerformanceEntry';
17
+
18
+ import {PerformanceEntry} from './PerformanceEntry';
11
19
  import {warnNoNativePerformanceObserver} from './PerformanceObserver';
12
20
  import NativePerformanceObserver from './specs/NativePerformanceObserver';
13
21
 
22
+ export type PerformanceEventTimingJSON = {
23
+ ...PerformanceEntryJSON,
24
+ processingStart: DOMHighResTimeStamp,
25
+ processingEnd: DOMHighResTimeStamp,
26
+ interactionId: number,
27
+ ...
28
+ };
29
+
30
+ export class PerformanceEventTiming extends PerformanceEntry {
31
+ #processingStart: DOMHighResTimeStamp;
32
+ #processingEnd: DOMHighResTimeStamp;
33
+ #interactionId: number;
34
+
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
+ });
49
+ this.#processingStart = init.processingStart ?? 0;
50
+ this.#processingEnd = init.processingEnd ?? 0;
51
+ this.#interactionId = init.interactionId ?? 0;
52
+ }
53
+
54
+ get processingStart(): DOMHighResTimeStamp {
55
+ return this.#processingStart;
56
+ }
57
+
58
+ get processingEnd(): DOMHighResTimeStamp {
59
+ return this.#processingEnd;
60
+ }
61
+
62
+ get interactionId(): number {
63
+ return this.#interactionId;
64
+ }
65
+
66
+ toJSON(): PerformanceEventTimingJSON {
67
+ return {
68
+ ...super.toJSON(),
69
+ processingStart: this.#processingStart,
70
+ processingEnd: this.#processingEnd,
71
+ interactionId: this.#interactionId,
72
+ };
73
+ }
74
+ }
75
+
14
76
  type EventCountsForEachCallbackType =
15
77
  | (() => void)
16
78
  | ((value: number) => void)
@@ -41,13 +103,13 @@ function getCachedEventCounts(): Map<string, number> {
41
103
  });
42
104
  return cachedEventCounts ?? new Map();
43
105
  }
106
+
44
107
  /**
45
108
  * Implementation of the EventCounts Web Performance API
46
109
  * corresponding to the standard in
47
110
  * https://www.w3.org/TR/event-timing/#eventcounts
48
111
  */
49
- export default class EventCounts {
50
- // flowlint unsafe-getters-setters:off
112
+ export class EventCounts {
51
113
  get size(): number {
52
114
  return getCachedEventCounts().size;
53
115
  }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ * @flow strict
9
+ */
10
+
11
+ // flowlint unsafe-getters-setters:off
12
+
13
+ import type {PerformanceEntryJSON} from './PerformanceEntry';
14
+
15
+ import {PerformanceEntry} from './PerformanceEntry';
16
+
17
+ export type PerformanceLongTaskTimingJSON = {
18
+ ...PerformanceEntryJSON,
19
+ attribution: $ReadOnlyArray<TaskAttributionTiming>,
20
+ ...
21
+ };
22
+
23
+ export class TaskAttributionTiming extends PerformanceEntry {}
24
+
25
+ const EMPTY_ATTRIBUTION: $ReadOnlyArray<TaskAttributionTiming> =
26
+ Object.preventExtensions([]);
27
+
28
+ export class PerformanceLongTaskTiming extends PerformanceEntry {
29
+ get attribution(): $ReadOnlyArray<TaskAttributionTiming> {
30
+ return EMPTY_ATTRIBUTION;
31
+ }
32
+
33
+ toJSON(): PerformanceLongTaskTimingJSON {
34
+ return {
35
+ ...super.toJSON(),
36
+ attribution: this.attribution,
37
+ };
38
+ }
39
+ }
@@ -10,15 +10,15 @@
10
10
 
11
11
  // flowlint unsafe-getters-setters:off
12
12
 
13
- import type {HighResTimeStamp, PerformanceEntryType} from './PerformanceEntry';
14
- import type {PerformanceEntryList} from './PerformanceObserver';
15
13
  import type {
16
- PerformanceMarkOptions,
17
- PerformanceMeasureOptions,
18
- } from './UserTiming';
14
+ DOMHighResTimeStamp,
15
+ PerformanceEntryType,
16
+ } from './PerformanceEntry';
17
+ import type {PerformanceEntryList} from './PerformanceObserver';
18
+ import type {DetailType, PerformanceMarkOptions} from './UserTiming';
19
19
 
20
20
  import warnOnce from '../../../../Libraries/Utilities/warnOnce';
21
- import EventCounts from './EventCounts';
21
+ import {EventCounts} from './EventTiming';
22
22
  import MemoryInfo from './MemoryInfo';
23
23
  import {ALWAYS_LOGGED_ENTRY_TYPES} from './PerformanceEntry';
24
24
  import {warnNoNativePerformanceObserver} from './PerformanceObserver';
@@ -37,7 +37,7 @@ declare var global: {
37
37
  +nativePerformanceNow?: ?() => number,
38
38
  };
39
39
 
40
- const getCurrentTimeStamp: () => HighResTimeStamp =
40
+ const getCurrentTimeStamp: () => DOMHighResTimeStamp =
41
41
  NativePerformance?.now ?? global.nativePerformanceNow ?? (() => Date.now());
42
42
 
43
43
  // We want some of the performance entry types to be always logged,
@@ -58,6 +58,13 @@ function warnNoNativePerformance() {
58
58
  );
59
59
  }
60
60
 
61
+ export type PerformanceMeasureOptions = {
62
+ detail?: DetailType,
63
+ start?: DOMHighResTimeStamp,
64
+ duration?: DOMHighResTimeStamp,
65
+ end?: DOMHighResTimeStamp,
66
+ };
67
+
61
68
  /**
62
69
  * Partial implementation of the Performance interface for RN,
63
70
  * corresponding to the standard in
@@ -195,7 +202,13 @@ export default class Performance {
195
202
  duration = options.duration ?? duration;
196
203
  }
197
204
 
198
- const measure = new PerformanceMeasure(measureName, options);
205
+ const measure = new PerformanceMeasure(measureName, {
206
+ // FIXME(T196011255): this is incorrect, as we're only assigning the
207
+ // start/end if they're specified as a number, but not if they're
208
+ // specified as previous mark names.
209
+ startTime,
210
+ duration,
211
+ });
199
212
 
200
213
  if (NativePerformance?.measure) {
201
214
  NativePerformance.measure(
@@ -229,7 +242,7 @@ export default class Performance {
229
242
  * Returns a double, measured in milliseconds.
230
243
  * https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
231
244
  */
232
- now(): HighResTimeStamp {
245
+ now(): DOMHighResTimeStamp {
233
246
  return getCurrentTimeStamp();
234
247
  }
235
248