@tanstack/query-devtools 5.0.0-rc.10 → 5.0.0-rc.13
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/build/Devtools/{ECUC7UFN.jsx → 3BAJISSX.jsx} +558 -286
- package/build/Devtools/{UZ6MTF6A.js → 4TNE5QTO.js} +610 -366
- package/build/Devtools/{56YMBTAH.jsx → OWSLDUSP.jsx} +558 -286
- package/build/Devtools/{B5V4HXOX.js → YSRICXZI.js} +610 -366
- package/build/dev.cjs +616 -372
- package/build/dev.js +1 -1
- package/build/dev.jsx +1 -1
- package/build/index.cjs +616 -372
- package/build/index.js +1 -1
- package/build/index.jsx +1 -1
- package/package.json +2 -2
- package/src/Context.ts +9 -0
- package/src/Devtools.tsx +422 -206
- package/src/Explorer.tsx +72 -47
- package/src/icons/index.tsx +113 -50
- package/src/utils.tsx +17 -0
package/src/Explorer.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
updateNestedDataByPath,
|
|
11
11
|
} from './utils'
|
|
12
12
|
import { Check, CopiedCopier, Copier, ErrorCopier, List, Trash } from './icons'
|
|
13
|
-
import { useQueryDevtoolsContext } from './Context'
|
|
13
|
+
import { useQueryDevtoolsContext, useTheme } from './Context'
|
|
14
14
|
import type { Query } from '@tanstack/query-core'
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -37,12 +37,15 @@ export function chunkArray<T extends { label: string; value: unknown }>(
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const Expander = (props: { expanded: boolean }) => {
|
|
40
|
-
const
|
|
40
|
+
const theme = useTheme()
|
|
41
|
+
const styles = createMemo(() => {
|
|
42
|
+
return theme() === 'dark' ? darkStyles : lightStyles
|
|
43
|
+
})
|
|
41
44
|
|
|
42
45
|
return (
|
|
43
46
|
<span
|
|
44
47
|
class={cx(
|
|
45
|
-
styles.expander,
|
|
48
|
+
styles().expander,
|
|
46
49
|
css`
|
|
47
50
|
transform: rotate(${props.expanded ? 90 : 0}deg);
|
|
48
51
|
`,
|
|
@@ -74,12 +77,15 @@ const Expander = (props: { expanded: boolean }) => {
|
|
|
74
77
|
|
|
75
78
|
type CopyState = 'NoCopy' | 'SuccessCopy' | 'ErrorCopy'
|
|
76
79
|
const CopyButton = (props: { value: unknown }) => {
|
|
77
|
-
const
|
|
80
|
+
const theme = useTheme()
|
|
81
|
+
const styles = createMemo(() => {
|
|
82
|
+
return theme() === 'dark' ? darkStyles : lightStyles
|
|
83
|
+
})
|
|
78
84
|
const [copyState, setCopyState] = createSignal<CopyState>('NoCopy')
|
|
79
85
|
|
|
80
86
|
return (
|
|
81
87
|
<button
|
|
82
|
-
class={styles.actionButton}
|
|
88
|
+
class={styles().actionButton}
|
|
83
89
|
title="Copy object to clipboard"
|
|
84
90
|
aria-label={`${
|
|
85
91
|
copyState() === 'NoCopy'
|
|
@@ -115,7 +121,7 @@ const CopyButton = (props: { value: unknown }) => {
|
|
|
115
121
|
<Copier />
|
|
116
122
|
</Match>
|
|
117
123
|
<Match when={copyState() === 'SuccessCopy'}>
|
|
118
|
-
<CopiedCopier />
|
|
124
|
+
<CopiedCopier theme={theme()} />
|
|
119
125
|
</Match>
|
|
120
126
|
<Match when={copyState() === 'ErrorCopy'}>
|
|
121
127
|
<ErrorCopier />
|
|
@@ -129,12 +135,15 @@ const ClearArrayButton = (props: {
|
|
|
129
135
|
dataPath: Array<string>
|
|
130
136
|
activeQuery: Query
|
|
131
137
|
}) => {
|
|
132
|
-
const
|
|
138
|
+
const theme = useTheme()
|
|
139
|
+
const styles = createMemo(() => {
|
|
140
|
+
return theme() === 'dark' ? darkStyles : lightStyles
|
|
141
|
+
})
|
|
133
142
|
const queryClient = useQueryDevtoolsContext().client
|
|
134
143
|
|
|
135
144
|
return (
|
|
136
145
|
<button
|
|
137
|
-
class={styles.actionButton}
|
|
146
|
+
class={styles().actionButton}
|
|
138
147
|
title={'Remove all items'}
|
|
139
148
|
aria-label={'Remove all items'}
|
|
140
149
|
onClick={() => {
|
|
@@ -152,12 +161,15 @@ const DeleteItemButton = (props: {
|
|
|
152
161
|
dataPath: Array<string>
|
|
153
162
|
activeQuery: Query
|
|
154
163
|
}) => {
|
|
155
|
-
const
|
|
164
|
+
const theme = useTheme()
|
|
165
|
+
const styles = createMemo(() => {
|
|
166
|
+
return theme() === 'dark' ? darkStyles : lightStyles
|
|
167
|
+
})
|
|
156
168
|
const queryClient = useQueryDevtoolsContext().client
|
|
157
169
|
|
|
158
170
|
return (
|
|
159
171
|
<button
|
|
160
|
-
class={cx(styles.actionButton)}
|
|
172
|
+
class={cx(styles().actionButton)}
|
|
161
173
|
title={'Delete item'}
|
|
162
174
|
aria-label={'Delete item'}
|
|
163
175
|
onClick={() => {
|
|
@@ -176,12 +188,21 @@ const ToggleValueButton = (props: {
|
|
|
176
188
|
activeQuery: Query
|
|
177
189
|
value: boolean
|
|
178
190
|
}) => {
|
|
179
|
-
const
|
|
191
|
+
const theme = useTheme()
|
|
192
|
+
const styles = createMemo(() => {
|
|
193
|
+
return theme() === 'dark' ? darkStyles : lightStyles
|
|
194
|
+
})
|
|
180
195
|
const queryClient = useQueryDevtoolsContext().client
|
|
181
196
|
|
|
182
197
|
return (
|
|
183
198
|
<button
|
|
184
|
-
class={cx(
|
|
199
|
+
class={cx(
|
|
200
|
+
styles().actionButton,
|
|
201
|
+
css`
|
|
202
|
+
width: ${tokens.size[3.5]};
|
|
203
|
+
height: ${tokens.size[3.5]};
|
|
204
|
+
`,
|
|
205
|
+
)}
|
|
185
206
|
title={'Toggle value'}
|
|
186
207
|
aria-label={'Toggle value'}
|
|
187
208
|
onClick={() => {
|
|
@@ -194,7 +215,7 @@ const ToggleValueButton = (props: {
|
|
|
194
215
|
queryClient.setQueryData(props.activeQuery.queryKey, newData)
|
|
195
216
|
}}
|
|
196
217
|
>
|
|
197
|
-
<Check checked={props.value} />
|
|
218
|
+
<Check theme={theme()} checked={props.value} />
|
|
198
219
|
</button>
|
|
199
220
|
)
|
|
200
221
|
}
|
|
@@ -214,7 +235,10 @@ function isIterable(x: any): x is Iterable<unknown> {
|
|
|
214
235
|
}
|
|
215
236
|
|
|
216
237
|
export default function Explorer(props: ExplorerProps) {
|
|
217
|
-
const
|
|
238
|
+
const theme = useTheme()
|
|
239
|
+
const styles = createMemo(() => {
|
|
240
|
+
return theme() === 'dark' ? darkStyles : lightStyles
|
|
241
|
+
})
|
|
218
242
|
const queryClient = useQueryDevtoolsContext().client
|
|
219
243
|
|
|
220
244
|
const [expanded, setExpanded] = createSignal(
|
|
@@ -275,21 +299,21 @@ export default function Explorer(props: ExplorerProps) {
|
|
|
275
299
|
const currentDataPath = props.dataPath ?? []
|
|
276
300
|
|
|
277
301
|
return (
|
|
278
|
-
<div class={styles.entry}>
|
|
302
|
+
<div class={styles().entry}>
|
|
279
303
|
<Show when={subEntryPages().length}>
|
|
280
|
-
<div class={styles.expanderButtonContainer}>
|
|
304
|
+
<div class={styles().expanderButtonContainer}>
|
|
281
305
|
<button
|
|
282
|
-
class={styles.expanderButton}
|
|
306
|
+
class={styles().expanderButton}
|
|
283
307
|
onClick={() => toggleExpanded()}
|
|
284
308
|
>
|
|
285
309
|
<Expander expanded={expanded()} /> <span>{props.label}</span>{' '}
|
|
286
|
-
<span class={styles.info}>
|
|
310
|
+
<span class={styles().info}>
|
|
287
311
|
{String(type()).toLowerCase() === 'iterable' ? '(Iterable) ' : ''}
|
|
288
312
|
{subEntries().length} {subEntries().length > 1 ? `items` : `item`}
|
|
289
313
|
</span>
|
|
290
314
|
</button>
|
|
291
315
|
<Show when={props.editable}>
|
|
292
|
-
<div class={styles.actions}>
|
|
316
|
+
<div class={styles().actions}>
|
|
293
317
|
<CopyButton value={props.value} />
|
|
294
318
|
|
|
295
319
|
<Show
|
|
@@ -314,7 +338,7 @@ export default function Explorer(props: ExplorerProps) {
|
|
|
314
338
|
</div>
|
|
315
339
|
<Show when={expanded()}>
|
|
316
340
|
<Show when={subEntryPages().length === 1}>
|
|
317
|
-
<div class={styles.subEntry}>
|
|
341
|
+
<div class={styles().subEntry}>
|
|
318
342
|
<Key each={subEntries()} by={(item) => item.label}>
|
|
319
343
|
{(entry) => {
|
|
320
344
|
return (
|
|
@@ -337,11 +361,11 @@ export default function Explorer(props: ExplorerProps) {
|
|
|
337
361
|
</div>
|
|
338
362
|
</Show>
|
|
339
363
|
<Show when={subEntryPages().length > 1}>
|
|
340
|
-
<div class={styles.subEntry}>
|
|
364
|
+
<div class={styles().subEntry}>
|
|
341
365
|
<Index each={subEntryPages()}>
|
|
342
366
|
{(entries, index) => (
|
|
343
367
|
<div>
|
|
344
|
-
<div class={styles.entry}>
|
|
368
|
+
<div class={styles().entry}>
|
|
345
369
|
<button
|
|
346
370
|
onClick={() =>
|
|
347
371
|
setExpandedPages((old) =>
|
|
@@ -350,14 +374,14 @@ export default function Explorer(props: ExplorerProps) {
|
|
|
350
374
|
: [...old, index],
|
|
351
375
|
)
|
|
352
376
|
}
|
|
353
|
-
class={styles.expanderButton}
|
|
377
|
+
class={styles().expanderButton}
|
|
354
378
|
>
|
|
355
379
|
<Expander expanded={expandedPages().includes(index)} />{' '}
|
|
356
380
|
[{index * 100}...
|
|
357
381
|
{index * 100 + 100 - 1}]
|
|
358
382
|
</button>
|
|
359
383
|
<Show when={expandedPages().includes(index)}>
|
|
360
|
-
<div class={styles.subEntry}>
|
|
384
|
+
<div class={styles().subEntry}>
|
|
361
385
|
<Key each={entries()} by={(entry) => entry.label}>
|
|
362
386
|
{(entry) => (
|
|
363
387
|
<Explorer
|
|
@@ -381,8 +405,8 @@ export default function Explorer(props: ExplorerProps) {
|
|
|
381
405
|
</Show>
|
|
382
406
|
</Show>
|
|
383
407
|
<Show when={subEntryPages().length === 0}>
|
|
384
|
-
<div class={styles.row}>
|
|
385
|
-
<span class={styles.label}>{props.label}:</span>
|
|
408
|
+
<div class={styles().row}>
|
|
409
|
+
<span class={styles().label}>{props.label}:</span>
|
|
386
410
|
<Show
|
|
387
411
|
when={
|
|
388
412
|
props.editable &&
|
|
@@ -392,7 +416,7 @@ export default function Explorer(props: ExplorerProps) {
|
|
|
392
416
|
type() === 'boolean')
|
|
393
417
|
}
|
|
394
418
|
fallback={
|
|
395
|
-
<span class={styles.value}>{displayValue(props.value)}</span>
|
|
419
|
+
<span class={styles().value}>{displayValue(props.value)}</span>
|
|
396
420
|
}
|
|
397
421
|
>
|
|
398
422
|
<Show
|
|
@@ -404,7 +428,7 @@ export default function Explorer(props: ExplorerProps) {
|
|
|
404
428
|
>
|
|
405
429
|
<input
|
|
406
430
|
type={type() === 'number' ? 'number' : 'text'}
|
|
407
|
-
class={cx(styles.value, styles.editableInput)}
|
|
431
|
+
class={cx(styles().value, styles().editableInput)}
|
|
408
432
|
value={props.value as string | number}
|
|
409
433
|
onChange={(changeEvent) => {
|
|
410
434
|
const oldData = props.activeQuery!.state.data
|
|
@@ -424,7 +448,11 @@ export default function Explorer(props: ExplorerProps) {
|
|
|
424
448
|
|
|
425
449
|
<Show when={type() === 'boolean'}>
|
|
426
450
|
<span
|
|
427
|
-
class={cx(
|
|
451
|
+
class={cx(
|
|
452
|
+
styles().value,
|
|
453
|
+
styles().actions,
|
|
454
|
+
styles().editableInput,
|
|
455
|
+
)}
|
|
428
456
|
>
|
|
429
457
|
<ToggleValueButton
|
|
430
458
|
activeQuery={props.activeQuery!}
|
|
@@ -454,9 +482,9 @@ export default function Explorer(props: ExplorerProps) {
|
|
|
454
482
|
)
|
|
455
483
|
}
|
|
456
484
|
|
|
457
|
-
const
|
|
485
|
+
const stylesFactory = (theme: 'light' | 'dark') => {
|
|
458
486
|
const { colors, font, size, border } = tokens
|
|
459
|
-
|
|
487
|
+
const t = (light: string, dark: string) => (theme === 'light' ? light : dark)
|
|
460
488
|
return {
|
|
461
489
|
entry: css`
|
|
462
490
|
& * {
|
|
@@ -470,7 +498,7 @@ const getStyles = () => {
|
|
|
470
498
|
subEntry: css`
|
|
471
499
|
margin: 0 0 0 0.5em;
|
|
472
500
|
padding-left: 0.75em;
|
|
473
|
-
border-left: 2px solid ${colors.darkGray[400]};
|
|
501
|
+
border-left: 2px solid ${t(colors.gray[300], colors.darkGray[400])};
|
|
474
502
|
/* outline: 1px solid ${colors.teal[400]}; */
|
|
475
503
|
`,
|
|
476
504
|
expander: css`
|
|
@@ -519,16 +547,16 @@ const getStyles = () => {
|
|
|
519
547
|
}
|
|
520
548
|
`,
|
|
521
549
|
info: css`
|
|
522
|
-
color: ${colors.gray[500]};
|
|
550
|
+
color: ${t(colors.gray[500], colors.gray[500])};
|
|
523
551
|
font-size: ${font.size.xs};
|
|
524
552
|
margin-left: ${size[1]};
|
|
525
553
|
/* outline: 1px solid ${colors.yellow[400]}; */
|
|
526
554
|
`,
|
|
527
555
|
label: css`
|
|
528
|
-
color: ${colors.gray[300]};
|
|
556
|
+
color: ${t(colors.gray[700], colors.gray[300])};
|
|
529
557
|
`,
|
|
530
558
|
value: css`
|
|
531
|
-
color: ${colors.purple[400]};
|
|
559
|
+
color: ${t(colors.purple[600], colors.purple[400])};
|
|
532
560
|
flex-grow: 1;
|
|
533
561
|
`,
|
|
534
562
|
actions: css`
|
|
@@ -546,16 +574,18 @@ const getStyles = () => {
|
|
|
546
574
|
`,
|
|
547
575
|
editableInput: css`
|
|
548
576
|
border: none;
|
|
549
|
-
padding: ${size[0.5]} ${size[1]};
|
|
577
|
+
padding: ${size[0.5]} ${size[1]} ${size[0.5]} ${size[1.5]};
|
|
550
578
|
flex-grow: 1;
|
|
551
|
-
|
|
579
|
+
border-radius: ${border.radius.xs};
|
|
580
|
+
background-color: ${t(colors.gray[200], colors.darkGray[500])};
|
|
552
581
|
|
|
553
582
|
&:hover {
|
|
554
|
-
background-color: ${colors.gray[
|
|
583
|
+
background-color: ${t(colors.gray[300], colors.darkGray[600])};
|
|
555
584
|
}
|
|
556
585
|
`,
|
|
557
586
|
actionButton: css`
|
|
558
587
|
background-color: transparent;
|
|
588
|
+
color: ${t(colors.gray[500], colors.gray[500])};
|
|
559
589
|
border: none;
|
|
560
590
|
display: inline-flex;
|
|
561
591
|
padding: 0px;
|
|
@@ -568,15 +598,7 @@ const getStyles = () => {
|
|
|
568
598
|
z-index: 1;
|
|
569
599
|
|
|
570
600
|
&:hover svg {
|
|
571
|
-
.
|
|
572
|
-
.check,
|
|
573
|
-
.list {
|
|
574
|
-
stroke: ${colors.gray[500]} !important;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
.list-item {
|
|
578
|
-
stroke: ${colors.gray[700]};
|
|
579
|
-
}
|
|
601
|
+
color: ${t(colors.gray[600], colors.gray[400])};
|
|
580
602
|
}
|
|
581
603
|
|
|
582
604
|
&:focus-visible {
|
|
@@ -587,3 +609,6 @@ const getStyles = () => {
|
|
|
587
609
|
`,
|
|
588
610
|
}
|
|
589
611
|
}
|
|
612
|
+
|
|
613
|
+
const lightStyles = stylesFactory('light')
|
|
614
|
+
const darkStyles = stylesFactory('dark')
|
package/src/icons/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Show } from 'solid-js'
|
|
2
2
|
|
|
3
3
|
export function Search() {
|
|
4
4
|
return (
|
|
@@ -11,7 +11,7 @@ export function Search() {
|
|
|
11
11
|
>
|
|
12
12
|
<path
|
|
13
13
|
d="M13 13L9.00007 9M10.3333 5.66667C10.3333 8.244 8.244 10.3333 5.66667 10.3333C3.08934 10.3333 1 8.244 1 5.66667C1 3.08934 3.08934 1 5.66667 1C8.244 1 10.3333 3.08934 10.3333 5.66667Z"
|
|
14
|
-
stroke="
|
|
14
|
+
stroke="currentColor"
|
|
15
15
|
stroke-width="1.66667"
|
|
16
16
|
stroke-linecap="round"
|
|
17
17
|
stroke-linejoin="round"
|
|
@@ -31,8 +31,8 @@ export function Trash() {
|
|
|
31
31
|
>
|
|
32
32
|
<path
|
|
33
33
|
d="M9 3H15M3 6H21M19 6L18.2987 16.5193C18.1935 18.0975 18.1409 18.8867 17.8 19.485C17.4999 20.0118 17.0472 20.4353 16.5017 20.6997C15.882 21 15.0911 21 13.5093 21H10.4907C8.90891 21 8.11803 21 7.49834 20.6997C6.95276 20.4353 6.50009 20.0118 6.19998 19.485C5.85911 18.8867 5.8065 18.0975 5.70129 16.5193L5 6M10 10.5V15.5M14 10.5V15.5"
|
|
34
|
-
stroke="
|
|
35
|
-
stroke-width="
|
|
34
|
+
stroke="currentColor"
|
|
35
|
+
stroke-width="2"
|
|
36
36
|
stroke-linecap="round"
|
|
37
37
|
stroke-linejoin="round"
|
|
38
38
|
/>
|
|
@@ -51,7 +51,7 @@ export function ChevronDown() {
|
|
|
51
51
|
>
|
|
52
52
|
<path
|
|
53
53
|
d="M1 1L5 5L9 1"
|
|
54
|
-
stroke="
|
|
54
|
+
stroke="currentColor"
|
|
55
55
|
stroke-width="1.66667"
|
|
56
56
|
stroke-linecap="round"
|
|
57
57
|
stroke-linejoin="round"
|
|
@@ -71,7 +71,7 @@ export function ArrowUp() {
|
|
|
71
71
|
>
|
|
72
72
|
<path
|
|
73
73
|
d="M8 13.3333V2.66667M8 2.66667L4 6.66667M8 2.66667L12 6.66667"
|
|
74
|
-
stroke="
|
|
74
|
+
stroke="currentColor"
|
|
75
75
|
stroke-width="1.66667"
|
|
76
76
|
stroke-linecap="round"
|
|
77
77
|
stroke-linejoin="round"
|
|
@@ -91,7 +91,7 @@ export function ArrowDown() {
|
|
|
91
91
|
>
|
|
92
92
|
<path
|
|
93
93
|
d="M8 2.66667V13.3333M8 13.3333L4 9.33333M8 13.3333L12 9.33333"
|
|
94
|
-
stroke="
|
|
94
|
+
stroke="currentColor"
|
|
95
95
|
stroke-width="1.66667"
|
|
96
96
|
stroke-linecap="round"
|
|
97
97
|
stroke-linejoin="round"
|
|
@@ -114,7 +114,7 @@ export function ArrowLeft() {
|
|
|
114
114
|
>
|
|
115
115
|
<path
|
|
116
116
|
d="M8 2.66667V13.3333M8 13.3333L4 9.33333M8 13.3333L12 9.33333"
|
|
117
|
-
stroke="
|
|
117
|
+
stroke="currentColor"
|
|
118
118
|
stroke-width="1.66667"
|
|
119
119
|
stroke-linecap="round"
|
|
120
120
|
stroke-linejoin="round"
|
|
@@ -137,7 +137,7 @@ export function ArrowRight() {
|
|
|
137
137
|
>
|
|
138
138
|
<path
|
|
139
139
|
d="M8 2.66667V13.3333M8 13.3333L4 9.33333M8 13.3333L12 9.33333"
|
|
140
|
-
stroke="
|
|
140
|
+
stroke="currentColor"
|
|
141
141
|
stroke-width="1.66667"
|
|
142
142
|
stroke-linecap="round"
|
|
143
143
|
stroke-linejoin="round"
|
|
@@ -146,11 +146,71 @@ export function ArrowRight() {
|
|
|
146
146
|
)
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
export function Sun() {
|
|
150
|
+
return (
|
|
151
|
+
<svg
|
|
152
|
+
viewBox="0 0 24 24"
|
|
153
|
+
height="12"
|
|
154
|
+
width="12"
|
|
155
|
+
fill="none"
|
|
156
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
157
|
+
>
|
|
158
|
+
<path
|
|
159
|
+
d="M12 2v2m0 16v2M4 12H2m4.314-5.686L4.9 4.9m12.786 1.414L19.1 4.9M6.314 17.69 4.9 19.104m12.786-1.414 1.414 1.414M22 12h-2m-3 0a5 5 0 1 1-10 0 5 5 0 0 1 10 0Z"
|
|
160
|
+
stroke="currentColor"
|
|
161
|
+
stroke-width="2"
|
|
162
|
+
stroke-linecap="round"
|
|
163
|
+
stroke-linejoin="round"
|
|
164
|
+
></path>
|
|
165
|
+
</svg>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function Moon() {
|
|
170
|
+
return (
|
|
171
|
+
<svg
|
|
172
|
+
viewBox="0 0 24 24"
|
|
173
|
+
height="12"
|
|
174
|
+
width="12"
|
|
175
|
+
fill="none"
|
|
176
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
177
|
+
>
|
|
178
|
+
<path
|
|
179
|
+
d="M22 15.844a10.424 10.424 0 0 1-4.306.925c-5.779 0-10.463-4.684-10.463-10.462 0-1.536.33-2.994.925-4.307A10.464 10.464 0 0 0 2 11.538C2 17.316 6.684 22 12.462 22c4.243 0 7.896-2.526 9.538-6.156Z"
|
|
180
|
+
stroke="currentColor"
|
|
181
|
+
stroke-width="2"
|
|
182
|
+
stroke-linecap="round"
|
|
183
|
+
stroke-linejoin="round"
|
|
184
|
+
></path>
|
|
185
|
+
</svg>
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function Monitor() {
|
|
190
|
+
return (
|
|
191
|
+
<svg
|
|
192
|
+
viewBox="0 0 24 24"
|
|
193
|
+
height="12"
|
|
194
|
+
width="12"
|
|
195
|
+
fill="none"
|
|
196
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
197
|
+
>
|
|
198
|
+
<path
|
|
199
|
+
d="M8 21h8m-4-4v4m-5.2-4h10.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C22 14.72 22 13.88 22 12.2V7.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C19.72 3 18.88 3 17.2 3H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 5.28 2 6.12 2 7.8v4.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C4.28 17 5.12 17 6.8 17Z"
|
|
200
|
+
stroke="currentColor"
|
|
201
|
+
stroke-width="2"
|
|
202
|
+
stroke-linecap="round"
|
|
203
|
+
stroke-linejoin="round"
|
|
204
|
+
></path>
|
|
205
|
+
</svg>
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
|
|
149
209
|
export function Wifi() {
|
|
150
210
|
return (
|
|
151
211
|
<svg
|
|
152
|
-
stroke="
|
|
153
|
-
fill="
|
|
212
|
+
stroke="currentColor"
|
|
213
|
+
fill="currentColor"
|
|
154
214
|
stroke-width="0"
|
|
155
215
|
viewBox="0 0 24 24"
|
|
156
216
|
height="1em"
|
|
@@ -166,8 +226,6 @@ export function Wifi() {
|
|
|
166
226
|
export function Offline() {
|
|
167
227
|
return (
|
|
168
228
|
<svg
|
|
169
|
-
stroke={tokens.colors.yellow[500]}
|
|
170
|
-
fill={tokens.colors.yellow[500]}
|
|
171
229
|
stroke-width="0"
|
|
172
230
|
viewBox="0 0 24 24"
|
|
173
231
|
height="1em"
|
|
@@ -194,14 +252,14 @@ export function Settings() {
|
|
|
194
252
|
>
|
|
195
253
|
<path
|
|
196
254
|
d="M9.3951 19.3711L9.97955 20.6856C10.1533 21.0768 10.4368 21.4093 10.7958 21.6426C11.1547 21.8759 11.5737 22.0001 12.0018 22C12.4299 22.0001 12.8488 21.8759 13.2078 21.6426C13.5667 21.4093 13.8503 21.0768 14.024 20.6856L14.6084 19.3711C14.8165 18.9047 15.1664 18.5159 15.6084 18.26C16.0532 18.0034 16.5678 17.8941 17.0784 17.9478L18.5084 18.1C18.9341 18.145 19.3637 18.0656 19.7451 17.8713C20.1265 17.6771 20.4434 17.3763 20.6573 17.0056C20.8715 16.635 20.9735 16.2103 20.9511 15.7829C20.9286 15.3555 20.7825 14.9438 20.5307 14.5978L19.684 13.4344C19.3825 13.0171 19.2214 12.5148 19.224 12C19.2239 11.4866 19.3865 10.9864 19.6884 10.5711L20.5351 9.40778C20.787 9.06175 20.933 8.65007 20.9555 8.22267C20.978 7.79528 20.8759 7.37054 20.6618 7C20.4479 6.62923 20.131 6.32849 19.7496 6.13423C19.3681 5.93997 18.9386 5.86053 18.5129 5.90556L17.0829 6.05778C16.5722 6.11141 16.0577 6.00212 15.6129 5.74556C15.17 5.48825 14.82 5.09736 14.6129 4.62889L14.024 3.31444C13.8503 2.92317 13.5667 2.59072 13.2078 2.3574C12.8488 2.12408 12.4299 1.99993 12.0018 2C11.5737 1.99993 11.1547 2.12408 10.7958 2.3574C10.4368 2.59072 10.1533 2.92317 9.97955 3.31444L9.3951 4.62889C9.18803 5.09736 8.83798 5.48825 8.3951 5.74556C7.95032 6.00212 7.43577 6.11141 6.9251 6.05778L5.49066 5.90556C5.06499 5.86053 4.6354 5.93997 4.25397 6.13423C3.87255 6.32849 3.55567 6.62923 3.34177 7C3.12759 7.37054 3.02555 7.79528 3.04804 8.22267C3.07052 8.65007 3.21656 9.06175 3.46844 9.40778L4.3151 10.5711C4.61704 10.9864 4.77964 11.4866 4.77955 12C4.77964 12.5134 4.61704 13.0137 4.3151 13.4289L3.46844 14.5922C3.21656 14.9382 3.07052 15.3499 3.04804 15.7773C3.02555 16.2047 3.12759 16.6295 3.34177 17C3.55589 17.3706 3.8728 17.6712 4.25417 17.8654C4.63554 18.0596 5.06502 18.1392 5.49066 18.0944L6.92066 17.9422C7.43133 17.8886 7.94587 17.9979 8.39066 18.2544C8.83519 18.511 9.18687 18.902 9.3951 19.3711Z"
|
|
197
|
-
stroke="
|
|
255
|
+
stroke="currentColor"
|
|
198
256
|
stroke-width="2"
|
|
199
257
|
stroke-linecap="round"
|
|
200
258
|
stroke-linejoin="round"
|
|
201
259
|
/>
|
|
202
260
|
<path
|
|
203
261
|
d="M12 15C13.6568 15 15 13.6569 15 12C15 10.3431 13.6568 9 12 9C10.3431 9 8.99998 10.3431 8.99998 12C8.99998 13.6569 10.3431 15 12 15Z"
|
|
204
|
-
stroke="
|
|
262
|
+
stroke="currentColor"
|
|
205
263
|
stroke-width="2"
|
|
206
264
|
stroke-linecap="round"
|
|
207
265
|
stroke-linejoin="round"
|
|
@@ -225,13 +283,13 @@ export function Copier() {
|
|
|
225
283
|
stroke-width="2"
|
|
226
284
|
stroke-linecap="round"
|
|
227
285
|
stroke-linejoin="round"
|
|
228
|
-
stroke="
|
|
286
|
+
stroke="currentColor"
|
|
229
287
|
/>
|
|
230
288
|
</svg>
|
|
231
289
|
)
|
|
232
290
|
}
|
|
233
291
|
|
|
234
|
-
export function CopiedCopier() {
|
|
292
|
+
export function CopiedCopier(props: { theme: 'light' | 'dark' }) {
|
|
235
293
|
return (
|
|
236
294
|
<svg
|
|
237
295
|
width="24"
|
|
@@ -242,7 +300,7 @@ export function CopiedCopier() {
|
|
|
242
300
|
>
|
|
243
301
|
<path
|
|
244
302
|
d="M7.5 12L10.5 15L16.5 9M7.8 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V16.2C3 17.8802 3 18.7202 3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673C5.27976 21 6.11984 21 7.8 21Z"
|
|
245
|
-
stroke=
|
|
303
|
+
stroke={props.theme === 'dark' ? '#12B76A' : '#027A48'}
|
|
246
304
|
stroke-width="2"
|
|
247
305
|
stroke-linecap="round"
|
|
248
306
|
stroke-linejoin="round"
|
|
@@ -278,7 +336,7 @@ export function List() {
|
|
|
278
336
|
height="24"
|
|
279
337
|
viewBox="0 0 24 24"
|
|
280
338
|
fill="none"
|
|
281
|
-
stroke="
|
|
339
|
+
stroke="currentColor"
|
|
282
340
|
stroke-width="2"
|
|
283
341
|
xmlns="http://www.w3.org/2000/svg"
|
|
284
342
|
>
|
|
@@ -290,39 +348,44 @@ export function List() {
|
|
|
290
348
|
)
|
|
291
349
|
}
|
|
292
350
|
|
|
293
|
-
export function Check(props: { checked: boolean }) {
|
|
351
|
+
export function Check(props: { checked: boolean; theme: 'light' | 'dark' }) {
|
|
294
352
|
return (
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
y1="14.63158"
|
|
311
|
-
x2="10.81294"
|
|
312
|
-
y2="14.63158"
|
|
313
|
-
class="check"
|
|
314
|
-
/>
|
|
315
|
-
<line
|
|
316
|
-
transform="rotate(-45 13.9674 11.5826)"
|
|
317
|
-
x1="6.02012"
|
|
318
|
-
y1="11.58263"
|
|
319
|
-
x2="21.91469"
|
|
320
|
-
y2="11.58263"
|
|
321
|
-
class="check"
|
|
353
|
+
<>
|
|
354
|
+
<Show when={props.checked}>
|
|
355
|
+
<svg
|
|
356
|
+
width="24"
|
|
357
|
+
height="24"
|
|
358
|
+
viewBox="0 0 24 24"
|
|
359
|
+
fill="none"
|
|
360
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
361
|
+
>
|
|
362
|
+
<path
|
|
363
|
+
d="M7.5 12L10.5 15L16.5 9M7.8 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V16.2C3 17.8802 3 18.7202 3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673C5.27976 21 6.11984 21 7.8 21Z"
|
|
364
|
+
stroke={props.theme === 'dark' ? '#9B8AFB' : '#6938EF'}
|
|
365
|
+
stroke-width="2"
|
|
366
|
+
stroke-linecap="round"
|
|
367
|
+
stroke-linejoin="round"
|
|
322
368
|
/>
|
|
323
|
-
</
|
|
324
|
-
|
|
325
|
-
|
|
369
|
+
</svg>
|
|
370
|
+
</Show>
|
|
371
|
+
<Show when={!props.checked}>
|
|
372
|
+
<svg
|
|
373
|
+
viewBox="0 0 24 24"
|
|
374
|
+
height="20"
|
|
375
|
+
width="20"
|
|
376
|
+
fill="none"
|
|
377
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
378
|
+
>
|
|
379
|
+
<path
|
|
380
|
+
d="M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"
|
|
381
|
+
stroke={props.theme === 'dark' ? '#9B8AFB' : '#6938EF'}
|
|
382
|
+
stroke-width="2"
|
|
383
|
+
stroke-linecap="round"
|
|
384
|
+
stroke-linejoin="round"
|
|
385
|
+
></path>
|
|
386
|
+
</svg>
|
|
387
|
+
</Show>
|
|
388
|
+
</>
|
|
326
389
|
)
|
|
327
390
|
}
|
|
328
391
|
|
package/src/utils.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { serialize } from 'superjson'
|
|
2
|
+
import { createSignal, onCleanup, onMount } from 'solid-js'
|
|
2
3
|
import type { Query } from '@tanstack/query-core'
|
|
3
4
|
import type { DevtoolsPosition } from './Context'
|
|
4
5
|
|
|
@@ -112,6 +113,22 @@ export const convertRemToPixels = (rem: number) => {
|
|
|
112
113
|
|
|
113
114
|
export const convertPixelsToRem = (px: number) => px / convertRemToPixels(1)
|
|
114
115
|
|
|
116
|
+
export const getPreferredColorScheme = () => {
|
|
117
|
+
const [colorScheme, setColorScheme] = createSignal<'light' | 'dark'>('dark')
|
|
118
|
+
|
|
119
|
+
onMount(() => {
|
|
120
|
+
const query = window.matchMedia('(prefers-color-scheme: dark)')
|
|
121
|
+
setColorScheme(query.matches ? 'dark' : 'light')
|
|
122
|
+
const listener = (e: MediaQueryListEvent) => {
|
|
123
|
+
setColorScheme(e.matches ? 'dark' : 'light')
|
|
124
|
+
}
|
|
125
|
+
query.addEventListener('change', listener)
|
|
126
|
+
onCleanup(() => query.removeEventListener('change', listener))
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
return colorScheme
|
|
130
|
+
}
|
|
131
|
+
|
|
115
132
|
/**
|
|
116
133
|
* updates nested data by path
|
|
117
134
|
*
|