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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/dist/src/app-root.js +19 -28
  2. package/dist/src/app-root.js.map +1 -1
  3. package/dist/src/collection-browser.d.ts +14 -10
  4. package/dist/src/collection-browser.js +870 -886
  5. package/dist/src/collection-browser.js.map +1 -1
  6. package/dist/src/collection-facets/facet-row.js +3 -4
  7. package/dist/src/collection-facets/facet-row.js.map +1 -1
  8. package/dist/src/collection-facets/models.js.map +1 -1
  9. package/dist/src/collection-facets/more-facets-content.js +145 -156
  10. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  11. package/dist/src/collection-facets/more-facets-pagination.js +6 -10
  12. package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
  13. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +16 -21
  14. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -1
  15. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +7 -10
  16. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  17. package/dist/src/collection-facets/smart-facets/smart-facet-button.js +3 -2
  18. package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -1
  19. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +9 -11
  20. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  21. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js +7 -7
  22. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -1
  23. package/dist/src/collection-facets/toggle-switch.js +4 -6
  24. package/dist/src/collection-facets/toggle-switch.js.map +1 -1
  25. package/dist/src/collection-facets.js +34 -50
  26. package/dist/src/collection-facets.js.map +1 -1
  27. package/dist/src/combo-box/caret-closed.js +5 -11
  28. package/dist/src/combo-box/caret-closed.js.map +1 -1
  29. package/dist/src/combo-box/caret-open.js +5 -11
  30. package/dist/src/combo-box/caret-open.js.map +1 -1
  31. package/dist/src/combo-box/clear.d.ts +2 -0
  32. package/dist/src/combo-box/clear.js +11 -0
  33. package/dist/src/combo-box/clear.js.map +1 -0
  34. package/dist/src/combo-box/ia-combo-box.d.ts +40 -9
  35. package/dist/src/combo-box/ia-combo-box.js +363 -272
  36. package/dist/src/combo-box/ia-combo-box.js.map +1 -1
  37. package/dist/src/combo-box/models.d.ts +14 -0
  38. package/dist/src/combo-box/models.js +32 -1
  39. package/dist/src/combo-box/models.js.map +1 -1
  40. package/dist/src/data-source/collection-browser-data-source.js +35 -47
  41. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  42. package/dist/src/empty-placeholder.js +19 -18
  43. package/dist/src/empty-placeholder.js.map +1 -1
  44. package/dist/src/expanded-date-picker.js +6 -10
  45. package/dist/src/expanded-date-picker.js.map +1 -1
  46. package/dist/src/language-code-handler/language-code-handler.js +2 -2
  47. package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
  48. package/dist/src/manage/manage-bar.js +86 -92
  49. package/dist/src/manage/manage-bar.js.map +1 -1
  50. package/dist/src/manage/remove-items-modal-content.js +2 -2
  51. package/dist/src/manage/remove-items-modal-content.js.map +1 -1
  52. package/dist/src/models.js +36 -40
  53. package/dist/src/models.js.map +1 -1
  54. package/dist/src/restoration-state-handler.js +9 -10
  55. package/dist/src/restoration-state-handler.js.map +1 -1
  56. package/dist/src/sort-filter-bar/alpha-bar.js +9 -14
  57. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  58. package/dist/src/sort-filter-bar/sort-filter-bar.js +14 -24
  59. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  60. package/dist/src/tiles/base-tile-component.js +1 -2
  61. package/dist/src/tiles/base-tile-component.js.map +1 -1
  62. package/dist/src/tiles/grid/account-tile.js +36 -38
  63. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  64. package/dist/src/tiles/grid/collection-tile.js +79 -82
  65. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  66. package/dist/src/tiles/grid/item-tile.js +154 -164
  67. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  68. package/dist/src/tiles/grid/search-tile.js +42 -43
  69. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  70. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
  71. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  72. package/dist/src/tiles/grid/tile-stats.js +2 -3
  73. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  74. package/dist/src/tiles/hover/hover-pane-controller.js +42 -49
  75. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  76. package/dist/src/tiles/hover/tile-hover-pane.js +113 -114
  77. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
  78. package/dist/src/tiles/image-block.js +5 -8
  79. package/dist/src/tiles/image-block.js.map +1 -1
  80. package/dist/src/tiles/item-image.js +12 -19
  81. package/dist/src/tiles/item-image.js.map +1 -1
  82. package/dist/src/tiles/list/tile-list-compact.js +114 -122
  83. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  84. package/dist/src/tiles/list/tile-list.js +326 -347
  85. package/dist/src/tiles/list/tile-list.js.map +1 -1
  86. package/dist/src/tiles/overlay/icon-overlay.js +1 -2
  87. package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
  88. package/dist/src/tiles/overlay/text-overlay.js +2 -4
  89. package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
  90. package/dist/src/tiles/text-snippet-block.js +2 -4
  91. package/dist/src/tiles/text-snippet-block.js.map +1 -1
  92. package/dist/src/tiles/tile-dispatcher.js +233 -241
  93. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  94. package/dist/src/tiles/tile-display-value-provider.js +5 -9
  95. package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
  96. package/dist/src/tiles/tile-mediatype-icon.js +12 -19
  97. package/dist/src/tiles/tile-mediatype-icon.js.map +1 -1
  98. package/dist/src/utils/collapse-repeated-quotes.js +1 -1
  99. package/dist/src/utils/collapse-repeated-quotes.js.map +1 -1
  100. package/dist/src/utils/facet-utils.js +3 -5
  101. package/dist/src/utils/facet-utils.js.map +1 -1
  102. package/dist/src/utils/format-count.js +10 -10
  103. package/dist/src/utils/format-count.js.map +1 -1
  104. package/dist/src/utils/format-date.js.map +1 -1
  105. package/dist/src/utils/resolve-mediatype.js +2 -3
  106. package/dist/src/utils/resolve-mediatype.js.map +1 -1
  107. package/dist/test/collection-browser.test.js +131 -185
  108. package/dist/test/collection-browser.test.js.map +1 -1
  109. package/dist/test/collection-facets/facet-row.test.js +60 -75
  110. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  111. package/dist/test/collection-facets/facets-template.test.js +17 -23
  112. package/dist/test/collection-facets/facets-template.test.js.map +1 -1
  113. package/dist/test/collection-facets/more-facets-content.test.js +22 -32
  114. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
  115. package/dist/test/collection-facets/more-facets-pagination.test.js +16 -22
  116. package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
  117. package/dist/test/collection-facets/toggle-switch.test.js +22 -19
  118. package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
  119. package/dist/test/collection-facets.test.js +80 -97
  120. package/dist/test/collection-facets.test.js.map +1 -1
  121. package/dist/test/empty-placeholder.test.js +11 -17
  122. package/dist/test/empty-placeholder.test.js.map +1 -1
  123. package/dist/test/expanded-date-picker.test.js +8 -14
  124. package/dist/test/expanded-date-picker.test.js.map +1 -1
  125. package/dist/test/icon-overlay.test.js +7 -6
  126. package/dist/test/icon-overlay.test.js.map +1 -1
  127. package/dist/test/image-block.test.js +16 -26
  128. package/dist/test/image-block.test.js.map +1 -1
  129. package/dist/test/item-image.test.js +23 -32
  130. package/dist/test/item-image.test.js.map +1 -1
  131. package/dist/test/manage/manage-bar.test.js +21 -33
  132. package/dist/test/manage/manage-bar.test.js.map +1 -1
  133. package/dist/test/manage/remove-items-modal-content.test.js +10 -15
  134. package/dist/test/manage/remove-items-modal-content.test.js.map +1 -1
  135. package/dist/test/mocks/mock-search-service.js +2 -3
  136. package/dist/test/mocks/mock-search-service.js.map +1 -1
  137. package/dist/test/restoration-state-handler.test.js +13 -21
  138. package/dist/test/restoration-state-handler.test.js.map +1 -1
  139. package/dist/test/review-block.test.js +16 -18
  140. package/dist/test/review-block.test.js.map +1 -1
  141. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +2 -3
  142. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -1
  143. package/dist/test/sort-filter-bar/alpha-bar.test.js +18 -24
  144. package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
  145. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +178 -180
  146. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  147. package/dist/test/text-overlay.test.js +16 -15
  148. package/dist/test/text-overlay.test.js.map +1 -1
  149. package/dist/test/text-snippet-block.test.js +14 -19
  150. package/dist/test/text-snippet-block.test.js.map +1 -1
  151. package/dist/test/tile-stats.test.js +73 -34
  152. package/dist/test/tile-stats.test.js.map +1 -1
  153. package/dist/test/tiles/grid/account-tile.test.js +25 -25
  154. package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
  155. package/dist/test/tiles/grid/collection-tile.test.js +13 -19
  156. package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
  157. package/dist/test/tiles/grid/item-tile.test.js +141 -168
  158. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  159. package/dist/test/tiles/grid/search-tile.test.js +9 -13
  160. package/dist/test/tiles/grid/search-tile.test.js.map +1 -1
  161. package/dist/test/tiles/hover/hover-pane-controller.test.js +50 -62
  162. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
  163. package/dist/test/tiles/hover/tile-hover-pane.test.js +12 -16
  164. package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
  165. package/dist/test/tiles/list/tile-list-compact.test.js +104 -118
  166. package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
  167. package/dist/test/tiles/list/tile-list.test.js +202 -231
  168. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  169. package/dist/test/tiles/tile-dispatcher.test.js +97 -110
  170. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
  171. package/dist/test/tiles/tile-mediatype-icon.test.js +12 -24
  172. package/dist/test/tiles/tile-mediatype-icon.test.js.map +1 -1
  173. package/dist/test/utils/format-date.test.js.map +1 -1
  174. package/index.html +1 -1
  175. package/package.json +5 -3
  176. package/src/collection-browser.ts +3060 -3030
  177. package/src/collection-facets/models.ts +10 -10
  178. package/src/collection-facets/more-facets-content.ts +639 -639
  179. package/src/collection-facets.ts +1 -1
  180. package/src/combo-box/caret-closed.ts +5 -11
  181. package/src/combo-box/caret-open.ts +5 -11
  182. package/src/combo-box/clear.ts +11 -0
  183. package/src/combo-box/ia-combo-box.ts +1288 -1180
  184. package/src/combo-box/models.ts +31 -1
  185. package/src/manage/manage-bar.ts +247 -247
  186. package/src/restoration-state-handler.ts +5 -1
  187. package/src/tiles/base-tile-component.ts +65 -65
  188. package/src/tiles/grid/account-tile.ts +113 -113
  189. package/src/tiles/grid/collection-tile.ts +163 -163
  190. package/src/tiles/grid/item-tile.ts +340 -340
  191. package/src/tiles/grid/search-tile.ts +90 -90
  192. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
  193. package/src/tiles/hover/hover-pane-controller.ts +613 -613
  194. package/src/tiles/hover/tile-hover-pane.ts +184 -184
  195. package/src/tiles/list/tile-list-compact.ts +239 -239
  196. package/src/tiles/list/tile-list.ts +700 -700
  197. package/src/tiles/tile-dispatcher.ts +517 -517
  198. package/src/utils/format-date.ts +62 -62
  199. package/test/collection-facets/facet-row.test.ts +375 -375
  200. package/test/collection-facets.test.ts +928 -928
  201. package/test/tiles/grid/item-tile.test.ts +520 -520
  202. package/test/tiles/hover/hover-pane-controller.test.ts +418 -418
  203. package/test/tiles/list/tile-list-compact.test.ts +282 -282
  204. package/test/tiles/list/tile-list.test.ts +552 -552
  205. package/test/tiles/tile-dispatcher.test.ts +283 -283
  206. package/test/utils/format-date.test.ts +89 -89
  207. package/tsconfig.json +8 -3
  208. package/vite.config.ts +29 -22
