@internetarchive/collection-browser 3.4.1-alpha-webdev7761.2 → 3.4.1-alpha-webdev7761.4

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 (208) hide show
  1. package/dist/src/app-root.js +19 -28
  2. package/dist/src/app-root.js.map +1 -1
  3. package/dist/src/collection-browser.d.ts +14 -10
  4. package/dist/src/collection-browser.js +870 -886
  5. package/dist/src/collection-browser.js.map +1 -1
  6. package/dist/src/collection-facets/facet-row.js +3 -4
  7. package/dist/src/collection-facets/facet-row.js.map +1 -1
  8. package/dist/src/collection-facets/models.js.map +1 -1
  9. package/dist/src/collection-facets/more-facets-content.js +145 -156
  10. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  11. package/dist/src/collection-facets/more-facets-pagination.js +6 -10
  12. package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
  13. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +16 -21
  14. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -1
  15. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +7 -10
  16. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  17. package/dist/src/collection-facets/smart-facets/smart-facet-button.js +3 -2
  18. package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -1
  19. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +9 -11
  20. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  21. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js +7 -7
  22. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -1
  23. package/dist/src/collection-facets/toggle-switch.js +4 -6
  24. package/dist/src/collection-facets/toggle-switch.js.map +1 -1
  25. package/dist/src/collection-facets.js +34 -50
  26. package/dist/src/collection-facets.js.map +1 -1
  27. package/dist/src/combo-box/caret-closed.js +5 -11
  28. package/dist/src/combo-box/caret-closed.js.map +1 -1
  29. package/dist/src/combo-box/caret-open.js +5 -11
  30. package/dist/src/combo-box/caret-open.js.map +1 -1
  31. package/dist/src/combo-box/clear.d.ts +2 -0
  32. package/dist/src/combo-box/clear.js +11 -0
  33. package/dist/src/combo-box/clear.js.map +1 -0
  34. package/dist/src/combo-box/ia-combo-box.d.ts +40 -9
  35. package/dist/src/combo-box/ia-combo-box.js +363 -272
  36. package/dist/src/combo-box/ia-combo-box.js.map +1 -1
  37. package/dist/src/combo-box/models.d.ts +14 -0
  38. package/dist/src/combo-box/models.js +32 -1
  39. package/dist/src/combo-box/models.js.map +1 -1
  40. package/dist/src/data-source/collection-browser-data-source.js +35 -47
  41. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  42. package/dist/src/empty-placeholder.js +19 -18
  43. package/dist/src/empty-placeholder.js.map +1 -1
  44. package/dist/src/expanded-date-picker.js +6 -10
  45. package/dist/src/expanded-date-picker.js.map +1 -1
  46. package/dist/src/language-code-handler/language-code-handler.js +2 -2
  47. package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
  48. package/dist/src/manage/manage-bar.js +86 -92
  49. package/dist/src/manage/manage-bar.js.map +1 -1
  50. package/dist/src/manage/remove-items-modal-content.js +2 -2
  51. package/dist/src/manage/remove-items-modal-content.js.map +1 -1
  52. package/dist/src/models.js +36 -40
  53. package/dist/src/models.js.map +1 -1
  54. package/dist/src/restoration-state-handler.js +9 -10
  55. package/dist/src/restoration-state-handler.js.map +1 -1
  56. package/dist/src/sort-filter-bar/alpha-bar.js +9 -14
  57. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  58. package/dist/src/sort-filter-bar/sort-filter-bar.js +14 -24
  59. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  60. package/dist/src/tiles/base-tile-component.js +1 -2
  61. package/dist/src/tiles/base-tile-component.js.map +1 -1
  62. package/dist/src/tiles/grid/account-tile.js +36 -38
  63. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  64. package/dist/src/tiles/grid/collection-tile.js +79 -82
  65. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  66. package/dist/src/tiles/grid/item-tile.js +154 -164
  67. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  68. package/dist/src/tiles/grid/search-tile.js +42 -43
  69. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  70. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
  71. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  72. package/dist/src/tiles/grid/tile-stats.js +2 -3
  73. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  74. package/dist/src/tiles/hover/hover-pane-controller.js +42 -49
  75. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  76. package/dist/src/tiles/hover/tile-hover-pane.js +113 -114
  77. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
  78. package/dist/src/tiles/image-block.js +5 -8
  79. package/dist/src/tiles/image-block.js.map +1 -1
  80. package/dist/src/tiles/item-image.js +12 -19
  81. package/dist/src/tiles/item-image.js.map +1 -1
  82. package/dist/src/tiles/list/tile-list-compact.js +114 -122
  83. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  84. package/dist/src/tiles/list/tile-list.js +326 -347
  85. package/dist/src/tiles/list/tile-list.js.map +1 -1
  86. package/dist/src/tiles/overlay/icon-overlay.js +1 -2
  87. package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
  88. package/dist/src/tiles/overlay/text-overlay.js +2 -4
  89. package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
  90. package/dist/src/tiles/text-snippet-block.js +2 -4
  91. package/dist/src/tiles/text-snippet-block.js.map +1 -1
  92. package/dist/src/tiles/tile-dispatcher.js +233 -241
  93. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  94. package/dist/src/tiles/tile-display-value-provider.js +5 -9
  95. package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
  96. package/dist/src/tiles/tile-mediatype-icon.js +12 -19
  97. package/dist/src/tiles/tile-mediatype-icon.js.map +1 -1
  98. package/dist/src/utils/collapse-repeated-quotes.js +1 -1
  99. package/dist/src/utils/collapse-repeated-quotes.js.map +1 -1
  100. package/dist/src/utils/facet-utils.js +3 -5
  101. package/dist/src/utils/facet-utils.js.map +1 -1
  102. package/dist/src/utils/format-count.js +10 -10
  103. package/dist/src/utils/format-count.js.map +1 -1
  104. package/dist/src/utils/format-date.js.map +1 -1
  105. package/dist/src/utils/resolve-mediatype.js +2 -3
  106. package/dist/src/utils/resolve-mediatype.js.map +1 -1
  107. package/dist/test/collection-browser.test.js +131 -185
  108. package/dist/test/collection-browser.test.js.map +1 -1
  109. package/dist/test/collection-facets/facet-row.test.js +60 -75
  110. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  111. package/dist/test/collection-facets/facets-template.test.js +17 -23
  112. package/dist/test/collection-facets/facets-template.test.js.map +1 -1
  113. package/dist/test/collection-facets/more-facets-content.test.js +22 -32
  114. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
  115. package/dist/test/collection-facets/more-facets-pagination.test.js +16 -22
  116. package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
  117. package/dist/test/collection-facets/toggle-switch.test.js +22 -19
  118. package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
  119. package/dist/test/collection-facets.test.js +80 -97
  120. package/dist/test/collection-facets.test.js.map +1 -1
  121. package/dist/test/empty-placeholder.test.js +11 -17
  122. package/dist/test/empty-placeholder.test.js.map +1 -1
  123. package/dist/test/expanded-date-picker.test.js +8 -14
  124. package/dist/test/expanded-date-picker.test.js.map +1 -1
  125. package/dist/test/icon-overlay.test.js +7 -6
  126. package/dist/test/icon-overlay.test.js.map +1 -1
  127. package/dist/test/image-block.test.js +16 -26
  128. package/dist/test/image-block.test.js.map +1 -1
  129. package/dist/test/item-image.test.js +23 -32
  130. package/dist/test/item-image.test.js.map +1 -1
  131. package/dist/test/manage/manage-bar.test.js +21 -33
  132. package/dist/test/manage/manage-bar.test.js.map +1 -1
  133. package/dist/test/manage/remove-items-modal-content.test.js +10 -15
  134. package/dist/test/manage/remove-items-modal-content.test.js.map +1 -1
  135. package/dist/test/mocks/mock-search-service.js +2 -3
  136. package/dist/test/mocks/mock-search-service.js.map +1 -1
  137. package/dist/test/restoration-state-handler.test.js +13 -21
  138. package/dist/test/restoration-state-handler.test.js.map +1 -1
  139. package/dist/test/review-block.test.js +16 -18
  140. package/dist/test/review-block.test.js.map +1 -1
  141. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +2 -3
  142. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -1
  143. package/dist/test/sort-filter-bar/alpha-bar.test.js +18 -24
  144. package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
  145. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +178 -180
  146. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  147. package/dist/test/text-overlay.test.js +16 -15
  148. package/dist/test/text-overlay.test.js.map +1 -1
  149. package/dist/test/text-snippet-block.test.js +14 -19
  150. package/dist/test/text-snippet-block.test.js.map +1 -1
  151. package/dist/test/tile-stats.test.js +73 -34
  152. package/dist/test/tile-stats.test.js.map +1 -1
  153. package/dist/test/tiles/grid/account-tile.test.js +25 -25
  154. package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
  155. package/dist/test/tiles/grid/collection-tile.test.js +13 -19
  156. package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
  157. package/dist/test/tiles/grid/item-tile.test.js +141 -168
  158. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  159. package/dist/test/tiles/grid/search-tile.test.js +9 -13
  160. package/dist/test/tiles/grid/search-tile.test.js.map +1 -1
  161. package/dist/test/tiles/hover/hover-pane-controller.test.js +50 -62
  162. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
  163. package/dist/test/tiles/hover/tile-hover-pane.test.js +12 -16
  164. package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
  165. package/dist/test/tiles/list/tile-list-compact.test.js +104 -118
  166. package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
  167. package/dist/test/tiles/list/tile-list.test.js +202 -231
  168. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  169. package/dist/test/tiles/tile-dispatcher.test.js +97 -110
  170. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
  171. package/dist/test/tiles/tile-mediatype-icon.test.js +12 -24
  172. package/dist/test/tiles/tile-mediatype-icon.test.js.map +1 -1
  173. package/dist/test/utils/format-date.test.js.map +1 -1
  174. package/index.html +1 -1
  175. package/package.json +5 -3
  176. package/src/collection-browser.ts +3060 -3030
  177. package/src/collection-facets/models.ts +10 -10
  178. package/src/collection-facets/more-facets-content.ts +639 -639
  179. package/src/collection-facets.ts +1 -1
  180. package/src/combo-box/caret-closed.ts +5 -11
  181. package/src/combo-box/caret-open.ts +5 -11
  182. package/src/combo-box/clear.ts +11 -0
  183. package/src/combo-box/ia-combo-box.ts +1288 -1180
  184. package/src/combo-box/models.ts +31 -1
  185. package/src/manage/manage-bar.ts +247 -247
  186. package/src/restoration-state-handler.ts +5 -1
  187. package/src/tiles/base-tile-component.ts +65 -65
  188. package/src/tiles/grid/account-tile.ts +113 -113
  189. package/src/tiles/grid/collection-tile.ts +163 -163
  190. package/src/tiles/grid/item-tile.ts +340 -340
  191. package/src/tiles/grid/search-tile.ts +90 -90
  192. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
  193. package/src/tiles/hover/hover-pane-controller.ts +613 -613
  194. package/src/tiles/hover/tile-hover-pane.ts +184 -184
  195. package/src/tiles/list/tile-list-compact.ts +239 -239
  196. package/src/tiles/list/tile-list.ts +700 -700
  197. package/src/tiles/tile-dispatcher.ts +517 -517
  198. package/src/utils/format-date.ts +62 -62
  199. package/test/collection-facets/facet-row.test.ts +375 -375
  200. package/test/collection-facets.test.ts +928 -928
  201. package/test/tiles/grid/item-tile.test.ts +520 -520
  202. package/test/tiles/hover/hover-pane-controller.test.ts +418 -418
  203. package/test/tiles/list/tile-list-compact.test.ts +282 -282
  204. package/test/tiles/list/tile-list.test.ts +552 -552
  205. package/test/tiles/tile-dispatcher.test.ts +283 -283
  206. package/test/utils/format-date.test.ts +89 -89
  207. package/tsconfig.json +8 -3
  208. package/vite.config.ts +29 -22
