@tanstack/react-query-devtools 5.0.0-alpha.2 → 5.0.0-alpha.21

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.
Files changed (88) hide show
  1. package/build/lib/CachePanel/ActiveQuery.d.ts +18 -0
  2. package/build/lib/CachePanel/ActiveQuery.esm.js +271 -0
  3. package/build/lib/CachePanel/ActiveQuery.esm.js.map +1 -0
  4. package/build/lib/CachePanel/ActiveQuery.js +275 -0
  5. package/build/lib/CachePanel/ActiveQuery.js.map +1 -0
  6. package/build/lib/CachePanel/ActiveQuery.mjs +257 -0
  7. package/build/lib/CachePanel/ActiveQuery.mjs.map +1 -0
  8. package/build/lib/CachePanel/CachePanel.d.ts +57 -0
  9. package/build/lib/CachePanel/CachePanel.esm.js +310 -0
  10. package/build/lib/CachePanel/CachePanel.esm.js.map +1 -0
  11. package/build/lib/CachePanel/CachePanel.js +315 -0
  12. package/build/lib/CachePanel/CachePanel.js.map +1 -0
  13. package/build/lib/CachePanel/CachePanel.mjs +310 -0
  14. package/build/lib/CachePanel/CachePanel.mjs.map +1 -0
  15. package/build/lib/CachePanel/Header/QueryStatusCount.d.ts +7 -0
  16. package/build/lib/CachePanel/Header/QueryStatusCount.esm.js +49 -0
  17. package/build/lib/CachePanel/Header/QueryStatusCount.esm.js.map +1 -0
  18. package/build/lib/CachePanel/Header/QueryStatusCount.js +53 -0
  19. package/build/lib/CachePanel/Header/QueryStatusCount.js.map +1 -0
  20. package/build/lib/CachePanel/Header/QueryStatusCount.mjs +49 -0
  21. package/build/lib/CachePanel/Header/QueryStatusCount.mjs.map +1 -0
  22. package/build/lib/CachePanel/QueryRow.d.ts +13 -0
  23. package/build/lib/CachePanel/QueryRow.esm.js +98 -0
  24. package/build/lib/CachePanel/QueryRow.esm.js.map +1 -0
  25. package/build/lib/CachePanel/QueryRow.js +102 -0
  26. package/build/lib/CachePanel/QueryRow.js.map +1 -0
  27. package/build/lib/CachePanel/QueryRow.mjs +82 -0
  28. package/build/lib/CachePanel/QueryRow.mjs.map +1 -0
  29. package/build/lib/Explorer.esm.js +2 -1
  30. package/build/lib/Explorer.esm.js.map +1 -1
  31. package/build/lib/Explorer.js +2 -1
  32. package/build/lib/Explorer.js.map +1 -1
  33. package/build/lib/Explorer.mjs +1 -0
  34. package/build/lib/Explorer.mjs.map +1 -1
  35. package/build/lib/devtools.d.ts +5 -48
  36. package/build/lib/devtools.esm.js +11 -550
  37. package/build/lib/devtools.esm.js.map +1 -1
  38. package/build/lib/devtools.js +12 -551
  39. package/build/lib/devtools.js.map +1 -1
  40. package/build/lib/devtools.mjs +7 -547
  41. package/build/lib/devtools.mjs.map +1 -1
  42. package/build/lib/index.esm.js +3 -1
  43. package/build/lib/index.esm.js.map +1 -1
  44. package/build/lib/index.js +3 -1
  45. package/build/lib/index.js.map +1 -1
  46. package/build/lib/index.mjs +3 -1
  47. package/build/lib/index.mjs.map +1 -1
  48. package/build/lib/index.prod.esm.js +821 -651
  49. package/build/lib/index.prod.esm.js.map +1 -1
  50. package/build/lib/index.prod.js +819 -650
  51. package/build/lib/index.prod.js.map +1 -1
  52. package/build/lib/index.prod.mjs +764 -625
  53. package/build/lib/index.prod.mjs.map +1 -1
  54. package/build/lib/styledComponents.d.ts +0 -1
  55. package/build/lib/styledComponents.esm.js +11 -1
  56. package/build/lib/styledComponents.esm.js.map +1 -1
  57. package/build/lib/styledComponents.js +11 -1
  58. package/build/lib/styledComponents.js.map +1 -1
  59. package/build/lib/styledComponents.mjs +11 -1
  60. package/build/lib/styledComponents.mjs.map +1 -1
  61. package/build/lib/theme.esm.js +1 -0
  62. package/build/lib/theme.esm.js.map +1 -1
  63. package/build/lib/theme.js +1 -0
  64. package/build/lib/theme.js.map +1 -1
  65. package/build/lib/theme.mjs +1 -0
  66. package/build/lib/theme.mjs.map +1 -1
  67. package/build/lib/types.d.ts +11 -0
  68. package/build/lib/useSubscribeToQueryCache.d.ts +3 -0
  69. package/build/lib/useSubscribeToQueryCache.esm.js +15 -0
  70. package/build/lib/useSubscribeToQueryCache.esm.js.map +1 -0
  71. package/build/lib/useSubscribeToQueryCache.js +19 -0
  72. package/build/lib/useSubscribeToQueryCache.js.map +1 -0
  73. package/build/lib/useSubscribeToQueryCache.mjs +15 -0
  74. package/build/lib/useSubscribeToQueryCache.mjs.map +1 -0
  75. package/build/umd/index.development.js +1667 -1529
  76. package/build/umd/index.development.js.map +1 -1
  77. package/build/umd/index.production.js.map +1 -1
  78. package/package.json +4 -4
  79. package/src/CachePanel/ActiveQuery.tsx +380 -0
  80. package/src/CachePanel/CachePanel.tsx +439 -0
  81. package/src/CachePanel/Header/QueryStatusCount.tsx +93 -0
  82. package/src/CachePanel/QueryRow.tsx +125 -0
  83. package/src/__tests__/Explorer.test.tsx +3 -2
  84. package/src/__tests__/devtools.test.tsx +229 -9
  85. package/src/devtools.tsx +10 -865
  86. package/src/styledComponents.ts +19 -1
  87. package/src/types.ts +12 -0
  88. package/src/useSubscribeToQueryCache.ts +26 -0
@@ -38,704 +38,6 @@
38
38
  return _extends.apply(this, arguments);
39
39
  }
40
40
 
41
- /**
42
- * match-sorter-utils
43
- *
44
- * Copyright (c) TanStack
45
- *
46
- * This source code is licensed under the MIT license found in the
47
- * LICENSE.md file in the root directory of this source tree.
48
- *
49
- * @license MIT
50
- */
51
- const characterMap = {
52
- À: 'A',
53
- Á: 'A',
54
- Â: 'A',
55
- Ã: 'A',
56
- Ä: 'A',
57
- Å: 'A',
58
- Ấ: 'A',
59
- Ắ: 'A',
60
- Ẳ: 'A',
61
- Ẵ: 'A',
62
- Ặ: 'A',
63
- Æ: 'AE',
64
- Ầ: 'A',
65
- Ằ: 'A',
66
- Ȃ: 'A',
67
- Ç: 'C',
68
- Ḉ: 'C',
69
- È: 'E',
70
- É: 'E',
71
- Ê: 'E',
72
- Ë: 'E',
73
- Ế: 'E',
74
- Ḗ: 'E',
75
- Ề: 'E',
76
- Ḕ: 'E',
77
- Ḝ: 'E',
78
- Ȇ: 'E',
79
- Ì: 'I',
80
- Í: 'I',
81
- Î: 'I',
82
- Ï: 'I',
83
- Ḯ: 'I',
84
- Ȋ: 'I',
85
- Ð: 'D',
86
- Ñ: 'N',
87
- Ò: 'O',
88
- Ó: 'O',
89
- Ô: 'O',
90
- Õ: 'O',
91
- Ö: 'O',
92
- Ø: 'O',
93
- Ố: 'O',
94
- Ṍ: 'O',
95
- Ṓ: 'O',
96
- Ȏ: 'O',
97
- Ù: 'U',
98
- Ú: 'U',
99
- Û: 'U',
100
- Ü: 'U',
101
- Ý: 'Y',
102
- à: 'a',
103
- á: 'a',
104
- â: 'a',
105
- ã: 'a',
106
- ä: 'a',
107
- å: 'a',
108
- ấ: 'a',
109
- ắ: 'a',
110
- ẳ: 'a',
111
- ẵ: 'a',
112
- ặ: 'a',
113
- æ: 'ae',
114
- ầ: 'a',
115
- ằ: 'a',
116
- ȃ: 'a',
117
- ç: 'c',
118
- ḉ: 'c',
119
- è: 'e',
120
- é: 'e',
121
- ê: 'e',
122
- ë: 'e',
123
- ế: 'e',
124
- ḗ: 'e',
125
- ề: 'e',
126
- ḕ: 'e',
127
- ḝ: 'e',
128
- ȇ: 'e',
129
- ì: 'i',
130
- í: 'i',
131
- î: 'i',
132
- ï: 'i',
133
- ḯ: 'i',
134
- ȋ: 'i',
135
- ð: 'd',
136
- ñ: 'n',
137
- ò: 'o',
138
- ó: 'o',
139
- ô: 'o',
140
- õ: 'o',
141
- ö: 'o',
142
- ø: 'o',
143
- ố: 'o',
144
- ṍ: 'o',
145
- ṓ: 'o',
146
- ȏ: 'o',
147
- ù: 'u',
148
- ú: 'u',
149
- û: 'u',
150
- ü: 'u',
151
- ý: 'y',
152
- ÿ: 'y',
153
- Ā: 'A',
154
- ā: 'a',
155
- Ă: 'A',
156
- ă: 'a',
157
- Ą: 'A',
158
- ą: 'a',
159
- Ć: 'C',
160
- ć: 'c',
161
- Ĉ: 'C',
162
- ĉ: 'c',
163
- Ċ: 'C',
164
- ċ: 'c',
165
- Č: 'C',
166
- č: 'c',
167
- C̆: 'C',
168
- c̆: 'c',
169
- Ď: 'D',
170
- ď: 'd',
171
- Đ: 'D',
172
- đ: 'd',
173
- Ē: 'E',
174
- ē: 'e',
175
- Ĕ: 'E',
176
- ĕ: 'e',
177
- Ė: 'E',
178
- ė: 'e',
179
- Ę: 'E',
180
- ę: 'e',
181
- Ě: 'E',
182
- ě: 'e',
183
- Ĝ: 'G',
184
- Ǵ: 'G',
185
- ĝ: 'g',
186
- ǵ: 'g',
187
- Ğ: 'G',
188
- ğ: 'g',
189
- Ġ: 'G',
190
- ġ: 'g',
191
- Ģ: 'G',
192
- ģ: 'g',
193
- Ĥ: 'H',
194
- ĥ: 'h',
195
- Ħ: 'H',
196
- ħ: 'h',
197
- Ḫ: 'H',
198
- ḫ: 'h',
199
- Ĩ: 'I',
200
- ĩ: 'i',
201
- Ī: 'I',
202
- ī: 'i',
203
- Ĭ: 'I',
204
- ĭ: 'i',
205
- Į: 'I',
206
- į: 'i',
207
- İ: 'I',
208
- ı: 'i',
209
- IJ: 'IJ',
210
- ij: 'ij',
211
- Ĵ: 'J',
212
- ĵ: 'j',
213
- Ķ: 'K',
214
- ķ: 'k',
215
- Ḱ: 'K',
216
- ḱ: 'k',
217
- K̆: 'K',
218
- k̆: 'k',
219
- Ĺ: 'L',
220
- ĺ: 'l',
221
- Ļ: 'L',
222
- ļ: 'l',
223
- Ľ: 'L',
224
- ľ: 'l',
225
- Ŀ: 'L',
226
- ŀ: 'l',
227
- Ł: 'l',
228
- ł: 'l',
229
- Ḿ: 'M',
230
- ḿ: 'm',
231
- M̆: 'M',
232
- m̆: 'm',
233
- Ń: 'N',
234
- ń: 'n',
235
- Ņ: 'N',
236
- ņ: 'n',
237
- Ň: 'N',
238
- ň: 'n',
239
- ʼn: 'n',
240
- N̆: 'N',
241
- n̆: 'n',
242
- Ō: 'O',
243
- ō: 'o',
244
- Ŏ: 'O',
245
- ŏ: 'o',
246
- Ő: 'O',
247
- ő: 'o',
248
- Œ: 'OE',
249
- œ: 'oe',
250
- P̆: 'P',
251
- p̆: 'p',
252
- Ŕ: 'R',
253
- ŕ: 'r',
254
- Ŗ: 'R',
255
- ŗ: 'r',
256
- Ř: 'R',
257
- ř: 'r',
258
- R̆: 'R',
259
- r̆: 'r',
260
- Ȓ: 'R',
261
- ȓ: 'r',
262
- Ś: 'S',
263
- ś: 's',
264
- Ŝ: 'S',
265
- ŝ: 's',
266
- Ş: 'S',
267
- Ș: 'S',
268
- ș: 's',
269
- ş: 's',
270
- Š: 'S',
271
- š: 's',
272
- Ţ: 'T',
273
- ţ: 't',
274
- ț: 't',
275
- Ț: 'T',
276
- Ť: 'T',
277
- ť: 't',
278
- Ŧ: 'T',
279
- ŧ: 't',
280
- T̆: 'T',
281
- t̆: 't',
282
- Ũ: 'U',
283
- ũ: 'u',
284
- Ū: 'U',
285
- ū: 'u',
286
- Ŭ: 'U',
287
- ŭ: 'u',
288
- Ů: 'U',
289
- ů: 'u',
290
- Ű: 'U',
291
- ű: 'u',
292
- Ų: 'U',
293
- ų: 'u',
294
- Ȗ: 'U',
295
- ȗ: 'u',
296
- V̆: 'V',
297
- v̆: 'v',
298
- Ŵ: 'W',
299
- ŵ: 'w',
300
- Ẃ: 'W',
301
- ẃ: 'w',
302
- X̆: 'X',
303
- x̆: 'x',
304
- Ŷ: 'Y',
305
- ŷ: 'y',
306
- Ÿ: 'Y',
307
- Y̆: 'Y',
308
- y̆: 'y',
309
- Ź: 'Z',
310
- ź: 'z',
311
- Ż: 'Z',
312
- ż: 'z',
313
- Ž: 'Z',
314
- ž: 'z',
315
- ſ: 's',
316
- ƒ: 'f',
317
- Ơ: 'O',
318
- ơ: 'o',
319
- Ư: 'U',
320
- ư: 'u',
321
- Ǎ: 'A',
322
- ǎ: 'a',
323
- Ǐ: 'I',
324
- ǐ: 'i',
325
- Ǒ: 'O',
326
- ǒ: 'o',
327
- Ǔ: 'U',
328
- ǔ: 'u',
329
- Ǖ: 'U',
330
- ǖ: 'u',
331
- Ǘ: 'U',
332
- ǘ: 'u',
333
- Ǚ: 'U',
334
- ǚ: 'u',
335
- Ǜ: 'U',
336
- ǜ: 'u',
337
- Ứ: 'U',
338
- ứ: 'u',
339
- Ṹ: 'U',
340
- ṹ: 'u',
341
- Ǻ: 'A',
342
- ǻ: 'a',
343
- Ǽ: 'AE',
344
- ǽ: 'ae',
345
- Ǿ: 'O',
346
- ǿ: 'o',
347
- Þ: 'TH',
348
- þ: 'th',
349
- Ṕ: 'P',
350
- ṕ: 'p',
351
- Ṥ: 'S',
352
- ṥ: 's',
353
- X́: 'X',
354
- x́: 'x',
355
- Ѓ: 'Г',
356
- ѓ: 'г',
357
- Ќ: 'К',
358
- ќ: 'к',
359
- A̋: 'A',
360
- a̋: 'a',
361
- E̋: 'E',
362
- e̋: 'e',
363
- I̋: 'I',
364
- i̋: 'i',
365
- Ǹ: 'N',
366
- ǹ: 'n',
367
- Ồ: 'O',
368
- ồ: 'o',
369
- Ṑ: 'O',
370
- ṑ: 'o',
371
- Ừ: 'U',
372
- ừ: 'u',
373
- Ẁ: 'W',
374
- ẁ: 'w',
375
- Ỳ: 'Y',
376
- ỳ: 'y',
377
- Ȁ: 'A',
378
- ȁ: 'a',
379
- Ȅ: 'E',
380
- ȅ: 'e',
381
- Ȉ: 'I',
382
- ȉ: 'i',
383
- Ȍ: 'O',
384
- ȍ: 'o',
385
- Ȑ: 'R',
386
- ȑ: 'r',
387
- Ȕ: 'U',
388
- ȕ: 'u',
389
- B̌: 'B',
390
- b̌: 'b',
391
- Č̣: 'C',
392
- č̣: 'c',
393
- Ê̌: 'E',
394
- ê̌: 'e',
395
- F̌: 'F',
396
- f̌: 'f',
397
- Ǧ: 'G',
398
- ǧ: 'g',
399
- Ȟ: 'H',
400
- ȟ: 'h',
401
- J̌: 'J',
402
- ǰ: 'j',
403
- Ǩ: 'K',
404
- ǩ: 'k',
405
- M̌: 'M',
406
- m̌: 'm',
407
- P̌: 'P',
408
- p̌: 'p',
409
- Q̌: 'Q',
410
- q̌: 'q',
411
- Ř̩: 'R',
412
- ř̩: 'r',
413
- Ṧ: 'S',
414
- ṧ: 's',
415
- V̌: 'V',
416
- v̌: 'v',
417
- W̌: 'W',
418
- w̌: 'w',
419
- X̌: 'X',
420
- x̌: 'x',
421
- Y̌: 'Y',
422
- y̌: 'y',
423
- A̧: 'A',
424
- a̧: 'a',
425
- B̧: 'B',
426
- b̧: 'b',
427
- Ḑ: 'D',
428
- ḑ: 'd',
429
- Ȩ: 'E',
430
- ȩ: 'e',
431
- Ɛ̧: 'E',
432
- ɛ̧: 'e',
433
- Ḩ: 'H',
434
- ḩ: 'h',
435
- I̧: 'I',
436
- i̧: 'i',
437
- Ɨ̧: 'I',
438
- ɨ̧: 'i',
439
- M̧: 'M',
440
- m̧: 'm',
441
- O̧: 'O',
442
- o̧: 'o',
443
- Q̧: 'Q',
444
- q̧: 'q',
445
- U̧: 'U',
446
- u̧: 'u',
447
- X̧: 'X',
448
- x̧: 'x',
449
- Z̧: 'Z',
450
- z̧: 'z'
451
- };
452
- const chars = Object.keys(characterMap).join('|');
453
- const allAccents = new RegExp(chars, 'g');
454
- function removeAccents(str) {
455
- return str.replace(allAccents, match => {
456
- return characterMap[match];
457
- });
458
- }
459
-
460
- /**
461
- * @name match-sorter
462
- * @license MIT license.
463
- * @copyright (c) 2099 Kent C. Dodds
464
- * @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
465
- */
466
- const rankings = {
467
- CASE_SENSITIVE_EQUAL: 7,
468
- EQUAL: 6,
469
- STARTS_WITH: 5,
470
- WORD_STARTS_WITH: 4,
471
- CONTAINS: 3,
472
- ACRONYM: 2,
473
- MATCHES: 1,
474
- NO_MATCH: 0
475
- };
476
- /**
477
- * Gets the highest ranking for value for the given item based on its values for the given keys
478
- * @param {*} item - the item to rank
479
- * @param {Array} keys - the keys to get values from the item for the ranking
480
- * @param {String} value - the value to rank against
481
- * @param {Object} options - options to control the ranking
482
- * @return {{rank: Number, accessorIndex: Number, accessorThreshold: Number}} - the highest ranking
483
- */
484
- function rankItem(item, value, options) {
485
- var _options$threshold;
486
- options = options || {};
487
- options.threshold = (_options$threshold = options.threshold) != null ? _options$threshold : rankings.MATCHES;
488
- if (!options.accessors) {
489
- // if keys is not specified, then we assume the item given is ready to be matched
490
- const rank = getMatchRanking(item, value, options);
491
- return {
492
- // ends up being duplicate of 'item' in matches but consistent
493
- rankedValue: item,
494
- rank,
495
- accessorIndex: -1,
496
- accessorThreshold: options.threshold,
497
- passed: rank >= options.threshold
498
- };
499
- }
500
- const valuesToRank = getAllValuesToRank(item, options.accessors);
501
- const rankingInfo = {
502
- rankedValue: item,
503
- rank: rankings.NO_MATCH,
504
- accessorIndex: -1,
505
- accessorThreshold: options.threshold,
506
- passed: false
507
- };
508
- for (let i = 0; i < valuesToRank.length; i++) {
509
- const rankValue = valuesToRank[i];
510
- let newRank = getMatchRanking(rankValue.itemValue, value, options);
511
- const {
512
- minRanking,
513
- maxRanking,
514
- threshold = options.threshold
515
- } = rankValue.attributes;
516
- if (newRank < minRanking && newRank >= rankings.MATCHES) {
517
- newRank = minRanking;
518
- } else if (newRank > maxRanking) {
519
- newRank = maxRanking;
520
- }
521
- newRank = Math.min(newRank, maxRanking);
522
- if (newRank >= threshold && newRank > rankingInfo.rank) {
523
- rankingInfo.rank = newRank;
524
- rankingInfo.passed = true;
525
- rankingInfo.accessorIndex = i;
526
- rankingInfo.accessorThreshold = threshold;
527
- rankingInfo.rankedValue = rankValue.itemValue;
528
- }
529
- }
530
- return rankingInfo;
531
- }
532
-
533
- /**
534
- * Gives a rankings score based on how well the two strings match.
535
- * @param {String} testString - the string to test against
536
- * @param {String} stringToRank - the string to rank
537
- * @param {Object} options - options for the match (like keepDiacritics for comparison)
538
- * @returns {Number} the ranking for how well stringToRank matches testString
539
- */
540
- function getMatchRanking(testString, stringToRank, options) {
541
- testString = prepareValueForComparison(testString, options);
542
- stringToRank = prepareValueForComparison(stringToRank, options);
543
-
544
- // too long
545
- if (stringToRank.length > testString.length) {
546
- return rankings.NO_MATCH;
547
- }
548
-
549
- // case sensitive equals
550
- if (testString === stringToRank) {
551
- return rankings.CASE_SENSITIVE_EQUAL;
552
- }
553
-
554
- // Lower casing before further comparison
555
- testString = testString.toLowerCase();
556
- stringToRank = stringToRank.toLowerCase();
557
-
558
- // case insensitive equals
559
- if (testString === stringToRank) {
560
- return rankings.EQUAL;
561
- }
562
-
563
- // starts with
564
- if (testString.startsWith(stringToRank)) {
565
- return rankings.STARTS_WITH;
566
- }
567
-
568
- // word starts with
569
- if (testString.includes(` ${stringToRank}`)) {
570
- return rankings.WORD_STARTS_WITH;
571
- }
572
-
573
- // contains
574
- if (testString.includes(stringToRank)) {
575
- return rankings.CONTAINS;
576
- } else if (stringToRank.length === 1) {
577
- // If the only character in the given stringToRank
578
- // isn't even contained in the testString, then
579
- // it's definitely not a match.
580
- return rankings.NO_MATCH;
581
- }
582
-
583
- // acronym
584
- if (getAcronym(testString).includes(stringToRank)) {
585
- return rankings.ACRONYM;
586
- }
587
-
588
- // will return a number between rankings.MATCHES and
589
- // rankings.MATCHES + 1 depending on how close of a match it is.
590
- return getClosenessRanking(testString, stringToRank);
591
- }
592
-
593
- /**
594
- * Generates an acronym for a string.
595
- *
596
- * @param {String} string the string for which to produce the acronym
597
- * @returns {String} the acronym
598
- */
599
- function getAcronym(string) {
600
- let acronym = '';
601
- const wordsInString = string.split(' ');
602
- wordsInString.forEach(wordInString => {
603
- const splitByHyphenWords = wordInString.split('-');
604
- splitByHyphenWords.forEach(splitByHyphenWord => {
605
- acronym += splitByHyphenWord.substr(0, 1);
606
- });
607
- });
608
- return acronym;
609
- }
610
-
611
- /**
612
- * Returns a score based on how spread apart the
613
- * characters from the stringToRank are within the testString.
614
- * A number close to rankings.MATCHES represents a loose match. A number close
615
- * to rankings.MATCHES + 1 represents a tighter match.
616
- * @param {String} testString - the string to test against
617
- * @param {String} stringToRank - the string to rank
618
- * @returns {Number} the number between rankings.MATCHES and
619
- * rankings.MATCHES + 1 for how well stringToRank matches testString
620
- */
621
- function getClosenessRanking(testString, stringToRank) {
622
- let matchingInOrderCharCount = 0;
623
- let charNumber = 0;
624
- function findMatchingCharacter(matchChar, string, index) {
625
- for (let j = index, J = string.length; j < J; j++) {
626
- const stringChar = string[j];
627
- if (stringChar === matchChar) {
628
- matchingInOrderCharCount += 1;
629
- return j + 1;
630
- }
631
- }
632
- return -1;
633
- }
634
- function getRanking(spread) {
635
- const spreadPercentage = 1 / spread;
636
- const inOrderPercentage = matchingInOrderCharCount / stringToRank.length;
637
- const ranking = rankings.MATCHES + inOrderPercentage * spreadPercentage;
638
- return ranking;
639
- }
640
- const firstIndex = findMatchingCharacter(stringToRank[0], testString, 0);
641
- if (firstIndex < 0) {
642
- return rankings.NO_MATCH;
643
- }
644
- charNumber = firstIndex;
645
- for (let i = 1, I = stringToRank.length; i < I; i++) {
646
- const matchChar = stringToRank[i];
647
- charNumber = findMatchingCharacter(matchChar, testString, charNumber);
648
- const found = charNumber > -1;
649
- if (!found) {
650
- return rankings.NO_MATCH;
651
- }
652
- }
653
- const spread = charNumber - firstIndex;
654
- return getRanking(spread);
655
- }
656
-
657
- /**
658
- * Prepares value for comparison by stringifying it, removing diacritics (if specified)
659
- * @param {String} value - the value to clean
660
- * @param {Object} options - {keepDiacritics: whether to remove diacritics}
661
- * @return {String} the prepared value
662
- */
663
- function prepareValueForComparison(value, _ref) {
664
- let {
665
- keepDiacritics
666
- } = _ref;
667
- // value might not actually be a string at this point (we don't get to choose)
668
- // so part of preparing the value for comparison is ensure that it is a string
669
- value = `${value}`; // toString
670
- if (!keepDiacritics) {
671
- value = removeAccents(value);
672
- }
673
- return value;
674
- }
675
-
676
- /**
677
- * Gets value for key in item at arbitrarily nested keypath
678
- * @param {Object} item - the item
679
- * @param {Object|Function} key - the potentially nested keypath or property callback
680
- * @return {Array} - an array containing the value(s) at the nested keypath
681
- */
682
- function getItemValues(item, accessor) {
683
- let accessorFn = accessor;
684
- if (typeof accessor === 'object') {
685
- accessorFn = accessor.accessor;
686
- }
687
- const value = accessorFn(item);
688
-
689
- // because `value` can also be undefined
690
- if (value == null) {
691
- return [];
692
- }
693
- if (Array.isArray(value)) {
694
- return value;
695
- }
696
- return [String(value)];
697
- }
698
-
699
- /**
700
- * Gets all the values for the given keys in the given item and returns an array of those values
701
- * @param item - the item from which the values will be retrieved
702
- * @param keys - the keys to use to retrieve the values
703
- * @return objects with {itemValue, attributes}
704
- */
705
- function getAllValuesToRank(item, accessors) {
706
- const allValues = [];
707
- for (let j = 0, J = accessors.length; j < J; j++) {
708
- const accessor = accessors[j];
709
- const attributes = getAccessorAttributes(accessor);
710
- const itemValues = getItemValues(item, accessor);
711
- for (let i = 0, I = itemValues.length; i < I; i++) {
712
- allValues.push({
713
- itemValue: itemValues[i],
714
- attributes
715
- });
716
- }
717
- }
718
- return allValues;
719
- }
720
- const defaultKeyAttributes = {
721
- maxRanking: Infinity,
722
- minRanking: -Infinity
723
- };
724
- /**
725
- * Gets all the attributes for the given accessor
726
- * @param accessor - the accessor from which the attributes will be retrieved
727
- * @return object containing the accessor's attributes
728
- */
729
- function getAccessorAttributes(accessor) {
730
- if (typeof accessor === 'function') {
731
- return defaultKeyAttributes;
732
- }
733
- return {
734
- ...defaultKeyAttributes,
735
- ...accessor
736
- };
737
- }
738
-
739
41
  const getItem = key => {
740
42
  try {
741
43
  const itemValue = localStorage.getItem(key);
@@ -1656,302 +958,1040 @@
1656
958
  }, {});
