@rootnative/core 0.0.0-alpha.0 → 0.0.0-alpha.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/README.md CHANGED
@@ -178,7 +178,9 @@ const columns = useBreakpointValue({ compact: 1, medium: 2, expanded: 4 })
178
178
 
179
179
  ## Docs
180
180
 
181
- https://rootnative.github.io/ui/
181
+ Full docs: https://rootnative.github.io/ui/
182
+
183
+ LLM-optimized reference: https://rootnative.github.io/ui/llms-full.txt — or read `node_modules/@rootnative/core/llms.txt` for the exact installed version.
182
184
 
183
185
  ## License
184
186
 
@@ -293,7 +293,9 @@ var lightTheme = {
293
293
  easingStandardDecelerate: "cubic-bezier(0, 0, 0, 1)",
294
294
  easingEmphasized: "cubic-bezier(0.2, 0, 0, 1)",
295
295
  easingEmphasizedAccelerate: "cubic-bezier(0.3, 0, 0.8, 0.15)",
296
- easingEmphasizedDecelerate: "cubic-bezier(0.05, 0.7, 0.1, 1)"
296
+ easingEmphasizedDecelerate: "cubic-bezier(0.05, 0.7, 0.1, 1)",
297
+ springFastSpatial: { tension: 380, friction: 33, mass: 1 },
298
+ springDefaultSpatial: { tension: 380, friction: 26, mass: 1 }
297
299
  }
298
300
  };
299
301
 
@@ -1,4 +1,4 @@
1
- import { T as Theme } from '../types-GiXhVyob.mjs';
1
+ import { T as Theme } from '../types-xq2X5AuN.mjs';
2
2
 
3
3
  /**
4
4
  * MD3 scheme variant. Each is a spec-defined recipe for deriving the palette
@@ -3,7 +3,7 @@ import {
3
3
  defaultTopAppBarTokens,
4
4
  defaultTypography,
5
5
  lightTheme
6
- } from "../chunk-DC35U5WG.mjs";
6
+ } from "../chunk-67NS34RT.mjs";
7
7
 
8
8
  // src/theme/createMaterialTheme.ts
9
9
  import {
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
- import { T as Theme, a as TopAppBarTokens, B as BaseTheme, S as Shape } from './types-GiXhVyob.mjs';
2
- export { C as Colors, E as Elevation, b as ElevationLevel, F as FontWeight, M as MaterialTheme, c as Motion, d as ShadowOffset, e as Spacing, f as StateLayer, g as TextStyle, h as Typography } from './types-GiXhVyob.mjs';
1
+ import { T as Theme, a as TopAppBarTokens, B as BaseTheme, M as Motion, S as Shape } from './types-xq2X5AuN.mjs';
2
+ export { C as Colors, E as Elevation, b as ElevationLevel, F as FontWeight, c as MaterialTheme, d as MotionSpring, e as ShadowOffset, f as Spacing, g as StateLayer, h as TextStyle, i as Typography } from './types-xq2X5AuN.mjs';
3
+ import { TransitionConfig, NamedTransitions } from '@rootnative/inertia';
3
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
  import * as React from 'react';
5
6
 
@@ -26,6 +27,29 @@ declare const defaultTopAppBarTokens: TopAppBarTokens;
26
27
  */
27
28
  declare function defineTheme<T extends BaseTheme>(theme: T): T;
28
29
 