@@ -37,104 +37,101 @@ let TileList = class TileList extends BaseTileComponent {
37
37
  this.collectionLinks = [];
38
38
  }
39
39
  render() {
40
- return html `
41
- <div id="list-line" class="${this.classSize}">
40
+ return html `
41
+ <div id="list-line" class="${this.classSize}">
42
42
  ${this.classSize === 'mobile'
43
43
  ? this.mobileTemplate
44
- : this.desktopTemplate}
45
- </div>
44
+ : this.desktopTemplate}
45
+ </div>
46
46
  `;
47
47
  }
48
48
  /**
49
49
  * Templates
50
50
  */
51
51
  get mobileTemplate() {
52
- return html `
53
- <div id="list-line-top">
54
- <div id="list-line-left">${this.imageBlockTemplate}</div>
55
- <div id="list-line-right">
56
- <div id="title-line">
57
- <div id="title">${this.titleTemplate}</div>
58
- ${this.iconRightTemplate}
59
- </div>
60
- </div>
61
- </div>
62
- <div id="list-line-bottom">${this.detailsTemplate}</div>
52
+ return html `
53
+ <div id="list-line-top">
54
+ <div id="list-line-left">${this.imageBlockTemplate}</div>
55
+ <div id="list-line-right">
56
+ <div id="title-line">
57
+ <div id="title">${this.titleTemplate}</div>
58
+ ${this.iconRightTemplate}
59
+ </div>
60
+ </div>
61
+ </div>
62
+ <div id="list-line-bottom">${this.detailsTemplate}</div>
63
63
  `;
