@shopify/react-native-skia 2.11.0-next.1 → 2.11.0-next.2
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/cpp/api/JsiSkConverters.h +2 -2
- package/cpp/api/JsiSkNativeObjects.h +9 -9
- package/cpp/api/JsiSkRuntimeEffect.h +2 -2
- package/cpp/jsi/EnumMapper.h +2 -2
- package/cpp/jsi/JSIConverter.h +2 -2
- package/cpp/jsi/NativeObject.h +13 -13
- package/cpp/jsi/Promise.cpp +2 -2
- package/cpp/jsi/Promise.h +2 -2
- package/package.json +1 -1
|
@@ -214,7 +214,7 @@ template <typename T> struct JsiOptional : std::optional<T> {
|
|
|
214
214
|
|
|
215
215
|
} // namespace RNSkia
|
|
216
216
|
|
|
217
|
-
namespace
|
|
217
|
+
namespace RNJsi {
|
|
218
218
|
|
|
219
219
|
/**
|
|
220
220
|
* sk_sp<T> arguments (SkImage, SkShader, ...). Delegates to the wrapper
|
|
@@ -407,4 +407,4 @@ template <> struct JSIConverter<SkISize> {
|
|
|
407
407
|
}
|
|
408
408
|
};
|
|
409
409
|
|
|
410
|
-
} // namespace
|
|
410
|
+
} // namespace RNJsi
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* be expressed as typed signatures (heterogeneous argument dispatch, typed
|
|
25
25
|
* array construction, lenient options objects, promises) — everything else
|
|
26
26
|
* uses installMethod/installGetter/installChainableMethod with typed C++
|
|
27
|
-
* signatures converted through
|
|
27
|
+
* signatures converted through RNJsi::JSIConverter.
|
|
28
28
|
*/
|
|
29
29
|
#define JSI_HOST_FUNCTION(NAME) \
|
|
30
30
|
jsi::Value NAME(jsi::Runtime &runtime, const jsi::Value &thisValue, \
|
|
@@ -36,7 +36,7 @@ namespace jsi = facebook::jsi;
|
|
|
36
36
|
|
|
37
37
|
// Minimum memory pressure reported for any native object — aliased from the
|
|
38
38
|
// NativeObject infrastructure so dispose() and create() agree on the floor.
|
|
39
|
-
static constexpr size_t kMinMemoryPressure =
|
|
39
|
+
static constexpr size_t kMinMemoryPressure = RNJsi::kMinMemoryPressure;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Creates the JS object for a wrapper instance (a class based on the
|
|
@@ -102,16 +102,16 @@ std::shared_ptr<T> getJsiObject(jsi::Runtime &runtime,
|
|
|
102
102
|
*
|
|
103
103
|
* Most methods use typed C++ signatures installed with installMethod /
|
|
104
104
|
* installGetter / installChainableMethod (arguments and results converted
|
|
105
|
-
* through
|
|
105
|
+
* through RNJsi::JSIConverter, see JsiSkConverters.h). Methods that cannot
|
|
106
106
|
* be typed keep the classic JSI_HOST_FUNCTION signature and are installed
|
|
107
107
|
* with installHostMethod, which resolves the C++ instance from `this` via
|
|
108
108
|
* native state.
|
|
109
109
|
*/
|
|
110
110
|
template <typename Derived>
|
|
111
|
-
class JsiSkNativeObject : public
|
|
111
|
+
class JsiSkNativeObject : public RNJsi::NativeObject<Derived> {
|
|
112
112
|
public:
|
|
113
113
|
explicit JsiSkNativeObject(std::shared_ptr<RNSkPlatformContext> context)
|
|
114
|
-
:
|
|
114
|
+
: RNJsi::NativeObject<Derived>(Derived::CLASS_NAME),
|
|
115
115
|
_context(std::move(context)) {}
|
|
116
116
|
|
|
117
117
|
/**
|
|
@@ -120,7 +120,7 @@ public:
|
|
|
120
120
|
*/
|
|
121
121
|
static std::shared_ptr<Derived> fromThis(jsi::Runtime &runtime,
|
|
122
122
|
const jsi::Value &thisValue) {
|
|
123
|
-
return
|
|
123
|
+
return RNJsi::NativeObject<Derived>::fromValue(runtime, thisValue);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
protected:
|
|
@@ -222,7 +222,7 @@ protected:
|
|
|
222
222
|
/**
|
|
223
223
|
* Installs a typed mutating method that returns `this` for chaining
|
|
224
224
|
* (e.g. path.moveTo(...).lineTo(...)). Arguments are converted through
|
|
225
|
-
*
|
|
225
|
+
* RNJsi::JSIConverter like installMethod; the member function's return
|
|
226
226
|
* value (if any) is ignored and the JS function returns thisValue.
|
|
227
227
|
*/
|
|
228
228
|
template <typename ReturnType, typename... Args>
|
|
@@ -270,7 +270,7 @@ private:
|
|
|
270
270
|
ReturnType (Derived::*method)(Args...),
|
|
271
271
|
jsi::Runtime &runtime, const jsi::Value *args,
|
|
272
272
|
std::index_sequence<Is...>, size_t count) {
|
|
273
|
-
(obj->*method)(
|
|
273
|
+
(obj->*method)(RNJsi::JSIConverter<std::decay_t<Args>>::fromJSI(
|
|
274
274
|
runtime, args[Is], Is >= count)...);
|
|
275
275
|
}
|
|
276
276
|
|
|
@@ -280,7 +280,7 @@ private:
|
|
|
280
280
|
jsi::Runtime &runtime, const jsi::Value *args, std::index_sequence<Is...>,
|
|
281
281
|
size_t count) {
|
|
282
282
|
(obj->*method)(runtime,
|
|
283
|
-
|
|
283
|
+
RNJsi::JSIConverter<std::decay_t<Args>>::fromJSI(
|
|
284
284
|
runtime, args[Is], Is >= count)...);
|
|
285
285
|
}
|
|
286
286
|
|
|
@@ -39,7 +39,7 @@ struct RuntimeEffectUniform {
|
|
|
39
39
|
|
|
40
40
|
} // namespace RNSkia
|
|
41
41
|
|
|
42
|
-
namespace
|
|
42
|
+
namespace RNJsi {
|
|
43
43
|
|
|
44
44
|
// RuntimeEffectUniform -> {columns, rows, slot, isInteger}
|
|
45
45
|
template <> struct JSIConverter<RNSkia::RuntimeEffectUniform> {
|
|
@@ -54,7 +54,7 @@ template <> struct JSIConverter<RNSkia::RuntimeEffectUniform> {
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
} // namespace
|
|
57
|
+
} // namespace RNJsi
|
|
58
58
|
|
|
59
59
|
namespace RNSkia {
|
|
60
60
|
|
package/cpp/jsi/EnumMapper.h
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
#include <stdexcept>
|
|
4
4
|
#include <string>
|
|
5
5
|
|
|
6
|
-
namespace
|
|
6
|
+
namespace RNJsi {
|
|
7
7
|
|
|
8
8
|
namespace EnumMapper {
|
|
9
9
|
// Add these two methods in namespace "EnumMapper" to allow parsing a custom
|
|
@@ -60,4 +60,4 @@ static void convertEnumToJSUnion(TEnum, std::string *) {
|
|
|
60
60
|
}
|
|
61
61
|
} // namespace EnumMapper
|
|
62
62
|
|
|
63
|
-
} // namespace
|
|
63
|
+
} // namespace RNJsi
|
package/cpp/jsi/JSIConverter.h
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
#include <cxxabi.h>
|
|
26
26
|
#endif
|
|
27
27
|
|
|
28
|
-
namespace
|
|
28
|
+
namespace RNJsi {
|
|
29
29
|
|
|
30
30
|
namespace jsi = facebook::jsi;
|
|
31
31
|
|
|
@@ -495,4 +495,4 @@ template <> struct JSIConverter<std::unordered_set<std::string>> {
|
|
|
495
495
|
}
|
|
496
496
|
};
|
|
497
497
|
|
|
498
|
-
} // namespace
|
|
498
|
+
} // namespace RNJsi
|
package/cpp/jsi/NativeObject.h
CHANGED
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
#include "jsi/RuntimeAwareCache.h" // Use Skia's RuntimeAwareCache
|
|
19
19
|
|
|
20
20
|
// Forward declare to avoid circular dependency
|
|
21
|
-
namespace
|
|
21
|
+
namespace RNJsi {
|
|
22
22
|
template <typename ArgType, typename SFINAE> struct JSIConverter;
|
|
23
|
-
} // namespace
|
|
23
|
+
} // namespace RNJsi
|
|
24
24
|
|
|
25
25
|
// Include the converter - must come after forward declaration
|
|
26
26
|
#include "JSIConverter.h"
|
|
27
27
|
|
|
28
|
-
namespace
|
|
28
|
+
namespace RNJsi {
|
|
29
29
|
|
|
30
30
|
namespace jsi = facebook::jsi;
|
|
31
31
|
|
|
@@ -452,7 +452,7 @@ protected:
|
|
|
452
452
|
return jsi::Value::undefined();
|
|
453
453
|
} else {
|
|
454
454
|
ReturnType result = (native.get()->*getter)();
|
|
455
|
-
return
|
|
455
|
+
return RNJsi::JSIConverter<std::decay_t<ReturnType>>::toJSI(
|
|
456
456
|
rt, std::move(result));
|
|
457
457
|
}
|
|
458
458
|
});
|
|
@@ -487,7 +487,7 @@ protected:
|
|
|
487
487
|
throw jsi::JSError(rt, "Setter requires a value argument");
|
|
488
488
|
}
|
|
489
489
|
auto native = NativeObject<Derived>::fromValue(rt, thisVal);
|
|
490
|
-
auto value =
|
|
490
|
+
auto value = RNJsi::JSIConverter<std::decay_t<ValueType>>::fromJSI(
|
|
491
491
|
rt, args[0], false);
|
|
492
492
|
(native.get()->*setter)(std::move(value));
|
|
493
493
|
return jsi::Value::undefined();
|
|
@@ -535,7 +535,7 @@ protected:
|
|
|
535
535
|
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
536
536
|
auto native = NativeObject<Derived>::fromValue(rt, thisVal);
|
|
537
537
|
ReturnType result = (native.get()->*getter)();
|
|
538
|
-
return
|
|
538
|
+
return RNJsi::JSIConverter<std::decay_t<ReturnType>>::toJSI(
|
|
539
539
|
rt, std::move(result));
|
|
540
540
|
});
|
|
541
541
|
|
|
@@ -548,7 +548,7 @@ protected:
|
|
|
548
548
|
throw jsi::JSError(rt, "Setter requires a value argument");
|
|
549
549
|
}
|
|
550
550
|
auto native = NativeObject<Derived>::fromValue(rt, thisVal);
|
|
551
|
-
auto value =
|
|
551
|
+
auto value = RNJsi::JSIConverter<std::decay_t<ValueType>>::fromJSI(
|
|
552
552
|
rt, args[0], false);
|
|
553
553
|
(native.get()->*setter)(std::move(value));
|
|
554
554
|
return jsi::Value::undefined();
|
|
@@ -579,9 +579,9 @@ private:
|
|
|
579
579
|
jsi::Runtime &runtime, const jsi::Value *args,
|
|
580
580
|
std::index_sequence<Is...>, size_t count) {
|
|
581
581
|
ReturnType result = (obj->*method)(
|
|
582
|
-
runtime,
|
|
582
|
+
runtime, RNJsi::JSIConverter<std::decay_t<Args>>::fromJSI(
|
|
583
583
|
runtime, args[Is], Is >= count)...);
|
|
584
|
-
return
|
|
584
|
+
return RNJsi::JSIConverter<std::decay_t<ReturnType>>::toJSI(
|
|
585
585
|
runtime, std::move(result));
|
|
586
586
|
}
|
|
587
587
|
|
|
@@ -592,7 +592,7 @@ private:
|
|
|
592
592
|
jsi::Runtime &runtime, const jsi::Value *args,
|
|
593
593
|
std::index_sequence<Is...>, size_t count) {
|
|
594
594
|
if constexpr (std::is_same_v<ReturnType, void>) {
|
|
595
|
-
(obj->*method)(
|
|
595
|
+
(obj->*method)(RNJsi::JSIConverter<std::decay_t<Args>>::fromJSI(
|
|
596
596
|
runtime, args[Is], Is >= count)...);
|
|
597
597
|
return jsi::Value::undefined();
|
|
598
598
|
} else if constexpr (std::is_same_v<ReturnType, jsi::Value>) {
|
|
@@ -601,9 +601,9 @@ private:
|
|
|
601
601
|
return (obj->*method)(runtime, jsi::Value::undefined(), args, count);
|
|
602
602
|
} else {
|
|
603
603
|
ReturnType result =
|
|
604
|
-
(obj->*method)(
|
|
604
|
+
(obj->*method)(RNJsi::JSIConverter<std::decay_t<Args>>::fromJSI(
|
|
605
605
|
runtime, args[Is], Is >= count)...);
|
|
606
|
-
return
|
|
606
|
+
return RNJsi::JSIConverter<std::decay_t<ReturnType>>::toJSI(
|
|
607
607
|
runtime, std::move(result));
|
|
608
608
|
}
|
|
609
609
|
}
|
|
@@ -616,4 +616,4 @@ template <typename T>
|
|
|
616
616
|
struct is_native_object<std::shared_ptr<T>>
|
|
617
617
|
: std::bool_constant<std::is_base_of_v<NativeObject<T>, T>> {};
|
|
618
618
|
|
|
619
|
-
} // namespace
|
|
619
|
+
} // namespace RNJsi
|
package/cpp/jsi/Promise.cpp
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
#include <utility>
|
|
7
7
|
#include <vector>
|
|
8
8
|
|
|
9
|
-
namespace
|
|
9
|
+
namespace RNJsi {
|
|
10
10
|
|
|
11
11
|
namespace jsi = facebook::jsi;
|
|
12
12
|
|
|
@@ -45,4 +45,4 @@ void Promise::reject(std::string message) {
|
|
|
45
45
|
_rejecter.call(runtime, error.value());
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
} // namespace
|
|
48
|
+
} // namespace RNJsi
|
package/cpp/jsi/Promise.h
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
#include <utility>
|
|
7
7
|
#include <vector>
|
|
8
8
|
|
|
9
|
-
namespace
|
|
9
|
+
namespace RNJsi {
|
|
10
10
|
|
|
11
11
|
namespace jsi = facebook::jsi;
|
|
12
12
|
|
|
@@ -34,4 +34,4 @@ public:
|
|
|
34
34
|
static jsi::Value createPromise(jsi::Runtime &runtime, RunPromise run);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
} // namespace
|
|
37
|
+
} // namespace RNJsi
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"setup-skia-web": "scripts/setup-canvaskit.js"
|
|
9
9
|
},
|
|
10
10
|
"title": "React Native Skia",
|
|
11
|
-
"version": "2.11.0-next.
|
|
11
|
+
"version": "2.11.0-next.2",
|
|
12
12
|
"description": "High-performance React Native Graphics using Skia",
|
|
13
13
|
"main": "lib/module/index.js",
|
|
14
14
|
"react-native": "src/index.ts",
|