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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/.editorconfig +29 -29
  2. package/.github/workflows/ci.yml +27 -27
  3. package/.github/workflows/gh-pages-main.yml +39 -39
  4. package/.github/workflows/npm-publish.yml +39 -39
  5. package/.github/workflows/pr-preview.yml +38 -38
  6. package/.husky/pre-commit +4 -4
  7. package/.prettierignore +1 -1
  8. package/LICENSE +661 -661
  9. package/README.md +83 -83
  10. package/dist/src/app-root.js +28 -19
  11. package/dist/src/app-root.js.map +1 -1
  12. package/dist/src/collection-browser.d.ts +4 -24
  13. package/dist/src/collection-browser.js +125 -286
  14. package/dist/src/collection-browser.js.map +1 -1
  15. package/dist/src/collection-facets/facet-row.js +143 -143
  16. package/dist/src/collection-facets/facet-row.js.map +1 -1
  17. package/dist/src/collection-facets/more-facets-content.d.ts +1 -1
  18. package/dist/src/collection-facets/more-facets-content.js +48 -34
  19. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  20. package/dist/src/collection-facets/more-facets-pagination.js +10 -6
  21. package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
  22. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +21 -16
  23. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -1
  24. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +10 -7
  25. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  26. package/dist/src/collection-facets/smart-facets/smart-facet-button.js +2 -3
  27. package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -1
  28. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +11 -9
  29. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  30. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js +7 -7
  31. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -1
  32. package/dist/src/collection-facets/toggle-switch.js +6 -4
  33. package/dist/src/collection-facets/toggle-switch.js.map +1 -1
  34. package/dist/src/collection-facets.js +310 -309
  35. package/dist/src/collection-facets.js.map +1 -1
  36. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +1 -10
  37. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  38. package/dist/src/data-source/collection-browser-data-source.d.ts +1 -19
  39. package/dist/src/data-source/collection-browser-data-source.js +65 -71
  40. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  41. package/dist/src/data-source/collection-browser-query-state.d.ts +2 -1
  42. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  43. package/dist/src/data-source/models.d.ts +0 -11
  44. package/dist/src/data-source/models.js.map +1 -1
  45. package/dist/src/empty-placeholder.js +18 -19
  46. package/dist/src/empty-placeholder.js.map +1 -1
  47. package/dist/src/expanded-date-picker.js +10 -6
  48. package/dist/src/expanded-date-picker.js.map +1 -1
  49. package/dist/src/language-code-handler/language-code-handler.js +2 -2
  50. package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
  51. package/dist/src/manage/manage-bar.js +15 -9
  52. package/dist/src/manage/manage-bar.js.map +1 -1
  53. package/dist/src/manage/remove-items-modal-content.js +2 -2
  54. package/dist/src/manage/remove-items-modal-content.js.map +1 -1
  55. package/dist/src/models.d.ts +6 -2
  56. package/dist/src/models.js +54 -46
  57. package/dist/src/models.js.map +1 -1
  58. package/dist/src/restoration-state-handler.d.ts +2 -1
  59. package/dist/src/restoration-state-handler.js +19 -12
  60. package/dist/src/restoration-state-handler.js.map +1 -1
  61. package/dist/src/sort-filter-bar/alpha-bar.js +14 -9
  62. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  63. package/dist/src/sort-filter-bar/sort-filter-bar.js +24 -14
  64. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  65. package/dist/src/tiles/base-tile-component.js +2 -1
  66. package/dist/src/tiles/base-tile-component.js.map +1 -1
  67. package/dist/src/tiles/grid/account-tile.js +7 -5
  68. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  69. package/dist/src/tiles/grid/collection-tile.js +6 -3
  70. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  71. package/dist/src/tiles/grid/item-tile.js +33 -23
  72. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  73. package/dist/src/tiles/grid/search-tile.js +2 -1
  74. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  75. package/dist/src/tiles/grid/tile-stats.js +3 -2
  76. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  77. package/dist/src/tiles/hover/hover-pane-controller.js +28 -21
  78. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  79. package/dist/src/tiles/hover/tile-hover-pane.js +4 -3
  80. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
  81. package/dist/src/tiles/image-block.js +8 -5
  82. package/dist/src/tiles/image-block.js.map +1 -1
  83. package/dist/src/tiles/item-image.js +19 -12
  84. package/dist/src/tiles/item-image.js.map +1 -1
  85. package/dist/src/tiles/list/tile-list-compact.js +25 -17
  86. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  87. package/dist/src/tiles/list/tile-list.js +55 -34
  88. package/dist/src/tiles/list/tile-list.js.map +1 -1
  89. package/dist/src/tiles/overlay/icon-overlay.js +2 -1
  90. package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
  91. package/dist/src/tiles/overlay/text-overlay.js +4 -2
  92. package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
  93. package/dist/src/tiles/text-snippet-block.js +4 -2
  94. package/dist/src/tiles/text-snippet-block.js.map +1 -1
  95. package/dist/src/tiles/tile-dispatcher.js +30 -22
  96. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  97. package/dist/src/tiles/tile-display-value-provider.js +9 -5
  98. package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
  99. package/dist/src/tiles/tile-mediatype-icon.js +19 -12
  100. package/dist/src/tiles/tile-mediatype-icon.js.map +1 -1
  101. package/dist/src/utils/collapse-repeated-quotes.js +1 -1
  102. package/dist/src/utils/collapse-repeated-quotes.js.map +1 -1
  103. package/dist/src/utils/facet-utils.js +5 -3
  104. package/dist/src/utils/facet-utils.js.map +1 -1
  105. package/dist/src/utils/format-count.js +10 -10
  106. package/dist/src/utils/format-count.js.map +1 -1
  107. package/dist/src/utils/resolve-mediatype.js +3 -2
  108. package/dist/src/utils/resolve-mediatype.js.map +1 -1
  109. package/dist/test/collection-browser.test.js +380 -336
  110. package/dist/test/collection-browser.test.js.map +1 -1
  111. package/dist/test/collection-facets/facet-row.test.js +52 -37
  112. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  113. package/dist/test/collection-facets/facets-template.test.js +23 -17
  114. package/dist/test/collection-facets/facets-template.test.js.map +1 -1
  115. package/dist/test/collection-facets/more-facets-content.test.js +32 -22
  116. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
  117. package/dist/test/collection-facets/more-facets-pagination.test.js +22 -16
  118. package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
  119. package/dist/test/collection-facets/toggle-switch.test.js +19 -22
  120. package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
  121. package/dist/test/collection-facets.test.js +77 -60
  122. package/dist/test/collection-facets.test.js.map +1 -1
  123. package/dist/test/empty-placeholder.test.js +17 -11
  124. package/dist/test/empty-placeholder.test.js.map +1 -1
  125. package/dist/test/expanded-date-picker.test.js +14 -8
  126. package/dist/test/expanded-date-picker.test.js.map +1 -1
  127. package/dist/test/icon-overlay.test.js +6 -7
  128. package/dist/test/icon-overlay.test.js.map +1 -1
  129. package/dist/test/image-block.test.js +26 -16
  130. package/dist/test/image-block.test.js.map +1 -1
  131. package/dist/test/item-image.test.js +32 -23
  132. package/dist/test/item-image.test.js.map +1 -1
  133. package/dist/test/manage/manage-bar.test.js +33 -21
  134. package/dist/test/manage/manage-bar.test.js.map +1 -1
  135. package/dist/test/manage/remove-items-modal-content.test.js +15 -10
  136. package/dist/test/manage/remove-items-modal-content.test.js.map +1 -1
  137. package/dist/test/mocks/mock-search-service.js +3 -2
  138. package/dist/test/mocks/mock-search-service.js.map +1 -1
  139. package/dist/test/restoration-state-handler.test.js +54 -14
  140. package/dist/test/restoration-state-handler.test.js.map +1 -1
  141. package/dist/test/review-block.test.js +18 -16
  142. package/dist/test/review-block.test.js.map +1 -1
  143. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +3 -2
  144. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -1
  145. package/dist/test/sort-filter-bar/alpha-bar.test.js +24 -18
  146. package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
  147. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +180 -178
  148. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  149. package/dist/test/text-overlay.test.js +15 -16
  150. package/dist/test/text-overlay.test.js.map +1 -1
  151. package/dist/test/text-snippet-block.test.js +19 -14
  152. package/dist/test/text-snippet-block.test.js.map +1 -1
  153. package/dist/test/tile-stats.test.js +34 -73
  154. package/dist/test/tile-stats.test.js.map +1 -1
  155. package/dist/test/tiles/grid/account-tile.test.js +25 -25
  156. package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
  157. package/dist/test/tiles/grid/collection-tile.test.js +19 -13
  158. package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
  159. package/dist/test/tiles/grid/item-tile.test.js +91 -64
  160. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  161. package/dist/test/tiles/grid/search-tile.test.js +13 -9
  162. package/dist/test/tiles/grid/search-tile.test.js.map +1 -1
  163. package/dist/test/tiles/hover/hover-pane-controller.test.js +35 -23
  164. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
  165. package/dist/test/tiles/hover/tile-hover-pane.test.js +16 -12
  166. package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
  167. package/dist/test/tiles/list/tile-list-compact.test.js +48 -34
  168. package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
  169. package/dist/test/tiles/list/tile-list.test.js +105 -76
  170. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  171. package/dist/test/tiles/tile-dispatcher.test.js +30 -17
  172. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
  173. package/dist/test/tiles/tile-mediatype-icon.test.js +24 -12
  174. package/dist/test/tiles/tile-mediatype-icon.test.js.map +1 -1
  175. package/eslint.config.mjs +53 -53
  176. package/index.html +24 -24
  177. package/local.archive.org.cert +86 -86
  178. package/local.archive.org.key +27 -27
  179. package/package.json +118 -120
  180. package/renovate.json +6 -6
  181. package/src/collection-browser.ts +15 -246
  182. package/src/collection-facets/facet-row.ts +296 -299
  183. package/src/collection-facets/more-facets-content.ts +8 -5
  184. package/src/collection-facets.ts +995 -1010
  185. package/src/data-source/collection-browser-data-source-interface.ts +333 -345
  186. package/src/data-source/collection-browser-data-source.ts +1401 -1441
  187. package/src/data-source/collection-browser-query-state.ts +65 -59
  188. package/src/data-source/models.ts +43 -56
  189. package/src/models.ts +870 -866
  190. package/src/restoration-state-handler.ts +544 -546
  191. package/test/collection-browser.test.ts +2403 -2413
  192. package/test/restoration-state-handler.test.ts +510 -480
  193. package/tsconfig.json +20 -25
  194. package/vite.config.ts +22 -29
  195. package/web-dev-server.config.mjs +30 -30
  196. package/web-test-runner.config.mjs +41 -41
  197. package/dist/src/combo-box/caret-closed.d.ts +0 -2
  198. package/dist/src/combo-box/caret-closed.js +0 -7
  199. package/dist/src/combo-box/caret-closed.js.map +0 -1
  200. package/dist/src/combo-box/caret-open.d.ts +0 -2
  201. package/dist/src/combo-box/caret-open.js +0 -7
  202. package/dist/src/combo-box/caret-open.js.map +0 -1
  203. package/dist/src/combo-box/clear.d.ts +0 -2
  204. package/dist/src/combo-box/clear.js +0 -11
  205. package/dist/src/combo-box/clear.js.map +0 -1
  206. package/dist/src/combo-box/ia-combo-box.d.ts +0 -422
  207. package/dist/src/combo-box/ia-combo-box.js +0 -1203
  208. package/dist/src/combo-box/ia-combo-box.js.map +0 -1
  209. package/dist/src/combo-box/models.d.ts +0 -75
  210. package/dist/src/combo-box/models.js +0 -40
  211. package/dist/src/combo-box/models.js.map +0 -1
  212. package/src/combo-box/caret-closed.ts +0 -7
  213. package/src/combo-box/caret-open.ts +0 -7
  214. package/src/combo-box/clear.ts +0 -11
  215. package/src/combo-box/ia-combo-box.ts +0 -1288
  216. package/src/combo-box/models.ts +0 -113
