@internetarchive/histogram-date-range 1.2.0 → 1.2.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/.editorconfig +29 -29
- package/.eslintrc.js +14 -14
- package/.github/workflows/ci.yml +30 -26
- package/LICENSE +661 -661
- package/README.md +113 -113
- package/demo/index.css +22 -22
- package/demo/index.html +159 -159
- package/dist/demo/app-root.d.ts +19 -0
- package/dist/demo/app-root.js +58 -0
- package/dist/demo/app-root.js.map +1 -0
- package/dist/demo/js/app-root.d.ts +19 -19
- package/dist/demo/js/app-root.js +46 -46
- package/dist/docs/_snowpack/pkg/@internetarchive/ia-activity-indicator/ia-activity-indicator.d.ts +1 -0
- package/dist/docs/_snowpack/pkg/@internetarchive/ia-activity-indicator/ia-activity-indicator.js +2 -0
- package/dist/docs/_snowpack/pkg/@internetarchive/ia-activity-indicator/ia-activity-indicator.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/histogram-date-range.d.ts +159 -159
- package/dist/src/histogram-date-range.js +846 -853
- package/dist/src/histogram-date-range.js.map +1 -1
- package/dist/test/histogram-date-range.test.d.ts +1 -1
- package/dist/test/histogram-date-range.test.js +488 -488
- package/dist/test/histogram-date-range.test.js.map +1 -1
- package/docs/_snowpack/pkg/@internetarchive/{ia-activity-indicator/ia-activity-indicator.js → ia-activity-indicator.js} +193 -168
- package/docs/_snowpack/pkg/common/lit-element-4616b61d.js +22 -0
- package/docs/_snowpack/pkg/common/lit-html-a4f3a51c.js +8 -0
- package/docs/_snowpack/pkg/common/query-assigned-elements-61aefe32.js +21 -0
- package/docs/_snowpack/pkg/dayjs/esm/plugin/customParseFormat.js +355 -0
- package/docs/_snowpack/pkg/dayjs/esm.js +631 -0
- package/docs/_snowpack/pkg/import-map.json +3 -1
- package/docs/_snowpack/pkg/lit/decorators.js +4 -21
- package/docs/_snowpack/pkg/lit/directives/live.js +3 -3
- package/docs/_snowpack/pkg/lit.js +2 -2
- package/docs/demo/index.css +22 -22
- package/docs/demo/index.html +159 -159
- package/docs/dist/src/histogram-date-range.js +5 -5
- package/index.ts +1 -1
- package/package.json +85 -84
- package/snowpack.config.js +10 -10
- package/src/histogram-date-range.ts +914 -922
- package/test/histogram-date-range.test.ts +684 -684
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +28 -28
- package/web-test-runner.config.mjs +29 -29
- package/docs/_snowpack/pkg/common/lit-element-2ebaea62.js +0 -22
- package/docs/_snowpack/pkg/common/lit-html-ab4365d1.js +0 -8
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
var SECONDS_A_MINUTE = 60;
|
|
2
|
+
var SECONDS_A_HOUR = SECONDS_A_MINUTE * 60;
|
|
3
|
+
var SECONDS_A_DAY = SECONDS_A_HOUR * 24;
|
|
4
|
+
var SECONDS_A_WEEK = SECONDS_A_DAY * 7;
|
|
5
|
+
var MILLISECONDS_A_SECOND = 1e3;
|
|
6
|
+
var MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND;
|
|
7
|
+
var MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND;
|
|
8
|
+
var MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND;
|
|
9
|
+
var MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND; // English locales
|
|
10
|
+
|
|
11
|
+
var MS = 'millisecond';
|
|
12
|
+
var S = 'second';
|
|
13
|
+
var MIN = 'minute';
|
|
14
|
+
var H = 'hour';
|
|
15
|
+
var D = 'day';
|
|
16
|
+
var W = 'week';
|
|
17
|
+
var M = 'month';
|
|
18
|
+
var Q = 'quarter';
|
|
19
|
+
var Y = 'year';
|
|
20
|
+
var DATE = 'date';
|
|
21
|
+
var FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ssZ';
|
|
22
|
+
var INVALID_DATE_STRING = 'Invalid Date'; // regex
|
|
23
|
+
|
|
24
|
+
var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
|
|
25
|
+
var REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
26
|
+
|
|
27
|
+
// English [en]
|
|
28
|
+
// We don't need weekdaysShort, weekdaysMin, monthsShort in en.js locale
|
|
29
|
+
var en = {
|
|
30
|
+
name: 'en',
|
|
31
|
+
weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
|
|
32
|
+
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
|
|
33
|
+
ordinal: function ordinal(n) {
|
|
34
|
+
var s = ['th', 'st', 'nd', 'rd'];
|
|
35
|
+
var v = n % 100;
|
|
36
|
+
return "[" + n + (s[(v - 20) % 10] || s[v] || s[0]) + "]";
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var padStart = function padStart(string, length, pad) {
|
|
41
|
+
var s = String(string);
|
|
42
|
+
if (!s || s.length >= length) return string;
|
|
43
|
+
return "" + Array(length + 1 - s.length).join(pad) + string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var padZoneStr = function padZoneStr(instance) {
|
|
47
|
+
var negMinutes = -instance.utcOffset();
|
|
48
|
+
var minutes = Math.abs(negMinutes);
|
|
49
|
+
var hourOffset = Math.floor(minutes / 60);
|
|
50
|
+
var minuteOffset = minutes % 60;
|
|
51
|
+
return "" + (negMinutes <= 0 ? '+' : '-') + padStart(hourOffset, 2, '0') + ":" + padStart(minuteOffset, 2, '0');
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var monthDiff = function monthDiff(a, b) {
|
|
55
|
+
// function from moment.js in order to keep the same result
|
|
56
|
+
if (a.date() < b.date()) return -monthDiff(b, a);
|
|
57
|
+
var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month());
|
|
58
|
+
var anchor = a.clone().add(wholeMonthDiff, M);
|
|
59
|
+
var c = b - anchor < 0;
|
|
60
|
+
var anchor2 = a.clone().add(wholeMonthDiff + (c ? -1 : 1), M);
|
|
61
|
+
return +(-(wholeMonthDiff + (b - anchor) / (c ? anchor - anchor2 : anchor2 - anchor)) || 0);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var absFloor = function absFloor(n) {
|
|
65
|
+
return n < 0 ? Math.ceil(n) || 0 : Math.floor(n);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var prettyUnit = function prettyUnit(u) {
|
|
69
|
+
var special = {
|
|
70
|
+
M: M,
|
|
71
|
+
y: Y,
|
|
72
|
+
w: W,
|
|
73
|
+
d: D,
|
|
74
|
+
D: DATE,
|
|
75
|
+
h: H,
|
|
76
|
+
m: MIN,
|
|
77
|
+
s: S,
|
|
78
|
+
ms: MS,
|
|
79
|
+
Q: Q
|
|
80
|
+
};
|
|
81
|
+
return special[u] || String(u || '').toLowerCase().replace(/s$/, '');
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
var isUndefined = function isUndefined(s) {
|
|
85
|
+
return s === undefined;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
var U = {
|
|
89
|
+
s: padStart,
|
|
90
|
+
z: padZoneStr,
|
|
91
|
+
m: monthDiff,
|
|
92
|
+
a: absFloor,
|
|
93
|
+
p: prettyUnit,
|
|
94
|
+
u: isUndefined
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
var L = 'en'; // global locale
|
|
98
|
+
|
|
99
|
+
var Ls = {}; // global loaded locale
|
|
100
|
+
|
|
101
|
+
Ls[L] = en;
|
|
102
|
+
var IS_DAYJS = '$isDayjsObject'; // eslint-disable-next-line no-use-before-define
|
|
103
|
+
|
|
104
|
+
var isDayjs = function isDayjs(d) {
|
|
105
|
+
return d instanceof Dayjs || !!(d && d[IS_DAYJS]);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
var parseLocale = function parseLocale(preset, object, isLocal) {
|
|
109
|
+
var l;
|
|
110
|
+
if (!preset) return L;
|
|
111
|
+
|
|
112
|
+
if (typeof preset === 'string') {
|
|
113
|
+
var presetLower = preset.toLowerCase();
|
|
114
|
+
|
|
115
|
+
if (Ls[presetLower]) {
|
|
116
|
+
l = presetLower;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (object) {
|
|
120
|
+
Ls[presetLower] = object;
|
|
121
|
+
l = presetLower;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var presetSplit = preset.split('-');
|
|
125
|
+
|
|
126
|
+
if (!l && presetSplit.length > 1) {
|
|
127
|
+
return parseLocale(presetSplit[0]);
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
var name = preset.name;
|
|
131
|
+
Ls[name] = preset;
|
|
132
|
+
l = name;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (!isLocal && l) L = l;
|
|
136
|
+
return l || !isLocal && L;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
var dayjs = function dayjs(date, c) {
|
|
140
|
+
if (isDayjs(date)) {
|
|
141
|
+
return date.clone();
|
|
142
|
+
} // eslint-disable-next-line no-nested-ternary
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
var cfg = typeof c === 'object' ? c : {};
|
|
146
|
+
cfg.date = date;
|
|
147
|
+
cfg.args = arguments; // eslint-disable-line prefer-rest-params
|
|
148
|
+
|
|
149
|
+
return new Dayjs(cfg); // eslint-disable-line no-use-before-define
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
var wrapper = function wrapper(date, instance) {
|
|
153
|
+
return dayjs(date, {
|
|
154
|
+
locale: instance.$L,
|
|
155
|
+
utc: instance.$u,
|
|
156
|
+
x: instance.$x,
|
|
157
|
+
$offset: instance.$offset // todo: refactor; do not use this.$offset in you code
|
|
158
|
+
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
var Utils = U; // for plugin use
|
|
163
|
+
|
|
164
|
+
Utils.l = parseLocale;
|
|
165
|
+
Utils.i = isDayjs;
|
|
166
|
+
Utils.w = wrapper;
|
|
167
|
+
|
|
168
|
+
var parseDate = function parseDate(cfg) {
|
|
169
|
+
var date = cfg.date,
|
|
170
|
+
utc = cfg.utc;
|
|
171
|
+
if (date === null) return new Date(NaN); // null is invalid
|
|
172
|
+
|
|
173
|
+
if (Utils.u(date)) return new Date(); // today
|
|
174
|
+
|
|
175
|
+
if (date instanceof Date) return new Date(date);
|
|
176
|
+
|
|
177
|
+
if (typeof date === 'string' && !/Z$/i.test(date)) {
|
|
178
|
+
var d = date.match(REGEX_PARSE);
|
|
179
|
+
|
|
180
|
+
if (d) {
|
|
181
|
+
var m = d[2] - 1 || 0;
|
|
182
|
+
var ms = (d[7] || '0').substring(0, 3);
|
|
183
|
+
|
|
184
|
+
if (utc) {
|
|
185
|
+
return new Date(Date.UTC(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return new Date(date); // everything else
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
var Dayjs = /*#__PURE__*/function () {
|
|
196
|
+
function Dayjs(cfg) {
|
|
197
|
+
this.$L = parseLocale(cfg.locale, null, true);
|
|
198
|
+
this.parse(cfg); // for plugin
|
|
199
|
+
|
|
200
|
+
this.$x = this.$x || cfg.x || {};
|
|
201
|
+
this[IS_DAYJS] = true;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
var _proto = Dayjs.prototype;
|
|
205
|
+
|
|
206
|
+
_proto.parse = function parse(cfg) {
|
|
207
|
+
this.$d = parseDate(cfg);
|
|
208
|
+
this.init();
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
_proto.init = function init() {
|
|
212
|
+
var $d = this.$d;
|
|
213
|
+
this.$y = $d.getFullYear();
|
|
214
|
+
this.$M = $d.getMonth();
|
|
215
|
+
this.$D = $d.getDate();
|
|
216
|
+
this.$W = $d.getDay();
|
|
217
|
+
this.$H = $d.getHours();
|
|
218
|
+
this.$m = $d.getMinutes();
|
|
219
|
+
this.$s = $d.getSeconds();
|
|
220
|
+
this.$ms = $d.getMilliseconds();
|
|
221
|
+
} // eslint-disable-next-line class-methods-use-this
|
|
222
|
+
;
|
|
223
|
+
|
|
224
|
+
_proto.$utils = function $utils() {
|
|
225
|
+
return Utils;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
_proto.isValid = function isValid() {
|
|
229
|
+
return !(this.$d.toString() === INVALID_DATE_STRING);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
_proto.isSame = function isSame(that, units) {
|
|
233
|
+
var other = dayjs(that);
|
|
234
|
+
return this.startOf(units) <= other && other <= this.endOf(units);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
_proto.isAfter = function isAfter(that, units) {
|
|
238
|
+
return dayjs(that) < this.startOf(units);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
_proto.isBefore = function isBefore(that, units) {
|
|
242
|
+
return this.endOf(units) < dayjs(that);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
_proto.$g = function $g(input, get, set) {
|
|
246
|
+
if (Utils.u(input)) return this[get];
|
|
247
|
+
return this.set(set, input);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
_proto.unix = function unix() {
|
|
251
|
+
return Math.floor(this.valueOf() / 1000);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
_proto.valueOf = function valueOf() {
|
|
255
|
+
// timezone(hour) * 60 * 60 * 1000 => ms
|
|
256
|
+
return this.$d.getTime();
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
_proto.startOf = function startOf(units, _startOf) {
|
|
260
|
+
var _this = this;
|
|
261
|
+
|
|
262
|
+
// startOf -> endOf
|
|
263
|
+
var isStartOf = !Utils.u(_startOf) ? _startOf : true;
|
|
264
|
+
var unit = Utils.p(units);
|
|
265
|
+
|
|
266
|
+
var instanceFactory = function instanceFactory(d, m) {
|
|
267
|
+
var ins = Utils.w(_this.$u ? Date.UTC(_this.$y, m, d) : new Date(_this.$y, m, d), _this);
|
|
268
|
+
return isStartOf ? ins : ins.endOf(D);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
var instanceFactorySet = function instanceFactorySet(method, slice) {
|
|
272
|
+
var argumentStart = [0, 0, 0, 0];
|
|
273
|
+
var argumentEnd = [23, 59, 59, 999];
|
|
274
|
+
return Utils.w(_this.toDate()[method].apply( // eslint-disable-line prefer-spread
|
|
275
|
+
_this.toDate('s'), (isStartOf ? argumentStart : argumentEnd).slice(slice)), _this);
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
var $W = this.$W,
|
|
279
|
+
$M = this.$M,
|
|
280
|
+
$D = this.$D;
|
|
281
|
+
var utcPad = "set" + (this.$u ? 'UTC' : '');
|
|
282
|
+
|
|
283
|
+
switch (unit) {
|
|
284
|
+
case Y:
|
|
285
|
+
return isStartOf ? instanceFactory(1, 0) : instanceFactory(31, 11);
|
|
286
|
+
|
|
287
|
+
case M:
|
|
288
|
+
return isStartOf ? instanceFactory(1, $M) : instanceFactory(0, $M + 1);
|
|
289
|
+
|
|
290
|
+
case W:
|
|
291
|
+
{
|
|
292
|
+
var weekStart = this.$locale().weekStart || 0;
|
|
293
|
+
var gap = ($W < weekStart ? $W + 7 : $W) - weekStart;
|
|
294
|
+
return instanceFactory(isStartOf ? $D - gap : $D + (6 - gap), $M);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
case D:
|
|
298
|
+
case DATE:
|
|
299
|
+
return instanceFactorySet(utcPad + "Hours", 0);
|
|
300
|
+
|
|
301
|
+
case H:
|
|
302
|
+
return instanceFactorySet(utcPad + "Minutes", 1);
|
|
303
|
+
|
|
304
|
+
case MIN:
|
|
305
|
+
return instanceFactorySet(utcPad + "Seconds", 2);
|
|
306
|
+
|
|
307
|
+
case S:
|
|
308
|
+
return instanceFactorySet(utcPad + "Milliseconds", 3);
|
|
309
|
+
|
|
310
|
+
default:
|
|
311
|
+
return this.clone();
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
_proto.endOf = function endOf(arg) {
|
|
316
|
+
return this.startOf(arg, false);
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
_proto.$set = function $set(units, _int) {
|
|
320
|
+
var _C$D$C$DATE$C$M$C$Y$C;
|
|
321
|
+
|
|
322
|
+
// private set
|
|
323
|
+
var unit = Utils.p(units);
|
|
324
|
+
var utcPad = "set" + (this.$u ? 'UTC' : '');
|
|
325
|
+
var name = (_C$D$C$DATE$C$M$C$Y$C = {}, _C$D$C$DATE$C$M$C$Y$C[D] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[DATE] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[M] = utcPad + "Month", _C$D$C$DATE$C$M$C$Y$C[Y] = utcPad + "FullYear", _C$D$C$DATE$C$M$C$Y$C[H] = utcPad + "Hours", _C$D$C$DATE$C$M$C$Y$C[MIN] = utcPad + "Minutes", _C$D$C$DATE$C$M$C$Y$C[S] = utcPad + "Seconds", _C$D$C$DATE$C$M$C$Y$C[MS] = utcPad + "Milliseconds", _C$D$C$DATE$C$M$C$Y$C)[unit];
|
|
326
|
+
var arg = unit === D ? this.$D + (_int - this.$W) : _int;
|
|
327
|
+
|
|
328
|
+
if (unit === M || unit === Y) {
|
|
329
|
+
// clone is for badMutable plugin
|
|
330
|
+
var date = this.clone().set(DATE, 1);
|
|
331
|
+
date.$d[name](arg);
|
|
332
|
+
date.init();
|
|
333
|
+
this.$d = date.set(DATE, Math.min(this.$D, date.daysInMonth())).$d;
|
|
334
|
+
} else if (name) this.$d[name](arg);
|
|
335
|
+
|
|
336
|
+
this.init();
|
|
337
|
+
return this;
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
_proto.set = function set(string, _int2) {
|
|
341
|
+
return this.clone().$set(string, _int2);
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
_proto.get = function get(unit) {
|
|
345
|
+
return this[Utils.p(unit)]();
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
_proto.add = function add(number, units) {
|
|
349
|
+
var _this2 = this,
|
|
350
|
+
_C$MIN$C$H$C$S$unit;
|
|
351
|
+
|
|
352
|
+
number = Number(number); // eslint-disable-line no-param-reassign
|
|
353
|
+
|
|
354
|
+
var unit = Utils.p(units);
|
|
355
|
+
|
|
356
|
+
var instanceFactorySet = function instanceFactorySet(n) {
|
|
357
|
+
var d = dayjs(_this2);
|
|
358
|
+
return Utils.w(d.date(d.date() + Math.round(n * number)), _this2);
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
if (unit === M) {
|
|
362
|
+
return this.set(M, this.$M + number);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (unit === Y) {
|
|
366
|
+
return this.set(Y, this.$y + number);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (unit === D) {
|
|
370
|
+
return instanceFactorySet(1);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
if (unit === W) {
|
|
374
|
+
return instanceFactorySet(7);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
var step = (_C$MIN$C$H$C$S$unit = {}, _C$MIN$C$H$C$S$unit[MIN] = MILLISECONDS_A_MINUTE, _C$MIN$C$H$C$S$unit[H] = MILLISECONDS_A_HOUR, _C$MIN$C$H$C$S$unit[S] = MILLISECONDS_A_SECOND, _C$MIN$C$H$C$S$unit)[unit] || 1; // ms
|
|
378
|
+
|
|
379
|
+
var nextTimeStamp = this.$d.getTime() + number * step;
|
|
380
|
+
return Utils.w(nextTimeStamp, this);
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
_proto.subtract = function subtract(number, string) {
|
|
384
|
+
return this.add(number * -1, string);
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
_proto.format = function format(formatStr) {
|
|
388
|
+
var _this3 = this;
|
|
389
|
+
|
|
390
|
+
var locale = this.$locale();
|
|
391
|
+
if (!this.isValid()) return locale.invalidDate || INVALID_DATE_STRING;
|
|
392
|
+
var str = formatStr || FORMAT_DEFAULT;
|
|
393
|
+
var zoneStr = Utils.z(this);
|
|
394
|
+
var $H = this.$H,
|
|
395
|
+
$m = this.$m,
|
|
396
|
+
$M = this.$M;
|
|
397
|
+
var weekdays = locale.weekdays,
|
|
398
|
+
months = locale.months,
|
|
399
|
+
meridiem = locale.meridiem;
|
|
400
|
+
|
|
401
|
+
var getShort = function getShort(arr, index, full, length) {
|
|
402
|
+
return arr && (arr[index] || arr(_this3, str)) || full[index].slice(0, length);
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
var get$H = function get$H(num) {
|
|
406
|
+
return Utils.s($H % 12 || 12, num, '0');
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
var meridiemFunc = meridiem || function (hour, minute, isLowercase) {
|
|
410
|
+
var m = hour < 12 ? 'AM' : 'PM';
|
|
411
|
+
return isLowercase ? m.toLowerCase() : m;
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
var matches = function matches(match) {
|
|
415
|
+
switch (match) {
|
|
416
|
+
case 'YY':
|
|
417
|
+
return String(_this3.$y).slice(-2);
|
|
418
|
+
|
|
419
|
+
case 'YYYY':
|
|
420
|
+
return Utils.s(_this3.$y, 4, '0');
|
|
421
|
+
|
|
422
|
+
case 'M':
|
|
423
|
+
return $M + 1;
|
|
424
|
+
|
|
425
|
+
case 'MM':
|
|
426
|
+
return Utils.s($M + 1, 2, '0');
|
|
427
|
+
|
|
428
|
+
case 'MMM':
|
|
429
|
+
return getShort(locale.monthsShort, $M, months, 3);
|
|
430
|
+
|
|
431
|
+
case 'MMMM':
|
|
432
|
+
return getShort(months, $M);
|
|
433
|
+
|
|
434
|
+
case 'D':
|
|
435
|
+
return _this3.$D;
|
|
436
|
+
|
|
437
|
+
case 'DD':
|
|
438
|
+
return Utils.s(_this3.$D, 2, '0');
|
|
439
|
+
|
|
440
|
+
case 'd':
|
|
441
|
+
return String(_this3.$W);
|
|
442
|
+
|
|
443
|
+
case 'dd':
|
|
444
|
+
return getShort(locale.weekdaysMin, _this3.$W, weekdays, 2);
|
|
445
|
+
|
|
446
|
+
case 'ddd':
|
|
447
|
+
return getShort(locale.weekdaysShort, _this3.$W, weekdays, 3);
|
|
448
|
+
|
|
449
|
+
case 'dddd':
|
|
450
|
+
return weekdays[_this3.$W];
|
|
451
|
+
|
|
452
|
+
case 'H':
|
|
453
|
+
return String($H);
|
|
454
|
+
|
|
455
|
+
case 'HH':
|
|
456
|
+
return Utils.s($H, 2, '0');
|
|
457
|
+
|
|
458
|
+
case 'h':
|
|
459
|
+
return get$H(1);
|
|
460
|
+
|
|
461
|
+
case 'hh':
|
|
462
|
+
return get$H(2);
|
|
463
|
+
|
|
464
|
+
case 'a':
|
|
465
|
+
return meridiemFunc($H, $m, true);
|
|
466
|
+
|
|
467
|
+
case 'A':
|
|
468
|
+
return meridiemFunc($H, $m, false);
|
|
469
|
+
|
|
470
|
+
case 'm':
|
|
471
|
+
return String($m);
|
|
472
|
+
|
|
473
|
+
case 'mm':
|
|
474
|
+
return Utils.s($m, 2, '0');
|
|
475
|
+
|
|
476
|
+
case 's':
|
|
477
|
+
return String(_this3.$s);
|
|
478
|
+
|
|
479
|
+
case 'ss':
|
|
480
|
+
return Utils.s(_this3.$s, 2, '0');
|
|
481
|
+
|
|
482
|
+
case 'SSS':
|
|
483
|
+
return Utils.s(_this3.$ms, 3, '0');
|
|
484
|
+
|
|
485
|
+
case 'Z':
|
|
486
|
+
return zoneStr;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return null;
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
return str.replace(REGEX_FORMAT, function (match, $1) {
|
|
493
|
+
return $1 || matches(match) || zoneStr.replace(':', '');
|
|
494
|
+
}); // 'ZZ'
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
_proto.utcOffset = function utcOffset() {
|
|
498
|
+
// Because a bug at FF24, we're rounding the timezone offset around 15 minutes
|
|
499
|
+
// https://github.com/moment/moment/pull/1871
|
|
500
|
+
return -Math.round(this.$d.getTimezoneOffset() / 15) * 15;
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
_proto.diff = function diff(input, units, _float) {
|
|
504
|
+
var _this4 = this;
|
|
505
|
+
|
|
506
|
+
var unit = Utils.p(units);
|
|
507
|
+
var that = dayjs(input);
|
|
508
|
+
var zoneDelta = (that.utcOffset() - this.utcOffset()) * MILLISECONDS_A_MINUTE;
|
|
509
|
+
var diff = this - that;
|
|
510
|
+
|
|
511
|
+
var getMonth = function getMonth() {
|
|
512
|
+
return Utils.m(_this4, that);
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
var result;
|
|
516
|
+
|
|
517
|
+
switch (unit) {
|
|
518
|
+
case Y:
|
|
519
|
+
result = getMonth() / 12;
|
|
520
|
+
break;
|
|
521
|
+
|
|
522
|
+
case M:
|
|
523
|
+
result = getMonth();
|
|
524
|
+
break;
|
|
525
|
+
|
|
526
|
+
case Q:
|
|
527
|
+
result = getMonth() / 3;
|
|
528
|
+
break;
|
|
529
|
+
|
|
530
|
+
case W:
|
|
531
|
+
result = (diff - zoneDelta) / MILLISECONDS_A_WEEK;
|
|
532
|
+
break;
|
|
533
|
+
|
|
534
|
+
case D:
|
|
535
|
+
result = (diff - zoneDelta) / MILLISECONDS_A_DAY;
|
|
536
|
+
break;
|
|
537
|
+
|
|
538
|
+
case H:
|
|
539
|
+
result = diff / MILLISECONDS_A_HOUR;
|
|
540
|
+
break;
|
|
541
|
+
|
|
542
|
+
case MIN:
|
|
543
|
+
result = diff / MILLISECONDS_A_MINUTE;
|
|
544
|
+
break;
|
|
545
|
+
|
|
546
|
+
case S:
|
|
547
|
+
result = diff / MILLISECONDS_A_SECOND;
|
|
548
|
+
break;
|
|
549
|
+
|
|
550
|
+
default:
|
|
551
|
+
result = diff; // milliseconds
|
|
552
|
+
|
|
553
|
+
break;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
return _float ? result : Utils.a(result);
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
_proto.daysInMonth = function daysInMonth() {
|
|
560
|
+
return this.endOf(M).$D;
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
_proto.$locale = function $locale() {
|
|
564
|
+
// get locale object
|
|
565
|
+
return Ls[this.$L];
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
_proto.locale = function locale(preset, object) {
|
|
569
|
+
if (!preset) return this.$L;
|
|
570
|
+
var that = this.clone();
|
|
571
|
+
var nextLocaleName = parseLocale(preset, object, true);
|
|
572
|
+
if (nextLocaleName) that.$L = nextLocaleName;
|
|
573
|
+
return that;
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
_proto.clone = function clone() {
|
|
577
|
+
return Utils.w(this.$d, this);
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
_proto.toDate = function toDate() {
|
|
581
|
+
return new Date(this.valueOf());
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
_proto.toJSON = function toJSON() {
|
|
585
|
+
return this.isValid() ? this.toISOString() : null;
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
_proto.toISOString = function toISOString() {
|
|
589
|
+
// ie 8 return
|
|
590
|
+
// new Dayjs(this.valueOf() + this.$d.getTimezoneOffset() * 60000)
|
|
591
|
+
// .format('YYYY-MM-DDTHH:mm:ss.SSS[Z]')
|
|
592
|
+
return this.$d.toISOString();
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
_proto.toString = function toString() {
|
|
596
|
+
return this.$d.toUTCString();
|
|
597
|
+
};
|
|
598
|
+
|
|
599
|
+
return Dayjs;
|
|
600
|
+
}();
|
|
601
|
+
|
|
602
|
+
var proto = Dayjs.prototype;
|
|
603
|
+
dayjs.prototype = proto;
|
|
604
|
+
[['$ms', MS], ['$s', S], ['$m', MIN], ['$H', H], ['$W', D], ['$M', M], ['$y', Y], ['$D', DATE]].forEach(function (g) {
|
|
605
|
+
proto[g[1]] = function (input) {
|
|
606
|
+
return this.$g(input, g[0], g[1]);
|
|
607
|
+
};
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
dayjs.extend = function (plugin, option) {
|
|
611
|
+
if (!plugin.$i) {
|
|
612
|
+
// install plugin only once
|
|
613
|
+
plugin(option, Dayjs, dayjs);
|
|
614
|
+
plugin.$i = true;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
return dayjs;
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
dayjs.locale = parseLocale;
|
|
621
|
+
dayjs.isDayjs = isDayjs;
|
|
622
|
+
|
|
623
|
+
dayjs.unix = function (timestamp) {
|
|
624
|
+
return dayjs(timestamp * 1e3);
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
dayjs.en = Ls[L];
|
|
628
|
+
dayjs.Ls = Ls;
|
|
629
|
+
dayjs.p = {};
|
|
630
|
+
|
|
631
|
+
export default dayjs;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"imports": {
|
|
3
|
-
"@internetarchive/ia-activity-indicator
|
|
3
|
+
"@internetarchive/ia-activity-indicator": "./@internetarchive/ia-activity-indicator.js",
|
|
4
|
+
"dayjs/esm": "./dayjs/esm.js",
|
|
5
|
+
"dayjs/esm/plugin/customParseFormat": "./dayjs/esm/plugin/customParseFormat.js",
|
|
4
6
|
"lit": "./lit.js",
|
|
5
7
|
"lit/decorators.js": "./lit/decorators.js",
|
|
6
8
|
"lit/directives/live.js": "./lit/directives/live.js"
|
|
@@ -1,27 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/
|
|
6
|
-
const n=n=>e=>"function"==typeof e?((n,e)=>(window.customElements.define(n,e),e))(n,e):((n,e)=>{const{kind:t,elements:i}=e;return {kind:t,elements:i,finisher(e){window.customElements.define(n,e);}}})(n,e);
|
|
1
|
+
import { n } from '../common/query-assigned-elements-61aefe32.js';
|
|
2
|
+
export { e as customElement, n as property } from '../common/query-assigned-elements-61aefe32.js';
|
|
7
3
|
|
|
8
4
|
/**
|
|
9
5
|
* @license
|
|
10
6
|
* Copyright 2017 Google LLC
|
|
11
7
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
-
*/
|
|
13
|
-
const i=(i,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(n){n.createProperty(e.key,i);}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this));},finisher(n){n.createProperty(e.key,i);}};function e(e){return (n,t)=>void 0!==t?((i,e,n)=>{e.constructor.createProperty(n,i);})(e,n,t):i(e,n)}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @license
|
|
17
|
-
* Copyright 2017 Google LLC
|
|
18
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/function t(t){return e({...t,state:!0})}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @license
|
|
23
|
-
* Copyright 2021 Google LLC
|
|
24
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
-
*/var n$1;const e$1=null!=(null===(n$1=window.HTMLSlotElement)||void 0===n$1?void 0:n$1.prototype.assignedElements)?(o,n)=>o.assignedElements(n):(o,n)=>o.assignedNodes(n).filter((o=>o.nodeType===Node.ELEMENT_NODE));
|
|
8
|
+
*/function t(t){return n({...t,state:!0})}
|
|
26
9
|
|
|
27
|
-
export {
|
|
10
|
+
export { t as state };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T, A } from '../../common/lit-html-a4f3a51c.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
@@ -11,12 +11,12 @@ const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e
|
|
|
11
11
|
* @license
|
|
12
12
|
* Copyright 2020 Google LLC
|
|
13
13
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
14
|
-
*/const e$1=o=>void 0===o.strings,
|
|
14
|
+
*/const e$1=o=>void 0===o.strings,s={},a=(o,l=s)=>o._$AH=l;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @license
|
|
18
18
|
* Copyright 2020 Google LLC
|
|
19
19
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
20
|
-
*/const l=e(class extends i{constructor(r){if(super(r),r.type!==t.PROPERTY&&r.type!==t.ATTRIBUTE&&r.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!e$1(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(i,[t$1]){if(t$1===
|
|
20
|
+
*/const l=e(class extends i{constructor(r){if(super(r),r.type!==t.PROPERTY&&r.type!==t.ATTRIBUTE&&r.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!e$1(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(i,[t$1]){if(t$1===T||t$1===A)return t$1;const o=i.element,l=i.name;if(i.type===t.PROPERTY){if(t$1===o[l])return T}else if(i.type===t.BOOLEAN_ATTRIBUTE){if(!!t$1===o.hasAttribute(l))return T}else if(i.type===t.ATTRIBUTE&&o.getAttribute(l)===t$1+"")return T;return a(i),t$1}});
|
|
21
21
|
|
|
22
22
|
export { l as live };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { s as LitElement,
|
|
2
|
-
export {
|
|
1
|
+
export { s as LitElement, i as css } from './common/lit-element-4616b61d.js';
|
|
2
|
+
export { x as html, A as nothing, b as svg } from './common/lit-html-a4f3a51c.js';
|