@idealyst/theme 1.1.5 → 1.1.7
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/package.json +1 -1
- package/src/builder.ts +317 -0
- package/src/darkTheme.ts +186 -943
- package/src/helpers.ts +206 -0
- package/src/index.ts +3 -1
- package/src/lightTheme.ts +286 -859
- package/src/theme/color.ts +36 -15
- package/src/theme/extensions.ts +92 -0
- package/src/theme/index.ts +41 -27
- package/src/theme/intent.ts +12 -7
- package/src/theme/shadow.ts +12 -16
- package/src/theme/size.ts +6 -202
- package/src/theme/structures.ts +237 -0
- package/src/unistyles.ts +5 -11
- package/src/variants/color.ts +3 -5
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural type definitions for theme values.
|
|
3
|
+
* These define WHAT the values look like, independent of RegisteredTheme.
|
|
4
|
+
* Used by the builder before RegisteredTheme is available.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Intent value structure - the colors for each intent.
|
|
9
|
+
*/
|
|
10
|
+
export type IntentValue = {
|
|
11
|
+
primary: string;
|
|
12
|
+
contrast: string;
|
|
13
|
+
light: string;
|
|
14
|
+
dark: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Shadow value structure for cross-platform shadows.
|
|
19
|
+
*/
|
|
20
|
+
export type ShadowValue = {
|
|
21
|
+
elevation: number;
|
|
22
|
+
shadowColor: string;
|
|
23
|
+
shadowOffset: {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
};
|
|
27
|
+
shadowOpacity: number;
|
|
28
|
+
shadowRadius: number;
|
|
29
|
+
boxShadow?: string;
|
|
30
|
+
} | {};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A color value string (hex, rgb, rgba, etc.)
|
|
34
|
+
*/
|
|
35
|
+
export type ColorValue = string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Shade values for palette colors (50-900 scale).
|
|
39
|
+
*/
|
|
40
|
+
export type Shade = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Size value - can be number or string
|
|
44
|
+
*/
|
|
45
|
+
export type SizeValue = number | string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Interaction state configuration for hover, focus, active states
|
|
49
|
+
*/
|
|
50
|
+
export type InteractionConfig = {
|
|
51
|
+
focusedBackground: string;
|
|
52
|
+
focusBorder: string;
|
|
53
|
+
opacity: {
|
|
54
|
+
hover: number;
|
|
55
|
+
active: number;
|
|
56
|
+
disabled: number;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Typography variants for semantic text styling
|
|
62
|
+
*/
|
|
63
|
+
export type Typography =
|
|
64
|
+
| 'h1'
|
|
65
|
+
| 'h2'
|
|
66
|
+
| 'h3'
|
|
67
|
+
| 'h4'
|
|
68
|
+
| 'h5'
|
|
69
|
+
| 'h6'
|
|
70
|
+
| 'subtitle1'
|
|
71
|
+
| 'subtitle2'
|
|
72
|
+
| 'body1'
|
|
73
|
+
| 'body2'
|
|
74
|
+
| 'caption';
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Typography style values
|
|
78
|
+
*/
|
|
79
|
+
export type TypographyValue = {
|
|
80
|
+
fontSize: SizeValue;
|
|
81
|
+
lineHeight: SizeValue;
|
|
82
|
+
fontWeight: '300' | '400' | '500' | '600' | '700';
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Component size value structures
|
|
86
|
+
export type ButtonSizeValue = {
|
|
87
|
+
paddingVertical: SizeValue;
|
|
88
|
+
paddingHorizontal: SizeValue;
|
|
89
|
+
minHeight: SizeValue;
|
|
90
|
+
fontSize: SizeValue;
|
|
91
|
+
lineHeight: SizeValue;
|
|
92
|
+
iconSize: SizeValue;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export type ChipSizeValue = {
|
|
96
|
+
paddingVertical: SizeValue;
|
|
97
|
+
paddingHorizontal: SizeValue;
|
|
98
|
+
minHeight: SizeValue;
|
|
99
|
+
borderRadius: SizeValue;
|
|
100
|
+
fontSize: SizeValue;
|
|
101
|
+
lineHeight: SizeValue;
|
|
102
|
+
iconSize: SizeValue;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export type BadgeSizeValue = {
|
|
106
|
+
minWidth: SizeValue;
|
|
107
|
+
height: SizeValue;
|
|
108
|
+
paddingHorizontal: SizeValue;
|
|
109
|
+
fontSize: SizeValue;
|
|
110
|
+
lineHeight: SizeValue;
|
|
111
|
+
iconSize: SizeValue;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export type IconSizeValue = {
|
|
115
|
+
width: SizeValue;
|
|
116
|
+
height: SizeValue;
|
|
117
|
+
fontSize: SizeValue;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export type InputSizeValue = {
|
|
121
|
+
height: SizeValue;
|
|
122
|
+
paddingHorizontal: SizeValue;
|
|
123
|
+
fontSize: SizeValue;
|
|
124
|
+
iconSize: SizeValue;
|
|
125
|
+
iconMargin: SizeValue;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export type RadioButtonSizeValue = {
|
|
129
|
+
radioSize: SizeValue;
|
|
130
|
+
radioDotSize: SizeValue;
|
|
131
|
+
fontSize: SizeValue;
|
|
132
|
+
gap: SizeValue;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export type SelectSizeValue = {
|
|
136
|
+
paddingHorizontal: SizeValue;
|
|
137
|
+
minHeight: SizeValue;
|
|
138
|
+
fontSize: SizeValue;
|
|
139
|
+
iconSize: SizeValue;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export type SliderSizeValue = {
|
|
143
|
+
trackHeight: SizeValue;
|
|
144
|
+
thumbSize: SizeValue;
|
|
145
|
+
thumbIconSize: SizeValue;
|
|
146
|
+
markHeight: SizeValue;
|
|
147
|
+
labelFontSize: SizeValue;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export type SwitchSizeValue = {
|
|
151
|
+
trackWidth: SizeValue;
|
|
152
|
+
trackHeight: SizeValue;
|
|
153
|
+
thumbSize: SizeValue;
|
|
154
|
+
thumbIconSize: SizeValue;
|
|
155
|
+
translateX: SizeValue;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export type TextAreaSizeValue = {
|
|
159
|
+
fontSize: SizeValue;
|
|
160
|
+
padding: SizeValue;
|
|
161
|
+
lineHeight: SizeValue;
|
|
162
|
+
minHeight: SizeValue;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export type AvatarSizeValue = {
|
|
166
|
+
width: SizeValue;
|
|
167
|
+
height: SizeValue;
|
|
168
|
+
fontSize: SizeValue;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export type ProgressSizeValue = {
|
|
172
|
+
linearHeight: SizeValue;
|
|
173
|
+
circularSize: SizeValue;
|
|
174
|
+
labelFontSize: SizeValue;
|
|
175
|
+
circularLabelFontSize: SizeValue;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export type AccordionSizeValue = {
|
|
179
|
+
headerPadding: SizeValue;
|
|
180
|
+
headerFontSize: SizeValue;
|
|
181
|
+
iconSize: SizeValue;
|
|
182
|
+
contentPadding: SizeValue;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export type ActivityIndicatorSizeValue = {
|
|
186
|
+
size: SizeValue;
|
|
187
|
+
borderWidth: SizeValue;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export type BreadcrumbSizeValue = {
|
|
191
|
+
fontSize: SizeValue;
|
|
192
|
+
lineHeight: SizeValue;
|
|
193
|
+
iconSize: SizeValue;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export type ListSizeValue = {
|
|
197
|
+
paddingVertical: SizeValue;
|
|
198
|
+
paddingHorizontal: SizeValue;
|
|
199
|
+
minHeight: SizeValue;
|
|
200
|
+
iconSize: SizeValue;
|
|
201
|
+
labelFontSize: SizeValue;
|
|
202
|
+
labelLineHeight: SizeValue;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export type MenuSizeValue = {
|
|
206
|
+
paddingVertical: SizeValue;
|
|
207
|
+
paddingHorizontal: SizeValue;
|
|
208
|
+
iconSize: SizeValue;
|
|
209
|
+
labelFontSize: SizeValue;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export type TextSizeValue = {
|
|
213
|
+
fontSize: SizeValue;
|
|
214
|
+
lineHeight: SizeValue;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export type TabBarSizeValue = {
|
|
218
|
+
fontSize: SizeValue;
|
|
219
|
+
lineHeight: SizeValue;
|
|
220
|
+
padding: SizeValue;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export type TableSizeValue = {
|
|
224
|
+
padding: SizeValue;
|
|
225
|
+
fontSize: SizeValue;
|
|
226
|
+
lineHeight: SizeValue;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export type TooltipSizeValue = {
|
|
230
|
+
fontSize: SizeValue;
|
|
231
|
+
padding: SizeValue;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export type ViewSizeValue = {
|
|
235
|
+
padding: SizeValue;
|
|
236
|
+
spacing: SizeValue;
|
|
237
|
+
};
|
package/src/unistyles.ts
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
import { darkTheme } from './darkTheme';
|
|
3
3
|
import { lightTheme } from './lightTheme';
|
|
4
|
-
|
|
5
|
-
// Export enhanced theme types
|
|
6
|
-
export type AppTheme = typeof lightTheme;
|
|
7
|
-
export type AppIntents = typeof lightTheme.intents;
|
|
8
|
-
export type AppColors = typeof lightTheme.colors;
|
|
9
|
-
|
|
10
|
-
// Utility types to extract keys from theme
|
|
11
|
-
export type ThemeIntentKeys = keyof AppIntents;
|
|
12
|
-
export type ThemeColorKeys = keyof AppColors;
|
|
4
|
+
import { Theme } from './theme';
|
|
13
5
|
|
|
14
6
|
// Unistyles v3 themes declaration
|
|
15
7
|
declare module 'react-native-unistyles' {
|
|
16
8
|
export interface UnistylesThemes {
|
|
17
|
-
light:
|
|
18
|
-
dark:
|
|
9
|
+
light: Theme;
|
|
10
|
+
dark: Theme;
|
|
19
11
|
}
|
|
20
12
|
}
|
|
21
13
|
|
|
14
|
+
// Export something to ensure this module is included in compilation
|
|
15
|
+
export const unistylesConfigured = true;
|
|
22
16
|
|
|
23
17
|
StyleSheet.configure({
|
|
24
18
|
settings: {
|
package/src/variants/color.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Color, ColorValue, Theme } from "../theme";
|
|
1
|
+
import { ColorValue, Pallet, Theme } from "../theme";
|
|
3
2
|
|
|
4
|
-
export function getColorFromString(theme: Theme, color:
|
|
5
|
-
const [colorName, shade] = color.split('.') as [
|
|
3
|
+
export function getColorFromString(theme: Theme, color: string): ColorValue {
|
|
4
|
+
const [colorName, shade] = color.split('.') as [Pallet, string | undefined];
|
|
6
5
|
const colorPallet = theme.colors.pallet;
|
|
7
6
|
return colorPallet[colorName]?.[shade || '500']
|
|
8
|
-
|
|
9
7
|
}
|