@internetarchive/collection-browser 1.1.0 → 1.1.1-alpha.2

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 (111) hide show
  1. package/dist/index.d.ts +9 -9
  2. package/dist/index.js +9 -9
  3. package/dist/index.js.map +1 -1
  4. package/dist/src/app-root.js.map +1 -1
  5. package/dist/src/collection-browser.d.ts +35 -4
  6. package/dist/src/collection-browser.js +115 -38
  7. package/dist/src/collection-browser.js.map +1 -1
  8. package/dist/src/collection-facets/facets-template.d.ts +1 -1
  9. package/dist/src/collection-facets/facets-template.js +3 -3
  10. package/dist/src/collection-facets/facets-template.js.map +1 -1
  11. package/dist/src/collection-facets/more-facets-content.d.ts +1 -1
  12. package/dist/src/collection-facets/more-facets-content.js +3 -3
  13. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  14. package/dist/src/collection-facets/more-facets-pagination.js +3 -3
  15. package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
  16. package/dist/src/collection-facets/toggle-switch.js +1 -1
  17. package/dist/src/collection-facets/toggle-switch.js.map +1 -1
  18. package/dist/src/collection-facets.d.ts +2 -2
  19. package/dist/src/collection-facets.js +12 -11
  20. package/dist/src/collection-facets.js.map +1 -1
  21. package/dist/src/empty-placeholder.js +2 -2
  22. package/dist/src/empty-placeholder.js.map +1 -1
  23. package/dist/src/language-code-handler/language-code-handler.js +1 -1
  24. package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
  25. package/dist/src/mediatype/mediatype-config.js +13 -13
  26. package/dist/src/mediatype/mediatype-config.js.map +1 -1
  27. package/dist/src/restoration-state-handler.d.ts +1 -1
  28. package/dist/src/restoration-state-handler.js +18 -2
  29. package/dist/src/restoration-state-handler.js.map +1 -1
  30. package/dist/src/sort-filter-bar/alpha-bar.d.ts +1 -1
  31. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  32. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +1 -1
  33. package/dist/src/sort-filter-bar/sort-filter-bar.js +8 -8
  34. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  35. package/dist/src/tiles/grid/account-tile.d.ts +1 -1
  36. package/dist/src/tiles/grid/account-tile.js +1 -1
  37. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  38. package/dist/src/tiles/grid/collection-tile.d.ts +1 -1
  39. package/dist/src/tiles/grid/collection-tile.js +3 -3
  40. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  41. package/dist/src/tiles/grid/item-tile.d.ts +1 -1
  42. package/dist/src/tiles/grid/item-tile.js +3 -3
  43. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  44. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +1 -1
  45. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  46. package/dist/src/tiles/grid/tile-stats.js +6 -6
  47. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  48. package/dist/src/tiles/hover/hover-pane-controller.d.ts +1 -1
  49. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  50. package/dist/src/tiles/hover/tile-hover-pane.d.ts +1 -1
  51. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
  52. package/dist/src/tiles/image-block.d.ts +1 -1
  53. package/dist/src/tiles/image-block.js.map +1 -1
  54. package/dist/src/tiles/item-image.d.ts +1 -1
  55. package/dist/src/tiles/item-image.js +1 -1
  56. package/dist/src/tiles/item-image.js.map +1 -1
  57. package/dist/src/tiles/list/tile-list-compact-header.d.ts +1 -1
  58. package/dist/src/tiles/list/tile-list-compact-header.js +1 -1
  59. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  60. package/dist/src/tiles/list/tile-list-compact.d.ts +1 -1
  61. package/dist/src/tiles/list/tile-list-compact.js +4 -4
  62. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  63. package/dist/src/tiles/list/tile-list.d.ts +1 -1
  64. package/dist/src/tiles/list/tile-list.js +6 -6
  65. package/dist/src/tiles/list/tile-list.js.map +1 -1
  66. package/dist/src/tiles/mediatype-icon.js +1 -1
  67. package/dist/src/tiles/mediatype-icon.js.map +1 -1
  68. package/dist/src/tiles/overlay/icon-overlay.js +2 -2
  69. package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
  70. package/dist/src/tiles/overlay/icon-text-overlay.js +2 -2
  71. package/dist/src/tiles/overlay/icon-text-overlay.js.map +1 -1
  72. package/dist/src/tiles/overlay/text-overlay.js +2 -2
  73. package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
  74. package/dist/src/tiles/tile-dispatcher.d.ts +4 -3
  75. package/dist/src/tiles/tile-dispatcher.js +7 -1
  76. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  77. package/dist/test/restoration-state-handler.test.js +28 -0
  78. package/dist/test/restoration-state-handler.test.js.map +1 -1
  79. package/index.ts +9 -9
  80. package/package.json +14 -13
  81. package/src/app-root.ts +1 -1
  82. package/src/collection-browser.ts +116 -38
  83. package/src/collection-facets/facets-template.ts +3 -3
  84. package/src/collection-facets/more-facets-content.ts +3 -3
  85. package/src/collection-facets/more-facets-pagination.ts +3 -3
  86. package/src/collection-facets/toggle-switch.ts +1 -1
  87. package/src/collection-facets.ts +11 -11
  88. package/src/empty-placeholder.ts +2 -2
  89. package/src/language-code-handler/language-code-handler.ts +1 -1
  90. package/src/mediatype/mediatype-config.ts +13 -13
  91. package/src/restoration-state-handler.ts +19 -2
  92. package/src/sort-filter-bar/alpha-bar.ts +2 -2
  93. package/src/sort-filter-bar/sort-filter-bar.ts +8 -8
  94. package/src/tiles/grid/account-tile.ts +2 -2
  95. package/src/tiles/grid/collection-tile.ts +4 -4
  96. package/src/tiles/grid/item-tile.ts +4 -4
  97. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +1 -1
  98. package/src/tiles/grid/tile-stats.ts +6 -6
  99. package/src/tiles/hover/hover-pane-controller.ts +1 -1
  100. package/src/tiles/hover/tile-hover-pane.ts +1 -1
  101. package/src/tiles/image-block.ts +1 -1
  102. package/src/tiles/item-image.ts +2 -2
  103. package/src/tiles/list/tile-list-compact-header.ts +2 -2
  104. package/src/tiles/list/tile-list-compact.ts +5 -5
  105. package/src/tiles/list/tile-list.ts +6 -6
  106. package/src/tiles/mediatype-icon.ts +1 -1
  107. package/src/tiles/overlay/icon-overlay.ts +2 -2
  108. package/src/tiles/overlay/icon-text-overlay.ts +2 -2
  109. package/src/tiles/overlay/text-overlay.ts +2 -2
  110. package/src/tiles/tile-dispatcher.ts +6 -3
  111. package/test/restoration-state-handler.test.ts +44 -0
