@sanity/ui 3.0.0-static.0 → 3.0.0-static.1
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/buildCommand.js +1387 -681
- package/dist/_chunks-cjs/buildCommand.js.map +1 -1
- package/dist/cli.js +4 -2
- package/dist/cli.js.map +1 -1
- package/dist/css.d.mts +131 -12
- package/dist/css.d.ts +131 -12
- package/dist/css.esm.js +1450 -791
- package/dist/css.esm.js.map +1 -1
- package/dist/css.js +1449 -790
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +1450 -791
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +84 -76
- package/dist/index.d.ts +84 -76
- package/dist/index.esm.js +2734 -3146
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2733 -3145
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2734 -3146
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-theme.css +1 -1
- package/dist/system.css +1590 -1158
- package/dist/theme.esm.js +1565 -452
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +1599 -484
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1565 -452
- package/dist/theme.mjs.map +1 -1
- package/package.json +22 -22
- package/src/core/__workshop__/constants.ts +14 -5
- package/src/core/__workshop__/fontsPlugin.tsx +1 -1
- package/src/core/_compat/index.ts +2 -0
- package/src/core/{styles → _compat/styles}/box/boxStyle.ts +1 -1
- package/src/core/{styles → _compat/styles}/box/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/card/_cardColorStyle.ts +2 -2
- package/src/core/{styles → _compat/styles}/flex/flexItemStyle.ts +1 -1
- package/src/core/{styles → _compat/styles}/font/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/grid/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/helpers.ts +1 -1
- package/src/core/{styles → _compat/styles}/input/textInputStyle.ts +2 -2
- package/src/core/{styles → _compat/styles}/radius/types.ts +1 -1
- package/src/core/{styles → _compat/styles}/shadow/shadowStyle.ts +1 -1
- package/src/core/components/autocomplete/__workshop__/custom.tsx +5 -4
- package/src/core/components/autocomplete/__workshop__/example.tsx +3 -2
- package/src/core/components/autocomplete/autocomplete.tsx +5 -5
- package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
- package/src/core/components/dialog/__workshop__/props.tsx +2 -0
- package/src/core/components/dialog/dialog.tsx +1 -5
- package/src/core/components/hotkeys/hotkeys.tsx +1 -1
- package/src/core/components/menu/menu.tsx +8 -10
- package/src/core/components/menu/menuDivider.tsx +16 -0
- package/src/core/components/menu/menuGroup.tsx +2 -8
- package/src/core/components/menu/menuItem.tsx +1 -1
- package/src/core/components/skeleton/skeleton.tsx +14 -20
- package/src/core/components/skeleton/textSkeleton.tsx +72 -48
- package/src/core/components/tab/tab.tsx +0 -1
- package/src/core/components/tab/tabList.tsx +4 -21
- package/src/core/components/tab/tabPanel.tsx +1 -0
- package/src/core/components/toast/toast.tsx +27 -14
- package/src/core/components/toast/toastProvider.tsx +4 -13
- package/src/core/components/tree/tree.tsx +1 -2
- package/src/core/components/tree/treeGroup.tsx +4 -1
- package/src/core/components/tree/treeItem.tsx +11 -15
- package/src/core/hooks/useArrayProp.ts +1 -1
- package/src/core/index.ts +0 -1
- package/src/core/lib/styled/members.ts +2 -2
- package/src/core/primitives/avatar/avatar.tsx +0 -21
- package/src/core/primitives/avatar/avatarCounter.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +1 -1
- package/src/core/primitives/avatar/styles.ts +2 -2
- package/src/core/primitives/box/box.tsx +4 -1
- package/src/core/primitives/button/__workshop__/props.tsx +2 -1
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
- package/src/core/primitives/button/__workshop__/stacked.tsx +2 -1
- package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
- package/src/core/primitives/button/styles.ts +3 -3
- package/src/core/primitives/card/__workshop__/props.tsx +2 -2
- package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
- package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
- package/src/core/primitives/card/card.tsx +7 -10
- package/src/core/primitives/code/code.tsx +2 -4
- package/src/core/primitives/container/styles.ts +1 -1
- package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/flex.tsx +1 -13
- package/src/core/primitives/grid/grid.tsx +5 -19
- package/src/core/primitives/heading/heading.tsx +8 -25
- package/src/core/primitives/heading/styles.ts +1 -1
- package/src/core/primitives/inline/inline.tsx +3 -12
- package/src/core/primitives/inline/styles.ts +1 -1
- package/src/core/primitives/label/label.tsx +4 -9
- package/src/core/primitives/label/styles.ts +1 -1
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +2 -2
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -1
- package/src/core/primitives/popover/popover.tsx +1 -1
- package/src/core/primitives/popover/popoverCard.tsx +1 -1
- package/src/core/primitives/radio/radio.tsx +1 -1
- package/src/core/primitives/radio/styles.ts +2 -2
- package/src/core/primitives/select/select.tsx +1 -1
- package/src/core/primitives/select/styles.ts +3 -3
- package/src/core/primitives/spinner/__workshop__/Props.tsx +2 -1
- package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +16 -0
- package/src/core/primitives/spinner/spinner.tsx +2 -2
- package/src/core/primitives/stack/styles.ts +1 -1
- package/src/core/primitives/switch/styles.ts +2 -2
- package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
- package/src/core/primitives/text/styles.ts +1 -1
- package/src/core/primitives/text/text.tsx +1 -4
- package/src/core/primitives/textArea/__workshop__/plain.tsx +2 -2
- package/src/core/primitives/textArea/textArea.tsx +3 -3
- package/src/core/primitives/textInput/__workshop__/plain.tsx +3 -2
- package/src/core/primitives/textInput/textInput.tsx +16 -83
- package/src/core/primitives/tooltip/tooltipCard.tsx +5 -5
- package/src/core/primitives/types.ts +1 -0
- package/src/core/theme/__workshop__/build/Root.tsx +1 -1
- package/src/core/theme/__workshop__/build/story.tsx +2 -4
- package/src/core/theme/themeProvider.tsx +1 -1
- package/src/core/types/box.ts +22 -16
- package/src/core/types/grid.ts +17 -12
- package/src/core/types/text.ts +7 -4
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
- package/src/core/utils/layer/layer.tsx +2 -2
- package/src/core/utils/virtualList/virtualList.tsx +1 -1
- package/src/css/compile/{comileRules.ts → compileRules.ts} +2 -5
- package/src/css/compile/compileSystem.ts +1 -1
- package/src/css/compile/compileTheme.ts +4 -1
- package/src/css/components/breadcrumbs/rules.ts +18 -0
- package/src/css/components/menu/index.ts +1 -0
- package/src/css/components/menu/menu.ts +5 -0
- package/src/css/components/menu/rules.ts +10 -0
- package/src/css/components/skeleton/index.ts +2 -0
- package/src/css/components/skeleton/rules.ts +106 -0
- package/src/css/components/skeleton/skeleton.ts +31 -0
- package/src/css/components/skeleton/types.ts +24 -0
- package/src/css/components/toast/rules.ts +68 -0
- package/src/css/components/tree/rules.ts +115 -0
- package/src/css/index.ts +4 -0
- package/src/css/primitives/box/box.ts +5 -1
- package/src/css/primitives/box/types.ts +7 -8
- package/src/css/primitives/card/rules.ts +161 -13
- package/src/css/primitives/checkbox/__styles.ts +115 -113
- package/src/css/primitives/selectable/__style.ts +117 -115
- package/src/css/primitives/spinner/rules.ts +5 -7
- package/src/css/primitives/spinner/spinner.ts +4 -0
- package/src/css/primitives/textInput/index.ts +1 -0
- package/src/css/primitives/textInput/rules.ts +159 -64
- package/src/css/primitives/textInput/textInput.ts +11 -3
- package/src/css/primitives/textInput/types.ts +8 -0
- package/src/css/rules.ts +16 -38
- package/src/css/styles/font/font.ts +7 -2
- package/src/css/styles/font/rules.ts +23 -0
- package/src/css/styles/font/types.ts +6 -0
- package/src/css/styles/gap/rules.ts +6 -6
- package/src/css/styles/grid/grid.ts +13 -0
- package/src/css/styles/grid/index.ts +2 -0
- package/src/css/styles/grid/rules.ts +112 -1
- package/src/css/styles/grid/types.ts +29 -0
- package/src/css/styles/margin/rules.ts +58 -54
- package/src/css/styles/outline/rules.ts +7 -0
- package/src/css/styles/overflow/index.ts +2 -0
- package/src/css/styles/overflow/overflow.ts +11 -0
- package/src/css/styles/overflow/types.ts +11 -0
- package/src/css/styles/padding/rules.ts +50 -48
- package/src/css/types.ts +36 -1
- package/src/css/varNames.ts +1 -1
- package/src/css/vars.ts +86 -0
- package/dist/_chunks-cjs/getTheme_v2.js +0 -316
- package/dist/_chunks-cjs/getTheme_v2.js.map +0 -1
- package/dist/_chunks-es/getTheme_v2.mjs +0 -317
- package/dist/_chunks-es/getTheme_v2.mjs.map +0 -1
- package/dist/_legacy/getTheme_v2.esm.js +0 -317
- package/dist/_legacy/getTheme_v2.esm.js.map +0 -1
- package/src/core/components/autocomplete/autocomplete.styles.tsx +0 -38
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +0 -17
- package/src/core/components/menu/menuDivider.ts +0 -13
- package/src/core/components/skeleton/styles.ts +0 -50
- package/src/core/components/toast/styles.ts +0 -61
- package/src/core/components/tree/style.ts +0 -104
- package/src/core/primitives/card/styles.ts +0 -146
- /package/src/core/{styles → _compat/styles}/border/borderStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/border/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/border/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/box/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/card/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/flex/flexStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/flex/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/flex/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/focusRing/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/codeFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/headingFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/labelFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/responsiveFont.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/textAlignStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/font/textFontStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/grid/gridItemStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/grid/gridStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/grid/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/input/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/input/responsiveInputPaddingStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/internal.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/marginStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/marginsStyle.test.ts +0 -0
- /package/src/core/{styles → _compat/styles}/margin/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/paddingStyle.test.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/paddingStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/padding/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/radius/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/radius/radiusStyle.ts +0 -0
- /package/src/core/{styles → _compat/styles}/shadow/index.ts +0 -0
- /package/src/core/{styles → _compat/styles}/shadow/types.ts +0 -0
- /package/src/core/{styles → _compat/styles}/types.ts +0 -0
- /package/src/core/{_compat.ts → _compat/types.ts} +0 -0
package/dist/theme.esm.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { defaultThemeConfig, themeColor_v0_v2 } from "./_legacy/getTheme_v2.esm.js";
|
|
2
|
-
import { getTheme_v2 } from "./_legacy/getTheme_v2.esm.js";
|
|
3
1
|
import { COLOR_HUES, COLOR_TINTS, color } from "@sanity/color";
|
|
4
2
|
function createSelectableTones(opts, base, dark, solid, muted) {
|
|
5
3
|
return {
|
|
@@ -57,46 +55,226 @@ function _createSelectableStates(opts, base, dark, solid, muted, tone) {
|
|
|
57
55
|
function createSolidTones(opts, base, dark, name) {
|
|
58
56
|
return {
|
|
59
57
|
default: {
|
|
60
|
-
enabled: opts.solid({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
enabled: opts.solid({
|
|
59
|
+
base,
|
|
60
|
+
dark,
|
|
61
|
+
tone: "default",
|
|
62
|
+
name,
|
|
63
|
+
state: "enabled"
|
|
64
|
+
}),
|
|
65
|
+
disabled: opts.solid({
|
|
66
|
+
base,
|
|
67
|
+
dark,
|
|
68
|
+
tone: "default",
|
|
69
|
+
name,
|
|
70
|
+
state: "disabled"
|
|
71
|
+
}),
|
|
72
|
+
hovered: opts.solid({
|
|
73
|
+
base,
|
|
74
|
+
dark,
|
|
75
|
+
tone: "default",
|
|
76
|
+
name,
|
|
77
|
+
state: "hovered"
|
|
78
|
+
}),
|
|
79
|
+
pressed: opts.solid({
|
|
80
|
+
base,
|
|
81
|
+
dark,
|
|
82
|
+
tone: "default",
|
|
83
|
+
name,
|
|
84
|
+
state: "pressed"
|
|
85
|
+
}),
|
|
86
|
+
selected: opts.solid({
|
|
87
|
+
base,
|
|
88
|
+
dark,
|
|
89
|
+
tone: "default",
|
|
90
|
+
name,
|
|
91
|
+
state: "selected"
|
|
92
|
+
})
|
|
65
93
|
},
|
|
66
94
|
transparent: {
|
|
67
|
-
enabled: opts.solid({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
95
|
+
enabled: opts.solid({
|
|
96
|
+
base,
|
|
97
|
+
dark,
|
|
98
|
+
tone: "transparent",
|
|
99
|
+
name,
|
|
100
|
+
state: "enabled"
|
|
101
|
+
}),
|
|
102
|
+
disabled: opts.solid({
|
|
103
|
+
base,
|
|
104
|
+
dark,
|
|
105
|
+
tone: "transparent",
|
|
106
|
+
name,
|
|
107
|
+
state: "disabled"
|
|
108
|
+
}),
|
|
109
|
+
hovered: opts.solid({
|
|
110
|
+
base,
|
|
111
|
+
dark,
|
|
112
|
+
tone: "transparent",
|
|
113
|
+
name,
|
|
114
|
+
state: "hovered"
|
|
115
|
+
}),
|
|
116
|
+
pressed: opts.solid({
|
|
117
|
+
base,
|
|
118
|
+
dark,
|
|
119
|
+
tone: "transparent",
|
|
120
|
+
name,
|
|
121
|
+
state: "pressed"
|
|
122
|
+
}),
|
|
123
|
+
selected: opts.solid({
|
|
124
|
+
base,
|
|
125
|
+
dark,
|
|
126
|
+
tone: "transparent",
|
|
127
|
+
name,
|
|
128
|
+
state: "selected"
|
|
129
|
+
})
|
|
72
130
|
},
|
|
73
131
|
primary: {
|
|
74
|
-
enabled: opts.solid({
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
132
|
+
enabled: opts.solid({
|
|
133
|
+
base,
|
|
134
|
+
dark,
|
|
135
|
+
tone: "primary",
|
|
136
|
+
name,
|
|
137
|
+
state: "enabled"
|
|
138
|
+
}),
|
|
139
|
+
disabled: opts.solid({
|
|
140
|
+
base,
|
|
141
|
+
dark,
|
|
142
|
+
tone: "primary",
|
|
143
|
+
name,
|
|
144
|
+
state: "disabled"
|
|
145
|
+
}),
|
|
146
|
+
hovered: opts.solid({
|
|
147
|
+
base,
|
|
148
|
+
dark,
|
|
149
|
+
tone: "primary",
|
|
150
|
+
name,
|
|
151
|
+
state: "hovered"
|
|
152
|
+
}),
|
|
153
|
+
pressed: opts.solid({
|
|
154
|
+
base,
|
|
155
|
+
dark,
|
|
156
|
+
tone: "primary",
|
|
157
|
+
name,
|
|
158
|
+
state: "pressed"
|
|
159
|
+
}),
|
|
160
|
+
selected: opts.solid({
|
|
161
|
+
base,
|
|
162
|
+
dark,
|
|
163
|
+
tone: "primary",
|
|
164
|
+
name,
|
|
165
|
+
state: "selected"
|
|
166
|
+
})
|
|
79
167
|
},
|
|
80
168
|
positive: {
|
|
81
|
-
enabled: opts.solid({
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
169
|
+
enabled: opts.solid({
|
|
170
|
+
base,
|
|
171
|
+
dark,
|
|
172
|
+
tone: "positive",
|
|
173
|
+
name,
|
|
174
|
+
state: "enabled"
|
|
175
|
+
}),
|
|
176
|
+
disabled: opts.solid({
|
|
177
|
+
base,
|
|
178
|
+
dark,
|
|
179
|
+
tone: "positive",
|
|
180
|
+
name,
|
|
181
|
+
state: "disabled"
|
|
182
|
+
}),
|
|
183
|
+
hovered: opts.solid({
|
|
184
|
+
base,
|
|
185
|
+
dark,
|
|
186
|
+
tone: "positive",
|
|
187
|
+
name,
|
|
188
|
+
state: "hovered"
|
|
189
|
+
}),
|
|
190
|
+
pressed: opts.solid({
|
|
191
|
+
base,
|
|
192
|
+
dark,
|
|
193
|
+
tone: "positive",
|
|
194
|
+
name,
|
|
195
|
+
state: "pressed"
|
|
196
|
+
}),
|
|
197
|
+
selected: opts.solid({
|
|
198
|
+
base,
|
|
199
|
+
dark,
|
|
200
|
+
tone: "positive",
|
|
201
|
+
name,
|
|
202
|
+
state: "selected"
|
|
203
|
+
})
|
|
86
204
|
},
|
|
87
205
|
caution: {
|
|
88
|
-
enabled: opts.solid({
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
206
|
+
enabled: opts.solid({
|
|
207
|
+
base,
|
|
208
|
+
dark,
|
|
209
|
+
tone: "caution",
|
|
210
|
+
name,
|
|
211
|
+
state: "enabled"
|
|
212
|
+
}),
|
|
213
|
+
disabled: opts.solid({
|
|
214
|
+
base,
|
|
215
|
+
dark,
|
|
216
|
+
tone: "caution",
|
|
217
|
+
name,
|
|
218
|
+
state: "disabled"
|
|
219
|
+
}),
|
|
220
|
+
hovered: opts.solid({
|
|
221
|
+
base,
|
|
222
|
+
dark,
|
|
223
|
+
tone: "caution",
|
|
224
|
+
name,
|
|
225
|
+
state: "hovered"
|
|
226
|
+
}),
|
|
227
|
+
pressed: opts.solid({
|
|
228
|
+
base,
|
|
229
|
+
dark,
|
|
230
|
+
tone: "caution",
|
|
231
|
+
name,
|
|
232
|
+
state: "pressed"
|
|
233
|
+
}),
|
|
234
|
+
selected: opts.solid({
|
|
235
|
+
base,
|
|
236
|
+
dark,
|
|
237
|
+
tone: "caution",
|
|
238
|
+
name,
|
|
239
|
+
state: "selected"
|
|
240
|
+
})
|
|
93
241
|
},
|
|
94
242
|
critical: {
|
|
95
|
-
enabled: opts.solid({
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
243
|
+
enabled: opts.solid({
|
|
244
|
+
base,
|
|
245
|
+
dark,
|
|
246
|
+
tone: "critical",
|
|
247
|
+
name,
|
|
248
|
+
state: "enabled"
|
|
249
|
+
}),
|
|
250
|
+
disabled: opts.solid({
|
|
251
|
+
base,
|
|
252
|
+
dark,
|
|
253
|
+
tone: "critical",
|
|
254
|
+
name,
|
|
255
|
+
state: "disabled"
|
|
256
|
+
}),
|
|
257
|
+
hovered: opts.solid({
|
|
258
|
+
base,
|
|
259
|
+
dark,
|
|
260
|
+
tone: "critical",
|
|
261
|
+
name,
|
|
262
|
+
state: "hovered"
|
|
263
|
+
}),
|
|
264
|
+
pressed: opts.solid({
|
|
265
|
+
base,
|
|
266
|
+
dark,
|
|
267
|
+
tone: "critical",
|
|
268
|
+
name,
|
|
269
|
+
state: "pressed"
|
|
270
|
+
}),
|
|
271
|
+
selected: opts.solid({
|
|
272
|
+
base,
|
|
273
|
+
dark,
|
|
274
|
+
tone: "critical",
|
|
275
|
+
name,
|
|
276
|
+
state: "selected"
|
|
277
|
+
})
|
|
100
278
|
}
|
|
101
279
|
};
|
|
102
280
|
}
|
|
@@ -287,7 +465,10 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
287
465
|
focusRing: [colors.critical.base, colors.critical.base]
|
|
288
466
|
}
|
|
289
467
|
}, defaultOpts = {
|
|
290
|
-
base: ({
|
|
468
|
+
base: ({
|
|
469
|
+
dark,
|
|
470
|
+
name
|
|
471
|
+
}) => name === "default" ? {
|
|
291
472
|
bg: dark ? black : white,
|
|
292
473
|
fg: dark ? white : black,
|
|
293
474
|
border: dark ? colors.default.darkest : colors.default.lightest,
|
|
@@ -318,7 +499,12 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
318
499
|
to: dark ? white : black
|
|
319
500
|
}
|
|
320
501
|
},
|
|
321
|
-
solid: ({
|
|
502
|
+
solid: ({
|
|
503
|
+
base,
|
|
504
|
+
dark,
|
|
505
|
+
state,
|
|
506
|
+
tone
|
|
507
|
+
}) => {
|
|
322
508
|
const color2 = colors[tone];
|
|
323
509
|
return state === "hovered" ? {
|
|
324
510
|
bg: dark ? color2.light : color2.dark,
|
|
@@ -362,7 +548,12 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
362
548
|
skeleton: base.skeleton
|
|
363
549
|
};
|
|
364
550
|
},
|
|
365
|
-
muted: ({
|
|
551
|
+
muted: ({
|
|
552
|
+
base,
|
|
553
|
+
dark,
|
|
554
|
+
state,
|
|
555
|
+
tone
|
|
556
|
+
}) => {
|
|
366
557
|
const color2 = colors[tone];
|
|
367
558
|
return state === "hovered" ? {
|
|
368
559
|
bg: dark ? color2.darker : color2.lighter,
|
|
@@ -406,7 +597,12 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
406
597
|
skeleton: base.skeleton
|
|
407
598
|
};
|
|
408
599
|
},
|
|
409
|
-
button: ({
|
|
600
|
+
button: ({
|
|
601
|
+
base,
|
|
602
|
+
mode,
|
|
603
|
+
muted,
|
|
604
|
+
solid
|
|
605
|
+
}) => mode === "bleed" ? {
|
|
410
606
|
...muted,
|
|
411
607
|
enabled: {
|
|
412
608
|
bg: "transparent",
|
|
@@ -454,7 +650,9 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
454
650
|
...solid,
|
|
455
651
|
enabled: muted.enabled
|
|
456
652
|
} : solid,
|
|
457
|
-
card: ({
|
|
653
|
+
card: ({
|
|
654
|
+
base
|
|
655
|
+
}) => ({
|
|
458
656
|
bg: black,
|
|
459
657
|
bg2: black,
|
|
460
658
|
fg: black,
|
|
@@ -482,8 +680,14 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
482
680
|
border: black,
|
|
483
681
|
placeholder: black
|
|
484
682
|
}),
|
|
485
|
-
selectable: ({
|
|
486
|
-
|
|
683
|
+
selectable: ({
|
|
684
|
+
muted,
|
|
685
|
+
state,
|
|
686
|
+
tone
|
|
687
|
+
}) => muted[tone][state],
|
|
688
|
+
spot: ({
|
|
689
|
+
key
|
|
690
|
+
}) => spots[key],
|
|
487
691
|
syntax: () => ({
|
|
488
692
|
atrule: black,
|
|
489
693
|
attrName: black,
|
|
@@ -598,64 +802,283 @@ function createInputModes(opts, base, dark, solid, muted) {
|
|
|
598
802
|
function createMutedTones(opts, base, dark, name) {
|
|
599
803
|
return {
|
|
600
804
|
default: {
|
|
601
|
-
enabled: opts.muted({
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
805
|
+
enabled: opts.muted({
|
|
806
|
+
base,
|
|
807
|
+
dark,
|
|
808
|
+
tone: "default",
|
|
809
|
+
name,
|
|
810
|
+
state: "enabled"
|
|
811
|
+
}),
|
|
812
|
+
disabled: opts.muted({
|
|
813
|
+
base,
|
|
814
|
+
dark,
|
|
815
|
+
tone: "default",
|
|
816
|
+
name,
|
|
817
|
+
state: "disabled"
|
|
818
|
+
}),
|
|
819
|
+
hovered: opts.muted({
|
|
820
|
+
base,
|
|
821
|
+
dark,
|
|
822
|
+
tone: "default",
|
|
823
|
+
name,
|
|
824
|
+
state: "hovered"
|
|
825
|
+
}),
|
|
826
|
+
pressed: opts.muted({
|
|
827
|
+
base,
|
|
828
|
+
dark,
|
|
829
|
+
tone: "default",
|
|
830
|
+
name,
|
|
831
|
+
state: "pressed"
|
|
832
|
+
}),
|
|
833
|
+
selected: opts.muted({
|
|
834
|
+
base,
|
|
835
|
+
dark,
|
|
836
|
+
tone: "default",
|
|
837
|
+
name,
|
|
838
|
+
state: "selected"
|
|
839
|
+
})
|
|
606
840
|
},
|
|
607
841
|
transparent: {
|
|
608
|
-
enabled: opts.muted({
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
842
|
+
enabled: opts.muted({
|
|
843
|
+
base,
|
|
844
|
+
dark,
|
|
845
|
+
tone: "transparent",
|
|
846
|
+
name,
|
|
847
|
+
state: "enabled"
|
|
848
|
+
}),
|
|
849
|
+
disabled: opts.muted({
|
|
850
|
+
base,
|
|
851
|
+
dark,
|
|
852
|
+
tone: "transparent",
|
|
853
|
+
name,
|
|
854
|
+
state: "disabled"
|
|
855
|
+
}),
|
|
856
|
+
hovered: opts.muted({
|
|
857
|
+
base,
|
|
858
|
+
dark,
|
|
859
|
+
tone: "transparent",
|
|
860
|
+
name,
|
|
861
|
+
state: "hovered"
|
|
862
|
+
}),
|
|
863
|
+
pressed: opts.muted({
|
|
864
|
+
base,
|
|
865
|
+
dark,
|
|
866
|
+
tone: "transparent",
|
|
867
|
+
name,
|
|
868
|
+
state: "pressed"
|
|
869
|
+
}),
|
|
870
|
+
selected: opts.muted({
|
|
871
|
+
base,
|
|
872
|
+
dark,
|
|
873
|
+
tone: "transparent",
|
|
874
|
+
name,
|
|
875
|
+
state: "selected"
|
|
876
|
+
})
|
|
613
877
|
},
|
|
614
878
|
primary: {
|
|
615
|
-
enabled: opts.muted({
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
879
|
+
enabled: opts.muted({
|
|
880
|
+
base,
|
|
881
|
+
dark,
|
|
882
|
+
tone: "primary",
|
|
883
|
+
name,
|
|
884
|
+
state: "enabled"
|
|
885
|
+
}),
|
|
886
|
+
disabled: opts.muted({
|
|
887
|
+
base,
|
|
888
|
+
dark,
|
|
889
|
+
tone: "primary",
|
|
890
|
+
name,
|
|
891
|
+
state: "disabled"
|
|
892
|
+
}),
|
|
893
|
+
hovered: opts.muted({
|
|
894
|
+
base,
|
|
895
|
+
dark,
|
|
896
|
+
tone: "primary",
|
|
897
|
+
name,
|
|
898
|
+
state: "hovered"
|
|
899
|
+
}),
|
|
900
|
+
pressed: opts.muted({
|
|
901
|
+
base,
|
|
902
|
+
dark,
|
|
903
|
+
tone: "primary",
|
|
904
|
+
name,
|
|
905
|
+
state: "pressed"
|
|
906
|
+
}),
|
|
907
|
+
selected: opts.muted({
|
|
908
|
+
base,
|
|
909
|
+
dark,
|
|
910
|
+
tone: "primary",
|
|
911
|
+
name,
|
|
912
|
+
state: "selected"
|
|
913
|
+
})
|
|
620
914
|
},
|
|
621
915
|
positive: {
|
|
622
|
-
enabled: opts.muted({
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
916
|
+
enabled: opts.muted({
|
|
917
|
+
base,
|
|
918
|
+
dark,
|
|
919
|
+
tone: "positive",
|
|
920
|
+
name,
|
|
921
|
+
state: "enabled"
|
|
922
|
+
}),
|
|
923
|
+
disabled: opts.muted({
|
|
924
|
+
base,
|
|
925
|
+
dark,
|
|
926
|
+
tone: "positive",
|
|
927
|
+
name,
|
|
928
|
+
state: "disabled"
|
|
929
|
+
}),
|
|
930
|
+
hovered: opts.muted({
|
|
931
|
+
base,
|
|
932
|
+
dark,
|
|
933
|
+
tone: "positive",
|
|
934
|
+
name,
|
|
935
|
+
state: "hovered"
|
|
936
|
+
}),
|
|
937
|
+
pressed: opts.muted({
|
|
938
|
+
base,
|
|
939
|
+
dark,
|
|
940
|
+
tone: "positive",
|
|
941
|
+
name,
|
|
942
|
+
state: "pressed"
|
|
943
|
+
}),
|
|
944
|
+
selected: opts.muted({
|
|
945
|
+
base,
|
|
946
|
+
dark,
|
|
947
|
+
tone: "positive",
|
|
948
|
+
name,
|
|
949
|
+
state: "selected"
|
|
950
|
+
})
|
|
627
951
|
},
|
|
628
952
|
caution: {
|
|
629
|
-
enabled: opts.muted({
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
953
|
+
enabled: opts.muted({
|
|
954
|
+
base,
|
|
955
|
+
dark,
|
|
956
|
+
tone: "caution",
|
|
957
|
+
name,
|
|
958
|
+
state: "enabled"
|
|
959
|
+
}),
|
|
960
|
+
disabled: opts.muted({
|
|
961
|
+
base,
|
|
962
|
+
dark,
|
|
963
|
+
tone: "caution",
|
|
964
|
+
name,
|
|
965
|
+
state: "disabled"
|
|
966
|
+
}),
|
|
967
|
+
hovered: opts.muted({
|
|
968
|
+
base,
|
|
969
|
+
dark,
|
|
970
|
+
tone: "caution",
|
|
971
|
+
name,
|
|
972
|
+
state: "hovered"
|
|
973
|
+
}),
|
|
974
|
+
pressed: opts.muted({
|
|
975
|
+
base,
|
|
976
|
+
dark,
|
|
977
|
+
tone: "caution",
|
|
978
|
+
name,
|
|
979
|
+
state: "pressed"
|
|
980
|
+
}),
|
|
981
|
+
selected: opts.muted({
|
|
982
|
+
base,
|
|
983
|
+
dark,
|
|
984
|
+
tone: "caution",
|
|
985
|
+
name,
|
|
986
|
+
state: "selected"
|
|
987
|
+
})
|
|
634
988
|
},
|
|
635
989
|
critical: {
|
|
636
|
-
enabled: opts.muted({
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
990
|
+
enabled: opts.muted({
|
|
991
|
+
base,
|
|
992
|
+
dark,
|
|
993
|
+
tone: "critical",
|
|
994
|
+
name,
|
|
995
|
+
state: "enabled"
|
|
996
|
+
}),
|
|
997
|
+
disabled: opts.muted({
|
|
998
|
+
base,
|
|
999
|
+
dark,
|
|
1000
|
+
tone: "critical",
|
|
1001
|
+
name,
|
|
1002
|
+
state: "disabled"
|
|
1003
|
+
}),
|
|
1004
|
+
hovered: opts.muted({
|
|
1005
|
+
base,
|
|
1006
|
+
dark,
|
|
1007
|
+
tone: "critical",
|
|
1008
|
+
name,
|
|
1009
|
+
state: "hovered"
|
|
1010
|
+
}),
|
|
1011
|
+
pressed: opts.muted({
|
|
1012
|
+
base,
|
|
1013
|
+
dark,
|
|
1014
|
+
tone: "critical",
|
|
1015
|
+
name,
|
|
1016
|
+
state: "pressed"
|
|
1017
|
+
}),
|
|
1018
|
+
selected: opts.muted({
|
|
1019
|
+
base,
|
|
1020
|
+
dark,
|
|
1021
|
+
tone: "critical",
|
|
1022
|
+
name,
|
|
1023
|
+
state: "selected"
|
|
1024
|
+
})
|
|
641
1025
|
}
|
|
642
1026
|
};
|
|
643
1027
|
}
|
|
644
1028
|
function createSpot(opts, base, dark) {
|
|
645
1029
|
return {
|
|
646
|
-
gray: opts.spot({
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
1030
|
+
gray: opts.spot({
|
|
1031
|
+
base,
|
|
1032
|
+
dark,
|
|
1033
|
+
key: "gray"
|
|
1034
|
+
}),
|
|
1035
|
+
blue: opts.spot({
|
|
1036
|
+
base,
|
|
1037
|
+
dark,
|
|
1038
|
+
key: "blue"
|
|
1039
|
+
}),
|
|
1040
|
+
purple: opts.spot({
|
|
1041
|
+
base,
|
|
1042
|
+
dark,
|
|
1043
|
+
key: "purple"
|
|
1044
|
+
}),
|
|
1045
|
+
magenta: opts.spot({
|
|
1046
|
+
base,
|
|
1047
|
+
dark,
|
|
1048
|
+
key: "magenta"
|
|
1049
|
+
}),
|
|
1050
|
+
red: opts.spot({
|
|
1051
|
+
base,
|
|
1052
|
+
dark,
|
|
1053
|
+
key: "red"
|
|
1054
|
+
}),
|
|
1055
|
+
orange: opts.spot({
|
|
1056
|
+
base,
|
|
1057
|
+
dark,
|
|
1058
|
+
key: "orange"
|
|
1059
|
+
}),
|
|
1060
|
+
yellow: opts.spot({
|
|
1061
|
+
base,
|
|
1062
|
+
dark,
|
|
1063
|
+
key: "yellow"
|
|
1064
|
+
}),
|
|
1065
|
+
green: opts.spot({
|
|
1066
|
+
base,
|
|
1067
|
+
dark,
|
|
1068
|
+
key: "green"
|
|
1069
|
+
}),
|
|
1070
|
+
cyan: opts.spot({
|
|
1071
|
+
base,
|
|
1072
|
+
dark,
|
|
1073
|
+
key: "cyan"
|
|
1074
|
+
})
|
|
655
1075
|
};
|
|
656
1076
|
}
|
|
657
1077
|
function createColorTheme(partialOpts = {}) {
|
|
658
|
-
const builders = {
|
|
1078
|
+
const builders = {
|
|
1079
|
+
...defaultOpts,
|
|
1080
|
+
...partialOpts
|
|
1081
|
+
};
|
|
659
1082
|
return {
|
|
660
1083
|
light: _createColorScheme(builders, !1),
|
|
661
1084
|
dark: _createColorScheme(builders, !0)
|
|
@@ -672,7 +1095,10 @@ function _createColorScheme(opts, dark) {
|
|
|
672
1095
|
};
|
|
673
1096
|
}
|
|
674
1097
|
function _createColor(opts, dark, name) {
|
|
675
|
-
const base = opts.base({
|
|
1098
|
+
const base = opts.base({
|
|
1099
|
+
dark,
|
|
1100
|
+
name
|
|
1101
|
+
}), solid = createSolidTones(opts, base, dark, name), muted = createMutedTones(opts, base, dark, name);
|
|
676
1102
|
return {
|
|
677
1103
|
base,
|
|
678
1104
|
button: createButtonModes(opts, base, dark, solid, muted),
|
|
@@ -681,12 +1107,149 @@ function _createColor(opts, dark, name) {
|
|
|
681
1107
|
input: createInputModes(opts, base, dark, solid, muted),
|
|
682
1108
|
selectable: createSelectableTones(opts, base, dark, solid, muted),
|
|
683
1109
|
spot: createSpot(opts, base, dark),
|
|
684
|
-
syntax: opts.syntax({
|
|
1110
|
+
syntax: opts.syntax({
|
|
1111
|
+
base,
|
|
1112
|
+
dark
|
|
1113
|
+
}),
|
|
685
1114
|
solid,
|
|
686
1115
|
muted
|
|
687
1116
|
};
|
|
688
1117
|
}
|
|
689
|
-
const
|
|
1118
|
+
const defaultThemeConfig = {
|
|
1119
|
+
_version: 2,
|
|
1120
|
+
avatar: {
|
|
1121
|
+
sizes: [{
|
|
1122
|
+
distance: -4,
|
|
1123
|
+
size: 19
|
|
1124
|
+
}, {
|
|
1125
|
+
distance: -4,
|
|
1126
|
+
size: 25
|
|
1127
|
+
}, {
|
|
1128
|
+
distance: -8,
|
|
1129
|
+
size: 33
|
|
1130
|
+
}, {
|
|
1131
|
+
distance: -12,
|
|
1132
|
+
size: 49
|
|
1133
|
+
}],
|
|
1134
|
+
focusRing: {
|
|
1135
|
+
offset: 1,
|
|
1136
|
+
width: 1
|
|
1137
|
+
}
|
|
1138
|
+
},
|
|
1139
|
+
button: {
|
|
1140
|
+
textWeight: "medium",
|
|
1141
|
+
border: {
|
|
1142
|
+
width: 1
|
|
1143
|
+
},
|
|
1144
|
+
focusRing: {
|
|
1145
|
+
offset: -1,
|
|
1146
|
+
width: 1
|
|
1147
|
+
}
|
|
1148
|
+
},
|
|
1149
|
+
card: {
|
|
1150
|
+
border: {
|
|
1151
|
+
width: 1
|
|
1152
|
+
},
|
|
1153
|
+
focusRing: {
|
|
1154
|
+
offset: -1,
|
|
1155
|
+
width: 1
|
|
1156
|
+
},
|
|
1157
|
+
shadow: {
|
|
1158
|
+
outline: 0.5
|
|
1159
|
+
}
|
|
1160
|
+
},
|
|
1161
|
+
container: [320, 640, 960, 1280, 1600, 1920],
|
|
1162
|
+
media: [360, 600, 900, 1200, 1800, 2400],
|
|
1163
|
+
layer: {
|
|
1164
|
+
dialog: {
|
|
1165
|
+
zOffset: 600
|
|
1166
|
+
},
|
|
1167
|
+
popover: {
|
|
1168
|
+
zOffset: 400
|
|
1169
|
+
},
|
|
1170
|
+
tooltip: {
|
|
1171
|
+
zOffset: 200
|
|
1172
|
+
}
|
|
1173
|
+
},
|
|
1174
|
+
radius: [0, 1, 5, 9, 13, 21, 33],
|
|
1175
|
+
shadow: [null, {
|
|
1176
|
+
umbra: [0, 0, 0, 0],
|
|
1177
|
+
penumbra: [0, 0, 0, 0],
|
|
1178
|
+
ambient: [0, 0, 0, 0]
|
|
1179
|
+
}, {
|
|
1180
|
+
umbra: [0, 3, 5, -2],
|
|
1181
|
+
penumbra: [0, 6, 10, 0],
|
|
1182
|
+
ambient: [0, 1, 18, 1]
|
|
1183
|
+
}, {
|
|
1184
|
+
umbra: [0, 7, 8, -4],
|
|
1185
|
+
penumbra: [0, 12, 17, 2],
|
|
1186
|
+
ambient: [0, 5, 22, 4]
|
|
1187
|
+
}, {
|
|
1188
|
+
umbra: [0, 9, 11, -5],
|
|
1189
|
+
penumbra: [0, 18, 28, 2],
|
|
1190
|
+
ambient: [0, 7, 34, 6]
|
|
1191
|
+
}, {
|
|
1192
|
+
umbra: [0, 11, 15, -7],
|
|
1193
|
+
penumbra: [0, 24, 38, 3],
|
|
1194
|
+
ambient: [0, 9, 46, 8]
|
|
1195
|
+
}],
|
|
1196
|
+
space: [0, 4, 8, 12, 20, 32, 52, 84, 136, 220],
|
|
1197
|
+
input: {
|
|
1198
|
+
border: {
|
|
1199
|
+
width: 1
|
|
1200
|
+
},
|
|
1201
|
+
checkbox: {
|
|
1202
|
+
size: 17,
|
|
1203
|
+
focusRing: {
|
|
1204
|
+
offset: -1,
|
|
1205
|
+
width: 1
|
|
1206
|
+
}
|
|
1207
|
+
},
|
|
1208
|
+
radio: {
|
|
1209
|
+
size: 17,
|
|
1210
|
+
markSize: 9,
|
|
1211
|
+
focusRing: {
|
|
1212
|
+
offset: -1,
|
|
1213
|
+
width: 1
|
|
1214
|
+
}
|
|
1215
|
+
},
|
|
1216
|
+
switch: {
|
|
1217
|
+
width: 25,
|
|
1218
|
+
height: 17,
|
|
1219
|
+
padding: 5,
|
|
1220
|
+
transitionDurationMs: 150,
|
|
1221
|
+
transitionTimingFunction: "ease-out",
|
|
1222
|
+
focusRing: {
|
|
1223
|
+
offset: 1,
|
|
1224
|
+
width: 1
|
|
1225
|
+
}
|
|
1226
|
+
},
|
|
1227
|
+
select: {
|
|
1228
|
+
focusRing: {
|
|
1229
|
+
offset: -1,
|
|
1230
|
+
width: 1
|
|
1231
|
+
}
|
|
1232
|
+
},
|
|
1233
|
+
text: {
|
|
1234
|
+
focusRing: {
|
|
1235
|
+
offset: -1,
|
|
1236
|
+
width: 1
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
},
|
|
1240
|
+
style: {
|
|
1241
|
+
button: {
|
|
1242
|
+
root: {
|
|
1243
|
+
transition: "background-color 100ms,border-color 100ms,color 100ms"
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
// card: {
|
|
1247
|
+
// root: {
|
|
1248
|
+
// transition: 'background-color 100ms,border-color 100ms,color 100ms',
|
|
1249
|
+
// },
|
|
1250
|
+
// },
|
|
1251
|
+
}
|
|
1252
|
+
}, defaultThemeFonts = {
|
|
690
1253
|
code: {
|
|
691
1254
|
family: "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
|
|
692
1255
|
weights: {
|
|
@@ -695,48 +1258,42 @@ const defaultThemeFonts = {
|
|
|
695
1258
|
semibold: 600,
|
|
696
1259
|
bold: 700
|
|
697
1260
|
},
|
|
698
|
-
sizes: [
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
fontSize: 22,
|
|
735
|
-
iconSize: 33,
|
|
736
|
-
lineHeight: 31,
|
|
737
|
-
letterSpacing: 0
|
|
738
|
-
}
|
|
739
|
-
]
|
|
1261
|
+
sizes: [{
|
|
1262
|
+
ascenderHeight: 4,
|
|
1263
|
+
descenderHeight: 4,
|
|
1264
|
+
fontSize: 10,
|
|
1265
|
+
iconSize: 17,
|
|
1266
|
+
lineHeight: 15,
|
|
1267
|
+
letterSpacing: 0
|
|
1268
|
+
}, {
|
|
1269
|
+
ascenderHeight: 5,
|
|
1270
|
+
descenderHeight: 5,
|
|
1271
|
+
fontSize: 13,
|
|
1272
|
+
iconSize: 21,
|
|
1273
|
+
lineHeight: 19,
|
|
1274
|
+
letterSpacing: 0
|
|
1275
|
+
}, {
|
|
1276
|
+
ascenderHeight: 6,
|
|
1277
|
+
descenderHeight: 6,
|
|
1278
|
+
fontSize: 16,
|
|
1279
|
+
iconSize: 25,
|
|
1280
|
+
lineHeight: 23,
|
|
1281
|
+
letterSpacing: 0
|
|
1282
|
+
}, {
|
|
1283
|
+
ascenderHeight: 7,
|
|
1284
|
+
descenderHeight: 7,
|
|
1285
|
+
fontSize: 19,
|
|
1286
|
+
iconSize: 29,
|
|
1287
|
+
lineHeight: 27,
|
|
1288
|
+
letterSpacing: 0
|
|
1289
|
+
}, {
|
|
1290
|
+
ascenderHeight: 8,
|
|
1291
|
+
descenderHeight: 8,
|
|
1292
|
+
fontSize: 22,
|
|
1293
|
+
iconSize: 33,
|
|
1294
|
+
lineHeight: 31,
|
|
1295
|
+
letterSpacing: 0
|
|
1296
|
+
}]
|
|
740
1297
|
},
|
|
741
1298
|
heading: {
|
|
742
1299
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
@@ -746,56 +1303,49 @@ const defaultThemeFonts = {
|
|
|
746
1303
|
semibold: 900,
|
|
747
1304
|
bold: 900
|
|
748
1305
|
},
|
|
749
|
-
sizes: [
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
descenderHeight: 9.5,
|
|
793
|
-
fontSize: 38,
|
|
794
|
-
iconSize: 53,
|
|
795
|
-
lineHeight: 47,
|
|
796
|
-
letterSpacing: 0
|
|
797
|
-
}
|
|
798
|
-
]
|
|
1306
|
+
sizes: [{
|
|
1307
|
+
ascenderHeight: 5,
|
|
1308
|
+
descenderHeight: 5,
|
|
1309
|
+
fontSize: 13,
|
|
1310
|
+
iconSize: 17,
|
|
1311
|
+
lineHeight: 19,
|
|
1312
|
+
letterSpacing: 0
|
|
1313
|
+
}, {
|
|
1314
|
+
ascenderHeight: 6,
|
|
1315
|
+
descenderHeight: 6,
|
|
1316
|
+
fontSize: 16,
|
|
1317
|
+
iconSize: 25,
|
|
1318
|
+
lineHeight: 23,
|
|
1319
|
+
letterSpacing: 0
|
|
1320
|
+
}, {
|
|
1321
|
+
ascenderHeight: 7,
|
|
1322
|
+
descenderHeight: 7,
|
|
1323
|
+
fontSize: 21,
|
|
1324
|
+
iconSize: 33,
|
|
1325
|
+
lineHeight: 29,
|
|
1326
|
+
letterSpacing: 0
|
|
1327
|
+
}, {
|
|
1328
|
+
ascenderHeight: 8,
|
|
1329
|
+
descenderHeight: 8,
|
|
1330
|
+
fontSize: 27,
|
|
1331
|
+
iconSize: 41,
|
|
1332
|
+
lineHeight: 35,
|
|
1333
|
+
letterSpacing: 0
|
|
1334
|
+
}, {
|
|
1335
|
+
ascenderHeight: 9.5,
|
|
1336
|
+
descenderHeight: 8.5,
|
|
1337
|
+
fontSize: 33,
|
|
1338
|
+
iconSize: 49,
|
|
1339
|
+
lineHeight: 41,
|
|
1340
|
+
letterSpacing: 0
|
|
1341
|
+
}, {
|
|
1342
|
+
ascenderHeight: 10.5,
|
|
1343
|
+
descenderHeight: 9.5,
|
|
1344
|
+
fontSize: 38,
|
|
1345
|
+
iconSize: 53,
|
|
1346
|
+
lineHeight: 47,
|
|
1347
|
+
letterSpacing: 0
|
|
1348
|
+
}]
|
|
799
1349
|
},
|
|
800
1350
|
label: {
|
|
801
1351
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", system-ui, sans-serif',
|
|
@@ -805,56 +1355,49 @@ const defaultThemeFonts = {
|
|
|
805
1355
|
semibold: 800,
|
|
806
1356
|
bold: 900
|
|
807
1357
|
},
|
|
808
|
-
sizes: [
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
descenderHeight: 2,
|
|
852
|
-
fontSize: 15,
|
|
853
|
-
iconSize: 23,
|
|
854
|
-
lineHeight: 15,
|
|
855
|
-
letterSpacing: 0.5
|
|
856
|
-
}
|
|
857
|
-
]
|
|
1358
|
+
sizes: [{
|
|
1359
|
+
ascenderHeight: 2,
|
|
1360
|
+
descenderHeight: 2,
|
|
1361
|
+
fontSize: 8.1,
|
|
1362
|
+
iconSize: 13,
|
|
1363
|
+
lineHeight: 10,
|
|
1364
|
+
letterSpacing: 0.5
|
|
1365
|
+
}, {
|
|
1366
|
+
ascenderHeight: 2,
|
|
1367
|
+
descenderHeight: 2,
|
|
1368
|
+
fontSize: 9.5,
|
|
1369
|
+
iconSize: 15,
|
|
1370
|
+
lineHeight: 11,
|
|
1371
|
+
letterSpacing: 0.5
|
|
1372
|
+
}, {
|
|
1373
|
+
ascenderHeight: 2,
|
|
1374
|
+
descenderHeight: 2,
|
|
1375
|
+
fontSize: 10.8,
|
|
1376
|
+
iconSize: 17,
|
|
1377
|
+
lineHeight: 12,
|
|
1378
|
+
letterSpacing: 0.5
|
|
1379
|
+
}, {
|
|
1380
|
+
ascenderHeight: 2,
|
|
1381
|
+
descenderHeight: 2,
|
|
1382
|
+
fontSize: 12.25,
|
|
1383
|
+
iconSize: 19,
|
|
1384
|
+
lineHeight: 13,
|
|
1385
|
+
letterSpacing: 0.5
|
|
1386
|
+
}, {
|
|
1387
|
+
ascenderHeight: 2,
|
|
1388
|
+
descenderHeight: 2,
|
|
1389
|
+
fontSize: 13.6,
|
|
1390
|
+
iconSize: 21,
|
|
1391
|
+
lineHeight: 14,
|
|
1392
|
+
letterSpacing: 0.5
|
|
1393
|
+
}, {
|
|
1394
|
+
ascenderHeight: 2,
|
|
1395
|
+
descenderHeight: 2,
|
|
1396
|
+
fontSize: 15,
|
|
1397
|
+
iconSize: 23,
|
|
1398
|
+
lineHeight: 15,
|
|
1399
|
+
letterSpacing: 0.5
|
|
1400
|
+
}]
|
|
858
1401
|
},
|
|
859
1402
|
text: {
|
|
860
1403
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
@@ -864,50 +1407,276 @@ const defaultThemeFonts = {
|
|
|
864
1407
|
semibold: 600,
|
|
865
1408
|
bold: 700
|
|
866
1409
|
},
|
|
867
|
-
sizes: [
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
fontSize: 21,
|
|
904
|
-
iconSize: 33,
|
|
905
|
-
lineHeight: 31,
|
|
906
|
-
letterSpacing: 0
|
|
907
|
-
}
|
|
908
|
-
]
|
|
1410
|
+
sizes: [{
|
|
1411
|
+
ascenderHeight: 4,
|
|
1412
|
+
descenderHeight: 4,
|
|
1413
|
+
fontSize: 10,
|
|
1414
|
+
iconSize: 17,
|
|
1415
|
+
lineHeight: 15,
|
|
1416
|
+
letterSpacing: 0
|
|
1417
|
+
}, {
|
|
1418
|
+
ascenderHeight: 5,
|
|
1419
|
+
descenderHeight: 5,
|
|
1420
|
+
fontSize: 13,
|
|
1421
|
+
iconSize: 21,
|
|
1422
|
+
lineHeight: 19,
|
|
1423
|
+
letterSpacing: 0
|
|
1424
|
+
}, {
|
|
1425
|
+
ascenderHeight: 6,
|
|
1426
|
+
descenderHeight: 6,
|
|
1427
|
+
fontSize: 15,
|
|
1428
|
+
iconSize: 25,
|
|
1429
|
+
lineHeight: 23,
|
|
1430
|
+
letterSpacing: 0
|
|
1431
|
+
}, {
|
|
1432
|
+
ascenderHeight: 7,
|
|
1433
|
+
descenderHeight: 7,
|
|
1434
|
+
fontSize: 18,
|
|
1435
|
+
iconSize: 29,
|
|
1436
|
+
lineHeight: 27,
|
|
1437
|
+
letterSpacing: 0
|
|
1438
|
+
}, {
|
|
1439
|
+
ascenderHeight: 8,
|
|
1440
|
+
descenderHeight: 8,
|
|
1441
|
+
fontSize: 21,
|
|
1442
|
+
iconSize: 33,
|
|
1443
|
+
lineHeight: 31,
|
|
1444
|
+
letterSpacing: 0
|
|
1445
|
+
}]
|
|
909
1446
|
}
|
|
910
|
-
};
|
|
1447
|
+
}, cache$4 = /* @__PURE__ */ new WeakMap();
|
|
1448
|
+
function themeColor_v0_v2(color_v0) {
|
|
1449
|
+
const cached_v2 = cache$4.get(color_v0);
|
|
1450
|
+
if (cached_v2) return cached_v2;
|
|
1451
|
+
const base = stateThemeColor_v0_v2(color_v0, color_v0.card.enabled), color_v2 = {
|
|
1452
|
+
_blend: color_v0._blend || (color_v0.dark ? "screen" : "multiply"),
|
|
1453
|
+
_dark: color_v0.dark,
|
|
1454
|
+
accent: base.accent,
|
|
1455
|
+
avatar: base.avatar,
|
|
1456
|
+
backdrop: color_v0.base.shadow.ambient,
|
|
1457
|
+
badge: base.badge,
|
|
1458
|
+
bg: color_v0.base.bg,
|
|
1459
|
+
border: color_v0.base.border,
|
|
1460
|
+
button: {
|
|
1461
|
+
default: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.default),
|
|
1462
|
+
ghost: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.ghost),
|
|
1463
|
+
bleed: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.bleed)
|
|
1464
|
+
},
|
|
1465
|
+
code: base.code,
|
|
1466
|
+
fg: color_v0.base.fg,
|
|
1467
|
+
focusRing: color_v0.base.focusRing,
|
|
1468
|
+
icon: base.muted.fg,
|
|
1469
|
+
input: {
|
|
1470
|
+
default: inputStatesThemeColor_v0_v2(color_v0.input.default),
|
|
1471
|
+
invalid: inputStatesThemeColor_v0_v2(color_v0.input.invalid)
|
|
1472
|
+
},
|
|
1473
|
+
kbd: base.kbd,
|
|
1474
|
+
link: base.link,
|
|
1475
|
+
muted: {
|
|
1476
|
+
...base.muted,
|
|
1477
|
+
bg: color_v0.selectable?.default.enabled.bg2 || color_v0.base.bg
|
|
1478
|
+
},
|
|
1479
|
+
selectable: stateTonesThemeColor_v0_v2(color_v0, color_v0.selectable || color_v0.muted),
|
|
1480
|
+
shadow: color_v0.base.shadow,
|
|
1481
|
+
skeleton: {
|
|
1482
|
+
from: color_v0.skeleton?.from || color_v0.base.border,
|
|
1483
|
+
to: color_v0.skeleton?.to || color_v0.base.border
|
|
1484
|
+
},
|
|
1485
|
+
syntax: color_v0.syntax
|
|
1486
|
+
};
|
|
1487
|
+
return cache$4.set(color_v0, color_v2), color_v2;
|
|
1488
|
+
}
|
|
1489
|
+
function stateTonesThemeColor_v0_v2(v0, t) {
|
|
1490
|
+
return {
|
|
1491
|
+
default: {
|
|
1492
|
+
enabled: stateThemeColor_v0_v2(v0, t.default.enabled),
|
|
1493
|
+
hovered: stateThemeColor_v0_v2(v0, t.default.hovered),
|
|
1494
|
+
pressed: stateThemeColor_v0_v2(v0, t.default.pressed),
|
|
1495
|
+
selected: stateThemeColor_v0_v2(v0, t.default.selected),
|
|
1496
|
+
disabled: stateThemeColor_v0_v2(v0, t.default.disabled)
|
|
1497
|
+
},
|
|
1498
|
+
primary: {
|
|
1499
|
+
enabled: stateThemeColor_v0_v2(v0, t.primary.enabled),
|
|
1500
|
+
hovered: stateThemeColor_v0_v2(v0, t.primary.hovered),
|
|
1501
|
+
pressed: stateThemeColor_v0_v2(v0, t.primary.pressed),
|
|
1502
|
+
selected: stateThemeColor_v0_v2(v0, t.primary.selected),
|
|
1503
|
+
disabled: stateThemeColor_v0_v2(v0, t.primary.disabled)
|
|
1504
|
+
},
|
|
1505
|
+
positive: {
|
|
1506
|
+
enabled: stateThemeColor_v0_v2(v0, t.positive.enabled),
|
|
1507
|
+
hovered: stateThemeColor_v0_v2(v0, t.positive.hovered),
|
|
1508
|
+
pressed: stateThemeColor_v0_v2(v0, t.positive.pressed),
|
|
1509
|
+
selected: stateThemeColor_v0_v2(v0, t.positive.selected),
|
|
1510
|
+
disabled: stateThemeColor_v0_v2(v0, t.positive.disabled)
|
|
1511
|
+
},
|
|
1512
|
+
caution: {
|
|
1513
|
+
enabled: stateThemeColor_v0_v2(v0, t.caution.enabled),
|
|
1514
|
+
hovered: stateThemeColor_v0_v2(v0, t.caution.hovered),
|
|
1515
|
+
pressed: stateThemeColor_v0_v2(v0, t.caution.pressed),
|
|
1516
|
+
selected: stateThemeColor_v0_v2(v0, t.caution.selected),
|
|
1517
|
+
disabled: stateThemeColor_v0_v2(v0, t.caution.disabled)
|
|
1518
|
+
},
|
|
1519
|
+
critical: {
|
|
1520
|
+
enabled: stateThemeColor_v0_v2(v0, t.critical.enabled),
|
|
1521
|
+
hovered: stateThemeColor_v0_v2(v0, t.critical.hovered),
|
|
1522
|
+
pressed: stateThemeColor_v0_v2(v0, t.critical.pressed),
|
|
1523
|
+
selected: stateThemeColor_v0_v2(v0, t.critical.selected),
|
|
1524
|
+
disabled: stateThemeColor_v0_v2(v0, t.critical.disabled)
|
|
1525
|
+
}
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
function stateThemeColor_v0_v2(v0, state) {
|
|
1529
|
+
return {
|
|
1530
|
+
...state,
|
|
1531
|
+
avatar: {
|
|
1532
|
+
gray: {
|
|
1533
|
+
bg: v0.spot.gray,
|
|
1534
|
+
fg: v0.base.bg
|
|
1535
|
+
},
|
|
1536
|
+
blue: {
|
|
1537
|
+
bg: v0.spot.blue,
|
|
1538
|
+
fg: v0.base.bg
|
|
1539
|
+
},
|
|
1540
|
+
purple: {
|
|
1541
|
+
bg: v0.spot.purple,
|
|
1542
|
+
fg: v0.base.bg
|
|
1543
|
+
},
|
|
1544
|
+
magenta: {
|
|
1545
|
+
bg: v0.spot.magenta,
|
|
1546
|
+
fg: v0.base.bg
|
|
1547
|
+
},
|
|
1548
|
+
red: {
|
|
1549
|
+
bg: v0.spot.red,
|
|
1550
|
+
fg: v0.base.bg
|
|
1551
|
+
},
|
|
1552
|
+
orange: {
|
|
1553
|
+
bg: v0.spot.orange,
|
|
1554
|
+
fg: v0.base.bg
|
|
1555
|
+
},
|
|
1556
|
+
yellow: {
|
|
1557
|
+
bg: v0.spot.yellow,
|
|
1558
|
+
fg: v0.base.bg
|
|
1559
|
+
},
|
|
1560
|
+
green: {
|
|
1561
|
+
bg: v0.spot.green,
|
|
1562
|
+
fg: v0.base.bg
|
|
1563
|
+
},
|
|
1564
|
+
cyan: {
|
|
1565
|
+
bg: v0.spot.cyan,
|
|
1566
|
+
fg: v0.base.bg
|
|
1567
|
+
}
|
|
1568
|
+
},
|
|
1569
|
+
badge: {
|
|
1570
|
+
default: {
|
|
1571
|
+
bg: v0.muted.default.enabled.bg,
|
|
1572
|
+
fg: v0.muted.default.enabled.fg,
|
|
1573
|
+
dot: v0.muted.default.enabled.muted.fg,
|
|
1574
|
+
icon: v0.muted.default.enabled.muted.fg
|
|
1575
|
+
},
|
|
1576
|
+
primary: {
|
|
1577
|
+
bg: v0.muted.primary.enabled.bg,
|
|
1578
|
+
fg: v0.muted.primary.enabled.fg,
|
|
1579
|
+
dot: v0.muted.primary.enabled.muted.fg,
|
|
1580
|
+
icon: v0.muted.primary.enabled.muted.fg
|
|
1581
|
+
},
|
|
1582
|
+
positive: {
|
|
1583
|
+
bg: v0.muted.positive.enabled.bg,
|
|
1584
|
+
fg: v0.muted.positive.enabled.fg,
|
|
1585
|
+
dot: v0.muted.positive.enabled.muted.fg,
|
|
1586
|
+
icon: v0.muted.positive.enabled.muted.fg
|
|
1587
|
+
},
|
|
1588
|
+
caution: {
|
|
1589
|
+
bg: v0.muted.caution.enabled.bg,
|
|
1590
|
+
fg: v0.muted.caution.enabled.fg,
|
|
1591
|
+
dot: v0.muted.caution.enabled.muted.fg,
|
|
1592
|
+
icon: v0.muted.caution.enabled.muted.fg
|
|
1593
|
+
},
|
|
1594
|
+
critical: {
|
|
1595
|
+
bg: v0.muted.critical.enabled.bg,
|
|
1596
|
+
fg: v0.muted.critical.enabled.fg,
|
|
1597
|
+
dot: v0.muted.critical.enabled.muted.fg,
|
|
1598
|
+
icon: v0.muted.critical.enabled.muted.fg
|
|
1599
|
+
}
|
|
1600
|
+
},
|
|
1601
|
+
kbd: {
|
|
1602
|
+
bg: v0.muted.default.enabled.bg,
|
|
1603
|
+
fg: v0.muted.default.enabled.fg,
|
|
1604
|
+
border: v0.muted.default.enabled.border
|
|
1605
|
+
},
|
|
1606
|
+
muted: {
|
|
1607
|
+
...v0.muted.default.enabled.muted,
|
|
1608
|
+
bg: state.bg2 || state.bg
|
|
1609
|
+
},
|
|
1610
|
+
skeleton: {
|
|
1611
|
+
from: state.skeleton?.from || state.border,
|
|
1612
|
+
to: state.skeleton?.to || state.border
|
|
1613
|
+
}
|
|
1614
|
+
};
|
|
1615
|
+
}
|
|
1616
|
+
function inputStatesThemeColor_v0_v2(states) {
|
|
1617
|
+
return {
|
|
1618
|
+
enabled: inputStateThemeColor_v0_v2(states.enabled),
|
|
1619
|
+
disabled: inputStateThemeColor_v0_v2(states.disabled),
|
|
1620
|
+
readOnly: inputStateThemeColor_v0_v2(states.readOnly),
|
|
1621
|
+
hovered: inputStateThemeColor_v0_v2(states.hovered)
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1624
|
+
function inputStateThemeColor_v0_v2(state) {
|
|
1625
|
+
return {
|
|
1626
|
+
bg: state.bg,
|
|
1627
|
+
border: state.border,
|
|
1628
|
+
fg: state.fg,
|
|
1629
|
+
muted: {
|
|
1630
|
+
bg: state.bg2
|
|
1631
|
+
},
|
|
1632
|
+
placeholder: state.placeholder
|
|
1633
|
+
};
|
|
1634
|
+
}
|
|
1635
|
+
const cache$3 = /* @__PURE__ */ new WeakMap();
|
|
1636
|
+
function getTheme_v2(theme) {
|
|
1637
|
+
if (theme.sanity.v2?._resolved) return theme.sanity.v2;
|
|
1638
|
+
const cached_v2 = cache$3.get(theme);
|
|
1639
|
+
if (cached_v2) return cached_v2;
|
|
1640
|
+
const v2 = {
|
|
1641
|
+
_version: 2,
|
|
1642
|
+
_resolved: !0,
|
|
1643
|
+
avatar: {
|
|
1644
|
+
...defaultThemeConfig.avatar,
|
|
1645
|
+
...theme.sanity.avatar
|
|
1646
|
+
},
|
|
1647
|
+
button: {
|
|
1648
|
+
...defaultThemeConfig.button,
|
|
1649
|
+
...theme.sanity.button
|
|
1650
|
+
},
|
|
1651
|
+
card: defaultThemeConfig.card,
|
|
1652
|
+
color: themeColor_v0_v2(theme.sanity.color),
|
|
1653
|
+
container: theme.sanity.container,
|
|
1654
|
+
font: theme.sanity.fonts,
|
|
1655
|
+
input: {
|
|
1656
|
+
...defaultThemeConfig.input,
|
|
1657
|
+
...theme.sanity.input,
|
|
1658
|
+
checkbox: {
|
|
1659
|
+
...defaultThemeConfig.input.checkbox,
|
|
1660
|
+
...theme.sanity.input.checkbox
|
|
1661
|
+
},
|
|
1662
|
+
radio: {
|
|
1663
|
+
...defaultThemeConfig.input.radio,
|
|
1664
|
+
...theme.sanity.input.radio
|
|
1665
|
+
},
|
|
1666
|
+
switch: {
|
|
1667
|
+
...defaultThemeConfig.input.switch,
|
|
1668
|
+
...theme.sanity.input.switch
|
|
1669
|
+
}
|
|
1670
|
+
},
|
|
1671
|
+
layer: theme.sanity.layer ?? defaultThemeConfig.layer,
|
|
1672
|
+
media: theme.sanity.media,
|
|
1673
|
+
radius: theme.sanity.radius,
|
|
1674
|
+
shadow: theme.sanity.shadows,
|
|
1675
|
+
space: theme.sanity.space,
|
|
1676
|
+
style: theme.sanity.styles
|
|
1677
|
+
};
|
|
1678
|
+
return cache$3.set(theme, v2), v2;
|
|
1679
|
+
}
|
|
911
1680
|
function is_v0(themeProp) {
|
|
912
1681
|
return themeProp._version === 0;
|
|
913
1682
|
}
|
|
@@ -1097,20 +1866,7 @@ function inputStateThemeColor_v2_v0(t) {
|
|
|
1097
1866
|
placeholder: t.placeholder
|
|
1098
1867
|
};
|
|
1099
1868
|
}
|
|
1100
|
-
const AVATAR_SIZE = [0, 1, 2, 3], CONTAINER = [0, 1, 2, 3, 4, 5], RADIUS = [0, 1, 2, 3, 4, 5, 6, "full"], SPACE = [0, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9], FONT_CODE_SIZE = [0, 1, 2, 3, 4, 5], FONT_HEADING_SIZE = [0, 1, 2, 3, 4, 5, 6], FONT_LABEL_SIZE = [0, 1, 2, 3, 4, 5, 6], FONT_TEXT_SIZE = [0, 1, 2, 3, 4, 5], SHADOW = [0, 1, 2, 3, 4, 5], THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
|
|
1101
|
-
"transparent",
|
|
1102
|
-
"default",
|
|
1103
|
-
"primary",
|
|
1104
|
-
"positive",
|
|
1105
|
-
"caution",
|
|
1106
|
-
"critical"
|
|
1107
|
-
], THEME_COLOR_STATE_TONES = [
|
|
1108
|
-
"default",
|
|
1109
|
-
"primary",
|
|
1110
|
-
"positive",
|
|
1111
|
-
"caution",
|
|
1112
|
-
"critical"
|
|
1113
|
-
], THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"], THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"], THEME_COLOR_INPUT_MODES = ["default", "invalid"], THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"], THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
|
|
1869
|
+
const AVATAR_SIZE = [0, 1, 2, 3], CONTAINER = [0, 1, 2, 3, 4, 5], RADIUS = [0, 1, 2, 3, 4, 5, 6, "full"], SPACE = [0, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9], FONT_CODE_SIZE = [0, 1, 2, 3, 4, 5], FONT_HEADING_SIZE = [0, 1, 2, 3, 4, 5, 6], FONT_LABEL_SIZE = [0, 1, 2, 3, 4, 5, 6], FONT_TEXT_SIZE = [0, 1, 2, 3, 4, 5], SHADOW = [0, 1, 2, 3, 4, 5], THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = ["transparent", "default", "primary", "positive", "caution", "critical"], THEME_COLOR_STATE_TONES = ["default", "primary", "positive", "caution", "critical"], THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"], THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"], THEME_COLOR_INPUT_MODES = ["default", "invalid"], THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"], THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
|
|
1114
1870
|
function isColorBlendModeValue(str) {
|
|
1115
1871
|
return THEME_COLOR_BLEND_MODES.includes(str);
|
|
1116
1872
|
}
|
|
@@ -1123,33 +1879,7 @@ function isColorTintKey(str) {
|
|
|
1123
1879
|
function isColorButtonMode(str) {
|
|
1124
1880
|
return THEME_COLOR_BUTTON_MODES.includes(str);
|
|
1125
1881
|
}
|
|
1126
|
-
const COLOR_CONFIG_STATE_KEYS = [
|
|
1127
|
-
"_hue",
|
|
1128
|
-
"bg",
|
|
1129
|
-
"fg",
|
|
1130
|
-
"border",
|
|
1131
|
-
"focusRing",
|
|
1132
|
-
"muted/fg",
|
|
1133
|
-
"accent/fg",
|
|
1134
|
-
"link/fg",
|
|
1135
|
-
"code/bg",
|
|
1136
|
-
"code/fg",
|
|
1137
|
-
"skeleton/from",
|
|
1138
|
-
"skeleton/to",
|
|
1139
|
-
"status/dot",
|
|
1140
|
-
"status/icon"
|
|
1141
|
-
], COLOR_CONFIG_CARD_KEYS = [
|
|
1142
|
-
...COLOR_CONFIG_STATE_KEYS,
|
|
1143
|
-
"_hue",
|
|
1144
|
-
"bg",
|
|
1145
|
-
"fg",
|
|
1146
|
-
"border",
|
|
1147
|
-
"focusRing",
|
|
1148
|
-
"shadow/outline",
|
|
1149
|
-
"shadow/umbra",
|
|
1150
|
-
"shadow/penumbra",
|
|
1151
|
-
"shadow/ambient"
|
|
1152
|
-
], COLOR_CONFIG_BLEND_KEYS = ["_blend"], COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS], COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES], COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES], COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES], COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES], COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
|
|
1882
|
+
const COLOR_CONFIG_STATE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "accent/fg", "link/fg", "code/bg", "code/fg", "skeleton/from", "skeleton/to", "status/dot", "status/icon"], COLOR_CONFIG_CARD_KEYS = [...COLOR_CONFIG_STATE_KEYS, "_hue", "bg", "fg", "border", "focusRing", "shadow/outline", "shadow/umbra", "shadow/penumbra", "shadow/ambient"], COLOR_CONFIG_BLEND_KEYS = ["_blend"], COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS], COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES], COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES], COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES], COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES], COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
|
|
1153
1883
|
function parseTokenKey(str) {
|
|
1154
1884
|
const segments = str.split("/"), segment0 = segments.shift() || "";
|
|
1155
1885
|
if (isColorConfigBaseTone(segment0)) {
|
|
@@ -1315,10 +2045,16 @@ function compileColorTokenValue(node) {
|
|
|
1315
2045
|
}
|
|
1316
2046
|
const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
|
|
1317
2047
|
function resolveColorTokenValue(context, value = DEFAULT_COLOR_TOKEN_VALUE) {
|
|
1318
|
-
const {
|
|
2048
|
+
const {
|
|
2049
|
+
hue,
|
|
2050
|
+
scheme
|
|
2051
|
+
} = context, node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
1319
2052
|
if (!node || node.type !== "color")
|
|
1320
2053
|
throw new Error(`Invalid color token: ${value[0]}`);
|
|
1321
|
-
return compileColorTokenValue({
|
|
2054
|
+
return compileColorTokenValue({
|
|
2055
|
+
...node,
|
|
2056
|
+
hue: node.hue || hue
|
|
2057
|
+
});
|
|
1322
2058
|
}
|
|
1323
2059
|
const defaultColorTokens = {
|
|
1324
2060
|
base: {
|
|
@@ -1393,16 +2129,24 @@ const defaultColorTokens = {
|
|
|
1393
2129
|
fg: ["600", "400"]
|
|
1394
2130
|
}
|
|
1395
2131
|
},
|
|
1396
|
-
primary: {
|
|
2132
|
+
primary: {
|
|
2133
|
+
_hue: "blue"
|
|
2134
|
+
},
|
|
1397
2135
|
positive: {
|
|
1398
2136
|
_hue: "green",
|
|
1399
|
-
shadow: {
|
|
2137
|
+
shadow: {
|
|
2138
|
+
outline: ["500/0.4", "500/0.4"]
|
|
2139
|
+
}
|
|
1400
2140
|
},
|
|
1401
2141
|
caution: {
|
|
1402
2142
|
_hue: "yellow",
|
|
1403
|
-
shadow: {
|
|
2143
|
+
shadow: {
|
|
2144
|
+
outline: ["600/0.3", "500/0.4"]
|
|
2145
|
+
}
|
|
1404
2146
|
},
|
|
1405
|
-
critical: {
|
|
2147
|
+
critical: {
|
|
2148
|
+
_hue: "red"
|
|
2149
|
+
}
|
|
1406
2150
|
},
|
|
1407
2151
|
button: {
|
|
1408
2152
|
default: {
|
|
@@ -2000,15 +2744,33 @@ function resolveBaseColorTones(inputTokens, tone) {
|
|
|
2000
2744
|
...spec,
|
|
2001
2745
|
_hue: hue,
|
|
2002
2746
|
avatar: {
|
|
2003
|
-
gray: merge({
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2747
|
+
gray: merge({
|
|
2748
|
+
_hue: "gray"
|
|
2749
|
+
}, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2750
|
+
blue: merge({
|
|
2751
|
+
_hue: "blue"
|
|
2752
|
+
}, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2753
|
+
purple: merge({
|
|
2754
|
+
_hue: "purple"
|
|
2755
|
+
}, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2756
|
+
magenta: merge({
|
|
2757
|
+
_hue: "magenta"
|
|
2758
|
+
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2759
|
+
red: merge({
|
|
2760
|
+
_hue: "red"
|
|
2761
|
+
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2762
|
+
orange: merge({
|
|
2763
|
+
_hue: "orange"
|
|
2764
|
+
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2765
|
+
yellow: merge({
|
|
2766
|
+
_hue: "yellow"
|
|
2767
|
+
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2768
|
+
green: merge({
|
|
2769
|
+
_hue: "green"
|
|
2770
|
+
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2771
|
+
cyan: merge({
|
|
2772
|
+
_hue: "cyan"
|
|
2773
|
+
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2012
2774
|
},
|
|
2013
2775
|
badge: {
|
|
2014
2776
|
default: {
|
|
@@ -2058,25 +2820,38 @@ function resolveButtonModeColorTokens(inputTokens, mode, tone) {
|
|
|
2058
2820
|
return tokens;
|
|
2059
2821
|
}
|
|
2060
2822
|
function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
|
|
2061
|
-
const spec = merge(
|
|
2062
|
-
inputTokens?.button?.[mode]?.["*"]?.["*"],
|
|
2063
|
-
inputTokens?.button?.[mode]?.[tone]?.["*"],
|
|
2064
|
-
inputTokens?.button?.[mode]?.["*"]?.[state],
|
|
2065
|
-
inputTokens?.button?.[mode]?.[tone]?.[state]
|
|
2066
|
-
), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2823
|
+
const spec = merge(inputTokens?.button?.[mode]?.["*"]?.["*"], inputTokens?.button?.[mode]?.[tone]?.["*"], inputTokens?.button?.[mode]?.["*"]?.[state], inputTokens?.button?.[mode]?.[tone]?.[state]), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2067
2824
|
return {
|
|
2068
2825
|
...spec,
|
|
2069
2826
|
_hue: hue,
|
|
2070
2827
|
avatar: {
|
|
2071
|
-
gray: merge({
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2828
|
+
gray: merge({
|
|
2829
|
+
_hue: "gray"
|
|
2830
|
+
}, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2831
|
+
blue: merge({
|
|
2832
|
+
_hue: "blue"
|
|
2833
|
+
}, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2834
|
+
purple: merge({
|
|
2835
|
+
_hue: "purple"
|
|
2836
|
+
}, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2837
|
+
magenta: merge({
|
|
2838
|
+
_hue: "magenta"
|
|
2839
|
+
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2840
|
+
red: merge({
|
|
2841
|
+
_hue: "red"
|
|
2842
|
+
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2843
|
+
orange: merge({
|
|
2844
|
+
_hue: "orange"
|
|
2845
|
+
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2846
|
+
yellow: merge({
|
|
2847
|
+
_hue: "yellow"
|
|
2848
|
+
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2849
|
+
green: merge({
|
|
2850
|
+
_hue: "green"
|
|
2851
|
+
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2852
|
+
cyan: merge({
|
|
2853
|
+
_hue: "cyan"
|
|
2854
|
+
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2080
2855
|
},
|
|
2081
2856
|
badge: {
|
|
2082
2857
|
default: {
|
|
@@ -2120,13 +2895,11 @@ function resolveInputModeColorTokens(inputTokens, mode) {
|
|
|
2120
2895
|
return states;
|
|
2121
2896
|
}
|
|
2122
2897
|
function resolveInputStateColorTokens(inputTokens, mode, state) {
|
|
2123
|
-
const spec = merge(
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
|
|
2129
|
-
return { ...spec, _hue: hue };
|
|
2898
|
+
const spec = merge(inputTokens?.input?.["*"]?.["*"], inputTokens?.input?.[mode]?.["*"], inputTokens?.input?.["*"]?.[state], inputTokens?.input?.[mode]?.[state]), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
|
|
2899
|
+
return {
|
|
2900
|
+
...spec,
|
|
2901
|
+
_hue: hue
|
|
2902
|
+
};
|
|
2130
2903
|
}
|
|
2131
2904
|
function resolveSelectableColorTokens(inputTokens) {
|
|
2132
2905
|
const tokens = {};
|
|
@@ -2143,25 +2916,38 @@ function resolveSelectableToneColorTokens(inputTokens, tone) {
|
|
|
2143
2916
|
return states;
|
|
2144
2917
|
}
|
|
2145
2918
|
function resolveSelectableStateColorTokens(inputTokens, tone, state) {
|
|
2146
|
-
const spec = merge(
|
|
2147
|
-
inputTokens?.selectable?.["*"]?.["*"],
|
|
2148
|
-
inputTokens?.selectable?.[tone]?.["*"],
|
|
2149
|
-
inputTokens?.selectable?.["*"]?.[state],
|
|
2150
|
-
inputTokens?.selectable?.[tone]?.[state]
|
|
2151
|
-
), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2919
|
+
const spec = merge(inputTokens?.selectable?.["*"]?.["*"], inputTokens?.selectable?.[tone]?.["*"], inputTokens?.selectable?.["*"]?.[state], inputTokens?.selectable?.[tone]?.[state]), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2152
2920
|
return {
|
|
2153
2921
|
...spec,
|
|
2154
2922
|
_hue: hue,
|
|
2155
2923
|
avatar: {
|
|
2156
|
-
gray: merge({
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2924
|
+
gray: merge({
|
|
2925
|
+
_hue: "gray"
|
|
2926
|
+
}, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2927
|
+
blue: merge({
|
|
2928
|
+
_hue: "blue"
|
|
2929
|
+
}, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2930
|
+
purple: merge({
|
|
2931
|
+
_hue: "purple"
|
|
2932
|
+
}, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2933
|
+
magenta: merge({
|
|
2934
|
+
_hue: "magenta"
|
|
2935
|
+
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2936
|
+
red: merge({
|
|
2937
|
+
_hue: "red"
|
|
2938
|
+
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2939
|
+
orange: merge({
|
|
2940
|
+
_hue: "orange"
|
|
2941
|
+
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2942
|
+
yellow: merge({
|
|
2943
|
+
_hue: "yellow"
|
|
2944
|
+
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2945
|
+
green: merge({
|
|
2946
|
+
_hue: "green"
|
|
2947
|
+
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2948
|
+
cyan: merge({
|
|
2949
|
+
_hue: "cyan"
|
|
2950
|
+
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2165
2951
|
},
|
|
2166
2952
|
badge: {
|
|
2167
2953
|
default: {
|
|
@@ -2198,35 +2984,71 @@ function buildColorTheme(config) {
|
|
|
2198
2984
|
color: resolveColorTokens(config?.color)
|
|
2199
2985
|
};
|
|
2200
2986
|
return {
|
|
2201
|
-
light: buildColorScheme({
|
|
2202
|
-
|
|
2987
|
+
light: buildColorScheme({
|
|
2988
|
+
scheme: "light"
|
|
2989
|
+
}, resolvedConfig),
|
|
2990
|
+
dark: buildColorScheme({
|
|
2991
|
+
scheme: "dark"
|
|
2992
|
+
}, resolvedConfig)
|
|
2203
2993
|
};
|
|
2204
2994
|
}
|
|
2205
2995
|
function buildColorScheme(options, config) {
|
|
2206
|
-
const {
|
|
2996
|
+
const {
|
|
2997
|
+
scheme
|
|
2998
|
+
} = options;
|
|
2207
2999
|
return {
|
|
2208
|
-
transparent: buildCardColorTheme({
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
3000
|
+
transparent: buildCardColorTheme({
|
|
3001
|
+
scheme,
|
|
3002
|
+
tone: "transparent"
|
|
3003
|
+
}, config),
|
|
3004
|
+
default: buildCardColorTheme({
|
|
3005
|
+
scheme,
|
|
3006
|
+
tone: "default"
|
|
3007
|
+
}, config),
|
|
3008
|
+
primary: buildCardColorTheme({
|
|
3009
|
+
scheme,
|
|
3010
|
+
tone: "primary"
|
|
3011
|
+
}, config),
|
|
3012
|
+
positive: buildCardColorTheme({
|
|
3013
|
+
scheme,
|
|
3014
|
+
tone: "positive"
|
|
3015
|
+
}, config),
|
|
3016
|
+
caution: buildCardColorTheme({
|
|
3017
|
+
scheme,
|
|
3018
|
+
tone: "caution"
|
|
3019
|
+
}, config),
|
|
3020
|
+
critical: buildCardColorTheme({
|
|
3021
|
+
scheme,
|
|
3022
|
+
tone: "critical"
|
|
3023
|
+
}, config)
|
|
2214
3024
|
};
|
|
2215
3025
|
}
|
|
2216
3026
|
function buildCardColorTheme(options, config) {
|
|
2217
|
-
const {
|
|
3027
|
+
const {
|
|
3028
|
+
scheme,
|
|
3029
|
+
tone
|
|
3030
|
+
} = options, tokens = config?.color?.base?.[tone], context = {
|
|
3031
|
+
hue: tokens?._hue || "gray",
|
|
3032
|
+
scheme
|
|
3033
|
+
};
|
|
2218
3034
|
return {
|
|
2219
3035
|
_blend: (tokens?._blend || ["multiply", "screen"])[scheme === "light" ? 0 : 1],
|
|
2220
3036
|
_dark: scheme === "dark",
|
|
2221
3037
|
accent: {
|
|
2222
3038
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2223
3039
|
},
|
|
2224
|
-
avatar: buildAvatarColorTheme({
|
|
3040
|
+
avatar: buildAvatarColorTheme({
|
|
3041
|
+
scheme
|
|
3042
|
+
}, tokens),
|
|
2225
3043
|
backdrop: resolveColorTokenValue(context, tokens?.backdrop),
|
|
2226
|
-
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
3044
|
+
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
3045
|
+
scheme
|
|
3046
|
+
}, config),
|
|
2227
3047
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2228
3048
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2229
|
-
button: buildButtonColorTheme({
|
|
3049
|
+
button: buildButtonColorTheme({
|
|
3050
|
+
scheme
|
|
3051
|
+
}, config),
|
|
2230
3052
|
code: {
|
|
2231
3053
|
bg: resolveColorTokenValue(context, tokens?.code?.bg),
|
|
2232
3054
|
fg: resolveColorTokenValue(context, tokens?.code?.fg)
|
|
@@ -2234,7 +3056,10 @@ function buildCardColorTheme(options, config) {
|
|
|
2234
3056
|
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2235
3057
|
focusRing: resolveColorTokenValue(context, tokens?.focusRing),
|
|
2236
3058
|
icon: resolveColorTokenValue(context, tokens?.icon),
|
|
2237
|
-
input: buildInputColorTheme({
|
|
3059
|
+
input: buildInputColorTheme({
|
|
3060
|
+
scheme,
|
|
3061
|
+
tone
|
|
3062
|
+
}, config),
|
|
2238
3063
|
kbd: {
|
|
2239
3064
|
bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
|
|
2240
3065
|
fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
|
|
@@ -2247,17 +3072,30 @@ function buildCardColorTheme(options, config) {
|
|
|
2247
3072
|
bg: resolveColorTokenValue(context, tokens?.muted?.bg),
|
|
2248
3073
|
fg: resolveColorTokenValue(context, tokens?.muted?.fg)
|
|
2249
3074
|
},
|
|
2250
|
-
selectable: buildSelectableColorTheme({
|
|
2251
|
-
|
|
3075
|
+
selectable: buildSelectableColorTheme({
|
|
3076
|
+
scheme
|
|
3077
|
+
}, config),
|
|
3078
|
+
shadow: buildShadowColorTheme({
|
|
3079
|
+
scheme,
|
|
3080
|
+
tone
|
|
3081
|
+
}, config),
|
|
2252
3082
|
skeleton: {
|
|
2253
3083
|
from: resolveColorTokenValue(context, tokens?.skeleton?.from),
|
|
2254
3084
|
to: resolveColorTokenValue(context, tokens?.skeleton?.to)
|
|
2255
3085
|
},
|
|
2256
|
-
syntax: buildSyntaxColorTheme({
|
|
3086
|
+
syntax: buildSyntaxColorTheme({
|
|
3087
|
+
scheme
|
|
3088
|
+
}, config)
|
|
2257
3089
|
};
|
|
2258
3090
|
}
|
|
2259
3091
|
function buildShadowColorTheme(options, config) {
|
|
2260
|
-
const {
|
|
3092
|
+
const {
|
|
3093
|
+
scheme,
|
|
3094
|
+
tone
|
|
3095
|
+
} = options, tokens = config?.color?.base?.[tone], context = {
|
|
3096
|
+
hue: tokens?._hue || "gray",
|
|
3097
|
+
scheme
|
|
3098
|
+
};
|
|
2261
3099
|
return {
|
|
2262
3100
|
outline: resolveColorTokenValue(context, tokens?.shadow?.outline),
|
|
2263
3101
|
umbra: resolveColorTokenValue(context, tokens?.shadow?.umbra),
|
|
@@ -2266,21 +3104,56 @@ function buildShadowColorTheme(options, config) {
|
|
|
2266
3104
|
};
|
|
2267
3105
|
}
|
|
2268
3106
|
function buildAvatarColorTheme(options, stateTokens) {
|
|
2269
|
-
const {
|
|
3107
|
+
const {
|
|
3108
|
+
scheme
|
|
3109
|
+
} = options;
|
|
2270
3110
|
return {
|
|
2271
|
-
gray: _buildAvatarColorTheme({
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
3111
|
+
gray: _buildAvatarColorTheme({
|
|
3112
|
+
color: "gray",
|
|
3113
|
+
scheme
|
|
3114
|
+
}, stateTokens),
|
|
3115
|
+
blue: _buildAvatarColorTheme({
|
|
3116
|
+
color: "blue",
|
|
3117
|
+
scheme
|
|
3118
|
+
}, stateTokens),
|
|
3119
|
+
purple: _buildAvatarColorTheme({
|
|
3120
|
+
color: "purple",
|
|
3121
|
+
scheme
|
|
3122
|
+
}, stateTokens),
|
|
3123
|
+
magenta: _buildAvatarColorTheme({
|
|
3124
|
+
color: "magenta",
|
|
3125
|
+
scheme
|
|
3126
|
+
}, stateTokens),
|
|
3127
|
+
red: _buildAvatarColorTheme({
|
|
3128
|
+
color: "red",
|
|
3129
|
+
scheme
|
|
3130
|
+
}, stateTokens),
|
|
3131
|
+
orange: _buildAvatarColorTheme({
|
|
3132
|
+
color: "orange",
|
|
3133
|
+
scheme
|
|
3134
|
+
}, stateTokens),
|
|
3135
|
+
yellow: _buildAvatarColorTheme({
|
|
3136
|
+
color: "yellow",
|
|
3137
|
+
scheme
|
|
3138
|
+
}, stateTokens),
|
|
3139
|
+
green: _buildAvatarColorTheme({
|
|
3140
|
+
color: "green",
|
|
3141
|
+
scheme
|
|
3142
|
+
}, stateTokens),
|
|
3143
|
+
cyan: _buildAvatarColorTheme({
|
|
3144
|
+
color: "cyan",
|
|
3145
|
+
scheme
|
|
3146
|
+
}, stateTokens)
|
|
2280
3147
|
};
|
|
2281
3148
|
}
|
|
2282
3149
|
function _buildAvatarColorTheme(options, stateTokens) {
|
|
2283
|
-
const {
|
|
3150
|
+
const {
|
|
3151
|
+
color: color2,
|
|
3152
|
+
scheme
|
|
3153
|
+
} = options, tokens = stateTokens?.avatar?.[color2], context = {
|
|
3154
|
+
hue: tokens?._hue || "gray",
|
|
3155
|
+
scheme
|
|
3156
|
+
};
|
|
2284
3157
|
return {
|
|
2285
3158
|
_blend: (tokens?._blend || ["screen", "multiply"])[scheme === "light" ? 0 : 1],
|
|
2286
3159
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
@@ -2288,17 +3161,40 @@ function _buildAvatarColorTheme(options, stateTokens) {
|
|
|
2288
3161
|
};
|
|
2289
3162
|
}
|
|
2290
3163
|
function buildBadgeColorTheme(tokens, options, config) {
|
|
2291
|
-
const {
|
|
3164
|
+
const {
|
|
3165
|
+
scheme
|
|
3166
|
+
} = options;
|
|
2292
3167
|
return {
|
|
2293
|
-
default: _buildBadgeColorTheme(tokens, {
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
3168
|
+
default: _buildBadgeColorTheme(tokens, {
|
|
3169
|
+
scheme,
|
|
3170
|
+
tone: "default"
|
|
3171
|
+
}, config),
|
|
3172
|
+
primary: _buildBadgeColorTheme(tokens, {
|
|
3173
|
+
scheme,
|
|
3174
|
+
tone: "primary"
|
|
3175
|
+
}, config),
|
|
3176
|
+
positive: _buildBadgeColorTheme(tokens, {
|
|
3177
|
+
scheme,
|
|
3178
|
+
tone: "positive"
|
|
3179
|
+
}, config),
|
|
3180
|
+
caution: _buildBadgeColorTheme(tokens, {
|
|
3181
|
+
scheme,
|
|
3182
|
+
tone: "caution"
|
|
3183
|
+
}, config),
|
|
3184
|
+
critical: _buildBadgeColorTheme(tokens, {
|
|
3185
|
+
scheme,
|
|
3186
|
+
tone: "critical"
|
|
3187
|
+
}, config)
|
|
2298
3188
|
};
|
|
2299
3189
|
}
|
|
2300
3190
|
function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
2301
|
-
const {
|
|
3191
|
+
const {
|
|
3192
|
+
scheme,
|
|
3193
|
+
tone
|
|
3194
|
+
} = options, tokens = parentTokens?.[tone], context = {
|
|
3195
|
+
hue: tokens?._hue || config?.color?.base?.[tone]?._hue || "gray",
|
|
3196
|
+
scheme
|
|
3197
|
+
};
|
|
2302
3198
|
return {
|
|
2303
3199
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2304
3200
|
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
@@ -2307,32 +3203,65 @@ function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
|
2307
3203
|
};
|
|
2308
3204
|
}
|
|
2309
3205
|
function buildButtonColorTheme(options, config) {
|
|
2310
|
-
const {
|
|
3206
|
+
const {
|
|
3207
|
+
scheme
|
|
3208
|
+
} = options, modes = {};
|
|
2311
3209
|
for (const mode of THEME_COLOR_BUTTON_MODES)
|
|
2312
|
-
modes[mode] = buildButtonTonesColorTheme({
|
|
3210
|
+
modes[mode] = buildButtonTonesColorTheme({
|
|
3211
|
+
scheme,
|
|
3212
|
+
mode
|
|
3213
|
+
}, config);
|
|
2313
3214
|
return modes;
|
|
2314
3215
|
}
|
|
2315
3216
|
function buildButtonTonesColorTheme(options, config) {
|
|
2316
|
-
const {
|
|
3217
|
+
const {
|
|
3218
|
+
mode,
|
|
3219
|
+
scheme
|
|
3220
|
+
} = options, tones2 = {};
|
|
2317
3221
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2318
|
-
tones2[tone] = buildButtonStatesColorTheme({
|
|
3222
|
+
tones2[tone] = buildButtonStatesColorTheme({
|
|
3223
|
+
mode,
|
|
3224
|
+
scheme,
|
|
3225
|
+
tone
|
|
3226
|
+
}, config);
|
|
2319
3227
|
return tones2;
|
|
2320
3228
|
}
|
|
2321
3229
|
function buildButtonStatesColorTheme(options, config) {
|
|
2322
|
-
const {
|
|
3230
|
+
const {
|
|
3231
|
+
mode,
|
|
3232
|
+
scheme,
|
|
3233
|
+
tone
|
|
3234
|
+
} = options, states = {};
|
|
2323
3235
|
for (const state of THEME_COLOR_STATES)
|
|
2324
|
-
states[state] = buildButtonStateColorTheme({
|
|
3236
|
+
states[state] = buildButtonStateColorTheme({
|
|
3237
|
+
mode,
|
|
3238
|
+
tone,
|
|
3239
|
+
scheme,
|
|
3240
|
+
state
|
|
3241
|
+
}, config);
|
|
2325
3242
|
return states;
|
|
2326
3243
|
}
|
|
2327
3244
|
function buildButtonStateColorTheme(options, config) {
|
|
2328
|
-
const {
|
|
3245
|
+
const {
|
|
3246
|
+
mode,
|
|
3247
|
+
tone,
|
|
3248
|
+
scheme,
|
|
3249
|
+
state
|
|
3250
|
+
} = options, tokens = config?.color?.button?.[mode]?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
3251
|
+
hue,
|
|
3252
|
+
scheme
|
|
3253
|
+
};
|
|
2329
3254
|
return {
|
|
2330
3255
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2331
3256
|
accent: {
|
|
2332
3257
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2333
3258
|
},
|
|
2334
|
-
avatar: buildAvatarColorTheme({
|
|
2335
|
-
|
|
3259
|
+
avatar: buildAvatarColorTheme({
|
|
3260
|
+
scheme
|
|
3261
|
+
}, tokens),
|
|
3262
|
+
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
3263
|
+
scheme
|
|
3264
|
+
}, config),
|
|
2336
3265
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2337
3266
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2338
3267
|
code: {
|
|
@@ -2360,23 +3289,66 @@ function buildButtonStateColorTheme(options, config) {
|
|
|
2360
3289
|
};
|
|
2361
3290
|
}
|
|
2362
3291
|
function buildInputColorTheme(options, config) {
|
|
2363
|
-
const {
|
|
3292
|
+
const {
|
|
3293
|
+
scheme,
|
|
3294
|
+
tone
|
|
3295
|
+
} = options;
|
|
2364
3296
|
return {
|
|
2365
|
-
default: buildInputStatesColorTheme({
|
|
2366
|
-
|
|
3297
|
+
default: buildInputStatesColorTheme({
|
|
3298
|
+
mode: "default",
|
|
3299
|
+
scheme,
|
|
3300
|
+
tone
|
|
3301
|
+
}, config),
|
|
3302
|
+
invalid: buildInputStatesColorTheme({
|
|
3303
|
+
mode: "invalid",
|
|
3304
|
+
scheme,
|
|
3305
|
+
tone
|
|
3306
|
+
}, config)
|
|
2367
3307
|
};
|
|
2368
3308
|
}
|
|
2369
3309
|
function buildInputStatesColorTheme(options, config) {
|
|
2370
|
-
const {
|
|
3310
|
+
const {
|
|
3311
|
+
mode,
|
|
3312
|
+
scheme,
|
|
3313
|
+
tone
|
|
3314
|
+
} = options;
|
|
2371
3315
|
return {
|
|
2372
|
-
enabled: buildInputStateColorTheme({
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
3316
|
+
enabled: buildInputStateColorTheme({
|
|
3317
|
+
mode,
|
|
3318
|
+
scheme,
|
|
3319
|
+
state: "enabled",
|
|
3320
|
+
tone
|
|
3321
|
+
}, config),
|
|
3322
|
+
hovered: buildInputStateColorTheme({
|
|
3323
|
+
mode,
|
|
3324
|
+
scheme,
|
|
3325
|
+
state: "hovered",
|
|
3326
|
+
tone
|
|
3327
|
+
}, config),
|
|
3328
|
+
readOnly: buildInputStateColorTheme({
|
|
3329
|
+
mode,
|
|
3330
|
+
scheme,
|
|
3331
|
+
state: "readOnly",
|
|
3332
|
+
tone
|
|
3333
|
+
}, config),
|
|
3334
|
+
disabled: buildInputStateColorTheme({
|
|
3335
|
+
mode,
|
|
3336
|
+
scheme,
|
|
3337
|
+
state: "disabled",
|
|
3338
|
+
tone
|
|
3339
|
+
}, config)
|
|
2376
3340
|
};
|
|
2377
3341
|
}
|
|
2378
3342
|
function buildInputStateColorTheme(options, config) {
|
|
2379
|
-
const {
|
|
3343
|
+
const {
|
|
3344
|
+
mode,
|
|
3345
|
+
tone,
|
|
3346
|
+
scheme,
|
|
3347
|
+
state
|
|
3348
|
+
} = options, tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
3349
|
+
hue,
|
|
3350
|
+
scheme
|
|
3351
|
+
};
|
|
2380
3352
|
return {
|
|
2381
3353
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2382
3354
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
@@ -2389,26 +3361,49 @@ function buildInputStateColorTheme(options, config) {
|
|
|
2389
3361
|
};
|
|
2390
3362
|
}
|
|
2391
3363
|
function buildSelectableColorTheme(options, config) {
|
|
2392
|
-
const {
|
|
3364
|
+
const {
|
|
3365
|
+
scheme
|
|
3366
|
+
} = options, tones2 = {};
|
|
2393
3367
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2394
|
-
tones2[tone] = buildSelectableStatesColorTheme({
|
|
3368
|
+
tones2[tone] = buildSelectableStatesColorTheme({
|
|
3369
|
+
scheme,
|
|
3370
|
+
tone
|
|
3371
|
+
}, config);
|
|
2395
3372
|
return tones2;
|
|
2396
3373
|
}
|
|
2397
3374
|
function buildSelectableStatesColorTheme(options, config) {
|
|
2398
|
-
const {
|
|
3375
|
+
const {
|
|
3376
|
+
scheme,
|
|
3377
|
+
tone
|
|
3378
|
+
} = options, states = {};
|
|
2399
3379
|
for (const state of THEME_COLOR_STATES)
|
|
2400
|
-
states[state] = buildSelectableStateColorTheme({
|
|
3380
|
+
states[state] = buildSelectableStateColorTheme({
|
|
3381
|
+
tone,
|
|
3382
|
+
scheme,
|
|
3383
|
+
state
|
|
3384
|
+
}, config);
|
|
2401
3385
|
return states;
|
|
2402
3386
|
}
|
|
2403
3387
|
function buildSelectableStateColorTheme(options, config) {
|
|
2404
|
-
const {
|
|
3388
|
+
const {
|
|
3389
|
+
scheme,
|
|
3390
|
+
state,
|
|
3391
|
+
tone
|
|
3392
|
+
} = options, tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
3393
|
+
hue,
|
|
3394
|
+
scheme
|
|
3395
|
+
};
|
|
2405
3396
|
return {
|
|
2406
3397
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2407
3398
|
accent: {
|
|
2408
3399
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2409
3400
|
},
|
|
2410
|
-
avatar: buildAvatarColorTheme({
|
|
2411
|
-
|
|
3401
|
+
avatar: buildAvatarColorTheme({
|
|
3402
|
+
scheme
|
|
3403
|
+
}, tokens),
|
|
3404
|
+
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
3405
|
+
scheme
|
|
3406
|
+
}, config),
|
|
2412
3407
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2413
3408
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2414
3409
|
code: {
|
|
@@ -2436,7 +3431,12 @@ function buildSelectableStateColorTheme(options, config) {
|
|
|
2436
3431
|
};
|
|
2437
3432
|
}
|
|
2438
3433
|
function buildSyntaxColorTheme(options, config) {
|
|
2439
|
-
const {
|
|
3434
|
+
const {
|
|
3435
|
+
scheme
|
|
3436
|
+
} = options, tokens = config?.color?.syntax, context = {
|
|
3437
|
+
hue: "gray",
|
|
3438
|
+
scheme
|
|
3439
|
+
};
|
|
2440
3440
|
return {
|
|
2441
3441
|
atrule: resolveColorTokenValue(context, tokens?.atrule),
|
|
2442
3442
|
attrName: resolveColorTokenValue(context, tokens?.attrName),
|
|
@@ -2551,11 +3551,19 @@ function rgbToHex(color2) {
|
|
|
2551
3551
|
const r = round(clamp(Math.round(color2.r), 0, 255)), g = round(clamp(Math.round(color2.g), 0, 255)), b = round(clamp(Math.round(color2.b), 0, 255));
|
|
2552
3552
|
return "a" in color2 ? `rgba(${r},${g},${b},${color2.a})` : "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
2553
3553
|
}
|
|
2554
|
-
function rgbToHsl({
|
|
3554
|
+
function rgbToHsl({
|
|
3555
|
+
r,
|
|
3556
|
+
g,
|
|
3557
|
+
b
|
|
3558
|
+
}) {
|
|
2555
3559
|
r /= 255, g /= 255, b /= 255;
|
|
2556
3560
|
const cmin = Math.min(r, g, b), cmax = Math.max(r, g, b), delta = cmax - cmin;
|
|
2557
3561
|
let h = 0, s = 0, l = 0;
|
|
2558
|
-
return delta == 0 ? h = 0 : cmax == r ? h = (g - b) / delta % 6 : cmax == g ? h = (b - r) / delta + 2 : h = (r - g) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), {
|
|
3562
|
+
return delta == 0 ? h = 0 : cmax == r ? h = (g - b) / delta % 6 : cmax == g ? h = (b - r) / delta + 2 : h = (r - g) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), {
|
|
3563
|
+
h,
|
|
3564
|
+
s,
|
|
3565
|
+
l
|
|
3566
|
+
};
|
|
2559
3567
|
}
|
|
2560
3568
|
function hslToRgb(hsl) {
|
|
2561
3569
|
const s = hsl.s / 100, l = hsl.l / 100, c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(hsl.h / 60 % 2 - 1)), m = l - c / 2;
|
|
@@ -2580,10 +3588,18 @@ function parseHsl(str) {
|
|
|
2580
3588
|
const res = HSL_RE.exec(str);
|
|
2581
3589
|
if (!res)
|
|
2582
3590
|
throw new Error(`parseHsl: string is not a HSL color: "${str}"`);
|
|
2583
|
-
return {
|
|
3591
|
+
return {
|
|
3592
|
+
h: parseInt(res[1]),
|
|
3593
|
+
s: parseFloat(res[3]),
|
|
3594
|
+
l: parseFloat(res[5])
|
|
3595
|
+
};
|
|
2584
3596
|
}
|
|
2585
3597
|
function parseColor(color2) {
|
|
2586
|
-
if (!color2) return {
|
|
3598
|
+
if (!color2) return {
|
|
3599
|
+
r: 0,
|
|
3600
|
+
g: 0,
|
|
3601
|
+
b: 0
|
|
3602
|
+
};
|
|
2587
3603
|
if (typeof color2 != "string")
|
|
2588
3604
|
throw new Error("parseColor: expected a string");
|
|
2589
3605
|
if (isHex(color2))
|
|
@@ -2598,7 +3614,11 @@ function getContrastRatio(bg, fg) {
|
|
|
2598
3614
|
const rgb1 = parseColor(bg), rgb2 = parseColor(fg), c1 = rgb_lrgb(rgb1), c2 = rgb_lrgb(rgb2), l1 = lrgb_luminance(c1), l2 = lrgb_luminance(c2);
|
|
2599
3615
|
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
2600
3616
|
}
|
|
2601
|
-
function rgb_lrgb({
|
|
3617
|
+
function rgb_lrgb({
|
|
3618
|
+
r,
|
|
3619
|
+
g,
|
|
3620
|
+
b
|
|
3621
|
+
}) {
|
|
2602
3622
|
return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
|
|
2603
3623
|
}
|
|
2604
3624
|
function rgb_lrgb1(v) {
|
|
@@ -2613,7 +3633,9 @@ function rgba(color2, a) {
|
|
|
2613
3633
|
}
|
|
2614
3634
|
const RGB_RANGE = [0, 255];
|
|
2615
3635
|
function mixThemeColor(value, options) {
|
|
2616
|
-
const {
|
|
3636
|
+
const {
|
|
3637
|
+
blendMode
|
|
3638
|
+
} = options, color2 = parseColor(value), black2 = parseColor(options.black), white2 = parseColor(options.white), bg = options.bg ? parseColor(options.bg) : blendMode === "multiply" ? white2 : black2, paletteRange = {
|
|
2617
3639
|
r: [black2.r, white2.r],
|
|
2618
3640
|
g: [black2.g, white2.g],
|
|
2619
3641
|
b: [black2.b, white2.b]
|
|
@@ -2633,7 +3655,11 @@ function mixThemeColor(value, options) {
|
|
|
2633
3655
|
return rgbToHex(v);
|
|
2634
3656
|
}
|
|
2635
3657
|
function renderColorValue(str, options) {
|
|
2636
|
-
const {
|
|
3658
|
+
const {
|
|
3659
|
+
bg,
|
|
3660
|
+
blendMode,
|
|
3661
|
+
colorPalette
|
|
3662
|
+
} = options;
|
|
2637
3663
|
if (bg === "white")
|
|
2638
3664
|
throw new Error("Cannot blend with white background");
|
|
2639
3665
|
const node = parseTokenValue(str);
|
|
@@ -2670,17 +3696,31 @@ function renderThemeColorSchemes(value, config) {
|
|
|
2670
3696
|
};
|
|
2671
3697
|
}
|
|
2672
3698
|
function renderThemeColorScheme(colorPalette, value) {
|
|
2673
|
-
const toneEntries = Object.entries(value), [, transparentTone] = toneEntries.find(([k]) => k === "transparent"), [, defaultTone] = toneEntries.find(([k]) => k === "default"), renderedTransparentTone = renderThemeColor(transparentTone, {
|
|
3699
|
+
const toneEntries = Object.entries(value), [, transparentTone] = toneEntries.find(([k]) => k === "transparent"), [, defaultTone] = toneEntries.find(([k]) => k === "default"), renderedTransparentTone = renderThemeColor(transparentTone, {
|
|
3700
|
+
colorPalette
|
|
3701
|
+
}), renderedDefaultTone = renderThemeColor(defaultTone, {
|
|
3702
|
+
colorPalette
|
|
3703
|
+
}), bg = renderedDefaultTone.bg;
|
|
2674
3704
|
if (bg === "white")
|
|
2675
3705
|
throw new Error("Cannot blend with white background");
|
|
2676
|
-
return Object.fromEntries([
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
]);
|
|
3706
|
+
return Object.fromEntries([["transparent", renderedTransparentTone], ["default", renderedDefaultTone], ...toneEntries.filter(([k]) => k !== "default" && k !== "transparent").map(([k, v]) => [k, renderThemeColor(v, {
|
|
3707
|
+
bg,
|
|
3708
|
+
colorPalette
|
|
3709
|
+
})])]);
|
|
2681
3710
|
}
|
|
2682
3711
|
function renderThemeColor(value, options) {
|
|
2683
|
-
const {
|
|
3712
|
+
const {
|
|
3713
|
+
colorPalette,
|
|
3714
|
+
bg
|
|
3715
|
+
} = options, blendMode = value._blend || "multiply", baseBg = renderColorValue(value.bg, {
|
|
3716
|
+
colorPalette,
|
|
3717
|
+
bg,
|
|
3718
|
+
blendMode
|
|
3719
|
+
}), colorOptions = {
|
|
3720
|
+
colorPalette,
|
|
3721
|
+
bg: baseBg,
|
|
3722
|
+
blendMode
|
|
3723
|
+
}, button = renderThemeColorButton(value.button, {
|
|
2684
3724
|
baseBg,
|
|
2685
3725
|
blendMode,
|
|
2686
3726
|
colorPalette
|
|
@@ -2693,17 +3733,26 @@ function renderThemeColor(value, options) {
|
|
|
2693
3733
|
umbra: renderColorValue(value.shadow.umbra, {
|
|
2694
3734
|
...colorOptions,
|
|
2695
3735
|
bg: void 0,
|
|
2696
|
-
colorPalette: {
|
|
3736
|
+
colorPalette: {
|
|
3737
|
+
...colorPalette,
|
|
3738
|
+
black: "#000000"
|
|
3739
|
+
}
|
|
2697
3740
|
}),
|
|
2698
3741
|
penumbra: renderColorValue(value.shadow.penumbra, {
|
|
2699
3742
|
...colorOptions,
|
|
2700
3743
|
bg: void 0,
|
|
2701
|
-
colorPalette: {
|
|
3744
|
+
colorPalette: {
|
|
3745
|
+
...colorPalette,
|
|
3746
|
+
black: "#000000"
|
|
3747
|
+
}
|
|
2702
3748
|
}),
|
|
2703
3749
|
ambient: renderColorValue(value.shadow.ambient, {
|
|
2704
3750
|
...colorOptions,
|
|
2705
3751
|
bg: void 0,
|
|
2706
|
-
colorPalette: {
|
|
3752
|
+
colorPalette: {
|
|
3753
|
+
...colorPalette,
|
|
3754
|
+
black: "#000000"
|
|
3755
|
+
}
|
|
2707
3756
|
})
|
|
2708
3757
|
};
|
|
2709
3758
|
return {
|
|
@@ -2712,9 +3761,17 @@ function renderThemeColor(value, options) {
|
|
|
2712
3761
|
accent: {
|
|
2713
3762
|
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
2714
3763
|
},
|
|
2715
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3764
|
+
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3765
|
+
baseBg,
|
|
3766
|
+
colorPalette,
|
|
3767
|
+
blendMode
|
|
3768
|
+
}),
|
|
2716
3769
|
backdrop: renderColorValue(value.backdrop, colorOptions),
|
|
2717
|
-
badge: renderThemeColorBadge(value.badge, {
|
|
3770
|
+
badge: renderThemeColorBadge(value.badge, {
|
|
3771
|
+
baseBg,
|
|
3772
|
+
colorPalette,
|
|
3773
|
+
blendMode
|
|
3774
|
+
}),
|
|
2718
3775
|
bg: baseBg,
|
|
2719
3776
|
border: renderColorValue(value.border, colorOptions),
|
|
2720
3777
|
button,
|
|
@@ -2725,8 +3782,16 @@ function renderThemeColor(value, options) {
|
|
|
2725
3782
|
fg: renderColorValue(value.fg, colorOptions),
|
|
2726
3783
|
focusRing: renderColorValue(value.focusRing, colorOptions),
|
|
2727
3784
|
icon: renderColorValue(value.icon, colorOptions),
|
|
2728
|
-
input: renderThemeColorInput(value.input, {
|
|
2729
|
-
|
|
3785
|
+
input: renderThemeColorInput(value.input, {
|
|
3786
|
+
baseBg,
|
|
3787
|
+
colorPalette,
|
|
3788
|
+
blendMode
|
|
3789
|
+
}),
|
|
3790
|
+
kbd: renderThemeColorKBD(value.kbd, {
|
|
3791
|
+
baseBg,
|
|
3792
|
+
colorPalette,
|
|
3793
|
+
blendMode
|
|
3794
|
+
}),
|
|
2730
3795
|
link: {
|
|
2731
3796
|
fg: renderColorValue(value.link.fg, colorOptions)
|
|
2732
3797
|
},
|
|
@@ -2739,12 +3804,20 @@ function renderThemeColor(value, options) {
|
|
|
2739
3804
|
from: renderColorValue(value.skeleton.from, colorOptions),
|
|
2740
3805
|
to: renderColorValue(value.skeleton.to, colorOptions)
|
|
2741
3806
|
},
|
|
2742
|
-
syntax: renderSyntaxColorTheme(value.syntax, {
|
|
3807
|
+
syntax: renderSyntaxColorTheme(value.syntax, {
|
|
3808
|
+
baseBg,
|
|
3809
|
+
colorPalette,
|
|
3810
|
+
blendMode
|
|
3811
|
+
}),
|
|
2743
3812
|
selectable
|
|
2744
3813
|
};
|
|
2745
3814
|
}
|
|
2746
3815
|
function renderThemeColorKBD(value, options) {
|
|
2747
|
-
const {
|
|
3816
|
+
const {
|
|
3817
|
+
baseBg,
|
|
3818
|
+
blendMode,
|
|
3819
|
+
colorPalette
|
|
3820
|
+
} = options, rootOptions = {
|
|
2748
3821
|
bg: baseBg,
|
|
2749
3822
|
blendMode,
|
|
2750
3823
|
colorPalette
|
|
@@ -2773,7 +3846,11 @@ function renderThemeColorAvatar(value, options) {
|
|
|
2773
3846
|
};
|
|
2774
3847
|
}
|
|
2775
3848
|
function renderThemeColorAvatarColor(value, options) {
|
|
2776
|
-
const {
|
|
3849
|
+
const {
|
|
3850
|
+
baseBg,
|
|
3851
|
+
blendMode: rootBlendMode,
|
|
3852
|
+
colorPalette
|
|
3853
|
+
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
2777
3854
|
bg: baseBg,
|
|
2778
3855
|
blendMode: rootBlendMode,
|
|
2779
3856
|
colorPalette
|
|
@@ -2798,7 +3875,11 @@ function renderThemeColorBadge(value, options) {
|
|
|
2798
3875
|
};
|
|
2799
3876
|
}
|
|
2800
3877
|
function renderThemeColorBadgeColor(value, options) {
|
|
2801
|
-
const {
|
|
3878
|
+
const {
|
|
3879
|
+
baseBg,
|
|
3880
|
+
blendMode: rootBlendMode,
|
|
3881
|
+
colorPalette
|
|
3882
|
+
} = options, blendMode = rootBlendMode, rootOptions = {
|
|
2802
3883
|
bg: baseBg,
|
|
2803
3884
|
blendMode: rootBlendMode,
|
|
2804
3885
|
colorPalette
|
|
@@ -2840,7 +3921,11 @@ function renderThemeColorButtonStates(value, options) {
|
|
|
2840
3921
|
};
|
|
2841
3922
|
}
|
|
2842
3923
|
function renderThemeColorState(value, options) {
|
|
2843
|
-
const {
|
|
3924
|
+
const {
|
|
3925
|
+
baseBg,
|
|
3926
|
+
blendMode: rootBlendMode,
|
|
3927
|
+
colorPalette
|
|
3928
|
+
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
2844
3929
|
bg: baseBg,
|
|
2845
3930
|
blendMode: rootBlendMode,
|
|
2846
3931
|
colorPalette
|
|
@@ -2854,8 +3939,16 @@ function renderThemeColorState(value, options) {
|
|
|
2854
3939
|
accent: {
|
|
2855
3940
|
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
2856
3941
|
},
|
|
2857
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
2858
|
-
|
|
3942
|
+
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3943
|
+
baseBg: bg,
|
|
3944
|
+
colorPalette,
|
|
3945
|
+
blendMode
|
|
3946
|
+
}),
|
|
3947
|
+
badge: renderThemeColorBadge(value.badge, {
|
|
3948
|
+
baseBg: bg,
|
|
3949
|
+
colorPalette,
|
|
3950
|
+
blendMode
|
|
3951
|
+
}),
|
|
2859
3952
|
bg,
|
|
2860
3953
|
border: renderColorValue(value.border, colorOptions),
|
|
2861
3954
|
code: {
|
|
@@ -2897,7 +3990,19 @@ function renderInputStatesColorTheme(value, options) {
|
|
|
2897
3990
|
};
|
|
2898
3991
|
}
|
|
2899
3992
|
function renderInputStateColorTheme(value, options) {
|
|
2900
|
-
const {
|
|
3993
|
+
const {
|
|
3994
|
+
baseBg,
|
|
3995
|
+
blendMode: rootBlendMode,
|
|
3996
|
+
colorPalette
|
|
3997
|
+
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
3998
|
+
colorPalette,
|
|
3999
|
+
bg: baseBg,
|
|
4000
|
+
blendMode: rootBlendMode
|
|
4001
|
+
}, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
|
|
4002
|
+
colorPalette,
|
|
4003
|
+
bg,
|
|
4004
|
+
blendMode
|
|
4005
|
+
};
|
|
2901
4006
|
return {
|
|
2902
4007
|
_blend: blendMode,
|
|
2903
4008
|
bg,
|
|
@@ -2928,7 +4033,15 @@ function renderThemeColorSelectableStates(value, options) {
|
|
|
2928
4033
|
};
|
|
2929
4034
|
}
|
|
2930
4035
|
function renderSyntaxColorTheme(value, options) {
|
|
2931
|
-
const {
|
|
4036
|
+
const {
|
|
4037
|
+
colorPalette,
|
|
4038
|
+
baseBg,
|
|
4039
|
+
blendMode
|
|
4040
|
+
} = options, colorOptions = {
|
|
4041
|
+
colorPalette,
|
|
4042
|
+
bg: baseBg,
|
|
4043
|
+
blendMode
|
|
4044
|
+
};
|
|
2932
4045
|
return {
|
|
2933
4046
|
atrule: renderColorValue(value.atrule, colorOptions),
|
|
2934
4047
|
attrName: renderColorValue(value.attrName, colorOptions),
|