@rootnative/inertia-svg 0.0.0-alpha.2 → 0.0.0-alpha.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/README.md +44 -3
  3. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -6,11 +6,24 @@ This package ships in lockstep with `@rootnative/inertia` — version numbers tr
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.0.0-alpha.2] - 2026-07-20
10
+
11
+ ### Added
12
+
13
+ - **`createMotionSvgComponent(Component, config)` factory** — wraps any `react-native-svg` element with the same `initial` / `animate` / `transition` surface as `MotionPath`. Config declares the animatable surface: `animatableProps` (numeric), `colorProps` (color strings), and `arrayProps` (numeric arrays, element-wise with the array length locked at mount — the same rule `MotionPath` applies to path commands). Per-key engagement is locked at mount; `transition` accepts named transitions from the nearest `<MotionConfig transitions>`, both top-level and per-property.
14
+ - **Prebuilt `MotionCircle` / `MotionRect` / `MotionLine`** shapes built on the factory, also reachable as `MotionSvg.Circle` / `.Rect` / `.Line`. `MotionCircle` animates `cx` / `cy` / `r` / `strokeWidth` / opacities / `strokeDashoffset` plus `fill` / `stroke`, and `strokeDasharray` element-wise — the progress-ring shape (`strokeDasharray` circumference + animated `strokeDashoffset`) works without any direct Reanimated imports.
15
+
16
+ ## [0.0.0-alpha.1] - 2026-07-19
17
+
18
+ Lockstep version bump alongside `@rootnative/inertia@0.0.0-alpha.1` (README / `llms.txt` updates only; no runtime changes).
19
+
9
20
  ## [0.0.0-alpha.0]
10
21
 
11
22
  ### Added
12
23
 
13
24
  - `MotionPath` over `react-native-svg`. Animatable: `d` (element-wise scalar interpolation on structurally-compatible paths), `fill`, `stroke`, `strokeWidth`, opacities, `strokeDashoffset`. Source and target paths must share the same command sequence after implicit-repeat expansion; remount with `key` to switch shape.
14
25
 
