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

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 (210) 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 -47
  12. package/dist/src/app-root.js +247 -247
  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 -246
  69. package/dist/src/collection-browser.js +1031 -1031
  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 +15 -15
  73. package/dist/src/collection-facets/facets-template.d.ts +16 -16
  74. package/dist/src/collection-facets/facets-template.js +125 -125
  75. package/dist/src/collection-facets/more-facets-content.d.ts +76 -76
  76. package/dist/src/collection-facets/more-facets-content.js +353 -353
  77. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  78. package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
  79. package/dist/src/collection-facets/more-facets-pagination.js +192 -192
  80. package/dist/src/collection-facets.d.ts +77 -77
  81. package/dist/src/collection-facets.js +389 -388
  82. package/dist/src/collection-facets.js.map +1 -1
  83. package/dist/src/empty-placeholder.d.ts +11 -11
  84. package/dist/src/empty-placeholder.js +42 -42
  85. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
  86. package/dist/src/language-code-handler/language-code-handler.js +26 -26
  87. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
  88. package/dist/src/language-code-handler/language-code-mapping.js +562 -562
  89. package/dist/src/mediatype/mediatype-config.d.ts +3 -3
  90. package/dist/src/mediatype/mediatype-config.js +85 -85
  91. package/dist/src/models.d.ts +103 -103
  92. package/dist/src/models.js +117 -117
  93. package/dist/src/restoration-state-handler.d.ts +46 -46
  94. package/dist/src/restoration-state-handler.js +230 -230
  95. package/dist/src/sort-filter-bar/alpha-bar.d.ts +9 -9
  96. package/dist/src/sort-filter-bar/alpha-bar.js +41 -41
  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 +107 -107
  106. package/dist/src/sort-filter-bar/sort-filter-bar.js +423 -423
  107. package/dist/src/styles/item-image-styles.d.ts +8 -8
  108. package/dist/src/styles/item-image-styles.js +9 -9
  109. package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
  110. package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
  111. package/dist/src/tiles/grid/account-tile.d.ts +8 -8
  112. package/dist/src/tiles/grid/account-tile.js +20 -20
  113. package/dist/src/tiles/grid/collection-tile.d.ts +7 -7
  114. package/dist/src/tiles/grid/collection-tile.js +23 -23
  115. package/dist/src/tiles/grid/item-tile.d.ts +24 -24
  116. package/dist/src/tiles/grid/item-tile.js +87 -87
  117. package/dist/src/tiles/grid/tile-stats.d.ts +10 -10
  118. package/dist/src/tiles/grid/tile-stats.js +40 -40
  119. package/dist/src/tiles/image-block.d.ts +17 -17
  120. package/dist/src/tiles/image-block.js +69 -69
  121. package/dist/src/tiles/item-image.d.ts +31 -31
  122. package/dist/src/tiles/item-image.js +103 -103
  123. package/dist/src/tiles/list/account-label.d.ts +1 -1
  124. package/dist/src/tiles/list/account-label.js +6 -6
  125. package/dist/src/tiles/list/date-label.d.ts +1 -1
  126. package/dist/src/tiles/list/date-label.js +12 -12
  127. package/dist/src/tiles/list/tile-list-compact-header.d.ts +12 -12
  128. package/dist/src/tiles/list/tile-list-compact-header.js +41 -41
  129. package/dist/src/tiles/list/tile-list-compact.d.ts +21 -21
  130. package/dist/src/tiles/list/tile-list-compact.js +93 -93
  131. package/dist/src/tiles/list/tile-list.d.ts +50 -50
  132. package/dist/src/tiles/list/tile-list.js +271 -271
  133. package/dist/src/tiles/mediatype-icon.d.ts +9 -9
  134. package/dist/src/tiles/mediatype-icon.js +47 -47
  135. package/dist/src/tiles/overlay/icon-overlay.d.ts +7 -7
  136. package/dist/src/tiles/overlay/icon-overlay.js +30 -30
  137. package/dist/src/tiles/overlay/text-overlay.d.ts +8 -8
  138. package/dist/src/tiles/overlay/text-overlay.js +31 -31
  139. package/dist/src/tiles/text-snippet-block.d.ts +29 -29
  140. package/dist/src/tiles/text-snippet-block.js +81 -81
  141. package/dist/src/tiles/tile-dispatcher.d.ts +36 -36
  142. package/dist/src/tiles/tile-dispatcher.js +128 -128
  143. package/dist/src/utils/analytics-events.d.ts +22 -22
  144. package/dist/src/utils/analytics-events.js +24 -24
  145. package/dist/src/utils/format-count.d.ts +7 -7
  146. package/dist/src/utils/format-count.js +76 -76
  147. package/dist/src/utils/format-date.d.ts +2 -2
  148. package/dist/src/utils/format-date.js +23 -23
  149. package/dist/test/collection-browser.test.d.ts +1 -1
  150. package/dist/test/collection-browser.test.js +444 -444
  151. package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
  152. package/dist/test/collection-facets/facets-template.test.js +62 -62
  153. package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
  154. package/dist/test/collection-facets/more-facets-content.test.js +114 -114
  155. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
  156. package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
  157. package/dist/test/collection-facets.test.d.ts +2 -2
  158. package/dist/test/collection-facets.test.js +498 -544
  159. package/dist/test/collection-facets.test.js.map +1 -1
  160. package/dist/test/empty-placeholder.test.d.ts +1 -1
  161. package/dist/test/empty-placeholder.test.js +33 -33
  162. package/dist/test/icon-overlay.test.d.ts +1 -1
  163. package/dist/test/icon-overlay.test.js +24 -24
  164. package/dist/test/image-block.test.d.ts +1 -1
  165. package/dist/test/image-block.test.js +48 -48
  166. package/dist/test/item-image.test.d.ts +1 -1
  167. package/dist/test/item-image.test.js +56 -56
  168. package/dist/test/mediatype-config.test.d.ts +1 -1
  169. package/dist/test/mediatype-config.test.js +16 -16
  170. package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
  171. package/dist/test/mocks/mock-analytics-handler.js +15 -15
  172. package/dist/test/mocks/mock-collection-name-cache.d.ts +7 -7
  173. package/dist/test/mocks/mock-collection-name-cache.js +13 -13
  174. package/dist/test/mocks/mock-search-responses.d.ts +8 -8
  175. package/dist/test/mocks/mock-search-responses.js +198 -198
  176. package/dist/test/mocks/mock-search-service.d.ts +13 -13
  177. package/dist/test/mocks/mock-search-service.js +32 -32
  178. package/dist/test/restoration-state-handler.test.d.ts +1 -1
  179. package/dist/test/restoration-state-handler.test.js +126 -126
  180. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
  181. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +113 -113
  182. package/dist/test/text-overlay.test.d.ts +1 -1
  183. package/dist/test/text-overlay.test.js +41 -41
  184. package/dist/test/text-snippet-block.test.d.ts +1 -1
  185. package/dist/test/text-snippet-block.test.js +57 -57
  186. package/dist/test/tile-stats.test.d.ts +1 -1
  187. package/dist/test/tile-stats.test.js +33 -33
  188. package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
  189. package/dist/test/tiles/grid/item-tile.test.js +107 -107
  190. package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
  191. package/dist/test/tiles/list/tile-list-compact.test.js +92 -92
  192. package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
  193. package/dist/test/tiles/list/tile-list.test.js +67 -67
  194. package/dist/test/utils/format-count.test.d.ts +1 -1
  195. package/dist/test/utils/format-count.test.js +23 -23
  196. package/dist/test/utils/format-date.test.d.ts +1 -1
  197. package/dist/test/utils/format-date.test.js +17 -17
  198. package/index.html +24 -24
  199. package/local.archive.org.cert +86 -86
  200. package/local.archive.org.key +27 -27
  201. package/package.json +1 -1
  202. package/renovate.json +6 -6
  203. package/src/app-root.ts +1 -1
  204. package/src/collection-browser.ts +9 -9
  205. package/src/collection-facets/more-facets-content.ts +3 -3
  206. package/src/collection-facets.ts +4 -3
  207. package/test/collection-facets.test.ts +0 -67
  208. package/tsconfig.json +21 -21
  209. package/web-dev-server.config.mjs +30 -30
  210. 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,207 +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, _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