1657
959
  }
1658
960
 
1659
- var __assign = (undefined && undefined.__assign) || function () {
1660
- __assign = Object.assign || function(t) {
1661
- for (var s, i = 1, n = arguments.length; i < n; i++) {
1662
- s = arguments[i];
1663
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
1664
- t[p] = s[p];
1665
- }
1666
- return t;
1667
- };
1668
- return __assign.apply(this, arguments);
1669
- };
1670
- var serialize = function (object) {
1671
- var identities = new Map();
1672
- var output = walker(object, identities);
1673
- var res = {
1674
- json: output.transformedValue
1675
- };
1676
- if (output.annotations) {
1677
- res.meta = __assign(__assign({}, res.meta), { values: output.annotations });
1678
- }
1679
- var equalityAnnotations = generateReferentialEqualityAnnotations(identities);
1680
- if (equalityAnnotations) {
1681
- res.meta = __assign(__assign({}, res.meta), { referentialEqualities: equalityAnnotations });
1682
- }
1683
- return res;
1684
- };
1685
- var deserialize = function (payload) {
1686
- var json = payload.json, meta = payload.meta;
1687
- var result = copy(json);
1688
- if (meta === null || meta === void 0 ? void 0 : meta.values) {
1689
- result = applyValueAnnotations(result, meta.values);
1690
- }
1691
- if (meta === null || meta === void 0 ? void 0 : meta.referentialEqualities) {
1692
- result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
1693
- }
1694
- return result;
1695
- };
1696
- var stringify = function (object) {
1697
- return JSON.stringify(serialize(object));
1698
- };
1699
- var parse = function (string) {
1700
- return deserialize(JSON.parse(string));
1701
- };
1702
- var registerClass = function (v, options) {
1703
- return ClassRegistry.register(v, options);
961
+ var __assign = (undefined && undefined.__assign) || function () {
962
+ __assign = Object.assign || function(t) {
963
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
964
+ s = arguments[i];
965
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
966
+ t[p] = s[p];
967
+ }
968
+ return t;
969
+ };
970
+ return __assign.apply(this, arguments);
971
+ };
972
+ var serialize = function (object) {
973
+ var identities = new Map();
974
+ var output = walker(object, identities);
975
+ var res = {
976
+ json: output.transformedValue
977
+ };
978
+ if (output.annotations) {
979
+ res.meta = __assign(__assign({}, res.meta), { values: output.annotations });
980
+ }
981
+ var equalityAnnotations = generateReferentialEqualityAnnotations(identities);
982
+ if (equalityAnnotations) {
983
+ res.meta = __assign(__assign({}, res.meta), { referentialEqualities: equalityAnnotations });
984
+ }
985
+ return res;
986
+ };
987
+ var deserialize = function (payload) {
988
+ var json = payload.json, meta = payload.meta;
989
+ var result = copy(json);
990
+ if (meta === null || meta === void 0 ? void 0 : meta.values) {
991
+ result = applyValueAnnotations(result, meta.values);
992
+ }
993
+ if (meta === null || meta === void 0 ? void 0 : meta.referentialEqualities) {
994
+ result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
995
+ }
996
+ return result;
997
+ };
998
+ var stringify = function (object) {
999
+ return JSON.stringify(serialize(object));
1000
+ };
1001
+ var parse = function (string) {
1002
+ return deserialize(JSON.parse(string));
1003
+ };
1004
+ var registerClass = function (v, options) {
1005
+ return ClassRegistry.register(v, options);
1006
+ };
1007
+ var registerSymbol = function (v, identifier) {
1008
+ return SymbolRegistry.register(v, identifier);
1009
+ };
1010
+ var registerCustom = function (transformer, name) {
1011
+ return CustomTransformerRegistry.register(__assign({ name: name }, transformer));
1012
+ };
1013
+ var superjson = {
1014
+ stringify: stringify,
1015
+ parse: parse,
1016
+ serialize: serialize,
1017
+ deserialize: deserialize,
1018
+ registerClass: registerClass,
1019
+ registerSymbol: registerSymbol,
1020
+ registerCustom: registerCustom,
1021
+ allowErrorProps: allowErrorProps
1022
+ };
1023
+
1024
+ const defaultTheme = {
1025
+ background: '#0b1521',
1026
+ backgroundAlt: '#132337',
1027
+ foreground: 'white',
1028
+ gray: '#3f4e60',
1029
+ grayAlt: '#222e3e',
1030
+ inputBackgroundColor: '#fff',
1031
+ inputTextColor: '#000',
1032
+ success: '#00ab52',
1033
+ danger: '#ff0085',
1034
+ active: '#006bff',
1035
+ paused: '#8c49eb',
1036
+ warning: '#ffb200'
1037
+ };
1038
+ const ThemeContext = /*#__PURE__*/React__namespace.createContext(defaultTheme);
1039
+ function ThemeProvider({
1040
+ theme,
1041
+ ...rest
1042
+ }) {
1043
+ return /*#__PURE__*/React__namespace.createElement(ThemeContext.Provider, _extends({
1044
+ value: theme
1045
+ }, rest));
1046
+ }
1047
+ function useTheme() {
1048
+ return React__namespace.useContext(ThemeContext);
1049
+ }
1050
+
1051
+ function useMediaQuery(query) {
1052
+ // Keep track of the preference in state, start with the current match
1053
+ const [isMatch, setIsMatch] = React__namespace.useState(() => {
1054
+ if (typeof window !== 'undefined') {
1055
+ return window.matchMedia(query).matches;
1056
+ }
1057
+ return;
1058
+ });
1059
+
1060
+ // Watch for changes
1061
+ React__namespace.useEffect(() => {
1062
+ if (typeof window !== 'undefined') {
1063
+ // Create a matcher
1064
+ const matcher = window.matchMedia(query);
1065
+
1066
+ // Create our handler
1067
+ const onChange = ({
1068
+ matches
1069
+ }) => setIsMatch(matches);
1070
+
1071
+ // Listen for changes
1072
+ matcher.addListener(onChange);
1073
+ return () => {
1074
+ // Stop listening for changes
1075
+ matcher.removeListener(onChange);
1076
+ };
1077
+ }
1078
+ return;
1079
+ }, [isMatch, query, setIsMatch]);
1080
+ return isMatch;
1081
+ }
1082
+
1083
+ function getQueryStatusColor({
1084
+ queryState,
1085
+ observerCount,
1086
+ isStale,
1087
+ theme
1088
+ }) {
1089
+ return queryState.fetchStatus === 'fetching' ? theme.active : !observerCount ? theme.gray : queryState.fetchStatus === 'paused' ? theme.paused : isStale ? theme.warning : theme.success;
1090
+ }
1091
+ function getQueryStatusLabel(query) {
1092
+ return query.state.fetchStatus === 'fetching' ? 'fetching' : !query.getObserversCount() ? 'inactive' : query.state.fetchStatus === 'paused' ? 'paused' : query.isStale() ? 'stale' : 'fresh';
1093
+ }
1094
+ function styled(type, newStyles, queries = {}) {
1095
+ return /*#__PURE__*/React__namespace.forwardRef(({
1096
+ style,
1097
+ ...rest
1098
+ }, ref) => {
1099
+ const theme = useTheme();
1100
+ const mediaStyles = Object.entries(queries).reduce((current, [key, value]) => {
1101
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1102
+ return useMediaQuery(key) ? {
1103
+ ...current,
1104
+ ...(typeof value === 'function' ? value(rest, theme) : value)
1105
+ } : current;
1106
+ }, {});
1107
+ return /*#__PURE__*/React__namespace.createElement(type, {
1108
+ ...rest,
1109
+ style: {
1110
+ ...(typeof newStyles === 'function' ? newStyles(rest, theme) : newStyles),
1111
+ ...style,
1112
+ ...mediaStyles
1113
+ },
1114
+ ref
1115
+ });
1116
+ });
1117
+ }
1118
+ function useIsMounted() {
1119
+ const mountedRef = React__namespace.useRef(false);
1120
+ const isMounted = React__namespace.useCallback(() => mountedRef.current, []);
1121
+ React__namespace.useEffect(() => {
1122
+ mountedRef.current = true;
1123
+ return () => {
1124
+ mountedRef.current = false;
1125
+ };
1126
+ }, []);
1127
+ return isMounted;
1128
+ }
1129
+
1130
+ /**
1131
+ * Displays a string regardless the type of the data
1132
+ * @param {unknown} value Value to be stringified
1133
+ * @param {boolean} beautify Formats json to multiline
1134
+ */
1135
+ const displayValue = (value, beautify = false) => {
1136
+ const {
1137
+ json
1138
+ } = superjson.serialize(value);
1139
+ return JSON.stringify(json, null, beautify ? 2 : undefined);
1704
1140
  };
