@sanity/ui 2.0.0-alpha.36 → 2.0.0-alpha.37
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/theme.d.ts +40 -5
- package/dist/theme.esm.js +46 -5
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +46 -5
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
- package/src/theme/build/buildTheme.ts +6 -1
- package/src/theme/config/types.ts +5 -5
- package/src/theme/system/avatar.ts +1 -1
- package/src/theme/system/index.ts +1 -1
- package/src/theme/system/input.ts +1 -1
- package/src/theme/system/theme.ts +6 -6
- package/src/theme/system/v0/avatar.ts +10 -0
- package/src/theme/system/v0/index.ts +2 -0
- package/src/theme/system/v0/input.ts +23 -0
- package/src/theme/versioning/getTheme_v2.ts +20 -2
- package/src/theme/versioning/v0_v2.ts +20 -2
- /package/src/theme/system/{fonts.ts → font.ts} +0 -0
package/package.json
CHANGED
|
@@ -15,9 +15,14 @@ export function buildTheme(config?: ThemeConfig): RootTheme {
|
|
|
15
15
|
avatar: config?.avatar ?? defaultThemeConfig.avatar,
|
|
16
16
|
button: config?.button ?? defaultThemeConfig.button,
|
|
17
17
|
card: config?.card ?? defaultThemeConfig.card,
|
|
18
|
+
// How colors are generated:
|
|
19
|
+
// 1. Merge custom tokens with default tokens
|
|
20
|
+
// 2. Generate tree of color keys (gray/500, black, white, etc.)
|
|
21
|
+
// 3. Apply mixing and render to hex values
|
|
22
|
+
// render(build(mergeWithDefaults()))
|
|
18
23
|
color: renderThemeColorSchemes(colorTheme, config),
|
|
19
24
|
container: config?.container ?? defaultThemeConfig.container,
|
|
20
|
-
font: config?.
|
|
25
|
+
font: config?.font ?? defaultThemeFonts,
|
|
21
26
|
input: config?.input ?? defaultThemeConfig.input,
|
|
22
27
|
layer: config?.layer ?? defaultThemeConfig.layer,
|
|
23
28
|
media: config?.media ?? defaultThemeConfig.media,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {ColorHueKey, ColorTint as ColorPaletteValue, ColorTintKey} from '@sanity/color'
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
ThemeAvatar_v2,
|
|
4
4
|
ThemeFocusRing,
|
|
5
5
|
ThemeFontWeightKey,
|
|
6
6
|
ThemeFonts,
|
|
7
|
-
|
|
7
|
+
ThemeInput_v2,
|
|
8
8
|
ThemeLayer,
|
|
9
9
|
ThemeShadow,
|
|
10
10
|
ThemeStyles,
|
|
@@ -19,7 +19,7 @@ export type ThemeColorPalette = {
|
|
|
19
19
|
|
|
20
20
|
/** @public */
|
|
21
21
|
export interface ThemeConfig {
|
|
22
|
-
avatar?:
|
|
22
|
+
avatar?: ThemeAvatar_v2
|
|
23
23
|
button?: {
|
|
24
24
|
border: {width: number}
|
|
25
25
|
focusRing: ThemeFocusRing
|
|
@@ -32,8 +32,8 @@ export interface ThemeConfig {
|
|
|
32
32
|
}
|
|
33
33
|
color?: ThemeColorTokens
|
|
34
34
|
container?: number[]
|
|
35
|
-
|
|
36
|
-
input?:
|
|
35
|
+
font?: ThemeFonts
|
|
36
|
+
input?: ThemeInput_v2
|
|
37
37
|
layer?: ThemeLayer
|
|
38
38
|
media?: number[]
|
|
39
39
|
palette?: ThemeColorPalette
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ThemeAvatar_v2} from './avatar'
|
|
2
2
|
import {ThemeColorSchemes_v2, ThemeColorCard_v2} from './color'
|
|
3
3
|
import {ThemeFocusRing} from './focusRing'
|
|
4
|
-
import {ThemeFontWeightKey, ThemeFonts} from './
|
|
5
|
-
import {
|
|
4
|
+
import {ThemeFontWeightKey, ThemeFonts} from './font'
|
|
5
|
+
import {ThemeInput_v2} from './input'
|
|
6
6
|
import {ThemeLayer} from './layer'
|
|
7
7
|
import {ThemeShadow} from './shadow'
|
|
8
8
|
import {ThemeStyles} from './styles'
|
|
9
|
-
import {ThemeColor, ThemeColorSchemes} from './v0'
|
|
9
|
+
import {ThemeAvatar, ThemeColor, ThemeColorSchemes, ThemeInput} from './v0'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
export interface RootTheme_v2 {
|
|
15
15
|
_version: 2
|
|
16
|
-
avatar:
|
|
16
|
+
avatar: ThemeAvatar_v2
|
|
17
17
|
button: {
|
|
18
18
|
border: {width: number}
|
|
19
19
|
focusRing: ThemeFocusRing
|
|
@@ -27,7 +27,7 @@ export interface RootTheme_v2 {
|
|
|
27
27
|
color: ThemeColorSchemes_v2
|
|
28
28
|
container: number[]
|
|
29
29
|
font: ThemeFonts
|
|
30
|
-
input:
|
|
30
|
+
input: ThemeInput_v2
|
|
31
31
|
layer: ThemeLayer
|
|
32
32
|
media: number[]
|
|
33
33
|
radius: number[]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
* @deprecated Use `ThemeInput_v2` instead
|
|
4
|
+
*/
|
|
5
|
+
export interface ThemeInput {
|
|
6
|
+
checkbox: {
|
|
7
|
+
size: number
|
|
8
|
+
}
|
|
9
|
+
radio: {
|
|
10
|
+
size: number
|
|
11
|
+
markSize: number
|
|
12
|
+
}
|
|
13
|
+
switch: {
|
|
14
|
+
width: number
|
|
15
|
+
height: number
|
|
16
|
+
padding: number
|
|
17
|
+
transitionDurationMs: number
|
|
18
|
+
transitionTimingFunction: string
|
|
19
|
+
}
|
|
20
|
+
border: {
|
|
21
|
+
width: number
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -14,7 +14,10 @@ export function getTheme_v2(theme: Theme): Theme_v2 {
|
|
|
14
14
|
|
|
15
15
|
const v2: Theme_v2 = {
|
|
16
16
|
_version: 2,
|
|
17
|
-
avatar:
|
|
17
|
+
avatar: {
|
|
18
|
+
...defaultThemeConfig.avatar,
|
|
19
|
+
...theme.sanity.avatar,
|
|
20
|
+
},
|
|
18
21
|
button: {
|
|
19
22
|
...defaultThemeConfig.button,
|
|
20
23
|
...theme.sanity.button,
|
|
@@ -23,7 +26,22 @@ export function getTheme_v2(theme: Theme): Theme_v2 {
|
|
|
23
26
|
color: themeColor_v0_v2(theme.sanity.color),
|
|
24
27
|
container: theme.sanity.container,
|
|
25
28
|
font: theme.sanity.fonts,
|
|
26
|
-
input:
|
|
29
|
+
input: {
|
|
30
|
+
...defaultThemeConfig.input,
|
|
31
|
+
...theme.sanity.input,
|
|
32
|
+
checkbox: {
|
|
33
|
+
...defaultThemeConfig.input.checkbox,
|
|
34
|
+
...theme.sanity.input.checkbox,
|
|
35
|
+
},
|
|
36
|
+
radio: {
|
|
37
|
+
...defaultThemeConfig.input.radio,
|
|
38
|
+
...theme.sanity.input.radio,
|
|
39
|
+
},
|
|
40
|
+
switch: {
|
|
41
|
+
...defaultThemeConfig.input.switch,
|
|
42
|
+
...theme.sanity.input.switch,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
27
45
|
layer: theme.sanity.layer ?? defaultThemeConfig.layer,
|
|
28
46
|
media: theme.sanity.media,
|
|
29
47
|
radius: theme.sanity.radius,
|
|
@@ -31,7 +31,10 @@ export function v0_v2(v0: RootTheme): RootTheme_v2 {
|
|
|
31
31
|
|
|
32
32
|
const v2: RootTheme_v2 = {
|
|
33
33
|
_version: 2,
|
|
34
|
-
avatar
|
|
34
|
+
avatar: {
|
|
35
|
+
...defaultThemeConfig.avatar,
|
|
36
|
+
...avatar,
|
|
37
|
+
},
|
|
35
38
|
button: {
|
|
36
39
|
...defaultThemeConfig.button,
|
|
37
40
|
...button,
|
|
@@ -57,7 +60,22 @@ export function v0_v2(v0: RootTheme): RootTheme_v2 {
|
|
|
57
60
|
},
|
|
58
61
|
container,
|
|
59
62
|
font,
|
|
60
|
-
input
|
|
63
|
+
input: {
|
|
64
|
+
...defaultThemeConfig.input,
|
|
65
|
+
...input,
|
|
66
|
+
checkbox: {
|
|
67
|
+
...defaultThemeConfig.input.checkbox,
|
|
68
|
+
...input.checkbox,
|
|
69
|
+
},
|
|
70
|
+
radio: {
|
|
71
|
+
...defaultThemeConfig.input.radio,
|
|
72
|
+
...input.radio,
|
|
73
|
+
},
|
|
74
|
+
switch: {
|
|
75
|
+
...defaultThemeConfig.input.switch,
|
|
76
|
+
...input.switch,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
61
79
|
layer: layer ?? defaultThemeConfig.layer,
|
|
62
80
|
media,
|
|
63
81
|
radius,
|
|
File without changes
|