@internetarchive/collection-browser 3.5.3 → 4.0.1-webdev-8162.0

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 (53) hide show
  1. package/.editorconfig +29 -29
  2. package/.github/workflows/ci.yml +27 -27
  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/.prettierignore +1 -1
  8. package/LICENSE +661 -661
  9. package/README.md +83 -83
  10. package/dist/src/app-root.d.ts +1 -0
  11. package/dist/src/app-root.js +627 -606
  12. package/dist/src/app-root.js.map +1 -1
  13. package/dist/src/collection-browser.js +764 -764
  14. package/dist/src/collection-browser.js.map +1 -1
  15. package/dist/src/collection-facets/more-facets-content.js +121 -121
  16. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  17. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  18. package/dist/src/models.js.map +1 -1
  19. package/dist/src/tiles/grid/collection-tile.d.ts +2 -0
  20. package/dist/src/tiles/grid/collection-tile.js +98 -77
  21. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  22. package/dist/src/tiles/grid/item-tile.d.ts +2 -2
  23. package/dist/src/tiles/grid/item-tile.js +150 -144
  24. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  25. package/dist/src/tiles/hover/hover-pane-controller.js +28 -28
  26. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  27. package/dist/src/tiles/models.d.ts +8 -1
  28. package/dist/src/tiles/models.js.map +1 -1
  29. package/dist/src/tiles/tile-dispatcher.d.ts +3 -3
  30. package/dist/src/tiles/tile-dispatcher.js +219 -218
  31. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  32. package/dist/test/collection-browser.test.js +1 -1
  33. package/dist/test/collection-browser.test.js.map +1 -1
  34. package/eslint.config.mjs +53 -53
  35. package/index.html +24 -24
  36. package/local.archive.org.cert +86 -86
  37. package/local.archive.org.key +27 -27
  38. package/package.json +121 -119
  39. package/renovate.json +6 -6
  40. package/src/app-root.ts +1166 -1140
  41. package/src/collection-browser.ts +3075 -3075
  42. package/src/collection-facets/more-facets-content.ts +644 -644
  43. package/src/data-source/collection-browser-query-state.ts +59 -59
  44. package/src/models.ts +873 -873
  45. package/src/tiles/grid/collection-tile.ts +184 -163
  46. package/src/tiles/grid/item-tile.ts +346 -340
  47. package/src/tiles/hover/hover-pane-controller.ts +627 -627
  48. package/src/tiles/models.ts +8 -1
  49. package/src/tiles/tile-dispatcher.ts +518 -517
  50. package/test/collection-browser.test.ts +1 -1
  51. package/tsconfig.json +25 -25
  52. package/web-dev-server.config.mjs +30 -30
  53. package/web-test-runner.config.mjs +52 -41
@@ -35,40 +35,41 @@ let ItemTile = class ItemTile extends BaseTileComponent {
35
35
  super(...arguments);
36
36
  this.showInfoButton = false;
37
37
  this.showTvClips = false;
38
- this.simpleLayoutType = 'none';
38
+ this.layoutType = 'default';
39
39
  }
40
40
  render() {
41
41
  const itemTitle = this.model?.title;
42
42
  const containerClasses = classMap({
43
43
  container: true,
44
- simple: this.simpleLayoutType !== 'none',
45
- 'stats-only': this.simpleLayoutType === 'stats-only',
46
- 'snippets-only': this.simpleLayoutType === 'snippets-only',
44
+ simple: this.layoutType !== 'default',
45
+ 'stats-only': this.layoutType === 'stats-only',
46
+ 'snippets-only': this.layoutType === 'snippets-only',
47
+ minimal: this.layoutType === 'minimal',
47
48
  });
48
- return html `
49
- <div class=${containerClasses}>
50
- ${this.infoButtonTemplate}
51
- <div class="tile-details">
52
- <div class="item-info">
53
- ${this.imageBlockTemplate}
54
-
55
- <div id="title">
56
- <h3 class="truncated" title=${ifDefined(itemTitle)}>
57
- ${itemTitle}
58
- </h3>
59
- </div>
60
-
61
- ${this.volumeIssueTemplate}
49
+ return html `
50
+ <div class=${containerClasses}>
51
+ ${this.infoButtonTemplate}
52
+ <div class="tile-details">
53
+ <div class="item-info">
54
+ ${this.imageBlockTemplate}
55
+
56
+ <div id="title">
57
+ <h3 class="truncated" title=${ifDefined(itemTitle)}>
58
+ ${itemTitle}
59
+ </h3>
60
+ </div>
61
+
62
+ ${this.volumeIssueTemplate}
62
63
  ${this.isSortedByDate
63
64
  ? this.sortedDateInfoTemplate
64
- : this.creatorTemplate}
65
- ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}
66
- ${this.reviewBlockTemplate}
67
- </div>
68
-
69
- ${this.tileStatsTemplate}
70
- </div>
71
- </div>
65
+ : this.creatorTemplate}
66
+ ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}
67
+ ${this.reviewBlockTemplate}
68
+ </div>
69
+
70
+ ${this.tileStatsTemplate}
71
+ </div>
72
+ </div>
72
73
  `;
73
74
  }
74
75
  /**
@@ -78,26 +79,26 @@ let ItemTile = class ItemTile extends BaseTileComponent {
78
79
  const displayedCreator = this.displayValueProvider.firstCreatorMatchingFilter;
79
80
  if (!displayedCreator)
80
81
  return nothing;
81
- return html `
82
- <div class="created-by">
83
- <span class="truncated" title=${displayedCreator}>
84
- by&nbsp;${displayedCreator}
85
- </span>
86
- </div>
82
+ return html `
83
+ <div class="created-by">
84
+ <span class="truncated" title=${displayedCreator}>
85
+ by&nbsp;${displayedCreator}
86
+ </span>
87
+ </div>
87
88
  `;
