@draftbit/theme 50.6.2-fba047.2 → 50.6.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/Provider.js +1 -1
- package/lib/commonjs/createTheme.js +1 -1
- package/lib/commonjs/createThemeValuesProxy.js +1 -1
- package/lib/commonjs/utils.js +1 -0
- package/lib/commonjs/validators.js +1 -1
- package/lib/typescript/src/Provider.js +29 -12
- package/lib/typescript/src/Provider.js.map +1 -1
- package/lib/typescript/src/createTheme.d.ts +1 -13
- package/lib/typescript/src/createTheme.js +19 -7
- package/lib/typescript/src/createTheme.js.map +1 -1
- package/lib/typescript/src/createThemeValuesProxy.d.ts +9 -1
- package/lib/typescript/src/createThemeValuesProxy.js +26 -24
- package/lib/typescript/src/createThemeValuesProxy.js.map +1 -1
- package/lib/typescript/src/utils.d.ts +3 -0
- package/lib/typescript/src/utils.js +18 -0
- package/lib/typescript/src/utils.js.map +1 -0
- package/lib/typescript/src/validators.d.ts +1 -3
- package/lib/typescript/src/validators.js +74 -10
- package/lib/typescript/src/validators.js.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -3
- package/src/Provider.js +29 -12
- package/src/Provider.js.map +1 -1
- package/src/Provider.tsx +28 -42
- package/src/createTheme.js +19 -7
- package/src/createTheme.js.map +1 -1
- package/src/createTheme.ts +28 -7
- package/src/createThemeValuesProxy.js +26 -24
- package/src/createThemeValuesProxy.js.map +1 -1
- package/src/createThemeValuesProxy.ts +44 -90
- package/src/utils.js +18 -0
- package/src/utils.js.map +1 -0
- package/src/utils.ts +22 -0
- package/src/validators.js +74 -10
- package/src/validators.js.map +1 -1
- package/src/validators.ts +93 -12
package/src/createTheme.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { deepmergeCustom } from "deepmerge-ts";
|
|
2
|
+
import { validateBreakpoints, validatePalettes, validateTheme, } from "./validators";
|
|
3
|
+
import { isTextStyleObject } from "./utils";
|
|
2
4
|
/**
|
|
3
5
|
* Custom deepmerge function to skip merging of typography/text style objects.
|
|
4
6
|
*
|
|
@@ -11,14 +13,24 @@ import merge from "deepmerge";
|
|
|
11
13
|
* keys and the keys of the style object which breaks how the proxy is able to
|
|
12
14
|
* return the correct value.
|
|
13
15
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const themeMerge = deepmergeCustom({
|
|
17
|
+
enableImplicitDefaultMerging: true,
|
|
18
|
+
mergeRecords(values, utils, meta) {
|
|
19
|
+
const firstValue = values[0];
|
|
20
|
+
if (isTextStyleObject(firstValue)) {
|
|
21
|
+
return utils.defaultMergeFunctions.mergeRecords(values.slice(1), utils, meta);
|
|
22
|
+
}
|
|
23
|
+
return utils.defaultMergeFunctions.mergeRecords(values, utils, meta);
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
export default function createTheme({ breakpoints, palettes, theme, baseTheme, }) {
|
|
27
|
+
validateBreakpoints(breakpoints);
|
|
28
|
+
validatePalettes(palettes);
|
|
29
|
+
validateTheme(theme);
|
|
18
30
|
let resultTheme = theme;
|
|
19
31
|
if (baseTheme) {
|
|
20
|
-
|
|
21
|
-
resultTheme =
|
|
32
|
+
validateTheme(baseTheme);
|
|
33
|
+
resultTheme = themeMerge(baseTheme, theme);
|
|
22
34
|
}
|
|
23
35
|
return {
|
|
24
36
|
...resultTheme,
|
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,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAO/C,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,GAAG,eAAe,CAAC;IACjC,4BAA4B,EAAE,IAAI;IAClC,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI;QAC9B,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE;YACjC,OAAO,KAAK,CAAC,qBAAqB,CAAC,YAAY,CAC7C,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EACf,KAAK,EACL,IAAI,CACL,CAAC;SACH;QACD,OAAO,KAAK,CAAC,qBAAqB,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACvE,CAAC;CACF,CAAC,CAAC;AAEH,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,UAAU,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;KAC5C;IAED,OAAO;QACL,GAAG,WAAW;QACd,SAAS,EAAE,IAAI;KAChB,CAAC;AACJ,CAAC"}
|
package/src/createTheme.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import { deepmergeCustom } from "deepmerge-ts";
|
|
1
2
|
import type {
|
|
2
3
|
Breakpoints,
|
|
3
4
|
Theme,
|
|
4
5
|
ValidatedTheme,
|
|
5
6
|
ColorPalettes,
|
|
6
7
|
} from "./types";
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
import {
|
|
9
|
+
validateBreakpoints,
|
|
10
|
+
validatePalettes,
|
|
11
|
+
validateTheme,
|
|
12
|
+
} from "./validators";
|
|
13
|
+
import { isTextStyleObject } from "./utils";
|
|
9
14
|
|
|
10
15
|
/**
|
|
11
16
|
* Custom deepmerge function to skip merging of typography/text style objects.
|
|
@@ -19,8 +24,24 @@ import merge from "deepmerge";
|
|
|
19
24
|
* keys and the keys of the style object which breaks how the proxy is able to
|
|
20
25
|
* return the correct value.
|
|
21
26
|
*/
|
|
27
|
+
const themeMerge = deepmergeCustom({
|
|
28
|
+
enableImplicitDefaultMerging: true,
|
|
29
|
+
mergeRecords(values, utils, meta) {
|
|
30
|
+
const firstValue = values[0];
|
|
31
|
+
if (isTextStyleObject(firstValue)) {
|
|
32
|
+
return utils.defaultMergeFunctions.mergeRecords(
|
|
33
|
+
values.slice(1),
|
|
34
|
+
utils,
|
|
35
|
+
meta
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return utils.defaultMergeFunctions.mergeRecords(values, utils, meta);
|
|
39
|
+
},
|
|
40
|
+
});
|
|
22
41
|
|
|
23
42
|
export default function createTheme({
|
|
43
|
+
breakpoints,
|
|
44
|
+
palettes,
|
|
24
45
|
theme,
|
|
25
46
|
baseTheme,
|
|
26
47
|
}: {
|
|
@@ -29,15 +50,15 @@ export default function createTheme({
|
|
|
29
50
|
theme: Theme;
|
|
30
51
|
baseTheme?: Theme;
|
|
31
52
|
}): ValidatedTheme {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
53
|
+
validateBreakpoints(breakpoints);
|
|
54
|
+
validatePalettes(palettes);
|
|
55
|
+
validateTheme(theme);
|
|
35
56
|
|
|
36
57
|
let resultTheme = theme;
|
|
37
58
|
|
|
38
59
|
if (baseTheme) {
|
|
39
|
-
|
|
40
|
-
resultTheme =
|
|
60
|
+
validateTheme(baseTheme);
|
|
61
|
+
resultTheme = themeMerge(baseTheme, theme);
|
|
41
62
|
}
|
|
42
63
|
|
|
43
64
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { asThemeValuesObject } from "./utils";
|
|
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
|
|
@@ -6,32 +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(value, breakpoints, deviceWidth, devicePlatform, currentLightDarkSelection) {
|
|
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
|
-
const valueAsThemeValues =
|
|
17
|
-
? currentValue
|
|
18
|
-
: undefined;
|
|
16
|
+
const valueAsThemeValues = asThemeValuesObject(currentValue);
|
|
19
17
|
if (valueAsThemeValues) {
|
|
20
18
|
const platformKeys = ["ios", "android", "web", "macos", "windows"];
|
|
21
19
|
const breakpointKeys = Object.keys(breakpoints);
|
|
22
20
|
const lightDarkKeys = ["light", "dark"];
|
|
23
21
|
const keysType = getKeysType(valueAsThemeValues, platformKeys, breakpointKeys, lightDarkKeys);
|
|
22
|
+
const input = {
|
|
23
|
+
value: valueAsThemeValues,
|
|
24
|
+
breakpoints,
|
|
25
|
+
deviceWidth,
|
|
26
|
+
devicePlatform,
|
|
27
|
+
currentLightDarkSelection,
|
|
28
|
+
};
|
|
24
29
|
if (keysType === "default") {
|
|
25
|
-
return createThemeValuesProxy(
|
|
30
|
+
return createThemeValuesProxy(input);
|
|
26
31
|
}
|
|
27
32
|
else if (keysType === "platform") {
|
|
28
|
-
return getPlatformValue(
|
|
33
|
+
return getPlatformValue(input);
|
|
29
34
|
}
|
|
30
35
|
else if (keysType === "breakpoint") {
|
|
31
|
-
return getBreakpointValue(
|
|
36
|
+
return getBreakpointValue(input);
|
|
32
37
|
}
|
|
33
38
|
else if (keysType === "lightDark") {
|
|
34
|
-
return getLightDarkValue(
|
|
39
|
+
return getLightDarkValue(input);
|
|
35
40
|
}
|
|
36
41
|
else {
|
|
37
42
|
return undefined;
|
|
@@ -78,21 +83,21 @@ function onlyOneTrue(a, b, c, d) {
|
|
|
78
83
|
function allFalse(a, b, c, d) {
|
|
79
84
|
return [a, b, c, d].filter((x) => x).length === 0;
|
|
80
85
|
}
|
|
81
|
-
function getPlatformValue(
|
|
86
|
+
function getPlatformValue(input) {
|
|
82
87
|
var _a;
|
|
88
|
+
const { value, devicePlatform } = input;
|
|
83
89
|
const currentPlatformValue = (_a = value === null || value === void 0 ? void 0 : value[devicePlatform]) !== null && _a !== void 0 ? _a : value === null || value === void 0 ? void 0 : value.default;
|
|
84
|
-
const valueAsThemeValues =
|
|
85
|
-
? currentPlatformValue
|
|
86
|
-
: undefined;
|
|
90
|
+
const valueAsThemeValues = asThemeValuesObject(currentPlatformValue);
|
|
87
91
|
if (valueAsThemeValues) {
|
|
88
|
-
return createThemeValuesProxy(
|
|
92
|
+
return createThemeValuesProxy({ ...input, value: valueAsThemeValues });
|
|
89
93
|
}
|
|
90
94
|
else {
|
|
91
95
|
return currentPlatformValue;
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
|
-
function getBreakpointValue(
|
|
98
|
+
function getBreakpointValue(input) {
|
|
95
99
|
var _a;
|
|
100
|
+
const { value, breakpoints, deviceWidth } = input;
|
|
96
101
|
const keysToBreakpointValue = Object.keys(value !== null && value !== void 0 ? value : {}).map((key) => [key, breakpoints[key]]);
|
|
97
102
|
const orderedBreakpoints = keysToBreakpointValue.sort(([_, val]) => val);
|
|
98
103
|
let currentBreakpointKey = "";
|
|
@@ -102,24 +107,21 @@ function getBreakpointValue(value, breakpoints, deviceWidth, devicePlatform, cur
|
|
|
102
107
|
}
|
|
103
108
|
}
|
|
104
109
|
const currentBreakpointValue = (_a = value === null || value === void 0 ? void 0 : value[currentBreakpointKey]) !== null && _a !== void 0 ? _a : value === null || value === void 0 ? void 0 : value.default;
|
|
105
|
-
const valueAsThemeValues =
|
|
106
|
-
? currentBreakpointKey
|
|
107
|
-
: undefined;
|
|
110
|
+
const valueAsThemeValues = asThemeValuesObject(currentBreakpointValue);
|
|
108
111
|
if (valueAsThemeValues) {
|
|
109
|
-
return createThemeValuesProxy(
|
|
112
|
+
return createThemeValuesProxy({ ...input, value: valueAsThemeValues });
|
|
110
113
|
}
|
|
111
114
|
else {
|
|
112
115
|
return currentBreakpointValue;
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
|
-
function getLightDarkValue(
|
|
118
|
+
function getLightDarkValue(input) {
|
|
116
119
|
var _a;
|
|
120
|
+
const { value, currentLightDarkSelection } = input;
|
|
117
121
|
const currentLightDarkValue = (_a = value === null || value === void 0 ? void 0 : value[currentLightDarkSelection]) !== null && _a !== void 0 ? _a : value === null || value === void 0 ? void 0 : value.default;
|
|
118
|
-
const valueAsThemeValues =
|
|
119
|
-
? currentLightDarkSelection
|
|
120
|
-
: undefined;
|
|
122
|
+
const valueAsThemeValues = asThemeValuesObject(currentLightDarkValue);
|
|
121
123
|
if (valueAsThemeValues) {
|
|
122
|
-
return createThemeValuesProxy(
|
|
124
|
+
return createThemeValuesProxy({ ...input, value: valueAsThemeValues });
|
|
123
125
|
}
|
|
124
126
|
else {
|
|
125
127
|
return currentLightDarkValue;
|
|
@@ -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,mBAAmB,EAAE,MAAM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;IACvD,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;IAEtE,IAAI,kBAAkB,EAAE;QACtB,OAAO,sBAAsB,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC;KACxE;SAAM;QACL,OAAO,qBAAqB,CAAC;KAC9B;AACH,CAAC"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { ThemeValues, Breakpoints } from "./types";
|
|
2
2
|
import { Platform, TextStyle } from "react-native";
|
|
3
|
-
import {
|
|
3
|
+
import { asThemeValuesObject } from "./utils";
|
|
4
|
+
|
|
5
|
+
interface CreateThemeValuesProxyInput {
|
|
6
|
+
value: ThemeValues | undefined;
|
|
7
|
+
breakpoints: Breakpoints;
|
|
8
|
+
deviceWidth: number;
|
|
9
|
+
devicePlatform: typeof Platform.OS;
|
|
10
|
+
currentLightDarkSelection: "light" | "dark";
|
|
11
|
+
}
|
|
4
12
|
|
|
5
13
|
/**
|
|
6
14
|
* Creates a proxy for theme value objects to select a value whenever
|
|
@@ -9,13 +17,13 @@ import { isObject } from "lodash";
|
|
|
9
17
|
* Ex: {color: {ios: "blue", android: "red"}}
|
|
10
18
|
* -> theme.color returns "blue" when the platform is ios and "red" when android
|
|
11
19
|
*/
|
|
12
|
-
export default function createThemeValuesProxy(
|
|
13
|
-
value
|
|
14
|
-
breakpoints
|
|
15
|
-
deviceWidth
|
|
16
|
-
devicePlatform
|
|
17
|
-
currentLightDarkSelection
|
|
18
|
-
): any /* return type 'any' to allow arbitrary object references (object.example.another.there) */ {
|
|
20
|
+
export default function createThemeValuesProxy({
|
|
21
|
+
value,
|
|
22
|
+
breakpoints,
|
|
23
|
+
deviceWidth,
|
|
24
|
+
devicePlatform,
|
|
25
|
+
currentLightDarkSelection,
|
|
26
|
+
}: CreateThemeValuesProxyInput): any /* return type 'any' to allow arbitrary object references (object.example.another.there) */ {
|
|
19
27
|
if (value === undefined || value === null) {
|
|
20
28
|
return undefined;
|
|
21
29
|
}
|
|
@@ -26,9 +34,7 @@ export default function createThemeValuesProxy(
|
|
|
26
34
|
): string | number | ThemeValues | TextStyle | undefined => {
|
|
27
35
|
const currentValue = target[key];
|
|
28
36
|
|
|
29
|
-
const valueAsThemeValues =
|
|
30
|
-
? (currentValue as ThemeValues)
|
|
31
|
-
: undefined;
|
|
37
|
+
const valueAsThemeValues = asThemeValuesObject(currentValue);
|
|
32
38
|
|
|
33
39
|
if (valueAsThemeValues) {
|
|
34
40
|
const platformKeys = ["ios", "android", "web", "macos", "windows"];
|
|
@@ -42,38 +48,22 @@ export default function createThemeValuesProxy(
|
|
|
42
48
|
lightDarkKeys
|
|
43
49
|
);
|
|
44
50
|
|
|
51
|
+
const input: CreateThemeValuesProxyInput = {
|
|
52
|
+
value: valueAsThemeValues,
|
|
53
|
+
breakpoints,
|
|
54
|
+
deviceWidth,
|
|
55
|
+
devicePlatform,
|
|
56
|
+
currentLightDarkSelection,
|
|
57
|
+
};
|
|
58
|
+
|
|
45
59
|
if (keysType === "default") {
|
|
46
|
-
return createThemeValuesProxy(
|
|
47
|
-
valueAsThemeValues,
|
|
48
|
-
breakpoints,
|
|
49
|
-
deviceWidth,
|
|
50
|
-
devicePlatform,
|
|
51
|
-
currentLightDarkSelection
|
|
52
|
-
);
|
|
60
|
+
return createThemeValuesProxy(input);
|
|
53
61
|
} else if (keysType === "platform") {
|
|
54
|
-
return getPlatformValue(
|
|
55
|
-
valueAsThemeValues,
|
|
56
|
-
breakpoints,
|
|
57
|
-
deviceWidth,
|
|
58
|
-
devicePlatform,
|
|
59
|
-
currentLightDarkSelection
|
|
60
|
-
);
|
|
62
|
+
return getPlatformValue(input);
|
|
61
63
|
} else if (keysType === "breakpoint") {
|
|
62
|
-
return getBreakpointValue(
|
|
63
|
-
valueAsThemeValues,
|
|
64
|
-
breakpoints,
|
|
65
|
-
deviceWidth,
|
|
66
|
-
devicePlatform,
|
|
67
|
-
currentLightDarkSelection
|
|
68
|
-
);
|
|
64
|
+
return getBreakpointValue(input);
|
|
69
65
|
} else if (keysType === "lightDark") {
|
|
70
|
-
return getLightDarkValue(
|
|
71
|
-
valueAsThemeValues,
|
|
72
|
-
breakpoints,
|
|
73
|
-
deviceWidth,
|
|
74
|
-
devicePlatform,
|
|
75
|
-
currentLightDarkSelection
|
|
76
|
-
);
|
|
66
|
+
return getLightDarkValue(input);
|
|
77
67
|
} else {
|
|
78
68
|
return undefined;
|
|
79
69
|
}
|
|
@@ -145,38 +135,22 @@ function allFalse(a: boolean, b: boolean, c: boolean, d: boolean) {
|
|
|
145
135
|
return [a, b, c, d].filter((x) => x).length === 0;
|
|
146
136
|
}
|
|
147
137
|
|
|
148
|
-
function getPlatformValue(
|
|
149
|
-
value
|
|
150
|
-
|
|
151
|
-
deviceWidth: number,
|
|
152
|
-
devicePlatform: typeof Platform.OS,
|
|
153
|
-
currentLightDarkSelection: "light" | "dark"
|
|
154
|
-
) {
|
|
138
|
+
function getPlatformValue(input: CreateThemeValuesProxyInput) {
|
|
139
|
+
const { value, devicePlatform } = input;
|
|
140
|
+
|
|
155
141
|
const currentPlatformValue = value?.[devicePlatform] ?? value?.default;
|
|
156
|
-
const valueAsThemeValues =
|
|
157
|
-
? (currentPlatformValue as ThemeValues)
|
|
158
|
-
: undefined;
|
|
142
|
+
const valueAsThemeValues = asThemeValuesObject(currentPlatformValue);
|
|
159
143
|
|
|
160
144
|
if (valueAsThemeValues) {
|
|
161
|
-
return createThemeValuesProxy(
|
|
162
|
-
valueAsThemeValues,
|
|
163
|
-
breakpoints,
|
|
164
|
-
deviceWidth,
|
|
165
|
-
devicePlatform,
|
|
166
|
-
currentLightDarkSelection
|
|
167
|
-
);
|
|
145
|
+
return createThemeValuesProxy({ ...input, value: valueAsThemeValues });
|
|
168
146
|
} else {
|
|
169
147
|
return currentPlatformValue;
|
|
170
148
|
}
|
|
171
149
|
}
|
|
172
150
|
|
|
173
|
-
function getBreakpointValue(
|
|
174
|
-
value
|
|
175
|
-
|
|
176
|
-
deviceWidth: number,
|
|
177
|
-
devicePlatform: typeof Platform.OS,
|
|
178
|
-
currentLightDarkSelection: "light" | "dark"
|
|
179
|
-
) {
|
|
151
|
+
function getBreakpointValue(input: CreateThemeValuesProxyInput) {
|
|
152
|
+
const { value, breakpoints, deviceWidth } = input;
|
|
153
|
+
|
|
180
154
|
const keysToBreakpointValue: [string, number][] = Object.keys(
|
|
181
155
|
value ?? {}
|
|
182
156
|
).map((key) => [key, breakpoints[key]]);
|
|
@@ -189,44 +163,24 @@ function getBreakpointValue(
|
|
|
189
163
|
}
|
|
190
164
|
const currentBreakpointValue =
|
|
191
165
|
value?.[currentBreakpointKey] ?? value?.default;
|
|
192
|
-
const valueAsThemeValues =
|
|
193
|
-
? (currentBreakpointKey as ThemeValues)
|
|
194
|
-
: undefined;
|
|
166
|
+
const valueAsThemeValues = asThemeValuesObject(currentBreakpointValue);
|
|
195
167
|
|
|
196
168
|
if (valueAsThemeValues) {
|
|
197
|
-
return createThemeValuesProxy(
|
|
198
|
-
valueAsThemeValues,
|
|
199
|
-
breakpoints,
|
|
200
|
-
deviceWidth,
|
|
201
|
-
devicePlatform,
|
|
202
|
-
currentLightDarkSelection
|
|
203
|
-
);
|
|
169
|
+
return createThemeValuesProxy({ ...input, value: valueAsThemeValues });
|
|
204
170
|
} else {
|
|
205
171
|
return currentBreakpointValue;
|
|
206
172
|
}
|
|
207
173
|
}
|
|
208
174
|
|
|
209
|
-
function getLightDarkValue(
|
|
210
|
-
value
|
|
211
|
-
|
|
212
|
-
deviceWidth: number,
|
|
213
|
-
devicePlatform: typeof Platform.OS,
|
|
214
|
-
currentLightDarkSelection: "light" | "dark"
|
|
215
|
-
) {
|
|
175
|
+
function getLightDarkValue(input: CreateThemeValuesProxyInput) {
|
|
176
|
+
const { value, currentLightDarkSelection } = input;
|
|
177
|
+
|
|
216
178
|
const currentLightDarkValue =
|
|
217
179
|
value?.[currentLightDarkSelection] ?? value?.default;
|
|
218
|
-
const valueAsThemeValues =
|
|
219
|
-
? (currentLightDarkSelection as ThemeValues)
|
|
220
|
-
: undefined;
|
|
180
|
+
const valueAsThemeValues = asThemeValuesObject(currentLightDarkValue);
|
|
221
181
|
|
|
222
182
|
if (valueAsThemeValues) {
|
|
223
|
-
return createThemeValuesProxy(
|
|
224
|
-
valueAsThemeValues,
|
|
225
|
-
breakpoints,
|
|
226
|
-
deviceWidth,
|
|
227
|
-
devicePlatform,
|
|
228
|
-
currentLightDarkSelection
|
|
229
|
-
);
|
|
183
|
+
return createThemeValuesProxy({ ...input, value: valueAsThemeValues });
|
|
230
184
|
} else {
|
|
231
185
|
return currentLightDarkValue;
|
|
232
186
|
}
|
package/src/utils.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isObject } from "lodash";
|
|
2
|
+
export function isTextStyleObject(value) {
|
|
3
|
+
return Object.keys(value).some((key) => [
|
|
4
|
+
"fontFamily",
|
|
5
|
+
"fontWeight",
|
|
6
|
+
"fontSize",
|
|
7
|
+
"fontStyle",
|
|
8
|
+
"lineHeight",
|
|
9
|
+
"letterSpacing",
|
|
10
|
+
].includes(key));
|
|
11
|
+
}
|
|
12
|
+
export function asThemeValuesObject(value) {
|
|
13
|
+
// Any object that isn't a text style object is considered a ThemeValues object
|
|
14
|
+
return !isTextStyleObject(value) && isObject(value)
|
|
15
|
+
? value
|
|
16
|
+
: null;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=utils.js.map
|
package/src/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGlC,MAAM,UAAU,iBAAiB,CAAC,KAAU;IAC1C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CACrC;QACE,YAAY;QACZ,YAAY;QACZ,UAAU;QACV,WAAW;QACX,YAAY;QACZ,eAAe;KAChB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAU;IAC5C,+EAA+E;IAC/E,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC;QACjD,CAAC,CAAE,KAAqB;QACxB,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isObject } from "lodash";
|
|
2
|
+
import type { ThemeValues } from "./types";
|
|
3
|
+
|
|
4
|
+
export function isTextStyleObject(value: any): boolean {
|
|
5
|
+
return Object.keys(value).some((key) =>
|
|
6
|
+
[
|
|
7
|
+
"fontFamily",
|
|
8
|
+
"fontWeight",
|
|
9
|
+
"fontSize",
|
|
10
|
+
"fontStyle",
|
|
11
|
+
"lineHeight",
|
|
12
|
+
"letterSpacing",
|
|
13
|
+
].includes(key)
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function asThemeValuesObject(value: any): ThemeValues | null {
|
|
18
|
+
// Any object that isn't a text style object is considered a ThemeValues object
|
|
19
|
+
return !isTextStyleObject(value) && isObject(value)
|
|
20
|
+
? (value as ThemeValues)
|
|
21
|
+
: null;
|
|
22
|
+
}
|
package/src/validators.js
CHANGED
|
@@ -1,17 +1,81 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const PaletteSchema = z.record(z.string(), z.record(z.string(), z.string()));
|
|
3
|
+
const BreakpointSchema = z.record(z.string(), z.number());
|
|
4
|
+
const TextStyleSchema = z.union([
|
|
5
|
+
z.object({
|
|
6
|
+
fontSize: z.number(),
|
|
7
|
+
}),
|
|
8
|
+
z.object({
|
|
9
|
+
fontFamily: z.string(),
|
|
10
|
+
}),
|
|
11
|
+
z.object({
|
|
12
|
+
fontWeight: z.enum([
|
|
13
|
+
"normal",
|
|
14
|
+
"bold",
|
|
15
|
+
"100",
|
|
16
|
+
"200",
|
|
17
|
+
"300",
|
|
18
|
+
"400",
|
|
19
|
+
"500",
|
|
20
|
+
"600",
|
|
21
|
+
"700",
|
|
22
|
+
"800",
|
|
23
|
+
"900",
|
|
24
|
+
]),
|
|
25
|
+
}),
|
|
26
|
+
z.object({
|
|
27
|
+
fontStyle: z.enum(["normal", "italic"]),
|
|
28
|
+
}),
|
|
29
|
+
z.object({
|
|
30
|
+
letterSpacing: z.number(),
|
|
31
|
+
}),
|
|
32
|
+
z.object({
|
|
33
|
+
lineHeight: z.number(),
|
|
34
|
+
}),
|
|
35
|
+
]);
|
|
36
|
+
const ThemeValuesSchema = z.record(z.string(), z.lazy(() => z.union([z.string(), z.number(), TextStyleSchema, ThemeValuesSchema])));
|
|
37
|
+
const TextStyleOrThemeValuesSchema = z.union([TextStyleSchema, ThemeValuesSchema]);
|
|
38
|
+
const ThemeSchema = z.object({
|
|
39
|
+
name: z.string(),
|
|
40
|
+
colors: z.object({
|
|
41
|
+
branding: ThemeValuesSchema.optional(),
|
|
42
|
+
text: ThemeValuesSchema.optional(),
|
|
43
|
+
background: ThemeValuesSchema.optional(),
|
|
44
|
+
foreground: ThemeValuesSchema.optional(),
|
|
45
|
+
border: ThemeValuesSchema.optional(),
|
|
46
|
+
}),
|
|
47
|
+
typography: z.object({
|
|
48
|
+
body1: TextStyleOrThemeValuesSchema.optional(),
|
|
49
|
+
body2: TextStyleOrThemeValuesSchema.optional(),
|
|
50
|
+
button: TextStyleOrThemeValuesSchema.optional(),
|
|
51
|
+
caption: TextStyleOrThemeValuesSchema.optional(),
|
|
52
|
+
headline1: TextStyleOrThemeValuesSchema.optional(),
|
|
53
|
+
headline2: TextStyleOrThemeValuesSchema.optional(),
|
|
54
|
+
headline3: TextStyleOrThemeValuesSchema.optional(),
|
|
55
|
+
headline4: TextStyleOrThemeValuesSchema.optional(),
|
|
56
|
+
headline5: TextStyleOrThemeValuesSchema.optional(),
|
|
57
|
+
headline6: TextStyleOrThemeValuesSchema.optional(),
|
|
58
|
+
overline: TextStyleOrThemeValuesSchema.optional(),
|
|
59
|
+
subtitle1: TextStyleOrThemeValuesSchema.optional(),
|
|
60
|
+
subtitle2: TextStyleOrThemeValuesSchema.optional(),
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
1
63
|
export function validatePalettes(palettes) {
|
|
2
|
-
palettes;
|
|
64
|
+
const result = PaletteSchema.safeParse(palettes);
|
|
65
|
+
if (!result.success) {
|
|
66
|
+
throw new Error("Invalid palettes object: " + result.error.message);
|
|
67
|
+
}
|
|
3
68
|
}
|
|
4
69
|
export function validateBreakpoints(breakpoints) {
|
|
5
|
-
breakpoints;
|
|
70
|
+
const result = BreakpointSchema.safeParse(breakpoints);
|
|
71
|
+
if (!result.success) {
|
|
72
|
+
throw new Error("Invalid breakpoints object: " + result.error.message);
|
|
73
|
+
}
|
|
6
74
|
}
|
|
7
75
|
export function validateTheme(theme) {
|
|
8
|
-
theme;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
export function asThemeValuesObject(value) {
|
|
15
|
-
return value;
|
|
76
|
+
const result = ThemeSchema.safeParse(theme);
|
|
77
|
+
if (!result.success) {
|
|
78
|
+
throw new Error("Invalid theme object: " + result.error.message);
|
|
79
|
+
}
|
|
16
80
|
}
|
|
17
81
|
//# sourceMappingURL=validators.js.map
|
package/src/validators.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["validators.ts"],"names":[],"mappings":"AAEA,MAAM,
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["validators.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,aAAa,GAA6B,CAAC,CAAC,MAAM,CACtD,CAAC,CAAC,MAAM,EAAE,EACV,CAAC,CAA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