@internetarchive/collection-browser 0.0.1-alpha.7 → 0.1.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 (238) hide show
  1. package/README.md +8 -11
  2. package/demo/app-root.ts +30 -96
  3. package/dist/demo/app-root.d.ts +3 -5
  4. package/dist/demo/app-root.js +28 -87
  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/eye-closed.d.ts +2 -0
  13. package/dist/src/assets/img/icons/eye-closed.js +5 -0
  14. package/dist/src/assets/img/icons/eye-closed.js.map +1 -0
  15. package/dist/src/assets/img/icons/eye.d.ts +2 -0
  16. package/dist/src/assets/img/icons/eye.js +5 -0
  17. package/dist/src/assets/img/icons/eye.js.map +1 -0
  18. package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -2
  19. package/dist/src/assets/img/icons/mediatype/account.js +6 -4
  20. package/dist/src/assets/img/icons/mediatype/account.js.map +1 -1
  21. package/dist/src/assets/img/icons/mediatype/audio.js +7 -4
  22. package/dist/src/assets/img/icons/mediatype/audio.js.map +1 -1
  23. package/dist/src/assets/img/icons/mediatype/collection.js +7 -4
  24. package/dist/src/assets/img/icons/mediatype/collection.js.map +1 -1
  25. package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -0
  26. package/dist/src/assets/img/icons/mediatype/data.js +15 -0
  27. package/dist/src/assets/img/icons/mediatype/data.js.map +1 -0
  28. package/dist/src/assets/img/icons/mediatype/etree.js +10 -5
  29. package/dist/src/assets/img/icons/mediatype/etree.js.map +1 -1
  30. package/dist/src/assets/img/icons/mediatype/film.js +2 -1
  31. package/dist/src/assets/img/icons/mediatype/film.js.map +1 -1
  32. package/dist/src/assets/img/icons/mediatype/images.js +9 -6
  33. package/dist/src/assets/img/icons/mediatype/images.js.map +1 -1
  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 +57 -20
  48. package/dist/src/collection-browser.js +511 -128
  49. package/dist/src/collection-browser.js.map +1 -1
  50. package/dist/src/collection-facets.d.ts +27 -6
  51. package/dist/src/collection-facets.js +316 -100
  52. package/dist/src/collection-facets.js.map +1 -1
  53. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -0
  54. package/dist/src/language-code-handler/language-code-handler.js +27 -0
  55. package/dist/src/language-code-handler/language-code-handler.js.map +1 -0
  56. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -0
  57. package/dist/src/language-code-handler/language-code-mapping.js +563 -0
  58. package/dist/src/language-code-handler/language-code-mapping.js.map +1 -0
  59. package/dist/src/mediatype/mediatype-config.d.ts +3 -0
  60. package/dist/src/mediatype/mediatype-config.js +86 -0
  61. package/dist/src/mediatype/mediatype-config.js.map +1 -0
  62. package/dist/src/models.d.ts +72 -13
  63. package/dist/src/models.js +57 -1
  64. package/dist/src/models.js.map +1 -1
  65. package/dist/src/restoration-state-handler.d.ts +38 -0
  66. package/dist/src/restoration-state-handler.js +204 -0
  67. package/dist/src/restoration-state-handler.js.map +1 -0
  68. package/dist/src/sort-filter-bar/alpha-bar.d.ts +1 -2
  69. package/dist/src/sort-filter-bar/alpha-bar.js +12 -8
  70. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  71. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -0
  72. package/dist/src/sort-filter-bar/img/compact.js +5 -0
  73. package/dist/src/sort-filter-bar/img/compact.js.map +1 -0
  74. package/dist/src/sort-filter-bar/img/list.d.ts +1 -0
  75. package/dist/src/sort-filter-bar/img/list.js +5 -0
  76. package/dist/src/sort-filter-bar/img/list.js.map +1 -0
  77. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -0
  78. package/dist/src/sort-filter-bar/img/sort-triangle.js +5 -0
  79. package/dist/src/sort-filter-bar/img/sort-triangle.js.map +1 -0
  80. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -0
  81. package/dist/src/sort-filter-bar/img/tile.js +5 -0
  82. package/dist/src/sort-filter-bar/img/tile.js.map +1 -0
  83. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +74 -13
  84. package/dist/src/sort-filter-bar/sort-filter-bar.js +547 -172
  85. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  86. package/dist/src/tiles/{loading-tile.d.ts → collection-browser-loading-tile.d.ts} +1 -1
  87. package/dist/src/tiles/collection-browser-loading-tile.js +32 -0
  88. package/dist/src/tiles/collection-browser-loading-tile.js.map +1 -0
  89. package/dist/src/tiles/grid/account-tile.d.ts +1 -1
  90. package/dist/src/tiles/grid/account-tile.js +5 -5
  91. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  92. package/dist/src/tiles/grid/collection-tile.js +1 -2
  93. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  94. package/dist/src/tiles/grid/icons/views.d.ts +1 -1
  95. package/dist/src/tiles/grid/icons/views.js +2 -2
  96. package/dist/src/tiles/grid/icons/views.js.map +1 -1
  97. package/dist/src/tiles/grid/item-tile.d.ts +2 -2
  98. package/dist/src/tiles/grid/item-tile.js +58 -150
  99. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  100. package/dist/src/tiles/item-image.d.ts +19 -0
  101. package/dist/src/tiles/item-image.js +204 -0
  102. package/dist/src/tiles/item-image.js.map +1 -0
  103. package/dist/src/tiles/list/account-label.d.ts +1 -0
  104. package/dist/src/tiles/list/account-label.js +7 -0
  105. package/dist/src/tiles/list/account-label.js.map +1 -0
  106. package/dist/src/tiles/list/date-label.d.ts +1 -0
  107. package/dist/src/tiles/list/date-label.js +13 -0
  108. package/dist/src/tiles/list/date-label.js.map +1 -0
  109. package/dist/src/tiles/list/tile-list-compact-header.d.ts +12 -0
  110. package/dist/src/tiles/list/tile-list-compact-header.js +84 -0
  111. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -0
  112. package/dist/src/tiles/list/tile-list-compact.d.ts +12 -0
  113. package/dist/src/tiles/list/tile-list-compact.js +203 -6
  114. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  115. package/dist/src/tiles/list/tile-list.d.ts +35 -10
  116. package/dist/src/tiles/list/tile-list.js +368 -104
  117. package/dist/src/tiles/list/tile-list.js.map +1 -1
  118. package/dist/src/{mediatype-icon.d.ts → tiles/mediatype-icon.d.ts} +2 -2
  119. package/dist/src/tiles/mediatype-icon.js +78 -0
  120. package/dist/src/tiles/mediatype-icon.js.map +1 -0
  121. package/dist/src/tiles/tile-dispatcher.d.ts +11 -4
  122. package/dist/src/tiles/tile-dispatcher.js +56 -19
  123. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  124. package/dist/src/utils/format-date.js +2 -2
  125. package/dist/src/utils/format-date.js.map +1 -1
  126. package/dist/test/collection-browser.test.d.ts +1 -0
  127. package/dist/test/collection-browser.test.js +16 -2
  128. package/dist/test/collection-browser.test.js.map +1 -1
  129. package/dist/test/{utils/format-string.test.d.ts → mediatype-config.test.d.ts} +0 -0
  130. package/dist/test/mediatype-config.test.js +17 -0
  131. package/dist/test/mediatype-config.test.js.map +1 -0
  132. package/dist/test/utils/format-date.test.js +1 -1
  133. package/dist/test/utils/format-date.test.js.map +1 -1
  134. package/index.ts +6 -0
  135. package/local.archive.org.cert +86 -0
  136. package/local.archive.org.key +27 -0
  137. package/package.json +9 -5
  138. package/src/assets/img/icons/chevron.ts +4 -0
  139. package/src/assets/img/icons/eye-closed.ts +5 -0
  140. package/src/assets/img/icons/eye.ts +5 -0
  141. package/src/assets/img/icons/mediatype/account.ts +6 -4
  142. package/src/assets/img/icons/mediatype/audio.ts +7 -4
  143. package/src/assets/img/icons/mediatype/collection.ts +7 -4
  144. package/src/assets/img/icons/mediatype/data.ts +15 -0
  145. package/src/assets/img/icons/mediatype/etree.ts +10 -5
  146. package/src/assets/img/icons/mediatype/film.ts +2 -1
  147. package/src/assets/img/icons/mediatype/images.ts +9 -6
  148. package/src/assets/img/icons/mediatype/radio.ts +15 -0
  149. package/src/assets/img/icons/mediatype/software.ts +9 -6
  150. package/src/assets/img/icons/mediatype/texts.ts +9 -6
  151. package/src/assets/img/icons/mediatype/tv.ts +10 -5
  152. package/src/assets/img/icons/mediatype/video.ts +10 -6
  153. package/src/assets/img/icons/mediatype/web.ts +9 -6
  154. package/src/collection-browser.ts +537 -123
  155. package/src/collection-facets.ts +352 -132
  156. package/src/language-code-handler/language-code-handler.ts +64 -0
  157. package/src/language-code-handler/language-code-mapping.ts +564 -0
  158. package/src/mediatype/mediatype-config.ts +86 -0
  159. package/src/models.ts +141 -13
  160. package/src/restoration-state-handler.ts +266 -0
  161. package/src/sort-filter-bar/alpha-bar.ts +12 -8
  162. package/src/sort-filter-bar/img/compact.ts +5 -0
  163. package/src/sort-filter-bar/img/list.ts +5 -0
  164. package/src/sort-filter-bar/img/sort-triangle.ts +5 -0
  165. package/src/sort-filter-bar/img/tile.ts +5 -0
  166. package/src/sort-filter-bar/sort-filter-bar.ts +604 -176
  167. package/src/tiles/collection-browser-loading-tile.ts +29 -0
  168. package/src/tiles/grid/account-tile.ts +1 -1
  169. package/src/tiles/grid/collection-tile.ts +1 -2
  170. package/src/tiles/grid/icons/views.ts +2 -2
  171. package/src/tiles/grid/item-tile.ts +57 -162
  172. package/src/tiles/item-image.ts +206 -0
  173. package/src/tiles/list/account-label.ts +6 -0
  174. package/src/tiles/list/date-label.ts +12 -0
  175. package/src/tiles/list/tile-list-compact-header.ts +77 -0
  176. package/src/tiles/list/tile-list-compact.ts +218 -0
  177. package/src/tiles/list/tile-list.ts +412 -107
  178. package/src/tiles/mediatype-icon.ts +75 -0
  179. package/src/tiles/tile-dispatcher.ts +66 -18
  180. package/src/utils/format-date.ts +2 -2
  181. package/test/collection-browser.test.ts +20 -1
  182. package/test/mediatype-config.test.ts +18 -0
  183. package/test/utils/format-date.test.ts +1 -1
  184. package/web-dev-server.config.mjs +3 -1
  185. package/dist/src/assets/img/icons/audio.d.ts +0 -1
  186. package/dist/src/assets/img/icons/audio.js +0 -9
  187. package/dist/src/assets/img/icons/audio.js.map +0 -1
  188. package/dist/src/assets/img/icons/collection.d.ts +0 -1
  189. package/dist/src/assets/img/icons/collection.js +0 -9
  190. package/dist/src/assets/img/icons/collection.js.map +0 -1
  191. package/dist/src/assets/img/icons/etree.d.ts +0 -1
  192. package/dist/src/assets/img/icons/etree.js +0 -9
  193. package/dist/src/assets/img/icons/etree.js.map +0 -1
  194. package/dist/src/assets/img/icons/images.d.ts +0 -1
  195. package/dist/src/assets/img/icons/images.js +0 -10
  196. package/dist/src/assets/img/icons/images.js.map +0 -1
  197. package/dist/src/assets/img/icons/mediatype/etree copy.d.ts +0 -1
  198. package/dist/src/assets/img/icons/mediatype/etree copy.js +0 -9
  199. package/dist/src/assets/img/icons/mediatype/etree copy.js.map +0 -1
  200. package/dist/src/assets/img/icons/mediatype/livemusic.d.ts +0 -1
  201. package/dist/src/assets/img/icons/mediatype/livemusic.js +0 -7
  202. package/dist/src/assets/img/icons/mediatype/livemusic.js.map +0 -1
  203. package/dist/src/assets/img/icons/mediatype/photos.d.ts +0 -1
  204. package/dist/src/assets/img/icons/mediatype/photos.js +0 -7
  205. package/dist/src/assets/img/icons/mediatype/photos.js.map +0 -1
  206. package/dist/src/assets/img/icons/software.d.ts +0 -1
  207. package/dist/src/assets/img/icons/software.js +0 -10
  208. package/dist/src/assets/img/icons/software.js.map +0 -1
  209. package/dist/src/assets/img/icons/texts.d.ts +0 -1
  210. package/dist/src/assets/img/icons/texts.js +0 -10
  211. package/dist/src/assets/img/icons/texts.js.map +0 -1
  212. package/dist/src/assets/img/icons/tv.d.ts +0 -1
  213. package/dist/src/assets/img/icons/tv.js +0 -9
  214. package/dist/src/assets/img/icons/tv.js.map +0 -1
  215. package/dist/src/assets/img/icons/video.d.ts +0 -1
  216. package/dist/src/assets/img/icons/video.js +0 -10
  217. package/dist/src/assets/img/icons/video.js.map +0 -1
  218. package/dist/src/assets/img/icons/web.d.ts +0 -1
  219. package/dist/src/assets/img/icons/web.js +0 -10
  220. package/dist/src/assets/img/icons/web.js.map +0 -1
  221. package/dist/src/mediatype-icon.js +0 -89
  222. package/dist/src/mediatype-icon.js.map +0 -1
  223. package/dist/src/search-handler.d.ts +0 -11
  224. package/dist/src/search-handler.js +0 -34
  225. package/dist/src/search-handler.js.map +0 -1
  226. package/dist/src/tiles/list/tile-list-detail.d.ts +0 -7
  227. package/dist/src/tiles/list/tile-list-detail.js +0 -28
  228. package/dist/src/tiles/list/tile-list-detail.js.map +0 -1
  229. package/dist/src/tiles/loading-tile.js +0 -73
  230. package/dist/src/tiles/loading-tile.js.map +0 -1
  231. package/dist/src/utils/format-string.d.ts +0 -2
  232. package/dist/src/utils/format-string.js +0 -7
  233. package/dist/src/utils/format-string.js.map +0 -1
  234. package/dist/test/utils/format-string.test.js +0 -17
  235. package/dist/test/utils/format-string.test.js.map +0 -1
  236. package/src/assets/img/icons/mediatype/foo.svg +0 -5
  237. package/src/mediatype-icon.ts +0 -83
  238. package/src/tiles/loading-tile.ts +0 -70
