@internetarchive/collection-browser 3.0.7-alpha-webdev7989.0 → 3.1.1-alpha-webdev6778.1

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 (75) hide show
  1. package/dist/src/app-root.js +606 -606
  2. package/dist/src/app-root.js.map +1 -1
  3. package/dist/src/collection-browser.d.ts +9 -0
  4. package/dist/src/collection-browser.js +689 -682
  5. package/dist/src/collection-browser.js.map +1 -1
  6. package/dist/src/collection-facets/models.js.map +1 -1
  7. package/dist/src/collection-facets/more-facets-content.d.ts +1 -0
  8. package/dist/src/collection-facets/more-facets-content.js +122 -118
  9. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  10. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +75 -75
  11. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  12. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +54 -54
  13. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  14. package/dist/src/collection-facets.d.ts +1 -0
  15. package/dist/src/collection-facets.js +269 -265
  16. package/dist/src/collection-facets.js.map +1 -1
  17. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  18. package/dist/src/data-source/collection-browser-data-source.js +27 -13
  19. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  20. package/dist/src/data-source/collection-browser-query-state.d.ts +1 -0
  21. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  22. package/dist/src/data-source/models.d.ts +1 -1
  23. package/dist/src/data-source/models.js.map +1 -1
  24. package/dist/src/expanded-date-picker.js +52 -52
  25. package/dist/src/expanded-date-picker.js.map +1 -1
  26. package/dist/src/manage/manage-bar.js +77 -77
  27. package/dist/src/manage/manage-bar.js.map +1 -1
  28. package/dist/src/models.js.map +1 -1
  29. package/dist/src/sort-filter-bar/sort-filter-bar.js +376 -376
  30. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  31. package/dist/src/tiles/grid/collection-tile.js +77 -77
  32. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  33. package/dist/src/tiles/grid/item-tile.js +139 -139
  34. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  35. package/dist/src/tiles/grid/search-tile.js +42 -42
  36. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  37. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
  38. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  39. package/dist/src/tiles/list/tile-list.js +297 -297
  40. package/dist/src/tiles/list/tile-list.js.map +1 -1
  41. package/dist/src/tiles/tile-dispatcher.js +200 -200
  42. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  43. package/dist/src/utils/analytics-events.js.map +1 -1
  44. package/dist/test/collection-browser.test.js +196 -183
  45. package/dist/test/collection-browser.test.js.map +1 -1
  46. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +37 -37
  47. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  48. package/dist/test/tiles/list/tile-list.test.js +113 -113
  49. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  50. package/package.json +2 -2
  51. package/src/app-root.ts +1140 -1140
  52. package/src/collection-browser.ts +2802 -2788
  53. package/src/collection-facets/models.ts +10 -10
  54. package/src/collection-facets/more-facets-content.ts +639 -636
  55. package/src/collection-facets/smart-facets/smart-facet-bar.ts +437 -437
  56. package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +185 -185
  57. package/src/collection-facets.ts +995 -992
  58. package/src/data-source/collection-browser-data-source-interface.ts +333 -333
  59. package/src/data-source/collection-browser-data-source.ts +1401 -1391
  60. package/src/data-source/collection-browser-query-state.ts +65 -64
  61. package/src/data-source/models.ts +1 -1
  62. package/src/expanded-date-picker.ts +191 -191
  63. package/src/manage/manage-bar.ts +247 -247
  64. package/src/models.ts +870 -870
  65. package/src/sort-filter-bar/sort-filter-bar.ts +1283 -1283
  66. package/src/tiles/grid/collection-tile.ts +162 -162
  67. package/src/tiles/grid/item-tile.ts +339 -339
  68. package/src/tiles/grid/search-tile.ts +90 -90
  69. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
  70. package/src/tiles/list/tile-list.ts +696 -696
  71. package/src/tiles/tile-dispatcher.ts +486 -486
  72. package/src/utils/analytics-events.ts +29 -29
  73. package/test/collection-browser.test.ts +2359 -2340
  74. package/test/sort-filter-bar/sort-filter-bar.test.ts +885 -885
  75. package/test/tiles/list/tile-list.test.ts +497 -497
