@rootnative/core 0.0.0-alpha.21 → 0.0.0-alpha.23
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
|
@@ -49,7 +49,7 @@ Provides the theme context to all child components. Works with any design system
|
|
|
49
49
|
| Prop | Type | Default | Description |
|
|
50
50
|
|------|------|---------|-------------|
|
|
51
51
|
| `theme` | `BaseTheme` | `lightTheme` (MD3) | Theme object |
|
|
52
|
-
| `iconResolver` | `IconResolver` |
|
|
52
|
+
| `iconResolver` | `IconResolver` | none | Resolves string icon names (`leadingIcon="check"`) to icon nodes. Set once at the app root to use Lucide, SF Symbols, custom SVGs, etc. Pre-built adapters: [`@rootnative/icons`](https://www.npmjs.com/package/@rootnative/icons) |
|
|
53
53
|
| `children` | `ReactNode` | — | App content |
|
|
54
54
|
|
|
55
55
|
### useTheme()
|
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-
|
|
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-
|
|
1
|
+
import { T as Theme, a as TopAppBarTokens, B as BaseTheme, M as Motion, S as Shape } from './types-CEs6uwKu.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-CEs6uwKu.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';
|
|
@@ -89,8 +89,8 @@ type IconResolver = (name: string, props: IconRenderProps) => React.ReactNode;
|
|
|
89
89
|
* Anything a component will accept for an icon prop:
|
|
90
90
|
*
|
|
91
91
|
* - **string** — a name resolved via the `iconResolver` registered on
|
|
92
|
-
* `ThemeProvider`.
|
|
93
|
-
* resolver is set
|
|
92
|
+
* `ThemeProvider`. Renders nothing, with one warning, when no
|
|
93
|
+
* resolver is set.
|
|
94
94
|
* - **ReactElement** — a pre-rendered icon. The caller is responsible for
|
|
95
95
|
* passing size and color; the component will not override them.
|
|
96
96
|
* - **(props) => ReactNode** — a render function that receives the
|
|
@@ -208,7 +208,7 @@ interface ThemeProviderProps {
|
|
|
208
208
|
/**
|
|
209
209
|
* Resolves string icon names (e.g. `leadingIcon="check"`) to icon nodes.
|
|
210
210
|
* Set this once at the app root to use SF Symbols, Lucide, custom SVGs,
|
|
211
|
-
* etc.
|
|
211
|
+
* etc. `mdiResolver` from `@rootnative/components/mdi` gives MaterialDesignIcons.
|
|
212
212
|
*
|
|
213
213
|
* @example
|
|
214
214
|
* import { Check, ArrowRight } from 'lucide-react-native'
|
|
@@ -291,8 +291,8 @@ declare function useThemeMode(): ThemeModeContextValue;
|
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
293
|
* Returns the icon resolver registered on the nearest `ThemeProvider`,
|
|
294
|
-
* or `null` if none was provided.
|
|
295
|
-
*
|
|
294
|
+
* or `null` if none was provided. A string icon renders nothing and logs one
|
|
295
|
+
* warning when no resolver is set.
|
|
296
296
|
*/
|
|
297
297
|
declare function useIconResolver(): IconResolver | null;
|
|
298
298
|
|
|
@@ -136,7 +136,7 @@ interface TypographyToken {
|
|
|
136
136
|
lineHeight: number;
|
|
137
137
|
letterSpacing: number;
|
|
138
138
|
}
|
|
139
|
-
/** Corner radius tokens from none (0) to full (
|
|
139
|
+
/** Corner radius tokens from none (0) to full (999 for pill shapes). */
|
|
140
140
|
interface Shape {
|
|
141
141
|
/** Global multiplier for corner radii. `0` = sharp, `1` = default MD3, `2` = double rounding. Does not affect `cornerNone` or `cornerFull`. */
|
|
142
142
|
roundness: number;
|
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.
|
|
4
|
-
> Peer deps: react >=19.2.3 <20.0.0, react-native >=0.83.0 <0.87.0, @rootnative/inertia >=0.0.
|
|
3
|
+
> Version: 0.0.0-alpha.23
|
|
4
|
+
> Peer deps: react >=19.2.3 <20.0.0, react-native >=0.83.0 <0.87.0, @rootnative/inertia >=0.0.17 <0.1.0 (required — every animation runs on it)
|
|
5
5
|
> createMaterialTheme needs no extra install — its color engine (@material/material-color-utilities) is bundled behind the create-theme subpath
|
|
6
6
|
|
|
7
7
|
## Quick Start
|
|
@@ -79,7 +79,7 @@ Props:
|
|
|
79
79
|
- `defaultMode?: 'system' | 'light' | 'dark'` — Initial mode when uncontrolled. Default: `'system'`
|
|
80
80
|
- `onModeChange?: (mode: ThemeMode) => void`
|
|
81
81
|
- `storage?: { getItem, setItem }` — Persists the mode. Any AsyncStorage-shaped object; sync or async. Nothing is persisted unless you pass this
|
|
82
|
-
- `iconResolver?: IconResolver`
|
|
82
|
+
- `iconResolver?: IconResolver` — Renders string icon names. Pass `mdiResolver` from `@rootnative/components/mdi` for MaterialDesignIcons, or your own. Without it a string name renders nothing and logs one warning
|
|
83
83
|
- `children: ReactNode`
|
|
84
84
|
|
|
85
85
|
### useThemeMode()
|
|
@@ -146,7 +146,7 @@ const myTheme = defineTheme<MyTheme>({
|
|
|
146
146
|
heading: { fontFamily: 'Inter', fontSize: 24, fontWeight: '700', lineHeight: 32, letterSpacing: 0 },
|
|
147
147
|
body: { fontFamily: 'Inter', fontSize: 16, fontWeight: '400', lineHeight: 24, letterSpacing: 0.5 },
|
|
148
148
|
},
|
|
149
|
-
shape: { roundness: 1, cornerNone: 0, cornerExtraSmall: 4, cornerSmall: 8, cornerMedium: 12, cornerLarge: 16, cornerExtraLarge: 28, cornerFull:
|
|
149
|
+
shape: { roundness: 1, cornerNone: 0, cornerExtraSmall: 4, cornerSmall: 8, cornerMedium: 12, cornerLarge: 16, cornerExtraLarge: 28, cornerFull: 999 },
|
|
150
150
|
spacing: { xs: 4, sm: 8, md: 16, lg: 24, xl: 32 },
|
|
151
151
|
stateLayer: { pressedOpacity: 0.1, focusedOpacity: 0.1, hoveredOpacity: 0.08, draggedOpacity: 0.16, disabledOpacity: 0.38, disabledContainerOpacity: 0.12 },
|
|
152
152
|
elevation: { ... },
|
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.23",
|
|
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,
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"md3"
|
|
54
54
|
],
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@rootnative/inertia": ">=0.0.
|
|
56
|
+
"@rootnative/inertia": ">=0.0.17 <0.1.0",
|
|
57
57
|
"react": ">=19.2.3 <20.0.0",
|
|
58
58
|
"react-native": ">=0.83.0 <0.87.0"
|
|
59
59
|
},
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@material/material-color-utilities": "^0.4.0",
|
|
62
62
|
"@react-native/babel-preset": "^0.86.3",
|
|
63
63
|
"@react-native/jest-preset": "^0.86.3",
|
|
64
|
-
"@rootnative/inertia": "0.0.
|
|
64
|
+
"@rootnative/inertia": "0.0.17",
|
|
65
65
|
"@testing-library/react-native": "^13.3.3",
|
|
66
66
|
"@types/jest": "^29.5.14",
|
|
67
67
|
"@types/react": "^19.0.0",
|