- }
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
+ }
216
216
  return html `
217
217
  <div id="topics" class="metadata">
218
218
  ${this.labelTemplate('Topics')}
219
219
  ${join(map(this.model.subjects, id => this.searchLink('subject', id)), html `, `)}
220
220
  </div>
221
- `;
222
- }
223
- get collectionsTemplate() {
224
- if (!this.collectionLinks || this.collectionLinks.length === 0) {
225
- return nothing;
226
- }
221
+ `;
222
+ }
223
+ get collectionsTemplate() {
224
+ if (!this.collectionLinks || this.collectionLinks.length === 0) {
225
+ return nothing;
226
+ }
227
227
  return html `
228
228
  <div id="collections" class="metadata">
229
229
  ${this.labelTemplate('Collections')}
230
230
  ${join(this.collectionLinks, html `, `)}
231
231
  </div>
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;
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;
242
242
  return html `<text-snippet-block
243
243
  viewsize="list"
244
244
  .snippets=${(_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets}
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;
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;
256
256
  return html `
257
257
  <div id=${ifDefined(id)} class="metadata">
258
258
  ${this.labelTemplate(label)} ${text}
259
259
  </div>
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
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
275
275
  return html `<a href="${this.baseNavigationUrl}/search.php?query=${query}">
276
276
  ${DOMPurify.sanitize(searchTerm)}</a
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
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
283
283
  return html `<a
284
284
  href="${this.baseNavigationUrl}/details/${encodeURI(identifier)}"
285
285
  >${DOMPurify.sanitize(linkText)}</a
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() {
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() {
323
323
  return css `
324
324
  html {
325
325
  font-size: unset;
@@ -438,41 +438,41 @@ let TileList = class TileList extends LitElement {
438
438
  flex-direction: row;
439
439
  gap: 10px;
440
440
  }
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 };
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 };
478
478
  //# sourceMappingURL=tile-list.js.map
@@ -1,9 +1,9 @@
1
- import { CSSResultGroup, LitElement } from 'lit';
2
- export declare class MediatypeIcon extends LitElement {
3
- mediatype: string | undefined;
4
- collections: string[] | undefined;
5
- showText: boolean;
6
- private get displayMediatype();
7
- render(): import("lit-html").TemplateResult<1>;
8
- static get styles(): CSSResultGroup;
9
- }
1
+ import { CSSResultGroup, LitElement } from 'lit';
2
+ export declare class MediatypeIcon extends LitElement {
3
+ mediatype: string | undefined;
4
+ collections: string[] | undefined;
5
+ showText: boolean;
6
+ private get displayMediatype();
7
+ render(): import("lit-html").TemplateResult<1>;
8
+ static get styles(): CSSResultGroup;
9
+ }