@@ -1,339 +1,339 @@
1
- import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';
2
- import { customElement, property } from 'lit/decorators.js';
3
- import { ifDefined } from 'lit/directives/if-defined.js';
4
- import { map } from 'lit/directives/map.js';
5
- import { classMap } from 'lit/directives/class-map.js';
6
- import { msg } from '@lit/localize';
7
-
8
- import type { SortParam } from '@internetarchive/search-service';
9
- import { DateFormat, formatDate } from '../../utils/format-date';
10
- import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';
11
- import { BaseTileComponent } from '../base-tile-component';
12
- import { baseTileStyles } from './styles/tile-grid-shared-styles';
13
-
14
- import '../image-block';
15
- import '../review-block';
16
- import '../text-snippet-block';
17
- import '../item-image';
18
- import '../tile-mediatype-icon';
19
- import './tile-stats';
20
- import { SimpleLayoutType } from '../models';
21
-
22
- @customElement('item-tile')
23
- export class ItemTile extends BaseTileComponent {
24
- /*
25
- * Reactive properties inherited from BaseTileComponent:
26
- * - model?: TileModel;
27
- * - currentWidth?: number;
28
- * - currentHeight?: number;
29
- * - baseNavigationUrl?: string;
30
- * - baseImageUrl?: string;
31
- * - collectionPagePath?: string;
32
- * - sortParam: SortParam | null = null;
33
- * - defaultSortParam: SortParam | null = null;
34
- * - creatorFilter?: string;
35
- * - mobileBreakpoint?: number;
36
- * - loggedIn = false;
37
- * - suppressBlurring = false;
38
- */
39
-
40
- @property({ type: Boolean }) showInfoButton = false;
41
-
42
- @property({ type: Boolean }) showTvClips = false;
43
-
44
- @property({ type: String }) simpleLayoutType: SimpleLayoutType = 'none';
45
-
46
- render() {
47
- const itemTitle = this.model?.title;
48
- const containerClasses = classMap({
49
- container: true,
50
- simple: this.simpleLayoutType !== 'none',
51
- 'stats-only': this.simpleLayoutType === 'stats-only',
52
- 'snippets-only': this.simpleLayoutType === 'snippets-only',
53
- });
54
-
55
- return html`
56
- <div class=${containerClasses}>
57
- ${this.infoButtonTemplate}
58
- <div class="tile-details">
59
- <div class="item-info">
60
- ${this.imageBlockTemplate}
61
-
62
- <div id="title">
63
- <h3 class="truncated" title=${ifDefined(itemTitle)}>
64
- ${itemTitle}
65
- </h3>
66
- </div>
67
-
68
- ${this.volumeIssueTemplate}
69
- ${this.isSortedByDate
70
- ? this.sortedDateInfoTemplate
71
- : this.creatorTemplate}
72
- ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}
73
- ${this.reviewBlockTemplate}
74
- </div>
75
-
76
- ${this.tileStatsTemplate}
77
- </div>
78
- </div>
79
- `;
80
- }
81
-
82
- /**
83
- * Templates
84
- */
85
- private get creatorTemplate(): TemplateResult | typeof nothing {
86
- const displayedCreator =
87
- this.displayValueProvider.firstCreatorMatchingFilter;
88
- if (!displayedCreator) return nothing;
89
-
90
- return html`
91
- <div class="created-by">
92
- <span class="truncated" title=${displayedCreator}>
93
- by&nbsp;${displayedCreator}
94
- </span>
95
- </div>
96
- `;
97
- }
98
-
99
- private get imageBlockTemplate(): TemplateResult {
100
- return html`
101
- <image-block
102
- .model=${this.model}
103
- .baseImageUrl=${this.baseImageUrl}
104
- .loggedIn=${this.loggedIn}
105
- .suppressBlurring=${this.suppressBlurring}
106
- .isCompactTile=${false}
107
- .isListTile=${false}
108
- .viewSize=${'grid'}
109
- >
110
- </image-block>
111
- `;
112
- }
113
-
114
- private get sortedDateInfoTemplate() {
115
- let sortedValue;
116
- let format: DateFormat = 'long';
117
- switch (this.effectiveSort?.field) {
118
- case 'date': {
119
- const datePublished = this.model?.datePublished;
120
- sortedValue = { field: 'published', value: datePublished };
121
- if (isFirstMillisecondOfUTCYear(datePublished)) {
122
- format = 'year-only';
123
- }
124
- break;
125
- }
126
- case 'reviewdate':
127
- sortedValue = { field: 'reviewed', value: this.model?.dateReviewed };
128
- break;
129
- case 'addeddate':
130
- sortedValue = { field: 'added', value: this.model?.dateAdded };
131
- break;
132
- case 'publicdate':
133
- sortedValue = { field: 'archived', value: this.model?.dateArchived };
134
- break;
135
- default:
136
- break;
137
- }
138
-
139
- if (!sortedValue?.value) {
140
- return nothing;
141
- }
142
- return html`
143
- <div class="date-sorted-by truncated">
144
- <span>
145
- ${sortedValue?.field} ${formatDate(sortedValue?.value, format)}
146
- </span>
147
- </div>
148
- `;
149
- }
150
-
151
- private get infoButtonTemplate(): TemplateResult | typeof nothing {
152
- // &#9432; is an information icon
153
- return this.showInfoButton
154
- ? html`<button class="info-button" @click=${this.infoButtonPressed}>
155
- &#9432;
156
- <span class="sr-only">${msg('More info')}</span>
157
- </button>`
158
- : nothing;
159
- }
160
-
161
- private get reviewBlockTemplate(): TemplateResult | typeof nothing {
162
- if (!this.model?.review) return nothing;
163
-
164
- const { reviewtitle, reviewbody, stars } = this.model.review;
165
- return html`
166
- <review-block
167
- viewsize="grid"
168
- title=${ifDefined(reviewtitle)}
169
- body=${ifDefined(reviewbody)}
170
- starRating=${ifDefined(stars)}
171
- >
172
- </review-block>
173
- `;
174
- }
175
-
176
- private get textSnippetsTemplate(): TemplateResult | typeof nothing {
177
- if (!this.hasSnippets || this.simpleLayoutType === 'stats-only')
178
- return nothing;
179
-
180
- return html`
181
- <text-snippet-block viewsize="grid" .snippets=${this.model?.snippets}>
182
- </text-snippet-block>
183
- `;
184
- }
185
-
186
- private get volumeIssueTemplate(): TemplateResult | typeof nothing {
187
- if (!this.model?.volume || !this.model?.issue) return nothing;
188
-
189
- return html`
190
- <div class="volume-issue">
191
- <span class="truncated" title="volume|issue">
192
- Volume&nbsp;${this.model?.volume}, Issue&nbsp;${this.model?.issue}
193
- </span>
194
- </div>
195
- `;
196
- }
197
-
198
- private get webArchivesCaptureDatesTemplate():
199
- | TemplateResult
200
- | typeof nothing {
201
- if (!this.model?.captureDates || !this.model.title) return nothing;
202
-
203
- return html`
204
- <ul class="capture-dates">
205
- ${map(
206
- this.model.captureDates,
207
- date =>
208
- html`<li>
209
- ${this.displayValueProvider.webArchivesCaptureLink(
210
- this.model!.title,
211
- date,
212
- )}
213
- </li>`,
214
- )}
215
- </ul>
216
- `;
217
- }
218
-
219
- /**
220
- * Template for the stats row along the bottom of the tile.
221
- */
222
- private get tileStatsTemplate(): TemplateResult | typeof nothing {
223
- if (this.simpleLayoutType === 'snippets-only') return nothing;
224
-
225
- const effectiveSort = this.sortParam ?? this.defaultSortParam;
226
- const [viewCount, viewLabel] =
227
- effectiveSort?.field === 'week'
228
- ? [this.model?.weeklyViewCount, 'weekly views']
229
- : [this.model?.viewCount, 'all-time views'];
230
-
231
- return html`
232
- <tile-stats
233
- .model=${this.model}
234
- .mediatype=${this.model?.mediatype}
235
- .viewCount=${viewCount}
236
- .viewLabel=${viewLabel}
237
- .favCount=${this.model?.favCount}
238
- .commentCount=${this.model?.commentCount}
239
- .tvClipCount=${this.model?.tvClipCount}
240
- .showTvClips=${this.showTvClips}
241
- >
242
- </tile-stats>
243
- `;
244
- }
245
-
246
- private get isSortedByDate(): boolean {
247
- return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(
248
- this.effectiveSort?.field as string,
249
- );
250
- }
251
-
252
- /**
253
- * Returns the active sort param if one is set, or the default sort param otherwise.
254
- */
255
- private get effectiveSort(): SortParam | null {
256
- return this.sortParam ?? this.defaultSortParam;
257
- }
258
-
259
- private get hasSnippets(): boolean {
260
- return !!this.model?.snippets?.length;
261
- }
262
-
263
- private infoButtonPressed(e: PointerEvent): void {
264
- e.preventDefault();
265
- const event = new CustomEvent<{ x: number; y: number }>(
266
- 'infoButtonPressed',
267
- { detail: { x: e.clientX, y: e.clientY } },
268
- );
269
- this.dispatchEvent(event);
270
- }
271
-
272
- /**
273
- * CSS
274
- */
275
- static get styles(): CSSResultGroup {
276
- const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;
277
-
278
- return [
279
- baseTileStyles,
280
- css`
281
- a:link {
282
- text-decoration: none;
283
- color: var(--ia-theme-link-color, #4b64ff);
284
- }
285
- a:hover {
286
- text-decoration: underline;
287
- }
288
-
289
- .container {
290
- border: 1px solid ${tileBorderColor};
291
- }
292
-
293
- .simple #title > .truncated {
294
- -webkit-line-clamp: 2;
295
- }
296
-
297
- .simple .created-by > .truncated,
298
- .simple .date-sorted-by > .truncated,
299
- .simple .volume-issue > .truncated {
300
- -webkit-line-clamp: 1;
301
- }
302
-
303
- .simple.snippets-only .item-info {
304
- padding-bottom: 5px;
305
- }
306
-
307
- .simple.snippets-only text-snippet-block {
308
- margin-top: auto; /* Force the snippets to the bottom of the tile */
309
- }
310
-
311
- .capture-dates {
312
- margin: 0;
313
- padding: 0 5px;
314
- list-style-type: none;
315
- }
316
-
317
- review-block,
318
- text-snippet-block {
319
- --containerLeftMargin: 5px;
320
- --containerTopMargin: 5px;
321
- }
322
-
323
- /**
324
- * iOS Safari long-press on tiles (to bring up hover pane)
325
- * gets messy without this
326
- */
327
- @media screen and (pointer: coarse) and (hover: none) {
328
- .container {
329
- -webkit-touch-callout: none;
330
- }
331
-
332
- .truncated {
333
- -webkit-touch-callout: default;
334
- }
335
- }
336
- `,
337
- ];
338
- }
339
- }
1
+ import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { ifDefined } from 'lit/directives/if-defined.js';
4
+ import { map } from 'lit/directives/map.js';
5
+ import { classMap } from 'lit/directives/class-map.js';
6
+ import { msg } from '@lit/localize';
7
+
8
+ import type { SortParam } from '@internetarchive/search-service';
9
+ import { DateFormat, formatDate } from '../../utils/format-date';
10
+ import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';
11
+ import { BaseTileComponent } from '../base-tile-component';
12
+ import { baseTileStyles } from './styles/tile-grid-shared-styles';
13
+
14
+ import '../image-block';
15
+ import '../review-block';
16
+ import '../text-snippet-block';
17
+ import '../item-image';
18
+ import '../tile-mediatype-icon';
19
+ import './tile-stats';
20
+ import { SimpleLayoutType } from '../models';
21
+
22
+ @customElement('item-tile')
23
+ export class ItemTile extends BaseTileComponent {
24
+ /*
25
+ * Reactive properties inherited from BaseTileComponent:
26
+ * - model?: TileModel;
27
+ * - currentWidth?: number;
28
+ * - currentHeight?: number;
29
+ * - baseNavigationUrl?: string;
30
+ * - baseImageUrl?: string;
31
+ * - collectionPagePath?: string;
32
+ * - sortParam: SortParam | null = null;
33
+ * - defaultSortParam: SortParam | null = null;
34
+ * - creatorFilter?: string;
35
+ * - mobileBreakpoint?: number;
36
+ * - loggedIn = false;
37
+ * - suppressBlurring = false;
38
+ */
39
+
40
+ @property({ type: Boolean }) showInfoButton = false;
41
+
42
+ @property({ type: Boolean }) showTvClips = false;
43
+
44
+ @property({ type: String }) simpleLayoutType: SimpleLayoutType = 'none';
45
+
46
+ render() {
47
+ const itemTitle = this.model?.title;
48
+ const containerClasses = classMap({
49
+ container: true,
50
+ simple: this.simpleLayoutType !== 'none',
51
+ 'stats-only': this.simpleLayoutType === 'stats-only',
52
+ 'snippets-only': this.simpleLayoutType === 'snippets-only',
53
+ });
54
+
55
+ return html`
56
+ <div class=${containerClasses}>
57
+ ${this.infoButtonTemplate}
58
+ <div class="tile-details">
59
+ <div class="item-info">
60
+ ${this.imageBlockTemplate}
61
+
62
+ <div id="title">
63
+ <h3 class="truncated" title=${ifDefined(itemTitle)}>
64
+ ${itemTitle}
65
+ </h3>
66
+ </div>
67
+
68
+ ${this.volumeIssueTemplate}
69
+ ${this.isSortedByDate
70
+ ? this.sortedDateInfoTemplate
71
+ : this.creatorTemplate}
72
+ ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}
73
+ ${this.reviewBlockTemplate}
74
+ </div>
75
+
76
+ ${this.tileStatsTemplate}
77
+ </div>
78
+ </div>
79
+ `;
80
+ }
81
+
82
+ /**
83
+ * Templates
84
+ */
85
+ private get creatorTemplate(): TemplateResult | typeof nothing {
86
+ const displayedCreator =
87
+ this.displayValueProvider.firstCreatorMatchingFilter;
88
+ if (!displayedCreator) return nothing;
89
+
90
+ return html`
91
+ <div class="created-by">
92
+ <span class="truncated" title=${displayedCreator}>
93
+ by&nbsp;${displayedCreator}
94
+ </span>
95
+ </div>
96
+ `;
97
+ }
98
+
99
+ private get imageBlockTemplate(): TemplateResult {
100
+ return html`
101
+ <image-block
102
+ .model=${this.model}
103
+ .baseImageUrl=${this.baseImageUrl}
104
+ .loggedIn=${this.loggedIn}
105
+ .suppressBlurring=${this.suppressBlurring}
106
+ .isCompactTile=${false}
107
+ .isListTile=${false}
108
+ .viewSize=${'grid'}
109
+ >
110
+ </image-block>
111
+ `;
112
+ }
113
+
114
+ private get sortedDateInfoTemplate() {
115
+ let sortedValue;
116
+ let format: DateFormat = 'long';
117
+ switch (this.effectiveSort?.field) {
118
+ case 'date': {
119
+ const datePublished = this.model?.datePublished;
120
+ sortedValue = { field: 'published', value: datePublished };
121
+ if (isFirstMillisecondOfUTCYear(datePublished)) {
122
+ format = 'year-only';
123
+ }
124
+ break;
125
+ }
126
+ case 'reviewdate':
127
+ sortedValue = { field: 'reviewed', value: this.model?.dateReviewed };
128
+ break;
129
+ case 'addeddate':
130
+ sortedValue = { field: 'added', value: this.model?.dateAdded };
131
+ break;
132
+ case 'publicdate':
133
+ sortedValue = { field: 'archived', value: this.model?.dateArchived };
134
+ break;
135
+ default:
136
+ break;
137
+ }
138
+
139
+ if (!sortedValue?.value) {
140
+ return nothing;
141
+ }
142
+ return html`
143
+ <div class="date-sorted-by truncated">
144
+ <span>
145
+ ${sortedValue?.field} ${formatDate(sortedValue?.value, format)}
146
+ </span>
147
+ </div>
148
+ `;
149
+ }
150
+
151
+ private get infoButtonTemplate(): TemplateResult | typeof nothing {
152
+ // &#9432; is an information icon
153
+ return this.showInfoButton
154
+ ? html`<button class="info-button" @click=${this.infoButtonPressed}>
155
+ &#9432;
156
+ <span class="sr-only">${msg('More info')}</span>
157
+ </button>`
158
+ : nothing;
159
+ }
160
+
161
+ private get reviewBlockTemplate(): TemplateResult | typeof nothing {
162
+ if (!this.model?.review) return nothing;
163
+
164
+ const { reviewtitle, reviewbody, stars } = this.model.review;
165
+ return html`
166
+ <review-block
167
+ viewsize="grid"
168
+ title=${ifDefined(reviewtitle)}
169
+ body=${ifDefined(reviewbody)}
170
+ starRating=${ifDefined(stars)}
171
+ >
172
+ </review-block>
173
+ `;
174
+ }
175
+
176
+ private get textSnippetsTemplate(): TemplateResult | typeof nothing {
177
+ if (!this.hasSnippets || this.simpleLayoutType === 'stats-only')
178
+ return nothing;
179
+
180
+ return html`
181
+ <text-snippet-block viewsize="grid" .snippets=${this.model?.snippets}>
182
+ </text-snippet-block>
183
+ `;
184
+ }
185
+
186
+ private get volumeIssueTemplate(): TemplateResult | typeof nothing {
187
+ if (!this.model?.volume || !this.model?.issue) return nothing;
188
+
189
+ return html`
190
+ <div class="volume-issue">
191
+ <span class="truncated" title="volume|issue">
192
+ Volume&nbsp;${this.model?.volume}, Issue&nbsp;${this.model?.issue}
193
+ </span>
194
+ </div>
195
+ `;
196
+ }
197
+
198
+ private get webArchivesCaptureDatesTemplate():
199
+ | TemplateResult
200
+ | typeof nothing {
201
+ if (!this.model?.captureDates || !this.model.title) return nothing;
202
+
203
+ return html`
204
+ <ul class="capture-dates">
205
+ ${map(
206
+ this.model.captureDates,
207
+ date =>
208
+ html`<li>
209
+ ${this.displayValueProvider.webArchivesCaptureLink(
210
+ this.model!.title,
211
+ date,
212
+ )}
213
+ </li>`,
214
+ )}
215
+ </ul>
216
+ `;
217
+ }
218
+
219
+ /**
220
+ * Template for the stats row along the bottom of the tile.
221
+ */
222
+ private get tileStatsTemplate(): TemplateResult | typeof nothing {
223
+ if (this.simpleLayoutType === 'snippets-only') return nothing;
224
+
225
+ const effectiveSort = this.sortParam ?? this.defaultSortParam;
226
+ const [viewCount, viewLabel] =
227
+ effectiveSort?.field === 'week'
228
+ ? [this.model?.weeklyViewCount, 'weekly views']
229
+ : [this.model?.viewCount, 'all-time views'];
230
+
231
+ return html`
232
+ <tile-stats
233
+ .model=${this.model}
234
+ .mediatype=${this.model?.mediatype}
235
+ .viewCount=${viewCount}
236
+ .viewLabel=${viewLabel}
237
+ .favCount=${this.model?.favCount}
238
+ .commentCount=${this.model?.commentCount}
239
+ .tvClipCount=${this.model?.tvClipCount}
240
+ .showTvClips=${this.showTvClips}
241
+ >
242
+ </tile-stats>
243
+ `;
244
+ }
245
+
246
+ private get isSortedByDate(): boolean {
247
+ return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(
248
+ this.effectiveSort?.field as string,
249
+ );
250
+ }
251
+
252
+ /**
253
+ * Returns the active sort param if one is set, or the default sort param otherwise.
254
+ */
255
+ private get effectiveSort(): SortParam | null {
256
+ return this.sortParam ?? this.defaultSortParam;
257
+ }
258
+
259
+ private get hasSnippets(): boolean {
260
+ return !!this.model?.snippets?.length;
261
+ }
262
+
263
+ private infoButtonPressed(e: PointerEvent): void {
264
+ e.preventDefault();
265
+ const event = new CustomEvent<{ x: number; y: number }>(
266
+ 'infoButtonPressed',
267
+ { detail: { x: e.clientX, y: e.clientY } },
268
+ );
269
+ this.dispatchEvent(event);
270
+ }
271
+
272
+ /**
273
+ * CSS
274
+ */
275
+ static get styles(): CSSResultGroup {
276
+ const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;
277
+
278
+ return [
279
+ baseTileStyles,
280
+ css`
281
+ a:link {
282
+ text-decoration: none;
283
+ color: var(--ia-theme-link-color, #4b64ff);
284
+ }
285
+ a:hover {
286
+ text-decoration: underline;
287
+ }
288
+
289
+ .container {
290
+ border: 1px solid ${tileBorderColor};
291
+ }
292
+
293
+ .simple #title > .truncated {
294
+ -webkit-line-clamp: 2;
295
+ }
296
+
297
+ .simple .created-by > .truncated,
298
+ .simple .date-sorted-by > .truncated,
299
+ .simple .volume-issue > .truncated {
300
+ -webkit-line-clamp: 1;
301
+ }
302
+
303
+ .simple.snippets-only .item-info {
304
+ padding-bottom: 5px;
305
+ }
306
+
307
+ .simple.snippets-only text-snippet-block {
308
+ margin-top: auto; /* Force the snippets to the bottom of the tile */
309
+ }
310
+
311
+ .capture-dates {
312
+ margin: 0;
313
+ padding: 0 5px;
314
+ list-style-type: none;
315
+ }
316
+
317
+ review-block,
318
+ text-snippet-block {
319
+ --containerLeftMargin: 5px;
320
+ --containerTopMargin: 5px;
321
+ }
322
+
323
+ /**
324
+ * iOS Safari long-press on tiles (to bring up hover pane)
325
+ * gets messy without this
326
+ */
327
+ @media screen and (pointer: coarse) and (hover: none) {
328
+ .container {
329
+ -webkit-touch-callout: none;
330
+ }
331
+
332
+ .truncated {
333
+ -webkit-touch-callout: default;
334
+ }
335
+ }
336
+ `,
337
+ ];
338
+ }
339
+ }