@internetarchive/collection-browser 2.1.4-alpha.3 → 2.1.4-alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/.editorconfig +29 -29
  2. package/.husky/pre-commit +4 -4
  3. package/LICENSE +661 -661
  4. package/README.md +83 -83
  5. package/dist/index.d.ts +12 -12
  6. package/dist/index.js +12 -12
  7. package/dist/src/app-root.d.ts +84 -88
  8. package/dist/src/app-root.js +454 -487
  9. package/dist/src/app-root.js.map +1 -1
  10. package/dist/src/assets/img/icons/arrow-left.d.ts +2 -2
  11. package/dist/src/assets/img/icons/arrow-left.js +2 -2
  12. package/dist/src/assets/img/icons/arrow-right.d.ts +2 -2
  13. package/dist/src/assets/img/icons/arrow-right.js +2 -2
  14. package/dist/src/assets/img/icons/chevron.d.ts +2 -2
  15. package/dist/src/assets/img/icons/chevron.js +2 -2
  16. package/dist/src/assets/img/icons/contract.d.ts +2 -2
  17. package/dist/src/assets/img/icons/contract.js +2 -2
  18. package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
  19. package/dist/src/assets/img/icons/empty-query.js +2 -2
  20. package/dist/src/assets/img/icons/expand.d.ts +2 -2
  21. package/dist/src/assets/img/icons/expand.js +2 -2
  22. package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
  23. package/dist/src/assets/img/icons/eye-closed.js +2 -2
  24. package/dist/src/assets/img/icons/eye.d.ts +2 -2
  25. package/dist/src/assets/img/icons/eye.js +2 -2
  26. package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
  27. package/dist/src/assets/img/icons/favorite-filled.js +2 -2
  28. package/dist/src/assets/img/icons/favorite-unfilled.d.ts +1 -1
  29. package/dist/src/assets/img/icons/favorite-unfilled.js +2 -2
  30. package/dist/src/assets/img/icons/login-required.d.ts +1 -1
  31. package/dist/src/assets/img/icons/login-required.js +2 -2
  32. package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
  33. package/dist/src/assets/img/icons/mediatype/account.js +2 -2
  34. package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
  35. package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
  36. package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
  37. package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
  38. package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
  39. package/dist/src/assets/img/icons/mediatype/data.js +2 -2
  40. package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
  41. package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
  42. package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
  43. package/dist/src/assets/img/icons/mediatype/film.js +2 -2
  44. package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
  45. package/dist/src/assets/img/icons/mediatype/images.js +2 -2
  46. package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
  47. package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
  48. package/dist/src/assets/img/icons/mediatype/search.d.ts +1 -1
  49. package/dist/src/assets/img/icons/mediatype/search.js +2 -2
  50. package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
  51. package/dist/src/assets/img/icons/mediatype/software.js +2 -2
  52. package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
  53. package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
  54. package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
  55. package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
  56. package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
  57. package/dist/src/assets/img/icons/mediatype/video.js +2 -2
  58. package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
  59. package/dist/src/assets/img/icons/mediatype/web.js +2 -2
  60. package/dist/src/assets/img/icons/null-result.d.ts +2 -2
  61. package/dist/src/assets/img/icons/null-result.js +2 -2
  62. package/dist/src/assets/img/icons/restricted.d.ts +1 -1
  63. package/dist/src/assets/img/icons/restricted.js +2 -2
  64. package/dist/src/assets/img/icons/reviews.d.ts +1 -1
  65. package/dist/src/assets/img/icons/reviews.js +2 -2
  66. package/dist/src/assets/img/icons/upload.d.ts +1 -1
  67. package/dist/src/assets/img/icons/upload.js +2 -2
  68. package/dist/src/assets/img/icons/views.d.ts +1 -1
  69. package/dist/src/assets/img/icons/views.js +2 -2
  70. package/dist/src/circular-activity-indicator.d.ts +5 -5
  71. package/dist/src/circular-activity-indicator.js +17 -17
  72. package/dist/src/collection-browser.d.ts +395 -395
  73. package/dist/src/collection-browser.js +1363 -1366
  74. package/dist/src/collection-browser.js.map +1 -1
  75. package/dist/src/collection-facets/facet-row.d.ts +30 -30
  76. package/dist/src/collection-facets/facet-row.js +114 -114
  77. package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
  78. package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
  79. package/dist/src/collection-facets/facets-template.d.ts +17 -17
  80. package/dist/src/collection-facets/facets-template.js +114 -114
  81. package/dist/src/collection-facets/more-facets-content.d.ts +70 -70
  82. package/dist/src/collection-facets/more-facets-content.js +354 -354
  83. package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
  84. package/dist/src/collection-facets/more-facets-pagination.js +196 -196
  85. package/dist/src/collection-facets/toggle-switch.d.ts +41 -41
  86. package/dist/src/collection-facets/toggle-switch.js +94 -94
  87. package/dist/src/collection-facets.d.ts +103 -103
  88. package/dist/src/collection-facets.js +509 -509
  89. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +232 -232
  90. package/dist/src/data-source/collection-browser-data-source-interface.js +1 -1
  91. package/dist/src/data-source/collection-browser-data-source.d.ts +360 -360
  92. package/dist/src/data-source/collection-browser-data-source.js +930 -930
  93. package/dist/src/data-source/collection-browser-query-state.d.ts +43 -43
  94. package/dist/src/data-source/collection-browser-query-state.js +1 -1
  95. package/dist/src/data-source/models.d.ts +28 -28
  96. package/dist/src/data-source/models.js +8 -8
  97. package/dist/src/empty-placeholder.d.ts +23 -23
  98. package/dist/src/empty-placeholder.js +74 -74
  99. package/dist/src/expanded-date-picker.d.ts +43 -43
  100. package/dist/src/expanded-date-picker.js +109 -109
  101. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
  102. package/dist/src/language-code-handler/language-code-handler.js +26 -26
  103. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
  104. package/dist/src/language-code-handler/language-code-mapping.js +562 -562
  105. package/dist/src/manage/manage-bar.d.ts +30 -26
  106. package/dist/src/manage/manage-bar.js +76 -85
  107. package/dist/src/manage/manage-bar.js.map +1 -1
  108. package/dist/src/mediatype/mediatype-config.d.ts +3 -3
  109. package/dist/src/mediatype/mediatype-config.js +91 -91
  110. package/dist/src/models.d.ts +198 -198
  111. package/dist/src/models.js +381 -381
  112. package/dist/src/restoration-state-handler.d.ts +70 -70
  113. package/dist/src/restoration-state-handler.js +357 -357
  114. package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -6
  115. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +24 -24
  116. package/dist/src/sort-filter-bar/alpha-bar.d.ts +21 -21
  117. package/dist/src/sort-filter-bar/alpha-bar.js +128 -128
  118. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
  119. package/dist/src/sort-filter-bar/img/compact.js +2 -2
  120. package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
  121. package/dist/src/sort-filter-bar/img/list.js +2 -2
  122. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -1
  123. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +2 -2
  124. package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -1
  125. package/dist/src/sort-filter-bar/img/sort-toggle-down.js +2 -2
  126. package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -1
  127. package/dist/src/sort-filter-bar/img/sort-toggle-up.js +2 -2
  128. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
  129. package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
  130. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
  131. package/dist/src/sort-filter-bar/img/tile.js +2 -2
  132. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +219 -221
  133. package/dist/src/sort-filter-bar/sort-filter-bar.js +685 -695
  134. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  135. package/dist/src/styles/ia-button.d.ts +2 -0
  136. package/dist/src/styles/ia-button.js +102 -0
  137. package/dist/src/styles/ia-button.js.map +1 -0
  138. package/dist/src/styles/item-image-styles.d.ts +8 -8
  139. package/dist/src/styles/item-image-styles.js +9 -9
  140. package/dist/src/styles/sr-only.d.ts +1 -1
  141. package/dist/src/styles/sr-only.js +2 -2
  142. package/dist/src/tiles/base-tile-component.d.ts +19 -19
  143. package/dist/src/tiles/base-tile-component.js +63 -63
  144. package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
  145. package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
  146. package/dist/src/tiles/grid/account-tile.d.ts +18 -18
  147. package/dist/src/tiles/grid/account-tile.js +72 -72
  148. package/dist/src/tiles/grid/collection-tile.d.ts +15 -15
  149. package/dist/src/tiles/grid/collection-tile.js +80 -80
  150. package/dist/src/tiles/grid/item-tile.d.ts +30 -30
  151. package/dist/src/tiles/grid/item-tile.js +149 -149
  152. package/dist/src/tiles/grid/search-tile.d.ts +10 -10
  153. package/dist/src/tiles/grid/search-tile.js +51 -51
  154. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
  155. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +8 -8
  156. package/dist/src/tiles/grid/tile-stats.d.ts +11 -11
  157. package/dist/src/tiles/grid/tile-stats.js +53 -53
  158. package/dist/src/tiles/hover/hover-pane-controller.d.ts +219 -219
  159. package/dist/src/tiles/hover/hover-pane-controller.js +352 -352
  160. package/dist/src/tiles/hover/tile-hover-pane.d.ts +15 -15
  161. package/dist/src/tiles/hover/tile-hover-pane.js +38 -38
  162. package/dist/src/tiles/image-block.d.ts +17 -17
  163. package/dist/src/tiles/image-block.js +73 -73
  164. package/dist/src/tiles/item-image.d.ts +39 -39
  165. package/dist/src/tiles/item-image.js +154 -154
  166. package/dist/src/tiles/list/tile-list-compact-header.d.ts +6 -6
  167. package/dist/src/tiles/list/tile-list-compact-header.js +38 -38
  168. package/dist/src/tiles/list/tile-list-compact.d.ts +15 -15
  169. package/dist/src/tiles/list/tile-list-compact.js +114 -114
  170. package/dist/src/tiles/list/tile-list.d.ts +50 -50
  171. package/dist/src/tiles/list/tile-list.js +315 -315
  172. package/dist/src/tiles/mediatype-icon.d.ts +9 -9
  173. package/dist/src/tiles/mediatype-icon.js +47 -47
  174. package/dist/src/tiles/overlay/icon-overlay.d.ts +10 -10
  175. package/dist/src/tiles/overlay/icon-overlay.js +40 -40
  176. package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
  177. package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
  178. package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
  179. package/dist/src/tiles/overlay/text-overlay.js +42 -42
  180. package/dist/src/tiles/review-block.d.ts +12 -12
  181. package/dist/src/tiles/review-block.js +56 -56
  182. package/dist/src/tiles/text-snippet-block.d.ts +27 -27
  183. package/dist/src/tiles/text-snippet-block.js +73 -73
  184. package/dist/src/tiles/tile-dispatcher.d.ts +64 -64
  185. package/dist/src/tiles/tile-dispatcher.js +230 -233
  186. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  187. package/dist/src/tiles/tile-display-value-provider.d.ts +47 -47
  188. package/dist/src/tiles/tile-display-value-provider.js +94 -94
  189. package/dist/src/utils/analytics-events.d.ts +25 -25
  190. package/dist/src/utils/analytics-events.js +27 -27
  191. package/dist/src/utils/array-equals.d.ts +4 -4
  192. package/dist/src/utils/array-equals.js +10 -10
  193. package/dist/src/utils/collapse-repeated-quotes.d.ts +11 -11
  194. package/dist/src/utils/collapse-repeated-quotes.js +13 -13
  195. package/dist/src/utils/format-count.d.ts +7 -7
  196. package/dist/src/utils/format-count.js +76 -76
  197. package/dist/src/utils/format-date.d.ts +2 -2
  198. package/dist/src/utils/format-date.js +25 -25
  199. package/dist/src/utils/format-unit-size.d.ts +2 -2
  200. package/dist/src/utils/format-unit-size.js +33 -33
  201. package/dist/src/utils/local-date-from-utc.d.ts +9 -9
  202. package/dist/src/utils/local-date-from-utc.js +15 -15
  203. package/dist/src/utils/log.d.ts +7 -7
  204. package/dist/src/utils/log.js +15 -15
  205. package/dist/src/utils/resolve-mediatype.d.ts +8 -8
  206. package/dist/src/utils/resolve-mediatype.js +23 -23
  207. package/dist/src/utils/sha1.d.ts +2 -2
  208. package/dist/src/utils/sha1.js +8 -8
  209. package/dist/test/collection-browser.test.d.ts +1 -1
  210. package/dist/test/collection-browser.test.js +1243 -1215
  211. package/dist/test/collection-browser.test.js.map +1 -1
  212. package/dist/test/collection-facets/facet-row.test.d.ts +1 -1
  213. package/dist/test/collection-facets/facet-row.test.js +203 -203
  214. package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
  215. package/dist/test/collection-facets/facets-template.test.js +105 -105
  216. package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
  217. package/dist/test/collection-facets/more-facets-content.test.js +133 -133
  218. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
  219. package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
  220. package/dist/test/collection-facets/toggle-switch.test.d.ts +1 -1
  221. package/dist/test/collection-facets/toggle-switch.test.js +73 -73
  222. package/dist/test/collection-facets.test.d.ts +2 -2
  223. package/dist/test/collection-facets.test.js +652 -652
  224. package/dist/test/data-source/collection-browser-data-source.test.d.ts +1 -1
  225. package/dist/test/data-source/collection-browser-data-source.test.js +89 -89
  226. package/dist/test/empty-placeholder.test.d.ts +1 -1
  227. package/dist/test/empty-placeholder.test.js +63 -63
  228. package/dist/test/expanded-date-picker.test.d.ts +1 -1
  229. package/dist/test/expanded-date-picker.test.js +95 -95
  230. package/dist/test/icon-overlay.test.d.ts +1 -1
  231. package/dist/test/icon-overlay.test.js +24 -24
  232. package/dist/test/image-block.test.d.ts +1 -1
  233. package/dist/test/image-block.test.js +48 -48
  234. package/dist/test/item-image.test.d.ts +1 -1
  235. package/dist/test/item-image.test.js +85 -85
  236. package/dist/test/manage/manage-bar.test.d.ts +1 -1
  237. package/dist/test/manage/manage-bar.test.js +77 -72
  238. package/dist/test/manage/manage-bar.test.js.map +1 -1
  239. package/dist/test/mediatype-config.test.d.ts +1 -1
  240. package/dist/test/mediatype-config.test.js +16 -16
  241. package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
  242. package/dist/test/mocks/mock-analytics-handler.js +15 -15
  243. package/dist/test/mocks/mock-search-responses.d.ts +24 -24
  244. package/dist/test/mocks/mock-search-responses.js +840 -840
  245. package/dist/test/mocks/mock-search-service.d.ts +15 -15
  246. package/dist/test/mocks/mock-search-service.js +53 -53
  247. package/dist/test/restoration-state-handler.test.d.ts +1 -1
  248. package/dist/test/restoration-state-handler.test.js +270 -270
  249. package/dist/test/review-block.test.d.ts +1 -1
  250. package/dist/test/review-block.test.js +44 -44
  251. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -1
  252. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +12 -12
  253. package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
  254. package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -73
  255. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
  256. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +420 -420
  257. package/dist/test/text-overlay.test.d.ts +1 -1
  258. package/dist/test/text-overlay.test.js +48 -48
  259. package/dist/test/text-snippet-block.test.d.ts +1 -1
  260. package/dist/test/text-snippet-block.test.js +57 -57
  261. package/dist/test/tile-stats.test.d.ts +1 -1
  262. package/dist/test/tile-stats.test.js +81 -81
  263. package/dist/test/tiles/grid/account-tile.test.d.ts +1 -1
  264. package/dist/test/tiles/grid/account-tile.test.js +76 -76
  265. package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
  266. package/dist/test/tiles/grid/collection-tile.test.js +73 -73
  267. package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
  268. package/dist/test/tiles/grid/item-tile.test.js +312 -312
  269. package/dist/test/tiles/grid/search-tile.test.d.ts +1 -1
  270. package/dist/test/tiles/grid/search-tile.test.js +51 -51
  271. package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
  272. package/dist/test/tiles/hover/hover-pane-controller.test.js +259 -259
  273. package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -1
  274. package/dist/test/tiles/hover/tile-hover-pane.test.js +13 -13
  275. package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
  276. package/dist/test/tiles/list/tile-list-compact.test.js +143 -143
  277. package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
  278. package/dist/test/tiles/list/tile-list.test.js +297 -297
  279. package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -1
  280. package/dist/test/tiles/tile-dispatcher.test.js +100 -100
  281. package/dist/test/tiles/tile-display-value-provider.test.d.ts +1 -1
  282. package/dist/test/tiles/tile-display-value-provider.test.js +141 -141
  283. package/dist/test/utils/array-equals.test.d.ts +1 -1
  284. package/dist/test/utils/array-equals.test.js +26 -26
  285. package/dist/test/utils/format-count.test.d.ts +1 -1
  286. package/dist/test/utils/format-count.test.js +23 -23
  287. package/dist/test/utils/format-date.test.d.ts +1 -1
  288. package/dist/test/utils/format-date.test.js +17 -17
  289. package/dist/test/utils/format-unit-size.test.d.ts +1 -1
  290. package/dist/test/utils/format-unit-size.test.js +17 -17
  291. package/dist/test/utils/local-date-from-utc.test.d.ts +1 -1
  292. package/dist/test/utils/local-date-from-utc.test.js +26 -26
  293. package/local.archive.org.cert +86 -86
  294. package/local.archive.org.key +27 -27
  295. package/package.json +1 -1
  296. package/renovate.json +6 -6
  297. package/src/app-root.ts +25 -59
  298. package/src/collection-browser.ts +7 -9
  299. package/src/manage/manage-bar.ts +22 -33
  300. package/src/sort-filter-bar/sort-filter-bar.ts +1 -10
  301. package/src/styles/ia-button.ts +107 -0
  302. package/src/tiles/tile-dispatcher.ts +1 -3
  303. package/test/collection-browser.test.ts +38 -0
  304. package/test/manage/manage-bar.test.ts +5 -0
  305. package/tsconfig.json +21 -21
  306. package/web-dev-server.config.mjs +30 -30
  307. package/web-test-runner.config.mjs +41 -41
