@tamagui/theme-base 1.0.1-rc.1.4 → 1.0.1-rc.10

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.
@@ -0,0 +1,167 @@
1
+ import {
2
+ blue,
3
+ blueDark,
4
+ gray,
5
+ grayA,
6
+ grayDark,
7
+ grayDarkA,
8
+ green,
9
+ greenDark,
10
+ orange,
11
+ orangeDark,
12
+ pink,
13
+ pinkDark,
14
+ purple,
15
+ purpleDark,
16
+ red,
17
+ redDark,
18
+ teal,
19
+ tealDark,
20
+ violet,
21
+ violetDark,
22
+ yellow,
23
+ yellowDark
24
+ } from "@tamagui/colors";
25
+ import { createTokens } from "@tamagui/core";
26
+ const size = {
27
+ 0: 0,
28
+ 0.25: 2,
29
+ 0.5: 4,
30
+ 0.75: 8,
31
+ 1: 20,
32
+ 1.5: 24,
33
+ 2: 28,
34
+ 2.5: 32,
35
+ 3: 36,
36
+ 3.5: 40,
37
+ 4: 44,
38
+ true: 44,
39
+ 4.5: 48,
40
+ 5: 52,
41
+ 5.5: 59,
42
+ 6: 64,
43
+ 6.5: 69,
44
+ 7: 74,
45
+ 7.6: 79,
46
+ 8: 84,
47
+ 8.5: 89,
48
+ 9: 94,
49
+ 9.5: 99,
50
+ 10: 104,
51
+ 11: 124,
52
+ 12: 144,
53
+ 13: 164,
54
+ 14: 184,
55
+ 15: 204,
56
+ 16: 224,
57
+ 17: 224,
58
+ 18: 244,
59
+ 19: 264,
60
+ 20: 284
61
+ };
62
+ const spaces = Object.entries(size).map(([k, v]) => [
63
+ k,
64
+ Math.max(0, v <= 16 ? Math.round(v * 0.333) : Math.floor(v * 0.7 - 12))
65
+ ]);
66
+ const spacesNegative = spaces.map(([k, v]) => [`-${k}`, -v]);
67
+ const space = {
68
+ ...Object.fromEntries(spaces),
69
+ ...Object.fromEntries(spacesNegative)
70
+ };
71
+ const zIndex = {
72
+ 0: 0,
73
+ 1: 100,
74
+ 2: 200,
75
+ 3: 300,
76
+ 4: 400,
77
+ 5: 500
78
+ };
79
+ const colorTokens = {
80
+ light: {
81
+ blue,
82
+ gray,
83
+ grayA,
84
+ green,
85
+ orange,
86
+ pink,
87
+ purple,
88
+ red,
89
+ violet,
90
+ yellow,
91
+ teal
92
+ },
93
+ dark: {
94
+ blue: blueDark,
95
+ gray: grayDark,
96
+ grayA: grayDarkA,
97
+ green: greenDark,
98
+ orange: orangeDark,
99
+ pink: pinkDark,
100
+ purple: purpleDark,
101
+ red: redDark,
102
+ violet: violetDark,
103
+ yellow: yellowDark,
104
+ teal: tealDark
105
+ }
106
+ };
107
+ const darkColors = {
108
+ ...colorTokens.dark.blue,
109
+ ...colorTokens.dark.gray,
110
+ ...colorTokens.dark.grayA,
111
+ ...colorTokens.dark.green,
112
+ ...colorTokens.dark.orange,
113
+ ...colorTokens.dark.pink,
114
+ ...colorTokens.dark.purple,
115
+ ...colorTokens.dark.red,
116
+ ...colorTokens.dark.violet,
117
+ ...colorTokens.dark.yellow,
118
+ ...colorTokens.dark.teal
119
+ };
120
+ const lightColors = {
121
+ ...colorTokens.light.blue,
122
+ ...colorTokens.light.gray,
123
+ ...colorTokens.light.grayA,
124
+ ...colorTokens.light.green,
125
+ ...colorTokens.light.orange,
126
+ ...colorTokens.light.pink,
127
+ ...colorTokens.light.purple,
128
+ ...colorTokens.light.red,
129
+ ...colorTokens.light.violet,
130
+ ...colorTokens.light.yellow,
131
+ ...colorTokens.light.teal
132
+ };
133
+ const allColors = {
134
+ ...postfixObjKeys(lightColors, "Light"),
135
+ ...postfixObjKeys(darkColors, "Dark")
136
+ };
137
+ function postfixObjKeys(obj, postfix) {
138
+ return Object.fromEntries(Object.entries(obj).map(([k, v]) => [`${k}${postfix}`, v]));
139
+ }
140
+ const radius = {
141
+ 0: 0,
142
+ 1: 3,
143
+ 2: 5,
144
+ 3: 7,
145
+ 4: 9,
146
+ 5: 10,
147
+ 6: 16,
148
+ 7: 19,
149
+ 8: 22,
150
+ 9: 26,
151
+ 10: 34,
152
+ 11: 42,
153
+ 12: 50
154
+ };
155
+ const tokens = createTokens({
156
+ color: allColors,
157
+ radius,
158
+ zIndex,
159
+ space,
160
+ size
161
+ });
162
+ export {
163
+ darkColors,
164
+ lightColors,
165
+ tokens
166
+ };
167
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/tokens.tsx"],
4
+ "sourcesContent": ["import {\n blue,\n blueDark,\n gray,\n grayA,\n grayDark,\n grayDarkA,\n green,\n greenDark,\n orange,\n orangeDark,\n pink,\n pinkDark,\n purple,\n purpleDark,\n red,\n redDark,\n teal,\n tealDark,\n violet,\n violetDark,\n yellow,\n yellowDark,\n} from '@tamagui/colors'\nimport { Variable, createTokens } from '@tamagui/core'\n\n// should roughly map to button/input etc height at each level\n// fonts should match that height/lineHeight at each stop\n// so these are really non-linear on purpose\n// why?\n// - at sizes <1, used for fine grained things (borders, smallest paddingY)\n// - so smallest padY should be roughly 1-4px so it can join with lineHeight\n// - at sizes >=1, have to consider \"pressability\" (jumps up)\n// - after that it should go upwards somewhat naturally\n// - H1 / headings top out at 10 naturally, so after 10 we can go upwards faster\n// but also one more wrinkle...\n// space is used in conjunction with size\n// i'm setting space to generally just a fixed fraction of size (~1/3-2/3 still fine tuning)\nconst size = {\n 0: 0,\n 0.25: 2,\n 0.5: 4,\n 0.75: 8,\n 1: 20,\n 1.5: 24,\n 2: 28,\n 2.5: 32,\n 3: 36,\n 3.5: 40,\n 4: 44,\n true: 44,\n 4.5: 48,\n 5: 52,\n 5.5: 59,\n 6: 64,\n 6.5: 69,\n 7: 74,\n 7.6: 79,\n 8: 84,\n 8.5: 89,\n 9: 94,\n 9.5: 99,\n 10: 104,\n 11: 124,\n 12: 144,\n 13: 164,\n 14: 184,\n 15: 204,\n 16: 224,\n 17: 224,\n 18: 244,\n 19: 264,\n 20: 284,\n}\n\ntype Sizes = typeof size\ntype SizeKeys = `${keyof Sizes}`\n\nconst spaces = Object.entries(size).map(([k, v]) => [\n k,\n Math.max(0, v <= 16 ? Math.round(v * 0.333) : Math.floor(v * 0.7 - 12)),\n])\n\nconst spacesNegative = spaces.map(([k, v]) => [`-${k}`, -v])\n\nconst space: {\n [Key in `-${SizeKeys}` | SizeKeys]: Key extends keyof Sizes ? Sizes[Key] : number\n} = {\n ...Object.fromEntries(spaces),\n ...Object.fromEntries(spacesNegative),\n} as any\n\nconst zIndex = {\n 0: 0,\n 1: 100,\n 2: 200,\n 3: 300,\n 4: 400,\n 5: 500,\n}\n\nconst colorTokens = {\n light: {\n blue: blue,\n gray: gray,\n grayA: grayA,\n green: green,\n orange: orange,\n pink: pink,\n purple: purple,\n red: red,\n violet: violet,\n yellow: yellow,\n teal: teal,\n },\n dark: {\n blue: blueDark,\n gray: grayDark,\n grayA: grayDarkA,\n green: greenDark,\n orange: orangeDark,\n pink: pinkDark,\n purple: purpleDark,\n red: redDark,\n violet: violetDark,\n yellow: yellowDark,\n teal: tealDark,\n },\n}\n\nexport const darkColors = {\n ...colorTokens.dark.blue,\n ...colorTokens.dark.gray,\n ...colorTokens.dark.grayA,\n ...colorTokens.dark.green,\n ...colorTokens.dark.orange,\n ...colorTokens.dark.pink,\n ...colorTokens.dark.purple,\n ...colorTokens.dark.red,\n ...colorTokens.dark.violet,\n ...colorTokens.dark.yellow,\n ...colorTokens.dark.teal,\n}\n\nexport const lightColors = {\n ...colorTokens.light.blue,\n ...colorTokens.light.gray,\n ...colorTokens.light.grayA,\n ...colorTokens.light.green,\n ...colorTokens.light.orange,\n ...colorTokens.light.pink,\n ...colorTokens.light.purple,\n ...colorTokens.light.red,\n ...colorTokens.light.violet,\n ...colorTokens.light.yellow,\n ...colorTokens.light.teal,\n}\n\nconst allColors = {\n ...postfixObjKeys(lightColors, 'Light'),\n ...postfixObjKeys(darkColors, 'Dark'),\n}\n\nfunction postfixObjKeys<A extends { [key: string]: Variable<string> | string }, B extends string>(\n obj: A,\n postfix: B\n): {\n [Key in `${keyof A extends string ? keyof A : never}${B}`]: Variable<string> | string\n} {\n return Object.fromEntries(Object.entries(obj).map(([k, v]) => [`${k}${postfix}`, v])) as any\n}\n\nconst radius = {\n 0: 0,\n 1: 3,\n 2: 5,\n 3: 7,\n 4: 9,\n 5: 10,\n 6: 16,\n 7: 19,\n 8: 22,\n 9: 26,\n 10: 34,\n 11: 42,\n 12: 50,\n}\n\nexport const tokens = createTokens({\n color: allColors,\n radius,\n zIndex,\n space,\n size,\n})\n"],
5
+ "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA;AAcA,MAAM,OAAO;AAAA,EACX,GAAG;AAAA,EACH,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,MAAM;AAAA,EACN,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAKA,MAAM,SAAS,OAAO,QAAQ,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,OAAO;AAAA,EAClD;AAAA,EACA,KAAK,IAAI,GAAG,KAAK,KAAK,KAAK,MAAM,IAAI,KAAK,IAAI,KAAK,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MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AACvB;AAEA,MAAM,YAAY;AAAA,EAChB,GAAG,eAAe,aAAa,OAAO;AAAA,EACtC,GAAG,eAAe,YAAY,MAAM;AACtC;AAEA,wBACE,KACA,SAGA;AACA,SAAO,OAAO,YAAY,OAAO,QAAQ,GAAG,EAAE,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC;AACtF;AAEA,MAAM,SAAS;AAAA,EACb,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;AAAA,EACH,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEO,MAAM,SAAS,aAAa;AAAA,EACjC,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/theme-base",
3
- "version": "1.0.1-rc.1.4",
3
+ "version": "1.0.1-rc.10",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -13,8 +13,8 @@
13
13
  "scripts": {
14
14
  "build": "tamagui-build",
15
15
  "watch": "tamagui-build --watch",
16
- "lint": "eslint src",
17
- "lint:fix": "yarn lint --fix",
16
+ "lint": "../../node_modules/.bin/rome check src",
17
+ "lint:fix": "../../node_modules/.bin/rome check --apply-suggested src",
18
18
  "clean": "tamagui-build clean",
19
19
  "clean:build": "tamagui-build clean:build"
20
20
  },