64
64
  }
65
65
  get desktopTemplate() {
66
- return html `
67
- <div id="list-line-left">${this.imageBlockTemplate}</div>
68
- <div id="list-line-right">
69
- <div id="title-line">
70
- <div id="title">${this.titleTemplate}</div>
71
- ${this.iconRightTemplate}
72
- </div>
73
- ${this.detailsTemplate}
74
- </div>
66
+ return html `
67
+ <div id="list-line-left">${this.imageBlockTemplate}</div>
68
+ <div id="list-line-right">
69
+ <div id="title-line">
70
+ <div id="title">${this.titleTemplate}</div>
71
+ ${this.iconRightTemplate}
72
+ </div>
73
+ ${this.detailsTemplate}
74
+ </div>
75
75
  `;
76
76
  }
77
77
  get imageBlockTemplate() {
78
- var _a;
79
78
  if (!this.model)
80
79
  return nothing;
81
80
  const isCollection = this.model.mediatype === 'collection';
82
81
  const href = this.displayValueProvider.itemPageUrl(this.model.identifier, isCollection);
83
- return html `<a
84
- id="image-link"
85
- title=${msg(str `View ${(_a = this.model) === null || _a === void 0 ? void 0 : _a.title}`)}
86
- href=${href}
87
- >
88
- <image-block
89
- .model=${this.model}
90
- .baseImageUrl=${this.baseImageUrl}
91
- .isCompactTile=${false}
92
- .isListTile=${true}
93
- .viewSize=${this.classSize}
94
- .loggedIn=${this.loggedIn}
95
- .suppressBlurring=${this.suppressBlurring}
96
- >
97
- </image-block>
82
+ return html `<a
83
+ id="image-link"
84
+ title=${msg(str `View ${this.model?.title}`)}
85
+ href=${href}
86
+ >
87
+ <image-block
88
+ .model=${this.model}
89
+ .baseImageUrl=${this.baseImageUrl}
90
+ .isCompactTile=${false}
91
+ .isListTile=${true}
92
+ .viewSize=${this.classSize}
93
+ .loggedIn=${this.loggedIn}
94
+ .suppressBlurring=${this.suppressBlurring}
95
+ >
96
+ </image-block>
98
97
  </a> `;
99
98
  }