@@ -56,21 +56,21 @@ import {
56
56
  PrefixFilterCounts,
57
57
  prefixFilterAggregationKeys,
58
58
  FacetEventDetails,
59
- } from './models';
59
+ } from './models.js';
60
60
  import {
61
61
  RestorationStateHandlerInterface,
62
62
  RestorationStateHandler,
63
63
  RestorationState,
64
- } from './restoration-state-handler';
65
- import chevronIcon from './assets/img/icons/chevron';
66
- import type { PlaceholderType } from './empty-placeholder';
64
+ } from './restoration-state-handler.js';
65
+ import chevronIcon from './assets/img/icons/chevron.js';
66
+ import type { PlaceholderType } from './empty-placeholder.js';
67
67
  import './empty-placeholder';
68
68
 
69
69
  import {
70
70
  analyticsActions,
71
71
  analyticsCategories,
72
- } from './utils/analytics-events';
73
- import { srOnlyStyle } from './styles/sr-only';
72
+ } from './utils/analytics-events.js';
73
+ import { srOnlyStyle } from './styles/sr-only.js';
74
74
 
75
75
  @customElement('collection-browser')
76
76
  export class CollectionBrowser
@@ -147,6 +147,10 @@ export class CollectionBrowser
147
147
  */
148
148
  @property({ type: Boolean }) isManageView = false;
149
149
 
150
+ @property({ type: Boolean }) prerender = false;
151
+ @property({ type: Object }) prerenderSearchResults?: SearchResult[];
152
+ @property({ type: Number }) totalResults?: number;
153
+
150
154
  /**
151
155
  * The page that the consumer wants to load.
152
156
  */
@@ -173,14 +177,14 @@ export class CollectionBrowser
173
177
 
174
178
  @state() private fullYearsHistogramAggregation: Aggregation | undefined;
175
179
 
176
- @state() private totalResults?: number;
177
-
178
180
  @state() private queryErrorMessage?: string;
179
181
 
180
182
  @state() private mobileView = false;
181
183
 
182
184
  @state() private mobileFacetsVisible = false;
183
185
 
186
+ @state() private contentWidth?: number;
187
+
184
188
  @state() private placeholderType: PlaceholderType = null;
185
189
 
186
190
  @state() private prefixFilterCountMap: Partial<
@@ -343,6 +347,12 @@ export class CollectionBrowser
343
347
 
