@internetarchive/collection-browser 1.14.17-beta.5 → 1.14.18-alpha.0

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