88
89
  }
89
90
  get imageBlockTemplate() {
90
- return html `
91
- <image-block
92
- .model=${this.model}
93
- .baseImageUrl=${this.baseImageUrl}
94
- .loggedIn=${this.loggedIn}
95
- .suppressBlurring=${this.suppressBlurring}
96
- .isCompactTile=${false}
97
- .isListTile=${false}
98
- .viewSize=${'grid'}
99
- >
100
- </image-block>
91
+ return html `
92
+ <image-block
93
+ .model=${this.model}
94
+ .baseImageUrl=${this.baseImageUrl}
95
+ .loggedIn=${this.loggedIn}
96
+ .suppressBlurring=${this.suppressBlurring}
97
+ .isCompactTile=${false}
98
+ .isListTile=${false}
99
+ .viewSize=${'grid'}
100
+ >
101
+ </image-block>
101
102
  `;
102
103
  }
103
104
  get sortedDateInfoTemplate() {
@@ -128,18 +129,18 @@ let ItemTile = class ItemTile extends BaseTileComponent {
128
129
  return nothing;
129
130
  }
130
131
  const formattedDate = this.getFormattedDate(sortedValue.value, format);
131
- return html `
132
- <div class="date-sorted-by truncated">
133
- <span>${sortedValue.field} ${formattedDate}</span>
134
- </div>
132
+ return html `
133
+ <div class="date-sorted-by truncated">
134
+ <span>${sortedValue.field} ${formattedDate}</span>
135
+ </div>
135
136
  `;
136
137
  }
137
138
  get infoButtonTemplate() {
138
139
  // &#9432; is an information icon
139
140
  return this.showInfoButton
140
- ? html `<button class="info-button" @click=${this.infoButtonPressed}>
141
- &#9432;
142
- <span class="sr-only">${msg('More info')}</span>
141
+ ? html `<button class="info-button" @click=${this.infoButtonPressed}>
142
+ &#9432;
143
+ <span class="sr-only">${msg('More info')}</span>
143
144
  </button>`
144
145
  : nothing;
145
146
  }
@@ -147,68 +148,72 @@ let ItemTile = class ItemTile extends BaseTileComponent {
147
148
  if (!this.model?.review)
148
149
  return nothing;
149
150
  const { reviewtitle, reviewbody, stars } = this.model.review;
150
- return html `
151
- <review-block
152
- viewsize="grid"
153
- title=${ifDefined(reviewtitle)}
154
- body=${ifDefined(reviewbody)}
155
- starRating=${ifDefined(stars)}
156
- >
157
- </review-block>
151
+ return html `
152
+ <review-block
153
+ viewsize="grid"
154
+ title=${ifDefined(reviewtitle)}
155
+ body=${ifDefined(reviewbody)}
156
+ starRating=${ifDefined(stars)}
157
+ >
158
+ </review-block>
158
159
  `;
159
160
  }
160
161
  get textSnippetsTemplate() {
161
- if (!this.hasSnippets || this.simpleLayoutType === 'stats-only')
162
+ if (!this.hasSnippets)
162
163
  return nothing;
163
- return html `
164
- <text-snippet-block viewsize="grid" .snippets=${this.model?.snippets}>
165
- </text-snippet-block>
164
+ if (['stats-only', 'minimal'].includes(this.layoutType)) {
165
+ return nothing;
166
+ }
167
+ return html `
168
+ <text-snippet-block viewsize="grid" .snippets=${this.model?.snippets}>
169
+ </text-snippet-block>
166
170
  `;
167
171
  }
168
172
  get volumeIssueTemplate() {
169
173
  if (!this.model?.volume || !this.model?.issue)
170
174
  return nothing;
171
- return html `
172
- <div class="volume-issue">
173
- <span class="truncated" title="volume|issue">
174
- Volume&nbsp;${this.model?.volume}, Issue&nbsp;${this.model?.issue}
175
- </span>
176
- </div>
175
+ return html `
176
+ <div class="volume-issue">
177
+ <span class="truncated" title="volume|issue">
178
+ Volume&nbsp;${this.model?.volume}, Issue&nbsp;${this.model?.issue}
179
+ </span>
180
+ </div>
177
181
  `;
178
182
  }
