@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/dist/theme.d.ts
CHANGED
|
@@ -392,7 +392,7 @@ export declare type RootTheme = BaseTheme
|
|
|
392
392
|
*/
|
|
393
393
|
export declare interface RootTheme_v2 {
|
|
394
394
|
_version: 2
|
|
395
|
-
avatar:
|
|
395
|
+
avatar: ThemeAvatar_v2
|
|
396
396
|
button: {
|
|
397
397
|
border: {
|
|
398
398
|
width: number
|
|
@@ -412,7 +412,7 @@ export declare interface RootTheme_v2 {
|
|
|
412
412
|
color: ThemeColorSchemes_v2
|
|
413
413
|
container: number[]
|
|
414
414
|
font: ThemeFonts
|
|
415
|
-
input:
|
|
415
|
+
input: ThemeInput_v2
|
|
416
416
|
layer: ThemeLayer
|
|
417
417
|
media: number[]
|
|
418
418
|
radius: number[]
|
|
@@ -505,8 +505,19 @@ export declare type Theme_v2 = Omit<RootTheme_v2, 'color'> & {
|
|
|
505
505
|
|
|
506
506
|
/**
|
|
507
507
|
* @public
|
|
508
|
+
* @deprecated Use `ThemeAvatar_v2` instead
|
|
508
509
|
*/
|
|
509
510
|
export declare interface ThemeAvatar {
|
|
511
|
+
sizes: {
|
|
512
|
+
distance: number
|
|
513
|
+
size: number
|
|
514
|
+
}[]
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* @public
|
|
519
|
+
*/
|
|
520
|
+
export declare interface ThemeAvatar_v2 {
|
|
510
521
|
sizes: {
|
|
511
522
|
/** Spacing between avatars in an <AvatarStack> component (px) */
|
|
512
523
|
distance: number
|
|
@@ -1279,7 +1290,7 @@ export declare type ThemeColorToneKey = ThemeColorCardToneKey
|
|
|
1279
1290
|
|
|
1280
1291
|
/** @public */
|
|
1281
1292
|
export declare interface ThemeConfig {
|
|
1282
|
-
avatar?:
|
|
1293
|
+
avatar?: ThemeAvatar_v2
|
|
1283
1294
|
button?: {
|
|
1284
1295
|
border: {
|
|
1285
1296
|
width: number
|
|
@@ -1298,8 +1309,8 @@ export declare interface ThemeConfig {
|
|
|
1298
1309
|
}
|
|
1299
1310
|
color?: ThemeColorTokens
|
|
1300
1311
|
container?: number[]
|
|
1301
|
-
|
|
1302
|
-
input?:
|
|
1312
|
+
font?: ThemeFonts
|
|
1313
|
+
input?: ThemeInput_v2
|
|
1303
1314
|
layer?: ThemeLayer
|
|
1304
1315
|
media?: number[]
|
|
1305
1316
|
palette?: ThemeColorPalette
|
|
@@ -1373,8 +1384,32 @@ export declare type ThemeFontWeightKey = 'regular' | 'medium' | 'semibold' | 'bo
|
|
|
1373
1384
|
|
|
1374
1385
|
/**
|
|
1375
1386
|
* @public
|
|
1387
|
+
* @deprecated Use `ThemeInput_v2` instead
|
|
1376
1388
|
*/
|
|
1377
1389
|
export declare interface ThemeInput {
|
|
1390
|
+
checkbox: {
|
|
1391
|
+
size: number
|
|
1392
|
+
}
|
|
1393
|
+
radio: {
|
|
1394
|
+
size: number
|
|
1395
|
+
markSize: number
|
|
1396
|
+
}
|
|
1397
|
+
switch: {
|
|
1398
|
+
width: number
|
|
1399
|
+
height: number
|
|
1400
|
+
padding: number
|
|
1401
|
+
transitionDurationMs: number
|
|
1402
|
+
transitionTimingFunction: string
|
|
1403
|
+
}
|
|
1404
|
+
border: {
|
|
1405
|
+
width: number
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
/**
|
|
1410
|
+
* @public
|
|
1411
|
+
*/
|
|
1412
|
+
export declare interface ThemeInput_v2 {
|
|
1378
1413
|
checkbox: {
|
|
1379
1414
|
size: number
|
|
1380
1415
|
focusRing: ThemeFocusRing
|
package/dist/theme.esm.js
CHANGED
|
@@ -1679,7 +1679,10 @@ function getTheme_v2(theme) {
|
|
|
1679
1679
|
if (cached_v2) return cached_v2;
|
|
1680
1680
|
const v2 = {
|
|
1681
1681
|
_version: 2,
|
|
1682
|
-
avatar:
|
|
1682
|
+
avatar: {
|
|
1683
|
+
...defaultThemeConfig.avatar,
|
|
1684
|
+
...theme.sanity.avatar
|
|
1685
|
+
},
|
|
1683
1686
|
button: {
|
|
1684
1687
|
...defaultThemeConfig.button,
|
|
1685
1688
|
...theme.sanity.button
|
|
@@ -1688,7 +1691,22 @@ function getTheme_v2(theme) {
|
|
|
1688
1691
|
color: themeColor_v0_v2(theme.sanity.color),
|
|
1689
1692
|
container: theme.sanity.container,
|
|
1690
1693
|
font: theme.sanity.fonts,
|
|
1691
|
-
input:
|
|
1694
|
+
input: {
|
|
1695
|
+
...defaultThemeConfig.input,
|
|
1696
|
+
...theme.sanity.input,
|
|
1697
|
+
checkbox: {
|
|
1698
|
+
...defaultThemeConfig.input.checkbox,
|
|
1699
|
+
...theme.sanity.input.checkbox
|
|
1700
|
+
},
|
|
1701
|
+
radio: {
|
|
1702
|
+
...defaultThemeConfig.input.radio,
|
|
1703
|
+
...theme.sanity.input.radio
|
|
1704
|
+
},
|
|
1705
|
+
switch: {
|
|
1706
|
+
...defaultThemeConfig.input.switch,
|
|
1707
|
+
...theme.sanity.input.switch
|
|
1708
|
+
}
|
|
1709
|
+
},
|
|
1692
1710
|
layer: (_a = theme.sanity.layer) != null ? _a : defaultThemeConfig.layer,
|
|
1693
1711
|
media: theme.sanity.media,
|
|
1694
1712
|
radius: theme.sanity.radius,
|
|
@@ -1728,7 +1746,10 @@ function v0_v2(v0) {
|
|
|
1728
1746
|
} = v0;
|
|
1729
1747
|
const v2 = {
|
|
1730
1748
|
_version: 2,
|
|
1731
|
-
avatar
|
|
1749
|
+
avatar: {
|
|
1750
|
+
...defaultThemeConfig.avatar,
|
|
1751
|
+
...avatar
|
|
1752
|
+
},
|
|
1732
1753
|
button: {
|
|
1733
1754
|
...defaultThemeConfig.button,
|
|
1734
1755
|
...button
|
|
@@ -1754,7 +1775,22 @@ function v0_v2(v0) {
|
|
|
1754
1775
|
},
|
|
1755
1776
|
container,
|
|
1756
1777
|
font,
|
|
1757
|
-
input
|
|
1778
|
+
input: {
|
|
1779
|
+
...defaultThemeConfig.input,
|
|
1780
|
+
...input,
|
|
1781
|
+
checkbox: {
|
|
1782
|
+
...defaultThemeConfig.input.checkbox,
|
|
1783
|
+
...input.checkbox
|
|
1784
|
+
},
|
|
1785
|
+
radio: {
|
|
1786
|
+
...defaultThemeConfig.input.radio,
|
|
1787
|
+
...input.radio
|
|
1788
|
+
},
|
|
1789
|
+
switch: {
|
|
1790
|
+
...defaultThemeConfig.input.switch,
|
|
1791
|
+
...input.switch
|
|
1792
|
+
}
|
|
1793
|
+
},
|
|
1758
1794
|
layer: layer != null ? layer : defaultThemeConfig.layer,
|
|
1759
1795
|
media,
|
|
1760
1796
|
radius,
|
|
@@ -4240,9 +4276,14 @@ function buildTheme(config) {
|
|
|
4240
4276
|
avatar: (_a = config == null ? void 0 : config.avatar) != null ? _a : defaultThemeConfig.avatar,
|
|
4241
4277
|
button: (_b = config == null ? void 0 : config.button) != null ? _b : defaultThemeConfig.button,
|
|
4242
4278
|
card: (_c = config == null ? void 0 : config.card) != null ? _c : defaultThemeConfig.card,
|
|
4279
|
+
// How colors are generated:
|
|
4280
|
+
// 1. Merge custom tokens with default tokens
|
|
4281
|
+
// 2. Generate tree of color keys (gray/500, black, white, etc.)
|
|
4282
|
+
// 3. Apply mixing and render to hex values
|
|
4283
|
+
// render(build(mergeWithDefaults()))
|
|
4243
4284
|
color: renderThemeColorSchemes(colorTheme, config),
|
|
4244
4285
|
container: (_d = config == null ? void 0 : config.container) != null ? _d : defaultThemeConfig.container,
|
|
4245
|
-
font: (_e = config == null ? void 0 : config.
|
|
4286
|
+
font: (_e = config == null ? void 0 : config.font) != null ? _e : defaultThemeFonts,
|
|
4246
4287
|
input: (_f = config == null ? void 0 : config.input) != null ? _f : defaultThemeConfig.input,
|
|
4247
4288
|
layer: (_g = config == null ? void 0 : config.layer) != null ? _g : defaultThemeConfig.layer,
|
|
4248
4289
|
media: (_h = config == null ? void 0 : config.media) != null ? _h : defaultThemeConfig.media,
|