@internetarchive/collection-browser 0.4.9-alpha.1 → 0.4.9

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 (263) hide show
  1. package/.editorconfig +29 -29
  2. package/.github/workflows/ci.yml +26 -26
  3. package/.github/workflows/gh-pages-main.yml +39 -39
  4. package/.github/workflows/npm-publish.yml +39 -39
  5. package/.github/workflows/pr-preview.yml +38 -38
  6. package/.husky/pre-commit +4 -4
  7. package/LICENSE +661 -661
  8. package/README.md +83 -83
  9. package/dist/index.d.ts +9 -9
  10. package/dist/index.js +9 -9
  11. package/dist/src/app-root.d.ts +50 -50
  12. package/dist/src/app-root.js +278 -278
  13. package/dist/src/assets/img/icons/arrow-left.d.ts +2 -2
  14. package/dist/src/assets/img/icons/arrow-left.js +2 -2
  15. package/dist/src/assets/img/icons/arrow-right.d.ts +2 -2
  16. package/dist/src/assets/img/icons/arrow-right.js +2 -2
  17. package/dist/src/assets/img/icons/chevron.d.ts +2 -2
  18. package/dist/src/assets/img/icons/chevron.js +2 -2
  19. package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
  20. package/dist/src/assets/img/icons/empty-query.js +2 -2
  21. package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
  22. package/dist/src/assets/img/icons/eye-closed.js +2 -2
  23. package/dist/src/assets/img/icons/eye.d.ts +2 -2
  24. package/dist/src/assets/img/icons/eye.js +2 -2
  25. package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
  26. package/dist/src/assets/img/icons/favorite-filled.js +2 -2
  27. package/dist/src/assets/img/icons/login-required.d.ts +1 -1
  28. package/dist/src/assets/img/icons/login-required.js +2 -2
  29. package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
  30. package/dist/src/assets/img/icons/mediatype/account.js +2 -2
  31. package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
  32. package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
  33. package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
  34. package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
  35. package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
  36. package/dist/src/assets/img/icons/mediatype/data.js +2 -2
  37. package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
  38. package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
  39. package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
  40. package/dist/src/assets/img/icons/mediatype/film.js +2 -2
  41. package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
  42. package/dist/src/assets/img/icons/mediatype/images.js +2 -2
  43. package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
  44. package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
  45. package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
  46. package/dist/src/assets/img/icons/mediatype/software.js +2 -2
  47. package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
  48. package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
  49. package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
  50. package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
  51. package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
  52. package/dist/src/assets/img/icons/mediatype/video.js +2 -2
  53. package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
  54. package/dist/src/assets/img/icons/mediatype/web.js +2 -2
  55. package/dist/src/assets/img/icons/null-result.d.ts +2 -2
  56. package/dist/src/assets/img/icons/null-result.js +2 -2
  57. package/dist/src/assets/img/icons/restricted.d.ts +1 -1
  58. package/dist/src/assets/img/icons/restricted.js +2 -2
  59. package/dist/src/assets/img/icons/reviews.d.ts +1 -1
  60. package/dist/src/assets/img/icons/reviews.js +2 -2
  61. package/dist/src/assets/img/icons/upload.d.ts +1 -1
  62. package/dist/src/assets/img/icons/upload.js +2 -2
  63. package/dist/src/assets/img/icons/views.d.ts +1 -1
  64. package/dist/src/assets/img/icons/views.js +2 -2
  65. package/dist/src/circular-activity-indicator.d.ts +5 -5
  66. package/dist/src/circular-activity-indicator.js +17 -17
  67. package/dist/src/collection-browser.d.ts +281 -281
  68. package/dist/src/collection-browser.js +1204 -1200
  69. package/dist/src/collection-browser.js.map +1 -1
  70. package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
  71. package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
  72. package/dist/src/collection-facets/facets-template.d.ts +16 -16
  73. package/dist/src/collection-facets/facets-template.js +125 -125
  74. package/dist/src/collection-facets/more-facets-content.d.ts +77 -77
  75. package/dist/src/collection-facets/more-facets-content.js +357 -357
  76. package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
  77. package/dist/src/collection-facets/more-facets-pagination.js +192 -192
  78. package/dist/src/collection-facets.d.ts +83 -83
  79. package/dist/src/collection-facets.js +392 -392
  80. package/dist/src/collection-facets.js.map +1 -1
  81. package/dist/src/empty-placeholder.d.ts +11 -11
  82. package/dist/src/empty-placeholder.js +42 -42
  83. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
  84. package/dist/src/language-code-handler/language-code-handler.js +26 -26
  85. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
  86. package/dist/src/language-code-handler/language-code-mapping.js +562 -562
  87. package/dist/src/mediatype/mediatype-config.d.ts +3 -3
  88. package/dist/src/mediatype/mediatype-config.js +85 -85
  89. package/dist/src/models.d.ts +115 -114
  90. package/dist/src/models.js +125 -125
  91. package/dist/src/models.js.map +1 -1
  92. package/dist/src/restoration-state-handler.d.ts +45 -45
  93. package/dist/src/restoration-state-handler.js +230 -230
  94. package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -0
  95. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +61 -0
  96. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js.map +1 -0
  97. package/dist/src/sort-filter-bar/alpha-bar.d.ts +20 -12
  98. package/dist/src/sort-filter-bar/alpha-bar.js +166 -58
  99. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  100. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
  101. package/dist/src/sort-filter-bar/img/compact.js +2 -2
  102. package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
  103. package/dist/src/sort-filter-bar/img/list.js +2 -2
  104. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
  105. package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
  106. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
  107. package/dist/src/sort-filter-bar/img/tile.js +2 -2
  108. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +108 -108
  109. package/dist/src/sort-filter-bar/sort-filter-bar.js +438 -438
  110. package/dist/src/styles/item-image-styles.d.ts +8 -8
  111. package/dist/src/styles/item-image-styles.js +9 -9
  112. package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
  113. package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
  114. package/dist/src/tiles/grid/account-tile.d.ts +20 -17
  115. package/dist/src/tiles/grid/account-tile.js +68 -46
  116. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  117. package/dist/src/tiles/grid/collection-tile.d.ts +17 -14
  118. package/dist/src/tiles/grid/collection-tile.js +75 -53
  119. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  120. package/dist/src/tiles/grid/item-tile.d.ts +32 -29
  121. package/dist/src/tiles/grid/item-tile.js +126 -108
  122. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  123. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
  124. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +44 -8
  125. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  126. package/dist/src/tiles/grid/tile-stats.d.ts +10 -10
  127. package/dist/src/tiles/grid/tile-stats.js +40 -40
  128. package/dist/src/tiles/hover/hover-pane-controller.d.ts +219 -197
  129. package/dist/src/tiles/hover/hover-pane-controller.js +352 -331
  130. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  131. package/dist/src/tiles/hover/tile-hover-pane.d.ts +15 -15
  132. package/dist/src/tiles/hover/tile-hover-pane.js +38 -38
  133. package/dist/src/tiles/image-block.d.ts +17 -17
  134. package/dist/src/tiles/image-block.js +72 -72
  135. package/dist/src/tiles/item-image.d.ts +35 -35
  136. package/dist/src/tiles/item-image.js +117 -117
  137. package/dist/src/tiles/list/account-label.d.ts +1 -1
  138. package/dist/src/tiles/list/account-label.js +6 -6
  139. package/dist/src/tiles/list/date-label.d.ts +1 -1
  140. package/dist/src/tiles/list/date-label.js +12 -12
  141. package/dist/src/tiles/list/tile-list-compact-header.d.ts +12 -12
  142. package/dist/src/tiles/list/tile-list-compact-header.js +41 -41
  143. package/dist/src/tiles/list/tile-list-compact.d.ts +21 -21
  144. package/dist/src/tiles/list/tile-list-compact.js +99 -99
  145. package/dist/src/tiles/list/tile-list.d.ts +55 -55
  146. package/dist/src/tiles/list/tile-list.js +303 -297
  147. package/dist/src/tiles/list/tile-list.js.map +1 -1
  148. package/dist/src/tiles/mediatype-icon.d.ts +9 -9
  149. package/dist/src/tiles/mediatype-icon.js +47 -47
  150. package/dist/src/tiles/overlay/icon-overlay.d.ts +10 -10
  151. package/dist/src/tiles/overlay/icon-overlay.js +40 -40
  152. package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
  153. package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
  154. package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
  155. package/dist/src/tiles/overlay/text-overlay.js +42 -42
  156. package/dist/src/tiles/text-snippet-block.d.ts +27 -27
  157. package/dist/src/tiles/text-snippet-block.js +73 -73
  158. package/dist/src/tiles/tile-dispatcher.d.ts +58 -55
  159. package/dist/src/tiles/tile-dispatcher.js +203 -179
  160. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  161. package/dist/src/utils/analytics-events.d.ts +22 -22
  162. package/dist/src/utils/analytics-events.js +24 -24
  163. package/dist/src/utils/format-count.d.ts +7 -7
  164. package/dist/src/utils/format-count.js +76 -76
  165. package/dist/src/utils/format-date.d.ts +2 -2
  166. package/dist/src/utils/format-date.js +23 -23
  167. package/dist/src/utils/format-unit-size.d.ts +2 -2
  168. package/dist/src/utils/format-unit-size.js +33 -33
  169. package/dist/test/collection-browser.test.d.ts +1 -1
  170. package/dist/test/collection-browser.test.js +584 -584
  171. package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
  172. package/dist/test/collection-facets/facets-template.test.js +62 -62
  173. package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
  174. package/dist/test/collection-facets/more-facets-content.test.js +114 -114
  175. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
  176. package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
  177. package/dist/test/collection-facets.test.d.ts +2 -2
  178. package/dist/test/collection-facets.test.js +508 -508
  179. package/dist/test/empty-placeholder.test.d.ts +1 -1
  180. package/dist/test/empty-placeholder.test.js +33 -33
  181. package/dist/test/icon-overlay.test.d.ts +1 -1
  182. package/dist/test/icon-overlay.test.js +24 -24
  183. package/dist/test/image-block.test.d.ts +1 -1
  184. package/dist/test/image-block.test.js +48 -48
  185. package/dist/test/item-image.test.d.ts +1 -1
  186. package/dist/test/item-image.test.js +84 -84
  187. package/dist/test/mediatype-config.test.d.ts +1 -1
  188. package/dist/test/mediatype-config.test.js +16 -16
  189. package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
  190. package/dist/test/mocks/mock-analytics-handler.js +15 -15
  191. package/dist/test/mocks/mock-collection-name-cache.d.ts +7 -7
  192. package/dist/test/mocks/mock-collection-name-cache.js +13 -13
  193. package/dist/test/mocks/mock-search-responses.d.ts +12 -12
  194. package/dist/test/mocks/mock-search-responses.js +341 -341
  195. package/dist/test/mocks/mock-search-service.d.ts +13 -13
  196. package/dist/test/mocks/mock-search-service.js +40 -40
  197. package/dist/test/restoration-state-handler.test.d.ts +1 -1
  198. package/dist/test/restoration-state-handler.test.js +125 -125
  199. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -0
  200. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +13 -0
  201. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -0
  202. package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
  203. package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -43
  204. package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
  205. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
  206. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +197 -197
  207. package/dist/test/text-overlay.test.d.ts +1 -1
  208. package/dist/test/text-overlay.test.js +48 -48
  209. package/dist/test/text-snippet-block.test.d.ts +1 -1
  210. package/dist/test/text-snippet-block.test.js +57 -57
  211. package/dist/test/tile-stats.test.d.ts +1 -1
  212. package/dist/test/tile-stats.test.js +33 -33
  213. package/dist/test/tiles/grid/account-tile.test.d.ts +1 -1
  214. package/dist/test/tiles/grid/account-tile.test.js +81 -60
  215. package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
  216. package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
  217. package/dist/test/tiles/grid/collection-tile.test.js +81 -57
  218. package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
  219. package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
  220. package/dist/test/tiles/grid/item-tile.test.js +163 -142
  221. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  222. package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
  223. package/dist/test/tiles/hover/hover-pane-controller.test.js +257 -257
  224. package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -1
  225. package/dist/test/tiles/hover/tile-hover-pane.test.js +13 -13
  226. package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
  227. package/dist/test/tiles/list/tile-list-compact.test.js +92 -92
  228. package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
  229. package/dist/test/tiles/list/tile-list.test.js +163 -163
  230. package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -0
  231. package/dist/test/tiles/tile-dispatcher.test.js +101 -0
  232. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -0
  233. package/dist/test/utils/format-count.test.d.ts +1 -1
  234. package/dist/test/utils/format-count.test.js +23 -23
  235. package/dist/test/utils/format-date.test.d.ts +1 -1
  236. package/dist/test/utils/format-date.test.js +17 -17
  237. package/dist/test/utils/format-unit-size.test.d.ts +1 -1
  238. package/dist/test/utils/format-unit-size.test.js +17 -17
  239. package/local.archive.org.cert +86 -86
  240. package/local.archive.org.key +27 -27
  241. package/package.json +1 -1
  242. package/renovate.json +6 -6
  243. package/src/collection-browser.ts +4 -0
  244. package/src/collection-facets.ts +3 -5
  245. package/src/models.ts +1 -0
  246. package/src/sort-filter-bar/alpha-bar-tooltip.ts +54 -0
  247. package/src/sort-filter-bar/alpha-bar.ts +133 -9
  248. package/src/tiles/grid/account-tile.ts +23 -1
  249. package/src/tiles/grid/collection-tile.ts +31 -2
  250. package/src/tiles/grid/item-tile.ts +22 -2
  251. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +37 -1
  252. package/src/tiles/hover/hover-pane-controller.ts +38 -1
  253. package/src/tiles/list/tile-list.ts +8 -1
  254. package/src/tiles/tile-dispatcher.ts +29 -2
  255. package/test/sort-filter-bar/alpha-bar-tooltip.test.ts +17 -0
  256. package/test/sort-filter-bar/alpha-bar.test.ts +46 -1
  257. package/test/tiles/grid/account-tile.test.ts +27 -0
  258. package/test/tiles/grid/collection-tile.test.ts +30 -0
  259. package/test/tiles/grid/item-tile.test.ts +27 -0
  260. package/test/tiles/tile-dispatcher.test.ts +122 -0
  261. package/tsconfig.json +21 -21
  262. package/web-dev-server.config.mjs +30 -30
  263. package/web-test-runner.config.mjs +41 -41
@@ -1,47 +1,47 @@
1
- var TileDispatcher_1;
2
- import { __decorate } from "tslib";
3
- import { css, html, LitElement, nothing } from 'lit';
4
- import { customElement, property, query } from 'lit/decorators.js';
5
- import { ifDefined } from 'lit/directives/if-defined.js';
6
- import './grid/collection-tile';
7
- import './grid/item-tile';
8
- import './grid/account-tile';
9
- import './hover/tile-hover-pane';
10
- import './list/tile-list';
11
- import './list/tile-list-compact';
12
- import './list/tile-list-compact-header';
13
- import { HoverPaneController, } from './hover/hover-pane-controller';
14
- let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends LitElement {
15
- constructor() {
16
- super(...arguments);
17
- this.sortParam = null;
18
- this.loggedIn = false;
19
- /** Whether this tile should include a hover pane at all (for applicable tile modes) */
20
- this.enableHoverPane = false;
21
- }
22
- render() {
23
- var _a, _b;
24
- const isGridMode = this.tileDisplayMode === 'grid';
25
- const hoverPaneTemplate = (_b = (_a = this.hoverPaneController) === null || _a === void 0 ? void 0 : _a.getTemplate()) !== null && _b !== void 0 ? _b : nothing;
1
+ var TileDispatcher_1;
2
+ import { __decorate } from "tslib";
3
+ import { css, html, LitElement, nothing } from 'lit';
4
+ import { customElement, property, query } from 'lit/decorators.js';
5
+ import { ifDefined } from 'lit/directives/if-defined.js';
6
+ import './grid/collection-tile';
7
+ import './grid/item-tile';
8
+ import './grid/account-tile';
9
+ import './hover/tile-hover-pane';
10
+ import './list/tile-list';
11
+ import './list/tile-list-compact';
12
+ import './list/tile-list-compact-header';
13
+ import { HoverPaneController, } from './hover/hover-pane-controller';
14
+ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends LitElement {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.sortParam = null;
18
+ this.loggedIn = false;
19
+ /** Whether this tile should include a hover pane at all (for applicable tile modes) */
20
+ this.enableHoverPane = false;
21
+ }
22
+ render() {
23
+ var _a, _b;
24
+ const isGridMode = this.tileDisplayMode === 'grid';
25
+ const hoverPaneTemplate = (_b = (_a = this.hoverPaneController) === null || _a === void 0 ? void 0 : _a.getTemplate()) !== null && _b !== void 0 ? _b : nothing;
26
26
  return html `
27
27
  <div id="container" class=${isGridMode ? 'hoverable' : nothing}>
28
- ${this.tileDisplayMode === 'list-header'
29
- ? this.headerTemplate
28
+ ${this.tileDisplayMode === 'list-header'
29
+ ? this.headerTemplate
30
30
  : this.tileTemplate}
31
31
  ${hoverPaneTemplate}
32
32
  </div>
33
- `;
34
- }
35
- firstUpdated() {
36
- if (this.shouldPrepareHoverPane) {
37
- this.hoverPaneController = new HoverPaneController(this, {
38
- mobileBreakpoint: this.mobileBreakpoint,
39
- enableLongPress: false,
40
- });
41
- }
42
- }
43
- get headerTemplate() {
44
- const { currentWidth, sortParam, mobileBreakpoint } = this;
33
+ `;
34
+ }
35
+ firstUpdated() {
36
+ if (this.shouldPrepareHoverPane) {
37
+ this.hoverPaneController = new HoverPaneController(this, {
38
+ mobileBreakpoint: this.mobileBreakpoint,
39
+ enableLongPress: false,
40
+ });
41
+ }
42
+ }
43
+ get headerTemplate() {
44
+ const { currentWidth, sortParam, mobileBreakpoint } = this;
45
45
  return html `
46
46
  <tile-list-compact-header
47
47
  class="header"
@@ -50,98 +50,120 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends LitElement
50
50
  .mobileBreakpoint=${mobileBreakpoint}
51
51
  >
52
52
  </tile-list-compact-header>
53
- `;
54
- }
55
- get tileTemplate() {
53
+ `;
54
+ }
55
+ get tileTemplate() {
56
56
  return html `
57
- ${this.tileDisplayMode === 'list-detail'
58
- ? this.tile
57
+ ${this.tileDisplayMode === 'list-detail'
58
+ ? this.tile
59
59
  : this.linkTileTemplate}
60
- `;
61
- }
62
- get linkTileTemplate() {
63
- var _a, _b;
60
+ `;
61
+ }
62
+ get linkTileTemplate() {
63
+ var _a;
64
64
  return html `
65
65
  <a
66
- href="${this.baseNavigationUrl}/details/${(_a = this.model) === null || _a === void 0 ? void 0 : _a.identifier}"
67
- title=${this.shouldPrepareHoverPane
68
- ? nothing // Don't show title tooltips when we have the tile info popups
69
- : ifDefined((_b = this.model) === null || _b === void 0 ? void 0 : _b.title)}
66
+ href="${this.linkTileHref}"
67
+ title=${this.shouldPrepareHoverPane
68
+ ? nothing // Don't show title tooltips when we have the tile info popups
69
+ : ifDefined((_a = this.model) === null || _a === void 0 ? void 0 : _a.title)}
70
70
  @click=${() => this.dispatchEvent(new CustomEvent('resultSelected', { detail: this.model }))}
71
71
  >
72
72
  ${this.tile}
73
73
  </a>
74
- `;
75
- }
76
- /**
77
- * Whether hover pane behavior should be prepared for this tile
78
- * (e.g., whether mouse listeners should be attached, etc.)
79
- */
80
- get shouldPrepareHoverPane() {
81
- return (this.enableHoverPane &&
82
- !!this.tileDisplayMode &&
83
- TileDispatcher_1.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode]);
84
- }
85
- /** @inheritdoc */
86
- getHoverPane() {
87
- return this.hoverPane;
88
- }
89
- /** @inheritdoc */
90
- getHoverPaneProps() {
91
- return this;
92
- }
93
- handleResize(entry) {
94
- this.currentWidth = entry.contentRect.width;
95
- this.currentHeight = entry.contentRect.height;
96
- }
97
- disconnectedCallback() {
98
- this.stopResizeObservation(this.resizeObserver);
99
- }
100
- stopResizeObservation(observer) {
101
- observer === null || observer === void 0 ? void 0 : observer.removeObserver({
102
- handler: this,
103
- target: this.container,
104
- });
105
- }
106
- startResizeObservation() {
107
- var _a;
108
- this.stopResizeObservation(this.resizeObserver);
109
- (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.addObserver({
110
- handler: this,
111
- target: this.container,
112
- });
113
- }
114
- updated(props) {
115
- if (props.has('resizeObserver')) {
116
- const previousObserver = props.get('resizeObserver');
117
- this.stopResizeObservation(previousObserver);
118
- this.startResizeObservation();
119
- }
120
- }
121
- get tile() {
122
- const { model, baseNavigationUrl, currentWidth, currentHeight, sortParam, mobileBreakpoint, } = this;
123
- if (!model)
124
- return nothing;
125
- switch (this.tileDisplayMode) {
126
- case 'grid':
127
- switch (model.mediatype) {
128
- case 'collection':
74
+ `;
75
+ }
76
+ get linkTileHref() {
77
+ var _a, _b, _c;
78
+ // Use the server-specified href if available.
79
+ // Otherwise, construct a details page URL from the item identifier.
80
+ return ((_a = this.model) === null || _a === void 0 ? void 0 : _a.href)
81
+ ? `${this.baseNavigationUrl}${(_b = this.model) === null || _b === void 0 ? void 0 : _b.href}`
82
+ : `${this.baseNavigationUrl}/details/${(_c = this.model) === null || _c === void 0 ? void 0 : _c.identifier}`;
83
+ }
84
+ /**
85
+ * Whether hover pane behavior should be prepared for this tile
86
+ * (e.g., whether mouse listeners should be attached, etc.)
87
+ */
88
+ get shouldPrepareHoverPane() {
89
+ return (this.enableHoverPane &&
90
+ !!this.tileDisplayMode &&
91
+ TileDispatcher_1.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode]);
92
+ }
93
+ get isHoverEnabled() {
94
+ return window.matchMedia('(hover: hover)').matches;
95
+ }
96
+ /** @inheritdoc */
97
+ getHoverPane() {
98
+ return this.hoverPane;
99
+ }
100
+ /** @inheritdoc */
101
+ getHoverPaneProps() {
102
+ return this;
103
+ }
104
+ handleResize(entry) {
105
+ this.currentWidth = entry.contentRect.width;
106
+ this.currentHeight = entry.contentRect.height;
107
+ }
108
+ disconnectedCallback() {
109
+ this.stopResizeObservation(this.resizeObserver);
110
+ }
111
+ stopResizeObservation(observer) {
112
+ observer === null || observer === void 0 ? void 0 : observer.removeObserver({
113
+ handler: this,
114
+ target: this.container,
115
+ });
116
+ }
117
+ startResizeObservation() {
118
+ var _a;
119
+ this.stopResizeObservation(this.resizeObserver);
120
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.addObserver({
121
+ handler: this,
122
+ target: this.container,
123
+ });
124
+ }
125
+ updated(props) {
126
+ if (props.has('resizeObserver')) {
127
+ const previousObserver = props.get('resizeObserver');
128
+ this.stopResizeObservation(previousObserver);
129
+ this.startResizeObservation();
130
+ }
131
+ }
132
+ tileInfoButtonPressed(e) {
133
+ var _a;
134
+ (_a = this.hoverPaneController) === null || _a === void 0 ? void 0 : _a.toggleHoverPane({
135
+ coords: e.detail,
136
+ enableTouchBackdrop: true,
137
+ });
138
+ }
139
+ get tile() {
140
+ const { model, baseNavigationUrl, currentWidth, currentHeight, sortParam, mobileBreakpoint, } = this;
141
+ if (!model)
142
+ return nothing;
143
+ switch (this.tileDisplayMode) {
144
+ case 'grid':
145
+ switch (model.mediatype) {
146
+ case 'collection':
129
147
  return html `<collection-tile
130
148
  .model=${model}
131
149
  .baseImageUrl=${this.baseImageUrl}
132
150
  .currentWidth=${currentWidth}
133
151
  .currentHeight=${currentHeight}
152
+ ?showInfoButton=${!this.isHoverEnabled}
153
+ @infoButtonPressed=${this.tileInfoButtonPressed}
134
154
  >
135
- </collection-tile>`;
136
- case 'account':
155
+ </collection-tile>`;
156
+ case 'account':
137
157
  return html `<account-tile
138
158
  .model=${model}
139
159
  .baseImageUrl=${this.baseImageUrl}
140
160
  .currentWidth=${currentWidth}
141
161
  .currentHeight=${currentHeight}
162
+ ?showInfoButton=${!this.isHoverEnabled}
163
+ @infoButtonPressed=${this.tileInfoButtonPressed}
142
164
  >
143
- </account-tile>`;
144
- default:
165
+ </account-tile>`;
166
+ default:
145
167
  return html `<item-tile
146
168
  .model=${model}
147
169
  .currentWidth=${this.currentWidth}
@@ -150,10 +172,12 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends LitElement
150
172
  .baseImageUrl=${this.baseImageUrl}
151
173
  .sortParam=${sortParam}
152
174
  .loggedIn=${this.loggedIn}
175
+ ?showInfoButton=${!this.isHoverEnabled}
176
+ @infoButtonPressed=${this.tileInfoButtonPressed}
153
177
  >
154
- </item-tile>`;
155
- }
156
- case 'list-compact':
178
+ </item-tile>`;
179
+ }
180
+ case 'list-compact':
157
181
  return html `<tile-list-compact
158
182
  .model=${model}
159
183
  .currentWidth=${currentWidth}
@@ -164,8 +188,8 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends LitElement
164
188
  .baseImageUrl=${this.baseImageUrl}
165
189
  .loggedIn=${this.loggedIn}
166
190
  >
167
- </tile-list-compact>`;
168
- case 'list-detail':
191
+ </tile-list-compact>`;
192
+ case 'list-detail':
169
193
  return html `<tile-list
170
194
  .model=${model}
171
195
  .collectionNameCache=${this.collectionNameCache}
@@ -177,12 +201,12 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends LitElement
177
201
  .baseImageUrl=${this.baseImageUrl}
178
202
  .loggedIn=${this.loggedIn}
179
203
  >
180
- </tile-list>`;
181
- default:
182
- return nothing;
183
- }
184
- }
185
- static get styles() {
204
+ </tile-list>`;
205
+ default:
206
+ return nothing;
207
+ }
208
+ }
209
+ static get styles() {
186
210
  return css `
187
211
  :host {
188
212
  display: block;
@@ -235,7 +259,7 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends LitElement
235
259
  height: 100vh;
236
260
  top: 0;
237
261
  left: 0;
238
- z-index: 1;
262
+ z-index: 2;
239
263
  background: transparent;
240
264
  }
241
265
 
@@ -245,60 +269,60 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends LitElement
245
269
  left: -9999px;
246
270
  z-index: 2;
247
271
  }
248
- `;
249
- }
250
- };
251
- /** Maps each display mode to whether hover panes should appear in that mode */
252
- TileDispatcher.HOVER_PANE_DISPLAY_MODES = {
253
- grid: true,
254
- 'list-compact': true,
255
- 'list-detail': false,
256
- 'list-header': false,
257
- };
258
- __decorate([
259
- property({ type: String })
260
- ], TileDispatcher.prototype, "tileDisplayMode", void 0);
261
- __decorate([
262
- property({ type: Object })
263
- ], TileDispatcher.prototype, "model", void 0);
264
- __decorate([
265
- property({ type: String })
266
- ], TileDispatcher.prototype, "baseNavigationUrl", void 0);
267
- __decorate([
268
- property({ type: Number })
269
- ], TileDispatcher.prototype, "currentWidth", void 0);
270
- __decorate([
271
- property({ type: Number })
272
- ], TileDispatcher.prototype, "currentHeight", void 0);
273
- __decorate([
274
- property({ type: Object })
275
- ], TileDispatcher.prototype, "resizeObserver", void 0);
276
- __decorate([
277
- property({ type: Object })
278
- ], TileDispatcher.prototype, "collectionNameCache", void 0);
279
- __decorate([
280
- property({ type: Object })
281
- ], TileDispatcher.prototype, "sortParam", void 0);
282
- __decorate([
283
- property({ type: Number })
284
- ], TileDispatcher.prototype, "mobileBreakpoint", void 0);
285
- __decorate([
286
- property({ type: String })
287
- ], TileDispatcher.prototype, "baseImageUrl", void 0);
288
- __decorate([
289
- property({ type: Boolean })
290
- ], TileDispatcher.prototype, "loggedIn", void 0);
291
- __decorate([
292
- property({ type: Boolean })
293
- ], TileDispatcher.prototype, "enableHoverPane", void 0);
294
- __decorate([
295
- query('#container')
296
- ], TileDispatcher.prototype, "container", void 0);
297
- __decorate([
298
- query('tile-hover-pane')
299
- ], TileDispatcher.prototype, "hoverPane", void 0);
300
- TileDispatcher = TileDispatcher_1 = __decorate([
301
- customElement('tile-dispatcher')
302
- ], TileDispatcher);
303
- export { TileDispatcher };
272
+ `;
273
+ }
274
+ };
275
+ /** Maps each display mode to whether hover panes should appear in that mode */
276
+ TileDispatcher.HOVER_PANE_DISPLAY_MODES = {
277
+ grid: true,
278
+ 'list-compact': true,
279
+ 'list-detail': false,
280
+ 'list-header': false,
281
+ };
282
+ __decorate([
283
+ property({ type: String })
284
+ ], TileDispatcher.prototype, "tileDisplayMode", void 0);
285
+ __decorate([
286
+ property({ type: Object })
287
+ ], TileDispatcher.prototype, "model", void 0);
288
+ __decorate([
289
+ property({ type: String })
290
+ ], TileDispatcher.prototype, "baseNavigationUrl", void 0);
291
+ __decorate([
292
+ property({ type: Number })
293
+ ], TileDispatcher.prototype, "currentWidth", void 0);
294
+ __decorate([
295
+ property({ type: Number })
296
+ ], TileDispatcher.prototype, "currentHeight", void 0);
297
+ __decorate([
298
+ property({ type: Object })
299
+ ], TileDispatcher.prototype, "resizeObserver", void 0);
300
+ __decorate([
301
+ property({ type: Object })
302
+ ], TileDispatcher.prototype, "collectionNameCache", void 0);
303
+ __decorate([
304
+ property({ type: Object })
305
+ ], TileDispatcher.prototype, "sortParam", void 0);
306
+ __decorate([
307
+ property({ type: Number })
308
+ ], TileDispatcher.prototype, "mobileBreakpoint", void 0);
309
+ __decorate([
310
+ property({ type: String })
311
+ ], TileDispatcher.prototype, "baseImageUrl", void 0);
312
+ __decorate([
313
+ property({ type: Boolean })
314
+ ], TileDispatcher.prototype, "loggedIn", void 0);
315
+ __decorate([
316
+ property({ type: Boolean })
317
+ ], TileDispatcher.prototype, "enableHoverPane", void 0);
318
+ __decorate([
319
+ query('#container')
320
+ ], TileDispatcher.prototype, "container", void 0);
321
+ __decorate([
322
+ query('tile-hover-pane')
323
+ ], TileDispatcher.prototype, "hoverPane", void 0);
324
+ TileDispatcher = TileDispatcher_1 = __decorate([
325
+ customElement('tile-dispatcher')
326
+ ], TileDispatcher);
327
+ export { TileDispatcher };
304
328
  //# sourceMappingURL=tile-dispatcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAQzD,OAAO,wBAAwB,CAAC;AAChC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,yBAAyB,CAAC;AACjC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,0BAA0B,CAAC;AAClC,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EACL,mBAAmB,GAIpB,MAAM,+BAA+B,CAAC;AAGvC,IAAa,cAAc,sBAA3B,MAAa,cACX,SAAQ,UAAU;IADpB;;QAqB8B,cAAS,GAAqB,IAAI,CAAC;QAMlC,aAAQ,GAAG,KAAK,CAAC;QAE9C,uFAAuF;QAC1D,oBAAe,GAAG,KAAK,CAAC;IAoRvD,CAAC;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B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAyB;AAKrD;IADC,KAAK,CAAC,YAAY,CAAC;iDACe;AAGnC;IADC,KAAK,CAAC,iBAAiB,CAAC;iDACS;AAtCvB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAkT1B;SAlTY,cAAc","sourcesContent":["import { css, html, LitElement, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { SortParam } from '@internetarchive/search-service';\nimport type { TileDisplayMode, TileModel } from '../models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './hover/tile-hover-pane';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\nimport type { TileHoverPane } from './hover/tile-hover-pane';\nimport {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from './hover/hover-pane-controller';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends LitElement\n implements\n SharedResizeObserverResizeHandlerInterface,\n HoverPaneProviderInterface\n{\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Number }) currentHeight?: number;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) loggedIn = false;\n\n /** Whether this tile should include a hover pane at all (for applicable tile modes) */\n @property({ type: Boolean }) enableHoverPane = false;\n\n private hoverPaneController?: HoverPaneControllerInterface;\n\n @query('#container')\n private container!: HTMLDivElement;\n\n @query('tile-hover-pane')\n private hoverPane?: TileHoverPane;\n\n /** Maps each display mode to whether hover panes should appear in that mode */\n private static readonly HOVER_PANE_DISPLAY_MODES: Record<\n TileDisplayMode,\n boolean\n > = {\n grid: true,\n 'list-compact': true,\n 'list-detail': false,\n 'list-header': false,\n };\n\n render() {\n const isGridMode = this.tileDisplayMode === 'grid';\n const hoverPaneTemplate =\n this.hoverPaneController?.getTemplate() ?? nothing;\n return html`\n <div id=\"container\" class=${isGridMode ? 'hoverable' : nothing}>\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n ${hoverPaneTemplate}\n </div>\n `;\n }\n\n protected firstUpdated(): void {\n if (this.shouldPrepareHoverPane) {\n this.hoverPaneController = new HoverPaneController(this, {\n mobileBreakpoint: this.mobileBreakpoint,\n enableLongPress: false,\n });\n }\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, mobileBreakpoint } = this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=\"${this.baseNavigationUrl}/details/${this.model?.identifier}\"\n title=${this.shouldPrepareHoverPane\n ? nothing // Don't show title tooltips when we have the tile info popups\n : ifDefined(this.model?.title)}\n @click=${() =>\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model })\n )}\n >\n ${this.tile}\n </a>\n `;\n }\n\n /**\n * Whether hover pane behavior should be prepared for this tile\n * (e.g., whether mouse listeners should be attached, etc.)\n */\n private get shouldPrepareHoverPane(): boolean {\n return (\n this.enableHoverPane &&\n !!this.tileDisplayMode &&\n TileDispatcher.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode]\n );\n }\n\n /** @inheritdoc */\n getHoverPane(): TileHoverPane | undefined {\n return this.hoverPane;\n }\n\n /** @inheritdoc */\n getHoverPaneProps(): HoverPaneProperties {\n return this;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n private get tile() {\n const {\n model,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n mobileBreakpoint,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </account-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .loggedIn=${this.loggedIn}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n }\n\n collection-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n }\n\n account-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #fcf5e6;\n }\n\n item-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #f1f1f4;\n }\n\n #container {\n position: relative;\n height: 100%;\n border-radius: 4px;\n }\n\n #container.hoverable:hover {\n box-shadow: 0 0 6px 2px rgba(8, 8, 32, 0.8);\n transition: box-shadow 0.1s ease;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n transition: transform 0.05s ease;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n\n #touch-backdrop {\n position: fixed;\n width: 100vw;\n height: 100vh;\n top: 0;\n left: 0;\n z-index: 1;\n background: transparent;\n }\n\n tile-hover-pane {\n position: absolute;\n top: 0;\n left: -9999px;\n z-index: 2;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO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,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAkB;AAGjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAyB;AAKrD;IADC,KAAK,CAAC,YAAY,CAAC;iDACe;AAGnC;IADC,KAAK,CAAC,iBAAiB,CAAC;iDACS;AAtCvB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CA6U1B;SA7UY,cAAc","sourcesContent":["import { css, html, LitElement, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { SortParam } from '@internetarchive/search-service';\nimport type { TileDisplayMode, TileModel } from '../models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './hover/tile-hover-pane';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\nimport type { TileHoverPane } from './hover/tile-hover-pane';\nimport {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from './hover/hover-pane-controller';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends LitElement\n implements\n SharedResizeObserverResizeHandlerInterface,\n HoverPaneProviderInterface\n{\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Number }) currentHeight?: number;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) loggedIn = false;\n\n /** Whether this tile should include a hover pane at all (for applicable tile modes) */\n @property({ type: Boolean }) enableHoverPane = false;\n\n private hoverPaneController?: HoverPaneControllerInterface;\n\n @query('#container')\n private container!: HTMLDivElement;\n\n @query('tile-hover-pane')\n private hoverPane?: TileHoverPane;\n\n /** Maps each display mode to whether hover panes should appear in that mode */\n private static readonly HOVER_PANE_DISPLAY_MODES: Record<\n TileDisplayMode,\n boolean\n > = {\n grid: true,\n 'list-compact': true,\n 'list-detail': false,\n 'list-header': false,\n };\n\n render() {\n const isGridMode = this.tileDisplayMode === 'grid';\n const hoverPaneTemplate =\n this.hoverPaneController?.getTemplate() ?? nothing;\n return html`\n <div id=\"container\" class=${isGridMode ? 'hoverable' : nothing}>\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n ${hoverPaneTemplate}\n </div>\n `;\n }\n\n protected firstUpdated(): void {\n if (this.shouldPrepareHoverPane) {\n this.hoverPaneController = new HoverPaneController(this, {\n mobileBreakpoint: this.mobileBreakpoint,\n enableLongPress: false,\n });\n }\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, mobileBreakpoint } = this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=\"${this.linkTileHref}\"\n title=${this.shouldPrepareHoverPane\n ? nothing // Don't show title tooltips when we have the tile info popups\n : ifDefined(this.model?.title)}\n @click=${() =>\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model })\n )}\n >\n ${this.tile}\n </a>\n `;\n }\n\n private get linkTileHref() {\n // Use the server-specified href if available.\n // Otherwise, construct a details page URL from the item identifier.\n return this.model?.href\n ? `${this.baseNavigationUrl}${this.model?.href}`\n : `${this.baseNavigationUrl}/details/${this.model?.identifier}`;\n }\n\n /**\n * Whether hover pane behavior should be prepared for this tile\n * (e.g., whether mouse listeners should be attached, etc.)\n */\n private get shouldPrepareHoverPane(): boolean {\n return (\n this.enableHoverPane &&\n !!this.tileDisplayMode &&\n TileDispatcher.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode]\n );\n }\n\n private get isHoverEnabled(): boolean {\n return window.matchMedia('(hover: hover)').matches;\n }\n\n /** @inheritdoc */\n getHoverPane(): TileHoverPane | undefined {\n return this.hoverPane;\n }\n\n /** @inheritdoc */\n getHoverPaneProps(): HoverPaneProperties {\n return this;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n private tileInfoButtonPressed(\n e: CustomEvent<{ x: number; y: number }>\n ): void {\n this.hoverPaneController?.toggleHoverPane({\n coords: e.detail,\n enableTouchBackdrop: true,\n });\n }\n\n private get tile() {\n const {\n model,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n mobileBreakpoint,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </account-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .loggedIn=${this.loggedIn}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n }\n\n collection-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n }\n\n account-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #fcf5e6;\n }\n\n item-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #f1f1f4;\n }\n\n #container {\n position: relative;\n height: 100%;\n border-radius: 4px;\n }\n\n #container.hoverable:hover {\n box-shadow: 0 0 6px 2px rgba(8, 8, 32, 0.8);\n transition: box-shadow 0.1s ease;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n transition: transform 0.05s ease;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n\n #touch-backdrop {\n position: fixed;\n width: 100vw;\n height: 100vh;\n top: 0;\n left: 0;\n z-index: 2;\n background: transparent;\n }\n\n tile-hover-pane {\n position: absolute;\n top: 0;\n left: -9999px;\n z-index: 2;\n }\n `;\n }\n}\n"]}
@@ -1,22 +1,22 @@
1
- /**
2
- * Analytics categories and events. Used when building actions in
3
- */
4
- export declare enum analyticsCategories {
5
- default = "collection-browser"
6
- }
7
- export declare enum analyticsActions {
8
- sortBy = "sortBy",
9
- filterByCreator = "filterByCreator",
10
- filterByTitle = "filterByTitle",
11
- displayMode = "displayMode",
12
- facetSelected = "facetSelected",
13
- facetDeselected = "facetDeselected",
14
- facetNegativeSelected = "facetNegativeSelected",
15
- facetNegativeDeselected = "facetNegativeDeselected",
16
- histogramChanged = "histogramChanged",
17
- resultSelected = "resultSelected",
18
- moreFacetsPageChange = "moreFacetsPageChange",
19
- showMoreFacetsModal = "showMoreFacetsModal",
20
- closeMoreFacetsModal = "closeMoreFacetsModal",
21
- applyMoreFacetsModal = "applyMoreFacetsModal"
22
- }
1
+ /**
2
+ * Analytics categories and events. Used when building actions in
3
+ */
4
+ export declare enum analyticsCategories {
5
+ default = "collection-browser"
6
+ }
7
+ export declare enum analyticsActions {
8
+ sortBy = "sortBy",
9
+ filterByCreator = "filterByCreator",
10
+ filterByTitle = "filterByTitle",
11
+ displayMode = "displayMode",
12
+ facetSelected = "facetSelected",
13
+ facetDeselected = "facetDeselected",
14
+ facetNegativeSelected = "facetNegativeSelected",
15
+ facetNegativeDeselected = "facetNegativeDeselected",
16
+ histogramChanged = "histogramChanged",
17
+ resultSelected = "resultSelected",
18
+ moreFacetsPageChange = "moreFacetsPageChange",
19
+ showMoreFacetsModal = "showMoreFacetsModal",
20
+ closeMoreFacetsModal = "closeMoreFacetsModal",
21
+ applyMoreFacetsModal = "applyMoreFacetsModal"
22
+ }
@@ -1,25 +1,25 @@
1
- /**
2
- * Analytics categories and events. Used when building actions in
3
- */
4
- export var analyticsCategories;
5
- (function (analyticsCategories) {
6
- analyticsCategories["default"] = "collection-browser";
7
- })(analyticsCategories || (analyticsCategories = {}));
8
- export var analyticsActions;
9
- (function (analyticsActions) {
10
- analyticsActions["sortBy"] = "sortBy";
11
- analyticsActions["filterByCreator"] = "filterByCreator";
12
- analyticsActions["filterByTitle"] = "filterByTitle";
13
- analyticsActions["displayMode"] = "displayMode";
14
- analyticsActions["facetSelected"] = "facetSelected";
15
- analyticsActions["facetDeselected"] = "facetDeselected";
16
- analyticsActions["facetNegativeSelected"] = "facetNegativeSelected";
17
- analyticsActions["facetNegativeDeselected"] = "facetNegativeDeselected";
18
- analyticsActions["histogramChanged"] = "histogramChanged";
19
- analyticsActions["resultSelected"] = "resultSelected";
20
- analyticsActions["moreFacetsPageChange"] = "moreFacetsPageChange";
21
- analyticsActions["showMoreFacetsModal"] = "showMoreFacetsModal";
22
- analyticsActions["closeMoreFacetsModal"] = "closeMoreFacetsModal";
23
- analyticsActions["applyMoreFacetsModal"] = "applyMoreFacetsModal";
24
- })(analyticsActions || (analyticsActions = {}));
1
+ /**
2
+ * Analytics categories and events. Used when building actions in
3
+ */
4
+ export var analyticsCategories;
5
+ (function (analyticsCategories) {
6
+ analyticsCategories["default"] = "collection-browser";
7
+ })(analyticsCategories || (analyticsCategories = {}));
8
+ export var analyticsActions;
9
+ (function (analyticsActions) {
10
+ analyticsActions["sortBy"] = "sortBy";
11
+ analyticsActions["filterByCreator"] = "filterByCreator";
12
+ analyticsActions["filterByTitle"] = "filterByTitle";
13
+ analyticsActions["displayMode"] = "displayMode";
14
+ analyticsActions["facetSelected"] = "facetSelected";
15
+ analyticsActions["facetDeselected"] = "facetDeselected";
16
+ analyticsActions["facetNegativeSelected"] = "facetNegativeSelected";
17
+ analyticsActions["facetNegativeDeselected"] = "facetNegativeDeselected";
18
+ analyticsActions["histogramChanged"] = "histogramChanged";
19
+ analyticsActions["resultSelected"] = "resultSelected";
20
+ analyticsActions["moreFacetsPageChange"] = "moreFacetsPageChange";
21
+ analyticsActions["showMoreFacetsModal"] = "showMoreFacetsModal";
22
+ analyticsActions["closeMoreFacetsModal"] = "closeMoreFacetsModal";
23
+ analyticsActions["applyMoreFacetsModal"] = "applyMoreFacetsModal";
24
+ })(analyticsActions || (analyticsActions = {}));
25
25
  //# sourceMappingURL=analytics-events.js.map
@@ -1,7 +1,7 @@
1
- export declare type NumberFormat = 'short' | 'long';
2
- export declare type LabelFormat = 'short' | 'long';
3
- /**
4
- * Format a "count" number into short "icon" or longer text string.
5
- * For positive numbers only.
6
- */
7
- export declare function formatCount(count: number | undefined, numberFormat?: NumberFormat, labelFormat?: LabelFormat, locale?: string): string;
1
+ export declare type NumberFormat = 'short' | 'long';
2
+ export declare type LabelFormat = 'short' | 'long';
3
+ /**
4
+ * Format a "count" number into short "icon" or longer text string.
5
+ * For positive numbers only.
6
+ */
7
+ export declare function formatCount(count: number | undefined, numberFormat?: NumberFormat, labelFormat?: LabelFormat, locale?: string): string;