@symbiote-native/engine 0.2.0 → 0.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/README.md +17 -10
- package/build/action-sheet-ios/index.js +4 -1
- package/build/animated/animations/composition.js +3 -1
- package/build/animated/animations/spring-config.js +4 -1
- package/build/animated/animations/spring.js +23 -9
- package/build/animated/animations/timing.js +3 -2
- package/build/animated/bezier.js +2 -1
- package/build/animated/color.js +4 -2
- package/build/animated/event.js +7 -3
- package/build/animated/graph.js +8 -3
- package/build/animated/index.d.ts +2 -2
- package/build/animated/index.js +2 -2
- package/build/animated/interpolation.js +7 -2
- package/build/animated/mock.js +1 -1
- package/build/animated/native/native-animated.js +1 -1
- package/build/animated/operators.js +27 -6
- package/build/animated/props.js +1 -1
- package/build/animated/rgba.js +18 -3
- package/build/animated/style.js +13 -3
- package/build/animated/value-xy.d.ts +8 -5
- package/build/animated/value-xy.js +4 -1
- package/build/appearance/index.js +4 -1
- package/build/commit.d.ts +13 -0
- package/build/commit.js +145 -9
- package/build/events/index.js +19 -8
- package/build/fabric-props.js +8 -2
- package/build/image-loader.js +3 -2
- package/build/index.d.ts +19 -17
- package/build/index.js +17 -10
- package/build/interaction-manager/index.js +2 -1
- package/build/layout-animation/index.js +12 -4
- package/build/native-events.js +2 -1
- package/build/native-modules/index.js +3 -1
- package/build/node.d.ts +25 -0
- package/build/node.js +168 -2
- package/build/pan-responder/index.js +20 -9
- package/build/permissions-android/index.js +3 -1
- package/build/platform/index.android.d.ts +1 -1
- package/build/platform/index.android.js +1 -1
- package/build/platform/index.ios.d.ts +1 -1
- package/build/platform-color/index.js +3 -1
- package/build/post-commit.d.ts +1 -0
- package/build/post-commit.js +6 -0
- package/build/process-background-image/index.js +30 -9
- package/build/process-filter.js +11 -4
- package/build/registry.js +10 -2
- package/build/report-error.js +4 -1
- package/build/share/index.android.js +1 -1
- package/build/share/index.ios.js +1 -1
- package/build/status-bar/index.android.js +3 -4
- package/build/status-bar/index.ios.js +1 -1
- package/build/style-registry/index.d.ts +9 -2
- package/build/style-registry/index.js +145 -170
- package/build/style-registry/scope.d.ts +15 -1
- package/build/style-registry/scope.js +29 -27
- package/build/styles.d.ts +11 -1
- package/build/surface.d.ts +1 -1
- package/build/surface.js +5 -0
- package/build/tags.d.ts +1 -0
- package/build/tags.js +31 -1
- package/build/touch-history.js +9 -2
- package/build/vibration/index.ios.js +1 -1
- package/build/view-config.js +14 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ current one, clones only what changed, and calls `completeRoot` — the persiste
|
|
|
9
9
|
dance Fabric requires, done **once**, for every framework.
|
|
10
10
|
|
|
11
11
|
> New to SymbioteNative? The [root README](../../README.md) has the architecture and the one fact it
|
|
12
|
-
> rests on — React is just
|
|
12
|
+
> rests on — React is just _one client_ of `nativeFabricUIManager`. This package is what sits
|
|
13
13
|
> between every adapter and that native slot.
|
|
14
14
|
|
|
15
15
|
---
|
|
@@ -48,17 +48,24 @@ The entire surface a renderer seam drives:
|
|
|
48
48
|
|
|
49
49
|
```ts
|
|
50
50
|
import {
|
|
51
|
-
createElement,
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
createElement,
|
|
52
|
+
createRawText,
|
|
53
|
+
createAnchor,
|
|
54
|
+
appendChild,
|
|
55
|
+
insertBefore,
|
|
56
|
+
removeChild,
|
|
57
|
+
routeProp,
|
|
58
|
+
setEventListener,
|
|
59
|
+
setProp,
|
|
60
|
+
setText,
|
|
54
61
|
} from '@symbiote-native/engine';
|
|
55
62
|
|
|
56
|
-
const node = createElement('RCTView');
|
|
63
|
+
const node = createElement('RCTView'); // component IS the Fabric view name
|
|
57
64
|
const text = createRawText('Hello');
|
|
58
65
|
appendChild(node, text);
|
|
59
|
-
routeProp(node, 'onPress', () => {});
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
routeProp(node, 'onPress', () => {}); // ← the flat-bag entry point (React/Vue/Solid):
|
|
67
|
+
// decides event-vs-prop via the ViewConfig,
|
|
68
|
+
// NOT by the "onX" naming convention
|
|
62
69
|
```
|
|
63
70
|
|
|
64
71
|
`routeProp` is the one call a flat-bag adapter should route every prop through — a **structural**
|
|
@@ -72,7 +79,7 @@ import { createSurface } from '@symbiote-native/engine';
|
|
|
72
79
|
|
|
73
80
|
const surface = createSurface(rootTag);
|
|
74
81
|
surface.appendChild(root, node);
|
|
75
|
-
surface.commit();
|
|
82
|
+
surface.commit(); // synchronous — for a framework that already batches (React)
|
|
76
83
|
// surface.requestCommit(); // microtask-coalesced — for reactive frameworks (Vue/Svelte/Angular)
|
|
77
84
|
```
|
|
78
85
|
|
|
@@ -98,7 +105,7 @@ before a tag is guaranteed to exist.
|
|
|
98
105
|
- **The style pipeline** — `flattenStyle`, the CSS-style processors RN itself runs in JS
|
|
99
106
|
(`processBoxShadow`, `processFilter`, `processTransform`, `processTransformOrigin`,
|
|
100
107
|
`processAspectRatio`, `processFontVariant`, `processBackgroundImage`), and the runtime
|
|
101
|
-
**class-name registry** (`
|
|
108
|
+
**class-name registry** (`registerRules` / `resolveClassName` / `renameClassTokens`) that
|
|
102
109
|
`@symbiote-native/css-parser`'s build-time output resolves against — shared by every adapter's
|
|
103
110
|
`class` / `className` / `addClass` prop path.
|
|
104
111
|
- **`AppRegistry` core** (`createAppRegistry`) — registry bookkeeping + headless-task plumbing;
|
|
@@ -41,7 +41,10 @@ export const ActionSheetIOS = {
|
|
|
41
41
|
else if (typeof destructiveButtonIndex === 'number') {
|
|
42
42
|
destructiveButtonIndices = [destructiveButtonIndex];
|
|
43
43
|
}
|
|
44
|
-
const nativeOptions = {
|
|
44
|
+
const nativeOptions = {
|
|
45
|
+
...remainingOptions,
|
|
46
|
+
destructiveButtonIndices,
|
|
47
|
+
};
|
|
45
48
|
manager.showActionSheetWithOptions(nativeOptions, buttonIndex => {
|
|
46
49
|
dlog(`ActionSheetIOS callback buttonIndex=${buttonIndex}`);
|
|
47
50
|
callback(buttonIndex);
|
|
@@ -211,7 +211,9 @@ export function loop(animation, config = {}) {
|
|
|
211
211
|
return;
|
|
212
212
|
}
|
|
213
213
|
const restart = (result = { finished: true }) => {
|
|
214
|
-
if (isFinished ||
|
|
214
|
+
if (isFinished ||
|
|
215
|
+
iterationsSoFar === iterations ||
|
|
216
|
+
result.finished === false) {
|
|
215
217
|
callback?.(result);
|
|
216
218
|
}
|
|
217
219
|
else {
|
|
@@ -34,7 +34,10 @@ export function fromBouncinessAndSpeed(bounciness, speed) {
|
|
|
34
34
|
return 0.000044 * Math.pow(x, 3) - 0.006 * Math.pow(x, 2) + 0.36 * x + 2;
|
|
35
35
|
}
|
|
36
36
|
function b3Friction3(x) {
|
|
37
|
-
return 0.00000045 * Math.pow(x, 3) -
|
|
37
|
+
return (0.00000045 * Math.pow(x, 3) -
|
|
38
|
+
0.000332 * Math.pow(x, 2) +
|
|
39
|
+
0.1078 * x +
|
|
40
|
+
5.84);
|
|
38
41
|
}
|
|
39
42
|
function b3Nobounce(tension) {
|
|
40
43
|
if (tension <= 18)
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
// continuous. The native-config export is dropped.
|
|
7
7
|
import { dlog } from '../../debug.js';
|
|
8
8
|
import { BaseAnimation } from './base.js';
|
|
9
|
-
import { cancelFrame, clearTimer, requestFrame, setTimer } from './raf.js';
|
|
10
|
-
import { fromBouncinessAndSpeed, fromOrigamiTensionAndFriction } from './spring-config.js';
|
|
9
|
+
import { cancelFrame, clearTimer, requestFrame, setTimer, } from './raf.js';
|
|
10
|
+
import { fromBouncinessAndSpeed, fromOrigamiTensionAndFriction, } from './spring-config.js';
|
|
11
11
|
function resolveStiffnessDampingMass(config) {
|
|
12
|
-
if (config.stiffness !== undefined ||
|
|
12
|
+
if (config.stiffness !== undefined ||
|
|
13
|
+
config.damping !== undefined ||
|
|
14
|
+
config.mass !== undefined) {
|
|
13
15
|
return {
|
|
14
16
|
stiffness: config.stiffness ?? 100,
|
|
15
17
|
damping: config.damping ?? 10,
|
|
@@ -18,10 +20,18 @@ function resolveStiffnessDampingMass(config) {
|
|
|
18
20
|
}
|
|
19
21
|
if (config.bounciness !== undefined || config.speed !== undefined) {
|
|
20
22
|
const springConfig = fromBouncinessAndSpeed(config.bounciness ?? 8, config.speed ?? 12);
|
|
21
|
-
return {
|
|
23
|
+
return {
|
|
24
|
+
stiffness: springConfig.stiffness,
|
|
25
|
+
damping: springConfig.damping,
|
|
26
|
+
mass: 1,
|
|
27
|
+
};
|
|
22
28
|
}
|
|
23
29
|
const springConfig = fromOrigamiTensionAndFriction(config.tension ?? 40, config.friction ?? 7);
|
|
24
|
-
return {
|
|
30
|
+
return {
|
|
31
|
+
stiffness: springConfig.stiffness,
|
|
32
|
+
damping: springConfig.damping,
|
|
33
|
+
mass: 1,
|
|
34
|
+
};
|
|
25
35
|
}
|
|
26
36
|
export class SpringAnimation extends BaseAnimation {
|
|
27
37
|
overshootClamping;
|
|
@@ -141,7 +151,8 @@ export class SpringAnimation extends BaseAnimation {
|
|
|
141
151
|
position =
|
|
142
152
|
this.toValue -
|
|
143
153
|
envelope *
|
|
144
|
-
(((v0 + zeta * omega0 * x0) / omega1) * Math.sin(omega1 * t) +
|
|
154
|
+
(((v0 + zeta * omega0 * x0) / omega1) * Math.sin(omega1 * t) +
|
|
155
|
+
x0 * Math.cos(omega1 * t));
|
|
145
156
|
velocity =
|
|
146
157
|
zeta *
|
|
147
158
|
omega0 *
|
|
@@ -149,13 +160,15 @@ export class SpringAnimation extends BaseAnimation {
|
|
|
149
160
|
((Math.sin(omega1 * t) * (v0 + zeta * omega0 * x0)) / omega1 +
|
|
150
161
|
x0 * Math.cos(omega1 * t)) -
|
|
151
162
|
envelope *
|
|
152
|
-
(Math.cos(omega1 * t) * (v0 + zeta * omega0 * x0) -
|
|
163
|
+
(Math.cos(omega1 * t) * (v0 + zeta * omega0 * x0) -
|
|
164
|
+
omega1 * x0 * Math.sin(omega1 * t));
|
|
153
165
|
}
|
|
154
166
|
else {
|
|
155
167
|
// Critically damped.
|
|
156
168
|
const envelope = Math.exp(-omega0 * t);
|
|
157
169
|
position = this.toValue - envelope * (x0 + (v0 + omega0 * x0) * t);
|
|
158
|
-
velocity =
|
|
170
|
+
velocity =
|
|
171
|
+
envelope * (v0 * (t * omega0 - 1) + t * x0 * (omega0 * omega0));
|
|
159
172
|
}
|
|
160
173
|
this.lastTime = now;
|
|
161
174
|
this.lastPosition = position;
|
|
@@ -177,7 +190,8 @@ export class SpringAnimation extends BaseAnimation {
|
|
|
177
190
|
const isVelocity = Math.abs(velocity) <= this.restSpeedThreshold;
|
|
178
191
|
let isDisplacement = true;
|
|
179
192
|
if (this.stiffness !== 0) {
|
|
180
|
-
isDisplacement =
|
|
193
|
+
isDisplacement =
|
|
194
|
+
Math.abs(this.toValue - position) <= this.restDisplacementThreshold;
|
|
181
195
|
}
|
|
182
196
|
if (isOvershooting || (isVelocity && isDisplacement)) {
|
|
183
197
|
if (this.stiffness !== 0) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Easing } from '../easing.js';
|
|
6
6
|
import { dlog } from '../../debug.js';
|
|
7
7
|
import { BaseAnimation } from './base.js';
|
|
8
|
-
import { cancelFrame, clearTimer, requestFrame, setTimer } from './raf.js';
|
|
8
|
+
import { cancelFrame, clearTimer, requestFrame, setTimer, } from './raf.js';
|
|
9
9
|
let cachedEaseInOut;
|
|
10
10
|
function easeInOut() {
|
|
11
11
|
if (cachedEaseInOut === undefined) {
|
|
@@ -80,7 +80,8 @@ export class TimingAnimation extends BaseAnimation {
|
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
this.onUpdate(this.fromValue +
|
|
83
|
-
this.easing((now - this.startTime) / this.duration) *
|
|
83
|
+
this.easing((now - this.startTime) / this.duration) *
|
|
84
|
+
(this.toValue - this.fromValue));
|
|
84
85
|
if (this.__active) {
|
|
85
86
|
this.animationFrame = requestFrame(() => this.onFrame());
|
|
86
87
|
}
|
package/build/animated/bezier.js
CHANGED
|
@@ -40,7 +40,8 @@ function binarySubdivide(x, lower, upper, mX1, mX2) {
|
|
|
40
40
|
else {
|
|
41
41
|
lo = currentT;
|
|
42
42
|
}
|
|
43
|
-
} while (Math.abs(currentX) > SUBDIVISION_PRECISION &&
|
|
43
|
+
} while (Math.abs(currentX) > SUBDIVISION_PRECISION &&
|
|
44
|
+
++i < SUBDIVISION_MAX_ITERATIONS);
|
|
44
45
|
return currentT;
|
|
45
46
|
}
|
|
46
47
|
function newtonRaphsonIterate(x, guess, mX1, mX2) {
|
package/build/animated/color.js
CHANGED
|
@@ -11,7 +11,7 @@ import { DEFAULT_COLOR, normalizeColor } from './rgba.js';
|
|
|
11
11
|
// live in the dependency-free ./rgba leaf (see its header for the cycle it breaks).
|
|
12
12
|
export { normalizeColor };
|
|
13
13
|
function isRgbaInput(value) {
|
|
14
|
-
return typeof value === 'object' && value !== null && 'r' in value && 'g' in value;
|
|
14
|
+
return (typeof value === 'object' && value !== null && 'r' in value && 'g' in value);
|
|
15
15
|
}
|
|
16
16
|
function toChannel(value) {
|
|
17
17
|
return value instanceof AnimatedValue ? value : new AnimatedValue(value);
|
|
@@ -59,7 +59,9 @@ export class AnimatedColor extends AnimatedWithChildren {
|
|
|
59
59
|
// pattern). flushValue dedupes by leaf identity, so a single flush rebuilds
|
|
60
60
|
// every bound prop once even though four channels changed.
|
|
61
61
|
setValue(value) {
|
|
62
|
-
const rgba = typeof value === 'object'
|
|
62
|
+
const rgba = typeof value === 'object'
|
|
63
|
+
? value
|
|
64
|
+
: (normalizeColor(value) ?? DEFAULT_COLOR);
|
|
63
65
|
this.withSuspendedCallbacks(() => {
|
|
64
66
|
this.r.setValue(rgba.r);
|
|
65
67
|
this.g.setValue(rgba.g);
|
package/build/animated/event.js
CHANGED
|
@@ -17,14 +17,16 @@ import { dlog } from '../debug.js';
|
|
|
17
17
|
import { getNativeTag, whenCommitted } from '../commit.js';
|
|
18
18
|
import { isSymbioteNode } from '../node.js';
|
|
19
19
|
import { AnimatedNode, flushValue } from './graph.js';
|
|
20
|
-
import { isNativeAnimatedAvailable, nativeAnimated } from './native/native-animated.js';
|
|
20
|
+
import { isNativeAnimatedAvailable, nativeAnimated, } from './native/native-animated.js';
|
|
21
21
|
import { isRecord } from '../type-guards.js';
|
|
22
22
|
// A value node settable from an event field. AnimatedValue carries setValue; we
|
|
23
23
|
// duck-type it (rather than importing AnimatedValue) to keep this leaf-agnostic
|
|
24
24
|
// and avoid a value<->event import cycle.
|
|
25
25
|
function settableValue(node) {
|
|
26
26
|
const candidate = Reflect.get(node, 'setValue');
|
|
27
|
-
return typeof candidate === 'function'
|
|
27
|
+
return typeof candidate === 'function'
|
|
28
|
+
? value => candidate.call(node, value)
|
|
29
|
+
: undefined;
|
|
28
30
|
}
|
|
29
31
|
// Walk the mapping to every leaf AnimatedNode, recording its key path. Shared by
|
|
30
32
|
// the JS handler (to set values) and the native attach (to register paths).
|
|
@@ -128,7 +130,9 @@ export class AnimatedEvent {
|
|
|
128
130
|
if (!this.attachedNatively) {
|
|
129
131
|
// Paths are stored relative to `nativeEvent` (the native module excludes
|
|
130
132
|
// that prefix); the JS event arg still carries it, so re-add it here.
|
|
131
|
-
const nativeEvent = isRecord(args[0])
|
|
133
|
+
const nativeEvent = isRecord(args[0])
|
|
134
|
+
? Reflect.get(args[0], 'nativeEvent')
|
|
135
|
+
: undefined;
|
|
132
136
|
for (const mapped of this.mappedValues) {
|
|
133
137
|
const extracted = extractAtPath(nativeEvent, mapped.path);
|
|
134
138
|
if (extracted === undefined)
|
package/build/animated/graph.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// B) bottom-up: each flagged leaf re-pulls its whole subtree via __getValue()
|
|
11
11
|
// to rebuild composite props (e.g. transform from many parents).
|
|
12
12
|
import { generateNativeNodeTag, nativeAnimated, } from './native/native-animated.js';
|
|
13
|
-
import { checkValidRanges, createInterpolation } from './interpolation.js';
|
|
13
|
+
import { checkValidRanges, createInterpolation, } from './interpolation.js';
|
|
14
14
|
import { dlog } from '../debug.js';
|
|
15
15
|
let nextListenerId = 1;
|
|
16
16
|
// Depth of the currently-active withSuspendedCallbacks blocks. While > 0, a
|
|
@@ -81,7 +81,10 @@ export class AnimatedNode {
|
|
|
81
81
|
// (AnimatedNode.js:146-148) rather than in each node's config method.
|
|
82
82
|
const config = this.platformConfig === undefined
|
|
83
83
|
? this.__getNativeConfig()
|
|
84
|
-
: {
|
|
84
|
+
: {
|
|
85
|
+
...this.__getNativeConfig(),
|
|
86
|
+
platformConfig: this.platformConfig,
|
|
87
|
+
};
|
|
85
88
|
nativeAnimated.createAnimatedNode(this.nativeTag, config);
|
|
86
89
|
}
|
|
87
90
|
return this.nativeTag;
|
|
@@ -221,7 +224,9 @@ function numericValueOf(node) {
|
|
|
221
224
|
// under useDefineForClassFields. So leaves are detected structurally instead.
|
|
222
225
|
function leafUpdate(node) {
|
|
223
226
|
const candidate = Reflect.get(node, 'update');
|
|
224
|
-
return typeof candidate === 'function'
|
|
227
|
+
return typeof candidate === 'function'
|
|
228
|
+
? () => candidate.call(node)
|
|
229
|
+
: undefined;
|
|
225
230
|
}
|
|
226
231
|
// Top-down walk to the leaves, then re-pull each leaf (deduped by node identity,
|
|
227
232
|
// so a diamond in the graph still updates a leaf once). Suppressed inside a
|
|
@@ -14,7 +14,7 @@ export { AnimatedTracking } from './animations/tracking';
|
|
|
14
14
|
export { timing, spring, decay, parallel, sequence, stagger, loop, delay, type ICompositeAnimation, type ITimingConfig, type ISpringConfig, type IDecayConfig, type IParallelConfig, type ILoopAnimationConfig, } from './animations/composition';
|
|
15
15
|
export { nativeAnimated, isNativeAnimatedAvailable, type INativeNodeConfig, type INativeAnimationConfig, type INativeEventMapping, type IPlatformConfig, } from './native/native-animated';
|
|
16
16
|
export { AnimatedProps } from './props';
|
|
17
|
-
export { createAnimatedLeafLifecycle, type IAnimatedLeafLifecycle } from './leaf-lifecycle';
|
|
17
|
+
export { createAnimatedLeafLifecycle, type IAnimatedLeafLifecycle, } from './leaf-lifecycle';
|
|
18
18
|
export { AnimatedStyle, AnimatedTransform } from './style';
|
|
19
19
|
export { AnimatedMock } from './mock';
|
|
20
|
-
export { reduceProps, isAnimatedNode, readPassthroughStyle, resolveHostNode } from './shared';
|
|
20
|
+
export { reduceProps, isAnimatedNode, readPassthroughStyle, resolveHostNode, } from './shared';
|
package/build/animated/index.js
CHANGED
|
@@ -21,8 +21,8 @@ export { nativeAnimated, isNativeAnimatedAvailable, } from './native/native-anim
|
|
|
21
21
|
// no React/Vue). They live here with the rest of the graph; every adapter's
|
|
22
22
|
// createAnimatedComponent + Animated namespace re-exports them.
|
|
23
23
|
export { AnimatedProps } from './props.js';
|
|
24
|
-
export { createAnimatedLeafLifecycle } from './leaf-lifecycle.js';
|
|
24
|
+
export { createAnimatedLeafLifecycle, } from './leaf-lifecycle.js';
|
|
25
25
|
export { AnimatedStyle, AnimatedTransform } from './style.js';
|
|
26
26
|
export { AnimatedMock } from './mock.js';
|
|
27
27
|
// Framework-agnostic createAnimatedComponent helpers. Both adapters import them.
|
|
28
|
-
export { reduceProps, isAnimatedNode, readPassthroughStyle, resolveHostNode } from './shared.js';
|
|
28
|
+
export { reduceProps, isAnimatedNode, readPassthroughStyle, resolveHostNode, } from './shared.js';
|
|
@@ -171,7 +171,9 @@ function createStringInterpolation(config, outputRange) {
|
|
|
171
171
|
return input => {
|
|
172
172
|
const values = interpolations.map(interpolation => interpolation(input));
|
|
173
173
|
let i = 0;
|
|
174
|
-
return template
|
|
174
|
+
return template
|
|
175
|
+
.map(c => (typeof c === 'number' ? values[i++] : c))
|
|
176
|
+
.join('');
|
|
175
177
|
};
|
|
176
178
|
}
|
|
177
179
|
// Colors: r,g,b must be integers, so round them; alpha stays continuous but is
|
|
@@ -195,5 +197,8 @@ export function createInterpolation(config) {
|
|
|
195
197
|
if (isStringOutputRange(config.outputRange)) {
|
|
196
198
|
return createStringInterpolation(config, config.outputRange);
|
|
197
199
|
}
|
|
198
|
-
return createNumericInterpolation({
|
|
200
|
+
return createNumericInterpolation({
|
|
201
|
+
...config,
|
|
202
|
+
outputRange: config.outputRange,
|
|
203
|
+
});
|
|
199
204
|
}
|
package/build/animated/mock.js
CHANGED
|
@@ -11,7 +11,7 @@ import { AnimatedValueXY } from './value-xy.js';
|
|
|
11
11
|
import { AnimatedColor } from './color.js';
|
|
12
12
|
import { AnimatedNode } from './graph.js';
|
|
13
13
|
import { Easing } from './easing.js';
|
|
14
|
-
import { add, subtract, multiply, divide, modulo, diffClamp } from './operators.js';
|
|
14
|
+
import { add, subtract, multiply, divide, modulo, diffClamp, } from './operators.js';
|
|
15
15
|
import { event, forkEvent, unforkEvent } from './event.js';
|
|
16
16
|
import { dlog } from '../debug.js';
|
|
17
17
|
// Prevent a callback invocation from recursively triggering another callback,
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// native host) is inert until a native-driven animation actually starts.
|
|
12
12
|
import { dlog } from '../../debug.js';
|
|
13
13
|
import { getNativeModule } from '../../native-modules/index.js';
|
|
14
|
-
import { NativeEventEmitter } from '../../native-events.js';
|
|
14
|
+
import { NativeEventEmitter, } from '../../native-events.js';
|
|
15
15
|
import { isRecord } from '../../type-guards.js';
|
|
16
16
|
// iOS bridgeless registers the Turbo variant; the legacy name is the fallback.
|
|
17
17
|
const TURBO_MODULE_NAME = 'NativeAnimatedTurboModule';
|
|
@@ -57,7 +57,10 @@ export class AnimatedAddition extends AnimatedBinaryOp {
|
|
|
57
57
|
return a + b;
|
|
58
58
|
}
|
|
59
59
|
__getNativeConfig() {
|
|
60
|
-
return {
|
|
60
|
+
return {
|
|
61
|
+
type: 'addition',
|
|
62
|
+
input: [this.a.__getNativeTag(), this.b.__getNativeTag()],
|
|
63
|
+
};
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
export class AnimatedSubtraction extends AnimatedBinaryOp {
|
|
@@ -65,7 +68,10 @@ export class AnimatedSubtraction extends AnimatedBinaryOp {
|
|
|
65
68
|
return a - b;
|
|
66
69
|
}
|
|
67
70
|
__getNativeConfig() {
|
|
68
|
-
return {
|
|
71
|
+
return {
|
|
72
|
+
type: 'subtraction',
|
|
73
|
+
input: [this.a.__getNativeTag(), this.b.__getNativeTag()],
|
|
74
|
+
};
|
|
69
75
|
}
|
|
70
76
|
}
|
|
71
77
|
export class AnimatedMultiplication extends AnimatedBinaryOp {
|
|
@@ -73,7 +79,10 @@ export class AnimatedMultiplication extends AnimatedBinaryOp {
|
|
|
73
79
|
return a * b;
|
|
74
80
|
}
|
|
75
81
|
__getNativeConfig() {
|
|
76
|
-
return {
|
|
82
|
+
return {
|
|
83
|
+
type: 'multiplication',
|
|
84
|
+
input: [this.a.__getNativeTag(), this.b.__getNativeTag()],
|
|
85
|
+
};
|
|
77
86
|
}
|
|
78
87
|
}
|
|
79
88
|
export class AnimatedDivision extends AnimatedBinaryOp {
|
|
@@ -97,7 +106,10 @@ export class AnimatedDivision extends AnimatedBinaryOp {
|
|
|
97
106
|
return a / b;
|
|
98
107
|
}
|
|
99
108
|
__getNativeConfig() {
|
|
100
|
-
return {
|
|
109
|
+
return {
|
|
110
|
+
type: 'division',
|
|
111
|
+
input: [this.a.__getNativeTag(), this.b.__getNativeTag()],
|
|
112
|
+
};
|
|
101
113
|
}
|
|
102
114
|
}
|
|
103
115
|
export class AnimatedModulo extends AnimatedWithChildren {
|
|
@@ -127,7 +139,11 @@ export class AnimatedModulo extends AnimatedWithChildren {
|
|
|
127
139
|
super.__makeNative(platformConfig);
|
|
128
140
|
}
|
|
129
141
|
__getNativeConfig() {
|
|
130
|
-
return {
|
|
142
|
+
return {
|
|
143
|
+
type: 'modulus',
|
|
144
|
+
input: this.a.__getNativeTag(),
|
|
145
|
+
modulus: this.modulus,
|
|
146
|
+
};
|
|
131
147
|
}
|
|
132
148
|
}
|
|
133
149
|
export class AnimatedDiffClamp extends AnimatedWithChildren {
|
|
@@ -167,7 +183,12 @@ export class AnimatedDiffClamp extends AnimatedWithChildren {
|
|
|
167
183
|
super.__makeNative(platformConfig);
|
|
168
184
|
}
|
|
169
185
|
__getNativeConfig() {
|
|
170
|
-
return {
|
|
186
|
+
return {
|
|
187
|
+
type: 'diffclamp',
|
|
188
|
+
input: this.a.__getNativeTag(),
|
|
189
|
+
min: this.min,
|
|
190
|
+
max: this.max,
|
|
191
|
+
};
|
|
171
192
|
}
|
|
172
193
|
}
|
|
173
194
|
export function add(a, b) {
|
package/build/animated/props.js
CHANGED
|
@@ -15,7 +15,7 @@ import { AnimatedNode, AnimatedWithChildren } from './graph.js';
|
|
|
15
15
|
import { setNativeProps, getNativeTag } from '../commit.js';
|
|
16
16
|
import { isSymbioteNode } from '../node.js';
|
|
17
17
|
import { registerPostCommit } from '../post-commit.js';
|
|
18
|
-
import { nativeAnimated } from './native/native-animated.js';
|
|
18
|
+
import { nativeAnimated, } from './native/native-animated.js';
|
|
19
19
|
import { AnimatedStyle } from './style.js';
|
|
20
20
|
function isAnimatedNode(value) {
|
|
21
21
|
return value instanceof AnimatedNode;
|
package/build/animated/rgba.js
CHANGED
|
@@ -16,7 +16,12 @@ export const DEFAULT_COLOR = { r: 0, g: 0, b: 0, a: 1 };
|
|
|
16
16
|
export function normalizeColor(color) {
|
|
17
17
|
if (typeof color === 'number') {
|
|
18
18
|
const c = color >>> 0;
|
|
19
|
-
return {
|
|
19
|
+
return {
|
|
20
|
+
r: (c >>> 24) & 255,
|
|
21
|
+
g: (c >>> 16) & 255,
|
|
22
|
+
b: (c >>> 8) & 255,
|
|
23
|
+
a: (c & 255) / 255,
|
|
24
|
+
};
|
|
20
25
|
}
|
|
21
26
|
const trimmed = color.trim();
|
|
22
27
|
if (trimmed.startsWith('#'))
|
|
@@ -42,7 +47,12 @@ function parseHex(hex) {
|
|
|
42
47
|
return { r: (int >>> 16) & 255, g: (int >>> 8) & 255, b: int & 255, a: 1 };
|
|
43
48
|
}
|
|
44
49
|
const c = int >>> 0;
|
|
45
|
-
return {
|
|
50
|
+
return {
|
|
51
|
+
r: (c >>> 24) & 255,
|
|
52
|
+
g: (c >>> 16) & 255,
|
|
53
|
+
b: (c >>> 8) & 255,
|
|
54
|
+
a: (c & 255) / 255,
|
|
55
|
+
};
|
|
46
56
|
}
|
|
47
57
|
function parseRgb(str) {
|
|
48
58
|
const match = /^rgba?\(([^)]+)\)$/i.exec(str);
|
|
@@ -51,5 +61,10 @@ function parseRgb(str) {
|
|
|
51
61
|
const parts = match[1].split(',').map(part => Number.parseFloat(part.trim()));
|
|
52
62
|
if (parts.length < 3 || parts.some(n => Number.isNaN(n)))
|
|
53
63
|
return undefined;
|
|
54
|
-
return {
|
|
64
|
+
return {
|
|
65
|
+
r: parts[0],
|
|
66
|
+
g: parts[1],
|
|
67
|
+
b: parts[2],
|
|
68
|
+
a: parts.length >= 4 ? parts[3] : 1,
|
|
69
|
+
};
|
|
55
70
|
}
|
package/build/animated/style.js
CHANGED
|
@@ -73,7 +73,9 @@ export class AnimatedTransform extends AnimatedWithChildren {
|
|
|
73
73
|
const result = {};
|
|
74
74
|
for (const key of Object.keys(entry)) {
|
|
75
75
|
const value = entry[key];
|
|
76
|
-
result[key] = isAnimatedNode(value)
|
|
76
|
+
result[key] = isAnimatedNode(value)
|
|
77
|
+
? value.__getAnimatedValue()
|
|
78
|
+
: value;
|
|
77
79
|
}
|
|
78
80
|
return result;
|
|
79
81
|
});
|
|
@@ -96,10 +98,18 @@ export class AnimatedTransform extends AnimatedWithChildren {
|
|
|
96
98
|
const value = entry[key];
|
|
97
99
|
if (isAnimatedNode(value)) {
|
|
98
100
|
// __getNativeTag only: creation is edge-free; the connect is a later phase.
|
|
99
|
-
transforms.push({
|
|
101
|
+
transforms.push({
|
|
102
|
+
type: 'animated',
|
|
103
|
+
property: key,
|
|
104
|
+
nodeTag: value.__getNativeTag(),
|
|
105
|
+
});
|
|
100
106
|
}
|
|
101
107
|
else {
|
|
102
|
-
transforms.push({
|
|
108
|
+
transforms.push({
|
|
109
|
+
type: 'static',
|
|
110
|
+
property: key,
|
|
111
|
+
value: transformDataType(value),
|
|
112
|
+
});
|
|
103
113
|
}
|
|
104
114
|
}
|
|
105
115
|
}
|
|
@@ -26,10 +26,13 @@ export declare class AnimatedValueXY {
|
|
|
26
26
|
left: AnimatedValue;
|
|
27
27
|
top: AnimatedValue;
|
|
28
28
|
};
|
|
29
|
-
getTranslateTransform(): [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
getTranslateTransform(): [
|
|
30
|
+
{
|
|
31
|
+
translateX: AnimatedValue;
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
translateY: AnimatedValue;
|
|
35
|
+
}
|
|
36
|
+
];
|
|
34
37
|
}
|
|
35
38
|
export {};
|
|
@@ -17,7 +17,10 @@ export class AnimatedValueXY {
|
|
|
17
17
|
// Each joint id maps to the two per-axis listener ids it registered, so
|
|
18
18
|
// removeListener can tear both down together.
|
|
19
19
|
jointListeners = new Map();
|
|
20
|
-
constructor(value = {
|
|
20
|
+
constructor(value = {
|
|
21
|
+
x: 0,
|
|
22
|
+
y: 0,
|
|
23
|
+
}) {
|
|
21
24
|
if (typeof value.x === 'number' && typeof value.y === 'number') {
|
|
22
25
|
this.x = new AnimatedValue(value.x);
|
|
23
26
|
this.y = new AnimatedValue(value.y);
|
|
@@ -62,7 +62,10 @@ export const Appearance = {
|
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
module.setColorScheme(colorScheme);
|
|
65
|
-
cachedScheme =
|
|
65
|
+
cachedScheme =
|
|
66
|
+
colorScheme === 'unspecified'
|
|
67
|
+
? (module.getColorScheme() ?? null)
|
|
68
|
+
: colorScheme;
|
|
66
69
|
},
|
|
67
70
|
// Subscribe to color-scheme changes. The listener receives `{ colorScheme }`.
|
|
68
71
|
addChangeListener(listener) {
|
package/build/commit.d.ts
CHANGED
|
@@ -3,6 +3,19 @@ import { type ISymbioteNode } from './node';
|
|
|
3
3
|
export { processColor, setColorProcessor } from './platform-color';
|
|
4
4
|
export declare function disposeRoot(rootTag: IRootTag): void;
|
|
5
5
|
export declare function commitChildren(rootTag: IRootTag, children: readonly ISymbioteNode[]): void;
|
|
6
|
+
export interface ICommitProfile {
|
|
7
|
+
commits: number;
|
|
8
|
+
walkMs: number;
|
|
9
|
+
nodesVisited: number;
|
|
10
|
+
propWrites: number;
|
|
11
|
+
propNoops: number;
|
|
12
|
+
childScans: number;
|
|
13
|
+
childScanProbed: number;
|
|
14
|
+
childFlattens: number;
|
|
15
|
+
childFlattenProbed: number;
|
|
16
|
+
childFlattenWidest: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function readCommitProfile(): ICommitProfile;
|
|
6
19
|
export declare function setNativeProps(node: ISymbioteNode, partial: Record<string, unknown>): void;
|
|
7
20
|
export declare function getNativeTag(node: ISymbioteNode): number | undefined;
|
|
8
21
|
export declare function whenCommitted(node: ISymbioteNode, action: () => void): () => void;
|