@tamagui/themes 1.89.28 → 1.89.30
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/generated-v3.js +1857 -1819
- package/dist/cjs/generated-v3.js.map +1 -1
- package/dist/cjs/generated-v3.native.js +2593 -2447
- package/dist/cjs/generated-v3.native.js.map +1 -1
- package/dist/cjs/helpers.native.js.map +1 -1
- package/dist/cjs/themes-old.native.js +6 -1
- package/dist/cjs/themes-old.native.js.map +1 -1
- package/dist/cjs/v3-themes.js +96 -57
- package/dist/cjs/v3-themes.js.map +1 -1
- package/dist/cjs/v3-themes.native.js +82 -57
- package/dist/cjs/v3-themes.native.js.map +2 -2
- package/dist/esm/generated-v3.js +1857 -1819
- package/dist/esm/generated-v3.js.map +1 -1
- package/dist/esm/generated-v3.mjs +166 -166
- package/dist/esm/generated-v3.native.js +2593 -2447
- package/dist/esm/generated-v3.native.js.map +1 -1
- package/dist/esm/themes-old.native.js +6 -1
- package/dist/esm/themes-old.native.js.map +1 -1
- package/dist/esm/v3-themes.js +96 -57
- package/dist/esm/v3-themes.js.map +1 -1
- package/dist/esm/v3-themes.mjs +81 -53
- package/dist/esm/v3-themes.native.js +81 -56
- package/dist/esm/v3-themes.native.js.map +2 -2
- package/package.json +7 -20
- package/src/generated-v3.ts +1828 -1788
- package/src/v3-themes.ts +114 -61
- package/tsconfig.json +28 -0
- package/types/generated-v3.d.ts +3 -1
- package/types/v3-themes.d.ts +15776 -5718
- package/types/componentThemeDefinitions.d.ts.map +0 -1
- package/types/generated-new.d.ts.map +0 -1
- package/types/generated-v2.d.ts.map +0 -1
- package/types/generated-v3.d.ts.map +0 -1
- package/types/helpers.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/masks.d.ts.map +0 -1
- package/types/palettes.d.ts.map +0 -1
- package/types/shadows.d.ts.map +0 -1
- package/types/templates.d.ts.map +0 -1
- package/types/themes-new.d.ts.map +0 -1
- package/types/themes-old.d.ts.map +0 -1
- package/types/themes.d.ts.map +0 -1
- package/types/tokens.d.ts.map +0 -1
- package/types/v2-themes.d.ts.map +0 -1
- package/types/v2.d.ts.map +0 -1
- package/types/v3-themes.d.ts.map +0 -1
- package/types/v3.d.ts.map +0 -1
package/src/v3-themes.ts
CHANGED
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
yellowDark,
|
|
18
18
|
} from '@tamagui/colors'
|
|
19
19
|
import { createThemeBuilder } from '@tamagui/theme-builder'
|
|
20
|
-
import type { Variable } from '@tamagui/web'
|
|
21
20
|
import { createTokens } from '@tamagui/web'
|
|
22
21
|
|
|
23
22
|
const colorTokens = {
|
|
@@ -111,15 +110,21 @@ export const palettes = (() => {
|
|
|
111
110
|
const transparent = (hsl: string, opacity = 0) =>
|
|
112
111
|
hsl.replace(`%)`, `%, ${opacity})`).replace(`hsl(`, `hsla(`)
|
|
113
112
|
|
|
114
|
-
const getColorPalette = (colors: Object): string[] => {
|
|
113
|
+
const getColorPalette = (colors: Object, accentColors: Object): string[] => {
|
|
115
114
|
const colorPalette = Object.values(colors)
|
|
116
115
|
// make the transparent color vibrant and towards the middle
|
|
117
116
|
const colorI = colorPalette.length - 4
|
|
118
117
|
|
|
118
|
+
// accents!
|
|
119
|
+
const accentPalette = Object.values(accentColors)
|
|
120
|
+
const accentBackground = accentPalette[0]
|
|
121
|
+
const accentColor = accentPalette[accentPalette.length - 1]
|
|
122
|
+
|
|
119
123
|
// add our transparent colors first/last
|
|
120
124
|
// and make sure the last (foreground) color is white/black rather than colorful
|
|
121
125
|
// this is mostly for consistency with the older theme-base
|
|
122
126
|
return [
|
|
127
|
+
accentBackground,
|
|
123
128
|
transparent(colorPalette[0], 0),
|
|
124
129
|
transparent(colorPalette[0], 0.25),
|
|
125
130
|
transparent(colorPalette[0], 0.5),
|
|
@@ -129,15 +134,17 @@ export const palettes = (() => {
|
|
|
129
134
|
transparent(colorPalette[colorI], 0.5),
|
|
130
135
|
transparent(colorPalette[colorI], 0.25),
|
|
131
136
|
transparent(colorPalette[colorI], 0),
|
|
137
|
+
accentColor,
|
|
132
138
|
]
|
|
133
139
|
}
|
|
134
140
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
141
|
+
const brandColor = {
|
|
142
|
+
light: color.blue4Light,
|
|
143
|
+
dark: color.blue4Dark,
|
|
144
|
+
}
|
|
139
145
|
|
|
140
146
|
const lightPalette = [
|
|
147
|
+
brandColor.light,
|
|
141
148
|
color.white0,
|
|
142
149
|
color.white025,
|
|
143
150
|
color.white05,
|
|
@@ -158,9 +165,11 @@ export const palettes = (() => {
|
|
|
158
165
|
color.black05,
|
|
159
166
|
color.black025,
|
|
160
167
|
color.black0,
|
|
168
|
+
brandColor.dark,
|
|
161
169
|
]
|
|
162
170
|
|
|
163
171
|
const darkPalette = [
|
|
172
|
+
brandColor.dark,
|
|
164
173
|
color.black0,
|
|
165
174
|
color.black025,
|
|
166
175
|
color.black05,
|
|
@@ -181,17 +190,34 @@ export const palettes = (() => {
|
|
|
181
190
|
color.white05,
|
|
182
191
|
color.white025,
|
|
183
192
|
color.white0,
|
|
193
|
+
brandColor.light,
|
|
184
194
|
]
|
|
185
195
|
|
|
196
|
+
const lightColorNames = objectKeys(colorTokens.light)
|
|
186
197
|
const lightPalettes = objectFromEntries(
|
|
187
|
-
|
|
188
|
-
(key) =>
|
|
198
|
+
lightColorNames.map(
|
|
199
|
+
(key, index) =>
|
|
200
|
+
[
|
|
201
|
+
`light_${key}`,
|
|
202
|
+
getColorPalette(
|
|
203
|
+
colorTokens.light[key],
|
|
204
|
+
colorTokens.light[lightColorNames[(index + 1) % lightColorNames.length]]
|
|
205
|
+
),
|
|
206
|
+
] as const
|
|
189
207
|
)
|
|
190
208
|
)
|
|
191
209
|
|
|
210
|
+
const darkColorNames = objectKeys(colorTokens.dark)
|
|
192
211
|
const darkPalettes = objectFromEntries(
|
|
193
|
-
|
|
194
|
-
(key) =>
|
|
212
|
+
darkColorNames.map(
|
|
213
|
+
(key, index) =>
|
|
214
|
+
[
|
|
215
|
+
`dark_${key}`,
|
|
216
|
+
getColorPalette(
|
|
217
|
+
colorTokens.dark[key],
|
|
218
|
+
colorTokens.light[darkColorNames[(index + 1) % darkColorNames.length]]
|
|
219
|
+
),
|
|
220
|
+
] as const
|
|
195
221
|
)
|
|
196
222
|
)
|
|
197
223
|
|
|
@@ -207,51 +233,61 @@ export const palettes = (() => {
|
|
|
207
233
|
}
|
|
208
234
|
})()
|
|
209
235
|
|
|
210
|
-
export const
|
|
211
|
-
const
|
|
236
|
+
export const getTemplates = (scheme: 'dark' | 'light') => {
|
|
237
|
+
const isLight = scheme === 'light'
|
|
238
|
+
|
|
239
|
+
// our palettes have 4 things padding each end until you get to bg/color:
|
|
240
|
+
// [accentBg, transparent1, transparent2, transparent3, transparent4, background, ...]
|
|
241
|
+
const bgIndex = 5
|
|
242
|
+
const lighten = isLight ? -1 : 1
|
|
243
|
+
const darken = -lighten
|
|
244
|
+
const borderColor = bgIndex + 3
|
|
212
245
|
|
|
213
246
|
// templates use the palette and specify index
|
|
214
247
|
// negative goes backwards from end so -1 is the last item
|
|
215
248
|
const base = {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
249
|
+
accentBackground: 0,
|
|
250
|
+
accentColor: -0,
|
|
251
|
+
|
|
252
|
+
background0: 1,
|
|
253
|
+
background025: 2,
|
|
254
|
+
background05: 3,
|
|
255
|
+
background075: 4,
|
|
256
|
+
color1: bgIndex,
|
|
257
|
+
color2: bgIndex + 1,
|
|
258
|
+
color3: bgIndex + 2,
|
|
259
|
+
color4: bgIndex + 3,
|
|
260
|
+
color5: bgIndex + 4,
|
|
261
|
+
color6: bgIndex + 5,
|
|
262
|
+
color7: bgIndex + 6,
|
|
263
|
+
color8: bgIndex + 7,
|
|
264
|
+
color9: bgIndex + 8,
|
|
265
|
+
color10: bgIndex + 9,
|
|
266
|
+
color11: bgIndex + 10,
|
|
267
|
+
color12: bgIndex + 11,
|
|
268
|
+
color0: -1,
|
|
269
|
+
color025: -2,
|
|
270
|
+
color05: -3,
|
|
271
|
+
color075: -4,
|
|
236
272
|
// the background, color, etc keys here work like generics - they make it so you
|
|
237
273
|
// can publish components for others to use without mandating a specific color scale
|
|
238
274
|
// the @tamagui/button Button component looks for `$background`, so you set the
|
|
239
275
|
// dark_red_Button theme to have a stronger background than the dark_red theme.
|
|
240
|
-
background:
|
|
241
|
-
backgroundHover:
|
|
242
|
-
backgroundPress:
|
|
243
|
-
backgroundFocus:
|
|
244
|
-
borderColor
|
|
245
|
-
borderColorHover:
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
color: -
|
|
249
|
-
colorHover: -
|
|
250
|
-
colorPress: -
|
|
251
|
-
colorFocus: -
|
|
252
|
-
colorTransparent: -
|
|
253
|
-
placeholderColor: -
|
|
254
|
-
outlineColor: -
|
|
276
|
+
background: bgIndex,
|
|
277
|
+
backgroundHover: bgIndex + lighten, // always lighten on hover no matter the scheme
|
|
278
|
+
backgroundPress: bgIndex + darken, // always darken on press no matter the theme
|
|
279
|
+
backgroundFocus: bgIndex + darken,
|
|
280
|
+
borderColor,
|
|
281
|
+
borderColorHover: borderColor + lighten,
|
|
282
|
+
borderColorPress: borderColor + darken,
|
|
283
|
+
borderColorFocus: borderColor,
|
|
284
|
+
color: -bgIndex,
|
|
285
|
+
colorHover: -bgIndex - 1,
|
|
286
|
+
colorPress: -bgIndex,
|
|
287
|
+
colorFocus: -bgIndex - 1,
|
|
288
|
+
colorTransparent: -1,
|
|
289
|
+
placeholderColor: -bgIndex - 3,
|
|
290
|
+
outlineColor: -2,
|
|
255
291
|
}
|
|
256
292
|
|
|
257
293
|
const surface1 = {
|
|
@@ -287,15 +323,20 @@ export const templates = (() => {
|
|
|
287
323
|
borderColorPress: base.borderColorPress + 3,
|
|
288
324
|
}
|
|
289
325
|
|
|
290
|
-
const
|
|
326
|
+
const surfaceActiveBg = {
|
|
291
327
|
background: base.background + 5,
|
|
292
328
|
backgroundHover: base.background + 5,
|
|
293
329
|
backgroundPress: base.backgroundPress + 5,
|
|
294
330
|
backgroundFocus: base.backgroundFocus + 5,
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const surfaceActive = {
|
|
334
|
+
...surfaceActiveBg,
|
|
335
|
+
// match border to background when active
|
|
336
|
+
borderColor: surfaceActiveBg.background,
|
|
337
|
+
borderColorHover: surfaceActiveBg.backgroundHover,
|
|
338
|
+
borderColorFocus: surfaceActiveBg.backgroundFocus,
|
|
339
|
+
borderColorPress: surfaceActiveBg.backgroundPress,
|
|
299
340
|
}
|
|
300
341
|
|
|
301
342
|
const inverseSurface1 = {
|
|
@@ -350,7 +391,22 @@ export const templates = (() => {
|
|
|
350
391
|
inverseActive,
|
|
351
392
|
surfaceActive,
|
|
352
393
|
}
|
|
353
|
-
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const lightTemplates = getTemplates('light')
|
|
397
|
+
const darkTemplates = getTemplates('dark')
|
|
398
|
+
const templates = {
|
|
399
|
+
...objectFromEntries(
|
|
400
|
+
objectKeys(lightTemplates).map(
|
|
401
|
+
(name) => [`light_${name}`, lightTemplates[name]] as const
|
|
402
|
+
)
|
|
403
|
+
),
|
|
404
|
+
...objectFromEntries(
|
|
405
|
+
objectKeys(darkTemplates).map(
|
|
406
|
+
(name) => [`dark_${name}`, darkTemplates[name]] as const
|
|
407
|
+
)
|
|
408
|
+
),
|
|
409
|
+
}
|
|
354
410
|
|
|
355
411
|
const shadows = {
|
|
356
412
|
light: {
|
|
@@ -388,7 +444,7 @@ const overlayThemeDefinitions = [
|
|
|
388
444
|
{
|
|
389
445
|
parent: 'dark',
|
|
390
446
|
theme: {
|
|
391
|
-
background: 'rgba(0,0,0,0.
|
|
447
|
+
background: 'rgba(0,0,0,0.8)',
|
|
392
448
|
},
|
|
393
449
|
},
|
|
394
450
|
]
|
|
@@ -561,12 +617,12 @@ const themeBuilder = createThemeBuilder()
|
|
|
561
617
|
|
|
562
618
|
const themesIn = themeBuilder.build()
|
|
563
619
|
|
|
564
|
-
export type Theme = Record<keyof typeof
|
|
620
|
+
export type Theme = Record<keyof typeof lightTemplates.base, string> &
|
|
565
621
|
typeof nonInherited.light
|
|
566
622
|
|
|
567
623
|
export type ThemesOut = Record<keyof typeof themesIn, Theme>
|
|
568
624
|
|
|
569
|
-
export const themes = themesIn as ThemesOut
|
|
625
|
+
export const themes = themesIn as any as ThemesOut
|
|
570
626
|
|
|
571
627
|
// --- tokens ---
|
|
572
628
|
|
|
@@ -673,14 +729,11 @@ export const tokens = createTokens({
|
|
|
673
729
|
|
|
674
730
|
// --- utils ---
|
|
675
731
|
|
|
676
|
-
export function postfixObjKeys<
|
|
677
|
-
A extends { [key: string]: Variable<string> | string },
|
|
678
|
-
B extends string,
|
|
679
|
-
>(
|
|
732
|
+
export function postfixObjKeys<A extends { [key: string]: string }, B extends string>(
|
|
680
733
|
obj: A,
|
|
681
734
|
postfix: B
|
|
682
735
|
): {
|
|
683
|
-
[Key in `${keyof A extends string ? keyof A : never}${B}`]:
|
|
736
|
+
[Key in `${keyof A extends string ? keyof A : never}${B}`]: string
|
|
684
737
|
} {
|
|
685
738
|
return Object.fromEntries(
|
|
686
739
|
Object.entries(obj).map(([k, v]) => [`${k}${postfix}`, v])
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true
|
|
5
|
+
},
|
|
6
|
+
"exclude": [
|
|
7
|
+
"generate.ts",
|
|
8
|
+
"types",
|
|
9
|
+
"v2.d.ts",
|
|
10
|
+
"v2.js",
|
|
11
|
+
"v2-themes.js",
|
|
12
|
+
"v2-themes.d.ts",
|
|
13
|
+
"v3.d.ts",
|
|
14
|
+
"v3.js",
|
|
15
|
+
"v3-themes.js",
|
|
16
|
+
"v3-themes.d.ts",
|
|
17
|
+
"dist",
|
|
18
|
+
"**/__tests__"
|
|
19
|
+
],
|
|
20
|
+
"references": [
|
|
21
|
+
{
|
|
22
|
+
"path": "../colors"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"path": "../core"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
package/types/generated-v3.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
type Theme = {
|
|
2
|
+
accentBackground: string;
|
|
3
|
+
accentColor: string;
|
|
2
4
|
background0: string;
|
|
3
5
|
background025: string;
|
|
4
6
|
background05: string;
|
|
@@ -25,8 +27,8 @@ type Theme = {
|
|
|
25
27
|
backgroundFocus: string;
|
|
26
28
|
borderColor: string;
|
|
27
29
|
borderColorHover: string;
|
|
28
|
-
borderColorFocus: string;
|
|
29
30
|
borderColorPress: string;
|
|
31
|
+
borderColorFocus: string;
|
|
30
32
|
color: string;
|
|
31
33
|
colorHover: string;
|
|
32
34
|
colorPress: string;
|