@react-native-rethemed/chakra-ui-tokens 0.1.0 → 0.1.1

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.
@@ -0,0 +1,206 @@
1
+ import { colors } from "./colors.mjs";
2
+ //#region src/scales.ts
3
+ /**
4
+ * Radius scale, aligned with Chakra UI's radii tokens.
5
+ * https://www.chakra-ui.com/docs/theming/radii
6
+ */
7
+ const radii = {
8
+ none: 0,
9
+ "2xs": 1,
10
+ xs: 2,
11
+ sm: 4,
12
+ md: 6,
13
+ lg: 8,
14
+ xl: 12,
15
+ "2xl": 16,
16
+ "3xl": 24,
17
+ "4xl": 32,
18
+ full: 9999
19
+ };
20
+ /**
21
+ * Spacing scale, aligned with Chakra UI's spacing tokens. 1 unit = 4px,
22
+ * matching Chakra/Tailwind's proportional scale.
23
+ * https://www.chakra-ui.com/docs/theming/spacing
24
+ */
25
+ const spacing = {
26
+ px: 1,
27
+ 0: 0,
28
+ .5: 2,
29
+ 1: 4,
30
+ 1.5: 6,
31
+ 2: 8,
32
+ 2.5: 10,
33
+ 3: 12,
34
+ 3.5: 14,
35
+ 4: 16,
36
+ 5: 20,
37
+ 6: 24,
38
+ 7: 28,
39
+ 8: 32,
40
+ 9: 36,
41
+ 10: 40,
42
+ 11: 44,
43
+ 12: 48,
44
+ 14: 56,
45
+ 16: 64,
46
+ 20: 80,
47
+ 24: 96,
48
+ 28: 112,
49
+ 32: 128,
50
+ 36: 144,
51
+ 40: 160,
52
+ 44: 176,
53
+ 48: 192,
54
+ 52: 208,
55
+ 56: 224,
56
+ 60: 240,
57
+ 64: 256,
58
+ 72: 288,
59
+ 80: 320,
60
+ 96: 384
61
+ };
62
+ /**
63
+ * Font size scale, aligned with Chakra UI's fontSizes tokens.
64
+ * https://www.chakra-ui.com/docs/theming/typography
65
+ */
66
+ const fontSizes = {
67
+ "2xs": 10,
68
+ xs: 12,
69
+ sm: 14,
70
+ md: 16,
71
+ lg: 18,
72
+ xl: 20,
73
+ "2xl": 24,
74
+ "3xl": 30,
75
+ "4xl": 36,
76
+ "5xl": 48,
77
+ "6xl": 60,
78
+ "7xl": 72,
79
+ "8xl": 96,
80
+ "9xl": 128
81
+ };
82
+ /** Font weight scale — the standard 9-step CSS scale (thin..black). */
83
+ const fontWeights = {
84
+ thin: "100",
85
+ extralight: "200",
86
+ light: "300",
87
+ normal: "400",
88
+ medium: "500",
89
+ semibold: "600",
90
+ bold: "700",
91
+ extrabold: "800",
92
+ black: "900"
93
+ };
94
+ /**
95
+ * Line height scale, aligned with Chakra UI's lineHeights tokens: unitless
96
+ * ratios, as Chakra defines them. `themed` resolves a token to
97
+ * `fontSize × ratio` (see `defaults.fontSize` for styles without a fontSize).
98
+ */
99
+ const lineHeights = {
100
+ shorter: 1.25,
101
+ short: 1.375,
102
+ moderate: 1.5,
103
+ tall: 1.625,
104
+ taller: 2
105
+ };
106
+ /**
107
+ * Letter spacing scale. Chakra's tokens are em-based; these are the
108
+ * approximate px equivalents at a 16px base font size.
109
+ */
110
+ const letterSpacings = {
111
+ tighter: -.8,
112
+ tight: -.4,
113
+ wide: .4,
114
+ wider: .8,
115
+ widest: 1.6
116
+ };
117
+ /**
118
+ * z-index scale, aligned with Chakra UI's zIndices tokens.
119
+ * https://www.chakra-ui.com/docs/theming/z-index
120
+ */
121
+ const zIndices = {
122
+ hide: -1,
123
+ base: 0,
124
+ docked: 10,
125
+ dropdown: 1e3,
126
+ sticky: 1100,
127
+ banner: 1200,
128
+ overlay: 1300,
129
+ modal: 1400,
130
+ popover: 1500,
131
+ skipNav: 1600,
132
+ toast: 1700,
133
+ tooltip: 1800,
134
+ max: 2147483647
135
+ };
136
+ /**
137
+ * Chakra's `xs`/`sm`/`md`/`lg`/`xl`/`2xl` box-shadow scale, approximated as
138
+ * single-layer RN shadow objects since RN doesn't support multi-layer
139
+ * shadows the way CSS `box-shadow` does. Chakra's `inner` (inset) shadow
140
+ * isn't included — not representable with RN's native shadow props.
141
+ */
142
+ const shadowColor = colors.black;
143
+ const shadows = {
144
+ xs: {
145
+ shadowColor,
146
+ shadowOffset: {
147
+ width: 0,
148
+ height: 1
149
+ },
150
+ shadowOpacity: .05,
151
+ shadowRadius: 1,
152
+ elevation: 1
153
+ },
154
+ sm: {
155
+ shadowColor,
156
+ shadowOffset: {
157
+ width: 0,
158
+ height: 1
159
+ },
160
+ shadowOpacity: .1,
161
+ shadowRadius: 2,
162
+ elevation: 2
163
+ },
164
+ md: {
165
+ shadowColor,
166
+ shadowOffset: {
167
+ width: 0,
168
+ height: 2
169
+ },
170
+ shadowOpacity: .12,
171
+ shadowRadius: 6,
172
+ elevation: 4
173
+ },
174
+ lg: {
175
+ shadowColor,
176
+ shadowOffset: {
177
+ width: 0,
178
+ height: 4
179
+ },
180
+ shadowOpacity: .14,
181
+ shadowRadius: 10,
182
+ elevation: 8
183
+ },
184
+ xl: {
185
+ shadowColor,
186
+ shadowOffset: {
187
+ width: 0,
188
+ height: 8
189
+ },
190
+ shadowOpacity: .16,
191
+ shadowRadius: 16,
192
+ elevation: 12
193
+ },
194
+ "2xl": {
195
+ shadowColor,
196
+ shadowOffset: {
197
+ width: 0,
198
+ height: 12
199
+ },
200
+ shadowOpacity: .2,
201
+ shadowRadius: 24,
202
+ elevation: 16
203
+ }
204
+ };
205
+ //#endregion
206
+ export { fontSizes, fontWeights, letterSpacings, lineHeights, radii, shadows, spacing, zIndices };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-rethemed/chakra-ui-tokens",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Chakra UI's default design tokens for React Native, ready for react-native-rethemed.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -20,18 +20,11 @@
20
20
  "directory": "packages/react-native-rethemed/chakra-ui"
