@tamagui/theme-base 1.0.0-beta.147

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.
Files changed (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -0
  3. package/dist/cjs/colorUtils.js +60 -0
  4. package/dist/cjs/colorUtils.js.map +7 -0
  5. package/dist/cjs/colors.js +64 -0
  6. package/dist/cjs/colors.js.map +7 -0
  7. package/dist/cjs/firaFont.js +54 -0
  8. package/dist/cjs/firaFont.js.map +7 -0
  9. package/dist/cjs/fonts.js +19 -0
  10. package/dist/cjs/fonts.js.map +7 -0
  11. package/dist/cjs/index.js +20 -0
  12. package/dist/cjs/index.js.map +7 -0
  13. package/dist/cjs/interFont.js +80 -0
  14. package/dist/cjs/interFont.js.map +7 -0
  15. package/dist/cjs/silkscreenFont.js +54 -0
  16. package/dist/cjs/silkscreenFont.js.map +7 -0
  17. package/dist/cjs/themes.js +256 -0
  18. package/dist/cjs/themes.js.map +7 -0
  19. package/dist/cjs/tokens.js +81 -0
  20. package/dist/cjs/tokens.js.map +7 -0
  21. package/dist/esm/colorUtils.js +43 -0
  22. package/dist/esm/colorUtils.js.map +7 -0
  23. package/dist/esm/colors.js +54 -0
  24. package/dist/esm/colors.js.map +7 -0
  25. package/dist/esm/firaFont.js +35 -0
  26. package/dist/esm/firaFont.js.map +7 -0
  27. package/dist/esm/fonts.js +3 -0
  28. package/dist/esm/fonts.js.map +7 -0
  29. package/dist/esm/index.js +4 -0
  30. package/dist/esm/index.js.map +7 -0
  31. package/dist/esm/interFont.js +61 -0
  32. package/dist/esm/interFont.js.map +7 -0
  33. package/dist/esm/silkscreenFont.js +35 -0
  34. package/dist/esm/silkscreenFont.js.map +7 -0
  35. package/dist/esm/themes.js +232 -0
  36. package/dist/esm/themes.js.map +7 -0
  37. package/dist/esm/tokens.js +54 -0
  38. package/dist/esm/tokens.js.map +7 -0
  39. package/dist/jsx/colorUtils.js +42 -0
  40. package/dist/jsx/colors.js +53 -0
  41. package/dist/jsx/firaFont.js +34 -0
  42. package/dist/jsx/fonts.js +2 -0
  43. package/dist/jsx/index.js +3 -0
  44. package/dist/jsx/interFont.js +60 -0
  45. package/dist/jsx/silkscreenFont.js +34 -0
  46. package/dist/jsx/themes.js +231 -0
  47. package/dist/jsx/tokens.js +53 -0
  48. package/package.json +27 -0
  49. package/types/colorUtils.d.ts +4 -0
  50. package/types/colorUtils.d.ts.map +1 -0
  51. package/types/colors.d.ts +444 -0
  52. package/types/colors.d.ts.map +1 -0
  53. package/types/firaFont.d.ts +47 -0
  54. package/types/firaFont.d.ts.map +1 -0
  55. package/types/fonts.d.ts +3 -0
  56. package/types/fonts.d.ts.map +1 -0
  57. package/types/index.d.ts +4 -0
  58. package/types/index.d.ts.map +1 -0
  59. package/types/interFont.d.ts +57 -0
  60. package/types/interFont.d.ts.map +1 -0
  61. package/types/silkscreenFont.d.ts +48 -0
  62. package/types/silkscreenFont.d.ts.map +1 -0
  63. package/types/themes.d.ts +4457 -0
  64. package/types/themes.d.ts.map +1 -0
  65. package/types/tokens.d.ts +334 -0
  66. package/types/tokens.d.ts.map +1 -0
@@ -0,0 +1,231 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import * as Colors from "@tamagui/colors";
4
+ import { allDarkColors, allLightColors } from "@tamagui/colors";
5
+ import { getVariableValue } from "@tamagui/core";
6
+ import { setColorAlpha } from "./colorUtils";
7
+ import { color } from "./tokens";
8
+ const alternates = [1, 2, 3, 4];
9
+ function createThemesFrom(name, getTheme, props) {
10
+ const { shift = 0 } = props;
11
+ const theme = getTheme(0 + shift, props);
12
+ let themeEntries = [[name, theme]];
13
+ const altThemes = alternates.map((alt) => [
14
+ `${name}_alt${alt}`,
15
+ getTheme(alt + shift, props)
16
+ ]);
17
+ const altButtonThemes = alternates.map((_, i) => {
18
+ const [bName, bTheme] = [altThemes[i][0], (altThemes[i + 1] || altThemes[i])[1]];
19
+ return [`${bName}_Button`, bTheme];
20
+ });
21
+ const darkerTheme = getTheme(Math.max(0, shift + (props.isLight ? 1 : -1)), props);
22
+ const activeTheme = makeActiveTheme(theme);
23
+ themeEntries = [
24
+ ...themeEntries,
25
+ ...altThemes,
26
+ ...altButtonThemes,
27
+ [`${name}_Button`, altThemes[0][1]],
28
+ [`${name}_darker`, darkerTheme],
29
+ [`${name}_active`, activeTheme]
30
+ ];
31
+ const themes2 = Object.fromEntries(themeEntries);
32
+ return themes2;
33
+ }
34
+ __name(createThemesFrom, "createThemesFrom");
35
+ const createTheme = /* @__PURE__ */ __name((str = 1, {
36
+ backgrounds,
37
+ isLight = true,
38
+ colors = [...backgrounds].reverse(),
39
+ offsets: offsetsProp
40
+ }) => {
41
+ var _a, _b, _c, _d;
42
+ const offsets = {
43
+ borderColor: (_b = (_a = offsetsProp == null ? void 0 : offsetsProp.borderColor) != null ? _a : offsetsProp == null ? void 0 : offsetsProp.background) != null ? _b : [0, 0, 0, 0],
44
+ background: (_c = offsetsProp == null ? void 0 : offsetsProp.background) != null ? _c : [0, 0, 0, 0],
45
+ color: (_d = offsetsProp == null ? void 0 : offsetsProp.color) != null ? _d : [0, 0, 0, 0]
46
+ };
47
+ const darkColors = isLight ? colors : backgrounds;
48
+ const lighterDir = isLight ? -1 : 1;
49
+ const darkerDir = -lighterDir;
50
+ const strongerDir = isLight ? darkerDir : lighterDir;
51
+ const get = /* @__PURE__ */ __name((arr, index, name = "background") => {
52
+ return arr[Math.max(0, Math.min(index + (offsets[name][str] || 0), arr.length - 1))];
53
+ }, "get");
54
+ const colorTranslucent = setColorAlpha(getVariableValue(get(colors, 0 + str, "color")), 0.5);
55
+ return {
56
+ background: get(backgrounds, str),
57
+ backgroundStronger: get(backgrounds, str + strongerDir),
58
+ backgroundSoft: get(backgrounds, str + 3),
59
+ backgroundHover: get(backgrounds, str + lighterDir),
60
+ backgroundPress: get(backgrounds, str + darkerDir * 1),
61
+ backgroundFocus: get(backgrounds, str + darkerDir * 2),
62
+ backgroundTransparent: color.grayA1,
63
+ borderColor: isLight ? get(colors, 8 - str, "borderColor") : get(backgrounds, 2 + str, "borderColor"),
64
+ borderColorHover: isLight ? get(colors, 6 - str, "borderColor") : get(backgrounds, 3 + str, "borderColor"),
65
+ borderColorPress: isLight ? get(colors, 5 - str, "borderColor") : get(backgrounds, 1 + str, "borderColor"),
66
+ borderColorFocus: isLight ? get(colors, 4 - str, "borderColor") : get(backgrounds, 3 + str, "borderColor"),
67
+ color: get(colors, 0 + str, "color"),
68
+ colorHover: get(colors, 1 + str, "color"),
69
+ colorPress: get(colors, 2 + str, "color"),
70
+ colorFocus: get(colors, 3 + str, "color"),
71
+ colorTranslucent,
72
+ colorMid: colors[Math.floor(colors.length / 2)],
73
+ shadowColor: isLight ? color.grayA3 : color.grayA8,
74
+ shadowColorHover: darkColors[!isLight ? 1 : 8],
75
+ shadowColorPress: darkColors[!isLight ? 1 : 8],
76
+ shadowColorFocus: darkColors[!isLight ? 1 : 8]
77
+ };
78
+ }, "createTheme");
79
+ const colorSchemes = [
80
+ { name: "blue", colors: Colors.blue, darkColors: Colors.blueDark },
81
+ { name: "gray", colors: Colors.gray, darkColors: Colors.grayDark },
82
+ { name: "green", colors: Colors.green, darkColors: Colors.greenDark },
83
+ { name: "indigo", colors: Colors.indigo, darkColors: Colors.indigoDark },
84
+ { name: "orange", colors: Colors.orange, darkColors: Colors.orangeDark },
85
+ { name: "pink", colors: Colors.pink, darkColors: Colors.pinkDark },
86
+ { name: "purple", colors: Colors.purple, darkColors: Colors.purpleDark },
87
+ { name: "red", colors: Colors.red, darkColors: Colors.redDark },
88
+ { name: "violet", colors: Colors.violet, darkColors: Colors.violetDark },
89
+ { name: "yellow", colors: Colors.yellow, darkColors: Colors.yellowDark },
90
+ { name: "teal", colors: Colors.teal, darkColors: Colors.tealDark },
91
+ { name: "lime", colors: Colors.lime, darkColors: Colors.limeDark },
92
+ { name: "brown", colors: Colors.brown, darkColors: Colors.brownDark }
93
+ ];
94
+ const lightGradient = [
95
+ "#fff",
96
+ "#f4f4f4",
97
+ color.gray1,
98
+ color.gray2,
99
+ color.gray3,
100
+ color.gray4,
101
+ color.gray5,
102
+ color.gray6,
103
+ color.gray7,
104
+ color.gray8,
105
+ color.gray9,
106
+ color.gray10,
107
+ color.gray11,
108
+ color.gray12
109
+ ];
110
+ const darkGradient = [
111
+ "#111111",
112
+ "#151515",
113
+ "#191919",
114
+ "#232323",
115
+ "#282828",
116
+ "#323232",
117
+ "#383838",
118
+ "#424242",
119
+ "#494949",
120
+ "#545454",
121
+ "#626262",
122
+ "#777777"
123
+ ];
124
+ const lightThemes = createThemesFrom("light", createTheme, {
125
+ backgrounds: lightGradient,
126
+ isLight: true
127
+ });
128
+ const darkThemes = createThemesFrom("dark", createTheme, {
129
+ backgrounds: darkGradient,
130
+ colors: lightGradient,
131
+ isLight: false,
132
+ shift: 1,
133
+ offsets: {
134
+ color: [0, 6, 7, 7, 7, 7]
135
+ }
136
+ });
137
+ const baseThemes = {
138
+ ...lightThemes,
139
+ light: {
140
+ ...allLightColors,
141
+ ...lightThemes.light
142
+ },
143
+ light_active: makeActiveTheme(lightThemes.light),
144
+ light_Card: lightThemes.light,
145
+ light_Button: lightThemes.light_alt1,
146
+ ...darkThemes,
147
+ dark: {
148
+ ...allDarkColors,
149
+ ...darkThemes.dark
150
+ },
151
+ dark_active: makeActiveTheme(darkThemes.dark),
152
+ dark_Card: darkThemes.dark_alt1,
153
+ dark_Button: darkThemes.dark_alt1
154
+ };
155
+ function makeActiveTheme(theme) {
156
+ const res = { ...theme };
157
+ res.backgroundHover = res.background;
158
+ res.colorHover = res.color;
159
+ res.backgroundPress = res.background;
160
+ res.colorPress = res.color;
161
+ return res;
162
+ }
163
+ __name(makeActiveTheme, "makeActiveTheme");
164
+ const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors }) => {
165
+ const [altLightThemes, altDarkThemes] = [colors, darkColors].map((colors2, i) => {
166
+ const isLight = i === 0;
167
+ const scheme = isLight ? "light" : "dark";
168
+ const shift = isLight ? 0 : 1;
169
+ let backgrounds = Object.values(colors2);
170
+ if (!isLight) {
171
+ const [_, h, sp, lp] = backgrounds[0].match(/hsl\(([0-9\.]+), ([0-9\.]+)\%, ([0-9\.]+)\%\)/);
172
+ backgrounds.unshift(`hsl(${h}, ${sp}%, ${parseFloat(lp) / 2}%)`);
173
+ }
174
+ const themeWithAlts = createThemesFrom(name, createTheme, {
175
+ backgrounds,
176
+ isLight,
177
+ shift,
178
+ isBase: false,
179
+ offsets: {
180
+ background: isLight ? [1, 1, 1, 0, 0, 0] : null,
181
+ borderColor: isLight ? [0, 1, 1, 2, 2, -2] : null,
182
+ color: isLight ? [0, 0, -1, -2, -3, -3, -4] : [-1, -1, -1, -1, -1, -1]
183
+ }
184
+ });
185
+ return Object.entries(themeWithAlts).map(([k, v]) => [`${scheme}_${k}`, v]);
186
+ });
187
+ const lightButtonTheme = altLightThemes[0];
188
+ const darkButtonTheme = altDarkThemes[0];
189
+ return [
190
+ ...altLightThemes,
191
+ [`${lightButtonTheme[0]}_Button`, altLightThemes[2][1]],
192
+ ...altDarkThemes,
193
+ [`${darkButtonTheme[0]}_Button`, altDarkThemes[2][1]]
194
+ ];
195
+ });
196
+ const transparent = {
197
+ background: "transparent",
198
+ backgroundSoft: "transparent",
199
+ backgroundHover: "transparent",
200
+ backgroundPress: "transparent",
201
+ backgroundFocus: "transparent",
202
+ backgroundTransparent: "transparent",
203
+ shadowColor: "transparent",
204
+ shadowColorHover: "transparent",
205
+ shadowColorPress: "transparent",
206
+ shadowColorFocus: "transparent"
207
+ };
208
+ const dark_outline = {
209
+ ...baseThemes.dark,
210
+ borderColor: "#fff",
211
+ ...transparent
212
+ };
213
+ const light_outline = {
214
+ ...baseThemes.light,
215
+ borderColor: "#000",
216
+ ...transparent
217
+ };
218
+ const colorThemes = Object.fromEntries(colorThemeEntries);
219
+ const allThemes = {
220
+ ...baseThemes,
221
+ ...colorThemes,
222
+ dark_outline,
223
+ light_outline
224
+ };
225
+ const themes = allThemes;
226
+ export {
227
+ colorSchemes,
228
+ darkGradient,
229
+ lightGradient,
230
+ themes
231
+ };
@@ -0,0 +1,53 @@
1
+ import { allLightColors, darkColorsPostfixed } from "@tamagui/colors";
2
+ const size = {
3
+ true: 20,
4
+ 0: 0,
5
+ "0.5": 2,
6
+ 1: 6,
7
+ 2: 10,
8
+ 3: 15,
9
+ 4: 20,
10
+ 5: 25,
11
+ 6: 30,
12
+ 7: 40,
13
+ 8: 50,
14
+ 9: 65,
15
+ 10: 75,
16
+ 11: 85,
17
+ 12: 100
18
+ };
19
+ const space = {
20
+ ...size,
21
+ ...Object.fromEntries(Object.entries(size).map(([k, v]) => [`-${k}`, -v]))
22
+ };
23
+ const zIndex = {
24
+ 0: 0,
25
+ 1: 100,
26
+ 2: 200,
27
+ 3: 300,
28
+ 4: 400,
29
+ 5: 500
30
+ };
31
+ const color = {
32
+ ...allLightColors,
33
+ ...darkColorsPostfixed
34
+ };
35
+ const radius = {
36
+ 0: 0,
37
+ 1: 3,
38
+ 2: 5,
39
+ 3: 7,
40
+ 4: 9,
41
+ 5: 10,
42
+ 6: 12,
43
+ 7: 16,
44
+ 8: 20,
45
+ 9: 30
46
+ };
47
+ export {
48
+ color,
49
+ radius,
50
+ size,
51
+ space,
52
+ zIndex
53
+ };
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@tamagui/theme-base",
3
+ "version": "1.0.0-beta.147+6d63af55",
4
+ "typings": "types",
5
+ "main": "dist/cjs",
6
+ "module": "dist/esm",
7
+ "module:jsx": "dist/jsx",
8
+ "files": [
9
+ "types",
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "build": "tamagui-build",
14
+ "watch": "tamagui-build --watch",
15
+ "clean": "tamagui-build clean",
16
+ "clean:build": "tamagui-build clean:build"
17
+ },
18
+ "devDependencies": {
19
+ "@tamagui/build": "^1.0.0-beta.147+6d63af55",
20
+ "@tamagui/colors": "^1.0.0-beta.147+6d63af55",
21
+ "@tamagui/core": "^1.0.0-beta.147+6d63af55"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "gitHead": "6d63af55317e3c878ea0b61995728fa480776ffc"
27
+ }
@@ -0,0 +1,4 @@
1
+ import { Variable } from '@tamagui/core';
2
+ export declare const hexToRGBA: (hex: string, alpha?: number) => string;
3
+ export declare const setColorAlpha: (colorIn: string | Variable, alpha?: number) => string;
4
+ //# sourceMappingURL=colorUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorUtils.d.ts","sourceRoot":"","sources":["../src/colorUtils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAoB,MAAM,eAAe,CAAA;AAE1D,eAAO,MAAM,SAAS,QAAS,MAAM,2BAQpC,CAAA;AAED,eAAO,MAAM,aAAa,YAAa,MAAM,GAAG,QAAQ,2BAYvD,CAAA"}