344
348
  render() {
345
349
  this.setPlaceholderType();
350
+
351
+ if (this.prerender && this.prerenderSearchResults) {
352
+ this.updateDataSource(1, this.prerenderSearchResults);
353
+ this.totalResults ??= this.prerenderSearchResults.length;
354
+ }
355
+
346
356
  return html`
347
357
  <div
348
358
  id="content-container"
@@ -356,6 +366,8 @@ export class CollectionBrowser
356
366
  }
357
367
 
358
368
  private setPlaceholderType() {
369
+ if (this.prerender && this.prerenderSearchResults) return null;
370
+
359
371
  this.placeholderType = null;
360
372
  if (!this.baseQuery?.trim()) {
361
373
  this.placeholderType = 'empty-query';
@@ -383,52 +395,110 @@ export class CollectionBrowser
383
395
  `;
384
396
  }
385
397
 
398
+ /**
399
+ * Top-level template for rendering the left (facets) and right (results) columns.
400
+ */
386
401
  private get collectionBrowserTemplate() {
387
- const shouldShowSearching =
388
- this.searchResultsLoading || this.totalResults === undefined;
389
- const resultsCount = this.totalResults?.toLocaleString();
390
- const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
391
- return html` <div id="left-column-scroll-sentinel"></div>
402
+ return html`
403
+ <div id="left-column-scroll-sentinel"></div>
404
+ ${this.leftColumnTemplate} ${this.rightColumnTemplate}
405
+ `;
406
+ }
407
+
408
+ /**
409
+ * Template for either the mobile or desktop version of the left column, depending
410
+ * on current component state.
411
+ */
412
+ private get leftColumnTemplate(): TemplateResult {
413
+ if (this.mobileView) {
414
+ return this.mobileLeftColumnTemplate;
415
+ }
416
+ return this.desktopLeftColumnTemplate;
417
+ }
418
+
419
+ /**
420
+ * Template for the mobile version of the "left column" (which in this case, appears
421
+ * *above* the search results rather than beside them), for rendering the
422
+ * accordion-style facets.
423
+ */
424
+ private get mobileLeftColumnTemplate(): TemplateResult {
425
+ return html`
392
426
  <div
393
427
  id="left-column"
394
428
  class="column${this.isResizeToMobile ? ' preload' : ''}"
395
429
  >
396
- <div id="mobile-header-container">
397
- ${this.mobileView
398
- ? this.mobileFacetsTemplate
399
- : html`<h2 id="facets-header" class="sr-only">Filters</h2>`}
400
- <div id="results-total">
401
- <span id="big-results-count">
402
- ${shouldShowSearching ? html`Searching&hellip;` : resultsCount}
403
- </span>
404
- <span id="big-results-label">
405
- ${shouldShowSearching ? nothing : resultsLabel}
406
- </span>
407
- </div>
408
- ${this.mobileView ? nothing : this.clearFiltersBtnTemplate(false)}
430
+ ${this.resultsCountTemplate}
431
+ <div id="facets-header-container">${this.mobileFacetsTemplate}</div>
432
+ </div>
433
+ `;
434
+ }
435
+
436
+ /**
437
+ * Template for the desktop version of the left column, displaying the facets sidebar.
438
+ */
439
+ private get desktopLeftColumnTemplate(): TemplateResult {
440
+ return html`
441
+ <div id="left-column" class="column">
442
+ <div id="facets-header-container">
443
+ <h2 id="facets-header" class="sr-only">Filters</h2>
444
+ ${this.resultsCountTemplate} ${this.clearFiltersBtnTemplate(false)}
409
445
  </div>
410
- ${this.mobileView
411
- ? nothing
412
- : html`<div id="facets-container" aria-labelledby="facets-header">
413
- ${this.facetsTemplate}
414
- <div id="facets-scroll-sentinel"></div>
415
- </div>`}
416
- ${this.mobileView ? nothing : html`<div id="facets-bottom-fade"></div>`}
446
+ <div id="facets-container" aria-labelledby="facets-header">
447
+ ${this.facetsTemplate}
448
+ <div id="facets-scroll-sentinel"></div>
449
+ </div>
450
+ <div id="facets-bottom-fade"></div>
417
451
  </div>
452
+ `;
453
+ }
454
+
455
+ /**
456
+ * Template for the "X Results" count at the top of the search results.
457
+ * Changes to the "Searching..." label if the search results are still loading.
458
+ */
459
+ private get resultsCountTemplate(): TemplateResult {
460
+ const shouldShowSearching =
461
+ this.searchResultsLoading || this.totalResults === undefined;
462
+ const resultsCount = this.totalResults?.toLocaleString();
463
+ const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
464
+
465
+ return html`
466
+ <div id="results-total">
467
+ <span id="big-results-count">
468
+ ${shouldShowSearching ? html`Searching&hellip;` : resultsCount}
469
+ </span>
470
+ <span id="big-results-label">
471
+ ${shouldShowSearching ? nothing : resultsLabel}
472
+ </span>
473
+ </div>
474
+ `;
475
+ }
476
+
477
+ /**
478
+ * Template for the right column of the collection browser, where the result
479
+ * tiles and sort/filter bar are shown.
480
+ */
481
+ private get rightColumnTemplate(): TemplateResult {
482
+ return html`
418
483
  <div id="right-column" class="column">
419
484
  ${this.sortFilterBarTemplate}
420
485
  ${this.displayMode === `list-compact`
421
486
  ? this.listHeaderTemplate
422
487
  : nothing}
423
488
  ${this.infiniteScrollerTemplate}
424
- </div>`;
489
+ </div>
490
+ `;
425
491
  }