179
183
  get webArchivesCaptureDatesTemplate() {
180
184
  if (!this.model?.captureDates || !this.model.title)
181
185
  return nothing;
182
- return html `
183
- <ul class="capture-dates">
184
- ${map(this.model.captureDates, date => html `<li>
185
- ${this.displayValueProvider.webArchivesCaptureLink(this.model.title, date)}
186
- </li>`)}
187
- </ul>
186
+ return html `
187
+ <ul class="capture-dates">
188
+ ${map(this.model.captureDates, date => html `<li>
189
+ ${this.displayValueProvider.webArchivesCaptureLink(this.model.title, date)}
190
+ </li>`)}
191
+ </ul>
188
192
  `;
189
193
  }
190
194
  /**
191
195
  * Template for the stats row along the bottom of the tile.
192
196
  */
193
197
  get tileStatsTemplate() {
194
- if (this.simpleLayoutType === 'snippets-only')
198
+ if (['snippets-only', 'minimal'].includes(this.layoutType)) {
195
199
  return nothing;
200
+ }
196
201
  const effectiveSort = this.sortParam ?? this.defaultSortParam;
197
202
  const [viewCount, viewLabel] = effectiveSort?.field === 'week'
198
203
  ? [this.model?.weeklyViewCount, 'weekly views']
199
204
  : [this.model?.viewCount, 'all-time views'];
200
- return html `
201
- <tile-stats
202
- .model=${this.model}
203
- .mediatype=${this.model?.mediatype}
204
- .viewCount=${viewCount}
205
- .viewLabel=${viewLabel}
206
- .favCount=${this.model?.favCount}
207
- .commentCount=${this.model?.commentCount}
208
- .tvClipCount=${this.model?.tvClipCount}
209
- .showTvClips=${this.showTvClips}
210
- >
211
- </tile-stats>
205
+ return html `
206
+ <tile-stats
207
+ .model=${this.model}
208
+ .mediatype=${this.model?.mediatype}
209
+ .viewCount=${viewCount}
210
+ .viewLabel=${viewLabel}
211
+ .favCount=${this.model?.favCount}
212
+ .commentCount=${this.model?.commentCount}
213
+ .tvClipCount=${this.model?.tvClipCount}
214
+ .showTvClips=${this.showTvClips}
215
+ >
216
+ </tile-stats>
212
217
  `;
213
218
  }
