@tamagui/theme-base 1.0.1-beta.71 → 1.0.1-beta.74
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/colorUtils.js +9 -10
- package/dist/cjs/colorUtils.js.map +1 -1
- package/dist/cjs/themes.js +17 -9
- package/dist/cjs/themes.js.map +2 -2
- package/dist/cjs/tokens.js +0 -2
- package/dist/cjs/tokens.js.map +1 -1
- package/dist/esm/colorUtils.js +9 -11
- package/dist/esm/colorUtils.js.map +1 -1
- package/dist/esm/themes.js +17 -10
- package/dist/esm/themes.js.map +2 -2
- package/dist/esm/tokens.js +0 -3
- package/dist/esm/tokens.js.map +1 -1
- package/dist/jsx/colorUtils.js +9 -11
- package/dist/jsx/themes.js +17 -10
- package/dist/jsx/tokens.js +0 -3
- package/package.json +4 -4
- package/src/themes.tsx +12 -0
- package/types/themes.d.ts +1344 -0
- package/types/themes.d.ts.map +1 -1
package/dist/jsx/themes.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import { createTheme, getVariableValue, isWeb } from "@tamagui/core";
|
|
4
2
|
import { setColorAlpha } from "./colorUtils";
|
|
5
3
|
import { darkColors, lightColors, tokens } from "./tokens";
|
|
@@ -58,8 +56,7 @@ function createThemesFrom(name, getTheme, props) {
|
|
|
58
56
|
const themes2 = Object.fromEntries(themeEntries);
|
|
59
57
|
return themes2;
|
|
60
58
|
}
|
|
61
|
-
|
|
62
|
-
const themeCreator = /* @__PURE__ */ __name((str = 1, {
|
|
59
|
+
const themeCreator = (str = 1, {
|
|
63
60
|
backgrounds,
|
|
64
61
|
isLight = true,
|
|
65
62
|
isBase = false,
|
|
@@ -79,9 +76,9 @@ const themeCreator = /* @__PURE__ */ __name((str = 1, {
|
|
|
79
76
|
const darkerDir = -lighterDir;
|
|
80
77
|
const strongerDir = isLight ? darkerDir : lighterDir;
|
|
81
78
|
const softerDir = -strongerDir;
|
|
82
|
-
const get =
|
|
79
|
+
const get = (arr, index, name = "background") => {
|
|
83
80
|
return arr[Math.max(0, Math.min(index + (offsets[name][str] || 0), arr.length - 1))];
|
|
84
|
-
}
|
|
81
|
+
};
|
|
85
82
|
const colorTranslucent = setColorAlpha(getVariableValue(get(colors, 0 + str, "color")), 0.5);
|
|
86
83
|
let theme = {
|
|
87
84
|
background: get(backgrounds, str),
|
|
@@ -104,7 +101,19 @@ const themeCreator = /* @__PURE__ */ __name((str = 1, {
|
|
|
104
101
|
borderColor: null,
|
|
105
102
|
borderColorHover: null,
|
|
106
103
|
borderColorPress: null,
|
|
107
|
-
borderColorFocus: null
|
|
104
|
+
borderColorFocus: null,
|
|
105
|
+
step1: backgrounds[0],
|
|
106
|
+
step2: backgrounds[1],
|
|
107
|
+
step3: backgrounds[2],
|
|
108
|
+
step4: backgrounds[3],
|
|
109
|
+
step5: backgrounds[4],
|
|
110
|
+
step6: backgrounds[5],
|
|
111
|
+
step7: backgrounds[6],
|
|
112
|
+
step8: backgrounds[7],
|
|
113
|
+
step9: backgrounds[8],
|
|
114
|
+
step10: backgrounds[9],
|
|
115
|
+
step11: backgrounds[10],
|
|
116
|
+
step12: backgrounds[11]
|
|
108
117
|
};
|
|
109
118
|
if (isBase) {
|
|
110
119
|
Object.assign(theme, {
|
|
@@ -122,7 +131,7 @@ const themeCreator = /* @__PURE__ */ __name((str = 1, {
|
|
|
122
131
|
});
|
|
123
132
|
}
|
|
124
133
|
return theme;
|
|
125
|
-
}
|
|
134
|
+
};
|
|
126
135
|
const themeColors = {
|
|
127
136
|
light: [
|
|
128
137
|
"#fff",
|
|
@@ -212,13 +221,11 @@ function makeActiveTheme(theme) {
|
|
|
212
221
|
res.colorPress = res.color;
|
|
213
222
|
return res;
|
|
214
223
|
}
|
|
215
|
-
__name(makeActiveTheme, "makeActiveTheme");
|
|
216
224
|
const darkEntries = Object.entries(dark);
|
|
217
225
|
const lightEntries = Object.entries(light);
|
|
218
226
|
function findColors(prefix, dark2 = false) {
|
|
219
227
|
return Object.fromEntries((dark2 ? darkEntries : lightEntries).filter(([k]) => k.startsWith(prefix)));
|
|
220
228
|
}
|
|
221
|
-
__name(findColors, "findColors");
|
|
222
229
|
const colorSchemes = [
|
|
223
230
|
{ name: "blue", colors: findColors("blue"), darkColors: findColors("blue", true) },
|
|
224
231
|
{ name: "gray", colors: findColors("gray"), darkColors: findColors("gray", true) },
|
package/dist/jsx/tokens.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import {
|
|
4
2
|
blue,
|
|
5
3
|
blueDark,
|
|
@@ -139,7 +137,6 @@ const allColors = {
|
|
|
139
137
|
function postfixObjKeys(obj, postfix) {
|
|
140
138
|
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [`${k}${postfix}`, v]));
|
|
141
139
|
}
|
|
142
|
-
__name(postfixObjKeys, "postfixObjKeys");
|
|
143
140
|
const radius = {
|
|
144
141
|
0: 0,
|
|
145
142
|
1: 3,
|
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.74",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"clean:build": "tamagui-build clean:build"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@tamagui/colors": "^1.0.1-beta.
|
|
21
|
-
"@tamagui/core": "^1.0.1-beta.
|
|
20
|
+
"@tamagui/colors": "^1.0.1-beta.74",
|
|
21
|
+
"@tamagui/core": "^1.0.1-beta.74"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
24
|
+
"@tamagui/build": "^1.0.1-beta.74"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
package/src/themes.tsx
CHANGED
|
@@ -153,6 +153,18 @@ const themeCreator = (
|
|
|
153
153
|
borderColorHover: null as any as string | Variable,
|
|
154
154
|
borderColorPress: null as any as string | Variable,
|
|
155
155
|
borderColorFocus: null as any as string | Variable,
|
|
156
|
+
step1: backgrounds[0],
|
|
157
|
+
step2: backgrounds[1],
|
|
158
|
+
step3: backgrounds[2],
|
|
159
|
+
step4: backgrounds[3],
|
|
160
|
+
step5: backgrounds[4],
|
|
161
|
+
step6: backgrounds[5],
|
|
162
|
+
step7: backgrounds[6],
|
|
163
|
+
step8: backgrounds[7],
|
|
164
|
+
step9: backgrounds[8],
|
|
165
|
+
step10: backgrounds[9],
|
|
166
|
+
step11: backgrounds[10],
|
|
167
|
+
step12: backgrounds[11],
|
|
156
168
|
}
|
|
157
169
|
|
|
158
170
|
if (isBase) {
|