@tamagui/theme-base 1.0.0-beta.222 → 1.0.0-beta.3

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 (52) hide show
  1. package/dist/cjs/colorUtils.js +5 -0
  2. package/dist/cjs/themes.js +55 -35
  3. package/dist/cjs/themes.js.map +2 -2
  4. package/dist/cjs/tokens.js +18 -17
  5. package/dist/cjs/tokens.js.map +2 -2
  6. package/dist/esm/themes.js +48 -38
  7. package/dist/esm/themes.js.map +2 -2
  8. package/dist/esm/tokens.js +9 -17
  9. package/dist/esm/tokens.js.map +2 -2
  10. package/dist/jsx/themes.js +48 -38
  11. package/dist/jsx/tokens.js +9 -17
  12. package/package.json +5 -5
  13. package/types/themes.d.ts +4096 -151
  14. package/types/themes.d.ts.map +1 -1
  15. package/types/tokens.d.ts +3 -15
  16. package/types/tokens.d.ts.map +1 -1
  17. package/LICENSE +0 -21
  18. package/dist/cjs/colors.js +0 -64
  19. package/dist/cjs/colors.js.map +0 -7
  20. package/dist/cjs/firaFont.js +0 -54
  21. package/dist/cjs/firaFont.js.map +0 -7
  22. package/dist/cjs/fonts.js +0 -19
  23. package/dist/cjs/fonts.js.map +0 -7
  24. package/dist/cjs/interFont.js +0 -80
  25. package/dist/cjs/interFont.js.map +0 -7
  26. package/dist/cjs/silkscreenFont.js +0 -54
  27. package/dist/cjs/silkscreenFont.js.map +0 -7
  28. package/dist/esm/colors.js +0 -54
  29. package/dist/esm/colors.js.map +0 -7
  30. package/dist/esm/firaFont.js +0 -35
  31. package/dist/esm/firaFont.js.map +0 -7
  32. package/dist/esm/fonts.js +0 -3
  33. package/dist/esm/fonts.js.map +0 -7
  34. package/dist/esm/interFont.js +0 -61
  35. package/dist/esm/interFont.js.map +0 -7
  36. package/dist/esm/silkscreenFont.js +0 -35
  37. package/dist/esm/silkscreenFont.js.map +0 -7
  38. package/dist/jsx/colors.js +0 -53
  39. package/dist/jsx/firaFont.js +0 -34
  40. package/dist/jsx/fonts.js +0 -2
  41. package/dist/jsx/interFont.js +0 -60
  42. package/dist/jsx/silkscreenFont.js +0 -34
  43. package/types/colors.d.ts +0 -444
  44. package/types/colors.d.ts.map +0 -1
  45. package/types/firaFont.d.ts +0 -47
  46. package/types/firaFont.d.ts.map +0 -1
  47. package/types/fonts.d.ts +0 -3
  48. package/types/fonts.d.ts.map +0 -1
  49. package/types/interFont.d.ts +0 -57
  50. package/types/interFont.d.ts.map +0 -1
  51. package/types/silkscreenFont.d.ts +0 -48
  52. package/types/silkscreenFont.d.ts.map +0 -1
@@ -1,21 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
1
3
  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