@@ -2,21 +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, } 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';
20
+ this.sortParam = null;
21
+ this.selectedSort = SortField.relevance;
22
+ this.selectedTitleFilter = null;
23
+ this.selectedCreatorFilter = null;
24
+ this.sortDirection = null;
19
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;
20
32
  /**
21
33
  * The page that the consumer wants to load.
22
34
  */
@@ -29,9 +41,11 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
29
41
  */
30
42
  this.pagesToRender = this.initialPageNumber;
31
43
  this.searchResultsLoading = false;
32
- this.selectedFacets = {};
33
44
  this.facetsLoading = false;
34
45
  this.fullYearAggregationLoading = false;
46
+ this.mobileView = false;
47
+ this.mobileFacetsVisible = false;
48
+ this.languageCodeHandler = new LanguageCodeHandler();
35
49
  /**
36
50
  * When we're animated scrolling to the page, we don't want to fetch
37
51
  * all of the pages as it scrolls so this lets us know if we're scrolling
@@ -41,7 +55,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
41
55
  * When we've reached the end of the data, stop trying to fetch more
42
56
  */
43
57
  this.endOfDataReached = false;
44
- this.placeholderCellTemplate = html `<loading-tile></loading-tile>`;
58
+ this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
45
59
  /**
46
60
  * The results per page so we can paginate.
47
61
  *
@@ -53,6 +67,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
53
67
  // we only want to scroll on the very first query change
54
68
  // so this keeps track of whether we've already set the initial query
55
69
  this.initialQueryChangeHappened = false;
70
+ this.historyPopOccurred = false;
56
71
  // this maps the query to the pages being fetched for that query
57
72
  this.pageFetchesInProgress = {};
58
73
  }
@@ -91,51 +106,100 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
91
106
  return Object.keys(this.dataSource).reduce((acc, page) => acc + this.dataSource[page].length, 0);
92
107
  }
93
108
  /**
109
+ * Go to the given page of results
94
110
  *
95
111
  * @param pageNumber
96
- * @param scroll
97
112
  */
