@tanstack/react-router-devtools 0.0.1-beta.8 → 0.0.1-beta.81

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 (76) hide show
  1. package/LICENSE +21 -0
  2. package/build/cjs/{packages/react-router-devtools/src/Explorer.js → Explorer.js} +44 -61
  3. package/build/cjs/Explorer.js.map +1 -0
  4. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -18
  5. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
  6. package/build/cjs/{packages/react-router-devtools/src/devtools.js → devtools.js} +176 -275
  7. package/build/cjs/devtools.js.map +1 -0
  8. package/build/cjs/{packages/react-router-devtools/src/index.js → index.js} +0 -0
  9. package/build/cjs/{packages/react-router-devtools/src/index.js.map → index.js.map} +0 -0
  10. package/build/cjs/{packages/react-router-devtools/src/styledComponents.js → styledComponents.js} +9 -37
  11. package/build/cjs/styledComponents.js.map +1 -0
  12. package/build/cjs/{packages/react-router-devtools/src/theme.js → theme.js} +5 -8
  13. package/build/cjs/theme.js.map +1 -0
  14. package/build/cjs/{packages/react-router-devtools/src/useLocalStorage.js → useLocalStorage.js} +2 -9
  15. package/build/cjs/useLocalStorage.js.map +1 -0
  16. package/build/cjs/{packages/react-router-devtools/src/useMediaQuery.js → useMediaQuery.js} +10 -13
  17. package/build/cjs/useMediaQuery.js.map +1 -0
  18. package/build/cjs/{packages/react-router-devtools/src/utils.js → utils.js} +24 -70
  19. package/build/cjs/utils.js.map +1 -0
  20. package/build/esm/index.js +268 -1319
  21. package/build/esm/index.js.map +1 -1
  22. package/build/stats-html.html +59 -49
  23. package/build/stats-react.json +324 -9463
  24. package/build/types/index.d.ts +4 -4
  25. package/build/umd/index.development.js +345 -1291
  26. package/build/umd/index.development.js.map +1 -1
  27. package/build/umd/index.production.js +43 -1
  28. package/build/umd/index.production.js.map +1 -1
  29. package/package.json +6 -8
  30. package/src/devtools.tsx +86 -87
  31. package/src/utils.ts +5 -17
  32. package/build/cjs/node_modules/date-fns/esm/_lib/assign/index.js +0 -30
  33. package/build/cjs/node_modules/date-fns/esm/_lib/assign/index.js.map +0 -1
  34. package/build/cjs/node_modules/date-fns/esm/_lib/cloneObject/index.js +0 -22
  35. package/build/cjs/node_modules/date-fns/esm/_lib/cloneObject/index.js.map +0 -1
  36. package/build/cjs/node_modules/date-fns/esm/_lib/defaultLocale/index.js +0 -20
  37. package/build/cjs/node_modules/date-fns/esm/_lib/defaultLocale/index.js.map +0 -1
  38. package/build/cjs/node_modules/date-fns/esm/_lib/defaultOptions/index.js +0 -21
  39. package/build/cjs/node_modules/date-fns/esm/_lib/defaultOptions/index.js.map +0 -1
  40. package/build/cjs/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js +0 -33
  41. package/build/cjs/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js.map +0 -1
  42. package/build/cjs/node_modules/date-fns/esm/_lib/requiredArgs/index.js +0 -22
  43. package/build/cjs/node_modules/date-fns/esm/_lib/requiredArgs/index.js.map +0 -1
  44. package/build/cjs/node_modules/date-fns/esm/compareAsc/index.js +0 -67
  45. package/build/cjs/node_modules/date-fns/esm/compareAsc/index.js.map +0 -1
  46. package/build/cjs/node_modules/date-fns/esm/formatDistanceStrict/index.js +0 -207
  47. package/build/cjs/node_modules/date-fns/esm/formatDistanceStrict/index.js.map +0 -1
  48. package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js +0 -26
  49. package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js.map +0 -1
  50. package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js +0 -39
  51. package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js.map +0 -1
  52. package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js +0 -65
  53. package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js.map +0 -1
  54. package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js +0 -34
  55. package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js.map +0 -1
  56. package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js +0 -105
  57. package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js.map +0 -1
  58. package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js +0 -52
  59. package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js.map +0 -1
  60. package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js +0 -31
  61. package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js.map +0 -1
  62. package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js +0 -164
  63. package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js.map +0 -1
  64. package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/match/index.js +0 -116
  65. package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/match/index.js.map +0 -1
  66. package/build/cjs/node_modules/date-fns/esm/locale/en-US/index.js +0 -47
  67. package/build/cjs/node_modules/date-fns/esm/locale/en-US/index.js.map +0 -1
  68. package/build/cjs/node_modules/date-fns/esm/toDate/index.js +0 -70
  69. package/build/cjs/node_modules/date-fns/esm/toDate/index.js.map +0 -1
  70. package/build/cjs/packages/react-router-devtools/src/Explorer.js.map +0 -1
  71. package/build/cjs/packages/react-router-devtools/src/devtools.js.map +0 -1
  72. package/build/cjs/packages/react-router-devtools/src/styledComponents.js.map +0 -1
  73. package/build/cjs/packages/react-router-devtools/src/theme.js.map +0 -1
  74. package/build/cjs/packages/react-router-devtools/src/useLocalStorage.js.map +0 -1
  75. package/build/cjs/packages/react-router-devtools/src/useMediaQuery.js.map +0 -1
  76. package/build/cjs/packages/react-router-devtools/src/utils.js.map +0 -1
@@ -10,893 +10,38 @@
10
10
  */
11
11
  import * as React from 'react';
12
12
  import React__default from 'react';
13
- import { last } from '@tanstack/react-router';
13
+ import { routerContext, invariant, useStore, last } from '@tanstack/react-router';
14
14
 
15
15
  function _extends() {
16
16
  _extends = Object.assign ? Object.assign.bind() : function (target) {
17
17
  for (var i = 1; i < arguments.length; i++) {
18
18
  var source = arguments[i];
19
-
20
19
  for (var key in source) {
21
20
  if (Object.prototype.hasOwnProperty.call(source, key)) {
22
21
  target[key] = source[key];
23
22
  }
24
23
  }
25
24
  }
26
-
27
25
  return target;
28
26
  };
29
27
  return _extends.apply(this, arguments);
30
28
  }
31
29
 