100
99
  get detailsTemplate() {
101
- return html `
102
- ${this.itemLineTemplate} ${this.creatorTemplate}
103
- <div id="dates-line">
104
- ${this.datePublishedTemplate} ${this.dateSortByTemplate}
105
- ${this.webArchivesCaptureDatesTemplate}
106
- </div>
107
- <div id="views-line">
108
- ${this.viewsTemplate} ${this.ratingTemplate} ${this.reviewsTemplate}
109
- </div>
110
- ${this.topicsTemplate} ${this.collectionsTemplate}
111
- ${this.descriptionTemplate} ${this.textSnippetsTemplate}
112
- ${this.reviewBlockTemplate}
100
+ return html `
101
+ ${this.itemLineTemplate} ${this.creatorTemplate}
102
+ <div id="dates-line">
103
+ ${this.datePublishedTemplate} ${this.dateSortByTemplate}
104
+ ${this.webArchivesCaptureDatesTemplate}
105
+ </div>
106
+ <div id="views-line">
107
+ ${this.viewsTemplate} ${this.ratingTemplate} ${this.reviewsTemplate}
108
+ </div>
109
+ ${this.topicsTemplate} ${this.collectionsTemplate}
110
+ ${this.descriptionTemplate} ${this.textSnippetsTemplate}
111
+ ${this.reviewBlockTemplate}
113
112
  `;
114
113
  }
115
114
  // Data templates
116
115
  get iconRightTemplate() {
117
- var _a;
118
- return html `
119
- <a
120
- id="icon-right"
121
- href=${this.mediatypeURL}
122
- title=${msg(str `See more: ${(_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype}`)}
123
- >
124
- <tile-mediatype-icon .model=${this.model}> </tile-mediatype-icon>
125
- </a>
116
+ return html `
117
+ <a
118
+ id="icon-right"
119
+ href=${this.mediatypeURL}
120
+ title=${msg(str `See more: ${this.model?.mediatype}`)}
121
+ >
122
+ <tile-mediatype-icon .model=${this.model}> </tile-mediatype-icon>
123
+ </a>
126
124
  `;
127
125
  }
128
126
  get titleTemplate() {
129
- var _a, _b, _c;
130
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.title)) {
127
+ if (!this.model?.title) {
131
128
  return nothing;
132
129
  }
133
130
  // If the model has a server-specified href, use it
134
131
  // Otherwise construct a details link using the identifier
135
- return ((_b = this.model) === null || _b === void 0 ? void 0 : _b.href)
136
- ? html `<a href="${this.baseNavigationUrl}${this.model.href}"
137
- >${(_c = this.model.title) !== null && _c !== void 0 ? _c : this.model.identifier}</a
132
+ return this.model?.href
133
+ ? html `<a href="${this.baseNavigationUrl}${this.model.href}"
134
+ >${this.model.title ?? this.model.identifier}</a
138
135
  >`
139
136
  : this.detailsLink(this.model.identifier, this.model.title, this.model.mediatype === 'collection');
140
137
  }
@@ -148,54 +145,49 @@ let TileList = class TileList extends BaseTileComponent {
148
145
  return html ` <div id="item-line">${source} ${volume} ${issue}</div> `;
149
146
  }
150
147
  get sourceTemplate() {
151
- var _a;
152
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.source)) {
148
+ if (!this.model?.source) {
153
149
  return nothing;
154
150
  }
155
- return html `
156
- <div id="source" class="metadata">
157
- ${this.labelTemplate(msg('Source'))}
158
- ${this.searchLink('source', this.model.source)}
159
- </div>
151
+ return html `
152
+ <div id="source" class="metadata">
153
+ ${this.labelTemplate(msg('Source'))}
154
+ ${this.searchLink('source', this.model.source)}
155
+ </div>
160
156
  `;
161
157
  }
162
158
  get volumeTemplate() {
163
- var _a;
164
- return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.volume, msg('Volume'));
159
+ return this.metadataTemplate(this.model?.volume, msg('Volume'));
165
160
  }
166
161
  get issueTemplate() {
167
- var _a;
168
- return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.issue, msg('Issue'));
162
+ return this.metadataTemplate(this.model?.issue, msg('Issue'));
169
163
  }
170
164
  get creatorTemplate() {
171
- var _a, _b, _c;
172
165
  // "Archivist since" if account
173
- if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'account') {
174
- return html `
175
- <div id="creator" class="metadata">
176
- <span class="label"
177
- >${(_b = this.displayValueProvider.accountLabel) !== null && _b !== void 0 ? _b : nothing}</span
178
- >
179
- </div>
166
+ if (this.model?.mediatype === 'account') {
167
+ return html `
168
+ <div id="creator" class="metadata">
169
+ <span class="label"
170
+ >${this.displayValueProvider.accountLabel ?? nothing}</span
171
+ >
172
+ </div>
180
173
  `;
181
174
  }
182
175
  // "Creator" if not account tile
183
- if (!((_c = this.model) === null || _c === void 0 ? void 0 : _c.creators) || this.model.creators.length === 0) {
176
+ if (!this.model?.creators || this.model.creators.length === 0) {
184
177
  return nothing;
185
178
  }
186
- return html `
187
- <div id="creator" class="metadata">
188
- ${this.labelTemplate(msg('By'))}
189
- ${join(map(this.model.creators, id => this.searchLink('creator', id)), ', ')}
190
- </div>
179
+ return html `
180
+ <div id="creator" class="metadata">
181
+ ${this.labelTemplate(msg('By'))}
182
+ ${join(map(this.model.creators, id => this.searchLink('creator', id)), ', ')}
183
+ </div>
191
184
  `;
192
185
  }
