@draftbit/theme 50.5.3-22879.2 → 50.5.3-9ae597.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/lib/commonjs/DefaultTheme.js +1 -1
- package/lib/commonjs/Provider.js +1 -1
- package/lib/commonjs/createThemeValuesProxy.js +1 -1
- package/lib/commonjs/types.js +0 -1
- package/lib/commonjs/validators.js +1 -1
- package/lib/typescript/src/DefaultTheme.js +38 -38
- package/lib/typescript/src/DefaultTheme.js.map +1 -1
- package/lib/typescript/src/Provider.js +10 -38
- package/lib/typescript/src/Provider.js.map +1 -1
- package/lib/typescript/src/createThemeValuesProxy.js +19 -23
- package/lib/typescript/src/createThemeValuesProxy.js.map +1 -1
- package/lib/typescript/src/types.d.ts +2 -30
- package/lib/typescript/src/validators.d.ts +1 -2
- package/lib/typescript/src/validators.js +42 -62
- package/lib/typescript/src/validators.js.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/DefaultTheme.js +38 -38
- package/src/DefaultTheme.js.map +1 -1
- package/src/DefaultTheme.ts +38 -38
- package/src/Provider.js +10 -38
- package/src/Provider.js.map +1 -1
- package/src/Provider.tsx +36 -60
- package/src/createThemeValuesProxy.js +19 -23
- package/src/createThemeValuesProxy.js.map +1 -1
- package/src/createThemeValuesProxy.ts +23 -32
- package/src/types.ts +2 -33
- package/src/validators.js +42 -62
- package/src/validators.js.map +1 -1
- package/src/validators.ts +46 -82
package/src/DefaultTheme.ts
CHANGED
|
@@ -64,84 +64,84 @@ const DraftbitTheme = createTheme({
|
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
typography: {
|
|
67
|
-
body1: {
|
|
68
|
-
...systemWeights.regular,
|
|
69
|
-
fontSize: 16,
|
|
70
|
-
letterSpacing: 0,
|
|
71
|
-
lineHeight: 26,
|
|
72
|
-
},
|
|
73
|
-
body2: {
|
|
74
|
-
...systemWeights.regular,
|
|
75
|
-
fontSize: 14,
|
|
76
|
-
letterSpacing: 0,
|
|
77
|
-
lineHeight: 22,
|
|
78
|
-
},
|
|
79
|
-
button: {
|
|
80
|
-
...systemWeights.bold,
|
|
81
|
-
fontSize: 14,
|
|
82
|
-
letterSpacing: 0,
|
|
83
|
-
lineHeight: 16,
|
|
84
|
-
},
|
|
85
|
-
caption: {
|
|
86
|
-
...systemWeights.regular,
|
|
87
|
-
fontSize: 12,
|
|
88
|
-
letterSpacing: 0,
|
|
89
|
-
lineHeight: 16,
|
|
90
|
-
},
|
|
91
67
|
headline1: {
|
|
92
|
-
...systemWeights.
|
|
68
|
+
...systemWeights.regular,
|
|
93
69
|
fontSize: 60,
|
|
94
70
|
letterSpacing: 0,
|
|
95
71
|
lineHeight: 71,
|
|
96
72
|
},
|
|
97
73
|
headline2: {
|
|
98
|
-
...systemWeights.
|
|
74
|
+
...systemWeights.regular,
|
|
99
75
|
fontSize: 48,
|
|
100
76
|
letterSpacing: 0,
|
|
101
77
|
lineHeight: 58,
|
|
102
78
|
},
|
|
103
79
|
headline3: {
|
|
104
|
-
...systemWeights.
|
|
80
|
+
...systemWeights.regular,
|
|
105
81
|
fontSize: 34,
|
|
106
82
|
letterSpacing: 0,
|
|
107
83
|
lineHeight: 40,
|
|
108
84
|
},
|
|
109
85
|
headline4: {
|
|
110
|
-
...systemWeights.
|
|
86
|
+
...systemWeights.regular,
|
|
111
87
|
fontSize: 24,
|
|
112
88
|
letterSpacing: 0,
|
|
113
89
|
lineHeight: 34,
|
|
114
90
|
},
|
|
115
91
|
headline5: {
|
|
116
|
-
...systemWeights.
|
|
92
|
+
...systemWeights.regular,
|
|
117
93
|
fontSize: 20,
|
|
118
94
|
letterSpacing: 0,
|
|
119
95
|
lineHeight: 26,
|
|
120
96
|
},
|
|
121
|
-
|
|
122
|
-
...systemWeights.
|
|
97
|
+
subtitle1: {
|
|
98
|
+
...systemWeights.regular,
|
|
123
99
|
fontSize: 16,
|
|
124
100
|
letterSpacing: 0,
|
|
125
|
-
lineHeight:
|
|
101
|
+
lineHeight: 26,
|
|
126
102
|
},
|
|
127
|
-
|
|
103
|
+
subtitle2: {
|
|
128
104
|
...systemWeights.regular,
|
|
129
|
-
fontSize:
|
|
130
|
-
letterSpacing:
|
|
131
|
-
lineHeight:
|
|
105
|
+
fontSize: 14,
|
|
106
|
+
letterSpacing: 0,
|
|
107
|
+
lineHeight: 22,
|
|
132
108
|
},
|
|
133
|
-
|
|
109
|
+
body1: {
|
|
134
110
|
...systemWeights.regular,
|
|
135
111
|
fontSize: 16,
|
|
136
112
|
letterSpacing: 0,
|
|
137
113
|
lineHeight: 26,
|
|
138
114
|
},
|
|
139
|
-
|
|
115
|
+
body2: {
|
|
140
116
|
...systemWeights.regular,
|
|
141
117
|
fontSize: 14,
|
|
142
118
|
letterSpacing: 0,
|
|
143
119
|
lineHeight: 22,
|
|
144
120
|
},
|
|
121
|
+
button: {
|
|
122
|
+
...systemWeights.regular,
|
|
123
|
+
fontSize: 14,
|
|
124
|
+
letterSpacing: 0,
|
|
125
|
+
lineHeight: 16,
|
|
126
|
+
},
|
|
127
|
+
caption: {
|
|
128
|
+
...systemWeights.regular,
|
|
129
|
+
fontSize: 12,
|
|
130
|
+
letterSpacing: 0,
|
|
131
|
+
lineHeight: 16,
|
|
132
|
+
},
|
|
133
|
+
overline: {
|
|
134
|
+
...systemWeights.regular,
|
|
135
|
+
fontSize: 12,
|
|
136
|
+
letterSpacing: 2,
|
|
137
|
+
lineHeight: 16,
|
|
138
|
+
},
|
|
139
|
+
headline6: {
|
|
140
|
+
...systemWeights.regular,
|
|
141
|
+
fontSize: 16,
|
|
142
|
+
letterSpacing: 0,
|
|
143
|
+
lineHeight: 24,
|
|
144
|
+
},
|
|
145
145
|
},
|
|
146
146
|
},
|
|
147
147
|
});
|
package/src/Provider.js
CHANGED
|
@@ -3,7 +3,6 @@ import { Dimensions, Platform, useColorScheme } from "react-native";
|
|
|
3
3
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
4
4
|
import createThemeValuesProxy from "./createThemeValuesProxy";
|
|
5
5
|
import DefaultTheme from "./DefaultTheme";
|
|
6
|
-
import { asThemeValuesObject } from "./validators";
|
|
7
6
|
const SAVED_SELECTED_THEME_KEY = "saved_selected_theme";
|
|
8
7
|
const ThemeContext = React.createContext({
|
|
9
8
|
theme: DefaultTheme,
|
|
@@ -29,43 +28,16 @@ const Provider = ({ themes, breakpoints, initialThemeName, children, }) => {
|
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
30
|
}, [themes, setCurrentTheme]);
|
|
32
|
-
const proxiedTheme = React.useMemo(() => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
43
|
-
return {
|
|
44
|
-
...currentTheme,
|
|
45
|
-
colors: {
|
|
46
|
-
branding: createProxiedThemeValue(currentTheme.colors.branding),
|
|
47
|
-
text: createProxiedThemeValue(currentTheme.colors.text),
|
|
48
|
-
background: createProxiedThemeValue(currentTheme.colors.background),
|
|
49
|
-
foreground: createProxiedThemeValue(currentTheme.colors.foreground),
|
|
50
|
-
border: createProxiedThemeValue(currentTheme.colors.border),
|
|
51
|
-
},
|
|
52
|
-
typography: {
|
|
53
|
-
body1: createProxiedTypographyValue(currentTheme.typography.body1),
|
|
54
|
-
body2: createProxiedTypographyValue(currentTheme.typography.body2),
|
|
55
|
-
button: createProxiedTypographyValue(currentTheme.typography.button),
|
|
56
|
-
caption: createProxiedTypographyValue(currentTheme.typography.caption),
|
|
57
|
-
headline1: createProxiedTypographyValue(currentTheme.typography.headline1),
|
|
58
|
-
headline2: createProxiedTypographyValue(currentTheme.typography.headline2),
|
|
59
|
-
headline3: createProxiedTypographyValue(currentTheme.typography.headline3),
|
|
60
|
-
headline4: createProxiedTypographyValue(currentTheme.typography.headline4),
|
|
61
|
-
headline5: createProxiedTypographyValue(currentTheme.typography.headline5),
|
|
62
|
-
headline6: createProxiedTypographyValue(currentTheme.typography.headline6),
|
|
63
|
-
overline: createProxiedTypographyValue(currentTheme.typography.overline),
|
|
64
|
-
subtitle1: createProxiedTypographyValue(currentTheme.typography.subtitle1),
|
|
65
|
-
subtitle2: createProxiedTypographyValue(currentTheme.typography.subtitle2),
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
}, [currentTheme, deviceWidth, breakpoints, lightDarkSelection]);
|
|
31
|
+
const proxiedTheme = React.useMemo(() => ({
|
|
32
|
+
...currentTheme,
|
|
33
|
+
colors: {
|
|
34
|
+
branding: createThemeValuesProxy(currentTheme.colors.branding, breakpoints, deviceWidth, Platform.OS, lightDarkSelection),
|
|
35
|
+
text: createThemeValuesProxy(currentTheme.colors.text, breakpoints, deviceWidth, Platform.OS, lightDarkSelection),
|
|
36
|
+
background: createThemeValuesProxy(currentTheme.colors.background, breakpoints, deviceWidth, Platform.OS, lightDarkSelection),
|
|
37
|
+
foreground: createThemeValuesProxy(currentTheme.colors.foreground, breakpoints, deviceWidth, Platform.OS, lightDarkSelection),
|
|
38
|
+
border: createThemeValuesProxy(currentTheme.colors.border, breakpoints, deviceWidth, Platform.OS, lightDarkSelection),
|
|
39
|
+
},
|
|
40
|
+
}), [currentTheme, deviceWidth, breakpoints, lightDarkSelection]);
|
|
69
41
|
React.useEffect(() => {
|
|
70
42
|
const listener = Dimensions.addEventListener("change", ({ window }) => setDeviceWidth(window.width));
|
|
71
43
|
return () => {
|
package/src/Provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.js","sourceRoot":"","sources":["Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"Provider.js","sourceRoot":"","sources":["Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OA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AmB,EAAE,EAAE;QACnD,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QACjD,OAAO,oBAAC,SAAS,OAAM,KAAe,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;IACrE,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC"}
|
package/src/Provider.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Dimensions, Platform, useColorScheme
|
|
2
|
+
import { Dimensions, Platform, useColorScheme } from "react-native";
|
|
3
3
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
4
4
|
import createThemeValuesProxy from "./createThemeValuesProxy";
|
|
5
5
|
import DefaultTheme from "./DefaultTheme";
|
|
@@ -7,10 +7,8 @@ import {
|
|
|
7
7
|
Breakpoints,
|
|
8
8
|
ChangeThemeOptions,
|
|
9
9
|
ReadTheme,
|
|
10
|
-
ThemeValues,
|
|
11
10
|
ValidatedTheme,
|
|
12
11
|
} from "./types";
|
|
13
|
-
import { asThemeValuesObject } from "./validators";
|
|
14
12
|
|
|
15
13
|
const SAVED_SELECTED_THEME_KEY = "saved_selected_theme";
|
|
16
14
|
|
|
@@ -68,71 +66,49 @@ const Provider: React.FC<React.PropsWithChildren<ProviderProps>> = ({
|
|
|
68
66
|
[themes, setCurrentTheme]
|
|
69
67
|
);
|
|
70
68
|
|
|
71
|
-
const proxiedTheme: ReadTheme = React.useMemo(
|
|
72
|
-
|
|
73
|
-
createThemeValuesProxy(
|
|
74
|
-
value,
|
|
75
|
-
breakpoints,
|
|
76
|
-
deviceWidth,
|
|
77
|
-
Platform.OS,
|
|
78
|
-
lightDarkSelection
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
const createProxiedTypographyValue = (
|
|
82
|
-
value: TextStyle | ThemeValues | undefined
|
|
83
|
-
) => {
|
|
84
|
-
const valueAsThemeValues = asThemeValuesObject(value);
|
|
85
|
-
if (valueAsThemeValues) {
|
|
86
|
-
return createProxiedThemeValue(valueAsThemeValues);
|
|
87
|
-
} else {
|
|
88
|
-
return value;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
return {
|
|
69
|
+
const proxiedTheme: ReadTheme = React.useMemo(
|
|
70
|
+
() => ({
|
|
93
71
|
...currentTheme,
|
|
94
72
|
colors: {
|
|
95
|
-
branding:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
typography: {
|
|
102
|
-
body1: createProxiedTypographyValue(currentTheme.typography.body1),
|
|
103
|
-
body2: createProxiedTypographyValue(currentTheme.typography.body2),
|
|
104
|
-
button: createProxiedTypographyValue(currentTheme.typography.button),
|
|
105
|
-
caption: createProxiedTypographyValue(currentTheme.typography.caption),
|
|
106
|
-
headline1: createProxiedTypographyValue(
|
|
107
|
-
currentTheme.typography.headline1
|
|
73
|
+
branding: createThemeValuesProxy(
|
|
74
|
+
currentTheme.colors.branding,
|
|
75
|
+
breakpoints,
|
|
76
|
+
deviceWidth,
|
|
77
|
+
Platform.OS,
|
|
78
|
+
lightDarkSelection
|
|
108
79
|
),
|
|
109
|
-
|
|
110
|
-
currentTheme.
|
|
80
|
+
text: createThemeValuesProxy(
|
|
81
|
+
currentTheme.colors.text,
|
|
82
|
+
breakpoints,
|
|
83
|
+
deviceWidth,
|
|
84
|
+
Platform.OS,
|
|
85
|
+
lightDarkSelection
|
|
111
86
|
),
|
|
112
|
-
|
|
113
|
-
currentTheme.
|
|
87
|
+
background: createThemeValuesProxy(
|
|
88
|
+
currentTheme.colors.background,
|
|
89
|
+
breakpoints,
|
|
90
|
+
deviceWidth,
|
|
91
|
+
Platform.OS,
|
|
92
|
+
lightDarkSelection
|
|
114
93
|
),
|
|
115
|
-
|
|
116
|
-
currentTheme.
|
|
94
|
+
foreground: createThemeValuesProxy(
|
|
95
|
+
currentTheme.colors.foreground,
|
|
96
|
+
breakpoints,
|
|
97
|
+
deviceWidth,
|
|
98
|
+
Platform.OS,
|
|
99
|
+
lightDarkSelection
|
|
117
100
|
),
|
|
118
|
-
|
|
119
|
-
currentTheme.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
overline: createProxiedTypographyValue(
|
|
125
|
-
currentTheme.typography.overline
|
|
126
|
-
),
|
|
127
|
-
subtitle1: createProxiedTypographyValue(
|
|
128
|
-
currentTheme.typography.subtitle1
|
|
129
|
-
),
|
|
130
|
-
subtitle2: createProxiedTypographyValue(
|
|
131
|
-
currentTheme.typography.subtitle2
|
|
101
|
+
border: createThemeValuesProxy(
|
|
102
|
+
currentTheme.colors.border,
|
|
103
|
+
breakpoints,
|
|
104
|
+
deviceWidth,
|
|
105
|
+
Platform.OS,
|
|
106
|
+
lightDarkSelection
|
|
132
107
|
),
|
|
133
108
|
},
|
|
134
|
-
}
|
|
135
|
-
|
|
109
|
+
}),
|
|
110
|
+
[currentTheme, deviceWidth, breakpoints, lightDarkSelection]
|
|
111
|
+
);
|
|
136
112
|
|
|
137
113
|
React.useEffect(() => {
|
|
138
114
|
const listener = Dimensions.addEventListener("change", ({ window }) =>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isObject } from "lodash";
|
|
2
2
|
/**
|
|
3
3
|
* Creates a proxy for theme value objects to select a value whenever
|
|
4
4
|
* multiple values are provided for different platforms, breakpoints, and/or light/dark modes
|
|
@@ -13,31 +13,30 @@ export default function createThemeValuesProxy(value, breakpoints, deviceWidth,
|
|
|
13
13
|
return new Proxy(value, {
|
|
14
14
|
get: (target, key) => {
|
|
15
15
|
const currentValue = target[key];
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
if (!isObject(currentValue)) {
|
|
17
|
+
return currentValue;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
18
20
|
const platformKeys = ["ios", "android", "web", "macos", "windows"];
|
|
19
21
|
const breakpointKeys = Object.keys(breakpoints);
|
|
20
22
|
const lightDarkKeys = ["light", "dark"];
|
|
21
|
-
const keysType = getKeysType(
|
|
23
|
+
const keysType = getKeysType(currentValue, platformKeys, breakpointKeys, lightDarkKeys);
|
|
22
24
|
if (keysType === "default") {
|
|
23
|
-
return createThemeValuesProxy(
|
|
25
|
+
return createThemeValuesProxy(currentValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
24
26
|
}
|
|
25
27
|
else if (keysType === "platform") {
|
|
26
|
-
return getPlatformValue(
|
|
28
|
+
return getPlatformValue(currentValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
27
29
|
}
|
|
28
30
|
else if (keysType === "breakpoint") {
|
|
29
|
-
return getBreakpointValue(
|
|
31
|
+
return getBreakpointValue(currentValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
30
32
|
}
|
|
31
33
|
else if (keysType === "lightDark") {
|
|
32
|
-
return getLightDarkValue(
|
|
34
|
+
return getLightDarkValue(currentValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
33
35
|
}
|
|
34
36
|
else {
|
|
35
37
|
return undefined;
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
|
-
else {
|
|
39
|
-
return currentValue;
|
|
40
|
-
}
|
|
41
40
|
},
|
|
42
41
|
set: () => {
|
|
43
42
|
throw new Error("Theme is read only, cannot be modified at runtime");
|
|
@@ -79,12 +78,11 @@ function allFalse(a, b, c, d) {
|
|
|
79
78
|
function getPlatformValue(value, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection) {
|
|
80
79
|
var _a;
|
|
81
80
|
const currentPlatformValue = (_a = value[devicePlatform]) !== null && _a !== void 0 ? _a : value.default;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return createThemeValuesProxy(valueAsThemeValues, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
81
|
+
if (!isObject(currentPlatformValue)) {
|
|
82
|
+
return currentPlatformValue;
|
|
85
83
|
}
|
|
86
84
|
else {
|
|
87
|
-
return currentPlatformValue;
|
|
85
|
+
return createThemeValuesProxy(currentPlatformValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
88
86
|
}
|
|
89
87
|
}
|
|
90
88
|
function getBreakpointValue(value, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection) {
|
|
@@ -98,23 +96,21 @@ function getBreakpointValue(value, breakpoints, deviceWidth, devicePlatform, cur
|
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
98
|
const currentBreakpointValue = (_a = value[currentBreakpointKey]) !== null && _a !== void 0 ? _a : value.default;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return createThemeValuesProxy(valueAsThemeValues, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
99
|
+
if (!isObject(currentBreakpointValue)) {
|
|
100
|
+
return currentBreakpointValue;
|
|
104
101
|
}
|
|
105
102
|
else {
|
|
106
|
-
return currentBreakpointValue;
|
|
103
|
+
return createThemeValuesProxy(currentBreakpointValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
107
104
|
}
|
|
108
105
|
}
|
|
109
106
|
function getLightDarkValue(value, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection) {
|
|
110
107
|
var _a;
|
|
111
108
|
const currentLightDarkValue = (_a = value[currentLightDarkSelection]) !== null && _a !== void 0 ? _a : value.default;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return createThemeValuesProxy(valueAsThemeValues, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
109
|
+
if (!isObject(currentLightDarkValue)) {
|
|
110
|
+
return currentLightDarkValue;
|
|
115
111
|
}
|
|
116
112
|
else {
|
|
117
|
-
return currentLightDarkValue;
|
|
113
|
+
return createThemeValuesProxy(currentLightDarkValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
118
114
|
}
|
|
119
115
|
}
|
|
120
116
|
//# sourceMappingURL=createThemeValuesProxy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createThemeValuesProxy.js","sourceRoot":"","sources":["createThemeValuesProxy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"createThemeValuesProxy.js","sourceRoot":"","sources":["createThemeValuesProxy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,KAA8B,EAC9B,WAAwB,EACxB,WAAmB,EACnB,cAAkC,EAClC,yBAA2C;IAE3C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE;QACzC,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE;QACtB,GAAG,EAAE,CACH,MAAmB,EACnB,GAAW,EACgC,EAAE;YAC7C,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YACjC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;gBAC3B,OAAO,YAAY,CAAC;aACrB;iBAAM;gBACL,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;gBACnE,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBAChD,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;gBACxC,MAAM,QAAQ,GAAG,WAAW,CAC1B,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,aAAa,CACd,CAAC;gBAEF,IAAI,QAAQ,KAAK,SAAS,EAAE;oBAC1B,OAAO,sBAAsB,CAC3B,YAAY,EACZ,WAAW,EACX,WAAW,EACX,c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C,MAAM,qBAAqB,GACzB,MAAA,KAAK,CAAC,yBAAyB,CAAC,mCAAI,KAAK,CAAC,OAAO,CAAC;IAEpD,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE;QACpC,OAAO,qBAAqB,CAAC;KAC9B;SAAM;QACL,OAAO,sBAAsB,CAC3B,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,cAAc,EACd,yBAAyB,CAC1B,CAAC;KACH;AACH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ThemeValues, Breakpoints } from "./types";
|
|
2
|
-
import { Platform
|
|
3
|
-
import {
|
|
2
|
+
import { Platform } from "react-native";
|
|
3
|
+
import { isObject } from "lodash";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Creates a proxy for theme value objects to select a value whenever
|
|
@@ -23,18 +23,16 @@ export default function createThemeValuesProxy(
|
|
|
23
23
|
get: (
|
|
24
24
|
target: ThemeValues,
|
|
25
25
|
key: string
|
|
26
|
-
): string | number | ThemeValues |
|
|
26
|
+
): string | number | ThemeValues | undefined => {
|
|
27
27
|
const currentValue = target[key];
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (valueAsThemeValues) {
|
|
28
|
+
if (!isObject(currentValue)) {
|
|
29
|
+
return currentValue;
|
|
30
|
+
} else {
|
|
32
31
|
const platformKeys = ["ios", "android", "web", "macos", "windows"];
|
|
33
32
|
const breakpointKeys = Object.keys(breakpoints);
|
|
34
33
|
const lightDarkKeys = ["light", "dark"];
|
|
35
|
-
|
|
36
34
|
const keysType = getKeysType(
|
|
37
|
-
|
|
35
|
+
currentValue,
|
|
38
36
|
platformKeys,
|
|
39
37
|
breakpointKeys,
|
|
40
38
|
lightDarkKeys
|
|
@@ -42,7 +40,7 @@ export default function createThemeValuesProxy(
|
|
|
42
40
|
|
|
43
41
|
if (keysType === "default") {
|
|
44
42
|
return createThemeValuesProxy(
|
|
45
|
-
|
|
43
|
+
currentValue,
|
|
46
44
|
breakpoints,
|
|
47
45
|
deviceWidth,
|
|
48
46
|
devicePlatform,
|
|
@@ -50,7 +48,7 @@ export default function createThemeValuesProxy(
|
|
|
50
48
|
);
|
|
51
49
|
} else if (keysType === "platform") {
|
|
52
50
|
return getPlatformValue(
|
|
53
|
-
|
|
51
|
+
currentValue,
|
|
54
52
|
breakpoints,
|
|
55
53
|
deviceWidth,
|
|
56
54
|
devicePlatform,
|
|
@@ -58,7 +56,7 @@ export default function createThemeValuesProxy(
|
|
|
58
56
|
);
|
|
59
57
|
} else if (keysType === "breakpoint") {
|
|
60
58
|
return getBreakpointValue(
|
|
61
|
-
|
|
59
|
+
currentValue,
|
|
62
60
|
breakpoints,
|
|
63
61
|
deviceWidth,
|
|
64
62
|
devicePlatform,
|
|
@@ -66,7 +64,7 @@ export default function createThemeValuesProxy(
|
|
|
66
64
|
);
|
|
67
65
|
} else if (keysType === "lightDark") {
|
|
68
66
|
return getLightDarkValue(
|
|
69
|
-
|
|
67
|
+
currentValue,
|
|
70
68
|
breakpoints,
|
|
71
69
|
deviceWidth,
|
|
72
70
|
devicePlatform,
|
|
@@ -75,8 +73,6 @@ export default function createThemeValuesProxy(
|
|
|
75
73
|
} else {
|
|
76
74
|
return undefined;
|
|
77
75
|
}
|
|
78
|
-
} else {
|
|
79
|
-
return currentValue;
|
|
80
76
|
}
|
|
81
77
|
},
|
|
82
78
|
set: () => {
|
|
@@ -151,18 +147,16 @@ function getPlatformValue(
|
|
|
151
147
|
currentLightDarkSelection: "light" | "dark"
|
|
152
148
|
) {
|
|
153
149
|
const currentPlatformValue = value[devicePlatform] ?? value.default;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
if (!isObject(currentPlatformValue)) {
|
|
151
|
+
return currentPlatformValue;
|
|
152
|
+
} else {
|
|
157
153
|
return createThemeValuesProxy(
|
|
158
|
-
|
|
154
|
+
currentPlatformValue,
|
|
159
155
|
breakpoints,
|
|
160
156
|
deviceWidth,
|
|
161
157
|
devicePlatform,
|
|
162
158
|
currentLightDarkSelection
|
|
163
159
|
);
|
|
164
|
-
} else {
|
|
165
|
-
return currentPlatformValue;
|
|
166
160
|
}
|
|
167
161
|
}
|
|
168
162
|
|
|
@@ -184,18 +178,16 @@ function getBreakpointValue(
|
|
|
184
178
|
}
|
|
185
179
|
}
|
|
186
180
|
const currentBreakpointValue = value[currentBreakpointKey] ?? value.default;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
181
|
+
if (!isObject(currentBreakpointValue)) {
|
|
182
|
+
return currentBreakpointValue;
|
|
183
|
+
} else {
|
|
190
184
|
return createThemeValuesProxy(
|
|
191
|
-
|
|
185
|
+
currentBreakpointValue,
|
|
192
186
|
breakpoints,
|
|
193
187
|
deviceWidth,
|
|
194
188
|
devicePlatform,
|
|
195
189
|
currentLightDarkSelection
|
|
196
190
|
);
|
|
197
|
-
} else {
|
|
198
|
-
return currentBreakpointValue;
|
|
199
191
|
}
|
|
200
192
|
}
|
|
201
193
|
|
|
@@ -208,17 +200,16 @@ function getLightDarkValue(
|
|
|
208
200
|
) {
|
|
209
201
|
const currentLightDarkValue =
|
|
210
202
|
value[currentLightDarkSelection] ?? value.default;
|
|
211
|
-
const valueAsThemeValues = asThemeValuesObject(currentLightDarkValue);
|
|
212
203
|
|
|
213
|
-
if (
|
|
204
|
+
if (!isObject(currentLightDarkValue)) {
|
|
205
|
+
return currentLightDarkValue;
|
|
206
|
+
} else {
|
|
214
207
|
return createThemeValuesProxy(
|
|
215
|
-
|
|
208
|
+
currentLightDarkValue,
|
|
216
209
|
breakpoints,
|
|
217
210
|
deviceWidth,
|
|
218
211
|
devicePlatform,
|
|
219
212
|
currentLightDarkSelection
|
|
220
213
|
);
|
|
221
|
-
} else {
|
|
222
|
-
return currentLightDarkValue;
|
|
223
214
|
}
|
|
224
215
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { TextStyle } from "react-native";
|
|
2
|
-
|
|
3
1
|
export type ThemeValues = {
|
|
4
|
-
[key: string]: string | number |
|
|
2
|
+
[key: string]: string | number | ThemeValues;
|
|
5
3
|
};
|
|
6
4
|
|
|
7
5
|
export type Theme = {
|
|
@@ -13,21 +11,7 @@ export type Theme = {
|
|
|
13
11
|
foreground?: ThemeValues;
|
|
14
12
|
border?: ThemeValues;
|
|
15
13
|
};
|
|
16
|
-
typography: {
|
|
17
|
-
body1?: ThemeValues | TextStyle;
|
|
18
|
-
body2?: ThemeValues | TextStyle;
|
|
19
|
-
button?: ThemeValues | TextStyle;
|
|
20
|
-
caption?: ThemeValues | TextStyle;
|
|
21
|
-
headline1?: ThemeValues | TextStyle;
|
|
22
|
-
headline2?: ThemeValues | TextStyle;
|
|
23
|
-
headline3?: ThemeValues | TextStyle;
|
|
24
|
-
headline4?: ThemeValues | TextStyle;
|
|
25
|
-
headline5?: ThemeValues | TextStyle;
|
|
26
|
-
headline6?: ThemeValues | TextStyle;
|
|
27
|
-
overline?: ThemeValues | TextStyle;
|
|
28
|
-
subtitle1?: ThemeValues | TextStyle;
|
|
29
|
-
subtitle2?: ThemeValues | TextStyle;
|
|
30
|
-
};
|
|
14
|
+
typography: { [key: string]: any }; //TODO: Update theme to support typography. Left as 'any' for legacy support until updated and migrated
|
|
31
15
|
};
|
|
32
16
|
|
|
33
17
|
export type ValidatedTheme = Theme & {
|
|
@@ -42,21 +26,6 @@ export type ReadTheme = Theme & {
|
|
|
42
26
|
foreground?: any;
|
|
43
27
|
border?: any;
|
|
44
28
|
};
|
|
45
|
-
typography: {
|
|
46
|
-
body1?: any;
|
|
47
|
-
body2?: any;
|
|
48
|
-
button?: any;
|
|
49
|
-
caption?: any;
|
|
50
|
-
headline1?: any;
|
|
51
|
-
headline2?: any;
|
|
52
|
-
headline3?: any;
|
|
53
|
-
headline4?: any;
|
|
54
|
-
headline5?: any;
|
|
55
|
-
headline6?: any;
|
|
56
|
-
overline?: any;
|
|
57
|
-
subtitle1?: any;
|
|
58
|
-
subtitle2?: any;
|
|
59
|
-
};
|
|
60
29
|
};
|
|
61
30
|
|
|
62
31
|
export type ColorPaletteValues = {
|