@internetarchive/histogram-date-range 0.0.11-beta → 0.1.2-alpha
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/demo/index.css +23 -0
- package/demo/index.html +51 -42
- package/dist/src/histogram-date-range.d.ts +22 -13
- package/dist/src/histogram-date-range.js +134 -70
- package/dist/src/histogram-date-range.js.map +1 -1
- package/dist/test/histogram-date-range.test.js +130 -34
- package/dist/test/histogram-date-range.test.js.map +1 -1
- package/docs/_snowpack/pkg/@internetarchive/ia-activity-indicator/ia-activity-indicator.js +9 -2534
- package/docs/_snowpack/pkg/common/lit-element-3254fb50.js +22 -0
- package/docs/_snowpack/pkg/common/lit-html-1d707ff6.js +8 -0
- package/docs/_snowpack/pkg/dayjs/esm/index.js +3 -3
- package/docs/_snowpack/pkg/dayjs/esm/plugin/customParseFormat.js +342 -0
- package/docs/_snowpack/pkg/import-map.json +1 -0
- package/docs/_snowpack/pkg/lit/decorators.js +8 -2
- package/docs/_snowpack/pkg/lit/directives/live.js +4 -4
- package/docs/_snowpack/pkg/lit.js +2 -23
- package/docs/demo/index.css +23 -0
- package/docs/demo/index.html +51 -42
- package/docs/dist/src/histogram-date-range.js +95 -51
- package/package.json +21 -20
- package/src/histogram-date-range.ts +176 -76
- package/test/histogram-date-range.test.ts +172 -38
- package/docs/_snowpack/env.js +0 -3
- package/docs/_snowpack/pkg/common/lit-html-e67c9f49.js +0 -8
- package/types/static.d.ts +0 -4
|
@@ -13,9 +13,8 @@ const subject = html`
|
|
|
13
13
|
tooltipWidth="140"
|
|
14
14
|
height="50"
|
|
15
15
|
dateFormat="M/D/YYYY"
|
|
16
|
-
updateDelay="10"
|
|
17
16
|
minDate="1900"
|
|
18
|
-
maxDate="
|
|
17
|
+
maxDate="12/4/2020"
|
|
19
18
|
bins="[33, 1, 100]"
|
|
20
19
|
>
|
|
21
20
|
</histogram-date-range>
|
|
@@ -67,18 +66,17 @@ describe('HistogramDateRange', () => {
|
|
|
67
66
|
// valid min date
|
|
68
67
|
minDateInput.value = '1950';
|
|
69
68
|
minDateInput.dispatchEvent(new Event('blur'));
|
|
70
|
-
await aTimeout(20);
|
|
71
69
|
|
|
72
70
|
expect(Math.floor(el.minSliderX)).to.eq(84);
|
|
73
71
|
expect(el.minSelectedDate).to.eq('1/1/1950'); // set to correct format
|
|
74
72
|
|
|
75
73
|
// attempt to set date earlier than first item
|
|
76
|
-
minDateInput.value = '
|
|
74
|
+
minDateInput.value = '10/1/1850';
|
|
77
75
|
minDateInput.dispatchEvent(new Event('blur'));
|
|
78
|
-
await aTimeout(100);
|
|
79
76
|
|
|
80
77
|
expect(Math.floor(el.minSliderX)).to.eq(SLIDER_WIDTH); // leftmost valid position
|
|
81
|
-
|
|
78
|
+
// allow date value less than slider range
|
|
79
|
+
expect(el.minSelectedDate).to.eq('10/1/1850');
|
|
82
80
|
|
|
83
81
|
/* -------------------------- maximum (right) slider ------------------------- */
|
|
84
82
|
expect(el.maxSliderX).to.eq(WIDTH - SLIDER_WIDTH);
|
|
@@ -87,20 +85,21 @@ describe('HistogramDateRange', () => {
|
|
|
87
85
|
) as HTMLInputElement;
|
|
88
86
|
|
|
89
87
|
// set valid max date
|
|
90
|
-
maxDateInput.value = '
|
|
88
|
+
maxDateInput.value = '3/12/1975';
|
|
91
89
|
maxDateInput.dispatchEvent(new Event('blur'));
|
|
92
|
-
await
|
|
90
|
+
await el.updateComplete;
|
|
93
91
|
|
|
94
92
|
expect(Math.floor(el.maxSliderX)).to.eq(121);
|
|
95
93
|
expect(maxDateInput.value).to.eq('3/12/1975');
|
|
96
94
|
|
|
97
95
|
// attempt to set date later than last item
|
|
98
|
-
maxDateInput.value = '
|
|
96
|
+
maxDateInput.value = '12/31/2199';
|
|
99
97
|
maxDateInput.dispatchEvent(new Event('blur'));
|
|
100
|
-
await
|
|
98
|
+
await el.updateComplete;
|
|
101
99
|
|
|
102
100
|
expect(el.maxSliderX).to.eq(WIDTH - SLIDER_WIDTH); // rightmost valid position
|
|
103
|
-
|
|
101
|
+
// allow date value greater than slider range
|
|
102
|
+
expect(maxDateInput.value).to.eq('12/31/2199');
|
|
104
103
|
});
|
|
105
104
|
|
|
106
105
|
it('handles invalid date inputs', async () => {
|
|
@@ -111,9 +110,9 @@ describe('HistogramDateRange', () => {
|
|
|
111
110
|
'#date-min'
|
|
112
111
|
) as HTMLInputElement;
|
|
113
112
|
|
|
114
|
-
minDateInput.value = '
|
|
113
|
+
minDateInput.value = '5/17/1961';
|
|
115
114
|
minDateInput.dispatchEvent(new Event('blur'));
|
|
116
|
-
await
|
|
115
|
+
await el.updateComplete;
|
|
117
116
|
|
|
118
117
|
expect(Math.floor(el.minSliderX)).to.eq(101);
|
|
119
118
|
expect(minDateInput.value).to.eq('5/17/1961');
|
|
@@ -121,7 +120,7 @@ describe('HistogramDateRange', () => {
|
|
|
121
120
|
// enter invalid value
|
|
122
121
|
minDateInput.value = 'invalid';
|
|
123
122
|
minDateInput.dispatchEvent(new Event('blur'));
|
|
124
|
-
await
|
|
123
|
+
await el.updateComplete;
|
|
125
124
|
|
|
126
125
|
expect(Math.floor(el.minSliderX)).to.eq(101); // does not move
|
|
127
126
|
expect(minDateInput.value).to.eq('5/17/1961'); // resets back to previous date
|
|
@@ -138,8 +137,8 @@ describe('HistogramDateRange', () => {
|
|
|
138
137
|
// enter invalid value
|
|
139
138
|
maxDateInput.value = 'Abc 12, 1YYY';
|
|
140
139
|
maxDateInput.dispatchEvent(new Event('blur'));
|
|
140
|
+
await el.updateComplete;
|
|
141
141
|
|
|
142
|
-
await aTimeout(20);
|
|
143
142
|
expect(Math.floor(el.maxSliderX)).to.eq(WIDTH - SLIDER_WIDTH); // does not move
|
|
144
143
|
expect(maxDateInput.value).to.eq('12/4/2020'); // resets back to previous date
|
|
145
144
|
});
|
|
@@ -162,15 +161,16 @@ describe('HistogramDateRange', () => {
|
|
|
162
161
|
|
|
163
162
|
// pointer down
|
|
164
163
|
minSlider.dispatchEvent(new PointerEvent('pointerdown'));
|
|
165
|
-
await
|
|
164
|
+
await el.updateComplete;
|
|
165
|
+
|
|
166
166
|
// cursor changes to 'grab'
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
);
|
|
167
|
+
const classList = minSlider.classList;
|
|
168
|
+
expect(classList.contains('draggable')).to.be.true;
|
|
169
|
+
expect(classList.contains('dragging')).to.be.true;
|
|
170
170
|
|
|
171
171
|
// slide to right
|
|
172
172
|
window.dispatchEvent(new PointerEvent('pointermove', { clientX: 70 }));
|
|
173
|
-
await
|
|
173
|
+
await el.updateComplete;
|
|
174
174
|
|
|
175
175
|
// slider has moved
|
|
176
176
|
expect(Math.round(minSlider.getBoundingClientRect().x)).to.eq(168);
|
|
@@ -179,7 +179,8 @@ describe('HistogramDateRange', () => {
|
|
|
179
179
|
|
|
180
180
|
// stop dragging
|
|
181
181
|
window.dispatchEvent(new PointerEvent('pointerup'));
|
|
182
|
-
await
|
|
182
|
+
await el.updateComplete;
|
|
183
|
+
|
|
183
184
|
// cursor returns to normal
|
|
184
185
|
expect(Array.from(container.classList)).not.to.include('dragging');
|
|
185
186
|
|
|
@@ -195,18 +196,18 @@ describe('HistogramDateRange', () => {
|
|
|
195
196
|
// slide to left
|
|
196
197
|
maxSlider.dispatchEvent(new PointerEvent('pointerdown', { clientX: 195 }));
|
|
197
198
|
window.dispatchEvent(new PointerEvent('pointermove', { clientX: 160 }));
|
|
198
|
-
await
|
|
199
|
+
await el.updateComplete;
|
|
199
200
|
|
|
200
201
|
// slider has moved
|
|
201
202
|
expect(Math.round(maxSlider.getBoundingClientRect().x)).to.eq(268);
|
|
202
203
|
// max date is updated
|
|
203
204
|
expect(maxDateInput.value).to.eq('10/8/2000');
|
|
204
|
-
await
|
|
205
|
+
await el.updateComplete;
|
|
205
206
|
|
|
206
207
|
// try to slide min slider past max slider
|
|
207
208
|
minSlider.dispatchEvent(new PointerEvent('pointerdown', { clientX: 62 }));
|
|
208
209
|
window.dispatchEvent(new PointerEvent('pointermove', { clientX: 190 }));
|
|
209
|
-
await
|
|
210
|
+
await el.updateComplete;
|
|
210
211
|
|
|
211
212
|
// slider moves all the way to meet the right slider
|
|
212
213
|
expect(Math.round(minSlider.getBoundingClientRect().x)).to.eq(258);
|
|
@@ -214,32 +215,65 @@ describe('HistogramDateRange', () => {
|
|
|
214
215
|
// try to slide max slider past min slider
|
|
215
216
|
maxSlider.dispatchEvent(new PointerEvent('pointerdown', { clientX: 120 }));
|
|
216
217
|
window.dispatchEvent(new PointerEvent('pointermove', { clientX: 50 }));
|
|
217
|
-
await
|
|
218
|
+
await el.updateComplete;
|
|
218
219
|
expect(Math.round(maxSlider.getBoundingClientRect().x)).to.eq(268); // max slider didn't move
|
|
219
220
|
});
|
|
220
221
|
|
|
221
|
-
it(
|
|
222
|
+
it("emits a custom event when the element's date range changes", async () => {
|
|
222
223
|
const el = await createCustomElementInHTMLContainer();
|
|
224
|
+
el.updateDelay = 30; // set debounce delay of 30ms
|
|
225
|
+
|
|
223
226
|
const minDateInput = el.shadowRoot?.querySelector(
|
|
224
227
|
'#date-min'
|
|
225
228
|
) as HTMLInputElement;
|
|
226
|
-
const
|
|
227
|
-
el,
|
|
228
|
-
'histogramDateRangeUpdated'
|
|
229
|
-
);
|
|
229
|
+
const updateEventPromise = oneEvent(el, 'histogramDateRangeUpdated');
|
|
230
230
|
|
|
231
231
|
// simulate typing a new value into input
|
|
232
232
|
minDateInput.value = '1955';
|
|
233
233
|
minDateInput.dispatchEvent(new Event('blur'));
|
|
234
234
|
|
|
235
|
+
// will wait longer than debounce delay
|
|
236
|
+
const { detail } = await updateEventPromise;
|
|
235
237
|
// verify that event is emitted
|
|
236
|
-
const { detail } = await dateRangeUpdatedEventListener;
|
|
237
238
|
expect(detail.minDate).to.equal('1/1/1955');
|
|
238
239
|
expect(detail.maxDate).to.equal('12/4/2020');
|
|
240
|
+
|
|
241
|
+
let eventCount = 0;
|
|
242
|
+
el.addEventListener('histogramDateRangeUpdated', () => (eventCount += 1));
|
|
243
|
+
|
|
244
|
+
// events are not sent if no change since the last event that was sent
|
|
245
|
+
minDateInput.value = '1955';
|
|
246
|
+
minDateInput.dispatchEvent(new Event('blur'));
|
|
247
|
+
await aTimeout(60); // wait longer than debounce delay
|
|
248
|
+
expect(eventCount).to.equal(0);
|
|
249
|
+
|
|
250
|
+
const updateEventPromise2 = oneEvent(el, 'histogramDateRangeUpdated');
|
|
251
|
+
|
|
252
|
+
// with the debounce, multiple quick changes only result in one event sent
|
|
253
|
+
minDateInput.value = '1965';
|
|
254
|
+
minDateInput.dispatchEvent(new Event('blur'));
|
|
255
|
+
await aTimeout(10); // wait less than the debounce delay
|
|
256
|
+
|
|
257
|
+
minDateInput.dispatchEvent(new Event('focus'));
|
|
258
|
+
minDateInput.value = '1975';
|
|
259
|
+
minDateInput.dispatchEvent(new Event('blur'));
|
|
260
|
+
await aTimeout(10);
|
|
261
|
+
|
|
262
|
+
minDateInput.dispatchEvent(new Event('focus'));
|
|
263
|
+
minDateInput.value = '1985';
|
|
264
|
+
minDateInput.dispatchEvent(new Event('blur'));
|
|
265
|
+
await aTimeout(10);
|
|
266
|
+
|
|
267
|
+
const event2 = await updateEventPromise2;
|
|
268
|
+
expect(event2.detail.minDate).to.equal('1/1/1985');
|
|
269
|
+
expect(eventCount).to.equal(1); // only one event was fired
|
|
239
270
|
});
|
|
240
271
|
|
|
241
272
|
it('shows/hides tooltip when hovering over (or pointing at) a bar', async () => {
|
|
242
273
|
const el = await createCustomElementInHTMLContainer();
|
|
274
|
+
// include a number which will require commas (1,000,000)
|
|
275
|
+
el.bins = [1000000, 1, 100];
|
|
276
|
+
await aTimeout(10);
|
|
243
277
|
const bars = (el.shadowRoot?.querySelectorAll(
|
|
244
278
|
'.bar'
|
|
245
279
|
) as unknown) as SVGRectElement[];
|
|
@@ -248,19 +282,21 @@ describe('HistogramDateRange', () => {
|
|
|
248
282
|
|
|
249
283
|
// hover
|
|
250
284
|
bars[0].dispatchEvent(new PointerEvent('pointerenter'));
|
|
251
|
-
await
|
|
252
|
-
expect(tooltip.innerText).to.match(
|
|
285
|
+
await el.updateComplete;
|
|
286
|
+
expect(tooltip.innerText).to.match(
|
|
287
|
+
/^1,000,000 items\n1\/1\/1900 - 4\/23\/1940/
|
|
288
|
+
);
|
|
253
289
|
expect(getComputedStyle(tooltip).display).to.eq('block');
|
|
254
290
|
|
|
255
291
|
// leave
|
|
256
292
|
bars[0].dispatchEvent(new PointerEvent('pointerleave'));
|
|
257
|
-
await
|
|
293
|
+
await el.updateComplete;
|
|
258
294
|
expect(getComputedStyle(tooltip).display).to.eq('none');
|
|
259
295
|
expect(tooltip.innerText).to.eq('');
|
|
260
296
|
|
|
261
297
|
// ensure singular item is not pluralized
|
|
262
298
|
bars[1].dispatchEvent(new PointerEvent('pointerenter'));
|
|
263
|
-
await
|
|
299
|
+
await el.updateComplete;
|
|
264
300
|
expect(tooltip.innerText).to.match(/^1 item\n4\/23\/1940 - 8\/13\/1980/);
|
|
265
301
|
});
|
|
266
302
|
|
|
@@ -276,11 +312,11 @@ describe('HistogramDateRange', () => {
|
|
|
276
312
|
// pointer down and slide right
|
|
277
313
|
minSlider.dispatchEvent(new PointerEvent('pointerdown'));
|
|
278
314
|
window.dispatchEvent(new PointerEvent('pointermove', { clientX: 100 }));
|
|
279
|
-
await
|
|
315
|
+
await el.updateComplete;
|
|
280
316
|
|
|
281
317
|
// hover over bar
|
|
282
318
|
bars[0].dispatchEvent(new PointerEvent('pointerenter'));
|
|
283
|
-
await
|
|
319
|
+
await el.updateComplete;
|
|
284
320
|
// tooltip display is suppressed while dragging
|
|
285
321
|
expect(tooltip.style.display).to.eq('');
|
|
286
322
|
});
|
|
@@ -315,6 +351,70 @@ describe('HistogramDateRange', () => {
|
|
|
315
351
|
expect(maxDateInput.value).to.eq('2019');
|
|
316
352
|
});
|
|
317
353
|
|
|
354
|
+
it('extends the selected range when the histogram is clicked outside of the current range', async () => {
|
|
355
|
+
const el = await fixture<HistogramDateRange>(
|
|
356
|
+
html`
|
|
357
|
+
<histogram-date-range
|
|
358
|
+
minDate="1900"
|
|
359
|
+
maxDate="2020"
|
|
360
|
+
minSelectedDate="1950"
|
|
361
|
+
maxSelectedDate="1955"
|
|
362
|
+
bins="[33, 1, 1, 1, 10, 10, 1, 1, 1, 50, 100]"
|
|
363
|
+
>
|
|
364
|
+
</histogram-date-range>
|
|
365
|
+
`
|
|
366
|
+
);
|
|
367
|
+
|
|
368
|
+
const leftBarToClick = Array.from(
|
|
369
|
+
el.shadowRoot?.querySelectorAll('.bar') as NodeList
|
|
370
|
+
)[1]; // click on second bar to the left
|
|
371
|
+
|
|
372
|
+
leftBarToClick.dispatchEvent(new Event('click'));
|
|
373
|
+
await el.updateComplete;
|
|
374
|
+
debugger;
|
|
375
|
+
expect(el.minSelectedDate).to.eq('1910'); // range was extended to left
|
|
376
|
+
|
|
377
|
+
const rightBarToClick = Array.from(
|
|
378
|
+
el.shadowRoot?.querySelectorAll('.bar') as NodeList
|
|
379
|
+
)[8]; // click on second bar from the right
|
|
380
|
+
|
|
381
|
+
rightBarToClick.dispatchEvent(new Event('click'));
|
|
382
|
+
expect(el.maxSelectedDate).to.eq('1998'); // range was extended to right
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
it('narrows the selected range when the histogram is clicked inside of the current range', async () => {
|
|
386
|
+
const el = await fixture<HistogramDateRange>(
|
|
387
|
+
html`
|
|
388
|
+
<histogram-date-range
|
|
389
|
+
minDate="1900"
|
|
390
|
+
maxDate="2020"
|
|
391
|
+
minSelectedDate="1900"
|
|
392
|
+
maxSelectedDate="2020"
|
|
393
|
+
bins="[33, 1, 1, 1, 10, 10, 1, 1, 1, 50, 100]"
|
|
394
|
+
>
|
|
395
|
+
</histogram-date-range>
|
|
396
|
+
`
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
///////////////////////////////////////////////
|
|
400
|
+
// NB: the slider nearest the clicked bar moves
|
|
401
|
+
///////////////////////////////////////////////
|
|
402
|
+
|
|
403
|
+
const leftBarToClick = Array.from(
|
|
404
|
+
el.shadowRoot?.querySelectorAll('.bar') as NodeList
|
|
405
|
+
)[3]; // click on fourth bar to the left
|
|
406
|
+
|
|
407
|
+
leftBarToClick.dispatchEvent(new Event('click'));
|
|
408
|
+
expect(el.minSelectedDate).to.eq('1932'); // range was extended to the right
|
|
409
|
+
|
|
410
|
+
const rightBarToClick = Array.from(
|
|
411
|
+
el.shadowRoot?.querySelectorAll('.bar') as NodeList
|
|
412
|
+
)[8]; // click on second bar from the right
|
|
413
|
+
|
|
414
|
+
rightBarToClick.dispatchEvent(new Event('click'));
|
|
415
|
+
expect(el.maxSelectedDate).to.eq('1998'); // range was extended to the left
|
|
416
|
+
});
|
|
417
|
+
|
|
318
418
|
it('handles invalid pre-selected range by defaulting to overall max and min', async () => {
|
|
319
419
|
const el = await fixture<HistogramDateRange>(
|
|
320
420
|
html`
|
|
@@ -331,12 +431,14 @@ describe('HistogramDateRange', () => {
|
|
|
331
431
|
const minDateInput = el.shadowRoot?.querySelector(
|
|
332
432
|
'#date-min'
|
|
333
433
|
) as HTMLInputElement;
|
|
434
|
+
// malformed min date defaults to overall min
|
|
334
435
|
expect(minDateInput.value).to.eq('1900');
|
|
335
436
|
|
|
336
437
|
const maxDateInput = el.shadowRoot?.querySelector(
|
|
337
438
|
'#date-max'
|
|
338
439
|
) as HTMLInputElement;
|
|
339
|
-
|
|
440
|
+
// well-formed max date is allowed
|
|
441
|
+
expect(maxDateInput.value).to.eq('5000');
|
|
340
442
|
});
|
|
341
443
|
|
|
342
444
|
it('handles missing data', async () => {
|
|
@@ -357,6 +459,20 @@ describe('HistogramDateRange', () => {
|
|
|
357
459
|
expect(el.shadowRoot?.innerHTML).to.contain('no data available');
|
|
358
460
|
});
|
|
359
461
|
|
|
462
|
+
it('correctly displays data consisting of a single bin', async () => {
|
|
463
|
+
const el = await fixture<HistogramDateRange>(
|
|
464
|
+
html`
|
|
465
|
+
<histogram-date-range minDate="2020" maxDate="2020" bins="[50]">
|
|
466
|
+
</histogram-date-range>
|
|
467
|
+
`
|
|
468
|
+
);
|
|
469
|
+
const bars = (el.shadowRoot?.querySelectorAll(
|
|
470
|
+
'.bar'
|
|
471
|
+
) as unknown) as SVGRectElement[];
|
|
472
|
+
const heights = Array.from(bars).map(b => b.height.baseVal.value);
|
|
473
|
+
expect(heights).to.eql([157]);
|
|
474
|
+
});
|
|
475
|
+
|
|
360
476
|
it('has a disabled state', async () => {
|
|
361
477
|
const el = await fixture<HistogramDateRange>(
|
|
362
478
|
html`
|
|
@@ -374,6 +490,24 @@ describe('HistogramDateRange', () => {
|
|
|
374
490
|
?.querySelector('.inner-container')
|
|
375
491
|
?.classList.contains('disabled')
|
|
376
492
|
).to.eq(true);
|
|
493
|
+
|
|
494
|
+
const minSlider = el.shadowRoot?.querySelector('#slider-min') as SVGElement;
|
|
495
|
+
|
|
496
|
+
expect(Math.round(minSlider.getBoundingClientRect().x)).to.eq(8); // initial state
|
|
497
|
+
|
|
498
|
+
// attempt to slide to right
|
|
499
|
+
minSlider.dispatchEvent(new PointerEvent('pointerdown'));
|
|
500
|
+
await el.updateComplete;
|
|
501
|
+
|
|
502
|
+
// cursor is not draggable if disabled
|
|
503
|
+
expect(Array.from(minSlider.classList).join(' ')).to.eq('');
|
|
504
|
+
|
|
505
|
+
// attempt to slide to right
|
|
506
|
+
window.dispatchEvent(new PointerEvent('pointermove', { clientX: 70 }));
|
|
507
|
+
await el.updateComplete;
|
|
508
|
+
|
|
509
|
+
// slider does not moved if element disabled
|
|
510
|
+
expect(Math.round(minSlider.getBoundingClientRect().x)).to.eq(8);
|
|
377
511
|
});
|
|
378
512
|
|
|
379
513
|
it('has a loading state with an activity indicator', async () => {
|
package/docs/_snowpack/env.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/
|
|
6
|
-
var t,i,s,e;const o=globalThis.trustedTypes,l=o?o.createPolicy("lit-html",{createHTML:t=>t}):void 0,n=`lit$${(Math.random()+"").slice(9)}$`,h="?"+n,r=`<${h}>`,u=document,c=(t="")=>u.createComment(t),d=t=>null===t||"object"!=typeof t&&"function"!=typeof t,v=Array.isArray,a=t=>{var i;return v(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])},f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m=/>/g,p=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,$=/'/g,g=/"/g,y=/^(?:script|style|textarea)$/i,b=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),T=b(1),x=b(2),w=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),P=new WeakMap,V=(t,i,s)=>{var e,o;const l=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let n=l._$litPart$;if(void 0===n){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;l._$litPart$=n=new C(i.insertBefore(c(),t),t,void 0,s);}return n.I(t),n},E=u.createTreeWalker(u,129,null,!1),M=(t,i)=>{const s=t.length-1,e=[];let o,h=2===i?"<svg>":"",u=f;for(let i=0;i<s;i++){const s=t[i];let l,c,d=-1,v=0;for(;v<s.length&&(u.lastIndex=v,c=u.exec(s),null!==c);)v=u.lastIndex,u===f?"!--"===c[1]?u=_:void 0!==c[1]?u=m:void 0!==c[2]?(y.test(c[2])&&(o=RegExp("</"+c[2],"g")),u=p):void 0!==c[3]&&(u=p):u===p?">"===c[0]?(u=null!=o?o:f,d=-1):void 0===c[1]?d=-2:(d=u.lastIndex-c[2].length,l=c[1],u=void 0===c[3]?p:'"'===c[3]?g:$):u===g||u===$?u=p:u===_||u===m?u=f:(u=p,o=void 0);const a=u===p&&t[i+1].startsWith("/>")?" ":"";h+=u===f?s+r:d>=0?(e.push(l),s.slice(0,d)+"$lit$"+s.slice(d)+n+a):s+n+(-2===d?(e.push(void 0),i):a);}const c=h+(t[s]||"<?>")+(2===i?"</svg>":"");return [void 0!==l?l.createHTML(c):c,e]};class N{constructor({strings:t,_$litType$:i},s){let e;this.parts=[];let l=0,r=0;const u=t.length-1,d=this.parts,[v,a]=M(t,i);if(this.el=N.createElement(v,s),E.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes);}for(;null!==(e=E.nextNode())&&d.length<u;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(n)){const s=a[r++];if(t.push(i),void 0!==s){const t=e.getAttribute(s.toLowerCase()+"$lit$").split(n),i=/([.?@])?(.*)/.exec(s);d.push({type:1,index:l,name:i[2],strings:t,ctor:"."===i[1]?I:"?"===i[1]?L:"@"===i[1]?R:H});}else d.push({type:6,index:l});}for(const i of t)e.removeAttribute(i);}if(y.test(e.tagName)){const t=e.textContent.split(n),i=t.length-1;if(i>0){e.textContent=o?o.emptyScript:"";for(let s=0;s<i;s++)e.append(t[s],c()),E.nextNode(),d.push({type:2,index:++l});e.append(t[i],c());}}}else if(8===e.nodeType)if(e.data===h)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=e.data.indexOf(n,t+1));)d.push({type:7,index:l}),t+=n.length-1;}l++;}}static createElement(t,i){const s=u.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){var o,l,n,h;if(i===w)return i;let r=void 0!==e?null===(o=s.Σi)||void 0===o?void 0:o[e]:s.Σo;const u=d(i)?void 0:i._$litDirective$;return (null==r?void 0:r.constructor)!==u&&(null===(l=null==r?void 0:r.O)||void 0===l||l.call(r,!1),void 0===u?r=void 0:(r=new u(t),r.T(t,s,e)),void 0!==e?(null!==(n=(h=s).Σi)&&void 0!==n?n:h.Σi=[])[e]=r:s.Σo=r),void 0!==r&&(i=S(t,r.S(t,i.values),r,e)),i}class k{constructor(t,i){this.l=[],this.N=void 0,this.D=t,this.M=i;}u(t){var i;const{el:{content:s},parts:e}=this.D,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:u).importNode(s,!0);E.currentNode=o;let l=E.nextNode(),n=0,h=0,r=e[0];for(;void 0!==r;){if(n===r.index){let i;2===r.type?i=new C(l,l.nextSibling,this,t):1===r.type?i=new r.ctor(l,r.name,r.strings,this,t):6===r.type&&(i=new z(l,this,t)),this.l.push(i),r=e[++h];}n!==(null==r?void 0:r.index)&&(l=E.nextNode(),n++);}return o}v(t){let i=0;for(const s of this.l)void 0!==s&&(void 0!==s.strings?(s.I(t,s,i),i+=s.strings.length-2):s.I(t[i])),i++;}}class C{constructor(t,i,s,e){this.type=2,this.N=void 0,this.A=t,this.B=i,this.M=s,this.options=e;}setConnected(t){var i;null===(i=this.P)||void 0===i||i.call(this,t);}get parentNode(){return this.A.parentNode}get startNode(){return this.A}get endNode(){return this.B}I(t,i=this){t=S(this,t,i),d(t)?t===A||null==t||""===t?(this.H!==A&&this.R(),this.H=A):t!==this.H&&t!==w&&this.m(t):void 0!==t._$litType$?this._(t):void 0!==t.nodeType?this.$(t):a(t)?this.g(t):this.m(t);}k(t,i=this.B){return this.A.parentNode.insertBefore(t,i)}$(t){this.H!==t&&(this.R(),this.H=this.k(t));}m(t){const i=this.A.nextSibling;null!==i&&3===i.nodeType&&(null===this.B?null===i.nextSibling:i===this.B.previousSibling)?i.data=t:this.$(u.createTextNode(t)),this.H=t;}_(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this.C(t):(void 0===e.el&&(e.el=N.createElement(e.h,this.options)),e);if((null===(i=this.H)||void 0===i?void 0:i.D)===o)this.H.v(s);else {const t=new k(o,this),i=t.u(this.options);t.v(s),this.$(i),this.H=t;}}C(t){let i=P.get(t.strings);return void 0===i&&P.set(t.strings,i=new N(t)),i}g(t){v(this.H)||(this.H=[],this.R());const i=this.H;let s,e=0;for(const o of t)e===i.length?i.push(s=new C(this.k(c()),this.k(c()),this,this.options)):s=i[e],s.I(o),e++;e<i.length&&(this.R(s&&s.B.nextSibling,e),i.length=e);}R(t=this.A.nextSibling,i){var s;for(null===(s=this.P)||void 0===s||s.call(this,!1,!0,i);t&&t!==this.B;){const i=t.nextSibling;t.remove(),t=i;}}}class H{constructor(t,i,s,e,o){this.type=1,this.H=A,this.N=void 0,this.V=void 0,this.element=t,this.name=i,this.M=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this.H=Array(s.length-1).fill(A),this.strings=s):this.H=A;}get tagName(){return this.element.tagName}I(t,i=this,s,e){const o=this.strings;let l=!1;if(void 0===o)t=S(this,t,i,0),l=!d(t)||t!==this.H&&t!==w,l&&(this.H=t);else {const e=t;let n,h;for(t=o[0],n=0;n<o.length-1;n++)h=S(this,e[s+n],i,n),h===w&&(h=this.H[n]),l||(l=!d(h)||h!==this.H[n]),h===A?t=A:t!==A&&(t+=(null!=h?h:"")+o[n+1]),this.H[n]=h;}l&&!e&&this.W(t);}W(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"");}}class I extends H{constructor(){super(...arguments),this.type=3;}W(t){this.element[this.name]=t===A?void 0:t;}}class L extends H{constructor(){super(...arguments),this.type=4;}W(t){t&&t!==A?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name);}}class R extends H{constructor(){super(...arguments),this.type=5;}I(t,i=this){var s;if((t=null!==(s=S(this,t,i,0))&&void 0!==s?s:A)===w)return;const e=this.H,o=t===A&&e!==A||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,l=t!==A&&(e===A||o);o&&this.element.removeEventListener(this.name,this,e),l&&this.element.addEventListener(this.name,this,t),this.H=t;}handleEvent(t){var i,s;"function"==typeof this.H?this.H.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this.H.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this.N=void 0,this.V=void 0,this.M=i,this.options=s;}I(t){S(this,t);}}null===(i=(t=globalThis).litHtmlPlatformSupport)||void 0===i||i.call(t,N,C),(null!==(s=(e=globalThis).litHtmlVersions)&&void 0!==s?s:e.litHtmlVersions=[]).push("2.0.0-rc.3");
|
|
7
|
-
|
|
8
|
-
export { A, T, V, w, x };
|
package/types/static.d.ts
DELETED