@sanity/ui 3.0.0-static.36 → 3.0.0-static.38
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/css/index.cjs +3 -3
- package/dist/css/index.cjs.map +1 -1
- package/dist/css/index.d.cts +9 -2
- package/dist/css/index.d.ts +9 -2
- package/dist/css/index.js +3 -3
- package/dist/css/index.js.map +1 -1
- package/dist/theme.cjs +1 -1
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +1 -3
- package/dist/theme.d.ts +1 -3
- package/dist/theme.js +1 -1
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
- package/src/css/index.ts +1 -1
- package/src/css/theme/{buildCSSThemeTokens.ts → buildCSSTheme.ts} +8 -4
- package/src/css/theme/defaultTheme.css.ts +2 -2
- package/src/theme/buildTheme.ts +1 -2
- package/src/theme/types.ts +1 -3
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type CardTone,
|
|
11
11
|
COLOR_VARIANTS,
|
|
12
12
|
type ColorScheme,
|
|
13
|
+
type ColorTokens,
|
|
13
14
|
type ColorValue,
|
|
14
15
|
type ColorVariant,
|
|
15
16
|
CONTAINER_SCALE,
|
|
@@ -21,16 +22,17 @@ import {
|
|
|
21
22
|
FONT_TEXT_SIZE,
|
|
22
23
|
type Hue,
|
|
23
24
|
HUES,
|
|
25
|
+
type PartialTokens,
|
|
24
26
|
RADIUS,
|
|
25
27
|
SHADOW,
|
|
26
28
|
SPACE,
|
|
27
29
|
type Theme,
|
|
28
|
-
type ThemeOptions,
|
|
29
30
|
TINTS,
|
|
30
31
|
} from '@sanity/ui/theme'
|
|
31
32
|
|
|
32
33
|
import {_fromEntries} from '../_fromEntries'
|
|
33
34
|
import type {
|
|
35
|
+
ColorPaletteTokens,
|
|
34
36
|
CSSCardColorTokens,
|
|
35
37
|
ElementColorTokens,
|
|
36
38
|
SchemeColorTokens,
|
|
@@ -40,7 +42,10 @@ import type {
|
|
|
40
42
|
import {paletteVars} from '../vars.css'
|
|
41
43
|
|
|
42
44
|
/** @public */
|
|
43
|
-
export
|
|
45
|
+
export type CSSThemeOptions = {color?: PartialTokens<ColorTokens>; palette?: ColorPaletteTokens}
|
|
46
|
+
|
|
47
|
+
/** @public */
|
|
48
|
+
export function buildCSSTheme(options?: CSSThemeOptions): ThemeTokens {
|
|
44
49
|
const theme = buildTheme(options)
|
|
45
50
|
|
|
46
51
|
return {
|
|
@@ -79,14 +84,13 @@ export function buildCSSThemeTokens(options?: ThemeOptions): ThemeTokens {
|
|
|
79
84
|
..._fromEntries(CONTAINER_SCALE.map((s) => [s, rem(theme.container[s])])),
|
|
80
85
|
},
|
|
81
86
|
color: {
|
|
82
|
-
palette: {
|
|
87
|
+
palette: options?.palette ?? {
|
|
83
88
|
black: black.hex,
|
|
84
89
|
white: white.hex,
|
|
85
90
|
..._fromEntries(
|
|
86
91
|
HUES.map((h) => [h, {..._fromEntries(TINTS.map((t) => [t, hues[h][t].hex]))}]),
|
|
87
92
|
),
|
|
88
93
|
},
|
|
89
|
-
|
|
90
94
|
light: renderColorScheme({theme, scheme: 'light'}),
|
|
91
95
|
dark: renderColorScheme({theme, scheme: 'dark'}),
|
|
92
96
|
},
|
|
@@ -2,7 +2,7 @@ import {createTheme, globalFontFace} from '@vanilla-extract/css'
|
|
|
2
2
|
|
|
3
3
|
import {layers} from '../layers.css'
|
|
4
4
|
import {themeVars} from '../vars.css'
|
|
5
|
-
import {
|
|
5
|
+
import {buildCSSTheme} from './buildCSSTheme'
|
|
6
6
|
|
|
7
7
|
const fontDisplay: FontDisplay = 'swap'
|
|
8
8
|
|
|
@@ -60,5 +60,5 @@ globalFontFace('Inter', [
|
|
|
60
60
|
/** @public */
|
|
61
61
|
export const themeClassName: string = createTheme(themeVars, {
|
|
62
62
|
'@layer': layers.theme,
|
|
63
|
-
...
|
|
63
|
+
...buildCSSTheme(),
|
|
64
64
|
})
|
package/src/theme/buildTheme.ts
CHANGED
|
@@ -9,8 +9,7 @@ import type {Theme, ThemeOptions} from './types'
|
|
|
9
9
|
/** @public */
|
|
10
10
|
export function buildTheme(options?: ThemeOptions): Theme {
|
|
11
11
|
const tokens = resolveTokens({
|
|
12
|
-
|
|
13
|
-
color: options?.tokens?.color ?? defaultColor,
|
|
12
|
+
color: options?.color ?? defaultColor,
|
|
14
13
|
})
|
|
15
14
|
|
|
16
15
|
return {
|
package/src/theme/types.ts
CHANGED
|
@@ -302,9 +302,7 @@ export type FontTextSize = (typeof FONT_TEXT_SIZE)[number]
|
|
|
302
302
|
export type Shadow = (typeof SHADOW)[number]
|
|
303
303
|
|
|
304
304
|
/** @public */
|
|
305
|
-
export
|
|
306
|
-
tokens?: PartialTokens<Tokens>
|
|
307
|
-
}
|
|
305
|
+
export type ThemeOptions = PartialTokens<Tokens>
|
|
308
306
|
|
|
309
307
|
/** @public */
|
|
310
308
|
export interface Palette {
|