@solidnative-dev/fabric-host 0.0.0-stage → 0.1.0-beta.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/LICENSE +21 -0
- package/README.md +87 -2
- package/dist/fatal-error-handler.d.ts +27 -0
- package/dist/fatal-error-handler.d.ts.map +1 -0
- package/dist/fatal-error-handler.js +106 -0
- package/dist/fatal-error-handler.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/native-binding.d.ts +183 -0
- package/dist/native-binding.d.ts.map +1 -0
- package/dist/native-binding.js +554 -0
- package/dist/native-binding.js.map +1 -0
- package/dist/native-fabric-host.d.ts +32 -0
- package/dist/native-fabric-host.d.ts.map +1 -0
- package/dist/native-fabric-host.js +275 -0
- package/dist/native-fabric-host.js.map +1 -0
- package/dist/native-transaction.d.ts +17 -0
- package/dist/native-transaction.d.ts.map +1 -0
- package/dist/native-transaction.js +124 -0
- package/dist/native-transaction.js.map +1 -0
- package/dist/react-native-0.88.d.ts +77 -0
- package/dist/react-native-0.88.d.ts.map +1 -0
- package/dist/react-native-0.88.js +79 -0
- package/dist/react-native-0.88.js.map +1 -0
- package/dist/surface-readiness.d.ts +18 -0
- package/dist/surface-readiness.d.ts.map +1 -0
- package/dist/surface-readiness.js +43 -0
- package/dist/surface-readiness.js.map +1 -0
- package/native/README.md +502 -0
- package/native/SolidNativeFabric.podspec +84 -0
- package/native/android/SolidNativeBindingsInstaller.cpp +4218 -0
- package/native/android/SolidNativeBindingsInstaller.h +8 -0
- package/native/android/SolidNativeRuntime.cmake +61 -0
- package/native/android/java/dev/solidnative/runtime/SolidNativeBindingsInstaller.kt +239 -0
- package/native/android/java/dev/solidnative/runtime/SolidNativeDebugModule.kt +191 -0
- package/native/android/java/dev/solidnative/runtime/SolidNativePackage.kt +43 -0
- package/native/android/java/dev/solidnative/runtime/SolidNativePlatformModule.kt +81 -0
- package/native/android/java/dev/solidnative/runtime/SolidNativeStartupFailureView.kt +93 -0
- package/native/android/java/dev/solidnative/runtime/SolidNativeSurface.kt +423 -0
- package/native/android/solid-native.gradle +90 -0
- package/native/apple/SolidNativeDebugRequest.mm +421 -0
- package/native/fabric/SolidNativeDebugRequest.h +12 -0
- package/native/fabric/SolidNativeDirtyNodes.h +26 -0
- package/native/fabric/SolidNativeFabricApi.cpp +224 -0
- package/native/fabric/SolidNativeFabricApi.h +107 -0
- package/native/fabric/SolidNativeFabricApplication.h +32 -0
- package/native/fabric/SolidNativeFabricApplication.mm +373 -0
- package/native/fabric/SolidNativeFabricJSIBinding.h +43 -0
- package/native/fabric/SolidNativeFabricJSIBinding.mm +4491 -0
- package/native/fabric/SolidNativeFabricSmokeApplication.h +26 -0
- package/native/fabric/SolidNativeFabricSmokeApplication.mm +331 -0
- package/native/fabric/SolidNativeFabricSurface.h +63 -0
- package/native/fabric/SolidNativeFabricSurface.mm +549 -0
- package/native/fabric/SolidNativeFabricTransactionCoordinator.cpp +1275 -0
- package/native/fabric/SolidNativeFabricTransactionCoordinator.h +90 -0
- package/native/fabric/SolidNativeFabricTransactionCoordinatorApple.mm +97 -0
- package/native/fabric/SolidNativeRootViewController.h +20 -0
- package/native/fabric/SolidNativeRootViewController.mm +83 -0
- package/native/fabric/SolidNativeStagedNodeMap.h +104 -0
- package/native/fabric/SolidNativeStartupFailureView.h +17 -0
- package/native/fabric/SolidNativeStartupFailureView.mm +77 -0
- package/native/react-native-boundary.json +106 -0
- package/native/worklets/SolidNativeUIWorklet.cpp +1080 -0
- package/native/worklets/SolidNativeUIWorklet.h +245 -0
- package/package.json +41 -3
- package/scripts/verify-react-native-boundary.mjs +282 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { HOST_CONTRACT_VERSION, } from "@solidnative-dev/host-contract";
|
|
2
|
+
import { commitNativeHostTransaction, getNativeHostBinding, measureNativeHostNode, readNativeSurfaceInfo, subscribeToNativeHostCommitLifecycle, subscribeToNativeHostEvents, supportsNativeUIWorklets, } from "./native-binding.js";
|
|
3
|
+
const TEARDOWN_POLL_INTERVAL_MS = 10;
|
|
4
|
+
const MAX_TEARDOWN_POLL_ATTEMPTS = 500;
|
|
5
|
+
const ACTIVE_NATIVE_FABRIC_HOSTS = new WeakMap();
|
|
6
|
+
export class NativeFabricSurfaceOwnershipError extends Error {
|
|
7
|
+
constructor() {
|
|
8
|
+
super("The native Fabric binding is already owned by another active host.");
|
|
9
|
+
this.name = "NativeFabricSurfaceOwnershipError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function waitForReclamationPoll() {
|
|
13
|
+
return new Promise((resolve) => {
|
|
14
|
+
const timers = globalThis;
|
|
15
|
+
timers.setTimeout(resolve, TEARDOWN_POLL_INTERVAL_MS);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Adapts the single Fabric surface owned by the native application shell to
|
|
20
|
+
* the framework-neutral host contract. One adapter intentionally supports one
|
|
21
|
+
* root for one runtime; a disposed surface cannot be reopened with stale node
|
|
22
|
+
* identities.
|
|
23
|
+
*/
|
|
24
|
+
export class NativeFabricHost {
|
|
25
|
+
platform;
|
|
26
|
+
capabilities;
|
|
27
|
+
binding;
|
|
28
|
+
#descriptors = new Map();
|
|
29
|
+
#listeners = new Set();
|
|
30
|
+
#lifecycleListeners = new Set();
|
|
31
|
+
#createdNodes = new Set();
|
|
32
|
+
#surface;
|
|
33
|
+
#nextNode = 1;
|
|
34
|
+
#detachNativeEvents;
|
|
35
|
+
#detachNativeLifecycle;
|
|
36
|
+
#destroying = false;
|
|
37
|
+
#destroyed = false;
|
|
38
|
+
constructor(options) {
|
|
39
|
+
this.binding = options.binding ?? getNativeHostBinding();
|
|
40
|
+
this.platform = this.binding.platform;
|
|
41
|
+
for (const descriptor of options.descriptors) {
|
|
42
|
+
if (this.#descriptors.has(descriptor.name)) {
|
|
43
|
+
throw new Error(`Duplicate native component descriptor: ${descriptor.name}.`);
|
|
44
|
+
}
|
|
45
|
+
this.#descriptors.set(descriptor.name, descriptor);
|
|
46
|
+
}
|
|
47
|
+
if (!this.#descriptors.has("RootView")) {
|
|
48
|
+
throw new Error("The native Fabric host requires a RootView descriptor.");
|
|
49
|
+
}
|
|
50
|
+
this.capabilities = Object.freeze({
|
|
51
|
+
contractVersion: HOST_CONTRACT_VERSION,
|
|
52
|
+
synchronousMeasurement: true,
|
|
53
|
+
bubblingEvents: true,
|
|
54
|
+
nativeScreens: this.#descriptors.has("Screen") && this.#descriptors.has("ScreenStack"),
|
|
55
|
+
uiWorklets: supportsNativeUIWorklets(this.binding),
|
|
56
|
+
viewRecycling: false,
|
|
57
|
+
commitMountEvents: typeof this.binding.setCommitLifecycleHandler === "function",
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
createSurface(_options) {
|
|
61
|
+
if (this.#destroyed) {
|
|
62
|
+
throw new Error("The native Fabric host has been destroyed.");
|
|
63
|
+
}
|
|
64
|
+
if (this.#surface !== undefined) {
|
|
65
|
+
throw new Error("The native Fabric runtime only supports one surface.");
|
|
66
|
+
}
|
|
67
|
+
const owner = ACTIVE_NATIVE_FABRIC_HOSTS.get(this.binding);
|
|
68
|
+
if (owner !== undefined && owner !== this) {
|
|
69
|
+
throw new NativeFabricSurfaceOwnershipError();
|
|
70
|
+
}
|
|
71
|
+
ACTIVE_NATIVE_FABRIC_HOSTS.set(this.binding, this);
|
|
72
|
+
try {
|
|
73
|
+
const info = readNativeSurfaceInfo(this.binding);
|
|
74
|
+
if (!info.ready) {
|
|
75
|
+
throw new Error("The native Fabric surface is not ready.");
|
|
76
|
+
}
|
|
77
|
+
if (info.sequence !== 0 ||
|
|
78
|
+
info.retainedNodeCount !== 0 ||
|
|
79
|
+
info.retainedResourceCount !== 0 ||
|
|
80
|
+
(info.activeUIWorkletCount ?? 0) !== 0) {
|
|
81
|
+
throw new Error("The native Fabric surface is not empty at JavaScript ownership transfer.");
|
|
82
|
+
}
|
|
83
|
+
this.#surface = info.surface;
|
|
84
|
+
return info.surface;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
if (ACTIVE_NATIVE_FABRIC_HOSTS.get(this.binding) === this) {
|
|
88
|
+
ACTIVE_NATIVE_FABRIC_HOSTS.delete(this.binding);
|
|
89
|
+
}
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
destroySurface(surface) {
|
|
94
|
+
this.#assertSurface(surface);
|
|
95
|
+
if (this.#createdNodes.size !== 0) {
|
|
96
|
+
throw new Error(`Cannot destroy a native Fabric surface with ${this.#createdNodes.size} live nodes.`);
|
|
97
|
+
}
|
|
98
|
+
const info = readNativeSurfaceInfo(this.binding);
|
|
99
|
+
if (info.surface !== surface || !info.ready) {
|
|
100
|
+
throw new Error("The native Fabric surface became unavailable during teardown.");
|
|
101
|
+
}
|
|
102
|
+
if (info.retainedResourceCount !== 0) {
|
|
103
|
+
throw new Error(`Cannot destroy a native Fabric surface with ${info.retainedResourceCount} retained native resources.`);
|
|
104
|
+
}
|
|
105
|
+
if ((info.activeUIWorkletCount ?? 0) !== 0) {
|
|
106
|
+
throw new Error(`Cannot destroy a native Fabric surface with ${String(info.activeUIWorkletCount)} active UI worklets.`);
|
|
107
|
+
}
|
|
108
|
+
this.#destroying = true;
|
|
109
|
+
if (info.retainedNodeCount !== 0) {
|
|
110
|
+
return this.#destroyWhenReclaimed(surface);
|
|
111
|
+
}
|
|
112
|
+
return this.#finishDestroySurface(surface);
|
|
113
|
+
}
|
|
114
|
+
async #destroyWhenReclaimed(surface) {
|
|
115
|
+
try {
|
|
116
|
+
for (let attempt = 0; attempt < MAX_TEARDOWN_POLL_ATTEMPTS; attempt++) {
|
|
117
|
+
await waitForReclamationPoll();
|
|
118
|
+
const info = readNativeSurfaceInfo(this.binding);
|
|
119
|
+
if (info.surface !== surface || !info.ready) {
|
|
120
|
+
throw new Error("The native Fabric surface became unavailable during identity reclamation.");
|
|
121
|
+
}
|
|
122
|
+
if (info.retainedResourceCount !== 0) {
|
|
123
|
+
throw new Error(`Cannot destroy a native Fabric surface with ${info.retainedResourceCount} retained native resources.`);
|
|
124
|
+
}
|
|
125
|
+
if ((info.activeUIWorkletCount ?? 0) !== 0) {
|
|
126
|
+
throw new Error(`Cannot destroy a native Fabric surface with ${String(info.activeUIWorkletCount)} active UI worklets.`);
|
|
127
|
+
}
|
|
128
|
+
if (info.retainedNodeCount === 0) {
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
if (attempt === MAX_TEARDOWN_POLL_ATTEMPTS - 1) {
|
|
132
|
+
throw new Error("Timed out waiting for Fabric to reclaim retired native node identities.");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
this.#destroying = false;
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
await this.#finishDestroySurface(surface);
|
|
141
|
+
}
|
|
142
|
+
async #finishDestroySurface(surface) {
|
|
143
|
+
this.#detachNativeEvents?.();
|
|
144
|
+
this.#detachNativeEvents = undefined;
|
|
145
|
+
this.#detachNativeLifecycle?.();
|
|
146
|
+
this.#detachNativeLifecycle = undefined;
|
|
147
|
+
this.#listeners.clear();
|
|
148
|
+
this.#lifecycleListeners.clear();
|
|
149
|
+
let destroyRequested = false;
|
|
150
|
+
try {
|
|
151
|
+
this.binding.destroySurface();
|
|
152
|
+
destroyRequested = true;
|
|
153
|
+
for (let attempt = 0; attempt < MAX_TEARDOWN_POLL_ATTEMPTS; attempt++) {
|
|
154
|
+
const info = readNativeSurfaceInfo(this.binding);
|
|
155
|
+
if (!info.ready) {
|
|
156
|
+
this.#surface = undefined;
|
|
157
|
+
this.#destroying = false;
|
|
158
|
+
this.#destroyed = true;
|
|
159
|
+
if (ACTIVE_NATIVE_FABRIC_HOSTS.get(this.binding) === this) {
|
|
160
|
+
ACTIVE_NATIVE_FABRIC_HOSTS.delete(this.binding);
|
|
161
|
+
}
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (info.surface !== surface) {
|
|
165
|
+
throw new Error("The native Fabric binding published a different surface during teardown.");
|
|
166
|
+
}
|
|
167
|
+
await waitForReclamationPoll();
|
|
168
|
+
}
|
|
169
|
+
throw new Error("Timed out waiting for the native Fabric surface to stop.");
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
if (!destroyRequested)
|
|
173
|
+
this.#destroying = false;
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
allocateNode(surface) {
|
|
178
|
+
this.#assertSurface(surface);
|
|
179
|
+
if (!Number.isSafeInteger(this.#nextNode)) {
|
|
180
|
+
throw new Error("The native node handle space is exhausted.");
|
|
181
|
+
}
|
|
182
|
+
return this.#nextNode++;
|
|
183
|
+
}
|
|
184
|
+
commit(transaction) {
|
|
185
|
+
this.#assertSurface(transaction.surface);
|
|
186
|
+
const result = commitNativeHostTransaction(this.binding, transaction);
|
|
187
|
+
for (const mutation of transaction.mutations) {
|
|
188
|
+
if (mutation.type === "create-element" ||
|
|
189
|
+
mutation.type === "create-text") {
|
|
190
|
+
this.#createdNodes.add(mutation.node);
|
|
191
|
+
}
|
|
192
|
+
else if (mutation.type === "delete-node") {
|
|
193
|
+
this.#createdNodes.delete(mutation.node);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
measure(surface, node, afterSequence = 0) {
|
|
199
|
+
this.#assertSurface(surface);
|
|
200
|
+
return measureNativeHostNode(this.binding, node, afterSequence);
|
|
201
|
+
}
|
|
202
|
+
subscribe(listener) {
|
|
203
|
+
if (this.#surface === undefined || this.#destroyed || this.#destroying) {
|
|
204
|
+
throw new Error("Cannot subscribe without an active native surface.");
|
|
205
|
+
}
|
|
206
|
+
this.#listeners.add(listener);
|
|
207
|
+
if (this.#detachNativeEvents === undefined) {
|
|
208
|
+
this.#detachNativeEvents = subscribeToNativeHostEvents(this.binding, (event) => this.#dispatchEvent(event));
|
|
209
|
+
}
|
|
210
|
+
let subscribed = true;
|
|
211
|
+
return () => {
|
|
212
|
+
if (!subscribed)
|
|
213
|
+
return;
|
|
214
|
+
subscribed = false;
|
|
215
|
+
this.#listeners.delete(listener);
|
|
216
|
+
if (this.#listeners.size === 0) {
|
|
217
|
+
this.#detachNativeEvents?.();
|
|
218
|
+
this.#detachNativeEvents = undefined;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
subscribeLifecycle(listener) {
|
|
223
|
+
if (this.#surface === undefined || this.#destroyed || this.#destroying) {
|
|
224
|
+
throw new Error("Cannot subscribe to lifecycle events without an active native surface.");
|
|
225
|
+
}
|
|
226
|
+
if (this.binding.setCommitLifecycleHandler === undefined) {
|
|
227
|
+
return () => { };
|
|
228
|
+
}
|
|
229
|
+
this.#lifecycleListeners.add(listener);
|
|
230
|
+
if (this.#detachNativeLifecycle === undefined) {
|
|
231
|
+
this.#detachNativeLifecycle = subscribeToNativeHostCommitLifecycle(this.binding, (event) => this.#dispatchLifecycle(event));
|
|
232
|
+
}
|
|
233
|
+
let subscribed = true;
|
|
234
|
+
return () => {
|
|
235
|
+
if (!subscribed)
|
|
236
|
+
return;
|
|
237
|
+
subscribed = false;
|
|
238
|
+
this.#lifecycleListeners.delete(listener);
|
|
239
|
+
if (this.#lifecycleListeners.size === 0) {
|
|
240
|
+
this.#detachNativeLifecycle?.();
|
|
241
|
+
this.#detachNativeLifecycle = undefined;
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
getComponentDescriptor(name) {
|
|
246
|
+
return this.#descriptors.get(name);
|
|
247
|
+
}
|
|
248
|
+
#dispatchEvent(event) {
|
|
249
|
+
if (event.surface !== this.#surface || this.#destroyed)
|
|
250
|
+
return;
|
|
251
|
+
for (const listener of [...this.#listeners])
|
|
252
|
+
listener(event);
|
|
253
|
+
}
|
|
254
|
+
#dispatchLifecycle(event) {
|
|
255
|
+
if (event.surface !== this.#surface || this.#destroyed)
|
|
256
|
+
return;
|
|
257
|
+
for (const listener of [...this.#lifecycleListeners])
|
|
258
|
+
listener(event);
|
|
259
|
+
}
|
|
260
|
+
#assertSurface(surface) {
|
|
261
|
+
if (this.#destroyed || this.#surface === undefined) {
|
|
262
|
+
throw new Error("The native Fabric host does not have an active surface.");
|
|
263
|
+
}
|
|
264
|
+
if (this.#destroying) {
|
|
265
|
+
throw new Error("The native Fabric surface is being destroyed.");
|
|
266
|
+
}
|
|
267
|
+
if (surface !== this.#surface) {
|
|
268
|
+
throw new Error(`Surface ${surface} does not belong to this native Fabric host.`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
export function createNativeFabricHost(options) {
|
|
273
|
+
return new NativeFabricHost(options);
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=native-fabric-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-fabric-host.js","sourceRoot":"","sources":["../src/native-fabric-host.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GActB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,oCAAoC,EACpC,2BAA2B,EAC3B,wBAAwB,GAEzB,MAAM,qBAAqB,CAAC;AAO7B,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AACvC,MAAM,0BAA0B,GAAG,IAAI,OAAO,EAG3C,CAAC;AAEJ,MAAM,OAAO,iCAAkC,SAAQ,KAAK;IAC1D;QACE,KAAK,CAAC,oEAAoE,CAAC,CAAC;QAC5E,IAAI,CAAC,IAAI,GAAG,mCAAmC,CAAC;IAClD,CAAC;CACF;AAED,SAAS,sBAAsB;IAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,MAA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KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxE,CAAC;IAED,cAAc,CAAC,OAAkB;QAC/B,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CACb,yDAAyD,CAC1D,CAAC;QACJ,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QACD,IAAI,OAAO,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CACb,WAAW,OAAO,8CAA8C,CACjE,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAED,MAAM,UAAU,sBAAsB,CACpC,OAAgC;IAEhC,OAAO,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HOST_CONTRACT_VERSION, type HostCommit } from "@solidnative-dev/host-contract";
|
|
2
|
+
/**
|
|
3
|
+
* Framework-neutral transport envelope consumed by the native Fabric
|
|
4
|
+
* transaction coordinator.
|
|
5
|
+
* The contract version is kept outside HostCommit so every native boundary
|
|
6
|
+
* must state which decoder it expects.
|
|
7
|
+
*/
|
|
8
|
+
export interface NativeHostTransaction extends HostCommit {
|
|
9
|
+
readonly contractVersion: typeof HOST_CONTRACT_VERSION;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Takes an ownership-safe snapshot for a synchronous or asynchronous JSI call.
|
|
13
|
+
* The returned object contains only host-contract primitives, arrays, and plain
|
|
14
|
+
* objects; callers may mutate their original commit after this function.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createNativeHostTransaction(commit: HostCommit, platform: "android" | "ios"): NativeHostTransaction;
|
|
17
|
+
//# sourceMappingURL=native-transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-transaction.d.ts","sourceRoot":"","sources":["../src/native-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EAErB,KAAK,UAAU,EAIhB,MAAM,gCAAgC,CAAC;AAGxC;;;;;GAKG;AACH,MAAM,WAAW,qBAAsB,SAAQ,UAAU;IACvD,QAAQ,CAAC,eAAe,EAAE,OAAO,qBAAqB,CAAC;CACxD;AAsJD;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,SAAS,GAAG,KAAK,GAC1B,qBAAqB,CAavB"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { HOST_CAUSAL_OPERATION_ID_MAX_LENGTH, HOST_CONTRACT_VERSION, } from "@solidnative-dev/host-contract";
|
|
2
|
+
import normalizeColor from "@react-native/normalize-colors";
|
|
3
|
+
function cloneValue(value) {
|
|
4
|
+
if (Array.isArray(value))
|
|
5
|
+
return value.map(cloneValue);
|
|
6
|
+
if (value !== null && typeof value === "object") {
|
|
7
|
+
return Object.fromEntries(Object.entries(value).map(([name, child]) => [name, cloneValue(child)]));
|
|
8
|
+
}
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
function isColorProperty(name) {
|
|
12
|
+
return (name === "color" ||
|
|
13
|
+
name.endsWith("Color") ||
|
|
14
|
+
name === "underlineColorAndroid" ||
|
|
15
|
+
name === "trackColorForFalse" ||
|
|
16
|
+
name === "trackColorForTrue");
|
|
17
|
+
}
|
|
18
|
+
function processColorValue(value, path, platform) {
|
|
19
|
+
if (value === null ||
|
|
20
|
+
(typeof value !== "string" && typeof value !== "number")) {
|
|
21
|
+
return cloneValue(value);
|
|
22
|
+
}
|
|
23
|
+
const normalized = normalizeColor(value);
|
|
24
|
+
if (normalized === null) {
|
|
25
|
+
throw new TypeError(`${path} is not a valid React Native color.`);
|
|
26
|
+
}
|
|
27
|
+
// React Native normalizes to 0xrrggbbaa. Fabric expects 0xaarrggbb, signed
|
|
28
|
+
// on Android and unsigned on iOS, matching React Native's processColor.
|
|
29
|
+
const processed = ((normalized << 24) | (normalized >>> 8)) >>> 0;
|
|
30
|
+
return platform === "android" ? processed | 0 : processed;
|
|
31
|
+
}
|
|
32
|
+
function cloneStyle(value, platform) {
|
|
33
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
34
|
+
return cloneValue(value);
|
|
35
|
+
}
|
|
36
|
+
return Object.fromEntries(Object.entries(value).map(([name, child]) => [
|
|
37
|
+
name,
|
|
38
|
+
isColorProperty(name)
|
|
39
|
+
? processColorValue(child, `style.${name}`, platform)
|
|
40
|
+
: cloneValue(child),
|
|
41
|
+
]));
|
|
42
|
+
}
|
|
43
|
+
function cloneNestedColors(value, path, platform) {
|
|
44
|
+
if (Array.isArray(value)) {
|
|
45
|
+
return value.map((child, index) => cloneNestedColors(child, `${path}[${String(index)}]`, platform));
|
|
46
|
+
}
|
|
47
|
+
if (value === null || typeof value !== "object")
|
|
48
|
+
return value;
|
|
49
|
+
return Object.fromEntries(Object.entries(value).map(([name, child]) => [
|
|
50
|
+
name,
|
|
51
|
+
isColorProperty(name)
|
|
52
|
+
? processColorValue(child, `${path}.${name}`, platform)
|
|
53
|
+
: cloneNestedColors(child, `${path}.${name}`, platform),
|
|
54
|
+
]));
|
|
55
|
+
}
|
|
56
|
+
function processColorArray(value, path, platform) {
|
|
57
|
+
if (!Array.isArray(value))
|
|
58
|
+
return cloneValue(value);
|
|
59
|
+
return value.map((entry, index) => processColorValue(entry, `${path}[${String(index)}]`, platform));
|
|
60
|
+
}
|
|
61
|
+
function containsNestedColors(name) {
|
|
62
|
+
return (name === "standardAppearance" ||
|
|
63
|
+
name === "scrollEdgeAppearance" ||
|
|
64
|
+
name === "nativeBackgroundAndroid" ||
|
|
65
|
+
name === "nativeForegroundAndroid");
|
|
66
|
+
}
|
|
67
|
+
function cloneProps(props, platform) {
|
|
68
|
+
return Object.fromEntries(Object.entries(props).map(([name, value]) => [
|
|
69
|
+
name,
|
|
70
|
+
name === "style"
|
|
71
|
+
? cloneStyle(value, platform)
|
|
72
|
+
: name === "colors"
|
|
73
|
+
? processColorArray(value, name, platform)
|
|
74
|
+
: containsNestedColors(name)
|
|
75
|
+
? cloneNestedColors(value, name, platform)
|
|
76
|
+
: isColorProperty(name)
|
|
77
|
+
? processColorValue(value, name, platform)
|
|
78
|
+
: cloneValue(value),
|
|
79
|
+
]));
|
|
80
|
+
}
|
|
81
|
+
function cloneMutation(mutation, platform) {
|
|
82
|
+
switch (mutation.type) {
|
|
83
|
+
case "create-element":
|
|
84
|
+
return { ...mutation, props: cloneProps(mutation.props, platform) };
|
|
85
|
+
case "update-props":
|
|
86
|
+
return {
|
|
87
|
+
...mutation,
|
|
88
|
+
props: cloneProps(mutation.props, platform),
|
|
89
|
+
removedProps: [...mutation.removedProps],
|
|
90
|
+
};
|
|
91
|
+
case "update-event-listeners":
|
|
92
|
+
return { ...mutation, events: [...mutation.events] };
|
|
93
|
+
case "command":
|
|
94
|
+
return { ...mutation, args: mutation.args.map(cloneValue) };
|
|
95
|
+
default:
|
|
96
|
+
return { ...mutation };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function cloneCausalContext(context) {
|
|
100
|
+
if (context.operationId.length === 0 ||
|
|
101
|
+
context.operationId.length > HOST_CAUSAL_OPERATION_ID_MAX_LENGTH ||
|
|
102
|
+
context.operationId.includes("\0")) {
|
|
103
|
+
throw new RangeError(`The causal operation ID must contain 1-${HOST_CAUSAL_OPERATION_ID_MAX_LENGTH} characters without null bytes.`);
|
|
104
|
+
}
|
|
105
|
+
return { operationId: context.operationId };
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Takes an ownership-safe snapshot for a synchronous or asynchronous JSI call.
|
|
109
|
+
* The returned object contains only host-contract primitives, arrays, and plain
|
|
110
|
+
* objects; callers may mutate their original commit after this function.
|
|
111
|
+
*/
|
|
112
|
+
export function createNativeHostTransaction(commit, platform) {
|
|
113
|
+
return {
|
|
114
|
+
contractVersion: HOST_CONTRACT_VERSION,
|
|
115
|
+
surface: commit.surface,
|
|
116
|
+
sequence: commit.sequence,
|
|
117
|
+
priority: commit.priority,
|
|
118
|
+
mutations: commit.mutations.map((mutation) => cloneMutation(mutation, platform)),
|
|
119
|
+
...(commit.causalContext === undefined
|
|
120
|
+
? {}
|
|
121
|
+
: { causalContext: cloneCausalContext(commit.causalContext) }),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=native-transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-transaction.js","sourceRoot":"","sources":["../src/native-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,qBAAqB,GAMtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,cAAc,MAAM,gCAAgC,CAAC;AAY5D,SAAS,UAAU,CAAC,KAAgB;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACvD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CACxE,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,CACL,IAAI,KAAK,OAAO;QAChB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QACtB,IAAI,KAAK,uBAAuB;QAChC,IAAI,KAAK,oBAAoB;QAC7B,IAAI,KA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,0 +1,77 @@
|
|
|
1
|
+
import { HOST_CONTRACT_VERSION } from "@solidnative-dev/host-contract";
|
|
2
|
+
export type NativePlatform = "ios" | "android";
|
|
3
|
+
export type NativeBackendProof = "device-verified" | "simulator-verified" | "compile-verified" | "research-only";
|
|
4
|
+
export interface NativeBackendFingerprint {
|
|
5
|
+
readonly backend: string;
|
|
6
|
+
readonly backendVersion: string;
|
|
7
|
+
readonly platform: NativePlatform;
|
|
8
|
+
readonly engine: string;
|
|
9
|
+
readonly engineVersion: string;
|
|
10
|
+
readonly hostContractVersion: number;
|
|
11
|
+
readonly fabricEnabled: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface NativeBackendDefinition {
|
|
14
|
+
readonly backend: "react-native-fabric";
|
|
15
|
+
/** Exact React Native npm package release used to build this backend. */
|
|
16
|
+
readonly packageVersion: string;
|
|
17
|
+
/** Normalized runtime identity installed by the native host. */
|
|
18
|
+
readonly backendVersion: string;
|
|
19
|
+
readonly engine: "hermes";
|
|
20
|
+
readonly engineVersion: string;
|
|
21
|
+
readonly engineBytecodeVersion: number;
|
|
22
|
+
readonly hostContractVersion: typeof HOST_CONTRACT_VERSION;
|
|
23
|
+
readonly minimumIosVersion: string;
|
|
24
|
+
readonly platformProof: Readonly<Record<NativePlatform, NativeBackendProof>>;
|
|
25
|
+
readonly nativeApiSurface: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
export interface NativeBackendValidationReport {
|
|
28
|
+
readonly compatible: boolean;
|
|
29
|
+
readonly issues: readonly string[];
|
|
30
|
+
readonly proof: NativeBackendProof;
|
|
31
|
+
readonly expected: NativeBackendDefinition;
|
|
32
|
+
readonly observed: NativeBackendFingerprint;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The only native backend line currently selected by the Fabric host.
|
|
36
|
+
*
|
|
37
|
+
* `device-verified` means the compatibility target compiled and linked, then
|
|
38
|
+
* mounted, updated, measured, handled input, and tore down on real hardware.
|
|
39
|
+
*/
|
|
40
|
+
export declare const REACT_NATIVE_0_88_BACKEND: {
|
|
41
|
+
readonly backend: "react-native-fabric";
|
|
42
|
+
readonly packageVersion: "0.88.1";
|
|
43
|
+
readonly backendVersion: "0.88.1";
|
|
44
|
+
readonly engine: "hermes";
|
|
45
|
+
readonly engineVersion: "260318099.0.5";
|
|
46
|
+
readonly engineBytecodeVersion: 99;
|
|
47
|
+
readonly hostContractVersion: 1;
|
|
48
|
+
readonly minimumIosVersion: "15.1";
|
|
49
|
+
readonly platformProof: {
|
|
50
|
+
readonly ios: "device-verified";
|
|
51
|
+
readonly android: "device-verified";
|
|
52
|
+
};
|
|
53
|
+
readonly nativeApiSurface: readonly ["UIManager.createNode", "UIManager.cloneNode", "UIManager.appendChild", "UIManager.completeSurface", "UIManager.dispatchCommand"];
|
|
54
|
+
};
|
|
55
|
+
/** Version-neutral alias for the active verified native backend. */
|
|
56
|
+
export declare const VERIFIED_NATIVE_BACKEND: {
|
|
57
|
+
readonly backend: "react-native-fabric";
|
|
58
|
+
readonly packageVersion: "0.88.1";
|
|
59
|
+
readonly backendVersion: "0.88.1";
|
|
60
|
+
readonly engine: "hermes";
|
|
61
|
+
readonly engineVersion: "260318099.0.5";
|
|
62
|
+
readonly engineBytecodeVersion: 99;
|
|
63
|
+
readonly hostContractVersion: 1;
|
|
64
|
+
readonly minimumIosVersion: "15.1";
|
|
65
|
+
readonly platformProof: {
|
|
66
|
+
readonly ios: "device-verified";
|
|
67
|
+
readonly android: "device-verified";
|
|
68
|
+
};
|
|
69
|
+
readonly nativeApiSurface: readonly ["UIManager.createNode", "UIManager.cloneNode", "UIManager.appendChild", "UIManager.completeSurface", "UIManager.dispatchCommand"];
|
|
70
|
+
};
|
|
71
|
+
export declare class IncompatibleNativeBackendError extends Error {
|
|
72
|
+
readonly report: NativeBackendValidationReport;
|
|
73
|
+
constructor(report: NativeBackendValidationReport);
|
|
74
|
+
}
|
|
75
|
+
export declare function inspectNativeBackend(observed: NativeBackendFingerprint): NativeBackendValidationReport;
|
|
76
|
+
export declare function assertCompatibleNativeBackend(observed: NativeBackendFingerprint): NativeBackendDefinition;
|
|
77
|
+
//# sourceMappingURL=react-native-0.88.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-native-0.88.d.ts","sourceRoot":"","sources":["../src/react-native-0.88.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAGvE,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,SAAS,CAAC;AAC/C,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,oBAAoB,GACpB,kBAAkB,GAClB,eAAe,CAAC;AAEpB,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAC;IACxC,yEAAyE;IACzE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,gEAAgE;IAChE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,mBAAmB,EAAE,OAAO,qBAAqB,CAAC;IAC3D,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAC7E,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IAC3C,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;CAC7C;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;CAoBM,CAAC;AAE7C,oEAAoE;AACpE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;CAA4B,CAAC;AAEjE,qBAAa,8BAA+B,SAAQ,KAAK;IACvD,QAAQ,CAAC,MAAM,EAAE,6BAA6B,CAAC;gBAEnC,MAAM,EAAE,6BAA6B;CAKlD;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,wBAAwB,GACjC,6BAA6B,CA8C/B;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,wBAAwB,GACjC,uBAAuB,CAIzB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { HOST_CONTRACT_VERSION } from "@solidnative-dev/host-contract";
|
|
2
|
+
import { REACT_NATIVE_0_88_RELEASE } from "@solidnative-dev/react-native-compat";
|
|
3
|
+
/**
|
|
4
|
+
* The only native backend line currently selected by the Fabric host.
|
|
5
|
+
*
|
|
6
|
+
* `device-verified` means the compatibility target compiled and linked, then
|
|
7
|
+
* mounted, updated, measured, handled input, and tore down on real hardware.
|
|
8
|
+
*/
|
|
9
|
+
export const REACT_NATIVE_0_88_BACKEND = {
|
|
10
|
+
backend: "react-native-fabric",
|
|
11
|
+
packageVersion: REACT_NATIVE_0_88_RELEASE.packageVersion,
|
|
12
|
+
backendVersion: REACT_NATIVE_0_88_RELEASE.runtimeVersion,
|
|
13
|
+
engine: "hermes",
|
|
14
|
+
engineVersion: REACT_NATIVE_0_88_RELEASE.hermesCompilerVersion,
|
|
15
|
+
engineBytecodeVersion: REACT_NATIVE_0_88_RELEASE.hermesBytecodeVersion,
|
|
16
|
+
hostContractVersion: HOST_CONTRACT_VERSION,
|
|
17
|
+
minimumIosVersion: "15.1",
|
|
18
|
+
platformProof: {
|
|
19
|
+
ios: "device-verified",
|
|
20
|
+
android: "device-verified",
|
|
21
|
+
},
|
|
22
|
+
nativeApiSurface: [
|
|
23
|
+
"UIManager.createNode",
|
|
24
|
+
"UIManager.cloneNode",
|
|
25
|
+
"UIManager.appendChild",
|
|
26
|
+
"UIManager.completeSurface",
|
|
27
|
+
"UIManager.dispatchCommand",
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
/** Version-neutral alias for the active verified native backend. */
|
|
31
|
+
export const VERIFIED_NATIVE_BACKEND = REACT_NATIVE_0_88_BACKEND;
|
|
32
|
+
export class IncompatibleNativeBackendError extends Error {
|
|
33
|
+
report;
|
|
34
|
+
constructor(report) {
|
|
35
|
+
super(`Incompatible native backend: ${report.issues.join(" ")}`);
|
|
36
|
+
this.name = "IncompatibleNativeBackendError";
|
|
37
|
+
this.report = report;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function inspectNativeBackend(observed) {
|
|
41
|
+
const expected = REACT_NATIVE_0_88_BACKEND;
|
|
42
|
+
const proof = expected.platformProof[observed.platform];
|
|
43
|
+
const issues = [];
|
|
44
|
+
if (observed.backend !== expected.backend) {
|
|
45
|
+
issues.push(`Expected backend ${expected.backend}, received ${observed.backend}.`);
|
|
46
|
+
}
|
|
47
|
+
if (observed.backendVersion !== expected.backendVersion) {
|
|
48
|
+
issues.push(`Expected React Native ${expected.backendVersion}, received ${observed.backendVersion}.`);
|
|
49
|
+
}
|
|
50
|
+
if (observed.engine !== expected.engine) {
|
|
51
|
+
issues.push(`Expected engine ${expected.engine}, received ${observed.engine}.`);
|
|
52
|
+
}
|
|
53
|
+
if (observed.engineVersion !== expected.engineVersion) {
|
|
54
|
+
issues.push(`Expected Hermes ${expected.engineVersion}, received ${observed.engineVersion}.`);
|
|
55
|
+
}
|
|
56
|
+
if (observed.hostContractVersion !== expected.hostContractVersion) {
|
|
57
|
+
issues.push(`Expected host contract ${expected.hostContractVersion}, received ${observed.hostContractVersion}.`);
|
|
58
|
+
}
|
|
59
|
+
if (!observed.fabricEnabled) {
|
|
60
|
+
issues.push("The React Native Fabric renderer is disabled.");
|
|
61
|
+
}
|
|
62
|
+
if (proof === "research-only") {
|
|
63
|
+
issues.push(`The ${observed.platform} backend is ${proof}; no native runtime proof exists yet.`);
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
compatible: issues.length === 0,
|
|
67
|
+
issues,
|
|
68
|
+
proof,
|
|
69
|
+
expected,
|
|
70
|
+
observed: { ...observed },
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export function assertCompatibleNativeBackend(observed) {
|
|
74
|
+
const report = inspectNativeBackend(observed);
|
|
75
|
+
if (!report.compatible)
|
|
76
|
+
throw new IncompatibleNativeBackendError(report);
|
|
77
|
+
return report.expected;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=react-native-0.88.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-native-0.88.js","sourceRoot":"","sources":["../src/react-native-0.88.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AA0CjF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,OAAO,EAAE,qBAAqB;IAC9B,cAAc,EAAE,yBAAyB,CAAC,cAAc;IACxD,cAAc,EAAE,yBAAyB,CAAC,cAAc;IACxD,MAAM,EAAE,QAAQ;IAChB,aAAa,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
+
import { type NativeFabricBinding, type NativeSurfaceInfo } from "./native-binding.js";
|
|
2
|
+
export interface WaitForNativeSurfaceOptions {
|
|
3
|
+
readonly binding?: NativeFabricBinding;
|
|
4
|
+
/** Maximum native bootstrap wait. Defaults to 10 seconds and is capped at 60 seconds. */
|
|
5
|
+
readonly timeoutMs?: number;
|
|
6
|
+
/** Poll interval while the platform allocates its Fabric surface. Defaults to 10 ms. */
|
|
7
|
+
readonly pollIntervalMs?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class NativeSurfaceStartupError extends Error {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Waits for the package-owned iOS or Android shell to publish its empty Fabric
|
|
14
|
+
* surface. The wait is bounded so a failed native bootstrap cannot leave a
|
|
15
|
+
* hidden JavaScript polling loop running indefinitely.
|
|
16
|
+
*/
|
|
17
|
+
export declare function waitForNativeSurface(options?: WaitForNativeSurfaceOptions): Promise<NativeSurfaceInfo>;
|
|
18
|
+
//# sourceMappingURL=surface-readiness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-readiness.d.ts","sourceRoot":"","sources":["../src/surface-readiness.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAO7B,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IACvC,yFAAyF;IACzF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,wFAAwF;IACxF,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAuBD;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,iBAAiB,CAAC,CA2B5B"}
|