@internetarchive/collection-browser 4.1.1-alpha-webdev8185.1 → 4.1.2-alpha1

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.
Files changed (45) hide show
  1. package/.editorconfig +29 -29
  2. package/.github/workflows/ci.yml +27 -27
  3. package/.github/workflows/gh-pages-main.yml +39 -39
  4. package/.github/workflows/npm-publish.yml +39 -39
  5. package/.github/workflows/pr-preview.yml +38 -38
  6. package/.husky/pre-commit +1 -1
  7. package/.prettierignore +1 -1
  8. package/LICENSE +661 -661
  9. package/README.md +83 -83
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/src/collection-browser.d.ts +18 -9
  14. package/dist/src/collection-browser.js +81 -20
  15. package/dist/src/collection-browser.js.map +1 -1
  16. package/dist/src/data-source/collection-browser-data-source.js +3 -2
  17. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  18. package/dist/src/data-source/collection-browser-query-state.d.ts +3 -5
  19. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  20. package/dist/src/models.d.ts +2 -27
  21. package/dist/src/models.js +0 -36
  22. package/dist/src/models.js.map +1 -1
  23. package/dist/src/restoration-state-handler.js +9 -3
  24. package/dist/src/restoration-state-handler.js.map +1 -1
  25. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +2 -2
  26. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  27. package/dist/test/collection-browser.test.js +17 -15
  28. package/dist/test/collection-browser.test.js.map +1 -1
  29. package/eslint.config.mjs +53 -53
  30. package/index.html +24 -24
  31. package/index.ts +0 -5
  32. package/local.archive.org.cert +86 -86
  33. package/local.archive.org.key +27 -27
  34. package/package.json +120 -120
  35. package/renovate.json +6 -6
  36. package/src/collection-browser.ts +100 -27
  37. package/src/data-source/collection-browser-data-source.ts +3 -2
  38. package/src/data-source/collection-browser-query-state.ts +3 -12
  39. package/src/models.ts +4 -53
  40. package/src/restoration-state-handler.ts +7 -3
  41. package/src/sort-filter-bar/sort-filter-bar.ts +4 -3
  42. package/test/collection-browser.test.ts +17 -15
  43. package/tsconfig.json +25 -25
  44. package/web-dev-server.config.mjs +30 -30
  45. package/web-test-runner.config.mjs +52 -52
