@sanity/ui 3.0.0-static.35 → 3.0.0-static.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "3.0.0-static.35",
3
+ "version": "3.0.0-static.36",
4
4
  "keywords": [
5
5
  "react",
6
6
  "ui",
package/src/css/index.ts CHANGED
@@ -4,7 +4,8 @@ export * from './layers.css'
4
4
  export * from './vars.css'
5
5
 
6
6
  // theme
7
- export * from './defaultTheme.css'
7
+ export * from './theme/buildCSSThemeTokens'
8
+ export * from './theme/defaultTheme.css'
8
9
 
9
10
  // props
10
11
  export * from './props/alignItems/alignItems'
@@ -86,8 +87,8 @@ export * from './props/width/types'
86
87
  export * from './primitives/_arrow/_arrow'
87
88
  export * from './primitives/_input/input'
88
89
  export * from './primitives/_input/types'
89
- export * from './primitives/_selectable/selectable'
90
- export * from './primitives/_selectable/types'
90
+ export * from './primitives/selectable/selectable'
91
+ export * from './primitives/selectable/types'
91
92
  export * from './primitives/avatar/avatar'
92
93
  export * from './primitives/avatar/types'
93
94
  export * from './primitives/badge/badge'
@@ -140,4 +141,3 @@ export * from './components/tree/tree'
140
141
 
141
142
  export * from './constants'
142
143
  export * from './types'
143
- export * from './util'
@@ -1,5 +1,5 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
- import {themeClassName} from '../../defaultTheme.css'
2
+ import {themeClassName} from '../../theme/defaultTheme.css'
3
3
  import {height} from '../../props/height/height'
4
4
  import {card} from '../card/card'
5
5
  import {_root} from './root.css'
@@ -40,7 +40,7 @@ export const tones: Record<ElementTone, string> = {
40
40
  _style(layers.primitives, {
41
41
  'vars': {
42
42
  [vars.color.bg]: tinted.bg[0],
43
- [vars.color.border]: tinted.border[2],
43
+ [vars.color.border]: tinted.border[1],
44
44
  [vars.color.fg]: tinted.fg[2],
45
45
  },
46
46
 
@@ -51,7 +51,7 @@ export const tones: Record<ElementTone, string> = {
51
51
  {
52
52
  vars: {
53
53
  [vars.color.bg]: tinted.bg[1],
54
- [vars.color.border]: tinted.border[1],
54
+ [vars.color.border]: tinted.border[2],
55
55
  [vars.color.fg]: tinted.fg[1],
56
56
  },
57
57
  },
@@ -1,6 +1,6 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
2
  import {radius} from '../../props/radius/radius'
3
- import {root, tones} from './_selectable.css'
3
+ import {root, tones} from './selectable.css'
4
4
  import type {SelectableStyleProps} from './types'
5
5
 
6
6
  /** @internal */
@@ -0,0 +1,481 @@
1
+ import {black, hues, white} from '@sanity/color'
2
+ import {
3
+ _parseColorToken,
4
+ AVATAR_COLORS,
5
+ AVATAR_SIZE,
6
+ type BoxShadow,
7
+ buildTheme,
8
+ CARD_TONES,
9
+ type CardColorTokens,
10
+ type CardTone,
11
+ COLOR_VARIANTS,
12
+ type ColorScheme,
13
+ type ColorValue,
14
+ type ColorVariant,
15
+ CONTAINER_SCALE,
16
+ ELEMENT_TONES,
17
+ type ElementTone,
18
+ FONT_CODE_SIZE,
19
+ FONT_HEADING_SIZE,
20
+ FONT_LABEL_SIZE,
21
+ FONT_TEXT_SIZE,
22
+ type Hue,
23
+ HUES,
24
+ RADIUS,
25
+ SHADOW,
26
+ SPACE,
27
+ type Theme,
28
+ type ThemeOptions,
29
+ TINTS,
30
+ } from '@sanity/ui/theme'
31
+
32
+ import {_fromEntries} from '../_fromEntries'
33
+ import type {
34
+ CSSCardColorTokens,
35
+ ElementColorTokens,
36
+ SchemeColorTokens,
37
+ ThemeTokens,
38
+ VariantColorTokens,
39
+ } from '../types'
40
+ import {paletteVars} from '../vars.css'
41
+
42
+ /** @public */
43
+ export function buildCSSThemeTokens(options?: ThemeOptions): ThemeTokens {
44
+ const theme = buildTheme(options)
45
+
46
+ return {
47
+ avatar: {
48
+ focusRing: {
49
+ offset: px(theme.avatar.focusRing.offset),
50
+ width: px(theme.avatar.focusRing.width),
51
+ },
52
+ scale: {
53
+ ..._fromEntries(
54
+ AVATAR_SIZE.map((s) => [
55
+ s,
56
+ {
57
+ distance: px(theme.avatar.sizes[s].distance),
58
+ size: px(theme.avatar.sizes[s].size),
59
+ },
60
+ ]),
61
+ ),
62
+ },
63
+ },
64
+ button: {
65
+ border: {
66
+ width: px(theme.button.border.width),
67
+ },
68
+ focusRing: {
69
+ offset: px(theme.button.focusRing.offset),
70
+ width: px(theme.button.focusRing.width),
71
+ },
72
+ },
73
+ card: {
74
+ shadow: {
75
+ outline: px(theme.card.shadow.outline),
76
+ },
77
+ },
78
+ container: {
79
+ ..._fromEntries(CONTAINER_SCALE.map((s) => [s, rem(theme.container[s])])),
80
+ },
81
+ color: {
82
+ palette: {
83
+ black: black.hex,
84
+ white: white.hex,
85
+ ..._fromEntries(
86
+ HUES.map((h) => [h, {..._fromEntries(TINTS.map((t) => [t, hues[h][t].hex]))}]),
87
+ ),
88
+ },
89
+
90
+ light: renderColorScheme({theme, scheme: 'light'}),
91
+ dark: renderColorScheme({theme, scheme: 'dark'}),
92
+ },
93
+ font: {
94
+ code: {
95
+ family: theme.font.code.family,
96
+ featureSettings: theme.font.code.featureSettings || 'normal',
97
+ weight: {
98
+ regular: theme.font.code.weight.regular.toString(),
99
+ medium: theme.font.code.weight.medium.toString(),
100
+ semibold: theme.font.code.weight.semibold.toString(),
101
+ bold: theme.font.code.weight.bold.toString(),
102
+ },
103
+ scale: {
104
+ ..._fromEntries(
105
+ FONT_CODE_SIZE.map((s) => [
106
+ s,
107
+ {
108
+ fontSize: rem(theme.font.code.scale[s].fontSize),
109
+ lineHeight: rem(theme.font.code.scale[s].lineHeight),
110
+ letterSpacing: rem(theme.font.code.scale[s].letterSpacing),
111
+ ascenderHeight: rem(theme.font.code.scale[s].ascenderHeight),
112
+ descenderHeight: rem(theme.font.code.scale[s].descenderHeight),
113
+ iconSize: rem(theme.font.code.scale[s].iconSize),
114
+ customIconSize: rem(theme.font.code.scale[s].customIconSize),
115
+ },
116
+ ]),
117
+ ),
118
+ },
119
+ },
120
+
121
+ heading: {
122
+ family: theme.font.heading.family,
123
+ featureSettings: theme.font.heading.featureSettings || 'normal',
124
+ weight: {
125
+ regular: theme.font.heading.weight.regular.toString(),
126
+ medium: theme.font.heading.weight.medium.toString(),
127
+ semibold: theme.font.heading.weight.semibold.toString(),
128
+ bold: theme.font.heading.weight.bold.toString(),
129
+ },
130
+ scale: {
131
+ ..._fromEntries(
132
+ FONT_HEADING_SIZE.map((s) => [
133
+ s,
134
+ {
135
+ fontSize: rem(theme.font.heading.scale[s].fontSize),
136
+ lineHeight: rem(theme.font.heading.scale[s].lineHeight),
137
+ letterSpacing: rem(theme.font.heading.scale[s].letterSpacing),
138
+ ascenderHeight: rem(theme.font.heading.scale[s].ascenderHeight),
139
+ descenderHeight: rem(theme.font.heading.scale[s].descenderHeight),
140
+ iconSize: rem(theme.font.heading.scale[s].iconSize),
141
+ customIconSize: rem(theme.font.heading.scale[s].customIconSize),
142
+ },
143
+ ]),
144
+ ),
145
+ },
146
+ },
147
+
148
+ label: {
149
+ family: theme.font.label.family,
150
+ featureSettings: theme.font.label.featureSettings || 'normal',
151
+ weight: {
152
+ regular: theme.font.label.weight.regular.toString(),
153
+ medium: theme.font.label.weight.medium.toString(),
154
+ semibold: theme.font.label.weight.semibold.toString(),
155
+ bold: theme.font.label.weight.bold.toString(),
156
+ },
157
+ scale: {
158
+ ..._fromEntries(
159
+ FONT_LABEL_SIZE.map((s) => [
160
+ s,
161
+ {
162
+ fontSize: rem(theme.font.label.scale[s].fontSize),
163
+ lineHeight: rem(theme.font.label.scale[s].lineHeight),
164
+ letterSpacing: rem(theme.font.label.scale[s].letterSpacing),
165
+ ascenderHeight: rem(theme.font.label.scale[s].ascenderHeight),
166
+ descenderHeight: rem(theme.font.label.scale[s].descenderHeight),
167
+ iconSize: rem(theme.font.label.scale[s].iconSize),
168
+ customIconSize: rem(theme.font.label.scale[s].customIconSize),
169
+ },
170
+ ]),
171
+ ),
172
+ },
173
+ },
174
+
175
+ text: {
176
+ family: theme.font.text.family,
177
+ featureSettings: theme.font.text.featureSettings || 'normal',
178
+ weight: {
179
+ regular: theme.font.text.weight.regular.toString(),
180
+ medium: theme.font.text.weight.medium.toString(),
181
+ semibold: theme.font.text.weight.semibold.toString(),
182
+ bold: theme.font.text.weight.bold.toString(),
183
+ },
184
+ scale: {
185
+ ..._fromEntries(
186
+ FONT_TEXT_SIZE.map((s) => [
187
+ s,
188
+ {
189
+ fontSize: rem(theme.font.text.scale[s].fontSize),
190
+ lineHeight: rem(theme.font.text.scale[s].lineHeight),
191
+ letterSpacing: rem(theme.font.text.scale[s].letterSpacing),
192
+ ascenderHeight: rem(theme.font.text.scale[s].ascenderHeight),
193
+ descenderHeight: rem(theme.font.text.scale[s].descenderHeight),
194
+ iconSize: rem(theme.font.text.scale[s].iconSize),
195
+ customIconSize: rem(theme.font.text.scale[s].customIconSize),
196
+ },
197
+ ]),
198
+ ),
199
+ },
200
+ },
201
+ },
202
+ input: {
203
+ border: {
204
+ width: px(theme.input.border.width),
205
+ },
206
+ checkbox: {
207
+ size: rem(theme.input.checkbox.size),
208
+ focusRing: {
209
+ offset: px(theme.input.checkbox.focusRing.offset),
210
+ width: px(theme.input.checkbox.focusRing.width),
211
+ },
212
+ },
213
+ radio: {
214
+ size: rem(theme.input.radio.size),
215
+ markSize: rem(theme.input.radio.markSize),
216
+ focusRing: {
217
+ offset: px(theme.input.radio.focusRing.offset),
218
+ width: px(theme.input.radio.focusRing.width),
219
+ },
220
+ },
221
+ select: {
222
+ focusRing: {
223
+ offset: px(theme.input.select.focusRing.offset),
224
+ width: px(theme.input.select.focusRing.width),
225
+ },
226
+ },
227
+ switch: {
228
+ width: rem(theme.input.switch.width),
229
+ height: rem(theme.input.switch.height),
230
+ focusRing: {
231
+ offset: px(theme.input.switch.focusRing.offset),
232
+ width: px(theme.input.switch.focusRing.width),
233
+ },
234
+ padding: rem(theme.input.switch.padding),
235
+ transitionDurationMs: `${theme.input.switch.transitionDurationMs}ms`,
236
+ transitionTimingFunction: theme.input.switch.transitionTimingFunction,
237
+ },
238
+ text: {
239
+ focusRing: {
240
+ offset: px(theme.input.text.focusRing.offset),
241
+ width: px(theme.input.text.focusRing.width),
242
+ },
243
+ },
244
+ },
245
+ radius: _fromEntries(RADIUS.map((key) => [key, `${theme.radius[key]}px`])),
246
+ shadow: _fromEntries(
247
+ SHADOW.map((s) => [
248
+ s,
249
+ {
250
+ umbra: toBoxShadow(theme.shadow[s]?.umbra),
251
+ penumbra: toBoxShadow(theme.shadow[s]?.penumbra),
252
+ ambient: toBoxShadow(theme.shadow[s]?.ambient),
253
+ },
254
+ ]),
255
+ ),
256
+ space: _fromEntries(SPACE.map((key) => [key, `${theme.space[key]}px`])),
257
+ } as const
258
+ }
259
+
260
+ function renderColorScheme(options: {theme: Theme; scheme: ColorScheme}): SchemeColorTokens {
261
+ const {theme, scheme} = options
262
+
263
+ const defaultCardColor = renderCardColor({
264
+ theme,
265
+ tone: 'default',
266
+ scheme,
267
+ })
268
+
269
+ return {
270
+ ..._fromEntries(
271
+ CARD_TONES.map((key) => {
272
+ if (key === 'default') {
273
+ return [key, defaultCardColor]
274
+ }
275
+
276
+ return [
277
+ key,
278
+ renderCardColor({
279
+ bgValue: defaultCardColor.tinted.default.bg[0],
280
+ theme,
281
+ tone: key,
282
+ scheme,
283
+ }),
284
+ ]
285
+ }),
286
+ ),
287
+ }
288
+ }
289
+
290
+ function renderCardColor(options: {
291
+ bgValue?: string
292
+ theme: Theme
293
+ tone: CardTone
294
+ scheme: 'light' | 'dark'
295
+ }): CSSCardColorTokens {
296
+ const {bgValue, theme, tone: t, scheme} = options
297
+
298
+ const tokens = theme.color[t]
299
+
300
+ const tintedDefaultVariant = renderColorElement(tokens, {
301
+ bgValue,
302
+ variant: 'tinted',
303
+ scheme,
304
+ tone: 'default',
305
+ })
306
+
307
+ const colorOptions = {
308
+ bgValue: tintedDefaultVariant.bg[0],
309
+ defaultHue: tokens._hue ?? 'gray',
310
+ scheme,
311
+ } as const
312
+
313
+ return {
314
+ avatar: {
315
+ ..._fromEntries(
316
+ AVATAR_COLORS.map((c) => [
317
+ c,
318
+ {
319
+ bg: renderColor(tokens.avatar[c].bg, {...colorOptions, defaultHue: c}),
320
+ fg: renderColor(tokens.avatar[c].fg, {...colorOptions, defaultHue: c}),
321
+ },
322
+ ]),
323
+ ),
324
+ },
325
+ backdrop: renderColor(tokens.backdrop, colorOptions),
326
+ code: {
327
+ bg: renderColor(tokens.code.bg, colorOptions),
328
+ fg: renderColor(tokens.code.fg, colorOptions),
329
+
330
+ token: {
331
+ atrule: renderColor(tokens.code.token.atrule, colorOptions),
332
+ attrName: renderColor(tokens.code.token.attrName, colorOptions),
333
+ attrValue: renderColor(tokens.code.token.attrValue, colorOptions),
334
+ attribute: renderColor(tokens.code.token.attribute, colorOptions),
335
+ boolean: renderColor(tokens.code.token.boolean, colorOptions),
336
+ builtin: renderColor(tokens.code.token.builtin, colorOptions),
337
+ cdata: renderColor(tokens.code.token.cdata, colorOptions),
338
+ char: renderColor(tokens.code.token.char, colorOptions),
339
+ class: renderColor(tokens.code.token.class, colorOptions),
340
+ className: renderColor(tokens.code.token.className, colorOptions),
341
+ comment: renderColor(tokens.code.token.comment, colorOptions),
342
+ constant: renderColor(tokens.code.token.constant, colorOptions),
343
+ deleted: renderColor(tokens.code.token.deleted, colorOptions),
344
+ doctype: renderColor(tokens.code.token.doctype, colorOptions),
345
+ entity: renderColor(tokens.code.token.entity, colorOptions),
346
+ function: renderColor(tokens.code.token.function, colorOptions),
347
+ hexcode: renderColor(tokens.code.token.hexcode, colorOptions),
348
+ id: renderColor(tokens.code.token.id, colorOptions),
349
+ important: renderColor(tokens.code.token.important, colorOptions),
350
+ inserted: renderColor(tokens.code.token.inserted, colorOptions),
351
+ keyword: renderColor(tokens.code.token.keyword, colorOptions),
352
+ number: renderColor(tokens.code.token.number, colorOptions),
353
+ operator: renderColor(tokens.code.token.operator, colorOptions),
354
+ prolog: renderColor(tokens.code.token.prolog, colorOptions),
355
+ property: renderColor(tokens.code.token.property, colorOptions),
356
+ pseudoClass: renderColor(tokens.code.token.pseudoClass, colorOptions),
357
+ pseudoElement: renderColor(tokens.code.token.pseudoElement, colorOptions),
358
+ punctuation: renderColor(tokens.code.token.punctuation, colorOptions),
359
+ regex: renderColor(tokens.code.token.regex, colorOptions),
360
+ selector: renderColor(tokens.code.token.selector, colorOptions),
361
+ string: renderColor(tokens.code.token.string, colorOptions),
362
+ symbol: renderColor(tokens.code.token.symbol, colorOptions),
363
+ tag: renderColor(tokens.code.token.tag, colorOptions),
364
+ unit: renderColor(tokens.code.token.unit, colorOptions),
365
+ url: renderColor(tokens.code.token.url, colorOptions),
366
+ variable: renderColor(tokens.code.token.variable, colorOptions),
367
+ },
368
+ },
369
+ focusRing: renderColor(tokens.focusRing, colorOptions),
370
+ link: {
371
+ fg: renderColor(tokens.link.fg, colorOptions),
372
+ },
373
+ shadow: {
374
+ outline: renderColor(tokens.shadow.outline, colorOptions),
375
+ umbra: renderColor(tokens.shadow.umbra, colorOptions),
376
+ penumbra: renderColor(tokens.shadow.penumbra, colorOptions),
377
+ ambient: renderColor(tokens.shadow.ambient, colorOptions),
378
+ },
379
+ skeleton: {
380
+ from: renderColor(tokens.skeleton.from, colorOptions),
381
+ to: renderColor(tokens.skeleton.to, colorOptions),
382
+ },
383
+ // variants
384
+ ..._fromEntries(
385
+ COLOR_VARIANTS.map((v) => [
386
+ v,
387
+ {
388
+ ..._fromEntries(
389
+ ELEMENT_TONES.map((t) => {
390
+ if (v === 'tinted' && t === 'default') {
391
+ return [t, tintedDefaultVariant]
392
+ }
393
+
394
+ return [t, renderColorElement(tokens, {scheme, variant: v, tone: t})]
395
+ }),
396
+ ),
397
+ } satisfies VariantColorTokens,
398
+ ]),
399
+ ),
400
+ }
401
+ }
402
+
403
+ function renderColorElement(
404
+ tokens: CardColorTokens,
405
+ options: {
406
+ bgValue?: string
407
+ scheme: ColorScheme
408
+ variant: ColorVariant
409
+ tone: ElementTone
410
+ },
411
+ ): ElementColorTokens {
412
+ const {bgValue, scheme, variant: v, tone: t} = options
413
+
414
+ const elementColorOptions = {bgValue, defaultHue: tokens.variant[v][t]._hue, scheme}
415
+
416
+ return {
417
+ bg: {
418
+ 0: renderColor(tokens.variant[v][t].bg[0], elementColorOptions),
419
+ 4: renderColor(tokens.variant[v][t].bg[4], elementColorOptions),
420
+ },
421
+ border: {
422
+ 0: renderColor(tokens.variant[v][t].border[0], elementColorOptions),
423
+ 4: renderColor(tokens.variant[v][t].border[4], elementColorOptions),
424
+ },
425
+ fg: {
426
+ 0: renderColor(tokens.variant[v][t].fg[0], elementColorOptions),
427
+ 4: renderColor(tokens.variant[v][t].fg[4], elementColorOptions),
428
+ },
429
+ }
430
+ }
431
+
432
+ function renderColor(
433
+ value: ColorValue,
434
+ context: {bgValue?: string; defaultHue: Hue; scheme: 'light' | 'dark'},
435
+ ): string {
436
+ const {bgValue = 'transparent', defaultHue, scheme} = context
437
+
438
+ const expr = _parseColorToken(value[scheme === 'light' ? 0 : 1], {defaultHue})
439
+
440
+ if (expr.type === 'inherit') {
441
+ return bgValue
442
+ }
443
+
444
+ let v = bgValue
445
+
446
+ if (expr.type === 'color') {
447
+ v = paletteVars[expr.name]
448
+ }
449
+
450
+ if (expr.type === 'tint') {
451
+ v = paletteVars[expr.hue][expr.tint]
452
+ }
453
+
454
+ if (expr.mix < 1) {
455
+ v = `color-mix(in srgb, ${bgValue}, ${v} ${expr.mix * 100}%)`
456
+ }
457
+
458
+ if (expr.opacity < 1) {
459
+ v = `color-mix(in srgb, transparent, ${v} ${expr.opacity * 100}%)`
460
+ }
461
+
462
+ return v
463
+ }
464
+
465
+ function rem(value: number): string {
466
+ if (value === 0) return '0'
467
+
468
+ return `${value / 16}rem`
469
+ }
470
+
471
+ function px(value: number): string {
472
+ if (value === 0) return '0'
473
+
474
+ return `${value}px`
475
+ }
476
+
477
+ function toBoxShadow(value: BoxShadow | undefined): string {
478
+ if (!value) return 'none'
479
+
480
+ return value.map((n) => px(n)).join(' ')
481
+ }
@@ -0,0 +1,64 @@
1
+ import {createTheme, globalFontFace} from '@vanilla-extract/css'
2
+
3
+ import {layers} from '../layers.css'
4
+ import {themeVars} from '../vars.css'
5
+ import {buildCSSThemeTokens} from './buildCSSThemeTokens'
6
+
7
+ const fontDisplay: FontDisplay = 'swap'
8
+
9
+ globalFontFace('Inter', [
10
+ {
11
+ src: `url('https://studio-static.sanity.io/Inter-Regular.woff2') format('woff2')`,
12
+ fontDisplay,
13
+ fontStyle: 'normal',
14
+ fontWeight: '400',
15
+ },
16
+ {
17
+ src: `url('https://studio-static.sanity.io/Inter-Italic.woff2') format('woff2')`,
18
+ fontDisplay,
19
+ fontStyle: 'italic',
20
+ fontWeight: '400',
21
+ },
22
+ {
23
+ src: `url('https://studio-static.sanity.io/Inter-Medium.woff2') format('woff2')`,
24
+ fontDisplay,
25
+ fontStyle: 'normal',
26
+ fontWeight: '500',
27
+ },
28
+ {
29
+ src: `url('https://studio-static.sanity.io/Inter-MediumItalic.woff2') format('woff2')`,
30
+ fontDisplay,
31
+ fontStyle: 'italic',
32
+ fontWeight: '500',
33
+ },
34
+ {
35
+ src: `url('https://studio-static.sanity.io/Inter-SemiBold.woff2') format('woff2')`,
36
+ fontDisplay,
37
+ fontStyle: 'normal',
38
+ fontWeight: '600',
39
+ },
40
+ {
41
+ src: `url('https://studio-static.sanity.io/Inter-SemiBoldItalic.woff2') format('woff2')`,
42
+ fontDisplay,
43
+ fontStyle: 'italic',
44
+ fontWeight: '600',
45
+ },
46
+ {
47
+ src: `url('https://studio-static.sanity.io/Inter-Bold.woff2') format('woff2')`,
48
+ fontDisplay,
49
+ fontStyle: 'normal',
50
+ fontWeight: '700',
51
+ },
52
+ {
53
+ src: `url('https://studio-static.sanity.io/Inter-BoldItalic.woff2') format('woff2')`,
54
+ fontDisplay,
55
+ fontStyle: 'italic',
56
+ fontWeight: '700',
57
+ },
58
+ ])
59
+
60
+ /** @public */
61
+ export const themeClassName: string = createTheme(themeVars, {
62
+ '@layer': layers.theme,
63
+ ...buildCSSThemeTokens(),
64
+ })
package/src/css/types.ts CHANGED
@@ -153,7 +153,7 @@ export type FontTokens<FontScaleIndex extends number> = {
153
153
  }
154
154
 
155
155
  /** @public */
156
- export type ThemeTokens = {
156
+ export type CoreThemeTokens = {
157
157
  avatar: {
158
158
  focusRing: {
159
159
  offset: string
@@ -245,7 +245,7 @@ export type ThemeTokens = {
245
245
  }
246
246
 
247
247
  /** @public */
248
- export type RootThemeTokens = ThemeTokens & {
248
+ export type ThemeTokens = CoreThemeTokens & {
249
249
  color: {palette: ColorPaletteTokens}
250
250
  }
251
251
 
@@ -418,4 +418,4 @@ export type ColorPaletteVars = ThemeContract<ColorPaletteTokens>
418
418
  export type ScopedVars = ThemeContract<ScopedTokens>
419
419
 
420
420
  /** @public */
421
- export type ThemeVars = ThemeContract<RootThemeTokens & ScopedTokens> // _CSSThemeWithoutPaletteTokens & ScopedVars
421
+ export type ThemeVars = ThemeContract<ThemeTokens & ScopedTokens> // _CSSThemeWithoutPaletteTokens & ScopedVars
@@ -21,7 +21,7 @@ import {_fromEntries} from './_fromEntries'
21
21
  import type {
22
22
  ColorPaletteTokens,
23
23
  ColorPaletteVars,
24
- RootThemeTokens,
24
+ CoreThemeTokens,
25
25
  ThemeContract,
26
26
  ThemeTokens,
27
27
  ThemeVars,
@@ -40,10 +40,10 @@ const paletteTokens: ColorPaletteTokens = {
40
40
  ),
41
41
  }
42
42
 
43
- /** @public */
43
+ /** @internal */
44
44
  export const paletteVars: ColorPaletteVars = createThemeContract(paletteTokens)
45
45
 
46
- const themeTokens: ThemeTokens = {
46
+ const themeTokens: CoreThemeTokens = {
47
47
  avatar: {
48
48
  focusRing: {
49
49
  offset: '',
@@ -350,13 +350,13 @@ const themeTokens: ThemeTokens = {
350
350
  },
351
351
  }
352
352
 
353
- const _themeVars: ThemeContract<ThemeTokens> = createThemeContract(themeTokens)
353
+ const _themeVars: ThemeContract<CoreThemeTokens> = createThemeContract(themeTokens)
354
354
 
355
355
  /**
356
356
  * Variables to be defined in a theme.
357
357
  *
358
- * @public */
359
- export const themeVars: ThemeContract<RootThemeTokens> = {
358
+ * @internal */
359
+ export const themeVars: ThemeContract<ThemeTokens> = {
360
360
  ..._themeVars,
361
361
  color: {
362
362
  ..._themeVars.color,
@@ -4,10 +4,10 @@ import {defaultColor} from './defaults/color'
4
4
  import {defaultTheme} from './defaults/common'
5
5
  import {defaultFonts} from './defaults/fonts'
6
6
  import {resolveTokens} from './resolveTokens'
7
- import type {Options, Theme} from './types'
7
+ import type {Theme, ThemeOptions} from './types'
8
8
 
9
9
  /** @public */
10
- export function buildTheme(options?: Options): Theme {
10
+ export function buildTheme(options?: ThemeOptions): Theme {
11
11
  const tokens = resolveTokens({
12
12
  ...options?.tokens,
13
13
  color: options?.tokens?.color ?? defaultColor,