98
113
  goToPage(pageNumber) {
99
114
  this.initialPageNumber = pageNumber;
100
115
  this.pagesToRender = pageNumber;
101
116
  this.scrollToPage(pageNumber);
102
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
+ }
103
128
  render() {
104
129
  return html `
105
- <div id="content-container">
106
- <div id="left-column">
107
- <div id="results-total">
108
- <span id="big-results-count"
109
- >${this.totalResults
130
+ <div id="content-container" class=${this.mobileView ? 'mobile' : ''}>
131
+ <div id="left-column" class="column">
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
110
159
  ? this.totalResults.toLocaleString()
111
160
  : '-'}</span
112
- >
113
- <span id="big-results-label">Results</span>
161
+ >
162
+ <span id="big-results-label">Results</span>
163
+ </div>
114
164
  </div>
115
- <div id="facets-container">
116
- ${this.facetsLoading ? this.loadingTemplate : nothing}
117
- <collection-facets
118
- @facetsChanged=${this.facetsChanged}
119
- @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
120
- .aggregations=${this.aggregations}
121
- .fullYearsHistogramAggregation=${this
122
- .fullYearsHistogramAggregation}
123
- ?facetsLoading=${this.facetDataLoading}
124
- ?fullYearAggregationLoading=${this.fullYearAggregationLoading}
125
- ></collection-facets>
165
+ <div
166
+ id="facets-container"
167
+ class=${!this.mobileView || this.mobileFacetsVisible
168
+ ? 'expanded'
169
+ : ''}
170
+ >
171
+ ${this.facetsTemplate}
126
172
  </div>
127
173
  </div>
128
- <div id="right-column">
174
+ <div id="right-column" class="column">
129
175
  ${this.searchResultsLoading ? this.loadingTemplate : nothing}
130
176
  <sort-filter-bar
131
- @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}
132
184
  @displayModeChanged=${this.displayModeChanged}
133
- @titleLetterChanged=${this.titleLetterChanged}
134
- @creatorLetterChanged=${this.creatorLetterChanged}
185
+ @titleLetterChanged=${this.titleLetterSelected}
186
+ @creatorLetterChanged=${this.creatorLetterSelected}
135
187
  ></sort-filter-bar>
136
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
+
137
201
  <infinite-scroller
138
- class="${this.displayMode}"
202
+ class="${ifDefined(this.displayMode)}"
139
203
  .cellProvider=${this}
140
204
  .placeholderCellTemplate=${this.placeholderCellTemplate}
141
205
  @scrollThresholdReached=${this.scrollThresholdReached}
@@ -146,38 +210,70 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
146
210
  </div>
147
211
  `;
148
212
  }
