embedded-react 0.2.0 → 0.2.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "embedded-react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native-style component package + reconciler that drives the embedded-react C engine through the QuickJS NativeUI bridge (Flow A).",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -74,13 +74,16 @@
|
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@babel/core": "^7.29.7",
|
|
76
76
|
"@babel/plugin-syntax-jsx": "^7.29.7",
|
|
77
|
-
"esbuild": "^0.
|
|
77
|
+
"esbuild": "^0.28.1",
|
|
78
78
|
"opentype.js": "^2.0.0",
|
|
79
79
|
"pngjs": "^7.0.0",
|
|
80
80
|
"react": "18.3.1",
|
|
81
81
|
"react-reconciler": "0.29.2"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"vitest": "^2.
|
|
84
|
+
"vitest": "^3.2.4"
|
|
85
|
+
},
|
|
86
|
+
"overrides": {
|
|
87
|
+
"esbuild": "^0.28.1"
|
|
85
88
|
}
|
|
86
89
|
}
|
|
@@ -280,8 +280,8 @@ export function loop(animation, config) {
|
|
|
280
280
|
const done = once(onComplete);
|
|
281
281
|
const startValue = resetBeforeIteration && animation._value ? animation._value.__getValue() : null;
|
|
282
282
|
let count = 0;
|
|
283
|
-
const
|
|
284
|
-
if (stopped
|
|
283
|
+
const startIteration = () => {
|
|
284
|
+
if (stopped) {
|
|
285
285
|
done({ finished: false });
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
@@ -293,9 +293,22 @@ export function loop(animation, config) {
|
|
|
293
293
|
if (resetBeforeIteration && animation._value && startValue != null && count > 1) {
|
|
294
294
|
animation._value.setValue(startValue);
|
|
295
295
|
}
|
|
296
|
-
animation.start(
|
|
296
|
+
animation.start(onIterationDone);
|
|
297
|
+
};
|
|
298
|
+
const onIterationDone = (result) => {
|
|
299
|
+
if (stopped || !result || result.finished === false) {
|
|
300
|
+
done({ finished: false });
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
// Defer the next iteration to a fresh task instead of starting it inline. A child animation can
|
|
304
|
+
// complete *synchronously* (a long-duration timing finishing inside one large catch-up frame in
|
|
305
|
+
// the simulator), and starting the next iteration from within, that completion callback would
|
|
306
|
+
// recurse — loop → child → completion → loop → … — until the stack overflows. setTimeout breaks
|
|
307
|
+
// the chain: the host pump runs it on the next frame, by which point real time has advanced so
|
|
308
|
+
// the animation runs its full duration again. (Negligible cost in the normal async case.)
|
|
309
|
+
setTimeout(startIteration, 0);
|
|
297
310
|
};
|
|
298
|
-
|
|
311
|
+
startIteration();
|
|
299
312
|
},
|
|
300
313
|
stop() {
|
|
301
314
|
stopped = true;
|