@sanity/ui 2.0.0-alpha.1 → 2.0.0-alpha.10
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/index.cjs.mjs +3 -0
- package/dist/index.d.ts +309 -411
- package/dist/index.esm.js +5098 -2428
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5230 -2557
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/dialog/constants.ts +4 -0
- package/src/components/dialog/dialog.tsx +86 -24
- package/src/components/dialog/styles.ts +3 -4
- package/src/components/menu/__workshop__/closableMenuButton.tsx +2 -2
- package/src/components/menu/menuDivider.ts +2 -1
- package/src/components/menu/menuGroup.tsx +22 -23
- package/src/components/menu/menuItem.tsx +31 -37
- package/src/components/skeleton/styles.ts +8 -7
- package/src/components/tree/style.ts +19 -20
- package/src/primitives/_selectable/style.ts +25 -22
- package/src/primitives/avatar/avatar.tsx +8 -3
- package/src/primitives/avatar/avatarCounter.tsx +5 -4
- package/src/primitives/avatar/spotColors.ts +53 -0
- package/src/primitives/avatar/styles.ts +5 -7
- package/src/primitives/avatar/types.ts +14 -0
- package/src/primitives/badge/badge.tsx +5 -3
- package/src/primitives/badge/styles.ts +7 -8
- package/src/primitives/box/__workshop__/responsive.tsx +2 -2
- package/src/primitives/button/button.tsx +2 -2
- package/src/primitives/button/styles.ts +82 -16
- package/src/primitives/card/__workshop__/selected.tsx +8 -9
- package/src/primitives/card/card.tsx +43 -7
- package/src/primitives/card/styles.ts +30 -22
- package/src/primitives/card/types.ts +3 -1
- package/src/primitives/checkbox/styles.ts +20 -20
- package/src/primitives/code/code.tsx +15 -3
- package/src/primitives/code/styles.ts +51 -42
- package/src/primitives/heading/styles.ts +6 -5
- package/src/primitives/kbd/kbd.tsx +2 -1
- package/src/primitives/label/styles.ts +3 -2
- package/src/primitives/popover/popoverArrow.tsx +3 -2
- package/src/primitives/popover/popoverCard.tsx +6 -2
- package/src/primitives/radio/styles.ts +15 -15
- package/src/primitives/select/styles.ts +20 -22
- package/src/primitives/switch/styles.ts +13 -13
- package/src/primitives/text/__workshop__/colored.tsx +10 -11
- package/src/primitives/text/styles.ts +10 -9
- package/src/primitives/textArea/textArea.tsx +8 -12
- package/src/primitives/textInput/textInput.tsx +13 -13
- package/src/primitives/tooltip/__workshop__/props.tsx +20 -3
- package/src/primitives/tooltip/tooltipArrow.tsx +3 -2
- package/src/styles/border/borderStyle.ts +2 -1
- package/src/styles/colorVars/colorVarsStyle.ts +73 -32
- package/src/styles/focusRing/index.ts +6 -4
- package/src/styles/input/textInputStyle.ts +76 -93
- package/src/styles/margin/marginsStyle.test.ts +1 -2
- package/src/styles/padding/paddingStyle.test.ts +1 -2
- package/src/styles/shadow/shadowStyle.ts +5 -5
- package/src/theme/__workshop__/color.tsx +2 -2
- package/src/theme/__workshop__/index.ts +0 -5
- package/src/theme/lib/color-fns/blend/multiply.ts +2 -2
- package/src/theme/lib/color-fns/blend/screen.ts +2 -2
- package/src/theme/lib/color-fns/convert.ts +15 -1
- package/src/theme/lib/color-fns/parse.ts +7 -3
- package/src/theme/lib/color-fns/types.ts +11 -0
- package/src/theme/lib/theme/color/_legacy/createColorTheme.ts +7 -0
- package/src/theme/lib/theme/color/_legacy/index.ts +1 -0
- package/src/theme/lib/theme/color/_legacy/legacyColor.ts +3997 -0
- package/src/theme/lib/theme/color/cssVariables/cardVariables.ts +88 -0
- package/src/theme/lib/theme/color/cssVariables/createCssVars.ts +31 -0
- package/src/theme/lib/theme/color/cssVariables/cssVars.test.ts +262 -0
- package/src/theme/lib/theme/color/cssVariables/index.ts +1 -0
- package/src/theme/lib/theme/color/cssVariables/tints.ts +312 -0
- package/src/theme/lib/theme/color/cssVariables/tones.ts +67 -0
- package/src/theme/lib/theme/color/cssVariables/utils.test.ts +15 -0
- package/src/theme/lib/theme/color/cssVariables/utils.ts +9 -0
- package/src/theme/lib/theme/color/index.ts +3 -12
- package/src/theme/lib/theme/color/types.ts +6 -37
- package/src/theme/lib/theme/theme.ts +9 -4
- package/src/theme/studioTheme/color.ts +2 -641
- package/src/theme/studioTheme/helpers.ts +15 -1
- package/src/theme/studioTheme/theme.ts +13 -3
- package/src/theme/themeColorProvider.tsx +2 -0
- package/src/theme/themeProvider.tsx +28 -8
- package/src/theme/toneContext/toneContext.ts +12 -0
- package/src/theme/toneContext/toneProvider.tsx +31 -0
- package/src/theme/toneContext/types.ts +10 -0
- package/src/theme/toneContext/useToneContext.tsx +26 -0
- package/src/theme/types.ts +2 -4
- package/src/utils/elementQuery/__workshop__/customMedia.tsx +4 -3
- package/src/theme/__workshop__/canvas.tsx +0 -395
- package/src/theme/lib/theme/color/_generic/index.ts +0 -1
- package/src/theme/lib/theme/color/_generic/types.ts +0 -30
- package/src/theme/lib/theme/color/base/index.ts +0 -1
- package/src/theme/lib/theme/color/base/types.ts +0 -19
- package/src/theme/lib/theme/color/button/createButtonModes.ts +0 -20
- package/src/theme/lib/theme/color/button/createButtonTones.ts +0 -52
- package/src/theme/lib/theme/color/button/index.ts +0 -1
- package/src/theme/lib/theme/color/button/types.ts +0 -44
- package/src/theme/lib/theme/color/card/createCardStates.ts +0 -58
- package/src/theme/lib/theme/color/card/index.ts +0 -1
- package/src/theme/lib/theme/color/card/types.ts +0 -18
- package/src/theme/lib/theme/color/color.test.ts +0 -63
- package/src/theme/lib/theme/color/defaults.ts +0 -390
- package/src/theme/lib/theme/color/factory.ts +0 -138
- package/src/theme/lib/theme/color/input/createInputModes.ts +0 -84
- package/src/theme/lib/theme/color/input/index.ts +0 -1
- package/src/theme/lib/theme/color/input/types.ts +0 -28
- package/src/theme/lib/theme/color/muted/createMuted.ts +0 -56
- package/src/theme/lib/theme/color/muted/index.ts +0 -1
- package/src/theme/lib/theme/color/muted/types.ts +0 -24
- package/src/theme/lib/theme/color/selectable/createSelectableTones.ts +0 -73
- package/src/theme/lib/theme/color/selectable/index.ts +0 -1
- package/src/theme/lib/theme/color/selectable/types.ts +0 -29
- package/src/theme/lib/theme/color/solid/createSolidTones.ts +0 -56
- package/src/theme/lib/theme/color/solid/index.ts +0 -1
- package/src/theme/lib/theme/color/solid/types.ts +0 -24
- package/src/theme/lib/theme/color/spot/createSpot.ts +0 -21
- package/src/theme/lib/theme/color/spot/index.ts +0 -1
- package/src/theme/lib/theme/color/spot/types.ts +0 -28
- package/src/theme/lib/theme/color/syntax/index.ts +0 -1
- package/src/theme/lib/theme/color/syntax/types.ts +0 -41
- package/src/theme/studioTheme/tints.ts +0 -152
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import {ThemeColorBase} from '../base'
|
|
2
|
-
import {ThemeColorBuilderOpts} from '../factory'
|
|
3
|
-
import {ThemeColorMuted} from '../muted'
|
|
4
|
-
import {ThemeColorSolid} from '../solid'
|
|
5
|
-
import {ThemeColorButtonModeKey, ThemeColorButtonTones} from './types'
|
|
6
|
-
|
|
7
|
-
export function createButtonTones(
|
|
8
|
-
opts: ThemeColorBuilderOpts,
|
|
9
|
-
base: ThemeColorBase,
|
|
10
|
-
dark: boolean,
|
|
11
|
-
solid: ThemeColorSolid,
|
|
12
|
-
muted: ThemeColorMuted,
|
|
13
|
-
mode: ThemeColorButtonModeKey,
|
|
14
|
-
): ThemeColorButtonTones {
|
|
15
|
-
return {
|
|
16
|
-
default: opts.button({
|
|
17
|
-
base,
|
|
18
|
-
dark,
|
|
19
|
-
solid: solid.default,
|
|
20
|
-
muted: muted.default,
|
|
21
|
-
mode,
|
|
22
|
-
}),
|
|
23
|
-
primary: opts.button({
|
|
24
|
-
base,
|
|
25
|
-
dark,
|
|
26
|
-
solid: solid.primary,
|
|
27
|
-
muted: muted.primary,
|
|
28
|
-
mode,
|
|
29
|
-
}),
|
|
30
|
-
positive: opts.button({
|
|
31
|
-
base,
|
|
32
|
-
dark,
|
|
33
|
-
solid: solid.positive,
|
|
34
|
-
muted: muted.positive,
|
|
35
|
-
mode,
|
|
36
|
-
}),
|
|
37
|
-
caution: opts.button({
|
|
38
|
-
base,
|
|
39
|
-
dark,
|
|
40
|
-
solid: solid.caution,
|
|
41
|
-
muted: muted.caution,
|
|
42
|
-
mode,
|
|
43
|
-
}),
|
|
44
|
-
critical: opts.button({
|
|
45
|
-
base,
|
|
46
|
-
dark,
|
|
47
|
-
solid: solid.critical,
|
|
48
|
-
muted: muted.critical,
|
|
49
|
-
mode,
|
|
50
|
-
}),
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types'
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import {ThemeColorGenericState} from '../_generic'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export type ThemeColorButtonModeKey = 'default' | 'ghost' | 'bleed'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Use `ThemeColorGenericState` instead.
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export type ThemeColorButtonState = ThemeColorGenericState
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export interface ThemeColorButtonStates {
|
|
18
|
-
enabled: ThemeColorButtonState
|
|
19
|
-
hovered: ThemeColorButtonState
|
|
20
|
-
pressed: ThemeColorButtonState
|
|
21
|
-
selected: ThemeColorButtonState
|
|
22
|
-
disabled: ThemeColorButtonState
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* TODO: Rename to `ThemeColorButtonMode`.
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
export interface ThemeColorButtonTones {
|
|
30
|
-
default: ThemeColorButtonStates
|
|
31
|
-
primary: ThemeColorButtonStates
|
|
32
|
-
positive: ThemeColorButtonStates
|
|
33
|
-
caution: ThemeColorButtonStates
|
|
34
|
-
critical: ThemeColorButtonStates
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
40
|
-
export interface ThemeColorButton {
|
|
41
|
-
default: ThemeColorButtonTones
|
|
42
|
-
ghost: ThemeColorButtonTones
|
|
43
|
-
bleed: ThemeColorButtonTones
|
|
44
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import {ThemeColorBase} from '../base'
|
|
2
|
-
import {ThemeColorBuilderOpts} from '../factory'
|
|
3
|
-
import {ThemeColorMuted} from '../muted'
|
|
4
|
-
import {ThemeColorSolid} from '../solid'
|
|
5
|
-
import {ThemeColorName} from '../types'
|
|
6
|
-
import {ThemeColorCard} from './types'
|
|
7
|
-
|
|
8
|
-
export function createCardStates(
|
|
9
|
-
opts: ThemeColorBuilderOpts,
|
|
10
|
-
base: ThemeColorBase,
|
|
11
|
-
dark: boolean,
|
|
12
|
-
name: ThemeColorName,
|
|
13
|
-
solid: ThemeColorSolid,
|
|
14
|
-
muted: ThemeColorMuted,
|
|
15
|
-
): ThemeColorCard {
|
|
16
|
-
return {
|
|
17
|
-
enabled: opts.card({
|
|
18
|
-
base,
|
|
19
|
-
dark,
|
|
20
|
-
name,
|
|
21
|
-
state: 'enabled',
|
|
22
|
-
solid,
|
|
23
|
-
muted,
|
|
24
|
-
}),
|
|
25
|
-
disabled: opts.card({
|
|
26
|
-
base,
|
|
27
|
-
dark,
|
|
28
|
-
name,
|
|
29
|
-
state: 'disabled',
|
|
30
|
-
solid,
|
|
31
|
-
muted,
|
|
32
|
-
}),
|
|
33
|
-
hovered: opts.card({
|
|
34
|
-
base,
|
|
35
|
-
dark,
|
|
36
|
-
name,
|
|
37
|
-
state: 'hovered',
|
|
38
|
-
solid,
|
|
39
|
-
muted,
|
|
40
|
-
}),
|
|
41
|
-
pressed: opts.card({
|
|
42
|
-
base,
|
|
43
|
-
dark,
|
|
44
|
-
name,
|
|
45
|
-
state: 'pressed',
|
|
46
|
-
solid,
|
|
47
|
-
muted,
|
|
48
|
-
}),
|
|
49
|
-
selected: opts.card({
|
|
50
|
-
base,
|
|
51
|
-
dark,
|
|
52
|
-
name,
|
|
53
|
-
state: 'selected',
|
|
54
|
-
solid,
|
|
55
|
-
muted,
|
|
56
|
-
}),
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types'
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {ThemeColorGenericState} from '../_generic'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Use `ThemeColorGenericState` instead.
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export type ThemeColorCardState = ThemeColorGenericState
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export interface ThemeColorCard {
|
|
13
|
-
enabled: ThemeColorCardState
|
|
14
|
-
hovered: ThemeColorCardState
|
|
15
|
-
pressed: ThemeColorCardState
|
|
16
|
-
selected: ThemeColorCardState
|
|
17
|
-
disabled: ThemeColorCardState
|
|
18
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/** @jest-environment jsdom */
|
|
2
|
-
|
|
3
|
-
import {createColorTheme} from './factory'
|
|
4
|
-
|
|
5
|
-
describe('color', () => {
|
|
6
|
-
describe('createColorTheme', () => {
|
|
7
|
-
it('should generate base (scheme=light, name=default)', () => {
|
|
8
|
-
const theme = createColorTheme()
|
|
9
|
-
const scheme = 'light'
|
|
10
|
-
const name = 'default'
|
|
11
|
-
const color = theme[scheme][name]
|
|
12
|
-
|
|
13
|
-
expect(color.base).toEqual({
|
|
14
|
-
bg: 'hsl(0, 0%, 100%)',
|
|
15
|
-
border: 'hsl(0, 0%, 95%)',
|
|
16
|
-
fg: 'hsl(0, 0%, 0%)',
|
|
17
|
-
focusRing: 'hsl(240, 100%, 50%)',
|
|
18
|
-
shadow: {
|
|
19
|
-
ambient: 'hsl(0, 0%, 0%)',
|
|
20
|
-
outline: 'hsl(0, 0%, 0%)',
|
|
21
|
-
penumbra: 'hsl(0, 0%, 0%)',
|
|
22
|
-
umbra: 'hsl(0, 0%, 0%)',
|
|
23
|
-
},
|
|
24
|
-
skeleton: {
|
|
25
|
-
from: 'hsl(0, 0%, 0%)',
|
|
26
|
-
to: 'hsl(0, 0%, 0%)',
|
|
27
|
-
},
|
|
28
|
-
})
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('should generate muted states (scheme=light, name=default)', () => {
|
|
32
|
-
const theme = createColorTheme()
|
|
33
|
-
const scheme = 'light'
|
|
34
|
-
const name = 'default'
|
|
35
|
-
const color = theme[scheme][name]
|
|
36
|
-
|
|
37
|
-
expect(color.muted.default.enabled).toEqual({
|
|
38
|
-
bg: 'hsl(0, 0%, 95%)',
|
|
39
|
-
bg2: 'hsl(0, 0%, 95%)',
|
|
40
|
-
border: 'hsl(0, 0%, 70%)',
|
|
41
|
-
fg: 'hsl(0, 0%, 20%)',
|
|
42
|
-
iconColor: 'hsl(0, 0%, 20%)',
|
|
43
|
-
muted: {
|
|
44
|
-
fg: 'hsl(0, 0%, 0%)',
|
|
45
|
-
},
|
|
46
|
-
link: {
|
|
47
|
-
fg: 'hsl(0, 0%, 0%)',
|
|
48
|
-
},
|
|
49
|
-
accent: {
|
|
50
|
-
fg: 'hsl(0, 0%, 0%)',
|
|
51
|
-
},
|
|
52
|
-
code: {
|
|
53
|
-
bg: 'hsl(0, 0%, 0%)',
|
|
54
|
-
fg: 'hsl(0, 0%, 0%)',
|
|
55
|
-
},
|
|
56
|
-
skeleton: {
|
|
57
|
-
from: 'hsl(0, 0%, 0%)',
|
|
58
|
-
to: 'hsl(0, 0%, 0%)',
|
|
59
|
-
},
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
})
|
|
63
|
-
})
|
|
@@ -1,390 +0,0 @@
|
|
|
1
|
-
import {ThemeColorBuilderOpts} from './factory'
|
|
2
|
-
|
|
3
|
-
const black = 'hsl(0, 0%, 0%)'
|
|
4
|
-
const white = 'hsl(0, 0%, 100%)'
|
|
5
|
-
|
|
6
|
-
const colors = {
|
|
7
|
-
default: {
|
|
8
|
-
lightest: 'hsl(0, 0%, 95%)',
|
|
9
|
-
lighter: 'hsl(0, 0%, 70%)',
|
|
10
|
-
light: 'hsl(0, 0%, 65%)',
|
|
11
|
-
base: 'hsl(0, 0%, 50%)',
|
|
12
|
-
dark: 'hsl(0, 0%, 35%)',
|
|
13
|
-
darker: 'hsl(0, 0%, 20%)',
|
|
14
|
-
darkest: 'hsl(0, 0%, 5%)',
|
|
15
|
-
},
|
|
16
|
-
transparent: {
|
|
17
|
-
lightest: 'hsl(240, 100%, 95%)',
|
|
18
|
-
lighter: 'hsl(240, 100%, 70%)',
|
|
19
|
-
light: 'hsl(240, 100%, 65%)',
|
|
20
|
-
base: 'hsl(240, 100%, 50%)',
|
|
21
|
-
dark: 'hsl(240, 100%, 35%)',
|
|
22
|
-
darker: 'hsl(240, 100%, 20%)',
|
|
23
|
-
darkest: 'hsl(240, 100%, 5%)',
|
|
24
|
-
},
|
|
25
|
-
primary: {
|
|
26
|
-
lightest: 'hsl(240, 100%, 95%)',
|
|
27
|
-
lighter: 'hsl(240, 100%, 70%)',
|
|
28
|
-
light: 'hsl(240, 100%, 65%)',
|
|
29
|
-
base: 'hsl(240, 100%, 50%)',
|
|
30
|
-
dark: 'hsl(240, 100%, 35%)',
|
|
31
|
-
darker: 'hsl(240, 100%, 20%)',
|
|
32
|
-
darkest: 'hsl(240, 100%, 5%)',
|
|
33
|
-
},
|
|
34
|
-
positive: {
|
|
35
|
-
lightest: 'hsl(120, 100%, 95%)',
|
|
36
|
-
lighter: 'hsl(120, 100%, 70%)',
|
|
37
|
-
light: 'hsl(120, 100%, 65%)',
|
|
38
|
-
base: 'hsl(120, 100%, 50%)',
|
|
39
|
-
dark: 'hsl(120, 100%, 35%)',
|
|
40
|
-
darker: 'hsl(120, 100%, 20%)',
|
|
41
|
-
darkest: 'hsl(120, 100%, 5%)',
|
|
42
|
-
},
|
|
43
|
-
caution: {
|
|
44
|
-
lightest: 'hsl(60, 100%, 95%)',
|
|
45
|
-
lighter: 'hsl(60, 100%, 70%)',
|
|
46
|
-
light: 'hsl(60, 100%, 65%)',
|
|
47
|
-
base: 'hsl(60, 100%, 50%)',
|
|
48
|
-
dark: 'hsl(60, 100%, 35%)',
|
|
49
|
-
darker: 'hsl(60, 100%, 20%)',
|
|
50
|
-
darkest: 'hsl(60, 100%, 5%)',
|
|
51
|
-
},
|
|
52
|
-
critical: {
|
|
53
|
-
lightest: 'hsl(0, 100%, 95%)',
|
|
54
|
-
lighter: 'hsl(0, 100%, 70%)',
|
|
55
|
-
light: 'hsl(0, 100%, 65%)',
|
|
56
|
-
base: 'hsl(0, 100%, 50%)',
|
|
57
|
-
dark: 'hsl(0, 100%, 35%)',
|
|
58
|
-
darker: 'hsl(0, 100%, 20%)',
|
|
59
|
-
darkest: 'hsl(0, 100%, 5%)',
|
|
60
|
-
},
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const spots = {
|
|
64
|
-
gray: 'hsl(0, 0%, 50%)',
|
|
65
|
-
red: 'hsl(0, 100%, 50%)',
|
|
66
|
-
orange: 'hsl(30, 100%, 50%)',
|
|
67
|
-
yellow: 'hsl(60, 100%, 50%)',
|
|
68
|
-
green: 'hsl(120, 100%, 50%)',
|
|
69
|
-
cyan: 'hsl(180, 100%, 50%)',
|
|
70
|
-
blue: 'hsl(240, 100%, 50%)',
|
|
71
|
-
purple: 'hsl(270, 100%, 50%)',
|
|
72
|
-
magenta: 'hsl(300, 100%, 50%)',
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const tones = {
|
|
76
|
-
transparent: {
|
|
77
|
-
bg: [colors.transparent.darkest, colors.transparent.lightest],
|
|
78
|
-
fg: [colors.transparent.lightest, colors.transparent.darkest],
|
|
79
|
-
border: [colors.transparent.darker, colors.transparent.lighter],
|
|
80
|
-
focusRing: [colors.transparent.base, colors.transparent.base],
|
|
81
|
-
},
|
|
82
|
-
primary: {
|
|
83
|
-
bg: [colors.primary.darkest, colors.primary.lightest],
|
|
84
|
-
fg: [colors.primary.lightest, colors.primary.darkest],
|
|
85
|
-
border: [colors.primary.darker, colors.primary.lighter],
|
|
86
|
-
focusRing: [colors.primary.base, colors.primary.base],
|
|
87
|
-
},
|
|
88
|
-
positive: {
|
|
89
|
-
bg: [colors.positive.darkest, colors.positive.lightest],
|
|
90
|
-
fg: [colors.positive.lightest, colors.positive.darkest],
|
|
91
|
-
border: [colors.positive.darker, colors.positive.lighter],
|
|
92
|
-
focusRing: [colors.positive.base, colors.positive.base],
|
|
93
|
-
},
|
|
94
|
-
caution: {
|
|
95
|
-
bg: [colors.caution.darkest, colors.caution.lightest],
|
|
96
|
-
fg: [colors.caution.lightest, colors.caution.darkest],
|
|
97
|
-
border: [colors.caution.darker, colors.caution.lighter],
|
|
98
|
-
focusRing: [colors.caution.base, colors.caution.base],
|
|
99
|
-
},
|
|
100
|
-
critical: {
|
|
101
|
-
bg: [colors.critical.darkest, colors.critical.lightest],
|
|
102
|
-
fg: [colors.critical.lightest, colors.critical.darkest],
|
|
103
|
-
border: [colors.critical.darker, colors.critical.lighter],
|
|
104
|
-
focusRing: [colors.critical.base, colors.critical.base],
|
|
105
|
-
},
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export const defaultOpts: ThemeColorBuilderOpts = {
|
|
109
|
-
base: ({dark, name}) => {
|
|
110
|
-
if (name === 'default') {
|
|
111
|
-
return {
|
|
112
|
-
bg: dark ? black : white,
|
|
113
|
-
fg: dark ? white : black,
|
|
114
|
-
border: dark ? colors.default.darkest : colors.default.lightest,
|
|
115
|
-
focusRing: colors.primary.base,
|
|
116
|
-
shadow: {
|
|
117
|
-
outline: black,
|
|
118
|
-
umbra: black,
|
|
119
|
-
penumbra: black,
|
|
120
|
-
ambient: black,
|
|
121
|
-
},
|
|
122
|
-
skeleton: {
|
|
123
|
-
from: dark ? white : black,
|
|
124
|
-
to: dark ? white : black,
|
|
125
|
-
},
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Variants:
|
|
130
|
-
// - primary
|
|
131
|
-
// - positive
|
|
132
|
-
// - caution
|
|
133
|
-
// - critical
|
|
134
|
-
return {
|
|
135
|
-
bg: tones[name].bg[dark ? 0 : 1],
|
|
136
|
-
fg: tones[name].fg[dark ? 0 : 1],
|
|
137
|
-
border: tones[name].border[dark ? 0 : 1],
|
|
138
|
-
focusRing: tones[name].focusRing[dark ? 0 : 1],
|
|
139
|
-
shadow: {
|
|
140
|
-
outline: black,
|
|
141
|
-
umbra: black,
|
|
142
|
-
penumbra: black,
|
|
143
|
-
ambient: black,
|
|
144
|
-
},
|
|
145
|
-
skeleton: {
|
|
146
|
-
from: dark ? white : black,
|
|
147
|
-
to: dark ? white : black,
|
|
148
|
-
},
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
solid: ({base, dark, state, tone}) => {
|
|
153
|
-
const color = colors[tone]
|
|
154
|
-
|
|
155
|
-
if (state === 'hovered') {
|
|
156
|
-
return {
|
|
157
|
-
bg: dark ? color.light : color.dark,
|
|
158
|
-
bg2: dark ? color.light : color.dark,
|
|
159
|
-
border: dark ? color.lighter : color.darker,
|
|
160
|
-
fg: dark ? color.darkest : color.lightest,
|
|
161
|
-
iconColor: dark ? color.darkest : color.lightest,
|
|
162
|
-
muted: {
|
|
163
|
-
fg: black,
|
|
164
|
-
},
|
|
165
|
-
accent: {
|
|
166
|
-
fg: black,
|
|
167
|
-
},
|
|
168
|
-
link: {
|
|
169
|
-
fg: black,
|
|
170
|
-
},
|
|
171
|
-
code: {
|
|
172
|
-
bg: black,
|
|
173
|
-
fg: black,
|
|
174
|
-
},
|
|
175
|
-
skeleton: base.skeleton,
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return {
|
|
180
|
-
bg: color.base,
|
|
181
|
-
bg2: color.base,
|
|
182
|
-
border: dark ? color.light : color.dark,
|
|
183
|
-
fg: dark ? color.darkest : color.lightest,
|
|
184
|
-
iconColor: dark ? color.darkest : color.lightest,
|
|
185
|
-
muted: {
|
|
186
|
-
fg: black,
|
|
187
|
-
},
|
|
188
|
-
accent: {
|
|
189
|
-
fg: black,
|
|
190
|
-
},
|
|
191
|
-
link: {
|
|
192
|
-
fg: black,
|
|
193
|
-
},
|
|
194
|
-
code: {
|
|
195
|
-
bg: black,
|
|
196
|
-
fg: black,
|
|
197
|
-
},
|
|
198
|
-
skeleton: base.skeleton,
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
muted: ({base, dark, state, tone}) => {
|
|
203
|
-
const color = colors[tone]
|
|
204
|
-
|
|
205
|
-
if (state === 'hovered') {
|
|
206
|
-
return {
|
|
207
|
-
bg: dark ? color.darker : color.lighter,
|
|
208
|
-
bg2: dark ? color.darker : color.lighter,
|
|
209
|
-
border: dark ? color.lighter : color.darker,
|
|
210
|
-
fg: dark ? color.lightest : color.darkest,
|
|
211
|
-
iconColor: dark ? color.lightest : color.darkest,
|
|
212
|
-
muted: {
|
|
213
|
-
fg: black,
|
|
214
|
-
},
|
|
215
|
-
accent: {
|
|
216
|
-
fg: black,
|
|
217
|
-
},
|
|
218
|
-
link: {
|
|
219
|
-
fg: black,
|
|
220
|
-
},
|
|
221
|
-
code: {
|
|
222
|
-
bg: black,
|
|
223
|
-
fg: black,
|
|
224
|
-
},
|
|
225
|
-
skeleton: base.skeleton,
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
return {
|
|
230
|
-
bg: dark ? color.darkest : color.lightest,
|
|
231
|
-
bg2: dark ? color.darkest : color.lightest,
|
|
232
|
-
border: dark ? color.darker : color.lighter,
|
|
233
|
-
fg: dark ? color.lighter : color.darker,
|
|
234
|
-
iconColor: dark ? color.lighter : color.darker,
|
|
235
|
-
muted: {
|
|
236
|
-
fg: black,
|
|
237
|
-
},
|
|
238
|
-
accent: {
|
|
239
|
-
fg: black,
|
|
240
|
-
},
|
|
241
|
-
link: {
|
|
242
|
-
fg: black,
|
|
243
|
-
},
|
|
244
|
-
code: {
|
|
245
|
-
bg: black,
|
|
246
|
-
fg: black,
|
|
247
|
-
},
|
|
248
|
-
skeleton: base.skeleton,
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
|
|
252
|
-
button: ({base, mode, muted, solid}) => {
|
|
253
|
-
if (mode === 'bleed') {
|
|
254
|
-
return {
|
|
255
|
-
...muted,
|
|
256
|
-
enabled: {
|
|
257
|
-
bg: 'transparent',
|
|
258
|
-
bg2: 'transparent',
|
|
259
|
-
fg: muted.enabled.fg,
|
|
260
|
-
iconColor: muted.enabled.fg,
|
|
261
|
-
border: 'transparent',
|
|
262
|
-
muted: {
|
|
263
|
-
fg: black,
|
|
264
|
-
},
|
|
265
|
-
accent: {
|
|
266
|
-
fg: black,
|
|
267
|
-
},
|
|
268
|
-
link: {
|
|
269
|
-
fg: black,
|
|
270
|
-
},
|
|
271
|
-
code: {
|
|
272
|
-
bg: black,
|
|
273
|
-
fg: black,
|
|
274
|
-
},
|
|
275
|
-
skeleton: base.skeleton,
|
|
276
|
-
},
|
|
277
|
-
hovered: {
|
|
278
|
-
bg: muted.enabled.bg,
|
|
279
|
-
bg2: muted.enabled.bg,
|
|
280
|
-
fg: muted.hovered.fg,
|
|
281
|
-
iconColor: muted.hovered.fg,
|
|
282
|
-
border: 'transparent',
|
|
283
|
-
muted: {
|
|
284
|
-
fg: black,
|
|
285
|
-
},
|
|
286
|
-
accent: {
|
|
287
|
-
fg: black,
|
|
288
|
-
},
|
|
289
|
-
link: {
|
|
290
|
-
fg: black,
|
|
291
|
-
},
|
|
292
|
-
code: {
|
|
293
|
-
bg: black,
|
|
294
|
-
fg: black,
|
|
295
|
-
},
|
|
296
|
-
skeleton: base.skeleton,
|
|
297
|
-
},
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (mode === 'ghost')
|
|
302
|
-
return {
|
|
303
|
-
...solid,
|
|
304
|
-
enabled: muted.enabled,
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
return solid
|
|
308
|
-
},
|
|
309
|
-
|
|
310
|
-
card: ({base}) => {
|
|
311
|
-
return {
|
|
312
|
-
bg: black,
|
|
313
|
-
bg2: black,
|
|
314
|
-
fg: black,
|
|
315
|
-
iconColor: black,
|
|
316
|
-
border: black,
|
|
317
|
-
muted: {
|
|
318
|
-
fg: black,
|
|
319
|
-
},
|
|
320
|
-
accent: {
|
|
321
|
-
fg: black,
|
|
322
|
-
},
|
|
323
|
-
link: {
|
|
324
|
-
fg: black,
|
|
325
|
-
},
|
|
326
|
-
code: {
|
|
327
|
-
bg: black,
|
|
328
|
-
fg: black,
|
|
329
|
-
},
|
|
330
|
-
skeleton: base.skeleton,
|
|
331
|
-
}
|
|
332
|
-
},
|
|
333
|
-
|
|
334
|
-
input: () => {
|
|
335
|
-
return {
|
|
336
|
-
bg: black,
|
|
337
|
-
bg2: black,
|
|
338
|
-
fg: black,
|
|
339
|
-
border: black,
|
|
340
|
-
placeholder: black,
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
|
|
344
|
-
selectable: ({muted, state, tone}) => {
|
|
345
|
-
return muted[tone][state]
|
|
346
|
-
},
|
|
347
|
-
|
|
348
|
-
spot: ({key}) => {
|
|
349
|
-
return spots[key]
|
|
350
|
-
},
|
|
351
|
-
|
|
352
|
-
syntax: () => ({
|
|
353
|
-
atrule: black,
|
|
354
|
-
attrName: black,
|
|
355
|
-
attrValue: black,
|
|
356
|
-
attribute: black,
|
|
357
|
-
boolean: black,
|
|
358
|
-
builtin: black,
|
|
359
|
-
cdata: black,
|
|
360
|
-
char: black,
|
|
361
|
-
class: black,
|
|
362
|
-
className: black,
|
|
363
|
-
comment: black,
|
|
364
|
-
constant: black,
|
|
365
|
-
deleted: black,
|
|
366
|
-
doctype: black,
|
|
367
|
-
entity: black,
|
|
368
|
-
function: black,
|
|
369
|
-
hexcode: black,
|
|
370
|
-
id: black,
|
|
371
|
-
important: black,
|
|
372
|
-
inserted: black,
|
|
373
|
-
keyword: black,
|
|
374
|
-
number: black,
|
|
375
|
-
operator: black,
|
|
376
|
-
prolog: black,
|
|
377
|
-
property: black,
|
|
378
|
-
pseudoClass: black,
|
|
379
|
-
pseudoElement: black,
|
|
380
|
-
punctuation: black,
|
|
381
|
-
regex: black,
|
|
382
|
-
selector: black,
|
|
383
|
-
string: black,
|
|
384
|
-
symbol: black,
|
|
385
|
-
tag: black,
|
|
386
|
-
unit: black,
|
|
387
|
-
url: black,
|
|
388
|
-
variable: black,
|
|
389
|
-
}),
|
|
390
|
-
}
|