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