426
492
 
427
493
  private get infiniteScrollerTemplate() {
494
+ let itemCount = this.placeholderType ? 0 : nothing;
495
+ if (this.prerender && this.totalResults) itemCount = this.totalResults;
496
+
428
497
  return html`<infinite-scroller
429
498
  class=${this.infiniteScrollerClasses}
430
- itemCount=${this.placeholderType ? 0 : nothing}
431
499
  ariaLandmarkLabel="Search results"
500
+ ?prerender=${this.prerender}
501
+ .itemCount=${itemCount}
432
502
  .cellProvider=${this}
433
503
  .placeholderCellTemplate=${this.placeholderCellTemplate}
434
504
  @scrollThresholdReached=${this.scrollThresholdReached}
@@ -647,6 +717,7 @@ export class CollectionBrowser
647
717
  .collectionNameCache=${this.collectionNameCache}
648
718
  .showHistogramDatePicker=${this.showHistogramDatePicker}
649
719
  .allowExpandingDatePicker=${!this.mobileView}
720
+ .contentWidth=${this.contentWidth}
650
721
  .query=${this.baseQuery}
651
722
  .filterMap=${this.filterMap}
652
723
  .modalManager=${this.modalManager}
@@ -869,7 +940,8 @@ export class CollectionBrowser
869
940
  handleResize(entry: ResizeObserverEntry): void {
870
941
  const previousView = this.mobileView;
871
942
  if (entry.target === this.contentContainer) {
872
- this.mobileView = entry.contentRect.width < this.mobileBreakpoint;
943
+ this.contentWidth = entry.contentRect.width;
944
+ this.mobileView = this.contentWidth < this.mobileBreakpoint;
873
945
  // If changing from desktop to mobile disable transition
874
946
  if (this.mobileView && !previousView) {
875
947
  this.isResizeToMobile = true;
@@ -1762,6 +1834,7 @@ export class CollectionBrowser
1762
1834
 
1763
1835
  return html`
1764
1836
  <tile-dispatcher
1837
+ ?prerender=${this.prerender}
1765
1838
  .baseNavigationUrl=${this.baseNavigationUrl}
1766
1839
  .baseImageUrl=${this.baseImageUrl}
1767
1840
  .model=${model}
@@ -1827,6 +1900,10 @@ export class CollectionBrowser
1827
1900
  transition: transform 0.2s ease-out;
1828
1901
  }
1829
1902
 
1903
+ #mobile-filter-collapse {
1904
+ width: 100%;
1905
+ }
1906
+
1830
1907
  #mobile-filter-collapse > summary {
1831
1908
  cursor: pointer;
1832
1909
  list-style: none;
@@ -1957,14 +2034,14 @@ export class CollectionBrowser
1957
2034
  background: transparent;
1958
2035
  }
1959
2036
 
1960
- #mobile-header-container {
2037
+ #facets-header-container {
1961
2038
  display: flex;
1962
2039
  justify-content: space-between;
1963
2040
  align-items: flex-start;
1964
2041
  margin: 10px 0;
1965
2042
  }
1966
2043
 
1967
- .desktop #mobile-header-container {
2044
+ .desktop #facets-header-container {
1968
2045
  padding-top: 2rem;
1969
2046
  flex-wrap: wrap;
1970
2047
  }
@@ -2037,6 +2114,7 @@ export class CollectionBrowser
2037
2114
  }
2038
2115
 
2039
2116
  .mobile #results-total {
2117
+ float: right;
2040
2118
  margin-bottom: 0;
2041
2119
  margin-right: 5px;
2042
2120
  }
@@ -2,8 +2,8 @@ import { css, html, LitElement, TemplateResult, CSSResultGroup } from 'lit';
2
2
  import { customElement, property } from 'lit/decorators.js';
3
3
  import { repeat } from 'lit/directives/repeat.js';
4
4
  import type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';
