@internetarchive/collection-browser 0.4.2 → 0.4.3-alpha.2

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