package/renovate.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "extends": [
3
- "config:base",
4
- ":preserveSemverRanges"
5
- ]
6
- }
1
+ {
2
+ "extends": [
3
+ "config:base",
4
+ ":preserveSemverRanges"
5
+ ]
6
+ }
@@ -36,13 +36,14 @@ import type { IAComboBox } from '@internetarchive/elements/ia-combo-box/ia-combo
36
36
  import {
37
37
  SelectedFacets,
38
38
  SortField,
39
- type ExplicitSortField,
40
39
  CollectionBrowserContext,
41
40
  getDefaultSelectedFacets,
42
41
  TileModel,
43
42
  CollectionDisplayMode,
44
43
  FacetEventDetails,
44
+ sortOptionFromAPIString,
45
45
  SORT_OPTIONS,
46
+ defaultProfileElementSorts,
46
47
  FacetLoadStrategy,
47
48
  defaultFacetDisplayOrder,
48
49
  tvFacetDisplayOrder,
@@ -150,8 +151,10 @@ export class CollectionBrowser
150
151
 
151
152
  @property({ type: String }) sortDirection: SortDirection | null = null;
152
153
 
153
- @property({ type: String }) defaultSortField: ExplicitSortField =
154
- SortField.relevance;
154
+ @property({ type: String }) defaultSortField: Exclude<
155
+ SortField,
156
+ SortField.default
157
+ > = SortField.relevance;
155
158
 
156
159
  @property({ type: String }) defaultSortDirection: SortDirection | null = null;
157
160
 
@@ -598,6 +601,10 @@ export class CollectionBrowser
598
601
 
599
602
  willUpdate(changed: PropertyValues): void {
600
603
  this.setPlaceholderType();
604
+
605
+ if (changed.has('searchType') && this.searchType === SearchType.TV) {
606
+ this.applyDefaultTVSearchSort();
607
+ }
601
608
  }
602
609
 
603
610
  render() {
@@ -853,8 +860,12 @@ export class CollectionBrowser
853
860
  let sortFieldAvailability = defaultSortAvailability;
854
861
 
855
862
  // We adjust the available sort options for a couple of special cases...
856
- if (this.withinCollection?.startsWith('fav-')) {
857
- // When viewing a fav- collection, we include the Date Favorited option as the default
863
+ if (
864
+ this.withinCollection?.startsWith('fav-') ||
865
+ (this.profileElement as string) === 'favorites'
866
+ ) {
867
+ // When viewing a fav- collection or the favorites profile tab,
868
+ // we include the Date Favorited option as the default
858
869
  sortFieldAvailability = favoritesSortAvailability;
859
870
  } else if (!this.withinCollection && this.searchType === SearchType.TV) {
860
871
  // When viewing TV search results, we exclude several of the usual date sort options.
@@ -1639,12 +1650,6 @@ export class CollectionBrowser
1639
1650
  this.maxSelectedDate = queryState.maxSelectedDate;
1640
1651
  this.selectedSort = queryState.selectedSort ?? SortField.default;
1641
1652
  this.sortDirection = queryState.sortDirection;
1642
- if (queryState.defaultSortField) {
1643
- this.defaultSortField = queryState.defaultSortField;
1644
- }
1645
- if (queryState.defaultSortDirection !== undefined) {
1646
- this.defaultSortDirection = queryState.defaultSortDirection;
1647
- }
1648
1653
  this.selectedTitleFilter = queryState.selectedTitleFilter;
1649
1654
  this.selectedCreatorFilter = queryState.selectedCreatorFilter;
1650
1655
 
@@ -1755,6 +1760,21 @@ export class CollectionBrowser
1755
1760
  }
1756
1761
  }
1757
1762
 
1763
+ if (changed.has('profileElement')) {
1764
+ this.applyDefaultProfileSort();
1765
+ }
1766
+
1767
+ if (changed.has('withinCollection') && this.withinCollection) {
1768
+ // Set a sensible default collection sort while we load results, which we will later
1769
+ // adjust based on any sort-by metadata once the response arrives.
1770
+ if (!this.baseQuery) {
1771
+ this.defaultSortField = this.withinCollection.startsWith('fav-')
1772
+ ? SortField.datefavorited
1773
+ : SortField.weeklyview;
1774
+ this.defaultSortDirection = 'desc';
1775
+ }
1776
+ }
1777
+
1758
1778
  if (changed.has('baseQuery')) {
1759
1779
  this.emitBaseQueryChanged();
1760
1780
  }
@@ -2067,22 +2087,6 @@ export class CollectionBrowser
2067
2087
  );
2068
2088
  }
2069
2089
 
