@tanstack/router-devtools 0.0.1-alpha.1 → 0.0.1-beta.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/build/cjs/{packages/react-router-devtools/src/Explorer.js → Explorer.js} +52 -81
- package/build/cjs/Explorer.js.map +1 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -19
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/build/cjs/devtools.js +583 -0
- package/build/cjs/devtools.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/index.js → index.js} +1 -1
- package/build/cjs/{packages/react-router-devtools/src/styledComponents.js → styledComponents.js} +10 -38
- package/build/cjs/styledComponents.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/theme.js → theme.js} +6 -9
- package/build/cjs/theme.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/useLocalStorage.js → useLocalStorage.js} +3 -10
- package/build/cjs/useLocalStorage.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/useMediaQuery.js → useMediaQuery.js} +13 -12
- package/build/cjs/useMediaQuery.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/utils.js → utils.js} +25 -35
- package/build/cjs/utils.js.map +1 -0
- package/build/esm/index.js +308 -1337
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +59 -49
- package/build/stats-react.json +223 -9444
- package/build/types/index.d.ts +6 -5
- package/build/umd/index.development.js +347 -1316
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +22 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +9 -11
- package/src/Explorer.tsx +14 -12
- package/src/devtools.tsx +263 -240
- package/src/useLocalStorage.ts +5 -5
- package/src/useMediaQuery.ts +3 -0
- package/src/utils.ts +35 -17
- package/build/cjs/packages/react-router-devtools/src/Explorer.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/Logo.js +0 -73
- package/build/cjs/packages/react-router-devtools/src/Logo.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/devtools.js +0 -654
- package/build/cjs/packages/react-router-devtools/src/devtools.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/styledComponents.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/theme.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/useLocalStorage.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/useMediaQuery.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/utils.js.map +0 -1
- package/src/Logo.tsx +0 -37
- /package/build/cjs/{packages/react-router-devtools/src/index.js.map → index.js.map} +0 -0
package/build/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* router-devtools
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) TanStack
|
|
5
5
|
*
|
|
@@ -10,893 +10,38 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import React__default from 'react';
|
|
13
|
-
import {
|
|
13
|
+
import { routerContext, invariant, useStore, last } from '@tanstack/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
|
|
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
|
|
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(
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
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,70 +95,62 @@ function useMediaQuery(query) {
|
|
|
956
95
|
if (typeof window !== 'undefined') {
|
|
957
96
|
return window.matchMedia && window.matchMedia(query).matches;
|
|
958
97
|
}
|
|
959
|
-
|
|
98
|
+
return;
|
|
99
|
+
});
|
|
960
100
|
|
|
101
|
+
// Watch for changes
|
|
961
102
|
React__default.useEffect(() => {
|
|
962
103
|
if (typeof window !== 'undefined') {
|
|
963
104
|
if (!window.matchMedia) {
|
|
964
105
|
return;
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
const matcher = window.matchMedia(query); // Create our handler
|
|
106
|
+
}
|
|
969
107
|
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
matches
|
|
973
|
-
} = _ref;
|
|
974
|
-
return setIsMatch(matches);
|
|
975
|
-
}; // Listen for changes
|
|
108
|
+
// Create a matcher
|
|
109
|
+
const matcher = window.matchMedia(query);
|
|
976
110
|
|
|
111
|
+
// Create our handler
|
|
112
|
+
const onChange = ({
|
|
113
|
+
matches
|
|
114
|
+
}) => setIsMatch(matches);
|
|
977
115
|
|
|
116
|
+
// Listen for changes
|
|
978
117
|
matcher.addListener(onChange);
|
|
979
118
|
return () => {
|
|
980
119
|
// Stop listening for changes
|
|
981
120
|
matcher.removeListener(onChange);
|
|
982
121
|
};
|
|
983
122
|
}
|
|
123
|
+
return;
|
|
984
124
|
}, [isMatch, query, setIsMatch]);
|
|
985
125
|
return isMatch;
|
|
986
126
|
}
|
|
987
127
|
|
|
988
|
-
const _excluded$2 = ["style"];
|
|
989
128
|
const isServer$1 = typeof window === 'undefined';
|
|
990
129
|
function getStatusColor(match, theme) {
|
|
991
|
-
return match.
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
// ? 'stale'
|
|
999
|
-
// : 'fresh'
|
|
1000
|
-
// }
|
|
1001
|
-
|
|
1002
|
-
function styled(type, newStyles, queries) {
|
|
1003
|
-
if (queries === void 0) {
|
|
1004
|
-
queries = {};
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
return /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
1008
|
-
let {
|
|
1009
|
-
style
|
|
1010
|
-
} = _ref,
|
|
1011
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
1012
|
-
|
|
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) => {
|
|
1013
137
|
const theme = useTheme();
|
|
1014
|
-
const mediaStyles = Object.entries(queries).reduce((current,
|
|
1015
|
-
let [key, value] = _ref2;
|
|
138
|
+
const mediaStyles = Object.entries(queries).reduce((current, [key, value]) => {
|
|
1016
139
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1017
|
-
return useMediaQuery(key) ?
|
|
140
|
+
return useMediaQuery(key) ? {
|
|
141
|
+
...current,
|
|
142
|
+
...(typeof value === 'function' ? value(rest, theme) : value)
|
|
143
|
+
} : current;
|
|
1018
144
|
}, {});
|
|
1019
|
-
return /*#__PURE__*/React__default.createElement(type,
|
|
1020
|
-
|
|
145
|
+
return /*#__PURE__*/React__default.createElement(type, {
|
|
146
|
+
...rest,
|
|
147
|
+
style: {
|
|
148
|
+
...(typeof newStyles === 'function' ? newStyles(rest, theme) : newStyles),
|
|
149
|
+
...style,
|
|
150
|
+
...mediaStyles
|
|
151
|
+
},
|
|
1021
152
|
ref
|
|
1022
|
-
})
|
|
153
|
+
});
|
|
1023
154
|
});
|
|
1024
155
|
}
|
|
1025
156
|
function useIsMounted() {
|
|
@@ -1033,22 +164,22 @@ function useIsMounted() {
|
|
|
1033
164
|
}, []);
|
|
1034
165
|
return isMounted;
|
|
1035
166
|
}
|
|
167
|
+
|
|
1036
168
|
/**
|
|
1037
169
|
* Displays a string regardless the type of the data
|
|
1038
170
|
* @param {unknown} value Value to be stringified
|
|
1039
171
|
*/
|
|
1040
|
-
|
|
1041
172
|
const displayValue = value => {
|
|
1042
173
|
const name = Object.getOwnPropertyNames(Object(value));
|
|
1043
|
-
const newValue = typeof value === 'bigint' ? value.toString()
|
|
174
|
+
const newValue = typeof value === 'bigint' ? `${value.toString()}n` : value;
|
|
1044
175
|
return JSON.stringify(newValue, name);
|
|
1045
176
|
};
|
|
177
|
+
|
|
1046
178
|
/**
|
|
1047
179
|
* This hook is a safe useState version which schedules state updates in microtasks
|
|
1048
180
|
* to prevent updating a component state while React is rendering different components
|
|
1049
181
|
* or when the component is not mounted anymore.
|
|
1050
182
|
*/
|
|
1051
|
-
|
|
1052
183
|
function useSafeState(initialState) {
|
|
1053
184
|
const isMounted = useIsMounted();
|
|
1054
185
|
const [state, setState] = React__default.useState(initialState);
|
|
@@ -1061,11 +192,11 @@ function useSafeState(initialState) {
|
|
|
1061
192
|
}, [isMounted]);
|
|
1062
193
|
return [state, safeSetState];
|
|
1063
194
|
}
|
|
195
|
+
|
|
1064
196
|
/**
|
|
1065
197
|
* Schedules a microtask.
|
|
1066
198
|
* This can be useful to schedule state updates after rendering.
|
|
1067
199
|
*/
|
|
1068
|
-
|
|
1069
200
|
function scheduleMicrotask(callback) {
|
|
1070
201
|
Promise.resolve().then(callback).catch(error => setTimeout(() => {
|
|
1071
202
|
throw error;
|
|
@@ -1074,7 +205,7 @@ function scheduleMicrotask(callback) {
|
|
|
1074
205
|
|
|
1075
206
|
const Panel = styled('div', (_props, theme) => ({
|
|
1076
207
|
fontSize: 'clamp(12px, 1.5vw, 14px)',
|
|
1077
|
-
fontFamily:
|
|
208
|
+
fontFamily: `sans-serif`,
|
|
1078
209
|
display: 'flex',
|
|
1079
210
|
backgroundColor: theme.background,
|
|
1080
211
|
color: theme.foreground
|
|
@@ -1083,10 +214,11 @@ const Panel = styled('div', (_props, theme) => ({
|
|
|
1083
214
|
flexDirection: 'column'
|
|
1084
215
|
},
|
|
1085
216
|
'(max-width: 600px)': {
|
|
1086
|
-
fontSize: '.9em'
|
|
1087
|
-
|
|
217
|
+
fontSize: '.9em'
|
|
218
|
+
// flexDirection: 'column',
|
|
1088
219
|
}
|
|
1089
220
|
});
|
|
221
|
+
|
|
1090
222
|
const ActivePanel = styled('div', () => ({
|
|
1091
223
|
flex: '1 1 500px',
|
|
1092
224
|
display: 'flex',
|
|
@@ -1095,7 +227,7 @@ const ActivePanel = styled('div', () => ({
|
|
|
1095
227
|
height: '100%'
|
|
1096
228
|
}), {
|
|
1097
229
|
'(max-width: 700px)': (_props, theme) => ({
|
|
1098
|
-
borderTop:
|
|
230
|
+
borderTop: `2px solid ${theme.gray}`
|
|
1099
231
|
})
|
|
1100
232
|
});
|
|
1101
233
|
const Button = styled('button', (props, theme) => ({
|
|
@@ -1109,10 +241,13 @@ const Button = styled('button', (props, theme) => ({
|
|
|
1109
241
|
padding: '.5em',
|
|
1110
242
|
opacity: props.disabled ? '.5' : undefined,
|
|
1111
243
|
cursor: 'pointer'
|
|
1112
|
-
}));
|
|
244
|
+
}));
|
|
245
|
+
|
|
246
|
+
// export const QueryKeys = styled('span', {
|
|
1113
247
|
// display: 'inline-block',
|
|
1114
248
|
// fontSize: '0.9em',
|
|
1115
249
|
// })
|
|
250
|
+
|
|
1116
251
|
// export const QueryKey = styled('span', {
|
|
1117
252
|
// display: 'inline-flex',
|
|
1118
253
|
// alignItems: 'center',
|
|
@@ -1125,40 +260,7 @@ const Button = styled('button', (props, theme) => ({
|
|
|
1125
260
|
const Code = styled('code', {
|
|
1126
261
|
fontSize: '.9em'
|
|
1127
262
|
});
|
|
1128
|
-
styled('input', (_props, theme) => ({
|
|
1129
|
-
backgroundColor: theme.inputBackgroundColor,
|
|
1130
|
-
border: 0,
|
|
1131
|
-
borderRadius: '.2em',
|
|
1132
|
-
color: theme.inputTextColor,
|
|
1133
|
-
fontSize: '.9em',
|
|
1134
|
-
lineHeight: "1.3",
|
|
1135
|
-
padding: '.3em .4em'
|
|
1136
|
-
}));
|
|
1137
|
-
styled('select', (_props, theme) => ({
|
|
1138
|
-
display: "inline-block",
|
|
1139
|
-
fontSize: ".9em",
|
|
1140
|
-
fontFamily: "sans-serif",
|
|
1141
|
-
fontWeight: 'normal',
|
|
1142
|
-
lineHeight: "1.3",
|
|
1143
|
-
padding: ".3em 1.5em .3em .5em",
|
|
1144
|
-
height: 'auto',
|
|
1145
|
-
border: 0,
|
|
1146
|
-
borderRadius: ".2em",
|
|
1147
|
-
appearance: "none",
|
|
1148
|
-
WebkitAppearance: 'none',
|
|
1149
|
-
backgroundColor: theme.inputBackgroundColor,
|
|
1150
|
-
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>\")",
|
|
1151
|
-
backgroundRepeat: "no-repeat",
|
|
1152
|
-
backgroundPosition: "right .55em center",
|
|
1153
|
-
backgroundSize: ".65em auto, 100%",
|
|
1154
|
-
color: theme.inputTextColor
|
|
1155
|
-
}), {
|
|
1156
|
-
'(max-width: 500px)': {
|
|
1157
|
-
display: 'none'
|
|
1158
|
-
}
|
|
1159
|
-
});
|
|
1160
263
|
|
|
1161
|
-
const _excluded$1 = ["value", "defaultExpanded", "renderer", "pageSize"];
|
|
1162
264
|
const Entry = styled('div', {
|
|
1163
265
|
fontFamily: 'Menlo, monospace',
|
|
1164
266
|
fontSize: '.7rem',
|
|
@@ -1194,20 +296,17 @@ const Info = styled('span', {
|
|
|
1194
296
|
color: 'grey',
|
|
1195
297
|
fontSize: '.7em'
|
|
1196
298
|
});
|
|
1197
|
-
const Expander =
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
}, "\u25B6");
|
|
1209
|
-
};
|
|
1210
|
-
|
|
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");
|
|
1211
310
|
/**
|
|
1212
311
|
* Chunk elements in the array by size
|
|
1213
312
|
*
|
|
@@ -1221,53 +320,40 @@ function chunkArray(array, size) {
|
|
|
1221
320
|
if (size < 1) return [];
|
|
1222
321
|
let i = 0;
|
|
1223
322
|
const result = [];
|
|
1224
|
-
|
|
1225
323
|
while (i < array.length) {
|
|
1226
324
|
result.push(array.slice(i, i + size));
|
|
1227
325
|
i = i + size;
|
|
1228
326
|
}
|
|
1229
|
-
|
|
1230
327
|
return result;
|
|
1231
328
|
}
|
|
1232
|
-
const DefaultRenderer =
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
} = _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
|
+
}) => {
|
|
1245
341
|
const [expandedPages, setExpandedPages] = React.useState([]);
|
|
1246
342
|
const [valueSnapshot, setValueSnapshot] = React.useState(undefined);
|
|
1247
|
-
|
|
1248
343
|
const refreshValueSnapshot = () => {
|
|
1249
344
|
setValueSnapshot(value());
|
|
1250
345
|
};
|
|
1251
|
-
|
|
1252
|
-
return /*#__PURE__*/React.createElement(Entry, {
|
|
1253
|
-
key: label
|
|
1254
|
-
}, subEntryPages.length ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ExpandButton, {
|
|
346
|
+
return /*#__PURE__*/React.createElement(Entry, null, subEntryPages.length ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ExpandButton, {
|
|
1255
347
|
onClick: () => toggleExpanded()
|
|
1256
348
|
}, /*#__PURE__*/React.createElement(Expander, {
|
|
1257
349
|
expanded: expanded
|
|
1258
|
-
}), " ", label, ' ', /*#__PURE__*/React.createElement(Info, null, String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : '', subEntries.length, " ", subEntries.length > 1 ?
|
|
1259
|
-
key: entry.label,
|
|
1260
|
-
entry: entry
|
|
1261
|
-
}))) : /*#__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", {
|
|
1262
351
|
key: index
|
|
1263
352
|
}, /*#__PURE__*/React.createElement(Entry, null, /*#__PURE__*/React.createElement(LabelButton, {
|
|
1264
353
|
onClick: () => setExpandedPages(old => old.includes(index) ? old.filter(d => d !== index) : [...old, index])
|
|
1265
354
|
}, /*#__PURE__*/React.createElement(Expander, {
|
|
1266
355
|
expanded: expanded
|
|
1267
|
-
}), " [", index * pageSize, " ...", ' ', index * pageSize + pageSize - 1, "]"), expandedPages.includes(index) ? /*#__PURE__*/React.createElement(SubEntries, null, entries.map(entry => /*#__PURE__*/React.createElement(
|
|
1268
|
-
key: entry.label,
|
|
1269
|
-
entry: entry
|
|
1270
|
-
}))) : null)))) : null) : type === 'function' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Explorer, {
|
|
356
|
+
}), " [", index * pageSize, " ...", ' ', index * pageSize + pageSize - 1, "]"), expandedPages.includes(index) ? /*#__PURE__*/React.createElement(SubEntries, null, entries.map(entry => handleEntry(entry))) : null)))) : null) : type === 'function' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Explorer, {
|
|
1271
357
|
renderer: renderer,
|
|
1272
358
|
label: /*#__PURE__*/React.createElement("button", {
|
|
1273
359
|
onClick: refreshValueSnapshot,
|
|
@@ -1281,34 +367,29 @@ const DefaultRenderer = _ref2 => {
|
|
|
1281
367
|
defaultExpanded: {}
|
|
1282
368
|
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Label, null, label, ":"), " ", /*#__PURE__*/React.createElement(Value, null, displayValue(value))));
|
|
1283
369
|
};
|
|
1284
|
-
|
|
1285
370
|
function isIterable(x) {
|
|
1286
371
|
return Symbol.iterator in x;
|
|
1287
372
|
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
} = _ref3,
|
|
1296
|
-
rest = _objectWithoutPropertiesLoose(_ref3, _excluded$1);
|
|
1297
|
-
|
|
373
|
+
function Explorer({
|
|
374
|
+
value,
|
|
375
|
+
defaultExpanded,
|
|
376
|
+
renderer = DefaultRenderer,
|
|
377
|
+
pageSize = 100,
|
|
378
|
+
...rest
|
|
379
|
+
}) {
|
|
1298
380
|
const [expanded, setExpanded] = React.useState(Boolean(defaultExpanded));
|
|
1299
381
|
const toggleExpanded = React.useCallback(() => setExpanded(old => !old), []);
|
|
1300
382
|
let type = typeof value;
|
|
1301
383
|
let subEntries = [];
|
|
1302
|
-
|
|
1303
384
|
const makeProperty = sub => {
|
|
1304
385
|
const subDefaultExpanded = defaultExpanded === true ? {
|
|
1305
386
|
[sub.label]: true
|
|
1306
|
-
} : defaultExpanded
|
|
1307
|
-
return
|
|
387
|
+
} : defaultExpanded?.[sub.label];
|
|
388
|
+
return {
|
|
389
|
+
...sub,
|
|
1308
390
|
defaultExpanded: subDefaultExpanded
|
|
1309
|
-
}
|
|
391
|
+
};
|
|
1310
392
|
};
|
|
1311
|
-
|
|
1312
393
|
if (Array.isArray(value)) {
|
|
1313
394
|
type = 'array';
|
|
1314
395
|
subEntries = value.map((d, i) => makeProperty({
|
|
@@ -1323,87 +404,68 @@ function Explorer(_ref3) {
|
|
|
1323
404
|
}));
|
|
1324
405
|
} else if (typeof value === 'object' && value !== null) {
|
|
1325
406
|
type = 'object';
|
|
1326
|
-
subEntries = Object.entries(value).map(
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
value: val
|
|
1331
|
-
});
|
|
1332
|
-
});
|
|
407
|
+
subEntries = Object.entries(value).map(([key, val]) => makeProperty({
|
|
408
|
+
label: key,
|
|
409
|
+
value: val
|
|
410
|
+
}));
|
|
1333
411
|
}
|
|
1334
|
-
|
|
1335
412
|
const subEntryPages = chunkArray(subEntries, pageSize);
|
|
1336
|
-
return renderer(
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
value: value,
|
|
1343
|
-
renderer: renderer
|
|
1344
|
-
}, rest, entry));
|
|
1345
|
-
},
|
|
413
|
+
return renderer({
|
|
414
|
+
handleEntry: entry => /*#__PURE__*/React.createElement(Explorer, _extends({
|
|
415
|
+
key: entry.label,
|
|
416
|
+
value: value,
|
|
417
|
+
renderer: renderer
|
|
418
|
+
}, rest, entry)),
|
|
1346
419
|
type,
|
|
1347
420
|
subEntries,
|
|
1348
421
|
subEntryPages,
|
|
1349
422
|
value,
|
|
1350
423
|
expanded,
|
|
1351
424
|
toggleExpanded,
|
|
1352
|
-
pageSize
|
|
1353
|
-
|
|
425
|
+
pageSize,
|
|
426
|
+
...rest
|
|
427
|
+
});
|
|
1354
428
|
}
|
|
1355
429
|
|
|
430
|
+
const isServer = typeof window === 'undefined';
|
|
1356
431
|
function Logo(props) {
|
|
1357
|
-
return /*#__PURE__*/
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
}, /*#__PURE__*/
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
}
|
|
1384
|
-
d: "M54.8601729,98.3577578 C56.1715224,97.6082856 57.8360246,98.0746014 58.5779424,99.3993034 L58.5779424,99.3993034 L59.0525843,100.24352 C62.8563392,106.982993 66.8190116,113.380176 70.9406016,119.435068 C75.8078808,126.585427 81.28184,133.82411 87.3624792,141.151115 C88.3168778,142.30114 88.1849437,144.011176 87.065686,144.997937 L87.065686,144.997937 L86.4542085,145.534625 C66.3465389,163.103314 53.2778188,166.612552 47.2480482,156.062341 C41.3500652,145.742717 43.4844915,126.982888 53.6513274,99.7828526 C53.876818,99.1795821 54.3045861,98.675291 54.8601729,98.3577578 Z M140.534177,119.041504 C141.986131,118.785177 143.375496,119.742138 143.65963,121.194242 L143.65963,121.194242 L143.812815,121.986376 C148.782365,147.995459 145.283348,161 133.315764,161 C121.609745,161 106.708724,149.909007 88.6127018,127.727022 C88.2113495,127.235047 87.9945723,126.617371 88,125.981509 C88.013158,124.480686 89.2357854,123.274651 90.730918,123.287756 L90.730918,123.287756 L91.6846544,123.294531 C99.3056979,123.335994 106.714387,123.071591 113.910723,122.501323 C122.409039,121.82788 131.283523,120.674607 140.534177,119.041504 Z M147.408726,63.8119663 C147.932139,62.4026903 149.508386,61.6634537 150.954581,62.149012 L150.954581,62.149012 L151.742552,62.4154854 C177.583763,71.217922 187.402356,80.8916805 181.198332,91.4367609 C175.129904,101.751366 157.484347,109.260339 128.26166,113.963678 C127.613529,114.067994 126.948643,113.945969 126.382735,113.618843 C125.047025,112.846729 124.602046,111.158214 125.388848,109.847438 L125.388848,109.847438 L125.889328,109.0105 C129.877183,102.31633 133.481358,95.6542621 136.701854,89.0242957 C140.50501,81.1948179 144.073967,72.7907081 147.408726,63.8119663 Z M61.7383398,56.0363218 C62.3864708,55.9320063 63.0513565,56.0540315 63.6172646,56.3811573 C64.9529754,57.153271 65.3979538,58.8417862 64.6111517,60.1525615 L64.6111517,60.1525615 L64.1106718,60.9895001 C60.1228168,67.6836699 56.5186416,74.3457379 53.2981462,80.9757043 C49.49499,88.8051821 45.9260328,97.2092919 42.5912744,106.188034 C42.0678608,107.59731 40.4916142,108.336546 39.045419,107.850988 L39.045419,107.850988 L38.2574475,107.584515 C12.4162372,98.782078 2.59764398,89.1083195 8.80166786,78.5632391 C14.8700957,68.2486335 32.515653,60.7396611 61.7383398,56.0363218 Z M103.545792,24.4653746 C123.653461,6.89668641 136.722181,3.38744778 142.751952,13.9376587 C148.649935,24.2572826 146.515508,43.0171122 136.348673,70.2171474 C136.123182,70.8204179 135.695414,71.324709 135.139827,71.6422422 C133.828478,72.3917144 132.163975,71.9253986 131.422058,70.6006966 L131.422058,70.6006966 L130.947416,69.7564798 C127.143661,63.0170065 123.180988,56.6198239 119.059398,50.564932 C114.192119,43.4145727 108.71816,36.1758903 102.637521,28.8488847 C101.683122,27.6988602 101.815056,25.9888243 102.934314,25.0020629 L102.934314,25.0020629 Z M57.6842361,8 C69.3902551,8 84.2912758,19.0909926 102.387298,41.2729777 C102.788651,41.7649527 103.005428,42.3826288 103,43.0184911 C102.986842,44.5193144 101.764215,45.7253489 100.269082,45.7122445 L100.269082,45.7122445 L99.3153456,45.7054689 C91.6943021,45.6640063 84.2856126,45.9284091 77.0892772,46.4986773 C68.5909612,47.17212 59.7164767,48.325393 50.4658235,49.9584962 C49.0138691,50.2148231 47.6245044,49.2578618 47.3403697,47.805758 L47.3403697,47.805758 L47.1871846,47.0136235 C42.2176347,21.0045412 45.7166519,8 57.6842361,8 Z",
|
|
1385
|
-
id: "Combined-Shape",
|
|
1386
|
-
fill: "#FF4154"
|
|
1387
|
-
})))));
|
|
432
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({}, props, {
|
|
433
|
+
style: {
|
|
434
|
+
...(props.style ?? {}),
|
|
435
|
+
display: 'flex',
|
|
436
|
+
alignItems: 'center',
|
|
437
|
+
flexDirection: 'column',
|
|
438
|
+
fontSize: '0.8rem',
|
|
439
|
+
fontWeight: 'bolder',
|
|
440
|
+
lineHeight: '1'
|
|
441
|
+
}
|
|
442
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
443
|
+
style: {
|
|
444
|
+
letterSpacing: '-0.05rem'
|
|
445
|
+
}
|
|
446
|
+
}, "TANSTACK"), /*#__PURE__*/React__default.createElement("div", {
|
|
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',
|
|
455
|
+
letterSpacing: '0.1rem',
|
|
456
|
+
marginRight: '-0.2rem'
|
|
457
|
+
}
|
|
458
|
+
}, "ROUTER"));
|
|
1388
459
|
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
let {
|
|
1399
|
-
initialIsOpen,
|
|
1400
|
-
panelProps = {},
|
|
1401
|
-
closeButtonProps = {},
|
|
1402
|
-
toggleButtonProps = {},
|
|
1403
|
-
position = 'bottom-left',
|
|
1404
|
-
containerElement: Container = 'footer',
|
|
1405
|
-
useRouter: useRouterImpl = useRouter
|
|
1406
|
-
} = _ref;
|
|
460
|
+
function TanStackRouterDevtools({
|
|
461
|
+
initialIsOpen,
|
|
462
|
+
panelProps = {},
|
|
463
|
+
closeButtonProps = {},
|
|
464
|
+
toggleButtonProps = {},
|
|
465
|
+
position = 'bottom-left',
|
|
466
|
+
containerElement: Container = 'footer',
|
|
467
|
+
router
|
|
468
|
+
}) {
|
|
1407
469
|
const rootRef = React__default.useRef(null);
|
|
1408
470
|
const panelRef = React__default.useRef(null);
|
|
1409
471
|
const [isOpen, setIsOpen] = useLocalStorage('tanstackRouterDevtoolsOpen', initialIsOpen);
|
|
@@ -1411,61 +473,51 @@ function TanStackRouterDevtools(_ref) {
|
|
|
1411
473
|
const [isResolvedOpen, setIsResolvedOpen] = useSafeState(false);
|
|
1412
474
|
const [isResizing, setIsResizing] = useSafeState(false);
|
|
1413
475
|
const isMounted = useIsMounted();
|
|
1414
|
-
|
|
1415
|
-
const _handleDragStart = (panelElement, startEvent) => {
|
|
1416
|
-
var _panelElement$getBoun;
|
|
1417
|
-
|
|
476
|
+
const handleDragStart = (panelElement, startEvent) => {
|
|
1418
477
|
if (startEvent.button !== 0) return; // Only allow left click for drag
|
|
1419
478
|
|
|
1420
479
|
setIsResizing(true);
|
|
1421
480
|
const dragInfo = {
|
|
1422
|
-
originalHeight:
|
|
481
|
+
originalHeight: panelElement?.getBoundingClientRect().height ?? 0,
|
|
1423
482
|
pageY: startEvent.pageY
|
|
1424
483
|
};
|
|
1425
|
-
|
|
1426
484
|
const run = moveEvent => {
|
|
1427
485
|
const delta = dragInfo.pageY - moveEvent.pageY;
|
|
1428
|
-
const newHeight =
|
|
486
|
+
const newHeight = dragInfo?.originalHeight + delta;
|
|
1429
487
|
setDevtoolsHeight(newHeight);
|
|
1430
|
-
|
|
1431
488
|
if (newHeight < 70) {
|
|
1432
489
|
setIsOpen(false);
|
|
1433
490
|
} else {
|
|
1434
491
|
setIsOpen(true);
|
|
1435
492
|
}
|
|
1436
493
|
};
|
|
1437
|
-
|
|
1438
494
|
const unsub = () => {
|
|
1439
495
|
setIsResizing(false);
|
|
1440
496
|
document.removeEventListener('mousemove', run);
|
|
1441
497
|
document.removeEventListener('mouseUp', unsub);
|
|
1442
498
|
};
|
|
1443
|
-
|
|
1444
499
|
document.addEventListener('mousemove', run);
|
|
1445
500
|
document.addEventListener('mouseup', unsub);
|
|
1446
501
|
};
|
|
1447
|
-
|
|
1448
502
|
React__default.useEffect(() => {
|
|
1449
|
-
setIsResolvedOpen(isOpen
|
|
1450
|
-
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
1451
|
-
// Prevents focusing in a closed panel.
|
|
503
|
+
setIsResolvedOpen(isOpen ?? false);
|
|
504
|
+
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
1452
505
|
|
|
506
|
+
// Toggle panel visibility before/after transition (depending on direction).
|
|
507
|
+
// Prevents focusing in a closed panel.
|
|
1453
508
|
React__default.useEffect(() => {
|
|
1454
509
|
const ref = panelRef.current;
|
|
1455
|
-
|
|
1456
510
|
if (ref) {
|
|
1457
511
|
const handlePanelTransitionStart = () => {
|
|
1458
512
|
if (ref && isResolvedOpen) {
|
|
1459
513
|
ref.style.visibility = 'visible';
|
|
1460
514
|
}
|
|
1461
515
|
};
|
|
1462
|
-
|
|
1463
516
|
const handlePanelTransitionEnd = () => {
|
|
1464
517
|
if (ref && !isResolvedOpen) {
|
|
1465
518
|
ref.style.visibility = 'hidden';
|
|
1466
519
|
}
|
|
1467
520
|
};
|
|
1468
|
-
|
|
1469
521
|
ref.addEventListener('transitionstart', handlePanelTransitionStart);
|
|
1470
522
|
ref.addEventListener('transitionend', handlePanelTransitionEnd);
|
|
1471
523
|
return () => {
|
|
@@ -1473,62 +525,46 @@ function TanStackRouterDevtools(_ref) {
|
|
|
1473
525
|
ref.removeEventListener('transitionend', handlePanelTransitionEnd);
|
|
1474
526
|
};
|
|
1475
527
|
}
|
|
1476
|
-
|
|
1477
528
|
return;
|
|
1478
529
|
}, [isResolvedOpen]);
|
|
1479
530
|
React__default[isServer ? 'useEffect' : 'useLayoutEffect'](() => {
|
|
1480
531
|
if (isResolvedOpen) {
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
const previousValue = (_rootRef$current = rootRef.current) == null ? void 0 : (_rootRef$current$pare = _rootRef$current.parentElement) == null ? void 0 : _rootRef$current$pare.style.paddingBottom;
|
|
1484
|
-
|
|
532
|
+
const previousValue = rootRef.current?.parentElement?.style.paddingBottom;
|
|
1485
533
|
const run = () => {
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
if ((_rootRef$current2 = rootRef.current) != null && _rootRef$current2.parentElement) {
|
|
1491
|
-
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`;
|
|
1492
537
|
}
|
|
1493
538
|
};
|
|
1494
|
-
|
|
1495
539
|
run();
|
|
1496
|
-
|
|
1497
540
|
if (typeof window !== 'undefined') {
|
|
1498
541
|
window.addEventListener('resize', run);
|
|
1499
542
|
return () => {
|
|
1500
|
-
var _rootRef$current3;
|
|
1501
|
-
|
|
1502
543
|
window.removeEventListener('resize', run);
|
|
1503
|
-
|
|
1504
|
-
if ((_rootRef$current3 = rootRef.current) != null && _rootRef$current3.parentElement && typeof previousValue === 'string') {
|
|
544
|
+
if (rootRef.current?.parentElement && typeof previousValue === 'string') {
|
|
1505
545
|
rootRef.current.parentElement.style.paddingBottom = previousValue;
|
|
1506
546
|
}
|
|
1507
547
|
};
|
|
1508
548
|
}
|
|
1509
549
|
}
|
|
1510
|
-
|
|
1511
550
|
return;
|
|
1512
551
|
}, [isResolvedOpen]);
|
|
1513
|
-
|
|
1514
552
|
const {
|
|
1515
|
-
style: panelStyle = {}
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
553
|
+
style: panelStyle = {},
|
|
554
|
+
...otherPanelProps
|
|
555
|
+
} = panelProps;
|
|
1519
556
|
const {
|
|
1520
557
|
style: closeButtonStyle = {},
|
|
1521
|
-
onClick: onCloseClick
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
558
|
+
onClick: onCloseClick,
|
|
559
|
+
...otherCloseButtonProps
|
|
560
|
+
} = closeButtonProps;
|
|
1525
561
|
const {
|
|
1526
562
|
style: toggleButtonStyle = {},
|
|
1527
|
-
onClick: onToggleClick
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
563
|
+
onClick: onToggleClick,
|
|
564
|
+
...otherToggleButtonProps
|
|
565
|
+
} = toggleButtonProps;
|
|
1531
566
|
|
|
567
|
+
// Do not render on the server
|
|
1532
568
|
if (!isMounted()) return null;
|
|
1533
569
|
return /*#__PURE__*/React__default.createElement(Container, {
|
|
1534
570
|
ref: rootRef,
|
|
@@ -1538,36 +574,39 @@ function TanStackRouterDevtools(_ref) {
|
|
|
1538
574
|
}, /*#__PURE__*/React__default.createElement(TanStackRouterDevtoolsPanel, _extends({
|
|
1539
575
|
ref: panelRef
|
|
1540
576
|
}, otherPanelProps, {
|
|
1541
|
-
|
|
1542
|
-
style:
|
|
577
|
+
router: router,
|
|
578
|
+
style: {
|
|
1543
579
|
position: 'fixed',
|
|
1544
580
|
bottom: '0',
|
|
1545
581
|
right: '0',
|
|
1546
582
|
zIndex: 99999,
|
|
1547
583
|
width: '100%',
|
|
1548
|
-
height: devtoolsHeight
|
|
584
|
+
height: devtoolsHeight ?? 500,
|
|
1549
585
|
maxHeight: '90%',
|
|
1550
586
|
boxShadow: '0 0 20px rgba(0,0,0,.3)',
|
|
1551
|
-
borderTop:
|
|
587
|
+
borderTop: `1px solid ${defaultTheme.gray}`,
|
|
1552
588
|
transformOrigin: 'top',
|
|
1553
589
|
// visibility will be toggled after transitions, but set initial state here
|
|
1554
|
-
visibility: isOpen ? 'visible' : 'hidden'
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
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
|
+
},
|
|
1568
607
|
isOpen: isResolvedOpen,
|
|
1569
608
|
setIsOpen: setIsOpen,
|
|
1570
|
-
handleDragStart: e =>
|
|
609
|
+
handleDragStart: e => handleDragStart(panelRef.current, e)
|
|
1571
610
|
})), isResolvedOpen ? /*#__PURE__*/React__default.createElement(Button, _extends({
|
|
1572
611
|
type: "button",
|
|
1573
612
|
"aria-label": "Close TanStack Router Devtools"
|
|
@@ -1576,20 +615,22 @@ function TanStackRouterDevtools(_ref) {
|
|
|
1576
615
|
setIsOpen(false);
|
|
1577
616
|
onCloseClick && onCloseClick(e);
|
|
1578
617
|
},
|
|
1579
|
-
style:
|
|
618
|
+
style: {
|
|
1580
619
|
position: 'fixed',
|
|
1581
620
|
zIndex: 99999,
|
|
1582
621
|
margin: '.5em',
|
|
1583
|
-
bottom: 0
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
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
|
+
}
|
|
1593
634
|
}), "Close") : null), !isResolvedOpen ? /*#__PURE__*/React__default.createElement("button", _extends({
|
|
1594
635
|
type: "button"
|
|
1595
636
|
}, otherToggleButtonProps, {
|
|
@@ -1598,7 +639,7 @@ function TanStackRouterDevtools(_ref) {
|
|
|
1598
639
|
setIsOpen(true);
|
|
1599
640
|
onToggleClick && onToggleClick(e);
|
|
1600
641
|
},
|
|
1601
|
-
style:
|
|
642
|
+
style: {
|
|
1602
643
|
appearance: 'none',
|
|
1603
644
|
background: 'none',
|
|
1604
645
|
border: 0,
|
|
@@ -1609,46 +650,45 @@ function TanStackRouterDevtools(_ref) {
|
|
|
1609
650
|
fontSize: '1.5em',
|
|
1610
651
|
margin: '.5em',
|
|
1611
652
|
cursor: 'pointer',
|
|
1612
|
-
width: 'fit-content'
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
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
|
+
}
|
|
1626
669
|
}), /*#__PURE__*/React__default.createElement(Logo, {
|
|
1627
670
|
"aria-hidden": true
|
|
1628
671
|
})) : null);
|
|
1629
672
|
}
|
|
1630
673
|
const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(function TanStackRouterDevtoolsPanel(props, ref) {
|
|
1631
|
-
var _router$state$matches, _router$state$pending, _last, _last2, _last3, _last4, _last5, _last6;
|
|
1632
|
-
|
|
1633
674
|
const {
|
|
1634
675
|
isOpen = true,
|
|
676
|
+
setIsOpen,
|
|
1635
677
|
handleDragStart,
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
const router =
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
router.cleanPreloadCache();
|
|
1644
|
-
router.notify();
|
|
1645
|
-
}, 1000);
|
|
1646
|
-
return () => {
|
|
1647
|
-
clearInterval(interval);
|
|
1648
|
-
};
|
|
1649
|
-
}, []);
|
|
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);
|
|
1650
685
|
const [activeRouteId, setActiveRouteId] = useLocalStorage('tanstackRouterDevtoolsActiveRouteId', '');
|
|
1651
|
-
const
|
|
686
|
+
const [activeMatchId, setActiveMatchId] = useLocalStorage('tanstackRouterDevtoolsActiveMatchId', '');
|
|
687
|
+
React__default.useEffect(() => {
|
|
688
|
+
setActiveMatchId('');
|
|
689
|
+
}, [activeRouteId]);
|
|
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);
|
|
1652
692
|
return /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
1653
693
|
theme: defaultTheme
|
|
1654
694
|
}, /*#__PURE__*/React__default.createElement(Panel, _extends({
|
|
@@ -1656,7 +696,49 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1656
696
|
className: "TanStackRouterDevtoolsPanel"
|
|
1657
697
|
}, panelProps), /*#__PURE__*/React__default.createElement("style", {
|
|
1658
698
|
dangerouslySetInnerHTML: {
|
|
1659
|
-
__html:
|
|
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
|
+
`
|
|
1660
742
|
}
|
|
1661
743
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
1662
744
|
style: {
|
|
@@ -1676,30 +758,27 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1676
758
|
minHeight: '40%',
|
|
1677
759
|
maxHeight: '100%',
|
|
1678
760
|
overflow: 'auto',
|
|
1679
|
-
borderRight:
|
|
761
|
+
borderRight: `1px solid ${defaultTheme.grayAlt}`,
|
|
1680
762
|
display: 'flex',
|
|
1681
763
|
flexDirection: 'column'
|
|
1682
764
|
}
|
|
1683
765
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1684
766
|
style: {
|
|
1685
|
-
padding: '.5em',
|
|
1686
|
-
background: defaultTheme.backgroundAlt,
|
|
1687
767
|
display: 'flex',
|
|
1688
|
-
justifyContent: '
|
|
1689
|
-
|
|
768
|
+
justifyContent: 'start',
|
|
769
|
+
gap: '1rem',
|
|
770
|
+
padding: '1rem',
|
|
771
|
+
alignItems: 'center',
|
|
772
|
+
background: defaultTheme.backgroundAlt
|
|
1690
773
|
}
|
|
1691
774
|
}, /*#__PURE__*/React__default.createElement(Logo, {
|
|
1692
|
-
"aria-hidden": true
|
|
1693
|
-
style: {
|
|
1694
|
-
marginRight: '.5em'
|
|
1695
|
-
}
|
|
775
|
+
"aria-hidden": true
|
|
1696
776
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
1697
777
|
style: {
|
|
1698
|
-
marginRight: 'auto',
|
|
1699
778
|
fontSize: 'clamp(.8rem, 2vw, 1.3rem)',
|
|
1700
779
|
fontWeight: 'bold'
|
|
1701
780
|
}
|
|
1702
|
-
},
|
|
781
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
1703
782
|
style: {
|
|
1704
783
|
fontWeight: 100
|
|
1705
784
|
}
|
|
@@ -1714,11 +793,7 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1714
793
|
}
|
|
1715
794
|
}, /*#__PURE__*/React__default.createElement(Explorer, {
|
|
1716
795
|
label: "Router",
|
|
1717
|
-
value:
|
|
1718
|
-
const rest = _objectWithoutPropertiesLoose(router, _excluded5);
|
|
1719
|
-
|
|
1720
|
-
return rest;
|
|
1721
|
-
})(),
|
|
796
|
+
value: router,
|
|
1722
797
|
defaultExpanded: {}
|
|
1723
798
|
})))), /*#__PURE__*/React__default.createElement("div", {
|
|
1724
799
|
style: {
|
|
@@ -1726,7 +801,7 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1726
801
|
minHeight: '40%',
|
|
1727
802
|
maxHeight: '100%',
|
|
1728
803
|
overflow: 'auto',
|
|
1729
|
-
borderRight:
|
|
804
|
+
borderRight: `1px solid ${defaultTheme.grayAlt}`,
|
|
1730
805
|
display: 'flex',
|
|
1731
806
|
flexDirection: 'column'
|
|
1732
807
|
}
|
|
@@ -1738,15 +813,15 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1738
813
|
top: 0,
|
|
1739
814
|
zIndex: 1
|
|
1740
815
|
}
|
|
1741
|
-
}, "
|
|
816
|
+
}, "Active Matches"), router.state.currentMatches.map((match, i) => {
|
|
1742
817
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
1743
|
-
key: match.
|
|
818
|
+
key: match.route.id || i,
|
|
1744
819
|
role: "button",
|
|
1745
|
-
"aria-label":
|
|
1746
|
-
onClick: () => setActiveRouteId(activeRouteId === match.
|
|
820
|
+
"aria-label": `Open match details for ${match.route.id}`,
|
|
821
|
+
onClick: () => setActiveRouteId(activeRouteId === match.route.id ? '' : match.route.id),
|
|
1747
822
|
style: {
|
|
1748
823
|
display: 'flex',
|
|
1749
|
-
borderBottom:
|
|
824
|
+
borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
|
|
1750
825
|
cursor: 'pointer',
|
|
1751
826
|
alignItems: 'center',
|
|
1752
827
|
background: match === activeMatch ? 'rgba(255,255,255,.1)' : undefined
|
|
@@ -1768,8 +843,8 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1768
843
|
style: {
|
|
1769
844
|
padding: '.5em'
|
|
1770
845
|
}
|
|
1771
|
-
},
|
|
1772
|
-
}), /*#__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", {
|
|
1773
848
|
style: {
|
|
1774
849
|
marginTop: '2rem',
|
|
1775
850
|
padding: '.5em',
|
|
@@ -1778,15 +853,15 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1778
853
|
top: 0,
|
|
1779
854
|
zIndex: 1
|
|
1780
855
|
}
|
|
1781
|
-
}, "Pending Matches"),
|
|
856
|
+
}, "Pending Matches"), router.state.pendingMatches?.map((match, i) => {
|
|
1782
857
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
1783
|
-
key: match.
|
|
858
|
+
key: match.route.id || i,
|
|
1784
859
|
role: "button",
|
|
1785
|
-
"aria-label":
|
|
1786
|
-
onClick: () => setActiveRouteId(activeRouteId === match.
|
|
860
|
+
"aria-label": `Open match details for ${match.route.id}`,
|
|
861
|
+
onClick: () => setActiveRouteId(activeRouteId === match.route.id ? '' : match.route.id),
|
|
1787
862
|
style: {
|
|
1788
863
|
display: 'flex',
|
|
1789
|
-
borderBottom:
|
|
864
|
+
borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
|
|
1790
865
|
cursor: 'pointer',
|
|
1791
866
|
background: match === activeMatch ? 'rgba(255,255,255,.1)' : undefined
|
|
1792
867
|
}
|
|
@@ -1807,77 +882,14 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1807
882
|
style: {
|
|
1808
883
|
padding: '.5em'
|
|
1809
884
|
}
|
|
1810
|
-
},
|
|
1811
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
1812
|
-
style: {
|
|
1813
|
-
marginTop: '2rem',
|
|
1814
|
-
padding: '.5em',
|
|
1815
|
-
background: defaultTheme.backgroundAlt,
|
|
1816
|
-
position: 'sticky',
|
|
1817
|
-
top: 0,
|
|
1818
|
-
zIndex: 1
|
|
1819
|
-
}
|
|
1820
|
-
}, "Preloading Matches"), Object.keys(router.preloadCache).filter(key => {
|
|
1821
|
-
var _cacheEntry$match$upd;
|
|
1822
|
-
|
|
1823
|
-
const cacheEntry = router.preloadCache[key];
|
|
1824
|
-
return ((_cacheEntry$match$upd = cacheEntry.match.updatedAt) != null ? _cacheEntry$match$upd : Date.now()) + cacheEntry.maxAge > Date.now();
|
|
1825
|
-
}).map((key, i) => {
|
|
1826
|
-
var _match$updatedAt;
|
|
1827
|
-
|
|
1828
|
-
const {
|
|
1829
|
-
match,
|
|
1830
|
-
maxAge
|
|
1831
|
-
} = router.preloadCache[key];
|
|
1832
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1833
|
-
key: match.matchId || i,
|
|
1834
|
-
role: "button",
|
|
1835
|
-
"aria-label": "Open match details for " + match.matchId,
|
|
1836
|
-
onClick: () => setActiveRouteId(activeRouteId === match.routeId ? '' : match.routeId),
|
|
1837
|
-
style: {
|
|
1838
|
-
display: 'flex',
|
|
1839
|
-
borderBottom: "solid 1px " + defaultTheme.grayAlt,
|
|
1840
|
-
cursor: 'pointer',
|
|
1841
|
-
background: match === activeMatch ? 'rgba(255,255,255,.1)' : undefined
|
|
1842
|
-
}
|
|
1843
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1844
|
-
style: {
|
|
1845
|
-
display: 'flex',
|
|
1846
|
-
flexDirection: 'column',
|
|
1847
|
-
padding: '.5rem',
|
|
1848
|
-
gap: '.3rem'
|
|
1849
|
-
}
|
|
1850
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1851
|
-
style: {
|
|
1852
|
-
display: 'flex',
|
|
1853
|
-
alignItems: 'center',
|
|
1854
|
-
gap: '.5rem'
|
|
1855
|
-
}
|
|
1856
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1857
|
-
style: {
|
|
1858
|
-
flex: '0 0 auto',
|
|
1859
|
-
width: '1.3rem',
|
|
1860
|
-
height: '1.3rem',
|
|
1861
|
-
background: getStatusColor(match, defaultTheme),
|
|
1862
|
-
alignItems: 'center',
|
|
1863
|
-
justifyContent: 'center',
|
|
1864
|
-
fontWeight: 'bold',
|
|
1865
|
-
borderRadius: '.25rem',
|
|
1866
|
-
transition: 'all .2s ease-out'
|
|
1867
|
-
}
|
|
1868
|
-
}), /*#__PURE__*/React__default.createElement(Code, null, "" + match.matchId)), /*#__PURE__*/React__default.createElement("span", {
|
|
1869
|
-
style: {
|
|
1870
|
-
opacity: '.5'
|
|
1871
|
-
}
|
|
1872
|
-
}, "Expires", ' ', formatDistanceStrict(new Date(), new Date(((_match$updatedAt = match.updatedAt) != null ? _match$updatedAt : Date.now()) + maxAge), {
|
|
1873
|
-
addSuffix: true
|
|
1874
|
-
}))));
|
|
1875
|
-
})), activeMatch ? /*#__PURE__*/React__default.createElement(ActivePanel, null, /*#__PURE__*/React__default.createElement("div", {
|
|
885
|
+
}, `${match.id}`));
|
|
886
|
+
})) : null), activeMatch ? /*#__PURE__*/React__default.createElement(ActivePanel, null, /*#__PURE__*/React__default.createElement("div", {
|
|
1876
887
|
style: {
|
|
1877
888
|
padding: '.5em',
|
|
1878
889
|
background: defaultTheme.backgroundAlt,
|
|
1879
890
|
position: 'sticky',
|
|
1880
891
|
top: 0,
|
|
892
|
+
bottom: 0,
|
|
1881
893
|
zIndex: 1
|
|
1882
894
|
}
|
|
1883
895
|
}, "Match Details"), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("table", null, /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
|
|
@@ -1888,28 +900,21 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1888
900
|
style: {
|
|
1889
901
|
lineHeight: '1.8em'
|
|
1890
902
|
}
|
|
1891
|
-
}, JSON.stringify(activeMatch.
|
|
1892
|
-
style: {
|
|
1893
|
-
opacity: '.5'
|
|
1894
|
-
}
|
|
1895
|
-
}, "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", {
|
|
1896
904
|
style: {
|
|
1897
905
|
opacity: '.5'
|
|
1898
906
|
}
|
|
1899
|
-
}, "
|
|
907
|
+
}, "Status"), /*#__PURE__*/React__default.createElement("td", null, activeMatch.state.status)), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
|
|
1900
908
|
style: {
|
|
1901
909
|
opacity: '.5'
|
|
1902
910
|
}
|
|
1903
|
-
}, "
|
|
1904
|
-
style: {
|
|
1905
|
-
opacity: '.5'
|
|
1906
|
-
}
|
|
1907
|
-
}, "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", {
|
|
1908
912
|
style: {
|
|
1909
913
|
background: defaultTheme.backgroundAlt,
|
|
1910
914
|
padding: '.5em',
|
|
1911
915
|
position: 'sticky',
|
|
1912
916
|
top: 0,
|
|
917
|
+
bottom: 0,
|
|
1913
918
|
zIndex: 1
|
|
1914
919
|
}
|
|
1915
920
|
}, "Actions"), /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -1918,17 +923,7 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1918
923
|
}
|
|
1919
924
|
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
1920
925
|
type: "button",
|
|
1921
|
-
onClick: () =>
|
|
1922
|
-
router.invalidateRoute(activeMatch);
|
|
1923
|
-
router.notify();
|
|
1924
|
-
},
|
|
1925
|
-
style: {
|
|
1926
|
-
background: defaultTheme.warning,
|
|
1927
|
-
color: defaultTheme.inputTextColor
|
|
1928
|
-
}
|
|
1929
|
-
}, "Invalidate"), ' ', /*#__PURE__*/React__default.createElement(Button, {
|
|
1930
|
-
type: "button",
|
|
1931
|
-
onClick: () => router.reload(),
|
|
926
|
+
onClick: () => activeMatch.load(),
|
|
1932
927
|
style: {
|
|
1933
928
|
background: defaultTheme.gray
|
|
1934
929
|
}
|
|
@@ -1938,6 +933,7 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1938
933
|
padding: '.5em',
|
|
1939
934
|
position: 'sticky',
|
|
1940
935
|
top: 0,
|
|
936
|
+
bottom: 0,
|
|
1941
937
|
zIndex: 1
|
|
1942
938
|
}
|
|
1943
939
|
}, "Explorer"), /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -1946,11 +942,7 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1946
942
|
}
|
|
1947
943
|
}, /*#__PURE__*/React__default.createElement(Explorer, {
|
|
1948
944
|
label: "Match",
|
|
1949
|
-
value:
|
|
1950
|
-
const rest = _objectWithoutPropertiesLoose(activeMatch, _excluded6);
|
|
1951
|
-
|
|
1952
|
-
return rest;
|
|
1953
|
-
})(),
|
|
945
|
+
value: activeMatch,
|
|
1954
946
|
defaultExpanded: {}
|
|
1955
947
|
}))) : null, /*#__PURE__*/React__default.createElement("div", {
|
|
1956
948
|
style: {
|
|
@@ -1958,7 +950,7 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1958
950
|
minHeight: '40%',
|
|
1959
951
|
maxHeight: '100%',
|
|
1960
952
|
overflow: 'auto',
|
|
1961
|
-
borderRight:
|
|
953
|
+
borderRight: `1px solid ${defaultTheme.grayAlt}`,
|
|
1962
954
|
display: 'flex',
|
|
1963
955
|
flexDirection: 'column'
|
|
1964
956
|
}
|
|
@@ -1968,37 +960,16 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1968
960
|
background: defaultTheme.backgroundAlt,
|
|
1969
961
|
position: 'sticky',
|
|
1970
962
|
top: 0,
|
|
1971
|
-
|
|
1972
|
-
}
|
|
1973
|
-
}, "Loader Data"), /*#__PURE__*/React__default.createElement("div", {
|
|
1974
|
-
style: {
|
|
1975
|
-
padding: '.5em'
|
|
1976
|
-
}
|
|
1977
|
-
}, Object.keys(((_last = last(router.state.matches)) == null ? void 0 : _last.loaderData) || {}).length ? /*#__PURE__*/React__default.createElement(Explorer, {
|
|
1978
|
-
value: ((_last2 = last(router.state.matches)) == null ? void 0 : _last2.loaderData) || {},
|
|
1979
|
-
defaultExpanded: Object.keys(((_last3 = last(router.state.matches)) == null ? void 0 : _last3.loaderData) || {}).reduce((obj, next) => {
|
|
1980
|
-
obj[next] = {};
|
|
1981
|
-
return obj;
|
|
1982
|
-
}, {})
|
|
1983
|
-
}) : /*#__PURE__*/React__default.createElement("em", {
|
|
1984
|
-
style: {
|
|
1985
|
-
opacity: 0.5
|
|
1986
|
-
}
|
|
1987
|
-
}, '{ }')), /*#__PURE__*/React__default.createElement("div", {
|
|
1988
|
-
style: {
|
|
1989
|
-
padding: '.5em',
|
|
1990
|
-
background: defaultTheme.backgroundAlt,
|
|
1991
|
-
position: 'sticky',
|
|
1992
|
-
top: 0,
|
|
963
|
+
bottom: 0,
|
|
1993
964
|
zIndex: 1
|
|
1994
965
|
}
|
|
1995
966
|
}, "Search Params"), /*#__PURE__*/React__default.createElement("div", {
|
|
1996
967
|
style: {
|
|
1997
968
|
padding: '.5em'
|
|
1998
969
|
}
|
|
1999
|
-
}, Object.keys(
|
|
2000
|
-
value:
|
|
2001
|
-
defaultExpanded: Object.keys(
|
|
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) => {
|
|
2002
973
|
obj[next] = {};
|
|
2003
974
|
return obj;
|
|
2004
975
|
}, {})
|