@tamagui/themes 1.88.19 → 1.88.21
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/package.json +7 -7
- package/dist/cjs/generated-v3.js +0 -1954
- package/dist/cjs/generated-v3.js.map +0 -6
- package/dist/cjs/generated-v3.native.js +0 -3542
- package/dist/cjs/generated-v3.native.js.map +0 -6
- package/dist/cjs/v3-themes.js +0 -453
- package/dist/cjs/v3-themes.js.map +0 -6
- package/dist/cjs/v3-themes.native.js +0 -463
- package/dist/cjs/v3-themes.native.js.map +0 -6
- package/dist/cjs/v3.js +0 -47
- package/dist/cjs/v3.js.map +0 -6
- package/dist/cjs/v3.native.js +0 -69
- package/dist/cjs/v3.native.js.map +0 -6
- package/dist/esm/generated-v3.js +0 -1938
- package/dist/esm/generated-v3.js.map +0 -6
- package/dist/esm/generated-v3.mjs +0 -1708
- package/dist/esm/generated-v3.native.js +0 -3542
- package/dist/esm/generated-v3.native.js.map +0 -6
- package/dist/esm/v3-themes.js +0 -458
- package/dist/esm/v3-themes.js.map +0 -6
- package/dist/esm/v3-themes.mjs +0 -423
- package/dist/esm/v3-themes.native.js +0 -463
- package/dist/esm/v3-themes.native.js.map +0 -6
- package/dist/esm/v3.js +0 -32
- package/dist/esm/v3.js.map +0 -6
- package/dist/esm/v3.mjs +0 -12
- package/dist/esm/v3.native.js +0 -69
- package/dist/esm/v3.native.js.map +0 -6
- package/types/generated-v3.d.ts.map +0 -1
- package/types/v3-themes.d.ts.map +0 -1
- package/types/v3.d.ts.map +0 -1
package/dist/esm/v3-themes.mjs
DELETED
|
@@ -1,423 +0,0 @@
|
|
|
1
|
-
import { createThemeBuilder } from "@tamagui/theme-builder";
|
|
2
|
-
import { blue, blueDark, gray, grayDark, green, greenDark, orange, orangeDark, pink, pinkDark, purple, purpleDark, red, redDark, yellow, yellowDark } from "@tamagui/colors";
|
|
3
|
-
import { createTokens } from "@tamagui/web";
|
|
4
|
-
import { masks } from "./masks.mjs";
|
|
5
|
-
import { masks as masks2 } from "./masks.mjs";
|
|
6
|
-
const colorTokens = {
|
|
7
|
-
light: {
|
|
8
|
-
blue,
|
|
9
|
-
gray,
|
|
10
|
-
green,
|
|
11
|
-
orange,
|
|
12
|
-
pink,
|
|
13
|
-
purple,
|
|
14
|
-
red,
|
|
15
|
-
yellow
|
|
16
|
-
},
|
|
17
|
-
dark: {
|
|
18
|
-
blue: blueDark,
|
|
19
|
-
gray: grayDark,
|
|
20
|
-
green: greenDark,
|
|
21
|
-
orange: orangeDark,
|
|
22
|
-
pink: pinkDark,
|
|
23
|
-
purple: purpleDark,
|
|
24
|
-
red: redDark,
|
|
25
|
-
yellow: yellowDark
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
palettes = (() => {
|
|
29
|
-
const lightTransparent = "rgba(255,255,255,0)",
|
|
30
|
-
darkTransparent = "rgba(10,10,10,0)",
|
|
31
|
-
transparent = (hsl, opacity = 0) => hsl.replace("%)", `%, ${opacity})`).replace("hsl(", "hsla("),
|
|
32
|
-
getColorPalette = (colors, color2 = colors[0]) => {
|
|
33
|
-
const colorPalette = Object.values(colors),
|
|
34
|
-
[head, tail] = [colorPalette.slice(0, 6), colorPalette.slice(colorPalette.length - 5)];
|
|
35
|
-
return [transparent(colorPalette[0]), ...head, ...tail, color2, transparent(colorPalette[colorPalette.length - 1])];
|
|
36
|
-
},
|
|
37
|
-
lightColor = "hsl(0, 0%, 9.0%)",
|
|
38
|
-
lightPalette = [lightTransparent, "#fff", "#f8f8f8", "hsl(0, 0%, 96.3%)", "hsl(0, 0%, 94.1%)", "hsl(0, 0%, 92.0%)", "hsl(0, 0%, 90.0%)", "hsl(0, 0%, 88.5%)", "hsl(0, 0%, 81.0%)", "hsl(0, 0%, 56.1%)", "hsl(0, 0%, 50.3%)", "hsl(0, 0%, 42.5%)", lightColor, darkTransparent],
|
|
39
|
-
darkColor = "#fff",
|
|
40
|
-
darkPalette = [darkTransparent, "#050505", "#151515", "#191919", "#232323", "#282828", "#323232", "#424242", "#494949", "#545454", "#626262", "#a5a5a5", darkColor, lightTransparent],
|
|
41
|
-
lightPalettes = objectFromEntries(objectKeys(colorTokens.light).map(key => [`light_${key}`, getColorPalette(colorTokens.light[key], lightColor)])),
|
|
42
|
-
darkPalettes = objectFromEntries(objectKeys(colorTokens.dark).map(key => [`dark_${key}`, getColorPalette(colorTokens.dark[key], darkColor)])),
|
|
43
|
-
colorPalettes = {
|
|
44
|
-
...lightPalettes,
|
|
45
|
-
...darkPalettes
|
|
46
|
-
};
|
|
47
|
-
return {
|
|
48
|
-
light: lightPalette,
|
|
49
|
-
dark: darkPalette,
|
|
50
|
-
...colorPalettes
|
|
51
|
-
};
|
|
52
|
-
})(),
|
|
53
|
-
templateColorsSpecific = {
|
|
54
|
-
color1: 1,
|
|
55
|
-
color2: 2,
|
|
56
|
-
color3: 3,
|
|
57
|
-
color4: 4,
|
|
58
|
-
color5: 5,
|
|
59
|
-
color6: 6,
|
|
60
|
-
color7: 7,
|
|
61
|
-
color8: 8,
|
|
62
|
-
color9: 9,
|
|
63
|
-
color10: 10,
|
|
64
|
-
color11: 11,
|
|
65
|
-
color12: 12
|
|
66
|
-
},
|
|
67
|
-
templates = (() => {
|
|
68
|
-
const base = {
|
|
69
|
-
...templateColorsSpecific,
|
|
70
|
-
// the background, color, etc keys here work like generics - they make it so you
|
|
71
|
-
// can publish components for others to use without mandating a specific color scale
|
|
72
|
-
// the @tamagui/button Button component looks for `$background`, so you set the
|
|
73
|
-
// dark_red_Button theme to have a stronger background than the dark_red theme.
|
|
74
|
-
background: 2,
|
|
75
|
-
backgroundHover: 3,
|
|
76
|
-
backgroundPress: 4,
|
|
77
|
-
backgroundFocus: 5,
|
|
78
|
-
backgroundStrong: 1,
|
|
79
|
-
backgroundTransparent: 0,
|
|
80
|
-
color: -1,
|
|
81
|
-
colorHover: -2,
|
|
82
|
-
colorPress: -1,
|
|
83
|
-
colorFocus: -2,
|
|
84
|
-
colorTransparent: -0,
|
|
85
|
-
borderColor: 5,
|
|
86
|
-
borderColorHover: 6,
|
|
87
|
-
borderColorFocus: 4,
|
|
88
|
-
borderColorPress: 5,
|
|
89
|
-
placeholderColor: -4,
|
|
90
|
-
// in the future this should be partially transparent
|
|
91
|
-
outlineColor: 5
|
|
92
|
-
},
|
|
93
|
-
surface1 = {
|
|
94
|
-
background: base.background + 1,
|
|
95
|
-
backgroundHover: base.backgroundHover + 1,
|
|
96
|
-
backgroundPress: base.backgroundPress + 1,
|
|
97
|
-
backgroundFocus: base.backgroundFocus + 1,
|
|
98
|
-
backgroundStrong: base.backgroundStrong + 1,
|
|
99
|
-
borderColor: base.borderColor + 1,
|
|
100
|
-
borderColorHover: base.borderColorHover + 1,
|
|
101
|
-
borderColorFocus: base.borderColorFocus + 1,
|
|
102
|
-
borderColorPress: base.borderColorPress + 1,
|
|
103
|
-
outlineColor: base.outlineColor + 1
|
|
104
|
-
},
|
|
105
|
-
surface2 = {
|
|
106
|
-
background: base.background + 2,
|
|
107
|
-
backgroundHover: base.backgroundHover + 2,
|
|
108
|
-
backgroundPress: base.backgroundPress + 2,
|
|
109
|
-
backgroundFocus: base.backgroundFocus + 2,
|
|
110
|
-
backgroundStrong: base.backgroundStrong + 2,
|
|
111
|
-
borderColor: base.borderColor + 2,
|
|
112
|
-
borderColorHover: base.borderColorHover + 2,
|
|
113
|
-
borderColorFocus: base.borderColorFocus + 2,
|
|
114
|
-
borderColorPress: base.borderColorPress + 2,
|
|
115
|
-
outlineColor: base.outlineColor + 2
|
|
116
|
-
},
|
|
117
|
-
surface3 = {
|
|
118
|
-
background: base.background + 3,
|
|
119
|
-
backgroundHover: base.backgroundHover + 3,
|
|
120
|
-
backgroundPress: base.backgroundPress + 3,
|
|
121
|
-
backgroundFocus: base.backgroundFocus + 3,
|
|
122
|
-
backgroundStrong: base.backgroundStrong + 3,
|
|
123
|
-
borderColor: base.borderColor + 3,
|
|
124
|
-
borderColorHover: base.borderColorHover + 3,
|
|
125
|
-
borderColorFocus: base.borderColorFocus + 3,
|
|
126
|
-
borderColorPress: base.borderColorPress + 3,
|
|
127
|
-
outlineColor: base.outlineColor + 3
|
|
128
|
-
};
|
|
129
|
-
return {
|
|
130
|
-
base,
|
|
131
|
-
surface1,
|
|
132
|
-
surface2,
|
|
133
|
-
surface3
|
|
134
|
-
};
|
|
135
|
-
})(),
|
|
136
|
-
maskOptions = (() => {
|
|
137
|
-
const shadows2 = {
|
|
138
|
-
shadowColor: 0,
|
|
139
|
-
shadowColorHover: 0,
|
|
140
|
-
shadowColorPress: 0,
|
|
141
|
-
shadowColorFocus: 0
|
|
142
|
-
},
|
|
143
|
-
colors = {
|
|
144
|
-
...shadows2,
|
|
145
|
-
color: 0,
|
|
146
|
-
colorHover: 0,
|
|
147
|
-
colorFocus: 0,
|
|
148
|
-
colorPress: 0
|
|
149
|
-
},
|
|
150
|
-
baseMaskOptions = {
|
|
151
|
-
override: shadows2,
|
|
152
|
-
skip: shadows2,
|
|
153
|
-
// avoids the transparent ends
|
|
154
|
-
max: palettes.light.length - 2,
|
|
155
|
-
min: 1
|
|
156
|
-
},
|
|
157
|
-
skipShadowsAndSpecificColors = {
|
|
158
|
-
...shadows2,
|
|
159
|
-
...templateColorsSpecific
|
|
160
|
-
};
|
|
161
|
-
return {
|
|
162
|
-
component: {
|
|
163
|
-
...baseMaskOptions,
|
|
164
|
-
override: colors,
|
|
165
|
-
skip: skipShadowsAndSpecificColors
|
|
166
|
-
},
|
|
167
|
-
alt: {
|
|
168
|
-
...baseMaskOptions
|
|
169
|
-
},
|
|
170
|
-
button: {
|
|
171
|
-
...baseMaskOptions,
|
|
172
|
-
override: {
|
|
173
|
-
...colors,
|
|
174
|
-
borderColor: "transparent",
|
|
175
|
-
borderColorHover: "transparent"
|
|
176
|
-
},
|
|
177
|
-
skip: skipShadowsAndSpecificColors
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
})(),
|
|
181
|
-
lightShadowColor = "rgba(0,0,0,0.04)",
|
|
182
|
-
lightShadowColorStrong = "rgba(0,0,0,0.085)",
|
|
183
|
-
darkShadowColor = "rgba(0,0,0,0.2)",
|
|
184
|
-
darkShadowColorStrong = "rgba(0,0,0,0.3)",
|
|
185
|
-
size = {
|
|
186
|
-
$0: 0,
|
|
187
|
-
"$0.25": 2,
|
|
188
|
-
"$0.5": 4,
|
|
189
|
-
"$0.75": 8,
|
|
190
|
-
$1: 20,
|
|
191
|
-
"$1.5": 24,
|
|
192
|
-
$2: 28,
|
|
193
|
-
"$2.5": 32,
|
|
194
|
-
$3: 36,
|
|
195
|
-
"$3.5": 40,
|
|
196
|
-
$4: 44,
|
|
197
|
-
$true: 44,
|
|
198
|
-
"$4.5": 48,
|
|
199
|
-
$5: 52,
|
|
200
|
-
$6: 64,
|
|
201
|
-
$7: 74,
|
|
202
|
-
$8: 84,
|
|
203
|
-
$9: 94,
|
|
204
|
-
$10: 104,
|
|
205
|
-
$11: 124,
|
|
206
|
-
$12: 144,
|
|
207
|
-
$13: 164,
|
|
208
|
-
$14: 184,
|
|
209
|
-
$15: 204,
|
|
210
|
-
$16: 224,
|
|
211
|
-
$17: 224,
|
|
212
|
-
$18: 244,
|
|
213
|
-
$19: 264,
|
|
214
|
-
$20: 284
|
|
215
|
-
},
|
|
216
|
-
spaces = Object.entries(size).map(([k, v]) => [k, sizeToSpace(v)]),
|
|
217
|
-
spacesNegative = spaces.slice(1).map(([k, v]) => [`-${k.slice(1)}`, -v]),
|
|
218
|
-
space = {
|
|
219
|
-
...Object.fromEntries(spaces),
|
|
220
|
-
...Object.fromEntries(spacesNegative)
|
|
221
|
-
},
|
|
222
|
-
zIndex = {
|
|
223
|
-
0: 0,
|
|
224
|
-
1: 100,
|
|
225
|
-
2: 200,
|
|
226
|
-
3: 300,
|
|
227
|
-
4: 400,
|
|
228
|
-
5: 500
|
|
229
|
-
},
|
|
230
|
-
darkColors = {
|
|
231
|
-
...colorTokens.dark.blue,
|
|
232
|
-
...colorTokens.dark.gray,
|
|
233
|
-
...colorTokens.dark.green,
|
|
234
|
-
...colorTokens.dark.orange,
|
|
235
|
-
...colorTokens.dark.pink,
|
|
236
|
-
...colorTokens.dark.purple,
|
|
237
|
-
...colorTokens.dark.red,
|
|
238
|
-
...colorTokens.dark.yellow
|
|
239
|
-
},
|
|
240
|
-
lightColors = {
|
|
241
|
-
...colorTokens.light.blue,
|
|
242
|
-
...colorTokens.light.gray,
|
|
243
|
-
...colorTokens.light.green,
|
|
244
|
-
...colorTokens.light.orange,
|
|
245
|
-
...colorTokens.light.pink,
|
|
246
|
-
...colorTokens.light.purple,
|
|
247
|
-
...colorTokens.light.red,
|
|
248
|
-
...colorTokens.light.yellow
|
|
249
|
-
},
|
|
250
|
-
color = {
|
|
251
|
-
...postfixObjKeys(lightColors, "Light"),
|
|
252
|
-
...postfixObjKeys(darkColors, "Dark")
|
|
253
|
-
},
|
|
254
|
-
radius = {
|
|
255
|
-
0: 0,
|
|
256
|
-
1: 3,
|
|
257
|
-
2: 5,
|
|
258
|
-
3: 7,
|
|
259
|
-
4: 9,
|
|
260
|
-
true: 9,
|
|
261
|
-
5: 10,
|
|
262
|
-
6: 16,
|
|
263
|
-
7: 19,
|
|
264
|
-
8: 22,
|
|
265
|
-
9: 26,
|
|
266
|
-
10: 34,
|
|
267
|
-
11: 42,
|
|
268
|
-
12: 50
|
|
269
|
-
},
|
|
270
|
-
tokens = createTokens({
|
|
271
|
-
color,
|
|
272
|
-
radius,
|
|
273
|
-
zIndex,
|
|
274
|
-
space,
|
|
275
|
-
size
|
|
276
|
-
}),
|
|
277
|
-
shadows = {
|
|
278
|
-
light: {
|
|
279
|
-
shadowColor: lightShadowColorStrong,
|
|
280
|
-
shadowColorHover: lightShadowColorStrong,
|
|
281
|
-
shadowColorPress: lightShadowColor,
|
|
282
|
-
shadowColorFocus: lightShadowColor
|
|
283
|
-
},
|
|
284
|
-
dark: {
|
|
285
|
-
shadowColor: darkShadowColorStrong,
|
|
286
|
-
shadowColorHover: darkShadowColorStrong,
|
|
287
|
-
shadowColorPress: darkShadowColor,
|
|
288
|
-
shadowColorFocus: darkShadowColor
|
|
289
|
-
}
|
|
290
|
-
},
|
|
291
|
-
colorThemeDefinition = colorName => ({
|
|
292
|
-
palette: colorName,
|
|
293
|
-
template: "base"
|
|
294
|
-
}),
|
|
295
|
-
nonInherited = {
|
|
296
|
-
light: {
|
|
297
|
-
...lightColors,
|
|
298
|
-
...shadows.light
|
|
299
|
-
},
|
|
300
|
-
dark: {
|
|
301
|
-
...darkColors,
|
|
302
|
-
...shadows.dark
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
overlayThemeDefinitions = [{
|
|
306
|
-
parent: "light",
|
|
307
|
-
theme: {
|
|
308
|
-
background: "rgba(0,0,0,0.5)"
|
|
309
|
-
}
|
|
310
|
-
}, {
|
|
311
|
-
parent: "dark",
|
|
312
|
-
theme: {
|
|
313
|
-
background: "rgba(0,0,0,0.9)"
|
|
314
|
-
}
|
|
315
|
-
}],
|
|
316
|
-
themeBuilder = createThemeBuilder().addPalettes(palettes).addTemplates(templates).addMasks(masks).addThemes({
|
|
317
|
-
light: {
|
|
318
|
-
template: "base",
|
|
319
|
-
palette: "light",
|
|
320
|
-
nonInheritedValues: nonInherited.light
|
|
321
|
-
},
|
|
322
|
-
dark: {
|
|
323
|
-
template: "base",
|
|
324
|
-
palette: "dark",
|
|
325
|
-
nonInheritedValues: nonInherited.dark
|
|
326
|
-
}
|
|
327
|
-
}).addChildThemes({
|
|
328
|
-
orange: colorThemeDefinition("orange"),
|
|
329
|
-
yellow: colorThemeDefinition("yellow"),
|
|
330
|
-
green: colorThemeDefinition("green"),
|
|
331
|
-
blue: colorThemeDefinition("blue"),
|
|
332
|
-
purple: colorThemeDefinition("purple"),
|
|
333
|
-
pink: colorThemeDefinition("pink"),
|
|
334
|
-
red: colorThemeDefinition("red"),
|
|
335
|
-
gray: colorThemeDefinition("gray")
|
|
336
|
-
}).addChildThemes({
|
|
337
|
-
alt1: {
|
|
338
|
-
template: "surface1"
|
|
339
|
-
},
|
|
340
|
-
alt2: {
|
|
341
|
-
template: "surface2"
|
|
342
|
-
},
|
|
343
|
-
active: {
|
|
344
|
-
template: "surface3"
|
|
345
|
-
}
|
|
346
|
-
}).addChildThemes({
|
|
347
|
-
ListItem: {
|
|
348
|
-
template: "surface1"
|
|
349
|
-
},
|
|
350
|
-
Card: {
|
|
351
|
-
template: "surface1"
|
|
352
|
-
},
|
|
353
|
-
Button: {
|
|
354
|
-
template: "surface2"
|
|
355
|
-
},
|
|
356
|
-
Checkbox: {
|
|
357
|
-
template: "surface2"
|
|
358
|
-
},
|
|
359
|
-
Switch: {
|
|
360
|
-
template: "surface2"
|
|
361
|
-
},
|
|
362
|
-
SwitchThumb: {
|
|
363
|
-
mask: "inverse",
|
|
364
|
-
...maskOptions.component
|
|
365
|
-
},
|
|
366
|
-
TooltipContent: {
|
|
367
|
-
template: "surface2"
|
|
368
|
-
},
|
|
369
|
-
DrawerFrame: {
|
|
370
|
-
template: "surface1"
|
|
371
|
-
},
|
|
372
|
-
Progress: {
|
|
373
|
-
template: "surface1"
|
|
374
|
-
},
|
|
375
|
-
RadioGroupItem: {
|
|
376
|
-
template: "surface2"
|
|
377
|
-
},
|
|
378
|
-
TooltipArrow: {
|
|
379
|
-
template: "surface1"
|
|
380
|
-
},
|
|
381
|
-
SliderTrackActive: {
|
|
382
|
-
template: "surface3"
|
|
383
|
-
},
|
|
384
|
-
SliderTrack: {
|
|
385
|
-
template: "surface1"
|
|
386
|
-
},
|
|
387
|
-
SliderThumb: {
|
|
388
|
-
mask: "inverse",
|
|
389
|
-
...maskOptions.component
|
|
390
|
-
},
|
|
391
|
-
Tooltip: {
|
|
392
|
-
mask: "inverse",
|
|
393
|
-
...maskOptions.component
|
|
394
|
-
},
|
|
395
|
-
ProgressIndicator: {
|
|
396
|
-
mask: "inverse",
|
|
397
|
-
...maskOptions.component
|
|
398
|
-
},
|
|
399
|
-
SheetOverlay: overlayThemeDefinitions,
|
|
400
|
-
DialogOverlay: overlayThemeDefinitions,
|
|
401
|
-
ModalOverlay: overlayThemeDefinitions,
|
|
402
|
-
Input: {
|
|
403
|
-
template: "surface2"
|
|
404
|
-
},
|
|
405
|
-
TextArea: {
|
|
406
|
-
template: "surface2"
|
|
407
|
-
}
|
|
408
|
-
}),
|
|
409
|
-
themesIn = themeBuilder.build(),
|
|
410
|
-
themes = themesIn;
|
|
411
|
-
function postfixObjKeys(obj, postfix) {
|
|
412
|
-
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [`${k}${postfix}`, v]));
|
|
413
|
-
}
|
|
414
|
-
function sizeToSpace(v) {
|
|
415
|
-
return v === 0 ? 0 : v === 2 ? 0.5 : v === 4 ? 1 : v === 8 ? 1.5 : v <= 16 ? Math.round(v * 0.333) : Math.floor(v * 0.7 - 12);
|
|
416
|
-
}
|
|
417
|
-
function objectFromEntries(arr) {
|
|
418
|
-
return Object.fromEntries(arr);
|
|
419
|
-
}
|
|
420
|
-
function objectKeys(obj) {
|
|
421
|
-
return Object.keys(obj);
|
|
422
|
-
}
|
|
423
|
-
export { maskOptions, masks2 as masks, palettes, templates, themes, tokens };
|