@tanstack/devtools-ui 0.4.4 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/button.js +21 -19
- package/dist/esm/components/button.js.map +1 -1
- package/dist/esm/components/checkbox.js +51 -50
- package/dist/esm/components/checkbox.js.map +1 -1
- package/dist/esm/components/header.js +38 -48
- package/dist/esm/components/header.js.map +1 -1
- package/dist/esm/components/icons.d.ts +2 -1
- package/dist/esm/components/icons.js +32 -51
- package/dist/esm/components/icons.js.map +1 -1
- package/dist/esm/components/input.js +53 -52
- package/dist/esm/components/input.js.map +1 -1
- package/dist/esm/components/logo.js +92 -91
- package/dist/esm/components/logo.js.map +1 -1
- package/dist/esm/components/main-panel.js +15 -19
- package/dist/esm/components/main-panel.js.map +1 -1
- package/dist/esm/components/section.js +47 -69
- package/dist/esm/components/section.js.map +1 -1
- package/dist/esm/components/select.js +55 -54
- package/dist/esm/components/select.js.map +1 -1
- package/dist/esm/components/tag.js +38 -37
- package/dist/esm/components/tag.js.map +1 -1
- package/dist/esm/components/theme.d.ts +4 -4
- package/dist/esm/components/theme.js +24 -26
- package/dist/esm/components/theme.js.map +1 -1
- package/dist/esm/components/tree.d.ts +3 -0
- package/dist/esm/components/tree.js +494 -476
- package/dist/esm/components/tree.js.map +1 -1
- package/dist/esm/icons.js +1 -24
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +3 -30
- package/dist/esm/styles/tokens.js +300 -189
- package/dist/esm/styles/tokens.js.map +1 -1
- package/dist/esm/styles/use-styles.js +337 -179
- package/dist/esm/styles/use-styles.js.map +1 -1
- package/dist/esm/utils/deep-keys.d.ts +4 -2
- package/package.json +5 -4
- package/src/components/button.tsx +14 -17
- package/src/components/icons.tsx +8 -6
- package/src/components/theme.tsx +5 -5
- package/src/components/tree.tsx +46 -0
- package/src/index.ts +1 -0
- package/src/styles/use-styles.ts +179 -75
- package/src/utils/deep-keys.ts +25 -13
- package/dist/esm/icons.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
package/src/styles/use-styles.ts
CHANGED
|
@@ -2,62 +2,201 @@ import * as goober from 'goober'
|
|
|
2
2
|
import { createEffect, createSignal } from 'solid-js'
|
|
3
3
|
import { useTheme } from '../components/theme'
|
|
4
4
|
import { tokens } from './tokens'
|
|
5
|
+
|
|
6
|
+
import type { TanStackDevtoolsTheme } from '../components/theme'
|
|
5
7
|
import type { ButtonVariant } from '../components/button'
|
|
6
|
-
import type { Theme } from '../components/theme'
|
|
7
8
|
|
|
8
9
|
const buttonVariantColors: Record<
|
|
9
10
|
ButtonVariant,
|
|
10
|
-
{
|
|
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
|
+
}
|
|
11
20
|
> = {
|
|
12
21
|
primary: {
|
|
13
|
-
bg: tokens.colors.gray[900],
|
|
14
|
-
hover: tokens.colors.gray[800],
|
|
15
|
-
active: tokens.colors.gray[700],
|
|
16
|
-
text: '#fff',
|
|
17
|
-
border: tokens.colors.gray[
|
|
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
|
+
},
|
|
18
35
|
},
|
|
19
36
|
secondary: {
|
|
20
|
-
bg: tokens.colors.gray[100],
|
|
21
|
-
hover: tokens.colors.gray[200],
|
|
22
|
-
active: tokens.colors.gray[300],
|
|
23
|
-
text: tokens.colors.gray[900],
|
|
24
|
-
border: tokens.colors.gray[300],
|
|
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
|
+
},
|
|
25
50
|
},
|
|
26
51
|
info: {
|
|
27
|
-
bg: tokens.colors.blue[500],
|
|
28
|
-
hover: tokens.colors.blue[600],
|
|
29
|
-
active: tokens.colors.blue[700],
|
|
30
|
-
text: '#fff',
|
|
31
|
-
border: tokens.colors.blue[500],
|
|
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
|
+
},
|
|
32
65
|
},
|
|
33
66
|
warning: {
|
|
34
|
-
bg: tokens.colors.yellow[500],
|
|
35
|
-
hover:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
+
},
|
|
39
89
|
},
|
|
40
90
|
danger: {
|
|
41
|
-
bg: tokens.colors.red[500],
|
|
42
|
-
hover: tokens.colors.red[600],
|
|
43
|
-
active: tokens.colors.red[700],
|
|
44
|
-
text: '#fff',
|
|
45
|
-
border: tokens.colors.red[500],
|
|
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
|
+
},
|
|
46
104
|
},
|
|
47
105
|
success: {
|
|
48
|
-
bg: tokens.colors.green[500],
|
|
49
|
-
hover: tokens.colors.green[600],
|
|
50
|
-
active: tokens.colors.green[700],
|
|
51
|
-
text: '#fff',
|
|
52
|
-
border: tokens.colors.green[500],
|
|
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
|
+
},
|
|
53
119
|
},
|
|
54
120
|
}
|
|
55
121
|
export const css = goober.css
|
|
56
|
-
const stylesFactory = (theme:
|
|
122
|
+
const stylesFactory = (theme: TanStackDevtoolsTheme) => {
|
|
57
123
|
const { colors, font, size, border } = tokens
|
|
58
124
|
const { fontFamily } = font
|
|
59
125
|
|
|
60
126
|
const t = (light: string, dark: string) => (theme === 'light' ? light : dark)
|
|
127
|
+
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)
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
ghost: css`
|
|
139
|
+
background: transparent;
|
|
140
|
+
color: ${outlineColor};
|
|
141
|
+
border-color: transparent;
|
|
142
|
+
&:hover {
|
|
143
|
+
background: ${t(colors.gray[100], colors.darkGray[800])};
|
|
144
|
+
color: ${outlineHoverColor};
|
|
145
|
+
}
|
|
146
|
+
&:active {
|
|
147
|
+
background: ${t(colors.gray[200], colors.darkGray[700])};
|
|
148
|
+
color: ${outlineHoverColor};
|
|
149
|
+
}
|
|
150
|
+
`,
|
|
151
|
+
outline: css`
|
|
152
|
+
background: transparent;
|
|
153
|
+
color: ${outlineColor};
|
|
154
|
+
border-color: ${outlineColor};
|
|
155
|
+
&:hover {
|
|
156
|
+
background: ${t(colors.gray[50], colors.darkGray[800])};
|
|
157
|
+
color: ${outlineHoverColor};
|
|
158
|
+
border-color: ${outlineHoverColor};
|
|
159
|
+
}
|
|
160
|
+
&:active {
|
|
161
|
+
background: ${t(colors.gray[100], colors.darkGray[700])};
|
|
162
|
+
color: ${outlineHoverColor};
|
|
163
|
+
border-color: ${outlineHoverColor};
|
|
164
|
+
}
|
|
165
|
+
`,
|
|
166
|
+
solid: css`
|
|
167
|
+
background: ${solidBg};
|
|
168
|
+
color: ${solidText};
|
|
169
|
+
border-color: ${solidBorder};
|
|
170
|
+
&:hover {
|
|
171
|
+
background: ${solidHover};
|
|
172
|
+
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
|
+
)};
|
|
177
|
+
}
|
|
178
|
+
&:active {
|
|
179
|
+
background: ${solidActive};
|
|
180
|
+
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
|
+
)};
|
|
185
|
+
}
|
|
186
|
+
`,
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
const buttonVariants: Record<
|
|
190
|
+
ButtonVariant,
|
|
191
|
+
{ ghost: string; outline: string; solid: string }
|
|
192
|
+
> = {
|
|
193
|
+
primary: buildButtonVariant('primary'),
|
|
194
|
+
secondary: buildButtonVariant('secondary'),
|
|
195
|
+
info: buildButtonVariant('info'),
|
|
196
|
+
warning: buildButtonVariant('warning'),
|
|
197
|
+
danger: buildButtonVariant('danger'),
|
|
198
|
+
success: buildButtonVariant('success'),
|
|
199
|
+
}
|
|
61
200
|
|
|
62
201
|
const wrapperSize = 320
|
|
63
202
|
|
|
@@ -72,7 +211,7 @@ const stylesFactory = (theme: Theme = 'dark') => {
|
|
|
72
211
|
height: ${size[12]};
|
|
73
212
|
font-family: ${fontFamily.sans};
|
|
74
213
|
gap: ${tokens.size[0.5]};
|
|
75
|
-
padding:
|
|
214
|
+
padding: 0;
|
|
76
215
|
&:hover {
|
|
77
216
|
opacity: 0.7;
|
|
78
217
|
}
|
|
@@ -268,49 +407,14 @@ const stylesFactory = (theme: Theme = 'dark') => {
|
|
|
268
407
|
border-style: solid;
|
|
269
408
|
`,
|
|
270
409
|
variant(variant: ButtonVariant, outline?: boolean, ghost?: boolean) {
|
|
271
|
-
const v =
|
|
410
|
+
const v = buttonVariants[variant]
|
|
272
411
|
if (ghost) {
|
|
273
|
-
return
|
|
274
|
-
background: transparent;
|
|
275
|
-
color: ${t(v.bg, v.bg)};
|
|
276
|
-
border-color: transparent;
|
|
277
|
-
&:hover {
|
|
278
|
-
background: ${t(colors.gray[100], colors.darkGray[800])};
|
|
279
|
-
}
|
|
280
|
-
&:active {
|
|
281
|
-
background: ${t(colors.gray[200], colors.darkGray[700])};
|
|
282
|
-
}
|
|
283
|
-
`
|
|
412
|
+
return v.ghost
|
|
284
413
|
}
|
|
285
414
|
if (outline) {
|
|
286
|
-
return
|
|
287
|
-
background: transparent;
|
|
288
|
-
color: ${t(v.bg, v.bg)};
|
|
289
|
-
border-color: ${t(v.bg, v.bg)};
|
|
290
|
-
&:hover {
|
|
291
|
-
background: ${t(colors.gray[50], colors.darkGray[800])};
|
|
292
|
-
border-color: ${t(v.hover, v.hover)};
|
|
293
|
-
}
|
|
294
|
-
&:active {
|
|
295
|
-
background: ${t(colors.gray[100], colors.darkGray[700])};
|
|
296
|
-
border-color: ${t(v.active, v.active)};
|
|
297
|
-
}
|
|
298
|
-
`
|
|
415
|
+
return v.outline
|
|
299
416
|
}
|
|
300
|
-
|
|
301
|
-
return css`
|
|
302
|
-
background: ${t(v.bg, v.bg)};
|
|
303
|
-
color: ${t(v.text, v.text)};
|
|
304
|
-
border-color: ${t(v.border, v.border)};
|
|
305
|
-
&:hover {
|
|
306
|
-
background: ${t(v.hover, v.hover)};
|
|
307
|
-
border-color: ${t(v.hover, v.hover)};
|
|
308
|
-
}
|
|
309
|
-
&:active {
|
|
310
|
-
background: ${t(v.active, v.active)};
|
|
311
|
-
border-color: ${t(v.active, v.active)};
|
|
312
|
-
}
|
|
313
|
-
`
|
|
417
|
+
return v.solid
|
|
314
418
|
},
|
|
315
419
|
},
|
|
316
420
|
tag: {
|
|
@@ -371,7 +475,7 @@ const stylesFactory = (theme: Theme = 'dark') => {
|
|
|
371
475
|
color: ${t(colors.gray[500], colors.gray[500])};
|
|
372
476
|
border: none;
|
|
373
477
|
display: inline-flex;
|
|
374
|
-
padding:
|
|
478
|
+
padding: 0;
|
|
375
479
|
align-items: center;
|
|
376
480
|
justify-content: center;
|
|
377
481
|
cursor: pointer;
|
|
@@ -505,7 +609,7 @@ const stylesFactory = (theme: Theme = 'dark') => {
|
|
|
505
609
|
background-color: transparent;
|
|
506
610
|
border: none;
|
|
507
611
|
gap: ${tokens.size[0.5]};
|
|
508
|
-
padding:
|
|
612
|
+
padding: 0;
|
|
509
613
|
&:hover {
|
|
510
614
|
opacity: 0.7;
|
|
511
615
|
}
|
package/src/utils/deep-keys.ts
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
|
+
type IsAny<T> = 0 extends 1 & T ? true : false
|
|
2
|
+
|
|
3
|
+
type Clean<T> = Exclude<T, undefined | null>
|
|
4
|
+
|
|
1
5
|
type CollapsibleKeys<T, TPrefix extends string = ''> =
|
|
2
|
-
T extends
|
|
3
|
-
?
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
: T extends
|
|
6
|
+
IsAny<T> extends true
|
|
7
|
+
? TPrefix extends ''
|
|
8
|
+
? never
|
|
9
|
+
: TPrefix
|
|
10
|
+
: T extends ReadonlyArray<infer U>
|
|
7
11
|
?
|
|
8
12
|
| (TPrefix extends '' ? '' : TPrefix)
|
|
9
|
-
| {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
| CollapsibleKeys<U, `${TPrefix}[${number}]`>
|
|
14
|
+
: T extends object
|
|
15
|
+
?
|
|
16
|
+
| (TPrefix extends '' ? '' : TPrefix)
|
|
17
|
+
| {
|
|
18
|
+
[K in Extract<keyof T, string>]: CollapsibleKeys<
|
|
19
|
+
T[K],
|
|
20
|
+
TPrefix extends '' ? `${K}` : `${TPrefix}.${K}`
|
|
21
|
+
>
|
|
22
|
+
}[Extract<keyof T, string>]
|
|
23
|
+
: never
|
|
16
24
|
|
|
17
25
|
export type CollapsiblePaths<T> =
|
|
18
|
-
CollapsibleKeys<T
|
|
26
|
+
CollapsibleKeys<Clean<T>> extends infer P
|
|
27
|
+
? P extends string
|
|
28
|
+
? P
|
|
29
|
+
: never
|
|
30
|
+
: never
|
package/dist/esm/icons.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|