193
186
  get datePublishedTemplate() {
194
- var _a;
195
187
  // If we're showing a date published of Jan 1 at midnight, only show the year.
196
188
  // This is because items with only a year for their publication date are normalized to
197
189
  // Jan 1 at midnight timestamps in the search engine documents.
198
- const date = (_a = this.model) === null || _a === void 0 ? void 0 : _a.datePublished;
190
+ const date = this.model?.datePublished;
199
191
  let format = 'long';
200
192
  if (isFirstMillisecondOfUTCYear(date)) {
201
193
  format = 'year-only';
@@ -214,93 +206,84 @@ let TileList = class TileList extends BaseTileComponent {
214
206
  return nothing;
215
207
  }
216
208
  get viewsTemplate() {
217
- var _a, _b, _c, _d;
218
- const viewCount = ((_a = this.effectiveSort) === null || _a === void 0 ? void 0 : _a.field) === 'week'
219
- ? (_b = this.model) === null || _b === void 0 ? void 0 : _b.weeklyViewCount // weekly views
220
- : (_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount; // all-time views
209
+ const viewCount = this.effectiveSort?.field === 'week'
210
+ ? this.model?.weeklyViewCount // weekly views
211
+ : this.model?.viewCount; // all-time views
221
212
  if (viewCount == null)
222
213
  return nothing;
223
214
  // when its a search-tile, we don't have any stats to show
224
- if (((_d = this.model) === null || _d === void 0 ? void 0 : _d.mediatype) === 'search') {
215
+ if (this.model?.mediatype === 'search') {
225
216
  return this.metadataTemplate('(Favorited search query)', '');
226
217
  }
227
218
  return this.metadataTemplate(`${formatCount(viewCount, this.formatSize)}`, msg('Views'));
228
219
  }
229
220
  get ratingTemplate() {
230
- var _a;
231
- return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.averageRating, msg('Avg Rating'));
221
+ return this.metadataTemplate(this.model?.averageRating, msg('Avg Rating'));
232
222
  }
233
223
  get reviewsTemplate() {
234
- var _a;
235
- return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.commentCount, msg('Reviews'));
224
+ return this.metadataTemplate(this.model?.commentCount, msg('Reviews'));
236
225
  }
237
226
  get topicsTemplate() {
238
- var _a;
239
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.subjects) || this.model.subjects.length === 0) {
227
+ if (!this.model?.subjects || this.model.subjects.length === 0) {
240
228
  return nothing;
241
229
  }
242
- return html `
243
- <div id="topics" class="metadata">
244
- ${this.labelTemplate(msg('Topics'))}
245
- ${join(map(this.model.subjects, id => this.searchLink('subject', id)), ', ')}
246
- </div>
230
+ return html `
231
+ <div id="topics" class="metadata">
232
+ ${this.labelTemplate(msg('Topics'))}
233
+ ${join(map(this.model.subjects, id => this.searchLink('subject', id)), ', ')}
234
+ </div>
247
235
  `;
248
236
  }
249
237
  get collectionsTemplate() {
250
238
  if (!this.collectionLinks || this.collectionLinks.length === 0) {
251
239
  return nothing;
252
240
  }
253
- return html `
254
- <div id="collections" class="metadata">
255
- ${this.labelTemplate(msg('Collections'))}
256
- ${join(this.collectionLinks, ', ')}
257
- </div>
241
+ return html `
242
+ <div id="collections" class="metadata">
243
+ ${this.labelTemplate(msg('Collections'))}
244
+ ${join(this.collectionLinks, ', ')}
245
+ </div>
258
246
  `;
259
247
  }
260
248
  get descriptionTemplate() {
261
- var _a, _b, _c;
262
249
  return this.metadataTemplate(
263
250
  // Sanitize away any HTML tags and convert line breaks to spaces.
264
- 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');
251
+ unsafeHTML(DOMPurify.sanitize(this.model?.description?.replace(/\n/g, ' ') ?? '')), '', 'description');
265
252
  }
266
253
  get reviewBlockTemplate() {
267
- var _a;
268
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.review))
254
+ if (!this.model?.review)
269
255
  return nothing;
270
256
  const { reviewtitle, reviewbody, stars } = this.model.review;
271
- return html `
272
- <review-block
273
- viewsize="list"
274
- title=${ifDefined(reviewtitle)}
275
- body=${ifDefined(reviewbody)}
276
- starRating=${ifDefined(stars)}
277
- >
278
- </review-block>
257
+ return html `
258
+ <review-block
259
+ viewsize="list"
260
+ title=${ifDefined(reviewtitle)}
261
+ body=${ifDefined(reviewbody)}
262
+ starRating=${ifDefined(stars)}
263
+ >
264
+ </review-block>
279
265
  `;
280
266
  }
281
267
  get textSnippetsTemplate() {
282
- var _a;
283
268
  if (!this.hasSnippets)
284
269
  return nothing;
285
- return html `<text-snippet-block
286
- viewsize="list"
287
- .snippets=${(_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets}
270
+ return html `<text-snippet-block
271
+ viewsize="list"
272
+ .snippets=${this.model?.snippets}
288
273
  ></text-snippet-block>`;
289
274
  }
