@internetarchive/collection-browser 0.4.10-alpha.3 → 0.4.11

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