@internetarchive/collection-browser 3.3.1 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (492) hide show
  1. package/package.json +1 -1
  2. package/dist/index.d.ts +0 -16
  3. package/dist/index.js.map +0 -1
  4. package/dist/src/app-root.d.ts +0 -105
  5. package/dist/src/app-root.js +0 -1076
  6. package/dist/src/app-root.js.map +0 -1
  7. package/dist/src/assets/img/icons/arrow-left.d.ts +0 -2
  8. package/dist/src/assets/img/icons/arrow-left.js +0 -10
  9. package/dist/src/assets/img/icons/arrow-left.js.map +0 -1
  10. package/dist/src/assets/img/icons/arrow-right.d.ts +0 -2
  11. package/dist/src/assets/img/icons/arrow-right.js +0 -10
  12. package/dist/src/assets/img/icons/arrow-right.js.map +0 -1
  13. package/dist/src/assets/img/icons/chevron.d.ts +0 -2
  14. package/dist/src/assets/img/icons/chevron.js +0 -4
  15. package/dist/src/assets/img/icons/chevron.js.map +0 -1
  16. package/dist/src/assets/img/icons/close-circle-dark.d.ts +0 -2
  17. package/dist/src/assets/img/icons/close-circle-dark.js +0 -5
  18. package/dist/src/assets/img/icons/close-circle-dark.js.map +0 -1
  19. package/dist/src/assets/img/icons/contract.d.ts +0 -2
  20. package/dist/src/assets/img/icons/contract.js +0 -9
  21. package/dist/src/assets/img/icons/contract.js.map +0 -1
  22. package/dist/src/assets/img/icons/empty-query.d.ts +0 -2
  23. package/dist/src/assets/img/icons/empty-query.js +0 -5
  24. package/dist/src/assets/img/icons/empty-query.js.map +0 -1
  25. package/dist/src/assets/img/icons/expand.d.ts +0 -2
  26. package/dist/src/assets/img/icons/expand.js +0 -9
  27. package/dist/src/assets/img/icons/expand.js.map +0 -1
  28. package/dist/src/assets/img/icons/eye-closed.d.ts +0 -2
  29. package/dist/src/assets/img/icons/eye-closed.js +0 -5
  30. package/dist/src/assets/img/icons/eye-closed.js.map +0 -1
  31. package/dist/src/assets/img/icons/eye.d.ts +0 -2
  32. package/dist/src/assets/img/icons/eye.js +0 -5
  33. package/dist/src/assets/img/icons/eye.js.map +0 -1
  34. package/dist/src/assets/img/icons/favorite-filled.d.ts +0 -1
  35. package/dist/src/assets/img/icons/favorite-filled.js +0 -10
  36. package/dist/src/assets/img/icons/favorite-filled.js.map +0 -1
  37. package/dist/src/assets/img/icons/favorite-unfilled.d.ts +0 -1
  38. package/dist/src/assets/img/icons/favorite-unfilled.js +0 -9
  39. package/dist/src/assets/img/icons/favorite-unfilled.js.map +0 -1
  40. package/dist/src/assets/img/icons/filter.d.ts +0 -2
  41. package/dist/src/assets/img/icons/filter.js +0 -10
  42. package/dist/src/assets/img/icons/filter.js.map +0 -1
  43. package/dist/src/assets/img/icons/login-required.d.ts +0 -1
  44. package/dist/src/assets/img/icons/login-required.js +0 -18
  45. package/dist/src/assets/img/icons/login-required.js.map +0 -1
  46. package/dist/src/assets/img/icons/mediatype/account.d.ts +0 -1
  47. package/dist/src/assets/img/icons/mediatype/account.js +0 -14
  48. package/dist/src/assets/img/icons/mediatype/account.js.map +0 -1
  49. package/dist/src/assets/img/icons/mediatype/audio.d.ts +0 -1
  50. package/dist/src/assets/img/icons/mediatype/audio.js +0 -14
  51. package/dist/src/assets/img/icons/mediatype/audio.js.map +0 -1
  52. package/dist/src/assets/img/icons/mediatype/collection.d.ts +0 -1
  53. package/dist/src/assets/img/icons/mediatype/collection.js +0 -12
  54. package/dist/src/assets/img/icons/mediatype/collection.js.map +0 -1
  55. package/dist/src/assets/img/icons/mediatype/data.d.ts +0 -1
  56. package/dist/src/assets/img/icons/mediatype/data.js +0 -15
  57. package/dist/src/assets/img/icons/mediatype/data.js.map +0 -1
  58. package/dist/src/assets/img/icons/mediatype/etree.d.ts +0 -1
  59. package/dist/src/assets/img/icons/mediatype/etree.js +0 -14
  60. package/dist/src/assets/img/icons/mediatype/etree.js.map +0 -1
  61. package/dist/src/assets/img/icons/mediatype/film.d.ts +0 -1
  62. package/dist/src/assets/img/icons/mediatype/film.js +0 -14
  63. package/dist/src/assets/img/icons/mediatype/film.js.map +0 -1
  64. package/dist/src/assets/img/icons/mediatype/images.d.ts +0 -1
  65. package/dist/src/assets/img/icons/mediatype/images.js +0 -13
  66. package/dist/src/assets/img/icons/mediatype/images.js.map +0 -1
  67. package/dist/src/assets/img/icons/mediatype/radio.d.ts +0 -1
  68. package/dist/src/assets/img/icons/mediatype/radio.js +0 -15
  69. package/dist/src/assets/img/icons/mediatype/radio.js.map +0 -1
  70. package/dist/src/assets/img/icons/mediatype/search.d.ts +0 -1
  71. package/dist/src/assets/img/icons/mediatype/search.js +0 -14
  72. package/dist/src/assets/img/icons/mediatype/search.js.map +0 -1
  73. package/dist/src/assets/img/icons/mediatype/software.d.ts +0 -1
  74. package/dist/src/assets/img/icons/mediatype/software.js +0 -13
  75. package/dist/src/assets/img/icons/mediatype/software.js.map +0 -1
  76. package/dist/src/assets/img/icons/mediatype/texts.d.ts +0 -1
  77. package/dist/src/assets/img/icons/mediatype/texts.js +0 -13
  78. package/dist/src/assets/img/icons/mediatype/texts.js.map +0 -1
  79. package/dist/src/assets/img/icons/mediatype/tv-commercial.d.ts +0 -1
  80. package/dist/src/assets/img/icons/mediatype/tv-commercial.js +0 -12
  81. package/dist/src/assets/img/icons/mediatype/tv-commercial.js.map +0 -1
  82. package/dist/src/assets/img/icons/mediatype/tv-fact-check.d.ts +0 -1
  83. package/dist/src/assets/img/icons/mediatype/tv-fact-check.js +0 -12
  84. package/dist/src/assets/img/icons/mediatype/tv-fact-check.js.map +0 -1
  85. package/dist/src/assets/img/icons/mediatype/tv-quote.d.ts +0 -1
  86. package/dist/src/assets/img/icons/mediatype/tv-quote.js +0 -12
  87. package/dist/src/assets/img/icons/mediatype/tv-quote.js.map +0 -1
  88. package/dist/src/assets/img/icons/mediatype/tv.d.ts +0 -1
  89. package/dist/src/assets/img/icons/mediatype/tv.js +0 -14
  90. package/dist/src/assets/img/icons/mediatype/tv.js.map +0 -1
  91. package/dist/src/assets/img/icons/mediatype/video.d.ts +0 -1
  92. package/dist/src/assets/img/icons/mediatype/video.js +0 -14
  93. package/dist/src/assets/img/icons/mediatype/video.js.map +0 -1
  94. package/dist/src/assets/img/icons/mediatype/web.d.ts +0 -1
  95. package/dist/src/assets/img/icons/mediatype/web.js +0 -13
  96. package/dist/src/assets/img/icons/mediatype/web.js.map +0 -1
  97. package/dist/src/assets/img/icons/null-result.d.ts +0 -2
  98. package/dist/src/assets/img/icons/null-result.js +0 -5
  99. package/dist/src/assets/img/icons/null-result.js.map +0 -1
  100. package/dist/src/assets/img/icons/quote.d.ts +0 -1
  101. package/dist/src/assets/img/icons/quote.js +0 -7
  102. package/dist/src/assets/img/icons/quote.js.map +0 -1
  103. package/dist/src/assets/img/icons/restricted.d.ts +0 -1
  104. package/dist/src/assets/img/icons/restricted.js +0 -13
  105. package/dist/src/assets/img/icons/restricted.js.map +0 -1
  106. package/dist/src/assets/img/icons/reviews.d.ts +0 -1
  107. package/dist/src/assets/img/icons/reviews.js +0 -11
  108. package/dist/src/assets/img/icons/reviews.js.map +0 -1
  109. package/dist/src/assets/img/icons/upload.d.ts +0 -1
  110. package/dist/src/assets/img/icons/upload.js +0 -12
  111. package/dist/src/assets/img/icons/upload.js.map +0 -1
  112. package/dist/src/assets/img/icons/views.d.ts +0 -1
  113. package/dist/src/assets/img/icons/views.js +0 -11
  114. package/dist/src/assets/img/icons/views.js.map +0 -1
  115. package/dist/src/circular-activity-indicator.d.ts +0 -5
  116. package/dist/src/circular-activity-indicator.js +0 -66
  117. package/dist/src/circular-activity-indicator.js.map +0 -1
  118. package/dist/src/collection-browser.d.ts +0 -684
  119. package/dist/src/collection-browser.js +0 -2567
  120. package/dist/src/collection-browser.js.map +0 -1
  121. package/dist/src/collection-facets/facet-row.d.ts +0 -30
  122. package/dist/src/collection-facets/facet-row.js +0 -265
  123. package/dist/src/collection-facets/facet-row.js.map +0 -1
  124. package/dist/src/collection-facets/facet-tombstone-row.d.ts +0 -5
  125. package/dist/src/collection-facets/facet-tombstone-row.js +0 -43
  126. package/dist/src/collection-facets/facet-tombstone-row.js.map +0 -1
  127. package/dist/src/collection-facets/facets-template.d.ts +0 -13
  128. package/dist/src/collection-facets/facets-template.js +0 -68
  129. package/dist/src/collection-facets/facets-template.js.map +0 -1
  130. package/dist/src/collection-facets/models.d.ts +0 -9
  131. package/dist/src/collection-facets/models.js +0 -10
  132. package/dist/src/collection-facets/models.js.map +0 -1
  133. package/dist/src/collection-facets/more-facets-content.d.ts +0 -109
  134. package/dist/src/collection-facets/more-facets-content.js +0 -547
  135. package/dist/src/collection-facets/more-facets-content.js.map +0 -1
  136. package/dist/src/collection-facets/more-facets-pagination.d.ts +0 -36
  137. package/dist/src/collection-facets/more-facets-pagination.js +0 -264
  138. package/dist/src/collection-facets/more-facets-pagination.js.map +0 -1
  139. package/dist/src/collection-facets/smart-facets/dedupe.d.ts +0 -10
  140. package/dist/src/collection-facets/smart-facets/dedupe.js +0 -35
  141. package/dist/src/collection-facets/smart-facets/dedupe.js.map +0 -1
  142. package/dist/src/collection-facets/smart-facets/heuristics/browser-language/browser-language-heuristic.d.ts +0 -5
  143. package/dist/src/collection-facets/smart-facets/heuristics/browser-language/browser-language-heuristic.js +0 -24
  144. package/dist/src/collection-facets/smart-facets/heuristics/browser-language/browser-language-heuristic.js.map +0 -1
  145. package/dist/src/collection-facets/smart-facets/heuristics/index.d.ts +0 -3
  146. package/dist/src/collection-facets/smart-facets/heuristics/index.js +0 -4
  147. package/dist/src/collection-facets/smart-facets/heuristics/index.js.map +0 -1
  148. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-heuristic.d.ts +0 -4
  149. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-heuristic.js +0 -14
  150. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-heuristic.js.map +0 -1
  151. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-map.d.ts +0 -6
  152. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-map.js +0 -68
  153. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-map.js.map +0 -1
  154. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.d.ts +0 -9
  155. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.js +0 -69
  156. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.js.map +0 -1
  157. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.d.ts +0 -21
  158. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +0 -76
  159. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +0 -1
  160. package/dist/src/collection-facets/smart-facets/models.d.ts +0 -30
  161. package/dist/src/collection-facets/smart-facets/models.js +0 -2
  162. package/dist/src/collection-facets/smart-facets/models.js.map +0 -1
  163. package/dist/src/collection-facets/smart-facets/smart-facet-bar.d.ts +0 -54
  164. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +0 -383
  165. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +0 -1
  166. package/dist/src/collection-facets/smart-facets/smart-facet-button.d.ts +0 -11
  167. package/dist/src/collection-facets/smart-facets/smart-facet-button.js +0 -133
  168. package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +0 -1
  169. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.d.ts +0 -28
  170. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +0 -172
  171. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +0 -1
  172. package/dist/src/collection-facets/smart-facets/smart-facet-equals.d.ts +0 -2
  173. package/dist/src/collection-facets/smart-facets/smart-facet-equals.js +0 -13
  174. package/dist/src/collection-facets/smart-facets/smart-facet-equals.js.map +0 -1
  175. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.d.ts +0 -5
  176. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js +0 -18
  177. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +0 -1
  178. package/dist/src/collection-facets/toggle-switch.d.ts +0 -41
  179. package/dist/src/collection-facets/toggle-switch.js +0 -174
  180. package/dist/src/collection-facets/toggle-switch.js.map +0 -1
  181. package/dist/src/collection-facets.d.ts +0 -113
  182. package/dist/src/collection-facets.js +0 -873
  183. package/dist/src/collection-facets.js.map +0 -1
  184. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +0 -261
  185. package/dist/src/data-source/collection-browser-data-source-interface.js +0 -2
  186. package/dist/src/data-source/collection-browser-data-source-interface.js.map +0 -1
  187. package/dist/src/data-source/collection-browser-data-source.d.ts +0 -400
  188. package/dist/src/data-source/collection-browser-data-source.js +0 -1103
  189. package/dist/src/data-source/collection-browser-data-source.js.map +0 -1
  190. package/dist/src/data-source/collection-browser-query-state.d.ts +0 -49
  191. package/dist/src/data-source/collection-browser-query-state.js +0 -2
  192. package/dist/src/data-source/collection-browser-query-state.js.map +0 -1
  193. package/dist/src/data-source/models.d.ts +0 -32
  194. package/dist/src/data-source/models.js +0 -9
  195. package/dist/src/data-source/models.js.map +0 -1
  196. package/dist/src/empty-placeholder.d.ts +0 -23
  197. package/dist/src/empty-placeholder.js +0 -165
  198. package/dist/src/empty-placeholder.js.map +0 -1
  199. package/dist/src/expanded-date-picker.d.ts +0 -50
  200. package/dist/src/expanded-date-picker.js +0 -182
  201. package/dist/src/expanded-date-picker.js.map +0 -1
  202. package/dist/src/language-code-handler/language-code-handler.d.ts +0 -37
  203. package/dist/src/language-code-handler/language-code-handler.js +0 -27
  204. package/dist/src/language-code-handler/language-code-handler.js.map +0 -1
  205. package/dist/src/language-code-handler/language-code-mapping.d.ts +0 -1
  206. package/dist/src/language-code-handler/language-code-mapping.js +0 -563
  207. package/dist/src/language-code-handler/language-code-mapping.js.map +0 -1
  208. package/dist/src/manage/manage-bar.d.ts +0 -58
  209. package/dist/src/manage/manage-bar.js +0 -237
  210. package/dist/src/manage/manage-bar.js.map +0 -1
  211. package/dist/src/manage/remove-items-modal-content.d.ts +0 -9
  212. package/dist/src/manage/remove-items-modal-content.js +0 -104
  213. package/dist/src/manage/remove-items-modal-content.js.map +0 -1
  214. package/dist/src/mediatype/mediatype-config.d.ts +0 -11
  215. package/dist/src/mediatype/mediatype-config.js +0 -116
  216. package/dist/src/mediatype/mediatype-config.js.map +0 -1
  217. package/dist/src/models.d.ts +0 -302
  218. package/dist/src/models.js +0 -511
  219. package/dist/src/models.js.map +0 -1
  220. package/dist/src/restoration-state-handler.d.ts +0 -75
  221. package/dist/src/restoration-state-handler.js +0 -403
  222. package/dist/src/restoration-state-handler.js.map +0 -1
  223. package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +0 -6
  224. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +0 -60
  225. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js.map +0 -1
  226. package/dist/src/sort-filter-bar/alpha-bar.d.ts +0 -21
  227. package/dist/src/sort-filter-bar/alpha-bar.js +0 -241
  228. package/dist/src/sort-filter-bar/alpha-bar.js.map +0 -1
  229. package/dist/src/sort-filter-bar/img/compact.d.ts +0 -1
  230. package/dist/src/sort-filter-bar/img/compact.js +0 -5
  231. package/dist/src/sort-filter-bar/img/compact.js.map +0 -1
  232. package/dist/src/sort-filter-bar/img/list.d.ts +0 -1
  233. package/dist/src/sort-filter-bar/img/list.js +0 -5
  234. package/dist/src/sort-filter-bar/img/list.js.map +0 -1
  235. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +0 -1
  236. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +0 -15
  237. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js.map +0 -1
  238. package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +0 -1
  239. package/dist/src/sort-filter-bar/img/sort-toggle-down.js +0 -17
  240. package/dist/src/sort-filter-bar/img/sort-toggle-down.js.map +0 -1
  241. package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +0 -1
  242. package/dist/src/sort-filter-bar/img/sort-toggle-up.js +0 -17
  243. package/dist/src/sort-filter-bar/img/sort-toggle-up.js.map +0 -1
  244. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +0 -1
  245. package/dist/src/sort-filter-bar/img/sort-triangle.js +0 -5
  246. package/dist/src/sort-filter-bar/img/sort-triangle.js.map +0 -1
  247. package/dist/src/sort-filter-bar/img/tile.d.ts +0 -1
  248. package/dist/src/sort-filter-bar/img/tile.js +0 -5
  249. package/dist/src/sort-filter-bar/img/tile.js.map +0 -1
  250. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +0 -278
  251. package/dist/src/sort-filter-bar/sort-filter-bar.js +0 -1161
  252. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +0 -1
  253. package/dist/src/styles/ia-button.d.ts +0 -2
  254. package/dist/src/styles/ia-button.js +0 -134
  255. package/dist/src/styles/ia-button.js.map +0 -1
  256. package/dist/src/styles/item-image-styles.d.ts +0 -8
  257. package/dist/src/styles/item-image-styles.js +0 -123
  258. package/dist/src/styles/item-image-styles.js.map +0 -1
  259. package/dist/src/styles/sr-only.d.ts +0 -1
  260. package/dist/src/styles/sr-only.js +0 -18
  261. package/dist/src/styles/sr-only.js.map +0 -1
  262. package/dist/src/tiles/base-tile-component.d.ts +0 -27
  263. package/dist/src/tiles/base-tile-component.js +0 -82
  264. package/dist/src/tiles/base-tile-component.js.map +0 -1
  265. package/dist/src/tiles/collection-browser-loading-tile.d.ts +0 -5
  266. package/dist/src/tiles/collection-browser-loading-tile.js +0 -29
  267. package/dist/src/tiles/collection-browser-loading-tile.js.map +0 -1
  268. package/dist/src/tiles/grid/account-tile.d.ts +0 -18
  269. package/dist/src/tiles/grid/account-tile.js +0 -111
  270. package/dist/src/tiles/grid/account-tile.js.map +0 -1
  271. package/dist/src/tiles/grid/collection-tile.d.ts +0 -15
  272. package/dist/src/tiles/grid/collection-tile.js +0 -160
  273. package/dist/src/tiles/grid/collection-tile.js.map +0 -1
  274. package/dist/src/tiles/grid/item-tile.d.ts +0 -41
  275. package/dist/src/tiles/grid/item-tile.js +0 -321
  276. package/dist/src/tiles/grid/item-tile.js.map +0 -1
  277. package/dist/src/tiles/grid/search-tile.d.ts +0 -10
  278. package/dist/src/tiles/grid/search-tile.js +0 -95
  279. package/dist/src/tiles/grid/search-tile.js.map +0 -1
  280. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +0 -1
  281. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +0 -128
  282. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +0 -1
  283. package/dist/src/tiles/grid/tile-stats.d.ts +0 -58
  284. package/dist/src/tiles/grid/tile-stats.js +0 -204
  285. package/dist/src/tiles/grid/tile-stats.js.map +0 -1
  286. package/dist/src/tiles/hover/hover-pane-controller.d.ts +0 -220
  287. package/dist/src/tiles/hover/hover-pane-controller.js +0 -378
  288. package/dist/src/tiles/hover/hover-pane-controller.js.map +0 -1
  289. package/dist/src/tiles/hover/tile-hover-pane.d.ts +0 -19
  290. package/dist/src/tiles/hover/tile-hover-pane.js +0 -182
  291. package/dist/src/tiles/hover/tile-hover-pane.js.map +0 -1
  292. package/dist/src/tiles/image-block.d.ts +0 -19
  293. package/dist/src/tiles/image-block.js +0 -175
  294. package/dist/src/tiles/image-block.js.map +0 -1
  295. package/dist/src/tiles/item-image.d.ts +0 -40
  296. package/dist/src/tiles/item-image.js +0 -191
  297. package/dist/src/tiles/item-image.js.map +0 -1
  298. package/dist/src/tiles/list/tile-list-compact-header.d.ts +0 -6
  299. package/dist/src/tiles/list/tile-list-compact-header.js +0 -85
  300. package/dist/src/tiles/list/tile-list-compact-header.js.map +0 -1
  301. package/dist/src/tiles/list/tile-list-compact.d.ts +0 -19
  302. package/dist/src/tiles/list/tile-list-compact.js +0 -223
  303. package/dist/src/tiles/list/tile-list-compact.js.map +0 -1
  304. package/dist/src/tiles/list/tile-list.d.ts +0 -54
  305. package/dist/src/tiles/list/tile-list.js +0 -621
  306. package/dist/src/tiles/list/tile-list.js.map +0 -1
  307. package/dist/src/tiles/models.d.ts +0 -1
  308. package/dist/src/tiles/models.js +0 -2
  309. package/dist/src/tiles/models.js.map +0 -1
  310. package/dist/src/tiles/overlay/icon-overlay.d.ts +0 -8
  311. package/dist/src/tiles/overlay/icon-overlay.js +0 -55
  312. package/dist/src/tiles/overlay/icon-overlay.js.map +0 -1
  313. package/dist/src/tiles/overlay/text-overlay.d.ts +0 -9
  314. package/dist/src/tiles/overlay/text-overlay.js +0 -74
  315. package/dist/src/tiles/overlay/text-overlay.js.map +0 -1
  316. package/dist/src/tiles/review-block.d.ts +0 -12
  317. package/dist/src/tiles/review-block.js +0 -134
  318. package/dist/src/tiles/review-block.js.map +0 -1
  319. package/dist/src/tiles/text-snippet-block.d.ts +0 -27
  320. package/dist/src/tiles/text-snippet-block.js +0 -132
  321. package/dist/src/tiles/text-snippet-block.js.map +0 -1
  322. package/dist/src/tiles/tile-dispatcher.d.ts +0 -68
  323. package/dist/src/tiles/tile-dispatcher.js +0 -445
  324. package/dist/src/tiles/tile-dispatcher.js.map +0 -1
  325. package/dist/src/tiles/tile-display-value-provider.d.ts +0 -47
  326. package/dist/src/tiles/tile-display-value-provider.js +0 -95
  327. package/dist/src/tiles/tile-display-value-provider.js.map +0 -1
  328. package/dist/src/tiles/tile-mediatype-icon.d.ts +0 -27
  329. package/dist/src/tiles/tile-mediatype-icon.js +0 -130
  330. package/dist/src/tiles/tile-mediatype-icon.js.map +0 -1
  331. package/dist/src/utils/analytics-events.d.ts +0 -28
  332. package/dist/src/utils/analytics-events.js +0 -31
  333. package/dist/src/utils/analytics-events.js.map +0 -1
  334. package/dist/src/utils/array-equals.d.ts +0 -4
  335. package/dist/src/utils/array-equals.js +0 -11
  336. package/dist/src/utils/array-equals.js.map +0 -1
  337. package/dist/src/utils/collapse-repeated-quotes.d.ts +0 -11
  338. package/dist/src/utils/collapse-repeated-quotes.js +0 -14
  339. package/dist/src/utils/collapse-repeated-quotes.js.map +0 -1
  340. package/dist/src/utils/facet-utils.d.ts +0 -83
  341. package/dist/src/utils/facet-utils.js +0 -152
  342. package/dist/src/utils/facet-utils.js.map +0 -1
  343. package/dist/src/utils/format-count.d.ts +0 -7
  344. package/dist/src/utils/format-count.js +0 -76
  345. package/dist/src/utils/format-count.js.map +0 -1
  346. package/dist/src/utils/format-date.d.ts +0 -16
  347. package/dist/src/utils/format-date.js +0 -33
  348. package/dist/src/utils/format-date.js.map +0 -1
  349. package/dist/src/utils/format-unit-size.d.ts +0 -2
  350. package/dist/src/utils/format-unit-size.js +0 -34
  351. package/dist/src/utils/format-unit-size.js.map +0 -1
  352. package/dist/src/utils/local-date-from-utc.d.ts +0 -9
  353. package/dist/src/utils/local-date-from-utc.js +0 -16
  354. package/dist/src/utils/local-date-from-utc.js.map +0 -1
  355. package/dist/src/utils/log.d.ts +0 -7
  356. package/dist/src/utils/log.js +0 -14
  357. package/dist/src/utils/log.js.map +0 -1
  358. package/dist/src/utils/resolve-mediatype.d.ts +0 -8
  359. package/dist/src/utils/resolve-mediatype.js +0 -24
  360. package/dist/src/utils/resolve-mediatype.js.map +0 -1
  361. package/dist/src/utils/sha1.d.ts +0 -2
  362. package/dist/src/utils/sha1.js +0 -9
  363. package/dist/src/utils/sha1.js.map +0 -1
  364. package/dist/test/collection-browser.test.d.ts +0 -1
  365. package/dist/test/collection-browser.test.js +0 -1711
  366. package/dist/test/collection-browser.test.js.map +0 -1
  367. package/dist/test/collection-facets/facet-row.test.d.ts +0 -1
  368. package/dist/test/collection-facets/facet-row.test.js +0 -274
  369. package/dist/test/collection-facets/facet-row.test.js.map +0 -1
  370. package/dist/test/collection-facets/facets-template.test.d.ts +0 -1
  371. package/dist/test/collection-facets/facets-template.test.js +0 -101
  372. package/dist/test/collection-facets/facets-template.test.js.map +0 -1
  373. package/dist/test/collection-facets/more-facets-content.test.d.ts +0 -1
  374. package/dist/test/collection-facets/more-facets-content.test.js +0 -169
  375. package/dist/test/collection-facets/more-facets-content.test.js.map +0 -1
  376. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +0 -1
  377. package/dist/test/collection-facets/more-facets-pagination.test.js +0 -132
  378. package/dist/test/collection-facets/more-facets-pagination.test.js.map +0 -1
  379. package/dist/test/collection-facets/toggle-switch.test.d.ts +0 -1
  380. package/dist/test/collection-facets/toggle-switch.test.js +0 -96
  381. package/dist/test/collection-facets/toggle-switch.test.js.map +0 -1
  382. package/dist/test/collection-facets.test.d.ts +0 -2
  383. package/dist/test/collection-facets.test.js +0 -745
  384. package/dist/test/collection-facets.test.js.map +0 -1
  385. package/dist/test/data-source/collection-browser-data-source.test.d.ts +0 -1
  386. package/dist/test/data-source/collection-browser-data-source.test.js +0 -102
  387. package/dist/test/data-source/collection-browser-data-source.test.js.map +0 -1
  388. package/dist/test/empty-placeholder.test.d.ts +0 -1
  389. package/dist/test/empty-placeholder.test.js +0 -63
  390. package/dist/test/empty-placeholder.test.js.map +0 -1
  391. package/dist/test/expanded-date-picker.test.d.ts +0 -1
  392. package/dist/test/expanded-date-picker.test.js +0 -130
  393. package/dist/test/expanded-date-picker.test.js.map +0 -1
  394. package/dist/test/icon-overlay.test.d.ts +0 -1
  395. package/dist/test/icon-overlay.test.js +0 -30
  396. package/dist/test/icon-overlay.test.js.map +0 -1
  397. package/dist/test/image-block.test.d.ts +0 -1
  398. package/dist/test/image-block.test.js +0 -218
  399. package/dist/test/image-block.test.js.map +0 -1
  400. package/dist/test/item-image.test.d.ts +0 -1
  401. package/dist/test/item-image.test.js +0 -196
  402. package/dist/test/item-image.test.js.map +0 -1
  403. package/dist/test/manage/manage-bar.test.d.ts +0 -2
  404. package/dist/test/manage/manage-bar.test.js +0 -106
  405. package/dist/test/manage/manage-bar.test.js.map +0 -1
  406. package/dist/test/manage/remove-items-modal-content.test.d.ts +0 -1
  407. package/dist/test/manage/remove-items-modal-content.test.js +0 -65
  408. package/dist/test/manage/remove-items-modal-content.test.js.map +0 -1
  409. package/dist/test/mediatype-config.test.d.ts +0 -1
  410. package/dist/test/mediatype-config.test.js +0 -11
  411. package/dist/test/mediatype-config.test.js.map +0 -1
  412. package/dist/test/mocks/mock-analytics-handler.d.ts +0 -10
  413. package/dist/test/mocks/mock-analytics-handler.js +0 -16
  414. package/dist/test/mocks/mock-analytics-handler.js.map +0 -1
  415. package/dist/test/mocks/mock-search-responses.d.ts +0 -31
  416. package/dist/test/mocks/mock-search-responses.js +0 -1241
  417. package/dist/test/mocks/mock-search-responses.js.map +0 -1
  418. package/dist/test/mocks/mock-search-service.d.ts +0 -16
  419. package/dist/test/mocks/mock-search-service.js +0 -65
  420. package/dist/test/mocks/mock-search-service.js.map +0 -1
  421. package/dist/test/restoration-state-handler.test.d.ts +0 -1
  422. package/dist/test/restoration-state-handler.test.js +0 -375
  423. package/dist/test/restoration-state-handler.test.js.map +0 -1
  424. package/dist/test/review-block.test.d.ts +0 -1
  425. package/dist/test/review-block.test.js +0 -48
  426. package/dist/test/review-block.test.js.map +0 -1
  427. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +0 -1
  428. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +0 -13
  429. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +0 -1
  430. package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +0 -1
  431. package/dist/test/sort-filter-bar/alpha-bar.test.js +0 -74
  432. package/dist/test/sort-filter-bar/alpha-bar.test.js.map +0 -1
  433. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +0 -1
  434. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +0 -609
  435. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +0 -1
  436. package/dist/test/text-overlay.test.d.ts +0 -1
  437. package/dist/test/text-overlay.test.js +0 -42
  438. package/dist/test/text-overlay.test.js.map +0 -1
  439. package/dist/test/text-snippet-block.test.d.ts +0 -1
  440. package/dist/test/text-snippet-block.test.js +0 -63
  441. package/dist/test/text-snippet-block.test.js.map +0 -1
  442. package/dist/test/tile-stats.test.d.ts +0 -1
  443. package/dist/test/tile-stats.test.js +0 -128
  444. package/dist/test/tile-stats.test.js.map +0 -1
  445. package/dist/test/tiles/grid/account-tile.test.d.ts +0 -1
  446. package/dist/test/tiles/grid/account-tile.test.js +0 -96
  447. package/dist/test/tiles/grid/account-tile.test.js.map +0 -1
  448. package/dist/test/tiles/grid/collection-tile.test.d.ts +0 -1
  449. package/dist/test/tiles/grid/collection-tile.test.js +0 -96
  450. package/dist/test/tiles/grid/collection-tile.test.js.map +0 -1
  451. package/dist/test/tiles/grid/item-tile.test.d.ts +0 -1
  452. package/dist/test/tiles/grid/item-tile.test.js +0 -427
  453. package/dist/test/tiles/grid/item-tile.test.js.map +0 -1
  454. package/dist/test/tiles/grid/search-tile.test.d.ts +0 -1
  455. package/dist/test/tiles/grid/search-tile.test.js +0 -66
  456. package/dist/test/tiles/grid/search-tile.test.js.map +0 -1
  457. package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +0 -1
  458. package/dist/test/tiles/hover/hover-pane-controller.test.js +0 -282
  459. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +0 -1
  460. package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +0 -1
  461. package/dist/test/tiles/hover/tile-hover-pane.test.js +0 -57
  462. package/dist/test/tiles/hover/tile-hover-pane.test.js.map +0 -1
  463. package/dist/test/tiles/list/tile-list-compact.test.d.ts +0 -1
  464. package/dist/test/tiles/list/tile-list-compact.test.js +0 -251
  465. package/dist/test/tiles/list/tile-list-compact.test.js.map +0 -1
  466. package/dist/test/tiles/list/tile-list.test.d.ts +0 -1
  467. package/dist/test/tiles/list/tile-list.test.js +0 -469
  468. package/dist/test/tiles/list/tile-list.test.js.map +0 -1
  469. package/dist/test/tiles/tile-dispatcher.test.d.ts +0 -1
  470. package/dist/test/tiles/tile-dispatcher.test.js +0 -153
  471. package/dist/test/tiles/tile-dispatcher.test.js.map +0 -1
  472. package/dist/test/tiles/tile-display-value-provider.test.d.ts +0 -1
  473. package/dist/test/tiles/tile-display-value-provider.test.js +0 -142
  474. package/dist/test/tiles/tile-display-value-provider.test.js.map +0 -1
  475. package/dist/test/tiles/tile-mediatype-icon.test.d.ts +0 -1
  476. package/dist/test/tiles/tile-mediatype-icon.test.js +0 -145
  477. package/dist/test/tiles/tile-mediatype-icon.test.js.map +0 -1
  478. package/dist/test/utils/array-equals.test.d.ts +0 -1
  479. package/dist/test/utils/array-equals.test.js +0 -27
  480. package/dist/test/utils/array-equals.test.js.map +0 -1
  481. package/dist/test/utils/format-count.test.d.ts +0 -1
  482. package/dist/test/utils/format-count.test.js +0 -24
  483. package/dist/test/utils/format-count.test.js.map +0 -1
  484. package/dist/test/utils/format-date.test.d.ts +0 -1
  485. package/dist/test/utils/format-date.test.js +0 -61
  486. package/dist/test/utils/format-date.test.js.map +0 -1
  487. package/dist/test/utils/format-unit-size.test.d.ts +0 -1
  488. package/dist/test/utils/format-unit-size.test.js +0 -18
  489. package/dist/test/utils/format-unit-size.test.js.map +0 -1
  490. package/dist/test/utils/local-date-from-utc.test.d.ts +0 -1
  491. package/dist/test/utils/local-date-from-utc.test.js +0 -27
  492. package/dist/test/utils/local-date-from-utc.test.js.map +0 -1
