@internetarchive/collection-browser 0.4.6 → 0.4.8-alpha.1

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