2070
- /**
2071
- * Emits a `collectionExtraInfoLoaded` event when the data source has received
2072
- * collection metadata from the backend. This allows parent components to react
2073
- * to the metadata (e.g., to update their default sort based on the collection's
2074
- * `sort-by` metadata field).
2075
- */
2076
- emitCollectionExtraInfoLoaded(
2077
- collectionExtraInfo?: CollectionExtraInfo,
2078
- ): void {
2079
- this.dispatchEvent(
2080
- new CustomEvent('collectionExtraInfoLoaded', {
2081
- detail: collectionExtraInfo,
2082
- }),
2083
- );
2084
- }
2085
-
2086
2090
  /**
2087
2091
  * Emits a `queryStateChanged` event indicating that one or more of this component's
2088
2092
  * properties have changed in a way that could affect the set of search results.
@@ -2382,6 +2386,75 @@ export class CollectionBrowser
2382
2386
  }
2383
2387
  }
2384
2388
 
2389
+ /**
2390
+ * Applies the default sort options for the TV search results page
2391
+ */
2392
+ applyDefaultTVSearchSort(): void {
2393
+ this.defaultSortField = SortField.datearchived;
2394
+ this.defaultSortDirection = 'desc';
2395
+ }
2396
+
2397
+ /**
2398
+ * Applies any default sort option for the current collection, by checking
2399
+ * for one in the collection's metadata. If none is found, defaults to sorting
2400
+ * descending by:
2401
+ * - Date Favorited for fav-* collections
2402
+ * - Weekly views for all other collections
2403
+ */
2404
+ applyDefaultCollectionSort(collectionInfo?: CollectionExtraInfo): void {
2405
+ if (this.baseQuery) {
2406
+ // If there's a query set, then we default to relevance sorting regardless of
2407
+ // the collection metadata-specified sort.
2408
+ this.defaultSortField = SortField.relevance;
2409
+ this.defaultSortDirection = null;
2410
+ return;
2411
+ }
2412
+
2413
+ // Favorite collections sort on Date Favorited by default.
2414
+ // Other collections fall back to sorting on weekly views.
2415
+ const baseDefaultSort: string =
2416
+ collectionInfo?.public_metadata?.identifier?.startsWith('fav-')
2417
+ ? '-favoritedate'
2418
+ : '-week';
2419
+
2420
+ // The collection metadata may override the default sorting with something else
2421
+ const metadataSort: string | undefined =
2422
+ collectionInfo?.public_metadata?.['sort-by'];
2423
+
2424
+ // Prefer the metadata-specified sort if one exists
2425
+ const defaultSortToApply = metadataSort ?? baseDefaultSort;
2426
+
2427
+ // Account for both -field and field:dir formats
2428
+ let [field, dir] = defaultSortToApply.split(':');
2429
+ if (field.startsWith('-')) {
2430
+ field = field.slice(1);
2431
+ dir = 'desc';
2432
+ } else if (!['asc', 'desc'].includes(dir)) {
2433
+ dir = 'asc';
2434
+ }
2435
+
2436
+ const sortOption = sortOptionFromAPIString(field);
2437
+ const sortField = sortOption.field;
2438
+ if (sortField && sortField !== SortField.default) {
2439
+ this.defaultSortField = sortField;
2440
+ this.defaultSortDirection = dir as SortDirection;
2441
+ }
2442
+ }
2443
+
2444
+ /**
2445
+ * Applies the default sort option for the current profile element
2446
+ */
2447
+ applyDefaultProfileSort(): void {
2448
+ if (this.profileElement) {
2449
+ const defaultSortField = defaultProfileElementSorts[this.profileElement];
2450
+ this.defaultSortField = defaultSortField ?? SortField.weeklyview;
2451
+ } else {
2452
+ this.defaultSortField = SortField.weeklyview;
2453
+ }
2454
+
2455
+ this.defaultSortDirection = 'desc';
2456
+ }
2457
+
2385
2458
  /**
2386
2459
  * This is useful for determining whether we need to reload the scroller.
2387
2460
  *
@@ -1194,9 +1194,10 @@ export class CollectionBrowserDataSource
1194
1194
  if (withinCollection) {
1195
1195
  this.collectionExtraInfo = success.response.collectionExtraInfo;
1196
1196
 
1197
- // Emit the collection metadata so the parent page can set default sort
1197
+ // For collections, we want the UI to respect the default sort option
1198
+ // which can be specified in metadata, or otherwise assumed to be week:desc
1198
1199
  if (this.activeOnHost) {
1199
- this.host.emitCollectionExtraInfoLoaded(this.collectionExtraInfo);
1200
+ this.host.applyDefaultCollectionSort(this.collectionExtraInfo);
1200
1201
  }
1201
1202
 
1202
1203
  if (this.collectionExtraInfo) {
@@ -6,12 +6,7 @@ import type {
6
6
  SortDirection,
7
7
  SortParam,
8
8
  } from '@internetarchive/search-service';
9
- import type {
10
- ExplicitSortField,
11
- FacetLoadStrategy,
12
- SelectedFacets,
13
- SortField,
14
- } from '../models';
9
+ import type { FacetLoadStrategy, SelectedFacets, SortField } from '../models';
15
10
  import type { CollectionBrowserDataSourceInterface } from './collection-browser-data-source-interface';
16
11
 
17
12
  /**
@@ -32,8 +27,6 @@ export interface CollectionBrowserQueryState {
32
27
  selectedCreatorFilter: string | null;
33
28
  selectedSort?: SortField;
34
29
  sortDirection: SortDirection | null;
35
- defaultSortField?: ExplicitSortField;
36
- defaultSortDirection?: SortDirection | null;
37
30
  }
38
31
 
39
32
  /**
@@ -45,7 +38,7 @@ export interface CollectionBrowserSearchInterface
45
38
  searchService?: SearchServiceInterface;
46
39
  isTVCollection: boolean;
47
40
  readonly sortParam: SortParam | null;
48
- readonly defaultSortField: ExplicitSortField;
41
+ readonly defaultSortField: SortField | null;
49
42
  readonly defaultSortDirection: SortDirection | null;
50
43
  readonly facetLoadStrategy: FacetLoadStrategy;
51
44
  readonly initialPageNumber: number;
@@ -59,9 +52,7 @@ export interface CollectionBrowserSearchInterface
59
52
  setFacetsLoading(loading: boolean): void;
60
53
  setTotalResultCount(count: number): void;
61
54
  setTileCount(count: number): void;
62
- emitCollectionExtraInfoLoaded(
63
- collectionExtraInfo?: CollectionExtraInfo,
64
- ): void;
55
+ applyDefaultCollectionSort(collectionInfo?: CollectionExtraInfo): void;
65
56
  emitEmptyResults(): void;
66
57
  emitSearchError(): void;
67
58
  emitQueryStateChanged(): void;
package/src/models.ts CHANGED
@@ -3,7 +3,6 @@ import { msg } from '@lit/localize';
3
3
  import type { MediaType } from '@internetarchive/field-parsers';
4
4
  import {
5
5
  AggregationSortType,
6
- CollectionExtraInfo,
7
6
  HitType,
8
7
  SearchReview,
9
8
  SearchResult,
@@ -323,16 +322,6 @@ export enum SortField {
323
322
  'creator' = 'creator',
324
323
  }
325
324
 
326
- /**
327
- * A sort field other than the abstract "default" placeholder.
328
- * This is useful because the "default" sort field is just an indicator to
329
- * revert to an explicitly defined fallback value. So when defining default
330
- * sort logic, this type should be preferred to avoid accidentally permitting
331
- * that fallback to itself equal the "default" placeholder (which would be
332
- * rather circular/ill-defined).
333
- */
334
- export type ExplicitSortField = Exclude<SortField, SortField.default>;
335
-
336
325
  /**
337
326
  * Views-related sort fields
338
327
  */