@@ -1,315 +1,315 @@
1
- import { __decorate } from "tslib";
2
- /* eslint-disable import/no-duplicates */
3
- import { html, css, LitElement, nothing, } from 'lit';
4
- import { customElement, property, query, state } from 'lit/decorators.js';
5
- import { classMap } from 'lit/directives/class-map.js';
6
- import { msg } from '@lit/localize';
7
- import { SearchType, } from '@internetarchive/search-service';
8
- import '@internetarchive/infinite-scroller';
9
- import { SortField, getDefaultSelectedFacets, sortOptionFromAPIString, SORT_OPTIONS, defaultProfileElementSorts, } from './models';
10
- import { RestorationStateHandler, } from './restoration-state-handler';
11
- import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
12
- import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
13
- import chevronIcon from './assets/img/icons/chevron';
14
- import { srOnlyStyle } from './styles/sr-only';
15
- import { sha1 } from './utils/sha1';
16
- import { formatDate } from './utils/format-date';
17
- import { log } from './utils/log';
18
- import './empty-placeholder';
19
- import './tiles/tile-dispatcher';
20
- import './tiles/collection-browser-loading-tile';
21
- import './sort-filter-bar/sort-filter-bar';
22
- import './manage/manage-bar';
23
- import './collection-facets';
24
- import './circular-activity-indicator';
25
- let CollectionBrowser = class CollectionBrowser extends LitElement {
26
- constructor() {
27
- super();
28
- this.baseImageUrl = 'https://archive.org';
29
- this.searchType = SearchType.METADATA;
30
- this.defaultSortParam = null;
31
- this.selectedSort = SortField.default;
32
- this.selectedTitleFilter = null;
33
- this.selectedCreatorFilter = null;
34
- this.sortDirection = null;
35
- this.pageSize = 50;
36
- this.showHistogramDatePicker = false;
37
- this.suppressPlaceholders = false;
38
- this.suppressResultCount = false;
39
- this.suppressResultTiles = false;
40
- this.suppressURLQuery = false;
41
- this.suppressFacets = false;
42
- this.suppressSortBar = false;
43
- this.suppressDisplayModes = false;
44
- this.clearResultsOnEmptyQuery = false;
45
- this.collectionPagePath = '/details/';
46
- /** describes where this component is being used */
47
- this.searchContext = analyticsCategories.default;
48
- this.pageContext = 'search';
49
- this.restorationStateHandler = new RestorationStateHandler({
50
- context: this.pageContext,
51
- });
52
- this.mobileBreakpoint = 600;
53
- this.loggedIn = false;
54
- this.modalManager = undefined;
55
- /**
56
- * If item management UI active
57
- */
58
- this.isManageView = false;
59
- /** Whether to replace the default sort options with a slot for customization (default: false) */
60
- this.enableSortOptionsSlot = false;
61
- /**
62
- * The results per page so we can paginate.
63
- *
64
- * This allows us to start in the middle of the search results and
65
- * fetch data before or after the current page. If we don't have a key
66
- * for the previous/next page, we'll fetch the next/previous page to populate it
67
- */
68
- this.dataSource = new CollectionBrowserDataSource(this, this.pageSize);
69
- /**
70
- * The page that the consumer wants to load.
71
- */
72
- this.initialPageNumber = 1;
73
- /**
74
- * This the the number of pages that we want to show.
75
- *
76
- * The data isn't necessarily loaded for all of the pages, but this lets us
77
- * know how many cells we should render.
78
- */
79
- this.pagesToRender = this.initialPageNumber;
80
- /**
81
- * Whether the initial page fetch for a new query is currently in progress.
82
- */
83
- this.searchResultsLoading = false;
84
- this.facetsLoading = false;
85
- this.mobileView = false;
86
- this.mobileFacetsVisible = false;
87
- this.defaultSortField = SortField.relevance;
88
- this.defaultSortDirection = null;
89
- this.placeholderType = null;
90
- /**
91
- * When we're animated scrolling to the page, we don't want to fetch
92
- * all of the pages as it scrolls so this lets us know if we're scrolling
93
- */
94
- this.isScrollingToCell = false;
95
- /**
96
- * When page width resizes from desktop to mobile, set true to
97
- * disable expand/collapse transition when loading.
98
- */
99
- this.isResizeToMobile = false;
100
- /**
101
- * Flag indicating that a new data source is currently being installed.
102
- * During the install, any URL persistence operation should replace the current entry
103
- * instead of creating a new one.
104
- */
105
- this.dataSourceInstallInProgress = false;
106
- this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
107
- /**
108
- * How many tiles to offset the data source by, to account for any removed tiles.
109
- */
110
- this.tileModelOffset = 0;
111
- /**
112
- * Updates the height of the left column according to its position on the page.
113
- * Arrow function ensures proper `this` binding.
114
- */
115
- this.updateLeftColumnHeight = () => {
116
- var _a, _b, _c, _d, _e;
117
- if (this.mobileView) {
118
- (_b = (_a = this.leftColumn) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.removeProperty('height');
119
- }
120
- else {
121
- const clientTop = (_c = this.leftColumn) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().top;
122
- (_e = (_d = this.leftColumn) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.setProperty('height', `${window.innerHeight - (clientTop !== null && clientTop !== void 0 ? clientTop : 0) - 3}px`);
123
- }
124
- };
125
- /**
126
- * Toggles whether the fade-out is visible at the bottom of the facets.
127
- * It should only be visible if the facets are not scrolled to the bottom.
128
- * Arrow function ensures proper `this` binding.
129
- */
130
- this.updateFacetFadeOut = (entries) => {
131
- var _a, _b;
132
- const fadeElmt = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('facets-bottom-fade');
133
- fadeElmt === null || fadeElmt === void 0 ? void 0 : fadeElmt.classList.toggle('hidden', (_b = entries === null || entries === void 0 ? void 0 : entries[0]) === null || _b === void 0 ? void 0 : _b.isIntersecting);
134
- };
135
- // we only want to scroll on the very first query change
136
- // so this keeps track of whether we've already set the initial query
137
- this.initialQueryChangeHappened = false;
138
- this.historyPopOccurred = false;
139
- this.addController(this.dataSource);
140
- }
141
- tileModelAtCellIndex(index) {
142
- const model = this.dataSource.getTileModelAt(index);
143
- /**
144
- * If we encounter a model we don't have yet and we're not in the middle of an
145
- * automated scroll, fetch the page and just return undefined.
146
- * The datasource will be updated once the page is loaded and the cell will be rendered.
147
- *
148
- * We disable it during the automated scroll since we don't want to fetch pages for intervening cells the
149
- * user may never see.
150
- */
151
- if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {
152
- const pageNumber = Math.floor(index / this.pageSize) + 1;
153
- this.dataSource.fetchPage(pageNumber);
154
- }
155
- return model;
156
- }
157
- // this is the total number of tiles we expect if
158
- // the data returned is a full page worth
159
- // this is useful for putting in placeholders for the expected number of tiles
160
- get estimatedTileCount() {
161
- return this.pagesToRender * this.pageSize;
162
- }
163
- /**
164
- * Returns a promise resolving to a unique string that persists for the current browser session.
165
- * Used in generating unique IDs for search requests, so that multiple requests coming from the
166
- * same browser session can be identified.
167
- */
168
- async getSessionId() {
169
- try {
170
- const storedSessionId = sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem('cb-session');
171
- if (storedSessionId) {
172
- return storedSessionId;
173
- }
174
- // If we enter this method a second time while a first session ID is already being generated,
175
- // ensure we produce the same ID from both calls instead of generating another one.
176
- if (this.sessionIdGenPromise) {
177
- return this.sessionIdGenPromise;
178
- }
179
- this.sessionIdGenPromise = sha1(Math.random().toString());
180
- const newSessionId = await this.sessionIdGenPromise;
181
- sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.setItem('cb-session', newSessionId);
182
- return newSessionId;
183
- }
184
- catch (err) {
185
- // Either we can't generate the hash or we're restricted from accessing sessionStorage
186
- return '';
187
- }
188
- }
189
- /**
190
- * Go to the given page of results
191
- *
192
- * @param pageNumber
193
- */
194
- goToPage(pageNumber) {
195
- this.initialPageNumber = pageNumber;
196
- this.pagesToRender = pageNumber;
197
- return this.scrollToPage(pageNumber);
198
- }
199
- /**
200
- * Sets the state for whether the initial set of search results is loading in.
201
- */
202
- setSearchResultsLoading(loading) {
203
- this.searchResultsLoading = loading;
204
- }
205
- /**
206
- * Sets the state for whether facet data is loading in
207
- */
208
- setFacetsLoading(loading) {
209
- this.facetsLoading = loading;
210
- }
211
- /**
212
- * Sets the total number of results to be displayed for the current search
213
- */
214
- setTotalResultCount(totalResults) {
215
- this.totalResults = totalResults;
216
- }
217
- /**
218
- * Clears all selected/negated facets, date ranges, and letter filters.
219
- *
220
- * By default, the current sort field/direction are not cleared,
221
- * but this can be overridden by setting the `sort` option to `true`.
222
- *
223
- * Similarly, it is possible to finely control what is cleared by
224
- * setting any of the `facets`, `dateRange`, or `letterFilters` flags
225
- * in the options object.
226
- */
227
- clearFilters({ facets = true, dateRange = true, letterFilters = true, sort = false, } = {}) {
228
- // Don't bother clearing facets if none are checked, so that we don't
229
- // trigger unnecessary update cycles.
230
- if (facets && this.hasCheckedFacets) {
231
- this.selectedFacets = getDefaultSelectedFacets();
232
- }
233
- if (dateRange) {
234
- this.minSelectedDate = undefined;
235
- this.maxSelectedDate = undefined;
236
- }
237
- if (letterFilters) {
238
- this.selectedTitleFilter = null;
239
- this.selectedCreatorFilter = null;
240
- }
241
- if (sort) {
242
- this.sortDirection = null;
243
- this.selectedSort = SortField.default;
244
- }
245
- }
246
- /**
247
- * Returns true if the current value of `this.selectedFacets` contains
248
- * any facet buckets than have been selected or negated, or false otherwise.
249
- */
250
- get hasCheckedFacets() {
251
- if (!this.selectedFacets)
252
- return false;
253
- for (const facetGroup of Object.values(this.selectedFacets)) {
254
- for (const bucket of Object.values(facetGroup)) {
255
- if (bucket.state !== 'none')
256
- return true;
257
- }
258
- }
259
- return false;
260
- }
261
- /**
262
- * Returns true if there are any currently selected/negated facet buckets,
263
- * any selected date range, or any selected letter filters. False otherwise.
264
- *
265
- * Ignores sorting options.
266
- */
267
- get hasActiveFilters() {
268
- return !!(this.hasCheckedFacets ||
269
- this.minSelectedDate ||
270
- this.maxSelectedDate ||
271
- this.selectedTitleFilter ||
272
- this.selectedCreatorFilter);
273
- }
274
- render() {
275
- this.setPlaceholderType();
1
+ import { __decorate } from "tslib";
2
+ /* eslint-disable import/no-duplicates */
3
+ import { html, css, LitElement, nothing, } from 'lit';
4
+ import { customElement, property, query, state } from 'lit/decorators.js';
5
+ import { classMap } from 'lit/directives/class-map.js';
6
+ import { msg } from '@lit/localize';
7
+ import { SearchType, } from '@internetarchive/search-service';
8
+ import '@internetarchive/infinite-scroller';
9
+ import { SortField, getDefaultSelectedFacets, sortOptionFromAPIString, SORT_OPTIONS, defaultProfileElementSorts, } from './models';
10
+ import { RestorationStateHandler, } from './restoration-state-handler';
11
+ import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
12
+ import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
13
+ import chevronIcon from './assets/img/icons/chevron';
14
+ import { srOnlyStyle } from './styles/sr-only';
15
+ import { sha1 } from './utils/sha1';
16
+ import { formatDate } from './utils/format-date';
17
+ import { log } from './utils/log';
18
+ import './empty-placeholder';
19
+ import './tiles/tile-dispatcher';
20
+ import './tiles/collection-browser-loading-tile';
21
+ import './sort-filter-bar/sort-filter-bar';
22
+ import './manage/manage-bar';
23
+ import './collection-facets';
24
+ import './circular-activity-indicator';
25
+ let CollectionBrowser = class CollectionBrowser extends LitElement {
26
+ constructor() {
27
+ super();
28
+ this.baseImageUrl = 'https://archive.org';
29
+ this.searchType = SearchType.METADATA;
30
+ this.defaultSortParam = null;
31
+ this.selectedSort = SortField.default;
32
+ this.selectedTitleFilter = null;
33
+ this.selectedCreatorFilter = null;
34
+ this.sortDirection = null;
35
+ this.pageSize = 50;
36
+ this.showHistogramDatePicker = false;
37
+ this.suppressPlaceholders = false;
38
+ this.suppressResultCount = false;
39
+ this.suppressResultTiles = false;
40
+ this.suppressURLQuery = false;
41
+ this.suppressFacets = false;
42
+ this.suppressSortBar = false;
43
+ this.clearResultsOnEmptyQuery = false;
44
+ this.collectionPagePath = '/details/';
45
+ /** describes where this component is being used */
46
+ this.searchContext = analyticsCategories.default;
47
+ this.pageContext = 'search';
48
+ this.restorationStateHandler = new RestorationStateHandler({
49
+ context: this.pageContext,
50
+ });
51
+ this.mobileBreakpoint = 600;
52
+ this.loggedIn = false;
53
+ this.modalManager = undefined;
54
+ /**
55
+ * If item management UI active
56
+ */
57
+ this.isManageView = false;
58
+ this.manageViewLabel = 'Select items to remove';
59
+ /** Whether to replace the default sort options with a slot for customization (default: false) */
60
+ this.enableSortOptionsSlot = false;
61
+ /**
62
+ * The results per page so we can paginate.
63
+ *
64
+ * This allows us to start in the middle of the search results and
65
+ * fetch data before or after the current page. If we don't have a key
66
+ * for the previous/next page, we'll fetch the next/previous page to populate it
67
+ */
68
+ this.dataSource = new CollectionBrowserDataSource(this, this.pageSize);
69
+ /**
70
+ * The page that the consumer wants to load.
71
+ */
72
+ this.initialPageNumber = 1;
73
+ /**
74
+ * This the the number of pages that we want to show.
75
+ *
76
+ * The data isn't necessarily loaded for all of the pages, but this lets us
77
+ * know how many cells we should render.
78
+ */
79
+ this.pagesToRender = this.initialPageNumber;
80
+ /**
81
+ * Whether the initial page fetch for a new query is currently in progress.
82
+ */
83
+ this.searchResultsLoading = false;
84
+ this.facetsLoading = false;
85
+ this.mobileView = false;
86
+ this.mobileFacetsVisible = false;
87
+ this.defaultSortField = SortField.relevance;
88
+ this.defaultSortDirection = null;
89
+ this.placeholderType = null;
90
+ /**
91
+ * When we're animated scrolling to the page, we don't want to fetch
92
+ * all of the pages as it scrolls so this lets us know if we're scrolling
93
+ */
94
+ this.isScrollingToCell = false;
95
+ /**
96
+ * When page width resizes from desktop to mobile, set true to
97
+ * disable expand/collapse transition when loading.
98
+ */
99
+ this.isResizeToMobile = false;
100
+ /**
101
+ * Flag indicating that a new data source is currently being installed.
102
+ * During the install, any URL persistence operation should replace the current entry
103
+ * instead of creating a new one.
104
+ */
105
+ this.dataSourceInstallInProgress = false;
106
+ this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
107
+ /**
108
+ * How many tiles to offset the data source by, to account for any removed tiles.
109
+ */
110
+ this.tileModelOffset = 0;
111
+ /**
112
+ * Updates the height of the left column according to its position on the page.
113
+ * Arrow function ensures proper `this` binding.
114
+ */
115
+ this.updateLeftColumnHeight = () => {
116
+ var _a, _b, _c, _d, _e;
117
+ if (this.mobileView) {
118
+ (_b = (_a = this.leftColumn) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.removeProperty('height');
119
+ }
120
+ else {
121
+ const clientTop = (_c = this.leftColumn) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().top;
122
+ (_e = (_d = this.leftColumn) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.setProperty('height', `${window.innerHeight - (clientTop !== null && clientTop !== void 0 ? clientTop : 0) - 3}px`);
123
+ }
124
+ };
125
+ /**
126
+ * Toggles whether the fade-out is visible at the bottom of the facets.
127
+ * It should only be visible if the facets are not scrolled to the bottom.
128
+ * Arrow function ensures proper `this` binding.
129
+ */
130
+ this.updateFacetFadeOut = (entries) => {
131
+ var _a, _b;
132
+ const fadeElmt = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('facets-bottom-fade');
133
+ fadeElmt === null || fadeElmt === void 0 ? void 0 : fadeElmt.classList.toggle('hidden', (_b = entries === null || entries === void 0 ? void 0 : entries[0]) === null || _b === void 0 ? void 0 : _b.isIntersecting);
134
+ };
135
+ // we only want to scroll on the very first query change
136
+ // so this keeps track of whether we've already set the initial query
137
+ this.initialQueryChangeHappened = false;
138
+ this.historyPopOccurred = false;
139
+ this.addController(this.dataSource);
140
+ }
141
+ tileModelAtCellIndex(index) {
142
+ const model = this.dataSource.getTileModelAt(index);
143
+ /**
144
+ * If we encounter a model we don't have yet and we're not in the middle of an
145
+ * automated scroll, fetch the page and just return undefined.
146
+ * The datasource will be updated once the page is loaded and the cell will be rendered.
147
+ *
148
+ * We disable it during the automated scroll since we don't want to fetch pages for intervening cells the
149
+ * user may never see.
150
+ */
151
+ if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {
152
+ const pageNumber = Math.floor(index / this.pageSize) + 1;
153
+ this.dataSource.fetchPage(pageNumber);
154
+ }
155
+ return model;
156
+ }
157
+ // this is the total number of tiles we expect if
158
+ // the data returned is a full page worth
159
+ // this is useful for putting in placeholders for the expected number of tiles
160
+ get estimatedTileCount() {
161
+ return this.pagesToRender * this.pageSize;
162
+ }
163
+ /**
164
+ * Returns a promise resolving to a unique string that persists for the current browser session.
165
+ * Used in generating unique IDs for search requests, so that multiple requests coming from the
166
+ * same browser session can be identified.
167
+ */
168
+ async getSessionId() {
169
+ try {
170
+ const storedSessionId = sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem('cb-session');
171
+ if (storedSessionId) {
172
+ return storedSessionId;
173
+ }
174
+ // If we enter this method a second time while a first session ID is already being generated,
175
+ // ensure we produce the same ID from both calls instead of generating another one.
176
+ if (this.sessionIdGenPromise) {
177
+ return this.sessionIdGenPromise;
178
+ }
179
+ this.sessionIdGenPromise = sha1(Math.random().toString());
180
+ const newSessionId = await this.sessionIdGenPromise;
181
+ sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.setItem('cb-session', newSessionId);
182
+ return newSessionId;
183
+ }
184
+ catch (err) {
185
+ // Either we can't generate the hash or we're restricted from accessing sessionStorage
186
+ return '';
187
+ }
188
+ }
189
+ /**
190
+ * Go to the given page of results
191
+ *
192
+ * @param pageNumber
193
+ */
194
+ goToPage(pageNumber) {
195
+ this.initialPageNumber = pageNumber;
196
+ this.pagesToRender = pageNumber;
197
+ return this.scrollToPage(pageNumber);
198
+ }
199
+ /**
200
+ * Sets the state for whether the initial set of search results is loading in.
201
+ */
202
+ setSearchResultsLoading(loading) {
203
+ this.searchResultsLoading = loading;
204
+ }
205
+ /**
206
+ * Sets the state for whether facet data is loading in
207
+ */
208
+ setFacetsLoading(loading) {
209
+ this.facetsLoading = loading;
210
+ }
211
+ /**
212
+ * Sets the total number of results to be displayed for the current search
213
+ */
214
+ setTotalResultCount(totalResults) {
215
+ this.totalResults = totalResults;
216
+ }
217
+ /**
218
+ * Clears all selected/negated facets, date ranges, and letter filters.
219
+ *
220
+ * By default, the current sort field/direction are not cleared,
221
+ * but this can be overridden by setting the `sort` option to `true`.
222
+ *
223
+ * Similarly, it is possible to finely control what is cleared by
224
+ * setting any of the `facets`, `dateRange`, or `letterFilters` flags
225
+ * in the options object.
226
+ */
227
+ clearFilters({ facets = true, dateRange = true, letterFilters = true, sort = false, } = {}) {
228
+ // Don't bother clearing facets if none are checked, so that we don't
229
+ // trigger unnecessary update cycles.
230
+ if (facets && this.hasCheckedFacets) {
231
+ this.selectedFacets = getDefaultSelectedFacets();
232
+ }
233
+ if (dateRange) {
234
+ this.minSelectedDate = undefined;
235
+ this.maxSelectedDate = undefined;
236
+ }
237
+ if (letterFilters) {
238
+ this.selectedTitleFilter = null;
239
+ this.selectedCreatorFilter = null;
240
+ }
241
+ if (sort) {
242
+ this.sortDirection = null;
243
+ this.selectedSort = SortField.default;
244
+ }
245
+ }
246
+ /**
247
+ * Returns true if the current value of `this.selectedFacets` contains
248
+ * any facet buckets than have been selected or negated, or false otherwise.
249
+ */
250
+ get hasCheckedFacets() {
251
+ if (!this.selectedFacets)
252
+ return false;
253
+ for (const facetGroup of Object.values(this.selectedFacets)) {
254
+ for (const bucket of Object.values(facetGroup)) {
255
+ if (bucket.state !== 'none')
256
+ return true;
257
+ }
258
+ }
259
+ return false;
260
+ }
261
+ /**
262
+ * Returns true if there are any currently selected/negated facet buckets,
263
+ * any selected date range, or any selected letter filters. False otherwise.
264
+ *
265
+ * Ignores sorting options.
266
+ */
267
+ get hasActiveFilters() {
268
+ return !!(this.hasCheckedFacets ||
269
+ this.minSelectedDate ||
270
+ this.maxSelectedDate ||
271
+ this.selectedTitleFilter ||
272
+ this.selectedCreatorFilter);
273
+ }
274
+ render() {
275
+ this.setPlaceholderType();
276
276
  return html `
277
277
  <div
278
278
  id="content-container"
279
279
  class=${this.mobileView ? 'mobile' : 'desktop'}
280
280
  >
281
- ${this.placeholderType
282
- ? this.emptyPlaceholderTemplate
281
+ ${this.placeholderType
282
+ ? this.emptyPlaceholderTemplate
283
283
  : this.collectionBrowserTemplate}
284
284
  </div>
285
- `;
286
- }
287
- setPlaceholderType() {
288
- var _a;
289
- const hasQuery = !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
290
- const isCollection = !!this.withinCollection;
291
- const isProfile = !!this.withinProfile;
292
- const noResults = !this.searchResultsLoading &&
293
- (this.dataSource.size === 0 || !this.searchService);
294
- this.placeholderType = null;
295
- if (this.suppressPlaceholders)
296
- return;
297
- if (!hasQuery && !isCollection && !isProfile) {
298
- this.placeholderType = 'empty-query';
299
- }
300
- else if (noResults) {
301
- // Within a collection, no query + no results means the collection simply has no viewable items.
302
- // Otherwise, we must have a user query that produced 0 results.
303
- this.placeholderType =
304
- !hasQuery && isCollection ? 'empty-collection' : 'no-results';
305
- }
306
- if (this.dataSource.queryErrorMessage) {
307
- this.placeholderType =
308
- !hasQuery && isCollection ? 'collection-error' : 'query-error';
309
- }
310
- }
311
- get emptyPlaceholderTemplate() {
312
- var _a;
285
+ `;
286
+ }
287
+ setPlaceholderType() {
288
+ var _a;
289
+ const hasQuery = !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
290
+ const isCollection = !!this.withinCollection;
291
+ const isProfile = !!this.withinProfile;
292
+ const noResults = !this.searchResultsLoading &&
293
+ (this.dataSource.size === 0 || !this.searchService);
294
+ this.placeholderType = null;
295
+ if (this.suppressPlaceholders)
296
+ return;
297
+ if (!hasQuery && !isCollection && !isProfile) {
298
+ this.placeholderType = 'empty-query';
299
+ }
300
+ else if (noResults) {
301
+ // Within a collection, no query + no results means the collection simply has no viewable items.
302
+ // Otherwise, we must have a user query that produced 0 results.
303
+ this.placeholderType =
304
+ !hasQuery && isCollection ? 'empty-collection' : 'no-results';
305
+ }
306
+ if (this.dataSource.queryErrorMessage) {
307
+ this.placeholderType =
308
+ !hasQuery && isCollection ? 'collection-error' : 'query-error';
309
+ }
310
+ }
311
+ get emptyPlaceholderTemplate() {
312
+ var _a;
313
313
  return html `
314
314
  <empty-placeholder
315
315
  .placeholderType=${this.placeholderType}
@@ -318,33 +318,33 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
318
318
  .detailMessage=${(_a = this.dataSource.queryErrorMessage) !== null && _a !== void 0 ? _a : ''}
319
319
  .baseNavigationUrl=${this.baseNavigationUrl}
320
320
  ></empty-placeholder>
321
- `;
322
- }
323
- /**
324
- * Top-level template for rendering the left (facets) and right (results) columns.
325
- */
326
- get collectionBrowserTemplate() {
321
+ `;
322
+ }
323
+ /**
324
+ * Top-level template for rendering the left (facets) and right (results) columns.
325
+ */
326
+ get collectionBrowserTemplate() {
327
327
  return html `
328
328
  <div id="left-column-scroll-sentinel"></div>
329
329
  ${this.leftColumnTemplate} ${this.rightColumnTemplate}
330
- `;
331
- }
332
- /**
333
- * Template for either the mobile or desktop version of the left column, depending
334
- * on current component state.
335
- */
336
- get leftColumnTemplate() {
337
- if (this.mobileView) {
338
- return this.mobileLeftColumnTemplate;
339
- }
340
- return this.desktopLeftColumnTemplate;
341
- }
342
- /**
343
- * Template for the mobile version of the "left column" (which in this case, appears
344
- * *above* the search results rather than beside them), for rendering the
345
- * accordion-style facets.
346
- */
347
- get mobileLeftColumnTemplate() {
330
+ `;
331
+ }
332
+ /**
333
+ * Template for either the mobile or desktop version of the left column, depending
334
+ * on current component state.
335
+ */
336
+ get leftColumnTemplate() {
337
+ if (this.mobileView) {
338
+ return this.mobileLeftColumnTemplate;
339
+ }
340
+ return this.desktopLeftColumnTemplate;
341
+ }
342
+ /**
343
+ * Template for the mobile version of the "left column" (which in this case, appears
344
+ * *above* the search results rather than beside them), for rendering the
345
+ * accordion-style facets.
346
+ */
347
+ get mobileLeftColumnTemplate() {
348
348
  return html `
349
349
  <div
350
350
  id="left-column"
@@ -353,12 +353,12 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
353
353
  ${this.facetTopViewSlot} ${this.resultsCountTemplate}
354
354
  <div id="facets-header-container">${this.mobileFacetsTemplate}</div>
355
355
  </div>
356
- `;
357
- }
358
- /**
359
- * Template for the desktop version of the left column, displaying the facets sidebar.
360
- */
361
- get desktopLeftColumnTemplate() {
356
+ `;
357
+ }
358
+ /**
359
+ * Template for the desktop version of the left column, displaying the facets sidebar.
360
+ */
361
+ get desktopLeftColumnTemplate() {
362
362
  return html `
363
363
  <div id="left-column" class="column">
364
364
  ${this.facetTopViewSlot}
@@ -372,28 +372,28 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
372
372
  </div>
373
373
  <div id="facets-bottom-fade"></div>
374
374
  </div>
375
- `;
376
- }
377
- /**
378
- * Slot which is placed at top of the facets area for user-profile page
379
- * - mainly used to render userlists
380
- */
381
- get facetTopViewSlot() {
375
+ `;
376
+ }
377
+ /**
378
+ * Slot which is placed at top of the facets area for user-profile page
379
+ * - mainly used to render userlists
380
+ */
381
+ get facetTopViewSlot() {
382
382
  return html `<div id="facet-top-view">
383
383
  <slot name="facet-top-slot"></slot>
384
- </div>`;
385
- }
386
- /**
387
- * Template for the "X Results" count at the top of the search results.
388
- * Changes to the "Searching..." label if the search results are still loading.
389
- */
390
- get resultsCountTemplate() {
391
- var _a;
392
- if (this.suppressResultCount)
393
- return nothing;
394
- const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
395
- const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
396
- const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
384
+ </div>`;
385
+ }
386
+ /**
387
+ * Template for the "X Results" count at the top of the search results.
388
+ * Changes to the "Searching..." label if the search results are still loading.
389
+ */
390
+ get resultsCountTemplate() {
391
+ var _a;
392
+ if (this.suppressResultCount)
393
+ return nothing;
394
+ const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
395
+ const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
396
+ const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
397
397
  return html `
398
398
  <div id="results-total">
399
399
  <span id="big-results-count">
@@ -403,30 +403,30 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
403
403
  ${shouldShowSearching ? nothing : resultsLabel}
404
404
  </span>
405
405
  </div>
406
- `;
407
- }
408
- /**
409
- * Template for the right column of the collection browser, where the result
410
- * tiles and sort/filter bar are shown.
411
- */
412
- get rightColumnTemplate() {
406
+ `;
407
+ }
408
+ /**
409
+ * Template for the right column of the collection browser, where the result
410
+ * tiles and sort/filter bar are shown.
411
+ */
412
+ get rightColumnTemplate() {
413
413
  return html `
414
414
  <div id="right-column" class="column">
415
415
  <div id="cb-top-view">
416
416
  <slot name="cb-top-slot"></slot>
417
417
  </div>
418
- ${this.isManageView
419
- ? this.manageBarTemplate
418
+ ${this.isManageView
419
+ ? this.manageBarTemplate
420
420
  : this.sortFilterBarTemplate}
421
421
  <slot name="cb-results"></slot>
422
- ${this.displayMode === `list-compact`
423
- ? this.listHeaderTemplate
422
+ ${this.displayMode === `list-compact`
423
+ ? this.listHeaderTemplate
424
424
  : nothing}
425
425
  ${this.suppressResultTiles ? nothing : this.infiniteScrollerTemplate}
426
426
  </div>
427
- `;
428
- }
429
- get infiniteScrollerTemplate() {
427
+ `;
428
+ }
429
+ get infiniteScrollerTemplate() {
430
430
  return html `<infinite-scroller
431
431
  class=${this.infiniteScrollerClasses}
432
432
  itemCount=${this.placeholderType ? 0 : nothing}
@@ -435,22 +435,22 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
435
435
  .placeholderCellTemplate=${this.placeholderCellTemplate}
436
436
  @scrollThresholdReached=${this.scrollThresholdReached}
437
437
  @visibleCellsChanged=${this.visibleCellsChanged}
438
- >${this.displayMode === 'grid'
439
- ? html `<slot name="result-last-tile" slot="result-last-tile"></slot>`
438
+ >${this.displayMode === 'grid'
439
+ ? html `<slot name="result-last-tile" slot="result-last-tile"></slot>`
440
440
  : nothing}
441
- </infinite-scroller>`;
442
- }
443
- get infiniteScrollerClasses() {
444
- var _a;
445
- return classMap({
446
- [(_a = this.displayMode) !== null && _a !== void 0 ? _a : '']: !!this.displayMode,
447
- hidden: !!this.placeholderType,
448
- });
449
- }
450
- get sortFilterBarTemplate() {
451
- var _a;
452
- if (this.suppressSortBar)
453
- return nothing;
441
+ </infinite-scroller>`;
442
+ }
443
+ get infiniteScrollerClasses() {
444
+ var _a;
445
+ return classMap({
446
+ [(_a = this.displayMode) !== null && _a !== void 0 ? _a : '']: !!this.displayMode,
447
+ hidden: !!this.placeholderType,
448
+ });
449
+ }
450
+ get sortFilterBarTemplate() {
451
+ var _a;
452
+ if (this.suppressSortBar)
453
+ return nothing;
454
454
  return html `
455
455
  <sort-filter-bar
456
456
  .defaultSortField=${this.defaultSortField}
@@ -465,7 +465,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
465
465
  .prefixFilterCountMap=${this.dataSource.prefixFilterCountMap}
466
466
  .resizeObserver=${this.resizeObserver}
467
467
  .enableSortOptionsSlot=${this.enableSortOptionsSlot}
468
- .suppressDisplayModes=${this.suppressDisplayModes}
469
468
  @sortChanged=${this.userChangedSort}
470
469
  @displayModeChanged=${this.displayModeChanged}
471
470
  @titleLetterChanged=${this.titleLetterSelected}
@@ -473,175 +472,176 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
473
472
  >
474
473
  <slot name="sort-options-left" slot="sort-options-left"></slot>
475
474
  <slot name="sort-options" slot="sort-options"></slot>
476
- <slot name="sort-options-right" slot="sort-options-right"></slot>
477
475
  </sort-filter-bar>
478
- `;
479
- }
480
- get manageBarTemplate() {
476
+ `;
477
+ }
478
+ get manageBarTemplate() {
481
479
  return html `
482
480
  <manage-bar
481
+ label=${this.manageViewLabel}
483
482
  showSelectAll
484
483
  showUnselectAll
484
+ ?enableRemoveButton=${this.dataSource.checkedTileModels.length !== 0}
485
485
  @removeItems=${this.handleRemoveItems}
486
486
  @selectAll=${() => this.dataSource.checkAllTiles()}
487
487
  @unselectAll=${() => this.dataSource.uncheckAllTiles()}
488
- @cancel=${() => {
489
- this.isManageView = false;
490
- this.dataSource.uncheckAllTiles();
488
+ @cancel=${() => {
489
+ this.isManageView = false;
490
+ this.dataSource.uncheckAllTiles();
491
491
  }}
492
492
  ></manage-bar>
493
- `;
494
- }
495
- /**
496
- * Handler for when the user requests to remove all checked items via the manage bar.
497
- * Emits an `itemRemovalRequested` event with all checked tile models.
498
- */
499
- handleRemoveItems() {
500
- this.dispatchEvent(new CustomEvent('itemRemovalRequested', {
501
- detail: {
502
- items: this.dataSource.checkedTileModels.map(model => {
503
- const cloned = model.clone();
504
- cloned.dateStr = formatDate(model.datePublished, 'long');
505
- return cloned;
506
- }),
507
- },
508
- }));
509
- }
510
- /**
511
- * Removes all tile models that are currently checked & adjusts the paging
512
- * of the data source to account for any new gaps in the data.
513
- */
514
- removeCheckedTiles() {
515
- this.dataSource.removeCheckedTiles();
516
- }
517
- userChangedSort(e) {
518
- var _a;
519
- const { selectedSort, sortDirection } = e.detail;
520
- this.selectedSort = selectedSort;
521
- this.sortDirection = sortDirection;
522
- if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
523
- this.goToPage(1);
524
- }
525
- this.currentPage = 1;
526
- }
527
- sendSortByAnalytics(prevSortDirection) {
528
- var _a;
529
- const directionCleared = prevSortDirection && !this.sortDirection;
530
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
531
- category: this.searchContext,
532
- action: analyticsActions.sortBy,
533
- label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
534
- });
535
- }
536
- selectedSortChanged() {
537
- // Lazy-load the alphabet counts for title/creator sort bar as needed
538
- this.dataSource.updatePrefixFiltersForCurrentSort();
539
- }
540
- get sortParam() {
541
- var _a;
542
- const sortOption = SORT_OPTIONS[this.selectedSort];
543
- if (!(sortOption === null || sortOption === void 0 ? void 0 : sortOption.handledBySearchService)) {
544
- return null;
545
- }
546
- // If the sort option specified in the URL is unrecognized, we just use it as-is
547
- const urlSortParam = new URL(window.location.href).searchParams.get('sort');
548
- const sortField = (_a = sortOption.searchServiceKey) !== null && _a !== void 0 ? _a : urlSortParam === null || urlSortParam === void 0 ? void 0 : urlSortParam.replace(/^-/, '');
549
- // If the sort direction is still null at this point, then we assume ascending
550
- // (i.e., it was unrecognized and had no directional flag)
551
- if (!this.sortDirection)
552
- this.sortDirection = 'asc';
553
- if (!sortField)
554
- return null;
555
- return { field: sortField, direction: this.sortDirection };
556
- }
557
- displayModeChanged(e) {
558
- var _a;
559
- this.displayMode = e.detail.displayMode;
560
- if (this.displayMode) {
561
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
562
- category: this.searchContext,
563
- action: analyticsActions.displayMode,
564
- label: this.displayMode,
565
- });
566
- }
567
- }
568
- /**
569
- * Returns a query clause identifying the currently selected title filter,
570
- * e.g., `firstTitle:X`.
571
- */
572
- get titleQuery() {
573
- return this.selectedTitleFilter
574
- ? `firstTitle:${this.selectedTitleFilter}`
575
- : undefined;
576
- }
577
- /**
578
- * Returns a query clause identifying the currently selected creator filter,
579
- * e.g., `firstCreator:X`.
580
- */
581
- get creatorQuery() {
582
- return this.selectedCreatorFilter
583
- ? `firstCreator:${this.selectedCreatorFilter}`
584
- : undefined;
585
- }
586
- /**
587
- * Send Analytics when sorting by title's first letter
588
- * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
589
- */
590
- sendFilterByTitleAnalytics(prevSelectedLetter) {
591
- var _a;
592
- if (!prevSelectedLetter && !this.selectedTitleFilter) {
593
- return;
594
- }
595
- const cleared = prevSelectedLetter && !this.selectedTitleFilter;
596
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
597
- category: this.searchContext,
598
- action: analyticsActions.filterByTitle,
599
- label: cleared
600
- ? `clear-${prevSelectedLetter}`
601
- : `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
602
- });
603
- }
604
- /**
605
- * Send Analytics when filtering by creator's first letter
606
- * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
607
- */
608
- sendFilterByCreatorAnalytics(prevSelectedLetter) {
609
- var _a;
610
- if (!prevSelectedLetter && !this.selectedCreatorFilter) {
611
- return;
612
- }
613
- const cleared = prevSelectedLetter && !this.selectedCreatorFilter;
614
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
615
- category: this.searchContext,
616
- action: analyticsActions.filterByCreator,
617
- label: cleared
618
- ? `clear-${prevSelectedLetter}`
619
- : `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
620
- });
621
- }
622
- /**
623
- * Handler for changes to which letter is selected in the title alphabet bar.
624
- */
625
- titleLetterSelected(e) {
626
- this.selectedCreatorFilter = null;
627
- this.selectedTitleFilter = e.detail.selectedLetter;
628
- }
629
- /**
630
- * Handler for changes to which letter is selected in the creator alphabet bar.
631
- */
632
- creatorLetterSelected(e) {
633
- this.selectedTitleFilter = null;
634
- this.selectedCreatorFilter = e.detail.selectedLetter;
635
- }
636
- /**
637
- * The full template for how the facets should be structured in mobile view,
638
- * including the collapsible container (with header) and the facets themselves.
639
- */
640
- get mobileFacetsTemplate() {
641
- const toggleFacetsVisible = () => {
642
- this.isResizeToMobile = false;
643
- this.mobileFacetsVisible = !this.mobileFacetsVisible;
644
- };
493
+ `;
494
+ }
495
+ /**
496
+ * Handler for when the user requests to remove all checked items via the manage bar.
497
+ * Emits an `itemRemovalRequested` event with all checked tile models.
498
+ */
499
+ handleRemoveItems() {
500
+ this.dispatchEvent(new CustomEvent('itemRemovalRequested', {
501
+ detail: {
502
+ items: this.dataSource.checkedTileModels.map(model => {
503
+ const cloned = model.clone();
504
+ cloned.dateStr = formatDate(model.datePublished, 'long');
505
+ return cloned;
506
+ }),
507
+ },
508
+ }));
509
+ }
510
+ /**
511
+ * Removes all tile models that are currently checked & adjusts the paging
512
+ * of the data source to account for any new gaps in the data.
513
+ */
514
+ removeCheckedTiles() {
515
+ this.dataSource.removeCheckedTiles();
516
+ }
517
+ userChangedSort(e) {
518
+ var _a;
519
+ const { selectedSort, sortDirection } = e.detail;
520
+ this.selectedSort = selectedSort;
521
+ this.sortDirection = sortDirection;
522
+ if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
523
+ this.goToPage(1);
524
+ }
525
+ this.currentPage = 1;
526
+ }
527
+ sendSortByAnalytics(prevSortDirection) {
528
+ var _a;
529
+ const directionCleared = prevSortDirection && !this.sortDirection;
530
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
531
+ category: this.searchContext,
532
+ action: analyticsActions.sortBy,
533
+ label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
534
+ });
535
+ }
536
+ selectedSortChanged() {
537
+ // Lazy-load the alphabet counts for title/creator sort bar as needed
538
+ this.dataSource.updatePrefixFiltersForCurrentSort();
539
+ }
540
+ get sortParam() {
541
+ var _a;
542
+ const sortOption = SORT_OPTIONS[this.selectedSort];
543
+ if (!(sortOption === null || sortOption === void 0 ? void 0 : sortOption.handledBySearchService)) {
544
+ return null;
545
+ }
546
+ // If the sort option specified in the URL is unrecognized, we just use it as-is
547
+ const urlSortParam = new URL(window.location.href).searchParams.get('sort');
548
+ const sortField = (_a = sortOption.searchServiceKey) !== null && _a !== void 0 ? _a : urlSortParam === null || urlSortParam === void 0 ? void 0 : urlSortParam.replace(/^-/, '');
549
+ // If the sort direction is still null at this point, then we assume ascending
550
+ // (i.e., it was unrecognized and had no directional flag)
551
+ if (!this.sortDirection)
552
+ this.sortDirection = 'asc';
553
+ if (!sortField)
554
+ return null;
555
+ return { field: sortField, direction: this.sortDirection };
556
+ }
557
+ displayModeChanged(e) {
558
+ var _a;
559
+ this.displayMode = e.detail.displayMode;
560
+ if (this.displayMode) {
561
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
562
+ category: this.searchContext,
563
+ action: analyticsActions.displayMode,
564
+ label: this.displayMode,
565
+ });
566
+ }
567
+ }
568
+ /**
569
+ * Returns a query clause identifying the currently selected title filter,
570
+ * e.g., `firstTitle:X`.
571
+ */
572
+ get titleQuery() {
573
+ return this.selectedTitleFilter
574
+ ? `firstTitle:${this.selectedTitleFilter}`
575
+ : undefined;
576
+ }
577
+ /**
578
+ * Returns a query clause identifying the currently selected creator filter,
579
+ * e.g., `firstCreator:X`.
580
+ */
581
+ get creatorQuery() {
582
+ return this.selectedCreatorFilter
583
+ ? `firstCreator:${this.selectedCreatorFilter}`
584
+ : undefined;
585
+ }
586
+ /**
587
+ * Send Analytics when sorting by title's first letter
588
+ * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
589
+ */
590
+ sendFilterByTitleAnalytics(prevSelectedLetter) {
591
+ var _a;
592
+ if (!prevSelectedLetter && !this.selectedTitleFilter) {
593
+ return;
594
+ }
595
+ const cleared = prevSelectedLetter && !this.selectedTitleFilter;
596
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
597
+ category: this.searchContext,
598
+ action: analyticsActions.filterByTitle,
599
+ label: cleared
600
+ ? `clear-${prevSelectedLetter}`
601
+ : `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
602
+ });
603
+ }
604
+ /**
605
+ * Send Analytics when filtering by creator's first letter
606
+ * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
607
+ */
608
+ sendFilterByCreatorAnalytics(prevSelectedLetter) {
609
+ var _a;
610
+ if (!prevSelectedLetter && !this.selectedCreatorFilter) {
611
+ return;
612
+ }
613
+ const cleared = prevSelectedLetter && !this.selectedCreatorFilter;
614
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
615
+ category: this.searchContext,
616
+ action: analyticsActions.filterByCreator,
617
+ label: cleared
618
+ ? `clear-${prevSelectedLetter}`
619
+ : `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
620
+ });
621
+ }
622
+ /**
623
+ * Handler for changes to which letter is selected in the title alphabet bar.
624
+ */
625
+ titleLetterSelected(e) {
626
+ this.selectedCreatorFilter = null;
627
+ this.selectedTitleFilter = e.detail.selectedLetter;
628
+ }
629
+ /**
630
+ * Handler for changes to which letter is selected in the creator alphabet bar.
631
+ */
632
+ creatorLetterSelected(e) {
633
+ this.selectedTitleFilter = null;
634
+ this.selectedCreatorFilter = e.detail.selectedLetter;
635
+ }
636
+ /**
637
+ * The full template for how the facets should be structured in mobile view,
638
+ * including the collapsible container (with header) and the facets themselves.
639
+ */
640
+ get mobileFacetsTemplate() {
641
+ const toggleFacetsVisible = () => {
642
+ this.isResizeToMobile = false;
643
+ this.mobileFacetsVisible = !this.mobileFacetsVisible;
644
+ };
645
645
  return html `
646
646
  <details
647
647
  id="mobile-filter-collapse"
@@ -655,19 +655,19 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
655
655
  </summary>
656
656
  ${this.facetsTemplate}
657
657
  </details>
658
- `;
659
- }
660
- /**
661
- * The template for the facets component alone, without any surrounding wrappers.
662
- */
663
- get facetsTemplate() {
664
- if (this.suppressFacets) {
658
+ `;
659
+ }
660
+ /**
661
+ * The template for the facets component alone, without any surrounding wrappers.
662
+ */
663
+ get facetsTemplate() {
664
+ if (this.suppressFacets) {
665
665
  return html `
666
666
  <p class="facets-message">
667
667
  ${msg('Facets are temporarily unavailable.')}
668
668
  </p>
669
- `;
670
- }
669
+ `;
670
+ }
671
671
  return html `
672
672
  <collection-facets
673
673
  @facetsChanged=${this.facetsChanged}
@@ -681,7 +681,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
681
681
  .resizeObserver=${this.resizeObserver}
682
682
  .searchType=${this.searchType}
683
683
  .aggregations=${this.dataSource.aggregations}
684
- .fullYearsHistogramAggregation=${this.dataSource
684
+ .fullYearsHistogramAggregation=${this.dataSource
685
685
  .yearHistogramAggregation}
686
686
  .minSelectedDate=${this.minSelectedDate}
687
687
  .maxSelectedDate=${this.maxSelectedDate}
@@ -702,41 +702,41 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
702
702
  .analyticsHandler=${this.analyticsHandler}
703
703
  >
704
704
  </collection-facets>
705
- `;
706
- }
707
- /**
708
- * The HTML template for the "Clear all filters" button, or `nothing` if no
709
- * filters are currently active.
710
- *
711
- * @param mobile Whether to style/shorten the button for mobile view
712
- */
713
- clearFiltersBtnTemplate(mobile) {
714
- if (!this.hasActiveFilters)
715
- return nothing;
716
- const buttonClasses = classMap({
717
- 'clear-filters-btn': true,
718
- mobile,
719
- });
720
- const buttonText = mobile ? 'Clear all' : 'Clear all filters';
705
+ `;
706
+ }
707
+ /**
708
+ * The HTML template for the "Clear all filters" button, or `nothing` if no
709
+ * filters are currently active.
710
+ *
711
+ * @param mobile Whether to style/shorten the button for mobile view
712
+ */
713
+ clearFiltersBtnTemplate(mobile) {
714
+ if (!this.hasActiveFilters)
715
+ return nothing;
716
+ const buttonClasses = classMap({
717
+ 'clear-filters-btn': true,
718
+ mobile,
719
+ });
720
+ const buttonText = mobile ? 'Clear all' : 'Clear all filters';
721
721
  return html `
722
722
  <div class="clear-filters-btn-row">
723
- ${mobile
724
- ? html `<span class="clear-filters-btn-separator">&nbsp;</span>`
723
+ ${mobile
724
+ ? html `<span class="clear-filters-btn-separator">&nbsp;</span>`
725
725
  : nothing}
726
726
  <button class=${buttonClasses} @click=${this.clearFilters}>
727
727
  ${buttonText}
728
728
  </button>
729
729
  </div>
730
- `;
731
- }
732
- get loadingTemplate() {
730
+ `;
731
+ }
732
+ get loadingTemplate() {
733
733
  return html `
734
734
  <div class="loading-cover">
735
735
  <circular-activity-indicator></circular-activity-indicator>
736
736
  </div>
737
- `;
738
- }
739
- get listHeaderTemplate() {
737
+ `;
738
+ }
739
+ get listHeaderTemplate() {
740
740
  return html `
741
741
  <div id="list-header">
742
742
  <tile-dispatcher
@@ -749,600 +749,600 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
749
749
  >
750
750
  </tile-dispatcher>
751
751
  </div>
752
- `;
753
- }
754
- histogramDateRangeUpdated(e) {
755
- var _a;
756
- const { minDate, maxDate } = e.detail;
757
- [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
758
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
759
- category: this.searchContext,
760
- action: analyticsActions.histogramChanged,
761
- label: this.dateRangeQueryClause,
762
- });
763
- }
764
- get dateRangeQueryClause() {
765
- if (!this.minSelectedDate || !this.maxSelectedDate) {
766
- return undefined;
767
- }
768
- return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;
769
- }
770
- /**
771
- * Emits an event indicating a change in whether the manage mode is shown.
772
- */
773
- emitManageModeChangedEvent() {
774
- this.dispatchEvent(new CustomEvent('manageModeChanged', {
775
- detail: this.isManageView,
776
- }));
777
- }
778
- async installDataSourceAndQueryState(dataSource, queryState) {
779
- var _a, _b;
780
- log('Installing data source & query state in CB:', dataSource, queryState);
781
- if (this.dataSource)
782
- this.removeController(this.dataSource);
783
- this.dataSource = dataSource;
784
- this.addController(this.dataSource);
785
- this.baseQuery = queryState.baseQuery;
786
- this.profileElement = queryState.profileElement;
787
- this.searchType = queryState.searchType;
788
- this.selectedFacets =
789
- (_a = queryState.selectedFacets) !== null && _a !== void 0 ? _a : getDefaultSelectedFacets();
790
- this.minSelectedDate = queryState.minSelectedDate;
791
- this.maxSelectedDate = queryState.maxSelectedDate;
792
- this.selectedSort = (_b = queryState.selectedSort) !== null && _b !== void 0 ? _b : SortField.default;
793
- this.sortDirection = queryState.sortDirection;
794
- this.selectedTitleFilter = queryState.selectedTitleFilter;
795
- this.selectedCreatorFilter = queryState.selectedCreatorFilter;
796
- // We set this flag during the update to prevent the URL state persistence
797
- // from creating an unwanted extra history entry.
798
- this.dataSourceInstallInProgress = true;
799
- this.requestUpdate();
800
- await this.updateComplete;
801
- this.dataSourceInstallInProgress = false;
802
- if (!this.searchResultsLoading) {
803
- this.setTotalResultCount(this.dataSource.totalResults);
804
- this.setTileCount(this.dataSource.size);
805
- }
806
- this.refreshVisibleResults();
807
- }
808
- firstUpdated() {
809
- this.restoreState();
810
- }
811
- updated(changed) {
812
- var _a, _b;
813
- if (changed.has('placeholderType') && this.placeholderType === null) {
814
- if (!this.leftColIntersectionObserver) {
815
- this.setupLeftColumnScrollListeners();
816
- }
817
- if (!this.facetsIntersectionObserver) {
818
- this.setupFacetsScrollListeners();
819
- }
820
- this.updateLeftColumnHeight();
821
- }
822
- if (changed.has('displayMode') ||
823
- changed.has('baseNavigationUrl') ||
824
- changed.has('baseImageUrl') ||
825
- changed.has('loggedIn')) {
826
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
827
- }
828
- if (changed.has('baseQuery') ||
829
- changed.has('searchType') ||
830
- changed.has('withinCollection')) {
831
- // Unless this query/search type update is from the initial page load or the
832
- // result of hitting the back button,
833
- // we need to clear any existing filters since they may no longer be valid for
834
- // the new set of search results.
835
- if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
836
- // Ordinarily, we leave the sort param unchanged between searches.
837
- // However, if we are changing the target collection itself, we want the sort cleared too,
838
- // since different collections may have different sorting options available.
839
- const shouldClearSort = changed.has('withinCollection') &&
840
- !changed.has('selectedSort') &&
841
- !changed.has('sortDirection');
842
- // Otherwise, only clear filters that haven't been simultaneously applied in this update
843
- this.clearFilters({
844
- sort: shouldClearSort,
845
- facets: !changed.has('selectedFacets'),
846
- dateRange: !(changed.has('minSelectedDate') || changed.has('maxSelectedDate')),
847
- letterFilters: !(changed.has('selectedTitleFilter') ||
848
- changed.has('selectedCreatorFilter')),
849
- });
850
- }
851
- }
852
- if (changed.has('profileElement')) {
853
- this.applyDefaultProfileSort();
854
- }
855
- if (changed.has('baseQuery')) {
856
- this.emitBaseQueryChanged();
857
- }
858
- if (changed.has('searchType')) {
859
- this.emitSearchTypeChanged();
860
- }
861
- if (changed.has('currentPage') || changed.has('displayMode')) {
862
- this.persistState();
863
- }
864
- if (changed.has('baseQuery') ||
865
- changed.has('minSelectedDate') ||
866
- changed.has('maxSelectedDate') ||
867
- changed.has('selectedFacets') ||
868
- changed.has('searchService') ||
869
- changed.has('withinCollection') ||
870
- changed.has('withinProfile') ||
871
- changed.has('profileElement')) {
872
- this.dataSource.refreshLetterCounts();
873
- }
874
- if (changed.has('selectedSort') || changed.has('sortDirection')) {
875
- const prevSortDirection = changed.get('sortDirection');
876
- this.sendSortByAnalytics(prevSortDirection);
877
- this.selectedSortChanged();
878
- }
879
- if (changed.has('selectedTitleFilter')) {
880
- this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
881
- }
882
- if (changed.has('selectedCreatorFilter')) {
883
- this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
884
- }
885
- if (changed.has('baseQuery') ||
886
- changed.has('searchType') ||
887
- changed.has('selectedTitleFilter') ||
888
- changed.has('selectedCreatorFilter') ||
889
- changed.has('minSelectedDate') ||
890
- changed.has('maxSelectedDate') ||
891
- changed.has('selectedSort') ||
892
- changed.has('sortDirection') ||
893
- changed.has('selectedFacets') ||
894
- changed.has('searchService') ||
895
- changed.has('withinCollection') ||
896
- changed.has('withinProfile') ||
897
- changed.has('profileElement')) {
898
- this.handleQueryChange();
899
- }
900
- if (changed.has('searchResultsLoading')) {
901
- this.emitSearchResultsLoadingChanged();
902
- }
903
- if (changed.has('facetsLoading') &&
904
- this.facetsLoading &&
905
- this.collectionFacets) {
906
- this.collectionFacets.moreLinksVisible =
907
- this.searchType !== SearchType.FULLTEXT;
908
- }
909
- if (changed.has('pagesToRender')) {
910
- if (!this.dataSource.endOfDataReached && this.infiniteScroller) {
911
- this.infiniteScroller.itemCount = this.estimatedTileCount;
912
- }
913
- }
914
- if (changed.has('isManageView')) {
915
- if (this.isManageView)
916
- this.displayMode = 'grid';
917
- (_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.refreshAllVisibleCells();
918
- this.emitManageModeChangedEvent();
919
- }
920
- if (changed.has('resizeObserver')) {
921
- const oldObserver = changed.get('resizeObserver');
922
- if (oldObserver)
923
- this.disconnectResizeObserver(oldObserver);
924
- this.setupResizeObserver();
925
- }
926
- }
927
- connectedCallback() {
928
- var _a;
929
- (_a = super.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
930
- this.setupStateRestorationObserver();
931
- this.setupResizeObserver();
932
- }
933
- disconnectedCallback() {
934
- var _a, _b;
935
- if (this.resizeObserver) {
936
- this.disconnectResizeObserver(this.resizeObserver);
937
- }
938
- if (this.boundNavigationHandler) {
939
- window.removeEventListener('popstate', this.boundNavigationHandler);
940
- }
941
- (_a = this.leftColIntersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
942
- (_b = this.facetsIntersectionObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
943
- window.removeEventListener('resize', this.updateLeftColumnHeight);
944
- }
945
- handleResize(entry) {
946
- const previousView = this.mobileView;
947
- if (entry.target === this.contentContainer) {
948
- this.contentWidth = entry.contentRect.width;
949
- this.mobileView =
950
- this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
951
- // If changing from desktop to mobile disable transition
952
- if (this.mobileView && !previousView) {
953
- this.isResizeToMobile = true;
954
- }
955
- }
956
- // Ensure the facet sidebar remains sized correctly
957
- this.updateLeftColumnHeight();
958
- }
959
- /**
960
- * Sets up listeners for events that may require updating the left column height.
961
- */
962
- setupLeftColumnScrollListeners() {
963
- var _a;
964
- // We observe intersections between the left column's scroll sentinel and
965
- // the viewport, so that we can ensure the left column is always sized to
966
- // match the _available_ viewport height. This should generally be more
967
- // performant than listening to scroll events on the page or column.
968
- const leftColumnSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#left-column-scroll-sentinel');
969
- if (leftColumnSentinel) {
970
- this.leftColIntersectionObserver = new IntersectionObserver(this.updateLeftColumnHeight, {
971
- threshold: [...Array(101).keys()].map(n => n / 100), // Threshold every 1%
972
- });
973
- this.leftColIntersectionObserver.observe(leftColumnSentinel);
974
- }
975
- // We also listen for window resize events, as they are not always captured
976
- // by the resize observer and can affect the desired height of the left column.
977
- window.addEventListener('resize', this.updateLeftColumnHeight);
978
- }
979
- /**
980
- * Sets up listeners to control whether the facet sidebar shows its bottom fade-out.
981
- * Note this uses a separate IntersectionObserver from the left column, because we
982
- * don't need granular intersection thresholds for this.
983
- */
984
- setupFacetsScrollListeners() {
985
- var _a;
986
- const facetsSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#facets-scroll-sentinel');
987
- if (facetsSentinel) {
988
- this.facetsIntersectionObserver = new IntersectionObserver(this.updateFacetFadeOut);
989
- this.facetsIntersectionObserver.observe(facetsSentinel);
990
- }
991
- }
992
- emitBaseQueryChanged() {
993
- this.dispatchEvent(new CustomEvent('baseQueryChanged', {
994
- detail: {
995
- baseQuery: this.baseQuery,
996
- },
997
- }));
998
- }
999
- emitSearchTypeChanged() {
1000
- this.dispatchEvent(new CustomEvent('searchTypeChanged', {
1001
- detail: this.searchType,
1002
- }));
1003
- }
1004
- emitQueryStateChanged() {
1005
- this.dispatchEvent(new CustomEvent('queryStateChanged', {
1006
- detail: {
1007
- baseQuery: this.baseQuery,
1008
- withinCollection: this.withinCollection,
1009
- withinProfile: this.withinProfile,
1010
- profileElement: this.profileElement,
1011
- searchType: this.searchType,
1012
- selectedFacets: this.selectedFacets,
1013
- minSelectedDate: this.minSelectedDate,
1014
- maxSelectedDate: this.maxSelectedDate,
1015
- selectedSort: this.selectedSort,
1016
- sortDirection: this.sortDirection,
1017
- selectedTitleFilter: this.selectedTitleFilter,
1018
- selectedCreatorFilter: this.selectedCreatorFilter,
1019
- },
1020
- }));
1021
- }
1022
- emitEmptyResults() {
1023
- this.dispatchEvent(new Event('emptyResults'));
1024
- }
1025
- disconnectResizeObserver(resizeObserver) {
1026
- resizeObserver.removeObserver({
1027
- target: this.contentContainer,
1028
- handler: this,
1029
- });
1030
- }
1031
- setupResizeObserver() {
1032
- if (!this.resizeObserver || !this.contentContainer)
1033
- return;
1034
- this.resizeObserver.addObserver({
1035
- target: this.contentContainer,
1036
- handler: this,
1037
- });
1038
- }
1039
- /**
1040
- * When the visible cells change from the infinite scroller, we want to emit
1041
- * which page is currently visible so the consumer can update its UI or the URL
1042
- *
1043
- * @param e
1044
- * @returns
1045
- */
1046
- visibleCellsChanged(e) {
1047
- if (this.isScrollingToCell)
1048
- return;
1049
- const { visibleCellIndices } = e.detail;
1050
- if (visibleCellIndices.length === 0)
1051
- return;
1052
- const lastVisibleCellIndex = visibleCellIndices[visibleCellIndices.length - 1];
1053
- const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
1054
- if (this.currentPage !== lastVisibleCellPage) {
1055
- this.currentPage = lastVisibleCellPage;
1056
- }
1057
- const event = new CustomEvent('visiblePageChanged', {
1058
- detail: {
1059
- pageNumber: lastVisibleCellPage,
1060
- },
1061
- });
1062
- this.dispatchEvent(event);
1063
- }
1064
- /**
1065
- * A Promise which, after each query change, resolves once the fetches for the initial
1066
- * search have completed. Waits for *both* the hits and aggregations fetches to finish.
1067
- *
1068
- * Ensure you await this component's `updateComplete` promise before awaiting this
1069
- * one, to ensure you do not await an obsolete promise from the previous update.
1070
- */
1071
- get initialSearchComplete() {
1072
- return this.dataSource.initialSearchComplete;
1073
- }
1074
- async handleQueryChange() {
1075
- var _a;
1076
- // only reset if the query has actually changed
1077
- if (!this.searchService ||
1078
- this.dataSource.pageFetchQueryKey === this.previousQueryKey)
1079
- return;
1080
- // If the new state prevents us from updating the search results, don't reset
1081
- if (!this.dataSource.canPerformSearch &&
1082
- !(this.clearResultsOnEmptyQuery && this.baseQuery === ''))
1083
- return;
1084
- this.previousQueryKey = this.dataSource.pageFetchQueryKey;
1085
- // this.emitQueryStateChanged();
1086
- this.tileModelOffset = 0;
1087
- this.totalResults = undefined;
1088
- this.pagesToRender =
1089
- this.initialPageNumber === 1
1090
- ? 2 // First two pages are batched into one request when starting from page 1
1091
- : this.initialPageNumber;
1092
- // Reset the infinite scroller's item count, so that it
1093
- // shows tile placeholders until the new query's results load in
1094
- if (this.infiniteScroller) {
1095
- this.infiniteScroller.itemCount = this.estimatedTileCount;
1096
- this.infiniteScroller.reload();
1097
- }
1098
- if (this.withinCollection && ((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim())) {
1099
- this.defaultSortField = SortField.relevance;
1100
- this.defaultSortDirection = null;
1101
- }
1102
- if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {
1103
- this.scrollToPage(this.initialPageNumber);
1104
- }
1105
- this.initialQueryChangeHappened = true;
1106
- // if the query changed as part of a window.history pop event, we don't want to
1107
- // persist the state because it overwrites the forward history
1108
- if (!this.historyPopOccurred) {
1109
- this.persistState();
1110
- }
1111
- this.historyPopOccurred = false;
1112
- // Fire the initial page and facets requests
1113
- // await this.dataSource.handleQueryChange();
1114
- }
1115
- setupStateRestorationObserver() {
1116
- if (!this.boundNavigationHandler) {
1117
- this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
1118
- }
1119
- // when the user navigates back, we want to update the UI to match the URL
1120
- window.addEventListener('popstate', this.boundNavigationHandler);
1121
- }
1122
- historyNavigationHandler() {
1123
- this.historyPopOccurred = true;
1124
- this.restoreState();
1125
- }
1126
- restoreState() {
1127
- var _a, _b, _c, _d, _e;
1128
- const restorationState = this.restorationStateHandler.getRestorationState();
1129
- this.displayMode = restorationState.displayMode;
1130
- if (restorationState.searchType != null)
1131
- this.searchType = restorationState.searchType;
1132
- this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.default;
1133
- this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
1134
- this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
1135
- this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
1136
- this.selectedFacets = restorationState.selectedFacets;
1137
- if (!this.suppressURLQuery)
1138
- this.baseQuery = restorationState.baseQuery;
1139
- this.currentPage = (_e = restorationState.currentPage) !== null && _e !== void 0 ? _e : 1;
1140
- this.minSelectedDate = restorationState.minSelectedDate;
1141
- this.maxSelectedDate = restorationState.maxSelectedDate;
1142
- if (this.currentPage > 1) {
1143
- this.goToPage(this.currentPage);
1144
- }
1145
- }
1146
- persistState() {
1147
- var _a, _b, _c, _d;
1148
- const restorationState = {
1149
- displayMode: this.displayMode,
1150
- searchType: this.searchType,
1151
- selectedSort: this.selectedSort,
1152
- sortDirection: (_a = this.sortDirection) !== null && _a !== void 0 ? _a : undefined,
1153
- selectedFacets: (_b = this.selectedFacets) !== null && _b !== void 0 ? _b : getDefaultSelectedFacets(),
1154
- baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,
1155
- currentPage: this.currentPage,
1156
- titleQuery: this.titleQuery,
1157
- creatorQuery: this.creatorQuery,
1158
- minSelectedDate: this.minSelectedDate,
1159
- maxSelectedDate: this.maxSelectedDate,
1160
- selectedTitleFilter: (_c = this.selectedTitleFilter) !== null && _c !== void 0 ? _c : undefined,
1161
- selectedCreatorFilter: (_d = this.selectedCreatorFilter) !== null && _d !== void 0 ? _d : undefined,
1162
- };
1163
- this.restorationStateHandler.persistState(restorationState, this.dataSourceInstallInProgress);
1164
- }
1165
- emitSearchResultsLoadingChanged() {
1166
- this.dispatchEvent(new CustomEvent('searchResultsLoadingChanged', {
1167
- detail: {
1168
- loading: this.searchResultsLoading,
1169
- },
1170
- }));
1171
- }
1172
- facetsChanged(e) {
1173
- this.selectedFacets = e.detail;
1174
- }
1175
- facetClickHandler({ detail: { facetType, bucket, negative }, }) {
1176
- var _a;
1177
- let action;
1178
- if (negative) {
1179
- action =
1180
- bucket.state !== 'none'
1181
- ? analyticsActions.facetNegativeSelected
1182
- : analyticsActions.facetNegativeDeselected;
1183
- }
1184
- else {
1185
- action =
1186
- bucket.state !== 'none'
1187
- ? analyticsActions.facetSelected
1188
- : analyticsActions.facetDeselected;
1189
- }
1190
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
1191
- category: this.searchContext,
1192
- action,
1193
- label: facetType,
1194
- });
1195
- }
1196
- scrollToPage(pageNumber) {
1197
- return new Promise(resolve => {
1198
- const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
1199
- // without this setTimeout, Safari just pauses until the `fetchPage` is complete
1200
- // then scrolls to the cell
1201
- setTimeout(() => {
1202
- var _a;
1203
- this.isScrollingToCell = true;
1204
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
1205
- // This timeout is to give the scroll animation time to finish
1206
- // then updating the infinite scroller once we're done scrolling
1207
- // There's no scroll animation completion callback so we're
1208
- // giving it 0.5s to finish.
1209
- setTimeout(() => {
1210
- var _a;
1211
- this.isScrollingToCell = false;
1212
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1213
- resolve();
1214
- }, 500);
1215
- }, 0);
1216
- });
1217
- }
1218
- /**
1219
- * Whether sorting by relevance makes sense for the current state.
1220
- * Currently equivalent to having a non-empty query.
1221
- */
1222
- get isRelevanceSortAvailable() {
1223
- var _a;
1224
- return !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
1225
- }
1226
- /**
1227
- * Sets the total number of tiles displayed in the infinite scroller.
1228
- */
1229
- setTileCount(count) {
1230
- if (this.infiniteScroller) {
1231
- this.infiniteScroller.itemCount = count;
1232
- }
1233
- }
1234
- /**
1235
- * Applies any default sort option for the current collection, by checking
1236
- * for one in the collection's metadata. If none is found, defaults to sorting
1237
- * descending by:
1238
- * - Date Favorited for fav-* collections
1239
- * - Weekly views for all other collections
1240
- */
1241
- applyDefaultCollectionSort(collectionInfo) {
1242
- var _a, _b, _c;
1243
- if (this.baseQuery) {
1244
- // If there's a query set, then we default to relevance sorting regardless of
1245
- // the collection metadata-specified sort.
1246
- this.defaultSortField = SortField.relevance;
1247
- this.defaultSortDirection = null;
1248
- return;
1249
- }
1250
- // Favorite collections sort on Date Favorited by default.
1251
- // Other collections fall back to sorting on weekly views.
1252
- const baseDefaultSort = ((_b = (_a = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _a === void 0 ? void 0 : _a.identifier) === null || _b === void 0 ? void 0 : _b.startsWith('fav-'))
1253
- ? '-favoritedate'
1254
- : '-week';
1255
- // The collection metadata may override the default sorting with something else
1256
- const metadataSort = (_c = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _c === void 0 ? void 0 : _c['sort-by'];
1257
- // Prefer the metadata-specified sort if one exists
1258
- const defaultSortToApply = metadataSort !== null && metadataSort !== void 0 ? metadataSort : baseDefaultSort;
1259
- // Account for both -field and field:dir formats
1260
- let [field, dir] = defaultSortToApply.split(':');
1261
- if (field.startsWith('-')) {
1262
- field = field.slice(1);
1263
- dir = 'desc';
1264
- }
1265
- else if (!['asc', 'desc'].includes(dir)) {
1266
- dir = 'asc';
1267
- }
1268
- const sortOption = sortOptionFromAPIString(field);
1269
- const sortField = sortOption.field;
1270
- if (sortField && sortField !== SortField.default) {
1271
- this.defaultSortField = sortField;
1272
- this.defaultSortDirection = dir;
1273
- this.defaultSortParam = {
1274
- field: this.defaultSortField,
1275
- direction: this.defaultSortDirection,
1276
- };
1277
- }
1278
- }
1279
- /**
1280
- * Applies the default sort option for the current profile element
1281
- */
1282
- applyDefaultProfileSort() {
1283
- if (this.profileElement) {
1284
- const defaultSortField = defaultProfileElementSorts[this.profileElement];
1285
- this.defaultSortField = defaultSortField !== null && defaultSortField !== void 0 ? defaultSortField : SortField.weeklyview;
1286
- }
1287
- else {
1288
- this.defaultSortField = SortField.weeklyview;
1289
- }
1290
- this.defaultSortDirection = 'desc';
1291
- this.defaultSortParam = {
1292
- field: this.defaultSortField,
1293
- direction: this.defaultSortDirection,
1294
- };
1295
- }
1296
- /**
1297
- * This is useful for determining whether we need to reload the scroller.
1298
- *
1299
- * When the fetch completes, we need to reload the scroller if the cells for that
1300
- * page are visible, but if the page is not currenlty visible, we don't need to reload
1301
- */
1302
- get currentVisiblePageNumbers() {
1303
- var _a, _b;
1304
- const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
1305
- const visiblePages = new Set();
1306
- visibleCells.forEach(cellIndex => {
1307
- const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
1308
- visiblePages.add(visiblePage);
1309
- });
1310
- return Array.from(visiblePages);
1311
- }
1312
- /**
1313
- * Refreshes all visible result cells in the infinite scroller.
1314
- */
1315
- refreshVisibleResults() {
1316
- var _a;
1317
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1318
- }
1319
- /**
1320
- * Callback when a result is selected
1321
- */
1322
- resultSelected(event) {
1323
- var _a, _b, _c;
1324
- if (this.isManageView) {
1325
- // Checked/unchecked state change -- rerender to ensure it propagates
1326
- // this.mapDataSource(model => ({ ...model }));
1327
- const cellIndex = this.dataSource.indexOf(event.detail);
1328
- if (cellIndex >= 0)
1329
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshCell(cellIndex);
1330
- }
1331
- (_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
1332
- category: this.searchContext,
1333
- action: analyticsActions.resultSelected,
1334
- label: event.detail.mediatype,
1335
- });
1336
- (_c = this.analyticsHandler) === null || _c === void 0 ? void 0 : _c.sendEvent({
1337
- category: this.searchContext,
1338
- action: analyticsActions.resultSelected,
1339
- label: `page-${this.currentPage}`,
1340
- });
1341
- }
1342
- cellForIndex(index) {
1343
- const model = this.tileModelAtCellIndex(index);
1344
- if (!model)
1345
- return undefined;
752
+ `;
753
+ }
754
+ histogramDateRangeUpdated(e) {
755
+ var _a;
756
+ const { minDate, maxDate } = e.detail;
757
+ [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
758
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
759
+ category: this.searchContext,
760
+ action: analyticsActions.histogramChanged,
761
+ label: this.dateRangeQueryClause,
762
+ });
763
+ }
764
+ get dateRangeQueryClause() {
765
+ if (!this.minSelectedDate || !this.maxSelectedDate) {
766
+ return undefined;
767
+ }
768
+ return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;
769
+ }
770
+ /**
771
+ * Emits an event indicating a change in whether the manage mode is shown.
772
+ */
773
+ emitManageModeChangedEvent() {
774
+ this.dispatchEvent(new CustomEvent('manageModeChanged', {
775
+ detail: this.isManageView,
776
+ }));
777
+ }
778
+ async installDataSourceAndQueryState(dataSource, queryState) {
779
+ var _a, _b;
780
+ log('Installing data source & query state in CB:', dataSource, queryState);
781
+ if (this.dataSource)
782
+ this.removeController(this.dataSource);
783
+ this.dataSource = dataSource;
784
+ this.addController(this.dataSource);
785
+ this.baseQuery = queryState.baseQuery;
786
+ this.profileElement = queryState.profileElement;
787
+ this.searchType = queryState.searchType;
788
+ this.selectedFacets =
789
+ (_a = queryState.selectedFacets) !== null && _a !== void 0 ? _a : getDefaultSelectedFacets();
790
+ this.minSelectedDate = queryState.minSelectedDate;
791
+ this.maxSelectedDate = queryState.maxSelectedDate;
792
+ this.selectedSort = (_b = queryState.selectedSort) !== null && _b !== void 0 ? _b : SortField.default;
793
+ this.sortDirection = queryState.sortDirection;
794
+ this.selectedTitleFilter = queryState.selectedTitleFilter;
795
+ this.selectedCreatorFilter = queryState.selectedCreatorFilter;
796
+ // We set this flag during the update to prevent the URL state persistence
797
+ // from creating an unwanted extra history entry.
798
+ this.dataSourceInstallInProgress = true;
799
+ this.requestUpdate();
800
+ await this.updateComplete;
801
+ this.dataSourceInstallInProgress = false;
802
+ if (!this.searchResultsLoading) {
803
+ this.setTotalResultCount(this.dataSource.totalResults);
804
+ this.setTileCount(this.dataSource.size);
805
+ }
806
+ this.refreshVisibleResults();
807
+ }
808
+ firstUpdated() {
809
+ this.restoreState();
810
+ }
811
+ updated(changed) {
812
+ var _a, _b;
813
+ if (changed.has('placeholderType') && this.placeholderType === null) {
814
+ if (!this.leftColIntersectionObserver) {
815
+ this.setupLeftColumnScrollListeners();
816
+ }
817
+ if (!this.facetsIntersectionObserver) {
818
+ this.setupFacetsScrollListeners();
819
+ }
820
+ this.updateLeftColumnHeight();
821
+ }
822
+ if (changed.has('displayMode') ||
823
+ changed.has('baseNavigationUrl') ||
824
+ changed.has('baseImageUrl') ||
825
+ changed.has('loggedIn')) {
826
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
827
+ }
828
+ if (changed.has('baseQuery') ||
829
+ changed.has('searchType') ||
830
+ changed.has('withinCollection')) {
831
+ // Unless this query/search type update is from the initial page load or the
832
+ // result of hitting the back button,
833
+ // we need to clear any existing filters since they may no longer be valid for
834
+ // the new set of search results.
835
+ if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
836
+ // Ordinarily, we leave the sort param unchanged between searches.
837
+ // However, if we are changing the target collection itself, we want the sort cleared too,
838
+ // since different collections may have different sorting options available.
839
+ const shouldClearSort = changed.has('withinCollection') &&
840
+ !changed.has('selectedSort') &&
841
+ !changed.has('sortDirection');
842
+ // Otherwise, only clear filters that haven't been simultaneously applied in this update
843
+ this.clearFilters({
844
+ sort: shouldClearSort,
845
+ facets: !changed.has('selectedFacets'),
846
+ dateRange: !(changed.has('minSelectedDate') || changed.has('maxSelectedDate')),
847
+ letterFilters: !(changed.has('selectedTitleFilter') ||
848
+ changed.has('selectedCreatorFilter')),
849
+ });
850
+ }
851
+ }
852
+ if (changed.has('profileElement')) {
853
+ this.applyDefaultProfileSort();
854
+ }
855
+ if (changed.has('baseQuery')) {
856
+ this.emitBaseQueryChanged();
857
+ }
858
+ if (changed.has('searchType')) {
859
+ this.emitSearchTypeChanged();
860
+ }
861
+ if (changed.has('currentPage') || changed.has('displayMode')) {
862
+ this.persistState();
863
+ }
864
+ if (changed.has('baseQuery') ||
865
+ changed.has('minSelectedDate') ||
866
+ changed.has('maxSelectedDate') ||
867
+ changed.has('selectedFacets') ||
868
+ changed.has('searchService') ||
869
+ changed.has('withinCollection') ||
870
+ changed.has('withinProfile') ||
871
+ changed.has('profileElement')) {
872
+ this.dataSource.refreshLetterCounts();
873
+ }
874
+ if (changed.has('selectedSort') || changed.has('sortDirection')) {
875
+ const prevSortDirection = changed.get('sortDirection');
876
+ this.sendSortByAnalytics(prevSortDirection);
877
+ this.selectedSortChanged();
878
+ }
879
+ if (changed.has('selectedTitleFilter')) {
880
+ this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
881
+ }
882
+ if (changed.has('selectedCreatorFilter')) {
883
+ this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
884
+ }
885
+ if (changed.has('baseQuery') ||
886
+ changed.has('searchType') ||
887
+ changed.has('selectedTitleFilter') ||
888
+ changed.has('selectedCreatorFilter') ||
889
+ changed.has('minSelectedDate') ||
890
+ changed.has('maxSelectedDate') ||
891
+ changed.has('selectedSort') ||
892
+ changed.has('sortDirection') ||
893
+ changed.has('selectedFacets') ||
894
+ changed.has('searchService') ||
895
+ changed.has('withinCollection') ||
896
+ changed.has('withinProfile') ||
897
+ changed.has('profileElement')) {
898
+ this.handleQueryChange();
899
+ }
900
+ if (changed.has('searchResultsLoading')) {
901
+ this.emitSearchResultsLoadingChanged();
902
+ }
903
+ if (changed.has('facetsLoading') &&
904
+ this.facetsLoading &&
905
+ this.collectionFacets) {
906
+ this.collectionFacets.moreLinksVisible =
907
+ this.searchType !== SearchType.FULLTEXT;
908
+ }
909
+ if (changed.has('pagesToRender')) {
910
+ if (!this.dataSource.endOfDataReached && this.infiniteScroller) {
911
+ this.infiniteScroller.itemCount = this.estimatedTileCount;
912
+ }
913
+ }
914
+ if (changed.has('isManageView')) {
915
+ if (this.isManageView)
916
+ this.displayMode = 'grid';
917
+ (_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.refreshAllVisibleCells();
918
+ this.emitManageModeChangedEvent();
919
+ }
920
+ if (changed.has('resizeObserver')) {
921
+ const oldObserver = changed.get('resizeObserver');
922
+ if (oldObserver)
923
+ this.disconnectResizeObserver(oldObserver);
924
+ this.setupResizeObserver();
925
+ }
926
+ }
927
+ connectedCallback() {
928
+ var _a;
929
+ (_a = super.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
930
+ this.setupStateRestorationObserver();
931
+ }
932
+ disconnectedCallback() {
933
+ var _a, _b;
934
+ if (this.resizeObserver) {
935
+ this.disconnectResizeObserver(this.resizeObserver);
936
+ }
937
+ if (this.boundNavigationHandler) {
938
+ window.removeEventListener('popstate', this.boundNavigationHandler);
939
+ }
940
+ (_a = this.leftColIntersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
941
+ (_b = this.facetsIntersectionObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
942
+ window.removeEventListener('resize', this.updateLeftColumnHeight);
943
+ }
944
+ handleResize(entry) {
945
+ const previousView = this.mobileView;
946
+ if (entry.target === this.contentContainer) {
947
+ this.contentWidth = entry.contentRect.width;
948
+ this.mobileView =
949
+ this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
950
+ // If changing from desktop to mobile disable transition
951
+ if (this.mobileView && !previousView) {
952
+ this.isResizeToMobile = true;
953
+ }
954
+ }
955
+ // Ensure the facet sidebar remains sized correctly
956
+ this.updateLeftColumnHeight();
957
+ }
958
+ /**
959
+ * Sets up listeners for events that may require updating the left column height.
960
+ */
961
+ setupLeftColumnScrollListeners() {
962
+ var _a;
963
+ // We observe intersections between the left column's scroll sentinel and
964
+ // the viewport, so that we can ensure the left column is always sized to
965
+ // match the _available_ viewport height. This should generally be more
966
+ // performant than listening to scroll events on the page or column.
967
+ const leftColumnSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#left-column-scroll-sentinel');
968
+ if (leftColumnSentinel) {
969
+ this.leftColIntersectionObserver = new IntersectionObserver(this.updateLeftColumnHeight, {
970
+ threshold: [...Array(101).keys()].map(n => n / 100), // Threshold every 1%
971
+ });
972
+ this.leftColIntersectionObserver.observe(leftColumnSentinel);
973
+ }
974
+ // We also listen for window resize events, as they are not always captured
975
+ // by the resize observer and can affect the desired height of the left column.
976
+ window.addEventListener('resize', this.updateLeftColumnHeight);
977
+ }
978
+ /**
979
+ * Sets up listeners to control whether the facet sidebar shows its bottom fade-out.
980
+ * Note this uses a separate IntersectionObserver from the left column, because we
981
+ * don't need granular intersection thresholds for this.
982
+ */
983
+ setupFacetsScrollListeners() {
984
+ var _a;
985
+ const facetsSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#facets-scroll-sentinel');
986
+ if (facetsSentinel) {
987
+ this.facetsIntersectionObserver = new IntersectionObserver(this.updateFacetFadeOut);
988
+ this.facetsIntersectionObserver.observe(facetsSentinel);
989
+ }
990
+ }
991
+ emitBaseQueryChanged() {
992
+ this.dispatchEvent(new CustomEvent('baseQueryChanged', {
993
+ detail: {
994
+ baseQuery: this.baseQuery,
995
+ },
996
+ }));
997
+ }
998
+ emitSearchTypeChanged() {
999
+ this.dispatchEvent(new CustomEvent('searchTypeChanged', {
1000
+ detail: this.searchType,
1001
+ }));
1002
+ }
1003
+ emitQueryStateChanged() {
1004
+ this.dispatchEvent(new CustomEvent('queryStateChanged', {
1005
+ detail: {
1006
+ baseQuery: this.baseQuery,
1007
+ withinCollection: this.withinCollection,
1008
+ withinProfile: this.withinProfile,
1009
+ profileElement: this.profileElement,
1010
+ searchType: this.searchType,
1011
+ selectedFacets: this.selectedFacets,
1012
+ minSelectedDate: this.minSelectedDate,
1013
+ maxSelectedDate: this.maxSelectedDate,
1014
+ selectedSort: this.selectedSort,
1015
+ sortDirection: this.sortDirection,
1016
+ selectedTitleFilter: this.selectedTitleFilter,
1017
+ selectedCreatorFilter: this.selectedCreatorFilter,
1018
+ },
1019
+ }));
1020
+ }
1021
+ emitEmptyResults() {
1022
+ this.dispatchEvent(new Event('emptyResults'));
1023
+ }
1024
+ disconnectResizeObserver(resizeObserver) {
1025
+ resizeObserver.removeObserver({
1026
+ target: this.contentContainer,
1027
+ handler: this,
1028
+ });
1029
+ }
1030
+ setupResizeObserver() {
1031
+ if (!this.resizeObserver)
1032
+ return;
1033
+ this.resizeObserver.addObserver({
1034
+ target: this.contentContainer,
1035
+ handler: this,
1036
+ });
1037
+ }
1038
+ /**
1039
+ * When the visible cells change from the infinite scroller, we want to emit
1040
+ * which page is currently visible so the consumer can update its UI or the URL
1041
+ *
1042
+ * @param e
1043
+ * @returns
1044
+ */
1045
+ visibleCellsChanged(e) {
1046
+ if (this.isScrollingToCell)
1047
+ return;
1048
+ const { visibleCellIndices } = e.detail;
1049
+ if (visibleCellIndices.length === 0)
1050
+ return;
1051
+ const lastVisibleCellIndex = visibleCellIndices[visibleCellIndices.length - 1];
1052
+ const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
1053
+ if (this.currentPage !== lastVisibleCellPage) {
1054
+ this.currentPage = lastVisibleCellPage;
1055
+ }
1056
+ const event = new CustomEvent('visiblePageChanged', {
1057
+ detail: {
1058
+ pageNumber: lastVisibleCellPage,
1059
+ },
1060
+ });
1061
+ this.dispatchEvent(event);
1062
+ }
1063
+ /**
1064
+ * A Promise which, after each query change, resolves once the fetches for the initial
1065
+ * search have completed. Waits for *both* the hits and aggregations fetches to finish.
1066
+ *
1067
+ * Ensure you await this component's `updateComplete` promise before awaiting this
1068
+ * one, to ensure you do not await an obsolete promise from the previous update.
1069
+ */
1070
+ get initialSearchComplete() {
1071
+ return this.dataSource.initialSearchComplete;
1072
+ }
1073
+ async handleQueryChange() {
1074
+ var _a;
1075
+ // only reset if the query has actually changed
1076
+ if (!this.searchService ||
1077
+ this.dataSource.pageFetchQueryKey === this.previousQueryKey)
1078
+ return;
1079
+ // If the new state prevents us from updating the search results, don't reset
1080
+ if (!this.dataSource.canPerformSearch &&
1081
+ !(this.clearResultsOnEmptyQuery && this.baseQuery === ''))
1082
+ return;
1083
+ this.previousQueryKey = this.dataSource.pageFetchQueryKey;
1084
+ // this.emitQueryStateChanged();
1085
+ this.tileModelOffset = 0;
1086
+ this.totalResults = undefined;
1087
+ this.pagesToRender =
1088
+ this.initialPageNumber === 1
1089
+ ? 2 // First two pages are batched into one request when starting from page 1
1090
+ : this.initialPageNumber;
1091
+ // Reset the infinite scroller's item count, so that it
1092
+ // shows tile placeholders until the new query's results load in
1093
+ if (this.infiniteScroller) {
1094
+ this.infiniteScroller.itemCount = this.estimatedTileCount;
1095
+ this.infiniteScroller.reload();
1096
+ }
1097
+ if (this.withinCollection && ((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim())) {
1098
+ this.defaultSortField = SortField.relevance;
1099
+ this.defaultSortDirection = null;
1100
+ }
1101
+ if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {
1102
+ this.scrollToPage(this.initialPageNumber);
1103
+ }
1104
+ this.initialQueryChangeHappened = true;
1105
+ // if the query changed as part of a window.history pop event, we don't want to
1106
+ // persist the state because it overwrites the forward history
1107
+ if (!this.historyPopOccurred) {
1108
+ this.persistState();
1109
+ }
1110
+ this.historyPopOccurred = false;
1111
+ // Fire the initial page and facets requests
1112
+ // await this.dataSource.handleQueryChange();
1113
+ }
1114
+ setupStateRestorationObserver() {
1115
+ if (!this.boundNavigationHandler) {
1116
+ this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
1117
+ }
1118
+ // when the user navigates back, we want to update the UI to match the URL
1119
+ window.addEventListener('popstate', this.boundNavigationHandler);
1120
+ }
1121
+ historyNavigationHandler() {
1122
+ this.historyPopOccurred = true;
1123
+ this.restoreState();
1124
+ }
1125
+ restoreState() {
1126
+ var _a, _b, _c, _d, _e;
1127
+ const restorationState = this.restorationStateHandler.getRestorationState();
1128
+ this.displayMode = restorationState.displayMode;
1129
+ if (restorationState.searchType != null)
1130
+ this.searchType = restorationState.searchType;
1131
+ this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.default;
1132
+ this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
1133
+ this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
1134
+ this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
1135
+ this.selectedFacets = restorationState.selectedFacets;
1136
+ if (!this.suppressURLQuery)
1137
+ this.baseQuery = restorationState.baseQuery;
1138
+ this.currentPage = (_e = restorationState.currentPage) !== null && _e !== void 0 ? _e : 1;
1139
+ this.minSelectedDate = restorationState.minSelectedDate;
1140
+ this.maxSelectedDate = restorationState.maxSelectedDate;
1141
+ if (this.currentPage > 1) {
1142
+ this.goToPage(this.currentPage);
1143
+ }
1144
+ }
1145
+ persistState() {
1146
+ var _a, _b, _c, _d;
1147
+ const restorationState = {
1148
+ displayMode: this.displayMode,
1149
+ searchType: this.searchType,
1150
+ selectedSort: this.selectedSort,
1151
+ sortDirection: (_a = this.sortDirection) !== null && _a !== void 0 ? _a : undefined,
1152
+ selectedFacets: (_b = this.selectedFacets) !== null && _b !== void 0 ? _b : getDefaultSelectedFacets(),
1153
+ baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,
1154
+ currentPage: this.currentPage,
1155
+ titleQuery: this.titleQuery,
1156
+ creatorQuery: this.creatorQuery,
1157
+ minSelectedDate: this.minSelectedDate,
1158
+ maxSelectedDate: this.maxSelectedDate,
1159
+ selectedTitleFilter: (_c = this.selectedTitleFilter) !== null && _c !== void 0 ? _c : undefined,
1160
+ selectedCreatorFilter: (_d = this.selectedCreatorFilter) !== null && _d !== void 0 ? _d : undefined,
1161
+ };
1162
+ this.restorationStateHandler.persistState(restorationState, this.dataSourceInstallInProgress);
1163
+ }
1164
+ emitSearchResultsLoadingChanged() {
1165
+ this.dispatchEvent(new CustomEvent('searchResultsLoadingChanged', {
1166
+ detail: {
1167
+ loading: this.searchResultsLoading,
1168
+ },
1169
+ }));
1170
+ }
1171
+ facetsChanged(e) {
1172
+ this.selectedFacets = e.detail;
1173
+ }
1174
+ facetClickHandler({ detail: { facetType, bucket, negative }, }) {
1175
+ var _a;
1176
+ let action;
1177
+ if (negative) {
1178
+ action =
1179
+ bucket.state !== 'none'
1180
+ ? analyticsActions.facetNegativeSelected
1181
+ : analyticsActions.facetNegativeDeselected;
1182
+ }
1183
+ else {
1184
+ action =
1185
+ bucket.state !== 'none'
1186
+ ? analyticsActions.facetSelected
1187
+ : analyticsActions.facetDeselected;
1188
+ }
1189
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
1190
+ category: this.searchContext,
1191
+ action,
1192
+ label: facetType,
1193
+ });
1194
+ }
1195
+ scrollToPage(pageNumber) {
1196
+ return new Promise(resolve => {
1197
+ const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
1198
+ // without this setTimeout, Safari just pauses until the `fetchPage` is complete
1199
+ // then scrolls to the cell
1200
+ setTimeout(() => {
1201
+ var _a;
1202
+ this.isScrollingToCell = true;
1203
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
1204
+ // This timeout is to give the scroll animation time to finish
1205
+ // then updating the infinite scroller once we're done scrolling
1206
+ // There's no scroll animation completion callback so we're
1207
+ // giving it 0.5s to finish.
1208
+ setTimeout(() => {
1209
+ var _a;
1210
+ this.isScrollingToCell = false;
1211
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1212
+ resolve();
1213
+ }, 500);
1214
+ }, 0);
1215
+ });
1216
+ }
1217
+ /**
1218
+ * Whether sorting by relevance makes sense for the current state.
1219
+ * Currently equivalent to having a non-empty query.
1220
+ */
1221
+ get isRelevanceSortAvailable() {
1222
+ var _a;
1223
+ return !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
1224
+ }
1225
+ /**
1226
+ * Sets the total number of tiles displayed in the infinite scroller.
1227
+ */
1228
+ setTileCount(count) {
1229
+ if (this.infiniteScroller) {
1230
+ this.infiniteScroller.itemCount = count;
1231
+ }
1232
+ }
1233
+ /**
1234
+ * Applies any default sort option for the current collection, by checking
1235
+ * for one in the collection's metadata. If none is found, defaults to sorting
1236
+ * descending by:
1237
+ * - Date Favorited for fav-* collections
1238
+ * - Weekly views for all other collections
1239
+ */
1240
+ applyDefaultCollectionSort(collectionInfo) {
1241
+ var _a, _b, _c;
1242
+ if (this.baseQuery) {
1243
+ // If there's a query set, then we default to relevance sorting regardless of
1244
+ // the collection metadata-specified sort.
1245
+ this.defaultSortField = SortField.relevance;
1246
+ this.defaultSortDirection = null;
1247
+ return;
1248
+ }
1249
+ // Favorite collections sort on Date Favorited by default.
1250
+ // Other collections fall back to sorting on weekly views.
1251
+ const baseDefaultSort = ((_b = (_a = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _a === void 0 ? void 0 : _a.identifier) === null || _b === void 0 ? void 0 : _b.startsWith('fav-'))
1252
+ ? '-favoritedate'
1253
+ : '-week';
1254
+ // The collection metadata may override the default sorting with something else
1255
+ const metadataSort = (_c = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _c === void 0 ? void 0 : _c['sort-by'];
1256
+ // Prefer the metadata-specified sort if one exists
1257
+ const defaultSortToApply = metadataSort !== null && metadataSort !== void 0 ? metadataSort : baseDefaultSort;
1258
+ // Account for both -field and field:dir formats
1259
+ let [field, dir] = defaultSortToApply.split(':');
1260
+ if (field.startsWith('-')) {
1261
+ field = field.slice(1);
1262
+ dir = 'desc';
1263
+ }
1264
+ else if (!['asc', 'desc'].includes(dir)) {
1265
+ dir = 'asc';
1266
+ }
1267
+ const sortOption = sortOptionFromAPIString(field);
1268
+ const sortField = sortOption.field;
1269
+ if (sortField && sortField !== SortField.default) {
1270
+ this.defaultSortField = sortField;
1271
+ this.defaultSortDirection = dir;
1272
+ this.defaultSortParam = {
1273
+ field: this.defaultSortField,
1274
+ direction: this.defaultSortDirection,
1275
+ };
1276
+ }
1277
+ }
1278
+ /**
1279
+ * Applies the default sort option for the current profile element
1280
+ */
1281
+ applyDefaultProfileSort() {
1282
+ if (this.profileElement) {
1283
+ const defaultSortField = defaultProfileElementSorts[this.profileElement];
1284
+ this.defaultSortField = defaultSortField !== null && defaultSortField !== void 0 ? defaultSortField : SortField.weeklyview;
1285
+ }
1286
+ else {
1287
+ this.defaultSortField = SortField.weeklyview;
1288
+ }
1289
+ this.defaultSortDirection = 'desc';
1290
+ this.defaultSortParam = {
1291
+ field: this.defaultSortField,
1292
+ direction: this.defaultSortDirection,
1293
+ };
1294
+ }
1295
+ /**
1296
+ * This is useful for determining whether we need to reload the scroller.
1297
+ *
1298
+ * When the fetch completes, we need to reload the scroller if the cells for that
1299
+ * page are visible, but if the page is not currenlty visible, we don't need to reload
1300
+ */
1301
+ get currentVisiblePageNumbers() {
1302
+ var _a, _b;
1303
+ const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
1304
+ const visiblePages = new Set();
1305
+ visibleCells.forEach(cellIndex => {
1306
+ const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
1307
+ visiblePages.add(visiblePage);
1308
+ });
1309
+ return Array.from(visiblePages);
1310
+ }
1311
+ /**
1312
+ * Refreshes all visible result cells in the infinite scroller.
1313
+ */
1314
+ refreshVisibleResults() {
1315
+ var _a;
1316
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1317
+ }
1318
+ /**
1319
+ * Callback when a result is selected
1320
+ */
1321
+ resultSelected(event) {
1322
+ var _a, _b, _c;
1323
+ if (this.isManageView) {
1324
+ // Checked/unchecked state change -- rerender to ensure it propagates
1325
+ // this.mapDataSource(model => ({ ...model }));
1326
+ const cellIndex = this.dataSource.indexOf(event.detail);
1327
+ if (cellIndex >= 0)
1328
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshCell(cellIndex);
1329
+ this.requestUpdate();
1330
+ }
1331
+ (_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
1332
+ category: this.searchContext,
1333
+ action: analyticsActions.resultSelected,
1334
+ label: event.detail.mediatype,
1335
+ });
1336
+ (_c = this.analyticsHandler) === null || _c === void 0 ? void 0 : _c.sendEvent({
1337
+ category: this.searchContext,
1338
+ action: analyticsActions.resultSelected,
1339
+ label: `page-${this.currentPage}`,
1340
+ });
1341
+ }
1342
+ cellForIndex(index) {
1343
+ const model = this.tileModelAtCellIndex(index);
1344
+ if (!model)
1345
+ return undefined;
1346
1346
  return html `
1347
1347
  <tile-dispatcher
1348
1348
  .collectionPagePath=${this.collectionPagePath}
@@ -1362,21 +1362,21 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1362
1362
  @resultSelected=${(e) => this.resultSelected(e)}
1363
1363
  >
1364
1364
  </tile-dispatcher>
1365
- `;
1366
- }
1367
- /**
1368
- * When the user scrolls near to the bottom of the page, fetch the next page
1369
- * increase the number of pages to render and start fetching data for the new page
1370
- */
1371
- scrollThresholdReached() {
1372
- if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
1373
- this.pagesToRender += 1;
1374
- this.dataSource.fetchPage(this.pagesToRender);
1375
- }
1376
- }
1377
- static get styles() {
1378
- return [
1379
- srOnlyStyle,
1365
+ `;
1366
+ }
1367
+ /**
1368
+ * When the user scrolls near to the bottom of the page, fetch the next page
1369
+ * increase the number of pages to render and start fetching data for the new page
1370
+ */
1371
+ scrollThresholdReached() {
1372
+ if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
1373
+ this.pagesToRender += 1;
1374
+ this.dataSource.fetchPage(this.pagesToRender);
1375
+ }
1376
+ }
1377
+ static get styles() {
1378
+ return [
1379
+ srOnlyStyle,
1380
1380
  css `
1381
1381
  :host {
1382
1382
  display: block;
@@ -1453,7 +1453,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1453
1453
  #right-column {
1454
1454
  flex: 1;
1455
1455
  position: relative;
1456
- min-height: 90vh;
1457
1456
  border-left: 1px solid rgb(232, 232, 232);
1458
1457
  border-right: 1px solid rgb(232, 232, 232);
1459
1458
  padding-left: 1rem;
@@ -1570,9 +1569,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1570
1569
 
1571
1570
  .mobile #left-column {
1572
1571
  width: 100%;
1573
- min-width: 0;
1574
1572
  padding: 0;
1575
- border: 0;
1576
1573
  }
1577
1574
 
1578
1575
  .clear-filters-btn-row {
@@ -1754,180 +1751,180 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1754
1751
  infinite-scroller.hidden {
1755
1752
  display: none;
1756
1753
  }
1757
- `,
1758
- ];
1759
- }
1760
- };
1761
- __decorate([
1762
- property({ type: String })
1763
- ], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
1764
- __decorate([
1765
- property({ type: String })
1766
- ], CollectionBrowser.prototype, "baseImageUrl", void 0);
1767
- __decorate([
1768
- property({ type: Object })
1769
- ], CollectionBrowser.prototype, "searchService", void 0);
1770
- __decorate([
1771
- property({ type: String })
1772
- ], CollectionBrowser.prototype, "searchType", void 0);
1773
- __decorate([
1774
- property({ type: String })
1775
- ], CollectionBrowser.prototype, "withinCollection", void 0);
1776
- __decorate([
1777
- property({ type: String })
1778
- ], CollectionBrowser.prototype, "withinProfile", void 0);
1779
- __decorate([
1780
- property({ type: String })
1781
- ], CollectionBrowser.prototype, "profileElement", void 0);
1782
- __decorate([
1783
- property({ type: String })
1784
- ], CollectionBrowser.prototype, "baseQuery", void 0);
1785
- __decorate([
1786
- property({ type: String })
1787
- ], CollectionBrowser.prototype, "displayMode", void 0);
1788
- __decorate([
1789
- property({ type: Object })
1790
- ], CollectionBrowser.prototype, "defaultSortParam", void 0);
1791
- __decorate([
1792
- property({ type: String })
1793
- ], CollectionBrowser.prototype, "selectedSort", void 0);
1794
- __decorate([
1795
- property({ type: String })
1796
- ], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
1797
- __decorate([
1798
- property({ type: String })
1799
- ], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
1800
- __decorate([
1801
- property({ type: String })
1802
- ], CollectionBrowser.prototype, "sortDirection", void 0);
1803
- __decorate([
1804
- property({ type: Number })
1805
- ], CollectionBrowser.prototype, "pageSize", void 0);
1806
- __decorate([
1807
- property({ type: Number })
1808
- ], CollectionBrowser.prototype, "currentPage", void 0);
1809
- __decorate([
1810
- property({ type: String })
1811
- ], CollectionBrowser.prototype, "minSelectedDate", void 0);
1812
- __decorate([
1813
- property({ type: String })
1814
- ], CollectionBrowser.prototype, "maxSelectedDate", void 0);
1815
- __decorate([
1816
- property({ type: Object })
1817
- ], CollectionBrowser.prototype, "selectedFacets", void 0);
1818
- __decorate([
1819
- property({ type: Boolean })
1820
- ], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
1821
- __decorate([
1822
- property({ type: Boolean })
1823
- ], CollectionBrowser.prototype, "suppressPlaceholders", void 0);
1824
- __decorate([
1825
- property({ type: Boolean })
1826
- ], CollectionBrowser.prototype, "suppressResultCount", void 0);
1827
- __decorate([
1828
- property({ type: Boolean })
1829
- ], CollectionBrowser.prototype, "suppressResultTiles", void 0);
1830
- __decorate([
1831
- property({ type: Boolean })
1832
- ], CollectionBrowser.prototype, "suppressURLQuery", void 0);
1833
- __decorate([
1834
- property({ type: Boolean })
1835
- ], CollectionBrowser.prototype, "suppressFacets", void 0);
1836
- __decorate([
1837
- property({ type: Boolean })
1838
- ], CollectionBrowser.prototype, "suppressSortBar", void 0);
1839
- __decorate([
1840
- property({ type: Boolean })
1841
- ], CollectionBrowser.prototype, "suppressDisplayModes", void 0);
1842
- __decorate([
1843
- property({ type: Boolean })
1844
- ], CollectionBrowser.prototype, "clearResultsOnEmptyQuery", void 0);
1845
- __decorate([
1846
- property({ type: String })
1847
- ], CollectionBrowser.prototype, "collectionPagePath", void 0);
1848
- __decorate([
1849
- property({ type: String, reflect: true })
1850
- ], CollectionBrowser.prototype, "searchContext", void 0);
1851
- __decorate([
1852
- property({ type: String })
1853
- ], CollectionBrowser.prototype, "pageContext", void 0);
1854
- __decorate([
1855
- property({ type: Object })
1856
- ], CollectionBrowser.prototype, "restorationStateHandler", void 0);
1857
- __decorate([
1858
- property({ type: Number })
1859
- ], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
1860
- __decorate([
1861
- property({ type: Boolean })
1862
- ], CollectionBrowser.prototype, "loggedIn", void 0);
1863
- __decorate([
1864
- property({ type: Object })
1865
- ], CollectionBrowser.prototype, "resizeObserver", void 0);
1866
- __decorate([
1867
- property({ type: Object })
1868
- ], CollectionBrowser.prototype, "modalManager", void 0);
1869
- __decorate([
1870
- property({ type: Object })
1871
- ], CollectionBrowser.prototype, "featureFeedbackService", void 0);
1872
- __decorate([
1873
- property({ type: Object })
1874
- ], CollectionBrowser.prototype, "recaptchaManager", void 0);
1875
- __decorate([
1876
- property({ type: Boolean })
1877
- ], CollectionBrowser.prototype, "isManageView", void 0);
1878
- __decorate([
1879
- property({ type: Boolean })
1880
- ], CollectionBrowser.prototype, "enableSortOptionsSlot", void 0);
1881
- __decorate([
1882
- property({ type: Object })
1883
- ], CollectionBrowser.prototype, "dataSource", void 0);
1884
- __decorate([
1885
- state()
1886
- ], CollectionBrowser.prototype, "pagesToRender", void 0);
1887
- __decorate([
1888
- state()
1889
- ], CollectionBrowser.prototype, "searchResultsLoading", void 0);
1890
- __decorate([
1891
- state()
1892
- ], CollectionBrowser.prototype, "facetsLoading", void 0);
1893
- __decorate([
1894
- state()
1895
- ], CollectionBrowser.prototype, "totalResults", void 0);
1896
- __decorate([
1897
- state()
1898
- ], CollectionBrowser.prototype, "mobileView", void 0);
1899
- __decorate([
1900
- state()
1901
- ], CollectionBrowser.prototype, "mobileFacetsVisible", void 0);
1902
- __decorate([
1903
- state()
1904
- ], CollectionBrowser.prototype, "contentWidth", void 0);
1905
- __decorate([
1906
- state()
1907
- ], CollectionBrowser.prototype, "defaultSortField", void 0);
1908
- __decorate([
1909
- state()
1910
- ], CollectionBrowser.prototype, "defaultSortDirection", void 0);
1911
- __decorate([
1912
- state()
1913
- ], CollectionBrowser.prototype, "placeholderType", void 0);
1914
- __decorate([
1915
- query('#content-container')
1916
- ], CollectionBrowser.prototype, "contentContainer", void 0);
1917
- __decorate([
1918
- query('#left-column')
1919
- ], CollectionBrowser.prototype, "leftColumn", void 0);
1920
- __decorate([
1921
- query('collection-facets')
1922
- ], CollectionBrowser.prototype, "collectionFacets", void 0);
1923
- __decorate([
1924
- property({ type: Object, attribute: false })
1925
- ], CollectionBrowser.prototype, "analyticsHandler", void 0);
1926
- __decorate([
1927
- query('infinite-scroller')
1928
- ], CollectionBrowser.prototype, "infiniteScroller", void 0);
1929
- CollectionBrowser = __decorate([
1930
- customElement('collection-browser')
1931
- ], CollectionBrowser);
1932
- export { CollectionBrowser };
1754
+ `,
1755
+ ];
1756
+ }
1757
+ };
1758
+ __decorate([
1759
+ property({ type: String })
1760
+ ], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
1761
+ __decorate([
1762
+ property({ type: String })
1763
+ ], CollectionBrowser.prototype, "baseImageUrl", void 0);
1764
+ __decorate([
1765
+ property({ type: Object })
1766
+ ], CollectionBrowser.prototype, "searchService", void 0);
1767
+ __decorate([
1768
+ property({ type: String })
1769
+ ], CollectionBrowser.prototype, "searchType", void 0);
1770
+ __decorate([
1771
+ property({ type: String })
1772
+ ], CollectionBrowser.prototype, "withinCollection", void 0);
1773
+ __decorate([
1774
+ property({ type: String })
1775
+ ], CollectionBrowser.prototype, "withinProfile", void 0);
1776
+ __decorate([
1777
+ property({ type: String })
1778
+ ], CollectionBrowser.prototype, "profileElement", void 0);
1779
+ __decorate([
1780
+ property({ type: String })
1781
+ ], CollectionBrowser.prototype, "baseQuery", void 0);
1782
+ __decorate([
1783
+ property({ type: String })
1784
+ ], CollectionBrowser.prototype, "displayMode", void 0);
1785
+ __decorate([
1786
+ property({ type: Object })
1787
+ ], CollectionBrowser.prototype, "defaultSortParam", void 0);
1788
+ __decorate([
1789
+ property({ type: String })
1790
+ ], CollectionBrowser.prototype, "selectedSort", void 0);
1791
+ __decorate([
1792
+ property({ type: String })
1793
+ ], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
1794
+ __decorate([
1795
+ property({ type: String })
1796
+ ], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
1797
+ __decorate([
1798
+ property({ type: String })
1799
+ ], CollectionBrowser.prototype, "sortDirection", void 0);
1800
+ __decorate([
1801
+ property({ type: Number })
1802
+ ], CollectionBrowser.prototype, "pageSize", void 0);
1803
+ __decorate([
1804
+ property({ type: Number })
1805
+ ], CollectionBrowser.prototype, "currentPage", void 0);
1806
+ __decorate([
1807
+ property({ type: String })
1808
+ ], CollectionBrowser.prototype, "minSelectedDate", void 0);
1809
+ __decorate([
1810
+ property({ type: String })
1811
+ ], CollectionBrowser.prototype, "maxSelectedDate", void 0);
1812
+ __decorate([
1813
+ property({ type: Object })
1814
+ ], CollectionBrowser.prototype, "selectedFacets", void 0);
1815
+ __decorate([
1816
+ property({ type: Boolean })
1817
+ ], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
1818
+ __decorate([
1819
+ property({ type: Boolean })
1820
+ ], CollectionBrowser.prototype, "suppressPlaceholders", void 0);
1821
+ __decorate([
1822
+ property({ type: Boolean })
1823
+ ], CollectionBrowser.prototype, "suppressResultCount", void 0);
1824
+ __decorate([
1825
+ property({ type: Boolean })
1826
+ ], CollectionBrowser.prototype, "suppressResultTiles", void 0);
1827
+ __decorate([
1828
+ property({ type: Boolean })
1829
+ ], CollectionBrowser.prototype, "suppressURLQuery", void 0);
1830
+ __decorate([
1831
+ property({ type: Boolean })
1832
+ ], CollectionBrowser.prototype, "suppressFacets", void 0);
1833
+ __decorate([
1834
+ property({ type: Boolean })
1835
+ ], CollectionBrowser.prototype, "suppressSortBar", void 0);
1836
+ __decorate([
1837
+ property({ type: Boolean })
1838
+ ], CollectionBrowser.prototype, "clearResultsOnEmptyQuery", void 0);
1839
+ __decorate([
1840
+ property({ type: String })
1841
+ ], CollectionBrowser.prototype, "collectionPagePath", void 0);
1842
+ __decorate([
1843
+ property({ type: String, reflect: true })
1844
+ ], CollectionBrowser.prototype, "searchContext", void 0);
1845
+ __decorate([
1846
+ property({ type: String })
1847
+ ], CollectionBrowser.prototype, "pageContext", void 0);
1848
+ __decorate([
1849
+ property({ type: Object })
1850
+ ], CollectionBrowser.prototype, "restorationStateHandler", void 0);
1851
+ __decorate([
1852
+ property({ type: Number })
1853
+ ], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
1854
+ __decorate([
1855
+ property({ type: Boolean })
1856
+ ], CollectionBrowser.prototype, "loggedIn", void 0);
1857
+ __decorate([
1858
+ property({ type: Object })
1859
+ ], CollectionBrowser.prototype, "resizeObserver", void 0);
1860
+ __decorate([
1861
+ property({ type: Object })
1862
+ ], CollectionBrowser.prototype, "modalManager", void 0);
1863
+ __decorate([
1864
+ property({ type: Object })
1865
+ ], CollectionBrowser.prototype, "featureFeedbackService", void 0);
1866
+ __decorate([
1867
+ property({ type: Object })
1868
+ ], CollectionBrowser.prototype, "recaptchaManager", void 0);
1869
+ __decorate([
1870
+ property({ type: Boolean })
1871
+ ], CollectionBrowser.prototype, "isManageView", void 0);
1872
+ __decorate([
1873
+ property({ type: String })
1874
+ ], CollectionBrowser.prototype, "manageViewLabel", void 0);
1875
+ __decorate([
1876
+ property({ type: Boolean })
1877
+ ], CollectionBrowser.prototype, "enableSortOptionsSlot", void 0);
1878
+ __decorate([
1879
+ property({ type: Object })
1880
+ ], CollectionBrowser.prototype, "dataSource", void 0);
1881
+ __decorate([
1882
+ state()
1883
+ ], CollectionBrowser.prototype, "pagesToRender", void 0);
1884
+ __decorate([
1885
+ state()
1886
+ ], CollectionBrowser.prototype, "searchResultsLoading", void 0);
1887
+ __decorate([
1888
+ state()
1889
+ ], CollectionBrowser.prototype, "facetsLoading", void 0);
1890
+ __decorate([
1891
+ state()
1892
+ ], CollectionBrowser.prototype, "totalResults", void 0);
1893
+ __decorate([
1894
+ state()
1895
+ ], CollectionBrowser.prototype, "mobileView", void 0);
1896
+ __decorate([
1897
+ state()
1898
+ ], CollectionBrowser.prototype, "mobileFacetsVisible", void 0);
1899
+ __decorate([
1900
+ state()
1901
+ ], CollectionBrowser.prototype, "contentWidth", void 0);
1902
+ __decorate([
1903
+ state()
1904
+ ], CollectionBrowser.prototype, "defaultSortField", void 0);
1905
+ __decorate([
1906
+ state()
1907
+ ], CollectionBrowser.prototype, "defaultSortDirection", void 0);
1908
+ __decorate([
1909
+ state()
1910
+ ], CollectionBrowser.prototype, "placeholderType", void 0);
1911
+ __decorate([
1912
+ query('#content-container')
1913
+ ], CollectionBrowser.prototype, "contentContainer", void 0);
1914
+ __decorate([
1915
+ query('#left-column')
1916
+ ], CollectionBrowser.prototype, "leftColumn", void 0);
1917
+ __decorate([
1918
+ query('collection-facets')
1919
+ ], CollectionBrowser.prototype, "collectionFacets", void 0);
1920
+ __decorate([
1921
+ property({ type: Object, attribute: false })
1922
+ ], CollectionBrowser.prototype, "analyticsHandler", void 0);
1923
+ __decorate([
1924
+ query('infinite-scroller')
1925
+ ], CollectionBrowser.prototype, "infiniteScroller", void 0);
1926
+ CollectionBrowser = __decorate([
1927
+ customElement('collection-browser')
1928
+ ], CollectionBrowser);
1929
+ export { CollectionBrowser };
1933
1930
  //# sourceMappingURL=collection-browser.js.map