@@ -26,12 +26,12 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@tamagui/colors": "^1.0.1-rc.1.4",
30
- "@tamagui/core": "^1.0.1-rc.1.4",
31
- "@tamagui/create-themes": "^1.0.1-rc.1.4"
29
+ "@tamagui/colors": "^1.0.1-rc.10",
30
+ "@tamagui/core": "^1.0.1-rc.10",
31
+ "@tamagui/create-themes": "^1.0.1-rc.10"
32
32
  },
33
33
  "devDependencies": {
34
- "@tamagui/build": "^1.0.1-rc.1.4"
34
+ "@tamagui/build": "^1.0.1-rc.10"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
@@ -29,13 +29,14 @@ const isValidHex = (hex: string) => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex)
29
29
  const getChunksFromString = (st: string, chunkSize = 0) =>
30
30
  st.match(new RegExp(`.{${chunkSize}}`, 'g'))
31
31
 
32
- const convertHexUnitTo256 = (hexStr: string) => parseInt(hexStr.repeat(2 / hexStr.length), 16)
32
+ const convertHexUnitTo256 = (hexStr: string) =>
33
+ parseInt(hexStr.repeat(2 / hexStr.length), 16)
33
34
 
34
35
  const getAlphaFloat = (a: any, alpha = 1) => {
35
36
  if (a !== undefined) {
36
37
  return a / 255
37
38
  }
38
- if (typeof alpha != 'number' || alpha < 0 || alpha > 1) {
39
+ if (typeof alpha !== 'number' || alpha < 0 || alpha > 1) {
39
40
  return 1
40
41
  }
41
42
  return alpha
package/src/themes.tsx CHANGED
@@ -32,7 +32,7 @@ export const themes = createThemes<keyof typeof colorTokens.light>({
32
32
  '#494949',
33
33
  '#545454',
34
34
  '#626262',
35
- '#777777',
35
+ '#a5a5a5',
36
36
  ],
37
37
  colorsLight: colorTokens.light,
38
38
  colorsDark: colorTokens.dark,
package/src/tokens.tsx CHANGED
@@ -138,13 +138,20 @@ export const color = {
138
138
  ...postfixObjKeys(darkColors, 'Dark'),
139
139
  }
140
140
 
141
- function postfixObjKeys<A extends { [key: string]: Variable<string> | string }, B extends string>(
141
+ function postfixObjKeys<
142
+ A extends { [key: string]: Variable<string> | string },
143
+ B extends string,
144
+ >(
142
145
  obj: A,
143
- postfix: B
146
+ postfix: B,
144
147
  ): {
145
- [Key in `${keyof A extends string ? keyof A : never}${B}`]: Variable<string> | string
148
+ [Key in `${keyof A extends string ? keyof A : never}${B}`]:
149
+ | Variable<string>
150
+ | string
146
151
  } {
147
- return Object.fromEntries(Object.entries(obj).map(([k, v]) => [`${k}${postfix}`, v])) as any
152
+ return Object.fromEntries(
153
+ Object.entries(obj).map(([k, v]) => [`${k}${postfix}`, v]),
154
+ ) as any
148
155
  }
149
156
 
150
157
  export const radius = {