@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
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import clsx from 'clsx'
|
|
2
|
-
import {
|
|
2
|
+
import { createStyles } from '../styles/use-styles'
|
|
3
3
|
import type { JSX } from 'solid-js/jsx-runtime'
|
|
4
4
|
|
|
5
5
|
export const Section = ({
|
|
6
6
|
children,
|
|
7
7
|
...rest
|
|
8
8
|
}: JSX.IntrinsicElements['section']) => {
|
|
9
|
-
const styles =
|
|
9
|
+
const styles = createStyles()
|
|
10
10
|
return (
|
|
11
|
-
<section
|
|
11
|
+
<section
|
|
12
|
+
data-tsd-surface
|
|
13
|
+
class={clsx(styles().section.main, rest.class)}
|
|
14
|
+
{...rest}
|
|
15
|
+
>
|
|
12
16
|
{children}
|
|
13
17
|
</section>
|
|
14
18
|
)
|
|
@@ -18,9 +22,13 @@ export const SectionTitle = ({
|
|
|
18
22
|
children,
|
|
19
23
|
...rest
|
|
20
24
|
}: JSX.IntrinsicElements['h3']) => {
|
|
21
|
-
const styles =
|
|
25
|
+
const styles = createStyles()
|
|
22
26
|
return (
|
|
23
|
-
<h3
|
|
27
|
+
<h3
|
|
28
|
+
data-tsd-separator
|
|
29
|
+
class={clsx(styles().section.title, rest.class)}
|
|
30
|
+
{...rest}
|
|
31
|
+
>
|
|
24
32
|
{children}
|
|
25
33
|
</h3>
|
|
26
34
|
)
|
|
@@ -30,7 +38,7 @@ export const SectionDescription = ({
|
|
|
30
38
|
children,
|
|
31
39
|
...rest
|
|
32
40
|
}: JSX.IntrinsicElements['p']) => {
|
|
33
|
-
const styles =
|
|
41
|
+
const styles = createStyles()
|
|
34
42
|
return (
|
|
35
43
|
<p class={clsx(styles().section.description, rest.class)} {...rest}>
|
|
36
44
|
{children}
|
|
@@ -42,7 +50,7 @@ export const SectionIcon = ({
|
|
|
42
50
|
children,
|
|
43
51
|
...rest
|
|
44
52
|
}: JSX.IntrinsicElements['span']) => {
|
|
45
|
-
const styles =
|
|
53
|
+
const styles = createStyles()
|
|
46
54
|
return (
|
|
47
55
|
<span class={clsx(styles().section.icon, rest.class)} {...rest}>
|
|
48
56
|
{children}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createSignal } from 'solid-js'
|
|
2
|
-
import {
|
|
1
|
+
import { createEffect, createSignal, createUniqueId } from 'solid-js'
|
|
2
|
+
import { createStyles } from '../styles/use-styles'
|
|
3
3
|
|
|
4
4
|
interface SelectOption<T extends string | number> {
|
|
5
5
|
value: T
|
|
@@ -15,30 +15,49 @@ interface SelectProps<T extends string | number> {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function Select<T extends string | number>(props: SelectProps<T>) {
|
|
18
|
-
const styles =
|
|
18
|
+
const styles = createStyles()
|
|
19
19
|
const [selected, setSelected] = createSignal(
|
|
20
|
-
props.value
|
|
20
|
+
props.value ?? props.options[0]?.value,
|
|
21
21
|
)
|
|
22
|
+
const id = createUniqueId()
|
|
23
|
+
const descriptionId = `${id}-description`
|
|
24
|
+
|
|
25
|
+
createEffect(() => {
|
|
26
|
+
if (props.value !== undefined) {
|
|
27
|
+
setSelected(() => props.value)
|
|
28
|
+
}
|
|
29
|
+
})
|
|
22
30
|
|
|
23
31
|
const handleChange = (e: Event) => {
|
|
24
|
-
const value = (e.target as HTMLSelectElement).value
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
const value = (e.target as HTMLSelectElement).value
|
|
33
|
+
const option = props.options.find(
|
|
34
|
+
(candidate) => String(candidate.value) === value,
|
|
35
|
+
)
|
|
36
|
+
if (!option) return
|
|
37
|
+
setSelected(() => option.value)
|
|
38
|
+
props.onChange?.(option.value)
|
|
27
39
|
}
|
|
28
40
|
|
|
29
41
|
return (
|
|
30
42
|
<div class={styles().selectContainer}>
|
|
31
43
|
<div class={styles().selectWrapper}>
|
|
32
44
|
{props.label && (
|
|
33
|
-
<label class={styles().selectLabel}>
|
|
45
|
+
<label for={id} class={styles().selectLabel}>
|
|
46
|
+
{props.label}
|
|
47
|
+
</label>
|
|
34
48
|
)}
|
|
35
49
|
{props.description && (
|
|
36
|
-
<p class={styles().selectDescription}>
|
|
50
|
+
<p id={descriptionId} class={styles().selectDescription}>
|
|
51
|
+
{props.description}
|
|
52
|
+
</p>
|
|
37
53
|
)}
|
|
38
54
|
<select
|
|
55
|
+
id={id}
|
|
56
|
+
data-tsd-control
|
|
57
|
+
aria-describedby={props.description ? descriptionId : undefined}
|
|
39
58
|
class={styles().select}
|
|
40
59
|
value={selected()}
|
|
41
|
-
|
|
60
|
+
onChange={handleChange}
|
|
42
61
|
>
|
|
43
62
|
{props.options.map((opt) => (
|
|
44
63
|
<option value={opt.value}>{opt.label}</option>
|
package/src/components/tag.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Show } from 'solid-js'
|
|
2
|
-
import {
|
|
2
|
+
import { createStyles } from '../styles/use-styles'
|
|
3
3
|
import type { tokens } from '../styles/tokens'
|
|
4
4
|
|
|
5
5
|
export const Tag = (props: {
|
|
@@ -8,9 +8,13 @@ export const Tag = (props: {
|
|
|
8
8
|
count?: number
|
|
9
9
|
disabled?: boolean
|
|
10
10
|
}) => {
|
|
11
|
-
const styles =
|
|
11
|
+
const styles = createStyles()
|
|
12
12
|
return (
|
|
13
|
-
<button
|
|
13
|
+
<button
|
|
14
|
+
data-tsd-control
|
|
15
|
+
disabled={props.disabled}
|
|
16
|
+
class={styles().tag.base}
|
|
17
|
+
>
|
|
14
18
|
<span class={styles().tag.dot(props.color)} />
|
|
15
19
|
<span class={styles().tag.label}>{props.label}</span>
|
|
16
20
|
|
package/src/components/theme.tsx
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
createEffect,
|
|
4
|
+
createSignal,
|
|
5
|
+
useContext as getContext,
|
|
6
|
+
} from 'solid-js'
|
|
7
|
+
import { ensureDevtoolsStyles } from '../styles/semantic-theme'
|
|
2
8
|
import type { Accessor, JSX } from 'solid-js'
|
|
3
9
|
|
|
4
10
|
export type TanStackDevtoolsTheme = 'light' | 'dark'
|
|
@@ -17,17 +23,24 @@ export const ThemeContextProvider = (props: {
|
|
|
17
23
|
createEffect(() => {
|
|
18
24
|
setTheme(props.theme)
|
|
19
25
|
})
|
|
26
|
+
const [container, setContainer] = createSignal<HTMLSpanElement>()
|
|
27
|
+
createEffect(() => {
|
|
28
|
+
const element = container()
|
|
29
|
+
if (element) ensureDevtoolsStyles(element.ownerDocument)
|
|
30
|
+
})
|
|
20
31
|
return (
|
|
21
32
|
<ThemeContext.Provider value={{ theme, setTheme }}>
|
|
22
|
-
{
|
|
33
|
+
<span ref={setContainer} style={{ display: 'contents' }}>
|
|
34
|
+
{props.children}
|
|
35
|
+
</span>
|
|
23
36
|
</ThemeContext.Provider>
|
|
24
37
|
)
|
|
25
38
|
}
|
|
26
39
|
|
|
27
|
-
export function
|
|
28
|
-
const context =
|
|
40
|
+
export function createTheme() {
|
|
41
|
+
const context = getContext(ThemeContext)
|
|
29
42
|
if (!context) {
|
|
30
|
-
throw new Error('
|
|
43
|
+
throw new Error('createTheme must be used within a ThemeContextProvider')
|
|
31
44
|
}
|
|
32
45
|
|
|
33
46
|
return context
|
package/src/components/tree.tsx
CHANGED
|
@@ -3,10 +3,11 @@ import clsx from 'clsx'
|
|
|
3
3
|
import dayjs from 'dayjs'
|
|
4
4
|
|
|
5
5
|
// css
|
|
6
|
-
import {
|
|
6
|
+
import { createStyles, css } from '../styles/use-styles'
|
|
7
7
|
|
|
8
8
|
// icons
|
|
9
9
|
import { CopiedCopier, Copier, ErrorCopier } from './icons'
|
|
10
|
+
import { createTheme } from './theme'
|
|
10
11
|
|
|
11
12
|
// utils
|
|
12
13
|
import type { CollapsiblePaths } from '../utils/deep-keys'
|
|
@@ -49,14 +50,17 @@ function JsonValue(props: {
|
|
|
49
50
|
|
|
50
51
|
config?: { dateFormat?: string }
|
|
51
52
|
}) {
|
|
52
|
-
const styles =
|
|
53
|
+
const styles = createStyles()
|
|
53
54
|
|
|
54
55
|
return (
|
|
55
|
-
<span
|
|
56
|
+
<span
|
|
57
|
+
data-tsd-surface={props.isRoot ? '' : undefined}
|
|
58
|
+
class={styles().tree.valueContainer(props.isRoot ?? false)}
|
|
59
|
+
>
|
|
56
60
|
{props.keyName &&
|
|
57
61
|
typeof props.value !== 'object' &&
|
|
58
62
|
!Array.isArray(props.value) && (
|
|
59
|
-
<span class={styles().tree.valueKey}>
|
|
63
|
+
<span data-tsd-syntax="property" class={styles().tree.valueKey}>
|
|
60
64
|
"{props.keyName}":{' '}
|
|
61
65
|
</span>
|
|
62
66
|
)}
|
|
@@ -64,7 +68,7 @@ function JsonValue(props: {
|
|
|
64
68
|
{(() => {
|
|
65
69
|
if (typeof props.value === 'string') {
|
|
66
70
|
return (
|
|
67
|
-
<span class={styles().tree.valueString}>
|
|
71
|
+
<span data-tsd-syntax="string" class={styles().tree.valueString}>
|
|
68
72
|
"{props.value}"
|
|
69
73
|
</span>
|
|
70
74
|
)
|
|
@@ -72,29 +76,39 @@ function JsonValue(props: {
|
|
|
72
76
|
|
|
73
77
|
if (typeof props.value === 'number') {
|
|
74
78
|
return (
|
|
75
|
-
<span class={styles().tree.valueNumber}>
|
|
79
|
+
<span data-tsd-syntax="number" class={styles().tree.valueNumber}>
|
|
80
|
+
{String(props.value)}
|
|
81
|
+
</span>
|
|
76
82
|
)
|
|
77
83
|
}
|
|
78
84
|
|
|
79
85
|
if (typeof props.value === 'boolean') {
|
|
80
86
|
return (
|
|
81
|
-
<span class={styles().tree.valueBoolean}>
|
|
87
|
+
<span data-tsd-syntax="keyword" class={styles().tree.valueBoolean}>
|
|
82
88
|
{String(props.value)}
|
|
83
89
|
</span>
|
|
84
90
|
)
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
if (props.value === null) {
|
|
88
|
-
return
|
|
94
|
+
return (
|
|
95
|
+
<span data-tsd-syntax="keyword" class={styles().tree.valueNull}>
|
|
96
|
+
null
|
|
97
|
+
</span>
|
|
98
|
+
)
|
|
89
99
|
}
|
|
90
100
|
|
|
91
101
|
if (props.value === undefined) {
|
|
92
|
-
return
|
|
102
|
+
return (
|
|
103
|
+
<span data-tsd-syntax="keyword" class={styles().tree.valueNull}>
|
|
104
|
+
undefined
|
|
105
|
+
</span>
|
|
106
|
+
)
|
|
93
107
|
}
|
|
94
108
|
|
|
95
109
|
if (typeof props.value === 'function') {
|
|
96
110
|
return (
|
|
97
|
-
<span class={styles().tree.valueFunction}>
|
|
111
|
+
<span data-tsd-syntax="keyword" class={styles().tree.valueFunction}>
|
|
98
112
|
{String(props.value)}
|
|
99
113
|
</span>
|
|
100
114
|
)
|
|
@@ -137,7 +151,11 @@ function JsonValue(props: {
|
|
|
137
151
|
<CopyButton value={props.value} />
|
|
138
152
|
</div>
|
|
139
153
|
)}
|
|
140
|
-
{props.isLastKey || props.isRoot ?
|
|
154
|
+
{props.isLastKey || props.isRoot ? (
|
|
155
|
+
''
|
|
156
|
+
) : (
|
|
157
|
+
<span data-tsd-syntax="punctuation">,</span>
|
|
158
|
+
)}
|
|
141
159
|
</span>
|
|
142
160
|
)
|
|
143
161
|
}
|
|
@@ -152,7 +170,7 @@ const ArrayValue = (props: {
|
|
|
152
170
|
path: string
|
|
153
171
|
config?: { dateFormat?: string }
|
|
154
172
|
}) => {
|
|
155
|
-
const styles =
|
|
173
|
+
const styles = createStyles()
|
|
156
174
|
|
|
157
175
|
const [expanded, setExpanded] = createSignal(
|
|
158
176
|
props.depth <= props.defaultExpansionDepth &&
|
|
@@ -163,12 +181,17 @@ const ArrayValue = (props: {
|
|
|
163
181
|
return (
|
|
164
182
|
<span class={styles().tree.expanderContainer}>
|
|
165
183
|
{props.keyName && (
|
|
166
|
-
<span
|
|
184
|
+
<span
|
|
185
|
+
data-tsd-syntax="property"
|
|
186
|
+
class={clsx(styles().tree.valueKey, styles().tree.collapsible)}
|
|
187
|
+
>
|
|
167
188
|
"{props.keyName}":{' '}
|
|
168
189
|
</span>
|
|
169
190
|
)}
|
|
170
191
|
|
|
171
|
-
<span class={styles().tree.valueBraces}>
|
|
192
|
+
<span data-tsd-syntax="punctuation" class={styles().tree.valueBraces}>
|
|
193
|
+
[]
|
|
194
|
+
</span>
|
|
172
195
|
</span>
|
|
173
196
|
)
|
|
174
197
|
}
|
|
@@ -186,6 +209,7 @@ const ArrayValue = (props: {
|
|
|
186
209
|
e.stopImmediatePropagation()
|
|
187
210
|
setExpanded(!expanded())
|
|
188
211
|
}}
|
|
212
|
+
data-tsd-syntax="property"
|
|
189
213
|
class={clsx(styles().tree.valueKey, styles().tree.collapsible)}
|
|
190
214
|
>
|
|
191
215
|
"{props.keyName}":{' '}
|
|
@@ -193,10 +217,15 @@ const ArrayValue = (props: {
|
|
|
193
217
|
</span>
|
|
194
218
|
)}
|
|
195
219
|
|
|
196
|
-
<span class={styles().tree.valueBraces}>
|
|
220
|
+
<span data-tsd-syntax="punctuation" class={styles().tree.valueBraces}>
|
|
221
|
+
[
|
|
222
|
+
</span>
|
|
197
223
|
|
|
198
224
|
<Show when={expanded()}>
|
|
199
|
-
<span
|
|
225
|
+
<span
|
|
226
|
+
data-tsd-separator={props.keyName ? '' : undefined}
|
|
227
|
+
class={styles().tree.expandedLine(Boolean(props.keyName))}
|
|
228
|
+
>
|
|
200
229
|
<For each={props.value}>
|
|
201
230
|
{(item, i) => {
|
|
202
231
|
const isLastKey = i() === props.value.length - 1
|
|
@@ -219,6 +248,7 @@ const ArrayValue = (props: {
|
|
|
219
248
|
|
|
220
249
|
<Show when={!expanded()}>
|
|
221
250
|
<span
|
|
251
|
+
data-tsd-syntax="comment"
|
|
222
252
|
onClick={(e) => {
|
|
223
253
|
e.stopPropagation()
|
|
224
254
|
e.stopImmediatePropagation()
|
|
@@ -229,7 +259,9 @@ const ArrayValue = (props: {
|
|
|
229
259
|
{`...`}
|
|
230
260
|
</span>
|
|
231
261
|
</Show>
|
|
232
|
-
<span class={styles().tree.valueBraces}>
|
|
262
|
+
<span data-tsd-syntax="punctuation" class={styles().tree.valueBraces}>
|
|
263
|
+
]
|
|
264
|
+
</span>
|
|
233
265
|
</span>
|
|
234
266
|
)
|
|
235
267
|
}
|
|
@@ -244,7 +276,7 @@ const ObjectValue = (props: {
|
|
|
244
276
|
path: string
|
|
245
277
|
config?: { dateFormat?: string }
|
|
246
278
|
}) => {
|
|
247
|
-
const styles =
|
|
279
|
+
const styles = createStyles()
|
|
248
280
|
|
|
249
281
|
const [expanded, setExpanded] = createSignal(
|
|
250
282
|
props.depth <= props.defaultExpansionDepth &&
|
|
@@ -258,12 +290,15 @@ const ObjectValue = (props: {
|
|
|
258
290
|
return (
|
|
259
291
|
<span class={styles().tree.expanderContainer}>
|
|
260
292
|
{props.keyName && (
|
|
261
|
-
<span
|
|
293
|
+
<span
|
|
294
|
+
data-tsd-syntax="property"
|
|
295
|
+
class={clsx(styles().tree.valueKey, styles().tree.collapsible)}
|
|
296
|
+
>
|
|
262
297
|
"{props.keyName}":{' '}
|
|
263
298
|
</span>
|
|
264
299
|
)}
|
|
265
300
|
|
|
266
|
-
<span class={styles().tree.valueBraces}>
|
|
301
|
+
<span data-tsd-syntax="string" class={styles().tree.valueBraces}>
|
|
267
302
|
{dayjs(props.value).format(
|
|
268
303
|
props.config?.dateFormat ? props.config.dateFormat : 'DDMMMYY',
|
|
269
304
|
)}
|
|
@@ -276,12 +311,17 @@ const ObjectValue = (props: {
|
|
|
276
311
|
return (
|
|
277
312
|
<span class={styles().tree.expanderContainer}>
|
|
278
313
|
{props.keyName && (
|
|
279
|
-
<span
|
|
314
|
+
<span
|
|
315
|
+
data-tsd-syntax="property"
|
|
316
|
+
class={clsx(styles().tree.valueKey, styles().tree.collapsible)}
|
|
317
|
+
>
|
|
280
318
|
"{props.keyName}":{' '}
|
|
281
319
|
</span>
|
|
282
320
|
)}
|
|
283
321
|
|
|
284
|
-
<span class={styles().tree.valueBraces}>
|
|
322
|
+
<span data-tsd-syntax="punctuation" class={styles().tree.valueBraces}>
|
|
323
|
+
{'{}'}
|
|
324
|
+
</span>
|
|
285
325
|
</span>
|
|
286
326
|
)
|
|
287
327
|
}
|
|
@@ -302,6 +342,7 @@ const ObjectValue = (props: {
|
|
|
302
342
|
e.stopImmediatePropagation()
|
|
303
343
|
setExpanded(!expanded())
|
|
304
344
|
}}
|
|
345
|
+
data-tsd-syntax="property"
|
|
305
346
|
class={clsx(styles().tree.valueKey, styles().tree.collapsible)}
|
|
306
347
|
>
|
|
307
348
|
"{props.keyName}":{' '}
|
|
@@ -309,10 +350,15 @@ const ObjectValue = (props: {
|
|
|
309
350
|
</span>
|
|
310
351
|
)}
|
|
311
352
|
|
|
312
|
-
<span class={styles().tree.valueBraces}>
|
|
353
|
+
<span data-tsd-syntax="punctuation" class={styles().tree.valueBraces}>
|
|
354
|
+
{'{'}
|
|
355
|
+
</span>
|
|
313
356
|
|
|
314
357
|
<Show when={expanded()}>
|
|
315
|
-
<span
|
|
358
|
+
<span
|
|
359
|
+
data-tsd-separator={props.keyName ? '' : undefined}
|
|
360
|
+
class={styles().tree.expandedLine(Boolean(props.keyName))}
|
|
361
|
+
>
|
|
316
362
|
<For each={keys}>
|
|
317
363
|
{(k) => (
|
|
318
364
|
<>
|
|
@@ -335,6 +381,7 @@ const ObjectValue = (props: {
|
|
|
335
381
|
|
|
336
382
|
<Show when={!expanded()}>
|
|
337
383
|
<span
|
|
384
|
+
data-tsd-syntax="comment"
|
|
338
385
|
onClick={(e) => {
|
|
339
386
|
e.stopPropagation()
|
|
340
387
|
e.stopImmediatePropagation()
|
|
@@ -346,7 +393,9 @@ const ObjectValue = (props: {
|
|
|
346
393
|
</span>
|
|
347
394
|
</Show>
|
|
348
395
|
|
|
349
|
-
<span class={styles().tree.valueBraces}>
|
|
396
|
+
<span data-tsd-syntax="punctuation" class={styles().tree.valueBraces}>
|
|
397
|
+
{'}'}
|
|
398
|
+
</span>
|
|
350
399
|
</span>
|
|
351
400
|
)
|
|
352
401
|
}
|
|
@@ -354,11 +403,14 @@ const ObjectValue = (props: {
|
|
|
354
403
|
type CopyState = 'NoCopy' | 'SuccessCopy' | 'ErrorCopy'
|
|
355
404
|
|
|
356
405
|
const CopyButton = (props: { value: unknown }) => {
|
|
357
|
-
const styles =
|
|
406
|
+
const styles = createStyles()
|
|
407
|
+
const { theme } = createTheme()
|
|
358
408
|
const [copyState, setCopyState] = createSignal<CopyState>('NoCopy')
|
|
359
409
|
|
|
360
410
|
return (
|
|
361
411
|
<button
|
|
412
|
+
data-tsd-control
|
|
413
|
+
data-copy-state={copyState()}
|
|
362
414
|
class={styles().tree.actionButton}
|
|
363
415
|
title="Copy object to clipboard"
|
|
364
416
|
aria-label={`${
|
|
@@ -397,10 +449,14 @@ const CopyButton = (props: { value: unknown }) => {
|
|
|
397
449
|
<Copier />
|
|
398
450
|
</Match>
|
|
399
451
|
<Match when={copyState() === 'SuccessCopy'}>
|
|
400
|
-
<
|
|
452
|
+
<span class={styles().tree.actionSuccess}>
|
|
453
|
+
<CopiedCopier theme={theme()} />
|
|
454
|
+
</span>
|
|
401
455
|
</Match>
|
|
402
456
|
<Match when={copyState() === 'ErrorCopy'}>
|
|
403
|
-
<
|
|
457
|
+
<span class={styles().tree.actionError}>
|
|
458
|
+
<ErrorCopier />
|
|
459
|
+
</span>
|
|
404
460
|
</Match>
|
|
405
461
|
</Switch>
|
|
406
462
|
</button>
|
|
@@ -408,10 +464,21 @@ const CopyButton = (props: { value: unknown }) => {
|
|
|
408
464
|
}
|
|
409
465
|
|
|
410
466
|
const Expander = (props: { expanded: boolean; onClick: () => void }) => {
|
|
411
|
-
const styles =
|
|
467
|
+
const styles = createStyles()
|
|
412
468
|
return (
|
|
413
469
|
<span
|
|
470
|
+
data-tsd-control
|
|
471
|
+
role="button"
|
|
472
|
+
tabIndex={0}
|
|
473
|
+
aria-expanded={props.expanded}
|
|
474
|
+
aria-label={props.expanded ? 'Collapse value' : 'Expand value'}
|
|
414
475
|
onClick={props.onClick}
|
|
476
|
+
onKeyDown={(event) => {
|
|
477
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
478
|
+
event.preventDefault()
|
|
479
|
+
props.onClick()
|
|
480
|
+
}
|
|
481
|
+
}}
|
|
415
482
|
class={clsx(
|
|
416
483
|
styles().tree.expander,
|
|
417
484
|
css`
|
package/src/index.ts
CHANGED
|
@@ -13,7 +13,7 @@ export {
|
|
|
13
13
|
SectionIcon,
|
|
14
14
|
} from './components/section'
|
|
15
15
|
export { Header, HeaderLogo } from './components/header'
|
|
16
|
-
export {
|
|
16
|
+
export { createTheme, ThemeContextProvider } from './components/theme'
|
|
17
17
|
export type { TanStackDevtoolsTheme } from './components/theme'
|
|
18
18
|
export {
|
|
19
19
|
CheckCircleIcon,
|
package/src/internal.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export {
|
|
2
|
+
DEVTOOLS_FONT_STYLE_ID,
|
|
3
|
+
DEVTOOLS_FORCED_COLORS_STYLE_ID,
|
|
4
|
+
devtoolsFontCss,
|
|
5
|
+
forcedColorsCss,
|
|
6
|
+
ensureDevtoolsFonts,
|
|
7
|
+
ensureDevtoolsStyles,
|
|
8
|
+
resolveSemanticTheme,
|
|
9
|
+
semanticThemes,
|
|
10
|
+
} from './styles/semantic-theme'
|
|
11
|
+
export type { SemanticTheme, StatusRole } from './styles/semantic-theme'
|