@sanity/ui 3.0.0-static.10 → 3.0.0-static.11

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.
Files changed (71) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +160 -207
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-es/_visual-editing.mjs +161 -208
  4. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  5. package/dist/_visual-editing.d.mts +1 -3
  6. package/dist/_visual-editing.d.ts +1 -3
  7. package/dist/cli.js +1 -1
  8. package/dist/css.d.mts +115 -2
  9. package/dist/css.d.ts +115 -2
  10. package/dist/css.js +539 -402
  11. package/dist/css.js.map +1 -1
  12. package/dist/css.mjs +541 -404
  13. package/dist/css.mjs.map +1 -1
  14. package/dist/index.d.mts +4 -4
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.js +50 -17
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +45 -12
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/sanity-theme.css +1 -1
  21. package/dist/system.css +418 -182
  22. package/dist/theme.js +10 -11
  23. package/dist/theme.js.map +1 -1
  24. package/dist/theme.mjs +10 -11
  25. package/dist/theme.mjs.map +1 -1
  26. package/package.json +1 -1
  27. package/src/css/_resp.ts +0 -1
  28. package/src/css/aspects/font/font.style.ts +7 -66
  29. package/src/css/aspects/shadow/shadow.style.ts +16 -41
  30. package/src/css/compile/compilePalette.ts +4 -3
  31. package/src/css/compile/compileSystem.ts +0 -3
  32. package/src/css/compile/compileTheme_v3.ts +233 -219
  33. package/src/css/components/skeleton/skeleton.style.ts +8 -4
  34. package/src/css/constants.ts +9 -0
  35. package/src/css/index.ts +1 -0
  36. package/src/css/primitives/_arrow/_arrow.style.ts +6 -8
  37. package/src/css/primitives/_arrow/_arrow.ts +4 -0
  38. package/src/css/primitives/_selectable/_selectable.style.ts +23 -23
  39. package/src/css/primitives/button/button.style.ts +48 -15
  40. package/src/css/primitives/card/card.style.ts +1 -1
  41. package/src/css/primitives/token/token.style.ts +37 -36
  42. package/src/css/responsiveRules.ts +12 -19
  43. package/src/css/types.ts +106 -3
  44. package/src/css/varNames.ts +101 -4
  45. package/src/css/vars.ts +52 -16
  46. package/src/theme/v3/buildTheme_v3.ts +1 -1
  47. package/src/theme/v3/{defaults.ts → defaultTokens.ts} +1 -2
  48. package/src/theme/v3/index.ts +1 -1
  49. package/src/theme/v3/resolveTokens.ts +9 -9
  50. package/src/ui/RootClassNames.tsx +41 -0
  51. package/src/ui/_compat/helpers.ts +72 -0
  52. package/src/ui/_compat/index.ts +2 -6
  53. package/src/ui/_compat/studioTheme.ts +7 -0
  54. package/src/ui/_compat/types.ts +0 -83
  55. package/src/ui/index.ts +1 -0
  56. package/src/ui/primitives/button/button.tsx +5 -6
  57. package/src/ui/primitives/popover/popover.tsx +25 -7
  58. package/src/ui/primitives/popover/popoverCard.tsx +46 -45
  59. package/src/ui/primitives/tooltip/tooltip.tsx +9 -2
  60. package/src/ui/primitives/tooltip/tooltipCard.tsx +1 -1
  61. package/src/ui/utils/arrow/arrow.tsx +3 -11
  62. package/src/ui/utils/elementQuery/elementQuery.tsx +10 -8
  63. package/src/ui/utils/virtualList/virtualList.tsx +37 -32
  64. package/src/css/components/breadcrumbs/rules.ts +0 -25
  65. package/src/css/components/dialog/rules.ts +0 -78
  66. package/src/css/components/skeleton/rules.ts +0 -113
  67. package/src/css/components/toast/rules.ts +0 -18
  68. package/src/css/components/tree/rules.ts +0 -168
  69. package/src/css/primitives/popover/rules.ts +0 -5
  70. package/src/css/primitives/spinner/rules.ts +0 -21
  71. package/src/css/primitives/token/rules.ts +0 -45