290
275
  get hasSnippets() {
291
- var _a, _b;
292
- return !!((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets) === null || _b === void 0 ? void 0 : _b.length);
276
+ return !!this.model?.snippets?.length;
293
277
  }
294
278
  get webArchivesCaptureDatesTemplate() {
295
- var _a;
296
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.captureDates) || !this.model.title)
279
+ if (!this.model?.captureDates || !this.model.title)
297
280
  return nothing;
298
- return html `
299
- <ul class="capture-dates">
300
- ${map(this.model.captureDates, date => html `<li>
301
- ${this.displayValueProvider.webArchivesCaptureLink(this.model.title, date)}
302
- </li>`)}
303
- </ul>
281
+ return html `
282
+ <ul class="capture-dates">
283
+ ${map(this.model.captureDates, date => html `<li>
284
+ ${this.displayValueProvider.webArchivesCaptureLink(this.model.title, date)}
285
+ </li>`)}
286
+ </ul>
304
287
  `;
305
288
  }
306
289
  // Utility functions
@@ -308,10 +291,10 @@ let TileList = class TileList extends BaseTileComponent {
308
291
  metadataTemplate(text, label = '', id) {
309
292
  if (!text)
310
293
  return nothing;
311
- return html `
312
- <div id=${ifDefined(id)} class="metadata">
313
- ${this.labelTemplate(label)} ${text}
314
- </div>
294
+ return html `
295
+ <div id=${ifDefined(id)} class="metadata">
296
+ ${this.labelTemplate(label)} ${text}
297
+ </div>
315
298
  `;
316
299
  }
