@internetarchive/collection-browser 0.4.3-alpha.9 → 0.4.4-alpha

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