@internetarchive/collection-browser 0.0.1-alpha.9 → 0.1.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 (227) hide show
  1. package/README.md +8 -11
  2. package/demo/app-root.ts +17 -92
  3. package/dist/demo/app-root.d.ts +3 -5
  4. package/dist/demo/app-root.js +14 -83
  5. package/dist/demo/app-root.js.map +1 -1
  6. package/dist/index.d.ts +6 -0
  7. package/dist/index.js +6 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/src/assets/img/icons/chevron.d.ts +2 -0
  10. package/dist/src/assets/img/icons/chevron.js +4 -0
  11. package/dist/src/assets/img/icons/chevron.js.map +1 -0
  12. package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -2
  13. package/dist/src/assets/img/icons/mediatype/account.js +6 -4
  14. package/dist/src/assets/img/icons/mediatype/account.js.map +1 -1
  15. package/dist/src/assets/img/icons/mediatype/audio.js +7 -4
  16. package/dist/src/assets/img/icons/mediatype/audio.js.map +1 -1
  17. package/dist/src/assets/img/icons/mediatype/collection.js +7 -4
  18. package/dist/src/assets/img/icons/mediatype/collection.js.map +1 -1
  19. package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -0
  20. package/dist/src/assets/img/icons/mediatype/data.js +15 -0
  21. package/dist/src/assets/img/icons/mediatype/data.js.map +1 -0
  22. package/dist/src/assets/img/icons/mediatype/etree.js +10 -5
  23. package/dist/src/assets/img/icons/mediatype/etree.js.map +1 -1
  24. package/dist/src/assets/img/icons/mediatype/film.js +2 -1
  25. package/dist/src/assets/img/icons/mediatype/film.js.map +1 -1
  26. package/dist/src/assets/img/icons/mediatype/images.js +9 -6
  27. package/dist/src/assets/img/icons/mediatype/images.js.map +1 -1
  28. package/dist/src/assets/img/icons/mediatype/livemusic.d.ts +1 -0
  29. package/dist/src/assets/img/icons/mediatype/livemusic.js +7 -0
  30. package/dist/src/assets/img/icons/mediatype/livemusic.js.map +1 -0
  31. package/dist/src/assets/img/icons/mediatype/photos.d.ts +1 -0
  32. package/dist/src/assets/img/icons/mediatype/photos.js +7 -0
  33. package/dist/src/assets/img/icons/mediatype/photos.js.map +1 -0
  34. package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -0
  35. package/dist/src/assets/img/icons/mediatype/radio.js +15 -0
  36. package/dist/src/assets/img/icons/mediatype/radio.js.map +1 -0
  37. package/dist/src/assets/img/icons/mediatype/software.js +9 -6
  38. package/dist/src/assets/img/icons/mediatype/software.js.map +1 -1
  39. package/dist/src/assets/img/icons/mediatype/texts.js +9 -6
  40. package/dist/src/assets/img/icons/mediatype/texts.js.map +1 -1
  41. package/dist/src/assets/img/icons/mediatype/tv.js +10 -5
  42. package/dist/src/assets/img/icons/mediatype/tv.js.map +1 -1
  43. package/dist/src/assets/img/icons/mediatype/video.js +10 -6
  44. package/dist/src/assets/img/icons/mediatype/video.js.map +1 -1
  45. package/dist/src/assets/img/icons/mediatype/web.js +9 -6
  46. package/dist/src/assets/img/icons/mediatype/web.js.map +1 -1
  47. package/dist/src/collection-browser.d.ts +54 -31
  48. package/dist/src/collection-browser.js +508 -166
  49. package/dist/src/collection-browser.js.map +1 -1
  50. package/dist/src/collection-facets.d.ts +28 -13
  51. package/dist/src/collection-facets.js +276 -160
  52. package/dist/src/collection-facets.js.map +1 -1
  53. package/dist/src/helpers.d.ts +1 -0
  54. package/dist/src/helpers.js +20 -0
  55. package/dist/src/helpers.js.map +1 -0
  56. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -0
  57. package/dist/src/language-code-handler/language-code-handler.js +27 -0
  58. package/dist/src/language-code-handler/language-code-handler.js.map +1 -0
  59. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -0
  60. package/dist/src/language-code-handler/language-code-mapping.js +563 -0
  61. package/dist/src/language-code-handler/language-code-mapping.js.map +1 -0
  62. package/dist/src/mediatype/mediatype-color.d.ts +3 -0
  63. package/dist/src/mediatype/mediatype-color.js +15 -0
  64. package/dist/src/mediatype/mediatype-color.js.map +1 -0
  65. package/dist/src/mediatype/mediatype-config.d.ts +3 -0
  66. package/dist/src/mediatype/mediatype-config.js +86 -0
  67. package/dist/src/mediatype/mediatype-config.js.map +1 -0
  68. package/dist/src/mediatype/mediatype-display.d.ts +3 -0
  69. package/dist/src/mediatype/mediatype-display.js +86 -0
  70. package/dist/src/mediatype/mediatype-display.js.map +1 -0
  71. package/dist/src/mediatype/mediatype-icon.d.ts +10 -0
  72. package/dist/src/mediatype/mediatype-icon.js +105 -0
  73. package/dist/src/mediatype/mediatype-icon.js.map +1 -0
  74. package/dist/src/mediatype/mediatype-text.d.ts +3 -0
  75. package/dist/src/mediatype/mediatype-text.js +17 -0
  76. package/dist/src/mediatype/mediatype-text.js.map +1 -0
  77. package/dist/src/mediatype/mediatypeConfig.d.ts +3 -0
  78. package/dist/src/mediatype/mediatypeConfig.js +86 -0
  79. package/dist/src/mediatype/mediatypeConfig.js.map +1 -0
  80. package/dist/src/mediatype-icon.d.ts +2 -2
  81. package/dist/src/mediatype-icon.js +35 -46
  82. package/dist/src/mediatype-icon.js.map +1 -1
  83. package/dist/src/models.d.ts +72 -13
  84. package/dist/src/models.js +57 -1
  85. package/dist/src/models.js.map +1 -1
  86. package/dist/src/restoration-state-handler.d.ts +38 -0
  87. package/dist/src/restoration-state-handler.js +204 -0
  88. package/dist/src/restoration-state-handler.js.map +1 -0
  89. package/dist/src/sort-filter-bar/alpha-bar.d.ts +1 -1
  90. package/dist/src/sort-filter-bar/alpha-bar.js +9 -2
  91. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  92. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -0
  93. package/dist/src/sort-filter-bar/img/compact.js +5 -0
  94. package/dist/src/sort-filter-bar/img/compact.js.map +1 -0
  95. package/dist/src/sort-filter-bar/img/list.js +1 -1
  96. package/dist/src/sort-filter-bar/img/list.js.map +1 -1
  97. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -0
  98. package/dist/src/sort-filter-bar/img/tile.js +5 -0
  99. package/dist/src/sort-filter-bar/img/tile.js.map +1 -0
  100. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +71 -14
  101. package/dist/src/sort-filter-bar/sort-filter-bar.js +499 -216
  102. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  103. package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -0
  104. package/dist/src/tiles/collection-browser-loading-tile.js +32 -0
  105. package/dist/src/tiles/collection-browser-loading-tile.js.map +1 -0
  106. package/dist/src/tiles/grid/account-tile.d.ts +1 -1
  107. package/dist/src/tiles/grid/account-tile.js +5 -5
  108. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  109. package/dist/src/tiles/grid/collection-tile.js +1 -2
  110. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  111. package/dist/src/tiles/grid/icons/views.d.ts +1 -1
  112. package/dist/src/tiles/grid/icons/views.js +2 -2
  113. package/dist/src/tiles/grid/icons/views.js.map +1 -1
  114. package/dist/src/tiles/grid/item-tile.d.ts +3 -3
  115. package/dist/src/tiles/grid/item-tile.js +55 -152
  116. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  117. package/dist/src/tiles/item-image.d.ts +21 -0
  118. package/dist/src/tiles/item-image.js +215 -0
  119. package/dist/src/tiles/item-image.js.map +1 -0
  120. package/dist/src/tiles/list/account-label.d.ts +1 -0
  121. package/dist/src/tiles/list/account-label.js +7 -0
  122. package/dist/src/tiles/list/account-label.js.map +1 -0
  123. package/dist/src/tiles/list/date-label.d.ts +1 -0
  124. package/dist/src/tiles/list/date-label.js +13 -0
  125. package/dist/src/tiles/list/date-label.js.map +1 -0
  126. package/dist/src/tiles/list/tile-list-compact-header.d.ts +12 -0
  127. package/dist/src/tiles/list/tile-list-compact-header.js +84 -0
  128. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -0
  129. package/dist/src/tiles/list/tile-list-compact.d.ts +13 -0
  130. package/dist/src/tiles/list/tile-list-compact.js +206 -6
  131. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  132. package/dist/src/tiles/list/tile-list.d.ts +36 -10
  133. package/dist/src/tiles/list/tile-list.js +370 -103
  134. package/dist/src/tiles/list/tile-list.js.map +1 -1
  135. package/dist/src/tiles/loading-tile.js +1 -42
  136. package/dist/src/tiles/loading-tile.js.map +1 -1
  137. package/dist/src/tiles/mediatype-icon.d.ts +9 -0
  138. package/dist/src/tiles/mediatype-icon.js +78 -0
  139. package/dist/src/tiles/mediatype-icon.js.map +1 -0
  140. package/dist/src/tiles/tile-dispatcher.d.ts +12 -4
  141. package/dist/src/tiles/tile-dispatcher.js +62 -20
  142. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  143. package/dist/src/utils/format-date.js +2 -2
  144. package/dist/src/utils/format-date.js.map +1 -1
  145. package/dist/src/utils/format-string.d.ts +2 -0
  146. package/dist/src/utils/format-string.js +7 -0
  147. package/dist/src/utils/format-string.js.map +1 -0
  148. package/dist/src/waveform-thumbnail.d.ts +7 -0
  149. package/dist/src/waveform-thumbnail.js +106 -0
  150. package/dist/src/waveform-thumbnail.js.map +1 -0
  151. package/dist/src/waveform-view.d.ts +0 -0
  152. package/dist/src/waveform-view.js +2 -0
  153. package/dist/src/waveform-view.js.map +1 -0
  154. package/dist/src/your-webcomponent.d.ts +8 -0
  155. package/dist/src/your-webcomponent.js +38 -0
  156. package/dist/src/your-webcomponent.js.map +1 -0
  157. package/dist/test/collection-browser.test.d.ts +1 -0
  158. package/dist/test/collection-browser.test.js +16 -2
  159. package/dist/test/collection-browser.test.js.map +1 -1
  160. package/dist/test/mediatype-config.test.d.ts +1 -0
  161. package/dist/test/mediatype-config.test.js +17 -0
  162. package/dist/test/mediatype-config.test.js.map +1 -0
  163. package/dist/test/mediatype-icon.test.d.ts +0 -0
  164. package/dist/test/mediatype-icon.test.js +3 -0
  165. package/dist/test/mediatype-icon.test.js.map +1 -0
  166. package/dist/test/mediatypeConfig.test.d.ts +1 -0
  167. package/dist/test/mediatypeConfig.test.js +17 -0
  168. package/dist/test/mediatypeConfig.test.js.map +1 -0
  169. package/dist/test/utils/format-date.test.js +1 -1
  170. package/dist/test/utils/format-date.test.js.map +1 -1
  171. package/dist/test/utils/format-string.test.d.ts +1 -0
  172. package/dist/test/utils/format-string.test.js +17 -0
  173. package/dist/test/utils/format-string.test.js.map +1 -0
  174. package/dist/test/your-webcomponent.test.d.ts +1 -0
  175. package/dist/test/your-webcomponent.test.js +23 -0
  176. package/dist/test/your-webcomponent.test.js.map +1 -0
  177. package/index.ts +6 -0
  178. package/local.archive.org.cert +86 -0
  179. package/local.archive.org.key +27 -0
  180. package/package.json +9 -5
  181. package/src/assets/img/icons/chevron.ts +4 -0
  182. package/src/assets/img/icons/mediatype/account.ts +6 -4
  183. package/src/assets/img/icons/mediatype/audio.ts +7 -4
  184. package/src/assets/img/icons/mediatype/collection.ts +7 -4
  185. package/src/assets/img/icons/mediatype/data.ts +15 -0
  186. package/src/assets/img/icons/mediatype/etree.ts +10 -5
  187. package/src/assets/img/icons/mediatype/film.ts +2 -1
  188. package/src/assets/img/icons/mediatype/images.ts +9 -6
  189. package/src/assets/img/icons/mediatype/radio.ts +15 -0
  190. package/src/assets/img/icons/mediatype/software.ts +9 -6
  191. package/src/assets/img/icons/mediatype/texts.ts +9 -6
  192. package/src/assets/img/icons/mediatype/tv.ts +10 -5
  193. package/src/assets/img/icons/mediatype/video.ts +10 -6
  194. package/src/assets/img/icons/mediatype/web.ts +9 -6
  195. package/src/collection-browser.ts +532 -163
  196. package/src/collection-facets.ts +307 -205
  197. package/src/language-code-handler/language-code-handler.ts +64 -0
  198. package/src/language-code-handler/language-code-mapping.ts +564 -0
  199. package/src/mediatype/mediatype-config.ts +86 -0
  200. package/src/models.ts +141 -13
  201. package/src/restoration-state-handler.ts +266 -0
  202. package/src/sort-filter-bar/alpha-bar.ts +9 -3
  203. package/src/sort-filter-bar/img/compact.ts +5 -0
  204. package/src/sort-filter-bar/img/list.ts +1 -1
  205. package/src/sort-filter-bar/img/tile.ts +5 -0
  206. package/src/sort-filter-bar/sort-filter-bar.ts +557 -225
  207. package/src/tiles/collection-browser-loading-tile.ts +29 -0
  208. package/src/tiles/grid/account-tile.ts +1 -1
  209. package/src/tiles/grid/collection-tile.ts +1 -2
  210. package/src/tiles/grid/icons/views.ts +2 -2
  211. package/src/tiles/grid/item-tile.ts +54 -164
  212. package/src/tiles/item-image.ts +218 -0
  213. package/src/tiles/list/account-label.ts +6 -0
  214. package/src/tiles/list/date-label.ts +12 -0
  215. package/src/tiles/list/tile-list-compact-header.ts +77 -0
  216. package/src/tiles/list/tile-list-compact.ts +220 -0
  217. package/src/tiles/list/tile-list.ts +414 -107
  218. package/src/tiles/mediatype-icon.ts +75 -0
  219. package/src/tiles/tile-dispatcher.ts +71 -19
  220. package/src/utils/format-date.ts +2 -2
  221. package/test/collection-browser.test.ts +20 -1
  222. package/test/mediatype-config.test.ts +18 -0
  223. package/test/utils/format-date.test.ts +1 -1
  224. package/web-dev-server.config.mjs +3 -1
  225. package/src/mediatype-icon.ts +0 -83
  226. package/src/sort-filter-bar/img/grid.ts +0 -5
  227. package/src/tiles/loading-tile.ts +0 -70
