@tamagui/theme-builder 1.79.19 → 1.80.1
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/ThemeBuilder.js +4 -1
- package/dist/cjs/ThemeBuilder.js.map +1 -1
- package/dist/cjs/ThemeBuilder.native.js +4 -1
- package/dist/cjs/ThemeBuilder.native.js.map +1 -1
- package/dist/cjs/buildMask.js +1 -1
- package/dist/cjs/buildMask.js.map +1 -1
- package/dist/cjs/buildMask.native.js +1 -1
- package/dist/cjs/buildMask.native.js.map +1 -1
- package/dist/cjs/buildThemeSuite.js +230 -245
- package/dist/cjs/buildThemeSuite.js.map +2 -2
- package/dist/cjs/buildThemeSuite.native.js +230 -245
- package/dist/cjs/buildThemeSuite.native.js.map +2 -2
- package/dist/cjs/buildThemeSuiteScales.js.map +1 -1
- package/dist/cjs/buildThemeSuiteScales.native.js.map +1 -1
- package/dist/cjs/index.js +1 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +1 -11
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/masks.js +0 -142
- package/dist/cjs/masks.js.map +2 -2
- package/dist/cjs/masks.native.js +0 -142
- package/dist/cjs/masks.native.js.map +2 -2
- package/dist/esm/ThemeBuilder.js +4 -1
- package/dist/esm/ThemeBuilder.js.map +1 -1
- package/dist/esm/ThemeBuilder.native.js +4 -1
- package/dist/esm/ThemeBuilder.native.js.map +1 -1
- package/dist/esm/buildMask.js +1 -1
- package/dist/esm/buildMask.js.map +1 -1
- package/dist/esm/buildMask.native.js +1 -1
- package/dist/esm/buildMask.native.js.map +1 -1
- package/dist/esm/buildThemeSuite.js +227 -248
- package/dist/esm/buildThemeSuite.js.map +2 -2
- package/dist/esm/buildThemeSuite.native.js +227 -248
- package/dist/esm/buildThemeSuite.native.js.map +2 -2
- package/dist/esm/buildThemeSuiteScales.js.map +1 -1
- package/dist/esm/buildThemeSuiteScales.native.js.map +1 -1
- package/dist/esm/index.js +0 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.native.js +0 -5
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/masks.js +0 -129
- package/dist/esm/masks.js.map +2 -2
- package/dist/esm/masks.native.js +0 -129
- package/dist/esm/masks.native.js.map +2 -2
- package/package.json +3 -3
- package/src/ThemeBuilder.ts +15 -8
- package/src/index.ts +0 -7
- package/types/ThemeBuilder.d.ts +5 -1
- package/types/ThemeBuilder.d.ts.map +1 -1
- package/types/buildMask.d.ts.map +1 -1
- package/types/buildThemeSuite.d.ts +4 -1639
- package/types/buildThemeSuite.d.ts.map +1 -1
- package/types/buildThemeSuiteScales.d.ts.map +1 -1
- package/types/index.d.ts +0 -5
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +13 -8
- package/types/types.d.ts.map +1 -1
- package/src/buildMask.ts +0 -63
- package/src/buildThemeSuite.ts +0 -384
- package/src/buildThemeSuitePalettes.ts +0 -164
- package/src/buildThemeSuiteScales.ts +0 -254
- package/src/masks.ts +0 -147
- package/src/types.ts +0 -102
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { hsla, parseToHsla, toHex } from 'color2k'
|
|
2
|
-
|
|
3
|
-
import { BuildTheme, ScaleTypeName } from './types'
|
|
4
|
-
|
|
5
|
-
// export function getColorForegroundBackground(color: string, isDarkMode = false) {
|
|
6
|
-
// const [h, s, l] = parseToHsla(color)
|
|
7
|
-
// const isColorLight = l > 0.5
|
|
8
|
-
// const oppositeLightness = l > 0.5 ? 1 - l : 0.5 + l
|
|
9
|
-
// const oppositeLightnessColor = toHex(hsla(h, s, oppositeLightness, 1))
|
|
10
|
-
// const foreground = isDarkMode ? color : oppositeLightnessColor
|
|
11
|
-
// const background = foreground === color ? oppositeLightnessColor : color
|
|
12
|
-
// return {
|
|
13
|
-
// foreground,
|
|
14
|
-
// foregroundLightness: foreground === color ? l : oppositeLightness,
|
|
15
|
-
// background,
|
|
16
|
-
// backgroundLightness: foreground !== color ? l : oppositeLightness,
|
|
17
|
-
// }
|
|
18
|
-
// }
|
|
19
|
-
|
|
20
|
-
// if (scale === 'automatic') {
|
|
21
|
-
// const lightColors = getColorForegroundBackground(baseColor, false)
|
|
22
|
-
// const darkColors = getColorForegroundBackground(baseColor, true)
|
|
23
|
-
|
|
24
|
-
// const scaleLen = 12
|
|
25
|
-
// const arr = new Array(scaleLen).fill(0)
|
|
26
|
-
|
|
27
|
-
// function getScale(bgL: number, fgL: number) {
|
|
28
|
-
// const stepSize = (fgL - bgL) / scaleLen
|
|
29
|
-
// return arr.map((_, i) => bgL + i * stepSize)
|
|
30
|
-
// }
|
|
31
|
-
|
|
32
|
-
// return {
|
|
33
|
-
// ...base,
|
|
34
|
-
// lumScale: {
|
|
35
|
-
// light: getScale(lightColors.backgroundLightness, lightColors.foregroundLightness),
|
|
36
|
-
// dark: getScale(darkColors.backgroundLightness, darkColors.foregroundLightness),
|
|
37
|
-
// },
|
|
38
|
-
// }
|
|
39
|
-
// }
|
|
40
|
-
|
|
41
|
-
export type ScaleType<A extends ScaleTypeName = ScaleTypeName> = {
|
|
42
|
-
name: string
|
|
43
|
-
createdFrom?: A // we copy the scale values - keeping this helps us refer back to the scale. also helpful if we change scales in the future
|
|
44
|
-
lumScale?: {
|
|
45
|
-
light: Array<number>
|
|
46
|
-
dark: Array<number>
|
|
47
|
-
}
|
|
48
|
-
satScale?: {
|
|
49
|
-
light: Array<number>
|
|
50
|
-
dark: Array<number>
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function getScalePreset<Name extends ScaleTypeName>(
|
|
55
|
-
a: Name
|
|
56
|
-
): (typeof scaleTypes)[Name] {
|
|
57
|
-
return scaleTypes[a]
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const fullSatScale = {
|
|
61
|
-
light: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
62
|
-
dark: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export const scaleTypes = {
|
|
66
|
-
custom: {
|
|
67
|
-
name: 'Custom',
|
|
68
|
-
createdFrom: 'custom',
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
radix: {
|
|
72
|
-
name: 'Radius',
|
|
73
|
-
createdFrom: 'radix',
|
|
74
|
-
lumScale: {
|
|
75
|
-
light: [
|
|
76
|
-
0.992, 0.95, 0.92, 0.868, 0.832, 0.804, 0.747, 0.659, 0.541, 0.453, 0.27, 0.086,
|
|
77
|
-
],
|
|
78
|
-
dark: [
|
|
79
|
-
0.07, 0.11, 0.136, 0.158, 0.179, 0.205, 0.243, 0.313, 0.439, 0.52, 0.61, 0.93,
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
satScale: {
|
|
83
|
-
light: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
84
|
-
dark: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
'radix-b': {
|
|
89
|
-
name: 'Radius B',
|
|
90
|
-
createdFrom: 'radix-b',
|
|
91
|
-
lumScale: {
|
|
92
|
-
light: [
|
|
93
|
-
0.92, 0.868, 0.832, 0.804, 0.747, 0.7, 0.659, 0.541, 0.453, 0.36, 0.32, 0.27,
|
|
94
|
-
],
|
|
95
|
-
dark: [
|
|
96
|
-
0.11, 0.136, 0.158, 0.179, 0.205, 0.243, 0.313, 0.439, 0.47, 0.52, 0.56, 0.61,
|
|
97
|
-
],
|
|
98
|
-
},
|
|
99
|
-
satScale: {
|
|
100
|
-
light: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
101
|
-
dark: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
'radius-bright': {
|
|
106
|
-
name: 'Radius Bright',
|
|
107
|
-
createdFrom: 'radius-bright',
|
|
108
|
-
lumScale: {
|
|
109
|
-
light: [1, 0.954, 0.94, 0.9, 0.85, 0.804, 0.747, 0.659, 0.541, 0.453, 0.27, 0.086],
|
|
110
|
-
dark: [0, 0.1, 0.16, 0.2, 0.24, 0.36, 0.42, 0.46, 0.5, 0.54, 0.84, 0.97],
|
|
111
|
-
},
|
|
112
|
-
satScale: {
|
|
113
|
-
light: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
114
|
-
dark: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
'radius-bold': {
|
|
119
|
-
name: 'Radius Bold',
|
|
120
|
-
createdFrom: 'radius-bold',
|
|
121
|
-
lumScale: {
|
|
122
|
-
light: [1, 0.9, 0.885, 0.82, 0.77, 0.54, 0.32, 0.25, 0.16, 0.12, 0.075, 0],
|
|
123
|
-
dark: [0, 0.13, 0.2, 0.24, 0.3, 0.34, 0.45, 0.55, 0.65, 0.885, 0.9, 1],
|
|
124
|
-
},
|
|
125
|
-
satScale: {
|
|
126
|
-
light: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
127
|
-
dark: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
linear: {
|
|
132
|
-
name: 'Linear',
|
|
133
|
-
createdFrom: 'linear',
|
|
134
|
-
lumScale: {
|
|
135
|
-
light: [1, 0.925, 0.9, 0.85, 0.75, 0.6, 0.4, 0.3, 0.25, 0.15, 0.125, 0],
|
|
136
|
-
dark: [0, 0.075, 0.125, 0.15, 0.25, 0.4, 0.6, 0.75, 0.85, 0.9, 0.925, 1],
|
|
137
|
-
},
|
|
138
|
-
satScale: {
|
|
139
|
-
light: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
140
|
-
dark: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
neon: {
|
|
145
|
-
name: 'Neon',
|
|
146
|
-
createdFrom: 'neon',
|
|
147
|
-
lumScale: {
|
|
148
|
-
light: [
|
|
149
|
-
0.978, 0.938, 0.902, 0.868, 0.832, 0.804, 0.747, 0.659, 0.541, 0.453, 0.27, 0.086,
|
|
150
|
-
],
|
|
151
|
-
dark: [
|
|
152
|
-
0.07, 0.11, 0.136, 0.158, 0.179, 0.205, 0.243, 0.313, 0.439, 0.52, 0.61, 0.93,
|
|
153
|
-
],
|
|
154
|
-
},
|
|
155
|
-
satScale: {
|
|
156
|
-
light: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
157
|
-
dark: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
'neon-bright': {
|
|
162
|
-
name: 'Neon B',
|
|
163
|
-
createdFrom: 'neon-bright',
|
|
164
|
-
lumScale: {
|
|
165
|
-
light: [0.45, 0.475, 0.5, 0.525, 0.55, 0.575, 0.6, 0.625, 0.65, 0.2, 0.1, 0],
|
|
166
|
-
dark: [0.45, 0.475, 0.5, 0.525, 0.55, 0.575, 0.6, 0.625, 0.65, 0.2, 0.1, 0],
|
|
167
|
-
},
|
|
168
|
-
satScale: {
|
|
169
|
-
light: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
170
|
-
dark: [0.65, 0.55, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
'neon-c': {
|
|
175
|
-
name: 'Neon C',
|
|
176
|
-
createdFrom: 'neon-c',
|
|
177
|
-
lumScale: {
|
|
178
|
-
light: [0.45, 0.475, 0.5, 0.525, 0.55, 0.575, 0.6, 0.625, 0.65, 0.2, 0.1, 0],
|
|
179
|
-
dark: [0.45, 0.475, 0.5, 0.525, 0.55, 0.575, 0.6, 0.625, 0.65, 0.2, 0.1, 0],
|
|
180
|
-
},
|
|
181
|
-
satScale: fullSatScale,
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
pastel: {
|
|
185
|
-
name: 'Pastel',
|
|
186
|
-
createdFrom: 'pastel',
|
|
187
|
-
lumScale: {
|
|
188
|
-
light: [
|
|
189
|
-
0.978, 0.938, 0.902, 0.868, 0.832, 0.804, 0.747, 0.659, 0.541, 0.453, 0.36, 0.2,
|
|
190
|
-
],
|
|
191
|
-
dark: [0.07, 0.15, 0.176, 0.198, 0.2, 0.225, 0.243, 0.313, 0.439, 0.52, 0.61, 0.9],
|
|
192
|
-
},
|
|
193
|
-
satScale: {
|
|
194
|
-
light: [0.5, 0.45, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
195
|
-
dark: [0.5, 0.45, 0.4, 0.4, 0.35, 0.35, 0.35, 0.35, 0.4, 0.4, 0.3, 0.2],
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
'pastel-desaturating': {
|
|
200
|
-
name: 'Pastel D',
|
|
201
|
-
createdFrom: 'pastel-desaturating',
|
|
202
|
-
lumScale: {
|
|
203
|
-
light: [
|
|
204
|
-
0.935, 0.838, 0.802, 0.768, 0.732, 0.704, 0.647, 0.559, 0.441, 0.353, 0.17, 0,
|
|
205
|
-
],
|
|
206
|
-
dark: [0.085, 0.1, 0.12, 0.14, 0.17, 0.22, 0.27, 0.35, 0.409, 0.49, 0.58, 0.9],
|
|
207
|
-
},
|
|
208
|
-
satScale: {
|
|
209
|
-
light: [0.6, 0.5, 0.4, 0.35, 0.3, 0.3, 0.3, 0.3, 0.4, 0.35, 0.25, 0.15],
|
|
210
|
-
dark: [0.6, 0.5, 0.4, 0.35, 0.3, 0.3, 0.3, 0.3, 0.4, 0.35, 0.25, 0.15],
|
|
211
|
-
},
|
|
212
|
-
},
|
|
213
|
-
} satisfies Record<ScaleTypeName, ScaleType>
|
|
214
|
-
|
|
215
|
-
const adjustScale = (
|
|
216
|
-
theme: BuildTheme,
|
|
217
|
-
scale: number[],
|
|
218
|
-
userVal: number,
|
|
219
|
-
isLight = false
|
|
220
|
-
) => {
|
|
221
|
-
const scaleMin = scale.reduce((acc, cur) => Math.min(cur, acc), Infinity)
|
|
222
|
-
const scaleMax = scale.reduce((acc, cur) => Math.max(cur, acc), 0)
|
|
223
|
-
|
|
224
|
-
if (scaleMin === scaleMax) {
|
|
225
|
-
return scale.map(() => userVal)
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
const res = scale.map((val, i) => {
|
|
229
|
-
if (userVal > 0.5) {
|
|
230
|
-
return val + (userVal - 0.5) * (1 - val)
|
|
231
|
-
} else {
|
|
232
|
-
return val * (1 / (1.5 - userVal))
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// // goes from 0 - 1 where 0 = closest to edge, 1 = furthest
|
|
236
|
-
// const distanceFromEdge = 2 * (userVal < 0.5 ? userVal : 1 - userVal)
|
|
237
|
-
|
|
238
|
-
// // goes from 0 - 1 where 0 = furthest from edge, 1 = closest
|
|
239
|
-
// const strengthOfUserVal = 1 - distanceFromEdge
|
|
240
|
-
|
|
241
|
-
// // gets stronger as we get closer to edges
|
|
242
|
-
// const next = userVal * strengthOfUserVal + val * (1 - strengthOfUserVal)
|
|
243
|
-
|
|
244
|
-
// return clamp(
|
|
245
|
-
// val < 0
|
|
246
|
-
// ? // TODO
|
|
247
|
-
// val
|
|
248
|
-
// : next,
|
|
249
|
-
// [0, 1]
|
|
250
|
-
// )
|
|
251
|
-
})
|
|
252
|
-
|
|
253
|
-
return res
|
|
254
|
-
}
|
package/src/masks.ts
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MaskDefinitions,
|
|
3
|
-
MaskOptions,
|
|
4
|
-
combineMasks,
|
|
5
|
-
createIdentityMask,
|
|
6
|
-
createInverseMask,
|
|
7
|
-
createMask,
|
|
8
|
-
createSoftenMask,
|
|
9
|
-
createStrengthenMask,
|
|
10
|
-
skipMask,
|
|
11
|
-
} from '@tamagui/create-theme'
|
|
12
|
-
|
|
13
|
-
const shadows = {
|
|
14
|
-
shadowColor: 0,
|
|
15
|
-
shadowColorHover: 0,
|
|
16
|
-
shadowColorPress: 0,
|
|
17
|
-
shadowColorFocus: 0,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const colors = {
|
|
21
|
-
...shadows,
|
|
22
|
-
color: 0,
|
|
23
|
-
colorHover: 0,
|
|
24
|
-
colorFocus: 0,
|
|
25
|
-
colorPress: 0,
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const templateColorsSpecific = {
|
|
29
|
-
color1: 1,
|
|
30
|
-
color2: 2,
|
|
31
|
-
color3: 3,
|
|
32
|
-
color4: 4,
|
|
33
|
-
color5: 5,
|
|
34
|
-
color6: 6,
|
|
35
|
-
color7: 7,
|
|
36
|
-
color8: 8,
|
|
37
|
-
color9: 9,
|
|
38
|
-
color10: 10,
|
|
39
|
-
color11: 11,
|
|
40
|
-
color12: 12,
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const skipShadowsAndSpecificColors = {
|
|
44
|
-
...shadows,
|
|
45
|
-
...templateColorsSpecific,
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const PALETTE_LEN = 14
|
|
49
|
-
|
|
50
|
-
const baseMaskOptions: MaskOptions = {
|
|
51
|
-
override: shadows,
|
|
52
|
-
skip: shadows,
|
|
53
|
-
// avoids the transparent ends
|
|
54
|
-
max: PALETTE_LEN - 2,
|
|
55
|
-
min: 1,
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export const maskOptions = {
|
|
59
|
-
component: {
|
|
60
|
-
...baseMaskOptions,
|
|
61
|
-
override: colors,
|
|
62
|
-
skip: skipShadowsAndSpecificColors,
|
|
63
|
-
},
|
|
64
|
-
alt: {
|
|
65
|
-
...baseMaskOptions,
|
|
66
|
-
},
|
|
67
|
-
button: {
|
|
68
|
-
...baseMaskOptions,
|
|
69
|
-
override: {
|
|
70
|
-
...colors,
|
|
71
|
-
borderColor: 'transparent',
|
|
72
|
-
borderColorHover: 'transparent',
|
|
73
|
-
},
|
|
74
|
-
skip: skipShadowsAndSpecificColors,
|
|
75
|
-
},
|
|
76
|
-
} satisfies Record<string, MaskOptions>
|
|
77
|
-
|
|
78
|
-
export const masks = {
|
|
79
|
-
identity: createIdentityMask(),
|
|
80
|
-
soften: createSoftenMask(),
|
|
81
|
-
soften2: createSoftenMask({ strength: 2 }),
|
|
82
|
-
soften3: createSoftenMask({ strength: 3 }),
|
|
83
|
-
strengthen: createStrengthenMask(),
|
|
84
|
-
inverse: createInverseMask(),
|
|
85
|
-
inverseSoften: combineMasks(createInverseMask(), createSoftenMask({ strength: 2 })),
|
|
86
|
-
inverseSoften2: combineMasks(createInverseMask(), createSoftenMask({ strength: 3 })),
|
|
87
|
-
inverseSoften3: combineMasks(createInverseMask(), createSoftenMask({ strength: 4 })),
|
|
88
|
-
inverseStrengthen2: combineMasks(
|
|
89
|
-
createInverseMask(),
|
|
90
|
-
createStrengthenMask({ strength: 2 })
|
|
91
|
-
),
|
|
92
|
-
strengthenButSoftenBorder: createMask((template, options) => {
|
|
93
|
-
const stronger = createStrengthenMask().mask(template, options)
|
|
94
|
-
const softer = createSoftenMask().mask(template, options)
|
|
95
|
-
return {
|
|
96
|
-
...stronger,
|
|
97
|
-
borderColor: softer.borderColor,
|
|
98
|
-
borderColorHover: softer.borderColorHover,
|
|
99
|
-
borderColorPress: softer.borderColorPress,
|
|
100
|
-
borderColorFocus: softer.borderColorFocus,
|
|
101
|
-
}
|
|
102
|
-
}),
|
|
103
|
-
soften2Border1: createMask((template, options) => {
|
|
104
|
-
const softer2 = createSoftenMask({ strength: 2 }).mask(template, options)
|
|
105
|
-
const softer1 = createSoftenMask({ strength: 1 }).mask(template, options)
|
|
106
|
-
return {
|
|
107
|
-
...softer2,
|
|
108
|
-
borderColor: softer1.borderColor,
|
|
109
|
-
borderColorHover: softer1.borderColorHover,
|
|
110
|
-
borderColorPress: softer1.borderColorPress,
|
|
111
|
-
borderColorFocus: softer1.borderColorFocus,
|
|
112
|
-
}
|
|
113
|
-
}),
|
|
114
|
-
soften3FlatBorder: createMask((template, options) => {
|
|
115
|
-
const borderMask = createSoftenMask({ strength: 2 }).mask(template, options)
|
|
116
|
-
const softer3 = createSoftenMask({ strength: 3 }).mask(template, options)
|
|
117
|
-
return {
|
|
118
|
-
...softer3,
|
|
119
|
-
borderColor: borderMask.borderColor,
|
|
120
|
-
borderColorHover: borderMask.borderColorHover,
|
|
121
|
-
borderColorPress: borderMask.borderColorPress,
|
|
122
|
-
borderColorFocus: borderMask.borderColorFocus,
|
|
123
|
-
}
|
|
124
|
-
}),
|
|
125
|
-
softenBorder: createMask((template, options) => {
|
|
126
|
-
const plain = skipMask.mask(template, options)
|
|
127
|
-
const softer = createSoftenMask().mask(template, options)
|
|
128
|
-
return {
|
|
129
|
-
...plain,
|
|
130
|
-
borderColor: softer.borderColor,
|
|
131
|
-
borderColorHover: softer.borderColorHover,
|
|
132
|
-
borderColorPress: softer.borderColorPress,
|
|
133
|
-
borderColorFocus: softer.borderColorFocus,
|
|
134
|
-
}
|
|
135
|
-
}),
|
|
136
|
-
softenBorder2: createMask((template, options) => {
|
|
137
|
-
const plain = skipMask.mask(template, options)
|
|
138
|
-
const softer = createSoftenMask({ strength: 2 }).mask(template, options)
|
|
139
|
-
return {
|
|
140
|
-
...plain,
|
|
141
|
-
borderColor: softer.borderColor,
|
|
142
|
-
borderColorHover: softer.borderColorHover,
|
|
143
|
-
borderColorPress: softer.borderColorPress,
|
|
144
|
-
borderColorFocus: softer.borderColorFocus,
|
|
145
|
-
}
|
|
146
|
-
}),
|
|
147
|
-
} satisfies MaskDefinitions
|
package/src/types.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
// only used by the studio theme builder generated:
|
|
2
|
-
|
|
3
|
-
import { MaskOptions, Template } from '@tamagui/create-theme'
|
|
4
|
-
|
|
5
|
-
export type SubTheme = BuildTheme | BuildThemeMask
|
|
6
|
-
|
|
7
|
-
export type BuildThemeSuiteProps = {
|
|
8
|
-
baseTheme: BuildTheme
|
|
9
|
-
subThemes?: SubTheme[]
|
|
10
|
-
componentMask?: MaskOptions
|
|
11
|
-
templates?: {
|
|
12
|
-
base: Template
|
|
13
|
-
accentLight: Template
|
|
14
|
-
accentDark: Template
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type BuildThemeSuitePalettes = {
|
|
19
|
-
light: string[]
|
|
20
|
-
dark: string[]
|
|
21
|
-
lightAccent?: string[]
|
|
22
|
-
darkAccent?: string[]
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export type ScaleTypeName =
|
|
26
|
-
| 'custom'
|
|
27
|
-
| 'radix'
|
|
28
|
-
| 'radix-b'
|
|
29
|
-
| 'radius-bold'
|
|
30
|
-
| 'radius-bright'
|
|
31
|
-
| 'linear'
|
|
32
|
-
| 'pastel'
|
|
33
|
-
| 'pastel-desaturating'
|
|
34
|
-
| 'neon'
|
|
35
|
-
| 'neon-bright'
|
|
36
|
-
| 'neon-c'
|
|
37
|
-
|
|
38
|
-
export type BuildThemeBase = {
|
|
39
|
-
id: string
|
|
40
|
-
name: string
|
|
41
|
-
errors?: string[]
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export type BuildThemeAnchor = {
|
|
45
|
-
index: number
|
|
46
|
-
hue: {
|
|
47
|
-
light: number
|
|
48
|
-
dark: number
|
|
49
|
-
sync?: boolean
|
|
50
|
-
syncLeft?: boolean
|
|
51
|
-
}
|
|
52
|
-
sat: {
|
|
53
|
-
light: number
|
|
54
|
-
dark: number
|
|
55
|
-
sync?: boolean
|
|
56
|
-
syncLeft?: boolean
|
|
57
|
-
}
|
|
58
|
-
lum: {
|
|
59
|
-
light: number
|
|
60
|
-
dark: number
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export type BuildTheme = BuildThemeBase & {
|
|
65
|
-
type: 'theme'
|
|
66
|
-
|
|
67
|
-
scale: ScaleTypeName
|
|
68
|
-
|
|
69
|
-
anchors: BuildThemeAnchor[]
|
|
70
|
-
|
|
71
|
-
template?: Template
|
|
72
|
-
|
|
73
|
-
accent?: BuildTheme
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// TODO type here isnt the same as type in BuildTheme
|
|
77
|
-
export type BuildMask = { id: string } & (
|
|
78
|
-
| {
|
|
79
|
-
type: 'strengthen'
|
|
80
|
-
strength: number
|
|
81
|
-
}
|
|
82
|
-
| {
|
|
83
|
-
type: 'soften'
|
|
84
|
-
strength: number
|
|
85
|
-
}
|
|
86
|
-
| {
|
|
87
|
-
type: 'inverse'
|
|
88
|
-
}
|
|
89
|
-
| {
|
|
90
|
-
type: 'strengthenBorder'
|
|
91
|
-
strength: number
|
|
92
|
-
}
|
|
93
|
-
| {
|
|
94
|
-
type: 'softenBorder'
|
|
95
|
-
strength: number
|
|
96
|
-
}
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
export type BuildThemeMask = BuildThemeBase & {
|
|
100
|
-
type: 'mask'
|
|
101
|
-
masks: BuildMask[]
|
|
102
|
-
}
|