32
- function _objectWithoutPropertiesLoose(source, excluded) {
33
- if (source == null) return {};
34
- var target = {};
35
- var sourceKeys = Object.keys(source);
36
- var key, i;
37
-
38
- for (i = 0; i < sourceKeys.length; i++) {
39
- key = sourceKeys[i];
40
- if (excluded.indexOf(key) >= 0) continue;
41
- target[key] = source[key];
42
- }
43
-
44
- return target;
45
- }
46
-
47
- function requiredArgs(required, args) {
48
- if (args.length < required) {
49
- throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
50
- }
51
- }
52
-
53
- /**
54
- * @name toDate
55
- * @category Common Helpers
56
- * @summary Convert the given argument to an instance of Date.
57
- *
58
- * @description
59
- * Convert the given argument to an instance of Date.
60
- *
61
- * If the argument is an instance of Date, the function returns its clone.
62
- *
63
- * If the argument is a number, it is treated as a timestamp.
64
- *
65
- * If the argument is none of the above, the function returns Invalid Date.
66
- *
67
- * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
68
- *
69
- * @param {Date|Number} argument - the value to convert
70
- * @returns {Date} the parsed date in the local time zone
71
- * @throws {TypeError} 1 argument required
72
- *
73
- * @example
74
- * // Clone the date:
75
- * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
76
- * //=> Tue Feb 11 2014 11:30:30
77
- *
78
- * @example
79
- * // Convert the timestamp to date:
80
- * const result = toDate(1392098430000)
81
- * //=> Tue Feb 11 2014 11:30:30
82
- */
83
-
84
- function toDate(argument) {
85
- requiredArgs(1, arguments);
86
- var argStr = Object.prototype.toString.call(argument); // Clone the date
87
-
88
- if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
89
- // Prevent the date to lose the milliseconds when passed to new Date() in IE10
90
- return new Date(argument.getTime());
91
- } else if (typeof argument === 'number' || argStr === '[object Number]') {
92
- return new Date(argument);
93
- } else {
94
- if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
95
- // eslint-disable-next-line no-console
96
- console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); // eslint-disable-next-line no-console
97
-
98
- console.warn(new Error().stack);
99
- }
100
-
101
- return new Date(NaN);
102
- }
103
- }
104
-
105
- var defaultOptions = {};
106
- function getDefaultOptions() {
107
- return defaultOptions;
108
- }
109
-
110
- /**
111
- * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
112
- * They usually appear for dates that denote time before the timezones were introduced
113
- * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
114
- * and GMT+01:00:00 after that date)
115
- *
116
- * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
117
- * which would lead to incorrect calculations.
118
- *
119
- * This function returns the timezone offset in milliseconds that takes seconds in account.
120
- */
121
- function getTimezoneOffsetInMilliseconds(date) {
122
- var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
123
- utcDate.setUTCFullYear(date.getFullYear());
124
- return date.getTime() - utcDate.getTime();
125
- }
126
-
127
- /**
128
- * @name compareAsc
129
- * @category Common Helpers
130
- * @summary Compare the two dates and return -1, 0 or 1.
131
- *
132
- * @description
133
- * Compare the two dates and return 1 if the first date is after the second,
134
- * -1 if the first date is before the second or 0 if dates are equal.
135
- *
136
- * @param {Date|Number} dateLeft - the first date to compare
137
- * @param {Date|Number} dateRight - the second date to compare
138
- * @returns {Number} the result of the comparison
139
- * @throws {TypeError} 2 arguments required
140
- *
141
- * @example
142
- * // Compare 11 February 1987 and 10 July 1989:
143
- * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
144
- * //=> -1
145
- *
146
- * @example
147
- * // Sort the array of dates:
148
- * const result = [
149
- * new Date(1995, 6, 2),
150
- * new Date(1987, 1, 11),
151
- * new Date(1989, 6, 10)
152
- * ].sort(compareAsc)
153
- * //=> [
154
- * // Wed Feb 11 1987 00:00:00,
155
- * // Mon Jul 10 1989 00:00:00,
156
- * // Sun Jul 02 1995 00:00:00
157
- * // ]
158
- */
159
-
160
- function compareAsc(dirtyDateLeft, dirtyDateRight) {
161
- requiredArgs(2, arguments);
162
- var dateLeft = toDate(dirtyDateLeft);
163
- var dateRight = toDate(dirtyDateRight);
164
- var diff = dateLeft.getTime() - dateRight.getTime();
165
-
166
- if (diff < 0) {
167
- return -1;
168
- } else if (diff > 0) {
169
- return 1; // Return 0 if diff is 0; return NaN if diff is NaN
170
- } else {
171
- return diff;
172
- }
173
- }
174
-
175
- var formatDistanceLocale = {
176
- lessThanXSeconds: {
177
- one: 'less than a second',
178
- other: 'less than {{count}} seconds'
179
- },
180
- xSeconds: {
181
- one: '1 second',
182
- other: '{{count}} seconds'
183
- },
184
- halfAMinute: 'half a minute',
185
- lessThanXMinutes: {
186
- one: 'less than a minute',
187
- other: 'less than {{count}} minutes'
188
- },
189
- xMinutes: {
190
- one: '1 minute',
191
- other: '{{count}} minutes'
192
- },
193
- aboutXHours: {
194
- one: 'about 1 hour',
195
- other: 'about {{count}} hours'
196
- },
197
- xHours: {
198
- one: '1 hour',
199
- other: '{{count}} hours'
200
- },
201
- xDays: {
202
- one: '1 day',
203
- other: '{{count}} days'
204
- },
205
- aboutXWeeks: {
206
- one: 'about 1 week',
207
- other: 'about {{count}} weeks'
208
- },
209
- xWeeks: {
210
- one: '1 week',
211
- other: '{{count}} weeks'
212
- },
213
- aboutXMonths: {
214
- one: 'about 1 month',
215
- other: 'about {{count}} months'
216
- },
217
- xMonths: {
218
- one: '1 month',
219
- other: '{{count}} months'
220
- },
221
- aboutXYears: {
222
- one: 'about 1 year',
223
- other: 'about {{count}} years'
224
- },
225
- xYears: {
226
- one: '1 year',
227
- other: '{{count}} years'
228
- },
229
- overXYears: {
230
- one: 'over 1 year',
231
- other: 'over {{count}} years'
232
- },
233
- almostXYears: {
234
- one: 'almost 1 year',
235
- other: 'almost {{count}} years'
236
- }
237
- };
238
-
239
- var formatDistance = function (token, count, options) {
240
- var result;
241
- var tokenValue = formatDistanceLocale[token];
242
-
243
- if (typeof tokenValue === 'string') {
244
- result = tokenValue;
245
- } else if (count === 1) {
246
- result = tokenValue.one;
247
- } else {
248
- result = tokenValue.other.replace('{{count}}', count.toString());
249
- }
250
-
251
- if (options !== null && options !== void 0 && options.addSuffix) {
252
- if (options.comparison && options.comparison > 0) {
253
- return 'in ' + result;
254
- } else {
255
- return result + ' ago';
256
- }
257
- }
258
-
259
- return result;
260
- };
261
-
262
- var formatDistance$1 = formatDistance;
263
-
264
- function buildFormatLongFn(args) {
265
- return function () {
266
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
267
- // TODO: Remove String()
268
- var width = options.width ? String(options.width) : args.defaultWidth;
269
- var format = args.formats[width] || args.formats[args.defaultWidth];
270
- return format;
271
- };
272
- }
273
-
274
- var dateFormats = {
275
- full: 'EEEE, MMMM do, y',
276
- long: 'MMMM do, y',
277
- medium: 'MMM d, y',
278
- short: 'MM/dd/yyyy'
279
- };
280
- var timeFormats = {
281
- full: 'h:mm:ss a zzzz',
282
- long: 'h:mm:ss a z',
283
- medium: 'h:mm:ss a',
284
- short: 'h:mm a'
285
- };
286
- var dateTimeFormats = {
287
- full: "{{date}} 'at' {{time}}",
288
- long: "{{date}} 'at' {{time}}",
289
- medium: '{{date}}, {{time}}',
290
- short: '{{date}}, {{time}}'
291
- };
292
- var formatLong = {
293
- date: buildFormatLongFn({
294
- formats: dateFormats,
295
- defaultWidth: 'full'
296
- }),
297
- time: buildFormatLongFn({
298
- formats: timeFormats,
299
- defaultWidth: 'full'
300
- }),
301
- dateTime: buildFormatLongFn({
302
- formats: dateTimeFormats,
303
- defaultWidth: 'full'
304
- })
305
- };
306
- var formatLong$1 = formatLong;
307
-
308
- var formatRelativeLocale = {
309
- lastWeek: "'last' eeee 'at' p",
310
- yesterday: "'yesterday at' p",
311
- today: "'today at' p",
312
- tomorrow: "'tomorrow at' p",
313
- nextWeek: "eeee 'at' p",
314
- other: 'P'
315
- };
316
-
317
- var formatRelative = function (token, _date, _baseDate, _options) {
318
- return formatRelativeLocale[token];
319
- };
320
-
321
- var formatRelative$1 = formatRelative;
322
-
323
- function buildLocalizeFn(args) {
324
- return function (dirtyIndex, options) {
325
- var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
326
- var valuesArray;
327
-
328
- if (context === 'formatting' && args.formattingValues) {
329
- var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
330
- var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
331
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
332
- } else {
333
- var _defaultWidth = args.defaultWidth;
334
-
335
- var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
336
-
337
- valuesArray = args.values[_width] || args.values[_defaultWidth];
338
- }
339
-
340
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
341
-
342
- return valuesArray[index];
343
- };
344
- }
345
-
346
- var eraValues = {
347
- narrow: ['B', 'A'],
348
- abbreviated: ['BC', 'AD'],
349
- wide: ['Before Christ', 'Anno Domini']
350
- };
351
- var quarterValues = {
352
- narrow: ['1', '2', '3', '4'],
353
- abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
354
- wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
355
- }; // Note: in English, the names of days of the week and months are capitalized.
356
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
357
- // Generally, formatted dates should look like they are in the middle of a sentence,
358
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
359
-
360
- var monthValues = {
361
- narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
362
- abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
363
- wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
364
- };
365
- var dayValues = {
366
- narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
367
- short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
368
- abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
369
- wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
370
- };
371
- var dayPeriodValues = {
372
- narrow: {
373
- am: 'a',
374
- pm: 'p',
375
- midnight: 'mi',
376
- noon: 'n',
377
- morning: 'morning',
378
- afternoon: 'afternoon',
379
- evening: 'evening',
380
- night: 'night'
381
- },
382
- abbreviated: {
383
- am: 'AM',
384
- pm: 'PM',
385
- midnight: 'midnight',
386
- noon: 'noon',
387
- morning: 'morning',
388
- afternoon: 'afternoon',
389
- evening: 'evening',
390
- night: 'night'
391
- },
392
- wide: {
393
- am: 'a.m.',
394
- pm: 'p.m.',
395
- midnight: 'midnight',
396
- noon: 'noon',
397
- morning: 'morning',
398
- afternoon: 'afternoon',
399
- evening: 'evening',
400
- night: 'night'
401
- }
402
- };
403
- var formattingDayPeriodValues = {
404
- narrow: {
405
- am: 'a',
406
- pm: 'p',
407
- midnight: 'mi',
408
- noon: 'n',
409
- morning: 'in the morning',
410
- afternoon: 'in the afternoon',
411
- evening: 'in the evening',
412
- night: 'at night'
413
- },
414
- abbreviated: {
415
- am: 'AM',
416
- pm: 'PM',
417
- midnight: 'midnight',
418
- noon: 'noon',
419
- morning: 'in the morning',
420
- afternoon: 'in the afternoon',
421
- evening: 'in the evening',
422
- night: 'at night'
423
- },
424
- wide: {
425
- am: 'a.m.',
426
- pm: 'p.m.',
427
- midnight: 'midnight',
428
- noon: 'noon',
429
- morning: 'in the morning',
430
- afternoon: 'in the afternoon',
431
- evening: 'in the evening',
432
- night: 'at night'
433
- }
434
- };
435
-
436
- var ordinalNumber = function (dirtyNumber, _options) {
437
- var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
438
- // if they are different for different grammatical genders,
439
- // use `options.unit`.
440
- //
441
- // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
442
- // 'day', 'hour', 'minute', 'second'.
443
-
444
- var rem100 = number % 100;
445
-
446
- if (rem100 > 20 || rem100 < 10) {
447
- switch (rem100 % 10) {
448
- case 1:
449
- return number + 'st';
450
-
451
- case 2:
452
- return number + 'nd';
453
-
454
- case 3:
455
- return number + 'rd';
456
- }
457
- }
458
-
459
- return number + 'th';
460
- };
461
-
462
- var localize = {
463
- ordinalNumber: ordinalNumber,
464
- era: buildLocalizeFn({
465
- values: eraValues,
466
- defaultWidth: 'wide'
467
- }),
468
- quarter: buildLocalizeFn({
469
- values: quarterValues,
470
- defaultWidth: 'wide',
471
- argumentCallback: function (quarter) {
472
- return quarter - 1;
473
- }
474
- }),
475
- month: buildLocalizeFn({
476
- values: monthValues,
477
- defaultWidth: 'wide'
478
- }),
479
- day: buildLocalizeFn({
480
- values: dayValues,
481
- defaultWidth: 'wide'
482
- }),
483
- dayPeriod: buildLocalizeFn({
484
- values: dayPeriodValues,
485
- defaultWidth: 'wide',
486
- formattingValues: formattingDayPeriodValues,
487
- defaultFormattingWidth: 'wide'
488
- })
489
- };
490
- var localize$1 = localize;
491
-
492
- function buildMatchFn(args) {
493
- return function (string) {
494
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
495
- var width = options.width;
496
- var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
497
- var matchResult = string.match(matchPattern);
498
-
499
- if (!matchResult) {
500
- return null;
501
- }
502
-
503
- var matchedString = matchResult[0];
504
- var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
505
- var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
506
- return pattern.test(matchedString);
507
- }) : findKey(parsePatterns, function (pattern) {
508
- return pattern.test(matchedString);
509
- });
510
- var value;
511
- value = args.valueCallback ? args.valueCallback(key) : key;
512
- value = options.valueCallback ? options.valueCallback(value) : value;
513
- var rest = string.slice(matchedString.length);
514
- return {
515
- value: value,
516
- rest: rest
517
- };
518
- };
519
- }
520
-
521
- function findKey(object, predicate) {
522
- for (var key in object) {
523
- if (object.hasOwnProperty(key) && predicate(object[key])) {
524
- return key;
525
- }
526
- }
527
-
528
- return undefined;
529
- }
530
-
531
- function findIndex(array, predicate) {
532
- for (var key = 0; key < array.length; key++) {
533
- if (predicate(array[key])) {
534
- return key;
535
- }
536
- }
537
-
538
- return undefined;
539
- }
540
-
541
- function buildMatchPatternFn(args) {
542
- return function (string) {
543
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
544
- var matchResult = string.match(args.matchPattern);
545
- if (!matchResult) return null;
546
- var matchedString = matchResult[0];
547
- var parseResult = string.match(args.parsePattern);
548
- if (!parseResult) return null;
549
- var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
550
- value = options.valueCallback ? options.valueCallback(value) : value;
551
- var rest = string.slice(matchedString.length);
552
- return {
553
- value: value,
554
- rest: rest
555
- };
556
- };
557
- }
558
-
559
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
560
- var parseOrdinalNumberPattern = /\d+/i;
561
- var matchEraPatterns = {
562
- narrow: /^(b|a)/i,
563
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
564
- wide: /^(before christ|before common era|anno domini|common era)/i
565
- };
566
- var parseEraPatterns = {
567
- any: [/^b/i, /^(a|c)/i]
568
- };
569
- var matchQuarterPatterns = {
570
- narrow: /^[1234]/i,
571
- abbreviated: /^q[1234]/i,
572
- wide: /^[1234](th|st|nd|rd)? quarter/i
573
- };
574
- var parseQuarterPatterns = {
575
- any: [/1/i, /2/i, /3/i, /4/i]
576
- };
577
- var matchMonthPatterns = {
578
- narrow: /^[jfmasond]/i,
579
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
580
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
581
- };
582
- var parseMonthPatterns = {
583
- narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
584
- any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
585
- };
586
- var matchDayPatterns = {
587
- narrow: /^[smtwf]/i,
588
- short: /^(su|mo|tu|we|th|fr|sa)/i,
589
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
590
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
591
- };
592
- var parseDayPatterns = {
593
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
594
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
595
- };
596
- var matchDayPeriodPatterns = {
597
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
598
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
599
- };
600
- var parseDayPeriodPatterns = {
601
- any: {
602
- am: /^a/i,
603
- pm: /^p/i,
604
- midnight: /^mi/i,
605
- noon: /^no/i,
606
- morning: /morning/i,
607
- afternoon: /afternoon/i,
608
- evening: /evening/i,
609
- night: /night/i
610
- }
611
- };
612
- var match = {
613
- ordinalNumber: buildMatchPatternFn({
614
- matchPattern: matchOrdinalNumberPattern,
615
- parsePattern: parseOrdinalNumberPattern,
616
- valueCallback: function (value) {
617
- return parseInt(value, 10);
618
- }
619
- }),
620
- era: buildMatchFn({
621
- matchPatterns: matchEraPatterns,
622
- defaultMatchWidth: 'wide',
623
- parsePatterns: parseEraPatterns,
624
- defaultParseWidth: 'any'
625
- }),
626
- quarter: buildMatchFn({
627
- matchPatterns: matchQuarterPatterns,
628
- defaultMatchWidth: 'wide',
629
- parsePatterns: parseQuarterPatterns,
630
- defaultParseWidth: 'any',
631
- valueCallback: function (index) {
632
- return index + 1;
633
- }
634
- }),
635
- month: buildMatchFn({
636
- matchPatterns: matchMonthPatterns,
637
- defaultMatchWidth: 'wide',
638
- parsePatterns: parseMonthPatterns,
639
- defaultParseWidth: 'any'
640
- }),
641
- day: buildMatchFn({
642
- matchPatterns: matchDayPatterns,
643
- defaultMatchWidth: 'wide',
644
- parsePatterns: parseDayPatterns,
645
- defaultParseWidth: 'any'
646
- }),
647
- dayPeriod: buildMatchFn({
648
- matchPatterns: matchDayPeriodPatterns,
649
- defaultMatchWidth: 'any',
650
- parsePatterns: parseDayPeriodPatterns,
651
- defaultParseWidth: 'any'
652
- })
653
- };
654
- var match$1 = match;
655
-
656
- /**
657
- * @type {Locale}
658
- * @category Locales
659
- * @summary English locale (United States).
660
- * @language English
661
- * @iso-639-2 eng
662
- * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
663
- * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
664
- */
665
- var locale = {
666
- code: 'en-US',
667
- formatDistance: formatDistance$1,
668
- formatLong: formatLong$1,
669
- formatRelative: formatRelative$1,
670
- localize: localize$1,
671
- match: match$1,
672
- options: {
673
- weekStartsOn: 0
674
- /* Sunday */
675
- ,
676
- firstWeekContainsDate: 1
677
- }
678
- };
679
- var defaultLocale = locale;
680
-
681
- function assign(target, object) {
682
- if (target == null) {
683
- throw new TypeError('assign requires that input parameter not be null or undefined');
684
- }
685
-
686
- for (var property in object) {
687
- if (Object.prototype.hasOwnProperty.call(object, property)) {
688
- target[property] = object[property];
689
- }
690
- }
691
-
692
- return target;
693
- }
694
-
695
- function cloneObject(object) {
696
- return assign({}, object);
697
- }
698
-
699
- var MILLISECONDS_IN_MINUTE = 1000 * 60;
700
- var MINUTES_IN_DAY = 60 * 24;
701
- var MINUTES_IN_MONTH = MINUTES_IN_DAY * 30;
702
- var MINUTES_IN_YEAR = MINUTES_IN_DAY * 365;
703
- /**
704
- * @name formatDistanceStrict
705
- * @category Common Helpers
706
- * @summary Return the distance between the given dates in words.
707
- *
708
- * @description
709
- * Return the distance between the given dates in words, using strict units.
710
- * This is like `formatDistance`, but does not use helpers like 'almost', 'over',
711
- * 'less than' and the like.
712
- *
713
- * | Distance between dates | Result |
714
- * |------------------------|---------------------|
715
- * | 0 ... 59 secs | [0..59] seconds |
716
- * | 1 ... 59 mins | [1..59] minutes |
717
- * | 1 ... 23 hrs | [1..23] hours |
718
- * | 1 ... 29 days | [1..29] days |
719
- * | 1 ... 11 months | [1..11] months |
720
- * | 1 ... N years | [1..N] years |
721
- *
722
- * @param {Date|Number} date - the date
723
- * @param {Date|Number} baseDate - the date to compare with
724
- * @param {Object} [options] - an object with options.
725
- * @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first
726
- * @param {'second'|'minute'|'hour'|'day'|'month'|'year'} [options.unit] - if specified, will force a unit
727
- * @param {'floor'|'ceil'|'round'} [options.roundingMethod='round'] - which way to round partial units
728
- * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
729
- * @returns {String} the distance in words
730
- * @throws {TypeError} 2 arguments required
731
- * @throws {RangeError} `date` must not be Invalid Date
732
- * @throws {RangeError} `baseDate` must not be Invalid Date
733
- * @throws {RangeError} `options.roundingMethod` must be 'floor', 'ceil' or 'round'
734
- * @throws {RangeError} `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year'
735
- * @throws {RangeError} `options.locale` must contain `formatDistance` property
736
- *
737
- * @example
738
- * // What is the distance between 2 July 2014 and 1 January 2015?
739
- * const result = formatDistanceStrict(new Date(2014, 6, 2), new Date(2015, 0, 2))
740
- * //=> '6 months'
741
- *
742
- * @example
743
- * // What is the distance between 1 January 2015 00:00:15
744
- * // and 1 January 2015 00:00:00?
745
- * const result = formatDistanceStrict(
746
- * new Date(2015, 0, 1, 0, 0, 15),
747
- * new Date(2015, 0, 1, 0, 0, 0)
748
- * )
749
- * //=> '15 seconds'
750
- *
751
- * @example
752
- * // What is the distance from 1 January 2016
753
- * // to 1 January 2015, with a suffix?
754
- * const result = formatDistanceStrict(new Date(2015, 0, 1), new Date(2016, 0, 1), {
755
- * addSuffix: true
756
- * })
757
- * //=> '1 year ago'
758
- *
759
- * @example
760
- * // What is the distance from 1 January 2016
761
- * // to 1 January 2015, in minutes?
762
- * const result = formatDistanceStrict(new Date(2016, 0, 1), new Date(2015, 0, 1), {
763
- * unit: 'minute'
764
- * })
765
- * //=> '525600 minutes'
766
- *
767
- * @example
768
- * // What is the distance from 1 January 2015
769
- * // to 28 January 2015, in months, rounded up?
770
- * const result = formatDistanceStrict(new Date(2015, 0, 28), new Date(2015, 0, 1), {
771
- * unit: 'month',
772
- * roundingMethod: 'ceil'
773
- * })
774
- * //=> '1 month'
775
- *
776
- * @example
777
- * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?
778
- * import { eoLocale } from 'date-fns/locale/eo'
779
- * const result = formatDistanceStrict(new Date(2016, 7, 1), new Date(2015, 0, 1), {
780
- * locale: eoLocale
781
- * })
782
- * //=> '1 jaro'
783
- */
784
-
785
- function formatDistanceStrict(dirtyDate, dirtyBaseDate, options) {
786
- var _ref, _options$locale, _options$roundingMeth;
787
-
788
- requiredArgs(2, arguments);
789
- var defaultOptions = getDefaultOptions();
790
- var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
791
-
792
- if (!locale.formatDistance) {
793
- throw new RangeError('locale must contain localize.formatDistance property');
794
- }
795
-
796
- var comparison = compareAsc(dirtyDate, dirtyBaseDate);
797
-
798
- if (isNaN(comparison)) {
799
- throw new RangeError('Invalid time value');
800
- }
801
-
802
- var localizeOptions = assign(cloneObject(options), {
803
- addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix),
804
- comparison: comparison
805
- });
806
- var dateLeft;
807
- var dateRight;
808
-
809
- if (comparison > 0) {
810
- dateLeft = toDate(dirtyBaseDate);
811
- dateRight = toDate(dirtyDate);
812
- } else {
813
- dateLeft = toDate(dirtyDate);
814
- dateRight = toDate(dirtyBaseDate);
815
- }
816
-
817
- var roundingMethod = String((_options$roundingMeth = options === null || options === void 0 ? void 0 : options.roundingMethod) !== null && _options$roundingMeth !== void 0 ? _options$roundingMeth : 'round');
818
- var roundingMethodFn;
819
-
820
- if (roundingMethod === 'floor') {
821
- roundingMethodFn = Math.floor;
822
- } else if (roundingMethod === 'ceil') {
823
- roundingMethodFn = Math.ceil;
824
- } else if (roundingMethod === 'round') {
825
- roundingMethodFn = Math.round;
826
- } else {
827
- throw new RangeError("roundingMethod must be 'floor', 'ceil' or 'round'");
828
- }
829
-
830
- var milliseconds = dateRight.getTime() - dateLeft.getTime();
831
- var minutes = milliseconds / MILLISECONDS_IN_MINUTE;
832
- var timezoneOffset = getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft); // Use DST-normalized difference in minutes for years, months and days;
833
- // use regular difference in minutes for hours, minutes and seconds.
834
-
835
- var dstNormalizedMinutes = (milliseconds - timezoneOffset) / MILLISECONDS_IN_MINUTE;
836
- var defaultUnit = options === null || options === void 0 ? void 0 : options.unit;
837
- var unit;
838
-
839
- if (!defaultUnit) {
840
- if (minutes < 1) {
841
- unit = 'second';
842
- } else if (minutes < 60) {
843
- unit = 'minute';
844
- } else if (minutes < MINUTES_IN_DAY) {
845
- unit = 'hour';
846
- } else if (dstNormalizedMinutes < MINUTES_IN_MONTH) {
847
- unit = 'day';
848
- } else if (dstNormalizedMinutes < MINUTES_IN_YEAR) {
849
- unit = 'month';
850
- } else {
851
- unit = 'year';
852
- }
853
- } else {
854
- unit = String(defaultUnit);
855
- } // 0 up to 60 seconds
856
-
857
-
858
- if (unit === 'second') {
859
- var seconds = roundingMethodFn(milliseconds / 1000);
860
- return locale.formatDistance('xSeconds', seconds, localizeOptions); // 1 up to 60 mins
861
- } else if (unit === 'minute') {
862
- var roundedMinutes = roundingMethodFn(minutes);
863
- return locale.formatDistance('xMinutes', roundedMinutes, localizeOptions); // 1 up to 24 hours
864
- } else if (unit === 'hour') {
865
- var hours = roundingMethodFn(minutes / 60);
866
- return locale.formatDistance('xHours', hours, localizeOptions); // 1 up to 30 days
867
- } else if (unit === 'day') {
868
- var days = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_DAY);
869
- return locale.formatDistance('xDays', days, localizeOptions); // 1 up to 12 months
870
- } else if (unit === 'month') {
871
- var months = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_MONTH);
872
- return months === 12 && defaultUnit !== 'month' ? locale.formatDistance('xYears', 1, localizeOptions) : locale.formatDistance('xMonths', months, localizeOptions); // 1 year up to max Date
873
- } else if (unit === 'year') {
874
- var years = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_YEAR);
875
- return locale.formatDistance('xYears', years, localizeOptions);
876
- }
877
-
878
- throw new RangeError("unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'");
879
- }
880
-
881
30
  const getItem = key => {
882
31
  try {
883
32
  const itemValue = localStorage.getItem(key);
884
-
885
33
  if (typeof itemValue === 'string') {
886
34
  return JSON.parse(itemValue);
887
35
  }
888
-
889
36
  return undefined;
890
- } catch (_unused) {
37
+ } catch {
891
38
  return undefined;
892
39
  }
893
40
  };
