@tanstack/devtools-ui 0.5.3 → 0.7.0

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 (63) hide show
  1. package/dist/assets/BricolageGrotesque-Bold-BIJrwikb.ttf +0 -0
  2. package/dist/assets/Inter-latin-BwkfbSeq.woff2 +0 -0
  3. package/dist/esm/assets/fonts/BricolageGrotesque-Bold.js +6 -0
  4. package/dist/esm/assets/fonts/BricolageGrotesque-Bold.js.map +1 -0
  5. package/dist/esm/assets/fonts/Inter-latin.js +6 -0
  6. package/dist/esm/assets/fonts/Inter-latin.js.map +1 -0
  7. package/dist/esm/components/button.js +3 -3
  8. package/dist/esm/components/button.js.map +1 -1
  9. package/dist/esm/components/checkbox.js +16 -10
  10. package/dist/esm/components/checkbox.js.map +1 -1
  11. package/dist/esm/components/header.js +4 -4
  12. package/dist/esm/components/header.js.map +1 -1
  13. package/dist/esm/components/icons.d.ts +1 -1
  14. package/dist/esm/components/icons.js +4 -8
  15. package/dist/esm/components/icons.js.map +1 -1
  16. package/dist/esm/components/input.js +16 -9
  17. package/dist/esm/components/input.js.map +1 -1
  18. package/dist/esm/components/logo.js +3 -3
  19. package/dist/esm/components/logo.js.map +1 -1
  20. package/dist/esm/components/main-panel.js +3 -3
  21. package/dist/esm/components/main-panel.js.map +1 -1
  22. package/dist/esm/components/section.js +6 -6
  23. package/dist/esm/components/section.js.map +1 -1
  24. package/dist/esm/components/select.js +24 -13
  25. package/dist/esm/components/select.js.map +1 -1
  26. package/dist/esm/components/tag.js +3 -3
  27. package/dist/esm/components/tag.js.map +1 -1
  28. package/dist/esm/components/theme.d.ts +1 -1
  29. package/dist/esm/components/theme.js +15 -5
  30. package/dist/esm/components/theme.js.map +1 -1
  31. package/dist/esm/components/tree.js +114 -62
  32. package/dist/esm/components/tree.js.map +1 -1
  33. package/dist/esm/index.d.ts +1 -1
  34. package/dist/esm/index.js +2 -2
  35. package/dist/esm/internal.d.ts +2 -0
  36. package/dist/esm/internal.js +2 -0
  37. package/dist/esm/styles/semantic-theme.d.ts +420 -0
  38. package/dist/esm/styles/semantic-theme.js +283 -0
  39. package/dist/esm/styles/semantic-theme.js.map +1 -0
  40. package/dist/esm/styles/use-styles.d.ts +3 -1
  41. package/dist/esm/styles/use-styles.js +304 -372
  42. package/dist/esm/styles/use-styles.js.map +1 -1
  43. package/package.json +15 -3
  44. package/src/assets/fonts/OFL-Bricolage-Grotesque.txt +93 -0
  45. package/src/assets/fonts/OFL-Inter.txt +92 -0
  46. package/src/components/button.tsx +3 -3
  47. package/src/components/checkbox.tsx +9 -5
  48. package/src/components/header.tsx +10 -4
  49. package/src/components/icons.tsx +5 -5
  50. package/src/components/input.tsx +14 -5
  51. package/src/components/logo.tsx +3 -2
  52. package/src/components/main-panel.tsx +3 -2
  53. package/src/components/section.tsx +15 -7
  54. package/src/components/select.tsx +29 -10
  55. package/src/components/tag.tsx +7 -3
  56. package/src/components/theme.tsx +18 -5
  57. package/src/components/tree.tsx +96 -29
  58. package/src/index.ts +1 -1
  59. package/src/internal.ts +11 -0
  60. package/src/styles/semantic-theme.ts +345 -0
  61. package/src/styles/use-styles.ts +318 -310
  62. package/dist/esm/styles/tokens.js +0 -301
  63. package/dist/esm/styles/tokens.js.map +0 -1
@@ -1,138 +1,32 @@
1
1
  import * as goober from 'goober'
2
2
  import { createEffect, createSignal } from 'solid-js'
3
- import { useTheme } from '../components/theme'
4
- import { tokens } from './tokens'
3
+ import { createTheme } from '../components/theme'
4
+ import { resolveSemanticTheme } from './semantic-theme'
5
+ import type { tokens } from './tokens'
5
6
 
6
7
  import type { TanStackDevtoolsTheme } from '../components/theme'
7
8
  import type { ButtonVariant } from '../components/button'
8
9
 
