react-native-windows 0.73.10 → 0.74.0-preview.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.
- package/.flowconfig +12 -7
- package/Chakra/ChakraUtils.cpp +5 -10
- package/Chakra/ChakraUtils.h +2 -2
- package/Common/packages.lock.json +3 -3
- package/Directory.Build.props +5 -5
- package/Folly/Folly.vcxproj +2 -2
- package/Folly/Folly.vcxproj.filters +7 -0
- package/Folly/TEMP_UntilFollyUpdate/dynamic-inl.h +22 -1
- package/Folly/TEMP_UntilFollyUpdate/lang/SafeAssert.h +4 -1
- package/Folly/cgmanifest.json +1 -1
- package/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +6 -0
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +6 -0
- package/Libraries/ActionSheetIOS/NativeActionSheetManager.js +4 -45
- package/Libraries/Alert/Alert.windows.js +2 -3
- package/Libraries/Alert/NativeAlertManager.js +4 -26
- package/Libraries/Animated/Animated.js +2 -2
- package/Libraries/Animated/AnimatedPlatformConfig.js +1 -1
- package/Libraries/Animated/NativeAnimatedHelper.js +14 -11
- package/Libraries/Animated/NativeAnimatedModule.js +4 -68
- package/Libraries/Animated/NativeAnimatedTurboModule.js +4 -69
- package/Libraries/Animated/animations/Animation.js +6 -22
- package/Libraries/Animated/components/AnimatedFlatList.js +1 -16
- package/Libraries/Animated/components/AnimatedScrollView.js +36 -31
- package/Libraries/Animated/components/AnimatedSectionList.js +1 -20
- package/Libraries/Animated/createAnimatedComponent.js +45 -40
- package/Libraries/Animated/nodes/AnimatedStyle.js +1 -1
- package/Libraries/Animated/shouldUseTurboAnimatedModule.js +1 -1
- package/Libraries/Animated/useAnimatedProps.js +21 -1
- package/Libraries/AppState/NativeAppState.js +4 -24
- package/Libraries/AppTheme/NativeAppTheme.js +4 -25
- package/Libraries/BatchedBridge/NativeModules.js +1 -1
- package/Libraries/Blob/Blob.js +1 -4
- package/Libraries/Blob/BlobManager.js +6 -8
- package/Libraries/Blob/File.js +1 -1
- package/Libraries/Blob/NativeBlobModule.js +4 -50
- package/Libraries/Blob/NativeFileReaderModule.js +4 -13
- package/Libraries/BugReporting/NativeBugReporting.js +4 -12
- package/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js +3 -23
- package/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js +4 -57
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.android.js +3 -2
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.windows.js +3 -2
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +9 -40
- package/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js +3 -43
- package/Libraries/Components/Button.js +103 -107
- package/Libraries/Components/Button.windows.js +199 -206
- package/Libraries/Components/Clipboard/NativeClipboard.js +3 -11
- package/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js +3 -114
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -5
- package/Libraries/Components/Keyboard/KeyboardExt.d.ts +8 -8
- package/Libraries/Components/Keyboard/KeyboardExt.js +27 -27
- package/Libraries/Components/Keyboard/KeyboardExt.js.map +1 -1
- package/Libraries/Components/Keyboard/KeyboardExtProps.d.ts +17 -17
- package/Libraries/Components/Keyboard/KeyboardExtProps.js +7 -7
- package/Libraries/Components/Keyboard/KeyboardExtProps.js.map +1 -1
- package/Libraries/Components/Keyboard/NativeKeyboardObserver.js +3 -10
- package/Libraries/Components/PopupMenuAndroid/PopupMenuAndroid.android.js +69 -0
- package/Libraries/Components/PopupMenuAndroid/PopupMenuAndroid.d.ts +24 -0
- package/Libraries/Components/PopupMenuAndroid/PopupMenuAndroid.js +33 -0
- package/Libraries/Components/PopupMenuAndroid/PopupMenuAndroidNativeComponent.js +13 -0
- package/Libraries/Components/Pressable/Pressable.js +1 -1
- package/Libraries/Components/Pressable/Pressable.windows.js +1 -2
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +5 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.js +4 -24
- package/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js +3 -64
- package/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js +3 -61
- package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
- package/Libraries/Components/RefreshControl/RefreshControl.windows.js +1 -1
- package/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +3 -15
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollContentViewNativeComponent.js +3 -16
- package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +1 -1
- package/Libraries/Components/ScrollView/ScrollView.d.ts +5 -6
- package/Libraries/Components/ScrollView/ScrollView.js +12 -38
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -2
- package/Libraries/Components/Sound/NativeSoundManager.js +3 -12
- package/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js +3 -58
- package/Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js +3 -79
- package/Libraries/Components/Switch/AndroidSwitchNativeComponent.js +4 -53
- package/Libraries/Components/Switch/Switch.js +0 -2
- package/Libraries/Components/Switch/Switch.windows.js +0 -2
- package/Libraries/Components/Switch/SwitchNativeComponent.js +4 -52
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +8 -0
- package/Libraries/Components/TextInput/InputAccessoryView.js +18 -20
- package/Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js +4 -17
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +3 -6
- package/Libraries/Components/TextInput/TextInput.d.ts +16 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +16 -0
- package/Libraries/Components/TextInput/TextInput.js +65 -32
- package/Libraries/Components/TextInput/TextInput.windows.js +87 -38
- package/Libraries/Components/TextInput/WindowsTextInputNativeComponent.js +773 -9
- package/Libraries/Components/ToastAndroid/NativeToastAndroid.js +3 -28
- package/Libraries/Components/Touchable/PooledClass.js +1 -1
- package/Libraries/Components/Touchable/Touchable.js +2 -3
- package/Libraries/Components/Touchable/Touchable.windows.js +2 -3
- package/Libraries/Components/Touchable/TouchableHighlight.js +4 -4
- package/Libraries/Components/Touchable/TouchableHighlight.windows.js +4 -4
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -1
- package/Libraries/Components/Touchable/TouchableOpacity.js +5 -2
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +5 -2
- package/Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js +3 -16
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +1 -1
- package/Libraries/Components/View/View.js +0 -11
- package/Libraries/Components/View/View.windows.js +19 -18
- package/Libraries/Components/View/ViewAccessibility.d.ts +33 -17
- package/Libraries/Components/View/ViewPropTypes.d.ts +28 -17
- package/Libraries/Components/View/ViewPropTypes.js +36 -36
- package/Libraries/Components/View/ViewPropTypes.windows.js +36 -36
- package/Libraries/Core/InitializeCore.js +1 -1
- package/Libraries/Core/NativeExceptionsManager.js +3 -93
- package/Libraries/Core/ReactNativeVersion.js +12 -6
- package/Libraries/Core/ReactNativeVersionCheck.js +6 -6
- package/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js +3 -18
- package/Libraries/Core/Timers/NativeTiming.js +3 -16
- package/Libraries/Core/registerCallableModule.js +42 -0
- package/Libraries/Core/setUpPerformance.js +2 -2
- package/Libraries/Core/setUpPerformanceObserver.js +3 -1
- package/Libraries/Debugging/DebuggingOverlay.js +111 -0
- package/Libraries/Debugging/DebuggingOverlayNativeComponent.js +13 -0
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +513 -0
- package/Libraries/Debugging/useSubscribeToDebuggingOverlayRegistry.js +32 -0
- package/Libraries/DevToolsSettings/NativeDevToolsSettingsManager.js +3 -14
- package/Libraries/HeapCapture/NativeJSCHeapCapture.js +3 -9
- package/Libraries/Image/AssetSourceResolver.js +5 -5
- package/Libraries/Image/AssetUtils.js +4 -5
- package/Libraries/Image/Image.android.js +146 -174
- package/Libraries/Image/Image.d.ts +1 -1
- package/Libraries/Image/Image.ios.js +53 -79
- package/Libraries/Image/Image.windows.js +53 -79
- package/Libraries/Image/ImageBackground.js +2 -2
- package/Libraries/Image/ImageInjection.js +76 -18
- package/Libraries/Image/ImageTypes.flow.js +71 -0
- package/Libraries/Image/ImageUtils.js +1 -1
- package/Libraries/Image/ImageViewNativeComponent.js +18 -0
- package/Libraries/Image/NativeImageEditor.js +3 -42
- package/Libraries/Image/NativeImageLoaderAndroid.js +4 -28
- package/Libraries/Image/NativeImageLoaderIOS.js +4 -28
- package/Libraries/Image/NativeImageStoreAndroid.js +3 -16
- package/Libraries/Image/NativeImageStoreIOS.js +3 -23
- package/Libraries/Image/resolveAssetSource.js +59 -26
- package/Libraries/Image/resolveAssetSource.windows.js +148 -0
- package/Libraries/Inspector/ElementProperties.js +26 -52
- package/Libraries/Inspector/Inspector.js +122 -186
- package/Libraries/Inspector/InspectorOverlay.js +21 -33
- package/Libraries/Inspector/InspectorPanel.js +3 -17
- package/Libraries/Inspector/ReactDevToolsOverlay.js +171 -0
- package/Libraries/Inspector/getInspectorDataForViewAtPoint.js +20 -8
- package/Libraries/Interaction/FrameRateLogger.js +8 -18
- package/Libraries/Interaction/NativeFrameRateLogger.js +4 -16
- package/Libraries/IntersectionObserver/IntersectionObserver.js +1 -1
- package/Libraries/IntersectionObserver/IntersectionObserverEntry.js +20 -19
- package/Libraries/IntersectionObserver/IntersectionObserverManager.js +84 -6
- package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +3 -31
- package/Libraries/IntersectionObserver/__mocks__/NativeIntersectionObserver.js +12 -2
- package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -2
- package/Libraries/Linking/NativeIntentAndroid.js +3 -20
- package/Libraries/Linking/NativeLinkingManager.js +3 -17
- package/Libraries/Lists/FillRateHelper.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +2 -2
- package/Libraries/Lists/FlatList.js +6 -1
- package/Libraries/Lists/FlatList.windows.js +717 -0
- package/Libraries/Lists/SectionList.d.ts +6 -1
- package/Libraries/Lists/ViewabilityHelper.js +1 -1
- package/Libraries/Lists/VirtualizeUtils.js +1 -1
- package/Libraries/Lists/VirtualizedList.js +1 -1
- package/Libraries/Lists/VirtualizedListContext.js +1 -1
- package/Libraries/Lists/VirtualizedSectionList.js +1 -1
- package/Libraries/LogBox/LogBoxInspectorContainer.js +1 -1
- package/Libraries/Modal/Modal.js +43 -11
- package/Libraries/Modal/NativeModalManager.js +3 -11
- package/Libraries/Modal/RCTModalHostViewNativeComponent.js +3 -129
- package/Libraries/MutationObserver/MutationObserver.js +1 -1
- package/Libraries/MutationObserver/MutationObserverManager.js +2 -2
- package/Libraries/MutationObserver/MutationRecord.js +12 -10
- package/Libraries/MutationObserver/NativeMutationObserver.js +3 -48
- package/Libraries/MutationObserver/__mocks__/NativeMutationObserver.js +1 -1
- package/Libraries/NativeComponent/BaseViewConfig.android.js +1 -0
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +3 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
- package/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +3 -10
- package/Libraries/NativeModules/specs/NativeDevMenu.js +3 -13
- package/Libraries/NativeModules/specs/NativeDevSettings.js +3 -23
- package/Libraries/NativeModules/specs/NativeDeviceEventManager.js +3 -9
- package/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js +3 -38
- package/Libraries/NativeModules/specs/NativeDialogManagerWindows.js +11 -0
- package/Libraries/NativeModules/specs/NativeLogBox.js +3 -10
- package/Libraries/NativeModules/specs/NativeRedBox.js +4 -11
- package/Libraries/NativeModules/specs/NativeSourceCode.js +2 -25
- package/Libraries/Network/FormData.js +3 -1
- package/Libraries/Network/NativeNetworkingAndroid.js +4 -28
- package/Libraries/Network/NativeNetworkingIOS.js +4 -28
- package/Libraries/NewAppScreen/components/DebugInstructions.windows.js +4 -2
- package/Libraries/NewAppScreen/components/ReloadInstructions.windows.js +3 -1
- package/Libraries/Performance/NativeJSCSamplingProfiler.js +3 -9
- package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +4 -68
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +3 -3
- package/Libraries/Pressability/Pressability.js +12 -2
- package/Libraries/Pressability/Pressability.windows.js +13 -3
- package/Libraries/Pressability/usePressability.js +7 -0
- package/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js +4 -70
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +45 -39
- package/Libraries/ReactNative/AppContainer-dev.js +192 -0
- package/Libraries/ReactNative/AppContainer-prod.js +53 -0
- package/Libraries/ReactNative/AppContainer.js +6 -149
- package/Libraries/ReactNative/AppRegistry.js +3 -1
- package/Libraries/ReactNative/BridgelessUIManager.js +375 -128
- package/Libraries/ReactNative/FabricUIManager.js +6 -0
- package/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js +3 -10
- package/Libraries/ReactNative/NativeI18nManager.js +3 -18
- package/Libraries/ReactNative/NativeUIManager.js +4 -112
- package/Libraries/ReactNative/PaperUIManager.js +8 -7
- package/Libraries/ReactNative/PaperUIManager.windows.js +29 -8
- package/Libraries/ReactNative/ReactFabricInternals.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +24 -5
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +0 -45
- package/Libraries/ReactNative/RendererImplementation.js +11 -0
- package/Libraries/ReactNative/UIManager.d.ts +11 -34
- package/Libraries/ReactNative/UIManager.js +2 -23
- package/Libraries/ReactNative/UIManagerProperties.js +0 -2
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +23 -1
- package/Libraries/ReactNative/getNativeComponentAttributes.js +5 -1
- package/Libraries/ReactNative/renderApplication.js +9 -6
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +6 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +24771 -21123
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +4160 -3109
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4384 -3322
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +25194 -21398
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3763 -2636
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4027 -2867
- package/Libraries/Renderer/shims/ReactNativeTypes.js +8 -9
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +7 -12
- package/Libraries/Settings/NativeSettingsManager.js +4 -16
- package/Libraries/Share/NativeShareModule.js +3 -13
- package/Libraries/StyleSheet/PlatformColorValueTypes.windows.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.d.ts +1 -20
- package/Libraries/StyleSheet/StyleSheet.js +5 -28
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +47 -7
- package/Libraries/StyleSheet/StyleSheetTypes.js +16 -11
- package/Libraries/StyleSheet/flattenStyle.js +2 -2
- package/Libraries/StyleSheet/normalizeColor.js +1 -1
- package/Libraries/StyleSheet/processAspectRatio.js +1 -1
- package/Libraries/StyleSheet/processFontVariant.js +1 -1
- package/Libraries/Text/Text.js +0 -6
- package/Libraries/Text/Text.windows.js +0 -6
- package/Libraries/Text/TextAncestor.js +2 -3
- package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +4 -41
- package/Libraries/Types/ReactDevToolsTypes.js +58 -0
- package/Libraries/Types/UIManagerJSInterface.js +16 -0
- package/Libraries/Utilities/DebugEnvironment.js +1 -4
- package/Libraries/Utilities/Dimensions.js +8 -16
- package/Libraries/Utilities/GlobalPerformanceLogger.js +1 -2
- package/Libraries/Utilities/NativeAppearance.js +3 -26
- package/Libraries/Utilities/NativeDevLoadingView.js +3 -14
- package/Libraries/Utilities/NativeDeviceInfo.js +2 -47
- package/Libraries/Utilities/NativePlatformConstantsAndroid.js +3 -34
- package/Libraries/Utilities/NativePlatformConstantsIOS.js +3 -26
- package/Libraries/Utilities/NativePlatformConstantsWin.js +3 -23
- package/Libraries/Utilities/PixelRatio.d.ts +4 -4
- package/Libraries/Utilities/Platform.android.js +4 -0
- package/Libraries/Utilities/Platform.d.ts +3 -0
- package/Libraries/Utilities/Platform.flow.js +7 -0
- package/Libraries/Utilities/Platform.flow.windows.js +9 -0
- package/Libraries/Utilities/Platform.ios.js +11 -0
- package/Libraries/Utilities/Platform.windows.js +6 -0
- package/Libraries/Utilities/binaryToBase64.js +1 -1
- package/Libraries/Utilities/codegenNativeComponent.js +4 -6
- package/Libraries/Utilities/createPerformanceLogger.js +2 -74
- package/Libraries/Utilities/useMergeRefs.js +5 -9
- package/Libraries/Vibration/NativeVibration.js +3 -14
- package/Libraries/WebSocket/NativeWebSocketModule.js +4 -25
- package/Libraries/YellowBox/YellowBoxDeprecated.js +1 -1
- package/Libraries/vendor/emitter/EventEmitter.js +1 -0
- package/Microsoft.ReactNative/AsynchronousEventBeat.cpp +50 -0
- package/Microsoft.ReactNative/AsynchronousEventBeat.h +23 -0
- package/Microsoft.ReactNative/Base/CoreUIManagers.cpp +4 -0
- package/Microsoft.ReactNative/Base/CxxReactIncludes.h +1 -1
- package/Microsoft.ReactNative/Base/FollyIncludes.h +2 -2
- package/Microsoft.ReactNative/ComponentView.idl +106 -0
- package/Microsoft.ReactNative/Composition.Input.idl +16 -2
- package/Microsoft.ReactNative/CompositionComponentView.idl +117 -0
- package/Microsoft.ReactNative/CompositionContext.idl +1 -1
- package/Microsoft.ReactNative/CompositionRootView.idl +8 -0
- package/Microsoft.ReactNative/CompositionSwitcher.idl +25 -14
- package/Microsoft.ReactNative/DevMenuControl.idl +0 -3
- package/Microsoft.ReactNative/DevMenuControl.xaml +0 -15
- package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.cpp +189 -0
- package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.h +80 -0
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.cpp +83 -0
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.h +83 -0
- package/Microsoft.ReactNative/Fabric/AbiState.cpp +71 -0
- package/Microsoft.ReactNative/Fabric/AbiState.h +38 -0
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +48 -19
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.h +8 -16
- package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +97 -0
- package/Microsoft.ReactNative/Fabric/AbiViewProps.h +39 -0
- package/Microsoft.ReactNative/Fabric/AbiViewShadowNode.cpp +90 -0
- package/Microsoft.ReactNative/Fabric/AbiViewShadowNode.h +87 -0
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +340 -0
- package/Microsoft.ReactNative/Fabric/ComponentView.h +130 -64
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +48 -24
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.h +18 -14
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +42 -27
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.h +3 -1
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +123 -28
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +69 -13
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +651 -284
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.h +7 -7
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper_emptyimpl.cpp +9 -9
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +120 -31
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +12 -2
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +308 -129
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +34 -6
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHelpers.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +61 -54
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.h +0 -9
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +99 -30
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +4 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.cpp +273 -28
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.h +28 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView_emptyimpl.cpp +7 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService.cpp +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +479 -280
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +133 -79
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +113 -0
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.h +39 -0
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +61 -41
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +19 -14
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +39 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +343 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +67 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +18 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +39 -0
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +53 -186
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +20 -12
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +59 -150
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +27 -76
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +81 -32
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +27 -14
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +707 -64
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +47 -26
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +225 -125
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +34 -21
- package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.cpp +179 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.h +25 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +110 -115
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +228 -79
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +43 -22
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.cpp +18 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h +12 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.h +5 -5
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +5 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +4 -44
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h +11 -9
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +550 -0
- package/Microsoft.ReactNative/Fabric/Composition/Theme.h +73 -0
- package/Microsoft.ReactNative/Fabric/Composition/Theme_emptyimpl.cpp +85 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +48 -26
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +6 -2
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +30 -65
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.h +16 -25
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +72 -88
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +5 -2
- package/Microsoft.ReactNative/Fabric/IComponentViewRegistry.h +3 -2
- package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.cpp +6 -6
- package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.h +2 -2
- package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +12 -7
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +28 -19
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.h +5 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +5 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/WindowsViewEvents.h +2 -4
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/Float.h +20 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +86 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorParser.h +38 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/{Color.cpp → PlatformColorUtils.cpp} +7 -77
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.h +12 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +1 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.h +2 -0
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +6 -87
- package/Microsoft.ReactNative/IReactContext.idl +3 -0
- package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +71 -1
- package/Microsoft.ReactNative/JsiApi.cpp +17 -7
- package/Microsoft.ReactNative/JsiApi.h +2 -2
- package/Microsoft.ReactNative/JsiApi.idl +5 -4
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +13 -22
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +6 -2
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.h +1 -1
- package/Microsoft.ReactNative/Modules/AlertModule.h +2 -2
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +12 -8
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +1 -1
- package/Microsoft.ReactNative/Modules/AppStateModule.h +2 -2
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +5 -3
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.h +4 -4
- package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +10 -1
- package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +71 -38
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.h +5 -5
- package/Microsoft.ReactNative/Modules/ExceptionsManager.cpp +110 -0
- package/Microsoft.ReactNative/Modules/ExceptionsManager.h +54 -0
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.h +11 -10
- package/Microsoft.ReactNative/Modules/LinkingManagerModule.h +8 -6
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +3 -3
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +5 -28
- package/Microsoft.ReactNative/Modules/NativeUIManager.h +1 -1
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +8 -5
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.h +3 -3
- package/Microsoft.ReactNative/Modules/PlatformConstantsWinModule.cpp +49 -0
- package/Microsoft.ReactNative/Modules/PlatformConstantsWinModule.h +18 -0
- package/Microsoft.ReactNative/Modules/SourceCode.cpp +31 -0
- package/Microsoft.ReactNative/Modules/SourceCode.h +28 -0
- package/Microsoft.ReactNative/Modules/StatusBarManager.h +12 -0
- package/Microsoft.ReactNative/Modules/Timing.cpp +325 -0
- package/Microsoft.ReactNative/Modules/Timing.h +121 -0
- package/Microsoft.ReactNative/QuirkSettings.cpp +32 -0
- package/Microsoft.ReactNative/QuirkSettings.h +9 -0
- package/Microsoft.ReactNative/QuirkSettings.idl +6 -0
- package/Microsoft.ReactNative/ReactCoreInjection.cpp +15 -0
- package/Microsoft.ReactNative/ReactCoreInjection.h +4 -0
- package/Microsoft.ReactNative/ReactCoreInjection.idl +8 -0
- package/Microsoft.ReactNative/ReactHost/IReactInstance.h +1 -1
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +1 -1
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +556 -234
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +36 -9
- package/Microsoft.ReactNative/ReactInstanceSettings.idl +3 -0
- package/Microsoft.ReactNative/ReactPointerEventArgs.cpp +8 -0
- package/Microsoft.ReactNative/ReactPointerEventArgs.h +4 -0
- package/Microsoft.ReactNative/ReactPointerEventArgs.idl +12 -0
- package/Microsoft.ReactNative/SchedulerSettings.cpp +23 -0
- package/Microsoft.ReactNative/SchedulerSettings.h +9 -1
- package/Microsoft.ReactNative/SynchronousEventBeat.cpp +41 -0
- package/Microsoft.ReactNative/SynchronousEventBeat.h +29 -0
- package/Microsoft.ReactNative/Theme.idl +57 -0
- package/Microsoft.ReactNative/Timer.cpp +63 -0
- package/Microsoft.ReactNative/{CoreAppPage.h → Timer.h} +12 -5
- package/Microsoft.ReactNative/Timer.idl +34 -0
- package/Microsoft.ReactNative/TurboModulesProvider.cpp +4 -0
- package/Microsoft.ReactNative/Utils/ImageUtils.cpp +37 -3
- package/Microsoft.ReactNative/Utils/ImageUtils.h +0 -1
- package/Microsoft.ReactNative/Utils/LocalBundleReader.cpp +11 -12
- package/Microsoft.ReactNative/Utils/LocalBundleReader.h +3 -3
- package/Microsoft.ReactNative/Utils/ThemeUtils.cpp +33 -0
- package/Microsoft.ReactNative/Utils/ThemeUtils.h +13 -0
- package/Microsoft.ReactNative/Utils/ValueUtils.cpp +0 -5
- package/Microsoft.ReactNative/Utils/ValueUtils.h +0 -3
- package/Microsoft.ReactNative/ViewProps.idl +17 -0
- package/Microsoft.ReactNative/Views/ActivityIndicatorViewManager.cpp +1 -0
- package/Microsoft.ReactNative/Views/DebuggingOverlayViewManager.cpp +54 -0
- package/Microsoft.ReactNative/Views/DebuggingOverlayViewManager.h +30 -0
- package/Microsoft.ReactNative/Views/DevMenu.cpp +1 -20
- package/Microsoft.ReactNative/Views/DynamicAutomationPeer.cpp +157 -0
- package/Microsoft.ReactNative/Views/DynamicAutomationPeer.h +5 -0
- package/Microsoft.ReactNative/Views/DynamicAutomationProperties.cpp +20 -0
- package/Microsoft.ReactNative/Views/DynamicAutomationProperties.h +4 -0
- package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +1 -5
- package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +137 -0
- package/Microsoft.ReactNative/Views/ICompositionRootView.h +0 -1
- package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +0 -5
- package/Microsoft.ReactNative/Views/PopupViewManager.cpp +1 -5
- package/Microsoft.ReactNative/Views/ShadowNodeBase.cpp +11 -0
- package/Microsoft.ReactNative/Views/ShadowNodeBase.h +3 -4
- package/Microsoft.ReactNative/Views/TextInputViewManager.cpp +0 -6
- package/Microsoft.ReactNative/Views/TextViewManager.cpp +0 -11
- package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +1 -1
- package/Microsoft.ReactNative/Views/UnimplementedViewManager.cpp +79 -0
- package/Microsoft.ReactNative/Views/UnimplementedViewManager.h +27 -0
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +46 -0
- package/Microsoft.ReactNative/Views/ViewManagerBase.h +1 -1
- package/Microsoft.ReactNative/Views/cppwinrt/DynamicAutomationPeer.idl +77 -2
- package/Microsoft.ReactNative/microsoft.reactnative.def +0 -3
- package/Microsoft.ReactNative/packages.lock.json +9 -6
- package/{Shared/Composition → Microsoft.ReactNative.Cxx}/AutoDraw.h +2 -0
- package/{Shared/Composition → Microsoft.ReactNative.Cxx}/CompositionSwitcher.interop.h +4 -10
- package/Microsoft.ReactNative.Cxx/CppWinRTIncludes.h +0 -5
- package/Microsoft.ReactNative.Cxx/DesktopWindowBridge.h +5 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +19 -10
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +2 -0
- package/Microsoft.ReactNative.Cxx/JSValueComposition.h +22 -0
- package/Microsoft.ReactNative.Cxx/JSValueReader.h +19 -0
- package/Microsoft.ReactNative.Cxx/JSValueXaml.h +1 -1
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +6 -4
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +0 -1
- package/Microsoft.ReactNative.Cxx/NativeModules.h +15 -15
- package/Microsoft.ReactNative.Cxx/TurboModuleProvider.cpp +1 -1
- package/Microsoft.ReactNative.Managed/ReactSettingsSnapshot.cs +2 -0
- package/Microsoft.ReactNative.Managed/packages.lock.json +6 -3
- package/Microsoft.ReactNative.Managed.CodeGen/Microsoft.ReactNative.Managed.CodeGen.csproj +0 -1
- package/Mso/future/details/executor.h +1 -1
- package/Mso/src/debugAssertApi/debugAssertApi.cpp +1 -1
- package/PropertySheets/External/Microsoft.ReactNative.Composition.Common.props +8 -0
- package/PropertySheets/External/Microsoft.ReactNative.Composition.CppLib.props +24 -0
- package/PropertySheets/External/Microsoft.ReactNative.Composition.CppLib.targets +20 -0
- package/PropertySheets/External/Microsoft.ReactNative.Cpp.Dependencies.props +1 -1
- package/PropertySheets/External/Microsoft.ReactNative.WindowsSdk.Default.props +2 -0
- package/PropertySheets/Generated/PackageVersion.g.props +4 -4
- package/PropertySheets/JSEngine.props +0 -8
- package/PropertySheets/React.Cpp.props +14 -3
- package/PropertySheets/ReactCommunity.cpp.props +2 -2
- package/PropertySheets/Release.props +0 -1
- package/PropertySheets/WinUI.props +21 -1
- package/PropertySheets/x64.props +3 -0
- package/PropertySheets/x86.props +3 -0
- package/ReactCommon/ReactCommon.vcxproj +13 -8
- package/ReactCommon/ReactCommon.vcxproj.filters +12 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +114 -19
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.cpp +66 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp +114 -52
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleUtils.h +13 -15
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/scrollview/ScrollViewProps.cpp +535 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +437 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/utils/jsi-utils.cpp +39 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/utils/jsi-utils.h +31 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/YGEnums.h +19 -24
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/algorithm/CalculateLayout.cpp +600 -980
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/enums/ExperimentalFeature.h +5 -11
- package/ReactCommon/cgmanifest.json +1 -1
- package/Scripts/EnableInternalWinAppSDKFeed.ps1 +21 -0
- package/Scripts/IntegrationTests.ps1 +26 -15
- package/Scripts/Microsoft.ReactNative.targets +0 -6
- package/Scripts/OfficeReact.Win32.nuspec +1 -2
- package/Scripts/TestServers.ps1 +2 -28
- package/Scripts/Tfs/Start-TestServers.ps1 +1 -21
- package/Scripts/Tfs/Stop-TestServers.ps1 +0 -5
- package/Scripts/rnw-dependencies.ps1 +38 -67
- package/Shared/CreateInstance.h +25 -0
- package/Shared/DevServerHelper.h +0 -3
- package/Shared/DevSettings.h +9 -0
- package/Shared/HermesRuntimeHolder.cpp +17 -0
- package/Shared/HermesRuntimeHolder.h +17 -0
- package/Shared/HermesSamplingProfiler.cpp +12 -10
- package/Shared/HermesSamplingProfiler.h +5 -4
- package/Shared/IDevSupportManager.h +4 -2
- package/Shared/InstanceManager.cpp +13 -11
- package/Shared/InstanceManager.h +8 -18
- package/Shared/JSI/ChakraRuntime.cpp +66 -9
- package/Shared/JSI/ChakraRuntime.h +8 -0
- package/Shared/JSI/JSExecutorFactoryDelegate.h +12 -0
- package/Shared/JSI/JSExecutorFactorySettings.cpp +30 -0
- package/Shared/JSI/JSExecutorFactorySettings.h +21 -0
- package/Shared/Modules/BlobModule.h +1 -1
- package/Shared/Modules/FileReaderModule.h +1 -1
- package/Shared/Modules/HttpModule.h +1 -1
- package/Shared/Modules/WebSocketTurboModule.h +1 -1
- package/Shared/Networking/OriginPolicyHttpFilter.cpp +19 -23
- package/Shared/Networking/OriginPolicyHttpFilter.h +4 -7
- package/Shared/Networking/WinRTHttpResource.cpp +2 -4
- package/Shared/OInstance.cpp +212 -165
- package/Shared/OInstance.h +19 -0
- package/Shared/Shared.vcxitems +134 -50
- package/Shared/Shared.vcxitems.filters +81 -24
- package/Shared/Utils.cpp +12 -10
- package/Shared/Utils.h +2 -2
- package/Shared/WebSocketJSExecutorFactory.h +1 -0
- package/codegen/NativeBugReportingSpec.g.h +0 -6
- package/codegen/NativeFrameRateLoggerSpec.g.h +0 -2
- package/codegen/NativeImageLoaderAndroidSpec.g.h +10 -23
- package/codegen/NativePerformanceObserverSpec.g.h +6 -0
- package/codegen/NativePlatformConstantsIOSSpec.g.h +2 -0
- package/codegen/NativePlatformConstantsWinSpec.g.h +17 -0
- package/codegen/NativePushNotificationManagerIOSSpec.g.h +8 -6
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +88 -0
- package/codegen/NativeUIManagerSpec.g.h +83 -95
- package/codegen/react/components/rnwcore/ComponentDescriptors.h +10 -7
- package/codegen/react/components/rnwcore/EventEmitters.cpp +40 -52
- package/codegen/react/components/rnwcore/EventEmitters.h +66 -84
- package/codegen/react/components/rnwcore/Props.cpp +60 -95
- package/codegen/react/components/rnwcore/Props.h +198 -239
- package/codegen/react/components/rnwcore/ShadowNodes.cpp +6 -7
- package/codegen/react/components/rnwcore/ShadowNodes.h +38 -29
- package/codegen/react/components/rnwcore/States.cpp +3 -5
- package/codegen/react/components/rnwcore/States.h +29 -16
- package/codegen/rnwcoreJSI-generated.cpp +1442 -1398
- package/codegen/rnwcoreJSI.h +6066 -3593
- package/index.js +66 -99
- package/index.windows.js +60 -102
- package/jest/assetFileTransformer.js +1 -1
- package/jest/local-setup.js +0 -5
- package/jest/mockModal.js +2 -1
- package/jest/mockScrollView.js +1 -2
- package/jest/renderer.js +1 -1
- package/jest/setup.js +6 -3
- package/just-task.js +1 -1
- package/package.json +30 -29
- package/{Libraries/Core → src/private/core}/setUpDOM.js +2 -2
- package/src/private/featureflags/NativeReactNativeFeatureFlags.js +42 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +140 -0
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +84 -0
- package/src/private/featureflags/__tests__/ReactNativeFeatureFlags-test.js +92 -0
- package/src/private/specs/components/ActivityIndicatorViewNativeComponent.js +53 -0
- package/src/private/specs/components/AndroidDrawerLayoutNativeComponent.js +124 -0
- package/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js +26 -0
- package/src/private/specs/components/AndroidSwipeRefreshLayoutNativeComponent.js +74 -0
- package/src/private/specs/components/AndroidSwitchNativeComponent.js +62 -0
- package/src/private/specs/components/DebuggingOverlayNativeComponent.js +61 -0
- package/src/private/specs/components/PopupMenuAndroidNativeComponent.js +47 -0
- package/src/private/specs/components/ProgressBarAndroidNativeComponent.js +36 -0
- package/src/private/specs/components/PullToRefreshViewNativeComponent.js +71 -0
- package/src/private/specs/components/RCTInputAccessoryViewNativeComponent.js +26 -0
- package/src/private/specs/components/RCTModalHostViewNativeComponent.js +139 -0
- package/src/private/specs/components/RCTSafeAreaViewNativeComponent.js +25 -0
- package/src/private/specs/components/SwitchNativeComponent.js +61 -0
- package/src/private/specs/components/UnimplementedNativeViewNativeComponent.js +26 -0
- package/src/private/specs/modules/NativeAccessibilityInfo.js +33 -0
- package/src/private/specs/modules/NativeAccessibilityManager.js +66 -0
- package/src/private/specs/modules/NativeActionSheetManager.js +54 -0
- package/src/private/specs/modules/NativeAlertManager.js +35 -0
- package/src/private/specs/modules/NativeAnimatedModule.js +77 -0
- package/src/private/specs/modules/NativeAnimatedTurboModule.js +78 -0
- package/src/private/specs/modules/NativeAnimationsDebugModule.js +20 -0
- package/src/private/specs/modules/NativeAppState.js +33 -0
- package/src/private/specs/modules/NativeAppTheme.js +33 -0
- package/src/private/specs/modules/NativeAppearance.js +36 -0
- package/src/private/specs/modules/NativeBlobModule.js +59 -0
- package/src/private/specs/modules/NativeBugReporting.js +20 -0
- package/src/private/specs/modules/NativeClipboard.js +21 -0
- package/src/private/specs/modules/NativeDevLoadingView.js +24 -0
- package/src/private/specs/modules/NativeDevMenu.js +23 -0
- package/src/private/specs/modules/NativeDevSettings.js +33 -0
- package/src/private/specs/modules/NativeDevToolsSettingsManager.js +24 -0
- package/src/private/specs/modules/NativeDeviceEventManager.js +19 -0
- package/src/private/specs/modules/NativeDeviceInfo.js +58 -0
- package/src/private/specs/modules/NativeDialogManagerAndroid.js +48 -0
- package/{Libraries/Alert → src/private/specs/modules}/NativeDialogManagerWindows.js +5 -4
- package/src/private/specs/modules/NativeExceptionsManager.js +103 -0
- package/src/private/specs/modules/NativeFileReaderModule.js +22 -0
- package/src/private/specs/modules/NativeFrameRateLogger.js +22 -0
- package/src/private/specs/modules/NativeHeadlessJsTaskSupport.js +20 -0
- package/src/private/specs/modules/NativeI18nManager.js +28 -0
- package/src/private/specs/modules/NativeImageEditor.js +52 -0
- package/src/private/specs/modules/NativeImageLoaderAndroid.js +30 -0
- package/src/private/specs/modules/NativeImageLoaderIOS.js +37 -0
- package/src/private/specs/modules/NativeImageStoreAndroid.js +26 -0
- package/src/private/specs/modules/NativeImageStoreIOS.js +33 -0
- package/src/private/specs/modules/NativeIntentAndroid.js +30 -0
- package/src/private/specs/modules/NativeIntersectionObserver.js +41 -0
- package/src/private/specs/modules/NativeJSCHeapCapture.js +19 -0
- package/src/private/specs/modules/NativeJSCSamplingProfiler.js +19 -0
- package/src/private/specs/modules/NativeKeyboardObserver.js +20 -0
- package/src/private/specs/modules/NativeLinkingManager.js +27 -0
- package/src/private/specs/modules/NativeLogBox.js +20 -0
- package/src/private/specs/modules/NativeModalManager.js +21 -0
- package/src/private/specs/modules/NativeMutationObserver.js +58 -0
- package/src/private/specs/modules/NativeNetworkingAndroid.js +37 -0
- package/src/private/specs/modules/NativeNetworkingIOS.js +37 -0
- package/src/private/specs/modules/NativePermissionsAndroid.js +77 -0
- package/src/private/specs/modules/NativePlatformConstantsAndroid.js +44 -0
- package/src/private/specs/modules/NativePlatformConstantsIOS.js +37 -0
- package/src/private/specs/modules/NativePlatformConstantsWin.js +38 -0
- package/src/private/specs/modules/NativePushNotificationManagerIOS.js +107 -0
- package/src/private/specs/modules/NativeRedBox.js +20 -0
- package/src/private/specs/modules/NativeSampleTurboModule.js +53 -0
- package/src/private/specs/modules/NativeSegmentFetcher.js +28 -0
- package/src/private/specs/modules/NativeSettingsManager.js +25 -0
- package/src/private/specs/modules/NativeShareModule.js +23 -0
- package/src/private/specs/modules/NativeSoundManager.js +22 -0
- package/src/private/specs/modules/NativeSourceCode.js +36 -0
- package/src/private/specs/modules/NativeStatusBarManagerAndroid.js +68 -0
- package/src/private/specs/modules/NativeStatusBarManagerIOS.js +89 -0
- package/src/private/specs/modules/NativeTiming.js +26 -0
- package/src/private/specs/modules/NativeToastAndroid.js +38 -0
- package/src/private/specs/modules/NativeUIManager.js +118 -0
- package/src/private/specs/modules/NativeVibration.js +24 -0
- package/src/private/specs/modules/NativeWebSocketModule.js +34 -0
- package/{Libraries/DOM/Nodes → src/private/webapis/dom/nodes}/ReactNativeElement.js +6 -6
- package/{Libraries/DOM/Nodes → src/private/webapis/dom/nodes}/ReadOnlyCharacterData.js +2 -2
- package/{Libraries/DOM/Nodes → src/private/webapis/dom/nodes}/ReadOnlyElement.js +5 -5
- package/{Libraries/DOM/Nodes → src/private/webapis/dom/nodes}/ReadOnlyNode.js +19 -10
- package/{Libraries/DOM/OldStyleCollections → src/private/webapis/dom/oldstylecollections}/DOMRectList.js +1 -1
- package/src/private/webapis/dom/oldstylecollections/__tests__/DOMRectList-test.js +85 -0
- package/src/private/webapis/dom/oldstylecollections/__tests__/HTMLCollection-test.js +80 -0
- package/src/private/webapis/dom/oldstylecollections/__tests__/NodeList-test.js +161 -0
- package/{Libraries/WebPerformance → src/private/webapis/performance}/NativePerformance.js +2 -2
- package/{Libraries/WebPerformance → src/private/webapis/performance}/NativePerformanceObserver.js +3 -2
- package/{Libraries/WebPerformance → src/private/webapis/performance}/Performance.js +2 -2
- package/{Libraries/WebPerformance → src/private/webapis/performance}/PerformanceEventTiming.js +1 -1
- package/{Libraries/WebPerformance → src/private/webapis/performance}/PerformanceObserver.js +21 -2
- package/{Libraries/WebPerformance → src/private/webapis/performance}/RawPerformanceEntry.js +1 -1
- package/{Libraries/WebPerformance → src/private/webapis/performance}/__mocks__/NativePerformanceObserver.js +9 -0
- package/src/private/webapis/performance/__tests__/EventCounts-test.js +116 -0
- package/src/private/webapis/performance/__tests__/NativePerformanceMock-test.js +82 -0
- package/src/private/webapis/performance/__tests__/NativePerformanceObserverMock-test.js +108 -0
- package/src/private/webapis/performance/__tests__/Performance-test.js +117 -0
- package/src/private/webapis/performance/__tests__/PerformanceObserver-test.js +208 -0
- package/template/cpp-app/src/App.cpp +2 -2
- package/template/cs-app/src/App.xaml.cs +2 -2
- package/templates/cpp-app/jest.config.windows.js +3 -0
- package/templates/cpp-app/metro.config.js +0 -2
- package/templates/cpp-app/template.config.js +24 -9
- package/templates/cpp-app/windows/ExperimentalFeatures.props +1 -1
- package/templates/cpp-app/windows/MyApp/AutolinkedNativeModules.g.cpp +13 -0
- package/templates/cpp-app/windows/MyApp/AutolinkedNativeModules.g.h +10 -0
- package/templates/cpp-app/windows/MyApp/MyApp.cpp +134 -249
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +12 -11
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj.filters +6 -3
- package/templates/cpp-app/windows/MyApp/pch.h +12 -9
- package/templates/cpp-app/windows/MyApp/resource.h +0 -1
- package/templates/cpp-app/windows/MyApp.sln +26 -26
- package/templates/cpp-lib/example/metro.config.js +74 -0
- package/templates/cpp-lib/template.config.js +235 -0
- package/templates/cpp-lib/windows/ExperimentalFeatures.props +11 -0
- package/templates/cpp-lib/windows/MyLib/MyLib.cpp +18 -0
- package/templates/cpp-lib/windows/MyLib/MyLib.def +3 -0
- package/templates/cpp-lib/windows/MyLib/MyLib.h +31 -0
- package/templates/cpp-lib/windows/MyLib/MyLib.rc +0 -0
- package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +148 -0
- package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj.filters +44 -0
- package/templates/cpp-lib/windows/MyLib/ReactPackageProvider.cpp +20 -0
- package/templates/cpp-lib/windows/MyLib/ReactPackageProvider.h +24 -0
- package/templates/cpp-lib/windows/MyLib/ReactPackageProvider.idl +9 -0
- package/templates/cpp-lib/windows/MyLib/pch.cpp +1 -0
- package/templates/cpp-lib/windows/MyLib/pch.h +30 -0
- package/templates/cpp-lib/windows/MyLib/resource.h +5 -0
- package/templates/cpp-lib/windows/MyLib/targetver.h +8 -0
- package/templates/cpp-lib/windows/MyLib.sln +156 -0
- package/templates/cpp-lib/windows/_gitignore +41 -0
- package/templates/templateUtils.js +137 -0
- package/types/modules/globals.d.ts +1 -0
- package/Folly/TEMP_UntilFollyUpdate/hash/Hash.h +0 -1016
- package/Libraries/Components/Button.flow.js +0 -265
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.windows.js +0 -8
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.windows.js +0 -14
- package/Libraries/Components/SafeAreaView/SafeAreaView.windows.js +0 -34
- package/Libraries/Components/ScrollView/ScrollView.windows.js +0 -1941
- package/Libraries/Components/ScrollView/ScrollViewViewConfig.js +0 -85
- package/Libraries/Components/ToastAndroid/ToastAndroid.windows.js +0 -45
- package/Libraries/Components/Touchable/Touchable.flow.js +0 -284
- package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlay.js +0 -189
- package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlayNativeComponent.js +0 -43
- package/Libraries/Image/Image.flow.js +0 -64
- package/Libraries/Inspector/DevtoolsOverlay.js +0 -223
- package/Libraries/Performance/QuickPerformanceLogger.js +0 -142
- package/Libraries/Settings/Settings.windows.js +0 -28
- package/Microsoft.ReactNative/CoreApp.cpp +0 -303
- package/Microsoft.ReactNative/CoreAppPage.cpp +0 -21
- package/Microsoft.ReactNative/CoreAppPage.idl +0 -12
- package/Microsoft.ReactNative/CoreAppPage.xaml +0 -14
- package/Microsoft.ReactNative/Fabric/Composition/AbiCompositionViewComponentView.cpp +0 -197
- package/Microsoft.ReactNative/Fabric/Composition/AbiCompositionViewComponentView.h +0 -84
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/rnwcore/EventEmitters.h +0 -5
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/rnwcore/Props.h +0 -5
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/rnwcore/ShadowNodes.h +0 -5
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/rnwcore/States.h +0 -5
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/core/graphicsConversions.h +0 -245
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/Color.h +0 -134
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/conversions.h +0 -27
- package/Microsoft.ReactNative/Modules/TimingModule.cpp +0 -229
- package/Microsoft.ReactNative/Modules/TimingModule.h +0 -88
- package/Microsoft.ReactNative.Cxx/CoreApp.h +0 -60
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/LongLivedObject.cpp +0 -60
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/LongLivedObject.h +0 -60
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleBinding.h +0 -63
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/YogaLayoutableShadowNode.cpp +0 -1038
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/YogaStylableProps.cpp +0 -503
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/conversions.h +0 -895
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/mapbuffer/MapBufferBuilder.cpp +0 -182
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/mounting/ShadowTree.cpp +0 -543
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManagerBinding.cpp +0 -1505
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/bits/NumericBitfield.h +0 -67
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.h +0 -93
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.h +0 -88
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/Node.cpp +0 -606
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/Node.h +0 -344
- package/ReactCommon/Yoga.cpp +0 -961
- /package/{Libraries/DOM/Geometry → src/private/webapis/dom/geometry}/DOMRect.js +0 -0
- /package/{Libraries/DOM/Geometry → src/private/webapis/dom/geometry}/DOMRectReadOnly.js +0 -0
- /package/{Libraries/DOM/Nodes → src/private/webapis/dom/nodes}/ReadOnlyText.js +0 -0
- /package/{Libraries/DOM/Nodes/Utilities → src/private/webapis/dom/nodes/utilities}/Traversal.js +0 -0
- /package/{Libraries/DOM/OldStyleCollections → src/private/webapis/dom/oldstylecollections}/ArrayLikeUtils.js +0 -0
- /package/{Libraries/DOM/OldStyleCollections → src/private/webapis/dom/oldstylecollections}/HTMLCollection.js +0 -0
- /package/{Libraries/DOM/OldStyleCollections → src/private/webapis/dom/oldstylecollections}/NodeList.js +0 -0
- /package/{Libraries/WebPerformance → src/private/webapis/performance}/EventCounts.js +0 -0
- /package/{Libraries/WebPerformance → src/private/webapis/performance}/MemoryInfo.js +0 -0
- /package/{Libraries/WebPerformance → src/private/webapis/performance}/PerformanceEntry.js +0 -0
- /package/{Libraries/WebPerformance → src/private/webapis/performance}/ReactNativeStartupTiming.js +0 -0
- /package/{Libraries/WebPerformance → src/private/webapis/performance}/__mocks__/NativePerformance.js +0 -0
|
@@ -1,1016 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* folly::hash provides hashing algorithms, as well as algorithms to combine
|
|
19
|
-
* multiple hashes/hashable objects together.
|
|
20
|
-
*
|
|
21
|
-
* @refcode folly/docs/examples/folly/hash/Hash.cpp
|
|
22
|
-
* @file hash/Hash.h
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
#pragma once
|
|
26
|
-
|
|
27
|
-
#include <cstdint>
|
|
28
|
-
#include <cstring>
|
|
29
|
-
#include <limits>
|
|
30
|
-
#include <memory>
|
|
31
|
-
#include <string>
|
|
32
|
-
#include <tuple>
|
|
33
|
-
#include <type_traits>
|
|
34
|
-
#include <utility>
|
|
35
|
-
|
|
36
|
-
#include <folly/CPortability.h>
|
|
37
|
-
#include <folly/Traits.h>
|
|
38
|
-
#include <folly/Utility.h>
|
|
39
|
-
#include <folly/functional/ApplyTuple.h>
|
|
40
|
-
#include <folly/hash/SpookyHashV1.h>
|
|
41
|
-
#include <folly/hash/SpookyHashV2.h>
|
|
42
|
-
#include <folly/lang/Bits.h>
|
|
43
|
-
|
|
44
|
-
#if FOLLY_HAS_STRING_VIEW
|
|
45
|
-
#include <string_view>
|
|
46
|
-
#endif
|
|
47
|
-
|
|
48
|
-
namespace folly {
|
|
49
|
-
namespace hash {
|
|
50
|
-
|
|
51
|
-
namespace detail {
|
|
52
|
-
|
|
53
|
-
namespace {
|
|
54
|
-
|
|
55
|
-
template <typename T>
|
|
56
|
-
constexpr bool is_hashable_byte_v = false;
|
|
57
|
-
template <>
|
|
58
|
-
constexpr bool is_hashable_byte_v<char> = true;
|
|
59
|
-
template <>
|
|
60
|
-
constexpr bool is_hashable_byte_v<signed char> = true;
|
|
61
|
-
template <>
|
|
62
|
-
constexpr bool is_hashable_byte_v<unsigned char> = true;
|
|
63
|
-
|
|
64
|
-
} // namespace
|
|
65
|
-
|
|
66
|
-
} // namespace detail
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Reduce two 64-bit hashes into one.
|
|
70
|
-
*
|
|
71
|
-
* hash_128_to_64 uses the Hash128to64 function from Google's cityhash (under
|
|
72
|
-
* the MIT License).
|
|
73
|
-
*/
|
|
74
|
-
FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER("unsigned-integer-overflow")
|
|
75
|
-
constexpr uint64_t hash_128_to_64(
|
|
76
|
-
const uint64_t upper, const uint64_t lower) noexcept {
|
|
77
|
-
// Murmur-inspired hashing.
|
|
78
|
-
const uint64_t kMul = 0x9ddfea08eb382d69ULL;
|
|
79
|
-
uint64_t a = (lower ^ upper) * kMul;
|
|
80
|
-
a ^= (a >> 47);
|
|
81
|
-
uint64_t b = (upper ^ a) * kMul;
|
|
82
|
-
b ^= (b >> 47);
|
|
83
|
-
b *= kMul;
|
|
84
|
-
return b;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Order-independent reduction of two 64-bit hashes into one.
|
|
89
|
-
*
|
|
90
|
-
* Commutative accumulator taken from this paper:
|
|
91
|
-
* https://www.preprints.org/manuscript/201710.0192/v1/download
|
|
92
|
-
*/
|
|
93
|
-
FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER("unsigned-integer-overflow")
|
|
94
|
-
constexpr uint64_t commutative_hash_128_to_64(
|
|
95
|
-
const uint64_t upper, const uint64_t lower) noexcept {
|
|
96
|
-
return 3860031 + (upper + lower) * 2779 + (upper * lower * 2);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Thomas Wang 64 bit mix hash function.
|
|
101
|
-
*
|
|
102
|
-
* @methodset twang
|
|
103
|
-
*/
|
|
104
|
-
FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER("unsigned-integer-overflow")
|
|
105
|
-
constexpr uint64_t twang_mix64(uint64_t key) noexcept {
|
|
106
|
-
key = (~key) + (key << 21); // key *= (1 << 21) - 1; key -= 1;
|
|
107
|
-
key = key ^ (key >> 24);
|
|
108
|
-
key = key + (key << 3) + (key << 8); // key *= 1 + (1 << 3) + (1 << 8)
|
|
109
|
-
key = key ^ (key >> 14);
|
|
110
|
-
key = key + (key << 2) + (key << 4); // key *= 1 + (1 << 2) + (1 << 4)
|
|
111
|
-
key = key ^ (key >> 28);
|
|
112
|
-
key = key + (key << 31); // key *= 1 + (1 << 31)
|
|
113
|
-
return key;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Inverse of twang_mix64.
|
|
118
|
-
*
|
|
119
|
-
* @methodset twang
|
|
120
|
-
*/
|
|
121
|
-
constexpr uint64_t twang_unmix64(uint64_t key) noexcept {
|
|
122
|
-
// See the comments in jenkins_rev_unmix32 for an explanation as to how this
|
|
123
|
-
// was generated
|
|
124
|
-
key *= 4611686016279904257U;
|
|
125
|
-
key ^= (key >> 28) ^ (key >> 56);
|
|
126
|
-
key *= 14933078535860113213U;
|
|
127
|
-
key ^= (key >> 14) ^ (key >> 28) ^ (key >> 42) ^ (key >> 56);
|
|
128
|
-
key *= 15244667743933553977U;
|
|
129
|
-
key ^= (key >> 24) ^ (key >> 48);
|
|
130
|
-
key = (key + 1) * 9223367638806167551U;
|
|
131
|
-
return key;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Thomas Wang downscaling hash function.
|
|
136
|
-
*
|
|
137
|
-
* @methodset twang
|
|
138
|
-
*/
|
|
139
|
-
constexpr uint32_t twang_32from64(uint64_t key) noexcept {
|
|
140
|
-
key = (~key) + (key << 18);
|
|
141
|
-
key = key ^ (key >> 31);
|
|
142
|
-
key = key * 21;
|
|
143
|
-
key = key ^ (key >> 11);
|
|
144
|
-
key = key + (key << 6);
|
|
145
|
-
key = key ^ (key >> 22);
|
|
146
|
-
return static_cast<uint32_t>(key);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Robert Jenkins' reversible 32 bit mix hash function.
|
|
151
|
-
*
|
|
152
|
-
* @methodset jenkins
|
|
153
|
-
*/
|
|
154
|
-
constexpr uint32_t jenkins_rev_mix32(uint32_t key) noexcept {
|
|
155
|
-
key += (key << 12); // key *= (1 + (1 << 12))
|
|
156
|
-
key ^= (key >> 22);
|
|
157
|
-
key += (key << 4); // key *= (1 + (1 << 4))
|
|
158
|
-
key ^= (key >> 9);
|
|
159
|
-
key += (key << 10); // key *= (1 + (1 << 10))
|
|
160
|
-
key ^= (key >> 2);
|
|
161
|
-
// key *= (1 + (1 << 7)) * (1 + (1 << 12))
|
|
162
|
-
key += (key << 7);
|
|
163
|
-
key += (key << 12);
|
|
164
|
-
return key;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Inverse of jenkins_rev_mix32.
|
|
169
|
-
*
|
|
170
|
-
* @methodset jenkins
|
|
171
|
-
*/
|
|
172
|
-
constexpr uint32_t jenkins_rev_unmix32(uint32_t key) noexcept {
|
|
173
|
-
// These are the modular multiplicative inverses (in Z_2^32) of the
|
|
174
|
-
// multiplication factors in jenkins_rev_mix32, in reverse order. They were
|
|
175
|
-
// computed using the Extended Euclidean algorithm, see
|
|
176
|
-
// http://en.wikipedia.org/wiki/Modular_multiplicative_inverse
|
|
177
|
-
key *= 2364026753U;
|
|
178
|
-
|
|
179
|
-
// The inverse of a ^= (a >> n) is
|
|
180
|
-
// b = a
|
|
181
|
-
// for (int i = n; i < 32; i += n) {
|
|
182
|
-
// b ^= (a >> i);
|
|
183
|
-
// }
|
|
184
|
-
key ^= (key >> 2) ^ (key >> 4) ^ (key >> 6) ^ (key >> 8) ^ (key >> 10) ^
|
|
185
|
-
(key >> 12) ^ (key >> 14) ^ (key >> 16) ^ (key >> 18) ^ (key >> 20) ^
|
|
186
|
-
(key >> 22) ^ (key >> 24) ^ (key >> 26) ^ (key >> 28) ^ (key >> 30);
|
|
187
|
-
key *= 3222273025U;
|
|
188
|
-
key ^= (key >> 9) ^ (key >> 18) ^ (key >> 27);
|
|
189
|
-
key *= 4042322161U;
|
|
190
|
-
key ^= (key >> 22);
|
|
191
|
-
key *= 16773121U;
|
|
192
|
-
return key;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// fnv
|
|
196
|
-
//
|
|
197
|
-
// Fowler / Noll / Vo (FNV) Hash
|
|
198
|
-
// http://www.isthe.com/chongo/tech/comp/fnv/
|
|
199
|
-
//
|
|
200
|
-
// Discouraged for poor performance in the smhasher suite.
|
|
201
|
-
|
|
202
|
-
constexpr uint32_t fnv32_hash_start = 2166136261UL;
|
|
203
|
-
constexpr uint64_t fnv64_hash_start = 14695981039346656037ULL;
|
|
204
|
-
constexpr uint64_t fnva64_hash_start = 14695981039346656037ULL;
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Append byte to FNV hash.
|
|
208
|
-
*
|
|
209
|
-
* @see fnv32
|
|
210
|
-
* @methodset fnv
|
|
211
|
-
*/
|
|
212
|
-
constexpr uint32_t fnv32_append_byte(uint32_t hash, uint8_t c) {
|
|
213
|
-
hash = hash //
|
|
214
|
-
+ (hash << 1) //
|
|
215
|
-
+ (hash << 4) //
|
|
216
|
-
+ (hash << 7) //
|
|
217
|
-
+ (hash << 8) //
|
|
218
|
-
+ (hash << 24);
|
|
219
|
-
// forcing signed char, since other platforms can use unsigned
|
|
220
|
-
hash ^= static_cast<int8_t>(c);
|
|
221
|
-
return hash;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* FNV hash of a byte-range.
|
|
226
|
-
*
|
|
227
|
-
* @param hash The initial hash seed.
|
|
228
|
-
*
|
|
229
|
-
* @see fnv32
|
|
230
|
-
* @methodset fnv
|
|
231
|
-
*/
|
|
232
|
-
template <typename C, std::enable_if_t<detail::is_hashable_byte_v<C>, int> = 0>
|
|
233
|
-
constexpr uint32_t fnv32_buf(
|
|
234
|
-
const C* buf, size_t n, uint32_t hash = fnv32_hash_start) noexcept {
|
|
235
|
-
for (size_t i = 0; i < n; ++i) {
|
|
236
|
-
hash = fnv32_append_byte(hash, static_cast<uint8_t>(buf[i]));
|
|
237
|
-
}
|
|
238
|
-
return hash;
|
|
239
|
-
}
|
|
240
|
-
inline uint32_t fnv32_buf(
|
|
241
|
-
const void* buf, size_t n, uint32_t hash = fnv32_hash_start) noexcept {
|
|
242
|
-
return fnv32_buf(reinterpret_cast<const uint8_t*>(buf), n, hash);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* FNV hash of a c-str.
|
|
247
|
-
*
|
|
248
|
-
* Continues hashing until a null byte is reached.
|
|
249
|
-
*
|
|
250
|
-
* @param hash The initial hash seed.
|
|
251
|
-
*
|
|
252
|
-
* @methodset fnv
|
|
253
|
-
*/
|
|
254
|
-
constexpr uint32_t fnv32(
|
|
255
|
-
const char* buf, uint32_t hash = fnv32_hash_start) noexcept {
|
|
256
|
-
for (; *buf; ++buf) {
|
|
257
|
-
hash = fnv32_append_byte(hash, static_cast<uint8_t>(*buf));
|
|
258
|
-
}
|
|
259
|
-
return hash;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* @overloadbrief FNV hash of a string.
|
|
264
|
-
*
|
|
265
|
-
* FNV is the Fowler / Noll / Vo Hash:
|
|
266
|
-
* http://www.isthe.com/chongo/tech/comp/fnv/
|
|
267
|
-
*
|
|
268
|
-
* Discouraged for poor performance in the smhasher suite.
|
|
269
|
-
*
|
|
270
|
-
* @param hash The initial hash seed.
|
|
271
|
-
*
|
|
272
|
-
* @methodset fnv
|
|
273
|
-
*/
|
|
274
|
-
inline uint32_t fnv32(
|
|
275
|
-
const std::string& str, uint32_t hash = fnv32_hash_start) noexcept {
|
|
276
|
-
return fnv32_buf(str.data(), str.size(), hash);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Append a byte to FNV hash.
|
|
281
|
-
*
|
|
282
|
-
* @see fnv32
|
|
283
|
-
* @methodset fnv
|
|
284
|
-
*/
|
|
285
|
-
constexpr uint64_t fnv64_append_byte(uint64_t hash, uint8_t c) {
|
|
286
|
-
hash = hash //
|
|
287
|
-
+ (hash << 1) //
|
|
288
|
-
+ (hash << 4) //
|
|
289
|
-
+ (hash << 5) //
|
|
290
|
-
+ (hash << 7) //
|
|
291
|
-
+ (hash << 8) //
|
|
292
|
-
+ (hash << 40);
|
|
293
|
-
// forcing signed char, since other platforms can use unsigned
|
|
294
|
-
hash ^= static_cast<int8_t>(c);
|
|
295
|
-
return hash;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* FNV hash of a byte-range.
|
|
300
|
-
*
|
|
301
|
-
* @param hash The initial hash seed.
|
|
302
|
-
*
|
|
303
|
-
* @see fnv32
|
|
304
|
-
* @methodset fnv
|
|
305
|
-
*/
|
|
306
|
-
template <typename C, std::enable_if_t<detail::is_hashable_byte_v<C>, int> = 0>
|
|
307
|
-
constexpr uint64_t fnv64_buf(
|
|
308
|
-
const C* buf, size_t n, uint64_t hash = fnv64_hash_start) noexcept {
|
|
309
|
-
for (size_t i = 0; i < n; ++i) {
|
|
310
|
-
hash = fnv64_append_byte(hash, static_cast<uint8_t>(buf[i]));
|
|
311
|
-
}
|
|
312
|
-
return hash;
|
|
313
|
-
}
|
|
314
|
-
inline uint64_t fnv64_buf(
|
|
315
|
-
const void* buf, size_t n, uint64_t hash = fnv64_hash_start) noexcept {
|
|
316
|
-
return fnv64_buf(reinterpret_cast<const uint8_t*>(buf), n, hash);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* FNV hash of a c-str.
|
|
321
|
-
*
|
|
322
|
-
* Continues hashing until a null byte is reached.
|
|
323
|
-
*
|
|
324
|
-
* @param hash The initial hash seed.
|
|
325
|
-
*
|
|
326
|
-
* @see fnv32
|
|
327
|
-
* @methodset fnv
|
|
328
|
-
*/
|
|
329
|
-
constexpr uint64_t fnv64(
|
|
330
|
-
const char* buf, uint64_t hash = fnv64_hash_start) noexcept {
|
|
331
|
-
for (; *buf; ++buf) {
|
|
332
|
-
hash = fnv64_append_byte(hash, static_cast<uint8_t>(*buf));
|
|
333
|
-
}
|
|
334
|
-
return hash;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* @overloadbrief FNV hash of a string.
|
|
339
|
-
*
|
|
340
|
-
* FNV is the Fowler / Noll / Vo Hash:
|
|
341
|
-
* http://www.isthe.com/chongo/tech/comp/fnv/
|
|
342
|
-
*
|
|
343
|
-
* Discouraged for poor performance in the smhasher suite.
|
|
344
|
-
*
|
|
345
|
-
* @param hash The initial hash seed.
|
|
346
|
-
*
|
|
347
|
-
* @see fnv32
|
|
348
|
-
* @methodset fnv
|
|
349
|
-
*/
|
|
350
|
-
inline uint64_t fnv64(
|
|
351
|
-
const std::string& str, uint64_t hash = fnv64_hash_start) noexcept {
|
|
352
|
-
return fnv64_buf(str.data(), str.size(), hash);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* Append a byte to FNVA hash.
|
|
357
|
-
*
|
|
358
|
-
* @see fnv32
|
|
359
|
-
* @methodset fnv
|
|
360
|
-
*/
|
|
361
|
-
constexpr uint64_t fnva64_append_byte(uint64_t hash, uint8_t c) {
|
|
362
|
-
hash ^= c;
|
|
363
|
-
hash = hash //
|
|
364
|
-
+ (hash << 1) //
|
|
365
|
-
+ (hash << 4) //
|
|
366
|
-
+ (hash << 5) //
|
|
367
|
-
+ (hash << 7) //
|
|
368
|
-
+ (hash << 8) //
|
|
369
|
-
+ (hash << 40);
|
|
370
|
-
return hash;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* FNVA hash of a byte-range.
|
|
375
|
-
*
|
|
376
|
-
* @param hash The initial hash seed.
|
|
377
|
-
*
|
|
378
|
-
* @see fnv32
|
|
379
|
-
* @methodset fnv
|
|
380
|
-
*/
|
|
381
|
-
template <typename C, std::enable_if_t<detail::is_hashable_byte_v<C>, int> = 0>
|
|
382
|
-
constexpr uint64_t fnva64_buf(
|
|
383
|
-
const C* buf, size_t n, uint64_t hash = fnva64_hash_start) noexcept {
|
|
384
|
-
for (size_t i = 0; i < n; ++i) {
|
|
385
|
-
hash = fnva64_append_byte(hash, static_cast<uint8_t>(buf[i]));
|
|
386
|
-
}
|
|
387
|
-
return hash;
|
|
388
|
-
}
|
|
389
|
-
inline uint64_t fnva64_buf(
|
|
390
|
-
const void* buf, size_t n, uint64_t hash = fnva64_hash_start) noexcept {
|
|
391
|
-
return fnva64_buf(reinterpret_cast<const uint8_t*>(buf), n, hash);
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* FNVA hash of a string.
|
|
396
|
-
*
|
|
397
|
-
* @param hash The initial hash seed.
|
|
398
|
-
*
|
|
399
|
-
* @see fnv32
|
|
400
|
-
* @methodset fnv
|
|
401
|
-
*/
|
|
402
|
-
inline uint64_t fnva64(
|
|
403
|
-
const std::string& str, uint64_t hash = fnva64_hash_start) noexcept {
|
|
404
|
-
return fnva64_buf(str.data(), str.size(), hash);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
// hsieh
|
|
408
|
-
//
|
|
409
|
-
// Paul Hsieh: http://www.azillionmonkeys.com/qed/hash.html
|
|
410
|
-
|
|
411
|
-
#define get16bits(d) folly::loadUnaligned<uint16_t>(d)
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* hsieh hash a byte-range.
|
|
415
|
-
*
|
|
416
|
-
* @see hsieh_hash32_str
|
|
417
|
-
* @methodset hsieh
|
|
418
|
-
*/
|
|
419
|
-
inline constexpr uint32_t hsieh_hash32_buf_constexpr(
|
|
420
|
-
const unsigned char* buf, size_t len) noexcept {
|
|
421
|
-
// forcing signed char, since other platforms can use unsigned
|
|
422
|
-
const unsigned char* s = buf;
|
|
423
|
-
uint32_t hash = static_cast<uint32_t>(len);
|
|
424
|
-
uint32_t tmp = 0;
|
|
425
|
-
size_t rem = 0;
|
|
426
|
-
|
|
427
|
-
if (len <= 0 || buf == nullptr) {
|
|
428
|
-
return 0;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
rem = len & 3;
|
|
432
|
-
len >>= 2;
|
|
433
|
-
|
|
434
|
-
/* Main loop */
|
|
435
|
-
for (; len > 0; len--) {
|
|
436
|
-
hash += get16bits(s);
|
|
437
|
-
tmp = (get16bits(s + 2) << 11) ^ hash;
|
|
438
|
-
hash = (hash << 16) ^ tmp;
|
|
439
|
-
s += 2 * sizeof(uint16_t);
|
|
440
|
-
hash += hash >> 11;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
/* Handle end cases */
|
|
444
|
-
switch (rem) {
|
|
445
|
-
case 3:
|
|
446
|
-
hash += get16bits(s);
|
|
447
|
-
hash ^= hash << 16;
|
|
448
|
-
hash ^= s[sizeof(uint16_t)] << 18;
|
|
449
|
-
hash += hash >> 11;
|
|
450
|
-
break;
|
|
451
|
-
case 2:
|
|
452
|
-
hash += get16bits(s);
|
|
453
|
-
hash ^= hash << 11;
|
|
454
|
-
hash += hash >> 17;
|
|
455
|
-
break;
|
|
456
|
-
case 1:
|
|
457
|
-
hash += *s;
|
|
458
|
-
hash ^= hash << 10;
|
|
459
|
-
hash += hash >> 1;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
/* Force "avalanching" of final 127 bits */
|
|
463
|
-
hash ^= hash << 3;
|
|
464
|
-
hash += hash >> 5;
|
|
465
|
-
hash ^= hash << 4;
|
|
466
|
-
hash += hash >> 17;
|
|
467
|
-
hash ^= hash << 25;
|
|
468
|
-
hash += hash >> 6;
|
|
469
|
-
|
|
470
|
-
return hash;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
#undef get16bits
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* hsieh hash a void* byte-range.
|
|
477
|
-
*
|
|
478
|
-
* @see hsieh_hash32_str
|
|
479
|
-
* @methodset hsieh
|
|
480
|
-
*/
|
|
481
|
-
inline uint32_t hsieh_hash32_buf(const void* buf, size_t len) noexcept {
|
|
482
|
-
return hsieh_hash32_buf_constexpr(
|
|
483
|
-
reinterpret_cast<const unsigned char*>(buf), len);
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* hsieh hash a c-str.
|
|
488
|
-
*
|
|
489
|
-
* Computes the strlen of the input, then byte-range hashes it.
|
|
490
|
-
*
|
|
491
|
-
* @see hsieh_hash32_str
|
|
492
|
-
* @methodset hsieh
|
|
493
|
-
*/
|
|
494
|
-
inline uint32_t hsieh_hash32(const char* s) noexcept {
|
|
495
|
-
return hsieh_hash32_buf(s, std::strlen(s));
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
/**
|
|
499
|
-
* hsieh hash a string.
|
|
500
|
-
*
|
|
501
|
-
* Paul Hsieh: http://www.azillionmonkeys.com/qed/hash.html
|
|
502
|
-
*
|
|
503
|
-
* @methodset hsieh
|
|
504
|
-
*/
|
|
505
|
-
inline uint32_t hsieh_hash32_str(const std::string& str) noexcept {
|
|
506
|
-
return hsieh_hash32_buf(str.data(), str.size());
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
} // namespace hash
|
|
510
|
-
|
|
511
|
-
namespace detail {
|
|
512
|
-
|
|
513
|
-
template <typename Int>
|
|
514
|
-
struct integral_hasher {
|
|
515
|
-
using folly_is_avalanching =
|
|
516
|
-
bool_constant<(sizeof(Int) >= 8 || sizeof(size_t) == 4)>;
|
|
517
|
-
|
|
518
|
-
constexpr size_t operator()(Int const& i) const noexcept {
|
|
519
|
-
static_assert(sizeof(Int) <= 16, "Input type is too wide");
|
|
520
|
-
/* constexpr */ if (sizeof(Int) <= 4) {
|
|
521
|
-
auto const i32 = static_cast<int32_t>(i); // impl accident: sign-extends
|
|
522
|
-
auto const u32 = static_cast<uint32_t>(i32);
|
|
523
|
-
return static_cast<size_t>(hash::jenkins_rev_mix32(u32));
|
|
524
|
-
} else if (sizeof(Int) <= 8) {
|
|
525
|
-
auto const u64 = static_cast<uint64_t>(i);
|
|
526
|
-
return static_cast<size_t>(hash::twang_mix64(u64));
|
|
527
|
-
} else {
|
|
528
|
-
auto const u = to_unsigned(i);
|
|
529
|
-
auto const hi = static_cast<uint64_t>(u >> sizeof(Int) * 4);
|
|
530
|
-
auto const lo = static_cast<uint64_t>(u);
|
|
531
|
-
// [Win] Added static_cast
|
|
532
|
-
return static_cast<size_t>(hash::hash_128_to_64(hi, lo));
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
template <typename F>
|
|
538
|
-
struct float_hasher {
|
|
539
|
-
using folly_is_avalanching = std::true_type;
|
|
540
|
-
|
|
541
|
-
size_t operator()(F const& f) const noexcept {
|
|
542
|
-
static_assert(sizeof(F) <= 8, "Input type is too wide");
|
|
543
|
-
|
|
544
|
-
if (f == F{}) { // Ensure 0 and -0 get the same hash.
|
|
545
|
-
return 0;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
uint64_t u64 = 0;
|
|
549
|
-
memcpy(&u64, &f, sizeof(F));
|
|
550
|
-
return static_cast<size_t>(hash::twang_mix64(u64));
|
|
551
|
-
}
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
} // namespace detail
|
|
555
|
-
|
|
556
|
-
template <class Key, class Enable = void>
|
|
557
|
-
struct hasher;
|
|
558
|
-
|
|
559
|
-
struct Hash {
|
|
560
|
-
template <class T>
|
|
561
|
-
constexpr size_t operator()(const T& v) const
|
|
562
|
-
noexcept(noexcept(hasher<T>()(v))) {
|
|
563
|
-
return hasher<T>()(v);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
template <class T, class... Ts>
|
|
567
|
-
constexpr size_t operator()(const T& t, const Ts&... ts) const {
|
|
568
|
-
return hash::hash_128_to_64((*this)(t), (*this)(ts...));
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
constexpr size_t operator()() const noexcept { return 0; }
|
|
572
|
-
};
|
|
573
|
-
|
|
574
|
-
// IsAvalanchingHasher<H, K> extends std::integral_constant<bool, V>.
|
|
575
|
-
// V will be true if it is known that when a hasher of type H computes
|
|
576
|
-
// the hash of a key of type K, any subset of B bits from the resulting
|
|
577
|
-
// hash value is usable in a context that can tolerate a collision rate
|
|
578
|
-
// of about 1/2^B. (Input bits lost implicitly converting between K and
|
|
579
|
-
// the argument of H::operator() are not considered here; K is separate
|
|
580
|
-
// to handle the case of generic hashers like folly::Hash).
|
|
581
|
-
//
|
|
582
|
-
// If std::hash<T> or folly::hasher<T> is specialized for a new type T and
|
|
583
|
-
// the implementation avalanches input entropy across all of the bits of a
|
|
584
|
-
// std::size_t result, the specialization should be marked as avalanching.
|
|
585
|
-
// This can be done either by adding a member type folly_is_avalanching
|
|
586
|
-
// to the functor H that contains a constexpr bool value of true, or by
|
|
587
|
-
// specializing IsAvalanchingHasher<H, K>. The member type mechanism is
|
|
588
|
-
// more convenient, but specializing IsAvalanchingHasher may be required
|
|
589
|
-
// if a hasher is polymorphic on the key type or if its definition cannot
|
|
590
|
-
// be modified.
|
|
591
|
-
//
|
|
592
|
-
// The standard's definition of hash quality is based on the chance hash
|
|
593
|
-
// collisions using the entire hash value. No requirement is made that
|
|
594
|
-
// this property holds for subsets of the bits. In addition, hashed keys
|
|
595
|
-
// in real-world workloads are not chosen uniformly from the entire domain
|
|
596
|
-
// of keys, which can further increase the collision rate for a subset
|
|
597
|
-
// of bits. For example, std::hash<uint64_t> in libstdc++-v3 and libc++
|
|
598
|
-
// is the identity function. This hash function has no collisions when
|
|
599
|
-
// considering hash values in their entirety, but for real-world workloads
|
|
600
|
-
// the high bits are likely to always be zero.
|
|
601
|
-
//
|
|
602
|
-
// Some hash functions provide a stronger guarantee -- the standard's
|
|
603
|
-
// collision property is also preserved for subsets of the output bits and
|
|
604
|
-
// for sub-domains of keys. Another way to say this is that each bit of
|
|
605
|
-
// the hash value contains entropy from the entire input, changes to the
|
|
606
|
-
// input avalanche across all of the bits of the output. The distinction
|
|
607
|
-
// is useful when mapping the hash value onto a smaller space efficiently
|
|
608
|
-
// (such as when implementing a hash table).
|
|
609
|
-
template <typename Hasher, typename Key>
|
|
610
|
-
struct IsAvalanchingHasher;
|
|
611
|
-
|
|
612
|
-
namespace detail {
|
|
613
|
-
template <typename Hasher, typename Void = void>
|
|
614
|
-
struct IsAvalanchingHasherFromMemberType : std::false_type {};
|
|
615
|
-
|
|
616
|
-
template <typename Hasher>
|
|
617
|
-
struct IsAvalanchingHasherFromMemberType<
|
|
618
|
-
Hasher,
|
|
619
|
-
void_t<typename Hasher::folly_is_avalanching>>
|
|
620
|
-
: bool_constant<Hasher::folly_is_avalanching::value> {};
|
|
621
|
-
} // namespace detail
|
|
622
|
-
|
|
623
|
-
template <typename Hasher, typename Key>
|
|
624
|
-
struct IsAvalanchingHasher : detail::IsAvalanchingHasherFromMemberType<Hasher> {
|
|
625
|
-
};
|
|
626
|
-
|
|
627
|
-
// It's ugly to put this here, but folly::transparent isn't hash specific
|
|
628
|
-
// so it seems even more ugly to put this near its declaration
|
|
629
|
-
template <typename H, typename K>
|
|
630
|
-
struct IsAvalanchingHasher<transparent<H>, K> : IsAvalanchingHasher<H, K> {};
|
|
631
|
-
|
|
632
|
-
template <typename K>
|
|
633
|
-
struct IsAvalanchingHasher<Hash, K> : IsAvalanchingHasher<hasher<K>, K> {};
|
|
634
|
-
|
|
635
|
-
template <>
|
|
636
|
-
struct hasher<bool> {
|
|
637
|
-
using folly_is_avalanching = std::true_type;
|
|
638
|
-
|
|
639
|
-
constexpr size_t operator()(bool key) const noexcept {
|
|
640
|
-
// Make sure that all the output bits depend on the input.
|
|
641
|
-
return key ? std::numeric_limits<size_t>::max() : 0;
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
|
-
template <typename K>
|
|
645
|
-
struct IsAvalanchingHasher<hasher<bool>, K> : std::true_type {};
|
|
646
|
-
|
|
647
|
-
template <>
|
|
648
|
-
struct hasher<unsigned long long>
|
|
649
|
-
: detail::integral_hasher<unsigned long long> {};
|
|
650
|
-
|
|
651
|
-
template <>
|
|
652
|
-
struct hasher<signed long long> : detail::integral_hasher<signed long long> {};
|
|
653
|
-
|
|
654
|
-
template <>
|
|
655
|
-
struct hasher<unsigned long> : detail::integral_hasher<unsigned long> {};
|
|
656
|
-
|
|
657
|
-
template <>
|
|
658
|
-
struct hasher<signed long> : detail::integral_hasher<signed long> {};
|
|
659
|
-
|
|
660
|
-
template <>
|
|
661
|
-
struct hasher<unsigned int> : detail::integral_hasher<unsigned int> {};
|
|
662
|
-
|
|
663
|
-
template <>
|
|
664
|
-
struct hasher<signed int> : detail::integral_hasher<signed int> {};
|
|
665
|
-
|
|
666
|
-
template <>
|
|
667
|
-
struct hasher<unsigned short> : detail::integral_hasher<unsigned short> {};
|
|
668
|
-
|
|
669
|
-
template <>
|
|
670
|
-
struct hasher<signed short> : detail::integral_hasher<signed short> {};
|
|
671
|
-
|
|
672
|
-
template <>
|
|
673
|
-
struct hasher<unsigned char> : detail::integral_hasher<unsigned char> {};
|
|
674
|
-
|
|
675
|
-
template <>
|
|
676
|
-
struct hasher<signed char> : detail::integral_hasher<signed char> {};
|
|
677
|
-
|
|
678
|
-
template <> // char is a different type from both signed char and unsigned char
|
|
679
|
-
struct hasher<char> : detail::integral_hasher<char> {};
|
|
680
|
-
|
|
681
|
-
#if FOLLY_HAVE_INT128_T
|
|
682
|
-
template <>
|
|
683
|
-
struct hasher<signed __int128> : detail::integral_hasher<signed __int128> {};
|
|
684
|
-
|
|
685
|
-
template <>
|
|
686
|
-
struct hasher<unsigned __int128> : detail::integral_hasher<unsigned __int128> {
|
|
687
|
-
};
|
|
688
|
-
#endif
|
|
689
|
-
|
|
690
|
-
template <>
|
|
691
|
-
struct hasher<float> : detail::float_hasher<float> {};
|
|
692
|
-
|
|
693
|
-
template <>
|
|
694
|
-
struct hasher<double> : detail::float_hasher<double> {};
|
|
695
|
-
|
|
696
|
-
template <>
|
|
697
|
-
struct hasher<std::string> {
|
|
698
|
-
using folly_is_avalanching = std::true_type;
|
|
699
|
-
|
|
700
|
-
size_t operator()(const std::string& key) const {
|
|
701
|
-
return static_cast<size_t>(
|
|
702
|
-
hash::SpookyHashV2::Hash64(key.data(), key.size(), 0));
|
|
703
|
-
}
|
|
704
|
-
};
|
|
705
|
-
template <typename K>
|
|
706
|
-
struct IsAvalanchingHasher<hasher<std::string>, K> : std::true_type {};
|
|
707
|
-
|
|
708
|
-
#if FOLLY_HAS_STRING_VIEW
|
|
709
|
-
template <>
|
|
710
|
-
struct hasher<std::string_view> {
|
|
711
|
-
using folly_is_avalanching = std::true_type;
|
|
712
|
-
|
|
713
|
-
size_t operator()(const std::string_view& key) const {
|
|
714
|
-
return static_cast<size_t>(
|
|
715
|
-
hash::SpookyHashV2::Hash64(key.data(), key.size(), 0));
|
|
716
|
-
}
|
|
717
|
-
};
|
|
718
|
-
template <typename K>
|
|
719
|
-
struct IsAvalanchingHasher<hasher<std::string_view>, K> : std::true_type {};
|
|
720
|
-
#endif
|
|
721
|
-
|
|
722
|
-
template <typename T>
|
|
723
|
-
struct hasher<T, std::enable_if_t<std::is_enum<T>::value>> {
|
|
724
|
-
size_t operator()(T key) const noexcept { return Hash()(to_underlying(key)); }
|
|
725
|
-
};
|
|
726
|
-
|
|
727
|
-
template <typename T, typename K>
|
|
728
|
-
struct IsAvalanchingHasher<
|
|
729
|
-
hasher<T, std::enable_if_t<std::is_enum<T>::value>>,
|
|
730
|
-
K> : IsAvalanchingHasher<hasher<std::underlying_type_t<T>>, K> {};
|
|
731
|
-
|
|
732
|
-
template <typename T1, typename T2>
|
|
733
|
-
struct hasher<std::pair<T1, T2>> {
|
|
734
|
-
using folly_is_avalanching = std::true_type;
|
|
735
|
-
|
|
736
|
-
size_t operator()(const std::pair<T1, T2>& key) const {
|
|
737
|
-
return Hash()(key.first, key.second);
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
|
|
741
|
-
template <typename... Ts>
|
|
742
|
-
struct hasher<std::tuple<Ts...>> {
|
|
743
|
-
size_t operator()(const std::tuple<Ts...>& key) const {
|
|
744
|
-
return apply(Hash(), key);
|
|
745
|
-
}
|
|
746
|
-
};
|
|
747
|
-
|
|
748
|
-
template <typename T>
|
|
749
|
-
struct hasher<T*> {
|
|
750
|
-
using folly_is_avalanching = hasher<std::uintptr_t>::folly_is_avalanching;
|
|
751
|
-
|
|
752
|
-
size_t operator()(T* key) const {
|
|
753
|
-
return Hash()(bit_cast<std::uintptr_t>(key));
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
|
|
757
|
-
template <typename T>
|
|
758
|
-
struct hasher<std::unique_ptr<T>> {
|
|
759
|
-
using folly_is_avalanching = typename hasher<T*>::folly_is_avalanching;
|
|
760
|
-
|
|
761
|
-
size_t operator()(const std::unique_ptr<T>& key) const {
|
|
762
|
-
return Hash()(key.get());
|
|
763
|
-
}
|
|
764
|
-
};
|
|
765
|
-
|
|
766
|
-
template <typename T>
|
|
767
|
-
struct hasher<std::shared_ptr<T>> {
|
|
768
|
-
using folly_is_avalanching = typename hasher<T*>::folly_is_avalanching;
|
|
769
|
-
|
|
770
|
-
size_t operator()(const std::shared_ptr<T>& key) const {
|
|
771
|
-
return Hash()(key.get());
|
|
772
|
-
}
|
|
773
|
-
};
|
|
774
|
-
|
|
775
|
-
// combiner for multi-arg tuple also mixes bits
|
|
776
|
-
template <typename T, typename K>
|
|
777
|
-
struct IsAvalanchingHasher<hasher<std::tuple<T>>, K>
|
|
778
|
-
: IsAvalanchingHasher<hasher<T>, K> {};
|
|
779
|
-
template <typename T1, typename T2, typename... Ts, typename K>
|
|
780
|
-
struct IsAvalanchingHasher<hasher<std::tuple<T1, T2, Ts...>>, K>
|
|
781
|
-
: std::true_type {};
|
|
782
|
-
|
|
783
|
-
namespace hash {
|
|
784
|
-
// Simply uses std::hash to hash. Note that std::hash is not guaranteed
|
|
785
|
-
// to be a very good hash function; provided std::hash doesn't collide on
|
|
786
|
-
// the individual inputs, you are fine, but that won't be true for, say,
|
|
787
|
-
// strings or pairs
|
|
788
|
-
class StdHasher {
|
|
789
|
-
public:
|
|
790
|
-
// The standard requires all explicit and partial specializations of std::hash
|
|
791
|
-
// supplied by either the standard library or by users to be default
|
|
792
|
-
// constructible.
|
|
793
|
-
template <typename T>
|
|
794
|
-
size_t operator()(const T& t) const noexcept(noexcept(std::hash<T>()(t))) {
|
|
795
|
-
return std::hash<T>()(t);
|
|
796
|
-
}
|
|
797
|
-
};
|
|
798
|
-
|
|
799
|
-
// This is a general-purpose way to create a single hash from multiple
|
|
800
|
-
// hashable objects. hash_combine_generic takes a class Hasher implementing
|
|
801
|
-
// hash<T>; hash_combine uses a default hasher StdHasher that uses std::hash.
|
|
802
|
-
// hash_combine_generic hashes each argument and combines those hashes in
|
|
803
|
-
// an order-dependent way to yield a new hash; hash_range does so (also in an
|
|
804
|
-
// order-dependent way) for items in the range [first, last);
|
|
805
|
-
// commutative_hash_combine_* hashes values but combines them in an
|
|
806
|
-
// order-independent way to yield a new hash.
|
|
807
|
-
|
|
808
|
-
/**
|
|
809
|
-
* Hash a value, and combine it with a seed. Commutative.
|
|
810
|
-
*
|
|
811
|
-
* @param hasher The function/callable which will hash the value.
|
|
812
|
-
*
|
|
813
|
-
* @methodset ranges
|
|
814
|
-
*/
|
|
815
|
-
template <class Hash, class Value>
|
|
816
|
-
uint64_t commutative_hash_combine_value_generic(
|
|
817
|
-
uint64_t seed, Hash const& hasher, Value const& value) {
|
|
818
|
-
auto const x = hasher(value);
|
|
819
|
-
auto const y = IsAvalanchingHasher<Hash, Value>::value ? x : twang_mix64(x);
|
|
820
|
-
return commutative_hash_128_to_64(seed, y);
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
/**
|
|
824
|
-
* Combine hashes of items in the range [first, last), order-dependently.
|
|
825
|
-
*
|
|
826
|
-
* For order-independent hashing, such as for hashing an unordered container
|
|
827
|
-
* (e.g. folly::dynamic::object) use commutative_hash_combine_range instead.
|
|
828
|
-
*
|
|
829
|
-
* @param hash The base-case hash to use.
|
|
830
|
-
* @param hasher The function/callable which will hash the value.
|
|
831
|
-
*
|
|
832
|
-
* @methodset ranges
|
|
833
|
-
*/
|
|
834
|
-
template <
|
|
835
|
-
class Iter,
|
|
836
|
-
class Hash = std::hash<typename std::iterator_traits<Iter>::value_type>>
|
|
837
|
-
uint64_t hash_range(
|
|
838
|
-
Iter begin, Iter end, uint64_t hash = 0, Hash hasher = Hash()) {
|
|
839
|
-
for (; begin != end; ++begin) {
|
|
840
|
-
hash = hash_128_to_64(hash, hasher(*begin));
|
|
841
|
-
}
|
|
842
|
-
return hash;
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
/**
|
|
846
|
-
* Create a hash from multiple hashable objects, order-independently.
|
|
847
|
-
*
|
|
848
|
-
* For order-dependent hashing use hash_range.
|
|
849
|
-
*
|
|
850
|
-
* @param seed The base-case hash to use.
|
|
851
|
-
* @param hasher The function/callable which will hash the value.
|
|
852
|
-
*
|
|
853
|
-
* @methodset ranges
|
|
854
|
-
*/
|
|
855
|
-
template <class Hash, class Iter>
|
|
856
|
-
uint64_t commutative_hash_combine_range_generic(
|
|
857
|
-
uint64_t seed, Hash const& hasher, Iter first, Iter last) {
|
|
858
|
-
while (first != last) {
|
|
859
|
-
seed = commutative_hash_combine_value_generic(seed, hasher, *first++);
|
|
860
|
-
}
|
|
861
|
-
return seed;
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
/**
|
|
865
|
-
* Create a hash from multiple hashable objects, order-independently.
|
|
866
|
-
*
|
|
867
|
-
* @methodset ranges
|
|
868
|
-
*/
|
|
869
|
-
template <class Iter>
|
|
870
|
-
uint64_t commutative_hash_combine_range(Iter first, Iter last) {
|
|
871
|
-
return commutative_hash_combine_range_generic(0, Hash{}, first, last);
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
namespace detail {
|
|
875
|
-
using c_array_size_t = size_t[];
|
|
876
|
-
} // namespace detail
|
|
877
|
-
|
|
878
|
-
// Never used, but gcc demands it.
|
|
879
|
-
template <class Hasher>
|
|
880
|
-
inline size_t hash_combine_generic(const Hasher&) noexcept {
|
|
881
|
-
return 0;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
/**
|
|
885
|
-
* Combine hashes of multiple items, order-dependently.
|
|
886
|
-
*
|
|
887
|
-
* @param h The function/callable which will hash the value.
|
|
888
|
-
*
|
|
889
|
-
* @methodset ranges
|
|
890
|
-
*/
|
|
891
|
-
template <class Hasher, typename T, typename... Ts>
|
|
892
|
-
size_t hash_combine_generic(
|
|
893
|
-
const Hasher& h,
|
|
894
|
-
const T& t,
|
|
895
|
-
const Ts&... ts) noexcept(noexcept(detail::c_array_size_t{
|
|
896
|
-
h(t), h(ts)...})) {
|
|
897
|
-
size_t seed = h(t);
|
|
898
|
-
if (sizeof...(ts) == 0) {
|
|
899
|
-
return seed;
|
|
900
|
-
}
|
|
901
|
-
size_t remainder = hash_combine_generic(h, ts...);
|
|
902
|
-
if /* constexpr */ (sizeof(size_t) == sizeof(uint32_t)) {
|
|
903
|
-
return twang_32from64((uint64_t(seed) << 32) | remainder);
|
|
904
|
-
} else {
|
|
905
|
-
return static_cast<size_t>(hash_128_to_64(seed, remainder));
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
/**
|
|
910
|
-
* Combine hashes of multiple items, order-independently.
|
|
911
|
-
*
|
|
912
|
-
* @param hasher The function/callable which will hash the value.
|
|
913
|
-
*
|
|
914
|
-
* @methodset ranges
|
|
915
|
-
*/
|
|
916
|
-
template <typename Hash, typename... Value>
|
|
917
|
-
uint64_t commutative_hash_combine_generic(
|
|
918
|
-
uint64_t seed, Hash const& hasher, Value const&... value) {
|
|
919
|
-
// variadic foreach:
|
|
920
|
-
uint64_t _[] = {
|
|
921
|
-
0, seed = commutative_hash_combine_value_generic(seed, hasher, value)...};
|
|
922
|
-
(void)_;
|
|
923
|
-
return seed;
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
/**
|
|
927
|
-
* Combine hashes of multiple items, order-dependently.
|
|
928
|
-
*
|
|
929
|
-
* @methodset ranges
|
|
930
|
-
*/
|
|
931
|
-
template <typename T, typename... Ts>
|
|
932
|
-
FOLLY_NODISCARD size_t hash_combine(const T& t, const Ts&... ts) noexcept(
|
|
933
|
-
noexcept(hash_combine_generic(StdHasher{}, t, ts...))) {
|
|
934
|
-
return hash_combine_generic(StdHasher{}, t, ts...);
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
/**
|
|
938
|
-
* Combine hashes of multiple items, order-independently.
|
|
939
|
-
*
|
|
940
|
-
*/
|
|
941
|
-
template <typename... Value>
|
|
942
|
-
uint64_t commutative_hash_combine(Value const&... value) {
|
|
943
|
-
return commutative_hash_combine_generic(0, Hash{}, value...);
|
|
944
|
-
}
|
|
945
|
-
} // namespace hash
|
|
946
|
-
|
|
947
|
-
// recursion
|
|
948
|
-
template <size_t index, typename... Ts>
|
|
949
|
-
struct TupleHasher {
|
|
950
|
-
size_t operator()(std::tuple<Ts...> const& key) const {
|
|
951
|
-
return hash::hash_combine(
|
|
952
|
-
TupleHasher<index - 1, Ts...>()(key), std::get<index>(key));
|
|
953
|
-
}
|
|
954
|
-
};
|
|
955
|
-
|
|
956
|
-
// base
|
|
957
|
-
template <typename... Ts>
|
|
958
|
-
struct TupleHasher<0, Ts...> {
|
|
959
|
-
size_t operator()(std::tuple<Ts...> const& key) const {
|
|
960
|
-
// we could do std::hash here directly, but hash_combine hides all the
|
|
961
|
-
// ugly templating implicitly
|
|
962
|
-
return hash::hash_combine(std::get<0>(key));
|
|
963
|
-
}
|
|
964
|
-
};
|
|
965
|
-
|
|
966
|
-
} // namespace folly
|
|
967
|
-
|
|
968
|
-
// Custom hash functions.
|
|
969
|
-
namespace std {
|
|
970
|
-
// Hash function for pairs. Requires default hash functions for both
|
|
971
|
-
// items in the pair.
|
|
972
|
-
template <typename T1, typename T2>
|
|
973
|
-
struct hash<std::pair<T1, T2>> {
|
|
974
|
-
using folly_is_avalanching = std::true_type;
|
|
975
|
-
|
|
976
|
-
size_t operator()(const std::pair<T1, T2>& x) const {
|
|
977
|
-
return folly::hash::hash_combine(x.first, x.second);
|
|
978
|
-
}
|
|
979
|
-
};
|
|
980
|
-
|
|
981
|
-
// Hash function for tuples. Requires default hash functions for all types.
|
|
982
|
-
template <typename... Ts>
|
|
983
|
-
struct hash<std::tuple<Ts...>> {
|
|
984
|
-
private:
|
|
985
|
-
using FirstT = std::decay_t<std::tuple_element_t<0, std::tuple<Ts..., bool>>>;
|
|
986
|
-
|
|
987
|
-
public:
|
|
988
|
-
using folly_is_avalanching = folly::bool_constant<(
|
|
989
|
-
sizeof...(Ts) != 1 ||
|
|
990
|
-
folly::IsAvalanchingHasher<std::hash<FirstT>, FirstT>::value)>;
|
|
991
|
-
|
|
992
|
-
size_t operator()(std::tuple<Ts...> const& key) const {
|
|
993
|
-
folly::TupleHasher<
|
|
994
|
-
sizeof...(Ts) - 1, // start index
|
|
995
|
-
Ts...>
|
|
996
|
-
hasher;
|
|
997
|
-
|
|
998
|
-
return hasher(key);
|
|
999
|
-
}
|
|
1000
|
-
};
|
|
1001
|
-
} // namespace std
|
|
1002
|
-
|
|
1003
|
-
namespace folly {
|
|
1004
|
-
|
|
1005
|
-
// std::hash<std::string> is avalanching on libstdc++-v3 (code checked),
|
|
1006
|
-
// libc++ (code checked), and MSVC (based on online information).
|
|
1007
|
-
// std::hash for float and double on libstdc++-v3 are avalanching,
|
|
1008
|
-
// but they are not on libc++. std::hash for integral types is not
|
|
1009
|
-
// avalanching for libstdc++-v3 or libc++. We're conservative here and
|
|
1010
|
-
// just mark std::string as avalanching. std::string_view will also be
|
|
1011
|
-
// so, once it exists.
|
|
1012
|
-
template <typename... Args, typename K>
|
|
1013
|
-
struct IsAvalanchingHasher<std::hash<std::basic_string<Args...>>, K>
|
|
1014
|
-
: std::true_type {};
|
|
1015
|
-
|
|
1016
|
-
} // namespace folly
|