@@ -564,47 +553,6 @@ export function sortOptionFromAPIString(sortName?: string | null): SortOption {
564
553
  );
565
554
  }
566
555
 
567
- /**
568
- * Resolves the default sort option for a collection based on its metadata.
569
- *
570
- * - Favorite collections (`fav-*`) default to Date Favorited descending.
571
- * - Other collections default to Weekly Views descending.
572
- * - If the collection metadata specifies a `sort-by` field, that overrides the above.
573
- *
574
- * Supports both `-field` (dash prefix = desc) and `field:dir` metadata formats.
575
- *
576
- * Note: This does NOT handle the "relevance when a query is present" rule,
577
- * which is managed separately by collection-browser itself.
578
- */
579
- export function resolveCollectionDefaultSort(
580
- collectionInfo?: CollectionExtraInfo,
581
- ): { field: ExplicitSortField; direction: SortDirection } {
582
- const isFav = collectionInfo?.public_metadata?.identifier?.startsWith('fav-');
583
- const baseDefaultSort: string = isFav ? '-favoritedate' : '-week';
584
- const metadataSort: string | undefined =
585
- collectionInfo?.public_metadata?.['sort-by'];
586
- const defaultSortToApply = metadataSort ?? baseDefaultSort;
587
-
588
- // Account for both -field and field:dir formats
589
- let [field, dir] = defaultSortToApply.split(':');
590
- if (field.startsWith('-')) {
591
- field = field.slice(1);
592
- dir = 'desc';
593
- } else if (!['asc', 'desc'].includes(dir)) {
594
- dir = 'asc';
595
- }
596
-
597
- const sortOption = sortOptionFromAPIString(field);
598
- const sortField = sortOption.field;
599
- if (sortField && sortField !== SortField.default) {
600
- return {
601
- field: sortField as ExplicitSortField,
602
- direction: dir as SortDirection,
603
- };
604
- }
605
- return { field: SortField.weeklyview, direction: 'desc' };
606
- }
607
-
608
556
  export const defaultSortAvailability: Record<SortField, boolean> = {
609
557
  [SortField.relevance]: true,
610
558
  [SortField.weeklyview]: true,
@@ -632,7 +580,10 @@ export const tvSortAvailability: Record<SortField, boolean> = {
632
580
  [SortField.dateadded]: false,
633
581
  };
634
582
 
635
- export const defaultProfileElementSorts: Record<string, ExplicitSortField> = {
583
+ export const defaultProfileElementSorts: Record<
584
+ string,
585
+ Exclude<SortField, SortField.default>
586
+ > = {
636
587
  uploads: SortField.datearchived,
637
588
  reviews: SortField.datereviewed,
638
589
  collections: SortField.datearchived,
@@ -337,7 +337,9 @@ export class RestorationStateHandler
337
337
  if (facetAnds) {
338
338
  facetAnds.forEach(and => {
339
339
  // eslint-disable-next-line prefer-const
340
- let [field, value] = and.split(':');
340
+ let [field, ...valueParts] = and.split(':');
341
+ if (!valueParts.length) return;
342
+ const value = valueParts.join(':');
341
343
 
342
344
  // Legacy search allowed and[] fields like 'creatorSorter', 'languageSorter', etc.
343
345
  // which we want to normalize to 'creator', 'language', etc. if redirected here.
@@ -396,7 +398,9 @@ export class RestorationStateHandler
396
398
 
397
399
  if (facetNots) {
398
400
  facetNots.forEach(not => {
399
- const [field, value] = not.split(':');
401
+ const [field, ...valueParts] = not.split(':');
402
+ if (!valueParts.length) return;
403
+ const value = valueParts.join(':');
400
404
  this.setSelectedFacetState(
401
405
  restorationState.selectedFacets,
402
406
  field as FacetOption,
@@ -531,7 +535,7 @@ export class RestorationStateHandler
531
535
  if (!facet) return; // Unrecognized facet group, ignore it.
532
536
 
533
537
  const unQuotedValue = this.stripQuotes(value);
534
- facet[unQuotedValue] ??= this.getDefaultBucket(value);
538
+ facet[unQuotedValue] ??= this.getDefaultBucket(unQuotedValue);
535
539
  facet[unQuotedValue].state = state;
536
540
  }
537
541
 
@@ -13,7 +13,6 @@ import type { SortDirection } from '@internetarchive/search-service';
13
13
  import {
14
14
  CollectionDisplayMode,
15
15
  defaultSortAvailability,
16
- type ExplicitSortField,
17
16
  PrefixFilterCounts,
18
17
  PrefixFilterType,
19
18
  SORT_OPTIONS,
@@ -43,8 +42,10 @@ export class SortFilterBar extends LitElement {
43
42
  @property({ type: String }) defaultSortDirection: SortDirection | null = null;
44
43
 
45
44
  /** The default sort field to use if none is set */
46
- @property({ type: String }) defaultSortField: ExplicitSortField =
47
- SortField.relevance;
45
+ @property({ type: String }) defaultSortField: Exclude<
46
+ SortField,
47
+ SortField.default
48
+ > = SortField.relevance;
48
49
 
49
50
  /** The current sort direction (asc/desc), or null if none is set */
50
51
  @property({ type: String }) sortDirection: SortDirection | null = null;
@@ -1313,19 +1313,20 @@ describe('Collection Browser', () => {
1313
1313
  );
1314
1314
  });
1315
1315
 
1316
- it('sets default sort from externally-provided values', async () => {
1316
+ it('sets default sort from collection metadata', async () => {
1317
1317
  const searchService = new MockSearchService();
1318
1318
  const el = await fixture<CollectionBrowser>(
1319
1319
  html`<collection-browser
1320
1320
  .searchService=${searchService}
1321
1321
  .baseNavigationUrl=${''}
1322
- .withinCollection=${'test-collection'}
1323
- .defaultSortField=${SortField.title}
1324
- .defaultSortDirection=${'asc'}
1325
1322
  ></collection-browser>`,
1326
1323
  );
1327
1324
 
1325
+ el.withinCollection = 'default-sort';
1326
+ await el.updateComplete;
1327
+ await el.initialSearchComplete;
1328
1328
  await el.updateComplete;
1329
+ await aTimeout(50);
1329
1330
 
1330
1331
  const sortBar = el.shadowRoot?.querySelector(
1331
1332
  'sort-filter-bar',
@@ -1337,19 +1338,20 @@ describe('Collection Browser', () => {
1337
1338
  expect(sortBar.sortDirection).to.be.null;
1338
1339
  });
1339
1340
 
1340
- it('reflects updated default sort field/direction on sort bar', async () => {
1341
+ it('sets default sort from collection metadata in "-field" format', async () => {
1341
1342
  const searchService = new MockSearchService();
1342
1343
  const el = await fixture<CollectionBrowser>(
1343
1344
  html`<collection-browser
1344
1345
  .searchService=${searchService}
1345
1346
  .baseNavigationUrl=${''}
1346
- .withinCollection=${'test-collection'}
1347
- .defaultSortField=${SortField.dateadded}
1348
- .defaultSortDirection=${'desc'}
1349
1347
  ></collection-browser>`,
1350
1348
  );
1351
1349
 
1350
+ el.withinCollection = 'default-sort-concise';
1351
+ await el.updateComplete;
1352
+ await el.initialSearchComplete;
1352
1353
  await el.updateComplete;
1354
+ await aTimeout(50);
1353
1355
 
1354
1356
  const sortBar = el.shadowRoot?.querySelector(
1355
1357
  'sort-filter-bar',
@@ -1361,15 +1363,14 @@ describe('Collection Browser', () => {
1361
1363
  expect(sortBar.sortDirection).to.be.null;
1362
1364
  });
1363
1365
 
1364
- it('uses weekly views as default sort when set externally for profiles', async () => {
1366
+ it('falls back to weekly views default sorting on profiles when tab not set', async () => {
1365
1367
  const el = await fixture<CollectionBrowser>(
1366
1368
  html`<collection-browser
1367
1369
  .withinProfile=${'@foobar'}
1368
- .defaultSortField=${SortField.weeklyview}
1369
- .defaultSortDirection=${'desc'}
1370
1370
  ></collection-browser>`,
1371
1371
  );
1372
1372
 
1373
+ el.applyDefaultProfileSort();
1373
1374
  expect(el.defaultSortParam).to.deep.equal({
1374
1375
  field: 'week',
1375
1376
  direction: 'desc',
@@ -1402,19 +1403,20 @@ describe('Collection Browser', () => {
1402
1403
  expect(sortBar.sortDirection).to.be.null;
1403
1404
  });
1404
1405
 
1405
- it('uses date favorited sort as default when set externally for fav- collection', async () => {
1406
+ it('uses date favorited sort as default when targeting fav- collection', async () => {
1406
1407
  const searchService = new MockSearchService();
1407
1408
  const el = await fixture<CollectionBrowser>(
1408
1409
  html`<collection-browser
1409
1410
  .searchService=${searchService}
1410
1411
  .baseNavigationUrl=${''}
1411
- .withinCollection=${'fav-sort'}
1412
- .defaultSortField=${SortField.datefavorited}
1413
- .defaultSortDirection=${'desc'}
1414
1412
  ></collection-browser>`,
1415
1413
  );
1416
1414
 
1415
+ el.withinCollection = 'fav-sort';
1417
1416
  await el.updateComplete;
1417
+ await el.initialSearchComplete;
1418
+ await el.updateComplete;
1419
+ await aTimeout(50);
1418
1420
 
1419
1421
  const sortBar = el.shadowRoot?.querySelector(
1420
1422
  'sort-filter-bar',
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
+ });