@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
@@ -7,7 +7,6 @@ export class HoverPaneController {
7
7
  host,
8
8
  /** Options for adjusting the hover pane behavior (offsets, delays, etc.) */
9
9
  options = {}) {
10
- var _a, _b, _c, _d, _e, _f, _g;
11
10
  this.host = host;
12
11
  /**
13
12
  * The breakpoint (in pixels) below which the mobile interface should be used.
@@ -107,13 +106,12 @@ export class HoverPaneController {
107
106
  */
108
107
  // NB: Arrow function so 'this' remains bound to the controller
109
108
  this.handleMouseMove = (e) => {
110
- var _a;
111
109
  // The mouse is within the tile, so abort any pending removal of the hover pane
112
110
  clearTimeout(this.hideTimer);
113
111
  // If the hover pane is currently fading out, just make it fade back in where it is
114
112
  if (this.hoverPaneState === 'fading-out') {
115
113
  this.hoverPaneState = 'shown';
116
- (_a = this.hoverPane) === null || _a === void 0 ? void 0 : _a.classList.add('fade-in');
114
+ this.hoverPane?.classList.add('fade-in');
117
115
  }
118
116
  // Restart the timer to show the hover pane anytime the mouse moves within the tile
119
117
  if (this.hoverPaneState === 'hidden') {
@@ -183,13 +181,13 @@ export class HoverPaneController {
183
181
  }
184
182
  e.stopPropagation();
185
183
  };
186
- this.mobileBreakpoint = (_a = options.mobileBreakpoint) !== null && _a !== void 0 ? _a : this.mobileBreakpoint;
187
- this.offsetX = (_b = options.offsetX) !== null && _b !== void 0 ? _b : this.offsetX;
188
- this.offsetY = (_c = options.offsetY) !== null && _c !== void 0 ? _c : this.offsetY;
189
- this.showDelay = (_d = options.showDelay) !== null && _d !== void 0 ? _d : this.showDelay;
190
- this.hideDelay = (_e = options.hideDelay) !== null && _e !== void 0 ? _e : this.hideDelay;
191
- this.longPressDelay = (_f = options.longPressDelay) !== null && _f !== void 0 ? _f : this.longPressDelay;
192
- this.enableLongPress = (_g = options.enableLongPress) !== null && _g !== void 0 ? _g : this.enableLongPress;
184
+ this.mobileBreakpoint = options.mobileBreakpoint ?? this.mobileBreakpoint;
185
+ this.offsetX = options.offsetX ?? this.offsetX;
186
+ this.offsetY = options.offsetY ?? this.offsetY;
187
+ this.showDelay = options.showDelay ?? this.showDelay;
188
+ this.hideDelay = options.hideDelay ?? this.hideDelay;
189
+ this.longPressDelay = options.longPressDelay ?? this.longPressDelay;
190
+ this.enableLongPress = options.enableLongPress ?? this.enableLongPress;
193
191
  this.host.addController(this);
194
192
  }
195
193
  hostConnected() {
@@ -204,41 +202,39 @@ export class HoverPaneController {
204
202
  }
205
203
  /** @inheritdoc */
206
204
  getTemplate() {
207
- var _a, _b, _c, _d, _e, _f, _g;
208
205
  this.hoverPaneProps = this.host.getHoverPaneProps();
209
206
  return this.shouldRenderHoverPane
210
- ? html `
211
- ${this.touchBackdropTemplate}
212
- <tile-hover-pane
213
- popover
214
- tabindex="-1"
215
- aria-describedby="tile-hover-pane-aria-description"
216
- .model=${(_a = this.hoverPaneProps) === null || _a === void 0 ? void 0 : _a.model}
217
- .baseNavigationUrl=${(_b = this.hoverPaneProps) === null || _b === void 0 ? void 0 : _b.baseNavigationUrl}
218
- .baseImageUrl=${(_c = this.hoverPaneProps) === null || _c === void 0 ? void 0 : _c.baseImageUrl}
219
- .loggedIn=${(_d = this.hoverPaneProps) === null || _d === void 0 ? void 0 : _d.loggedIn}
220
- .suppressBlurring=${(_e = this.hoverPaneProps) === null || _e === void 0 ? void 0 : _e.suppressBlurring}
221
- .sortParam=${(_f = this.hoverPaneProps) === null || _f === void 0 ? void 0 : _f.sortParam}
222
- .collectionTitles=${(_g = this.hoverPaneProps) === null || _g === void 0 ? void 0 : _g.collectionTitles}
223
- .mobileBreakpoint=${this.mobileBreakpoint}
224
- .currentWidth=${window.innerWidth}
225
- ></tile-hover-pane>
226
- <div id="tile-hover-pane-aria-description" class="sr-only">
227
- ${msg('Press Up Arrow to exit item detail preview')}
228
- </div>
207
+ ? html `
208
+ ${this.touchBackdropTemplate}
209
+ <tile-hover-pane
210
+ popover
211
+ tabindex="-1"
212
+ aria-describedby="tile-hover-pane-aria-description"
213
+ .model=${this.hoverPaneProps?.model}
214
+ .baseNavigationUrl=${this.hoverPaneProps?.baseNavigationUrl}
215
+ .baseImageUrl=${this.hoverPaneProps?.baseImageUrl}
216
+ .loggedIn=${this.hoverPaneProps?.loggedIn}
217
+ .suppressBlurring=${this.hoverPaneProps?.suppressBlurring}
218
+ .sortParam=${this.hoverPaneProps?.sortParam}
219
+ .collectionTitles=${this.hoverPaneProps?.collectionTitles}
220
+ .mobileBreakpoint=${this.mobileBreakpoint}
221
+ .currentWidth=${window.innerWidth}
222
+ ></tile-hover-pane>
223
+ <div id="tile-hover-pane-aria-description" class="sr-only">
224
+ ${msg('Press Up Arrow to exit item detail preview')}
225
+ </div>
229
226
  `
230
227
  : nothing;
231
228
  }
232
229
  /** @inheritdoc */
233
230
  toggleHoverPane(options) {
234
- var _a;
235
231
  if (this.hoverPaneState === 'shown') {
236
232
  this.fadeOutHoverPane();
237
233
  this.forceTouchBackdrop = false;
238
234
  }
239
235
  else {
240
236
  this.lastPointerClientPos = options.coords;
241
- this.forceTouchBackdrop = (_a = options.enableTouchBackdrop) !== null && _a !== void 0 ? _a : false;
237
+ this.forceTouchBackdrop = options.enableTouchBackdrop ?? false;
242
238
  this.showHoverPane();
243
239
  }
244
240
  }
@@ -251,15 +247,15 @@ export class HoverPaneController {
251
247
  */
252
248
  get touchBackdropTemplate() {
253
249
  return this.showTouchBackdrop
254
- ? html `<div
255
- id="touch-backdrop"
256
- @touchstart=${this.handleBackdropInteraction}
257
- @touchmove=${this.handleBackdropInteraction}
258
- @touchend=${this.handleBackdropInteraction}
259
- @touchcancel=${this.handleBackdropInteraction}
260
- @mouseenter=${(e) => e.stopPropagation()}
261
- @mousemove=${(e) => e.stopPropagation()}
262
- @mouseleave=${(e) => e.stopPropagation()}
250
+ ? html `<div
251
+ id="touch-backdrop"
252
+ @touchstart=${this.handleBackdropInteraction}
253
+ @touchmove=${this.handleBackdropInteraction}
254
+ @touchend=${this.handleBackdropInteraction}
255
+ @touchcancel=${this.handleBackdropInteraction}
256
+ @mouseenter=${(e) => e.stopPropagation()}
257
+ @mousemove=${(e) => e.stopPropagation()}
258
+ @mouseleave=${(e) => e.stopPropagation()}
263
259
  ></div>`
264
260
  : nothing;
265
261
  }
@@ -297,7 +293,6 @@ export class HoverPaneController {
297
293
  // (b) to the extent possible, minimize the distance between the
298
294
  // nearest corner of the hover pane and the mouse/host element position
299
295
  // (with some additional offsets applied after the fact).
300
- var _a;
301
296
  let [left, top] = [0, 0];
302
297
  switch (anchor) {
303
298
  case 'host':
@@ -315,7 +310,7 @@ export class HoverPaneController {
315
310
  // (Similar to how Wikipedia's link hover panes work)
316
311
  const flipHorizontal = left > window.innerWidth / 2;
317
312
  const flipVertical = top > window.innerHeight / 2;
318
- const hoverPaneRect = (_a = this.hoverPane) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
313
+ const hoverPaneRect = this.hoverPane?.getBoundingClientRect();
319
314
  if (hoverPaneRect) {
320
315
  // If we need to flip the hover pane, do so by subtracting its width/height from left/top
321
316
  if (flipHorizontal) {
@@ -394,16 +389,15 @@ export class HoverPaneController {
394
389
  async showHoverPane(options = {
395
390
  anchor: 'cursor',
396
391
  }) {
397
- var _a, _b, _c, _d;
398
392
  this.hoverPaneState = 'shown';
399
393
  this.host.requestUpdate();
400
394
  // Wait for the state update to render the hover pane
401
395
  await this.host.updateComplete;
402
396
  // Ensure the hover pane element is still in the document before showing,
403
397
  // as it might have been removed by the previous update.
404
- if (!((_a = this.hoverPane) === null || _a === void 0 ? void 0 : _a.isConnected))
398
+ if (!this.hoverPane?.isConnected)
405
399
  return;
406
- (_c = (_b = this.hoverPane) === null || _b === void 0 ? void 0 : _b.showPopover) === null || _c === void 0 ? void 0 : _c.call(_b);
400
+ this.hoverPane?.showPopover?.();
407
401
  await new Promise(resolve => {
408
402
  // Pane sizes aren't accurate until next frame
409
403
  requestAnimationFrame(resolve);
@@ -413,16 +407,15 @@ export class HoverPaneController {
413
407
  // The hover pane is initially not visible (to avoid it shifting around
414
408
  // while being positioned). Since it now has the correct positioning, we
415
409
  // can make it visible and begin its fade-in animation.
416
- (_d = this.hoverPane) === null || _d === void 0 ? void 0 : _d.classList.add('visible', 'fade-in');
410
+ this.hoverPane?.classList.add('visible', 'fade-in');
417
411
  }
418
412
  /**
419
413
  * Causes this tile's hover pane to begin fading out and starts
420
414
  * the timer for it to be removed.
421
415
  */
422
416
  fadeOutHoverPane() {
423
- var _a;
424
417
  this.hoverPaneState = 'fading-out';
425
- (_a = this.hoverPane) === null || _a === void 0 ? void 0 : _a.classList.remove('fade-in');
418
+ this.hoverPane?.classList.remove('fade-in');
426
419
  clearTimeout(this.hideTimer);
427
420
  this.hideTimer = window.setTimeout(() => {
428
421
  this.hoverPaneState = 'hidden';
@@ -1 +1 @@
1
- {"version":3,"file":"hover-pane-controller.js","sourceRoot":"","sources":["../../../../src/tiles/hover/hover-pane-controller.ts"],"names":[],"mappings":"AACA,OAAO,EACL,IAAI,EAEJ,OAAO,GAGR,MAAM,KAAK,CAAC;AAGb,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAoEpC,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,GAAG,QAAQ,EAAE,EAAE,CAC7D,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAEpC,MAAM,OAAO,mBAAmB;IA8E9B;IACE,wEAAwE;IACvD,IAEJ;IACb,4EAA4E;IAC5E,UAAsC,EAAE;;QAJvB,SAAI,GAAJ,IAAI,CAER;QAvEf;;WAEG;QACK,qBAA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ACvD,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACtD,CAAC;IAED;;;OAGG;IACK,gBAAgB;;QACtB,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC;QACnC,MAAA,IAAI,CAAC,SAAS,0CAAE,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAE5C,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE;YACtC,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;YAC/B,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACnB,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;YAC/B,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;QAC5B,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC;IAED;;OAEG;IACK,mBAAmB,CAAC,MAA+B;QACzD,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO;QAE5B,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAE1D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;QACtC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type { SortParam } from '@internetarchive/search-service';\r\nimport {\r\n html,\r\n HTMLTemplateResult,\r\n nothing,\r\n ReactiveController,\r\n ReactiveControllerHost,\r\n} from 'lit';\r\nimport type { TileModel } from '../../models';\r\nimport type { CollectionTitles } from '../../data-source/models';\r\nimport { msg } from '@lit/localize';\r\n\r\ntype HoverPaneState = 'hidden' | 'shown' | 'fading-out';\r\n\r\n// the anchor point of the hover pane\r\n// can be either the mouse cursor or near the host element\r\n// in the case of mouse navigation, we want it to follow the cursor\r\n// in the case of keyboard navigation, we want it to appear near the host element\r\ntype HoverPanePositionAnchor = 'host' | 'cursor';\r\n\r\nexport interface HoverPaneProperties {\r\n model?: TileModel;\r\n baseNavigationUrl?: string;\r\n baseImageUrl?: string;\r\n loggedIn: boolean;\r\n suppressBlurring: boolean;\r\n sortParam: SortParam | null;\r\n collectionTitles?: CollectionTitles;\r\n}\r\n\r\nexport interface HoverPaneControllerOptions {\r\n offsetX?: number;\r\n offsetY?: number;\r\n enableLongPress?: boolean;\r\n showDelay?: number;\r\n hideDelay?: number;\r\n longPressDelay?: number;\r\n mobileBreakpoint?: number;\r\n}\r\n\r\n/** A common interface for providing a hover pane element. */\r\nexport interface HoverPaneProviderInterface {\r\n /** Returns the provider's currently rendered hover pane element. */\r\n getHoverPane(): HTMLElement | undefined;\r\n /** Returns properties that should be passed to the hover pane. */\r\n getHoverPaneProps(): HoverPaneProperties;\r\n /** When user has keyboard navigated out of more info, we want the host to get focus */\r\n acquireFocus(): void;\r\n /** When user has keyboard navigated out of more info, we want the host to lose focus */\r\n releaseFocus(): void;\r\n}\r\n\r\nexport interface ToggleHoverPaneOptions {\r\n coords: { x: number; y: number };\r\n enableTouchBackdrop?: boolean;\r\n}\r\n\r\n/**\r\n * An interface for interacting with hover pane controllers (e.g.,\r\n * to retrieve their current hover pane template).\r\n */\r\nexport interface HoverPaneControllerInterface extends ReactiveController {\r\n /**\r\n * Returns the hover pane template to render based on this controller's\r\n * current state. The returned template may be `nothing` if the hover\r\n * pane should not currently be rendered.\r\n */\r\n getTemplate(): HTMLTemplateResult | typeof nothing;\r\n\r\n /**\r\n * Requests to manually toggle the state of the hover pane.\r\n * If the hover pane is already shown, it will begin fading out and then\r\n * subsequently be hidden and removed. If the hover pane is already fading\r\n * out or hidden, it will fade back in and be shown.\r\n */\r\n toggleHoverPane(options: ToggleHoverPaneOptions): void;\r\n}\r\n\r\nconst clamp = (val: number, min = -Infinity, max = Infinity) =>\r\n Math.max(min, Math.min(val, max));\r\n\r\nexport class HoverPaneController implements HoverPaneControllerInterface {\r\n /**\r\n * The hover pane element attached to this controller's host.\r\n */\r\n private hoverPane?: HTMLElement;\r\n\r\n /**\r\n * The properties to be passed to the hover pane element\r\n */\r\n private hoverPaneProps?: HoverPaneProperties;\r\n\r\n /**\r\n * The breakpoint (in pixels) below which the mobile interface should be used.\r\n */\r\n private mobileBreakpoint?: number = 600;\r\n\r\n /**\r\n * The number of horizontal pixels the hover pane should be offset from the\r\n * pointer position.\r\n */\r\n private offsetX: number = -10;\r\n\r\n /**\r\n * The number of vertical pixels the hover pane should be offset from the\r\n * pointer position.\r\n */\r\n private offsetY: number = 15;\r\n\r\n /**\r\n * The delay between the mouse idling within the host element and when the hover\r\n * pane should begin fading in (in milliseconds).\r\n */\r\n private showDelay: number = 300;\r\n\r\n /**\r\n * The delay between when the mouse leaves the host element and when the hover\r\n * pane should begin fading out (in milliseconds).\r\n */\r\n private hideDelay: number = 100;\r\n\r\n /**\r\n * The delay between when a touch event begins on the host element and when the\r\n * hover pane should begin fading in (in milliseconds).\r\n */\r\n private longPressDelay: number = 600;\r\n\r\n /**\r\n * Whether long press interactions should cause the hover pane to appear (when\r\n * below the mobile breakpoint).\r\n */\r\n private enableLongPress: boolean = false;\r\n\r\n /**\r\n * Used to control the current state of this provider's hover pane.\r\n * - `'hidden'` => The hover pane is not present at all.\r\n * - `'shown'` => The hover pane is either fading in or fully visible.\r\n * - `'fading-out'` => The hover pane is fading out and about to be removed.\r\n */\r\n private hoverPaneState: HoverPaneState = 'hidden';\r\n\r\n /** The timer ID for showing the hover pane */\r\n private showTimer?: number;\r\n\r\n /** The timer ID for hiding the hover pane */\r\n private hideTimer?: number;\r\n\r\n /** The timer ID for recognizing a long press event */\r\n private longPressTimer?: number;\r\n\r\n /**\r\n * Whether the touch backdrop should currently be rendered irrespective of other touch\r\n * interactions being enabled.\r\n */\r\n private forceTouchBackdrop: boolean = false;\r\n\r\n /** A record of the last mouse position on the host element, for positioning the hover pane */\r\n private lastPointerClientPos = { x: 0, y: 0 };\r\n\r\n constructor(\r\n /** The host element to which this controller should attach listeners */\r\n private readonly host: ReactiveControllerHost &\r\n HoverPaneProviderInterface &\r\n HTMLElement,\r\n /** Options for adjusting the hover pane behavior (offsets, delays, etc.) */\r\n options: HoverPaneControllerOptions = {},\r\n ) {\r\n this.mobileBreakpoint = options.mobileBreakpoint ?? this.mobileBreakpoint;\r\n this.offsetX = options.offsetX ?? this.offsetX;\r\n this.offsetY = options.offsetY ?? this.offsetY;\r\n this.showDelay = options.showDelay ?? this.showDelay;\r\n this.hideDelay = options.hideDelay ?? this.hideDelay;\r\n this.longPressDelay = options.longPressDelay ?? this.longPressDelay;\r\n this.enableLongPress = options.enableLongPress ?? this.enableLongPress;\r\n\r\n this.host.addController(this);\r\n }\r\n\r\n hostConnected(): void {\r\n this.attachListeners();\r\n }\r\n\r\n hostDisconnected(): void {\r\n this.detachListeners();\r\n }\r\n\r\n hostUpdated(): void {\r\n this.hoverPane = this.host.getHoverPane();\r\n this.hoverPaneProps = this.host.getHoverPaneProps();\r\n }\r\n\r\n /** @inheritdoc */\r\n getTemplate(): HTMLTemplateResult | typeof nothing {\r\n this.hoverPaneProps = this.host.getHoverPaneProps();\r\n\r\n return this.shouldRenderHoverPane\r\n ? html`\r\n ${this.touchBackdropTemplate}\r\n <tile-hover-pane\r\n popover\r\n tabindex=\"-1\"\r\n aria-describedby=\"tile-hover-pane-aria-description\"\r\n .model=${this.hoverPaneProps?.model}\r\n .baseNavigationUrl=${this.hoverPaneProps?.baseNavigationUrl}\r\n .baseImageUrl=${this.hoverPaneProps?.baseImageUrl}\r\n .loggedIn=${this.hoverPaneProps?.loggedIn}\r\n .suppressBlurring=${this.hoverPaneProps?.suppressBlurring}\r\n .sortParam=${this.hoverPaneProps?.sortParam}\r\n .collectionTitles=${this.hoverPaneProps?.collectionTitles}\r\n .mobileBreakpoint=${this.mobileBreakpoint}\r\n .currentWidth=${window.innerWidth}\r\n ></tile-hover-pane>\r\n <div id=\"tile-hover-pane-aria-description\" class=\"sr-only\">\r\n ${msg('Press Up Arrow to exit item detail preview')}\r\n </div>\r\n `\r\n : nothing;\r\n }\r\n\r\n /** @inheritdoc */\r\n toggleHoverPane(options: ToggleHoverPaneOptions): void {\r\n if (this.hoverPaneState === 'shown') {\r\n this.fadeOutHoverPane();\r\n this.forceTouchBackdrop = false;\r\n } else {\r\n this.lastPointerClientPos = options.coords;\r\n this.forceTouchBackdrop = options.enableTouchBackdrop ?? false;\r\n this.showHoverPane();\r\n }\r\n }\r\n\r\n /**\r\n * Produces a template for the invisible touch capture backdrop that\r\n * is used to cancel the hover pane on touch devices. We want any\r\n * touch interaction on the backdrop to remove the hover pane, and\r\n * we don't want to bubble up mouse events that would otherwise\r\n * affect the state of the hover pane (e.g., fading it back in).\r\n */\r\n private get touchBackdropTemplate(): HTMLTemplateResult | typeof nothing {\r\n return this.showTouchBackdrop\r\n ? html`<div\r\n id=\"touch-backdrop\"\r\n @touchstart=${this.handleBackdropInteraction}\r\n @touchmove=${this.handleBackdropInteraction}\r\n @touchend=${this.handleBackdropInteraction}\r\n @touchcancel=${this.handleBackdropInteraction}\r\n @mouseenter=${(e: MouseEvent) => e.stopPropagation()}\r\n @mousemove=${(e: MouseEvent) => e.stopPropagation()}\r\n @mouseleave=${(e: MouseEvent) => e.stopPropagation()}\r\n ></div>`\r\n : nothing;\r\n }\r\n\r\n private get showTouchBackdrop(): boolean {\r\n return (\r\n (this.isTouchEnabled && this.enableLongPress) || this.forceTouchBackdrop\r\n );\r\n }\r\n\r\n /** Whether to use the mobile layout */\r\n private get isMobileView(): boolean {\r\n return !!this.mobileBreakpoint && window.innerWidth < this.mobileBreakpoint;\r\n }\r\n\r\n private get isHoverEnabled(): boolean {\r\n return window.matchMedia('(hover: hover)').matches;\r\n }\r\n\r\n private get isTouchEnabled(): boolean {\r\n return (\r\n 'ontouchstart' in window &&\r\n window.matchMedia('(any-pointer: coarse)').matches\r\n );\r\n }\r\n\r\n /** Whether this controller should currently render its hover pane. */\r\n private get shouldRenderHoverPane(): boolean {\r\n return this.hoverPaneState !== 'hidden';\r\n }\r\n\r\n /**\r\n * Returns the desired top/left offsets (in pixels) for this tile's hover pane.\r\n * The desired offsets balance positioning the hover pane under the primary pointer\r\n * while preventing it from flowing outside the viewport. The returned offsets are\r\n * relative to the viewport, intended to position the pane as a popover element.\r\n *\r\n * These offsets are only valid if the hover pane is already rendered with its\r\n * correct width and height. If the hover pane is not present, the returned offsets\r\n * will simply represent the current pointer position.\r\n */\r\n private makePaneDesiredOffsets(anchor: HoverPanePositionAnchor): {\r\n top: number;\r\n left: number;\r\n } {\r\n // Try to find offsets for the hover pane that:\r\n // (a) cause it to lie entirely within the viewport, and\r\n // (b) to the extent possible, minimize the distance between the\r\n // nearest corner of the hover pane and the mouse/host element position\r\n // (with some additional offsets applied after the fact).\r\n\r\n let [left, top] = [0, 0];\r\n switch (anchor) {\r\n case 'host':\r\n const hostRect = this.host.getBoundingClientRect();\r\n // slight inset from host top left corner\r\n left = hostRect.left + 20;\r\n top = hostRect.top + 30;\r\n break;\r\n case 'cursor':\r\n left = this.lastPointerClientPos.x;\r\n top = this.lastPointerClientPos.y;\r\n break;\r\n }\r\n\r\n // Flip the hover pane according to which quadrant of the viewport the coordinates are in.\r\n // (Similar to how Wikipedia's link hover panes work)\r\n const flipHorizontal = left > window.innerWidth / 2;\r\n const flipVertical = top > window.innerHeight / 2;\r\n\r\n const hoverPaneRect = this.hoverPane?.getBoundingClientRect();\r\n if (hoverPaneRect) {\r\n // If we need to flip the hover pane, do so by subtracting its width/height from left/top\r\n if (flipHorizontal) {\r\n left -= hoverPaneRect.width;\r\n }\r\n if (flipVertical) {\r\n top -= hoverPaneRect.height;\r\n }\r\n\r\n // Apply desired offsets from the target position\r\n left += (flipHorizontal ? -1 : 1) * this.offsetX;\r\n top += (flipVertical ? -1 : 1) * this.offsetY;\r\n\r\n // On mobile view, shunt the hover pane to avoid overflowing the viewport\r\n if (this.isMobileView) {\r\n left = clamp(left, 20, window.innerWidth - hoverPaneRect.width - 20);\r\n top = clamp(top, 20, window.innerHeight - hoverPaneRect.height - 20);\r\n }\r\n }\r\n\r\n left += window.scrollX;\r\n top += window.scrollY;\r\n\r\n return { left, top };\r\n }\r\n\r\n /**\r\n * Adds to the host element all the listeners necessary to make the\r\n * hover pane functional.\r\n */\r\n private attachListeners(): void {\r\n // keyboard navigation listeners\r\n this.host.addEventListener('focus', this.handleFocus);\r\n this.host.addEventListener('blur', this.handleBlur);\r\n this.host.addEventListener('keyup', this.handleKeyUp);\r\n this.host.addEventListener('keydown', this.handleKeyDown);\r\n\r\n if (this.isHoverEnabled) {\r\n this.host.addEventListener('mouseenter', this.handleMouseEnter);\r\n this.host.addEventListener('mousemove', this.handleMouseMove);\r\n this.host.addEventListener('mouseleave', this.handleMouseLeave);\r\n }\r\n\r\n if (this.isTouchEnabled && this.enableLongPress) {\r\n this.host.addEventListener('touchstart', this.handleTouchStart);\r\n this.host.addEventListener('touchmove', this.handleLongPressCancel);\r\n this.host.addEventListener('touchend', this.handleLongPressCancel);\r\n this.host.addEventListener('touchcancel', this.handleLongPressCancel);\r\n this.host.addEventListener('contextmenu', this.handleContextMenu);\r\n }\r\n }\r\n\r\n /**\r\n * Removes all the hover pane listeners from the host element.\r\n */\r\n private detachListeners(): void {\r\n this.host.removeEventListener('mouseenter', this.handleMouseEnter);\r\n this.host.removeEventListener('mousemove', this.handleMouseMove);\r\n this.host.removeEventListener('mouseleave', this.handleMouseLeave);\r\n this.host.removeEventListener('touchstart', this.handleTouchStart);\r\n this.host.removeEventListener('touchmove', this.handleLongPressCancel);\r\n this.host.removeEventListener('touchend', this.handleLongPressCancel);\r\n this.host.removeEventListener('touchcancel', this.handleLongPressCancel);\r\n this.host.removeEventListener('contextmenu', this.handleContextMenu);\r\n\r\n // keyboard navigation listeners\r\n this.host.removeEventListener('focus', this.handleFocus);\r\n this.host.removeEventListener('blur', this.handleBlur);\r\n this.host.removeEventListener('keyup', this.handleKeyUp);\r\n this.host.removeEventListener('keydown', this.handleKeyDown);\r\n }\r\n\r\n private handleFocus = (): void => {\r\n if (this.hoverPaneState === 'hidden') {\r\n this.showHoverPane({\r\n anchor: 'host',\r\n });\r\n }\r\n };\r\n\r\n private handleBlur = (): void => {\r\n if (this.hoverPaneState !== 'hidden') {\r\n this.fadeOutHoverPane();\r\n }\r\n };\r\n\r\n private handleKeyDown = (e: KeyboardEvent): void => {\r\n if (\r\n (e.key === 'ArrowDown' || e.key === 'ArrowUp') &&\r\n this.hoverPaneState !== 'hidden'\r\n ) {\r\n e.preventDefault();\r\n }\r\n };\r\n\r\n private handleKeyUp = (e: KeyboardEvent): void => {\r\n if (this.hoverPaneState === 'hidden' || !this.hoverPane) return;\r\n if (e.key === 'ArrowDown') {\r\n this.hoverPane.tabIndex = 1;\r\n this.hoverPane.focus();\r\n }\r\n\r\n const isArrowUp = e.key === 'ArrowUp';\r\n const isEscape = e.key === 'Escape' || e.key === 'Esc';\r\n\r\n if (isEscape) {\r\n this.fadeOutHoverPane();\r\n }\r\n if (isArrowUp || isEscape) {\r\n this.hoverPane.tabIndex = -1;\r\n this.host.acquireFocus();\r\n }\r\n };\r\n\r\n /**\r\n * Handler for the mouseenter event on the host element.\r\n */\r\n // NB: Arrow function so 'this' remains bound to the controller\r\n private handleMouseEnter = (e: MouseEvent): void => {\r\n // Delegate to the mousemove handler, as they are currently processed identically\r\n this.handleMouseMove(e);\r\n };\r\n\r\n /**\r\n * Handler for the mousemove event on the host element.\r\n * Aborts any pending hide/fade-out for the hover pane, and restarts the\r\n * timer to show it.\r\n */\r\n // NB: Arrow function so 'this' remains bound to the controller\r\n private handleMouseMove = (e: MouseEvent): void => {\r\n // The mouse is within the tile, so abort any pending removal of the hover pane\r\n clearTimeout(this.hideTimer);\r\n\r\n // If the hover pane is currently fading out, just make it fade back in where it is\r\n if (this.hoverPaneState === 'fading-out') {\r\n this.hoverPaneState = 'shown';\r\n this.hoverPane?.classList.add('fade-in');\r\n }\r\n\r\n // Restart the timer to show the hover pane anytime the mouse moves within the tile\r\n if (this.hoverPaneState === 'hidden') {\r\n this.restartShowHoverPaneTimer();\r\n this.lastPointerClientPos = { x: e.clientX, y: e.clientY };\r\n }\r\n };\r\n\r\n /**\r\n * Handler for the mouseleave event on the host element.\r\n * Hides the hover pane if present, and aborts the timer for showing it.\r\n */\r\n // NB: Arrow function so 'this' remains bound to the controller\r\n private handleMouseLeave = (): void => {\r\n this.host.releaseFocus();\r\n\r\n // Abort any timer to show the hover pane, as the mouse has left the tile\r\n clearTimeout(this.showTimer);\r\n\r\n // Hide the hover pane if it's already been shown\r\n if (this.hoverPaneState !== 'hidden') {\r\n this.hideTimer = window.setTimeout(() => {\r\n this.fadeOutHoverPane();\r\n }, this.hideDelay);\r\n }\r\n };\r\n\r\n /**\r\n * Handler for the touchstart event on the host element.\r\n * Begins the timer for recognizing a long press event.\r\n */\r\n // NB: Arrow function so 'this' remains bound to the controller\r\n private handleTouchStart = (e: TouchEvent): void => {\r\n clearTimeout(this.longPressTimer);\r\n\r\n if (e.touches.length === 1) {\r\n this.longPressTimer = window.setTimeout(() => {\r\n if (this.hoverPaneState === 'hidden') {\r\n this.showHoverPane();\r\n }\r\n }, this.longPressDelay);\r\n\r\n this.lastPointerClientPos = {\r\n x: e.touches[0].clientX,\r\n y: e.touches[0].clientY,\r\n };\r\n }\r\n };\r\n\r\n /**\r\n * Handler for events that should cancel a pending long press event\r\n * (touchmove, touchend, touchcancel). Aborts the timer for recognizing\r\n * a long press.\r\n */\r\n // NB: Arrow function so 'this' remains bound to the controller\r\n private handleLongPressCancel = (): void => {\r\n clearTimeout(this.longPressTimer);\r\n };\r\n\r\n /**\r\n * Handler for the contextmenu event, which should be suppressed during\r\n * mobile long-press events on the host element.\r\n */\r\n // NB: Arrow function so 'this' remains bound to the controller\r\n private handleContextMenu = (e: Event): void => {\r\n e.preventDefault();\r\n };\r\n\r\n /**\r\n * Immediately causes the hover pane to begin fading out, if it is present.\r\n */\r\n // NB: Arrow function so 'this' remains bound to the controller\r\n private handleBackdropInteraction = (e: Event): void => {\r\n if (this.hoverPaneState !== 'hidden') {\r\n this.fadeOutHoverPane();\r\n }\r\n e.stopPropagation();\r\n };\r\n\r\n /**\r\n * Aborts and restarts the timer for showing the hover pane.\r\n */\r\n private restartShowHoverPaneTimer(): void {\r\n clearTimeout(this.showTimer);\r\n this.showTimer = window.setTimeout(() => {\r\n this.host.acquireFocus();\r\n this.showHoverPane();\r\n }, this.showDelay);\r\n }\r\n\r\n /**\r\n * Causes this tile's hover pane to be rendered, positioned, and made visible.\r\n */\r\n private async showHoverPane(\r\n options: {\r\n anchor: HoverPanePositionAnchor;\r\n } = {\r\n anchor: 'cursor',\r\n },\r\n ): Promise<void> {\r\n this.hoverPaneState = 'shown';\r\n this.host.requestUpdate();\r\n\r\n // Wait for the state update to render the hover pane\r\n await this.host.updateComplete;\r\n\r\n // Ensure the hover pane element is still in the document before showing,\r\n // as it might have been removed by the previous update.\r\n if (!this.hoverPane?.isConnected) return;\r\n\r\n this.hoverPane?.showPopover?.();\r\n await new Promise(resolve => {\r\n // Pane sizes aren't accurate until next frame\r\n requestAnimationFrame(resolve);\r\n });\r\n\r\n // Apply the correct positioning to the hover pane\r\n this.repositionHoverPane(options.anchor);\r\n\r\n // The hover pane is initially not visible (to avoid it shifting around\r\n // while being positioned). Since it now has the correct positioning, we\r\n // can make it visible and begin its fade-in animation.\r\n this.hoverPane?.classList.add('visible', 'fade-in');\r\n }\r\n\r\n /**\r\n * Causes this tile's hover pane to begin fading out and starts\r\n * the timer for it to be removed.\r\n */\r\n private fadeOutHoverPane(): void {\r\n this.hoverPaneState = 'fading-out';\r\n this.hoverPane?.classList.remove('fade-in');\r\n\r\n clearTimeout(this.hideTimer);\r\n this.hideTimer = window.setTimeout(() => {\r\n this.hoverPaneState = 'hidden';\r\n if (this.hoverPane) {\r\n this.hoverPane.tabIndex = -1;\r\n }\r\n this.host.requestUpdate();\r\n }, 100);\r\n }\r\n\r\n /**\r\n * Positions the hover pane with the correct offsets.\r\n */\r\n private repositionHoverPane(anchor: HoverPanePositionAnchor): void {\r\n if (!this.hoverPane) return;\r\n\r\n const { top, left } = this.makePaneDesiredOffsets(anchor);\r\n\r\n this.hoverPane.style.top = `${top}px`;\r\n this.hoverPane.style.left = `${left}px`;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"hover-pane-controller.js","sourceRoot":"","sources":["../../../../src/tiles/hover/hover-pane-controller.ts"],"names":[],"mappings":"AACA,OAAO,EACL,IAAI,EAEJ,OAAO,GAGR,MAAM,KAAK,CAAC;AAGb,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAoEpC,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,GAAG,QAAQ,EAAE,EAAE,CAC7D,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAEpC,MAAM,OAAO,mBAAmB;IA8E9B;IACE,wEAAwE;IACvD,IAEJ;IACb,4EAA4E;IAC5E,UAAsC,EAAE;QAJvB,SAAI,GAAJ,IAAI,CAER;QAvEf;;WAEG;QACK,qBAAgB,GAAY,GAAG,CAAC;QAExC;;;WAGG;QACK,YAAO,GAAW,CAAC,EAAE,CAAC;QAE9B;;;WAGG;QACK,YAAO,GAAW,EAAE,CAAC;QAE7B;;;WAGG;QACK,cAAS,GAAW,GAAG,CAAC;QAEhC;;;WAGG;QACK,cAAS,GAAW,GAAG,CAAC;QAEhC;;;WAGG;QACK,mBAAc,GAAW,GAAG,CAAC;QAErC;;;WAGG;QACK,oBAAe,GAAY,KAAK,CAAC;QAEzC;;;;;WAKG;QACK,mBAAc,GAAmB,QAAQ,CAAC;QAWlD;;;WAGG;QACK,uBAAkB,GAAY,KAAK,C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aAAa,EAAE,CAAC;QAC5B,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC;IAED;;OAEG;IACK,mBAAmB,CAAC,MAA+B;QACzD,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO;QAE5B,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAE1D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;QACtC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type { SortParam } from '@internetarchive/search-service';\nimport {\n html,\n HTMLTemplateResult,\n nothing,\n ReactiveController,\n ReactiveControllerHost,\n} from 'lit';\nimport type { TileModel } from '../../models';\nimport type { CollectionTitles } from '../../data-source/models';\nimport { msg } from '@lit/localize';\n\ntype HoverPaneState = 'hidden' | 'shown' | 'fading-out';\n\n// the anchor point of the hover pane\n// can be either the mouse cursor or near the host element\n// in the case of mouse navigation, we want it to follow the cursor\n// in the case of keyboard navigation, we want it to appear near the host element\ntype HoverPanePositionAnchor = 'host' | 'cursor';\n\nexport interface HoverPaneProperties {\n model?: TileModel;\n baseNavigationUrl?: string;\n baseImageUrl?: string;\n loggedIn: boolean;\n suppressBlurring: boolean;\n sortParam: SortParam | null;\n collectionTitles?: CollectionTitles;\n}\n\nexport interface HoverPaneControllerOptions {\n offsetX?: number;\n offsetY?: number;\n enableLongPress?: boolean;\n showDelay?: number;\n hideDelay?: number;\n longPressDelay?: number;\n mobileBreakpoint?: number;\n}\n\n/** A common interface for providing a hover pane element. */\nexport interface HoverPaneProviderInterface {\n /** Returns the provider's currently rendered hover pane element. */\n getHoverPane(): HTMLElement | undefined;\n /** Returns properties that should be passed to the hover pane. */\n getHoverPaneProps(): HoverPaneProperties;\n /** When user has keyboard navigated out of more info, we want the host to get focus */\n acquireFocus(): void;\n /** When user has keyboard navigated out of more info, we want the host to lose focus */\n releaseFocus(): void;\n}\n\nexport interface ToggleHoverPaneOptions {\n coords: { x: number; y: number };\n enableTouchBackdrop?: boolean;\n}\n\n/**\n * An interface for interacting with hover pane controllers (e.g.,\n * to retrieve their current hover pane template).\n */\nexport interface HoverPaneControllerInterface extends ReactiveController {\n /**\n * Returns the hover pane template to render based on this controller's\n * current state. The returned template may be `nothing` if the hover\n * pane should not currently be rendered.\n */\n getTemplate(): HTMLTemplateResult | typeof nothing;\n\n /**\n * Requests to manually toggle the state of the hover pane.\n * If the hover pane is already shown, it will begin fading out and then\n * subsequently be hidden and removed. If the hover pane is already fading\n * out or hidden, it will fade back in and be shown.\n */\n toggleHoverPane(options: ToggleHoverPaneOptions): void;\n}\n\nconst clamp = (val: number, min = -Infinity, max = Infinity) =>\n Math.max(min, Math.min(val, max));\n\nexport class HoverPaneController implements HoverPaneControllerInterface {\n /**\n * The hover pane element attached to this controller's host.\n */\n private hoverPane?: HTMLElement;\n\n /**\n * The properties to be passed to the hover pane element\n */\n private hoverPaneProps?: HoverPaneProperties;\n\n /**\n * The breakpoint (in pixels) below which the mobile interface should be used.\n */\n private mobileBreakpoint?: number = 600;\n\n /**\n * The number of horizontal pixels the hover pane should be offset from the\n * pointer position.\n */\n private offsetX: number = -10;\n\n /**\n * The number of vertical pixels the hover pane should be offset from the\n * pointer position.\n */\n private offsetY: number = 15;\n\n /**\n * The delay between the mouse idling within the host element and when the hover\n * pane should begin fading in (in milliseconds).\n */\n private showDelay: number = 300;\n\n /**\n * The delay between when the mouse leaves the host element and when the hover\n * pane should begin fading out (in milliseconds).\n */\n private hideDelay: number = 100;\n\n /**\n * The delay between when a touch event begins on the host element and when the\n * hover pane should begin fading in (in milliseconds).\n */\n private longPressDelay: number = 600;\n\n /**\n * Whether long press interactions should cause the hover pane to appear (when\n * below the mobile breakpoint).\n */\n private enableLongPress: boolean = false;\n\n /**\n * Used to control the current state of this provider's hover pane.\n * - `'hidden'` => The hover pane is not present at all.\n * - `'shown'` => The hover pane is either fading in or fully visible.\n * - `'fading-out'` => The hover pane is fading out and about to be removed.\n */\n private hoverPaneState: HoverPaneState = 'hidden';\n\n /** The timer ID for showing the hover pane */\n private showTimer?: number;\n\n /** The timer ID for hiding the hover pane */\n private hideTimer?: number;\n\n /** The timer ID for recognizing a long press event */\n private longPressTimer?: number;\n\n /**\n * Whether the touch backdrop should currently be rendered irrespective of other touch\n * interactions being enabled.\n */\n private forceTouchBackdrop: boolean = false;\n\n /** A record of the last mouse position on the host element, for positioning the hover pane */\n private lastPointerClientPos = { x: 0, y: 0 };\n\n constructor(\n /** The host element to which this controller should attach listeners */\n private readonly host: ReactiveControllerHost &\n HoverPaneProviderInterface &\n HTMLElement,\n /** Options for adjusting the hover pane behavior (offsets, delays, etc.) */\n options: HoverPaneControllerOptions = {},\n ) {\n this.mobileBreakpoint = options.mobileBreakpoint ?? this.mobileBreakpoint;\n this.offsetX = options.offsetX ?? this.offsetX;\n this.offsetY = options.offsetY ?? this.offsetY;\n this.showDelay = options.showDelay ?? this.showDelay;\n this.hideDelay = options.hideDelay ?? this.hideDelay;\n this.longPressDelay = options.longPressDelay ?? this.longPressDelay;\n this.enableLongPress = options.enableLongPress ?? this.enableLongPress;\n\n this.host.addController(this);\n }\n\n hostConnected(): void {\n this.attachListeners();\n }\n\n hostDisconnected(): void {\n this.detachListeners();\n }\n\n hostUpdated(): void {\n this.hoverPane = this.host.getHoverPane();\n this.hoverPaneProps = this.host.getHoverPaneProps();\n }\n\n /** @inheritdoc */\n getTemplate(): HTMLTemplateResult | typeof nothing {\n this.hoverPaneProps = this.host.getHoverPaneProps();\n\n return this.shouldRenderHoverPane\n ? html`\n ${this.touchBackdropTemplate}\n <tile-hover-pane\n popover\n tabindex=\"-1\"\n aria-describedby=\"tile-hover-pane-aria-description\"\n .model=${this.hoverPaneProps?.model}\n .baseNavigationUrl=${this.hoverPaneProps?.baseNavigationUrl}\n .baseImageUrl=${this.hoverPaneProps?.baseImageUrl}\n .loggedIn=${this.hoverPaneProps?.loggedIn}\n .suppressBlurring=${this.hoverPaneProps?.suppressBlurring}\n .sortParam=${this.hoverPaneProps?.sortParam}\n .collectionTitles=${this.hoverPaneProps?.collectionTitles}\n .mobileBreakpoint=${this.mobileBreakpoint}\n .currentWidth=${window.innerWidth}\n ></tile-hover-pane>\n <div id=\"tile-hover-pane-aria-description\" class=\"sr-only\">\n ${msg('Press Up Arrow to exit item detail preview')}\n </div>\n `\n : nothing;\n }\n\n /** @inheritdoc */\n toggleHoverPane(options: ToggleHoverPaneOptions): void {\n if (this.hoverPaneState === 'shown') {\n this.fadeOutHoverPane();\n this.forceTouchBackdrop = false;\n } else {\n this.lastPointerClientPos = options.coords;\n this.forceTouchBackdrop = options.enableTouchBackdrop ?? false;\n this.showHoverPane();\n }\n }\n\n /**\n * Produces a template for the invisible touch capture backdrop that\n * is used to cancel the hover pane on touch devices. We want any\n * touch interaction on the backdrop to remove the hover pane, and\n * we don't want to bubble up mouse events that would otherwise\n * affect the state of the hover pane (e.g., fading it back in).\n */\n private get touchBackdropTemplate(): HTMLTemplateResult | typeof nothing {\n return this.showTouchBackdrop\n ? html`<div\n id=\"touch-backdrop\"\n @touchstart=${this.handleBackdropInteraction}\n @touchmove=${this.handleBackdropInteraction}\n @touchend=${this.handleBackdropInteraction}\n @touchcancel=${this.handleBackdropInteraction}\n @mouseenter=${(e: MouseEvent) => e.stopPropagation()}\n @mousemove=${(e: MouseEvent) => e.stopPropagation()}\n @mouseleave=${(e: MouseEvent) => e.stopPropagation()}\n ></div>`\n : nothing;\n }\n\n private get showTouchBackdrop(): boolean {\n return (\n (this.isTouchEnabled && this.enableLongPress) || this.forceTouchBackdrop\n );\n }\n\n /** Whether to use the mobile layout */\n private get isMobileView(): boolean {\n return !!this.mobileBreakpoint && window.innerWidth < this.mobileBreakpoint;\n }\n\n private get isHoverEnabled(): boolean {\n return window.matchMedia('(hover: hover)').matches;\n }\n\n private get isTouchEnabled(): boolean {\n return (\n 'ontouchstart' in window &&\n window.matchMedia('(any-pointer: coarse)').matches\n );\n }\n\n /** Whether this controller should currently render its hover pane. */\n private get shouldRenderHoverPane(): boolean {\n return this.hoverPaneState !== 'hidden';\n }\n\n /**\n * Returns the desired top/left offsets (in pixels) for this tile's hover pane.\n * The desired offsets balance positioning the hover pane under the primary pointer\n * while preventing it from flowing outside the viewport. The returned offsets are\n * relative to the viewport, intended to position the pane as a popover element.\n *\n * These offsets are only valid if the hover pane is already rendered with its\n * correct width and height. If the hover pane is not present, the returned offsets\n * will simply represent the current pointer position.\n */\n private makePaneDesiredOffsets(anchor: HoverPanePositionAnchor): {\n top: number;\n left: number;\n } {\n // Try to find offsets for the hover pane that:\n // (a) cause it to lie entirely within the viewport, and\n // (b) to the extent possible, minimize the distance between the\n // nearest corner of the hover pane and the mouse/host element position\n // (with some additional offsets applied after the fact).\n\n let [left, top] = [0, 0];\n switch (anchor) {\n case 'host':\n const hostRect = this.host.getBoundingClientRect();\n // slight inset from host top left corner\n left = hostRect.left + 20;\n top = hostRect.top + 30;\n break;\n case 'cursor':\n left = this.lastPointerClientPos.x;\n top = this.lastPointerClientPos.y;\n break;\n }\n\n // Flip the hover pane according to which quadrant of the viewport the coordinates are in.\n // (Similar to how Wikipedia's link hover panes work)\n const flipHorizontal = left > window.innerWidth / 2;\n const flipVertical = top > window.innerHeight / 2;\n\n const hoverPaneRect = this.hoverPane?.getBoundingClientRect();\n if (hoverPaneRect) {\n // If we need to flip the hover pane, do so by subtracting its width/height from left/top\n if (flipHorizontal) {\n left -= hoverPaneRect.width;\n }\n if (flipVertical) {\n top -= hoverPaneRect.height;\n }\n\n // Apply desired offsets from the target position\n left += (flipHorizontal ? -1 : 1) * this.offsetX;\n top += (flipVertical ? -1 : 1) * this.offsetY;\n\n // On mobile view, shunt the hover pane to avoid overflowing the viewport\n if (this.isMobileView) {\n left = clamp(left, 20, window.innerWidth - hoverPaneRect.width - 20);\n top = clamp(top, 20, window.innerHeight - hoverPaneRect.height - 20);\n }\n }\n\n left += window.scrollX;\n top += window.scrollY;\n\n return { left, top };\n }\n\n /**\n * Adds to the host element all the listeners necessary to make the\n * hover pane functional.\n */\n private attachListeners(): void {\n // keyboard navigation listeners\n this.host.addEventListener('focus', this.handleFocus);\n this.host.addEventListener('blur', this.handleBlur);\n this.host.addEventListener('keyup', this.handleKeyUp);\n this.host.addEventListener('keydown', this.handleKeyDown);\n\n if (this.isHoverEnabled) {\n this.host.addEventListener('mouseenter', this.handleMouseEnter);\n this.host.addEventListener('mousemove', this.handleMouseMove);\n this.host.addEventListener('mouseleave', this.handleMouseLeave);\n }\n\n if (this.isTouchEnabled && this.enableLongPress) {\n this.host.addEventListener('touchstart', this.handleTouchStart);\n this.host.addEventListener('touchmove', this.handleLongPressCancel);\n this.host.addEventListener('touchend', this.handleLongPressCancel);\n this.host.addEventListener('touchcancel', this.handleLongPressCancel);\n this.host.addEventListener('contextmenu', this.handleContextMenu);\n }\n }\n\n /**\n * Removes all the hover pane listeners from the host element.\n */\n private detachListeners(): void {\n this.host.removeEventListener('mouseenter', this.handleMouseEnter);\n this.host.removeEventListener('mousemove', this.handleMouseMove);\n this.host.removeEventListener('mouseleave', this.handleMouseLeave);\n this.host.removeEventListener('touchstart', this.handleTouchStart);\n this.host.removeEventListener('touchmove', this.handleLongPressCancel);\n this.host.removeEventListener('touchend', this.handleLongPressCancel);\n this.host.removeEventListener('touchcancel', this.handleLongPressCancel);\n this.host.removeEventListener('contextmenu', this.handleContextMenu);\n\n // keyboard navigation listeners\n this.host.removeEventListener('focus', this.handleFocus);\n this.host.removeEventListener('blur', this.handleBlur);\n this.host.removeEventListener('keyup', this.handleKeyUp);\n this.host.removeEventListener('keydown', this.handleKeyDown);\n }\n\n private handleFocus = (): void => {\n if (this.hoverPaneState === 'hidden') {\n this.showHoverPane({\n anchor: 'host',\n });\n }\n };\n\n private handleBlur = (): void => {\n if (this.hoverPaneState !== 'hidden') {\n this.fadeOutHoverPane();\n }\n };\n\n private handleKeyDown = (e: KeyboardEvent): void => {\n if (\n (e.key === 'ArrowDown' || e.key === 'ArrowUp') &&\n this.hoverPaneState !== 'hidden'\n ) {\n e.preventDefault();\n }\n };\n\n private handleKeyUp = (e: KeyboardEvent): void => {\n if (this.hoverPaneState === 'hidden' || !this.hoverPane) return;\n if (e.key === 'ArrowDown') {\n this.hoverPane.tabIndex = 1;\n this.hoverPane.focus();\n }\n\n const isArrowUp = e.key === 'ArrowUp';\n const isEscape = e.key === 'Escape' || e.key === 'Esc';\n\n if (isEscape) {\n this.fadeOutHoverPane();\n }\n if (isArrowUp || isEscape) {\n this.hoverPane.tabIndex = -1;\n this.host.acquireFocus();\n }\n };\n\n /**\n * Handler for the mouseenter event on the host element.\n */\n // NB: Arrow function so 'this' remains bound to the controller\n private handleMouseEnter = (e: MouseEvent): void => {\n // Delegate to the mousemove handler, as they are currently processed identically\n this.handleMouseMove(e);\n };\n\n /**\n * Handler for the mousemove event on the host element.\n * Aborts any pending hide/fade-out for the hover pane, and restarts the\n * timer to show it.\n */\n // NB: Arrow function so 'this' remains bound to the controller\n private handleMouseMove = (e: MouseEvent): void => {\n // The mouse is within the tile, so abort any pending removal of the hover pane\n clearTimeout(this.hideTimer);\n\n // If the hover pane is currently fading out, just make it fade back in where it is\n if (this.hoverPaneState === 'fading-out') {\n this.hoverPaneState = 'shown';\n this.hoverPane?.classList.add('fade-in');\n }\n\n // Restart the timer to show the hover pane anytime the mouse moves within the tile\n if (this.hoverPaneState === 'hidden') {\n this.restartShowHoverPaneTimer();\n this.lastPointerClientPos = { x: e.clientX, y: e.clientY };\n }\n };\n\n /**\n * Handler for the mouseleave event on the host element.\n * Hides the hover pane if present, and aborts the timer for showing it.\n */\n // NB: Arrow function so 'this' remains bound to the controller\n private handleMouseLeave = (): void => {\n this.host.releaseFocus();\n\n // Abort any timer to show the hover pane, as the mouse has left the tile\n clearTimeout(this.showTimer);\n\n // Hide the hover pane if it's already been shown\n if (this.hoverPaneState !== 'hidden') {\n this.hideTimer = window.setTimeout(() => {\n this.fadeOutHoverPane();\n }, this.hideDelay);\n }\n };\n\n /**\n * Handler for the touchstart event on the host element.\n * Begins the timer for recognizing a long press event.\n */\n // NB: Arrow function so 'this' remains bound to the controller\n private handleTouchStart = (e: TouchEvent): void => {\n clearTimeout(this.longPressTimer);\n\n if (e.touches.length === 1) {\n this.longPressTimer = window.setTimeout(() => {\n if (this.hoverPaneState === 'hidden') {\n this.showHoverPane();\n }\n }, this.longPressDelay);\n\n this.lastPointerClientPos = {\n x: e.touches[0].clientX,\n y: e.touches[0].clientY,\n };\n }\n };\n\n /**\n * Handler for events that should cancel a pending long press event\n * (touchmove, touchend, touchcancel). Aborts the timer for recognizing\n * a long press.\n */\n // NB: Arrow function so 'this' remains bound to the controller\n private handleLongPressCancel = (): void => {\n clearTimeout(this.longPressTimer);\n };\n\n /**\n * Handler for the contextmenu event, which should be suppressed during\n * mobile long-press events on the host element.\n */\n // NB: Arrow function so 'this' remains bound to the controller\n private handleContextMenu = (e: Event): void => {\n e.preventDefault();\n };\n\n /**\n * Immediately causes the hover pane to begin fading out, if it is present.\n */\n // NB: Arrow function so 'this' remains bound to the controller\n private handleBackdropInteraction = (e: Event): void => {\n if (this.hoverPaneState !== 'hidden') {\n this.fadeOutHoverPane();\n }\n e.stopPropagation();\n };\n\n /**\n * Aborts and restarts the timer for showing the hover pane.\n */\n private restartShowHoverPaneTimer(): void {\n clearTimeout(this.showTimer);\n this.showTimer = window.setTimeout(() => {\n this.host.acquireFocus();\n this.showHoverPane();\n }, this.showDelay);\n }\n\n /**\n * Causes this tile's hover pane to be rendered, positioned, and made visible.\n */\n private async showHoverPane(\n options: {\n anchor: HoverPanePositionAnchor;\n } = {\n anchor: 'cursor',\n },\n ): Promise<void> {\n this.hoverPaneState = 'shown';\n this.host.requestUpdate();\n\n // Wait for the state update to render the hover pane\n await this.host.updateComplete;\n\n // Ensure the hover pane element is still in the document before showing,\n // as it might have been removed by the previous update.\n if (!this.hoverPane?.isConnected) return;\n\n this.hoverPane?.showPopover?.();\n await new Promise(resolve => {\n // Pane sizes aren't accurate until next frame\n requestAnimationFrame(resolve);\n });\n\n // Apply the correct positioning to the hover pane\n this.repositionHoverPane(options.anchor);\n\n // The hover pane is initially not visible (to avoid it shifting around\n // while being positioned). Since it now has the correct positioning, we\n // can make it visible and begin its fade-in animation.\n this.hoverPane?.classList.add('visible', 'fade-in');\n }\n\n /**\n * Causes this tile's hover pane to begin fading out and starts\n * the timer for it to be removed.\n */\n private fadeOutHoverPane(): void {\n this.hoverPaneState = 'fading-out';\n this.hoverPane?.classList.remove('fade-in');\n\n clearTimeout(this.hideTimer);\n this.hideTimer = window.setTimeout(() => {\n this.hoverPaneState = 'hidden';\n if (this.hoverPane) {\n this.hoverPane.tabIndex = -1;\n }\n this.host.requestUpdate();\n }, 100);\n }\n\n /**\n * Positions the hover pane with the correct offsets.\n */\n private repositionHoverPane(anchor: HoverPanePositionAnchor): void {\n if (!this.hoverPane) return;\n\n const { top, left } = this.makePaneDesiredOffsets(anchor);\n\n this.hoverPane.style.top = `${top}px`;\n this.hoverPane.style.left = `${left}px`;\n }\n}\n"]}
@@ -11,38 +11,37 @@ let TileHoverPane = class TileHoverPane extends LitElement {
11
11
  this.suppressBlurring = false;
12
12
  }
13
13
  render() {
14
- return html `
15
- <div id="container">
16
- <focus-trap>
17
- ${this.headerTemplate}
18
- <div id="hover-tile-list">
19
- <tile-list
20
- .model=${this.model}
21
- .baseNavigationUrl=${this.baseNavigationUrl}
22
- .baseImageUrl=${this.baseImageUrl}
23
- .loggedIn=${this.loggedIn}
24
- .suppressBlurring=${this.suppressBlurring}
25
- .sortParam=${this.sortParam}
26
- .collectionTitles=${this.collectionTitles}
27
- .mobileBreakpoint=${this.mobileBreakpoint}
28
- .currentWidth=${this.currentWidth}
29
- ></tile-list>
30
- </div>
31
- </focus-trap>
32
- </div>
14
+ return html `
15
+ <div id="container">
16
+ <focus-trap>
17
+ ${this.headerTemplate}
18
+ <div id="hover-tile-list">
19
+ <tile-list
20
+ .model=${this.model}
21
+ .baseNavigationUrl=${this.baseNavigationUrl}
22
+ .baseImageUrl=${this.baseImageUrl}
23
+ .loggedIn=${this.loggedIn}
24
+ .suppressBlurring=${this.suppressBlurring}
25
+ .sortParam=${this.sortParam}
26
+ .collectionTitles=${this.collectionTitles}
27
+ .mobileBreakpoint=${this.mobileBreakpoint}
28
+ .currentWidth=${this.currentWidth}
29
+ ></tile-list>
30
+ </div>
31
+ </focus-trap>
32
+ </div>
33
33
  `;
34
34
  }
35
35
  get headerTemplate() {
36
- var _a, _b, _c, _d, _e;
37
36
  // early return if item does't have parent collection
38
- if (((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) === null || _b === void 0 ? void 0 : _b.length) === 0)
37
+ if (this.model?.collections?.length === 0)
39
38
  return nothing;
40
39
  let collectionTitle = '';
41
40
  let collectionIdentifier = '';
42
- for (const collection of ((_c = this.model) === null || _c === void 0 ? void 0 : _c.collections) || []) {
41
+ for (const collection of this.model?.collections || []) {
43
42
  if (!suppressedCollections[collection] &&
44
43
  !collection.startsWith('fav-')) {
45
- collectionTitle = (_e = (_d = this.collectionTitles) === null || _d === void 0 ? void 0 : _d.get(collection)) !== null && _e !== void 0 ? _e : collection;
44
+ collectionTitle = this.collectionTitles?.get(collection) ?? collection;
46
45
  collectionIdentifier = collection;
47
46
  break;
48
47
  }
@@ -51,103 +50,103 @@ let TileHoverPane = class TileHoverPane extends LitElement {
51
50
  // let's not render that
52
51
  if (!collectionIdentifier)
53
52
  return nothing;
54
- return html `
55
- <div id="list-line-header">
56
- <a href="${this.baseNavigationUrl}/details/${collectionIdentifier}">
57
- <img
58
- src="${this.baseImageUrl}/services/img/${collectionIdentifier}"
59
- alt=""
60
- /><span>${collectionTitle}</span>
61
- </a>
62
- </div>
53
+ return html `
54
+ <div id="list-line-header">
55
+ <a href="${this.baseNavigationUrl}/details/${collectionIdentifier}">
56
+ <img
57
+ src="${this.baseImageUrl}/services/img/${collectionIdentifier}"
58
+ alt=""
59
+ /><span>${collectionTitle}</span>
60
+ </a>
61
+ </div>
63
62
  `;
64
63
  }
65
64
  static get styles() {
66
65
  const hoverPaneHeaderBGColor = css `var(--hoverPaneHeaderBGColor, #edf0ff)`;
67
66
  const iaLinkColor = css `var(--ia-theme-link-color, #4b64ff)`;
68
67
  const iaFontFamily = css `var(--ia-theme-base-font-family, "Helvetica Neue", Helvetica, Arial, sans-serif);`;
69
- return css `
70
- :host {
71
- margin: 0;
72
- border: 0;
73
- padding: 0;
74
- overflow: visible;
75
- color: inherit;
76
- background: none;
77
- visibility: hidden;
78
- opacity: 0;
79
- transform: translateY(8px);
80
- transition:
81
- opacity 0.1s ease-in,
82
- transform 0.1s ease-in;
83
- --image-width: auto;
84
- }
85
-
86
- :host(.visible) {
87
- visibility: visible;
88
- }
89
-
90
- :host(.fade-in) {
91
- opacity: 1;
92
- transform: translateY(0);
93
- }
94
-
95
- @media (prefers-reduced-motion: reduce) {
96
- :host {
97
- transition-duration: 0.001s !important; /* Imperceptibly fast */
98
- }
99
- }
100
-
101
- #container {
102
- width: max-content;
103
- max-width: min(45vw, 600px);
104
- border: 1px solid #ddd;
105
- border-radius: 4px;
106
- box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.8);
107
- background: white;
108
- }
109
-
110
- @media screen and (max-width: 600px) {
111
- #container {
112
- max-width: 80vw;
113
- }
114
- }
115
-
116
- /* main tile-list container */
117
- #hover-tile-list {
118
- padding: 10px;
119
- }
120
-
121
- /* header on hover panel to show collection icon and title */
122
- #list-line-header {
123
- background: ${hoverPaneHeaderBGColor};
124
- }
125
- #list-line-header a {
126
- display: flex;
127
- align-items: center;
128
- column-gap: 5px;
129
- height: 3.4rem;
130
- padding: 0 10px;
131
- border-radius: 4px 4px 0 0;
132
- width: fit-content;
133
- font-size: 1.4rem;
134
- color: ${iaLinkColor};
135
- font-family: ${iaFontFamily};
136
- text-decoration: none;
137
- width: auto;
138
- }
139
- #list-line-header a span {
140
- white-space: nowrap;
141
- overflow: hidden;
142
- text-overflow: ellipsis;
143
- }
144
- #list-line-header a:hover {
145
- text-decoration: underline;
146
- }
147
- #list-line-header a img {
148
- width: 30px;
149
- max-height: 30px;
150
- }
68
+ return css `
69
+ :host {
70
+ margin: 0;
71
+ border: 0;
72
+ padding: 0;
73
+ overflow: visible;
74
+ color: inherit;
75
+ background: none;
76
+ visibility: hidden;
77
+ opacity: 0;
78
+ transform: translateY(8px);
79
+ transition:
80
+ opacity 0.1s ease-in,
81
+ transform 0.1s ease-in;
82
+ --image-width: auto;
83
+ }
84
+
85
+ :host(.visible) {
86
+ visibility: visible;
87
+ }
88
+
89
+ :host(.fade-in) {
90
+ opacity: 1;
91
+ transform: translateY(0);
92
+ }
93
+
94
+ @media (prefers-reduced-motion: reduce) {
95
+ :host {
96
+ transition-duration: 0.001s !important; /* Imperceptibly fast */
97
+ }
98
+ }
99
+
100
+ #container {
101
+ width: max-content;
102
+ max-width: min(45vw, 600px);
103
+ border: 1px solid #ddd;
104
+ border-radius: 4px;
105
+ box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.8);
106
+ background: white;
107
+ }
108
+
109
+ @media screen and (max-width: 600px) {
110
+ #container {
111
+ max-width: 80vw;
112
+ }
113
+ }
114
+
115
+ /* main tile-list container */
116
+ #hover-tile-list {
117
+ padding: 10px;
118
+ }
119
+
120
+ /* header on hover panel to show collection icon and title */
121
+ #list-line-header {
122
+ background: ${hoverPaneHeaderBGColor};
123
+ }
124
+ #list-line-header a {
125
+ display: flex;
126
+ align-items: center;
127
+ column-gap: 5px;
128
+ height: 3.4rem;
129
+ padding: 0 10px;
130
+ border-radius: 4px 4px 0 0;
131
+ width: fit-content;
132
+ font-size: 1.4rem;
133
+ color: ${iaLinkColor};
134
+ font-family: ${iaFontFamily};
135
+ text-decoration: none;
136
+ width: auto;
137
+ }
138
+ #list-line-header a span {
139
+ white-space: nowrap;
140
+ overflow: hidden;
141
+ text-overflow: ellipsis;
142
+ }
143
+ #list-line-header a:hover {
144
+ text-decoration: underline;
145
+ }
146
+ #list-line-header a img {
147
+ width: 30px;
148
+ max-height: 30px;
149
+ }
151
150
  `;
152
151
  }
153
152
  };