5
- import eyeIcon from '../assets/img/icons/eye';
6
- import eyeClosedIcon from '../assets/img/icons/eye-closed';
5
+ import eyeIcon from '../assets/img/icons/eye.js';
6
+ import eyeClosedIcon from '../assets/img/icons/eye-closed.js';
7
7
  import {
8
8
  FacetGroup,
9
9
  FacetOption,
@@ -12,7 +12,7 @@ import {
12
12
  getDefaultSelectedFacets,
13
13
  FacetEventDetails,
14
14
  FacetState,
15
- } from '../models';
15
+ } from '../models.js';
16
16
 
17
17
  @customElement('facets-template')
18
18
  export class FacetsTemplate extends LitElement {
@@ -31,16 +31,16 @@ import {
31
31
  suppressedCollections,
32
32
  valueFacetSort,
33
33
  defaultFacetSort,
34
- } from '../models';
34
+ } from '../models.js';
35
35
  import '@internetarchive/ia-activity-indicator/ia-activity-indicator';
36
36
  import './more-facets-pagination';
37
37
  import './facets-template';
38
38
  import {
39
39
  analyticsActions,
40
40
  analyticsCategories,
41
- } from '../utils/analytics-events';
41
+ } from '../utils/analytics-events.js';
42
42
  import './toggle-switch';
43
- import { srOnlyStyle } from '../styles/sr-only';
43
+ import { srOnlyStyle } from '../styles/sr-only.js';
44
44
 
45
45
  @customElement('more-facets-content')
