@internetarchive/collection-browser 2.19.1-alpha-webdev7818.0 → 2.20.1-alpha-webdev7822.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.
Files changed (44) hide show
  1. package/dist/src/app-root.js +606 -605
  2. package/dist/src/app-root.js.map +1 -1
  3. package/dist/src/collection-browser.d.ts +5 -0
  4. package/dist/src/collection-browser.js +36 -11
  5. package/dist/src/collection-browser.js.map +1 -1
  6. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +75 -75
  7. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  8. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +54 -54
  9. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  10. package/dist/src/collection-facets.js +263 -263
  11. package/dist/src/collection-facets.js.map +1 -1
  12. package/dist/src/expanded-date-picker.js +52 -52
  13. package/dist/src/expanded-date-picker.js.map +1 -1
  14. package/dist/src/models.d.ts +13 -0
  15. package/dist/src/models.js +41 -0
  16. package/dist/src/models.js.map +1 -1
  17. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +79 -24
  18. package/dist/src/sort-filter-bar/sort-filter-bar.js +201 -119
  19. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  20. package/dist/src/tiles/grid/item-tile.js +139 -139
  21. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  22. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +118 -118
  23. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  24. package/dist/src/tiles/list/tile-list.js +289 -289
  25. package/dist/src/tiles/list/tile-list.js.map +1 -1
  26. package/dist/src/tiles/tile-dispatcher.js +200 -200
  27. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  28. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +157 -11
  29. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/app-root.ts +1140 -1140
  32. package/src/collection-browser.ts +38 -10
  33. package/src/collection-facets/smart-facets/smart-facet-bar.ts +437 -437
  34. package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +185 -185
  35. package/src/collection-facets.ts +990 -990
  36. package/src/expanded-date-picker.ts +191 -191
  37. package/src/models.ts +48 -0
  38. package/src/sort-filter-bar/sort-filter-bar.ts +220 -126
  39. package/src/tiles/grid/item-tile.ts +339 -339
  40. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +129 -129
  41. package/src/tiles/list/tile-list.ts +688 -688
  42. package/src/tiles/tile-dispatcher.ts +486 -486
  43. package/test/sort-filter-bar/sort-filter-bar.test.ts +205 -12
  44. package/tsconfig.json +1 -1
@@ -47,6 +47,9 @@ import {
47
47
  tvFacetDisplayOrder,
48
48
  TvClipFilterType,
49
49
  TileBlurOverrideState,
50
+ defaultSortAvailability,
51
+ favoritesSortAvailability,
52
+ tvSortAvailability,
50
53
  } from './models';
