@draftbit/theme 50.6.2-4142fd.2 → 50.6.2-8430ca.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/createTheme.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 +11 -29
- package/lib/typescript/src/Provider.js.map +1 -1
- package/lib/typescript/src/createTheme.d.ts +0 -12
- package/lib/typescript/src/createTheme.js +1 -13
- package/lib/typescript/src/createTheme.js.map +1 -1
- package/lib/typescript/src/createThemeValuesProxy.d.ts +1 -9
- package/lib/typescript/src/createThemeValuesProxy.js +26 -48
- 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 -3
- package/lib/typescript/src/validators.js +42 -81
- 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 +11 -29
- package/src/Provider.js.map +1 -1
- package/src/Provider.tsx +41 -29
- package/src/createTheme.js +1 -13
- package/src/createTheme.js.map +1 -1
- package/src/createTheme.ts +1 -14
- package/src/createThemeValuesProxy.js +26 -48
- package/src/createThemeValuesProxy.js.map +1 -1
- package/src/createThemeValuesProxy.ts +95 -75
- package/src/types.ts +2 -33
- package/src/validators.js +42 -81
- package/src/validators.js.map +1 -1
- package/src/validators.ts +46 -103
package/src/DefaultTheme.js
CHANGED
|
@@ -61,84 +61,84 @@ const DraftbitTheme = createTheme({
|
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
63
|
typography: {
|
|
64
|
-
body1: {
|
|
65
|
-
...systemWeights.regular,
|
|
66
|
-
fontSize: 16,
|
|
67
|
-
letterSpacing: 0,
|
|
68
|
-
lineHeight: 26,
|
|
69
|
-
},
|
|
70
|
-
body2: {
|
|
71
|
-
...systemWeights.regular,
|
|
72
|
-
fontSize: 14,
|
|
73
|
-
letterSpacing: 0,
|
|
74
|
-
lineHeight: 22,
|
|
75
|
-
},
|
|
76
|
-
button: {
|
|
77
|
-
...systemWeights.bold,
|
|
78
|
-
fontSize: 14,
|
|
79
|
-
letterSpacing: 0,
|
|
80
|
-
lineHeight: 16,
|
|
81
|
-
},
|
|
82
|
-
caption: {
|
|
83
|
-
...systemWeights.regular,
|
|
84
|
-
fontSize: 12,
|
|
85
|
-
letterSpacing: 0,
|
|
86
|
-
lineHeight: 16,
|
|
87
|
-
},
|
|
88
64
|
headline1: {
|
|
89
|
-
...systemWeights.
|
|
65
|
+
...systemWeights.regular,
|
|
90
66
|
fontSize: 60,
|
|
91
67
|
letterSpacing: 0,
|
|
92
68
|
lineHeight: 71,
|
|
93
69
|
},
|
|
94
70
|
headline2: {
|
|
95
|
-
...systemWeights.
|
|
71
|
+
...systemWeights.regular,
|
|
96
72
|
fontSize: 48,
|
|
97
73
|
letterSpacing: 0,
|
|
98
74
|
lineHeight: 58,
|
|
99
75
|
},
|
|
100
76
|
headline3: {
|
|
101
|
-
...systemWeights.
|
|
77
|
+
...systemWeights.regular,
|
|
102
78
|
fontSize: 34,
|
|
103
79
|
letterSpacing: 0,
|
|
104
80
|
lineHeight: 40,
|
|
105
81
|
},
|
|
106
82
|
headline4: {
|
|
107
|
-
...systemWeights.
|
|
83
|
+
...systemWeights.regular,
|
|
108
84
|
fontSize: 24,
|
|
109
85
|
letterSpacing: 0,
|
|
110
86
|
lineHeight: 34,
|
|
111
87
|
},
|
|
112
88
|
headline5: {
|
|
113
|
-
...systemWeights.
|
|
89
|
+
...systemWeights.regular,
|
|
114
90
|
fontSize: 20,
|
|
115
91
|
letterSpacing: 0,
|
|
116
92
|
lineHeight: 26,
|
|
117
93
|
},
|
|
118
|
-
|
|
119
|
-
...systemWeights.
|
|
94
|
+
subtitle1: {
|
|
95
|
+
...systemWeights.regular,
|
|
120
96
|
fontSize: 16,
|
|
121
97
|
letterSpacing: 0,
|
|
122
|
-
lineHeight:
|
|
98
|
+
lineHeight: 26,
|
|
123
99
|
},
|
|
124
|
-
|
|
100
|
+
subtitle2: {
|
|
125
101
|
...systemWeights.regular,
|
|
126
|
-
fontSize:
|
|
127
|
-
letterSpacing:
|
|
128
|
-
lineHeight:
|
|
102
|
+
fontSize: 14,
|
|
103
|
+
letterSpacing: 0,
|
|
104
|
+
lineHeight: 22,
|
|
129
105
|
},
|
|
130
|
-
|
|
106
|
+
body1: {
|
|
131
107
|
...systemWeights.regular,
|
|
132
108
|
fontSize: 16,
|
|
133
109
|
letterSpacing: 0,
|
|
134
110
|
lineHeight: 26,
|
|
135
111
|
},
|
|
136
|
-
|
|
112
|
+
body2: {
|
|
137
113
|
...systemWeights.regular,
|
|
138
114
|
fontSize: 14,
|
|
139
115
|
letterSpacing: 0,
|
|
140
116
|
lineHeight: 22,
|
|
141
117
|
},
|
|
118
|
+
button: {
|
|
119
|
+
...systemWeights.regular,
|
|
120
|
+
fontSize: 14,
|
|
121
|
+
letterSpacing: 0,
|
|
122
|
+
lineHeight: 16,
|
|
123
|
+
},
|
|
124
|
+
caption: {
|
|
125
|
+
...systemWeights.regular,
|
|
126
|
+
fontSize: 12,
|
|
127
|
+
letterSpacing: 0,
|
|
128
|
+
lineHeight: 16,
|
|
129
|
+
},
|
|
130
|
+
overline: {
|
|
131
|
+
...systemWeights.regular,
|
|
132
|
+
fontSize: 12,
|
|
133
|
+
letterSpacing: 2,
|
|
134
|
+
lineHeight: 16,
|
|
135
|
+
},
|
|
136
|
+
headline6: {
|
|
137
|
+
...systemWeights.regular,
|
|
138
|
+
fontSize: 16,
|
|
139
|
+
letterSpacing: 0,
|
|
140
|
+
lineHeight: 24,
|
|
141
|
+
},
|
|
142
142
|
},
|
|
143
143
|
},
|
|
144
144
|
});
|
package/src/DefaultTheme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultTheme.js","sourceRoot":"","sources":["DefaultTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,WAAW,MAAM,eAAe,CAAC;AAGxC,MAAM,QAAQ,GAAkB;IAC9B,QAAQ,EAAE;QACR,OAAO,EAAE,kBAAkB;QAC3B,SAAS,EAAE,mBAAmB;QAC9B,QAAQ,EAAE,gBAAgB;QAC1B,UAAU,EAAE,wBAAwB;QACpC,KAAK,EAAE,uBAAuB;QAC9B,OAAO,EAAE,wBAAwB;QACjC,MAAM,EAAE,qBAAqB;QAC7B,MAAM,EAAE,qBAAqB;QAC7B,KAAK,EAAE,wBAAwB;QAC/B,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;KAChB;CACF,CAAC;AAEF,MAAM,aAAa,GAAG,WAAW,CAAC;IAChC,WAAW,EAAE,EAAE;IACf,QAAQ;IACR,KAAK,EAAE;QACL,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO;gBAClC,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,SAAS;gBACtC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ;gBACpC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,SAAS;aACpC;YACD,IAAI,EAAE;gBACJ,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM;gBAChC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM;gBAChC,MAAM,EAAE,QAAQ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ACZ,aAAa,EAAE,CAAC;gBAChB,UAAU,EAAE,EAAE;aACf;SACF;KACF;CACF,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC"}
|
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
|
@@ -28,26 +28,16 @@ const Provider = ({ themes, breakpoints, initialThemeName, children, }) => {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
}, [themes, setCurrentTheme]);
|
|
31
|
-
const proxiedTheme = React.useMemo(() => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
breakpoints,
|
|
35
|
-
deviceWidth,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
colors: {
|
|
42
|
-
branding: createProxiedThemeValue(currentTheme.colors.branding),
|
|
43
|
-
text: createProxiedThemeValue(currentTheme.colors.text),
|
|
44
|
-
background: createProxiedThemeValue(currentTheme.colors.background),
|
|
45
|
-
foreground: createProxiedThemeValue(currentTheme.colors.foreground),
|
|
46
|
-
border: createProxiedThemeValue(currentTheme.colors.border),
|
|
47
|
-
},
|
|
48
|
-
typography: currentTheme.typography,
|
|
49
|
-
};
|
|
50
|
-
}, [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]);
|
|
51
41
|
React.useEffect(() => {
|
|
52
42
|
const listener = Dimensions.addEventListener("change", ({ window }) => setDeviceWidth(window.width));
|
|
53
43
|
return () => {
|
|
@@ -57,16 +47,8 @@ const Provider = ({ themes, breakpoints, initialThemeName, children, }) => {
|
|
|
57
47
|
React.useEffect(() => {
|
|
58
48
|
const run = async () => {
|
|
59
49
|
const savedSelectedThemeName = await AsyncStorage.getItem(SAVED_SELECTED_THEME_KEY);
|
|
60
|
-
const themeExists = themes.some((t) => t.name === savedSelectedThemeName);
|
|
61
50
|
if (savedSelectedThemeName) {
|
|
62
|
-
|
|
63
|
-
changeTheme(savedSelectedThemeName);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
AsyncStorage.removeItem(SAVED_SELECTED_THEME_KEY).catch((e) => {
|
|
67
|
-
console.warn("Failed to reset persisted selected theme", e);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
51
|
+
changeTheme(savedSelectedThemeName);
|
|
70
52
|
}
|
|
71
53
|
};
|
|
72
54
|
run();
|
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,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,YAAY,MAAM,2CAA2C,CAAC;AACrE,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,YAAY,MAAM,gBAAgB,CAAC;
|
|
1
|
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;AAEF,MAAM,SAAS,GAAG,CAChB,SAAqC,EACrC,EAAE;IACF,OAAO,KAAK,CAAC,UAAU,CACrB,CAAC,KAA2B,EAAE,GAAmB,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
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
Breakpoints,
|
|
8
8
|
ChangeThemeOptions,
|
|
9
9
|
ReadTheme,
|
|
10
|
-
ThemeValues,
|
|
11
10
|
ValidatedTheme,
|
|
12
11
|
} from "./types";
|
|
13
12
|
|
|
@@ -67,28 +66,49 @@ const Provider: React.FC<React.PropsWithChildren<ProviderProps>> = ({
|
|
|
67
66
|
[themes, setCurrentTheme]
|
|
68
67
|
);
|
|
69
68
|
|
|
70
|
-
const proxiedTheme: ReadTheme = React.useMemo(
|
|
71
|
-
|
|
72
|
-
createThemeValuesProxy({
|
|
73
|
-
value,
|
|
74
|
-
breakpoints,
|
|
75
|
-
deviceWidth,
|
|
76
|
-
devicePlatform: Platform.OS,
|
|
77
|
-
currentLightDarkSelection: lightDarkSelection,
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
return {
|
|
69
|
+
const proxiedTheme: ReadTheme = React.useMemo(
|
|
70
|
+
() => ({
|
|
81
71
|
...currentTheme,
|
|
82
72
|
colors: {
|
|
83
|
-
branding:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
branding: createThemeValuesProxy(
|
|
74
|
+
currentTheme.colors.branding,
|
|
75
|
+
breakpoints,
|
|
76
|
+
deviceWidth,
|
|
77
|
+
Platform.OS,
|
|
78
|
+
lightDarkSelection
|
|
79
|
+
),
|
|
80
|
+
text: createThemeValuesProxy(
|
|
81
|
+
currentTheme.colors.text,
|
|
82
|
+
breakpoints,
|
|
83
|
+
deviceWidth,
|
|
84
|
+
Platform.OS,
|
|
85
|
+
lightDarkSelection
|
|
86
|
+
),
|
|
87
|
+
background: createThemeValuesProxy(
|
|
88
|
+
currentTheme.colors.background,
|
|
89
|
+
breakpoints,
|
|
90
|
+
deviceWidth,
|
|
91
|
+
Platform.OS,
|
|
92
|
+
lightDarkSelection
|
|
93
|
+
),
|
|
94
|
+
foreground: createThemeValuesProxy(
|
|
95
|
+
currentTheme.colors.foreground,
|
|
96
|
+
breakpoints,
|
|
97
|
+
deviceWidth,
|
|
98
|
+
Platform.OS,
|
|
99
|
+
lightDarkSelection
|
|
100
|
+
),
|
|
101
|
+
border: createThemeValuesProxy(
|
|
102
|
+
currentTheme.colors.border,
|
|
103
|
+
breakpoints,
|
|
104
|
+
deviceWidth,
|
|
105
|
+
Platform.OS,
|
|
106
|
+
lightDarkSelection
|
|
107
|
+
),
|
|
88
108
|
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
109
|
+
}),
|
|
110
|
+
[currentTheme, deviceWidth, breakpoints, lightDarkSelection]
|
|
111
|
+
);
|
|
92
112
|
|
|
93
113
|
React.useEffect(() => {
|
|
94
114
|
const listener = Dimensions.addEventListener("change", ({ window }) =>
|
|
@@ -104,16 +124,8 @@ const Provider: React.FC<React.PropsWithChildren<ProviderProps>> = ({
|
|
|
104
124
|
const savedSelectedThemeName = await AsyncStorage.getItem(
|
|
105
125
|
SAVED_SELECTED_THEME_KEY
|
|
106
126
|
);
|
|
107
|
-
const themeExists = themes.some((t) => t.name === savedSelectedThemeName);
|
|
108
|
-
|
|
109
127
|
if (savedSelectedThemeName) {
|
|
110
|
-
|
|
111
|
-
changeTheme(savedSelectedThemeName);
|
|
112
|
-
} else {
|
|
113
|
-
AsyncStorage.removeItem(SAVED_SELECTED_THEME_KEY).catch((e) => {
|
|
114
|
-
console.warn("Failed to reset persisted selected theme", e);
|
|
115
|
-
});
|
|
116
|
-
}
|
|
128
|
+
changeTheme(savedSelectedThemeName);
|
|
117
129
|
}
|
|
118
130
|
};
|
|
119
131
|
run();
|
package/src/createTheme.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
import { validateBreakpoints, validatePalettes, validateTheme, } from "./validators";
|
|
2
1
|
import merge from "deepmerge";
|
|
3
|
-
|
|
4
|
-
* Custom deepmerge function to skip merging of typography/text style objects.
|
|
5
|
-
*
|
|
6
|
-
* The theme object allows for special keys that trigger variability depending
|
|
7
|
-
* on platform, breakpoint, color mode, etc.
|
|
8
|
-
*
|
|
9
|
-
* Text style objects can break this logic when merged with other objects.
|
|
10
|
-
* For example, if you merge a standard text style object with another object that
|
|
11
|
-
* has variability through the special keys, you get an object with both special
|
|
12
|
-
* keys and the keys of the style object which breaks how the proxy is able to
|
|
13
|
-
* return the correct value.
|
|
14
|
-
*/
|
|
2
|
+
import { validateBreakpoints, validatePalettes, validateTheme, } from "./validators";
|
|
15
3
|
export default function createTheme({ breakpoints, palettes, theme, baseTheme, }) {
|
|
16
4
|
validateBreakpoints(breakpoints);
|
|
17
5
|
validatePalettes(palettes);
|
package/src/createTheme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTheme.js","sourceRoot":"","sources":["createTheme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createTheme.js","sourceRoot":"","sources":["createTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,WAAW,CAAC;AAO9B,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,WAAW,EACX,QAAQ,EACR,KAAK,EACL,SAAS,GAMV;IACC,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACjC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC3B,aAAa,CAAC,KAAK,CAAC,CAAC;IAErB,IAAI,WAAW,GAAG,KAAK,CAAC;IAExB,IAAI,SAAS,EAAE;QACb,aAAa,CAAC,SAAS,CAAC,CAAC;QACzB,WAAW,GAAG,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;KACvC;IAED,OAAO;QACL,GAAG,WAAW;QACd,SAAS,EAAE,IAAI;KAChB,CAAC;AACJ,CAAC"}
|
package/src/createTheme.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import merge from "deepmerge";
|
|
1
2
|
import type {
|
|
2
3
|
Breakpoints,
|
|
3
4
|
Theme,
|
|
@@ -9,20 +10,6 @@ import {
|
|
|
9
10
|
validatePalettes,
|
|
10
11
|
validateTheme,
|
|
11
12
|
} from "./validators";
|
|
12
|
-
import merge from "deepmerge";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Custom deepmerge function to skip merging of typography/text style objects.
|
|
16
|
-
*
|
|
17
|
-
* The theme object allows for special keys that trigger variability depending
|
|
18
|
-
* on platform, breakpoint, color mode, etc.
|
|
19
|
-
*
|
|
20
|
-
* Text style objects can break this logic when merged with other objects.
|
|
21
|
-
* For example, if you merge a standard text style object with another object that
|
|
22
|
-
* has variability through the special keys, you get an object with both special
|
|
23
|
-
* keys and the keys of the style object which breaks how the proxy is able to
|
|
24
|
-
* return the correct value.
|
|
25
|
-
*/
|
|
26
13
|
|
|
27
14
|
export default function createTheme({
|
|
28
15
|
breakpoints,
|
|
@@ -6,47 +6,37 @@ import { isObject } from "lodash";
|
|
|
6
6
|
* Ex: {color: {ios: "blue", android: "red"}}
|
|
7
7
|
* -> theme.color returns "blue" when the platform is ios and "red" when android
|
|
8
8
|
*/
|
|
9
|
-
export default function createThemeValuesProxy(
|
|
9
|
+
export default function createThemeValuesProxy(value, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection) {
|
|
10
10
|
if (value === undefined || value === null) {
|
|
11
11
|
return undefined;
|
|
12
12
|
}
|
|
13
13
|
return new Proxy(value, {
|
|
14
14
|
get: (target, key) => {
|
|
15
15
|
const currentValue = target[key];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
if (!isObject(currentValue)) {
|
|
17
|
+
return currentValue;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
20
|
const platformKeys = ["ios", "android", "web", "macos", "windows"];
|
|
21
21
|
const breakpointKeys = Object.keys(breakpoints);
|
|
22
22
|
const lightDarkKeys = ["light", "dark"];
|
|
23
|
-
const keysType = getKeysType(
|
|
24
|
-
const input = {
|
|
25
|
-
value: valueAsThemeValues,
|
|
26
|
-
breakpoints,
|
|
27
|
-
deviceWidth,
|
|
28
|
-
devicePlatform,
|
|
29
|
-
currentLightDarkSelection,
|
|
30
|
-
};
|
|
23
|
+
const keysType = getKeysType(currentValue, platformKeys, breakpointKeys, lightDarkKeys);
|
|
31
24
|
if (keysType === "default") {
|
|
32
|
-
return createThemeValuesProxy(
|
|
25
|
+
return createThemeValuesProxy(currentValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
33
26
|
}
|
|
34
27
|
else if (keysType === "platform") {
|
|
35
|
-
return getPlatformValue(
|
|
28
|
+
return getPlatformValue(currentValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
36
29
|
}
|
|
37
30
|
else if (keysType === "breakpoint") {
|
|
38
|
-
return getBreakpointValue(
|
|
31
|
+
return getBreakpointValue(currentValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
39
32
|
}
|
|
40
33
|
else if (keysType === "lightDark") {
|
|
41
|
-
return getLightDarkValue(
|
|
34
|
+
return getLightDarkValue(currentValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
42
35
|
}
|
|
43
36
|
else {
|
|
44
37
|
return undefined;
|
|
45
38
|
}
|
|
46
39
|
}
|
|
47
|
-
else {
|
|
48
|
-
return currentValue;
|
|
49
|
-
}
|
|
50
40
|
},
|
|
51
41
|
set: () => {
|
|
52
42
|
throw new Error("Theme is read only, cannot be modified at runtime");
|
|
@@ -85,24 +75,19 @@ function onlyOneTrue(a, b, c, d) {
|
|
|
85
75
|
function allFalse(a, b, c, d) {
|
|
86
76
|
return [a, b, c, d].filter((x) => x).length === 0;
|
|
87
77
|
}
|
|
88
|
-
function getPlatformValue(
|
|
78
|
+
function getPlatformValue(value, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection) {
|
|
89
79
|
var _a;
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
? currentPlatformValue
|
|
94
|
-
: undefined;
|
|
95
|
-
if (valueAsThemeValues) {
|
|
96
|
-
return createThemeValuesProxy({ ...input, value: valueAsThemeValues });
|
|
80
|
+
const currentPlatformValue = (_a = value[devicePlatform]) !== null && _a !== void 0 ? _a : value.default;
|
|
81
|
+
if (!isObject(currentPlatformValue)) {
|
|
82
|
+
return currentPlatformValue;
|
|
97
83
|
}
|
|
98
84
|
else {
|
|
99
|
-
return currentPlatformValue;
|
|
85
|
+
return createThemeValuesProxy(currentPlatformValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
100
86
|
}
|
|
101
87
|
}
|
|
102
|
-
function getBreakpointValue(
|
|
88
|
+
function getBreakpointValue(value, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection) {
|
|
103
89
|
var _a;
|
|
104
|
-
const
|
|
105
|
-
const keysToBreakpointValue = Object.keys(value !== null && value !== void 0 ? value : {}).map((key) => [key, breakpoints[key]]);
|
|
90
|
+
const keysToBreakpointValue = Object.keys(value).map((key) => [key, breakpoints[key]]);
|
|
106
91
|
const orderedBreakpoints = keysToBreakpointValue.sort(([_, val]) => val);
|
|
107
92
|
let currentBreakpointKey = "";
|
|
108
93
|
for (const [breakpointKey, breakpointValue] of orderedBreakpoints) {
|
|
@@ -110,29 +95,22 @@ function getBreakpointValue(input) {
|
|
|
110
95
|
currentBreakpointKey = breakpointKey;
|
|
111
96
|
}
|
|
112
97
|
}
|
|
113
|
-
const currentBreakpointValue = (_a = value
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
: undefined;
|
|
117
|
-
if (valueAsThemeValues) {
|
|
118
|
-
return createThemeValuesProxy({ ...input, value: valueAsThemeValues });
|
|
98
|
+
const currentBreakpointValue = (_a = value[currentBreakpointKey]) !== null && _a !== void 0 ? _a : value.default;
|
|
99
|
+
if (!isObject(currentBreakpointValue)) {
|
|
100
|
+
return currentBreakpointValue;
|
|
119
101
|
}
|
|
120
102
|
else {
|
|
121
|
-
return currentBreakpointValue;
|
|
103
|
+
return createThemeValuesProxy(currentBreakpointValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
122
104
|
}
|
|
123
105
|
}
|
|
124
|
-
function getLightDarkValue(
|
|
106
|
+
function getLightDarkValue(value, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection) {
|
|
125
107
|
var _a;
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
? currentLightDarkSelection
|
|
130
|
-
: undefined;
|
|
131
|
-
if (valueAsThemeValues) {
|
|
132
|
-
return createThemeValuesProxy({ ...input, value: valueAsThemeValues });
|
|
108
|
+
const currentLightDarkValue = (_a = value[currentLightDarkSelection]) !== null && _a !== void 0 ? _a : value.default;
|
|
109
|
+
if (!isObject(currentLightDarkValue)) {
|
|
110
|
+
return currentLightDarkValue;
|
|
133
111
|
}
|
|
134
112
|
else {
|
|
135
|
-
return currentLightDarkValue;
|
|
113
|
+
return createThemeValuesProxy(currentLightDarkValue, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection);
|
|
136
114
|
}
|
|
137
115
|
}
|
|
138
116
|
//# sourceMappingURL=createThemeValuesProxy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createThemeValuesProxy.js","sourceRoot":"","sources":["createThemeValuesProxy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;
|
|
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,cAAc,EACd,yBAAyB,CAC1B,CAAC;iBACH;qBAAM,IAAI,QAAQ,KAAK,UAAU,EAAE;oBAClC,OAAO,gBAAgB,CACrB,YAAY,EACZ,WAAW,EACX,W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