30
+ declare module '@rootnative/inertia' {
31
+ interface RegisteredTransitions {
32
+ 'state-hover': TransitionConfig;
33
+ 'state-press': TransitionConfig;
34
+ 'state-focus': TransitionConfig;
35
+ 'spring-fast-spatial': TransitionConfig;
36
+ 'spring-default-spatial': TransitionConfig;
37
+ }
38
+ }
39
+ /**
40
+ * Map a theme's motion tokens into inertia's named-transition registry.
41
+ * `ThemeProvider` feeds the result to `<MotionConfig transitions>`, making
42
+ * `theme.motion.*` the single source of truth components (and consumers)
43
+ * reference by name instead of hand-rolling `withTiming`/`withSpring`
44
+ * configs.
45
+ *
46
+ * The state-layer names encode the library's interaction timing policy —
47
+ * hover `durationShort3` (150ms), press `durationShort2` (100ms), focus
48
+ * `durationShort4` (200ms), all on the standard easing curve. The spring
49
+ * names expose the theme's `MotionSpring` tokens verbatim.
50
+ */
51
+ declare function motionTransitions(motion: Motion): NamedTransitions;
52
+
29
53
  /**
30
54
  * Scales the intermediate corner radius tokens by a `roundness` multiplier.
31
55
  * `cornerNone` always stays `0` and `cornerFull` always stays `999`.
@@ -183,4 +207,4 @@ declare const material: {
183
207
  readonly defaultTopAppBarTokens: TopAppBarTokens;
184
208
  };
185
209
 
186
- export { BaseTheme, type Breakpoint, type BreakpointValues, type IconRenderProps, type IconResolver, IconResolverContext, Shape, Theme, ThemeProvider, type ThemeProviderProps, TopAppBarTokens, applyRoundness, breakpoints, darkTheme, defaultTopAppBarTokens, defineTheme, lightTheme, material, useBreakpoint, useBreakpointValue, useIconResolver, useTheme };
210
+ export { BaseTheme, type Breakpoint, type BreakpointValues, type IconRenderProps, type IconResolver, IconResolverContext, Motion, Shape, Theme, ThemeProvider, type ThemeProviderProps, TopAppBarTokens, applyRoundness, breakpoints, darkTheme, defaultTopAppBarTokens, defineTheme, lightTheme, material, motionTransitions, useBreakpoint, useBreakpointValue, useIconResolver, useTheme };
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  defaultTopAppBarTokens,
4
4
  defaultTypography,
5
5
  lightTheme
6
- } from "./chunk-DC35U5WG.mjs";
6
+ } from "./chunk-67NS34RT.mjs";
7
7
 
8
8
  // src/theme/dark.ts
9
9
  var darkTheme = {
@@ -170,7 +170,9 @@ var darkTheme = {
170
170
  easingStandardDecelerate: "cubic-bezier(0, 0, 0, 1)",
171
171
  easingEmphasized: "cubic-bezier(0.2, 0, 0, 1)",
172
172
  easingEmphasizedAccelerate: "cubic-bezier(0.3, 0, 0.8, 0.15)",
173
- easingEmphasizedDecelerate: "cubic-bezier(0.05, 0.7, 0.1, 1)"
173
+ easingEmphasizedDecelerate: "cubic-bezier(0.05, 0.7, 0.1, 1)",
174
+ springFastSpatial: { tension: 380, friction: 33, mass: 1 },
175
+ springDefaultSpatial: { tension: 380, friction: 26, mass: 1 }
174
176
  }
175
177
  };
176
178
 
@@ -179,6 +181,40 @@ function defineTheme(theme) {
179
181
  return theme;
180
182
  }
181
183
 
184
+ // src/theme/motionAdapter.ts
185
+ import {
186
+ cubicBezier
187
+ } from "@rootnative/inertia";
188
+ function motionTransitions(motion) {
189
+ const standard = cubicBezier(motion.easingStandard);
190
+ return {
191
+ "state-hover": {
192
+ type: "timing",
193
+ duration: motion.durationShort3,
194
+ easing: standard
195
+ },
196
+ "state-press": {
197
+ type: "timing",
198
+ duration: motion.durationShort2,
199
+ easing: standard
200
+ },
201
+ "state-focus": {
202
+ type: "timing",
203
+ duration: motion.durationShort4,
204
+ easing: standard
205
+ },
206
+ "spring-fast-spatial": { type: "spring", ...motion.springFastSpatial },
207
+ "spring-default-spatial": {
208
+ type: "spring",
209
+ ...motion.springDefaultSpatial
210
+ }
211
+ };
212
+ }
213
+
214
+ // src/provider/ThemeProvider.tsx
215
+ import { MotionConfig } from "@rootnative/inertia";
216
+ import * as React3 from "react";
217
+
182
218
  // src/provider/IconResolverContext.ts
183
219
  import * as React from "react";
184
220
  var IconResolverContext = React.createContext(
@@ -196,7 +232,12 @@ function ThemeProvider({
196
232
  iconResolver,
197
233
  children
198
234
  }) {
199
- return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: theme != null ? theme : lightTheme, children: /* @__PURE__ */ jsx(IconResolverContext.Provider, { value: iconResolver != null ? iconResolver : null, children }) });
235
+ const resolvedTheme = theme != null ? theme : lightTheme;
236
+ const transitions = React3.useMemo(
237
+ () => motionTransitions(resolvedTheme.motion),
238
+ [resolvedTheme.motion]
239
+ );
240
+ return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: resolvedTheme, children: /* @__PURE__ */ jsx(IconResolverContext.Provider, { value: iconResolver != null ? iconResolver : null, children: /* @__PURE__ */ jsx(MotionConfig, { transitions, children }) }) });
200
241
  }
201
242
 
202
243
  // src/provider/useTheme.ts