15
- [unreleased]: https://github.com/rootnative/inertia/compare/v0.0.0-alpha.0...HEAD
26
+ [unreleased]: https://github.com/rootnative/inertia/compare/core+gestures+gradients+svg@0.0.0-alpha.2...HEAD
27
+ [0.0.0-alpha.2]: https://github.com/rootnative/inertia/releases/tag/core+gestures+gradients+svg@0.0.0-alpha.2
28
+ [0.0.0-alpha.1]: https://github.com/rootnative/inertia/releases/tag/core+gestures+gradients+svg@0.0.0-alpha.1
16
29
  [0.0.0-alpha.0]: https://github.com/rootnative/inertia/releases/tag/v0.0.0-alpha.0
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Animatable SVG primitives for [`@rootnative/inertia`](../core), built on [`react-native-svg`](https://github.com/software-mansion/react-native-svg).
7
7
 
8
- `MotionPath` accepts the same `initial` / `animate` / `transition` shape as the core `Motion.*` primitives, with animatable keys for the path data (`d`), color paint (`fill`, `stroke`), and numeric paint (`strokeWidth`, opacities, `strokeDashoffset`).
8
+ `MotionPath` accepts the same `initial` / `animate` / `transition` shape as the core `Motion.*` primitives, with animatable keys for the path data (`d`), color paint (`fill`, `stroke`), and numeric paint (`strokeWidth`, opacities, `strokeDashoffset`). Prebuilt `MotionCircle` / `MotionRect` / `MotionLine` cover the other common shapes, and the `createMotionSvgComponent` factory behind them wraps any `react-native-svg` element. Everything is also reachable through the `MotionSvg` namespace (`MotionSvg.Path` / `.Circle` / `.Rect` / `.Line`).
9
9
 
10
10
  ## Install
11
11
 
@@ -81,13 +81,54 @@ In dev, the component throws on template mismatches at mount, when `animate.d` c
81
81
 
82
82
  Path resampling between structurally different shapes (flubber-style) is out of scope for v0.2. For arbitrary shape swaps, remount with `key={...}`.
83
83
 
84
+ ## Shapes — MotionCircle, MotionRect, MotionLine
85
+
86
+ Prebuilt geometry primitives with the same `initial` / `animate` / `transition` surface. Each animates its numeric geometry props (`cx` / `cy` / `r`, `x` / `y` / `width` / `height` / `rx` / `ry`, `x1` / `y1` / `x2` / `y2`), the `fill` / `stroke` paints (`stroke` only for `MotionLine`), opacities, `strokeDashoffset` — and `strokeDasharray` element-wise, with the array length locked at mount (the same rule `MotionPath` applies to path commands). The canonical consumer is a circular progress ring:
87
+
88
+ ```tsx
89
+ import Svg from 'react-native-svg'
90
+ import { MotionCircle } from '@rootnative/inertia-svg'
91
+
92
+ const CIRCUMFERENCE = 2 * Math.PI * 40
93
+
94
+ <Svg viewBox="0 0 100 100" width={96} height={96}>
95
+ <MotionCircle
96
+ cx={50}
97
+ cy={50}
98
+ r={40}
99
+ fill="none"
100
+ stroke="#4f46e5"
101
+ strokeWidth={8}
102
+ strokeDasharray={[CIRCUMFERENCE]}
103
+ animate={{ strokeDashoffset: CIRCUMFERENCE * (1 - progress) }}
104
+ transition={{ type: 'timing', duration: 250 }}
105
+ />
106
+ </Svg>
107
+ ```
108
+
109
+ ## createMotionSvgComponent
110
+
111
+ The factory behind the prebuilt shapes — wraps any other `react-native-svg` element:
112
+
113
+ ```tsx
114
+ import { Ellipse } from 'react-native-svg'
115
+ import { createMotionSvgComponent } from '@rootnative/inertia-svg'
116
+
117
+ const MotionEllipse = createMotionSvgComponent(Ellipse, {
118
+ animatableProps: ['cx', 'cy', 'rx', 'ry', 'strokeWidth', 'opacity'],
119
+ colorProps: ['fill', 'stroke'],
120
+ arrayProps: ['strokeDasharray'],
121
+ })
122
+ ```
123
+
124
+ `animatableProps` are numeric, `colorProps` are color strings, `arrayProps` are numeric arrays (element-wise, length locked at mount). `transition` accepts named transitions from the nearest `<MotionConfig transitions>`, top-level and per-property.
125
+
84
126
  ## Reduced motion
85
127
 
86
- `MotionPath` participates in `<MotionConfig reducedMotion>` just like the core primitives — when the OS reduce-motion setting is on (or you pass `reducedMotion="always"`), every animated property snaps directly to its target.
128
+ All primitives participate in `<MotionConfig reducedMotion>` just like the core ones — when the OS reduce-motion setting is on (or you pass `reducedMotion="always"`), every animated property snaps directly to its target.
87
129
 
88
130
  ## What this package doesn't do (v0.2)
89
131
 
90
- - Other SVG shapes (`Circle`, `Rect`, `Line`, `Ellipse`) — land in a follow-up once the `MotionPath` API is validated.
91
132
  - Path resampling between arbitrary shapes.
92
133
  - Morphing an `L` into a `C` (or other across-command interpolation). Element-wise scalar interpolation is intentional.
93
134
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootnative/inertia-svg",
3
- "version": "0.0.0-alpha.2",
3
+ "version": "0.0.0-alpha.3",
4
4
  "description": "Animatable SVG primitives (path morphing, fill/stroke) for @rootnative/inertia, built on react-native-svg.",
5
5
  "license": "MIT",
6
6
  "author": "RootNative",
@@ -50,7 +50,7 @@
50
50
  "!**/*.test.*"
51
51
  ],
52
52
  "peerDependencies": {
53
- "@rootnative/inertia": ">=0.0.0-alpha.2",
53
+ "@rootnative/inertia": ">=0.0.0-alpha.3",
54
54
  "react": ">=19.0.0",
55
55
  "react-native": ">=0.81.0",
56
56
  "react-native-reanimated": ">=4.0.0",
@@ -69,7 +69,7 @@
69
69
  "react-test-renderer": "19.1.0",
70
70
  "tsup": "^8.3.5",
71
71
  "typescript": "^5.7.3",
72
- "@rootnative/inertia": "0.0.0-alpha.2"
72
+ "@rootnative/inertia": "0.0.0-alpha.3"
73
73
  },
74
74
  "publishConfig": {
75
75
  "access": "public"