@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
|
@@ -2,6 +2,7 @@ import {_resp} from '../../_resp'
|
|
|
2
2
|
import {composeClassNames} from '../../composeClassNames'
|
|
3
3
|
import {ShadowStyleProps} from './types'
|
|
4
4
|
|
|
5
|
+
/** @internal */
|
|
5
6
|
export function shadow(props: ShadowStyleProps): string | undefined {
|
|
6
7
|
return composeClassNames(_resp('shadow', props.shadow))
|
|
7
8
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {color} from '@sanity/color'
|
|
2
|
+
import {HUES, TINTS} from '@sanity/ui/theme'
|
|
3
|
+
|
|
4
|
+
import {_compileStyle} from './_compileStyle'
|
|
5
|
+
import {Properties} from './types'
|
|
6
|
+
import {varNames} from './varNames'
|
|
7
|
+
|
|
8
|
+
/** @internal */
|
|
9
|
+
export function compilePalette(): string {
|
|
10
|
+
return _compileStyle({
|
|
11
|
+
layers: {
|
|
12
|
+
theme: {
|
|
13
|
+
':root': compilePaletteProperties(),
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function compilePaletteProperties() {
|
|
20
|
+
const rules: Properties = {
|
|
21
|
+
[varNames.black]: color.black.hex,
|
|
22
|
+
[varNames.white]: color.white.hex,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
for (const hue of HUES) {
|
|
26
|
+
for (const tint of TINTS) {
|
|
27
|
+
rules[varNames[hue][tint]] = color[hue][tint].hex
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return rules
|
|
32
|
+
}
|
|
@@ -0,0 +1,434 @@
|
|
|
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 {_compileStyle} from './_compileStyle'
|
|
17
|
+
import {Properties} from './types'
|
|
18
|
+
import {px, rem, toBoxShadow} from './util'
|
|
19
|
+
import {varNames} from './varNames'
|
|
20
|
+
|
|
21
|
+
const THEME_COLOR_SCHEMES = ['dark', 'light'] as const
|
|
22
|
+
const THEME_COLOR_VARIANTS = ['tinted', 'solid'] as const
|
|
23
|
+
|
|
24
|
+
/** @internal */
|
|
25
|
+
export function compileTheme_v3(theme: Theme_v3): string {
|
|
26
|
+
return _compileStyle({
|
|
27
|
+
layers: {
|
|
28
|
+
theme: {
|
|
29
|
+
':root': compileThemeProperties(theme),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function compileThemeProperties(theme: Theme_v3): Properties {
|
|
36
|
+
return {
|
|
37
|
+
...buildAvatarThemeProperties(theme),
|
|
38
|
+
...buildButtonThemeProperties(theme),
|
|
39
|
+
[varNames.card.shadow.outline]: px(theme.card.shadow.outline),
|
|
40
|
+
...buildColorThemeProperties(theme),
|
|
41
|
+
...buildContainerThemeProperties(theme),
|
|
42
|
+
...buildFontCodeThemeProperties(theme),
|
|
43
|
+
...buildFontHeadingThemeProperties(theme),
|
|
44
|
+
...buildFontLabelThemeProperties(theme),
|
|
45
|
+
...buildFontTextThemeProperties(theme),
|
|
46
|
+
...buildInputThemeProperties(theme),
|
|
47
|
+
...buildRadiusThemeProperties(theme),
|
|
48
|
+
...buildShadowThemeProperties(theme),
|
|
49
|
+
...buildSpaceThemeProperties(theme),
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function buildAvatarThemeProperties(theme: Theme_v3): Properties {
|
|
54
|
+
return {
|
|
55
|
+
[varNames.avatar.focusRing.offset]: px(theme.avatar.focusRing.offset),
|
|
56
|
+
[varNames.avatar.focusRing.width]: px(theme.avatar.focusRing.width),
|
|
57
|
+
|
|
58
|
+
[varNames.avatar.sizes[0].distance]: rem(theme.avatar.sizes[0].distance),
|
|
59
|
+
[varNames.avatar.sizes[0].size]: rem(theme.avatar.sizes[0].size),
|
|
60
|
+
|
|
61
|
+
[varNames.avatar.sizes[1].distance]: rem(theme.avatar.sizes[1].distance),
|
|
62
|
+
[varNames.avatar.sizes[1].size]: rem(theme.avatar.sizes[1].size),
|
|
63
|
+
|
|
64
|
+
[varNames.avatar.sizes[2].distance]: rem(theme.avatar.sizes[2].distance),
|
|
65
|
+
[varNames.avatar.sizes[2].size]: rem(theme.avatar.sizes[2].size),
|
|
66
|
+
|
|
67
|
+
[varNames.avatar.sizes[3].distance]: rem(theme.avatar.sizes[3].distance),
|
|
68
|
+
[varNames.avatar.sizes[3].size]: rem(theme.avatar.sizes[3].size),
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function buildButtonThemeProperties(theme: Theme_v3): Properties {
|
|
73
|
+
return {
|
|
74
|
+
[varNames.button.border.width]: px(theme.button.border.width),
|
|
75
|
+
[varNames.button.focusRing.offset]: px(theme.button.focusRing.offset),
|
|
76
|
+
[varNames.button.focusRing.width]: px(theme.button.focusRing.width),
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function buildContainerThemeProperties(theme: Theme_v3): Properties {
|
|
81
|
+
return {
|
|
82
|
+
[varNames.container[0]]: rem(theme.container[0]),
|
|
83
|
+
[varNames.container[1]]: rem(theme.container[1]),
|
|
84
|
+
[varNames.container[2]]: rem(theme.container[2]),
|
|
85
|
+
[varNames.container[3]]: rem(theme.container[3]),
|
|
86
|
+
[varNames.container[4]]: rem(theme.container[4]),
|
|
87
|
+
[varNames.container[5]]: rem(theme.container[5]),
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function buildFontCodeThemeProperties(theme: Theme_v3): Properties {
|
|
92
|
+
const v = varNames.font.code
|
|
93
|
+
const t = theme.font.code
|
|
94
|
+
|
|
95
|
+
const props: Properties = {
|
|
96
|
+
[v.family]: t.family,
|
|
97
|
+
[v.featureSettings]: t.featureSettings || 'normal',
|
|
98
|
+
[v.weights.regular]: t.weights.regular,
|
|
99
|
+
[v.weights.medium]: t.weights.medium,
|
|
100
|
+
[v.weights.semibold]: t.weights.semibold,
|
|
101
|
+
[v.weights.bold]: t.weights.bold,
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
for (const size of FONT_CODE_SIZE) {
|
|
105
|
+
const _v = varNames.font.code.sizes[size]
|
|
106
|
+
const _t = theme.font.code.sizes[size]
|
|
107
|
+
|
|
108
|
+
props[_v.fontSize] = rem(_t.fontSize)
|
|
109
|
+
props[_v.lineHeight] = rem(_t.lineHeight)
|
|
110
|
+
props[_v.ascenderHeight] = rem(_t.ascenderHeight)
|
|
111
|
+
props[_v.descenderHeight] = rem(_t.descenderHeight)
|
|
112
|
+
props[_v.letterSpacing] = rem(_t.letterSpacing)
|
|
113
|
+
props[_v.iconSize] = rem(_t.iconSize)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return props
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function buildFontHeadingThemeProperties(theme: Theme_v3): Properties {
|
|
120
|
+
const v = varNames.font.heading
|
|
121
|
+
const t = theme.font.heading
|
|
122
|
+
|
|
123
|
+
const props: Properties = {
|
|
124
|
+
[v.family]: t.family,
|
|
125
|
+
[v.featureSettings]: t.featureSettings,
|
|
126
|
+
[v.weights.regular]: t.weights.regular,
|
|
127
|
+
[v.weights.medium]: t.weights.medium,
|
|
128
|
+
[v.weights.semibold]: t.weights.semibold,
|
|
129
|
+
[v.weights.bold]: t.weights.bold,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
for (const size of FONT_HEADING_SIZE) {
|
|
133
|
+
const _v = v.sizes[size]
|
|
134
|
+
const _t = t.sizes[size]
|
|
135
|
+
|
|
136
|
+
props[_v.fontSize] = rem(_t.fontSize)
|
|
137
|
+
props[_v.lineHeight] = rem(_t.lineHeight)
|
|
138
|
+
props[_v.ascenderHeight] = rem(_t.ascenderHeight)
|
|
139
|
+
props[_v.descenderHeight] = rem(_t.descenderHeight)
|
|
140
|
+
props[_v.letterSpacing] = rem(_t.letterSpacing)
|
|
141
|
+
props[_v.iconSize] = rem(_t.iconSize)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return props
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function buildFontLabelThemeProperties(theme: Theme_v3): Properties {
|
|
148
|
+
const v = varNames.font.label
|
|
149
|
+
const t = theme.font.label
|
|
150
|
+
|
|
151
|
+
const props: Properties = {
|
|
152
|
+
[v.family]: t.family,
|
|
153
|
+
[v.featureSettings]: t.featureSettings,
|
|
154
|
+
[v.weights.regular]: t.weights.regular,
|
|
155
|
+
[v.weights.medium]: t.weights.medium,
|
|
156
|
+
[v.weights.semibold]: t.weights.semibold,
|
|
157
|
+
[v.weights.bold]: t.weights.bold,
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
for (const size of FONT_LABEL_SIZE) {
|
|
161
|
+
const _v = v.sizes[size]
|
|
162
|
+
const _t = t.sizes[size]
|
|
163
|
+
|
|
164
|
+
props[_v.fontSize] = rem(_t.fontSize)
|
|
165
|
+
props[_v.lineHeight] = rem(_t.lineHeight)
|
|
166
|
+
props[_v.ascenderHeight] = rem(_t.ascenderHeight)
|
|
167
|
+
props[_v.descenderHeight] = rem(_t.descenderHeight)
|
|
168
|
+
props[_v.letterSpacing] = rem(_t.letterSpacing)
|
|
169
|
+
props[_v.iconSize] = rem(_t.iconSize)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return props
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function buildFontTextThemeProperties(theme: Theme_v3): Properties {
|
|
176
|
+
const v = varNames.font.text
|
|
177
|
+
const t = theme.font.text
|
|
178
|
+
|
|
179
|
+
const props: Properties = {
|
|
180
|
+
[v.family]: t.family,
|
|
181
|
+
[v.featureSettings]: t.featureSettings,
|
|
182
|
+
[v.weights.regular]: t.weights.regular,
|
|
183
|
+
[v.weights.medium]: t.weights.medium,
|
|
184
|
+
[v.weights.semibold]: t.weights.semibold,
|
|
185
|
+
[v.weights.bold]: t.weights.bold,
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
for (const size of FONT_TEXT_SIZE) {
|
|
189
|
+
const _v = v.sizes[size]
|
|
190
|
+
const _t = t.sizes[size]
|
|
191
|
+
|
|
192
|
+
props[_v.fontSize] = rem(_t.fontSize)
|
|
193
|
+
props[_v.lineHeight] = rem(_t.lineHeight)
|
|
194
|
+
props[_v.ascenderHeight] = rem(_t.ascenderHeight)
|
|
195
|
+
props[_v.descenderHeight] = rem(_t.descenderHeight)
|
|
196
|
+
props[_v.letterSpacing] = rem(_t.letterSpacing)
|
|
197
|
+
props[_v.iconSize] = rem(_t.iconSize)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return props
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function buildInputThemeProperties(theme: Theme_v3): Properties {
|
|
204
|
+
return {
|
|
205
|
+
[varNames.input.border.width]: px(theme.input.border.width),
|
|
206
|
+
[varNames.input.checkbox.focusRing.offset]: px(theme.input.checkbox.focusRing.offset),
|
|
207
|
+
[varNames.input.checkbox.focusRing.width]: px(theme.input.checkbox.focusRing.width),
|
|
208
|
+
[varNames.input.checkbox.size]: rem(theme.input.checkbox.size),
|
|
209
|
+
[varNames.input.radio.focusRing.offset]: px(theme.input.radio.focusRing.offset),
|
|
210
|
+
[varNames.input.radio.focusRing.width]: px(theme.input.radio.focusRing.width),
|
|
211
|
+
[varNames.input.radio.markSize]: rem(theme.input.radio.markSize),
|
|
212
|
+
[varNames.input.radio.size]: rem(theme.input.radio.size),
|
|
213
|
+
[varNames.input.select.focusRing.offset]: px(theme.input.select.focusRing.offset),
|
|
214
|
+
[varNames.input.select.focusRing.width]: px(theme.input.select.focusRing.width),
|
|
215
|
+
[varNames.input.switch.focusRing.offset]: px(theme.input.switch.focusRing.offset),
|
|
216
|
+
[varNames.input.switch.focusRing.width]: px(theme.input.switch.focusRing.width),
|
|
217
|
+
[varNames.input.switch.height]: rem(theme.input.switch.height),
|
|
218
|
+
[varNames.input.switch.padding]: rem(theme.input.switch.padding),
|
|
219
|
+
[varNames.input.switch.transitionDurationMs]: `${theme.input.switch.transitionDurationMs}ms`,
|
|
220
|
+
[varNames.input.switch.transitionTimingFunction]: theme.input.switch.transitionTimingFunction,
|
|
221
|
+
[varNames.input.switch.width]: rem(theme.input.switch.width),
|
|
222
|
+
[varNames.input.text.focusRing.offset]: px(theme.input.text.focusRing.offset),
|
|
223
|
+
[varNames.input.text.focusRing.width]: px(theme.input.text.focusRing.width),
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function buildRadiusThemeProperties(theme: Theme_v3): Properties {
|
|
228
|
+
return {
|
|
229
|
+
[varNames.radius[0]]: px(theme.radius[0]),
|
|
230
|
+
[varNames.radius[1]]: px(theme.radius[1]),
|
|
231
|
+
[varNames.radius[2]]: px(theme.radius[2]),
|
|
232
|
+
[varNames.radius[3]]: px(theme.radius[3]),
|
|
233
|
+
[varNames.radius[4]]: px(theme.radius[4]),
|
|
234
|
+
[varNames.radius[5]]: px(theme.radius[5]),
|
|
235
|
+
[varNames.radius[6]]: px(theme.radius[6]),
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function buildShadowThemeProperties(theme: Theme_v3): Properties {
|
|
240
|
+
return {
|
|
241
|
+
[varNames.shadow[0].umbra]: toBoxShadow(theme.shadow[0]?.umbra),
|
|
242
|
+
[varNames.shadow[0].penumbra]: toBoxShadow(theme.shadow[0]?.penumbra),
|
|
243
|
+
[varNames.shadow[0].ambient]: toBoxShadow(theme.shadow[0]?.ambient),
|
|
244
|
+
|
|
245
|
+
[varNames.shadow[1].umbra]: toBoxShadow(theme.shadow[1]?.umbra),
|
|
246
|
+
[varNames.shadow[1].penumbra]: toBoxShadow(theme.shadow[1]?.penumbra),
|
|
247
|
+
[varNames.shadow[1].ambient]: toBoxShadow(theme.shadow[1]?.ambient),
|
|
248
|
+
|
|
249
|
+
[varNames.shadow[2].umbra]: toBoxShadow(theme.shadow[2]?.umbra),
|
|
250
|
+
[varNames.shadow[2].penumbra]: toBoxShadow(theme.shadow[2]?.penumbra),
|
|
251
|
+
[varNames.shadow[2].ambient]: toBoxShadow(theme.shadow[2]?.ambient),
|
|
252
|
+
|
|
253
|
+
[varNames.shadow[3].umbra]: toBoxShadow(theme.shadow[3]?.umbra),
|
|
254
|
+
[varNames.shadow[3].penumbra]: toBoxShadow(theme.shadow[3]?.penumbra),
|
|
255
|
+
[varNames.shadow[3].ambient]: toBoxShadow(theme.shadow[3]?.ambient),
|
|
256
|
+
|
|
257
|
+
[varNames.shadow[4].umbra]: toBoxShadow(theme.shadow[4]?.umbra),
|
|
258
|
+
[varNames.shadow[4].penumbra]: toBoxShadow(theme.shadow[4]?.penumbra),
|
|
259
|
+
[varNames.shadow[4].ambient]: toBoxShadow(theme.shadow[4]?.ambient),
|
|
260
|
+
|
|
261
|
+
[varNames.shadow[5].umbra]: toBoxShadow(theme.shadow[5]?.umbra),
|
|
262
|
+
[varNames.shadow[5].penumbra]: toBoxShadow(theme.shadow[5]?.penumbra),
|
|
263
|
+
[varNames.shadow[5].ambient]: toBoxShadow(theme.shadow[5]?.ambient),
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function buildSpaceThemeProperties(theme: Theme_v3): Properties {
|
|
268
|
+
return {
|
|
269
|
+
[varNames.space[0]]: px(theme.space[0]),
|
|
270
|
+
[varNames.space[0.5]]: px(theme.space[1] / 2),
|
|
271
|
+
[varNames.space[1]]: px(theme.space[1]),
|
|
272
|
+
[varNames.space[2]]: px(theme.space[2]),
|
|
273
|
+
[varNames.space[3]]: px(theme.space[3]),
|
|
274
|
+
[varNames.space[4]]: px(theme.space[4]),
|
|
275
|
+
[varNames.space[5]]: px(theme.space[5]),
|
|
276
|
+
[varNames.space[6]]: px(theme.space[6]),
|
|
277
|
+
[varNames.space[7]]: px(theme.space[7]),
|
|
278
|
+
[varNames.space[8]]: px(theme.space[8]),
|
|
279
|
+
[varNames.space[9]]: px(theme.space[9]),
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function buildColorThemeProperties(theme: Theme_v3): Properties {
|
|
284
|
+
const props: Properties = {}
|
|
285
|
+
|
|
286
|
+
for (const scheme of THEME_COLOR_SCHEMES) {
|
|
287
|
+
for (const cardTone of THEME_COLOR_CARD_TONES) {
|
|
288
|
+
Object.assign(props, buildColorAvatarThemeProperties(theme, {scheme, cardTone}))
|
|
289
|
+
Object.assign(props, buildColorCardThemeProperties(theme, {scheme, cardTone}))
|
|
290
|
+
|
|
291
|
+
for (const colorVariant of THEME_COLOR_VARIANTS) {
|
|
292
|
+
for (const elementTone of THEME_COLOR_STATE_TONES) {
|
|
293
|
+
// shorthand to variable names
|
|
294
|
+
const v = varNames.color[scheme][cardTone][colorVariant][elementTone]
|
|
295
|
+
|
|
296
|
+
// shorthand to values
|
|
297
|
+
const t = theme._tokens.color[cardTone].variant[colorVariant][elementTone]
|
|
298
|
+
|
|
299
|
+
const context: RenderColorContext = {
|
|
300
|
+
bgVar: v.bg[0],
|
|
301
|
+
hue: t._hue,
|
|
302
|
+
scheme,
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
Object.assign(props, {
|
|
306
|
+
[v.bg[0]]: renderColor(t.bg[0], context),
|
|
307
|
+
[v.bg[1]]: `color-mix(in srgb, var(${v.bg[0]}), var(${v.bg[4]}) 25%)`,
|
|
308
|
+
[v.bg[2]]: `color-mix(in srgb, var(${v.bg[0]}), var(${v.bg[4]}) 50%)`,
|
|
309
|
+
[v.bg[3]]: `color-mix(in srgb, var(${v.bg[0]}), var(${v.bg[4]}) 75%)`,
|
|
310
|
+
[v.bg[4]]: renderColor(t.bg[4], context),
|
|
311
|
+
|
|
312
|
+
[v.border[0]]: renderColor(t.border[0], context),
|
|
313
|
+
[v.border[1]]: `color-mix(in srgb, var(${v.border[0]}), var(${v.border[4]}) 25%)`,
|
|
314
|
+
[v.border[2]]: `color-mix(in srgb, var(${v.border[0]}), var(${v.border[4]}) 50%)`,
|
|
315
|
+
[v.border[3]]: `color-mix(in srgb, var(${v.border[0]}), var(${v.border[4]}) 75%)`,
|
|
316
|
+
[v.border[4]]: renderColor(t.border[4], context),
|
|
317
|
+
|
|
318
|
+
[v.fg[0]]: renderColor(t.fg[0], context),
|
|
319
|
+
[v.fg[1]]: `color-mix(in srgb, var(${v.fg[0]}), var(${v.fg[4]}) 25%)`,
|
|
320
|
+
[v.fg[2]]: `color-mix(in srgb, var(${v.fg[0]}), var(${v.fg[4]}) 50%)`,
|
|
321
|
+
[v.fg[3]]: `color-mix(in srgb, var(${v.fg[0]}), var(${v.fg[4]}) 75%)`,
|
|
322
|
+
[v.fg[4]]: renderColor(t.fg[4], context),
|
|
323
|
+
} satisfies Properties)
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return props as Properties
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function buildColorAvatarThemeProperties(
|
|
333
|
+
theme: Theme_v3,
|
|
334
|
+
options: {scheme: ThemeColorSchemeKey; cardTone: ThemeColorCardToneKey},
|
|
335
|
+
): Properties {
|
|
336
|
+
const {scheme, cardTone} = options
|
|
337
|
+
|
|
338
|
+
const v = varNames.color[scheme][cardTone]
|
|
339
|
+
const t = theme._tokens.color[cardTone]
|
|
340
|
+
|
|
341
|
+
const props: Properties = {}
|
|
342
|
+
|
|
343
|
+
for (const hue of HUES) {
|
|
344
|
+
const context: RenderColorContext = {
|
|
345
|
+
bgVar: varNames.color.bg,
|
|
346
|
+
hue: t.avatar[hue]._hue ?? hue,
|
|
347
|
+
scheme,
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
Object.assign(props, {
|
|
351
|
+
[v.avatar[hue].bg]: renderColor(t.avatar[hue].bg, context),
|
|
352
|
+
[v.avatar[hue].fg]: renderColor(t.avatar[hue].fg, context),
|
|
353
|
+
} satisfies Properties)
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return props
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function buildColorCardThemeProperties(
|
|
360
|
+
theme: Theme_v3,
|
|
361
|
+
options: {scheme: ThemeColorSchemeKey; cardTone: ThemeColorCardToneKey},
|
|
362
|
+
): Properties {
|
|
363
|
+
const {scheme, cardTone} = options
|
|
364
|
+
|
|
365
|
+
const v = varNames.color[scheme][cardTone]
|
|
366
|
+
const t = theme._tokens.color[cardTone]
|
|
367
|
+
|
|
368
|
+
const context: RenderColorContext = {
|
|
369
|
+
bgVar: varNames.color.bg,
|
|
370
|
+
hue: t._hue,
|
|
371
|
+
scheme,
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const props: Properties = {
|
|
375
|
+
// backdrop
|
|
376
|
+
[v.backdrop]: renderColor(t.backdrop, context),
|
|
377
|
+
|
|
378
|
+
// code
|
|
379
|
+
[v.code.bg]: renderColor(t.code.bg, context),
|
|
380
|
+
[v.code.fg]: renderColor(t.code.fg, context),
|
|
381
|
+
|
|
382
|
+
// code / token
|
|
383
|
+
[v.code.token.atrule]: renderColor(t.code.token.atrule, context),
|
|
384
|
+
[v.code.token.attrName]: renderColor(t.code.token.attrName, context),
|
|
385
|
+
[v.code.token.attrValue]: renderColor(t.code.token.attrValue, context),
|
|
386
|
+
[v.code.token.attribute]: renderColor(t.code.token.attribute, context),
|
|
387
|
+
[v.code.token.boolean]: renderColor(t.code.token.boolean, context),
|
|
388
|
+
[v.code.token.builtin]: renderColor(t.code.token.builtin, context),
|
|
389
|
+
[v.code.token.cdata]: renderColor(t.code.token.cdata, context),
|
|
390
|
+
[v.code.token.char]: renderColor(t.code.token.char, context),
|
|
391
|
+
[v.code.token.className]: renderColor(t.code.token.className, context),
|
|
392
|
+
[v.code.token.class]: renderColor(t.code.token.class, context),
|
|
393
|
+
[v.code.token.comment]: renderColor(t.code.token.comment, context),
|
|
394
|
+
[v.code.token.constant]: renderColor(t.code.token.constant, context),
|
|
395
|
+
[v.code.token.deleted]: renderColor(t.code.token.deleted, context),
|
|
396
|
+
[v.code.token.doctype]: renderColor(t.code.token.doctype, context),
|
|
397
|
+
[v.code.token.entity]: renderColor(t.code.token.entity, context),
|
|
398
|
+
[v.code.token.function]: renderColor(t.code.token.function, context),
|
|
399
|
+
[v.code.token.hexcode]: renderColor(t.code.token.hexcode, context),
|
|
400
|
+
[v.code.token.id]: renderColor(t.code.token.id, context),
|
|
401
|
+
[v.code.token.important]: renderColor(t.code.token.important, context),
|
|
402
|
+
[v.code.token.inserted]: renderColor(t.code.token.inserted, context),
|
|
403
|
+
[v.code.token.keyword]: renderColor(t.code.token.keyword, context),
|
|
404
|
+
[v.code.token.number]: renderColor(t.code.token.number, context),
|
|
405
|
+
[v.code.token.operator]: renderColor(t.code.token.operator, context),
|
|
406
|
+
[v.code.token.prolog]: renderColor(t.code.token.prolog, context),
|
|
407
|
+
[v.code.token.property]: renderColor(t.code.token.property, context),
|
|
408
|
+
[v.code.token.pseudoClass]: renderColor(t.code.token.pseudoClass, context),
|
|
409
|
+
[v.code.token.pseudoElement]: renderColor(t.code.token.pseudoElement, context),
|
|
410
|
+
[v.code.token.punctuation]: renderColor(t.code.token.punctuation, context),
|
|
411
|
+
[v.code.token.regex]: renderColor(t.code.token.regex, context),
|
|
412
|
+
[v.code.token.selector]: renderColor(t.code.token.selector, context),
|
|
413
|
+
[v.code.token.string]: renderColor(t.code.token.string, context),
|
|
414
|
+
[v.code.token.symbol]: renderColor(t.code.token.symbol, context),
|
|
415
|
+
[v.code.token.tag]: renderColor(t.code.token.tag, context),
|
|
416
|
+
[v.code.token.unit]: renderColor(t.code.token.unit, context),
|
|
417
|
+
[v.code.token.url]: renderColor(t.code.token.url, context),
|
|
418
|
+
[v.code.token.variable]: renderColor(t.code.token.variable, context),
|
|
419
|
+
|
|
420
|
+
// focus ring
|
|
421
|
+
[v.focusRing]: renderColor(t.focusRing, context),
|
|
422
|
+
|
|
423
|
+
// link
|
|
424
|
+
[v.link.fg]: renderColor(t.link.fg, context),
|
|
425
|
+
|
|
426
|
+
// shadow
|
|
427
|
+
[v.shadow.outline]: renderColor(t.shadow.outline, context),
|
|
428
|
+
[v.shadow.umbra]: renderColor(t.shadow.umbra, context),
|
|
429
|
+
[v.shadow.penumbra]: renderColor(t.shadow.penumbra, context),
|
|
430
|
+
[v.shadow.ambient]: renderColor(t.shadow.ambient, context),
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
return props
|
|
434
|
+
}
|
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
import {_comp} from '../../_comp'
|
|
2
2
|
import {inset} from '../../aspects'
|
|
3
3
|
|
|
4
|
+
/** @public */
|
|
4
5
|
export function dialog(): string | undefined {
|
|
5
6
|
return _comp('dialog', inset({inset: 0}))
|
|
6
7
|
}
|
|
7
8
|
|
|
9
|
+
/** @public */
|
|
8
10
|
export function dialogContainer(): string | undefined {
|
|
9
11
|
return _comp('dialog-container')
|
|
10
12
|
}
|
|
11
13
|
|
|
14
|
+
/** @public */
|
|
12
15
|
export function dialogCardRoot(): string | undefined {
|
|
13
16
|
return _comp('dialog-card-root')
|
|
14
17
|
}
|
|
15
18
|
|
|
19
|
+
/** @public */
|
|
16
20
|
export function dialogLayout(): string | undefined {
|
|
17
21
|
return _comp('dialog-layout')
|
|
18
22
|
}
|
|
19
23
|
|
|
24
|
+
/** @public */
|
|
20
25
|
export function dialogHeader(): string | undefined {
|
|
21
26
|
return _comp('dialog-header')
|
|
22
27
|
}
|
|
23
28
|
|
|
29
|
+
/** @public */
|
|
24
30
|
export function dialogContent(): string | undefined {
|
|
25
31
|
return _comp('dialog-content')
|
|
26
32
|
}
|
|
27
33
|
|
|
34
|
+
/** @public */
|
|
28
35
|
export function dialogFooter(): string | undefined {
|
|
29
36
|
return _comp('dialog-footer')
|
|
30
37
|
}
|
|
@@ -2,10 +2,14 @@ import {FONT_CODE_SIZE, FONT_HEADING_SIZE, FONT_LABEL_SIZE, FONT_TEXT_SIZE} from
|
|
|
2
2
|
|
|
3
3
|
import {_responsiveRule} from '../../_responsiveRule'
|
|
4
4
|
import {Style, StyleKeyframes, StyleRules} from '../../types'
|
|
5
|
+
import {varNames} from '../../varNames'
|
|
5
6
|
import {vars} from '../../vars'
|
|
6
7
|
|
|
8
|
+
// TODO: should keyframes be prefixed?
|
|
9
|
+
const KEYFRAMES_PULSE = 'skeleton-pulse'
|
|
10
|
+
|
|
7
11
|
const keyframes: StyleKeyframes = {
|
|
8
|
-
|
|
12
|
+
[KEYFRAMES_PULSE]: {
|
|
9
13
|
'0%': {
|
|
10
14
|
backgroundPosition: '100%',
|
|
11
15
|
},
|
|
@@ -17,8 +21,8 @@ const keyframes: StyleKeyframes = {
|
|
|
17
21
|
|
|
18
22
|
const component: StyleRules = {
|
|
19
23
|
'.skeleton': {
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
[varNames.color.skeleton.from]: `color-mix(in srgb, transparent, ${vars.color.muted.fg} 5%)`,
|
|
25
|
+
[varNames.color.skeleton.to]: `color-mix(in srgb, transparent, ${vars.color.muted.fg} 10%)`,
|
|
22
26
|
|
|
23
27
|
'backgroundColor': vars.color.skeleton.from,
|
|
24
28
|
'backgroundPosition': '100%',
|
|
@@ -38,7 +42,7 @@ const component: StyleRules = {
|
|
|
38
42
|
vars.color.skeleton.from,
|
|
39
43
|
`)`,
|
|
40
44
|
].join(', '),
|
|
41
|
-
animationName:
|
|
45
|
+
animationName: KEYFRAMES_PULSE,
|
|
42
46
|
animationTimingFunction: 'ease-in-out',
|
|
43
47
|
animationIterationCount: 'infinite',
|
|
44
48
|
animationDuration: '2000ms',
|
|
@@ -14,18 +14,22 @@ export function skeleton(props: SkeletonStyleProps): string | undefined {
|
|
|
14
14
|
return _comp('skeleton', radius(props))
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/** @beta */
|
|
17
18
|
export function codeSkeleton(props: CodeSkeletonStyleProps): string | undefined {
|
|
18
19
|
return _comp('font-skeleton', _resp('code-skeleton', props.size))
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
/** @beta */
|
|
21
23
|
export function headingSkeleton(props: HeadingSkeletonStyleProps): string | undefined {
|
|
22
24
|
return _comp('font-skeleton', _resp('heading-skeleton', props.size))
|
|
23
25
|
}
|
|
24
26
|
|
|
27
|
+
/** @beta */
|
|
25
28
|
export function labelSkeleton(props: LabelSkeletonStyleProps): string | undefined {
|
|
26
29
|
return _comp('font-skeleton', _resp('label-skeleton', props.size))
|
|
27
30
|
}
|
|
28
31
|
|
|
32
|
+
/** @beta */
|
|
29
33
|
export function textSkeleton(props: TextSkeletonStyleProps): string | undefined {
|
|
30
34
|
return _comp('font-skeleton', _resp('text-skeleton', props.size))
|
|
31
35
|
}
|
|
@@ -9,18 +9,22 @@ export interface SkeletonStyleProps extends RadiusStyleProps {
|
|
|
9
9
|
// visible?: boolean
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/** @beta */
|
|
12
13
|
export interface CodeSkeletonStyleProps {
|
|
13
14
|
size?: ResponsiveProp<FontCodeSize>
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
/** @beta */
|
|
16
18
|
export interface HeadingSkeletonStyleProps {
|
|
17
19
|
size?: ResponsiveProp<FontHeadingSize>
|
|
18
20
|
}
|
|
19
21
|
|
|
22
|
+
/** @beta */
|
|
20
23
|
export interface LabelSkeletonStyleProps {
|
|
21
24
|
size?: ResponsiveProp<FontLabelSize>
|
|
22
25
|
}
|
|
23
26
|
|
|
27
|
+
/** @beta */
|
|
24
28
|
export interface TextSkeletonStyleProps {
|
|
25
29
|
size?: ResponsiveProp<FontTextSize>
|
|
26
30
|
}
|