@@ -266,6 +307,7 @@ export {
266
307
  defineTheme,
267
308
  lightTheme,
268
309
  material,
310
+ motionTransitions,
269
311
  useBreakpoint,
270
312
  useBreakpointValue,
271
313
  useIconResolver,
@@ -179,6 +179,17 @@ interface ShadowOffset {
179
179
  width: number;
180
180
  height: number;
181
181
  }
182
+ /**
183
+ * Physics config for spring-driven transitions. Uses the react-spring
184
+ * vocabulary (`tension`/`friction`/`mass`) — the same surface
185
+ * `@rootnative/inertia` springs accept, mapped 1:1 onto Reanimated's
186
+ * `stiffness`/`damping`/`mass`.
187
+ */
188
+ interface MotionSpring {
189
+ tension: number;
190
+ friction: number;
191
+ mass: number;
192
+ }
182
193
  /** Duration (in ms) and easing tokens for animations following MD3 motion guidelines. */
183
194
  interface Motion {
184
195
  durationShort1: number;
@@ -204,6 +215,18 @@ interface Motion {
204
215
  easingEmphasized: string;
205
216
  easingEmphasizedAccelerate: string;
206
217
  easingEmphasizedDecelerate: string;
218
+ /**
219
+ * Spring for fast spatial transitions — selection morphs that track user
220
+ * input snappily (Switch thumb, Slider press-grow). Slight overshoot,
221
+ * ~0.85 damping ratio. Named after the MD3 Expressive motion-physics token
222
+ * scheme (fast/default/slow × spatial/effects).
223
+ */
224
+ springFastSpatial: MotionSpring;
225
+ /**
226
+ * Spring for default spatial transitions — selection morphs with a softer,
227
+ * bouncier settle (Checkbox and Radio marks).
228
+ */
229
+ springDefaultSpatial: MotionSpring;
207
230
  }
208
231
 
209
- export type { BaseTheme as B, Colors as C, Elevation as E, FontWeight as F, MaterialTheme as M, Shape as S, Theme as T, TopAppBarTokens as a, ElevationLevel as b, Motion as c, ShadowOffset as d, Spacing as e, StateLayer as f, TextStyle as g, Typography as h };
232
+ export type { BaseTheme as B, Colors as C, Elevation as E, FontWeight as F, Motion as M, Shape as S, Theme as T, TopAppBarTokens as a, ElevationLevel as b, MaterialTheme as c, MotionSpring as d, ShadowOffset as e, Spacing as f, StateLayer as g, TextStyle as h, Typography as i };
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # @rootnative/core — Theme System for React Native
2
2
 
3
- > Version: 0.0.0-alpha.0
3
+ > Version: 0.0.0-alpha.2
4
4
  > Peer deps: react >=18, react-native >=0.72
5
5
  > Optional: @material/material-color-utilities >=0.4.0 (for createMaterialTheme)
6
6
 
@@ -194,7 +194,7 @@ BaseTheme {
194
194
  spacing: Spacing — xs, sm, md, lg, xl
195
195
  elevation: Elevation — level0..level3 (shadow properties)
196
196
  stateLayer: StateLayer — pressedOpacity, focusedOpacity, hoveredOpacity, disabledOpacity
197
- motion: Motion — duration and easing tokens
197
+ motion: Motion — duration, easing, and spring tokens
198
198
  }
199
199
 
200
200
  Theme extends BaseTheme {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootnative/core",
3
- "version": "0.0.0-alpha.0",
3
+ "version": "0.0.0-alpha.2",
4
4
  "description": "Design-system agnostic theme engine for RootNative UI — a React Native component library. Ships with Material Design 3 out of the box.",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -10,6 +10,7 @@
10
10
  "react-native": "dist/index.mjs",
11
11
  "source": "src/index.ts",
12
12
  "exports": {
13
+ "./package.json": "./package.json",
13
14
  ".": {
14
15
  "types": "./dist/index.d.mts",
15
16
  "react-native": "./dist/index.mjs",
@@ -53,6 +54,7 @@
53
54
  ],
54
55
  "peerDependencies": {
55
56
  "@material/material-color-utilities": ">=0.4.0",
57
+ "@rootnative/inertia": ">=0.0.0-alpha.5",
56
58
  "react": ">=18.0.0",
57
59
  "react-native": ">=0.72.0"
58
60
  },
@@ -64,6 +66,7 @@
64
66
  "devDependencies": {
65
67
  "@material/material-color-utilities": "^0.4.0",
66
68
  "@react-native/babel-preset": "^0.81.5",
69
+ "@rootnative/inertia": "^0.0.0-alpha.5",
67
70
  "@testing-library/react-native": "^13.3.3",
68
71
  "@types/jest": "^29.5.14",
69
72
  "@types/react": "^19.0.0",