@internetarchive/collection-browser 4.7.1-alpha-webdev9189.0 → 4.8.1-webdev-9227.1

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 (396) hide show
  1. package/README.md +33 -0
  2. package/dist/src/app-root.js +0 -2
  3. package/dist/src/app-root.js.map +1 -1
  4. package/dist/src/assets/img/icons/check.d.ts +2 -0
  5. package/dist/src/assets/img/icons/check.js +5 -0
  6. package/dist/src/assets/img/icons/check.js.map +1 -0
  7. package/dist/src/collection-browser.d.ts +2 -1
  8. package/dist/src/collection-browser.js +5 -27
  9. package/dist/src/collection-browser.js.map +1 -1
  10. package/dist/src/collection-facets/facet-row-template.d.ts +38 -0
  11. package/dist/src/collection-facets/facet-row-template.js +200 -0
  12. package/dist/src/collection-facets/facet-row-template.js.map +1 -0
  13. package/dist/src/collection-facets/facet-row.js +11 -186
  14. package/dist/src/collection-facets/facet-row.js.map +1 -1
  15. package/dist/src/collection-facets/models.d.ts +7 -2
  16. package/dist/src/collection-facets/models.js +7 -2
  17. package/dist/src/collection-facets/models.js.map +1 -1
  18. package/dist/src/collection-facets/more-facets-content.d.ts +87 -21
  19. package/dist/src/collection-facets/more-facets-content.js +479 -201
  20. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  21. package/dist/src/collection-facets/more-facets-scroller.d.ts +85 -0
  22. package/dist/src/collection-facets/more-facets-scroller.js +429 -0
  23. package/dist/src/collection-facets/more-facets-scroller.js.map +1 -0
  24. package/dist/src/collection-facets/page-window.d.ts +73 -0
  25. package/dist/src/collection-facets/page-window.js +202 -0
  26. package/dist/src/collection-facets/page-window.js.map +1 -0
  27. package/dist/src/collection-facets/toggle-switch.js +1 -0
  28. package/dist/src/collection-facets/toggle-switch.js.map +1 -1
  29. package/dist/src/collection-facets.js +3 -2
  30. package/dist/src/collection-facets.js.map +1 -1
  31. package/dist/src/empty-placeholder.d.ts +7 -7
  32. package/dist/src/empty-placeholder.js +29 -15
  33. package/dist/src/empty-placeholder.js.map +1 -1
  34. package/dist/src/expanded-date-picker.js +3 -2
  35. package/dist/src/expanded-date-picker.js.map +1 -1
  36. package/dist/src/locales/es.d.ts +94 -0
  37. package/dist/src/locales/es.js +109 -0
  38. package/dist/src/locales/es.js.map +1 -0
  39. package/dist/src/manage/manage-bar.d.ts +3 -2
  40. package/dist/src/manage/manage-bar.js +6 -7
  41. package/dist/src/manage/manage-bar.js.map +1 -1
  42. package/dist/src/manage/remove-items-modal-content.js +3 -2
  43. package/dist/src/manage/remove-items-modal-content.js.map +1 -1
  44. package/dist/src/models.d.ts +4 -0
  45. package/dist/src/models.js +22 -2
  46. package/dist/src/models.js.map +1 -1
  47. package/dist/src/sort-filter-bar/sort-filter-bar.js +3 -3
  48. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  49. package/dist/src/tiles/grid/account-tile.js +3 -2
  50. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  51. package/dist/src/tiles/grid/collection-tile.js +3 -2
  52. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  53. package/dist/src/tiles/grid/item-tile.js +3 -2
  54. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  55. package/dist/src/tiles/grid/tile-stats.js +3 -2
  56. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  57. package/dist/src/tiles/list/tile-list-compact-header.js +3 -2
  58. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  59. package/dist/src/tiles/list/tile-list-compact.js +3 -1
  60. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  61. package/dist/src/tiles/list/tile-list.js +3 -2
  62. package/dist/src/tiles/list/tile-list.js.map +1 -1
  63. package/dist/src/tiles/overlay/text-overlay.js +3 -1
  64. package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
  65. package/dist/src/tiles/review-block.js +3 -2
  66. package/dist/src/tiles/review-block.js.map +1 -1
  67. package/dist/src/tiles/tile-dispatcher.d.ts +2 -1
  68. package/dist/src/tiles/tile-dispatcher.js +5 -4
  69. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  70. package/dist/src/utils/log.d.ts +1 -4
  71. package/dist/src/utils/normalize-filter-text.d.ts +28 -0
  72. package/dist/src/utils/normalize-filter-text.js +35 -0
  73. package/dist/src/utils/normalize-filter-text.js.map +1 -0
  74. package/locales/es.d.ts +1 -0
  75. package/locales/es.js +1 -0
  76. package/package.json +15 -1
  77. package/.editorconfig +0 -29
  78. package/.github/workflows/ci.yml +0 -29
  79. package/.github/workflows/gh-pages-main.yml +0 -41
  80. package/.github/workflows/npm-publish.yml +0 -42
  81. package/.github/workflows/pr-preview.yml +0 -40
  82. package/.husky/pre-commit +0 -1
  83. package/.prettierignore +0 -1
  84. package/dist/src/collection-facets/more-facets-pagination.d.ts +0 -36
  85. package/dist/src/collection-facets/more-facets-pagination.js +0 -260
  86. package/dist/src/collection-facets/more-facets-pagination.js.map +0 -1
  87. package/dist/test/collection-browser.test.d.ts +0 -1
  88. package/dist/test/collection-browser.test.js +0 -1849
  89. package/dist/test/collection-browser.test.js.map +0 -1
  90. package/dist/test/collection-facets/facet-row.test.d.ts +0 -1
  91. package/dist/test/collection-facets/facet-row.test.js +0 -291
  92. package/dist/test/collection-facets/facet-row.test.js.map +0 -1
  93. package/dist/test/collection-facets/facets-template.test.d.ts +0 -1
  94. package/dist/test/collection-facets/facets-template.test.js +0 -95
  95. package/dist/test/collection-facets/facets-template.test.js.map +0 -1
  96. package/dist/test/collection-facets/more-facets-content.test.d.ts +0 -1
  97. package/dist/test/collection-facets/more-facets-content.test.js +0 -159
  98. package/dist/test/collection-facets/more-facets-content.test.js.map +0 -1
  99. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +0 -1
  100. package/dist/test/collection-facets/more-facets-pagination.test.js +0 -126
  101. package/dist/test/collection-facets/more-facets-pagination.test.js.map +0 -1
  102. package/dist/test/collection-facets/toggle-switch.test.d.ts +0 -1
  103. package/dist/test/collection-facets/toggle-switch.test.js +0 -99
  104. package/dist/test/collection-facets/toggle-switch.test.js.map +0 -1
  105. package/dist/test/collection-facets.test.d.ts +0 -2
  106. package/dist/test/collection-facets.test.js +0 -728
  107. package/dist/test/collection-facets.test.js.map +0 -1
  108. package/dist/test/data-source/collection-browser-data-source.test.d.ts +0 -1
  109. package/dist/test/data-source/collection-browser-data-source.test.js +0 -154
  110. package/dist/test/data-source/collection-browser-data-source.test.js.map +0 -1
  111. package/dist/test/empty-placeholder.test.d.ts +0 -1
  112. package/dist/test/empty-placeholder.test.js +0 -57
  113. package/dist/test/empty-placeholder.test.js.map +0 -1
  114. package/dist/test/expanded-date-picker.test.d.ts +0 -1
  115. package/dist/test/expanded-date-picker.test.js +0 -124
  116. package/dist/test/expanded-date-picker.test.js.map +0 -1
  117. package/dist/test/icon-overlay.test.d.ts +0 -1
  118. package/dist/test/icon-overlay.test.js +0 -31
  119. package/dist/test/icon-overlay.test.js.map +0 -1
  120. package/dist/test/image-block.test.d.ts +0 -1
  121. package/dist/test/image-block.test.js +0 -208
  122. package/dist/test/image-block.test.js.map +0 -1
  123. package/dist/test/item-image.test.d.ts +0 -1
  124. package/dist/test/item-image.test.js +0 -187
  125. package/dist/test/item-image.test.js.map +0 -1
  126. package/dist/test/manage/manage-bar.test.d.ts +0 -3
  127. package/dist/test/manage/manage-bar.test.js +0 -216
  128. package/dist/test/manage/manage-bar.test.js.map +0 -1
  129. package/dist/test/manage/remove-items-modal-content.test.d.ts +0 -1
  130. package/dist/test/manage/remove-items-modal-content.test.js +0 -60
  131. package/dist/test/manage/remove-items-modal-content.test.js.map +0 -1
  132. package/dist/test/mediatype-config.test.d.ts +0 -1
  133. package/dist/test/mediatype-config.test.js +0 -11
  134. package/dist/test/mediatype-config.test.js.map +0 -1
  135. package/dist/test/mocks/mock-analytics-handler.d.ts +0 -10
  136. package/dist/test/mocks/mock-analytics-handler.js +0 -16
  137. package/dist/test/mocks/mock-analytics-handler.js.map +0 -1
  138. package/dist/test/mocks/mock-search-responses.d.ts +0 -31
  139. package/dist/test/mocks/mock-search-responses.js +0 -1241
  140. package/dist/test/mocks/mock-search-responses.js.map +0 -1
  141. package/dist/test/mocks/mock-search-service.d.ts +0 -16
  142. package/dist/test/mocks/mock-search-service.js +0 -64
  143. package/dist/test/mocks/mock-search-service.js.map +0 -1
  144. package/dist/test/restoration-state-handler.test.d.ts +0 -1
  145. package/dist/test/restoration-state-handler.test.js +0 -335
  146. package/dist/test/restoration-state-handler.test.js.map +0 -1
  147. package/dist/test/review-block.test.d.ts +0 -1
  148. package/dist/test/review-block.test.js +0 -46
  149. package/dist/test/review-block.test.js.map +0 -1
  150. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +0 -1
  151. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +0 -12
  152. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +0 -1
  153. package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +0 -1
  154. package/dist/test/sort-filter-bar/alpha-bar.test.js +0 -68
  155. package/dist/test/sort-filter-bar/alpha-bar.test.js.map +0 -1
  156. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +0 -1
  157. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +0 -326
  158. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +0 -1
  159. package/dist/test/text-overlay.test.d.ts +0 -1
  160. package/dist/test/text-overlay.test.js +0 -43
  161. package/dist/test/text-overlay.test.js.map +0 -1
  162. package/dist/test/text-snippet-block.test.d.ts +0 -1
  163. package/dist/test/text-snippet-block.test.js +0 -58
  164. package/dist/test/text-snippet-block.test.js.map +0 -1
  165. package/dist/test/tile-stats.test.d.ts +0 -1
  166. package/dist/test/tile-stats.test.js +0 -167
  167. package/dist/test/tile-stats.test.js.map +0 -1
  168. package/dist/test/tiles/grid/account-tile.test.d.ts +0 -1
  169. package/dist/test/tiles/grid/account-tile.test.js +0 -96
  170. package/dist/test/tiles/grid/account-tile.test.js.map +0 -1
  171. package/dist/test/tiles/grid/collection-tile.test.d.ts +0 -1
  172. package/dist/test/tiles/grid/collection-tile.test.js +0 -90
  173. package/dist/test/tiles/grid/collection-tile.test.js.map +0 -1
  174. package/dist/test/tiles/grid/item-tile.test.d.ts +0 -1
  175. package/dist/test/tiles/grid/item-tile.test.js +0 -400
  176. package/dist/test/tiles/grid/item-tile.test.js.map +0 -1
  177. package/dist/test/tiles/grid/search-tile.test.d.ts +0 -1
  178. package/dist/test/tiles/grid/search-tile.test.js +0 -62
  179. package/dist/test/tiles/grid/search-tile.test.js.map +0 -1
  180. package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +0 -1
  181. package/dist/test/tiles/hover/hover-pane-controller.test.js +0 -351
  182. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +0 -1
  183. package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +0 -1
  184. package/dist/test/tiles/hover/tile-hover-pane.test.js +0 -53
  185. package/dist/test/tiles/hover/tile-hover-pane.test.js.map +0 -1
  186. package/dist/test/tiles/list/tile-list-compact-header.test.d.ts +0 -1
  187. package/dist/test/tiles/list/tile-list-compact-header.test.js +0 -36
  188. package/dist/test/tiles/list/tile-list-compact-header.test.js.map +0 -1
  189. package/dist/test/tiles/list/tile-list-compact.test.d.ts +0 -1
  190. package/dist/test/tiles/list/tile-list-compact.test.js +0 -237
  191. package/dist/test/tiles/list/tile-list-compact.test.js.map +0 -1
  192. package/dist/test/tiles/list/tile-list.test.d.ts +0 -1
  193. package/dist/test/tiles/list/tile-list.test.js +0 -460
  194. package/dist/test/tiles/list/tile-list.test.js.map +0 -1
  195. package/dist/test/tiles/tile-dispatcher.test.d.ts +0 -1
  196. package/dist/test/tiles/tile-dispatcher.test.js +0 -246
  197. package/dist/test/tiles/tile-dispatcher.test.js.map +0 -1
  198. package/dist/test/tiles/tile-display-value-provider.test.d.ts +0 -1
  199. package/dist/test/tiles/tile-display-value-provider.test.js +0 -142
  200. package/dist/test/tiles/tile-display-value-provider.test.js.map +0 -1
  201. package/dist/test/tiles/tile-mediatype-icon.test.d.ts +0 -1
  202. package/dist/test/tiles/tile-mediatype-icon.test.js +0 -133
  203. package/dist/test/tiles/tile-mediatype-icon.test.js.map +0 -1
  204. package/dist/test/utils/array-equals.test.d.ts +0 -1
  205. package/dist/test/utils/array-equals.test.js +0 -27
  206. package/dist/test/utils/array-equals.test.js.map +0 -1
  207. package/dist/test/utils/format-count.test.d.ts +0 -1
  208. package/dist/test/utils/format-count.test.js +0 -24
  209. package/dist/test/utils/format-count.test.js.map +0 -1
  210. package/dist/test/utils/format-date.test.d.ts +0 -1
  211. package/dist/test/utils/format-date.test.js +0 -61
  212. package/dist/test/utils/format-date.test.js.map +0 -1
  213. package/dist/test/utils/format-unit-size.test.d.ts +0 -1
  214. package/dist/test/utils/format-unit-size.test.js +0 -18
  215. package/dist/test/utils/format-unit-size.test.js.map +0 -1
  216. package/dist/test/utils/local-date-from-utc.test.d.ts +0 -1
  217. package/dist/test/utils/local-date-from-utc.test.js +0 -27
  218. package/dist/test/utils/local-date-from-utc.test.js.map +0 -1
  219. package/eslint.config.mjs +0 -53
  220. package/index.html +0 -24
  221. package/index.ts +0 -29
  222. package/local.archive.org.cert +0 -86
  223. package/local.archive.org.key +0 -27
  224. package/pnpm-workspace.yaml +0 -30
  225. package/renovate.json +0 -6
  226. package/src/app-root.ts +0 -1284
  227. package/src/assets/img/icons/arrow-left.ts +0 -10
  228. package/src/assets/img/icons/arrow-right.ts +0 -10
  229. package/src/assets/img/icons/chevron.ts +0 -4
  230. package/src/assets/img/icons/close-circle-dark.ts +0 -5
  231. package/src/assets/img/icons/contract.ts +0 -9
  232. package/src/assets/img/icons/empty-query.ts +0 -5
  233. package/src/assets/img/icons/expand.ts +0 -9
  234. package/src/assets/img/icons/eye-closed.ts +0 -5
  235. package/src/assets/img/icons/eye.ts +0 -5
  236. package/src/assets/img/icons/favorite-filled.ts +0 -10
  237. package/src/assets/img/icons/favorite-unfilled.ts +0 -9
  238. package/src/assets/img/icons/filter.ts +0 -10
  239. package/src/assets/img/icons/login-required.ts +0 -18
  240. package/src/assets/img/icons/mediatype/account.ts +0 -14
  241. package/src/assets/img/icons/mediatype/audio.ts +0 -14
  242. package/src/assets/img/icons/mediatype/collection.ts +0 -12
  243. package/src/assets/img/icons/mediatype/data.ts +0 -15
  244. package/src/assets/img/icons/mediatype/etree.ts +0 -14
  245. package/src/assets/img/icons/mediatype/film.ts +0 -14
  246. package/src/assets/img/icons/mediatype/images.ts +0 -13
  247. package/src/assets/img/icons/mediatype/radio.ts +0 -15
  248. package/src/assets/img/icons/mediatype/search.ts +0 -14
  249. package/src/assets/img/icons/mediatype/software.ts +0 -13
  250. package/src/assets/img/icons/mediatype/texts.ts +0 -13
  251. package/src/assets/img/icons/mediatype/tv-commercial.ts +0 -12
  252. package/src/assets/img/icons/mediatype/tv-fact-check.ts +0 -12
  253. package/src/assets/img/icons/mediatype/tv-quote.ts +0 -12
  254. package/src/assets/img/icons/mediatype/tv.ts +0 -14
  255. package/src/assets/img/icons/mediatype/video.ts +0 -14
  256. package/src/assets/img/icons/mediatype/web.ts +0 -13
  257. package/src/assets/img/icons/null-result.ts +0 -5
  258. package/src/assets/img/icons/quote.ts +0 -7
  259. package/src/assets/img/icons/restricted.ts +0 -13
  260. package/src/assets/img/icons/reviews.ts +0 -11
  261. package/src/assets/img/icons/upload.ts +0 -12
  262. package/src/assets/img/icons/views.ts +0 -11
  263. package/src/circular-activity-indicator.ts +0 -64
  264. package/src/collection-browser.ts +0 -3187
  265. package/src/collection-facets/facet-row.ts +0 -309
  266. package/src/collection-facets/facet-tombstone-row.ts +0 -40
  267. package/src/collection-facets/facets-template.ts +0 -85
  268. package/src/collection-facets/models.ts +0 -10
  269. package/src/collection-facets/more-facets-content.ts +0 -644
  270. package/src/collection-facets/more-facets-pagination.ts +0 -294
  271. package/src/collection-facets/smart-facets/dedupe.ts +0 -44
  272. package/src/collection-facets/smart-facets/heuristics/browser-language/browser-language-heuristic.ts +0 -27
  273. package/src/collection-facets/smart-facets/heuristics/index.ts +0 -3
  274. package/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-heuristic.ts +0 -17
  275. package/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-map.ts +0 -70
  276. package/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.ts +0 -79
  277. package/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.ts +0 -93
  278. package/src/collection-facets/smart-facets/models.ts +0 -36
  279. package/src/collection-facets/smart-facets/smart-facet-bar.ts +0 -437
  280. package/src/collection-facets/smart-facets/smart-facet-button.ts +0 -145
  281. package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +0 -185
  282. package/src/collection-facets/smart-facets/smart-facet-equals.ts +0 -16
  283. package/src/collection-facets/smart-facets/smart-facet-heuristics.ts +0 -26
  284. package/src/collection-facets/toggle-switch.ts +0 -174
  285. package/src/collection-facets.ts +0 -1013
  286. package/src/data-source/collection-browser-data-source-interface.ts +0 -351
  287. package/src/data-source/collection-browser-data-source.ts +0 -1474
  288. package/src/data-source/collection-browser-query-state.ts +0 -60
  289. package/src/data-source/models.ts +0 -56
  290. package/src/empty-placeholder.ts +0 -192
  291. package/src/expanded-date-picker.ts +0 -191
  292. package/src/language-code-handler/language-code-handler.ts +0 -64
  293. package/src/language-code-handler/language-code-mapping.ts +0 -564
  294. package/src/manage/manage-bar.ts +0 -276
  295. package/src/manage/remove-items-modal-content.ts +0 -102
  296. package/src/mediatype/mediatype-config.ts +0 -146
  297. package/src/models.ts +0 -895
  298. package/src/restoration-state-handler.ts +0 -550
  299. package/src/sort-filter-bar/alpha-bar-tooltip.ts +0 -53
  300. package/src/sort-filter-bar/alpha-bar.ts +0 -252
  301. package/src/sort-filter-bar/img/compact.ts +0 -5
  302. package/src/sort-filter-bar/img/list.ts +0 -5
  303. package/src/sort-filter-bar/img/sort-toggle-disabled.ts +0 -15
  304. package/src/sort-filter-bar/img/sort-toggle-down.ts +0 -17
  305. package/src/sort-filter-bar/img/sort-toggle-up.ts +0 -17
  306. package/src/sort-filter-bar/img/sort-triangle.ts +0 -5
  307. package/src/sort-filter-bar/img/tile.ts +0 -5
  308. package/src/sort-filter-bar/sort-filter-bar.ts +0 -734
  309. package/src/styles/ia-button.ts +0 -139
  310. package/src/styles/item-image-styles.ts +0 -124
  311. package/src/styles/sr-only.ts +0 -18
  312. package/src/styles/tile-action-styles.ts +0 -59
  313. package/src/tiles/base-tile-component.ts +0 -124
  314. package/src/tiles/collection-browser-loading-tile.ts +0 -26
  315. package/src/tiles/grid/account-tile.ts +0 -113
  316. package/src/tiles/grid/collection-tile.ts +0 -184
  317. package/src/tiles/grid/item-tile.ts +0 -347
  318. package/src/tiles/grid/search-tile.ts +0 -90
  319. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +0 -130
  320. package/src/tiles/grid/tile-stats.ts +0 -211
  321. package/src/tiles/hover/hover-pane-controller.ts +0 -638
  322. package/src/tiles/hover/tile-hover-pane.ts +0 -184
  323. package/src/tiles/image-block.ts +0 -162
  324. package/src/tiles/item-image.ts +0 -214
  325. package/src/tiles/list/tile-list-compact-header.ts +0 -112
  326. package/src/tiles/list/tile-list-compact.ts +0 -278
  327. package/src/tiles/list/tile-list.ts +0 -718
  328. package/src/tiles/models.ts +0 -21
  329. package/src/tiles/overlay/icon-overlay.ts +0 -57
  330. package/src/tiles/overlay/text-overlay.ts +0 -79
  331. package/src/tiles/review-block.ts +0 -130
  332. package/src/tiles/text-snippet-block.ts +0 -132
  333. package/src/tiles/tile-dispatcher.ts +0 -637
  334. package/src/tiles/tile-display-value-provider.ts +0 -133
  335. package/src/tiles/tile-mediatype-icon.ts +0 -133
  336. package/src/utils/analytics-events.ts +0 -29
  337. package/src/utils/array-equals.ts +0 -8
  338. package/src/utils/collapse-repeated-quotes.ts +0 -13
  339. package/src/utils/date-filter-field.ts +0 -11
  340. package/src/utils/facet-utils.ts +0 -183
  341. package/src/utils/format-count.ts +0 -95
  342. package/src/utils/format-date.ts +0 -62
  343. package/src/utils/format-unit-size.ts +0 -43
  344. package/src/utils/local-date-from-utc.ts +0 -15
  345. package/src/utils/log.ts +0 -14
  346. package/src/utils/resolve-mediatype.ts +0 -26
  347. package/src/utils/sha1.ts +0 -9
  348. package/test/collection-browser.test.ts +0 -2694
  349. package/test/collection-facets/facet-row.test.ts +0 -421
  350. package/test/collection-facets/facets-template.test.ts +0 -139
  351. package/test/collection-facets/more-facets-content.test.ts +0 -231
  352. package/test/collection-facets/more-facets-pagination.test.ts +0 -201
  353. package/test/collection-facets/toggle-switch.test.ts +0 -164
  354. package/test/collection-facets.test.ts +0 -928
  355. package/test/data-source/collection-browser-data-source.test.ts +0 -193
  356. package/test/empty-placeholder.test.ts +0 -88
  357. package/test/expanded-date-picker.test.ts +0 -201
  358. package/test/icon-overlay.test.ts +0 -38
  359. package/test/image-block.test.ts +0 -247
  360. package/test/item-image.test.ts +0 -220
  361. package/test/manage/manage-bar.test.ts +0 -347
  362. package/test/manage/remove-items-modal-content.test.ts +0 -81
  363. package/test/mediatype-config.test.ts +0 -11
  364. package/test/mocks/mock-analytics-handler.ts +0 -30
  365. package/test/mocks/mock-search-responses.ts +0 -1364
  366. package/test/mocks/mock-search-service.ts +0 -134
  367. package/test/restoration-state-handler.test.ts +0 -480
  368. package/test/review-block.test.ts +0 -62
  369. package/test/sort-filter-bar/alpha-bar-tooltip.test.ts +0 -17
  370. package/test/sort-filter-bar/alpha-bar.test.ts +0 -101
  371. package/test/sort-filter-bar/sort-filter-bar.test.ts +0 -472
  372. package/test/text-overlay.test.ts +0 -55
  373. package/test/text-snippet-block.test.ts +0 -85
  374. package/test/tile-stats.test.ts +0 -191
  375. package/test/tiles/grid/account-tile.test.ts +0 -121
  376. package/test/tiles/grid/collection-tile.test.ts +0 -114
  377. package/test/tiles/grid/item-tile.test.ts +0 -520
  378. package/test/tiles/grid/search-tile.test.ts +0 -75
  379. package/test/tiles/hover/hover-pane-controller.test.ts +0 -482
  380. package/test/tiles/hover/tile-hover-pane.test.ts +0 -80
  381. package/test/tiles/list/tile-list-compact-header.test.ts +0 -43
  382. package/test/tiles/list/tile-list-compact.test.ts +0 -282
  383. package/test/tiles/list/tile-list.test.ts +0 -576
  384. package/test/tiles/tile-dispatcher.test.ts +0 -320
  385. package/test/tiles/tile-display-value-provider.test.ts +0 -172
  386. package/test/tiles/tile-mediatype-icon.test.ts +0 -160
  387. package/test/utils/array-equals.test.ts +0 -31
  388. package/test/utils/format-count.test.ts +0 -32
  389. package/test/utils/format-date.test.ts +0 -89
  390. package/test/utils/format-unit-size.test.ts +0 -21
  391. package/test/utils/local-date-from-utc.test.ts +0 -37
  392. package/tsconfig.json +0 -25
  393. package/types/dompurify.d.ts +0 -1
  394. package/vite.config.ts +0 -29
  395. package/web-dev-server.config.mjs +0 -30
  396. package/web-test-runner.config.mjs +0 -52