@@ -2,22 +2,33 @@ import { __decorate } from "tslib";
2
2
  /* eslint-disable import/no-duplicates */
3
3
  import { html, css, LitElement, nothing, } from 'lit';
4
4
  import { customElement, property, query, state } from 'lit/decorators.js';
5
- import { SearchParams, } from '@internetarchive/search-service';
6
- import { AggregateSearchParams, SortParam, } from '@internetarchive/search-service/dist/src/search-params';
5
+ import { ifDefined } from 'lit/directives/if-defined.js';
7
6
  import '@internetarchive/infinite-scroller';
8
7
  import './tiles/tile-dispatcher';
9
- import './tiles/loading-tile';
8
+ import './tiles/collection-browser-loading-tile';
10
9
  import './sort-filter-bar/sort-filter-bar';
11
10
  import './collection-facets';
12
11
  import './circular-activity-indicator';
13
12
  import './sort-filter-bar/sort-filter-bar';
13
+ import { SortField, SortFieldToMetadataField, defaultSelectedFacets, } from './models';
14
+ import { RestorationStateHandler, } from './restoration-state-handler';
15
+ import chevronIcon from './assets/img/icons/chevron';
16
+ import { LanguageCodeHandler } from './language-code-handler/language-code-handler';
14
17
  let CollectionBrowser = class CollectionBrowser extends LitElement {
15
18
  constructor() {
16
19
  super(...arguments);
17
- this.showDeleteButtons = false;
18
- this.displayMode = 'grid';
19
20
  this.sortParam = null;
21
+ this.selectedSort = SortField.relevance;
22
+ this.selectedTitleFilter = null;
23
+ this.selectedCreatorFilter = null;
24
+ this.sortDirection = null;
20
25
  this.pageSize = 50;
26
+ this.showHistogramDatePicker = false;
27
+ this.pageContext = 'search';
28
+ this.restorationStateHandler = new RestorationStateHandler({
29
+ context: this.pageContext,
30
+ });
31
+ this.mobileBreakpoint = 600;
21
32
  /**
22
33
  * The page that the consumer wants to load.
23
34
  */
@@ -30,10 +41,11 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
30
41
  */
31
42
  this.pagesToRender = this.initialPageNumber;
32
43
  this.searchResultsLoading = false;
33
- this.selectedFacets = {};
34
- this.hiddenFacets = {};
35
44
  this.facetsLoading = false;
36
45
  this.fullYearAggregationLoading = false;
46
+ this.mobileView = false;
47
+ this.mobileFacetsVisible = false;
48
+ this.languageCodeHandler = new LanguageCodeHandler();
37
49
  /**
38
50
  * When we're animated scrolling to the page, we don't want to fetch
39
51
  * all of the pages as it scrolls so this lets us know if we're scrolling
@@ -43,7 +55,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
43
55
  * When we've reached the end of the data, stop trying to fetch more
44
56
  */
45
57
  this.endOfDataReached = false;
46
- this.placeholderCellTemplate = html `<loading-tile></loading-tile>`;
58
+ this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
47
59
  /**
48
60
  * The results per page so we can paginate.
49
61
  *
@@ -55,6 +67,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
55
67
  // we only want to scroll on the very first query change
56
68
  // so this keeps track of whether we've already set the initial query
57
69
  this.initialQueryChangeHappened = false;
70
+ this.historyPopOccurred = false;
58
71
  // this maps the query to the pages being fetched for that query
59
72
  this.pageFetchesInProgress = {};
60
73
  }
@@ -93,54 +106,100 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
93
106
  return Object.keys(this.dataSource).reduce((acc, page) => acc + this.dataSource[page].length, 0);
94
107
  }
95
108
  /**
109
+ * Go to the given page of results
96
110
  *
97
111
  * @param pageNumber
98
- * @param scroll
99
112
  */
100
113
  goToPage(pageNumber) {
101
114
  this.initialPageNumber = pageNumber;
102
115
  this.pagesToRender = pageNumber;
103
116
  this.scrollToPage(pageNumber);
104
117
  }
118
+ clearFilters() {
119
+ this.selectedFacets = defaultSelectedFacets;
120
+ this.sortParam = null;
121
+ this.selectedTitleFilter = null;
122
+ this.selectedCreatorFilter = null;
123
+ this.titleQuery = undefined;
124
+ this.creatorQuery = undefined;
125
+ this.selectedSort = SortField.relevance;
126
+ this.sortDirection = null;
127
+ }
105
128
  render() {
106
129
  return html `
107
- ${this.queryDebuggingTemplate}
108
-
109
- <div id="content-container">
130
+ <div id="content-container" class=${this.mobileView ? 'mobile' : ''}>
110
131
  <div id="left-column" class="column">
111
- <div id="results-total">
112
- <span id="big-results-count"
113
- >${this.totalResults
132
+ <div id="mobile-header-container">
133
+ ${this.mobileView
134
+ ? html `
135
+ <div id="mobile-filter-collapse">
136
+ <h1
137
+ @click=${() => {
138
+ this.mobileFacetsVisible = !this.mobileFacetsVisible;
139
+ }}
140
+ @keyup=${() => {
141
+ this.mobileFacetsVisible = !this.mobileFacetsVisible;
142
+ }}
143
+ >
144
+ <span
145
+ class="collapser ${this.mobileFacetsVisible
146
+ ? 'open'
147
+ : ''}"
148
+ >
149
+ ${chevronIcon}
150
+ </span>
151
+ Filters
152
+ </h1>
153
+ </div>
154
+ `
155
+ : nothing}
156
+ <div id="results-total">
157
+ <span id="big-results-count"
158
+ >${this.totalResults !== undefined
114
159
  ? this.totalResults.toLocaleString()
115
160
  : '-'}</span
116
- >
117
- <span id="big-results-label">Results</span>
161
+ >
162
+ <span id="big-results-label">Results</span>
163
+ </div>
118
164
  </div>
119
- <div id="facets-container">
120
- ${this.facetsLoading ? this.loadingTemplate : nothing}
121
- <collection-facets
122
- @facetsChanged=${this.facetsChanged}
123
- @hiddenFacetsChanged=${this.hiddenFacetsChanged}
124
- @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
125
- .aggregations=${this.aggregations}
126
- .fullYearsHistogramAggregation=${this
127
- .fullYearsHistogramAggregation}
128
- ?facetsLoading=${this.facetDataLoading}
129
- ?fullYearAggregationLoading=${this.fullYearAggregationLoading}
130
- ></collection-facets>
165
+ <div
166
+ id="facets-container"
167
+ class=${!this.mobileView || this.mobileFacetsVisible
168
+ ? 'expanded'
169
+ : ''}
170
+ >
171
+ ${this.facetsTemplate}
131
172
  </div>
132
173
  </div>
133
174
  <div id="right-column" class="column">
134
175
  ${this.searchResultsLoading ? this.loadingTemplate : nothing}
135
176
  <sort-filter-bar
136
- @sortChanged=${this.sortChanged}
177
+ .selectedSort=${this.selectedSort}
178
+ .sortDirection=${this.sortDirection}
179
+ .displayMode=${this.displayMode}
180
+ .selectedTitleFilter=${this.selectedTitleFilter}
181
+ .selectedCreatorFilter=${this.selectedCreatorFilter}
182
+ .resizeObserver=${this.resizeObserver}
183
+ @sortChanged=${this.userChangedSort}
137
184
  @displayModeChanged=${this.displayModeChanged}
138
- @titleLetterChanged=${this.titleLetterChanged}
139
- @creatorLetterChanged=${this.creatorLetterChanged}
185
+ @titleLetterChanged=${this.titleLetterSelected}
186
+ @creatorLetterChanged=${this.creatorLetterSelected}
140
187
  ></sort-filter-bar>
141
188
 
189
+ ${this.displayMode === `list-compact`
190
+ ? this.listHeaderTemplate
191
+ : nothing}
192
+ ${!this.searchResultsLoading && this.totalResults === 0
193
+ ? html `
194
+ <h2>
195
+ Your search did not match any items in the Archive. Try
196
+ different keywords or a more general search.
197
+ </h2>
198
+ `
199
+ : nothing}
200
+
142
201
  <infinite-scroller
143
- class="${this.displayMode}"
202
+ class="${ifDefined(this.displayMode)}"
144
203
  .cellProvider=${this}
145
204
  .placeholderCellTemplate=${this.placeholderCellTemplate}
146
205
  @scrollThresholdReached=${this.scrollThresholdReached}
@@ -151,45 +210,70 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
151
210
  </div>
152
211
  `;
153
212
  }
154
- sortChanged(e) {
213
+ userChangedSort(e) {
155
214
  var _a;
156
- const { sortField, sortDirection } = e.detail;
157
- console.debug('sortChanged', sortField, sortDirection);
158
- if (sortField && sortDirection) {
159
- this.sortParam = new SortParam(sortField, sortDirection);
160
- }
161
- else {
162
- this.sortParam = null;
163
- }
215
+ const { selectedSort, sortDirection } = e.detail;
216
+ this.selectedSort = selectedSort;
217
+ this.sortDirection = sortDirection;
164
218
  if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
165
219
  this.goToPage(1);
166
220
  }
167
221
  this.currentPage = 1;
168
222
  }
223
+ selectedSortChanged() {
224
+ if (this.selectedSort === 'relevance' || this.sortDirection === null) {
225
+ this.sortParam = null;
226
+ return;
227
+ }
228
+ const sortField = SortFieldToMetadataField[this.selectedSort];
229
+ if (!sortField)
230
+ return;
231
+ this.sortParam = { field: sortField, direction: this.sortDirection };
232
+ }
169
233
  displayModeChanged(e) {
170
234
  this.displayMode = e.detail.displayMode;
171
235
  }
172
- titleLetterChanged(e) {
173
- const letter = e.detail.selectedLetter;
174
- if (letter) {
175
- this.titleQuery = `firstTitle:${letter}`;
176
- }
177
- else {
178
- this.titleQuery = undefined;
179
- }
236
+ selectedTitleLetterChanged() {
237
+ this.titleQuery = this.selectedTitleFilter
238
+ ? `firstTitle:${this.selectedTitleFilter}`
239
+ : undefined;
180
240
  }
181
- creatorLetterChanged(e) {
182
- const letter = e.detail.selectedLetter;
183
- if (letter) {
184
- this.creatorQuery = `firstCreator:${letter}`;
185
- }
186
- else {
187
- this.creatorQuery = undefined;
188
- }
241
+ selectedCreatorLetterChanged() {
242
+ this.creatorQuery = this.selectedCreatorFilter
243
+ ? `firstCreator:${this.selectedCreatorFilter}`
244
+ : undefined;
245
+ }
246
+ titleLetterSelected(e) {
247
+ this.selectedCreatorFilter = null;
248
+ this.selectedTitleFilter = e.detail.selectedLetter;
249
+ }
250
+ creatorLetterSelected(e) {
251
+ this.selectedTitleFilter = null;
252
+ this.selectedCreatorFilter = e.detail.selectedLetter;
189
253
  }
190
254
  get facetDataLoading() {
191
255
  return this.facetsLoading || this.fullYearAggregationLoading;
192
256
  }
257
+ get facetsTemplate() {
258
+ return html `
259
+ ${this.facetsLoading ? this.loadingTemplate : nothing}
260
+ <collection-facets
261
+ @facetsChanged=${this.facetsChanged}
262
+ @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
263
+ .aggregations=${this.aggregations}
264
+ .fullYearsHistogramAggregation=${this.fullYearsHistogramAggregation}
265
+ .minSelectedDate=${this.minSelectedDate}
266
+ .maxSelectedDate=${this.maxSelectedDate}
267
+ .selectedFacets=${this.selectedFacets}
268
+ .collectionNameCache=${this.collectionNameCache}
269
+ .languageCodeHandler=${this.languageCodeHandler}
270
+ .showHistogramDatePicker=${this.showHistogramDatePicker}
271
+ ?collapsableFacets=${this.mobileView}
272
+ ?facetsLoading=${this.facetDataLoading}
273
+ ?fullYearAggregationLoading=${this.fullYearAggregationLoading}
274
+ ></collection-facets>
275
+ `;
276
+ }
193
277
  get loadingTemplate() {
194
278
  return html `
195
279
  <div class="loading-cover">
@@ -197,6 +281,19 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
197
281
  </div>
198
282
  `;
199
283
  }
284
+ get listHeaderTemplate() {
285
+ return html `
286
+ <div id="list-header">
287
+ <tile-dispatcher
288
+ .tileDisplayMode=${'list-header'}
289
+ .resizeObserver=${this.resizeObserver}
290
+ .sortParam=${this.sortParam}
291
+ .mobileBreakpoint=${this.mobileBreakpoint}
292
+ >
293
+ </tile-dispatcher>
294
+ </div>
295
+ `;
296
+ }
200
297
  get queryDebuggingTemplate() {
201
298
  var _a, _b;
202
299
  return html `
@@ -216,27 +313,83 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
216
313
  const { minDate, maxDate } = e.detail;
217
314
  this.dateRangeQueryClause = `year:[${minDate} TO ${maxDate}]`;
218
315
  }
316
+ firstUpdated() {
317
+ this.setupStateRestorationObserver();
318
+ this.restoreState();
319
+ }
219
320
  updated(changed) {
220
- if (changed.has('displayMode') ||
221
- changed.has('showDeleteButtons') ||
222
- changed.has('baseNavigationUrl')) {
321
+ if (changed.has('displayMode') || changed.has('baseNavigationUrl')) {
223
322
  this.infiniteScroller.reload();
224
323
  }
324
+ if (changed.has('baseQuery')) {
325
+ this.emitBaseQueryChanged();
326
+ }
327
+ if (changed.has('currentPage') || changed.has('displayMode')) {
328
+ this.persistState();
329
+ }
225
330
  if (changed.has('baseQuery') ||
226
331
  changed.has('titleQuery') ||
227
332
  changed.has('creatorQuery') ||
228
333
  changed.has('dateRangeQueryClause') ||
229
334
  changed.has('sortParam') ||
230
335
  changed.has('selectedFacets') ||
231
- changed.has('hiddenFacets') ||
232
336
  changed.has('searchService')) {
233
337
  this.handleQueryChange();
234
338
  }
339
+ if (changed.has('selectedSort') || changed.has('sortDirection')) {
340
+ this.selectedSortChanged();
341
+ }
342
+ if (changed.has('selectedTitleFilter')) {
343
+ this.selectedTitleLetterChanged();
344
+ }
345
+ if (changed.has('selectedCreatorFilter')) {
346
+ this.selectedCreatorLetterChanged();
347
+ }
235
348
  if (changed.has('pagesToRender')) {
236
349
  if (!this.endOfDataReached) {
237
350
  this.infiniteScroller.itemCount = this.estimatedTileCount;
238
351
  }
239
352
  }
353
+ if (changed.has('resizeObserver')) {
354
+ const oldObserver = changed.get('resizeObserver');
355
+ if (oldObserver)
356
+ this.disconnectResizeObserver(oldObserver);
357
+ this.setupResizeObserver();
358
+ }
359
+ }
360
+ disconnectedCallback() {
361
+ if (this.resizeObserver) {
362
+ this.disconnectResizeObserver(this.resizeObserver);
363
+ }
364
+ if (this.boundNavigationHandler) {
365
+ window.removeEventListener('popstate', this.boundNavigationHandler);
366
+ }
367
+ }
368
+ handleResize(entry) {
369
+ if (entry.target === this.contentContainer) {
370
+ this.mobileView = entry.contentRect.width < 600;
371
+ }
372
+ }
373
+ emitBaseQueryChanged() {
374
+ this.dispatchEvent(new CustomEvent('baseQueryChanged', {
375
+ detail: {
376
+ baseQuery: this.baseQuery,
377
+ },
378
+ }));
379
+ }
380
+ disconnectResizeObserver(resizeObserver) {
381
+ resizeObserver.removeObserver({
382
+ target: this.contentContainer,
383
+ handler: this,
384
+ });
385
+ }
386
+ setupResizeObserver() {
387
+ if (!this.resizeObserver)
388
+ return;
389
+ this.resizeObserver.addObserver({
390
+ target: this.contentContainer,
391
+ handler: this,
392
+ });
240
393
  }
241
394
  /**
242
395
  * When the visible cells change from the infinite scroller, we want to emit
@@ -253,6 +406,9 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
253
406
  return;
254
407
  const lastVisibleCellIndex = visibleCellIndices[visibleCellIndices.length - 1];
255
408
  const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
409
+ if (this.currentPage !== lastVisibleCellPage) {
410
+ this.currentPage = lastVisibleCellPage;
411
+ }
256
412
  const event = new CustomEvent('visiblePageChanged', {
257
413
  detail: {
258
414
  pageNumber: lastVisibleCellPage,
@@ -273,12 +429,70 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
273
429
  this.scrollToPage(this.initialPageNumber);
274
430
  }
275
431
  this.initialQueryChangeHappened = true;
432
+ // if the query changed as part of a window.history pop event, we don't want to
433
+ // persist the state because it overwrites the forward history
434
+ if (!this.historyPopOccurred) {
435
+ this.persistState();
436
+ this.historyPopOccurred = false;
437
+ }
276
438
  await Promise.all([
277
439
  this.doInitialPageFetch(),
278
440
  this.fetchFacets(),
279
441
  this.fetchFullYearHistogram(),
280
442
  ]);
281
443
  }
444
+ setupStateRestorationObserver() {
445
+ if (this.boundNavigationHandler)
446
+ return;
447
+ this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
448
+ // when the user navigates back, we want to update the UI to match the URL
449
+ window.addEventListener('popstate', this.boundNavigationHandler);
450
+ }
451
+ historyNavigationHandler() {
452
+ this.historyPopOccurred = true;
453
+ this.restoreState();
454
+ }
455
+ restoreState() {
456
+ var _a, _b, _c, _d, _e, _f;
457
+ const restorationState = this.restorationStateHandler.getRestorationState();
458
+ this.displayMode = restorationState.displayMode;
459
+ this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.relevance;
460
+ this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
461
+ this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
462
+ this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
463
+ this.selectedFacets = restorationState.selectedFacets;
464
+ this.baseQuery = restorationState.baseQuery;
465
+ this.titleQuery = restorationState.titleQuery;
466
+ this.creatorQuery = restorationState.creatorQuery;
467
+ this.dateRangeQueryClause = restorationState.dateRangeQueryClause;
468
+ this.sortParam = (_e = restorationState.sortParam) !== null && _e !== void 0 ? _e : null;
469
+ this.currentPage = (_f = restorationState.currentPage) !== null && _f !== void 0 ? _f : 1;
470
+ this.minSelectedDate = restorationState.minSelectedDate;
471
+ this.maxSelectedDate = restorationState.maxSelectedDate;
472
+ if (this.currentPage > 1) {
473
+ this.goToPage(this.currentPage);
474
+ }
475
+ }
476
+ persistState() {
477
+ var _a, _b, _c, _d, _e;
478
+ const restorationState = {
479
+ displayMode: this.displayMode,
480
+ sortParam: (_a = this.sortParam) !== null && _a !== void 0 ? _a : undefined,
481
+ selectedSort: this.selectedSort,
482
+ sortDirection: (_b = this.sortDirection) !== null && _b !== void 0 ? _b : undefined,
483
+ selectedFacets: (_c = this.selectedFacets) !== null && _c !== void 0 ? _c : defaultSelectedFacets,
484
+ baseQuery: this.baseQuery,
485
+ currentPage: this.currentPage,
486
+ dateRangeQueryClause: this.dateRangeQueryClause,
487
+ titleQuery: this.titleQuery,
488
+ creatorQuery: this.creatorQuery,
489
+ minSelectedDate: this.minSelectedDate,
490
+ maxSelectedDate: this.maxSelectedDate,
491
+ selectedTitleFilter: (_d = this.selectedTitleFilter) !== null && _d !== void 0 ? _d : undefined,
492
+ selectedCreatorFilter: (_e = this.selectedCreatorFilter) !== null && _e !== void 0 ? _e : undefined,
493
+ };
494
+ this.restorationStateHandler.persistState(restorationState);
495
+ }
282
496
  async doInitialPageFetch() {
283
497
  this.searchResultsLoading = true;
284
498
  await this.fetchPage(this.initialPageNumber);
@@ -305,50 +519,46 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
305
519
  }
306
520
  return fullQuery;
307
521
  }
308
- get facetQuery() {
309
- const facets = this.getFacetQuery(this.selectedFacets, false);
310
- const hiddenFacets = this.getFacetQuery(this.hiddenFacets, true);
311
- if (facets && hiddenFacets)
312
- return [facets, hiddenFacets].join(' AND ');
313
- if (facets)
314
- return facets;
315
- if (hiddenFacets)
316
- return hiddenFacets;
317
- return undefined;
318
- }
319
522
  /**
320
523
  * Generates a query string for the given facets
321
524
  *
322
- * Example: `mediatype:("collection" OR "audio") AND year:("2000" OR "2001")`
323
- *
324
- * For negative facets, we prefix the field with `-`, ie:
325
- * `-mediatype:("collection" OR "audio")`
326
- *
327
- * @param facets
328
- * @param negative
329
- * @returns
525
+ * Example: `mediatype:("collection" OR "audio" OR -"etree") AND year:("2000" OR "2001")`
330
526
  */
331
- getFacetQuery(facets, negative) {
527
+ get facetQuery() {
528
+ if (!this.selectedFacets)
529
+ return undefined;
332
530
  const facetQuery = [];
333
- for (const [facetName, facetValues] of Object.entries(facets)) {
334
- const negation = negative ? '-' : '';
335
- const wrappedValues = facetValues.map(value => `"${value}"`);
336
- const valueQuery = wrappedValues.join(` OR `);
337
- facetQuery.push(`${negation}${facetName}:(${valueQuery})`);
531
+ for (const [facetName, facetValues] of Object.entries(this.selectedFacets)) {
532
+ const facetEntries = Object.entries(facetValues);
533
+ // eslint-disable-next-line no-continue
534
+ if (facetEntries.length === 0)
535
+ continue;
536
+ const facetValuesArray = [];
537
+ for (const [key, facetState] of facetEntries) {
538
+ const plusMinusPrefix = facetState === 'hidden' ? '-' : '';
539
+ if (facetName === 'language') {
540
+ const languages = this.languageCodeHandler.getCodeArrayFromCodeString(key);
541
+ for (const language of languages) {
542
+ facetValuesArray.push(`${plusMinusPrefix}"${language}"`);
543
+ }
544
+ }
545
+ else {
546
+ facetValuesArray.push(`${plusMinusPrefix}"${key}"`);
547
+ }
548
+ }
549
+ const valueQuery = facetValuesArray.join(` OR `);
550
+ facetQuery.push(`${facetName}:(${valueQuery})`);
338
551
  }
339
552
  return facetQuery.length > 0 ? `(${facetQuery.join(' AND ')})` : undefined;
340
553
  }
341
554
  facetsChanged(e) {
342
555
  this.selectedFacets = e.detail;
343
556
  }
344
- hiddenFacetsChanged(e) {
345
- this.hiddenFacets = e.detail;
346
- }
347
557
  async fetchFacets() {
348
558
  var _a, _b;
349
559
  if (!this.fullQuery)
350
560
  return;
351
- const aggregations = new AggregateSearchParams({
561
+ const aggregations = {
352
562
  advancedParams: [
353
563
  {
354
564
  field: 'subjectSorter',
@@ -375,13 +585,13 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
375
585
  size: 50,
376
586
  },
377
587
  ],
378
- });
379
- const params = new SearchParams({
588
+ };
589
+ const params = {
380
590
  query: this.fullQuery,
381
591
  fields: ['identifier'],
382
592
  aggregations,
383
593
  rows: 1,
384
- });
594
+ };
385
595
  this.facetsLoading = true;
386
596
  const results = await ((_a = this.searchService) === null || _a === void 0 ? void 0 : _a.search(params));
387
597
  this.facetsLoading = false;
@@ -394,8 +604,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
394
604
  * If this doesn't change, we don't need to re-fetch the histogram date range
395
605
  */
396
606
  get fullQueryNoDateKey() {
397
- var _a;
398
- return `${this.fullQueryWithoutDate}-${(_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.asString}`;
607
+ var _a, _b;
608
+ return `${this.fullQueryWithoutDate}-${(_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field}-${(_b = this.sortParam) === null || _b === void 0 ? void 0 : _b.direction}`;
399
609
  }
400
610
  /**
401
611
  * This method is similar to fetching the facets above,
@@ -411,15 +621,15 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
411
621
  fullQueryNoDateKey === this.previousFullQueryNoDate)
412
622
  return;
413
623
  this.previousFullQueryNoDate = fullQueryNoDateKey;
414
- const aggregations = new AggregateSearchParams({
624
+ const aggregations = {
415
625
  simpleParams: ['year'],
416
- });
417
- const params = new SearchParams({
626
+ };
627
+ const params = {
418
628
  query: this.fullQueryWithoutDate,
419
629
  fields: ['identifier'],
420
630
  aggregations,
421
631
  rows: 1,
422
- });
632
+ };
423
633
  this.fullYearAggregationLoading = true;
424
634
  const results = await ((_a = this.searchService) === null || _a === void 0 ? void 0 : _a.search(params));
425
635
  this.fullYearAggregationLoading = false;
@@ -450,11 +660,11 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
450
660
  * no longer relevant.
451
661
  */
452
662
  get pageFetchQueryKey() {
453
- var _a;
454
- return `${this.fullQuery}-${(_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.asString}`;
663
+ var _a, _b;
664
+ return `${this.fullQuery}-${(_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field}-${(_b = this.sortParam) === null || _b === void 0 ? void 0 : _b.direction}`;
455
665
  }
456
666
  async fetchPage(pageNumber) {
457
- var _a, _b, _c, _d;
667
+ var _a, _b, _c, _d, _e;
458
668
  if (!this.fullQuery)
459
669
  return;
460
670
  // if we already have data, don't fetch again
@@ -470,32 +680,33 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
470
680
  pageFetches.add(pageNumber);
471
681
  this.pageFetchesInProgress[pageFetchQueryKey] = pageFetches;
472
682
  const sortParams = this.sortParam ? [this.sortParam] : [];
473
- console.debug('sortParam', sortParams);
474
- const params = new SearchParams({
683
+ const params = {
475
684
  query: this.fullQuery,
476
685
  fields: [
686
+ 'addeddate',
687
+ 'avg_rating',
688
+ 'collections_raw',
689
+ 'creator',
690
+ 'date',
691
+ 'description',
692
+ 'downloads',
477
693
  'identifier',
478
- 'title',
694
+ 'issue',
695
+ 'item_count',
479
696
  'mediatype',
480
- 'downloads',
481
- 'avg_rating',
482
697
  'num_favorites',
483
698
  'num_reviews',
484
- 'item_count',
485
- 'description',
486
- 'date',
487
- 'addeddate',
488
699
  'publicdate',
489
700
  'reviewdate',
490
- 'creator',
491
- 'subject',
492
701
  'source',
493
- 'collections_raw',
702
+ 'subject',
703
+ 'title',
704
+ 'volume',
494
705
  ],
495
706
  page: pageNumber,
496
707
  rows: this.pageSize,
497
708
  sort: sortParams,
498
- });
709
+ };
499
710
  const results = await ((_b = this.searchService) === null || _b === void 0 ? void 0 : _b.search(params));
500
711
  const success = results === null || results === void 0 ? void 0 : results.success;
501
712
  if (!success)
@@ -506,11 +717,31 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
506
717
  // right behind it
507
718
  const searchQuery = success.responseHeader.params.qin;
508
719
  const searchSort = success.responseHeader.params.sort;
509
- const queryChangedSinceFetch = searchQuery !== this.fullQuery || searchSort !== ((_c = this.sortParam) === null || _c === void 0 ? void 0 : _c.asString);
720
+ let sortChanged = false;
721
+ if (!searchSort) {
722
+ // if we went from no sort to sort, the sort has changed
723
+ if (this.sortParam) {
724
+ sortChanged = true;
725
+ }
726
+ }
727
+ else {
728
+ // check if the sort has changed
729
+ const split = searchSort.split(' ');
730
+ if (split.length > 1) {
731
+ const field = searchSort.split(' ')[0];
732
+ const direction = searchSort.split(' ')[1];
733
+ if (field !== ((_c = this.sortParam) === null || _c === void 0 ? void 0 : _c.field) ||
734
+ direction !== ((_d = this.sortParam) === null || _d === void 0 ? void 0 : _d.direction)) {
735
+ sortChanged = true;
736
+ }
737
+ }
738
+ }
739
+ const queryChangedSinceFetch = searchQuery !== this.fullQuery || sortChanged;
510
740
  if (queryChangedSinceFetch)
511
741
  return;
512
742
  const { docs } = success.response;
513
743
  if (docs && docs.length > 0) {
744
+ this.preloadCollectionNames(docs);
514
745
  this.updateDataSource(pageNumber, docs);
515
746
  }
516
747
  if (docs.length < this.pageSize) {
@@ -518,9 +749,15 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
518
749
  // this updates the infinite scroller to show the actual size
519
750
  this.infiniteScroller.itemCount = this.actualTileCount;
520
751
  }
521
- (_d = this.pageFetchesInProgress[pageFetchQueryKey]) === null || _d === void 0 ? void 0 : _d.delete(pageNumber);
752
+ (_e = this.pageFetchesInProgress[pageFetchQueryKey]) === null || _e === void 0 ? void 0 : _e.delete(pageNumber);
522
753
  this.searchResultsLoading = false;
523
754
  }
755
+ preloadCollectionNames(docs) {
756
+ var _a;
757
+ const collectionIds = docs.map(doc => { var _a; return (_a = doc.collections_raw) === null || _a === void 0 ? void 0 : _a.values; }).flat();
758
+ const collectionIdsArray = Array.from(new Set(collectionIds));
759
+ (_a = this.collectionNameCache) === null || _a === void 0 ? void 0 : _a.preloadIdentifiers(collectionIdsArray);
760
+ }
524
761
  /**
525
762
  * This is useful for determining whether we need to reload the scroller.
526
763
  *
@@ -549,27 +786,30 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
549
786
  const datasource = { ...this.dataSource };
550
787
  const tiles = [];
551
788
  docs === null || docs === void 0 ? void 0 : docs.forEach(doc => {
552
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
789
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
553
790
  if (!doc.identifier)
554
791
  return;
555
792
  tiles.push({
556
- identifier: doc.identifier,
557
- title: this.etreeTitle((_a = doc.title) === null || _a === void 0 ? void 0 : _a.value, (_b = doc.mediatype) === null || _b === void 0 ? void 0 : _b.value),
558
- mediatype: (_d = (_c = doc.mediatype) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 'data',
559
- viewCount: (_f = (_e = doc.downloads) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : 0,
560
- favCount: (_h = (_g = doc.num_favorites) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : 0,
561
- commentCount: (_k = (_j = doc.num_reviews) === null || _j === void 0 ? void 0 : _j.value) !== null && _k !== void 0 ? _k : 0,
562
- itemCount: (_m = (_l = doc.item_count) === null || _l === void 0 ? void 0 : _l.value) !== null && _m !== void 0 ? _m : 0,
793
+ averageRating: (_a = doc.avg_rating) === null || _a === void 0 ? void 0 : _a.value,
794
+ collections: (_c = (_b = doc.collections_raw) === null || _b === void 0 ? void 0 : _b.values) !== null && _c !== void 0 ? _c : [],
795
+ commentCount: (_e = (_d = doc.num_reviews) === null || _d === void 0 ? void 0 : _d.value) !== null && _e !== void 0 ? _e : 0,
796
+ creator: (_f = doc.creator) === null || _f === void 0 ? void 0 : _f.value,
797
+ creators: (_h = (_g = doc.creator) === null || _g === void 0 ? void 0 : _g.values) !== null && _h !== void 0 ? _h : [],
798
+ dateAdded: (_j = doc.addeddate) === null || _j === void 0 ? void 0 : _j.value,
799
+ dateArchived: (_k = doc.publicdate) === null || _k === void 0 ? void 0 : _k.value,
800
+ datePublished: (_l = doc.date) === null || _l === void 0 ? void 0 : _l.value,
801
+ dateReviewed: (_m = doc.reviewdate) === null || _m === void 0 ? void 0 : _m.value,
563
802
  description: (_o = doc.description) === null || _o === void 0 ? void 0 : _o.value,
564
- dateAdded: (_p = doc.addeddate) === null || _p === void 0 ? void 0 : _p.value,
565
- dateArchived: (_q = doc.publicdate) === null || _q === void 0 ? void 0 : _q.value,
566
- dateReviewed: (_r = doc.reviewdate) === null || _r === void 0 ? void 0 : _r.value,
567
- datePublished: (_s = doc.date) === null || _s === void 0 ? void 0 : _s.value,
568
- creator: (_t = doc.creator) === null || _t === void 0 ? void 0 : _t.value,
569
- averageRating: (_u = doc.avg_rating) === null || _u === void 0 ? void 0 : _u.value,
570
- subject: (_v = doc.subject) === null || _v === void 0 ? void 0 : _v.value,
803
+ favCount: (_q = (_p = doc.num_favorites) === null || _p === void 0 ? void 0 : _p.value) !== null && _q !== void 0 ? _q : 0,
804
+ identifier: doc.identifier,
805
+ issue: (_r = doc.issue) === null || _r === void 0 ? void 0 : _r.value,
806
+ itemCount: (_t = (_s = doc.item_count) === null || _s === void 0 ? void 0 : _s.value) !== null && _t !== void 0 ? _t : 0,
807
+ mediatype: (_v = (_u = doc.mediatype) === null || _u === void 0 ? void 0 : _u.value) !== null && _v !== void 0 ? _v : 'data',
571
808
  source: (_w = doc.source) === null || _w === void 0 ? void 0 : _w.value,
572
- collections: (_y = (_x = doc.collections_raw) === null || _x === void 0 ? void 0 : _x.values) !== null && _y !== void 0 ? _y : [],
809
+ subjects: (_y = (_x = doc.subject) === null || _x === void 0 ? void 0 : _x.values) !== null && _y !== void 0 ? _y : [],
810
+ title: this.etreeTitle((_z = doc.title) === null || _z === void 0 ? void 0 : _z.value, (_0 = doc.mediatype) === null || _0 === void 0 ? void 0 : _0.value, (_1 = doc.collection) === null || _1 === void 0 ? void 0 : _1.values),
811
+ volume: (_2 = doc.volume) === null || _2 === void 0 ? void 0 : _2.value,
812
+ viewCount: (_4 = (_3 = doc.downloads) === null || _3 === void 0 ? void 0 : _3.value) !== null && _4 !== void 0 ? _4 : 0,
573
813
  });
574
814
  });
575
815
  datasource[pageNumber] = tiles;
@@ -587,9 +827,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
587
827
  * Todo: Check collection(s) for etree, need to get as array.
588
828
  * Current search-service only returns first collection as string.
589
829
  */
590
- etreeTitle(title, mediatype) {
591
- if (mediatype === 'etree') {
592
- // || collections.includes('etree')) {
830
+ etreeTitle(title, mediatype, collections) {
831
+ if (mediatype === 'etree' || (collections === null || collections === void 0 ? void 0 : collections.includes('etree'))) {
593
832
  const regex = /^(.*) Live at (.*) on (\d\d\d\d-\d\d-\d\d)$/;
594
833
  const newTitle = title === null || title === void 0 ? void 0 : title.replace(regex, '$3: $2');
595
834
  if (newTitle) {
@@ -604,11 +843,13 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
604
843
  return undefined;
605
844
  return html ` <tile-dispatcher
606
845
  .baseNavigationUrl=${this.baseNavigationUrl}
846
+ .baseImageUrl=${this.baseImageUrl}
607
847
  .model=${model}
608
- .displayMode=${this.displayMode}
848
+ .tileDisplayMode=${this.displayMode}
609
849
  .resizeObserver=${this.resizeObserver}
850
+ .collectionNameCache=${this.collectionNameCache}
610
851
  .sortParam=${this.sortParam}
611
- ?showDeleteButton=${this.showDeleteButtons}
852
+ .mobileBreakpoint=${this.mobileBreakpoint}
612
853
  ></tile-dispatcher>`;
613
854
  }
614
855
  /**
@@ -629,23 +870,73 @@ CollectionBrowser.styles = css `
629
870
  display: flex;
630
871
  }
631
872
 
873
+ .collapser {
874
+ display: inline-block;
875
+ }
876
+
877
+ .collapser svg {
878
+ width: 10px;
879
+ height: 10px;
880
+ transition: transform 0.2s ease-out;
881
+ }
882
+
883
+ .collapser.open svg {
884
+ transform: rotate(90deg);
885
+ }
886
+
887
+ #mobile-filter-collapse h1 {
888
+ cursor: pointer;
889
+ }
890
+
891
+ #content-container.mobile {
892
+ display: block;
893
+ }
894
+
895
+ .column {
896
+ padding-top: 2rem;
897
+ }
898
+
632
899
  #right-column {
633
900
  flex: 1;
634
901
  position: relative;
635
902
  border-left: 1px solid rgb(232, 232, 232);
903
+ padding-left: 1rem;
904
+ }
905
+
906
+ .mobile #right-column {
907
+ border-left: none;
908
+ padding: 0;
636
909
  }
637
910
 
638
911
  #left-column {
639
912
  width: 18rem;
640
913
  padding-right: 12px;
914
+ padding-right: 1rem;
641
915
  }
642
916
 
643
- .column {
644
- padding-top: 2rem;
917
+ .mobile #left-column {
918
+ width: 100%;
919
+ padding: 0;
920
+ }
921
+
922
+ #mobile-header-container {
923
+ display: flex;
924
+ justify-content: space-between;
645
925
  }
646
926
 
647
927
  #facets-container {
648
928
  position: relative;
929
+ max-height: 0;
930
+ transition: max-height 0.2s ease-in-out;
931
+ z-index: 1;
932
+ }
933
+
934
+ .mobile #facets-container {
935
+ overflow: hidden;
936
+ }
937
+
938
+ #facets-container.expanded {
939
+ max-height: 2000px;
649
940
  }
