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

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 (236) 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 +47 -43
  12. package/dist/src/app-root.js +331 -285
  13. package/dist/src/app-root.js.map +1 -1
  14. package/dist/src/assets/img/icons/arrow-left.d.ts +2 -2
  15. package/dist/src/assets/img/icons/arrow-left.js +2 -2
  16. package/dist/src/assets/img/icons/arrow-right.d.ts +2 -2
  17. package/dist/src/assets/img/icons/arrow-right.js +2 -2
  18. package/dist/src/assets/img/icons/chevron.d.ts +2 -2
  19. package/dist/src/assets/img/icons/chevron.js +2 -2
  20. package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
  21. package/dist/src/assets/img/icons/empty-query.js +2 -2
  22. package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
  23. package/dist/src/assets/img/icons/eye-closed.js +2 -2
  24. package/dist/src/assets/img/icons/eye.d.ts +2 -2
  25. package/dist/src/assets/img/icons/eye.js +2 -2
  26. package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
  27. package/dist/src/assets/img/icons/favorite-filled.js +2 -2
  28. package/dist/src/assets/img/icons/login-required.d.ts +1 -1
  29. package/dist/src/assets/img/icons/login-required.js +2 -2
  30. package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
  31. package/dist/src/assets/img/icons/mediatype/account.js +2 -2
  32. package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
  33. package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
  34. package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
  35. package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
  36. package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
  37. package/dist/src/assets/img/icons/mediatype/data.js +2 -2
  38. package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
  39. package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
  40. package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
  41. package/dist/src/assets/img/icons/mediatype/film.js +2 -2
  42. package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
  43. package/dist/src/assets/img/icons/mediatype/images.js +2 -2
  44. package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
  45. package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
  46. package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
  47. package/dist/src/assets/img/icons/mediatype/software.js +2 -2
  48. package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
  49. package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
  50. package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
  51. package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
  52. package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
  53. package/dist/src/assets/img/icons/mediatype/video.js +2 -2
  54. package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
  55. package/dist/src/assets/img/icons/mediatype/web.js +2 -2
  56. package/dist/src/assets/img/icons/null-result.d.ts +2 -2
  57. package/dist/src/assets/img/icons/null-result.js +2 -2
  58. package/dist/src/assets/img/icons/restricted.d.ts +1 -1
  59. package/dist/src/assets/img/icons/restricted.js +2 -2
  60. package/dist/src/assets/img/icons/reviews.d.ts +1 -1
  61. package/dist/src/assets/img/icons/reviews.js +2 -2
  62. package/dist/src/assets/img/icons/upload.d.ts +1 -1
  63. package/dist/src/assets/img/icons/upload.js +2 -2
  64. package/dist/src/assets/img/icons/views.d.ts +1 -1
  65. package/dist/src/assets/img/icons/views.js +2 -2
  66. package/dist/src/circular-activity-indicator.d.ts +5 -5
  67. package/dist/src/circular-activity-indicator.js +17 -17
  68. package/dist/src/collection-browser.d.ts +246 -245
  69. package/dist/src/collection-browser.js +1370 -1359
  70. package/dist/src/collection-browser.js.map +1 -1
  71. package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
  72. package/dist/src/collection-facets/facet-tombstone-row.js +42 -42
  73. package/dist/src/collection-facets/facet-tombstone-row.js.map +1 -1
  74. package/dist/src/collection-facets/facets-template.d.ts +16 -16
  75. package/dist/src/collection-facets/facets-template.js +130 -128
  76. package/dist/src/collection-facets/facets-template.js.map +1 -1
  77. package/dist/src/collection-facets/more-facets-content.d.ts +76 -76
  78. package/dist/src/collection-facets/more-facets-content.js +353 -353
  79. package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
  80. package/dist/src/collection-facets/more-facets-pagination.js +192 -192
  81. package/dist/src/collection-facets.d.ts +77 -77
  82. package/dist/src/collection-facets.js +551 -551
  83. package/dist/src/collection-facets.js.map +1 -1
  84. package/dist/src/empty-placeholder.d.ts +11 -11
  85. package/dist/src/empty-placeholder.js +42 -42
  86. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
  87. package/dist/src/language-code-handler/language-code-handler.js +26 -26
  88. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
  89. package/dist/src/language-code-handler/language-code-mapping.js +562 -562
  90. package/dist/src/mediatype/mediatype-config.d.ts +3 -3
  91. package/dist/src/mediatype/mediatype-config.js +85 -85
  92. package/dist/src/models.d.ts +103 -102
  93. package/dist/src/models.js +117 -117
  94. package/dist/src/models.js.map +1 -1
  95. package/dist/src/restoration-state-handler.d.ts +46 -45
  96. package/dist/src/restoration-state-handler.js +230 -220
  97. package/dist/src/restoration-state-handler.js.map +1 -1
  98. package/dist/src/sort-filter-bar/alpha-bar.d.ts +9 -9
  99. package/dist/src/sort-filter-bar/alpha-bar.js +41 -41
  100. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
  101. package/dist/src/sort-filter-bar/img/compact.js +2 -2
  102. package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
  103. package/dist/src/sort-filter-bar/img/list.js +2 -2
  104. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
  105. package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
  106. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
  107. package/dist/src/sort-filter-bar/img/tile.js +2 -2
  108. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +107 -107
  109. package/dist/src/sort-filter-bar/sort-filter-bar.js +423 -423
  110. package/dist/src/styles/item-image-styles.d.ts +8 -8
  111. package/dist/src/styles/item-image-styles.js +9 -9
  112. package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
  113. package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
  114. package/dist/src/tiles/grid/account-tile.d.ts +8 -8
  115. package/dist/src/tiles/grid/account-tile.js +20 -20
  116. package/dist/src/tiles/grid/collection-tile.d.ts +7 -7
  117. package/dist/src/tiles/grid/collection-tile.js +23 -23
  118. package/dist/src/tiles/grid/item-tile.d.ts +24 -24
  119. package/dist/src/tiles/grid/item-tile.js +87 -87
  120. package/dist/src/tiles/grid/tile-stats.d.ts +10 -10
  121. package/dist/src/tiles/grid/tile-stats.js +46 -40
  122. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  123. package/dist/src/tiles/image-block.d.ts +17 -17
  124. package/dist/src/tiles/image-block.js +69 -69
  125. package/dist/src/tiles/item-image.d.ts +31 -31
  126. package/dist/src/tiles/item-image.js +103 -103
  127. package/dist/src/tiles/list/account-label.d.ts +1 -1
  128. package/dist/src/tiles/list/account-label.js +6 -6
  129. package/dist/src/tiles/list/date-label.d.ts +1 -1
  130. package/dist/src/tiles/list/date-label.js +12 -12
  131. package/dist/src/tiles/list/tile-list-compact-header.d.ts +12 -12
  132. package/dist/src/tiles/list/tile-list-compact-header.js +41 -41
  133. package/dist/src/tiles/list/tile-list-compact.d.ts +21 -20
  134. package/dist/src/tiles/list/tile-list-compact.js +94 -90
  135. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  136. package/dist/src/tiles/list/tile-list.d.ts +50 -50
  137. package/dist/src/tiles/list/tile-list.js +271 -268
  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 +49 -47
  141. package/dist/src/tiles/mediatype-icon.js.map +1 -1
  142. package/dist/src/tiles/overlay/icon-overlay.d.ts +7 -7
  143. package/dist/src/tiles/overlay/icon-overlay.js +30 -30
  144. package/dist/src/tiles/overlay/text-overlay.d.ts +8 -8
  145. package/dist/src/tiles/overlay/text-overlay.js +31 -31
  146. package/dist/src/tiles/text-snippet-block.d.ts +29 -29
  147. package/dist/src/tiles/text-snippet-block.js +81 -81
  148. package/dist/src/tiles/tile-dispatcher.d.ts +36 -36
  149. package/dist/src/tiles/tile-dispatcher.js +128 -128
  150. package/dist/src/utils/analytics-events.d.ts +22 -22
  151. package/dist/src/utils/analytics-events.js +24 -24
  152. package/dist/src/utils/format-count.d.ts +7 -7
  153. package/dist/src/utils/format-count.js +76 -76
  154. package/dist/src/utils/format-date.d.ts +2 -2
  155. package/dist/src/utils/format-date.js +23 -23
  156. package/dist/test/collection-browser.test.d.ts +1 -1
  157. package/dist/test/collection-browser.test.js +481 -415
  158. package/dist/test/collection-browser.test.js.map +1 -1
  159. package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
  160. package/dist/test/collection-facets/facets-template.test.js +62 -62
  161. package/dist/test/collection-facets/facets-template.test.js.map +1 -1
  162. package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
  163. package/dist/test/collection-facets/more-facets-content.test.js +114 -114
  164. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
  165. package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
  166. package/dist/test/collection-facets.test.d.ts +2 -2
  167. package/dist/test/collection-facets.test.js +498 -498
  168. package/dist/test/empty-placeholder.test.d.ts +1 -1
  169. package/dist/test/empty-placeholder.test.js +33 -33
  170. package/dist/test/icon-overlay.test.d.ts +1 -1
  171. package/dist/test/icon-overlay.test.js +24 -24
  172. package/dist/test/image-block.test.d.ts +1 -1
  173. package/dist/test/image-block.test.js +48 -48
  174. package/dist/test/item-image.test.d.ts +1 -1
  175. package/dist/test/item-image.test.js +56 -56
  176. package/dist/test/mediatype-config.test.d.ts +1 -1
  177. package/dist/test/mediatype-config.test.js +16 -16
  178. package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
  179. package/dist/test/mocks/mock-analytics-handler.js +15 -15
  180. package/dist/test/mocks/mock-collection-name-cache.d.ts +7 -7
  181. package/dist/test/mocks/mock-collection-name-cache.js +13 -13
  182. package/dist/test/mocks/mock-search-responses.d.ts +8 -8
  183. package/dist/test/mocks/mock-search-responses.js +198 -198
  184. package/dist/test/mocks/mock-search-responses.js.map +1 -1
  185. package/dist/test/mocks/mock-search-service.d.ts +13 -13
  186. package/dist/test/mocks/mock-search-service.js +32 -32
  187. package/dist/test/mocks/mock-search-service.js.map +1 -1
  188. package/dist/test/restoration-state-handler.test.d.ts +1 -1
  189. package/dist/test/restoration-state-handler.test.js +126 -117
  190. package/dist/test/restoration-state-handler.test.js.map +1 -1
  191. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
  192. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +113 -113
  193. package/dist/test/text-overlay.test.d.ts +1 -1
  194. package/dist/test/text-overlay.test.js +41 -41
  195. package/dist/test/text-snippet-block.test.d.ts +1 -1
  196. package/dist/test/text-snippet-block.test.js +57 -57
  197. package/dist/test/tile-stats.test.d.ts +1 -1
  198. package/dist/test/tile-stats.test.js +33 -33
  199. package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
  200. package/dist/test/tiles/grid/item-tile.test.js +107 -107
  201. package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
  202. package/dist/test/tiles/list/tile-list-compact.test.js +125 -26
  203. package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
  204. package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
  205. package/dist/test/tiles/list/tile-list.test.js +79 -47
  206. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  207. package/dist/test/utils/format-count.test.d.ts +1 -1
  208. package/dist/test/utils/format-count.test.js +23 -23
  209. package/dist/test/utils/format-date.test.d.ts +1 -1
  210. package/dist/test/utils/format-date.test.js +17 -17
  211. package/index.html +24 -24
  212. package/local.archive.org.cert +86 -86
  213. package/local.archive.org.key +27 -27
  214. package/package.json +115 -115
  215. package/renovate.json +6 -6
  216. package/src/app-root.ts +104 -55
  217. package/src/collection-browser.ts +1503 -1488
  218. package/src/collection-facets/facet-tombstone-row.ts +40 -40
  219. package/src/collection-facets/facets-template.ts +5 -3
  220. package/src/collection-facets.ts +635 -635
  221. package/src/models.ts +1 -0
  222. package/src/restoration-state-handler.ts +19 -1
  223. package/src/tiles/grid/tile-stats.ts +18 -5
  224. package/src/tiles/list/tile-list-compact.ts +7 -3
  225. package/src/tiles/list/tile-list.ts +6 -1
  226. package/src/tiles/mediatype-icon.ts +2 -0
  227. package/test/collection-browser.test.ts +679 -599
  228. package/test/collection-facets/facets-template.test.ts +5 -3
  229. package/test/mocks/mock-search-responses.ts +226 -226
  230. package/test/mocks/mock-search-service.ts +61 -61
  231. package/test/restoration-state-handler.test.ts +12 -0
  232. package/test/tiles/list/tile-list-compact.test.ts +110 -0
  233. package/test/tiles/list/tile-list.test.ts +36 -0
  234. package/tsconfig.json +21 -21
  235. package/web-dev-server.config.mjs +30 -30
  236. package/web-test-runner.config.mjs +41 -41