149
- sortChanged(e) {
213
+ userChangedSort(e) {
150
214
  var _a;
151
- this.sortParam = e.detail.sort;
215
+ const { selectedSort, sortDirection } = e.detail;
216
+ this.selectedSort = selectedSort;
217
+ this.sortDirection = sortDirection;
152
218
  if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
153
219
  this.goToPage(1);
154
220
  }
155
221
  this.currentPage = 1;
156
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
+ }
157
233
  displayModeChanged(e) {
158
234
  this.displayMode = e.detail.displayMode;
159
235
  }
160
- titleLetterChanged(e) {
161
- const letter = e.detail.selectedLetter;
162
- if (letter) {
163
- this.titleQuery = `firstTitle:${letter}`;
164
- }
165
- else {
166
- this.titleQuery = undefined;
167
- }
236
+ selectedTitleLetterChanged() {
237
+ this.titleQuery = this.selectedTitleFilter
238
+ ? `firstTitle:${this.selectedTitleFilter}`
239
+ : undefined;
168
240
  }
169
- creatorLetterChanged(e) {
170
- const letter = e.detail.selectedLetter;
171
- if (letter) {
172
- this.creatorQuery = `firstCreator:${letter}`;
173
- }
174
- else {
175
- this.creatorQuery = undefined;
176
- }
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;
177
253
  }
178
254
  get facetDataLoading() {
179
255
  return this.facetsLoading || this.fullYearAggregationLoading;
180
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
+ }
181
277
  get loadingTemplate() {
182
278
  return html `
183
279
  <div class="loading-cover">
@@ -185,6 +281,19 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
185
281
  </div>
186
282
  `;
187
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
+ }
188
297
  get queryDebuggingTemplate() {
189
298
  var _a, _b;
190
299
  return html `
@@ -204,12 +313,20 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
204
313
  const { minDate, maxDate } = e.detail;
205
314
  this.dateRangeQueryClause = `year:[${minDate} TO ${maxDate}]`;
206
315
  }
316
+ firstUpdated() {
317
+ this.setupStateRestorationObserver();
318
+ this.restoreState();
319
+ }
207
320
  updated(changed) {
208
- if (changed.has('displayMode') ||
209
- changed.has('showDeleteButtons') ||
210
- changed.has('baseNavigationUrl')) {
321
+ if (changed.has('displayMode') || changed.has('baseNavigationUrl')) {
211
322
  this.infiniteScroller.reload();
212
323
  }
324
+ if (changed.has('baseQuery')) {
325
+ this.emitBaseQueryChanged();
326
+ }
327
+ if (changed.has('currentPage') || changed.has('displayMode')) {
328
+ this.persistState();
329
+ }
213
330
  if (changed.has('baseQuery') ||
214
331
  changed.has('titleQuery') ||
215
332
  changed.has('creatorQuery') ||
@@ -219,11 +336,60 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
219
336
  changed.has('searchService')) {
220
337
  this.handleQueryChange();
221
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
+ }
222
348
  if (changed.has('pagesToRender')) {
223
349
  if (!this.endOfDataReached) {
224
350
  this.infiniteScroller.itemCount = this.estimatedTileCount;
225
351
  }
226
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
+ });
227
393
  }
228
394
  /**
229
395
  * When the visible cells change from the infinite scroller, we want to emit
@@ -240,6 +406,9 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
240
406
  return;
241
407
  const lastVisibleCellIndex = visibleCellIndices[visibleCellIndices.length - 1];
242
408
  const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
409
+ if (this.currentPage !== lastVisibleCellPage) {
410
+ this.currentPage = lastVisibleCellPage;
411
+ }
243
412
  const event = new CustomEvent('visiblePageChanged', {
244
413
  detail: {
245
414
  pageNumber: lastVisibleCellPage,
@@ -260,12 +429,70 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
260
429
  this.scrollToPage(this.initialPageNumber);
261
430
  }
262
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
+ }
263
438
  await Promise.all([
264
439
  this.doInitialPageFetch(),
265
440
  this.fetchFacets(),
266
441
  this.fetchFullYearHistogram(),
267
442
  ]);
268
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
+ }
269
496
  async doInitialPageFetch() {
270
497
  this.searchResultsLoading = true;
271
498
  await this.fetchPage(this.initialPageNumber);
@@ -292,15 +519,35 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
292
519
  }
293
520
  return fullQuery;
294
521
  }
522
+ /**
523
+ * Generates a query string for the given facets
524
+ *
525
+ * Example: `mediatype:("collection" OR "audio" OR -"etree") AND year:("2000" OR "2001")`
526
+ */
295
527
  get facetQuery() {
528
+ if (!this.selectedFacets)
529
+ return undefined;
296
530
  const facetQuery = [];
297
- for (const [facetName, selectedValues] of Object.entries(this.selectedFacets)) {
298
- const values = [];
299
- for (const value of selectedValues) {
300
- values.push(`${facetName}:"${value}"`);
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
+ }
301
548
  }
302
- const valueQuery = values.join(' OR ');
303
- facetQuery.push(`(${valueQuery})`);
549
+ const valueQuery = facetValuesArray.join(` OR `);
550
+ facetQuery.push(`${facetName}:(${valueQuery})`);
304
551
  }
305
552
  return facetQuery.length > 0 ? `(${facetQuery.join(' AND ')})` : undefined;
306
553
  }
@@ -311,7 +558,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
311
558
  var _a, _b;
312
559
  if (!this.fullQuery)
313
560
  return;
314
- const aggregations = new AggregateSearchParams({
561
+ const aggregations = {
315
562
  advancedParams: [
316
563
  {
317
564
  field: 'subjectSorter',
@@ -338,13 +585,13 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
338
585
  size: 50,
339
586
  },
340
587
  ],
341
- });
342
- const params = new SearchParams({
588
+ };
589
+ const params = {
343
590
  query: this.fullQuery,
344
591
  fields: ['identifier'],
345
592
  aggregations,
346
593
  rows: 1,
347
- });
594
+ };
348
595
  this.facetsLoading = true;
349
596
  const results = await ((_a = this.searchService) === null || _a === void 0 ? void 0 : _a.search(params));
350
597
  this.facetsLoading = false;
@@ -357,8 +604,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
357
604
  * If this doesn't change, we don't need to re-fetch the histogram date range
358
605
  */
359
606
  get fullQueryNoDateKey() {
360
- var _a;
361
- 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}`;
362
609
  }
363
610
  /**
364
611
  * This method is similar to fetching the facets above,
@@ -374,15 +621,15 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
374
621
  fullQueryNoDateKey === this.previousFullQueryNoDate)
375
622
  return;
376
623
  this.previousFullQueryNoDate = fullQueryNoDateKey;
377
- const aggregations = new AggregateSearchParams({
624
+ const aggregations = {
378
625
  simpleParams: ['year'],
379
- });
380
- const params = new SearchParams({
626
+ };
627
+ const params = {
381
628
  query: this.fullQueryWithoutDate,
382
629
  fields: ['identifier'],
383
630
  aggregations,
384
631
  rows: 1,
385
- });
632
+ };
386
633
  this.fullYearAggregationLoading = true;
387
634
  const results = await ((_a = this.searchService) === null || _a === void 0 ? void 0 : _a.search(params));
388
635
  this.fullYearAggregationLoading = false;
@@ -413,11 +660,11 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
413
660
  * no longer relevant.
414
661
  */
415
662
  get pageFetchQueryKey() {
416
- var _a;
417
- 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}`;
418
665
  }
419
666
  async fetchPage(pageNumber) {
420
- var _a, _b, _c, _d;
667
+ var _a, _b, _c, _d, _e;
421
668
  if (!this.fullQuery)
422
669
  return;
423
670
  // if we already have data, don't fetch again
@@ -433,31 +680,33 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
433
680
  pageFetches.add(pageNumber);
434
681
  this.pageFetchesInProgress[pageFetchQueryKey] = pageFetches;
435
682
  const sortParams = this.sortParam ? [this.sortParam] : [];
436
- const params = new SearchParams({
683
+ const params = {
437
684
  query: this.fullQuery,
438
685
  fields: [
686
+ 'addeddate',
687
+ 'avg_rating',
688
+ 'collections_raw',
689
+ 'creator',
690
+ 'date',
691
+ 'description',
692
+ 'downloads',
439
693
  'identifier',
440
- 'title',
694
+ 'issue',
695
+ 'item_count',
441
696
  'mediatype',
442
- 'downloads',
443
- 'avg_rating',
444
697
  'num_favorites',
445
698
  'num_reviews',
446
- 'item_count',
447
- 'description',
448
- 'date',
449
- 'addeddate',
450
699
  'publicdate',
451
700
  'reviewdate',
452
- 'creator',
453
- 'subject',
454
701
  'source',
455
- 'collections_raw',
702
+ 'subject',
703
+ 'title',
704
+ 'volume',
456
705
  ],
457
706
  page: pageNumber,
458
707
  rows: this.pageSize,
459
708
  sort: sortParams,
460
- });
709
+ };
461
710
  const results = await ((_b = this.searchService) === null || _b === void 0 ? void 0 : _b.search(params));
462
711
  const success = results === null || results === void 0 ? void 0 : results.success;
463
712
  if (!success)
@@ -468,11 +717,31 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
468
717
  // right behind it
469
718
  const searchQuery = success.responseHeader.params.qin;
470
719
  const searchSort = success.responseHeader.params.sort;
471
- 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;
472
740
  if (queryChangedSinceFetch)
473
741
  return;
474
742
  const { docs } = success.response;
475
743
  if (docs && docs.length > 0) {
744
+ this.preloadCollectionNames(docs);
476
745
  this.updateDataSource(pageNumber, docs);
477
746
  }
478
747
  if (docs.length < this.pageSize) {
@@ -480,9 +749,15 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
480
749
  // this updates the infinite scroller to show the actual size
481
750
  this.infiniteScroller.itemCount = this.actualTileCount;
482
751
  }
483
- (_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);
484
753
  this.searchResultsLoading = false;
485
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
+ }
486
761
  /**
487
762
  * This is useful for determining whether we need to reload the scroller.
488
763
  *
@@ -511,27 +786,30 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
511
786
  const datasource = { ...this.dataSource };
512
787
  const tiles = [];
513
788
  docs === null || docs === void 0 ? void 0 : docs.forEach(doc => {
514
- 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;
515
790
  if (!doc.identifier)
516
791
  return;
517
792
  tiles.push({
518
- identifier: doc.identifier,
519
- 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),
520
- mediatype: (_d = (_c = doc.mediatype) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 'data',
521
- viewCount: (_f = (_e = doc.downloads) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : 0,
522
- favCount: (_h = (_g = doc.num_favorites) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : 0,
523
- commentCount: (_k = (_j = doc.num_reviews) === null || _j === void 0 ? void 0 : _j.value) !== null && _k !== void 0 ? _k : 0,
524
- 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,
525
802
  description: (_o = doc.description) === null || _o === void 0 ? void 0 : _o.value,
526
- dateAdded: (_p = doc.addeddate) === null || _p === void 0 ? void 0 : _p.value,
527
- dateArchived: (_q = doc.publicdate) === null || _q === void 0 ? void 0 : _q.value,
528
- dateReviewed: (_r = doc.reviewdate) === null || _r === void 0 ? void 0 : _r.value,
529
- datePublished: (_s = doc.date) === null || _s === void 0 ? void 0 : _s.value,
530
- creator: (_t = doc.creator) === null || _t === void 0 ? void 0 : _t.value,
531
- averageRating: (_u = doc.avg_rating) === null || _u === void 0 ? void 0 : _u.value,
532
- 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',
533
808
  source: (_w = doc.source) === null || _w === void 0 ? void 0 : _w.value,
534
- 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,
535
813
  });
536
814
  });
537
815
  datasource[pageNumber] = tiles;
@@ -549,9 +827,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
549
827
  * Todo: Check collection(s) for etree, need to get as array.
550
828
  * Current search-service only returns first collection as string.
551
829
  */
552
- etreeTitle(title, mediatype) {
553
- if (mediatype === 'etree') {
554
- // || collections.includes('etree')) {
830
+ etreeTitle(title, mediatype, collections) {
831
+ if (mediatype === 'etree' || (collections === null || collections === void 0 ? void 0 : collections.includes('etree'))) {
555
832
  const regex = /^(.*) Live at (.*) on (\d\d\d\d-\d\d-\d\d)$/;
556
833
  const newTitle = title === null || title === void 0 ? void 0 : title.replace(regex, '$3: $2');
557
834
  if (newTitle) {
@@ -567,10 +844,11 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
567
844
  return html ` <tile-dispatcher
568
845
  .baseNavigationUrl=${this.baseNavigationUrl}
569
846
  .model=${model}
570
- .displayMode=${this.displayMode}
847
+ .tileDisplayMode=${this.displayMode}
571
848
  .resizeObserver=${this.resizeObserver}
849
+ .collectionNameCache=${this.collectionNameCache}
572
850
  .sortParam=${this.sortParam}
573
- ?showDeleteButton=${this.showDeleteButtons}
851
+ .mobileBreakpoint=${this.mobileBreakpoint}
574
852
  ></tile-dispatcher>`;
575
853
  }
576
854
  /**
@@ -591,19 +869,73 @@ CollectionBrowser.styles = css `
591
869
  display: flex;
592
870
  }