650
941
 
651
942
  #results-total {
@@ -654,6 +945,10 @@ CollectionBrowser.styles = css `
654
945
  margin-bottom: 5rem;
655
946
  }
656
947
 
948
+ .mobile #results-total {
949
+ margin-bottom: 0;
950
+ }
951
+
657
952
  #big-results-count {
658
953
  font-size: 2.4rem;
659
954
  font-weight: 500;
@@ -666,6 +961,10 @@ CollectionBrowser.styles = css `
666
961
  text-transform: uppercase;
667
962
  }
668
963
 
964
+ #list-header {
965
+ max-height: 4.2rem;
966
+ }
967
+
669
968
  .loading-cover {
670
969
  position: absolute;
671
970
  top: 0;
@@ -683,6 +982,11 @@ CollectionBrowser.styles = css `
683
982
  height: 30px;
684
983
  }
685
984
 
985
+ sort-filter-bar {
986
+ display: block;
987
+ margin-bottom: 4rem;
988
+ }
989
+
686
990
  infinite-scroller {
687
991
  display: block;
688
992
  --infiniteScrollerRowGap: var(--collectionBrowserRowGap, 1.7rem);
@@ -694,14 +998,9 @@ CollectionBrowser.styles = css `
694
998
  --collectionBrowserCellMinWidth,
695
999
  100%
696
1000
  );