894
-
895
41
  function useLocalStorage(key, defaultValue) {
896
42
  const [value, setValue] = React__default.useState();
897
43
  React__default.useEffect(() => {
898
44
  const initialValue = getItem(key);
899
-
900
45
  if (typeof initialValue === 'undefined' || initialValue === null) {
901
46
  setValue(typeof defaultValue === 'function' ? defaultValue() : defaultValue);
902
47
  } else {
@@ -906,22 +51,18 @@ function useLocalStorage(key, defaultValue) {
906
51
  const setter = React__default.useCallback(updater => {
907
52
  setValue(old => {
908
53
  let newVal = updater;
909
-
910
54
  if (typeof updater == 'function') {
911
55
  newVal = updater(old);
912
56
  }
913
-
914
57
  try {
915
58
  localStorage.setItem(key, JSON.stringify(newVal));
916
- } catch (_unused2) {}
917
-
59
+ } catch {}
918
60
  return newVal;
919
61
  });
920
62
  }, [key]);
921
63
  return [value, setter];
922
64
  }
923
65
 
924
- const _excluded$3 = ["theme"];
925
66
  const defaultTheme = {
926
67
  background: '#0b1521',
927
68
  backgroundAlt: '#132337',
@@ -936,12 +77,10 @@ const defaultTheme = {
936
77
  warning: '#ffb200'
937
78
  };
938
79
  const ThemeContext = /*#__PURE__*/React__default.createContext(defaultTheme);
939
- function ThemeProvider(_ref) {
940
- let {
941
- theme
942
- } = _ref,
943
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
944
-
80
+ function ThemeProvider({
81
+ theme,
82
+ ...rest
83
+ }) {
945
84
  return /*#__PURE__*/React__default.createElement(ThemeContext.Provider, _extends({
946
85
  value: theme
947
86
  }, rest));
@@ -956,74 +95,62 @@ function useMediaQuery(query) {
956
95
  if (typeof window !== 'undefined') {
957
96
  return window.matchMedia && window.matchMedia(query).matches;
958
97
  }
959
-
960
98
  return;
961
- }); // Watch for changes
99
+ });
962
100
 
101
+ // Watch for changes
963
102
  React__default.useEffect(() => {
964
103
  if (typeof window !== 'undefined') {
965
104
  if (!window.matchMedia) {
966
105
  return;
967
- } // Create a matcher
968
-
969
-
970
- const matcher = window.matchMedia(query); // Create our handler
106
+ }
971
107
 
972
- const onChange = _ref => {
973
- let {
974
- matches
975
- } = _ref;
976
- return setIsMatch(matches);
977
- }; // Listen for changes
108
+ // Create a matcher
109
+ const matcher = window.matchMedia(query);
978
110
 
111
+ // Create our handler
112
+ const onChange = ({
113
+ matches
114
+ }) => setIsMatch(matches);
979
115
 
116
+ // Listen for changes
980
117
  matcher.addListener(onChange);
981
118
  return () => {
982
119
  // Stop listening for changes
983
120
  matcher.removeListener(onChange);
984
121
  };
985
122
  }
986
-
987
123
  return;
988
124
  }, [isMatch, query, setIsMatch]);
989
125
  return isMatch;
990
126
  }
991
127
 
992
- const _excluded$2 = ["style"];
993
128
  const isServer$1 = typeof window === 'undefined';
994
129
  function getStatusColor(match, theme) {
995
- return match.isPending ? theme.warning : match.isFetching ? theme.active : match.status === 'error' ? theme.danger : match.status === 'success' ? theme.success : theme.gray;
996
- } // export function getQueryStatusLabel(query: Query) {
997
- // return query.state.isFetching
998
- // ? 'fetching'
999
- // : !query.getObserversCount()
1000
- // ? 'inactive'
1001
- // : query.isStale()
1002
- // ? 'stale'
1003
- // : 'fresh'
1004
- // }
1005
-
1006
- function styled(type, newStyles, queries) {
1007
- if (queries === void 0) {
1008
- queries = {};
1009
- }
1010
-
1011
- return /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
1012
- let {
1013
- style
1014
- } = _ref,
1015
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
1016
-
130
+ return match.state.status === 'pending' ? theme.active : match.state.status === 'error' ? theme.danger : match.state.status === 'success' ? theme.success : theme.gray;
131
+ }
132
+ function styled(type, newStyles, queries = {}) {
133
+ return /*#__PURE__*/React__default.forwardRef(({
134
+ style,
135
+ ...rest
136
+ }, ref) => {
1017
137
  const theme = useTheme();
1018
- const mediaStyles = Object.entries(queries).reduce((current, _ref2) => {
1019
- let [key, value] = _ref2;
138
+ const mediaStyles = Object.entries(queries).reduce((current, [key, value]) => {
1020
139
  // eslint-disable-next-line react-hooks/rules-of-hooks
1021
- return useMediaQuery(key) ? _extends({}, current, typeof value === 'function' ? value(rest, theme) : value) : current;
140
+ return useMediaQuery(key) ? {
141
+ ...current,
142
+ ...(typeof value === 'function' ? value(rest, theme) : value)
143
+ } : current;
1022
144
  }, {});
1023
- return /*#__PURE__*/React__default.createElement(type, _extends({}, rest, {
1024
- style: _extends({}, typeof newStyles === 'function' ? newStyles(rest, theme) : newStyles, style, mediaStyles),
145
+ return /*#__PURE__*/React__default.createElement(type, {
146
+ ...rest,
147
+ style: {
148
+ ...(typeof newStyles === 'function' ? newStyles(rest, theme) : newStyles),
149
+ ...style,
150
+ ...mediaStyles
151
+ },
1025
152
  ref
1026
- }));
153
+ });
1027
154
  });
1028
155
  }
1029
156
  function useIsMounted() {
@@ -1037,22 +164,22 @@ function useIsMounted() {
1037
164
  }, []);
1038
165
  return isMounted;
1039
166
  }
167
+
1040
168
  /**
1041
169
  * Displays a string regardless the type of the data
1042
170
  * @param {unknown} value Value to be stringified
1043
171
  */
1044
-
1045
172
  const displayValue = value => {
1046
173
  const name = Object.getOwnPropertyNames(Object(value));
1047
- const newValue = typeof value === 'bigint' ? value.toString() + "n" : value;
174
+ const newValue = typeof value === 'bigint' ? `${value.toString()}n` : value;
1048
175
  return JSON.stringify(newValue, name);
1049
176
  };
177
+
1050
178
  /**
1051
179
  * This hook is a safe useState version which schedules state updates in microtasks
1052
180
  * to prevent updating a component state while React is rendering different components
1053
181
  * or when the component is not mounted anymore.
1054
182
  */
1055
-
1056
183
  function useSafeState(initialState) {
1057
184
  const isMounted = useIsMounted();
1058
185
  const [state, setState] = React__default.useState(initialState);
@@ -1065,55 +192,20 @@ function useSafeState(initialState) {
1065
192
  }, [isMounted]);
1066
193
  return [state, safeSetState];
1067
194
  }
195
+
1068
196
  /**
1069
197
  * Schedules a microtask.
1070
198
  * This can be useful to schedule state updates after rendering.
1071
199
  */
1072
-
1073
200
  function scheduleMicrotask(callback) {
1074
201
  Promise.resolve().then(callback).catch(error => setTimeout(() => {
1075
202
  throw error;
1076
203
  }));
1077
204
  }
1078
205
 
1079
- function multiSortBy(arr, accessors) {
1080
- if (accessors === void 0) {
1081
- accessors = [d => d];
1082
- }
1083
-
1084
- return arr.map((d, i) => [d, i]).sort((_ref3, _ref4) => {
1085
- let [a, ai] = _ref3;
1086
- let [b, bi] = _ref4;
1087
-
1088
- for (const accessor of accessors) {
1089
- const ao = accessor(a);
1090
- const bo = accessor(b);
1091
-
1092
- if (typeof ao === 'undefined') {
1093
- if (typeof bo === 'undefined') {
1094
- continue;
1095
- }
1096
-
1097
- return 1;
1098
- }
1099
-
1100
- if (ao === bo) {
1101
- continue;
1102
- }
1103
-
1104
- return ao > bo ? 1 : -1;
1105
- }
1106
-
1107
- return ai - bi;
1108
- }).map(_ref5 => {
1109
- let [d] = _ref5;
1110
- return d;
1111
- });
1112
- }
1113
-
1114
206
  const Panel = styled('div', (_props, theme) => ({
1115
207
  fontSize: 'clamp(12px, 1.5vw, 14px)',
1116
- fontFamily: "sans-serif",
208
+ fontFamily: `sans-serif`,
1117
209
  display: 'flex',
1118
210
  backgroundColor: theme.background,
1119
211
  color: theme.foreground
@@ -1122,10 +214,11 @@ const Panel = styled('div', (_props, theme) => ({
1122
214
  flexDirection: 'column'
1123
215
  },
1124
216
  '(max-width: 600px)': {
1125
- fontSize: '.9em' // flexDirection: 'column',
1126
-
217
+ fontSize: '.9em'
218
+ // flexDirection: 'column',
1127
219
  }
1128
220
  });
221
+
1129
222
  const ActivePanel = styled('div', () => ({
1130
223
  flex: '1 1 500px',
1131
224
  display: 'flex',
@@ -1134,7 +227,7 @@ const ActivePanel = styled('div', () => ({
1134
227
  height: '100%'
1135
228
  }), {
1136
229
  '(max-width: 700px)': (_props, theme) => ({
1137
- borderTop: "2px solid " + theme.gray
230
+ borderTop: `2px solid ${theme.gray}`
1138
231
  })
1139
232
  });
1140
233
  const Button = styled('button', (props, theme) => ({
@@ -1148,10 +241,13 @@ const Button = styled('button', (props, theme) => ({
1148
241
  padding: '.5em',
1149
242
  opacity: props.disabled ? '.5' : undefined,
1150
243
  cursor: 'pointer'
1151
- })); // export const QueryKeys = styled('span', {
244
+ }));
245
+
246
+ // export const QueryKeys = styled('span', {
1152
247
  // display: 'inline-block',
1153
248
  // fontSize: '0.9em',
1154
249
  // })
250
+
1155
251
  // export const QueryKey = styled('span', {
1156
252
  // display: 'inline-flex',
1157
253
  // alignItems: 'center',
@@ -1164,40 +260,7 @@ const Button = styled('button', (props, theme) => ({
1164
260
  const Code = styled('code', {
1165
261
  fontSize: '.9em'
1166
262
  });
1167
- styled('input', (_props, theme) => ({
1168
- backgroundColor: theme.inputBackgroundColor,
1169
- border: 0,
1170
- borderRadius: '.2em',
1171
- color: theme.inputTextColor,
1172
- fontSize: '.9em',
1173
- lineHeight: "1.3",
1174
- padding: '.3em .4em'
1175
- }));
1176
- styled('select', (_props, theme) => ({
1177
- display: "inline-block",
1178
- fontSize: ".9em",
1179
- fontFamily: "sans-serif",
1180
- fontWeight: 'normal',
1181
- lineHeight: "1.3",
1182
- padding: ".3em 1.5em .3em .5em",
1183
- height: 'auto',
1184
- border: 0,
1185
- borderRadius: ".2em",
1186
- appearance: "none",
1187
- WebkitAppearance: 'none',
1188
- backgroundColor: theme.inputBackgroundColor,
1189
- backgroundImage: "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23444444'><polygon points='0,25 100,25 50,75'/></svg>\")",
1190
- backgroundRepeat: "no-repeat",
1191
- backgroundPosition: "right .55em center",
1192
- backgroundSize: ".65em auto, 100%",
1193
- color: theme.inputTextColor
1194
- }), {
1195
- '(max-width: 500px)': {
1196
- display: 'none'
1197
- }
1198
- });
1199
263
 
1200
- const _excluded$1 = ["value", "defaultExpanded", "renderer", "pageSize"];
1201
264
  const Entry = styled('div', {
1202
265
  fontFamily: 'Menlo, monospace',
1203
266
  fontSize: '.7rem',
@@ -1233,20 +296,17 @@ const Info = styled('span', {
1233
296
  color: 'grey',
1234
297
  fontSize: '.7em'
1235
298
  });
1236
- const Expander = _ref => {
1237
- let {
1238
- expanded,
1239
- style = {}
1240
- } = _ref;
1241
- return /*#__PURE__*/React.createElement("span", {
1242
- style: _extends({
1243
- display: 'inline-block',
1244
- transition: 'all .1s ease',
1245
- transform: "rotate(" + (expanded ? 90 : 0) + "deg) " + (style.transform || '')
1246
- }, style)
1247
- }, "\u25B6");
1248
- };
1249
-
299
+ const Expander = ({
300
+ expanded,
301
+ style = {}
302
+ }) => /*#__PURE__*/React.createElement("span", {
303
+ style: {
304
+ display: 'inline-block',
305
+ transition: 'all .1s ease',
306
+ transform: `rotate(${expanded ? 90 : 0}deg) ${style.transform || ''}`,
307
+ ...style
308
+ }
309
+ }, "\u25B6");
1250
310
  /**
1251
311
  * Chunk elements in the array by size
1252
312
  *
@@ -1260,39 +320,34 @@ function chunkArray(array, size) {
1260
320
  if (size < 1) return [];
1261
321
  let i = 0;
1262
322
  const result = [];
1263
-
1264
323
  while (i < array.length) {
1265
324
  result.push(array.slice(i, i + size));
1266
325
  i = i + size;
1267
326
  }
1268
-
1269
327
  return result;
1270
328
  }
1271
- const DefaultRenderer = _ref2 => {
1272
- let {
1273
- handleEntry,
1274
- label,
1275
- value,
1276
- subEntries = [],
1277
- subEntryPages = [],
1278
- type,
1279
- expanded = false,
1280
- toggleExpanded,
1281
- pageSize,
1282
- renderer
1283
- } = _ref2;
329
+ const DefaultRenderer = ({
330
+ handleEntry,
331
+ label,
332
+ value,
333
+ subEntries = [],
334
+ subEntryPages = [],
335
+ type,
336
+ expanded = false,
337
+ toggleExpanded,
338
+ pageSize,
339
+ renderer
340
+ }) => {
1284
341
  const [expandedPages, setExpandedPages] = React.useState([]);
1285
342
  const [valueSnapshot, setValueSnapshot] = React.useState(undefined);
1286
-
1287
343
  const refreshValueSnapshot = () => {
1288
344
  setValueSnapshot(value());
1289
345
  };
1290
-
1291
346
  return /*#__PURE__*/React.createElement(Entry, null, subEntryPages.length ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ExpandButton, {
1292
347
  onClick: () => toggleExpanded()
1293
348
  }, /*#__PURE__*/React.createElement(Expander, {
1294
349
  expanded: expanded
1295
- }), " ", label, ' ', /*#__PURE__*/React.createElement(Info, null, String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : '', subEntries.length, " ", subEntries.length > 1 ? "items" : "item")), expanded ? subEntryPages.length === 1 ? /*#__PURE__*/React.createElement(SubEntries, null, subEntries.map((entry, index) => handleEntry(entry))) : /*#__PURE__*/React.createElement(SubEntries, null, subEntryPages.map((entries, index) => /*#__PURE__*/React.createElement("div", {
350
+ }), " ", label, ' ', /*#__PURE__*/React.createElement(Info, null, String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : '', subEntries.length, " ", subEntries.length > 1 ? `items` : `item`)), expanded ? subEntryPages.length === 1 ? /*#__PURE__*/React.createElement(SubEntries, null, subEntries.map((entry, index) => handleEntry(entry))) : /*#__PURE__*/React.createElement(SubEntries, null, subEntryPages.map((entries, index) => /*#__PURE__*/React.createElement("div", {
1296
351
  key: index
1297
352
  }, /*#__PURE__*/React.createElement(Entry, null, /*#__PURE__*/React.createElement(LabelButton, {
1298
353
  onClick: () => setExpandedPages(old => old.includes(index) ? old.filter(d => d !== index) : [...old, index])
@@ -1312,34 +367,29 @@ const DefaultRenderer = _ref2 => {
1312
367
  defaultExpanded: {}
1313
368
  })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Label, null, label, ":"), " ", /*#__PURE__*/React.createElement(Value, null, displayValue(value))));
1314
369
  };
1315
-
1316
370
  function isIterable(x) {
1317
371
  return Symbol.iterator in x;
1318
372
  }
1319
-
1320
- function Explorer(_ref3) {
1321
- let {
1322
- value,
1323
- defaultExpanded,
1324
- renderer = DefaultRenderer,
1325
- pageSize = 100
1326
- } = _ref3,
1327
- rest = _objectWithoutPropertiesLoose(_ref3, _excluded$1);
1328
-
373
+ function Explorer({
374
+ value,
375
+ defaultExpanded,
376
+ renderer = DefaultRenderer,
377
+ pageSize = 100,
378
+ ...rest
379
+ }) {
1329
380
  const [expanded, setExpanded] = React.useState(Boolean(defaultExpanded));
1330
381
  const toggleExpanded = React.useCallback(() => setExpanded(old => !old), []);
1331
382
  let type = typeof value;
1332
383
  let subEntries = [];
1333
-
1334
384
  const makeProperty = sub => {
1335
385
  const subDefaultExpanded = defaultExpanded === true ? {
1336
386
  [sub.label]: true
1337
- } : defaultExpanded == null ? void 0 : defaultExpanded[sub.label];
1338
- return _extends({}, sub, {
387
+ } : defaultExpanded?.[sub.label];
388
+ return {
389
+ ...sub,
1339
390
  defaultExpanded: subDefaultExpanded
1340
- });
391
+ };
1341
392
  };
1342
-
1343
393
  if (Array.isArray(value)) {
1344
394
  type = 'array';
1345
395
  subEntries = value.map((d, i) => makeProperty({
@@ -1354,17 +404,13 @@ function Explorer(_ref3) {
1354
404
  }));
1355
405
  } else if (typeof value === 'object' && value !== null) {
1356
406
  type = 'object';
1357
- subEntries = Object.entries(value).map(_ref4 => {
1358
- let [key, val] = _ref4;
1359
- return makeProperty({
1360
- label: key,
1361
- value: val
1362
- });
1363
- });
407
+ subEntries = Object.entries(value).map(([key, val]) => makeProperty({
408
+ label: key,
409
+ value: val
410
+ }));
1364
411
  }
1365
-
1366
412
  const subEntryPages = chunkArray(subEntries, pageSize);
1367
- return renderer(_extends({
413
+ return renderer({
1368
414
  handleEntry: entry => /*#__PURE__*/React.createElement(Explorer, _extends({
1369
415
  key: entry.label,
1370
416
  value: value,
@@ -1376,51 +422,50 @@ function Explorer(_ref3) {
1376
422
  value,
1377
423
  expanded,
1378
424
  toggleExpanded,
1379
- pageSize
1380
- }, rest));
425
+ pageSize,
426
+ ...rest
427
+ });
1381
428
  }
1382
429
 
1383
- const _excluded = ["style"],
1384
- _excluded2 = ["style", "onClick"],
1385
- _excluded3 = ["style", "onClick"],
1386
- _excluded4 = ["isOpen", "setIsOpen", "handleDragStart", "router"];
1387
430
  const isServer = typeof window === 'undefined';
1388
-
1389
431
  function Logo(props) {
1390
- var _props$style;
1391
-
1392
432
  return /*#__PURE__*/React__default.createElement("div", _extends({}, props, {
1393
- style: _extends({}, (_props$style = props.style) != null ? _props$style : {}, {
433
+ style: {
434
+ ...(props.style ?? {}),
1394
435
  display: 'flex',
1395
436
  alignItems: 'center',
1396
437
  flexDirection: 'column',
1397
- fontSize: '0.7rem',
1398
- fontWeight: '900',
438
+ fontSize: '0.8rem',
439
+ fontWeight: 'bolder',
1399
440
  lineHeight: '1'
1400
- })
441
+ }
1401
442
  }), /*#__PURE__*/React__default.createElement("div", {
1402
443
  style: {
1403
444
  letterSpacing: '-0.05rem'
1404
445
  }
1405
446
  }, "TANSTACK"), /*#__PURE__*/React__default.createElement("div", {
1406
- className: "text-transparent bg-clip-text bg-gradient-to-r from-lime-500 to-emerald-500",
1407
447
  style: {
448
+ backgroundImage: 'linear-gradient(to right, var(--tw-gradient-stops))',
449
+ // @ts-ignore
450
+ '--tw-gradient-from': '#84cc16',
451
+ '--tw-gradient-stops': 'var(--tw-gradient-from), var(--tw-gradient-to)',
452
+ '--tw-gradient-to': '#10b981',
453
+ WebkitBackgroundClip: 'text',
454
+ color: 'transparent',
1408
455
  letterSpacing: '0.1rem',
1409
456
  marginRight: '-0.2rem'
1410
457
  }
1411
458
  }, "ROUTER"));
1412
459
  }
1413
-
1414
- function TanStackRouterDevtools(_ref) {
1415
- let {
1416
- initialIsOpen,
1417
- panelProps = {},
1418
- closeButtonProps = {},
1419
- toggleButtonProps = {},
1420
- position = 'bottom-left',
1421
- containerElement: Container = 'footer',
1422
- router
1423
- } = _ref;
460
+ function TanStackRouterDevtools({
461
+ initialIsOpen,
462
+ panelProps = {},
463
+ closeButtonProps = {},
464
+ toggleButtonProps = {},
465
+ position = 'bottom-left',
466
+ containerElement: Container = 'footer',
467
+ router
468
+ }) {
1424
469
  const rootRef = React__default.useRef(null);
1425
470
  const panelRef = React__default.useRef(null);
1426
471
  const [isOpen, setIsOpen] = useLocalStorage('tanstackRouterDevtoolsOpen', initialIsOpen);
@@ -1428,61 +473,51 @@ function TanStackRouterDevtools(_ref) {
1428
473
  const [isResolvedOpen, setIsResolvedOpen] = useSafeState(false);
1429
474
  const [isResizing, setIsResizing] = useSafeState(false);
1430
475
  const isMounted = useIsMounted();
1431
-
1432
- const _handleDragStart = (panelElement, startEvent) => {
1433
- var _panelElement$getBoun;
1434
-
476
+ const handleDragStart = (panelElement, startEvent) => {
1435
477
  if (startEvent.button !== 0) return; // Only allow left click for drag
1436
478
 
1437
479
  setIsResizing(true);
1438
480
  const dragInfo = {
1439
- originalHeight: (_panelElement$getBoun = panelElement == null ? void 0 : panelElement.getBoundingClientRect().height) != null ? _panelElement$getBoun : 0,
481
+ originalHeight: panelElement?.getBoundingClientRect().height ?? 0,
1440
482
  pageY: startEvent.pageY
1441
483
  };
1442
-
1443
484
  const run = moveEvent => {
1444
485
  const delta = dragInfo.pageY - moveEvent.pageY;
1445
- const newHeight = (dragInfo == null ? void 0 : dragInfo.originalHeight) + delta;
486
+ const newHeight = dragInfo?.originalHeight + delta;
1446
487
  setDevtoolsHeight(newHeight);
1447
-
1448
488
  if (newHeight < 70) {
1449
489
  setIsOpen(false);
1450
490
  } else {
1451
491
  setIsOpen(true);
1452
492
  }
1453
493
  };
1454
-
1455
494
  const unsub = () => {
1456
495
  setIsResizing(false);
1457
496
  document.removeEventListener('mousemove', run);
1458
497
  document.removeEventListener('mouseUp', unsub);
1459
498
  };
1460
-
1461
499
  document.addEventListener('mousemove', run);
1462
500
  document.addEventListener('mouseup', unsub);
1463
501
  };
1464
-
1465
502
  React__default.useEffect(() => {
1466
- setIsResolvedOpen(isOpen != null ? isOpen : false);
1467
- }, [isOpen, isResolvedOpen, setIsResolvedOpen]); // Toggle panel visibility before/after transition (depending on direction).
1468
- // Prevents focusing in a closed panel.
503
+ setIsResolvedOpen(isOpen ?? false);
504
+ }, [isOpen, isResolvedOpen, setIsResolvedOpen]);
1469
505
 
506
+ // Toggle panel visibility before/after transition (depending on direction).
507
+ // Prevents focusing in a closed panel.
1470
508
  React__default.useEffect(() => {
1471
509
  const ref = panelRef.current;
1472
-
1473
510
  if (ref) {
1474
511
  const handlePanelTransitionStart = () => {
1475
512
  if (ref && isResolvedOpen) {
1476
513
  ref.style.visibility = 'visible';
1477
514
  }
1478
515
  };
1479
-
1480
516
  const handlePanelTransitionEnd = () => {
1481
517
  if (ref && !isResolvedOpen) {
1482
518
  ref.style.visibility = 'hidden';
1483
519
  }
1484
520
  };
1485
-
1486
521
  ref.addEventListener('transitionstart', handlePanelTransitionStart);
1487
522
  ref.addEventListener('transitionend', handlePanelTransitionEnd);
1488
523
  return () => {
@@ -1490,62 +525,46 @@ function TanStackRouterDevtools(_ref) {
1490
525
  ref.removeEventListener('transitionend', handlePanelTransitionEnd);
1491
526
  };
1492
527
  }
1493
-
1494
528
  return;
1495
529
  }, [isResolvedOpen]);
1496
530
  React__default[isServer ? 'useEffect' : 'useLayoutEffect'](() => {
1497
531
  if (isResolvedOpen) {
1498
- var _rootRef$current, _rootRef$current$pare;
1499
-
1500
- const previousValue = (_rootRef$current = rootRef.current) == null ? void 0 : (_rootRef$current$pare = _rootRef$current.parentElement) == null ? void 0 : _rootRef$current$pare.style.paddingBottom;
1501
-
532
+ const previousValue = rootRef.current?.parentElement?.style.paddingBottom;
1502
533
  const run = () => {
1503
- var _panelRef$current, _rootRef$current2;
1504
-
1505
- const containerHeight = (_panelRef$current = panelRef.current) == null ? void 0 : _panelRef$current.getBoundingClientRect().height;
1506
-
1507
- if ((_rootRef$current2 = rootRef.current) != null && _rootRef$current2.parentElement) {
1508
- rootRef.current.parentElement.style.paddingBottom = containerHeight + "px";
534
+ const containerHeight = panelRef.current?.getBoundingClientRect().height;
535
+ if (rootRef.current?.parentElement) {
536
+ rootRef.current.parentElement.style.paddingBottom = `${containerHeight}px`;
1509
537
  }
1510
538
  };
1511
-
1512
539
  run();
1513
-
1514
540
  if (typeof window !== 'undefined') {
1515
541
  window.addEventListener('resize', run);
1516
542
  return () => {
1517
- var _rootRef$current3;
1518
-
1519
543
  window.removeEventListener('resize', run);
1520
-
1521
- if ((_rootRef$current3 = rootRef.current) != null && _rootRef$current3.parentElement && typeof previousValue === 'string') {
544
+ if (rootRef.current?.parentElement && typeof previousValue === 'string') {
1522
545
  rootRef.current.parentElement.style.paddingBottom = previousValue;
1523
546
  }
1524
547
  };
1525
548
  }
1526
549
  }
1527
-
1528
550
  return;
1529
551
  }, [isResolvedOpen]);
1530
-
1531
552
  const {
1532
- style: panelStyle = {}
1533
- } = panelProps,
1534
- otherPanelProps = _objectWithoutPropertiesLoose(panelProps, _excluded);
1535
-
553
+ style: panelStyle = {},
554
+ ...otherPanelProps
555
+ } = panelProps;
1536
556
  const {
1537
557
  style: closeButtonStyle = {},
1538
- onClick: onCloseClick
1539
- } = closeButtonProps,
1540
- otherCloseButtonProps = _objectWithoutPropertiesLoose(closeButtonProps, _excluded2);
1541
-
558
+ onClick: onCloseClick,
559
+ ...otherCloseButtonProps
560
+ } = closeButtonProps;
1542
561
  const {
1543
562
  style: toggleButtonStyle = {},
1544
- onClick: onToggleClick
1545
- } = toggleButtonProps,
1546
- otherToggleButtonProps = _objectWithoutPropertiesLoose(toggleButtonProps, _excluded3); // Do not render on the server
1547
-
563
+ onClick: onToggleClick,
564
+ ...otherToggleButtonProps
565
+ } = toggleButtonProps;
1548
566
 
567
+ // Do not render on the server
1549
568
  if (!isMounted()) return null;
1550
569
  return /*#__PURE__*/React__default.createElement(Container, {
1551
570
  ref: rootRef,
@@ -1556,35 +575,38 @@ function TanStackRouterDevtools(_ref) {
1556
575
  ref: panelRef
1557
576
  }, otherPanelProps, {
1558
577
  router: router,
1559
- style: _extends({
578
+ style: {
1560
579
  position: 'fixed',
1561
580
  bottom: '0',
1562
581
  right: '0',
1563
582
  zIndex: 99999,
1564
583
  width: '100%',
1565
- height: devtoolsHeight != null ? devtoolsHeight : 500,
584
+ height: devtoolsHeight ?? 500,
1566
585
  maxHeight: '90%',
1567
586
  boxShadow: '0 0 20px rgba(0,0,0,.3)',
1568
- borderTop: "1px solid " + defaultTheme.gray,
587
+ borderTop: `1px solid ${defaultTheme.gray}`,
1569
588
  transformOrigin: 'top',
1570
589
  // visibility will be toggled after transitions, but set initial state here
1571
- visibility: isOpen ? 'visible' : 'hidden'
1572
- }, panelStyle, isResizing ? {
1573
- transition: "none"
1574
- } : {
1575
- transition: "all .2s ease"
1576
- }, isResolvedOpen ? {
1577
- opacity: 1,
1578
- pointerEvents: 'all',
1579
- transform: "translateY(0) scale(1)"
1580
- } : {
1581
- opacity: 0,
1582
- pointerEvents: 'none',
1583
- transform: "translateY(15px) scale(1.02)"
1584
- }),
590
+ visibility: isOpen ? 'visible' : 'hidden',
591
+ ...panelStyle,
592
+ ...(isResizing ? {
593
+ transition: `none`
594
+ } : {
595
+ transition: `all .2s ease`
596
+ }),
597
+ ...(isResolvedOpen ? {
598
+ opacity: 1,
599
+ pointerEvents: 'all',
600
+ transform: `translateY(0) scale(1)`
601
+ } : {
602
+ opacity: 0,
603
+ pointerEvents: 'none',
604
+ transform: `translateY(15px) scale(1.02)`
605
+ })
606
+ },
1585
607
  isOpen: isResolvedOpen,
1586
608
  setIsOpen: setIsOpen,
1587
- handleDragStart: e => _handleDragStart(panelRef.current, e)
609
+ handleDragStart: e => handleDragStart(panelRef.current, e)
1588
610
  })), isResolvedOpen ? /*#__PURE__*/React__default.createElement(Button, _extends({
1589
611
  type: "button",
1590
612
  "aria-label": "Close TanStack Router Devtools"
@@ -1593,20 +615,22 @@ function TanStackRouterDevtools(_ref) {
1593
615
  setIsOpen(false);
1594
616
  onCloseClick && onCloseClick(e);
1595
617
  },
1596
- style: _extends({
618
+ style: {
1597
619
  position: 'fixed',
1598
620
  zIndex: 99999,
1599
621
  margin: '.5em',
1600
- bottom: 0
1601
- }, position === 'top-right' ? {
1602
- right: '0'
1603
- } : position === 'top-left' ? {
1604
- left: '0'
1605
- } : position === 'bottom-right' ? {
1606
- right: '0'
1607
- } : {
1608
- left: '0'
1609
- }, closeButtonStyle)
622
+ bottom: 0,
623
+ ...(position === 'top-right' ? {
624
+ right: '0'
625
+ } : position === 'top-left' ? {
626
+ left: '0'
627
+ } : position === 'bottom-right' ? {
628
+ right: '0'
629
+ } : {
630
+ left: '0'
631
+ }),
632
+ ...closeButtonStyle
633
+ }
1610
634
  }), "Close") : null), !isResolvedOpen ? /*#__PURE__*/React__default.createElement("button", _extends({
1611
635
  type: "button"
1612
636
  }, otherToggleButtonProps, {
@@ -1615,7 +639,7 @@ function TanStackRouterDevtools(_ref) {
1615
639
  setIsOpen(true);
1616
640
  onToggleClick && onToggleClick(e);
1617
641
  },
1618
- style: _extends({
642
+ style: {
1619
643
  appearance: 'none',
1620
644
  background: 'none',
1621
645
  border: 0,
@@ -1626,65 +650,95 @@ function TanStackRouterDevtools(_ref) {
1626
650
  fontSize: '1.5em',
1627
651
  margin: '.5em',
1628
652
  cursor: 'pointer',
1629
- width: 'fit-content'
1630
- }, position === 'top-right' ? {
1631
- top: '0',
1632
- right: '0'
1633
- } : position === 'top-left' ? {
1634
- top: '0',
1635
- left: '0'
1636
- } : position === 'bottom-right' ? {
1637
- bottom: '0',
1638
- right: '0'
1639
- } : {
1640
- bottom: '0',
1641
- left: '0'
1642
- }, toggleButtonStyle)
653
+ width: 'fit-content',
654
+ ...(position === 'top-right' ? {
655
+ top: '0',
656
+ right: '0'
657
+ } : position === 'top-left' ? {
658
+ top: '0',
659
+ left: '0'
660
+ } : position === 'bottom-right' ? {
661
+ bottom: '0',
662
+ right: '0'
663
+ } : {
664
+ bottom: '0',
665
+ left: '0'
666
+ }),
667
+ ...toggleButtonStyle
668
+ }
1643
669
  }), /*#__PURE__*/React__default.createElement(Logo, {
1644
670
  "aria-hidden": true
1645
671
  })) : null);
1646
672
  }
1647
673
  const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(function TanStackRouterDevtoolsPanel(props, ref) {
1648
- var _Object$values$find$m, _Object$values, _Object$values$find, _router$state$matches, _router$state$pending, _router$state$pending2, _last, _last2, _last3, _last4, _last5, _last6;
1649
-
1650
674
  const {
1651
675
  isOpen = true,
676
+ setIsOpen,
1652
677
  handleDragStart,
1653
- router
1654
- } = props,
1655
- panelProps = _objectWithoutPropertiesLoose(props, _excluded4);
1656
-
1657
- const rerender = React__default.useReducer(() => ({}), {})[1];
1658
- React__default.useEffect(() => {
1659
- let interval = setInterval(() => {
1660
- router.cleanMatchCache(); // router.notify()
1661
-
1662
- rerender();
1663
- }, 250);
1664
- return () => {
1665
- clearInterval(interval);
1666
- };
1667
- }, []);
678
+ router: userRouter,
679
+ ...panelProps
680
+ } = props;
681
+ const routerContextValue = React__default.useContext(routerContext);
682
+ const router = userRouter ?? routerContextValue?.router;
683
+ invariant(router, 'No router was found for the TanStack Router Devtools. Please place the devtools in the <RouterProvider> component tree or pass the router instance to the devtools manually.');
684
+ useStore(router.__store);
1668
685
  const [activeRouteId, setActiveRouteId] = useLocalStorage('tanstackRouterDevtoolsActiveRouteId', '');
1669
686
  const [activeMatchId, setActiveMatchId] = useLocalStorage('tanstackRouterDevtoolsActiveMatchId', '');
1670
687
  React__default.useEffect(() => {
1671
688
  setActiveMatchId('');
1672
689
  }, [activeRouteId]);
1673
- const activeMatch = (_Object$values$find$m = (_Object$values = Object.values(router.matchCache)) == null ? void 0 : (_Object$values$find = _Object$values.find(d => d.match.matchId === activeMatchId)) == null ? void 0 : _Object$values$find.match) != null ? _Object$values$find$m : (_router$state$matches = router.state.matches) == null ? void 0 : _router$state$matches.find(d => d.routeId === activeRouteId);
1674
- const matchCacheValues = multiSortBy(Object.keys(router.matchCache).filter(key => {
1675
- const cacheEntry = router.matchCache[key];
1676
- return cacheEntry.gc > Date.now();
1677
- }).map(key => router.matchCache[key]), [d => d.match.isFetching ? -1 : 1, d => -d.match.updatedAt]);
690
+ const allMatches = React__default.useMemo(() => [...Object.values(router.state.currentMatches), ...Object.values(router.state.pendingMatches ?? [])], [router.state.currentMatches, router.state.pendingMatches]);
691
+ const activeMatch = allMatches?.find(d => d.id === activeMatchId) || allMatches?.find(d => d.route.id === activeRouteId);
1678
692
  return /*#__PURE__*/React__default.createElement(ThemeProvider, {
1679
693
  theme: defaultTheme
1680
- }, /*#__PURE__*/React__default.createElement("script", {
1681
- src: "https://cdn.tailwindcss.com"
1682
- }), /*#__PURE__*/React__default.createElement(Panel, _extends({
694
+ }, /*#__PURE__*/React__default.createElement(Panel, _extends({
1683
695
  ref: ref,
1684
696
  className: "TanStackRouterDevtoolsPanel"
1685
697
  }, panelProps), /*#__PURE__*/React__default.createElement("style", {
1686
698
  dangerouslySetInnerHTML: {
1687
- __html: "\n\n .TanStackRouterDevtoolsPanel * {\n scrollbar-color: " + defaultTheme.backgroundAlt + " " + defaultTheme.gray + ";\n }\n\n .TanStackRouterDevtoolsPanel *::-webkit-scrollbar, .TanStackRouterDevtoolsPanel scrollbar {\n width: 1em;\n height: 1em;\n }\n\n .TanStackRouterDevtoolsPanel *::-webkit-scrollbar-track, .TanStackRouterDevtoolsPanel scrollbar-track {\n background: " + defaultTheme.backgroundAlt + ";\n }\n\n .TanStackRouterDevtoolsPanel *::-webkit-scrollbar-thumb, .TanStackRouterDevtoolsPanel scrollbar-thumb {\n background: " + defaultTheme.gray + ";\n border-radius: .5em;\n border: 3px solid " + defaultTheme.backgroundAlt + ";\n }\n\n .TanStackRouterDevtoolsPanel table {\n width: 100%;\n }\n\n .TanStackRouterDevtoolsPanel table tr {\n border-bottom: 2px dotted rgba(255, 255, 255, .2);\n }\n\n .TanStackRouterDevtoolsPanel table tr:last-child {\n border-bottom: none\n }\n\n .TanStackRouterDevtoolsPanel table td {\n padding: .25rem .5rem;\n border-right: 2px dotted rgba(255, 255, 255, .05);\n }\n\n .TanStackRouterDevtoolsPanel table td:last-child {\n border-right: none\n }\n\n "
699
+ __html: `
700
+
701
+ .TanStackRouterDevtoolsPanel * {
702
+ scrollbar-color: ${defaultTheme.backgroundAlt} ${defaultTheme.gray};
703
+ }
704
+
705
+ .TanStackRouterDevtoolsPanel *::-webkit-scrollbar, .TanStackRouterDevtoolsPanel scrollbar {
706
+ width: 1em;
707
+ height: 1em;
708
+ }
709
+
710
+ .TanStackRouterDevtoolsPanel *::-webkit-scrollbar-track, .TanStackRouterDevtoolsPanel scrollbar-track {
711
+ background: ${defaultTheme.backgroundAlt};
712
+ }
713
+
714
+ .TanStackRouterDevtoolsPanel *::-webkit-scrollbar-thumb, .TanStackRouterDevtoolsPanel scrollbar-thumb {
715
+ background: ${defaultTheme.gray};
716
+ border-radius: .5em;
717
+ border: 3px solid ${defaultTheme.backgroundAlt};
718
+ }
719
+
720
+ .TanStackRouterDevtoolsPanel table {
721
+ width: 100%;
722
+ }
723
+
724
+ .TanStackRouterDevtoolsPanel table tr {
725
+ border-bottom: 2px dotted rgba(255, 255, 255, .2);
726
+ }
727
+
728
+ .TanStackRouterDevtoolsPanel table tr:last-child {
729
+ border-bottom: none
730
+ }
731
+
732
+ .TanStackRouterDevtoolsPanel table td {
733
+ padding: .25rem .5rem;
734
+ border-right: 2px dotted rgba(255, 255, 255, .05);
735
+ }
736
+
737
+ .TanStackRouterDevtoolsPanel table td:last-child {
738
+ border-right: none
739
+ }
740
+
741
+ `
1688
742
  }
1689
743
  }), /*#__PURE__*/React__default.createElement("div", {
1690
744
  style: {
@@ -1704,13 +758,17 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
1704
758
  minHeight: '40%',
1705
759
  maxHeight: '100%',
1706
760
  overflow: 'auto',
1707
- borderRight: "1px solid " + defaultTheme.grayAlt,
761
+ borderRight: `1px solid ${defaultTheme.grayAlt}`,
1708
762
  display: 'flex',
1709
763
  flexDirection: 'column'
1710
764
  }
1711
765
  }, /*#__PURE__*/React__default.createElement("div", {
1712
- className: "flex justify-start gap-2 p-2 items-center",
1713
766
  style: {
767
+ display: 'flex',
768
+ justifyContent: 'start',
769
+ gap: '1rem',
770
+ padding: '1rem',
771
+ alignItems: 'center',
1714
772
  background: defaultTheme.backgroundAlt
1715
773
  }
1716
774
  }, /*#__PURE__*/React__default.createElement(Logo, {
@@ -1743,7 +801,7 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
1743
801
  minHeight: '40%',
1744
802
  maxHeight: '100%',
1745
803
  overflow: 'auto',
1746
- borderRight: "1px solid " + defaultTheme.grayAlt,
804
+ borderRight: `1px solid ${defaultTheme.grayAlt}`,
1747
805
  display: 'flex',
1748
806
  flexDirection: 'column'
1749
807
  }
@@ -1755,15 +813,15 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
1755
813
  top: 0,
1756
814
  zIndex: 1
1757
815
  }
1758
- }, "Active Matches"), router.state.matches.map((match, i) => {
816
+ }, "Active Matches"), router.state.currentMatches.map((match, i) => {
1759
817
  return /*#__PURE__*/React__default.createElement("div", {
1760
- key: match.routeId || i,
818
+ key: match.route.id || i,
1761
819
  role: "button",
1762
- "aria-label": "Open match details for " + match.routeId,
1763
- onClick: () => setActiveRouteId(activeRouteId === match.routeId ? '' : match.routeId),
820
+ "aria-label": `Open match details for ${match.route.id}`,
821
+ onClick: () => setActiveRouteId(activeRouteId === match.route.id ? '' : match.route.id),
1764
822
  style: {
1765
823
  display: 'flex',
1766
- borderBottom: "solid 1px " + defaultTheme.grayAlt,
824
+ borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
1767
825
  cursor: 'pointer',
1768
826
  alignItems: 'center',
1769
827
  background: match === activeMatch ? 'rgba(255,255,255,.1)' : undefined
@@ -1785,8 +843,8 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
1785
843
  style: {
1786
844
  padding: '.5em'
1787
845
  }
1788
- }, "" + match.matchId));
1789
- }), (_router$state$pending = router.state.pending) != null && _router$state$pending.matches.length ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
846
+ }, `${match.id}`));
847
+ }), router.state.pendingMatches?.length ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
1790
848
  style: {
1791
849
  marginTop: '2rem',
1792
850
  padding: '.5em',
@@ -1795,15 +853,15 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
1795
853
  top: 0,
1796
854
  zIndex: 1
1797
855
  }
1798
- }, "Pending Matches"), (_router$state$pending2 = router.state.pending) == null ? void 0 : _router$state$pending2.matches.map((match, i) => {
856
+ }, "Pending Matches"), router.state.pendingMatches?.map((match, i) => {
1799
857
  return /*#__PURE__*/React__default.createElement("div", {
1800
- key: match.routeId || i,
858
+ key: match.route.id || i,
1801
859
  role: "button",
1802
- "aria-label": "Open match details for " + match.routeId,
1803
- onClick: () => setActiveRouteId(activeRouteId === match.routeId ? '' : match.routeId),
860
+ "aria-label": `Open match details for ${match.route.id}`,
861
+ onClick: () => setActiveRouteId(activeRouteId === match.route.id ? '' : match.route.id),
1804
862
  style: {
1805
863
  display: 'flex',
1806
- borderBottom: "solid 1px " + defaultTheme.grayAlt,
864
+ borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
1807
865
  cursor: 'pointer',
1808
866
  background: match === activeMatch ? 'rgba(255,255,255,.1)' : undefined
1809
867
  }
@@ -1824,75 +882,7 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
1824
882
  style: {
1825
883
  padding: '.5em'
1826
884
  }
1827
- }, "" + match.matchId));
1828
- })) : null, matchCacheValues.length ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
1829
- style: {
1830
- marginTop: '2rem',
1831
- padding: '.5em',
1832
- background: defaultTheme.backgroundAlt,
1833
- position: 'sticky',
1834
- top: 0,
1835
- bottom: 0,
1836
- zIndex: 1,
1837
- display: 'flex',
1838
- alignItems: 'center',
1839
- justifyContent: 'space-between'
1840
- }
1841
- }, /*#__PURE__*/React__default.createElement("div", null, "Match Cache"), /*#__PURE__*/React__default.createElement(Button, {
1842
- onClick: () => {
1843
- router.matchCache = {};
1844
- router.notify();
1845
- }
1846
- }, "Clear")), matchCacheValues.map((d, i) => {
1847
- const {
1848
- match,
1849
- gc
1850
- } = d;
1851
- return /*#__PURE__*/React__default.createElement("div", {
1852
- key: match.matchId || i,
1853
- role: "button",
1854
- "aria-label": "Open match details for " + match.matchId,
1855
- onClick: () => setActiveMatchId(activeMatchId === match.matchId ? '' : match.matchId),
1856
- style: {
1857
- display: 'flex',
1858
- borderBottom: "solid 1px " + defaultTheme.grayAlt,
1859
- cursor: 'pointer',
1860
- background: match === activeMatch ? 'rgba(255,255,255,.1)' : undefined
1861
- }
1862
- }, /*#__PURE__*/React__default.createElement("div", {
1863
- style: {
1864
- display: 'flex',
1865
- flexDirection: 'column',
1866
- padding: '.5rem',
1867
- gap: '.3rem'
1868
- }
1869
- }, /*#__PURE__*/React__default.createElement("div", {
1870
- style: {
1871
- display: 'flex',
1872
- alignItems: 'center',
1873
- gap: '.5rem'
1874
- }
1875
- }, /*#__PURE__*/React__default.createElement("div", {
1876
- style: {
1877
- flex: '0 0 auto',
1878
- width: '1.3rem',
1879
- height: '1.3rem',
1880
- background: getStatusColor(match, defaultTheme),
1881
- alignItems: 'center',
1882
- justifyContent: 'center',
1883
- fontWeight: 'bold',
1884
- borderRadius: '.25rem',
1885
- transition: 'all .2s ease-out'
1886
- }
1887
- }), /*#__PURE__*/React__default.createElement(Code, null, "" + match.matchId)), /*#__PURE__*/React__default.createElement("span", {
1888
- style: {
1889
- fontSize: '.7rem',
1890
- opacity: '.5',
1891
- lineHeight: 1
1892
- }
1893
- }, "Expires", ' ', formatDistanceStrict(new Date(gc), new Date(), {
1894
- addSuffix: true
1895
- }))));
885
+ }, `${match.id}`));
1896
886
  })) : null), activeMatch ? /*#__PURE__*/React__default.createElement(ActivePanel, null, /*#__PURE__*/React__default.createElement("div", {
1897
887
  style: {
1898
888
  padding: '.5em',
@@ -1910,23 +900,15 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
1910
900
  style: {
1911
901
  lineHeight: '1.8em'
1912
902
  }
1913
- }, JSON.stringify(activeMatch.matchId, null, 2)))), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
1914
- style: {
1915
- opacity: '.5'
1916
- }
1917
- }, "Status"), /*#__PURE__*/React__default.createElement("td", null, activeMatch.status)), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
903
+ }, JSON.stringify(activeMatch.id, null, 2)))), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
1918
904
  style: {
1919
905
  opacity: '.5'
1920
906
  }
1921
- }, "Pending"), /*#__PURE__*/React__default.createElement("td", null, activeMatch.isPending.toString())), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
907
+ }, "Status"), /*#__PURE__*/React__default.createElement("td", null, activeMatch.state.status)), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
1922
908
  style: {
1923
909
  opacity: '.5'
1924
910
  }