@@ -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,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;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,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';\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"]}
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,OAA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,CAAC,CAAC;QAEH,kDAAkD;QAClD,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEzC,uEAAuE;QACvE,wEAAwE;QACxE,uDAAuD;QACvD,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';\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"]}
@@ -33,15 +33,16 @@ let TileHoverPane = class TileHoverPane extends LitElement {
33
33
  `;
34
34
  }
35
35
  get headerTemplate() {
36
+ var _a, _b, _c, _d, _e;
36
37
  // early return if item does't have parent collection
37
- if (this.model?.collections?.length === 0)
38
+ if (((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) === null || _b === void 0 ? void 0 : _b.length) === 0)
38
39
  return nothing;
39
40
  let collectionTitle = '';
40
41
  let collectionIdentifier = '';
41
- for (const collection of this.model?.collections || []) {
42
+ for (const collection of ((_c = this.model) === null || _c === void 0 ? void 0 : _c.collections) || []) {
42
43
  if (!suppressedCollections[collection] &&
43
44
  !collection.startsWith('fav-')) {
44
- collectionTitle = this.collectionTitles?.get(collection) ?? collection;
45
+ collectionTitle = (_e = (_d = this.collectionTitles) === null || _d === void 0 ? void 0 : _d.get(collection)) !== null && _e !== void 0 ? _e : collection;
45
46
  collectionIdentifier = collection;
46
47
  break;
47
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tile-hover-pane.js","sourceRoot":"","sources":["../../../../src/tiles/hover/tile-hover-pane.ts"],"names":[],"mappings":";AACA,OAAO,EACL,GAAG,EAEH,IAAI,EACJ,UAAU,EACV,OAAO,GAER,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,qBAAqB,EAAkB,MAAM,cAAc,CAAC;AAErE,OAAO,mBAAmB,CAAC;AAGpB,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QAOwB,aAAQ,GAAY,KAAK,CAAC;QAE1B,qBAAgB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AAW,GAAG,GAAG,CAAA,qCAAqC,CAAC;QAC7D,MAAM,YAAY,GAAG,GAAG,CAAA,mFAAmF,CAAC;QAE5G,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAsDQ,sBAAsB;;;;;;;;;;;iBAW3B,WAAW;uBACL,YAAY;;;;;;;;;;;;;;;;KAgB9B,CAAC;IACJ,CAAC;CACF,CAAA;AArK6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA4B;AAE3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAuB;AAErB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAA2B;AAE1B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAmC;AAEnC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAuB;AAEtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAA2B;AAE1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAuB;AAGlD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDACS;AAlBzB,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAsKzB","sourcesContent":["import type { SortParam } from '@internetarchive/search-service';\nimport {\n css,\n CSSResultGroup,\n html,\n LitElement,\n nothing,\n TemplateResult,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport '@a11y/focus-trap';\n\nimport { suppressedCollections, type TileModel } from '../../models';\nimport type { CollectionTitles } from '../../data-source/models';\nimport '../list/tile-list';\n\n@customElement('tile-hover-pane')\nexport class TileHoverPane extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) loggedIn: boolean = false;\n\n @property({ type: Boolean }) suppressBlurring: boolean = false;\n\n @property({ type: Object }) sortParam?: SortParam;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Object })\n collectionTitles?: CollectionTitles;\n\n protected render(): TemplateResult {\n return html`\n <div id=\"container\">\n <focus-trap>\n ${this.headerTemplate}\n <div id=\"hover-tile-list\">\n <tile-list\n .model=${this.model}\n .baseNavigationUrl=${this.baseNavigationUrl}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .sortParam=${this.sortParam}\n .collectionTitles=${this.collectionTitles}\n .mobileBreakpoint=${this.mobileBreakpoint}\n .currentWidth=${this.currentWidth}\n ></tile-list>\n </div>\n </focus-trap>\n </div>\n `;\n }\n\n private get headerTemplate(): TemplateResult | typeof nothing {\n // early return if item does't have parent collection\n if (this.model?.collections?.length === 0) return nothing;\n\n let collectionTitle = '';\n let collectionIdentifier = '';\n\n for (const collection of this.model?.collections || []) {\n if (\n !suppressedCollections[collection] &&\n !collection.startsWith('fav-')\n ) {\n collectionTitle = this.collectionTitles?.get(collection) ?? collection;\n collectionIdentifier = collection;\n break;\n }\n }\n\n // sometimes item does have collections but they are in suppressed or favorite list,\n // let's not render that\n if (!collectionIdentifier) return nothing;\n\n return html`\n <div id=\"list-line-header\">\n <a href=\"${this.baseNavigationUrl}/details/${collectionIdentifier}\">\n <img\n src=\"${this.baseImageUrl}/services/img/${collectionIdentifier}\"\n alt=\"\"\n /><span>${collectionTitle}</span>\n </a>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n const hoverPaneHeaderBGColor = css`var(--hoverPaneHeaderBGColor, #edf0ff)`;\n const iaLinkColor = css`var(--ia-theme-link-color, #4b64ff)`;\n const iaFontFamily = css`var(--ia-theme-base-font-family, \"Helvetica Neue\", Helvetica, Arial, sans-serif);`;\n\n return css`\n :host {\n margin: 0;\n border: 0;\n padding: 0;\n overflow: visible;\n color: inherit;\n background: none;\n visibility: hidden;\n opacity: 0;\n transform: translateY(8px);\n transition:\n opacity 0.1s ease-in,\n transform 0.1s ease-in;\n --image-width: auto;\n }\n\n :host(.visible) {\n visibility: visible;\n }\n\n :host(.fade-in) {\n opacity: 1;\n transform: translateY(0);\n }\n\n @media (prefers-reduced-motion: reduce) {\n :host {\n transition-duration: 0.001s !important; /* Imperceptibly fast */\n }\n }\n\n #container {\n width: max-content;\n max-width: min(45vw, 600px);\n border: 1px solid #ddd;\n border-radius: 4px;\n box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.8);\n background: white;\n }\n\n @media screen and (max-width: 600px) {\n #container {\n max-width: 80vw;\n }\n }\n\n /* main tile-list container */\n #hover-tile-list {\n padding: 10px;\n }\n\n /* header on hover panel to show collection icon and title */\n #list-line-header {\n background: ${hoverPaneHeaderBGColor};\n }\n #list-line-header a {\n display: flex;\n align-items: center;\n column-gap: 5px;\n height: 3.4rem;\n padding: 0 10px;\n border-radius: 4px 4px 0 0;\n width: fit-content;\n font-size: 1.4rem;\n color: ${iaLinkColor};\n font-family: ${iaFontFamily};\n text-decoration: none;\n width: auto;\n }\n #list-line-header a span {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n #list-line-header a:hover {\n text-decoration: underline;\n }\n #list-line-header a img {\n width: 30px;\n max-height: 30px;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"tile-hover-pane.js","sourceRoot":"","sources":["../../../../src/tiles/hover/tile-hover-pane.ts"],"names":[],"mappings":";AACA,OAAO,EACL,GAAG,EAEH,IAAI,EACJ,UAAU,EACV,OAAO,GAER,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QA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zB,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAsKzB","sourcesContent":["import type { SortParam } from '@internetarchive/search-service';\nimport {\n css,\n CSSResultGroup,\n html,\n LitElement,\n nothing,\n TemplateResult,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport '@a11y/focus-trap';\n\nimport { suppressedCollections, type TileModel } from '../../models';\nimport type { CollectionTitles } from '../../data-source/models';\nimport '../list/tile-list';\n\n@customElement('tile-hover-pane')\nexport class TileHoverPane extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) loggedIn: boolean = false;\n\n @property({ type: Boolean }) suppressBlurring: boolean = false;\n\n @property({ type: Object }) sortParam?: SortParam;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Object })\n collectionTitles?: CollectionTitles;\n\n protected render(): TemplateResult {\n return html`\n <div id=\"container\">\n <focus-trap>\n ${this.headerTemplate}\n <div id=\"hover-tile-list\">\n <tile-list\n .model=${this.model}\n .baseNavigationUrl=${this.baseNavigationUrl}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .sortParam=${this.sortParam}\n .collectionTitles=${this.collectionTitles}\n .mobileBreakpoint=${this.mobileBreakpoint}\n .currentWidth=${this.currentWidth}\n ></tile-list>\n </div>\n </focus-trap>\n </div>\n `;\n }\n\n private get headerTemplate(): TemplateResult | typeof nothing {\n // early return if item does't have parent collection\n if (this.model?.collections?.length === 0) return nothing;\n\n let collectionTitle = '';\n let collectionIdentifier = '';\n\n for (const collection of this.model?.collections || []) {\n if (\n !suppressedCollections[collection] &&\n !collection.startsWith('fav-')\n ) {\n collectionTitle = this.collectionTitles?.get(collection) ?? collection;\n collectionIdentifier = collection;\n break;\n }\n }\n\n // sometimes item does have collections but they are in suppressed or favorite list,\n // let's not render that\n if (!collectionIdentifier) return nothing;\n\n return html`\n <div id=\"list-line-header\">\n <a href=\"${this.baseNavigationUrl}/details/${collectionIdentifier}\">\n <img\n src=\"${this.baseImageUrl}/services/img/${collectionIdentifier}\"\n alt=\"\"\n /><span>${collectionTitle}</span>\n </a>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n const hoverPaneHeaderBGColor = css`var(--hoverPaneHeaderBGColor, #edf0ff)`;\n const iaLinkColor = css`var(--ia-theme-link-color, #4b64ff)`;\n const iaFontFamily = css`var(--ia-theme-base-font-family, \"Helvetica Neue\", Helvetica, Arial, sans-serif);`;\n\n return css`\n :host {\n margin: 0;\n border: 0;\n padding: 0;\n overflow: visible;\n color: inherit;\n background: none;\n visibility: hidden;\n opacity: 0;\n transform: translateY(8px);\n transition:\n opacity 0.1s ease-in,\n transform 0.1s ease-in;\n --image-width: auto;\n }\n\n :host(.visible) {\n visibility: visible;\n }\n\n :host(.fade-in) {\n opacity: 1;\n transform: translateY(0);\n }\n\n @media (prefers-reduced-motion: reduce) {\n :host {\n transition-duration: 0.001s !important; /* Imperceptibly fast */\n }\n }\n\n #container {\n width: max-content;\n max-width: min(45vw, 600px);\n border: 1px solid #ddd;\n border-radius: 4px;\n box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.8);\n background: white;\n }\n\n @media screen and (max-width: 600px) {\n #container {\n max-width: 80vw;\n }\n }\n\n /* main tile-list container */\n #hover-tile-list {\n padding: 10px;\n }\n\n /* header on hover panel to show collection icon and title */\n #list-line-header {\n background: ${hoverPaneHeaderBGColor};\n }\n #list-line-header a {\n display: flex;\n align-items: center;\n column-gap: 5px;\n height: 3.4rem;\n padding: 0 10px;\n border-radius: 4px 4px 0 0;\n width: fit-content;\n font-size: 1.4rem;\n color: ${iaLinkColor};\n font-family: ${iaFontFamily};\n text-decoration: none;\n width: auto;\n }\n #list-line-header a span {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n #list-line-header a:hover {\n text-decoration: underline;\n }\n #list-line-header a img {\n width: 30px;\n max-height: 30px;\n }\n `;\n }\n}\n"]}
@@ -14,7 +14,8 @@ let ImageBlock = class ImageBlock extends LitElement {
14
14
  this.viewSize = 'desktop';
15
15
  }
16
16
  render() {
17
- if (!this.model?.identifier)
17
+ var _a;
18
+ if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.identifier))
18
19
  return nothing;
