@rootnative/core 0.0.0-alpha.2 → 0.0.0-alpha.4

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.
@@ -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
 
@@ -294,8 +403,14 @@ var lightTheme = {
294
403
  easingEmphasized: "cubic-bezier(0.2, 0, 0, 1)",
295
404
  easingEmphasizedAccelerate: "cubic-bezier(0.3, 0, 0.8, 0.15)",
296
405
  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 }
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 }
299
414
  }
300
415
  };
301
416
 
@@ -1,4 +1,4 @@
1
- import { T as Theme } from '../types-xq2X5AuN.mjs';
1
+ import { T as Theme } from '../types-C8j9GvU_.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-67NS34RT.mjs";
6
+ } from "../chunk-QQ3ME6R7.mjs";
7
7
 
8
8
  // src/theme/createMaterialTheme.ts
9
9
  import {
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-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';
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
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';
@@ -34,6 +34,10 @@ declare module '@rootnative/inertia' {
34
34
  'state-focus': TransitionConfig;
35
35
  'spring-fast-spatial': TransitionConfig;
36
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;
37
41
  }
38
42
  }
39
43
  /**
@@ -43,10 +47,10 @@ declare module '@rootnative/inertia' {
43
47
  * reference by name instead of hand-rolling `withTiming`/`withSpring`
44
48
  * configs.
45
49
  *
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
+ * 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.
50
54
  */
51
55
  declare function motionTransitions(motion: Motion): NamedTransitions;
52
56
 
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  defaultTopAppBarTokens,
4
4
  defaultTypography,
5
5
  lightTheme
6
- } from "./chunk-67NS34RT.mjs";
6
+ } from "./chunk-QQ3ME6R7.mjs";
7
7
 
8
8
  // src/theme/dark.ts
9
9
  var darkTheme = {
@@ -171,8 +171,14 @@ var darkTheme = {
171
171
  easingEmphasized: "cubic-bezier(0.2, 0, 0, 1)",
172
172
  easingEmphasizedAccelerate: "cubic-bezier(0.3, 0, 0.8, 0.15)",
173
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
+ // 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 }
176
182
  }
177
183
  };
178
184
 
@@ -182,32 +188,23 @@ function defineTheme(theme) {
182
188
  }
183
189
 
184
190
  // src/theme/motionAdapter.ts
185
- import {
186
- cubicBezier
187
- } from "@rootnative/inertia";
188
191
  function motionTransitions(motion) {
189
- const standard = cubicBezier(motion.easingStandard);
190
192
  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
- },
193
+ "state-hover": { type: "spring", ...motion.springFastEffects },
194
+ "state-press": { type: "spring", ...motion.springFastEffects },
195
+ "state-focus": { type: "spring", ...motion.springFastEffects },
206
196
  "spring-fast-spatial": { type: "spring", ...motion.springFastSpatial },
207
197
  "spring-default-spatial": {
208
198
  type: "spring",
209
199
  ...motion.springDefaultSpatial
210
- }
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 }
211
208
  };
212
209
  }
213
210
 
@@ -89,7 +89,14 @@ interface Colors {
89
89
  inverseOnSurface: string;
90
90
  inversePrimary: string;
91
91
  }
92
- /** Material Design 3 type scale with 15 roles across 5 categories (display, headline, title, body, label). */
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 {
@@ -216,17 +238,41 @@ interface Motion {
216
238
  easingEmphasizedAccelerate: string;
217
239
  easingEmphasizedDecelerate: string;
218
240
  /**
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).
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).
223
246
  */
224
247
  springFastSpatial: MotionSpring;
225
248
  /**
226
- * Spring for default spatial transitions — selection morphs with a softer,
227
- * bouncier settle (Checkbox and Radio marks).
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.
228
252
  */
229
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;
230
276
  }
231
277
 
232
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.2
3
+ > Version: 0.0.0-alpha.4
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, 15 typography variants, and optional `topAppBar` tokens. `MaterialTheme` is an identical alias (same type) — use it to disambiguate in multi-design-system codebases.
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, easing, and spring tokens
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 — 15 type scale variants (displayLarge..labelSmall)
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.2",
3
+ "version": "0.0.0-alpha.4",
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.0-alpha.5",
57
+ "@rootnative/inertia": "0.0.2",
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.0-alpha.5",
69
+ "@rootnative/inertia": "0.0.2",
70
70
  "@testing-library/react-native": "^13.3.3",
71
71
  "@types/jest": "^29.5.14",
72
72
  "@types/react": "^19.0.0",