@@ -28,57 +28,54 @@ let CollectionTile = class CollectionTile extends BaseTileComponent {
28
28
  this.showInfoButton = false;
29
29
  }
30
30
  render() {
31
- return html `
32
- <div class="container">
33
- ${this.infoButtonTemplate}
34
- <div class="tile-details">
35
- <div class="item-info">
36
- ${this.getImageBlockTemplate} ${this.getTitleTemplate}
37
- </div>
38
- </div>
39
-
40
- ${this.getTileStatsTemplate}
41
- </div>
31
+ return html `
32
+ <div class="container">
33
+ ${this.infoButtonTemplate}
34
+ <div class="tile-details">
35
+ <div class="item-info">
36
+ ${this.getImageBlockTemplate} ${this.getTitleTemplate}
37
+ </div>
38
+ </div>
39
+
40
+ ${this.getTileStatsTemplate}
41
+ </div>
42
42
  `;
43
43
  }
44
44
  get getImageBlockTemplate() {
45
- return html `
46
- <image-block
47
- .model=${this.model}
48
- .baseImageUrl=${this.baseImageUrl}
49
- .viewSize=${'grid'}
50
- .suppressBlurring=${this.suppressBlurring}
51
- >
52
- </image-block>
45
+ return html `
46
+ <image-block
47
+ .model=${this.model}
48
+ .baseImageUrl=${this.baseImageUrl}
49
+ .viewSize=${'grid'}
50
+ .suppressBlurring=${this.suppressBlurring}
51
+ >
52
+ </image-block>
53
53
  `;
54
54
  }
