@fluentui-react-native/default-theme 0.9.15 → 0.10.2
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/CHANGELOG.json +88 -1
- package/CHANGELOG.md +33 -2
- package/lib/createAliasTokens.d.ts +5 -0
- package/lib/createAliasTokens.d.ts.map +1 -0
- package/lib/createAliasTokens.js +9 -0
- package/lib/createAliasTokens.js.map +1 -0
- package/lib/defaultColors.js +1 -1
- package/lib/defaultColors.js.map +1 -1
- package/lib/defaultTheme.d.ts.map +1 -1
- package/lib/defaultTheme.js +132 -0
- package/lib/defaultTheme.js.map +1 -1
- package/lib/getAliasTokens.d.ts +3 -0
- package/lib/getAliasTokens.d.ts.map +1 -0
- package/lib/getAliasTokens.js +20 -0
- package/lib/getAliasTokens.js.map +1 -0
- package/lib/highContrast/tokens-alias.d.ts +2 -0
- package/lib/highContrast/tokens-alias.d.ts.map +1 -0
- package/lib/highContrast/tokens-alias.js +16 -0
- package/lib/highContrast/tokens-alias.js.map +1 -0
- package/lib/highContrast/tokens-alias.win32.d.ts +2 -0
- package/lib/highContrast/tokens-alias.win32.d.ts.map +1 -0
- package/lib/highContrast/tokens-alias.win32.js +16 -0
- package/lib/highContrast/tokens-alias.win32.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib-commonjs/createAliasTokens.d.ts +5 -0
- package/lib-commonjs/createAliasTokens.d.ts.map +1 -0
- package/lib-commonjs/createAliasTokens.js +12 -0
- package/lib-commonjs/createAliasTokens.js.map +1 -0
- package/lib-commonjs/defaultColors.js +4 -4
- package/lib-commonjs/defaultColors.js.map +1 -1
- package/lib-commonjs/defaultTheme.d.ts.map +1 -1
- package/lib-commonjs/defaultTheme.js +132 -0
- package/lib-commonjs/defaultTheme.js.map +1 -1
- package/lib-commonjs/getAliasTokens.d.ts +3 -0
- package/lib-commonjs/getAliasTokens.d.ts.map +1 -0
- package/lib-commonjs/getAliasTokens.js +27 -0
- package/lib-commonjs/getAliasTokens.js.map +1 -0
- package/lib-commonjs/highContrast/tokens-alias.d.ts +2 -0
- package/lib-commonjs/highContrast/tokens-alias.d.ts.map +1 -0
- package/lib-commonjs/highContrast/tokens-alias.js +22 -0
- package/lib-commonjs/highContrast/tokens-alias.js.map +1 -0
- package/lib-commonjs/highContrast/tokens-alias.win32.d.ts +2 -0
- package/lib-commonjs/highContrast/tokens-alias.win32.d.ts.map +1 -0
- package/lib-commonjs/highContrast/tokens-alias.win32.js +22 -0
- package/lib-commonjs/highContrast/tokens-alias.win32.js.map +1 -0
- package/lib-commonjs/index.d.ts +1 -0
- package/lib-commonjs/index.d.ts.map +1 -1
- package/lib-commonjs/index.js +3 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +8 -5
- package/src/createAliasTokens.ts +11 -0
- package/src/defaultColors.ts +1 -1
- package/src/defaultTheme.ts +133 -1
- package/src/getAliasTokens.ts +19 -0
- package/src/highContrast/tokens-alias.ts +18 -0
- package/src/highContrast/tokens-alias.win32.ts +18 -0
- package/src/index.ts +1 -0
package/src/defaultTheme.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Theme, Typography, Spacing, FontWeightValue, FontSize, FontSizes, Variants } from '@fluentui-react-native/theme-types';
|
|
1
|
+
import { Theme, Typography, Spacing, FontWeightValue, FontSize, FontSizes, Variants, FontFamily } from '@fluentui-react-native/theme-types';
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
import { getStockWebPalette, getStockWebDarkPalette, getStockWebHCPalette } from './defaultColors';
|
|
4
4
|
import { globalTokens } from '@fluentui-react-native/theme-tokens';
|
|
@@ -40,6 +40,72 @@ function _defaultTypography(): Typography {
|
|
|
40
40
|
heroSemibold: { face: 'primary', size: 'hero', weight: 'semiBold' },
|
|
41
41
|
heroLargeStandard: { face: 'primary', size: 'heroLarge', weight: 'regular' },
|
|
42
42
|
heroLargeSemibold: { face: 'primary', size: 'heroLarge', weight: 'semiBold' },
|
|
43
|
+
//v1 text variants
|
|
44
|
+
caption1: {
|
|
45
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
46
|
+
size: globalTokens.font.size['100'] as FontSize,
|
|
47
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
48
|
+
},
|
|
49
|
+
body1: {
|
|
50
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
51
|
+
size: globalTokens.font.size['200'] as FontSize,
|
|
52
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
53
|
+
},
|
|
54
|
+
body1Strong: {
|
|
55
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
56
|
+
size: globalTokens.font.size['200'] as FontSize,
|
|
57
|
+
weight: globalTokens.font.weight.semibold as FontWeightValue,
|
|
58
|
+
},
|
|
59
|
+
body2: {
|
|
60
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
61
|
+
size: globalTokens.font.size['300'] as FontSize,
|
|
62
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
63
|
+
},
|
|
64
|
+
body2Strong: {
|
|
65
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
66
|
+
size: globalTokens.font.size['300'] as FontSize,
|
|
67
|
+
weight: globalTokens.font.weight.semibold as FontWeightValue,
|
|
68
|
+
},
|
|
69
|
+
subtitle2: {
|
|
70
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
71
|
+
size: globalTokens.font.size['400'] as FontSize,
|
|
72
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
73
|
+
},
|
|
74
|
+
subtitle2Strong: {
|
|
75
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
76
|
+
size: globalTokens.font.size['400'] as FontSize,
|
|
77
|
+
weight: globalTokens.font.weight.semibold as FontWeightValue,
|
|
78
|
+
},
|
|
79
|
+
subtitle1: {
|
|
80
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
81
|
+
size: globalTokens.font.size['500'] as FontSize,
|
|
82
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
83
|
+
},
|
|
84
|
+
subtitle1Strong: {
|
|
85
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
86
|
+
size: globalTokens.font.size['500'] as FontSize,
|
|
87
|
+
weight: globalTokens.font.weight.semibold as FontWeightValue,
|
|
88
|
+
},
|
|
89
|
+
title1: {
|
|
90
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
91
|
+
size: globalTokens.font.size['700'] as FontSize,
|
|
92
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
93
|
+
},
|
|
94
|
+
title1Strong: {
|
|
95
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
96
|
+
size: globalTokens.font.size['700'] as FontSize,
|
|
97
|
+
weight: globalTokens.font.weight.semibold as FontWeightValue,
|
|
98
|
+
},
|
|
99
|
+
largeTitle: {
|
|
100
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
101
|
+
size: globalTokens.font.size['900'] as FontSize,
|
|
102
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
103
|
+
},
|
|
104
|
+
display: {
|
|
105
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
106
|
+
size: globalTokens.font.size['900'] as FontSize,
|
|
107
|
+
weight: globalTokens.font.weight.semibold as FontWeightValue,
|
|
108
|
+
},
|
|
43
109
|
} as Variants,
|
|
44
110
|
};
|
|
45
111
|
|
|
@@ -81,6 +147,72 @@ function _defaultTypography(): Typography {
|
|
|
81
147
|
heroSemibold: { face: 'secondary', size: 'hero', weight: 'semiBold' },
|
|
82
148
|
heroLargeStandard: { face: 'primary', size: 'heroLarge', weight: 'regular' },
|
|
83
149
|
heroLargeSemibold: { face: 'secondary', size: 'heroLarge', weight: 'semiBold' },
|
|
150
|
+
//v2 text variants
|
|
151
|
+
caption1: {
|
|
152
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
153
|
+
size: globalTokens.font.size['100'] as FontSize,
|
|
154
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
155
|
+
},
|
|
156
|
+
body1: {
|
|
157
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
158
|
+
size: globalTokens.font.size['200'] as FontSize,
|
|
159
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
160
|
+
},
|
|
161
|
+
body1Strong: {
|
|
162
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
163
|
+
size: globalTokens.font.size['200'] as FontSize,
|
|
164
|
+
weight: globalTokens.font.weight.semibold as FontWeightValue,
|
|
165
|
+
},
|
|
166
|
+
body2: {
|
|
167
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
168
|
+
size: globalTokens.font.size['300'] as FontSize,
|
|
169
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
170
|
+
},
|
|
171
|
+
body2Strong: {
|
|
172
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
173
|
+
size: globalTokens.font.size['300'] as FontSize,
|
|
174
|
+
weight: globalTokens.font.weight.semibold as FontWeightValue,
|
|
175
|
+
},
|
|
176
|
+
subtitle2: {
|
|
177
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
178
|
+
size: globalTokens.font.size['400'] as FontSize,
|
|
179
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
180
|
+
},
|
|
181
|
+
subtitle2Strong: {
|
|
182
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
183
|
+
size: globalTokens.font.size['400'] as FontSize,
|
|
184
|
+
weight: globalTokens.font.weight.semibold as FontWeightValue,
|
|
185
|
+
},
|
|
186
|
+
subtitle1: {
|
|
187
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
188
|
+
size: globalTokens.font.size['500'] as FontSize,
|
|
189
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
190
|
+
},
|
|
191
|
+
subtitle1Strong: {
|
|
192
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
193
|
+
size: globalTokens.font.size['500'] as FontSize,
|
|
194
|
+
weight: globalTokens.font.weight.semibold as FontWeightValue,
|
|
195
|
+
},
|
|
196
|
+
title1: {
|
|
197
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
198
|
+
size: globalTokens.font.size['700'] as FontSize,
|
|
199
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
200
|
+
},
|
|
201
|
+
title1Strong: {
|
|
202
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
203
|
+
size: globalTokens.font.size['700'] as FontSize,
|
|
204
|
+
weight: globalTokens.font.weight.semibold as FontWeightValue,
|
|
205
|
+
},
|
|
206
|
+
largeTitle: {
|
|
207
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
208
|
+
size: globalTokens.font.size['900'] as FontSize,
|
|
209
|
+
weight: globalTokens.font.weight.regular as FontWeightValue,
|
|
210
|
+
},
|
|
211
|
+
display: {
|
|
212
|
+
face: globalTokens.font.family['base'] as FontFamily,
|
|
213
|
+
size: globalTokens.font.size['900'] as FontSize,
|
|
214
|
+
weight: globalTokens.font.weight.semibold as FontWeightValue,
|
|
215
|
+
},
|
|
84
216
|
} as Variants;
|
|
85
217
|
defaultsDict.variants = variantsDictWin32;
|
|
86
218
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import lightAliasTokens from '@fluentui-react-native/design-tokens-windows/light/tokens-aliases.json';
|
|
2
|
+
import darkAliasTokens from '@fluentui-react-native/design-tokens-windows/dark/tokens-aliases.json';
|
|
3
|
+
import { hcAliasTokens } from './highContrast/tokens-alias';
|
|
4
|
+
import { AppearanceOptions } from '@fluentui-react-native/theme-types';
|
|
5
|
+
import { assertNever } from 'assert-never';
|
|
6
|
+
|
|
7
|
+
export function getAliasTokens(mode: AppearanceOptions) {
|
|
8
|
+
if (mode === 'light') {
|
|
9
|
+
return lightAliasTokens;
|
|
10
|
+
} else if (mode === 'dark') {
|
|
11
|
+
return darkAliasTokens;
|
|
12
|
+
} else if (mode === 'highContrast') {
|
|
13
|
+
return hcAliasTokens;
|
|
14
|
+
} else {
|
|
15
|
+
assertNever(mode);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return lightAliasTokens;
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PlatformColor } from 'react-native';
|
|
2
|
+
import aliasTokens from '@fluentui-react-native/design-tokens-win32/hc/tokens-aliases.json';
|
|
3
|
+
|
|
4
|
+
export const hcAliasTokens = processAliasTokens(aliasTokens);
|
|
5
|
+
|
|
6
|
+
function processAliasTokens(aliasTokens: any) {
|
|
7
|
+
for (const key in aliasTokens) {
|
|
8
|
+
for (const innerKey in aliasTokens[key]) {
|
|
9
|
+
const entry = aliasTokens[key][innerKey];
|
|
10
|
+
if (typeof entry === 'string' && entry.includes('PlatformColor')) {
|
|
11
|
+
const color = 'SystemColor' + entry.substring(14, entry.length - 1) + 'Color';
|
|
12
|
+
aliasTokens[key][innerKey] = PlatformColor(color);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return aliasTokens;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PlatformColor } from 'react-native';
|
|
2
|
+
import aliasTokens from '@fluentui-react-native/design-tokens-win32/hc/tokens-aliases.json';
|
|
3
|
+
|
|
4
|
+
export const hcAliasTokens = processAliasTokens(aliasTokens);
|
|
5
|
+
|
|
6
|
+
function processAliasTokens(aliasTokens: any) {
|
|
7
|
+
for (const key in aliasTokens) {
|
|
8
|
+
for (const innerKey in aliasTokens[key]) {
|
|
9
|
+
const entry = aliasTokens[key][innerKey];
|
|
10
|
+
if (typeof entry === 'string' && entry.includes('PlatformColor')) {
|
|
11
|
+
const color = entry.substring(14, entry.length - 1);
|
|
12
|
+
aliasTokens[key][innerKey] = PlatformColor(color);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return aliasTokens;
|
|
18
|
+
}
|
package/src/index.ts
CHANGED