1925
- }, "Invalid"), /*#__PURE__*/React__default.createElement("td", null, activeMatch.isInvalid.toString())), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
1926
- style: {
1927
- opacity: '.5'
1928
- }
1929
- }, "Last Updated"), /*#__PURE__*/React__default.createElement("td", null, activeMatch.updatedAt ? new Date(activeMatch.updatedAt).toLocaleTimeString() : 'N/A'))))), /*#__PURE__*/React__default.createElement("div", {
911
+ }, "Last Updated"), /*#__PURE__*/React__default.createElement("td", null, activeMatch.state.updatedAt ? new Date(activeMatch.state.updatedAt).toLocaleTimeString() : 'N/A'))))), /*#__PURE__*/React__default.createElement("div", {
1930
912
  style: {
1931
913
  background: defaultTheme.backgroundAlt,
1932
914
  padding: '.5em',
@@ -1940,16 +922,6 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
1940
922
  padding: '0.5em'
1941
923
  }
1942
924
  }, /*#__PURE__*/React__default.createElement(Button, {
1943
- type: "button",
1944
- onClick: () => {
1945
- activeMatch.invalidate();
1946
- router.notify();
1947
- },
1948
- style: {
1949
- background: defaultTheme.warning,
1950
- color: defaultTheme.inputTextColor
1951
- }
1952
- }, "Invalidate"), ' ', /*#__PURE__*/React__default.createElement(Button, {
1953
925
  type: "button",
1954
926
  onClick: () => activeMatch.load(),
1955
927
  style: {
@@ -1978,7 +950,7 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
1978
950
  minHeight: '40%',
1979
951
  maxHeight: '100%',
1980
952
  overflow: 'auto',
1981
- borderRight: "1px solid " + defaultTheme.grayAlt,
953
+ borderRight: `1px solid ${defaultTheme.grayAlt}`,
1982
954
  display: 'flex',
1983
955
  flexDirection: 'column'
1984
956
  }
@@ -1991,36 +963,13 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
1991
963
  bottom: 0,
1992
964
  zIndex: 1
1993
965
  }
1994
- }, "All Loader Data"), /*#__PURE__*/React__default.createElement("div", {
1995
- style: {
1996
- padding: '.5em'
1997
- }
1998
- }, Object.keys(((_last = last(router.state.matches)) == null ? void 0 : _last.loaderData) || {}).length ? /*#__PURE__*/React__default.createElement(Explorer, {
1999
- value: ((_last2 = last(router.state.matches)) == null ? void 0 : _last2.loaderData) || {},
2000
- defaultExpanded: Object.keys(((_last3 = last(router.state.matches)) == null ? void 0 : _last3.loaderData) || {}).reduce((obj, next) => {
2001
- obj[next] = {};
2002
- return obj;
2003
- }, {})
2004
- }) : /*#__PURE__*/React__default.createElement("em", {
2005
- style: {
2006
- opacity: 0.5
2007
- }
2008
- }, '{ }')), /*#__PURE__*/React__default.createElement("div", {
2009
- style: {
2010
- padding: '.5em',
2011
- background: defaultTheme.backgroundAlt,
2012
- position: 'sticky',
2013
- top: 0,
2014
- bottom: 0,
2015
- zIndex: 1
2016
- }
2017
966
  }, "Search Params"), /*#__PURE__*/React__default.createElement("div", {
2018
967
  style: {
2019
968
  padding: '.5em'
2020
969
  }
2021
- }, Object.keys(((_last4 = last(router.state.matches)) == null ? void 0 : _last4.search) || {}).length ? /*#__PURE__*/React__default.createElement(Explorer, {
2022
- value: ((_last5 = last(router.state.matches)) == null ? void 0 : _last5.search) || {},
2023
- defaultExpanded: Object.keys(((_last6 = last(router.state.matches)) == null ? void 0 : _last6.search) || {}).reduce((obj, next) => {
970
+ }, Object.keys(last(router.state.currentMatches)?.state.search || {}).length ? /*#__PURE__*/React__default.createElement(Explorer, {
971
+ value: last(router.state.currentMatches)?.state.search || {},
972
+ defaultExpanded: Object.keys(last(router.state.currentMatches)?.state.search || {}).reduce((obj, next) => {
2024
973
  obj[next] = {};
2025
974
  return obj;
2026
975
  }, {})