@rootnative/core 0.0.0-alpha.3 → 0.0.0-alpha.5

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
@@ -5,10 +5,14 @@ Design-system agnostic theme engine for [RootNative UI](https://github.com/rootn
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- pnpm add @rootnative/core
8
+ pnpm add @rootnative/core @rootnative/inertia
9
9
  ```
10
10
 
11
- Peer dependencies: `react >=18`, `react-native >=0.72`
11
+ Peer dependencies: `react >=18`, `react-native >=0.72`, `@rootnative/inertia >=0.0.4 <0.1.0`
12
+
13
+ `@rootnative/inertia` is required — every animation in the library runs on it.
14
+ npm and pnpm install required peers automatically; Yarn classic does not, so add
15
+ it by hand there.
12
16
 
13
17
  Optional: `@material/material-color-utilities >=0.4` — only needed for `createMaterialTheme`.
14
18
 
@@ -112,20 +116,20 @@ material.defaultTopAppBarTokens
112
116
 
113
117
  ### Theme type hierarchy
114
118
 
115
- - `BaseTheme` — Generic base. Colors as `Record<string, string>`, typography as `Record<string, TextStyle>`, plus shape, spacing, stateLayer, elevation, motion.
116
- - `Theme` — MD3 theme. Extends `BaseTheme` with 69 color roles, 15 typography variants, optional `topAppBar` tokens. `MaterialTheme` is an identical alias — use it to disambiguate in multi-design-system codebases.
119
+ - `BaseTheme` — Generic base. Colors as `Record<string, string>`, typography as `Record<string, TypographyToken>`, plus shape, spacing, stateLayer, elevation, motion.
120
+ - `Theme` — MD3 theme. Extends `BaseTheme` with 49 color roles, 30 typography variants (15 base + 15 emphasized), optional `topAppBar` tokens. `MaterialTheme` is an identical alias — use it to disambiguate in multi-design-system codebases.
117
121
 
118
122
  ### Theme structure
119
123
 
120
124
  | Token group | Description |
121
125
  |-------------|-------------|
122
126
  | `colors` | Design-system specific color roles (`Record<string, string>`) |
123
- | `typography` | Type scale variants (`Record<string, TextStyle>`) |
124
- | `shape` | Corner radius tokens (none through full) |
127
+ | `typography` | Type scale variants (`Record<string, TypographyToken>`) |
128
+ | `shape` | `roundness` multiplier plus corner radius tokens (`cornerNone` through `cornerFull`) |
125
129
  | `spacing` | Spacing scale (xs, sm, md, lg, xl) |
126
- | `elevation` | Shadow levels 0–3 |
127
- | `stateLayer` | Opacity values for pressed, focused, hovered, disabled |
128
- | `motion` | Duration and easing tokens |
130
+ | `elevation` | Shadow levels `level0` through `level5` |
131
+ | `stateLayer` | Opacity values: `pressedOpacity`, `focusedOpacity`, `hoveredOpacity`, `draggedOpacity`, `disabledOpacity`, `disabledContainerOpacity` |
132
+ | `motion` | 16 `duration*`, 7 `easing*` and 6 `spring*` tokens |
129
133
 
130
134
  ### Custom MD3 theme
131
135
 
@@ -174,7 +178,8 @@ const columns = useBreakpointValue({ compact: 1, medium: 2, expanded: 4 })
174
178
  - `useBreakpointValue` — Responsive values
175
179
  - `lightTheme` / `darkTheme` — Built-in MD3 themes
176
180
  - `defaultTopAppBarTokens` — MD3 top app bar defaults
177
- - `BaseTheme`, `Theme`, `MaterialTheme`, `Colors`, `Typography`, `Shape`, `Spacing`, `Elevation`, `StateLayer`, `Motion`, `TopAppBarTokens`, `IconResolver`, `IconRenderProps`, `ThemeProviderProps`, `Breakpoint`, `BreakpointValues` — Types
181
+ - `motionTransitions` — The named-transition registry mounted by `ThemeProvider`
182
+ - `BaseTheme`, `Theme`, `MaterialTheme`, `Colors`, `Typography`, `TypographyToken`, `FontWeight`, `Shape`, `Spacing`, `Elevation`, `ElevationLevel`, `ShadowOffset`, `StateLayer`, `Motion`, `MotionSpring`, `TopAppBarTokens`, `IconResolver`, `IconRenderProps`, `IconSource`, `ThemeProviderProps`, `Breakpoint`, `BreakpointValues` — Types
178
183
 
179
184
  ## Docs
180
185
 
@@ -1,4 +1,4 @@
1
- import { T as Theme } from '../types-C8j9GvU_.mjs';
1
+ import { T as Theme } from '../types-NiRbh4dM.mjs';
2
2
 
3
3
  /**
4
4
  * MD3 scheme variant. Each is a spec-defined recipe for deriving the palette
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as Theme, a as TopAppBarTokens, B as BaseTheme, M as Motion, S as Shape } from './types-C8j9GvU_.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-C8j9GvU_.mjs';
1
+ import { T as Theme, a as TopAppBarTokens, B as BaseTheme, M as Motion, S as Shape } from './types-NiRbh4dM.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 Typography, i as TypographyToken } from './types-NiRbh4dM.mjs';
3
3
  import { TransitionConfig, NamedTransitions } from '@rootnative/inertia';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as React from 'react';
@@ -84,7 +84,19 @@ interface IconRenderProps {
84
84
  * etc. without forking components.
85
85
  */
86
86
  type IconResolver = (name: string, props: IconRenderProps) => React.ReactNode;
87
- declare const IconResolverContext: React.Context<IconResolver | null>;
87
+ /**
88
+ * Anything a component will accept for an icon prop:
89
+ *
90
+ * - **string** — a name resolved via the `iconResolver` registered on
91
+ * `ThemeProvider`. Falls back to `MaterialCommunityIcons` when no
92
+ * resolver is set, preserving the legacy default.
93
+ * - **ReactElement** — a pre-rendered icon. The caller is responsible for
94
+ * passing size and color; the component will not override them.
95
+ * - **(props) => ReactNode** — a render function that receives the
96
+ * component's resolved size and color. Useful for plugging in Lucide,
97
+ * SF Symbols, or custom SVGs without losing theme integration.
98
+ */
99
+ type IconSource = string | React.ReactElement | ((props: IconRenderProps) => React.ReactNode);
88
100
 
89
101
  interface ThemeProviderProps {
90
102
  /**
@@ -211,4 +223,4 @@ declare const material: {
211
223
  readonly defaultTopAppBarTokens: TopAppBarTokens;
212
224
  };
213
225
 
214
- 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 };
226
+ export { BaseTheme, type Breakpoint, type BreakpointValues, type IconRenderProps, type IconResolver, type IconSource, Motion, Shape, Theme, ThemeProvider, type ThemeProviderProps, TopAppBarTokens, applyRoundness, breakpoints, darkTheme, defaultTopAppBarTokens, defineTheme, lightTheme, material, motionTransitions, useBreakpoint, useBreakpointValue, useIconResolver, useTheme };
package/dist/index.mjs CHANGED
@@ -295,7 +295,6 @@ var material = {
295
295
  defaultTopAppBarTokens
296
296
  };
297
297
  export {
298
- IconResolverContext,
299
298
  ThemeProvider,
300
299
  applyRoundness,
301
300
  breakpoints,
@@ -6,12 +6,12 @@
6
6
  * @example
7
7
  * interface MyTheme extends BaseTheme {
8
8
  * colors: { brand: string; background: string; text: string }
9
- * typography: { heading: TextStyle; body: TextStyle }
9
+ * typography: { heading: TypographyToken; body: TypographyToken }
10
10
  * }
11
11
  */
12
12
  interface BaseTheme {
13
13
  colors: Record<string, string>;
14
- typography: Record<string, TextStyle>;
14
+ typography: Record<string, TypographyToken>;
15
15
  shape: Shape;
16
16
  spacing: Spacing;
17
17
  stateLayer: StateLayer;
@@ -37,8 +37,7 @@ interface Theme extends BaseTheme {
37
37
  */
38
38
  type MaterialTheme = Theme;
39
39
  /** Material Design 3 color roles. All values are CSS color strings (hex, rgb, etc.). */
40
- interface Colors {
41
- [key: string]: string;
40
+ type Colors = {
42
41
  primary: string;
43
42
  onPrimary: string;
44
43
  primaryContainer: string;
@@ -88,7 +87,7 @@ interface Colors {
88
87
  inverseSurface: string;
89
88
  inverseOnSurface: string;
90
89
  inversePrimary: string;
91
- }
90
+ };
92
91
  /**
93
92
  * Material Design 3 type scale with 15 roles across 5 categories (display,
94
93
  * headline, title, body, label), plus the 15 MD3 Expressive emphasized
@@ -97,41 +96,40 @@ interface Colors {
97
96
  * spec additionally varies width/grade on variable fonts, which React Native
98
97
  * cannot express — weight (+tracking) is the documented approximation.
99
98
  */
100
- interface Typography {
101
- [key: string]: TextStyle;
102
- displayLarge: TextStyle;
103
- displayMedium: TextStyle;
104
- displaySmall: TextStyle;
105
- headlineLarge: TextStyle;
106
- headlineMedium: TextStyle;
107
- headlineSmall: TextStyle;
108
- titleLarge: TextStyle;
109
- titleMedium: TextStyle;
110
- titleSmall: TextStyle;
111
- bodyLarge: TextStyle;
112
- bodyMedium: TextStyle;
113
- bodySmall: TextStyle;
114
- labelLarge: TextStyle;
115
- labelMedium: TextStyle;
116
- labelSmall: TextStyle;
117
- displayLargeEmphasized: TextStyle;
118
- displayMediumEmphasized: TextStyle;
119
- displaySmallEmphasized: TextStyle;
120
- headlineLargeEmphasized: TextStyle;
121
- headlineMediumEmphasized: TextStyle;
122
- headlineSmallEmphasized: TextStyle;
123
- titleLargeEmphasized: TextStyle;
124
- titleMediumEmphasized: TextStyle;
125
- titleSmallEmphasized: TextStyle;
126
- bodyLargeEmphasized: TextStyle;
127
- bodyMediumEmphasized: TextStyle;
128
- bodySmallEmphasized: TextStyle;
129
- labelLargeEmphasized: TextStyle;
130
- labelMediumEmphasized: TextStyle;
131
- labelSmallEmphasized: TextStyle;
132
- }
99
+ type Typography = {
100
+ displayLarge: TypographyToken;
101
+ displayMedium: TypographyToken;
102
+ displaySmall: TypographyToken;
103
+ headlineLarge: TypographyToken;
104
+ headlineMedium: TypographyToken;
105
+ headlineSmall: TypographyToken;
106
+ titleLarge: TypographyToken;
107
+ titleMedium: TypographyToken;
108
+ titleSmall: TypographyToken;
109
+ bodyLarge: TypographyToken;
110
+ bodyMedium: TypographyToken;
111
+ bodySmall: TypographyToken;
112
+ labelLarge: TypographyToken;
113
+ labelMedium: TypographyToken;
114
+ labelSmall: TypographyToken;
115
+ displayLargeEmphasized: TypographyToken;
116
+ displayMediumEmphasized: TypographyToken;
117
+ displaySmallEmphasized: TypographyToken;
118
+ headlineLargeEmphasized: TypographyToken;
119
+ headlineMediumEmphasized: TypographyToken;
120
+ headlineSmallEmphasized: TypographyToken;
121
+ titleLargeEmphasized: TypographyToken;
122
+ titleMediumEmphasized: TypographyToken;
123
+ titleSmallEmphasized: TypographyToken;
124
+ bodyLargeEmphasized: TypographyToken;
125
+ bodyMediumEmphasized: TypographyToken;
126
+ bodySmallEmphasized: TypographyToken;
127
+ labelLargeEmphasized: TypographyToken;
128
+ labelMediumEmphasized: TypographyToken;
129
+ labelSmallEmphasized: TypographyToken;
130
+ };
133
131
  type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
134
- interface TextStyle {
132
+ interface TypographyToken {
135
133
  fontFamily: string;
136
134
  fontSize: number;
137
135
  fontWeight: FontWeight;
@@ -275,4 +273,4 @@ interface Motion {
275
273
  springSlowEffects: MotionSpring;
276
274
  }
277
275
 
278
- 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 };
276
+ 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, Typography as h, TypographyToken as i };
package/llms.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  # @rootnative/core — Theme System for React Native
2
2
 
3
- > Version: 0.0.0-alpha.3
4
- > Peer deps: react >=18, react-native >=0.72
3
+ > Version: 0.0.0-alpha.5
4
+ > Peer deps: react >=18, react-native >=0.72, @rootnative/inertia >=0.0.4 <0.1.0 (required — every animation runs on it)
5
5
  > Optional: @material/material-color-utilities >=0.4.0 (for createMaterialTheme)
6
6
 
7
7
  ## Quick Start
@@ -72,10 +72,10 @@ Identity function that validates a custom theme object against `BaseTheme`. Prov
72
72
 
73
73
  ```tsx
74
74
  import { defineTheme } from '@rootnative/core'
75
- import type { BaseTheme, TextStyle } from '@rootnative/core'
75
+ import type { BaseTheme, TypographyToken } from '@rootnative/core'
76
76
 
77
77
  interface MyColors { [key: string]: string; brand: string; background: string; text: string }
78
- interface MyTypography { [key: string]: TextStyle; heading: TextStyle; body: TextStyle }
78
+ interface MyTypography { [key: string]: TypographyToken; heading: TypographyToken; body: TypographyToken }
79
79
  interface MyTheme extends BaseTheme { colors: MyColors; typography: MyTypography }
80
80
 
81
81
  const myTheme = defineTheme<MyTheme>({
@@ -86,7 +86,7 @@ const myTheme = defineTheme<MyTheme>({
86
86
  },
87
87
  shape: { roundness: 1, cornerNone: 0, cornerExtraSmall: 4, cornerSmall: 8, cornerMedium: 12, cornerLarge: 16, cornerExtraLarge: 28, cornerFull: 9999 },
88
88
  spacing: { xs: 4, sm: 8, md: 16, lg: 24, xl: 32 },
89
- stateLayer: { pressedOpacity: 0.12, focusedOpacity: 0.12, hoveredOpacity: 0.08, disabledOpacity: 0.38 },
89
+ stateLayer: { pressedOpacity: 0.1, focusedOpacity: 0.1, hoveredOpacity: 0.08, draggedOpacity: 0.16, disabledOpacity: 0.38, disabledContainerOpacity: 0.12 },
90
90
  elevation: { ... },
91
91
  motion: { ... },
92
92
  })
@@ -101,7 +101,7 @@ Defaults are byte-identical to the upstream MD3 `material-color-utilities` libra
101
101
  **Spec-aligned options:**
102
102
  - `variant?: 'tonalSpot' | 'neutral' | 'vibrant' | 'expressive' | 'fidelity' | 'content' | 'monochrome' | 'rainbow' | 'fruitSalad'` — MD3 scheme variant (default `'tonalSpot'`, the Material You default on Android 12+). Each is a spec-defined recipe for deriving the palette. Use `'monochrome'` for spec-legal pure-grey themes, `'vibrant'` for high-colorfulness, etc.
103
103
  - `contrastLevel?: 'standard' | 'medium' | 'high'` — MD3 contrast preset (default `'standard'`). Maps to MD3 contrast values `0 / 0.5 / 1.0`. Use `'medium'` or `'high'` for WCAG AAA / low-vision modes.
104
- - `fontFamily?: string` — Custom font family applied to all 15 typography styles. When omitted, platform defaults are used (Roboto on Android, System on iOS).
104
+ - `fontFamily?: string` — Custom font family applied to all 30 typography styles (15 base + 15 emphasized). When omitted, platform defaults are used (Roboto on Android, System on iOS).
105
105
  - `roundness?: number` — Global corner-radius multiplier. `0` = sharp corners, `1` = default MD3 (default), `2` = double rounding. Does not affect `cornerNone` or `cornerFull`.
106
106
 
107
107
  **Explicit overrides (NOT part of MD3 spec — use only when no built-in `variant` covers your case):**
@@ -144,7 +144,7 @@ createMaterialTheme('#006A6A', { seedAdjustments: { primary: 60, secondary: 32 }
144
144
 
145
145
  Returns: `{ lightTheme: Theme, darkTheme: Theme }`
146
146
 
147
- The generated themes include all 69 MD3 color roles plus shared tokens (typography, shape, spacing, stateLayer, elevation, motion, topAppBar).
147
+ The generated themes include all 49 MD3 color roles plus shared tokens (typography, shape, spacing, stateLayer, elevation, motion, topAppBar).
148
148
 
149
149
  Requires `@material/material-color-utilities` as a peer dependency: `npm install @material/material-color-utilities`
150
150
 
@@ -181,24 +181,24 @@ material.defaultTopAppBarTokens
181
181
 
182
182
  ### Theme type hierarchy
183
183
 
184
- - `BaseTheme` — Generic base interface. All design systems extend this. Has `colors: Record<string, string>`, `typography: Record<string, TextStyle>`, plus shape, spacing, stateLayer, elevation, motion.
185
- - `Theme` — Material Design 3 theme. Extends `BaseTheme` with 69 MD3 color roles, 30 typography variants (15 base + 15 emphasized), and optional `topAppBar` tokens. `MaterialTheme` is an identical alias (same type) — use it to disambiguate in multi-design-system codebases.
184
+ - `BaseTheme` — Generic base interface. All design systems extend this. Has `colors: Record<string, string>`, `typography: Record<string, TypographyToken>`, plus shape, spacing, stateLayer, elevation, motion.
185
+ - `Theme` — Material Design 3 theme. Extends `BaseTheme` with 49 MD3 color roles, 30 typography variants (15 base + 15 emphasized), and optional `topAppBar` tokens. `MaterialTheme` is an identical alias (same type) — use it to disambiguate in multi-design-system codebases.
186
186
 
187
187
  ### Theme structure
188
188
 
189
189
  ```
190
190
  BaseTheme {
191
191
  colors: Record<string, string>
192
- typography: Record<string, TextStyle>
192
+ typography: Record<string, TypographyToken>
193
193
  shape: Shape — roundness, cornerNone, cornerExtraSmall, cornerSmall, cornerMedium, cornerLarge, cornerExtraLarge, cornerFull
194
194
  spacing: Spacing — xs, sm, md, lg, xl
195
- elevation: Elevation — level0..level3 (shadow properties)
196
- stateLayer: StateLayer — pressedOpacity, focusedOpacity, hoveredOpacity, disabledOpacity
195
+ elevation: Elevation — level0..level5 (shadow properties)
196
+ stateLayer: StateLayer — pressedOpacity, focusedOpacity, hoveredOpacity, draggedOpacity, disabledOpacity, disabledContainerOpacity
197
197
  motion: Motion — duration, easing, and MD3 Expressive spring tokens (springFastSpatial, springDefaultSpatial, springSlowSpatial, springFastEffects, springDefaultEffects, springSlowEffects — each { tension, friction, mass })
198
198
  }
199
199
 
200
200
  Theme extends BaseTheme {
201
- colors: Colors — 69 MD3 color roles
201
+ colors: Colors — 49 MD3 color roles
202
202
  typography: Typography — 30 type scale variants: 15 base (displayLarge..labelSmall) + 15 MD3 Expressive emphasized (displayLargeEmphasized..labelSmallEmphasized)
203
203
  topAppBar?: TopAppBarTokens
204
204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootnative/core",
3
- "version": "0.0.0-alpha.3",
3
+ "version": "0.0.0-alpha.5",
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,
@@ -54,7 +54,7 @@
54
54
  ],
55
55
  "peerDependencies": {
56
56
  "@material/material-color-utilities": ">=0.4.0",
57
- "@rootnative/inertia": "0.0.2",
57
+ "@rootnative/inertia": ">=0.0.5 <0.1.0",
58
58
  "react": ">=18.0.0",
59
59
  "react-native": ">=0.72.0"
60
60
  },
@@ -66,7 +66,7 @@
66
66
  "devDependencies": {
67
67
  "@material/material-color-utilities": "^0.4.0",
68
68
  "@react-native/babel-preset": "^0.81.5",
69
- "@rootnative/inertia": "0.0.2",
69
+ "@rootnative/inertia": "0.0.5",
70
70
  "@testing-library/react-native": "^13.3.3",
71
71
  "@types/jest": "^29.5.14",
72
72
  "@types/react": "^19.0.0",