@tamagui/theme-base 1.0.1-beta.46 → 1.0.1-beta.49
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/dist/cjs/themes.js +83 -71
- package/dist/cjs/themes.js.map +2 -2
- package/dist/cjs/tokens.js +51 -15
- package/dist/cjs/tokens.js.map +2 -2
- package/dist/esm/themes.js +82 -66
- package/dist/esm/themes.js.map +2 -2
- package/dist/esm/tokens.js +96 -10
- package/dist/esm/tokens.js.map +2 -2
- package/dist/jsx/themes.js +82 -66
- package/dist/jsx/tokens.js +96 -10
- package/package.json +4 -4
- package/types/themes.d.ts +2078 -3390
- package/types/themes.d.ts.map +1 -1
- package/types/tokens.d.ts +955 -320
- package/types/tokens.d.ts.map +1 -1
package/dist/jsx/themes.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import
|
|
4
|
-
import { allDarkColors, allLightColors } from "@tamagui/colors";
|
|
5
|
-
import { getVariableValue } from "@tamagui/core";
|
|
3
|
+
import { createVariable, getVariableValue } from "@tamagui/core";
|
|
6
4
|
import { setColorAlpha } from "./colorUtils";
|
|
7
|
-
import {
|
|
5
|
+
import { colorTokens, darkColors, lightColors, tokens } from "./tokens";
|
|
6
|
+
const { color } = tokens;
|
|
8
7
|
const alternates = [1, 2, 3, 4];
|
|
8
|
+
const alts = [1, 2, 3];
|
|
9
9
|
function createThemesFrom(name, getTheme, props) {
|
|
10
10
|
const { shift = 0 } = props;
|
|
11
11
|
const theme = getTheme(0 + shift, props);
|
|
@@ -39,8 +39,8 @@ function createThemesFrom(name, getTheme, props) {
|
|
|
39
39
|
});
|
|
40
40
|
themeEntries = [
|
|
41
41
|
...themeEntries,
|
|
42
|
-
...altThemes,
|
|
43
|
-
...altButtonThemes,
|
|
42
|
+
...altThemes.slice(0, alts.length),
|
|
43
|
+
...altButtonThemes.slice(0, alts.length),
|
|
44
44
|
[`${name}_Button`, altThemes2[1][1]],
|
|
45
45
|
[`${name}_DrawerFrame`, altThemes2[1][1]],
|
|
46
46
|
[`${name}_SliderTrack`, altThemes[1][1]],
|
|
@@ -74,7 +74,7 @@ const createTheme = /* @__PURE__ */ __name((str = 1, {
|
|
|
74
74
|
background: (_c = offsetsProp == null ? void 0 : offsetsProp.background) != null ? _c : [0, 0, 0, 0],
|
|
75
75
|
color: (_d = offsetsProp == null ? void 0 : offsetsProp.color) != null ? _d : [0, 0, 0, 0]
|
|
76
76
|
};
|
|
77
|
-
const
|
|
77
|
+
const darkColors2 = isLight ? colors : backgrounds;
|
|
78
78
|
const lighterDir = isLight ? -1 : 1;
|
|
79
79
|
const darkerDir = -lighterDir;
|
|
80
80
|
const strongerDir = isLight ? darkerDir : lighterDir;
|
|
@@ -98,9 +98,9 @@ const createTheme = /* @__PURE__ */ __name((str = 1, {
|
|
|
98
98
|
colorTranslucent,
|
|
99
99
|
colorMid: (isLight ? colors : backgrounds)[Math.floor(colors.length / 2)],
|
|
100
100
|
shadowColor: isLight ? color.grayA2 : color.grayA8,
|
|
101
|
-
shadowColorHover:
|
|
102
|
-
shadowColorPress:
|
|
103
|
-
shadowColorFocus:
|
|
101
|
+
shadowColorHover: darkColors2[!isLight ? 1 : 8],
|
|
102
|
+
shadowColorPress: darkColors2[!isLight ? 1 : 8],
|
|
103
|
+
shadowColorFocus: darkColors2[!isLight ? 1 : 8],
|
|
104
104
|
borderColor: null,
|
|
105
105
|
borderColorHover: null,
|
|
106
106
|
borderColorPress: null,
|
|
@@ -124,59 +124,58 @@ const createTheme = /* @__PURE__ */ __name((str = 1, {
|
|
|
124
124
|
return theme;
|
|
125
125
|
}, "createTheme");
|
|
126
126
|
const colorSchemes = [
|
|
127
|
-
{ name: "blue", colors:
|
|
128
|
-
{ name: "gray", colors:
|
|
129
|
-
{ name: "green", colors:
|
|
130
|
-
{ name: "
|
|
131
|
-
{ name: "
|
|
132
|
-
{ name: "
|
|
133
|
-
{ name: "
|
|
134
|
-
{ name: "
|
|
135
|
-
{ name: "
|
|
136
|
-
{ name: "
|
|
137
|
-
{ name: "teal", colors: Colors.teal, darkColors: Colors.tealDark },
|
|
138
|
-
{ name: "lime", colors: Colors.lime, darkColors: Colors.limeDark },
|
|
139
|
-
{ name: "brown", colors: Colors.brown, darkColors: Colors.brownDark }
|
|
140
|
-
];
|
|
141
|
-
const lightGradient = [
|
|
142
|
-
"#fff",
|
|
143
|
-
"#f4f4f4",
|
|
144
|
-
color.gray1,
|
|
145
|
-
color.gray2,
|
|
146
|
-
color.gray3,
|
|
147
|
-
color.gray4,
|
|
148
|
-
color.gray5,
|
|
149
|
-
color.gray6,
|
|
150
|
-
color.gray7,
|
|
151
|
-
color.gray8,
|
|
152
|
-
color.gray9,
|
|
153
|
-
color.gray10,
|
|
154
|
-
color.gray11,
|
|
155
|
-
color.gray12
|
|
156
|
-
];
|
|
157
|
-
const darkGradient = [
|
|
158
|
-
"#111111",
|
|
159
|
-
"#151515",
|
|
160
|
-
"#191919",
|
|
161
|
-
"#232323",
|
|
162
|
-
"#282828",
|
|
163
|
-
"#323232",
|
|
164
|
-
"#383838",
|
|
165
|
-
"#424242",
|
|
166
|
-
"#494949",
|
|
167
|
-
"#545454",
|
|
168
|
-
"#626262",
|
|
169
|
-
"#777777"
|
|
127
|
+
{ name: "blue", colors: colorTokens.light.blue, darkColors: colorTokens.dark.blue },
|
|
128
|
+
{ name: "gray", colors: colorTokens.light.gray, darkColors: colorTokens.dark.gray },
|
|
129
|
+
{ name: "green", colors: colorTokens.light.green, darkColors: colorTokens.dark.green },
|
|
130
|
+
{ name: "orange", colors: colorTokens.light.orange, darkColors: colorTokens.dark.orange },
|
|
131
|
+
{ name: "pink", colors: colorTokens.light.pink, darkColors: colorTokens.dark.pink },
|
|
132
|
+
{ name: "purple", colors: colorTokens.light.purple, darkColors: colorTokens.dark.purple },
|
|
133
|
+
{ name: "red", colors: colorTokens.light.red, darkColors: colorTokens.dark.red },
|
|
134
|
+
{ name: "violet", colors: colorTokens.light.violet, darkColors: colorTokens.dark.violet },
|
|
135
|
+
{ name: "yellow", colors: colorTokens.light.yellow, darkColors: colorTokens.dark.yellow },
|
|
136
|
+
{ name: "teal", colors: colorTokens.light.teal, darkColors: colorTokens.dark.teal }
|
|
170
137
|
];
|
|
138
|
+
const themeColors = {
|
|
139
|
+
light: [
|
|
140
|
+
"#fff",
|
|
141
|
+
"#f4f4f4",
|
|
142
|
+
color.gray1,
|
|
143
|
+
color.gray2,
|
|
144
|
+
color.gray3,
|
|
145
|
+
color.gray4,
|
|
146
|
+
color.gray5,
|
|
147
|
+
color.gray6,
|
|
148
|
+
color.gray7,
|
|
149
|
+
color.gray8,
|
|
150
|
+
color.gray9,
|
|
151
|
+
color.gray10,
|
|
152
|
+
color.gray11,
|
|
153
|
+
color.gray12
|
|
154
|
+
],
|
|
155
|
+
dark: [
|
|
156
|
+
"#111111",
|
|
157
|
+
"#151515",
|
|
158
|
+
"#191919",
|
|
159
|
+
"#232323",
|
|
160
|
+
"#282828",
|
|
161
|
+
"#323232",
|
|
162
|
+
"#383838",
|
|
163
|
+
"#424242",
|
|
164
|
+
"#494949",
|
|
165
|
+
"#545454",
|
|
166
|
+
"#626262",
|
|
167
|
+
"#777777"
|
|
168
|
+
]
|
|
169
|
+
};
|
|
171
170
|
const lightThemes = createThemesFrom("light", createTheme, {
|
|
172
|
-
backgrounds:
|
|
171
|
+
backgrounds: themeColors.light,
|
|
173
172
|
backgroundStrong: "#fafafa",
|
|
174
|
-
borderColors:
|
|
173
|
+
borderColors: themeColors.light.slice(2),
|
|
175
174
|
isLight: true
|
|
176
175
|
});
|
|
177
176
|
const darkThemes = createThemesFrom("dark", createTheme, {
|
|
178
|
-
backgrounds:
|
|
179
|
-
colors:
|
|
177
|
+
backgrounds: themeColors.dark,
|
|
178
|
+
colors: themeColors.light.slice(2),
|
|
180
179
|
backgroundStrong: "#111",
|
|
181
180
|
isBase: true,
|
|
182
181
|
isLight: false,
|
|
@@ -185,10 +184,23 @@ const darkThemes = createThemesFrom("dark", createTheme, {
|
|
|
185
184
|
color: [0, 4, 5, 5, 5, 5]
|
|
186
185
|
}
|
|
187
186
|
});
|
|
187
|
+
const colorNames = [
|
|
188
|
+
"blue",
|
|
189
|
+
"gray",
|
|
190
|
+
"green",
|
|
191
|
+
"indigo",
|
|
192
|
+
"orange",
|
|
193
|
+
"pink",
|
|
194
|
+
"purple",
|
|
195
|
+
"red",
|
|
196
|
+
"violet",
|
|
197
|
+
"yellow",
|
|
198
|
+
"teal"
|
|
199
|
+
];
|
|
188
200
|
const baseThemes = {
|
|
189
201
|
...lightThemes,
|
|
190
202
|
light: {
|
|
191
|
-
...
|
|
203
|
+
...lightColors,
|
|
192
204
|
...lightThemes.light
|
|
193
205
|
},
|
|
194
206
|
light_active: makeActiveTheme(lightThemes.light),
|
|
@@ -201,7 +213,7 @@ const baseThemes = {
|
|
|
201
213
|
light_DrawerFrame: lightThemes.light_alt1,
|
|
202
214
|
...darkThemes,
|
|
203
215
|
dark: {
|
|
204
|
-
...
|
|
216
|
+
...darkColors,
|
|
205
217
|
...darkThemes.dark
|
|
206
218
|
},
|
|
207
219
|
dark_active: makeActiveTheme(darkThemes.dark),
|
|
@@ -222,10 +234,10 @@ function makeActiveTheme(theme) {
|
|
|
222
234
|
return res;
|
|
223
235
|
}
|
|
224
236
|
__name(makeActiveTheme, "makeActiveTheme");
|
|
225
|
-
const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors }) => {
|
|
237
|
+
const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors: darkColors2 }) => {
|
|
226
238
|
const [altLightThemes, altDarkThemes] = [
|
|
227
|
-
{ colors:
|
|
228
|
-
{ colors, backgrounds:
|
|
239
|
+
{ colors: darkColors2, backgrounds: colors },
|
|
240
|
+
{ colors, backgrounds: darkColors2 }
|
|
229
241
|
].map((props, i) => {
|
|
230
242
|
const isLight = i === 0;
|
|
231
243
|
const [backgrounds, colors2] = [
|
|
@@ -235,8 +247,13 @@ const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors }) =>
|
|
|
235
247
|
const scheme = isLight ? "light" : "dark";
|
|
236
248
|
const shift = isLight ? 0 : 1;
|
|
237
249
|
if (!isLight) {
|
|
238
|
-
const [_, h, sp, lp] = backgrounds[0].match(/hsl\(([0-9\.]+), ([0-9\.]+)\%, ([0-9\.]+)\%\)/);
|
|
239
|
-
backgrounds.
|
|
250
|
+
const [_, h, sp, lp] = backgrounds[0].val.match(/hsl\(([0-9\.]+), ([0-9\.]+)\%, ([0-9\.]+)\%\)/);
|
|
251
|
+
const key = backgrounds[0].key.replace("1", "0");
|
|
252
|
+
backgrounds.unshift(createVariable({
|
|
253
|
+
key,
|
|
254
|
+
name: key,
|
|
255
|
+
val: `hsl(${h}, ${sp}%, ${parseFloat(lp) / 2}%)`
|
|
256
|
+
}));
|
|
240
257
|
}
|
|
241
258
|
const themeWithAlts = createThemesFrom(name, createTheme, {
|
|
242
259
|
colors: colors2,
|
|
@@ -262,8 +279,7 @@ const allThemes = {
|
|
|
262
279
|
};
|
|
263
280
|
const themes = allThemes;
|
|
264
281
|
export {
|
|
282
|
+
colorNames,
|
|
265
283
|
colorSchemes,
|
|
266
|
-
darkGradient,
|
|
267
|
-
lightGradient,
|
|
268
284
|
themes
|
|
269
285
|
};
|
package/dist/jsx/tokens.js
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
blue,
|
|
5
|
+
blueDark,
|
|
6
|
+
gray,
|
|
7
|
+
grayA,
|
|
8
|
+
grayDark,
|
|
9
|
+
grayDarkA,
|
|
10
|
+
green,
|
|
11
|
+
greenDark,
|
|
12
|
+
orange,
|
|
13
|
+
orangeDark,
|
|
14
|
+
pink,
|
|
15
|
+
pinkDark,
|
|
16
|
+
purple,
|
|
17
|
+
purpleDark,
|
|
18
|
+
red,
|
|
19
|
+
redDark,
|
|
20
|
+
teal,
|
|
21
|
+
tealDark,
|
|
22
|
+
violet,
|
|
23
|
+
violetDark,
|
|
24
|
+
yellow,
|
|
25
|
+
yellowDark
|
|
26
|
+
} from "@tamagui/colors";
|
|
27
|
+
import { createTokens, createVariables } from "@tamagui/core";
|
|
4
28
|
const sizeKeys = [
|
|
5
29
|
"true",
|
|
6
30
|
"0",
|
|
@@ -48,10 +72,68 @@ const zIndex = {
|
|
|
48
72
|
4: 400,
|
|
49
73
|
5: 500
|
|
50
74
|
};
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
75
|
+
const colorTokens = createVariables({
|
|
76
|
+
light: {
|
|
77
|
+
blue,
|
|
78
|
+
gray,
|
|
79
|
+
grayA,
|
|
80
|
+
green,
|
|
81
|
+
orange,
|
|
82
|
+
pink,
|
|
83
|
+
purple,
|
|
84
|
+
red,
|
|
85
|
+
violet,
|
|
86
|
+
yellow,
|
|
87
|
+
teal
|
|
88
|
+
},
|
|
89
|
+
dark: {
|
|
90
|
+
blue: blueDark,
|
|
91
|
+
gray: grayDark,
|
|
92
|
+
grayA: grayDarkA,
|
|
93
|
+
green: greenDark,
|
|
94
|
+
orange: orangeDark,
|
|
95
|
+
pink: pinkDark,
|
|
96
|
+
purple: purpleDark,
|
|
97
|
+
red: redDark,
|
|
98
|
+
violet: violetDark,
|
|
99
|
+
yellow: yellowDark,
|
|
100
|
+
teal: tealDark
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const darkColors = {
|
|
104
|
+
...colorTokens.dark.blue,
|
|
105
|
+
...colorTokens.dark.gray,
|
|
106
|
+
...colorTokens.dark.grayA,
|
|
107
|
+
...colorTokens.dark.green,
|
|
108
|
+
...colorTokens.dark.orange,
|
|
109
|
+
...colorTokens.dark.pink,
|
|
110
|
+
...colorTokens.dark.purple,
|
|
111
|
+
...colorTokens.dark.red,
|
|
112
|
+
...colorTokens.dark.violet,
|
|
113
|
+
...colorTokens.dark.yellow,
|
|
114
|
+
...colorTokens.dark.teal
|
|
54
115
|
};
|
|
116
|
+
const lightColors = {
|
|
117
|
+
...colorTokens.light.blue,
|
|
118
|
+
...colorTokens.light.gray,
|
|
119
|
+
...colorTokens.light.grayA,
|
|
120
|
+
...colorTokens.light.green,
|
|
121
|
+
...colorTokens.light.orange,
|
|
122
|
+
...colorTokens.light.pink,
|
|
123
|
+
...colorTokens.light.purple,
|
|
124
|
+
...colorTokens.light.red,
|
|
125
|
+
...colorTokens.light.violet,
|
|
126
|
+
...colorTokens.light.yellow,
|
|
127
|
+
...colorTokens.light.teal
|
|
128
|
+
};
|
|
129
|
+
const allColors = {
|
|
130
|
+
...lightColors,
|
|
131
|
+
...darkPostfix(darkColors)
|
|
132
|
+
};
|
|
133
|
+
function darkPostfix(obj) {
|
|
134
|
+
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [`${k}Dark`, v]));
|
|
135
|
+
}
|
|
136
|
+
__name(darkPostfix, "darkPostfix");
|
|
55
137
|
const radius = {
|
|
56
138
|
0: 0,
|
|
57
139
|
1: 3,
|
|
@@ -67,12 +149,16 @@ const radius = {
|
|
|
67
149
|
11: 42,
|
|
68
150
|
12: 50
|
|
69
151
|
};
|
|
70
|
-
|
|
71
|
-
color,
|
|
72
|
-
getSizeAt,
|
|
152
|
+
const tokens = createTokens({
|
|
153
|
+
color: allColors,
|
|
73
154
|
radius,
|
|
74
|
-
|
|
75
|
-
sizeKeys,
|
|
155
|
+
zIndex,
|
|
76
156
|
space,
|
|
77
|
-
|
|
157
|
+
size
|
|
158
|
+
});
|
|
159
|
+
export {
|
|
160
|
+
colorTokens,
|
|
161
|
+
darkColors,
|
|
162
|
+
lightColors,
|
|
163
|
+
tokens
|
|
78
164
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/theme-base",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.49",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"clean:build": "tamagui-build clean:build"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@tamagui/colors": "^1.0.1-beta.
|
|
20
|
-
"@tamagui/core": "^1.0.1-beta.
|
|
19
|
+
"@tamagui/colors": "^1.0.1-beta.49",
|
|
20
|
+
"@tamagui/core": "^1.0.1-beta.49"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
23
|
+
"@tamagui/build": "^1.0.1-beta.49"
|
|
24
24
|
},
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public"
|