51
54
  import {
52
55
  RestorationStateHandlerInterface,
@@ -201,6 +204,12 @@ export class CollectionBrowser
201
204
  */
202
205
  @property({ type: Boolean }) suppressURLQuery = false;
203
206
 
207
+ /**
208
+ * Whether to suppress persistence of the `sin` search type param to the URL.
209
+ * If true, the `sin` param will not be added to the URL or updated on query changes.
210
+ */
211
+ @property({ type: Boolean }) suppressURLSinParam = false;
212
+
204
213
  /**
205
214
  * Whether to suppress display of the sort bar.
206
215
  * If true, the entire sort bar (incl. display modes) will be omitted from rendering.
@@ -236,7 +245,7 @@ export class CollectionBrowser
236
245
  */
237
246
  @property({ type: String }) facetLoadStrategy: FacetLoadStrategy = 'eager';
238
247
 
239
- @property({ type: Boolean }) facetPaneVisible = false;
248
+ @property({ type: Boolean, reflect: true }) facetPaneVisible = false;
240
249
 
241
250
  @property({ type: Boolean }) clearResultsOnEmptyQuery = false;
242
251
 
@@ -675,11 +684,7 @@ export class CollectionBrowser
675
684
  */
676
685
  private get desktopLeftColumnTemplate(): TemplateResult {
677
686
  return html`
678
- <div
679
- id="left-column"
680
- class="column"
681
- ?hidden=${!this.facetPaneVisible}
682
- >
687
+ <div id="left-column" class="column" ?hidden=${!this.facetPaneVisible}>
683
688
  ${this.facetTopViewSlot}
684
689
  <div id="facets-header-container">
685
690
  <h2 id="facets-header" class="sr-only">${msg('Filters')}</h2>
@@ -802,14 +807,37 @@ export class CollectionBrowser
802
807
  private get sortFilterBarTemplate(): TemplateResult | typeof nothing {
803
808
  if (this.suppressSortBar) return nothing;
804
809
 
810
+ // Determine the set of sortable fields that should be shown in the sort bar
811
+ let defaultViewSort = SortField.weeklyview;
812
+ let defaultDateSort = SortField.date;
813
+ let sortFieldAvailability = defaultSortAvailability;
814
+
815
+ // We adjust the sort options for a couple of special cases...
816
+ if (this.withinCollection?.startsWith('fav-')) {
817
+ // When viewing a fav- collection, we include the Date Favorited option and show
818
+ // it as the default in the date dropdown.
819
+ defaultDateSort = SortField.datefavorited;
820
+ sortFieldAvailability = favoritesSortAvailability;
821
+ } else if (!this.withinCollection && this.searchType === SearchType.TV) {
822
+ // When viewing TV search results, we default the views dropdown to All-time Views
823
+ // and exclude several of the usual date sort options.
824
+ defaultViewSort = SortField.alltimeview;
825
+ defaultDateSort = SortField.datearchived;
826
+ sortFieldAvailability = tvSortAvailability;
827
+ }
828
+
829
+ // We only show relevance sort if a search query is currently defined
830
+ sortFieldAvailability.relevance = this.isRelevanceSortAvailable;
831
+
805
832
  return html`
806
833
  <sort-filter-bar
807
834
  .defaultSortField=${this.defaultSortField}
808
835
  .defaultSortDirection=${this.defaultSortDirection}
836
+ .defaultViewSort=${defaultViewSort}
837
+ .defaultDateSort=${defaultDateSort}
809
838
  .selectedSort=${this.selectedSort}
810
839
  .sortDirection=${this.sortDirection}
811
- .showRelevance=${this.isRelevanceSortAvailable}
812
- .showDateFavorited=${this.withinCollection?.startsWith('fav-')}
840
+ .sortFieldAvailability=${sortFieldAvailability}
813
841
  .displayMode=${this.displayMode}
814
842
  .selectedTitleFilter=${this.selectedTitleFilter}
815
843
  .selectedCreatorFilter=${this.selectedCreatorFilter}
@@ -1982,7 +2010,7 @@ export class CollectionBrowser
1982
2010
  private restoreState() {
1983
2011
  const restorationState = this.restorationStateHandler.getRestorationState();
1984
2012
  this.displayMode = restorationState.displayMode;
1985
- if (restorationState.searchType != null)
2013
+ if (!this.suppressURLSinParam && restorationState.searchType != null)
1986
2014
  this.searchType = restorationState.searchType;
1987
2015
  this.selectedSort = restorationState.selectedSort ?? SortField.default;
1988
2016
  this.sortDirection = restorationState.sortDirection ?? null;
@@ -2002,7 +2030,7 @@ export class CollectionBrowser
2002
2030
  private persistState() {
2003
2031
  const restorationState: RestorationState = {
2004
2032
  displayMode: this.displayMode,
2005
- searchType: this.searchType,
2033
+ searchType: this.suppressURLSinParam ? undefined : this.searchType,
2006
2034
  selectedSort: this.selectedSort,
2007
2035
  sortDirection: this.sortDirection ?? undefined,
2008
2036
  selectedFacets: this.selectedFacets ?? getDefaultSelectedFacets(),