@tanstack/query-devtools 5.0.5 → 5.1.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.
@@ -389,6 +389,95 @@ export function Check(props: { checked: boolean; theme: 'light' | 'dark' }) {
389
389
  )
390
390
  }
391
391
 
392
+ export function CheckCircle() {
393
+ return (
394
+ <svg
395
+ width="14"
396
+ height="14"
397
+ viewBox="0 0 24 24"
398
+ fill="none"
399
+ xmlns="http://www.w3.org/2000/svg"
400
+ >
401
+ <path
402
+ d="M7.5 12L10.5 15L16.5 9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"
403
+ stroke="currentColor"
404
+ stroke-width="2"
405
+ stroke-linecap="round"
406
+ stroke-linejoin="round"
407
+ />
408
+ </svg>
409
+ )
410
+ }
411
+
412
+ export function LoadingCircle() {
413
+ return (
414
+ <svg
415
+ width="14"
416
+ height="14"
417
+ viewBox="0 0 24 24"
418
+ fill="none"
419
+ xmlns="http://www.w3.org/2000/svg"
420
+ >
421
+ <path
422
+ d="M12 2V6M12 18V22M6 12H2M22 12H18M19.0784 19.0784L16.25 16.25M19.0784 4.99994L16.25 7.82837M4.92157 19.0784L7.75 16.25M4.92157 4.99994L7.75 7.82837"
423
+ stroke="currentColor"
424
+ stroke-width="2"
425
+ stroke-linecap="round"
426
+ stroke-linejoin="round"
427
+ />
428
+ <animateTransform
429
+ attributeName="transform"
430
+ attributeType="XML"
431
+ type="rotate"
432
+ from="0"
433
+ to="360"
434
+ dur="2s"
435
+ repeatCount="indefinite"
436
+ />
437
+ </svg>
438
+ )
439
+ }
440
+
441
+ export function XCircle() {
442
+ return (
443
+ <svg
444
+ width="14"
445
+ height="14"
446
+ viewBox="0 0 24 24"
447
+ fill="none"
448
+ xmlns="http://www.w3.org/2000/svg"
449
+ >
450
+ <path
451
+ d="M15 9L9 15M9 9L15 15M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"
452
+ stroke="currentColor"
453
+ stroke-width="2"
454
+ stroke-linecap="round"
455
+ stroke-linejoin="round"
456
+ />
457
+ </svg>
458
+ )
459
+ }
460
+
461
+ export function PauseCircle() {
462
+ return (
463
+ <svg
464
+ width="14"
465
+ height="14"
466
+ viewBox="0 0 24 24"
467
+ fill="none"
468
+ xmlns="http://www.w3.org/2000/svg"
469
+ >
470
+ <path
471
+ d="M9.5 15V9M14.5 15V9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"
472
+ stroke="currentColor"
473
+ stroke-width="2"
474
+ stroke-linecap="round"
475
+ stroke-linejoin="round"
476
+ />
477
+ </svg>
478
+ )
479
+ }
480
+
392
481
  export function TanstackLogo() {
393
482
  const id = createUniqueId()
394
483
  return (
package/src/theme.ts CHANGED
@@ -96,17 +96,17 @@ export const tokens = {
96
96
  900: '#054F31',
97
97
  },
98
98
  red: {
99
- 25: '#FFFBFA',
100
- 50: '#FEF3F2',
101
- 100: '#FEE4E2',
102
- 200: '#FECDCA',
103
- 300: '#FDA29B',
104
- 400: '#F97066',
105
- 500: '#F04438',
106
- 600: '#D92D20',
107
- 700: '#B42318',
108
- 800: '#912018',
109
- 900: '#7A271A',
99
+ 50: '#fef2f2',
100
+ 100: '#fee2e2',
101
+ 200: '#fecaca',
102
+ 300: '#fca5a5',
103
+ 400: '#f87171',
104
+ 500: '#ef4444',
105
+ 600: '#dc2626',
106
+ 700: '#b91c1c',
107
+ 800: '#991b1b',
108
+ 900: '#7f1d1d',
109
+ 950: '#450a0a',
110
110
  },
111
111
  yellow: {
112
112
  25: '#FFFCF5',
package/src/utils.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import { serialize } from 'superjson'
2
2
  import { createSignal, onCleanup, onMount } from 'solid-js'
3
- import type { Query } from '@tanstack/query-core'
3
+ import type { Mutation, Query } from '@tanstack/query-core'
4
4
  import type { DevtoolsPosition } from './Context'
5
5
 
6
6
  export function getQueryStatusLabel(query: Query) {
@@ -53,6 +53,24 @@ export function getQueryStatusColor({
53
53
  : 'green'
54
54
  }
55
55
 
56
+ export function getMutationStatusColor({
57
+ status,
58
+ isPaused,
59
+ }: {
60
+ status: Mutation['state']['status']
61
+ isPaused: boolean
62
+ }) {
63
+ return isPaused
64
+ ? 'purple'
65
+ : status === 'error'
66
+ ? 'red'
67
+ : status === 'pending'
68
+ ? 'yellow'
69
+ : status === 'success'
70
+ ? 'green'
71
+ : 'gray'
72
+ }
73
+
56
74
  export function getQueryStatusColorByLabel(label: IQueryStatusLabel) {
57
75
  return label === 'fresh'
58
76
  ? 'green'
@@ -107,6 +125,33 @@ export const sortFns: Record<string, SortFn> = {
107
125
  'last updated': dateSort,
108
126
  }
109
127
 
128
+ type MutationSortFn = (a: Mutation, b: Mutation) => number
129
+
130
+ const getMutationStatusRank = (m: Mutation) =>
131
+ m.state.isPaused
132
+ ? 0
133
+ : m.state.status === 'error'
134
+ ? 2
135
+ : m.state.status === 'pending'
136
+ ? 1
137
+ : 3
138
+
139
+ const mutationDateSort: MutationSortFn = (a, b) =>
140
+ a.state.submittedAt < b.state.submittedAt ? 1 : -1
141
+
142
+ const mutationStatusSort: MutationSortFn = (a, b) => {
143
+ if (getMutationStatusRank(a) === getMutationStatusRank(b)) {
144
+ return mutationDateSort(a, b)
145
+ }
146
+
147
+ return getMutationStatusRank(a) > getMutationStatusRank(b) ? 1 : -1
148
+ }
149
+
150
+ export const mutationSortFns: Record<string, MutationSortFn> = {
151
+ status: mutationStatusSort,
152
+ 'last updated': mutationDateSort,
153
+ }
154
+
110
155
  export const convertRemToPixels = (rem: number) => {
111
156
  return rem * parseFloat(getComputedStyle(document.documentElement).fontSize)
112
157
  }