214
219
  get isSortedByDate() {
@@ -235,62 +240,63 @@ let ItemTile = class ItemTile extends BaseTileComponent {
235
240
  const tileBorderColor = css `var(--tileBorderColor, #dddddd)`;
236
241
  return [
237
242
  baseTileStyles,
238
- css `
239
- a:link {
240
- text-decoration: none;
241
- color: var(--ia-theme-link-color, #4b64ff);
242
- }
243
- a:hover {
244
- text-decoration: underline;
245
- }
246
-
247
- .container {
248
- border: 1px solid ${tileBorderColor};
249
- }
250
-
251
- .simple #title > .truncated {
252
- -webkit-line-clamp: 2;
253
- }
254
-
255
- .simple .created-by > .truncated,
256
- .simple .date-sorted-by > .truncated,
257
- .simple .volume-issue > .truncated {
258
- -webkit-line-clamp: 1;
259
- }
260
-
261
- .simple.snippets-only .item-info {
262
- padding-bottom: 5px;
263
- }
264
-
265
- .simple.snippets-only text-snippet-block {
266
- margin-top: auto; /* Force the snippets to the bottom of the tile */
267
- }
268
-
269
- .capture-dates {
270
- margin: 0;
271
- padding: 0 5px;
272
- list-style-type: none;
273
- }
274
-
275
- review-block,
276
- text-snippet-block {
277
- --containerLeftMargin: 5px;
278
- --containerTopMargin: 5px;
279
- }
280
-
281
- /**
282
- * iOS Safari long-press on tiles (to bring up hover pane)
283
- * gets messy without this
284
- */
285
- @media screen and (pointer: coarse) and (hover: none) {
286
- .container {
287
- -webkit-touch-callout: none;
288
- }
289
-
290
- .truncated {
291
- -webkit-touch-callout: default;
292
- }
293
- }
243
+ css `
244
+ a:link {
245
+ text-decoration: none;
246
+ color: var(--ia-theme-link-color, #4b64ff);
247
+ }
248
+ a:hover {
249
+ text-decoration: underline;
250
+ }
251
+
252
+ .container {
253
+ border: 1px solid ${tileBorderColor};
254
+ }
255
+
256
+ .simple #title > .truncated {
257
+ -webkit-line-clamp: 2;
258
+ }
259
+
260
+ .simple .created-by > .truncated,
261
+ .simple .date-sorted-by > .truncated,
262
+ .simple .volume-issue > .truncated {
263
+ -webkit-line-clamp: 1;
264
+ }
265
+
266
+ .simple.snippets-only .item-info,
267
+ .simple.minimal .item-info {
268
+ padding-bottom: 5px;
269
+ }
270
+
271
+ .simple.snippets-only text-snippet-block {
272
+ margin-top: auto; /* Force the snippets to the bottom of the tile */
273
+ }
274
+
275
+ .capture-dates {
276
+ margin: 0;
277
+ padding: 0 5px;
278
+ list-style-type: none;
279
+ }
280
+
281
+ review-block,
282
+ text-snippet-block {
283
+ --containerLeftMargin: 5px;
284
+ --containerTopMargin: 5px;
285
+ }
286
+
287
+ /**
288
+ * iOS Safari long-press on tiles (to bring up hover pane)
289
+ * gets messy without this
290
+ */
291
+ @media screen and (pointer: coarse) and (hover: none) {
292
+ .container {
293
+ -webkit-touch-callout: none;
294
+ }
295
+
296
+ .truncated {
297
+ -webkit-touch-callout: default;
298
+ }
299
+ }
294
300
  `,
295
301
  ];
296
302
  }
@@ -303,7 +309,7 @@ __decorate([
303
309
  ], ItemTile.prototype, "showTvClips", void 0);
304
310
  __decorate([
305
311
  property({ type: String })
306
- ], ItemTile.prototype, "simpleLayoutType", void 0);
312
+ ], ItemTile.prototype, "layoutType", void 0);
307
313
  ItemTile = __decorate([
308
314
  customElement('item-tile')
309
315
  ], ItemTile);
@@ -1 +1 @@
1
- {"version":3,"file":"item-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/item-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,O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AC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAA6C;AAtB7D,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA6TpB","sourcesContent":["import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';\r\nimport { customElement, property } from 'lit/decorators.js';\r\nimport { ifDefined } from 'lit/directives/if-defined.js';\r\nimport { map } from 'lit/directives/map.js';\r\nimport { classMap } from 'lit/directives/class-map.js';\r\nimport { msg } from '@lit/localize';\r\n\r\nimport type { SortParam } from '@internetarchive/search-service';\r\nimport type { DateFormat } from '../../utils/format-date';\r\nimport { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';\r\nimport { BaseTileComponent } from '../base-tile-component';\r\nimport { baseTileStyles } from './styles/tile-grid-shared-styles';\r\nimport { SimpleLayoutType } from '../models';\r\n\r\nimport '../image-block';\r\nimport '../review-block';\r\nimport '../text-snippet-block';\r\nimport '../item-image';\r\nimport '../tile-mediatype-icon';\r\nimport './tile-stats';\r\n\r\n@customElement('item-tile')\r\nexport class ItemTile extends BaseTileComponent {\r\n /*\r\n * Reactive properties inherited from BaseTileComponent:\r\n * - model?: TileModel;\r\n * - currentWidth?: number;\r\n * - currentHeight?: number;\r\n * - baseNavigationUrl?: string;\r\n * - baseImageUrl?: string;\r\n * - collectionPagePath?: string;\r\n * - sortParam: SortParam | null = null;\r\n * - defaultSortParam: SortParam | null = null;\r\n * - creatorFilter?: string;\r\n * - mobileBreakpoint?: number;\r\n * - loggedIn = false;\r\n * - suppressBlurring = false;\r\n * - useLocalTime = false;\r\n */\r\n\r\n @property({ type: Boolean }) showInfoButton = false;\r\n\r\n @property({ type: Boolean }) showTvClips = false;\r\n\r\n @property({ type: String }) simpleLayoutType: SimpleLayoutType = 'none';\r\n\r\n render() {\r\n const itemTitle = this.model?.title;\r\n const containerClasses = classMap({\r\n container: true,\r\n simple: this.simpleLayoutType !== 'none',\r\n 'stats-only': this.simpleLayoutType === 'stats-only',\r\n 'snippets-only': this.simpleLayoutType === 'snippets-only',\r\n });\r\n\r\n return html`\r\n <div class=${containerClasses}>\r\n ${this.infoButtonTemplate}\r\n <div class=\"tile-details\">\r\n <div class=\"item-info\">\r\n ${this.imageBlockTemplate}\r\n\r\n <div id=\"title\">\r\n <h3 class=\"truncated\" title=${ifDefined(itemTitle)}>\r\n ${itemTitle}\r\n </h3>\r\n </div>\r\n\r\n ${this.volumeIssueTemplate}\r\n ${this.isSortedByDate\r\n ? this.sortedDateInfoTemplate\r\n : this.creatorTemplate}\r\n ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}\r\n ${this.reviewBlockTemplate}\r\n </div>\r\n\r\n ${this.tileStatsTemplate}\r\n </div>\r\n </div>\r\n `;\r\n }\r\n\r\n /**\r\n * Templates\r\n */\r\n private get creatorTemplate(): TemplateResult | typeof nothing {\r\n const displayedCreator =\r\n this.displayValueProvider.firstCreatorMatchingFilter;\r\n if (!displayedCreator) return nothing;\r\n\r\n return html`\r\n <div class=\"created-by\">\r\n <span class=\"truncated\" title=${displayedCreator}>\r\n by&nbsp;${displayedCreator}\r\n </span>\r\n </div>\r\n `;\r\n }\r\n\r\n private get imageBlockTemplate(): TemplateResult {\r\n return html`\r\n <image-block\r\n .model=${this.model}\r\n .baseImageUrl=${this.baseImageUrl}\r\n .loggedIn=${this.loggedIn}\r\n .suppressBlurring=${this.suppressBlurring}\r\n .isCompactTile=${false}\r\n .isListTile=${false}\r\n .viewSize=${'grid'}\r\n >\r\n </image-block>\r\n `;\r\n }\r\n\r\n private get sortedDateInfoTemplate() {\r\n let sortedValue;\r\n let format: DateFormat = 'long';\r\n switch (this.effectiveSort?.field) {\r\n case 'date': {\r\n const datePublished = this.model?.datePublished;\r\n sortedValue = { field: 'published', value: datePublished };\r\n if (isFirstMillisecondOfUTCYear(datePublished)) {\r\n format = 'year-only';\r\n }\r\n break;\r\n }\r\n case 'reviewdate':\r\n sortedValue = { field: 'reviewed', value: this.model?.dateReviewed };\r\n break;\r\n case 'addeddate':\r\n sortedValue = { field: 'added', value: this.model?.dateAdded };\r\n break;\r\n case 'publicdate':\r\n sortedValue = { field: 'archived', value: this.model?.dateArchived };\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n if (!sortedValue?.value) {\r\n return nothing;\r\n }\r\n\r\n const formattedDate = this.getFormattedDate(sortedValue.value, format);\r\n return html`\r\n <div class=\"date-sorted-by truncated\">\r\n <span>${sortedValue.field} ${formattedDate}</span>\r\n </div>\r\n `;\r\n }\r\n\r\n private get infoButtonTemplate(): TemplateResult | typeof nothing {\r\n // &#9432; is an information icon\r\n return this.showInfoButton\r\n ? html`<button class=\"info-button\" @click=${this.infoButtonPressed}>\r\n &#9432;\r\n <span class=\"sr-only\">${msg('More info')}</span>\r\n </button>`\r\n : nothing;\r\n }\r\n\r\n private get reviewBlockTemplate(): TemplateResult | typeof nothing {\r\n if (!this.model?.review) return nothing;\r\n\r\n const { reviewtitle, reviewbody, stars } = this.model.review;\r\n return html`\r\n <review-block\r\n viewsize=\"grid\"\r\n title=${ifDefined(reviewtitle)}\r\n body=${ifDefined(reviewbody)}\r\n starRating=${ifDefined(stars)}\r\n >\r\n </review-block>\r\n `;\r\n }\r\n\r\n private get textSnippetsTemplate(): TemplateResult | typeof nothing {\r\n if (!this.hasSnippets || this.simpleLayoutType === 'stats-only')\r\n return nothing;\r\n\r\n return html`\r\n <text-snippet-block viewsize=\"grid\" .snippets=${this.model?.snippets}>\r\n </text-snippet-block>\r\n `;\r\n }\r\n\r\n private get volumeIssueTemplate(): TemplateResult | typeof nothing {\r\n if (!this.model?.volume || !this.model?.issue) return nothing;\r\n\r\n return html`\r\n <div class=\"volume-issue\">\r\n <span class=\"truncated\" title=\"volume|issue\">\r\n Volume&nbsp;${this.model?.volume}, Issue&nbsp;${this.model?.issue}\r\n </span>\r\n </div>\r\n `;\r\n }\r\n\r\n private get webArchivesCaptureDatesTemplate():\r\n | TemplateResult\r\n | typeof nothing {\r\n if (!this.model?.captureDates || !this.model.title) return nothing;\r\n\r\n return html`\r\n <ul class=\"capture-dates\">\r\n ${map(\r\n this.model.captureDates,\r\n date =>\r\n html`<li>\r\n ${this.displayValueProvider.webArchivesCaptureLink(\r\n this.model!.title,\r\n date,\r\n )}\r\n </li>`,\r\n )}\r\n </ul>\r\n `;\r\n }\r\n\r\n /**\r\n * Template for the stats row along the bottom of the tile.\r\n */\r\n private get tileStatsTemplate(): TemplateResult | typeof nothing {\r\n if (this.simpleLayoutType === 'snippets-only') return nothing;\r\n\r\n const effectiveSort = this.sortParam ?? this.defaultSortParam;\r\n const [viewCount, viewLabel] =\r\n effectiveSort?.field === 'week'\r\n ? [this.model?.weeklyViewCount, 'weekly views']\r\n : [this.model?.viewCount, 'all-time views'];\r\n\r\n return html`\r\n <tile-stats\r\n .model=${this.model}\r\n .mediatype=${this.model?.mediatype}\r\n .viewCount=${viewCount}\r\n .viewLabel=${viewLabel}\r\n .favCount=${this.model?.favCount}\r\n .commentCount=${this.model?.commentCount}\r\n .tvClipCount=${this.model?.tvClipCount}\r\n .showTvClips=${this.showTvClips}\r\n >\r\n </tile-stats>\r\n `;\r\n }\r\n\r\n private get isSortedByDate(): boolean {\r\n return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(\r\n this.effectiveSort?.field as string,\r\n );\r\n }\r\n\r\n /**\r\n * Returns the active sort param if one is set, or the default sort param otherwise.\r\n */\r\n private get effectiveSort(): SortParam | null {\r\n return this.sortParam ?? this.defaultSortParam;\r\n }\r\n\r\n private get hasSnippets(): boolean {\r\n return !!this.model?.snippets?.length;\r\n }\r\n\r\n private infoButtonPressed(e: PointerEvent): void {\r\n e.preventDefault();\r\n const event = new CustomEvent<{ x: number; y: number }>(\r\n 'infoButtonPressed',\r\n { detail: { x: e.clientX, y: e.clientY } },\r\n );\r\n this.dispatchEvent(event);\r\n }\r\n\r\n /**\r\n * CSS\r\n */\r\n static get styles(): CSSResultGroup {\r\n const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;\r\n\r\n return [\r\n baseTileStyles,\r\n css`\r\n a:link {\r\n text-decoration: none;\r\n color: var(--ia-theme-link-color, #4b64ff);\r\n }\r\n a:hover {\r\n text-decoration: underline;\r\n }\r\n\r\n .container {\r\n border: 1px solid ${tileBorderColor};\r\n }\r\n\r\n .simple #title > .truncated {\r\n -webkit-line-clamp: 2;\r\n }\r\n\r\n .simple .created-by > .truncated,\r\n .simple .date-sorted-by > .truncated,\r\n .simple .volume-issue > .truncated {\r\n -webkit-line-clamp: 1;\r\n }\r\n\r\n .simple.snippets-only .item-info {\r\n padding-bottom: 5px;\r\n }\r\n\r\n .simple.snippets-only text-snippet-block {\r\n margin-top: auto; /* Force the snippets to the bottom of the tile */\r\n }\r\n\r\n .capture-dates {\r\n margin: 0;\r\n padding: 0 5px;\r\n list-style-type: none;\r\n }\r\n\r\n review-block,\r\n text-snippet-block {\r\n --containerLeftMargin: 5px;\r\n --containerTopMargin: 5px;\r\n }\r\n\r\n /**\r\n * iOS Safari long-press on tiles (to bring up hover pane)\r\n * gets messy without this\r\n */\r\n @media screen and (pointer: coarse) and (hover: none) {\r\n .container {\r\n -webkit-touch-callout: none;\r\n }\r\n\r\n .truncated {\r\n -webkit-touch-callout: default;\r\n }\r\n }\r\n `,\r\n ];\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"item-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/item-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIpC,OAAO,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I,EAAE,MAAM,EAAE,CAAC;4CAAoC;AAtBpD,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAmUpB","sourcesContent":["import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { map } from 'lit/directives/map.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { msg } from '@lit/localize';\n\nimport type { SortParam } from '@internetarchive/search-service';\nimport type { DateFormat } from '../../utils/format-date';\nimport { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';\nimport { BaseTileComponent } from '../base-tile-component';\nimport { baseTileStyles } from './styles/tile-grid-shared-styles';\nimport { LayoutType } from '../models';\n\nimport '../image-block';\nimport '../review-block';\nimport '../text-snippet-block';\nimport '../item-image';\nimport '../tile-mediatype-icon';\nimport './tile-stats';\n\n@customElement('item-tile')\nexport class ItemTile extends BaseTileComponent {\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - defaultSortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n * - suppressBlurring = false;\n * - useLocalTime = false;\n */\n\n @property({ type: Boolean }) showInfoButton = false;\n\n @property({ type: Boolean }) showTvClips = false;\n\n @property({ type: String }) layoutType: LayoutType = 'default';\n\n render() {\n const itemTitle = this.model?.title;\n const containerClasses = classMap({\n container: true,\n simple: this.layoutType !== 'default',\n 'stats-only': this.layoutType === 'stats-only',\n 'snippets-only': this.layoutType === 'snippets-only',\n minimal: this.layoutType === 'minimal',\n });\n\n return html`\n <div class=${containerClasses}>\n ${this.infoButtonTemplate}\n <div class=\"tile-details\">\n <div class=\"item-info\">\n ${this.imageBlockTemplate}\n\n <div id=\"title\">\n <h3 class=\"truncated\" title=${ifDefined(itemTitle)}>\n ${itemTitle}\n </h3>\n </div>\n\n ${this.volumeIssueTemplate}\n ${this.isSortedByDate\n ? this.sortedDateInfoTemplate\n : this.creatorTemplate}\n ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}\n ${this.reviewBlockTemplate}\n </div>\n\n ${this.tileStatsTemplate}\n </div>\n </div>\n `;\n }\n\n /**\n * Templates\n */\n private get creatorTemplate(): TemplateResult | typeof nothing {\n const displayedCreator =\n this.displayValueProvider.firstCreatorMatchingFilter;\n if (!displayedCreator) return nothing;\n\n return html`\n <div class=\"created-by\">\n <span class=\"truncated\" title=${displayedCreator}>\n by&nbsp;${displayedCreator}\n </span>\n </div>\n `;\n }\n\n private get imageBlockTemplate(): TemplateResult {\n return html`\n <image-block\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .isCompactTile=${false}\n .isListTile=${false}\n .viewSize=${'grid'}\n >\n </image-block>\n `;\n }\n\n private get sortedDateInfoTemplate() {\n let sortedValue;\n let format: DateFormat = 'long';\n switch (this.effectiveSort?.field) {\n case 'date': {\n const datePublished = this.model?.datePublished;\n sortedValue = { field: 'published', value: datePublished };\n if (isFirstMillisecondOfUTCYear(datePublished)) {\n format = 'year-only';\n }\n break;\n }\n case 'reviewdate':\n sortedValue = { field: 'reviewed', value: this.model?.dateReviewed };\n break;\n case 'addeddate':\n sortedValue = { field: 'added', value: this.model?.dateAdded };\n break;\n case 'publicdate':\n sortedValue = { field: 'archived', value: this.model?.dateArchived };\n break;\n default:\n break;\n }\n\n if (!sortedValue?.value) {\n return nothing;\n }\n\n const formattedDate = this.getFormattedDate(sortedValue.value, format);\n return html`\n <div class=\"date-sorted-by truncated\">\n <span>${sortedValue.field} ${formattedDate}</span>\n </div>\n `;\n }\n\n private get infoButtonTemplate(): TemplateResult | typeof nothing {\n // &#9432; is an information icon\n return this.showInfoButton\n ? html`<button class=\"info-button\" @click=${this.infoButtonPressed}>\n &#9432;\n <span class=\"sr-only\">${msg('More info')}</span>\n </button>`\n : nothing;\n }\n\n private get reviewBlockTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.review) return nothing;\n\n const { reviewtitle, reviewbody, stars } = this.model.review;\n return html`\n <review-block\n viewsize=\"grid\"\n title=${ifDefined(reviewtitle)}\n body=${ifDefined(reviewbody)}\n starRating=${ifDefined(stars)}\n >\n </review-block>\n `;\n }\n\n private get textSnippetsTemplate(): TemplateResult | typeof nothing {\n if (!this.hasSnippets) return nothing;\n if (['stats-only', 'minimal'].includes(this.layoutType)) {\n return nothing;\n }\n\n return html`\n <text-snippet-block viewsize=\"grid\" .snippets=${this.model?.snippets}>\n </text-snippet-block>\n `;\n }\n\n private get volumeIssueTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.volume || !this.model?.issue) return nothing;\n\n return html`\n <div class=\"volume-issue\">\n <span class=\"truncated\" title=\"volume|issue\">\n Volume&nbsp;${this.model?.volume}, Issue&nbsp;${this.model?.issue}\n </span>\n </div>\n `;\n }\n\n private get webArchivesCaptureDatesTemplate():\n | TemplateResult\n | typeof nothing {\n if (!this.model?.captureDates || !this.model.title) return nothing;\n\n return html`\n <ul class=\"capture-dates\">\n ${map(\n this.model.captureDates,\n date =>\n html`<li>\n ${this.displayValueProvider.webArchivesCaptureLink(\n this.model!.title,\n date,\n )}\n </li>`,\n )}\n </ul>\n `;\n }\n\n /**\n * Template for the stats row along the bottom of the tile.\n */\n private get tileStatsTemplate(): TemplateResult | typeof nothing {\n if (['snippets-only', 'minimal'].includes(this.layoutType)) {\n return nothing;\n }\n\n const effectiveSort = this.sortParam ?? this.defaultSortParam;\n const [viewCount, viewLabel] =\n effectiveSort?.field === 'week'\n ? [this.model?.weeklyViewCount, 'weekly views']\n : [this.model?.viewCount, 'all-time views'];\n\n return html`\n <tile-stats\n .model=${this.model}\n .mediatype=${this.model?.mediatype}\n .viewCount=${viewCount}\n .viewLabel=${viewLabel}\n .favCount=${this.model?.favCount}\n .commentCount=${this.model?.commentCount}\n .tvClipCount=${this.model?.tvClipCount}\n .showTvClips=${this.showTvClips}\n >\n </tile-stats>\n `;\n }\n\n private get isSortedByDate(): boolean {\n return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(\n this.effectiveSort?.field as string,\n );\n }\n\n /**\n * Returns the active sort param if one is set, or the default sort param otherwise.\n */\n private get effectiveSort(): SortParam | null {\n return this.sortParam ?? this.defaultSortParam;\n }\n\n private get hasSnippets(): boolean {\n return !!this.model?.snippets?.length;\n }\n\n private infoButtonPressed(e: PointerEvent): void {\n e.preventDefault();\n const event = new CustomEvent<{ x: number; y: number }>(\n 'infoButtonPressed',\n { detail: { x: e.clientX, y: e.clientY } },\n );\n this.dispatchEvent(event);\n }\n\n /**\n * CSS\n */\n static get styles(): CSSResultGroup {\n const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;\n\n return [\n baseTileStyles,\n css`\n a:link {\n text-decoration: none;\n color: var(--ia-theme-link-color, #4b64ff);\n }\n a:hover {\n text-decoration: underline;\n }\n\n .container {\n border: 1px solid ${tileBorderColor};\n }\n\n .simple #title > .truncated {\n -webkit-line-clamp: 2;\n }\n\n .simple .created-by > .truncated,\n .simple .date-sorted-by > .truncated,\n .simple .volume-issue > .truncated {\n -webkit-line-clamp: 1;\n }\n\n .simple.snippets-only .item-info,\n .simple.minimal .item-info {\n padding-bottom: 5px;\n }\n\n .simple.snippets-only text-snippet-block {\n margin-top: auto; /* Force the snippets to the bottom of the tile */\n }\n\n .capture-dates {\n margin: 0;\n padding: 0 5px;\n list-style-type: none;\n }\n\n review-block,\n text-snippet-block {\n --containerLeftMargin: 5px;\n --containerTopMargin: 5px;\n }\n\n /**\n * iOS Safari long-press on tiles (to bring up hover pane)\n * gets messy without this\n */\n @media screen and (pointer: coarse) and (hover: none) {\n .container {\n -webkit-touch-callout: none;\n }\n\n .truncated {\n -webkit-touch-callout: default;\n }\n }\n `,\n ];\n }\n}\n"]}
@@ -215,25 +215,25 @@ export class HoverPaneController {
215
215
  getTemplate() {
216
216
  this.hoverPaneProps = this.host.getHoverPaneProps();
217
217
  return this.shouldRenderHoverPane
218
- ? html `
219
- ${this.touchBackdropTemplate}
220
- <tile-hover-pane
221
- popover
222
- tabindex="-1"
223
- aria-describedby="tile-hover-pane-aria-description"
224
- .model=${this.hoverPaneProps?.model}
225
- .baseNavigationUrl=${this.hoverPaneProps?.baseNavigationUrl}
226
- .baseImageUrl=${this.hoverPaneProps?.baseImageUrl}
227
- .loggedIn=${this.hoverPaneProps?.loggedIn}
228
- .suppressBlurring=${this.hoverPaneProps?.suppressBlurring}
229
- .sortParam=${this.hoverPaneProps?.sortParam}
230
- .collectionTitles=${this.hoverPaneProps?.collectionTitles}
231
- .mobileBreakpoint=${this.mobileBreakpoint}
232
- .currentWidth=${window.innerWidth}
233
- ></tile-hover-pane>
234
- <div id="tile-hover-pane-aria-description" class="sr-only">
235
- ${msg('Press Up Arrow to exit item detail preview')}
236
- </div>
218
+ ? html `
219
+ ${this.touchBackdropTemplate}
220
+ <tile-hover-pane
221
+ popover
222
+ tabindex="-1"
223
+ aria-describedby="tile-hover-pane-aria-description"
224
+ .model=${this.hoverPaneProps?.model}
225
+ .baseNavigationUrl=${this.hoverPaneProps?.baseNavigationUrl}
226
+ .baseImageUrl=${this.hoverPaneProps?.baseImageUrl}
227
+ .loggedIn=${this.hoverPaneProps?.loggedIn}
228
+ .suppressBlurring=${this.hoverPaneProps?.suppressBlurring}
229
+ .sortParam=${this.hoverPaneProps?.sortParam}
230
+ .collectionTitles=${this.hoverPaneProps?.collectionTitles}
231
+ .mobileBreakpoint=${this.mobileBreakpoint}
232
+ .currentWidth=${window.innerWidth}
233
+ ></tile-hover-pane>
234
+ <div id="tile-hover-pane-aria-description" class="sr-only">
235
+ ${msg('Press Up Arrow to exit item detail preview')}
236
+ </div>
237
237
  `
238
238
  : nothing;
239
239
  }
@@ -258,15 +258,15 @@ export class HoverPaneController {
258
258
  */
259
259
  get touchBackdropTemplate() {
260
260
  return this.showTouchBackdrop
261
- ? html `<div
262
- id="touch-backdrop"
263
- @touchstart=${this.handleBackdropInteraction}
264
- @touchmove=${this.handleBackdropInteraction}
265
- @touchend=${this.handleBackdropInteraction}
266
- @touchcancel=${this.handleBackdropInteraction}
267
- @mouseenter=${(e) => e.stopPropagation()}
268
- @mousemove=${(e) => e.stopPropagation()}
269
- @mouseleave=${(e) => e.stopPropagation()}
261
+ ? html `<div
262
+ id="touch-backdrop"
263
+ @touchstart=${this.handleBackdropInteraction}
264
+ @touchmove=${this.handleBackdropInteraction}
265
+ @touchend=${this.handleBackdropInteraction}
266
+ @touchcancel=${this.handleBackdropInteraction}
267
+ @mouseenter=${(e) => e.stopPropagation()}
268
+ @mousemove=${(e) => e.stopPropagation()}
269
+ @mouseleave=${(e) => e.stopPropagation()}
270
270
  ></div>`
271
271
  : nothing;
272
272
  }