@internetarchive/collection-browser 4.3.2-alpha-webdev7939.2 → 4.3.2-alpha-webdev7939.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.
@@ -37,41 +37,41 @@ 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() {
@@ -79,48 +79,48 @@ let TileList = class TileList extends BaseTileComponent {
79
79
  return nothing;
80
80
  const isCollection = this.model.mediatype === 'collection';
81
81
  const href = this.displayValueProvider.itemPageUrl(this.model.identifier, isCollection);
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>
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>
97
97
  </a> `;
98
98
  }
99
99
  get detailsTemplate() {
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}
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}
112
112
  `;
113
113
  }
114
114
  // Data templates
115
115
  get iconRightTemplate() {
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>
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>
124
124
  `;
125
125
  }
126
126
  get titleTemplate() {
@@ -130,8 +130,8 @@ let TileList = class TileList extends BaseTileComponent {
130
130
  // If the model has a server-specified href, use it
131
131
  // Otherwise construct a details link using the identifier
132
132
  return this.model?.href
133
- ? html `<a href="${this.baseNavigationUrl}${this.model.href}"
134
- >${this.model.title ?? this.model.identifier}</a
133
+ ? html `<a href="${this.baseNavigationUrl}${this.model.href}"
134
+ >${this.model.title ?? this.model.identifier}</a
135
135
  >`
136
136
  : this.detailsLink(this.model.identifier, this.model.title, this.model.mediatype === 'collection');
137
137
  }
@@ -148,11 +148,11 @@ let TileList = class TileList extends BaseTileComponent {
148
148
  if (!this.model?.source) {
149
149
  return nothing;
150
150
  }
151
- return html `
152
- <div id="source" class="metadata">
153
- ${this.labelTemplate(msg('Source'))}
154
- ${this.searchLink('source', this.model.source)}
155
- </div>
151
+ return html `
152
+ <div id="source" class="metadata">
153
+ ${this.labelTemplate(msg('Source'))}
154
+ ${this.searchLink('source', this.model.source)}
155
+ </div>
156
156
  `;
157
157
  }
158
158
  get volumeTemplate() {
@@ -164,23 +164,23 @@ let TileList = class TileList extends BaseTileComponent {
164
164
  get creatorTemplate() {
165
165
  // "Archivist since" if account
166
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>
167
+ return html `
168
+ <div id="creator" class="metadata">
169
+ <span class="label"
170
+ >${this.displayValueProvider.accountLabel ?? nothing}</span
171
+ >
172
+ </div>
173
173
  `;
174
174
  }
175
175
  // "Creator" if not account tile
176
176
  if (!this.model?.creators || this.model.creators.length === 0) {
177
177
  return nothing;
178
178
  }
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>
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>
184
184
  `;
185
185
  }
186
186
  get datePublishedTemplate() {
@@ -228,22 +228,22 @@ let TileList = class TileList extends BaseTileComponent {
228
228
  if (!this.model?.subjects || this.model.subjects.length === 0) {
229
229
  return nothing;
230
230
  }
231
- return html `
232
- <div id="topics" class="metadata">
233
- ${this.labelTemplate(msg('Topics'))}
234
- ${join(map(this.model.subjects, id => this.searchLink('subject', id)), ', ')}
235
- </div>
231
+ return html `
232
+ <div id="topics" class="metadata">
233
+ ${this.labelTemplate(msg('Topics'))}
234
+ ${join(map(this.model.subjects, id => this.searchLink('subject', id)), ', ')}
235
+ </div>
236
236
  `;
237
237
  }
238
238
  get collectionsTemplate() {
239
239
  if (!this.collectionLinks || this.collectionLinks.length === 0) {
240
240
  return nothing;
241
241
  }
242
- return html `
243
- <div id="collections" class="metadata">
244
- ${this.labelTemplate(msg('Collections'))}
245
- ${join(this.collectionLinks, ', ')}
246
- </div>
242
+ return html `
243
+ <div id="collections" class="metadata">
244
+ ${this.labelTemplate(msg('Collections'))}
245
+ ${join(this.collectionLinks, ', ')}
246
+ </div>
247
247
  `;
248
248
  }
249
249
  get descriptionTemplate() {
@@ -255,22 +255,22 @@ let TileList = class TileList extends BaseTileComponent {
255
255
  if (!this.model?.review)
256
256
  return nothing;
257
257
  const { reviewtitle, reviewbody, stars } = this.model.review;
258
- return html `
259
- <review-block
260
- viewsize="list"
261
- title=${ifDefined(reviewtitle)}
262
- body=${ifDefined(reviewbody)}
263
- starRating=${ifDefined(stars)}
264
- >
265
- </review-block>
258
+ return html `
259
+ <review-block
260
+ viewsize="list"
261
+ title=${ifDefined(reviewtitle)}
262
+ body=${ifDefined(reviewbody)}
263
+ starRating=${ifDefined(stars)}
264
+ >
265
+ </review-block>
266
266
  `;
267
267
  }
268
268
  get textSnippetsTemplate() {
269
269
  if (!this.hasSnippets)
270
270
  return nothing;
271
- return html `<text-snippet-block
272
- viewsize="list"
273
- .snippets=${this.model?.snippets}
271
+ return html `<text-snippet-block
272
+ viewsize="list"
273
+ .snippets=${this.model?.snippets}
274
274
  ></text-snippet-block>`;
275
275
  }
276
276
  get hasSnippets() {
@@ -279,12 +279,12 @@ let TileList = class TileList extends BaseTileComponent {
279
279
  get webArchivesCaptureDatesTemplate() {
280
280
  if (!this.model?.captureDates || !this.model.title)
281
281
  return nothing;
282
- return html `
283
- <ul class="capture-dates">
284
- ${map(this.model.captureDates, date => html `<li>
285
- ${this.displayValueProvider.webArchivesCaptureLink(this.model.title, date)}
286
- </li>`)}
287
- </ul>
282
+ return html `
283
+ <ul class="capture-dates">
284
+ ${map(this.model.captureDates, date => html `<li>
285
+ ${this.displayValueProvider.webArchivesCaptureLink(this.model.title, date)}
286
+ </li>`)}
287
+ </ul>
288
288
  `;
289
289
  }
290
290
  // Utility functions
@@ -292,10 +292,10 @@ let TileList = class TileList extends BaseTileComponent {
292
292
  metadataTemplate(text, label = '', id) {
293
293
  if (!text)
294
294
  return nothing;
295
- return html `
296
- <div id=${ifDefined(id)} class="metadata">
297
- ${this.labelTemplate(label)} ${text}
298
- </div>
295
+ return html `
296
+ <div id=${ifDefined(id)} class="metadata">
297
+ ${this.labelTemplate(label)} ${text}
298
+ </div>
299
299
  `;
300
300
  }
301
301
  labelTemplate(label) {
@@ -310,11 +310,11 @@ let TileList = class TileList extends BaseTileComponent {
310
310
  const query = encodeURIComponent(`${field}:"${searchTerm}"`);
311
311
  // No whitespace after closing tag
312
312
  // Note: single ' for href='' to wrap " in query var gets changed back by yarn format
313
- return html `<a
314
- href="${this.baseNavigationUrl}/search?query=${query}"
315
- rel="nofollow"
316
- >
317
- ${DOMPurify.sanitize(searchTerm)}</a
313
+ return html `<a
314
+ href="${this.baseNavigationUrl}/search?query=${query}"
315
+ rel="nofollow"
316
+ >
317
+ ${DOMPurify.sanitize(searchTerm)}</a
318
318
  >`;
319
319
  }
320
320
  detailsLink(identifier, text, isCollection = false) {
@@ -401,190 +401,190 @@ let TileList = class TileList extends BaseTileComponent {
401
401
  return 'long';
402
402
  }
403
403
  static get styles() {
404
- return css `
405
- html {
406
- font-size: unset;
407
- }
408
-
409
- div {
410
- font-size: 14px;
411
- }
412
-
413
- div a {
414
- text-decoration: none;
415
- }
416
-
417
- div a:link {
418
- color: var(--ia-theme-link-color, #4b64ff);
419
- }
420
-
421
- .label {
422
- font-weight: bold;
423
- }
424
-
425
- #list-line.mobile {
426
- --infiniteScrollerRowGap: 20px;
427
- --infiniteScrollerRowHeight: auto;
428
- }
429
-
430
- #list-line.desktop {
431
- --infiniteScrollerRowGap: 30px;
432
- --infiniteScrollerRowHeight: auto;
433
- }
434
-
435
- /* fields */
436
- #icon-right {
437
- width: 20px;
438
- padding-top: 5px;
439
- --iconHeight: 20px;
440
- --iconWidth: 20px;
441
- --iconTextAlign: right;
442
- margin-top: -8px;
443
- text-align: right;
444
- }
445
-
446
- #title {
447
- color: #4b64ff;
448
- text-decoration: none;
449
- font-size: 22px;
450
- font-weight: bold;
451
- /* align top of text with image */
452
- line-height: 25px;
453
- margin-top: -4px;
454
- padding-bottom: 2px;
455
- flex-grow: 1;
456
-
457
- display: -webkit-box;
458
- -webkit-box-orient: vertical;
459
- -webkit-line-clamp: 3;
460
- overflow: hidden;
461
- overflow-wrap: anywhere;
462
- }
463
-
464
- .metadata {
465
- line-height: 20px;
466
- }
467
-
468
- #description,
469
- #creator,
470
- #topics,
471
- #source {
472
- text-align: left;
473
- overflow: hidden;
474
- text-overflow: ellipsis;
475
- -webkit-box-orient: vertical;
476
- display: -webkit-box;
477
- word-break: break-word;
478
- -webkit-line-clamp: 3; /* number of lines to show */
479
- line-clamp: 3;
480
-
481
- /*
482
- * Safari doesn't always respect the line-clamping rules above,
483
- * so we add this to ensure these fields still get truncated
484
- */
485
- max-height: 60px;
486
- }
487
-
488
- #collections {
489
- display: -webkit-box;
490
- -webkit-box-orient: vertical;
491
- -webkit-line-clamp: 3;
492
- overflow: hidden;
493
- overflow-wrap: anywhere;
494
- }
495
-
496
- #collections > a {
497
- display: inline-block;
498
- }
499
-
500
- #icon {
501
- padding-top: 5px;
502
- }
503
-
504
- #description {
505
- padding-top: 10px;
506
- }
507
-
508
- /* Top level container */
509
- #list-line {
510
- display: flex;
511
- }
512
-
513
- #list-line.mobile {
514
- flex-direction: column;
515
- }
516
-
517
- #list-line.desktop {
518
- column-gap: 10px;
519
- }
520
-
521
- #list-line-top {
522
- display: flex;
523
- column-gap: 7px;
524
- }
525
-
526
- #list-line-bottom {
527
- padding-top: 4px;
528
- }
529
-
530
- #list-line-right,
531
- #list-line-top,
532
- #list-line-bottom {
533
- width: 100%;
534
- }
535
-
536
- /*
537
- * If the container becomes very tiny, don't let the thumbnail side take
538
- * up too much space. Shouldn't make a difference on ordinary viewport sizes.
539
- */
540
- #list-line-left {
541
- max-width: 25%;
542
-
543
- display: flex;
544
- flex-direction: column;
545
- row-gap: 5px;
546
- }
547
-
548
- div a:hover {
549
- text-decoration: underline;
550
- }
551
-
552
- /* Lines containing multiple div as row */
553
- #item-line,
554
- #dates-line,
555
- #views-line,
556
- #title-line {
557
- display: flex;
558
- flex-direction: row;
559
- column-gap: 10px;
560
- }
561
-
562
- /*
563
- * With the exception of the title line, allow these to wrap if
564
- * the space becomes too small to accommodate them together.
565
- *
566
- * The title line is excluded because it contains the mediatype icon
567
- * which we don't want to wrap.
568
- */
569
- #item-line,
570
- #dates-line,
571
- #views-line {
572
- flex-wrap: wrap;
573
- }
574
-
575
- .capture-dates {
576
- margin: 0;
577
- padding: 0;
578
- list-style-type: none;
579
- }
580
-
581
- .capture-dates a:link {
582
- text-decoration: none;
583
- color: var(--ia-theme-link-color, #4b64ff);
584
- }
585
- .capture-dates a:hover {
586
- text-decoration: underline;
587
- }
404
+ return css `
405
+ html {
406
+ font-size: unset;
407
+ }
408
+
409
+ div {
410
+ font-size: 14px;
411
+ }
412
+
413
+ div a {
414
+ text-decoration: none;
415
+ }
416
+
417
+ div a:link {
418
+ color: var(--ia-theme-link-color, #4b64ff);
419
+ }
420
+
421
+ .label {
422
+ font-weight: bold;
423
+ }
424
+
425
+ #list-line.mobile {
426
+ --infiniteScrollerRowGap: 20px;
427
+ --infiniteScrollerRowHeight: auto;
428
+ }
429
+
430
+ #list-line.desktop {
431
+ --infiniteScrollerRowGap: 30px;
432
+ --infiniteScrollerRowHeight: auto;
433
+ }
434
+
435
+ /* fields */
436
+ #icon-right {
437
+ width: 20px;
438
+ padding-top: 5px;
439
+ --iconHeight: 20px;
440
+ --iconWidth: 20px;
441
+ --iconTextAlign: right;
442
+ margin-top: -8px;
443
+ text-align: right;
444
+ }
445
+
446
+ #title {
447
+ color: #4b64ff;
448
+ text-decoration: none;
449
+ font-size: 22px;
450
+ font-weight: bold;
451
+ /* align top of text with image */
452
+ line-height: 25px;
453
+ margin-top: -4px;
454
+ padding-bottom: 2px;
455
+ flex-grow: 1;
456
+
457
+ display: -webkit-box;
458
+ -webkit-box-orient: vertical;
459
+ -webkit-line-clamp: 3;
460
+ overflow: hidden;
461
+ overflow-wrap: anywhere;
462
+ }
463
+
464
+ .metadata {
465
+ line-height: 20px;
466
+ }
467
+
468
+ #description,
469
+ #creator,
470
+ #topics,
471
+ #source {
472
+ text-align: left;
473
+ overflow: hidden;
474
+ text-overflow: ellipsis;
475
+ -webkit-box-orient: vertical;
476
+ display: -webkit-box;
477
+ word-break: break-word;
478
+ -webkit-line-clamp: 3; /* number of lines to show */
479
+ line-clamp: 3;
480
+
481
+ /*
482
+ * Safari doesn't always respect the line-clamping rules above,
483
+ * so we add this to ensure these fields still get truncated
484
+ */
485
+ max-height: 60px;
486
+ }
487
+
488
+ #collections {
489
+ display: -webkit-box;
490
+ -webkit-box-orient: vertical;
491
+ -webkit-line-clamp: 3;
492
+ overflow: hidden;
493
+ overflow-wrap: anywhere;
494
+ }
495
+
496
+ #collections > a {
497
+ display: inline-block;
498
+ }
499
+
500
+ #icon {
501
+ padding-top: 5px;
502
+ }
503
+
504
+ #description {
505
+ padding-top: 10px;
506
+ }
507
+
508
+ /* Top level container */
509
+ #list-line {
510
+ display: flex;
511
+ }
512
+
513
+ #list-line.mobile {
514
+ flex-direction: column;
515
+ }
516
+
517
+ #list-line.desktop {
518
+ column-gap: 10px;
519
+ }
520
+
521
+ #list-line-top {
522
+ display: flex;
523
+ column-gap: 7px;
524
+ }
525
+
526
+ #list-line-bottom {
527
+ padding-top: 4px;
528
+ }
529
+
530
+ #list-line-right,
531
+ #list-line-top,
532
+ #list-line-bottom {
533
+ width: 100%;
534
+ }
535
+
536
+ /*
537
+ * If the container becomes very tiny, don't let the thumbnail side take
538
+ * up too much space. Shouldn't make a difference on ordinary viewport sizes.
539
+ */
540
+ #list-line-left {
541
+ max-width: 25%;
542
+
543
+ display: flex;
544
+ flex-direction: column;
545
+ row-gap: 5px;
546
+ }
547
+
548
+ div a:hover {
549
+ text-decoration: underline;
550
+ }
551
+
552
+ /* Lines containing multiple div as row */
553
+ #item-line,
554
+ #dates-line,
555
+ #views-line,
556
+ #title-line {
557
+ display: flex;
558
+ flex-direction: row;
559
+ column-gap: 10px;
560
+ }
561
+
562
+ /*
563
+ * With the exception of the title line, allow these to wrap if
564
+ * the space becomes too small to accommodate them together.
565
+ *
566
+ * The title line is excluded because it contains the mediatype icon
567
+ * which we don't want to wrap.
568
+ */
569
+ #item-line,
570
+ #dates-line,
571
+ #views-line {
572
+ flex-wrap: wrap;
573
+ }
574
+
575
+ .capture-dates {
576
+ margin: 0;
577
+ padding: 0;
578
+ list-style-type: none;
579
+ }
580
+
581
+ .capture-dates a:link {
582
+ text-decoration: none;
583
+ color: var(--ia-theme-link-color, #4b64ff);
584
+ }
585
+ .capture-dates a:hover {
586
+ text-decoration: underline;
587
+ }
588
588
  `;
589
589
  }
590
590
  };