@@ -1,62 +1,62 @@
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 { customElement, property, state } from 'lit/decorators.js';
7
- import DOMPurify from 'dompurify';
8
- import { suppressedCollections } from '../../models';
9
- import { dateLabel } from './date-label';
10
- import { accountLabel } from './account-label';
11
- import { formatCount } from '../../utils/format-count';
12
- import { formatDate } from '../../utils/format-date';
13
- import '../image-block';
14
- import '../mediatype-icon';
15
- let TileList = class TileList extends LitElement {
16
- constructor() {
17
- super(...arguments);
18
- this.sortParam = null;
19
- this.collectionLinks = [];
20
- this.loggedIn = false;
21
- }
22
- updated(changed) {
23
- if (changed.has('model')) {
24
- this.fetchCollectionNames();
25
- }
26
- }
27
- async fetchCollectionNames() {
28
- var _a, _b;
29
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) ||
30
- this.model.collections.length === 0 ||
31
- !this.collectionNameCache) {
32
- return;
33
- }
34
- // Note: quirk of Lit: need to replace collectionLinks array,
35
- // otherwise it will not re-render. Can't simply alter the array.
36
- this.collectionLinks = [];
37
- const newCollectionLinks = [];
38
- const promises = [];
39
- for (const collection of this.model.collections) {
40
- // Don't include collections that are meant to be suppressed
41
- if (!suppressedCollections[collection]) {
42
- promises.push((_b = this.collectionNameCache) === null || _b === void 0 ? void 0 : _b.collectionNameFor(collection).then(name => {
43
- newCollectionLinks.push(this.detailsLink(collection, name !== null && name !== void 0 ? name : collection));
44
- }));
45
- }
46
- }
47
- await Promise.all(promises);
48
- this.collectionLinks = newCollectionLinks;
49
- }
50
- 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 { customElement, property, state } from 'lit/decorators.js';
7
+ import DOMPurify from 'dompurify';
8
+ import { suppressedCollections } from '../../models';
9
+ import { dateLabel } from './date-label';
10
+ import { accountLabel } from './account-label';
11
+ import { formatCount } from '../../utils/format-count';
12
+ import { formatDate } from '../../utils/format-date';
13
+ import '../image-block';
14
+ import '../mediatype-icon';
15
+ let TileList = class TileList extends LitElement {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.sortParam = null;
19
+ this.collectionLinks = [];
20
+ this.loggedIn = false;
21
+ }
22
+ updated(changed) {
23
+ if (changed.has('model')) {
24
+ this.fetchCollectionNames();
25
+ }
26
+ }
27
+ async fetchCollectionNames() {
28
+ var _a, _b;
29
+ if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) ||
30
+ this.model.collections.length === 0 ||
31
+ !this.collectionNameCache) {
32
+ return;
33
+ }
34
+ // Note: quirk of Lit: need to replace collectionLinks array,
35
+ // otherwise it will not re-render. Can't simply alter the array.
36
+ this.collectionLinks = [];
37
+ const newCollectionLinks = [];
38
+ const promises = [];
39
+ for (const collection of this.model.collections) {
40
+ // Don't include collections that are meant to be suppressed
41
+ if (!suppressedCollections[collection]) {
42
+ promises.push((_b = this.collectionNameCache) === null || _b === void 0 ? void 0 : _b.collectionNameFor(collection).then(name => {
43
+ newCollectionLinks.push(this.detailsLink(collection, name !== null && name !== void 0 ? name : collection));
44
+ }));
45
+ }
46
+ }
47
+ await Promise.all(promises);
48
+ this.collectionLinks = newCollectionLinks;
49
+ }
50
+ render() {
51
51
  return html `
52
52
  <div id="list-line" class="${this.classSize}">
53
- ${this.classSize === 'mobile'
54
- ? this.mobileTemplate
53
+ ${this.classSize === 'mobile'
54
+ ? this.mobileTemplate
55
55
  : this.desktopTemplate}
56
56
  </div>
57
- `;
58
- }
59
- get mobileTemplate() {
57
+ `;
58
+ }
59
+ get mobileTemplate() {
60
60
  return html `
61
61
  <div id="list-line-top">
62
62
  <div id="list-line-left">${this.imageBlockTemplate}</div>
@@ -68,9 +68,9 @@ let TileList = class TileList extends LitElement {
68
68
  </div>
69
69
  </div>
70
70
  <div id="list-line-bottom">${this.detailsTemplate}</div>
71
- `;
72
- }
73
- get desktopTemplate() {
71
+ `;
72
+ }
73
+ get desktopTemplate() {
74
74
  return html `
75
75
  <div id="list-line-left">${this.imageBlockTemplate}</div>
76
76
  <div id="list-line-right">
@@ -80,9 +80,9 @@ let TileList = class TileList extends LitElement {
80
80
  </div>
81
81
  ${this.detailsTemplate}
82
82
  </div>
83
- `;
84
- }
85
- get imageBlockTemplate() {
83
+ `;
84
+ }
85
+ get imageBlockTemplate() {
86
86
  return html `
87
87
  <image-block
88
88
  .model=${this.model}
@@ -93,9 +93,9 @@ let TileList = class TileList extends LitElement {
93
93
  .loggedIn=${this.loggedIn}
94
94
  >
95
95
  </image-block>
96
- `;
97
- }
98
- get detailsTemplate() {
96
+ `;
97
+ }
98
+ get detailsTemplate() {
99
99
  return html `
100
100
  ${this.itemLineTemplate} ${this.creatorTemplate}
101
101
  <div id="dates-line">
@@ -106,11 +106,11 @@ let TileList = class TileList extends LitElement {
106
106
  </div>
107
107
  ${this.topicsTemplate} ${this.collectionsTemplate}
108
108
  ${this.descriptionTemplate} ${this.textSnippetsTemplate}
109
- `;
110
- }
111
- // Data templates
112
- get iconRightTemplate() {
113
- var _a, _b;
109
+ `;
110
+ }
111
+ // Data templates
112
+ get iconRightTemplate() {
113
+ var _a, _b;
114
114
  return html `
115
115
  <div id="icon-right">
116
116
  <mediatype-icon
@@ -119,204 +119,207 @@ let TileList = class TileList extends LitElement {
119
119
  >
120
120
  </mediatype-icon>
121
121
  </div>
122
- `;
123
- }
124
- get titleTemplate() {
125
- var _a;
126
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.title)) {
127
- return nothing;
128
- }
129
- return html ` ${this.detailsLink(this.model.identifier, this.model.title)} `;
130
- }
131
- get itemLineTemplate() {
132
- const source = this.sourceTemplate;
133
- const volume = this.volumeTemplate;
134
- const issue = this.issueTemplate;
135
- if (!source && !volume && !issue) {
136
- return nothing;
137
- }
138
- return html ` <div id="item-line">${source} ${volume} ${issue}</div> `;
139
- }
140
- get sourceTemplate() {
141
- var _a;
142
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.source)) {
143
- return nothing;
144
- }
122
+ `;
123
+ }
124
+ get titleTemplate() {
125
+ var _a;
126
+ if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.title)) {
127
+ return nothing;
128
+ }
129
+ return html ` ${this.detailsLink(this.model.identifier, this.model.title)} `;
130
+ }
131
+ get itemLineTemplate() {
132
+ const source = this.sourceTemplate;
133
+ const volume = this.volumeTemplate;
134
+ const issue = this.issueTemplate;
135
+ if (!source && !volume && !issue) {
136
+ return nothing;
137
+ }
138
+ return html ` <div id="item-line">${source} ${volume} ${issue}</div> `;
139
+ }
140
+ get sourceTemplate() {
141
+ var _a;
142
+ if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.source)) {
143
+ return nothing;
144
+ }
145
145
  return html `
146
146
  <div id="source" class="metadata">
147
147
  ${this.labelTemplate('Source')}
148
148
  ${this.searchLink('source', this.model.source)}
149
149
  </div>
150
- `;
151
- }
152
- get volumeTemplate() {
153
- var _a;
154
- return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.volume, 'Volume');
155
- }
156
- get issueTemplate() {
157
- var _a;
158
- return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.issue, 'Issue');
159
- }
160
- get creatorTemplate() {
161
- var _a, _b, _c;
162
- // "Achivist since" if account
163
- if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'account') {
150
+ `;
151
+ }
152
+ get volumeTemplate() {
153
+ var _a;
154
+ return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.volume, 'Volume');
155
+ }
156
+ get issueTemplate() {
157
+ var _a;
158
+ return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.issue, 'Issue');
159
+ }
160
+ get creatorTemplate() {
161
+ var _a, _b, _c;
162
+ // "Achivist since" if account
163
+ if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'account') {
164
164
  return html `
165
165
  <div id="creator" class="metadata">
166
166
  <span class="label"> ${accountLabel((_b = this.model) === null || _b === void 0 ? void 0 : _b.dateAdded)} </span>
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('By')}
177
177
  ${join(map(this.model.creators, id => this.searchLink('creator', id)), html `, `)}
