react-native-windows 0.0.0-canary.486 → 0.0.0-canary.489
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Chakra/ChakraHelpers.cpp +0 -1
- package/Libraries/StyleSheet/processTransform.windows.js +272 -0
- package/Microsoft.ReactNative/DynamicReader.cpp +3 -3
- package/Microsoft.ReactNative/Fabric/SliderComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/SwitchComponentView.h +1 -1
- package/Microsoft.ReactNative/Modules/CreateModules.cpp +3 -3
- package/Microsoft.ReactNative/ReactHost/ReactNativeHeaders.h +1 -1
- package/Microsoft.ReactNative/ReactRootView.cpp +2 -1
- package/Microsoft.ReactNative/RedBox.cpp +2 -1
- package/Microsoft.ReactNative/Utils/ValueUtils.cpp +2 -1
- package/Microsoft.ReactNative/Views/DevMenu.cpp +2 -2
- package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +91 -19
- package/Microsoft.ReactNative/Views/Image/Microsoft.UI.Composition.Effects_Impl.h +5 -11
- package/Microsoft.ReactNative/Views/Image/ReactImage.cpp +2 -1
- package/Microsoft.ReactNative.Cxx/CppWinRTIncludes.h +0 -2
- package/Microsoft.ReactNative.Cxx/DesktopWindowBridge.h +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +1 -1
- package/Microsoft.ReactNative.Cxx/JSValueReader.h +2 -2
- package/Microsoft.ReactNative.Cxx/JSValueWriter.h +5 -5
- package/Microsoft.ReactNative.Cxx/NativeModules.h +1 -1
- package/Microsoft.ReactNative.Cxx/ReactContext.h +3 -3
- package/Microsoft.ReactNative.Cxx/ReactNonAbiValue.h +3 -3
- package/Microsoft.ReactNative.Cxx/XamlUtils.h +5 -0
- package/Microsoft.ReactNative.Managed/packages.lock.json +1 -1
- package/Mso/activeObject/activeObject.h +2 -2
- package/Mso/compilerAdapters/cppMacros.h +3 -5
- package/Mso/errorCode/errorProvider.h +2 -2
- package/Mso/errorCode/maybe.h +4 -4
- package/Mso/functional/functor.h +6 -6
- package/Mso/functional/functorRef.h +2 -2
- package/Mso/future/details/executor.h +2 -2
- package/Mso/future/details/futureFuncInl.h +4 -4
- package/Mso/future/details/ifuture.h +3 -3
- package/Mso/future/details/maybeInvoker.h +6 -6
- package/Mso/future/details/promiseGroupInl.h +4 -4
- package/Mso/future/details/promiseInl.h +4 -4
- package/Mso/future/details/resultTraits.h +4 -4
- package/Mso/future/details/whenAllInl.h +1 -1
- package/Mso/future/future.h +13 -13
- package/Mso/guid/msoGuidDetails.h +1 -1
- package/Mso/memoryApi/memoryApi.h +13 -7
- package/Mso/motifCpp/gTestAdapter.h +1 -1
- package/Mso/motifCpp/testInfo.h +7 -9
- package/Mso/object/make.h +8 -8
- package/Mso/object/objectRefCount.h +3 -5
- package/Mso/object/objectWithWeakRef.h +10 -14
- package/Mso/object/queryCast.h +4 -4
- package/Mso/object/refCountedObject.h +4 -4
- package/Mso/object/unknownObject.h +7 -7
- package/Mso/platformAdapters/windowsFirst.h +1 -1
- package/Mso/smartPtr/cntPtr.h +8 -8
- package/Mso/src/future/futureImpl.h +1 -1
- package/Mso/src/memoryApi/memoryApi.cpp +4 -4
- package/PropertySheets/Generated/PackageVersion.g.props +1 -1
- package/ReactCommon/ReactCommon.vcxproj +0 -3
- package/Scripts/OfficeReact.Win32.nuspec +1 -1
- package/Shared/AbiSafe.h +3 -3
- package/Shared/BaseScriptStoreImpl.cpp +1 -1
- package/Shared/CppRuntimeOptions.h +50 -0
- package/Shared/InspectorPackagerConnection.cpp +7 -5
- package/Shared/InspectorPackagerConnection.h +2 -2
- package/Shared/JSI/ChakraApi.cpp +0 -1
- package/Shared/JSI/ChakraRuntime.cpp +1 -2
- package/Shared/Modules/HttpModule.cpp +1 -1
- package/Shared/Modules/HttpModule.h +2 -2
- package/Shared/Modules/WebSocketModule.cpp +1 -1
- package/Shared/Modules/WebSocketModule.h +8 -5
- package/Shared/{IHttpResource.h → Networking/IHttpResource.h} +4 -4
- package/Shared/{IWebSocketResource.h → Networking/IWebSocketResource.h} +3 -3
- package/Shared/Networking/OriginPolicy.h +15 -0
- package/Shared/Networking/OriginPolicyHttpFilter.cpp +746 -0
- package/Shared/Networking/OriginPolicyHttpFilter.h +112 -0
- package/Shared/{WinRTHttpResource.cpp → Networking/WinRTHttpResource.cpp} +129 -99
- package/Shared/{WinRTHttpResource.h → Networking/WinRTHttpResource.h} +8 -12
- package/Shared/Networking/WinRTTypes.h +30 -0
- package/Shared/{WinRTWebSocketResource.cpp → Networking/WinRTWebSocketResource.cpp} +18 -3
- package/Shared/{WinRTWebSocketResource.h → Networking/WinRTWebSocketResource.h} +3 -3
- package/Shared/OInstance.cpp +1 -1
- package/Shared/RuntimeOptions.cpp +93 -15
- package/Shared/RuntimeOptions.h +22 -9
- package/Shared/Shared.vcxitems +11 -7
- package/Shared/Shared.vcxitems.filters +39 -21
- package/Shared/Threading/BatchingQueueThread.cpp +1 -1
- package/Shared/tracing/fbsystrace.h +2 -2
- package/include/Shared/cdebug.h +9 -9
- package/package.json +4 -4
- package/Shared/cdebug.cpp +0 -6
package/Chakra/ChakraHelpers.cpp
CHANGED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @flow
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
const MatrixMath = require('../Utilities/MatrixMath');
|
|
14
|
+
const Platform = require('../Utilities/Platform');
|
|
15
|
+
|
|
16
|
+
const invariant = require('invariant');
|
|
17
|
+
const stringifySafe = require('../Utilities/stringifySafe').default;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generate a transform matrix based on the provided transforms, and use that
|
|
21
|
+
* within the style object instead.
|
|
22
|
+
*
|
|
23
|
+
* This allows us to provide an API that is similar to CSS, where transforms may
|
|
24
|
+
* be applied in an arbitrary order, and yet have a universal, singular
|
|
25
|
+
* interface to native code.
|
|
26
|
+
*/
|
|
27
|
+
function processTransform(
|
|
28
|
+
transform: Array<Object>,
|
|
29
|
+
): Array<Object> | Array<number> {
|
|
30
|
+
if (__DEV__) {
|
|
31
|
+
_validateTransforms(transform);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Android & iOS implementations of transform property accept the list of
|
|
35
|
+
// transform properties as opposed to a transform Matrix. This is necessary
|
|
36
|
+
// to control transform property updates completely on the native thread.
|
|
37
|
+
if (
|
|
38
|
+
Platform.OS === 'android' ||
|
|
39
|
+
Platform.OS === 'ios' ||
|
|
40
|
+
Platform.OS === 'windows'
|
|
41
|
+
) {
|
|
42
|
+
return transform;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const result = MatrixMath.createIdentityMatrix();
|
|
46
|
+
|
|
47
|
+
transform.forEach(transformation => {
|
|
48
|
+
const key = Object.keys(transformation)[0];
|
|
49
|
+
const value = transformation[key];
|
|
50
|
+
|
|
51
|
+
switch (key) {
|
|
52
|
+
case 'matrix':
|
|
53
|
+
MatrixMath.multiplyInto(result, result, value);
|
|
54
|
+
break;
|
|
55
|
+
case 'perspective':
|
|
56
|
+
_multiplyTransform(result, MatrixMath.reusePerspectiveCommand, [value]);
|
|
57
|
+
break;
|
|
58
|
+
case 'rotateX':
|
|
59
|
+
_multiplyTransform(result, MatrixMath.reuseRotateXCommand, [
|
|
60
|
+
_convertToRadians(value),
|
|
61
|
+
]);
|
|
62
|
+
break;
|
|
63
|
+
case 'rotateY':
|
|
64
|
+
_multiplyTransform(result, MatrixMath.reuseRotateYCommand, [
|
|
65
|
+
_convertToRadians(value),
|
|
66
|
+
]);
|
|
67
|
+
break;
|
|
68
|
+
case 'rotate':
|
|
69
|
+
case 'rotateZ':
|
|
70
|
+
_multiplyTransform(result, MatrixMath.reuseRotateZCommand, [
|
|
71
|
+
_convertToRadians(value),
|
|
72
|
+
]);
|
|
73
|
+
break;
|
|
74
|
+
case 'scale':
|
|
75
|
+
_multiplyTransform(result, MatrixMath.reuseScaleCommand, [value]);
|
|
76
|
+
break;
|
|
77
|
+
case 'scaleX':
|
|
78
|
+
_multiplyTransform(result, MatrixMath.reuseScaleXCommand, [value]);
|
|
79
|
+
break;
|
|
80
|
+
case 'scaleY':
|
|
81
|
+
_multiplyTransform(result, MatrixMath.reuseScaleYCommand, [value]);
|
|
82
|
+
break;
|
|
83
|
+
case 'translate':
|
|
84
|
+
_multiplyTransform(result, MatrixMath.reuseTranslate3dCommand, [
|
|
85
|
+
value[0],
|
|
86
|
+
value[1],
|
|
87
|
+
value[2] || 0,
|
|
88
|
+
]);
|
|
89
|
+
break;
|
|
90
|
+
case 'translateX':
|
|
91
|
+
_multiplyTransform(result, MatrixMath.reuseTranslate2dCommand, [
|
|
92
|
+
value,
|
|
93
|
+
0,
|
|
94
|
+
]);
|
|
95
|
+
break;
|
|
96
|
+
case 'translateY':
|
|
97
|
+
_multiplyTransform(result, MatrixMath.reuseTranslate2dCommand, [
|
|
98
|
+
0,
|
|
99
|
+
value,
|
|
100
|
+
]);
|
|
101
|
+
break;
|
|
102
|
+
case 'skewX':
|
|
103
|
+
_multiplyTransform(result, MatrixMath.reuseSkewXCommand, [
|
|
104
|
+
_convertToRadians(value),
|
|
105
|
+
]);
|
|
106
|
+
break;
|
|
107
|
+
case 'skewY':
|
|
108
|
+
_multiplyTransform(result, MatrixMath.reuseSkewYCommand, [
|
|
109
|
+
_convertToRadians(value),
|
|
110
|
+
]);
|
|
111
|
+
break;
|
|
112
|
+
default:
|
|
113
|
+
throw new Error('Invalid transform name: ' + key);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Performs a destructive operation on a transform matrix.
|
|
122
|
+
*/
|
|
123
|
+
function _multiplyTransform(
|
|
124
|
+
result: Array<number>,
|
|
125
|
+
matrixMathFunction: Function,
|
|
126
|
+
args: Array<number>,
|
|
127
|
+
): void {
|
|
128
|
+
const matrixToApply = MatrixMath.createIdentityMatrix();
|
|
129
|
+
const argsWithIdentity = [matrixToApply].concat(args);
|
|
130
|
+
matrixMathFunction.apply(this, argsWithIdentity);
|
|
131
|
+
MatrixMath.multiplyInto(result, result, matrixToApply);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Parses a string like '0.5rad' or '60deg' into radians expressed in a float.
|
|
136
|
+
* Note that validation on the string is done in `_validateTransform()`.
|
|
137
|
+
*/
|
|
138
|
+
function _convertToRadians(value: string): number {
|
|
139
|
+
const floatValue = parseFloat(value);
|
|
140
|
+
return value.indexOf('rad') > -1 ? floatValue : (floatValue * Math.PI) / 180;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function _validateTransforms(transform: Array<Object>): void {
|
|
144
|
+
transform.forEach(transformation => {
|
|
145
|
+
const keys = Object.keys(transformation);
|
|
146
|
+
invariant(
|
|
147
|
+
keys.length === 1,
|
|
148
|
+
'You must specify exactly one property per transform object. Passed properties: %s',
|
|
149
|
+
stringifySafe(transformation),
|
|
150
|
+
);
|
|
151
|
+
const key = keys[0];
|
|
152
|
+
const value = transformation[key];
|
|
153
|
+
_validateTransform(key, value, transformation);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function _validateTransform(
|
|
158
|
+
key:
|
|
159
|
+
| string
|
|
160
|
+
| $TEMPORARY$string<'matrix'>
|
|
161
|
+
| $TEMPORARY$string<'perspective'>
|
|
162
|
+
| $TEMPORARY$string<'rotate'>
|
|
163
|
+
| $TEMPORARY$string<'rotateX'>
|
|
164
|
+
| $TEMPORARY$string<'rotateY'>
|
|
165
|
+
| $TEMPORARY$string<'rotateZ'>
|
|
166
|
+
| $TEMPORARY$string<'scale'>
|
|
167
|
+
| $TEMPORARY$string<'scaleX'>
|
|
168
|
+
| $TEMPORARY$string<'scaleY'>
|
|
169
|
+
| $TEMPORARY$string<'skewX'>
|
|
170
|
+
| $TEMPORARY$string<'skewY'>
|
|
171
|
+
| $TEMPORARY$string<'translate'>
|
|
172
|
+
| $TEMPORARY$string<'translateX'>
|
|
173
|
+
| $TEMPORARY$string<'translateY'>,
|
|
174
|
+
value: any | number | string,
|
|
175
|
+
transformation: any,
|
|
176
|
+
) {
|
|
177
|
+
invariant(
|
|
178
|
+
!value.getValue,
|
|
179
|
+
'You passed an Animated.Value to a normal component. ' +
|
|
180
|
+
'You need to wrap that component in an Animated. For example, ' +
|
|
181
|
+
'replace <View /> by <Animated.View />.',
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const multivalueTransforms = ['matrix', 'translate'];
|
|
185
|
+
if (multivalueTransforms.indexOf(key) !== -1) {
|
|
186
|
+
invariant(
|
|
187
|
+
Array.isArray(value),
|
|
188
|
+
'Transform with key of %s must have an array as the value: %s',
|
|
189
|
+
key,
|
|
190
|
+
stringifySafe(transformation),
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
switch (key) {
|
|
194
|
+
case 'matrix':
|
|
195
|
+
invariant(
|
|
196
|
+
value.length === 9 || value.length === 16,
|
|
197
|
+
'Matrix transform must have a length of 9 (2d) or 16 (3d). ' +
|
|
198
|
+
'Provided matrix has a length of %s: %s',
|
|
199
|
+
/* $FlowFixMe[prop-missing] (>=0.84.0 site=react_native_fb) This
|
|
200
|
+
* comment suppresses an error found when Flow v0.84 was deployed. To
|
|
201
|
+
* see the error, delete this comment and run Flow. */
|
|
202
|
+
value.length,
|
|
203
|
+
stringifySafe(transformation),
|
|
204
|
+
);
|
|
205
|
+
break;
|
|
206
|
+
case 'translate':
|
|
207
|
+
invariant(
|
|
208
|
+
value.length === 2 || value.length === 3,
|
|
209
|
+
'Transform with key translate must be an array of length 2 or 3, found %s: %s',
|
|
210
|
+
/* $FlowFixMe[prop-missing] (>=0.84.0 site=react_native_fb) This
|
|
211
|
+
* comment suppresses an error found when Flow v0.84 was deployed. To
|
|
212
|
+
* see the error, delete this comment and run Flow. */
|
|
213
|
+
value.length,
|
|
214
|
+
stringifySafe(transformation),
|
|
215
|
+
);
|
|
216
|
+
break;
|
|
217
|
+
case 'rotateX':
|
|
218
|
+
case 'rotateY':
|
|
219
|
+
case 'rotateZ':
|
|
220
|
+
case 'rotate':
|
|
221
|
+
case 'skewX':
|
|
222
|
+
case 'skewY':
|
|
223
|
+
invariant(
|
|
224
|
+
typeof value === 'string',
|
|
225
|
+
'Transform with key of "%s" must be a string: %s',
|
|
226
|
+
key,
|
|
227
|
+
stringifySafe(transformation),
|
|
228
|
+
);
|
|
229
|
+
invariant(
|
|
230
|
+
value.indexOf('deg') > -1 || value.indexOf('rad') > -1,
|
|
231
|
+
'Rotate transform must be expressed in degrees (deg) or radians ' +
|
|
232
|
+
'(rad): %s',
|
|
233
|
+
stringifySafe(transformation),
|
|
234
|
+
);
|
|
235
|
+
break;
|
|
236
|
+
case 'perspective':
|
|
237
|
+
invariant(
|
|
238
|
+
typeof value === 'number',
|
|
239
|
+
'Transform with key of "%s" must be a number: %s',
|
|
240
|
+
key,
|
|
241
|
+
stringifySafe(transformation),
|
|
242
|
+
);
|
|
243
|
+
invariant(
|
|
244
|
+
value !== 0,
|
|
245
|
+
'Transform with key of "%s" cannot be zero: %s',
|
|
246
|
+
key,
|
|
247
|
+
stringifySafe(transformation),
|
|
248
|
+
);
|
|
249
|
+
break;
|
|
250
|
+
case 'translateX':
|
|
251
|
+
case 'translateY':
|
|
252
|
+
case 'scale':
|
|
253
|
+
case 'scaleX':
|
|
254
|
+
case 'scaleY':
|
|
255
|
+
invariant(
|
|
256
|
+
typeof value === 'number',
|
|
257
|
+
'Transform with key of "%s" must be a number: %s',
|
|
258
|
+
key,
|
|
259
|
+
stringifySafe(transformation),
|
|
260
|
+
);
|
|
261
|
+
break;
|
|
262
|
+
default:
|
|
263
|
+
invariant(
|
|
264
|
+
false,
|
|
265
|
+
'Invalid transform %s: %s',
|
|
266
|
+
key,
|
|
267
|
+
stringifySafe(transformation),
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
module.exports = processTransform;
|
|
@@ -140,9 +140,9 @@ bool DynamicReader::GetBoolean() noexcept {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
int64_t DynamicReader::GetInt64() noexcept {
|
|
143
|
-
return (m_current->type() == folly::dynamic::Type::INT64)
|
|
144
|
-
? m_current->
|
|
145
|
-
|
|
143
|
+
return (m_current->type() == folly::dynamic::Type::INT64) ? m_current->getInt()
|
|
144
|
+
: (m_current->type() == folly::dynamic::Type::DOUBLE) ? static_cast<int64_t>(m_current->getDouble())
|
|
145
|
+
: 0;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
double DynamicReader::GetDouble() noexcept {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
#include <CreateModules.h>
|
|
5
|
+
#include <Networking/WinRTWebSocketResource.h>
|
|
5
6
|
#include <QuirkSettings.h>
|
|
6
7
|
#include <React.h>
|
|
7
8
|
#include <ReactPropertyBag.h>
|
|
8
|
-
#include <WinRTWebSocketResource.h>
|
|
9
9
|
|
|
10
10
|
// React Native
|
|
11
11
|
#include <cxxreact/CxxModule.h>
|
|
@@ -17,11 +17,11 @@ using winrt::Microsoft::ReactNative::ReactPropertyBag;
|
|
|
17
17
|
using winrt::Microsoft::ReactNative::ReactPropertyId;
|
|
18
18
|
using winrt::Microsoft::ReactNative::implementation::QuirkSettings;
|
|
19
19
|
|
|
20
|
-
namespace Microsoft::React {
|
|
20
|
+
namespace Microsoft::React::Networking {
|
|
21
21
|
|
|
22
22
|
std::shared_ptr<IWebSocketResource> IWebSocketResource::Make() {
|
|
23
23
|
std::vector<winrt::Windows::Security::Cryptography::Certificates::ChainValidationResult> certExceptions;
|
|
24
24
|
return std::make_shared<WinRTWebSocketResource>(std::move(certExceptions));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
} // namespace Microsoft::React
|
|
27
|
+
} // namespace Microsoft::React::Networking
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
#include <winrt/Windows.UI.Core.h>
|
|
14
14
|
#include "ReactNativeHost.h"
|
|
15
15
|
#include "ReactViewInstance.h"
|
|
16
|
+
#include "XamlUtils.h"
|
|
16
17
|
|
|
17
18
|
#include <winrt/Microsoft.UI.Xaml.Controls.h>
|
|
18
19
|
|
|
@@ -269,7 +270,7 @@ void ReactRootView::EnsureLoadingUI() noexcept {
|
|
|
269
270
|
m_greenBoxGrid.ColumnDefinitions().Append(c);
|
|
270
271
|
|
|
271
272
|
m_waitingTextBlock.SetValue(xaml::Controls::Grid::ColumnProperty(), winrt::box_value(1));
|
|
272
|
-
m_greenBoxGrid.Background(xaml::Media::SolidColorBrush(
|
|
273
|
+
m_greenBoxGrid.Background(xaml::Media::SolidColorBrush(xaml::FromArgb(0x80, 0x03, 0x29, 0x29)));
|
|
273
274
|
m_greenBoxGrid.Children().Append(m_waitingTextBlock);
|
|
274
275
|
m_greenBoxGrid.VerticalAlignment(xaml::VerticalAlignment::Center);
|
|
275
276
|
Microsoft::UI::Xaml::Controls::ProgressRing ring{};
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
#include <winrt/Windows.Web.Http.h>
|
|
28
28
|
#include "CppWinRTIncludes.h"
|
|
29
29
|
#include "Utils/Helpers.h"
|
|
30
|
+
#include "XamlUtils.h"
|
|
30
31
|
#endif
|
|
31
32
|
|
|
32
33
|
using namespace winrt::Windows::Foundation;
|
|
@@ -274,7 +275,7 @@ struct RedBox : public std::enable_shared_from_this<RedBox> {
|
|
|
274
275
|
xaml::Documents::Run linkRun;
|
|
275
276
|
|
|
276
277
|
linkRun.Text(Microsoft::Common::Unicode::Utf8ToUtf16(METRO_TROUBLESHOOTING_URL));
|
|
277
|
-
link.Foreground(xaml::Media::SolidColorBrush(
|
|
278
|
+
link.Foreground(xaml::Media::SolidColorBrush(xaml::FromArgb(0xff, 0xff, 0xff, 0xff)));
|
|
278
279
|
link.Inlines().Append(linkRun);
|
|
279
280
|
xaml::Documents::Run normalRun;
|
|
280
281
|
normalRun.Text(Microsoft::Common::Unicode::Utf8ToUtf16(json["type"].asString() + (" ─ See ")));
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
#include <Utils/ValueUtils.h>
|
|
10
10
|
#include <winrt/Windows.UI.ViewManagement.h>
|
|
11
11
|
#include "Unicode.h"
|
|
12
|
+
#include "XamlUtils.h"
|
|
12
13
|
|
|
13
14
|
#include <JSValue.h>
|
|
14
15
|
#include <folly/dynamic.h>
|
|
@@ -157,7 +158,7 @@ xaml::Media::Brush BrushFromColorObject(const winrt::Microsoft::ReactNative::JSV
|
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
winrt::Color ColorFromNumber(DWORD argb) noexcept {
|
|
160
|
-
return
|
|
161
|
+
return xaml::FromArgb(GetAFromArgb(argb), GetRFromArgb(argb), GetGFromArgb(argb), GetBFromArgb(argb));
|
|
161
162
|
}
|
|
162
163
|
|
|
163
164
|
REACTWINDOWS_API_(winrt::Color) ColorFrom(const folly::dynamic &d) {
|
|
@@ -205,8 +205,8 @@ void DevMenuManager::CreateAndShowUI() noexcept {
|
|
|
205
205
|
if (Mso::React::ReactOptions::JsiEngine(m_context->Properties()) == Mso::React::JSIEngine::Hermes) {
|
|
206
206
|
m_samplingProfilerRevoker = devMenu.SamplingProfiler().Click(
|
|
207
207
|
winrt::auto_revoke,
|
|
208
|
-
[wkThis = weak_from_this()](
|
|
209
|
-
|
|
208
|
+
[wkThis = weak_from_this()](auto & /*sender*/, xaml::RoutedEventArgs const & /*args*/) noexcept
|
|
209
|
+
-> winrt::fire_and_forget {
|
|
210
210
|
if (auto strongThis = wkThis.lock()) {
|
|
211
211
|
strongThis->Hide();
|
|
212
212
|
if (!Microsoft::ReactNative::HermesSamplingProfiler::IsStarted()) {
|
|
@@ -99,6 +99,21 @@ static void GetAccessibilityValueProps(const winrt::Microsoft::ReactNative::IJSV
|
|
|
99
99
|
writer.WriteObjectEnd();
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
inline float ToRadians(const winrt::Microsoft::ReactNative::JSValue &value) {
|
|
103
|
+
if ((value.Type() == winrt::Microsoft::ReactNative::JSValueType::Double)) {
|
|
104
|
+
return value.AsSingle();
|
|
105
|
+
}
|
|
106
|
+
assert(value.Type() == winrt::Microsoft::ReactNative::JSValueType::String);
|
|
107
|
+
|
|
108
|
+
auto stringValue = value.AsString();
|
|
109
|
+
char *suffixStart;
|
|
110
|
+
double num = strtod(stringValue.c_str(), &suffixStart);
|
|
111
|
+
if (0 == strncmp(suffixStart, "deg", 3)) {
|
|
112
|
+
return static_cast<float>(num * M_PI / 180.0f);
|
|
113
|
+
}
|
|
114
|
+
return static_cast<float>(num); // assume suffix is "rad"
|
|
115
|
+
}
|
|
116
|
+
|
|
102
117
|
void FrameworkElementViewManager::GetNativeProps(const winrt::Microsoft::ReactNative::IJSValueWriter &writer) const {
|
|
103
118
|
Super::GetNativeProps(writer);
|
|
104
119
|
|
|
@@ -139,27 +154,84 @@ bool FrameworkElementViewManager::UpdateProperty(
|
|
|
139
154
|
if (element.try_as<xaml::IUIElement10>()) // Works on 19H1+
|
|
140
155
|
{
|
|
141
156
|
if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Array) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
winrt::Windows::Foundation::Numerics::float4x4 transformMatrix{
|
|
158
|
+
winrt::Windows::Foundation::Numerics::float4x4::identity()};
|
|
159
|
+
for (const auto &transform : propertyValue.AsArray()) {
|
|
160
|
+
for (const auto &operation : transform.AsObject()) {
|
|
161
|
+
const std::string &transformType = operation.first;
|
|
162
|
+
const auto &innerValue = operation.second;
|
|
163
|
+
|
|
164
|
+
if (transformType == "matrix") {
|
|
165
|
+
assert(innerValue.AsArray().size() == 16);
|
|
166
|
+
winrt::Windows::Foundation::Numerics::float4x4 innerMatrix;
|
|
167
|
+
innerMatrix.m11 = static_cast<float>(innerValue[0].AsDouble());
|
|
168
|
+
innerMatrix.m12 = static_cast<float>(innerValue[1].AsDouble());
|
|
169
|
+
innerMatrix.m13 = static_cast<float>(innerValue[2].AsDouble());
|
|
170
|
+
innerMatrix.m14 = static_cast<float>(innerValue[3].AsDouble());
|
|
171
|
+
innerMatrix.m21 = static_cast<float>(innerValue[4].AsDouble());
|
|
172
|
+
innerMatrix.m22 = static_cast<float>(innerValue[5].AsDouble());
|
|
173
|
+
innerMatrix.m23 = static_cast<float>(innerValue[6].AsDouble());
|
|
174
|
+
innerMatrix.m24 = static_cast<float>(innerValue[7].AsDouble());
|
|
175
|
+
innerMatrix.m31 = static_cast<float>(innerValue[8].AsDouble());
|
|
176
|
+
innerMatrix.m32 = static_cast<float>(innerValue[9].AsDouble());
|
|
177
|
+
innerMatrix.m33 = static_cast<float>(innerValue[10].AsDouble());
|
|
178
|
+
innerMatrix.m34 = static_cast<float>(innerValue[11].AsDouble());
|
|
179
|
+
innerMatrix.m41 = static_cast<float>(innerValue[12].AsDouble());
|
|
180
|
+
innerMatrix.m42 = static_cast<float>(innerValue[13].AsDouble());
|
|
181
|
+
innerMatrix.m43 = static_cast<float>(innerValue[14].AsDouble());
|
|
182
|
+
innerMatrix.m44 = static_cast<float>(innerValue[15].AsDouble());
|
|
183
|
+
transformMatrix = transformMatrix * innerMatrix;
|
|
184
|
+
} else if (transformType == "perspective") {
|
|
185
|
+
auto innerMatrix = winrt::Windows::Foundation::Numerics::float4x4::identity();
|
|
186
|
+
innerMatrix.m34 = -1 / innerValue.AsSingle();
|
|
187
|
+
transformMatrix = transformMatrix * innerMatrix;
|
|
188
|
+
} else if (transformType == "rotateX") {
|
|
189
|
+
transformMatrix = transformMatrix *
|
|
190
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_rotation_x(ToRadians(innerValue));
|
|
191
|
+
} else if (transformType == "rotateY") {
|
|
192
|
+
transformMatrix = transformMatrix *
|
|
193
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_rotation_y(ToRadians(innerValue));
|
|
194
|
+
} else if (transformType == "rotate" || transformType == "rotateZ") {
|
|
195
|
+
transformMatrix = transformMatrix *
|
|
196
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_rotation_z(ToRadians(innerValue));
|
|
197
|
+
} else if (transformType == "scale") {
|
|
198
|
+
transformMatrix = transformMatrix *
|
|
199
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_scale(
|
|
200
|
+
innerValue.AsSingle(), innerValue.AsSingle(), 1);
|
|
201
|
+
} else if (transformType == "scaleX") {
|
|
202
|
+
transformMatrix = transformMatrix *
|
|
203
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_scale(innerValue.AsSingle(), 1, 1);
|
|
204
|
+
} else if (transformType == "scaleY") {
|
|
205
|
+
transformMatrix = transformMatrix *
|
|
206
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_scale(1, innerValue.AsSingle(), 1);
|
|
207
|
+
} else if (transformType == "translate") {
|
|
208
|
+
auto ¶ms = innerValue.AsArray();
|
|
209
|
+
transformMatrix =
|
|
210
|
+
transformMatrix *
|
|
211
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_translation(
|
|
212
|
+
params[0].AsSingle(), params[1].AsSingle(), params.size() > 2 ? params[2].AsSingle() : 0.f);
|
|
213
|
+
} else if (transformType == "translateX") {
|
|
214
|
+
transformMatrix = transformMatrix *
|
|
215
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_translation(innerValue.AsSingle(), 0.f, 0.f);
|
|
216
|
+
} else if (transformType == "translateY") {
|
|
217
|
+
transformMatrix = transformMatrix *
|
|
218
|
+
winrt::Windows::Foundation::Numerics::make_float4x4_translation(0.f, innerValue.AsSingle(), 0.f);
|
|
219
|
+
} else if (transformType == "skewX") {
|
|
220
|
+
transformMatrix =
|
|
221
|
+
transformMatrix *
|
|
222
|
+
winrt::Windows::Foundation::Numerics::float4x4(
|
|
223
|
+
winrt::Windows::Foundation::Numerics::make_float3x2_skew(innerValue.AsSingle(), 0.f));
|
|
224
|
+
} else if (transformType == "skewY") {
|
|
225
|
+
transformMatrix =
|
|
226
|
+
transformMatrix *
|
|
227
|
+
winrt::Windows::Foundation::Numerics::float4x4(
|
|
228
|
+
winrt::Windows::Foundation::Numerics::make_float3x2_skew(0.f, innerValue.AsSingle()));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
160
232
|
|
|
161
233
|
if (!element.IsLoaded()) {
|
|
162
|
-
element.Loaded([=](auto sender, auto &&) -> auto
|
|
234
|
+
element.Loaded([=](auto sender, auto &&) -> auto{
|
|
163
235
|
ApplyTransformMatrix(sender.as<xaml::UIElement>(), nodeToUpdate, transformMatrix);
|
|
164
236
|
});
|
|
165
237
|
} else {
|
|
@@ -141,14 +141,10 @@ class EffectBase : public winrt::implements<EffectBase, abi::IGraphicsEffectD2D1
|
|
|
141
141
|
|
|
142
142
|
#pragma push_macro("DECLARE_SOURCE")
|
|
143
143
|
#undef DECLARE_SOURCE
|
|
144
|
-
#define DECLARE_SOURCE(Name)
|
|
145
|
-
winrt::IGraphicsEffectSource m_##Name;
|
|
146
|
-
winrt::IGraphicsEffectSource Name() {
|
|
147
|
-
|
|
148
|
-
} \
|
|
149
|
-
void Name(winrt::IGraphicsEffectSource const &value) { \
|
|
150
|
-
m_##Name = value; \
|
|
151
|
-
}
|
|
144
|
+
#define DECLARE_SOURCE(Name) \
|
|
145
|
+
winrt::IGraphicsEffectSource m_##Name; \
|
|
146
|
+
winrt::IGraphicsEffectSource Name() { return m_##Name; } \
|
|
147
|
+
void Name(winrt::IGraphicsEffectSource const &value) { m_##Name = value; }
|
|
152
148
|
|
|
153
149
|
#pragma push_macro("DECLARE_SINGLE_SOURCE")
|
|
154
150
|
#undef DECLARE_SINGLE_SOURCE
|
|
@@ -192,9 +188,7 @@ class EffectBase : public winrt::implements<EffectBase, abi::IGraphicsEffectD2D1
|
|
|
192
188
|
Type m_##Name = InitialValue; \
|
|
193
189
|
\
|
|
194
190
|
public: \
|
|
195
|
-
Type Name() {
|
|
196
|
-
return m_##Name; \
|
|
197
|
-
} \
|
|
191
|
+
Type Name() { return m_##Name; } \
|
|
198
192
|
void Name(Type const &value) { \
|
|
199
193
|
if (!(0, Condition)) { \
|
|
200
194
|
throw winrt::hresult_invalid_argument(); \
|
|
@@ -259,7 +259,8 @@ winrt::fire_and_forget ReactImage::SetBackground(bool fireLoadEndEvent) {
|
|
|
259
259
|
compositionBrush->TintColor(strong_this->m_tintColor);
|
|
260
260
|
|
|
261
261
|
const auto surface = fromStream ? winrt::LoadedImageSurface::StartLoadFromStream(memoryStream)
|
|
262
|
-
|
|
262
|
+
: uri ? winrt::LoadedImageSurface::StartLoadFromUri(uri)
|
|
263
|
+
: nullptr;
|
|
263
264
|
|
|
264
265
|
m_sizeChangedRevoker = strong_this->SizeChanged(
|
|
265
266
|
winrt::auto_revoke, [compositionBrush](const auto &, const winrt::SizeChangedEventArgs &args) {
|
|
@@ -18,7 +18,6 @@ namespace comp = winrt::Windows::UI::Composition;
|
|
|
18
18
|
namespace ui = winrt::Windows::UI;
|
|
19
19
|
namespace winrt {
|
|
20
20
|
namespace dispatching = winrt::Windows::System;
|
|
21
|
-
using ColorHelper = winrt::Windows::UI::ColorHelper;
|
|
22
21
|
using Colors = winrt::Windows::UI::Colors;
|
|
23
22
|
} // namespace winrt
|
|
24
23
|
#else
|
|
@@ -32,7 +31,6 @@ namespace comp = winrt::Microsoft::UI::Composition;
|
|
|
32
31
|
namespace ui = winrt::Microsoft::UI;
|
|
33
32
|
namespace winrt {
|
|
34
33
|
namespace dispatching = winrt::Microsoft::UI::Dispatching;
|
|
35
|
-
using ColorHelper = winrt::Microsoft::UI::ColorHelper;
|
|
36
34
|
using Colors = winrt::Microsoft::UI::Colors;
|
|
37
35
|
} // namespace winrt
|
|
38
36
|
|
|
@@ -92,7 +92,7 @@ __declspec(selectany) std::unordered_map<std::wstring, IndirectLibrary> indirect
|
|
|
92
92
|
} // namespace details
|
|
93
93
|
|
|
94
94
|
template <typename TFn, typename... TArgs>
|
|
95
|
-
auto CallIndirect(const wchar_t *dllName, const char *fnName, TArgs &&...
|
|
95
|
+
auto CallIndirect(const wchar_t *dllName, const char *fnName, TArgs &&...args) noexcept {
|
|
96
96
|
if (details::indirectLibraries.count(dllName) == 0) {
|
|
97
97
|
details::indirectLibraries.emplace(dllName, WINRT_IMPL_LoadLibraryW(dllName));
|
|
98
98
|
}
|
|
@@ -1003,7 +1003,7 @@ size_t JsiAbiRuntime::ValueRefArray::Size() const noexcept {
|
|
|
1003
1003
|
//===========================================================================
|
|
1004
1004
|
|
|
1005
1005
|
JsiAbiRuntime::PropNameIDRef::PropNameIDRef(JsiPropertyIdRef const &data) noexcept
|
|
1006
|
-
: m_propertyId{make<PropNameID>(new
|
|
1006
|
+
: m_propertyId{make<PropNameID>(new(std::addressof(m_pointerStore)) DataPointerValue(data.Data))} {}
|
|
1007
1007
|
|
|
1008
1008
|
JsiAbiRuntime::PropNameIDRef::~PropNameIDRef() noexcept {}
|
|
1009
1009
|
|
|
@@ -1254,7 +1254,7 @@ size_t NapiJsiRuntime::JsiValueViewArgs::Size() const noexcept {
|
|
|
1254
1254
|
#pragma region PropNameIDView
|
|
1255
1255
|
|
|
1256
1256
|
NapiJsiRuntime::PropNameIDView::PropNameIDView(NapiJsiRuntime *runtime, napi_value propertyId) noexcept
|
|
1257
|
-
: m_propertyId{make<PropNameID>(new
|
|
1257
|
+
: m_propertyId{make<PropNameID>(new(std::addressof(m_pointerStore)) NapiPointerValueView{runtime, propertyId})} {}
|
|
1258
1258
|
|
|
1259
1259
|
NapiJsiRuntime::PropNameIDView::operator PropNameID const &() const noexcept {
|
|
1260
1260
|
return m_propertyId;
|
|
@@ -90,7 +90,7 @@ void ReadValue(IJSValueReader const &reader, /*out*/ T &value) noexcept;
|
|
|
90
90
|
|
|
91
91
|
bool SkipArrayToEnd(IJSValueReader const &reader) noexcept;
|
|
92
92
|
template <class... TArgs>
|
|
93
|
-
void ReadArgs(IJSValueReader const &reader, /*out*/ TArgs &...
|
|
93
|
+
void ReadArgs(IJSValueReader const &reader, /*out*/ TArgs &...args) noexcept;
|
|
94
94
|
|
|
95
95
|
//===========================================================================
|
|
96
96
|
// IJSValueReader extensions implementation
|
|
@@ -432,7 +432,7 @@ inline bool SkipArrayToEnd(IJSValueReader const &reader) noexcept {
|
|
|
432
432
|
}
|
|
433
433
|
|
|
434
434
|
template <class... TArgs>
|
|
435
|
-
inline void ReadArgs(IJSValueReader const &reader, /*out*/ TArgs &...
|
|
435
|
+
inline void ReadArgs(IJSValueReader const &reader, /*out*/ TArgs &...args) noexcept {
|
|
436
436
|
// Read as many arguments as we can or return default values.
|
|
437
437
|
bool success = reader.ValueType() == JSValueType::Array;
|
|
438
438
|
((success = success && reader.GetNextArrayItem(), args = success ? ReadValue<TArgs>(reader) : TArgs{}), ...);
|