593
871
 
872
+ .collapser {
873
+ display: inline-block;
874
+ }
875
+
876
+ .collapser svg {
877
+ width: 10px;
878
+ height: 10px;
879
+ transition: transform 0.2s ease-out;
880
+ }
881
+
882
+ .collapser.open svg {
883
+ transform: rotate(90deg);
884
+ }
885
+
886
+ #mobile-filter-collapse h1 {
887
+ cursor: pointer;
888
+ }
889
+
890
+ #content-container.mobile {
891
+ display: block;
892
+ }
893
+
894
+ .column {
895
+ padding-top: 2rem;
896
+ }
897
+
594
898
  #right-column {
595
899
  flex: 1;
596
900
  position: relative;
597
901
  border-left: 1px solid rgb(232, 232, 232);
902
+ padding-left: 1rem;
903
+ }
904
+
905
+ .mobile #right-column {
906
+ border-left: none;
907
+ padding: 0;
598
908
  }
599
909
 
600
910
  #left-column {
601
911
  width: 18rem;
602
912
  padding-right: 12px;
913
+ padding-right: 1rem;
914
+ }
915
+
916
+ .mobile #left-column {
917
+ width: 100%;
918
+ padding: 0;
919
+ }
920
+
921
+ #mobile-header-container {
922
+ display: flex;
923
+ justify-content: space-between;
603
924
  }
