@tamagui/themes 1.84.1 → 1.85.0
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/tokens.js +1 -7
- package/dist/cjs/tokens.js.map +1 -1
- package/dist/cjs/tokens.native.js +1 -7
- package/dist/cjs/tokens.native.js.map +1 -1
- package/dist/cjs/v2-themes.js +336 -34
- package/dist/cjs/v2-themes.js.map +2 -2
- package/dist/cjs/v2-themes.native.js +336 -34
- package/dist/cjs/v2-themes.native.js.map +2 -2
- package/dist/cjs/v2.js +2 -12
- package/dist/cjs/v2.js.map +1 -1
- package/dist/cjs/v2.native.js +2 -12
- package/dist/cjs/v2.native.js.map +1 -1
- package/dist/esm/tokens.js +1 -7
- package/dist/esm/tokens.js.map +1 -1
- package/dist/esm/tokens.native.js +1 -7
- package/dist/esm/tokens.native.js.map +1 -1
- package/dist/esm/v2-themes.js +321 -9
- package/dist/esm/v2-themes.js.map +2 -2
- package/dist/esm/v2-themes.native.js +321 -9
- package/dist/esm/v2-themes.native.js.map +2 -2
- package/dist/esm/v2.js +1 -6
- package/dist/esm/v2.js.map +1 -1
- package/dist/esm/v2.native.js +1 -6
- package/dist/esm/v2.native.js.map +1 -1
- package/package.json +7 -7
- package/src/tokens.tsx +1 -9
- package/src/v2-themes.ts +466 -10
- package/src/v2.tsx +1 -6
- package/types/tokens.d.ts +0 -5
- package/types/tokens.d.ts.map +1 -1
- package/types/v2-themes.d.ts +795 -1
- package/types/v2-themes.d.ts.map +1 -1
- package/types/v2.d.ts +1 -6
- package/types/v2.d.ts.map +1 -1
package/src/v2-themes.ts
CHANGED
|
@@ -1,11 +1,392 @@
|
|
|
1
|
-
import { createThemeBuilder } from '@tamagui/theme-builder'
|
|
1
|
+
import { createThemeBuilder, MaskOptions } from '@tamagui/theme-builder'
|
|
2
|
+
import {
|
|
3
|
+
blue,
|
|
4
|
+
blueDark,
|
|
5
|
+
gray,
|
|
6
|
+
grayDark,
|
|
7
|
+
green,
|
|
8
|
+
greenDark,
|
|
9
|
+
orange,
|
|
10
|
+
orangeDark,
|
|
11
|
+
pink,
|
|
12
|
+
pinkDark,
|
|
13
|
+
purple,
|
|
14
|
+
purpleDark,
|
|
15
|
+
red,
|
|
16
|
+
redDark,
|
|
17
|
+
yellow,
|
|
18
|
+
yellowDark,
|
|
19
|
+
} from '@tamagui/colors'
|
|
20
|
+
import { Variable, createTokens } from '@tamagui/web'
|
|
2
21
|
|
|
3
|
-
import { overlayThemeDefinitions } from './componentThemeDefinitions'
|
|
4
22
|
import { masks } from './masks'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
23
|
+
|
|
24
|
+
export { masks } from './masks'
|
|
25
|
+
|
|
26
|
+
const colorTokens = {
|
|
27
|
+
light: {
|
|
28
|
+
blue,
|
|
29
|
+
gray,
|
|
30
|
+
green,
|
|
31
|
+
orange,
|
|
32
|
+
pink,
|
|
33
|
+
purple,
|
|
34
|
+
red,
|
|
35
|
+
yellow,
|
|
36
|
+
},
|
|
37
|
+
dark: {
|
|
38
|
+
blue: blueDark,
|
|
39
|
+
gray: grayDark,
|
|
40
|
+
green: greenDark,
|
|
41
|
+
orange: orangeDark,
|
|
42
|
+
pink: pinkDark,
|
|
43
|
+
purple: purpleDark,
|
|
44
|
+
red: redDark,
|
|
45
|
+
yellow: yellowDark,
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const palettes = (() => {
|
|
50
|
+
const lightTransparent = 'rgba(255,255,255,0)'
|
|
51
|
+
const darkTransparent = 'rgba(10,10,10,0)'
|
|
52
|
+
|
|
53
|
+
const transparent = (hsl: string, opacity = 0) =>
|
|
54
|
+
hsl.replace(`%)`, `%, ${opacity})`).replace(`hsl(`, `hsla(`)
|
|
55
|
+
|
|
56
|
+
const getColorPalette = (colors: Object, color = colors[0]): string[] => {
|
|
57
|
+
const colorPalette = Object.values(colors)
|
|
58
|
+
|
|
59
|
+
// were re-ordering these
|
|
60
|
+
const [head, tail] = [
|
|
61
|
+
colorPalette.slice(0, 6),
|
|
62
|
+
colorPalette.slice(colorPalette.length - 5),
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
// add our transparent colors first/last
|
|
66
|
+
// and make sure the last (foreground) color is white/black rather than colorful
|
|
67
|
+
// this is mostly for consistency with the older theme-base
|
|
68
|
+
return [
|
|
69
|
+
transparent(colorPalette[0]),
|
|
70
|
+
...head,
|
|
71
|
+
...tail,
|
|
72
|
+
color,
|
|
73
|
+
transparent(colorPalette[colorPalette.length - 1]),
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const lightColor = 'hsl(0, 0%, 9.0%)'
|
|
78
|
+
const lightPalette = [
|
|
79
|
+
lightTransparent,
|
|
80
|
+
'#fff',
|
|
81
|
+
'#f8f8f8',
|
|
82
|
+
'hsl(0, 0%, 96.3%)',
|
|
83
|
+
'hsl(0, 0%, 94.1%)',
|
|
84
|
+
'hsl(0, 0%, 92.0%)',
|
|
85
|
+
'hsl(0, 0%, 90.0%)',
|
|
86
|
+
'hsl(0, 0%, 88.5%)',
|
|
87
|
+
'hsl(0, 0%, 81.0%)',
|
|
88
|
+
'hsl(0, 0%, 56.1%)',
|
|
89
|
+
'hsl(0, 0%, 50.3%)',
|
|
90
|
+
'hsl(0, 0%, 42.5%)',
|
|
91
|
+
lightColor,
|
|
92
|
+
darkTransparent,
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
const darkColor = '#fff'
|
|
96
|
+
const darkPalette = [
|
|
97
|
+
darkTransparent,
|
|
98
|
+
'#050505',
|
|
99
|
+
'#151515',
|
|
100
|
+
'#191919',
|
|
101
|
+
'#232323',
|
|
102
|
+
'#282828',
|
|
103
|
+
'#323232',
|
|
104
|
+
'#424242',
|
|
105
|
+
'#494949',
|
|
106
|
+
'#545454',
|
|
107
|
+
'#626262',
|
|
108
|
+
'#a5a5a5',
|
|
109
|
+
darkColor,
|
|
110
|
+
lightTransparent,
|
|
111
|
+
]
|
|
112
|
+
|
|
113
|
+
const lightPalettes = objectFromEntries(
|
|
114
|
+
objectKeys(colorTokens.light).map(
|
|
115
|
+
(key) =>
|
|
116
|
+
[`light_${key}`, getColorPalette(colorTokens.light[key], lightColor)] as const
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
const darkPalettes = objectFromEntries(
|
|
121
|
+
objectKeys(colorTokens.dark).map(
|
|
122
|
+
(key) => [`dark_${key}`, getColorPalette(colorTokens.dark[key], darkColor)] as const
|
|
123
|
+
)
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
const colorPalettes = {
|
|
127
|
+
...lightPalettes,
|
|
128
|
+
...darkPalettes,
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return {
|
|
132
|
+
light: lightPalette,
|
|
133
|
+
dark: darkPalette,
|
|
134
|
+
...colorPalettes,
|
|
135
|
+
}
|
|
136
|
+
})()
|
|
137
|
+
|
|
138
|
+
const templateColorsSpecific = {
|
|
139
|
+
color1: 1,
|
|
140
|
+
color2: 2,
|
|
141
|
+
color3: 3,
|
|
142
|
+
color4: 4,
|
|
143
|
+
color5: 5,
|
|
144
|
+
color6: 6,
|
|
145
|
+
color7: 7,
|
|
146
|
+
color8: 8,
|
|
147
|
+
color9: 9,
|
|
148
|
+
color10: 10,
|
|
149
|
+
color11: 11,
|
|
150
|
+
color12: 12,
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export const templates = (() => {
|
|
154
|
+
// templates use the palette and specify index
|
|
155
|
+
// negative goes backwards from end so -1 is the last item
|
|
156
|
+
const template = {
|
|
157
|
+
...templateColorsSpecific,
|
|
158
|
+
// the background, color, etc keys here work like generics - they make it so you
|
|
159
|
+
// can publish components for others to use without mandating a specific color scale
|
|
160
|
+
// the @tamagui/button Button component looks for `$background`, so you set the
|
|
161
|
+
// dark_red_Button theme to have a stronger background than the dark_red theme.
|
|
162
|
+
background: 2,
|
|
163
|
+
backgroundHover: 3,
|
|
164
|
+
backgroundPress: 4,
|
|
165
|
+
backgroundFocus: 5,
|
|
166
|
+
backgroundStrong: 1,
|
|
167
|
+
backgroundTransparent: 0,
|
|
168
|
+
color: -1,
|
|
169
|
+
colorHover: -2,
|
|
170
|
+
colorPress: -1,
|
|
171
|
+
colorFocus: -2,
|
|
172
|
+
colorTransparent: -0,
|
|
173
|
+
borderColor: 5,
|
|
174
|
+
borderColorHover: 6,
|
|
175
|
+
borderColorFocus: 4,
|
|
176
|
+
borderColorPress: 5,
|
|
177
|
+
placeholderColor: -4,
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
base: template,
|
|
182
|
+
colorLight: {
|
|
183
|
+
...template,
|
|
184
|
+
// light color themes are a bit less sensitive
|
|
185
|
+
borderColor: 4,
|
|
186
|
+
borderColorHover: 5,
|
|
187
|
+
borderColorFocus: 4,
|
|
188
|
+
borderColorPress: 4,
|
|
189
|
+
},
|
|
190
|
+
}
|
|
191
|
+
})()
|
|
192
|
+
|
|
193
|
+
export const maskOptions = (() => {
|
|
194
|
+
const shadows = {
|
|
195
|
+
shadowColor: 0,
|
|
196
|
+
shadowColorHover: 0,
|
|
197
|
+
shadowColorPress: 0,
|
|
198
|
+
shadowColorFocus: 0,
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const colors = {
|
|
202
|
+
...shadows,
|
|
203
|
+
color: 0,
|
|
204
|
+
colorHover: 0,
|
|
205
|
+
colorFocus: 0,
|
|
206
|
+
colorPress: 0,
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const baseMaskOptions: MaskOptions = {
|
|
210
|
+
override: shadows,
|
|
211
|
+
skip: shadows,
|
|
212
|
+
// avoids the transparent ends
|
|
213
|
+
max: palettes.light.length - 2,
|
|
214
|
+
min: 1,
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const skipShadowsAndSpecificColors = {
|
|
218
|
+
...shadows,
|
|
219
|
+
...templateColorsSpecific,
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
component: {
|
|
224
|
+
...baseMaskOptions,
|
|
225
|
+
override: colors,
|
|
226
|
+
skip: skipShadowsAndSpecificColors,
|
|
227
|
+
},
|
|
228
|
+
alt: {
|
|
229
|
+
...baseMaskOptions,
|
|
230
|
+
},
|
|
231
|
+
button: {
|
|
232
|
+
...baseMaskOptions,
|
|
233
|
+
override: {
|
|
234
|
+
...colors,
|
|
235
|
+
borderColor: 'transparent',
|
|
236
|
+
borderColorHover: 'transparent',
|
|
237
|
+
},
|
|
238
|
+
skip: skipShadowsAndSpecificColors,
|
|
239
|
+
},
|
|
240
|
+
} satisfies Record<string, MaskOptions>
|
|
241
|
+
})()
|
|
242
|
+
|
|
243
|
+
const lightShadowColor = 'rgba(0,0,0,0.04)'
|
|
244
|
+
const lightShadowColorStrong = 'rgba(0,0,0,0.085)'
|
|
245
|
+
const darkShadowColor = 'rgba(0,0,0,0.2)'
|
|
246
|
+
const darkShadowColorStrong = 'rgba(0,0,0,0.3)'
|
|
247
|
+
|
|
248
|
+
// should roughly map to button/input etc height at each level
|
|
249
|
+
// fonts should match that height/lineHeight at each stop
|
|
250
|
+
// so these are really non-linear on purpose
|
|
251
|
+
// why?
|
|
252
|
+
// - at sizes <1, used for fine grained things (borders, smallest paddingY)
|
|
253
|
+
// - so smallest padY should be roughly 1-4px so it can join with lineHeight
|
|
254
|
+
// - at sizes >=1, have to consider "pressability" (jumps up)
|
|
255
|
+
// - after that it should go upwards somewhat naturally
|
|
256
|
+
// - H1 / headings top out at 10 naturally, so after 10 we can go upwards faster
|
|
257
|
+
// but also one more wrinkle...
|
|
258
|
+
// space is used in conjunction with size
|
|
259
|
+
// i'm setting space to generally just a fixed fraction of size (~1/3-2/3 still fine tuning)
|
|
260
|
+
const size = {
|
|
261
|
+
$0: 0,
|
|
262
|
+
'$0.25': 2,
|
|
263
|
+
'$0.5': 4,
|
|
264
|
+
'$0.75': 8,
|
|
265
|
+
$1: 20,
|
|
266
|
+
'$1.5': 24,
|
|
267
|
+
$2: 28,
|
|
268
|
+
'$2.5': 32,
|
|
269
|
+
$3: 36,
|
|
270
|
+
'$3.5': 40,
|
|
271
|
+
$4: 44,
|
|
272
|
+
$true: 44,
|
|
273
|
+
'$4.5': 48,
|
|
274
|
+
$5: 52,
|
|
275
|
+
$6: 64,
|
|
276
|
+
$7: 74,
|
|
277
|
+
$8: 84,
|
|
278
|
+
$9: 94,
|
|
279
|
+
$10: 104,
|
|
280
|
+
$11: 124,
|
|
281
|
+
$12: 144,
|
|
282
|
+
$13: 164,
|
|
283
|
+
$14: 184,
|
|
284
|
+
$15: 204,
|
|
285
|
+
$16: 224,
|
|
286
|
+
$17: 224,
|
|
287
|
+
$18: 244,
|
|
288
|
+
$19: 264,
|
|
289
|
+
$20: 284,
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
type SizeKeysIn = keyof typeof size
|
|
293
|
+
type Sizes = {
|
|
294
|
+
[Key in SizeKeysIn extends `$${infer Key}` ? Key : SizeKeysIn]: number
|
|
295
|
+
}
|
|
296
|
+
type SizeKeys = `${keyof Sizes extends `${infer K}` ? K : never}`
|
|
297
|
+
|
|
298
|
+
const spaces = Object.entries(size).map(([k, v]) => {
|
|
299
|
+
return [k, sizeToSpace(v)] as const
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
const spacesNegative = spaces.slice(1).map(([k, v]) => [`-${k.slice(1)}`, -v])
|
|
303
|
+
|
|
304
|
+
type SizeKeysWithNegatives =
|
|
305
|
+
| Exclude<`-${SizeKeys extends `$${infer Key}` ? Key : SizeKeys}`, '-0'>
|
|
306
|
+
| SizeKeys
|
|
307
|
+
|
|
308
|
+
const space: {
|
|
309
|
+
[Key in SizeKeysWithNegatives]: Key extends keyof Sizes ? Sizes[Key] : number
|
|
310
|
+
} = {
|
|
311
|
+
...Object.fromEntries(spaces),
|
|
312
|
+
...Object.fromEntries(spacesNegative),
|
|
313
|
+
} as any
|
|
314
|
+
|
|
315
|
+
const zIndex = {
|
|
316
|
+
0: 0,
|
|
317
|
+
1: 100,
|
|
318
|
+
2: 200,
|
|
319
|
+
3: 300,
|
|
320
|
+
4: 400,
|
|
321
|
+
5: 500,
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const darkColors = {
|
|
325
|
+
...colorTokens.dark.blue,
|
|
326
|
+
...colorTokens.dark.gray,
|
|
327
|
+
...colorTokens.dark.green,
|
|
328
|
+
...colorTokens.dark.orange,
|
|
329
|
+
...colorTokens.dark.pink,
|
|
330
|
+
...colorTokens.dark.purple,
|
|
331
|
+
...colorTokens.dark.red,
|
|
332
|
+
...colorTokens.dark.yellow,
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const lightColors = {
|
|
336
|
+
...colorTokens.light.blue,
|
|
337
|
+
...colorTokens.light.gray,
|
|
338
|
+
...colorTokens.light.green,
|
|
339
|
+
...colorTokens.light.orange,
|
|
340
|
+
...colorTokens.light.pink,
|
|
341
|
+
...colorTokens.light.purple,
|
|
342
|
+
...colorTokens.light.red,
|
|
343
|
+
...colorTokens.light.yellow,
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const color = {
|
|
347
|
+
...postfixObjKeys(lightColors, 'Light'),
|
|
348
|
+
...postfixObjKeys(darkColors, 'Dark'),
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
const radius = {
|
|
352
|
+
0: 0,
|
|
353
|
+
1: 3,
|
|
354
|
+
2: 5,
|
|
355
|
+
3: 7,
|
|
356
|
+
4: 9,
|
|
357
|
+
true: 9,
|
|
358
|
+
5: 10,
|
|
359
|
+
6: 16,
|
|
360
|
+
7: 19,
|
|
361
|
+
8: 22,
|
|
362
|
+
9: 26,
|
|
363
|
+
10: 34,
|
|
364
|
+
11: 42,
|
|
365
|
+
12: 50,
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export const tokens = createTokens({
|
|
369
|
+
color,
|
|
370
|
+
radius,
|
|
371
|
+
zIndex,
|
|
372
|
+
space,
|
|
373
|
+
size,
|
|
374
|
+
})
|
|
375
|
+
|
|
376
|
+
const shadows = {
|
|
377
|
+
light: {
|
|
378
|
+
shadowColor: lightShadowColorStrong,
|
|
379
|
+
shadowColorHover: lightShadowColorStrong,
|
|
380
|
+
shadowColorPress: lightShadowColor,
|
|
381
|
+
shadowColorFocus: lightShadowColor,
|
|
382
|
+
},
|
|
383
|
+
dark: {
|
|
384
|
+
shadowColor: darkShadowColorStrong,
|
|
385
|
+
shadowColorHover: darkShadowColorStrong,
|
|
386
|
+
shadowColorPress: darkShadowColor,
|
|
387
|
+
shadowColorFocus: darkShadowColor,
|
|
388
|
+
},
|
|
389
|
+
}
|
|
9
390
|
|
|
10
391
|
const colorThemeDefinition = (colorName: string) => [
|
|
11
392
|
{
|
|
@@ -31,7 +412,24 @@ const nonInherited = {
|
|
|
31
412
|
},
|
|
32
413
|
}
|
|
33
414
|
|
|
34
|
-
const
|
|
415
|
+
const overlayThemeDefinitions = [
|
|
416
|
+
{
|
|
417
|
+
parent: 'light',
|
|
418
|
+
theme: {
|
|
419
|
+
background: 'rgba(0,0,0,0.5)',
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
parent: 'dark',
|
|
424
|
+
theme: {
|
|
425
|
+
background: 'rgba(0,0,0,0.9)',
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
]
|
|
429
|
+
|
|
430
|
+
// --- themeBuilder ---
|
|
431
|
+
|
|
432
|
+
const themeBuilder = createThemeBuilder()
|
|
35
433
|
.addPalettes(palettes)
|
|
36
434
|
.addTemplates(templates)
|
|
37
435
|
.addMasks(masks)
|
|
@@ -196,13 +594,71 @@ const themesBuilder = createThemeBuilder()
|
|
|
196
594
|
}
|
|
197
595
|
)
|
|
198
596
|
|
|
199
|
-
|
|
597
|
+
// --- main export ---
|
|
598
|
+
|
|
599
|
+
const themesIn = themeBuilder.build()
|
|
200
600
|
|
|
201
|
-
// stupid typescript too deep types fix :/
|
|
202
601
|
type ThemesIn = typeof themesIn
|
|
602
|
+
// add non-inherited back to typs
|
|
203
603
|
type ThemesOut = Omit<ThemesIn, 'light' | 'dark'> & {
|
|
204
604
|
light: ThemesIn['light'] & typeof nonInherited.light
|
|
205
605
|
dark: ThemesIn['dark'] & typeof nonInherited.dark
|
|
206
606
|
}
|
|
207
|
-
|
|
208
607
|
export const themes = themesIn as ThemesOut
|
|
608
|
+
|
|
609
|
+
// --- utils ---
|
|
610
|
+
|
|
611
|
+
function postfixObjKeys<
|
|
612
|
+
A extends { [key: string]: Variable<string> | string },
|
|
613
|
+
B extends string,
|
|
614
|
+
>(
|
|
615
|
+
obj: A,
|
|
616
|
+
postfix: B
|
|
617
|
+
): {
|
|
618
|
+
[Key in `${keyof A extends string ? keyof A : never}${B}`]: Variable<string> | string
|
|
619
|
+
} {
|
|
620
|
+
return Object.fromEntries(
|
|
621
|
+
Object.entries(obj).map(([k, v]) => [`${k}${postfix}`, v])
|
|
622
|
+
) as any
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// a bit odd but keeping backward compat for values >8 while fixing below
|
|
626
|
+
function sizeToSpace(v: number) {
|
|
627
|
+
if (v === 0) return 0
|
|
628
|
+
if (v === 2) return 0.5
|
|
629
|
+
if (v === 4) return 1
|
|
630
|
+
if (v === 8) return 1.5
|
|
631
|
+
if (v <= 16) return Math.round(v * 0.333)
|
|
632
|
+
return Math.floor(v * 0.7 - 12)
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
function objectFromEntries<ARR_T extends EntriesType>(
|
|
636
|
+
arr: ARR_T
|
|
637
|
+
): EntriesToObject<ARR_T> {
|
|
638
|
+
return Object.fromEntries(arr) as EntriesToObject<ARR_T>
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
type EntriesType =
|
|
642
|
+
| [PropertyKey, unknown][]
|
|
643
|
+
| ReadonlyArray<readonly [PropertyKey, unknown]>
|
|
644
|
+
|
|
645
|
+
type DeepWritable<OBJ_T> = { -readonly [P in keyof OBJ_T]: DeepWritable<OBJ_T[P]> }
|
|
646
|
+
type UnionToIntersection<UNION_T> = // From https://stackoverflow.com/a/50375286
|
|
647
|
+
(UNION_T extends any ? (k: UNION_T) => void : never) extends (k: infer I) => void
|
|
648
|
+
? I
|
|
649
|
+
: never
|
|
650
|
+
|
|
651
|
+
type UnionObjectFromArrayOfPairs<ARR_T extends EntriesType> =
|
|
652
|
+
DeepWritable<ARR_T> extends (infer R)[]
|
|
653
|
+
? R extends [infer key, infer val]
|
|
654
|
+
? { [prop in key & PropertyKey]: val }
|
|
655
|
+
: never
|
|
656
|
+
: never
|
|
657
|
+
type MergeIntersectingObjects<ObjT> = { [key in keyof ObjT]: ObjT[key] }
|
|
658
|
+
type EntriesToObject<ARR_T extends EntriesType> = MergeIntersectingObjects<
|
|
659
|
+
UnionToIntersection<UnionObjectFromArrayOfPairs<ARR_T>>
|
|
660
|
+
>
|
|
661
|
+
|
|
662
|
+
function objectKeys<O extends Object>(obj: O) {
|
|
663
|
+
return Object.keys(obj) as Array<keyof O>
|
|
664
|
+
}
|
package/src/v2.tsx
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './masks'
|
|
3
|
-
export * from './componentThemeDefinitions'
|
|
4
|
-
export * from './palettes'
|
|
5
|
-
export * from './templates'
|
|
6
|
-
export * from './shadows'
|
|
1
|
+
export * from './v2-themes'
|
|
7
2
|
|
|
8
3
|
// specific colors since we have cjs here
|
|
9
4
|
export { blue, blueDark } from '@tamagui/colors'
|
package/types/tokens.d.ts
CHANGED
|
@@ -1301,11 +1301,6 @@ export declare const tokens: {
|
|
|
1301
1301
|
19: Variable<number>;
|
|
1302
1302
|
20: Variable<number>;
|
|
1303
1303
|
};
|
|
1304
|
-
icon: {
|
|
1305
|
-
sm: Variable<number>;
|
|
1306
|
-
md: Variable<number>;
|
|
1307
|
-
lg: Variable<number>;
|
|
1308
|
-
};
|
|
1309
1304
|
}, "color" | "space" | "size" | "radius" | "zIndex">;
|
|
1310
1305
|
export {};
|
|
1311
1306
|
//# sourceMappingURL=tokens.d.ts.map
|
package/types/tokens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAgB,MAAM,cAAc,CAAA;AAcrD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BhB,CAAA;AAED,KAAK,UAAU,GAAG,MAAM,OAAO,IAAI,CAAA;AACnC,KAAK,KAAK,GAAG;KACV,GAAG,IAAI,UAAU,SAAS,IAAI,MAAM,GAAG,EAAE,GAAG,GAAG,GAAG,UAAU,GAAG,MAAM;CACvE,CAAA;AACD,KAAK,QAAQ,GAAG,GAAG,MAAM,KAAK,SAAS,GAAG,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,EAAE,CAAA;AAkBjE,KAAK,qBAAqB,GACtB,OAAO,CAAC,IAAI,QAAQ,SAAS,IAAI,MAAM,GAAG,EAAE,GAAG,GAAG,GAAG,QAAQ,EAAE,EAAE,IAAI,CAAC,GACtE,QAAQ,CAAA;AAEZ,eAAO,MAAM,KAAK,EAAE;KACjB,GAAG,IAAI,qBAAqB,GAAG,GAAG,SAAS,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM;CAIvE,CAAA;AAER,eAAO,MAAM,MAAM;;;;;;;CAOlB,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqBvB,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAStB,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASvB,CAAA;AAED,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGjB,CAAA;AAgBD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;CAelB,CAAA;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAMjB,CAAA"}
|