55
55
  get getTitleTemplate() {
56
- var _a;
57
- return html `<div id="title">
58
- <h3 class="truncated">${(_a = this.model) === null || _a === void 0 ? void 0 : _a.title}</h3>
56
+ return html `<div id="title">
57
+ <h3 class="truncated">${this.model?.title}</h3>
59
58
  </div>`;
60
59
  }
61
60
  get getTileStatsTemplate() {
62
- return html `
63
- <div id="item-stats">
64
- <div id="item-mediatype">${collectionIcon}</div>
65
-
66
- <div id="stats-row">
67
- ${this.getItemsTemplate} ${this.getSizeTemplate}
68
- </div>
69
- </div>
61
+ return html `
62
+ <div id="item-stats">
63
+ <div id="item-mediatype">${collectionIcon}</div>
64
+
65
+ <div id="stats-row">
66
+ ${this.getItemsTemplate} ${this.getSizeTemplate}
67
+ </div>
68
+ </div>
70
69
  `;
71
70
  }
72
71
  get getItemsTemplate() {
73
- var _a, _b;
74
- const collectionItems = (_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.itemCount) === null || _b === void 0 ? void 0 : _b.toLocaleString();
75
- return html `<span id="item-count"
76
- >${collectionItems} item${Number(collectionItems) !== 1 ? 's' : ''}</span
72
+ const collectionItems = this.model?.itemCount?.toLocaleString();
73
+ return html `<span id="item-count"
74
+ >${collectionItems} item${Number(collectionItems) !== 1 ? 's' : ''}</span
77
75
  >`;
78
76
  }
79
77
  get getSizeTemplate() {
80
- var _a, _b;
81
- const collectionSize = (_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.collectionSize) !== null && _b !== void 0 ? _b : 0;
78
+ const collectionSize = this.model?.collectionSize ?? 0;
82
79
  return collectionSize
83
80
  ? html `<span id="item-size">${formatUnitSize(collectionSize, 1)}</span>`
84
81
  : ``;
@@ -86,9 +83,9 @@ let CollectionTile = class CollectionTile extends BaseTileComponent {
86
83
  get infoButtonTemplate() {
87
84
  // &#9432; is an information icon
88
85
  return this.showInfoButton
89
- ? html `<button class="info-button" @click=${this.infoButtonPressed}>
90
- &#9432;
91
- <span class="sr-only">${msg('More info')}</span>
86
+ ? html `<button class="info-button" @click=${this.infoButtonPressed}>
87
+ &#9432;
88
+ <span class="sr-only">${msg('More info')}</span>
92
89
  </button>`
93
90
  : nothing;
94
91
  }