@@ -2,10 +2,14 @@ import {FONT_CODE_SIZE, FONT_HEADING_SIZE, FONT_LABEL_SIZE, FONT_TEXT_SIZE} from
2
2
 
3
3
  import {_responsiveRule} from '../../_responsiveRule'
4
4
  import {Style, StyleKeyframes, StyleRules} from '../../types'
5
+ import {varNames} from '../../varNames'
5
6
  import {vars} from '../../vars'
6
7
 
8
+ // TODO: should keyframes be prefixed?
9
+ const KEYFRAMES_PULSE = 'skeleton-pulse'
10
+
7
11
  const keyframes: StyleKeyframes = {
8
- 'skeleton-pulse': {
12
+ [KEYFRAMES_PULSE]: {
9
13
  '0%': {
10
14
  backgroundPosition: '100%',
11
15
  },
@@ -17,8 +21,8 @@ const keyframes: StyleKeyframes = {
17
21
 
18
22
  const component: StyleRules = {
19
23
  '.skeleton': {
20
- '--color-skeleton-from': `color-mix(in srgb, transparent, ${vars.color.muted.fg} 5%)`,
21
- '--color-skeleton-to': `color-mix(in srgb, transparent, ${vars.color.muted.fg} 10%)`,
24
+ [varNames.color.skeleton.from]: `color-mix(in srgb, transparent, ${vars.color.muted.fg} 5%)`,
25
+ [varNames.color.skeleton.to]: `color-mix(in srgb, transparent, ${vars.color.muted.fg} 10%)`,
22
26
 
23
27
  'backgroundColor': vars.color.skeleton.from,
24
28
  'backgroundPosition': '100%',
@@ -38,7 +42,7 @@ const component: StyleRules = {
38
42
  vars.color.skeleton.from,
39
43
  `)`,
40
44
  ].join(', '),
41
- animationName: 'skeleton-pulse',
45
+ animationName: KEYFRAMES_PULSE,
42
46
  animationTimingFunction: 'ease-in-out',
43
47
  animationIterationCount: 'infinite',
44
48
  animationDuration: '2000ms',
@@ -1 +1,10 @@
1
+ export const BREAKPOINTS = {
2
+ 1: 360,
3
+ 2: 600,
4
+ 3: 900,
5
+ 4: 1200,
6
+ 5: 1800,
7
+ 6: 2400,
8
+ }
9
+
1
10
  export const PREFIX = 's-'
package/src/css/index.ts CHANGED
@@ -9,6 +9,7 @@ export * from './components/skeleton'
9
9
  export * from './components/toast'
10
10
  export * from './components/tree'
11
11
  export * from './composeClassNames'
12
+ export * from './constants'
12
13
  export * from './primitives/_arrow'
13
14
  export * from './primitives/_input'
14
15
  export * from './primitives/_selectable'
@@ -20,49 +20,47 @@ const primitive: StyleRules = {
20
20
  },
21
21
 
22
22
  // top
23
-
24
23
  '[data-placement^="top"] > &': {
25
24
  bottom: 'calc(0px - var(--arrow-size))',
26
25
  },
27
-
28
26
  '[data-placement^="top"] > & svg': {
29
27
  transform: 'rotate(0deg)',
30
28
  },
31
29
 
32
30
  // right
33
-
34
31
  '[data-placement^="right"] > &': {
35
32
  left: 'calc(0px - var(--arrow-size))',
36
33
  },
37
-
38
34
  '[data-placement^="right"] > & svg': {
39
35
  transform: 'rotate(90deg)',
40
36
  },
41
37
 
42
38
  // left
43
-
44
39
  '[data-placement^="left"] > &': {
45
40
  right: 'calc(0px - var(--arrow-size))',
46
41
  },
47
-
48
42
  '[data-placement^="left"] > & svg': {
49
43
  transform: 'rotate(-90deg)',
50
44
  },
51
45
 
52
46
  // bottom
53
-
54
47
  '[data-placement^="bottom"] > &': {
55
48
  top: 'calc(0px - var(--arrow-size))',
56
49
  },
57
-
58
50
  '[data-placement^="bottom"] > & svg': {
59
51
  transform: 'rotate(180deg)',
60
52
  },
61
53
  },
62
54
  },
63
55
 
56
+ '.arrow-stroke-mask': {
57
+ // @ts-expect-error `y` is not a valid property in 'csstype'
58
+ y: vars.shadow.outline,
59
+ },
60
+
64
61
  '.arrow-stroke': {
65
62
  stroke: vars.color.shadow.outline,
63
+ strokeWidth: `calc(${vars.card.shadow.outline} * 2)`,
66
64
  },
67
65
 
68
66
  '.arrow-shape': {
@@ -9,6 +9,10 @@ export function _arrowStroke(): string | undefined {
9
9
  return _comp('arrow-stroke')
10
10
  }
11
11
 
12
+ export function _arrowStrokeMask(): string | undefined {
13
+ return _comp('arrow-stroke-mask')
14
+ }
15
+
12
16
  export function _arrowShape(): string | undefined {
13
17
  return _comp('arrow-shape')
14
18
  }
@@ -10,9 +10,9 @@ const primitive: StyleRules = {
10
10
  'backgroundColor': vars.color.bg,
11
11
  'color': vars.color.fg,
12
12
 
13
- '--color-bg': vars.color.tinted.bg[0],
14
- '--color-border': vars.color.tinted.border[2],
15
- '--color-fg': vars.color.tinted.fg[2],
13
+ [varNames.color.bg]: vars.color.tinted.bg[0],
14
+ [varNames.color.border]: vars.color.tinted.border[2],
15
+ [varNames.color.fg]: vars.color.tinted.fg[2],
16
16
 
17
17
  '@nest': {
18
18
  '&:is(button)': {
@@ -43,36 +43,36 @@ const primitive: StyleRules = {
43
43
  },
44
44
 
45
45
  '&:not([data-disabled]):hover': {
46
- '--color-bg': vars.color.tinted.bg[1],
47
- '--color-border': vars.color.tinted.border[3],
48
- '--color-fg': vars.color.tinted.fg[1],
49
- '--color-muted-bg': vars.color.tinted.bg[2],
50
- '--color-muted-fg': vars.color.tinted.fg[4],
46
+ [varNames.color.bg]: vars.color.tinted.bg[1],
47
+ [varNames.color.border]: vars.color.tinted.border[3],
48
+ [varNames.color.fg]: vars.color.tinted.fg[1],
49
+ [varNames.color.muted.bg]: vars.color.tinted.bg[2],
50
+ [varNames.color.muted.fg]: vars.color.tinted.fg[4],
51
51
  },
52
52
 
53
53
  '&:not([data-disabled]):active, &:not([data-disabled])[aria-pressed="true"], &:not([data-disabled])[data-pressed]':
54
54
  {
55
- '--color-bg': vars.color.tinted.bg[2],
56
- '--color-border': vars.color.tinted.border[4],
57
- '--color-fg': vars.color.tinted.fg[0],
58
- '--color-muted-bg': vars.color.tinted.bg[3],
59
- '--color-muted-fg': vars.color.tinted.fg[4],
55
+ [varNames.color.bg]: vars.color.tinted.bg[2],
56
+ [varNames.color.border]: vars.color.tinted.border[4],
57
+ [varNames.color.fg]: vars.color.tinted.fg[0],
58
+ [varNames.color.muted.bg]: vars.color.tinted.bg[3],
59
+ [varNames.color.muted.fg]: vars.color.tinted.fg[4],
60
60
  },
61
61
 
62
62
  '&:not([data-disabled]):focus': {
63
- '--color-bg': vars.color.solid.bg[0],
64
- '--color-border': vars.color.solid.border[1],
65
- '--color-fg': vars.color.solid.fg[1],
66
- '--color-muted-bg': vars.color.solid.bg[1],
67
- '--color-muted-fg': vars.color.solid.fg[3],
63
+ [varNames.color.bg]: vars.color.solid.primary.bg[0],
64
+ [varNames.color.border]: vars.color.solid.primary.border[1],
65
+ [varNames.color.fg]: vars.color.solid.primary.fg[0],
66
+ [varNames.color.muted.bg]: vars.color.solid.primary.bg[1],
67
+ [varNames.color.muted.fg]: vars.color.solid.primary.fg[3],
68
68
  },
69
69
 
70
70
  '&[data-disabled]': {
71
- '--color-bg': vars.color.tinted.bg[0],
72
- '--color-border': vars.color.tinted.border[1],
73
- '--color-fg': vars.color.tinted.border[4],
74
- '--color-muted-bg': vars.color.tinted.bg[1],
75
- '--color-muted-fg': vars.color.tinted.border[4],
71
+ [varNames.color.bg]: vars.color.tinted.bg[0],
72
+ [varNames.color.border]: vars.color.tinted.border[1],
73
+ [varNames.color.fg]: vars.color.tinted.border[4],
74
+ [varNames.color.muted.bg]: vars.color.tinted.bg[1],
75
+ [varNames.color.muted.fg]: vars.color.tinted.border[4],
76
76
  },
77
77
  },
78
78
  },
@@ -96,11 +96,22 @@ for (const tone of THEME_COLOR_STATE_TONES) {
96
96
  },
97
97
 
98
98
  '&[data-disabled]': {
99
- [varNames.color.bg]: vars.color.default.tinted.bg[1],
100
- [varNames.color.border]: vars.color.default.tinted.border[0],
101
- [varNames.color.fg]: vars.color.default.tinted.fg[2],
102
- [varNames.color.muted.bg]: vars.color.default.tinted.bg[2],
103
- [varNames.color.muted.fg]: vars.color.default.tinted.fg[1],
99
+ [varNames.color.avatar.gray.bg]: vars.color.tinted.default.bg[3],
100
+ [varNames.color.avatar.blue.bg]: vars.color.tinted.default.bg[3],
101
+ [varNames.color.avatar.purple.bg]: vars.color.tinted.default.bg[3],
102
+ [varNames.color.avatar.magenta.bg]: vars.color.tinted.default.bg[3],
103
+ [varNames.color.avatar.red.bg]: vars.color.tinted.default.bg[3],
104
+ [varNames.color.avatar.orange.bg]: vars.color.tinted.default.bg[3],
105
+ [varNames.color.avatar.yellow.bg]: vars.color.tinted.default.bg[3],
106
+ [varNames.color.avatar.green.bg]: vars.color.tinted.default.bg[3],
107
+ [varNames.color.avatar.cyan.bg]: vars.color.tinted.default.bg[3],
108
+ [varNames.color.bg]: vars.color.tinted.default.bg[1],
109
+ [varNames.color.border]: vars.color.tinted.default.border[1],
110
+ [varNames.color.code.bg]: vars.color.tinted.default.bg[2],
111
+ [varNames.color.code.fg]: vars.color.tinted.default.border[4],
112
+ [varNames.color.fg]: vars.color.tinted.default.border[4],
113
+ [varNames.color.muted.bg]: vars.color.tinted.default.bg[2],
114
+ [varNames.color.muted.fg]: vars.color.tinted.default.border[4],
104
115
  },
105
116
  },
106
117
  }
@@ -143,11 +154,22 @@ for (const tone of THEME_COLOR_STATE_TONES) {
143
154
  },
144
155
 
145
156
  '&[data-disabled]': {
146
- [varNames.color.bg]: vars.color.default.tinted.bg[1],
147
- [varNames.color.border]: vars.color.default.tinted.border[0],
148
- [varNames.color.fg]: vars.color.default.tinted.fg[2],
149
- [varNames.color.muted.bg]: vars.color.default.tinted.bg[2],
150
- [varNames.color.muted.fg]: vars.color.default.tinted.fg[1],
157
+ [varNames.color.avatar.gray.bg]: vars.color.tinted.default.bg[2],
158
+ [varNames.color.avatar.blue.bg]: vars.color.tinted.default.bg[2],
159
+ [varNames.color.avatar.purple.bg]: vars.color.tinted.default.bg[2],
160
+ [varNames.color.avatar.magenta.bg]: vars.color.tinted.default.bg[2],
161
+ [varNames.color.avatar.red.bg]: vars.color.tinted.default.bg[2],
162
+ [varNames.color.avatar.orange.bg]: vars.color.tinted.default.bg[2],
163
+ [varNames.color.avatar.yellow.bg]: vars.color.tinted.default.bg[2],
164
+ [varNames.color.avatar.green.bg]: vars.color.tinted.default.bg[2],
165
+ [varNames.color.avatar.cyan.bg]: vars.color.tinted.default.bg[2],
166
+ [varNames.color.bg]: vars.color.tinted.default.bg[0],
167
+ [varNames.color.border]: vars.color.tinted.default.border[0],
168
+ [varNames.color.code.bg]: vars.color.tinted.default.bg[1],
169
+ [varNames.color.code.fg]: vars.color.tinted.default.border[3],
170
+ [varNames.color.fg]: vars.color.tinted.default.border[4],
171
+ [varNames.color.muted.bg]: vars.color.tinted.default.bg[1],
172
+ [varNames.color.muted.fg]: vars.color.tinted.default.border[3],
151
173
  },
152
174
  },
153
175
  }
@@ -188,11 +210,22 @@ for (const tone of THEME_COLOR_STATE_TONES) {
188
210
  },
189
211
 
190
212
  '&[data-disabled]': {
191
- [varNames.color.bg]: vars.color.default.tinted.bg[0],
192
- [varNames.color.border]: vars.color.default.tinted.border[0],
193
- [varNames.color.fg]: vars.color.default.tinted.fg[2],
194
- [varNames.color.muted.bg]: vars.color.default.tinted.bg[1],
195
- [varNames.color.muted.fg]: vars.color.default.tinted.fg[1],
213
+ [varNames.color.avatar.gray.bg]: vars.color.tinted.default.bg[2],
214
+ [varNames.color.avatar.blue.bg]: vars.color.tinted.default.bg[2],
215
+ [varNames.color.avatar.purple.bg]: vars.color.tinted.default.bg[2],
216
+ [varNames.color.avatar.magenta.bg]: vars.color.tinted.default.bg[2],
217
+ [varNames.color.avatar.red.bg]: vars.color.tinted.default.bg[2],
218
+ [varNames.color.avatar.orange.bg]: vars.color.tinted.default.bg[2],
219
+ [varNames.color.avatar.yellow.bg]: vars.color.tinted.default.bg[2],
220
+ [varNames.color.avatar.green.bg]: vars.color.tinted.default.bg[2],
221
+ [varNames.color.avatar.cyan.bg]: vars.color.tinted.default.bg[2],
222
+ [varNames.color.bg]: vars.color.tinted.default.bg[0],
223
+ [varNames.color.border]: vars.color.tinted.default.border[0],
224
+ [varNames.color.code.bg]: vars.color.tinted.default.bg[1],
225
+ [varNames.color.code.fg]: vars.color.tinted.default.border[3],
226
+ [varNames.color.fg]: vars.color.tinted.default.border[4],
227
+ [varNames.color.muted.bg]: vars.color.tinted.default.bg[1],
228
+ [varNames.color.muted.fg]: vars.color.tinted.default.border[3],
196
229
  },
197
230
  },
198
231
  }
