mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-05 22:56:11 +00:00
fix: react-native-windows implementation for new architecture (#2527)
# Summary
There are two main things going on with the PR. Both involve a reworking
of the new arch implementation of rn-svg for windows.
The current implementation attempts to implement a svg renderer from
scratch. There are numerous edge cases that it wasn't handling
correctly, and the performance had some serious issues. This
implementation switches to use the svg rendering path built into
Direct2D. This brings significant performance improvements.
The 2nd issue is there have been various breaking changes in
react-native-windows for how new arch native components are implemented.
This brings the rn-svg implementation in line with those latest changes.
## Test Plan
Primary testing right now is loading up the example app in the repo.
New arch on react-native-windows is still in somewhat early days - so
there are not really current users of this code. I am integrating this
code into Microsoft Office, where I have tested some scenarios. But we
will get expanded testing as we roll out the new arch. I expect there to
be some follow-ups as we expand our usage. The version of rn-svg before
this PR doesn't build with the latest new arch react-native-windows
versions. - So its hard to get worse than that.
### What's required for testing (prerequisites)?
### What are the steps to reproduce (after prerequisites)?
## Compatibility
| OS | Implemented |
| ------- | :---------: |
| iOS | N/A |
| MacOS | N/A |
| Android | N/A |
| Web | ✅ |
## Checklist
- [x] I have tested this on a device and a simulator
- [ ] I added documentation in `README.md`
- [ ] I updated the typed files (typescript)
- [ ] I added a test for the API in the `__tests__` folder
This commit is contained in:
19
apps/common/example/examples/Reanimated.windows.tsx
Normal file
19
apps/common/example/examples/Reanimated.windows.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import React from 'react';
|
||||
import {StyleSheet, Text} from 'react-native';
|
||||
|
||||
function ReanimatedRectExample() {
|
||||
return (
|
||||
<Text>
|
||||
Reanimated not supported in react-native-windows new arch currently
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
ReanimatedRectExample.title = 'reanimated rectangle';
|
||||
|
||||
const title = 'Reanimated';
|
||||
const samples = [ReanimatedRectExample];
|
||||
|
||||
const style = StyleSheet.create({text: {width: 30, height: 30}});
|
||||
const icon = <Text style={style.text}>R</Text>;
|
||||
|
||||
export {icon, samples};
|
||||
49
apps/common/noNavigationApp.tsx
Normal file
49
apps/common/noNavigationApp.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Sample React Native App for react-native-svg library
|
||||
* https://github.com/software-mansion/react-native-svg/tree/main/apps/common/example
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is a very simple render of the examples for react-native-svg library, to avoid dependencies on @react-navigation,
|
||||
* which may not be fully supported on all platforms and versions of react-native
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import {ScrollView, Text, View} from 'react-native';
|
||||
import {examples} from './example/examples';
|
||||
import type {Example} from './example/utils/types';
|
||||
import {commonStyles} from './example/utils/commonStyles';
|
||||
|
||||
const ExampleBlock = ({example, index}: {example: Example; index: number}) => {
|
||||
if (Array.isArray(example.samples)) {
|
||||
return (
|
||||
<View
|
||||
key={index}
|
||||
style={{borderWidth: 1, margin: 15, padding: 15, borderRadius: 5}}>
|
||||
{example.icon}
|
||||
<View style={[commonStyles.separator, {margin: 10}]} />
|
||||
{example.samples.map((sample, index) => {
|
||||
return (
|
||||
<View key={index} style={{margin: 15}}>
|
||||
<Text style={commonStyles.title}>{sample.title}</Text>
|
||||
{sample({})}
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
throw new Error('Unhandled Example type');
|
||||
};
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<ScrollView>
|
||||
{Object.values(examples).map((example, index) => {
|
||||
return <ExampleBlock example={example} index={index} key={index} />;
|
||||
})}
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
3
apps/fabric-windows-example/.gitignore
vendored
3
apps/fabric-windows-example/.gitignore
vendored
@@ -52,6 +52,9 @@ yarn-error.log
|
||||
**/fastlane/screenshots
|
||||
**/fastlane/test_output
|
||||
|
||||
# Locally installed nuget packages
|
||||
/windows/packages
|
||||
|
||||
# Bundle artifact
|
||||
*.jsbundle
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
module.exports = {
|
||||
presets: ['module:@react-native/babel-preset'],
|
||||
plugins: [
|
||||
'react-native-reanimated/plugin',
|
||||
],
|
||||
};
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
*/
|
||||
|
||||
import {AppRegistry} from 'react-native';
|
||||
import App from '../common';
|
||||
import App from '../common/noNavigationApp';
|
||||
import {name as appName} from './app.json';
|
||||
|
||||
AppRegistry.registerComponent(appName, () => App);
|
||||
|
||||
|
||||
AppRegistry.registerComponent("Example", () => App);
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
"dependencies": {
|
||||
"react": "18.2.0",
|
||||
"react-native": "0.74.2",
|
||||
"react-native-windows": "0.74.9",
|
||||
"react-native-reanimated": "3.9.0",
|
||||
"react-native-windows": "0.74.24",
|
||||
"react-native-svg": "link:../../"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -36,6 +36,8 @@ void UpdateRootViewSizeToAppWindow(
|
||||
winrt::Microsoft::UI::Windowing::OverlappedPresenterState::Minimized) {
|
||||
winrt::Microsoft::ReactNative::LayoutConstraints constraints;
|
||||
constraints.MaximumSize = constraints.MinimumSize = size;
|
||||
constraints.LayoutDirection =
|
||||
winrt::Microsoft::ReactNative::LayoutDirection::Undefined;
|
||||
rootView.Arrange(constraints, {0, 0});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>shell32.lib;user32.lib;windowsapp.lib;%(AdditionalDependenices)</AdditionalDependencies>
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
"native,Version=v0.0": {
|
||||
"boost": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.76.0, )",
|
||||
"resolved": "1.76.0",
|
||||
"contentHash": "p+w3YvNdXL8Cu9Fzrmexssu0tZbWxuf6ywsQqHjDlKFE5ojXHof1HIyMC3zDLfLnh80dIeFcEUAuR2Asg/XHRA=="
|
||||
"requested": "[1.83.0, )",
|
||||
"resolved": "1.83.0",
|
||||
"contentHash": "cy53VNMzysEMvhBixDe8ujPk67Fcj3v6FPHQnH91NYJNLHpc6jxa2xq9ruCaaJjE4M3YrGSHDi4uUSTGBWw6EQ=="
|
||||
},
|
||||
"Microsoft.JavaScript.Hermes": {
|
||||
"type": "Direct",
|
||||
"requested": "[0.1.21, )",
|
||||
"resolved": "0.1.21",
|
||||
"contentHash": "5njCh+3eXTLOv7+8nOnp6nJ5C0r6it5ze54c0nuWleeDptuK8t3dEDB79XTU4D5DKNvAPlqJpgXRDOak5nYIug=="
|
||||
"requested": "[0.1.23, )",
|
||||
"resolved": "0.1.23",
|
||||
"contentHash": "cA9t1GjY4Yo0JD1AfA//e1lOwk48hLANfuX6GXrikmEBNZVr2TIX5ONJt5tqCnpZyLz6xGiPDgTfFNKbSfb21g=="
|
||||
},
|
||||
"Microsoft.VCRTForwarders.140": {
|
||||
"type": "Direct",
|
||||
@@ -35,6 +35,19 @@
|
||||
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
||||
}
|
||||
},
|
||||
"Microsoft.UI.Xaml": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.8.0",
|
||||
"contentHash": "vxdHxTr63s5KVtNddMFpgvjBjUH50z7seq/5jLWmmSuf8poxg+sXrywkofUdE8ZstbpO9y3FL/IXXUcPYbeesA==",
|
||||
"dependencies": {
|
||||
"Microsoft.Web.WebView2": "1.0.1264.42"
|
||||
}
|
||||
},
|
||||
"Microsoft.Web.WebView2": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1264.42",
|
||||
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
|
||||
},
|
||||
"Microsoft.Windows.SDK.BuildTools": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.22621.756",
|
||||
@@ -43,7 +56,7 @@
|
||||
"common": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"boost": "[1.76.0, )"
|
||||
"boost": "[1.83.0, )"
|
||||
}
|
||||
},
|
||||
"fmt": {
|
||||
@@ -53,7 +66,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Fmt": "[1.0.0, )",
|
||||
"boost": "[1.76.0, )"
|
||||
"boost": "[1.83.0, )"
|
||||
}
|
||||
},
|
||||
"microsoft.reactnative": {
|
||||
@@ -61,17 +74,24 @@
|
||||
"dependencies": {
|
||||
"Common": "[1.0.0, )",
|
||||
"Folly": "[1.0.0, )",
|
||||
"Microsoft.JavaScript.Hermes": "[0.1.21, )",
|
||||
"Microsoft.JavaScript.Hermes": "[0.1.23, )",
|
||||
"Microsoft.WindowsAppSDK": "[1.5.240227000, )",
|
||||
"ReactCommon": "[1.0.0, )",
|
||||
"boost": "[1.76.0, )"
|
||||
"boost": "[1.83.0, )"
|
||||
}
|
||||
},
|
||||
"reactcommon": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Folly": "[1.0.0, )",
|
||||
"boost": "[1.76.0, )"
|
||||
"boost": "[1.83.0, )"
|
||||
}
|
||||
},
|
||||
"reactnativeasyncstorage": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.ReactNative": "[1.0.0, )",
|
||||
"Microsoft.UI.Xaml": "[2.8.0, )"
|
||||
}
|
||||
},
|
||||
"rnsvg": {
|
||||
@@ -80,7 +100,7 @@
|
||||
"Microsoft.ReactNative": "[1.0.0, )",
|
||||
"Microsoft.VCRTForwarders.140": "[1.0.2-rc, )",
|
||||
"Microsoft.WindowsAppSDK": "[1.5.240227000, )",
|
||||
"boost": "[1.76.0, )"
|
||||
"boost": "[1.83.0, )"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -99,6 +119,11 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
||||
}
|
||||
},
|
||||
"Microsoft.Web.WebView2": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1264.42",
|
||||
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
|
||||
}
|
||||
},
|
||||
"native,Version=v0.0/win-arm64": {
|
||||
@@ -116,6 +141,11 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
||||
}
|
||||
},
|
||||
"Microsoft.Web.WebView2": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1264.42",
|
||||
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
|
||||
}
|
||||
},
|
||||
"native,Version=v0.0/win-x64": {
|
||||
@@ -133,6 +163,11 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
||||
}
|
||||
},
|
||||
"Microsoft.Web.WebView2": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1264.42",
|
||||
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
|
||||
}
|
||||
},
|
||||
"native,Version=v0.0/win-x86": {
|
||||
@@ -150,6 +185,11 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
||||
}
|
||||
},
|
||||
"Microsoft.Web.WebView2": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1264.42",
|
||||
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -919,7 +919,7 @@
|
||||
"@babel/helper-create-regexp-features-plugin" "^7.18.6"
|
||||
"@babel/helper-plugin-utils" "^7.18.6"
|
||||
|
||||
"@babel/plugin-transform-arrow-functions@^7.0.0", "@babel/plugin-transform-arrow-functions@^7.0.0-0", "@babel/plugin-transform-arrow-functions@^7.24.1":
|
||||
"@babel/plugin-transform-arrow-functions@^7.0.0", "@babel/plugin-transform-arrow-functions@^7.24.1":
|
||||
version "7.24.1"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.24.1.tgz#2bf263617060c9cc45bcdbf492b8cc805082bf27"
|
||||
integrity sha512-ngT/3NkRhsaep9ck9uj2Xhv9+xB1zShY3tM3g6om4xxCELwCDN4g4Aq5dRn48+0hasAql7s2hdBOysCfNpr4fw==
|
||||
@@ -1377,7 +1377,7 @@
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.24.7"
|
||||
|
||||
"@babel/plugin-transform-nullish-coalescing-operator@^7.0.0-0", "@babel/plugin-transform-nullish-coalescing-operator@^7.24.1":
|
||||
"@babel/plugin-transform-nullish-coalescing-operator@^7.24.1":
|
||||
version "7.24.1"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.24.1.tgz#0cd494bb97cb07d428bd651632cb9d4140513988"
|
||||
integrity sha512-iQ+caew8wRrhCikO5DrUYx0mrmdhkaELgFa+7baMcVuhxIkN7oxt06CZ51D65ugIb1UWRQ8oQe+HXAVM6qHFjw==
|
||||
@@ -1461,7 +1461,7 @@
|
||||
"@babel/helper-plugin-utils" "^7.24.7"
|
||||
"@babel/plugin-syntax-optional-catch-binding" "^7.8.3"
|
||||
|
||||
"@babel/plugin-transform-optional-chaining@^7.0.0-0", "@babel/plugin-transform-optional-chaining@^7.24.1":
|
||||
"@babel/plugin-transform-optional-chaining@^7.24.1":
|
||||
version "7.24.1"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.24.1.tgz#26e588acbedce1ab3519ac40cc748e380c5291e6"
|
||||
integrity sha512-n03wmDt+987qXwAgcBlnUUivrZBPZ8z1plL0YvgQalLm+ZE5BMhGm94jhxXtA1wzv1Cu2aaOv1BM9vbVttrzSg==
|
||||
@@ -1617,7 +1617,7 @@
|
||||
babel-plugin-polyfill-regenerator "^0.6.1"
|
||||
semver "^6.3.1"
|
||||
|
||||
"@babel/plugin-transform-shorthand-properties@^7.0.0", "@babel/plugin-transform-shorthand-properties@^7.0.0-0", "@babel/plugin-transform-shorthand-properties@^7.24.1":
|
||||
"@babel/plugin-transform-shorthand-properties@^7.0.0", "@babel/plugin-transform-shorthand-properties@^7.24.1":
|
||||
version "7.24.1"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.24.1.tgz#ba9a09144cf55d35ec6b93a32253becad8ee5b55"
|
||||
integrity sha512-LyjVB1nsJ6gTTUKRjRWx9C1s9hE7dLfP/knKdrfeH9UPtAGjYGgxIbFfx7xyLIEWs7Xe1Gnf8EWiUqfjLhInZA==
|
||||
@@ -1661,7 +1661,7 @@
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.24.7"
|
||||
|
||||
"@babel/plugin-transform-template-literals@^7.0.0-0", "@babel/plugin-transform-template-literals@^7.24.1":
|
||||
"@babel/plugin-transform-template-literals@^7.24.1":
|
||||
version "7.24.1"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.24.1.tgz#15e2166873a30d8617e3e2ccadb86643d327aab7"
|
||||
integrity sha512-WRkhROsNzriarqECASCNu/nojeXCDTE/F2HmRgOzi7NGvyfYGq1NEjKBK3ckLfRgGc6/lPAqP0vDOSw3YtG34g==
|
||||
@@ -1977,7 +1977,7 @@
|
||||
"@babel/plugin-transform-modules-commonjs" "^7.24.7"
|
||||
"@babel/plugin-transform-typescript" "^7.24.7"
|
||||
|
||||
"@babel/preset-typescript@^7.13.0", "@babel/preset-typescript@^7.16.7":
|
||||
"@babel/preset-typescript@^7.13.0":
|
||||
version "7.24.1"
|
||||
resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.24.1.tgz#89bdf13a3149a17b3b2a2c9c62547f06db8845ec"
|
||||
integrity sha512-1DBaMmRDpuYQBPWD8Pf/WEwCrtgRHxsZnP4mIy9G/X+hFfbI47Q2G4t1Paakld84+qsk2fSsUPMKg71jkoOOaQ==
|
||||
@@ -2493,16 +2493,6 @@
|
||||
resolved "https://registry.yarnpkg.com/@opentelemetry/semantic-conventions/-/semantic-conventions-1.24.0.tgz#f074db930a7feb4d64103a9a576c5fbad046fcac"
|
||||
integrity sha512-yL0jI6Ltuz8R+Opj7jClGrul6pOoYrdfVmzQS4SITXRPH7I5IRZbrwe/6/v8v4WYMa6MYZG480S1+uc/IGfqsA==
|
||||
|
||||
"@react-native-community/cli-clean@13.6.6":
|
||||
version "13.6.6"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-clean/-/cli-clean-13.6.6.tgz#87c7ad8746c38dab0fe7b3c6ff89d44351d5d943"
|
||||
integrity sha512-cBwJTwl0NyeA4nyMxbhkWZhxtILYkbU3TW3k8AXLg+iGphe0zikYMGB3T+haTvTc6alTyEFwPbimk9bGIqkjAQ==
|
||||
dependencies:
|
||||
"@react-native-community/cli-tools" "13.6.6"
|
||||
chalk "^4.1.2"
|
||||
execa "^5.0.0"
|
||||
fast-glob "^3.3.2"
|
||||
|
||||
"@react-native-community/cli-clean@13.6.8":
|
||||
version "13.6.8"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-clean/-/cli-clean-13.6.8.tgz#95ce964047f005152ac100394b6dcd5d2cc2a474"
|
||||
@@ -2513,17 +2503,15 @@
|
||||
execa "^5.0.0"
|
||||
fast-glob "^3.3.2"
|
||||
|
||||
"@react-native-community/cli-config@13.6.6":
|
||||
version "13.6.6"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-config/-/cli-config-13.6.6.tgz#69f590694b3a079c74f781baab3b762db74f5dbd"
|
||||
integrity sha512-mbG425zCKr8JZhv/j11382arezwS/70juWMsn8j2lmrGTrP1cUdW0MF15CCIFtJsqyK3Qs+FTmqttRpq81QfSg==
|
||||
"@react-native-community/cli-clean@13.6.9":
|
||||
version "13.6.9"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-clean/-/cli-clean-13.6.9.tgz#b6754f39c2b877c9d730feb848945150e1d52209"
|
||||
integrity sha512-7Dj5+4p9JggxuVNOjPbduZBAP1SUgNhLKVw5noBUzT/3ZpUZkDM+RCSwyoyg8xKWoE4OrdUAXwAFlMcFDPKykA==
|
||||
dependencies:
|
||||
"@react-native-community/cli-tools" "13.6.6"
|
||||
"@react-native-community/cli-tools" "13.6.9"
|
||||
chalk "^4.1.2"
|
||||
cosmiconfig "^5.1.0"
|
||||
deepmerge "^4.3.0"
|
||||
execa "^5.0.0"
|
||||
fast-glob "^3.3.2"
|
||||
joi "^17.2.1"
|
||||
|
||||
"@react-native-community/cli-config@13.6.8":
|
||||
version "13.6.8"
|
||||
@@ -2537,12 +2525,17 @@
|
||||
fast-glob "^3.3.2"
|
||||
joi "^17.2.1"
|
||||
|
||||
"@react-native-community/cli-debugger-ui@13.6.6":
|
||||
version "13.6.6"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-debugger-ui/-/cli-debugger-ui-13.6.6.tgz#ac021ebd795b0fd66fb52a8987d1d41c5a4b8cb3"
|
||||
integrity sha512-Vv9u6eS4vKSDAvdhA0OiQHoA7y39fiPIgJ6biT32tN4avHDtxlc6TWZGiqv7g98SBvDWvoVAmdPLcRf3kU+c8g==
|
||||
"@react-native-community/cli-config@13.6.9":
|
||||
version "13.6.9"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-config/-/cli-config-13.6.9.tgz#d609a64d40a173c89bd7d24e31807bb7dcba69f9"
|
||||
integrity sha512-rFfVBcNojcMm+KKHE/xqpqXg8HoKl4EC7bFHUrahMJ+y/tZll55+oX/PGG37rzB8QzP2UbMQ19DYQKC1G7kXeg==
|
||||
dependencies:
|
||||
serve-static "^1.13.1"
|
||||
"@react-native-community/cli-tools" "13.6.9"
|
||||
chalk "^4.1.2"
|
||||
cosmiconfig "^5.1.0"
|
||||
deepmerge "^4.3.0"
|
||||
fast-glob "^3.3.2"
|
||||
joi "^17.2.1"
|
||||
|
||||
"@react-native-community/cli-debugger-ui@13.6.8":
|
||||
version "13.6.8"
|
||||
@@ -2551,28 +2544,12 @@
|
||||
dependencies:
|
||||
serve-static "^1.13.1"
|
||||
|
||||
"@react-native-community/cli-doctor@13.6.6":
|
||||
version "13.6.6"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-doctor/-/cli-doctor-13.6.6.tgz#ac0febff05601d9b86af3e03460e1a6b0a1d33a5"
|
||||
integrity sha512-TWZb5g6EmQe2Ua2TEWNmyaEayvlWH4GmdD9ZC+p8EpKFpB1NpDGMK6sXbpb42TDvwZg5s4TDRplK0PBEA/SVDg==
|
||||
"@react-native-community/cli-debugger-ui@13.6.9":
|
||||
version "13.6.9"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-debugger-ui/-/cli-debugger-ui-13.6.9.tgz#bc5727c51964206a00d417e5148b46331a81d5a5"
|
||||
integrity sha512-TkN7IdFmGPPvTpAo3nCAH9uwGCPxWBEAwpqEZDrq0NWllI7Tdie8vDpGdrcuCcKalmhq6OYnkXzeBah7O1Ztpw==
|
||||
dependencies:
|
||||
"@react-native-community/cli-config" "13.6.6"
|
||||
"@react-native-community/cli-platform-android" "13.6.6"
|
||||
"@react-native-community/cli-platform-apple" "13.6.6"
|
||||
"@react-native-community/cli-platform-ios" "13.6.6"
|
||||
"@react-native-community/cli-tools" "13.6.6"
|
||||
chalk "^4.1.2"
|
||||
command-exists "^1.2.8"
|
||||
deepmerge "^4.3.0"
|
||||
envinfo "^7.10.0"
|
||||
execa "^5.0.0"
|
||||
hermes-profile-transformer "^0.0.6"
|
||||
node-stream-zip "^1.9.1"
|
||||
ora "^5.4.1"
|
||||
semver "^7.5.2"
|
||||
strip-ansi "^5.2.0"
|
||||
wcwidth "^1.0.1"
|
||||
yaml "^2.2.1"
|
||||
serve-static "^1.13.1"
|
||||
|
||||
"@react-native-community/cli-doctor@13.6.8":
|
||||
version "13.6.8"
|
||||
@@ -2597,15 +2574,28 @@
|
||||
wcwidth "^1.0.1"
|
||||
yaml "^2.2.1"
|
||||
|
||||
"@react-native-community/cli-hermes@13.6.6":
|
||||
version "13.6.6"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-hermes/-/cli-hermes-13.6.6.tgz#590f55f151fec23b55498228f92d100a0e71d474"
|
||||
integrity sha512-La5Ie+NGaRl3klei6WxKoOxmCUSGGxpOk6vU5pEGf0/O7ky+Ay0io+zXYUZqlNMi/cGpO7ZUijakBYOB/uyuFg==
|
||||
"@react-native-community/cli-doctor@13.6.9":
|
||||
version "13.6.9"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-doctor/-/cli-doctor-13.6.9.tgz#f1d4eeff427ddc8a9d19851042621c10939c35cb"
|
||||
integrity sha512-5quFaLdWFQB+677GXh5dGU9I5eg2z6Vg4jOX9vKnc9IffwyIFAyJfCZHrxLSRPDGNXD7biDQUdoezXYGwb6P/A==
|
||||
dependencies:
|
||||
"@react-native-community/cli-platform-android" "13.6.6"
|
||||
"@react-native-community/cli-tools" "13.6.6"
|
||||
"@react-native-community/cli-config" "13.6.9"
|
||||
"@react-native-community/cli-platform-android" "13.6.9"
|
||||
"@react-native-community/cli-platform-apple" "13.6.9"
|
||||
"@react-native-community/cli-platform-ios" "13.6.9"
|
||||
"@react-native-community/cli-tools" "13.6.9"
|
||||
chalk "^4.1.2"
|
||||
command-exists "^1.2.8"
|
||||
deepmerge "^4.3.0"
|
||||
envinfo "^7.10.0"
|
||||
execa "^5.0.0"
|
||||
hermes-profile-transformer "^0.0.6"
|
||||
node-stream-zip "^1.9.1"
|
||||
ora "^5.4.1"
|
||||
semver "^7.5.2"
|
||||
strip-ansi "^5.2.0"
|
||||
wcwidth "^1.0.1"
|
||||
yaml "^2.2.1"
|
||||
|
||||
"@react-native-community/cli-hermes@13.6.8":
|
||||
version "13.6.8"
|
||||
@@ -2617,17 +2607,15 @@
|
||||
chalk "^4.1.2"
|
||||
hermes-profile-transformer "^0.0.6"
|
||||
|
||||
"@react-native-community/cli-platform-android@13.6.6":
|
||||
version "13.6.6"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-android/-/cli-platform-android-13.6.6.tgz#9e3863cb092709021f11848890bff0fc16fc1609"
|
||||
integrity sha512-/tMwkBeNxh84syiSwNlYtmUz/Ppc+HfKtdopL/5RB+fd3SV1/5/NPNjMlyLNgFKnpxvKCInQ7dnl6jGHJjeHjg==
|
||||
"@react-native-community/cli-hermes@13.6.9":
|
||||
version "13.6.9"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-hermes/-/cli-hermes-13.6.9.tgz#88c8dfe936a0d4272efc54429eda9ccc3fca3ad8"
|
||||
integrity sha512-GvwiwgvFw4Ws+krg2+gYj8sR3g05evmNjAHkKIKMkDTJjZ8EdyxbkifRUs1ZCq3TMZy2oeblZBXCJVOH4W7ZbA==
|
||||
dependencies:
|
||||
"@react-native-community/cli-tools" "13.6.6"
|
||||
"@react-native-community/cli-platform-android" "13.6.9"
|
||||
"@react-native-community/cli-tools" "13.6.9"
|
||||
chalk "^4.1.2"
|
||||
execa "^5.0.0"
|
||||
fast-glob "^3.3.2"
|
||||
fast-xml-parser "^4.2.4"
|
||||
logkitty "^0.7.1"
|
||||
hermes-profile-transformer "^0.0.6"
|
||||
|
||||
"@react-native-community/cli-platform-android@13.6.8":
|
||||
version "13.6.8"
|
||||
@@ -2641,17 +2629,17 @@
|
||||
fast-xml-parser "^4.2.4"
|
||||
logkitty "^0.7.1"
|
||||
|
||||
"@react-native-community/cli-platform-apple@13.6.6":
|
||||
version "13.6.6"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-apple/-/cli-platform-apple-13.6.6.tgz#d445fd6ed02c5ae2f43f9c45501e04fee53a2790"
|
||||
integrity sha512-bOmSSwoqNNT3AmCRZXEMYKz1Jf1l2F86Nhs7qBcXdY/sGiJ+Flng564LOqvdAlVLTbkgz47KjNKCS2pP4Jg0Mg==
|
||||
"@react-native-community/cli-platform-android@13.6.9":
|
||||
version "13.6.9"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-android/-/cli-platform-android-13.6.9.tgz#b175b9b11334fc90da3f395432678bd53c30fae4"
|
||||
integrity sha512-9KsYGdr08QhdvT3Ht7e8phQB3gDX9Fs427NJe0xnoBh+PDPTI2BD5ks5ttsH8CzEw8/P6H8tJCHq6hf2nxd9cw==
|
||||
dependencies:
|
||||
"@react-native-community/cli-tools" "13.6.6"
|
||||
"@react-native-community/cli-tools" "13.6.9"
|
||||
chalk "^4.1.2"
|
||||
execa "^5.0.0"
|
||||
fast-glob "^3.3.2"
|
||||
fast-xml-parser "^4.0.12"
|
||||
ora "^5.4.1"
|
||||
fast-xml-parser "^4.2.4"
|
||||
logkitty "^0.7.1"
|
||||
|
||||
"@react-native-community/cli-platform-apple@13.6.8":
|
||||
version "13.6.8"
|
||||
@@ -2665,12 +2653,17 @@
|
||||
fast-xml-parser "^4.0.12"
|
||||
ora "^5.4.1"
|
||||
|
||||
"@react-native-community/cli-platform-ios@13.6.6":
|
||||
version "13.6.6"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-ios/-/cli-platform-ios-13.6.6.tgz#0cd700f36483ca37dda7ec044377f8a926b1df1f"
|
||||
integrity sha512-vjDnRwhlSN5ryqKTas6/DPkxuouuyFBAqAROH4FR1cspTbn6v78JTZKDmtQy9JMMo7N5vZj1kASU5vbFep9IOQ==
|
||||
"@react-native-community/cli-platform-apple@13.6.9":
|
||||
version "13.6.9"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-apple/-/cli-platform-apple-13.6.9.tgz#02fb5dc47d62acd85f4d7a852e93216927a772fa"
|
||||
integrity sha512-KoeIHfhxMhKXZPXmhQdl6EE+jGKWwoO9jUVWgBvibpVmsNjo7woaG/tfJMEWfWF3najX1EkQAoJWpCDBMYWtlA==
|
||||
dependencies:
|
||||
"@react-native-community/cli-platform-apple" "13.6.6"
|
||||
"@react-native-community/cli-tools" "13.6.9"
|
||||
chalk "^4.1.2"
|
||||
execa "^5.0.0"
|
||||
fast-glob "^3.3.2"
|
||||
fast-xml-parser "^4.0.12"
|
||||
ora "^5.4.1"
|
||||
|
||||
"@react-native-community/cli-platform-ios@13.6.8":
|
||||
version "13.6.8"
|
||||
@@ -2679,20 +2672,12 @@
|
||||
dependencies:
|
||||
"@react-native-community/cli-platform-apple" "13.6.8"
|
||||
|
||||
"@react-native-community/cli-server-api@13.6.6":
|
||||
version "13.6.6"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-server-api/-/cli-server-api-13.6.6.tgz#467993006ef82361cdf7a9817999d5a09e85ca6a"
|
||||
integrity sha512-ZtCXxoFlM7oDv3iZ3wsrT3SamhtUJuIkX2WePLPlN5bcbq7zimbPm2lHyicNJtpcGQ5ymsgpUWPCNZsWQhXBqQ==
|
||||
"@react-native-community/cli-platform-ios@13.6.9":
|
||||
version "13.6.9"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-ios/-/cli-platform-ios-13.6.9.tgz#f37ceab41c2302e8f0d4bcbd3bf58b3353db4306"
|
||||
integrity sha512-CiUcHlGs8vE0CAB4oi1f+dzniqfGuhWPNrDvae2nm8dewlahTBwIcK5CawyGezjcJoeQhjBflh9vloska+nlnw==
|
||||
dependencies:
|
||||
"@react-native-community/cli-debugger-ui" "13.6.6"
|
||||
"@react-native-community/cli-tools" "13.6.6"
|
||||
compression "^1.7.1"
|
||||
connect "^3.6.5"
|
||||
errorhandler "^1.5.1"
|
||||
nocache "^3.0.1"
|
||||
pretty-format "^26.6.2"
|
||||
serve-static "^1.13.1"
|
||||
ws "^6.2.2"
|
||||
"@react-native-community/cli-platform-apple" "13.6.9"
|
||||
|
||||
"@react-native-community/cli-server-api@13.6.8":
|
||||
version "13.6.8"
|
||||
@@ -2709,22 +2694,20 @@
|
||||
serve-static "^1.13.1"
|
||||
ws "^6.2.2"
|
||||
|
||||
"@react-native-community/cli-tools@13.6.6":
|
||||
version "13.6.6"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-tools/-/cli-tools-13.6.6.tgz#55c40cbabafbfc56cfb95a4d5fbf73ef60ec3cbc"
|
||||
integrity sha512-ptOnn4AJczY5njvbdK91k4hcYazDnGtEPrqIwEI+k/CTBHNdb27Rsm2OZ7ye6f7otLBqF8gj/hK6QzJs8CEMgw==
|
||||
"@react-native-community/cli-server-api@13.6.9":
|
||||
version "13.6.9"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-server-api/-/cli-server-api-13.6.9.tgz#269e666bc26e9d0b2f42c7f6099559b5f9259e9d"
|
||||
integrity sha512-W8FSlCPWymO+tlQfM3E0JmM8Oei5HZsIk5S0COOl0MRi8h0NmHI4WSTF2GCfbFZkcr2VI/fRsocoN8Au4EZAug==
|
||||
dependencies:
|
||||
appdirsjs "^1.2.4"
|
||||
chalk "^4.1.2"
|
||||
execa "^5.0.0"
|
||||
find-up "^5.0.0"
|
||||
mime "^2.4.1"
|
||||
node-fetch "^2.6.0"
|
||||
open "^6.2.0"
|
||||
ora "^5.4.1"
|
||||
semver "^7.5.2"
|
||||
shell-quote "^1.7.3"
|
||||
sudo-prompt "^9.0.0"
|
||||
"@react-native-community/cli-debugger-ui" "13.6.9"
|
||||
"@react-native-community/cli-tools" "13.6.9"
|
||||
compression "^1.7.1"
|
||||
connect "^3.6.5"
|
||||
errorhandler "^1.5.1"
|
||||
nocache "^3.0.1"
|
||||
pretty-format "^26.6.2"
|
||||
serve-static "^1.13.1"
|
||||
ws "^6.2.2"
|
||||
|
||||
"@react-native-community/cli-tools@13.6.8":
|
||||
version "13.6.8"
|
||||
@@ -2743,12 +2726,22 @@
|
||||
shell-quote "^1.7.3"
|
||||
sudo-prompt "^9.0.0"
|
||||
|
||||
"@react-native-community/cli-types@13.6.6":
|
||||
version "13.6.6"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-types/-/cli-types-13.6.6.tgz#b45af119d61888fea1074a7c32ddb093e3f119a9"
|
||||
integrity sha512-733iaYzlmvNK7XYbnWlMjdE+2k0hlTBJW071af/xb6Bs+hbJqBP9c03FZuYH2hFFwDDntwj05bkri/P7VgSxug==
|
||||
"@react-native-community/cli-tools@13.6.9":
|
||||
version "13.6.9"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-tools/-/cli-tools-13.6.9.tgz#2baee279358ba1a863e737b2fa9f45659ad91929"
|
||||
integrity sha512-OXaSjoN0mZVw3nrAwcY1PC0uMfyTd9fz7Cy06dh+EJc+h0wikABsVRzV8cIOPrVV+PPEEXE0DBrH20T2puZzgQ==
|
||||
dependencies:
|
||||
joi "^17.2.1"
|
||||
appdirsjs "^1.2.4"
|
||||
chalk "^4.1.2"
|
||||
execa "^5.0.0"
|
||||
find-up "^5.0.0"
|
||||
mime "^2.4.1"
|
||||
node-fetch "^2.6.0"
|
||||
open "^6.2.0"
|
||||
ora "^5.4.1"
|
||||
semver "^7.5.2"
|
||||
shell-quote "^1.7.3"
|
||||
sudo-prompt "^9.0.0"
|
||||
|
||||
"@react-native-community/cli-types@13.6.8":
|
||||
version "13.6.8"
|
||||
@@ -2757,28 +2750,12 @@
|
||||
dependencies:
|
||||
joi "^17.2.1"
|
||||
|
||||
"@react-native-community/cli@13.6.6":
|
||||
version "13.6.6"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-13.6.6.tgz#b929c8668e88344c03a46a3e635cb382dba16773"
|
||||
integrity sha512-IqclB7VQ84ye8Fcs89HOpOscY4284VZg2pojHNl8H0Lzd4DadXJWQoxC7zWm8v2f8eyeX2kdhxp2ETD5tceIgA==
|
||||
"@react-native-community/cli-types@13.6.9":
|
||||
version "13.6.9"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-types/-/cli-types-13.6.9.tgz#08bfb796eacf0daeb31e2de516e81e78a36a1a55"
|
||||
integrity sha512-RLxDppvRxXfs3hxceW/mShi+6o5yS+kFPnPqZTaMKKR5aSg7LwDpLQW4K2D22irEG8e6RKDkZUeH9aL3vO2O0w==
|
||||
dependencies:
|
||||
"@react-native-community/cli-clean" "13.6.6"
|
||||
"@react-native-community/cli-config" "13.6.6"
|
||||
"@react-native-community/cli-debugger-ui" "13.6.6"
|
||||
"@react-native-community/cli-doctor" "13.6.6"
|
||||
"@react-native-community/cli-hermes" "13.6.6"
|
||||
"@react-native-community/cli-server-api" "13.6.6"
|
||||
"@react-native-community/cli-tools" "13.6.6"
|
||||
"@react-native-community/cli-types" "13.6.6"
|
||||
chalk "^4.1.2"
|
||||
commander "^9.4.1"
|
||||
deepmerge "^4.3.0"
|
||||
execa "^5.0.0"
|
||||
find-up "^4.1.0"
|
||||
fs-extra "^8.1.0"
|
||||
graceful-fs "^4.1.3"
|
||||
prompts "^2.4.2"
|
||||
semver "^7.5.2"
|
||||
joi "^17.2.1"
|
||||
|
||||
"@react-native-community/cli@13.6.8":
|
||||
version "13.6.8"
|
||||
@@ -2803,15 +2780,38 @@
|
||||
prompts "^2.4.2"
|
||||
semver "^7.5.2"
|
||||
|
||||
"@react-native-windows/cli@0.74.0":
|
||||
version "0.74.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-windows/cli/-/cli-0.74.0.tgz#da85c0f8d7f96a761080fae27323fe257560e22d"
|
||||
integrity sha512-grOp6b/Pfa4T+n+oWmoo18BXI97CKZPbRKTlCg2Ne5Hsq2rj4Ewg8tnRFKFOMthy5dZcPWLqsphkT0J/sQBHXw==
|
||||
"@react-native-community/cli@13.6.9":
|
||||
version "13.6.9"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-13.6.9.tgz#ba6360b94e0aba9c4001bda256cf7e57e2ecb02c"
|
||||
integrity sha512-hFJL4cgLPxncJJd/epQ4dHnMg5Jy/7Q56jFvA3MHViuKpzzfTCJCB+pGY54maZbtym53UJON9WTGpM3S81UfjQ==
|
||||
dependencies:
|
||||
"@react-native-windows/codegen" "0.74.0"
|
||||
"@react-native-windows/fs" "0.74.0"
|
||||
"@react-native-windows/package-utils" "0.74.0"
|
||||
"@react-native-windows/telemetry" "0.74.0"
|
||||
"@react-native-community/cli-clean" "13.6.9"
|
||||
"@react-native-community/cli-config" "13.6.9"
|
||||
"@react-native-community/cli-debugger-ui" "13.6.9"
|
||||
"@react-native-community/cli-doctor" "13.6.9"
|
||||
"@react-native-community/cli-hermes" "13.6.9"
|
||||
"@react-native-community/cli-server-api" "13.6.9"
|
||||
"@react-native-community/cli-tools" "13.6.9"
|
||||
"@react-native-community/cli-types" "13.6.9"
|
||||
chalk "^4.1.2"
|
||||
commander "^9.4.1"
|
||||
deepmerge "^4.3.0"
|
||||
execa "^5.0.0"
|
||||
find-up "^4.1.0"
|
||||
fs-extra "^8.1.0"
|
||||
graceful-fs "^4.1.3"
|
||||
prompts "^2.4.2"
|
||||
semver "^7.5.2"
|
||||
|
||||
"@react-native-windows/cli@0.74.8":
|
||||
version "0.74.8"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-windows/cli/-/cli-0.74.8.tgz#747b6d4de9fa5e3e837b643fc1a48600d756d2d2"
|
||||
integrity sha512-XUqoXiGDlD4BCYcEweujpV3tUYr5pGijX3mNrP1DWzY8gKXVgcmzLs6fng/EK6VsWD7H8bRraYAu9pccGLN4fw==
|
||||
dependencies:
|
||||
"@react-native-windows/codegen" "0.74.5"
|
||||
"@react-native-windows/fs" "0.74.1"
|
||||
"@react-native-windows/package-utils" "0.74.1"
|
||||
"@react-native-windows/telemetry" "0.74.2"
|
||||
"@xmldom/xmldom" "^0.7.7"
|
||||
chalk "^4.1.0"
|
||||
cli-spinners "^2.2.0"
|
||||
@@ -2830,50 +2830,50 @@
|
||||
xml-parser "^1.2.1"
|
||||
xpath "^0.0.27"
|
||||
|
||||
"@react-native-windows/codegen@0.74.0":
|
||||
version "0.74.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-windows/codegen/-/codegen-0.74.0.tgz#9024ba6e871088e42356f94eb126697e6268487b"
|
||||
integrity sha512-jSN5PZQKZIuaukoUJU9LOyHs2Y/KmG5xsLtSGRUcjG8wTrzP+xXxj3115hHdk9vreL80o+pup5o1UNfyLfvGIA==
|
||||
"@react-native-windows/codegen@0.74.5":
|
||||
version "0.74.5"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-windows/codegen/-/codegen-0.74.5.tgz#a90d6caa0c1664ce25f43457bdb72bf424918f48"
|
||||
integrity sha512-7v2QBQH7wBBYe+OUlbEsDEEOhsRAM4th55F8r9RtyEvMc+2W79up0se3+xYdBgwjYIPHsDp+g5XwDVjBJC4m7A==
|
||||
dependencies:
|
||||
"@react-native-windows/fs" "0.74.0"
|
||||
"@react-native-windows/fs" "0.74.1"
|
||||
chalk "^4.1.0"
|
||||
globby "^11.0.4"
|
||||
globby "^11.1.0"
|
||||
mustache "^4.0.1"
|
||||
source-map-support "^0.5.19"
|
||||
yargs "^16.2.0"
|
||||
|
||||
"@react-native-windows/find-repo-root@0.74.0":
|
||||
version "0.74.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-windows/find-repo-root/-/find-repo-root-0.74.0.tgz#687819c76825d3f7c58401a9d96c2c748774506f"
|
||||
integrity sha512-6dxkKX+mtT+yXuTDUf7A+ZQnyX57WlYk3fDNeNTpI66xBR4QuRwPdzTNamZxvX6JEMSe4lm4PqXWlfAKYzPENw==
|
||||
"@react-native-windows/find-repo-root@0.74.1":
|
||||
version "0.74.1"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-windows/find-repo-root/-/find-repo-root-0.74.1.tgz#bf2f10545c29ffcdb76b9179fce346f84e15c5ab"
|
||||
integrity sha512-k+Hk16/NmPhxsQYGCRtAfcQqCDCJvAxC74FLzFOO6+c/VDM0U05kEcJsJzI1dh/0kZh+YSZQo3w1RrA1z1S2gw==
|
||||
dependencies:
|
||||
"@react-native-windows/fs" "0.74.0"
|
||||
"@react-native-windows/fs" "0.74.1"
|
||||
find-up "^4.1.0"
|
||||
|
||||
"@react-native-windows/fs@0.74.0":
|
||||
version "0.74.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-windows/fs/-/fs-0.74.0.tgz#bbef312e6c9541292a69e607c1e5fbc47e2a665c"
|
||||
integrity sha512-YK8CkNHSwskU3PPCPTw1DPen3/QXS7qP7rAp+FNK4LfyOgiO1V9TiIyz3DcvqOsD+iwriXoEl/3Bvo/8HmlTbQ==
|
||||
"@react-native-windows/fs@0.74.1":
|
||||
version "0.74.1"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-windows/fs/-/fs-0.74.1.tgz#2c6ade1f937adc6056b1a6b052b7b85acb725a14"
|
||||
integrity sha512-Qepr2KyMvCKugOwIXKXtgMqww5P3yI5HTtxIUWytBCoIPEk1lJdpx/sFjTGmir0QXaLlZxXbdrxpLLnN7eq3Tg==
|
||||
dependencies:
|
||||
graceful-fs "^4.2.8"
|
||||
|
||||
"@react-native-windows/package-utils@0.74.0":
|
||||
version "0.74.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-windows/package-utils/-/package-utils-0.74.0.tgz#bdcd18f993d899a6f9914365863bde7ee4eee509"
|
||||
integrity sha512-b7c2/DycLM3MK7K6Y4XVuKFBTLvyg0DSP7++f/yZsBWyCysFycAS5gCrlVbXk6Kez3CIEspSS7op+GJMduMp8g==
|
||||
"@react-native-windows/package-utils@0.74.1":
|
||||
version "0.74.1"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-windows/package-utils/-/package-utils-0.74.1.tgz#18e49bb5b2ed967f279605223eae65a3ea55112f"
|
||||
integrity sha512-nzKo1H991npbRx2EJT0wkniGkngEw7ND5+oz6jhbNFQ3UCKIUBCLc2bPBBX1Z5jp40R+qoVbgnQP2fuAN5y9tA==
|
||||
dependencies:
|
||||
"@react-native-windows/find-repo-root" "0.74.0"
|
||||
"@react-native-windows/fs" "0.74.0"
|
||||
"@react-native-windows/find-repo-root" "0.74.1"
|
||||
"@react-native-windows/fs" "0.74.1"
|
||||
get-monorepo-packages "^1.2.0"
|
||||
lodash "^4.17.15"
|
||||
|
||||
"@react-native-windows/telemetry@0.74.0":
|
||||
version "0.74.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-windows/telemetry/-/telemetry-0.74.0.tgz#e050312998d6c64f50f368bcb3299e9e3138fd10"
|
||||
integrity sha512-80vMPWXLJpa3v+vAafXjCQM0GFE3Iq8breRkrwzmbANAfCEXoJdOI0Aju0sOqDyiE68OUekjU9lwWbIyFEQGJQ==
|
||||
"@react-native-windows/telemetry@0.74.2":
|
||||
version "0.74.2"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-windows/telemetry/-/telemetry-0.74.2.tgz#3ad1bdc2be0f43f2009f13368d5c6659064ec3db"
|
||||
integrity sha512-fTqPYaYB7MtPHTr1ytarFsoPHLHch8EAegblTDTo1ha3a1neGOMTGoxZF2a8/l0y8HSDdsfyTfv8JjCO3w5oow==
|
||||
dependencies:
|
||||
"@azure/core-auth" "1.5.0"
|
||||
"@react-native-windows/fs" "0.74.0"
|
||||
"@react-native-windows/fs" "0.74.1"
|
||||
"@xmldom/xmldom" "^0.7.7"
|
||||
applicationinsights "2.9.1"
|
||||
ci-info "^3.2.0"
|
||||
@@ -2882,16 +2882,16 @@
|
||||
os-locale "^5.0.0"
|
||||
xpath "^0.0.27"
|
||||
|
||||
"@react-native/assets-registry@0.74.83":
|
||||
version "0.74.83"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/assets-registry/-/assets-registry-0.74.83.tgz#c1815dc10f9e1075e0d03b4c8a9619145969522e"
|
||||
integrity sha512-2vkLMVnp+YTZYTNSDIBZojSsjz8sl5PscP3j4GcV6idD8V978SZfwFlk8K0ti0BzRs11mzL0Pj17km597S/eTQ==
|
||||
|
||||
"@react-native/assets-registry@0.74.84":
|
||||
version "0.74.84"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/assets-registry/-/assets-registry-0.74.84.tgz#aa472f82c1b7d8a30098c8ba22fad7b3dbb5be5f"
|
||||
integrity sha512-dzUhwyaX04QosWZ8zyaaNB/WYZIdeDN1lcpfQbqiOhZJShRH+FLTDVONE/dqlMQrP+EO7lDqF0RrlIt9lnOCQQ==
|
||||
|
||||
"@react-native/assets-registry@0.74.87":
|
||||
version "0.74.87"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/assets-registry/-/assets-registry-0.74.87.tgz#7dda64e48db14597e19e15f679e31abbb1c1fb4d"
|
||||
integrity sha512-1XmRhqQchN+pXPKEKYdpJlwESxVomJOxtEnIkbo7GAlaN2sym84fHEGDXAjLilih5GVPpcpSmFzTy8jx3LtaFg==
|
||||
|
||||
"@react-native/assets@1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/assets/-/assets-1.0.0.tgz#c6f9bf63d274bafc8e970628de24986b30a55c8e"
|
||||
@@ -2904,13 +2904,6 @@
|
||||
dependencies:
|
||||
"@react-native/codegen" "0.74.81"
|
||||
|
||||
"@react-native/babel-plugin-codegen@0.74.83":
|
||||
version "0.74.83"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/babel-plugin-codegen/-/babel-plugin-codegen-0.74.83.tgz#971f9cfec980dd05598d81964c05a26c6166f9fb"
|
||||
integrity sha512-+S0st3t4Ro00bi9gjT1jnK8qTFOU+CwmziA7U9odKyWrCoRJrgmrvogq/Dr1YXlpFxexiGIupGut1VHxr+fxJA==
|
||||
dependencies:
|
||||
"@react-native/codegen" "0.74.83"
|
||||
|
||||
"@react-native/babel-plugin-codegen@0.74.84":
|
||||
version "0.74.84"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/babel-plugin-codegen/-/babel-plugin-codegen-0.74.84.tgz#a3a72c188d875601704a421e395f6909fdec40f3"
|
||||
@@ -2918,6 +2911,13 @@
|
||||
dependencies:
|
||||
"@react-native/codegen" "0.74.84"
|
||||
|
||||
"@react-native/babel-plugin-codegen@0.74.87":
|
||||
version "0.74.87"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/babel-plugin-codegen/-/babel-plugin-codegen-0.74.87.tgz#44457f4de69911f37a6ac308a7783203a757574a"
|
||||
integrity sha512-+vJYpMnENFrwtgvDfUj+CtVJRJuUnzAUYT0/Pb68Sq9RfcZ5xdcCuUgyf7JO+akW2VTBoJY427wkcxU30qrWWw==
|
||||
dependencies:
|
||||
"@react-native/codegen" "0.74.87"
|
||||
|
||||
"@react-native/babel-preset@0.74.81":
|
||||
version "0.74.81"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/babel-preset/-/babel-preset-0.74.81.tgz#80d0b96eef35d671f97eaf223c4d770170d7f23f"
|
||||
@@ -2967,55 +2967,6 @@
|
||||
babel-plugin-transform-flow-enums "^0.0.2"
|
||||
react-refresh "^0.14.0"
|
||||
|
||||
"@react-native/babel-preset@0.74.83":
|
||||
version "0.74.83"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/babel-preset/-/babel-preset-0.74.83.tgz#9828457779b4ce0219078652327ce3203115cdf9"
|
||||
integrity sha512-KJuu3XyVh3qgyUer+rEqh9a/JoUxsDOzkJNfRpDyXiAyjDRoVch60X/Xa/NcEQ93iCVHAWs0yQ+XGNGIBCYE6g==
|
||||
dependencies:
|
||||
"@babel/core" "^7.20.0"
|
||||
"@babel/plugin-proposal-async-generator-functions" "^7.0.0"
|
||||
"@babel/plugin-proposal-class-properties" "^7.18.0"
|
||||
"@babel/plugin-proposal-export-default-from" "^7.0.0"
|
||||
"@babel/plugin-proposal-logical-assignment-operators" "^7.18.0"
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator" "^7.18.0"
|
||||
"@babel/plugin-proposal-numeric-separator" "^7.0.0"
|
||||
"@babel/plugin-proposal-object-rest-spread" "^7.20.0"
|
||||
"@babel/plugin-proposal-optional-catch-binding" "^7.0.0"
|
||||
"@babel/plugin-proposal-optional-chaining" "^7.20.0"
|
||||
"@babel/plugin-syntax-dynamic-import" "^7.8.0"
|
||||
"@babel/plugin-syntax-export-default-from" "^7.0.0"
|
||||
"@babel/plugin-syntax-flow" "^7.18.0"
|
||||
"@babel/plugin-syntax-nullish-coalescing-operator" "^7.0.0"
|
||||
"@babel/plugin-syntax-optional-chaining" "^7.0.0"
|
||||
"@babel/plugin-transform-arrow-functions" "^7.0.0"
|
||||
"@babel/plugin-transform-async-to-generator" "^7.20.0"
|
||||
"@babel/plugin-transform-block-scoping" "^7.0.0"
|
||||
"@babel/plugin-transform-classes" "^7.0.0"
|
||||
"@babel/plugin-transform-computed-properties" "^7.0.0"
|
||||
"@babel/plugin-transform-destructuring" "^7.20.0"
|
||||
"@babel/plugin-transform-flow-strip-types" "^7.20.0"
|
||||
"@babel/plugin-transform-function-name" "^7.0.0"
|
||||
"@babel/plugin-transform-literals" "^7.0.0"
|
||||
"@babel/plugin-transform-modules-commonjs" "^7.0.0"
|
||||
"@babel/plugin-transform-named-capturing-groups-regex" "^7.0.0"
|
||||
"@babel/plugin-transform-parameters" "^7.0.0"
|
||||
"@babel/plugin-transform-private-methods" "^7.22.5"
|
||||
"@babel/plugin-transform-private-property-in-object" "^7.22.11"
|
||||
"@babel/plugin-transform-react-display-name" "^7.0.0"
|
||||
"@babel/plugin-transform-react-jsx" "^7.0.0"
|
||||
"@babel/plugin-transform-react-jsx-self" "^7.0.0"
|
||||
"@babel/plugin-transform-react-jsx-source" "^7.0.0"
|
||||
"@babel/plugin-transform-runtime" "^7.0.0"
|
||||
"@babel/plugin-transform-shorthand-properties" "^7.0.0"
|
||||
"@babel/plugin-transform-spread" "^7.0.0"
|
||||
"@babel/plugin-transform-sticky-regex" "^7.0.0"
|
||||
"@babel/plugin-transform-typescript" "^7.5.0"
|
||||
"@babel/plugin-transform-unicode-regex" "^7.0.0"
|
||||
"@babel/template" "^7.0.0"
|
||||
"@react-native/babel-plugin-codegen" "0.74.83"
|
||||
babel-plugin-transform-flow-enums "^0.0.2"
|
||||
react-refresh "^0.14.0"
|
||||
|
||||
"@react-native/babel-preset@0.74.84":
|
||||
version "0.74.84"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/babel-preset/-/babel-preset-0.74.84.tgz#703ebfc810d82c9f51f033352abd5f9fa70d492b"
|
||||
@@ -3065,6 +3016,55 @@
|
||||
babel-plugin-transform-flow-enums "^0.0.2"
|
||||
react-refresh "^0.14.0"
|
||||
|
||||
"@react-native/babel-preset@0.74.87":
|
||||
version "0.74.87"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/babel-preset/-/babel-preset-0.74.87.tgz#3d74517d2ea8898f83b5106027033607d5bda50d"
|
||||
integrity sha512-hyKpfqzN2nxZmYYJ0tQIHG99FQO0OWXp/gVggAfEUgiT+yNKas1C60LuofUsK7cd+2o9jrpqgqW4WzEDZoBlTg==
|
||||
dependencies:
|
||||
"@babel/core" "^7.20.0"
|
||||
"@babel/plugin-proposal-async-generator-functions" "^7.0.0"
|
||||
"@babel/plugin-proposal-class-properties" "^7.18.0"
|
||||
"@babel/plugin-proposal-export-default-from" "^7.0.0"
|
||||
"@babel/plugin-proposal-logical-assignment-operators" "^7.18.0"
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator" "^7.18.0"
|
||||
"@babel/plugin-proposal-numeric-separator" "^7.0.0"
|
||||
"@babel/plugin-proposal-object-rest-spread" "^7.20.0"
|
||||
"@babel/plugin-proposal-optional-catch-binding" "^7.0.0"
|
||||
"@babel/plugin-proposal-optional-chaining" "^7.20.0"
|
||||
"@babel/plugin-syntax-dynamic-import" "^7.8.0"
|
||||
"@babel/plugin-syntax-export-default-from" "^7.0.0"
|
||||
"@babel/plugin-syntax-flow" "^7.18.0"
|
||||
"@babel/plugin-syntax-nullish-coalescing-operator" "^7.0.0"
|
||||
"@babel/plugin-syntax-optional-chaining" "^7.0.0"
|
||||
"@babel/plugin-transform-arrow-functions" "^7.0.0"
|
||||
"@babel/plugin-transform-async-to-generator" "^7.20.0"
|
||||
"@babel/plugin-transform-block-scoping" "^7.0.0"
|
||||
"@babel/plugin-transform-classes" "^7.0.0"
|
||||
"@babel/plugin-transform-computed-properties" "^7.0.0"
|
||||
"@babel/plugin-transform-destructuring" "^7.20.0"
|
||||
"@babel/plugin-transform-flow-strip-types" "^7.20.0"
|
||||
"@babel/plugin-transform-function-name" "^7.0.0"
|
||||
"@babel/plugin-transform-literals" "^7.0.0"
|
||||
"@babel/plugin-transform-modules-commonjs" "^7.0.0"
|
||||
"@babel/plugin-transform-named-capturing-groups-regex" "^7.0.0"
|
||||
"@babel/plugin-transform-parameters" "^7.0.0"
|
||||
"@babel/plugin-transform-private-methods" "^7.22.5"
|
||||
"@babel/plugin-transform-private-property-in-object" "^7.22.11"
|
||||
"@babel/plugin-transform-react-display-name" "^7.0.0"
|
||||
"@babel/plugin-transform-react-jsx" "^7.0.0"
|
||||
"@babel/plugin-transform-react-jsx-self" "^7.0.0"
|
||||
"@babel/plugin-transform-react-jsx-source" "^7.0.0"
|
||||
"@babel/plugin-transform-runtime" "^7.0.0"
|
||||
"@babel/plugin-transform-shorthand-properties" "^7.0.0"
|
||||
"@babel/plugin-transform-spread" "^7.0.0"
|
||||
"@babel/plugin-transform-sticky-regex" "^7.0.0"
|
||||
"@babel/plugin-transform-typescript" "^7.5.0"
|
||||
"@babel/plugin-transform-unicode-regex" "^7.0.0"
|
||||
"@babel/template" "^7.0.0"
|
||||
"@react-native/babel-plugin-codegen" "0.74.87"
|
||||
babel-plugin-transform-flow-enums "^0.0.2"
|
||||
react-refresh "^0.14.0"
|
||||
|
||||
"@react-native/codegen@0.74.81":
|
||||
version "0.74.81"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/codegen/-/codegen-0.74.81.tgz#1025ffd41f2b4710fd700c9e8e85210b9651a7c4"
|
||||
@@ -3078,19 +3078,6 @@
|
||||
mkdirp "^0.5.1"
|
||||
nullthrows "^1.1.1"
|
||||
|
||||
"@react-native/codegen@0.74.83":
|
||||
version "0.74.83"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/codegen/-/codegen-0.74.83.tgz#7c56a82fe7603f0867f0d80ff29db3757b71be55"
|
||||
integrity sha512-GgvgHS3Aa2J8/mp1uC/zU8HuTh8ZT5jz7a4mVMWPw7+rGyv70Ba8uOVBq6UH2Q08o617IATYc+0HfyzAfm4n0w==
|
||||
dependencies:
|
||||
"@babel/parser" "^7.20.0"
|
||||
glob "^7.1.1"
|
||||
hermes-parser "0.19.1"
|
||||
invariant "^2.2.4"
|
||||
jscodeshift "^0.14.0"
|
||||
mkdirp "^0.5.1"
|
||||
nullthrows "^1.1.1"
|
||||
|
||||
"@react-native/codegen@0.74.84":
|
||||
version "0.74.84"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/codegen/-/codegen-0.74.84.tgz#d3425a510b7da558ef5088d9b0aa5e0b1c05c783"
|
||||
@@ -3104,23 +3091,18 @@
|
||||
mkdirp "^0.5.1"
|
||||
nullthrows "^1.1.1"
|
||||
|
||||
"@react-native/community-cli-plugin@0.74.83":
|
||||
version "0.74.83"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/community-cli-plugin/-/community-cli-plugin-0.74.83.tgz#58808a58a5288895627548338731e72ebb5b507c"
|
||||
integrity sha512-7GAFjFOg1mFSj8bnFNQS4u8u7+QtrEeflUIDVZGEfBZQ3wMNI5ycBzbBGycsZYiq00Xvoc6eKFC7kvIaqeJpUQ==
|
||||
"@react-native/codegen@0.74.87":
|
||||
version "0.74.87"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/codegen/-/codegen-0.74.87.tgz#47f07a627d0294c8270a03aee098991ed91f8ae9"
|
||||
integrity sha512-GMSYDiD+86zLKgMMgz9z0k6FxmRn+z6cimYZKkucW4soGbxWsbjUAZoZ56sJwt2FJ3XVRgXCrnOCgXoH/Bkhcg==
|
||||
dependencies:
|
||||
"@react-native-community/cli-server-api" "13.6.6"
|
||||
"@react-native-community/cli-tools" "13.6.6"
|
||||
"@react-native/dev-middleware" "0.74.83"
|
||||
"@react-native/metro-babel-transformer" "0.74.83"
|
||||
chalk "^4.0.0"
|
||||
execa "^5.1.1"
|
||||
metro "^0.80.3"
|
||||
metro-config "^0.80.3"
|
||||
metro-core "^0.80.3"
|
||||
node-fetch "^2.2.0"
|
||||
querystring "^0.2.1"
|
||||
readline "^1.3.0"
|
||||
"@babel/parser" "^7.20.0"
|
||||
glob "^7.1.1"
|
||||
hermes-parser "0.19.1"
|
||||
invariant "^2.2.4"
|
||||
jscodeshift "^0.14.0"
|
||||
mkdirp "^0.5.1"
|
||||
nullthrows "^1.1.1"
|
||||
|
||||
"@react-native/community-cli-plugin@0.74.84":
|
||||
version "0.74.84"
|
||||
@@ -3140,23 +3122,41 @@
|
||||
querystring "^0.2.1"
|
||||
readline "^1.3.0"
|
||||
|
||||
"@react-native/debugger-frontend@0.74.83":
|
||||
version "0.74.83"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/debugger-frontend/-/debugger-frontend-0.74.83.tgz#48050afa4e086438073b95f041c0cc84fe3f20de"
|
||||
integrity sha512-RGQlVUegBRxAUF9c1ss1ssaHZh6CO+7awgtI9sDeU0PzDZY/40ImoPD5m0o0SI6nXoVzbPtcMGzU+VO590pRfA==
|
||||
"@react-native/community-cli-plugin@0.74.87":
|
||||
version "0.74.87"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/community-cli-plugin/-/community-cli-plugin-0.74.87.tgz#4d9798d51381912f3771acded9b6b2804987e952"
|
||||
integrity sha512-EgJG9lSr8x3X67dHQKQvU6EkO+3ksVlJHYIVv6U/AmW9dN80BEFxgYbSJ7icXS4wri7m4kHdgeq2PQ7/3vvrTQ==
|
||||
dependencies:
|
||||
"@react-native-community/cli-server-api" "13.6.9"
|
||||
"@react-native-community/cli-tools" "13.6.9"
|
||||
"@react-native/dev-middleware" "0.74.87"
|
||||
"@react-native/metro-babel-transformer" "0.74.87"
|
||||
chalk "^4.0.0"
|
||||
execa "^5.1.1"
|
||||
metro "^0.80.3"
|
||||
metro-config "^0.80.3"
|
||||
metro-core "^0.80.3"
|
||||
node-fetch "^2.2.0"
|
||||
querystring "^0.2.1"
|
||||
readline "^1.3.0"
|
||||
|
||||
"@react-native/debugger-frontend@0.74.84":
|
||||
version "0.74.84"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/debugger-frontend/-/debugger-frontend-0.74.84.tgz#0bde122a988916b6a50f05a7c3ab1c5db029b149"
|
||||
integrity sha512-YUEA03UNFbiYzHpYxlcS2D9+3eNT5YLGkl5yRg3nOSN6KbCc/OttGnNZme+tuSOJwjMN/vcvtDKYkTqjJw8U0A==
|
||||
|
||||
"@react-native/dev-middleware@0.74.83":
|
||||
version "0.74.83"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/dev-middleware/-/dev-middleware-0.74.83.tgz#9d09cfdb763e8ef81c003b0f99ae4ed1a3539639"
|
||||
integrity sha512-UH8iriqnf7N4Hpi20D7M2FdvSANwTVStwFCSD7VMU9agJX88Yk0D1T6Meh2RMhUu4kY2bv8sTkNRm7LmxvZqgA==
|
||||
"@react-native/debugger-frontend@0.74.87":
|
||||
version "0.74.87"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/debugger-frontend/-/debugger-frontend-0.74.87.tgz#0bb4f4f54365d04fc975349d5f635cb575f6a5d8"
|
||||
integrity sha512-MN95DJLYTv4EqJc+9JajA3AJZSBYJz2QEJ3uWlHrOky2vKrbbRVaW1ityTmaZa2OXIvNc6CZwSRSE7xCoHbXhQ==
|
||||
|
||||
"@react-native/dev-middleware@0.74.84":
|
||||
version "0.74.84"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/dev-middleware/-/dev-middleware-0.74.84.tgz#19ccfece791742f83f4c0a22a8c14593a45562a2"
|
||||
integrity sha512-veYw/WmyrAOQHUiIeULzn2duJQnXDPiKq2jZ/lcmDo6jsLirpp+Q73lx09TYgy/oVoPRuV0nfmU3x9B6EV/7qQ==
|
||||
dependencies:
|
||||
"@isaacs/ttlcache" "^1.4.1"
|
||||
"@react-native/debugger-frontend" "0.74.83"
|
||||
"@react-native/debugger-frontend" "0.74.84"
|
||||
"@rnx-kit/chromium-edge-launcher" "^1.0.0"
|
||||
chrome-launcher "^0.15.2"
|
||||
connect "^3.6.5"
|
||||
@@ -3169,13 +3169,13 @@
|
||||
temp-dir "^2.0.0"
|
||||
ws "^6.2.2"
|
||||
|
||||
"@react-native/dev-middleware@0.74.84":
|
||||
version "0.74.84"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/dev-middleware/-/dev-middleware-0.74.84.tgz#19ccfece791742f83f4c0a22a8c14593a45562a2"
|
||||
integrity sha512-veYw/WmyrAOQHUiIeULzn2duJQnXDPiKq2jZ/lcmDo6jsLirpp+Q73lx09TYgy/oVoPRuV0nfmU3x9B6EV/7qQ==
|
||||
"@react-native/dev-middleware@0.74.87":
|
||||
version "0.74.87"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/dev-middleware/-/dev-middleware-0.74.87.tgz#254807b579a3015ced659a14c374dbf029a9c04e"
|
||||
integrity sha512-7TmZ3hTHwooYgIHqc/z87BMe1ryrIqAUi+AF7vsD+EHCGxHFdMjSpf1BZ2SUPXuLnF2cTiTfV2RwhbPzx0tYIA==
|
||||
dependencies:
|
||||
"@isaacs/ttlcache" "^1.4.1"
|
||||
"@react-native/debugger-frontend" "0.74.84"
|
||||
"@react-native/debugger-frontend" "0.74.87"
|
||||
"@rnx-kit/chromium-edge-launcher" "^1.0.0"
|
||||
chrome-launcher "^0.15.2"
|
||||
connect "^3.6.5"
|
||||
@@ -3212,31 +3212,31 @@
|
||||
resolved "https://registry.yarnpkg.com/@react-native/eslint-plugin/-/eslint-plugin-0.74.81.tgz#ac53da7c41a35948b0f9d01d88d2a858e879edb1"
|
||||
integrity sha512-vlbLJ38MFJzcEgNxNswjgDRELvZX5e4SmGhtN9N1ZQpXLkgo3hs+l2m4ulSpKhSmqpbacB5XbuTTMgKOsLj/5w==
|
||||
|
||||
"@react-native/gradle-plugin@0.74.83":
|
||||
version "0.74.83"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/gradle-plugin/-/gradle-plugin-0.74.83.tgz#4ac60a6d6295d5b920173cbf184ee32e53690810"
|
||||
integrity sha512-Pw2BWVyOHoBuJVKxGVYF6/GSZRf6+v1Ygc+ULGz5t20N8qzRWPa2fRZWqoxsN7TkNLPsECYY8gooOl7okOcPAQ==
|
||||
|
||||
"@react-native/gradle-plugin@0.74.84":
|
||||
version "0.74.84"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/gradle-plugin/-/gradle-plugin-0.74.84.tgz#6ff25fad5f78c276afde96ffc42e04e92d6d92b1"
|
||||
integrity sha512-wYWC5WWXqzCCe4PDogz9pNc4xH5ZamahW5XGSbrrYJ5V3walZ+7z43V6iEBJkZbLjj9YBcSttkXYGr1Xh4veAg==
|
||||
|
||||
"@react-native/gradle-plugin@0.74.87":
|
||||
version "0.74.87"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/gradle-plugin/-/gradle-plugin-0.74.87.tgz#a66c01fda7a938a116dc27447f0ccce285796b2a"
|
||||
integrity sha512-T+VX0N1qP+U9V4oAtn7FTX7pfsoVkd1ocyw9swYXgJqU2fK7hC9famW7b3s3ZiufPGPr1VPJe2TVGtSopBjL6A==
|
||||
|
||||
"@react-native/js-polyfills@0.74.81":
|
||||
version "0.74.81"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/js-polyfills/-/js-polyfills-0.74.81.tgz#64780497be4ecbff1b27076294e3ebd7df1ba485"
|
||||
integrity sha512-o4MiR+/kkHoeoQ/zPwt81LnTm6pqdg0wOhU7S7vIZUqzJ7YUpnpaAvF+/z7HzUOPudnavoCN0wvcZPe/AMEyCA==
|
||||
|
||||
"@react-native/js-polyfills@0.74.83":
|
||||
version "0.74.83"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/js-polyfills/-/js-polyfills-0.74.83.tgz#0e189ce3ab0efecd00223f3bfc53663ce08ba013"
|
||||
integrity sha512-/t74n8r6wFhw4JEoOj3bN71N1NDLqaawB75uKAsSjeCwIR9AfCxlzZG0etsXtOexkY9KMeZIQ7YwRPqUdNXuqw==
|
||||
|
||||
"@react-native/js-polyfills@0.74.84":
|
||||
version "0.74.84"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/js-polyfills/-/js-polyfills-0.74.84.tgz#edf0e8463616a2683269bbfe3957590f7ebd910c"
|
||||
integrity sha512-+PgxuUjBw9JVlz6m4ECsIJMLbDopnr4rpLmsG32hQaJrg0wMuvHtsgAY/J/aVCSG2GNUXexfjrnhc+O9yGOZXQ==
|
||||
|
||||
"@react-native/js-polyfills@0.74.87":
|
||||
version "0.74.87"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/js-polyfills/-/js-polyfills-0.74.87.tgz#d28090a4dae417a2e9ad14e065fcf8cf52cc482c"
|
||||
integrity sha512-M5Evdn76CuVEF0GsaXiGi95CBZ4IWubHqwXxV9vG9CC9kq0PSkoM2Pn7Lx7dgyp4vT7ccJ8a3IwHbe+5KJRnpw==
|
||||
|
||||
"@react-native/metro-babel-transformer@0.74.81":
|
||||
version "0.74.81"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/metro-babel-transformer/-/metro-babel-transformer-0.74.81.tgz#f724eab91e6de82f8d098e6de57f25bb7501d2d6"
|
||||
@@ -3247,16 +3247,6 @@
|
||||
hermes-parser "0.19.1"
|
||||
nullthrows "^1.1.1"
|
||||
|
||||
"@react-native/metro-babel-transformer@0.74.83":
|
||||
version "0.74.83"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/metro-babel-transformer/-/metro-babel-transformer-0.74.83.tgz#ba87c3cf041f4c0d2b991231af1a6b4a216e9b5d"
|
||||
integrity sha512-hGdx5N8diu8y+GW/ED39vTZa9Jx1di2ZZ0aapbhH4egN1agIAusj5jXTccfNBwwWF93aJ5oVbRzfteZgjbutKg==
|
||||
dependencies:
|
||||
"@babel/core" "^7.20.0"
|
||||
"@react-native/babel-preset" "0.74.83"
|
||||
hermes-parser "0.19.1"
|
||||
nullthrows "^1.1.1"
|
||||
|
||||
"@react-native/metro-babel-transformer@0.74.84":
|
||||
version "0.74.84"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/metro-babel-transformer/-/metro-babel-transformer-0.74.84.tgz#6c2c1632bdf557f176c9d489fbb676522ffb222a"
|
||||
@@ -3267,6 +3257,16 @@
|
||||
hermes-parser "0.19.1"
|
||||
nullthrows "^1.1.1"
|
||||
|
||||
"@react-native/metro-babel-transformer@0.74.87":
|
||||
version "0.74.87"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/metro-babel-transformer/-/metro-babel-transformer-0.74.87.tgz#f60958f5e7eb39008a2c01dc5248ab60240bdc01"
|
||||
integrity sha512-UsJCO24sNax2NSPBmV1zLEVVNkS88kcgAiYrZHtYSwSjpl4WZ656tIeedBfiySdJ94Hr3kQmBYLipV5zk0NI1A==
|
||||
dependencies:
|
||||
"@babel/core" "^7.20.0"
|
||||
"@react-native/babel-preset" "0.74.87"
|
||||
hermes-parser "0.19.1"
|
||||
nullthrows "^1.1.1"
|
||||
|
||||
"@react-native/metro-config@0.74.81":
|
||||
version "0.74.81"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/metro-config/-/metro-config-0.74.81.tgz#3ed605c0bb51081905171af3e0326abd3adc0b27"
|
||||
@@ -3277,29 +3277,21 @@
|
||||
metro-config "^0.80.3"
|
||||
metro-runtime "^0.80.3"
|
||||
|
||||
"@react-native/normalize-colors@0.74.83":
|
||||
version "0.74.83"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/normalize-colors/-/normalize-colors-0.74.83.tgz#86ef925bacf219d74df115bcfb615f62d8142e85"
|
||||
integrity sha512-jhCY95gRDE44qYawWVvhTjTplW1g+JtKTKM3f8xYT1dJtJ8QWv+gqEtKcfmOHfDkSDaMKG0AGBaDTSK8GXLH8Q==
|
||||
|
||||
"@react-native/normalize-colors@0.74.84":
|
||||
version "0.74.84"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/normalize-colors/-/normalize-colors-0.74.84.tgz#4764d59775c17a6ed193509cb01ae2f42dd5c045"
|
||||
integrity sha512-Y5W6x8cC5RuakUcTVUFNAIhUZ/tYpuqHZlRBoAuakrTwVuoNHXfQki8lj1KsYU7rW6e3VWgdEx33AfOQpdNp6A==
|
||||
|
||||
"@react-native/normalize-colors@0.74.87":
|
||||
version "0.74.87"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/normalize-colors/-/normalize-colors-0.74.87.tgz#a814169d0ce4ce13ffebcda0a3a5a3f780ccd772"
|
||||
integrity sha512-Xh7Nyk/MPefkb0Itl5Z+3oOobeG9lfLb7ZOY2DKpFnoCE1TzBmib9vMNdFaLdSxLIP+Ec6icgKtdzYg8QUPYzA==
|
||||
|
||||
"@react-native/typescript-config@0.74.81":
|
||||
version "0.74.81"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/typescript-config/-/typescript-config-0.74.81.tgz#a249b6a21b577d572a0a70056d7c48a55fd6662f"
|
||||
integrity sha512-jk4LJUKdRYmXxxpebRSW8mK9xJPW90W6BE1IE9LdFi0exdsnVv5gXM9QylG+9kDVZj3bltMuMVdijWnU7SRNbg==
|
||||
|
||||
"@react-native/virtualized-lists@0.74.83":
|
||||
version "0.74.83"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/virtualized-lists/-/virtualized-lists-0.74.83.tgz#5595d6aefd9679d1295c56a1d1653b1fb261bd62"
|
||||
integrity sha512-rmaLeE34rj7py4FxTod7iMTC7BAsm+HrGA8WxYmEJeyTV7WSaxAkosKoYBz8038mOiwnG9VwA/7FrB6bEQvn1A==
|
||||
dependencies:
|
||||
invariant "^2.2.4"
|
||||
nullthrows "^1.1.1"
|
||||
|
||||
"@react-native/virtualized-lists@0.74.84":
|
||||
version "0.74.84"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/virtualized-lists/-/virtualized-lists-0.74.84.tgz#cf32fffc93072942532c9c81bd7e4c01a2949626"
|
||||
@@ -3308,6 +3300,14 @@
|
||||
invariant "^2.2.4"
|
||||
nullthrows "^1.1.1"
|
||||
|
||||
"@react-native/virtualized-lists@0.74.87":
|
||||
version "0.74.87"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/virtualized-lists/-/virtualized-lists-0.74.87.tgz#31bc44d62617df7d893df22c4c57094f576677a0"
|
||||
integrity sha512-lsGxoFMb0lyK/MiplNKJpD+A1EoEUumkLrCjH4Ht+ZlG8S0BfCxmskLZ6qXn3BiDSkLjfjI/qyZ3pnxNBvkXpQ==
|
||||
dependencies:
|
||||
invariant "^2.2.4"
|
||||
nullthrows "^1.1.1"
|
||||
|
||||
"@rnx-kit/chromium-edge-launcher@^1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@rnx-kit/chromium-edge-launcher/-/chromium-edge-launcher-1.0.0.tgz#c0df8ea00a902c7a417cd9655aab06de398b939c"
|
||||
@@ -5489,7 +5489,7 @@ globalthis@^1.0.3:
|
||||
dependencies:
|
||||
define-properties "^1.1.3"
|
||||
|
||||
globby@^11.0.4, globby@^11.1.0:
|
||||
globby@^11.1.0:
|
||||
version "11.1.0"
|
||||
resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b"
|
||||
integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==
|
||||
@@ -7627,43 +7627,29 @@ react-is@^17.0.1:
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
|
||||
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==
|
||||
|
||||
react-native-reanimated@3.9.0:
|
||||
version "3.9.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-3.9.0.tgz#e5c5f303415a2aadd7db786005159b26c21ae495"
|
||||
integrity sha512-OMZV2BVmxZvm8UhlXBrESO0y/ODGTRpQRQUO7U9QXysOF9RaR8FbO6KS0x99MH19zfFTV8cLGN/vYW1dFia9Rw==
|
||||
dependencies:
|
||||
"@babel/plugin-transform-arrow-functions" "^7.0.0-0"
|
||||
"@babel/plugin-transform-nullish-coalescing-operator" "^7.0.0-0"
|
||||
"@babel/plugin-transform-optional-chaining" "^7.0.0-0"
|
||||
"@babel/plugin-transform-shorthand-properties" "^7.0.0-0"
|
||||
"@babel/plugin-transform-template-literals" "^7.0.0-0"
|
||||
"@babel/preset-typescript" "^7.16.7"
|
||||
convert-source-map "^2.0.0"
|
||||
invariant "^2.2.4"
|
||||
|
||||
"react-native-svg@link:../..":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
react-native-windows@0.74.9:
|
||||
version "0.74.9"
|
||||
resolved "https://registry.yarnpkg.com/react-native-windows/-/react-native-windows-0.74.9.tgz#2abcc8eb99a4ce0ce80dfe2dea8ce249b8e21469"
|
||||
integrity sha512-0WEwKhfi+WyjVswT6pRewfw2V694KYfTMIDSITDEu3Y3A9m1o0YyisnURxc4KRndRc0FQuw1iUf49uVK7BnXAw==
|
||||
react-native-windows@0.74.24:
|
||||
version "0.74.24"
|
||||
resolved "https://registry.yarnpkg.com/react-native-windows/-/react-native-windows-0.74.24.tgz#1dfbf992d377663da0578adf7507934c363c27b2"
|
||||
integrity sha512-Vdpmpr9JDHdZUQFfr7rPeYNkcAaP0BRR1gLd4hz80pShIOuxuVUKmccN3mtr1S4y8VF+hEnhXdMHRjk64OE4GQ==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.0.0"
|
||||
"@jest/create-cache-key-function" "^29.6.3"
|
||||
"@react-native-community/cli" "13.6.6"
|
||||
"@react-native-community/cli-platform-android" "13.6.6"
|
||||
"@react-native-community/cli-platform-ios" "13.6.6"
|
||||
"@react-native-windows/cli" "0.74.0"
|
||||
"@react-native-community/cli" "13.6.9"
|
||||
"@react-native-community/cli-platform-android" "13.6.9"
|
||||
"@react-native-community/cli-platform-ios" "13.6.9"
|
||||
"@react-native-windows/cli" "0.74.8"
|
||||
"@react-native/assets" "1.0.0"
|
||||
"@react-native/assets-registry" "0.74.83"
|
||||
"@react-native/codegen" "0.74.83"
|
||||
"@react-native/community-cli-plugin" "0.74.83"
|
||||
"@react-native/gradle-plugin" "0.74.83"
|
||||
"@react-native/js-polyfills" "0.74.83"
|
||||
"@react-native/normalize-colors" "0.74.83"
|
||||
"@react-native/virtualized-lists" "0.74.83"
|
||||
"@react-native/assets-registry" "0.74.87"
|
||||
"@react-native/codegen" "0.74.87"
|
||||
"@react-native/community-cli-plugin" "0.74.87"
|
||||
"@react-native/gradle-plugin" "0.74.87"
|
||||
"@react-native/js-polyfills" "0.74.87"
|
||||
"@react-native/normalize-colors" "0.74.87"
|
||||
"@react-native/virtualized-lists" "0.74.87"
|
||||
abort-controller "^3.0.0"
|
||||
anser "^1.4.9"
|
||||
ansi-regex "^5.0.0"
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
module.exports = {
|
||||
presets: ['module:@react-native/babel-preset'],
|
||||
plugins: [
|
||||
'@babel/plugin-proposal-export-namespace-from',
|
||||
'module:react-native-dotenv',
|
||||
'react-native-reanimated/plugin',
|
||||
],
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
import { AppRegistry } from 'react-native';
|
||||
import App from '../common';
|
||||
import App from '../common/noNavigationApp';
|
||||
import { name as appName } from './app.json';
|
||||
|
||||
AppRegistry.registerComponent(appName, () => App);
|
||||
|
||||
@@ -14,14 +14,11 @@
|
||||
"react": "18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-native": "0.74.2",
|
||||
"react-native-reanimated": "3.15.4",
|
||||
"react-native-svg": "link:../../",
|
||||
"react-native-view-shot": "4.0.0-alpha.2",
|
||||
"react-native-windows": "0.74.9"
|
||||
"react-native-windows": "0.74.24"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.0",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
||||
"@babel/preset-env": "^7.20.0",
|
||||
"@babel/runtime": "^7.20.0",
|
||||
"@react-native/babel-preset": "0.74.84",
|
||||
@@ -39,7 +36,6 @@
|
||||
"patch-package": "^8.0.0",
|
||||
"postinstall-postinstall": "^2.1.0",
|
||||
"prettier": "2.8.8",
|
||||
"react-native-dotenv": "^3.4.11",
|
||||
"react-test-renderer": "18.2.0",
|
||||
"typescript": "5.0.4"
|
||||
},
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
diff --git a/node_modules/react-native-view-shot/ios/RNViewShot.m b/node_modules/react-native-view-shot/ios/RNViewShot.m
|
||||
index bd55b92..6a20e9d 100644
|
||||
--- a/node_modules/react-native-view-shot/ios/RNViewShot.m
|
||||
+++ b/node_modules/react-native-view-shot/ios/RNViewShot.m
|
||||
@@ -106,7 +106,7 @@ - (dispatch_queue_t)methodQueue
|
||||
scrollView.frame = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height);
|
||||
}
|
||||
|
||||
- UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:size];
|
||||
+ UIGraphicsBeginImageContextWithOptions(size, NO, 0);
|
||||
|
||||
if (renderInContext) {
|
||||
// this comes with some trade-offs such as inability to capture gradients or scrollview's content in full but it works for large views
|
||||
@@ -117,8 +117,8 @@ - (dispatch_queue_t)methodQueue
|
||||
// this doesn't work for large views and reports incorrect success even though the image is blank
|
||||
success = [rendered drawViewHierarchyInRect:(CGRect){CGPointZero, size} afterScreenUpdates:YES];
|
||||
}
|
||||
-
|
||||
- UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) {}];
|
||||
+ UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
+ UIGraphicsEndImageContext();
|
||||
|
||||
if (snapshotContentContainer) {
|
||||
// Restore scroll & frame
|
||||
@@ -152,11 +152,11 @@ - (dispatch_queue_t)methodQueue
|
||||
NSString *res = nil;
|
||||
if ([result isEqualToString:@"base64"]) {
|
||||
// Return as a base64 raw string
|
||||
- res = [data base64EncodedStringWithOptions: 0];
|
||||
+ res = [data base64EncodedStringWithOptions: NSDataBase64EncodingEndLineWithLineFeed];
|
||||
}
|
||||
else if ([result isEqualToString:@"data-uri"]) {
|
||||
// Return as a base64 data uri string
|
||||
- NSString *base64 = [data base64EncodedStringWithOptions: 0];
|
||||
+ NSString *base64 = [data base64EncodedStringWithOptions: NSDataBase64EncodingEndLineWithLineFeed];
|
||||
NSString *imageFormat = ([format isEqualToString:@"jpg"]) ? @"jpeg" : format;
|
||||
res = [NSString stringWithFormat:@"data:image/%@;base64,%@", imageFormat, base64];
|
||||
}
|
||||
diff --git a/node_modules/react-native-view-shot/src/specs/NativeRNViewShot.ts b/node_modules/react-native-view-shot/src/specs/NativeRNViewShot.ts
|
||||
index a6f4c00..1e9e6ce 100644
|
||||
--- a/node_modules/react-native-view-shot/src/specs/NativeRNViewShot.ts
|
||||
+++ b/node_modules/react-native-view-shot/src/specs/NativeRNViewShot.ts
|
||||
@@ -2,7 +2,7 @@ import type { TurboModule } from 'react-native';
|
||||
import { TurboModuleRegistry } from 'react-native';
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
- releaseCapture: () => string;
|
||||
+ releaseCapture: (uri: string) => void;
|
||||
captureRef: (tag: number, options: Object) => Promise<string>
|
||||
captureScreen: (options: Object) => Promise<string>;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/node_modules/react-native-windows/Microsoft.ReactNative/Modules/NativeUIManager.cpp b/node_modules/react-native-windows/Microsoft.ReactNative/Modules/NativeUIManager.cpp
|
||||
index 97c1691..8136008 100644
|
||||
index fb25176..eb1201a 100644
|
||||
--- a/node_modules/react-native-windows/Microsoft.ReactNative/Modules/NativeUIManager.cpp
|
||||
+++ b/node_modules/react-native-windows/Microsoft.ReactNative/Modules/NativeUIManager.cpp
|
||||
@@ -309,16 +309,10 @@ static YGValue YGValueOrDefault(
|
||||
@@ -4,9 +4,9 @@
|
||||
"native,Version=v0.0": {
|
||||
"Microsoft.JavaScript.Hermes": {
|
||||
"type": "Direct",
|
||||
"requested": "[0.1.21, )",
|
||||
"resolved": "0.1.21",
|
||||
"contentHash": "5njCh+3eXTLOv7+8nOnp6nJ5C0r6it5ze54c0nuWleeDptuK8t3dEDB79XTU4D5DKNvAPlqJpgXRDOak5nYIug=="
|
||||
"requested": "[0.1.23, )",
|
||||
"resolved": "0.1.23",
|
||||
"contentHash": "cA9t1GjY4Yo0JD1AfA//e1lOwk48hLANfuX6GXrikmEBNZVr2TIX5ONJt5tqCnpZyLz6xGiPDgTfFNKbSfb21g=="
|
||||
},
|
||||
"Microsoft.UI.Xaml": {
|
||||
"type": "Direct",
|
||||
@@ -25,18 +25,130 @@
|
||||
},
|
||||
"boost": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.76.0",
|
||||
"contentHash": "p+w3YvNdXL8Cu9Fzrmexssu0tZbWxuf6ywsQqHjDlKFE5ojXHof1HIyMC3zDLfLnh80dIeFcEUAuR2Asg/XHRA=="
|
||||
"resolved": "1.83.0",
|
||||
"contentHash": "cy53VNMzysEMvhBixDe8ujPk67Fcj3v6FPHQnH91NYJNLHpc6jxa2xq9ruCaaJjE4M3YrGSHDi4uUSTGBWw6EQ=="
|
||||
},
|
||||
"Microsoft.Net.Native.Compiler": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.2.9-rel-29512-01",
|
||||
"contentHash": "xjK9G8qoKaN1kUvOp/PuqYYxk6uGTZFwHUsHLrLXLyFVxnoHq/woqWyVb/n22uNWYtAoioeXlm6hZ0M8/f7eXw==",
|
||||
"dependencies": {
|
||||
"runtime.win10-arm.Microsoft.Net.Native.Compiler": "2.2.9-rel-29512-01",
|
||||
"runtime.win10-arm64.Microsoft.Net.Native.Compiler": "2.2.9-rel-29512-01",
|
||||
"runtime.win10-x64.Microsoft.Net.Native.Compiler": "2.2.9-rel-29512-01",
|
||||
"runtime.win10-x86.Microsoft.Net.Native.Compiler": "2.2.9-rel-29512-01"
|
||||
}
|
||||
},
|
||||
"Microsoft.Net.UWPCoreRuntimeSdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.2.11",
|
||||
"contentHash": "B1p3txWKwmO+Csf126X9y1gVQej/zOfUUAOE90iOmEHFMieIle/XfKrrAtlHIIo5snylwB8LgDsRn0kWlDsHhg==",
|
||||
"dependencies": {
|
||||
"runtime.win10-arm.Microsoft.Net.UWPCoreRuntimeSdk": "2.2.11",
|
||||
"runtime.win10-x64.Microsoft.Net.UWPCoreRuntimeSdk": "2.2.11",
|
||||
"runtime.win10-x86.Microsoft.Net.UWPCoreRuntimeSdk": "2.2.11"
|
||||
}
|
||||
},
|
||||
"Microsoft.NETCore.Platforms": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.1.0",
|
||||
"contentHash": "ok+RPAtESz/9MUXeIEz6Lv5XAGQsaNmEYXMsgVALj4D7kqC8gveKWXWXbufLySR2fWrwZf8smyN5RmHu0e4BHA=="
|
||||
},
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "YeOCD+m2tfqkYzQ2hAKZ52cTrHWU0HRS4/2vf3SeZ+KHWq+unmskH+TrRktaIj/pChwPUMwLdCTU5/+4WeQcWQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "2.1.0",
|
||||
"Microsoft.Net.Native.Compiler": "2.2.9-rel-29512-01",
|
||||
"Microsoft.Net.UWPCoreRuntimeSdk": "2.2.11",
|
||||
"NETStandard.Library": "2.0.3"
|
||||
}
|
||||
},
|
||||
"Microsoft.Web.WebView2": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1264.42",
|
||||
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
|
||||
},
|
||||
"NETStandard.Library": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.0.3",
|
||||
"contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.1.0"
|
||||
}
|
||||
},
|
||||
"runtime.win10-arm.Microsoft.Net.Native.Compiler": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.2.9-rel-29512-01",
|
||||
"contentHash": "p+v2gthEgj5Tgm4Cl05mfV0w6Q7IFMdOQXZQsiZRg4wBkKSdVoW9lgaxF8bVffBJYes2Vm8ovKpxwTrmEXRzFg==",
|
||||
"dependencies": {
|
||||
"runtime.win10-arm.Microsoft.Net.Native.SharedLibrary": "2.2.8-rel-29512-01"
|
||||
}
|
||||
},
|
||||
"runtime.win10-arm.Microsoft.Net.Native.SharedLibrary": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.2.8-rel-29512-01",
|
||||
"contentHash": "GUQ7Ubf9ts1XfNNaDrJUnmpsKfpcyZ+8NeZoDyYlImgT/UukkW1cYaxqbxM8VH+g5iIGXeO7suVv8tkwE862FA=="
|
||||
},
|
||||
"runtime.win10-arm.Microsoft.Net.UWPCoreRuntimeSdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.2.11",
|
||||
"contentHash": "R1RaI4RSc+H9E5Pq9pndWzAv4dxztym4+TAII4VrsReePMGRM8eoJByg47BAPM4Y9mBv7esR0KhYc5J1/hpUIw=="
|
||||
},
|
||||
"runtime.win10-arm64.Microsoft.Net.Native.Compiler": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.2.9-rel-29512-01",
|
||||
"contentHash": "8ex2blgQcIw/MoaJH7hqRJdekTWgMUz5Qb+xmVeGvbB/lWl4BPv6/J9+cmcFxEM+Z7OA8xilFH1kwWFMyvak1A==",
|
||||
"dependencies": {
|
||||
"runtime.win10-arm64.Microsoft.Net.Native.SharedLibrary": "2.2.8-rel-29512-01"
|
||||
}
|
||||
},
|
||||
"runtime.win10-arm64.Microsoft.Net.Native.SharedLibrary": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.2.8-rel-29512-01",
|
||||
"contentHash": "iYqXJq6hpg07RqAqq8RAffVU1308cQ2ta4ZZtfWI8tbVXGuKOU6he52AMgz4JfcP/Yb/khy9Gdxl62MVXcctzg=="
|
||||
},
|
||||
"runtime.win10-x64.Microsoft.Net.Native.Compiler": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.2.9-rel-29512-01",
|
||||
"contentHash": "sgiiODHWt4WZ9mDpZd+XkCdWYCBZukjZPNz3XJdeKeeNcRA4y4OTtd2+STWytXDxWAXUNRjImDF5XP48jNXj8A==",
|
||||
"dependencies": {
|
||||
"runtime.win10-x64.Microsoft.Net.Native.SharedLibrary": "2.2.8-rel-29512-01"
|
||||
}
|
||||
},
|
||||
"runtime.win10-x64.Microsoft.Net.Native.SharedLibrary": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.2.8-rel-29512-01",
|
||||
"contentHash": "JoJavADSFAHk8KQo/bIHT+TTM1gn26X7A3DBltr0ocxcR+6FEnrFa1dLev2tFWmUcndeoyTklndZKwBkSFfEDw=="
|
||||
},
|
||||
"runtime.win10-x64.Microsoft.Net.UWPCoreRuntimeSdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.2.11",
|
||||
"contentHash": "7e8MH4/tzwVV25dUvq+eYgvH31Tyi7kpGNcsqfzfJDYxA6hpGijhfZFFn2QHjORRoTu/BVxGM/9xc/bP4J0vRg=="
|
||||
},
|
||||
"runtime.win10-x86.Microsoft.Net.Native.Compiler": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.2.9-rel-29512-01",
|
||||
"contentHash": "M586UCPkXEXFbbC7dNznyN9/uNSWNjOeWWHrKNhwztaIl5iCaqr9ITDu55hd7tRdsoi/mPthAH470k4Vml/UrA==",
|
||||
"dependencies": {
|
||||
"runtime.win10-x86.Microsoft.Net.Native.SharedLibrary": "2.2.8-rel-29512-01"
|
||||
}
|
||||
},
|
||||
"runtime.win10-x86.Microsoft.Net.Native.SharedLibrary": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.2.8-rel-29512-01",
|
||||
"contentHash": "s+oRLOdFSD8FS/hG2MBLzcdPzvBOzQqydYGLl/E+jaB7ijqYs8Dd3yeK72HgWLmKvp3rtkPhCHeRqYhA54+1YQ=="
|
||||
},
|
||||
"runtime.win10-x86.Microsoft.Net.UWPCoreRuntimeSdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.2.11",
|
||||
"contentHash": "NF8tUTxFfwd8MXiA6ygCVuT7dVgEkaHpuwFnDeP1L2i1SIOxhk5w4HHySjmvbRSYtnjLA9BlOtwjGIJCztOHeg=="
|
||||
},
|
||||
"common": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"boost": "[1.76.0, )"
|
||||
"boost": "[1.83.0, )"
|
||||
}
|
||||
},
|
||||
"fmt": {
|
||||
@@ -46,7 +158,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Fmt": "[1.0.0, )",
|
||||
"boost": "[1.76.0, )"
|
||||
"boost": "[1.83.0, )"
|
||||
}
|
||||
},
|
||||
"microsoft.reactnative": {
|
||||
@@ -54,17 +166,38 @@
|
||||
"dependencies": {
|
||||
"Common": "[1.0.0, )",
|
||||
"Folly": "[1.0.0, )",
|
||||
"Microsoft.JavaScript.Hermes": "[0.1.21, )",
|
||||
"Microsoft.JavaScript.Hermes": "[0.1.23, )",
|
||||
"Microsoft.UI.Xaml": "[2.8.0, )",
|
||||
"ReactCommon": "[1.0.0, )",
|
||||
"boost": "[1.76.0, )"
|
||||
"boost": "[1.83.0, )"
|
||||
}
|
||||
},
|
||||
"microsoft.reactnative.managed": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": "[6.2.9, )",
|
||||
"Microsoft.ReactNative": "[1.0.0, )"
|
||||
}
|
||||
},
|
||||
"reactcommon": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Folly": "[1.0.0, )",
|
||||
"boost": "[1.76.0, )"
|
||||
"boost": "[1.83.0, )"
|
||||
}
|
||||
},
|
||||
"reactnativeasyncstorage": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.ReactNative": "[1.0.0, )",
|
||||
"Microsoft.UI.Xaml": "[2.8.0, )"
|
||||
}
|
||||
},
|
||||
"rnscreens": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.ReactNative": "[1.0.0, )",
|
||||
"Microsoft.UI.Xaml": "[2.8.0, )"
|
||||
}
|
||||
},
|
||||
"rnsvg": {
|
||||
@@ -73,55 +206,182 @@
|
||||
"Microsoft.ReactNative": "[1.0.0, )",
|
||||
"Microsoft.UI.Xaml": "[2.8.0, )"
|
||||
}
|
||||
},
|
||||
"rnviewshot": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": "[6.2.11, )",
|
||||
"Microsoft.ReactNative": "[1.0.0, )",
|
||||
"Microsoft.ReactNative.Managed": "[1.0.0, )"
|
||||
}
|
||||
}
|
||||
},
|
||||
"native,Version=v0.0/win10-arm": {
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "YeOCD+m2tfqkYzQ2hAKZ52cTrHWU0HRS4/2vf3SeZ+KHWq+unmskH+TrRktaIj/pChwPUMwLdCTU5/+4WeQcWQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "2.1.0",
|
||||
"Microsoft.Net.Native.Compiler": "2.2.9-rel-29512-01",
|
||||
"Microsoft.Net.UWPCoreRuntimeSdk": "2.2.11",
|
||||
"NETStandard.Library": "2.0.3",
|
||||
"runtime.win10-arm.Microsoft.NETCore.UniversalWindowsPlatform": "6.2.11"
|
||||
}
|
||||
},
|
||||
"Microsoft.Web.WebView2": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1264.42",
|
||||
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
|
||||
},
|
||||
"runtime.win10-arm.Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "TMXtd4TVwVgENc4tFWZ+rfnJXZfwRmeL9vkkwMjyCK6+dknZaFuiRMnZ9ggPDMZ4qtq4eKXDqhp7GIVzLkmTxQ=="
|
||||
}
|
||||
},
|
||||
"native,Version=v0.0/win10-arm-aot": {
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "YeOCD+m2tfqkYzQ2hAKZ52cTrHWU0HRS4/2vf3SeZ+KHWq+unmskH+TrRktaIj/pChwPUMwLdCTU5/+4WeQcWQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "2.1.0",
|
||||
"Microsoft.Net.Native.Compiler": "2.2.9-rel-29512-01",
|
||||
"Microsoft.Net.UWPCoreRuntimeSdk": "2.2.11",
|
||||
"NETStandard.Library": "2.0.3",
|
||||
"runtime.win10-arm-aot.Microsoft.NETCore.UniversalWindowsPlatform": "6.2.11"
|
||||
}
|
||||
},
|
||||
"Microsoft.Web.WebView2": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1264.42",
|
||||
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
|
||||
},
|
||||
"runtime.win10-arm-aot.Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "Sn/jnBh7ggB1TqoxrsEM2S+JpFM8FOO8lXRfdp9LWbUI1Vgzb+a5wpS1bXki1lJK6cFrVldDjbZv4D4NEfJuyg=="
|
||||
}
|
||||
},
|
||||
"native,Version=v0.0/win10-arm64-aot": {
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "YeOCD+m2tfqkYzQ2hAKZ52cTrHWU0HRS4/2vf3SeZ+KHWq+unmskH+TrRktaIj/pChwPUMwLdCTU5/+4WeQcWQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "2.1.0",
|
||||
"Microsoft.Net.Native.Compiler": "2.2.9-rel-29512-01",
|
||||
"Microsoft.Net.UWPCoreRuntimeSdk": "2.2.11",
|
||||
"NETStandard.Library": "2.0.3",
|
||||
"runtime.win10-arm64-aot.Microsoft.NETCore.UniversalWindowsPlatform": "6.2.11"
|
||||
}
|
||||
},
|
||||
"Microsoft.Web.WebView2": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1264.42",
|
||||
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
|
||||
},
|
||||
"runtime.win10-arm64-aot.Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "07IvykpRbKdON7JjrBxshOKTqkJ39h7b6xc6AE09h8DaoP8CsUkyn+IBRlMGAzfVNnQwaoCKf+EWoSCueBKaqQ=="
|
||||
}
|
||||
},
|
||||
"native,Version=v0.0/win10-x64": {
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "YeOCD+m2tfqkYzQ2hAKZ52cTrHWU0HRS4/2vf3SeZ+KHWq+unmskH+TrRktaIj/pChwPUMwLdCTU5/+4WeQcWQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "2.1.0",
|
||||
"Microsoft.Net.Native.Compiler": "2.2.9-rel-29512-01",
|
||||
"Microsoft.Net.UWPCoreRuntimeSdk": "2.2.11",
|
||||
"NETStandard.Library": "2.0.3",
|
||||
"runtime.win10-x64.Microsoft.NETCore.UniversalWindowsPlatform": "6.2.11"
|
||||
}
|
||||
},
|
||||
"Microsoft.Web.WebView2": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1264.42",
|
||||
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
|
||||
},
|
||||
"runtime.win10-x64.Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "EqfKqHuQsosS4oPFBaKlUFMSV2ZSLh2VoxWnLkPiydVK9jIh31c2Au1csZ5ucQmXOra3vEuZLToOK4XNVLW2wQ=="
|
||||
}
|
||||
},
|
||||
"native,Version=v0.0/win10-x64-aot": {
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "YeOCD+m2tfqkYzQ2hAKZ52cTrHWU0HRS4/2vf3SeZ+KHWq+unmskH+TrRktaIj/pChwPUMwLdCTU5/+4WeQcWQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "2.1.0",
|
||||
"Microsoft.Net.Native.Compiler": "2.2.9-rel-29512-01",
|
||||
"Microsoft.Net.UWPCoreRuntimeSdk": "2.2.11",
|
||||
"NETStandard.Library": "2.0.3",
|
||||
"runtime.win10-x64-aot.Microsoft.NETCore.UniversalWindowsPlatform": "6.2.11"
|
||||
}
|
||||
},
|
||||
"Microsoft.Web.WebView2": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1264.42",
|
||||
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
|
||||
},
|
||||
"runtime.win10-x64-aot.Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "PfST4gE/8rgl0tPMlGYp7BqzFjrhSGMQd+V68P4IMze9V6cnlkyXof4apD9MDzl7MPMPO0wwlkMj89+4+vXP3A=="
|
||||
}
|
||||
},
|
||||
"native,Version=v0.0/win10-x86": {
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "YeOCD+m2tfqkYzQ2hAKZ52cTrHWU0HRS4/2vf3SeZ+KHWq+unmskH+TrRktaIj/pChwPUMwLdCTU5/+4WeQcWQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "2.1.0",
|
||||
"Microsoft.Net.Native.Compiler": "2.2.9-rel-29512-01",
|
||||
"Microsoft.Net.UWPCoreRuntimeSdk": "2.2.11",
|
||||
"NETStandard.Library": "2.0.3",
|
||||
"runtime.win10-x86.Microsoft.NETCore.UniversalWindowsPlatform": "6.2.11"
|
||||
}
|
||||
},
|
||||
"Microsoft.Web.WebView2": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1264.42",
|
||||
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
|
||||
},
|
||||
"runtime.win10-x86.Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "Svwt46NcUEBhH+LNdg+9J+phHiWW3mmfuKrKT1RGI9QCownxaFg0kI5NCT0YhoMcndFT6fLsUA5VLswApg3/HA=="
|
||||
}
|
||||
},
|
||||
"native,Version=v0.0/win10-x86-aot": {
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "YeOCD+m2tfqkYzQ2hAKZ52cTrHWU0HRS4/2vf3SeZ+KHWq+unmskH+TrRktaIj/pChwPUMwLdCTU5/+4WeQcWQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "2.1.0",
|
||||
"Microsoft.Net.Native.Compiler": "2.2.9-rel-29512-01",
|
||||
"Microsoft.Net.UWPCoreRuntimeSdk": "2.2.11",
|
||||
"NETStandard.Library": "2.0.3",
|
||||
"runtime.win10-x86-aot.Microsoft.NETCore.UniversalWindowsPlatform": "6.2.11"
|
||||
}
|
||||
},
|
||||
"Microsoft.Web.WebView2": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.1264.42",
|
||||
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
|
||||
},
|
||||
"runtime.win10-x86-aot.Microsoft.NETCore.UniversalWindowsPlatform": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.2.11",
|
||||
"contentHash": "2Yz+NstJwZlo4+9jfpQ+5fVuowPVIOG/Lp2yABPtfmh4VhbxoKyiAjeRo7bZUMk1RdwZL+LjJ5zg2l2Sh3ZhEA=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@ import extractOpacity from './extractOpacity';
|
||||
import { idPattern } from '../util';
|
||||
import type {
|
||||
ClipProps,
|
||||
ColorProps,
|
||||
extractedProps,
|
||||
FillProps,
|
||||
NumberProp,
|
||||
@@ -53,6 +54,7 @@ export default function extractProps(
|
||||
ResponderProps &
|
||||
StrokeProps &
|
||||
FillProps &
|
||||
ColorProps &
|
||||
ClipProps,
|
||||
ref: object
|
||||
) {
|
||||
@@ -75,6 +77,9 @@ export default function extractProps(
|
||||
extractResponder(extracted, props, ref);
|
||||
extractFill(extracted, props, inherited);
|
||||
extractStroke(extracted, props, inherited);
|
||||
if (props.color) {
|
||||
extracted.color = props.color;
|
||||
}
|
||||
|
||||
if (inherited.length) {
|
||||
extracted.propList = inherited;
|
||||
|
||||
@@ -8,11 +8,6 @@
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
BrushView::BrushView(
|
||||
const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
#endif
|
||||
|
||||
void BrushView::SaveDefinition() {
|
||||
if (auto const &root{SvgRoot()}) {
|
||||
CreateBrush();
|
||||
|
||||
@@ -8,10 +8,6 @@ struct BrushView : BrushViewT<BrushView, RNSVG::implementation::GroupView> {
|
||||
public:
|
||||
BrushView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
BrushView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void SaveDefinition();
|
||||
|
||||
@@ -32,3 +28,4 @@ struct BrushView : BrushViewT<BrushView, RNSVG::implementation::GroupView> {
|
||||
namespace winrt::RNSVG::factory_implementation {
|
||||
struct BrushView : BrushViewT<BrushView, implementation::BrushView> {};
|
||||
} // namespace winrt::RNSVG::factory_implementation
|
||||
|
||||
|
||||
@@ -12,47 +12,6 @@ using namespace Microsoft::ReactNative;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
CircleProps::CircleProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void CircleProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
CircleView::CircleView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void CircleView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGCircle", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::CircleProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::CircleView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void CircleView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto circleProps = props.try_as<CircleProps>();
|
||||
if (circleProps) {
|
||||
m_props = circleProps;
|
||||
|
||||
m_cx = m_props->cx;
|
||||
m_cy = m_props->cy;
|
||||
m_r = m_props->r;
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
}
|
||||
#else
|
||||
void CircleView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
|
||||
@@ -71,7 +30,6 @@ void CircleView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate
|
||||
|
||||
__super::UpdateProperties(reader, forceUpdate, invalidate);
|
||||
}
|
||||
#endif
|
||||
|
||||
void CircleView::CreateGeometry(RNSVG::D2DDeviceContext const &context) {
|
||||
auto const root{SvgRoot()};
|
||||
|
||||
@@ -1,53 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "CircleProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "CircleView.g.h"
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(CircleProps)
|
||||
struct CircleProps : CirclePropsT<CircleProps, SvgRenderableCommonProps> {
|
||||
CircleProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(r)
|
||||
RNSVG::SVGLength r{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(cx)
|
||||
RNSVG::SVGLength cx{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(cy)
|
||||
RNSVG::SVGLength cy{0, winrt::RNSVG::LengthType::Unknown};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct CircleView : CircleViewT<CircleView, RNSVG::implementation::RenderableView> {
|
||||
public:
|
||||
CircleView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
CircleView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#else
|
||||
// IRenderablePaper
|
||||
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void CreateGeometry(RNSVG::D2DDeviceContext const &context);
|
||||
@@ -57,11 +20,9 @@ struct CircleView : CircleViewT<CircleView, RNSVG::implementation::RenderableVie
|
||||
RNSVG::SVGLength m_cx{};
|
||||
RNSVG::SVGLength m_cy{};
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<CircleProps> m_props;
|
||||
#endif
|
||||
};
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
namespace winrt::RNSVG::factory_implementation {
|
||||
struct CircleView : CircleViewT<CircleView, implementation::CircleView> {};
|
||||
} // namespace winrt::RNSVG::factory_implementation
|
||||
|
||||
@@ -7,28 +7,4 @@
|
||||
using namespace winrt;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
#ifdef USE_FABRIC
|
||||
ClipPathProps::ClipPathProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void ClipPathProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
ClipPathView::ClipPathView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void ClipPathView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGClipPath", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::ClipPathProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::ClipPathView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
#endif
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
@@ -1,36 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "ClipPathProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "ClipPathView.g.h"
|
||||
#include "GroupView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(ClipPathProps)
|
||||
struct ClipPathProps : ClipPathPropsT<ClipPathProps, SvgGroupCommonProps> {
|
||||
ClipPathProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
REACT_SVG_GROUP_COMMON_PROPS;
|
||||
};
|
||||
#endif
|
||||
struct ClipPathView : ClipPathViewT<ClipPathView, RNSVG::implementation::GroupView> {
|
||||
public:
|
||||
ClipPathView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
ClipPathView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void Draw(RNSVG::D2DDeviceContext const & /*deviceContext*/, Windows::Foundation::Size const & /*size*/){};
|
||||
};
|
||||
|
||||
@@ -131,11 +131,7 @@ struct D2DHelpers {
|
||||
}
|
||||
|
||||
static DWRITE_FONT_WEIGHT FontWeightFrom(
|
||||
#ifdef USE_FABRIC
|
||||
winrt::Microsoft::ReactNative::ComponentView const &parent,
|
||||
#else
|
||||
xaml::FrameworkElement const &parent,
|
||||
#endif
|
||||
hstring const &weight) {
|
||||
if (weight == L"normal") {
|
||||
return DWRITE_FONT_WEIGHT_NORMAL;
|
||||
|
||||
@@ -8,30 +8,5 @@ using namespace winrt;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
DefsProps::DefsProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void DefsProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
DefsView::DefsView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void DefsView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGDefs", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::DefsProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::DefsView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
void DefsView::Draw(RNSVG::D2DDeviceContext const& /*deviceContext*/, Size const & /*size*/) {}
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
@@ -1,37 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "DefsProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "DefsView.g.h"
|
||||
#include "GroupView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(DefsProps)
|
||||
struct DefsProps : DefsPropsT<DefsProps, SvgGroupCommonProps> {
|
||||
DefsProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct DefsView : DefsViewT<DefsView, RNSVG::implementation::GroupView> {
|
||||
public:
|
||||
DefsView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
DefsView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void Draw(RNSVG::D2DDeviceContext const &deviceContext, Windows::Foundation::Size const &size);
|
||||
};
|
||||
|
||||
@@ -11,48 +11,7 @@ using namespace winrt;
|
||||
using namespace Microsoft::ReactNative;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
#ifdef USE_FABRIC
|
||||
EllipseProps::EllipseProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void EllipseProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
EllipseView::EllipseView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void EllipseView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGEllipse", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::EllipseProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::EllipseView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void EllipseView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto ellipseProps = props.try_as<EllipseProps>();
|
||||
if (ellipseProps) {
|
||||
m_props = ellipseProps;
|
||||
|
||||
m_cx = m_props->cx;
|
||||
m_cy = m_props->cy;
|
||||
m_rx = m_props->rx;
|
||||
m_ry = m_props->ry;
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
}
|
||||
#else
|
||||
void EllipseView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
|
||||
@@ -73,7 +32,6 @@ void EllipseView::UpdateProperties(IJSValueReader const &reader, bool forceUpdat
|
||||
|
||||
__super::UpdateProperties(reader, forceUpdate, invalidate);
|
||||
}
|
||||
#endif
|
||||
|
||||
void EllipseView::CreateGeometry(RNSVG::D2DDeviceContext const &context) {
|
||||
auto const root{SvgRoot()};
|
||||
|
||||
@@ -1,55 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "EllipseProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "EllipseView.g.h"
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(EllipseProps)
|
||||
struct EllipseProps : EllipsePropsT<EllipseProps, SvgRenderableCommonProps> {
|
||||
EllipseProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(cx)
|
||||
RNSVG::SVGLength cx{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(cy)
|
||||
RNSVG::SVGLength cy{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(rx)
|
||||
RNSVG::SVGLength rx{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(ry)
|
||||
RNSVG::SVGLength ry{0, winrt::RNSVG::LengthType::Unknown};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct EllipseView : EllipseViewT<EllipseView, RNSVG::implementation::RenderableView> {
|
||||
public:
|
||||
EllipseView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
EllipseView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#else
|
||||
// IRenderablePaper
|
||||
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void CreateGeometry(RNSVG::D2DDeviceContext const &context);
|
||||
@@ -59,12 +20,9 @@ struct EllipseView : EllipseViewT<EllipseView, RNSVG::implementation::Renderable
|
||||
RNSVG::SVGLength m_cy{};
|
||||
RNSVG::SVGLength m_rx{};
|
||||
RNSVG::SVGLength m_ry{};
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<EllipseProps> m_props;
|
||||
#endif
|
||||
};
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
namespace winrt::RNSVG::factory_implementation {
|
||||
struct EllipseView : EllipseViewT<EllipseView, implementation::EllipseView> {};
|
||||
} // namespace winrt::RNSVG::factory_implementation
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
import "Views.idl";
|
||||
|
||||
namespace RNSVG
|
||||
{
|
||||
[experimental]
|
||||
interface IRenderableFabric
|
||||
{
|
||||
Microsoft.ReactNative.ComponentView SvgParent { get; };
|
||||
|
||||
void UpdateProperties(Microsoft.ReactNative.IComponentProps props, Microsoft.ReactNative.IComponentProps oldProps, Boolean forceUpdate, Boolean invalidate);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass SvgView : Microsoft.ReactNative.Composition.ViewComponentView,
|
||||
Microsoft.ReactNative.Composition.Experimental.IInternalCreateVisual, IRenderable, IRenderableFabric, ISvgView
|
||||
{
|
||||
SvgView(Microsoft.ReactNative.Composition.CreateCompositionComponentViewArgs args);
|
||||
|
||||
GroupView Group;
|
||||
Microsoft.ReactNative.Color CurrentColor{ get; };
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass RenderableView : Microsoft.ReactNative.ComponentView, IRenderable, IRenderableFabric, IRenderableView
|
||||
{
|
||||
RenderableView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
SvgView SvgRoot{ get; };
|
||||
Microsoft.ReactNative.Color Fill{ get; };
|
||||
Microsoft.ReactNative.Color Stroke{ get; };
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass RectView : RenderableView
|
||||
{
|
||||
RectView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass CircleView : RenderableView
|
||||
{
|
||||
CircleView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass EllipseView : RenderableView
|
||||
{
|
||||
EllipseView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass LineView : RenderableView
|
||||
{
|
||||
LineView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass PathView : RenderableView
|
||||
{
|
||||
PathView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass UseView : RenderableView
|
||||
{
|
||||
UseView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass ImageView : RenderableView
|
||||
{
|
||||
ImageView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass GroupView : RenderableView, IGroupView
|
||||
{
|
||||
GroupView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass TextView : GroupView, ITextView
|
||||
{
|
||||
TextView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass TSpanView : TextView, ITSpanView
|
||||
{
|
||||
TSpanView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass DefsView : GroupView
|
||||
{
|
||||
DefsView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass SymbolView : GroupView, ISymbolView
|
||||
{
|
||||
SymbolView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass ClipPathView : GroupView
|
||||
{
|
||||
ClipPathView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass MarkerView : GroupView
|
||||
{
|
||||
MarkerView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass MaskView : GroupView
|
||||
{
|
||||
MaskView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass BrushView : GroupView, IBrushView
|
||||
{
|
||||
BrushView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass LinearGradientView : BrushView
|
||||
{
|
||||
LinearGradientView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass RadialGradientView : BrushView
|
||||
{
|
||||
RadialGradientView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass PatternView : BrushView
|
||||
{
|
||||
PatternView(Microsoft.ReactNative.CreateComponentViewArgs args);
|
||||
};
|
||||
}
|
||||
53
windows/RNSVG/Fabric/CircleView.cpp
Normal file
53
windows/RNSVG/Fabric/CircleView.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
#include "pch.h"
|
||||
#include "CircleView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
REACT_STRUCT(CircleProps)
|
||||
struct CircleProps : public winrt::implements<CircleProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
CircleProps(const winrt::Microsoft::ReactNative::ViewProps &props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) REACT_SVG_RENDERABLE_COMMON_PROPS_INIT
|
||||
{
|
||||
REACT_BEGIN_SVG_RENDERABLE_COMMON_PROPS_CLONE(CircleProps)
|
||||
r = cloneFromProps->r;
|
||||
cx = cloneFromProps->cx;
|
||||
cy = cloneFromProps->cy;
|
||||
REACT_END_SVG_RENDERABLE_COMMON_PROPS_CLONE
|
||||
}
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(r)
|
||||
D2D1_SVG_LENGTH r{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
REACT_FIELD(cx)
|
||||
D2D1_SVG_LENGTH cx{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
REACT_FIELD(cy)
|
||||
D2D1_SVG_LENGTH cy{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
};
|
||||
|
||||
struct CircleView : winrt::implements<CircleView, winrt::Windows::Foundation::IInspectable, RenderableView> {
|
||||
public:
|
||||
CircleView() = default;
|
||||
|
||||
const wchar_t *GetSvgElementName() noexcept override {
|
||||
return L"circle";
|
||||
}
|
||||
void OnRender(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement &element) noexcept override {
|
||||
auto props = winrt::get_self<CircleProps>(m_props);
|
||||
|
||||
SetCommonSvgProps(svgView, document, element, *props);
|
||||
|
||||
element.SetAttributeValue(SvgStrings::cxAttributeName, props->cx);
|
||||
element.SetAttributeValue(SvgStrings::cyAttributeName, props->cy);
|
||||
element.SetAttributeValue(SvgStrings::rAttributeName, props->r);
|
||||
}
|
||||
};
|
||||
|
||||
void RegisterCircleComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
RegisterRenderableComponent<winrt::RNSVG::implementation::CircleProps, CircleView>(L"RNSVGCircle", builder);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
9
windows/RNSVG/Fabric/CircleView.h
Normal file
9
windows/RNSVG/Fabric/CircleView.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
void RegisterCircleComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
38
windows/RNSVG/Fabric/ClipPathView.cpp
Normal file
38
windows/RNSVG/Fabric/ClipPathView.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "pch.h"
|
||||
#include "ClipPathView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
REACT_STRUCT(ClipPathProps)
|
||||
struct ClipPathProps : winrt::implements<ClipPathProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
ClipPathProps(const winrt::Microsoft::ReactNative::ViewProps &props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) REACT_SVG_RENDERABLE_COMMON_PROPS_INIT {
|
||||
REACT_BEGIN_SVG_RENDERABLE_COMMON_PROPS_CLONE(ClipPathProps)
|
||||
REACT_END_SVG_RENDERABLE_COMMON_PROPS_CLONE
|
||||
}
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
};
|
||||
|
||||
struct ClipPathView : winrt::implements<ClipPathView, winrt::Windows::Foundation::IInspectable, RenderableView> {
|
||||
public:
|
||||
ClipPathView() = default;
|
||||
|
||||
void OnRender(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement &element) noexcept override {
|
||||
auto props = winrt::get_self<ClipPathProps>(m_props);
|
||||
SetCommonSvgProps(svgView, document, element, *props);
|
||||
}
|
||||
|
||||
const wchar_t *GetSvgElementName() noexcept override {
|
||||
return L"clipPath";
|
||||
}
|
||||
};
|
||||
|
||||
void RegisterClipPathComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
RegisterRenderableComponent<winrt::RNSVG::implementation::ClipPathProps, ClipPathView>(L"RNSVGClipPath", builder);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
10
windows/RNSVG/Fabric/ClipPathView.h
Normal file
10
windows/RNSVG/Fabric/ClipPathView.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "GroupView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
void RegisterClipPathComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
18
windows/RNSVG/Fabric/D2DHelpers.h
Normal file
18
windows/RNSVG/Fabric/D2DHelpers.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
namespace winrt::RNSVG {
|
||||
struct D2DHelpers {
|
||||
public:
|
||||
static D2D1::ColorF AsD2DColor(winrt::Windows::UI::Color const &color) {
|
||||
return {
|
||||
color.R / 255.0f,
|
||||
color.G / 255.0f,
|
||||
color.B / 255.0f,
|
||||
color.A / 255.0f};
|
||||
}
|
||||
|
||||
static D2D1::Matrix3x2F AsD2DTransform(winrt::Windows::Foundation::Numerics::float3x2 const &transform) {
|
||||
return D2D1::Matrix3x2F(transform.m11, transform.m12, transform.m21, transform.m22, transform.m31, transform.m32);
|
||||
}
|
||||
};
|
||||
} // namespace winrt::RNSVG
|
||||
41
windows/RNSVG/Fabric/DefsView.cpp
Normal file
41
windows/RNSVG/Fabric/DefsView.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "pch.h"
|
||||
#include "DefsView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
REACT_STRUCT(DefsProps)
|
||||
struct DefsProps : winrt::implements<DefsProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
DefsProps(const winrt::Microsoft::ReactNative::ViewProps &props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) REACT_SVG_RENDERABLE_COMMON_PROPS_INIT
|
||||
{
|
||||
REACT_BEGIN_SVG_RENDERABLE_COMMON_PROPS_CLONE(DefsProps)
|
||||
REACT_END_SVG_RENDERABLE_COMMON_PROPS_CLONE
|
||||
}
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
};
|
||||
|
||||
struct DefsView : winrt::implements<DefsView, winrt::Windows::Foundation::IInspectable, RenderableView> {
|
||||
public:
|
||||
DefsView() = default;
|
||||
|
||||
const wchar_t *GetSvgElementName() noexcept override {
|
||||
return L"defs";
|
||||
}
|
||||
|
||||
void OnRender(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement &element) noexcept override {
|
||||
if (m_props) {
|
||||
auto props = winrt::get_self<DefsProps>(m_props);
|
||||
SetCommonSvgProps(svgView, document, element, *props);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void RegisterDefsComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
RegisterRenderableComponent<DefsProps, DefsView>(L"RNSVGDefs", builder);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
9
windows/RNSVG/Fabric/DefsView.h
Normal file
9
windows/RNSVG/Fabric/DefsView.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "GroupView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
void RegisterDefsComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
56
windows/RNSVG/Fabric/EllipseView.cpp
Normal file
56
windows/RNSVG/Fabric/EllipseView.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "pch.h"
|
||||
#include "EllipseView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
REACT_STRUCT(EllipseProps)
|
||||
struct EllipseProps : winrt::implements<EllipseProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
EllipseProps(const winrt::Microsoft::ReactNative::ViewProps &props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) REACT_SVG_RENDERABLE_COMMON_PROPS_INIT
|
||||
{
|
||||
REACT_BEGIN_SVG_RENDERABLE_COMMON_PROPS_CLONE(EllipseProps)
|
||||
cx = cloneFromProps->cx;
|
||||
cy = cloneFromProps->cy;
|
||||
rx = cloneFromProps->rx;
|
||||
ry = cloneFromProps->ry;
|
||||
REACT_END_SVG_RENDERABLE_COMMON_PROPS_CLONE
|
||||
}
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(cx)
|
||||
D2D1_SVG_LENGTH cx{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
REACT_FIELD(cy)
|
||||
D2D1_SVG_LENGTH cy{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
REACT_FIELD(rx)
|
||||
D2D1_SVG_LENGTH rx{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
REACT_FIELD(ry)
|
||||
D2D1_SVG_LENGTH ry{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
};
|
||||
|
||||
struct EllipseView : winrt::implements<EllipseView, winrt::Windows::Foundation::IInspectable, RenderableView> {
|
||||
public:
|
||||
EllipseView() = default;
|
||||
|
||||
const wchar_t *GetSvgElementName() noexcept override {
|
||||
return L"ellipse";
|
||||
}
|
||||
|
||||
void OnRender(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement &element) noexcept override {
|
||||
auto props = m_props.as<EllipseProps>();
|
||||
SetCommonSvgProps(svgView, document, element, *props);
|
||||
element.SetAttributeValue(SvgStrings::cxAttributeName, props->cx);
|
||||
element.SetAttributeValue(SvgStrings::cyAttributeName, props->cy);
|
||||
element.SetAttributeValue(SvgStrings::rxAttributeName, props->rx);
|
||||
element.SetAttributeValue(SvgStrings::ryAttributeName, props->ry);
|
||||
}
|
||||
};
|
||||
|
||||
void RegisterEllipseComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
RegisterRenderableComponent<EllipseProps, EllipseView>(L"RNSVGEllipse", builder);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
11
windows/RNSVG/Fabric/EllipseView.h
Normal file
11
windows/RNSVG/Fabric/EllipseView.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
void RegisterEllipseComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
42
windows/RNSVG/Fabric/GroupView.cpp
Normal file
42
windows/RNSVG/Fabric/GroupView.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include "GroupView.h"
|
||||
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
REACT_STRUCT(SvgGroupProps)
|
||||
struct SvgGroupProps : winrt::implements<SvgGroupProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
SvgGroupProps(const winrt::Microsoft::ReactNative::ViewProps &props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) REACT_SVG_RENDERABLE_COMMON_PROPS_INIT
|
||||
{
|
||||
REACT_BEGIN_SVG_RENDERABLE_COMMON_PROPS_CLONE(SvgGroupProps)
|
||||
REACT_END_SVG_RENDERABLE_COMMON_PROPS_CLONE
|
||||
}
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
};
|
||||
|
||||
struct GroupView : winrt::implements<GroupView, winrt::Windows::Foundation::IInspectable, RenderableView> {
|
||||
public:
|
||||
GroupView() = default;
|
||||
|
||||
const wchar_t *GetSvgElementName() noexcept override {
|
||||
return L"g";
|
||||
}
|
||||
|
||||
void OnRender(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement &element) noexcept override {
|
||||
auto props = winrt::get_self<SvgGroupProps>(m_props);
|
||||
SetCommonSvgProps(svgView, document, element, *props);
|
||||
}
|
||||
};
|
||||
|
||||
void RegisterGroupComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
RegisterRenderableComponent<SvgGroupProps, GroupView>(L"RNSVGGroup", builder);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
8
windows/RNSVG/Fabric/GroupView.h
Normal file
8
windows/RNSVG/Fabric/GroupView.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
void RegisterGroupComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
128
windows/RNSVG/Fabric/ImageView.cpp
Normal file
128
windows/RNSVG/Fabric/ImageView.cpp
Normal file
@@ -0,0 +1,128 @@
|
||||
#include "pch.h"
|
||||
#include "ImageView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
REACT_STRUCT(ImageSource)
|
||||
struct ImageSource {
|
||||
REACT_FIELD(uri)
|
||||
std::wstring uri{};
|
||||
REACT_FIELD(width)
|
||||
float width{0.0f};
|
||||
REACT_FIELD(height)
|
||||
float height{0.0f};
|
||||
|
||||
bool operator==(const ImageSource &rhs) const {
|
||||
return uri == rhs.uri && width == rhs.width && height == rhs.height;
|
||||
}
|
||||
|
||||
bool operator!=(const ImageSource &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
};
|
||||
|
||||
REACT_STRUCT(ImageProps)
|
||||
struct ImageProps : winrt::implements<ImageProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
ImageProps(const winrt::Microsoft::ReactNative::ViewProps &props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) REACT_SVG_RENDERABLE_COMMON_PROPS_INIT
|
||||
{
|
||||
REACT_BEGIN_SVG_RENDERABLE_COMMON_PROPS_CLONE(ImageProps)
|
||||
x = cloneFromProps->x;
|
||||
y = cloneFromProps->y;
|
||||
width = cloneFromProps->width;
|
||||
height = cloneFromProps->height;
|
||||
src = cloneFromProps->src;
|
||||
align = cloneFromProps->align;
|
||||
meetOrSlice = cloneFromProps->meetOrSlice;
|
||||
REACT_END_SVG_RENDERABLE_COMMON_PROPS_CLONE
|
||||
}
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(x)
|
||||
std::optional<D2D1_SVG_LENGTH> x;
|
||||
REACT_FIELD(y)
|
||||
std::optional<D2D1_SVG_LENGTH> y;
|
||||
REACT_FIELD(width)
|
||||
std::optional<D2D1_SVG_LENGTH> width;
|
||||
REACT_FIELD(height)
|
||||
std::optional<D2D1_SVG_LENGTH> height;
|
||||
REACT_FIELD(src)
|
||||
ImageSource src;
|
||||
REACT_FIELD(align)
|
||||
std::optional<std::string> align{""};
|
||||
REACT_FIELD(meetOrSlice)
|
||||
std::optional<MeetOrSlice> meetOrSlice;
|
||||
};
|
||||
|
||||
struct ImageView : winrt::implements<ImageView, winrt::Windows::Foundation::IInspectable, RenderableView> {
|
||||
public:
|
||||
ImageView() = default;
|
||||
|
||||
const wchar_t *GetSvgElementName() noexcept override {
|
||||
return L"image";
|
||||
}
|
||||
|
||||
void UpdateProps(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &newProps,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
|
||||
RenderableView::UpdateProps(view, newProps, oldProps);
|
||||
|
||||
auto props = newProps.as<ImageProps>();
|
||||
|
||||
if (!props->align) {
|
||||
m_aspectAlign = AlignToAspectAlign(props->align.value());
|
||||
} else {
|
||||
m_aspectAlign = D2D1_SVG_ASPECT_ALIGN::D2D1_SVG_ASPECT_ALIGN_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void OnRender(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement &element) noexcept override {
|
||||
auto props = m_props.as<ImageProps>();
|
||||
SetCommonSvgProps(svgView, document, element, *props);
|
||||
|
||||
if (props->x) {
|
||||
element.SetAttributeValue(SvgStrings::xAttributeName, props->x.value());
|
||||
}
|
||||
if (props->y) {
|
||||
element.SetAttributeValue(SvgStrings::yAttributeName, props->y.value());
|
||||
}
|
||||
if (props->width) {
|
||||
element.SetAttributeValue(SvgStrings::widthAttributeName, props->width.value());
|
||||
}
|
||||
if (props->height) {
|
||||
element.SetAttributeValue(SvgStrings::heightAttributeName, props->height.value());
|
||||
}
|
||||
|
||||
if (props->align != std::nullopt || props->meetOrSlice != std::nullopt) {
|
||||
D2D1_SVG_PRESERVE_ASPECT_RATIO preserveAspectRatio;
|
||||
preserveAspectRatio.defer = false;
|
||||
preserveAspectRatio.align = m_aspectAlign;
|
||||
|
||||
preserveAspectRatio.meetOrSlice = props->meetOrSlice.value() == MeetOrSlice::Meet
|
||||
? D2D1_SVG_ASPECT_SCALING::D2D1_SVG_ASPECT_SCALING_MEET
|
||||
: D2D1_SVG_ASPECT_SCALING::D2D1_SVG_ASPECT_SCALING_SLICE;
|
||||
element.SetAttributeValue(SvgStrings::preserveAspectRatioAttributeName, preserveAspectRatio);
|
||||
}
|
||||
|
||||
if (!props->src.uri.empty()) {
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::xlinkhrefAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
props->src.uri.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
D2D1_SVG_ASPECT_ALIGN m_aspectAlign;
|
||||
};
|
||||
|
||||
void RegisterImageComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
RegisterRenderableComponent<winrt::RNSVG::implementation::ImageProps, ImageView>(L"RNSVGImage", builder);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
9
windows/RNSVG/Fabric/ImageView.h
Normal file
9
windows/RNSVG/Fabric/ImageView.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
void RegisterImageComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
56
windows/RNSVG/Fabric/LineView.cpp
Normal file
56
windows/RNSVG/Fabric/LineView.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "pch.h"
|
||||
#include "LineView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
REACT_STRUCT(LineProps)
|
||||
struct LineProps : winrt::implements<LineProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
LineProps(const winrt::Microsoft::ReactNative::ViewProps &props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) REACT_SVG_RENDERABLE_COMMON_PROPS_INIT
|
||||
{
|
||||
REACT_BEGIN_SVG_RENDERABLE_COMMON_PROPS_CLONE(LineProps)
|
||||
x1 = cloneFromProps->x1;
|
||||
y1 = cloneFromProps->y1;
|
||||
x2 = cloneFromProps->x2;
|
||||
y2 = cloneFromProps->y2;
|
||||
REACT_END_SVG_RENDERABLE_COMMON_PROPS_CLONE
|
||||
}
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(x1)
|
||||
D2D1_SVG_LENGTH x1{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
REACT_FIELD(y1)
|
||||
D2D1_SVG_LENGTH y1{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
REACT_FIELD(x2)
|
||||
D2D1_SVG_LENGTH x2{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
REACT_FIELD(y2)
|
||||
D2D1_SVG_LENGTH y2{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
};
|
||||
|
||||
struct LineView : winrt::implements<LineView, winrt::Windows::Foundation::IInspectable, RenderableView> {
|
||||
public:
|
||||
LineView() = default;
|
||||
|
||||
const wchar_t *GetSvgElementName() noexcept override {
|
||||
return L"line";
|
||||
}
|
||||
|
||||
void OnRender(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement &element) noexcept override {
|
||||
auto props = m_props.as<LineProps>();
|
||||
SetCommonSvgProps(svgView, document, element, *props);
|
||||
element.SetAttributeValue(SvgStrings::x1AttributeName, props->x1);
|
||||
element.SetAttributeValue(SvgStrings::y1AttributeName, props->y1);
|
||||
element.SetAttributeValue(SvgStrings::x2AttributeName, props->x2);
|
||||
element.SetAttributeValue(SvgStrings::y2AttributeName, props->y2);
|
||||
}
|
||||
};
|
||||
|
||||
void RegisterLineComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
RegisterRenderableComponent<LineProps, LineView>(L"RNSVGLine", builder);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
10
windows/RNSVG/Fabric/LineView.h
Normal file
10
windows/RNSVG/Fabric/LineView.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
void RegisterLineComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
134
windows/RNSVG/Fabric/LinearGradientView.cpp
Normal file
134
windows/RNSVG/Fabric/LinearGradientView.cpp
Normal file
@@ -0,0 +1,134 @@
|
||||
#include "pch.h"
|
||||
#include "LinearGradientView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
struct SvgLinearGradientStop {
|
||||
float offset{0};
|
||||
D2D1_COLOR_F color;
|
||||
float opacity{1.0f};
|
||||
};
|
||||
|
||||
REACT_STRUCT(LinearGradientProps)
|
||||
struct LinearGradientProps : winrt::implements<LinearGradientProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
LinearGradientProps(const winrt::Microsoft::ReactNative::ViewProps &props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) REACT_SVG_RENDERABLE_COMMON_PROPS_INIT
|
||||
{
|
||||
REACT_BEGIN_SVG_RENDERABLE_COMMON_PROPS_CLONE(LinearGradientProps)
|
||||
x1 = cloneFromProps->x1;
|
||||
y1 = cloneFromProps->y1;
|
||||
x2 = cloneFromProps->x2;
|
||||
y2 = cloneFromProps->y2;
|
||||
gradient = cloneFromProps->gradient;
|
||||
gradientUnits = cloneFromProps->gradientUnits;
|
||||
gradientTransform = cloneFromProps->gradientTransform;
|
||||
REACT_END_SVG_RENDERABLE_COMMON_PROPS_CLONE
|
||||
}
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(x1)
|
||||
std::optional<std::wstring> x1;
|
||||
REACT_FIELD(y1)
|
||||
std::optional<std::wstring> y1;
|
||||
REACT_FIELD(x2)
|
||||
std::optional<std::wstring> x2;
|
||||
REACT_FIELD(y2)
|
||||
std::optional<std::wstring> y2;
|
||||
REACT_FIELD(gradient)
|
||||
std::optional<std::vector<float>> gradient{};
|
||||
REACT_FIELD(gradientUnits)
|
||||
std::optional<int32_t> gradientUnits;
|
||||
REACT_FIELD(gradientTransform)
|
||||
std::optional<std::vector<float>> gradientTransform;
|
||||
};
|
||||
|
||||
struct LinearGradientView : winrt::implements<LinearGradientView, winrt::Windows::Foundation::IInspectable, RenderableView> {
|
||||
public:
|
||||
LinearGradientView() = default;
|
||||
|
||||
void UpdateProps(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &newProps,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept override {
|
||||
auto props = newProps.as<LinearGradientProps>();
|
||||
m_stops.clear();
|
||||
|
||||
if (props->gradient) {
|
||||
auto it = props->gradient->begin();
|
||||
while (it != props->gradient->end()) {
|
||||
SvgLinearGradientStop stop;
|
||||
|
||||
stop.offset = *it;
|
||||
++it;
|
||||
auto clr = static_cast<uint32_t>(*it);
|
||||
stop.color = D2D1_COLOR_F{
|
||||
((clr & 0x00FF0000) >> 16) / 255.0f,
|
||||
((clr & 0x0000FF00) >> 8) / 255.0f,
|
||||
(clr & 0x000000FF) / 255.0f,
|
||||
((clr & 0xFF000000) >> 24) / 255.0f};
|
||||
stop.opacity = ((clr & 0xFF000000) >> 24) / 255.0f;
|
||||
++it;
|
||||
m_stops.push_back(stop);
|
||||
}
|
||||
}
|
||||
RenderableView::UpdateProps(view, newProps, oldProps);
|
||||
}
|
||||
|
||||
const wchar_t *GetSvgElementName() noexcept override {
|
||||
return L"linearGradient";
|
||||
}
|
||||
|
||||
void OnRender(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement &element) noexcept override {
|
||||
auto props = m_props.as<LinearGradientProps>();
|
||||
SetCommonSvgProps(svgView, document, element, *props);
|
||||
if (props->x1)
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::x1AttributeName, D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG, props->x1.value().c_str());
|
||||
if (props->y1)
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::y1AttributeName, D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG, props->y1.value().c_str());
|
||||
if (props->x2)
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::x2AttributeName, D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG, props->x2.value().c_str());
|
||||
if (props->y2)
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::y2AttributeName, D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG, props->y2.value().c_str());
|
||||
|
||||
if (props->gradientUnits.value_or(0) == 0) {
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::gradientUnitsAttributeName, D2D1_SVG_UNIT_TYPE::D2D1_SVG_UNIT_TYPE_OBJECT_BOUNDING_BOX);
|
||||
} else {
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::gradientUnitsAttributeName, D2D1_SVG_UNIT_TYPE::D2D1_SVG_UNIT_TYPE_USER_SPACE_ON_USE);
|
||||
}
|
||||
|
||||
if (props->gradientTransform) {
|
||||
auto &matrix = props->gradientTransform.value();
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::gradientTransformAttributeName,
|
||||
D2D1_MATRIX_3X2_F{matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]});
|
||||
}
|
||||
|
||||
for (const auto &stop : m_stops) {
|
||||
winrt::com_ptr<ID2D1SvgElement> svgStop;
|
||||
element.CreateChild(SvgStrings::stopAttributeName, svgStop.put());
|
||||
svgStop->SetAttributeValue(SvgStrings::offsetAttributeName, stop.offset);
|
||||
svgStop->SetAttributeValue(SvgStrings::stopColorAttributeName, stop.color);
|
||||
svgStop->SetAttributeValue(SvgStrings::stopOpacityAttributeName, stop.opacity);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<SvgLinearGradientStop> m_stops;
|
||||
};
|
||||
|
||||
void RegisterLinearGradientComponent(
|
||||
const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
RegisterRenderableComponent<LinearGradientProps, LinearGradientView>(L"RNSVGLinearGradient", builder);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
11
windows/RNSVG/Fabric/LinearGradientView.h
Normal file
11
windows/RNSVG/Fabric/LinearGradientView.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "GroupView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
|
||||
void RegisterLinearGradientComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
49
windows/RNSVG/Fabric/PathView.cpp
Normal file
49
windows/RNSVG/Fabric/PathView.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "pch.h"
|
||||
#include "PathView.h"
|
||||
|
||||
#include "d2d1svg.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
REACT_STRUCT(PathProps)
|
||||
struct PathProps : winrt::implements<PathProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
PathProps(const winrt::Microsoft::ReactNative::ViewProps &props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) REACT_SVG_RENDERABLE_COMMON_PROPS_INIT
|
||||
{
|
||||
REACT_BEGIN_SVG_RENDERABLE_COMMON_PROPS_CLONE(PathProps)
|
||||
d = cloneFromProps->d;
|
||||
REACT_END_SVG_RENDERABLE_COMMON_PROPS_CLONE
|
||||
}
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(d)
|
||||
std::wstring d;
|
||||
};
|
||||
|
||||
struct PathView : winrt::implements<PathView, winrt::Windows::Foundation::IInspectable, RenderableView> {
|
||||
public:
|
||||
PathView() = default;
|
||||
|
||||
const wchar_t *GetSvgElementName() noexcept override {
|
||||
return L"path";
|
||||
}
|
||||
|
||||
void OnRender(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement &element) noexcept override {
|
||||
auto props = m_props.as<PathProps>();
|
||||
SetCommonSvgProps(svgView, document, element, *props);
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::dAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
props->d.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
void RegisterPathComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
RegisterRenderableComponent<PathProps, PathView>(L"RNSVGPath", builder);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
9
windows/RNSVG/Fabric/PathView.h
Normal file
9
windows/RNSVG/Fabric/PathView.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
void RegisterPathComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
161
windows/RNSVG/Fabric/RadialGradientView.cpp
Normal file
161
windows/RNSVG/Fabric/RadialGradientView.cpp
Normal file
@@ -0,0 +1,161 @@
|
||||
#include "pch.h"
|
||||
#include "RadialGradientView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
struct SvgRadialGradientStop {
|
||||
float offset{0};
|
||||
D2D1_COLOR_F color;
|
||||
float opacity{1.0f};
|
||||
};
|
||||
|
||||
REACT_STRUCT(RadialGradientProps)
|
||||
struct RadialGradientProps : winrt::implements<RadialGradientProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
RadialGradientProps(const winrt::Microsoft::ReactNative::ViewProps &props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) REACT_SVG_RENDERABLE_COMMON_PROPS_INIT
|
||||
{
|
||||
REACT_BEGIN_SVG_RENDERABLE_COMMON_PROPS_CLONE(RadialGradientProps)
|
||||
fx = cloneFromProps->fx;
|
||||
fy = cloneFromProps->fy;
|
||||
cx = cloneFromProps->cx;
|
||||
cy = cloneFromProps->cy;
|
||||
rx = cloneFromProps->rx;
|
||||
ry = cloneFromProps->ry;
|
||||
gradient = cloneFromProps->gradient;
|
||||
gradientUnits = cloneFromProps->gradientUnits;
|
||||
gradientTransform = cloneFromProps->gradientTransform;
|
||||
REACT_END_SVG_RENDERABLE_COMMON_PROPS_CLONE
|
||||
}
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(fx)
|
||||
std::optional<std::wstring> fx;
|
||||
REACT_FIELD(fy)
|
||||
std::optional<std::wstring> fy;
|
||||
REACT_FIELD(cx)
|
||||
std::optional<std::wstring> cx;
|
||||
REACT_FIELD(cy)
|
||||
std::optional<std::wstring> cy;
|
||||
REACT_FIELD(rx)
|
||||
std::optional<std::wstring> rx;
|
||||
REACT_FIELD(ry)
|
||||
std::optional<std::wstring> ry;
|
||||
REACT_FIELD(gradient)
|
||||
std::optional<std::vector<float>> gradient{};
|
||||
REACT_FIELD(gradientUnits)
|
||||
std::optional<int32_t> gradientUnits;
|
||||
REACT_FIELD(gradientTransform)
|
||||
std::optional<std::vector<float>> gradientTransform;
|
||||
};
|
||||
|
||||
struct RadialGradientView : winrt::implements<RadialGradientView, winrt::Windows::Foundation::IInspectable, RenderableView> {
|
||||
public:
|
||||
RadialGradientView() = default;
|
||||
|
||||
void UpdateProps(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &newProps,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept override {
|
||||
auto props = newProps.as<RadialGradientProps>();
|
||||
m_stops.clear();
|
||||
|
||||
if (props->gradient) {
|
||||
auto it = props->gradient->begin();
|
||||
while (it != props->gradient->end()) {
|
||||
SvgRadialGradientStop stop;
|
||||
|
||||
stop.offset = *it;
|
||||
++it;
|
||||
auto clr = static_cast<uint32_t>(*it);
|
||||
stop.color = D2D1_COLOR_F{
|
||||
((clr & 0x00FF0000) >> 16) / 255.0f,
|
||||
((clr & 0x0000FF00) >> 8) / 255.0f,
|
||||
(clr & 0x000000FF) / 255.0f,
|
||||
((clr & 0xFF000000) >> 24) / 255.0f};
|
||||
stop.opacity = ((clr & 0xFF000000) >> 24) / 255.0f;
|
||||
++it;
|
||||
m_stops.push_back(stop);
|
||||
}
|
||||
}
|
||||
|
||||
RenderableView::UpdateProps(view, newProps, oldProps);
|
||||
}
|
||||
|
||||
const wchar_t *GetSvgElementName() noexcept override {
|
||||
return L"radialGradient";
|
||||
}
|
||||
|
||||
void OnRender(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement &element) noexcept override {
|
||||
auto props = m_props.as<RadialGradientProps>();
|
||||
SetCommonSvgProps(svgView, document, element, *props);
|
||||
if (props->cx)
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::cxAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
props->cx->c_str());
|
||||
if (props->cy)
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::cyAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
props->cy->c_str());
|
||||
|
||||
// RNSVG can decompose r to rx and ry, but D2D svgs don't support rx or ry, so if that is specified then take rx as
|
||||
// r, and make sure the specified rx and ry are the same.
|
||||
assert(props->rx == props->ry);
|
||||
|
||||
if (props->rx)
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::rAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
props->rx->c_str());
|
||||
|
||||
if (props->fx)
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::fxAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
props->fx->c_str());
|
||||
|
||||
if (props->fy)
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::fyAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
props->fy->c_str());
|
||||
|
||||
if (props->gradientUnits.value_or(0) == 0) {
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::gradientUnitsAttributeName, D2D1_SVG_UNIT_TYPE::D2D1_SVG_UNIT_TYPE_OBJECT_BOUNDING_BOX);
|
||||
} else {
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::gradientUnitsAttributeName, D2D1_SVG_UNIT_TYPE::D2D1_SVG_UNIT_TYPE_USER_SPACE_ON_USE);
|
||||
}
|
||||
|
||||
if (props->gradientTransform) {
|
||||
auto &matrix = props->gradientTransform.value();
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::gradientTransformAttributeName,
|
||||
D2D1_MATRIX_3X2_F{matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]});
|
||||
}
|
||||
|
||||
for (const auto &stop : m_stops) {
|
||||
winrt::com_ptr<ID2D1SvgElement> svgStop;
|
||||
element.CreateChild(SvgStrings::stopAttributeName, svgStop.put());
|
||||
svgStop->SetAttributeValue(SvgStrings::offsetAttributeName, stop.offset);
|
||||
svgStop->SetAttributeValue(SvgStrings::stopColorAttributeName, stop.color);
|
||||
svgStop->SetAttributeValue(SvgStrings::stopOpacityAttributeName, stop.opacity);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<SvgRadialGradientStop> m_stops;
|
||||
};
|
||||
|
||||
void RegisterRadialGradientComponent(
|
||||
const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
RegisterRenderableComponent<RadialGradientProps, RadialGradientView>(L"RNSVGRadialGradient", builder);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
10
windows/RNSVG/Fabric/RadialGradientView.h
Normal file
10
windows/RNSVG/Fabric/RadialGradientView.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "GroupView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
void RegisterRadialGradientComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
79
windows/RNSVG/Fabric/RectView.cpp
Normal file
79
windows/RNSVG/Fabric/RectView.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
#include "pch.h"
|
||||
#include "RectView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
REACT_STRUCT(RectProps)
|
||||
struct RectProps : winrt::implements<RectProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
RectProps(const winrt::Microsoft::ReactNative::ViewProps &props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) REACT_SVG_RENDERABLE_COMMON_PROPS_INIT
|
||||
{
|
||||
REACT_BEGIN_SVG_RENDERABLE_COMMON_PROPS_CLONE(RectProps)
|
||||
x = cloneFromProps->x;
|
||||
y = cloneFromProps->y;
|
||||
height = cloneFromProps->height;
|
||||
width = cloneFromProps->width;
|
||||
rx = cloneFromProps->rx;
|
||||
ry = cloneFromProps->ry;
|
||||
REACT_END_SVG_RENDERABLE_COMMON_PROPS_CLONE
|
||||
}
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(x)
|
||||
std::wstring x;
|
||||
REACT_FIELD(y)
|
||||
std::wstring y;
|
||||
REACT_FIELD(height)
|
||||
std::wstring height;
|
||||
REACT_FIELD(width)
|
||||
std::wstring width;
|
||||
REACT_FIELD(rx)
|
||||
D2D1_SVG_LENGTH rx{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
REACT_FIELD(ry)
|
||||
D2D1_SVG_LENGTH ry{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
};
|
||||
|
||||
struct RectView : winrt::implements<RectView, winrt::Windows::Foundation::IInspectable, RenderableView> {
|
||||
public:
|
||||
RectView() = default;
|
||||
|
||||
const wchar_t *GetSvgElementName() noexcept override {
|
||||
return L"rect";
|
||||
}
|
||||
|
||||
void OnRender(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement &element) noexcept override {
|
||||
auto props = m_props.as<RectProps>();
|
||||
SetCommonSvgProps(svgView, document, element, *props);
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::xAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
props->x.c_str());
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::yAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
props->y.c_str());
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::widthAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
props->width.c_str());
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::heightAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
props->height.c_str());
|
||||
|
||||
if (props->rx.value)
|
||||
element.SetAttributeValue(SvgStrings::rxAttributeName, props->rx);
|
||||
if (props->ry.value)
|
||||
element.SetAttributeValue(SvgStrings::ryAttributeName, props->ry);
|
||||
}
|
||||
};
|
||||
|
||||
void RegisterRectComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
RegisterRenderableComponent<RectProps, RectView>(L"RNSVGRect", builder);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
9
windows/RNSVG/Fabric/RectView.h
Normal file
9
windows/RNSVG/Fabric/RectView.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
void RegisterRectComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
174
windows/RNSVG/Fabric/RenderableView.cpp
Normal file
174
windows/RNSVG/Fabric/RenderableView.cpp
Normal file
@@ -0,0 +1,174 @@
|
||||
#include "pch.h"
|
||||
#include "RenderableView.h"
|
||||
|
||||
#include "SvgView.h"
|
||||
#include "D2DHelpers.h"
|
||||
|
||||
namespace winrt::Microsoft::ReactNative {
|
||||
|
||||
void WriteValue(IJSValueWriter const &writer, const D2D1_SVG_LENGTH &value) noexcept {
|
||||
if (value.units == D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_PERCENTAGE) {
|
||||
writer.WriteString(winrt::to_hstring(std::to_string(value.value) + "%"));
|
||||
} else {
|
||||
writer.WriteDouble(value.value);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadValue(IJSValueReader const &reader, /*out*/ D2D1_SVG_LENGTH &value) noexcept {
|
||||
switch (reader.ValueType()) {
|
||||
case JSValueType::String: {
|
||||
auto str = to_string(reader.GetString());
|
||||
|
||||
auto strLength{str.size()};
|
||||
if (strLength == 0 || str == "normal") {
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
value.value = 0.0;
|
||||
return;
|
||||
} else if (str.back() == '%') {
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_PERCENTAGE;
|
||||
value.value = std::stof(str.substr(0, strLength - 1), nullptr);
|
||||
return;
|
||||
} else if (strLength > 2) {
|
||||
auto end{strLength - 2};
|
||||
auto lastTwo{str.substr(end)};
|
||||
|
||||
if (lastTwo == "px") {
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
} else if (lastTwo == "em") {
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
// value.unit = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_EM;
|
||||
} else if (lastTwo == "ex") {
|
||||
// value.unit = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_EX;
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
} else if (lastTwo == "cm") {
|
||||
// value.unit = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_CM;
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
} else if (lastTwo == "mm") {
|
||||
// value.unit = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_MM;
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
} else if (lastTwo == "in") {
|
||||
// value.unit = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_INCH;
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
} else if (lastTwo == "pt") {
|
||||
// value.unit = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_POINT;
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
} else if (lastTwo == "pc") {
|
||||
// value.unit = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_PICA;
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
} else {
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
end = strLength;
|
||||
}
|
||||
|
||||
value.value = std::stof(str.substr(0, end), nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
value.value = std::stof(str, nullptr);
|
||||
}
|
||||
return;
|
||||
case JSValueType::Int64:
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
value.value = static_cast<float>(reader.GetInt64());
|
||||
return;
|
||||
case JSValueType::Double:
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
value.value = static_cast<float>(reader.GetDouble());
|
||||
return;
|
||||
default:
|
||||
value.units = D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER;
|
||||
value.value = 0.0f;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
HRESULT
|
||||
SetColorMode(
|
||||
const SvgView &svgView,
|
||||
ID2D1SvgElement &element,
|
||||
const std::wstring &attribute,
|
||||
const ColorStruct &colorProp) noexcept {
|
||||
HRESULT hr = S_OK;
|
||||
if (colorProp.type == 0 /*Native Color*/) {
|
||||
hr = element.SetAttributeValue(
|
||||
attribute.c_str(), D2DHelpers::AsD2DColor(colorProp.payload.AsWindowsColor(svgView.Theme())));
|
||||
} else if (colorProp.type == 1 /*Brush ref*/) {
|
||||
std::wstring namedRefStr = L"url(#" + colorProp.brushRef + L")";
|
||||
hr = element.SetAttributeValue(
|
||||
attribute.c_str(), D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG, namedRefStr.c_str());
|
||||
} else if (colorProp.type == 2 /*Current Color*/) {
|
||||
hr = element.SetAttributeValue(
|
||||
attribute.c_str(), D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG, L"currentColor");
|
||||
} else if (colorProp.type == 3 /*context-fill*/) {
|
||||
hr = element.SetAttributeValue(
|
||||
attribute.c_str(), D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG, L"context-fill");
|
||||
} else if (colorProp.type == 4 /*context-stroke*/) {
|
||||
hr = element.SetAttributeValue(
|
||||
attribute.c_str(), D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG, L"context-fill");
|
||||
}
|
||||
|
||||
assert(hr == S_OK);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
void RenderableView::Invalidate(const winrt::Microsoft::ReactNative::ComponentView &view) {
|
||||
winrt::com_ptr<winrt::RNSVG::implementation::ISvgView> svgView{nullptr};
|
||||
auto current = view.Parent();
|
||||
while (current && !svgView) {
|
||||
svgView = current.UserData().try_as<winrt::RNSVG::implementation::ISvgView>();
|
||||
current = current.Parent();
|
||||
}
|
||||
|
||||
if (svgView) {
|
||||
svgView->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void RenderableView::MountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &parent,
|
||||
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &) noexcept {
|
||||
Invalidate(parent);
|
||||
}
|
||||
|
||||
void RenderableView::UnmountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &parent,
|
||||
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &) noexcept {
|
||||
Invalidate(parent);
|
||||
}
|
||||
|
||||
void RenderableView::UpdateProps(
|
||||
const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &) noexcept {
|
||||
m_props = props;
|
||||
}
|
||||
|
||||
void RenderableView::FinalizeUpates(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
winrt::Microsoft::ReactNative::ComponentViewUpdateMask) noexcept {
|
||||
Invalidate(view);
|
||||
}
|
||||
|
||||
ID2D1SvgElement &RenderableView::Render(const SvgView &svgView, ID2D1SvgDocument& document, ID2D1SvgElement &svgElement) noexcept {
|
||||
svgElement.CreateChild(GetSvgElementName(), m_spD2DSvgElement.put());
|
||||
OnRender(svgView, document, *m_spD2DSvgElement);
|
||||
return *m_spD2DSvgElement;
|
||||
}
|
||||
|
||||
bool RenderableView::IsSupported() const noexcept {
|
||||
return true;
|
||||
}
|
||||
void RenderableView::OnRender(
|
||||
const SvgView & /*svgView*/,
|
||||
ID2D1SvgDocument & /*document*/,
|
||||
ID2D1SvgElement & /*element*/) noexcept {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
302
windows/RNSVG/Fabric/RenderableView.h
Normal file
302
windows/RNSVG/Fabric/RenderableView.h
Normal file
@@ -0,0 +1,302 @@
|
||||
#pragma once
|
||||
|
||||
#include "SvgView.h"
|
||||
|
||||
#include <JSValueComposition.h>
|
||||
#include <NativeModules.h>
|
||||
#include "D2DHelpers.h"
|
||||
#include "SvgStrings.h"
|
||||
|
||||
namespace winrt::Microsoft::ReactNative {
|
||||
void WriteValue(IJSValueWriter const &writer, const D2D1_SVG_LENGTH &value) noexcept;
|
||||
void ReadValue(IJSValueReader const &reader, /*out*/ D2D1_SVG_LENGTH &value) noexcept;
|
||||
} // namespace winrt::Microsoft::ReactNative
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
REACT_STRUCT(ColorStruct)
|
||||
struct ColorStruct {
|
||||
REACT_FIELD(type)
|
||||
int32_t type{-1};
|
||||
|
||||
REACT_FIELD(payload)
|
||||
winrt::Microsoft::ReactNative::Color payload{nullptr};
|
||||
|
||||
REACT_FIELD(brushRef)
|
||||
std::wstring brushRef;
|
||||
|
||||
bool operator==(const ColorStruct &rhs) const {
|
||||
if (type != rhs.type || brushRef != rhs.brushRef)
|
||||
return false;
|
||||
|
||||
// When we move to a RNW version that provides Color::Equals switch to that for the payload comparison
|
||||
auto writer = winrt::Microsoft::ReactNative::MakeJSValueTreeWriter();
|
||||
winrt::Microsoft::ReactNative::WriteValue(writer, payload);
|
||||
auto rhsWriter = winrt::Microsoft::ReactNative::MakeJSValueTreeWriter();
|
||||
winrt::Microsoft::ReactNative::WriteValue(rhsWriter, rhs.payload);
|
||||
return winrt::Microsoft::ReactNative::TakeJSValue(writer).Equals(
|
||||
winrt::Microsoft::ReactNative::TakeJSValue(rhsWriter));
|
||||
}
|
||||
|
||||
bool operator!=(const ColorStruct &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
};
|
||||
|
||||
HRESULT SetColorMode(
|
||||
const SvgView &svgView,
|
||||
ID2D1SvgElement &element,
|
||||
const std::wstring &attribute,
|
||||
const ColorStruct &colorProp) noexcept;
|
||||
|
||||
// Currently no good way to do inheritance in REACT_STRUCTS
|
||||
#define REACT_SVG_RENDERABLE_COMMON_PROPS \
|
||||
REACT_FIELD(name) \
|
||||
std::optional<std::wstring> name; \
|
||||
REACT_FIELD(opacity) \
|
||||
std::optional<float> opacity; \
|
||||
REACT_FIELD(matrix) \
|
||||
std::optional<std::vector<float>> matrix; \
|
||||
REACT_FIELD(clipPath) \
|
||||
std::optional<std::wstring> clipPath; \
|
||||
REACT_FIELD(clipRule) \
|
||||
std::optional<D2D1_FILL_MODE> clipRule; \
|
||||
REACT_FIELD(fill) \
|
||||
std::optional<ColorStruct> fill; \
|
||||
REACT_FIELD(fillOpacity) \
|
||||
std::optional<float> fillOpacity; \
|
||||
REACT_FIELD(fillRule) \
|
||||
std::optional<D2D1_FILL_MODE> fillRule; \
|
||||
REACT_FIELD(stroke) \
|
||||
std::optional<ColorStruct> stroke; \
|
||||
REACT_FIELD(strokeOpacity) \
|
||||
std::optional<float> strokeOpacity; \
|
||||
REACT_FIELD(strokeWidth) \
|
||||
std::optional<D2D1_SVG_LENGTH> strokeWidth; \
|
||||
REACT_FIELD(strokeLinecap) \
|
||||
std::optional<uint32_t> strokeLinecap; \
|
||||
REACT_FIELD(strokeLinejoin) \
|
||||
std::optional<D2D1_SVG_LINE_JOIN> strokeLinejoin; \
|
||||
REACT_FIELD(strokeDasharray) \
|
||||
std::optional<std::vector<D2D1_SVG_LENGTH>> strokeDasharray; \
|
||||
REACT_FIELD(strokeDashoffset) \
|
||||
std::optional<float> strokeDashoffset; \
|
||||
REACT_FIELD(strokeMiterlimit) \
|
||||
std::optional<float> strokeMiterlimit; \
|
||||
REACT_FIELD(propList) \
|
||||
std::optional<std::vector<std::string>> propList; \
|
||||
std::optional<winrt::Microsoft::ReactNative::Color> color; \
|
||||
winrt::Microsoft::ReactNative::ViewProps m_props{nullptr};
|
||||
|
||||
#define REACT_SVG_RENDERABLE_COMMON_PROPS_INIT \
|
||||
: m_props(props)
|
||||
|
||||
#define REACT_BEGIN_SVG_RENDERABLE_COMMON_PROPS_CLONE(TProps) \
|
||||
if (cloneFrom) { \
|
||||
auto cloneFromProps = cloneFrom.as<TProps>(); \
|
||||
name = cloneFromProps->name; \
|
||||
opacity = cloneFromProps->opacity; \
|
||||
matrix = cloneFromProps->matrix; \
|
||||
clipPath = cloneFromProps->clipPath; \
|
||||
clipRule = cloneFromProps->clipRule; \
|
||||
fill = cloneFromProps->fill; \
|
||||
fillOpacity = cloneFromProps->fillOpacity; \
|
||||
fillRule = cloneFromProps->fillRule; \
|
||||
stroke = cloneFromProps->stroke; \
|
||||
strokeOpacity = cloneFromProps->strokeOpacity; \
|
||||
strokeWidth = cloneFromProps->strokeWidth; \
|
||||
strokeLinecap = cloneFromProps->strokeLinecap; \
|
||||
strokeLinejoin = cloneFromProps->strokeLinejoin; \
|
||||
strokeDasharray = cloneFromProps->strokeDasharray; \
|
||||
strokeMiterlimit = cloneFromProps->strokeMiterlimit; \
|
||||
propList = cloneFromProps->propList; \
|
||||
color = cloneFromProps->color;
|
||||
|
||||
#define REACT_END_SVG_RENDERABLE_COMMON_PROPS_CLONE \
|
||||
}
|
||||
|
||||
struct __declspec(uuid("a03986c0-b06e-4fb8-a86e-16fcc47b2f31")) RenderableView : public ::IUnknown {
|
||||
public:
|
||||
RenderableView() = default;
|
||||
|
||||
virtual const wchar_t *GetSvgElementName() noexcept = 0;
|
||||
|
||||
// ComponentView
|
||||
void MountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept;
|
||||
void UnmountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept;
|
||||
|
||||
virtual void UpdateProps(
|
||||
const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept;
|
||||
|
||||
virtual void FinalizeUpates(
|
||||
const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
|
||||
winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept;
|
||||
|
||||
ID2D1SvgElement &Render(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement &svgElement) noexcept;
|
||||
|
||||
virtual void OnRender(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement & /*svgElement*/) noexcept;
|
||||
virtual bool IsSupported() const noexcept;
|
||||
|
||||
void Invalidate(const winrt::Microsoft::ReactNative::ComponentView &view);
|
||||
|
||||
protected:
|
||||
winrt::Microsoft::ReactNative::IComponentProps m_props;
|
||||
|
||||
private:
|
||||
winrt::com_ptr<ID2D1SvgElement> m_spD2DSvgElement;
|
||||
};
|
||||
|
||||
template <typename TProps>
|
||||
void SetCommonSvgProps(
|
||||
const SvgView &svgView,
|
||||
ID2D1SvgDocument &document,
|
||||
ID2D1SvgElement &element,
|
||||
const TProps &commonProps) noexcept {
|
||||
HRESULT hr = S_OK;
|
||||
if (commonProps.color != std::nullopt) {
|
||||
auto color = commonProps.color.value().AsWindowsColor(svgView.Theme());
|
||||
hr |= element.SetAttributeValue(SvgStrings::colorAttributeName, D2DHelpers::AsD2DColor(color));
|
||||
}
|
||||
|
||||
if (commonProps.propList) {
|
||||
for (auto &prop : commonProps.propList.value()) {
|
||||
if (prop == "fill") {
|
||||
if (commonProps.fill != std::nullopt)
|
||||
hr |= SetColorMode(svgView, element, SvgStrings::fillAttributeName, commonProps.fill.value());
|
||||
else
|
||||
hr |= element.SetAttributeValue(
|
||||
SvgStrings::fillAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
SvgStrings::noneAttributeValue);
|
||||
} else if (prop == "fillOpacity") {
|
||||
if (commonProps.fillOpacity != std::nullopt)
|
||||
hr |= element.SetAttributeValue(SvgStrings::fillOpacityAttributeName, commonProps.fillOpacity.value());
|
||||
} else if (prop == "fillRule") {
|
||||
if (commonProps.fillRule != std::nullopt) {
|
||||
hr |= element.SetAttributeValue(SvgStrings::fillRuleAttributeName, commonProps.fillRule.value());
|
||||
}
|
||||
} else if (prop == "stroke") {
|
||||
if (commonProps.stroke != std::nullopt)
|
||||
hr |= SetColorMode(svgView, element, SvgStrings::strokeAttributeName, commonProps.stroke.value());
|
||||
else
|
||||
hr |= element.SetAttributeValue(
|
||||
SvgStrings::strokeAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
SvgStrings::noneAttributeValue);
|
||||
} else if (prop == "strokeWidth") {
|
||||
if (commonProps.strokeWidth != std::nullopt)
|
||||
hr |= element.SetAttributeValue(SvgStrings::strokeWidthAttributeName, commonProps.strokeWidth.value());
|
||||
} else if (prop == "strokeOpacity") {
|
||||
if (commonProps.strokeOpacity != std::nullopt)
|
||||
hr |= element.SetAttributeValue(SvgStrings::strokeOpacityAttributeName, commonProps.strokeOpacity.value());
|
||||
} else if (prop == "strokeDasharray") {
|
||||
if (commonProps.strokeDasharray != std::nullopt && !commonProps.strokeDasharray->empty()) {
|
||||
winrt::com_ptr<ID2D1SvgStrokeDashArray> dashArray;
|
||||
document.CreateStrokeDashArray(
|
||||
&commonProps.strokeDasharray.value()[0],
|
||||
static_cast<UINT32>(commonProps.strokeDasharray.value().size()),
|
||||
dashArray.put());
|
||||
hr |= element.SetAttributeValue(SvgStrings::strokeDashArrayAttributeName, dashArray.get());
|
||||
}
|
||||
} else if (prop == "strokeDashoffset") {
|
||||
if (commonProps.strokeDashoffset != std::nullopt) {
|
||||
hr |= element.SetAttributeValue(
|
||||
SvgStrings::strokeDashOffsetAttributeName, commonProps.strokeDashoffset.value());
|
||||
}
|
||||
} else if (prop == "strokeLinecap") {
|
||||
if (commonProps.strokeLinecap != std::nullopt) {
|
||||
static D2D1_SVG_LINE_CAP supportedCaps[] = {
|
||||
D2D1_SVG_LINE_CAP_BUTT, D2D1_SVG_LINE_CAP_ROUND, D2D1_SVG_LINE_CAP_SQUARE};
|
||||
hr |= element.SetAttributeValue(
|
||||
SvgStrings::strokeLinecapAttributeName, supportedCaps[commonProps.strokeLinecap.value()]);
|
||||
}
|
||||
} else if (prop == "strokeLinejoin") {
|
||||
if (commonProps.strokeLinejoin != std::nullopt) {
|
||||
static D2D1_SVG_LINE_JOIN supportedJoins[] = {
|
||||
D2D1_SVG_LINE_JOIN_MITER, D2D1_SVG_LINE_JOIN_ROUND, D2D1_SVG_LINE_JOIN_BEVEL};
|
||||
hr |= element.SetAttributeValue(
|
||||
SvgStrings::strokeLinejoinAttributeName, supportedJoins[commonProps.strokeLinejoin.value()]);
|
||||
}
|
||||
} else if (prop == "strokeMiterlimit") {
|
||||
if (commonProps.strokeMiterlimit != std::nullopt) {
|
||||
hr |= element.SetAttributeValue(
|
||||
SvgStrings::strokeMiterLimitAttributeName, commonProps.strokeMiterlimit.value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (commonProps.clipPath != std::nullopt) {
|
||||
std::wstring namedRefStr = L"url(#" + commonProps.clipPath.value() + L")";
|
||||
hr |= element.SetAttributeValue(
|
||||
SvgStrings::clipPathAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
namedRefStr.c_str());
|
||||
}
|
||||
|
||||
if (commonProps.clipRule != std::nullopt) {
|
||||
hr |= element.SetAttributeValue(SvgStrings::clipRuleAttributeName, commonProps.clipRule.value());
|
||||
}
|
||||
|
||||
if (commonProps.name != std::nullopt)
|
||||
hr |= element.SetAttributeValue(
|
||||
SvgStrings::idAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
commonProps.name.value().c_str());
|
||||
|
||||
if (commonProps.opacity != std::nullopt)
|
||||
hr |= element.SetAttributeValue(SvgStrings::opacityAttributeName, commonProps.opacity.value());
|
||||
|
||||
if (commonProps.matrix != std::nullopt) {
|
||||
auto &matrix = commonProps.matrix.value();
|
||||
hr |= element.SetAttributeValue(
|
||||
SvgStrings::transformAttributeName,
|
||||
D2D1_MATRIX_3X2_F{matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]});
|
||||
}
|
||||
|
||||
assert(hr == S_OK);
|
||||
}
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
template <typename TProps, typename TUserData>
|
||||
void RegisterRenderableComponent(
|
||||
const winrt::hstring &name,
|
||||
const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(name, [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
||||
auto userData = winrt::make_self<TUserData>();
|
||||
view.UserData(*userData);
|
||||
});
|
||||
builder.SetCreateProps(
|
||||
[](winrt::Microsoft::ReactNative::ViewProps props, const winrt::Microsoft::ReactNative::IComponentProps &cloneFrom) noexcept { return winrt::make<TProps>(props, cloneFrom); });
|
||||
builder.SetUpdatePropsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &newProps,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
|
||||
auto userData = winrt::get_self<TUserData>(view.UserData());
|
||||
userData->UpdateProps(view, newProps, oldProps);
|
||||
});
|
||||
builder.SetFinalizeUpdateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
const winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept {
|
||||
auto userData = winrt::get_self<TUserData>(view.UserData());
|
||||
userData->FinalizeUpates(view, mask);
|
||||
});
|
||||
builder.SetMountChildComponentViewHandler(
|
||||
[](const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept {
|
||||
auto userData = winrt::get_self<TUserData>(view.UserData());
|
||||
return userData->MountChildComponentView(view, args);
|
||||
});
|
||||
builder.SetUnmountChildComponentViewHandler(
|
||||
[](const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept {
|
||||
auto userData = winrt::get_self<TUserData>(view.UserData());
|
||||
return userData->UnmountChildComponentView(view, args);
|
||||
});
|
||||
});
|
||||
}
|
||||
58
windows/RNSVG/Fabric/SvgStrings.h
Normal file
58
windows/RNSVG/Fabric/SvgStrings.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
namespace winrt::RNSVG::SvgStrings {
|
||||
constexpr wchar_t fillAttributeName[] = L"fill";
|
||||
constexpr wchar_t clipPathAttributeName[] = L"clip-path";
|
||||
constexpr wchar_t clipRuleAttributeName[] = L"clip-rule";
|
||||
constexpr wchar_t fillRuleAttributeName[] = L"fill-rule";
|
||||
|
||||
constexpr wchar_t colorAttributeName[] = L"color";
|
||||
constexpr wchar_t opacityAttributeName[] = L"opacity";
|
||||
constexpr wchar_t fillOpacityAttributeName[] = L"fill-opacity";
|
||||
constexpr wchar_t stopOpacityAttributeName[] = L"stop-opacity";
|
||||
constexpr wchar_t strokeAttributeName[] = L"stroke";
|
||||
constexpr wchar_t strokeWidthAttributeName[] = L"stroke-width";
|
||||
constexpr wchar_t strokeOpacityAttributeName[] = L"stroke-opacity";
|
||||
constexpr wchar_t strokeLinecapAttributeName[] = L"stroke-linecap";
|
||||
constexpr wchar_t strokeLinejoinAttributeName[] = L"stroke-linejoin";
|
||||
constexpr wchar_t strokeDashArrayAttributeName[] = L"stroke-dasharray";
|
||||
constexpr wchar_t strokeDashOffsetAttributeName[] = L"stroke-dashoffset";
|
||||
constexpr wchar_t strokeMiterLimitAttributeName[] = L"stroke-miterlimit";
|
||||
constexpr wchar_t idAttributeName[] = L"id";
|
||||
constexpr wchar_t transformAttributeName[] = L"transform";
|
||||
|
||||
constexpr wchar_t xAttributeName[] = L"x";
|
||||
constexpr wchar_t yAttributeName[] = L"y";
|
||||
constexpr wchar_t widthAttributeName[] = L"width";
|
||||
constexpr wchar_t heightAttributeName[] = L"height";
|
||||
|
||||
constexpr wchar_t cxAttributeName[] = L"cx";
|
||||
constexpr wchar_t cyAttributeName[] = L"cy";
|
||||
constexpr wchar_t rxAttributeName[] = L"rx";
|
||||
constexpr wchar_t ryAttributeName[] = L"ry";
|
||||
|
||||
constexpr wchar_t rAttributeName[] = L"r";
|
||||
constexpr wchar_t fxAttributeName[] = L"fx";
|
||||
constexpr wchar_t fyAttributeName[] = L"fy";
|
||||
|
||||
constexpr wchar_t x1AttributeName[] = L"x1";
|
||||
constexpr wchar_t y1AttributeName[] = L"y1";
|
||||
|
||||
constexpr wchar_t x2AttributeName[] = L"x2";
|
||||
constexpr wchar_t y2AttributeName[] = L"y2";
|
||||
|
||||
constexpr wchar_t gradientUnitsAttributeName[] = L"gradientUnits";
|
||||
constexpr wchar_t gradientTransformAttributeName[] = L"gradientTransform";
|
||||
constexpr wchar_t offsetAttributeName[] = L"offset";
|
||||
constexpr wchar_t stopColorAttributeName[] = L"stop-color";
|
||||
constexpr wchar_t stopAttributeName[] = L"stop";
|
||||
|
||||
constexpr wchar_t xlinkhrefAttributeName[] = L"xlink:href";
|
||||
|
||||
constexpr wchar_t dAttributeName[] = L"d";
|
||||
|
||||
constexpr wchar_t noneAttributeValue[] = L"none";
|
||||
|
||||
constexpr wchar_t viewBoxAttributeName[] = L"viewBox";
|
||||
constexpr wchar_t preserveAspectRatioAttributeName[] = L"preserveAspectRatio";
|
||||
}
|
||||
342
windows/RNSVG/Fabric/SvgView.cpp
Normal file
342
windows/RNSVG/Fabric/SvgView.cpp
Normal file
@@ -0,0 +1,342 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include "SvgView.h"
|
||||
|
||||
#include "D2DHelpers.h"
|
||||
#include "GroupView.h"
|
||||
|
||||
#include <AutoDraw.h>
|
||||
#include <winrt/Microsoft.ReactNative.Composition.Experimental.h>
|
||||
#include <CompositionSwitcher.Experimental.interop.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
|
||||
#include <d3d11_4.h>
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
SvgViewProps::SvgViewProps(const winrt::Microsoft::ReactNative::ViewProps& props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom)
|
||||
: m_props(props)
|
||||
{
|
||||
if (cloneFrom) {
|
||||
auto cloneFromProps = cloneFrom.as<SvgViewProps>();
|
||||
minX = cloneFromProps->minX;
|
||||
minY = cloneFromProps->minY;
|
||||
vbWidth = cloneFromProps->vbWidth;
|
||||
vbHeight = cloneFromProps->vbHeight;
|
||||
align = cloneFromProps->align;
|
||||
meetOrSlice = cloneFromProps->meetOrSlice;
|
||||
color = cloneFromProps->color;
|
||||
}
|
||||
}
|
||||
|
||||
void SvgViewProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
SvgView::SvgView(const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext)
|
||||
: m_compContext(compContext) {}
|
||||
|
||||
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual SvgView::CreateInternalVisual() {
|
||||
m_visual = m_compContext.CreateSpriteVisual();
|
||||
m_visual.Comment(L"SVGRoot");
|
||||
return m_visual;
|
||||
}
|
||||
|
||||
void SvgView::MountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &,
|
||||
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &) noexcept {
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void SvgView::UnmountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &,
|
||||
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &) noexcept {
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void SvgView::OnThemeChanged() noexcept {
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void SvgView::OnMounted() noexcept {
|
||||
m_isMounted = true;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void SvgView::OnUnmounted() noexcept {
|
||||
m_isMounted = false;
|
||||
}
|
||||
|
||||
D2D1_SVG_ASPECT_ALIGN AlignToAspectAlign(const std::string &align) noexcept {
|
||||
if (align.compare("xMinYMin") == 0)
|
||||
return D2D1_SVG_ASPECT_ALIGN::D2D1_SVG_ASPECT_ALIGN_X_MIN_Y_MIN;
|
||||
else if (align.compare("xMidYMin") == 0)
|
||||
return D2D1_SVG_ASPECT_ALIGN::D2D1_SVG_ASPECT_ALIGN_X_MID_Y_MIN;
|
||||
else if (align.compare("xMaxYMin") == 0)
|
||||
return D2D1_SVG_ASPECT_ALIGN::D2D1_SVG_ASPECT_ALIGN_X_MAX_Y_MIN;
|
||||
else if (align.compare("xMinYMid") == 0)
|
||||
return D2D1_SVG_ASPECT_ALIGN::D2D1_SVG_ASPECT_ALIGN_X_MIN_Y_MID;
|
||||
else if (align.compare("xMidYMid") == 0)
|
||||
return D2D1_SVG_ASPECT_ALIGN::D2D1_SVG_ASPECT_ALIGN_X_MID_Y_MID;
|
||||
else if (align.compare("xMaxYMid") == 0)
|
||||
return D2D1_SVG_ASPECT_ALIGN::D2D1_SVG_ASPECT_ALIGN_X_MAX_Y_MID;
|
||||
else if (align.compare("xMinYMax") == 0)
|
||||
return D2D1_SVG_ASPECT_ALIGN::D2D1_SVG_ASPECT_ALIGN_X_MIN_Y_MAX;
|
||||
else if (align.compare("xMidYMax") == 0)
|
||||
return D2D1_SVG_ASPECT_ALIGN::D2D1_SVG_ASPECT_ALIGN_X_MID_Y_MAX;
|
||||
else if (align.compare("xMaxYMax") == 0)
|
||||
return D2D1_SVG_ASPECT_ALIGN::D2D1_SVG_ASPECT_ALIGN_X_MAX_Y_MAX;
|
||||
else if (align.compare("none") == 0)
|
||||
return D2D1_SVG_ASPECT_ALIGN::D2D1_SVG_ASPECT_ALIGN_NONE;
|
||||
|
||||
assert(false);
|
||||
return D2D1_SVG_ASPECT_ALIGN::D2D1_SVG_ASPECT_ALIGN_NONE;
|
||||
}
|
||||
|
||||
void SvgView::UpdateProps(
|
||||
const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &newProps,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps & /*oldProps*/) noexcept {
|
||||
m_props = newProps.as<SvgViewProps>();
|
||||
|
||||
if (m_props->align) {
|
||||
m_aspectAlign = AlignToAspectAlign(m_props->align.value());
|
||||
} else {
|
||||
m_aspectAlign = D2D1_SVG_ASPECT_ALIGN::D2D1_SVG_ASPECT_ALIGN_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void SvgView::FinalizeUpates(
|
||||
const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
|
||||
winrt::Microsoft::ReactNative::ComponentViewUpdateMask) noexcept {
|
||||
Invalidate(); // Move to finalize
|
||||
}
|
||||
|
||||
void SvgView::Initialize(const winrt::Microsoft::ReactNative::ComponentView &sender) noexcept {
|
||||
auto view = sender.as<winrt::Microsoft::ReactNative::Composition::ViewComponentView>();
|
||||
m_wkView = view;
|
||||
|
||||
sender.as<winrt::Microsoft::ReactNative::Composition::Experimental::IInternalCreateVisual>()
|
||||
.CreateInternalVisualHandler([wkThis = get_weak()](const winrt::Microsoft::ReactNative::ComponentView &) {
|
||||
return wkThis.get()->CreateInternalVisual();
|
||||
});
|
||||
|
||||
sender.LayoutMetricsChanged(
|
||||
[wkThis = get_weak()](
|
||||
const winrt::Windows::Foundation::IInspectable &, const winrt::Microsoft::ReactNative::LayoutMetricsChangedArgs &args) {
|
||||
if (auto strongThis = wkThis.get()) {
|
||||
strongThis->UpdateLayoutMetrics(args.NewLayoutMetrics(), args.OldLayoutMetrics());
|
||||
}
|
||||
});
|
||||
|
||||
view.ThemeChanged(
|
||||
[wkThis = get_weak()](const winrt::Windows::Foundation::IInspectable & /*sender*/, const winrt::Windows::Foundation::IInspectable & /*args*/) {
|
||||
if (auto strongThis = wkThis.get()) {
|
||||
strongThis->OnThemeChanged();
|
||||
}
|
||||
});
|
||||
|
||||
view.Mounted([wkThis = get_weak()](
|
||||
const winrt::Windows::Foundation::IInspectable & /*sender*/, const winrt::Microsoft::ReactNative::ComponentView &) {
|
||||
if (auto strongThis = wkThis.get()) {
|
||||
strongThis->OnMounted();
|
||||
}
|
||||
});
|
||||
|
||||
view.Unmounted([wkThis = get_weak()](
|
||||
const winrt::Windows::Foundation::IInspectable & /*sender*/, const winrt::Microsoft::ReactNative::ComponentView &) {
|
||||
if (auto strongThis = wkThis.get()) {
|
||||
strongThis->OnUnmounted();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void SvgView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGSvgView", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &cloneFrom) noexcept {
|
||||
return winrt::make<SvgViewProps>(props, cloneFrom);
|
||||
});
|
||||
auto compBuilder =
|
||||
builder.as<winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder>();
|
||||
|
||||
compBuilder.SetViewComponentViewInitializer(
|
||||
[](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
||||
auto userData = winrt::make_self<SvgView>(
|
||||
view.as<winrt::Microsoft::ReactNative::Composition::Experimental::IInternalComponentView>()
|
||||
.CompositionContext());
|
||||
userData->Initialize(view);
|
||||
view.UserData(*userData);
|
||||
});
|
||||
|
||||
compBuilder.SetViewFeatures(
|
||||
winrt::Microsoft::ReactNative::Composition::ComponentViewFeatures::Default &
|
||||
~winrt::Microsoft::ReactNative::Composition::ComponentViewFeatures::Background);
|
||||
|
||||
builder.SetUpdatePropsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &newProps,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
|
||||
auto userData = winrt::get_self<SvgView>(view.UserData());
|
||||
userData->UpdateProps(view, newProps, oldProps);
|
||||
});
|
||||
|
||||
builder.SetFinalizeUpdateHandler(
|
||||
[](const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
const winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept {
|
||||
auto userData = winrt::get_self<SvgView>(view.UserData());
|
||||
userData->FinalizeUpates(view, mask);
|
||||
});
|
||||
|
||||
builder.SetMountChildComponentViewHandler(
|
||||
[](const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept {
|
||||
auto userData = winrt::get_self<SvgView>(view.UserData());
|
||||
return userData->MountChildComponentView(view, args);
|
||||
});
|
||||
|
||||
builder.SetUnmountChildComponentViewHandler(
|
||||
[](const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept {
|
||||
auto userData = winrt::get_self<SvgView>(view.UserData());
|
||||
return userData->UnmountChildComponentView(view, args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void SvgView::UpdateLayoutMetrics(
|
||||
const winrt::Microsoft::ReactNative::LayoutMetrics &metrics,
|
||||
const winrt::Microsoft::ReactNative::LayoutMetrics &oldMetrics) {
|
||||
m_layoutMetrics = metrics;
|
||||
|
||||
if (metrics != oldMetrics) {
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void RecurseRenderNode(
|
||||
const SvgView *root,
|
||||
const winrt::Microsoft::ReactNative::ComponentView &view,
|
||||
ID2D1SvgDocument &document,
|
||||
ID2D1SvgElement &svgElement) noexcept {
|
||||
for (auto const &child : view.Children()) {
|
||||
{
|
||||
auto renderable = child.UserData().try_as<RenderableView>();
|
||||
|
||||
if (renderable && renderable->IsSupported()) {
|
||||
ID2D1SvgElement &newElement = renderable->Render(*root, document, svgElement);
|
||||
RecurseRenderNode(root, child, document, newElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SvgView::Draw(
|
||||
const winrt::Microsoft::ReactNative::Composition::ViewComponentView &view,
|
||||
ID2D1DeviceContext &context,
|
||||
winrt::Windows::Foundation::Size const &size) noexcept {
|
||||
|
||||
com_ptr<ID2D1DeviceContext> deviceContext;
|
||||
deviceContext.copy_from(&context);
|
||||
|
||||
auto deviceContext5 = deviceContext.as<ID2D1DeviceContext5>();
|
||||
|
||||
winrt::com_ptr<ID2D1SvgDocument> spSvgDocument;
|
||||
deviceContext5->CreateSvgDocument(nullptr, D2D1_SIZE_F{size.Width, size.Height}, spSvgDocument.put());
|
||||
|
||||
winrt::com_ptr<ID2D1SvgElement> spRoot;
|
||||
spSvgDocument->GetRoot(spRoot.put());
|
||||
|
||||
if (m_props->vbWidth != std::nullopt || m_props->vbHeight != std::nullopt) {
|
||||
std::wstring viewBoxStr = std::to_wstring(m_props->minX.value_or(0)) + L" " +
|
||||
std::to_wstring(m_props->minY.value_or(0)) + L" " + std::to_wstring(m_props->vbWidth.value_or(0)) + L" " +
|
||||
std::to_wstring(m_props->vbHeight.value_or(0));
|
||||
spRoot->SetAttributeValue(
|
||||
SvgStrings::viewBoxAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
viewBoxStr.c_str());
|
||||
}
|
||||
|
||||
spRoot->SetAttributeValue(
|
||||
SvgStrings::widthAttributeName, D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG, std::to_wstring(size.Width).c_str());
|
||||
spRoot->SetAttributeValue(
|
||||
SvgStrings::heightAttributeName, D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG, std::to_wstring(size.Height).c_str());
|
||||
|
||||
if (m_props->color) {
|
||||
spRoot->SetAttributeValue(
|
||||
SvgStrings::colorAttributeName, D2DHelpers::AsD2DColor(m_props->color.AsWindowsColor(Theme())));
|
||||
} else
|
||||
spRoot->SetAttributeValue(
|
||||
SvgStrings::colorAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
SvgStrings::noneAttributeValue);
|
||||
|
||||
if (m_props->align != std::nullopt || m_props->meetOrSlice != std::nullopt) {
|
||||
D2D1_SVG_PRESERVE_ASPECT_RATIO preserveAspectRatio;
|
||||
preserveAspectRatio.defer = false;
|
||||
preserveAspectRatio.align = m_aspectAlign;
|
||||
|
||||
preserveAspectRatio.meetOrSlice = m_props->meetOrSlice.value() == MeetOrSlice::Meet
|
||||
? D2D1_SVG_ASPECT_SCALING::D2D1_SVG_ASPECT_SCALING_MEET
|
||||
: D2D1_SVG_ASPECT_SCALING::D2D1_SVG_ASPECT_SCALING_SLICE;
|
||||
spRoot->SetAttributeValue(SvgStrings::preserveAspectRatioAttributeName, preserveAspectRatio);
|
||||
}
|
||||
|
||||
for (auto const &child : view.Children()) {
|
||||
auto renderable = child.UserData().as<RenderableView>();
|
||||
if (renderable->IsSupported()) {
|
||||
RecurseRenderNode(this, child, *spSvgDocument, *spRoot);
|
||||
}
|
||||
}
|
||||
|
||||
deviceContext5->DrawSvgDocument(spSvgDocument.get());
|
||||
}
|
||||
|
||||
winrt::Microsoft::ReactNative::Composition::Theme SvgView::Theme() const noexcept {
|
||||
if (auto view = m_wkView.get()) {
|
||||
return view.Theme();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SvgView::Invalidate() {
|
||||
if (auto view = m_wkView.get()) {
|
||||
auto size = winrt::Windows::Foundation::Size{m_layoutMetrics.Frame.Width, m_layoutMetrics.Frame.Height};
|
||||
|
||||
if (!m_isMounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (size.Height == 0 || size.Width == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto drawingSurface = m_compContext.CreateDrawingSurfaceBrush(
|
||||
size,
|
||||
winrt::Windows::Graphics::DirectX::DirectXPixelFormat::B8G8R8A8UIntNormalized,
|
||||
winrt::Windows::Graphics::DirectX::DirectXAlphaMode::Premultiplied);
|
||||
|
||||
POINT offset;
|
||||
{
|
||||
::Microsoft::ReactNative::Composition::AutoDrawDrawingSurface autoDraw(drawingSurface, 1.0, &offset);
|
||||
if (auto deviceContext = autoDraw.GetRenderTarget()) {
|
||||
auto transform =
|
||||
winrt::Windows::Foundation::Numerics::make_float3x2_translation({static_cast<float>(offset.x), static_cast<float>(offset.y)});
|
||||
deviceContext->SetTransform(D2DHelpers::AsD2DTransform(transform));
|
||||
|
||||
deviceContext->Clear(D2D1::ColorF(D2D1::ColorF::Black, 0.0f));
|
||||
|
||||
com_ptr<ID2D1DeviceContext> spDeviceContext;
|
||||
spDeviceContext.copy_from(deviceContext);
|
||||
|
||||
Draw(view, *spDeviceContext, size);
|
||||
}
|
||||
}
|
||||
|
||||
m_visual.Brush(drawingSurface);
|
||||
}
|
||||
}
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
107
windows/RNSVG/Fabric/SvgView.h
Normal file
107
windows/RNSVG/Fabric/SvgView.h
Normal file
@@ -0,0 +1,107 @@
|
||||
#pragma once
|
||||
|
||||
#include <unknwn.h>
|
||||
|
||||
#include <d2d1_3.h>
|
||||
#include <NativeModules.h>
|
||||
#pragma push_macro("X86")
|
||||
#undef X86
|
||||
#include <winrt/Microsoft.ReactNative.Composition.Experimental.h>
|
||||
#include <winrt/Microsoft.ReactNative.h>
|
||||
#include <JSValueComposition.h>
|
||||
#pragma pop_macro("X86")
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
D2D1_SVG_ASPECT_ALIGN AlignToAspectAlign(const std::string &align) noexcept;
|
||||
|
||||
enum class MeetOrSlice {
|
||||
Meet = 0,
|
||||
Slice = 1,
|
||||
};
|
||||
|
||||
REACT_STRUCT(SvgViewProps)
|
||||
struct SvgViewProps : winrt::implements<SvgViewProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
SvgViewProps(const winrt::Microsoft::ReactNative::ViewProps &props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept;
|
||||
|
||||
REACT_FIELD(minX)
|
||||
std::optional<float> minX;
|
||||
REACT_FIELD(minY)
|
||||
std::optional<float> minY;
|
||||
REACT_FIELD(vbWidth)
|
||||
std::optional<float> vbWidth;
|
||||
REACT_FIELD(vbHeight)
|
||||
std::optional<float> vbHeight;
|
||||
REACT_FIELD(align)
|
||||
std::optional<std::string> align;
|
||||
REACT_FIELD(meetOrSlice)
|
||||
std::optional<MeetOrSlice> meetOrSlice;
|
||||
REACT_FIELD(color)
|
||||
winrt::Microsoft::ReactNative::Color color{nullptr};
|
||||
private:
|
||||
winrt::Microsoft::ReactNative::ViewProps m_props{nullptr};
|
||||
};
|
||||
|
||||
struct __declspec(uuid("ed381ffa-461a-48Bf-a3c0-5d9a42eecd30")) ISvgView : public ::IUnknown {
|
||||
virtual void Invalidate() = 0;
|
||||
};
|
||||
|
||||
struct SvgView : winrt::implements<SvgView, winrt::Windows::Foundation::IInspectable, ISvgView> {
|
||||
public:
|
||||
|
||||
SvgView(const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext);
|
||||
|
||||
// Overrides
|
||||
// IInternalCreateVisual
|
||||
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual CreateInternalVisual();
|
||||
|
||||
// ComponentView
|
||||
void UpdateProps(
|
||||
const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &newProps,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps & /*oldProps*/) noexcept;
|
||||
void UpdateLayoutMetrics(
|
||||
const winrt::Microsoft::ReactNative::LayoutMetrics &metrics,
|
||||
const winrt::Microsoft::ReactNative::LayoutMetrics &oldMetrics);
|
||||
void MountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView& view,
|
||||
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs& args) noexcept;
|
||||
void UnmountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView& view,
|
||||
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs& args) noexcept;
|
||||
|
||||
void FinalizeUpates(
|
||||
const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
|
||||
winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept;
|
||||
|
||||
void OnThemeChanged() noexcept;
|
||||
void OnMounted() noexcept;
|
||||
void OnUnmounted() noexcept;
|
||||
|
||||
void Initialize(const winrt::Microsoft::ReactNative::ComponentView & /*view*/) noexcept;
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
void Invalidate();
|
||||
winrt::Microsoft::ReactNative::Composition::Theme Theme() const noexcept;
|
||||
|
||||
private:
|
||||
void Draw(
|
||||
const winrt::Microsoft::ReactNative::Composition::ViewComponentView &view,
|
||||
ID2D1DeviceContext &context,
|
||||
winrt::Windows::Foundation::Size const &size) noexcept;
|
||||
|
||||
bool m_isMounted{false};
|
||||
winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual m_visual{nullptr};
|
||||
winrt::Microsoft::ReactNative::LayoutMetrics m_layoutMetrics{{0, 0, 0, 0}, 1.0};
|
||||
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext m_compContext{nullptr};
|
||||
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::ViewComponentView> m_wkView;
|
||||
D2D1_SVG_ASPECT_ALIGN m_aspectAlign;
|
||||
winrt::com_ptr<SvgViewProps> m_props;
|
||||
|
||||
// Shared
|
||||
Microsoft::ReactNative::IReactContext m_reactContext{nullptr};
|
||||
};
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
33
windows/RNSVG/Fabric/UnsupportedSvgView.cpp
Normal file
33
windows/RNSVG/Fabric/UnsupportedSvgView.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "pch.h"
|
||||
#include "UnsupportedSvgView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
REACT_STRUCT(UnsupportedProps)
|
||||
struct UnsupportedProps : public winrt::implements<UnsupportedProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
UnsupportedProps(const winrt::Microsoft::ReactNative::ViewProps &/*props*/, const winrt::Microsoft::ReactNative::IComponentProps& /*cloneFrom*/) {}
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
};
|
||||
|
||||
struct UnsupportedSvgView : winrt::implements<UnsupportedSvgView, winrt::Windows::Foundation::IInspectable, RenderableView> {
|
||||
public:
|
||||
UnsupportedSvgView() = default;
|
||||
|
||||
const wchar_t *GetSvgElementName() noexcept override{
|
||||
assert(false);
|
||||
return L"unsupported";
|
||||
}
|
||||
|
||||
bool IsSupported() const noexcept override {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
void RegisterUnsupportedSvgComponent(const winrt::hstring& name, const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
RegisterRenderableComponent<UnsupportedProps, UnsupportedSvgView>(name, builder);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
9
windows/RNSVG/Fabric/UnsupportedSvgView.h
Normal file
9
windows/RNSVG/Fabric/UnsupportedSvgView.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
void RegisterUnsupportedSvgComponent(const winrt::hstring& name, const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
64
windows/RNSVG/Fabric/UseView.cpp
Normal file
64
windows/RNSVG/Fabric/UseView.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
#include "pch.h"
|
||||
#include "UseView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
REACT_STRUCT(UseProps)
|
||||
struct UseProps : winrt::implements<UseProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
||||
UseProps(const winrt::Microsoft::ReactNative::ViewProps &props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) REACT_SVG_RENDERABLE_COMMON_PROPS_INIT
|
||||
{
|
||||
REACT_BEGIN_SVG_RENDERABLE_COMMON_PROPS_CLONE(UseProps)
|
||||
href = cloneFromProps->href;
|
||||
x = cloneFromProps->x;
|
||||
y = cloneFromProps->y;
|
||||
width = cloneFromProps->width;
|
||||
height = cloneFromProps->height;
|
||||
REACT_END_SVG_RENDERABLE_COMMON_PROPS_CLONE
|
||||
}
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(href)
|
||||
std::wstring href;
|
||||
REACT_FIELD(x)
|
||||
D2D1_SVG_LENGTH x{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
REACT_FIELD(y)
|
||||
D2D1_SVG_LENGTH y{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
REACT_FIELD(width)
|
||||
D2D1_SVG_LENGTH width{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
REACT_FIELD(height)
|
||||
D2D1_SVG_LENGTH height{0, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
};
|
||||
|
||||
struct UseView : winrt::implements<UseView, winrt::Windows::Foundation::IInspectable, RenderableView> {
|
||||
public:
|
||||
UseView() = default;
|
||||
|
||||
const wchar_t *GetSvgElementName() noexcept override {
|
||||
return L"use";
|
||||
}
|
||||
|
||||
void OnRender(const SvgView &svgView, ID2D1SvgDocument &document, ID2D1SvgElement &element) noexcept override {
|
||||
auto props = m_props.as<UseProps>();
|
||||
SetCommonSvgProps(svgView, document, element, *props);
|
||||
element.SetAttributeValue(
|
||||
SvgStrings::xlinkhrefAttributeName,
|
||||
D2D1_SVG_ATTRIBUTE_STRING_TYPE::D2D1_SVG_ATTRIBUTE_STRING_TYPE_SVG,
|
||||
(L"#" + props->href).c_str());
|
||||
|
||||
element.SetAttributeValue(SvgStrings::xAttributeName, props->x);
|
||||
element.SetAttributeValue(SvgStrings::yAttributeName, props->y);
|
||||
element.SetAttributeValue(SvgStrings::widthAttributeName, props->width);
|
||||
element.SetAttributeValue(SvgStrings::heightAttributeName, props->height);
|
||||
}
|
||||
};
|
||||
|
||||
void RegisterUseComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
RegisterRenderableComponent<UseProps, UseView>(L"RNSVGUse", builder);
|
||||
}
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
10
windows/RNSVG/Fabric/UseView.h
Normal file
10
windows/RNSVG/Fabric/UseView.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
void RegisterUseComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
@@ -14,87 +14,7 @@ using namespace winrt;
|
||||
using namespace Microsoft::ReactNative;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
#ifdef USE_FABRIC
|
||||
SvgGroupCommonProps::SvgGroupCommonProps(
|
||||
const winrt::Microsoft::ReactNative::ViewProps &props)
|
||||
: base_type(props) {}
|
||||
|
||||
void SvgGroupCommonProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
GroupView::GroupView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args)
|
||||
: base_type(args), m_reactContext(args.ReactContext()) {}
|
||||
|
||||
void GroupView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGGroup", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::SvgGroupCommonProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView(
|
||||
[](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::GroupView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void GroupView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto groupProps = props.as<SvgGroupCommonProps>();
|
||||
auto oldGroupProps = oldProps ? oldProps.as<SvgGroupCommonProps>() : nullptr;
|
||||
|
||||
auto const &parent{Parent().try_as<RNSVG::GroupView>()};
|
||||
|
||||
if (!oldGroupProps || groupProps->font != oldGroupProps->font) {
|
||||
if (forceUpdate || !m_fontPropMap[RNSVG::FontProp::FontSize]) {
|
||||
if (groupProps->font.fontSize) {
|
||||
m_fontSize = groupProps->font.fontSize != std::nullopt
|
||||
? *groupProps->font.fontSize
|
||||
: (parent ? parent.FontSize() : 12.0f);
|
||||
}
|
||||
|
||||
m_fontPropMap[RNSVG::FontProp::FontSize] = !!groupProps->font.fontSize;
|
||||
}
|
||||
|
||||
if (forceUpdate || !m_fontPropMap[RNSVG::FontProp::FontFamily]) {
|
||||
if (groupProps->font.fontFamily) {
|
||||
m_fontFamily = !(*groupProps->font.fontFamily).empty()
|
||||
? winrt::to_hstring(*groupProps->font.fontFamily)
|
||||
: (parent ? parent.FontFamily() : L"Segoe UI");
|
||||
|
||||
m_fontPropMap[RNSVG::FontProp::FontFamily] = !(*groupProps->font.fontFamily).empty();
|
||||
}
|
||||
}
|
||||
|
||||
if (forceUpdate || !m_fontPropMap[RNSVG::FontProp::FontWeight]) {
|
||||
if (groupProps->font.fontWeight) {
|
||||
m_fontWeight = !(*groupProps->font.fontWeight).empty()
|
||||
? winrt::to_hstring(*groupProps->font.fontWeight)
|
||||
: (parent ? parent.FontWeight() : L"auto");
|
||||
|
||||
m_fontPropMap[RNSVG::FontProp::FontWeight] = !(*groupProps->font.fontWeight).empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, false);
|
||||
|
||||
for (auto const &child : Children()) {
|
||||
child.as<IRenderableFabric>().UpdateProperties(props, oldProps, false, false);
|
||||
}
|
||||
|
||||
if (invalidate && Parent()) {
|
||||
SvgRoot().Invalidate();
|
||||
}
|
||||
}
|
||||
#else
|
||||
void GroupView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
|
||||
@@ -180,7 +100,6 @@ void GroupView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate,
|
||||
SvgRoot().Invalidate();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void GroupView::CreateGeometry(RNSVG::D2DDeviceContext const &context) {
|
||||
std::vector<ID2D1Geometry *> geometries;
|
||||
@@ -274,12 +193,9 @@ void GroupView::Unload() {
|
||||
child.as<IRenderable>().Unload();
|
||||
}
|
||||
|
||||
m_reactContext = nullptr;
|
||||
m_fontPropMap.clear();
|
||||
|
||||
#ifndef USE_FABRIC
|
||||
m_children.Clear();
|
||||
#endif
|
||||
|
||||
__super::Unload();
|
||||
}
|
||||
|
||||
@@ -2,108 +2,19 @@
|
||||
#include "GroupView.g.h"
|
||||
#include "RenderableView.h"
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "SvgGroupCommonProps.g.h"
|
||||
#endif
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(FontObject)
|
||||
struct FontObject {
|
||||
REACT_FIELD(fontStyle)
|
||||
std::optional<std::string> fontStyle;
|
||||
REACT_FIELD(fontVariant)
|
||||
std::optional<std::string> fontVariant;
|
||||
REACT_FIELD(fontWeight)
|
||||
std::optional<std::string> fontWeight;
|
||||
REACT_FIELD(fontStretch)
|
||||
std::optional<std::string> fontStretch;
|
||||
REACT_FIELD(fontSize)
|
||||
std::optional<float> fontSize;
|
||||
REACT_FIELD(fontFamily)
|
||||
std::optional<std::string> fontFamily;
|
||||
REACT_FIELD(textAnchor)
|
||||
std::optional<std::string> textAnchor;
|
||||
REACT_FIELD(textDecoration)
|
||||
std::optional<std::string> textDecoration;
|
||||
REACT_FIELD(letterSpacing)
|
||||
std::optional<float> letterSpacing;
|
||||
REACT_FIELD(wordSpacing)
|
||||
std::optional<float> wordSpacing;
|
||||
REACT_FIELD(kerning)
|
||||
std::optional<float> kerning;
|
||||
REACT_FIELD(fontFeatureSettings)
|
||||
std::optional<std::string> fontFeatureSettings;
|
||||
REACT_FIELD(fontVariantLigatures)
|
||||
std::optional<std::string> fontVariantLigatures;
|
||||
REACT_FIELD(fontVariationSettings)
|
||||
std::optional<std::string> fontVariationSettings;
|
||||
|
||||
bool operator==(const FontObject &rhs) const {
|
||||
return fontStyle == rhs.fontStyle && fontVariant == rhs.fontVariant &&
|
||||
fontWeight == rhs.fontWeight && fontStretch == rhs.fontStretch &&
|
||||
fontSize == rhs.fontSize && fontFamily == rhs.fontFamily &&
|
||||
textAnchor == rhs.textAnchor && textDecoration == rhs.textDecoration &&
|
||||
letterSpacing == rhs.letterSpacing && wordSpacing == rhs.wordSpacing &&
|
||||
kerning == rhs.kerning &&
|
||||
fontFeatureSettings == rhs.fontFeatureSettings &&
|
||||
fontVariantLigatures == rhs.fontVariantLigatures &&
|
||||
fontVariationSettings == rhs.fontVariationSettings;
|
||||
}
|
||||
|
||||
bool operator!=(const FontObject &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
};
|
||||
|
||||
#define REACT_SVG_GROUP_COMMON_PROPS \
|
||||
REACT_FIELD(fontSize) \
|
||||
REACT_FIELD(fontWeight) \
|
||||
REACT_FIELD(font)
|
||||
|
||||
REACT_STRUCT(SvgGroupCommonProps)
|
||||
struct SvgGroupCommonProps
|
||||
: SvgGroupCommonPropsT<SvgGroupCommonProps, SvgRenderableCommonProps> {
|
||||
SvgGroupCommonProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
REACT_SVG_GROUP_COMMON_PROPS;
|
||||
|
||||
std::string fontSize;
|
||||
std::string fontWeight;
|
||||
FontObject font;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct GroupView
|
||||
: GroupViewT<GroupView, RNSVG::implementation::RenderableView> {
|
||||
public:
|
||||
GroupView() = default;
|
||||
#ifdef USE_FABRIC
|
||||
GroupView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#else
|
||||
GroupView(Microsoft::ReactNative::IReactContext const &context) : m_reactContext(context) {}
|
||||
GroupView(Microsoft::ReactNative::IReactContext const & /*context*/) {}
|
||||
|
||||
Windows::Foundation::Collections::IVector<RNSVG::IRenderable> Children() { return m_children; }
|
||||
|
||||
// IRenderablePaper
|
||||
virtual void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
hstring FontFamily() { return m_fontFamily; }
|
||||
void FontFamily(hstring const &value) { m_fontFamily = value; }
|
||||
@@ -126,12 +37,9 @@ struct GroupView
|
||||
virtual void DrawGroup(RNSVG::D2DDeviceContext const &deviceContext, Windows::Foundation::Size const &size);
|
||||
|
||||
private:
|
||||
Microsoft::ReactNative::IReactContext m_reactContext{nullptr};
|
||||
|
||||
#ifndef USE_FABRIC
|
||||
Windows::Foundation::Collections::IVector<RNSVG::IRenderable> m_children{
|
||||
winrt::single_threaded_vector<RNSVG::IRenderable>()};
|
||||
#endif
|
||||
|
||||
float m_fontSize{12.0f};
|
||||
hstring m_fontFamily{L"Segoe UI"};
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
#include <d2d1effects.h>
|
||||
#include <shcore.h>
|
||||
|
||||
#ifndef USE_FABRIC
|
||||
#include <wincodec.h>
|
||||
#endif
|
||||
|
||||
using namespace winrt::Microsoft::ReactNative;
|
||||
using namespace winrt::Windows::Security::Cryptography;
|
||||
@@ -25,64 +23,6 @@ using namespace winrt::Windows::Web::Http;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
ImageProps::ImageProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void ImageProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
ImageView::ImageView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void ImageView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGImage", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::ImageProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::ImageView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void ImageView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto imageProps = props.try_as<ImageProps>();
|
||||
auto oldImageProps = oldProps.try_as<ImageProps>();
|
||||
if (imageProps) {
|
||||
m_props = imageProps;
|
||||
|
||||
m_x = m_props->x;
|
||||
m_y = m_props->y;
|
||||
m_width = m_props->width;
|
||||
m_height = m_props->height;
|
||||
|
||||
// preserveAspectRatio
|
||||
m_align = m_props->align;
|
||||
m_meetOrSlice = m_props->meetOrSlice;
|
||||
|
||||
// IamgeSource
|
||||
m_source.uri = m_props->src.uri;
|
||||
m_source.method = m_props->src.method;
|
||||
m_source.width = m_props->src.width;
|
||||
m_source.height = m_props->src.height;
|
||||
m_source.scale = m_props->src.scale;
|
||||
|
||||
if (!oldImageProps || (oldImageProps->src.uri != imageProps->src.uri)) {
|
||||
LoadImageSourceAsync(true);
|
||||
}
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
}
|
||||
#else
|
||||
void ImageView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
|
||||
@@ -141,7 +81,6 @@ void ImageView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate,
|
||||
|
||||
__super::UpdateProperties(reader, forceUpdate, invalidate);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ImageView::Draw(RNSVG::D2DDeviceContext const &context, Size const &size) {
|
||||
if (!m_wicbitmap) {
|
||||
@@ -302,7 +241,6 @@ IAsyncOperation<InMemoryRandomAccessStream> ImageView::GetImageStreamAsync(
|
||||
Uri uri{winrt::to_hstring(source.uri)};
|
||||
HttpRequestMessage request{httpMethod, uri};
|
||||
|
||||
#ifndef USE_FABRIC
|
||||
if (!source.headers.empty()) {
|
||||
for (auto const &header : source.headers) {
|
||||
if (_stricmp(to_string(header.first).c_str(), "authorization") == 0) {
|
||||
@@ -312,7 +250,6 @@ IAsyncOperation<InMemoryRandomAccessStream> ImageView::GetImageStreamAsync(
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
HttpClient httpClient;
|
||||
HttpResponseMessage response{co_await httpClient.SendRequestAsync(request)};
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "ImageProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "ImageView.g.h"
|
||||
#include "RenderableView.h"
|
||||
|
||||
@@ -13,65 +9,6 @@ namespace winrt::RNSVG::implementation {
|
||||
enum class ImageSourceType { Uri = 0, Download = 1, InlineData = 2 };
|
||||
enum class ImageSourceFormat { Bitmap = 0, Svg = 1 };
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(ImageSource)
|
||||
struct ImageSource {
|
||||
REACT_FIELD(uri)
|
||||
std::string uri{""};
|
||||
REACT_FIELD(method)
|
||||
std::string method{""};
|
||||
//REACT_FIELD(headers)
|
||||
//std::vector<winrt::Microsoft::ReactNative::JSValue> headers;
|
||||
REACT_FIELD(body)
|
||||
std::string body{""};
|
||||
REACT_FIELD(width)
|
||||
float width{0.0f};
|
||||
REACT_FIELD(height)
|
||||
float height{0.0f};
|
||||
REACT_FIELD(scale)
|
||||
float scale{1.0f};
|
||||
/*REACT_FIELD(packagerAsset)
|
||||
bool packagerAsset{false};
|
||||
REACT_FIELD(type)
|
||||
ImageSourceType type{ImageSourceType::Uri};
|
||||
REACT_FIELD(format)
|
||||
ImageSourceFormat format{ImageSourceFormat::Bitmap};*/
|
||||
|
||||
bool operator==(const ImageSource &rhs) const {
|
||||
return uri == rhs.uri && method == rhs.method && width == rhs.width && height == rhs.height && scale == rhs.scale;
|
||||
}
|
||||
|
||||
bool operator!=(const ImageSource &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
};
|
||||
|
||||
REACT_STRUCT(ImageProps)
|
||||
struct ImageProps : ImagePropsT<ImageProps, SvgRenderableCommonProps> {
|
||||
ImageProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(x)
|
||||
RNSVG::SVGLength x{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(y)
|
||||
RNSVG::SVGLength y{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(width)
|
||||
RNSVG::SVGLength width{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(height)
|
||||
RNSVG::SVGLength height{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(src)
|
||||
ImageSource src;
|
||||
REACT_FIELD(align)
|
||||
std::string align{""};
|
||||
REACT_FIELD(meetOrSlice)
|
||||
RNSVG::MeetOrSlice meetOrSlice{RNSVG::MeetOrSlice::Meet};
|
||||
};
|
||||
#else
|
||||
struct ImageSource {
|
||||
std::string uri{""};
|
||||
std::string method{""};
|
||||
@@ -83,27 +20,13 @@ struct ImageSource {
|
||||
ImageSourceType type{ImageSourceType::Uri};
|
||||
ImageSourceFormat format{ImageSourceFormat::Bitmap};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct ImageView : ImageViewT<ImageView, RNSVG::implementation::RenderableView> {
|
||||
public:
|
||||
ImageView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
ImageView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#else
|
||||
// IRenderablePaper
|
||||
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void Draw(RNSVG::D2DDeviceContext const &deviceContext, Windows::Foundation::Size const &size);
|
||||
@@ -119,10 +42,6 @@ struct ImageView : ImageViewT<ImageView, RNSVG::implementation::RenderableView>
|
||||
ImageSourceType m_type{ImageSourceType::Uri};
|
||||
ImageSourceFormat m_format{ImageSourceFormat::Bitmap};
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<ImageProps> m_props;
|
||||
#endif
|
||||
|
||||
// preserveAspectRatio
|
||||
std::string m_align{""};
|
||||
RNSVG::MeetOrSlice m_meetOrSlice{RNSVG::MeetOrSlice::Meet};
|
||||
|
||||
@@ -12,48 +12,6 @@ using namespace Microsoft::ReactNative;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
LineProps::LineProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void LineProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
LineView::LineView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void LineView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGLine", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::LineProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::LineView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void LineView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto lineProps = props.try_as<LineProps>();
|
||||
if (lineProps) {
|
||||
m_props = lineProps;
|
||||
|
||||
m_x1 = m_props->x1;
|
||||
m_y1 = m_props->y1;
|
||||
m_x2 = m_props->x2;
|
||||
m_y2 = m_props->y2;
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
}
|
||||
#else
|
||||
void LineView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
|
||||
@@ -74,7 +32,6 @@ void LineView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate,
|
||||
|
||||
__super::UpdateProperties(reader, forceUpdate, invalidate);
|
||||
}
|
||||
#endif
|
||||
|
||||
void LineView::CreateGeometry(RNSVG::D2DDeviceContext const &context) {
|
||||
auto const &root{SvgRoot()};
|
||||
|
||||
@@ -1,55 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "LineProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "LineView.g.h"
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(LineProps)
|
||||
struct LineProps : LinePropsT<LineProps, SvgRenderableCommonProps> {
|
||||
LineProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(x1)
|
||||
RNSVG::SVGLength x1{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(y1)
|
||||
RNSVG::SVGLength y1{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(x2)
|
||||
RNSVG::SVGLength x2{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(y2)
|
||||
RNSVG::SVGLength y2{0, winrt::RNSVG::LengthType::Unknown};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct LineView : LineViewT<LineView, RNSVG::implementation::RenderableView> {
|
||||
public:
|
||||
LineView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
LineView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#else
|
||||
// IRenderablePaper
|
||||
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void CreateGeometry(RNSVG::D2DDeviceContext const &context);
|
||||
@@ -59,13 +20,9 @@ struct LineView : LineViewT<LineView, RNSVG::implementation::RenderableView> {
|
||||
RNSVG::SVGLength m_y1{};
|
||||
RNSVG::SVGLength m_x2{};
|
||||
RNSVG::SVGLength m_y2{};
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<LineProps> m_props;
|
||||
#endif
|
||||
|
||||
};
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
namespace winrt::RNSVG::factory_implementation {
|
||||
struct LineView : LineViewT<LineView, implementation::LineView> {};
|
||||
} // namespace winrt::RNSVG::factory_implementation
|
||||
|
||||
@@ -11,54 +11,6 @@ using namespace Microsoft::ReactNative;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
LinearGradientProps::LinearGradientProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void LinearGradientProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
LinearGradientView::LinearGradientView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void LinearGradientView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGLinearGradient", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::LinearGradientProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::LinearGradientView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void LinearGradientView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto linearGradientProps = props.try_as<LinearGradientProps>();
|
||||
if (linearGradientProps) {
|
||||
m_props = linearGradientProps;
|
||||
|
||||
m_x1 = m_props->x1;
|
||||
m_y1 = m_props->y1;
|
||||
m_x2 = m_props->x2;
|
||||
m_y2 = m_props->y2;
|
||||
|
||||
m_stops = Utils::JSValueAsGradientStops(m_props->gradient);
|
||||
m_gradientUnits = Utils::JSValueAsBrushUnits(m_props->gradientUnits);
|
||||
m_transform = Utils::JSValueAsD2DTransform(m_props->gradientTransform);
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
|
||||
SaveDefinition();
|
||||
}
|
||||
#else
|
||||
void LinearGradientView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
|
||||
@@ -91,7 +43,6 @@ void LinearGradientView::UpdateProperties(IJSValueReader const &reader, bool for
|
||||
|
||||
SaveDefinition();
|
||||
}
|
||||
#endif
|
||||
|
||||
void LinearGradientView::Unload() {
|
||||
m_stops.clear();
|
||||
|
||||
@@ -1,62 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "LinearGradientProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "LinearGradientView.g.h"
|
||||
#include "BrushView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(LinearGradientProps)
|
||||
struct LinearGradientProps : LinearGradientPropsT<LinearGradientProps, SvgGroupCommonProps> {
|
||||
LinearGradientProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
REACT_SVG_GROUP_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(x1)
|
||||
RNSVG::SVGLength x1{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(y1)
|
||||
RNSVG::SVGLength y1{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(x2)
|
||||
RNSVG::SVGLength x2{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(y2)
|
||||
RNSVG::SVGLength y2{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(gradient)
|
||||
std::optional<std::vector<float>> gradient{};
|
||||
REACT_FIELD(gradientUnits)
|
||||
std::optional<int32_t> gradientUnits;
|
||||
REACT_FIELD(gradientTransform)
|
||||
std::optional<std::vector<float>> gradientTransform;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct LinearGradientView : LinearGradientViewT<LinearGradientView, RNSVG::implementation::BrushView> {
|
||||
public:
|
||||
LinearGradientView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
LinearGradientView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#else
|
||||
// IRenderablePaper
|
||||
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void Unload();
|
||||
@@ -69,10 +23,6 @@ struct LinearGradientView : LinearGradientViewT<LinearGradientView, RNSVG::imple
|
||||
std::vector<D2D1_GRADIENT_STOP> m_stops{};
|
||||
std::string m_gradientUnits{"objectBoundingBox"};
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<LinearGradientProps> m_props;
|
||||
#endif
|
||||
|
||||
// BrushView
|
||||
void CreateBrush();
|
||||
void UpdateBounds();
|
||||
|
||||
@@ -8,43 +8,5 @@ using namespace winrt;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
MarkerProps::MarkerProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void MarkerProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
MarkerView::MarkerView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void MarkerView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGMarker", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::MarkerProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::MarkerView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void MarkerView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto markerProps = props.try_as<MarkerProps>();
|
||||
if (markerProps) {
|
||||
m_props = markerProps;
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
@@ -1,78 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "MarkerProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "MarkerView.g.h"
|
||||
#include "GroupView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(MarkerProps)
|
||||
struct MarkerProps : MarkerPropsT<MarkerProps, SvgGroupCommonProps> {
|
||||
MarkerProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(refX)
|
||||
RNSVG::SVGLength refX{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(refY)
|
||||
RNSVG::SVGLength refY{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(markerHeight)
|
||||
RNSVG::SVGLength markerHeight{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(markerWidth)
|
||||
RNSVG::SVGLength markerWidth{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(markerUnits)
|
||||
std::string markerUnits{""};
|
||||
REACT_FIELD(orient)
|
||||
std::string orient{""};
|
||||
REACT_FIELD(minX)
|
||||
float minX{0.0f};
|
||||
REACT_FIELD(minY)
|
||||
float minY{0.0f};
|
||||
REACT_FIELD(vbWidth)
|
||||
float vbWidth{0.0f};
|
||||
REACT_FIELD(vbHeight)
|
||||
float vbHeight{0.0f};
|
||||
REACT_FIELD(align)
|
||||
std::string align{""};
|
||||
REACT_FIELD(meetOrSlice)
|
||||
RNSVG::MeetOrSlice meetOrSlice{RNSVG::MeetOrSlice::Meet};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct MarkerView : MarkerViewT<MarkerView, RNSVG::implementation::GroupView> {
|
||||
public:
|
||||
MarkerView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
MarkerView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void Draw(RNSVG::D2DDeviceContext const & /*deviceContext*/, Windows::Foundation::Size const & /*size*/){};
|
||||
|
||||
private:
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<MarkerProps> m_props;
|
||||
#endif
|
||||
|
||||
};
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
|
||||
@@ -8,43 +8,4 @@ using namespace winrt;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
MaskProps::MaskProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void MaskProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
MaskView::MaskView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void MaskView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGMask", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::MaskProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::MaskView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void MaskView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto maskProps = props.try_as<MaskProps>();
|
||||
if (maskProps) {
|
||||
m_props = maskProps;
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
@@ -1,66 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "MaskProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "MaskView.g.h"
|
||||
#include "GroupView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(MaskProps)
|
||||
struct MaskProps : MaskPropsT<MaskProps, SvgGroupCommonProps> {
|
||||
MaskProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(x)
|
||||
RNSVG::SVGLength x{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(y)
|
||||
RNSVG::SVGLength y{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(height)
|
||||
RNSVG::SVGLength height{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(width)
|
||||
RNSVG::SVGLength width{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(maskUnits)
|
||||
uint32_t maskUnits{0};
|
||||
REACT_FIELD(maskContentUnits)
|
||||
uint32_t maskContentUnits{0};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct MaskView : MaskViewT<MaskView, RNSVG::implementation::GroupView> {
|
||||
public:
|
||||
MaskView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
MaskView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void Draw(RNSVG::D2DDeviceContext const & /*deviceContext*/, Windows::Foundation::Size const & /*size*/){};
|
||||
|
||||
private:
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<MaskProps> m_props;
|
||||
#endif
|
||||
|
||||
};
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
|
||||
@@ -15,49 +15,6 @@ using namespace Microsoft::ReactNative;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
PathProps::PathProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void PathProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
PathView::PathView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void PathView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGPath", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::PathProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::PathView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void PathView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
|
||||
auto pathProps = props.try_as<PathProps>();
|
||||
if (pathProps) {
|
||||
m_props = pathProps;
|
||||
|
||||
m_d = m_props->d;
|
||||
m_commands.clear();
|
||||
m_segmentData.clear();
|
||||
ParsePath();
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
}
|
||||
#else
|
||||
void PathView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
|
||||
@@ -81,7 +38,6 @@ void PathView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate,
|
||||
|
||||
__super::UpdateProperties(reader, forceUpdate, invalidate);
|
||||
}
|
||||
#endif
|
||||
|
||||
void PathView::CreateGeometry(RNSVG::D2DDeviceContext const &context) {
|
||||
auto const &root{SvgRoot()};
|
||||
|
||||
@@ -1,49 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "PathProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "PathView.g.h"
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(PathProps)
|
||||
struct PathProps : PathPropsT<PathProps, SvgRenderableCommonProps> {
|
||||
PathProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(d)
|
||||
std::string d;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct PathView : PathViewT<PathView, RNSVG::implementation::RenderableView> {
|
||||
public:
|
||||
PathView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
PathView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#else
|
||||
// IRenderablePaper
|
||||
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void CreateGeometry(RNSVG::D2DDeviceContext const &context);
|
||||
@@ -53,10 +20,6 @@ struct PathView : PathViewT<PathView, RNSVG::implementation::RenderableView> {
|
||||
std::vector<float> m_segmentData;
|
||||
std::vector<D2D1_SVG_PATH_COMMAND> m_commands;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<PathProps> m_props;
|
||||
#endif
|
||||
|
||||
std::unordered_map<char, D2D1_SVG_PATH_COMMAND> m_cmds{
|
||||
{'M', D2D1_SVG_PATH_COMMAND_MOVE_ABSOLUTE},
|
||||
{'m', D2D1_SVG_PATH_COMMAND_MOVE_RELATIVE},
|
||||
|
||||
@@ -12,67 +12,6 @@ using namespace Microsoft::ReactNative;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
PatternProps::PatternProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void PatternProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
PatternView::PatternView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void PatternView::RegisterComponent(
|
||||
const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGPattern", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::PatternProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::PatternView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void PatternView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto patternProps = props.try_as<PatternProps>();
|
||||
if (patternProps) {
|
||||
m_props = patternProps;
|
||||
|
||||
m_x = m_props->x;
|
||||
m_y = m_props->y;
|
||||
m_width = m_props->width;
|
||||
m_height = m_props->height;
|
||||
|
||||
m_minX = m_props->minX;
|
||||
m_minY = m_props->minY;
|
||||
m_vbWidth = m_props->vbWidth;
|
||||
m_vbHeight = m_props->vbHeight;
|
||||
m_align = m_props->align;
|
||||
m_meetOrSlice = m_props->meetOrSlice;
|
||||
|
||||
m_patternUnits = Utils::JSValueAsBrushUnits(m_props->patternUnits);
|
||||
m_patternContentUnits = Utils::JSValueAsBrushUnits(m_props->patternContentUnits, "userSpaceOnUse");
|
||||
|
||||
m_transform = Utils::JSValueAsD2DTransform(m_props->patternTransform);
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
|
||||
SaveDefinition();
|
||||
|
||||
if (auto const &root{SvgRoot()}) {
|
||||
root.Invalidate();
|
||||
}
|
||||
}
|
||||
#else
|
||||
void PatternView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
|
||||
@@ -121,7 +60,6 @@ void PatternView::UpdateProperties(IJSValueReader const &reader, bool forceUpdat
|
||||
root.Invalidate();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void PatternView::UpdateBounds() {
|
||||
if (m_patternUnits == "objectBoundingBox") {
|
||||
|
||||
@@ -1,74 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "PatternProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "PatternView.g.h"
|
||||
#include "BrushView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(PatternProps)
|
||||
struct PatternProps : PatternPropsT<PatternProps, SvgGroupCommonProps> {
|
||||
PatternProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(x)
|
||||
RNSVG::SVGLength x{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(y)
|
||||
RNSVG::SVGLength y{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(width)
|
||||
RNSVG::SVGLength width{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(height)
|
||||
RNSVG::SVGLength height{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(patternUnits)
|
||||
std::optional<int32_t> patternUnits;
|
||||
REACT_FIELD(patternContentUnits)
|
||||
std::optional<int32_t> patternContentUnits;
|
||||
REACT_FIELD(patternTransform)
|
||||
std::optional<std::vector<float>> patternTransform;
|
||||
|
||||
REACT_FIELD(minX)
|
||||
float minX{0.0f};
|
||||
REACT_FIELD(minY)
|
||||
float minY{0.0f};
|
||||
REACT_FIELD(vbWidth)
|
||||
float vbWidth{0.0f};
|
||||
REACT_FIELD(vbHeight)
|
||||
float vbHeight{0.0f};
|
||||
REACT_FIELD(align)
|
||||
std::string align{""};
|
||||
REACT_FIELD(meetOrSlice)
|
||||
RNSVG::MeetOrSlice meetOrSlice{RNSVG::MeetOrSlice::Meet};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct PatternView : PatternViewT<PatternView, RNSVG::implementation::BrushView> {
|
||||
public:
|
||||
PatternView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
PatternView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#else
|
||||
// IRenderablePaper
|
||||
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void Draw(RNSVG::D2DDeviceContext const & /*deviceContext*/, Windows::Foundation::Size const & /*size*/){};
|
||||
@@ -89,10 +31,6 @@ struct PatternView : PatternViewT<PatternView, RNSVG::implementation::BrushView>
|
||||
std::string m_align{""};
|
||||
RNSVG::MeetOrSlice m_meetOrSlice{RNSVG::MeetOrSlice::Meet};
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<PatternProps> m_props;
|
||||
#endif
|
||||
|
||||
// BrushView
|
||||
void CreateBrush();
|
||||
void UpdateBounds();
|
||||
|
||||
@@ -195,13 +195,40 @@
|
||||
<ClInclude Include="UseViewManager.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="BrushView.cpp" />
|
||||
<ClCompile Include="CircleView.cpp" />
|
||||
<ClCompile Include="ClipPathView.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ReactPackageProvider.cpp">
|
||||
<DependentUpon>ReactPackageProvider.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(UseFabric)'=='true'">
|
||||
<ClCompile Include="Fabric/CircleView.cpp" />
|
||||
<ClCompile Include="Fabric/ClipPathView.cpp" />
|
||||
<ClCompile Include="Fabric/DefsView.cpp" />
|
||||
<ClCompile Include="Fabric/EllipseView.cpp" />
|
||||
<ClCompile Include="Fabric/GroupView.cpp" />
|
||||
<ClCompile Include="Fabric/ImageView.cpp" />
|
||||
<ClCompile Include="Fabric/LinearGradientView.cpp" />
|
||||
<ClCompile Include="Fabric/LineView.cpp" />
|
||||
<ClCompile Include="Fabric/PathView.cpp" />
|
||||
<ClCompile Include="Fabric/RadialGradientView.cpp" />
|
||||
<ClCompile Include="Fabric/RectView.cpp" />
|
||||
<ClCompile Include="Fabric/RenderableView.cpp" />
|
||||
<ClCompile Include="Fabric/SvgView.cpp" />
|
||||
<ClCompile Include="Fabric/UnsupportedSvgView.cpp" />
|
||||
<ClCompile Include="Fabric/UseView.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(UseFabric)'!='true'">
|
||||
<ClCompile Include="D2DBrush.cpp" />
|
||||
<ClCompile Include="D2DDevice.cpp" />
|
||||
<ClCompile Include="D2DDeviceContext.cpp" />
|
||||
<ClCompile Include="D2DGeometry.cpp" />
|
||||
<ClCompile Include="SVGLength.cpp" />
|
||||
<ClCompile Include="BrushView.cpp" />
|
||||
<ClCompile Include="CircleView.cpp" />
|
||||
<ClCompile Include="ClipPathView.cpp" />
|
||||
<ClCompile Include="DefsView.cpp" />
|
||||
<ClCompile Include="EllipseView.cpp" />
|
||||
<ClCompile Include="GroupView.cpp" />
|
||||
@@ -212,24 +239,14 @@
|
||||
<ClCompile Include="MaskView.cpp" />
|
||||
<ClCompile Include="PathView.cpp" />
|
||||
<ClCompile Include="PatternView.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RadialGradientView.cpp" />
|
||||
<ClCompile Include="ReactPackageProvider.cpp">
|
||||
<DependentUpon>ReactPackageProvider.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
||||
<ClCompile Include="RectView.cpp" />
|
||||
<ClCompile Include="RenderableView.cpp" />
|
||||
<ClCompile Include="SVGLength.cpp" />
|
||||
<ClCompile Include="SvgView.cpp" />
|
||||
<ClCompile Include="SymbolView.cpp" />
|
||||
<ClCompile Include="TextView.cpp" />
|
||||
<ClCompile Include="TSpanView.cpp" />
|
||||
<ClCompile Include="UseView.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(UseFabric)'!='true'">
|
||||
<ClCompile Include="CircleViewManager.cpp" />
|
||||
<ClCompile Include="ClipPathViewManager.cpp" />
|
||||
<ClCompile Include="DefsViewManager.cpp" />
|
||||
@@ -252,13 +269,11 @@
|
||||
<ClCompile Include="UseViewManager.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="Fabric.idl" Condition="'$(UseFabric)'=='true'" />
|
||||
<Midl Include="Paper.idl" Condition="'$(UseFabric)'!='true'" />
|
||||
<Midl Include="ReactPackageProvider.idl" />
|
||||
<Midl Include="Types.idl" />
|
||||
<Midl Include="Types.idl" Condition="'$(UseFabric)'!='true'"/>
|
||||
<Midl Include="ViewManagers.idl" Condition="'$(UseFabric)'!='true'" />
|
||||
<Midl Include="ViewProps.idl" Condition="'$(UseFabric)'=='true'" />
|
||||
<Midl Include="Views.idl" />
|
||||
<Midl Include="Views.idl" Condition="'$(UseFabric)'!='true'"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(UseFabric)'!='true'">
|
||||
<None Include="PropertySheet.props" />
|
||||
|
||||
@@ -11,58 +11,6 @@ using namespace Microsoft::ReactNative;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
RadialGradientProps::RadialGradientProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void RadialGradientProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
RadialGradientView::RadialGradientView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args)
|
||||
: base_type(args) {}
|
||||
|
||||
void RadialGradientView::RegisterComponent(
|
||||
const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGRadialGradient", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::RadialGradientProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::RadialGradientView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void RadialGradientView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto radialGradientProps = props.try_as<RadialGradientProps>();
|
||||
if (radialGradientProps) {
|
||||
m_props = radialGradientProps;
|
||||
|
||||
m_rx = m_props->rx;
|
||||
m_ry = m_props->ry;
|
||||
m_fx = m_props->fx;
|
||||
m_fy = m_props->fy;
|
||||
m_cx = m_props->cx;
|
||||
m_cy = m_props->cy;
|
||||
|
||||
m_stops = Utils::JSValueAsGradientStops(m_props->gradient);
|
||||
m_gradientUnits = Utils::JSValueAsBrushUnits(m_props->gradientUnits);
|
||||
m_transform = Utils::JSValueAsD2DTransform(m_props->gradientTransform);
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
|
||||
SaveDefinition();
|
||||
}
|
||||
#else
|
||||
void RadialGradientView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
|
||||
@@ -99,7 +47,6 @@ void RadialGradientView::UpdateProperties(IJSValueReader const &reader, bool for
|
||||
|
||||
SaveDefinition();
|
||||
}
|
||||
#endif
|
||||
|
||||
void RadialGradientView::Unload() {
|
||||
m_stops.clear();
|
||||
|
||||
@@ -1,65 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "RadialGradientProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "RadialGradientView.g.h"
|
||||
#include "BrushView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(RadialGradientProps)
|
||||
struct RadialGradientProps : RadialGradientPropsT<RadialGradientProps, SvgGroupCommonProps> {
|
||||
RadialGradientProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(fx)
|
||||
RNSVG::SVGLength fx{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(fy)
|
||||
RNSVG::SVGLength fy{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(cx)
|
||||
RNSVG::SVGLength cx{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(cy)
|
||||
RNSVG::SVGLength cy{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(rx)
|
||||
RNSVG::SVGLength rx{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(ry)
|
||||
RNSVG::SVGLength ry{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(gradient)
|
||||
std::optional<std::vector<float>> gradient{};
|
||||
REACT_FIELD(gradientUnits)
|
||||
std::optional<int32_t> gradientUnits;
|
||||
REACT_FIELD(gradientTransform)
|
||||
std::optional<std::vector<float>> gradientTransform;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct RadialGradientView : RadialGradientViewT<RadialGradientView, RNSVG::implementation::BrushView> {
|
||||
public:
|
||||
RadialGradientView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
RadialGradientView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#else
|
||||
// IRenderablePaper
|
||||
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void Unload();
|
||||
@@ -74,10 +25,6 @@ struct RadialGradientView : RadialGradientViewT<RadialGradientView, RNSVG::imple
|
||||
std::vector<D2D1_GRADIENT_STOP> m_stops{};
|
||||
std::string m_gradientUnits{"objectBoundingBox"};
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<RadialGradientProps> m_props;
|
||||
#endif
|
||||
|
||||
// BrushView
|
||||
void CreateBrush();
|
||||
void UpdateBounds();
|
||||
|
||||
@@ -7,25 +7,20 @@
|
||||
#include "RNSVGModule.h"
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "SvgView.h"
|
||||
#include "RectView.h"
|
||||
#include "CircleView.h"
|
||||
#include "EllipseView.h"
|
||||
#include "LineView.h"
|
||||
#include "PathView.h"
|
||||
#include "ImageView.h"
|
||||
#include "UseView.h"
|
||||
#include "GroupView.h"
|
||||
#include "SymbolView.h"
|
||||
#include "DefsView.h"
|
||||
#include "ClipPathView.h"
|
||||
#include "MarkerView.h"
|
||||
#include "MaskView.h"
|
||||
#include "LinearGradientView.h"
|
||||
#include "RadialGradientView.h"
|
||||
#include "PatternView.h"
|
||||
#include "TextView.h"
|
||||
#include "TSpanView.h"
|
||||
#include "Fabric/SvgView.h"
|
||||
#include "Fabric/RectView.h"
|
||||
#include "Fabric/CircleView.h"
|
||||
#include "Fabric/EllipseView.h"
|
||||
#include "Fabric/LineView.h"
|
||||
#include "Fabric/PathView.h"
|
||||
#include "Fabric/ImageView.h"
|
||||
#include "Fabric/UseView.h"
|
||||
#include "Fabric/GroupView.h"
|
||||
#include "Fabric/DefsView.h"
|
||||
#include "Fabric/ClipPathView.h"
|
||||
#include "Fabric/LinearGradientView.h"
|
||||
#include "Fabric/RadialGradientView.h"
|
||||
#include "Fabric/UnsupportedSvgView.h"
|
||||
#else
|
||||
#include "SvgViewManager.h"
|
||||
#include "GroupViewManager.h"
|
||||
@@ -60,24 +55,33 @@ namespace winrt::RNSVG::implementation
|
||||
auto fabricPackageBuilder = packageBuilder.as<winrt::Microsoft::ReactNative::IReactPackageBuilderFabric>();
|
||||
|
||||
SvgView::RegisterComponent(fabricPackageBuilder);
|
||||
RectView::RegisterComponent(fabricPackageBuilder);
|
||||
CircleView::RegisterComponent(fabricPackageBuilder);
|
||||
EllipseView::RegisterComponent(fabricPackageBuilder);
|
||||
LineView::RegisterComponent(fabricPackageBuilder);
|
||||
PathView::RegisterComponent(fabricPackageBuilder);
|
||||
ImageView::RegisterComponent(fabricPackageBuilder);
|
||||
UseView::RegisterComponent(fabricPackageBuilder);
|
||||
GroupView::RegisterComponent(fabricPackageBuilder);
|
||||
SymbolView::RegisterComponent(fabricPackageBuilder);
|
||||
DefsView::RegisterComponent(fabricPackageBuilder);
|
||||
ClipPathView::RegisterComponent(fabricPackageBuilder);
|
||||
MarkerView::RegisterComponent(fabricPackageBuilder);
|
||||
MaskView::RegisterComponent(fabricPackageBuilder);
|
||||
LinearGradientView::RegisterComponent(fabricPackageBuilder);
|
||||
RadialGradientView::RegisterComponent(fabricPackageBuilder);
|
||||
PatternView::RegisterComponent(fabricPackageBuilder);
|
||||
TextView::RegisterComponent(fabricPackageBuilder);
|
||||
TSpanView::RegisterComponent(fabricPackageBuilder);
|
||||
RegisterRectComponent(fabricPackageBuilder);
|
||||
RegisterCircleComponent(fabricPackageBuilder);
|
||||
RegisterEllipseComponent(fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGFilter", fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGFeBlend", fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGFeColorMatrix", fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGFeComposite", fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGFeFlood", fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGFeGaussianBlur", fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGFeMerge", fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGFeOffset", fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGForeignObject", fabricPackageBuilder);
|
||||
RegisterLineComponent(fabricPackageBuilder);
|
||||
RegisterPathComponent(fabricPackageBuilder);
|
||||
RegisterImageComponent(fabricPackageBuilder);
|
||||
RegisterUseComponent(fabricPackageBuilder);
|
||||
RegisterGroupComponent(fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGSymbol", fabricPackageBuilder);
|
||||
RegisterDefsComponent(fabricPackageBuilder);
|
||||
RegisterClipPathComponent(fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGMarker", fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGMask", fabricPackageBuilder);
|
||||
RegisterLinearGradientComponent(fabricPackageBuilder);
|
||||
RegisterRadialGradientComponent(fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGPattern", fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGText", fabricPackageBuilder);
|
||||
RegisterUnsupportedSvgComponent(L"RNSVGTSpan", fabricPackageBuilder);
|
||||
#else
|
||||
packageBuilder.AddViewManager(L"SvgViewManager", []() { return winrt::make<SvgViewManager>(); });
|
||||
packageBuilder.AddViewManager(L"RectViewManager", []() { return winrt::make<RectViewManager>(); });
|
||||
|
||||
@@ -22,18 +22,8 @@ void RectProps::SetProp(
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
RectView::RectView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void RectView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGRect", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::RectProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::RectView>(args);
|
||||
});
|
||||
});
|
||||
RegisterRenderableComponent<winrt::RNSVG::implementation::RectProps, RectView>(L"RNSVGRect", builder);
|
||||
}
|
||||
|
||||
void RectView::UpdateProperties(
|
||||
@@ -43,14 +33,12 @@ void RectView::UpdateProperties(
|
||||
bool invalidate) noexcept {
|
||||
auto rectProps = props.try_as<RectProps>();
|
||||
if (rectProps) {
|
||||
m_props = rectProps;
|
||||
|
||||
m_x = m_props->x;
|
||||
m_y = m_props->y;
|
||||
m_width = m_props->width;
|
||||
m_height = m_props->height;
|
||||
m_rx = m_props->rx;
|
||||
m_ry = m_props->ry;
|
||||
m_x = rectProps->x;
|
||||
m_y = rectProps->y;
|
||||
m_width = rectProps->width;
|
||||
m_height = rectProps->height;
|
||||
m_rx = rectProps->rx;
|
||||
m_ry = rectProps->ry;
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
|
||||
@@ -1,59 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "RectProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "RectView.g.h"
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(RectProps)
|
||||
struct RectProps : RectPropsT<RectProps, SvgRenderableCommonProps> {
|
||||
RectProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(x)
|
||||
RNSVG::SVGLength x{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(y)
|
||||
RNSVG::SVGLength y{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(height)
|
||||
RNSVG::SVGLength height{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(width)
|
||||
RNSVG::SVGLength width{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(rx)
|
||||
RNSVG::SVGLength rx{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(ry)
|
||||
RNSVG::SVGLength ry{0, winrt::RNSVG::LengthType::Unknown};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct RectView : RectViewT<RectView, RNSVG::implementation::RenderableView> {
|
||||
public:
|
||||
RectView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
RectView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#else
|
||||
// IRenderablePaper
|
||||
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
void CreateGeometry(RNSVG::D2DDeviceContext const &context);
|
||||
@@ -65,10 +22,6 @@ struct RectView : RectViewT<RectView, RNSVG::implementation::RenderableView> {
|
||||
RNSVG::SVGLength m_y{};
|
||||
RNSVG::SVGLength m_rx{};
|
||||
RNSVG::SVGLength m_ry{};
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<RectProps> m_props;
|
||||
#endif
|
||||
};
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
|
||||
@@ -35,52 +35,59 @@ void SvgRenderableCommonProps::SetProp(
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
RenderableView::RenderableView(
|
||||
const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args)
|
||||
: base_type(args), m_reactContext(args.ReactContext()) {}
|
||||
|
||||
void RenderableView::MountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
||||
uint32_t index) noexcept {
|
||||
const winrt::Microsoft::ReactNative::ComponentView&,
|
||||
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs& args) noexcept
|
||||
{
|
||||
const RNSVG::RenderableView &view{*this};
|
||||
const auto &group{view.try_as<RNSVG::GroupView>()};
|
||||
const auto &child{childComponentView.try_as<IRenderable>()};
|
||||
if (auto userData = args.Child().UserData()) {
|
||||
const auto &group{view.try_as<RNSVG::GroupView>()};
|
||||
const auto &child{userData.try_as<IRenderable>()};
|
||||
m_children.InsertAt(args.Index(), child);
|
||||
|
||||
if (group && child) {
|
||||
base_type::MountChildComponentView(childComponentView, index);
|
||||
child.MergeProperties(*this);
|
||||
userData.as<IRenderableFabric>().SvgParent(*this);
|
||||
|
||||
if (child.IsResponsible() && !IsResponsible()) {
|
||||
IsResponsible(true);
|
||||
}
|
||||
assert(group && child);
|
||||
if (group && child) {
|
||||
child.MergeProperties(*this);
|
||||
|
||||
if (auto const &root{SvgRoot()}) {
|
||||
root.Invalidate();
|
||||
if (child.IsResponsible() && !IsResponsible()) {
|
||||
IsResponsible(true);
|
||||
}
|
||||
|
||||
if (auto const &root{SvgRoot()}) {
|
||||
root.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderableView::UnmountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
||||
uint32_t index) noexcept {
|
||||
const RNSVG::RenderableView &view{*this};
|
||||
const auto &group{view.try_as<RNSVG::GroupView>()};
|
||||
const auto &child{childComponentView.try_as<IRenderable>()};
|
||||
const winrt::Microsoft::ReactNative::ComponentView &,
|
||||
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept {
|
||||
if (auto userData = args.Child().UserData()) {
|
||||
const RNSVG::RenderableView &view{*this};
|
||||
const auto &group{view.try_as<RNSVG::GroupView>()};
|
||||
const auto &child{userData.try_as<IRenderable>()};
|
||||
|
||||
if (group && child) {
|
||||
if (!IsUnloaded()) {
|
||||
child.Unload();
|
||||
}
|
||||
userData.as<IRenderableFabric>().SvgParent(nullptr);
|
||||
|
||||
base_type::UnmountChildComponentView(childComponentView, index);
|
||||
if (group && child) {
|
||||
if (!IsUnloaded()) {
|
||||
child.Unload();
|
||||
}
|
||||
|
||||
if (auto const &root{SvgRoot()}) {
|
||||
root.Invalidate();
|
||||
m_children.RemoveAt(args.Index());
|
||||
|
||||
if (auto const &root{SvgRoot()}) {
|
||||
root.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderableView::UpdateProps(
|
||||
const winrt::Microsoft::ReactNative::ComponentView & /*view*/,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
|
||||
if (!props && !oldProps)
|
||||
@@ -98,7 +105,7 @@ void RenderableView::UpdateProperties(
|
||||
auto oldRenderableProps =
|
||||
oldProps ? oldProps.as<SvgRenderableCommonProps>() : nullptr;
|
||||
|
||||
auto const &parent{Parent().try_as<RNSVG::RenderableView>()};
|
||||
auto const &parent{SvgParent().try_as<RNSVG::RenderableView>()};
|
||||
|
||||
// propList
|
||||
/*
|
||||
@@ -207,7 +214,7 @@ void RenderableView::UpdateProperties(
|
||||
std::find(renderableProps->propList->begin(), renderableProps->propList->end(), "fill") !=
|
||||
renderableProps->propList->end()};
|
||||
|
||||
if (forceUpdate || !m_propSetMap[RNSVG::BaseProp::Fill]) {
|
||||
if (forceUpdate || (fillSet && !m_propSetMap[RNSVG::BaseProp::Fill])) {
|
||||
winrt::Microsoft::ReactNative::Color fallbackColor{winrt::Microsoft::ReactNative::Color::Black()};
|
||||
if (renderableProps->fill == std::nullopt && fillSet) {
|
||||
fallbackColor = winrt::Microsoft::ReactNative::Color::Transparent();
|
||||
@@ -400,10 +407,15 @@ void RenderableView::UpdateProperties(
|
||||
|
||||
m_recreateResources = true;
|
||||
|
||||
if (invalidate && Parent()) {
|
||||
if (invalidate && SvgParent()) {
|
||||
SvgRoot().Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
const winrt::Windows::Foundation::Collections::IVector<IRenderable>& RenderableView::Children() const noexcept {
|
||||
return m_children;
|
||||
}
|
||||
|
||||
#else
|
||||
void RenderableView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
@@ -717,8 +729,8 @@ RNSVG::SvgView RenderableView::SvgRoot() {
|
||||
if (auto parent = SvgParent()) {
|
||||
if (auto const &svgView{parent.try_as<RNSVG::SvgView>()}) {
|
||||
if (auto const &svgViewParent = svgView.SvgParent()) {
|
||||
if (auto const &parent{svgViewParent.try_as<RNSVG::RenderableView>()}) {
|
||||
return parent.SvgRoot();
|
||||
if (auto const &renderableParent{svgViewParent.try_as<RNSVG::RenderableView>()}) {
|
||||
return renderableParent.SvgRoot();
|
||||
} else {
|
||||
return svgView;
|
||||
}
|
||||
|
||||
@@ -5,156 +5,14 @@
|
||||
#include "D2DDeviceContext.h"
|
||||
#include "D2DGeometry.h"
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "SvgNodeCommonProps.g.h"
|
||||
#include "SvgRenderableCommonProps.g.h"
|
||||
|
||||
#include <JSValueComposition.h>
|
||||
#endif
|
||||
|
||||
#include <NativeModules.h>
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(ColorStruct)
|
||||
struct ColorStruct {
|
||||
REACT_FIELD(type)
|
||||
int32_t type{-1};
|
||||
|
||||
REACT_FIELD(payload)
|
||||
winrt::Microsoft::ReactNative::Color payload{nullptr};
|
||||
|
||||
REACT_FIELD(brushRef)
|
||||
std::string brushRef;
|
||||
|
||||
bool operator==(const ColorStruct &rhs) const {
|
||||
return type == rhs.type && payload == rhs.payload && brushRef == rhs.brushRef;
|
||||
}
|
||||
|
||||
bool operator!=(const ColorStruct &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
};
|
||||
|
||||
// Currently no good way to do inheritance in REACT_STRUCTS
|
||||
#define REACT_SVG_NODE_COMMON_PROPS \
|
||||
REACT_FIELD(name) \
|
||||
REACT_FIELD(opacity) \
|
||||
REACT_FIELD(matrix) \
|
||||
REACT_FIELD(mask) \
|
||||
REACT_FIELD(markerStart) \
|
||||
REACT_FIELD(markerMid) \
|
||||
REACT_FIELD(markerEnd) \
|
||||
REACT_FIELD(clipPath) \
|
||||
REACT_FIELD(clipRule) \
|
||||
REACT_FIELD(responsible) \
|
||||
REACT_FIELD(display) \
|
||||
REACT_FIELD(pointerEvents)
|
||||
|
||||
REACT_STRUCT(SvgNodeCommonProps)
|
||||
struct SvgNodeCommonProps : SvgNodeCommonPropsT<SvgNodeCommonProps> {
|
||||
SvgNodeCommonProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
virtual void SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
|
||||
std::optional<std::string> name;
|
||||
std::optional<float> opacity; // 1.0f
|
||||
std::optional<std::vector<float>> matrix;
|
||||
std::optional<std::string> mask;
|
||||
std::optional<std::string> markerStart;
|
||||
std::optional<std::string> markerMid;
|
||||
std::optional<std::string> markerEnd;
|
||||
std::optional<std::string> clipPath;
|
||||
std::optional<RNSVG::FillRule> clipRule; // RNSVG::FillRule::EvenOdd
|
||||
std::optional<bool> responsible;
|
||||
std::optional<std::string> display;
|
||||
std::optional<std::string> pointerEvents;
|
||||
|
||||
private:
|
||||
winrt::Microsoft::ReactNative::ViewProps m_props{nullptr};
|
||||
};
|
||||
|
||||
// Currently no good way to do inheritance in REACT_STRUCTS
|
||||
#define REACT_SVG_RENDERABLE_COMMON_PROPS \
|
||||
REACT_FIELD(fill) \
|
||||
REACT_FIELD(fillOpacity) \
|
||||
REACT_FIELD(fillRule) \
|
||||
REACT_FIELD(stroke) \
|
||||
REACT_FIELD(strokeOpacity) \
|
||||
REACT_FIELD(strokeWidth) \
|
||||
REACT_FIELD(strokeLinecap) \
|
||||
REACT_FIELD(strokeLinejoin) \
|
||||
REACT_FIELD(strokeDasharray) \
|
||||
REACT_FIELD(strokeDashoffset) \
|
||||
REACT_FIELD(strokeMiterlimit) \
|
||||
REACT_FIELD(vectorEffect) \
|
||||
REACT_FIELD(propList)
|
||||
|
||||
REACT_STRUCT(SvgRenderableCommonProps)
|
||||
struct SvgRenderableCommonProps
|
||||
: SvgRenderableCommonPropsT<SvgRenderableCommonProps, SvgNodeCommonProps> {
|
||||
SvgRenderableCommonProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
std::optional<ColorStruct> fill;
|
||||
std::optional<float> fillOpacity; // 1.0f
|
||||
std::optional<FillRule> fillRule; // RNSVG::FillRule::NonZero
|
||||
std::optional<ColorStruct> stroke;
|
||||
std::optional<float> strokeOpacity; // 1.0f
|
||||
std::optional<RNSVG::SVGLength> strokeWidth;
|
||||
std::optional<LineCap> strokeLinecap; // RNSVG::LineCap::Butt
|
||||
std::optional<LineJoin> strokeLinejoin; // RNSVG::LineJoin::Miter
|
||||
std::optional<std::vector<RNSVG::SVGLength>> strokeDasharray;
|
||||
std::optional<float> strokeDashoffset;
|
||||
std::optional<float> strokeMiterlimit;
|
||||
std::optional<int32_t> vectorEffect; // 0
|
||||
std::optional<std::vector<std::string>> propList;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct RenderableView : RenderableViewT<RenderableView> {
|
||||
public:
|
||||
RenderableView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
RenderableView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
// IRenderableFabric
|
||||
winrt::Microsoft::ReactNative::ComponentView SvgParent() { return Parent(); }
|
||||
winrt::Microsoft::ReactNative::Color Fill() { return m_fill; }
|
||||
winrt::Microsoft::ReactNative::Color Stroke() { return m_stroke; }
|
||||
|
||||
// ComponentView
|
||||
void MountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
||||
uint32_t index) noexcept;
|
||||
void UnmountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
||||
uint32_t index) noexcept;
|
||||
|
||||
virtual void UpdateProps(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
virtual void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept;
|
||||
#else
|
||||
RenderableView(Microsoft::ReactNative::IReactContext const &context) : m_reactContext(context) {}
|
||||
|
||||
// IRenderablePaper
|
||||
@@ -165,7 +23,6 @@ struct RenderableView : RenderableViewT<RenderableView> {
|
||||
Windows::UI::Color Stroke() { return m_stroke; }
|
||||
|
||||
virtual void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate = true, bool invalidate = true);
|
||||
#endif
|
||||
|
||||
RNSVG::SvgView SvgRoot();
|
||||
|
||||
@@ -203,9 +60,7 @@ struct RenderableView : RenderableViewT<RenderableView> {
|
||||
virtual RNSVG::IRenderable HitTest(Windows::Foundation::Point const &point);
|
||||
|
||||
protected:
|
||||
#ifndef USE_FABRIC
|
||||
std::vector<std::string> m_propList{};
|
||||
#endif
|
||||
|
||||
float m_opacity{1.0f};
|
||||
std::map<RNSVG::BaseProp, bool> m_propSetMap{
|
||||
@@ -224,22 +79,11 @@ struct RenderableView : RenderableViewT<RenderableView> {
|
||||
};
|
||||
|
||||
private:
|
||||
#ifdef USE_FABRIC
|
||||
winrt::Microsoft::ReactNative::ComponentView m_parent{nullptr};
|
||||
winrt::Microsoft::ReactNative::Color m_fill{winrt::Microsoft::ReactNative::Color::Black()};
|
||||
winrt::Microsoft::ReactNative::Color m_stroke{winrt::Microsoft::ReactNative::Color::Transparent()};
|
||||
|
||||
void SetColor(
|
||||
std::optional<ColorStruct> &propValue,
|
||||
winrt::Microsoft::ReactNative::Color const &fallbackColor,
|
||||
std::string propName);
|
||||
#else
|
||||
xaml::FrameworkElement m_parent{nullptr};
|
||||
Windows::UI::Color m_fill{Colors::Black()};
|
||||
Windows::UI::Color m_stroke{Colors::Transparent()};
|
||||
|
||||
void SetColor(const Microsoft::ReactNative::JSValueObject &propValue, Windows::UI::Color const &fallbackColor, std::string propName);
|
||||
#endif
|
||||
|
||||
Microsoft::ReactNative::IReactContext m_reactContext{nullptr};
|
||||
RNSVG::D2DGeometry m_geometry{nullptr};
|
||||
|
||||
@@ -104,4 +104,28 @@ void ReadValue(IJSValueReader const &reader, /*out*/ winrt::RNSVG::SVGLength &va
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace winrt::Microsoft::ReactNative
|
||||
|
||||
namespace winrt::RNSVG {
|
||||
|
||||
D2D1_SVG_LENGTH D2dSvgLength(const winrt::RNSVG::SVGLength &value) noexcept {
|
||||
switch (value.Unit) {
|
||||
case RNSVG::LengthType::Percentage:
|
||||
return {value.Value, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_PERCENTAGE};
|
||||
case RNSVG::LengthType::Unknown:
|
||||
case RNSVG::LengthType::EMS:
|
||||
case RNSVG::LengthType::EXS:
|
||||
case RNSVG::LengthType::Centimeter:
|
||||
case RNSVG::LengthType::Millimeter:
|
||||
case RNSVG::LengthType::Inch:
|
||||
case RNSVG::LengthType::Point:
|
||||
case RNSVG::LengthType::Pica:
|
||||
default:
|
||||
// Unsupported unit type
|
||||
__fallthrough;
|
||||
case RNSVG::LengthType::Number:
|
||||
return {value.Value, D2D1_SVG_LENGTH_UNITS::D2D1_SVG_LENGTH_UNITS_NUMBER};
|
||||
}
|
||||
}
|
||||
} // namespace winrt::RNSVG
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
#include <winrt/RNSVG.h>
|
||||
|
||||
#ifndef USE_FABRIC
|
||||
#include "JSValueXaml.h"
|
||||
#endif
|
||||
|
||||
namespace winrt::Microsoft::ReactNative {
|
||||
void WriteValue(IJSValueWriter const &writer, const winrt::RNSVG::SVGLength &value) noexcept;
|
||||
|
||||
@@ -18,148 +18,12 @@
|
||||
#include "D2DDeviceContext.h"
|
||||
#include "GroupView.h"
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include <AutoDraw.h>
|
||||
#include <CompositionSwitcher.Experimental.interop.h>
|
||||
#endif
|
||||
|
||||
#include <d3d11_4.h>
|
||||
|
||||
using namespace winrt;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
SvgViewProps::SvgViewProps(
|
||||
const winrt::Microsoft::ReactNative::ViewProps &props)
|
||||
: m_props(props) {}
|
||||
|
||||
void SvgViewProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
SvgView::SvgView(const winrt::Microsoft::ReactNative::Composition::CreateCompositionComponentViewArgs &args)
|
||||
: base_type(args),
|
||||
m_reactContext(args.ReactContext()),
|
||||
m_compContext(
|
||||
args.as<winrt::Microsoft::ReactNative::Composition::Experimental::IInternalCreateComponentViewArgs>()
|
||||
.CompositionContext()) {}
|
||||
|
||||
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual SvgView::CreateInternalVisual() {
|
||||
m_visual = m_compContext.CreateSpriteVisual();
|
||||
m_visual.Comment(L"SVGRoot");
|
||||
return m_visual;
|
||||
}
|
||||
|
||||
void SvgView::MountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
||||
uint32_t index) noexcept {
|
||||
auto const &group{childComponentView.try_as<RNSVG::GroupView>()};
|
||||
|
||||
if (group) {
|
||||
// Every SvgView has exactly one child - a Group that gets
|
||||
// all of Svg's children piped through.
|
||||
Group(group);
|
||||
}
|
||||
|
||||
base_type::MountChildComponentView(childComponentView, index);
|
||||
}
|
||||
|
||||
void SvgView::UnmountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
||||
uint32_t index) noexcept {
|
||||
if (Group()) {
|
||||
Group().Unload();
|
||||
}
|
||||
Group(nullptr);
|
||||
|
||||
base_type::UnmountChildComponentView(childComponentView, index);
|
||||
}
|
||||
|
||||
void SvgView::OnThemeChanged() noexcept {
|
||||
Invalidate();
|
||||
base_type::OnThemeChanged();
|
||||
}
|
||||
|
||||
void SvgView::UpdateProps(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
|
||||
UpdateProperties(props, oldProps);
|
||||
}
|
||||
|
||||
void SvgView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(L"RNSVGSvgView", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::SvgViewProps>(props);
|
||||
});
|
||||
auto compBuilder = builder.as<winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder>();
|
||||
compBuilder.SetCreateViewComponentView([](const winrt::Microsoft::ReactNative::Composition::CreateCompositionComponentViewArgs &args) noexcept {
|
||||
args.Features(args.Features() & ~winrt::Microsoft::ReactNative::Composition::ComponentViewFeatures::Background);
|
||||
return winrt::make<winrt::RNSVG::implementation::SvgView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void SvgView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) {
|
||||
auto svgProps = props.try_as<SvgViewProps>();
|
||||
auto oldSvgProps = oldProps ? oldProps.try_as<SvgViewProps>() : nullptr;
|
||||
|
||||
// If forceUpdate is false, that means this is a nested Svg
|
||||
// and we're inheriting props. Pass those along to the group.
|
||||
if (!forceUpdate && m_group) {
|
||||
m_group.UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!oldSvgProps || svgProps->bbWidth != oldSvgProps->bbWidth) {
|
||||
m_bbWidth = svgProps->bbWidth;
|
||||
}
|
||||
if (!oldSvgProps || svgProps->bbHeight != oldSvgProps->bbHeight) {
|
||||
m_bbHeight = svgProps->bbHeight;
|
||||
}
|
||||
if (!oldSvgProps || svgProps->vbWidth != oldSvgProps->vbWidth) {
|
||||
m_vbWidth = svgProps->vbWidth;
|
||||
}
|
||||
if (!oldSvgProps || svgProps->vbHeight != oldSvgProps->vbHeight) {
|
||||
m_vbHeight = svgProps->vbHeight;
|
||||
}
|
||||
if (!oldSvgProps || svgProps->minX != oldSvgProps->minX) {
|
||||
m_minX = svgProps->minX;
|
||||
}
|
||||
if (!oldSvgProps || svgProps->minY != oldSvgProps->minY) {
|
||||
m_minY = svgProps->minY;
|
||||
}
|
||||
if (!oldSvgProps || svgProps->align != oldSvgProps->align) {
|
||||
m_align = svgProps->align;
|
||||
}
|
||||
if (!oldSvgProps || svgProps->meetOrSlice != oldSvgProps->meetOrSlice) {
|
||||
m_meetOrSlice = svgProps->meetOrSlice;
|
||||
}
|
||||
if (!oldSvgProps || svgProps->color != oldSvgProps->color) {
|
||||
m_currentColor = svgProps->color;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void SvgView::UpdateLayoutMetrics(
|
||||
const LayoutMetrics &metrics,
|
||||
const LayoutMetrics &oldMetrics) {
|
||||
m_layoutMetrics = metrics;
|
||||
base_type::UpdateLayoutMetrics(metrics, oldMetrics);
|
||||
|
||||
if (metrics != oldMetrics) {
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
#else
|
||||
SvgView::SvgView(IReactContext const &context) : m_reactContext(context) {
|
||||
uint32_t creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
|
||||
|
||||
@@ -290,14 +154,9 @@ void SvgView::Panel_Unloaded(IInspectable const &sender, xaml::RoutedEventArgs c
|
||||
svgView.Unload();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
winrt::Windows::Foundation::Size SvgView::CanvasSize() noexcept {
|
||||
#ifdef USE_FABRIC
|
||||
return winrt::Windows::Foundation::Size{m_layoutMetrics.Frame.Width, m_layoutMetrics.Frame.Height};
|
||||
#else
|
||||
return ActualSize();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SvgView::SaveDefinition() {
|
||||
@@ -357,12 +216,10 @@ void SvgView::CreateResources() {
|
||||
|
||||
Invalidate();
|
||||
|
||||
#ifndef USE_FABRIC
|
||||
m_image.Width(ActualWidth());
|
||||
m_image.Height(ActualHeight());
|
||||
m_image.Stretch(xaml::Media::Stretch::UniformToFill);
|
||||
Children().Append(m_image);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SvgView::Unload() {
|
||||
@@ -379,48 +236,6 @@ void SvgView::Invalidate() {
|
||||
m_brushes.Clear();
|
||||
m_templates.Clear();
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
Size size = CanvasSize();
|
||||
|
||||
if (size.Height == 0 || size.Width == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Theme().IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto drawingSurface = m_compContext.CreateDrawingSurfaceBrush(
|
||||
size,
|
||||
winrt::Windows::Graphics::DirectX::DirectXPixelFormat::B8G8R8A8UIntNormalized,
|
||||
winrt::Windows::Graphics::DirectX::DirectXAlphaMode::Premultiplied);
|
||||
|
||||
POINT offset;
|
||||
{
|
||||
::Microsoft::ReactNative::Composition::AutoDrawDrawingSurface autoDraw(drawingSurface, 1.0, &offset);
|
||||
if (auto deviceContext = autoDraw.GetRenderTarget()) {
|
||||
auto transform = Numerics::make_float3x2_translation({static_cast<float>(offset.x), static_cast<float>(offset.y)});
|
||||
deviceContext->SetTransform(D2DHelpers::AsD2DTransform(transform));
|
||||
|
||||
deviceContext->Clear(D2D1::ColorF(D2D1::ColorF::Black, 0.0f));
|
||||
|
||||
com_ptr<ID2D1DeviceContext> spDeviceContext;
|
||||
spDeviceContext.copy_from(deviceContext);
|
||||
|
||||
m_deviceContext = winrt::make<RNSVG::implementation::D2DDeviceContext>(spDeviceContext);
|
||||
|
||||
com_ptr<ID2D1Device> spDevice;
|
||||
spDeviceContext->GetDevice(spDevice.put());
|
||||
|
||||
m_device = winrt::make<RNSVG::implementation::D2DDevice>(spDevice);
|
||||
|
||||
Draw(m_deviceContext, size);
|
||||
}
|
||||
}
|
||||
|
||||
m_visual.Brush(drawingSurface);
|
||||
|
||||
#else
|
||||
if (!m_loaded) {
|
||||
return;
|
||||
}
|
||||
@@ -465,6 +280,5 @@ void SvgView::Invalidate() {
|
||||
sisNativeWithD2D->EndDraw();
|
||||
|
||||
m_image.Source(surfaceImageSource);
|
||||
#endif
|
||||
}
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
@@ -2,91 +2,15 @@
|
||||
|
||||
#include "SvgView.g.h"
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "SvgViewProps.g.h"
|
||||
|
||||
#include <JSValueComposition.h>
|
||||
#include "NativeModules.h"
|
||||
#endif
|
||||
|
||||
#include "SVGLength.h"
|
||||
#include "Utils.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(SvgViewProps)
|
||||
struct SvgViewProps : SvgViewPropsT<SvgViewProps> {
|
||||
SvgViewProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept;
|
||||
|
||||
REACT_FIELD(bbWidth)
|
||||
winrt::RNSVG::SVGLength bbWidth{0.0, winrt::RNSVG::LengthType::Unknown};
|
||||
|
||||
REACT_FIELD(bbHeight)
|
||||
winrt::RNSVG::SVGLength bbHeight{0.0, winrt::RNSVG::LengthType::Unknown};
|
||||
|
||||
REACT_FIELD(minX)
|
||||
float minX;
|
||||
REACT_FIELD(minY)
|
||||
float minY;
|
||||
REACT_FIELD(vbWidth)
|
||||
float vbWidth;
|
||||
REACT_FIELD(vbHeight)
|
||||
float vbHeight;
|
||||
REACT_FIELD(align)
|
||||
std::string align;
|
||||
REACT_FIELD(meetOrSlice)
|
||||
RNSVG::MeetOrSlice meetOrSlice{RNSVG::MeetOrSlice::Meet};
|
||||
REACT_FIELD(tintColor)
|
||||
winrt::Microsoft::ReactNative::Color tintColor{nullptr};
|
||||
REACT_FIELD(color)
|
||||
winrt::Microsoft::ReactNative::Color color{nullptr};
|
||||
|
||||
private:
|
||||
winrt::Microsoft::ReactNative::ViewProps m_props{nullptr};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct SvgView : SvgViewT<SvgView> {
|
||||
public:
|
||||
SvgView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
SvgView(const winrt::Microsoft::ReactNative::Composition::CreateCompositionComponentViewArgs &args);
|
||||
|
||||
winrt::Microsoft::ReactNative::ComponentView SvgParent() { return Parent(); }
|
||||
winrt::Microsoft::ReactNative::Color CurrentColor() { return m_currentColor; }
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true);
|
||||
|
||||
// Overrides
|
||||
// IInternalCreateVisual
|
||||
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual CreateInternalVisual();
|
||||
|
||||
// ComponentView
|
||||
void UpdateProps(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept;
|
||||
void UpdateLayoutMetrics(
|
||||
const winrt::Microsoft::ReactNative::LayoutMetrics &metrics,
|
||||
const winrt::Microsoft::ReactNative::LayoutMetrics &oldMetrics);
|
||||
void MountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
||||
uint32_t index) noexcept;
|
||||
void UnmountChildComponentView(
|
||||
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
||||
uint32_t index) noexcept;
|
||||
void OnThemeChanged() noexcept;
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
#else
|
||||
SvgView(winrt::Microsoft::ReactNative::IReactContext const &context);
|
||||
|
||||
xaml::FrameworkElement SvgParent() { return m_parent; }
|
||||
@@ -103,7 +27,6 @@ struct SvgView : SvgViewT<SvgView> {
|
||||
|
||||
void Panel_Loaded(winrt::Windows::Foundation::IInspectable const &sender, xaml::RoutedEventArgs const &args);
|
||||
void Panel_Unloaded(winrt::Windows::Foundation::IInspectable const &sender, xaml::RoutedEventArgs const &args);
|
||||
#endif
|
||||
|
||||
winrt::Windows::Foundation::Size CanvasSize() noexcept;
|
||||
|
||||
@@ -139,12 +62,6 @@ struct SvgView : SvgViewT<SvgView> {
|
||||
void Invalidate();
|
||||
|
||||
private:
|
||||
#ifdef USE_FABRIC
|
||||
winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual m_visual{nullptr};
|
||||
winrt::Microsoft::ReactNative::Color m_currentColor{nullptr};
|
||||
winrt::Microsoft::ReactNative::LayoutMetrics m_layoutMetrics{{0, 0, 0, 0}, 1.0};
|
||||
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext m_compContext{nullptr};
|
||||
#else
|
||||
bool m_loaded{false};
|
||||
xaml::FrameworkElement m_parent{nullptr};
|
||||
xaml::Controls::Image m_image;
|
||||
@@ -152,7 +69,6 @@ struct SvgView : SvgViewT<SvgView> {
|
||||
|
||||
xaml::FrameworkElement::Loaded_revoker m_panelLoadedRevoker{};
|
||||
xaml::FrameworkElement::Unloaded_revoker m_panelUnloadedRevoker{};
|
||||
#endif
|
||||
|
||||
// Shared
|
||||
Microsoft::ReactNative::IReactContext m_reactContext{nullptr};
|
||||
|
||||
@@ -10,50 +10,6 @@ using namespace winrt;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
SymbolProps::SymbolProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void SymbolProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
SymbolView::SymbolView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void SymbolView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGSymbol", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::SymbolProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::SymbolView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void SymbolView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto symbolProps = props.try_as<SymbolProps>();
|
||||
if (symbolProps) {
|
||||
m_props = symbolProps;
|
||||
|
||||
m_minX = m_props->minX;
|
||||
m_minY = m_props->minY;
|
||||
m_vbWidth = m_props->vbWidth;
|
||||
m_vbHeight = m_props->vbHeight;
|
||||
m_align = m_props->align;
|
||||
m_meetOrSlice = m_props->meetOrSlice;
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
}
|
||||
#else
|
||||
void SymbolView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
|
||||
@@ -78,5 +34,5 @@ void SymbolView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate
|
||||
|
||||
__super::UpdateProperties(reader, forceUpdate, invalidate);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
@@ -1,59 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "SymbolProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "SymbolView.g.h"
|
||||
#include "GroupView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(SymbolProps)
|
||||
struct SymbolProps : SymbolPropsT<SymbolProps, SvgGroupCommonProps> {
|
||||
SymbolProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(minX)
|
||||
float minX{0.0f};
|
||||
REACT_FIELD(minY)
|
||||
float minY{0.0f};
|
||||
REACT_FIELD(vbWidth)
|
||||
float vbWidth{0.0f};
|
||||
REACT_FIELD(vbHeight)
|
||||
float vbHeight{0.0f};
|
||||
REACT_FIELD(align)
|
||||
std::string align{""};
|
||||
REACT_FIELD(meetOrSlice)
|
||||
RNSVG::MeetOrSlice meetOrSlice{RNSVG::MeetOrSlice::Meet};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct SymbolView : SymbolViewT<SymbolView, RNSVG::implementation::GroupView> {
|
||||
public:
|
||||
SymbolView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
SymbolView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#else
|
||||
// IRenderablePaper
|
||||
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
float MinX() { return m_minX; }
|
||||
float MinY() { return m_minY; }
|
||||
@@ -72,11 +29,6 @@ struct SymbolView : SymbolViewT<SymbolView, RNSVG::implementation::GroupView> {
|
||||
float m_vbHeight{0.0f};
|
||||
std::string m_align{""};
|
||||
RNSVG::MeetOrSlice m_meetOrSlice{RNSVG::MeetOrSlice::Meet};
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<SymbolProps> m_props;
|
||||
#endif
|
||||
|
||||
};
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
|
||||
@@ -13,44 +13,6 @@ using namespace Microsoft::ReactNative;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
TSpanProps::TSpanProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void TSpanProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
TSpanView::TSpanView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void TSpanView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGTSpan", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::TSpanProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::TSpanView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void TSpanView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto tspanProps = props.try_as<TSpanProps>();
|
||||
if (tspanProps) {
|
||||
m_props = tspanProps;
|
||||
m_content = m_props->content;
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
}
|
||||
#else
|
||||
void TSpanView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
|
||||
@@ -65,7 +27,6 @@ void TSpanView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate,
|
||||
|
||||
__super::UpdateProperties(reader, forceUpdate, invalidate);
|
||||
}
|
||||
#endif
|
||||
|
||||
void TSpanView::Draw(RNSVG::D2DDeviceContext const &context, Size const &size) {
|
||||
com_ptr<ID2D1DeviceContext> deviceContext{get_self<D2DDeviceContext>(context)->Get()};
|
||||
|
||||
@@ -1,62 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "TSpanProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "TSpanView.g.h"
|
||||
#include "TextView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(TSpanProps)
|
||||
struct TSpanProps : TSpanPropsT<TSpanProps, SvgTextCommonProps> {
|
||||
TSpanProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
REACT_SVG_GROUP_COMMON_PROPS;
|
||||
REACT_SVG_TEXT_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(content)
|
||||
std::string content{""};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct TSpanView : TSpanViewT<TSpanView, RNSVG::implementation::TextView> {
|
||||
public:
|
||||
TSpanView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
TSpanView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
#else
|
||||
// IRenderablePaper
|
||||
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
// IRenderable
|
||||
virtual void Draw(RNSVG::D2DDeviceContext const &deviceContext, Windows::Foundation::Size const &size);
|
||||
|
||||
private:
|
||||
std::string m_content;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<TSpanProps> m_props;
|
||||
#endif
|
||||
|
||||
};
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
|
||||
@@ -11,83 +11,6 @@ using namespace Microsoft::ReactNative;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
SvgTextCommonProps::SvgTextCommonProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void SvgTextCommonProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
TextView::TextView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void TextView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGText", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::SvgTextCommonProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::TextView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void TextView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto textProps = props.try_as<SvgTextCommonProps>();
|
||||
if (textProps) {
|
||||
m_props = textProps;
|
||||
|
||||
if (textProps->x != std::nullopt) {
|
||||
m_x.Clear();
|
||||
|
||||
for (auto const &item : *textProps->x) {
|
||||
m_x.Append(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (textProps->y != std::nullopt) {
|
||||
m_y.Clear();
|
||||
|
||||
for (auto const &item : *textProps->y) {
|
||||
m_y.Append(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (textProps->dx != std::nullopt) {
|
||||
m_dx.Clear();
|
||||
|
||||
for (auto const &item : *textProps->dx) {
|
||||
m_dx.Append(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (textProps->dy != std::nullopt) {
|
||||
m_dy.Clear();
|
||||
|
||||
for (auto const &item : *textProps->dy) {
|
||||
m_dy.Append(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (textProps->rotate != std::nullopt) {
|
||||
m_rotate.Clear();
|
||||
|
||||
for (auto const &item : *textProps->rotate) {
|
||||
m_rotate.Append(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
}
|
||||
#else
|
||||
void TextView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
|
||||
@@ -125,7 +48,6 @@ void TextView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate,
|
||||
|
||||
__super::UpdateProperties(reader, forceUpdate, invalidate);
|
||||
}
|
||||
#endif
|
||||
|
||||
void TextView::DrawGroup(RNSVG::D2DDeviceContext const &context, Size const &size) {
|
||||
com_ptr<ID2D1DeviceContext> deviceContext{get_self<D2DDeviceContext>(context)->Get()};
|
||||
|
||||
@@ -1,72 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "SvgTextCommonProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "TextView.g.h"
|
||||
#include "GroupView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#define REACT_SVG_TEXT_COMMON_PROPS \
|
||||
REACT_FIELD(dx) \
|
||||
REACT_FIELD(dy) \
|
||||
REACT_FIELD(x) \
|
||||
REACT_FIELD(y) \
|
||||
REACT_FIELD(rotate) \
|
||||
REACT_FIELD(inlineSize) \
|
||||
REACT_FIELD(textLength) \
|
||||
REACT_FIELD(baselineShift) \
|
||||
REACT_FIELD(lengthAdjust) \
|
||||
REACT_FIELD(alignmentBaseline) \
|
||||
REACT_FIELD(verticalAlign)
|
||||
|
||||
REACT_STRUCT(SvgTextCommonProps)
|
||||
struct SvgTextCommonProps : SvgTextCommonPropsT<SvgTextCommonProps, SvgGroupCommonProps> {
|
||||
SvgTextCommonProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
REACT_SVG_GROUP_COMMON_PROPS;
|
||||
|
||||
std::optional<std::vector<RNSVG::SVGLength>> dx;
|
||||
std::optional<std::vector<RNSVG::SVGLength>> dy;
|
||||
std::optional<std::vector<RNSVG::SVGLength>> x;
|
||||
std::optional<std::vector<RNSVG::SVGLength>> y;
|
||||
std::optional<std::vector<RNSVG::SVGLength>> rotate;
|
||||
RNSVG::SVGLength inlineSize{0, winrt::RNSVG::LengthType::Unknown};
|
||||
RNSVG::SVGLength textLength{0, winrt::RNSVG::LengthType::Unknown};
|
||||
RNSVG::SVGLength baselineShift{0, winrt::RNSVG::LengthType::Unknown};
|
||||
std::string lengthAdjust;
|
||||
std::string alignmentBaseline;
|
||||
RNSVG::SVGLength verticalAlign{0, winrt::RNSVG::LengthType::Unknown};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct TextView : TextViewT<TextView, RNSVG::implementation::GroupView> {
|
||||
public:
|
||||
TextView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
TextView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
|
||||
// IRenderableFabric
|
||||
virtual void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept;
|
||||
#else
|
||||
// IRenderablePaper
|
||||
virtual void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
Windows::Foundation::Collections::IVector<RNSVG::SVGLength> X() { return m_x; }
|
||||
Windows::Foundation::Collections::IVector<RNSVG::SVGLength> Y() { return m_y; }
|
||||
@@ -83,13 +27,9 @@ struct TextView : TextViewT<TextView, RNSVG::implementation::GroupView> {
|
||||
Windows::Foundation::Collections::IVector<RNSVG::SVGLength> m_dx{winrt::single_threaded_vector<RNSVG::SVGLength>()};
|
||||
Windows::Foundation::Collections::IVector<RNSVG::SVGLength> m_dy{winrt::single_threaded_vector<RNSVG::SVGLength>()};
|
||||
Windows::Foundation::Collections::IVector<RNSVG::SVGLength> m_rotate{winrt::single_threaded_vector<RNSVG::SVGLength>()};
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<SvgTextCommonProps> m_props;
|
||||
#endif
|
||||
|
||||
};
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
namespace winrt::RNSVG::factory_implementation {
|
||||
struct TextView : TextViewT<TextView, implementation::TextView> {};
|
||||
} // namespace winrt::RNSVG::factory_implementation
|
||||
|
||||
@@ -11,49 +11,6 @@ using namespace Microsoft::ReactNative;
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
UseProps::UseProps(const winrt::Microsoft::ReactNative::ViewProps &props) : base_type(props) {}
|
||||
|
||||
void UseProps::SetProp(
|
||||
uint32_t hash,
|
||||
winrt::hstring propName,
|
||||
winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
||||
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
||||
}
|
||||
|
||||
UseView::UseView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) : base_type(args) {}
|
||||
|
||||
void UseView::RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept {
|
||||
builder.AddViewComponent(
|
||||
L"RNSVGUse", [](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
||||
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::UseProps>(props);
|
||||
});
|
||||
builder.SetCreateComponentView([](const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args) noexcept {
|
||||
return winrt::make<winrt::RNSVG::implementation::UseView>(args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void UseView::UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate,
|
||||
bool invalidate) noexcept {
|
||||
auto useProps = props.try_as<UseProps>();
|
||||
if (useProps) {
|
||||
m_props = useProps;
|
||||
|
||||
m_href = winrt::to_hstring(m_props->href);
|
||||
m_x = m_props->x;
|
||||
m_y = m_props->y;
|
||||
m_width = m_props->width;
|
||||
m_height = m_props->height;
|
||||
}
|
||||
|
||||
base_type::UpdateProperties(props, oldProps, forceUpdate, invalidate);
|
||||
}
|
||||
#else
|
||||
void UseView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, bool invalidate) {
|
||||
const JSValueObject &propertyMap{JSValue::ReadObjectFrom(reader)};
|
||||
|
||||
@@ -76,7 +33,6 @@ void UseView::UpdateProperties(IJSValueReader const &reader, bool forceUpdate, b
|
||||
|
||||
__super::UpdateProperties(reader, forceUpdate, invalidate);
|
||||
}
|
||||
#endif
|
||||
|
||||
void UseView::Draw(RNSVG::D2DDeviceContext const &context, Size const &size) {
|
||||
if (auto const &view{GetRenderableTemplate()}) {
|
||||
@@ -129,11 +85,7 @@ void UseView::Draw(RNSVG::D2DDeviceContext const &context, Size const &size) {
|
||||
deviceContext->PopLayer();
|
||||
|
||||
// Restore original template props
|
||||
#ifdef USE_FABRIC
|
||||
auto renderable{view.try_as<RNSVG::IRenderableFabric>()};
|
||||
#else
|
||||
auto renderable{view.try_as<RNSVG::IRenderablePaper>()};
|
||||
#endif
|
||||
if (renderable) {
|
||||
if (auto const &parent{renderable.SvgParent().try_as<RNSVG::RenderableView>()}) {
|
||||
view.MergeProperties(parent);
|
||||
|
||||
@@ -1,57 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include "UseProps.g.h"
|
||||
#endif
|
||||
|
||||
#include "UseView.g.h"
|
||||
#include "RenderableView.h"
|
||||
|
||||
namespace winrt::RNSVG::implementation {
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
REACT_STRUCT(UseProps)
|
||||
struct UseProps : UsePropsT<UseProps, SvgRenderableCommonProps> {
|
||||
UseProps(const winrt::Microsoft::ReactNative::ViewProps &props);
|
||||
|
||||
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept
|
||||
override;
|
||||
|
||||
REACT_SVG_NODE_COMMON_PROPS;
|
||||
REACT_SVG_RENDERABLE_COMMON_PROPS;
|
||||
|
||||
REACT_FIELD(href)
|
||||
std::string href;
|
||||
REACT_FIELD(x)
|
||||
RNSVG::SVGLength x{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(y)
|
||||
RNSVG::SVGLength y{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(width)
|
||||
RNSVG::SVGLength width{0, winrt::RNSVG::LengthType::Unknown};
|
||||
REACT_FIELD(height)
|
||||
RNSVG::SVGLength height{0, winrt::RNSVG::LengthType::Unknown};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct UseView : UseViewT<UseView, RNSVG::implementation::RenderableView> {
|
||||
public:
|
||||
UseView() = default;
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
UseView(const winrt::Microsoft::ReactNative::CreateComponentViewArgs &args);
|
||||
|
||||
// IRenderableFabric
|
||||
void UpdateProperties(
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &props,
|
||||
const winrt::Microsoft::ReactNative::IComponentProps &oldProps,
|
||||
bool forceUpdate = true,
|
||||
bool invalidate = true) noexcept override;
|
||||
|
||||
static void RegisterComponent(const winrt::Microsoft::ReactNative::IReactPackageBuilderFabric &builder) noexcept;
|
||||
#else
|
||||
// IRenderablePaper
|
||||
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
||||
#endif
|
||||
|
||||
// RenderableView
|
||||
void Draw(RNSVG::D2DDeviceContext const &deviceContext, Windows::Foundation::Size const &size);
|
||||
@@ -63,10 +22,6 @@ private:
|
||||
RNSVG::SVGLength m_width{};
|
||||
RNSVG::SVGLength m_height{};
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
com_ptr<UseProps> m_props;
|
||||
#endif
|
||||
|
||||
RNSVG::IRenderable GetRenderableTemplate();
|
||||
};
|
||||
} // namespace winrt::RNSVG::implementation
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
#include <winrt/Microsoft.ReactNative.Composition.h>
|
||||
#include <winrt/Microsoft.ReactNative.Composition.Experimental.h>
|
||||
#endif
|
||||
|
||||
#include <winrt/Windows.Foundation.Numerics.h>
|
||||
#include <UI.Text.h>
|
||||
#include "JSValueReader.h"
|
||||
@@ -171,54 +166,6 @@ struct Utils {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_FABRIC
|
||||
static std::string JSValueAsBrushUnits(
|
||||
std::optional<int32_t> const &value,
|
||||
std::string defaultValue = "objectBoundingBox") {
|
||||
return (value.has_value() && *value == 1) ? "userSpaceOnUse" : defaultValue;
|
||||
}
|
||||
|
||||
static float JSValueAsFloat(std::optional<float> const &value, float defaultValue = 0.0f) {
|
||||
return value.has_value() ? *value : defaultValue;
|
||||
}
|
||||
|
||||
static std::string JSValueAsString(std::optional<std::string> const &value, std::string defaultValue = "") {
|
||||
return value.has_value() ? *value : defaultValue;
|
||||
}
|
||||
|
||||
static D2D1::Matrix3x2F JSValueAsD2DTransform(std::optional<std::vector<float>> const &value) {
|
||||
if (value.has_value()) {
|
||||
auto matrix{value.value()};
|
||||
return D2D1::Matrix3x2F(
|
||||
matrix.at(0),
|
||||
matrix.at(1),
|
||||
matrix.at(2),
|
||||
matrix.at(3),
|
||||
matrix.at(4),
|
||||
matrix.at(5));
|
||||
}
|
||||
|
||||
return D2D1::Matrix3x2F::Identity();
|
||||
}
|
||||
|
||||
static std::vector<D2D1_GRADIENT_STOP> JSValueAsGradientStops(std::optional<std::vector<float>> const &value) {
|
||||
if (value.has_value()) {
|
||||
auto gradient = value.value();
|
||||
std::vector<D2D1_GRADIENT_STOP> gradientStops;
|
||||
|
||||
for (size_t i = 0; i < gradient.size(); ++i) {
|
||||
D2D1_GRADIENT_STOP stop{};
|
||||
stop.position = Utils::JSValueAsFloat(gradient.at(i));
|
||||
stop.color = D2DHelpers::AsD2DColor(Utils::JSValueAsD2DColor(gradient.at(++i)));
|
||||
gradientStops.emplace_back(stop);
|
||||
}
|
||||
|
||||
return gradientStops;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
#else
|
||||
static std::string JSValueAsBrushUnits(JSValue const &value, std::string defaultValue = "objectBoundingBox") {
|
||||
if (value.IsNull()) {
|
||||
return defaultValue;
|
||||
@@ -306,7 +253,6 @@ struct Utils {
|
||||
|
||||
return gradientStops;
|
||||
}
|
||||
#endif
|
||||
|
||||
static winrt::Windows::UI::Color JSValueAsD2DColor(float value) {
|
||||
auto color = static_cast<int32_t>(value);
|
||||
@@ -321,11 +267,7 @@ struct Utils {
|
||||
|
||||
static com_ptr<ID2D1Brush> GetCanvasBrush(
|
||||
hstring const &brushId,
|
||||
#ifdef USE_FABRIC
|
||||
winrt::Microsoft::ReactNative::Color const &color,
|
||||
#else
|
||||
Windows::UI::Color const &color,
|
||||
#endif
|
||||
RNSVG::SvgView const &root,
|
||||
com_ptr<ID2D1Geometry> const &geometry,
|
||||
RNSVG::D2DDeviceContext const &context) {
|
||||
@@ -337,11 +279,7 @@ struct Utils {
|
||||
if (root && brushId != L"") {
|
||||
if (brushId == L"currentColor") {
|
||||
com_ptr<ID2D1SolidColorBrush> scb;
|
||||
#ifdef USE_FABRIC
|
||||
winColor = root.CurrentColor().AsWindowsColor(root.Theme());
|
||||
#else
|
||||
winColor = root.CurrentColor();
|
||||
#endif
|
||||
deviceContext->CreateSolidColorBrush(D2DHelpers::AsD2DColor(winColor), scb.put());
|
||||
brush = scb.as<ID2D1Brush>();
|
||||
} else if (auto const &brushView{root.Brushes().TryLookup(brushId)}) {
|
||||
@@ -360,11 +298,7 @@ struct Utils {
|
||||
if (!brush) {
|
||||
com_ptr<ID2D1SolidColorBrush> scb;
|
||||
assert(root != nullptr);
|
||||
#ifdef USE_FABRIC
|
||||
winColor = color.AsWindowsColor(root.Theme());
|
||||
#else
|
||||
winColor = color;
|
||||
#endif
|
||||
deviceContext->CreateSolidColorBrush(D2DHelpers::AsD2DColor(winColor), scb.put());
|
||||
brush = scb.as<ID2D1Brush>();
|
||||
}
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
namespace RNSVG
|
||||
{
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass SvgNodeCommonProps : Microsoft.ReactNative.IComponentProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass SvgRenderableCommonProps : SvgNodeCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
runtimeclass SvgViewProps : Microsoft.ReactNative.IComponentProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass RectProps : SvgRenderableCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass CircleProps : SvgRenderableCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass EllipseProps : SvgRenderableCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass LineProps : SvgRenderableCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass PathProps : SvgRenderableCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass UseProps : SvgRenderableCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass SymbolProps : SvgRenderableCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass ImageProps : SvgRenderableCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass SvgGroupCommonProps : SvgRenderableCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass DefsProps : SvgGroupCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass ClipPathProps : SvgGroupCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass MarkerProps : SvgGroupCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass MaskProps : SvgGroupCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass LinearGradientProps : SvgGroupCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass RadialGradientProps : SvgGroupCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass PatternProps : SvgGroupCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass SvgTextCommonProps : SvgGroupCommonProps {
|
||||
};
|
||||
|
||||
[experimental]
|
||||
[default_interface]
|
||||
unsealed runtimeclass TSpanProps : SvgTextCommonProps {
|
||||
};
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user