@@ -103,49 +100,49 @@ let CollectionTile = class CollectionTile extends BaseTileComponent {
103
100
  const whiteColor = css `#fff`;
104
101
  return [
105
102
  baseTileStyles,
106
- css `
107
- .container {
108
- background-color: ${tileBackgroundColor};
109
- border: 1px solid ${tileBorderColor};
110
- }
111
-
112
- .item-info {
113
- flex-grow: initial;
114
- }
115
-
116
- h4.truncated,
117
- h3.truncated {
118
- color: ${whiteColor};
119
- }
120
-
121
- #item-mediatype svg {
122
- filter: invert(100%);
123
- height: 2.5rem;
124
- align-items: baseline;
125
- }
126
-
127
- .container:hover > #title {
128
- text-decoration: underline;
129
- }
130
-
131
- /* this is a workaround for Safari 15 where the hover effects are not working */
132
- image-block:hover > #title {
133
- text-decoration: underline;
134
- }
135
-
136
- #item-stats {
137
- display: flex;
138
- padding: 0 5px 5px;
139
- align-items: center;
140
- }
141
-
142
- #stats-row {
143
- display: flex;
144
- align-items: baseline;
145
- color: ${whiteColor};
146
- flex-direction: column;
147
- margin-left: 10px;
148
- }
103
+ css `
104
+ .container {
105
+ background-color: ${tileBackgroundColor};
106
+ border: 1px solid ${tileBorderColor};
107
+ }
108
+
109
+ .item-info {
110
+ flex-grow: initial;
111
+ }
112
+
113
+ h4.truncated,
114
+ h3.truncated {
115
+ color: ${whiteColor};
116
+ }
117
+
118
+ #item-mediatype svg {
119
+ filter: invert(100%);
120
+ height: 2.5rem;
121
+ align-items: baseline;
122
+ }
123
+
124
+ .container:hover > #title {
125
+ text-decoration: underline;
126
+ }
127
+
128
+ /* this is a workaround for Safari 15 where the hover effects are not working */
129
+ image-block:hover > #title {
130
+ text-decoration: underline;
131
+ }
132
+
133
+ #item-stats {
134
+ display: flex;
135
+ padding: 0 5px 5px;
136
+ align-items: center;
137
+ }
138
+
139
+ #stats-row {
140
+ display: flex;
141
+ align-items: baseline;
142
+ color: ${whiteColor};
143
+ flex-direction: column;
144
+ margin-left: 10px;
145
+ }
149
146
  `,
150
147
  ];
151
148
  }
@@ -1 +1 @@
1
- {"version":3,"file":"collection-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/collection-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CA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B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sDAAwB;AAjBzC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAwJ1B","sourcesContent":["import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';\r\nimport { customElement, property } from 'lit/decorators.js';\r\nimport { msg } from '@lit/localize';\r\nimport { collectionIcon } from '../../assets/img/icons/mediatype/collection';\r\nimport { formatUnitSize } from '../../utils/format-unit-size';\r\nimport { baseTileStyles } from './styles/tile-grid-shared-styles';\r\nimport { BaseTileComponent } from '../base-tile-component';\r\nimport '../image-block';\r\n\r\n@customElement('collection-tile')\r\nexport class CollectionTile 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 * - 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 render() {\r\n return html`\r\n <div class=\"container\">\r\n ${this.infoButtonTemplate}\r\n <div class=\"tile-details\">\r\n <div class=\"item-info\">\r\n ${this.getImageBlockTemplate} ${this.getTitleTemplate}\r\n </div>\r\n </div>\r\n\r\n ${this.getTileStatsTemplate}\r\n </div>\r\n `;\r\n }\r\n\r\n private get getImageBlockTemplate(): TemplateResult {\r\n return html`\r\n <image-block\r\n .model=${this.model}\r\n .baseImageUrl=${this.baseImageUrl}\r\n .viewSize=${'grid'}\r\n .suppressBlurring=${this.suppressBlurring}\r\n >\r\n </image-block>\r\n `;\r\n }\r\n\r\n private get getTitleTemplate() {\r\n return html`<div id=\"title\">\r\n <h3 class=\"truncated\">${this.model?.title}</h3>\r\n </div>`;\r\n }\r\n\r\n private get getTileStatsTemplate() {\r\n return html`\r\n <div id=\"item-stats\">\r\n <div id=\"item-mediatype\">${collectionIcon}</div>\r\n\r\n <div id=\"stats-row\">\r\n ${this.getItemsTemplate} ${this.getSizeTemplate}\r\n </div>\r\n </div>\r\n `;\r\n }\r\n\r\n private get getItemsTemplate() {\r\n const collectionItems = this.model?.itemCount?.toLocaleString();\r\n\r\n return html`<span id=\"item-count\"\r\n >${collectionItems} item${Number(collectionItems) !== 1 ? 's' : ''}</span\r\n >`;\r\n }\r\n\r\n private get getSizeTemplate() {\r\n const collectionSize = this.model?.collectionSize ?? 0;\r\n\r\n return collectionSize\r\n ? html`<span id=\"item-size\">${formatUnitSize(collectionSize, 1)}</span>`\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 infoButtonPressed(e: PointerEvent) {\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 static get styles(): CSSResultGroup {\r\n const tileBorderColor = css`var(--tileBorderColor, #555555)`;\r\n const tileBackgroundColor = css`var(--tileBackgroundColor, #666666)`;\r\n const whiteColor = css`#fff`;\r\n\r\n return [\r\n baseTileStyles,\r\n css`\r\n .container {\r\n background-color: ${tileBackgroundColor};\r\n border: 1px solid ${tileBorderColor};\r\n }\r\n\r\n .item-info {\r\n flex-grow: initial;\r\n }\r\n\r\n h4.truncated,\r\n h3.truncated {\r\n color: ${whiteColor};\r\n }\r\n\r\n #item-mediatype svg {\r\n filter: invert(100%);\r\n height: 2.5rem;\r\n align-items: baseline;\r\n }\r\n\r\n .container:hover > #title {\r\n text-decoration: underline;\r\n }\r\n\r\n /* this is a workaround for Safari 15 where the hover effects are not working */\r\n image-block:hover > #title {\r\n text-decoration: underline;\r\n }\r\n\r\n #item-stats {\r\n display: flex;\r\n padding: 0 5px 5px;\r\n align-items: center;\r\n }\r\n\r\n #stats-row {\r\n display: flex;\r\n align-items: baseline;\r\n color: ${whiteColor};\r\n flex-direction: column;\r\n margin-left: 10px;\r\n }\r\n `,\r\n ];\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"collection-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/collection-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,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,gBAAgB,CAAC;AAGjB,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,iBAAiB;IAA9C;QACL;;;;;;;;;;;;;;WAcG;;QAE0B,mBAAc,GAAG,KAAK,CAAC;IAuItD,CAAC;IArIC,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,kBAAkB;;;cAGnB,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,gBAAgB;;;;UAIvD,IAAI,CAAC,oBAAoB;;KAE9B,CAAC;IACJ,CAAC;IAED,IAAY,qBAAqB;QAC/B,OAAO,IAAI,CAAA;;iBAEE,IAAI,CAAC,KAAK;wBACH,IAAI,CAAC,YAAY;oBACrB,MAAM;4BACE,IAAI,CAAC,g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AK,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,KAAK,MAAM;QACf,MAAM,eAAe,GAAG,GAAG,CAAA,iCAAiC,CAAC;QAC7D,MAAM,mBAAmB,GAAG,GAAG,CAAA,qCAAqC,CAAC;QACrE,MAAM,UAAU,GAAG,GAAG,CAAA,MAAM,CAAC;QAE7B,OAAO;YACL,cAAc;YACd,GAAG,CAAA;;8BAEqB,mBAAmB;8BACnB,eAAe;;;;;;;;;mBAS1B,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA2BV,UAAU;;;;OAItB;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAvI8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sDAAwB;AAjBzC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAwJ1B","sourcesContent":["import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { msg } from '@lit/localize';\nimport { collectionIcon } from '../../assets/img/icons/mediatype/collection';\nimport { formatUnitSize } from '../../utils/format-unit-size';\nimport { baseTileStyles } from './styles/tile-grid-shared-styles';\nimport { BaseTileComponent } from '../base-tile-component';\nimport '../image-block';\n\n@customElement('collection-tile')\nexport class CollectionTile 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 * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n * - suppressBlurring = false;\n * - useLocalTime = false;\n */\n\n @property({ type: Boolean }) showInfoButton = false;\n\n render() {\n return html`\n <div class=\"container\">\n ${this.infoButtonTemplate}\n <div class=\"tile-details\">\n <div class=\"item-info\">\n ${this.getImageBlockTemplate} ${this.getTitleTemplate}\n </div>\n </div>\n\n ${this.getTileStatsTemplate}\n </div>\n `;\n }\n\n private get getImageBlockTemplate(): TemplateResult {\n return html`\n <image-block\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}\n .viewSize=${'grid'}\n .suppressBlurring=${this.suppressBlurring}\n >\n </image-block>\n `;\n }\n\n private get getTitleTemplate() {\n return html`<div id=\"title\">\n <h3 class=\"truncated\">${this.model?.title}</h3>\n </div>`;\n }\n\n private get getTileStatsTemplate() {\n return html`\n <div id=\"item-stats\">\n <div id=\"item-mediatype\">${collectionIcon}</div>\n\n <div id=\"stats-row\">\n ${this.getItemsTemplate} ${this.getSizeTemplate}\n </div>\n </div>\n `;\n }\n\n private get getItemsTemplate() {\n const collectionItems = this.model?.itemCount?.toLocaleString();\n\n return html`<span id=\"item-count\"\n >${collectionItems} item${Number(collectionItems) !== 1 ? 's' : ''}</span\n >`;\n }\n\n private get getSizeTemplate() {\n const collectionSize = this.model?.collectionSize ?? 0;\n\n return collectionSize\n ? html`<span id=\"item-size\">${formatUnitSize(collectionSize, 1)}</span>`\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 infoButtonPressed(e: PointerEvent) {\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 static get styles(): CSSResultGroup {\n const tileBorderColor = css`var(--tileBorderColor, #555555)`;\n const tileBackgroundColor = css`var(--tileBackgroundColor, #666666)`;\n const whiteColor = css`#fff`;\n\n return [\n baseTileStyles,\n css`\n .container {\n background-color: ${tileBackgroundColor};\n border: 1px solid ${tileBorderColor};\n }\n\n .item-info {\n flex-grow: initial;\n }\n\n h4.truncated,\n h3.truncated {\n color: ${whiteColor};\n }\n\n #item-mediatype svg {\n filter: invert(100%);\n height: 2.5rem;\n align-items: baseline;\n }\n\n .container:hover > #title {\n text-decoration: underline;\n }\n\n /* this is a workaround for Safari 15 where the hover effects are not working */\n image-block:hover > #title {\n text-decoration: underline;\n }\n\n #item-stats {\n display: flex;\n padding: 0 5px 5px;\n align-items: center;\n }\n\n #stats-row {\n display: flex;\n align-items: baseline;\n color: ${whiteColor};\n flex-direction: column;\n margin-left: 10px;\n }\n `,\n ];\n }\n}\n"]}
@@ -38,38 +38,37 @@ let ItemTile = class ItemTile extends BaseTileComponent {
38
38
  this.simpleLayoutType = 'none';
39
39
  }
40
40
  render() {
41
- var _a;
42
- const itemTitle = (_a = this.model) === null || _a === void 0 ? void 0 : _a.title;
41
+ const itemTitle = this.model?.title;
43
42
  const containerClasses = classMap({
44
43
  container: true,
45
44
  simple: this.simpleLayoutType !== 'none',
46
45
  'stats-only': this.simpleLayoutType === 'stats-only',
47
46
  'snippets-only': this.simpleLayoutType === 'snippets-only',
48
47
  });
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}
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}
63
62
  ${this.isSortedByDate
64
63
  ? this.sortedDateInfoTemplate
65
- : this.creatorTemplate}
66
- ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}
67
- ${this.reviewBlockTemplate}
68
- </div>
69
-
70
- ${this.tileStatsTemplate}
71
- </div>
72
- </div>
64
+ : this.creatorTemplate}
65
+ ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}
66
+ ${this.reviewBlockTemplate}
67
+ </div>
68
+
69
+ ${this.tileStatsTemplate}
70
+ </div>
71
+ </div>
73
72
  `;
74
73
  }
75
74
  /**
@@ -79,35 +78,34 @@ let ItemTile = class ItemTile extends BaseTileComponent {
79
78
  const displayedCreator = this.displayValueProvider.firstCreatorMatchingFilter;
80
79
  if (!displayedCreator)
81
80
  return nothing;
82
- return html `
83
- <div class="created-by">
84
- <span class="truncated" title=${displayedCreator}>
85
- by&nbsp;${displayedCreator}
86
- </span>
87
- </div>
81
+ return html `
82
+ <div class="created-by">
83
+ <span class="truncated" title=${displayedCreator}>
84
+ by&nbsp;${displayedCreator}
85
+ </span>
86
+ </div>
88
87
  `;