9
- const buttonVariantColors: Record<
10
- ButtonVariant,
11
- {
12
- bg: { light: string; dark: string }
13
- hover: { light: string; dark: string }
14
- active: { light: string; dark: string }
15
- text: { light: string; dark: string }
16
- border: { light: string; dark: string }
17
- outline: { light: string; dark: string }
18
- outlineHover: { light: string; dark: string }
19
- }
20
- > = {
21
- primary: {
22
- bg: { light: tokens.colors.gray[900], dark: tokens.colors.gray[100] },
23
- hover: { light: tokens.colors.gray[800], dark: tokens.colors.gray[200] },
24
- active: { light: tokens.colors.gray[700], dark: tokens.colors.gray[300] },
25
- text: { light: '#fff', dark: tokens.colors.gray[900] },
26
- border: { light: tokens.colors.gray[800], dark: tokens.colors.gray[200] },
27
- outline: {
28
- light: tokens.colors.gray[900],
29
- dark: tokens.colors.gray[100],
30
- },
31
- outlineHover: {
32
- light: tokens.colors.gray[800],
33
- dark: tokens.colors.gray[200],
34
- },
35
- },
36
- secondary: {
37
- bg: { light: tokens.colors.gray[100], dark: tokens.colors.gray[100] },
38
- hover: { light: tokens.colors.gray[200], dark: tokens.colors.gray[200] },
39
- active: { light: tokens.colors.gray[300], dark: tokens.colors.gray[300] },
40
- text: { light: tokens.colors.gray[900], dark: tokens.colors.gray[900] },
41
- border: { light: tokens.colors.gray[300], dark: tokens.colors.gray[300] },
42
- outline: {
43
- light: tokens.colors.gray[700],
44
- dark: tokens.colors.gray[300],
45
- },
46
- outlineHover: {
47
- light: tokens.colors.gray[800],
48
- dark: tokens.colors.gray[200],
49
- },
50
- },
51
- info: {
52
- bg: { light: tokens.colors.blue[500], dark: tokens.colors.blue[500] },
53
- hover: { light: tokens.colors.blue[600], dark: tokens.colors.blue[600] },
54
- active: { light: tokens.colors.blue[700], dark: tokens.colors.blue[700] },
55
- text: { light: '#fff', dark: '#fff' },
56
- border: { light: tokens.colors.blue[500], dark: tokens.colors.blue[500] },
57
- outline: {
58
- light: tokens.colors.blue[700],
59
- dark: tokens.colors.blue[300],
60
- },
61
- outlineHover: {
62
- light: tokens.colors.blue[600],
63
- dark: tokens.colors.blue[200],
64
- },
65
- },
66
- warning: {
67
- bg: { light: tokens.colors.yellow[500], dark: tokens.colors.yellow[500] },
68
- hover: {
69
- light: tokens.colors.yellow[600],
70
- dark: tokens.colors.yellow[600],
71
- },
72
- active: {
73
- light: tokens.colors.yellow[700],
74
- dark: tokens.colors.yellow[700],
75
- },
76
- text: { light: '#fff', dark: '#fff' },
77
- border: {
78
- light: tokens.colors.yellow[500],
79
- dark: tokens.colors.yellow[500],
80
- },
81
- outline: {
82
- light: tokens.colors.yellow[700],
83
- dark: tokens.colors.yellow[300],
84
- },
85
- outlineHover: {
86
- light: tokens.colors.yellow[600],
87
- dark: tokens.colors.yellow[200],
88
- },
89
- },
90
- danger: {
91
- bg: { light: tokens.colors.red[500], dark: tokens.colors.red[500] },
92
- hover: { light: tokens.colors.red[600], dark: tokens.colors.red[600] },
93
- active: { light: tokens.colors.red[700], dark: tokens.colors.red[700] },
94
- text: { light: '#fff', dark: '#fff' },
95
- border: { light: tokens.colors.red[500], dark: tokens.colors.red[500] },
96
- outline: {
97
- light: tokens.colors.red[700],
98
- dark: tokens.colors.red[300],
99
- },
100
- outlineHover: {
101
- light: tokens.colors.red[600],
102
- dark: tokens.colors.red[200],
103
- },
104
- },
105
- success: {
106
- bg: { light: tokens.colors.green[500], dark: tokens.colors.green[500] },
107
- hover: { light: tokens.colors.green[600], dark: tokens.colors.green[600] },
108
- active: { light: tokens.colors.green[700], dark: tokens.colors.green[700] },
109
- text: { light: '#fff', dark: '#fff' },
110
- border: { light: tokens.colors.green[500], dark: tokens.colors.green[500] },
111
- outline: {
112
- light: tokens.colors.green[700],
113
- dark: tokens.colors.green[300],
114
- },
115
- outlineHover: {
116
- light: tokens.colors.green[600],
117
- dark: tokens.colors.green[200],
118
- },
119
- },
120
- }
121
10
  export const css = goober.css