21
21
  },
22
22
  "sideEffects": false,
23
- "main": "./dist/cjs/index.js",
24
- "types": "./dist/cjs/index.d.ts",
23
+ "types": "./dist/index.d.cts",
25
24
  "exports": {
26
25
  ".": {
27
- "import": {
28
- "types": "./dist/esm/index.d.ts",
29
- "default": "./dist/esm/index.js"
30
- },
31
- "require": {
32
- "types": "./dist/cjs/index.d.ts",
33
- "default": "./dist/cjs/index.js"
34
- }
26
+ "import": "./dist/index.mjs",
27
+ "require": "./dist/index.cjs"
35
28
  },
36
29
  "./package.json": "./package.json"
37
30
  },
@@ -42,26 +35,31 @@
42
35
  "access": "public"
43
36
  },
44
37
  "dependencies": {
45
- "@react-native-rethemed/core": "^0.1.0"
38
+ "@react-native-rethemed/core": "^0.1.1"
46
39
  },
47
40
  "devDependencies": {
41
+ "@arethetypeswrong/core": "0.18.5",
48
42
  "@biomejs/biome": "2.5.4",
49
- "@react-native-rethemed/cli": "0.1.0",
43
+ "@react-native-rethemed/cli": "0.1.1",
50
44
  "@types/node": "24.10.4",
51
45
  "@types/react": "19.2.17",
52
46
  "biome-config": "0.0.0",
47
+ "publint": "0.3.25",
53
48
  "react": "19.2.3",
54
49
  "react-native": "0.86.2",
50
+ "tsdown": "0.23.0",
51
+ "tsdown-config": "0.0.0",
55
52
  "typescript": "6.0.3",
56
53
  "vitest": "4.1.10"
57
54
  },
58
55
  "scripts": {
59
- "build": "node ../../../scripts/build-package.mjs",
56
+ "build": "tsdown",
60
57
  "example:codegen": "react-native-rethemed codegen example/theme.ts --docs example/themed.md",
61
58
  "lint": "biome check src example",
62
59
  "lint:fix": "biome check --write --unsafe src example",
63
60
  "tsc": "tsc --noEmit",
64
61
  "test": "vitest",
65
62
  "test:ci": "vitest run"
66
- }
63
+ },
64
+ "main": "./dist/index.cjs"
67
65
  }