@tanstack/query-devtools 5.0.5 → 5.4.2

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/src/Explorer.tsx CHANGED
@@ -517,8 +517,8 @@ const stylesFactory = (theme: 'light' | 'dark') => {
517
517
  expanderButtonContainer: css`
518
518
  display: flex;
519
519
  align-items: center;
520
- line-height: 1.125rem;
521
- min-height: 1.125rem;
520
+ line-height: ${size[4]};
521
+ min-height: ${size[4]};
522
522
  gap: ${size[2]};
523
523
  `,
524
524
  expanderButton: css`
@@ -526,7 +526,7 @@ const stylesFactory = (theme: 'light' | 'dark') => {
526
526
  color: inherit;
527
527
  font: inherit;
528
528
  outline: inherit;
529
- height: 1rem;
529
+ height: ${size[5]};
530
530
  background: transparent;
531
531
  border: none;
532
532
  padding: 0;
@@ -568,8 +568,8 @@ const stylesFactory = (theme: 'light' | 'dark') => {
568
568
  display: inline-flex;
569
569
  gap: ${size[2]};
570
570
  width: 100%;
571
- margin-bottom: ${size[0.5]};
572
- line-height: 1.125rem;
571
+ margin: ${size[0.25]} 0px;
572
+ line-height: ${size[4.5]};
573
573
  align-items: center;
574
574
  `,
575
575
  editableInput: css`
@@ -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',
@@ -189,35 +189,35 @@ export const tokens = {
189
189
  },
190
190
  font: {
191
191
  size: {
192
- '2xs': '0.625rem',
193
- xs: '0.75rem',
194
- sm: '0.875rem',
195
- md: '1rem',
196
- lg: '1.125rem',
197
- xl: '1.25rem',
198
- '2xl': '1.5rem',
199
- '3xl': '1.875rem',
200
- '4xl': '2.25rem',
201
- '5xl': '3rem',
202
- '6xl': '3.75rem',
203
- '7xl': '4.5rem',
204
- '8xl': '6rem',
205
- '9xl': '8rem',
192
+ '2xs': 'calc(var(--tsqd-font-size) * 0.625)',
193
+ xs: 'calc(var(--tsqd-font-size) * 0.75)',
194
+ sm: 'calc(var(--tsqd-font-size) * 0.875)',
195
+ md: 'var(--tsqd-font-size)',
196
+ lg: 'calc(var(--tsqd-font-size) * 1.125)',
197
+ xl: 'calc(var(--tsqd-font-size) * 1.25)',
198
+ '2xl': 'calc(var(--tsqd-font-size) * 1.5)',
199
+ '3xl': 'calc(var(--tsqd-font-size) * 1.875)',
200
+ '4xl': 'calc(var(--tsqd-font-size) * 2.25)',
201
+ '5xl': 'calc(var(--tsqd-font-size) * 3)',
202
+ '6xl': 'calc(var(--tsqd-font-size) * 3.75)',
203
+ '7xl': 'calc(var(--tsqd-font-size) * 4.5)',
204
+ '8xl': 'calc(var(--tsqd-font-size) * 6)',
205
+ '9xl': 'calc(var(--tsqd-font-size) * 8)',
206
206
  },
207
207
  lineHeight: {
208
- xs: '1rem',
209
- sm: '1.25rem',
210
- md: '1.5rem',
211
- lg: '1.75rem',
212
- xl: '1.75rem',
213
- '2xl': '2rem',
214
- '3xl': '2.25rem',
215
- '4xl': '2.5rem',
216
- '5xl': '1',
217
- '6xl': '1',
218
- '7xl': '1',
219
- '8xl': '1',
220
- '9xl': '1',
208
+ xs: 'calc(var(--tsqd-font-size) * 1)',
209
+ sm: 'calc(var(--tsqd-font-size) * 1.25)',
210
+ md: 'calc(var(--tsqd-font-size) * 1.5)',
211
+ lg: 'calc(var(--tsqd-font-size) * 1.75)',
212
+ xl: 'calc(var(--tsqd-font-size) * 2)',
213
+ '2xl': 'calc(var(--tsqd-font-size) * 2.25)',
214
+ '3xl': 'calc(var(--tsqd-font-size) * 2.5)',
215
+ '4xl': 'calc(var(--tsqd-font-size) * 2.75)',
216
+ '5xl': 'calc(var(--tsqd-font-size) * 3)',
217
+ '6xl': 'calc(var(--tsqd-font-size) * 3.25)',
218
+ '7xl': 'calc(var(--tsqd-font-size) * 3.5)',
219
+ '8xl': 'calc(var(--tsqd-font-size) * 3.75)',
220
+ '9xl': 'calc(var(--tsqd-font-size) * 4)',
221
221
  },
222
222
  weight: {
223
223
  thin: '100',
@@ -242,55 +242,55 @@ export const tokens = {
242
242
  border: {
243
243
  radius: {
244
244
  none: '0px',
245
- xs: '0.125rem',
246
- sm: '0.25rem',
247
- md: '0.375rem',
248
- lg: '0.5rem',
249
- xl: '0.75rem',
250
- '2xl': '1rem',
251
- '3xl': '1.5rem',
245
+ xs: 'calc(var(--tsqd-font-size) * 0.125)',
246
+ sm: 'calc(var(--tsqd-font-size) * 0.25)',
247
+ md: 'calc(var(--tsqd-font-size) * 0.375)',
248
+ lg: 'calc(var(--tsqd-font-size) * 0.5)',
249
+ xl: 'calc(var(--tsqd-font-size) * 0.75)',
250
+ '2xl': 'calc(var(--tsqd-font-size) * 1)',
251
+ '3xl': 'calc(var(--tsqd-font-size) * 1.5)',
252
252
  full: '9999px',
253
253
  },
254
254
  },
255
255
  size: {
256
256
  0: '0px',
257
- 0.25: '0.0625rem',
258
- 0.5: '0.125rem',
259
- 1: '0.25rem',
260
- 1.5: '0.375rem',
261
- 2: '0.5rem',
262
- 2.5: '0.625rem',
263
- 3: '0.75rem',
264
- 3.5: '0.875rem',
265
- 4: '1rem',
266
- 4.5: '1.125rem',
267
- 5: '1.25rem',
268
- 5.5: '1.375rem',
269
- 6: '1.5rem',
270
- 6.5: '1.625rem',
271
- 7: '1.75rem',
272
- 8: '2rem',
273
- 9: '2.25rem',
274
- 10: '2.5rem',
275
- 11: '2.75rem',
276
- 12: '3rem',
277
- 14: '3.5rem',
278
- 16: '4rem',
279
- 20: '5rem',
280
- 24: '6rem',
281
- 28: '7rem',
282
- 32: '8rem',
283
- 36: '9rem',
284
- 40: '10rem',
285
- 44: '11rem',
286
- 48: '12rem',
287
- 52: '13rem',
288
- 56: '14rem',
289
- 60: '15rem',
290
- 64: '16rem',
291
- 72: '18rem',
292
- 80: '20rem',
293
- 96: '24rem',
257
+ 0.25: 'calc(var(--tsqd-font-size) * 0.0625)',
258
+ 0.5: 'calc(var(--tsqd-font-size) * 0.125)',
259
+ 1: 'calc(var(--tsqd-font-size) * 0.25)',
260
+ 1.5: 'calc(var(--tsqd-font-size) * 0.375)',
261
+ 2: 'calc(var(--tsqd-font-size) * 0.5)',
262
+ 2.5: 'calc(var(--tsqd-font-size) * 0.625)',
263
+ 3: 'calc(var(--tsqd-font-size) * 0.75)',
264
+ 3.5: 'calc(var(--tsqd-font-size) * 0.875)',
265
+ 4: 'calc(var(--tsqd-font-size) * 1)',
266
+ 4.5: 'calc(var(--tsqd-font-size) * 1.125)',
267
+ 5: 'calc(var(--tsqd-font-size) * 1.25)',
268
+ 5.5: 'calc(var(--tsqd-font-size) * 1.375)',
269
+ 6: 'calc(var(--tsqd-font-size) * 1.5)',
270
+ 6.5: 'calc(var(--tsqd-font-size) * 1.625)',
271
+ 7: 'calc(var(--tsqd-font-size) * 1.75)',
272
+ 8: 'calc(var(--tsqd-font-size) * 2)',
273
+ 9: 'calc(var(--tsqd-font-size) * 2.25)',
274
+ 10: 'calc(var(--tsqd-font-size) * 2.5)',
275
+ 11: 'calc(var(--tsqd-font-size) * 2.75)',
276
+ 12: 'calc(var(--tsqd-font-size) * 3)',
277
+ 14: 'calc(var(--tsqd-font-size) * 3.5)',
278
+ 16: 'calc(var(--tsqd-font-size) * 4)',
279
+ 20: 'calc(var(--tsqd-font-size) * 5)',
280
+ 24: 'calc(var(--tsqd-font-size) * 6)',
281
+ 28: 'calc(var(--tsqd-font-size) * 7)',
282
+ 32: 'calc(var(--tsqd-font-size) * 8)',
283
+ 36: 'calc(var(--tsqd-font-size) * 9)',
284
+ 40: 'calc(var(--tsqd-font-size) * 10)',
285
+ 44: 'calc(var(--tsqd-font-size) * 11)',
286
+ 48: 'calc(var(--tsqd-font-size) * 12)',
287
+ 52: 'calc(var(--tsqd-font-size) * 13)',
288
+ 56: 'calc(var(--tsqd-font-size) * 14)',
289
+ 60: 'calc(var(--tsqd-font-size) * 15)',
290
+ 64: 'calc(var(--tsqd-font-size) * 16)',
291
+ 72: 'calc(var(--tsqd-font-size) * 18)',
292
+ 80: 'calc(var(--tsqd-font-size) * 20)',
293
+ 96: 'calc(var(--tsqd-font-size) * 24)',
294
294
  },
295
295
  shadow: Shadow,
296
296
  zIndices: {
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
  }