122
11
  const stylesFactory = (theme: TanStackDevtoolsTheme) => {
123
- const { colors, font, size, border } = tokens
124
- const { fontFamily } = font
12
+ const semantic = resolveSemanticTheme(theme)
125
13
 
126
14
  const t = (light: string, dark: string) => (theme === 'light' ? light : dark)
127
15
  const buildButtonVariant = (variant: ButtonVariant) => {
128
- const v = buttonVariantColors[variant]
129
- const outlineColor = t(v.outline.light, v.outline.dark)
130
- const outlineHoverColor = t(v.outlineHover.light, v.outlineHover.dark)
131
- const solidBg = t(v.bg.light, v.bg.dark)
132
- const solidHover = t(v.hover.light, v.hover.dark)
133
- const solidActive = t(v.active.light, v.active.dark)
134
- const solidText = t(v.text.light, v.text.dark)
135
- const solidBorder = t(v.border.light, v.border.dark)
16
+ const statusRole =
17
+ variant === 'danger'
18
+ ? 'error'
19
+ : variant === 'primary' || variant === 'secondary'
20
+ ? 'neutral'
21
+ : variant
22
+ const status = semantic.color.status[statusRole]
23
+ const outlineColor = status.text
24
+ const outlineHoverColor = status.text
25
+ const solidBg = status.solidFill
26
+ const solidHover = status.border
27
+ const solidActive = status.solidFill
28
+ const solidText = status.onFill
29
+ const solidBorder = status.border
136
30
 
137
31
  return {
138
32
  ghost: css`
@@ -140,11 +34,11 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
140
34
  color: ${outlineColor};
141
35
  border-color: transparent;
142
36
  &:hover {
143
- background: ${t(colors.gray[100], colors.darkGray[800])};
37
+ background: ${semantic.color.state.hover};
144
38
  color: ${outlineHoverColor};
145
39
  }
146
40
  &:active {
147
- background: ${t(colors.gray[200], colors.darkGray[700])};
41
+ background: ${semantic.color.state.pressed};
148
42
  color: ${outlineHoverColor};
149
43
  }
150
44
  `,
@@ -153,12 +47,12 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
153
47
  color: ${outlineColor};
154
48
  border-color: ${outlineColor};
155
49
  &:hover {
156
- background: ${t(colors.gray[50], colors.darkGray[800])};
50
+ background: ${semantic.color.state.hover};
157
51
  color: ${outlineHoverColor};
158
52
  border-color: ${outlineHoverColor};
159
53
  }
160
54
  &:active {
161
- background: ${t(colors.gray[100], colors.darkGray[700])};
55
+ background: ${semantic.color.state.pressed};
162
56
  color: ${outlineHoverColor};
163
57
  border-color: ${outlineHoverColor};
164
58
  }
@@ -170,18 +64,12 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
170
64
  &:hover {
171
65
  background: ${solidHover};
172
66
  border-color: ${solidHover};
173
- box-shadow: ${t(
174
- tokens.shadow.xs('rgb(0 0 0 / 0.12)'),
175
- tokens.shadow.xs('rgb(0 0 0 / 0.5)'),
176
- )};
67
+ box-shadow: ${semantic.shadow.xs};
177
68
  }
178
69
  &:active {
179
70
  background: ${solidActive};
180
71
  border-color: ${solidActive};
181
- box-shadow: ${t(
182
- tokens.shadow.inner('rgb(0 0 0 / 0.2)'),
183
- tokens.shadow.inner('rgb(0 0 0 / 0.6)'),
184
- )};
72
+ box-shadow: ${semantic.shadow.sm};
185
73
  }
186
74
  `,
187
75
  }
@@ -199,6 +87,19 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
199
87
  }
200
88
 
201
89
  const wrapperSize = 320
90
+ const legacyTagColor = (color: keyof typeof tokens.colors) => {
91
+ const semanticRole =
92
+ color === 'red'
93
+ ? 'error'
94
+ : color === 'yellow'
95
+ ? 'warning'
96
+ : color === 'green'
97
+ ? 'success'
98
+ : color === 'blue' || color === 'cyan' || color === 'teal'
99
+ ? 'info'
100
+ : 'neutral'
101
+ return semantic.color.status[semanticRole].solidFill
102
+ }
202
103
 
203
104
  return {
204
105
  logo: css`
@@ -207,10 +108,10 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
207
108
  flex-direction: column;
208
109
  background-color: transparent;
209
110
  border: none;
210
- width: ${size[12]};
211
- height: ${size[12]};
212
- font-family: ${fontFamily.sans};
213
- gap: ${tokens.size[0.5]};
111
+ width: 48px;
112
+ height: 48px;
113
+ font-family: ${semantic.font.body};
114
+ gap: ${semantic.gap.tight};
214
115
  padding: 0;
215
116
  &:hover {
216
117
  opacity: 0.7;
@@ -222,50 +123,77 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
222
123
  max-width: ${wrapperSize}px;
223
124
  display: flex;
224
125
  flex-direction: column;
225
- gap: 0.375rem;
126
+ gap: ${semantic.gap.tight};
226
127
  `,
227
128
  selectContainer: css`
228
129
  width: 100%;
130
+ &::selection,
131
+ & *::selection {
132
+ background: ${semantic.color.state.selectionFill};
133
+ color: ${semantic.color.state.selectionText};
134
+ }
229
135
  `,
230
136
  selectLabel: css`
231
- font-size: 0.875rem;
232
- font-weight: 500;
233
- color: ${t(colors.gray[900], colors.gray[100])};
137
+ font: ${semantic.type.labelSm.weight} ${semantic.type.labelSm.size} /
138
+ ${semantic.type.labelSm.lineHeight} ${semantic.font.body};
139
+ letter-spacing: ${semantic.type.labelSm.tracking};
140
+ color: ${semantic.color.text.primary};
234
141
  text-align: left;
235
142
  `,
236
143
  selectDescription: css`
237
- font-size: 0.8rem;
238
- color: ${t(colors.gray[500], colors.gray[400])};
144
+ font: ${semantic.type.bodyXs.weight} ${semantic.type.bodyXs.size} /
145
+ ${semantic.type.bodyXs.lineHeight} ${semantic.font.body};
146
+ color: ${semantic.color.text.secondary};
239
147
  margin: 0;
240
- line-height: 1.3;
241
148
  text-align: left;
242
149
  `,
243
150
  select: css`
151
+ /* The platform chevron is drawn in the OS accent, which reads as foreign
152
+ next to the rest of the panel — draw our own from currentColor instead
153
+ so it follows the theme. */
244
154
  appearance: none;
155
+ -webkit-appearance: none;
245
156
  width: 100%;
246
- padding: 0.5rem 3rem 0.5rem 0.75rem;
247
- border-radius: 0.375rem;
248
- background-color: ${t(colors.gray[50], colors.darkGray[800])};
249
- color: ${t(colors.gray[900], colors.gray[100])};
250
- border: 1px solid ${t(colors.gray[200], colors.gray[800])};
251
- font-size: 0.875rem;
252
- transition: all 0.15s ease;
253
- cursor: pointer;
254
-
255
- /* Custom arrow */
256
- background-image: url("data:image/svg+xml;utf8,<svg fill='%236b7280' height='20' viewBox='0 0 24 24' width='20' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
157
+ box-sizing: border-box;
158
+ padding: ${semantic.padding.controlBlock} 28px
159
+ ${semantic.padding.controlBlock} ${semantic.padding.controlInline};
160
+ border-radius: ${semantic.radius.control};
161
+ background-color: ${semantic.color.surface.elevated};
162
+ background-image:
163
+ linear-gradient(45deg, transparent 50%, currentColor 50%),
164
+ linear-gradient(135deg, currentColor 50%, transparent 50%);
165
+ background-position:
166
+ right 14px center,
167
+ right 9px center;
168
+ background-size:
169
+ 5px 5px,
170
+ 5px 5px;
257
171
  background-repeat: no-repeat;
258
- background-position: right 0.75rem center;
259
- background-size: 1.25rem;
172
+ color: ${semantic.color.text.primary};
173
+ border: 1px solid ${semantic.color.border.control};
174
+ font: ${semantic.type.bodySm.weight} ${semantic.type.bodySm.size} /
175
+ ${semantic.type.bodySm.lineHeight} ${semantic.font.body};
176
+ transition:
177
+ border-color 0.15s ease,
178
+ background-color 0.15s ease;
179
+ cursor: pointer;
260
180
 
261
181
  &:hover {
262
- border-color: ${t(colors.gray[300], colors.gray[700])};
182
+ border-color: ${semantic.color.border.focus};
263
183
  }
264
184
 
265
- &:focus {
266
- outline: none;
267
- border-color: ${colors.gray[400]};
268
- box-shadow: 0 0 0 3px ${t(colors.gray[200], colors.gray[800])};
185
+ &:focus-visible {
186
+ outline: 2px solid ${semantic.color.border.focus};
187
+ outline-offset: 2px;
188
+ }
189
+ /* The custom chevron is decorative; let the platform draw its own when
190
+ the user forces system colours. */
191
+ @media (forced-colors: active) {
192
+ appearance: auto;
193
+ background-image: none;
194
+ }
195
+ @media (prefers-reduced-motion: reduce) {
196
+ transition: none;
269
197
  }
270
198
  `,
271
199
  inputWrapper: css`
@@ -273,117 +201,134 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
273
201
  max-width: ${wrapperSize}px;
274
202
  display: flex;
275
203
  flex-direction: column;
276
- gap: 0.375rem;
204
+ gap: ${semantic.gap.tight};
277
205
  `,
278
206
  inputContainer: css`
279
207
  width: 100%;
208
+ &::selection,
209
+ & *::selection {
210
+ background: ${semantic.color.state.selectionFill};
211
+ color: ${semantic.color.state.selectionText};
212
+ }
280
213
  `,
281
214
  inputLabel: css`
282
- font-size: 0.875rem;
283
- font-weight: 500;
284
- color: ${t(colors.gray[900], colors.gray[100])};
215
+ font: ${semantic.type.labelSm.weight} ${semantic.type.labelSm.size} /
216
+ ${semantic.type.labelSm.lineHeight} ${semantic.font.body};
217
+ letter-spacing: ${semantic.type.labelSm.tracking};
218
+ color: ${semantic.color.text.primary};
285
219
  text-align: left;
286
220
  `,
287
221
  inputDescription: css`
288
- font-size: 0.8rem;
289
- color: ${t(colors.gray[500], colors.gray[400])};
222
+ font: ${semantic.type.bodyXs.weight} ${semantic.type.bodyXs.size} /
223
+ ${semantic.type.bodyXs.lineHeight} ${semantic.font.body};
224
+ color: ${semantic.color.text.secondary};
290
225
  margin: 0;
291
- line-height: 1.3;
292
226
  text-align: left;
293
227
  `,
294
228
  input: css`
295
229
  appearance: none;
296
230
  box-sizing: border-box;
297
231
  width: 100%;
298
- padding: 0.5rem 0.75rem;
299
- border-radius: 0.375rem;
300
- background-color: ${t(colors.gray[50], colors.darkGray[800])};
301
- color: ${t(colors.gray[900], colors.gray[100])};
302
- border: 1px solid ${t(colors.gray[200], colors.gray[800])};
303
- font-size: 0.875rem;
304
- font-family: ${fontFamily.mono};
232
+ padding: ${semantic.padding.controlBlock}
233
+ ${semantic.padding.controlInline};
234
+ border-radius: ${semantic.radius.control};
235
+ background-color: ${semantic.color.surface.elevated};
236
+ color: ${semantic.color.text.primary};
237
+ border: 1px solid ${semantic.color.border.control};
238
+ font: ${semantic.type.bodySm.weight} ${semantic.type.bodySm.size} /
239
+ ${semantic.type.bodySm.lineHeight} ${semantic.font.body};
305
240
  transition: all 0.15s ease;
306
241
 
307
242
  &::placeholder {
308
- color: ${t(colors.gray[400], colors.gray[500])};
243
+ color: ${semantic.color.text.secondary};
309
244
  }
310
245
 
311
246
  &:hover {
312
- border-color: ${t(colors.gray[300], colors.gray[700])};
247
+ border-color: ${semantic.color.border.focus};
313
248
  }
314
249
 
315
250
  &:focus {
316
- outline: none;
317
- border-color: ${t(colors.gray[400], colors.gray[600])};
318
- box-shadow: 0 0 0 3px ${t(colors.gray[200], colors.gray[800])};
251
+ outline: 2px solid ${semantic.color.border.focus};
252
+ outline-offset: 2px;
319
253
  }
320
254
  `,
321
255
  checkboxWrapper: css`
322
256
  display: flex;
323
257
  align-items: flex-start;
324
- gap: 0.75rem;
258
+ gap: ${semantic.gap.control};
325
259
  cursor: pointer;
326
260
  user-select: none;
327
- padding: 0.375rem;
328
- border-radius: 0.375rem;
261
+ padding: ${semantic.padding.controlBlock}
262
+ ${semantic.padding.controlInline};
263
+ border-radius: ${semantic.radius.control};
329
264
  transition: background-color 0.15s ease;
330
265
 
331
266
  &:hover {
332
- background-color: ${t(colors.gray[50], colors.darkGray[900])};
267
+ background-color: ${semantic.color.state.hover};
333
268
  }
334
269
  `,
335
270
  checkboxContainer: css`
336
271
  width: 100%;
272
+ &::selection,
273
+ & *::selection {
274
+ background: ${semantic.color.state.selectionFill};
275
+ color: ${semantic.color.state.selectionText};
276
+ }
337
277
  `,
338
278
  checkboxLabelContainer: css`
339
279
  display: flex;
340
280
  flex-direction: column;
341
- gap: 0.25rem;
281
+ gap: ${semantic.gap.tight};
342
282
  flex: 1;
343
283
  `,
344
284
  checkbox: css`
345
285
  appearance: none;
346
- width: 1.25rem;
347
- height: 1.25rem;
348
- border: 2px solid ${t(colors.gray[300], colors.gray[700])};
349
- border-radius: 0.25rem;
350
- background-color: ${t(colors.gray[50], colors.darkGray[800])};
286
+ width: ${semantic.space[4]};
287
+ height: ${semantic.space[4]};
288
+ border: 2px solid ${semantic.color.border.control};
289
+ border-radius: ${semantic.radius.control};
290
+ background-color: ${semantic.color.surface.elevated};
351
291
  display: grid;
352
292
  place-items: center;
353
293
  transition: all 0.15s ease;
354
294
  flex-shrink: 0;
355
- margin-top: 0.125rem;
295
+ margin-top: ${semantic.space[1]};
356
296
 
357
297
  &:hover {
358
- border-color: ${t(colors.gray[400], colors.gray[600])};
298
+ border-color: ${semantic.color.border.focus};
299
+ }
300
+
301
+ &:focus-visible {
302
+ outline: 2px solid ${semantic.color.border.focus};
303
+ outline-offset: 2px;
359
304
  }
360
305
 
361
306
  &:checked {
362
- background-color: ${t(colors.gray[900], colors.gray[100])};
363
- border-color: ${t(colors.gray[900], colors.gray[100])};
307
+ background-color: ${semantic.color.state.selectionFill};
308
+ border-color: ${semantic.color.state.selectionFill};
364
309
  }
365
310
 
366
311
  &:checked::after {
367
312
  content: '';
368
- width: 0.4rem;
369
- height: 0.6rem;
370
- border: solid ${t('#fff', colors.gray[900])};
313
+ width: ${semantic.space[1]};
314
+ height: ${semantic.space[2]};
315
+ border: solid ${semantic.color.state.selectionText};
371
316
  border-width: 0 2px 2px 0;
372
317
  transform: rotate(45deg);
373
318
  margin-top: -3px;
374
319
  }
375
320
  `,
376
321
  checkboxLabel: css`
377
- color: ${t(colors.gray[900], colors.gray[100])};
378
- font-size: 0.875rem;
379
- font-weight: 500;
380
- line-height: 1.4;
322
+ color: ${semantic.color.text.primary};
323
+ font: ${semantic.type.labelSm.weight} ${semantic.type.labelSm.size} /
324
+ ${semantic.type.labelSm.lineHeight} ${semantic.font.body};
325
+ letter-spacing: ${semantic.type.labelSm.tracking};
381
326
  text-align: left;
382
327
  `,
383
328
  checkboxDescription: css`
384
- color: ${t(colors.gray[500], colors.gray[400])};
385
- font-size: 0.8rem;
386
- line-height: 1.3;
329
+ color: ${semantic.color.text.secondary};
330
+ font: ${semantic.type.bodyXs.weight} ${semantic.type.bodyXs.size} /
331
+ ${semantic.type.bodyXs.lineHeight} ${semantic.font.body};
387
332
  text-align: left;
388
333
  `,
389
334
  button: {
@@ -391,20 +336,29 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
391
336
  display: inline-flex;
392
337
  align-items: center;
393
338
  justify-content: center;
394
- font-family: ${tokens.font.fontFamily.sans};
395
- font-size: 0.8rem;
396
- font-weight: 500;
397
- border-radius: 0.375rem;
398
- padding: 0.375rem 0.75rem;
339
+ font-family: ${semantic.font.body};
340
+ font-size: ${semantic.type.bodyXs.size};
341
+ line-height: ${semantic.type.bodyXs.lineHeight};
342
+ font-weight: ${semantic.type.labelSm.weight};
343
+ border-radius: ${semantic.radius.control};
344
+ padding: ${semantic.padding.controlBlock}
345
+ ${semantic.padding.controlInline};
399
346
  cursor: pointer;
400
347
  transition:
401
348
  background 0.15s,
402
349
  color 0.15s,
403
350
  border 0.15s,
404
351
  box-shadow 0.15s;
405
- outline: none;
352
+ &:focus-visible {
353
+ outline: 2px solid ${semantic.color.border.focus};
354
+ outline-offset: 2px;
355
+ }
406
356
  border-width: 1px;
407
357
  border-style: solid;
358
+ &:disabled {
359
+ cursor: not-allowed;
360
+ opacity: 0.6;
361
+ }
408
362
  `,
409
363
  variant(variant: ButtonVariant, outline?: boolean, ghost?: boolean) {
410
364
  const v = buttonVariants[variant]
@@ -419,81 +373,95 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
419
373
  },
420
374
  tag: {
421
375
  dot: (color: keyof typeof tokens.colors) => css`
422
- width: ${tokens.size[1.5]};
423
- height: ${tokens.size[1.5]};
424
- border-radius: ${tokens.border.radius.full};
425
- background-color: ${t(
426
- tokens.colors[color][500],
427
- tokens.colors[color][500],
428
- )};
376
+ width: ${semantic.space[1]};
377
+ height: ${semantic.space[1]};
378
+ border-radius: 9999px;
379
+ background-color: ${legacyTagColor(color)};
429
380
  `,
430
381
  base: css`
431
382
  display: flex;
432
- gap: ${tokens.size[1.5]};
383
+ gap: ${semantic.gap.tight};
433
384
  box-sizing: border-box;
434
- height: ${tokens.size[6.5]};
435
- background: ${t(colors.gray[50], colors.darkGray[500])};
436
- color: ${t(colors.gray[700], colors.gray[300])};
437
- border-radius: ${tokens.border.radius.sm};
438
- font-size: ${font.size.sm};
439
- padding: ${tokens.size[1]};
440
- padding-left: ${tokens.size[1.5]};
385
+ background: ${semantic.color.surface.subtle};
386
+ color: ${semantic.color.text.primary};
387
+ border-radius: ${semantic.radius.control};
388
+ font-size: ${semantic.type.bodyXs.size};
389
+ line-height: ${semantic.type.bodyXs.lineHeight};
390
+ font-family: ${semantic.font.body};
391
+ padding: ${semantic.padding.controlBlock}
392
+ ${semantic.padding.controlInline};
441
393
  align-items: center;
442
- font-weight: ${font.weight.medium};
443
- border: ${t('1px solid ' + colors.gray[300], '1px solid transparent')};
394
+ font-weight: ${semantic.type.labelSm.weight};
395
+ border: 1px solid ${semantic.color.border.control};
444
396
  user-select: none;
445
397
  position: relative;
398
+ &::selection,
399
+ & *::selection {
400
+ background: ${semantic.color.state.selectionFill};
401
+ color: ${semantic.color.state.selectionText};
402
+ }
446
403
  &:focus-visible {
447
404
  outline-offset: 2px;
448
- outline: 2px solid ${t(colors.blue[700], colors.blue[800])};
405
+ outline: 2px solid ${semantic.color.border.focus};
449
406
  }
450
407
  `,
451
408
  label: css`
452
- font-size: ${font.size.xs};
409
+ font-size: ${semantic.type.bodyXs.size};
410
+ line-height: ${semantic.type.bodyXs.lineHeight};
411
+ font-family: ${semantic.font.body};
412
+ letter-spacing: ${semantic.type.labelSm.tracking};
453
413
  `,
454
414
  count: css`
455
- font-size: ${font.size.xs};
456
- padding: 0 5px;
415
+ font-size: ${semantic.type.bodyXs.size};
416
+ padding: 0 ${semantic.space[1]};
457
417
  display: flex;
458
418
  align-items: center;
459
419
  justify-content: center;
460
- color: ${t(colors.gray[500], colors.gray[400])};
461
- background-color: ${t(colors.gray[200], colors.darkGray[300])};
462
- border-radius: 2px;
420
+ color: ${semantic.color.text.secondary};
421
+ background-color: ${semantic.color.state.hover};
422
+ border-radius: ${semantic.radius.control};
423
+ line-height: ${semantic.type.bodyXs.lineHeight};
424
+ font-family: ${semantic.font.body};
463
425
  font-variant-numeric: tabular-nums;
464
- height: ${tokens.size[4.5]};
426
+ min-height: ${semantic.space[4]};
465
427
  `,
466
428
  },
467
429
  tree: {
468
430
  info: css`
469
- color: ${t(colors.gray[500], colors.gray[500])};
470
- font-size: ${font.size.xs};
471
- margin-right: ${size[1]};
431
+ color: ${semantic.color.text.secondary};
432
+ font-size: ${semantic.type.bodyXs.size};
433
+ margin-right: ${semantic.space[1]};
472
434
  `,
473
435
  actionButton: css`
474
436
  background-color: transparent;
475
- color: ${t(colors.gray[500], colors.gray[500])};
437
+ color: ${semantic.color.text.secondary};
476
438
  border: none;
477
439
  display: inline-flex;
478
440
  padding: 0;
479
441
  align-items: center;
480
442
  justify-content: center;
481
443
  cursor: pointer;
482
- width: ${size[3]};
483
- height: ${size[3]};
444
+ width: ${semantic.space[3]};
445
+ height: ${semantic.space[3]};
484
446
  position: relative;
485
447
  z-index: 1;
486
448
 
487
449
  &:hover svg {
488
- color: ${t(colors.gray[600], colors.gray[400])};
450
+ color: ${semantic.color.text.primary};
489
451
  }
490
452
 
491
453
  &:focus-visible {
492
- border-radius: ${border.radius.xs};
493
- outline: 2px solid ${t(colors.blue[700], colors.blue[800])};
454
+ border-radius: ${semantic.radius.control};
455
+ outline: 2px solid ${semantic.color.border.focus};
494
456
  outline-offset: 2px;
495
457
  }
496
458
  `,
459
+ actionSuccess: css`
460
+ color: ${semantic.color.status.success.text};
461
+ `,
462
+ actionError: css`
463
+ color: ${semantic.color.status.error.text};
464
+ `,
497
465
  expanderContainer: css`
498
466
  position: relative;
499
467
  `,
@@ -503,38 +471,43 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
503
471
  left: -16px;
504
472
  top: 3px;
505
473
  & path {
506
- stroke: ${t(colors.blue[400], colors.blue[300])};
474
+ stroke: ${semantic.color.text.link};
507
475
  }
508
476
  & svg {
509
- width: ${size[3]};
510
- height: ${size[3]};
477
+ width: ${semantic.space[3]};
478
+ height: ${semantic.space[3]};
511
479
  }
512
480
 
513
481
  display: inline-flex;
514
482
  align-items: center;
515
483
  transition: all 0.1s ease;
484
+ &:focus-visible {
485
+ border-radius: ${semantic.radius.control};
486
+ outline: 2px solid ${semantic.color.border.focus};
487
+ outline-offset: 2px;
488
+ }
516
489
  `,
517
490
  expandedLine: (hasBorder: boolean) => css`
518
491
  display: block;
519
- padding-left: 0.75rem;
520
- margin-left: -0.7rem;
492
+ padding-left: ${semantic.space[3]};
493
+ margin-left: -${semantic.space[3]};
521
494
  ${hasBorder
522
- ? `border-left: 1px solid ${t(colors.blue[400], colors.blue[300])};`
495
+ ? `border-left: 1px solid ${semantic.color.border.decorative};`
523
496
  : ''}
524
497
  `,
525
498
  collapsible: css`
526
499
  cursor: pointer;
527
500
  transition: all 0.2s ease;
528
501
  &:hover {
529
- background-color: ${t(colors.gray[100], colors.darkGray[700])};
530
- border-radius: ${tokens.border.radius.sm};
531
- padding: 0 ${tokens.size[1]};
502
+ background-color: ${semantic.color.state.hover};
503
+ border-radius: ${semantic.radius.control};
504
+ padding: 0 ${semantic.space[1]};
532
505
  }
533
506
  `,
534
507
  actions: css`
535
508
  display: inline-flex;
536
- margin-left: ${size[2]};
537
- gap: ${size[2]};
509
+ margin-left: ${semantic.space[2]};
510
+ gap: ${semantic.gap.control};
538
511
  align-items: center;
539
512
  & svg {
540
513
  height: 12px;
@@ -542,33 +515,43 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
542
515
  }
543
516
  `,
544
517
  valueCollapsed: css`
545
- color: ${t(colors.gray[500], colors.gray[400])};
518
+ color: ${semantic.color.text.secondary};
546
519
  `,
547
520
  valueFunction: css`
548
- color: ${t(colors.cyan[500], colors.cyan[400])};
521
+ color: ${semantic.color.syntax.keyword};
549
522
  `,
550
523
  valueString: css`
551
- color: ${t(colors.green[500], colors.green[400])};
524
+ color: ${semantic.color.syntax.string};
552
525
  `,
553
526
  valueNumber: css`
554
- color: ${t(colors.yellow[500], colors.yellow[400])};
527
+ color: ${semantic.color.syntax.number};
555
528
  `,
556
529
  valueBoolean: css`
557
- color: ${t(colors.pink[500], colors.pink[400])};
530
+ color: ${semantic.color.syntax.keyword};
558
531
  `,
559
532
  valueNull: css`
560
- color: ${t(colors.gray[500], colors.gray[400])};
533
+ color: ${semantic.color.syntax.comment};
561
534
  font-style: italic;
562
535
  `,
563
536
  valueKey: css`
564
- color: ${t(colors.blue[400], colors.blue[300])};
537
+ color: ${semantic.color.syntax.property};
565
538
  `,
566
539
  valueBraces: css`
567
- color: ${colors.gray[500]};
540
+ color: ${semantic.color.syntax.punctuation};
568
541
  `,
569
542
  valueContainer: (isRoot: boolean) => css`
570
543
  display: block;
571
- margin-left: ${isRoot ? '0' : '1rem'};
544
+ font-family: ${semantic.font.mono};
545
+ &::selection,
546
+ & *::selection {
547
+ background: ${semantic.color.state.selectionFill};
548
+ color: ${semantic.color.state.selectionText};
549
+ }
550
+ & [data-tsd-syntax]::selection {
551
+ background: ${semantic.color.syntax.selectionFill};
552
+ color: ${semantic.color.syntax.selectionText};
553
+ }
554
+ margin-left: ${isRoot ? '0' : semantic.space[4]};
572
555
 
573
556
  &:not(:hover) .actions {
574
557
  display: none;
@@ -584,21 +567,28 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
584
567
  display: flex;
585
568
  justify-content: space-between;
586
569
  align-items: center;
587
- padding: ${tokens.size[2]} ${tokens.size[2.5]};
588
- gap: ${tokens.size[2.5]};
589
- border-bottom: ${t(colors.gray[300], colors.darkGray[500])} 1px solid;
570
+ &::selection,
571
+ & *::selection {
572
+ background: ${semantic.color.state.selectionFill};
573
+ color: ${semantic.color.state.selectionText};
574
+ }
575
+ padding: ${semantic.space[2]} ${semantic.space[3]};
576
+ gap: ${semantic.gap.control};
577
+ background: ${semantic.color.surface.elevated};
578
+ color: ${semantic.color.text.primary};
579
+ border-bottom: ${semantic.color.border.decorative} 1px solid;
590
580
  align-items: center;
591
581
  `,
592
582
  logoAndToggleContainer: css`
593
583
  display: flex;
594
- gap: ${tokens.size[3]};
584
+ gap: ${semantic.gap.section};
595
585
  align-items: center;
596
586
  & > button {
597
587
  padding: 0;
598
588
  background: transparent;
599
589
  border: none;
600
590
  display: flex;
601
- gap: ${size[0.5]};
591
+ gap: ${semantic.gap.tight};
602
592
  flex-direction: column;
603
593
  }
604
594
  `,
@@ -608,54 +598,61 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
608
598
  flex-direction: column;
609
599
  background-color: transparent;
610
600
  border: none;
611
- gap: ${tokens.size[0.5]};
601
+ gap: ${semantic.gap.tight};
612
602
  padding: 0;
613
603
  &:hover {
614
604
  opacity: 0.7;
615
605
  }
616
606
  &:focus-visible {
617
- outline-offset: 4px;
618
- border-radius: ${border.radius.xs};
619
- outline: 2px solid ${colors.blue[800]};
607
+ outline-offset: 2px;
608
+ border-radius: ${semantic.radius.control};
609
+ outline: 2px solid ${semantic.color.border.focus};
620
610
  }
621
611
  `,
622
612
  tanstackLogo: css`
623
- font-size: ${font.size.md};
624
- font-weight: ${font.weight.bold};
625
- line-height: ${font.lineHeight.xs};
613
+ font-size: ${semantic.type.headingPane.size};
614
+ line-height: ${semantic.type.headingPane.lineHeight};
615
+ font-family: ${semantic.font.display};
616
+ font-weight: ${semantic.type.headingPane.weight};
626
617
  white-space: nowrap;
627
- color: ${t(colors.gray[700], colors.gray[300])};
618
+ color: ${semantic.color.text.primary};
628
619
  `,
629
620
  flavorLogo: (flavorLight: string, flavorDark: string) => css`
630
- font-weight: ${font.weight.semibold};
631
- font-size: ${font.size.xs};
632
- background: linear-gradient(to right, ${t(flavorLight, flavorDark)});
633
- background-clip: text;
634
- -webkit-background-clip: text;
635
- line-height: 1;
636
- -webkit-text-fill-color: transparent;
621
+ font-weight: ${semantic.type.labelSm.weight};
622
+ font-size: ${semantic.type.labelSm.size};
623
+ line-height: ${semantic.type.labelSm.lineHeight};
624
+ font-family: ${semantic.font.body};
625
+ letter-spacing: ${semantic.type.labelSm.tracking};
626
+ color: ${t(flavorLight, flavorDark)};
637
627
  white-space: nowrap;
638
628
  `,
639
629
  },
640
630
  section: {
641
631
  main: css`
642
- margin-bottom: 1.5rem;
643
- padding: 1rem;
644
- background-color: ${t(colors.gray[50], colors.darkGray[800])};
645
- border: 1px solid ${t(colors.gray[200], colors.gray[800])};
646
- border-radius: 0.5rem;
647
- box-shadow: none;
632
+ margin-bottom: ${semantic.space[4]};
633
+ padding: ${semantic.space[4]};
634
+ background-color: ${semantic.color.surface.subtle};
635
+ border: 1px solid ${semantic.color.border.decorative};
636
+ border-radius: ${semantic.radius.overlay};
637
+ box-shadow: ${semantic.shadow.xs};
638
+ &::selection,
639
+ & *::selection {
640
+ background: ${semantic.color.state.selectionFill};
641
+ color: ${semantic.color.state.selectionText};
642
+ }
648
643
  `,
649
644
  title: css`
650
- font-size: 1rem;
651
- font-weight: 600;
652
- color: ${t(colors.gray[900], colors.gray[100])};
653
- margin: 0 0 0.75rem 0;
654
- padding-bottom: 0.5rem;
655
- border-bottom: 1px solid ${t(colors.gray[200], colors.gray[800])};
645
+ font-size: ${semantic.type.headingPane.size};
646
+ line-height: ${semantic.type.headingPane.lineHeight};
647
+ font-weight: ${semantic.type.headingPane.weight};
648
+ color: ${semantic.color.text.primary};
649
+ font-family: ${semantic.font.display};
650
+ margin: 0 0 ${semantic.space[3]} 0;
651
+ padding-bottom: ${semantic.space[2]};
652
+ border-bottom: 1px solid ${semantic.color.border.decorative};
656
653
  display: flex;
657
654
  align-items: center;
658
- gap: 0.5rem;
655
+ gap: ${semantic.gap.control};
659
656
  text-align: left;
660
657
  `,
661
658
  icon: css`
@@ -665,29 +662,40 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
665
662
  height: 100%;
666
663
  width: 100%;
667
664
  }
668
- color: ${t(colors.gray[700], colors.gray[400])};
665
+ color: ${semantic.color.text.secondary};
669
666
  `,
670
667
  description: css`
671
- color: ${t(colors.gray[500], colors.gray[400])};
672
- font-size: 0.8rem;
673
- margin: 0 0 1rem 0;
674
- line-height: 1.4;
668
+ color: ${semantic.color.text.secondary};
669
+ font: ${semantic.type.bodyXs.weight} ${semantic.type.bodyXs.size} /
670
+ ${semantic.type.bodyXs.lineHeight} ${semantic.font.body};
671
+ margin: 0 0 ${semantic.space[4]} 0;
675
672
  text-align: left;
676
673
  `,
677
674
  },
678
675
  mainPanel: {
679
676
  panel: (withPadding: boolean) => css`
680
- padding: ${withPadding ? tokens.size[3] : 0};
681
- background: ${t(colors.gray[50], colors.darkGray[700])};
677
+ /* space[4] keeps the panel's own gutter equal to the workbench gutter,
678
+ so a destination's content lines up with the tab strip above it. */
679
+ padding: ${withPadding ? semantic.space[4] : 0};
680
+ background: ${semantic.color.surface.workspace};
681
+ color: ${semantic.color.text.primary};
682
682
  overflow-y: auto;
683
+ /* Keep a scroll gesture inside the devtools instead of chaining it on
684
+ to the host page once this panel hits its end. */
685
+ overscroll-behavior: contain;
683
686
  height: 100%;
687
+ &::selection,
688
+ & *::selection {
689
+ background: ${semantic.color.state.selectionFill};
690
+ color: ${semantic.color.state.selectionText};
691
+ }
684
692
  `,
685
693
  },
686
694
  }
687
695
  }
688
696
 
689
- export function useStyles() {
690
- const { theme } = useTheme()
697
+ export function createStyles() {
698
+ const { theme } = createTheme()
691
699
  const [styles, setStyles] = createSignal(stylesFactory(theme()))
692
700
  createEffect(() => {
693
701
  setStyles(stylesFactory(theme()))