@sigx/lynx-motion 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +6 -12
  2. package/package.json +11 -8
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @sigx/lynx-motion
2
2
 
3
- Spring and tween animation drivers for [SignalX](https://github.com/signalxjs) on Lynx, built directly on `SharedValue` from [`@sigx/lynx`](../lynx). One customer of the cross-thread bridge alongside gestures and scroll.
3
+ Spring and tween animation drivers for [SignalX](https://github.com/signalxjs) on Lynx, built directly on `SharedValue` from [`@sigx/lynx`](https://github.com/signalxjs/lynx/tree/main/packages/lynx). One customer of the cross-thread bridge alongside gestures and scroll.
4
4
 
5
- The differentiator: animation progress is **observable from the background thread** for free. Mutate a `SharedValue` on MT via `withSpring(sv, target)` — the existing diff/publish bridge ships every frame to a BG-side sigx `signal`, so `effect(() => sv.value)` re-runs reactively. Neither `framer-motion` nor `@lynx-js/motion` offers this today; their value primitives are MT-only.
5
+ The differentiator: animation progress is **observable from the background thread** for free. Mutate a `SharedValue` on MT via `withSpring(sv, target)` — the existing diff/publish bridge ships every frame to a BG-side sigx `signal`, so `effect(() => sv.value)` re-runs reactively.
6
6
 
7
7
  ## Installation
8
8
 
@@ -48,7 +48,7 @@ const App = component(() => {
48
48
  });
49
49
  ```
50
50
 
51
- `useAnimatedStyle(elRef, sv, 'translateX')` is required for the bound element to actually move — `withSpring` only writes the SharedValue; the style binding registry (Phase 2.5) is what applies the transform.
51
+ `useAnimatedStyle(elRef, sv, 'translateX')` is required for the bound element to actually move — `withSpring` only writes the SharedValue; the style binding registry is what applies the transform.
52
52
 
53
53
  ## API
54
54
 
@@ -148,7 +148,7 @@ Underneath `animate()`. Exposed for advanced use (driving non-SharedValue values
148
148
 
149
149
  Built-in: `linear`, `easeIn`, `easeOut`, `easeInOut`, `circIn`, `circOut`, `circInOut`, `backIn`, `backOut`, `backInOut`, `anticipate`. Plus `cubicBezier(x1, y1, x2, y2)` and the `mirrorEasing` / `reverseEasing` modifiers.
150
150
 
151
- Tween animations always use the built-in `easeOut`. Custom easing functions can't be passed directly: function references don't survive the worklet `_c` capture across the MT/BG bridge — they'd arrive on MT as `undefined`. If you need a non-built-in curve, either pick a different built-in or wait for `registerEasing(name, fn)` (filed as a follow-up in `NEXT-STEPS.md`).
151
+ Tween animations always use the built-in `easeOut`. Custom easing functions can't be passed directly: function references don't survive the worklet `_c` capture across the MT/BG bridge — they'd arrive on MT as `undefined`. If you need a non-built-in curve, pick a different built-in.
152
152
 
153
153
  ## Cancellation behavior
154
154
 
@@ -165,17 +165,11 @@ Animations tick via `requestAnimationFrame`. Lynx's worklet runtime installs `gl
165
165
  - **Scalar `SharedValue<number>` only** for v0.1. 2D values (`{x, y}`) need parallel `animate()` calls (one per axis) for now.
166
166
  - **No velocity-carry across animations.** When a new `animate()` cancels an in-flight one, the new one starts at velocity 0. Motion's `MotionValue` tracks velocity to support seamless gesture-to-spring handoff; sigx's `SharedValue` doesn't yet (would require extending `SharedValueState<T>` from `{ value }` to `{ value, velocity }`). Add iff a real use case needs it.
167
167
  - **No duration→physics resolution** (motion's `findSpring`). Spring options are physics-only (stiffness/damping/mass). `{ duration, bounce }` not supported. Add iff users want it.
168
- - **No keyframes / sequences / stagger.** Spring + tween cover gesture-driven UI. The richer orchestration surface (variants, layout, presence, scroll-driven) lives in upstream `@lynx-js/motion` if you need it.
169
-
170
- ## Why we ported instead of using upstream
171
-
172
- `@lynx-js/motion` ships two entry points: `.` (full, ~200 LOC of thin wrappers around `framer-motion` + `motion-dom`) and `./mini` (lean, ~250 LOC self-contained). Phase 2.6 spiked hosting motion-mini directly on top of sigx via a shim and reverted because the bring-up required eight cumulative pipeline concessions, two with silent-fragility risk (semantic-approximation `useEffect`/`useMemo` shims and an rspack `sideEffects` override of motion's metadata).
173
-
174
- Porting motion-mini's algorithmic content (spring solver, easings, animate orchestration — ~250 LOC of Apache-2.0 math) was the cleaner path: faithful semantics we own, a sigx-shaped API, and the BG-observable `SharedValue` integration becomes first-class. See `PHASE-2.6-LAYERING-PLAN.md` "What we tried and reverted" for the spike write-up and `PHASE-2.7-MOTION-PLAN.md` "Why mini, not full motion" for the design rationale.
168
+ - **No keyframes / sequences / stagger.** Spring + tween cover gesture-driven UI today.
175
169
 
176
170
  ## Attribution
177
171
 
178
- Spring solver and easing functions are ported from [`@lynx-js/motion`](https://github.com/lynx-family/lynx-stack/tree/main/packages/motion) v0.0.3, [`motion-dom`](https://github.com/motiondivision/motion/tree/main/packages/motion-dom) v12.23.12, and [`motion-utils`](https://github.com/motiondivision/motion/tree/main/packages/motion-utils) v12.23.6 — all Apache-2.0. The cubic bezier code is in turn modified from Gaëtan Renaudeau's [`bezier-easing`](https://github.com/gre/bezier-easing) (MIT). Full attribution in [`THIRD_PARTY_NOTICES.md`](../../THIRD_PARTY_NOTICES.md).
172
+ Spring solver and easing functions are ported from [`@lynx-js/motion`](https://github.com/lynx-family/lynx-stack/tree/main/packages/motion) v0.0.3, [`motion-dom`](https://github.com/motiondivision/motion/tree/main/packages/motion-dom) v12.23.12, and [`motion-utils`](https://github.com/motiondivision/motion/tree/main/packages/motion-utils) v12.23.6 — all Apache-2.0. The cubic bezier code is in turn modified from Gaëtan Renaudeau's [`bezier-easing`](https://github.com/gre/bezier-easing) (MIT).
179
173
 
180
174
  ## License
181
175
 
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@sigx/lynx-motion",
3
- "version": "0.1.0",
4
- "description": "Animation primitives for sigx-lynx — spring/tween drivers built on AnimatedValue",
3
+ "version": "0.1.2",
4
+ "description": "Animation primitives for sigx-lynx — spring/tween drivers built on SharedValue",
5
5
  "type": "module",
6
- "main": "./src/index.ts",
7
- "types": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
8
  "exports": {
9
- ".": "./src/index.ts"
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
10
13
  },
11
14
  "files": [
12
15
  "src",
@@ -21,7 +24,7 @@
21
24
  "motion"
22
25
  ],
23
26
  "author": "Andreas Ekdahl",
24
- "license": "MIT",
27
+ "license": "(MIT AND Apache-2.0)",
25
28
  "dependencies": {
26
29
  "@sigx/lynx": "^0.1.4"
27
30
  },
@@ -29,8 +32,8 @@
29
32
  "@lynx-js/react": "^0.119.0",
30
33
  "typescript": "^6.0.3",
31
34
  "vite": "^8.0.12",
32
- "@sigx/lynx-plugin": "^0.2.7",
33
- "@sigx/lynx-runtime-main": "^0.2.7"
35
+ "@sigx/lynx-runtime-main": "^0.2.7",
36
+ "@sigx/lynx-plugin": "^0.2.7"
34
37
  },
35
38
  "repository": {
36
39
  "type": "git",