@symbiote-native/engine 0.1.1 → 0.1.3
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 +10 -0
- package/build/accessibility-info/index.android.js +8 -9
- package/build/accessibility-info/index.ios.js +8 -9
- package/build/accessibility-info/index.js +1 -1
- package/build/accessibility-info/shared.js +2 -1
- package/build/action-sheet-ios/index.js +4 -4
- package/build/alert/index.android.js +9 -9
- package/build/alert/index.ios.js +5 -5
- package/build/alert/index.js +2 -2
- package/build/alert/shared.js +1 -1
- package/build/animated/animated-component-shared.js +3 -4
- package/build/animated/animations/base.js +5 -5
- package/build/animated/animations/composition.js +9 -9
- package/build/animated/animations/decay.js +5 -5
- package/build/animated/animations/spring.js +5 -5
- package/build/animated/animations/timing.js +5 -5
- package/build/animated/animations/tracking.js +1 -1
- package/build/animated/color.js +2 -2
- package/build/animated/easing.js +1 -1
- package/build/animated/event.js +5 -5
- package/build/animated/graph.js +3 -4
- package/build/animated/index.js +24 -24
- package/build/animated/interpolation-node.js +2 -2
- package/build/animated/interpolation.js +2 -2
- package/build/animated/mock.js +8 -8
- package/build/animated/native/native-animated.js +6 -6
- package/build/animated/operators.js +4 -4
- package/build/animated/props.js +10 -10
- package/build/animated/style.js +5 -5
- package/build/animated/value-xy.js +2 -2
- package/build/animated/value.js +4 -4
- package/build/app-registry/index.js +2 -2
- package/build/app-state/index.js +3 -3
- package/build/appearance/index.js +3 -3
- package/build/back-handler/index.js +5 -6
- package/build/commit.js +21 -21
- package/build/dimensions/index.js +4 -5
- package/build/events/index.js +5 -5
- package/build/fabric.js +1 -1
- package/build/host-instance/index.js +3 -3
- package/build/i18n-manager/index.js +4 -5
- package/build/index.js +49 -49
- package/build/interaction-manager/index.js +1 -1
- package/build/keyboard/index.js +5 -5
- package/build/layout-animation/index.js +3 -4
- package/build/linking/index.android.js +2 -2
- package/build/linking/index.ios.js +1 -1
- package/build/linking/index.js +2 -2
- package/build/linking/shared.js +4 -4
- package/build/native-events.js +3 -3
- package/build/native-modules.js +2 -2
- package/build/node.js +5 -4
- package/build/pan-responder/index.js +1 -1
- package/build/permissions-android/index.js +5 -6
- package/build/pixel-ratio/index.js +1 -1
- package/build/platform/index.android.js +2 -2
- package/build/platform/index.ios.js +2 -2
- package/build/platform/index.js +1 -2
- package/build/platform/shared.js +2 -3
- package/build/process-aspect-ratio.js +1 -1
- package/build/process-background-image/index.js +3 -3
- package/build/process-box-shadow/index.js +3 -3
- package/build/process-filter.js +3 -3
- package/build/process-transform/index.js +1 -1
- package/build/process-transform-origin/index.js +1 -1
- package/build/settings/index.js +5 -7
- package/build/share/index.android.js +4 -5
- package/build/share/index.ios.js +4 -4
- package/build/share/index.js +2 -2
- package/build/share/shared.js +1 -1
- package/build/status-bar/index.android.js +5 -5
- package/build/status-bar/index.ios.js +4 -5
- package/build/status-bar/index.js +1 -1
- package/build/status-bar/shared.js +1 -1
- package/build/style-registry/index.js +12 -16
- package/build/style-sheet/index.js +3 -3
- package/build/surface.js +3 -3
- package/build/text-input-state.js +2 -2
- package/build/toast-android/index.js +5 -5
- package/build/vibration/index.android.js +2 -3
- package/build/vibration/index.ios.js +1 -1
- package/build/vibration/index.js +2 -2
- package/build/vibration/shared.js +6 -7
- package/build/view-config.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -30,6 +30,16 @@ dance Fabric requires, done **once**, for every framework.
|
|
|
30
30
|
The mutation API below is intentionally low-level and closely mirrors Fabric's own persistent
|
|
31
31
|
semantics — it is an internal seam, not an app-facing API.
|
|
32
32
|
|
|
33
|
+
### Install
|
|
34
|
+
|
|
35
|
+
Most apps get this transitively, through an adapter (`@symbiote-native/react`,
|
|
36
|
+
`@symbiote-native/vue`, `@symbiote-native/angular` all depend on it). Writing or debugging an
|
|
37
|
+
adapter yourself:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install @symbiote-native/engine
|
|
41
|
+
```
|
|
42
|
+
|
|
33
43
|
---
|
|
34
44
|
|
|
35
45
|
## The mutation API — `core/engine/src/node.ts`
|
|
@@ -6,17 +6,16 @@
|
|
|
6
6
|
// device-event NAMES also differ from iOS (e.g. screen-reader is `touchExplorationDidChange`,
|
|
7
7
|
// reduce-motion is `reduceMotionDidChange`). Metro picks this on an Android host. Mirrors
|
|
8
8
|
// RN's AccessibilityInfo.js Android branches.
|
|
9
|
-
import { getNativeModule } from '../native-modules';
|
|
10
|
-
import { installDeviceEventHub, NativeEventEmitter, } from '../native-events';
|
|
11
|
-
import { isSymbioteNode } from '../node';
|
|
12
|
-
import { sendAccessibilityEvent as sharedSendAccessibilityEvent } from '../commit';
|
|
13
|
-
import { dlog } from '../debug';
|
|
14
|
-
import { isBoolean, } from './shared';
|
|
9
|
+
import { getNativeModule } from '../native-modules.js';
|
|
10
|
+
import { installDeviceEventHub, NativeEventEmitter, } from '../native-events.js';
|
|
11
|
+
import { isSymbioteNode } from '../node.js';
|
|
12
|
+
import { sendAccessibilityEvent as sharedSendAccessibilityEvent } from '../commit.js';
|
|
13
|
+
import { dlog } from '../debug.js';
|
|
14
|
+
import { isBoolean, } from './shared.js';
|
|
15
15
|
// The Android native module name. This is the module the Android JS wrapper
|
|
16
16
|
// (INativeAccessibilityInfoAndroid) resolves: the stock RN `AccessibilityInfo` Turbo/legacy
|
|
17
|
-
// module.
|
|
18
|
-
//
|
|
19
|
-
// .docs/native-module-platform-routing.md.
|
|
17
|
+
// module. A module name is only provable on a real host (a headless fake answers to any
|
|
18
|
+
// name); this Android name is DEVICE-VERIFY-PENDING.
|
|
20
19
|
const ACCESSIBILITY_MODULE = 'AccessibilityInfo';
|
|
21
20
|
// Public event name -> the Android device event the native side emits. Android renames
|
|
22
21
|
// most of them; events with no Android source (iOS-only) are absent and yield an inert
|
|
@@ -6,18 +6,17 @@
|
|
|
6
6
|
// NativeEventEmitter and re-broadcasts to JS listeners. Metro picks this on an iOS host;
|
|
7
7
|
// the bare accessibility-info.ts re-exports it as the default for tsc / tsx / headless.
|
|
8
8
|
// Mirrors RN's AccessibilityInfo.js iOS branches.
|
|
9
|
-
import { getNativeModule } from '../native-modules';
|
|
10
|
-
import { installDeviceEventHub, NativeEventEmitter, } from '../native-events';
|
|
11
|
-
import { isSymbioteNode } from '../node';
|
|
12
|
-
import { sendAccessibilityEvent as sharedSendAccessibilityEvent } from '../commit';
|
|
13
|
-
import { dlog } from '../debug';
|
|
14
|
-
import { isBoolean, } from './shared';
|
|
9
|
+
import { getNativeModule } from '../native-modules.js';
|
|
10
|
+
import { installDeviceEventHub, NativeEventEmitter, } from '../native-events.js';
|
|
11
|
+
import { isSymbioteNode } from '../node.js';
|
|
12
|
+
import { sendAccessibilityEvent as sharedSendAccessibilityEvent } from '../commit.js';
|
|
13
|
+
import { dlog } from '../debug.js';
|
|
14
|
+
import { isBoolean, } from './shared.js';
|
|
15
15
|
// The iOS native module name RN registers this under. NOTE: this is the name the iOS JS
|
|
16
16
|
// wrapper (INativeAccessibilityManagerIOS) resolves via
|
|
17
17
|
// `TurboModuleRegistry.get('AccessibilityManager')`, NOT the spec filename
|
|
18
|
-
// `NativeAccessibilityManager`.
|
|
19
|
-
//
|
|
20
|
-
// (the pre-split file shipped it). See .docs/native-module-platform-routing.md.
|
|
18
|
+
// `NativeAccessibilityManager`. A module name is only provable on a real host (a headless
|
|
19
|
+
// fake answers to any name); this iOS name is device-verified (the pre-split file shipped it).
|
|
21
20
|
const ACCESSIBILITY_MODULE = 'AccessibilityManager';
|
|
22
21
|
// Public event name -> the iOS device event the native side emits. iOS keeps the names
|
|
23
22
|
// 1:1; the indirection exists only so the mapping stays explicit (Android renames them).
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
// event maps to (iOS `screenReaderChanged` vs Android `touchExplorationDidChange`).
|
|
7
7
|
// So the .ios/.android files own the native calls and per-platform event-name map;
|
|
8
8
|
// the public types + the shared method surface live here. Filename selects, no
|
|
9
|
-
// Platform.OS read
|
|
9
|
+
// Platform.OS read: the native module name is resolved per platform inside those
|
|
10
|
+
// files, not derived from this file's name. Mirrors
|
|
10
11
|
// RN's Libraries/Components/AccessibilityInfo/AccessibilityInfo.js.
|
|
11
12
|
export function isBoolean(value) {
|
|
12
13
|
return typeof value === 'boolean';
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// passes options straight through and the native `callback(buttonIndex)` reports
|
|
4
4
|
// the tapped row. We mirror RN faithfully.
|
|
5
5
|
//
|
|
6
|
-
// The native contract is confirmed from RN's TurboModule spec
|
|
7
|
-
//
|
|
6
|
+
// The native contract is confirmed from RN's TurboModule spec for
|
|
7
|
+
// `INativeActionSheetManager`:
|
|
8
8
|
// showActionSheetWithOptions(options, callback: (buttonIndex: number) => void)
|
|
9
9
|
// showShareActionSheetWithOptions(options, failureCallback, successCallback)
|
|
10
10
|
// dismissActionSheet?()
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
// through processColor before handing them to native. symbiote centralizes color
|
|
17
17
|
// processing in @symbiote-native/engine, so we do NOT process colors here; options pass
|
|
18
18
|
// through untouched. The canary needs no colors; revisit when wiring real colors.
|
|
19
|
-
import { dlog } from '../debug';
|
|
20
|
-
import { getNativeModule } from '../native-modules';
|
|
19
|
+
import { dlog } from '../debug.js';
|
|
20
|
+
import { getNativeModule } from '../native-modules.js';
|
|
21
21
|
const ACTION_SHEET_MANAGER = 'ActionSheetManager';
|
|
22
22
|
// The static imperative API RN exposes, mirrored as a static-method object.
|
|
23
23
|
export const ActionSheetIOS = {
|
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
// neutral, last-to-first as RN does. Everything platform-agnostic is the shared core.
|
|
6
6
|
// Metro picks this file on an Android host.
|
|
7
7
|
//
|
|
8
|
-
// The native contract is confirmed from RN's TurboModule spec
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
8
|
+
// The native contract is confirmed from RN's TurboModule spec for
|
|
9
|
+
// `INativeDialogManagerAndroid`:
|
|
10
|
+
// getConstants(): { buttonClicked, dismissed, buttonPositive, buttonNegative,
|
|
11
|
+
// buttonNeutral }
|
|
12
|
+
// showAlert(config, onError: (msg) => void, onAction: (action, buttonKey?) => void)
|
|
13
13
|
//
|
|
14
14
|
// device-verify-pending: the `DialogManagerAndroid` name and routing are confirmed from RN
|
|
15
15
|
// source but not yet exercised on a real Android host; only a bridgeless resolution log
|
|
16
|
-
// there can prove the name.
|
|
16
|
+
// there can prove the name.
|
|
17
17
|
//
|
|
18
18
|
// Non-throwing, like StatusBar: a missing native module is a no-op, never a crash.
|
|
19
|
-
import { dlog } from '../debug';
|
|
20
|
-
import { getNativeModule } from '../native-modules';
|
|
21
|
-
import { DEFAULT_POSITIVE_TEXT, normalizeButtons, } from './shared';
|
|
19
|
+
import { dlog } from '../debug.js';
|
|
20
|
+
import { getNativeModule } from '../native-modules.js';
|
|
21
|
+
import { DEFAULT_POSITIVE_TEXT, normalizeButtons, } from './shared.js';
|
|
22
22
|
const DIALOG_MANAGER = 'DialogManagerAndroid';
|
|
23
23
|
// RN's hardwired Android fallbacks for the button-key constants (NativeDialogManager-
|
|
24
24
|
// Android documents buttonPositive=-1, buttonNegative=-2, buttonNeutral=-3, and the
|
package/build/alert/index.ios.js
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
// AlertManager path RN uses. Metro picks this file on an iOS host; the base alert.ts
|
|
6
6
|
// re-exports it for web/headless.
|
|
7
7
|
//
|
|
8
|
-
// The native contract is confirmed from RN's TurboModule spec
|
|
9
|
-
//
|
|
10
|
-
//
|
|
8
|
+
// The native contract is confirmed from RN's TurboModule spec for
|
|
9
|
+
// `INativeAlertManager`:
|
|
10
|
+
// alertWithArgs(args: Args, callback: (id: number, value: string) => void)
|
|
11
11
|
//
|
|
12
12
|
// Non-throwing, like StatusBar: a missing native module is a no-op, never a crash (on a
|
|
13
13
|
// device the module may be absent).
|
|
14
|
-
import { dlog } from '../debug';
|
|
15
|
-
import { getNativeModule } from '../native-modules';
|
|
14
|
+
import { dlog } from '../debug.js';
|
|
15
|
+
import { getNativeModule } from '../native-modules.js';
|
|
16
16
|
const ALERT_MANAGER = 'AlertManager';
|
|
17
17
|
// prompt builds the native args, assigns each button its array index as id, and dispatches
|
|
18
18
|
// the matching button's onPress when the native callback returns that id. Non-throwing: no
|
package/build/alert/index.js
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
// → graceful no-op). The barrel imports './alert', which resolves here under tsc/tsx and to
|
|
5
5
|
// the platform file under Metro. The `export *` re-exports the public type names
|
|
6
6
|
// (AlertType, AlertButtonStyle, AlertButton, AlertButtons, AlertOptions) so the barrel's
|
|
7
|
-
// `export type { ... } from '../alert'` still resolves.
|
|
8
|
-
export * from './index.ios';
|
|
7
|
+
// `export type { ... } from '../alert/index.js'` still resolves.
|
|
8
|
+
export * from './index.ios.js';
|
package/build/alert/shared.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// constant defaults, and the button-normalization helper. The per-platform files
|
|
4
4
|
// (alert.ios.ts / alert.android.ts) implement `alert()` fully against their own native
|
|
5
5
|
// module (iOS keeps `prompt` too); the two native call shapes are too divergent to share
|
|
6
|
-
// a factory. No native, no `Platform.OS` read here.
|
|
6
|
+
// a factory. No native, no `Platform.OS` read here.
|
|
7
7
|
// The default positive label RN uses when a button carries no text.
|
|
8
8
|
export const DEFAULT_POSITIVE_TEXT = 'OK';
|
|
9
9
|
// Normalize the `buttons` arg into a consistent list: undefined/empty becomes a single
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
// mechanism (capture the host node, build an AnimatedProps leaf, reduce animated
|
|
4
4
|
// props to their current values, override with the passthrough style) is pure JS,
|
|
5
5
|
// identical across frameworks. Only `assignRef` is framework-ref-specific and stays
|
|
6
|
-
// per-adapter; everything here is shared
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import { AnimatedStyle } from './style';
|
|
6
|
+
// per-adapter; everything here is shared so a new adapter reuses it verbatim.
|
|
7
|
+
import { AnimatedNode } from './graph.js';
|
|
8
|
+
import { AnimatedStyle } from './style.js';
|
|
10
9
|
export function isAnimatedNode(value) {
|
|
11
10
|
return value instanceof AnimatedNode;
|
|
12
11
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Minimal driver base, ported from RN's animations/Animation.js with every
|
|
2
|
-
// native path removed
|
|
2
|
+
// native path removed: no NativeAnimatedHelper, no
|
|
3
3
|
// __startAnimationIfNative, no shouldUseNativeDriver, no FeatureFlags. What
|
|
4
4
|
// remains is the JS-only contract: hold the end callback, track whether the
|
|
5
5
|
// animation is still active, and fire onEnd at most once.
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
// owns its own requestAnimationFrame loop. They are declared as methods (not
|
|
9
9
|
// class fields) so a subclass override is not shadowed under
|
|
10
10
|
// useDefineForClassFields.
|
|
11
|
-
import { flushValue } from '../graph';
|
|
12
|
-
import { dlog, isDebug } from '../../debug';
|
|
13
|
-
import { generateNativeAnimationId, isNativeAnimatedAvailable, nativeAnimated, } from '../native/native-animated';
|
|
11
|
+
import { flushValue } from '../graph.js';
|
|
12
|
+
import { dlog, isDebug } from '../../debug.js';
|
|
13
|
+
import { generateNativeAnimationId, isNativeAnimatedAvailable, nativeAnimated, } from '../native/native-animated.js';
|
|
14
14
|
export class BaseAnimation {
|
|
15
15
|
// `protected` so subclasses read it inside their rAF loop to decide whether to
|
|
16
16
|
// schedule the next frame; cleared by stop().
|
|
@@ -48,7 +48,7 @@ export class BaseAnimation {
|
|
|
48
48
|
// If useNativeDriver was requested and the module is present, mirror the value
|
|
49
49
|
// graph into native and hand the curve to native. The JS rAF loop is then
|
|
50
50
|
// skipped entirely. Returns true when native took over. Falls back to JS (false)
|
|
51
|
-
// when the module is missing
|
|
51
|
+
// when the module is missing, so an app without RCTAnimation
|
|
52
52
|
// still animates.
|
|
53
53
|
startNativeIfNeeded(animatedValue) {
|
|
54
54
|
if (!this.nativeDriverRequested)
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// The driver factory + composition API, ported from RN's
|
|
2
|
-
// AnimatedImplementation.js, JS orchestration only
|
|
2
|
+
// AnimatedImplementation.js, JS orchestration only. `timing` /
|
|
3
3
|
// `spring` / `decay` wrap a value with a fresh driver and return a
|
|
4
4
|
// CompositeAnimation; `parallel` / `sequence` / `stagger` / `loop` / `delay`
|
|
5
5
|
// orchestrate those. Vector (XY/Color) handling, tracking, AnimatedEvent and
|
|
6
6
|
// every native-loop branch are dropped.
|
|
7
|
-
import { dlog } from '../../debug';
|
|
8
|
-
import { isNativeAnimatedAvailable } from '../native/native-animated';
|
|
9
|
-
import { AnimatedNode } from '../graph';
|
|
10
|
-
import { AnimatedValue } from '../value';
|
|
11
|
-
import { AnimatedTracking } from './tracking';
|
|
12
|
-
import { TimingAnimation } from './timing';
|
|
13
|
-
import { SpringAnimation } from './spring';
|
|
14
|
-
import { DecayAnimation } from './decay';
|
|
7
|
+
import { dlog } from '../../debug.js';
|
|
8
|
+
import { isNativeAnimatedAvailable } from '../native/native-animated.js';
|
|
9
|
+
import { AnimatedNode } from '../graph.js';
|
|
10
|
+
import { AnimatedValue } from '../value.js';
|
|
11
|
+
import { AnimatedTracking } from './tracking.js';
|
|
12
|
+
import { TimingAnimation } from './timing.js';
|
|
13
|
+
import { SpringAnimation } from './spring.js';
|
|
14
|
+
import { DecayAnimation } from './decay.js';
|
|
15
15
|
// A loop offloads to native only when the driver was asked for the native path AND
|
|
16
16
|
// the module is present; otherwise the JS-restart loop must run (a JS timing runs
|
|
17
17
|
// once, it does not loop itself).
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// DecayAnimation: ported from RN's animations/DecayAnimation.js, JS path only
|
|
2
|
-
//
|
|
1
|
+
// DecayAnimation: ported from RN's animations/DecayAnimation.js, JS path only.
|
|
2
|
+
// Models momentum bleeding off under friction: an initial velocity
|
|
3
3
|
// decays exponentially toward a resting value. Ends when consecutive frames
|
|
4
4
|
// move less than 0.1.
|
|
5
|
-
import { dlog } from '../../debug';
|
|
6
|
-
import { BaseAnimation } from './base';
|
|
7
|
-
import { cancelFrame, requestFrame } from './raf';
|
|
5
|
+
import { dlog } from '../../debug.js';
|
|
6
|
+
import { BaseAnimation } from './base.js';
|
|
7
|
+
import { cancelFrame, requestFrame } from './raf.js';
|
|
8
8
|
export class DecayAnimation extends BaseAnimation {
|
|
9
9
|
startTime = 0;
|
|
10
10
|
lastValue = 0;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// SpringAnimation: ported from RN's animations/SpringAnimation.js, JS path
|
|
2
|
-
// only
|
|
2
|
+
// only. Integrates the closed form of a damped harmonic oscillator
|
|
3
3
|
// each frame and rests once both velocity and displacement fall below their
|
|
4
4
|
// thresholds. A spring chained after a previous spring inherits its
|
|
5
5
|
// position/velocity/time (getInternalState) so retargeting mid-flight stays
|
|
6
6
|
// continuous. The native-config export is dropped.
|
|
7
|
-
import { dlog } from '../../debug';
|
|
8
|
-
import { BaseAnimation } from './base';
|
|
9
|
-
import { cancelFrame, clearTimer, requestFrame, setTimer } from './raf';
|
|
10
|
-
import { fromBouncinessAndSpeed, fromOrigamiTensionAndFriction } from './spring-config';
|
|
7
|
+
import { dlog } from '../../debug.js';
|
|
8
|
+
import { BaseAnimation } from './base.js';
|
|
9
|
+
import { cancelFrame, clearTimer, requestFrame, setTimer } from './raf.js';
|
|
10
|
+
import { fromBouncinessAndSpeed, fromOrigamiTensionAndFriction } from './spring-config.js';
|
|
11
11
|
function resolveStiffnessDampingMass(config) {
|
|
12
12
|
if (config.stiffness !== undefined || config.damping !== undefined || config.mass !== undefined) {
|
|
13
13
|
return {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// TimingAnimation: ported from RN's animations/TimingAnimation.js, JS path
|
|
2
|
-
// only
|
|
2
|
+
// only. Walks a value from `fromValue` to `toValue` over `duration`
|
|
3
3
|
// ms, shaping progress through an easing function. The native-frame export and
|
|
4
4
|
// __startAnimationIfNative branch are dropped.
|
|
5
|
-
import { Easing } from '../easing';
|
|
6
|
-
import { dlog } from '../../debug';
|
|
7
|
-
import { BaseAnimation } from './base';
|
|
8
|
-
import { cancelFrame, clearTimer, requestFrame, setTimer } from './raf';
|
|
5
|
+
import { Easing } from '../easing.js';
|
|
6
|
+
import { dlog } from '../../debug.js';
|
|
7
|
+
import { BaseAnimation } from './base.js';
|
|
8
|
+
import { cancelFrame, clearTimer, requestFrame, setTimer } from './raf.js';
|
|
9
9
|
let cachedEaseInOut;
|
|
10
10
|
function easeInOut() {
|
|
11
11
|
if (cachedEaseInOut === undefined) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// target changes, re-launches the animation toward the target's new value, so the
|
|
5
5
|
// value chases the target continuously (a spring following a gesture). Ported from
|
|
6
6
|
// RN's AnimatedTracking.js, JS path; native tracking re-uses the per-launch driver.
|
|
7
|
-
import { AnimatedNode } from '../graph';
|
|
7
|
+
import { AnimatedNode } from '../graph.js';
|
|
8
8
|
export class AnimatedTracking extends AnimatedNode {
|
|
9
9
|
value;
|
|
10
10
|
parent;
|
package/build/animated/color.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// AnimatedColor.js: the {r,g,b,a} and CSS-color input forms are supported; named
|
|
5
5
|
// colors and platform (Native) colors are deferred (they need RN's full
|
|
6
6
|
// normalizeColor / processColorObject, which live outside shared).
|
|
7
|
-
import { AnimatedWithChildren, flushValue } from './graph';
|
|
8
|
-
import { AnimatedValue } from './value';
|
|
7
|
+
import { AnimatedWithChildren, flushValue } from './graph.js';
|
|
8
|
+
import { AnimatedValue } from './value.js';
|
|
9
9
|
const DEFAULT_COLOR = { r: 0, g: 0, b: 0, a: 1 };
|
|
10
10
|
function isRgbaInput(value) {
|
|
11
11
|
return typeof value === 'object' && value !== null && 'r' in value && 'g' in value;
|
package/build/animated/easing.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Common easing functions, ported from React Native's Libraries/Animated/Easing.js.
|
|
2
2
|
// Pure math (the only dependency is the equally-pure bezier solver), so it lives
|
|
3
3
|
// unchanged in shared and every adapter re-exports it.
|
|
4
|
-
import { bezier } from './bezier';
|
|
4
|
+
import { bezier } from './bezier.js';
|
|
5
5
|
let cachedEase;
|
|
6
6
|
export const Easing = {
|
|
7
7
|
// A stepping function: 1 for any positive n, else 0.
|
package/build/animated/event.js
CHANGED
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
// - Native path: __attach(viewTag, eventName) mirrors each leaf value into native
|
|
14
14
|
// and registers the key path with the stock native module, so the event drives
|
|
15
15
|
// the view with zero JS per event.
|
|
16
|
-
import { dlog } from '../debug';
|
|
17
|
-
import { getNativeTag, whenCommitted } from '../commit';
|
|
18
|
-
import { isSymbioteNode } from '../node';
|
|
19
|
-
import { AnimatedNode, flushValue } from './graph';
|
|
20
|
-
import { isNativeAnimatedAvailable, nativeAnimated } from './native/native-animated';
|
|
16
|
+
import { dlog } from '../debug.js';
|
|
17
|
+
import { getNativeTag, whenCommitted } from '../commit.js';
|
|
18
|
+
import { isSymbioteNode } from '../node.js';
|
|
19
|
+
import { AnimatedNode, flushValue } from './graph.js';
|
|
20
|
+
import { isNativeAnimatedAvailable, nativeAnimated } from './native/native-animated.js';
|
|
21
21
|
function isRecord(value) {
|
|
22
22
|
return typeof value === 'object' && value !== null;
|
|
23
23
|
}
|
package/build/animated/graph.js
CHANGED
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
// sits ABOVE symbiote's shadow tree. Ported from React Native's AnimatedNode.js
|
|
3
3
|
// + AnimatedWithChildren.js, with every native-driver path
|
|
4
4
|
// (NativeAnimatedHelper / __isNative / __makeNative / __getNativeConfig) removed:
|
|
5
|
-
// this is
|
|
6
|
-
// hooks separately (ADR 0017).
|
|
5
|
+
// this is a JS-driven engine. A native driver re-introduces those hooks separately.
|
|
7
6
|
//
|
|
8
7
|
// Two phases drive an update:
|
|
9
8
|
// A) top-down: when a Value changes, walk children to the leaf nodes (the
|
|
10
9
|
// ones with an `update()` method) and flag them.
|
|
11
10
|
// B) bottom-up: each flagged leaf re-pulls its whole subtree via __getValue()
|
|
12
11
|
// to rebuild composite props (e.g. transform from many parents).
|
|
13
|
-
import { generateNativeNodeTag, nativeAnimated, } from './native/native-animated';
|
|
12
|
+
import { generateNativeNodeTag, nativeAnimated, } from './native/native-animated.js';
|
|
14
13
|
let nextListenerId = 1;
|
|
15
14
|
// Depth of the currently-active withSuspendedCallbacks blocks. While > 0, a
|
|
16
15
|
// composite setter (AnimatedColor.setValue) is driving several channels in a row;
|
|
@@ -28,7 +27,7 @@ export class AnimatedNode {
|
|
|
28
27
|
// _withSuspendedCallbacks, then fires once with the final value. Ported from RN's
|
|
29
28
|
// AnimatedColor._suspendCallbacks.
|
|
30
29
|
suspendCallbacks = 0;
|
|
31
|
-
// Native-driver state
|
|
30
|
+
// Native-driver state. Off until a useNativeDriver animation marks
|
|
32
31
|
// the graph native; `nativeTag` is the node's identity in the native module,
|
|
33
32
|
// allocated lazily on first reference (which also creates the native node).
|
|
34
33
|
isNative = false;
|
package/build/animated/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
// @symbiote-native/engine/animated: the framework-agnostic, JS-driven Animated engine
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
export { AnimatedNode, AnimatedWithChildren, flushValue } from './graph';
|
|
5
|
-
export { AnimatedValue } from './value';
|
|
6
|
-
export { AnimatedValueXY } from './value-xy';
|
|
7
|
-
export { AnimatedInterpolation } from './interpolation-node';
|
|
8
|
-
export { AnimatedAddition, AnimatedSubtraction, AnimatedMultiplication, AnimatedDivision, AnimatedModulo, AnimatedDiffClamp, add, subtract, multiply, divide, modulo, diffClamp, } from './operators';
|
|
9
|
-
export { AnimatedEvent, event, forkEvent, unforkEvent, attachNativeEvent, attachNativeEventHandler, } from './event';
|
|
10
|
-
export { AnimatedColor } from './color';
|
|
11
|
-
export { Easing } from './easing';
|
|
12
|
-
export { createNumericInterpolation, createInterpolation, checkValidRanges, } from './interpolation';
|
|
13
|
-
export { TimingAnimation } from './animations/timing';
|
|
14
|
-
export { SpringAnimation } from './animations/spring';
|
|
15
|
-
export { DecayAnimation } from './animations/decay';
|
|
16
|
-
export { AnimatedTracking } from './animations/tracking';
|
|
17
|
-
export { timing, spring, decay, parallel, sequence, stagger, loop, delay, } from './animations/composition';
|
|
18
|
-
// The native-driver bridge
|
|
1
|
+
// @symbiote-native/engine/animated: the framework-agnostic, JS-driven Animated engine.
|
|
2
|
+
// The value graph, easing, interpolation and drivers are pure JS with no React
|
|
3
|
+
// and no native dependency; every adapter re-exports them.
|
|
4
|
+
export { AnimatedNode, AnimatedWithChildren, flushValue } from './graph.js';
|
|
5
|
+
export { AnimatedValue } from './value.js';
|
|
6
|
+
export { AnimatedValueXY } from './value-xy.js';
|
|
7
|
+
export { AnimatedInterpolation } from './interpolation-node.js';
|
|
8
|
+
export { AnimatedAddition, AnimatedSubtraction, AnimatedMultiplication, AnimatedDivision, AnimatedModulo, AnimatedDiffClamp, add, subtract, multiply, divide, modulo, diffClamp, } from './operators.js';
|
|
9
|
+
export { AnimatedEvent, event, forkEvent, unforkEvent, attachNativeEvent, attachNativeEventHandler, } from './event.js';
|
|
10
|
+
export { AnimatedColor } from './color.js';
|
|
11
|
+
export { Easing } from './easing.js';
|
|
12
|
+
export { createNumericInterpolation, createInterpolation, checkValidRanges, } from './interpolation.js';
|
|
13
|
+
export { TimingAnimation } from './animations/timing.js';
|
|
14
|
+
export { SpringAnimation } from './animations/spring.js';
|
|
15
|
+
export { DecayAnimation } from './animations/decay.js';
|
|
16
|
+
export { AnimatedTracking } from './animations/tracking.js';
|
|
17
|
+
export { timing, spring, decay, parallel, sequence, stagger, loop, delay, } from './animations/composition.js';
|
|
18
|
+
// The native-driver bridge. Adapters need it to connect a props leaf to
|
|
19
19
|
// a host view tag and to restore default values on disconnect.
|
|
20
|
-
export { nativeAnimated, isNativeAnimatedAvailable, } from './native/native-animated';
|
|
20
|
+
export { nativeAnimated, isNativeAnimatedAvailable, } from './native/native-animated.js';
|
|
21
21
|
// The pure graph leaves and the mock, framework-agnostic (extend AnimatedWithChildren,
|
|
22
22
|
// no React/Vue). They live here with the rest of the graph; every adapter's
|
|
23
|
-
// createAnimatedComponent + Animated namespace re-exports them
|
|
24
|
-
export { AnimatedProps } from './props';
|
|
25
|
-
export { AnimatedStyle, AnimatedTransform } from './style';
|
|
26
|
-
export { AnimatedMock } from './mock';
|
|
23
|
+
// createAnimatedComponent + Animated namespace re-exports them.
|
|
24
|
+
export { AnimatedProps } from './props.js';
|
|
25
|
+
export { AnimatedStyle, AnimatedTransform } from './style.js';
|
|
26
|
+
export { AnimatedMock } from './mock.js';
|
|
27
27
|
// Framework-agnostic createAnimatedComponent helpers. Both adapters import them.
|
|
28
|
-
export { reduceProps, isAnimatedNode, readPassthroughStyle, resolveHostNode, } from './animated-component-shared';
|
|
28
|
+
export { reduceProps, isAnimatedNode, readPassthroughStyle, resolveHostNode, } from './animated-component-shared.js';
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// through an interpolation. Ported from RN's AnimatedInterpolation.js: numeric,
|
|
3
3
|
// string-with-units, and color output ranges (the value graph; native config
|
|
4
4
|
// removed). Platform (Native) colors stay out of scope, color.ts defers them.
|
|
5
|
-
import { AnimatedNode, AnimatedWithChildren } from './graph';
|
|
6
|
-
import { checkValidRanges, createInterpolation } from './interpolation';
|
|
5
|
+
import { AnimatedNode, AnimatedWithChildren } from './graph.js';
|
|
6
|
+
import { checkValidRanges, createInterpolation } from './interpolation.js';
|
|
7
7
|
export class AnimatedInterpolation extends AnimatedWithChildren {
|
|
8
8
|
parent;
|
|
9
9
|
config;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// extrapolation. A numeric output range stays number -> number; a string output
|
|
5
5
|
// range (values-with-units like '0deg' or colors like '#000') is interpolated
|
|
6
6
|
// per numeric token and reassembled. See createStringInterpolation below.
|
|
7
|
-
import { normalizeColor } from './color';
|
|
8
|
-
import { Easing } from './easing';
|
|
7
|
+
import { normalizeColor } from './color.js';
|
|
8
|
+
import { Easing } from './easing.js';
|
|
9
9
|
function interpolateSegment(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight) {
|
|
10
10
|
let result = input;
|
|
11
11
|
// Extrapolate below the range.
|
package/build/animated/mock.js
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
// users get the resting state without flake. The value graph, operators, easing,
|
|
7
7
|
// events and createAnimatedComponent are reused verbatim from the live engine.
|
|
8
8
|
// Only the driver factories (timing/spring/decay) and compositions are mocked.
|
|
9
|
-
import { AnimatedValue } from './value';
|
|
10
|
-
import { AnimatedValueXY } from './value-xy';
|
|
11
|
-
import { AnimatedColor } from './color';
|
|
12
|
-
import { AnimatedNode } from './graph';
|
|
13
|
-
import { Easing } from './easing';
|
|
14
|
-
import { add, subtract, multiply, divide, modulo, diffClamp } from './operators';
|
|
15
|
-
import { event, forkEvent, unforkEvent } from './event';
|
|
16
|
-
import { dlog } from '../debug';
|
|
9
|
+
import { AnimatedValue } from './value.js';
|
|
10
|
+
import { AnimatedValueXY } from './value-xy.js';
|
|
11
|
+
import { AnimatedColor } from './color.js';
|
|
12
|
+
import { AnimatedNode } from './graph.js';
|
|
13
|
+
import { Easing } from './easing.js';
|
|
14
|
+
import { add, subtract, multiply, divide, modulo, diffClamp } from './operators.js';
|
|
15
|
+
import { event, forkEvent, unforkEvent } from './event.js';
|
|
16
|
+
import { dlog } from '../debug.js';
|
|
17
17
|
// Prevent a callback invocation from recursively triggering another callback,
|
|
18
18
|
// which may trigger another animation (RN's AnimatedMock.js:36-60).
|
|
19
19
|
let inAnimationCallback = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The native-driver bridge
|
|
1
|
+
// The native-driver bridge. When an animation runs with
|
|
2
2
|
// useNativeDriver:true, the whole value graph is mirrored into native "animated
|
|
3
3
|
// nodes" and the curve is handed to the stock NativeAnimated TurboModule, which
|
|
4
4
|
// then mutates the bound shadow node every frame with ZERO JS per frame.
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
// We consume the module that ships in stock react-native, no native fork. On
|
|
7
7
|
// iOS bridgeless it registers as `NativeAnimatedTurboModule`; we fall back to the
|
|
8
8
|
// legacy `NativeAnimatedModule` name. Resolution goes through the same JSI seam as
|
|
9
|
-
// every other native module (getNativeModule)
|
|
9
|
+
// every other native module (getNativeModule). The
|
|
10
10
|
// module is resolved lazily on first use, so importing this file headless (no
|
|
11
11
|
// native host) is inert until a native-driven animation actually starts.
|
|
12
|
-
import { dlog } from '../../debug';
|
|
13
|
-
import { getNativeModule } from '../../native-modules';
|
|
14
|
-
import { NativeEventEmitter } from '../../native-events';
|
|
12
|
+
import { dlog } from '../../debug.js';
|
|
13
|
+
import { getNativeModule } from '../../native-modules.js';
|
|
14
|
+
import { NativeEventEmitter } from '../../native-events.js';
|
|
15
15
|
// iOS bridgeless registers the Turbo variant; the legacy name is the fallback.
|
|
16
16
|
const TURBO_MODULE_NAME = 'NativeAnimatedTurboModule';
|
|
17
17
|
const LEGACY_MODULE_NAME = 'NativeAnimatedModule';
|
|
@@ -29,7 +29,7 @@ function module() {
|
|
|
29
29
|
}
|
|
30
30
|
// True when the stock native module is present in the binary: the gate the
|
|
31
31
|
// drivers consult before honouring useNativeDriver:true (else they fall back to
|
|
32
|
-
// the JS-driven path
|
|
32
|
+
// the JS-driven path).
|
|
33
33
|
export function isNativeAnimatedAvailable() {
|
|
34
34
|
return module() !== null;
|
|
35
35
|
}
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
// separately and wired by registering this node as a child of each input at
|
|
9
9
|
// __attach (input.__addChild(this)). __getNativeConfig is creation-only: it reads
|
|
10
10
|
// each input's native tag (creating the input node) but issues no connect.
|
|
11
|
-
import { AnimatedNode, AnimatedWithChildren } from './graph';
|
|
12
|
-
import { AnimatedValue } from './value';
|
|
13
|
-
import { AnimatedInterpolation } from './interpolation-node';
|
|
14
|
-
import { dlog } from '../debug';
|
|
11
|
+
import { AnimatedNode, AnimatedWithChildren } from './graph.js';
|
|
12
|
+
import { AnimatedValue } from './value.js';
|
|
13
|
+
import { AnimatedInterpolation } from './interpolation-node.js';
|
|
14
|
+
import { dlog } from '../debug.js';
|
|
15
15
|
// Wrap a bare number in an AnimatedValue so every input is a graph node.
|
|
16
16
|
function toNode(input) {
|
|
17
17
|
return typeof input === 'number' ? new AnimatedValue(input) : input;
|
package/build/animated/props.js
CHANGED
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
// flushes to this leaf via its `update()` method, which re-pulls the current values
|
|
6
6
|
// into a flat partial and pushes it through shared's scoped setNativeProps: one
|
|
7
7
|
// targeted clone-on-write commit. Ported from RN's AnimatedProps.js, JS-driven path
|
|
8
|
-
// only: native config (__makeNative / __getNativeConfig / connectAnimatedNodeToView
|
|
9
|
-
//
|
|
8
|
+
// only: native config (__makeNative / __getNativeConfig / connectAnimatedNodeToView)
|
|
9
|
+
// is stripped.
|
|
10
10
|
//
|
|
11
11
|
// `update` MUST be a method, not a class field: flushValue detects a leaf by reading
|
|
12
12
|
// a `update` function off the node, and under useDefineForClassFields a field
|
|
13
13
|
// initialiser would shadow it and break subclassing. (See shared graph.ts leafUpdate.)
|
|
14
|
-
import { AnimatedNode, AnimatedWithChildren } from './graph';
|
|
15
|
-
import { setNativeProps, getNativeTag } from '../commit';
|
|
16
|
-
import { isSymbioteNode } from '../node';
|
|
17
|
-
import { registerPostCommit } from '../post-commit';
|
|
18
|
-
import { nativeAnimated } from './native/native-animated';
|
|
19
|
-
import { AnimatedStyle } from './style';
|
|
14
|
+
import { AnimatedNode, AnimatedWithChildren } from './graph.js';
|
|
15
|
+
import { setNativeProps, getNativeTag } from '../commit.js';
|
|
16
|
+
import { isSymbioteNode } from '../node.js';
|
|
17
|
+
import { registerPostCommit } from '../post-commit.js';
|
|
18
|
+
import { nativeAnimated } from './native/native-animated.js';
|
|
19
|
+
import { AnimatedStyle } from './style.js';
|
|
20
20
|
function isAnimatedNode(value) {
|
|
21
21
|
return value instanceof AnimatedNode;
|
|
22
22
|
}
|
|
@@ -73,7 +73,7 @@ export class AnimatedProps extends AnimatedWithChildren {
|
|
|
73
73
|
// base component's public instance via setNativeView.
|
|
74
74
|
target = null;
|
|
75
75
|
// The Fabric view tag this leaf is bound to natively (null until connected).
|
|
76
|
-
// Kept so __detach can disconnect exactly what it connected
|
|
76
|
+
// Kept so __detach can disconnect exactly what it connected.
|
|
77
77
|
connectedViewTag = null;
|
|
78
78
|
constructor(inputProps) {
|
|
79
79
|
super();
|
|
@@ -139,7 +139,7 @@ export class AnimatedProps extends AnimatedWithChildren {
|
|
|
139
139
|
this.target = null;
|
|
140
140
|
super.__detach();
|
|
141
141
|
}
|
|
142
|
-
// ---- native driver
|
|
142
|
+
// ---- native driver -------------------------------------------------------
|
|
143
143
|
// Marking the leaf native binds it to the host view. The value->...->props edges
|
|
144
144
|
// are wired by the upstream walk (AnimatedWithChildren.__makeNative); the one
|
|
145
145
|
// thing only the leaf can do is attach the props node to a real view tag.
|