@internetarchive/histogram-date-range 0.0.10-beta → 0.1.1-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 +52 -43
- package/dist/src/histogram-date-range.d.ts +7 -5
- package/dist/src/histogram-date-range.js +114 -59
- package/dist/src/histogram-date-range.js.map +1 -1
- package/dist/test/histogram-date-range.test.js +109 -35
- package/dist/test/histogram-date-range.test.js.map +1 -1
- package/docs/_snowpack/pkg/common/lit-html-bb3fcd20.js +8 -0
- package/docs/_snowpack/pkg/dayjs/esm/plugin/customParseFormat.js +327 -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 +6 -6
- package/docs/demo/index.css +23 -0
- package/docs/demo/index.html +52 -43
- package/docs/dist/src/histogram-date-range.js +92 -50
- package/package.json +3 -3
- package/src/histogram-date-range.ts +150 -66
- package/test/histogram-date-range.test.ts +140 -37
- 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
|
});
|
|
@@ -158,16 +157,20 @@ describe('HistogramDateRange', () => {
|
|
|
158
157
|
|
|
159
158
|
// initial state
|
|
160
159
|
expect(minSlider.getBoundingClientRect().x).to.eq(108);
|
|
161
|
-
expect(minSlider.classList
|
|
160
|
+
expect(Array.from(minSlider.classList).join(' ')).to.eq('draggable');
|
|
162
161
|
|
|
163
162
|
// pointer down
|
|
164
163
|
minSlider.dispatchEvent(new PointerEvent('pointerdown'));
|
|
165
|
-
await
|
|
166
|
-
|
|
164
|
+
await el.updateComplete;
|
|
165
|
+
|
|
166
|
+
// cursor changes to 'grab'
|
|
167
|
+
const classList = minSlider.classList;
|
|
168
|
+
expect(classList.contains('draggable')).to.be.true;
|
|
169
|
+
expect(classList.contains('dragging')).to.be.true;
|
|
167
170
|
|
|
168
171
|
// slide to right
|
|
169
172
|
window.dispatchEvent(new PointerEvent('pointermove', { clientX: 70 }));
|
|
170
|
-
await
|
|
173
|
+
await el.updateComplete;
|
|
171
174
|
|
|
172
175
|
// slider has moved
|
|
173
176
|
expect(Math.round(minSlider.getBoundingClientRect().x)).to.eq(168);
|
|
@@ -176,7 +179,8 @@ describe('HistogramDateRange', () => {
|
|
|
176
179
|
|
|
177
180
|
// stop dragging
|
|
178
181
|
window.dispatchEvent(new PointerEvent('pointerup'));
|
|
179
|
-
await
|
|
182
|
+
await el.updateComplete;
|
|
183
|
+
|
|
180
184
|
// cursor returns to normal
|
|
181
185
|
expect(Array.from(container.classList)).not.to.include('dragging');
|
|
182
186
|
|
|
@@ -192,18 +196,18 @@ describe('HistogramDateRange', () => {
|
|
|
192
196
|
// slide to left
|
|
193
197
|
maxSlider.dispatchEvent(new PointerEvent('pointerdown', { clientX: 195 }));
|
|
194
198
|
window.dispatchEvent(new PointerEvent('pointermove', { clientX: 160 }));
|
|
195
|
-
await
|
|
199
|
+
await el.updateComplete;
|
|
196
200
|
|
|
197
201
|
// slider has moved
|
|
198
202
|
expect(Math.round(maxSlider.getBoundingClientRect().x)).to.eq(268);
|
|
199
203
|
// max date is updated
|
|
200
204
|
expect(maxDateInput.value).to.eq('10/8/2000');
|
|
201
|
-
await
|
|
205
|
+
await el.updateComplete;
|
|
202
206
|
|
|
203
207
|
// try to slide min slider past max slider
|
|
204
208
|
minSlider.dispatchEvent(new PointerEvent('pointerdown', { clientX: 62 }));
|
|
205
209
|
window.dispatchEvent(new PointerEvent('pointermove', { clientX: 190 }));
|
|
206
|
-
await
|
|
210
|
+
await el.updateComplete;
|
|
207
211
|
|
|
208
212
|
// slider moves all the way to meet the right slider
|
|
209
213
|
expect(Math.round(minSlider.getBoundingClientRect().x)).to.eq(258);
|
|
@@ -211,32 +215,65 @@ describe('HistogramDateRange', () => {
|
|
|
211
215
|
// try to slide max slider past min slider
|
|
212
216
|
maxSlider.dispatchEvent(new PointerEvent('pointerdown', { clientX: 120 }));
|
|
213
217
|
window.dispatchEvent(new PointerEvent('pointermove', { clientX: 50 }));
|
|
214
|
-
await
|
|
218
|
+
await el.updateComplete;
|
|
215
219
|
expect(Math.round(maxSlider.getBoundingClientRect().x)).to.eq(268); // max slider didn't move
|
|
216
220
|
});
|
|
217
221
|
|
|
218
|
-
it(
|
|
222
|
+
it("emits a custom event when the element's date range changes", async () => {
|
|
219
223
|
const el = await createCustomElementInHTMLContainer();
|
|
224
|
+
el.updateDelay = 30; // set debounce delay of 30ms
|
|
225
|
+
|
|
220
226
|
const minDateInput = el.shadowRoot?.querySelector(
|
|
221
227
|
'#date-min'
|
|
222
228
|
) as HTMLInputElement;
|
|
223
|
-
const
|
|
224
|
-
el,
|
|
225
|
-
'histogramDateRangeUpdated'
|
|
226
|
-
);
|
|
229
|
+
const updateEventPromise = oneEvent(el, 'histogramDateRangeUpdated');
|
|
227
230
|
|
|
228
231
|
// simulate typing a new value into input
|
|
229
232
|
minDateInput.value = '1955';
|
|
230
233
|
minDateInput.dispatchEvent(new Event('blur'));
|
|
231
234
|
|
|
235
|
+
// will wait longer than debounce delay
|
|
236
|
+
const { detail } = await updateEventPromise;
|
|
232
237
|
// verify that event is emitted
|
|
233
|
-
const { detail } = await dateRangeUpdatedEventListener;
|
|
234
238
|
expect(detail.minDate).to.equal('1/1/1955');
|
|
235
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
|
|
236
270
|
});
|
|
237
271
|
|
|
238
272
|
it('shows/hides tooltip when hovering over (or pointing at) a bar', async () => {
|
|
239
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);
|
|
240
277
|
const bars = (el.shadowRoot?.querySelectorAll(
|
|
241
278
|
'.bar'
|
|
242
279
|
) as unknown) as SVGRectElement[];
|
|
@@ -245,19 +282,21 @@ describe('HistogramDateRange', () => {
|
|
|
245
282
|
|
|
246
283
|
// hover
|
|
247
284
|
bars[0].dispatchEvent(new PointerEvent('pointerenter'));
|
|
248
|
-
await
|
|
249
|
-
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
|
+
);
|
|
250
289
|
expect(getComputedStyle(tooltip).display).to.eq('block');
|
|
251
290
|
|
|
252
291
|
// leave
|
|
253
292
|
bars[0].dispatchEvent(new PointerEvent('pointerleave'));
|
|
254
|
-
await
|
|
293
|
+
await el.updateComplete;
|
|
255
294
|
expect(getComputedStyle(tooltip).display).to.eq('none');
|
|
256
295
|
expect(tooltip.innerText).to.eq('');
|
|
257
296
|
|
|
258
297
|
// ensure singular item is not pluralized
|
|
259
298
|
bars[1].dispatchEvent(new PointerEvent('pointerenter'));
|
|
260
|
-
await
|
|
299
|
+
await el.updateComplete;
|
|
261
300
|
expect(tooltip.innerText).to.match(/^1 item\n4\/23\/1940 - 8\/13\/1980/);
|
|
262
301
|
});
|
|
263
302
|
|
|
@@ -273,11 +312,11 @@ describe('HistogramDateRange', () => {
|
|
|
273
312
|
// pointer down and slide right
|
|
274
313
|
minSlider.dispatchEvent(new PointerEvent('pointerdown'));
|
|
275
314
|
window.dispatchEvent(new PointerEvent('pointermove', { clientX: 100 }));
|
|
276
|
-
await
|
|
315
|
+
await el.updateComplete;
|
|
277
316
|
|
|
278
317
|
// hover over bar
|
|
279
318
|
bars[0].dispatchEvent(new PointerEvent('pointerenter'));
|
|
280
|
-
await
|
|
319
|
+
await el.updateComplete;
|
|
281
320
|
// tooltip display is suppressed while dragging
|
|
282
321
|
expect(tooltip.style.display).to.eq('');
|
|
283
322
|
});
|
|
@@ -312,6 +351,35 @@ describe('HistogramDateRange', () => {
|
|
|
312
351
|
expect(maxDateInput.value).to.eq('2019');
|
|
313
352
|
});
|
|
314
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
|
+
expect(el.minSelectedDate).to.eq('1910'); // range was extended to left
|
|
374
|
+
|
|
375
|
+
const rightBarToClick = Array.from(
|
|
376
|
+
el.shadowRoot?.querySelectorAll('.bar') as NodeList
|
|
377
|
+
)[8]; // click on second bar from the right
|
|
378
|
+
|
|
379
|
+
rightBarToClick.dispatchEvent(new Event('click'));
|
|
380
|
+
expect(el.maxSelectedDate).to.eq('1998'); // range was extended to right
|
|
381
|
+
});
|
|
382
|
+
|
|
315
383
|
it('handles invalid pre-selected range by defaulting to overall max and min', async () => {
|
|
316
384
|
const el = await fixture<HistogramDateRange>(
|
|
317
385
|
html`
|
|
@@ -328,12 +396,14 @@ describe('HistogramDateRange', () => {
|
|
|
328
396
|
const minDateInput = el.shadowRoot?.querySelector(
|
|
329
397
|
'#date-min'
|
|
330
398
|
) as HTMLInputElement;
|
|
399
|
+
// malformed min date defaults to overall min
|
|
331
400
|
expect(minDateInput.value).to.eq('1900');
|
|
332
401
|
|
|
333
402
|
const maxDateInput = el.shadowRoot?.querySelector(
|
|
334
403
|
'#date-max'
|
|
335
404
|
) as HTMLInputElement;
|
|
336
|
-
|
|
405
|
+
// well-formed max date is allowed
|
|
406
|
+
expect(maxDateInput.value).to.eq('5000');
|
|
337
407
|
});
|
|
338
408
|
|
|
339
409
|
it('handles missing data', async () => {
|
|
@@ -354,6 +424,21 @@ describe('HistogramDateRange', () => {
|
|
|
354
424
|
expect(el.shadowRoot?.innerHTML).to.contain('no data available');
|
|
355
425
|
});
|
|
356
426
|
|
|
427
|
+
it('correctly displays data consisting of a single bin', async () => {
|
|
428
|
+
const el = await fixture<HistogramDateRange>(
|
|
429
|
+
html`
|
|
430
|
+
<histogram-date-range minDate="2020" maxDate="2020" bins="[50]">
|
|
431
|
+
</histogram-date-range>
|
|
432
|
+
`
|
|
433
|
+
);
|
|
434
|
+
const bars = (el.shadowRoot?.querySelectorAll(
|
|
435
|
+
'.bar'
|
|
436
|
+
) as unknown) as SVGRectElement[];
|
|
437
|
+
const heights = Array.from(bars).map(b => b.height.baseVal.value);
|
|
438
|
+
debugger;
|
|
439
|
+
expect(heights).to.eql([157]);
|
|
440
|
+
});
|
|
441
|
+
|
|
357
442
|
it('has a disabled state', async () => {
|
|
358
443
|
const el = await fixture<HistogramDateRange>(
|
|
359
444
|
html`
|
|
@@ -371,6 +456,24 @@ describe('HistogramDateRange', () => {
|
|
|
371
456
|
?.querySelector('.inner-container')
|
|
372
457
|
?.classList.contains('disabled')
|
|
373
458
|
).to.eq(true);
|
|
459
|
+
|
|
460
|
+
const minSlider = el.shadowRoot?.querySelector('#slider-min') as SVGElement;
|
|
461
|
+
|
|
462
|
+
expect(Math.round(minSlider.getBoundingClientRect().x)).to.eq(8); // initial state
|
|
463
|
+
|
|
464
|
+
// attempt to slide to right
|
|
465
|
+
minSlider.dispatchEvent(new PointerEvent('pointerdown'));
|
|
466
|
+
await el.updateComplete;
|
|
467
|
+
|
|
468
|
+
// cursor is not draggable if disabled
|
|
469
|
+
expect(Array.from(minSlider.classList).join(' ')).to.eq('');
|
|
470
|
+
|
|
471
|
+
// attempt to slide to right
|
|
472
|
+
window.dispatchEvent(new PointerEvent('pointermove', { clientX: 70 }));
|
|
473
|
+
await el.updateComplete;
|
|
474
|
+
|
|
475
|
+
// slider does not moved if element disabled
|
|
476
|
+
expect(Math.round(minSlider.getBoundingClientRect().x)).to.eq(8);
|
|
374
477
|
});
|
|
375
478
|
|
|
376
479
|
it('has a loading state with an activity indicator', async () => {
|
|
@@ -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