@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.
- package/dist/assets/BricolageGrotesque-Bold-BIJrwikb.ttf +0 -0
- package/dist/assets/Inter-latin-BwkfbSeq.woff2 +0 -0
- package/dist/esm/assets/fonts/BricolageGrotesque-Bold.js +6 -0
- package/dist/esm/assets/fonts/BricolageGrotesque-Bold.js.map +1 -0
- package/dist/esm/assets/fonts/Inter-latin.js +6 -0
- package/dist/esm/assets/fonts/Inter-latin.js.map +1 -0
- package/dist/esm/components/button.js +3 -3
- package/dist/esm/components/button.js.map +1 -1
- package/dist/esm/components/checkbox.js +16 -10
- package/dist/esm/components/checkbox.js.map +1 -1
- package/dist/esm/components/header.js +4 -4
- package/dist/esm/components/header.js.map +1 -1
- package/dist/esm/components/icons.d.ts +1 -1
- package/dist/esm/components/icons.js +4 -8
- package/dist/esm/components/icons.js.map +1 -1
- package/dist/esm/components/input.js +16 -9
- package/dist/esm/components/input.js.map +1 -1
- package/dist/esm/components/logo.js +3 -3
- package/dist/esm/components/logo.js.map +1 -1
- package/dist/esm/components/main-panel.js +3 -3
- package/dist/esm/components/main-panel.js.map +1 -1
- package/dist/esm/components/section.js +6 -6
- package/dist/esm/components/section.js.map +1 -1
- package/dist/esm/components/select.js +24 -13
- package/dist/esm/components/select.js.map +1 -1
- package/dist/esm/components/tag.js +3 -3
- package/dist/esm/components/tag.js.map +1 -1
- package/dist/esm/components/theme.d.ts +1 -1
- package/dist/esm/components/theme.js +15 -5
- package/dist/esm/components/theme.js.map +1 -1
- package/dist/esm/components/tree.js +114 -62
- package/dist/esm/components/tree.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/internal.d.ts +2 -0
- package/dist/esm/internal.js +2 -0
- package/dist/esm/styles/semantic-theme.d.ts +420 -0
- package/dist/esm/styles/semantic-theme.js +283 -0
- package/dist/esm/styles/semantic-theme.js.map +1 -0
- package/dist/esm/styles/use-styles.d.ts +3 -1
- package/dist/esm/styles/use-styles.js +304 -372
- package/dist/esm/styles/use-styles.js.map +1 -1
- package/package.json +15 -3
- package/src/assets/fonts/OFL-Bricolage-Grotesque.txt +93 -0
- package/src/assets/fonts/OFL-Inter.txt +92 -0
- package/src/components/button.tsx +3 -3
- package/src/components/checkbox.tsx +9 -5
- package/src/components/header.tsx +10 -4
- package/src/components/icons.tsx +5 -5
- package/src/components/input.tsx +14 -5
- package/src/components/logo.tsx +3 -2
- package/src/components/main-panel.tsx +3 -2
- package/src/components/section.tsx +15 -7
- package/src/components/select.tsx +29 -10
- package/src/components/tag.tsx +7 -3
- package/src/components/theme.tsx +18 -5
- package/src/components/tree.tsx +96 -29
- package/src/index.ts +1 -1
- package/src/internal.ts +11 -0
- package/src/styles/semantic-theme.ts +345 -0
- package/src/styles/use-styles.ts +318 -310
- package/dist/esm/styles/tokens.js +0 -301
- package/dist/esm/styles/tokens.js.map +0 -1
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import bricolageGrotesqueUrl from '../assets/fonts/BricolageGrotesque-Bold.ttf?url&no-inline'
|
|
2
|
+
import interUrl from '../assets/fonts/Inter-latin.woff2?url&no-inline'
|
|
3
|
+
import type { TanStackDevtoolsTheme } from '../components/theme'
|
|
4
|
+
|
|
5
|
+
export const DEVTOOLS_FONT_STYLE_ID = 'tanstack-devtools-fonts'
|
|
6
|
+
export const DEVTOOLS_FORCED_COLORS_STYLE_ID = 'tanstack-devtools-forced-colors'
|
|
7
|
+
|
|
8
|
+
export const forcedColorsCss = `
|
|
9
|
+
@media (forced-colors: active) {
|
|
10
|
+
[data-tsd-surface] { forced-color-adjust: auto; background: Canvas; color: CanvasText; }
|
|
11
|
+
[data-tsd-control] { forced-color-adjust: auto; background: ButtonFace; color: ButtonText; border-color: ButtonText; }
|
|
12
|
+
[data-tsd-selected="true"] { background: Highlight; color: HighlightText; border-color: HighlightText; }
|
|
13
|
+
[data-tsd-separator] { border-color: CanvasText; }
|
|
14
|
+
[data-tsd-separator="resize"] { border: 1px solid CanvasText; }
|
|
15
|
+
[data-tsd-control]:focus-visible { outline: 2px solid ButtonText; outline-offset: 2px; }
|
|
16
|
+
}`
|
|
17
|
+
|
|
18
|
+
export const devtoolsFontCss = `
|
|
19
|
+
@font-face {
|
|
20
|
+
font-family: 'Bricolage Grotesque';
|
|
21
|
+
src: url('${bricolageGrotesqueUrl}') format('truetype');
|
|
22
|
+
font-style: normal;
|
|
23
|
+
font-weight: 700;
|
|
24
|
+
font-display: swap;
|
|
25
|
+
}
|
|
26
|
+
@font-face {
|
|
27
|
+
font-family: 'Inter';
|
|
28
|
+
src: url('${interUrl}') format('woff2');
|
|
29
|
+
font-style: normal;
|
|
30
|
+
font-weight: 100 900;
|
|
31
|
+
font-display: swap;
|
|
32
|
+
}`
|
|
33
|
+
|
|
34
|
+
export function ensureDevtoolsFonts(targetDocument: Document): void {
|
|
35
|
+
if (targetDocument.getElementById(DEVTOOLS_FONT_STYLE_ID)) return
|
|
36
|
+
|
|
37
|
+
const style = targetDocument.createElement('style')
|
|
38
|
+
style.id = DEVTOOLS_FONT_STYLE_ID
|
|
39
|
+
style.textContent = devtoolsFontCss
|
|
40
|
+
targetDocument.head.append(style)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function ensureDevtoolsStyles(targetDocument: Document): void {
|
|
44
|
+
ensureDevtoolsFonts(targetDocument)
|
|
45
|
+
if (targetDocument.getElementById(DEVTOOLS_FORCED_COLORS_STYLE_ID)) return
|
|
46
|
+
const style = targetDocument.createElement('style')
|
|
47
|
+
style.id = DEVTOOLS_FORCED_COLORS_STYLE_ID
|
|
48
|
+
style.textContent = forcedColorsCss
|
|
49
|
+
targetDocument.head.append(style)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type StatusRole = 'success' | 'warning' | 'error' | 'info' | 'neutral'
|
|
53
|
+
|
|
54
|
+
type DeepReadonly<T> = T extends (...args: Array<never>) => unknown
|
|
55
|
+
? T
|
|
56
|
+
: T extends object
|
|
57
|
+
? { readonly [Key in keyof T]: DeepReadonly<T[Key]> }
|
|
58
|
+
: T
|
|
59
|
+
|
|
60
|
+
export type SemanticTheme = DeepReadonly<{
|
|
61
|
+
font: {
|
|
62
|
+
display: string
|
|
63
|
+
body: string
|
|
64
|
+
mono: string
|
|
65
|
+
}
|
|
66
|
+
space: { 1: '4px'; 2: '8px'; 3: '12px'; 4: '16px' }
|
|
67
|
+
gap: {
|
|
68
|
+
tight: '4px'
|
|
69
|
+
control: '8px'
|
|
70
|
+
section: '12px'
|
|
71
|
+
sectionLarge: '16px'
|
|
72
|
+
}
|
|
73
|
+
padding: { controlBlock: '6px'; controlInline: '8px' }
|
|
74
|
+
type: {
|
|
75
|
+
bodyXs: { size: '12px'; lineHeight: '17px'; weight: 400 }
|
|
76
|
+
bodySm: { size: '14px'; lineHeight: '20px'; weight: 400 }
|
|
77
|
+
bodyMd: { size: '16px'; lineHeight: '24px'; weight: 300 }
|
|
78
|
+
labelSm: {
|
|
79
|
+
size: '12px'
|
|
80
|
+
lineHeight: '14px'
|
|
81
|
+
weight: 500
|
|
82
|
+
tracking: '0.5px'
|
|
83
|
+
}
|
|
84
|
+
headingCompact: { size: '14px'; lineHeight: '18px'; weight: 700 }
|
|
85
|
+
headingPane: { size: '16px'; lineHeight: '21px'; weight: 700 }
|
|
86
|
+
}
|
|
87
|
+
radius: { control: '4px'; group: '6px'; overlay: '8px' }
|
|
88
|
+
shadow: { xs: string; sm: string; overlay: string }
|
|
89
|
+
motion: { strip: '120ms'; graceMs: 400 }
|
|
90
|
+
color: {
|
|
91
|
+
surface: {
|
|
92
|
+
app: string
|
|
93
|
+
workspace: string
|
|
94
|
+
subtle: string
|
|
95
|
+
elevated: string
|
|
96
|
+
brand: string
|
|
97
|
+
}
|
|
98
|
+
text: {
|
|
99
|
+
primary: string
|
|
100
|
+
secondary: string
|
|
101
|
+
muted: string
|
|
102
|
+
mutedOnBrand: string
|
|
103
|
+
inverse: string
|
|
104
|
+
link: string
|
|
105
|
+
}
|
|
106
|
+
border: { decorative: string; control: string; focus: string }
|
|
107
|
+
state: {
|
|
108
|
+
hover: string
|
|
109
|
+
pressed: string
|
|
110
|
+
selectionFill: string
|
|
111
|
+
selectionText: string
|
|
112
|
+
}
|
|
113
|
+
status: Record<
|
|
114
|
+
StatusRole,
|
|
115
|
+
{
|
|
116
|
+
subtleFill: string
|
|
117
|
+
border: string
|
|
118
|
+
text: string
|
|
119
|
+
solidFill: string
|
|
120
|
+
onFill: string
|
|
121
|
+
}
|
|
122
|
+
>
|
|
123
|
+
syntax: {
|
|
124
|
+
keyword: string
|
|
125
|
+
string: string
|
|
126
|
+
number: string
|
|
127
|
+
comment: string
|
|
128
|
+
property: string
|
|
129
|
+
punctuation: string
|
|
130
|
+
selectionFill: string
|
|
131
|
+
selectionText: string
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}>
|
|
135
|
+
|
|
136
|
+
function deepFreeze<const TValue extends object>(value: TValue) {
|
|
137
|
+
for (const nestedValue of Object.values(value)) {
|
|
138
|
+
if (nestedValue !== null && typeof nestedValue === 'object') {
|
|
139
|
+
deepFreeze(nestedValue)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return Object.freeze(value)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const commonTheme = {
|
|
147
|
+
font: {
|
|
148
|
+
display: "'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif",
|
|
149
|
+
body: "'Inter', ui-sans-serif, system-ui, sans-serif",
|
|
150
|
+
mono: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
|
|
151
|
+
},
|
|
152
|
+
space: { 1: '4px', 2: '8px', 3: '12px', 4: '16px' },
|
|
153
|
+
gap: {
|
|
154
|
+
tight: '4px',
|
|
155
|
+
control: '8px',
|
|
156
|
+
section: '12px',
|
|
157
|
+
sectionLarge: '16px',
|
|
158
|
+
},
|
|
159
|
+
padding: { controlBlock: '6px', controlInline: '8px' },
|
|
160
|
+
type: {
|
|
161
|
+
bodyXs: { size: '12px', lineHeight: '17px', weight: 400 },
|
|
162
|
+
bodySm: { size: '14px', lineHeight: '20px', weight: 400 },
|
|
163
|
+
bodyMd: { size: '16px', lineHeight: '24px', weight: 300 },
|
|
164
|
+
labelSm: {
|
|
165
|
+
size: '12px',
|
|
166
|
+
lineHeight: '14px',
|
|
167
|
+
weight: 500,
|
|
168
|
+
tracking: '0.5px',
|
|
169
|
+
},
|
|
170
|
+
headingCompact: {
|
|
171
|
+
size: '14px',
|
|
172
|
+
lineHeight: '18px',
|
|
173
|
+
weight: 700,
|
|
174
|
+
},
|
|
175
|
+
headingPane: { size: '16px', lineHeight: '21px', weight: 700 },
|
|
176
|
+
},
|
|
177
|
+
radius: { control: '4px', group: '6px', overlay: '8px' },
|
|
178
|
+
shadow: {
|
|
179
|
+
xs: '0 1px 2px rgba(0,0,0,0.03)',
|
|
180
|
+
sm: '0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03)',
|
|
181
|
+
overlay: '0 25px 50px -12px rgba(0,0,0,0.20)',
|
|
182
|
+
},
|
|
183
|
+
motion: { strip: '120ms', graceMs: 400 },
|
|
184
|
+
} satisfies Omit<SemanticTheme, 'color'>
|
|
185
|
+
|
|
186
|
+
export const semanticThemes = deepFreeze({
|
|
187
|
+
light: {
|
|
188
|
+
...commonTheme,
|
|
189
|
+
color: {
|
|
190
|
+
surface: {
|
|
191
|
+
app: '#ffffff',
|
|
192
|
+
workspace: '#ffffff',
|
|
193
|
+
subtle: '#fafafa',
|
|
194
|
+
elevated: '#ffffff',
|
|
195
|
+
brand: '#eeebd4',
|
|
196
|
+
},
|
|
197
|
+
text: {
|
|
198
|
+
primary: '#111111',
|
|
199
|
+
secondary: '#3e3529',
|
|
200
|
+
muted: '#756c5b',
|
|
201
|
+
mutedOnBrand: '#3e3529',
|
|
202
|
+
inverse: '#ffffff',
|
|
203
|
+
link: '#003e53',
|
|
204
|
+
},
|
|
205
|
+
border: {
|
|
206
|
+
decorative: '#eeebd4',
|
|
207
|
+
control: '#756c5b',
|
|
208
|
+
focus: '#003e53',
|
|
209
|
+
},
|
|
210
|
+
state: {
|
|
211
|
+
hover: '#1111110f',
|
|
212
|
+
pressed: '#1111111f',
|
|
213
|
+
selectionFill: '#3e3529',
|
|
214
|
+
selectionText: '#ffffff',
|
|
215
|
+
},
|
|
216
|
+
status: {
|
|
217
|
+
success: {
|
|
218
|
+
subtleFill: '#d8f0da',
|
|
219
|
+
border: '#1d4226',
|
|
220
|
+
text: '#1d4226',
|
|
221
|
+
solidFill: '#1d4226',
|
|
222
|
+
onFill: '#ffffff',
|
|
223
|
+
},
|
|
224
|
+
warning: {
|
|
225
|
+
subtleFill: '#fef6cc',
|
|
226
|
+
border: '#624a00',
|
|
227
|
+
text: '#624a00',
|
|
228
|
+
solidFill: '#624a00',
|
|
229
|
+
onFill: '#ffffff',
|
|
230
|
+
},
|
|
231
|
+
error: {
|
|
232
|
+
subtleFill: '#f9d8c4',
|
|
233
|
+
border: '#5f1a06',
|
|
234
|
+
text: '#5f1a06',
|
|
235
|
+
solidFill: '#5f1a06',
|
|
236
|
+
onFill: '#ffffff',
|
|
237
|
+
},
|
|
238
|
+
info: {
|
|
239
|
+
subtleFill: '#d8f0f3',
|
|
240
|
+
border: '#003e53',
|
|
241
|
+
text: '#003e53',
|
|
242
|
+
solidFill: '#003e53',
|
|
243
|
+
onFill: '#ffffff',
|
|
244
|
+
},
|
|
245
|
+
neutral: {
|
|
246
|
+
subtleFill: '#eeebd4',
|
|
247
|
+
border: '#756c5b',
|
|
248
|
+
text: '#3e3529',
|
|
249
|
+
solidFill: '#3e3529',
|
|
250
|
+
onFill: '#ffffff',
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
syntax: {
|
|
254
|
+
keyword: '#5f1a06',
|
|
255
|
+
string: '#1d4226',
|
|
256
|
+
number: '#541f5d',
|
|
257
|
+
comment: '#756c5b',
|
|
258
|
+
property: '#003e53',
|
|
259
|
+
punctuation: '#3e3529',
|
|
260
|
+
selectionFill: '#d8f0f3',
|
|
261
|
+
selectionText: '#003e53',
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
dark: {
|
|
266
|
+
...commonTheme,
|
|
267
|
+
color: {
|
|
268
|
+
surface: {
|
|
269
|
+
app: '#111111',
|
|
270
|
+
workspace: '#1f1f1f',
|
|
271
|
+
subtle: '#1b1b1b',
|
|
272
|
+
elevated: '#2b2b2b',
|
|
273
|
+
brand: '#111111',
|
|
274
|
+
},
|
|
275
|
+
text: {
|
|
276
|
+
primary: '#ffffff',
|
|
277
|
+
secondary: '#aea691',
|
|
278
|
+
muted: '#aea691',
|
|
279
|
+
mutedOnBrand: '#aea691',
|
|
280
|
+
inverse: '#111111',
|
|
281
|
+
link: '#9cd5e2',
|
|
282
|
+
},
|
|
283
|
+
border: { decorative: '#2d2d2d', control: '#aea691', focus: '#61adbf' },
|
|
284
|
+
state: {
|
|
285
|
+
hover: '#ffffff14',
|
|
286
|
+
pressed: '#ffffff1f',
|
|
287
|
+
selectionFill: '#c5c3bf',
|
|
288
|
+
selectionText: '#111111',
|
|
289
|
+
},
|
|
290
|
+
status: {
|
|
291
|
+
success: {
|
|
292
|
+
subtleFill: '#1d4226',
|
|
293
|
+
border: '#69bc75',
|
|
294
|
+
text: '#a2e1a9',
|
|
295
|
+
solidFill: '#69bc75',
|
|
296
|
+
onFill: '#111111',
|
|
297
|
+
},
|
|
298
|
+
warning: {
|
|
299
|
+
subtleFill: '#624a00',
|
|
300
|
+
border: '#f4d648',
|
|
301
|
+
text: '#fae884',
|
|
302
|
+
solidFill: '#f4d648',
|
|
303
|
+
onFill: '#111111',
|
|
304
|
+
},
|
|
305
|
+
error: {
|
|
306
|
+
subtleFill: '#5f1a06',
|
|
307
|
+
border: '#e06e49',
|
|
308
|
+
text: '#edaa8d',
|
|
309
|
+
solidFill: '#e06e49',
|
|
310
|
+
onFill: '#111111',
|
|
311
|
+
},
|
|
312
|
+
info: {
|
|
313
|
+
subtleFill: '#003e53',
|
|
314
|
+
border: '#61adbf',
|
|
315
|
+
text: '#9cd5e2',
|
|
316
|
+
solidFill: '#61adbf',
|
|
317
|
+
onFill: '#111111',
|
|
318
|
+
},
|
|
319
|
+
neutral: {
|
|
320
|
+
subtleFill: '#2b2b2b',
|
|
321
|
+
border: '#aea691',
|
|
322
|
+
text: '#c5c3bf',
|
|
323
|
+
solidFill: '#c5c3bf',
|
|
324
|
+
onFill: '#111111',
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
syntax: {
|
|
328
|
+
keyword: '#e06e49',
|
|
329
|
+
string: '#69bc75',
|
|
330
|
+
number: '#c56dcf',
|
|
331
|
+
comment: '#aea691',
|
|
332
|
+
property: '#61adbf',
|
|
333
|
+
punctuation: '#c5c3bf',
|
|
334
|
+
selectionFill: '#003e53',
|
|
335
|
+
selectionText: '#ffffff',
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
} as const satisfies Record<TanStackDevtoolsTheme, SemanticTheme>)
|
|
340
|
+
|
|
341
|
+
export function resolveSemanticTheme(
|
|
342
|
+
theme: TanStackDevtoolsTheme,
|
|
343
|
+
): SemanticTheme {
|
|
344
|
+
return semanticThemes[theme]
|
|
345
|
+
}
|