604
925
 
605
926
  #facets-container {
606
927
  position: relative;
928
+ max-height: 0;
929
+ transition: max-height 0.2s ease-in-out;
930
+ z-index: 1;
931
+ }
932
+
933
+ .mobile #facets-container {
934
+ overflow: hidden;
935
+ }
936
+
937
+ #facets-container.expanded {
938
+ max-height: 2000px;
607
939
  }
608
940
 
609
941
  #results-total {
@@ -612,6 +944,10 @@ CollectionBrowser.styles = css `
612
944
  margin-bottom: 5rem;
613
945
  }
614
946
 
947
+ .mobile #results-total {
948
+ margin-bottom: 0;
949
+ }
950
+
615
951
  #big-results-count {
616
952
  font-size: 2.4rem;
617
953
  font-weight: 500;
@@ -624,6 +960,10 @@ CollectionBrowser.styles = css `
624
960
  text-transform: uppercase;
625
961
  }
626
962
 
963
+ #list-header {
964
+ max-height: 4.2rem;
965
+ }
966
+
627
967
  .loading-cover {
628
968
  position: absolute;
629
969
  top: 0;
@@ -641,6 +981,11 @@ CollectionBrowser.styles = css `
641
981
  height: 30px;
642
982
  }
643
983
 
984
+ sort-filter-bar {
985
+ display: block;
986
+ margin-bottom: 4rem;
987
+ }
988
+
644
989
  infinite-scroller {
645
990
  display: block;
646
991
  --infiniteScrollerRowGap: var(--collectionBrowserRowGap, 1.7rem);
@@ -652,14 +997,9 @@ CollectionBrowser.styles = css `
652
997
  --collectionBrowserCellMinWidth,
653
998
  100%
654
999
  );