697
- --infiniteScrollerCellMinHeight: var(
698
- --collectionBrowserCellMinHeight,
699
- 2rem
700
- );
701
- --infiniteScrollerCellMaxHeight: var(
702
- --collectionBrowserCellMaxHeight,
703
- 2rem
704
- );
1001
+ --infiniteScrollerCellMinHeight: 34px; /* override infinite scroller component */
1002
+ --infiniteScrollerCellMaxHeight: 56px;
1003
+ --infiniteScrollerRowGap: 0px;
705
1004
  }
706
1005
 
707
1006
  infinite-scroller.list-detail {
@@ -713,6 +1012,16 @@ CollectionBrowser.styles = css `
713
1012
  --collectionBrowserCellMinHeight,
714
1013
  5rem
715
1014
  );
1015
+ /*
1016
+ 30px in spec, compensating for a -4px margin
1017
+ to align title with top of item image
1018
+ src/tiles/list/tile-list.ts
1019
+ */
1020
+ --infiniteScrollerRowGap: 34px;
1021
+ }
1022
+
1023
+ .mobile infinite-scroller.list-detail {
1024
+ --infiniteScrollerRowGap: 24px;
716
1025
  }
717
1026
 
718
1027
  infinite-scroller.grid {
@@ -734,21 +1043,33 @@ CollectionBrowser.styles = css `
734
1043
  __decorate([
735
1044
  property({ type: String })
736
1045
  ], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
1046
+ __decorate([
1047
+ property({ type: String })
1048
+ ], CollectionBrowser.prototype, "baseImageUrl", void 0);
737
1049
  __decorate([
738
1050
  property({ type: Object })
739
1051
  ], CollectionBrowser.prototype, "searchService", void 0);
740
1052
  __decorate([
741
1053
  property({ type: String })
742
1054
  ], CollectionBrowser.prototype, "baseQuery", void 0);
743
- __decorate([
744
- property({ type: Boolean })
745
- ], CollectionBrowser.prototype, "showDeleteButtons", void 0);
746
1055
  __decorate([
747
1056
  property({ type: String })
748
1057
  ], CollectionBrowser.prototype, "displayMode", void 0);
749
1058
  __decorate([
750
1059
  property({ type: Object })
751
1060
  ], CollectionBrowser.prototype, "sortParam", void 0);
1061
+ __decorate([
1062
+ property({ type: String })
1063
+ ], CollectionBrowser.prototype, "selectedSort", void 0);
1064
+ __decorate([
1065
+ property({ type: String })
1066
+ ], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
1067
+ __decorate([
1068
+ property({ type: String })
1069
+ ], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
1070
+ __decorate([
1071
+ property({ type: String })
1072
+ ], CollectionBrowser.prototype, "sortDirection", void 0);
752
1073
  __decorate([
753
1074
  property({ type: String })
754
1075
  ], CollectionBrowser.prototype, "dateRangeQueryClause", void 0);
@@ -759,23 +1080,44 @@ __decorate([
759
1080
  property({ type: Object })
760
1081
  ], CollectionBrowser.prototype, "resizeObserver", void 0);
761
1082
  __decorate([
762
- query('collection-facets')
763
- ], CollectionBrowser.prototype, "collectionFacets", void 0);
1083
+ property({ type: String })
1084
+ ], CollectionBrowser.prototype, "titleQuery", void 0);
764
1085
  __decorate([
765
- query('sort-filter-bar')
766
- ], CollectionBrowser.prototype, "sortFilterBar", void 0);
1086
+ property({ type: String })
1087
+ ], CollectionBrowser.prototype, "creatorQuery", void 0);
767
1088
  __decorate([
768
- state()
769
- ], CollectionBrowser.prototype, "pagesToRender", void 0);
1089
+ property({ type: Number })
1090
+ ], CollectionBrowser.prototype, "currentPage", void 0);
770
1091
  __decorate([
771
- state()
772
- ], CollectionBrowser.prototype, "searchResultsLoading", void 0);
1092
+ property({ type: String })
1093
+ ], CollectionBrowser.prototype, "minSelectedDate", void 0);
773
1094
  __decorate([
774
- state()
1095
+ property({ type: String })
1096
+ ], CollectionBrowser.prototype, "maxSelectedDate", void 0);
1097
+ __decorate([
1098
+ property({ type: Object })
775
1099
  ], CollectionBrowser.prototype, "selectedFacets", void 0);