1705
- var registerSymbol = function (v, identifier) {
1706
- return SymbolRegistry.register(v, identifier);
1141
+
1142
+ // Sorting functions
1143
+
1144
+ const getStatusRank = q => q.state.fetchStatus !== 'idle' ? 0 : !q.getObserversCount() ? 3 : q.isStale() ? 2 : 1;
1145
+ const queryHashSort = (a, b) => a.queryHash.localeCompare(b.queryHash);
1146
+ const dateSort = (a, b) => a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1;
1147
+ const statusAndDateSort = (a, b) => {
1148
+ if (getStatusRank(a) === getStatusRank(b)) {
1149
+ return dateSort(a, b);
1150
+ }
1151
+ return getStatusRank(a) > getStatusRank(b) ? 1 : -1;
1707
1152
  };
1708
- var registerCustom = function (transformer, name) {
1709
- return CustomTransformerRegistry.register(__assign({ name: name }, transformer));
1153
+ const sortFns = {
1154
+ 'Status > Last Updated': statusAndDateSort,
1155
+ 'Query Hash': queryHashSort,
1156
+ 'Last Updated': dateSort
1710
1157
  };
1711
- var superjson = {
1712
- stringify: stringify,
1713
- parse: parse,
1714
- serialize: serialize,
1715
- deserialize: deserialize,
1716
- registerClass: registerClass,
1717
- registerSymbol: registerSymbol,
1718
- registerCustom: registerCustom,
1719
- allowErrorProps: allowErrorProps
1158
+ const minPanelSize = 70;
1159
+ const defaultPanelSize = 500;
1160
+ const sides = {
1161
+ top: 'bottom',
1162
+ bottom: 'top',
1163
+ left: 'right',
1164
+ right: 'left'
1720
1165
  };
1166
+ /**
1167
+ * Check if the given side is vertical (left/right)
1168
+ */
1169
+ function isVerticalSide(side) {
1170
+ return ['left', 'right'].includes(side);
1171
+ }
1172
+ /**
1173
+ * Get the opposite side, eg 'left' => 'right'. 'top' => 'bottom', etc
1174
+ */
1175
+ function getOppositeSide(side) {
1176
+ return sides[side];
1177
+ }
1178
+ /**
1179
+ * Given as css prop it will return a sided css prop based on a given side
1180
+ * Example given `border` and `right` it return `borderRight`
1181
+ */
1182
+ function getSidedProp(prop, side) {
1183
+ return `${prop}${side.charAt(0).toUpperCase() + side.slice(1)}`;
1184
+ }
1185
+ function getSidePanelStyle({
1186
+ position = 'bottom',
1187
+ height,
1188
+ width,
1189
+ devtoolsTheme,
1190
+ isOpen,
1191
+ isResizing,
1192
+ panelStyle
1193
+ }) {
1194
+ const oppositeSide = getOppositeSide(position);
1195
+ const borderSide = getSidedProp('border', oppositeSide);
1196
+ const isVertical = isVerticalSide(position);
1197
+ return {
1198
+ ...panelStyle,
1199
+ direction: 'ltr',
1200
+ position: 'fixed',
1201
+ [position]: 0,
1202
+ [borderSide]: `1px solid ${devtoolsTheme.gray}`,
1203
+ transformOrigin: oppositeSide,
1204
+ boxShadow: '0 0 20px rgba(0,0,0,.3)',
1205
+ zIndex: 99999,
1206
+ // visibility will be toggled after transitions, but set initial state here
1207
+ visibility: isOpen ? 'visible' : 'hidden',
1208
+ ...(isResizing ? {
1209
+ transition: `none`
1210
+ } : {
1211
+ transition: `all .2s ease`
1212
+ }),
1213
+ ...(isOpen ? {
1214
+ opacity: 1,
1215
+ pointerEvents: 'all',
1216
+ transform: isVertical ? `translateX(0) scale(1)` : `translateY(0) scale(1)`
1217
+ } : {
1218
+ opacity: 0,
1219
+ pointerEvents: 'none',
1220
+ transform: isVertical ? `translateX(15px) scale(1.02)` : `translateY(15px) scale(1.02)`
1221
+ }),
1222
+ ...(isVertical ? {
1223
+ top: 0,
1224
+ height: '100vh',
1225
+ maxWidth: '90%',
1226
+ width: typeof width === 'number' && width >= minPanelSize ? width : defaultPanelSize
1227
+ } : {
1228
+ left: 0,
1229
+ width: '100%',
1230
+ maxHeight: '90%',
1231
+ height: typeof height === 'number' && height >= minPanelSize ? height : defaultPanelSize
1232
+ })
1233
+ };
1234
+ }
1721
1235
 
1722
- const defaultTheme = {
1723
- background: '#0b1521',
1724
- backgroundAlt: '#132337',
1725
- foreground: 'white',
1726
- gray: '#3f4e60',
1727
- grayAlt: '#222e3e',
1728
- inputBackgroundColor: '#fff',
1729
- inputTextColor: '#000',
1730
- success: '#00ab52',
1731
- danger: '#ff0085',
1732
- active: '#006bff',
1733
- paused: '#8c49eb',
1734
- warning: '#ffb200'
1236
+ /**
1237
+ * Get resize handle style based on a given side
1238
+ */
1239
+ function getResizeHandleStyle(position = 'bottom') {
1240
+ const isVertical = isVerticalSide(position);
1241
+ const oppositeSide = getOppositeSide(position);
1242
+ const marginSide = getSidedProp('margin', oppositeSide);
1243
+ return {
1244
+ position: 'absolute',
1245
+ cursor: isVertical ? 'col-resize' : 'row-resize',
1246
+ zIndex: 100000,
1247
+ [oppositeSide]: 0,
1248
+ [marginSide]: `-4px`,
1249
+ ...(isVertical ? {
1250
+ top: 0,
1251
+ height: '100%',
1252
+ width: '4px'
1253
+ } : {
1254
+ width: '100%',
1255
+ height: '4px'
1256
+ })
1257
+ };
1258
+ }
1259
+
1260
+ function ScreenReader({
1261
+ text
1262
+ }) {
1263
+ return /*#__PURE__*/React__namespace.createElement("span", {
1264
+ style: {
1265
+ position: 'absolute',
1266
+ width: '0.1px',
1267
+ height: '0.1px',
1268
+ overflow: 'hidden'
1269
+ }
1270
+ }, text);
1271
+ }
1272
+
1273
+ function Logo(props) {
1274
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends({
1275
+ width: "40px",
1276
+ height: "40px",
1277
+ viewBox: "0 0 190 190",
1278
+ version: "1.1"
1279
+ }, props), /*#__PURE__*/React__namespace.createElement("g", {
1280
+ stroke: "none",
1281
+ strokeWidth: "1",
1282
+ fill: "none",
1283
+ fillRule: "evenodd"
1284
+ }, /*#__PURE__*/React__namespace.createElement("g", {
1285
+ transform: "translate(-33.000000, 0.000000)"
1286
+ }, /*#__PURE__*/React__namespace.createElement("path", {
1287
+ d: "M72.7239712,61.3436237 C69.631224,46.362877 68.9675112,34.8727722 70.9666331,26.5293551 C72.1555965,21.5671678 74.3293088,17.5190846 77.6346064,14.5984631 C81.1241394,11.5150478 85.5360327,10.0020122 90.493257,10.0020122 C98.6712013,10.0020122 107.26826,13.7273214 116.455725,20.8044264 C120.20312,23.6910458 124.092437,27.170411 128.131651,31.2444746 C128.45314,30.8310265 128.816542,30.4410453 129.22143,30.0806152 C140.64098,19.9149716 150.255245,13.5989272 158.478408,11.1636507 C163.367899,9.715636 167.958526,9.57768202 172.138936,10.983031 C176.551631,12.4664684 180.06766,15.5329489 182.548314,19.8281091 C186.642288,26.9166735 187.721918,36.2310983 186.195595,47.7320243 C185.573451,52.4199112 184.50985,57.5263831 183.007094,63.0593153 C183.574045,63.1277086 184.142416,63.2532808 184.705041,63.4395297 C199.193932,68.2358678 209.453582,73.3937462 215.665021,79.2882839 C219.360669,82.7953831 221.773972,86.6998434 222.646365,91.0218204 C223.567176,95.5836746 222.669313,100.159332 220.191548,104.451297 C216.105211,111.529614 208.591643,117.11221 197.887587,121.534031 C193.589552,123.309539 188.726579,124.917559 183.293259,126.363748 C183.541176,126.92292 183.733521,127.516759 183.862138,128.139758 C186.954886,143.120505 187.618598,154.61061 185.619477,162.954027 C184.430513,167.916214 182.256801,171.964297 178.951503,174.884919 C175.46197,177.968334 171.050077,179.48137 166.092853,179.48137 C157.914908,179.48137 149.31785,175.756061 140.130385,168.678956 C136.343104,165.761613 132.410866,162.238839 128.325434,158.108619 C127.905075,158.765474 127.388968,159.376011 126.77857,159.919385 C115.35902,170.085028 105.744755,176.401073 97.5215915,178.836349 C92.6321009,180.284364 88.0414736,180.422318 83.8610636,179.016969 C79.4483686,177.533532 75.9323404,174.467051 73.4516862,170.171891 C69.3577116,163.083327 68.2780823,153.768902 69.8044053,142.267976 C70.449038,137.410634 71.56762,132.103898 73.1575891,126.339009 C72.5361041,126.276104 71.9120754,126.144816 71.2949591,125.940529 C56.8060684,121.144191 46.5464184,115.986312 40.3349789,110.091775 C36.6393312,106.584675 34.2260275,102.680215 33.3536352,98.3582381 C32.4328237,93.7963839 33.3306866,89.2207269 35.8084524,84.9287618 C39.8947886,77.8504443 47.4083565,72.2678481 58.1124133,67.8460273 C62.5385143,66.0176154 67.5637208,64.366822 73.1939394,62.8874674 C72.9933393,62.3969171 72.8349374,61.8811235 72.7239712,61.3436237 Z",
1288
+ fill: "#002C4B",
1289
+ fillRule: "nonzero",
1290
+ transform: "translate(128.000000, 95.000000) scale(-1, 1) translate(-128.000000, -95.000000) "
1291
+ }), /*#__PURE__*/React__namespace.createElement("path", {
1292
+ d: "M113.396882,64 L142.608177,64 C144.399254,64 146.053521,64.958025 146.944933,66.5115174 L161.577138,92.0115174 C162.461464,93.5526583 162.461464,95.4473417 161.577138,96.9884826 L146.944933,122.488483 C146.053521,124.041975 144.399254,125 142.608177,125 L113.396882,125 C111.605806,125 109.951539,124.041975 109.060126,122.488483 L94.4279211,96.9884826 C93.543596,95.4473417 93.543596,93.5526583 94.4279211,92.0115174 L109.060126,66.5115174 C109.951539,64.958025 111.605806,64 113.396882,64 Z M138.987827,70.2765273 C140.779849,70.2765273 142.434839,71.2355558 143.325899,72.7903404 L154.343038,92.0138131 C155.225607,93.5537825 155.225607,95.4462175 154.343038,96.9861869 L143.325899,116.20966 C142.434839,117.764444 140.779849,118.723473 138.987827,118.723473 L117.017233,118.723473 C115.225211,118.723473 113.570221,117.764444 112.67916,116.20966 L101.662022,96.9861869 C100.779452,95.4462175 100.779452,93.5537825 101.662022,92.0138131 L112.67916,72.7903404 C113.570221,71.2355558 115.225211,70.2765273 117.017233,70.2765273 L138.987827,70.2765273 Z M135.080648,77.1414791 L120.924411,77.1414791 C119.134228,77.1414791 117.480644,78.0985567 116.5889,79.6508285 L116.5889,79.6508285 L109.489217,92.0093494 C108.603232,93.5515958 108.603232,95.4484042 109.489217,96.9906506 L109.489217,96.9906506 L116.5889,109.349172 C117.480644,110.901443 119.134228,111.858521 120.924411,111.858521 L120.924411,111.858521 L135.080648,111.858521 C136.870831,111.858521 138.524416,110.901443 139.41616,109.349172 L139.41616,109.349172 L146.515843,96.9906506 C147.401828,95.4484042 147.401828,93.5515958 146.515843,92.0093494 L146.515843,92.0093494 L139.41616,79.6508285 C138.524416,78.0985567 136.870831,77.1414791 135.080648,77.1414791 L135.080648,77.1414791 Z M131.319186,83.7122186 C133.108028,83.7122186 134.760587,84.6678753 135.652827,86.2183156 L138.983552,92.0060969 C139.87203,93.5500005 139.87203,95.4499995 138.983552,96.9939031 L135.652827,102.781684 C134.760587,104.332125 133.108028,105.287781 131.319186,105.287781 L124.685874,105.287781 C122.897032,105.287781 121.244473,104.332125 120.352233,102.781684 L117.021508,96.9939031 C116.13303,95.4499995 116.13303,93.5500005 117.021508,92.0060969 L120.352233,86.2183156 C121.244473,84.6678753 122.897032,83.7122186 124.685874,83.7122186 L131.319186,83.7122186 Z M128.003794,90.1848875 C126.459294,90.1848875 125.034382,91.0072828 124.263005,92.3424437 C123.491732,93.6774232 123.491732,95.3225768 124.263005,96.6575563 C125.034382,97.9927172 126.459294,98.8151125 128.001266,98.8151125 L128.001266,98.8151125 C129.545766,98.8151125 130.970678,97.9927172 131.742055,96.6575563 C132.513327,95.3225768 132.513327,93.6774232 131.742055,92.3424437 C130.970678,91.0072828 129.545766,90.1848875 128.003794,90.1848875 L128.003794,90.1848875 Z M93,94.5009646 L100.767764,94.5009646",
1293
+ fill: "#FFD94C"
1294
+ }), /*#__PURE__*/React__namespace.createElement("path", {
1295
+ d: "M87.8601729,108.357758 C89.1715224,107.608286 90.8360246,108.074601 91.5779424,109.399303 L91.5779424,109.399303 L92.0525843,110.24352 C95.8563392,116.982993 99.8190116,123.380176 103.940602,129.435068 C108.807881,136.585427 114.28184,143.82411 120.362479,151.151115 C121.316878,152.30114 121.184944,154.011176 120.065686,154.997937 L120.065686,154.997937 L119.454208,155.534625 C99.3465389,173.103314 86.2778188,176.612552 80.2480482,166.062341 C74.3500652,155.742717 76.4844915,136.982888 86.6513274,109.782853 C86.876818,109.179582 87.3045861,108.675291 87.8601729,108.357758 Z M173.534177,129.041504 C174.986131,128.785177 176.375496,129.742138 176.65963,131.194242 L176.65963,131.194242 L176.812815,131.986376 C181.782365,157.995459 178.283348,171 166.315764,171 C154.609745,171 139.708724,159.909007 121.612702,137.727022 C121.211349,137.235047 120.994572,136.617371 121,135.981509 C121.013158,134.480686 122.235785,133.274651 123.730918,133.287756 L123.730918,133.287756 L124.684654,133.294531 C132.305698,133.335994 139.714387,133.071591 146.910723,132.501323 C155.409039,131.82788 164.283523,130.674607 173.534177,129.041504 Z M180.408726,73.8119663 C180.932139,72.4026903 182.508386,71.6634537 183.954581,72.149012 L183.954581,72.149012 L184.742552,72.4154854 C210.583763,81.217922 220.402356,90.8916805 214.198332,101.436761 C208.129904,111.751366 190.484347,119.260339 161.26166,123.963678 C160.613529,124.067994 159.948643,123.945969 159.382735,123.618843 C158.047025,122.846729 157.602046,121.158214 158.388848,119.847438 L158.388848,119.847438 L158.889328,119.0105 C162.877183,112.31633 166.481358,105.654262 169.701854,99.0242957 C173.50501,91.1948179 177.073967,82.7907081 180.408726,73.8119663 Z M94.7383398,66.0363218 C95.3864708,65.9320063 96.0513565,66.0540315 96.6172646,66.3811573 C97.9529754,67.153271 98.3979538,68.8417862 97.6111517,70.1525615 L97.6111517,70.1525615 L97.1106718,70.9895001 C93.1228168,77.6836699 89.5186416,84.3457379 86.2981462,90.9757043 C82.49499,98.8051821 78.9260328,107.209292 75.5912744,116.188034 C75.0678608,117.59731 73.4916142,118.336546 72.045419,117.850988 L72.045419,117.850988 L71.2574475,117.584515 C45.4162372,108.782078 35.597644,99.1083195 41.8016679,88.5632391 C47.8700957,78.2486335 65.515653,70.7396611 94.7383398,66.0363218 Z M136.545792,34.4653746 C156.653461,16.8966864 169.722181,13.3874478 175.751952,23.9376587 C181.649935,34.2572826 179.515508,53.0171122 169.348673,80.2171474 C169.123182,80.8204179 168.695414,81.324709 168.139827,81.6422422 C166.828478,82.3917144 165.163975,81.9253986 164.422058,80.6006966 L164.422058,80.6006966 L163.947416,79.7564798 C160.143661,73.0170065 156.180988,66.6198239 152.059398,60.564932 C147.192119,53.4145727 141.71816,46.1758903 135.637521,38.8488847 C134.683122,37.6988602 134.815056,35.9888243 135.934314,35.0020629 L135.934314,35.0020629 Z M90.6842361,18 C102.390255,18 117.291276,29.0909926 135.387298,51.2729777 C135.788651,51.7649527 136.005428,52.3826288 136,53.0184911 C135.986842,54.5193144 134.764215,55.7253489 133.269082,55.7122445 L133.269082,55.7122445 L132.315346,55.7054689 C124.694302,55.6640063 117.285613,55.9284091 110.089277,56.4986773 C101.590961,57.17212 92.7164767,58.325393 83.4658235,59.9584962 C82.0138691,60.2148231 80.6245044,59.2578618 80.3403697,57.805758 L80.3403697,57.805758 L80.1871846,57.0136235 C75.2176347,31.0045412 78.7166519,18 90.6842361,18 Z",
1296
+ fill: "#FF4154"
1297
+ }))));
1298
+ }
1299
+
1300
+ /**
1301
+ * match-sorter-utils
1302
+ *
1303
+ * Copyright (c) TanStack
1304
+ *
1305
+ * This source code is licensed under the MIT license found in the
1306
+ * LICENSE.md file in the root directory of this source tree.
1307
+ *
1308
+ * @license MIT
1309
+ */
1310
+ const characterMap = {
1311
+ À: 'A',
1312
+ Á: 'A',
1313
+ Â: 'A',
1314
+ Ã: 'A',
1315
+ Ä: 'A',
1316
+ Å: 'A',
1317
+ Ấ: 'A',
1318
+ Ắ: 'A',
1319
+ Ẳ: 'A',
1320
+ Ẵ: 'A',
1321
+ Ặ: 'A',
1322
+ Æ: 'AE',
1323
+ Ầ: 'A',
1324
+ Ằ: 'A',
1325
+ Ȃ: 'A',
1326
+ Ç: 'C',
1327
+ Ḉ: 'C',
1328
+ È: 'E',
1329
+ É: 'E',
1330
+ Ê: 'E',
1331
+ Ë: 'E',
1332
+ Ế: 'E',
1333
+ Ḗ: 'E',
1334
+ Ề: 'E',
1335
+ Ḕ: 'E',
1336
+ Ḝ: 'E',
1337
+ Ȇ: 'E',
1338
+ Ì: 'I',
1339
+ Í: 'I',
1340
+ Î: 'I',
1341
+ Ï: 'I',
1342
+ Ḯ: 'I',
1343
+ Ȋ: 'I',
1344
+ Ð: 'D',
1345
+ Ñ: 'N',
1346
+ Ò: 'O',
1347
+ Ó: 'O',
1348
+ Ô: 'O',
1349
+ Õ: 'O',
1350
+ Ö: 'O',
1351
+ Ø: 'O',
1352
+ Ố: 'O',
1353
+ Ṍ: 'O',
1354
+ Ṓ: 'O',
1355
+ Ȏ: 'O',
1356
+ Ù: 'U',
1357
+ Ú: 'U',
1358
+ Û: 'U',
1359
+ Ü: 'U',
1360
+ Ý: 'Y',
1361
+ à: 'a',
1362
+ á: 'a',
1363
+ â: 'a',
1364
+ ã: 'a',
1365
+ ä: 'a',
1366
+ å: 'a',
1367
+ ấ: 'a',
1368
+ ắ: 'a',
1369
+ ẳ: 'a',
1370
+ ẵ: 'a',
1371
+ ặ: 'a',
1372
+ æ: 'ae',
1373
+ ầ: 'a',
1374
+ ằ: 'a',
1375
+ ȃ: 'a',
1376
+ ç: 'c',
1377
+ ḉ: 'c',
1378
+ è: 'e',
1379
+ é: 'e',
1380
+ ê: 'e',
1381
+ ë: 'e',
1382
+ ế: 'e',
1383
+ ḗ: 'e',
1384
+ ề: 'e',
1385
+ ḕ: 'e',
1386
+ ḝ: 'e',
1387
+ ȇ: 'e',
1388
+ ì: 'i',
1389
+ í: 'i',
1390
+ î: 'i',
1391
+ ï: 'i',
1392
+ ḯ: 'i',
1393
+ ȋ: 'i',
1394
+ ð: 'd',
1395
+ ñ: 'n',
1396
+ ò: 'o',
1397
+ ó: 'o',
1398
+ ô: 'o',
1399
+ õ: 'o',
1400
+ ö: 'o',
1401
+ ø: 'o',
1402
+ ố: 'o',
1403
+ ṍ: 'o',
1404
+ ṓ: 'o',
1405
+ ȏ: 'o',
1406
+ ù: 'u',
1407
+ ú: 'u',
1408
+ û: 'u',
1409
+ ü: 'u',
1410
+ ý: 'y',
1411
+ ÿ: 'y',
1412
+ Ā: 'A',
1413
+ ā: 'a',
1414
+ Ă: 'A',
1415
+ ă: 'a',
1416
+ Ą: 'A',
1417
+ ą: 'a',
1418
+ Ć: 'C',
1419
+ ć: 'c',
1420
+ Ĉ: 'C',
1421
+ ĉ: 'c',
1422
+ Ċ: 'C',
1423
+ ċ: 'c',
1424
+ Č: 'C',
1425
+ č: 'c',
1426
+ C̆: 'C',
1427
+ c̆: 'c',
1428
+ Ď: 'D',
1429
+ ď: 'd',
1430
+ Đ: 'D',
1431
+ đ: 'd',
1432
+ Ē: 'E',
1433
+ ē: 'e',
1434
+ Ĕ: 'E',
1435
+ ĕ: 'e',
1436
+ Ė: 'E',
1437
+ ė: 'e',
1438
+ Ę: 'E',
1439
+ ę: 'e',
1440
+ Ě: 'E',
1441
+ ě: 'e',
1442
+ Ĝ: 'G',
1443
+ Ǵ: 'G',
1444
+ ĝ: 'g',
1445
+ ǵ: 'g',
1446
+ Ğ: 'G',
1447
+ ğ: 'g',
1448
+ Ġ: 'G',
1449
+ ġ: 'g',
1450
+ Ģ: 'G',
1451
+ ģ: 'g',
1452
+ Ĥ: 'H',
1453
+ ĥ: 'h',
1454
+ Ħ: 'H',
1455
+ ħ: 'h',
1456
+ Ḫ: 'H',
1457
+ ḫ: 'h',
1458
+ Ĩ: 'I',
1459
+ ĩ: 'i',
1460
+ Ī: 'I',
1461
+ ī: 'i',
1462
+ Ĭ: 'I',
1463
+ ĭ: 'i',
1464
+ Į: 'I',
1465
+ į: 'i',
1466
+ İ: 'I',
1467
+ ı: 'i',
1468
+ IJ: 'IJ',
1469
+ ij: 'ij',
1470
+ Ĵ: 'J',
1471
+ ĵ: 'j',
1472
+ Ķ: 'K',
1473
+ ķ: 'k',
1474
+ Ḱ: 'K',
1475
+ ḱ: 'k',
1476
+ K̆: 'K',
1477
+ k̆: 'k',
1478
+ Ĺ: 'L',
1479
+ ĺ: 'l',
1480
+ Ļ: 'L',
1481
+ ļ: 'l',
1482
+ Ľ: 'L',
1483
+ ľ: 'l',
1484
+ Ŀ: 'L',
1485
+ ŀ: 'l',
1486
+ Ł: 'l',
1487
+ ł: 'l',
1488
+ Ḿ: 'M',
1489
+ ḿ: 'm',
1490
+ M̆: 'M',
1491
+ m̆: 'm',
1492
+ Ń: 'N',
1493
+ ń: 'n',
1494
+ Ņ: 'N',
1495
+ ņ: 'n',
1496
+ Ň: 'N',
1497
+ ň: 'n',
1498
+ ʼn: 'n',
1499
+ N̆: 'N',
1500
+ n̆: 'n',
1501
+ Ō: 'O',
1502
+ ō: 'o',
1503
+ Ŏ: 'O',
1504
+ ŏ: 'o',
1505
+ Ő: 'O',
1506
+ ő: 'o',
1507
+ Œ: 'OE',
1508
+ œ: 'oe',
1509
+ P̆: 'P',
1510
+ p̆: 'p',
1511
+ Ŕ: 'R',
1512
+ ŕ: 'r',
1513
+ Ŗ: 'R',
1514
+ ŗ: 'r',
1515
+ Ř: 'R',
1516
+ ř: 'r',
1517
+ R̆: 'R',
1518
+ r̆: 'r',
1519
+ Ȓ: 'R',
1520
+ ȓ: 'r',
1521
+ Ś: 'S',
1522
+ ś: 's',
1523
+ Ŝ: 'S',
1524
+ ŝ: 's',
1525
+ Ş: 'S',
1526
+ Ș: 'S',
1527
+ ș: 's',
1528
+ ş: 's',
1529
+ Š: 'S',
1530
+ š: 's',
1531
+ Ţ: 'T',
1532
+ ţ: 't',
1533
+ ț: 't',
1534
+ Ț: 'T',
1535
+ Ť: 'T',
1536
+ ť: 't',
1537
+ Ŧ: 'T',
1538
+ ŧ: 't',
1539
+ T̆: 'T',
1540
+ t̆: 't',
1541
+ Ũ: 'U',
1542
+ ũ: 'u',
1543
+ Ū: 'U',
1544
+ ū: 'u',
1545
+ Ŭ: 'U',
1546
+ ŭ: 'u',
1547
+ Ů: 'U',
1548
+ ů: 'u',
1549
+ Ű: 'U',
1550
+ ű: 'u',
1551
+ Ų: 'U',
1552
+ ų: 'u',
1553
+ Ȗ: 'U',
1554
+ ȗ: 'u',
1555
+ V̆: 'V',
1556
+ v̆: 'v',
1557
+ Ŵ: 'W',
1558
+ ŵ: 'w',
1559
+ Ẃ: 'W',
1560
+ ẃ: 'w',
1561
+ X̆: 'X',
1562
+ x̆: 'x',
1563
+ Ŷ: 'Y',
1564
+ ŷ: 'y',
1565
+ Ÿ: 'Y',
1566
+ Y̆: 'Y',
1567
+ y̆: 'y',
1568
+ Ź: 'Z',
1569
+ ź: 'z',
1570
+ Ż: 'Z',
1571
+ ż: 'z',
1572
+ Ž: 'Z',
1573
+ ž: 'z',
1574
+ ſ: 's',
1575
+ ƒ: 'f',
1576
+ Ơ: 'O',
1577
+ ơ: 'o',
1578
+ Ư: 'U',
1579
+ ư: 'u',
1580
+ Ǎ: 'A',
1581
+ ǎ: 'a',
1582
+ Ǐ: 'I',
1583
+ ǐ: 'i',
1584
+ Ǒ: 'O',
1585
+ ǒ: 'o',
1586
+ Ǔ: 'U',
1587
+ ǔ: 'u',
1588
+ Ǖ: 'U',
1589
+ ǖ: 'u',
1590
+ Ǘ: 'U',
1591
+ ǘ: 'u',
1592
+ Ǚ: 'U',
1593
+ ǚ: 'u',
1594
+ Ǜ: 'U',
1595
+ ǜ: 'u',
1596
+ Ứ: 'U',
1597
+ ứ: 'u',
1598
+ Ṹ: 'U',
1599
+ ṹ: 'u',
1600
+ Ǻ: 'A',
1601
+ ǻ: 'a',
1602
+ Ǽ: 'AE',
1603
+ ǽ: 'ae',
1604
+ Ǿ: 'O',
1605
+ ǿ: 'o',
1606
+ Þ: 'TH',
1607
+ þ: 'th',
1608
+ Ṕ: 'P',
1609
+ ṕ: 'p',
1610
+ Ṥ: 'S',
1611
+ ṥ: 's',
1612
+ X́: 'X',
1613
+ x́: 'x',
1614
+ Ѓ: 'Г',
1615
+ ѓ: 'г',
1616
+ Ќ: 'К',
1617
+ ќ: 'к',
1618
+ A̋: 'A',
1619
+ a̋: 'a',
1620
+ E̋: 'E',
1621
+ e̋: 'e',
1622
+ I̋: 'I',
1623
+ i̋: 'i',
1624
+ Ǹ: 'N',
1625
+ ǹ: 'n',
1626
+ Ồ: 'O',
1627
+ ồ: 'o',
1628
+ Ṑ: 'O',
1629
+ ṑ: 'o',
1630
+ Ừ: 'U',
1631
+ ừ: 'u',
1632
+ Ẁ: 'W',
1633
+ ẁ: 'w',
1634
+ Ỳ: 'Y',
1635
+ ỳ: 'y',
1636
+ Ȁ: 'A',
1637
+ ȁ: 'a',
1638
+ Ȅ: 'E',
1639
+ ȅ: 'e',
1640
+ Ȉ: 'I',
1641
+ ȉ: 'i',
1642
+ Ȍ: 'O',
1643
+ ȍ: 'o',
1644
+ Ȑ: 'R',
1645
+ ȑ: 'r',
1646
+ Ȕ: 'U',
1647
+ ȕ: 'u',
1648
+ B̌: 'B',
1649
+ b̌: 'b',
1650
+ Č̣: 'C',
1651
+ č̣: 'c',
1652
+ Ê̌: 'E',
1653
+ ê̌: 'e',
1654
+ F̌: 'F',
1655
+ f̌: 'f',
1656
+ Ǧ: 'G',
1657
+ ǧ: 'g',
1658
+ Ȟ: 'H',
1659
+ ȟ: 'h',
1660
+ J̌: 'J',
1661
+ ǰ: 'j',
1662
+ Ǩ: 'K',
1663
+ ǩ: 'k',
1664
+ M̌: 'M',
1665
+ m̌: 'm',
1666
+ P̌: 'P',
1667
+ p̌: 'p',
1668
+ Q̌: 'Q',
1669
+ q̌: 'q',
1670
+ Ř̩: 'R',
1671
+ ř̩: 'r',
1672
+ Ṧ: 'S',
1673
+ ṧ: 's',
1674
+ V̌: 'V',
1675
+ v̌: 'v',
1676
+ W̌: 'W',
1677
+ w̌: 'w',
1678
+ X̌: 'X',
1679
+ x̌: 'x',
1680
+ Y̌: 'Y',
1681
+ y̌: 'y',
1682
+ A̧: 'A',
1683
+ a̧: 'a',
1684
+ B̧: 'B',
1685
+ b̧: 'b',
1686
+ Ḑ: 'D',
1687
+ ḑ: 'd',
1688
+ Ȩ: 'E',
1689
+ ȩ: 'e',
1690
+ Ɛ̧: 'E',
1691
+ ɛ̧: 'e',
1692
+ Ḩ: 'H',
1693
+ ḩ: 'h',
1694
+ I̧: 'I',
1695
+ i̧: 'i',
1696
+ Ɨ̧: 'I',
1697
+ ɨ̧: 'i',
1698
+ M̧: 'M',
1699
+ m̧: 'm',
1700
+ O̧: 'O',
1701
+ o̧: 'o',
1702
+ Q̧: 'Q',
1703
+ q̧: 'q',
1704
+ U̧: 'U',
1705
+ u̧: 'u',
1706
+ X̧: 'X',
1707
+ x̧: 'x',
1708
+ Z̧: 'Z',
1709
+ z̧: 'z'
1735
1710
  };
1736
- const ThemeContext = /*#__PURE__*/React__namespace.createContext(defaultTheme);
1737
- function ThemeProvider({
1738
- theme,
1739
- ...rest
1740
- }) {
1741
- return /*#__PURE__*/React__namespace.createElement(ThemeContext.Provider, _extends({
1742
- value: theme
1743
- }, rest));
1744
- }
1745
- function useTheme() {
1746
- return React__namespace.useContext(ThemeContext);
1747
- }
1748
-
1749
- function useMediaQuery(query) {
1750
- // Keep track of the preference in state, start with the current match
1751
- const [isMatch, setIsMatch] = React__namespace.useState(() => {
1752
- if (typeof window !== 'undefined') {
1753
- return window.matchMedia(query).matches;
1754
- }
1755
- return;
1711
+ const chars = Object.keys(characterMap).join('|');
1712
+ const allAccents = new RegExp(chars, 'g');
1713
+ function removeAccents(str) {
1714
+ return str.replace(allAccents, match => {
1715
+ return characterMap[match];
1756
1716
  });
1757
-
1758
- // Watch for changes
1759
- React__namespace.useEffect(() => {
1760
- if (typeof window !== 'undefined') {
1761
- // Create a matcher
1762
- const matcher = window.matchMedia(query);
1763
-
1764
- // Create our handler
1765
- const onChange = ({
1766
- matches
1767
- }) => setIsMatch(matches);
1768
-
1769
- // Listen for changes
1770
- matcher.addListener(onChange);
1771
- return () => {
1772
- // Stop listening for changes
1773
- matcher.removeListener(onChange);
1774
- };
1775
- }
1776
- return;
1777
- }, [isMatch, query, setIsMatch]);
1778
- return isMatch;
1779
1717
  }
1780
1718
 
1781
- function getQueryStatusColor({
1782
- queryState,
1783
- observerCount,
1784
- isStale,
1785
- theme
1786
- }) {
1787
- return queryState.fetchStatus === 'fetching' ? theme.active : !observerCount ? theme.gray : queryState.fetchStatus === 'paused' ? theme.paused : isStale ? theme.warning : theme.success;
1788
- }
1789
- function getQueryStatusLabel(query) {
1790
- return query.state.fetchStatus === 'fetching' ? 'fetching' : !query.getObserversCount() ? 'inactive' : query.state.fetchStatus === 'paused' ? 'paused' : query.isStale() ? 'stale' : 'fresh';
1791
- }
1792
- function styled(type, newStyles, queries = {}) {
1793
- return /*#__PURE__*/React__namespace.forwardRef(({
1794
- style,
1795
- ...rest
1796
- }, ref) => {
1797
- const theme = useTheme();
1798
- const mediaStyles = Object.entries(queries).reduce((current, [key, value]) => {
1799
- // eslint-disable-next-line react-hooks/rules-of-hooks
1800
- return useMediaQuery(key) ? {
1801
- ...current,
1802
- ...(typeof value === 'function' ? value(rest, theme) : value)
1803
- } : current;
1804
- }, {});
1805
- return /*#__PURE__*/React__namespace.createElement(type, {
1806
- ...rest,
1807
- style: {
1808
- ...(typeof newStyles === 'function' ? newStyles(rest, theme) : newStyles),
1809
- ...style,
1810
- ...mediaStyles
1811
- },
1812
- ref
1813
- });
1814
- });
1815
- }
1816
- function useIsMounted() {
1817
- const mountedRef = React__namespace.useRef(false);
1818
- const isMounted = React__namespace.useCallback(() => mountedRef.current, []);
1819
- React__namespace.useEffect(() => {
1820
- mountedRef.current = true;
1821
- return () => {
1822
- mountedRef.current = false;
1719
+ /**
1720
+ * @name match-sorter
1721
+ * @license MIT license.
1722
+ * @copyright (c) 2099 Kent C. Dodds
1723
+ * @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
1724
+ */
1725
+ const rankings = {
1726
+ CASE_SENSITIVE_EQUAL: 7,
1727
+ EQUAL: 6,
1728
+ STARTS_WITH: 5,
1729
+ WORD_STARTS_WITH: 4,
1730
+ CONTAINS: 3,
1731
+ ACRONYM: 2,
1732
+ MATCHES: 1,
1733
+ NO_MATCH: 0
1734
+ };
1735
+ /**
1736
+ * Gets the highest ranking for value for the given item based on its values for the given keys
1737
+ * @param {*} item - the item to rank
1738
+ * @param {Array} keys - the keys to get values from the item for the ranking
1739
+ * @param {String} value - the value to rank against
1740
+ * @param {Object} options - options to control the ranking
1741
+ * @return {{rank: Number, accessorIndex: Number, accessorThreshold: Number}} - the highest ranking
1742
+ */
1743
+ function rankItem(item, value, options) {
1744
+ var _options$threshold;
1745
+ options = options || {};
1746
+ options.threshold = (_options$threshold = options.threshold) != null ? _options$threshold : rankings.MATCHES;
1747
+ if (!options.accessors) {
1748
+ // if keys is not specified, then we assume the item given is ready to be matched
1749
+ const rank = getMatchRanking(item, value, options);
1750
+ return {
1751
+ // ends up being duplicate of 'item' in matches but consistent
1752
+ rankedValue: item,
1753
+ rank,
1754
+ accessorIndex: -1,
1755
+ accessorThreshold: options.threshold,
1756
+ passed: rank >= options.threshold
1823
1757
  };
1824
- }, []);
1825
- return isMounted;
1758
+ }
1759
+ const valuesToRank = getAllValuesToRank(item, options.accessors);
1760
+ const rankingInfo = {
1761
+ rankedValue: item,
1762
+ rank: rankings.NO_MATCH,
1763
+ accessorIndex: -1,
1764
+ accessorThreshold: options.threshold,
1765
+ passed: false
1766
+ };
1767
+ for (let i = 0; i < valuesToRank.length; i++) {
1768
+ const rankValue = valuesToRank[i];
1769
+ let newRank = getMatchRanking(rankValue.itemValue, value, options);
1770
+ const {
1771
+ minRanking,
1772
+ maxRanking,
1773
+ threshold = options.threshold
1774
+ } = rankValue.attributes;
1775
+ if (newRank < minRanking && newRank >= rankings.MATCHES) {
1776
+ newRank = minRanking;
1777
+ } else if (newRank > maxRanking) {
1778
+ newRank = maxRanking;
1779
+ }
1780
+ newRank = Math.min(newRank, maxRanking);
1781
+ if (newRank >= threshold && newRank > rankingInfo.rank) {
1782
+ rankingInfo.rank = newRank;
1783
+ rankingInfo.passed = true;
1784
+ rankingInfo.accessorIndex = i;
1785
+ rankingInfo.accessorThreshold = threshold;
1786
+ rankingInfo.rankedValue = rankValue.itemValue;
1787
+ }
1788
+ }
1789
+ return rankingInfo;
1826
1790
  }
1827
1791
 
1828
1792
  /**
1829
- * Displays a string regardless the type of the data
1830
- * @param {unknown} value Value to be stringified
1831
- * @param {boolean} beautify Formats json to multiline
1793
+ * Gives a rankings score based on how well the two strings match.
1794
+ * @param {String} testString - the string to test against
1795
+ * @param {String} stringToRank - the string to rank
1796
+ * @param {Object} options - options for the match (like keepDiacritics for comparison)
1797
+ * @returns {Number} the ranking for how well stringToRank matches testString
1832
1798
  */
1833
- const displayValue = (value, beautify = false) => {
1834
- const {
1835
- json
1836
- } = superjson.serialize(value);
1837
- return JSON.stringify(json, null, beautify ? 2 : undefined);
1838
- };
1799
+ function getMatchRanking(testString, stringToRank, options) {
1800
+ testString = prepareValueForComparison(testString, options);
1801
+ stringToRank = prepareValueForComparison(stringToRank, options);
1839
1802
 
1840
- // Sorting functions
1803
+ // too long
1804
+ if (stringToRank.length > testString.length) {
1805
+ return rankings.NO_MATCH;
1806
+ }
1841
1807
 
1842
- const getStatusRank = q => q.state.fetchStatus !== 'idle' ? 0 : !q.getObserversCount() ? 3 : q.isStale() ? 2 : 1;
1843
- const queryHashSort = (a, b) => a.queryHash.localeCompare(b.queryHash);
1844
- const dateSort = (a, b) => a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1;
1845
- const statusAndDateSort = (a, b) => {
1846
- if (getStatusRank(a) === getStatusRank(b)) {
1847
- return dateSort(a, b);
1808
+ // case sensitive equals
1809
+ if (testString === stringToRank) {
1810
+ return rankings.CASE_SENSITIVE_EQUAL;
1848
1811
  }
1849
- return getStatusRank(a) > getStatusRank(b) ? 1 : -1;
1850
- };
1851
- const sortFns = {
1852
- 'Status > Last Updated': statusAndDateSort,
1853
- 'Query Hash': queryHashSort,
1854
- 'Last Updated': dateSort
1855
- };
1856
- const minPanelSize = 70;
1857
- const defaultPanelSize = 500;
1858
- const sides = {
1859
- top: 'bottom',
1860
- bottom: 'top',
1861
- left: 'right',
1862
- right: 'left'
1863
- };
1812
+
1813
+ // Lower casing before further comparison
1814
+ testString = testString.toLowerCase();
1815
+ stringToRank = stringToRank.toLowerCase();
1816
+
1817
+ // case insensitive equals
1818
+ if (testString === stringToRank) {
1819
+ return rankings.EQUAL;
1820
+ }
1821
+
1822
+ // starts with
1823
+ if (testString.startsWith(stringToRank)) {
1824
+ return rankings.STARTS_WITH;
1825
+ }
1826
+
1827
+ // word starts with
1828
+ if (testString.includes(` ${stringToRank}`)) {
1829
+ return rankings.WORD_STARTS_WITH;
1830
+ }
1831
+
1832
+ // contains
1833
+ if (testString.includes(stringToRank)) {
1834
+ return rankings.CONTAINS;
1835
+ } else if (stringToRank.length === 1) {
1836
+ // If the only character in the given stringToRank
1837
+ // isn't even contained in the testString, then
1838
+ // it's definitely not a match.
1839
+ return rankings.NO_MATCH;
1840
+ }
1841
+
1842
+ // acronym
1843
+ if (getAcronym(testString).includes(stringToRank)) {
1844
+ return rankings.ACRONYM;
1845
+ }
1846
+
1847
+ // will return a number between rankings.MATCHES and
1848
+ // rankings.MATCHES + 1 depending on how close of a match it is.
1849
+ return getClosenessRanking(testString, stringToRank);
1850
+ }
1851
+
1864
1852
  /**
1865
- * Check if the given side is vertical (left/right)
1853
+ * Generates an acronym for a string.
1854
+ *
1855
+ * @param {String} string the string for which to produce the acronym
1856
+ * @returns {String} the acronym
1866
1857
  */
1867
- function isVerticalSide(side) {
1868
- return ['left', 'right'].includes(side);
1858
+ function getAcronym(string) {
1859
+ let acronym = '';
1860
+ const wordsInString = string.split(' ');
1861
+ wordsInString.forEach(wordInString => {
1862
+ const splitByHyphenWords = wordInString.split('-');
1863
+ splitByHyphenWords.forEach(splitByHyphenWord => {
1864
+ acronym += splitByHyphenWord.substr(0, 1);
1865
+ });
1866
+ });
1867
+ return acronym;
1869
1868
  }
1869
+
1870
1870
  /**
1871
- * Get the opposite side, eg 'left' => 'right'. 'top' => 'bottom', etc
1871
+ * Returns a score based on how spread apart the
1872
+ * characters from the stringToRank are within the testString.
1873
+ * A number close to rankings.MATCHES represents a loose match. A number close
1874
+ * to rankings.MATCHES + 1 represents a tighter match.
1875
+ * @param {String} testString - the string to test against
1876
+ * @param {String} stringToRank - the string to rank
1877
+ * @returns {Number} the number between rankings.MATCHES and
1878
+ * rankings.MATCHES + 1 for how well stringToRank matches testString
1872
1879
  */
1873
- function getOppositeSide(side) {
1874
- return sides[side];
1880
+ function getClosenessRanking(testString, stringToRank) {
1881
+ let matchingInOrderCharCount = 0;
1882
+ let charNumber = 0;
1883
+ function findMatchingCharacter(matchChar, string, index) {
1884
+ for (let j = index, J = string.length; j < J; j++) {
1885
+ const stringChar = string[j];
1886
+ if (stringChar === matchChar) {
1887
+ matchingInOrderCharCount += 1;
1888
+ return j + 1;
1889
+ }
1890
+ }
1891
+ return -1;
1892
+ }
1893
+ function getRanking(spread) {
1894
+ const spreadPercentage = 1 / spread;
1895
+ const inOrderPercentage = matchingInOrderCharCount / stringToRank.length;
1896
+ const ranking = rankings.MATCHES + inOrderPercentage * spreadPercentage;
1897
+ return ranking;
1898
+ }
1899
+ const firstIndex = findMatchingCharacter(stringToRank[0], testString, 0);
1900
+ if (firstIndex < 0) {
1901
+ return rankings.NO_MATCH;
1902
+ }
1903
+ charNumber = firstIndex;
1904
+ for (let i = 1, I = stringToRank.length; i < I; i++) {
1905
+ const matchChar = stringToRank[i];
1906
+ charNumber = findMatchingCharacter(matchChar, testString, charNumber);
1907
+ const found = charNumber > -1;
1908
+ if (!found) {
1909
+ return rankings.NO_MATCH;
1910
+ }
1911
+ }
1912
+ const spread = charNumber - firstIndex;
1913
+ return getRanking(spread);
1875
1914
  }
1915
+
1876
1916
  /**
1877
- * Given as css prop it will return a sided css prop based on a given side
1878
- * Example given `border` and `right` it return `borderRight`
1917
+ * Prepares value for comparison by stringifying it, removing diacritics (if specified)
1918
+ * @param {String} value - the value to clean
1919
+ * @param {Object} options - {keepDiacritics: whether to remove diacritics}
1920
+ * @return {String} the prepared value
1879
1921
  */
1880
- function getSidedProp(prop, side) {
1881
- return `${prop}${side.charAt(0).toUpperCase() + side.slice(1)}`;
1882
- }
1883
- function getSidePanelStyle({
1884
- position = 'bottom',
1885
- height,
1886
- width,
1887
- devtoolsTheme,
1888
- isOpen,
1889
- isResizing,
1890
- panelStyle
1891
- }) {
1892
- const oppositeSide = getOppositeSide(position);
1893
- const borderSide = getSidedProp('border', oppositeSide);
1894
- const isVertical = isVerticalSide(position);
1895
- return {
1896
- ...panelStyle,
1897
- direction: 'ltr',
1898
- position: 'fixed',
1899
- [position]: 0,
1900
- [borderSide]: `1px solid ${devtoolsTheme.gray}`,
1901
- transformOrigin: oppositeSide,
1902
- boxShadow: '0 0 20px rgba(0,0,0,.3)',
1903
- zIndex: 99999,
1904
- // visibility will be toggled after transitions, but set initial state here
1905
- visibility: isOpen ? 'visible' : 'hidden',
1906
- ...(isResizing ? {
1907
- transition: `none`
1908
- } : {
1909
- transition: `all .2s ease`
1910
- }),
1911
- ...(isOpen ? {
1912
- opacity: 1,
1913
- pointerEvents: 'all',
1914
- transform: isVertical ? `translateX(0) scale(1)` : `translateY(0) scale(1)`
1915
- } : {
1916
- opacity: 0,
1917
- pointerEvents: 'none',
1918
- transform: isVertical ? `translateX(15px) scale(1.02)` : `translateY(15px) scale(1.02)`
1919
- }),
1920
- ...(isVertical ? {
1921
- top: 0,
1922
- height: '100vh',
1923
- maxWidth: '90%',
1924
- width: typeof width === 'number' && width >= minPanelSize ? width : defaultPanelSize
1925
- } : {
1926
- left: 0,
1927
- width: '100%',
1928
- maxHeight: '90%',
1929
- height: typeof height === 'number' && height >= minPanelSize ? height : defaultPanelSize
1930
- })
1931
- };
1922
+ function prepareValueForComparison(value, _ref) {
1923
+ let {
1924
+ keepDiacritics
1925
+ } = _ref;
1926
+ // value might not actually be a string at this point (we don't get to choose)
1927
+ // so part of preparing the value for comparison is ensure that it is a string
1928
+ value = `${value}`; // toString
1929
+ if (!keepDiacritics) {
1930
+ value = removeAccents(value);
1931
+ }
1932
+ return value;
1932
1933
  }
1933
1934
 
1934
1935
  /**
1935
- * Get resize handle style based on a given side
1936
+ * Gets value for key in item at arbitrarily nested keypath
1937
+ * @param {Object} item - the item
1938
+ * @param {Object|Function} key - the potentially nested keypath or property callback
1939
+ * @return {Array} - an array containing the value(s) at the nested keypath
1936
1940
  */
1937
- function getResizeHandleStyle(position = 'bottom') {
1938
- const isVertical = isVerticalSide(position);
1939
- const oppositeSide = getOppositeSide(position);
1940
- const marginSide = getSidedProp('margin', oppositeSide);
1941
+ function getItemValues(item, accessor) {
1942
+ let accessorFn = accessor;
1943
+ if (typeof accessor === 'object') {
1944
+ accessorFn = accessor.accessor;
1945
+ }
1946
+ const value = accessorFn(item);
1947
+
1948
+ // because `value` can also be undefined
1949
+ if (value == null) {
1950
+ return [];
1951
+ }
1952
+ if (Array.isArray(value)) {
1953
+ return value;
1954
+ }
1955
+ return [String(value)];
1956
+ }
1957
+
1958
+ /**
1959
+ * Gets all the values for the given keys in the given item and returns an array of those values
1960
+ * @param item - the item from which the values will be retrieved
1961
+ * @param keys - the keys to use to retrieve the values
1962
+ * @return objects with {itemValue, attributes}
1963
+ */
1964
+ function getAllValuesToRank(item, accessors) {
1965
+ const allValues = [];
1966
+ for (let j = 0, J = accessors.length; j < J; j++) {
1967
+ const accessor = accessors[j];
1968
+ const attributes = getAccessorAttributes(accessor);
1969
+ const itemValues = getItemValues(item, accessor);
1970
+ for (let i = 0, I = itemValues.length; i < I; i++) {
1971
+ allValues.push({
1972
+ itemValue: itemValues[i],
1973
+ attributes
1974
+ });
1975
+ }
1976
+ }
1977
+ return allValues;
1978
+ }
1979
+ const defaultKeyAttributes = {
1980
+ maxRanking: Infinity,
1981
+ minRanking: -Infinity
1982
+ };
1983
+ /**
1984
+ * Gets all the attributes for the given accessor
1985
+ * @param accessor - the accessor from which the attributes will be retrieved
1986
+ * @return object containing the accessor's attributes
1987
+ */
1988
+ function getAccessorAttributes(accessor) {
1989
+ if (typeof accessor === 'function') {
1990
+ return defaultKeyAttributes;
1991
+ }
1941
1992
  return {
1942
- position: 'absolute',
1943
- cursor: isVertical ? 'col-resize' : 'row-resize',
1944
- zIndex: 100000,
1945
- [oppositeSide]: 0,
1946
- [marginSide]: `-4px`,
1947
- ...(isVertical ? {
1948
- top: 0,
1949
- height: '100%',
1950
- width: '4px'
1951
- } : {
1952
- width: '100%',
1953
- height: '4px'
1954
- })
1993
+ ...defaultKeyAttributes,
1994
+ ...accessor
1955
1995
  };
1956
1996
  }
1957
1997
 
@@ -1971,6 +2011,7 @@
1971
2011
  }
1972
2012
  });
1973
2013
 
2014
+ Panel.displayName = 'Panel';
1974
2015
  const ActiveQueryPanel = styled('div', () => ({
1975
2016
  flex: '1 1 500px',
1976
2017
  display: 'flex',
@@ -1982,6 +2023,7 @@
1982
2023
  borderTop: `2px solid ${theme.gray}`
1983
2024
  })
1984
2025
  });
2026
+ ActiveQueryPanel.displayName = 'ActiveQueryPanel';
1985
2027
  const Button = styled('button', (props, theme) => ({
1986
2028
  appearance: 'none',
1987
2029
  fontSize: '.9em',
@@ -1994,10 +2036,14 @@
1994
2036
  opacity: props.disabled ? '.5' : undefined,
1995
2037
  cursor: 'pointer'
1996
2038
  }));
2039
+ Button.displayName = 'Button';
1997
2040
  const QueryKeys = styled('span', {
1998
- display: 'inline-block',
2041
+ display: 'flex',
2042
+ flexWrap: 'wrap',
2043
+ gap: '0.5em',
1999
2044
  fontSize: '0.9em'
2000
2045
  });
2046
+ QueryKeys.displayName = 'QueryKeys';
2001
2047
  const QueryKey = styled('span', {
2002
2048
  display: 'inline-flex',
2003
2049
  alignItems: 'center',
@@ -2006,11 +2052,13 @@
2006
2052
  textShadow: '0 0 10px black',
2007
2053
  borderRadius: '.2em'
2008
2054
  });
2055
+ QueryKey.displayName = 'QueryKey';
2009
2056
  const Code = styled('code', {
2010
2057
  fontSize: '.9em',
2011
2058
  color: 'inherit',
2012
2059
  background: 'inherit'
2013
2060
  });
2061
+ Code.displayName = 'Code';
2014
2062
  const Input = styled('input', (_props, theme) => ({
2015
2063
  backgroundColor: theme.inputBackgroundColor,
2016
2064
  border: 0,
@@ -2020,6 +2068,7 @@
2020
2068
  lineHeight: `1.3`,
2021
2069
  padding: '.3em .4em'
2022
2070
  }));
2071
+ Input.displayName = 'Input';
2023
2072
  const Select = styled('select', (_props, theme) => ({
2024
2073
  display: `inline-block`,
2025
2074
  fontSize: `.9em`,
@@ -2043,20 +2092,133 @@
2043
2092
  display: 'none'
2044
2093
  }
2045
2094
  });
2095
+ Select.displayName = 'Select';
2046
2096
 
2047
- function ScreenReader({
2048
- text
2097
+ const useSubscribeToQueryCache = (queryCache, getSnapshot, skip = false) => {
2098
+ return React.useSyncExternalStore(React.useCallback(onStoreChange => {
2099
+ if (!skip) return queryCache.subscribe(reactQuery.notifyManager.batchCalls(onStoreChange));
2100
+ return () => {
2101
+ return;
2102
+ };
2103
+ }, [queryCache, skip]), getSnapshot, getSnapshot);
2104
+ };
2105
+ var useSubscribeToQueryCache$1 = useSubscribeToQueryCache;
2106
+
2107
+ /**
2108
+ * Displays the number of queries for each status
2109
+ */
2110
+ function QueryStatusCount({
2111
+ queryCache
2049
2112
  }) {
2050
- return /*#__PURE__*/React__namespace.createElement("span", {
2113
+ const hasFresh = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fresh').length);
2114
+ const hasFetching = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fetching').length);
2115
+ const hasPaused = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'paused').length);
2116
+ const hasStale = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'stale').length);
2117
+ const hasInactive = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'inactive').length);
2118
+ return /*#__PURE__*/React.createElement(QueryKeys, null, /*#__PURE__*/React.createElement(QueryKey, {
2051
2119
  style: {
2052
- position: 'absolute',
2053
- width: '0.1px',
2054
- height: '0.1px',
2055
- overflow: 'hidden'
2120
+ background: defaultTheme.success,
2121
+ opacity: hasFresh ? 1 : 0.3
2056
2122
  }
2057
- }, text);
2123
+ }, "fresh ", /*#__PURE__*/React.createElement(Code, null, "(", hasFresh, ")")), ' ', /*#__PURE__*/React.createElement(QueryKey, {
2124
+ style: {
2125
+ background: defaultTheme.active,
2126
+ opacity: hasFetching ? 1 : 0.3
2127
+ }
2128
+ }, "fetching ", /*#__PURE__*/React.createElement(Code, null, "(", hasFetching, ")")), ' ', /*#__PURE__*/React.createElement(QueryKey, {
2129
+ style: {
2130
+ background: defaultTheme.paused,
2131
+ opacity: hasPaused ? 1 : 0.3
2132
+ }
2133
+ }, "paused ", /*#__PURE__*/React.createElement(Code, null, "(", hasPaused, ")")), ' ', /*#__PURE__*/React.createElement(QueryKey, {
2134
+ style: {
2135
+ background: defaultTheme.warning,
2136
+ color: 'black',
2137
+ textShadow: '0',
2138
+ opacity: hasStale ? 1 : 0.3
2139
+ }
2140
+ }, "stale ", /*#__PURE__*/React.createElement(Code, null, "(", hasStale, ")")), ' ', /*#__PURE__*/React.createElement(QueryKey, {
2141
+ style: {
2142
+ background: defaultTheme.gray,
2143
+ opacity: hasInactive ? 1 : 0.3
2144
+ }
2145
+ }, "inactive ", /*#__PURE__*/React.createElement(Code, null, "(", hasInactive, ")")));
2058
2146
  }
2059
2147
 
2148
+ /**
2149
+ * Row for a query in the query list
2150
+ */
2151
+ const QueryRow = /*#__PURE__*/React.memo(({
2152
+ queryKey,
2153
+ setActiveQueryHash,
2154
+ activeQueryHash,
2155
+ queryCache
2156
+ }) => {
2157
+ const queryHash = useSubscribeToQueryCache$1(queryCache, () => queryCache.find({
2158
+ queryKey
2159
+ })?.queryHash) ?? '';
2160
+ const queryState = useSubscribeToQueryCache$1(queryCache, () => queryCache.find({
2161
+ queryKey
2162
+ })?.state);
2163
+ const isStale = useSubscribeToQueryCache$1(queryCache, () => queryCache.find({
2164
+ queryKey
2165
+ })?.isStale()) ?? false;
2166
+ const isDisabled = useSubscribeToQueryCache$1(queryCache, () => queryCache.find({
2167
+ queryKey
2168
+ })?.isDisabled()) ?? false;
2169
+ const observerCount = useSubscribeToQueryCache$1(queryCache, () => queryCache.find({
2170
+ queryKey
2171
+ })?.getObserversCount()) ?? 0;
2172
+ if (!queryState) {
2173
+ return null;
2174
+ }
2175
+ return /*#__PURE__*/React.createElement("div", {
2176
+ role: "button",
2177
+ "aria-label": `Open query details for ${queryHash}`,
2178
+ onClick: () => setActiveQueryHash(activeQueryHash === queryHash ? '' : queryHash),
2179
+ style: {
2180
+ display: 'flex',
2181
+ borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
2182
+ cursor: 'pointer',
2183
+ background: queryHash === activeQueryHash ? 'rgba(255,255,255,.1)' : undefined
2184
+ }
2185
+ }, /*#__PURE__*/React.createElement("div", {
2186
+ style: {
2187
+ flex: '0 0 auto',
2188
+ width: '2em',
2189
+ height: '2em',
2190
+ background: getQueryStatusColor({
2191
+ queryState,
2192
+ isStale,
2193
+ observerCount,
2194
+ theme: defaultTheme
2195
+ }),
2196
+ display: 'flex',
2197
+ alignItems: 'center',
2198
+ justifyContent: 'center',
2199
+ fontWeight: 'bold',
2200
+ textShadow: isStale ? '0' : '0 0 10px black',
2201
+ color: isStale ? 'black' : 'white'
2202
+ }
2203
+ }, observerCount), isDisabled ? /*#__PURE__*/React.createElement("div", {
2204
+ style: {
2205
+ flex: '0 0 auto',
2206
+ height: '2em',
2207
+ background: defaultTheme.gray,
2208
+ display: 'flex',
2209
+ alignItems: 'center',
2210
+ fontWeight: 'bold',
2211
+ padding: '0 0.5em'
2212
+ }
2213
+ }, "disabled") : null, /*#__PURE__*/React.createElement(Code, {
2214
+ style: {
2215
+ padding: '.5em'
2216
+ }
2217
+ }, `${queryHash}`));
2218
+ });
2219
+ QueryRow.displayName = 'QueryRow';
2220
+ var QueryRow$1 = QueryRow;
2221
+
2060
2222
  const Entry = styled('div', {
2061
2223
  fontFamily: 'Menlo, monospace',
2062
2224
  fontSize: '1em',
@@ -2303,260 +2465,255 @@
2303
2465
  });
2304
2466
  }
2305
2467
 
2306
- function Logo(props) {
2307
- return /*#__PURE__*/React__namespace.createElement("svg", _extends({
2308
- width: "40px",
2309
- height: "40px",
2310
- viewBox: "0 0 190 190",
2311
- version: "1.1"
2312
- }, props), /*#__PURE__*/React__namespace.createElement("g", {
2313
- stroke: "none",
2314
- strokeWidth: "1",
2315
- fill: "none",
2316
- fillRule: "evenodd"
2317
- }, /*#__PURE__*/React__namespace.createElement("g", {
2318
- transform: "translate(-33.000000, 0.000000)"
2319
- }, /*#__PURE__*/React__namespace.createElement("path", {
2320
- d: "M72.7239712,61.3436237 C69.631224,46.362877 68.9675112,34.8727722 70.9666331,26.5293551 C72.1555965,21.5671678 74.3293088,17.5190846 77.6346064,14.5984631 C81.1241394,11.5150478 85.5360327,10.0020122 90.493257,10.0020122 C98.6712013,10.0020122 107.26826,13.7273214 116.455725,20.8044264 C120.20312,23.6910458 124.092437,27.170411 128.131651,31.2444746 C128.45314,30.8310265 128.816542,30.4410453 129.22143,30.0806152 C140.64098,19.9149716 150.255245,13.5989272 158.478408,11.1636507 C163.367899,9.715636 167.958526,9.57768202 172.138936,10.983031 C176.551631,12.4664684 180.06766,15.5329489 182.548314,19.8281091 C186.642288,26.9166735 187.721918,36.2310983 186.195595,47.7320243 C185.573451,52.4199112 184.50985,57.5263831 183.007094,63.0593153 C183.574045,63.1277086 184.142416,63.2532808 184.705041,63.4395297 C199.193932,68.2358678 209.453582,73.3937462 215.665021,79.2882839 C219.360669,82.7953831 221.773972,86.6998434 222.646365,91.0218204 C223.567176,95.5836746 222.669313,100.159332 220.191548,104.451297 C216.105211,111.529614 208.591643,117.11221 197.887587,121.534031 C193.589552,123.309539 188.726579,124.917559 183.293259,126.363748 C183.541176,126.92292 183.733521,127.516759 183.862138,128.139758 C186.954886,143.120505 187.618598,154.61061 185.619477,162.954027 C184.430513,167.916214 182.256801,171.964297 178.951503,174.884919 C175.46197,177.968334 171.050077,179.48137 166.092853,179.48137 C157.914908,179.48137 149.31785,175.756061 140.130385,168.678956 C136.343104,165.761613 132.410866,162.238839 128.325434,158.108619 C127.905075,158.765474 127.388968,159.376011 126.77857,159.919385 C115.35902,170.085028 105.744755,176.401073 97.5215915,178.836349 C92.6321009,180.284364 88.0414736,180.422318 83.8610636,179.016969 C79.4483686,177.533532 75.9323404,174.467051 73.4516862,170.171891 C69.3577116,163.083327 68.2780823,153.768902 69.8044053,142.267976 C70.449038,137.410634 71.56762,132.103898 73.1575891,126.339009 C72.5361041,126.276104 71.9120754,126.144816 71.2949591,125.940529 C56.8060684,121.144191 46.5464184,115.986312 40.3349789,110.091775 C36.6393312,106.584675 34.2260275,102.680215 33.3536352,98.3582381 C32.4328237,93.7963839 33.3306866,89.2207269 35.8084524,84.9287618 C39.8947886,77.8504443 47.4083565,72.2678481 58.1124133,67.8460273 C62.5385143,66.0176154 67.5637208,64.366822 73.1939394,62.8874674 C72.9933393,62.3969171 72.8349374,61.8811235 72.7239712,61.3436237 Z",
2321
- fill: "#002C4B",
2322
- fillRule: "nonzero",
2323
- transform: "translate(128.000000, 95.000000) scale(-1, 1) translate(-128.000000, -95.000000) "
2324
- }), /*#__PURE__*/React__namespace.createElement("path", {
2325
- d: "M113.396882,64 L142.608177,64 C144.399254,64 146.053521,64.958025 146.944933,66.5115174 L161.577138,92.0115174 C162.461464,93.5526583 162.461464,95.4473417 161.577138,96.9884826 L146.944933,122.488483 C146.053521,124.041975 144.399254,125 142.608177,125 L113.396882,125 C111.605806,125 109.951539,124.041975 109.060126,122.488483 L94.4279211,96.9884826 C93.543596,95.4473417 93.543596,93.5526583 94.4279211,92.0115174 L109.060126,66.5115174 C109.951539,64.958025 111.605806,64 113.396882,64 Z M138.987827,70.2765273 C140.779849,70.2765273 142.434839,71.2355558 143.325899,72.7903404 L154.343038,92.0138131 C155.225607,93.5537825 155.225607,95.4462175 154.343038,96.9861869 L143.325899,116.20966 C142.434839,117.764444 140.779849,118.723473 138.987827,118.723473 L117.017233,118.723473 C115.225211,118.723473 113.570221,117.764444 112.67916,116.20966 L101.662022,96.9861869 C100.779452,95.4462175 100.779452,93.5537825 101.662022,92.0138131 L112.67916,72.7903404 C113.570221,71.2355558 115.225211,70.2765273 117.017233,70.2765273 L138.987827,70.2765273 Z M135.080648,77.1414791 L120.924411,77.1414791 C119.134228,77.1414791 117.480644,78.0985567 116.5889,79.6508285 L116.5889,79.6508285 L109.489217,92.0093494 C108.603232,93.5515958 108.603232,95.4484042 109.489217,96.9906506 L109.489217,96.9906506 L116.5889,109.349172 C117.480644,110.901443 119.134228,111.858521 120.924411,111.858521 L120.924411,111.858521 L135.080648,111.858521 C136.870831,111.858521 138.524416,110.901443 139.41616,109.349172 L139.41616,109.349172 L146.515843,96.9906506 C147.401828,95.4484042 147.401828,93.5515958 146.515843,92.0093494 L146.515843,92.0093494 L139.41616,79.6508285 C138.524416,78.0985567 136.870831,77.1414791 135.080648,77.1414791 L135.080648,77.1414791 Z M131.319186,83.7122186 C133.108028,83.7122186 134.760587,84.6678753 135.652827,86.2183156 L138.983552,92.0060969 C139.87203,93.5500005 139.87203,95.4499995 138.983552,96.9939031 L135.652827,102.781684 C134.760587,104.332125 133.108028,105.287781 131.319186,105.287781 L124.685874,105.287781 C122.897032,105.287781 121.244473,104.332125 120.352233,102.781684 L117.021508,96.9939031 C116.13303,95.4499995 116.13303,93.5500005 117.021508,92.0060969 L120.352233,86.2183156 C121.244473,84.6678753 122.897032,83.7122186 124.685874,83.7122186 L131.319186,83.7122186 Z M128.003794,90.1848875 C126.459294,90.1848875 125.034382,91.0072828 124.263005,92.3424437 C123.491732,93.6774232 123.491732,95.3225768 124.263005,96.6575563 C125.034382,97.9927172 126.459294,98.8151125 128.001266,98.8151125 L128.001266,98.8151125 C129.545766,98.8151125 130.970678,97.9927172 131.742055,96.6575563 C132.513327,95.3225768 132.513327,93.6774232 131.742055,92.3424437 C130.970678,91.0072828 129.545766,90.1848875 128.003794,90.1848875 L128.003794,90.1848875 Z M93,94.5009646 L100.767764,94.5009646",
2326
- fill: "#FFD94C"
2327
- }), /*#__PURE__*/React__namespace.createElement("path", {
2328
- d: "M87.8601729,108.357758 C89.1715224,107.608286 90.8360246,108.074601 91.5779424,109.399303 L91.5779424,109.399303 L92.0525843,110.24352 C95.8563392,116.982993 99.8190116,123.380176 103.940602,129.435068 C108.807881,136.585427 114.28184,143.82411 120.362479,151.151115 C121.316878,152.30114 121.184944,154.011176 120.065686,154.997937 L120.065686,154.997937 L119.454208,155.534625 C99.3465389,173.103314 86.2778188,176.612552 80.2480482,166.062341 C74.3500652,155.742717 76.4844915,136.982888 86.6513274,109.782853 C86.876818,109.179582 87.3045861,108.675291 87.8601729,108.357758 Z M173.534177,129.041504 C174.986131,128.785177 176.375496,129.742138 176.65963,131.194242 L176.65963,131.194242 L176.812815,131.986376 C181.782365,157.995459 178.283348,171 166.315764,171 C154.609745,171 139.708724,159.909007 121.612702,137.727022 C121.211349,137.235047 120.994572,136.617371 121,135.981509 C121.013158,134.480686 122.235785,133.274651 123.730918,133.287756 L123.730918,133.287756 L124.684654,133.294531 C132.305698,133.335994 139.714387,133.071591 146.910723,132.501323 C155.409039,131.82788 164.283523,130.674607 173.534177,129.041504 Z M180.408726,73.8119663 C180.932139,72.4026903 182.508386,71.6634537 183.954581,72.149012 L183.954581,72.149012 L184.742552,72.4154854 C210.583763,81.217922 220.402356,90.8916805 214.198332,101.436761 C208.129904,111.751366 190.484347,119.260339 161.26166,123.963678 C160.613529,124.067994 159.948643,123.945969 159.382735,123.618843 C158.047025,122.846729 157.602046,121.158214 158.388848,119.847438 L158.388848,119.847438 L158.889328,119.0105 C162.877183,112.31633 166.481358,105.654262 169.701854,99.0242957 C173.50501,91.1948179 177.073967,82.7907081 180.408726,73.8119663 Z M94.7383398,66.0363218 C95.3864708,65.9320063 96.0513565,66.0540315 96.6172646,66.3811573 C97.9529754,67.153271 98.3979538,68.8417862 97.6111517,70.1525615 L97.6111517,70.1525615 L97.1106718,70.9895001 C93.1228168,77.6836699 89.5186416,84.3457379 86.2981462,90.9757043 C82.49499,98.8051821 78.9260328,107.209292 75.5912744,116.188034 C75.0678608,117.59731 73.4916142,118.336546 72.045419,117.850988 L72.045419,117.850988 L71.2574475,117.584515 C45.4162372,108.782078 35.597644,99.1083195 41.8016679,88.5632391 C47.8700957,78.2486335 65.515653,70.7396611 94.7383398,66.0363218 Z M136.545792,34.4653746 C156.653461,16.8966864 169.722181,13.3874478 175.751952,23.9376587 C181.649935,34.2572826 179.515508,53.0171122 169.348673,80.2171474 C169.123182,80.8204179 168.695414,81.324709 168.139827,81.6422422 C166.828478,82.3917144 165.163975,81.9253986 164.422058,80.6006966 L164.422058,80.6006966 L163.947416,79.7564798 C160.143661,73.0170065 156.180988,66.6198239 152.059398,60.564932 C147.192119,53.4145727 141.71816,46.1758903 135.637521,38.8488847 C134.683122,37.6988602 134.815056,35.9888243 135.934314,35.0020629 L135.934314,35.0020629 Z M90.6842361,18 C102.390255,18 117.291276,29.0909926 135.387298,51.2729777 C135.788651,51.7649527 136.005428,52.3826288 136,53.0184911 C135.986842,54.5193144 134.764215,55.7253489 133.269082,55.7122445 L133.269082,55.7122445 L132.315346,55.7054689 C124.694302,55.6640063 117.285613,55.9284091 110.089277,56.4986773 C101.590961,57.17212 92.7164767,58.325393 83.4658235,59.9584962 C82.0138691,60.2148231 80.6245044,59.2578618 80.3403697,57.805758 L80.3403697,57.805758 L80.1871846,57.0136235 C75.2176347,31.0045412 78.7166519,18 90.6842361,18 Z",
2329
- fill: "#FF4154"
2330
- }))));
2331
- }
2332
-
2333
- function ReactQueryDevtools$1({
2334
- initialIsOpen,
2335
- panelProps = {},
2336
- closeButtonProps = {},
2337
- toggleButtonProps = {},
2338
- position = 'bottom-left',
2339
- containerElement: Container = 'aside',
2340
- queryClient,
2341
- styleNonce,
2342
- panelPosition: initialPanelPosition = 'bottom'
2343
- }) {
2344
- const rootRef = React__namespace.useRef(null);
2345
- const panelRef = React__namespace.useRef(null);
2346
- const [isOpen, setIsOpen] = useLocalStorage('reactQueryDevtoolsOpen', initialIsOpen);
2347
- const [devtoolsHeight, setDevtoolsHeight] = useLocalStorage('reactQueryDevtoolsHeight', defaultPanelSize);
2348
- const [devtoolsWidth, setDevtoolsWidth] = useLocalStorage('reactQueryDevtoolsWidth', defaultPanelSize);
2349
- const [panelPosition = 'bottom', setPanelPosition] = useLocalStorage('reactQueryDevtoolsPanelPosition', initialPanelPosition);
2350
- const [isResolvedOpen, setIsResolvedOpen] = React__namespace.useState(false);
2351
- const [isResizing, setIsResizing] = React__namespace.useState(false);
2352
- const isMounted = useIsMounted();
2353
- const handleDragStart = (panelElement, startEvent) => {
2354
- if (!panelElement) return;
2355
- if (startEvent.button !== 0) return; // Only allow left click for drag
2356
- const isVertical = isVerticalSide(panelPosition);
2357
- setIsResizing(true);
2358
- const {
2359
- height,
2360
- width
2361
- } = panelElement.getBoundingClientRect();
2362
- const startX = startEvent.clientX;
2363
- const startY = startEvent.clientY;
2364
- let newSize = 0;
2365
- const run = moveEvent => {
2366
- // prevent mouse selecting stuff with mouse drag
2367
- moveEvent.preventDefault();
2468
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
2469
+ function noop() {}
2368
2470
 
2369
- // calculate the correct size based on mouse position and current panel position
2370
- // hint: it is different formula for the opposite sides
2371
- if (isVertical) {
2372
- newSize = width + (panelPosition === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX);
2373
- setDevtoolsWidth(newSize);
2374
- } else {
2375
- newSize = height + (panelPosition === 'bottom' ? startY - moveEvent.clientY : moveEvent.clientY - startY);
2376
- setDevtoolsHeight(newSize);
2471
+ /**
2472
+ * Panel for the query currently being inspected
2473
+ *
2474
+ * It displays query details (key, observers...), query actions,
2475
+ * the data explorer and the query explorer
2476
+ */
2477
+ const ActiveQuery = ({
2478
+ queryCache,
2479
+ activeQueryHash,
2480
+ queryClient,
2481
+ errorTypes
2482
+ }) => {
2483
+ const activeQuery = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash));
2484
+ const activeQueryState = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.state);
2485
+ const isStale = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.isStale()) ?? false;
2486
+ const observerCount = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.getObserversCount()) ?? 0;
2487
+ const handleRefetch = () => {
2488
+ const promise = activeQuery?.fetch();
2489
+ promise?.catch(noop);
2490
+ };
2491
+ const currentErrorTypeName = React.useMemo(() => {
2492
+ if (activeQuery && activeQueryState?.error) {
2493
+ const errorType = errorTypes.find(type => type.initializer(activeQuery).toString() === activeQueryState.error?.toString());
2494
+ return errorType?.name;
2495
+ }
2496
+ return undefined;
2497
+ }, [activeQuery, activeQueryState?.error, errorTypes]);
2498
+ if (!activeQuery || !activeQueryState) {
2499
+ return null;
2500
+ }
2501
+ const triggerError = errorType => {
2502
+ const error = errorType?.initializer(activeQuery) ?? new Error('Unknown error from devtools');
2503
+ const __previousQueryOptions = activeQuery.options;
2504
+ activeQuery.setState({
2505
+ status: 'error',
2506
+ error,
2507
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
2508
+ fetchMeta: {
2509
+ ...activeQuery.state.fetchMeta,
2510
+ __previousQueryOptions
2377
2511
  }
2378
- if (newSize < minPanelSize) {
2379
- setIsOpen(false);
2512
+ });
2513
+ };
2514
+ const restoreQueryAfterLoadingOrError = () => {
2515
+ activeQuery.fetch(activeQuery.state.fetchMeta.__previousQueryOptions, {
2516
+ // Make sure this fetch will cancel the previous one
2517
+ cancelRefetch: true
2518
+ });
2519
+ };
2520
+ return /*#__PURE__*/React.createElement(ActiveQueryPanel, null, /*#__PURE__*/React.createElement("div", {
2521
+ style: {
2522
+ padding: '.5em',
2523
+ background: defaultTheme.backgroundAlt,
2524
+ position: 'sticky',
2525
+ top: 0,
2526
+ zIndex: 1
2527
+ }
2528
+ }, "Query Details"), /*#__PURE__*/React.createElement("div", {
2529
+ style: {
2530
+ padding: '.5em'
2531
+ }
2532
+ }, /*#__PURE__*/React.createElement("div", {
2533
+ style: {
2534
+ marginBottom: '.5em',
2535
+ display: 'flex',
2536
+ alignItems: 'flex-start',
2537
+ justifyContent: 'space-between'
2538
+ }
2539
+ }, /*#__PURE__*/React.createElement(Code, {
2540
+ style: {
2541
+ lineHeight: '1.8em'
2542
+ }
2543
+ }, /*#__PURE__*/React.createElement("pre", {
2544
+ style: {
2545
+ margin: 0,
2546
+ padding: 0,
2547
+ overflow: 'auto'
2548
+ }
2549
+ }, displayValue(activeQuery.queryKey, true))), /*#__PURE__*/React.createElement("span", {
2550
+ style: {
2551
+ padding: '0.3em .6em',
2552
+ borderRadius: '0.4em',
2553
+ fontWeight: 'bold',
2554
+ textShadow: '0 2px 10px black',
2555
+ background: getQueryStatusColor({
2556
+ queryState: activeQueryState,
2557
+ isStale: isStale,
2558
+ observerCount: observerCount,
2559
+ theme: defaultTheme
2560
+ }),
2561
+ flexShrink: 0
2562
+ }
2563
+ }, getQueryStatusLabel(activeQuery))), /*#__PURE__*/React.createElement("div", {
2564
+ style: {
2565
+ marginBottom: '.5em',
2566
+ display: 'flex',
2567
+ alignItems: 'center',
2568
+ justifyContent: 'space-between'
2569
+ }
2570
+ }, "Observers: ", /*#__PURE__*/React.createElement(Code, null, observerCount)), /*#__PURE__*/React.createElement("div", {
2571
+ style: {
2572
+ display: 'flex',
2573
+ alignItems: 'center',
2574
+ justifyContent: 'space-between'
2575
+ }
2576
+ }, "Last Updated:", ' ', /*#__PURE__*/React.createElement(Code, null, new Date(activeQueryState.dataUpdatedAt).toLocaleTimeString()))), /*#__PURE__*/React.createElement("div", {
2577
+ style: {
2578
+ background: defaultTheme.backgroundAlt,
2579
+ padding: '.5em',
2580
+ position: 'sticky',
2581
+ top: 0,
2582
+ zIndex: 1
2583
+ }
2584
+ }, "Actions"), /*#__PURE__*/React.createElement("div", {
2585
+ style: {
2586
+ padding: '0.5em',
2587
+ display: 'flex',
2588
+ flexWrap: 'wrap',
2589
+ gap: '0.5em',
2590
+ alignItems: 'flex-end'
2591
+ }
2592
+ }, /*#__PURE__*/React.createElement(Button, {
2593
+ type: "button",
2594
+ onClick: handleRefetch,
2595
+ disabled: activeQueryState.fetchStatus === 'fetching',
2596
+ style: {
2597
+ background: defaultTheme.active
2598
+ }
2599
+ }, "Refetch"), ' ', /*#__PURE__*/React.createElement(Button, {
2600
+ type: "button",
2601
+ onClick: () => queryClient.invalidateQueries(activeQuery),
2602
+ style: {
2603
+ background: defaultTheme.warning,
2604
+ color: defaultTheme.inputTextColor
2605
+ }
2606
+ }, "Invalidate"), ' ', /*#__PURE__*/React.createElement(Button, {
2607
+ type: "button",
2608
+ onClick: () => queryClient.resetQueries(activeQuery),
2609
+ style: {
2610
+ background: defaultTheme.gray
2611
+ }
2612
+ }, "Reset"), ' ', /*#__PURE__*/React.createElement(Button, {
2613
+ type: "button",
2614
+ onClick: () => queryClient.removeQueries(activeQuery),
2615
+ style: {
2616
+ background: defaultTheme.danger
2617
+ }
2618
+ }, "Remove"), ' ', /*#__PURE__*/React.createElement(Button, {
2619
+ type: "button",
2620
+ onClick: () => {
2621
+ if (activeQuery.state.data === undefined) {
2622
+ restoreQueryAfterLoadingOrError();
2380
2623
  } else {
2381
- setIsOpen(true);
2382
- }
2383
- };
2384
- const unsub = () => {
2385
- if (isResizing) {
2386
- setIsResizing(false);
2624
+ const __previousQueryOptions = activeQuery.options;
2625
+ // Trigger a fetch in order to trigger suspense as well.
2626
+ activeQuery.fetch({
2627
+ ...__previousQueryOptions,
2628
+ queryFn: () => {
2629
+ return new Promise(() => {
2630
+ // Never resolve
2631
+ });
2632
+ },
2633
+ gcTime: -1
2634
+ });
2635
+ activeQuery.setState({
2636
+ data: undefined,
2637
+ status: 'pending',
2638
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
2639
+ fetchMeta: {
2640
+ ...activeQuery.state.fetchMeta,
2641
+ __previousQueryOptions
2642
+ }
2643
+ });
2387
2644
  }
2388
- document.removeEventListener('mousemove', run, false);
2389
- document.removeEventListener('mouseUp', unsub, false);
2390
- };
2391
- document.addEventListener('mousemove', run, false);
2392
- document.addEventListener('mouseup', unsub, false);
2393
- };
2394
- React__namespace.useEffect(() => {
2395
- setIsResolvedOpen(isOpen ?? false);
2396
- }, [isOpen, isResolvedOpen, setIsResolvedOpen]);
2397
-
2398
- // Toggle panel visibility before/after transition (depending on direction).
2399
- // Prevents focusing in a closed panel.
2400
- React__namespace.useEffect(() => {
2401
- const ref = panelRef.current;
2402
- if (ref) {
2403
- const handlePanelTransitionStart = () => {
2404
- if (isResolvedOpen) {
2405
- ref.style.visibility = 'visible';
2406
- }
2407
- };
2408
- const handlePanelTransitionEnd = () => {
2409
- if (!isResolvedOpen) {
2410
- ref.style.visibility = 'hidden';
2411
- }
2412
- };
2413
- ref.addEventListener('transitionstart', handlePanelTransitionStart);
2414
- ref.addEventListener('transitionend', handlePanelTransitionEnd);
2415
- return () => {
2416
- ref.removeEventListener('transitionstart', handlePanelTransitionStart);
2417
- ref.removeEventListener('transitionend', handlePanelTransitionEnd);
2418
- };
2645
+ },
2646
+ style: {
2647
+ background: defaultTheme.paused
2419
2648
  }
2420
- return;
2421
- }, [isResolvedOpen]);
2422
- React__namespace.useEffect(() => {
2423
- if (isResolvedOpen && rootRef.current?.parentElement) {
2424
- const {
2425
- parentElement
2426
- } = rootRef.current;
2427
- const styleProp = getSidedProp('padding', panelPosition);
2428
- const isVertical = isVerticalSide(panelPosition);
2429
- const previousPaddings = (({
2430
- padding,
2431
- paddingTop,
2432
- paddingBottom,
2433
- paddingLeft,
2434
- paddingRight
2435
- }) => ({
2436
- padding,
2437
- paddingTop,
2438
- paddingBottom,
2439
- paddingLeft,
2440
- paddingRight
2441
- }))(parentElement.style);
2442
- const run = () => {
2443
- // reset the padding
2444
- parentElement.style.padding = '0px';
2445
- parentElement.style.paddingTop = '0px';
2446
- parentElement.style.paddingBottom = '0px';
2447
- parentElement.style.paddingLeft = '0px';
2448
- parentElement.style.paddingRight = '0px';
2449
- // set the new padding based on the new panel position
2450
-
2451
- parentElement.style[styleProp] = `${isVertical ? devtoolsWidth : devtoolsHeight}px`;
2452
- };
2453
- run();
2454
- if (typeof window !== 'undefined') {
2455
- window.addEventListener('resize', run);
2456
- return () => {
2457
- window.removeEventListener('resize', run);
2458
- Object.entries(previousPaddings).forEach(([property, previousValue]) => {
2459
- parentElement.style[property] = previousValue;
2460
- });
2461
- };
2649
+ }, activeQuery.state.status === 'pending' ? 'Restore' : 'Trigger', ' ', "loading"), ' ', errorTypes.length === 0 || activeQuery.state.status === 'error' ? /*#__PURE__*/React.createElement(Button, {
2650
+ type: "button",
2651
+ onClick: () => {
2652
+ if (!activeQuery.state.error) {
2653
+ triggerError();
2654
+ } else {
2655
+ queryClient.resetQueries(activeQuery);
2462
2656
  }
2657
+ },
2658
+ style: {
2659
+ background: defaultTheme.danger
2463
2660
  }
2464
- return;
2465
- }, [isResolvedOpen, panelPosition, devtoolsHeight, devtoolsWidth]);
2466
- const {
2467
- style: panelStyle = {},
2468
- ...otherPanelProps
2469
- } = panelProps;
2470
- const {
2471
- style: toggleButtonStyle = {},
2472
- onClick: onToggleClick,
2473
- ...otherToggleButtonProps
2474
- } = toggleButtonProps;
2475
-
2476
- // get computed style based on panel position
2477
- const style = getSidePanelStyle({
2478
- position: panelPosition,
2479
- devtoolsTheme: defaultTheme,
2480
- isOpen: isResolvedOpen,
2481
- height: devtoolsHeight,
2482
- width: devtoolsWidth,
2483
- isResizing,
2484
- panelStyle
2485
- });
2486
-
2487
- // Do not render on the server
2488
- if (!isMounted()) return null;
2489
- return /*#__PURE__*/React__namespace.createElement(Container, {
2490
- ref: rootRef,
2491
- className: "ReactQueryDevtools",
2492
- "aria-label": "React Query Devtools"
2493
- }, /*#__PURE__*/React__namespace.createElement(ThemeProvider, {
2494
- theme: defaultTheme
2495
- }, /*#__PURE__*/React__namespace.createElement(ReactQueryDevtoolsPanel$1, _extends({
2496
- ref: panelRef,
2497
- queryClient: queryClient,
2498
- styleNonce: styleNonce,
2499
- position: panelPosition,
2500
- onPositionChange: setPanelPosition,
2501
- showCloseButton: true,
2502
- closeButtonProps: closeButtonProps
2503
- }, otherPanelProps, {
2504
- style: style,
2505
- isOpen: isResolvedOpen,
2506
- setIsOpen: setIsOpen,
2507
- onDragStart: e => handleDragStart(panelRef.current, e)
2508
- }))), !isResolvedOpen ? /*#__PURE__*/React__namespace.createElement("button", _extends({
2509
- type: "button"
2510
- }, otherToggleButtonProps, {
2511
- "aria-label": "Open React Query Devtools",
2512
- "aria-controls": "ReactQueryDevtoolsPanel",
2513
- "aria-haspopup": "true",
2514
- "aria-expanded": "false",
2515
- onClick: e => {
2516
- setIsOpen(true);
2517
- onToggleClick?.(e);
2661
+ }, activeQuery.state.status === 'error' ? 'Restore' : 'Trigger', " error") : /*#__PURE__*/React.createElement("label", null, "Trigger error:", /*#__PURE__*/React.createElement(Select, {
2662
+ value: currentErrorTypeName ?? '',
2663
+ style: {
2664
+ marginInlineStart: '.5em'
2518
2665
  },
2666
+ onChange: e => {
2667
+ const errorType = errorTypes.find(t => t.name === e.target.value);
2668
+ triggerError(errorType);
2669
+ }
2670
+ }, /*#__PURE__*/React.createElement("option", {
2671
+ key: "",
2672
+ value: ""
2673
+ }), errorTypes.map(errorType => /*#__PURE__*/React.createElement("option", {
2674
+ key: errorType.name,
2675
+ value: errorType.name
2676
+ }, errorType.name))))), /*#__PURE__*/React.createElement("div", {
2677
+ style: {
2678
+ background: defaultTheme.backgroundAlt,
2679
+ padding: '.5em',
2680
+ position: 'sticky',
2681
+ top: 0,
2682
+ zIndex: 1
2683
+ }
2684
+ }, "Data Explorer"), /*#__PURE__*/React.createElement("div", {
2685
+ style: {
2686
+ padding: '.5em'
2687
+ }
2688
+ }, /*#__PURE__*/React.createElement(Explorer, {
2689
+ label: "Data",
2690
+ value: activeQueryState.data,
2691
+ defaultExpanded: {},
2692
+ copyable: true
2693
+ })), /*#__PURE__*/React.createElement("div", {
2519
2694
  style: {
2520
- background: 'none',
2521
- border: 0,
2522
- padding: 0,
2523
- position: 'fixed',
2524
- zIndex: 99999,
2525
- display: 'inline-flex',
2526
- fontSize: '1.5em',
2527
- margin: '.5em',
2528
- cursor: 'pointer',
2529
- width: 'fit-content',
2530
- ...(position === 'top-right' ? {
2531
- top: '0',
2532
- right: '0'
2533
- } : position === 'top-left' ? {
2534
- top: '0',
2535
- left: '0'
2536
- } : position === 'bottom-right' ? {
2537
- bottom: '0',
2538
- right: '0'
2539
- } : {
2540
- bottom: '0',
2541
- left: '0'
2542
- }),
2543
- ...toggleButtonStyle
2695
+ background: defaultTheme.backgroundAlt,
2696
+ padding: '.5em',
2697
+ position: 'sticky',
2698
+ top: 0,
2699
+ zIndex: 1
2544
2700
  }
2545
- }), /*#__PURE__*/React__namespace.createElement(Logo, {
2546
- "aria-hidden": true
2547
- }), /*#__PURE__*/React__namespace.createElement(ScreenReader, {
2548
- text: "Open React Query Devtools"
2549
- })) : null);
2550
- }
2551
- const useSubscribeToQueryCache = (queryCache, getSnapshot, skip = false) => {
2552
- return React__namespace.useSyncExternalStore(React__namespace.useCallback(onStoreChange => {
2553
- if (!skip) return queryCache.subscribe(reactQuery.notifyManager.batchCalls(onStoreChange));
2554
- return () => {
2555
- return;
2556
- };
2557
- }, [queryCache, skip]), getSnapshot, getSnapshot);
2701
+ }, "Query Explorer"), /*#__PURE__*/React.createElement("div", {
2702
+ style: {
2703
+ padding: '.5em'
2704
+ }
2705
+ }, /*#__PURE__*/React.createElement(Explorer, {
2706
+ label: "Query",
2707
+ value: activeQuery,
2708
+ defaultExpanded: {
2709
+ queryKey: true
2710
+ }
2711
+ })));
2558
2712
  };
2559
- const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
2713
+ ActiveQuery.displayName = 'ActiveQuery';
2714
+ var ActiveQuery$1 = ActiveQuery;
2715
+
2716
+ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
2560
2717
  const {
2561
2718
  isOpen = true,
2562
2719
  styleNonce,
@@ -2567,6 +2724,7 @@
2567
2724
  showCloseButton,
2568
2725
  position,
2569
2726
  closeButtonProps = {},
2727
+ errorTypes = [],
2570
2728
  ...panelProps
2571
2729
  } = props;
2572
2730
  const {
@@ -2578,10 +2736,10 @@
2578
2736
  const [sort, setSort] = useLocalStorage('reactQueryDevtoolsSortFn', Object.keys(sortFns)[0]);
2579
2737
  const [filter, setFilter] = useLocalStorage('reactQueryDevtoolsFilter', '');
2580
2738
  const [baseSort, setBaseSort] = useLocalStorage('reactQueryDevtoolsBaseSort', 1);
2581
- const sortFn = React__namespace.useMemo(() => sortFns[sort], [sort]);
2582
- const queriesCount = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().length, !isOpen);
2739
+ const sortFn = React.useMemo(() => sortFns[sort], [sort]);
2740
+ const queriesCount = useSubscribeToQueryCache$1(queryCache, () => queryCache.getAll().length, !isOpen);
2583
2741
  const [activeQueryHash, setActiveQueryHash] = useLocalStorage('reactQueryDevtoolsActiveQueryHash', '');
2584
- const queries = React__namespace.useMemo(() => {
2742
+ const queries = React.useMemo(() => {
2585
2743
  const unsortedQueries = queryCache.getAll();
2586
2744
  if (queriesCount === 0) {
2587
2745
  return [];
@@ -2590,10 +2748,10 @@
2590
2748
  const sorted = sortFn ? filtered.sort((a, b) => sortFn(a, b) * baseSort) : filtered;
2591
2749
  return sorted;
2592
2750
  }, [baseSort, sortFn, filter, queriesCount, queryCache]);
2593
- const [isMockOffline, setMockOffline] = React__namespace.useState(false);
2594
- return /*#__PURE__*/React__namespace.createElement(ThemeProvider, {
2751
+ const [isMockOffline, setMockOffline] = React.useState(false);
2752
+ return /*#__PURE__*/React.createElement(ThemeProvider, {
2595
2753
  theme: defaultTheme
2596
- }, /*#__PURE__*/React__namespace.createElement(Panel, _extends({
2754
+ }, /*#__PURE__*/React.createElement(Panel, _extends({
2597
2755
  ref: ref,
2598
2756
  className: "ReactQueryDevtoolsPanel",
2599
2757
  "aria-label": "React Query Devtools Panel",
@@ -2604,7 +2762,7 @@
2604
2762
  position: 'relative',
2605
2763
  ...panelProps.style
2606
2764
  }
2607
- }), /*#__PURE__*/React__namespace.createElement("style", {
2765
+ }), /*#__PURE__*/React.createElement("style", {
2608
2766
  nonce: styleNonce,
2609
2767
  dangerouslySetInnerHTML: {
2610
2768
  __html: `
@@ -2628,10 +2786,10 @@
2628
2786
  }
2629
2787
  `
2630
2788
  }
2631
- }), /*#__PURE__*/React__namespace.createElement("div", {
2789
+ }), /*#__PURE__*/React.createElement("div", {
2632
2790
  style: getResizeHandleStyle(position),
2633
2791
  onMouseDown: onDragStart
2634
- }), isOpen && /*#__PURE__*/React__namespace.createElement("div", {
2792
+ }), isOpen && /*#__PURE__*/React.createElement("div", {
2635
2793
  style: {
2636
2794
  flex: '1 1 500px',
2637
2795
  minHeight: '40%',
@@ -2641,7 +2799,7 @@
2641
2799
  display: 'flex',
2642
2800
  flexDirection: 'column'
2643
2801
  }
2644
- }, /*#__PURE__*/React__namespace.createElement("div", {
2802
+ }, /*#__PURE__*/React.createElement("div", {
2645
2803
  style: {
2646
2804
  padding: '.5em',
2647
2805
  background: defaultTheme.backgroundAlt,
@@ -2649,7 +2807,7 @@
2649
2807
  justifyContent: 'space-between',
2650
2808
  alignItems: 'center'
2651
2809
  }
2652
- }, /*#__PURE__*/React__namespace.createElement("button", {
2810
+ }, /*#__PURE__*/React.createElement("button", {
2653
2811
  type: "button",
2654
2812
  "aria-label": "Close React Query Devtools",
2655
2813
  "aria-controls": "ReactQueryDevtoolsPanel",
@@ -2664,45 +2822,47 @@
2664
2822
  marginRight: '.5em',
2665
2823
  cursor: 'pointer'
2666
2824
  }
2667
- }, /*#__PURE__*/React__namespace.createElement(Logo, {
2825
+ }, /*#__PURE__*/React.createElement(Logo, {
2668
2826
  "aria-hidden": true
2669
- }), /*#__PURE__*/React__namespace.createElement(ScreenReader, {
2827
+ }), /*#__PURE__*/React.createElement(ScreenReader, {
2670
2828
  text: "Close React Query Devtools"
2671
- })), /*#__PURE__*/React__namespace.createElement("div", {
2829
+ })), /*#__PURE__*/React.createElement("div", {
2672
2830
  style: {
2673
2831
  display: 'flex',
2674
2832
  flexDirection: 'column'
2675
2833
  }
2676
- }, /*#__PURE__*/React__namespace.createElement("div", {
2834
+ }, /*#__PURE__*/React.createElement("div", {
2677
2835
  style: {
2678
2836
  display: 'flex',
2679
2837
  justifyContent: 'space-between',
2680
2838
  alignItems: 'center',
2681
2839
  marginBottom: '.5em'
2682
2840
  }
2683
- }, /*#__PURE__*/React__namespace.createElement(QueryStatusCount, {
2841
+ }, /*#__PURE__*/React.createElement(QueryStatusCount, {
2684
2842
  queryCache: queryCache
2685
- }), position && onPositionChange ? /*#__PURE__*/React__namespace.createElement(Select, {
2843
+ }), position && onPositionChange ? /*#__PURE__*/React.createElement(Select, {
2686
2844
  "aria-label": "Panel position",
2687
2845
  value: position,
2688
2846
  style: {
2689
2847
  marginInlineStart: '.5em'
2690
2848
  },
2691
2849
  onChange: e => onPositionChange(e.target.value)
2692
- }, /*#__PURE__*/React__namespace.createElement("option", {
2850
+ }, /*#__PURE__*/React.createElement("option", {
2693
2851
  value: "left"
2694
- }, "Left"), /*#__PURE__*/React__namespace.createElement("option", {
2852
+ }, "Left"), /*#__PURE__*/React.createElement("option", {
2695
2853
  value: "right"
2696
- }, "Right"), /*#__PURE__*/React__namespace.createElement("option", {
2854
+ }, "Right"), /*#__PURE__*/React.createElement("option", {
2697
2855
  value: "top"
2698
- }, "Top"), /*#__PURE__*/React__namespace.createElement("option", {
2856
+ }, "Top"), /*#__PURE__*/React.createElement("option", {
2699
2857
  value: "bottom"
2700
- }, "Bottom")) : null), /*#__PURE__*/React__namespace.createElement("div", {
2858
+ }, "Bottom")) : null), /*#__PURE__*/React.createElement("div", {
2701
2859
  style: {
2702
2860
  display: 'flex',
2703
- alignItems: 'center'
2861
+ alignItems: 'center',
2862
+ flexWrap: 'wrap',
2863
+ gap: '0.5em'
2704
2864
  }
2705
- }, /*#__PURE__*/React__namespace.createElement(Input, {
2865
+ }, /*#__PURE__*/React.createElement(Input, {
2706
2866
  placeholder: "Filter",
2707
2867
  "aria-label": "Filter by queryhash",
2708
2868
  value: filter ?? '',
@@ -2712,10 +2872,9 @@
2712
2872
  },
2713
2873
  style: {
2714
2874
  flex: '1',
2715
- marginRight: '.5em',
2716
2875
  width: '100%'
2717
2876
  }
2718
- }), /*#__PURE__*/React__namespace.createElement(Select, {
2877
+ }), /*#__PURE__*/React.createElement(Select, {
2719
2878
  "aria-label": "Sort queries",
2720
2879
  value: sort,
2721
2880
  onChange: e => setSort(e.target.value),
@@ -2724,17 +2883,26 @@
2724
2883
  minWidth: 75,
2725
2884
  marginRight: '.5em'
2726
2885
  }
2727
- }, Object.keys(sortFns).map(key => /*#__PURE__*/React__namespace.createElement("option", {
2886
+ }, Object.keys(sortFns).map(key => /*#__PURE__*/React.createElement("option", {
2728
2887
  key: key,
2729
2888
  value: key
2730
- }, "Sort by ", key))), /*#__PURE__*/React__namespace.createElement(Button, {
2889
+ }, "Sort by ", key))), /*#__PURE__*/React.createElement(Button, {
2731
2890
  type: "button",
2732
2891
  onClick: () => setBaseSort(old => old * -1),
2733
2892
  style: {
2734
2893
  padding: '.3em .4em',
2735
2894
  marginRight: '.5em'
2736
2895
  }
2737
- }, baseSort === 1 ? '⬆ Asc' : '⬇ Desc'), /*#__PURE__*/React__namespace.createElement(Button, {
2896
+ }, baseSort === 1 ? '⬆ Asc' : '⬇ Desc'), /*#__PURE__*/React.createElement(Button, {
2897
+ title: "Clear cache",
2898
+ "aria-label": "Clear cache",
2899
+ type: "button",
2900
+ onClick: () => queryCache.clear(),
2901
+ style: {
2902
+ padding: '.3em .4em',
2903
+ marginRight: '.5em'
2904
+ }
2905
+ }, "Clear"), /*#__PURE__*/React.createElement(Button, {
2738
2906
  type: "button",
2739
2907
  onClick: () => {
2740
2908
  if (isMockOffline) {
@@ -2744,6 +2912,7 @@
2744
2912
  } else {
2745
2913
  reactQuery.onlineManager.setOnline(false);
2746
2914
  setMockOffline(true);
2915
+ window.dispatchEvent(new Event('offline'));
2747
2916
  }
2748
2917
  },
2749
2918
  "aria-label": isMockOffline ? 'Restore offline mock' : 'Mock offline behavior',
@@ -2752,345 +2921,314 @@
2752
2921
  padding: '0',
2753
2922
  height: '2em'
2754
2923
  }
2755
- }, /*#__PURE__*/React__namespace.createElement("svg", {
2924
+ }, /*#__PURE__*/React.createElement("svg", {
2756
2925
  xmlns: "http://www.w3.org/2000/svg",
2757
2926
  width: "2em",
2758
2927
  height: "2em",
2759
2928
  viewBox: "0 0 24 24",
2760
2929
  stroke: isMockOffline ? defaultTheme.danger : 'currentColor',
2761
2930
  fill: "none"
2762
- }, isMockOffline ? /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("path", {
2931
+ }, isMockOffline ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("path", {
2763
2932
  stroke: "none",
2764
2933
  d: "M0 0h24v24H0z",
2765
2934
  fill: "none"
2766
- }), /*#__PURE__*/React__namespace.createElement("line", {
2935
+ }), /*#__PURE__*/React.createElement("line", {
2767
2936
  x1: "12",
2768
2937
  y1: "18",
2769
2938
  x2: "12.01",
2770
2939
  y2: "18"
2771
- }), /*#__PURE__*/React__namespace.createElement("path", {
2940
+ }), /*#__PURE__*/React.createElement("path", {
2772
2941
  d: "M9.172 15.172a4 4 0 0 1 5.656 0"
2773
- }), /*#__PURE__*/React__namespace.createElement("path", {
2942
+ }), /*#__PURE__*/React.createElement("path", {
2774
2943
  d: "M6.343 12.343a7.963 7.963 0 0 1 3.864 -2.14m4.163 .155a7.965 7.965 0 0 1 3.287 2"
2775
- }), /*#__PURE__*/React__namespace.createElement("path", {
2944
+ }), /*#__PURE__*/React.createElement("path", {
2776
2945
  d: "M3.515 9.515a12 12 0 0 1 3.544 -2.455m3.101 -.92a12 12 0 0 1 10.325 3.374"
2777
- }), /*#__PURE__*/React__namespace.createElement("line", {
2946
+ }), /*#__PURE__*/React.createElement("line", {
2778
2947
  x1: "3",
2779
2948
  y1: "3",
2780
2949
  x2: "21",
2781
2950
  y2: "21"
2782
- })) : /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("path", {
2951
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("path", {
2783
2952
  stroke: "none",
2784
2953
  d: "M0 0h24v24H0z",
2785
2954
  fill: "none"
2786
- }), /*#__PURE__*/React__namespace.createElement("line", {
2955
+ }), /*#__PURE__*/React.createElement("line", {
2787
2956
  x1: "12",
2788
2957
  y1: "18",
2789
2958
  x2: "12.01",
2790
2959
  y2: "18"
2791
- }), /*#__PURE__*/React__namespace.createElement("path", {
2960
+ }), /*#__PURE__*/React.createElement("path", {
2792
2961
  d: "M9.172 15.172a4 4 0 0 1 5.656 0"
2793
- }), /*#__PURE__*/React__namespace.createElement("path", {
2962
+ }), /*#__PURE__*/React.createElement("path", {
2794
2963
  d: "M6.343 12.343a8 8 0 0 1 11.314 0"
2795
- }), /*#__PURE__*/React__namespace.createElement("path", {
2964
+ }), /*#__PURE__*/React.createElement("path", {
2796
2965
  d: "M3.515 9.515c4.686 -4.687 12.284 -4.687 17 0"
2797
- }))), /*#__PURE__*/React__namespace.createElement(ScreenReader, {
2966
+ }))), /*#__PURE__*/React.createElement(ScreenReader, {
2798
2967
  text: isMockOffline ? 'Restore offline mock' : 'Mock offline behavior'
2799
- }))))), /*#__PURE__*/React__namespace.createElement("div", {
2968
+ }))))), /*#__PURE__*/React.createElement("div", {
2800
2969
  style: {
2801
2970
  overflowY: 'auto',
2802
2971
  flex: '1'
2803
2972
  }
2804
2973
  }, queries.map(query => {
2805
- return /*#__PURE__*/React__namespace.createElement(QueryRow, {
2974
+ return /*#__PURE__*/React.createElement(QueryRow$1, {
2806
2975
  queryKey: query.queryKey,
2807
2976
  activeQueryHash: activeQueryHash,
2808
2977
  setActiveQueryHash: setActiveQueryHash,
2809
2978
  key: query.queryHash,
2810
2979
  queryCache: queryCache
2811
2980
  });
2812
- }))), activeQueryHash && isOpen ? /*#__PURE__*/React__namespace.createElement(ActiveQuery, {
2981
+ }))), activeQueryHash && isOpen ? /*#__PURE__*/React.createElement(ActiveQuery$1, {
2813
2982
  activeQueryHash: activeQueryHash,
2814
2983
  queryCache: queryCache,
2815
- queryClient: client
2816
- }) : null, showCloseButton ? /*#__PURE__*/React__namespace.createElement(Button, _extends({
2984
+ queryClient: client,
2985
+ errorTypes: errorTypes
2986
+ }) : null, showCloseButton ? /*#__PURE__*/React.createElement(Button, _extends({
2817
2987
  type: "button",
2818
2988
  "aria-controls": "ReactQueryDevtoolsPanel",
2819
2989
  "aria-haspopup": "true",
2820
- "aria-expanded": "true"
2821
- }, otherCloseButtonProps, {
2822
- style: {
2823
- position: 'absolute',
2824
- zIndex: 99999,
2825
- margin: '.5em',
2826
- bottom: 0,
2827
- left: 0,
2828
- ...otherCloseButtonProps.style
2829
- },
2990
+ "aria-expanded": "true"
2991
+ }, otherCloseButtonProps, {
2992
+ style: {
2993
+ position: 'absolute',
2994
+ zIndex: 99999,
2995
+ margin: '.5em',
2996
+ bottom: 0,
2997
+ left: 0,
2998
+ ...otherCloseButtonProps.style
2999
+ },
3000
+ onClick: e => {
3001
+ setIsOpen(false);
3002
+ onCloseClick?.(e);
3003
+ }
3004
+ }), "Close") : null));
3005
+ });
3006
+ ReactQueryDevtoolsPanel$1.displayName = 'ReactQueryDevtoolsPanel';
3007
+ var ReactQueryDevtoolsPanel$2 = ReactQueryDevtoolsPanel$1;
3008
+
3009
+ function ReactQueryDevtools$1({
3010
+ initialIsOpen,
3011
+ panelProps = {},
3012
+ closeButtonProps = {},
3013
+ toggleButtonProps = {},
3014
+ position = 'bottom-left',
3015
+ containerElement: Container = 'aside',
3016
+ queryClient,
3017
+ styleNonce,
3018
+ panelPosition: initialPanelPosition = 'bottom',
3019
+ errorTypes = []
3020
+ }) {
3021
+ const rootRef = React__namespace.useRef(null);
3022
+ const panelRef = React__namespace.useRef(null);
3023
+ const [isOpen, setIsOpen] = useLocalStorage('reactQueryDevtoolsOpen', initialIsOpen);
3024
+ const [devtoolsHeight, setDevtoolsHeight] = useLocalStorage('reactQueryDevtoolsHeight', defaultPanelSize);
3025
+ const [devtoolsWidth, setDevtoolsWidth] = useLocalStorage('reactQueryDevtoolsWidth', defaultPanelSize);
3026
+ const [panelPosition = 'bottom', setPanelPosition] = useLocalStorage('reactQueryDevtoolsPanelPosition', initialPanelPosition);
3027
+ const [isResolvedOpen, setIsResolvedOpen] = React__namespace.useState(false);
3028
+ const [isResizing, setIsResizing] = React__namespace.useState(false);
3029
+ const isMounted = useIsMounted();
3030
+ const handleDragStart = (panelElement, startEvent) => {
3031
+ if (!panelElement) return;
3032
+ if (startEvent.button !== 0) return; // Only allow left click for drag
3033
+ const isVertical = isVerticalSide(panelPosition);
3034
+ setIsResizing(true);
3035
+ const {
3036
+ height,
3037
+ width
3038
+ } = panelElement.getBoundingClientRect();
3039
+ const startX = startEvent.clientX;
3040
+ const startY = startEvent.clientY;
3041
+ let newSize = 0;
3042
+ const run = moveEvent => {
3043
+ // prevent mouse selecting stuff with mouse drag
3044
+ moveEvent.preventDefault();
3045
+
3046
+ // calculate the correct size based on mouse position and current panel position
3047
+ // hint: it is different formula for the opposite sides
3048
+ if (isVertical) {
3049
+ newSize = width + (panelPosition === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX);
3050
+ setDevtoolsWidth(newSize);
3051
+ } else {
3052
+ newSize = height + (panelPosition === 'bottom' ? startY - moveEvent.clientY : moveEvent.clientY - startY);
3053
+ setDevtoolsHeight(newSize);
3054
+ }
3055
+ if (newSize < minPanelSize) {
3056
+ setIsOpen(false);
3057
+ } else {
3058
+ setIsOpen(true);
3059
+ }
3060
+ };
3061
+ const unsub = () => {
3062
+ if (isResizing) {
3063
+ setIsResizing(false);
3064
+ }
3065
+ document.removeEventListener('mousemove', run, false);
3066
+ document.removeEventListener('mouseUp', unsub, false);
3067
+ };
3068
+ document.addEventListener('mousemove', run, false);
3069
+ document.addEventListener('mouseup', unsub, false);
3070
+ };
3071
+ React__namespace.useEffect(() => {
3072
+ setIsResolvedOpen(isOpen ?? false);
3073
+ }, [isOpen, isResolvedOpen, setIsResolvedOpen]);
3074
+
3075
+ // Toggle panel visibility before/after transition (depending on direction).
3076
+ // Prevents focusing in a closed panel.
3077
+ React__namespace.useEffect(() => {
3078
+ const ref = panelRef.current;
3079
+ if (ref) {
3080
+ const handlePanelTransitionStart = () => {
3081
+ if (isResolvedOpen) {
3082
+ ref.style.visibility = 'visible';
3083
+ }
3084
+ };
3085
+ const handlePanelTransitionEnd = () => {
3086
+ if (!isResolvedOpen) {
3087
+ ref.style.visibility = 'hidden';
3088
+ }
3089
+ };
3090
+ ref.addEventListener('transitionstart', handlePanelTransitionStart);
3091
+ ref.addEventListener('transitionend', handlePanelTransitionEnd);
3092
+ return () => {
3093
+ ref.removeEventListener('transitionstart', handlePanelTransitionStart);
3094
+ ref.removeEventListener('transitionend', handlePanelTransitionEnd);
3095
+ };
3096
+ }
3097
+ return;
3098
+ }, [isResolvedOpen]);
3099
+ React__namespace.useEffect(() => {
3100
+ if (isResolvedOpen && rootRef.current?.parentElement) {
3101
+ const {
3102
+ parentElement
3103
+ } = rootRef.current;
3104
+ const styleProp = getSidedProp('padding', panelPosition);
3105
+ const isVertical = isVerticalSide(panelPosition);
3106
+ const previousPaddings = (({
3107
+ padding,
3108
+ paddingTop,
3109
+ paddingBottom,
3110
+ paddingLeft,
3111
+ paddingRight
3112
+ }) => ({
3113
+ padding,
3114
+ paddingTop,
3115
+ paddingBottom,
3116
+ paddingLeft,
3117
+ paddingRight
3118
+ }))(parentElement.style);
3119
+ const run = () => {
3120
+ // reset the padding
3121
+ parentElement.style.padding = '0px';
3122
+ parentElement.style.paddingTop = '0px';
3123
+ parentElement.style.paddingBottom = '0px';
3124
+ parentElement.style.paddingLeft = '0px';
3125
+ parentElement.style.paddingRight = '0px';
3126
+ // set the new padding based on the new panel position
3127
+
3128
+ parentElement.style[styleProp] = `${isVertical ? devtoolsWidth : devtoolsHeight}px`;
3129
+ };
3130
+ run();
3131
+ if (typeof window !== 'undefined') {
3132
+ window.addEventListener('resize', run);
3133
+ return () => {
3134
+ window.removeEventListener('resize', run);
3135
+ Object.entries(previousPaddings).forEach(([property, previousValue]) => {
3136
+ parentElement.style[property] = previousValue;
3137
+ });
3138
+ };
3139
+ }
3140
+ }
3141
+ return;
3142
+ }, [isResolvedOpen, panelPosition, devtoolsHeight, devtoolsWidth]);
3143
+ const {
3144
+ style: panelStyle = {},
3145
+ ...otherPanelProps
3146
+ } = panelProps;
3147
+ const {
3148
+ style: toggleButtonStyle = {},
3149
+ onClick: onToggleClick,
3150
+ ...otherToggleButtonProps
3151
+ } = toggleButtonProps;
3152
+
3153
+ // get computed style based on panel position
3154
+ const style = getSidePanelStyle({
3155
+ position: panelPosition,
3156
+ devtoolsTheme: defaultTheme,
3157
+ isOpen: isResolvedOpen,
3158
+ height: devtoolsHeight,
3159
+ width: devtoolsWidth,
3160
+ isResizing,
3161
+ panelStyle
3162
+ });
3163
+
3164
+ // Do not render on the server
3165
+ if (!isMounted()) return null;
3166
+ return /*#__PURE__*/React__namespace.createElement(Container, {
3167
+ ref: rootRef,
3168
+ className: "ReactQueryDevtools",
3169
+ "aria-label": "React Query Devtools"
3170
+ }, /*#__PURE__*/React__namespace.createElement(ThemeProvider, {
3171
+ theme: defaultTheme
3172
+ }, /*#__PURE__*/React__namespace.createElement(ReactQueryDevtoolsPanel$2, _extends({
3173
+ ref: panelRef,
3174
+ queryClient: queryClient,
3175
+ styleNonce: styleNonce,
3176
+ position: panelPosition,
3177
+ onPositionChange: setPanelPosition,
3178
+ showCloseButton: true,
3179
+ closeButtonProps: closeButtonProps
3180
+ }, otherPanelProps, {
3181
+ style: style,
3182
+ isOpen: isResolvedOpen,
3183
+ setIsOpen: setIsOpen,
3184
+ onDragStart: e => handleDragStart(panelRef.current, e),
3185
+ errorTypes: errorTypes
3186
+ }))), !isResolvedOpen ? /*#__PURE__*/React__namespace.createElement("button", _extends({
3187
+ type: "button"
3188
+ }, otherToggleButtonProps, {
3189
+ "aria-label": "Open React Query Devtools",
3190
+ "aria-controls": "ReactQueryDevtoolsPanel",
3191
+ "aria-haspopup": "true",
3192
+ "aria-expanded": "false",
2830
3193
  onClick: e => {
2831
- setIsOpen(false);
2832
- onCloseClick?.(e);
2833
- }
2834
- }), "Close") : null));
2835
- });
2836
- const ActiveQuery = ({
2837
- queryCache,
2838
- activeQueryHash,
2839
- queryClient
2840
- }) => {
2841
- const activeQuery = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash));
2842
- const activeQueryState = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.state);
2843
- const isStale = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.isStale()) ?? false;
2844
- const observerCount = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.getObserversCount()) ?? 0;
2845
- const handleRefetch = () => {
2846
- const promise = activeQuery?.fetch();
2847
- promise?.catch(noop);
2848
- };
2849
- if (!activeQuery || !activeQueryState) {
2850
- return null;
2851
- }
2852
- return /*#__PURE__*/React__namespace.createElement(ActiveQueryPanel, null, /*#__PURE__*/React__namespace.createElement("div", {
2853
- style: {
2854
- padding: '.5em',
2855
- background: defaultTheme.backgroundAlt,
2856
- position: 'sticky',
2857
- top: 0,
2858
- zIndex: 1
2859
- }
2860
- }, "Query Details"), /*#__PURE__*/React__namespace.createElement("div", {
2861
- style: {
2862
- padding: '.5em'
2863
- }
2864
- }, /*#__PURE__*/React__namespace.createElement("div", {
2865
- style: {
2866
- marginBottom: '.5em',
2867
- display: 'flex',
2868
- alignItems: 'flex-start',
2869
- justifyContent: 'space-between'
2870
- }
2871
- }, /*#__PURE__*/React__namespace.createElement(Code, {
2872
- style: {
2873
- lineHeight: '1.8em'
2874
- }
2875
- }, /*#__PURE__*/React__namespace.createElement("pre", {
3194
+ setIsOpen(true);
3195
+ onToggleClick?.(e);
3196
+ },
2876
3197
  style: {
2877
- margin: 0,
3198
+ background: 'none',
3199
+ border: 0,
2878
3200
  padding: 0,
2879
- overflow: 'auto'
2880
- }
2881
- }, displayValue(activeQuery.queryKey, true))), /*#__PURE__*/React__namespace.createElement("span", {
2882
- style: {
2883
- padding: '0.3em .6em',
2884
- borderRadius: '0.4em',
2885
- fontWeight: 'bold',
2886
- textShadow: '0 2px 10px black',
2887
- background: getQueryStatusColor({
2888
- queryState: activeQueryState,
2889
- isStale: isStale,
2890
- observerCount: observerCount,
2891
- theme: defaultTheme
2892
- }),
2893
- flexShrink: 0
2894
- }
2895
- }, getQueryStatusLabel(activeQuery))), /*#__PURE__*/React__namespace.createElement("div", {
2896
- style: {
2897
- marginBottom: '.5em',
2898
- display: 'flex',
2899
- alignItems: 'center',
2900
- justifyContent: 'space-between'
2901
- }
2902
- }, "Observers: ", /*#__PURE__*/React__namespace.createElement(Code, null, observerCount)), /*#__PURE__*/React__namespace.createElement("div", {
2903
- style: {
2904
- display: 'flex',
2905
- alignItems: 'center',
2906
- justifyContent: 'space-between'
2907
- }
2908
- }, "Last Updated:", ' ', /*#__PURE__*/React__namespace.createElement(Code, null, new Date(activeQueryState.dataUpdatedAt).toLocaleTimeString()))), /*#__PURE__*/React__namespace.createElement("div", {
2909
- style: {
2910
- background: defaultTheme.backgroundAlt,
2911
- padding: '.5em',
2912
- position: 'sticky',
2913
- top: 0,
2914
- zIndex: 1
2915
- }
2916
- }, "Actions"), /*#__PURE__*/React__namespace.createElement("div", {
2917
- style: {
2918
- padding: '0.5em'
2919
- }
2920
- }, /*#__PURE__*/React__namespace.createElement(Button, {
2921
- type: "button",
2922
- onClick: handleRefetch,
2923
- disabled: activeQueryState.fetchStatus === 'fetching',
2924
- style: {
2925
- background: defaultTheme.active
2926
- }
2927
- }, "Refetch"), ' ', /*#__PURE__*/React__namespace.createElement(Button, {
2928
- type: "button",
2929
- onClick: () => queryClient.invalidateQueries(activeQuery),
2930
- style: {
2931
- background: defaultTheme.warning,
2932
- color: defaultTheme.inputTextColor
2933
- }
2934
- }, "Invalidate"), ' ', /*#__PURE__*/React__namespace.createElement(Button, {
2935
- type: "button",
2936
- onClick: () => queryClient.resetQueries(activeQuery),
2937
- style: {
2938
- background: defaultTheme.gray
2939
- }
2940
- }, "Reset"), ' ', /*#__PURE__*/React__namespace.createElement(Button, {
2941
- type: "button",
2942
- onClick: () => queryClient.removeQueries(activeQuery),
2943
- style: {
2944
- background: defaultTheme.danger
2945
- }
2946
- }, "Remove")), /*#__PURE__*/React__namespace.createElement("div", {
2947
- style: {
2948
- background: defaultTheme.backgroundAlt,
2949
- padding: '.5em',
2950
- position: 'sticky',
2951
- top: 0,
2952
- zIndex: 1
2953
- }
2954
- }, "Data Explorer"), /*#__PURE__*/React__namespace.createElement("div", {
2955
- style: {
2956
- padding: '.5em'
2957
- }
2958
- }, /*#__PURE__*/React__namespace.createElement(Explorer, {
2959
- label: "Data",
2960
- value: activeQueryState.data,
2961
- defaultExpanded: {},
2962
- copyable: true
2963
- })), /*#__PURE__*/React__namespace.createElement("div", {
2964
- style: {
2965
- background: defaultTheme.backgroundAlt,
2966
- padding: '.5em',
2967
- position: 'sticky',
2968
- top: 0,
2969
- zIndex: 1
2970
- }
2971
- }, "Query Explorer"), /*#__PURE__*/React__namespace.createElement("div", {
2972
- style: {
2973
- padding: '.5em'
2974
- }
2975
- }, /*#__PURE__*/React__namespace.createElement(Explorer, {
2976
- label: "Query",
2977
- value: activeQuery,
2978
- defaultExpanded: {
2979
- queryKey: true
2980
- }
2981
- })));
2982
- };
2983
- const QueryStatusCount = ({
2984
- queryCache
2985
- }) => {
2986
- const hasFresh = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fresh').length);
2987
- const hasFetching = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fetching').length);
2988
- const hasPaused = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'paused').length);
2989
- const hasStale = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'stale').length);
2990
- const hasInactive = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'inactive').length);
2991
- return /*#__PURE__*/React__namespace.createElement(QueryKeys, null, /*#__PURE__*/React__namespace.createElement(QueryKey, {
2992
- style: {
2993
- background: defaultTheme.success,
2994
- opacity: hasFresh ? 1 : 0.3
2995
- }
2996
- }, "fresh ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasFresh, ")")), ' ', /*#__PURE__*/React__namespace.createElement(QueryKey, {
2997
- style: {
2998
- background: defaultTheme.active,
2999
- opacity: hasFetching ? 1 : 0.3
3000
- }
3001
- }, "fetching ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasFetching, ")")), ' ', /*#__PURE__*/React__namespace.createElement(QueryKey, {
3002
- style: {
3003
- background: defaultTheme.paused,
3004
- opacity: hasPaused ? 1 : 0.3
3005
- }
3006
- }, "paused ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasPaused, ")")), ' ', /*#__PURE__*/React__namespace.createElement(QueryKey, {
3007
- style: {
3008
- background: defaultTheme.warning,
3009
- color: 'black',
3010
- textShadow: '0',
3011
- opacity: hasStale ? 1 : 0.3
3012
- }
3013
- }, "stale ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasStale, ")")), ' ', /*#__PURE__*/React__namespace.createElement(QueryKey, {
3014
- style: {
3015
- background: defaultTheme.gray,
3016
- opacity: hasInactive ? 1 : 0.3
3017
- }
3018
- }, "inactive ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasInactive, ")")));
3019
- };
3020
- const QueryRow = /*#__PURE__*/React__namespace.memo(({
3021
- queryKey,
3022
- setActiveQueryHash,
3023
- activeQueryHash,
3024
- queryCache
3025
- }) => {
3026
- const queryHash = useSubscribeToQueryCache(queryCache, () => queryCache.find({
3027
- queryKey
3028
- })?.queryHash) ?? '';
3029
- const queryState = useSubscribeToQueryCache(queryCache, () => queryCache.find({
3030
- queryKey
3031
- })?.state);
3032
- const isStale = useSubscribeToQueryCache(queryCache, () => queryCache.find({
3033
- queryKey
3034
- })?.isStale()) ?? false;
3035
- const isDisabled = useSubscribeToQueryCache(queryCache, () => queryCache.find({
3036
- queryKey
3037
- })?.isDisabled()) ?? false;
3038
- const observerCount = useSubscribeToQueryCache(queryCache, () => queryCache.find({
3039
- queryKey
3040
- })?.getObserversCount()) ?? 0;
3041
- if (!queryState) {
3042
- return null;
3043
- }
3044
- return /*#__PURE__*/React__namespace.createElement("div", {
3045
- role: "button",
3046
- "aria-label": `Open query details for ${queryHash}`,
3047
- onClick: () => setActiveQueryHash(activeQueryHash === queryHash ? '' : queryHash),
3048
- style: {
3049
- display: 'flex',
3050
- borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
3201
+ position: 'fixed',
3202
+ zIndex: 99999,
3203
+ display: 'inline-flex',
3204
+ fontSize: '1.5em',
3205
+ margin: '.5em',
3051
3206
  cursor: 'pointer',
3052
- background: queryHash === activeQueryHash ? 'rgba(255,255,255,.1)' : undefined
3053
- }
3054
- }, /*#__PURE__*/React__namespace.createElement("div", {
3055
- style: {
3056
- flex: '0 0 auto',
3057
- width: '2em',
3058
- height: '2em',
3059
- background: getQueryStatusColor({
3060
- queryState,
3061
- isStale,
3062
- observerCount,
3063
- theme: defaultTheme
3207
+ width: 'fit-content',
3208
+ ...(position === 'top-right' ? {
3209
+ top: '0',
3210
+ right: '0'
3211
+ } : position === 'top-left' ? {
3212
+ top: '0',
3213
+ left: '0'
3214
+ } : position === 'bottom-right' ? {
3215
+ bottom: '0',
3216
+ right: '0'
3217
+ } : {
3218
+ bottom: '0',
3219
+ left: '0'
3064
3220
  }),
3065
- display: 'flex',
3066
- alignItems: 'center',
3067
- justifyContent: 'center',
3068
- fontWeight: 'bold',
3069
- textShadow: isStale ? '0' : '0 0 10px black',
3070
- color: isStale ? 'black' : 'white'
3071
- }
3072
- }, observerCount), isDisabled ? /*#__PURE__*/React__namespace.createElement("div", {
3073
- style: {
3074
- flex: '0 0 auto',
3075
- height: '2em',
3076
- background: defaultTheme.gray,
3077
- display: 'flex',
3078
- alignItems: 'center',
3079
- fontWeight: 'bold',
3080
- padding: '0 0.5em'
3081
- }
3082
- }, "disabled") : null, /*#__PURE__*/React__namespace.createElement(Code, {
3083
- style: {
3084
- padding: '.5em'
3221
+ ...toggleButtonStyle
3085
3222
  }
3086
- }, `${queryHash}`));
3087
- });
3088
-
3089
- // eslint-disable-next-line @typescript-eslint/no-empty-function
3090
- function noop() {}
3223
+ }), /*#__PURE__*/React__namespace.createElement(Logo, {
3224
+ "aria-hidden": true
3225
+ }), /*#__PURE__*/React__namespace.createElement(ScreenReader, {
3226
+ text: "Open React Query Devtools"
3227
+ })) : null);
3228
+ }
3091
3229
 
3092
3230
  const ReactQueryDevtools = ReactQueryDevtools$1;
3093
- const ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel$1;
3231
+ const ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel$2;
3094
3232
 
3095
3233
  exports.ReactQueryDevtools = ReactQueryDevtools;
3096
3234
  exports.ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel;