@internetarchive/collection-browser 1.8.0 → 1.9.0-alpha2

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 (269) 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 +54 -54
  12. package/dist/src/app-root.js +293 -293
  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/contract.d.ts +2 -2
  20. package/dist/src/assets/img/icons/contract.js +2 -2
  21. package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
  22. package/dist/src/assets/img/icons/empty-query.js +2 -2
  23. package/dist/src/assets/img/icons/expand.d.ts +2 -2
  24. package/dist/src/assets/img/icons/expand.js +2 -2
  25. package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
  26. package/dist/src/assets/img/icons/eye-closed.js +2 -2
  27. package/dist/src/assets/img/icons/eye.d.ts +2 -2
  28. package/dist/src/assets/img/icons/eye.js +2 -2
  29. package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
  30. package/dist/src/assets/img/icons/favorite-filled.js +2 -2
  31. package/dist/src/assets/img/icons/login-required.d.ts +1 -1
  32. package/dist/src/assets/img/icons/login-required.js +2 -2
  33. package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
  34. package/dist/src/assets/img/icons/mediatype/account.js +2 -2
  35. package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
  36. package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
  37. package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
  38. package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
  39. package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
  40. package/dist/src/assets/img/icons/mediatype/data.js +2 -2
  41. package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
  42. package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
  43. package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
  44. package/dist/src/assets/img/icons/mediatype/film.js +2 -2
  45. package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
  46. package/dist/src/assets/img/icons/mediatype/images.js +2 -2
  47. package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
  48. package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
  49. package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
  50. package/dist/src/assets/img/icons/mediatype/software.js +2 -2
  51. package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
  52. package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
  53. package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
  54. package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
  55. package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
  56. package/dist/src/assets/img/icons/mediatype/video.js +2 -2
  57. package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
  58. package/dist/src/assets/img/icons/mediatype/web.js +2 -2
  59. package/dist/src/assets/img/icons/null-result.d.ts +2 -2
  60. package/dist/src/assets/img/icons/null-result.js +2 -2
  61. package/dist/src/assets/img/icons/restricted.d.ts +1 -1
  62. package/dist/src/assets/img/icons/restricted.js +2 -2
  63. package/dist/src/assets/img/icons/reviews.d.ts +1 -1
  64. package/dist/src/assets/img/icons/reviews.js +2 -2
  65. package/dist/src/assets/img/icons/upload.d.ts +1 -1
  66. package/dist/src/assets/img/icons/upload.js +2 -2
  67. package/dist/src/assets/img/icons/views.d.ts +1 -1
  68. package/dist/src/assets/img/icons/views.js +2 -2
  69. package/dist/src/circular-activity-indicator.d.ts +5 -5
  70. package/dist/src/circular-activity-indicator.js +17 -17
  71. package/dist/src/collection-browser.d.ts +469 -469
  72. package/dist/src/collection-browser.js +1677 -1653
  73. package/dist/src/collection-browser.js.map +1 -1
  74. package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
  75. package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
  76. package/dist/src/collection-facets/facets-template.d.ts +20 -20
  77. package/dist/src/collection-facets/facets-template.js +152 -152
  78. package/dist/src/collection-facets/more-facets-content.d.ts +77 -77
  79. package/dist/src/collection-facets/more-facets-content.js +359 -359
  80. package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
  81. package/dist/src/collection-facets/more-facets-pagination.js +196 -196
  82. package/dist/src/collection-facets/toggle-switch.d.ts +41 -41
  83. package/dist/src/collection-facets/toggle-switch.js +94 -94
  84. package/dist/src/collection-facets.d.ts +99 -99
  85. package/dist/src/collection-facets.js +471 -471
  86. package/dist/src/empty-placeholder.d.ts +21 -21
  87. package/dist/src/empty-placeholder.js +69 -69
  88. package/dist/src/expanded-date-picker.d.ts +43 -43
  89. package/dist/src/expanded-date-picker.js +109 -109
  90. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
  91. package/dist/src/language-code-handler/language-code-handler.js +26 -26
  92. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
  93. package/dist/src/language-code-handler/language-code-mapping.js +562 -562
  94. package/dist/src/mediatype/mediatype-config.d.ts +3 -3
  95. package/dist/src/mediatype/mediatype-config.js +85 -85
  96. package/dist/src/models.d.ts +162 -149
  97. package/dist/src/models.js +256 -195
  98. package/dist/src/models.js.map +1 -1
  99. package/dist/src/restoration-state-handler.d.ts +70 -63
  100. package/dist/src/restoration-state-handler.js +355 -326
  101. package/dist/src/restoration-state-handler.js.map +1 -1
  102. package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -6
  103. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +24 -24
  104. package/dist/src/sort-filter-bar/alpha-bar.d.ts +21 -21
  105. package/dist/src/sort-filter-bar/alpha-bar.js +128 -128
  106. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
  107. package/dist/src/sort-filter-bar/img/compact.js +2 -2
  108. package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
  109. package/dist/src/sort-filter-bar/img/list.js +2 -2
  110. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -1
  111. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +2 -2
  112. package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -1
  113. package/dist/src/sort-filter-bar/img/sort-toggle-down.js +2 -2
  114. package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -1
  115. package/dist/src/sort-filter-bar/img/sort-toggle-up.js +2 -2
  116. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
  117. package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
  118. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
  119. package/dist/src/sort-filter-bar/img/tile.js +2 -2
  120. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +201 -199
  121. package/dist/src/sort-filter-bar/sort-filter-bar.js +622 -617
  122. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  123. package/dist/src/styles/item-image-styles.d.ts +8 -8
  124. package/dist/src/styles/item-image-styles.js +9 -9
  125. package/dist/src/styles/sr-only.d.ts +1 -1
  126. package/dist/src/styles/sr-only.js +2 -2
  127. package/dist/src/tiles/base-tile-component.d.ts +18 -18
  128. package/dist/src/tiles/base-tile-component.js +59 -59
  129. package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
  130. package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
  131. package/dist/src/tiles/grid/account-tile.d.ts +18 -18
  132. package/dist/src/tiles/grid/account-tile.js +72 -72
  133. package/dist/src/tiles/grid/collection-tile.d.ts +15 -15
  134. package/dist/src/tiles/grid/collection-tile.js +80 -80
  135. package/dist/src/tiles/grid/item-tile.d.ts +27 -27
  136. package/dist/src/tiles/grid/item-tile.js +134 -134
  137. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
  138. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +8 -8
  139. package/dist/src/tiles/grid/tile-stats.d.ts +11 -11
  140. package/dist/src/tiles/grid/tile-stats.js +48 -48
  141. package/dist/src/tiles/hover/hover-pane-controller.d.ts +219 -219
  142. package/dist/src/tiles/hover/hover-pane-controller.js +352 -352
  143. package/dist/src/tiles/hover/tile-hover-pane.d.ts +15 -15
  144. package/dist/src/tiles/hover/tile-hover-pane.js +38 -38
  145. package/dist/src/tiles/image-block.d.ts +17 -17
  146. package/dist/src/tiles/image-block.js +72 -72
  147. package/dist/src/tiles/item-image.d.ts +35 -35
  148. package/dist/src/tiles/item-image.js +117 -117
  149. package/dist/src/tiles/list/tile-list-compact-header.d.ts +6 -6
  150. package/dist/src/tiles/list/tile-list-compact-header.js +38 -38
  151. package/dist/src/tiles/list/tile-list-compact.d.ts +15 -15
  152. package/dist/src/tiles/list/tile-list-compact.js +114 -114
  153. package/dist/src/tiles/list/tile-list.d.ts +46 -46
  154. package/dist/src/tiles/list/tile-list.js +298 -298
  155. package/dist/src/tiles/mediatype-icon.d.ts +9 -9
  156. package/dist/src/tiles/mediatype-icon.js +47 -47
  157. package/dist/src/tiles/overlay/icon-overlay.d.ts +10 -10
  158. package/dist/src/tiles/overlay/icon-overlay.js +40 -40
  159. package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
  160. package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
  161. package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
  162. package/dist/src/tiles/overlay/text-overlay.js +42 -42
  163. package/dist/src/tiles/text-snippet-block.d.ts +27 -27
  164. package/dist/src/tiles/text-snippet-block.js +73 -73
  165. package/dist/src/tiles/tile-dispatcher.d.ts +50 -50
  166. package/dist/src/tiles/tile-dispatcher.js +185 -185
  167. package/dist/src/tiles/tile-display-value-provider.d.ts +43 -43
  168. package/dist/src/tiles/tile-display-value-provider.js +80 -80
  169. package/dist/src/utils/analytics-events.d.ts +24 -24
  170. package/dist/src/utils/analytics-events.js +26 -26
  171. package/dist/src/utils/array-equals.d.ts +4 -4
  172. package/dist/src/utils/array-equals.js +10 -10
  173. package/dist/src/utils/format-count.d.ts +7 -7
  174. package/dist/src/utils/format-count.js +76 -76
  175. package/dist/src/utils/format-date.d.ts +2 -2
  176. package/dist/src/utils/format-date.js +25 -25
  177. package/dist/src/utils/format-unit-size.d.ts +2 -2
  178. package/dist/src/utils/format-unit-size.js +33 -33
  179. package/dist/src/utils/local-date-from-utc.d.ts +9 -9
  180. package/dist/src/utils/local-date-from-utc.js +15 -15
  181. package/dist/src/utils/sha1.d.ts +2 -2
  182. package/dist/src/utils/sha1.js +8 -8
  183. package/dist/test/collection-browser.test.d.ts +1 -1
  184. package/dist/test/collection-browser.test.js +808 -808
  185. package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
  186. package/dist/test/collection-facets/facets-template.test.js +134 -134
  187. package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
  188. package/dist/test/collection-facets/more-facets-content.test.js +133 -133
  189. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
  190. package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
  191. package/dist/test/collection-facets/toggle-switch.test.d.ts +1 -1
  192. package/dist/test/collection-facets/toggle-switch.test.js +73 -73
  193. package/dist/test/collection-facets.test.d.ts +2 -2
  194. package/dist/test/collection-facets.test.js +645 -645
  195. package/dist/test/empty-placeholder.test.d.ts +1 -1
  196. package/dist/test/empty-placeholder.test.js +56 -56
  197. package/dist/test/expanded-date-picker.test.d.ts +1 -1
  198. package/dist/test/expanded-date-picker.test.js +95 -95
  199. package/dist/test/icon-overlay.test.d.ts +1 -1
  200. package/dist/test/icon-overlay.test.js +24 -24
  201. package/dist/test/image-block.test.d.ts +1 -1
  202. package/dist/test/image-block.test.js +48 -48
  203. package/dist/test/item-image.test.d.ts +1 -1
  204. package/dist/test/item-image.test.js +84 -84
  205. package/dist/test/mediatype-config.test.d.ts +1 -1
  206. package/dist/test/mediatype-config.test.js +16 -16
  207. package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
  208. package/dist/test/mocks/mock-analytics-handler.js +15 -15
  209. package/dist/test/mocks/mock-collection-name-cache.d.ts +9 -9
  210. package/dist/test/mocks/mock-collection-name-cache.js +17 -17
  211. package/dist/test/mocks/mock-search-responses.d.ts +19 -19
  212. package/dist/test/mocks/mock-search-responses.js +623 -623
  213. package/dist/test/mocks/mock-search-service.d.ts +15 -15
  214. package/dist/test/mocks/mock-search-service.js +48 -48
  215. package/dist/test/restoration-state-handler.test.d.ts +1 -1
  216. package/dist/test/restoration-state-handler.test.js +270 -218
  217. package/dist/test/restoration-state-handler.test.js.map +1 -1
  218. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -1
  219. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +12 -12
  220. package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
  221. package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -73
  222. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
  223. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +378 -378
  224. package/dist/test/text-overlay.test.d.ts +1 -1
  225. package/dist/test/text-overlay.test.js +48 -48
  226. package/dist/test/text-snippet-block.test.d.ts +1 -1
  227. package/dist/test/text-snippet-block.test.js +57 -57
  228. package/dist/test/tile-stats.test.d.ts +1 -1
  229. package/dist/test/tile-stats.test.js +33 -33
  230. package/dist/test/tiles/grid/account-tile.test.d.ts +1 -1
  231. package/dist/test/tiles/grid/account-tile.test.js +76 -76
  232. package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
  233. package/dist/test/tiles/grid/collection-tile.test.js +73 -73
  234. package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
  235. package/dist/test/tiles/grid/item-tile.test.js +254 -254
  236. package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
  237. package/dist/test/tiles/hover/hover-pane-controller.test.js +257 -257
  238. package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -1
  239. package/dist/test/tiles/hover/tile-hover-pane.test.js +13 -13
  240. package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
  241. package/dist/test/tiles/list/tile-list-compact.test.js +143 -143
  242. package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
  243. package/dist/test/tiles/list/tile-list.test.js +242 -242
  244. package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -1
  245. package/dist/test/tiles/tile-dispatcher.test.js +67 -67
  246. package/dist/test/tiles/tile-display-value-provider.test.d.ts +1 -1
  247. package/dist/test/tiles/tile-display-value-provider.test.js +141 -141
  248. package/dist/test/utils/array-equals.test.d.ts +1 -1
  249. package/dist/test/utils/array-equals.test.js +26 -26
  250. package/dist/test/utils/format-count.test.d.ts +1 -1
  251. package/dist/test/utils/format-count.test.js +23 -23
  252. package/dist/test/utils/format-date.test.d.ts +1 -1
  253. package/dist/test/utils/format-date.test.js +17 -17
  254. package/dist/test/utils/format-unit-size.test.d.ts +1 -1
  255. package/dist/test/utils/format-unit-size.test.js +17 -17
  256. package/dist/test/utils/local-date-from-utc.test.d.ts +1 -1
  257. package/dist/test/utils/local-date-from-utc.test.js +26 -26
  258. package/local.archive.org.cert +86 -86
  259. package/local.archive.org.key +27 -27
  260. package/package.json +1 -1
  261. package/renovate.json +6 -6
  262. package/src/collection-browser.ts +42 -8
  263. package/src/models.ts +193 -109
  264. package/src/restoration-state-handler.ts +66 -40
  265. package/src/sort-filter-bar/sort-filter-bar.ts +34 -27
  266. package/test/restoration-state-handler.test.ts +68 -1
  267. package/tsconfig.json +21 -21
  268. package/web-dev-server.config.mjs +30 -30
  269. package/web-test-runner.config.mjs +41 -41
@@ -1,50 +1,50 @@
1
- import { __decorate } from "tslib";
2
- import { css, html, nothing } from 'lit';
3
- import { ifDefined } from 'lit/directives/if-defined.js';
4
- import { join } from 'lit/directives/join.js';
5
- import { map } from 'lit/directives/map.js';
6
- import { unsafeHTML } from 'lit/directives/unsafe-html.js';
7
- import { customElement, property, state } from 'lit/decorators.js';
8
- import { msg } from '@lit/localize';
9
- import DOMPurify from 'dompurify';
10
- import { suppressedCollections } from '../../models';
11
- import { BaseTileComponent } from '../base-tile-component';
12
- import { formatCount } from '../../utils/format-count';
13
- import { formatDate } from '../../utils/format-date';
14
- import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';
15
- import '../image-block';
16
- import '../mediatype-icon';
17
- let TileList = class TileList extends BaseTileComponent {
18
- constructor() {
19
- /*
20
- * Reactive properties inherited from BaseTileComponent:
21
- * - model?: TileModel;
22
- * - currentWidth?: number;
23
- * - currentHeight?: number;
24
- * - baseNavigationUrl?: string;
25
- * - baseImageUrl?: string;
26
- * - collectionPagePath?: string;
27
- * - sortParam: SortParam | null = null;
28
- * - creatorFilter?: string;
29
- * - mobileBreakpoint?: number;
30
- * - loggedIn = false;
31
- */
32
- super(...arguments);
33
- this.collectionLinks = [];
34
- }
35
- render() {
1
+ import { __decorate } from "tslib";
2
+ import { css, html, nothing } from 'lit';
3
+ import { ifDefined } from 'lit/directives/if-defined.js';
4
+ import { join } from 'lit/directives/join.js';
5
+ import { map } from 'lit/directives/map.js';
6
+ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
7
+ import { customElement, property, state } from 'lit/decorators.js';
8
+ import { msg } from '@lit/localize';
9
+ import DOMPurify from 'dompurify';
10
+ import { suppressedCollections } from '../../models';
11
+ import { BaseTileComponent } from '../base-tile-component';
12
+ import { formatCount } from '../../utils/format-count';
13
+ import { formatDate } from '../../utils/format-date';
14
+ import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';
15
+ import '../image-block';
16
+ import '../mediatype-icon';
17
+ let TileList = class TileList extends BaseTileComponent {
18
+ constructor() {
19
+ /*
20
+ * Reactive properties inherited from BaseTileComponent:
21
+ * - model?: TileModel;
22
+ * - currentWidth?: number;
23
+ * - currentHeight?: number;
24
+ * - baseNavigationUrl?: string;
25
+ * - baseImageUrl?: string;
26
+ * - collectionPagePath?: string;
27
+ * - sortParam: SortParam | null = null;
28
+ * - creatorFilter?: string;
29
+ * - mobileBreakpoint?: number;
30
+ * - loggedIn = false;
31
+ */
32
+ super(...arguments);
33
+ this.collectionLinks = [];
34
+ }
35
+ render() {
36
36
  return html `
37
37
  <div id="list-line" class="${this.classSize}">
38
- ${this.classSize === 'mobile'
39
- ? this.mobileTemplate
38
+ ${this.classSize === 'mobile'
39
+ ? this.mobileTemplate
40
40
  : this.desktopTemplate}
41
41
  </div>
42
- `;
43
- }
44
- /**
45
- * Templates
46
- */
47
- get mobileTemplate() {
42
+ `;
43
+ }
44
+ /**
45
+ * Templates
46
+ */
47
+ get mobileTemplate() {
48
48
  return html `
49
49
  <div id="list-line-top">
50
50
  <div id="list-line-left">${this.imageBlockTemplate}</div>
@@ -56,9 +56,9 @@ let TileList = class TileList extends BaseTileComponent {
56
56
  </div>
57
57
  </div>
58
58
  <div id="list-line-bottom">${this.detailsTemplate}</div>
59
- `;
60
- }
61
- get desktopTemplate() {
59
+ `;
60
+ }
61
+ get desktopTemplate() {
62
62
  return html `
63
63
  <div id="list-line-left">${this.imageBlockTemplate}</div>
64
64
  <div id="list-line-right">
@@ -68,13 +68,13 @@ let TileList = class TileList extends BaseTileComponent {
68
68
  </div>
69
69
  ${this.detailsTemplate}
70
70
  </div>
71
- `;
72
- }
73
- get imageBlockTemplate() {
74
- if (!this.model)
75
- return nothing;
76
- const isCollection = this.model.mediatype === 'collection';
77
- const href = this.displayValueProvider.itemPageUrl(this.model.identifier, isCollection);
71
+ `;
72
+ }
73
+ get imageBlockTemplate() {
74
+ if (!this.model)
75
+ return nothing;
76
+ const isCollection = this.model.mediatype === 'collection';
77
+ const href = this.displayValueProvider.itemPageUrl(this.model.identifier, isCollection);
78
78
  return html `<a href=${href}>
79
79
  <image-block
80
80
  .model=${this.model}
@@ -85,9 +85,9 @@ let TileList = class TileList extends BaseTileComponent {
85
85
  .loggedIn=${this.loggedIn}
86
86
  >
87
87
  </image-block>
88
- </a> `;
89
- }
90
- get detailsTemplate() {
88
+ </a> `;
89
+ }
90
+ get detailsTemplate() {
91
91
  return html `
92
92
  ${this.itemLineTemplate} ${this.creatorTemplate}
93
93
  <div id="dates-line">
@@ -98,11 +98,11 @@ let TileList = class TileList extends BaseTileComponent {
98
98
  </div>
99
99
  ${this.topicsTemplate} ${this.collectionsTemplate}
100
100
  ${this.descriptionTemplate} ${this.textSnippetsTemplate}
101
- `;
102
- }
103
- // Data templates
104
- get iconRightTemplate() {
105
- var _a, _b;
101
+ `;
102
+ }
103
+ // Data templates
104
+ get iconRightTemplate() {
105
+ var _a, _b;
106
106
  return html `
107
107
  <a id="icon-right" href=${this.mediatypeURL}>
108
108
  <mediatype-icon
@@ -111,270 +111,270 @@ let TileList = class TileList extends BaseTileComponent {
111
111
  >
112
112
  </mediatype-icon>
113
113
  </a>
114
- `;
115
- }
116
- get titleTemplate() {
117
- var _a, _b, _c;
118
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.title)) {
119
- return nothing;
120
- }
121
- // If the model has a server-specified href, use it
122
- // Otherwise construct a details link using the identifier
123
- return ((_b = this.model) === null || _b === void 0 ? void 0 : _b.href)
114
+ `;
115
+ }
116
+ get titleTemplate() {
117
+ var _a, _b, _c;
118
+ if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.title)) {
119
+ return nothing;
120
+ }
121
+ // If the model has a server-specified href, use it
122
+ // Otherwise construct a details link using the identifier
123
+ return ((_b = this.model) === null || _b === void 0 ? void 0 : _b.href)
124
124
  ? html `<a href="${this.baseNavigationUrl}${this.model.href}"
125
125
  >${(_c = this.model.title) !== null && _c !== void 0 ? _c : this.model.identifier}</a
126
- >`
127
- : this.detailsLink(this.model.identifier, this.model.title, this.model.mediatype === 'collection');
128
- }
129
- get itemLineTemplate() {
130
- const source = this.sourceTemplate;
131
- const volume = this.volumeTemplate;
132
- const issue = this.issueTemplate;
133
- if (!source && !volume && !issue) {
134
- return nothing;
135
- }
136
- return html ` <div id="item-line">${source} ${volume} ${issue}</div> `;
137
- }
138
- get sourceTemplate() {
139
- var _a;
140
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.source)) {
141
- return nothing;
142
- }
126
+ >`
127
+ : this.detailsLink(this.model.identifier, this.model.title, this.model.mediatype === 'collection');
128
+ }
129
+ get itemLineTemplate() {
130
+ const source = this.sourceTemplate;
131
+ const volume = this.volumeTemplate;
132
+ const issue = this.issueTemplate;
133
+ if (!source && !volume && !issue) {
134
+ return nothing;
135
+ }
136
+ return html ` <div id="item-line">${source} ${volume} ${issue}</div> `;
137
+ }
138
+ get sourceTemplate() {
139
+ var _a;
140
+ if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.source)) {
141
+ return nothing;
142
+ }
143
143
  return html `
144
144
  <div id="source" class="metadata">
145
145
  ${this.labelTemplate(msg('Source'))}
146
146
  ${this.searchLink('source', this.model.source)}
147
147
  </div>
148
- `;
149
- }
150
- get volumeTemplate() {
151
- var _a;
152
- return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.volume, msg('Volume'));
153
- }
154
- get issueTemplate() {
155
- var _a;
156
- return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.issue, msg('Issue'));
157
- }
158
- get creatorTemplate() {
159
- var _a, _b, _c;
160
- // "Archivist since" if account
161
- if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'account') {
148
+ `;
149
+ }
150
+ get volumeTemplate() {
151
+ var _a;
152
+ return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.volume, msg('Volume'));
153
+ }
154
+ get issueTemplate() {
155
+ var _a;
156
+ return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.issue, msg('Issue'));
157
+ }
158
+ get creatorTemplate() {
159
+ var _a, _b, _c;
160
+ // "Archivist since" if account
161
+ if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'account') {
162
162
  return html `
163
163
  <div id="creator" class="metadata">
164
164
  <span class="label"
165
165
  >${(_b = this.displayValueProvider.accountLabel) !== null && _b !== void 0 ? _b : nothing}</span
166
166
  >
167
167
  </div>
168
- `;
169
- }
170
- // "Creator" if not account tile
171
- if (!((_c = this.model) === null || _c === void 0 ? void 0 : _c.creators) || this.model.creators.length === 0) {
172
- return nothing;
173
- }
168
+ `;
169
+ }
170
+ // "Creator" if not account tile
171
+ if (!((_c = this.model) === null || _c === void 0 ? void 0 : _c.creators) || this.model.creators.length === 0) {
172
+ return nothing;
173
+ }
174
174
  return html `
175
175
  <div id="creator" class="metadata">
176
176
  ${this.labelTemplate(msg('By'))}
177
177
  ${join(map(this.model.creators, id => this.searchLink('creator', id)), ', ')}
178
178
  </div>
179
- `;
180
- }
181
- get datePublishedTemplate() {
182
- var _a;
183
- // If we're showing a date published of Jan 1 at midnight, only show the year.
184
- // This is because items with only a year for their publication date are normalized to
185
- // Jan 1 at midnight timestamps in the search engine documents.
186
- const date = (_a = this.model) === null || _a === void 0 ? void 0 : _a.datePublished;
187
- let format = 'long';
188
- if (isFirstMillisecondOfUTCYear(date)) {
189
- format = 'year-only';
190
- }
191
- return this.metadataTemplate(formatDate(date, format), msg('Published'));
192
- }
193
- // Show date label/value when sorted by date type
194
- // Except datePublished which is always shown
195
- get dateSortByTemplate() {
196
- if (this.sortParam &&
197
- (this.sortParam.field === 'addeddate' ||
198
- this.sortParam.field === 'reviewdate' ||
199
- this.sortParam.field === 'publicdate')) {
200
- return this.metadataTemplate(formatDate(this.date, 'long'), this.displayValueProvider.dateLabel);
201
- }
202
- return nothing;
203
- }
204
- get viewsTemplate() {
205
- var _a, _b, _c;
206
- const viewCount = ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) === 'week'
207
- ? (_b = this.model) === null || _b === void 0 ? void 0 : _b.weeklyViewCount // weekly views
208
- : (_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount; // all-time views
209
- return this.metadataTemplate(`${formatCount(viewCount !== null && viewCount !== void 0 ? viewCount : 0, this.formatSize)}`, msg('Views'));
210
- }
211
- get ratingTemplate() {
212
- var _a;
213
- return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.averageRating, msg('Avg Rating'));
214
- }
215
- get reviewsTemplate() {
216
- var _a;
217
- return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.commentCount, msg('Reviews'));
218
- }
219
- get topicsTemplate() {
220
- var _a;
221
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.subjects) || this.model.subjects.length === 0) {
222
- return nothing;
223
- }
179
+ `;
180
+ }
181
+ get datePublishedTemplate() {
182
+ var _a;
183
+ // If we're showing a date published of Jan 1 at midnight, only show the year.
184
+ // This is because items with only a year for their publication date are normalized to
185
+ // Jan 1 at midnight timestamps in the search engine documents.
186
+ const date = (_a = this.model) === null || _a === void 0 ? void 0 : _a.datePublished;
187
+ let format = 'long';
188
+ if (isFirstMillisecondOfUTCYear(date)) {
189
+ format = 'year-only';
190
+ }
191
+ return this.metadataTemplate(formatDate(date, format), msg('Published'));
192
+ }
193
+ // Show date label/value when sorted by date type
194
+ // Except datePublished which is always shown
195
+ get dateSortByTemplate() {
196
+ if (this.sortParam &&
197
+ (this.sortParam.field === 'addeddate' ||
198
+ this.sortParam.field === 'reviewdate' ||
199
+ this.sortParam.field === 'publicdate')) {
200
+ return this.metadataTemplate(formatDate(this.date, 'long'), this.displayValueProvider.dateLabel);
201
+ }
202
+ return nothing;
203
+ }
204
+ get viewsTemplate() {
205
+ var _a, _b, _c;
206
+ const viewCount = ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) === 'week'
207
+ ? (_b = this.model) === null || _b === void 0 ? void 0 : _b.weeklyViewCount // weekly views
208
+ : (_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount; // all-time views
209
+ return this.metadataTemplate(`${formatCount(viewCount !== null && viewCount !== void 0 ? viewCount : 0, this.formatSize)}`, msg('Views'));
210
+ }
211
+ get ratingTemplate() {
212
+ var _a;
213
+ return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.averageRating, msg('Avg Rating'));
214
+ }
215
+ get reviewsTemplate() {
216
+ var _a;
217
+ return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.commentCount, msg('Reviews'));
218
+ }
219
+ get topicsTemplate() {
220
+ var _a;
221
+ if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.subjects) || this.model.subjects.length === 0) {
222
+ return nothing;
223
+ }
224
224
  return html `
225
225
  <div id="topics" class="metadata">
226
226
  ${this.labelTemplate(msg('Topics'))}
227
227
  ${join(map(this.model.subjects, id => this.searchLink('subject', id)), ', ')}
228
228
  </div>
229
- `;
230
- }
231
- get collectionsTemplate() {
232
- if (!this.collectionLinks || this.collectionLinks.length === 0) {
233
- return nothing;
234
- }
229
+ `;
230
+ }
231
+ get collectionsTemplate() {
232
+ if (!this.collectionLinks || this.collectionLinks.length === 0) {
233
+ return nothing;
234
+ }
235
235
  return html `
236
236
  <div id="collections" class="metadata">
237
237
  ${this.labelTemplate(msg('Collections'))}
238
238
  ${join(this.collectionLinks, ', ')}
239
239
  </div>
240
- `;
241
- }
242
- get descriptionTemplate() {
243
- var _a, _b, _c;
244
- return this.metadataTemplate(
245
- // Sanitize away any HTML tags and convert line breaks to spaces.
246
- unsafeHTML(DOMPurify.sanitize((_c = (_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.description) === null || _b === void 0 ? void 0 : _b.replace(/\n/g, ' ')) !== null && _c !== void 0 ? _c : '')), '', 'description');
247
- }
248
- get textSnippetsTemplate() {
249
- var _a;
250
- if (!this.hasSnippets)
251
- return nothing;
240
+ `;
241
+ }
242
+ get descriptionTemplate() {
243
+ var _a, _b, _c;
244
+ return this.metadataTemplate(
245
+ // Sanitize away any HTML tags and convert line breaks to spaces.
246
+ unsafeHTML(DOMPurify.sanitize((_c = (_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.description) === null || _b === void 0 ? void 0 : _b.replace(/\n/g, ' ')) !== null && _c !== void 0 ? _c : '')), '', 'description');
247
+ }
248
+ get textSnippetsTemplate() {
249
+ var _a;
250
+ if (!this.hasSnippets)
251
+ return nothing;
252
252
  return html `<text-snippet-block
253
253
  viewsize="list"
254
254
  .snippets=${(_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets}
255
- ></text-snippet-block>`;
256
- }
257
- get hasSnippets() {
258
- var _a, _b;
259
- return !!((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets) === null || _b === void 0 ? void 0 : _b.length);
260
- }
261
- // Utility functions
262
- // eslint-disable-next-line default-param-last
263
- metadataTemplate(text, label = '', id) {
264
- if (!text)
265
- return nothing;
255
+ ></text-snippet-block>`;
256
+ }
257
+ get hasSnippets() {
258
+ var _a, _b;
259
+ return !!((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets) === null || _b === void 0 ? void 0 : _b.length);
260
+ }
261
+ // Utility functions
262
+ // eslint-disable-next-line default-param-last
263
+ metadataTemplate(text, label = '', id) {
264
+ if (!text)
265
+ return nothing;
266
266
  return html `
267
267
  <div id=${ifDefined(id)} class="metadata">
268
268
  ${this.labelTemplate(label)} ${text}
269
269
  </div>
270
- `;
271
- }
272
- labelTemplate(label) {
273
- return html ` ${label
274
- ? html `<span class="label">${label}: </span>`
275
- : nothing}`;
276
- }
277
- searchLink(field, searchTerm) {
278
- if (!field || !searchTerm) {
279
- return nothing;
280
- }
281
- const query = encodeURIComponent(`${field}:"${searchTerm}"`);
282
- // No whitespace after closing tag
283
- // Note: single ' for href='' to wrap " in query var gets changed back by yarn format
284
- /* eslint-disable lit/no-invalid-html */
270
+ `;
271
+ }
272
+ labelTemplate(label) {
273
+ return html ` ${label
274
+ ? html `<span class="label">${label}: </span>`
275
+ : nothing}`;
276
+ }
277
+ searchLink(field, searchTerm) {
278
+ if (!field || !searchTerm) {
279
+ return nothing;
280
+ }
281
+ const query = encodeURIComponent(`${field}:"${searchTerm}"`);
282
+ // No whitespace after closing tag
283
+ // Note: single ' for href='' to wrap " in query var gets changed back by yarn format
284
+ /* eslint-disable lit/no-invalid-html */
285
285
  return html `<a
286
286
  href="${this.baseNavigationUrl}/search?query=${query}"
287
287
  rel="nofollow"
288
288
  >
289
289
  ${DOMPurify.sanitize(searchTerm)}</a
290
- >`;
291
- /* eslint-enable lit/no-invalid-html */
292
- }
293
- detailsLink(identifier, text, isCollection = false) {
294
- const linkText = text !== null && text !== void 0 ? text : identifier;
295
- const linkHref = this.displayValueProvider.itemPageUrl(identifier, isCollection);
296
- return html `<a href=${linkHref}> ${DOMPurify.sanitize(linkText)} </a>`;
297
- }
298
- /** The URL of this item's mediatype collection, if defined. */
299
- get mediatypeURL() {
300
- var _a;
301
- // NB: baseNavigationUrl can be an empty string
302
- if (this.baseNavigationUrl === undefined || !((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype))
303
- return nothing;
304
- // Need special handling for certain mediatypes that don't have a top-level collection page
305
- switch (this.model.mediatype) {
306
- case 'collection':
307
- return `${this.baseNavigationUrl}/search?query=mediatype:collection&sort=-downloads`;
308
- case 'account':
309
- return nothing;
310
- default:
311
- return this.displayValueProvider.itemPageUrl(this.model.mediatype, true);
312
- }
313
- }
314
- updated(changed) {
315
- if (changed.has('model')) {
316
- this.fetchCollectionNames();
317
- }
318
- }
319
- async fetchCollectionNames() {
320
- var _a, _b;
321
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) ||
322
- this.model.collections.length === 0 ||
323
- !this.collectionNameCache) {
324
- return;
325
- }
326
- // Note: quirk of Lit: need to replace collectionLinks array,
327
- // otherwise it will not re-render. Can't simply alter the array.
328
- this.collectionLinks = [];
329
- const newCollectionLinks = [];
330
- const promises = [];
331
- for (const collection of this.model.collections) {
332
- // Don't include favorites or collections that are meant to be suppressed
333
- if (!suppressedCollections[collection] &&
334
- !collection.startsWith('fav-')) {
335
- promises.push((_b = this.collectionNameCache) === null || _b === void 0 ? void 0 : _b.collectionNameFor(collection).then(name => {
336
- newCollectionLinks.push(this.detailsLink(collection, name !== null && name !== void 0 ? name : collection, true));
337
- }));
338
- }
339
- }
340
- await Promise.all(promises);
341
- this.collectionLinks = newCollectionLinks;
342
- }
343
- /*
344
- * TODO: fix field names to match model in src/collection-browser.ts
345
- * private get dateSortSelector()
346
- * @see src/models.ts
347
- */
348
- get date() {
349
- var _a, _b, _c, _d, _e;
350
- switch ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) {
351
- case 'date':
352
- return (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished;
353
- case 'reviewdate':
354
- return (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed;
355
- case 'addeddate':
356
- return (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded;
357
- default:
358
- return (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived; // publicdate
359
- }
360
- }
361
- get classSize() {
362
- if (this.mobileBreakpoint &&
363
- this.currentWidth &&
364
- this.currentWidth < this.mobileBreakpoint) {
365
- return 'mobile';
366
- }
367
- return 'desktop';
368
- }
369
- get formatSize() {
370
- if (this.mobileBreakpoint &&
371
- this.currentWidth &&
372
- this.currentWidth < this.mobileBreakpoint) {
373
- return 'short';
374
- }
375
- return 'long';
376
- }
377
- static get styles() {
290
+ >`;
291
+ /* eslint-enable lit/no-invalid-html */
292
+ }
293
+ detailsLink(identifier, text, isCollection = false) {
294
+ const linkText = text !== null && text !== void 0 ? text : identifier;
295
+ const linkHref = this.displayValueProvider.itemPageUrl(identifier, isCollection);
296
+ return html `<a href=${linkHref}> ${DOMPurify.sanitize(linkText)} </a>`;
297
+ }
298
+ /** The URL of this item's mediatype collection, if defined. */
299
+ get mediatypeURL() {
300
+ var _a;
301
+ // NB: baseNavigationUrl can be an empty string
302
+ if (this.baseNavigationUrl === undefined || !((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype))
303
+ return nothing;
304
+ // Need special handling for certain mediatypes that don't have a top-level collection page
305
+ switch (this.model.mediatype) {
306
+ case 'collection':
307
+ return `${this.baseNavigationUrl}/search?query=mediatype:collection&sort=-downloads`;
308
+ case 'account':
309
+ return nothing;
310
+ default:
311
+ return this.displayValueProvider.itemPageUrl(this.model.mediatype, true);
312
+ }
313
+ }
314
+ updated(changed) {
315
+ if (changed.has('model')) {
316
+ this.fetchCollectionNames();
317
+ }
318
+ }
319
+ async fetchCollectionNames() {
320
+ var _a, _b;
321
+ if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) ||
322
+ this.model.collections.length === 0 ||
323
+ !this.collectionNameCache) {
324
+ return;
325
+ }
326
+ // Note: quirk of Lit: need to replace collectionLinks array,
327
+ // otherwise it will not re-render. Can't simply alter the array.
328
+ this.collectionLinks = [];
329
+ const newCollectionLinks = [];
330
+ const promises = [];
331
+ for (const collection of this.model.collections) {
332
+ // Don't include favorites or collections that are meant to be suppressed
333
+ if (!suppressedCollections[collection] &&
334
+ !collection.startsWith('fav-')) {
335
+ promises.push((_b = this.collectionNameCache) === null || _b === void 0 ? void 0 : _b.collectionNameFor(collection).then(name => {
336
+ newCollectionLinks.push(this.detailsLink(collection, name !== null && name !== void 0 ? name : collection, true));
337
+ }));
338
+ }
339
+ }
340
+ await Promise.all(promises);
341
+ this.collectionLinks = newCollectionLinks;
342
+ }
343
+ /*
344
+ * TODO: fix field names to match model in src/collection-browser.ts
345
+ * private get dateSortSelector()
346
+ * @see src/models.ts
347
+ */
348
+ get date() {
349
+ var _a, _b, _c, _d, _e;
350
+ switch ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) {
351
+ case 'date':
352
+ return (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished;
353
+ case 'reviewdate':
354
+ return (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed;
355
+ case 'addeddate':
356
+ return (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded;
357
+ default:
358
+ return (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived; // publicdate
359
+ }
360
+ }
361
+ get classSize() {
362
+ if (this.mobileBreakpoint &&
363
+ this.currentWidth &&
364
+ this.currentWidth < this.mobileBreakpoint) {
365
+ return 'mobile';
366
+ }
367
+ return 'desktop';
368
+ }
369
+ get formatSize() {
370
+ if (this.mobileBreakpoint &&
371
+ this.currentWidth &&
372
+ this.currentWidth < this.mobileBreakpoint) {
373
+ return 'short';
374
+ }
375
+ return 'long';
376
+ }
377
+ static get styles() {
378
378
  return css `
379
379
  html {
380
380
  font-size: unset;
@@ -545,17 +545,17 @@ let TileList = class TileList extends BaseTileComponent {
545
545
  #views-line {
546
546
  flex-wrap: wrap;
547
547
  }
548
- `;
549
- }
550
- };
551
- __decorate([
552
- property({ type: Object })
553
- ], TileList.prototype, "collectionNameCache", void 0);
554
- __decorate([
555
- state()
556
- ], TileList.prototype, "collectionLinks", void 0);
557
- TileList = __decorate([
558
- customElement('tile-list')
559
- ], TileList);
560
- export { TileList };
548
+ `;
549
+ }
550
+ };
551
+ __decorate([
552
+ property({ type: Object })
553
+ ], TileList.prototype, "collectionNameCache", void 0);
554
+ __decorate([
555
+ state()
556
+ ], TileList.prototype, "collectionLinks", void 0);
557
+ TileList = __decorate([
558
+ customElement('tile-list')
559
+ ], TileList);
560
+ export { TileList };
561
561
  //# sourceMappingURL=tile-list.js.map