89
88
  }
90
89
  get imageBlockTemplate() {
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>
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>
102
101
  `;
103
102
  }
104
103
  get sortedDateInfoTemplate() {
105
- var _a, _b, _c, _d, _e;
106
104
  let sortedValue;
107
105
  let format = 'long';
108
- switch ((_a = this.effectiveSort) === null || _a === void 0 ? void 0 : _a.field) {
106
+ switch (this.effectiveSort?.field) {
109
107
  case 'date': {
110
- const datePublished = (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished;
108
+ const datePublished = this.model?.datePublished;
111
109
  sortedValue = { field: 'published', value: datePublished };
112
110
  if (isFirstMillisecondOfUTCYear(datePublished)) {
113
111
  format = 'year-only';
@@ -115,123 +113,115 @@ let ItemTile = class ItemTile extends BaseTileComponent {
115
113
  break;
116
114
  }
117
115
  case 'reviewdate':
118
- sortedValue = { field: 'reviewed', value: (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed };
116
+ sortedValue = { field: 'reviewed', value: this.model?.dateReviewed };
119
117
  break;
120
118
  case 'addeddate':
121
- sortedValue = { field: 'added', value: (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded };
119
+ sortedValue = { field: 'added', value: this.model?.dateAdded };
122
120
  break;
123
121
  case 'publicdate':
124
- sortedValue = { field: 'archived', value: (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived };
122
+ sortedValue = { field: 'archived', value: this.model?.dateArchived };
125
123
  break;
126
124
  default:
127
125
  break;
128
126
  }
129
- if (!(sortedValue === null || sortedValue === void 0 ? void 0 : sortedValue.value)) {
127
+ if (!sortedValue?.value) {
130
128
  return nothing;
131
129
  }
132
130
  const formattedDate = this.getFormattedDate(sortedValue.value, format);
133
- return html `
134
- <div class="date-sorted-by truncated">
135
- <span>${sortedValue.field} ${formattedDate}</span>
136
- </div>
131
+ return html `
132
+ <div class="date-sorted-by truncated">
133
+ <span>${sortedValue.field} ${formattedDate}</span>
134
+ </div>
137
135
  `;
138
136
  }