@@ -1,2567 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { html, css, LitElement, nothing, } from 'lit';
3
- import { customElement, property, query, state } from 'lit/decorators.js';
4
- import { classMap } from 'lit/directives/class-map.js';
5
- import { msg } from '@lit/localize';
6
- import { SearchType, } from '@internetarchive/search-service';
7
- import '@internetarchive/infinite-scroller';
8
- import { SortField, getDefaultSelectedFacets, sortOptionFromAPIString, SORT_OPTIONS, defaultProfileElementSorts, defaultFacetDisplayOrder, tvFacetDisplayOrder, defaultSortAvailability, favoritesSortAvailability, tvSortAvailability, } from './models';
9
- import { RestorationStateHandler, } from './restoration-state-handler';
10
- import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
11
- import { FACETLESS_PAGE_ELEMENTS } from './data-source/models';
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 { log } from './utils/log';
17
- import './empty-placeholder';
18
- import './tiles/tile-dispatcher';
19
- import './tiles/collection-browser-loading-tile';
20
- import './sort-filter-bar/sort-filter-bar';
21
- import './manage/manage-bar';
22
- import './collection-facets';
23
- import './circular-activity-indicator';
24
- import './collection-facets/smart-facets/smart-facet-bar';
25
- let CollectionBrowser = class CollectionBrowser extends LitElement {
26
- constructor() {
27
- super();
28
- this.baseImageUrl = 'https://archive.org';
29
- /**
30
- * Which backend should be targeted by searches (e.g., metadata or FTS)
31
- */
32
- this.searchType = SearchType.DEFAULT;
33
- this.selectedSort = SortField.default;
34
- this.selectedTitleFilter = null;
35
- this.selectedCreatorFilter = null;
36
- this.tvClipFilter = 'all';
37
- this.sortDirection = null;
38
- this.defaultSortField = SortField.relevance;
39
- this.defaultSortDirection = null;
40
- this.pageSize = 50;
41
- /**
42
- * Whether to show smart facets (bubbles) along the top of the component
43
- */
44
- this.showSmartFacetBar = false;
45
- /**
46
- * Whether to show the date picker (above the facets)
47
- */
48
- this.showHistogramDatePicker = false;
49
- /**
50
- * Whether placeholder views should be suppressed. If true, searches that produce an
51
- * error or empty result set will simply show a blank results view instead of a placeholder.
52
- */
53
- this.suppressPlaceholders = false;
54
- /**
55
- * Whether the result count text should be suppressed.
56
- * If true, no "X Results" message will be shown.
57
- */
58
- this.suppressResultCount = false;
59
- /**
60
- * Whether the scrolling result view should be suppressed entirely.
61
- * If true, no infinite scroller (and thus no result tiles) will be rendered.
62
- */
63
- this.suppressResultTiles = false;
64
- /**
65
- * Whether to suppress persistence of the query to the URL.
66
- * If true, the `query` param will not be added to the URL or updated on query changes.
67
- */
68
- this.suppressURLQuery = false;
69
- /**
70
- * Whether to suppress persistence of the `sin` search type param to the URL.
71
- * If true, the `sin` param will not be added to the URL or updated on query changes.
72
- */
73
- this.suppressURLSinParam = false;
74
- /**
75
- * Whether to suppress display of the sort bar.
76
- * If true, the entire sort bar (incl. display modes) will be omitted from rendering.
77
- */
78
- this.suppressSortBar = false;
79
- /**
80
- * Whether to suppress showing the display mode options in the sort bar.
81
- * If true, those options will be omitted (though the rest of the sort bar may still render).
82
- */
83
- this.suppressDisplayModes = false;
84
- /**
85
- * Whether to suppress the display of the `mediatype` facet group, e.g., because this instance
86
- * of collection browser is being shown in a filtered single-mediatype context.
87
- */
88
- this.suppressMediatypeFacets = false;
89
- /**
90
- * What strategy to use for when/whether to load facet data for a search.
91
- *
92
- * Defaults to `eager`, always loading facets immediately alongside search results.
93
- *
94
- * To eliminate facets that are never seen, this can be reduced to `lazy-mobile`, which
95
- * will delay loading facets in the mobile view until the "Filters" accordion is opened.
96
- * Facets are still loaded eagerly when viewing the desktop layout.
97
- *
98
- * To further reduce facet requests for patrons who do not need to use them, this can be
99
- * again reduced to `opt-in`, which will also require desktop users to explicitly request
100
- * that they be loaded (in addition to the lazy mobile behavior described above).
101
- *
102
- * To entirely suppress facets from being loaded, this may be set to `off`.
103
- */
104
- this.facetLoadStrategy = 'eager';
105
- this.facetPaneVisible = false;
106
- this.clearResultsOnEmptyQuery = false;
107
- this.collectionPagePath = '/details/';
108
- /** describes where this component is being used */
109
- this.searchContext = analyticsCategories.default;
110
- this.pageContext = 'search';
111
- this.restorationStateHandler = new RestorationStateHandler({
112
- context: this.pageContext,
113
- });
114
- this.mobileBreakpoint = 600;
115
- this.loggedIn = false;
116
- this.modalManager = undefined;
117
- /**
118
- * Whether we are representing a TV collection, needing slightly different tile handling.
119
- */
120
- this.isTVCollection = false;
121
- /**
122
- * If item management UI active
123
- */
124
- this.isManageView = false;
125
- this.manageViewLabel = 'Select items to remove';
126
- /** Whether to replace the default sort options with a slot for customization (default: false) */
127
- this.enableSortOptionsSlot = false;
128
- /** Whether to expose a slot for a smart results carousel above the full results */
129
- this.showSmartResults = false;
130
- /**
131
- * The maximum number of pages we will load when a privileged user clicks
132
- * the "Manage" button on the search page. Limited to 15 pages.
133
- */
134
- this.maxPagesToManage = 15;
135
- /**
136
- * The results per page so we can paginate.
137
- *
138
- * This allows us to start in the middle of the search results and
139
- * fetch data before or after the current page. If we don't have a key
140
- * for the previous/next page, we'll fetch the next/previous page to populate it
141
- */
142
- this.dataSource = new CollectionBrowserDataSource(this, this.pageSize);
143
- /**
144
- * The page that the consumer wants to load.
145
- */
146
- this.initialPageNumber = 1;
147
- /**
148
- * This the the number of pages that we want to show.
149
- *
150
- * The data isn't necessarily loaded for all of the pages, but this lets us
151
- * know how many cells we should render.
152
- */
153
- this.pagesToRender = this.initialPageNumber;
154
- /**
155
- * Whether the initial page fetch for a new query is currently in progress.
156
- */
157
- this.searchResultsLoading = false;
158
- this.facetsLoading = false;
159
- this.mobileView = false;
160
- /**
161
- * Any temporarily overridden `on`/`off` state for the user's tile blurring preference if they
162
- * have chosen to override it, or `no-override` if they have not.
163
- */
164
- this.tileBlurOverrideState = 'no-override';
165
- this.collapsibleFacetsVisible = false;
166
- this.placeholderType = null;
167
- /** Whether layout size analytics have been sent already. */
168
- this.layoutSizeAnalyticsSent = false;
169
- /**
170
- * When we're animated scrolling to the page, we don't want to fetch
171
- * all of the pages as it scrolls so this lets us know if we're scrolling
172
- */
173
- this.isScrollingToCell = false;
174
- /**
175
- * When page width resizes from desktop to mobile, set true to
176
- * disable expand/collapse transition when loading.
177
- */
178
- this.isResizeToMobile = false;
179
- /**
180
- * Flag indicating that a new data source is currently being installed.
181
- * During the install, any URL persistence operation should replace the current entry
182
- * instead of creating a new one.
183
- */
184
- this.dataSourceInstallInProgress = false;
185
- this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
186
- /**
187
- * Updates the height of the left column according to its position on the page.
188
- * Arrow function ensures proper `this` binding.
189
- */
190
- this.updateLeftColumnHeight = () => {
191
- var _a, _b, _c, _d, _e;
192
- if (this.mobileView) {
193
- (_b = (_a = this.leftColumn) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.removeProperty('height');
194
- }
195
- else {
196
- const clientTop = (_c = this.leftColumn) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().top;
197
- const columnHeight = window.innerHeight - (clientTop !== null && clientTop !== void 0 ? clientTop : 0);
198
- const cssHeightValue = clientTop === 0
199
- ? null
200
- : // Subtract off the column's top padding so that it doesn't overflow
201
- `calc(${columnHeight}px - var(--leftColumnPaddingTop, 2rem))`;
202
- (_e = (_d = this.leftColumn) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.setProperty('height', cssHeightValue);
203
- }
204
- };
205
- /**
206
- * Toggles whether the fade-out is visible at the bottom of the facets.
207
- * It should only be visible if the facets are not scrolled to the bottom.
208
- * Arrow function ensures proper `this` binding.
209
- */
210
- this.updateFacetFadeOut = (entries) => {
211
- var _a, _b;
212
- const fadeElmt = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('facets-bottom-fade');
213
- 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);
214
- };
215
- // we only want to scroll on the very first query change
216
- // so this keeps track of whether we've already set the initial query
217
- this.initialQueryChangeHappened = false;
218
- this.historyPopOccurred = false;
219
- this.addController(this.dataSource);
220
- }
221
- tileModelAtCellIndex(index) {
222
- const model = this.dataSource.getTileModelAt(index);
223
- /**
224
- * If we encounter a model we don't have yet and we're not in the middle of an
225
- * automated scroll, fetch the page and just return undefined.
226
- * The datasource will be updated once the page is loaded and the cell will be rendered.
227
- *
228
- * We disable it during the automated scroll since we don't want to fetch pages for intervening cells the
229
- * user may never see.
230
- */
231
- if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {
232
- const pageNumber = Math.floor(index / this.pageSize) + 1;
233
- this.dataSource.fetchPage(pageNumber);
234
- }
235
- return model;
236
- }
237
- // this is the total number of tiles we expect if
238
- // the data returned is a full page worth
239
- // this is useful for putting in placeholders for the expected number of tiles
240
- get estimatedTileCount() {
241
- return this.pagesToRender * this.pageSize;
242
- }
243
- /**
244
- * Returns a promise resolving to a unique string that persists for the current browser session.
245
- * Used in generating unique IDs for search requests, so that multiple requests coming from the
246
- * same browser session can be identified.
247
- */
248
- async getSessionId() {
249
- try {
250
- const storedSessionId = sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem('cb-session');
251
- if (storedSessionId) {
252
- return storedSessionId;
253
- }
254
- // If we enter this method a second time while a first session ID is already being generated,
255
- // ensure we produce the same ID from both calls instead of generating another one.
256
- if (this.sessionIdGenPromise) {
257
- return this.sessionIdGenPromise;
258
- }
259
- this.sessionIdGenPromise = sha1(Math.random().toString());
260
- const newSessionId = await this.sessionIdGenPromise;
261
- sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.setItem('cb-session', newSessionId);
262
- return newSessionId;
263
- }
264
- catch (_a) {
265
- // Either we can't generate the hash or we're restricted from accessing sessionStorage
266
- return '';
267
- }
268
- }
269
- /**
270
- * Go to the given page of results
271
- *
272
- * @param pageNumber
273
- */
274
- goToPage(pageNumber) {
275
- this.initialPageNumber = pageNumber;
276
- this.pagesToRender = pageNumber;
277
- return this.scrollToPage(pageNumber);
278
- }
279
- /**
280
- * Sets the state for whether the initial set of search results is loading in.
281
- */
282
- setSearchResultsLoading(loading) {
283
- this.searchResultsLoading = loading;
284
- }
285
- /**
286
- * Sets the state for whether facet data is loading in
287
- */
288
- setFacetsLoading(loading) {
289
- this.facetsLoading = loading;
290
- }
291
- /**
292
- * Sets the total number of results to be displayed for the current search
293
- */
294
- setTotalResultCount(totalResults) {
295
- this.totalResults = totalResults;
296
- }
297
- /**
298
- * Clears all selected/negated facets, date ranges, and letter filters.
299
- *
300
- * By default, the current sort field/direction are not cleared,
301
- * but this can be overridden by setting the `sort` option to `true`.
302
- *
303
- * Similarly, it is possible to finely control what is cleared by
304
- * setting any of the `facets`, `dateRange`, or `letterFilters` flags
305
- * in the options object.
306
- */
307
- clearFilters({ facets = true, dateRange = true, letterFilters = true, sort = false, } = {}) {
308
- // Don't bother clearing facets if none are checked, so that we don't
309
- // trigger unnecessary update cycles.
310
- if (facets && this.hasCheckedFacets) {
311
- this.selectedFacets = getDefaultSelectedFacets();
312
- }
313
- if (dateRange) {
314
- this.minSelectedDate = undefined;
315
- this.maxSelectedDate = undefined;
316
- }
317
- if (letterFilters) {
318
- this.selectedTitleFilter = null;
319
- this.selectedCreatorFilter = null;
320
- }
321
- if (sort) {
322
- this.sortDirection = null;
323
- this.selectedSort = SortField.default;
324
- }
325
- if (this.smartFacetBar) {
326
- this.smartFacetBar.deselectAll();
327
- }
328
- }
329
- /**
330
- * Returns true if the current value of `this.selectedFacets` contains
331
- * any facet buckets than have been selected or negated, or false otherwise.
332
- */
333
- get hasCheckedFacets() {
334
- if (!this.selectedFacets)
335
- return false;
336
- for (const facetGroup of Object.values(this.selectedFacets)) {
337
- for (const bucket of Object.values(facetGroup)) {
338
- if (bucket.state !== 'none')
339
- return true;
340
- }
341
- }
342
- return false;
343
- }
344
- /**
345
- * Returns true if there are any currently selected/negated facet buckets,
346
- * any selected date range, or any selected letter filters. False otherwise.
347
- *
348
- * Ignores sorting options.
349
- */
350
- get hasActiveFilters() {
351
- return !!(this.hasCheckedFacets ||
352
- this.minSelectedDate ||
353
- this.maxSelectedDate ||
354
- this.selectedTitleFilter ||
355
- this.selectedCreatorFilter);
356
- }
357
- willUpdate() {
358
- this.setPlaceholderType();
359
- }
360
- render() {
361
- return html `
362
- ${this.showSmartFacetBar && this.placeholderType === null
363
- ? html `<smart-facet-bar
364
- .query=${this.baseQuery}
365
- .aggregations=${this.dataSource.aggregations}
366
- .selectedFacets=${this.selectedFacets}
367
- .collectionTitles=${this.dataSource.collectionTitles}
368
- .filterToggleShown=${!this.mobileView}
369
- .filterToggleActive=${this.facetPaneVisible}
370
- .label=${this.smartFacetBarLabel}
371
- @facetsChanged=${this.facetsChanged}
372
- @filtersToggled=${() => {
373
- this.facetPaneVisible = !this.facetPaneVisible;
374
- this.emitFacetPaneVisibilityChanged();
375
- }}
376
- ></smart-facet-bar>`
377
- : nothing}
378
-
379
- <div
380
- id="content-container"
381
- class=${this.mobileView ? 'mobile' : 'desktop'}
382
- >
383
- ${this.placeholderType
384
- ? this.emptyPlaceholderTemplate
385
- : this.collectionBrowserTemplate}
386
- </div>
387
- `;
388
- }
389
- /**
390
- * Determines what type of placeholder content should be shown instead of result tiles, if applicable.
391
- * The placeholders indicate states where we have no results to show, which could be the result of:
392
- * - No query is set (on the search page)
393
- * - No results were returned for the most recent search
394
- * - The collection being searched within has no viewable items
395
- * - An error occurred on the most recent search attempt
396
- */
397
- setPlaceholderType() {
398
- var _a, _b;
399
- const isInitialized = this.dataSource.queryInitialized;
400
- const hasQuery = !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
401
- const hasIdentifiers = !!((_b = this.identifiers) === null || _b === void 0 ? void 0 : _b.length);
402
- const isCollection = !!this.withinCollection;
403
- const isProfile = !!this.withinProfile;
404
- const isSearchResults = !isCollection && !isProfile;
405
- const noResults = !this.searchResultsLoading &&
406
- (this.dataSource.size === 0 || !this.searchService);
407
- this.placeholderType = null;
408
- if (this.suppressPlaceholders)
409
- return;
410
- if (!isInitialized) {
411
- this.placeholderType = 'empty-query';
412
- }
413
- else if (isSearchResults && !hasQuery && !hasIdentifiers) {
414
- this.placeholderType = 'empty-query';
415
- }
416
- else if (noResults) {
417
- // Within a collection, no query + no results means the collection simply has no viewable items.
418
- // Otherwise, we must have a user query that produced 0 results.
419
- this.placeholderType =
420
- !hasQuery && isCollection ? 'empty-collection' : 'no-results';
421
- }
422
- if (this.dataSource.queryErrorMessage) {
423
- this.placeholderType =
424
- !hasQuery && isCollection ? 'collection-error' : 'query-error';
425
- }
426
- }
427
- /**
428
- * Template for the placeholder content to show when no results are available.
429
- */
430
- get emptyPlaceholderTemplate() {
431
- var _a;
432
- return html `
433
- <empty-placeholder
434
- .placeholderType=${this.placeholderType}
435
- ?isMobileView=${this.mobileView}
436
- ?isCollection=${!!this.withinCollection}
437
- .detailMessage=${(_a = this.dataSource.queryErrorMessage) !== null && _a !== void 0 ? _a : ''}
438
- .baseNavigationUrl=${this.baseNavigationUrl}
439
- ></empty-placeholder>
440
- `;
441
- }
442
- /**
443
- * Top-level template for rendering the left (facets) and right (results) columns.
444
- */
445
- get collectionBrowserTemplate() {
446
- return html `
447
- <div id="left-column-scroll-sentinel"></div>
448
- ${this.leftColumnTemplate} ${this.rightColumnTemplate}
449
- `;
450
- }
451
- /**
452
- * Template for either the mobile or desktop version of the left column, depending
453
- * on current component state.
454
- */
455
- get leftColumnTemplate() {
456
- if (this.mobileView) {
457
- return this.mobileLeftColumnTemplate;
458
- }
459
- return this.desktopLeftColumnTemplate;
460
- }
461
- /**
462
- * Template for the mobile version of the "left column" (which in this case, appears
463
- * *above* the search results rather than beside them), for rendering the
464
- * accordion-style facets.
465
- */
466
- get mobileLeftColumnTemplate() {
467
- return html `
468
- <div
469
- id="left-column"
470
- class="column${this.isResizeToMobile ? ' preload' : ''}"
471
- >
472
- ${this.facetTopViewSlot} ${this.resultsCountTemplate}
473
- <div id="facets-header-container">${this.mobileFacetsTemplate}</div>
474
- </div>
475
- `;
476
- }
477
- /**
478
- * Template for the desktop version of the left column, displaying the facets sidebar.
479
- */
480
- get desktopLeftColumnTemplate() {
481
- return html `
482
- <div id="left-column" class="column" ?hidden=${!this.facetPaneVisible}>
483
- ${this.facetTopViewSlot}
484
- <div id="facets-header-container">
485
- <h2 id="facets-header" class="sr-only">${msg('Filters')}</h2>
486
- ${this.resultsCountTemplate} ${this.clearFiltersBtnTemplate(false)}
487
- </div>
488
- <div id="facets-container" aria-labelledby="facets-header">
489
- ${this.facetsTemplate}
490
- <div id="facets-scroll-sentinel"></div>
491
- </div>
492
- <div id="facets-bottom-fade"></div>
493
- </div>
494
- `;
495
- }
496
- /**
497
- * Slot which is placed at top of the facets area for user-profile page
498
- * - mainly used to render userlists
499
- */
500
- get facetTopViewSlot() {
501
- return html `<div id="facet-top-view">
502
- <slot name="facet-top-slot"></slot>
503
- </div>`;
504
- }
505
- /**
506
- * Template for the "X Results" count at the top of the search results.
507
- * Changes to the "Searching..." label if the search results are still loading.
508
- */
509
- get resultsCountTemplate() {
510
- var _a;
511
- if (this.suppressResultCount)
512
- return nothing;
513
- const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
514
- const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
515
- const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
516
- // Added data-testid for Playwright testing
517
- return html `
518
- <div id="results-total" data-testid="results-total">
519
- <span id="big-results-count">
520
- ${shouldShowSearching ? html `Searching&hellip;` : resultsCount}
521
- </span>
522
- <span id="big-results-label">
523
- ${shouldShowSearching ? nothing : resultsLabel}
524
- </span>
525
- </div>
526
- `;
527
- }
528
- /**
529
- * Template for the right column of the collection browser, where the result
530
- * tiles and sort/filter bar are shown.
531
- */
532
- get rightColumnTemplate() {
533
- const rightColumnClasses = classMap({
534
- column: true,
535
- 'full-width': !this.facetPaneVisible,
536
- 'smart-results-spacing': !!this.showSmartResults,
537
- });
538
- return html `
539
- <div id="right-column" class=${rightColumnClasses}>
540
- ${this.showSmartResults
541
- ? html `<slot name="smart-results"></slot>`
542
- : nothing}
543
- <section id="results">
544
- <h2 class="results-section-heading">
545
- <slot name="results-heading"></slot>
546
- </h2>
547
- <div id="cb-top-view">
548
- <slot name="cb-top-slot"></slot>
549
- </div>
550
- ${this.isManageView
551
- ? this.manageBarTemplate
552
- : this.sortFilterBarTemplate}
553
- <slot name="cb-results"></slot>
554
- ${this.displayMode === `list-compact` && this.totalResults
555
- ? this.listHeaderTemplate
556
- : nothing}
557
- ${this.suppressResultTiles ? nothing : this.infiniteScrollerTemplate}
558
- </section>
559
- </div>
560
- `;
561
- }
562
- /**
563
- * Template for the infinite scroller widget that contains the result tiles.
564
- */
565
- get infiniteScrollerTemplate() {
566
- return html `<infinite-scroller
567
- class=${this.infiniteScrollerClasses}
568
- itemCount=${this.placeholderType ? 0 : nothing}
569
- ariaLandmarkLabel="Search results"
570
- .cellProvider=${this}
571
- .placeholderCellTemplate=${this.placeholderCellTemplate}
572
- @scrollThresholdReached=${this.scrollThresholdReached}
573
- @visibleCellsChanged=${this.visibleCellsChanged}
574
- >${this.displayMode === 'grid'
575
- ? html `<slot name="result-last-tile" slot="result-last-tile"></slot>`
576
- : nothing}
577
- </infinite-scroller>`;
578
- }
579
- /**
580
- * Produces a `classMap` indicating which classes the infinite scroller should have
581
- * given the current display mode & placeholder case.
582
- */
583
- get infiniteScrollerClasses() {
584
- var _a;
585
- return classMap({
586
- [(_a = this.displayMode) !== null && _a !== void 0 ? _a : '']: !!this.displayMode,
587
- hidden: !!this.placeholderType,
588
- });
589
- }
590
- /**
591
- * Template for the sort & filtering bar that appears atop the search results.
592
- */
593
- get sortFilterBarTemplate() {
594
- var _a;
595
- if (this.suppressSortBar)
596
- return nothing;
597
- // Determine the set of sortable fields that should be shown in the sort bar
598
- let defaultViewSort = SortField.weeklyview;
599
- let defaultDateSort = SortField.date;
600
- let sortFieldAvailability = defaultSortAvailability;
601
- // We adjust the sort options for a couple of special cases...
602
- if ((_a = this.withinCollection) === null || _a === void 0 ? void 0 : _a.startsWith('fav-')) {
603
- // When viewing a fav- collection, we include the Date Favorited option and show
604
- // it as the default in the date dropdown.
605
- defaultDateSort = SortField.datefavorited;
606
- sortFieldAvailability = favoritesSortAvailability;
607
- }
608
- else if (!this.withinCollection && this.searchType === SearchType.TV) {
609
- // When viewing TV search results, we default the views dropdown to All-time Views
610
- // and exclude several of the usual date sort options.
611
- defaultViewSort = SortField.alltimeview;
612
- defaultDateSort = SortField.datearchived;
613
- sortFieldAvailability = tvSortAvailability;
614
- }
615
- // We only show relevance sort if a search query is currently defined
616
- sortFieldAvailability.relevance = this.isRelevanceSortAvailable;
617
- return html `
618
- <sort-filter-bar
619
- .defaultSortField=${this.defaultSortField}
620
- .defaultSortDirection=${this.defaultSortDirection}
621
- .defaultViewSort=${defaultViewSort}
622
- .defaultDateSort=${defaultDateSort}
623
- .selectedSort=${this.selectedSort}
624
- .sortDirection=${this.sortDirection}
625
- .sortFieldAvailability=${sortFieldAvailability}
626
- .displayMode=${this.displayMode}
627
- .selectedTitleFilter=${this.selectedTitleFilter}
628
- .selectedCreatorFilter=${this.selectedCreatorFilter}
629
- .prefixFilterCountMap=${this.dataSource.prefixFilterCountMap}
630
- .resizeObserver=${this.resizeObserver}
631
- .enableSortOptionsSlot=${this.enableSortOptionsSlot}
632
- .suppressDisplayModes=${this.suppressDisplayModes}
633
- @sortChanged=${this.userChangedSort}
634
- @displayModeChanged=${this.displayModeChanged}
635
- @titleLetterChanged=${this.titleLetterSelected}
636
- @creatorLetterChanged=${this.creatorLetterSelected}
637
- >
638
- ${this.tileBlurCheckboxTemplate}
639
- <slot name="sort-options-left" slot="sort-options-left"></slot>
640
- <slot name="sort-options" slot="sort-options"></slot>
641
- <slot name="sort-options-right" slot="sort-options-right"></slot>
642
- </sort-filter-bar>
643
- `;
644
- }
645
- /**
646
- * Template for the Blurring toggle for admins to enable/disable blurring of
647
- * sensitive content in result tiles.
648
- */
649
- get tileBlurCheckboxTemplate() {
650
- var _a;
651
- // Only show the checkbox for @archive.org users
652
- if (!((_a = this.dataSource.sessionContext) === null || _a === void 0 ? void 0 : _a.is_archive_user))
653
- return nothing;
654
- return html `
655
- <label
656
- id="tile-blur-label"
657
- for="tile-blur-check"
658
- slot="sort-options-right"
659
- >
660
- ${msg('Blurring')}
661
- <input
662
- id="tile-blur-check"
663
- type="checkbox"
664
- ?checked=${!this.shouldSuppressTileBlurring}
665
- @change=${this.tileBlurCheckboxChanged}
666
- />
667
- </label>
668
- `;
669
- }
670
- /**
671
- * Message to show in the manage view modal, depending on context.
672
- */
673
- get manageViewModalMsg() {
674
- const pluralize = this.dataSource.checkedTileModels.length > 1;
675
- switch (this.profileElement) {
676
- case 'uploads':
677
- return pluralize
678
- ? msg('Note: It may take a few minutes for these items to stop appearing in your uploads list.')
679
- : msg('Note: It may take a few minutes for this item to stop appearing in your uploads list.');
680
- case 'web_archives':
681
- return pluralize
682
- ? msg('Note: It may take a few minutes for these items to stop appearing in your web archives list.')
683
- : msg('Note: It may take a few minutes for this item to stop appearing in your web archives list.');
684
- default:
685
- return '';
686
- }
687
- }
688
- /**
689
- * Template for the manage bar UI that appears atop the search results when we are
690
- * showing the management view. This generally replaces the sort bar when present.
691
- */
692
- get manageBarTemplate() {
693
- return html `
694
- <manage-bar
695
- .label=${this.manageViewLabel}
696
- .modalManager=${this.modalManager}
697
- .selectedItems=${this.dataSource.checkedTileModels}
698
- .manageViewModalMsg=${this.manageViewModalMsg}
699
- showSelectAll
700
- showUnselectAll
701
- ?showItemManageButton=${this.pageContext === 'search'}
702
- ?removeAllowed=${this.dataSource.checkedTileModels.length !== 0}
703
- @removeItems=${this.handleRemoveItems}
704
- @manageItems=${this.handleManageItems}
705
- @selectAll=${() => this.dataSource.checkAllTiles()}
706
- @unselectAll=${() => this.dataSource.uncheckAllTiles()}
707
- @cancel=${() => {
708
- this.isManageView = false;
709
- this.dataSource.uncheckAllTiles();
710
- if (this.searchResultsLoading)
711
- this.dataSource.resetPages();
712
- }}
713
- ></manage-bar>
714
- `;
715
- }
716
- /**
717
- * Handler for when the user requests to remove all checked items via the manage bar.
718
- * Emits an `itemRemovalRequested` event with all checked tile models.
719
- */
720
- handleRemoveItems() {
721
- this.dispatchEvent(new CustomEvent('itemRemovalRequested', {
722
- detail: {
723
- items: this.dataSource.checkedTileModels.map(model => {
724
- var _a;
725
- // For favorited searches, we attach a search: prefix to differentiate it from an item
726
- const searchPrefix = (model === null || model === void 0 ? void 0 : model.mediatype) === 'search' ? 'search:' : '';
727
- const identifier = (_a = model === null || model === void 0 ? void 0 : model.identifier) !== null && _a !== void 0 ? _a : '';
728
- return `${searchPrefix}${identifier}`;
729
- }),
730
- },
731
- }));
732
- }
733
- /**
734
- * Handler when user request to bulk edit from /search/ page
735
- */
736
- handleManageItems() {
737
- this.dispatchEvent(new CustomEvent('itemManagerRequested', {
738
- detail: {
739
- items: this.dataSource.checkedTileModels.map(model => (model === null || model === void 0 ? void 0 : model.identifier) ? model.identifier : ''),
740
- },
741
- }));
742
- }
743
- refreshSmartFacets() {
744
- var _a;
745
- (_a = this.smartFacetBar) === null || _a === void 0 ? void 0 : _a.refresh();
746
- }
747
- /**
748
- * Handler to show processing modal while removing item
749
- */
750
- showRemoveItemsProcessingModal() {
751
- var _a;
752
- (_a = this.manageBar) === null || _a === void 0 ? void 0 : _a.showRemoveItemsProcessingModal();
753
- }
754
- /**
755
- * Handler to show error modal when item removal failed
756
- */
757
- showRemoveItemsErrorModal() {
758
- var _a;
759
- (_a = this.manageBar) === null || _a === void 0 ? void 0 : _a.showRemoveItemsErrorModal();
760
- }
761
- /**
762
- * Removes all tile models that are currently checked & adjusts the paging
763
- * of the data source to account for any new gaps in the data.
764
- */
765
- removeCheckedTiles() {
766
- this.dataSource.removeCheckedTiles();
767
- }
768
- /**
769
- * Handler for when the tile blurring checkbox state is toggled
770
- */
771
- tileBlurCheckboxChanged(e) {
772
- var _a;
773
- const { checked } = e.target;
774
- this.tileBlurOverrideState = checked ? 'on' : 'off';
775
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
776
- }
777
- /**
778
- * Whether result tiles should have the default blurring of sensitive content suppressed.
779
- * First considers any override specified by the user, falling back to the setting in
780
- * user preferences if not overridden.
781
- */
782
- get shouldSuppressTileBlurring() {
783
- if (this.tileBlurOverrideState !== 'no-override') {
784
- // User wants to override their preference.
785
- // Return true if they want blurring turned off, or false otherwise.
786
- return this.tileBlurOverrideState === 'off';
787
- }
788
- // Not overriding, so use the preference from session context
789
- const { sessionContext } = this.dataSource;
790
- const userPrefs = sessionContext === null || sessionContext === void 0 ? void 0 : sessionContext.pps_relevant_user_preferences;
791
- const blurringPref = userPrefs === null || userPrefs === void 0 ? void 0 : userPrefs.display__blur_moderated_content;
792
- // Only suppress blurring if the preference is disabled.
793
- // If enabled or missing, tile blurring remains on.
794
- return blurringPref === 'off';
795
- }
796
- /**
797
- * Handler for when the user changes the selected sort option or direction.
798
- */
799
- userChangedSort(e) {
800
- var _a;
801
- const { selectedSort, sortDirection } = e.detail;
802
- this.selectedSort = selectedSort;
803
- this.sortDirection = sortDirection;
804
- if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
805
- this.goToPage(1);
806
- }
807
- this.currentPage = 1;
808
- }
809
- /**
810
- * Fires an analytics event for sorting changes.
811
- * @param prevSortDirection Which sort direction was previously set.
812
- */
813
- sendSortByAnalytics(prevSortDirection) {
814
- var _a;
815
- const directionCleared = prevSortDirection && !this.sortDirection;
816
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
817
- category: this.searchContext,
818
- action: analyticsActions.sortBy,
819
- label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
820
- });
821
- }
822
- /**
823
- * Handler for when the selected sort option is updated, whether by the user
824
- * themselves or programmatically.
825
- */
826
- selectedSortChanged() {
827
- // Lazy-load the alphabet counts for title/creator sort bar as needed
828
- this.dataSource.updatePrefixFiltersForCurrentSort();
829
- }
830
- /**
831
- * An object representing the current sort field & direction.
832
- */
833
- get sortParam() {
834
- var _a;
835
- const sortOption = SORT_OPTIONS[this.selectedSort];
836
- if (!(sortOption === null || sortOption === void 0 ? void 0 : sortOption.handledBySearchService)) {
837
- return null;
838
- }
839
- // If the sort option specified in the URL is unrecognized, we just use it as-is
840
- const urlSortParam = new URL(window.location.href).searchParams.get('sort');
841
- const sortField = (_a = sortOption.searchServiceKey) !== null && _a !== void 0 ? _a : urlSortParam === null || urlSortParam === void 0 ? void 0 : urlSortParam.replace(/^-/, '');
842
- // If the sort direction is still null at this point, then we assume ascending
843
- // (i.e., it was unrecognized and had no directional flag)
844
- if (!this.sortDirection)
845
- this.sortDirection = 'asc';
846
- if (!sortField)
847
- return null;
848
- return { field: sortField, direction: this.sortDirection };
849
- }
850
- /**
851
- * An object representing the default sort field & direction, if none are explicitly set.
852
- */
853
- get defaultSortParam() {
854
- var _a;
855
- const direction = (_a = this.defaultSortDirection) !== null && _a !== void 0 ? _a : 'asc';
856
- const field = SORT_OPTIONS[this.defaultSortField].searchServiceKey;
857
- if (!field)
858
- return null;
859
- return { field, direction };
860
- }
861
- /**
862
- * Handler for when the display mode option is changed (grid/list/compact-list views).
863
- */
864
- displayModeChanged(e) {
865
- var _a;
866
- this.displayMode = e.detail.displayMode;
867
- if (this.displayMode) {
868
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
869
- category: this.searchContext,
870
- action: analyticsActions.displayMode,
871
- label: this.displayMode,
872
- });
873
- }
874
- }
875
- /**
876
- * Returns a query clause identifying the currently selected title filter,
877
- * e.g., `firstTitle:X`.
878
- */
879
- get titleQuery() {
880
- return this.selectedTitleFilter
881
- ? `firstTitle:${this.selectedTitleFilter}`
882
- : undefined;
883
- }
884
- /**
885
- * Returns a query clause identifying the currently selected creator filter,
886
- * e.g., `firstCreator:X`.
887
- */
888
- get creatorQuery() {
889
- return this.selectedCreatorFilter
890
- ? `firstCreator:${this.selectedCreatorFilter}`
891
- : undefined;
892
- }
893
- /**
894
- * Send Analytics when sorting by title's first letter
895
- * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
896
- */
897
- sendFilterByTitleAnalytics(prevSelectedLetter) {
898
- var _a;
899
- if (!prevSelectedLetter && !this.selectedTitleFilter) {
900
- return;
901
- }
902
- const cleared = prevSelectedLetter && !this.selectedTitleFilter;
903
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
904
- category: this.searchContext,
905
- action: analyticsActions.filterByTitle,
906
- label: cleared
907
- ? `clear-${prevSelectedLetter}`
908
- : `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
909
- });
910
- }
911
- /**
912
- * Send Analytics when filtering by creator's first letter
913
- * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
914
- */
915
- sendFilterByCreatorAnalytics(prevSelectedLetter) {
916
- var _a;
917
- if (!prevSelectedLetter && !this.selectedCreatorFilter) {
918
- return;
919
- }
920
- const cleared = prevSelectedLetter && !this.selectedCreatorFilter;
921
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
922
- category: this.searchContext,
923
- action: analyticsActions.filterByCreator,
924
- label: cleared
925
- ? `clear-${prevSelectedLetter}`
926
- : `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
927
- });
928
- }
929
- /**
930
- * Handler for changes to which letter is selected in the title alphabet bar.
931
- */
932
- titleLetterSelected(e) {
933
- this.selectedCreatorFilter = null;
934
- this.selectedTitleFilter = e.detail.selectedLetter;
935
- }
936
- /**
937
- * Handler for changes to which letter is selected in the creator alphabet bar.
938
- */
939
- creatorLetterSelected(e) {
940
- this.selectedTitleFilter = null;
941
- this.selectedCreatorFilter = e.detail.selectedLetter;
942
- }
943
- /**
944
- * The full template for how the facets should be structured in mobile view,
945
- * including the collapsible container (with header) and the facets themselves.
946
- */
947
- get mobileFacetsTemplate() {
948
- if (FACETLESS_PAGE_ELEMENTS.includes(this.profileElement))
949
- return nothing;
950
- const toggleFacetsVisible = (e) => {
951
- var _a;
952
- const target = e.target;
953
- this.isResizeToMobile = false;
954
- this.collapsibleFacetsVisible = target.open;
955
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
956
- category: this.searchContext,
957
- action: analyticsActions.mobileFacetsToggled,
958
- label: target.open ? 'open' : 'closed',
959
- });
960
- };
961
- return html `
962
- <details id="mobile-filter-collapse" @toggle=${toggleFacetsVisible}>
963
- <summary>
964
- <span class="collapser-icon">${chevronIcon}</span>
965
- <h2>${msg('Filters')}</h2>
966
- ${this.clearFiltersBtnTemplate(true)}
967
- </summary>
968
- ${this.facetsTemplate}
969
- </details>
970
- `;
971
- }
972
- /**
973
- * The template for the facets component alone, without any surrounding wrappers.
974
- */
975
- get facetsTemplate() {
976
- if (FACETLESS_PAGE_ELEMENTS.includes(this.profileElement))
977
- return nothing;
978
- if (this.facetLoadStrategy === 'off') {
979
- return html `
980
- <p class="facets-message">
981
- ${msg('Facets are temporarily unavailable.')}
982
- </p>
983
- `;
984
- }
985
- // We switch to TV facet ordering & date picker if we are in a TV collection or showing TV search results
986
- const shouldUseTvInterface = this.isTVCollection ||
987
- (!this.withinCollection && this.searchType === SearchType.TV);
988
- const facetDisplayOrder = shouldUseTvInterface
989
- ? tvFacetDisplayOrder
990
- : defaultFacetDisplayOrder;
991
- const facets = html `
992
- <collection-facets
993
- .collectionPagePath=${this.collectionPagePath}
994
- .parentCollections=${this.dataSource.parentCollections}
995
- .pageSpecifierParams=${this.dataSource.pageSpecifierParams}
996
- .searchService=${this.searchService}
997
- .featureFeedbackService=${this.featureFeedbackService}
998
- .recaptchaManager=${this.recaptchaManager}
999
- .resizeObserver=${this.resizeObserver}
1000
- .searchType=${this.searchType}
1001
- .aggregations=${this.dataSource.aggregations}
1002
- .histogramAggregation=${this.dataSource.histogramAggregation}
1003
- .minSelectedDate=${this.minSelectedDate}
1004
- .maxSelectedDate=${this.maxSelectedDate}
1005
- .selectedFacets=${this.selectedFacets}
1006
- .baseNavigationUrl=${this.baseNavigationUrl}
1007
- .collectionTitles=${this.dataSource.collectionTitles}
1008
- .tvChannelAliases=${this.dataSource.tvChannelAliases}
1009
- .showHistogramDatePicker=${this.showHistogramDatePicker}
1010
- .allowExpandingDatePicker=${!this.mobileView}
1011
- .allowDatePickerMonths=${shouldUseTvInterface}
1012
- .contentWidth=${this.contentWidth}
1013
- .query=${this.baseQuery}
1014
- .identifiers=${this.identifiers}
1015
- .filterMap=${this.dataSource.filterMap}
1016
- .isManageView=${this.isManageView}
1017
- .modalManager=${this.modalManager}
1018
- .analyticsHandler=${this.analyticsHandler}
1019
- .facetDisplayOrder=${facetDisplayOrder}
1020
- .isTvSearch=${shouldUseTvInterface}
1021
- ?collapsableFacets=${this.mobileView}
1022
- ?facetsLoading=${this.facetsLoading}
1023
- ?histogramAggregationLoading=${this.facetsLoading}
1024
- ?suppressMediatypeFacets=${this.suppressMediatypeFacets}
1025
- @facetClick=${this.facetClickHandler}
1026
- @facetsChanged=${this.facetsChanged}
1027
- @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
1028
- >
1029
- </collection-facets>
1030
- `;
1031
- // If we are using one of the opt-in facet load strategies, we may need to wrap the
1032
- // desktop view facets in a <details> widget so that patrons can opt into loading them.
1033
- // In the `opt-in-or-login` case, we only do this if they are not logged in.
1034
- const showDesktopOptInWidget = this.facetLoadStrategy === 'opt-in' ||
1035
- (this.facetLoadStrategy === 'opt-in-or-login' && !this.loggedIn);
1036
- if (showDesktopOptInWidget && !this.mobileView) {
1037
- return html `
1038
- <details
1039
- class="desktop-facets-dropdown"
1040
- @toggle=${(e) => {
1041
- const target = e.target;
1042
- this.collapsibleFacetsVisible = target.open;
1043
- }}
1044
- >
1045
- <summary>
1046
- <span class="collapser-icon">${chevronIcon}</span>
1047
- <h2>${msg('Filters')}</h2>
1048
- </summary>
1049
- ${facets}
1050
- </details>
1051
- `;
1052
- }
1053
- // Otherwise, just render the facets component bare
1054
- return facets;
1055
- }
1056
- /**
1057
- * The HTML template for the "Clear all filters" button, or `nothing` if no
1058
- * filters are currently active.
1059
- *
1060
- * @param mobile Whether to style/shorten the button for mobile view
1061
- */
1062
- clearFiltersBtnTemplate(mobile) {
1063
- if (!this.hasActiveFilters)
1064
- return nothing;
1065
- const buttonClasses = classMap({
1066
- 'clear-filters-btn': true,
1067
- mobile,
1068
- });
1069
- const buttonText = mobile ? 'Clear all' : 'Clear all filters';
1070
- return html `
1071
- <div class="clear-filters-btn-row">
1072
- ${mobile
1073
- ? html `<span class="clear-filters-btn-separator">&nbsp;</span>`
1074
- : nothing}
1075
- <button class=${buttonClasses} @click=${this.clearFilters}>
1076
- ${buttonText}
1077
- </button>
1078
- </div>
1079
- `;
1080
- }
1081
- /**
1082
- * Template for the table header content that appears atop the compact list view.
1083
- */
1084
- get listHeaderTemplate() {
1085
- return html `
1086
- <div id="list-header">
1087
- <tile-dispatcher
1088
- .tileDisplayMode=${'list-header'}
1089
- .resizeObserver=${this.resizeObserver}
1090
- .sortParam=${this.sortParam}
1091
- .defaultSortParam=${this.defaultSortParam}
1092
- .mobileBreakpoint=${this.mobileBreakpoint}
1093
- .loggedIn=${this.loggedIn}
1094
- .suppressBlurring=${this.shouldSuppressTileBlurring}
1095
- >
1096
- </tile-dispatcher>
1097
- </div>
1098
- `;
1099
- }
1100
- /**
1101
- * Handler for when the date picker's date range is changed.
1102
- */
1103
- histogramDateRangeUpdated(e) {
1104
- var _a;
1105
- const { minDate, maxDate } = e.detail;
1106
- [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
1107
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
1108
- category: this.searchContext,
1109
- action: analyticsActions.histogramChanged,
1110
- label: this.dateRangeQueryClause,
1111
- });
1112
- }
1113
- /**
1114
- * The Lucene query corresponding to the current date range.
1115
- */
1116
- get dateRangeQueryClause() {
1117
- if (!this.minSelectedDate || !this.maxSelectedDate) {
1118
- return undefined;
1119
- }
1120
- return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;
1121
- }
1122
- /**
1123
- * Emits an event indicating a change in whether the manage mode is shown.
1124
- */
1125
- emitManageModeChangedEvent() {
1126
- this.dispatchEvent(new CustomEvent('manageModeChanged', {
1127
- detail: this.isManageView,
1128
- }));
1129
- }
1130
- /**
1131
- * Installs a new data source component and associated query state parameters into
1132
- * this component, causing it to efficiently update its views to represent the
1133
- * newly-provided data. In this way, one can reuse a single instance of
1134
- * <collection-browser> to handle multiple different sets of search results on
1135
- * a single page, each set of results being loaded & updated by its own data
1136
- * source.
1137
- *
1138
- * @param dataSource The data source component containing (or prepared to fetch)
1139
- * the tile data to be displayed.
1140
- * @param queryState The new query-related state that this component should
1141
- * represent, such as the search query, sort option, and any filters applied.
1142
- */
1143
- async installDataSourceAndQueryState(dataSource, queryState) {
1144
- var _a, _b, _c;
1145
- log('Installing data source & query state in CB:', dataSource, queryState);
1146
- if (this.dataSource)
1147
- this.removeController(this.dataSource);
1148
- this.dataSource = dataSource;
1149
- this.addController(this.dataSource);
1150
- this.baseQuery = queryState.baseQuery;
1151
- this.profileElement = queryState.profileElement;
1152
- this.searchType = queryState.searchType;
1153
- this.selectedFacets =
1154
- (_a = queryState.selectedFacets) !== null && _a !== void 0 ? _a : getDefaultSelectedFacets();
1155
- this.internalFilters = queryState.internalFilters;
1156
- this.minSelectedDate = queryState.minSelectedDate;
1157
- this.maxSelectedDate = queryState.maxSelectedDate;
1158
- this.selectedSort = (_b = queryState.selectedSort) !== null && _b !== void 0 ? _b : SortField.default;
1159
- this.sortDirection = queryState.sortDirection;
1160
- this.selectedTitleFilter = queryState.selectedTitleFilter;
1161
- this.selectedCreatorFilter = queryState.selectedCreatorFilter;
1162
- this.tvClipFilter = (_c = queryState.tvClipFilter) !== null && _c !== void 0 ? _c : 'all';
1163
- this.pagesToRender = this.initialPageNumber;
1164
- // We set this flag during the update to prevent the URL state persistence
1165
- // from creating an unwanted extra history entry.
1166
- this.dataSourceInstallInProgress = true;
1167
- this.requestUpdate();
1168
- await this.updateComplete;
1169
- this.dataSourceInstallInProgress = false;
1170
- if (!this.searchResultsLoading) {
1171
- this.setTotalResultCount(this.dataSource.totalResults);
1172
- this.setTileCount(this.dataSource.size);
1173
- }
1174
- this.refreshVisibleResults();
1175
- }
1176
- firstUpdated() {
1177
- this.restoreState();
1178
- this.setInitialSize();
1179
- }
1180
- /**
1181
- * Determines the initial size of the content container and whether or not
1182
- * the mobile layout should be used.
1183
- */
1184
- setInitialSize() {
1185
- this.contentWidth = this.contentContainer.getBoundingClientRect().width;
1186
- this.mobileView =
1187
- this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
1188
- this.sendLayoutSizeAnalytics();
1189
- }
1190
- /**
1191
- * Fires an analytics event indicating which type of layout was rendered:
1192
- * mobile or desktop.
1193
- */
1194
- sendLayoutSizeAnalytics() {
1195
- if (this.analyticsHandler) {
1196
- this.layoutSizeAnalyticsSent = true;
1197
- this.analyticsHandler.sendEvent({
1198
- category: this.searchContext,
1199
- action: this.mobileView
1200
- ? analyticsActions.loadMobileView
1201
- : analyticsActions.loadDesktopView,
1202
- });
1203
- }
1204
- }
1205
- updated(changed) {
1206
- var _a, _b, _c;
1207
- if (changed.has('placeholderType') && this.placeholderType === null) {
1208
- if (!this.leftColIntersectionObserver) {
1209
- this.setupLeftColumnScrollListeners();
1210
- }
1211
- if (!this.facetsIntersectionObserver) {
1212
- this.setupFacetsScrollListeners();
1213
- }
1214
- this.updateLeftColumnHeight();
1215
- }
1216
- if (changed.has('analyticsHandler') && !this.layoutSizeAnalyticsSent) {
1217
- this.sendLayoutSizeAnalytics();
1218
- }
1219
- if (changed.has('displayMode') ||
1220
- changed.has('baseNavigationUrl') ||
1221
- changed.has('baseImageUrl') ||
1222
- changed.has('loggedIn')) {
1223
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
1224
- }
1225
- if (changed.has('baseQuery') ||
1226
- changed.has('identifiers') ||
1227
- changed.has('searchType') ||
1228
- changed.has('withinCollection')) {
1229
- // Unless this query/search type update is from the initial page load or the
1230
- // result of hitting the back button,
1231
- // we need to clear any existing filters since they may no longer be valid for
1232
- // the new set of search results.
1233
- if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
1234
- // Ordinarily, we leave the sort param unchanged between searches.
1235
- // However, if we are changing the target collection itself, we want the sort cleared too,
1236
- // since different collections may have different sorting options available.
1237
- const shouldClearSort = changed.has('withinCollection') &&
1238
- !changed.has('selectedSort') &&
1239
- !changed.has('sortDirection');
1240
- // Otherwise, only clear filters that haven't been simultaneously applied in this update
1241
- this.clearFilters({
1242
- sort: shouldClearSort,
1243
- facets: !changed.has('selectedFacets'),
1244
- dateRange: !(changed.has('minSelectedDate') || changed.has('maxSelectedDate')),
1245
- letterFilters: !(changed.has('selectedTitleFilter') ||
1246
- changed.has('selectedCreatorFilter')),
1247
- });
1248
- }
1249
- }
1250
- if (changed.has('profileElement')) {
1251
- this.applyDefaultProfileSort();
1252
- }
1253
- if (changed.has('baseQuery')) {
1254
- this.emitBaseQueryChanged();
1255
- }
1256
- if (changed.has('searchType')) {
1257
- this.emitSearchTypeChanged();
1258
- }
1259
- if (changed.has('currentPage') || changed.has('displayMode')) {
1260
- this.persistState();
1261
- }
1262
- if (changed.has('baseQuery') ||
1263
- changed.has('identifiers') ||
1264
- changed.has('minSelectedDate') ||
1265
- changed.has('maxSelectedDate') ||
1266
- changed.has('selectedFacets') ||
1267
- changed.has('searchService') ||
1268
- changed.has('withinCollection') ||
1269
- changed.has('withinProfile') ||
1270
- changed.has('profileElement')) {
1271
- this.dataSource.refreshLetterCounts();
1272
- }
1273
- if (changed.has('selectedSort') || changed.has('sortDirection')) {
1274
- const prevSortDirection = changed.get('sortDirection');
1275
- this.sendSortByAnalytics(prevSortDirection);
1276
- this.selectedSortChanged();
1277
- }
1278
- if (changed.has('selectedTitleFilter')) {
1279
- this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
1280
- }
1281
- if (changed.has('selectedCreatorFilter')) {
1282
- this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
1283
- }
1284
- this.updateFacetReadiness();
1285
- if (changed.has('baseQuery') ||
1286
- changed.has('identifiers') ||
1287
- changed.has('searchType') ||
1288
- changed.has('selectedTitleFilter') ||
1289
- changed.has('selectedCreatorFilter') ||
1290
- changed.has('minSelectedDate') ||
1291
- changed.has('maxSelectedDate') ||
1292
- changed.has('selectedSort') ||
1293
- changed.has('sortDirection') ||
1294
- changed.has('selectedFacets') ||
1295
- changed.has('searchService') ||
1296
- changed.has('withinCollection') ||
1297
- changed.has('withinProfile') ||
1298
- changed.has('profileElement')) {
1299
- this.handleQueryChange();
1300
- }
1301
- if (changed.has('searchResultsLoading')) {
1302
- this.emitSearchResultsLoadingChanged();
1303
- }
1304
- if (changed.has('facetsLoading') &&
1305
- this.facetsLoading &&
1306
- this.collectionFacets) {
1307
- this.collectionFacets.moreLinksVisible =
1308
- this.searchType !== SearchType.FULLTEXT;
1309
- }
1310
- if (changed.has('pagesToRender')) {
1311
- if (!this.dataSource.endOfDataReached && this.infiniteScroller) {
1312
- this.infiniteScroller.itemCount = this.estimatedTileCount;
1313
- }
1314
- }
1315
- if (changed.has('isManageView')) {
1316
- if (this.isManageView) {
1317
- this.displayMode = 'grid';
1318
- this.fetchManageableSearchResults();
1319
- }
1320
- else if (this.pageContext === 'search')
1321
- (_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.reload();
1322
- (_c = this.infiniteScroller) === null || _c === void 0 ? void 0 : _c.refreshAllVisibleCells();
1323
- // Only emit change event if changing b/w true & false, not on initial value set.
1324
- if (changed.get('isManageView') !== undefined) {
1325
- this.emitManageModeChangedEvent();
1326
- }
1327
- }
1328
- if (changed.has('resizeObserver')) {
1329
- const oldObserver = changed.get('resizeObserver');
1330
- if (oldObserver)
1331
- this.disconnectResizeObserver(oldObserver);
1332
- this.setupResizeObserver();
1333
- }
1334
- this.ensureAvailableTilesDisplayed();
1335
- }
1336
- connectedCallback() {
1337
- var _a;
1338
- (_a = super.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
1339
- this.setupStateRestorationObserver();
1340
- this.setupResizeObserver();
1341
- }
1342
- disconnectedCallback() {
1343
- var _a, _b;
1344
- if (this.resizeObserver) {
1345
- this.disconnectResizeObserver(this.resizeObserver);
1346
- }
1347
- if (this.boundNavigationHandler) {
1348
- window.removeEventListener('popstate', this.boundNavigationHandler);
1349
- }
1350
- (_a = this.leftColIntersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
1351
- (_b = this.facetsIntersectionObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
1352
- window.removeEventListener('resize', this.updateLeftColumnHeight);
1353
- }
1354
- handleResize(entry) {
1355
- const previousView = this.mobileView;
1356
- if (entry.target === this.contentContainer) {
1357
- this.contentWidth = entry.contentRect.width;
1358
- this.mobileView =
1359
- this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
1360
- // If changing from desktop to mobile disable transition
1361
- if (this.mobileView && !previousView) {
1362
- this.isResizeToMobile = true;
1363
- }
1364
- }
1365
- // Ensure the facet sidebar remains sized correctly
1366
- this.updateLeftColumnHeight();
1367
- }
1368
- /**
1369
- * Ensures that if we have new results from the data source that are not yet
1370
- * displayed in the infinite scroller, that they are immediately reflected
1371
- * in the tile count.
1372
- */
1373
- ensureAvailableTilesDisplayed() {
1374
- if (this.infiniteScroller &&
1375
- this.infiniteScroller.itemCount < this.dataSource.size) {
1376
- this.setTileCount(this.dataSource.endOfDataReached
1377
- ? this.dataSource.size
1378
- : this.estimatedTileCount);
1379
- }
1380
- }
1381
- /**
1382
- * Updates the data source with the current state of facet readiness for loading,
1383
- * so that they will begin to load in at the appropriate time according to the
1384
- * current facet loading strategy.
1385
- */
1386
- updateFacetReadiness() {
1387
- // There are two ways to opt into facet production:
1388
- // (1) have the facets dropdown open, or
1389
- // (2) if using the `opt-in-or-login` strategy, be logged into an account
1390
- const optedIn = this.collapsibleFacetsVisible ||
1391
- (this.facetLoadStrategy === 'opt-in-or-login' && this.loggedIn);
1392
- // In desktop view, we are always ready to load facets *unless* we are using one of the
1393
- // `opt-in` strategies and have not opted in (whether by login or UI interaction).
1394
- const usingOptInStrategy = ['opt-in', 'opt-in-or-login'].includes(this.facetLoadStrategy);
1395
- const desktopFacetsReady = !this.mobileView && (!usingOptInStrategy || optedIn);
1396
- // In the mobile view, facets are considered ready provided we have opted in (whether by
1397
- // login or UI interaction).
1398
- const mobileFacetsReady = this.mobileView && optedIn;
1399
- this.dataSource.handleFacetReadinessChange(desktopFacetsReady || mobileFacetsReady);
1400
- }
1401
- /**
1402
- * Sets up listeners for events that may require updating the left column height.
1403
- */
1404
- setupLeftColumnScrollListeners() {
1405
- var _a;
1406
- // We observe intersections between the left column's scroll sentinel and
1407
- // the viewport, so that we can ensure the left column is always sized to
1408
- // match the _available_ viewport height. This should generally be more
1409
- // performant than listening to scroll events on the page or column.
1410
- const leftColumnSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#left-column-scroll-sentinel');
1411
- if (leftColumnSentinel) {
1412
- this.leftColIntersectionObserver = new IntersectionObserver(this.updateLeftColumnHeight, {
1413
- threshold: [...Array(201).keys()].map(n => n / 200), // Threshold every 0.5%
1414
- });
1415
- this.leftColIntersectionObserver.observe(leftColumnSentinel);
1416
- }
1417
- // We also listen for window resize events, as they are not always captured
1418
- // by the resize observer and can affect the desired height of the left column.
1419
- window.addEventListener('resize', this.updateLeftColumnHeight);
1420
- }
1421
- /**
1422
- * Sets up listeners to control whether the facet sidebar shows its bottom fade-out.
1423
- * Note this uses a separate IntersectionObserver from the left column, because we
1424
- * don't need granular intersection thresholds for this.
1425
- */
1426
- setupFacetsScrollListeners() {
1427
- var _a;
1428
- const facetsSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#facets-scroll-sentinel');
1429
- if (facetsSentinel) {
1430
- this.facetsIntersectionObserver = new IntersectionObserver(this.updateFacetFadeOut);
1431
- this.facetsIntersectionObserver.observe(facetsSentinel);
1432
- }
1433
- }
1434
- /**
1435
- * Emits a `baseQueryChanged` event indicating an update to the search query.
1436
- */
1437
- emitBaseQueryChanged() {
1438
- this.dispatchEvent(new CustomEvent('baseQueryChanged', {
1439
- detail: {
1440
- baseQuery: this.baseQuery,
1441
- },
1442
- }));
1443
- }
1444
- /**
1445
- * Emits a `searchTypeChanged` event indicating an update to the search type
1446
- * (e.g., metadata vs. full-text).
1447
- */
1448
- emitSearchTypeChanged() {
1449
- this.dispatchEvent(new CustomEvent('searchTypeChanged', {
1450
- detail: this.searchType,
1451
- }));
1452
- }
1453
- /**
1454
- * Emits a `facetPaneVisibilityChanged` event indicating that the facet pane has
1455
- * been toggled open or closed.
1456
- */
1457
- emitFacetPaneVisibilityChanged() {
1458
- this.dispatchEvent(new CustomEvent('facetPaneVisibilityChanged', {
1459
- detail: this.facetPaneVisible,
1460
- }));
1461
- }
1462
- /**
1463
- * Emits a `searchError` event indicating that the most recent search has encountered
1464
- * an error from the backend.
1465
- */
1466
- emitSearchError() {
1467
- this.dispatchEvent(new CustomEvent('searchError', {
1468
- detail: this.dataSource.queryErrorMessage,
1469
- }));
1470
- }
1471
- /**
1472
- * Emits a `queryStateChanged` event indicating that one or more of this component's
1473
- * properties have changed in a way that could affect the set of search results.
1474
- */
1475
- emitQueryStateChanged() {
1476
- this.dispatchEvent(new CustomEvent('queryStateChanged', {
1477
- detail: {
1478
- baseQuery: this.baseQuery,
1479
- withinCollection: this.withinCollection,
1480
- withinProfile: this.withinProfile,
1481
- profileElement: this.profileElement,
1482
- searchType: this.searchType,
1483
- selectedFacets: this.selectedFacets,
1484
- internalFilters: this.internalFilters,
1485
- minSelectedDate: this.minSelectedDate,
1486
- maxSelectedDate: this.maxSelectedDate,
1487
- selectedSort: this.selectedSort,
1488
- sortDirection: this.sortDirection,
1489
- selectedTitleFilter: this.selectedTitleFilter,
1490
- selectedCreatorFilter: this.selectedCreatorFilter,
1491
- tvClipFilter: this.tvClipFilter,
1492
- },
1493
- }));
1494
- }
1495
- /**
1496
- * Emits an `emptyResults` event indicating that we have received an empty result set
1497
- * for the most recent query.
1498
- */
1499
- emitEmptyResults() {
1500
- this.dispatchEvent(new Event('emptyResults'));
1501
- }
1502
- disconnectResizeObserver(resizeObserver) {
1503
- resizeObserver.removeObserver({
1504
- target: this.contentContainer,
1505
- handler: this,
1506
- });
1507
- }
1508
- setupResizeObserver() {
1509
- if (!this.resizeObserver || !this.contentContainer)
1510
- return;
1511
- this.resizeObserver.addObserver({
1512
- target: this.contentContainer,
1513
- handler: this,
1514
- });
1515
- }
1516
- /**
1517
- * When the visible cells change from the infinite scroller, we want to emit
1518
- * which page is currently visible so the consumer can update its UI or the URL
1519
- *
1520
- * @param e
1521
- * @returns
1522
- */
1523
- visibleCellsChanged(e) {
1524
- if (this.isScrollingToCell)
1525
- return;
1526
- const { visibleCellIndices } = e.detail;
1527
- if (visibleCellIndices.length === 0)
1528
- return;
1529
- // For page determination, do not count more than a single page of visible cells,
1530
- // since otherwise patrons using very tall screens will be treated as one page
1531
- // further than they actually are.
1532
- const lastIndexWithinCurrentPage = Math.min(this.pageSize, visibleCellIndices.length) - 1;
1533
- const lastVisibleCellIndex = visibleCellIndices[lastIndexWithinCurrentPage];
1534
- const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
1535
- if (this.currentPage !== lastVisibleCellPage) {
1536
- this.currentPage = lastVisibleCellPage;
1537
- }
1538
- const event = new CustomEvent('visiblePageChanged', {
1539
- detail: {
1540
- pageNumber: lastVisibleCellPage,
1541
- },
1542
- });
1543
- this.dispatchEvent(event);
1544
- }
1545
- /**
1546
- * A Promise which, after each query change, resolves once the fetches for the initial
1547
- * search have completed. Waits for *both* the hits and aggregations fetches to finish.
1548
- *
1549
- * Ensure you await this component's `updateComplete` promise before awaiting this
1550
- * one, to ensure you do not await an obsolete promise from the previous update.
1551
- */
1552
- get initialSearchComplete() {
1553
- return this.dataSource.initialSearchComplete;
1554
- }
1555
- /**
1556
- * Handler for whenever the component's properties change in a way that may require
1557
- * fetching new results.
1558
- */
1559
- async handleQueryChange() {
1560
- var _a;
1561
- // only reset if the query has actually changed
1562
- if (!this.searchService ||
1563
- this.dataSource.pageFetchQueryKey === this.previousQueryKey) {
1564
- return;
1565
- }
1566
- // If the new state prevents us from updating the search results, don't reset
1567
- if (this.baseQuery && !this.dataSource.canPerformSearch) {
1568
- return;
1569
- }
1570
- this.previousQueryKey = this.dataSource.pageFetchQueryKey;
1571
- this.totalResults = undefined;
1572
- this.pagesToRender =
1573
- this.initialPageNumber === 1
1574
- ? 2 // First two pages are batched into one request when starting from page 1
1575
- : this.initialPageNumber;
1576
- // Reset the infinite scroller's item count, so that it
1577
- // shows tile placeholders until the new query's results load in
1578
- if (this.infiniteScroller) {
1579
- this.infiniteScroller.itemCount = this.estimatedTileCount;
1580
- this.infiniteScroller.reload();
1581
- }
1582
- if (this.withinCollection && ((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim())) {
1583
- this.defaultSortField = SortField.relevance;
1584
- this.defaultSortDirection = null;
1585
- }
1586
- if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {
1587
- this.scrollToPage(this.initialPageNumber);
1588
- }
1589
- this.initialQueryChangeHappened = true;
1590
- // if the query changed as part of a window.history pop event, we don't want to
1591
- // persist the state because it overwrites the forward history
1592
- if (!this.historyPopOccurred) {
1593
- this.persistState();
1594
- }
1595
- this.historyPopOccurred = false;
1596
- }
1597
- setupStateRestorationObserver() {
1598
- if (!this.boundNavigationHandler) {
1599
- this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
1600
- }
1601
- // when the user navigates back, we want to update the UI to match the URL
1602
- window.addEventListener('popstate', this.boundNavigationHandler);
1603
- }
1604
- historyNavigationHandler() {
1605
- this.historyPopOccurred = true;
1606
- this.restoreState();
1607
- }
1608
- restoreState() {
1609
- var _a, _b, _c, _d, _e, _f;
1610
- const restorationState = this.restorationStateHandler.getRestorationState();
1611
- this.displayMode = restorationState.displayMode;
1612
- if (!this.suppressURLSinParam && restorationState.searchType != null)
1613
- this.searchType = restorationState.searchType;
1614
- this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.default;
1615
- this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
1616
- this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
1617
- this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
1618
- this.selectedFacets = restorationState.selectedFacets;
1619
- if (!this.suppressURLQuery)
1620
- this.baseQuery = restorationState.baseQuery;
1621
- this.currentPage = (_e = restorationState.currentPage) !== null && _e !== void 0 ? _e : 1;
1622
- this.minSelectedDate = restorationState.minSelectedDate;
1623
- this.maxSelectedDate = restorationState.maxSelectedDate;
1624
- this.tvClipFilter = (_f = restorationState.tvClipFilter) !== null && _f !== void 0 ? _f : 'all';
1625
- if (this.currentPage > 1) {
1626
- this.goToPage(this.currentPage);
1627
- }
1628
- }
1629
- persistState() {
1630
- var _a, _b, _c, _d;
1631
- const restorationState = {
1632
- displayMode: this.displayMode,
1633
- searchType: this.suppressURLSinParam ? undefined : this.searchType,
1634
- selectedSort: this.selectedSort,
1635
- sortDirection: (_a = this.sortDirection) !== null && _a !== void 0 ? _a : undefined,
1636
- selectedFacets: (_b = this.selectedFacets) !== null && _b !== void 0 ? _b : getDefaultSelectedFacets(),
1637
- baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,
1638
- currentPage: this.currentPage,
1639
- titleQuery: this.titleQuery,
1640
- creatorQuery: this.creatorQuery,
1641
- minSelectedDate: this.minSelectedDate,
1642
- maxSelectedDate: this.maxSelectedDate,
1643
- selectedTitleFilter: (_c = this.selectedTitleFilter) !== null && _c !== void 0 ? _c : undefined,
1644
- selectedCreatorFilter: (_d = this.selectedCreatorFilter) !== null && _d !== void 0 ? _d : undefined,
1645
- tvClipFilter: this.tvClipFilter,
1646
- };
1647
- const persistOptions = {
1648
- forceReplace: this.dataSourceInstallInProgress,
1649
- persistMetadataSearchType: this.isTVCollection,
1650
- };
1651
- this.restorationStateHandler.persistState(restorationState, persistOptions);
1652
- }
1653
- /**
1654
- * Emits a `searchResultsLoadingChanged` event indicating that our loading state has
1655
- * changed (either we have started loading new results, or we have finished loading them).
1656
- */
1657
- emitSearchResultsLoadingChanged() {
1658
- this.dispatchEvent(new CustomEvent('searchResultsLoadingChanged', {
1659
- detail: {
1660
- loading: this.searchResultsLoading,
1661
- },
1662
- }));
1663
- }
1664
- /**
1665
- * Handler for when the set of selected facets changes.
1666
- */
1667
- facetsChanged(e) {
1668
- this.selectedFacets = e.detail;
1669
- }
1670
- /**
1671
- * Handler for when any facet is selected/unselected/hidden/unhidden.
1672
- * Fires analytics indicating the type of facet event that took place.
1673
- */
1674
- facetClickHandler({ detail: { facetType, bucket, negative }, }) {
1675
- var _a;
1676
- let action;
1677
- if (negative) {
1678
- action =
1679
- bucket.state !== 'none'
1680
- ? analyticsActions.facetNegativeSelected
1681
- : analyticsActions.facetNegativeDeselected;
1682
- }
1683
- else {
1684
- action =
1685
- bucket.state !== 'none'
1686
- ? analyticsActions.facetSelected
1687
- : analyticsActions.facetDeselected;
1688
- }
1689
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
1690
- category: this.searchContext,
1691
- action,
1692
- label: facetType,
1693
- });
1694
- }
1695
- scrollToPage(pageNumber) {
1696
- return new Promise(resolve => {
1697
- const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
1698
- // without this setTimeout, Safari just pauses until the `fetchPage` is complete
1699
- // then scrolls to the cell
1700
- setTimeout(() => {
1701
- var _a;
1702
- this.isScrollingToCell = true;
1703
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
1704
- // This timeout is to give the scroll animation time to finish
1705
- // then updating the infinite scroller once we're done scrolling
1706
- // There's no scroll animation completion callback so we're
1707
- // giving it 0.5s to finish.
1708
- setTimeout(() => {
1709
- var _a;
1710
- this.isScrollingToCell = false;
1711
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1712
- resolve();
1713
- }, 500);
1714
- }, 0);
1715
- });
1716
- }
1717
- /**
1718
- * Whether sorting by relevance makes sense for the current state.
1719
- * Currently equivalent to having a non-empty query.
1720
- */
1721
- get isRelevanceSortAvailable() {
1722
- var _a;
1723
- return !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
1724
- }
1725
- /**
1726
- * Sets the total number of tiles displayed in the infinite scroller.
1727
- */
1728
- setTileCount(count) {
1729
- if (this.infiniteScroller) {
1730
- this.infiniteScroller.itemCount = count;
1731
- }
1732
- }
1733
- /**
1734
- * Applies any default sort option for the current collection, by checking
1735
- * for one in the collection's metadata. If none is found, defaults to sorting
1736
- * descending by:
1737
- * - Date Favorited for fav-* collections
1738
- * - Weekly views for all other collections
1739
- */
1740
- applyDefaultCollectionSort(collectionInfo) {
1741
- var _a, _b, _c;
1742
- if (this.baseQuery) {
1743
- // If there's a query set, then we default to relevance sorting regardless of
1744
- // the collection metadata-specified sort.
1745
- this.defaultSortField = SortField.relevance;
1746
- this.defaultSortDirection = null;
1747
- return;
1748
- }
1749
- // Favorite collections sort on Date Favorited by default.
1750
- // Other collections fall back to sorting on weekly views.
1751
- 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-'))
1752
- ? '-favoritedate'
1753
- : '-week';
1754
- // The collection metadata may override the default sorting with something else
1755
- const metadataSort = (_c = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _c === void 0 ? void 0 : _c['sort-by'];
1756
- // Prefer the metadata-specified sort if one exists
1757
- const defaultSortToApply = metadataSort !== null && metadataSort !== void 0 ? metadataSort : baseDefaultSort;
1758
- // Account for both -field and field:dir formats
1759
- let [field, dir] = defaultSortToApply.split(':');
1760
- if (field.startsWith('-')) {
1761
- field = field.slice(1);
1762
- dir = 'desc';
1763
- }
1764
- else if (!['asc', 'desc'].includes(dir)) {
1765
- dir = 'asc';
1766
- }
1767
- const sortOption = sortOptionFromAPIString(field);
1768
- const sortField = sortOption.field;
1769
- if (sortField && sortField !== SortField.default) {
1770
- this.defaultSortField = sortField;
1771
- this.defaultSortDirection = dir;
1772
- }
1773
- }
1774
- /**
1775
- * Applies the default sort option for the current profile element
1776
- */
1777
- applyDefaultProfileSort() {
1778
- if (this.profileElement) {
1779
- const defaultSortField = defaultProfileElementSorts[this.profileElement];
1780
- this.defaultSortField = defaultSortField !== null && defaultSortField !== void 0 ? defaultSortField : SortField.weeklyview;
1781
- }
1782
- else {
1783
- this.defaultSortField = SortField.weeklyview;
1784
- }
1785
- this.defaultSortDirection = 'desc';
1786
- }
1787
- /**
1788
- * This is useful for determining whether we need to reload the scroller.
1789
- *
1790
- * When the fetch completes, we need to reload the scroller if the cells for that
1791
- * page are visible, but if the page is not currenlty visible, we don't need to reload
1792
- */
1793
- get currentVisiblePageNumbers() {
1794
- var _a, _b;
1795
- const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
1796
- const visiblePages = new Set();
1797
- visibleCells.forEach(cellIndex => {
1798
- const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
1799
- visiblePages.add(visiblePage);
1800
- });
1801
- return Array.from(visiblePages);
1802
- }
1803
- /**
1804
- * Whether we are currently displaying results for a radio collection
1805
- */
1806
- get isRadioCollection() {
1807
- const { withinCollection } = this;
1808
- const topCollections = ['radio'];
1809
- const isTopCollection = topCollections.includes(withinCollection);
1810
- const isSubCollection = topCollections.some(topCollxn => { var _a; return (_a = this.dataSource.parentCollections) === null || _a === void 0 ? void 0 : _a.includes(topCollxn); });
1811
- return isTopCollection || isSubCollection;
1812
- }
1813
- /**
1814
- * Refreshes all visible result cells in the infinite scroller.
1815
- */
1816
- refreshVisibleResults() {
1817
- var _a;
1818
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1819
- }
1820
- /**
1821
- * Callback when a result is selected
1822
- */
1823
- resultSelected(event) {
1824
- var _a, _b, _c;
1825
- if (this.isManageView) {
1826
- // Checked/unchecked state change -- rerender to ensure it propagates
1827
- // this.mapDataSource(model => ({ ...model }));
1828
- const cellIndex = this.dataSource.indexOf(event.detail);
1829
- if (cellIndex >= 0)
1830
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshCell(cellIndex);
1831
- this.requestUpdate();
1832
- }
1833
- (_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
1834
- category: this.searchContext,
1835
- action: analyticsActions.resultSelected,
1836
- label: event.detail.mediatype,
1837
- });
1838
- (_c = this.analyticsHandler) === null || _c === void 0 ? void 0 : _c.sendEvent({
1839
- category: this.searchContext,
1840
- action: analyticsActions.resultSelected,
1841
- label: `page-${this.currentPage}`,
1842
- });
1843
- }
1844
- cellForIndex(index) {
1845
- const model = this.tileModelAtCellIndex(index);
1846
- if (!model)
1847
- return undefined;
1848
- // Tiles show dates in UTC by default.
1849
- // But for certain types of time-based media, we want them to use local time instead.
1850
- // Those local-time cases are:
1851
- // - TV or Radio search results
1852
- // - TV or Radio collection results
1853
- const isTVSearch = this.searchType === SearchType.TV;
1854
- const isRadioSearch = this.searchType === SearchType.RADIO;
1855
- const { isTVCollection, isRadioCollection } = this;
1856
- const shouldUseLocalTime = isTVSearch || isRadioSearch || isTVCollection || isRadioCollection;
1857
- return html `
1858
- <tile-dispatcher
1859
- .collectionPagePath=${this.collectionPagePath}
1860
- .baseNavigationUrl=${this.baseNavigationUrl}
1861
- .baseImageUrl=${this.baseImageUrl}
1862
- .model=${model}
1863
- .tileDisplayMode=${this.displayMode}
1864
- .resizeObserver=${this.resizeObserver}
1865
- .collectionTitles=${this.dataSource.collectionTitles}
1866
- .sortParam=${this.sortParam}
1867
- .defaultSortParam=${this.defaultSortParam}
1868
- .creatorFilter=${this.selectedCreatorFilter}
1869
- .mobileBreakpoint=${this.mobileBreakpoint}
1870
- .loggedIn=${this.loggedIn}
1871
- .suppressBlurring=${this.shouldSuppressTileBlurring}
1872
- .isManageView=${this.isManageView}
1873
- ?showTvClips=${isTVSearch || isTVCollection}
1874
- ?enableHoverPane=${true}
1875
- ?useLocalTime=${shouldUseLocalTime}
1876
- @resultSelected=${(e) => this.resultSelected(e)}
1877
- >
1878
- </tile-dispatcher>
1879
- `;
1880
- }
1881
- /**
1882
- * When the user scrolls near to the bottom of the page, fetch the next page
1883
- * increase the number of pages to render and start fetching data for the new page
1884
- */
1885
- scrollThresholdReached() {
1886
- if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
1887
- this.pagesToRender += 1;
1888
- this.dataSource.fetchPage(this.pagesToRender);
1889
- }
1890
- }
1891
- /**
1892
- * Fetches search results for privileged users when in manage view.
1893
- *
1894
- * This method:
1895
- * 1. Checks if we're in search context and either haven't loaded results yet, or have already finished loading with > 100 total results
1896
- * 2. Resets the datasource pagination state
1897
- * 3. Fetches first page with limit based on maxPagesToManage threshold
1898
- * 4. Reloads the infinite scroller to display new results
1899
- */
1900
- fetchManageableSearchResults() {
1901
- var _a;
1902
- const hasNotLoadedInitialResults = !this.dataSource.totalResults;
1903
- const hasLoadedWithMoreResultsAvailable = !this.searchResultsLoading && this.dataSource.totalResults > 100;
1904
- if (this.pageContext === 'search' &&
1905
- (hasNotLoadedInitialResults || hasLoadedWithMoreResultsAvailable)) {
1906
- this.dataSource.resetPages();
1907
- this.dataSource.fetchPage(1, this.maxPagesToManage);
1908
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
1909
- }
1910
- }
1911
- static get styles() {
1912
- return [
1913
- srOnlyStyle,
1914
- css `
1915
- :host {
1916
- display: block;
1917
- --leftColumnWidth: 18rem;
1918
- --leftColumnPaddingTop: 2rem;
1919
- --leftColumnPaddingRight: 2.5rem;
1920
- }
1921
-
1922
- #facet-top-view {
1923
- display: flex;
1924
- }
1925
-
1926
- /**
1927
- * When page width resizes from desktop to mobile, use this class to
1928
- * disable expand/collapse transition when loading.
1929
- */
1930
- .preload * {
1931
- transition: none !important;
1932
- -webkit-transition: none !important;
1933
- -moz-transition: none !important;
1934
- -ms-transition: none !important;
1935
- -o-transition: none !important;
1936
- }
1937
-
1938
- #content-container {
1939
- display: flex;
1940
- }
1941
-
1942
- empty-placeholder {
1943
- margin-top: var(--placeholderMarginTop, 0);
1944
- }
1945
-
1946
- .collapser-icon {
1947
- display: inline-block;
1948
- }
1949
-
1950
- .collapser-icon svg {
1951
- display: inline-block;
1952
- width: 12px;
1953
- height: 12px;
1954
- transition: transform 0.2s ease-out;
1955
- }
1956
-
1957
- #mobile-filter-collapse {
1958
- width: 100%;
1959
- }
1960
-
1961
- #mobile-filter-collapse > summary {
1962
- cursor: pointer;
1963
- list-style: none;
1964
- }
1965
-
1966
- #mobile-filter-collapse[open] > summary {
1967
- margin-bottom: 10px;
1968
- }
1969
-
1970
- #mobile-filter-collapse h2 {
1971
- display: inline-block;
1972
- margin: 0;
1973
- font-size: 2rem;
1974
- }
1975
-
1976
- #mobile-filter-collapse[open] svg {
1977
- transform: rotate(90deg);
1978
- }
1979
-
1980
- #content-container.mobile {
1981
- display: block;
1982
- }
1983
-
1984
- #right-column {
1985
- flex: 1;
1986
- position: relative;
1987
- min-height: 90vh;
1988
- border-right: 1px solid rgb(232, 232, 232);
1989
- margin-top: var(--rightColumnMarginTop, 0);
1990
- padding-top: var(--rightColumnPaddingTop, 2rem);
1991
- background: #fff;
1992
- }
1993
-
1994
- #left-column:not([hidden]) + #right-column {
1995
- border-left: 1px solid rgb(232, 232, 232);
1996
- }
1997
-
1998
- #right-column.smart-results-spacing {
1999
- padding-top: 0.5rem;
2000
- border-right: none;
2001
- background: transparent;
2002
- min-width: 0;
2003
- }
2004
-
2005
- #results {
2006
- background: #fff;
2007
- padding-left: 1rem;
2008
- padding-right: 1rem;
2009
- }
2010
-
2011
- #right-column.smart-results-spacing #results {
2012
- border-radius: 10px 10px 0px 0px;
2013
- padding-top: 0.5rem;
2014
- margin-top: 1rem;
2015
- }
2016
-
2017
- .mobile #right-column {
2018
- border-left: none;
2019
- }
2020
-
2021
- .mobile #results {
2022
- padding: 5px 5px 0;
2023
- }
2024
-
2025
- #left-column {
2026
- width: var(--leftColumnWidth, 18rem);
2027
- /* Prevents Safari from shrinking col at first draw */
2028
- min-width: var(--leftColumnWidth, 18rem);
2029
- padding-top: var(--leftColumnPaddingTop, 2rem);
2030
- /* Reduced padding by 0.2rem to add the invisible border in the rule below */
2031
- padding-right: calc(var(--leftColumnPaddingRight, 2.5rem) - 0.2rem);
2032
- border-right: 0.2rem solid transparent; /* Pads to the right of the scrollbar a bit */
2033
- z-index: 1;
2034
- }
2035
-
2036
- .desktop #left-column {
2037
- top: 0;
2038
- position: sticky;
2039
- height: calc(100vh - 2rem);
2040
- max-height: calc(100vh - 2rem);
2041
- overflow-x: hidden;
2042
- overflow-y: scroll;
2043
-
2044
- /*
2045
- * Firefox doesn't support any of the -webkit-scrollbar stuff below, but
2046
- * does at least give us a tiny bit of control over width & color.
2047
- */
2048
- scrollbar-width: thin;
2049
- scrollbar-color: transparent transparent;
2050
- }
2051
- .desktop #left-column:hover {
2052
- scrollbar-color: auto;
2053
- }
2054
- .desktop #left-column::-webkit-scrollbar {
2055
- appearance: none;
2056
- width: 6px;
2057
- }
2058
- .desktop #left-column::-webkit-scrollbar-button {
2059
- height: 3px;
2060
- background: transparent;
2061
- }
2062
- .desktop #left-column::-webkit-scrollbar-corner {
2063
- background: transparent;
2064
- }
2065
- .desktop #left-column::-webkit-scrollbar-thumb {
2066
- border-radius: 4px;
2067
- }
2068
- .desktop #left-column:hover::-webkit-scrollbar-thumb {
2069
- background: rgba(0, 0, 0, 0.15);
2070
- }
2071
- .desktop #left-column:hover::-webkit-scrollbar-thumb:hover {
2072
- background: rgba(0, 0, 0, 0.2);
2073
- }
2074
- .desktop #left-column:hover::-webkit-scrollbar-thumb:active {
2075
- background: rgba(0, 0, 0, 0.3);
2076
- }
2077
-
2078
- #facets-bottom-fade {
2079
- background: linear-gradient(
2080
- to bottom,
2081
- #f5f5f700 0%,
2082
- #f5f5f7c0 50%,
2083
- #f5f5f7 80%,
2084
- #f5f5f7 100%
2085
- );
2086
- position: fixed;
2087
- bottom: 0;
2088
- height: 50px;
2089
- /* Wide enough to cover the content, but leave the scrollbar uncovered */
2090
- width: calc(
2091
- var(--leftColumnWidth) + var(--leftColumnPaddingRight) - 10px
2092
- );
2093
- z-index: 2;
2094
- pointer-events: none;
2095
- transition: height 0.1s ease;
2096
- }
2097
- #facets-bottom-fade.hidden {
2098
- height: 0;
2099
- }
2100
-
2101
- .facets-message {
2102
- font-size: 1.4rem;
2103
- }
2104
-
2105
- .desktop-facets-dropdown > summary {
2106
- cursor: pointer;
2107
- list-style: none;
2108
- }
2109
-
2110
- .desktop-facets-dropdown h2 {
2111
- display: inline-block;
2112
- margin: 0;
2113
- font-size: 1.6rem;
2114
- }
2115
-
2116
- .desktop-facets-dropdown[open] > summary {
2117
- margin-bottom: 10px;
2118
- }
2119
-
2120
- .desktop-facets-dropdown[open] svg {
2121
- transform: rotate(90deg);
2122
- }
2123
-
2124
- .desktop #left-column-scroll-sentinel {
2125
- width: 1px;
2126
- height: 100vh;
2127
- background: transparent;
2128
- }
2129
-
2130
- .desktop #facets-scroll-sentinel {
2131
- width: 1px;
2132
- height: 1px;
2133
- background: transparent;
2134
- }
2135
-
2136
- #facets-header-container {
2137
- display: flex;
2138
- justify-content: space-between;
2139
- align-items: flex-start;
2140
- clear: both;
2141
- }
2142
-
2143
- .desktop #facets-header-container {
2144
- flex-wrap: wrap;
2145
- }
2146
-
2147
- .mobile #left-column {
2148
- width: 100%;
2149
- min-width: 0;
2150
- padding: 5px 0;
2151
- border: 0;
2152
- }
2153
-
2154
- .clear-filters-btn-row {
2155
- display: inline-block;
2156
- }
2157
-
2158
- .desktop .clear-filters-btn-row {
2159
- width: 100%;
2160
- }
2161
-
2162
- .clear-filters-btn {
2163
- display: inline-block;
2164
- appearance: none;
2165
- margin: 0;
2166
- padding: 0;
2167
- border: 0;
2168
- background: none;
2169
- color: var(--ia-theme-link-color);
2170
- font-size: 1.4rem;
2171
- font-family: inherit;
2172
- cursor: pointer;
2173
- }
2174
-
2175
- .clear-filters-btn:hover {
2176
- text-decoration: underline;
2177
- }
2178
-
2179
- .clear-filters-btn-separator {
2180
- display: inline-block;
2181
- margin-left: 5px;
2182
- border-left: 1px solid #2c2c2c;
2183
- font-size: 1.4rem;
2184
- line-height: 1.3rem;
2185
- }
2186
-
2187
- #facets-container {
2188
- position: relative;
2189
- max-height: 0;
2190
- transition: max-height 0.2s ease-in-out;
2191
- z-index: 1;
2192
- margin-top: var(--facetsContainerMarginTop, 5rem);
2193
- padding-bottom: 2rem;
2194
- }
2195
-
2196
- .desktop #facets-container {
2197
- width: 18rem;
2198
- }
2199
-
2200
- .mobile #facets-container {
2201
- overflow: hidden;
2202
- padding-bottom: 0;
2203
- padding-left: 10px;
2204
- padding-right: 10px;
2205
- }
2206
-
2207
- #facets-container.expanded {
2208
- max-height: 2000px;
2209
- }
2210
-
2211
- .results-section-heading {
2212
- margin: 0.5rem 0.3rem;
2213
- font-size: 2rem;
2214
- line-height: 25px;
2215
- }
2216
-
2217
- #results-total {
2218
- display: flex;
2219
- align-items: baseline;
2220
- }
2221
-
2222
- .mobile #results-total {
2223
- position: absolute;
2224
- right: 10px;
2225
- }
2226
-
2227
- #big-results-count {
2228
- font-size: 2.4rem;
2229
- font-weight: 500;
2230
- margin-right: 5px;
2231
- }
2232
-
2233
- .mobile #big-results-count {
2234
- font-size: 2rem;
2235
- }
2236
-
2237
- #big-results-label {
2238
- font-size: 1.4rem;
2239
- font-weight: 200;
2240
- }
2241
-
2242
- #list-header {
2243
- max-height: 4.2rem;
2244
- }
2245
-
2246
- .loading-cover {
2247
- position: absolute;
2248
- top: 0;
2249
- left: 0;
2250
- width: 100%;
2251
- height: 100%;
2252
- display: flex;
2253
- justify-content: center;
2254
- z-index: 1;
2255
- padding-top: 50px;
2256
- }
2257
-
2258
- #tile-blur-label {
2259
- display: flex;
2260
- align-items: center;
2261
- column-gap: 5px;
2262
- }
2263
-
2264
- #tile-blur-check {
2265
- margin: 0 5px 0 0;
2266
- width: 15px;
2267
- }
2268
-
2269
- circular-activity-indicator {
2270
- width: 30px;
2271
- height: 30px;
2272
- }
2273
-
2274
- sort-filter-bar {
2275
- display: block;
2276
- margin-bottom: 4rem;
2277
- }
2278
-
2279
- infinite-scroller {
2280
- display: block;
2281
- --infiniteScrollerRowGap: var(--collectionBrowserRowGap, 1.7rem);
2282
- --infiniteScrollerColGap: var(--collectionBrowserColGap, 1.7rem);
2283
- }
2284
-
2285
- infinite-scroller.list-compact {
2286
- --infiniteScrollerCellMinWidth: var(
2287
- --collectionBrowserCellMinWidth,
2288
- 100%
2289
- );
2290
- --infiniteScrollerCellMinHeight: 45px; /* override infinite scroller component */
2291
- --infiniteScrollerCellMaxHeight: 56px;
2292
- --infiniteScrollerRowGap: 10px;
2293
- }
2294
-
2295
- infinite-scroller.list-detail {
2296
- --infiniteScrollerCellMinWidth: var(
2297
- --collectionBrowserCellMinWidth,
2298
- 100%
2299
- );
2300
- --infiniteScrollerCellMinHeight: var(
2301
- --collectionBrowserCellMinHeight,
2302
- 5rem
2303
- );
2304
- /*
2305
- 30px in spec, compensating for a -4px margin
2306
- to align title with top of item image
2307
- src/tiles/list/tile-list.ts
2308
- */
2309
- --infiniteScrollerRowGap: 34px;
2310
- }
2311
-
2312
- .mobile infinite-scroller.list-detail {
2313
- --infiniteScrollerRowGap: 24px;
2314
- }
2315
-
2316
- infinite-scroller.grid {
2317
- --infiniteScrollerCellMinWidth: var(
2318
- --collectionBrowserCellMinWidth,
2319
- 17rem
2320
- );
2321
- --infiniteScrollerCellMaxWidth: var(
2322
- --collectionBrowserCellMaxWidth,
2323
- 1fr
2324
- );
2325
- }
2326
-
2327
- /* Allow tiles to shrink a bit further at smaller viewport widths */
2328
- @media screen and (max-width: 880px) {
2329
- infinite-scroller.grid {
2330
- --infiniteScrollerCellMinWidth: var(
2331
- --collectionBrowserCellMinWidth,
2332
- 15rem
2333
- );
2334
- }
2335
- }
2336
- /* At very small widths, maintain a 2-tile layout as far as it can reasonably go */
2337
- @media screen and (max-width: 360px) {
2338
- infinite-scroller.grid {
2339
- --infiniteScrollerCellMinWidth: var(
2340
- --collectionBrowserCellMinWidth,
2341
- 12rem
2342
- );
2343
- }
2344
- }
2345
-
2346
- infinite-scroller.hidden {
2347
- display: none;
2348
- }
2349
- `,
2350
- ];
2351
- }
2352
- };
2353
- __decorate([
2354
- property({ type: String })
2355
- ], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
2356
- __decorate([
2357
- property({ type: String })
2358
- ], CollectionBrowser.prototype, "baseImageUrl", void 0);
2359
- __decorate([
2360
- property({ type: Object })
2361
- ], CollectionBrowser.prototype, "searchService", void 0);
2362
- __decorate([
2363
- property({ type: Number })
2364
- ], CollectionBrowser.prototype, "searchType", void 0);
2365
- __decorate([
2366
- property({ type: String })
2367
- ], CollectionBrowser.prototype, "withinCollection", void 0);
2368
- __decorate([
2369
- property({ type: String })
2370
- ], CollectionBrowser.prototype, "withinProfile", void 0);
2371
- __decorate([
2372
- property({ type: String })
2373
- ], CollectionBrowser.prototype, "profileElement", void 0);
2374
- __decorate([
2375
- property({ type: String })
2376
- ], CollectionBrowser.prototype, "baseQuery", void 0);
2377
- __decorate([
2378
- property({ type: Array })
2379
- ], CollectionBrowser.prototype, "identifiers", void 0);
2380
- __decorate([
2381
- property({ type: String })
2382
- ], CollectionBrowser.prototype, "displayMode", void 0);
2383
- __decorate([
2384
- property({ type: String })
2385
- ], CollectionBrowser.prototype, "selectedSort", void 0);
2386
- __decorate([
2387
- property({ type: String })
2388
- ], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
2389
- __decorate([
2390
- property({ type: String })
2391
- ], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
2392
- __decorate([
2393
- property({ type: String })
2394
- ], CollectionBrowser.prototype, "tvClipFilter", void 0);
2395
- __decorate([
2396
- property({ type: String })
2397
- ], CollectionBrowser.prototype, "sortDirection", void 0);
2398
- __decorate([
2399
- property({ type: String })
2400
- ], CollectionBrowser.prototype, "defaultSortField", void 0);
2401
- __decorate([
2402
- property({ type: String })
2403
- ], CollectionBrowser.prototype, "defaultSortDirection", void 0);
2404
- __decorate([
2405
- property({ type: Number })
2406
- ], CollectionBrowser.prototype, "pageSize", void 0);
2407
- __decorate([
2408
- property({ type: Number })
2409
- ], CollectionBrowser.prototype, "currentPage", void 0);
2410
- __decorate([
2411
- property({ type: String })
2412
- ], CollectionBrowser.prototype, "minSelectedDate", void 0);
2413
- __decorate([
2414
- property({ type: String })
2415
- ], CollectionBrowser.prototype, "maxSelectedDate", void 0);
2416
- __decorate([
2417
- property({ type: Object })
2418
- ], CollectionBrowser.prototype, "selectedFacets", void 0);
2419
- __decorate([
2420
- property({ type: Object })
2421
- ], CollectionBrowser.prototype, "internalFilters", void 0);
2422
- __decorate([
2423
- property({ type: Boolean })
2424
- ], CollectionBrowser.prototype, "showSmartFacetBar", void 0);
2425
- __decorate([
2426
- property({ type: String })
2427
- ], CollectionBrowser.prototype, "smartFacetBarLabel", void 0);
2428
- __decorate([
2429
- property({ type: Boolean })
2430
- ], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
2431
- __decorate([
2432
- property({ type: Boolean })
2433
- ], CollectionBrowser.prototype, "suppressPlaceholders", void 0);
2434
- __decorate([
2435
- property({ type: Boolean })
2436
- ], CollectionBrowser.prototype, "suppressResultCount", void 0);
2437
- __decorate([
2438
- property({ type: Boolean })
2439
- ], CollectionBrowser.prototype, "suppressResultTiles", void 0);
2440
- __decorate([
2441
- property({ type: Boolean })
2442
- ], CollectionBrowser.prototype, "suppressURLQuery", void 0);
2443
- __decorate([
2444
- property({ type: Boolean })
2445
- ], CollectionBrowser.prototype, "suppressURLSinParam", void 0);
2446
- __decorate([
2447
- property({ type: Boolean })
2448
- ], CollectionBrowser.prototype, "suppressSortBar", void 0);
2449
- __decorate([
2450
- property({ type: Boolean })
2451
- ], CollectionBrowser.prototype, "suppressDisplayModes", void 0);
2452
- __decorate([
2453
- property({ type: Boolean })
2454
- ], CollectionBrowser.prototype, "suppressMediatypeFacets", void 0);
2455
- __decorate([
2456
- property({ type: String })
2457
- ], CollectionBrowser.prototype, "facetLoadStrategy", void 0);
2458
- __decorate([
2459
- property({ type: Boolean, reflect: true })
2460
- ], CollectionBrowser.prototype, "facetPaneVisible", void 0);
2461
- __decorate([
2462
- property({ type: Boolean })
2463
- ], CollectionBrowser.prototype, "clearResultsOnEmptyQuery", void 0);
2464
- __decorate([
2465
- property({ type: String })
2466
- ], CollectionBrowser.prototype, "collectionPagePath", void 0);
2467
- __decorate([
2468
- property({ type: String, reflect: true })
2469
- ], CollectionBrowser.prototype, "searchContext", void 0);
2470
- __decorate([
2471
- property({ type: String })
2472
- ], CollectionBrowser.prototype, "pageContext", void 0);
2473
- __decorate([
2474
- property({ type: Object })
2475
- ], CollectionBrowser.prototype, "restorationStateHandler", void 0);
2476
- __decorate([
2477
- property({ type: Number })
2478
- ], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
2479
- __decorate([
2480
- property({ type: Boolean })
2481
- ], CollectionBrowser.prototype, "loggedIn", void 0);
2482
- __decorate([
2483
- property({ type: Object })
2484
- ], CollectionBrowser.prototype, "resizeObserver", void 0);
2485
- __decorate([
2486
- property({ type: Object })
2487
- ], CollectionBrowser.prototype, "modalManager", void 0);
2488
- __decorate([
2489
- property({ type: Object })
2490
- ], CollectionBrowser.prototype, "featureFeedbackService", void 0);
2491
- __decorate([
2492
- property({ type: Object })
2493
- ], CollectionBrowser.prototype, "recaptchaManager", void 0);
2494
- __decorate([
2495
- property({ type: Boolean })
2496
- ], CollectionBrowser.prototype, "isTVCollection", void 0);
2497
- __decorate([
2498
- property({ type: Boolean })
2499
- ], CollectionBrowser.prototype, "isManageView", void 0);
2500
- __decorate([
2501
- property({ type: String })
2502
- ], CollectionBrowser.prototype, "manageViewLabel", void 0);
2503
- __decorate([
2504
- property({ type: Boolean })
2505
- ], CollectionBrowser.prototype, "enableSortOptionsSlot", void 0);
2506
- __decorate([
2507
- property({ type: Boolean, reflect: true })
2508
- ], CollectionBrowser.prototype, "showSmartResults", void 0);
2509
- __decorate([
2510
- property({ type: Number })
2511
- ], CollectionBrowser.prototype, "maxPagesToManage", void 0);
2512
- __decorate([
2513
- property({ type: Object })
2514
- ], CollectionBrowser.prototype, "dataSource", void 0);
2515
- __decorate([
2516
- state()
2517
- ], CollectionBrowser.prototype, "pagesToRender", void 0);
2518
- __decorate([
2519
- state()
2520
- ], CollectionBrowser.prototype, "searchResultsLoading", void 0);
2521
- __decorate([
2522
- state()
2523
- ], CollectionBrowser.prototype, "facetsLoading", void 0);
2524
- __decorate([
2525
- state()
2526
- ], CollectionBrowser.prototype, "totalResults", void 0);
2527
- __decorate([
2528
- state()
2529
- ], CollectionBrowser.prototype, "mobileView", void 0);
2530
- __decorate([
2531
- state()
2532
- ], CollectionBrowser.prototype, "tileBlurOverrideState", void 0);
2533
- __decorate([
2534
- state()
2535
- ], CollectionBrowser.prototype, "collapsibleFacetsVisible", void 0);
2536
- __decorate([
2537
- state()
2538
- ], CollectionBrowser.prototype, "contentWidth", void 0);
2539
- __decorate([
2540
- state()
2541
- ], CollectionBrowser.prototype, "placeholderType", void 0);
2542
- __decorate([
2543
- query('#content-container')
2544
- ], CollectionBrowser.prototype, "contentContainer", void 0);
2545
- __decorate([
2546
- query('#left-column')
2547
- ], CollectionBrowser.prototype, "leftColumn", void 0);
2548
- __decorate([
2549
- query('collection-facets')
2550
- ], CollectionBrowser.prototype, "collectionFacets", void 0);
2551
- __decorate([
2552
- query('manage-bar')
2553
- ], CollectionBrowser.prototype, "manageBar", void 0);
2554
- __decorate([
2555
- query('smart-facet-bar')
2556
- ], CollectionBrowser.prototype, "smartFacetBar", void 0);
2557
- __decorate([
2558
- property({ type: Object, attribute: false })
2559
- ], CollectionBrowser.prototype, "analyticsHandler", void 0);
2560
- __decorate([
2561
- query('infinite-scroller')
2562
- ], CollectionBrowser.prototype, "infiniteScroller", void 0);
2563
- CollectionBrowser = __decorate([
2564
- customElement('collection-browser')
2565
- ], CollectionBrowser);
2566
- export { CollectionBrowser };
2567
- //# sourceMappingURL=collection-browser.js.map