@@ -0,0 +1,429 @@
1
+ import { __decorate } from "tslib";
2
+ import { css, html, LitElement, unsafeCSS, } from 'lit';
3
+ import { customElement, property, query } from 'lit/decorators.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
5
+ import { ifDefined } from 'lit/directives/if-defined.js';
6
+ import { guard } from 'lit/directives/guard.js';
7
+ import { ref } from 'lit/directives/ref.js';
8
+ import { repeat } from 'lit/directives/repeat.js';
9
+ import { localized, msg } from '@lit/localize';
10
+ import arrowLeftIcon from '../assets/img/icons/arrow-left';
11
+ import arrowRightIcon from '../assets/img/icons/arrow-right';
12
+ import { srOnlyStyle } from '../styles/sr-only';
13
+ import { facetRowStyles, facetRowTemplate, getFacetState, } from './facet-row-template';
14
+ import { PageWindow } from './page-window';
15
+ import { MORE_FACETS__COLUMN_WIDTH, MORE_FACETS__ROWS_PER_COLUMN, } from './models';
16
+ /** Height in px reserved below the columns for the horizontal scrollbar */
17
+ const SCROLLBAR_SIZE = 12;
18
+ /**
19
+ * A long list of facet buckets laid out top to bottom in fixed-width columns
20
+ * that scroll horizontally and snap to whole pages. Only the pages around the
21
+ * viewport are in the DOM, so thousands of values stay responsive.
22
+ *
23
+ * Rows are plain DOM rather than `<facet-row>` elements, and one listener
24
+ * handles every row's checkbox clicks.
25
+ *
26
+ * See docs/design/column-virtualization.md before changing the windowing.
27
+ *
28
+ * @fires facetClick - A row's checkbox was clicked. Detail: `FacetEventDetails`
29
+ * @fires pageChanged - The scroller came to rest on a different page. Detail:
30
+ * the 0-based page index
31
+ */
32
+ let MoreFacetsScroller = class MoreFacetsScroller extends LitElement {
33
+ constructor() {
34
+ super(...arguments);
35
+ /** Every bucket to show, in display order */
36
+ this.buckets = [];
37
+ /** How many buckets to stack in each column before starting the next one */
38
+ this.rowsPerColumn = MORE_FACETS__ROWS_PER_COLUMN;
39
+ /**
40
+ * Whether rows leave out their hide (eye) button, unless the value is
41
+ * already hidden. Set it when the facet has only one value in all, since
42
+ * hiding that would leave no results. Don't base it on how many rows are
43
+ * showing: a filter that leaves a single row still needs its hide button.
44
+ */
45
+ this.omitHideButtons = false;
46
+ this.win = new PageWindow(this, {
47
+ colWidth: MORE_FACETS__COLUMN_WIDTH,
48
+ total: 0,
49
+ onRest: page => this.rested(page),
50
+ });
51
+ /** The last page reported in a `pageChanged` event */
52
+ this.reportedPage = 0;
53
+ }
54
+ /** The page resting at the start of the viewport */
55
+ get currentPage() {
56
+ return this.win.currentPage;
57
+ }
58
+ /** How many pages the buckets span at the current width */
59
+ get pageCount() {
60
+ return this.win.pageCount;
61
+ }
62
+ /** Scrolls so that `page` rests at the start of the viewport */
63
+ scrollToPage(page, behavior = 'auto') {
64
+ this.win.scrollToPage(page, behavior);
65
+ }
66
+ willUpdate(changed) {
67
+ if (changed.has('buckets') || changed.has('rowsPerColumn')) {
68
+ this.win.setTotal(Math.ceil(this.buckets.length / this.rowsPerColumn));
69
+ }
70
+ this.keepFocusOnScreen();
71
+ }
72
+ render() {
73
+ const w = this.win;
74
+ const live = [];
75
+ for (let i = w.first; i <= w.last; i++)
76
+ live.push(i);
77
+ return html `
78
+ <div class="scroll-nav">
79
+ ${this.arrowTemplate('prev')}
80
+ <div class="frame">
81
+ <div
82
+ class="scroller"
83
+ role="group"
84
+ aria-label=${ifDefined(this.label)}
85
+ tabindex=${w.pageCount > 0 ? 0 : -1}
86
+ style="--rowsPerColumn: ${this.rowsPerColumn}"
87
+ ${ref(w.attach)}
88
+ @click=${this.rowClicked}
89
+ @focusin=${this.rowFocused}
90
+ >
91
+ <div class="sizer" style="width:${w.totalWidth}px">
92
+ ${guard([w.pageCount, w.pageWidth, w.totalWidth], () => this.snapStubsTemplate())}
93
+ ${repeat(live, i => i, i => html `<div
94
+ class="page"
95
+ data-page=${i}
96
+ style="left:${i * w.pageWidth}px;width:${w.pageSpan(i)}px"
97
+ >
98
+ ${this.pageTemplate(i)}
99
+ </div>`)}
100
+ </div>
101
+ </div>
102
+ </div>
103
+ ${this.arrowTemplate('next')}
104
+ </div>
105
+ `;
106
+ }
107
+ /**
108
+ * One empty snap target per page, always mounted. The browser keeps
109
+ * re-picking its snap target while a fling decelerates, so the targets must
110
+ * not come and go with the window of rendered pages.
111
+ */
112
+ snapStubsTemplate() {
113
+ const w = this.win;
114
+ const all = Array.from({ length: w.pageCount }, (_, i) => i);
115
+ return html `${repeat(all, i => i, i => html `<div
116
+ class="snap-stub"
117
+ style="left:${i * w.pageWidth}px;width:${w.pageSpan(i)}px"
118
+ ></div>`)}`;
119
+ }
120
+ /** The columns of rows on page `page` */
121
+ pageTemplate(page) {
122
+ const { facetType, buckets, rowsPerColumn } = this;
123
+ if (!facetType)
124
+ return [];
125
+ const { colsPerPage } = this.win;
126
+ const firstCol = page * colsPerPage;
127
+ const endCol = Math.min(firstCol + colsPerPage, Math.ceil(buckets.length / rowsPerColumn));
128
+ const columns = [];
129
+ for (let col = firstCol; col < endCol; col++) {
130
+ const start = col * rowsPerColumn;
131
+ const rows = buckets.slice(start, start + rowsPerColumn);
132
+ columns.push(html `<div class="column">
133
+ ${rows.map(bucket => facetRowTemplate({
134
+ facetType,
135
+ bucket,
136
+ collectionTitles: this.collectionTitles,
137
+ omitHideButton: this.omitHideButtons,
138
+ }))}
139
+ </div>`);
140
+ }
141
+ return columns;
142
+ }
143
+ arrowTemplate(direction) {
144
+ const { currentPage, pageCount } = this.win;
145
+ const isPrev = direction === 'prev';
146
+ const disabled = isPrev ? currentPage <= 0 : currentPage >= pageCount - 1;
147
+ // Arrows keep their space even when there's nothing to scroll to, so that
148
+ // showing them never changes how many columns fit.
149
+ const classes = classMap({
150
+ 'scroll-arrow': true,
151
+ [direction]: true,
152
+ unneeded: pageCount <= 1,
153
+ });
154
+ return html `<button
155
+ type="button"
156
+ class=${classes}
157
+ ?disabled=${disabled}
158
+ aria-label=${isPrev
159
+ ? msg('Show previous page of values')
160
+ : msg('Show next page of values')}
161
+ @click=${() => this.arrowClicked(isPrev ? -1 : 1)}
162
+ >
163
+ ${isPrev ? arrowLeftIcon : arrowRightIcon}
164
+ </button>`;
165
+ }
166
+ /**
167
+ * Handles clicks on any row's checkboxes. The rows have no listeners of
168
+ * their own.
169
+ */
170
+ rowClicked(e) {
171
+ const input = e.target;
172
+ const { facetType } = this;
173
+ if (!(input instanceof HTMLInputElement) || !facetType)
174
+ return;
175
+ const bucket = this.buckets.find(b => b.key === input.value);
176
+ if (!bucket)
177
+ return;
178
+ const negative = input.classList.contains('hide-facet-checkbox');
179
+ this.dispatchEvent(new CustomEvent('facetClick', {
180
+ detail: {
181
+ facetType,
182
+ bucket: { ...bucket, state: getFacetState(input.checked, negative) },
183
+ negative,
184
+ },
185
+ }));
186
+ }
187
+ /**
188
+ * When focus comes into the rows from outside them, or from the scroller
189
+ * itself (a tab stop just before the rows), keeps it on the page being
190
+ * shown. Otherwise Tab lands on the mounted page before this one, and
191
+ * Shift+Tab on the last one after it, and the browser scrolls there.
192
+ * Moving from row to row is left alone, so Tab and Shift+Tab still carry on
193
+ * into the next or previous page.
194
+ */
195
+ rowFocused(e) {
196
+ const { scroller } = this;
197
+ const row = e.target;
198
+ if (!scroller || !(row instanceof HTMLElement) || row === scroller)
199
+ return;
200
+ const from = e.relatedTarget;
201
+ const fromRows = from instanceof Node && from !== scroller && scroller.contains(from);
202
+ if (fromRows)
203
+ return;
204
+ const page = Number(row.closest('.page')?.dataset.page);
205
+ const { currentPage } = this.win;
206
+ if (Number.isNaN(page) || page === currentPage)
207
+ return;
208
+ const rowsOnPage = [
209
+ ...scroller.querySelectorAll(`.page[data-page="${currentPage}"] input`),
210
+ ].filter(input => !input.closest('[hidden]'));
211
+ const target = page < currentPage ? rowsOnPage[0] : rowsOnPage[rowsOnPage.length - 1];
212
+ target?.focus({ preventScroll: true });
213
+ // Whatever moved focus may also scroll to the row it picked: in the
214
+ // dialog, modal-manager's focus trap already has, before this event; the
215
+ // browser's own Tab does just after this handler returns. Put the page
216
+ // back now, and again before the next frame is painted (and before the
217
+ // window is recomputed, so this page stays mounted).
218
+ this.win.scrollToPage(currentPage);
219
+ requestAnimationFrame(() => this.win.scrollToPage(currentPage));
220
+ }
221
+ /**
222
+ * If a row has focus and its page is about to leave the window, moves focus
223
+ * to the scroller itself. Otherwise focus would fall back to the document
224
+ * when the page is removed, and the arrow keys would stop scrolling. The
225
+ * scroller being a tab stop matters here: modal-manager's focus trap only
226
+ * moves Tab between tabbable elements, and from anything else it goes back
227
+ * to the start of the dialog.
228
+ */
229
+ keepFocusOnScreen() {
230
+ const focusedPage = this.shadowRoot?.activeElement?.closest('.page');
231
+ if (!focusedPage)
232
+ return;
233
+ const page = Number(focusedPage.dataset.page);
234
+ if (page >= this.win.first && page <= this.win.last)
235
+ return;
236
+ this.scroller?.focus({ preventScroll: true });
237
+ }
238
+ arrowClicked(step) {
239
+ // Count from where an earlier click is already headed, so that clicking
240
+ // twice quickly moves two pages.
241
+ const from = this.pendingPage ?? this.win.currentPage;
242
+ const target = Math.max(0, Math.min(from + step, this.win.pageCount - 1));
243
+ this.pendingPage = target;
244
+ const reduceMotion = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
245
+ this.win.scrollToPage(target, reduceMotion ? 'auto' : 'smooth');
246
+ }
247
+ rested(page) {
248
+ this.pendingPage = undefined;
249
+ if (page === this.reportedPage)
250
+ return;
251
+ this.reportedPage = page;
252
+ this.dispatchEvent(new CustomEvent('pageChanged', { detail: page }));
253
+ }
254
+ static get styles() {
255
+ const colWidth = unsafeCSS(`${MORE_FACETS__COLUMN_WIDTH}px`);
256
+ const scrollbarSize = unsafeCSS(`${SCROLLBAR_SIZE}px`);
257
+ const ownCss = css `
258
+ :host {
259
+ display: block;
260
+ --colWidth: ${colWidth};
261
+ --facetRowHeight: 2.4rem;
262
+ }
263
+
264
+ .scroll-nav {
265
+ display: flex;
266
+ align-items: center;
267
+ }
268
+
269
+ .frame {
270
+ flex: 1 1 auto;
271
+ min-width: 0;
272
+ container-type: inline-size;
273
+ }
274
+
275
+ .scroller {
276
+ /* Fallback where round() is unsupported: fill the frame */
277
+ width: 100%;
278
+ /* Otherwise round down to whole columns, so none is ever cut off */
279
+ width: max(
280
+ round(down, 100cqi, var(--colWidth)),
281
+ min(100cqi, var(--colWidth))
282
+ );
283
+ height: calc(
284
+ var(--rowsPerColumn) * var(--facetRowHeight) + ${scrollbarSize}
285
+ );
286
+ margin: 0 auto;
287
+ outline-offset: 2px;
288
+ overflow-x: auto;
289
+ overflow-y: hidden;
290
+ contain: strict;
291
+ scroll-snap-type: x mandatory;
292
+ /* scroll-snap-stop stays at its default 'normal' so a fling can cross
293
+ many pages before resting. 'always' would force one page per gesture. */
294
+ }
295
+
296
+ /* Keep the scrollbar visible, so it's clear there is more to see */
297
+ .scroller::-webkit-scrollbar {
298
+ height: ${scrollbarSize};
299
+ }
300
+ .scroller::-webkit-scrollbar-track {
301
+ background: #f1f1f1;
302
+ border-radius: 6px;
303
+ }
304
+ .scroller::-webkit-scrollbar-thumb {
305
+ background: #888;
306
+ border-radius: 6px;
307
+ }
308
+ .scroller::-webkit-scrollbar-thumb:hover {
309
+ background: #555;
310
+ }
311
+ /* Chrome ignores the rules above once these are set, so only Firefox gets them */
312
+ @supports not selector(::-webkit-scrollbar) {
313
+ .scroller {
314
+ scrollbar-width: thin;
315
+ scrollbar-color: #888 #f1f1f1;
316
+ }
317
+ }
318
+
319
+ .sizer {
320
+ position: relative;
321
+ height: 100%;
322
+ }
323
+
324
+ .snap-stub {
325
+ position: absolute;
326
+ top: 0;
327
+ height: 100%;
328
+ scroll-snap-align: start;
329
+ pointer-events: none;
330
+ contain: strict;
331
+ }
332
+
333
+ .page {
334
+ position: absolute;
335
+ top: 0;
336
+ height: 100%;
337
+ display: flex;
338
+ contain: content;
339
+ content-visibility: auto;
340
+ contain-intrinsic-size: auto none;
341
+ }
342
+
343
+ .column {
344
+ flex: none;
345
+ width: var(--colWidth);
346
+ box-sizing: border-box;
347
+ padding: 0 0.75rem;
348
+ }
349
+
350
+ /* Rows are a fixed height with one line of text, so every column holds
351
+ exactly rowsPerColumn rows. The full text is in the row's tooltip. */
352
+ .facet-row-container {
353
+ height: var(--facetRowHeight);
354
+ box-sizing: border-box;
355
+ align-items: center;
356
+ }
357
+ .facet-info-display {
358
+ flex-wrap: nowrap;
359
+ min-width: 0;
360
+ }
361
+ .facet-title {
362
+ min-width: 0;
363
+ overflow: hidden;
364
+ white-space: nowrap;
365
+ text-overflow: ellipsis;
366
+ word-break: normal;
367
+ }
368
+ .facet-count {
369
+ flex: none;
370
+ padding-left: 0.5rem;
371
+ }
372
+
373
+ .scroll-arrow {
374
+ flex: none;
375
+ width: 2.4rem;
376
+ padding: 0.5rem;
377
+ background: none;
378
+ border: none;
379
+ cursor: pointer;
380
+ }
381
+ .scroll-arrow svg {
382
+ height: 14px;
383
+ fill: #2c2c2c;
384
+ }
385
+ .scroll-arrow:disabled {
386
+ opacity: 0.3;
387
+ cursor: default;
388
+ }
389
+ .scroll-arrow.unneeded {
390
+ visibility: hidden;
391
+ }
392
+
393
+ /* Touch screens swipe; the space is better spent on the column */
394
+ @media (max-width: 560px) {
395
+ .scroll-arrow {
396
+ display: none;
397
+ }
398
+ }
399
+ `;
400
+ return [srOnlyStyle, facetRowStyles, ownCss];
401
+ }
402
+ };
403
+ __decorate([
404
+ property({ type: String })
405
+ ], MoreFacetsScroller.prototype, "facetType", void 0);
406
+ __decorate([
407
+ property({ type: Array })
408
+ ], MoreFacetsScroller.prototype, "buckets", void 0);
409
+ __decorate([
410
+ property({ type: Object })
411
+ ], MoreFacetsScroller.prototype, "collectionTitles", void 0);
412
+ __decorate([
413
+ property({ type: Number })
414
+ ], MoreFacetsScroller.prototype, "rowsPerColumn", void 0);
415
+ __decorate([
416
+ property({ type: Boolean })
417
+ ], MoreFacetsScroller.prototype, "omitHideButtons", void 0);
418
+ __decorate([
419
+ property({ type: String })
420
+ ], MoreFacetsScroller.prototype, "label", void 0);
421
+ __decorate([
422
+ query('.scroller')
423
+ ], MoreFacetsScroller.prototype, "scroller", void 0);
424
+ MoreFacetsScroller = __decorate([
425
+ customElement('more-facets-scroller'),
426
+ localized()
427
+ ], MoreFacetsScroller);
428
+ export { MoreFacetsScroller };
429
+ //# sourceMappingURL=more-facets-scroller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"more-facets-scroller.js","sourceRoot":"","sources":["../../../src/collection-facets/more-facets-scroller.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EAEH,IAAI,EACJ,UAAU,EAGV,SAAS,GACV,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,aAAa,MAAM,gCAAgC,CA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AqG1B,CAAC;QAEF,OAAO,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;CACF,CAAA;AAhb6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAyB;AAGzB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;mDAA6B;AAG3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAqC;AAGpC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAA8C;AAQ5C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2DAAyB;AAGzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAgB;AAenC;IADP,KAAK,CAAC,WAAW,CAAC;oDACY;AArCpB,kBAAkB;IAF9B,aAAa,CAAC,sBAAsB,CAAC;IACrC,SAAS,EAAE;GACC,kBAAkB,CAkb9B","sourcesContent":["import {\n css,\n CSSResultGroup,\n html,\n LitElement,\n PropertyValues,\n TemplateResult,\n unsafeCSS,\n} from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { guard } from 'lit/directives/guard.js';\nimport { ref } from 'lit/directives/ref.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { localized, msg } from '@lit/localize';\nimport type { FacetBucket, FacetEventDetails, FacetOption } from '../models';\nimport type { CollectionTitles } from '../data-source/models';\nimport arrowLeftIcon from '../assets/img/icons/arrow-left';\nimport arrowRightIcon from '../assets/img/icons/arrow-right';\nimport { srOnlyStyle } from '../styles/sr-only';\nimport {\n facetRowStyles,\n facetRowTemplate,\n getFacetState,\n} from './facet-row-template';\nimport { PageWindow } from './page-window';\nimport {\n MORE_FACETS__COLUMN_WIDTH,\n MORE_FACETS__ROWS_PER_COLUMN,\n} from './models';\n\n/** Height in px reserved below the columns for the horizontal scrollbar */\nconst SCROLLBAR_SIZE = 12;\n\n/**\n * A long list of facet buckets laid out top to bottom in fixed-width columns\n * that scroll horizontally and snap to whole pages. Only the pages around the\n * viewport are in the DOM, so thousands of values stay responsive.\n *\n * Rows are plain DOM rather than `<facet-row>` elements, and one listener\n * handles every row's checkbox clicks.\n *\n * See docs/design/column-virtualization.md before changing the windowing.\n *\n * @fires facetClick - A row's checkbox was clicked. Detail: `FacetEventDetails`\n * @fires pageChanged - The scroller came to rest on a different page. Detail:\n * the 0-based page index\n */\n@customElement('more-facets-scroller')\n@localized()\nexport class MoreFacetsScroller extends LitElement {\n /** The name of the facet group the buckets belong to (e.g., \"subject\") */\n @property({ type: String }) facetType?: FacetOption;\n\n /** Every bucket to show, in display order */\n @property({ type: Array }) buckets: FacetBucket[] = [];\n\n /** The collection name cache for converting collection identifiers to titles */\n @property({ type: Object }) collectionTitles?: CollectionTitles;\n\n /** How many buckets to stack in each column before starting the next one */\n @property({ type: Number }) rowsPerColumn = MORE_FACETS__ROWS_PER_COLUMN;\n\n /**\n * Whether rows leave out their hide (eye) button, unless the value is\n * already hidden. Set it when the facet has only one value in all, since\n * hiding that would leave no results. Don't base it on how many rows are\n * showing: a filter that leaves a single row still needs its hide button.\n */\n @property({ type: Boolean }) omitHideButtons = false;\n\n /** Accessible name for the columns, e.g. \"Subject values\" */\n @property({ type: String }) label?: string;\n\n private win = new PageWindow(this, {\n colWidth: MORE_FACETS__COLUMN_WIDTH,\n total: 0,\n onRest: page => this.rested(page),\n });\n\n /** The page an arrow button is scrolling to, until the scroller rests */\n private pendingPage?: number;\n\n /** The last page reported in a `pageChanged` event */\n private reportedPage = 0;\n\n @query('.scroller')\n private scroller?: HTMLElement;\n\n /** The page resting at the start of the viewport */\n get currentPage(): number {\n return this.win.currentPage;\n }\n\n /** How many pages the buckets span at the current width */\n get pageCount(): number {\n return this.win.pageCount;\n }\n\n /** Scrolls so that `page` rests at the start of the viewport */\n scrollToPage(page: number, behavior: ScrollBehavior = 'auto'): void {\n this.win.scrollToPage(page, behavior);\n }\n\n willUpdate(changed: PropertyValues): void {\n if (changed.has('buckets') || changed.has('rowsPerColumn')) {\n this.win.setTotal(Math.ceil(this.buckets.length / this.rowsPerColumn));\n }\n this.keepFocusOnScreen();\n }\n\n render(): TemplateResult {\n const w = this.win;\n const live: number[] = [];\n for (let i = w.first; i <= w.last; i++) live.push(i);\n\n return html`\n <div class=\"scroll-nav\">\n ${this.arrowTemplate('prev')}\n <div class=\"frame\">\n <div\n class=\"scroller\"\n role=\"group\"\n aria-label=${ifDefined(this.label)}\n tabindex=${w.pageCount > 0 ? 0 : -1}\n style=\"--rowsPerColumn: ${this.rowsPerColumn}\"\n ${ref(w.attach)}\n @click=${this.rowClicked}\n @focusin=${this.rowFocused}\n >\n <div class=\"sizer\" style=\"width:${w.totalWidth}px\">\n ${guard([w.pageCount, w.pageWidth, w.totalWidth], () =>\n this.snapStubsTemplate(),\n )}\n ${repeat(\n live,\n i => i,\n i =>\n html`<div\n class=\"page\"\n data-page=${i}\n style=\"left:${i * w.pageWidth}px;width:${w.pageSpan(i)}px\"\n >\n ${this.pageTemplate(i)}\n </div>`,\n )}\n </div>\n </div>\n </div>\n ${this.arrowTemplate('next')}\n </div>\n `;\n }\n\n /**\n * One empty snap target per page, always mounted. The browser keeps\n * re-picking its snap target while a fling decelerates, so the targets must\n * not come and go with the window of rendered pages.\n */\n private snapStubsTemplate(): TemplateResult {\n const w = this.win;\n const all = Array.from({ length: w.pageCount }, (_, i) => i);\n return html`${repeat(\n all,\n i => i,\n i =>\n html`<div\n class=\"snap-stub\"\n style=\"left:${i * w.pageWidth}px;width:${w.pageSpan(i)}px\"\n ></div>`,\n )}`;\n }\n\n /** The columns of rows on page `page` */\n private pageTemplate(page: number): TemplateResult[] {\n const { facetType, buckets, rowsPerColumn } = this;\n if (!facetType) return [];\n\n const { colsPerPage } = this.win;\n const firstCol = page * colsPerPage;\n const endCol = Math.min(\n firstCol + colsPerPage,\n Math.ceil(buckets.length / rowsPerColumn),\n );\n\n const columns: TemplateResult[] = [];\n for (let col = firstCol; col < endCol; col++) {\n const start = col * rowsPerColumn;\n const rows = buckets.slice(start, start + rowsPerColumn);\n columns.push(\n html`<div class=\"column\">\n ${rows.map(bucket =>\n facetRowTemplate({\n facetType,\n bucket,\n collectionTitles: this.collectionTitles,\n omitHideButton: this.omitHideButtons,\n }),\n )}\n </div>`,\n );\n }\n return columns;\n }\n\n private arrowTemplate(direction: 'prev' | 'next'): TemplateResult {\n const { currentPage, pageCount } = this.win;\n const isPrev = direction === 'prev';\n const disabled = isPrev ? currentPage <= 0 : currentPage >= pageCount - 1;\n\n // Arrows keep their space even when there's nothing to scroll to, so that\n // showing them never changes how many columns fit.\n const classes = classMap({\n 'scroll-arrow': true,\n [direction]: true,\n unneeded: pageCount <= 1,\n });\n\n return html`<button\n type=\"button\"\n class=${classes}\n ?disabled=${disabled}\n aria-label=${isPrev\n ? msg('Show previous page of values')\n : msg('Show next page of values')}\n @click=${() => this.arrowClicked(isPrev ? -1 : 1)}\n >\n ${isPrev ? arrowLeftIcon : arrowRightIcon}\n </button>`;\n }\n\n /**\n * Handles clicks on any row's checkboxes. The rows have no listeners of\n * their own.\n */\n private rowClicked(e: Event): void {\n const input = e.target;\n const { facetType } = this;\n if (!(input instanceof HTMLInputElement) || !facetType) return;\n\n const bucket = this.buckets.find(b => b.key === input.value);\n if (!bucket) return;\n\n const negative = input.classList.contains('hide-facet-checkbox');\n this.dispatchEvent(\n new CustomEvent<FacetEventDetails>('facetClick', {\n detail: {\n facetType,\n bucket: { ...bucket, state: getFacetState(input.checked, negative) },\n negative,\n },\n }),\n );\n }\n\n /**\n * When focus comes into the rows from outside them, or from the scroller\n * itself (a tab stop just before the rows), keeps it on the page being\n * shown. Otherwise Tab lands on the mounted page before this one, and\n * Shift+Tab on the last one after it, and the browser scrolls there.\n * Moving from row to row is left alone, so Tab and Shift+Tab still carry on\n * into the next or previous page.\n */\n private rowFocused(e: FocusEvent): void {\n const { scroller } = this;\n const row = e.target;\n if (!scroller || !(row instanceof HTMLElement) || row === scroller) return;\n\n const from = e.relatedTarget;\n const fromRows =\n from instanceof Node && from !== scroller && scroller.contains(from);\n if (fromRows) return;\n\n const page = Number(row.closest<HTMLElement>('.page')?.dataset.page);\n const { currentPage } = this.win;\n if (Number.isNaN(page) || page === currentPage) return;\n\n const rowsOnPage = [\n ...scroller.querySelectorAll<HTMLElement>(\n `.page[data-page=\"${currentPage}\"] input`,\n ),\n ].filter(input => !input.closest('[hidden]'));\n const target =\n page < currentPage ? rowsOnPage[0] : rowsOnPage[rowsOnPage.length - 1];\n target?.focus({ preventScroll: true });\n\n // Whatever moved focus may also scroll to the row it picked: in the\n // dialog, modal-manager's focus trap already has, before this event; the\n // browser's own Tab does just after this handler returns. Put the page\n // back now, and again before the next frame is painted (and before the\n // window is recomputed, so this page stays mounted).\n this.win.scrollToPage(currentPage);\n requestAnimationFrame(() => this.win.scrollToPage(currentPage));\n }\n\n /**\n * If a row has focus and its page is about to leave the window, moves focus\n * to the scroller itself. Otherwise focus would fall back to the document\n * when the page is removed, and the arrow keys would stop scrolling. The\n * scroller being a tab stop matters here: modal-manager's focus trap only\n * moves Tab between tabbable elements, and from anything else it goes back\n * to the start of the dialog.\n */\n private keepFocusOnScreen(): void {\n const focusedPage =\n this.shadowRoot?.activeElement?.closest<HTMLElement>('.page');\n if (!focusedPage) return;\n const page = Number(focusedPage.dataset.page);\n if (page >= this.win.first && page <= this.win.last) return;\n this.scroller?.focus({ preventScroll: true });\n }\n\n private arrowClicked(step: 1 | -1): void {\n // Count from where an earlier click is already headed, so that clicking\n // twice quickly moves two pages.\n const from = this.pendingPage ?? this.win.currentPage;\n const target = Math.max(0, Math.min(from + step, this.win.pageCount - 1));\n this.pendingPage = target;\n\n const reduceMotion = window.matchMedia?.(\n '(prefers-reduced-motion: reduce)',\n ).matches;\n this.win.scrollToPage(target, reduceMotion ? 'auto' : 'smooth');\n }\n\n private rested(page: number): void {\n this.pendingPage = undefined;\n if (page === this.reportedPage) return;\n this.reportedPage = page;\n this.dispatchEvent(\n new CustomEvent<number>('pageChanged', { detail: page }),\n );\n }\n\n static get styles(): CSSResultGroup {\n const colWidth = unsafeCSS(`${MORE_FACETS__COLUMN_WIDTH}px`);\n const scrollbarSize = unsafeCSS(`${SCROLLBAR_SIZE}px`);\n\n const ownCss = css`\n :host {\n display: block;\n --colWidth: ${colWidth};\n --facetRowHeight: 2.4rem;\n }\n\n .scroll-nav {\n display: flex;\n align-items: center;\n }\n\n .frame {\n flex: 1 1 auto;\n min-width: 0;\n container-type: inline-size;\n }\n\n .scroller {\n /* Fallback where round() is unsupported: fill the frame */\n width: 100%;\n /* Otherwise round down to whole columns, so none is ever cut off */\n width: max(\n round(down, 100cqi, var(--colWidth)),\n min(100cqi, var(--colWidth))\n );\n height: calc(\n var(--rowsPerColumn) * var(--facetRowHeight) + ${scrollbarSize}\n );\n margin: 0 auto;\n outline-offset: 2px;\n overflow-x: auto;\n overflow-y: hidden;\n contain: strict;\n scroll-snap-type: x mandatory;\n /* scroll-snap-stop stays at its default 'normal' so a fling can cross\n many pages before resting. 'always' would force one page per gesture. */\n }\n\n /* Keep the scrollbar visible, so it's clear there is more to see */\n .scroller::-webkit-scrollbar {\n height: ${scrollbarSize};\n }\n .scroller::-webkit-scrollbar-track {\n background: #f1f1f1;\n border-radius: 6px;\n }\n .scroller::-webkit-scrollbar-thumb {\n background: #888;\n border-radius: 6px;\n }\n .scroller::-webkit-scrollbar-thumb:hover {\n background: #555;\n }\n /* Chrome ignores the rules above once these are set, so only Firefox gets them */\n @supports not selector(::-webkit-scrollbar) {\n .scroller {\n scrollbar-width: thin;\n scrollbar-color: #888 #f1f1f1;\n }\n }\n\n .sizer {\n position: relative;\n height: 100%;\n }\n\n .snap-stub {\n position: absolute;\n top: 0;\n height: 100%;\n scroll-snap-align: start;\n pointer-events: none;\n contain: strict;\n }\n\n .page {\n position: absolute;\n top: 0;\n height: 100%;\n display: flex;\n contain: content;\n content-visibility: auto;\n contain-intrinsic-size: auto none;\n }\n\n .column {\n flex: none;\n width: var(--colWidth);\n box-sizing: border-box;\n padding: 0 0.75rem;\n }\n\n /* Rows are a fixed height with one line of text, so every column holds\n exactly rowsPerColumn rows. The full text is in the row's tooltip. */\n .facet-row-container {\n height: var(--facetRowHeight);\n box-sizing: border-box;\n align-items: center;\n }\n .facet-info-display {\n flex-wrap: nowrap;\n min-width: 0;\n }\n .facet-title {\n min-width: 0;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n word-break: normal;\n }\n .facet-count {\n flex: none;\n padding-left: 0.5rem;\n }\n\n .scroll-arrow {\n flex: none;\n width: 2.4rem;\n padding: 0.5rem;\n background: none;\n border: none;\n cursor: pointer;\n }\n .scroll-arrow svg {\n height: 14px;\n fill: #2c2c2c;\n }\n .scroll-arrow:disabled {\n opacity: 0.3;\n cursor: default;\n }\n .scroll-arrow.unneeded {\n visibility: hidden;\n }\n\n /* Touch screens swipe; the space is better spent on the column */\n @media (max-width: 560px) {\n .scroll-arrow {\n display: none;\n }\n }\n `;\n\n return [srOnlyStyle, facetRowStyles, ownCss];\n }\n}\n"]}
@@ -0,0 +1,73 @@
1
+ import type { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ export type PageWindowConfig = {
3
+ /** Width in px of every column. Columns are uniform. */
4
+ colWidth: number;
5
+ /** Total number of columns in the dataset. */
6
+ total: number;
7
+ /** Pages kept mounted on each side of the visible ones. Defaults to 1. */
8
+ buffer?: number;
9
+ /**
10
+ * Called each time the scroller comes to rest (or is re-laid out), with the
11
+ * page it rests on. Fires even when that page hasn't changed.
12
+ */
13
+ onRest?: (page: number) => void;
14
+ };
15
+ /**
16
+ * Windowing controller for a horizontal scroller of fixed-width columns that
17
+ * snaps to page boundaries. Tracks which pages should be in the DOM (`first`
18
+ * through `last`) and which page the scroller last came to rest on.
19
+ *
20
+ * All positions are arithmetic on `colWidth`; the only measurement is the
21
+ * scroller's width, which comes from a ResizeObserver.
22
+ *
23
+ * See docs/design/column-virtualization.md before changing this, especially
24
+ * its invariants.
25
+ */
26
+ export declare class PageWindow implements ReactiveController {
27
+ private host;
28
+ private cfg;
29
+ /** Index of the first mounted page. */
30
+ first: number;
31
+ /** Index of the last mounted page, or -1 when nothing is mounted. */
32
+ last: number;
33
+ /** How many columns fit in the scroller, derived from its measured width. */
34
+ colsPerPage: number;
35
+ /** The page the scroller last came to rest on. */
36
+ currentPage: number;
37
+ private scroller?;
38
+ private viewportW;
39
+ private frame;
40
+ private landFrame;
41
+ private endTimer;
42
+ private ro?;
43
+ /** Page to realign to once the host has re-rendered at a new page width. */
44
+ private realignTo?;
45
+ /** Whether to re-check the resting page once the host has re-rendered. */
46
+ private relandAfterUpdate;
47
+ constructor(host: ReactiveControllerHost, cfg: PageWindowConfig);
48
+ get pageWidth(): number;
49
+ get pageCount(): number;
50
+ get totalWidth(): number;
51
+ /**
52
+ * Width of page `i`. Every page is `pageWidth` except a partial last page,
53
+ * which is trimmed so that nothing extends the scroll area past `totalWidth`.
54
+ */
55
+ pageSpan(i: number): number;
56
+ /** Updates the number of columns, e.g. when the dataset is filtered. */
57
+ setTotal(total: number): void;
58
+ /** Scrolls so that `page` sits at the start of the viewport. */
59
+ scrollToPage(page: number, behavior?: ScrollBehavior): void;
60
+ /** Ref callback for the scroll container. */
61
+ attach: (el?: Element) => void;
62
+ hostUpdated(): void;
63
+ hostDisconnected(): void;
64
+ private detach;
65
+ private onResize;
66
+ private onScroll;
67
+ /** Fallback for browsers without `scrollend`: treat 120ms of quiet as rest. */
68
+ private onScrollIdle;
69
+ private onScrollEnd;
70
+ private recompute;
71
+ /** Records which page the scroller is resting on. */
72
+ private land;
73
+ }