139
137
  get infoButtonTemplate() {
140
138
  // &#9432; is an information icon
141
139
  return this.showInfoButton
142
- ? html `<button class="info-button" @click=${this.infoButtonPressed}>
143
- &#9432;
144
- <span class="sr-only">${msg('More info')}</span>
140
+ ? html `<button class="info-button" @click=${this.infoButtonPressed}>
141
+ &#9432;
142
+ <span class="sr-only">${msg('More info')}</span>
145
143
  </button>`
146
144
  : nothing;
147
145
  }
148
146
  get reviewBlockTemplate() {
149
- var _a;
150
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.review))
147
+ if (!this.model?.review)
151
148
  return nothing;
152
149
  const { reviewtitle, reviewbody, stars } = this.model.review;
153
- return html `
154
- <review-block
155
- viewsize="grid"
156
- title=${ifDefined(reviewtitle)}
157
- body=${ifDefined(reviewbody)}
158
- starRating=${ifDefined(stars)}
159
- >
160
- </review-block>
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>
161
158
  `;
162
159
  }
163
160
  get textSnippetsTemplate() {
164
- var _a;
165
161
  if (!this.hasSnippets || this.simpleLayoutType === 'stats-only')
166
162
  return nothing;
167
- return html `
168
- <text-snippet-block viewsize="grid" .snippets=${(_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets}>
169
- </text-snippet-block>
163
+ return html `
164
+ <text-snippet-block viewsize="grid" .snippets=${this.model?.snippets}>
165
+ </text-snippet-block>
170
166
  `;
171
167
  }
172
168
  get volumeIssueTemplate() {
173
- var _a, _b, _c, _d;
174
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.volume) || !((_b = this.model) === null || _b === void 0 ? void 0 : _b.issue))
169
+ if (!this.model?.volume || !this.model?.issue)
175
170
  return nothing;