- };
4
+ const sizeKeys = ["true", "0", "0.25", "0.5", "1", "1.5", "2", "2.5", "3", "3.5", "4", "4.5", "5", "5.5", "6", "6.5", "7", "7.5", "8", "9", "10", "11", "12", "13", "14"];
5
+ const getSizeAt = /* @__PURE__ */ __name((index) => index === 0 ? 0 : Math.round(Math.pow(1.6, index)) + Math.floor(3 * index), "getSizeAt");
6
+ const size = Object.fromEntries(sizeKeys.map((key) => {
7
+ return [key, getSizeAt(key === "true" ? 4 : +key)];
8
+ }));
19
9
  const space = {
20
10
  ...size,
21
11
  ...Object.fromEntries(Object.entries(size).map(([k, v]) => [`-${k}`, -v]))
@@ -46,8 +36,10 @@ const radius = {
46
36
  };
47
37
  export {
48
38
  color,
39
+ getSizeAt,
49
40
  radius,
50
41
  size,
42
+ sizeKeys,
51
43
  space,
52
44
  zIndex
53
45
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/tokens.tsx"],
4
- "sourcesContent": ["import { allLightColors, darkColorsPostfixed } from '@tamagui/colors'\n\nexport const size = {\n true: 20, // for space boolean true\n 0: 0,\n '0.5': 2,\n 1: 6,\n 2: 10,\n 3: 15,\n 4: 20,\n 5: 25,\n 6: 30,\n 7: 40,\n 8: 50,\n 9: 65,\n 10: 75,\n 11: 85,\n 12: 100,\n} as const\n\ntype Sizes = typeof size\ntype SizeKeys = keyof Sizes\n\nexport const space: {\n [Key in `-${SizeKeys}` | SizeKeys]: Key extends keyof Sizes ? Sizes[Key] : number\n} = {\n ...size,\n ...Object.fromEntries(Object.entries(size).map(([k, v]) => [`-${k}`, -v])),\n} as any\n\nexport const zIndex = {\n 0: 0,\n 1: 100,\n 2: 200,\n 3: 300,\n 4: 400,\n 5: 500,\n}\n\nexport const color = {\n ...allLightColors,\n ...darkColorsPostfixed,\n}\n\nexport const radius = {\n 0: 0,\n 1: 3,\n 2: 5,\n 3: 7,\n 4: 9,\n 5: 10,\n 6: 12,\n 7: 16,\n 8: 20,\n 9: 30,\n}\n"],
5
- "mappings": "AAAA;AAEO,MAAM,OAAO;AAAA,EAClB,MAAM;AAAA,EACN,GAAG;AAAA,EACH,OAAO;AAAA,EACP,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAKO,MAAM,QAET;AAAA,KACC;AAAA,KACA,OAAO,YAAY,OAAO,QAAQ,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAC3E;AAEO,MAAM,SAAS;AAAA,EACpB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,QAAQ;AAAA,KAChB;AAAA,KACA;AACL;AAEO,MAAM,SAAS;AAAA,EACpB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;",
4
+ "sourcesContent": ["import { allLightColors, darkColorsPostfixed } from '@tamagui/colors'\n\n// acknowledge you need more granularity at the smaller sizes with .5s\n// prettier-ignore\nexport const sizeKeys = ['true', '0', '0.25', '0.5', '1', '1.5', '2', '2.5', '3', '3.5', '4', '4.5', '5', '5.5', '6', '6.5', '7', '7.5', '8', '9', '10', '11', '12', '13', '14'] as const\n\n// slightly more than double every 2 indices apart\nexport const getSizeAt = (index: number) =>\n index === 0 ? 0 : Math.round(Math.pow(1.6, index)) + Math.floor(3 * index)\n\nexport const size: {\n [key in typeof sizeKeys[any]]: number\n} = Object.fromEntries(\n sizeKeys.map((key) => {\n return [key, getSizeAt(key === 'true' ? 4 : +key)]\n })\n) as any\n\ntype Sizes = typeof size\ntype SizeKeys = keyof Sizes\n\nexport const space: {\n [Key in `-${SizeKeys}` | SizeKeys]: Key extends keyof Sizes ? Sizes[Key] : number\n} = {\n ...size,\n ...Object.fromEntries(Object.entries(size).map(([k, v]) => [`-${k}`, -v])),\n} as any\n\nexport const zIndex = {\n 0: 0,\n 1: 100,\n 2: 200,\n 3: 300,\n 4: 400,\n 5: 500,\n}\n\nexport const color = {\n ...allLightColors,\n ...darkColorsPostfixed,\n}\n\nexport const radius = {\n 0: 0,\n 1: 3,\n 2: 5,\n 3: 7,\n 4: 9,\n 5: 10,\n 6: 12,\n 7: 16,\n 8: 20,\n 9: 30,\n}\n"],
5
+ "mappings": ";;AAAA;AAIO,MAAM,WAAW,CAAC,QAAQ,KAAK,QAAQ,OAAO,KAAK,OAAO,KAAK,OAAO,KAAK,OAAO,KAAK,OAAO,KAAK,OAAO,KAAK,OAAO,KAAK,OAAO,KAAK,KAAK,MAAM,MAAM,MAAM,MAAM,IAAI;AAGxK,MAAM,YAAY,wBAAC,UACxB,UAAU,IAAI,IAAI,KAAK,MAAM,KAAK,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,GADlD;AAGlB,MAAM,OAET,OAAO,YACT,SAAS,IAAI,CAAC,QAAQ;AACpB,SAAO,CAAC,KAAK,UAAU,QAAQ,SAAS,IAAI,CAAC,GAAG,CAAC;AACnD,CAAC,CACH;AAKO,MAAM,QAET;AAAA,KACC;AAAA,KACA,OAAO,YAAY,OAAO,QAAQ,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAC3E;AAEO,MAAM,SAAS;AAAA,EACpB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,QAAQ;AAAA,KAChB;AAAA,KACA;AACL;AAEO,MAAM,SAAS;AAAA,EACpB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;",
6
6
  "names": []
7
7
  }
@@ -35,7 +35,9 @@ __name(createThemesFrom, "createThemesFrom");
35
35
  const createTheme = /* @__PURE__ */ __name((str = 1, {
36
36
  backgrounds,
37
37
  isLight = true,
38
+ isBase = false,
38
39
  colors = [...backgrounds].reverse(),
40
+ borderColors = isLight ? colors : backgrounds,
39
41
  offsets: offsetsProp
40
42
  }) => {
41
43
  var _a, _b, _c, _d;
@@ -52,7 +54,7 @@ const createTheme = /* @__PURE__ */ __name((str = 1, {
52
54
  return arr[Math.max(0, Math.min(index + (offsets[name][str] || 0), arr.length - 1))];
53
55
  }, "get");
54
56
  const colorTranslucent = setColorAlpha(getVariableValue(get(colors, 0 + str, "color")), 0.5);
55
- return {
57
+ let theme = {
56
58
  background: get(backgrounds, str),
57
59
  backgroundStronger: get(backgrounds, str + strongerDir),
58
60
  backgroundSoft: get(backgrounds, str + 3),
@@ -60,10 +62,6 @@ const createTheme = /* @__PURE__ */ __name((str = 1, {
60
62
  backgroundPress: get(backgrounds, str + darkerDir * 1),
61
63
  backgroundFocus: get(backgrounds, str + darkerDir * 2),
62
64
  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
65
  color: get(colors, 0 + str, "color"),
68
66
  colorHover: get(colors, 1 + str, "color"),
69
67
  colorPress: get(colors, 2 + str, "color"),
@@ -73,8 +71,28 @@ const createTheme = /* @__PURE__ */ __name((str = 1, {
73
71
  shadowColor: isLight ? color.grayA3 : color.grayA8,
74
72
  shadowColorHover: darkColors[!isLight ? 1 : 8],
75
73
  shadowColorPress: darkColors[!isLight ? 1 : 8],
76
- shadowColorFocus: darkColors[!isLight ? 1 : 8]
74
+ shadowColorFocus: darkColors[!isLight ? 1 : 8],
75
+ borderColor: null,
76
+ borderColorHover: null,
77
+ borderColorPress: null,
78
+ borderColorFocus: null
77
79
  };
80
+ if (isBase) {
81
+ Object.assign(theme, {
82
+ borderColor: isLight ? get(colors, 8 - str, "borderColor") : get(backgrounds, 2 + str, "borderColor"),
83
+ borderColorHover: isLight ? get(colors, 6 - str, "borderColor") : get(backgrounds, 3 + str, "borderColor"),
84
+ borderColorPress: isLight ? get(colors, 5 - str, "borderColor") : get(backgrounds, 1 + str, "borderColor"),
85
+ borderColorFocus: isLight ? get(colors, 4 - str, "borderColor") : get(backgrounds, 3 + str, "borderColor")
86
+ });
87
+ } else {
88
+ Object.assign(theme, {
89
+ borderColor: get(borderColors, 1 + strongerDir, "borderColor"),
90
+ borderColorHover: get(borderColors, 2 + strongerDir, "borderColor"),
91
+ borderColorPress: get(borderColors, 3 + strongerDir, "borderColor"),
92
+ borderColorFocus: get(borderColors, 4 + strongerDir, "borderColor")
93
+ });
94
+ }
95
+ return theme;
78
96
  }, "createTheme");
79
97
  const colorSchemes = [
80
98
  { name: "blue", colors: Colors.blue, darkColors: Colors.blueDark },
@@ -123,15 +141,17 @@ const darkGradient = [
123
141
  ];
124
142
  const lightThemes = createThemesFrom("light", createTheme, {
125
143
  backgrounds: lightGradient,
144
+ borderColors: lightGradient.slice(2),
126
145
  isLight: true
127
146
  });
128
147
  const darkThemes = createThemesFrom("dark", createTheme, {
129
148
  backgrounds: darkGradient,
130
- colors: lightGradient,
149
+ colors: lightGradient.slice(2),
150
+ isBase: true,
131
151
  isLight: false,
132
152
  shift: 1,
133
153
  offsets: {
134
- color: [0, 6, 7, 7, 7, 7]
154
+ color: [0, 4, 5, 5, 5, 5]
135
155
  }
136
156
  });
137
157
  const baseThemes = {
@@ -142,6 +162,7 @@ const baseThemes = {
142
162
  },
143
163
  light_active: makeActiveTheme(lightThemes.light),
144
164
  light_Card: lightThemes.light,
165
+ light_DrawerFrame: lightThemes.light_alt1,
145
166
  light_Button: lightThemes.light_alt1,
146
167
  ...darkThemes,
147
168
  dark: {
@@ -150,6 +171,7 @@ const baseThemes = {
150
171
  },
151
172
  dark_active: makeActiveTheme(darkThemes.dark),
152
173
  dark_Card: darkThemes.dark_alt1,
174
+ dark_DrawerFrame: darkThemes.dark_alt2,
153
175
  dark_Button: darkThemes.dark_alt1
154
176
  };
155
177
  function makeActiveTheme(theme) {
@@ -162,23 +184,31 @@ function makeActiveTheme(theme) {
162
184
  }
163
185
  __name(makeActiveTheme, "makeActiveTheme");
164
186
  const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors }) => {
165
- const [altLightThemes, altDarkThemes] = [colors, darkColors].map((colors2, i) => {
187
+ const [altLightThemes, altDarkThemes] = [
188
+ { colors: darkColors, backgrounds: colors },
189
+ { colors, backgrounds: darkColors }
190
+ ].map((props, i) => {
166
191
  const isLight = i === 0;
192
+ const [backgrounds, colors2] = [
193
+ Object.values(props.backgrounds),
194
+ Object.values(props.colors).slice(isLight ? 2 : 2)
195
+ ];
167
196
  const scheme = isLight ? "light" : "dark";
168
197
  const shift = isLight ? 0 : 1;
169
- let backgrounds = Object.values(colors2);
170
198
  if (!isLight) {
171
199
  const [_, h, sp, lp] = backgrounds[0].match(/hsl\(([0-9\.]+), ([0-9\.]+)\%, ([0-9\.]+)\%\)/);
172
200
  backgrounds.unshift(`hsl(${h}, ${sp}%, ${parseFloat(lp) / 2}%)`);
173
201
  }
174
202
  const themeWithAlts = createThemesFrom(name, createTheme, {
203
+ colors: colors2,
175
204
  backgrounds,
205
+ borderColors: backgrounds,
176
206
  isLight,
177
207
  shift,
178
208
  isBase: false,
179
209
  offsets: {
180
- background: isLight ? [1, 1, 1, 0, 0, 0] : null,
181
- borderColor: isLight ? [0, 1, 1, 2, 2, -2] : null,
210
+ background: isLight ? [0, 0, 0, 0, 0, 0] : null,
211
+ borderColor: isLight ? [3, 3, 3, 3, 2] : null,
182
212
  color: isLight ? [0, 0, -1, -2, -3, -3, -4] : [-1, -1, -1, -1, -1, -1]
183
213
  }
184
214
  });
@@ -189,38 +219,18 @@ const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors }) =>
189
219
  return [
190
220
  ...altLightThemes,
191
221
  [`${lightButtonTheme[0]}_Button`, altLightThemes[2][1]],
222
+ [`${lightButtonTheme[0]}_Card`, altLightThemes[2][1]],
223
+ [`${lightButtonTheme[0]}_DrawerFrame`, altLightThemes[2][1]],
192
224
  ...altDarkThemes,
193
- [`${darkButtonTheme[0]}_Button`, altDarkThemes[2][1]]
225
+ [`${darkButtonTheme[0]}_Button`, altDarkThemes[2][1]],
226
+ [`${darkButtonTheme[0]}_Card`, altDarkThemes[2][1]],
227
+ [`${darkButtonTheme[0]}_DrawerFrame`, altDarkThemes[2][1]]
194
228
  ];
195
229
  });
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
230
  const colorThemes = Object.fromEntries(colorThemeEntries);
219
231
  const allThemes = {
220
232
  ...baseThemes,
221
- ...colorThemes,
222
- dark_outline,
223
- light_outline
233
+ ...colorThemes
224
234
  };
225
235
  const themes = allThemes;
226
236
  export {
@@ -1,21 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
1
3
  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
- };
4
+ const sizeKeys = ["true", "0", "0.25", "0.5", "1", "1.5", "2", "2.5", "3", "3.5", "4", "4.5", "5", "5.5", "6", "6.5", "7", "7.5", "8", "9", "10", "11", "12", "13", "14"];
5
+ const getSizeAt = /* @__PURE__ */ __name((index) => index === 0 ? 0 : Math.round(Math.pow(1.6, index)) + Math.floor(3 * index), "getSizeAt");
6
+ const size = Object.fromEntries(sizeKeys.map((key) => {
7
+ return [key, getSizeAt(key === "true" ? 4 : +key)];
8
+ }));
19
9
  const space = {
20
10
  ...size,
21
11
  ...Object.fromEntries(Object.entries(size).map(([k, v]) => [`-${k}`, -v]))
@@ -46,8 +36,10 @@ const radius = {
46
36
  };
47
37
  export {
48
38
  color,
39
+ getSizeAt,
49
40
  radius,
50
41
  size,
42
+ sizeKeys,
51
43
  space,
52
44
  zIndex
53
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/theme-base",
3
- "version": "1.0.0-beta.222+464bca9b",
3
+ "version": "1.0.0-beta.3",
4
4
  "typings": "types",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -16,12 +16,12 @@
16
16
  "clean:build": "tamagui-build clean:build"
17
17
  },
18
18
  "devDependencies": {
19
- "@tamagui/build": "^1.0.0-beta.222+464bca9b",
20
- "@tamagui/colors": "^1.0.0-beta.222+464bca9b",
21
- "@tamagui/core": "^1.0.0-beta.222+464bca9b"
19
+ "@tamagui/build": "^1.0.0-beta.2",
20
+ "@tamagui/colors": "^1.0.0-beta.2",
21
+ "@tamagui/core": "^1.0.0-beta.2"
22
22
  },
23
23
  "publishConfig": {
24
24
  "access": "public"
25
25
  },
26
- "gitHead": "464bca9bb632fcd9557a632d8e8dc49db243753c"
26
+ "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14"
27
27
  }