@rootnative/core 0.0.0-alpha.1 → 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.
- package/README.md +3 -1
- package/dist/{chunk-DC35U5WG.mjs → chunk-QQ3ME6R7.mjs} +118 -1
- package/dist/create-theme/index.d.mts +1 -1
- package/dist/create-theme/index.mjs +1 -1
- package/dist/index.d.mts +31 -3
- package/dist/index.mjs +42 -3
- package/dist/{types-GiXhVyob.d.mts → types-C8j9GvU_.d.mts} +71 -2
- package/llms.txt +5 -5
- package/package.json +3 -1
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
|
|
|
@@ -125,6 +125,115 @@ var defaultTypography = {
|
|
|
125
125
|
fontWeight: "500",
|
|
126
126
|
lineHeight: 16,
|
|
127
127
|
letterSpacing: 0.5
|
|
128
|
+
},
|
|
129
|
+
// MD3 Expressive emphasized styles — androidx TypeScaleTokens.kt v0_103.
|
|
130
|
+
// Same size/line-height as the base style, weight one step heavier
|
|
131
|
+
// (400→500, 500→700); displayLarge/titleMedium/bodyLarge/bodyMedium also
|
|
132
|
+
// adjust tracking per the Compose tokens.
|
|
133
|
+
displayLargeEmphasized: {
|
|
134
|
+
fontFamily: defaultFontFamily,
|
|
135
|
+
fontSize: 57,
|
|
136
|
+
fontWeight: "500",
|
|
137
|
+
lineHeight: 64,
|
|
138
|
+
letterSpacing: 0
|
|
139
|
+
},
|
|
140
|
+
displayMediumEmphasized: {
|
|
141
|
+
fontFamily: defaultFontFamily,
|
|
142
|
+
fontSize: 45,
|
|
143
|
+
fontWeight: "500",
|
|
144
|
+
lineHeight: 52,
|
|
145
|
+
letterSpacing: 0
|
|
146
|
+
},
|
|
147
|
+
displaySmallEmphasized: {
|
|
148
|
+
fontFamily: defaultFontFamily,
|
|
149
|
+
fontSize: 36,
|
|
150
|
+
fontWeight: "500",
|
|
151
|
+
lineHeight: 44,
|
|
152
|
+
letterSpacing: 0
|
|
153
|
+
},
|
|
154
|
+
headlineLargeEmphasized: {
|
|
155
|
+
fontFamily: defaultFontFamily,
|
|
156
|
+
fontSize: 32,
|
|
157
|
+
fontWeight: "500",
|
|
158
|
+
lineHeight: 40,
|
|
159
|
+
letterSpacing: 0
|
|
160
|
+
},
|
|
161
|
+
headlineMediumEmphasized: {
|
|
162
|
+
fontFamily: defaultFontFamily,
|
|
163
|
+
fontSize: 28,
|
|
164
|
+
fontWeight: "500",
|
|
165
|
+
lineHeight: 36,
|
|
166
|
+
letterSpacing: 0
|
|
167
|
+
},
|
|
168
|
+
headlineSmallEmphasized: {
|
|
169
|
+
fontFamily: defaultFontFamily,
|
|
170
|
+
fontSize: 24,
|
|
171
|
+
fontWeight: "500",
|
|
172
|
+
lineHeight: 32,
|
|
173
|
+
letterSpacing: 0
|
|
174
|
+
},
|
|
175
|
+
titleLargeEmphasized: {
|
|
176
|
+
fontFamily: defaultFontFamily,
|
|
177
|
+
fontSize: 22,
|
|
178
|
+
fontWeight: "500",
|
|
179
|
+
lineHeight: 28,
|
|
180
|
+
letterSpacing: 0
|
|
181
|
+
},
|
|
182
|
+
titleMediumEmphasized: {
|
|
183
|
+
fontFamily: defaultFontFamily,
|
|
184
|
+
fontSize: 16,
|
|
185
|
+
fontWeight: "700",
|
|
186
|
+
lineHeight: 24,
|
|
187
|
+
letterSpacing: 0.15
|
|
188
|
+
},
|
|
189
|
+
titleSmallEmphasized: {
|
|
190
|
+
fontFamily: defaultFontFamily,
|
|
191
|
+
fontSize: 14,
|
|
192
|
+
fontWeight: "700",
|
|
193
|
+
lineHeight: 20,
|
|
194
|
+
letterSpacing: 0.1
|
|
195
|
+
},
|
|
196
|
+
bodyLargeEmphasized: {
|
|
197
|
+
fontFamily: defaultFontFamily,
|
|
198
|
+
fontSize: 16,
|
|
199
|
+
fontWeight: "500",
|
|
200
|
+
lineHeight: 24,
|
|
201
|
+
letterSpacing: 0.15
|
|
202
|
+
},
|
|
203
|
+
bodyMediumEmphasized: {
|
|
204
|
+
fontFamily: defaultFontFamily,
|
|
205
|
+
fontSize: 14,
|
|
206
|
+
fontWeight: "500",
|
|
207
|
+
lineHeight: 20,
|
|
208
|
+
letterSpacing: 0.25
|
|
209
|
+
},
|
|
210
|
+
bodySmallEmphasized: {
|
|
211
|
+
fontFamily: defaultFontFamily,
|
|
212
|
+
fontSize: 12,
|
|
213
|
+
fontWeight: "500",
|
|
214
|
+
lineHeight: 16,
|
|
215
|
+
letterSpacing: 0.4
|
|
216
|
+
},
|
|
217
|
+
labelLargeEmphasized: {
|
|
218
|
+
fontFamily: defaultFontFamily,
|
|
219
|
+
fontSize: 14,
|
|
220
|
+
fontWeight: "700",
|
|
221
|
+
lineHeight: 20,
|
|
222
|
+
letterSpacing: 0.1
|
|
223
|
+
},
|
|
224
|
+
labelMediumEmphasized: {
|
|
225
|
+
fontFamily: defaultFontFamily,
|
|
226
|
+
fontSize: 12,
|
|
227
|
+
fontWeight: "700",
|
|
228
|
+
lineHeight: 16,
|
|
229
|
+
letterSpacing: 0.5
|
|
230
|
+
},
|
|
231
|
+
labelSmallEmphasized: {
|
|
232
|
+
fontFamily: defaultFontFamily,
|
|
233
|
+
fontSize: 11,
|
|
234
|
+
fontWeight: "700",
|
|
235
|
+
lineHeight: 16,
|
|
236
|
+
letterSpacing: 0.5
|
|
128
237
|
}
|
|
129
238
|
};
|
|
130
239
|
|
|
@@ -293,7 +402,15 @@ var lightTheme = {
|
|
|
293
402
|
easingStandardDecelerate: "cubic-bezier(0, 0, 0, 1)",
|
|
294
403
|
easingEmphasized: "cubic-bezier(0.2, 0, 0, 1)",
|
|
295
404
|
easingEmphasizedAccelerate: "cubic-bezier(0.3, 0, 0.8, 0.15)",
|
|
296
|
-
easingEmphasizedDecelerate: "cubic-bezier(0.05, 0.7, 0.1, 1)"
|
|
405
|
+
easingEmphasizedDecelerate: "cubic-bezier(0.05, 0.7, 0.1, 1)",
|
|
406
|
+
// MD3 Expressive scheme, androidx ExpressiveMotionTokens.kt v0_14_0.
|
|
407
|
+
// tension = Compose stiffness; friction = dampingRatio * 2 * sqrt(tension).
|
|
408
|
+
springFastSpatial: { tension: 800, friction: 33.94, mass: 1 },
|
|
409
|
+
springDefaultSpatial: { tension: 380, friction: 31.19, mass: 1 },
|
|
410
|
+
springSlowSpatial: { tension: 200, friction: 22.63, mass: 1 },
|
|
411
|
+
springFastEffects: { tension: 3800, friction: 123.29, mass: 1 },
|
|
412
|
+
springDefaultEffects: { tension: 1600, friction: 80, mass: 1 },
|
|
413
|
+
springSlowEffects: { tension: 800, friction: 56.57, mass: 1 }
|
|
297
414
|
}
|
|
298
415
|
};
|
|
299
416
|
|
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-
|
|
2
|
-
export { C as Colors, E as Elevation, b as ElevationLevel, F as FontWeight,
|
|
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';
|
|
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,33 @@ 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
|
+
'spring-slow-spatial': TransitionConfig;
|
|
38
|
+
'spring-fast-effects': TransitionConfig;
|
|
39
|
+
'spring-default-effects': TransitionConfig;
|
|
40
|
+
'spring-slow-effects': TransitionConfig;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Map a theme's motion tokens into inertia's named-transition registry.
|
|
45
|
+
* `ThemeProvider` feeds the result to `<MotionConfig transitions>`, making
|
|
46
|
+
* `theme.motion.*` the single source of truth components (and consumers)
|
|
47
|
+
* reference by name instead of hand-rolling `withTiming`/`withSpring`
|
|
48
|
+
* configs.
|
|
49
|
+
*
|
|
50
|
+
* The state-layer names encode the library's interaction motion policy —
|
|
51
|
+
* per MD3 Expressive, state-layer color/opacity feedback rides the
|
|
52
|
+
* fast-effects spring (small-element effects, critically damped). The
|
|
53
|
+
* spring names expose the theme's `MotionSpring` tokens verbatim.
|
|
54
|
+
*/
|
|
55
|
+
declare function motionTransitions(motion: Motion): NamedTransitions;
|
|
56
|
+
|
|
29
57
|
/**
|
|
30
58
|
* Scales the intermediate corner radius tokens by a `roundness` multiplier.
|
|
31
59
|
* `cornerNone` always stays `0` and `cornerFull` always stays `999`.
|
|
@@ -183,4 +211,4 @@ declare const material: {
|
|
|
183
211
|
readonly defaultTopAppBarTokens: TopAppBarTokens;
|
|
184
212
|
};
|
|
185
213
|
|
|
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 };
|
|
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
defaultTopAppBarTokens,
|
|
4
4
|
defaultTypography,
|
|
5
5
|
lightTheme
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QQ3ME6R7.mjs";
|
|
7
7
|
|
|
8
8
|
// src/theme/dark.ts
|
|
9
9
|
var darkTheme = {
|
|
@@ -170,7 +170,15 @@ 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
|
+
// MD3 Expressive scheme, androidx ExpressiveMotionTokens.kt v0_14_0.
|
|
175
|
+
// tension = Compose stiffness; friction = dampingRatio * 2 * sqrt(tension).
|
|
176
|
+
springFastSpatial: { tension: 800, friction: 33.94, mass: 1 },
|
|
177
|
+
springDefaultSpatial: { tension: 380, friction: 31.19, mass: 1 },
|
|
178
|
+
springSlowSpatial: { tension: 200, friction: 22.63, mass: 1 },
|
|
179
|
+
springFastEffects: { tension: 3800, friction: 123.29, mass: 1 },
|
|
180
|
+
springDefaultEffects: { tension: 1600, friction: 80, mass: 1 },
|
|
181
|
+
springSlowEffects: { tension: 800, friction: 56.57, mass: 1 }
|
|
174
182
|
}
|
|
175
183
|
};
|
|
176
184
|
|
|
@@ -179,6 +187,31 @@ function defineTheme(theme) {
|
|
|
179
187
|
return theme;
|
|
180
188
|
}
|
|
181
189
|
|
|
190
|
+
// src/theme/motionAdapter.ts
|
|
191
|
+
function motionTransitions(motion) {
|
|
192
|
+
return {
|
|
193
|
+
"state-hover": { type: "spring", ...motion.springFastEffects },
|
|
194
|
+
"state-press": { type: "spring", ...motion.springFastEffects },
|
|
195
|
+
"state-focus": { type: "spring", ...motion.springFastEffects },
|
|
196
|
+
"spring-fast-spatial": { type: "spring", ...motion.springFastSpatial },
|
|
197
|
+
"spring-default-spatial": {
|
|
198
|
+
type: "spring",
|
|
199
|
+
...motion.springDefaultSpatial
|
|
200
|
+
},
|
|
201
|
+
"spring-slow-spatial": { type: "spring", ...motion.springSlowSpatial },
|
|
202
|
+
"spring-fast-effects": { type: "spring", ...motion.springFastEffects },
|
|
203
|
+
"spring-default-effects": {
|
|
204
|
+
type: "spring",
|
|
205
|
+
...motion.springDefaultEffects
|
|
206
|
+
},
|
|
207
|
+
"spring-slow-effects": { type: "spring", ...motion.springSlowEffects }
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// src/provider/ThemeProvider.tsx
|
|
212
|
+
import { MotionConfig } from "@rootnative/inertia";
|
|
213
|
+
import * as React3 from "react";
|
|
214
|
+
|
|
182
215
|
// src/provider/IconResolverContext.ts
|
|
183
216
|
import * as React from "react";
|
|
184
217
|
var IconResolverContext = React.createContext(
|
|
@@ -196,7 +229,12 @@ function ThemeProvider({
|
|
|
196
229
|
iconResolver,
|
|
197
230
|
children
|
|
198
231
|
}) {
|
|
199
|
-
|
|
232
|
+
const resolvedTheme = theme != null ? theme : lightTheme;
|
|
233
|
+
const transitions = React3.useMemo(
|
|
234
|
+
() => motionTransitions(resolvedTheme.motion),
|
|
235
|
+
[resolvedTheme.motion]
|
|
236
|
+
);
|
|
237
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: resolvedTheme, children: /* @__PURE__ */ jsx(IconResolverContext.Provider, { value: iconResolver != null ? iconResolver : null, children: /* @__PURE__ */ jsx(MotionConfig, { transitions, children }) }) });
|
|
200
238
|
}
|
|
201
239
|
|
|
202
240
|
// src/provider/useTheme.ts
|
|
@@ -266,6 +304,7 @@ export {
|
|
|
266
304
|
defineTheme,
|
|
267
305
|
lightTheme,
|
|
268
306
|
material,
|
|
307
|
+
motionTransitions,
|
|
269
308
|
useBreakpoint,
|
|
270
309
|
useBreakpointValue,
|
|
271
310
|
useIconResolver,
|
|
@@ -89,7 +89,14 @@ interface Colors {
|
|
|
89
89
|
inverseOnSurface: string;
|
|
90
90
|
inversePrimary: string;
|
|
91
91
|
}
|
|
92
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* Material Design 3 type scale with 15 roles across 5 categories (display,
|
|
94
|
+
* headline, title, body, label), plus the 15 MD3 Expressive emphasized
|
|
95
|
+
* variants. Emphasized styles keep the base size/line-height and step the
|
|
96
|
+
* weight up (regular→medium, medium→bold); a few also adjust tracking. The
|
|
97
|
+
* spec additionally varies width/grade on variable fonts, which React Native
|
|
98
|
+
* cannot express — weight (+tracking) is the documented approximation.
|
|
99
|
+
*/
|
|
93
100
|
interface Typography {
|
|
94
101
|
[key: string]: TextStyle;
|
|
95
102
|
displayLarge: TextStyle;
|
|
@@ -107,6 +114,21 @@ interface Typography {
|
|
|
107
114
|
labelLarge: TextStyle;
|
|
108
115
|
labelMedium: TextStyle;
|
|
109
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;
|
|
110
132
|
}
|
|
111
133
|
type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
112
134
|
interface TextStyle {
|
|
@@ -179,6 +201,17 @@ interface ShadowOffset {
|
|
|
179
201
|
width: number;
|
|
180
202
|
height: number;
|
|
181
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Physics config for spring-driven transitions. Uses the react-spring
|
|
206
|
+
* vocabulary (`tension`/`friction`/`mass`) — the same surface
|
|
207
|
+
* `@rootnative/inertia` springs accept, mapped 1:1 onto Reanimated's
|
|
208
|
+
* `stiffness`/`damping`/`mass`.
|
|
209
|
+
*/
|
|
210
|
+
interface MotionSpring {
|
|
211
|
+
tension: number;
|
|
212
|
+
friction: number;
|
|
213
|
+
mass: number;
|
|
214
|
+
}
|
|
182
215
|
/** Duration (in ms) and easing tokens for animations following MD3 motion guidelines. */
|
|
183
216
|
interface Motion {
|
|
184
217
|
durationShort1: number;
|
|
@@ -204,6 +237,42 @@ interface Motion {
|
|
|
204
237
|
easingEmphasized: string;
|
|
205
238
|
easingEmphasizedAccelerate: string;
|
|
206
239
|
easingEmphasizedDecelerate: string;
|
|
240
|
+
/**
|
|
241
|
+
* Spring for fast spatial transitions — small-element position/size/corner
|
|
242
|
+
* morphs that track user input snappily (Switch thumb, Slider press-grow,
|
|
243
|
+
* press shape-morphs). Pronounced overshoot (damping ratio 0.6). Named
|
|
244
|
+
* after the MD3 Expressive motion-physics token scheme
|
|
245
|
+
* (fast/default/slow × spatial/effects).
|
|
246
|
+
*/
|
|
247
|
+
springFastSpatial: MotionSpring;
|
|
248
|
+
/**
|
|
249
|
+
* Spring for default spatial transitions — standard-size element morphs
|
|
250
|
+
* with a softer, bouncier settle (Checkbox and Radio marks). Damping
|
|
251
|
+
* ratio 0.8.
|
|
252
|
+
*/
|
|
253
|
+
springDefaultSpatial: MotionSpring;
|
|
254
|
+
/**
|
|
255
|
+
* Spring for slow spatial transitions — large-element position/size/corner
|
|
256
|
+
* morphs (full-screen or container-scale movement). Damping ratio 0.8 at
|
|
257
|
+
* low stiffness.
|
|
258
|
+
*/
|
|
259
|
+
springSlowSpatial: MotionSpring;
|
|
260
|
+
/**
|
|
261
|
+
* Spring for fast effects transitions — small-element color/opacity
|
|
262
|
+
* feedback (state layers). Critically damped (damping ratio 1.0) — effects
|
|
263
|
+
* springs never overshoot.
|
|
264
|
+
*/
|
|
265
|
+
springFastEffects: MotionSpring;
|
|
266
|
+
/**
|
|
267
|
+
* Spring for default effects transitions — standard color/opacity changes.
|
|
268
|
+
* Critically damped.
|
|
269
|
+
*/
|
|
270
|
+
springDefaultEffects: MotionSpring;
|
|
271
|
+
/**
|
|
272
|
+
* Spring for slow effects transitions — large-surface color/opacity
|
|
273
|
+
* changes. Critically damped.
|
|
274
|
+
*/
|
|
275
|
+
springSlowEffects: MotionSpring;
|
|
207
276
|
}
|
|
208
277
|
|
|
209
|
-
export type { BaseTheme as B, Colors as C, Elevation as E, FontWeight as F,
|
|
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 };
|
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.
|
|
3
|
+
> Version: 0.0.0-alpha.3
|
|
4
4
|
> Peer deps: react >=18, react-native >=0.72
|
|
5
5
|
> Optional: @material/material-color-utilities >=0.4.0 (for createMaterialTheme)
|
|
6
6
|
|
|
@@ -182,7 +182,7 @@ material.defaultTopAppBarTokens
|
|
|
182
182
|
### Theme type hierarchy
|
|
183
183
|
|
|
184
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,
|
|
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.
|
|
186
186
|
|
|
187
187
|
### Theme structure
|
|
188
188
|
|
|
@@ -194,19 +194,19 @@ 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
|
|
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
201
|
colors: Colors — 69 MD3 color roles
|
|
202
|
-
typography: Typography —
|
|
202
|
+
typography: Typography — 30 type scale variants: 15 base (displayLarge..labelSmall) + 15 MD3 Expressive emphasized (displayLargeEmphasized..labelSmallEmphasized)
|
|
203
203
|
topAppBar?: TopAppBarTokens
|
|
204
204
|
}
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
Colors: primary, onPrimary, primaryContainer, onPrimaryContainer, primaryFixed, onPrimaryFixed, primaryFixedDim, onPrimaryFixedVariant, secondary (same pattern), tertiary (same pattern), error, onError, errorContainer, onErrorContainer, background, onBackground, surface, surfaceDim, surfaceBright, surfaceContainerLowest, surfaceContainerLow, surfaceContainer, surfaceContainerHigh, surfaceContainerHighest, onSurface, surfaceVariant, onSurfaceVariant, outline, outlineVariant, surfaceTint, shadow, scrim, inverseSurface, inverseOnSurface, inversePrimary
|
|
208
208
|
|
|
209
|
-
Typography variants: displayLarge, displayMedium, displaySmall, headlineLarge, headlineMedium, headlineSmall, titleLarge, titleMedium, titleSmall, bodyLarge, bodyMedium, bodySmall, labelLarge, labelMedium, labelSmall — each with fontFamily, fontSize, fontWeight, lineHeight, letterSpacing
|
|
209
|
+
Typography variants: displayLarge, displayMedium, displaySmall, headlineLarge, headlineMedium, headlineSmall, titleLarge, titleMedium, titleSmall, bodyLarge, bodyMedium, bodySmall, labelLarge, labelMedium, labelSmall — each with fontFamily, fontSize, fontWeight, lineHeight, letterSpacing. Each also has an MD3 Expressive `<name>Emphasized` variant (same size/line height, weight one step heavier: 400→500, 500→700).
|
|
210
210
|
|
|
211
211
|
### useBreakpoint()
|
|
212
212
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rootnative/core",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.3",
|
|
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,6 +54,7 @@
|
|
|
54
54
|
],
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@material/material-color-utilities": ">=0.4.0",
|
|
57
|
+
"@rootnative/inertia": "0.0.2",
|
|
57
58
|
"react": ">=18.0.0",
|
|
58
59
|
"react-native": ">=0.72.0"
|
|
59
60
|
},
|
|
@@ -65,6 +66,7 @@
|
|
|
65
66
|
"devDependencies": {
|
|
66
67
|
"@material/material-color-utilities": "^0.4.0",
|
|
67
68
|
"@react-native/babel-preset": "^0.81.5",
|
|
69
|
+
"@rootnative/inertia": "0.0.2",
|
|
68
70
|
"@testing-library/react-native": "^13.3.3",
|
|
69
71
|
"@types/jest": "^29.5.14",
|
|
70
72
|
"@types/react": "^19.0.0",
|