-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathtypes.ts
More file actions
179 lines (157 loc) · 3.93 KB
/
Copy pathtypes.ts
File metadata and controls
179 lines (157 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import type * as React from 'react';
import type { $DeepPartial } from '@callstack/react-theme-provider';
export type Font = {
fontFamily: string;
fontWeight?:
| 'normal'
| 'bold'
| '100'
| '200'
| '300'
| '400'
| '500'
| '600'
| '700'
| '800'
| '900';
fontStyle?: 'normal' | 'italic' | undefined;
};
export type Fonts = {
regular: Font;
medium: Font;
light: Font;
thin: Font;
};
type Mode = 'adaptive' | 'exact';
export type ThemeColors = {
primary: string;
primaryContainer: string;
secondary: string;
secondaryContainer: string;
tertiary: string;
tertiaryContainer: string;
surface: string;
surfaceDim: string;
surfaceBright: string;
surfaceContainerLowest: string;
surfaceContainerLow: string;
surfaceContainer: string;
surfaceContainerHigh: string;
surfaceContainerHighest: string;
surfaceVariant: string;
background: string;
error: string;
errorContainer: string;
onPrimary: string;
onPrimaryContainer: string;
onSecondary: string;
onSecondaryContainer: string;
onTertiary: string;
onTertiaryContainer: string;
onSurface: string;
onSurfaceVariant: string;
onError: string;
onErrorContainer: string;
onBackground: string;
outline: string;
outlineVariant: string;
inverseSurface: string;
inverseOnSurface: string;
inversePrimary: string;
primaryFixed: string;
primaryFixedDim: string;
onPrimaryFixed: string;
onPrimaryFixedVariant: string;
secondaryFixed: string;
secondaryFixedDim: string;
onSecondaryFixed: string;
onSecondaryFixedVariant: string;
tertiaryFixed: string;
tertiaryFixedDim: string;
onTertiaryFixed: string;
onTertiaryFixedVariant: string;
shadow: string;
scrim: string;
/** Pre-computed state layer color at press opacity (0.10).
* Used for ripple effects. Avoids runtime alpha manipulation
* which is incompatible with PlatformColor on Android.
* TODO: revisit after https://github.com/facebook/react-native/pull/56395
* @see https://m3.material.io/foundations/interaction/states/state-layers */
stateLayerPressed: string;
elevation: ElevationColors;
};
export type ThemeProp = $DeepPartial<InternalTheme>;
export type ThemeBase = {
dark: boolean;
mode?: Mode;
roundness: number;
animation: {
scale: number;
defaultAnimationDuration?: number;
};
};
export type Theme = ThemeBase & {
colors: ThemeColors;
fonts: Typescale;
};
export type InternalTheme = Theme;
export enum TypescaleKey {
displayLarge = 'displayLarge',
displayMedium = 'displayMedium',
displaySmall = 'displaySmall',
headlineLarge = 'headlineLarge',
headlineMedium = 'headlineMedium',
headlineSmall = 'headlineSmall',
titleLarge = 'titleLarge',
titleMedium = 'titleMedium',
titleSmall = 'titleSmall',
labelLarge = 'labelLarge',
labelMedium = 'labelMedium',
labelSmall = 'labelSmall',
bodyLarge = 'bodyLarge',
bodyMedium = 'bodyMedium',
bodySmall = 'bodySmall',
}
export type TypescaleStyle = {
fontFamily: string;
letterSpacing: number;
fontWeight: Font['fontWeight'];
lineHeight: number;
fontSize: number;
fontStyle?: Font['fontStyle'];
};
export type Typescale =
| {
[key in TypescaleKey]: TypescaleStyle;
} & {
['default']: Omit<TypescaleStyle, 'lineHeight' | 'fontSize'>;
};
export type Elevation = 0 | 1 | 2 | 3 | 4 | 5;
export enum ElevationLevels {
'level0',
'level1',
'level2',
'level3',
'level4',
'level5',
}
export type ElevationColors = {
[key in keyof typeof ElevationLevels]: string;
};
export type $Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
export type $RemoveChildren<T extends React.ComponentType<any>> = $Omit<
React.ComponentPropsWithoutRef<T>,
'children'
>;
export type EllipsizeProp = 'head' | 'middle' | 'tail' | 'clip';
export type NavigationTheme = {
dark: boolean;
colors: {
primary: string;
background: string;
card: string;
text: string;
border: string;
notification: string;
};
};