react-native-windows 0.72.13 → 0.73.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 +16 -5
- package/Chakra/ChakraHelpers.cpp +1 -1
- package/Chakra/ChakraUtils.cpp +1 -1
- package/Chakra/ChakraValue.h +1 -1
- package/Common/packages.lock.json +13 -0
- package/Directory.Build.props +6 -2
- package/Folly/TEMP_UntilFollyUpdate/dynamic-inl.h +1 -10
- package/Folly/TEMP_UntilFollyUpdate/hash/Hash.h +1016 -0
- package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.h +1 -1
- package/Folly/cgmanifest.json +1 -1
- package/Folly/packages.lock.json +23 -0
- package/Libraries/Animated/Animated.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +1 -1
- package/Libraries/Animated/NativeAnimatedHelper.js +14 -10
- package/Libraries/Animated/NativeAnimatedModule.js +6 -2
- package/Libraries/Animated/NativeAnimatedTurboModule.js +7 -4
- package/Libraries/Animated/animations/Animation.js +57 -3
- package/Libraries/Animated/animations/DecayAnimation.js +9 -0
- package/Libraries/Animated/animations/SpringAnimation.js +8 -0
- package/Libraries/Animated/animations/TimingAnimation.js +8 -0
- package/Libraries/Animated/components/AnimatedFlatList.js +2 -1
- package/Libraries/Animated/components/AnimatedScrollView.js +2 -0
- package/Libraries/Animated/components/AnimatedSectionList.js +2 -1
- package/Libraries/Animated/createAnimatedComponent.js +1 -0
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedObject.js +146 -0
- package/Libraries/Animated/nodes/AnimatedProps.js +19 -7
- package/Libraries/Animated/nodes/AnimatedStyle.js +29 -55
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -17
- package/Libraries/Animated/shouldUseTurboAnimatedModule.js +17 -0
- package/Libraries/Animated/useAnimatedProps.js +9 -10
- package/Libraries/AppState/AppState.d.ts +1 -1
- package/Libraries/AppState/NativeAppState.js +8 -4
- package/Libraries/AppTheme/AppTheme.js +5 -5
- package/Libraries/BatchedBridge/MessageQueue.js +45 -36
- package/Libraries/Blob/Blob.js +6 -2
- package/Libraries/Blob/BlobManager.js +9 -10
- package/Libraries/Blob/BlobRegistry.js +14 -9
- package/Libraries/Blob/File.js +1 -1
- package/Libraries/Blob/FileReader.js +1 -2
- package/Libraries/Components/Clipboard/Clipboard.d.ts +4 -4
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +3 -1
- package/Libraries/Components/Glyph/Glyph.js +1 -1
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +26 -6
- package/Libraries/Components/Keyboard/KeyboardExt.d.ts +4 -1
- package/Libraries/Components/Keyboard/KeyboardExt.js +3 -0
- package/Libraries/Components/Keyboard/KeyboardExt.js.map +1 -1
- package/Libraries/Components/Keyboard/KeyboardExtProps.d.ts +4 -29
- package/Libraries/Components/Keyboard/KeyboardExtProps.js +0 -17
- package/Libraries/Components/Keyboard/KeyboardExtProps.js.map +1 -1
- package/Libraries/Components/Pressable/Pressable.js +3 -2
- package/Libraries/Components/Pressable/Pressable.windows.js +4 -3
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +1 -1
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +20 -0
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.windows.js +7 -1
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +7 -7
- package/Libraries/Components/SafeAreaView/SafeAreaView.windows.js +7 -10
- package/Libraries/Components/ScrollView/ScrollView.js +3 -1
- package/Libraries/Components/ScrollView/ScrollView.windows.js +3 -1
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +39 -46
- package/Libraries/Components/Switch/Switch.js +1 -0
- package/Libraries/Components/Switch/Switch.windows.js +259 -0
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +49 -7
- package/Libraries/Components/TextInput/TextInput.flow.js +43 -10
- package/Libraries/Components/TextInput/TextInput.js +62 -10
- package/Libraries/Components/TextInput/TextInput.windows.js +100 -14
- package/Libraries/Components/ToastAndroid/{ToastAndroid.ios.js → ToastAndroid.js} +9 -1
- package/Libraries/Components/ToastAndroid/ToastAndroid.windows.js +9 -1
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.windows.js +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
- package/Libraries/Components/Touchable/TouchableOpacity.js +4 -1
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +4 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +1 -0
- package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlay.js +16 -6
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +9 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.windows.js +1 -0
- package/Libraries/Components/View/View.js +46 -32
- package/Libraries/Components/View/View.windows.js +23 -7
- package/Libraries/Components/View/ViewAccessibility.d.ts +27 -1
- package/Libraries/Components/View/ViewAccessibility.windows.js +3 -0
- package/Libraries/Components/View/ViewNativeComponent.js +1 -0
- package/Libraries/Components/View/ViewPropTypes.d.ts +104 -1
- package/Libraries/Components/View/ViewPropTypes.js +18 -3
- package/Libraries/Components/View/ViewPropTypes.windows.js +33 -3
- package/Libraries/Core/Devtools/loadBundleFromServer.js +152 -0
- package/Libraries/Core/Devtools/symbolicateStackTrace.js +2 -1
- package/Libraries/Core/ExceptionsManager.js +16 -7
- package/Libraries/Core/ExtendedError.js +12 -0
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/ReactNativeVersionCheck.js +0 -2
- package/Libraries/Core/__mocks__/NativeExceptionsManager.js +20 -0
- package/Libraries/Core/setUpDeveloperTools.js +5 -1
- package/Libraries/Core/setUpIntersectionObserver.js +16 -0
- package/Libraries/Core/setUpMutationObserver.js +16 -0
- package/Libraries/Core/setUpPerformance.js +6 -13
- package/Libraries/Core/setUpPerformanceObserver.js +16 -0
- package/Libraries/Core/setUpRegeneratorRuntime.js +4 -2
- package/Libraries/DOM/Nodes/ReactNativeElement.js +135 -18
- package/Libraries/DOM/Nodes/ReadOnlyCharacterData.js +72 -0
- package/Libraries/DOM/Nodes/ReadOnlyElement.js +209 -21
- package/Libraries/DOM/Nodes/ReadOnlyNode.js +206 -17
- package/Libraries/DOM/Nodes/ReadOnlyText.js +30 -0
- package/Libraries/DOM/Nodes/Utilities/Traversal.js +54 -0
- package/Libraries/EventEmitter/NativeEventEmitter.d.ts +0 -6
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +15 -4
- package/Libraries/Image/Image.android.js +8 -2
- package/Libraries/Image/Image.d.ts +1 -1
- package/Libraries/Image/Image.ios.js +4 -1
- package/Libraries/Image/Image.windows.js +6 -3
- package/Libraries/Image/ImageBackground.js +3 -0
- package/Libraries/Inspector/DevtoolsOverlay.js +6 -3
- package/Libraries/Inspector/NetworkOverlay.js +2 -2
- package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -5
- package/Libraries/Interaction/PanResponder.js +1 -4
- package/Libraries/IntersectionObserver/IntersectionObserver.js +252 -0
- package/Libraries/IntersectionObserver/IntersectionObserverEntry.js +140 -0
- package/Libraries/IntersectionObserver/IntersectionObserverManager.js +221 -0
- package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +41 -0
- package/Libraries/IntersectionObserver/__mocks__/NativeIntersectionObserver.js +162 -0
- package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +2 -1
- package/Libraries/Lists/FlatList.js +15 -5
- package/Libraries/Lists/SectionList.js +4 -0
- package/Libraries/LogBox/Data/LogBoxLog.js +4 -1
- package/Libraries/LogBox/Data/LogBoxSymbolication.js +5 -2
- package/Libraries/LogBox/Data/parseLogBoxLog.js +57 -20
- package/Libraries/LogBox/UI/AnsiHighlight.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +24 -31
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
- package/Libraries/LogBox/UI/LogBoxMessage.js +4 -7
- package/Libraries/MutationObserver/MutationObserver.js +184 -0
- package/Libraries/MutationObserver/MutationObserverManager.js +218 -0
- package/Libraries/MutationObserver/MutationRecord.js +82 -0
- package/Libraries/MutationObserver/NativeMutationObserver.js +58 -0
- package/Libraries/MutationObserver/__mocks__/NativeMutationObserver.js +327 -0
- package/Libraries/NativeComponent/BaseViewConfig.android.js +18 -3
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +33 -0
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +34 -4
- package/Libraries/NativeComponent/NativeComponentRegistry.js +3 -5
- package/Libraries/NativeModules/specs/NativeSourceCode.js +6 -6
- package/Libraries/Network/RCTNetworking.android.js +2 -1
- package/Libraries/Network/XMLHttpRequest.js +1 -1
- package/Libraries/NewAppScreen/components/DebugInstructions.js +4 -4
- package/Libraries/NewAppScreen/components/DebugInstructions.windows.js +2 -2
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +9 -2
- package/Libraries/Performance/QuickPerformanceLogger.js +1 -1
- package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +1 -0
- package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +1 -0
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +3 -1
- package/Libraries/Pressability/Pressability.js +28 -3
- package/Libraries/Pressability/Pressability.windows.js +30 -5
- package/Libraries/ReactNative/AppContainer.js +2 -3
- package/Libraries/ReactNative/AppRegistry.d.ts +0 -5
- package/Libraries/ReactNative/AppRegistry.js +66 -53
- package/Libraries/ReactNative/BridgelessUIManager.js +38 -9
- package/Libraries/ReactNative/FabricUIManager.js +143 -34
- package/Libraries/ReactNative/I18nManager.js +5 -11
- package/Libraries/ReactNative/NativeI18nManager.js +7 -5
- package/Libraries/ReactNative/PaperUIManager.windows.js +2 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +151 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +81 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +492 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +32 -0
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +19 -3
- package/Libraries/ReactNative/UIManager.js +8 -0
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +648 -0
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +38 -2
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +27 -27
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +3 -3
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3 -3
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +27 -27
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3 -3
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3 -3
- package/Libraries/Renderer/shims/ReactFabric.js +5 -6
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -3
- package/Libraries/Renderer/shims/ReactNative.js +2 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +35 -17
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -3
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -3
- package/Libraries/Settings/{Settings.android.js → Settings.js} +4 -4
- package/Libraries/Share/Share.d.ts +3 -9
- package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +9 -4
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +28 -13
- package/Libraries/StyleSheet/PlatformColorValueTypes.windows.js +10 -6
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.ios.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.d.ts +10 -1
- package/Libraries/StyleSheet/StyleSheet.js +3 -0
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +31 -17
- package/Libraries/StyleSheet/StyleSheetTypes.js +90 -6
- package/Libraries/StyleSheet/flattenStyle.js +4 -0
- package/Libraries/StyleSheet/private/_TransformStyle.js +16 -2
- package/Libraries/StyleSheet/processColor.js +1 -2
- package/Libraries/StyleSheet/processTransformOrigin.js +136 -0
- package/Libraries/StyleSheet/splitLayoutProps.js +1 -0
- package/Libraries/Text/Text.d.ts +5 -5
- package/Libraries/Text/Text.js +17 -10
- package/Libraries/Text/Text.windows.js +53 -20
- package/Libraries/Text/TextProps.windows.js +275 -0
- package/Libraries/TurboModule/TurboModuleRegistry.js +47 -7
- package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +6 -0
- package/Libraries/Types/CoreEventTypes.d.ts +5 -2
- package/Libraries/Utilities/GlobalPerformanceLogger.js +2 -12
- package/Libraries/Utilities/NativeDeviceInfo.js +8 -9
- package/Libraries/Utilities/NativePlatformConstantsAndroid.js +23 -18
- package/Libraries/Utilities/NativePlatformConstantsIOS.js +16 -13
- package/Libraries/Utilities/NativePlatformConstantsWin.js +13 -10
- package/Libraries/Utilities/PerformanceLoggerContext.js +1 -1
- package/Libraries/Utilities/Platform.android.js +12 -8
- package/Libraries/Utilities/Platform.d.ts +1 -0
- package/Libraries/Utilities/Platform.flow.js +84 -0
- package/Libraries/Utilities/Platform.flow.windows.js +111 -0
- package/Libraries/Utilities/Platform.ios.js +12 -8
- package/Libraries/Utilities/Platform.windows.js +12 -8
- package/Libraries/Utilities/PolyfillFunctions.js +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -2
- package/Libraries/Utilities/SceneTracker.js +1 -1
- package/Libraries/Utilities/createPerformanceLogger.js +63 -32
- package/Libraries/Utilities/useColorScheme.js +7 -8
- package/Libraries/WebPerformance/MemoryInfo.js +1 -1
- package/Libraries/WebPerformance/NativePerformance.js +3 -8
- package/Libraries/WebPerformance/NativePerformanceObserver.js +4 -0
- package/Libraries/WebPerformance/Performance.js +42 -15
- package/Libraries/WebPerformance/PerformanceEntry.js +14 -6
- package/Libraries/WebPerformance/PerformanceEventTiming.js +18 -1
- package/Libraries/WebPerformance/ReactNativeStartupTiming.js +40 -14
- package/Libraries/WebPerformance/__mocks__/NativePerformance.js +4 -2
- package/Libraries/WebPerformance/__mocks__/NativePerformanceObserver.js +21 -3
- package/Libraries/__tests__/ViewWindows-test.js +3 -3
- package/Libraries/platform-types.d.ts +6 -2
- package/Libraries/promiseRejectionTrackingOptions.js +1 -3
- package/Libraries/vendor/emitter/EventEmitter.js +20 -18
- package/Microsoft.ReactNative/Composition.Input.idl +103 -0
- package/Microsoft.ReactNative/CompositionContext.idl +31 -8
- package/Microsoft.ReactNative/CompositionRootView.idl +8 -4
- package/Microsoft.ReactNative/CompositionSwitcher.idl +28 -17
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +15 -28
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.h +7 -10
- package/Microsoft.ReactNative/Fabric/ComponentView.h +42 -4
- package/Microsoft.ReactNative/Fabric/Composition/AbiCompositionViewComponentView.cpp +57 -4
- package/Microsoft.ReactNative/Fabric/Composition/AbiCompositionViewComponentView.h +22 -1
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +137 -0
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.h +59 -0
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +8 -2
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +575 -0
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +170 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +890 -226
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.h +38 -6
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper_emptyimpl.cpp +79 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +130 -27
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +6 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +382 -228
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +35 -8
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHelpers.h +46 -8
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +5 -21
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +232 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +36 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.cpp +51 -14
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.h +15 -6
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView_emptyimpl.cpp +123 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService_emptyimpl.cpp +18 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +333 -137
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +52 -8
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +32 -26
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +5 -3
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +183 -175
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +7 -4
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +101 -2
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +46 -2
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +36 -9
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +8 -2
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +247 -42
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +25 -8
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +78 -50
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +12 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +26 -28
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +429 -89
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +24 -3
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.cpp +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.h +3 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +5 -7
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +4 -6
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +1 -7
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h +1 -17
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +74 -3
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +12 -0
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +53 -59
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.h +3 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +5 -4
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +2 -1
- package/Microsoft.ReactNative/Fabric/ImageRequest.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +1 -1
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +3 -4
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformTouch.h +10 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.cpp +59 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.h +31 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +69 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +25 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +23 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/KeyEvent.h +113 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/WindowsViewEvents.h +75 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/core/graphicsConversions.h +18 -21
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/Color.cpp +158 -7
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/Color.h +15 -17
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +1 -1
- package/Microsoft.ReactNative/GlyphViewManager.cpp +1 -1
- package/Microsoft.ReactNative/IJSValueReader.idl +2 -2
- package/Microsoft.ReactNative/IJSValueWriter.idl +2 -2
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +23 -1
- package/Microsoft.ReactNative/IReactContext.cpp +1 -1
- package/Microsoft.ReactNative/IReactNotificationService.cpp +4 -3
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -4
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +2 -2
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +1 -2
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.h +1 -1
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +3 -4
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/AppStateModule.h +2 -2
- package/Microsoft.ReactNative/Modules/AppearanceModule.h +1 -1
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +4 -2
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.h +1 -1
- package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +2 -2
- package/Microsoft.ReactNative/Modules/I18nManagerModule.h +1 -1
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +21 -15
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +10 -6
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.h +4 -1
- package/Microsoft.ReactNative/QuirkSettings.idl +1 -1
- package/Microsoft.ReactNative/ReactApplication.cpp +13 -11
- package/Microsoft.ReactNative/ReactApplication.h +4 -4
- package/Microsoft.ReactNative/ReactCoreInjection.h +6 -5
- package/Microsoft.ReactNative/ReactHost/JSCallInvokerScheduler.cpp +2 -2
- package/Microsoft.ReactNative/ReactHost/MsoUtils.cpp +1 -1
- package/Microsoft.ReactNative/ReactHost/React.h +3 -6
- package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +0 -16
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +8 -16
- package/Microsoft.ReactNative/ReactInstanceSettings.cpp +6 -5
- package/Microsoft.ReactNative/ReactInstanceSettings.h +7 -7
- package/Microsoft.ReactNative/ReactNativeHost.h +4 -4
- package/Microsoft.ReactNative/ReactRootView.cpp +5 -4
- package/Microsoft.ReactNative/ReactRootView.h +2 -2
- package/Microsoft.ReactNative/ReactSupport.h +1 -1
- package/Microsoft.ReactNative/RedBox.cpp +1 -1
- package/Microsoft.ReactNative/RedBoxHandler.idl +1 -1
- package/Microsoft.ReactNative/Utils/UwpPreparedScriptStore.h +1 -1
- package/Microsoft.ReactNative/Utils/ValueUtils.cpp +49 -21
- package/Microsoft.ReactNative/Utils/ValueUtils.h +2 -1
- package/Microsoft.ReactNative/Views/DynamicAutomationPeer.cpp +31 -59
- package/Microsoft.ReactNative/Views/DynamicAutomationPeer.h +3 -4
- package/Microsoft.ReactNative/Views/DynamicAutomationProperties.cpp +15 -46
- package/Microsoft.ReactNative/Views/DynamicAutomationProperties.h +5 -13
- package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +4 -4
- package/Microsoft.ReactNative/Views/FrameworkElementTransferProperties.cpp +2 -8
- package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +127 -86
- package/Microsoft.ReactNative/Views/ICompositionRootView.h +1 -1
- package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +1 -1
- package/Microsoft.ReactNative/Views/Image/Microsoft.UI.Composition.Effects_Impl.h +2 -2
- package/Microsoft.ReactNative/Views/Image/ReactImage.cpp +1 -1
- package/Microsoft.ReactNative/Views/SIPEventHandler.cpp +5 -5
- package/Microsoft.ReactNative/Views/SIPEventHandler.h +1 -1
- package/Microsoft.ReactNative/Views/ShadowNodeBase.h +8 -5
- package/Microsoft.ReactNative/Views/SwitchViewManager.cpp +2 -2
- package/Microsoft.ReactNative/Views/Text/TextTransformVisitor.cpp +1 -1
- package/Microsoft.ReactNative/Views/TextInputViewManager.cpp +32 -14
- package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +1 -1
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +14 -2
- package/Microsoft.ReactNative/Views/ViewManagerBase.h +1 -1
- package/Microsoft.ReactNative/Views/ViewPanel.cpp +20 -219
- package/Microsoft.ReactNative/Views/ViewPanel.h +0 -30
- package/Microsoft.ReactNative/Views/ViewViewManager.cpp +17 -158
- package/Microsoft.ReactNative/Views/cppwinrt/DynamicAutomationPeer.idl +9 -12
- package/Microsoft.ReactNative/Views/cppwinrt/ViewPanel.idl +1 -9
- package/Microsoft.ReactNative/XamlHelper.cpp +1 -1
- package/Microsoft.ReactNative/XamlHelper.h +1 -1
- package/Microsoft.ReactNative/packages.lock.json +128 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.cpp +2 -2
- package/Microsoft.ReactNative.Cxx/JSValue.h +2 -2
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +0 -1
- package/Microsoft.ReactNative.Cxx/NativeModules.h +4 -4
- package/Microsoft.ReactNative.Cxx/ReactHandleHelper.h +1 -1
- package/Microsoft.ReactNative.Cxx/ReactNonAbiValue.h +2 -2
- package/Microsoft.ReactNative.Cxx/ReactNotificationService.h +10 -9
- package/Microsoft.ReactNative.Cxx/ReactPropertyBag.h +13 -12
- package/Microsoft.ReactNative.Managed/JSValueReaderGenerator.cs +5 -5
- package/Microsoft.ReactNative.Managed/JSValueWriterGenerator.cs +5 -5
- package/Microsoft.ReactNative.Managed/Microsoft.ReactNative.Managed.csproj +8 -2
- package/Microsoft.ReactNative.Managed/ReactPackageBuilderExtensions.cs +1 -1
- package/Microsoft.ReactNative.Managed/ReflectionReactPackageProvider.cs +1 -1
- package/Microsoft.ReactNative.Managed/packages.lock.json +9 -9
- package/Microsoft.ReactNative.Managed.CodeGen/CodeAnalyzer.cs +2 -0
- package/Microsoft.ReactNative.Managed.CodeGen/CodeGenerator.Module.cs +4 -2
- package/Microsoft.ReactNative.Managed.CodeGen/CodeGenerator.ViewManager.cs +1 -1
- package/Microsoft.ReactNative.Managed.CodeGen/DiagnosticDescriptors.cs +1 -1
- package/Microsoft.ReactNative.Managed.CodeGen/packages.lock.json +3197 -0
- package/Mso/compilerAdapters/compilerFeatures.h +1 -1
- package/Mso/compilerAdapters/functionDecorations.h +6 -6
- package/Mso/debugAssertApi/debugAssertDetails.h +1 -1
- package/Mso/dispatchQueue/dispatchQueue.h +3 -3
- package/Mso/motifCpp/motifCppTest.h +1 -1
- package/Mso/motifCpp/testCheck.h +1 -1
- package/Mso/oacr/oacr.h +1 -1
- package/Mso/smartPtr/smartPointerBase.h +1 -1
- package/Mso/src/dispatchQueue/looperScheduler.cpp +2 -2
- package/Mso/src/dispatchQueue/queueService.cpp +1 -1
- package/Mso/src/dispatchQueue/taskQueue.h +1 -1
- package/Mso/src/dispatchQueue/threadPoolScheduler_win.cpp +2 -2
- package/Mso/src/dispatchQueue/uiScheduler_winrt.cpp +122 -45
- package/Mso/src/eventWaitHandle/eventWaitHandleImpl_win.cpp +2 -2
- package/Mso/src/future/futureImpl.cpp +5 -5
- package/Mso/src/future/futureImpl.h +1 -1
- package/PropertySheets/External/Microsoft.ReactNative.Common.props +3 -0
- package/PropertySheets/External/{Microsoft.ReactNative.WinAppSDK.Common.props → Microsoft.ReactNative.Composition.Common.props} +2 -2
- package/PropertySheets/External/{Microsoft.ReactNative.WinAppSDK.CSharpApp.props → Microsoft.ReactNative.Composition.CppApp.props} +7 -10
- package/PropertySheets/External/Microsoft.ReactNative.Composition.CppApp.targets +19 -0
- package/PropertySheets/External/Microsoft.ReactNative.Composition.Package.props +14 -0
- package/PropertySheets/External/Microsoft.ReactNative.Composition.Package.targets +18 -0
- package/PropertySheets/External/Microsoft.ReactNative.WindowsSdk.Default.props +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +4 -4
- package/PropertySheets/HybridCRT.props +34 -0
- package/PropertySheets/JSEngine.props +1 -2
- package/PropertySheets/React.Cpp.props +0 -1
- package/PropertySheets/Warnings.props +1 -1
- package/PropertySheets/WinUI.props +1 -1
- package/ReactCommon/ReactCommon.vcxproj +15 -9
- package/ReactCommon/ReactCommon.vcxproj.filters +0 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +32 -5
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Bridging.h +20 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/YogaLayoutableShadowNode.cpp +1038 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/YogaStylableProps.cpp +228 -38
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/conversions.h +895 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/mounting/ShadowTree.cpp +543 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManagerBinding.cpp +1509 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/bits/NumericBitfield.h +67 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.h +93 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.h +88 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/Node.cpp +606 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/Node.h +344 -0
- package/ReactCommon/Yoga.cpp +497 -3895
- package/ReactCommon/packages.lock.json +30 -0
- package/Scripts/NuGetRestoreForceEvaluateAllSolutions.ps1 +22 -0
- package/Scripts/OfficeReact.Win32.nuspec +1 -0
- package/Scripts/rnw-dependencies.ps1 +79 -26
- package/Shared/BaseScriptStoreImpl.cpp +42 -13
- package/Shared/BaseScriptStoreImpl.h +1 -1
- package/Shared/Composition/AutoDraw.h +36 -0
- package/Shared/CxxMessageQueue.cpp +1 -1
- package/Shared/DevSettings.h +3 -0
- package/Shared/DevSupportManager.h +1 -1
- package/Shared/Hasher.cpp +64 -0
- package/Shared/Hasher.h +24 -0
- package/Shared/HermesRuntimeHolder.cpp +6 -6
- package/Shared/IDevSupportManager.h +1 -1
- package/Shared/JSI/ChakraApi.cpp +1 -1
- package/Shared/JSI/ChakraRuntime.cpp +10 -10
- package/Shared/JSI/ChakraRuntime.h +6 -6
- package/Shared/JSI/V8RuntimeHolder.cpp +1 -1
- package/Shared/Modules/IRequestBodyHandler.h +1 -1
- package/Shared/Modules/IUriHandler.h +1 -1
- package/Shared/Modules/PlatformConstantsModule.cpp +1 -1
- package/Shared/Modules/WebSocketModule.cpp +1 -1
- package/Shared/Networking/DefaultBlobResource.cpp +2 -2
- package/Shared/Networking/OriginPolicyHttpFilter.cpp +22 -16
- package/Shared/Networking/OriginPolicyHttpFilter.h +12 -11
- package/Shared/OInstance.cpp +9 -23
- package/Shared/OInstance.h +1 -1
- package/Shared/PackagerConnection.h +1 -1
- package/Shared/SafeLoadLibrary.cpp +8 -44
- package/Shared/SafeLoadLibrary.h +1 -5
- package/Shared/Shared.vcxitems +50 -20
- package/Shared/Shared.vcxitems.filters +26 -17
- package/Shared/Threading/BatchingQueueThread.cpp +5 -5
- package/Shared/Threading/BatchingQueueThread.h +4 -4
- package/Shared/TurboModuleManager.cpp +1 -1
- package/Shared/Utils.cpp +1 -1
- package/Shared/tracing/fbsystrace.h +1 -1
- package/codegen/NativeAnimatedModuleSpec.g.h +2 -0
- package/codegen/NativeAnimatedTurboModuleSpec.g.h +2 -0
- package/codegen/NativeAppStateSpec.g.h +11 -21
- package/codegen/NativeDeviceInfoSpec.g.h +4 -14
- package/codegen/NativeI18nManagerSpec.g.h +6 -16
- package/codegen/NativeIntersectionObserverSpec.g.h +96 -0
- package/codegen/NativeMutationObserverSpec.g.h +90 -0
- package/codegen/NativePerformanceObserverSpec.g.h +19 -13
- package/codegen/NativePerformanceSpec.g.h +6 -23
- package/codegen/NativePlatformConstantsAndroidSpec.g.h +22 -30
- package/codegen/NativePlatformConstantsIOSSpec.g.h +17 -25
- package/codegen/NativePlatformConstantsWinSpec.g.h +14 -22
- package/codegen/NativeSampleTurboModuleSpec.g.h +36 -0
- package/codegen/NativeSourceCodeSpec.g.h +3 -13
- package/codegen/react/components/rnwcore/EventEmitters.cpp +85 -58
- package/codegen/react/components/rnwcore/EventEmitters.h +17 -35
- package/codegen/react/components/rnwcore/Props.h +16 -17
- package/codegen/rnwcoreJSI-generated.cpp +1462 -319
- package/codegen/rnwcoreJSI.h +1609 -462
- package/fmt/packages.lock.json +13 -0
- package/index.windows.js +3 -3
- package/{Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.ios.js → jest/ReactNativeInternalFeatureFlagsMock.js} +2 -1
- package/jest/__tests__/setup-test.js +18 -0
- package/jest/mockModal.js +6 -4
- package/jest/setup.js +61 -30
- package/just-task.js +1 -0
- package/package.json +37 -42
- package/template/cs-app/proj/MyApp.csproj +0 -1
- package/template/cs-lib/proj/MyLib.csproj +0 -1
- package/templates/.clang-format +4 -0
- package/templates/cpp-app/metro.config.js +51 -0
- package/templates/cpp-app/template.config.js +119 -0
- package/templates/cpp-app/windows/ExperimentalFeatures.props +12 -0
- package/templates/cpp-app/windows/MyApp/MyApp.cpp +284 -0
- package/templates/cpp-app/windows/MyApp/MyApp.h +3 -0
- package/templates/cpp-app/windows/MyApp/MyApp.ico +0 -0
- package/templates/cpp-app/windows/MyApp/MyApp.rc +0 -0
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +142 -0
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj.filters +55 -0
- package/templates/cpp-app/windows/MyApp/_gitignore +1 -0
- package/templates/cpp-app/windows/MyApp/pch.cpp +1 -0
- package/templates/cpp-app/windows/MyApp/pch.h +35 -0
- package/templates/cpp-app/windows/MyApp/resource.h +18 -0
- package/templates/cpp-app/windows/MyApp/small.ico +0 -0
- package/templates/cpp-app/windows/MyApp/targetver.h +8 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/LockScreenLogo.scale-200.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/SplashScreen.scale-200.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/Square150x150Logo.scale-200.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/Square44x44Logo.scale-200.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/Square44x44Logo.targetsize-24_altform-unplated.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/StoreLogo.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/Wide310x150Logo.scale-200.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/MyApp.Package.wapproj +78 -0
- package/{template/cs-app-WinAppSDK/MyApp → templates/cpp-app/windows/MyApp.Package}/Package.appxmanifest +9 -8
- package/templates/cpp-app/windows/MyApp.sln +176 -0
- package/templates/cpp-app/windows/_gitignore +41 -0
- package/templates/old/generateWrapper.js +67 -0
- package/templates/old/uwp-cpp-app/template.config.js +15 -0
- package/templates/old/uwp-cpp-lib/template.config.js +15 -0
- package/templates/old/uwp-cs-app/template.config.js +15 -0
- package/templates/old/uwp-cs-lib/template.config.js +15 -0
- package/types/experimental.d.ts +44 -0
- package/types/index.d.ts +2 -1
- package/types/modules/Devtools.d.ts +1 -0
- package/types/modules/globals.d.ts +16 -1
- package/Libraries/Components/View/ViewWindows.d.ts +0 -19
- package/Libraries/Components/View/ViewWindows.js +0 -22
- package/Libraries/Components/View/ViewWindows.js.map +0 -1
- package/Libraries/Components/View/ViewWindowsProps.d.ts +0 -69
- package/Libraries/Components/View/ViewWindowsProps.js +0 -8
- package/Libraries/Components/View/ViewWindowsProps.js.map +0 -1
- package/Libraries/Utilities/AcessibilityMapping.js +0 -154
- package/Libraries/Utilities/NativeDevSplitBundleLoader.js +0 -19
- package/Libraries/Utilities/useColorScheme.windows.js +0 -26
- package/Microsoft.ReactNative/Fabric/platform/react/components/view/windows/WindowsViewProps.cpp +0 -61
- package/Microsoft.ReactNative/Fabric/platform/react/components/view/windows/WindowsViewProps.h +0 -34
- package/Microsoft.ReactNative/Fabric/platform/react/components/view/windows/primitives.h +0 -42
- package/PropertySheets/External/Microsoft.ReactNative.WinAppSDK.CSharp.PackageReferences.props +0 -11
- package/PropertySheets/External/Microsoft.ReactNative.WinAppSDK.CSharpApp.targets +0 -51
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/TouchEventEmitter.cpp +0 -237
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/TouchEventEmitter.h +0 -59
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/ViewEventEmitter.cpp +0 -159
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/ViewEventEmitter.h +0 -94
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/ViewProps.cpp +0 -465
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/ViewProps.h +0 -116
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/ViewShadowNode.cpp +0 -98
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/primitives.h +0 -326
- package/Scripts/Microsoft.ReactNative.WindowsAppSDK.nuspec +0 -30
- package/Shared/V8JSIRuntimeHolder.cpp +0 -71
- package/Shared/V8JSIRuntimeHolder.h +0 -56
- package/codegen/NativeDevSplitBundleLoaderSpec.g.h +0 -34
- package/template/cs-app-WinAppSDK/MyApp/App.xaml +0 -16
- package/template/cs-app-WinAppSDK/MyApp/App.xaml.cs +0 -70
- package/template/cs-app-WinAppSDK/MyApp/MainWindow.xaml +0 -14
- package/template/cs-app-WinAppSDK/MyApp/MainWindow.xaml.cs +0 -38
- package/template/cs-app-WinAppSDK/MyApp/Properties/PublishProfiles/win10-arm64.pubxml +0 -19
- package/template/cs-app-WinAppSDK/MyApp/Properties/PublishProfiles/win10-x64.pubxml +0 -19
- package/template/cs-app-WinAppSDK/MyApp/Properties/PublishProfiles/win10-x86.pubxml +0 -19
- package/template/cs-app-WinAppSDK/MyApp/Properties/launchSettings.json +0 -10
- package/template/cs-app-WinAppSDK/MyApp/app.manifest +0 -15
- package/template/cs-app-WinAppSDK/proj/ExperimentalFeatures.props +0 -24
- package/template/cs-app-WinAppSDK/proj/MyApp.csproj +0 -53
- package/template/cs-app-WinAppSDK/proj/MyApp.sln +0 -43
- package/template/cs-app-WinAppSDK/proj/NuGet_Config +0 -19
- /package/Libraries/Components/DrawerAndroid/{DrawerLayoutAndroid.ios.js → DrawerLayoutAndroid.js} +0 -0
- /package/Libraries/{Renderer/public → ReactNative/ReactFabricPublicInstance}/ReactFabricPublicInstanceUtils.js +0 -0
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
#include "pch.h"
|
|
3
3
|
#include "CompositionContextHelper.h"
|
|
4
|
-
#if __has_include("Composition.
|
|
5
|
-
#include "Composition.
|
|
4
|
+
#if __has_include("Composition.WindowsCompositionContextHelper.g.cpp")
|
|
5
|
+
#include "Composition.WindowsCompositionContextHelper.g.cpp"
|
|
6
|
+
#endif
|
|
7
|
+
#ifdef USE_WINUI3
|
|
8
|
+
#if __has_include("Composition.MicrosoftCompositionContextHelper.g.cpp")
|
|
9
|
+
#include "Composition.MicrosoftCompositionContextHelper.g.cpp"
|
|
10
|
+
#endif
|
|
6
11
|
#endif
|
|
7
12
|
|
|
8
|
-
#include <Composition.ScrollPositionChangedArgs.g.h>
|
|
9
|
-
#include <Composition.ScrollVisual.g.h>
|
|
10
|
-
#include <Composition.SpriteVisual.g.h>
|
|
11
|
-
#include <Composition.SurfaceBrush.g.h>
|
|
12
13
|
#include <Windows.Graphics.Interop.h>
|
|
13
14
|
#include <windows.ui.composition.interop.h>
|
|
14
15
|
#include <winrt/Windows.Graphics.DirectX.Direct3D11.h>
|
|
@@ -16,8 +17,131 @@
|
|
|
16
17
|
#include <winrt/Windows.UI.Composition.interactions.h>
|
|
17
18
|
#include "CompositionHelpers.h"
|
|
18
19
|
|
|
20
|
+
#ifdef USE_WINUI3
|
|
21
|
+
#include <winrt/Microsoft.UI.Composition.h>
|
|
22
|
+
#include <winrt/Microsoft.UI.Composition.interactions.h>
|
|
23
|
+
#include <winrt/Microsoft.UI.Composition.interop.h>
|
|
24
|
+
#endif
|
|
25
|
+
|
|
19
26
|
namespace Microsoft::ReactNative::Composition {
|
|
20
27
|
|
|
28
|
+
template <typename TSpriteVisual>
|
|
29
|
+
struct CompositionTypeTraits {};
|
|
30
|
+
|
|
31
|
+
struct WindowsTypeTag;
|
|
32
|
+
template <>
|
|
33
|
+
struct CompositionTypeTraits<WindowsTypeTag> {
|
|
34
|
+
using AnimationDelayBehavior = winrt::Windows::UI::Composition::AnimationDelayBehavior;
|
|
35
|
+
using AnimationDirection = winrt::Windows::UI::Composition::AnimationDirection;
|
|
36
|
+
using AnimationIterationBehavior = winrt::Windows::UI::Composition::AnimationIterationBehavior;
|
|
37
|
+
using CompositionAnimation = winrt::Windows::UI::Composition::CompositionAnimation;
|
|
38
|
+
using CompositionBackfaceVisibility = winrt::Windows::UI::Composition::CompositionBackfaceVisibility;
|
|
39
|
+
using CompositionBrush = winrt::Windows::UI::Composition::CompositionBrush;
|
|
40
|
+
using CompositionDrawingSurface = winrt::Windows::UI::Composition::CompositionDrawingSurface;
|
|
41
|
+
using CompositionEllipseGeometry = winrt::Windows::UI::Composition::CompositionEllipseGeometry;
|
|
42
|
+
using CompositionNineGridBrush = winrt::Windows::UI::Composition::CompositionNineGridBrush;
|
|
43
|
+
using CompositionPath = winrt::Windows::UI::Composition::CompositionPath;
|
|
44
|
+
using CompositionSpriteShape = winrt::Windows::UI::Composition::CompositionSpriteShape;
|
|
45
|
+
using CompositionStretch = winrt::Windows::UI::Composition::CompositionStretch;
|
|
46
|
+
using CompositionSurfaceBrush = winrt::Windows::UI::Composition::CompositionSurfaceBrush;
|
|
47
|
+
using Compositor = winrt::Windows::UI::Composition::Compositor;
|
|
48
|
+
using ContainerVisual = winrt::Windows::UI::Composition::ContainerVisual;
|
|
49
|
+
using DropShadow = winrt::Windows::UI::Composition::DropShadow;
|
|
50
|
+
using ICompositionSurface = winrt::Windows::UI::Composition::ICompositionSurface;
|
|
51
|
+
using IInteractionTrackerOwner = winrt::Windows::UI::Composition::Interactions::IInteractionTrackerOwner;
|
|
52
|
+
using InteractionSourceMode = winrt::Windows::UI::Composition::Interactions::InteractionSourceMode;
|
|
53
|
+
using InteractionTracker = winrt::Windows::UI::Composition::Interactions::InteractionTracker;
|
|
54
|
+
using InteractionTrackerCustomAnimationStateEnteredArgs =
|
|
55
|
+
winrt::Windows::UI::Composition::Interactions::InteractionTrackerCustomAnimationStateEnteredArgs;
|
|
56
|
+
using InteractionTrackerIdleStateEnteredArgs =
|
|
57
|
+
winrt::Windows::UI::Composition::Interactions::InteractionTrackerIdleStateEnteredArgs;
|
|
58
|
+
using InteractionTrackerInertiaStateEnteredArgs =
|
|
59
|
+
winrt::Windows::UI::Composition::Interactions::InteractionTrackerInertiaStateEnteredArgs;
|
|
60
|
+
using InteractionTrackerInteractingStateEnteredArgs =
|
|
61
|
+
winrt::Windows::UI::Composition::Interactions::InteractionTrackerInteractingStateEnteredArgs;
|
|
62
|
+
using InteractionTrackerRequestIgnoredArgs =
|
|
63
|
+
winrt::Windows::UI::Composition::Interactions::InteractionTrackerRequestIgnoredArgs;
|
|
64
|
+
using InteractionTrackerValuesChangedArgs =
|
|
65
|
+
winrt::Windows::UI::Composition::Interactions::InteractionTrackerValuesChangedArgs;
|
|
66
|
+
using ScalarKeyFrameAnimation = winrt::Windows::UI::Composition::ScalarKeyFrameAnimation;
|
|
67
|
+
using ShapeVisual = winrt::Windows::UI::Composition::ShapeVisual;
|
|
68
|
+
using SpriteVisual = winrt::Windows::UI::Composition::SpriteVisual;
|
|
69
|
+
using Visual = winrt::Windows::UI::Composition::Visual;
|
|
70
|
+
using VisualInteractionSource = winrt::Windows::UI::Composition::Interactions::VisualInteractionSource;
|
|
71
|
+
using VisualInteractionSourceRedirectionMode =
|
|
72
|
+
winrt::Windows::UI::Composition::Interactions::VisualInteractionSourceRedirectionMode;
|
|
73
|
+
using CompositionGraphicsDevice = winrt::Windows::UI::Composition::CompositionGraphicsDevice;
|
|
74
|
+
|
|
75
|
+
using ICompositionDrawingSurfaceInterop = ABI::Windows::UI::Composition::ICompositionDrawingSurfaceInterop;
|
|
76
|
+
using ICompositorInterop = ABI::Windows::UI::Composition::ICompositorInterop;
|
|
77
|
+
|
|
78
|
+
using IInnerCompositionCompositor = IWindowsCompositionCompositor;
|
|
79
|
+
using IInnerCompositionDropShadow = IWindowsCompositionDropShadow;
|
|
80
|
+
using IInnerCompositionVisual = IWindowsCompositionVisual;
|
|
81
|
+
using IInnerCompositionBrush = IWindowsCompositionBrush;
|
|
82
|
+
using IInnerCompositionDrawingSurface = IWindowsCompositionDrawingSurfaceInner;
|
|
83
|
+
using CompositionContextHelper = winrt::Microsoft::ReactNative::Composition::WindowsCompositionContextHelper;
|
|
84
|
+
};
|
|
85
|
+
using WindowsTypeRedirects = CompositionTypeTraits<WindowsTypeTag>;
|
|
86
|
+
|
|
87
|
+
#ifdef USE_WINUI3
|
|
88
|
+
struct MicrosoftTypeTag;
|
|
89
|
+
template <>
|
|
90
|
+
struct CompositionTypeTraits<MicrosoftTypeTag> {
|
|
91
|
+
using AnimationDelayBehavior = winrt::Microsoft::UI::Composition::AnimationDelayBehavior;
|
|
92
|
+
using AnimationDirection = winrt::Microsoft::UI::Composition::AnimationDirection;
|
|
93
|
+
using AnimationIterationBehavior = winrt::Microsoft::UI::Composition::AnimationIterationBehavior;
|
|
94
|
+
using CompositionAnimation = winrt::Microsoft::UI::Composition::CompositionAnimation;
|
|
95
|
+
using CompositionBackfaceVisibility = winrt::Microsoft::UI::Composition::CompositionBackfaceVisibility;
|
|
96
|
+
using CompositionBrush = winrt::Microsoft::UI::Composition::CompositionBrush;
|
|
97
|
+
using CompositionDrawingSurface = winrt::Microsoft::UI::Composition::CompositionDrawingSurface;
|
|
98
|
+
using CompositionEllipseGeometry = winrt::Microsoft::UI::Composition::CompositionEllipseGeometry;
|
|
99
|
+
using CompositionNineGridBrush = winrt::Microsoft::UI::Composition::CompositionNineGridBrush;
|
|
100
|
+
using CompositionPath = winrt::Microsoft::UI::Composition::CompositionPath;
|
|
101
|
+
using CompositionSpriteShape = winrt::Microsoft::UI::Composition::CompositionSpriteShape;
|
|
102
|
+
using CompositionStretch = winrt::Microsoft::UI::Composition::CompositionStretch;
|
|
103
|
+
using CompositionSurfaceBrush = winrt::Microsoft::UI::Composition::CompositionSurfaceBrush;
|
|
104
|
+
using Compositor = winrt::Microsoft::UI::Composition::Compositor;
|
|
105
|
+
using ContainerVisual = winrt::Microsoft::UI::Composition::ContainerVisual;
|
|
106
|
+
using DropShadow = winrt::Microsoft::UI::Composition::DropShadow;
|
|
107
|
+
using ICompositionSurface = winrt::Microsoft::UI::Composition::ICompositionSurface;
|
|
108
|
+
using IInteractionTrackerOwner = winrt::Microsoft::UI::Composition::Interactions::IInteractionTrackerOwner;
|
|
109
|
+
using InteractionSourceMode = winrt::Microsoft::UI::Composition::Interactions::InteractionSourceMode;
|
|
110
|
+
using InteractionTracker = winrt::Microsoft::UI::Composition::Interactions::InteractionTracker;
|
|
111
|
+
using InteractionTrackerCustomAnimationStateEnteredArgs =
|
|
112
|
+
winrt::Microsoft::UI::Composition::Interactions::InteractionTrackerCustomAnimationStateEnteredArgs;
|
|
113
|
+
using InteractionTrackerIdleStateEnteredArgs =
|
|
114
|
+
winrt::Microsoft::UI::Composition::Interactions::InteractionTrackerIdleStateEnteredArgs;
|
|
115
|
+
using InteractionTrackerInertiaStateEnteredArgs =
|
|
116
|
+
winrt::Microsoft::UI::Composition::Interactions::InteractionTrackerInertiaStateEnteredArgs;
|
|
117
|
+
using InteractionTrackerInteractingStateEnteredArgs =
|
|
118
|
+
winrt::Microsoft::UI::Composition::Interactions::InteractionTrackerInteractingStateEnteredArgs;
|
|
119
|
+
using InteractionTrackerRequestIgnoredArgs =
|
|
120
|
+
winrt::Microsoft::UI::Composition::Interactions::InteractionTrackerRequestIgnoredArgs;
|
|
121
|
+
using InteractionTrackerValuesChangedArgs =
|
|
122
|
+
winrt::Microsoft::UI::Composition::Interactions::InteractionTrackerValuesChangedArgs;
|
|
123
|
+
using ScalarKeyFrameAnimation = winrt::Microsoft::UI::Composition::ScalarKeyFrameAnimation;
|
|
124
|
+
using ShapeVisual = winrt::Microsoft::UI::Composition::ShapeVisual;
|
|
125
|
+
using SpriteVisual = winrt::Microsoft::UI::Composition::SpriteVisual;
|
|
126
|
+
using Visual = winrt::Microsoft::UI::Composition::Visual;
|
|
127
|
+
using VisualInteractionSource = winrt::Microsoft::UI::Composition::Interactions::VisualInteractionSource;
|
|
128
|
+
using VisualInteractionSourceRedirectionMode =
|
|
129
|
+
winrt::Microsoft::UI::Composition::Interactions::VisualInteractionSourceRedirectionMode;
|
|
130
|
+
using CompositionGraphicsDevice = winrt::Microsoft::UI::Composition::CompositionGraphicsDevice;
|
|
131
|
+
|
|
132
|
+
using ICompositionDrawingSurfaceInterop = winrt::Microsoft::UI::Composition::ICompositionDrawingSurfaceInterop;
|
|
133
|
+
using ICompositorInterop = winrt::Microsoft::UI::Composition::ICompositorInterop;
|
|
134
|
+
|
|
135
|
+
using IInnerCompositionCompositor = IMicrosoftCompositionCompositor;
|
|
136
|
+
using IInnerCompositionDropShadow = IMicrosoftCompositionDropShadow;
|
|
137
|
+
using IInnerCompositionVisual = IMicrosoftCompositionVisual;
|
|
138
|
+
using IInnerCompositionBrush = IMicrosoftCompositionBrush;
|
|
139
|
+
using IInnerCompositionDrawingSurface = IMicrosoftCompositionDrawingSurfaceInner;
|
|
140
|
+
using CompositionContextHelper = winrt::Microsoft::ReactNative::Composition::MicrosoftCompositionContextHelper;
|
|
141
|
+
};
|
|
142
|
+
using MicrosoftTypeRedirects = CompositionTypeTraits<MicrosoftTypeTag>;
|
|
143
|
+
#endif
|
|
144
|
+
|
|
21
145
|
struct GeometrySource : public winrt::implements<
|
|
22
146
|
GeometrySource,
|
|
23
147
|
winrt::Windows::Graphics::IGeometrySource2D,
|
|
@@ -39,39 +163,14 @@ struct GeometrySource : public winrt::implements<
|
|
|
39
163
|
winrt::com_ptr<ID2D1Geometry> m_geometry;
|
|
40
164
|
};
|
|
41
165
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
drawingSurface.as(m_drawingSurfaceInterop);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
HRESULT BeginDraw(ID2D1DeviceContext **deviceContextOut, POINT *offset) noexcept {
|
|
52
|
-
return m_drawingSurfaceInterop->BeginDraw(nullptr, __uuidof(ID2D1DeviceContext), (void **)deviceContextOut, offset);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
HRESULT EndDraw() noexcept {
|
|
56
|
-
return m_drawingSurfaceInterop->EndDraw();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
winrt::Windows::UI::Composition::ICompositionSurface Inner() const noexcept {
|
|
60
|
-
winrt::Windows::UI::Composition::ICompositionSurface surface;
|
|
61
|
-
m_drawingSurfaceInterop.as(surface);
|
|
62
|
-
return surface;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
private:
|
|
66
|
-
winrt::com_ptr<ABI::Windows::UI::Composition::ICompositionDrawingSurfaceInterop> m_drawingSurfaceInterop;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
struct CompDropShadow
|
|
70
|
-
: public winrt::
|
|
71
|
-
implements<CompDropShadow, winrt::Microsoft::ReactNative::Composition::IDropShadow, ICompositionDropShadow> {
|
|
72
|
-
CompDropShadow(winrt::Windows::UI::Composition::DropShadow const &shadow) : m_shadow(shadow) {}
|
|
166
|
+
template <typename TTypeRedirects>
|
|
167
|
+
struct CompDropShadow : public winrt::implements<
|
|
168
|
+
CompDropShadow<TTypeRedirects>,
|
|
169
|
+
winrt::Microsoft::ReactNative::Composition::IDropShadow,
|
|
170
|
+
typename TTypeRedirects::IInnerCompositionDropShadow> {
|
|
171
|
+
CompDropShadow(typename TTypeRedirects::DropShadow const &shadow) : m_shadow(shadow) {}
|
|
73
172
|
|
|
74
|
-
|
|
173
|
+
typename TTypeRedirects::DropShadow InnerShadow() const noexcept override {
|
|
75
174
|
return m_shadow;
|
|
76
175
|
}
|
|
77
176
|
|
|
@@ -92,31 +191,62 @@ struct CompDropShadow
|
|
|
92
191
|
}
|
|
93
192
|
|
|
94
193
|
private:
|
|
95
|
-
|
|
194
|
+
typename TTypeRedirects::DropShadow m_shadow;
|
|
96
195
|
};
|
|
196
|
+
using WindowsCompDropShadow = CompDropShadow<WindowsTypeRedirects>;
|
|
197
|
+
#ifdef USE_WINUI3
|
|
198
|
+
using MicrosoftCompDropShadow = CompDropShadow<MicrosoftTypeRedirects>;
|
|
199
|
+
#endif
|
|
97
200
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
201
|
+
template <typename TTypeRedirects>
|
|
202
|
+
struct CompBrush : public winrt::implements<
|
|
203
|
+
CompBrush<TTypeRedirects>,
|
|
204
|
+
winrt::Microsoft::ReactNative::Composition::IBrush,
|
|
205
|
+
typename TTypeRedirects::IInnerCompositionBrush> {
|
|
206
|
+
CompBrush(typename TTypeRedirects::CompositionBrush const &brush) : m_brush(brush) {}
|
|
101
207
|
|
|
102
|
-
|
|
208
|
+
typename TTypeRedirects::CompositionBrush InnerBrush() const noexcept {
|
|
103
209
|
return m_brush;
|
|
104
210
|
}
|
|
105
211
|
|
|
106
212
|
private:
|
|
107
|
-
|
|
213
|
+
typename TTypeRedirects::CompositionBrush m_brush;
|
|
108
214
|
};
|
|
215
|
+
using WindowsCompBrush = CompBrush<WindowsTypeRedirects>;
|
|
216
|
+
#ifdef USE_WINUI3
|
|
217
|
+
using MicrosoftCompBrush = CompBrush<MicrosoftTypeRedirects>;
|
|
218
|
+
#endif
|
|
219
|
+
|
|
220
|
+
template <typename TTypeRedirects>
|
|
221
|
+
struct CompDrawingSurfaceBrush : public winrt::implements<
|
|
222
|
+
CompDrawingSurfaceBrush<TTypeRedirects>,
|
|
223
|
+
winrt::Microsoft::ReactNative::Composition::IDrawingSurfaceBrush,
|
|
224
|
+
winrt::Microsoft::ReactNative::Composition::IBrush,
|
|
225
|
+
typename TTypeRedirects::IInnerCompositionBrush,
|
|
226
|
+
ICompositionDrawingSurfaceInterop,
|
|
227
|
+
typename TTypeRedirects::IInnerCompositionDrawingSurface> {
|
|
228
|
+
CompDrawingSurfaceBrush(
|
|
229
|
+
const typename TTypeRedirects::Compositor &compositor,
|
|
230
|
+
typename TTypeRedirects::CompositionDrawingSurface const &drawingSurface)
|
|
231
|
+
: m_brush(compositor.CreateSurfaceBrush(drawingSurface)) {
|
|
232
|
+
drawingSurface.as(m_drawingSurfaceInterop);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
HRESULT BeginDraw(ID2D1DeviceContext **deviceContextOut, POINT *offset) noexcept {
|
|
236
|
+
return m_drawingSurfaceInterop->BeginDraw(nullptr, __uuidof(ID2D1DeviceContext), (void **)deviceContextOut, offset);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
HRESULT EndDraw() noexcept {
|
|
240
|
+
return m_drawingSurfaceInterop->EndDraw();
|
|
241
|
+
}
|
|
109
242
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
: m_brush(compositor.CreateSurfaceBrush(
|
|
116
|
-
winrt::Microsoft::ReactNative::Composition::CompositionContextHelper::InnerSurface(
|
|
117
|
-
drawingSurfaceInterop))) {}
|
|
243
|
+
typename TTypeRedirects::ICompositionSurface Inner() const noexcept {
|
|
244
|
+
typename TTypeRedirects::ICompositionSurface surface;
|
|
245
|
+
m_drawingSurfaceInterop.as(surface);
|
|
246
|
+
return surface;
|
|
247
|
+
}
|
|
118
248
|
|
|
119
|
-
|
|
249
|
+
typename TTypeRedirects::CompositionBrush InnerBrush() const noexcept {
|
|
120
250
|
return m_brush;
|
|
121
251
|
}
|
|
122
252
|
|
|
@@ -130,42 +260,48 @@ struct CompSurfaceBrush
|
|
|
130
260
|
void Stretch(winrt::Microsoft::ReactNative::Composition::CompositionStretch mode) noexcept {
|
|
131
261
|
static_assert(
|
|
132
262
|
static_cast<winrt::Microsoft::ReactNative::Composition::CompositionStretch>(
|
|
133
|
-
|
|
263
|
+
TTypeRedirects::CompositionStretch::None) ==
|
|
134
264
|
winrt::Microsoft::ReactNative::Composition::CompositionStretch::None);
|
|
135
265
|
static_assert(
|
|
136
266
|
static_cast<winrt::Microsoft::ReactNative::Composition::CompositionStretch>(
|
|
137
|
-
|
|
267
|
+
TTypeRedirects::CompositionStretch::Fill) ==
|
|
138
268
|
winrt::Microsoft::ReactNative::Composition::CompositionStretch::Fill);
|
|
139
269
|
static_assert(
|
|
140
270
|
static_cast<winrt::Microsoft::ReactNative::Composition::CompositionStretch>(
|
|
141
|
-
|
|
271
|
+
TTypeRedirects::CompositionStretch::Uniform) ==
|
|
142
272
|
winrt::Microsoft::ReactNative::Composition::CompositionStretch::Uniform);
|
|
143
273
|
static_assert(
|
|
144
274
|
static_cast<winrt::Microsoft::ReactNative::Composition::CompositionStretch>(
|
|
145
|
-
|
|
275
|
+
TTypeRedirects::CompositionStretch::UniformToFill) ==
|
|
146
276
|
winrt::Microsoft::ReactNative::Composition::CompositionStretch::UniformToFill);
|
|
147
277
|
|
|
148
|
-
m_brush.Stretch(static_cast<
|
|
278
|
+
m_brush.Stretch(static_cast<typename TTypeRedirects::CompositionStretch>(mode));
|
|
149
279
|
}
|
|
150
280
|
|
|
151
281
|
private:
|
|
152
|
-
|
|
282
|
+
typename TTypeRedirects::CompositionSurfaceBrush m_brush;
|
|
283
|
+
winrt::com_ptr<typename TTypeRedirects::ICompositionDrawingSurfaceInterop> m_drawingSurfaceInterop;
|
|
153
284
|
};
|
|
285
|
+
using WindowsCompDrawingSurfaceBrush = CompDrawingSurfaceBrush<WindowsTypeRedirects>;
|
|
286
|
+
#ifdef USE_WINUI3
|
|
287
|
+
using MicrosoftCompDrawingSurfaceBrush = CompDrawingSurfaceBrush<MicrosoftTypeRedirects>;
|
|
288
|
+
#endif
|
|
154
289
|
|
|
290
|
+
template <typename TTypeRedirects>
|
|
155
291
|
struct CompVisual : public winrt::implements<
|
|
156
|
-
CompVisual
|
|
292
|
+
CompVisual<TTypeRedirects>,
|
|
157
293
|
winrt::Microsoft::ReactNative::Composition::IVisual,
|
|
158
|
-
|
|
294
|
+
typename TTypeRedirects::IInnerCompositionVisual,
|
|
159
295
|
IVisualInterop> {
|
|
160
|
-
CompVisual(
|
|
296
|
+
CompVisual(typename TTypeRedirects::Visual const &visual) : m_visual(visual) {}
|
|
161
297
|
|
|
162
|
-
|
|
298
|
+
typename TTypeRedirects::Visual InnerVisual() const noexcept override {
|
|
163
299
|
return m_visual;
|
|
164
300
|
}
|
|
165
301
|
|
|
166
302
|
void InsertAt(const winrt::Microsoft::ReactNative::Composition::IVisual &visual, uint32_t index) noexcept {
|
|
167
|
-
auto containerChildren = m_visual.as<
|
|
168
|
-
auto compVisual =
|
|
303
|
+
auto containerChildren = m_visual.as<typename TTypeRedirects::ContainerVisual>().Children();
|
|
304
|
+
auto compVisual = TTypeRedirects::CompositionContextHelper::InnerVisual(visual);
|
|
169
305
|
if (index == 0 || containerChildren.Count() == 0) {
|
|
170
306
|
containerChildren.InsertAtTop(compVisual);
|
|
171
307
|
return;
|
|
@@ -177,18 +313,17 @@ struct CompVisual : public winrt::implements<
|
|
|
177
313
|
}
|
|
178
314
|
|
|
179
315
|
void Remove(const winrt::Microsoft::ReactNative::Composition::IVisual &visual) noexcept {
|
|
180
|
-
auto compVisual =
|
|
181
|
-
auto containerChildren = m_visual.as<
|
|
316
|
+
auto compVisual = TTypeRedirects::CompositionContextHelper::InnerVisual(visual);
|
|
317
|
+
auto containerChildren = m_visual.as<typename TTypeRedirects::ContainerVisual>().Children();
|
|
182
318
|
containerChildren.Remove(compVisual);
|
|
183
319
|
}
|
|
184
320
|
|
|
185
321
|
winrt::Microsoft::ReactNative::Composition::IVisual GetAt(uint32_t index) noexcept {
|
|
186
|
-
auto containerChildren = m_visual.as<
|
|
322
|
+
auto containerChildren = m_visual.as<typename TTypeRedirects::ContainerVisual>().Children();
|
|
187
323
|
auto it = containerChildren.First();
|
|
188
324
|
for (uint32_t i = 0; i < index; i++)
|
|
189
325
|
it.MoveNext();
|
|
190
|
-
return
|
|
191
|
-
it.Current());
|
|
326
|
+
return TTypeRedirects::CompositionContextHelper::CreateVisual(it.Current());
|
|
192
327
|
}
|
|
193
328
|
|
|
194
329
|
void SetClippingPath(ID2D1Geometry *clippingPath) noexcept {
|
|
@@ -197,7 +332,7 @@ struct CompVisual : public winrt::implements<
|
|
|
197
332
|
return;
|
|
198
333
|
}
|
|
199
334
|
auto geometry = winrt::make<GeometrySource>(clippingPath);
|
|
200
|
-
auto path =
|
|
335
|
+
auto path = typename TTypeRedirects::CompositionPath(geometry);
|
|
201
336
|
auto pathgeo = m_visual.Compositor().CreatePathGeometry(path);
|
|
202
337
|
auto clip = m_visual.Compositor().CreateGeometricClip(pathgeo);
|
|
203
338
|
m_visual.Clip(clip);
|
|
@@ -250,24 +385,33 @@ struct CompVisual : public winrt::implements<
|
|
|
250
385
|
}
|
|
251
386
|
|
|
252
387
|
void BackfaceVisibility(winrt::Microsoft::ReactNative::Composition::BackfaceVisibility value) {
|
|
253
|
-
m_visual.BackfaceVisibility(static_cast<
|
|
388
|
+
m_visual.BackfaceVisibility(static_cast<typename TTypeRedirects::CompositionBackfaceVisibility>(value));
|
|
254
389
|
}
|
|
255
390
|
|
|
256
391
|
private:
|
|
257
|
-
|
|
392
|
+
typename TTypeRedirects::Visual m_visual;
|
|
258
393
|
};
|
|
394
|
+
using WindowsCompVisual = CompVisual<WindowsTypeRedirects>;
|
|
395
|
+
#ifdef USE_WINUI3
|
|
396
|
+
using MicrosoftCompVisual = CompVisual<MicrosoftTypeRedirects>;
|
|
397
|
+
#endif
|
|
259
398
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
399
|
+
template <typename TTypeRedirects>
|
|
400
|
+
struct CompSpriteVisual : winrt::implements<
|
|
401
|
+
CompSpriteVisual<TTypeRedirects>,
|
|
402
|
+
winrt::Microsoft::ReactNative::Composition::ISpriteVisual,
|
|
403
|
+
winrt::Microsoft::ReactNative::Composition::IVisual,
|
|
404
|
+
typename TTypeRedirects::IInnerCompositionVisual,
|
|
405
|
+
IVisualInterop> {
|
|
406
|
+
CompSpriteVisual(typename TTypeRedirects::SpriteVisual const &visual) : m_visual(visual) {}
|
|
263
407
|
|
|
264
|
-
|
|
408
|
+
typename TTypeRedirects::Visual InnerVisual() const noexcept override {
|
|
265
409
|
return m_visual;
|
|
266
410
|
}
|
|
267
411
|
|
|
268
412
|
void InsertAt(const winrt::Microsoft::ReactNative::Composition::IVisual &visual, uint32_t index) noexcept {
|
|
269
413
|
auto containerChildren = m_visual.Children();
|
|
270
|
-
auto compVisual =
|
|
414
|
+
auto compVisual = TTypeRedirects::CompositionContextHelper::InnerVisual(visual);
|
|
271
415
|
if (index == 0) {
|
|
272
416
|
containerChildren.InsertAtBottom(compVisual);
|
|
273
417
|
return;
|
|
@@ -279,22 +423,21 @@ struct CompSpriteVisual : winrt::Microsoft::ReactNative::Composition::implementa
|
|
|
279
423
|
}
|
|
280
424
|
|
|
281
425
|
void Remove(const winrt::Microsoft::ReactNative::Composition::IVisual &visual) noexcept {
|
|
282
|
-
auto compVisual =
|
|
426
|
+
auto compVisual = TTypeRedirects::CompositionContextHelper::InnerVisual(visual);
|
|
283
427
|
auto containerChildren = m_visual.Children();
|
|
284
428
|
containerChildren.Remove(compVisual);
|
|
285
429
|
}
|
|
286
430
|
|
|
287
431
|
winrt::Microsoft::ReactNative::Composition::IVisual GetAt(uint32_t index) noexcept {
|
|
288
|
-
auto containerChildren = m_visual.as<
|
|
432
|
+
auto containerChildren = m_visual.as<typename TTypeRedirects::ContainerVisual>().Children();
|
|
289
433
|
auto it = containerChildren.First();
|
|
290
434
|
for (uint32_t i = 0; i < index; i++)
|
|
291
435
|
it.MoveNext();
|
|
292
|
-
return
|
|
293
|
-
it.Current());
|
|
436
|
+
return TTypeRedirects::CompositionContextHelper::CreateVisual(it.Current());
|
|
294
437
|
}
|
|
295
438
|
|
|
296
439
|
void Brush(const winrt::Microsoft::ReactNative::Composition::IBrush &brush) noexcept {
|
|
297
|
-
m_visual.Brush(
|
|
440
|
+
m_visual.Brush(TTypeRedirects::CompositionContextHelper::InnerBrush(brush));
|
|
298
441
|
}
|
|
299
442
|
|
|
300
443
|
void Opacity(float opacity) noexcept {
|
|
@@ -344,7 +487,7 @@ struct CompSpriteVisual : winrt::Microsoft::ReactNative::Composition::implementa
|
|
|
344
487
|
}
|
|
345
488
|
|
|
346
489
|
void BackfaceVisibility(winrt::Microsoft::ReactNative::Composition::BackfaceVisibility value) {
|
|
347
|
-
m_visual.BackfaceVisibility(static_cast<
|
|
490
|
+
m_visual.BackfaceVisibility(static_cast<typename TTypeRedirects::CompositionBackfaceVisibility>(value));
|
|
348
491
|
}
|
|
349
492
|
|
|
350
493
|
void SetClippingPath(ID2D1Geometry *clippingPath) noexcept {
|
|
@@ -353,23 +496,27 @@ struct CompSpriteVisual : winrt::Microsoft::ReactNative::Composition::implementa
|
|
|
353
496
|
return;
|
|
354
497
|
}
|
|
355
498
|
auto geometry = winrt::make<GeometrySource>(clippingPath);
|
|
356
|
-
auto path =
|
|
499
|
+
auto path = TTypeRedirects::CompositionPath(geometry);
|
|
357
500
|
auto pathgeo = m_visual.Compositor().CreatePathGeometry(path);
|
|
358
501
|
auto clip = m_visual.Compositor().CreateGeometricClip(pathgeo);
|
|
359
502
|
m_visual.Clip(clip);
|
|
360
503
|
}
|
|
361
504
|
|
|
362
505
|
void Shadow(const winrt::Microsoft::ReactNative::Composition::IDropShadow &shadow) noexcept {
|
|
363
|
-
m_visual.Shadow(
|
|
506
|
+
m_visual.Shadow(TTypeRedirects::CompositionContextHelper::InnerDropShadow(shadow));
|
|
364
507
|
}
|
|
365
508
|
|
|
366
509
|
private:
|
|
367
|
-
|
|
510
|
+
typename TTypeRedirects::SpriteVisual m_visual;
|
|
368
511
|
};
|
|
512
|
+
using WindowsCompSpriteVisual = CompSpriteVisual<WindowsTypeRedirects>;
|
|
513
|
+
#ifdef USE_WINUI3
|
|
514
|
+
using MicrosoftCompSpriteVisual = CompSpriteVisual<MicrosoftTypeRedirects>;
|
|
515
|
+
#endif
|
|
369
516
|
|
|
370
|
-
struct CompScrollPositionChangedArgs
|
|
371
|
-
|
|
372
|
-
|
|
517
|
+
struct CompScrollPositionChangedArgs : winrt::implements<
|
|
518
|
+
CompScrollPositionChangedArgs,
|
|
519
|
+
winrt::Microsoft::ReactNative::Composition::IScrollPositionChangedArgs> {
|
|
373
520
|
CompScrollPositionChangedArgs(winrt::Windows::Foundation::Numerics::float2 position) : m_position(position) {}
|
|
374
521
|
|
|
375
522
|
winrt::Windows::Foundation::Numerics::float2 Position() {
|
|
@@ -380,32 +527,45 @@ struct CompScrollPositionChangedArgs
|
|
|
380
527
|
winrt::Windows::Foundation::Numerics::float2 m_position;
|
|
381
528
|
};
|
|
382
529
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
530
|
+
template <typename TTypeRedirects>
|
|
531
|
+
struct CompScrollerVisual : winrt::implements<
|
|
532
|
+
CompScrollerVisual<TTypeRedirects>,
|
|
533
|
+
winrt::Microsoft::ReactNative::Composition::IScrollVisual,
|
|
534
|
+
winrt::Microsoft::ReactNative::Composition::IVisual,
|
|
535
|
+
typename TTypeRedirects::IInnerCompositionVisual,
|
|
536
|
+
IVisualInterop> {
|
|
537
|
+
struct ScrollInteractionTrackerOwner
|
|
538
|
+
: public winrt::implements<ScrollInteractionTrackerOwner, typename TTypeRedirects::IInteractionTrackerOwner> {
|
|
388
539
|
ScrollInteractionTrackerOwner(CompScrollerVisual *outer) : m_outer(outer){};
|
|
389
540
|
|
|
390
541
|
void CustomAnimationStateEntered(
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
542
|
+
typename TTypeRedirects::InteractionTracker sender,
|
|
543
|
+
typename TTypeRedirects::InteractionTrackerCustomAnimationStateEnteredArgs args) noexcept {
|
|
544
|
+
m_outer->m_custom = true;
|
|
545
|
+
m_outer->m_inertia = false;
|
|
546
|
+
}
|
|
394
547
|
void IdleStateEntered(
|
|
395
|
-
|
|
396
|
-
|
|
548
|
+
typename TTypeRedirects::InteractionTracker sender,
|
|
549
|
+
typename TTypeRedirects::InteractionTrackerIdleStateEnteredArgs args) noexcept {
|
|
550
|
+
m_outer->m_custom = false;
|
|
551
|
+
m_outer->m_inertia = false;
|
|
552
|
+
}
|
|
397
553
|
void InertiaStateEntered(
|
|
398
|
-
|
|
399
|
-
|
|
554
|
+
typename TTypeRedirects::InteractionTracker sender,
|
|
555
|
+
typename TTypeRedirects::InteractionTrackerInertiaStateEnteredArgs args) noexcept {
|
|
556
|
+
m_outer->m_custom = false;
|
|
557
|
+
m_outer->m_inertia = true;
|
|
558
|
+
}
|
|
400
559
|
void InteractingStateEntered(
|
|
401
|
-
|
|
402
|
-
|
|
560
|
+
typename TTypeRedirects::InteractionTracker sender,
|
|
561
|
+
typename TTypeRedirects::InteractionTrackerInteractingStateEnteredArgs args) noexcept {}
|
|
403
562
|
void RequestIgnored(
|
|
404
|
-
|
|
405
|
-
|
|
563
|
+
typename TTypeRedirects::InteractionTracker sender,
|
|
564
|
+
typename TTypeRedirects::InteractionTrackerRequestIgnoredArgs args) noexcept {}
|
|
406
565
|
void ValuesChanged(
|
|
407
|
-
|
|
408
|
-
|
|
566
|
+
typename TTypeRedirects::InteractionTracker sender,
|
|
567
|
+
typename TTypeRedirects::InteractionTrackerValuesChangedArgs args) noexcept {
|
|
568
|
+
m_outer->m_currentPosition = args.Position();
|
|
409
569
|
m_outer->FireScrollPositionChanged({args.Position().x, args.Position().y});
|
|
410
570
|
}
|
|
411
571
|
|
|
@@ -413,7 +573,7 @@ struct CompScrollerVisual : winrt::Microsoft::ReactNative::Composition::implemen
|
|
|
413
573
|
CompScrollerVisual *m_outer;
|
|
414
574
|
};
|
|
415
575
|
|
|
416
|
-
CompScrollerVisual(
|
|
576
|
+
CompScrollerVisual(typename TTypeRedirects::SpriteVisual const &visual) : m_visual(visual) {
|
|
417
577
|
auto compositor = m_visual.Compositor();
|
|
418
578
|
m_contentVisual = compositor.CreateSpriteVisual();
|
|
419
579
|
|
|
@@ -425,25 +585,20 @@ struct CompScrollerVisual : winrt::Microsoft::ReactNative::Composition::implemen
|
|
|
425
585
|
|
|
426
586
|
m_visual.Clip(compositor.CreateInsetClip(0, 0, 0, 0));
|
|
427
587
|
|
|
428
|
-
m_interactionTracker =
|
|
588
|
+
m_interactionTracker = TTypeRedirects::InteractionTracker::CreateWithOwner(
|
|
429
589
|
compositor, winrt::make<ScrollInteractionTrackerOwner>(this));
|
|
430
590
|
|
|
431
591
|
m_interactionTracker.MinScale(1.0);
|
|
432
592
|
m_interactionTracker.MaxScale(1.0);
|
|
433
593
|
|
|
434
|
-
m_visualInteractionSource =
|
|
435
|
-
winrt::Windows::UI::Composition::Interactions::VisualInteractionSource::Create(m_visual);
|
|
594
|
+
m_visualInteractionSource = TTypeRedirects::VisualInteractionSource::Create(m_visual);
|
|
436
595
|
|
|
437
|
-
m_visualInteractionSource.PositionXSourceMode(
|
|
438
|
-
|
|
439
|
-
m_visualInteractionSource.
|
|
440
|
-
winrt::Windows::UI::Composition::Interactions::InteractionSourceMode::EnabledWithInertia);
|
|
441
|
-
m_visualInteractionSource.ScaleSourceMode(
|
|
442
|
-
winrt::Windows::UI::Composition::Interactions::InteractionSourceMode::Disabled);
|
|
596
|
+
m_visualInteractionSource.PositionXSourceMode(TTypeRedirects::InteractionSourceMode::EnabledWithInertia);
|
|
597
|
+
m_visualInteractionSource.PositionYSourceMode(TTypeRedirects::InteractionSourceMode::EnabledWithInertia);
|
|
598
|
+
m_visualInteractionSource.ScaleSourceMode(TTypeRedirects::InteractionSourceMode::Disabled);
|
|
443
599
|
|
|
444
600
|
m_visualInteractionSource.ManipulationRedirectionMode(
|
|
445
|
-
|
|
446
|
-
CapableTouchpadAndPointerWheel);
|
|
601
|
+
TTypeRedirects::VisualInteractionSourceRedirectionMode::CapableTouchpadAndPointerWheel);
|
|
447
602
|
m_interactionTracker.InteractionSources().Add(m_visualInteractionSource);
|
|
448
603
|
|
|
449
604
|
auto positionExpression = compositor.CreateExpressionAnimation(L"-tracker.Position");
|
|
@@ -451,13 +606,13 @@ struct CompScrollerVisual : winrt::Microsoft::ReactNative::Composition::implemen
|
|
|
451
606
|
m_contentVisual.StartAnimation(L"Offset", positionExpression);
|
|
452
607
|
}
|
|
453
608
|
|
|
454
|
-
|
|
609
|
+
typename TTypeRedirects::Visual InnerVisual() const noexcept {
|
|
455
610
|
return m_visual;
|
|
456
611
|
}
|
|
457
612
|
|
|
458
613
|
void InsertAt(const winrt::Microsoft::ReactNative::Composition::IVisual &visual, uint32_t index) noexcept {
|
|
459
614
|
auto containerChildren = m_contentVisual.Children();
|
|
460
|
-
auto compVisual =
|
|
615
|
+
auto compVisual = TTypeRedirects::CompositionContextHelper::InnerVisual(visual);
|
|
461
616
|
if (index == 0 || containerChildren.Count() == 0) {
|
|
462
617
|
containerChildren.InsertAtTop(compVisual);
|
|
463
618
|
return;
|
|
@@ -469,22 +624,21 @@ struct CompScrollerVisual : winrt::Microsoft::ReactNative::Composition::implemen
|
|
|
469
624
|
}
|
|
470
625
|
|
|
471
626
|
void Remove(const winrt::Microsoft::ReactNative::Composition::IVisual &visual) noexcept {
|
|
472
|
-
auto compVisual =
|
|
627
|
+
auto compVisual = TTypeRedirects::CompositionContextHelper::InnerVisual(visual);
|
|
473
628
|
auto containerChildren = m_contentVisual.Children();
|
|
474
629
|
containerChildren.Remove(compVisual);
|
|
475
630
|
}
|
|
476
631
|
|
|
477
632
|
winrt::Microsoft::ReactNative::Composition::IVisual GetAt(uint32_t index) noexcept {
|
|
478
|
-
auto containerChildren = m_visual.as<
|
|
633
|
+
auto containerChildren = m_visual.as<typename TTypeRedirects::ContainerVisual>().Children();
|
|
479
634
|
auto it = containerChildren.First();
|
|
480
635
|
for (uint32_t i = 0; i < index; i++)
|
|
481
636
|
it.MoveNext();
|
|
482
|
-
return
|
|
483
|
-
it.Current());
|
|
637
|
+
return TTypeRedirects::CompositionContextHelper::CreateVisual(it.Current());
|
|
484
638
|
}
|
|
485
639
|
|
|
486
640
|
void Brush(const winrt::Microsoft::ReactNative::Composition::IBrush &brush) noexcept {
|
|
487
|
-
m_visual.Brush(
|
|
641
|
+
m_visual.Brush(TTypeRedirects::CompositionContextHelper::InnerBrush(brush));
|
|
488
642
|
}
|
|
489
643
|
|
|
490
644
|
void Opacity(float opacity) noexcept {
|
|
@@ -536,7 +690,7 @@ struct CompScrollerVisual : winrt::Microsoft::ReactNative::Composition::implemen
|
|
|
536
690
|
}
|
|
537
691
|
|
|
538
692
|
void BackfaceVisibility(winrt::Microsoft::ReactNative::Composition::BackfaceVisibility value) {
|
|
539
|
-
m_visual.BackfaceVisibility(static_cast<
|
|
693
|
+
m_visual.BackfaceVisibility(static_cast<typename TTypeRedirects::CompositionBackfaceVisibility>(value));
|
|
540
694
|
}
|
|
541
695
|
|
|
542
696
|
void SetClippingPath(ID2D1Geometry *clippingPath) noexcept {
|
|
@@ -545,19 +699,19 @@ struct CompScrollerVisual : winrt::Microsoft::ReactNative::Composition::implemen
|
|
|
545
699
|
return;
|
|
546
700
|
}
|
|
547
701
|
auto geometry = winrt::make<GeometrySource>(clippingPath);
|
|
548
|
-
auto path =
|
|
702
|
+
auto path = TTypeRedirects::CompositionPath(geometry);
|
|
549
703
|
auto pathgeo = m_visual.Compositor().CreatePathGeometry(path);
|
|
550
704
|
auto clip = m_visual.Compositor().CreateGeometricClip(pathgeo);
|
|
551
705
|
m_visual.Clip(clip);
|
|
552
706
|
}
|
|
553
707
|
|
|
554
708
|
void Shadow(const winrt::Microsoft::ReactNative::Composition::IDropShadow &shadow) noexcept {
|
|
555
|
-
m_visual.Shadow(
|
|
709
|
+
m_visual.Shadow(TTypeRedirects::CompositionContextHelper::InnerDropShadow(shadow));
|
|
556
710
|
}
|
|
557
711
|
|
|
558
712
|
winrt::event_token ScrollPositionChanged(
|
|
559
713
|
winrt::Windows::Foundation::EventHandler<
|
|
560
|
-
winrt::Microsoft::ReactNative::Composition::
|
|
714
|
+
winrt::Microsoft::ReactNative::Composition::IScrollPositionChangedArgs> const &handler) {
|
|
561
715
|
return m_scrollPositionChangedEvent.add(handler);
|
|
562
716
|
}
|
|
563
717
|
|
|
@@ -575,20 +729,54 @@ struct CompScrollerVisual : winrt::Microsoft::ReactNative::Composition::implemen
|
|
|
575
729
|
return m_interactionTracker.Position();
|
|
576
730
|
}
|
|
577
731
|
|
|
578
|
-
|
|
579
|
-
|
|
732
|
+
// ChangeOffsets scrolling constants
|
|
733
|
+
static constexpr int64_t s_offsetsChangeMsPerUnit{5};
|
|
734
|
+
static constexpr int64_t s_offsetsChangeMinMs{50};
|
|
735
|
+
static constexpr int64_t s_offsetsChangeMaxMs{1000};
|
|
736
|
+
|
|
737
|
+
typename TTypeRedirects::CompositionAnimation GetPositionAnimation(float x, float y) {
|
|
738
|
+
const int64_t distance =
|
|
739
|
+
static_cast<int64_t>(std::sqrt(std::pow(x - m_currentPosition.x, 2.0f) + pow(y - m_currentPosition.y, 2.0f)));
|
|
740
|
+
auto compositor = m_visual.Compositor();
|
|
741
|
+
auto positionAnimation = compositor.CreateVector3KeyFrameAnimation();
|
|
742
|
+
|
|
743
|
+
positionAnimation.InsertKeyFrame(1.0f, {x, y, 0.0f});
|
|
744
|
+
positionAnimation.Duration(std::chrono::milliseconds(
|
|
745
|
+
std::clamp(distance * s_offsetsChangeMsPerUnit, s_offsetsChangeMinMs, s_offsetsChangeMaxMs)));
|
|
746
|
+
|
|
747
|
+
return positionAnimation;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
void ScrollBy(winrt::Windows::Foundation::Numerics::float3 const &offset, bool animate) noexcept {
|
|
751
|
+
auto restingPosition = m_inertia ? m_interactionTracker.NaturalRestingPosition() : m_interactionTracker.Position();
|
|
752
|
+
if (m_custom) {
|
|
753
|
+
restingPosition = m_targetPosition;
|
|
754
|
+
}
|
|
755
|
+
if (animate) {
|
|
756
|
+
auto maxPosition = m_interactionTracker.MaxPosition();
|
|
757
|
+
m_custom = true;
|
|
758
|
+
m_targetPosition = {
|
|
759
|
+
std::clamp(restingPosition.x + offset.x, 0.0f, maxPosition.x),
|
|
760
|
+
std::clamp(restingPosition.y + offset.y, 0.0f, maxPosition.y),
|
|
761
|
+
std::clamp(restingPosition.z + offset.z, 0.0f, maxPosition.z)};
|
|
762
|
+
|
|
763
|
+
auto kfa = GetPositionAnimation(m_targetPosition.x, m_targetPosition.y);
|
|
764
|
+
m_interactionTracker.TryUpdatePositionWithAnimation(kfa);
|
|
765
|
+
} else {
|
|
766
|
+
m_interactionTracker.TryUpdatePositionBy(offset);
|
|
767
|
+
}
|
|
580
768
|
};
|
|
581
769
|
|
|
582
770
|
void TryUpdatePosition(winrt::Windows::Foundation::Numerics::float3 const &position, bool animate) noexcept {
|
|
771
|
+
auto maxPosition = m_interactionTracker.MaxPosition();
|
|
583
772
|
if (animate) {
|
|
584
|
-
auto
|
|
585
|
-
auto cubicBezier = compositor.CreateCubicBezierEasingFunction({0.17f, 0.67f}, {1.0f, 1.0f});
|
|
586
|
-
auto kfa = compositor.CreateVector3KeyFrameAnimation();
|
|
587
|
-
kfa.Duration(std::chrono::seconds{1});
|
|
588
|
-
kfa.InsertKeyFrame(1.0f, position, cubicBezier);
|
|
773
|
+
auto kfa = GetPositionAnimation(std::min(maxPosition.x, position.x), std::min(maxPosition.y, position.y));
|
|
589
774
|
m_interactionTracker.TryUpdatePositionWithAnimation(kfa);
|
|
590
775
|
} else {
|
|
591
|
-
m_interactionTracker.TryUpdatePosition(
|
|
776
|
+
m_interactionTracker.TryUpdatePosition(
|
|
777
|
+
{std::min(maxPosition.x, position.x),
|
|
778
|
+
std::min(maxPosition.y, position.y),
|
|
779
|
+
std::min(maxPosition.z, position.z)});
|
|
592
780
|
}
|
|
593
781
|
}
|
|
594
782
|
|
|
@@ -604,23 +792,222 @@ struct CompScrollerVisual : winrt::Microsoft::ReactNative::Composition::implemen
|
|
|
604
792
|
0});
|
|
605
793
|
}
|
|
606
794
|
|
|
795
|
+
bool m_inertia{false};
|
|
796
|
+
bool m_custom{false};
|
|
797
|
+
winrt::Windows::Foundation::Numerics::float3 m_targetPosition;
|
|
798
|
+
winrt::Windows::Foundation::Numerics::float3 m_currentPosition;
|
|
607
799
|
winrt::Windows::Foundation::Numerics::float2 m_contentSize{0};
|
|
608
800
|
winrt::Windows::Foundation::Numerics::float2 m_visualSize{0};
|
|
609
801
|
winrt::event<
|
|
610
|
-
winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::Composition::
|
|
802
|
+
winrt::Windows::Foundation::EventHandler<winrt::Microsoft::ReactNative::Composition::IScrollPositionChangedArgs>>
|
|
611
803
|
m_scrollPositionChangedEvent;
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
804
|
+
typename TTypeRedirects::SpriteVisual m_visual{nullptr};
|
|
805
|
+
typename TTypeRedirects::SpriteVisual m_contentVisual{nullptr};
|
|
806
|
+
typename TTypeRedirects::InteractionTracker m_interactionTracker{nullptr};
|
|
807
|
+
typename TTypeRedirects::VisualInteractionSource m_visualInteractionSource{nullptr};
|
|
808
|
+
};
|
|
809
|
+
using WindowsCompScrollerVisual = CompScrollerVisual<WindowsTypeRedirects>;
|
|
810
|
+
#ifdef USE_WINUI3
|
|
811
|
+
using MicrosoftCompScrollerVisual = CompScrollerVisual<MicrosoftTypeRedirects>;
|
|
812
|
+
#endif
|
|
813
|
+
|
|
814
|
+
template <typename TTypeRedirects>
|
|
815
|
+
struct CompActivityVisual : winrt::implements<
|
|
816
|
+
CompActivityVisual<TTypeRedirects>,
|
|
817
|
+
winrt::Microsoft::ReactNative::Composition::IActivityVisual,
|
|
818
|
+
winrt::Microsoft::ReactNative::Composition::IVisual,
|
|
819
|
+
typename TTypeRedirects::IInnerCompositionVisual,
|
|
820
|
+
IVisualInterop> {
|
|
821
|
+
CompActivityVisual(typename TTypeRedirects::SpriteVisual const &visual) : m_visual(visual) {
|
|
822
|
+
auto compositor = m_visual.Compositor();
|
|
823
|
+
m_contentVisual = compositor.CreateSpriteVisual();
|
|
824
|
+
|
|
825
|
+
// Create loading circles
|
|
826
|
+
for (int i = 0; i < 4; i++) {
|
|
827
|
+
auto loadingCircle = createLoadingCircle(compositor, i * 200);
|
|
828
|
+
m_visual.Children().InsertAtTop(loadingCircle);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
void Color(winrt::Windows::UI::Color color) noexcept {
|
|
833
|
+
// Change the color of each SpriteVisual
|
|
834
|
+
for (auto &spriteVisual : m_spriteVisuals) {
|
|
835
|
+
auto colorBrush = m_visual.Compositor().CreateColorBrush(color);
|
|
836
|
+
// Set the new color brush on the SpriteVisual
|
|
837
|
+
spriteVisual.FillBrush(colorBrush);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
typename TTypeRedirects::ShapeVisual createLoadingCircle(typename TTypeRedirects::Compositor compositor, int delay) {
|
|
842
|
+
// Create circle
|
|
843
|
+
auto ellipse = compositor.CreateEllipseGeometry();
|
|
844
|
+
ellipse.Radius({m_ringWidth, m_ringWidth});
|
|
845
|
+
auto spriteShape = compositor.CreateSpriteShape();
|
|
846
|
+
spriteShape.Geometry(ellipse);
|
|
847
|
+
spriteShape.Offset(winrt::Windows::Foundation::Numerics::float2(m_centerX, m_centerY + m_radiusSmall));
|
|
848
|
+
auto spriteVisualBrush = compositor.CreateColorBrush(winrt::Windows::UI::Colors::LightGray());
|
|
849
|
+
spriteShape.FillBrush(spriteVisualBrush);
|
|
850
|
+
auto circleShape = compositor.CreateShapeVisual();
|
|
851
|
+
circleShape.Shapes().Append(spriteShape);
|
|
852
|
+
circleShape.Size({100.0f, 100.0f});
|
|
853
|
+
circleShape.Opacity(0.0f);
|
|
854
|
+
m_spriteVisuals.push_back(spriteShape);
|
|
855
|
+
|
|
856
|
+
// Create an OpacityAnimation
|
|
857
|
+
auto opacityAnimation = compositor.CreateScalarKeyFrameAnimation();
|
|
858
|
+
opacityAnimation.Duration(std::chrono::seconds(2));
|
|
859
|
+
opacityAnimation.IterationBehavior(TTypeRedirects::AnimationIterationBehavior::Forever);
|
|
860
|
+
opacityAnimation.DelayTime(std::chrono::milliseconds(650 + delay));
|
|
861
|
+
|
|
862
|
+
opacityAnimation.InsertKeyFrame(0.0f, 0.0f); // Initial opacity (fully transparent)
|
|
863
|
+
opacityAnimation.InsertKeyFrame(0.5f, 1.0f); // Intermediate opacity (fully opaque)
|
|
864
|
+
opacityAnimation.InsertKeyFrame(1.0f, 0.0f); // Intermediate opacity (fully opaque)
|
|
865
|
+
opacityAnimation.InsertKeyFrame(0.0f, 0.0f); // Final opacity (fully transparent)
|
|
866
|
+
|
|
867
|
+
// create an animation for the Offset property of the ShapeVisual
|
|
868
|
+
auto animation = compositor.CreateVector2KeyFrameAnimation();
|
|
869
|
+
animation.Duration(std::chrono::seconds(2));
|
|
870
|
+
animation.Direction(TTypeRedirects::AnimationDirection::Normal);
|
|
871
|
+
animation.IterationBehavior(TTypeRedirects::AnimationIterationBehavior::Forever);
|
|
872
|
+
animation.DelayTime(std::chrono::milliseconds(delay));
|
|
873
|
+
animation.DelayBehavior(TTypeRedirects::AnimationDelayBehavior::SetInitialValueAfterDelay);
|
|
874
|
+
|
|
875
|
+
// create path animation
|
|
876
|
+
float progress = 2.0f * static_cast<float>(M_PI); // specifies the end of the keyframe progress
|
|
877
|
+
for (float angle = 0.0f; angle < progress; angle += 0.1f) {
|
|
878
|
+
float x = m_centerX + m_radiusSmall * cos(angle);
|
|
879
|
+
float y = m_centerY + m_radiusSmall * sin(angle);
|
|
880
|
+
animation.InsertKeyFrame(
|
|
881
|
+
angle / (2.0f * static_cast<float>(M_PI)), winrt::Windows::Foundation::Numerics::float2(x, y));
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
// run animations
|
|
885
|
+
circleShape.StartAnimation(L"Opacity", opacityAnimation);
|
|
886
|
+
spriteShape.StartAnimation(L"Offset", animation);
|
|
887
|
+
|
|
888
|
+
return circleShape;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
typename TTypeRedirects::Visual InnerVisual() const noexcept {
|
|
892
|
+
return m_visual;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
void InsertAt(const winrt::Microsoft::ReactNative::Composition::IVisual &visual, uint32_t index) noexcept {
|
|
896
|
+
auto containerChildren = m_contentVisual.Children();
|
|
897
|
+
auto compVisual = typename TTypeRedirects::CompositionContextHelper::InnerVisual(visual);
|
|
898
|
+
if (index == 0 || containerChildren.Count() == 0) {
|
|
899
|
+
containerChildren.InsertAtTop(compVisual);
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
auto insertAfter = containerChildren.First();
|
|
903
|
+
for (uint32_t i = 1; i < index; i++)
|
|
904
|
+
insertAfter.MoveNext();
|
|
905
|
+
containerChildren.InsertAbove(compVisual, insertAfter.Current());
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
void Remove(const winrt::Microsoft::ReactNative::Composition::IVisual &visual) noexcept {
|
|
909
|
+
auto compVisual = typename TTypeRedirects::CompositionContextHelper::InnerVisual(visual);
|
|
910
|
+
auto containerChildren = m_contentVisual.Children();
|
|
911
|
+
containerChildren.Remove(compVisual);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
winrt::Microsoft::ReactNative::Composition::IVisual GetAt(uint32_t index) noexcept {
|
|
915
|
+
auto containerChildren = m_visual.as<typename TTypeRedirects::ContainerVisual>().Children();
|
|
916
|
+
auto it = containerChildren.First();
|
|
917
|
+
for (uint32_t i = 0; i < index; i++)
|
|
918
|
+
it.MoveNext();
|
|
919
|
+
return typename TTypeRedirects::CompositionContextHelper::CreateVisual(it.Current());
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
void Opacity(float opacity) noexcept {
|
|
923
|
+
m_visual.Opacity(opacity);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
void Scale(winrt::Windows::Foundation::Numerics::float3 const &scale) noexcept {
|
|
927
|
+
m_visual.Scale(scale);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
void TransformMatrix(winrt::Windows::Foundation::Numerics::float4x4 const &transform) noexcept {
|
|
931
|
+
m_visual.TransformMatrix(transform);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
void RotationAngle(float rotation) noexcept {
|
|
935
|
+
m_visual.RotationAngle(rotation);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
void IsVisible(bool isVisible) noexcept {
|
|
939
|
+
m_visual.IsVisible(isVisible);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
void Size(winrt::Windows::Foundation::Numerics::float2 const &size) noexcept {
|
|
943
|
+
m_visualSize = size;
|
|
944
|
+
m_visual.Size(size);
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
void Offset(winrt::Windows::Foundation::Numerics::float3 const &offset) noexcept {
|
|
948
|
+
m_visual.Offset(offset);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
void Offset(
|
|
952
|
+
winrt::Windows::Foundation::Numerics::float3 offset,
|
|
953
|
+
winrt::Windows::Foundation::Numerics::float3 relativeAdjustment) noexcept {
|
|
954
|
+
m_visual.Offset(offset);
|
|
955
|
+
m_visual.RelativeOffsetAdjustment(relativeAdjustment);
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
void RelativeSizeWithOffset(
|
|
959
|
+
winrt::Windows::Foundation::Numerics::float2 size,
|
|
960
|
+
winrt::Windows::Foundation::Numerics::float2 relativeSizeAdjustment) noexcept {
|
|
961
|
+
m_visual.Size(size);
|
|
962
|
+
m_visual.RelativeSizeAdjustment(relativeSizeAdjustment);
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
winrt::Microsoft::ReactNative::Composition::BackfaceVisibility BackfaceVisibility() {
|
|
966
|
+
return static_cast<winrt::Microsoft::ReactNative::Composition::BackfaceVisibility>(m_visual.BackfaceVisibility());
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
void BackfaceVisibility(winrt::Microsoft::ReactNative::Composition::BackfaceVisibility value) {
|
|
970
|
+
m_visual.BackfaceVisibility(static_cast<typename TTypeRedirects::CompositionBackfaceVisibility>(value));
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
void SetClippingPath(ID2D1Geometry *clippingPath) noexcept {
|
|
974
|
+
if (!clippingPath) {
|
|
975
|
+
m_visual.Clip(nullptr);
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
auto geometry = winrt::make<GeometrySource>(clippingPath);
|
|
979
|
+
auto path = typename TTypeRedirects::CompositionPath(geometry);
|
|
980
|
+
auto pathgeo = m_visual.Compositor().CreatePathGeometry(path);
|
|
981
|
+
auto clip = m_visual.Compositor().CreateGeometricClip(pathgeo);
|
|
982
|
+
m_visual.Clip(clip);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
private:
|
|
986
|
+
winrt::Windows::Foundation::Numerics::float2 m_visualSize{0};
|
|
987
|
+
typename TTypeRedirects::SpriteVisual m_visual{nullptr};
|
|
988
|
+
typename TTypeRedirects::SpriteVisual m_contentVisual{nullptr};
|
|
989
|
+
std::vector<typename TTypeRedirects::CompositionSpriteShape> m_spriteVisuals;
|
|
990
|
+
|
|
991
|
+
// constants
|
|
992
|
+
float m_radiusSmall = 8.0f;
|
|
993
|
+
float m_radiusLarge = 16.0f;
|
|
994
|
+
float m_ringWidth = 2.0f;
|
|
995
|
+
float m_centerX = m_radiusSmall + m_ringWidth;
|
|
996
|
+
float m_centerY = m_radiusSmall + m_ringWidth;
|
|
616
997
|
};
|
|
998
|
+
using WindowsCompActivityVisual = CompActivityVisual<WindowsTypeRedirects>;
|
|
999
|
+
#ifdef USE_WINUI3
|
|
1000
|
+
using MicrosoftCompActivityVisual = CompActivityVisual<MicrosoftTypeRedirects>;
|
|
1001
|
+
#endif
|
|
617
1002
|
|
|
618
|
-
|
|
619
|
-
|
|
1003
|
+
template <typename TTypeRedirects>
|
|
1004
|
+
struct CompCaretVisual
|
|
1005
|
+
: winrt::implements<CompCaretVisual<TTypeRedirects>, winrt::Microsoft::ReactNative::Composition::ICaretVisual> {
|
|
1006
|
+
CompCaretVisual(typename TTypeRedirects::Compositor const &compositor)
|
|
620
1007
|
: m_compositor(compositor),
|
|
621
1008
|
m_compVisual(compositor.CreateSpriteVisual()),
|
|
622
1009
|
m_opacityAnimation(compositor.CreateScalarKeyFrameAnimation()) {
|
|
623
|
-
m_visual =
|
|
1010
|
+
m_visual = CreateVisual();
|
|
624
1011
|
|
|
625
1012
|
// TODO should make the caret use an invert brush by default
|
|
626
1013
|
m_compVisual.Brush(m_compositor.CreateColorBrush(winrt::Windows::UI::Colors::Black()));
|
|
@@ -637,14 +1024,20 @@ struct CompCaretVisual : winrt::implements<CompCaretVisual, winrt::Microsoft::Re
|
|
|
637
1024
|
m_opacityAnimation.InsertKeyFrame(stayVisFrame + fadeVisFrame + stayVisFrame, 0.0f);
|
|
638
1025
|
m_opacityAnimation.InsertKeyFrame(1.0f, 1.0f, m_compositor.CreateLinearEasingFunction());
|
|
639
1026
|
m_opacityAnimation.Duration(std::chrono::milliseconds{1000});
|
|
640
|
-
m_opacityAnimation.IterationBehavior(
|
|
1027
|
+
m_opacityAnimation.IterationBehavior(TTypeRedirects::AnimationIterationBehavior::Count);
|
|
641
1028
|
m_opacityAnimation.IterationCount(500);
|
|
642
1029
|
}
|
|
643
1030
|
|
|
1031
|
+
winrt::Microsoft::ReactNative::Composition::IVisual CreateVisual() const noexcept;
|
|
1032
|
+
|
|
644
1033
|
winrt::Microsoft::ReactNative::Composition::IVisual InnerVisual() const noexcept {
|
|
645
1034
|
return m_visual;
|
|
646
1035
|
}
|
|
647
1036
|
|
|
1037
|
+
void Color(winrt::Windows::UI::Color color) noexcept {
|
|
1038
|
+
m_compVisual.Brush(m_compositor.CreateColorBrush(color));
|
|
1039
|
+
}
|
|
1040
|
+
|
|
648
1041
|
void Size(winrt::Windows::Foundation::Numerics::float2 size) noexcept {
|
|
649
1042
|
m_compVisual.Size(size);
|
|
650
1043
|
}
|
|
@@ -658,25 +1051,126 @@ struct CompCaretVisual : winrt::implements<CompCaretVisual, winrt::Microsoft::Re
|
|
|
658
1051
|
}
|
|
659
1052
|
|
|
660
1053
|
void IsVisible(bool value) noexcept {
|
|
1054
|
+
if (m_isVisible == value)
|
|
1055
|
+
return;
|
|
1056
|
+
m_isVisible = value;
|
|
661
1057
|
if (value) {
|
|
662
1058
|
m_compVisual.StartAnimation(L"opacity", m_opacityAnimation);
|
|
663
1059
|
} else {
|
|
664
1060
|
m_compVisual.StopAnimation(L"opacity");
|
|
1061
|
+
m_compVisual.Opacity(0.0f);
|
|
665
1062
|
}
|
|
666
1063
|
}
|
|
667
1064
|
|
|
668
1065
|
private:
|
|
669
1066
|
bool m_isVisible{false};
|
|
670
|
-
|
|
1067
|
+
typename TTypeRedirects::SpriteVisual m_compVisual;
|
|
1068
|
+
winrt::Microsoft::ReactNative::Composition::IVisual m_visual;
|
|
1069
|
+
typename TTypeRedirects::ScalarKeyFrameAnimation m_opacityAnimation;
|
|
1070
|
+
typename TTypeRedirects::Compositor m_compositor{nullptr};
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
winrt::Microsoft::ReactNative::Composition::IVisual CompCaretVisual<WindowsTypeRedirects>::CreateVisual()
|
|
1074
|
+
const noexcept {
|
|
1075
|
+
return winrt::make<Composition::WindowsCompSpriteVisual>(m_compVisual);
|
|
1076
|
+
}
|
|
1077
|
+
using WindowsCompCaretVisual = CompCaretVisual<WindowsTypeRedirects>;
|
|
1078
|
+
|
|
1079
|
+
#ifdef USE_WINUI3
|
|
1080
|
+
winrt::Microsoft::ReactNative::Composition::IVisual CompCaretVisual<MicrosoftTypeRedirects>::CreateVisual()
|
|
1081
|
+
const noexcept {
|
|
1082
|
+
return winrt::make<Composition::MicrosoftCompSpriteVisual>(m_compVisual);
|
|
1083
|
+
}
|
|
1084
|
+
using MicrosoftCompCaretVisual = CompCaretVisual<MicrosoftTypeRedirects>;
|
|
1085
|
+
#endif
|
|
1086
|
+
|
|
1087
|
+
// Switch Thumb animations
|
|
1088
|
+
template <typename TTypeRedirects>
|
|
1089
|
+
struct CompSwitchThumbVisual : winrt::implements<
|
|
1090
|
+
CompSwitchThumbVisual<TTypeRedirects>,
|
|
1091
|
+
winrt::Microsoft::ReactNative::Composition::ISwitchThumbVisual> {
|
|
1092
|
+
CompSwitchThumbVisual(typename TTypeRedirects::Compositor const &compositor)
|
|
1093
|
+
: m_compositor(compositor), m_compVisual(compositor.CreateSpriteVisual()) {
|
|
1094
|
+
m_visual = CreateVisual();
|
|
1095
|
+
|
|
1096
|
+
// Create Thumb
|
|
1097
|
+
m_geometry = m_compositor.CreateEllipseGeometry();
|
|
1098
|
+
m_spiritShape = m_compositor.CreateSpriteShape();
|
|
1099
|
+
m_spiritShape.Geometry(m_geometry);
|
|
1100
|
+
auto circleShape = m_compositor.CreateShapeVisual();
|
|
1101
|
+
circleShape.Shapes().Append(m_spiritShape);
|
|
1102
|
+
circleShape.Size({150.0f, 150.0f});
|
|
1103
|
+
|
|
1104
|
+
m_compVisual.Children().InsertAtTop(circleShape);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
winrt::Microsoft::ReactNative::Composition::IVisual CreateVisual() const noexcept;
|
|
1108
|
+
|
|
1109
|
+
winrt::Microsoft::ReactNative::Composition::IVisual InnerVisual() const noexcept {
|
|
1110
|
+
return m_visual;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
void Color(winrt::Windows::UI::Color color) noexcept {
|
|
1114
|
+
m_spiritShape.FillBrush(m_compositor.CreateColorBrush(color));
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
void Size(winrt::Windows::Foundation::Numerics::float2 size) noexcept {
|
|
1118
|
+
m_geometry.Radius(size);
|
|
1119
|
+
m_spiritShape.Offset(size);
|
|
1120
|
+
m_compVisual.Size(size);
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
void Position(winrt::Windows::Foundation::Numerics::float2 position) noexcept {
|
|
1124
|
+
if (!isDrawn) {
|
|
1125
|
+
// we don't want to animate if this is the first time the switch is drawn on screen
|
|
1126
|
+
isDrawn = true;
|
|
1127
|
+
m_compVisual.Offset({position.x, position.y, 0.0f});
|
|
1128
|
+
} else {
|
|
1129
|
+
auto animation = m_compositor.CreateVector3KeyFrameAnimation();
|
|
1130
|
+
animation.Duration(std::chrono::milliseconds(250));
|
|
1131
|
+
animation.Direction(TTypeRedirects::AnimationDirection::Normal);
|
|
1132
|
+
animation.InsertKeyFrame(1.0f, {position.x, position.y, 0.0f});
|
|
1133
|
+
|
|
1134
|
+
m_compVisual.StartAnimation(L"Offset", animation);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
bool IsVisible() const noexcept {
|
|
1139
|
+
return m_isVisible;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
void IsVisible(bool value) noexcept {}
|
|
1143
|
+
|
|
1144
|
+
private:
|
|
1145
|
+
bool m_isVisible{true};
|
|
1146
|
+
bool isDrawn{false};
|
|
1147
|
+
typename TTypeRedirects::SpriteVisual m_compVisual;
|
|
671
1148
|
winrt::Microsoft::ReactNative::Composition::IVisual m_visual;
|
|
672
|
-
|
|
673
|
-
|
|
1149
|
+
typename TTypeRedirects::Compositor m_compositor{nullptr};
|
|
1150
|
+
typename TTypeRedirects::CompositionSpriteShape m_spiritShape{nullptr};
|
|
1151
|
+
typename TTypeRedirects::CompositionEllipseGeometry m_geometry{nullptr};
|
|
674
1152
|
};
|
|
675
1153
|
|
|
676
|
-
|
|
677
|
-
|
|
1154
|
+
winrt::Microsoft::ReactNative::Composition::IVisual CompSwitchThumbVisual<WindowsTypeRedirects>::CreateVisual()
|
|
1155
|
+
const noexcept {
|
|
1156
|
+
return winrt::make<Composition::WindowsCompSpriteVisual>(m_compVisual);
|
|
1157
|
+
}
|
|
1158
|
+
using WindowsCompSwitchThumbVisual = CompSwitchThumbVisual<WindowsTypeRedirects>;
|
|
1159
|
+
|
|
1160
|
+
#ifdef USE_WINUI3
|
|
1161
|
+
winrt::Microsoft::ReactNative::Composition::IVisual CompSwitchThumbVisual<MicrosoftTypeRedirects>::CreateVisual()
|
|
1162
|
+
const noexcept {
|
|
1163
|
+
return winrt::make<Composition::MicrosoftCompSpriteVisual>(m_compVisual);
|
|
1164
|
+
}
|
|
1165
|
+
using MicrosoftCompSwitchThumbVisual = CompSwitchThumbVisual<MicrosoftTypeRedirects>;
|
|
1166
|
+
#endif
|
|
1167
|
+
|
|
1168
|
+
template <typename TTypeRedirects>
|
|
1169
|
+
struct CompFocusVisual
|
|
1170
|
+
: winrt::implements<CompFocusVisual<TTypeRedirects>, winrt::Microsoft::ReactNative::Composition::IFocusVisual> {
|
|
1171
|
+
CompFocusVisual(typename TTypeRedirects::Compositor const &compositor)
|
|
678
1172
|
: m_compVisual(compositor.CreateSpriteVisual()), m_brush(compositor.CreateNineGridBrush()) {
|
|
679
|
-
m_visual =
|
|
1173
|
+
m_visual = CreateVisual();
|
|
680
1174
|
|
|
681
1175
|
m_compVisual.Opacity(1.0f);
|
|
682
1176
|
m_compVisual.RelativeSizeAdjustment({1, 1});
|
|
@@ -685,6 +1179,8 @@ struct CompFocusVisual : winrt::implements<CompFocusVisual, winrt::Microsoft::Re
|
|
|
685
1179
|
m_brush.IsCenterHollow(true);
|
|
686
1180
|
}
|
|
687
1181
|
|
|
1182
|
+
winrt::Microsoft::ReactNative::Composition::IVisual CreateVisual() noexcept;
|
|
1183
|
+
|
|
688
1184
|
winrt::Microsoft::ReactNative::Composition::IVisual InnerVisual() const noexcept {
|
|
689
1185
|
return m_visual;
|
|
690
1186
|
}
|
|
@@ -716,16 +1212,30 @@ struct CompFocusVisual : winrt::implements<CompFocusVisual, winrt::Microsoft::Re
|
|
|
716
1212
|
|
|
717
1213
|
private:
|
|
718
1214
|
float m_scaleFactor{0};
|
|
719
|
-
|
|
720
|
-
|
|
1215
|
+
typename TTypeRedirects::CompositionNineGridBrush m_brush;
|
|
1216
|
+
typename TTypeRedirects::SpriteVisual m_compVisual;
|
|
721
1217
|
winrt::Microsoft::ReactNative::Composition::IVisual m_visual{nullptr};
|
|
722
1218
|
};
|
|
723
1219
|
|
|
1220
|
+
winrt::Microsoft::ReactNative::Composition::IVisual CompFocusVisual<WindowsTypeRedirects>::CreateVisual() noexcept {
|
|
1221
|
+
return winrt::make<Composition::WindowsCompSpriteVisual>(m_compVisual);
|
|
1222
|
+
}
|
|
1223
|
+
using WindowsCompFocusVisual = CompFocusVisual<WindowsTypeRedirects>;
|
|
1224
|
+
|
|
1225
|
+
#ifdef USE_WINUI3
|
|
1226
|
+
winrt::Microsoft::ReactNative::Composition::IVisual CompFocusVisual<MicrosoftTypeRedirects>::CreateVisual() noexcept {
|
|
1227
|
+
return winrt::make<Composition::MicrosoftCompSpriteVisual>(m_compVisual);
|
|
1228
|
+
}
|
|
1229
|
+
using MicrosoftCompFocusVisual = CompFocusVisual<MicrosoftTypeRedirects>;
|
|
1230
|
+
#endif
|
|
1231
|
+
|
|
1232
|
+
template <typename TTypeRedirects>
|
|
724
1233
|
struct CompContext : winrt::implements<
|
|
725
|
-
CompContext
|
|
1234
|
+
CompContext<TTypeRedirects>,
|
|
726
1235
|
winrt::Microsoft::ReactNative::Composition::ICompositionContext,
|
|
1236
|
+
typename TTypeRedirects::IInnerCompositionCompositor,
|
|
727
1237
|
ICompositionContextInterop> {
|
|
728
|
-
CompContext(
|
|
1238
|
+
CompContext(typename TTypeRedirects::Compositor const &compositor) : m_compositor(compositor) {}
|
|
729
1239
|
|
|
730
1240
|
winrt::com_ptr<ID2D1Factory1> D2DFactory() noexcept {
|
|
731
1241
|
if (!m_d2dFactory) {
|
|
@@ -796,118 +1306,272 @@ struct CompContext : winrt::implements<
|
|
|
796
1306
|
return m_d2dDevice;
|
|
797
1307
|
}
|
|
798
1308
|
|
|
799
|
-
winrt::Microsoft::ReactNative::Composition::
|
|
800
|
-
winrt::Windows::Foundation::Size surfaceSize,
|
|
801
|
-
winrt::Windows::Graphics::DirectX::DirectXPixelFormat pixelFormat,
|
|
802
|
-
winrt::Windows::Graphics::DirectX::DirectXAlphaMode alphaMode) noexcept {
|
|
803
|
-
return winrt::make<Composition::CompositionDrawingSurface>(
|
|
804
|
-
CompositionGraphicsDevice().CreateDrawingSurface(surfaceSize, pixelFormat, alphaMode));
|
|
805
|
-
}
|
|
1309
|
+
winrt::Microsoft::ReactNative::Composition::ISpriteVisual CreateSpriteVisual() noexcept;
|
|
806
1310
|
|
|
807
|
-
winrt::Microsoft::ReactNative::Composition::
|
|
808
|
-
return winrt::make<Composition::CompSpriteVisual>(m_compositor.CreateSpriteVisual());
|
|
809
|
-
}
|
|
1311
|
+
winrt::Microsoft::ReactNative::Composition::IScrollVisual CreateScrollerVisual() noexcept;
|
|
810
1312
|
|
|
811
|
-
winrt::Microsoft::ReactNative::Composition::
|
|
812
|
-
return winrt::make<Composition::CompScrollerVisual>(m_compositor.CreateSpriteVisual());
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
winrt::Microsoft::ReactNative::Composition::IDropShadow CreateDropShadow() noexcept {
|
|
816
|
-
return winrt::make<Composition::CompDropShadow>(m_compositor.CreateDropShadow());
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
winrt::Microsoft::ReactNative::Composition::IBrush CreateColorBrush(winrt::Windows::UI::Color color) noexcept {
|
|
820
|
-
return winrt::make<Composition::CompBrush>(m_compositor.CreateColorBrush(color));
|
|
821
|
-
}
|
|
1313
|
+
winrt::Microsoft::ReactNative::Composition::IActivityVisual CreateActivityVisual() noexcept;
|
|
822
1314
|
|
|
823
|
-
winrt::Microsoft::ReactNative::Composition::
|
|
824
|
-
const winrt::Microsoft::ReactNative::Composition::ICompositionDrawingSurface &surface) noexcept {
|
|
825
|
-
return winrt::make<Composition::CompSurfaceBrush>(m_compositor, surface);
|
|
826
|
-
}
|
|
1315
|
+
winrt::Microsoft::ReactNative::Composition::IDropShadow CreateDropShadow() noexcept;
|
|
827
1316
|
|
|
828
|
-
winrt::Microsoft::ReactNative::Composition::
|
|
829
|
-
return winrt::make<Composition::CompCaretVisual>(m_compositor);
|
|
830
|
-
}
|
|
1317
|
+
winrt::Microsoft::ReactNative::Composition::IBrush CreateColorBrush(winrt::Windows::UI::Color color) noexcept;
|
|
831
1318
|
|
|
832
|
-
winrt::Microsoft::ReactNative::Composition::
|
|
833
|
-
|
|
834
|
-
|
|
1319
|
+
winrt::Microsoft::ReactNative::Composition::IDrawingSurfaceBrush CreateDrawingSurfaceBrush(
|
|
1320
|
+
winrt::Windows::Foundation::Size surfaceSize,
|
|
1321
|
+
winrt::Windows::Graphics::DirectX::DirectXPixelFormat pixelFormat,
|
|
1322
|
+
winrt::Windows::Graphics::DirectX::DirectXAlphaMode alphaMode) noexcept;
|
|
835
1323
|
|
|
836
|
-
winrt::
|
|
837
|
-
if (!m_compositionGraphicsDevice) {
|
|
838
|
-
// To create a composition graphics device, we need to QI for another interface
|
|
1324
|
+
winrt::Microsoft::ReactNative::Composition::ICaretVisual CreateCaretVisual() noexcept;
|
|
839
1325
|
|
|
840
|
-
|
|
841
|
-
m_compositor.as<ABI::Windows::UI::Composition::ICompositorInterop>()};
|
|
1326
|
+
winrt::Microsoft::ReactNative::Composition::ISwitchThumbVisual CreateSwitchThumbVisual() noexcept;
|
|
842
1327
|
|
|
843
|
-
|
|
844
|
-
winrt::com_ptr<ABI::Windows::UI::Composition::ICompositionGraphicsDevice> compositionGraphicsDeviceIface;
|
|
845
|
-
winrt::check_hresult(
|
|
846
|
-
compositorInterop->CreateGraphicsDevice(D2DDevice().get(), compositionGraphicsDeviceIface.put()));
|
|
1328
|
+
winrt::Microsoft::ReactNative::Composition::IFocusVisual CreateFocusVisual() noexcept;
|
|
847
1329
|
|
|
848
|
-
|
|
849
|
-
}
|
|
850
|
-
return m_compositionGraphicsDevice;
|
|
851
|
-
}
|
|
1330
|
+
typename TTypeRedirects::CompositionGraphicsDevice CompositionGraphicsDevice() noexcept;
|
|
852
1331
|
|
|
853
|
-
|
|
1332
|
+
typename TTypeRedirects::Compositor InnerCompositor() const noexcept {
|
|
854
1333
|
return m_compositor;
|
|
855
1334
|
}
|
|
856
1335
|
|
|
857
1336
|
private:
|
|
858
|
-
|
|
1337
|
+
typename TTypeRedirects::Compositor m_compositor{nullptr};
|
|
859
1338
|
winrt::com_ptr<ID2D1Factory1> m_d2dFactory;
|
|
860
1339
|
winrt::com_ptr<ID3D11Device> m_d3dDevice;
|
|
861
1340
|
winrt::com_ptr<ID2D1Device> m_d2dDevice;
|
|
862
|
-
|
|
1341
|
+
typename TTypeRedirects::CompositionGraphicsDevice m_compositionGraphicsDevice{nullptr};
|
|
863
1342
|
winrt::com_ptr<ID3D11DeviceContext> m_d3dDeviceContext;
|
|
864
1343
|
};
|
|
865
1344
|
|
|
1345
|
+
winrt::Microsoft::ReactNative::Composition::ISpriteVisual
|
|
1346
|
+
CompContext<WindowsTypeRedirects>::CreateSpriteVisual() noexcept {
|
|
1347
|
+
return winrt::make<Composition::WindowsCompSpriteVisual>(m_compositor.CreateSpriteVisual());
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
winrt::Microsoft::ReactNative::Composition::IScrollVisual
|
|
1351
|
+
CompContext<WindowsTypeRedirects>::CreateScrollerVisual() noexcept {
|
|
1352
|
+
return winrt::make<Composition::WindowsCompScrollerVisual>(m_compositor.CreateSpriteVisual());
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
winrt::Microsoft::ReactNative::Composition::IActivityVisual
|
|
1356
|
+
CompContext<WindowsTypeRedirects>::CreateActivityVisual() noexcept {
|
|
1357
|
+
return winrt::make<Composition::WindowsCompActivityVisual>(m_compositor.CreateSpriteVisual());
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
winrt::Microsoft::ReactNative::Composition::IDropShadow CompContext<WindowsTypeRedirects>::CreateDropShadow() noexcept {
|
|
1361
|
+
return winrt::make<Composition::WindowsCompDropShadow>(m_compositor.CreateDropShadow());
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
winrt::Microsoft::ReactNative::Composition::IBrush CompContext<WindowsTypeRedirects>::CreateColorBrush(
|
|
1365
|
+
winrt::Windows::UI::Color color) noexcept {
|
|
1366
|
+
return winrt::make<Composition::WindowsCompBrush>(m_compositor.CreateColorBrush(color));
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
winrt::Microsoft::ReactNative::Composition::IDrawingSurfaceBrush
|
|
1370
|
+
CompContext<WindowsTypeRedirects>::CreateDrawingSurfaceBrush(
|
|
1371
|
+
winrt::Windows::Foundation::Size surfaceSize,
|
|
1372
|
+
winrt::Windows::Graphics::DirectX::DirectXPixelFormat pixelFormat,
|
|
1373
|
+
winrt::Windows::Graphics::DirectX::DirectXAlphaMode alphaMode) noexcept {
|
|
1374
|
+
return winrt::make<Composition::WindowsCompDrawingSurfaceBrush>(
|
|
1375
|
+
m_compositor, CompositionGraphicsDevice().CreateDrawingSurface(surfaceSize, pixelFormat, alphaMode));
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
winrt::Microsoft::ReactNative::Composition::ICaretVisual
|
|
1379
|
+
CompContext<WindowsTypeRedirects>::CreateCaretVisual() noexcept {
|
|
1380
|
+
return winrt::make<Composition::WindowsCompCaretVisual>(m_compositor);
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
winrt::Microsoft::ReactNative::Composition::ISwitchThumbVisual
|
|
1384
|
+
CompContext<WindowsTypeRedirects>::CreateSwitchThumbVisual() noexcept {
|
|
1385
|
+
return winrt::make<Composition::WindowsCompSwitchThumbVisual>(m_compositor);
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
winrt::Microsoft::ReactNative::Composition::IFocusVisual
|
|
1389
|
+
CompContext<WindowsTypeRedirects>::CreateFocusVisual() noexcept {
|
|
1390
|
+
return winrt::make<Composition::WindowsCompFocusVisual>(m_compositor);
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
template <>
|
|
1394
|
+
winrt::Windows::UI::Composition::CompositionGraphicsDevice
|
|
1395
|
+
CompContext<WindowsTypeRedirects>::CompositionGraphicsDevice() noexcept {
|
|
1396
|
+
if (!m_compositionGraphicsDevice) {
|
|
1397
|
+
// To create a composition graphics device, we need to QI for another interface
|
|
1398
|
+
|
|
1399
|
+
winrt::com_ptr<ABI::Windows::UI::Composition::ICompositorInterop> compositorInterop{
|
|
1400
|
+
m_compositor.as<ABI::Windows::UI::Composition::ICompositorInterop>()};
|
|
1401
|
+
|
|
1402
|
+
// Create a graphics device backed by our D3D device
|
|
1403
|
+
winrt::com_ptr<ABI::Windows::UI::Composition::ICompositionGraphicsDevice> compositionGraphicsDeviceIface;
|
|
1404
|
+
winrt::check_hresult(
|
|
1405
|
+
compositorInterop->CreateGraphicsDevice(D2DDevice().get(), compositionGraphicsDeviceIface.put()));
|
|
1406
|
+
|
|
1407
|
+
compositionGraphicsDeviceIface.as(m_compositionGraphicsDevice);
|
|
1408
|
+
}
|
|
1409
|
+
return m_compositionGraphicsDevice;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
using WindowsCompContext = CompContext<WindowsTypeRedirects>;
|
|
1413
|
+
|
|
1414
|
+
#ifdef USE_WINUI3
|
|
1415
|
+
winrt::Microsoft::ReactNative::Composition::ISpriteVisual
|
|
1416
|
+
CompContext<MicrosoftTypeRedirects>::CreateSpriteVisual() noexcept {
|
|
1417
|
+
return winrt::make<Composition::MicrosoftCompSpriteVisual>(m_compositor.CreateSpriteVisual());
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
winrt::Microsoft::ReactNative::Composition::IScrollVisual
|
|
1421
|
+
CompContext<MicrosoftTypeRedirects>::CreateScrollerVisual() noexcept {
|
|
1422
|
+
return winrt::make<Composition::MicrosoftCompScrollerVisual>(m_compositor.CreateSpriteVisual());
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
winrt::Microsoft::ReactNative::Composition::IActivityVisual
|
|
1426
|
+
CompContext<MicrosoftTypeRedirects>::CreateActivityVisual() noexcept {
|
|
1427
|
+
return winrt::make<Composition::MicrosoftCompActivityVisual>(m_compositor.CreateSpriteVisual());
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
winrt::Microsoft::ReactNative::Composition::IDropShadow
|
|
1431
|
+
CompContext<MicrosoftTypeRedirects>::CreateDropShadow() noexcept {
|
|
1432
|
+
return winrt::make<Composition::MicrosoftCompDropShadow>(m_compositor.CreateDropShadow());
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
winrt::Microsoft::ReactNative::Composition::IBrush CompContext<MicrosoftTypeRedirects>::CreateColorBrush(
|
|
1436
|
+
winrt::Windows::UI::Color color) noexcept {
|
|
1437
|
+
return winrt::make<Composition::MicrosoftCompBrush>(m_compositor.CreateColorBrush(color));
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
winrt::Microsoft::ReactNative::Composition::IDrawingSurfaceBrush
|
|
1441
|
+
CompContext<MicrosoftTypeRedirects>::CreateDrawingSurfaceBrush(
|
|
1442
|
+
winrt::Windows::Foundation::Size surfaceSize,
|
|
1443
|
+
winrt::Windows::Graphics::DirectX::DirectXPixelFormat pixelFormat,
|
|
1444
|
+
winrt::Windows::Graphics::DirectX::DirectXAlphaMode alphaMode) noexcept {
|
|
1445
|
+
return winrt::make<Composition::MicrosoftCompDrawingSurfaceBrush>(
|
|
1446
|
+
m_compositor,
|
|
1447
|
+
CompositionGraphicsDevice().CreateDrawingSurface(
|
|
1448
|
+
surfaceSize,
|
|
1449
|
+
static_cast<winrt::Microsoft::Graphics::DirectX::DirectXPixelFormat>(pixelFormat),
|
|
1450
|
+
static_cast<winrt::Microsoft::Graphics::DirectX::DirectXAlphaMode>(alphaMode)));
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
winrt::Microsoft::ReactNative::Composition::ICaretVisual
|
|
1454
|
+
CompContext<MicrosoftTypeRedirects>::CreateCaretVisual() noexcept {
|
|
1455
|
+
return winrt::make<Composition::MicrosoftCompCaretVisual>(m_compositor);
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
winrt::Microsoft::ReactNative::Composition::ISwitchThumbVisual
|
|
1459
|
+
CompContext<MicrosoftTypeRedirects>::CreateSwitchThumbVisual() noexcept {
|
|
1460
|
+
return winrt::make<Composition::MicrosoftCompSwitchThumbVisual>(m_compositor);
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
winrt::Microsoft::ReactNative::Composition::IFocusVisual
|
|
1464
|
+
CompContext<MicrosoftTypeRedirects>::CreateFocusVisual() noexcept {
|
|
1465
|
+
return winrt::make<Composition::MicrosoftCompFocusVisual>(m_compositor);
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
template <>
|
|
1469
|
+
winrt::Microsoft::UI::Composition::CompositionGraphicsDevice
|
|
1470
|
+
CompContext<MicrosoftTypeRedirects>::CompositionGraphicsDevice() noexcept {
|
|
1471
|
+
if (!m_compositionGraphicsDevice) {
|
|
1472
|
+
winrt::check_hresult(m_compositor.as<winrt::Microsoft::UI::Composition::ICompositorInterop>()->CreateGraphicsDevice(
|
|
1473
|
+
D2DDevice().get(), &m_compositionGraphicsDevice));
|
|
1474
|
+
}
|
|
1475
|
+
return m_compositionGraphicsDevice;
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
using MicrosoftCompContext = CompContext<MicrosoftTypeRedirects>;
|
|
1479
|
+
#endif
|
|
1480
|
+
|
|
866
1481
|
} // namespace Microsoft::ReactNative::Composition
|
|
867
1482
|
|
|
868
1483
|
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
869
1484
|
|
|
870
|
-
ICompositionContext
|
|
1485
|
+
ICompositionContext WindowsCompositionContextHelper::CreateContext(
|
|
871
1486
|
winrt::Windows::UI::Composition::Compositor const &compositor) noexcept {
|
|
872
|
-
return winrt::make<::Microsoft::ReactNative::Composition::
|
|
1487
|
+
return winrt::make<::Microsoft::ReactNative::Composition::WindowsCompContext>(compositor);
|
|
873
1488
|
}
|
|
874
1489
|
|
|
875
|
-
IVisual
|
|
1490
|
+
IVisual WindowsCompositionContextHelper::CreateVisual(winrt::Windows::UI::Composition::Visual const &visual) noexcept {
|
|
876
1491
|
if (auto spriteVisual = visual.try_as<winrt::Windows::UI::Composition::SpriteVisual>())
|
|
877
|
-
return winrt::make<::Microsoft::ReactNative::Composition::
|
|
878
|
-
return winrt::make<::Microsoft::ReactNative::Composition::
|
|
1492
|
+
return winrt::make<::Microsoft::ReactNative::Composition::WindowsCompSpriteVisual>(spriteVisual);
|
|
1493
|
+
return winrt::make<::Microsoft::ReactNative::Composition::WindowsCompVisual>(visual);
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
winrt::Windows::UI::Composition::Compositor WindowsCompositionContextHelper::InnerCompositor(
|
|
1497
|
+
ICompositionContext context) noexcept {
|
|
1498
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::IWindowsCompositionCompositor> s;
|
|
1499
|
+
context.try_as(s);
|
|
1500
|
+
return s ? s->InnerCompositor() : nullptr;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
winrt::Windows::UI::Composition::Visual WindowsCompositionContextHelper::InnerVisual(IVisual visual) noexcept {
|
|
1504
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::IWindowsCompositionVisual> s;
|
|
1505
|
+
visual.try_as(s);
|
|
1506
|
+
return s ? s->InnerVisual() : nullptr;
|
|
879
1507
|
}
|
|
880
1508
|
|
|
881
|
-
winrt::Windows::UI::Composition::
|
|
1509
|
+
winrt::Windows::UI::Composition::DropShadow WindowsCompositionContextHelper::InnerDropShadow(
|
|
1510
|
+
IDropShadow shadow) noexcept {
|
|
1511
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::IWindowsCompositionDropShadow> s;
|
|
1512
|
+
shadow.try_as(s);
|
|
1513
|
+
return s ? s->InnerShadow() : nullptr;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
winrt::Windows::UI::Composition::CompositionBrush WindowsCompositionContextHelper::InnerBrush(IBrush brush) noexcept {
|
|
1517
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::IWindowsCompositionBrush> s;
|
|
1518
|
+
brush.try_as(s);
|
|
1519
|
+
return s ? s->InnerBrush() : nullptr;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
winrt::Windows::UI::Composition::ICompositionSurface WindowsCompositionContextHelper::InnerSurface(
|
|
1523
|
+
IDrawingSurfaceBrush surface) noexcept {
|
|
1524
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::IWindowsCompositionDrawingSurfaceInner> s;
|
|
1525
|
+
surface.try_as(s);
|
|
1526
|
+
return s ? s->Inner() : nullptr;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
#ifdef USE_WINUI3
|
|
1530
|
+
ICompositionContext MicrosoftCompositionContextHelper::CreateContext(
|
|
1531
|
+
winrt::Microsoft::UI::Composition::Compositor const &compositor) noexcept {
|
|
1532
|
+
return winrt::make<::Microsoft::ReactNative::Composition::MicrosoftCompContext>(compositor);
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
IVisual MicrosoftCompositionContextHelper::CreateVisual(
|
|
1536
|
+
winrt::Microsoft::UI::Composition::Visual const &visual) noexcept {
|
|
1537
|
+
if (auto spriteVisual = visual.try_as<winrt::Microsoft::UI::Composition::SpriteVisual>())
|
|
1538
|
+
return winrt::make<::Microsoft::ReactNative::Composition::MicrosoftCompSpriteVisual>(spriteVisual);
|
|
1539
|
+
return winrt::make<::Microsoft::ReactNative::Composition::MicrosoftCompVisual>(visual);
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
winrt::Microsoft::UI::Composition::Compositor MicrosoftCompositionContextHelper::InnerCompositor(
|
|
882
1543
|
ICompositionContext context) noexcept {
|
|
883
|
-
winrt::com_ptr<::Microsoft::ReactNative::Composition::
|
|
884
|
-
context.
|
|
1544
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::IMicrosoftCompositionCompositor> s;
|
|
1545
|
+
context.try_as(s);
|
|
885
1546
|
return s ? s->InnerCompositor() : nullptr;
|
|
886
1547
|
}
|
|
887
1548
|
|
|
888
|
-
winrt::
|
|
889
|
-
winrt::com_ptr<::Microsoft::ReactNative::Composition::
|
|
890
|
-
visual.
|
|
1549
|
+
winrt::Microsoft::UI::Composition::Visual MicrosoftCompositionContextHelper::InnerVisual(IVisual visual) noexcept {
|
|
1550
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::IMicrosoftCompositionVisual> s;
|
|
1551
|
+
visual.try_as(s);
|
|
891
1552
|
return s ? s->InnerVisual() : nullptr;
|
|
892
1553
|
}
|
|
893
1554
|
|
|
894
|
-
winrt::
|
|
895
|
-
|
|
896
|
-
|
|
1555
|
+
winrt::Microsoft::UI::Composition::DropShadow MicrosoftCompositionContextHelper::InnerDropShadow(
|
|
1556
|
+
IDropShadow shadow) noexcept {
|
|
1557
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::IMicrosoftCompositionDropShadow> s;
|
|
1558
|
+
shadow.try_as(s);
|
|
897
1559
|
return s ? s->InnerShadow() : nullptr;
|
|
898
1560
|
}
|
|
899
1561
|
|
|
900
|
-
winrt::
|
|
901
|
-
|
|
902
|
-
|
|
1562
|
+
winrt::Microsoft::UI::Composition::CompositionBrush MicrosoftCompositionContextHelper::InnerBrush(
|
|
1563
|
+
IBrush brush) noexcept {
|
|
1564
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::IMicrosoftCompositionBrush> s;
|
|
1565
|
+
brush.try_as(s);
|
|
903
1566
|
return s ? s->InnerBrush() : nullptr;
|
|
904
1567
|
}
|
|
905
1568
|
|
|
906
|
-
winrt::
|
|
907
|
-
|
|
908
|
-
winrt::com_ptr<::Microsoft::ReactNative::Composition::
|
|
909
|
-
surface.
|
|
1569
|
+
winrt::Microsoft::UI::Composition::ICompositionSurface MicrosoftCompositionContextHelper::InnerSurface(
|
|
1570
|
+
IDrawingSurfaceBrush surface) noexcept {
|
|
1571
|
+
winrt::com_ptr<::Microsoft::ReactNative::Composition::IMicrosoftCompositionDrawingSurfaceInner> s;
|
|
1572
|
+
surface.try_as(s);
|
|
910
1573
|
return s ? s->Inner() : nullptr;
|
|
911
1574
|
}
|
|
1575
|
+
#endif
|
|
912
1576
|
|
|
913
1577
|
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|