@tanstack/react-router-devtools 0.0.1-beta.2 → 0.0.1-beta.29
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/build/cjs/{packages/react-router-devtools/src/Explorer.js → Explorer.js} +7 -18
- package/build/cjs/Explorer.js.map +1 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -5
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/build/cjs/{packages/react-router-devtools/src/devtools.js → devtools.js} +46 -66
- package/build/cjs/devtools.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/index.js → index.js} +0 -0
- package/build/cjs/{packages/react-router-devtools/src/index.js.map → index.js.map} +0 -0
- package/build/cjs/{packages/react-router-devtools/src/styledComponents.js → styledComponents.js} +7 -3
- package/build/cjs/styledComponents.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/theme.js → theme.js} +4 -5
- package/build/cjs/theme.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/useLocalStorage.js → useLocalStorage.js} +0 -7
- package/build/cjs/useLocalStorage.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/useMediaQuery.js → useMediaQuery.js} +8 -8
- package/build/cjs/useMediaQuery.js.map +1 -0
- package/build/cjs/{packages/react-router-devtools/src/utils.js → utils.js} +11 -19
- package/build/cjs/utils.js.map +1 -0
- package/build/esm/index.js +79 -960
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +59 -49
- package/build/stats-react.json +3009 -3003
- package/build/types/index.d.ts +3 -3
- package/build/umd/index.development.js +85 -132
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +4 -3
- package/src/devtools.tsx +28 -13
- package/src/utils.ts +1 -3
- package/build/cjs/node_modules/date-fns/esm/_lib/assign/index.js +0 -30
- package/build/cjs/node_modules/date-fns/esm/_lib/assign/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/_lib/cloneObject/index.js +0 -22
- package/build/cjs/node_modules/date-fns/esm/_lib/cloneObject/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/_lib/defaultLocale/index.js +0 -20
- package/build/cjs/node_modules/date-fns/esm/_lib/defaultLocale/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/_lib/defaultOptions/index.js +0 -21
- package/build/cjs/node_modules/date-fns/esm/_lib/defaultOptions/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js +0 -33
- package/build/cjs/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/_lib/requiredArgs/index.js +0 -22
- package/build/cjs/node_modules/date-fns/esm/_lib/requiredArgs/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/compareAsc/index.js +0 -67
- package/build/cjs/node_modules/date-fns/esm/compareAsc/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/formatDistanceStrict/index.js +0 -207
- package/build/cjs/node_modules/date-fns/esm/formatDistanceStrict/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js +0 -26
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js +0 -39
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js +0 -65
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js +0 -34
- package/build/cjs/node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js +0 -105
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js +0 -52
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js +0 -31
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js +0 -164
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/match/index.js +0 -116
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/_lib/match/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/index.js +0 -47
- package/build/cjs/node_modules/date-fns/esm/locale/en-US/index.js.map +0 -1
- package/build/cjs/node_modules/date-fns/esm/toDate/index.js +0 -70
- package/build/cjs/node_modules/date-fns/esm/toDate/index.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/Explorer.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/devtools.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/styledComponents.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/theme.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/useLocalStorage.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/useMediaQuery.js.map +0 -1
- package/build/cjs/packages/react-router-devtools/src/utils.js.map +0 -1
package/build/esm/index.js
CHANGED
|
@@ -10,893 +10,51 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import React__default from 'react';
|
|
13
|
-
import { last } from '@tanstack/react-router';
|
|
13
|
+
import { routerContext, invariant, last } from '@tanstack/react-router';
|
|
14
|
+
import { formatDistanceStrict } from 'date-fns';
|
|
14
15
|
|
|
15
16
|
function _extends() {
|
|
16
17
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
17
18
|
for (var i = 1; i < arguments.length; i++) {
|
|
18
19
|
var source = arguments[i];
|
|
19
|
-
|
|
20
20
|
for (var key in source) {
|
|
21
21
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
22
22
|
target[key] = source[key];
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
|
|
27
26
|
return target;
|
|
28
27
|
};
|
|
29
28
|
return _extends.apply(this, arguments);
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
33
31
|
if (source == null) return {};
|
|
34
32
|
var target = {};
|
|
35
33
|
var sourceKeys = Object.keys(source);
|
|
36
34
|
var key, i;
|
|
37
|
-
|
|
38
35
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
39
36
|
key = sourceKeys[i];
|
|
40
37
|
if (excluded.indexOf(key) >= 0) continue;
|
|
41
38
|
target[key] = source[key];
|
|
42
39
|
}
|
|
43
|
-
|
|
44
|
-
return target;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function requiredArgs(required, args) {
|
|
48
|
-
if (args.length < required) {
|
|
49
|
-
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* @name toDate
|
|
55
|
-
* @category Common Helpers
|
|
56
|
-
* @summary Convert the given argument to an instance of Date.
|
|
57
|
-
*
|
|
58
|
-
* @description
|
|
59
|
-
* Convert the given argument to an instance of Date.
|
|
60
|
-
*
|
|
61
|
-
* If the argument is an instance of Date, the function returns its clone.
|
|
62
|
-
*
|
|
63
|
-
* If the argument is a number, it is treated as a timestamp.
|
|
64
|
-
*
|
|
65
|
-
* If the argument is none of the above, the function returns Invalid Date.
|
|
66
|
-
*
|
|
67
|
-
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
68
|
-
*
|
|
69
|
-
* @param {Date|Number} argument - the value to convert
|
|
70
|
-
* @returns {Date} the parsed date in the local time zone
|
|
71
|
-
* @throws {TypeError} 1 argument required
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* // Clone the date:
|
|
75
|
-
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
|
76
|
-
* //=> Tue Feb 11 2014 11:30:30
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* // Convert the timestamp to date:
|
|
80
|
-
* const result = toDate(1392098430000)
|
|
81
|
-
* //=> Tue Feb 11 2014 11:30:30
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
function toDate(argument) {
|
|
85
|
-
requiredArgs(1, arguments);
|
|
86
|
-
var argStr = Object.prototype.toString.call(argument); // Clone the date
|
|
87
|
-
|
|
88
|
-
if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
|
|
89
|
-
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
|
90
|
-
return new Date(argument.getTime());
|
|
91
|
-
} else if (typeof argument === 'number' || argStr === '[object Number]') {
|
|
92
|
-
return new Date(argument);
|
|
93
|
-
} else {
|
|
94
|
-
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
|
|
95
|
-
// eslint-disable-next-line no-console
|
|
96
|
-
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); // eslint-disable-next-line no-console
|
|
97
|
-
|
|
98
|
-
console.warn(new Error().stack);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return new Date(NaN);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
var defaultOptions = {};
|
|
106
|
-
function getDefaultOptions() {
|
|
107
|
-
return defaultOptions;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
112
|
-
* They usually appear for dates that denote time before the timezones were introduced
|
|
113
|
-
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
114
|
-
* and GMT+01:00:00 after that date)
|
|
115
|
-
*
|
|
116
|
-
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
117
|
-
* which would lead to incorrect calculations.
|
|
118
|
-
*
|
|
119
|
-
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
120
|
-
*/
|
|
121
|
-
function getTimezoneOffsetInMilliseconds(date) {
|
|
122
|
-
var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
|
|
123
|
-
utcDate.setUTCFullYear(date.getFullYear());
|
|
124
|
-
return date.getTime() - utcDate.getTime();
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @name compareAsc
|
|
129
|
-
* @category Common Helpers
|
|
130
|
-
* @summary Compare the two dates and return -1, 0 or 1.
|
|
131
|
-
*
|
|
132
|
-
* @description
|
|
133
|
-
* Compare the two dates and return 1 if the first date is after the second,
|
|
134
|
-
* -1 if the first date is before the second or 0 if dates are equal.
|
|
135
|
-
*
|
|
136
|
-
* @param {Date|Number} dateLeft - the first date to compare
|
|
137
|
-
* @param {Date|Number} dateRight - the second date to compare
|
|
138
|
-
* @returns {Number} the result of the comparison
|
|
139
|
-
* @throws {TypeError} 2 arguments required
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* // Compare 11 February 1987 and 10 July 1989:
|
|
143
|
-
* const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
|
|
144
|
-
* //=> -1
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* // Sort the array of dates:
|
|
148
|
-
* const result = [
|
|
149
|
-
* new Date(1995, 6, 2),
|
|
150
|
-
* new Date(1987, 1, 11),
|
|
151
|
-
* new Date(1989, 6, 10)
|
|
152
|
-
* ].sort(compareAsc)
|
|
153
|
-
* //=> [
|
|
154
|
-
* // Wed Feb 11 1987 00:00:00,
|
|
155
|
-
* // Mon Jul 10 1989 00:00:00,
|
|
156
|
-
* // Sun Jul 02 1995 00:00:00
|
|
157
|
-
* // ]
|
|
158
|
-
*/
|
|
159
|
-
|
|
160
|
-
function compareAsc(dirtyDateLeft, dirtyDateRight) {
|
|
161
|
-
requiredArgs(2, arguments);
|
|
162
|
-
var dateLeft = toDate(dirtyDateLeft);
|
|
163
|
-
var dateRight = toDate(dirtyDateRight);
|
|
164
|
-
var diff = dateLeft.getTime() - dateRight.getTime();
|
|
165
|
-
|
|
166
|
-
if (diff < 0) {
|
|
167
|
-
return -1;
|
|
168
|
-
} else if (diff > 0) {
|
|
169
|
-
return 1; // Return 0 if diff is 0; return NaN if diff is NaN
|
|
170
|
-
} else {
|
|
171
|
-
return diff;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
var formatDistanceLocale = {
|
|
176
|
-
lessThanXSeconds: {
|
|
177
|
-
one: 'less than a second',
|
|
178
|
-
other: 'less than {{count}} seconds'
|
|
179
|
-
},
|
|
180
|
-
xSeconds: {
|
|
181
|
-
one: '1 second',
|
|
182
|
-
other: '{{count}} seconds'
|
|
183
|
-
},
|
|
184
|
-
halfAMinute: 'half a minute',
|
|
185
|
-
lessThanXMinutes: {
|
|
186
|
-
one: 'less than a minute',
|
|
187
|
-
other: 'less than {{count}} minutes'
|
|
188
|
-
},
|
|
189
|
-
xMinutes: {
|
|
190
|
-
one: '1 minute',
|
|
191
|
-
other: '{{count}} minutes'
|
|
192
|
-
},
|
|
193
|
-
aboutXHours: {
|
|
194
|
-
one: 'about 1 hour',
|
|
195
|
-
other: 'about {{count}} hours'
|
|
196
|
-
},
|
|
197
|
-
xHours: {
|
|
198
|
-
one: '1 hour',
|
|
199
|
-
other: '{{count}} hours'
|
|
200
|
-
},
|
|
201
|
-
xDays: {
|
|
202
|
-
one: '1 day',
|
|
203
|
-
other: '{{count}} days'
|
|
204
|
-
},
|
|
205
|
-
aboutXWeeks: {
|
|
206
|
-
one: 'about 1 week',
|
|
207
|
-
other: 'about {{count}} weeks'
|
|
208
|
-
},
|
|
209
|
-
xWeeks: {
|
|
210
|
-
one: '1 week',
|
|
211
|
-
other: '{{count}} weeks'
|
|
212
|
-
},
|
|
213
|
-
aboutXMonths: {
|
|
214
|
-
one: 'about 1 month',
|
|
215
|
-
other: 'about {{count}} months'
|
|
216
|
-
},
|
|
217
|
-
xMonths: {
|
|
218
|
-
one: '1 month',
|
|
219
|
-
other: '{{count}} months'
|
|
220
|
-
},
|
|
221
|
-
aboutXYears: {
|
|
222
|
-
one: 'about 1 year',
|
|
223
|
-
other: 'about {{count}} years'
|
|
224
|
-
},
|
|
225
|
-
xYears: {
|
|
226
|
-
one: '1 year',
|
|
227
|
-
other: '{{count}} years'
|
|
228
|
-
},
|
|
229
|
-
overXYears: {
|
|
230
|
-
one: 'over 1 year',
|
|
231
|
-
other: 'over {{count}} years'
|
|
232
|
-
},
|
|
233
|
-
almostXYears: {
|
|
234
|
-
one: 'almost 1 year',
|
|
235
|
-
other: 'almost {{count}} years'
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
var formatDistance = function (token, count, options) {
|
|
240
|
-
var result;
|
|
241
|
-
var tokenValue = formatDistanceLocale[token];
|
|
242
|
-
|
|
243
|
-
if (typeof tokenValue === 'string') {
|
|
244
|
-
result = tokenValue;
|
|
245
|
-
} else if (count === 1) {
|
|
246
|
-
result = tokenValue.one;
|
|
247
|
-
} else {
|
|
248
|
-
result = tokenValue.other.replace('{{count}}', count.toString());
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (options !== null && options !== void 0 && options.addSuffix) {
|
|
252
|
-
if (options.comparison && options.comparison > 0) {
|
|
253
|
-
return 'in ' + result;
|
|
254
|
-
} else {
|
|
255
|
-
return result + ' ago';
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return result;
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
var formatDistance$1 = formatDistance;
|
|
263
|
-
|
|
264
|
-
function buildFormatLongFn(args) {
|
|
265
|
-
return function () {
|
|
266
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
267
|
-
// TODO: Remove String()
|
|
268
|
-
var width = options.width ? String(options.width) : args.defaultWidth;
|
|
269
|
-
var format = args.formats[width] || args.formats[args.defaultWidth];
|
|
270
|
-
return format;
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
var dateFormats = {
|
|
275
|
-
full: 'EEEE, MMMM do, y',
|
|
276
|
-
long: 'MMMM do, y',
|
|
277
|
-
medium: 'MMM d, y',
|
|
278
|
-
short: 'MM/dd/yyyy'
|
|
279
|
-
};
|
|
280
|
-
var timeFormats = {
|
|
281
|
-
full: 'h:mm:ss a zzzz',
|
|
282
|
-
long: 'h:mm:ss a z',
|
|
283
|
-
medium: 'h:mm:ss a',
|
|
284
|
-
short: 'h:mm a'
|
|
285
|
-
};
|
|
286
|
-
var dateTimeFormats = {
|
|
287
|
-
full: "{{date}} 'at' {{time}}",
|
|
288
|
-
long: "{{date}} 'at' {{time}}",
|
|
289
|
-
medium: '{{date}}, {{time}}',
|
|
290
|
-
short: '{{date}}, {{time}}'
|
|
291
|
-
};
|
|
292
|
-
var formatLong = {
|
|
293
|
-
date: buildFormatLongFn({
|
|
294
|
-
formats: dateFormats,
|
|
295
|
-
defaultWidth: 'full'
|
|
296
|
-
}),
|
|
297
|
-
time: buildFormatLongFn({
|
|
298
|
-
formats: timeFormats,
|
|
299
|
-
defaultWidth: 'full'
|
|
300
|
-
}),
|
|
301
|
-
dateTime: buildFormatLongFn({
|
|
302
|
-
formats: dateTimeFormats,
|
|
303
|
-
defaultWidth: 'full'
|
|
304
|
-
})
|
|
305
|
-
};
|
|
306
|
-
var formatLong$1 = formatLong;
|
|
307
|
-
|
|
308
|
-
var formatRelativeLocale = {
|
|
309
|
-
lastWeek: "'last' eeee 'at' p",
|
|
310
|
-
yesterday: "'yesterday at' p",
|
|
311
|
-
today: "'today at' p",
|
|
312
|
-
tomorrow: "'tomorrow at' p",
|
|
313
|
-
nextWeek: "eeee 'at' p",
|
|
314
|
-
other: 'P'
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
var formatRelative = function (token, _date, _baseDate, _options) {
|
|
318
|
-
return formatRelativeLocale[token];
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
var formatRelative$1 = formatRelative;
|
|
322
|
-
|
|
323
|
-
function buildLocalizeFn(args) {
|
|
324
|
-
return function (dirtyIndex, options) {
|
|
325
|
-
var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
|
|
326
|
-
var valuesArray;
|
|
327
|
-
|
|
328
|
-
if (context === 'formatting' && args.formattingValues) {
|
|
329
|
-
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
330
|
-
var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
|
|
331
|
-
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
332
|
-
} else {
|
|
333
|
-
var _defaultWidth = args.defaultWidth;
|
|
334
|
-
|
|
335
|
-
var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
|
|
336
|
-
|
|
337
|
-
valuesArray = args.values[_width] || args.values[_defaultWidth];
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
|
|
341
|
-
|
|
342
|
-
return valuesArray[index];
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
var eraValues = {
|
|
347
|
-
narrow: ['B', 'A'],
|
|
348
|
-
abbreviated: ['BC', 'AD'],
|
|
349
|
-
wide: ['Before Christ', 'Anno Domini']
|
|
350
|
-
};
|
|
351
|
-
var quarterValues = {
|
|
352
|
-
narrow: ['1', '2', '3', '4'],
|
|
353
|
-
abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
|
|
354
|
-
wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
|
|
355
|
-
}; // Note: in English, the names of days of the week and months are capitalized.
|
|
356
|
-
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
|
|
357
|
-
// Generally, formatted dates should look like they are in the middle of a sentence,
|
|
358
|
-
// e.g. in Spanish language the weekdays and months should be in the lowercase.
|
|
359
|
-
|
|
360
|
-
var monthValues = {
|
|
361
|
-
narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
|
|
362
|
-
abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
363
|
-
wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
|
364
|
-
};
|
|
365
|
-
var dayValues = {
|
|
366
|
-
narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
367
|
-
short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
368
|
-
abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
369
|
-
wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
|
370
|
-
};
|
|
371
|
-
var dayPeriodValues = {
|
|
372
|
-
narrow: {
|
|
373
|
-
am: 'a',
|
|
374
|
-
pm: 'p',
|
|
375
|
-
midnight: 'mi',
|
|
376
|
-
noon: 'n',
|
|
377
|
-
morning: 'morning',
|
|
378
|
-
afternoon: 'afternoon',
|
|
379
|
-
evening: 'evening',
|
|
380
|
-
night: 'night'
|
|
381
|
-
},
|
|
382
|
-
abbreviated: {
|
|
383
|
-
am: 'AM',
|
|
384
|
-
pm: 'PM',
|
|
385
|
-
midnight: 'midnight',
|
|
386
|
-
noon: 'noon',
|
|
387
|
-
morning: 'morning',
|
|
388
|
-
afternoon: 'afternoon',
|
|
389
|
-
evening: 'evening',
|
|
390
|
-
night: 'night'
|
|
391
|
-
},
|
|
392
|
-
wide: {
|
|
393
|
-
am: 'a.m.',
|
|
394
|
-
pm: 'p.m.',
|
|
395
|
-
midnight: 'midnight',
|
|
396
|
-
noon: 'noon',
|
|
397
|
-
morning: 'morning',
|
|
398
|
-
afternoon: 'afternoon',
|
|
399
|
-
evening: 'evening',
|
|
400
|
-
night: 'night'
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
var formattingDayPeriodValues = {
|
|
404
|
-
narrow: {
|
|
405
|
-
am: 'a',
|
|
406
|
-
pm: 'p',
|
|
407
|
-
midnight: 'mi',
|
|
408
|
-
noon: 'n',
|
|
409
|
-
morning: 'in the morning',
|
|
410
|
-
afternoon: 'in the afternoon',
|
|
411
|
-
evening: 'in the evening',
|
|
412
|
-
night: 'at night'
|
|
413
|
-
},
|
|
414
|
-
abbreviated: {
|
|
415
|
-
am: 'AM',
|
|
416
|
-
pm: 'PM',
|
|
417
|
-
midnight: 'midnight',
|
|
418
|
-
noon: 'noon',
|
|
419
|
-
morning: 'in the morning',
|
|
420
|
-
afternoon: 'in the afternoon',
|
|
421
|
-
evening: 'in the evening',
|
|
422
|
-
night: 'at night'
|
|
423
|
-
},
|
|
424
|
-
wide: {
|
|
425
|
-
am: 'a.m.',
|
|
426
|
-
pm: 'p.m.',
|
|
427
|
-
midnight: 'midnight',
|
|
428
|
-
noon: 'noon',
|
|
429
|
-
morning: 'in the morning',
|
|
430
|
-
afternoon: 'in the afternoon',
|
|
431
|
-
evening: 'in the evening',
|
|
432
|
-
night: 'at night'
|
|
433
|
-
}
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
var ordinalNumber = function (dirtyNumber, _options) {
|
|
437
|
-
var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
|
|
438
|
-
// if they are different for different grammatical genders,
|
|
439
|
-
// use `options.unit`.
|
|
440
|
-
//
|
|
441
|
-
// `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
|
|
442
|
-
// 'day', 'hour', 'minute', 'second'.
|
|
443
|
-
|
|
444
|
-
var rem100 = number % 100;
|
|
445
|
-
|
|
446
|
-
if (rem100 > 20 || rem100 < 10) {
|
|
447
|
-
switch (rem100 % 10) {
|
|
448
|
-
case 1:
|
|
449
|
-
return number + 'st';
|
|
450
|
-
|
|
451
|
-
case 2:
|
|
452
|
-
return number + 'nd';
|
|
453
|
-
|
|
454
|
-
case 3:
|
|
455
|
-
return number + 'rd';
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
return number + 'th';
|
|
460
|
-
};
|
|
461
|
-
|
|
462
|
-
var localize = {
|
|
463
|
-
ordinalNumber: ordinalNumber,
|
|
464
|
-
era: buildLocalizeFn({
|
|
465
|
-
values: eraValues,
|
|
466
|
-
defaultWidth: 'wide'
|
|
467
|
-
}),
|
|
468
|
-
quarter: buildLocalizeFn({
|
|
469
|
-
values: quarterValues,
|
|
470
|
-
defaultWidth: 'wide',
|
|
471
|
-
argumentCallback: function (quarter) {
|
|
472
|
-
return quarter - 1;
|
|
473
|
-
}
|
|
474
|
-
}),
|
|
475
|
-
month: buildLocalizeFn({
|
|
476
|
-
values: monthValues,
|
|
477
|
-
defaultWidth: 'wide'
|
|
478
|
-
}),
|
|
479
|
-
day: buildLocalizeFn({
|
|
480
|
-
values: dayValues,
|
|
481
|
-
defaultWidth: 'wide'
|
|
482
|
-
}),
|
|
483
|
-
dayPeriod: buildLocalizeFn({
|
|
484
|
-
values: dayPeriodValues,
|
|
485
|
-
defaultWidth: 'wide',
|
|
486
|
-
formattingValues: formattingDayPeriodValues,
|
|
487
|
-
defaultFormattingWidth: 'wide'
|
|
488
|
-
})
|
|
489
|
-
};
|
|
490
|
-
var localize$1 = localize;
|
|
491
|
-
|
|
492
|
-
function buildMatchFn(args) {
|
|
493
|
-
return function (string) {
|
|
494
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
495
|
-
var width = options.width;
|
|
496
|
-
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
497
|
-
var matchResult = string.match(matchPattern);
|
|
498
|
-
|
|
499
|
-
if (!matchResult) {
|
|
500
|
-
return null;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
var matchedString = matchResult[0];
|
|
504
|
-
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
505
|
-
var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
|
|
506
|
-
return pattern.test(matchedString);
|
|
507
|
-
}) : findKey(parsePatterns, function (pattern) {
|
|
508
|
-
return pattern.test(matchedString);
|
|
509
|
-
});
|
|
510
|
-
var value;
|
|
511
|
-
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
512
|
-
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
513
|
-
var rest = string.slice(matchedString.length);
|
|
514
|
-
return {
|
|
515
|
-
value: value,
|
|
516
|
-
rest: rest
|
|
517
|
-
};
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
function findKey(object, predicate) {
|
|
522
|
-
for (var key in object) {
|
|
523
|
-
if (object.hasOwnProperty(key) && predicate(object[key])) {
|
|
524
|
-
return key;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
return undefined;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
function findIndex(array, predicate) {
|
|
532
|
-
for (var key = 0; key < array.length; key++) {
|
|
533
|
-
if (predicate(array[key])) {
|
|
534
|
-
return key;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
return undefined;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
function buildMatchPatternFn(args) {
|
|
542
|
-
return function (string) {
|
|
543
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
544
|
-
var matchResult = string.match(args.matchPattern);
|
|
545
|
-
if (!matchResult) return null;
|
|
546
|
-
var matchedString = matchResult[0];
|
|
547
|
-
var parseResult = string.match(args.parsePattern);
|
|
548
|
-
if (!parseResult) return null;
|
|
549
|
-
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
550
|
-
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
551
|
-
var rest = string.slice(matchedString.length);
|
|
552
|
-
return {
|
|
553
|
-
value: value,
|
|
554
|
-
rest: rest
|
|
555
|
-
};
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
|
560
|
-
var parseOrdinalNumberPattern = /\d+/i;
|
|
561
|
-
var matchEraPatterns = {
|
|
562
|
-
narrow: /^(b|a)/i,
|
|
563
|
-
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
564
|
-
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
565
|
-
};
|
|
566
|
-
var parseEraPatterns = {
|
|
567
|
-
any: [/^b/i, /^(a|c)/i]
|
|
568
|
-
};
|
|
569
|
-
var matchQuarterPatterns = {
|
|
570
|
-
narrow: /^[1234]/i,
|
|
571
|
-
abbreviated: /^q[1234]/i,
|
|
572
|
-
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
573
|
-
};
|
|
574
|
-
var parseQuarterPatterns = {
|
|
575
|
-
any: [/1/i, /2/i, /3/i, /4/i]
|
|
576
|
-
};
|
|
577
|
-
var matchMonthPatterns = {
|
|
578
|
-
narrow: /^[jfmasond]/i,
|
|
579
|
-
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
580
|
-
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
581
|
-
};
|
|
582
|
-
var parseMonthPatterns = {
|
|
583
|
-
narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
|
|
584
|
-
any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
|
|
585
|
-
};
|
|
586
|
-
var matchDayPatterns = {
|
|
587
|
-
narrow: /^[smtwf]/i,
|
|
588
|
-
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
589
|
-
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
590
|
-
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
591
|
-
};
|
|
592
|
-
var parseDayPatterns = {
|
|
593
|
-
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
594
|
-
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
595
|
-
};
|
|
596
|
-
var matchDayPeriodPatterns = {
|
|
597
|
-
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
598
|
-
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
599
|
-
};
|
|
600
|
-
var parseDayPeriodPatterns = {
|
|
601
|
-
any: {
|
|
602
|
-
am: /^a/i,
|
|
603
|
-
pm: /^p/i,
|
|
604
|
-
midnight: /^mi/i,
|
|
605
|
-
noon: /^no/i,
|
|
606
|
-
morning: /morning/i,
|
|
607
|
-
afternoon: /afternoon/i,
|
|
608
|
-
evening: /evening/i,
|
|
609
|
-
night: /night/i
|
|
610
|
-
}
|
|
611
|
-
};
|
|
612
|
-
var match = {
|
|
613
|
-
ordinalNumber: buildMatchPatternFn({
|
|
614
|
-
matchPattern: matchOrdinalNumberPattern,
|
|
615
|
-
parsePattern: parseOrdinalNumberPattern,
|
|
616
|
-
valueCallback: function (value) {
|
|
617
|
-
return parseInt(value, 10);
|
|
618
|
-
}
|
|
619
|
-
}),
|
|
620
|
-
era: buildMatchFn({
|
|
621
|
-
matchPatterns: matchEraPatterns,
|
|
622
|
-
defaultMatchWidth: 'wide',
|
|
623
|
-
parsePatterns: parseEraPatterns,
|
|
624
|
-
defaultParseWidth: 'any'
|
|
625
|
-
}),
|
|
626
|
-
quarter: buildMatchFn({
|
|
627
|
-
matchPatterns: matchQuarterPatterns,
|
|
628
|
-
defaultMatchWidth: 'wide',
|
|
629
|
-
parsePatterns: parseQuarterPatterns,
|
|
630
|
-
defaultParseWidth: 'any',
|
|
631
|
-
valueCallback: function (index) {
|
|
632
|
-
return index + 1;
|
|
633
|
-
}
|
|
634
|
-
}),
|
|
635
|
-
month: buildMatchFn({
|
|
636
|
-
matchPatterns: matchMonthPatterns,
|
|
637
|
-
defaultMatchWidth: 'wide',
|
|
638
|
-
parsePatterns: parseMonthPatterns,
|
|
639
|
-
defaultParseWidth: 'any'
|
|
640
|
-
}),
|
|
641
|
-
day: buildMatchFn({
|
|
642
|
-
matchPatterns: matchDayPatterns,
|
|
643
|
-
defaultMatchWidth: 'wide',
|
|
644
|
-
parsePatterns: parseDayPatterns,
|
|
645
|
-
defaultParseWidth: 'any'
|
|
646
|
-
}),
|
|
647
|
-
dayPeriod: buildMatchFn({
|
|
648
|
-
matchPatterns: matchDayPeriodPatterns,
|
|
649
|
-
defaultMatchWidth: 'any',
|
|
650
|
-
parsePatterns: parseDayPeriodPatterns,
|
|
651
|
-
defaultParseWidth: 'any'
|
|
652
|
-
})
|
|
653
|
-
};
|
|
654
|
-
var match$1 = match;
|
|
655
|
-
|
|
656
|
-
/**
|
|
657
|
-
* @type {Locale}
|
|
658
|
-
* @category Locales
|
|
659
|
-
* @summary English locale (United States).
|
|
660
|
-
* @language English
|
|
661
|
-
* @iso-639-2 eng
|
|
662
|
-
* @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
|
|
663
|
-
* @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
|
|
664
|
-
*/
|
|
665
|
-
var locale = {
|
|
666
|
-
code: 'en-US',
|
|
667
|
-
formatDistance: formatDistance$1,
|
|
668
|
-
formatLong: formatLong$1,
|
|
669
|
-
formatRelative: formatRelative$1,
|
|
670
|
-
localize: localize$1,
|
|
671
|
-
match: match$1,
|
|
672
|
-
options: {
|
|
673
|
-
weekStartsOn: 0
|
|
674
|
-
/* Sunday */
|
|
675
|
-
,
|
|
676
|
-
firstWeekContainsDate: 1
|
|
677
|
-
}
|
|
678
|
-
};
|
|
679
|
-
var defaultLocale = locale;
|
|
680
|
-
|
|
681
|
-
function assign(target, object) {
|
|
682
|
-
if (target == null) {
|
|
683
|
-
throw new TypeError('assign requires that input parameter not be null or undefined');
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
for (var property in object) {
|
|
687
|
-
if (Object.prototype.hasOwnProperty.call(object, property)) {
|
|
688
|
-
target[property] = object[property];
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
|
|
692
40
|
return target;
|
|
693
41
|
}
|
|
694
42
|
|
|
695
|
-
function cloneObject(object) {
|
|
696
|
-
return assign({}, object);
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
var MILLISECONDS_IN_MINUTE = 1000 * 60;
|
|
700
|
-
var MINUTES_IN_DAY = 60 * 24;
|
|
701
|
-
var MINUTES_IN_MONTH = MINUTES_IN_DAY * 30;
|
|
702
|
-
var MINUTES_IN_YEAR = MINUTES_IN_DAY * 365;
|
|
703
|
-
/**
|
|
704
|
-
* @name formatDistanceStrict
|
|
705
|
-
* @category Common Helpers
|
|
706
|
-
* @summary Return the distance between the given dates in words.
|
|
707
|
-
*
|
|
708
|
-
* @description
|
|
709
|
-
* Return the distance between the given dates in words, using strict units.
|
|
710
|
-
* This is like `formatDistance`, but does not use helpers like 'almost', 'over',
|
|
711
|
-
* 'less than' and the like.
|
|
712
|
-
*
|
|
713
|
-
* | Distance between dates | Result |
|
|
714
|
-
* |------------------------|---------------------|
|
|
715
|
-
* | 0 ... 59 secs | [0..59] seconds |
|
|
716
|
-
* | 1 ... 59 mins | [1..59] minutes |
|
|
717
|
-
* | 1 ... 23 hrs | [1..23] hours |
|
|
718
|
-
* | 1 ... 29 days | [1..29] days |
|
|
719
|
-
* | 1 ... 11 months | [1..11] months |
|
|
720
|
-
* | 1 ... N years | [1..N] years |
|
|
721
|
-
*
|
|
722
|
-
* @param {Date|Number} date - the date
|
|
723
|
-
* @param {Date|Number} baseDate - the date to compare with
|
|
724
|
-
* @param {Object} [options] - an object with options.
|
|
725
|
-
* @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first
|
|
726
|
-
* @param {'second'|'minute'|'hour'|'day'|'month'|'year'} [options.unit] - if specified, will force a unit
|
|
727
|
-
* @param {'floor'|'ceil'|'round'} [options.roundingMethod='round'] - which way to round partial units
|
|
728
|
-
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
|
|
729
|
-
* @returns {String} the distance in words
|
|
730
|
-
* @throws {TypeError} 2 arguments required
|
|
731
|
-
* @throws {RangeError} `date` must not be Invalid Date
|
|
732
|
-
* @throws {RangeError} `baseDate` must not be Invalid Date
|
|
733
|
-
* @throws {RangeError} `options.roundingMethod` must be 'floor', 'ceil' or 'round'
|
|
734
|
-
* @throws {RangeError} `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year'
|
|
735
|
-
* @throws {RangeError} `options.locale` must contain `formatDistance` property
|
|
736
|
-
*
|
|
737
|
-
* @example
|
|
738
|
-
* // What is the distance between 2 July 2014 and 1 January 2015?
|
|
739
|
-
* const result = formatDistanceStrict(new Date(2014, 6, 2), new Date(2015, 0, 2))
|
|
740
|
-
* //=> '6 months'
|
|
741
|
-
*
|
|
742
|
-
* @example
|
|
743
|
-
* // What is the distance between 1 January 2015 00:00:15
|
|
744
|
-
* // and 1 January 2015 00:00:00?
|
|
745
|
-
* const result = formatDistanceStrict(
|
|
746
|
-
* new Date(2015, 0, 1, 0, 0, 15),
|
|
747
|
-
* new Date(2015, 0, 1, 0, 0, 0)
|
|
748
|
-
* )
|
|
749
|
-
* //=> '15 seconds'
|
|
750
|
-
*
|
|
751
|
-
* @example
|
|
752
|
-
* // What is the distance from 1 January 2016
|
|
753
|
-
* // to 1 January 2015, with a suffix?
|
|
754
|
-
* const result = formatDistanceStrict(new Date(2015, 0, 1), new Date(2016, 0, 1), {
|
|
755
|
-
* addSuffix: true
|
|
756
|
-
* })
|
|
757
|
-
* //=> '1 year ago'
|
|
758
|
-
*
|
|
759
|
-
* @example
|
|
760
|
-
* // What is the distance from 1 January 2016
|
|
761
|
-
* // to 1 January 2015, in minutes?
|
|
762
|
-
* const result = formatDistanceStrict(new Date(2016, 0, 1), new Date(2015, 0, 1), {
|
|
763
|
-
* unit: 'minute'
|
|
764
|
-
* })
|
|
765
|
-
* //=> '525600 minutes'
|
|
766
|
-
*
|
|
767
|
-
* @example
|
|
768
|
-
* // What is the distance from 1 January 2015
|
|
769
|
-
* // to 28 January 2015, in months, rounded up?
|
|
770
|
-
* const result = formatDistanceStrict(new Date(2015, 0, 28), new Date(2015, 0, 1), {
|
|
771
|
-
* unit: 'month',
|
|
772
|
-
* roundingMethod: 'ceil'
|
|
773
|
-
* })
|
|
774
|
-
* //=> '1 month'
|
|
775
|
-
*
|
|
776
|
-
* @example
|
|
777
|
-
* // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?
|
|
778
|
-
* import { eoLocale } from 'date-fns/locale/eo'
|
|
779
|
-
* const result = formatDistanceStrict(new Date(2016, 7, 1), new Date(2015, 0, 1), {
|
|
780
|
-
* locale: eoLocale
|
|
781
|
-
* })
|
|
782
|
-
* //=> '1 jaro'
|
|
783
|
-
*/
|
|
784
|
-
|
|
785
|
-
function formatDistanceStrict(dirtyDate, dirtyBaseDate, options) {
|
|
786
|
-
var _ref, _options$locale, _options$roundingMeth;
|
|
787
|
-
|
|
788
|
-
requiredArgs(2, arguments);
|
|
789
|
-
var defaultOptions = getDefaultOptions();
|
|
790
|
-
var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
|
|
791
|
-
|
|
792
|
-
if (!locale.formatDistance) {
|
|
793
|
-
throw new RangeError('locale must contain localize.formatDistance property');
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
var comparison = compareAsc(dirtyDate, dirtyBaseDate);
|
|
797
|
-
|
|
798
|
-
if (isNaN(comparison)) {
|
|
799
|
-
throw new RangeError('Invalid time value');
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
var localizeOptions = assign(cloneObject(options), {
|
|
803
|
-
addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix),
|
|
804
|
-
comparison: comparison
|
|
805
|
-
});
|
|
806
|
-
var dateLeft;
|
|
807
|
-
var dateRight;
|
|
808
|
-
|
|
809
|
-
if (comparison > 0) {
|
|
810
|
-
dateLeft = toDate(dirtyBaseDate);
|
|
811
|
-
dateRight = toDate(dirtyDate);
|
|
812
|
-
} else {
|
|
813
|
-
dateLeft = toDate(dirtyDate);
|
|
814
|
-
dateRight = toDate(dirtyBaseDate);
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
var roundingMethod = String((_options$roundingMeth = options === null || options === void 0 ? void 0 : options.roundingMethod) !== null && _options$roundingMeth !== void 0 ? _options$roundingMeth : 'round');
|
|
818
|
-
var roundingMethodFn;
|
|
819
|
-
|
|
820
|
-
if (roundingMethod === 'floor') {
|
|
821
|
-
roundingMethodFn = Math.floor;
|
|
822
|
-
} else if (roundingMethod === 'ceil') {
|
|
823
|
-
roundingMethodFn = Math.ceil;
|
|
824
|
-
} else if (roundingMethod === 'round') {
|
|
825
|
-
roundingMethodFn = Math.round;
|
|
826
|
-
} else {
|
|
827
|
-
throw new RangeError("roundingMethod must be 'floor', 'ceil' or 'round'");
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
var milliseconds = dateRight.getTime() - dateLeft.getTime();
|
|
831
|
-
var minutes = milliseconds / MILLISECONDS_IN_MINUTE;
|
|
832
|
-
var timezoneOffset = getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft); // Use DST-normalized difference in minutes for years, months and days;
|
|
833
|
-
// use regular difference in minutes for hours, minutes and seconds.
|
|
834
|
-
|
|
835
|
-
var dstNormalizedMinutes = (milliseconds - timezoneOffset) / MILLISECONDS_IN_MINUTE;
|
|
836
|
-
var defaultUnit = options === null || options === void 0 ? void 0 : options.unit;
|
|
837
|
-
var unit;
|
|
838
|
-
|
|
839
|
-
if (!defaultUnit) {
|
|
840
|
-
if (minutes < 1) {
|
|
841
|
-
unit = 'second';
|
|
842
|
-
} else if (minutes < 60) {
|
|
843
|
-
unit = 'minute';
|
|
844
|
-
} else if (minutes < MINUTES_IN_DAY) {
|
|
845
|
-
unit = 'hour';
|
|
846
|
-
} else if (dstNormalizedMinutes < MINUTES_IN_MONTH) {
|
|
847
|
-
unit = 'day';
|
|
848
|
-
} else if (dstNormalizedMinutes < MINUTES_IN_YEAR) {
|
|
849
|
-
unit = 'month';
|
|
850
|
-
} else {
|
|
851
|
-
unit = 'year';
|
|
852
|
-
}
|
|
853
|
-
} else {
|
|
854
|
-
unit = String(defaultUnit);
|
|
855
|
-
} // 0 up to 60 seconds
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
if (unit === 'second') {
|
|
859
|
-
var seconds = roundingMethodFn(milliseconds / 1000);
|
|
860
|
-
return locale.formatDistance('xSeconds', seconds, localizeOptions); // 1 up to 60 mins
|
|
861
|
-
} else if (unit === 'minute') {
|
|
862
|
-
var roundedMinutes = roundingMethodFn(minutes);
|
|
863
|
-
return locale.formatDistance('xMinutes', roundedMinutes, localizeOptions); // 1 up to 24 hours
|
|
864
|
-
} else if (unit === 'hour') {
|
|
865
|
-
var hours = roundingMethodFn(minutes / 60);
|
|
866
|
-
return locale.formatDistance('xHours', hours, localizeOptions); // 1 up to 30 days
|
|
867
|
-
} else if (unit === 'day') {
|
|
868
|
-
var days = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_DAY);
|
|
869
|
-
return locale.formatDistance('xDays', days, localizeOptions); // 1 up to 12 months
|
|
870
|
-
} else if (unit === 'month') {
|
|
871
|
-
var months = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_MONTH);
|
|
872
|
-
return months === 12 && defaultUnit !== 'month' ? locale.formatDistance('xYears', 1, localizeOptions) : locale.formatDistance('xMonths', months, localizeOptions); // 1 year up to max Date
|
|
873
|
-
} else if (unit === 'year') {
|
|
874
|
-
var years = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_YEAR);
|
|
875
|
-
return locale.formatDistance('xYears', years, localizeOptions);
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
throw new RangeError("unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'");
|
|
879
|
-
}
|
|
880
|
-
|
|
881
43
|
const getItem = key => {
|
|
882
44
|
try {
|
|
883
45
|
const itemValue = localStorage.getItem(key);
|
|
884
|
-
|
|
885
46
|
if (typeof itemValue === 'string') {
|
|
886
47
|
return JSON.parse(itemValue);
|
|
887
48
|
}
|
|
888
|
-
|
|
889
49
|
return undefined;
|
|
890
50
|
} catch (_unused) {
|
|
891
51
|
return undefined;
|
|
892
52
|
}
|
|
893
53
|
};
|
|
894
|
-
|
|
895
54
|
function useLocalStorage(key, defaultValue) {
|
|
896
55
|
const [value, setValue] = React__default.useState();
|
|
897
56
|
React__default.useEffect(() => {
|
|
898
57
|
const initialValue = getItem(key);
|
|
899
|
-
|
|
900
58
|
if (typeof initialValue === 'undefined' || initialValue === null) {
|
|
901
59
|
setValue(typeof defaultValue === 'function' ? defaultValue() : defaultValue);
|
|
902
60
|
} else {
|
|
@@ -906,15 +64,12 @@ function useLocalStorage(key, defaultValue) {
|
|
|
906
64
|
const setter = React__default.useCallback(updater => {
|
|
907
65
|
setValue(old => {
|
|
908
66
|
let newVal = updater;
|
|
909
|
-
|
|
910
67
|
if (typeof updater == 'function') {
|
|
911
68
|
newVal = updater(old);
|
|
912
69
|
}
|
|
913
|
-
|
|
914
70
|
try {
|
|
915
71
|
localStorage.setItem(key, JSON.stringify(newVal));
|
|
916
72
|
} catch (_unused2) {}
|
|
917
|
-
|
|
918
73
|
return newVal;
|
|
919
74
|
});
|
|
920
75
|
}, [key]);
|
|
@@ -938,10 +93,9 @@ const defaultTheme = {
|
|
|
938
93
|
const ThemeContext = /*#__PURE__*/React__default.createContext(defaultTheme);
|
|
939
94
|
function ThemeProvider(_ref) {
|
|
940
95
|
let {
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
96
|
+
theme
|
|
97
|
+
} = _ref,
|
|
98
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
945
99
|
return /*#__PURE__*/React__default.createElement(ThemeContext.Provider, _extends({
|
|
946
100
|
value: theme
|
|
947
101
|
}, rest));
|
|
@@ -956,34 +110,34 @@ function useMediaQuery(query) {
|
|
|
956
110
|
if (typeof window !== 'undefined') {
|
|
957
111
|
return window.matchMedia && window.matchMedia(query).matches;
|
|
958
112
|
}
|
|
959
|
-
|
|
960
113
|
return;
|
|
961
|
-
});
|
|
114
|
+
});
|
|
962
115
|
|
|
116
|
+
// Watch for changes
|
|
963
117
|
React__default.useEffect(() => {
|
|
964
118
|
if (typeof window !== 'undefined') {
|
|
965
119
|
if (!window.matchMedia) {
|
|
966
120
|
return;
|
|
967
|
-
}
|
|
968
|
-
|
|
121
|
+
}
|
|
969
122
|
|
|
970
|
-
|
|
123
|
+
// Create a matcher
|
|
124
|
+
const matcher = window.matchMedia(query);
|
|
971
125
|
|
|
126
|
+
// Create our handler
|
|
972
127
|
const onChange = _ref => {
|
|
973
128
|
let {
|
|
974
129
|
matches
|
|
975
130
|
} = _ref;
|
|
976
131
|
return setIsMatch(matches);
|
|
977
|
-
};
|
|
978
|
-
|
|
132
|
+
};
|
|
979
133
|
|
|
134
|
+
// Listen for changes
|
|
980
135
|
matcher.addListener(onChange);
|
|
981
136
|
return () => {
|
|
982
137
|
// Stop listening for changes
|
|
983
138
|
matcher.removeListener(onChange);
|
|
984
139
|
};
|
|
985
140
|
}
|
|
986
|
-
|
|
987
141
|
return;
|
|
988
142
|
}, [isMatch, query, setIsMatch]);
|
|
989
143
|
return isMatch;
|
|
@@ -992,8 +146,10 @@ function useMediaQuery(query) {
|
|
|
992
146
|
const _excluded$2 = ["style"];
|
|
993
147
|
const isServer$1 = typeof window === 'undefined';
|
|
994
148
|
function getStatusColor(match, theme) {
|
|
995
|
-
return match.
|
|
996
|
-
}
|
|
149
|
+
return match.isFetching ? theme.active : match.status === 'error' ? theme.danger : match.status === 'success' ? theme.success : theme.gray;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// export function getQueryStatusLabel(query: Query) {
|
|
997
153
|
// return query.state.isFetching
|
|
998
154
|
// ? 'fetching'
|
|
999
155
|
// : !query.getObserversCount()
|
|
@@ -1007,13 +163,11 @@ function styled(type, newStyles, queries) {
|
|
|
1007
163
|
if (queries === void 0) {
|
|
1008
164
|
queries = {};
|
|
1009
165
|
}
|
|
1010
|
-
|
|
1011
166
|
return /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
1012
167
|
let {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
168
|
+
style
|
|
169
|
+
} = _ref,
|
|
170
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
1017
171
|
const theme = useTheme();
|
|
1018
172
|
const mediaStyles = Object.entries(queries).reduce((current, _ref2) => {
|
|
1019
173
|
let [key, value] = _ref2;
|
|
@@ -1037,22 +191,22 @@ function useIsMounted() {
|
|
|
1037
191
|
}, []);
|
|
1038
192
|
return isMounted;
|
|
1039
193
|
}
|
|
194
|
+
|
|
1040
195
|
/**
|
|
1041
196
|
* Displays a string regardless the type of the data
|
|
1042
197
|
* @param {unknown} value Value to be stringified
|
|
1043
198
|
*/
|
|
1044
|
-
|
|
1045
199
|
const displayValue = value => {
|
|
1046
200
|
const name = Object.getOwnPropertyNames(Object(value));
|
|
1047
201
|
const newValue = typeof value === 'bigint' ? value.toString() + "n" : value;
|
|
1048
202
|
return JSON.stringify(newValue, name);
|
|
1049
203
|
};
|
|
204
|
+
|
|
1050
205
|
/**
|
|
1051
206
|
* This hook is a safe useState version which schedules state updates in microtasks
|
|
1052
207
|
* to prevent updating a component state while React is rendering different components
|
|
1053
208
|
* or when the component is not mounted anymore.
|
|
1054
209
|
*/
|
|
1055
|
-
|
|
1056
210
|
function useSafeState(initialState) {
|
|
1057
211
|
const isMounted = useIsMounted();
|
|
1058
212
|
const [state, setState] = React__default.useState(initialState);
|
|
@@ -1065,45 +219,37 @@ function useSafeState(initialState) {
|
|
|
1065
219
|
}, [isMounted]);
|
|
1066
220
|
return [state, safeSetState];
|
|
1067
221
|
}
|
|
222
|
+
|
|
1068
223
|
/**
|
|
1069
224
|
* Schedules a microtask.
|
|
1070
225
|
* This can be useful to schedule state updates after rendering.
|
|
1071
226
|
*/
|
|
1072
|
-
|
|
1073
227
|
function scheduleMicrotask(callback) {
|
|
1074
228
|
Promise.resolve().then(callback).catch(error => setTimeout(() => {
|
|
1075
229
|
throw error;
|
|
1076
230
|
}));
|
|
1077
231
|
}
|
|
1078
|
-
|
|
1079
232
|
function multiSortBy(arr, accessors) {
|
|
1080
233
|
if (accessors === void 0) {
|
|
1081
234
|
accessors = [d => d];
|
|
1082
235
|
}
|
|
1083
|
-
|
|
1084
236
|
return arr.map((d, i) => [d, i]).sort((_ref3, _ref4) => {
|
|
1085
237
|
let [a, ai] = _ref3;
|
|
1086
238
|
let [b, bi] = _ref4;
|
|
1087
|
-
|
|
1088
239
|
for (const accessor of accessors) {
|
|
1089
240
|
const ao = accessor(a);
|
|
1090
241
|
const bo = accessor(b);
|
|
1091
|
-
|
|
1092
242
|
if (typeof ao === 'undefined') {
|
|
1093
243
|
if (typeof bo === 'undefined') {
|
|
1094
244
|
continue;
|
|
1095
245
|
}
|
|
1096
|
-
|
|
1097
246
|
return 1;
|
|
1098
247
|
}
|
|
1099
|
-
|
|
1100
248
|
if (ao === bo) {
|
|
1101
249
|
continue;
|
|
1102
250
|
}
|
|
1103
|
-
|
|
1104
251
|
return ao > bo ? 1 : -1;
|
|
1105
252
|
}
|
|
1106
|
-
|
|
1107
253
|
return ai - bi;
|
|
1108
254
|
}).map(_ref5 => {
|
|
1109
255
|
let [d] = _ref5;
|
|
@@ -1122,10 +268,11 @@ const Panel = styled('div', (_props, theme) => ({
|
|
|
1122
268
|
flexDirection: 'column'
|
|
1123
269
|
},
|
|
1124
270
|
'(max-width: 600px)': {
|
|
1125
|
-
fontSize: '.9em'
|
|
1126
|
-
|
|
271
|
+
fontSize: '.9em'
|
|
272
|
+
// flexDirection: 'column',
|
|
1127
273
|
}
|
|
1128
274
|
});
|
|
275
|
+
|
|
1129
276
|
const ActivePanel = styled('div', () => ({
|
|
1130
277
|
flex: '1 1 500px',
|
|
1131
278
|
display: 'flex',
|
|
@@ -1148,10 +295,13 @@ const Button = styled('button', (props, theme) => ({
|
|
|
1148
295
|
padding: '.5em',
|
|
1149
296
|
opacity: props.disabled ? '.5' : undefined,
|
|
1150
297
|
cursor: 'pointer'
|
|
1151
|
-
}));
|
|
298
|
+
}));
|
|
299
|
+
|
|
300
|
+
// export const QueryKeys = styled('span', {
|
|
1152
301
|
// display: 'inline-block',
|
|
1153
302
|
// fontSize: '0.9em',
|
|
1154
303
|
// })
|
|
304
|
+
|
|
1155
305
|
// export const QueryKey = styled('span', {
|
|
1156
306
|
// display: 'inline-flex',
|
|
1157
307
|
// alignItems: 'center',
|
|
@@ -1246,7 +396,6 @@ const Expander = _ref => {
|
|
|
1246
396
|
}, style)
|
|
1247
397
|
}, "\u25B6");
|
|
1248
398
|
};
|
|
1249
|
-
|
|
1250
399
|
/**
|
|
1251
400
|
* Chunk elements in the array by size
|
|
1252
401
|
*
|
|
@@ -1260,12 +409,10 @@ function chunkArray(array, size) {
|
|
|
1260
409
|
if (size < 1) return [];
|
|
1261
410
|
let i = 0;
|
|
1262
411
|
const result = [];
|
|
1263
|
-
|
|
1264
412
|
while (i < array.length) {
|
|
1265
413
|
result.push(array.slice(i, i + size));
|
|
1266
414
|
i = i + size;
|
|
1267
415
|
}
|
|
1268
|
-
|
|
1269
416
|
return result;
|
|
1270
417
|
}
|
|
1271
418
|
const DefaultRenderer = _ref2 => {
|
|
@@ -1283,11 +430,9 @@ const DefaultRenderer = _ref2 => {
|
|
|
1283
430
|
} = _ref2;
|
|
1284
431
|
const [expandedPages, setExpandedPages] = React.useState([]);
|
|
1285
432
|
const [valueSnapshot, setValueSnapshot] = React.useState(undefined);
|
|
1286
|
-
|
|
1287
433
|
const refreshValueSnapshot = () => {
|
|
1288
434
|
setValueSnapshot(value());
|
|
1289
435
|
};
|
|
1290
|
-
|
|
1291
436
|
return /*#__PURE__*/React.createElement(Entry, null, subEntryPages.length ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ExpandButton, {
|
|
1292
437
|
onClick: () => toggleExpanded()
|
|
1293
438
|
}, /*#__PURE__*/React.createElement(Expander, {
|
|
@@ -1312,25 +457,21 @@ const DefaultRenderer = _ref2 => {
|
|
|
1312
457
|
defaultExpanded: {}
|
|
1313
458
|
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Label, null, label, ":"), " ", /*#__PURE__*/React.createElement(Value, null, displayValue(value))));
|
|
1314
459
|
};
|
|
1315
|
-
|
|
1316
460
|
function isIterable(x) {
|
|
1317
461
|
return Symbol.iterator in x;
|
|
1318
462
|
}
|
|
1319
|
-
|
|
1320
463
|
function Explorer(_ref3) {
|
|
1321
464
|
let {
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
465
|
+
value,
|
|
466
|
+
defaultExpanded,
|
|
467
|
+
renderer = DefaultRenderer,
|
|
468
|
+
pageSize = 100
|
|
469
|
+
} = _ref3,
|
|
470
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded$1);
|
|
1329
471
|
const [expanded, setExpanded] = React.useState(Boolean(defaultExpanded));
|
|
1330
472
|
const toggleExpanded = React.useCallback(() => setExpanded(old => !old), []);
|
|
1331
473
|
let type = typeof value;
|
|
1332
474
|
let subEntries = [];
|
|
1333
|
-
|
|
1334
475
|
const makeProperty = sub => {
|
|
1335
476
|
const subDefaultExpanded = defaultExpanded === true ? {
|
|
1336
477
|
[sub.label]: true
|
|
@@ -1339,7 +480,6 @@ function Explorer(_ref3) {
|
|
|
1339
480
|
defaultExpanded: subDefaultExpanded
|
|
1340
481
|
});
|
|
1341
482
|
};
|
|
1342
|
-
|
|
1343
483
|
if (Array.isArray(value)) {
|
|
1344
484
|
type = 'array';
|
|
1345
485
|
subEntries = value.map((d, i) => makeProperty({
|
|
@@ -1362,7 +502,6 @@ function Explorer(_ref3) {
|
|
|
1362
502
|
});
|
|
1363
503
|
});
|
|
1364
504
|
}
|
|
1365
|
-
|
|
1366
505
|
const subEntryPages = chunkArray(subEntries, pageSize);
|
|
1367
506
|
return renderer(_extends({
|
|
1368
507
|
handleEntry: entry => /*#__PURE__*/React.createElement(Explorer, _extends({
|
|
@@ -1381,21 +520,19 @@ function Explorer(_ref3) {
|
|
|
1381
520
|
}
|
|
1382
521
|
|
|
1383
522
|
const _excluded = ["style"],
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
523
|
+
_excluded2 = ["style", "onClick"],
|
|
524
|
+
_excluded3 = ["style", "onClick"],
|
|
525
|
+
_excluded4 = ["isOpen", "setIsOpen", "handleDragStart", "router"];
|
|
1387
526
|
const isServer = typeof window === 'undefined';
|
|
1388
|
-
|
|
1389
527
|
function Logo(props) {
|
|
1390
528
|
var _props$style;
|
|
1391
|
-
|
|
1392
529
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, props, {
|
|
1393
530
|
style: _extends({}, (_props$style = props.style) != null ? _props$style : {}, {
|
|
1394
531
|
display: 'flex',
|
|
1395
532
|
alignItems: 'center',
|
|
1396
533
|
flexDirection: 'column',
|
|
1397
|
-
fontSize: '0.
|
|
1398
|
-
fontWeight: '
|
|
534
|
+
fontSize: '0.8rem',
|
|
535
|
+
fontWeight: 'bolder',
|
|
1399
536
|
lineHeight: '1'
|
|
1400
537
|
})
|
|
1401
538
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -1403,14 +540,19 @@ function Logo(props) {
|
|
|
1403
540
|
letterSpacing: '-0.05rem'
|
|
1404
541
|
}
|
|
1405
542
|
}, "TANSTACK"), /*#__PURE__*/React__default.createElement("div", {
|
|
1406
|
-
className: "text-transparent bg-clip-text bg-gradient-to-r from-lime-500 to-emerald-500",
|
|
1407
543
|
style: {
|
|
544
|
+
backgroundImage: 'linear-gradient(to right, var(--tw-gradient-stops))',
|
|
545
|
+
// @ts-ignore
|
|
546
|
+
'--tw-gradient-from': '#84cc16',
|
|
547
|
+
'--tw-gradient-stops': 'var(--tw-gradient-from), var(--tw-gradient-to)',
|
|
548
|
+
'--tw-gradient-to': '#10b981',
|
|
549
|
+
WebkitBackgroundClip: 'text',
|
|
550
|
+
color: 'transparent',
|
|
1408
551
|
letterSpacing: '0.1rem',
|
|
1409
552
|
marginRight: '-0.2rem'
|
|
1410
553
|
}
|
|
1411
554
|
}, "ROUTER"));
|
|
1412
555
|
}
|
|
1413
|
-
|
|
1414
556
|
function TanStackRouterDevtools(_ref) {
|
|
1415
557
|
let {
|
|
1416
558
|
initialIsOpen,
|
|
@@ -1428,10 +570,8 @@ function TanStackRouterDevtools(_ref) {
|
|
|
1428
570
|
const [isResolvedOpen, setIsResolvedOpen] = useSafeState(false);
|
|
1429
571
|
const [isResizing, setIsResizing] = useSafeState(false);
|
|
1430
572
|
const isMounted = useIsMounted();
|
|
1431
|
-
|
|
1432
573
|
const _handleDragStart = (panelElement, startEvent) => {
|
|
1433
574
|
var _panelElement$getBoun;
|
|
1434
|
-
|
|
1435
575
|
if (startEvent.button !== 0) return; // Only allow left click for drag
|
|
1436
576
|
|
|
1437
577
|
setIsResizing(true);
|
|
@@ -1439,50 +579,43 @@ function TanStackRouterDevtools(_ref) {
|
|
|
1439
579
|
originalHeight: (_panelElement$getBoun = panelElement == null ? void 0 : panelElement.getBoundingClientRect().height) != null ? _panelElement$getBoun : 0,
|
|
1440
580
|
pageY: startEvent.pageY
|
|
1441
581
|
};
|
|
1442
|
-
|
|
1443
582
|
const run = moveEvent => {
|
|
1444
583
|
const delta = dragInfo.pageY - moveEvent.pageY;
|
|
1445
584
|
const newHeight = (dragInfo == null ? void 0 : dragInfo.originalHeight) + delta;
|
|
1446
585
|
setDevtoolsHeight(newHeight);
|
|
1447
|
-
|
|
1448
586
|
if (newHeight < 70) {
|
|
1449
587
|
setIsOpen(false);
|
|
1450
588
|
} else {
|
|
1451
589
|
setIsOpen(true);
|
|
1452
590
|
}
|
|
1453
591
|
};
|
|
1454
|
-
|
|
1455
592
|
const unsub = () => {
|
|
1456
593
|
setIsResizing(false);
|
|
1457
594
|
document.removeEventListener('mousemove', run);
|
|
1458
595
|
document.removeEventListener('mouseUp', unsub);
|
|
1459
596
|
};
|
|
1460
|
-
|
|
1461
597
|
document.addEventListener('mousemove', run);
|
|
1462
598
|
document.addEventListener('mouseup', unsub);
|
|
1463
599
|
};
|
|
1464
|
-
|
|
1465
600
|
React__default.useEffect(() => {
|
|
1466
601
|
setIsResolvedOpen(isOpen != null ? isOpen : false);
|
|
1467
|
-
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
1468
|
-
// Prevents focusing in a closed panel.
|
|
602
|
+
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
1469
603
|
|
|
604
|
+
// Toggle panel visibility before/after transition (depending on direction).
|
|
605
|
+
// Prevents focusing in a closed panel.
|
|
1470
606
|
React__default.useEffect(() => {
|
|
1471
607
|
const ref = panelRef.current;
|
|
1472
|
-
|
|
1473
608
|
if (ref) {
|
|
1474
609
|
const handlePanelTransitionStart = () => {
|
|
1475
610
|
if (ref && isResolvedOpen) {
|
|
1476
611
|
ref.style.visibility = 'visible';
|
|
1477
612
|
}
|
|
1478
613
|
};
|
|
1479
|
-
|
|
1480
614
|
const handlePanelTransitionEnd = () => {
|
|
1481
615
|
if (ref && !isResolvedOpen) {
|
|
1482
616
|
ref.style.visibility = 'hidden';
|
|
1483
617
|
}
|
|
1484
618
|
};
|
|
1485
|
-
|
|
1486
619
|
ref.addEventListener('transitionstart', handlePanelTransitionStart);
|
|
1487
620
|
ref.addEventListener('transitionend', handlePanelTransitionEnd);
|
|
1488
621
|
return () => {
|
|
@@ -1490,62 +623,49 @@ function TanStackRouterDevtools(_ref) {
|
|
|
1490
623
|
ref.removeEventListener('transitionend', handlePanelTransitionEnd);
|
|
1491
624
|
};
|
|
1492
625
|
}
|
|
1493
|
-
|
|
1494
626
|
return;
|
|
1495
627
|
}, [isResolvedOpen]);
|
|
1496
628
|
React__default[isServer ? 'useEffect' : 'useLayoutEffect'](() => {
|
|
1497
629
|
if (isResolvedOpen) {
|
|
1498
630
|
var _rootRef$current, _rootRef$current$pare;
|
|
1499
|
-
|
|
1500
631
|
const previousValue = (_rootRef$current = rootRef.current) == null ? void 0 : (_rootRef$current$pare = _rootRef$current.parentElement) == null ? void 0 : _rootRef$current$pare.style.paddingBottom;
|
|
1501
|
-
|
|
1502
632
|
const run = () => {
|
|
1503
633
|
var _panelRef$current, _rootRef$current2;
|
|
1504
|
-
|
|
1505
634
|
const containerHeight = (_panelRef$current = panelRef.current) == null ? void 0 : _panelRef$current.getBoundingClientRect().height;
|
|
1506
|
-
|
|
1507
635
|
if ((_rootRef$current2 = rootRef.current) != null && _rootRef$current2.parentElement) {
|
|
1508
636
|
rootRef.current.parentElement.style.paddingBottom = containerHeight + "px";
|
|
1509
637
|
}
|
|
1510
638
|
};
|
|
1511
|
-
|
|
1512
639
|
run();
|
|
1513
|
-
|
|
1514
640
|
if (typeof window !== 'undefined') {
|
|
1515
641
|
window.addEventListener('resize', run);
|
|
1516
642
|
return () => {
|
|
1517
643
|
var _rootRef$current3;
|
|
1518
|
-
|
|
1519
644
|
window.removeEventListener('resize', run);
|
|
1520
|
-
|
|
1521
645
|
if ((_rootRef$current3 = rootRef.current) != null && _rootRef$current3.parentElement && typeof previousValue === 'string') {
|
|
1522
646
|
rootRef.current.parentElement.style.paddingBottom = previousValue;
|
|
1523
647
|
}
|
|
1524
648
|
};
|
|
1525
649
|
}
|
|
1526
650
|
}
|
|
1527
|
-
|
|
1528
651
|
return;
|
|
1529
652
|
}, [isResolvedOpen]);
|
|
1530
|
-
|
|
1531
653
|
const {
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
654
|
+
style: panelStyle = {}
|
|
655
|
+
} = panelProps,
|
|
656
|
+
otherPanelProps = _objectWithoutPropertiesLoose(panelProps, _excluded);
|
|
1536
657
|
const {
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
658
|
+
style: closeButtonStyle = {},
|
|
659
|
+
onClick: onCloseClick
|
|
660
|
+
} = closeButtonProps,
|
|
661
|
+
otherCloseButtonProps = _objectWithoutPropertiesLoose(closeButtonProps, _excluded2);
|
|
1542
662
|
const {
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
663
|
+
style: toggleButtonStyle = {},
|
|
664
|
+
onClick: onToggleClick
|
|
665
|
+
} = toggleButtonProps,
|
|
666
|
+
otherToggleButtonProps = _objectWithoutPropertiesLoose(toggleButtonProps, _excluded3);
|
|
1548
667
|
|
|
668
|
+
// Do not render on the server
|
|
1549
669
|
if (!isMounted()) return null;
|
|
1550
670
|
return /*#__PURE__*/React__default.createElement(Container, {
|
|
1551
671
|
ref: rootRef,
|
|
@@ -1646,19 +766,20 @@ function TanStackRouterDevtools(_ref) {
|
|
|
1646
766
|
}
|
|
1647
767
|
const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(function TanStackRouterDevtoolsPanel(props, ref) {
|
|
1648
768
|
var _Object$values$find$m, _Object$values, _Object$values$find, _router$state$matches, _router$state$pending, _router$state$pending2, _last, _last2, _last3, _last4, _last5, _last6;
|
|
1649
|
-
|
|
1650
769
|
const {
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
770
|
+
isOpen = true,
|
|
771
|
+
handleDragStart,
|
|
772
|
+
router: userRouter
|
|
773
|
+
} = props,
|
|
774
|
+
panelProps = _objectWithoutPropertiesLoose(props, _excluded4);
|
|
775
|
+
const routerContextValue = React__default.useContext(routerContext);
|
|
776
|
+
const router = userRouter != null ? userRouter : routerContextValue == null ? void 0 : routerContextValue.router;
|
|
777
|
+
invariant(router, 'No router was found for the TanStack Router Devtools. Please place the devtools in the <RouterProvider> component tree or pass the router instance to the devtools manually.');
|
|
1657
778
|
const rerender = React__default.useReducer(() => ({}), {})[1];
|
|
1658
779
|
React__default.useEffect(() => {
|
|
1659
780
|
let interval = setInterval(() => {
|
|
1660
|
-
router.cleanMatchCache();
|
|
1661
|
-
|
|
781
|
+
router.cleanMatchCache();
|
|
782
|
+
// router.notify()
|
|
1662
783
|
rerender();
|
|
1663
784
|
}, 250);
|
|
1664
785
|
return () => {
|
|
@@ -1677,9 +798,7 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1677
798
|
}).map(key => router.matchCache[key]), [d => d.match.isFetching ? -1 : 1, d => -d.match.updatedAt]);
|
|
1678
799
|
return /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
1679
800
|
theme: defaultTheme
|
|
1680
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
1681
|
-
src: "https://cdn.tailwindcss.com"
|
|
1682
|
-
}), /*#__PURE__*/React__default.createElement(Panel, _extends({
|
|
801
|
+
}, /*#__PURE__*/React__default.createElement(Panel, _extends({
|
|
1683
802
|
ref: ref,
|
|
1684
803
|
className: "TanStackRouterDevtoolsPanel"
|
|
1685
804
|
}, panelProps), /*#__PURE__*/React__default.createElement("style", {
|
|
@@ -1709,8 +828,12 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1709
828
|
flexDirection: 'column'
|
|
1710
829
|
}
|
|
1711
830
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1712
|
-
className: "flex justify-start gap-2 p-2 items-center",
|
|
1713
831
|
style: {
|
|
832
|
+
display: 'flex',
|
|
833
|
+
justifyContent: 'start',
|
|
834
|
+
gap: '1rem',
|
|
835
|
+
padding: '1rem',
|
|
836
|
+
alignItems: 'center',
|
|
1714
837
|
background: defaultTheme.backgroundAlt
|
|
1715
838
|
}
|
|
1716
839
|
}, /*#__PURE__*/React__default.createElement(Logo, {
|
|
@@ -1918,10 +1041,6 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1918
1041
|
style: {
|
|
1919
1042
|
opacity: '.5'
|
|
1920
1043
|
}
|
|
1921
|
-
}, "Pending"), /*#__PURE__*/React__default.createElement("td", null, activeMatch.isPending.toString())), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
|
|
1922
|
-
style: {
|
|
1923
|
-
opacity: '.5'
|
|
1924
|
-
}
|
|
1925
1044
|
}, "Invalid"), /*#__PURE__*/React__default.createElement("td", null, activeMatch.isInvalid.toString())), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
|
|
1926
1045
|
style: {
|
|
1927
1046
|
opacity: '.5'
|