317
300
  labelTemplate(label) {
@@ -326,25 +309,24 @@ let TileList = class TileList extends BaseTileComponent {
326
309
  const query = encodeURIComponent(`${field}:"${searchTerm}"`);
327
310
  // No whitespace after closing tag
328
311
  // Note: single ' for href='' to wrap " in query var gets changed back by yarn format
329
- return html `<a
330
- href="${this.baseNavigationUrl}/search?query=${query}"
331
- rel="nofollow"
332
- >
333
- ${DOMPurify.sanitize(searchTerm)}</a
312
+ return html `<a
313
+ href="${this.baseNavigationUrl}/search?query=${query}"
314
+ rel="nofollow"
315
+ >
316
+ ${DOMPurify.sanitize(searchTerm)}</a
334
317
  >`;
335
318
  }
336
319
  detailsLink(identifier, text, isCollection = false) {
337
320
  if (!identifier)
338
321
  return nothing;
339
- const linkText = text !== null && text !== void 0 ? text : identifier;
322
+ const linkText = text ?? identifier;
340
323
  const linkHref = this.displayValueProvider.itemPageUrl(identifier, isCollection);
341
324
  return html `<a href=${linkHref}> ${DOMPurify.sanitize(linkText)} </a>`;
342
325
  }
343
326
  /** The URL of this item's mediatype collection, if defined. */
344
327
  get mediatypeURL() {
345
- var _a;
346
328
  // NB: baseNavigationUrl can be an empty string
347
- if (this.baseNavigationUrl === undefined || !((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype))
329
+ if (this.baseNavigationUrl === undefined || !this.model?.mediatype)
348
330
  return nothing;
349
331
  // Need special handling for certain mediatypes that don't have a top-level collection page
350
332
  switch (this.model.mediatype) {
@@ -362,8 +344,7 @@ let TileList = class TileList extends BaseTileComponent {
362
344
  }
363
345
  }
364
346
  async buildCollectionLinks() {
365
- var _a, _b, _c;
366
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) || this.model.collections.length === 0) {
347
+ if (!this.model?.collections || this.model.collections.length === 0) {
367
348
  return;
368
349
  }
369
350
  // Note: quirk of Lit: need to replace collectionLinks array,
@@ -374,7 +355,7 @@ let TileList = class TileList extends BaseTileComponent {
374
355
  // Don't include favorites or collections that are meant to be suppressed
375
356
  if (!suppressedCollections[collection] &&
376
357
  !collection.startsWith('fav-')) {
377
- newCollectionLinks.push(this.detailsLink(collection, (_c = (_b = this.collectionTitles) === null || _b === void 0 ? void 0 : _b.get(collection)) !== null && _c !== void 0 ? _c : collection, true));
358
+ newCollectionLinks.push(this.detailsLink(collection, this.collectionTitles?.get(collection) ?? collection, true));
378
359
  }
379
360
  }
380
361
  this.collectionLinks = newCollectionLinks;
@@ -385,24 +366,22 @@ let TileList = class TileList extends BaseTileComponent {
385
366
  * @see src/models.ts
386
367
  */
387
368
  get date() {
388
- var _a, _b, _c, _d, _e;
389
- switch ((_a = this.effectiveSort) === null || _a === void 0 ? void 0 : _a.field) {
369
+ switch (this.effectiveSort?.field) {
390
370
  case 'date':
391
- return (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished;
371
+ return this.model?.datePublished;
392
372
  case 'reviewdate':
393
- return (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed;
373
+ return this.model?.dateReviewed;
394
374
  case 'addeddate':
395
- return (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded;
375
+ return this.model?.dateAdded;
396
376
  default:
397
- return (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived; // publicdate
377
+ return this.model?.dateArchived; // publicdate
398
378
  }
399
379
  }
400
380
  /**
401
381
  * Returns the active sort param if one is set, or the default sort param otherwise.
402
382
  */
403
383
  get effectiveSort() {
404
- var _a;
405
- return (_a = this.sortParam) !== null && _a !== void 0 ? _a : this.defaultSortParam;
384
+ return this.sortParam ?? this.defaultSortParam;
406
385
  }
407
386
  get classSize() {
408
387
  if (this.mobileBreakpoint &&
@@ -421,190 +400,190 @@ let TileList = class TileList extends BaseTileComponent {
421
400
  return 'long';
422
401
  }
423
402
  static get styles() {
424
- return css `
425
- html {
426
- font-size: unset;
427
- }
428
-
429
- div {
430
- font-size: 14px;
431
- }
432
-
433
- div a {
434
- text-decoration: none;
435
- }
436
-
437
- div a:link {
438
- color: var(--ia-theme-link-color, #4b64ff);
439
- }
440
-
441
- .label {
442
- font-weight: bold;
443
- }
444
-
445
- #list-line.mobile {
446
- --infiniteScrollerRowGap: 20px;
447
- --infiniteScrollerRowHeight: auto;
448
- }
449
-
450
- #list-line.desktop {
451
- --infiniteScrollerRowGap: 30px;
452
- --infiniteScrollerRowHeight: auto;
453
- }
454
-
455
- /* fields */
456
- #icon-right {
457
- width: 20px;
458
- padding-top: 5px;
459
- --iconHeight: 20px;
460
- --iconWidth: 20px;
461
- --iconTextAlign: right;
462
- margin-top: -8px;
463
- text-align: right;
464
- }
465
-
466
- #title {
467
- color: #4b64ff;
468
- text-decoration: none;
469
- font-size: 22px;
470
- font-weight: bold;
471
- /* align top of text with image */
472
- line-height: 25px;
473
- margin-top: -4px;
474
- padding-bottom: 2px;
475
- flex-grow: 1;
476
-
477
- display: -webkit-box;
478
- -webkit-box-orient: vertical;
479
- -webkit-line-clamp: 3;
480
- overflow: hidden;
481
- overflow-wrap: anywhere;
482
- }
483
-
484
- .metadata {
485
- line-height: 20px;
486
- }
487
-
488
- #description,
489
- #creator,
490
- #topics,
491
- #source {
492
- text-align: left;
493
- overflow: hidden;
494
- text-overflow: ellipsis;
495
- -webkit-box-orient: vertical;
496
- display: -webkit-box;
497
- word-break: break-word;
498
- -webkit-line-clamp: 3; /* number of lines to show */
499
- line-clamp: 3;
500
-
501
- /*
502
- * Safari doesn't always respect the line-clamping rules above,
503
- * so we add this to ensure these fields still get truncated
504
- */
505
- max-height: 60px;
506
- }
507
-
508
- #collections {
509
- display: -webkit-box;
510
- -webkit-box-orient: vertical;
511
- -webkit-line-clamp: 3;
512
- overflow: hidden;
513
- overflow-wrap: anywhere;
514
- }
515
-
516
- #collections > a {
517
- display: inline-block;
518
- }
519
-
520
- #icon {
521
- padding-top: 5px;
522
- }
523
-
524
- #description {
525
- padding-top: 10px;
526
- }
527
-
528
- /* Top level container */
529
- #list-line {
530
- display: flex;
531
- }
532
-
533
- #list-line.mobile {
534
- flex-direction: column;
535
- }
536
-
537
- #list-line.desktop {
538
- column-gap: 10px;
539
- }
540
-
541
- #list-line-top {
542
- display: flex;
543
- column-gap: 7px;
544
- }
545
-
546
- #list-line-bottom {
547
- padding-top: 4px;
548
- }
549
-
550
- #list-line-right,
551
- #list-line-top,
552
- #list-line-bottom {
553
- width: 100%;
554
- }
555
-
556
- /*
557
- * If the container becomes very tiny, don't let the thumbnail side take
558
- * up too much space. Shouldn't make a difference on ordinary viewport sizes.
559
- */
560
- #list-line-left {
561
- max-width: 25%;
562
-
563
- display: flex;
564
- flex-direction: column;
565
- row-gap: 5px;
566
- }
567
-
568
- div a:hover {
569
- text-decoration: underline;
570
- }
571
-
572
- /* Lines containing multiple div as row */
573
- #item-line,
574
- #dates-line,
575
- #views-line,
576
- #title-line {
577
- display: flex;
578
- flex-direction: row;
579
- column-gap: 10px;
580
- }
581
-
582
- /*
583
- * With the exception of the title line, allow these to wrap if
584
- * the space becomes too small to accommodate them together.
585
- *
586
- * The title line is excluded because it contains the mediatype icon
587
- * which we don't want to wrap.
588
- */
589
- #item-line,
590
- #dates-line,
591
- #views-line {
592
- flex-wrap: wrap;
593
- }
594
-
595
- .capture-dates {
596
- margin: 0;
597
- padding: 0;
598
- list-style-type: none;
599
- }
600
-
601
- .capture-dates a:link {
602
- text-decoration: none;
603
- color: var(--ia-theme-link-color, #4b64ff);
604
- }
605
- .capture-dates a:hover {
606
- text-decoration: underline;
607
- }
403
+ return css `
404
+ html {
405
+ font-size: unset;
406
+ }
407
+
408
+ div {
409
+ font-size: 14px;
410
+ }
411
+
412
+ div a {
413
+ text-decoration: none;
414
+ }
415
+
416
+ div a:link {
417
+ color: var(--ia-theme-link-color, #4b64ff);
418
+ }
419
+
420
+ .label {
421
+ font-weight: bold;
422
+ }
423
+
424
+ #list-line.mobile {
425
+ --infiniteScrollerRowGap: 20px;
426
+ --infiniteScrollerRowHeight: auto;
427
+ }
428
+
429
+ #list-line.desktop {
430
+ --infiniteScrollerRowGap: 30px;
431
+ --infiniteScrollerRowHeight: auto;
432
+ }
433
+
434
+ /* fields */
435
+ #icon-right {
436
+ width: 20px;
437
+ padding-top: 5px;
438
+ --iconHeight: 20px;
439
+ --iconWidth: 20px;
440
+ --iconTextAlign: right;
441
+ margin-top: -8px;
442
+ text-align: right;
443
+ }
444
+
445
+ #title {
446
+ color: #4b64ff;
447
+ text-decoration: none;
448
+ font-size: 22px;
449
+ font-weight: bold;
450
+ /* align top of text with image */
451
+ line-height: 25px;
452
+ margin-top: -4px;
453
+ padding-bottom: 2px;
454
+ flex-grow: 1;
455
+
456
+ display: -webkit-box;
457
+ -webkit-box-orient: vertical;
458
+ -webkit-line-clamp: 3;
459
+ overflow: hidden;
460
+ overflow-wrap: anywhere;
461
+ }
462
+
463
+ .metadata {
464
+ line-height: 20px;
465
+ }
466
+
467
+ #description,
468
+ #creator,
469
+ #topics,
470
+ #source {
471
+ text-align: left;
472
+ overflow: hidden;
473
+ text-overflow: ellipsis;
474
+ -webkit-box-orient: vertical;
475
+ display: -webkit-box;
476
+ word-break: break-word;
477
+ -webkit-line-clamp: 3; /* number of lines to show */
478
+ line-clamp: 3;
479
+
480
+ /*
481
+ * Safari doesn't always respect the line-clamping rules above,
482
+ * so we add this to ensure these fields still get truncated
483
+ */
484
+ max-height: 60px;
485
+ }
486
+
487
+ #collections {
488
+ display: -webkit-box;
489
+ -webkit-box-orient: vertical;
490
+ -webkit-line-clamp: 3;
491
+ overflow: hidden;
492
+ overflow-wrap: anywhere;
493
+ }
494
+
495
+ #collections > a {
496
+ display: inline-block;
497
+ }
498
+
499
+ #icon {
500
+ padding-top: 5px;
501
+ }
502
+
503
+ #description {
504
+ padding-top: 10px;
505
+ }
506
+
507
+ /* Top level container */
508
+ #list-line {
509
+ display: flex;
510
+ }
511
+
512
+ #list-line.mobile {
513
+ flex-direction: column;
514
+ }
515
+
516
+ #list-line.desktop {
517
+ column-gap: 10px;
518
+ }
519
+
520
+ #list-line-top {
521
+ display: flex;
522
+ column-gap: 7px;
523
+ }
524
+
525
+ #list-line-bottom {
526
+ padding-top: 4px;
527
+ }
528
+
529
+ #list-line-right,
530
+ #list-line-top,
531
+ #list-line-bottom {
532
+ width: 100%;
533
+ }
534
+
535
+ /*
536
+ * If the container becomes very tiny, don't let the thumbnail side take
537
+ * up too much space. Shouldn't make a difference on ordinary viewport sizes.
538
+ */
539
+ #list-line-left {
540
+ max-width: 25%;
541
+
542
+ display: flex;
543
+ flex-direction: column;
544
+ row-gap: 5px;
545
+ }
546
+
547
+ div a:hover {
548
+ text-decoration: underline;
549
+ }
550
+
551
+ /* Lines containing multiple div as row */
552
+ #item-line,
553
+ #dates-line,
554
+ #views-line,
555
+ #title-line {
556
+ display: flex;
557
+ flex-direction: row;
558
+ column-gap: 10px;
559
+ }
560
+
561
+ /*
562
+ * With the exception of the title line, allow these to wrap if
563
+ * the space becomes too small to accommodate them together.
564
+ *
565
+ * The title line is excluded because it contains the mediatype icon
566
+ * which we don't want to wrap.
567
+ */
568
+ #item-line,
569
+ #dates-line,
570
+ #views-line {
571
+ flex-wrap: wrap;
572
+ }
573
+
574
+ .capture-dates {
575
+ margin: 0;
576
+ padding: 0;
577
+ list-style-type: none;
578
+ }
579
+
580
+ .capture-dates a:link {
581
+ text-decoration: none;
582
+ color: var(--ia-theme-link-color, #4b64ff);
583
+ }
584
+ .capture-dates a:hover {
585
+ text-decoration: underline;
586
+ }
608
587
  `;
609
588
  }
610
589
  };