@fluentui-react-native/default-theme 0.10.3 → 0.11.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/CHANGELOG.json +40 -1
- package/CHANGELOG.md +14 -2
- package/lib/createAliasTokens.d.ts +5 -3
- package/lib/createAliasTokens.d.ts.map +1 -1
- package/lib/createAliasTokens.js +9 -4
- package/lib/createAliasTokens.js.map +1 -1
- package/lib/defaultColors.js +4 -4
- package/lib/defaultColors.js.map +1 -1
- package/lib/defaultTheme.d.ts.map +1 -1
- package/lib/defaultTheme.js +4 -0
- package/lib/defaultTheme.js.map +1 -1
- package/lib/getTokens.d.ts +302 -0
- package/lib/getTokens.d.ts.map +1 -0
- package/lib/getTokens.js +38 -0
- package/lib/getTokens.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/createAliasTokens.d.ts +5 -3
- package/lib-commonjs/createAliasTokens.d.ts.map +1 -1
- package/lib-commonjs/createAliasTokens.js +10 -5
- package/lib-commonjs/createAliasTokens.js.map +1 -1
- package/lib-commonjs/defaultColors.js +3 -3
- package/lib-commonjs/defaultColors.js.map +1 -1
- package/lib-commonjs/defaultTheme.d.ts.map +1 -1
- package/lib-commonjs/defaultTheme.js +4 -0
- package/lib-commonjs/defaultTheme.js.map +1 -1
- package/lib-commonjs/getTokens.d.ts +302 -0
- package/lib-commonjs/getTokens.d.ts.map +1 -0
- package/lib-commonjs/{getAliasTokens.js → getTokens.js} +21 -2
- package/lib-commonjs/getTokens.js.map +1 -0
- package/lib-commonjs/index.d.ts +1 -1
- package/lib-commonjs/index.d.ts.map +1 -1
- package/lib-commonjs/index.js +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +7 -7
- package/src/createAliasTokens.ts +12 -5
- package/src/defaultColors.ts +4 -4
- package/src/defaultTheme.ts +4 -0
- package/src/{getAliasTokens.ts → getTokens.ts} +17 -0
- package/src/index.ts +1 -1
- package/lib/getAliasTokens.d.ts +0 -3
- package/lib/getAliasTokens.d.ts.map +0 -1
- package/lib/getAliasTokens.js +0 -20
- package/lib/getAliasTokens.js.map +0 -1
- package/lib-commonjs/getAliasTokens.d.ts +0 -3
- package/lib-commonjs/getAliasTokens.d.ts.map +0 -1
- package/lib-commonjs/getAliasTokens.js.map +0 -1
package/src/createAliasTokens.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import { getAliasTokens } from './
|
|
2
|
-
import { AliasColorTokens, AppearanceOptions } from '@fluentui-react-native/theme-types';
|
|
1
|
+
import { getAliasTokens, getShadowTokens } from './getTokens';
|
|
2
|
+
import { AliasColorTokens, AppearanceOptions, ThemeShadowDefinition } from '@fluentui-react-native/theme-types';
|
|
3
3
|
import { memoize } from '@fluentui-react-native/memo-cache';
|
|
4
|
-
import { mapPipelineToTheme } from '@fluentui-react-native/theming-utils';
|
|
4
|
+
import { mapPipelineToShadow, mapPipelineToTheme } from '@fluentui-react-native/theming-utils';
|
|
5
5
|
|
|
6
|
-
function
|
|
6
|
+
function createColorAliasTokensWorker(mode: AppearanceOptions): AliasColorTokens {
|
|
7
7
|
const aliasTokens = getAliasTokens(mode);
|
|
8
8
|
return mapPipelineToTheme(aliasTokens);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const
|
|
11
|
+
export const createColorAliasTokens = memoize(createColorAliasTokensWorker);
|
|
12
|
+
|
|
13
|
+
function createShadowAliasTokensWorker(mode: AppearanceOptions): ThemeShadowDefinition {
|
|
14
|
+
const aliasTokens = getShadowTokens(mode);
|
|
15
|
+
return mapPipelineToShadow(aliasTokens);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const createShadowAliasTokens = memoize(createShadowAliasTokensWorker);
|
package/src/defaultColors.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Palette, FabricWebPalette, ThemeColorDefinition } from '@fluentui-react-native/theme-types';
|
|
2
2
|
import { globalTokens } from '@fluentui-react-native/theme-tokens';
|
|
3
|
-
import {
|
|
3
|
+
import { createColorAliasTokens } from './createAliasTokens';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Generate a palette from a set of fabric web colors, like those output from the theme designer.
|
|
@@ -253,7 +253,7 @@ export function getStockWebPalette(): ThemeColorDefinition {
|
|
|
253
253
|
accent: globalTokens.color.brand.primary,
|
|
254
254
|
blackTranslucent40: 'rgba(0,0,0,.4)',
|
|
255
255
|
}),
|
|
256
|
-
...
|
|
256
|
+
...createColorAliasTokens('light'),
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
259
|
|
|
@@ -292,7 +292,7 @@ export function getStockWebDarkPalette(): ThemeColorDefinition {
|
|
|
292
292
|
},
|
|
293
293
|
true,
|
|
294
294
|
),
|
|
295
|
-
...
|
|
295
|
+
...createColorAliasTokens('dark'),
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
298
|
|
|
@@ -505,6 +505,6 @@ export function getStockWebHCPalette(): ThemeColorDefinition {
|
|
|
505
505
|
|
|
506
506
|
personaActivityRing: '#ffffff',
|
|
507
507
|
personaActivityGlow: 'transparent', // glow probably doesn't make sense on HC
|
|
508
|
-
...
|
|
508
|
+
...createColorAliasTokens('highContrast'),
|
|
509
509
|
};
|
|
510
510
|
}
|
package/src/defaultTheme.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Theme, Typography, Spacing, FontWeightValue, FontSize, FontSizes, Varia
|
|
|
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';
|
|
5
|
+
import { createShadowAliasTokens } from './createAliasTokens';
|
|
5
6
|
|
|
6
7
|
function _defaultTypography(): Typography {
|
|
7
8
|
const defaultsDict = {
|
|
@@ -96,6 +97,7 @@ export const defaultFluentTheme: Theme = {
|
|
|
96
97
|
colors: getStockWebPalette(),
|
|
97
98
|
typography: _defaultTypography(),
|
|
98
99
|
spacing: defaultSpacing(),
|
|
100
|
+
shadows: createShadowAliasTokens('light'),
|
|
99
101
|
components: {},
|
|
100
102
|
host: { appearance: 'light' },
|
|
101
103
|
};
|
|
@@ -103,6 +105,7 @@ export const defaultFluentTheme: Theme = {
|
|
|
103
105
|
export const defaultFluentDarkTheme: Theme = {
|
|
104
106
|
colors: getStockWebDarkPalette(),
|
|
105
107
|
typography: defaultFluentTheme.typography,
|
|
108
|
+
shadows: createShadowAliasTokens('dark'),
|
|
106
109
|
spacing: defaultFluentTheme.spacing,
|
|
107
110
|
components: {},
|
|
108
111
|
host: { appearance: 'dark' },
|
|
@@ -111,6 +114,7 @@ export const defaultFluentDarkTheme: Theme = {
|
|
|
111
114
|
export const defaultFluentHighConstrastTheme: Theme = {
|
|
112
115
|
colors: getStockWebHCPalette(),
|
|
113
116
|
typography: defaultFluentTheme.typography,
|
|
117
|
+
shadows: createShadowAliasTokens('highContrast'),
|
|
114
118
|
spacing: defaultFluentTheme.spacing,
|
|
115
119
|
components: {},
|
|
116
120
|
host: { appearance: 'highContrast' },
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import lightAliasTokens from '@fluentui-react-native/design-tokens-windows/light/tokens-aliases.json';
|
|
2
2
|
import darkAliasTokens from '@fluentui-react-native/design-tokens-windows/dark/tokens-aliases.json';
|
|
3
3
|
import { hcAliasTokens } from './highContrast/tokens-alias';
|
|
4
|
+
import lightShadowTokens from '@fluentui-react-native/design-tokens-windows/light/tokens-shadow.json';
|
|
5
|
+
import darkShadowTokens from '@fluentui-react-native/design-tokens-windows/dark/tokens-shadow.json';
|
|
6
|
+
import hcShadowTokens from '@fluentui-react-native/design-tokens-win32/hc/tokens-shadow.json';
|
|
4
7
|
import { AppearanceOptions } from '@fluentui-react-native/theme-types';
|
|
5
8
|
import { assertNever } from 'assert-never';
|
|
6
9
|
|
|
@@ -17,3 +20,17 @@ export function getAliasTokens(mode: AppearanceOptions) {
|
|
|
17
20
|
|
|
18
21
|
return lightAliasTokens;
|
|
19
22
|
}
|
|
23
|
+
|
|
24
|
+
export function getShadowTokens(mode: AppearanceOptions) {
|
|
25
|
+
if (mode === 'light') {
|
|
26
|
+
return lightShadowTokens.shadow;
|
|
27
|
+
} else if (mode === 'dark') {
|
|
28
|
+
return darkShadowTokens.shadow;
|
|
29
|
+
} else if (mode === 'highContrast') {
|
|
30
|
+
return hcShadowTokens.shadow;
|
|
31
|
+
} else {
|
|
32
|
+
assertNever(mode);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return lightAliasTokens;
|
|
36
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { defaultFluentTheme, defaultFluentDarkTheme } from './defaultTheme';
|
|
2
2
|
export { createDefaultTheme } from './createDefaultTheme';
|
|
3
|
-
export { createAliasTokens } from './createAliasTokens';
|
|
3
|
+
export { createColorAliasTokens as createAliasTokens } from './createAliasTokens';
|
package/lib/getAliasTokens.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAliasTokens.d.ts","sourceRoot":"","sources":["../src/getAliasTokens.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAGvE,wBAAgB,cAAc,CAAC,IAAI,EAAE,iBAAiB,OAYrD"}
|
package/lib/getAliasTokens.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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 { assertNever } from 'assert-never';
|
|
5
|
-
export function getAliasTokens(mode) {
|
|
6
|
-
if (mode === 'light') {
|
|
7
|
-
return lightAliasTokens;
|
|
8
|
-
}
|
|
9
|
-
else if (mode === 'dark') {
|
|
10
|
-
return darkAliasTokens;
|
|
11
|
-
}
|
|
12
|
-
else if (mode === 'highContrast') {
|
|
13
|
-
return hcAliasTokens;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
assertNever(mode);
|
|
17
|
-
}
|
|
18
|
-
return lightAliasTokens;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=getAliasTokens.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAliasTokens.js","sourceRoot":"","sources":["../src/getAliasTokens.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,wEAAwE,CAAC;AACtG,OAAO,eAAe,MAAM,uEAAuE,CAAC;AACpG,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,UAAU,cAAc,CAAC,IAAuB;IACpD,IAAI,IAAI,KAAK,OAAO,EAAE;QACpB,OAAO,gBAAgB,CAAC;KACzB;SAAM,IAAI,IAAI,KAAK,MAAM,EAAE;QAC1B,OAAO,eAAe,CAAC;KACxB;SAAM,IAAI,IAAI,KAAK,cAAc,EAAE;QAClC,OAAO,aAAa,CAAC;KACtB;SAAM;QACL,WAAW,CAAC,IAAI,CAAC,CAAC;KACnB;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAliasTokens.d.ts","sourceRoot":"","sources":["../src/getAliasTokens.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAGvE,wBAAgB,cAAc,CAAC,IAAI,EAAE,iBAAiB,OAYrD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAliasTokens.js","sourceRoot":"","sources":["../src/getAliasTokens.ts"],"names":[],"mappings":";;;;;;AAAA,+HAAsG;AACtG,8HAAoG;AACpG,4DAA4D;AAE5D,6CAA2C;AAE3C,SAAgB,cAAc,CAAC,IAAuB;IACpD,IAAI,IAAI,KAAK,OAAO,EAAE;QACpB,OAAO,6BAAgB,CAAC;KACzB;SAAM,IAAI,IAAI,KAAK,MAAM,EAAE;QAC1B,OAAO,6BAAe,CAAC;KACxB;SAAM,IAAI,IAAI,KAAK,cAAc,EAAE;QAClC,OAAO,4BAAa,CAAC;KACtB;SAAM;QACL,IAAA,0BAAW,EAAC,IAAI,CAAC,CAAC;KACnB;IAED,OAAO,6BAAgB,CAAC;AAC1B,CAAC;AAZD,wCAYC"}
|