@internetarchive/collection-browser 4.0.2-alpha-webdev8209.0 → 4.1.0-alpha-webdev8164.0
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/.github/workflows/ci.yml +27 -27
- package/.github/workflows/gh-pages-main.yml +39 -39
- package/.github/workflows/npm-publish.yml +39 -39
- package/.github/workflows/pr-preview.yml +38 -38
- package/.husky/pre-commit +4 -4
- package/.prettierignore +1 -1
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/index.d.ts +0 -1
- package/dist/index.js.map +1 -1
- package/dist/src/app-root.js +614 -614
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.js +764 -764
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facets-template.js +5 -0
- package/dist/src/collection-facets/facets-template.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.d.ts +47 -8
- package/dist/src/collection-facets/more-facets-content.js +460 -161
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-pagination.d.ts +10 -0
- package/dist/src/collection-facets/more-facets-pagination.js +64 -1
- package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
- package/dist/src/models.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.js +89 -89
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +138 -138
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.js +28 -28
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/models.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.js +216 -216
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/test/collection-browser.test.js +189 -189
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +154 -3
- package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js +60 -0
- package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
- package/eslint.config.mjs +53 -53
- package/index.html +24 -24
- package/index.ts +0 -1
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +121 -121
- package/renovate.json +6 -6
- package/src/app-root.ts +1166 -1166
- package/src/collection-browser.ts +3075 -3075
- package/src/collection-facets/facets-template.ts +5 -0
- package/src/collection-facets/more-facets-content.ts +961 -644
- package/src/collection-facets/more-facets-pagination.ts +73 -1
- package/src/data-source/collection-browser-query-state.ts +59 -59
- package/src/models.ts +873 -873
- package/src/tiles/grid/collection-tile.ts +184 -184
- package/src/tiles/grid/item-tile.ts +346 -346
- package/src/tiles/hover/hover-pane-controller.ts +627 -627
- package/src/tiles/models.ts +8 -8
- package/src/tiles/tile-dispatcher.ts +518 -518
- package/test/collection-browser.test.ts +2413 -2413
- package/test/collection-facets/more-facets-content.test.ts +218 -3
- package/test/collection-facets/more-facets-pagination.test.ts +84 -0
- package/tsconfig.json +25 -25
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +52 -52
|
@@ -6,6 +6,7 @@ import { MockSearchService } from '../mocks/mock-search-service';
|
|
|
6
6
|
import { MockAnalyticsHandler } from '../mocks/mock-analytics-handler';
|
|
7
7
|
import type { FacetsTemplate } from '../../src/collection-facets/facets-template';
|
|
8
8
|
import type { SelectedFacets } from '../../src/models';
|
|
9
|
+
import { Aggregation, type Bucket } from '@internetarchive/search-service';
|
|
9
10
|
|
|
10
11
|
const selectedFacetsGroup = {
|
|
11
12
|
title: 'Media Type',
|
|
@@ -54,7 +55,7 @@ describe('More facets content', () => {
|
|
|
54
55
|
expect(el.shadowRoot?.querySelector('.facets-loader')).to.exist;
|
|
55
56
|
});
|
|
56
57
|
|
|
57
|
-
it('should render pagination
|
|
58
|
+
it('should NOT render pagination when facet count < 1000', async () => {
|
|
58
59
|
const searchService = new MockSearchService();
|
|
59
60
|
|
|
60
61
|
const el = await fixture<MoreFacetsContent>(
|
|
@@ -64,11 +65,22 @@ describe('More facets content', () => {
|
|
|
64
65
|
);
|
|
65
66
|
|
|
66
67
|
el.facetKey = 'year';
|
|
67
|
-
el.query = 'more-facets'; // Produces a response with
|
|
68
|
+
el.query = 'more-facets'; // Produces a response with 45 aggregations (< 1000)
|
|
68
69
|
await el.updateComplete;
|
|
69
70
|
await aTimeout(50); // Give it a moment to perform the (mock) search query after the initial update
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
// Verify pagination component is NOT present (horizontal scroll mode)
|
|
73
|
+
expect(el.shadowRoot?.querySelector('more-facets-pagination')).to.not.exist;
|
|
74
|
+
|
|
75
|
+
// Verify horizontal scroll mode CSS class is applied
|
|
76
|
+
expect(
|
|
77
|
+
el.shadowRoot?.querySelector('.facets-content.horizontal-scroll-mode'),
|
|
78
|
+
).to.exist;
|
|
79
|
+
|
|
80
|
+
// Verify footer still exists with buttons
|
|
81
|
+
expect(el.shadowRoot?.querySelector('.footer')).to.exist;
|
|
82
|
+
expect(el.shadowRoot?.querySelector('.btn-cancel')).to.exist;
|
|
83
|
+
expect(el.shadowRoot?.querySelector('.btn-submit')).to.exist;
|
|
72
84
|
});
|
|
73
85
|
|
|
74
86
|
it('query for more facets content using search service', async () => {
|
|
@@ -228,4 +240,207 @@ describe('More facets content', () => {
|
|
|
228
240
|
expect(mockAnalyticsHandler.callAction).to.equal('applyMoreFacetsModal');
|
|
229
241
|
expect(mockAnalyticsHandler.callLabel).to.equal('collection');
|
|
230
242
|
});
|
|
243
|
+
|
|
244
|
+
it('should have horizontal scrolling enabled', async () => {
|
|
245
|
+
const searchService = new MockSearchService();
|
|
246
|
+
|
|
247
|
+
const el = await fixture<MoreFacetsContent>(
|
|
248
|
+
html`<more-facets-content
|
|
249
|
+
.searchService=${searchService}
|
|
250
|
+
></more-facets-content>`,
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
el.facetKey = 'year';
|
|
254
|
+
el.query = 'more-facets';
|
|
255
|
+
await el.updateComplete;
|
|
256
|
+
await aTimeout(50);
|
|
257
|
+
|
|
258
|
+
const facetsContent = el.shadowRoot?.querySelector(
|
|
259
|
+
'.facets-content',
|
|
260
|
+
) as HTMLElement;
|
|
261
|
+
const styles = window.getComputedStyle(facetsContent);
|
|
262
|
+
|
|
263
|
+
expect(styles.overflowX).to.equal('auto');
|
|
264
|
+
expect(styles.overflowY).to.equal('hidden');
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
it('should have horizontal container wrapper', async () => {
|
|
268
|
+
const searchService = new MockSearchService();
|
|
269
|
+
|
|
270
|
+
const el = await fixture<MoreFacetsContent>(
|
|
271
|
+
html`<more-facets-content
|
|
272
|
+
.searchService=${searchService}
|
|
273
|
+
></more-facets-content>`,
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
el.facetKey = 'year';
|
|
277
|
+
el.query = 'more-facets';
|
|
278
|
+
await el.updateComplete;
|
|
279
|
+
await aTimeout(50);
|
|
280
|
+
|
|
281
|
+
const container = el.shadowRoot?.querySelector(
|
|
282
|
+
'.facets-horizontal-container',
|
|
283
|
+
);
|
|
284
|
+
expect(container).to.exist;
|
|
285
|
+
|
|
286
|
+
const facetsTemplate = container?.querySelector('facets-template');
|
|
287
|
+
expect(facetsTemplate).to.exist;
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
it('should render pagination when facet count >= 1000', async () => {
|
|
291
|
+
// Manually create aggregations with 1000+ facets
|
|
292
|
+
const buckets: Bucket[] = [];
|
|
293
|
+
for (let i = 0; i < 1000; i++) {
|
|
294
|
+
buckets.push({ key: `value-${i}`, doc_count: i + 1 });
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const el = await fixture<MoreFacetsContent>(
|
|
298
|
+
html`<more-facets-content
|
|
299
|
+
.facetKey=${'subject'}
|
|
300
|
+
.selectedFacets=${{
|
|
301
|
+
mediatype: {},
|
|
302
|
+
lending: {},
|
|
303
|
+
year: {},
|
|
304
|
+
subject: {},
|
|
305
|
+
collection: {},
|
|
306
|
+
creator: {},
|
|
307
|
+
language: {},
|
|
308
|
+
}}
|
|
309
|
+
></more-facets-content>`,
|
|
310
|
+
);
|
|
311
|
+
|
|
312
|
+
// @ts-expect-error - accessing private property for testing
|
|
313
|
+
el.aggregations = {
|
|
314
|
+
subject: new Aggregation({ buckets }),
|
|
315
|
+
};
|
|
316
|
+
el.facetsLoading = false;
|
|
317
|
+
await el.updateComplete;
|
|
318
|
+
|
|
319
|
+
// Verify pagination component IS present
|
|
320
|
+
expect(el.shadowRoot?.querySelector('more-facets-pagination')).to.exist;
|
|
321
|
+
|
|
322
|
+
// Verify pagination mode CSS class is applied
|
|
323
|
+
expect(el.shadowRoot?.querySelector('.facets-content.pagination-mode')).to
|
|
324
|
+
.exist;
|
|
325
|
+
|
|
326
|
+
// Verify horizontal container wrapper does NOT exist in pagination mode
|
|
327
|
+
expect(el.shadowRoot?.querySelector('.facets-horizontal-container')).to.not
|
|
328
|
+
.exist;
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
it('pagination page change should send analytics event', async () => {
|
|
332
|
+
const mockAnalyticsHandler = new MockAnalyticsHandler();
|
|
333
|
+
|
|
334
|
+
// Manually create aggregations with 1000+ facets
|
|
335
|
+
const buckets: Bucket[] = [];
|
|
336
|
+
for (let i = 0; i < 1000; i++) {
|
|
337
|
+
buckets.push({ key: `value-${i}`, doc_count: i + 1 });
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const el = await fixture<MoreFacetsContent>(
|
|
341
|
+
html`<more-facets-content
|
|
342
|
+
.facetKey=${'subject'}
|
|
343
|
+
.selectedFacets=${{
|
|
344
|
+
mediatype: {},
|
|
345
|
+
lending: {},
|
|
346
|
+
year: {},
|
|
347
|
+
subject: {},
|
|
348
|
+
collection: {},
|
|
349
|
+
creator: {},
|
|
350
|
+
language: {},
|
|
351
|
+
}}
|
|
352
|
+
.analyticsHandler=${mockAnalyticsHandler}
|
|
353
|
+
></more-facets-content>`,
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
// @ts-expect-error - accessing private property for testing
|
|
357
|
+
el.aggregations = {
|
|
358
|
+
subject: new Aggregation({ buckets }),
|
|
359
|
+
};
|
|
360
|
+
el.facetsLoading = false;
|
|
361
|
+
await el.updateComplete;
|
|
362
|
+
|
|
363
|
+
// Get the pagination component
|
|
364
|
+
const pagination = el.shadowRoot?.querySelector(
|
|
365
|
+
'more-facets-pagination',
|
|
366
|
+
) as any;
|
|
367
|
+
expect(pagination).to.exist;
|
|
368
|
+
|
|
369
|
+
// Simulate clicking page 2
|
|
370
|
+
pagination.currentPage = 2;
|
|
371
|
+
await pagination.updateComplete;
|
|
372
|
+
|
|
373
|
+
// Verify analytics event was sent
|
|
374
|
+
expect(mockAnalyticsHandler.callCategory).to.equal('collection-browser');
|
|
375
|
+
expect(mockAnalyticsHandler.callAction).to.equal('moreFacetsPageChange');
|
|
376
|
+
expect(mockAnalyticsHandler.callLabel).to.equal('2');
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
it('should show clear button when filter text is present', async () => {
|
|
380
|
+
const searchService = new MockSearchService();
|
|
381
|
+
|
|
382
|
+
const el = await fixture<MoreFacetsContent>(
|
|
383
|
+
html`<more-facets-content
|
|
384
|
+
.facetKey=${'year'}
|
|
385
|
+
.query=${'more-facets'}
|
|
386
|
+
.searchService=${searchService}
|
|
387
|
+
.selectedFacets=${yearSelectedFacets}
|
|
388
|
+
></more-facets-content>`,
|
|
389
|
+
);
|
|
390
|
+
|
|
391
|
+
await el.updateComplete;
|
|
392
|
+
await aTimeout(50);
|
|
393
|
+
|
|
394
|
+
// Initially, no clear button should exist
|
|
395
|
+
expect(el.shadowRoot?.querySelector('.filter-clear-btn')).to.not.exist;
|
|
396
|
+
|
|
397
|
+
// Type into the filter input
|
|
398
|
+
const filterInput = el.shadowRoot?.querySelector(
|
|
399
|
+
'#facet-filter',
|
|
400
|
+
) as HTMLInputElement;
|
|
401
|
+
expect(filterInput).to.exist;
|
|
402
|
+
|
|
403
|
+
filterInput.value = 'test';
|
|
404
|
+
filterInput.dispatchEvent(new Event('input'));
|
|
405
|
+
await el.updateComplete;
|
|
406
|
+
|
|
407
|
+
// Now clear button should exist
|
|
408
|
+
expect(el.shadowRoot?.querySelector('.filter-clear-btn')).to.exist;
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
it('should clear filter text when clear button is clicked', async () => {
|
|
412
|
+
const searchService = new MockSearchService();
|
|
413
|
+
|
|
414
|
+
const el = await fixture<MoreFacetsContent>(
|
|
415
|
+
html`<more-facets-content
|
|
416
|
+
.facetKey=${'year'}
|
|
417
|
+
.query=${'more-facets'}
|
|
418
|
+
.searchService=${searchService}
|
|
419
|
+
.selectedFacets=${yearSelectedFacets}
|
|
420
|
+
></more-facets-content>`,
|
|
421
|
+
);
|
|
422
|
+
|
|
423
|
+
await el.updateComplete;
|
|
424
|
+
await aTimeout(50);
|
|
425
|
+
|
|
426
|
+
// Type into the filter input
|
|
427
|
+
const filterInput = el.shadowRoot?.querySelector(
|
|
428
|
+
'#facet-filter',
|
|
429
|
+
) as HTMLInputElement;
|
|
430
|
+
filterInput.value = 'test';
|
|
431
|
+
filterInput.dispatchEvent(new Event('input'));
|
|
432
|
+
await el.updateComplete;
|
|
433
|
+
|
|
434
|
+
// Click the clear button
|
|
435
|
+
const clearBtn = el.shadowRoot?.querySelector(
|
|
436
|
+
'.filter-clear-btn',
|
|
437
|
+
) as HTMLButtonElement;
|
|
438
|
+
expect(clearBtn).to.exist;
|
|
439
|
+
clearBtn.click();
|
|
440
|
+
await el.updateComplete;
|
|
441
|
+
|
|
442
|
+
// Filter input should be empty and clear button should be gone
|
|
443
|
+
expect(filterInput.value).to.equal('');
|
|
444
|
+
expect(el.shadowRoot?.querySelector('.filter-clear-btn')).to.not.exist;
|
|
445
|
+
});
|
|
231
446
|
});
|
|
@@ -198,4 +198,88 @@ describe('More facets pagination', () => {
|
|
|
198
198
|
expect(el.currentPage).to.equal(6); // brings us forward 1 page
|
|
199
199
|
});
|
|
200
200
|
});
|
|
201
|
+
|
|
202
|
+
describe('Compact mode', () => {
|
|
203
|
+
it('shows all pages when size <= 3', async () => {
|
|
204
|
+
const el = await fixture<MoreFacetsPagination>(
|
|
205
|
+
html`<more-facets-pagination
|
|
206
|
+
.size=${3}
|
|
207
|
+
.compact=${true}
|
|
208
|
+
></more-facets-pagination>`,
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
await el.updateComplete;
|
|
212
|
+
expect(el.pages).to.deep.equal([1, 2, 3]);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('shows first, prev, current, next, ..., last for middle page', async () => {
|
|
216
|
+
const el = await fixture<MoreFacetsPagination>(
|
|
217
|
+
html`<more-facets-pagination
|
|
218
|
+
.size=${20}
|
|
219
|
+
.currentPage=${10}
|
|
220
|
+
.compact=${true}
|
|
221
|
+
></more-facets-pagination>`,
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
await el.updateComplete;
|
|
225
|
+
// first, ..., prev, current, next, ..., last
|
|
226
|
+
expect(el.pages).to.deep.equal([1, 0, 9, 10, 11, 0, 20]);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('shows correct pages when on page 1', async () => {
|
|
230
|
+
const el = await fixture<MoreFacetsPagination>(
|
|
231
|
+
html`<more-facets-pagination
|
|
232
|
+
.size=${20}
|
|
233
|
+
.currentPage=${1}
|
|
234
|
+
.compact=${true}
|
|
235
|
+
></more-facets-pagination>`,
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
await el.updateComplete;
|
|
239
|
+
// first (current), next, ..., last
|
|
240
|
+
expect(el.pages).to.deep.equal([1, 2, 0, 20]);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it('shows correct pages when on last page', async () => {
|
|
244
|
+
const el = await fixture<MoreFacetsPagination>(
|
|
245
|
+
html`<more-facets-pagination
|
|
246
|
+
.size=${20}
|
|
247
|
+
.currentPage=${20}
|
|
248
|
+
.compact=${true}
|
|
249
|
+
></more-facets-pagination>`,
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
await el.updateComplete;
|
|
253
|
+
// first, ..., prev, last (current)
|
|
254
|
+
expect(el.pages).to.deep.equal([1, 0, 19, 20]);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it('shows correct pages when on page 2', async () => {
|
|
258
|
+
const el = await fixture<MoreFacetsPagination>(
|
|
259
|
+
html`<more-facets-pagination
|
|
260
|
+
.size=${20}
|
|
261
|
+
.currentPage=${2}
|
|
262
|
+
.compact=${true}
|
|
263
|
+
></more-facets-pagination>`,
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
await el.updateComplete;
|
|
267
|
+
// first, current, next, ..., last
|
|
268
|
+
expect(el.pages).to.deep.equal([1, 2, 3, 0, 20]);
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it('shows correct pages when on second-to-last page', async () => {
|
|
272
|
+
const el = await fixture<MoreFacetsPagination>(
|
|
273
|
+
html`<more-facets-pagination
|
|
274
|
+
.size=${20}
|
|
275
|
+
.currentPage=${19}
|
|
276
|
+
.compact=${true}
|
|
277
|
+
></more-facets-pagination>`,
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
await el.updateComplete;
|
|
281
|
+
// first, ..., prev, current, last
|
|
282
|
+
expect(el.pages).to.deep.equal([1, 0, 18, 19, 20]);
|
|
283
|
+
});
|
|
284
|
+
});
|
|
201
285
|
});
|
package/tsconfig.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "esnext",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"noEmitOnError": true,
|
|
7
|
-
"lib": [
|
|
8
|
-
"ESNext",
|
|
9
|
-
"dom",
|
|
10
|
-
"dom.iterable"
|
|
11
|
-
],
|
|
12
|
-
"strict": true,
|
|
13
|
-
"esModuleInterop": false,
|
|
14
|
-
"allowSyntheticDefaultImports": true,
|
|
15
|
-
"experimentalDecorators": true,
|
|
16
|
-
"importHelpers": true,
|
|
17
|
-
"outDir": "dist",
|
|
18
|
-
"sourceMap": true,
|
|
19
|
-
"inlineSources": true,
|
|
20
|
-
"rootDir": "./",
|
|
21
|
-
"declaration": true,
|
|
22
|
-
"useDefineForClassFields": false,
|
|
23
|
-
},
|
|
24
|
-
"include": ["src", "test", "index.ts", "types"],
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"noEmitOnError": true,
|
|
7
|
+
"lib": [
|
|
8
|
+
"ESNext",
|
|
9
|
+
"dom",
|
|
10
|
+
"dom.iterable"
|
|
11
|
+
],
|
|
12
|
+
"strict": true,
|
|
13
|
+
"esModuleInterop": false,
|
|
14
|
+
"allowSyntheticDefaultImports": true,
|
|
15
|
+
"experimentalDecorators": true,
|
|
16
|
+
"importHelpers": true,
|
|
17
|
+
"outDir": "dist",
|
|
18
|
+
"sourceMap": true,
|
|
19
|
+
"inlineSources": true,
|
|
20
|
+
"rootDir": "./",
|
|
21
|
+
"declaration": true,
|
|
22
|
+
"useDefineForClassFields": false,
|
|
23
|
+
},
|
|
24
|
+
"include": ["src", "test", "index.ts", "types"],
|
|
25
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
|
2
|
-
|
|
3
|
-
/** Use Hot Module replacement by adding --hmr to the start command */
|
|
4
|
-
const hmr = process.argv.includes('--hmr');
|
|
5
|
-
|
|
6
|
-
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
7
|
-
nodeResolve: true,
|
|
8
|
-
open: '/',
|
|
9
|
-
watch: !hmr,
|
|
10
|
-
|
|
11
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
12
|
-
// esbuildTarget: 'auto'
|
|
13
|
-
|
|
14
|
-
/** Set appIndex to enable SPA routing */
|
|
15
|
-
// appIndex: 'demo/index.html',
|
|
16
|
-
|
|
17
|
-
/** Confgure bare import resolve plugin */
|
|
18
|
-
// nodeResolve: {
|
|
19
|
-
// exportConditions: ['browser', 'development']
|
|
20
|
-
// },
|
|
21
|
-
|
|
22
|
-
plugins: [
|
|
23
|
-
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
|
24
|
-
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
|
|
25
|
-
],
|
|
26
|
-
|
|
27
|
-
http2: true,
|
|
28
|
-
sslCert: './local.archive.org.cert',
|
|
29
|
-
sslKey: './local.archive.org.key',
|
|
30
|
-
});
|
|
1
|
+
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
|
2
|
+
|
|
3
|
+
/** Use Hot Module replacement by adding --hmr to the start command */
|
|
4
|
+
const hmr = process.argv.includes('--hmr');
|
|
5
|
+
|
|
6
|
+
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
7
|
+
nodeResolve: true,
|
|
8
|
+
open: '/',
|
|
9
|
+
watch: !hmr,
|
|
10
|
+
|
|
11
|
+
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
12
|
+
// esbuildTarget: 'auto'
|
|
13
|
+
|
|
14
|
+
/** Set appIndex to enable SPA routing */
|
|
15
|
+
// appIndex: 'demo/index.html',
|
|
16
|
+
|
|
17
|
+
/** Confgure bare import resolve plugin */
|
|
18
|
+
// nodeResolve: {
|
|
19
|
+
// exportConditions: ['browser', 'development']
|
|
20
|
+
// },
|
|
21
|
+
|
|
22
|
+
plugins: [
|
|
23
|
+
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
|
24
|
+
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
http2: true,
|
|
28
|
+
sslCert: './local.archive.org.cert',
|
|
29
|
+
sslKey: './local.archive.org.key',
|
|
30
|
+
});
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import rollupImage from '@rollup/plugin-image';
|
|
2
|
-
import { rollupAdapter } from '@web/dev-server-rollup';
|
|
3
|
-
// import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
4
|
-
|
|
5
|
-
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
|
|
6
|
-
|
|
7
|
-
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
8
|
-
/** Test files to run */
|
|
9
|
-
files: 'dist/test/**/*.test.js',
|
|
10
|
-
|
|
11
|
-
/** Resolve bare module imports */
|
|
12
|
-
nodeResolve: {
|
|
13
|
-
exportConditions: ['browser', 'development'],
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
mimeTypes: {
|
|
17
|
-
'**/*.scss': 'js',
|
|
18
|
-
'**/*.css': 'js',
|
|
19
|
-
'**/*.svg': 'js',
|
|
20
|
-
'**/*.json': 'js',
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
/** Filter out lit dev mode logs */
|
|
24
|
-
filterBrowserLogs(log) {
|
|
25
|
-
for (const arg of log.args) {
|
|
26
|
-
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
plugins: [rollupAdapter(rollupImage())],
|
|
34
|
-
|
|
35
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
36
|
-
// esbuildTarget: 'auto',
|
|
37
|
-
|
|
38
|
-
/** Amount of browsers to run concurrently */
|
|
39
|
-
// concurrentBrowsers: 2,
|
|
40
|
-
|
|
41
|
-
/** Amount of test files per browser to test concurrently */
|
|
42
|
-
// concurrency: 1,
|
|
43
|
-
|
|
44
|
-
/** Browsers to run tests on */
|
|
45
|
-
// browsers: [
|
|
46
|
-
// playwrightLauncher({ product: 'chromium' }),
|
|
47
|
-
// playwrightLauncher({ product: 'firefox' }),
|
|
48
|
-
// playwrightLauncher({ product: 'webkit' }),
|
|
49
|
-
// ],
|
|
50
|
-
|
|
51
|
-
// See documentation for all available options
|
|
52
|
-
});
|
|
1
|
+
import rollupImage from '@rollup/plugin-image';
|
|
2
|
+
import { rollupAdapter } from '@web/dev-server-rollup';
|
|
3
|
+
// import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
4
|
+
|
|
5
|
+
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
|
|
6
|
+
|
|
7
|
+
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
8
|
+
/** Test files to run */
|
|
9
|
+
files: 'dist/test/**/*.test.js',
|
|
10
|
+
|
|
11
|
+
/** Resolve bare module imports */
|
|
12
|
+
nodeResolve: {
|
|
13
|
+
exportConditions: ['browser', 'development'],
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
mimeTypes: {
|
|
17
|
+
'**/*.scss': 'js',
|
|
18
|
+
'**/*.css': 'js',
|
|
19
|
+
'**/*.svg': 'js',
|
|
20
|
+
'**/*.json': 'js',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
/** Filter out lit dev mode logs */
|
|
24
|
+
filterBrowserLogs(log) {
|
|
25
|
+
for (const arg of log.args) {
|
|
26
|
+
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
plugins: [rollupAdapter(rollupImage())],
|
|
34
|
+
|
|
35
|
+
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
36
|
+
// esbuildTarget: 'auto',
|
|
37
|
+
|
|
38
|
+
/** Amount of browsers to run concurrently */
|
|
39
|
+
// concurrentBrowsers: 2,
|
|
40
|
+
|
|
41
|
+
/** Amount of test files per browser to test concurrently */
|
|
42
|
+
// concurrency: 1,
|
|
43
|
+
|
|
44
|
+
/** Browsers to run tests on */
|
|
45
|
+
// browsers: [
|
|
46
|
+
// playwrightLauncher({ product: 'chromium' }),
|
|
47
|
+
// playwrightLauncher({ product: 'firefox' }),
|
|
48
|
+
// playwrightLauncher({ product: 'webkit' }),
|
|
49
|
+
// ],
|
|
50
|
+
|
|
51
|
+
// See documentation for all available options
|
|
52
|
+
});
|