178
178
  </div>
179
- `;
180
- }
181
- get datePublishedTemplate() {
182
- var _a;
183
- return this.metadataTemplate(formatDate((_a = this.model) === null || _a === void 0 ? void 0 : _a.datePublished, 'long'), 'Published');
184
- }
185
- // Show date label/value when sorted by date type
186
- // Except datePublished which is always shown
187
- get dateSortByTemplate() {
188
- if (this.sortParam &&
189
- (this.sortParam.field === 'addeddate' ||
190
- this.sortParam.field === 'reviewdate' ||
191
- this.sortParam.field === 'publicdate')) {
192
- return this.metadataTemplate(formatDate(this.date, 'long'), dateLabel(this.sortParam.field));
193
- }
194
- return nothing;
195
- }
196
- get viewsTemplate() {
197
- var _a, _b;
198
- return this.metadataTemplate(`${formatCount((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.viewCount) !== null && _b !== void 0 ? _b : 0, this.formatSize)}`, 'Views');
199
- }
200
- get ratingTemplate() {
201
- var _a;
202
- return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.averageRating, 'Avg Rating');
203
- }
204
- get reviewsTemplate() {
205
- var _a;
206
- return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.commentCount, 'Reviews');
207
- }
208
- get topicsTemplate() {
209
- var _a;
210
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.subjects) || this.model.subjects.length === 0) {
211
- return nothing;
212
- }
179
+ `;
180
+ }
181
+ get datePublishedTemplate() {
182
+ var _a;
183
+ return this.metadataTemplate(formatDate((_a = this.model) === null || _a === void 0 ? void 0 : _a.datePublished, 'long'), 'Published');
184
+ }
185
+ // Show date label/value when sorted by date type
186
+ // Except datePublished which is always shown
187
+ get dateSortByTemplate() {
188
+ if (this.sortParam &&
189
+ (this.sortParam.field === 'addeddate' ||
190
+ this.sortParam.field === 'reviewdate' ||
191
+ this.sortParam.field === 'publicdate')) {
192
+ return this.metadataTemplate(formatDate(this.date, 'long'), dateLabel(this.sortParam.field));
193
+ }
194
+ return nothing;
195
+ }
196
+ get viewsTemplate() {
197
+ var _a, _b, _c;
198
+ const viewCount = ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) === 'week'
199
+ ? (_b = this.model) === null || _b === void 0 ? void 0 : _b.weeklyViewCount // weekly views
200
+ : (_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount; // all-time views
201
+ return this.metadataTemplate(`${formatCount(viewCount !== null && viewCount !== void 0 ? viewCount : 0, this.formatSize)}`, 'Views');
202
+ }
203
+ get ratingTemplate() {
204
+ var _a;
205
+ return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.averageRating, 'Avg Rating');
206
+ }
207
+ get reviewsTemplate() {
208
+ var _a;
209
+ return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.commentCount, 'Reviews');
210
+ }
211
+ get topicsTemplate() {
212
+ var _a;
213
+ if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.subjects) || this.model.subjects.length === 0) {
214
+ return nothing;
215
+ }
213
216
  return html `
214
217
  <div id="topics" class="metadata">
215
218
  ${this.labelTemplate('Topics')}
216
219
  ${join(map(this.model.subjects, id => this.searchLink('subject', id)), html `, `)}
217
220
  </div>
218
- `;
219
- }
220
- get collectionsTemplate() {
221
- if (!this.collectionLinks || this.collectionLinks.length === 0) {
222
- return nothing;
223
- }
221
+ `;
222
+ }
223
+ get collectionsTemplate() {
224
+ if (!this.collectionLinks || this.collectionLinks.length === 0) {
225
+ return nothing;
226
+ }
224
227
  return html `
225
228
  <div id="collections" class="metadata">
226
229
  ${this.labelTemplate('Collections')}
227
230
  ${join(this.collectionLinks, html `, `)}
228
231
  </div>
229
- `;
230
- }
231
- get descriptionTemplate() {
232
- var _a, _b;
233
- return this.metadataTemplate(DOMPurify.sanitize((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : ''), '', 'description');
234
- }
235
- get textSnippetsTemplate() {
236
- var _a;
237
- if (!this.hasSnippets)
238
- return nothing;
232
+ `;
233
+ }
234
+ get descriptionTemplate() {
235
+ var _a, _b;
236
+ return this.metadataTemplate(DOMPurify.sanitize((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : ''), '', 'description');
237
+ }
238
+ get textSnippetsTemplate() {
239
+ var _a;
240
+ if (!this.hasSnippets)
241
+ return nothing;
239
242
  return html `<text-snippet-block
240
243
  viewsize="list"
241
244
  .snippets=${(_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets}
242
- ></text-snippet-block>`;
243
- }
244
- get hasSnippets() {
245
- var _a, _b;
246
- return !!((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets) === null || _b === void 0 ? void 0 : _b.length);
247
- }
248
- // Utility functions
249
- // eslint-disable-next-line default-param-last
250
- metadataTemplate(text, label = '', id) {
251
- if (!text)
252
- return nothing;
245
+ ></text-snippet-block>`;
246
+ }
247
+ get hasSnippets() {
248
+ var _a, _b;
249
+ return !!((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets) === null || _b === void 0 ? void 0 : _b.length);
250
+ }
251
+ // Utility functions
252
+ // eslint-disable-next-line default-param-last
253
+ metadataTemplate(text, label = '', id) {
254
+ if (!text)
255
+ return nothing;
253
256
  return html `
254
257
  <div id=${ifDefined(id)} class="metadata">
255
258
  ${this.labelTemplate(label)} ${text}
256
259
  </div>
257
- `;
258
- }
259
- labelTemplate(label) {
260
- return html ` ${label
261
- ? html `<span class="label">${label}: </span>`
262
- : nothing}`;
263
- }
264
- searchLink(field, searchTerm) {
265
- if (!field || !searchTerm) {
266
- return nothing;
267
- }
268
- const query = encodeURIComponent(`${field}:"${searchTerm}"`);
269
- // No whitespace after closing tag
270
- // Note: single ' for href='' to wrap " in query var gets changed back by yarn format
271
- // eslint-disable-next-line lit/no-invalid-html
260
+ `;
261
+ }
262
+ labelTemplate(label) {
263
+ return html ` ${label
264
+ ? html `<span class="label">${label}: </span>`
265
+ : nothing}`;
266
+ }
267
+ searchLink(field, searchTerm) {
268
+ if (!field || !searchTerm) {
269
+ return nothing;
270
+ }
271
+ const query = encodeURIComponent(`${field}:"${searchTerm}"`);
272
+ // No whitespace after closing tag
273
+ // Note: single ' for href='' to wrap " in query var gets changed back by yarn format
274
+ // eslint-disable-next-line lit/no-invalid-html
272
275
  return html `<a href="${this.baseNavigationUrl}/search.php?query=${query}">
273
276
  ${DOMPurify.sanitize(searchTerm)}</a
274
- >`;
275
- }
276
- detailsLink(identifier, text) {
277
- const linkText = text !== null && text !== void 0 ? text : identifier;
278
- // No whitespace after closing tag
279
- // identifiers (all ASCII in their creation) should be safe to use in href, but sanitize anyway
277
+ >`;
278
+ }
279
+ detailsLink(identifier, text) {
280
+ const linkText = text !== null && text !== void 0 ? text : identifier;
281
+ // No whitespace after closing tag
282
+ // identifiers (all ASCII in their creation) should be safe to use in href, but sanitize anyway
280
283
  return html `<a
281
284
  href="${this.baseNavigationUrl}/details/${encodeURI(identifier)}"
282
285
  >${DOMPurify.sanitize(linkText)}</a
283
- >`;
284
- }
285
- /*
286
- * TODO: fix field names to match model in src/collection-browser.ts
287
- * private get dateSortSelector()
288
- * @see src/models.ts
289
- */
290
- get date() {
291
- var _a, _b, _c, _d, _e;
292
- switch ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) {
293
- case 'date':
294
- return (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished;
295
- case 'reviewdate':
296
- return (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed;
297
- case 'addeddate':
298
- return (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded;
299
- default:
300
- return (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived; // publicdate
301
- }
302
- }
303
- get classSize() {
304
- if (this.mobileBreakpoint &&
305
- this.currentWidth &&
306
- this.currentWidth < this.mobileBreakpoint) {
307
- return 'mobile';
308
- }
309
- return 'desktop';
310
- }
311
- get formatSize() {
312
- if (this.mobileBreakpoint &&
313
- this.currentWidth &&
314
- this.currentWidth < this.mobileBreakpoint) {
315
- return 'short';
316
- }
317
- return 'long';
318
- }
319
- static get styles() {
286
+ >`;
287
+ }
288
+ /*
289
+ * TODO: fix field names to match model in src/collection-browser.ts
290
+ * private get dateSortSelector()
291
+ * @see src/models.ts
292
+ */
293
+ get date() {
294
+ var _a, _b, _c, _d, _e;
295
+ switch ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) {
296
+ case 'date':
297
+ return (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished;
298
+ case 'reviewdate':
299
+ return (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed;
300
+ case 'addeddate':
301
+ return (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded;
302
+ default:
303
+ return (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived; // publicdate
304
+ }
305
+ }
306
+ get classSize() {
307
+ if (this.mobileBreakpoint &&
308
+ this.currentWidth &&
309
+ this.currentWidth < this.mobileBreakpoint) {
310
+ return 'mobile';
311
+ }
312
+ return 'desktop';
313
+ }
314
+ get formatSize() {
315
+ if (this.mobileBreakpoint &&
316
+ this.currentWidth &&
317
+ this.currentWidth < this.mobileBreakpoint) {
318
+ return 'short';
319
+ }
320
+ return 'long';
321
+ }
322
+ static get styles() {
320
323
  return css `
321
324
  html {
322
325
  font-size: unset;
@@ -435,41 +438,41 @@ let TileList = class TileList extends LitElement {
435
438
  flex-direction: row;
436
439
  gap: 10px;
437
440
  }
438
- `;
439
- }
440
- };
441
- __decorate([
442
- property({ type: Object })
443
- ], TileList.prototype, "model", void 0);
444
- __decorate([
445
- property({ type: String })
446
- ], TileList.prototype, "baseNavigationUrl", void 0);
447
- __decorate([
448
- property({ type: Object })
449
- ], TileList.prototype, "collectionNameCache", void 0);
450
- __decorate([
451
- property({ type: Number })
452
- ], TileList.prototype, "currentWidth", void 0);
453
- __decorate([
454
- property({ type: Number })
455
- ], TileList.prototype, "currentHeight", void 0);
456
- __decorate([
457
- property({ type: Object })
458
- ], TileList.prototype, "sortParam", void 0);
459
- __decorate([
460
- property({ type: Number })
461
- ], TileList.prototype, "mobileBreakpoint", void 0);
462
- __decorate([
463
- state()
464
- ], TileList.prototype, "collectionLinks", void 0);
465
- __decorate([
466
- property({ type: String })
467
- ], TileList.prototype, "baseImageUrl", void 0);
468
- __decorate([
469
- property({ type: Boolean })
470
- ], TileList.prototype, "loggedIn", void 0);
471
- TileList = __decorate([
472
- customElement('tile-list')
473
- ], TileList);
474
- export { TileList };
441
+ `;
442
+ }
443
+ };
444
+ __decorate([
445
+ property({ type: Object })
446
+ ], TileList.prototype, "model", void 0);
447
+ __decorate([
448
+ property({ type: String })
449
+ ], TileList.prototype, "baseNavigationUrl", void 0);
450
+ __decorate([
451
+ property({ type: Object })
452
+ ], TileList.prototype, "collectionNameCache", void 0);
453
+ __decorate([
454
+ property({ type: Number })
455
+ ], TileList.prototype, "currentWidth", void 0);
456
+ __decorate([
457
+ property({ type: Number })
458
+ ], TileList.prototype, "currentHeight", void 0);
459
+ __decorate([
460
+ property({ type: Object })
461
+ ], TileList.prototype, "sortParam", void 0);
462
+ __decorate([
463
+ property({ type: Number })
464
+ ], TileList.prototype, "mobileBreakpoint", void 0);
465
+ __decorate([
466
+ state()
467
+ ], TileList.prototype, "collectionLinks", void 0);
468
+ __decorate([
469
+ property({ type: String })
470
+ ], TileList.prototype, "baseImageUrl", void 0);
471
+ __decorate([
472
+ property({ type: Boolean })
473
+ ], TileList.prototype, "loggedIn", void 0);
474
+ TileList = __decorate([
475
+ customElement('tile-list')
476
+ ], TileList);
477
+ export { TileList };
475
478
  //# sourceMappingURL=tile-list.js.map