@react-native-rethemed/material-design-tokens 0.1.0
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/LICENSE +21 -0
- package/README.md +56 -0
- package/dist/cjs/index.d.ts +144 -0
- package/dist/cjs/index.js +156 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/index.d.ts +144 -0
- package/dist/esm/index.js +153 -0
- package/dist/esm/package.json +1 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 manato
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @react-native-rethemed/material-design-tokens
|
|
2
|
+
|
|
3
|
+
Material Design 3 type scale and tokens for React Native, ready for [react-native-rethemed](https://github.com/manakuro/react-native-rethemed).
|
|
4
|
+
|
|
5
|
+
Material Design 3's baseline type scale — 5 roles (display / headline / title / body / label) × 3 sizes (lg / md / sm) — and spacing.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @react-native-rethemed/core @react-native-rethemed/material-design-tokens
|
|
11
|
+
npm install --save-dev @react-native-rethemed/cli
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`react` and `react-native` are peer dependencies of `@react-native-rethemed/core`.
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
// src/theme/theme.ts
|
|
20
|
+
import { materialDesignTheme } from '@react-native-rethemed/material-design-tokens';
|
|
21
|
+
|
|
22
|
+
export const themeConfig = materialDesignTheme;
|
|
23
|
+
|
|
24
|
+
// themed.text.title.lg()
|
|
25
|
+
// themed.text.body.md()
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Then generate the typed bindings (and the token reference for AI agents):
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npx @react-native-rethemed/cli codegen src/theme/theme.ts --docs docs/themed.md
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
and use them in components:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { useThemed } from './theme/themed.gen';
|
|
38
|
+
|
|
39
|
+
const { themed } = useThemed();
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
See the [main README](https://github.com/manakuro/react-native-rethemed#readme) for the full setup (`ThemedProvider`, color mode, `extendTheme`).
|
|
43
|
+
|
|
44
|
+
## Exports
|
|
45
|
+
|
|
46
|
+
| Export | Description |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `materialDesignTheme` | The full theme |
|
|
49
|
+
| `typescale` | The type scale as text presets |
|
|
50
|
+
| `spacing` | Spacing scale |
|
|
51
|
+
|
|
52
|
+
[`example/`](https://github.com/manakuro/react-native-rethemed/tree/main/packages/react-native-rethemed/material-design/example) shows what the CLI generates for `materialDesignTheme` (`themed.gen.ts`, `themed.md`).
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
MIT. Token values are converted from the [Material Design 3](https://m3.material.io/) specification.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Material Design 3's baseline type scale — 5 roles (display/headline/title/
|
|
3
|
+
* body/label) × 3 sizes (lg/md/sm).
|
|
4
|
+
* https://m3.material.io/styles/typography/type-scale-tokens
|
|
5
|
+
*
|
|
6
|
+
* MD3 Expressive's additional 15 "Emphasized" styles are intentionally left
|
|
7
|
+
* out — their values are less stable/well-documented across sources than
|
|
8
|
+
* this baseline scale.
|
|
9
|
+
*/
|
|
10
|
+
export declare const typescale: {
|
|
11
|
+
readonly display: {
|
|
12
|
+
readonly lg: {
|
|
13
|
+
readonly fontSize: 57;
|
|
14
|
+
readonly lineHeight: 64;
|
|
15
|
+
readonly letterSpacing: -0.25;
|
|
16
|
+
readonly fontWeight: "400";
|
|
17
|
+
};
|
|
18
|
+
readonly md: {
|
|
19
|
+
readonly fontSize: 45;
|
|
20
|
+
readonly lineHeight: 52;
|
|
21
|
+
readonly letterSpacing: 0;
|
|
22
|
+
readonly fontWeight: "400";
|
|
23
|
+
};
|
|
24
|
+
readonly sm: {
|
|
25
|
+
readonly fontSize: 36;
|
|
26
|
+
readonly lineHeight: 44;
|
|
27
|
+
readonly letterSpacing: 0;
|
|
28
|
+
readonly fontWeight: "400";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
readonly headline: {
|
|
32
|
+
readonly lg: {
|
|
33
|
+
readonly fontSize: 32;
|
|
34
|
+
readonly lineHeight: 40;
|
|
35
|
+
readonly letterSpacing: 0;
|
|
36
|
+
readonly fontWeight: "400";
|
|
37
|
+
};
|
|
38
|
+
readonly md: {
|
|
39
|
+
readonly fontSize: 28;
|
|
40
|
+
readonly lineHeight: 36;
|
|
41
|
+
readonly letterSpacing: 0;
|
|
42
|
+
readonly fontWeight: "400";
|
|
43
|
+
};
|
|
44
|
+
readonly sm: {
|
|
45
|
+
readonly fontSize: 24;
|
|
46
|
+
readonly lineHeight: 32;
|
|
47
|
+
readonly letterSpacing: 0;
|
|
48
|
+
readonly fontWeight: "400";
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
readonly title: {
|
|
52
|
+
readonly lg: {
|
|
53
|
+
readonly fontSize: 22;
|
|
54
|
+
readonly lineHeight: 28;
|
|
55
|
+
readonly letterSpacing: 0;
|
|
56
|
+
readonly fontWeight: "400";
|
|
57
|
+
};
|
|
58
|
+
readonly md: {
|
|
59
|
+
readonly fontSize: 16;
|
|
60
|
+
readonly lineHeight: 24;
|
|
61
|
+
readonly letterSpacing: 0.15;
|
|
62
|
+
readonly fontWeight: "500";
|
|
63
|
+
};
|
|
64
|
+
readonly sm: {
|
|
65
|
+
readonly fontSize: 14;
|
|
66
|
+
readonly lineHeight: 20;
|
|
67
|
+
readonly letterSpacing: 0.1;
|
|
68
|
+
readonly fontWeight: "500";
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
readonly body: {
|
|
72
|
+
readonly lg: {
|
|
73
|
+
readonly fontSize: 16;
|
|
74
|
+
readonly lineHeight: 24;
|
|
75
|
+
readonly letterSpacing: 0.5;
|
|
76
|
+
readonly fontWeight: "400";
|
|
77
|
+
};
|
|
78
|
+
readonly md: {
|
|
79
|
+
readonly fontSize: 14;
|
|
80
|
+
readonly lineHeight: 20;
|
|
81
|
+
readonly letterSpacing: 0.25;
|
|
82
|
+
readonly fontWeight: "400";
|
|
83
|
+
};
|
|
84
|
+
readonly sm: {
|
|
85
|
+
readonly fontSize: 12;
|
|
86
|
+
readonly lineHeight: 16;
|
|
87
|
+
readonly letterSpacing: 0.4;
|
|
88
|
+
readonly fontWeight: "400";
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
readonly label: {
|
|
92
|
+
readonly lg: {
|
|
93
|
+
readonly fontSize: 14;
|
|
94
|
+
readonly lineHeight: 20;
|
|
95
|
+
readonly letterSpacing: 0.1;
|
|
96
|
+
readonly fontWeight: "500";
|
|
97
|
+
};
|
|
98
|
+
readonly md: {
|
|
99
|
+
readonly fontSize: 12;
|
|
100
|
+
readonly lineHeight: 16;
|
|
101
|
+
readonly letterSpacing: 0.5;
|
|
102
|
+
readonly fontWeight: "500";
|
|
103
|
+
};
|
|
104
|
+
readonly sm: {
|
|
105
|
+
readonly fontSize: 11;
|
|
106
|
+
readonly lineHeight: 16;
|
|
107
|
+
readonly letterSpacing: 0.5;
|
|
108
|
+
readonly fontWeight: "500";
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Material Design 3's system spacing tokens (`md.sys.measurement.space*`),
|
|
114
|
+
* keyed by their dp value: `space100` (8dp) → `8`, so
|
|
115
|
+
* `themed.view({ padding: 8 })` is 8. React Native style numbers are already
|
|
116
|
+
* density-independent (1dp = 1), so values are used as-is.
|
|
117
|
+
*
|
|
118
|
+
* | M3 token | key / value (dp) |
|
|
119
|
+
* |:--|--:|
|
|
120
|
+
* | `space0` | 0 |
|
|
121
|
+
* | `space25` / `space50` / `space75` | 2 / 4 / 6 |
|
|
122
|
+
* | `space100` / `space125` | 8 / 10 |
|
|
123
|
+
* | `space200` … `space900` | 16 … 72 (8dp steps) |
|
|
124
|
+
*
|
|
125
|
+
* https://m3.material.io/styles/spacing/tokens (checked 2026-10-02; M3 notes
|
|
126
|
+
* these tokens are so far only used by Jetpack Compose).
|
|
127
|
+
*/
|
|
128
|
+
export declare const spacing: {
|
|
129
|
+
readonly 0: 0;
|
|
130
|
+
readonly 2: 2;
|
|
131
|
+
readonly 4: 4;
|
|
132
|
+
readonly 6: 6;
|
|
133
|
+
readonly 8: 8;
|
|
134
|
+
readonly 10: 10;
|
|
135
|
+
readonly 16: 16;
|
|
136
|
+
readonly 24: 24;
|
|
137
|
+
readonly 32: 32;
|
|
138
|
+
readonly 40: 40;
|
|
139
|
+
readonly 48: 48;
|
|
140
|
+
readonly 56: 56;
|
|
141
|
+
readonly 64: 64;
|
|
142
|
+
readonly 72: 72;
|
|
143
|
+
};
|
|
144
|
+
export declare const materialDesignTheme: import("@react-native-rethemed/core/config").ThemeConfig;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.materialDesignTheme = exports.spacing = exports.typescale = void 0;
|
|
4
|
+
const config_1 = require("@react-native-rethemed/core/config");
|
|
5
|
+
/**
|
|
6
|
+
* Material Design 3's baseline type scale — 5 roles (display/headline/title/
|
|
7
|
+
* body/label) × 3 sizes (lg/md/sm).
|
|
8
|
+
* https://m3.material.io/styles/typography/type-scale-tokens
|
|
9
|
+
*
|
|
10
|
+
* MD3 Expressive's additional 15 "Emphasized" styles are intentionally left
|
|
11
|
+
* out — their values are less stable/well-documented across sources than
|
|
12
|
+
* this baseline scale.
|
|
13
|
+
*/
|
|
14
|
+
exports.typescale = {
|
|
15
|
+
display: {
|
|
16
|
+
lg: {
|
|
17
|
+
fontSize: 57,
|
|
18
|
+
lineHeight: 64,
|
|
19
|
+
letterSpacing: -0.25,
|
|
20
|
+
fontWeight: '400',
|
|
21
|
+
},
|
|
22
|
+
md: {
|
|
23
|
+
fontSize: 45,
|
|
24
|
+
lineHeight: 52,
|
|
25
|
+
letterSpacing: 0,
|
|
26
|
+
fontWeight: '400',
|
|
27
|
+
},
|
|
28
|
+
sm: {
|
|
29
|
+
fontSize: 36,
|
|
30
|
+
lineHeight: 44,
|
|
31
|
+
letterSpacing: 0,
|
|
32
|
+
fontWeight: '400',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
headline: {
|
|
36
|
+
lg: {
|
|
37
|
+
fontSize: 32,
|
|
38
|
+
lineHeight: 40,
|
|
39
|
+
letterSpacing: 0,
|
|
40
|
+
fontWeight: '400',
|
|
41
|
+
},
|
|
42
|
+
md: {
|
|
43
|
+
fontSize: 28,
|
|
44
|
+
lineHeight: 36,
|
|
45
|
+
letterSpacing: 0,
|
|
46
|
+
fontWeight: '400',
|
|
47
|
+
},
|
|
48
|
+
sm: {
|
|
49
|
+
fontSize: 24,
|
|
50
|
+
lineHeight: 32,
|
|
51
|
+
letterSpacing: 0,
|
|
52
|
+
fontWeight: '400',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
title: {
|
|
56
|
+
lg: {
|
|
57
|
+
fontSize: 22,
|
|
58
|
+
lineHeight: 28,
|
|
59
|
+
letterSpacing: 0,
|
|
60
|
+
fontWeight: '400',
|
|
61
|
+
},
|
|
62
|
+
md: {
|
|
63
|
+
fontSize: 16,
|
|
64
|
+
lineHeight: 24,
|
|
65
|
+
letterSpacing: 0.15,
|
|
66
|
+
fontWeight: '500',
|
|
67
|
+
},
|
|
68
|
+
sm: {
|
|
69
|
+
fontSize: 14,
|
|
70
|
+
lineHeight: 20,
|
|
71
|
+
letterSpacing: 0.1,
|
|
72
|
+
fontWeight: '500',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
body: {
|
|
76
|
+
lg: {
|
|
77
|
+
fontSize: 16,
|
|
78
|
+
lineHeight: 24,
|
|
79
|
+
letterSpacing: 0.5,
|
|
80
|
+
fontWeight: '400',
|
|
81
|
+
},
|
|
82
|
+
md: {
|
|
83
|
+
fontSize: 14,
|
|
84
|
+
lineHeight: 20,
|
|
85
|
+
letterSpacing: 0.25,
|
|
86
|
+
fontWeight: '400',
|
|
87
|
+
},
|
|
88
|
+
sm: {
|
|
89
|
+
fontSize: 12,
|
|
90
|
+
lineHeight: 16,
|
|
91
|
+
letterSpacing: 0.4,
|
|
92
|
+
fontWeight: '400',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
label: {
|
|
96
|
+
lg: {
|
|
97
|
+
fontSize: 14,
|
|
98
|
+
lineHeight: 20,
|
|
99
|
+
letterSpacing: 0.1,
|
|
100
|
+
fontWeight: '500',
|
|
101
|
+
},
|
|
102
|
+
md: {
|
|
103
|
+
fontSize: 12,
|
|
104
|
+
lineHeight: 16,
|
|
105
|
+
letterSpacing: 0.5,
|
|
106
|
+
fontWeight: '500',
|
|
107
|
+
},
|
|
108
|
+
sm: {
|
|
109
|
+
fontSize: 11,
|
|
110
|
+
lineHeight: 16,
|
|
111
|
+
letterSpacing: 0.5,
|
|
112
|
+
fontWeight: '500',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Material Design 3's system spacing tokens (`md.sys.measurement.space*`),
|
|
118
|
+
* keyed by their dp value: `space100` (8dp) → `8`, so
|
|
119
|
+
* `themed.view({ padding: 8 })` is 8. React Native style numbers are already
|
|
120
|
+
* density-independent (1dp = 1), so values are used as-is.
|
|
121
|
+
*
|
|
122
|
+
* | M3 token | key / value (dp) |
|
|
123
|
+
* |:--|--:|
|
|
124
|
+
* | `space0` | 0 |
|
|
125
|
+
* | `space25` / `space50` / `space75` | 2 / 4 / 6 |
|
|
126
|
+
* | `space100` / `space125` | 8 / 10 |
|
|
127
|
+
* | `space200` … `space900` | 16 … 72 (8dp steps) |
|
|
128
|
+
*
|
|
129
|
+
* https://m3.material.io/styles/spacing/tokens (checked 2026-10-02; M3 notes
|
|
130
|
+
* these tokens are so far only used by Jetpack Compose).
|
|
131
|
+
*/
|
|
132
|
+
exports.spacing = {
|
|
133
|
+
0: 0,
|
|
134
|
+
2: 2,
|
|
135
|
+
4: 4,
|
|
136
|
+
6: 6,
|
|
137
|
+
8: 8,
|
|
138
|
+
10: 10,
|
|
139
|
+
16: 16,
|
|
140
|
+
24: 24,
|
|
141
|
+
32: 32,
|
|
142
|
+
40: 40,
|
|
143
|
+
48: 48,
|
|
144
|
+
56: 56,
|
|
145
|
+
64: 64,
|
|
146
|
+
72: 72,
|
|
147
|
+
};
|
|
148
|
+
exports.materialDesignTheme = (0, config_1.defineTheme)({
|
|
149
|
+
// Spacing is a scale, not a role, so it is a primitive `tokens` entry.
|
|
150
|
+
tokens: { spacing: exports.spacing },
|
|
151
|
+
// Type-scale styles are role-named (MD3 also places them under
|
|
152
|
+
// `md.sys.typescale.*`, not the reference layer), so they live in
|
|
153
|
+
// `semanticTokens`. Values stay raw: MD3 has its own scale and does not
|
|
154
|
+
// reference another theme's primitives.
|
|
155
|
+
semanticTokens: { text: exports.typescale },
|
|
156
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Material Design 3's baseline type scale — 5 roles (display/headline/title/
|
|
3
|
+
* body/label) × 3 sizes (lg/md/sm).
|
|
4
|
+
* https://m3.material.io/styles/typography/type-scale-tokens
|
|
5
|
+
*
|
|
6
|
+
* MD3 Expressive's additional 15 "Emphasized" styles are intentionally left
|
|
7
|
+
* out — their values are less stable/well-documented across sources than
|
|
8
|
+
* this baseline scale.
|
|
9
|
+
*/
|
|
10
|
+
export declare const typescale: {
|
|
11
|
+
readonly display: {
|
|
12
|
+
readonly lg: {
|
|
13
|
+
readonly fontSize: 57;
|
|
14
|
+
readonly lineHeight: 64;
|
|
15
|
+
readonly letterSpacing: -0.25;
|
|
16
|
+
readonly fontWeight: "400";
|
|
17
|
+
};
|
|
18
|
+
readonly md: {
|
|
19
|
+
readonly fontSize: 45;
|
|
20
|
+
readonly lineHeight: 52;
|
|
21
|
+
readonly letterSpacing: 0;
|
|
22
|
+
readonly fontWeight: "400";
|
|
23
|
+
};
|
|
24
|
+
readonly sm: {
|
|
25
|
+
readonly fontSize: 36;
|
|
26
|
+
readonly lineHeight: 44;
|
|
27
|
+
readonly letterSpacing: 0;
|
|
28
|
+
readonly fontWeight: "400";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
readonly headline: {
|
|
32
|
+
readonly lg: {
|
|
33
|
+
readonly fontSize: 32;
|
|
34
|
+
readonly lineHeight: 40;
|
|
35
|
+
readonly letterSpacing: 0;
|
|
36
|
+
readonly fontWeight: "400";
|
|
37
|
+
};
|
|
38
|
+
readonly md: {
|
|
39
|
+
readonly fontSize: 28;
|
|
40
|
+
readonly lineHeight: 36;
|
|
41
|
+
readonly letterSpacing: 0;
|
|
42
|
+
readonly fontWeight: "400";
|
|
43
|
+
};
|
|
44
|
+
readonly sm: {
|
|
45
|
+
readonly fontSize: 24;
|
|
46
|
+
readonly lineHeight: 32;
|
|
47
|
+
readonly letterSpacing: 0;
|
|
48
|
+
readonly fontWeight: "400";
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
readonly title: {
|
|
52
|
+
readonly lg: {
|
|
53
|
+
readonly fontSize: 22;
|
|
54
|
+
readonly lineHeight: 28;
|
|
55
|
+
readonly letterSpacing: 0;
|
|
56
|
+
readonly fontWeight: "400";
|
|
57
|
+
};
|
|
58
|
+
readonly md: {
|
|
59
|
+
readonly fontSize: 16;
|
|
60
|
+
readonly lineHeight: 24;
|
|
61
|
+
readonly letterSpacing: 0.15;
|
|
62
|
+
readonly fontWeight: "500";
|
|
63
|
+
};
|
|
64
|
+
readonly sm: {
|
|
65
|
+
readonly fontSize: 14;
|
|
66
|
+
readonly lineHeight: 20;
|
|
67
|
+
readonly letterSpacing: 0.1;
|
|
68
|
+
readonly fontWeight: "500";
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
readonly body: {
|
|
72
|
+
readonly lg: {
|
|
73
|
+
readonly fontSize: 16;
|
|
74
|
+
readonly lineHeight: 24;
|
|
75
|
+
readonly letterSpacing: 0.5;
|
|
76
|
+
readonly fontWeight: "400";
|
|
77
|
+
};
|
|
78
|
+
readonly md: {
|
|
79
|
+
readonly fontSize: 14;
|
|
80
|
+
readonly lineHeight: 20;
|
|
81
|
+
readonly letterSpacing: 0.25;
|
|
82
|
+
readonly fontWeight: "400";
|
|
83
|
+
};
|
|
84
|
+
readonly sm: {
|
|
85
|
+
readonly fontSize: 12;
|
|
86
|
+
readonly lineHeight: 16;
|
|
87
|
+
readonly letterSpacing: 0.4;
|
|
88
|
+
readonly fontWeight: "400";
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
readonly label: {
|
|
92
|
+
readonly lg: {
|
|
93
|
+
readonly fontSize: 14;
|
|
94
|
+
readonly lineHeight: 20;
|
|
95
|
+
readonly letterSpacing: 0.1;
|
|
96
|
+
readonly fontWeight: "500";
|
|
97
|
+
};
|
|
98
|
+
readonly md: {
|
|
99
|
+
readonly fontSize: 12;
|
|
100
|
+
readonly lineHeight: 16;
|
|
101
|
+
readonly letterSpacing: 0.5;
|
|
102
|
+
readonly fontWeight: "500";
|
|
103
|
+
};
|
|
104
|
+
readonly sm: {
|
|
105
|
+
readonly fontSize: 11;
|
|
106
|
+
readonly lineHeight: 16;
|
|
107
|
+
readonly letterSpacing: 0.5;
|
|
108
|
+
readonly fontWeight: "500";
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Material Design 3's system spacing tokens (`md.sys.measurement.space*`),
|
|
114
|
+
* keyed by their dp value: `space100` (8dp) → `8`, so
|
|
115
|
+
* `themed.view({ padding: 8 })` is 8. React Native style numbers are already
|
|
116
|
+
* density-independent (1dp = 1), so values are used as-is.
|
|
117
|
+
*
|
|
118
|
+
* | M3 token | key / value (dp) |
|
|
119
|
+
* |:--|--:|
|
|
120
|
+
* | `space0` | 0 |
|
|
121
|
+
* | `space25` / `space50` / `space75` | 2 / 4 / 6 |
|
|
122
|
+
* | `space100` / `space125` | 8 / 10 |
|
|
123
|
+
* | `space200` … `space900` | 16 … 72 (8dp steps) |
|
|
124
|
+
*
|
|
125
|
+
* https://m3.material.io/styles/spacing/tokens (checked 2026-10-02; M3 notes
|
|
126
|
+
* these tokens are so far only used by Jetpack Compose).
|
|
127
|
+
*/
|
|
128
|
+
export declare const spacing: {
|
|
129
|
+
readonly 0: 0;
|
|
130
|
+
readonly 2: 2;
|
|
131
|
+
readonly 4: 4;
|
|
132
|
+
readonly 6: 6;
|
|
133
|
+
readonly 8: 8;
|
|
134
|
+
readonly 10: 10;
|
|
135
|
+
readonly 16: 16;
|
|
136
|
+
readonly 24: 24;
|
|
137
|
+
readonly 32: 32;
|
|
138
|
+
readonly 40: 40;
|
|
139
|
+
readonly 48: 48;
|
|
140
|
+
readonly 56: 56;
|
|
141
|
+
readonly 64: 64;
|
|
142
|
+
readonly 72: 72;
|
|
143
|
+
};
|
|
144
|
+
export declare const materialDesignTheme: import("@react-native-rethemed/core/config").ThemeConfig;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { defineTheme, } from '@react-native-rethemed/core/config';
|
|
2
|
+
/**
|
|
3
|
+
* Material Design 3's baseline type scale — 5 roles (display/headline/title/
|
|
4
|
+
* body/label) × 3 sizes (lg/md/sm).
|
|
5
|
+
* https://m3.material.io/styles/typography/type-scale-tokens
|
|
6
|
+
*
|
|
7
|
+
* MD3 Expressive's additional 15 "Emphasized" styles are intentionally left
|
|
8
|
+
* out — their values are less stable/well-documented across sources than
|
|
9
|
+
* this baseline scale.
|
|
10
|
+
*/
|
|
11
|
+
export const typescale = {
|
|
12
|
+
display: {
|
|
13
|
+
lg: {
|
|
14
|
+
fontSize: 57,
|
|
15
|
+
lineHeight: 64,
|
|
16
|
+
letterSpacing: -0.25,
|
|
17
|
+
fontWeight: '400',
|
|
18
|
+
},
|
|
19
|
+
md: {
|
|
20
|
+
fontSize: 45,
|
|
21
|
+
lineHeight: 52,
|
|
22
|
+
letterSpacing: 0,
|
|
23
|
+
fontWeight: '400',
|
|
24
|
+
},
|
|
25
|
+
sm: {
|
|
26
|
+
fontSize: 36,
|
|
27
|
+
lineHeight: 44,
|
|
28
|
+
letterSpacing: 0,
|
|
29
|
+
fontWeight: '400',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
headline: {
|
|
33
|
+
lg: {
|
|
34
|
+
fontSize: 32,
|
|
35
|
+
lineHeight: 40,
|
|
36
|
+
letterSpacing: 0,
|
|
37
|
+
fontWeight: '400',
|
|
38
|
+
},
|
|
39
|
+
md: {
|
|
40
|
+
fontSize: 28,
|
|
41
|
+
lineHeight: 36,
|
|
42
|
+
letterSpacing: 0,
|
|
43
|
+
fontWeight: '400',
|
|
44
|
+
},
|
|
45
|
+
sm: {
|
|
46
|
+
fontSize: 24,
|
|
47
|
+
lineHeight: 32,
|
|
48
|
+
letterSpacing: 0,
|
|
49
|
+
fontWeight: '400',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
title: {
|
|
53
|
+
lg: {
|
|
54
|
+
fontSize: 22,
|
|
55
|
+
lineHeight: 28,
|
|
56
|
+
letterSpacing: 0,
|
|
57
|
+
fontWeight: '400',
|
|
58
|
+
},
|
|
59
|
+
md: {
|
|
60
|
+
fontSize: 16,
|
|
61
|
+
lineHeight: 24,
|
|
62
|
+
letterSpacing: 0.15,
|
|
63
|
+
fontWeight: '500',
|
|
64
|
+
},
|
|
65
|
+
sm: {
|
|
66
|
+
fontSize: 14,
|
|
67
|
+
lineHeight: 20,
|
|
68
|
+
letterSpacing: 0.1,
|
|
69
|
+
fontWeight: '500',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
body: {
|
|
73
|
+
lg: {
|
|
74
|
+
fontSize: 16,
|
|
75
|
+
lineHeight: 24,
|
|
76
|
+
letterSpacing: 0.5,
|
|
77
|
+
fontWeight: '400',
|
|
78
|
+
},
|
|
79
|
+
md: {
|
|
80
|
+
fontSize: 14,
|
|
81
|
+
lineHeight: 20,
|
|
82
|
+
letterSpacing: 0.25,
|
|
83
|
+
fontWeight: '400',
|
|
84
|
+
},
|
|
85
|
+
sm: {
|
|
86
|
+
fontSize: 12,
|
|
87
|
+
lineHeight: 16,
|
|
88
|
+
letterSpacing: 0.4,
|
|
89
|
+
fontWeight: '400',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
label: {
|
|
93
|
+
lg: {
|
|
94
|
+
fontSize: 14,
|
|
95
|
+
lineHeight: 20,
|
|
96
|
+
letterSpacing: 0.1,
|
|
97
|
+
fontWeight: '500',
|
|
98
|
+
},
|
|
99
|
+
md: {
|
|
100
|
+
fontSize: 12,
|
|
101
|
+
lineHeight: 16,
|
|
102
|
+
letterSpacing: 0.5,
|
|
103
|
+
fontWeight: '500',
|
|
104
|
+
},
|
|
105
|
+
sm: {
|
|
106
|
+
fontSize: 11,
|
|
107
|
+
lineHeight: 16,
|
|
108
|
+
letterSpacing: 0.5,
|
|
109
|
+
fontWeight: '500',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Material Design 3's system spacing tokens (`md.sys.measurement.space*`),
|
|
115
|
+
* keyed by their dp value: `space100` (8dp) → `8`, so
|
|
116
|
+
* `themed.view({ padding: 8 })` is 8. React Native style numbers are already
|
|
117
|
+
* density-independent (1dp = 1), so values are used as-is.
|
|
118
|
+
*
|
|
119
|
+
* | M3 token | key / value (dp) |
|
|
120
|
+
* |:--|--:|
|
|
121
|
+
* | `space0` | 0 |
|
|
122
|
+
* | `space25` / `space50` / `space75` | 2 / 4 / 6 |
|
|
123
|
+
* | `space100` / `space125` | 8 / 10 |
|
|
124
|
+
* | `space200` … `space900` | 16 … 72 (8dp steps) |
|
|
125
|
+
*
|
|
126
|
+
* https://m3.material.io/styles/spacing/tokens (checked 2026-10-02; M3 notes
|
|
127
|
+
* these tokens are so far only used by Jetpack Compose).
|
|
128
|
+
*/
|
|
129
|
+
export const spacing = {
|
|
130
|
+
0: 0,
|
|
131
|
+
2: 2,
|
|
132
|
+
4: 4,
|
|
133
|
+
6: 6,
|
|
134
|
+
8: 8,
|
|
135
|
+
10: 10,
|
|
136
|
+
16: 16,
|
|
137
|
+
24: 24,
|
|
138
|
+
32: 32,
|
|
139
|
+
40: 40,
|
|
140
|
+
48: 48,
|
|
141
|
+
56: 56,
|
|
142
|
+
64: 64,
|
|
143
|
+
72: 72,
|
|
144
|
+
};
|
|
145
|
+
export const materialDesignTheme = defineTheme({
|
|
146
|
+
// Spacing is a scale, not a role, so it is a primitive `tokens` entry.
|
|
147
|
+
tokens: { spacing },
|
|
148
|
+
// Type-scale styles are role-named (MD3 also places them under
|
|
149
|
+
// `md.sys.typescale.*`, not the reference layer), so they live in
|
|
150
|
+
// `semanticTokens`. Values stay raw: MD3 has its own scale and does not
|
|
151
|
+
// reference another theme's primitives.
|
|
152
|
+
semanticTokens: { text: typescale },
|
|
153
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-rethemed/material-design-tokens",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Material Design 3 type scale and tokens for React Native, ready for react-native-rethemed.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react-native",
|
|
7
|
+
"react-native-rethemed",
|
|
8
|
+
"material-design",
|
|
9
|
+
"material-3",
|
|
10
|
+
"design-tokens"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"author": "manakuro",
|
|
14
|
+
"homepage": "https://github.com/manakuro/react-native-rethemed/tree/main/packages/react-native-rethemed/material-design#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/manakuro/react-native-rethemed/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/manakuro/react-native-rethemed.git",
|
|
21
|
+
"directory": "packages/react-native-rethemed/material-design"
|
|
22
|
+
},
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"main": "./dist/cjs/index.js",
|
|
25
|
+
"types": "./dist/cjs/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"import": {
|
|
29
|
+
"types": "./dist/esm/index.d.ts",
|
|
30
|
+
"default": "./dist/esm/index.js"
|
|
31
|
+
},
|
|
32
|
+
"require": {
|
|
33
|
+
"types": "./dist/cjs/index.d.ts",
|
|
34
|
+
"default": "./dist/cjs/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"./package.json": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist"
|
|
41
|
+
],
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@react-native-rethemed/core": "^0.1.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@biomejs/biome": "2.5.4",
|
|
50
|
+
"@react-native-rethemed/cli": "0.1.0",
|
|
51
|
+
"@types/node": "24.10.4",
|
|
52
|
+
"@types/react": "19.2.17",
|
|
53
|
+
"biome-config": "0.0.0",
|
|
54
|
+
"react": "19.2.3",
|
|
55
|
+
"react-native": "0.86.2",
|
|
56
|
+
"typescript": "6.0.3",
|
|
57
|
+
"vitest": "4.1.10"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "node ../../../scripts/build-package.mjs",
|
|
61
|
+
"example:codegen": "react-native-rethemed codegen example/theme.ts --docs example/themed.md",
|
|
62
|
+
"lint": "biome check src example",
|
|
63
|
+
"lint:fix": "biome check --write --unsafe src example",
|
|
64
|
+
"tsc": "tsc --noEmit",
|
|
65
|
+
"test": "vitest",
|
|
66
|
+
"test:ci": "vitest run"
|
|
67
|
+
}
|
|
68
|
+
}
|