@sanity/ui 3.0.0-static.10 → 3.0.0-static.12
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/_chunks-cjs/_visual-editing.js +1300 -1269
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/buildCommand.js +28 -10
- package/dist/_chunks-cjs/buildCommand.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +1298 -1263
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +516 -360
- package/dist/_visual-editing.d.ts +516 -360
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +258 -75
- package/dist/css.d.ts +258 -75
- package/dist/css.js +746 -752
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +748 -754
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +1342 -871
- package/dist/index.d.ts +1342 -871
- package/dist/index.js +433 -325
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +429 -321
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-palette.css +105 -1
- package/dist/sanity-palette.min.css +1 -0
- package/dist/sanity-theme.css +4571 -1
- package/dist/sanity-theme.min.css +1 -0
- package/dist/system.css +22053 -21710
- package/dist/system.min.css +1 -0
- package/dist/theme.d.mts +51 -106
- package/dist/theme.d.ts +51 -106
- package/dist/theme.js +19 -20
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +19 -20
- package/dist/theme.mjs.map +1 -1
- package/package.json +10 -5
- package/src/cli/buildCommand.ts +46 -19
- package/src/css/_comp.ts +2 -2
- package/src/css/{compile/compileStyle.ts → _compileStyle.ts} +7 -7
- package/src/css/_resp.ts +0 -1
- package/src/css/{system.style.ts → _system.style.ts} +3 -2
- package/src/css/aspects/display/display.ts +1 -0
- package/src/css/aspects/display/types.ts +2 -3
- package/src/css/aspects/flex/types.ts +4 -12
- package/src/css/aspects/flexItem/types.ts +1 -3
- package/src/css/aspects/font/font.style.ts +7 -66
- package/src/css/aspects/font/types.ts +1 -3
- package/src/css/aspects/grid/grid.ts +1 -0
- package/src/css/aspects/grid/types.ts +5 -9
- package/src/css/aspects/gridItem/gridItem.ts +1 -1
- package/src/css/aspects/gridItem/types.ts +7 -18
- package/src/css/aspects/height/height.ts +3 -4
- package/src/css/aspects/inset/inset.ts +1 -0
- package/src/css/aspects/margin/margin.ts +1 -0
- package/src/css/aspects/margin/types.ts +1 -0
- package/src/css/aspects/maxWidth/maxWidth.ts +1 -0
- package/src/css/aspects/maxWidth/types.ts +1 -0
- package/src/css/aspects/minWidth/minWidth.ts +1 -0
- package/src/css/aspects/minWidth/types.ts +2 -0
- package/src/css/aspects/overflow/overflow.ts +1 -0
- package/src/css/aspects/padding/padding.ts +1 -0
- package/src/css/aspects/pointerEvents/pointerEvents.ts +1 -0
- package/src/css/aspects/position/position.ts +1 -0
- package/src/css/aspects/shadow/shadow.style.ts +16 -41
- package/src/css/aspects/shadow/shadow.ts +1 -0
- package/src/css/aspects/textOverflow/textOverflow.ts +1 -0
- package/src/css/aspects/textOverflow/types.ts +1 -0
- package/src/css/aspects/width/types.ts +2 -0
- package/src/css/aspects/width/width.ts +1 -0
- package/src/css/compilePalette.ts +32 -0
- package/src/css/compileSystem.ts +7 -0
- package/src/css/{compile/compileTheme.ts → compileTheme.ts} +1 -0
- package/src/css/compileTheme_v3.ts +434 -0
- package/src/css/components/breadcrumbs/breadcrumbs.ts +1 -0
- package/src/css/components/dialog/dialog.ts +7 -0
- package/src/css/components/menu/menu.ts +2 -0
- package/src/css/components/skeleton/skeleton.style.ts +8 -4
- package/src/css/components/skeleton/skeleton.ts +4 -0
- package/src/css/components/skeleton/types.ts +4 -0
- package/src/css/components/toast/toast.ts +5 -0
- package/src/css/components/tree/tree.ts +1 -0
- package/src/css/composeClassNames.ts +4 -2
- package/src/css/constants.ts +11 -0
- package/src/css/index.ts +4 -3
- package/src/css/primitives/_arrow/_arrow.style.ts +6 -8
- package/src/css/primitives/_arrow/_arrow.ts +7 -0
- package/src/css/primitives/_input/input.ts +2 -0
- package/src/css/primitives/_selectable/_selectable.style.ts +24 -25
- package/src/css/primitives/_selectable/selectable.ts +1 -2
- package/src/css/primitives/avatar/avatar.style.ts +5 -8
- package/src/css/primitives/avatar/avatar.ts +6 -0
- package/src/css/primitives/avatar/types.ts +1 -0
- package/src/css/primitives/box/types.ts +1 -3
- package/src/css/primitives/button/button.style.ts +48 -15
- package/src/css/primitives/button/button.ts +4 -21
- package/src/css/primitives/button/index.ts +1 -0
- package/src/css/primitives/button/types.ts +18 -0
- package/src/css/primitives/card/card.style.ts +4 -7
- package/src/css/primitives/card/card.ts +2 -2
- package/src/css/primitives/card/types.ts +2 -2
- package/src/css/primitives/checkbox/checkbox.ts +2 -0
- package/src/css/primitives/container/container.ts +1 -0
- package/src/css/primitives/container/types.ts +1 -0
- package/src/css/primitives/kbd/kbd.ts +1 -0
- package/src/css/primitives/label/types.ts +7 -2
- package/src/css/primitives/popover/popover.ts +2 -0
- package/src/css/primitives/radio/radio.ts +1 -0
- package/src/css/primitives/select/select.ts +2 -0
- package/src/css/primitives/spinner/spinner.ts +2 -0
- package/src/css/primitives/switch/switch.ts +5 -0
- package/src/css/primitives/text/types.ts +4 -0
- package/src/css/primitives/textArea/textArea.ts +1 -0
- package/src/css/primitives/textInput/textInput.ts +1 -0
- package/src/css/primitives/token/token.style.ts +37 -36
- package/src/css/primitives/tooltip/tooltip.ts +2 -0
- package/src/css/responsiveRules.ts +12 -19
- package/src/css/scopeClassName.ts +1 -0
- package/src/css/types.ts +115 -15
- package/src/css/util.ts +5 -0
- package/src/css/utils/srOnly/srOnly.ts +1 -0
- package/src/css/varNames.ts +230 -143
- package/src/css/vars.ts +53 -22
- package/src/theme/palette/constants.ts +2 -0
- package/src/theme/palette/types.ts +3 -0
- package/src/theme/types.ts +2 -6
- package/src/theme/v0/focusRing.ts +1 -3
- package/src/theme/v0/font.ts +6 -18
- package/src/theme/v0/layer.ts +1 -3
- package/src/theme/v0/shadow.ts +2 -6
- package/src/theme/v2/avatar.ts +1 -3
- package/src/theme/v2/color/_system.ts +1 -3
- package/src/theme/v2/color/avatar.ts +2 -6
- package/src/theme/v2/color/badge.ts +2 -6
- package/src/theme/v2/color/button.ts +3 -9
- package/src/theme/v2/color/color.ts +3 -9
- package/src/theme/v2/color/input.ts +3 -9
- package/src/theme/v2/color/kbd.ts +1 -3
- package/src/theme/v2/color/selectable.ts +2 -6
- package/src/theme/v2/color/state.ts +1 -3
- package/src/theme/v2/color/syntax.ts +1 -3
- package/src/theme/v2/input.ts +1 -3
- package/src/theme/v2/theme.ts +2 -6
- package/src/theme/v3/buildTheme_v3.ts +2 -1
- package/src/theme/v3/color/color.ts +6 -4
- package/src/theme/v3/color/renderColor.ts +4 -1
- package/src/theme/v3/{defaults.ts → defaultTokens.ts} +2 -2
- package/src/theme/v3/index.ts +1 -1
- package/src/theme/v3/resolveTokens.ts +18 -18
- package/src/ui/RootClassNames.tsx +44 -0
- package/src/ui/StyleTags.tsx +3 -1
- package/src/ui/_compat/helpers.ts +72 -0
- package/src/ui/_compat/index.ts +2 -6
- package/src/ui/_compat/studioTheme.ts +7 -0
- package/src/ui/_compat/theme/themeColorProvider.tsx +2 -6
- package/src/ui/_compat/theme/themeProvider.tsx +2 -6
- package/src/ui/_compat/theme/types.ts +1 -3
- package/src/ui/_compat/theme/useRootTheme.ts +1 -3
- package/src/ui/_compat/theme/useTheme.ts +2 -6
- package/src/ui/_compat/types.ts +0 -83
- package/src/ui/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/ui/components/autocomplete/autocomplete.tsx +86 -114
- package/src/ui/components/autocomplete/autocompleteOption.tsx +2 -0
- package/src/ui/components/autocomplete/types.ts +3 -8
- package/src/ui/components/breadcrumbs/breadcrumbs.tsx +27 -21
- package/src/ui/components/dialog/dialog.tsx +89 -291
- package/src/ui/components/dialog/dialogCard.tsx +183 -0
- package/src/ui/components/dialog/isTargetWithinScope.ts +14 -0
- package/src/ui/components/hotkeys/hotkeys.tsx +33 -15
- package/src/ui/components/menu/__workshop__/asComponent.tsx +6 -6
- package/src/ui/components/menu/menu.tsx +27 -33
- package/src/ui/components/menu/menuButton.tsx +10 -14
- package/src/ui/components/menu/menuDivider.tsx +25 -13
- package/src/ui/components/menu/menuGroup.tsx +34 -26
- package/src/ui/components/menu/menuItem.tsx +51 -40
- package/src/ui/components/skeleton/codeSkeleton.tsx +53 -0
- package/src/ui/components/skeleton/headingSkeleton.tsx +52 -0
- package/src/ui/components/skeleton/index.ts +3 -0
- package/src/ui/components/skeleton/labelSkeleton.tsx +51 -0
- package/src/ui/components/skeleton/skeleton.tsx +39 -16
- package/src/ui/components/skeleton/textSkeleton.tsx +31 -110
- package/src/ui/components/tab/tab.tsx +23 -19
- package/src/ui/components/tab/tabList.tsx +34 -33
- package/src/ui/components/tab/tabPanel.tsx +25 -19
- package/src/ui/components/toast/toast.tsx +21 -16
- package/src/ui/components/toast/toastLayer.tsx +28 -10
- package/src/ui/components/toast/toastProvider.tsx +2 -6
- package/src/ui/components/toast/types.ts +2 -6
- package/src/ui/components/toast/useToast.ts +1 -3
- package/src/ui/components/tree/tree.tsx +194 -187
- package/src/ui/components/tree/treeGroup.tsx +25 -5
- package/src/ui/components/tree/treeItem.tsx +35 -23
- package/src/ui/hooks/useClickOutside.ts +2 -6
- package/src/ui/hooks/useClickOutsideEvent.ts +3 -9
- package/src/ui/index.ts +1 -0
- package/src/ui/primitives/_selectable/selectable.tsx +33 -20
- package/src/ui/primitives/avatar/avatar.tsx +28 -31
- package/src/ui/primitives/avatar/avatarCounter.tsx +33 -25
- package/src/ui/primitives/avatar/avatarStack.tsx +31 -24
- package/src/ui/primitives/avatar/types.ts +2 -0
- package/src/ui/primitives/badge/__workshop__/props.tsx +1 -9
- package/src/ui/primitives/badge/__workshop__/tones.tsx +1 -6
- package/src/ui/primitives/badge/badge.tsx +33 -32
- package/src/ui/primitives/badge/types.ts +2 -1
- package/src/ui/primitives/box/box.tsx +59 -29
- package/src/ui/primitives/button/__workshop__/sanityUploadButton.tsx +3 -3
- package/src/ui/primitives/button/__workshop__/uploadButton.tsx +2 -1
- package/src/ui/primitives/button/button.test.tsx +1 -15
- package/src/ui/primitives/button/button.tsx +63 -70
- package/src/ui/primitives/card/__workshop__/asComponent.tsx +3 -3
- package/src/ui/primitives/card/card.tsx +22 -22
- package/src/ui/primitives/card/cardProvider.tsx +2 -0
- package/src/ui/primitives/checkbox/checkbox.tsx +26 -15
- package/src/ui/primitives/code/code.tsx +24 -22
- package/src/ui/primitives/container/container.tsx +26 -15
- package/src/ui/primitives/flex/flex.tsx +21 -19
- package/src/ui/primitives/grid/grid.tsx +21 -16
- package/src/ui/primitives/heading/heading.tsx +42 -19
- package/src/ui/primitives/inline/inline.tsx +26 -23
- package/src/ui/primitives/kbd/kbd.tsx +25 -23
- package/src/ui/primitives/label/label.tsx +29 -26
- package/src/ui/primitives/popover/popover.tsx +293 -271
- package/src/ui/primitives/popover/popoverCard.tsx +122 -120
- package/src/ui/primitives/radio/radio.tsx +30 -14
- package/src/ui/primitives/select/select.tsx +24 -16
- package/src/ui/primitives/spinner/animatedSpinnerIcon.tsx +4 -2
- package/src/ui/primitives/spinner/spinner.tsx +24 -12
- package/src/ui/primitives/stack/stack.tsx +27 -18
- package/src/ui/primitives/switch/switch.tsx +31 -14
- package/src/ui/primitives/text/text.tsx +30 -24
- package/src/ui/primitives/textArea/textArea.tsx +33 -18
- package/src/ui/primitives/textInput/textInput.tsx +28 -40
- package/src/ui/primitives/tooltip/constants.ts +1 -1
- package/src/ui/primitives/tooltip/tooltip.tsx +85 -61
- package/src/ui/primitives/tooltip/tooltipCard.tsx +89 -82
- package/src/ui/primitives/types.ts +1 -3
- package/src/ui/types/avatar.ts +3 -6
- package/src/ui/types/badge.ts +1 -3
- package/src/ui/types/button.ts +1 -3
- package/src/ui/types/card.ts +1 -3
- package/src/ui/types/dialog.ts +1 -3
- package/src/ui/types/props.ts +20 -10
- package/src/ui/utils/arrow/arrow.tsx +43 -25
- package/src/ui/utils/boundaryElement/boundaryElementProvider.tsx +2 -6
- package/src/ui/utils/boundaryElement/types.ts +1 -3
- package/src/ui/utils/boundaryElement/useBoundaryElement.ts +1 -3
- package/src/ui/utils/elementQuery/elementQuery.tsx +43 -19
- package/src/ui/utils/errorBoundary.tsx +2 -0
- package/src/ui/utils/index.ts +0 -1
- package/src/ui/utils/layer/layer.tsx +23 -93
- package/src/ui/utils/layer/layerCard.tsx +92 -0
- package/src/ui/utils/layer/layerProvider.tsx +2 -6
- package/src/ui/utils/layer/useLayer.ts +1 -3
- package/src/ui/utils/portal/portal.ts +2 -6
- package/src/ui/utils/portal/portalProvider.tsx +2 -6
- package/src/ui/utils/portal/types.ts +1 -3
- package/src/ui/utils/portal/usePortal.ts +1 -3
- package/src/ui/utils/srOnly/srOnly.tsx +25 -20
- package/src/ui/utils/virtualList/virtualList.tsx +69 -50
- package/src/css/compile/compilePalette.ts +0 -27
- package/src/css/compile/compileRule.ts +0 -97
- package/src/css/compile/compileRules.test.ts +0 -36
- package/src/css/compile/compileRules.ts +0 -43
- package/src/css/compile/compileSystem.ts +0 -10
- package/src/css/compile/compileTheme_v3.ts +0 -401
- package/src/css/compile/types.ts +0 -6
- package/src/css/components/breadcrumbs/rules.ts +0 -25
- package/src/css/components/dialog/rules.ts +0 -78
- package/src/css/components/skeleton/rules.ts +0 -113
- package/src/css/components/toast/rules.ts +0 -18
- package/src/css/components/tree/rules.ts +0 -168
- package/src/css/primitives/_selectable/_contants.ts +0 -11
- package/src/css/primitives/card/_constants.ts +0 -13
- package/src/css/primitives/popover/rules.ts +0 -5
- package/src/css/primitives/spinner/rules.ts +0 -21
- package/src/css/primitives/token/rules.ts +0 -45
- package/src/ui/utils/conditionalWrapper/conditionalWrapper.tsx +0 -23
- package/src/ui/utils/conditionalWrapper/index.ts +0 -1
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import {PREFIX} from '../constants'
|
|
2
|
-
import {type Properties} from '../types'
|
|
3
|
-
import {CompileRulesContext} from './types'
|
|
4
|
-
|
|
5
|
-
// TODO: remove this
|
|
6
|
-
export function compileRule(
|
|
7
|
-
selector: string,
|
|
8
|
-
props: Properties,
|
|
9
|
-
context: CompileRulesContext,
|
|
10
|
-
): string {
|
|
11
|
-
let css = compileProperties(selector, props)
|
|
12
|
-
|
|
13
|
-
if (props['@nest']) {
|
|
14
|
-
css += compileNestedRules(selector, props['@nest'], context)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// @ts-expect-error - TODO: fix this
|
|
18
|
-
if (props['@keyframes']) {
|
|
19
|
-
// @ts-expect-error - TODO: fix this
|
|
20
|
-
for (const name in props['@keyframes']) {
|
|
21
|
-
// @ts-expect-error - TODO: fix this
|
|
22
|
-
context.keyframes[name] = props['@keyframes'][name]
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (props['@media']) {
|
|
27
|
-
for (const key in props['@media']) {
|
|
28
|
-
if (!context.media[key]) {
|
|
29
|
-
context.media[key] = {}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
context.media[key][selector] = props['@media'][key]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return css
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function compileProperties(selector: string, props: Properties) {
|
|
40
|
-
let css = '{'
|
|
41
|
-
|
|
42
|
-
for (const key in props) {
|
|
43
|
-
if (key === '@keyframes') continue // ignore
|
|
44
|
-
if (key === '@media') continue // ignore
|
|
45
|
-
if (key === '@nest') continue // ignore
|
|
46
|
-
|
|
47
|
-
const value = (props as Record<string, string>)[key]
|
|
48
|
-
|
|
49
|
-
const valueArr = Array.isArray(value) ? value : [value]
|
|
50
|
-
|
|
51
|
-
for (const v of valueArr) {
|
|
52
|
-
css += toSnakeCase(key) + ':' + v + ';'
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (css === '{') return ''
|
|
57
|
-
|
|
58
|
-
return selector + css + '}'
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function compileNestedRules(
|
|
62
|
-
selector: string,
|
|
63
|
-
props: Record<string, Properties>,
|
|
64
|
-
context: CompileRulesContext,
|
|
65
|
-
) {
|
|
66
|
-
if (!props) return ''
|
|
67
|
-
|
|
68
|
-
let css = ''
|
|
69
|
-
|
|
70
|
-
for (const [_selector, _props] of Object.entries(props)) {
|
|
71
|
-
css +=
|
|
72
|
-
'\n' +
|
|
73
|
-
compileRule(_selector.replace(/\./g, `.${PREFIX}`).replace(/&/g, selector), _props, context)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return css
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function compileMediaQueryRule(query: string, rules: Record<string, Properties>): string {
|
|
80
|
-
let css = `@media ${query}{`
|
|
81
|
-
|
|
82
|
-
for (const [selector, props] of Object.entries(rules)) {
|
|
83
|
-
// console.log('compileMediaQueryRule', {selector, props})
|
|
84
|
-
|
|
85
|
-
css += '\n ' + compileProperties(selector, props)
|
|
86
|
-
|
|
87
|
-
if (props['@nest']) {
|
|
88
|
-
css += compileNestedRules(selector, props['@nest'], {keyframes: {}, media: {}})
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return css + '\n}'
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function toSnakeCase(value: string) {
|
|
96
|
-
return value.replace(/[A-Z]/g, (match) => '-' + match.toLowerCase())
|
|
97
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {responsiveRules} from '../responsiveRules'
|
|
2
|
-
import {Rules} from '../types'
|
|
3
|
-
import {compileRules} from './compileRules'
|
|
4
|
-
|
|
5
|
-
it('should compile deeply nested rules', () => {
|
|
6
|
-
const rules: Rules = {
|
|
7
|
-
card: {
|
|
8
|
-
'@nest': {
|
|
9
|
-
'&:is(a)': {
|
|
10
|
-
// @ts-expect-error - TODO: fix this
|
|
11
|
-
'@media': {
|
|
12
|
-
'(hover: hover)': {
|
|
13
|
-
background: 'red',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// eslint-disable-next-line no-console
|
|
22
|
-
console.log(compileRules(rules))
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it.only('should compile responsive rules', () => {
|
|
26
|
-
const rules = responsiveRules('block', {
|
|
27
|
-
'@nest': {
|
|
28
|
-
'&:not([hidden])': {
|
|
29
|
-
display: 'block',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
// eslint-disable-next-line no-console
|
|
35
|
-
console.log(compileRules(rules))
|
|
36
|
-
})
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import {scopeClassName} from '../scopeClassName'
|
|
2
|
-
import {type Rules} from '../types'
|
|
3
|
-
import {compileMediaQueryRule, compileRule} from './compileRule'
|
|
4
|
-
import {CompileRulesContext} from './types'
|
|
5
|
-
|
|
6
|
-
/** @public */
|
|
7
|
-
export function compileRules(rules: Rules): string {
|
|
8
|
-
let css = ''
|
|
9
|
-
|
|
10
|
-
const context: CompileRulesContext = {
|
|
11
|
-
keyframes: {},
|
|
12
|
-
media: {},
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
for (const [className, props] of Object.entries(rules)) {
|
|
16
|
-
const ruleCss = compileRule(
|
|
17
|
-
`.${scopeClassName(className)}`.replace(/:/g, '\\:'),
|
|
18
|
-
props,
|
|
19
|
-
context,
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
css += ruleCss ? `${ruleCss}\n` : ''
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
for (const [name, value] of Object.entries(context.keyframes)) {
|
|
26
|
-
let keyframesCss = `@keyframes ${name} {\n`
|
|
27
|
-
|
|
28
|
-
for (const [key, props] of Object.entries(value)) {
|
|
29
|
-
keyframesCss += ` ${key}`
|
|
30
|
-
keyframesCss += compileRule('', props, context).replace(/\n/g, '\n ') + '\n'
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
keyframesCss += `\n}\n`
|
|
34
|
-
|
|
35
|
-
css += keyframesCss
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
for (const [query, queryRules] of Object.entries(context.media)) {
|
|
39
|
-
css += compileMediaQueryRule(query, queryRules) + '\n'
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return css.replace(/\n{2,}/g, '\n').trimStart()
|
|
43
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// import {rules} from '../rules'
|
|
2
|
-
import {systemStyle} from '../system.style'
|
|
3
|
-
import {compileStyle} from './compileStyle'
|
|
4
|
-
// import {compileRules} from './compileRules'
|
|
5
|
-
|
|
6
|
-
/** @public */
|
|
7
|
-
export function compileSystem(): string {
|
|
8
|
-
// return compileRules(rules)
|
|
9
|
-
return compileStyle(systemStyle)
|
|
10
|
-
}
|
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FONT_CODE_SIZE,
|
|
3
|
-
FONT_HEADING_SIZE,
|
|
4
|
-
FONT_LABEL_SIZE,
|
|
5
|
-
FONT_TEXT_SIZE,
|
|
6
|
-
HUES,
|
|
7
|
-
renderColor,
|
|
8
|
-
RenderColorContext,
|
|
9
|
-
THEME_COLOR_CARD_TONES,
|
|
10
|
-
THEME_COLOR_STATE_TONES,
|
|
11
|
-
type Theme_v3,
|
|
12
|
-
ThemeColorCardToneKey,
|
|
13
|
-
ThemeColorSchemeKey,
|
|
14
|
-
} from '@sanity/ui/theme'
|
|
15
|
-
|
|
16
|
-
import {Properties} from '../types'
|
|
17
|
-
import {px, rem, toBoxShadow} from '../util'
|
|
18
|
-
import {compileRule} from './compileRule'
|
|
19
|
-
|
|
20
|
-
export function compileTheme_v3(theme: Theme_v3): string {
|
|
21
|
-
return compileRule(':root', compileThemeProperties(theme), {keyframes: {}, media: {}})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function compileThemeProperties(theme: Theme_v3): Properties {
|
|
25
|
-
return {
|
|
26
|
-
...buildAvatarThemeProperties(theme),
|
|
27
|
-
...buildButtonThemeProperties(theme),
|
|
28
|
-
...buildContainerThemeProperties(theme),
|
|
29
|
-
...buildFontCodeThemeProperties(theme),
|
|
30
|
-
...buildFontHeadingThemeProperties(theme),
|
|
31
|
-
...buildFontLabelThemeProperties(theme),
|
|
32
|
-
...buildFontTextThemeProperties(theme),
|
|
33
|
-
...buildInputThemeProperties(theme),
|
|
34
|
-
...buildRadiusThemeProperties(theme),
|
|
35
|
-
...buildShadowThemeProperties(theme),
|
|
36
|
-
...buildSpaceThemeProperties(theme),
|
|
37
|
-
...buildColorThemeProperties(theme),
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function buildAvatarThemeProperties(theme: Theme_v3): Properties {
|
|
42
|
-
return {
|
|
43
|
-
[`--avatar-focus-ring-offset`]: px(theme.avatar.focusRing.offset),
|
|
44
|
-
[`--avatar-focus-ring-width`]: px(theme.avatar.focusRing.width),
|
|
45
|
-
[`--avatar-0-distance`]: px(theme.avatar.sizes[0].distance),
|
|
46
|
-
[`--avatar-0-size`]: px(theme.avatar.sizes[0].size),
|
|
47
|
-
[`--avatar-1-distance`]: px(theme.avatar.sizes[1].distance),
|
|
48
|
-
[`--avatar-1-size`]: px(theme.avatar.sizes[1].size),
|
|
49
|
-
[`--avatar-2-distance`]: px(theme.avatar.sizes[2].distance),
|
|
50
|
-
[`--avatar-2-size`]: px(theme.avatar.sizes[2].size),
|
|
51
|
-
[`--avatar-3-distance`]: px(theme.avatar.sizes[3].distance),
|
|
52
|
-
[`--avatar-3-size`]: px(theme.avatar.sizes[3].size),
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function buildButtonThemeProperties(theme: Theme_v3): Properties {
|
|
57
|
-
return {
|
|
58
|
-
[`--button-border-width`]: px(theme.button.border.width),
|
|
59
|
-
[`--button-focus-ring-offset`]: px(theme.button.focusRing.offset),
|
|
60
|
-
[`--button-focus-ring-width`]: px(theme.button.focusRing.width),
|
|
61
|
-
// [`--button-text-weight`]: theme.button.textWeight,
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function buildContainerThemeProperties(theme: Theme_v3): Properties {
|
|
66
|
-
return {
|
|
67
|
-
[`--container-0`]: px(theme.container[0]),
|
|
68
|
-
[`--container-1`]: px(theme.container[1]),
|
|
69
|
-
[`--container-2`]: px(theme.container[2]),
|
|
70
|
-
[`--container-3`]: px(theme.container[3]),
|
|
71
|
-
[`--container-4`]: px(theme.container[4]),
|
|
72
|
-
[`--container-5`]: px(theme.container[5]),
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function buildFontCodeThemeProperties(theme: Theme_v3): Properties {
|
|
77
|
-
const props: Properties = {
|
|
78
|
-
'--font-code-family': theme.font.code.family,
|
|
79
|
-
'--font-code-feature-settings': theme.font.code.featureSettings,
|
|
80
|
-
'--font-code-weight-regular': `${theme.font.code.weights.regular}`,
|
|
81
|
-
'--font-code-weight-medium': `${theme.font.code.weights.medium}`,
|
|
82
|
-
'--font-code-weight-semibold': `${theme.font.code.weights.semibold}`,
|
|
83
|
-
'--font-code-weight-bold': `${theme.font.code.weights.bold}`,
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
for (const size of FONT_CODE_SIZE) {
|
|
87
|
-
props[`--font-code-${size}-size`] = rem(theme.font.code.sizes[size].fontSize)
|
|
88
|
-
props[`--font-code-${size}-line-height`] = rem(theme.font.code.sizes[size].lineHeight)
|
|
89
|
-
props[`--font-code-${size}-ascender-height`] = px(theme.font.code.sizes[size].ascenderHeight)
|
|
90
|
-
props[`--font-code-${size}-descender-height`] = px(theme.font.code.sizes[size].descenderHeight)
|
|
91
|
-
// props[`--font-code-${size}-cap-height`] =
|
|
92
|
-
// `calc(var(--font-code-${size}-line-height) - var(--font-code-${size}-ascender-height) - var(--font-code-${size}-descender-height))`
|
|
93
|
-
props[`--font-code-${size}-letter-spacing`] = px(theme.font.code.sizes[size].letterSpacing)
|
|
94
|
-
props[`--font-code-${size}-icon-size`] = px(theme.font.code.sizes[size].iconSize)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return props
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function buildFontHeadingThemeProperties(theme: Theme_v3): Properties {
|
|
101
|
-
const props: Properties = {
|
|
102
|
-
'--font-heading-family': theme.font.heading.family,
|
|
103
|
-
'--font-heading-feature-settings': theme.font.heading.featureSettings,
|
|
104
|
-
'--font-heading-weight-regular': `${theme.font.heading.weights.regular}`,
|
|
105
|
-
'--font-heading-weight-medium': `${theme.font.heading.weights.medium}`,
|
|
106
|
-
'--font-heading-weight-semibold': `${theme.font.heading.weights.semibold}`,
|
|
107
|
-
'--font-heading-weight-bold': `${theme.font.heading.weights.bold}`,
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
for (const size of FONT_HEADING_SIZE) {
|
|
111
|
-
props[`--font-heading-${size}-size`] = rem(theme.font.heading.sizes[size].fontSize)
|
|
112
|
-
props[`--font-heading-${size}-line-height`] = rem(theme.font.heading.sizes[size].lineHeight)
|
|
113
|
-
props[`--font-heading-${size}-ascender-height`] = px(
|
|
114
|
-
theme.font.heading.sizes[size].ascenderHeight,
|
|
115
|
-
)
|
|
116
|
-
props[`--font-heading-${size}-descender-height`] = px(
|
|
117
|
-
theme.font.heading.sizes[size].descenderHeight,
|
|
118
|
-
)
|
|
119
|
-
props[`--font-heading-${size}-letter-spacing`] = px(
|
|
120
|
-
theme.font.heading.sizes[size].letterSpacing,
|
|
121
|
-
)
|
|
122
|
-
// props[`--font-heading-${size}-cap-height`] =
|
|
123
|
-
// `calc(var(--font-heading-${size}-line-height) - var(--font-heading-${size}-ascender-height) - var(--font-heading-${size}-descender-height))`
|
|
124
|
-
props[`--font-heading-${size}-icon-size`] = px(theme.font.heading.sizes[size].iconSize)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return props
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function buildFontLabelThemeProperties(theme: Theme_v3): Properties {
|
|
131
|
-
const props: Properties = {
|
|
132
|
-
'--font-label-family': theme.font.label.family,
|
|
133
|
-
'--font-label-feature-settings': theme.font.label.featureSettings,
|
|
134
|
-
'--font-label-weight-regular': `${theme.font.label.weights.regular}`,
|
|
135
|
-
'--font-label-weight-medium': `${theme.font.label.weights.medium}`,
|
|
136
|
-
'--font-label-weight-semibold': `${theme.font.label.weights.semibold}`,
|
|
137
|
-
'--font-label-weight-bold': `${theme.font.label.weights.bold}`,
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
for (const size of FONT_LABEL_SIZE) {
|
|
141
|
-
props[`--font-label-${size}-size`] = rem(theme.font.label.sizes[size].fontSize)
|
|
142
|
-
props[`--font-label-${size}-line-height`] = rem(theme.font.label.sizes[size].lineHeight)
|
|
143
|
-
props[`--font-label-${size}-ascender-height`] = px(theme.font.label.sizes[size].ascenderHeight)
|
|
144
|
-
props[`--font-label-${size}-descender-height`] = px(
|
|
145
|
-
theme.font.label.sizes[size].descenderHeight,
|
|
146
|
-
)
|
|
147
|
-
// props[`--font-label-${size}-cap-height`] =
|
|
148
|
-
// `calc(var(--font-label-${size}-line-height) - var(--font-label-${size}-ascender-height) - var(--font-label-${size}-descender-height))`
|
|
149
|
-
props[`--font-label-${size}-letter-spacing`] = px(theme.font.label.sizes[size].letterSpacing)
|
|
150
|
-
props[`--font-label-${size}-icon-size`] = px(theme.font.label.sizes[size].iconSize)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return props
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function buildFontTextThemeProperties(theme: Theme_v3): Properties {
|
|
157
|
-
const props: Properties = {
|
|
158
|
-
'--font-text-family': theme.font.text.family,
|
|
159
|
-
'--font-text-feature-settings': theme.font.text.featureSettings,
|
|
160
|
-
'--font-text-weight-regular': `${theme.font.text.weights.regular}`,
|
|
161
|
-
'--font-text-weight-medium': `${theme.font.text.weights.medium}`,
|
|
162
|
-
'--font-text-weight-semibold': `${theme.font.text.weights.semibold}`,
|
|
163
|
-
'--font-text-weight-bold': `${theme.font.text.weights.bold}`,
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
for (const size of FONT_TEXT_SIZE) {
|
|
167
|
-
props[`--font-text-${size}-size`] = rem(theme.font.text.sizes[size].fontSize)
|
|
168
|
-
props[`--font-text-${size}-line-height`] = rem(theme.font.text.sizes[size].lineHeight)
|
|
169
|
-
props[`--font-text-${size}-ascender-height`] = px(theme.font.text.sizes[size].ascenderHeight)
|
|
170
|
-
props[`--font-text-${size}-descender-height`] = px(theme.font.text.sizes[size].descenderHeight)
|
|
171
|
-
// props[`--font-text-${size}-cap-height`] =
|
|
172
|
-
// `calc(var(--font-text-${size}-line-height) - var(--font-text-${size}-ascender-height) - var(--font-text-${size}-descender-height))`
|
|
173
|
-
props[`--font-text-${size}-letter-spacing`] = px(theme.font.text.sizes[size].letterSpacing)
|
|
174
|
-
props[`--font-text-${size}-icon-size`] = px(theme.font.text.sizes[size].iconSize)
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return props
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function buildInputThemeProperties(theme: Theme_v3): Properties {
|
|
181
|
-
return {
|
|
182
|
-
[`--input-border-width`]: px(theme.input.border.width),
|
|
183
|
-
[`--input-checkbox-focus-ring-offset`]: px(theme.input.checkbox.focusRing.offset),
|
|
184
|
-
[`--input-checkbox-focus-ring-width`]: px(theme.input.checkbox.focusRing.width),
|
|
185
|
-
[`--input-checkbox-size`]: px(theme.input.checkbox.size),
|
|
186
|
-
[`--input-radio-focus-ring-offset`]: px(theme.input.radio.focusRing.offset),
|
|
187
|
-
[`--input-radio-focus-ring-width`]: px(theme.input.radio.focusRing.width),
|
|
188
|
-
[`--input-radio-mark-size`]: px(theme.input.radio.markSize),
|
|
189
|
-
[`--input-radio-size`]: px(theme.input.radio.size),
|
|
190
|
-
[`--input-select-focus-ring-offset`]: px(theme.input.select.focusRing.offset),
|
|
191
|
-
[`--input-select-focus-ring-width`]: px(theme.input.select.focusRing.width),
|
|
192
|
-
[`--input-switch-focus-ring-offset`]: px(theme.input.switch.focusRing.offset),
|
|
193
|
-
[`--input-switch-focus-ring-width`]: px(theme.input.switch.focusRing.width),
|
|
194
|
-
[`--input-switch-height`]: px(theme.input.switch.height),
|
|
195
|
-
[`--input-switch-padding`]: px(theme.input.switch.padding),
|
|
196
|
-
[`--input-switch-transition-duration-ms`]: `${theme.input.switch.transitionDurationMs}ms`,
|
|
197
|
-
[`--input-switch-transition-timing-function`]: theme.input.switch.transitionTimingFunction,
|
|
198
|
-
[`--input-switch-width`]: px(theme.input.switch.width),
|
|
199
|
-
[`--input-text-focus-ring-offset`]: px(theme.input.text.focusRing.offset),
|
|
200
|
-
[`--input-text-focus-ring-width`]: px(theme.input.text.focusRing.width),
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function buildRadiusThemeProperties(theme: Theme_v3): Properties {
|
|
205
|
-
return {
|
|
206
|
-
[`--radius-0`]: rem(theme.radius[0]),
|
|
207
|
-
[`--radius-1`]: rem(theme.radius[1]),
|
|
208
|
-
[`--radius-2`]: rem(theme.radius[2]),
|
|
209
|
-
[`--radius-3`]: rem(theme.radius[3]),
|
|
210
|
-
[`--radius-4`]: rem(theme.radius[4]),
|
|
211
|
-
[`--radius-5`]: rem(theme.radius[5]),
|
|
212
|
-
[`--radius-6`]: rem(theme.radius[6]),
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function buildShadowThemeProperties(theme: Theme_v3): Properties {
|
|
217
|
-
return {
|
|
218
|
-
[`--shadow-outline`]: `0 0 0 ${theme.card.shadow.outline}px`,
|
|
219
|
-
[`--shadow-0-umbra`]: toBoxShadow(theme.shadow[0]?.umbra),
|
|
220
|
-
[`--shadow-0-penumbra`]: toBoxShadow(theme.shadow[0]?.penumbra),
|
|
221
|
-
[`--shadow-0-ambient`]: toBoxShadow(theme.shadow[0]?.ambient),
|
|
222
|
-
[`--shadow-1-umbra`]: toBoxShadow(theme.shadow[1]?.umbra),
|
|
223
|
-
[`--shadow-1-penumbra`]: toBoxShadow(theme.shadow[1]?.penumbra),
|
|
224
|
-
[`--shadow-1-ambient`]: toBoxShadow(theme.shadow[1]?.ambient),
|
|
225
|
-
[`--shadow-2-umbra`]: toBoxShadow(theme.shadow[2]?.umbra),
|
|
226
|
-
[`--shadow-2-penumbra`]: toBoxShadow(theme.shadow[2]?.penumbra),
|
|
227
|
-
[`--shadow-2-ambient`]: toBoxShadow(theme.shadow[2]?.ambient),
|
|
228
|
-
[`--shadow-3-umbra`]: toBoxShadow(theme.shadow[3]?.umbra),
|
|
229
|
-
[`--shadow-3-penumbra`]: toBoxShadow(theme.shadow[3]?.penumbra),
|
|
230
|
-
[`--shadow-3-ambient`]: toBoxShadow(theme.shadow[3]?.ambient),
|
|
231
|
-
[`--shadow-4-umbra`]: toBoxShadow(theme.shadow[4]?.umbra),
|
|
232
|
-
[`--shadow-4-penumbra`]: toBoxShadow(theme.shadow[4]?.penumbra),
|
|
233
|
-
[`--shadow-4-ambient`]: toBoxShadow(theme.shadow[4]?.ambient),
|
|
234
|
-
[`--shadow-5-umbra`]: toBoxShadow(theme.shadow[5]?.umbra),
|
|
235
|
-
[`--shadow-5-penumbra`]: toBoxShadow(theme.shadow[5]?.penumbra),
|
|
236
|
-
[`--shadow-5-ambient`]: toBoxShadow(theme.shadow[5]?.ambient),
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
function buildSpaceThemeProperties(theme: Theme_v3): Properties {
|
|
241
|
-
return {
|
|
242
|
-
[`--space-0`]: rem(theme.space[0]),
|
|
243
|
-
[`--space-0_5`]: rem(theme.space[1] / 2),
|
|
244
|
-
[`--space-1`]: rem(theme.space[1]),
|
|
245
|
-
[`--space-2`]: rem(theme.space[2]),
|
|
246
|
-
[`--space-3`]: rem(theme.space[3]),
|
|
247
|
-
[`--space-4`]: rem(theme.space[4]),
|
|
248
|
-
[`--space-5`]: rem(theme.space[5]),
|
|
249
|
-
[`--space-6`]: rem(theme.space[6]),
|
|
250
|
-
[`--space-7`]: rem(theme.space[7]),
|
|
251
|
-
[`--space-8`]: rem(theme.space[8]),
|
|
252
|
-
[`--space-9`]: rem(theme.space[9]),
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
const THEME_COLOR_SCHEMES = ['dark', 'light'] as const
|
|
257
|
-
const THEME_COLOR_VARIANTS = ['tinted', 'solid'] as const
|
|
258
|
-
|
|
259
|
-
function buildColorThemeProperties(theme: Theme_v3): Properties {
|
|
260
|
-
const props: Properties = {}
|
|
261
|
-
|
|
262
|
-
for (const scheme of THEME_COLOR_SCHEMES) {
|
|
263
|
-
for (const cardTone of THEME_COLOR_CARD_TONES) {
|
|
264
|
-
Object.assign(props, buildColorAvatarThemeProperties(theme, {scheme, cardTone}))
|
|
265
|
-
Object.assign(props, buildColorCardThemeProperties(theme, {scheme, cardTone}))
|
|
266
|
-
|
|
267
|
-
// card variants: tinted, solid
|
|
268
|
-
for (const colorVariant of THEME_COLOR_VARIANTS) {
|
|
269
|
-
for (const elementTone of THEME_COLOR_STATE_TONES) {
|
|
270
|
-
const tokens = theme._tokens.color[cardTone].variant[colorVariant][elementTone]
|
|
271
|
-
const prefix = `--color-${scheme}-${cardTone}-${colorVariant}-${elementTone}` as const
|
|
272
|
-
|
|
273
|
-
const context: RenderColorContext = {
|
|
274
|
-
bgVar: `${prefix}-bg-0`,
|
|
275
|
-
hue: tokens._hue,
|
|
276
|
-
scheme,
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
Object.assign(props, {
|
|
280
|
-
[`${prefix}-bg-0`]: renderColor(tokens.bg[0], context),
|
|
281
|
-
[`${prefix}-bg-1`]: `color-mix(in srgb, var(${prefix}-bg-0), var(${prefix}-bg-4) 25%)`,
|
|
282
|
-
[`${prefix}-bg-2`]: `color-mix(in srgb, var(${prefix}-bg-0), var(${prefix}-bg-4) 50%)`,
|
|
283
|
-
[`${prefix}-bg-3`]: `color-mix(in srgb, var(${prefix}-bg-0), var(${prefix}-bg-4) 75%)`,
|
|
284
|
-
[`${prefix}-bg-4`]: renderColor(tokens.bg[4], context),
|
|
285
|
-
|
|
286
|
-
[`${prefix}-border-0`]: renderColor(tokens.border[0], context),
|
|
287
|
-
[`${prefix}-border-1`]: `color-mix(in srgb, var(${prefix}-border-0), var(${prefix}-border-4) 25%)`,
|
|
288
|
-
[`${prefix}-border-2`]: `color-mix(in srgb, var(${prefix}-border-0), var(${prefix}-border-4) 50%)`,
|
|
289
|
-
[`${prefix}-border-3`]: `color-mix(in srgb, var(${prefix}-border-0), var(${prefix}-border-4) 75%)`,
|
|
290
|
-
[`${prefix}-border-4`]: renderColor(tokens.border[4], context),
|
|
291
|
-
|
|
292
|
-
[`${prefix}-fg-0`]: renderColor(tokens.fg[0], context),
|
|
293
|
-
[`${prefix}-fg-1`]: `color-mix(in srgb, var(${prefix}-fg-0), var(${prefix}-fg-4) 25%)`,
|
|
294
|
-
[`${prefix}-fg-2`]: `color-mix(in srgb, var(${prefix}-fg-0), var(${prefix}-fg-4) 50%)`,
|
|
295
|
-
[`${prefix}-fg-3`]: `color-mix(in srgb, var(${prefix}-fg-0), var(${prefix}-fg-4) 75%)`,
|
|
296
|
-
[`${prefix}-fg-4`]: renderColor(tokens.fg[4], context),
|
|
297
|
-
} satisfies Properties)
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
return props as Properties
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
function buildColorAvatarThemeProperties(
|
|
307
|
-
theme: Theme_v3,
|
|
308
|
-
options: {scheme: ThemeColorSchemeKey; cardTone: ThemeColorCardToneKey},
|
|
309
|
-
): Properties {
|
|
310
|
-
const {scheme, cardTone} = options
|
|
311
|
-
const tokens = theme._tokens.color[cardTone]
|
|
312
|
-
const prefix = `--color-${scheme}-${cardTone}` as const
|
|
313
|
-
|
|
314
|
-
const props: Properties = {}
|
|
315
|
-
|
|
316
|
-
for (const hue of HUES) {
|
|
317
|
-
const context: RenderColorContext = {
|
|
318
|
-
bgVar: `${prefix}-bg-0`,
|
|
319
|
-
hue: tokens.avatar[hue]._hue ?? hue,
|
|
320
|
-
scheme,
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
Object.assign(props, {
|
|
324
|
-
[`${prefix}-avatar-${hue}-bg`]: renderColor(tokens.avatar[hue].bg, context),
|
|
325
|
-
[`${prefix}-avatar-${hue}-fg`]: renderColor(tokens.avatar[hue].fg, context),
|
|
326
|
-
} satisfies Properties)
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
return props
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
function buildColorCardThemeProperties(
|
|
333
|
-
theme: Theme_v3,
|
|
334
|
-
options: {scheme: ThemeColorSchemeKey; cardTone: ThemeColorCardToneKey},
|
|
335
|
-
): Properties {
|
|
336
|
-
const {scheme, cardTone} = options
|
|
337
|
-
const tokens = theme._tokens.color[cardTone]
|
|
338
|
-
const prefix = `--color-${scheme}-${cardTone}` as const
|
|
339
|
-
const context: RenderColorContext = {bgVar: `${prefix}-bg-0`, hue: tokens._hue, scheme}
|
|
340
|
-
|
|
341
|
-
const props: Properties = {
|
|
342
|
-
// backdrop
|
|
343
|
-
[`${prefix}-backdrop`]: renderColor(tokens.backdrop, context),
|
|
344
|
-
|
|
345
|
-
// code
|
|
346
|
-
[`${prefix}-code-bg`]: renderColor(tokens.code.bg, context),
|
|
347
|
-
[`${prefix}-code-fg`]: renderColor(tokens.code.fg, context),
|
|
348
|
-
|
|
349
|
-
// code / token
|
|
350
|
-
[`${prefix}-code-token-atrule`]: renderColor(tokens.code.token.atrule, context),
|
|
351
|
-
[`${prefix}-code-token-attr-name`]: renderColor(tokens.code.token.attrName, context),
|
|
352
|
-
[`${prefix}-code-token-attr-value`]: renderColor(tokens.code.token.attrValue, context),
|
|
353
|
-
[`${prefix}-code-token-attribute`]: renderColor(tokens.code.token.attribute, context),
|
|
354
|
-
[`${prefix}-code-token-boolean`]: renderColor(tokens.code.token.boolean, context),
|
|
355
|
-
[`${prefix}-code-token-builtin`]: renderColor(tokens.code.token.builtin, context),
|
|
356
|
-
[`${prefix}-code-token-cdata`]: renderColor(tokens.code.token.cdata, context),
|
|
357
|
-
[`${prefix}-code-token-char`]: renderColor(tokens.code.token.char, context),
|
|
358
|
-
[`${prefix}-code-token-class-name`]: renderColor(tokens.code.token.className, context),
|
|
359
|
-
[`${prefix}-code-token-class`]: renderColor(tokens.code.token.class, context),
|
|
360
|
-
[`${prefix}-code-token-comment`]: renderColor(tokens.code.token.comment, context),
|
|
361
|
-
[`${prefix}-code-token-constant`]: renderColor(tokens.code.token.constant, context),
|
|
362
|
-
[`${prefix}-code-token-deleted`]: renderColor(tokens.code.token.deleted, context),
|
|
363
|
-
[`${prefix}-code-token-doctype`]: renderColor(tokens.code.token.doctype, context),
|
|
364
|
-
[`${prefix}-code-token-entity`]: renderColor(tokens.code.token.entity, context),
|
|
365
|
-
[`${prefix}-code-token-function`]: renderColor(tokens.code.token.function, context),
|
|
366
|
-
[`${prefix}-code-token-hexcode`]: renderColor(tokens.code.token.hexcode, context),
|
|
367
|
-
[`${prefix}-code-token-id`]: renderColor(tokens.code.token.id, context),
|
|
368
|
-
[`${prefix}-code-token-important`]: renderColor(tokens.code.token.important, context),
|
|
369
|
-
[`${prefix}-code-token-inserted`]: renderColor(tokens.code.token.inserted, context),
|
|
370
|
-
[`${prefix}-code-token-keyword`]: renderColor(tokens.code.token.keyword, context),
|
|
371
|
-
[`${prefix}-code-token-number`]: renderColor(tokens.code.token.number, context),
|
|
372
|
-
[`${prefix}-code-token-operator`]: renderColor(tokens.code.token.operator, context),
|
|
373
|
-
[`${prefix}-code-token-prolog`]: renderColor(tokens.code.token.prolog, context),
|
|
374
|
-
[`${prefix}-code-token-property`]: renderColor(tokens.code.token.property, context),
|
|
375
|
-
[`${prefix}-code-token-pseudo-class`]: renderColor(tokens.code.token.pseudoClass, context),
|
|
376
|
-
[`${prefix}-code-token-pseudo-eelement`]: renderColor(tokens.code.token.pseudoElement, context),
|
|
377
|
-
[`${prefix}-code-token-punctuation`]: renderColor(tokens.code.token.punctuation, context),
|
|
378
|
-
[`${prefix}-code-token-regex`]: renderColor(tokens.code.token.regex, context),
|
|
379
|
-
[`${prefix}-code-token-selector`]: renderColor(tokens.code.token.selector, context),
|
|
380
|
-
[`${prefix}-code-token-string`]: renderColor(tokens.code.token.string, context),
|
|
381
|
-
[`${prefix}-code-token-symbol`]: renderColor(tokens.code.token.symbol, context),
|
|
382
|
-
[`${prefix}-code-token-tag`]: renderColor(tokens.code.token.tag, context),
|
|
383
|
-
[`${prefix}-code-token-unit`]: renderColor(tokens.code.token.unit, context),
|
|
384
|
-
[`${prefix}-code-token-url`]: renderColor(tokens.code.token.url, context),
|
|
385
|
-
[`${prefix}-code-token-variable`]: renderColor(tokens.code.token.variable, context),
|
|
386
|
-
|
|
387
|
-
// focus ring
|
|
388
|
-
[`${prefix}-focus-ring`]: renderColor(tokens.focusRing, context),
|
|
389
|
-
|
|
390
|
-
// link
|
|
391
|
-
[`${prefix}-link-fg`]: renderColor(tokens.link.fg, context),
|
|
392
|
-
|
|
393
|
-
// shadow
|
|
394
|
-
[`${prefix}-shadow-outline`]: renderColor(tokens.shadow.outline, context),
|
|
395
|
-
[`${prefix}-shadow-umbra`]: renderColor(tokens.shadow.umbra, context),
|
|
396
|
-
[`${prefix}-shadow-penumbra`]: renderColor(tokens.shadow.penumbra, context),
|
|
397
|
-
[`${prefix}-shadow-ambient`]: renderColor(tokens.shadow.ambient, context),
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
return props
|
|
401
|
-
}
|
package/src/css/compile/types.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {Rules} from '../../types'
|
|
2
|
-
|
|
3
|
-
export const breadcrumbsRules: Rules = {
|
|
4
|
-
breadcrumbs: {
|
|
5
|
-
lineHeight: 0,
|
|
6
|
-
},
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// import {styled} from '../../lib/styled'
|
|
10
|
-
// import {Button} from '../../primitives'
|
|
11
|
-
|
|
12
|
-
// export const Root = styled.ol`
|
|
13
|
-
// margin: 0;
|
|
14
|
-
// padding: 0;
|
|
15
|
-
// display: flex;
|
|
16
|
-
// list-style: none;
|
|
17
|
-
// align-items: center;
|
|
18
|
-
// white-space: nowrap;
|
|
19
|
-
// line-height: 0;
|
|
20
|
-
// `
|
|
21
|
-
|
|
22
|
-
// export const ExpandButton = styled(Button)`
|
|
23
|
-
// appearance: none;
|
|
24
|
-
// margin: -4px;
|
|
25
|
-
// `
|