@tanstack/react-router-devtools 0.0.1-alpha.1
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/README.md +3 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +49 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/build/cjs/packages/react-router-devtools/src/Explorer.js +245 -0
- package/build/cjs/packages/react-router-devtools/src/Explorer.js.map +1 -0
- package/build/cjs/packages/react-router-devtools/src/Logo.js +73 -0
- package/build/cjs/packages/react-router-devtools/src/Logo.js.map +1 -0
- package/build/cjs/packages/react-router-devtools/src/devtools.js +654 -0
- package/build/cjs/packages/react-router-devtools/src/devtools.js.map +1 -0
- package/build/cjs/packages/react-router-devtools/src/index.js +21 -0
- package/build/cjs/packages/react-router-devtools/src/index.js.map +1 -0
- package/build/cjs/packages/react-router-devtools/src/styledComponents.js +107 -0
- package/build/cjs/packages/react-router-devtools/src/styledComponents.js.map +1 -0
- package/build/cjs/packages/react-router-devtools/src/theme.js +54 -0
- package/build/cjs/packages/react-router-devtools/src/theme.js.map +1 -0
- package/build/cjs/packages/react-router-devtools/src/useLocalStorage.js +65 -0
- package/build/cjs/packages/react-router-devtools/src/useLocalStorage.js.map +1 -0
- package/build/cjs/packages/react-router-devtools/src/useMediaQuery.js +57 -0
- package/build/cjs/packages/react-router-devtools/src/useMediaQuery.js.map +1 -0
- package/build/cjs/packages/react-router-devtools/src/utils.js +117 -0
- package/build/cjs/packages/react-router-devtools/src/utils.js.map +1 -0
- package/build/esm/index.js +2013 -0
- package/build/esm/index.js.map +1 -0
- package/build/stats-html.html +4034 -0
- package/build/stats-react.json +9681 -0
- package/build/types/index.d.ts +76 -0
- package/build/umd/index.development.js +2043 -0
- package/build/umd/index.development.js.map +1 -0
- package/build/umd/index.production.js +12 -0
- package/build/umd/index.production.js.map +1 -0
- package/package.json +49 -0
- package/src/Explorer.tsx +288 -0
- package/src/Logo.tsx +37 -0
- package/src/devtools.tsx +960 -0
- package/src/index.tsx +1 -0
- package/src/styledComponents.ts +106 -0
- package/src/theme.tsx +31 -0
- package/src/useLocalStorage.ts +52 -0
- package/src/useMediaQuery.ts +36 -0
- package/src/utils.ts +151 -0
|
@@ -0,0 +1,2043 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-router-devtools
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
(function (global, factory) {
|
|
12
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@tanstack/react-router')) :
|
|
13
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', '@tanstack/react-router'], factory) :
|
|
14
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactLocationDevtools = {}, global.React, global.ReactLocation));
|
|
15
|
+
})(this, (function (exports, React, reactRouter) { 'use strict';
|
|
16
|
+
|
|
17
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
|
+
|
|
19
|
+
function _interopNamespace(e) {
|
|
20
|
+
if (e && e.__esModule) return e;
|
|
21
|
+
var n = Object.create(null);
|
|
22
|
+
if (e) {
|
|
23
|
+
Object.keys(e).forEach(function (k) {
|
|
24
|
+
if (k !== 'default') {
|
|
25
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
26
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return e[k]; }
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
n["default"] = e;
|
|
34
|
+
return Object.freeze(n);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
38
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
39
|
+
|
|
40
|
+
function _extends() {
|
|
41
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
42
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
43
|
+
var source = arguments[i];
|
|
44
|
+
|
|
45
|
+
for (var key in source) {
|
|
46
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
47
|
+
target[key] = source[key];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return target;
|
|
53
|
+
};
|
|
54
|
+
return _extends.apply(this, arguments);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
58
|
+
if (source == null) return {};
|
|
59
|
+
var target = {};
|
|
60
|
+
var sourceKeys = Object.keys(source);
|
|
61
|
+
var key, i;
|
|
62
|
+
|
|
63
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
64
|
+
key = sourceKeys[i];
|
|
65
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
66
|
+
target[key] = source[key];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return target;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function requiredArgs(required, args) {
|
|
73
|
+
if (args.length < required) {
|
|
74
|
+
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @name toDate
|
|
80
|
+
* @category Common Helpers
|
|
81
|
+
* @summary Convert the given argument to an instance of Date.
|
|
82
|
+
*
|
|
83
|
+
* @description
|
|
84
|
+
* Convert the given argument to an instance of Date.
|
|
85
|
+
*
|
|
86
|
+
* If the argument is an instance of Date, the function returns its clone.
|
|
87
|
+
*
|
|
88
|
+
* If the argument is a number, it is treated as a timestamp.
|
|
89
|
+
*
|
|
90
|
+
* If the argument is none of the above, the function returns Invalid Date.
|
|
91
|
+
*
|
|
92
|
+
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
93
|
+
*
|
|
94
|
+
* @param {Date|Number} argument - the value to convert
|
|
95
|
+
* @returns {Date} the parsed date in the local time zone
|
|
96
|
+
* @throws {TypeError} 1 argument required
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* // Clone the date:
|
|
100
|
+
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
|
101
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* // Convert the timestamp to date:
|
|
105
|
+
* const result = toDate(1392098430000)
|
|
106
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
function toDate(argument) {
|
|
110
|
+
requiredArgs(1, arguments);
|
|
111
|
+
var argStr = Object.prototype.toString.call(argument); // Clone the date
|
|
112
|
+
|
|
113
|
+
if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
|
|
114
|
+
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
|
115
|
+
return new Date(argument.getTime());
|
|
116
|
+
} else if (typeof argument === 'number' || argStr === '[object Number]') {
|
|
117
|
+
return new Date(argument);
|
|
118
|
+
} else {
|
|
119
|
+
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
|
|
120
|
+
// eslint-disable-next-line no-console
|
|
121
|
+
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
|
|
122
|
+
|
|
123
|
+
console.warn(new Error().stack);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return new Date(NaN);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
var defaultOptions = {};
|
|
131
|
+
function getDefaultOptions() {
|
|
132
|
+
return defaultOptions;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
137
|
+
* They usually appear for dates that denote time before the timezones were introduced
|
|
138
|
+
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
139
|
+
* and GMT+01:00:00 after that date)
|
|
140
|
+
*
|
|
141
|
+
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
142
|
+
* which would lead to incorrect calculations.
|
|
143
|
+
*
|
|
144
|
+
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
145
|
+
*/
|
|
146
|
+
function getTimezoneOffsetInMilliseconds(date) {
|
|
147
|
+
var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
|
|
148
|
+
utcDate.setUTCFullYear(date.getFullYear());
|
|
149
|
+
return date.getTime() - utcDate.getTime();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @name compareAsc
|
|
154
|
+
* @category Common Helpers
|
|
155
|
+
* @summary Compare the two dates and return -1, 0 or 1.
|
|
156
|
+
*
|
|
157
|
+
* @description
|
|
158
|
+
* Compare the two dates and return 1 if the first date is after the second,
|
|
159
|
+
* -1 if the first date is before the second or 0 if dates are equal.
|
|
160
|
+
*
|
|
161
|
+
* @param {Date|Number} dateLeft - the first date to compare
|
|
162
|
+
* @param {Date|Number} dateRight - the second date to compare
|
|
163
|
+
* @returns {Number} the result of the comparison
|
|
164
|
+
* @throws {TypeError} 2 arguments required
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* // Compare 11 February 1987 and 10 July 1989:
|
|
168
|
+
* const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
|
|
169
|
+
* //=> -1
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* // Sort the array of dates:
|
|
173
|
+
* const result = [
|
|
174
|
+
* new Date(1995, 6, 2),
|
|
175
|
+
* new Date(1987, 1, 11),
|
|
176
|
+
* new Date(1989, 6, 10)
|
|
177
|
+
* ].sort(compareAsc)
|
|
178
|
+
* //=> [
|
|
179
|
+
* // Wed Feb 11 1987 00:00:00,
|
|
180
|
+
* // Mon Jul 10 1989 00:00:00,
|
|
181
|
+
* // Sun Jul 02 1995 00:00:00
|
|
182
|
+
* // ]
|
|
183
|
+
*/
|
|
184
|
+
|
|
185
|
+
function compareAsc(dirtyDateLeft, dirtyDateRight) {
|
|
186
|
+
requiredArgs(2, arguments);
|
|
187
|
+
var dateLeft = toDate(dirtyDateLeft);
|
|
188
|
+
var dateRight = toDate(dirtyDateRight);
|
|
189
|
+
var diff = dateLeft.getTime() - dateRight.getTime();
|
|
190
|
+
|
|
191
|
+
if (diff < 0) {
|
|
192
|
+
return -1;
|
|
193
|
+
} else if (diff > 0) {
|
|
194
|
+
return 1; // Return 0 if diff is 0; return NaN if diff is NaN
|
|
195
|
+
} else {
|
|
196
|
+
return diff;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
var formatDistanceLocale = {
|
|
201
|
+
lessThanXSeconds: {
|
|
202
|
+
one: 'less than a second',
|
|
203
|
+
other: 'less than {{count}} seconds'
|
|
204
|
+
},
|
|
205
|
+
xSeconds: {
|
|
206
|
+
one: '1 second',
|
|
207
|
+
other: '{{count}} seconds'
|
|
208
|
+
},
|
|
209
|
+
halfAMinute: 'half a minute',
|
|
210
|
+
lessThanXMinutes: {
|
|
211
|
+
one: 'less than a minute',
|
|
212
|
+
other: 'less than {{count}} minutes'
|
|
213
|
+
},
|
|
214
|
+
xMinutes: {
|
|
215
|
+
one: '1 minute',
|
|
216
|
+
other: '{{count}} minutes'
|
|
217
|
+
},
|
|
218
|
+
aboutXHours: {
|
|
219
|
+
one: 'about 1 hour',
|
|
220
|
+
other: 'about {{count}} hours'
|
|
221
|
+
},
|
|
222
|
+
xHours: {
|
|
223
|
+
one: '1 hour',
|
|
224
|
+
other: '{{count}} hours'
|
|
225
|
+
},
|
|
226
|
+
xDays: {
|
|
227
|
+
one: '1 day',
|
|
228
|
+
other: '{{count}} days'
|
|
229
|
+
},
|
|
230
|
+
aboutXWeeks: {
|
|
231
|
+
one: 'about 1 week',
|
|
232
|
+
other: 'about {{count}} weeks'
|
|
233
|
+
},
|
|
234
|
+
xWeeks: {
|
|
235
|
+
one: '1 week',
|
|
236
|
+
other: '{{count}} weeks'
|
|
237
|
+
},
|
|
238
|
+
aboutXMonths: {
|
|
239
|
+
one: 'about 1 month',
|
|
240
|
+
other: 'about {{count}} months'
|
|
241
|
+
},
|
|
242
|
+
xMonths: {
|
|
243
|
+
one: '1 month',
|
|
244
|
+
other: '{{count}} months'
|
|
245
|
+
},
|
|
246
|
+
aboutXYears: {
|
|
247
|
+
one: 'about 1 year',
|
|
248
|
+
other: 'about {{count}} years'
|
|
249
|
+
},
|
|
250
|
+
xYears: {
|
|
251
|
+
one: '1 year',
|
|
252
|
+
other: '{{count}} years'
|
|
253
|
+
},
|
|
254
|
+
overXYears: {
|
|
255
|
+
one: 'over 1 year',
|
|
256
|
+
other: 'over {{count}} years'
|
|
257
|
+
},
|
|
258
|
+
almostXYears: {
|
|
259
|
+
one: 'almost 1 year',
|
|
260
|
+
other: 'almost {{count}} years'
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
var formatDistance = function (token, count, options) {
|
|
265
|
+
var result;
|
|
266
|
+
var tokenValue = formatDistanceLocale[token];
|
|
267
|
+
|
|
268
|
+
if (typeof tokenValue === 'string') {
|
|
269
|
+
result = tokenValue;
|
|
270
|
+
} else if (count === 1) {
|
|
271
|
+
result = tokenValue.one;
|
|
272
|
+
} else {
|
|
273
|
+
result = tokenValue.other.replace('{{count}}', count.toString());
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (options !== null && options !== void 0 && options.addSuffix) {
|
|
277
|
+
if (options.comparison && options.comparison > 0) {
|
|
278
|
+
return 'in ' + result;
|
|
279
|
+
} else {
|
|
280
|
+
return result + ' ago';
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return result;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
var formatDistance$1 = formatDistance;
|
|
288
|
+
|
|
289
|
+
function buildFormatLongFn(args) {
|
|
290
|
+
return function () {
|
|
291
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
292
|
+
// TODO: Remove String()
|
|
293
|
+
var width = options.width ? String(options.width) : args.defaultWidth;
|
|
294
|
+
var format = args.formats[width] || args.formats[args.defaultWidth];
|
|
295
|
+
return format;
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
var dateFormats = {
|
|
300
|
+
full: 'EEEE, MMMM do, y',
|
|
301
|
+
long: 'MMMM do, y',
|
|
302
|
+
medium: 'MMM d, y',
|
|
303
|
+
short: 'MM/dd/yyyy'
|
|
304
|
+
};
|
|
305
|
+
var timeFormats = {
|
|
306
|
+
full: 'h:mm:ss a zzzz',
|
|
307
|
+
long: 'h:mm:ss a z',
|
|
308
|
+
medium: 'h:mm:ss a',
|
|
309
|
+
short: 'h:mm a'
|
|
310
|
+
};
|
|
311
|
+
var dateTimeFormats = {
|
|
312
|
+
full: "{{date}} 'at' {{time}}",
|
|
313
|
+
long: "{{date}} 'at' {{time}}",
|
|
314
|
+
medium: '{{date}}, {{time}}',
|
|
315
|
+
short: '{{date}}, {{time}}'
|
|
316
|
+
};
|
|
317
|
+
var formatLong = {
|
|
318
|
+
date: buildFormatLongFn({
|
|
319
|
+
formats: dateFormats,
|
|
320
|
+
defaultWidth: 'full'
|
|
321
|
+
}),
|
|
322
|
+
time: buildFormatLongFn({
|
|
323
|
+
formats: timeFormats,
|
|
324
|
+
defaultWidth: 'full'
|
|
325
|
+
}),
|
|
326
|
+
dateTime: buildFormatLongFn({
|
|
327
|
+
formats: dateTimeFormats,
|
|
328
|
+
defaultWidth: 'full'
|
|
329
|
+
})
|
|
330
|
+
};
|
|
331
|
+
var formatLong$1 = formatLong;
|
|
332
|
+
|
|
333
|
+
var formatRelativeLocale = {
|
|
334
|
+
lastWeek: "'last' eeee 'at' p",
|
|
335
|
+
yesterday: "'yesterday at' p",
|
|
336
|
+
today: "'today at' p",
|
|
337
|
+
tomorrow: "'tomorrow at' p",
|
|
338
|
+
nextWeek: "eeee 'at' p",
|
|
339
|
+
other: 'P'
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
var formatRelative = function (token, _date, _baseDate, _options) {
|
|
343
|
+
return formatRelativeLocale[token];
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
var formatRelative$1 = formatRelative;
|
|
347
|
+
|
|
348
|
+
function buildLocalizeFn(args) {
|
|
349
|
+
return function (dirtyIndex, options) {
|
|
350
|
+
var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
|
|
351
|
+
var valuesArray;
|
|
352
|
+
|
|
353
|
+
if (context === 'formatting' && args.formattingValues) {
|
|
354
|
+
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
355
|
+
var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
|
|
356
|
+
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
357
|
+
} else {
|
|
358
|
+
var _defaultWidth = args.defaultWidth;
|
|
359
|
+
|
|
360
|
+
var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
|
|
361
|
+
|
|
362
|
+
valuesArray = args.values[_width] || args.values[_defaultWidth];
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
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!
|
|
366
|
+
|
|
367
|
+
return valuesArray[index];
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
var eraValues = {
|
|
372
|
+
narrow: ['B', 'A'],
|
|
373
|
+
abbreviated: ['BC', 'AD'],
|
|
374
|
+
wide: ['Before Christ', 'Anno Domini']
|
|
375
|
+
};
|
|
376
|
+
var quarterValues = {
|
|
377
|
+
narrow: ['1', '2', '3', '4'],
|
|
378
|
+
abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
|
|
379
|
+
wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
|
|
380
|
+
}; // Note: in English, the names of days of the week and months are capitalized.
|
|
381
|
+
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
|
|
382
|
+
// Generally, formatted dates should look like they are in the middle of a sentence,
|
|
383
|
+
// e.g. in Spanish language the weekdays and months should be in the lowercase.
|
|
384
|
+
|
|
385
|
+
var monthValues = {
|
|
386
|
+
narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
|
|
387
|
+
abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
388
|
+
wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
|
389
|
+
};
|
|
390
|
+
var dayValues = {
|
|
391
|
+
narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
392
|
+
short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
393
|
+
abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
394
|
+
wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
|
395
|
+
};
|
|
396
|
+
var dayPeriodValues = {
|
|
397
|
+
narrow: {
|
|
398
|
+
am: 'a',
|
|
399
|
+
pm: 'p',
|
|
400
|
+
midnight: 'mi',
|
|
401
|
+
noon: 'n',
|
|
402
|
+
morning: 'morning',
|
|
403
|
+
afternoon: 'afternoon',
|
|
404
|
+
evening: 'evening',
|
|
405
|
+
night: 'night'
|
|
406
|
+
},
|
|
407
|
+
abbreviated: {
|
|
408
|
+
am: 'AM',
|
|
409
|
+
pm: 'PM',
|
|
410
|
+
midnight: 'midnight',
|
|
411
|
+
noon: 'noon',
|
|
412
|
+
morning: 'morning',
|
|
413
|
+
afternoon: 'afternoon',
|
|
414
|
+
evening: 'evening',
|
|
415
|
+
night: 'night'
|
|
416
|
+
},
|
|
417
|
+
wide: {
|
|
418
|
+
am: 'a.m.',
|
|
419
|
+
pm: 'p.m.',
|
|
420
|
+
midnight: 'midnight',
|
|
421
|
+
noon: 'noon',
|
|
422
|
+
morning: 'morning',
|
|
423
|
+
afternoon: 'afternoon',
|
|
424
|
+
evening: 'evening',
|
|
425
|
+
night: 'night'
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
var formattingDayPeriodValues = {
|
|
429
|
+
narrow: {
|
|
430
|
+
am: 'a',
|
|
431
|
+
pm: 'p',
|
|
432
|
+
midnight: 'mi',
|
|
433
|
+
noon: 'n',
|
|
434
|
+
morning: 'in the morning',
|
|
435
|
+
afternoon: 'in the afternoon',
|
|
436
|
+
evening: 'in the evening',
|
|
437
|
+
night: 'at night'
|
|
438
|
+
},
|
|
439
|
+
abbreviated: {
|
|
440
|
+
am: 'AM',
|
|
441
|
+
pm: 'PM',
|
|
442
|
+
midnight: 'midnight',
|
|
443
|
+
noon: 'noon',
|
|
444
|
+
morning: 'in the morning',
|
|
445
|
+
afternoon: 'in the afternoon',
|
|
446
|
+
evening: 'in the evening',
|
|
447
|
+
night: 'at night'
|
|
448
|
+
},
|
|
449
|
+
wide: {
|
|
450
|
+
am: 'a.m.',
|
|
451
|
+
pm: 'p.m.',
|
|
452
|
+
midnight: 'midnight',
|
|
453
|
+
noon: 'noon',
|
|
454
|
+
morning: 'in the morning',
|
|
455
|
+
afternoon: 'in the afternoon',
|
|
456
|
+
evening: 'in the evening',
|
|
457
|
+
night: 'at night'
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
var ordinalNumber = function (dirtyNumber, _options) {
|
|
462
|
+
var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
|
|
463
|
+
// if they are different for different grammatical genders,
|
|
464
|
+
// use `options.unit`.
|
|
465
|
+
//
|
|
466
|
+
// `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
|
|
467
|
+
// 'day', 'hour', 'minute', 'second'.
|
|
468
|
+
|
|
469
|
+
var rem100 = number % 100;
|
|
470
|
+
|
|
471
|
+
if (rem100 > 20 || rem100 < 10) {
|
|
472
|
+
switch (rem100 % 10) {
|
|
473
|
+
case 1:
|
|
474
|
+
return number + 'st';
|
|
475
|
+
|
|
476
|
+
case 2:
|
|
477
|
+
return number + 'nd';
|
|
478
|
+
|
|
479
|
+
case 3:
|
|
480
|
+
return number + 'rd';
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
return number + 'th';
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
var localize = {
|
|
488
|
+
ordinalNumber: ordinalNumber,
|
|
489
|
+
era: buildLocalizeFn({
|
|
490
|
+
values: eraValues,
|
|
491
|
+
defaultWidth: 'wide'
|
|
492
|
+
}),
|
|
493
|
+
quarter: buildLocalizeFn({
|
|
494
|
+
values: quarterValues,
|
|
495
|
+
defaultWidth: 'wide',
|
|
496
|
+
argumentCallback: function (quarter) {
|
|
497
|
+
return quarter - 1;
|
|
498
|
+
}
|
|
499
|
+
}),
|
|
500
|
+
month: buildLocalizeFn({
|
|
501
|
+
values: monthValues,
|
|
502
|
+
defaultWidth: 'wide'
|
|
503
|
+
}),
|
|
504
|
+
day: buildLocalizeFn({
|
|
505
|
+
values: dayValues,
|
|
506
|
+
defaultWidth: 'wide'
|
|
507
|
+
}),
|
|
508
|
+
dayPeriod: buildLocalizeFn({
|
|
509
|
+
values: dayPeriodValues,
|
|
510
|
+
defaultWidth: 'wide',
|
|
511
|
+
formattingValues: formattingDayPeriodValues,
|
|
512
|
+
defaultFormattingWidth: 'wide'
|
|
513
|
+
})
|
|
514
|
+
};
|
|
515
|
+
var localize$1 = localize;
|
|
516
|
+
|
|
517
|
+
function buildMatchFn(args) {
|
|
518
|
+
return function (string) {
|
|
519
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
520
|
+
var width = options.width;
|
|
521
|
+
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
522
|
+
var matchResult = string.match(matchPattern);
|
|
523
|
+
|
|
524
|
+
if (!matchResult) {
|
|
525
|
+
return null;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
var matchedString = matchResult[0];
|
|
529
|
+
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
530
|
+
var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
|
|
531
|
+
return pattern.test(matchedString);
|
|
532
|
+
}) : findKey(parsePatterns, function (pattern) {
|
|
533
|
+
return pattern.test(matchedString);
|
|
534
|
+
});
|
|
535
|
+
var value;
|
|
536
|
+
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
537
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
538
|
+
var rest = string.slice(matchedString.length);
|
|
539
|
+
return {
|
|
540
|
+
value: value,
|
|
541
|
+
rest: rest
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
function findKey(object, predicate) {
|
|
547
|
+
for (var key in object) {
|
|
548
|
+
if (object.hasOwnProperty(key) && predicate(object[key])) {
|
|
549
|
+
return key;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return undefined;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function findIndex(array, predicate) {
|
|
557
|
+
for (var key = 0; key < array.length; key++) {
|
|
558
|
+
if (predicate(array[key])) {
|
|
559
|
+
return key;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
return undefined;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
function buildMatchPatternFn(args) {
|
|
567
|
+
return function (string) {
|
|
568
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
569
|
+
var matchResult = string.match(args.matchPattern);
|
|
570
|
+
if (!matchResult) return null;
|
|
571
|
+
var matchedString = matchResult[0];
|
|
572
|
+
var parseResult = string.match(args.parsePattern);
|
|
573
|
+
if (!parseResult) return null;
|
|
574
|
+
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
575
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
576
|
+
var rest = string.slice(matchedString.length);
|
|
577
|
+
return {
|
|
578
|
+
value: value,
|
|
579
|
+
rest: rest
|
|
580
|
+
};
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
|
585
|
+
var parseOrdinalNumberPattern = /\d+/i;
|
|
586
|
+
var matchEraPatterns = {
|
|
587
|
+
narrow: /^(b|a)/i,
|
|
588
|
+
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
589
|
+
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
590
|
+
};
|
|
591
|
+
var parseEraPatterns = {
|
|
592
|
+
any: [/^b/i, /^(a|c)/i]
|
|
593
|
+
};
|
|
594
|
+
var matchQuarterPatterns = {
|
|
595
|
+
narrow: /^[1234]/i,
|
|
596
|
+
abbreviated: /^q[1234]/i,
|
|
597
|
+
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
598
|
+
};
|
|
599
|
+
var parseQuarterPatterns = {
|
|
600
|
+
any: [/1/i, /2/i, /3/i, /4/i]
|
|
601
|
+
};
|
|
602
|
+
var matchMonthPatterns = {
|
|
603
|
+
narrow: /^[jfmasond]/i,
|
|
604
|
+
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
605
|
+
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
606
|
+
};
|
|
607
|
+
var parseMonthPatterns = {
|
|
608
|
+
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],
|
|
609
|
+
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]
|
|
610
|
+
};
|
|
611
|
+
var matchDayPatterns = {
|
|
612
|
+
narrow: /^[smtwf]/i,
|
|
613
|
+
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
614
|
+
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
615
|
+
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
616
|
+
};
|
|
617
|
+
var parseDayPatterns = {
|
|
618
|
+
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
619
|
+
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
620
|
+
};
|
|
621
|
+
var matchDayPeriodPatterns = {
|
|
622
|
+
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
623
|
+
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
624
|
+
};
|
|
625
|
+
var parseDayPeriodPatterns = {
|
|
626
|
+
any: {
|
|
627
|
+
am: /^a/i,
|
|
628
|
+
pm: /^p/i,
|
|
629
|
+
midnight: /^mi/i,
|
|
630
|
+
noon: /^no/i,
|
|
631
|
+
morning: /morning/i,
|
|
632
|
+
afternoon: /afternoon/i,
|
|
633
|
+
evening: /evening/i,
|
|
634
|
+
night: /night/i
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
var match = {
|
|
638
|
+
ordinalNumber: buildMatchPatternFn({
|
|
639
|
+
matchPattern: matchOrdinalNumberPattern,
|
|
640
|
+
parsePattern: parseOrdinalNumberPattern,
|
|
641
|
+
valueCallback: function (value) {
|
|
642
|
+
return parseInt(value, 10);
|
|
643
|
+
}
|
|
644
|
+
}),
|
|
645
|
+
era: buildMatchFn({
|
|
646
|
+
matchPatterns: matchEraPatterns,
|
|
647
|
+
defaultMatchWidth: 'wide',
|
|
648
|
+
parsePatterns: parseEraPatterns,
|
|
649
|
+
defaultParseWidth: 'any'
|
|
650
|
+
}),
|
|
651
|
+
quarter: buildMatchFn({
|
|
652
|
+
matchPatterns: matchQuarterPatterns,
|
|
653
|
+
defaultMatchWidth: 'wide',
|
|
654
|
+
parsePatterns: parseQuarterPatterns,
|
|
655
|
+
defaultParseWidth: 'any',
|
|
656
|
+
valueCallback: function (index) {
|
|
657
|
+
return index + 1;
|
|
658
|
+
}
|
|
659
|
+
}),
|
|
660
|
+
month: buildMatchFn({
|
|
661
|
+
matchPatterns: matchMonthPatterns,
|
|
662
|
+
defaultMatchWidth: 'wide',
|
|
663
|
+
parsePatterns: parseMonthPatterns,
|
|
664
|
+
defaultParseWidth: 'any'
|
|
665
|
+
}),
|
|
666
|
+
day: buildMatchFn({
|
|
667
|
+
matchPatterns: matchDayPatterns,
|
|
668
|
+
defaultMatchWidth: 'wide',
|
|
669
|
+
parsePatterns: parseDayPatterns,
|
|
670
|
+
defaultParseWidth: 'any'
|
|
671
|
+
}),
|
|
672
|
+
dayPeriod: buildMatchFn({
|
|
673
|
+
matchPatterns: matchDayPeriodPatterns,
|
|
674
|
+
defaultMatchWidth: 'any',
|
|
675
|
+
parsePatterns: parseDayPeriodPatterns,
|
|
676
|
+
defaultParseWidth: 'any'
|
|
677
|
+
})
|
|
678
|
+
};
|
|
679
|
+
var match$1 = match;
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* @type {Locale}
|
|
683
|
+
* @category Locales
|
|
684
|
+
* @summary English locale (United States).
|
|
685
|
+
* @language English
|
|
686
|
+
* @iso-639-2 eng
|
|
687
|
+
* @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
|
|
688
|
+
* @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
|
|
689
|
+
*/
|
|
690
|
+
var locale = {
|
|
691
|
+
code: 'en-US',
|
|
692
|
+
formatDistance: formatDistance$1,
|
|
693
|
+
formatLong: formatLong$1,
|
|
694
|
+
formatRelative: formatRelative$1,
|
|
695
|
+
localize: localize$1,
|
|
696
|
+
match: match$1,
|
|
697
|
+
options: {
|
|
698
|
+
weekStartsOn: 0
|
|
699
|
+
/* Sunday */
|
|
700
|
+
,
|
|
701
|
+
firstWeekContainsDate: 1
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
var defaultLocale = locale;
|
|
705
|
+
|
|
706
|
+
function assign(target, object) {
|
|
707
|
+
if (target == null) {
|
|
708
|
+
throw new TypeError('assign requires that input parameter not be null or undefined');
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
for (var property in object) {
|
|
712
|
+
if (Object.prototype.hasOwnProperty.call(object, property)) {
|
|
713
|
+
target[property] = object[property];
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
return target;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
function cloneObject(object) {
|
|
721
|
+
return assign({}, object);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
var MILLISECONDS_IN_MINUTE = 1000 * 60;
|
|
725
|
+
var MINUTES_IN_DAY = 60 * 24;
|
|
726
|
+
var MINUTES_IN_MONTH = MINUTES_IN_DAY * 30;
|
|
727
|
+
var MINUTES_IN_YEAR = MINUTES_IN_DAY * 365;
|
|
728
|
+
/**
|
|
729
|
+
* @name formatDistanceStrict
|
|
730
|
+
* @category Common Helpers
|
|
731
|
+
* @summary Return the distance between the given dates in words.
|
|
732
|
+
*
|
|
733
|
+
* @description
|
|
734
|
+
* Return the distance between the given dates in words, using strict units.
|
|
735
|
+
* This is like `formatDistance`, but does not use helpers like 'almost', 'over',
|
|
736
|
+
* 'less than' and the like.
|
|
737
|
+
*
|
|
738
|
+
* | Distance between dates | Result |
|
|
739
|
+
* |------------------------|---------------------|
|
|
740
|
+
* | 0 ... 59 secs | [0..59] seconds |
|
|
741
|
+
* | 1 ... 59 mins | [1..59] minutes |
|
|
742
|
+
* | 1 ... 23 hrs | [1..23] hours |
|
|
743
|
+
* | 1 ... 29 days | [1..29] days |
|
|
744
|
+
* | 1 ... 11 months | [1..11] months |
|
|
745
|
+
* | 1 ... N years | [1..N] years |
|
|
746
|
+
*
|
|
747
|
+
* @param {Date|Number} date - the date
|
|
748
|
+
* @param {Date|Number} baseDate - the date to compare with
|
|
749
|
+
* @param {Object} [options] - an object with options.
|
|
750
|
+
* @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first
|
|
751
|
+
* @param {'second'|'minute'|'hour'|'day'|'month'|'year'} [options.unit] - if specified, will force a unit
|
|
752
|
+
* @param {'floor'|'ceil'|'round'} [options.roundingMethod='round'] - which way to round partial units
|
|
753
|
+
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
|
|
754
|
+
* @returns {String} the distance in words
|
|
755
|
+
* @throws {TypeError} 2 arguments required
|
|
756
|
+
* @throws {RangeError} `date` must not be Invalid Date
|
|
757
|
+
* @throws {RangeError} `baseDate` must not be Invalid Date
|
|
758
|
+
* @throws {RangeError} `options.roundingMethod` must be 'floor', 'ceil' or 'round'
|
|
759
|
+
* @throws {RangeError} `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year'
|
|
760
|
+
* @throws {RangeError} `options.locale` must contain `formatDistance` property
|
|
761
|
+
*
|
|
762
|
+
* @example
|
|
763
|
+
* // What is the distance between 2 July 2014 and 1 January 2015?
|
|
764
|
+
* const result = formatDistanceStrict(new Date(2014, 6, 2), new Date(2015, 0, 2))
|
|
765
|
+
* //=> '6 months'
|
|
766
|
+
*
|
|
767
|
+
* @example
|
|
768
|
+
* // What is the distance between 1 January 2015 00:00:15
|
|
769
|
+
* // and 1 January 2015 00:00:00?
|
|
770
|
+
* const result = formatDistanceStrict(
|
|
771
|
+
* new Date(2015, 0, 1, 0, 0, 15),
|
|
772
|
+
* new Date(2015, 0, 1, 0, 0, 0)
|
|
773
|
+
* )
|
|
774
|
+
* //=> '15 seconds'
|
|
775
|
+
*
|
|
776
|
+
* @example
|
|
777
|
+
* // What is the distance from 1 January 2016
|
|
778
|
+
* // to 1 January 2015, with a suffix?
|
|
779
|
+
* const result = formatDistanceStrict(new Date(2015, 0, 1), new Date(2016, 0, 1), {
|
|
780
|
+
* addSuffix: true
|
|
781
|
+
* })
|
|
782
|
+
* //=> '1 year ago'
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* // What is the distance from 1 January 2016
|
|
786
|
+
* // to 1 January 2015, in minutes?
|
|
787
|
+
* const result = formatDistanceStrict(new Date(2016, 0, 1), new Date(2015, 0, 1), {
|
|
788
|
+
* unit: 'minute'
|
|
789
|
+
* })
|
|
790
|
+
* //=> '525600 minutes'
|
|
791
|
+
*
|
|
792
|
+
* @example
|
|
793
|
+
* // What is the distance from 1 January 2015
|
|
794
|
+
* // to 28 January 2015, in months, rounded up?
|
|
795
|
+
* const result = formatDistanceStrict(new Date(2015, 0, 28), new Date(2015, 0, 1), {
|
|
796
|
+
* unit: 'month',
|
|
797
|
+
* roundingMethod: 'ceil'
|
|
798
|
+
* })
|
|
799
|
+
* //=> '1 month'
|
|
800
|
+
*
|
|
801
|
+
* @example
|
|
802
|
+
* // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?
|
|
803
|
+
* import { eoLocale } from 'date-fns/locale/eo'
|
|
804
|
+
* const result = formatDistanceStrict(new Date(2016, 7, 1), new Date(2015, 0, 1), {
|
|
805
|
+
* locale: eoLocale
|
|
806
|
+
* })
|
|
807
|
+
* //=> '1 jaro'
|
|
808
|
+
*/
|
|
809
|
+
|
|
810
|
+
function formatDistanceStrict(dirtyDate, dirtyBaseDate, options) {
|
|
811
|
+
var _ref, _options$locale, _options$roundingMeth;
|
|
812
|
+
|
|
813
|
+
requiredArgs(2, arguments);
|
|
814
|
+
var defaultOptions = getDefaultOptions();
|
|
815
|
+
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;
|
|
816
|
+
|
|
817
|
+
if (!locale.formatDistance) {
|
|
818
|
+
throw new RangeError('locale must contain localize.formatDistance property');
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
var comparison = compareAsc(dirtyDate, dirtyBaseDate);
|
|
822
|
+
|
|
823
|
+
if (isNaN(comparison)) {
|
|
824
|
+
throw new RangeError('Invalid time value');
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
var localizeOptions = assign(cloneObject(options), {
|
|
828
|
+
addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix),
|
|
829
|
+
comparison: comparison
|
|
830
|
+
});
|
|
831
|
+
var dateLeft;
|
|
832
|
+
var dateRight;
|
|
833
|
+
|
|
834
|
+
if (comparison > 0) {
|
|
835
|
+
dateLeft = toDate(dirtyBaseDate);
|
|
836
|
+
dateRight = toDate(dirtyDate);
|
|
837
|
+
} else {
|
|
838
|
+
dateLeft = toDate(dirtyDate);
|
|
839
|
+
dateRight = toDate(dirtyBaseDate);
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
var roundingMethod = String((_options$roundingMeth = options === null || options === void 0 ? void 0 : options.roundingMethod) !== null && _options$roundingMeth !== void 0 ? _options$roundingMeth : 'round');
|
|
843
|
+
var roundingMethodFn;
|
|
844
|
+
|
|
845
|
+
if (roundingMethod === 'floor') {
|
|
846
|
+
roundingMethodFn = Math.floor;
|
|
847
|
+
} else if (roundingMethod === 'ceil') {
|
|
848
|
+
roundingMethodFn = Math.ceil;
|
|
849
|
+
} else if (roundingMethod === 'round') {
|
|
850
|
+
roundingMethodFn = Math.round;
|
|
851
|
+
} else {
|
|
852
|
+
throw new RangeError("roundingMethod must be 'floor', 'ceil' or 'round'");
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
var milliseconds = dateRight.getTime() - dateLeft.getTime();
|
|
856
|
+
var minutes = milliseconds / MILLISECONDS_IN_MINUTE;
|
|
857
|
+
var timezoneOffset = getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft); // Use DST-normalized difference in minutes for years, months and days;
|
|
858
|
+
// use regular difference in minutes for hours, minutes and seconds.
|
|
859
|
+
|
|
860
|
+
var dstNormalizedMinutes = (milliseconds - timezoneOffset) / MILLISECONDS_IN_MINUTE;
|
|
861
|
+
var defaultUnit = options === null || options === void 0 ? void 0 : options.unit;
|
|
862
|
+
var unit;
|
|
863
|
+
|
|
864
|
+
if (!defaultUnit) {
|
|
865
|
+
if (minutes < 1) {
|
|
866
|
+
unit = 'second';
|
|
867
|
+
} else if (minutes < 60) {
|
|
868
|
+
unit = 'minute';
|
|
869
|
+
} else if (minutes < MINUTES_IN_DAY) {
|
|
870
|
+
unit = 'hour';
|
|
871
|
+
} else if (dstNormalizedMinutes < MINUTES_IN_MONTH) {
|
|
872
|
+
unit = 'day';
|
|
873
|
+
} else if (dstNormalizedMinutes < MINUTES_IN_YEAR) {
|
|
874
|
+
unit = 'month';
|
|
875
|
+
} else {
|
|
876
|
+
unit = 'year';
|
|
877
|
+
}
|
|
878
|
+
} else {
|
|
879
|
+
unit = String(defaultUnit);
|
|
880
|
+
} // 0 up to 60 seconds
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
if (unit === 'second') {
|
|
884
|
+
var seconds = roundingMethodFn(milliseconds / 1000);
|
|
885
|
+
return locale.formatDistance('xSeconds', seconds, localizeOptions); // 1 up to 60 mins
|
|
886
|
+
} else if (unit === 'minute') {
|
|
887
|
+
var roundedMinutes = roundingMethodFn(minutes);
|
|
888
|
+
return locale.formatDistance('xMinutes', roundedMinutes, localizeOptions); // 1 up to 24 hours
|
|
889
|
+
} else if (unit === 'hour') {
|
|
890
|
+
var hours = roundingMethodFn(minutes / 60);
|
|
891
|
+
return locale.formatDistance('xHours', hours, localizeOptions); // 1 up to 30 days
|
|
892
|
+
} else if (unit === 'day') {
|
|
893
|
+
var days = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_DAY);
|
|
894
|
+
return locale.formatDistance('xDays', days, localizeOptions); // 1 up to 12 months
|
|
895
|
+
} else if (unit === 'month') {
|
|
896
|
+
var months = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_MONTH);
|
|
897
|
+
return months === 12 && defaultUnit !== 'month' ? locale.formatDistance('xYears', 1, localizeOptions) : locale.formatDistance('xMonths', months, localizeOptions); // 1 year up to max Date
|
|
898
|
+
} else if (unit === 'year') {
|
|
899
|
+
var years = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_YEAR);
|
|
900
|
+
return locale.formatDistance('xYears', years, localizeOptions);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
throw new RangeError("unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'");
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
const getItem = key => {
|
|
907
|
+
try {
|
|
908
|
+
const itemValue = localStorage.getItem(key);
|
|
909
|
+
|
|
910
|
+
if (typeof itemValue === 'string') {
|
|
911
|
+
return JSON.parse(itemValue);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
return undefined;
|
|
915
|
+
} catch (_unused) {
|
|
916
|
+
return undefined;
|
|
917
|
+
}
|
|
918
|
+
};
|
|
919
|
+
|
|
920
|
+
function useLocalStorage(key, defaultValue) {
|
|
921
|
+
const [value, setValue] = React__default["default"].useState();
|
|
922
|
+
React__default["default"].useEffect(() => {
|
|
923
|
+
const initialValue = getItem(key);
|
|
924
|
+
|
|
925
|
+
if (typeof initialValue === 'undefined' || initialValue === null) {
|
|
926
|
+
setValue(typeof defaultValue === 'function' ? defaultValue() : defaultValue);
|
|
927
|
+
} else {
|
|
928
|
+
setValue(initialValue);
|
|
929
|
+
}
|
|
930
|
+
}, [defaultValue, key]);
|
|
931
|
+
const setter = React__default["default"].useCallback(updater => {
|
|
932
|
+
setValue(old => {
|
|
933
|
+
let newVal = updater;
|
|
934
|
+
|
|
935
|
+
if (typeof updater == 'function') {
|
|
936
|
+
newVal = updater(old);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
try {
|
|
940
|
+
localStorage.setItem(key, JSON.stringify(newVal));
|
|
941
|
+
} catch (_unused2) {}
|
|
942
|
+
|
|
943
|
+
return newVal;
|
|
944
|
+
});
|
|
945
|
+
}, [key]);
|
|
946
|
+
return [value, setter];
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
const _excluded$3 = ["theme"];
|
|
950
|
+
const defaultTheme = {
|
|
951
|
+
background: '#0b1521',
|
|
952
|
+
backgroundAlt: '#132337',
|
|
953
|
+
foreground: 'white',
|
|
954
|
+
gray: '#3f4e60',
|
|
955
|
+
grayAlt: '#222e3e',
|
|
956
|
+
inputBackgroundColor: '#fff',
|
|
957
|
+
inputTextColor: '#000',
|
|
958
|
+
success: '#00ab52',
|
|
959
|
+
danger: '#ff0085',
|
|
960
|
+
active: '#006bff',
|
|
961
|
+
warning: '#ffb200'
|
|
962
|
+
};
|
|
963
|
+
const ThemeContext = /*#__PURE__*/React__default["default"].createContext(defaultTheme);
|
|
964
|
+
function ThemeProvider(_ref) {
|
|
965
|
+
let {
|
|
966
|
+
theme
|
|
967
|
+
} = _ref,
|
|
968
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
969
|
+
|
|
970
|
+
return /*#__PURE__*/React__default["default"].createElement(ThemeContext.Provider, _extends({
|
|
971
|
+
value: theme
|
|
972
|
+
}, rest));
|
|
973
|
+
}
|
|
974
|
+
function useTheme() {
|
|
975
|
+
return React__default["default"].useContext(ThemeContext);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
function useMediaQuery(query) {
|
|
979
|
+
// Keep track of the preference in state, start with the current match
|
|
980
|
+
const [isMatch, setIsMatch] = React__default["default"].useState(() => {
|
|
981
|
+
if (typeof window !== 'undefined') {
|
|
982
|
+
return window.matchMedia && window.matchMedia(query).matches;
|
|
983
|
+
}
|
|
984
|
+
}); // Watch for changes
|
|
985
|
+
|
|
986
|
+
React__default["default"].useEffect(() => {
|
|
987
|
+
if (typeof window !== 'undefined') {
|
|
988
|
+
if (!window.matchMedia) {
|
|
989
|
+
return;
|
|
990
|
+
} // Create a matcher
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
const matcher = window.matchMedia(query); // Create our handler
|
|
994
|
+
|
|
995
|
+
const onChange = _ref => {
|
|
996
|
+
let {
|
|
997
|
+
matches
|
|
998
|
+
} = _ref;
|
|
999
|
+
return setIsMatch(matches);
|
|
1000
|
+
}; // Listen for changes
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
matcher.addListener(onChange);
|
|
1004
|
+
return () => {
|
|
1005
|
+
// Stop listening for changes
|
|
1006
|
+
matcher.removeListener(onChange);
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
}, [isMatch, query, setIsMatch]);
|
|
1010
|
+
return isMatch;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
const _excluded$2 = ["style"];
|
|
1014
|
+
const isServer$1 = typeof window === 'undefined';
|
|
1015
|
+
function getStatusColor(match, theme) {
|
|
1016
|
+
return match.isPending ? theme.warning : match.isFetching ? theme.active : match.status === 'error' ? theme.danger : match.status === 'success' ? theme.success : theme.gray;
|
|
1017
|
+
} // export function getQueryStatusLabel(query: Query) {
|
|
1018
|
+
// return query.state.isFetching
|
|
1019
|
+
// ? 'fetching'
|
|
1020
|
+
// : !query.getObserversCount()
|
|
1021
|
+
// ? 'inactive'
|
|
1022
|
+
// : query.isStale()
|
|
1023
|
+
// ? 'stale'
|
|
1024
|
+
// : 'fresh'
|
|
1025
|
+
// }
|
|
1026
|
+
|
|
1027
|
+
function styled(type, newStyles, queries) {
|
|
1028
|
+
if (queries === void 0) {
|
|
1029
|
+
queries = {};
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
return /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
1033
|
+
let {
|
|
1034
|
+
style
|
|
1035
|
+
} = _ref,
|
|
1036
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
1037
|
+
|
|
1038
|
+
const theme = useTheme();
|
|
1039
|
+
const mediaStyles = Object.entries(queries).reduce((current, _ref2) => {
|
|
1040
|
+
let [key, value] = _ref2;
|
|
1041
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1042
|
+
return useMediaQuery(key) ? _extends({}, current, typeof value === 'function' ? value(rest, theme) : value) : current;
|
|
1043
|
+
}, {});
|
|
1044
|
+
return /*#__PURE__*/React__default["default"].createElement(type, _extends({}, rest, {
|
|
1045
|
+
style: _extends({}, typeof newStyles === 'function' ? newStyles(rest, theme) : newStyles, style, mediaStyles),
|
|
1046
|
+
ref
|
|
1047
|
+
}));
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
function useIsMounted() {
|
|
1051
|
+
const mountedRef = React__default["default"].useRef(false);
|
|
1052
|
+
const isMounted = React__default["default"].useCallback(() => mountedRef.current, []);
|
|
1053
|
+
React__default["default"][isServer$1 ? 'useEffect' : 'useLayoutEffect'](() => {
|
|
1054
|
+
mountedRef.current = true;
|
|
1055
|
+
return () => {
|
|
1056
|
+
mountedRef.current = false;
|
|
1057
|
+
};
|
|
1058
|
+
}, []);
|
|
1059
|
+
return isMounted;
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Displays a string regardless the type of the data
|
|
1063
|
+
* @param {unknown} value Value to be stringified
|
|
1064
|
+
*/
|
|
1065
|
+
|
|
1066
|
+
const displayValue = value => {
|
|
1067
|
+
const name = Object.getOwnPropertyNames(Object(value));
|
|
1068
|
+
const newValue = typeof value === 'bigint' ? value.toString() + "n" : value;
|
|
1069
|
+
return JSON.stringify(newValue, name);
|
|
1070
|
+
};
|
|
1071
|
+
/**
|
|
1072
|
+
* This hook is a safe useState version which schedules state updates in microtasks
|
|
1073
|
+
* to prevent updating a component state while React is rendering different components
|
|
1074
|
+
* or when the component is not mounted anymore.
|
|
1075
|
+
*/
|
|
1076
|
+
|
|
1077
|
+
function useSafeState(initialState) {
|
|
1078
|
+
const isMounted = useIsMounted();
|
|
1079
|
+
const [state, setState] = React__default["default"].useState(initialState);
|
|
1080
|
+
const safeSetState = React__default["default"].useCallback(value => {
|
|
1081
|
+
scheduleMicrotask(() => {
|
|
1082
|
+
if (isMounted()) {
|
|
1083
|
+
setState(value);
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
}, [isMounted]);
|
|
1087
|
+
return [state, safeSetState];
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Schedules a microtask.
|
|
1091
|
+
* This can be useful to schedule state updates after rendering.
|
|
1092
|
+
*/
|
|
1093
|
+
|
|
1094
|
+
function scheduleMicrotask(callback) {
|
|
1095
|
+
Promise.resolve().then(callback).catch(error => setTimeout(() => {
|
|
1096
|
+
throw error;
|
|
1097
|
+
}));
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
const Panel = styled('div', (_props, theme) => ({
|
|
1101
|
+
fontSize: 'clamp(12px, 1.5vw, 14px)',
|
|
1102
|
+
fontFamily: "sans-serif",
|
|
1103
|
+
display: 'flex',
|
|
1104
|
+
backgroundColor: theme.background,
|
|
1105
|
+
color: theme.foreground
|
|
1106
|
+
}), {
|
|
1107
|
+
'(max-width: 700px)': {
|
|
1108
|
+
flexDirection: 'column'
|
|
1109
|
+
},
|
|
1110
|
+
'(max-width: 600px)': {
|
|
1111
|
+
fontSize: '.9em' // flexDirection: 'column',
|
|
1112
|
+
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1115
|
+
const ActivePanel = styled('div', () => ({
|
|
1116
|
+
flex: '1 1 500px',
|
|
1117
|
+
display: 'flex',
|
|
1118
|
+
flexDirection: 'column',
|
|
1119
|
+
overflow: 'auto',
|
|
1120
|
+
height: '100%'
|
|
1121
|
+
}), {
|
|
1122
|
+
'(max-width: 700px)': (_props, theme) => ({
|
|
1123
|
+
borderTop: "2px solid " + theme.gray
|
|
1124
|
+
})
|
|
1125
|
+
});
|
|
1126
|
+
const Button = styled('button', (props, theme) => ({
|
|
1127
|
+
appearance: 'none',
|
|
1128
|
+
fontSize: '.9em',
|
|
1129
|
+
fontWeight: 'bold',
|
|
1130
|
+
background: theme.gray,
|
|
1131
|
+
border: '0',
|
|
1132
|
+
borderRadius: '.3em',
|
|
1133
|
+
color: 'white',
|
|
1134
|
+
padding: '.5em',
|
|
1135
|
+
opacity: props.disabled ? '.5' : undefined,
|
|
1136
|
+
cursor: 'pointer'
|
|
1137
|
+
})); // export const QueryKeys = styled('span', {
|
|
1138
|
+
// display: 'inline-block',
|
|
1139
|
+
// fontSize: '0.9em',
|
|
1140
|
+
// })
|
|
1141
|
+
// export const QueryKey = styled('span', {
|
|
1142
|
+
// display: 'inline-flex',
|
|
1143
|
+
// alignItems: 'center',
|
|
1144
|
+
// padding: '.2em .4em',
|
|
1145
|
+
// fontWeight: 'bold',
|
|
1146
|
+
// textShadow: '0 0 10px black',
|
|
1147
|
+
// borderRadius: '.2em',
|
|
1148
|
+
// })
|
|
1149
|
+
|
|
1150
|
+
const Code = styled('code', {
|
|
1151
|
+
fontSize: '.9em'
|
|
1152
|
+
});
|
|
1153
|
+
styled('input', (_props, theme) => ({
|
|
1154
|
+
backgroundColor: theme.inputBackgroundColor,
|
|
1155
|
+
border: 0,
|
|
1156
|
+
borderRadius: '.2em',
|
|
1157
|
+
color: theme.inputTextColor,
|
|
1158
|
+
fontSize: '.9em',
|
|
1159
|
+
lineHeight: "1.3",
|
|
1160
|
+
padding: '.3em .4em'
|
|
1161
|
+
}));
|
|
1162
|
+
styled('select', (_props, theme) => ({
|
|
1163
|
+
display: "inline-block",
|
|
1164
|
+
fontSize: ".9em",
|
|
1165
|
+
fontFamily: "sans-serif",
|
|
1166
|
+
fontWeight: 'normal',
|
|
1167
|
+
lineHeight: "1.3",
|
|
1168
|
+
padding: ".3em 1.5em .3em .5em",
|
|
1169
|
+
height: 'auto',
|
|
1170
|
+
border: 0,
|
|
1171
|
+
borderRadius: ".2em",
|
|
1172
|
+
appearance: "none",
|
|
1173
|
+
WebkitAppearance: 'none',
|
|
1174
|
+
backgroundColor: theme.inputBackgroundColor,
|
|
1175
|
+
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>\")",
|
|
1176
|
+
backgroundRepeat: "no-repeat",
|
|
1177
|
+
backgroundPosition: "right .55em center",
|
|
1178
|
+
backgroundSize: ".65em auto, 100%",
|
|
1179
|
+
color: theme.inputTextColor
|
|
1180
|
+
}), {
|
|
1181
|
+
'(max-width: 500px)': {
|
|
1182
|
+
display: 'none'
|
|
1183
|
+
}
|
|
1184
|
+
});
|
|
1185
|
+
|
|
1186
|
+
const _excluded$1 = ["value", "defaultExpanded", "renderer", "pageSize"];
|
|
1187
|
+
const Entry = styled('div', {
|
|
1188
|
+
fontFamily: 'Menlo, monospace',
|
|
1189
|
+
fontSize: '.7rem',
|
|
1190
|
+
lineHeight: '1.7',
|
|
1191
|
+
outline: 'none',
|
|
1192
|
+
wordBreak: 'break-word'
|
|
1193
|
+
});
|
|
1194
|
+
const Label = styled('span', {
|
|
1195
|
+
color: 'white'
|
|
1196
|
+
});
|
|
1197
|
+
const LabelButton = styled('button', {
|
|
1198
|
+
cursor: 'pointer',
|
|
1199
|
+
color: 'white'
|
|
1200
|
+
});
|
|
1201
|
+
const ExpandButton = styled('button', {
|
|
1202
|
+
cursor: 'pointer',
|
|
1203
|
+
color: 'inherit',
|
|
1204
|
+
font: 'inherit',
|
|
1205
|
+
outline: 'inherit',
|
|
1206
|
+
background: 'transparent',
|
|
1207
|
+
border: 'none',
|
|
1208
|
+
padding: 0
|
|
1209
|
+
});
|
|
1210
|
+
const Value = styled('span', (_props, theme) => ({
|
|
1211
|
+
color: theme.danger
|
|
1212
|
+
}));
|
|
1213
|
+
const SubEntries = styled('div', {
|
|
1214
|
+
marginLeft: '.1em',
|
|
1215
|
+
paddingLeft: '1em',
|
|
1216
|
+
borderLeft: '2px solid rgba(0,0,0,.15)'
|
|
1217
|
+
});
|
|
1218
|
+
const Info = styled('span', {
|
|
1219
|
+
color: 'grey',
|
|
1220
|
+
fontSize: '.7em'
|
|
1221
|
+
});
|
|
1222
|
+
const Expander = _ref => {
|
|
1223
|
+
let {
|
|
1224
|
+
expanded,
|
|
1225
|
+
style = {}
|
|
1226
|
+
} = _ref;
|
|
1227
|
+
return /*#__PURE__*/React__namespace.createElement("span", {
|
|
1228
|
+
style: _extends({
|
|
1229
|
+
display: 'inline-block',
|
|
1230
|
+
transition: 'all .1s ease',
|
|
1231
|
+
transform: "rotate(" + (expanded ? 90 : 0) + "deg) " + (style.transform || '')
|
|
1232
|
+
}, style)
|
|
1233
|
+
}, "\u25B6");
|
|
1234
|
+
};
|
|
1235
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* Chunk elements in the array by size
|
|
1238
|
+
*
|
|
1239
|
+
* when the array cannot be chunked evenly by size, the last chunk will be
|
|
1240
|
+
* filled with the remaining elements
|
|
1241
|
+
*
|
|
1242
|
+
* @example
|
|
1243
|
+
* chunkArray(['a','b', 'c', 'd', 'e'], 2) // returns [['a','b'], ['c', 'd'], ['e']]
|
|
1244
|
+
*/
|
|
1245
|
+
function chunkArray(array, size) {
|
|
1246
|
+
if (size < 1) return [];
|
|
1247
|
+
let i = 0;
|
|
1248
|
+
const result = [];
|
|
1249
|
+
|
|
1250
|
+
while (i < array.length) {
|
|
1251
|
+
result.push(array.slice(i, i + size));
|
|
1252
|
+
i = i + size;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
return result;
|
|
1256
|
+
}
|
|
1257
|
+
const DefaultRenderer = _ref2 => {
|
|
1258
|
+
let {
|
|
1259
|
+
HandleEntry,
|
|
1260
|
+
label,
|
|
1261
|
+
value,
|
|
1262
|
+
subEntries = [],
|
|
1263
|
+
subEntryPages = [],
|
|
1264
|
+
type,
|
|
1265
|
+
expanded = false,
|
|
1266
|
+
toggleExpanded,
|
|
1267
|
+
pageSize,
|
|
1268
|
+
renderer
|
|
1269
|
+
} = _ref2;
|
|
1270
|
+
const [expandedPages, setExpandedPages] = React__namespace.useState([]);
|
|
1271
|
+
const [valueSnapshot, setValueSnapshot] = React__namespace.useState(undefined);
|
|
1272
|
+
|
|
1273
|
+
const refreshValueSnapshot = () => {
|
|
1274
|
+
setValueSnapshot(value());
|
|
1275
|
+
};
|
|
1276
|
+
|
|
1277
|
+
return /*#__PURE__*/React__namespace.createElement(Entry, {
|
|
1278
|
+
key: label
|
|
1279
|
+
}, subEntryPages.length ? /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ExpandButton, {
|
|
1280
|
+
onClick: () => toggleExpanded()
|
|
1281
|
+
}, /*#__PURE__*/React__namespace.createElement(Expander, {
|
|
1282
|
+
expanded: expanded
|
|
1283
|
+
}), " ", label, ' ', /*#__PURE__*/React__namespace.createElement(Info, null, String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : '', subEntries.length, " ", subEntries.length > 1 ? "items" : "item")), expanded ? subEntryPages.length === 1 ? /*#__PURE__*/React__namespace.createElement(SubEntries, null, subEntries.map(entry => /*#__PURE__*/React__namespace.createElement(HandleEntry, {
|
|
1284
|
+
key: entry.label,
|
|
1285
|
+
entry: entry
|
|
1286
|
+
}))) : /*#__PURE__*/React__namespace.createElement(SubEntries, null, subEntryPages.map((entries, index) => /*#__PURE__*/React__namespace.createElement("div", {
|
|
1287
|
+
key: index
|
|
1288
|
+
}, /*#__PURE__*/React__namespace.createElement(Entry, null, /*#__PURE__*/React__namespace.createElement(LabelButton, {
|
|
1289
|
+
onClick: () => setExpandedPages(old => old.includes(index) ? old.filter(d => d !== index) : [...old, index])
|
|
1290
|
+
}, /*#__PURE__*/React__namespace.createElement(Expander, {
|
|
1291
|
+
expanded: expanded
|
|
1292
|
+
}), " [", index * pageSize, " ...", ' ', index * pageSize + pageSize - 1, "]"), expandedPages.includes(index) ? /*#__PURE__*/React__namespace.createElement(SubEntries, null, entries.map(entry => /*#__PURE__*/React__namespace.createElement(HandleEntry, {
|
|
1293
|
+
key: entry.label,
|
|
1294
|
+
entry: entry
|
|
1295
|
+
}))) : null)))) : null) : type === 'function' ? /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Explorer, {
|
|
1296
|
+
renderer: renderer,
|
|
1297
|
+
label: /*#__PURE__*/React__namespace.createElement("button", {
|
|
1298
|
+
onClick: refreshValueSnapshot,
|
|
1299
|
+
style: {
|
|
1300
|
+
appearance: 'none',
|
|
1301
|
+
border: '0',
|
|
1302
|
+
background: 'transparent'
|
|
1303
|
+
}
|
|
1304
|
+
}, /*#__PURE__*/React__namespace.createElement(Label, null, label), " \uD83D\uDD04", ' '),
|
|
1305
|
+
value: valueSnapshot,
|
|
1306
|
+
defaultExpanded: {}
|
|
1307
|
+
})) : /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Label, null, label, ":"), " ", /*#__PURE__*/React__namespace.createElement(Value, null, displayValue(value))));
|
|
1308
|
+
};
|
|
1309
|
+
|
|
1310
|
+
function isIterable(x) {
|
|
1311
|
+
return Symbol.iterator in x;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
function Explorer(_ref3) {
|
|
1315
|
+
let {
|
|
1316
|
+
value,
|
|
1317
|
+
defaultExpanded,
|
|
1318
|
+
renderer = DefaultRenderer,
|
|
1319
|
+
pageSize = 100
|
|
1320
|
+
} = _ref3,
|
|
1321
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded$1);
|
|
1322
|
+
|
|
1323
|
+
const [expanded, setExpanded] = React__namespace.useState(Boolean(defaultExpanded));
|
|
1324
|
+
const toggleExpanded = React__namespace.useCallback(() => setExpanded(old => !old), []);
|
|
1325
|
+
let type = typeof value;
|
|
1326
|
+
let subEntries = [];
|
|
1327
|
+
|
|
1328
|
+
const makeProperty = sub => {
|
|
1329
|
+
const subDefaultExpanded = defaultExpanded === true ? {
|
|
1330
|
+
[sub.label]: true
|
|
1331
|
+
} : defaultExpanded == null ? void 0 : defaultExpanded[sub.label];
|
|
1332
|
+
return _extends({}, sub, {
|
|
1333
|
+
defaultExpanded: subDefaultExpanded
|
|
1334
|
+
});
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1337
|
+
if (Array.isArray(value)) {
|
|
1338
|
+
type = 'array';
|
|
1339
|
+
subEntries = value.map((d, i) => makeProperty({
|
|
1340
|
+
label: i.toString(),
|
|
1341
|
+
value: d
|
|
1342
|
+
}));
|
|
1343
|
+
} else if (value !== null && typeof value === 'object' && isIterable(value) && typeof value[Symbol.iterator] === 'function') {
|
|
1344
|
+
type = 'Iterable';
|
|
1345
|
+
subEntries = Array.from(value, (val, i) => makeProperty({
|
|
1346
|
+
label: i.toString(),
|
|
1347
|
+
value: val
|
|
1348
|
+
}));
|
|
1349
|
+
} else if (typeof value === 'object' && value !== null) {
|
|
1350
|
+
type = 'object';
|
|
1351
|
+
subEntries = Object.entries(value).map(_ref4 => {
|
|
1352
|
+
let [key, val] = _ref4;
|
|
1353
|
+
return makeProperty({
|
|
1354
|
+
label: key,
|
|
1355
|
+
value: val
|
|
1356
|
+
});
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
const subEntryPages = chunkArray(subEntries, pageSize);
|
|
1361
|
+
return renderer(_extends({
|
|
1362
|
+
HandleEntry: _ref5 => {
|
|
1363
|
+
let {
|
|
1364
|
+
entry
|
|
1365
|
+
} = _ref5;
|
|
1366
|
+
return /*#__PURE__*/React__namespace.createElement(Explorer, _extends({
|
|
1367
|
+
value: value,
|
|
1368
|
+
renderer: renderer
|
|
1369
|
+
}, rest, entry));
|
|
1370
|
+
},
|
|
1371
|
+
type,
|
|
1372
|
+
subEntries,
|
|
1373
|
+
subEntryPages,
|
|
1374
|
+
value,
|
|
1375
|
+
expanded,
|
|
1376
|
+
toggleExpanded,
|
|
1377
|
+
pageSize
|
|
1378
|
+
}, rest));
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
function Logo(props) {
|
|
1382
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
1383
|
+
width: "40px",
|
|
1384
|
+
height: "40px",
|
|
1385
|
+
viewBox: "0 0 190 190",
|
|
1386
|
+
version: "1.1"
|
|
1387
|
+
}, props), /*#__PURE__*/React__namespace.createElement("g", {
|
|
1388
|
+
stroke: "none",
|
|
1389
|
+
strokeWidth: "1",
|
|
1390
|
+
fill: "none",
|
|
1391
|
+
fillRule: "evenodd"
|
|
1392
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
1393
|
+
id: "og-white",
|
|
1394
|
+
transform: "translate(-28.000000, -21.000000)"
|
|
1395
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
1396
|
+
id: "Group-2",
|
|
1397
|
+
transform: "translate(28.000000, 31.000000)"
|
|
1398
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
1399
|
+
d: "M39.7239712,51.3436237 C36.631224,36.362877 35.9675112,24.8727722 37.9666331,16.5293551 C39.1555965,11.5671678 41.3293088,7.51908462 44.6346064,4.59846305 C48.1241394,1.51504777 52.5360327,0.00201216606 57.493257,0.00201216606 C65.6712013,0.00201216606 74.2682602,3.72732143 83.4557246,10.8044264 C87.2031203,13.6910458 91.0924366,17.170411 95.1316515,21.2444746 C95.4531404,20.8310265 95.8165416,20.4410453 96.2214301,20.0806152 C107.64098,9.91497158 117.255245,3.59892716 125.478408,1.16365068 C130.367899,-0.284364005 134.958526,-0.422317978 139.138936,0.983031021 C143.551631,2.46646844 147.06766,5.53294888 149.548314,9.82810912 C153.642288,16.9166735 154.721918,26.2310983 153.195595,37.7320243 C152.573451,42.4199112 151.50985,47.5263831 150.007094,53.0593153 C150.574045,53.1277086 151.142416,53.2532808 151.705041,53.4395297 C166.193932,58.2358678 176.453582,63.3937462 182.665021,69.2882839 C186.360669,72.7953831 188.773972,76.6998434 189.646365,81.0218204 C190.567176,85.5836746 189.669313,90.1593316 187.191548,94.4512967 C183.105211,101.529614 175.591643,107.11221 164.887587,111.534031 C160.589552,113.309539 155.726579,114.917559 150.293259,116.363748 C150.541176,116.92292 150.733521,117.516759 150.862138,118.139758 C153.954886,133.120505 154.618598,144.61061 152.619477,152.954027 C151.430513,157.916214 149.256801,161.964297 145.951503,164.884919 C142.46197,167.968334 138.050077,169.48137 133.092853,169.48137 C124.914908,169.48137 116.31785,165.756061 107.130385,158.678956 C103.343104,155.761613 99.4108655,152.238839 95.3254337,148.108619 C94.9050753,148.765474 94.3889681,149.376011 93.7785699,149.919385 C82.3590198,160.085028 72.744755,166.401073 64.5215915,168.836349 C59.6321009,170.284364 55.0414736,170.422318 50.8610636,169.016969 C46.4483686,167.533532 42.9323404,164.467051 40.4516862,160.171891 C36.3577116,153.083327 35.2780823,143.768902 36.8044053,132.267976 C37.449038,127.410634 38.56762,122.103898 40.1575891,116.339009 C39.5361041,116.276104 38.9120754,116.144816 38.2949591,115.940529 C23.8060684,111.144191 13.5464184,105.986312 7.33497892,100.091775 C3.63933121,96.5846754 1.22602752,92.6802151 0.353635235,88.3582381 C-0.567176333,83.7963839 0.330686581,79.2207269 2.80845236,74.9287618 C6.89478863,67.8504443 14.4083565,62.2678481 25.1124133,57.8460273 C29.5385143,56.0176154 34.5637208,54.366822 40.1939394,52.8874674 C39.9933393,52.3969171 39.8349374,51.8811235 39.7239712,51.3436237 Z",
|
|
1400
|
+
id: "Path",
|
|
1401
|
+
fill: "#002C4B",
|
|
1402
|
+
fillRule: "nonzero",
|
|
1403
|
+
transform: "translate(95.000000, 85.000000) scale(-1, 1) translate(-95.000000, -85.000000) "
|
|
1404
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
1405
|
+
d: "M76.1109918,91 L89.6216773,114.999606 L80.3968824,115 C78.6058059,115 76.9515387,114.041975 76.0601262,112.488483 L69.9456773,101.831606 L76.1109918,91 Z M118.814677,103.999606 L113.944933,112.488483 C113.053521,114.041975 111.399254,115 109.608177,115 L97.1836773,114.999606 L91,104 L118.814677,103.999606 Z M102.995798,71 L111,84.540954 L103.052984,98 L87.0061086,98 L79,84.3838793 L86.9562003,71 L102.995798,71 Z M124.136677,74.2726062 L128.577138,82.0115174 C129.461464,83.5526583 129.461464,85.4473417 128.577138,86.9884826 L122.257677,97.9996062 L110,98 L124.136677,74.2726062 Z M80,72 L66.1336773,95.1896062 L61.4279211,86.9884826 C60.543596,85.4473417 60.543596,83.5526583 61.4279211,82.0115174 L67.1716773,71.9996062 L80,72 Z M109.608177,54 C111.399254,54 113.053521,54.958025 113.944933,56.5115174 L120.835677,68.5206062 L114.929178,79 L100.820677,53.9996062 L109.608177,54 Z M93.7696773,53.9996062 L100,65 L71.1886773,64.9996062 L76.0601262,56.5115174 C76.9515387,54.958025 78.6058059,54 80.3968824,54 L93.7696773,53.9996062 Z",
|
|
1406
|
+
id: "Polygon-3",
|
|
1407
|
+
fill: "#FFD94C"
|
|
1408
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
1409
|
+
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",
|
|
1410
|
+
id: "Combined-Shape",
|
|
1411
|
+
fill: "#FF4154"
|
|
1412
|
+
})))));
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
const _excluded = ["style"],
|
|
1416
|
+
_excluded2 = ["style", "onClick"],
|
|
1417
|
+
_excluded3 = ["style", "onClick"],
|
|
1418
|
+
_excluded4 = ["isOpen", "setIsOpen", "handleDragStart", "useRouter"],
|
|
1419
|
+
_excluded5 = ["listeners", "buildLocation", "mount", "update", "buildNext", "navigate", "cancelMatches", "loadLocation", "cleanPreloadCache", "loadRoute", "matchRoutes", "loadMatches", "invalidateRoute", "resolvePath", "matchRoute", "buildLink", "__experimental__createSnapshot", "destroy"],
|
|
1420
|
+
_excluded6 = ["cancel", "load", "router", "Link", "MatchRoute", "buildLink", "linkProps", "matchRoute", "navigate"];
|
|
1421
|
+
const isServer = typeof window === 'undefined';
|
|
1422
|
+
function TanStackRouterDevtools(_ref) {
|
|
1423
|
+
let {
|
|
1424
|
+
initialIsOpen,
|
|
1425
|
+
panelProps = {},
|
|
1426
|
+
closeButtonProps = {},
|
|
1427
|
+
toggleButtonProps = {},
|
|
1428
|
+
position = 'bottom-left',
|
|
1429
|
+
containerElement: Container = 'footer',
|
|
1430
|
+
useRouter: useRouterImpl = reactRouter.useRouter
|
|
1431
|
+
} = _ref;
|
|
1432
|
+
const rootRef = React__default["default"].useRef(null);
|
|
1433
|
+
const panelRef = React__default["default"].useRef(null);
|
|
1434
|
+
const [isOpen, setIsOpen] = useLocalStorage('tanstackRouterDevtoolsOpen', initialIsOpen);
|
|
1435
|
+
const [devtoolsHeight, setDevtoolsHeight] = useLocalStorage('tanstackRouterDevtoolsHeight', null);
|
|
1436
|
+
const [isResolvedOpen, setIsResolvedOpen] = useSafeState(false);
|
|
1437
|
+
const [isResizing, setIsResizing] = useSafeState(false);
|
|
1438
|
+
const isMounted = useIsMounted();
|
|
1439
|
+
|
|
1440
|
+
const _handleDragStart = (panelElement, startEvent) => {
|
|
1441
|
+
var _panelElement$getBoun;
|
|
1442
|
+
|
|
1443
|
+
if (startEvent.button !== 0) return; // Only allow left click for drag
|
|
1444
|
+
|
|
1445
|
+
setIsResizing(true);
|
|
1446
|
+
const dragInfo = {
|
|
1447
|
+
originalHeight: (_panelElement$getBoun = panelElement == null ? void 0 : panelElement.getBoundingClientRect().height) != null ? _panelElement$getBoun : 0,
|
|
1448
|
+
pageY: startEvent.pageY
|
|
1449
|
+
};
|
|
1450
|
+
|
|
1451
|
+
const run = moveEvent => {
|
|
1452
|
+
const delta = dragInfo.pageY - moveEvent.pageY;
|
|
1453
|
+
const newHeight = (dragInfo == null ? void 0 : dragInfo.originalHeight) + delta;
|
|
1454
|
+
setDevtoolsHeight(newHeight);
|
|
1455
|
+
|
|
1456
|
+
if (newHeight < 70) {
|
|
1457
|
+
setIsOpen(false);
|
|
1458
|
+
} else {
|
|
1459
|
+
setIsOpen(true);
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
|
|
1463
|
+
const unsub = () => {
|
|
1464
|
+
setIsResizing(false);
|
|
1465
|
+
document.removeEventListener('mousemove', run);
|
|
1466
|
+
document.removeEventListener('mouseUp', unsub);
|
|
1467
|
+
};
|
|
1468
|
+
|
|
1469
|
+
document.addEventListener('mousemove', run);
|
|
1470
|
+
document.addEventListener('mouseup', unsub);
|
|
1471
|
+
};
|
|
1472
|
+
|
|
1473
|
+
React__default["default"].useEffect(() => {
|
|
1474
|
+
setIsResolvedOpen(isOpen != null ? isOpen : false);
|
|
1475
|
+
}, [isOpen, isResolvedOpen, setIsResolvedOpen]); // Toggle panel visibility before/after transition (depending on direction).
|
|
1476
|
+
// Prevents focusing in a closed panel.
|
|
1477
|
+
|
|
1478
|
+
React__default["default"].useEffect(() => {
|
|
1479
|
+
const ref = panelRef.current;
|
|
1480
|
+
|
|
1481
|
+
if (ref) {
|
|
1482
|
+
const handlePanelTransitionStart = () => {
|
|
1483
|
+
if (ref && isResolvedOpen) {
|
|
1484
|
+
ref.style.visibility = 'visible';
|
|
1485
|
+
}
|
|
1486
|
+
};
|
|
1487
|
+
|
|
1488
|
+
const handlePanelTransitionEnd = () => {
|
|
1489
|
+
if (ref && !isResolvedOpen) {
|
|
1490
|
+
ref.style.visibility = 'hidden';
|
|
1491
|
+
}
|
|
1492
|
+
};
|
|
1493
|
+
|
|
1494
|
+
ref.addEventListener('transitionstart', handlePanelTransitionStart);
|
|
1495
|
+
ref.addEventListener('transitionend', handlePanelTransitionEnd);
|
|
1496
|
+
return () => {
|
|
1497
|
+
ref.removeEventListener('transitionstart', handlePanelTransitionStart);
|
|
1498
|
+
ref.removeEventListener('transitionend', handlePanelTransitionEnd);
|
|
1499
|
+
};
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
return;
|
|
1503
|
+
}, [isResolvedOpen]);
|
|
1504
|
+
React__default["default"][isServer ? 'useEffect' : 'useLayoutEffect'](() => {
|
|
1505
|
+
if (isResolvedOpen) {
|
|
1506
|
+
var _rootRef$current, _rootRef$current$pare;
|
|
1507
|
+
|
|
1508
|
+
const previousValue = (_rootRef$current = rootRef.current) == null ? void 0 : (_rootRef$current$pare = _rootRef$current.parentElement) == null ? void 0 : _rootRef$current$pare.style.paddingBottom;
|
|
1509
|
+
|
|
1510
|
+
const run = () => {
|
|
1511
|
+
var _panelRef$current, _rootRef$current2;
|
|
1512
|
+
|
|
1513
|
+
const containerHeight = (_panelRef$current = panelRef.current) == null ? void 0 : _panelRef$current.getBoundingClientRect().height;
|
|
1514
|
+
|
|
1515
|
+
if ((_rootRef$current2 = rootRef.current) != null && _rootRef$current2.parentElement) {
|
|
1516
|
+
rootRef.current.parentElement.style.paddingBottom = containerHeight + "px";
|
|
1517
|
+
}
|
|
1518
|
+
};
|
|
1519
|
+
|
|
1520
|
+
run();
|
|
1521
|
+
|
|
1522
|
+
if (typeof window !== 'undefined') {
|
|
1523
|
+
window.addEventListener('resize', run);
|
|
1524
|
+
return () => {
|
|
1525
|
+
var _rootRef$current3;
|
|
1526
|
+
|
|
1527
|
+
window.removeEventListener('resize', run);
|
|
1528
|
+
|
|
1529
|
+
if ((_rootRef$current3 = rootRef.current) != null && _rootRef$current3.parentElement && typeof previousValue === 'string') {
|
|
1530
|
+
rootRef.current.parentElement.style.paddingBottom = previousValue;
|
|
1531
|
+
}
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
return;
|
|
1537
|
+
}, [isResolvedOpen]);
|
|
1538
|
+
|
|
1539
|
+
const {
|
|
1540
|
+
style: panelStyle = {}
|
|
1541
|
+
} = panelProps,
|
|
1542
|
+
otherPanelProps = _objectWithoutPropertiesLoose(panelProps, _excluded);
|
|
1543
|
+
|
|
1544
|
+
const {
|
|
1545
|
+
style: closeButtonStyle = {},
|
|
1546
|
+
onClick: onCloseClick
|
|
1547
|
+
} = closeButtonProps,
|
|
1548
|
+
otherCloseButtonProps = _objectWithoutPropertiesLoose(closeButtonProps, _excluded2);
|
|
1549
|
+
|
|
1550
|
+
const {
|
|
1551
|
+
style: toggleButtonStyle = {},
|
|
1552
|
+
onClick: onToggleClick
|
|
1553
|
+
} = toggleButtonProps,
|
|
1554
|
+
otherToggleButtonProps = _objectWithoutPropertiesLoose(toggleButtonProps, _excluded3); // Do not render on the server
|
|
1555
|
+
|
|
1556
|
+
|
|
1557
|
+
if (!isMounted()) return null;
|
|
1558
|
+
return /*#__PURE__*/React__default["default"].createElement(Container, {
|
|
1559
|
+
ref: rootRef,
|
|
1560
|
+
className: "TanStackRouterDevtools"
|
|
1561
|
+
}, /*#__PURE__*/React__default["default"].createElement(ThemeProvider, {
|
|
1562
|
+
theme: defaultTheme
|
|
1563
|
+
}, /*#__PURE__*/React__default["default"].createElement(TanStackRouterDevtoolsPanel, _extends({
|
|
1564
|
+
ref: panelRef
|
|
1565
|
+
}, otherPanelProps, {
|
|
1566
|
+
useRouter: useRouterImpl,
|
|
1567
|
+
style: _extends({
|
|
1568
|
+
position: 'fixed',
|
|
1569
|
+
bottom: '0',
|
|
1570
|
+
right: '0',
|
|
1571
|
+
zIndex: 99999,
|
|
1572
|
+
width: '100%',
|
|
1573
|
+
height: devtoolsHeight != null ? devtoolsHeight : 500,
|
|
1574
|
+
maxHeight: '90%',
|
|
1575
|
+
boxShadow: '0 0 20px rgba(0,0,0,.3)',
|
|
1576
|
+
borderTop: "1px solid " + defaultTheme.gray,
|
|
1577
|
+
transformOrigin: 'top',
|
|
1578
|
+
// visibility will be toggled after transitions, but set initial state here
|
|
1579
|
+
visibility: isOpen ? 'visible' : 'hidden'
|
|
1580
|
+
}, panelStyle, isResizing ? {
|
|
1581
|
+
transition: "none"
|
|
1582
|
+
} : {
|
|
1583
|
+
transition: "all .2s ease"
|
|
1584
|
+
}, isResolvedOpen ? {
|
|
1585
|
+
opacity: 1,
|
|
1586
|
+
pointerEvents: 'all',
|
|
1587
|
+
transform: "translateY(0) scale(1)"
|
|
1588
|
+
} : {
|
|
1589
|
+
opacity: 0,
|
|
1590
|
+
pointerEvents: 'none',
|
|
1591
|
+
transform: "translateY(15px) scale(1.02)"
|
|
1592
|
+
}),
|
|
1593
|
+
isOpen: isResolvedOpen,
|
|
1594
|
+
setIsOpen: setIsOpen,
|
|
1595
|
+
handleDragStart: e => _handleDragStart(panelRef.current, e)
|
|
1596
|
+
})), isResolvedOpen ? /*#__PURE__*/React__default["default"].createElement(Button, _extends({
|
|
1597
|
+
type: "button",
|
|
1598
|
+
"aria-label": "Close TanStack Router Devtools"
|
|
1599
|
+
}, otherCloseButtonProps, {
|
|
1600
|
+
onClick: e => {
|
|
1601
|
+
setIsOpen(false);
|
|
1602
|
+
onCloseClick && onCloseClick(e);
|
|
1603
|
+
},
|
|
1604
|
+
style: _extends({
|
|
1605
|
+
position: 'fixed',
|
|
1606
|
+
zIndex: 99999,
|
|
1607
|
+
margin: '.5em',
|
|
1608
|
+
bottom: 0
|
|
1609
|
+
}, position === 'top-right' ? {
|
|
1610
|
+
right: '0'
|
|
1611
|
+
} : position === 'top-left' ? {
|
|
1612
|
+
left: '0'
|
|
1613
|
+
} : position === 'bottom-right' ? {
|
|
1614
|
+
right: '0'
|
|
1615
|
+
} : {
|
|
1616
|
+
left: '0'
|
|
1617
|
+
}, closeButtonStyle)
|
|
1618
|
+
}), "Close") : null), !isResolvedOpen ? /*#__PURE__*/React__default["default"].createElement("button", _extends({
|
|
1619
|
+
type: "button"
|
|
1620
|
+
}, otherToggleButtonProps, {
|
|
1621
|
+
"aria-label": "Open TanStack Router Devtools",
|
|
1622
|
+
onClick: e => {
|
|
1623
|
+
setIsOpen(true);
|
|
1624
|
+
onToggleClick && onToggleClick(e);
|
|
1625
|
+
},
|
|
1626
|
+
style: _extends({
|
|
1627
|
+
appearance: 'none',
|
|
1628
|
+
background: 'none',
|
|
1629
|
+
border: 0,
|
|
1630
|
+
padding: 0,
|
|
1631
|
+
position: 'fixed',
|
|
1632
|
+
zIndex: 99999,
|
|
1633
|
+
display: 'inline-flex',
|
|
1634
|
+
fontSize: '1.5em',
|
|
1635
|
+
margin: '.5em',
|
|
1636
|
+
cursor: 'pointer',
|
|
1637
|
+
width: 'fit-content'
|
|
1638
|
+
}, position === 'top-right' ? {
|
|
1639
|
+
top: '0',
|
|
1640
|
+
right: '0'
|
|
1641
|
+
} : position === 'top-left' ? {
|
|
1642
|
+
top: '0',
|
|
1643
|
+
left: '0'
|
|
1644
|
+
} : position === 'bottom-right' ? {
|
|
1645
|
+
bottom: '0',
|
|
1646
|
+
right: '0'
|
|
1647
|
+
} : {
|
|
1648
|
+
bottom: '0',
|
|
1649
|
+
left: '0'
|
|
1650
|
+
}, toggleButtonStyle)
|
|
1651
|
+
}), /*#__PURE__*/React__default["default"].createElement(Logo, {
|
|
1652
|
+
"aria-hidden": true
|
|
1653
|
+
})) : null);
|
|
1654
|
+
}
|
|
1655
|
+
const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default["default"].forwardRef(function TanStackRouterDevtoolsPanel(props, ref) {
|
|
1656
|
+
var _router$state$matches, _router$state$pending, _last, _last2, _last3, _last4, _last5, _last6;
|
|
1657
|
+
|
|
1658
|
+
const {
|
|
1659
|
+
isOpen = true,
|
|
1660
|
+
handleDragStart,
|
|
1661
|
+
useRouter
|
|
1662
|
+
} = props,
|
|
1663
|
+
panelProps = _objectWithoutPropertiesLoose(props, _excluded4);
|
|
1664
|
+
|
|
1665
|
+
const router = useRouter();
|
|
1666
|
+
React__default["default"].useEffect(() => {
|
|
1667
|
+
let interval = setInterval(() => {
|
|
1668
|
+
router.cleanPreloadCache();
|
|
1669
|
+
router.notify();
|
|
1670
|
+
}, 1000);
|
|
1671
|
+
return () => {
|
|
1672
|
+
clearInterval(interval);
|
|
1673
|
+
};
|
|
1674
|
+
}, []);
|
|
1675
|
+
const [activeRouteId, setActiveRouteId] = useLocalStorage('tanstackRouterDevtoolsActiveRouteId', '');
|
|
1676
|
+
const activeMatch = (_router$state$matches = router.state.matches) == null ? void 0 : _router$state$matches.find(d => d.routeId === activeRouteId);
|
|
1677
|
+
return /*#__PURE__*/React__default["default"].createElement(ThemeProvider, {
|
|
1678
|
+
theme: defaultTheme
|
|
1679
|
+
}, /*#__PURE__*/React__default["default"].createElement(Panel, _extends({
|
|
1680
|
+
ref: ref,
|
|
1681
|
+
className: "TanStackRouterDevtoolsPanel"
|
|
1682
|
+
}, panelProps), /*#__PURE__*/React__default["default"].createElement("style", {
|
|
1683
|
+
dangerouslySetInnerHTML: {
|
|
1684
|
+
__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 "
|
|
1685
|
+
}
|
|
1686
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1687
|
+
style: {
|
|
1688
|
+
position: 'absolute',
|
|
1689
|
+
left: 0,
|
|
1690
|
+
top: 0,
|
|
1691
|
+
width: '100%',
|
|
1692
|
+
height: '4px',
|
|
1693
|
+
marginBottom: '-4px',
|
|
1694
|
+
cursor: 'row-resize',
|
|
1695
|
+
zIndex: 100000
|
|
1696
|
+
},
|
|
1697
|
+
onMouseDown: handleDragStart
|
|
1698
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1699
|
+
style: {
|
|
1700
|
+
flex: '1 1 500px',
|
|
1701
|
+
minHeight: '40%',
|
|
1702
|
+
maxHeight: '100%',
|
|
1703
|
+
overflow: 'auto',
|
|
1704
|
+
borderRight: "1px solid " + defaultTheme.grayAlt,
|
|
1705
|
+
display: 'flex',
|
|
1706
|
+
flexDirection: 'column'
|
|
1707
|
+
}
|
|
1708
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1709
|
+
style: {
|
|
1710
|
+
padding: '.5em',
|
|
1711
|
+
background: defaultTheme.backgroundAlt,
|
|
1712
|
+
display: 'flex',
|
|
1713
|
+
justifyContent: 'space-between',
|
|
1714
|
+
alignItems: 'center'
|
|
1715
|
+
}
|
|
1716
|
+
}, /*#__PURE__*/React__default["default"].createElement(Logo, {
|
|
1717
|
+
"aria-hidden": true,
|
|
1718
|
+
style: {
|
|
1719
|
+
marginRight: '.5em'
|
|
1720
|
+
}
|
|
1721
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1722
|
+
style: {
|
|
1723
|
+
marginRight: 'auto',
|
|
1724
|
+
fontSize: 'clamp(.8rem, 2vw, 1.3rem)',
|
|
1725
|
+
fontWeight: 'bold'
|
|
1726
|
+
}
|
|
1727
|
+
}, "TanStack Router", ' ', /*#__PURE__*/React__default["default"].createElement("span", {
|
|
1728
|
+
style: {
|
|
1729
|
+
fontWeight: 100
|
|
1730
|
+
}
|
|
1731
|
+
}, "Devtools"))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1732
|
+
style: {
|
|
1733
|
+
overflowY: 'auto',
|
|
1734
|
+
flex: '1'
|
|
1735
|
+
}
|
|
1736
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1737
|
+
style: {
|
|
1738
|
+
padding: '.5em'
|
|
1739
|
+
}
|
|
1740
|
+
}, /*#__PURE__*/React__default["default"].createElement(Explorer, {
|
|
1741
|
+
label: "Router",
|
|
1742
|
+
value: (() => {
|
|
1743
|
+
const rest = _objectWithoutPropertiesLoose(router, _excluded5);
|
|
1744
|
+
|
|
1745
|
+
return rest;
|
|
1746
|
+
})(),
|
|
1747
|
+
defaultExpanded: {}
|
|
1748
|
+
})))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1749
|
+
style: {
|
|
1750
|
+
flex: '1 1 500px',
|
|
1751
|
+
minHeight: '40%',
|
|
1752
|
+
maxHeight: '100%',
|
|
1753
|
+
overflow: 'auto',
|
|
1754
|
+
borderRight: "1px solid " + defaultTheme.grayAlt,
|
|
1755
|
+
display: 'flex',
|
|
1756
|
+
flexDirection: 'column'
|
|
1757
|
+
}
|
|
1758
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1759
|
+
style: {
|
|
1760
|
+
padding: '.5em',
|
|
1761
|
+
background: defaultTheme.backgroundAlt,
|
|
1762
|
+
position: 'sticky',
|
|
1763
|
+
top: 0,
|
|
1764
|
+
zIndex: 1
|
|
1765
|
+
}
|
|
1766
|
+
}, "Current Matches"), router.state.matches.map((match, i) => {
|
|
1767
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1768
|
+
key: match.routeId || i,
|
|
1769
|
+
role: "button",
|
|
1770
|
+
"aria-label": "Open match details for " + match.routeId,
|
|
1771
|
+
onClick: () => setActiveRouteId(activeRouteId === match.routeId ? '' : match.routeId),
|
|
1772
|
+
style: {
|
|
1773
|
+
display: 'flex',
|
|
1774
|
+
borderBottom: "solid 1px " + defaultTheme.grayAlt,
|
|
1775
|
+
cursor: 'pointer',
|
|
1776
|
+
alignItems: 'center',
|
|
1777
|
+
background: match === activeMatch ? 'rgba(255,255,255,.1)' : undefined
|
|
1778
|
+
}
|
|
1779
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1780
|
+
style: {
|
|
1781
|
+
flex: '0 0 auto',
|
|
1782
|
+
width: '1.3rem',
|
|
1783
|
+
height: '1.3rem',
|
|
1784
|
+
marginLeft: '.25rem',
|
|
1785
|
+
background: getStatusColor(match, defaultTheme),
|
|
1786
|
+
alignItems: 'center',
|
|
1787
|
+
justifyContent: 'center',
|
|
1788
|
+
fontWeight: 'bold',
|
|
1789
|
+
borderRadius: '.25rem',
|
|
1790
|
+
transition: 'all .2s ease-out'
|
|
1791
|
+
}
|
|
1792
|
+
}), /*#__PURE__*/React__default["default"].createElement(Code, {
|
|
1793
|
+
style: {
|
|
1794
|
+
padding: '.5em'
|
|
1795
|
+
}
|
|
1796
|
+
}, "" + match.matchId));
|
|
1797
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1798
|
+
style: {
|
|
1799
|
+
marginTop: '2rem',
|
|
1800
|
+
padding: '.5em',
|
|
1801
|
+
background: defaultTheme.backgroundAlt,
|
|
1802
|
+
position: 'sticky',
|
|
1803
|
+
top: 0,
|
|
1804
|
+
zIndex: 1
|
|
1805
|
+
}
|
|
1806
|
+
}, "Pending Matches"), (_router$state$pending = router.state.pending) == null ? void 0 : _router$state$pending.matches.map((match, i) => {
|
|
1807
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1808
|
+
key: match.routeId || i,
|
|
1809
|
+
role: "button",
|
|
1810
|
+
"aria-label": "Open match details for " + match.routeId,
|
|
1811
|
+
onClick: () => setActiveRouteId(activeRouteId === match.routeId ? '' : match.routeId),
|
|
1812
|
+
style: {
|
|
1813
|
+
display: 'flex',
|
|
1814
|
+
borderBottom: "solid 1px " + defaultTheme.grayAlt,
|
|
1815
|
+
cursor: 'pointer',
|
|
1816
|
+
background: match === activeMatch ? 'rgba(255,255,255,.1)' : undefined
|
|
1817
|
+
}
|
|
1818
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1819
|
+
style: {
|
|
1820
|
+
flex: '0 0 auto',
|
|
1821
|
+
width: '1.3rem',
|
|
1822
|
+
height: '1.3rem',
|
|
1823
|
+
marginLeft: '.25rem',
|
|
1824
|
+
background: getStatusColor(match, defaultTheme),
|
|
1825
|
+
alignItems: 'center',
|
|
1826
|
+
justifyContent: 'center',
|
|
1827
|
+
fontWeight: 'bold',
|
|
1828
|
+
borderRadius: '.25rem',
|
|
1829
|
+
transition: 'all .2s ease-out'
|
|
1830
|
+
}
|
|
1831
|
+
}), /*#__PURE__*/React__default["default"].createElement(Code, {
|
|
1832
|
+
style: {
|
|
1833
|
+
padding: '.5em'
|
|
1834
|
+
}
|
|
1835
|
+
}, "" + match.matchId));
|
|
1836
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1837
|
+
style: {
|
|
1838
|
+
marginTop: '2rem',
|
|
1839
|
+
padding: '.5em',
|
|
1840
|
+
background: defaultTheme.backgroundAlt,
|
|
1841
|
+
position: 'sticky',
|
|
1842
|
+
top: 0,
|
|
1843
|
+
zIndex: 1
|
|
1844
|
+
}
|
|
1845
|
+
}, "Preloading Matches"), Object.keys(router.preloadCache).filter(key => {
|
|
1846
|
+
var _cacheEntry$match$upd;
|
|
1847
|
+
|
|
1848
|
+
const cacheEntry = router.preloadCache[key];
|
|
1849
|
+
return ((_cacheEntry$match$upd = cacheEntry.match.updatedAt) != null ? _cacheEntry$match$upd : Date.now()) + cacheEntry.maxAge > Date.now();
|
|
1850
|
+
}).map((key, i) => {
|
|
1851
|
+
var _match$updatedAt;
|
|
1852
|
+
|
|
1853
|
+
const {
|
|
1854
|
+
match,
|
|
1855
|
+
maxAge
|
|
1856
|
+
} = router.preloadCache[key];
|
|
1857
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1858
|
+
key: match.matchId || i,
|
|
1859
|
+
role: "button",
|
|
1860
|
+
"aria-label": "Open match details for " + match.matchId,
|
|
1861
|
+
onClick: () => setActiveRouteId(activeRouteId === match.routeId ? '' : match.routeId),
|
|
1862
|
+
style: {
|
|
1863
|
+
display: 'flex',
|
|
1864
|
+
borderBottom: "solid 1px " + defaultTheme.grayAlt,
|
|
1865
|
+
cursor: 'pointer',
|
|
1866
|
+
background: match === activeMatch ? 'rgba(255,255,255,.1)' : undefined
|
|
1867
|
+
}
|
|
1868
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1869
|
+
style: {
|
|
1870
|
+
display: 'flex',
|
|
1871
|
+
flexDirection: 'column',
|
|
1872
|
+
padding: '.5rem',
|
|
1873
|
+
gap: '.3rem'
|
|
1874
|
+
}
|
|
1875
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1876
|
+
style: {
|
|
1877
|
+
display: 'flex',
|
|
1878
|
+
alignItems: 'center',
|
|
1879
|
+
gap: '.5rem'
|
|
1880
|
+
}
|
|
1881
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1882
|
+
style: {
|
|
1883
|
+
flex: '0 0 auto',
|
|
1884
|
+
width: '1.3rem',
|
|
1885
|
+
height: '1.3rem',
|
|
1886
|
+
background: getStatusColor(match, defaultTheme),
|
|
1887
|
+
alignItems: 'center',
|
|
1888
|
+
justifyContent: 'center',
|
|
1889
|
+
fontWeight: 'bold',
|
|
1890
|
+
borderRadius: '.25rem',
|
|
1891
|
+
transition: 'all .2s ease-out'
|
|
1892
|
+
}
|
|
1893
|
+
}), /*#__PURE__*/React__default["default"].createElement(Code, null, "" + match.matchId)), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
1894
|
+
style: {
|
|
1895
|
+
opacity: '.5'
|
|
1896
|
+
}
|
|
1897
|
+
}, "Expires", ' ', formatDistanceStrict(new Date(), new Date(((_match$updatedAt = match.updatedAt) != null ? _match$updatedAt : Date.now()) + maxAge), {
|
|
1898
|
+
addSuffix: true
|
|
1899
|
+
}))));
|
|
1900
|
+
})), activeMatch ? /*#__PURE__*/React__default["default"].createElement(ActivePanel, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1901
|
+
style: {
|
|
1902
|
+
padding: '.5em',
|
|
1903
|
+
background: defaultTheme.backgroundAlt,
|
|
1904
|
+
position: 'sticky',
|
|
1905
|
+
top: 0,
|
|
1906
|
+
zIndex: 1
|
|
1907
|
+
}
|
|
1908
|
+
}, "Match Details"), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("table", null, /*#__PURE__*/React__default["default"].createElement("tbody", null, /*#__PURE__*/React__default["default"].createElement("tr", null, /*#__PURE__*/React__default["default"].createElement("td", {
|
|
1909
|
+
style: {
|
|
1910
|
+
opacity: '.5'
|
|
1911
|
+
}
|
|
1912
|
+
}, "ID"), /*#__PURE__*/React__default["default"].createElement("td", null, /*#__PURE__*/React__default["default"].createElement(Code, {
|
|
1913
|
+
style: {
|
|
1914
|
+
lineHeight: '1.8em'
|
|
1915
|
+
}
|
|
1916
|
+
}, JSON.stringify(activeMatch.matchId, null, 2)))), /*#__PURE__*/React__default["default"].createElement("tr", null, /*#__PURE__*/React__default["default"].createElement("td", {
|
|
1917
|
+
style: {
|
|
1918
|
+
opacity: '.5'
|
|
1919
|
+
}
|
|
1920
|
+
}, "Status"), /*#__PURE__*/React__default["default"].createElement("td", null, activeMatch.status)), /*#__PURE__*/React__default["default"].createElement("tr", null, /*#__PURE__*/React__default["default"].createElement("td", {
|
|
1921
|
+
style: {
|
|
1922
|
+
opacity: '.5'
|
|
1923
|
+
}
|
|
1924
|
+
}, "Pending"), /*#__PURE__*/React__default["default"].createElement("td", null, activeMatch.isPending.toString())), /*#__PURE__*/React__default["default"].createElement("tr", null, /*#__PURE__*/React__default["default"].createElement("td", {
|
|
1925
|
+
style: {
|
|
1926
|
+
opacity: '.5'
|
|
1927
|
+
}
|
|
1928
|
+
}, "Invalid"), /*#__PURE__*/React__default["default"].createElement("td", null, activeMatch.isInvalid.toString())), /*#__PURE__*/React__default["default"].createElement("tr", null, /*#__PURE__*/React__default["default"].createElement("td", {
|
|
1929
|
+
style: {
|
|
1930
|
+
opacity: '.5'
|
|
1931
|
+
}
|
|
1932
|
+
}, "Last Updated"), /*#__PURE__*/React__default["default"].createElement("td", null, activeMatch.updatedAt ? new Date(activeMatch.updatedAt).toLocaleTimeString() : 'N/A'))))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1933
|
+
style: {
|
|
1934
|
+
background: defaultTheme.backgroundAlt,
|
|
1935
|
+
padding: '.5em',
|
|
1936
|
+
position: 'sticky',
|
|
1937
|
+
top: 0,
|
|
1938
|
+
zIndex: 1
|
|
1939
|
+
}
|
|
1940
|
+
}, "Actions"), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1941
|
+
style: {
|
|
1942
|
+
padding: '0.5em'
|
|
1943
|
+
}
|
|
1944
|
+
}, /*#__PURE__*/React__default["default"].createElement(Button, {
|
|
1945
|
+
type: "button",
|
|
1946
|
+
onClick: () => {
|
|
1947
|
+
router.invalidateRoute(activeMatch);
|
|
1948
|
+
router.notify();
|
|
1949
|
+
},
|
|
1950
|
+
style: {
|
|
1951
|
+
background: defaultTheme.warning,
|
|
1952
|
+
color: defaultTheme.inputTextColor
|
|
1953
|
+
}
|
|
1954
|
+
}, "Invalidate"), ' ', /*#__PURE__*/React__default["default"].createElement(Button, {
|
|
1955
|
+
type: "button",
|
|
1956
|
+
onClick: () => router.reload(),
|
|
1957
|
+
style: {
|
|
1958
|
+
background: defaultTheme.gray
|
|
1959
|
+
}
|
|
1960
|
+
}, "Reload")), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1961
|
+
style: {
|
|
1962
|
+
background: defaultTheme.backgroundAlt,
|
|
1963
|
+
padding: '.5em',
|
|
1964
|
+
position: 'sticky',
|
|
1965
|
+
top: 0,
|
|
1966
|
+
zIndex: 1
|
|
1967
|
+
}
|
|
1968
|
+
}, "Explorer"), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1969
|
+
style: {
|
|
1970
|
+
padding: '.5em'
|
|
1971
|
+
}
|
|
1972
|
+
}, /*#__PURE__*/React__default["default"].createElement(Explorer, {
|
|
1973
|
+
label: "Match",
|
|
1974
|
+
value: (() => {
|
|
1975
|
+
const rest = _objectWithoutPropertiesLoose(activeMatch, _excluded6);
|
|
1976
|
+
|
|
1977
|
+
return rest;
|
|
1978
|
+
})(),
|
|
1979
|
+
defaultExpanded: {}
|
|
1980
|
+
}))) : null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1981
|
+
style: {
|
|
1982
|
+
flex: '1 1 500px',
|
|
1983
|
+
minHeight: '40%',
|
|
1984
|
+
maxHeight: '100%',
|
|
1985
|
+
overflow: 'auto',
|
|
1986
|
+
borderRight: "1px solid " + defaultTheme.grayAlt,
|
|
1987
|
+
display: 'flex',
|
|
1988
|
+
flexDirection: 'column'
|
|
1989
|
+
}
|
|
1990
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1991
|
+
style: {
|
|
1992
|
+
padding: '.5em',
|
|
1993
|
+
background: defaultTheme.backgroundAlt,
|
|
1994
|
+
position: 'sticky',
|
|
1995
|
+
top: 0,
|
|
1996
|
+
zIndex: 1
|
|
1997
|
+
}
|
|
1998
|
+
}, "Loader Data"), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1999
|
+
style: {
|
|
2000
|
+
padding: '.5em'
|
|
2001
|
+
}
|
|
2002
|
+
}, Object.keys(((_last = reactRouter.last(router.state.matches)) == null ? void 0 : _last.loaderData) || {}).length ? /*#__PURE__*/React__default["default"].createElement(Explorer, {
|
|
2003
|
+
value: ((_last2 = reactRouter.last(router.state.matches)) == null ? void 0 : _last2.loaderData) || {},
|
|
2004
|
+
defaultExpanded: Object.keys(((_last3 = reactRouter.last(router.state.matches)) == null ? void 0 : _last3.loaderData) || {}).reduce((obj, next) => {
|
|
2005
|
+
obj[next] = {};
|
|
2006
|
+
return obj;
|
|
2007
|
+
}, {})
|
|
2008
|
+
}) : /*#__PURE__*/React__default["default"].createElement("em", {
|
|
2009
|
+
style: {
|
|
2010
|
+
opacity: 0.5
|
|
2011
|
+
}
|
|
2012
|
+
}, '{ }')), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2013
|
+
style: {
|
|
2014
|
+
padding: '.5em',
|
|
2015
|
+
background: defaultTheme.backgroundAlt,
|
|
2016
|
+
position: 'sticky',
|
|
2017
|
+
top: 0,
|
|
2018
|
+
zIndex: 1
|
|
2019
|
+
}
|
|
2020
|
+
}, "Search Params"), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2021
|
+
style: {
|
|
2022
|
+
padding: '.5em'
|
|
2023
|
+
}
|
|
2024
|
+
}, Object.keys(((_last4 = reactRouter.last(router.state.matches)) == null ? void 0 : _last4.search) || {}).length ? /*#__PURE__*/React__default["default"].createElement(Explorer, {
|
|
2025
|
+
value: ((_last5 = reactRouter.last(router.state.matches)) == null ? void 0 : _last5.search) || {},
|
|
2026
|
+
defaultExpanded: Object.keys(((_last6 = reactRouter.last(router.state.matches)) == null ? void 0 : _last6.search) || {}).reduce((obj, next) => {
|
|
2027
|
+
obj[next] = {};
|
|
2028
|
+
return obj;
|
|
2029
|
+
}, {})
|
|
2030
|
+
}) : /*#__PURE__*/React__default["default"].createElement("em", {
|
|
2031
|
+
style: {
|
|
2032
|
+
opacity: 0.5
|
|
2033
|
+
}
|
|
2034
|
+
}, '{ }')))));
|
|
2035
|
+
});
|
|
2036
|
+
|
|
2037
|
+
exports.TanStackRouterDevtools = TanStackRouterDevtools;
|
|
2038
|
+
exports.TanStackRouterDevtoolsPanel = TanStackRouterDevtoolsPanel;
|
|
2039
|
+
|
|
2040
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2041
|
+
|
|
2042
|
+
}));
|
|
2043
|
+
//# sourceMappingURL=index.development.js.map
|