@symbiote-native/engine 1.1.0 → 1.3.0
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/android/CMakeLists.txt +31 -1
- package/android/build.gradle +4 -1
- package/build/accessibility-info/index.android.js +21 -17
- package/build/accessibility-info/index.ios.js +2 -0
- package/build/accessibility-info/shared.d.ts +1 -1
- package/build/alert/shared.d.ts +1 -1
- package/build/alert/shared.js +3 -7
- package/build/app-state/index.d.ts +1 -1
- package/build/app-state/index.js +35 -27
- package/build/back-handler/index.d.ts +7 -2
- package/build/back-handler/index.js +19 -10
- package/build/events/index.js +10 -1
- package/build/fabric-props.js +1 -1
- package/build/fabric.d.ts +7 -0
- package/build/fabric.js +14 -0
- package/build/host-behavior.d.ts +1 -0
- package/build/image-loader.d.ts +4 -2
- package/build/image-loader.js +14 -25
- package/build/image-source-write.d.ts +1 -1
- package/build/image-source-write.js +14 -2
- package/build/index.d.ts +2 -2
- package/build/index.js +6 -6
- package/build/invariant.d.ts +1 -0
- package/build/invariant.js +10 -0
- package/build/keyboard/index.js +11 -32
- package/build/linking/index.android.js +5 -3
- package/build/linking/shared.d.ts +1 -1
- package/build/linking/shared.js +16 -19
- package/build/native-engine.d.ts +1 -0
- package/build/native-events.d.ts +5 -0
- package/build/native-events.js +21 -0
- package/build/node.js +34 -2
- package/build/permissions-android/index.android.d.ts +59 -0
- package/build/permissions-android/index.android.js +47 -0
- package/build/permissions-android/index.d.ts +1 -115
- package/build/permissions-android/index.ios.d.ts +59 -0
- package/build/permissions-android/index.ios.js +31 -0
- package/build/permissions-android/index.js +3 -184
- package/build/permissions-android/shared.d.ts +63 -0
- package/build/permissions-android/shared.js +66 -0
- package/build/platform/index.android.js +3 -5
- package/build/platform/index.ios.js +3 -3
- package/build/platform/shared.d.ts +4 -0
- package/build/platform/shared.js +9 -0
- package/build/platform-color/index.android.d.ts +4 -0
- package/build/platform-color/index.android.js +7 -0
- package/build/platform-color/index.d.ts +2 -20
- package/build/platform-color/index.js +1 -45
- package/build/platform-color/shared.d.ts +21 -0
- package/build/platform-color/shared.js +41 -0
- package/build/settings/index.android.d.ts +6 -0
- package/build/settings/index.android.js +21 -0
- package/build/settings/index.d.ts +1 -8
- package/build/settings/index.ios.d.ts +8 -0
- package/build/settings/index.ios.js +122 -0
- package/build/settings/index.js +3 -122
- package/build/share/index.android.js +9 -32
- package/build/share/index.ios.js +14 -15
- package/build/share/shared.d.ts +4 -2
- package/build/share/shared.js +7 -10
- package/build/status-bar/index.android.js +1 -1
- package/build/status-bar/index.ios.js +4 -3
- package/build/toast-android/index.android.d.ts +10 -0
- package/build/toast-android/index.android.js +108 -0
- package/build/toast-android/index.d.ts +1 -10
- package/build/toast-android/index.ios.d.ts +10 -0
- package/build/toast-android/index.ios.js +19 -0
- package/build/toast-android/index.js +3 -108
- package/build/tree-host.d.ts +47 -0
- package/build/tree-host.js +32 -2
- package/cpp/SymbioteFabricProps.cpp +218 -117
- package/cpp/SymbioteFabricProps.h +5 -0
- package/cpp/SymbioteTree.cpp +44 -6
- package/package.json +2 -2
package/cpp/SymbioteTree.cpp
CHANGED
|
@@ -18,9 +18,10 @@
|
|
|
18
18
|
#include <react/renderer/uimanager/primitives.h>
|
|
19
19
|
|
|
20
20
|
// `react/renderer/dom/` is NOT among the header folders ReactAndroid copies into its prefab
|
|
21
|
-
// (`ReactAndroid/build.gradle.kts` lists uimanager, mounting, core, … and no dom),
|
|
22
|
-
//
|
|
23
|
-
//
|
|
21
|
+
// (`ReactAndroid/build.gradle.kts` lists uimanager, mounting, core, … and no dom), though
|
|
22
|
+
// libreactnative.so exports the functions. `android/CMakeLists.txt` copies `DOM.h` from the app's
|
|
23
|
+
// react-native onto the include path; without it this falls back to the throwing stubs. iOS compiles
|
|
24
|
+
// against the full ReactCommon tree and has it.
|
|
24
25
|
//
|
|
25
26
|
// Detected rather than branched on `__ANDROID__`, because the fact is about the TOOLCHAIN'S HEADERS,
|
|
26
27
|
// not about the platform — and it self-heals the day upstream exports the folder. The three
|
|
@@ -73,6 +74,13 @@ constexpr int32_t kOpCreateVoid = 13;
|
|
|
73
74
|
// The owned listener names any platform rule reads, one bit each — see `Node::pressListeners`.
|
|
74
75
|
// `press` is deliberately bit 0 so the `focusable` question is the cheapest of the two.
|
|
75
76
|
constexpr uint8_t kPressListenerPress = 1u << 0;
|
|
77
|
+
// The four press names; `hasAnyPressListener` asks about these and nothing else.
|
|
78
|
+
constexpr uint8_t kPressListenerMask = 0x0f;
|
|
79
|
+
// ScrollView's `sendMomentumEvents` (`ScrollView.js:1801-1804`) asks about either of these two.
|
|
80
|
+
constexpr uint8_t kMomentumListenerMask = (1u << 4) | (1u << 5);
|
|
81
|
+
// Text's pressability (`Text.js:145-163`): onPress / onLongPress, plus onStartShouldSetResponder.
|
|
82
|
+
constexpr uint8_t kTextPressMask = kPressListenerPress | (1u << 3);
|
|
83
|
+
constexpr uint8_t kStartShouldSetResponder = 1u << 6;
|
|
76
84
|
|
|
77
85
|
/** 0 for a name the host has no rule for, which is nearly all of them. */
|
|
78
86
|
uint8_t pressListenerBit(const std::string &name) {
|
|
@@ -80,6 +88,9 @@ uint8_t pressListenerBit(const std::string &name) {
|
|
|
80
88
|
if (name == "pressIn") return 1u << 1;
|
|
81
89
|
if (name == "pressOut") return 1u << 2;
|
|
82
90
|
if (name == "longPress") return 1u << 3;
|
|
91
|
+
if (name == "momentumScrollBegin") return 1u << 4;
|
|
92
|
+
if (name == "momentumScrollEnd") return 1u << 5;
|
|
93
|
+
if (name == "startShouldSetResponder") return kStartShouldSetResponder;
|
|
83
94
|
return 0;
|
|
84
95
|
}
|
|
85
96
|
|
|
@@ -327,7 +338,27 @@ struct Node : jsi::NativeState {
|
|
|
327
338
|
//
|
|
328
339
|
// The reference applier has no such window (a JS child's `parent` reference keeps the parent
|
|
329
340
|
// alive), so nothing headless can reach this and there is no test to write for it.
|
|
341
|
+
/**
|
|
342
|
+
* How many nodes this process is holding, right now.
|
|
343
|
+
*
|
|
344
|
+
* The one reading nothing else can produce. Ownership here is JS-anchored — `children` is strong,
|
|
345
|
+
* `parent` is raw, and a node lives while a parent holds it or while JS names it through
|
|
346
|
+
* `NativeState` — so "JS gave its half back" IMPLIES the C++ half went with it. That is an
|
|
347
|
+
* inference from the ownership model, and the shape it would miss is the one
|
|
348
|
+
* software-mansion/react-native-reanimated#10527 describes: a container keyed by surface that
|
|
349
|
+
* nothing empties, holding a root alive after the surface is gone. We have no such container; this
|
|
350
|
+
* counter is what turns "we have no such container" from a reading of the code into a reading of
|
|
351
|
+
* the process.
|
|
352
|
+
*
|
|
353
|
+
* Not atomic, and deliberately: a commit walk is single-threaded, and the counter exists for a
|
|
354
|
+
* test rather than for a report anything acts on.
|
|
355
|
+
*/
|
|
356
|
+
static inline int64_t live = 0;
|
|
357
|
+
|
|
358
|
+
Node() { live += 1; }
|
|
359
|
+
|
|
330
360
|
~Node() {
|
|
361
|
+
live -= 1;
|
|
331
362
|
for (const NodePtr &child : children) {
|
|
332
363
|
// A HOLE, from a detach nothing has read past yet. The destructor is the one reader that does
|
|
333
364
|
// not compact first: compaction renumbers, and renumbering a vector whose owner is being
|
|
@@ -1035,15 +1066,18 @@ IOwner ownerOf(const Node &node) {
|
|
|
1035
1066
|
node.parent->tagName.c_str(),
|
|
1036
1067
|
(node.parent->pressListeners & kPressListenerPress) != 0,
|
|
1037
1068
|
node.parent->underlayShown,
|
|
1038
|
-
node.parent->pressListeners != 0};
|
|
1069
|
+
(node.parent->pressListeners & kPressListenerMask) != 0};
|
|
1039
1070
|
}
|
|
1040
1071
|
|
|
1041
1072
|
/** The node's own non-prop bits, unpacked from the mask the ops maintain. See `ISelf`. */
|
|
1042
1073
|
ISelf selfOf(const Node &node) {
|
|
1043
1074
|
return ISelf{
|
|
1044
1075
|
(node.pressListeners & kPressListenerPress) != 0,
|
|
1045
|
-
node.pressListeners != 0,
|
|
1046
|
-
node.underlayShown
|
|
1076
|
+
(node.pressListeners & kPressListenerMask) != 0,
|
|
1077
|
+
node.underlayShown,
|
|
1078
|
+
(node.pressListeners & kMomentumListenerMask) != 0,
|
|
1079
|
+
(node.pressListeners & kTextPressMask) != 0,
|
|
1080
|
+
(node.pressListeners & kStartShouldSetResponder) != 0};
|
|
1047
1081
|
}
|
|
1048
1082
|
|
|
1049
1083
|
/**
|
|
@@ -2578,6 +2612,10 @@ jsi::Value Tree::readSurfaceTelemetry(
|
|
|
2578
2612
|
result.setProperty(
|
|
2579
2613
|
runtime, "valueConversions", jsi::Value(static_cast<double>(walkCost_.valueConversions)));
|
|
2580
2614
|
result.setProperty(runtime, "applyMs", millis(walkCost_.applyNs));
|
|
2615
|
+
// NOT DRAINED ON READ, unlike every counter around it: this is a level rather than a total, and a
|
|
2616
|
+
// level that zeroed itself when read would answer about nothing. `retention-after-clear.itest.ts`
|
|
2617
|
+
// reads it across cycles.
|
|
2618
|
+
result.setProperty(runtime, "liveNodes", jsi::Value(static_cast<double>(Node::live)));
|
|
2581
2619
|
result.setProperty(runtime, "stringDecodeMs", millis(walkCost_.stringDecodeNs));
|
|
2582
2620
|
result.setProperty(runtime, "structureMs", millis(walkCost_.structureNs));
|
|
2583
2621
|
result.setProperty(runtime, "holdHandleMs", millis(walkCost_.holdHandleNs));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/engine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "SymbioteNative's retained shadow-tree engine — clone-on-write commit path + event normalization over React Native Fabric, shared by every framework adapter.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
},
|
|
72
72
|
"peerDependenciesMeta": {},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@symbiote-native/test-utils": "0.4.
|
|
74
|
+
"@symbiote-native/test-utils": "0.4.2"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"typecheck": "tsc --build",
|