1100
+ __decorate([
1101
+ property({ type: Boolean })
1102
+ ], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
1103
+ __decorate([
1104
+ property({ type: Object })
1105
+ ], CollectionBrowser.prototype, "collectionNameCache", void 0);
1106
+ __decorate([
1107
+ property({ type: String })
1108
+ ], CollectionBrowser.prototype, "pageContext", void 0);
1109
+ __decorate([
1110
+ property({ type: Object })
1111
+ ], CollectionBrowser.prototype, "restorationStateHandler", void 0);
1112
+ __decorate([
1113
+ property({ type: Number })
1114
+ ], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
1115
+ __decorate([
1116
+ state()
1117
+ ], CollectionBrowser.prototype, "pagesToRender", void 0);
776
1118
  __decorate([
777
1119
  state()
778
- ], CollectionBrowser.prototype, "hiddenFacets", void 0);
1120
+ ], CollectionBrowser.prototype, "searchResultsLoading", void 0);
779
1121
  __decorate([
780
1122
  state()
781
1123
  ], CollectionBrowser.prototype, "facetsLoading", void 0);
@@ -793,13 +1135,13 @@ __decorate([
793
1135
  ], CollectionBrowser.prototype, "totalResults", void 0);
794
1136
  __decorate([
795
1137
  state()
796
- ], CollectionBrowser.prototype, "titleQuery", void 0);
1138
+ ], CollectionBrowser.prototype, "mobileView", void 0);
797
1139
  __decorate([
798
1140
  state()
799
- ], CollectionBrowser.prototype, "creatorQuery", void 0);
1141
+ ], CollectionBrowser.prototype, "mobileFacetsVisible", void 0);
800
1142
  __decorate([
801
- state()
802
- ], CollectionBrowser.prototype, "currentPage", void 0);
1143
+ query('#content-container')
1144
+ ], CollectionBrowser.prototype, "contentContainer", void 0);
803
1145
  __decorate([
804
1146
  query('infinite-scroller')
805
1147
  ], CollectionBrowser.prototype, "infiniteScroller", void 0);