176
- return html `
177
- <div class="volume-issue">
178
- <span class="truncated" title="volume|issue">
179
- Volume&nbsp;${(_c = this.model) === null || _c === void 0 ? void 0 : _c.volume}, Issue&nbsp;${(_d = this.model) === null || _d === void 0 ? void 0 : _d.issue}
180
- </span>
181
- </div>
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>
182
177
  `;
183
178
  }
184
179
  get webArchivesCaptureDatesTemplate() {
185
- var _a;
186
- if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.captureDates) || !this.model.title)
180
+ if (!this.model?.captureDates || !this.model.title)
187
181
  return nothing;
188
- return html `
189
- <ul class="capture-dates">
190
- ${map(this.model.captureDates, date => html `<li>
191
- ${this.displayValueProvider.webArchivesCaptureLink(this.model.title, date)}
192
- </li>`)}
193
- </ul>
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>
194
188
  `;
195
189
  }
196
190
  /**
197
191
  * Template for the stats row along the bottom of the tile.
198
192
  */
199
193
  get tileStatsTemplate() {
200
- var _a, _b, _c, _d, _e, _f, _g;
201
194
  if (this.simpleLayoutType === 'snippets-only')
202
195
  return nothing;
203
- const effectiveSort = (_a = this.sortParam) !== null && _a !== void 0 ? _a : this.defaultSortParam;
204
- const [viewCount, viewLabel] = (effectiveSort === null || effectiveSort === void 0 ? void 0 : effectiveSort.field) === 'week'
205
- ? [(_b = this.model) === null || _b === void 0 ? void 0 : _b.weeklyViewCount, 'weekly views']
206
- : [(_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount, 'all-time views'];
207
- return html `
208
- <tile-stats
209
- .model=${this.model}
210
- .mediatype=${(_d = this.model) === null || _d === void 0 ? void 0 : _d.mediatype}
211
- .viewCount=${viewCount}
212
- .viewLabel=${viewLabel}
213
- .favCount=${(_e = this.model) === null || _e === void 0 ? void 0 : _e.favCount}
214
- .commentCount=${(_f = this.model) === null || _f === void 0 ? void 0 : _f.commentCount}
215
- .tvClipCount=${(_g = this.model) === null || _g === void 0 ? void 0 : _g.tvClipCount}
216
- .showTvClips=${this.showTvClips}
217
- >
218
- </tile-stats>
196
+ const effectiveSort = this.sortParam ?? this.defaultSortParam;
197
+ const [viewCount, viewLabel] = effectiveSort?.field === 'week'
198
+ ? [this.model?.weeklyViewCount, 'weekly views']
199
+ : [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>
219
212
  `;
220
213
  }
221
214
  get isSortedByDate() {
222
- var _a;
223
- return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes((_a = this.effectiveSort) === null || _a === void 0 ? void 0 : _a.field);
215
+ return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(this.effectiveSort?.field);
224
216
  }
225
217
  /**
226
218
  * Returns the active sort param if one is set, or the default sort param otherwise.
227
219
  */
228
220
  get effectiveSort() {
229
- var _a;
230
- return (_a = this.sortParam) !== null && _a !== void 0 ? _a : this.defaultSortParam;
221
+ return this.sortParam ?? this.defaultSortParam;
231
222
  }
232
223
  get hasSnippets() {
233
- var _a, _b;
234
- return !!((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets) === null || _b === void 0 ? void 0 : _b.length);
224
+ return !!this.model?.snippets?.length;
235
225
  }
236
226
  infoButtonPressed(e) {
237
227
  e.preventDefault();
@@ -245,62 +235,62 @@ let ItemTile = class ItemTile extends BaseTileComponent {
245
235
  const tileBorderColor = css `var(--tileBorderColor, #dddddd)`;
246
236
  return [
247
237
  baseTileStyles,
248
- css `
249
- a:link {
250
- text-decoration: none;
251
- color: var(--ia-theme-link-color, #4b64ff);
252
- }
253
- a:hover {
254
- text-decoration: underline;
255
- }
256
-
257
- .container {
258
- border: 1px solid ${tileBorderColor};
259
- }
260
-
261
- .simple #title > .truncated {
262
- -webkit-line-clamp: 2;
263
- }
264
-
265
- .simple .created-by > .truncated,
266
- .simple .date-sorted-by > .truncated,
267
- .simple .volume-issue > .truncated {
268
- -webkit-line-clamp: 1;
269
- }
270
-
271
- .simple.snippets-only .item-info {
272
- padding-bottom: 5px;
273
- }
274
-
275
- .simple.snippets-only text-snippet-block {
276
- margin-top: auto; /* Force the snippets to the bottom of the tile */
277
- }
278
-
279
- .capture-dates {
280
- margin: 0;
281
- padding: 0 5px;
282
- list-style-type: none;
283
- }
284
-
285
- review-block,
286
- text-snippet-block {
287
- --containerLeftMargin: 5px;
288
- --containerTopMargin: 5px;
289
- }
290
-
291
- /**
292
- * iOS Safari long-press on tiles (to bring up hover pane)
293
- * gets messy without this
294
- */
295
- @media screen and (pointer: coarse) and (hover: none) {
296
- .container {
297
- -webkit-touch-callout: none;
298
- }
299
-
300
- .truncated {
301
- -webkit-touch-callout: default;
302
- }
303
- }
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
+ }
304
294
  `,
305
295
  ];
306
296
  }