655
- --infiniteScrollerCellMinHeight: var(
656
- --collectionBrowserCellMinHeight,
657
- 2rem
658
- );
659
- --infiniteScrollerCellMaxHeight: var(
660
- --collectionBrowserCellMaxHeight,
661
- 2rem
662
- );
1000
+ --infiniteScrollerCellMinHeight: 34px; /* override infinite scroller component */
1001
+ --infiniteScrollerCellMaxHeight: 56px;
1002
+ --infiniteScrollerRowGap: 0px;
663
1003
  }
664
1004
 
665
1005
  infinite-scroller.list-detail {
@@ -671,6 +1011,16 @@ CollectionBrowser.styles = css `
671
1011
  --collectionBrowserCellMinHeight,
672
1012
  5rem
673
1013
  );
1014
+ /*
1015
+ 30px in spec, compensating for a -4px margin
1016
+ to align title with top of item image
1017
+ src/tiles/list/tile-list.ts
1018
+ */
1019
+ --infiniteScrollerRowGap: 34px;
1020
+ }
1021
+
1022
+ .mobile infinite-scroller.list-detail {
1023
+ --infiniteScrollerRowGap: 24px;
674
1024
  }
675
1025
 
676
1026
  infinite-scroller.grid {
@@ -698,15 +1048,24 @@ __decorate([
698
1048
  __decorate([
699
1049
  property({ type: String })
700
1050
  ], CollectionBrowser.prototype, "baseQuery", void 0);
701
- __decorate([
702
- property({ type: Boolean })
703
- ], CollectionBrowser.prototype, "showDeleteButtons", void 0);
704
1051
  __decorate([
705
1052
  property({ type: String })
706
1053
  ], CollectionBrowser.prototype, "displayMode", void 0);
707
1054
  __decorate([
708
1055
  property({ type: Object })
709
1056
  ], CollectionBrowser.prototype, "sortParam", void 0);
1057
+ __decorate([
1058
+ property({ type: String })
1059
+ ], CollectionBrowser.prototype, "selectedSort", void 0);
1060
+ __decorate([
1061
+ property({ type: String })
1062
+ ], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
1063
+ __decorate([
1064
+ property({ type: String })
1065
+ ], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
1066
+ __decorate([
1067
+ property({ type: String })
1068
+ ], CollectionBrowser.prototype, "sortDirection", void 0);
710
1069
  __decorate([
711
1070
  property({ type: String })
712
1071
  ], CollectionBrowser.prototype, "dateRangeQueryClause", void 0);
@@ -717,20 +1076,44 @@ __decorate([
717
1076
  property({ type: Object })
718
1077
  ], CollectionBrowser.prototype, "resizeObserver", void 0);
719
1078
  __decorate([
720
- query('collection-facets')
721
- ], CollectionBrowser.prototype, "collectionFacets", void 0);
1079
+ property({ type: String })
1080
+ ], CollectionBrowser.prototype, "titleQuery", void 0);
1081
+ __decorate([
1082
+ property({ type: String })
1083
+ ], CollectionBrowser.prototype, "creatorQuery", void 0);
1084
+ __decorate([
1085
+ property({ type: Number })
1086
+ ], CollectionBrowser.prototype, "currentPage", void 0);
1087
+ __decorate([
1088
+ property({ type: String })
1089
+ ], CollectionBrowser.prototype, "minSelectedDate", void 0);
1090
+ __decorate([
1091
+ property({ type: String })
1092
+ ], CollectionBrowser.prototype, "maxSelectedDate", void 0);
1093
+ __decorate([
1094
+ property({ type: Object })
1095
+ ], CollectionBrowser.prototype, "selectedFacets", void 0);
1096
+ __decorate([
1097
+ property({ type: Boolean })
1098
+ ], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
1099
+ __decorate([
1100
+ property({ type: Object })
1101
+ ], CollectionBrowser.prototype, "collectionNameCache", void 0);
1102
+ __decorate([
1103
+ property({ type: String })
1104
+ ], CollectionBrowser.prototype, "pageContext", void 0);
1105
+ __decorate([
1106
+ property({ type: Object })
1107
+ ], CollectionBrowser.prototype, "restorationStateHandler", void 0);
722
1108
  __decorate([
723
- query('sort-filter-bar')
724
- ], CollectionBrowser.prototype, "sortFilterBar", void 0);
1109
+ property({ type: Number })
1110
+ ], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
725
1111
  __decorate([
726
1112
  state()
727
1113
  ], CollectionBrowser.prototype, "pagesToRender", void 0);
728
1114
  __decorate([
729
1115
  state()
730
1116
  ], CollectionBrowser.prototype, "searchResultsLoading", void 0);
731
- __decorate([
732
- state()
733
- ], CollectionBrowser.prototype, "selectedFacets", void 0);
734
1117
  __decorate([
735
1118
  state()
736
1119
  ], CollectionBrowser.prototype, "facetsLoading", void 0);
@@ -748,13 +1131,13 @@ __decorate([
748
1131
  ], CollectionBrowser.prototype, "totalResults", void 0);
749
1132
  __decorate([
750
1133
  state()
751
- ], CollectionBrowser.prototype, "titleQuery", void 0);
1134
+ ], CollectionBrowser.prototype, "mobileView", void 0);
752
1135
  __decorate([
753
1136
  state()
754
- ], CollectionBrowser.prototype, "creatorQuery", void 0);
1137
+ ], CollectionBrowser.prototype, "mobileFacetsVisible", void 0);
755
1138
  __decorate([
756
- state()
757
- ], CollectionBrowser.prototype, "currentPage", void 0);
1139
+ query('#content-container')
1140
+ ], CollectionBrowser.prototype, "contentContainer", void 0);
758
1141
  __decorate([
759
1142
  query('infinite-scroller')
760
1143
  ], CollectionBrowser.prototype, "infiniteScroller", void 0);