@@ -96,7 +96,7 @@ const primitive: StyleRules = {
96
96
  // '--color-muted-fg': vars.color.solid.fg[3],
97
97
  // },
98
98
 
99
- 'a&[data-disabled]), button&[data-disabled]': {
99
+ 'a&[data-disabled], button&[data-disabled]': {
100
100
  [varNames.color.bg]: vars.color.tinted.default.bg[2],
101
101
  [varNames.color.border]: vars.color.tinted.default.border[4],
102
102
  [varNames.color.fg]: vars.color.tinted.default.fg[0],
@@ -1,47 +1,48 @@
1
1
  import {Style, StyleRules} from '../../types'
2
+ import {vars} from '../../vars'
2
3
 
3
4
  const primitive: StyleRules = {
4
5
  '.token': {
5
6
  '_prefix': false,
6
7
 
7
8
  '@nest': {
8
- '&.atrule': {color: 'var(--color-token-atrule)'},
9
- '&.attr-name': {color: 'var(--color-token-attr-name)'},
10
- '&.attr-value': {color: 'var(--color-token-attr-value)'},
11
- '&.attribute': {color: 'var(--color-token-attribute)'},
12
- '&.boolean': {color: 'var(--color-token-boolean)'},
13
- '&.builtin': {color: 'var(--color-token-builtin)'},
14
- '&.cdata': {color: 'var(--color-token-cdata)'},
15
- '&.char': {color: 'var(--color-token-char)'},
16
- '&.class': {color: 'var(--color-token-class)'},
17
- '&.class-name': {color: 'var(--color-token-class-name)'},
18
- '&.comment': {color: 'var(--color-token-comment)'},
19
- '&.constant': {color: 'var(--color-token-constant)'},
20
- '&.deleted': {color: 'var(--color-token-deleted)'},
21
- '&.doctype': {color: 'var(--color-token-doctype)'},
22
- '&.entity': {color: 'var(--color-token-entity)'},
23
- '&.function': {color: 'var(--color-token-function)'},
24
- '&.hexcode': {color: 'var(--color-token-hexcode)'},
25
- '&.id': {color: 'var(--color-token-id)'},
26
- '&.important': {color: 'var(--color-token-important)'},
27
- '&.inserted': {color: 'var(--color-token-inserted)'},
28
- '&.keyword': {color: 'var(--color-token-keyword)'},
29
- '&.number': {color: 'var(--color-token-number)'},
30
- '&.operator': {color: 'var(--color-token-operator)'},
31
- '&.prolog': {color: 'var(--color-token-prolog)'},
32
- '&.property': {color: 'var(--color-token-property)'},
33
- '&.pseudo-class': {color: 'var(--color-token-pseudo-class)'},
34
- '&.pseudo-element': {color: 'var(--color-token-pseudo-element)'},
35
- '&.punctuation': {color: 'var(--color-token-punctuation)'},
9
+ '&.atrule': {color: vars.color.code.token.atrule},
10
+ '&.attr-name': {color: vars.color.code.token.attrName},
11
+ '&.attr-value': {color: vars.color.code.token.attrValue},
12
+ '&.attribute': {color: vars.color.code.token.attribute},
13
+ '&.boolean': {color: vars.color.code.token.boolean},
14
+ '&.builtin': {color: vars.color.code.token.builtin},
15
+ '&.cdata': {color: vars.color.code.token.cdata},
16
+ '&.char': {color: vars.color.code.token.char},
17
+ '&.class': {color: vars.color.code.token.class},
18
+ '&.class-name': {color: vars.color.code.token.className},
19
+ '&.comment': {color: vars.color.code.token.comment},
20
+ '&.constant': {color: vars.color.code.token.constant},
21
+ '&.deleted': {color: vars.color.code.token.deleted},
22
+ '&.doctype': {color: vars.color.code.token.doctype},
23
+ '&.entity': {color: vars.color.code.token.entity},
24
+ '&.function': {color: vars.color.code.token.function},
25
+ '&.hexcode': {color: vars.color.code.token.hexcode},
26
+ '&.id': {color: vars.color.code.token.id},
27
+ '&.important': {color: vars.color.code.token.important},
28
+ '&.inserted': {color: vars.color.code.token.inserted},
29
+ '&.keyword': {color: vars.color.code.token.keyword},
30
+ '&.number': {color: vars.color.code.token.number},
31
+ '&.operator': {color: vars.color.code.token.operator},
32
+ '&.prolog': {color: vars.color.code.token.prolog},
33
+ '&.property': {color: vars.color.code.token.property},
34
+ '&.pseudo-class': {color: vars.color.code.token.pseudoClass},
35
+ '&.pseudo-element': {color: vars.color.code.token.pseudoElement},
36
+ '&.punctuation': {color: vars.color.code.token.punctuation},
36
37
  '&.attr-value &:not(.attr-equals).punctuation': {color: 'inherit'},
37
- '&.regex': {color: 'var(--color-token-regex)'},
38
- '&.selector': {color: 'var(--color-token-selector)'},
39
- '&.string': {color: 'var(--color-token-string)'},
40
- '&.symbol': {color: 'var(--color-token-symbol)'},
41
- '&.tag': {color: 'var(--color-token-tag)'},
42
- '&.unit': {color: 'var(--color-token-unit)'},
43
- '&.url': {color: 'var(--color-token-url)'},
44
- '&.variable': {color: 'var(--color-token-variable)'},
38
+ '&.regex': {color: vars.color.code.token.regex},
39
+ '&.selector': {color: vars.color.code.token.selector},
40
+ '&.string': {color: vars.color.code.token.string},
41
+ '&.symbol': {color: vars.color.code.token.symbol},
42
+ '&.tag': {color: vars.color.code.token.tag},
43
+ '&.unit': {color: vars.color.code.token.unit},
44
+ '&.url': {color: vars.color.code.token.url},
45
+ '&.variable': {color: vars.color.code.token.variable},
45
46
  },
46
47
  },
47
48
  }
@@ -1,25 +1,18 @@
1
+ import {BREAKPOINTS} from './constants'
1
2
  import {type Properties, type Rules} from './types'
2
3
 
3
4
  export function responsiveRules(className: string, props: Properties): Rules {
4
- return {
5
+ const rules: Rules = {
5
6
  [className]: props,
6
- [`_1:${className}`]: {
7
- '@media': {'screen and (min-width: 360px)': props},
8
- },
9
- [`_2:${className}`]: {
10
- '@media': {'screen and (min-width: 600px)': props},
11
- },
12
- [`_3:${className}`]: {
13
- '@media': {'screen and (min-width: 900px)': props},
14
- },
15
- [`_4:${className}`]: {
16
- '@media': {'screen and (min-width: 1200px)': props},
17
- },
18
- [`_5:${className}`]: {
19
- '@media': {'screen and (min-width: 1800px)': props},
20
- },
21
- [`_6:${className}`]: {
22
- '@media': {'screen and (min-width: 2400px)': props},
23
- },
24
7
  }
8
+
9
+ for (const [index, width] of Object.entries(BREAKPOINTS)) {
10
+ rules[`_${index}:${className}`] = {
11
+ '@media': {
12
+ [`screen and (min-width: ${width}px)`]: props,
13
+ },
14
+ }
15
+ }
16
+
17
+ return rules
25
18
  }
package/src/css/types.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import {ColorTintKey} from '@sanity/color'
1
2
  import {
2
3
  type AvatarSize,
3
4
  type ContainerWidth,
@@ -58,7 +59,7 @@ export type ThemeVarName =
58
59
  | `--card-border-width`
59
60
  | `--card-focus-ring-offset`
60
61
  | `--card-focus-ring-width`
61
- | `--shadow-outline`
62
+ | `--card-shadow-outline`
62
63
  | `--container-${ContainerWidth}`
63
64
  | `--font-code-family`
64
65
  | `--font-code-feature-settings`
@@ -604,12 +605,27 @@ export interface FontSizeVarNames {
604
605
 
605
606
  export interface FontVarNames<Size extends number> {
606
607
  family: VarName
608
+ featureSettings: VarName
607
609
  sizes: Record<Size, FontSizeVarNames>
608
- weight: Record<FontWeight, VarName>
610
+ weights: Record<FontWeight, VarName>
609
611
  }
610
612
 
611
613
  /** @public */
612
614
  export interface VarNames {
615
+ button: {
616
+ border: {
617
+ width: VarName
618
+ }
619
+ focusRing: {
620
+ offset: VarName
621
+ width: VarName
622
+ }
623
+ }
624
+ card: {
625
+ shadow: {
626
+ outline: VarName
627
+ }
628
+ }
613
629
  color: Record<Scheme, ColorSchemeVarNames> &
614
630
  ScopedColorVarNames &
615
631
  Record<CardTone, ColorCardVarNames>
@@ -630,17 +646,85 @@ export interface VarNames {
630
646
  text: FontVarNames<FontTextSize>
631
647
  }
632
648
  input: {
649
+ border: {
650
+ width: VarName
651
+ }
652
+
653
+ checkbox: {
654
+ focusRing: {
655
+ offset: VarName
656
+ width: VarName
657
+ }
658
+ size: VarName
659
+ }
660
+
661
+ radio: {
662
+ focusRing: {
663
+ offset: VarName
664
+ width: VarName
665
+ }
666
+ markSize: VarName
667
+ size: VarName
668
+ }
669
+
670
+ select: {
671
+ focusRing: {
672
+ offset: VarName
673
+ width: VarName
674
+ }
675
+ }
676
+
677
+ switch: {
678
+ focusRing: {
679
+ offset: VarName
680
+ width: VarName
681
+ }
682
+ height: VarName
683
+ padding: VarName
684
+
685
+ transitionDurationMs: VarName
686
+ transitionTimingFunction: VarName
687
+ width: VarName
688
+ }
689
+
690
+ text: {
691
+ focusRing: {
692
+ offset: VarName
693
+ width: VarName
694
+ }
695
+ }
696
+
633
697
  fontSize: VarName
634
698
  lineHeight: VarName
635
699
  letterSpacing: VarName
636
700
  ascenderHeight: VarName
637
701
  descenderHeight: VarName
638
- // capHeight: CSSVarName
639
702
  gap: VarName
640
703
  padding: VarName
641
704
  }
642
705
  radius: Record<Radius, VarName>
706
+ shadow: Record<
707
+ Shadow,
708
+ {
709
+ umbra: VarName
710
+ penumbra: VarName
711
+ ambient: VarName
712
+ }
713
+ >
643
714
  space: Record<Space, VarName>
715
+
716
+ // color
717
+ black: VarName
718
+ white: VarName
719
+ gray: Record<ColorTintKey, VarName>
720
+ blue: Record<ColorTintKey, VarName>
721
+ purple: Record<ColorTintKey, VarName>
722
+ magenta: Record<ColorTintKey, VarName>
723
+ red: Record<ColorTintKey, VarName>
724
+ orange: Record<ColorTintKey, VarName>
725
+ yellow: Record<ColorTintKey, VarName>
726
+ green: Record<ColorTintKey, VarName>
727
+ cyan: Record<ColorTintKey, VarName>
644
728
  }
645
729
 
646
730
  /** @public */
@@ -817,6 +901,11 @@ export interface Vars {
817
901
  size: CSSVar
818
902
  sizes: Record<AvatarSize, {distance: CSSVar; size: CSSVar}>
819
903
  }
904
+ card: {
905
+ shadow: {
906
+ outline: CSSVar
907
+ }
908
+ }
820
909
  color: {
821
910
  dark: ColorSchemeVars
822
911
  light: ColorSchemeVars
@@ -848,5 +937,19 @@ export interface Vars {
848
937
  }
849
938
  }
850
939
  radius: Record<Radius, CSSVar>
940
+ shadow: Record<Shadow, {umbra: CSSVar; penumbra: CSSVar; ambient: CSSVar}>
851
941
  space: Record<Space, CSSVar>
942
+
943
+ // color
944
+ black: CSSVar
945
+ white: CSSVar
946
+ gray: Record<ColorTintKey, CSSVar>
947
+ blue: Record<ColorTintKey, CSSVar>
948
+ purple: Record<ColorTintKey, CSSVar>
949
+ magenta: Record<ColorTintKey, CSSVar>
950
+ red: Record<ColorTintKey, CSSVar>
951
+ orange: Record<ColorTintKey, CSSVar>
952
+ yellow: Record<ColorTintKey, CSSVar>
953
+ green: Record<ColorTintKey, CSSVar>
954
+ cyan: Record<ColorTintKey, CSSVar>
852
955
  }