19
20
  return html `
20
21
  <div class=${classMap(this.baseClass)}>
@@ -33,13 +34,14 @@ let ImageBlock = class ImageBlock extends LitElement {
33
34
  `;
34
35
  }
35
36
  get baseClass() {
37
+ var _a, _b;
36
38
  return {
37
39
  container: true,
38
40
  list: this.isListTile && !this.isCompactTile,
39
41
  'list-compact': this.isListTile && this.isCompactTile,
40
- collection: this.model?.mediatype === 'collection', // fill the image in container
42
+ collection: ((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'collection', // fill the image in container
41
43
  [this.viewSize]: true,
42
- 'search-image': this.model?.mediatype === 'search',
44
+ 'search-image': ((_b = this.model) === null || _b === void 0 ? void 0 : _b.mediatype) === 'search',
43
45
  };
44
46
  }
45
47
  get iconOverlayTemplate() {
@@ -67,15 +69,16 @@ let ImageBlock = class ImageBlock extends LitElement {
67
69
  return html ` <text-overlay .type=${this.overlayType}></text-overlay> `;
68
70
  }
69
71
  get overlayType() {
72
+ var _a, _b;
70
73
  if (this.suppressBlurring)
71
74
  return undefined;
72
75
  // Prioritize showing the login-required overlay if needed.
73
76
  // Otherwise, if a content warning is required, show that overlay instead.
74
77
  // If neither flag is present, no overlay should be shown.
75
- if (this.model?.loginRequired && !this.loggedIn) {
78
+ if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.loginRequired) && !this.loggedIn) {
76
79
  return 'login-required';
77
80
  }
78
- if (this.model?.contentWarning) {
81
+ if ((_b = this.model) === null || _b === void 0 ? void 0 : _b.contentWarning) {
79
82
  return 'content-warning';
80
83
  }
81
84
  return undefined;
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yB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsDhD,CAAC;IACJ,CAAC;CACF,CAAA;AAtJ6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAuB;AAErB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAAuB;AAEtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CAAoB;AAEnB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDAA0B;AAE1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAA8B;AAb9C,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAuJtB","sourcesContent":["import { css, CSSResultGroup, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ClassInfo, classMap } from 'lit/directives/class-map.js';\n\nimport type { TileModel, TileOverlayType } from '../models';\n\nimport './overlay/icon-overlay';\nimport './overlay/text-overlay';\n\n@customElement('image-block')\nexport class ImageBlock extends LitElement {\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) isCompactTile = false;\n\n @property({ type: Boolean }) isListTile = false;\n\n @property({ type: Boolean }) loggedIn = false;\n\n @property({ type: Boolean }) suppressBlurring = false;\n\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) viewSize: string = 'desktop';\n\n render() {\n if (!this.model?.identifier) return nothing;\n\n return html`\n <div class=${classMap(this.baseClass)}>\n <item-image\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}\n .isListTile=${this.isListTile}\n .isCompactTile=${this.isCompactTile}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n style=\"--imgHeight: 100%; --imgWidth: 100%\"\n >\n </item-image>\n ${this.textOverlayTemplate} ${this.iconOverlayTemplate}\n </div>\n `;\n }\n\n private get baseClass(): ClassInfo {\n return {\n container: true,\n list: this.isListTile && !this.isCompactTile,\n 'list-compact': this.isListTile && this.isCompactTile,\n collection: this.model?.mediatype === 'collection', // fill the image in container\n [this.viewSize]: true,\n 'search-image': this.model?.mediatype === 'search',\n };\n }\n\n private get iconOverlayTemplate() {\n // Only list tiles use the icon overlay\n if (!this.isListTile) return nothing;\n\n const { overlayType } = this;\n if (!overlayType) return nothing;\n\n return html`\n <icon-overlay\n class=${this.isCompactTile ? 'list-compact' : 'list-detail'}\n .type=${this.overlayType}\n >\n </icon-overlay>\n `;\n }\n\n private get textOverlayTemplate() {\n // List tiles do not require the text overlay\n if (this.isListTile) return nothing;\n\n const { overlayType } = this;\n if (!overlayType) return nothing;\n\n return html` <text-overlay .type=${this.overlayType}></text-overlay> `;\n }\n\n private get overlayType(): TileOverlayType | undefined {\n if (this.suppressBlurring) return undefined;\n\n // Prioritize showing the login-required overlay if needed.\n // Otherwise, if a content warning is required, show that overlay instead.\n // If neither flag is present, no overlay should be shown.\n if (this.model?.loginRequired && !this.loggedIn) {\n return 'login-required';\n }\n if (this.model?.contentWarning) {\n return 'content-warning';\n }\n return undefined;\n }\n\n static get styles(): CSSResultGroup {\n const imageBlockBackgroundColor = css`var(--imageBlockBackgroundColor, #f1f1f4)`;\n\n return css`\n div {\n display: flex;\n justify-content: center;\n position: relative;\n background-color: ${imageBlockBackgroundColor};\n border-radius: 4px;\n }\n\n .grid {\n height: var(--imgBlockHeight, 16rem);\n flex: 1;\n position: initial;\n padding: 5px;\n border-radius: 4px 4px 0 0;\n }\n\n .collection.grid,\n .grid.search-image {\n display: block;\n }\n\n /** tile-list view */\n .list {\n border-radius: 0;\n background-color: var(--imageBlockListBackgroundColor, #ebebee);\n box-shadow: 1px 1px 2px rgb(0, 0, 0, 0.2);\n }\n\n .list.desktop {\n width: 100px;\n max-width: 100%;\n height: 100px;\n max-width: 100%;\n display: inline-block;\n position: relative;\n text-align: center;\n }\n\n .list.mobile {\n width: var(--image-width, 90px);\n height: 90px;\n }\n\n /** tile-list-compact view */\n .container.list-compact {\n display: block;\n text-align: center;\n }\n\n .list-compact.desktop {\n width: 45px;\n height: 45px;\n }\n\n .list-compact.mobile {\n width: 30px;\n height: 30px;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"image-block.js","sourceRoot":"","sources":["../../../src/tiles/image-block.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAa,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIlE,OAAO,wBAAwB,CAAC;AAChC,OAAO,wBAAwB,CAAC;AAGzB,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QAGwB,kBAAa,GAAG,KAAK,CAAC;QAEtB,eAAU,GAAG,KAAK,CAAC;QAEnB,aAAQ,GAAG,KAAK,CAAC;QAEjB,qBAAgB,GAAG,KAAK,CAAC;QAI1B,aAAQ,GAAW,SAAS,CAAC;IA0I3D,CAAC;IAxIC,MAAM;;QACJ,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,UAAU,CAAA;YAAE,OAAO,OAAO,CAAC;QAE5C,OAAO,IAAI,CAAA;mBACI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;;mBAExB,IAAI,CAAC,KAAK;0BACH,IAAI,CAAC,YAAY;wBACnB,IAAI,CAAC,UAAU;2BACZ,IAAI,CAAC,aAAa;sBACvB,IAAI,CAAC,QAAQ;8BACL,IAAI,CAAC,gBAAgB;;;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AC1D,IAAI,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,aAAa,KAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChD,OAAO,gBAAgB,CAAC;QAC1B,CAAC;QACD,IAAI,MAAA,IAAI,CAAC,KAAK,0CAAE,cAAc,EAAE,CAAC;YAC/B,OAAO,iBAAiB,CAAC;QAC3B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,MAAM;QACf,MAAM,yBAAyB,GAAG,GAAG,CAAA,2CAA2C,CAAC;QAEjF,OAAO,GAAG,CAAA;;;;;4BAKc,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsDhD,CAAC;IACJ,CAAC;CACF,CAAA;AAtJ6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAuB;AAErB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAAuB;AAEtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CAAoB;AAEnB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDAA0B;AAE1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAA8B;AAb9C,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAuJtB","sourcesContent":["import { css, CSSResultGroup, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ClassInfo, classMap } from 'lit/directives/class-map.js';\n\nimport type { TileModel, TileOverlayType } from '../models';\n\nimport './overlay/icon-overlay';\nimport './overlay/text-overlay';\n\n@customElement('image-block')\nexport class ImageBlock extends LitElement {\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) isCompactTile = false;\n\n @property({ type: Boolean }) isListTile = false;\n\n @property({ type: Boolean }) loggedIn = false;\n\n @property({ type: Boolean }) suppressBlurring = false;\n\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) viewSize: string = 'desktop';\n\n render() {\n if (!this.model?.identifier) return nothing;\n\n return html`\n <div class=${classMap(this.baseClass)}>\n <item-image\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}\n .isListTile=${this.isListTile}\n .isCompactTile=${this.isCompactTile}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n style=\"--imgHeight: 100%; --imgWidth: 100%\"\n >\n </item-image>\n ${this.textOverlayTemplate} ${this.iconOverlayTemplate}\n </div>\n `;\n }\n\n private get baseClass(): ClassInfo {\n return {\n container: true,\n list: this.isListTile && !this.isCompactTile,\n 'list-compact': this.isListTile && this.isCompactTile,\n collection: this.model?.mediatype === 'collection', // fill the image in container\n [this.viewSize]: true,\n 'search-image': this.model?.mediatype === 'search',\n };\n }\n\n private get iconOverlayTemplate() {\n // Only list tiles use the icon overlay\n if (!this.isListTile) return nothing;\n\n const { overlayType } = this;\n if (!overlayType) return nothing;\n\n return html`\n <icon-overlay\n class=${this.isCompactTile ? 'list-compact' : 'list-detail'}\n .type=${this.overlayType}\n >\n </icon-overlay>\n `;\n }\n\n private get textOverlayTemplate() {\n // List tiles do not require the text overlay\n if (this.isListTile) return nothing;\n\n const { overlayType } = this;\n if (!overlayType) return nothing;\n\n return html` <text-overlay .type=${this.overlayType}></text-overlay> `;\n }\n\n private get overlayType(): TileOverlayType | undefined {\n if (this.suppressBlurring) return undefined;\n\n // Prioritize showing the login-required overlay if needed.\n // Otherwise, if a content warning is required, show that overlay instead.\n // If neither flag is present, no overlay should be shown.\n if (this.model?.loginRequired && !this.loggedIn) {\n return 'login-required';\n }\n if (this.model?.contentWarning) {\n return 'content-warning';\n }\n return undefined;\n }\n\n static get styles(): CSSResultGroup {\n const imageBlockBackgroundColor = css`var(--imageBlockBackgroundColor, #f1f1f4)`;\n\n return css`\n div {\n display: flex;\n justify-content: center;\n position: relative;\n background-color: ${imageBlockBackgroundColor};\n border-radius: 4px;\n }\n\n .grid {\n height: var(--imgBlockHeight, 16rem);\n flex: 1;\n position: initial;\n padding: 5px;\n border-radius: 4px 4px 0 0;\n }\n\n .collection.grid,\n .grid.search-image {\n display: block;\n }\n\n /** tile-list view */\n .list {\n border-radius: 0;\n background-color: var(--imageBlockListBackgroundColor, #ebebee);\n box-shadow: 1px 1px 2px rgb(0, 0, 0, 0.2);\n }\n\n .list.desktop {\n width: 100px;\n max-width: 100%;\n height: 100px;\n max-width: 100%;\n display: inline-block;\n position: relative;\n text-align: center;\n }\n\n .list.mobile {\n width: var(--image-width, 90px);\n height: 90px;\n }\n\n /** tile-list-compact view */\n .container.list-compact {\n display: block;\n text-align: center;\n }\n\n .list-compact.desktop {\n width: 45px;\n height: 45px;\n }\n\n .list-compact.mobile {\n width: 30px;\n height: 30px;\n }\n `;\n }\n}\n"]}
@@ -20,7 +20,8 @@ let ItemImage = class ItemImage extends LitElement {
20
20
  `;
21
21
  }
22
22
  get imageTemplate() {
23
- if (this.model?.mediatype === 'search') {
23
+ var _a;
24
+ if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'search') {
24
25
  return html `${searchIcon}`;
25
26
  }
26
27
  return html `
@@ -37,10 +38,11 @@ let ItemImage = class ItemImage extends LitElement {
37
38
  * Helpers
38
39
  */
39
40
  get imageSrc() {
41
+ var _a, _b, _c;
40
42
  if (this.isNotFound)
41
43
  return this.notFoundSrc;
42
44
  // Use the correct image for web capture tiles, if possible
43
- if (this.model?.captureDates && this.model.identifier) {
45
+ if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.captureDates) && this.model.identifier) {
44
46
  try {
45
47
  const url = new URL(this.model.identifier);
46
48
  const domain = encodeURIComponent(url.hostname);
@@ -48,15 +50,15 @@ let ItemImage = class ItemImage extends LitElement {
48
50
  ? `https://web.archive.org/thumb/${domain}?generate=1`
49
51
  : nothing;
50
52
  }
51
- catch {
53
+ catch (_d) {
52
54
  return `${this.baseImageUrl}/images/notfound.png`;
53
55
  }
54
56
  }
55
57
  // Use the thumbnail URL specified in the model if it exists
56
- if (this.model?.thumbnailUrl)
58
+ if ((_b = this.model) === null || _b === void 0 ? void 0 : _b.thumbnailUrl)
57
59
  return this.model.thumbnailUrl;
58
60
  // Don't try to load invalid image URLs
59
- return this.baseImageUrl && this.model?.identifier
61
+ return this.baseImageUrl && ((_c = this.model) === null || _c === void 0 ? void 0 : _c.identifier)
60
62
  ? `${this.baseImageUrl}/services/img/${this.model.identifier}`
61
63
  : nothing;
62
64
  }
@@ -66,7 +68,8 @@ let ItemImage = class ItemImage extends LitElement {
66
68
  : nothing;
67
69
  }
68
70
  get hashBasedGradient() {
69
- if (!this.model?.identifier) {
71
+ var _a;
72
+ if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.identifier)) {
70
73
  return 'waveform-grad0';
71
74
  }
72
75
  const gradient = this.hashStrToInt(this.model.identifier) % 6; // returns 0-5
@@ -81,15 +84,17 @@ let ItemImage = class ItemImage extends LitElement {
81
84
  * Classes
82
85
  */
83
86
  get itemBaseClass() {
87
+ var _a;
84
88
  return {
85
89
  'drop-shadow': true,
86
90
  'list-box': this.isListTile,
87
- 'search-image': this.model?.mediatype === 'search',
91
+ 'search-image': ((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'search',
88
92
  [this.hashBasedGradient]: this.isWaveform,
89
93
  };
90
94
  }
91
95
  get itemImageClass() {
92
- const hasSensitiveContent = !!(this.model?.contentWarning || this.model?.loginRequired);
96
+ var _a, _b, _c;
97
+ const hasSensitiveContent = !!(((_a = this.model) === null || _a === void 0 ? void 0 : _a.contentWarning) || ((_b = this.model) === null || _b === void 0 ? void 0 : _b.loginRequired));
93
98
  const shouldBlur = hasSensitiveContent && !this.suppressBlurring;
94
99
  return {
95
100
  contain: !this.isCompactTile && !this.isWaveform,
@@ -97,14 +102,15 @@ let ItemImage = class ItemImage extends LitElement {
97
102
  blur: shouldBlur,
98
103
  waveform: this.isWaveform,
99
104
  'account-image': this.isAccountImage, // for account tile image
100
- 'collection-image': this.model?.mediatype === 'collection', // for collection tile image
105
+ 'collection-image': ((_c = this.model) === null || _c === void 0 ? void 0 : _c.mediatype) === 'collection', // for collection tile image
101
106
  };
102
107
  }
103
108
  /**
104
109
  * Helper function to determine if account tile image
105
110
  */
106
111
  get isAccountImage() {
107
- return (this.model?.mediatype === 'account' &&
112
+ var _a;
113
+ return (((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'account' &&
108
114
  !this.isCompactTile &&
109
115
  !this.isListTile);
110
116
  }
@@ -112,8 +118,9 @@ let ItemImage = class ItemImage extends LitElement {
112
118
  * Event listener sets isWaveform true if image is waveform
113
119
  */
114
120
  onLoad() {
115
- if ((this.model?.mediatype === 'audio' ||
116
- this.model?.mediatype === 'etree') &&
121
+ var _a, _b;
122
+ if ((((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'audio' ||
123
+ ((_b = this.model) === null || _b === void 0 ? void 0 : _b.mediatype) === 'etree') &&
117
124
  this.baseImage.naturalWidth / this.baseImage.naturalHeight === 4) {
118
125
  this.isWaveform = true;
119
126
  }
@@ -1 +1 @@
1
- {"version":3,"file":"item-image.js","sourceRoot":"","sources":["../../../src/tiles/item-image.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAa,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIlE,OAAO,EACL,mBAAmB,EACn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,MAAM;QACf,OAAO;YACL,mBAAmB;YACnB,sBAAsB;YACtB,GAAG,CAAA;;;;;;;;;;;;;;;;;;OAkBF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA5K6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAuB;AAErB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAoB;AAEnB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAuB;AAEtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAA0B;AAErC;IAAhB,KAAK,EAAE;6CAA4B;AAEnB;IAAhB,KAAK,EAAE;6CAA4B;AAEd;IAArB,KAAK,CAAC,KAAK,CAAC;4CAAsC;AAjBxC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CA6KrB","sourcesContent":["import { css, CSSResultGroup, html, LitElement, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { ClassInfo, classMap } from 'lit/directives/class-map.js';\n\nimport type { TileModel } from '../models';\n\nimport {\n baseItemImageStyles,\n waveformGradientStyles,\n} from '../styles/item-image-styles';\nimport { searchIcon } from '../assets/img/icons/mediatype/search';\n\n@customElement('item-image')\nexport class ItemImage extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) isListTile = false;\n\n @property({ type: Boolean }) isCompactTile = false;\n\n @property({ type: Boolean }) loggedIn = false;\n\n @property({ type: Boolean }) suppressBlurring = false;\n\n @state() private isWaveform = false;\n\n @state() private isNotFound = false;\n\n @query('img') private baseImage!: HTMLImageElement;\n\n render() {\n return html`\n <div class=${classMap(this.itemBaseClass)}>${this.imageTemplate}</div>\n `;\n }\n\n private get imageTemplate() {\n if (this.model?.mediatype === 'search') {\n return html`${searchIcon}`;\n }\n\n return html`\n <img\n class=${classMap(this.itemImageClass)}\n src=\"${this.imageSrc}\"\n alt=\"\"\n @load=${this.onLoad}\n @error=${this.onError}\n />\n `;\n }\n\n /**\n * Helpers\n */\n private get imageSrc() {\n if (this.isNotFound) return this.notFoundSrc;\n\n // Use the correct image for web capture tiles, if possible\n if (this.model?.captureDates && this.model.identifier) {\n try {\n const url = new URL(this.model.identifier);\n const domain = encodeURIComponent(url.hostname);\n return this.baseImageUrl\n ? `https://web.archive.org/thumb/${domain}?generate=1`\n : nothing;\n } catch {\n return `${this.baseImageUrl}/images/notfound.png`;\n }\n }\n\n // Use the thumbnail URL specified in the model if it exists\n if (this.model?.thumbnailUrl) return this.model.thumbnailUrl;\n\n // Don't try to load invalid image URLs\n return this.baseImageUrl && this.model?.identifier\n ? `${this.baseImageUrl}/services/img/${this.model.identifier}`\n : nothing;\n }\n\n private get notFoundSrc() {\n return this.baseImageUrl\n ? `${this.baseImageUrl}/images/notfound.png`\n : nothing;\n }\n\n private get hashBasedGradient() {\n if (!this.model?.identifier) {\n return 'waveform-grad0';\n }\n const gradient = this.hashStrToInt(this.model.identifier) % 6; // returns 0-5\n return `waveform-grad${gradient}`;\n }\n\n private hashStrToInt(str: string): number {\n return str\n .split('')\n .reduce((acc: number, char: string) => acc + char.charCodeAt(0), 0);\n }\n\n /**\n * Classes\n */\n private get itemBaseClass(): ClassInfo {\n return {\n 'drop-shadow': true,\n 'list-box': this.isListTile,\n 'search-image': this.model?.mediatype === 'search',\n [this.hashBasedGradient]: this.isWaveform,\n };\n }\n\n private get itemImageClass(): ClassInfo {\n const hasSensitiveContent = !!(\n this.model?.contentWarning || this.model?.loginRequired\n );\n const shouldBlur = hasSensitiveContent && !this.suppressBlurring;\n\n return {\n contain: !this.isCompactTile && !this.isWaveform,\n cover: this.isCompactTile,\n blur: shouldBlur,\n waveform: this.isWaveform,\n 'account-image': this.isAccountImage, // for account tile image\n 'collection-image': this.model?.mediatype === 'collection', // for collection tile image\n };\n }\n\n /**\n * Helper function to determine if account tile image\n */\n private get isAccountImage() {\n return (\n this.model?.mediatype === 'account' &&\n !this.isCompactTile &&\n !this.isListTile\n );\n }\n\n /**\n * Event listener sets isWaveform true if image is waveform\n */\n private onLoad() {\n if (\n (this.model?.mediatype === 'audio' ||\n this.model?.mediatype === 'etree') &&\n this.baseImage.naturalWidth / this.baseImage.naturalHeight === 4\n ) {\n this.isWaveform = true;\n }\n }\n\n private onError() {\n this.isNotFound = true;\n }\n\n /**\n * CSS\n */\n static get styles(): CSSResultGroup {\n return [\n baseItemImageStyles,\n waveformGradientStyles,\n css`\n img {\n height: var(--imgHeight, 16rem);\n width: var(--imgWidth, 16rem);\n }\n\n .search-image {\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgb(245, 245, 247);\n border-radius: 4px;\n }\n\n svg {\n height: 10rem;\n width: 10rem;\n }\n `,\n ];\n }\n}\n"]}
1
+ {"version":3,"file":"item-image.js","sourceRoot":"","sources":["../../../src/tiles/item-image.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAa,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIlE,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAG3D,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QAKwB,eAAU,GAAG,KAAK,CAAC;QAEnB,kBAAa,GAAG,KAAK,CAAC;QAEt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tB,GAAG,CAAA;;;;;;;;;;;;;;;;;;OAkBF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA5K6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAuB;AAErB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAoB;AAEnB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAuB;AAEtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAA0B;AAErC;IAAhB,KAAK,EAAE;6CAA4B;AAEnB;IAAhB,KAAK,EAAE;6CAA4B;AAEd;IAArB,KAAK,CAAC,KAAK,CAAC;4CAAsC;AAjBxC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CA6KrB","sourcesContent":["import { css, CSSResultGroup, html, LitElement, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { ClassInfo, classMap } from 'lit/directives/class-map.js';\n\nimport type { TileModel } from '../models';\n\nimport {\n baseItemImageStyles,\n waveformGradientStyles,\n} from '../styles/item-image-styles';\nimport { searchIcon } from '../assets/img/icons/mediatype/search';\n\n@customElement('item-image')\nexport class ItemImage extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) isListTile = false;\n\n @property({ type: Boolean }) isCompactTile = false;\n\n @property({ type: Boolean }) loggedIn = false;\n\n @property({ type: Boolean }) suppressBlurring = false;\n\n @state() private isWaveform = false;\n\n @state() private isNotFound = false;\n\n @query('img') private baseImage!: HTMLImageElement;\n\n render() {\n return html`\n <div class=${classMap(this.itemBaseClass)}>${this.imageTemplate}</div>\n `;\n }\n\n private get imageTemplate() {\n if (this.model?.mediatype === 'search') {\n return html`${searchIcon}`;\n }\n\n return html`\n <img\n class=${classMap(this.itemImageClass)}\n src=\"${this.imageSrc}\"\n alt=\"\"\n @load=${this.onLoad}\n @error=${this.onError}\n />\n `;\n }\n\n /**\n * Helpers\n */\n private get imageSrc() {\n if (this.isNotFound) return this.notFoundSrc;\n\n // Use the correct image for web capture tiles, if possible\n if (this.model?.captureDates && this.model.identifier) {\n try {\n const url = new URL(this.model.identifier);\n const domain = encodeURIComponent(url.hostname);\n return this.baseImageUrl\n ? `https://web.archive.org/thumb/${domain}?generate=1`\n : nothing;\n } catch {\n return `${this.baseImageUrl}/images/notfound.png`;\n }\n }\n\n // Use the thumbnail URL specified in the model if it exists\n if (this.model?.thumbnailUrl) return this.model.thumbnailUrl;\n\n // Don't try to load invalid image URLs\n return this.baseImageUrl && this.model?.identifier\n ? `${this.baseImageUrl}/services/img/${this.model.identifier}`\n : nothing;\n }\n\n private get notFoundSrc() {\n return this.baseImageUrl\n ? `${this.baseImageUrl}/images/notfound.png`\n : nothing;\n }\n\n private get hashBasedGradient() {\n if (!this.model?.identifier) {\n return 'waveform-grad0';\n }\n const gradient = this.hashStrToInt(this.model.identifier) % 6; // returns 0-5\n return `waveform-grad${gradient}`;\n }\n\n private hashStrToInt(str: string): number {\n return str\n .split('')\n .reduce((acc: number, char: string) => acc + char.charCodeAt(0), 0);\n }\n\n /**\n * Classes\n */\n private get itemBaseClass(): ClassInfo {\n return {\n 'drop-shadow': true,\n 'list-box': this.isListTile,\n 'search-image': this.model?.mediatype === 'search',\n [this.hashBasedGradient]: this.isWaveform,\n };\n }\n\n private get itemImageClass(): ClassInfo {\n const hasSensitiveContent = !!(\n this.model?.contentWarning || this.model?.loginRequired\n );\n const shouldBlur = hasSensitiveContent && !this.suppressBlurring;\n\n return {\n contain: !this.isCompactTile && !this.isWaveform,\n cover: this.isCompactTile,\n blur: shouldBlur,\n waveform: this.isWaveform,\n 'account-image': this.isAccountImage, // for account tile image\n 'collection-image': this.model?.mediatype === 'collection', // for collection tile image\n };\n }\n\n /**\n * Helper function to determine if account tile image\n */\n private get isAccountImage() {\n return (\n this.model?.mediatype === 'account' &&\n !this.isCompactTile &&\n !this.isListTile\n );\n }\n\n /**\n * Event listener sets isWaveform true if image is waveform\n */\n private onLoad() {\n if (\n (this.model?.mediatype === 'audio' ||\n this.model?.mediatype === 'etree') &&\n this.baseImage.naturalWidth / this.baseImage.naturalHeight === 4\n ) {\n this.isWaveform = true;\n }\n }\n\n private onError() {\n this.isNotFound = true;\n }\n\n /**\n * CSS\n */\n static get styles(): CSSResultGroup {\n return [\n baseItemImageStyles,\n waveformGradientStyles,\n css`\n img {\n height: var(--imgHeight, 16rem);\n width: var(--imgWidth, 16rem);\n }\n\n .search-image {\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgb(245, 245, 247);\n border-radius: 4px;\n }\n\n svg {\n height: 10rem;\n width: 10rem;\n }\n `,\n ];\n }\n}\n"]}
@@ -25,6 +25,7 @@ let TileListCompact = class TileListCompact extends BaseTileComponent {
25
25
  * - useLocalTime = false;
26
26
  */
27
27
  render() {
28
+ var _a, _b, _c, _d;
28
29
  return html `
29
30
  <div id="list-line" class="${this.classSize}">
30
31
  <image-block
@@ -38,10 +39,10 @@ let TileListCompact = class TileListCompact extends BaseTileComponent {
38
39
  >
39
40
  </image-block>
40
41
  <a href=${this.href} id="title"
41
- >${DOMPurify.sanitize(this.model?.title ?? '')}</a
42
+ >${DOMPurify.sanitize((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : '')}</a
42
43
  >
43
44
  <div id="creator">
44
- ${this.model?.mediatype === 'account'
45
+ ${((_c = this.model) === null || _c === void 0 ? void 0 : _c.mediatype) === 'account'
45
46
  ? this.displayValueProvider.accountLabel
46
47
  : this.creator}
47
48
  </div>
@@ -51,12 +52,13 @@ let TileListCompact = class TileListCompact extends BaseTileComponent {
51
52
  <div id="icon">
52
53
  <tile-mediatype-icon .model=${this.model}> </tile-mediatype-icon>
53
54
  </div>
54
- <div id="views">${formatCount(this.views ?? 0, this.formatSize)}</div>
55
+ <div id="views">${formatCount((_d = this.views) !== null && _d !== void 0 ? _d : 0, this.formatSize)}</div>
55
56
  </div>
56
57
  `;
57
58
  }
58
59
  get href() {
59
- if (!this.model?.identifier || this.baseNavigationUrl == null)
60
+ var _a;
61
+ if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.identifier) || this.baseNavigationUrl == null)
60
62
  return nothing;
61
63
  // Use the server-specified href if available.
62
64
  // Otherwise, construct a details page URL from the item identifier.
@@ -66,7 +68,8 @@ let TileListCompact = class TileListCompact extends BaseTileComponent {
66
68
  return this.displayValueProvider.itemPageUrl(this.model.identifier, this.model.mediatype === 'collection');
67
69
  }
68
70
  get creator() {
69
- return this.displayValueProvider.firstCreatorMatchingFilter ?? nothing;
71
+ var _a;
72
+ return (_a = this.displayValueProvider.firstCreatorMatchingFilter) !== null && _a !== void 0 ? _a : nothing;
70
73
  }
71
74
  /*
72
75
  * TODO: fix field names to match model in src/collection-browser.ts
@@ -74,33 +77,36 @@ let TileListCompact = class TileListCompact extends BaseTileComponent {
74
77
  * @see src/models.ts
75
78
  */
76
79
  get date() {
80
+ var _a, _b, _c, _d, _e;
77
81
  // Note on 'publicdate' vs. 'date':
78
82
  // The search engine metadata uses 'publicdate' as the key for the date the item
79
83
  // was created on archive.org, which in the UI is referred to as "Date Archived".
80
84
  // In contrast, the search engine metadata uses 'date' to refer to the actual
81
85
  // publication date of the underlying media ("Date Published" in the UI).
82
86
  // Refer to the full metadata schema for more info.
83
- switch (this.effectiveSort?.field) {
87
+ switch ((_a = this.effectiveSort) === null || _a === void 0 ? void 0 : _a.field) {
84
88
  case 'publicdate':
85
- return this.model?.dateArchived;
89
+ return (_b = this.model) === null || _b === void 0 ? void 0 : _b.dateArchived;
86
90
  case 'reviewdate':
87
- return this.model?.dateReviewed;
91
+ return (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed;
88
92
  case 'addeddate':
89
- return this.model?.dateAdded;
93
+ return (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded;
90
94
  default:
91
- return this.model?.datePublished;
95
+ return (_e = this.model) === null || _e === void 0 ? void 0 : _e.datePublished;
92
96
  }
93
97
  }
94
98
  get views() {
95
- return this.effectiveSort?.field === 'week'
96
- ? this.model?.weeklyViewCount // weekly views
97
- : this.model?.viewCount; // all-time views
99
+ var _a, _b, _c;
100
+ return ((_a = this.effectiveSort) === null || _a === void 0 ? void 0 : _a.field) === 'week'
101
+ ? (_b = this.model) === null || _b === void 0 ? void 0 : _b.weeklyViewCount // weekly views
102
+ : (_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount; // all-time views
98
103
  }
99
104
  /**
100
105
  * Returns the active sort param if one is set, or the default sort param otherwise.
101
106
  */
102
107
  get effectiveSort() {
103
- return this.sortParam ?? this.defaultSortParam;
108
+ var _a;
109
+ return (_a = this.sortParam) !== null && _a !== void 0 ? _a : this.defaultSortParam;
104
110
  }
105
111
  get classSize() {
106
112
  if (this.mobileBreakpoint &&
@@ -111,11 +117,12 @@ let TileListCompact = class TileListCompact extends BaseTileComponent {
111
117
  return 'desktop';
112
118
  }
113
119
  get dateFormatSize() {
120
+ var _a, _b;
114
121
  // If we're showing a date published of Jan 1 at midnight, only show the year.
115
122
  // This is because items with only a year for their publication date are normalized to
116
123
  // Jan 1 at midnight timestamps in the search engine documents.
117
- if ((!this.isSortedByDate || this.effectiveSort?.field === 'date') && // Any sort except dates that aren't published date
118
- isFirstMillisecondOfUTCYear(this.model?.datePublished)) {
124
+ if ((!this.isSortedByDate || ((_a = this.effectiveSort) === null || _a === void 0 ? void 0 : _a.field) === 'date') && // Any sort except dates that aren't published date
125
+ isFirstMillisecondOfUTCYear((_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished)) {
119
126
  return 'year-only';
120
127
  }
121
128
  return this.formatSize;
@@ -129,7 +136,8 @@ let TileListCompact = class TileListCompact extends BaseTileComponent {
129
136
  return 'long';
130
137
  }
131
138
  get isSortedByDate() {
132
- return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(this.effectiveSort?.field);
139
+ var _a;
140
+ return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes((_a = this.effectiveSort) === null || _a === void 0 ? void 0 : _a.field);
133
141
  }
134
142
  static get styles() {
135
143
  return css `