46
46
  export class MoreFacetsContent extends LitElement {
@@ -7,9 +7,9 @@ import {
7
7
  TemplateResult,
8
8
  } from 'lit';
9
9
  import { customElement, property, state } from 'lit/decorators.js';
10
- import arrowLeftIcon from '../assets/img/icons/arrow-left';
11
- import arrowRightIcon from '../assets/img/icons/arrow-right';
12
- import { srOnlyStyle } from '../styles/sr-only';
10
+ import arrowLeftIcon from '../assets/img/icons/arrow-left.js';
11
+ import arrowRightIcon from '../assets/img/icons/arrow-right.js';
12
+ import { srOnlyStyle } from '../styles/sr-only.js';
13
13
 
14
14
  @customElement('more-facets-pagination')
15
15
  export class MoreFacetsPagination extends LitElement {
@@ -1,6 +1,6 @@
1
1
  import { css, html, LitElement, CSSResultGroup } from 'lit';
2
2
  import { customElement, property, query } from 'lit/decorators.js';
3
- import { srOnlyStyle } from '../styles/sr-only';
3
+ import { srOnlyStyle } from '../styles/sr-only.js';
4
4
 
5
5
  export type Side = 'left' | 'right';
6
6
 
@@ -30,8 +30,8 @@ import type { FeatureFeedbackServiceInterface } from '@internetarchive/feature-f
30
30
  import type { RecaptchaManagerInterface } from '@internetarchive/recaptcha-manager';
31
31
  import type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';
32
32
  import type { SharedResizeObserverInterface } from '@internetarchive/shared-resize-observer';
33
- import chevronIcon from './assets/img/icons/chevron';
34
- import expandIcon from './assets/img/icons/expand';
33
+ import chevronIcon from './assets/img/icons/chevron.js';
34
+ import expandIcon from './assets/img/icons/expand.js';
35
35
  import {
36
36
  FacetOption,
37
37
  SelectedFacets,
@@ -44,7 +44,7 @@ import {
44
44
  LendingFacetKey,
45
45
  suppressedCollections,
46
46
  defaultFacetSort,
47
- } from './models';
47
+ } from './models.js';
48
48
  import './collection-facets/more-facets-content';
49
49
  import './collection-facets/facets-template';
50
50
  import './collection-facets/facet-tombstone-row';
@@ -52,9 +52,9 @@ import './expanded-date-picker';
52
52
  import {
53
53
  analyticsActions,
54
54
  analyticsCategories,
55
- } from './utils/analytics-events';
56
- import { srOnlyStyle } from './styles/sr-only';
57
- import { ExpandedDatePicker } from './expanded-date-picker';
55
+ } from './utils/analytics-events.js';
56
+ import { srOnlyStyle } from './styles/sr-only.js';
57
+ import { ExpandedDatePicker } from './expanded-date-picker.js';
58
58
 
59
59
  @customElement('collection-facets')
60
60
  export class CollectionFacets extends LitElement {
@@ -80,6 +80,8 @@ export class CollectionFacets extends LitElement {
80
80
 
81
81
  @property({ type: Boolean }) collapsableFacets = false;
82
82
 
83
+ @property({ type: Number }) contentWidth?: number;
84
+
83
85
  @property({ type: Boolean }) showHistogramDatePicker = false;
84
86
 
85
87
  @property({ type: Boolean }) allowExpandingDatePicker = false;
@@ -229,10 +231,6 @@ export class CollectionFacets extends LitElement {
229
231
  : nothing;
230
232
  }
231
233
 
232
- private get currentYearsHistogramAggregation(): Aggregation | undefined {
233
- return this.aggregations?.year_histogram;
234
- }
235
-
236
234
  private get histogramTemplate() {
237
235
  const { fullYearsHistogramAggregation } = this;
238
236
  return this.fullYearAggregationLoading
@@ -245,7 +243,9 @@ export class CollectionFacets extends LitElement {
245
243
  .maxSelectedDate=${this.maxSelectedDate}
246
244
  .updateDelay=${100}
247
245
  missingDataMessage="..."
248
- .width=${180}
246
+ .width=${this.collapsableFacets && this.contentWidth
247
+ ? this.contentWidth
248
+ : 180}
249
249
  .bins=${fullYearsHistogramAggregation?.buckets as number[]}
250
250
  @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
251
251
  ></histogram-date-range>
@@ -9,8 +9,8 @@ import {
9
9
  import { customElement, property } from 'lit/decorators.js';
10
10
  import { choose } from 'lit/directives/choose.js';
11
11
 
12
- import emptyQueryIcon from './assets/img/icons/empty-query';
13
- import nullResultIcon from './assets/img/icons/null-result';
12
+ import emptyQueryIcon from './assets/img/icons/empty-query.js';
13
+ import nullResultIcon from './assets/img/icons/null-result.js';
14
14
 
15
15
  export type PlaceholderType =
16
16
  | 'empty-query'
@@ -1,4 +1,4 @@
1
- import { codeToLanguageMap } from './language-code-mapping';
1
+ import { codeToLanguageMap } from './language-code-mapping.js';
2
2
 
3
3
  // To serialize the list of potential language codes, we store
4
4
  // the string in the format `en-us|en|en-gb` with `|` being the separator.
@@ -1,16 +1,16 @@
1
- import { accountIcon } from '../assets/img/icons/mediatype/account';
2
- import { audioIcon } from '../assets/img/icons/mediatype/audio';
3
- import { collectionIcon } from '../assets/img/icons/mediatype/collection';
4
- import { dataIcon } from '../assets/img/icons/mediatype/data';
5
- import { etreeIcon } from '../assets/img/icons/mediatype/etree';
6
- import { imagesIcon } from '../assets/img/icons/mediatype/images';
7
- import { filmIcon } from '../assets/img/icons/mediatype/film';
8
- import { radioIcon } from '../assets/img/icons/mediatype/radio';
9
- import { softwareIcon } from '../assets/img/icons/mediatype/software';
10
- import { textsIcon } from '../assets/img/icons/mediatype/texts';
11
- import { tvIcon } from '../assets/img/icons/mediatype/tv';
12
- import { videoIcon } from '../assets/img/icons/mediatype/video';
13
- import { webIcon } from '../assets/img/icons/mediatype/web';
1
+ import { accountIcon } from '../assets/img/icons/mediatype/account.js';
2
+ import { audioIcon } from '../assets/img/icons/mediatype/audio.js';
3
+ import { collectionIcon } from '../assets/img/icons/mediatype/collection.js';
4
+ import { dataIcon } from '../assets/img/icons/mediatype/data.js';
5
+ import { etreeIcon } from '../assets/img/icons/mediatype/etree.js';
6
+ import { imagesIcon } from '../assets/img/icons/mediatype/images.js';
7
+ import { filmIcon } from '../assets/img/icons/mediatype/film.js';
8
+ import { radioIcon } from '../assets/img/icons/mediatype/radio.js';
9
+ import { softwareIcon } from '../assets/img/icons/mediatype/software.js';
10
+ import { textsIcon } from '../assets/img/icons/mediatype/texts.js';
11
+ import { tvIcon } from '../assets/img/icons/mediatype/tv.js';
12
+ import { videoIcon } from '../assets/img/icons/mediatype/video.js';
13
+ import { webIcon } from '../assets/img/icons/mediatype/web.js';
14
14
 
15
15
  export const mediatypeConfig: { [key: string]: any } = {
16
16
  account: {
@@ -17,8 +17,8 @@ import {
17
17
  URLSortField,
18
18
  getDefaultSelectedFacets,
19
19
  MetadataFieldToURLField,
20
- } from './models';
21
- import { arrayEquals } from './utils/array-equals';
20
+ } from './models.js';
21
+ import { arrayEquals } from './utils/array-equals.js';
22
22
 
23
23
  export interface RestorationState {
24
24
  displayMode?: CollectionDisplayMode;
@@ -216,6 +216,16 @@ export class RestorationStateHandler
216
216
  const facetAnds = url.searchParams.getAll('and[]');
217
217
  const facetNots = url.searchParams.getAll('not[]');
218
218
 
219
+ // We also need to check for the presence of params like 'and[0]', 'not[1]', etc.
220
+ // since Facebook automatically converts URLs with [] into those forms.
221
+ for (const [key, val] of url.searchParams.entries()) {
222
+ if (/and\[\d+\]/.test(key)) {
223
+ facetAnds.push(val);
224
+ } else if (/not\[\d+\]/.test(key)) {
225
+ facetNots.push(val);
226
+ }
227
+ }
228
+
219
229
  // Legacy search allowed `q` and `search` params for the query, so in the interest
220
230
  // of backwards-compatibility with old bookmarks, we recognize those here too.
221
231
  // (However, they still get upgraded to a `query` param when we persist our state
@@ -387,6 +397,13 @@ export class RestorationStateHandler
387
397
  searchParams.delete('and[]');
388
398
  searchParams.delete('not[]');
389
399
 
400
+ // Remove any and/not facet params that contain numbers in their square brackets
401
+ for (const key of searchParams.keys()) {
402
+ if (/(and|not)\[\d+\]/.test(key)) {
403
+ searchParams.delete(key);
404
+ }
405
+ }
406
+
390
407
  // Also remove some legacy params that should have been upgraded to the ones above
391
408
  searchParams.delete('q');
392
409
  searchParams.delete('search');
@@ -1,9 +1,9 @@
1
1
  import { LitElement, html, css, nothing, TemplateResult } from 'lit';
2
2
  import { customElement, property, state, query } from 'lit/decorators.js';
3
- import type { PrefixFilterCounts } from '../models';
3
+ import type { PrefixFilterCounts } from '../models.js';
4
4
 
5
5
  import './alpha-bar-tooltip';
6
- import type { AlphaBarTooltip } from './alpha-bar-tooltip';
6
+ import type { AlphaBarTooltip } from './alpha-bar-tooltip.js';
7
7
 
8
8
  @customElement('alpha-bar')
9
9
  export class AlphaBar extends LitElement {
@@ -21,16 +21,16 @@ import {
21
21
  PrefixFilterType,
22
22
  SortField,
23
23
  SortFieldDisplayName,
24
- } from '../models';
24
+ } from '../models.js';
25
25
  import './alpha-bar';
26
26
 
27
- import { sortUpIcon } from './img/sort-toggle-up';
28
- import { sortDownIcon } from './img/sort-toggle-down';
29
- import { sortDisabledIcon } from './img/sort-toggle-disabled';
30
- import { tileIcon } from './img/tile';
31
- import { listIcon } from './img/list';
32
- import { compactIcon } from './img/compact';
33
- import { srOnlyStyle } from '../styles/sr-only';
27
+ import { sortUpIcon } from './img/sort-toggle-up.js';
28
+ import { sortDownIcon } from './img/sort-toggle-down.js';
29
+ import { sortDisabledIcon } from './img/sort-toggle-disabled.js';
30
+ import { tileIcon } from './img/tile.js';
31
+ import { listIcon } from './img/list.js';
32
+ import { compactIcon } from './img/compact.js';
33
+ import { srOnlyStyle } from '../styles/sr-only.js';
34
34
 
35
35
  type AlphaSelector = 'creator' | 'title';
36
36
 
@@ -1,8 +1,8 @@
1
1
  import { css, html, LitElement, nothing, TemplateResult } from 'lit';
2
2
  import { customElement, property } from 'lit/decorators.js';
3
- import type { TileModel } from '../../models';
3
+ import type { TileModel } from '../../models.js';
4
4
 
5
- import { baseTileStyles } from './styles/tile-grid-shared-styles';
5
+ import { baseTileStyles } from './styles/tile-grid-shared-styles.js';
6
6
  import '../image-block';
7
7
  import './tile-stats';
8
8
 
@@ -7,10 +7,10 @@ import {
7
7
  TemplateResult,
8
8
  } from 'lit';
9
9
  import { customElement, property } from 'lit/decorators.js';
10
- import { collectionIcon } from '../../assets/img/icons/mediatype/collection';
11
- import type { TileModel } from '../../models';
12
- import { formatUnitSize } from '../../utils/format-unit-size';
13
- import { baseTileStyles } from './styles/tile-grid-shared-styles';
10
+ import { collectionIcon } from '../../assets/img/icons/mediatype/collection.js';
11
+ import type { TileModel } from '../../models.js';
12
+ import { formatUnitSize } from '../../utils/format-unit-size.js';
13
+ import { baseTileStyles } from './styles/tile-grid-shared-styles.js';
14
14
  import '../image-block';
15
15
 
16
16
  @customElement('collection-tile')
@@ -11,11 +11,11 @@ import { customElement, property } from 'lit/decorators.js';
11
11
  import { ifDefined } from 'lit/directives/if-defined.js';
12
12
  import type { SortParam } from '@internetarchive/search-service';
13
13
 
14
- import { DateFormat, formatDate } from '../../utils/format-date';
15
- import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';
16
- import type { TileModel } from '../../models';
14
+ import { DateFormat, formatDate } from '../../utils/format-date.js';
15
+ import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc.js';
16
+ import type { TileModel } from '../../models.js';
17
17
 
18
- import { baseTileStyles } from './styles/tile-grid-shared-styles';
18
+ import { baseTileStyles } from './styles/tile-grid-shared-styles.js';
19
19
  import '../image-block';
20
20
  import '../text-snippet-block';
21
21
  import '../item-image';
@@ -1,5 +1,5 @@
1
1
  import { css } from 'lit';
2
- import { srOnlyStyle } from '../../../styles/sr-only';
2
+ import { srOnlyStyle } from '../../../styles/sr-only.js';
3
3
 
4
4
  /**
5
5
  * Base tile styles
@@ -1,13 +1,13 @@
1
1
  import { css, CSSResultGroup, html, LitElement } from 'lit';
2
2
  import { customElement, property } from 'lit/decorators.js';
3
3
 
4
- import { favoriteFilledIcon } from '../../assets/img/icons/favorite-filled';
5
- import { reviewsIcon } from '../../assets/img/icons/reviews';
6
- import { uploadIcon } from '../../assets/img/icons/upload';
7
- import { viewsIcon } from '../../assets/img/icons/views';
8
- import { srOnlyStyle } from '../../styles/sr-only';
4
+ import { favoriteFilledIcon } from '../../assets/img/icons/favorite-filled.js';
5
+ import { reviewsIcon } from '../../assets/img/icons/reviews.js';
6
+ import { uploadIcon } from '../../assets/img/icons/upload.js';
7
+ import { viewsIcon } from '../../assets/img/icons/views.js';
8
+ import { srOnlyStyle } from '../../styles/sr-only.js';
9
9
 
10
- import { formatCount } from '../../utils/format-count';
10
+ import { formatCount } from '../../utils/format-count.js';
11
11
 
12
12
  @customElement('tile-stats')
13
13
  export class TileStats extends LitElement {
@@ -7,7 +7,7 @@ import {
7
7
  ReactiveController,
8
8
  ReactiveControllerHost,
9
9
  } from 'lit';
10
- import type { TileModel } from '../../models';
10
+ import type { TileModel } from '../../models.js';
11
11
 
12
12
  type HoverPaneState = 'hidden' | 'shown' | 'fading-out';
13
13
 
@@ -2,7 +2,7 @@ import type { CollectionNameCacheInterface } from '@internetarchive/collection-n
2
2
  import type { SortParam } from '@internetarchive/search-service';
3
3
  import { css, CSSResultGroup, html, LitElement, TemplateResult } from 'lit';
4
4
  import { customElement, property } from 'lit/decorators.js';
5
- import type { TileModel } from '../../models';
5
+ import type { TileModel } from '../../models.js';
6
6
  import '../list/tile-list';
7
7
 
8
8
  @customElement('tile-hover-pane')
@@ -2,7 +2,7 @@ import { css, CSSResultGroup, html, LitElement, nothing } from 'lit';
2
2
  import { customElement, property } from 'lit/decorators.js';
3
3
  import { ClassInfo, classMap } from 'lit/directives/class-map.js';
4
4
 
5
- import type { TileModel } from '../models';
5
+ import type { TileModel } from '../models.js';
6
6
 
7
7
  import './overlay/icon-overlay';
8
8
  import './overlay/text-overlay';
@@ -2,12 +2,12 @@ import { css, CSSResultGroup, html, LitElement, nothing } from 'lit';
2
2
  import { customElement, property, query, state } from 'lit/decorators.js';
3
3
  import { ClassInfo, classMap } from 'lit/directives/class-map.js';
4
4
 
5
- import type { TileModel } from '../models';
5
+ import type { TileModel } from '../models.js';
6
6
 
7
7
  import {
8
8
  baseItemImageStyles,
9
9
  waveformGradientStyles,
10
- } from '../styles/item-image-styles';
10
+ } from '../styles/item-image-styles.js';
11
11
 
12
12
  @customElement('item-image')
13
13
  export class ItemImage extends LitElement {