@internetarchive/collection-browser 3.3.2 → 3.3.4-alpha-webdev7761.0
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.
- package/.editorconfig +29 -29
- package/.github/workflows/ci.yml +27 -27
- package/.github/workflows/gh-pages-main.yml +39 -39
- package/.github/workflows/npm-publish.yml +39 -39
- package/.github/workflows/pr-preview.yml +38 -38
- package/.husky/pre-commit +4 -4
- package/.prettierignore +1 -1
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/index.d.ts +16 -0
- package/dist/index.js.map +1 -0
- package/dist/src/app-root.d.ts +105 -0
- package/dist/src/app-root.js +1076 -0
- package/dist/src/app-root.js.map +1 -0
- package/dist/src/assets/img/icons/arrow-left.d.ts +2 -0
- package/dist/src/assets/img/icons/arrow-left.js +10 -0
- package/dist/src/assets/img/icons/arrow-left.js.map +1 -0
- package/dist/src/assets/img/icons/arrow-right.d.ts +2 -0
- package/dist/src/assets/img/icons/arrow-right.js +10 -0
- package/dist/src/assets/img/icons/arrow-right.js.map +1 -0
- package/dist/src/assets/img/icons/chevron.d.ts +2 -0
- package/dist/src/assets/img/icons/chevron.js +4 -0
- package/dist/src/assets/img/icons/chevron.js.map +1 -0
- package/dist/src/assets/img/icons/close-circle-dark.d.ts +2 -0
- package/dist/src/assets/img/icons/close-circle-dark.js +5 -0
- package/dist/src/assets/img/icons/close-circle-dark.js.map +1 -0
- package/dist/src/assets/img/icons/contract.d.ts +2 -0
- package/dist/src/assets/img/icons/contract.js +9 -0
- package/dist/src/assets/img/icons/contract.js.map +1 -0
- package/dist/src/assets/img/icons/empty-query.d.ts +2 -0
- package/dist/src/assets/img/icons/empty-query.js +5 -0
- package/dist/src/assets/img/icons/empty-query.js.map +1 -0
- package/dist/src/assets/img/icons/expand.d.ts +2 -0
- package/dist/src/assets/img/icons/expand.js +9 -0
- package/dist/src/assets/img/icons/expand.js.map +1 -0
- package/dist/src/assets/img/icons/eye-closed.d.ts +2 -0
- package/dist/src/assets/img/icons/eye-closed.js +5 -0
- package/dist/src/assets/img/icons/eye-closed.js.map +1 -0
- package/dist/src/assets/img/icons/eye.d.ts +2 -0
- package/dist/src/assets/img/icons/eye.js +5 -0
- package/dist/src/assets/img/icons/eye.js.map +1 -0
- package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -0
- package/dist/src/assets/img/icons/favorite-filled.js +10 -0
- package/dist/src/assets/img/icons/favorite-filled.js.map +1 -0
- package/dist/src/assets/img/icons/favorite-unfilled.d.ts +1 -0
- package/dist/src/assets/img/icons/favorite-unfilled.js +9 -0
- package/dist/src/assets/img/icons/favorite-unfilled.js.map +1 -0
- package/dist/src/assets/img/icons/filter.d.ts +2 -0
- package/dist/src/assets/img/icons/filter.js +10 -0
- package/dist/src/assets/img/icons/filter.js.map +1 -0
- package/dist/src/assets/img/icons/login-required.d.ts +1 -0
- package/dist/src/assets/img/icons/login-required.js +18 -0
- package/dist/src/assets/img/icons/login-required.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/account.js +14 -0
- package/dist/src/assets/img/icons/mediatype/account.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/audio.js +14 -0
- package/dist/src/assets/img/icons/mediatype/audio.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/collection.js +12 -0
- package/dist/src/assets/img/icons/mediatype/collection.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/data.js +15 -0
- package/dist/src/assets/img/icons/mediatype/data.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/etree.js +14 -0
- package/dist/src/assets/img/icons/mediatype/etree.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/film.js +14 -0
- package/dist/src/assets/img/icons/mediatype/film.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/images.js +13 -0
- package/dist/src/assets/img/icons/mediatype/images.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/radio.js +15 -0
- package/dist/src/assets/img/icons/mediatype/radio.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/search.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/search.js +14 -0
- package/dist/src/assets/img/icons/mediatype/search.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/software.js +13 -0
- package/dist/src/assets/img/icons/mediatype/software.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/texts.js +13 -0
- package/dist/src/assets/img/icons/mediatype/texts.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/tv-commercial.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/tv-commercial.js +12 -0
- package/dist/src/assets/img/icons/mediatype/tv-commercial.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/tv-fact-check.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/tv-fact-check.js +12 -0
- package/dist/src/assets/img/icons/mediatype/tv-fact-check.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/tv-quote.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/tv-quote.js +12 -0
- package/dist/src/assets/img/icons/mediatype/tv-quote.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/tv.js +14 -0
- package/dist/src/assets/img/icons/mediatype/tv.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/video.js +14 -0
- package/dist/src/assets/img/icons/mediatype/video.js.map +1 -0
- package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -0
- package/dist/src/assets/img/icons/mediatype/web.js +13 -0
- package/dist/src/assets/img/icons/mediatype/web.js.map +1 -0
- package/dist/src/assets/img/icons/null-result.d.ts +2 -0
- package/dist/src/assets/img/icons/null-result.js +5 -0
- package/dist/src/assets/img/icons/null-result.js.map +1 -0
- package/dist/src/assets/img/icons/quote.d.ts +1 -0
- package/dist/src/assets/img/icons/quote.js +7 -0
- package/dist/src/assets/img/icons/quote.js.map +1 -0
- package/dist/src/assets/img/icons/restricted.d.ts +1 -0
- package/dist/src/assets/img/icons/restricted.js +13 -0
- package/dist/src/assets/img/icons/restricted.js.map +1 -0
- package/dist/src/assets/img/icons/reviews.d.ts +1 -0
- package/dist/src/assets/img/icons/reviews.js +11 -0
- package/dist/src/assets/img/icons/reviews.js.map +1 -0
- package/dist/src/assets/img/icons/upload.d.ts +1 -0
- package/dist/src/assets/img/icons/upload.js +12 -0
- package/dist/src/assets/img/icons/upload.js.map +1 -0
- package/dist/src/assets/img/icons/views.d.ts +1 -0
- package/dist/src/assets/img/icons/views.js +11 -0
- package/dist/src/assets/img/icons/views.js.map +1 -0
- package/dist/src/circular-activity-indicator.d.ts +5 -0
- package/dist/src/circular-activity-indicator.js +66 -0
- package/dist/src/circular-activity-indicator.js.map +1 -0
- package/dist/src/collection-browser.d.ts +692 -0
- package/dist/src/collection-browser.js +2669 -0
- package/dist/src/collection-browser.js.map +1 -0
- package/dist/src/collection-facets/facet-row.d.ts +30 -0
- package/dist/src/collection-facets/facet-row.js +266 -0
- package/dist/src/collection-facets/facet-row.js.map +1 -0
- package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -0
- package/dist/src/collection-facets/facet-tombstone-row.js +43 -0
- package/dist/src/collection-facets/facet-tombstone-row.js.map +1 -0
- package/dist/src/collection-facets/facets-template.d.ts +13 -0
- package/dist/src/collection-facets/facets-template.js +68 -0
- package/dist/src/collection-facets/facets-template.js.map +1 -0
- package/dist/src/collection-facets/models.d.ts +9 -0
- package/dist/src/collection-facets/models.js +10 -0
- package/dist/src/collection-facets/models.js.map +1 -0
- package/dist/src/collection-facets/more-facets-content.d.ts +109 -0
- package/dist/src/collection-facets/more-facets-content.js +547 -0
- package/dist/src/collection-facets/more-facets-content.js.map +1 -0
- package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -0
- package/dist/src/collection-facets/more-facets-pagination.js +264 -0
- package/dist/src/collection-facets/more-facets-pagination.js.map +1 -0
- package/dist/src/collection-facets/smart-facets/dedupe.d.ts +10 -0
- package/dist/src/collection-facets/smart-facets/dedupe.js +35 -0
- package/dist/src/collection-facets/smart-facets/dedupe.js.map +1 -0
- package/dist/src/collection-facets/smart-facets/heuristics/browser-language/browser-language-heuristic.d.ts +5 -0
- package/dist/src/collection-facets/smart-facets/heuristics/browser-language/browser-language-heuristic.js +24 -0
- package/dist/src/collection-facets/smart-facets/heuristics/browser-language/browser-language-heuristic.js.map +1 -0
- package/dist/src/collection-facets/smart-facets/heuristics/index.d.ts +3 -0
- package/dist/src/collection-facets/smart-facets/heuristics/index.js +4 -0
- package/dist/src/collection-facets/smart-facets/heuristics/index.js.map +1 -0
- package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-heuristic.d.ts +4 -0
- package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-heuristic.js +14 -0
- package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-heuristic.js.map +1 -0
- package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-map.d.ts +6 -0
- package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-map.js +68 -0
- package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-map.js.map +1 -0
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.d.ts +9 -0
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.js +69 -0
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.js.map +1 -0
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.d.ts +21 -0
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +76 -0
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -0
- package/dist/src/collection-facets/smart-facets/models.d.ts +30 -0
- package/dist/src/collection-facets/smart-facets/models.js +2 -0
- package/dist/src/collection-facets/smart-facets/models.js.map +1 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.d.ts +54 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +383 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-button.d.ts +11 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-button.js +133 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.d.ts +28 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +172 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-equals.d.ts +2 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-equals.js +13 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-equals.js.map +1 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.d.ts +5 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js +18 -0
- package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -0
- package/dist/src/collection-facets/toggle-switch.d.ts +41 -0
- package/dist/src/collection-facets/toggle-switch.js +174 -0
- package/dist/src/collection-facets/toggle-switch.js.map +1 -0
- package/dist/src/collection-facets.d.ts +113 -0
- package/dist/src/collection-facets.js +884 -0
- package/dist/src/collection-facets.js.map +1 -0
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +270 -0
- package/dist/src/data-source/collection-browser-data-source-interface.js +2 -0
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -0
- package/dist/src/data-source/collection-browser-data-source.d.ts +418 -0
- package/dist/src/data-source/collection-browser-data-source.js +1121 -0
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -0
- package/dist/src/data-source/collection-browser-query-state.d.ts +48 -0
- package/dist/src/data-source/collection-browser-query-state.js +2 -0
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -0
- package/dist/src/data-source/models.d.ts +43 -0
- package/dist/src/data-source/models.js +9 -0
- package/dist/src/data-source/models.js.map +1 -0
- package/dist/src/empty-placeholder.d.ts +23 -0
- package/dist/src/empty-placeholder.js +165 -0
- package/dist/src/empty-placeholder.js.map +1 -0
- package/dist/src/expanded-date-picker.d.ts +50 -0
- package/dist/src/expanded-date-picker.js +182 -0
- package/dist/src/expanded-date-picker.js.map +1 -0
- package/dist/src/language-code-handler/language-code-handler.d.ts +37 -0
- package/dist/src/language-code-handler/language-code-handler.js +27 -0
- package/dist/src/language-code-handler/language-code-handler.js.map +1 -0
- package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -0
- package/dist/src/language-code-handler/language-code-mapping.js +563 -0
- package/dist/src/language-code-handler/language-code-mapping.js.map +1 -0
- package/dist/src/manage/manage-bar.d.ts +58 -0
- package/dist/src/manage/manage-bar.js +237 -0
- package/dist/src/manage/manage-bar.js.map +1 -0
- package/dist/src/manage/remove-items-modal-content.d.ts +9 -0
- package/dist/src/manage/remove-items-modal-content.js +104 -0
- package/dist/src/manage/remove-items-modal-content.js.map +1 -0
- package/dist/src/mediatype/mediatype-config.d.ts +11 -0
- package/dist/src/mediatype/mediatype-config.js +116 -0
- package/dist/src/mediatype/mediatype-config.js.map +1 -0
- package/dist/src/models.d.ts +298 -0
- package/dist/src/models.js +507 -0
- package/dist/src/models.js.map +1 -0
- package/dist/src/restoration-state-handler.d.ts +74 -0
- package/dist/src/restoration-state-handler.js +397 -0
- package/dist/src/restoration-state-handler.js.map +1 -0
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -0
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +60 -0
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js.map +1 -0
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +21 -0
- package/dist/src/sort-filter-bar/alpha-bar.js +241 -0
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -0
- package/dist/src/sort-filter-bar/img/compact.d.ts +1 -0
- package/dist/src/sort-filter-bar/img/compact.js +5 -0
- package/dist/src/sort-filter-bar/img/compact.js.map +1 -0
- package/dist/src/sort-filter-bar/img/list.d.ts +1 -0
- package/dist/src/sort-filter-bar/img/list.js +5 -0
- package/dist/src/sort-filter-bar/img/list.js.map +1 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +15 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js.map +1 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-down.js +17 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-down.js.map +1 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-up.js +17 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-up.js.map +1 -0
- package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -0
- package/dist/src/sort-filter-bar/img/sort-triangle.js +5 -0
- package/dist/src/sort-filter-bar/img/sort-triangle.js.map +1 -0
- package/dist/src/sort-filter-bar/img/tile.d.ts +1 -0
- package/dist/src/sort-filter-bar/img/tile.js +5 -0
- package/dist/src/sort-filter-bar/img/tile.js.map +1 -0
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +278 -0
- package/dist/src/sort-filter-bar/sort-filter-bar.js +1161 -0
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -0
- package/dist/src/styles/ia-button.d.ts +2 -0
- package/dist/src/styles/ia-button.js +134 -0
- package/dist/src/styles/ia-button.js.map +1 -0
- package/dist/src/styles/item-image-styles.d.ts +8 -0
- package/dist/src/styles/item-image-styles.js +123 -0
- package/dist/src/styles/item-image-styles.js.map +1 -0
- package/dist/src/styles/sr-only.d.ts +1 -0
- package/dist/src/styles/sr-only.js +18 -0
- package/dist/src/styles/sr-only.js.map +1 -0
- package/dist/src/tiles/base-tile-component.d.ts +27 -0
- package/dist/src/tiles/base-tile-component.js +82 -0
- package/dist/src/tiles/base-tile-component.js.map +1 -0
- package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -0
- package/dist/src/tiles/collection-browser-loading-tile.js +29 -0
- package/dist/src/tiles/collection-browser-loading-tile.js.map +1 -0
- package/dist/src/tiles/grid/account-tile.d.ts +18 -0
- package/dist/src/tiles/grid/account-tile.js +111 -0
- package/dist/src/tiles/grid/account-tile.js.map +1 -0
- package/dist/src/tiles/grid/collection-tile.d.ts +15 -0
- package/dist/src/tiles/grid/collection-tile.js +160 -0
- package/dist/src/tiles/grid/collection-tile.js.map +1 -0
- package/dist/src/tiles/grid/item-tile.d.ts +41 -0
- package/dist/src/tiles/grid/item-tile.js +321 -0
- package/dist/src/tiles/grid/item-tile.js.map +1 -0
- package/dist/src/tiles/grid/search-tile.d.ts +10 -0
- package/dist/src/tiles/grid/search-tile.js +95 -0
- package/dist/src/tiles/grid/search-tile.js.map +1 -0
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -0
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +128 -0
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -0
- package/dist/src/tiles/grid/tile-stats.d.ts +58 -0
- package/dist/src/tiles/grid/tile-stats.js +204 -0
- package/dist/src/tiles/grid/tile-stats.js.map +1 -0
- package/dist/src/tiles/hover/hover-pane-controller.d.ts +228 -0
- package/dist/src/tiles/hover/hover-pane-controller.js +446 -0
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -0
- package/dist/src/tiles/hover/tile-hover-pane.d.ts +20 -0
- package/dist/src/tiles/hover/tile-hover-pane.js +185 -0
- package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -0
- package/dist/src/tiles/image-block.d.ts +19 -0
- package/dist/src/tiles/image-block.js +175 -0
- package/dist/src/tiles/image-block.js.map +1 -0
- package/dist/src/tiles/item-image.d.ts +40 -0
- package/dist/src/tiles/item-image.js +191 -0
- package/dist/src/tiles/item-image.js.map +1 -0
- package/dist/src/tiles/list/tile-list-compact-header.d.ts +6 -0
- package/dist/src/tiles/list/tile-list-compact-header.js +85 -0
- package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -0
- package/dist/src/tiles/list/tile-list-compact.d.ts +19 -0
- package/dist/src/tiles/list/tile-list-compact.js +223 -0
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -0
- package/dist/src/tiles/list/tile-list.d.ts +54 -0
- package/dist/src/tiles/list/tile-list.js +621 -0
- package/dist/src/tiles/list/tile-list.js.map +1 -0
- package/dist/src/tiles/models.d.ts +1 -0
- package/dist/src/tiles/models.js +2 -0
- package/dist/src/tiles/models.js.map +1 -0
- package/dist/src/tiles/overlay/icon-overlay.d.ts +8 -0
- package/dist/src/tiles/overlay/icon-overlay.js +55 -0
- package/dist/src/tiles/overlay/icon-overlay.js.map +1 -0
- package/dist/src/tiles/overlay/text-overlay.d.ts +9 -0
- package/dist/src/tiles/overlay/text-overlay.js +74 -0
- package/dist/src/tiles/overlay/text-overlay.js.map +1 -0
- package/dist/src/tiles/review-block.d.ts +12 -0
- package/dist/src/tiles/review-block.js +134 -0
- package/dist/src/tiles/review-block.js.map +1 -0
- package/dist/src/tiles/text-snippet-block.d.ts +27 -0
- package/dist/src/tiles/text-snippet-block.js +132 -0
- package/dist/src/tiles/text-snippet-block.js.map +1 -0
- package/dist/src/tiles/tile-dispatcher.d.ts +71 -0
- package/dist/src/tiles/tile-dispatcher.js +472 -0
- package/dist/src/tiles/tile-dispatcher.js.map +1 -0
- package/dist/src/tiles/tile-display-value-provider.d.ts +47 -0
- package/dist/src/tiles/tile-display-value-provider.js +95 -0
- package/dist/src/tiles/tile-display-value-provider.js.map +1 -0
- package/dist/src/tiles/tile-mediatype-icon.d.ts +27 -0
- package/dist/src/tiles/tile-mediatype-icon.js +130 -0
- package/dist/src/tiles/tile-mediatype-icon.js.map +1 -0
- package/dist/src/utils/analytics-events.d.ts +28 -0
- package/dist/src/utils/analytics-events.js +31 -0
- package/dist/src/utils/analytics-events.js.map +1 -0
- package/dist/src/utils/array-equals.d.ts +4 -0
- package/dist/src/utils/array-equals.js +11 -0
- package/dist/src/utils/array-equals.js.map +1 -0
- package/dist/src/utils/collapse-repeated-quotes.d.ts +11 -0
- package/dist/src/utils/collapse-repeated-quotes.js +14 -0
- package/dist/src/utils/collapse-repeated-quotes.js.map +1 -0
- package/dist/src/utils/facet-utils.d.ts +83 -0
- package/dist/src/utils/facet-utils.js +152 -0
- package/dist/src/utils/facet-utils.js.map +1 -0
- package/dist/src/utils/format-count.d.ts +7 -0
- package/dist/src/utils/format-count.js +76 -0
- package/dist/src/utils/format-count.js.map +1 -0
- package/dist/src/utils/format-date.d.ts +16 -0
- package/dist/src/utils/format-date.js +33 -0
- package/dist/src/utils/format-date.js.map +1 -0
- package/dist/src/utils/format-unit-size.d.ts +2 -0
- package/dist/src/utils/format-unit-size.js +34 -0
- package/dist/src/utils/format-unit-size.js.map +1 -0
- package/dist/src/utils/local-date-from-utc.d.ts +9 -0
- package/dist/src/utils/local-date-from-utc.js +16 -0
- package/dist/src/utils/local-date-from-utc.js.map +1 -0
- package/dist/src/utils/log.d.ts +7 -0
- package/dist/src/utils/log.js +14 -0
- package/dist/src/utils/log.js.map +1 -0
- package/dist/src/utils/resolve-mediatype.d.ts +8 -0
- package/dist/src/utils/resolve-mediatype.js +24 -0
- package/dist/src/utils/resolve-mediatype.js.map +1 -0
- package/dist/src/utils/sha1.d.ts +2 -0
- package/dist/src/utils/sha1.js +9 -0
- package/dist/src/utils/sha1.js.map +1 -0
- package/dist/test/collection-browser.test.d.ts +1 -0
- package/dist/test/collection-browser.test.js +1721 -0
- package/dist/test/collection-browser.test.js.map +1 -0
- package/dist/test/collection-facets/facet-row.test.d.ts +1 -0
- package/dist/test/collection-facets/facet-row.test.js +274 -0
- package/dist/test/collection-facets/facet-row.test.js.map +1 -0
- package/dist/test/collection-facets/facets-template.test.d.ts +1 -0
- package/dist/test/collection-facets/facets-template.test.js +101 -0
- package/dist/test/collection-facets/facets-template.test.js.map +1 -0
- package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -0
- package/dist/test/collection-facets/more-facets-content.test.js +169 -0
- package/dist/test/collection-facets/more-facets-content.test.js.map +1 -0
- package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -0
- package/dist/test/collection-facets/more-facets-pagination.test.js +132 -0
- package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -0
- package/dist/test/collection-facets/toggle-switch.test.d.ts +1 -0
- package/dist/test/collection-facets/toggle-switch.test.js +96 -0
- package/dist/test/collection-facets/toggle-switch.test.js.map +1 -0
- package/dist/test/collection-facets.test.d.ts +2 -0
- package/dist/test/collection-facets.test.js +745 -0
- package/dist/test/collection-facets.test.js.map +1 -0
- package/dist/test/data-source/collection-browser-data-source.test.d.ts +1 -0
- package/dist/test/data-source/collection-browser-data-source.test.js +102 -0
- package/dist/test/data-source/collection-browser-data-source.test.js.map +1 -0
- package/dist/test/empty-placeholder.test.d.ts +1 -0
- package/dist/test/empty-placeholder.test.js +63 -0
- package/dist/test/empty-placeholder.test.js.map +1 -0
- package/dist/test/expanded-date-picker.test.d.ts +1 -0
- package/dist/test/expanded-date-picker.test.js +130 -0
- package/dist/test/expanded-date-picker.test.js.map +1 -0
- package/dist/test/icon-overlay.test.d.ts +1 -0
- package/dist/test/icon-overlay.test.js +30 -0
- package/dist/test/icon-overlay.test.js.map +1 -0
- package/dist/test/image-block.test.d.ts +1 -0
- package/dist/test/image-block.test.js +218 -0
- package/dist/test/image-block.test.js.map +1 -0
- package/dist/test/item-image.test.d.ts +1 -0
- package/dist/test/item-image.test.js +196 -0
- package/dist/test/item-image.test.js.map +1 -0
- package/dist/test/manage/manage-bar.test.d.ts +2 -0
- package/dist/test/manage/manage-bar.test.js +106 -0
- package/dist/test/manage/manage-bar.test.js.map +1 -0
- package/dist/test/manage/remove-items-modal-content.test.d.ts +1 -0
- package/dist/test/manage/remove-items-modal-content.test.js +65 -0
- package/dist/test/manage/remove-items-modal-content.test.js.map +1 -0
- package/dist/test/mediatype-config.test.d.ts +1 -0
- package/dist/test/mediatype-config.test.js +11 -0
- package/dist/test/mediatype-config.test.js.map +1 -0
- package/dist/test/mocks/mock-analytics-handler.d.ts +10 -0
- package/dist/test/mocks/mock-analytics-handler.js +16 -0
- package/dist/test/mocks/mock-analytics-handler.js.map +1 -0
- package/dist/test/mocks/mock-search-responses.d.ts +31 -0
- package/dist/test/mocks/mock-search-responses.js +1241 -0
- package/dist/test/mocks/mock-search-responses.js.map +1 -0
- package/dist/test/mocks/mock-search-service.d.ts +16 -0
- package/dist/test/mocks/mock-search-service.js +65 -0
- package/dist/test/mocks/mock-search-service.js.map +1 -0
- package/dist/test/restoration-state-handler.test.d.ts +1 -0
- package/dist/test/restoration-state-handler.test.js +343 -0
- package/dist/test/restoration-state-handler.test.js.map +1 -0
- package/dist/test/review-block.test.d.ts +1 -0
- package/dist/test/review-block.test.js +48 -0
- package/dist/test/review-block.test.js.map +1 -0
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -0
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +13 -0
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -0
- package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -0
- package/dist/test/sort-filter-bar/alpha-bar.test.js +74 -0
- package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -0
- package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -0
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +609 -0
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -0
- package/dist/test/text-overlay.test.d.ts +1 -0
- package/dist/test/text-overlay.test.js +42 -0
- package/dist/test/text-overlay.test.js.map +1 -0
- package/dist/test/text-snippet-block.test.d.ts +1 -0
- package/dist/test/text-snippet-block.test.js +63 -0
- package/dist/test/text-snippet-block.test.js.map +1 -0
- package/dist/test/tile-stats.test.d.ts +1 -0
- package/dist/test/tile-stats.test.js +128 -0
- package/dist/test/tile-stats.test.js.map +1 -0
- package/dist/test/tiles/grid/account-tile.test.d.ts +1 -0
- package/dist/test/tiles/grid/account-tile.test.js +96 -0
- package/dist/test/tiles/grid/account-tile.test.js.map +1 -0
- package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -0
- package/dist/test/tiles/grid/collection-tile.test.js +96 -0
- package/dist/test/tiles/grid/collection-tile.test.js.map +1 -0
- package/dist/test/tiles/grid/item-tile.test.d.ts +1 -0
- package/dist/test/tiles/grid/item-tile.test.js +427 -0
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -0
- package/dist/test/tiles/grid/search-tile.test.d.ts +1 -0
- package/dist/test/tiles/grid/search-tile.test.js +66 -0
- package/dist/test/tiles/grid/search-tile.test.js.map +1 -0
- package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -0
- package/dist/test/tiles/hover/hover-pane-controller.test.js +329 -0
- package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -0
- package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -0
- package/dist/test/tiles/hover/tile-hover-pane.test.js +57 -0
- package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -0
- package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -0
- package/dist/test/tiles/list/tile-list-compact.test.js +251 -0
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -0
- package/dist/test/tiles/list/tile-list.test.d.ts +1 -0
- package/dist/test/tiles/list/tile-list.test.js +469 -0
- package/dist/test/tiles/list/tile-list.test.js.map +1 -0
- package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -0
- package/dist/test/tiles/tile-dispatcher.test.js +231 -0
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -0
- package/dist/test/tiles/tile-display-value-provider.test.d.ts +1 -0
- package/dist/test/tiles/tile-display-value-provider.test.js +142 -0
- package/dist/test/tiles/tile-display-value-provider.test.js.map +1 -0
- package/dist/test/tiles/tile-mediatype-icon.test.d.ts +1 -0
- package/dist/test/tiles/tile-mediatype-icon.test.js +145 -0
- package/dist/test/tiles/tile-mediatype-icon.test.js.map +1 -0
- package/dist/test/utils/array-equals.test.d.ts +1 -0
- package/dist/test/utils/array-equals.test.js +27 -0
- package/dist/test/utils/array-equals.test.js.map +1 -0
- package/dist/test/utils/format-count.test.d.ts +1 -0
- package/dist/test/utils/format-count.test.js +24 -0
- package/dist/test/utils/format-count.test.js.map +1 -0
- package/dist/test/utils/format-date.test.d.ts +1 -0
- package/dist/test/utils/format-date.test.js +61 -0
- package/dist/test/utils/format-date.test.js.map +1 -0
- package/dist/test/utils/format-unit-size.test.d.ts +1 -0
- package/dist/test/utils/format-unit-size.test.js +18 -0
- package/dist/test/utils/format-unit-size.test.js.map +1 -0
- package/dist/test/utils/local-date-from-utc.test.d.ts +1 -0
- package/dist/test/utils/local-date-from-utc.test.js +27 -0
- package/dist/test/utils/local-date-from-utc.test.js.map +1 -0
- package/eslint.config.mjs +53 -53
- package/index.html +24 -24
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +118 -117
- package/renovate.json +6 -6
- package/src/collection-browser.ts +2954 -2829
- package/src/collection-facets/facet-row.ts +299 -296
- package/src/collection-facets/models.ts +10 -10
- package/src/collection-facets/more-facets-content.ts +639 -639
- package/src/collection-facets.ts +1005 -995
- package/src/data-source/collection-browser-data-source-interface.ts +345 -333
- package/src/data-source/collection-browser-data-source.ts +1441 -1401
- package/src/data-source/collection-browser-query-state.ts +59 -65
- package/src/data-source/models.ts +56 -43
- package/src/manage/manage-bar.ts +247 -247
- package/src/models.ts +866 -870
- package/src/restoration-state-handler.ts +542 -544
- package/src/tiles/base-tile-component.ts +65 -65
- package/src/tiles/grid/account-tile.ts +113 -113
- package/src/tiles/grid/collection-tile.ts +163 -163
- package/src/tiles/grid/item-tile.ts +340 -340
- package/src/tiles/grid/search-tile.ts +90 -90
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
- package/src/tiles/hover/hover-pane-controller.ts +613 -517
- package/src/tiles/hover/tile-hover-pane.ts +184 -180
- package/src/tiles/list/tile-list-compact.ts +239 -239
- package/src/tiles/list/tile-list.ts +700 -700
- package/src/tiles/tile-dispatcher.ts +517 -490
- package/src/utils/format-date.ts +62 -62
- package/test/collection-browser.test.ts +2413 -2403
- package/test/collection-facets/facet-row.test.ts +375 -375
- package/test/collection-facets.test.ts +928 -928
- package/test/restoration-state-handler.test.ts +480 -510
- package/test/tiles/grid/item-tile.test.ts +520 -520
- package/test/tiles/hover/hover-pane-controller.test.ts +418 -353
- package/test/tiles/list/tile-list-compact.test.ts +282 -282
- package/test/tiles/list/tile-list.test.ts +552 -552
- package/test/tiles/tile-dispatcher.test.ts +283 -187
- package/test/utils/format-date.test.ts +89 -89
- package/tsconfig.json +20 -20
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import type { SortParam } from '@internetarchive/search-service';
|
|
2
|
+
import { HTMLTemplateResult, nothing, ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
|
+
import type { TileModel } from '../../models';
|
|
4
|
+
import type { CollectionTitles } from '../../data-source/models';
|
|
5
|
+
export interface HoverPaneProperties {
|
|
6
|
+
model?: TileModel;
|
|
7
|
+
baseNavigationUrl?: string;
|
|
8
|
+
baseImageUrl?: string;
|
|
9
|
+
loggedIn: boolean;
|
|
10
|
+
suppressBlurring: boolean;
|
|
11
|
+
sortParam: SortParam | null;
|
|
12
|
+
collectionTitles?: CollectionTitles;
|
|
13
|
+
}
|
|
14
|
+
export interface HoverPaneControllerOptions {
|
|
15
|
+
offsetX?: number;
|
|
16
|
+
offsetY?: number;
|
|
17
|
+
enableLongPress?: boolean;
|
|
18
|
+
showDelay?: number;
|
|
19
|
+
hideDelay?: number;
|
|
20
|
+
longPressDelay?: number;
|
|
21
|
+
mobileBreakpoint?: number;
|
|
22
|
+
}
|
|
23
|
+
/** A common interface for providing a hover pane element. */
|
|
24
|
+
export interface HoverPaneProviderInterface {
|
|
25
|
+
/** Returns the provider's currently rendered hover pane element. */
|
|
26
|
+
getHoverPane(): HTMLElement | undefined;
|
|
27
|
+
/** Returns properties that should be passed to the hover pane. */
|
|
28
|
+
getHoverPaneProps(): HoverPaneProperties;
|
|
29
|
+
/** When user has keyboard navigated out of more info, we want the host to get focus */
|
|
30
|
+
acquireFocus(): void;
|
|
31
|
+
/** When user has keyboard navigated out of more info, we want the host to lose focus */
|
|
32
|
+
releaseFocus(): void;
|
|
33
|
+
}
|
|
34
|
+
export interface ToggleHoverPaneOptions {
|
|
35
|
+
coords: {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
};
|
|
39
|
+
enableTouchBackdrop?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* An interface for interacting with hover pane controllers (e.g.,
|
|
43
|
+
* to retrieve their current hover pane template).
|
|
44
|
+
*/
|
|
45
|
+
export interface HoverPaneControllerInterface extends ReactiveController {
|
|
46
|
+
/**
|
|
47
|
+
* Returns the hover pane template to render based on this controller's
|
|
48
|
+
* current state. The returned template may be `nothing` if the hover
|
|
49
|
+
* pane should not currently be rendered.
|
|
50
|
+
*/
|
|
51
|
+
getTemplate(): HTMLTemplateResult | typeof nothing;
|
|
52
|
+
/**
|
|
53
|
+
* Requests to manually toggle the state of the hover pane.
|
|
54
|
+
* If the hover pane is already shown, it will begin fading out and then
|
|
55
|
+
* subsequently be hidden and removed. If the hover pane is already fading
|
|
56
|
+
* out or hidden, it will fade back in and be shown.
|
|
57
|
+
*/
|
|
58
|
+
toggleHoverPane(options: ToggleHoverPaneOptions): void;
|
|
59
|
+
}
|
|
60
|
+
export declare class HoverPaneController implements HoverPaneControllerInterface {
|
|
61
|
+
/** The host element to which this controller should attach listeners */
|
|
62
|
+
private readonly host;
|
|
63
|
+
/**
|
|
64
|
+
* The hover pane element attached to this controller's host.
|
|
65
|
+
*/
|
|
66
|
+
private hoverPane?;
|
|
67
|
+
/**
|
|
68
|
+
* The properties to be passed to the hover pane element
|
|
69
|
+
*/
|
|
70
|
+
private hoverPaneProps?;
|
|
71
|
+
/**
|
|
72
|
+
* The breakpoint (in pixels) below which the mobile interface should be used.
|
|
73
|
+
*/
|
|
74
|
+
private mobileBreakpoint?;
|
|
75
|
+
/**
|
|
76
|
+
* The number of horizontal pixels the hover pane should be offset from the
|
|
77
|
+
* pointer position.
|
|
78
|
+
*/
|
|
79
|
+
private offsetX;
|
|
80
|
+
/**
|
|
81
|
+
* The number of vertical pixels the hover pane should be offset from the
|
|
82
|
+
* pointer position.
|
|
83
|
+
*/
|
|
84
|
+
private offsetY;
|
|
85
|
+
/**
|
|
86
|
+
* The delay between the mouse idling within the host element and when the hover
|
|
87
|
+
* pane should begin fading in (in milliseconds).
|
|
88
|
+
*/
|
|
89
|
+
private showDelay;
|
|
90
|
+
/**
|
|
91
|
+
* The delay between when the mouse leaves the host element and when the hover
|
|
92
|
+
* pane should begin fading out (in milliseconds).
|
|
93
|
+
*/
|
|
94
|
+
private hideDelay;
|
|
95
|
+
/**
|
|
96
|
+
* The delay between when a touch event begins on the host element and when the
|
|
97
|
+
* hover pane should begin fading in (in milliseconds).
|
|
98
|
+
*/
|
|
99
|
+
private longPressDelay;
|
|
100
|
+
/**
|
|
101
|
+
* Whether long press interactions should cause the hover pane to appear (when
|
|
102
|
+
* below the mobile breakpoint).
|
|
103
|
+
*/
|
|
104
|
+
private enableLongPress;
|
|
105
|
+
/**
|
|
106
|
+
* Used to control the current state of this provider's hover pane.
|
|
107
|
+
* - `'hidden'` => The hover pane is not present at all.
|
|
108
|
+
* - `'shown'` => The hover pane is either fading in or fully visible.
|
|
109
|
+
* - `'fading-out'` => The hover pane is fading out and about to be removed.
|
|
110
|
+
*/
|
|
111
|
+
private hoverPaneState;
|
|
112
|
+
/** The timer ID for showing the hover pane */
|
|
113
|
+
private showTimer?;
|
|
114
|
+
/** The timer ID for hiding the hover pane */
|
|
115
|
+
private hideTimer?;
|
|
116
|
+
/** The timer ID for recognizing a long press event */
|
|
117
|
+
private longPressTimer?;
|
|
118
|
+
/**
|
|
119
|
+
* Whether the touch backdrop should currently be rendered irrespective of other touch
|
|
120
|
+
* interactions being enabled.
|
|
121
|
+
*/
|
|
122
|
+
private forceTouchBackdrop;
|
|
123
|
+
/** A record of the last mouse position on the host element, for positioning the hover pane */
|
|
124
|
+
private lastPointerClientPos;
|
|
125
|
+
constructor(
|
|
126
|
+
/** The host element to which this controller should attach listeners */
|
|
127
|
+
host: ReactiveControllerHost & HoverPaneProviderInterface & HTMLElement,
|
|
128
|
+
/** Options for adjusting the hover pane behavior (offsets, delays, etc.) */
|
|
129
|
+
options?: HoverPaneControllerOptions);
|
|
130
|
+
hostConnected(): void;
|
|
131
|
+
hostDisconnected(): void;
|
|
132
|
+
hostUpdated(): void;
|
|
133
|
+
/** @inheritdoc */
|
|
134
|
+
getTemplate(): HTMLTemplateResult | typeof nothing;
|
|
135
|
+
/** @inheritdoc */
|
|
136
|
+
toggleHoverPane(options: ToggleHoverPaneOptions): void;
|
|
137
|
+
/**
|
|
138
|
+
* Produces a template for the invisible touch capture backdrop that
|
|
139
|
+
* is used to cancel the hover pane on touch devices. We want any
|
|
140
|
+
* touch interaction on the backdrop to remove the hover pane, and
|
|
141
|
+
* we don't want to bubble up mouse events that would otherwise
|
|
142
|
+
* affect the state of the hover pane (e.g., fading it back in).
|
|
143
|
+
*/
|
|
144
|
+
private get touchBackdropTemplate();
|
|
145
|
+
private get showTouchBackdrop();
|
|
146
|
+
/** Whether to use the mobile layout */
|
|
147
|
+
private get isMobileView();
|
|
148
|
+
private get isHoverEnabled();
|
|
149
|
+
private get isTouchEnabled();
|
|
150
|
+
/** Whether this controller should currently render its hover pane. */
|
|
151
|
+
private get shouldRenderHoverPane();
|
|
152
|
+
/**
|
|
153
|
+
* Returns the desired top/left offsets (in pixels) for this tile's hover pane.
|
|
154
|
+
* The desired offsets balance positioning the hover pane under the primary pointer
|
|
155
|
+
* while preventing it from flowing outside the viewport. The returned offsets are
|
|
156
|
+
* relative to the viewport, intended to position the pane as a popover element.
|
|
157
|
+
*
|
|
158
|
+
* These offsets are only valid if the hover pane is already rendered with its
|
|
159
|
+
* correct width and height. If the hover pane is not present, the returned offsets
|
|
160
|
+
* will simply represent the current pointer position.
|
|
161
|
+
*/
|
|
162
|
+
private makePaneDesiredOffsets;
|
|
163
|
+
/**
|
|
164
|
+
* Adds to the host element all the listeners necessary to make the
|
|
165
|
+
* hover pane functional.
|
|
166
|
+
*/
|
|
167
|
+
private attachListeners;
|
|
168
|
+
/**
|
|
169
|
+
* Removes all the hover pane listeners from the host element.
|
|
170
|
+
*/
|
|
171
|
+
private detachListeners;
|
|
172
|
+
private handleFocus;
|
|
173
|
+
private handleBlur;
|
|
174
|
+
private handleKeyDown;
|
|
175
|
+
private handleKeyUp;
|
|
176
|
+
/**
|
|
177
|
+
* Handler for the mouseenter event on the host element.
|
|
178
|
+
*/
|
|
179
|
+
private handleMouseEnter;
|
|
180
|
+
/**
|
|
181
|
+
* Handler for the mousemove event on the host element.
|
|
182
|
+
* Aborts any pending hide/fade-out for the hover pane, and restarts the
|
|
183
|
+
* timer to show it.
|
|
184
|
+
*/
|
|
185
|
+
private handleMouseMove;
|
|
186
|
+
/**
|
|
187
|
+
* Handler for the mouseleave event on the host element.
|
|
188
|
+
* Hides the hover pane if present, and aborts the timer for showing it.
|
|
189
|
+
*/
|
|
190
|
+
private handleMouseLeave;
|
|
191
|
+
/**
|
|
192
|
+
* Handler for the touchstart event on the host element.
|
|
193
|
+
* Begins the timer for recognizing a long press event.
|
|
194
|
+
*/
|
|
195
|
+
private handleTouchStart;
|
|
196
|
+
/**
|
|
197
|
+
* Handler for events that should cancel a pending long press event
|
|
198
|
+
* (touchmove, touchend, touchcancel). Aborts the timer for recognizing
|
|
199
|
+
* a long press.
|
|
200
|
+
*/
|
|
201
|
+
private handleLongPressCancel;
|
|
202
|
+
/**
|
|
203
|
+
* Handler for the contextmenu event, which should be suppressed during
|
|
204
|
+
* mobile long-press events on the host element.
|
|
205
|
+
*/
|
|
206
|
+
private handleContextMenu;
|
|
207
|
+
/**
|
|
208
|
+
* Immediately causes the hover pane to begin fading out, if it is present.
|
|
209
|
+
*/
|
|
210
|
+
private handleBackdropInteraction;
|
|
211
|
+
/**
|
|
212
|
+
* Aborts and restarts the timer for showing the hover pane.
|
|
213
|
+
*/
|
|
214
|
+
private restartShowHoverPaneTimer;
|
|
215
|
+
/**
|
|
216
|
+
* Causes this tile's hover pane to be rendered, positioned, and made visible.
|
|
217
|
+
*/
|
|
218
|
+
private showHoverPane;
|
|
219
|
+
/**
|
|
220
|
+
* Causes this tile's hover pane to begin fading out and starts
|
|
221
|
+
* the timer for it to be removed.
|
|
222
|
+
*/
|
|
223
|
+
private fadeOutHoverPane;
|
|
224
|
+
/**
|
|
225
|
+
* Positions the hover pane with the correct offsets.
|
|
226
|
+
*/
|
|
227
|
+
private repositionHoverPane;
|
|
228
|
+
}
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import { html, nothing, } from 'lit';
|
|
2
|
+
import { msg } from '@lit/localize';
|
|
3
|
+
const clamp = (val, min = -Infinity, max = Infinity) => Math.max(min, Math.min(val, max));
|
|
4
|
+
export class HoverPaneController {
|
|
5
|
+
constructor(
|
|
6
|
+
/** The host element to which this controller should attach listeners */
|
|
7
|
+
host,
|
|
8
|
+
/** Options for adjusting the hover pane behavior (offsets, delays, etc.) */
|
|
9
|
+
options = {}) {
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
11
|
+
this.host = host;
|
|
12
|
+
/**
|
|
13
|
+
* The breakpoint (in pixels) below which the mobile interface should be used.
|
|
14
|
+
*/
|
|
15
|
+
this.mobileBreakpoint = 600;
|
|
16
|
+
/**
|
|
17
|
+
* The number of horizontal pixels the hover pane should be offset from the
|
|
18
|
+
* pointer position.
|
|
19
|
+
*/
|
|
20
|
+
this.offsetX = -10;
|
|
21
|
+
/**
|
|
22
|
+
* The number of vertical pixels the hover pane should be offset from the
|
|
23
|
+
* pointer position.
|
|
24
|
+
*/
|
|
25
|
+
this.offsetY = 15;
|
|
26
|
+
/**
|
|
27
|
+
* The delay between the mouse idling within the host element and when the hover
|
|
28
|
+
* pane should begin fading in (in milliseconds).
|
|
29
|
+
*/
|
|
30
|
+
this.showDelay = 300;
|
|
31
|
+
/**
|
|
32
|
+
* The delay between when the mouse leaves the host element and when the hover
|
|
33
|
+
* pane should begin fading out (in milliseconds).
|
|
34
|
+
*/
|
|
35
|
+
this.hideDelay = 100;
|
|
36
|
+
/**
|
|
37
|
+
* The delay between when a touch event begins on the host element and when the
|
|
38
|
+
* hover pane should begin fading in (in milliseconds).
|
|
39
|
+
*/
|
|
40
|
+
this.longPressDelay = 600;
|
|
41
|
+
/**
|
|
42
|
+
* Whether long press interactions should cause the hover pane to appear (when
|
|
43
|
+
* below the mobile breakpoint).
|
|
44
|
+
*/
|
|
45
|
+
this.enableLongPress = false;
|
|
46
|
+
/**
|
|
47
|
+
* Used to control the current state of this provider's hover pane.
|
|
48
|
+
* - `'hidden'` => The hover pane is not present at all.
|
|
49
|
+
* - `'shown'` => The hover pane is either fading in or fully visible.
|
|
50
|
+
* - `'fading-out'` => The hover pane is fading out and about to be removed.
|
|
51
|
+
*/
|
|
52
|
+
this.hoverPaneState = 'hidden';
|
|
53
|
+
/**
|
|
54
|
+
* Whether the touch backdrop should currently be rendered irrespective of other touch
|
|
55
|
+
* interactions being enabled.
|
|
56
|
+
*/
|
|
57
|
+
this.forceTouchBackdrop = false;
|
|
58
|
+
/** A record of the last mouse position on the host element, for positioning the hover pane */
|
|
59
|
+
this.lastPointerClientPos = { x: 0, y: 0 };
|
|
60
|
+
this.handleFocus = () => {
|
|
61
|
+
if (this.hoverPaneState === 'hidden') {
|
|
62
|
+
this.showHoverPane({
|
|
63
|
+
anchor: 'host',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
this.handleBlur = () => {
|
|
68
|
+
if (this.hoverPaneState !== 'hidden') {
|
|
69
|
+
this.fadeOutHoverPane();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
this.handleKeyDown = (e) => {
|
|
73
|
+
if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') &&
|
|
74
|
+
this.hoverPaneState !== 'hidden') {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
this.handleKeyUp = (e) => {
|
|
79
|
+
if (this.hoverPaneState === 'hidden' || !this.hoverPane)
|
|
80
|
+
return;
|
|
81
|
+
if (e.key === 'ArrowDown') {
|
|
82
|
+
this.hoverPane.tabIndex = 1;
|
|
83
|
+
this.hoverPane.focus();
|
|
84
|
+
}
|
|
85
|
+
const isArrowUp = e.key === 'ArrowUp';
|
|
86
|
+
const isEscape = e.key === 'Escape' || e.key === 'Esc';
|
|
87
|
+
if (isEscape) {
|
|
88
|
+
this.fadeOutHoverPane();
|
|
89
|
+
}
|
|
90
|
+
if (isArrowUp || isEscape) {
|
|
91
|
+
this.hoverPane.tabIndex = -1;
|
|
92
|
+
this.host.acquireFocus();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Handler for the mouseenter event on the host element.
|
|
97
|
+
*/
|
|
98
|
+
// NB: Arrow function so 'this' remains bound to the controller
|
|
99
|
+
this.handleMouseEnter = (e) => {
|
|
100
|
+
// Delegate to the mousemove handler, as they are currently processed identically
|
|
101
|
+
this.handleMouseMove(e);
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Handler for the mousemove event on the host element.
|
|
105
|
+
* Aborts any pending hide/fade-out for the hover pane, and restarts the
|
|
106
|
+
* timer to show it.
|
|
107
|
+
*/
|
|
108
|
+
// NB: Arrow function so 'this' remains bound to the controller
|
|
109
|
+
this.handleMouseMove = (e) => {
|
|
110
|
+
var _a;
|
|
111
|
+
// The mouse is within the tile, so abort any pending removal of the hover pane
|
|
112
|
+
clearTimeout(this.hideTimer);
|
|
113
|
+
// If the hover pane is currently fading out, just make it fade back in where it is
|
|
114
|
+
if (this.hoverPaneState === 'fading-out') {
|
|
115
|
+
this.hoverPaneState = 'shown';
|
|
116
|
+
(_a = this.hoverPane) === null || _a === void 0 ? void 0 : _a.classList.add('fade-in');
|
|
117
|
+
}
|
|
118
|
+
// Restart the timer to show the hover pane anytime the mouse moves within the tile
|
|
119
|
+
if (this.hoverPaneState === 'hidden') {
|
|
120
|
+
this.restartShowHoverPaneTimer();
|
|
121
|
+
this.lastPointerClientPos = { x: e.clientX, y: e.clientY };
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Handler for the mouseleave event on the host element.
|
|
126
|
+
* Hides the hover pane if present, and aborts the timer for showing it.
|
|
127
|
+
*/
|
|
128
|
+
// NB: Arrow function so 'this' remains bound to the controller
|
|
129
|
+
this.handleMouseLeave = () => {
|
|
130
|
+
this.host.releaseFocus();
|
|
131
|
+
// Abort any timer to show the hover pane, as the mouse has left the tile
|
|
132
|
+
clearTimeout(this.showTimer);
|
|
133
|
+
// Hide the hover pane if it's already been shown
|
|
134
|
+
if (this.hoverPaneState !== 'hidden') {
|
|
135
|
+
this.hideTimer = window.setTimeout(() => {
|
|
136
|
+
this.fadeOutHoverPane();
|
|
137
|
+
}, this.hideDelay);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Handler for the touchstart event on the host element.
|
|
142
|
+
* Begins the timer for recognizing a long press event.
|
|
143
|
+
*/
|
|
144
|
+
// NB: Arrow function so 'this' remains bound to the controller
|
|
145
|
+
this.handleTouchStart = (e) => {
|
|
146
|
+
clearTimeout(this.longPressTimer);
|
|
147
|
+
if (e.touches.length === 1) {
|
|
148
|
+
this.longPressTimer = window.setTimeout(() => {
|
|
149
|
+
if (this.hoverPaneState === 'hidden') {
|
|
150
|
+
this.showHoverPane();
|
|
151
|
+
}
|
|
152
|
+
}, this.longPressDelay);
|
|
153
|
+
this.lastPointerClientPos = {
|
|
154
|
+
x: e.touches[0].clientX,
|
|
155
|
+
y: e.touches[0].clientY,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Handler for events that should cancel a pending long press event
|
|
161
|
+
* (touchmove, touchend, touchcancel). Aborts the timer for recognizing
|
|
162
|
+
* a long press.
|
|
163
|
+
*/
|
|
164
|
+
// NB: Arrow function so 'this' remains bound to the controller
|
|
165
|
+
this.handleLongPressCancel = () => {
|
|
166
|
+
clearTimeout(this.longPressTimer);
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Handler for the contextmenu event, which should be suppressed during
|
|
170
|
+
* mobile long-press events on the host element.
|
|
171
|
+
*/
|
|
172
|
+
// NB: Arrow function so 'this' remains bound to the controller
|
|
173
|
+
this.handleContextMenu = (e) => {
|
|
174
|
+
e.preventDefault();
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Immediately causes the hover pane to begin fading out, if it is present.
|
|
178
|
+
*/
|
|
179
|
+
// NB: Arrow function so 'this' remains bound to the controller
|
|
180
|
+
this.handleBackdropInteraction = (e) => {
|
|
181
|
+
if (this.hoverPaneState !== 'hidden') {
|
|
182
|
+
this.fadeOutHoverPane();
|
|
183
|
+
}
|
|
184
|
+
e.stopPropagation();
|
|
185
|
+
};
|
|
186
|
+
this.mobileBreakpoint = (_a = options.mobileBreakpoint) !== null && _a !== void 0 ? _a : this.mobileBreakpoint;
|
|
187
|
+
this.offsetX = (_b = options.offsetX) !== null && _b !== void 0 ? _b : this.offsetX;
|
|
188
|
+
this.offsetY = (_c = options.offsetY) !== null && _c !== void 0 ? _c : this.offsetY;
|
|
189
|
+
this.showDelay = (_d = options.showDelay) !== null && _d !== void 0 ? _d : this.showDelay;
|
|
190
|
+
this.hideDelay = (_e = options.hideDelay) !== null && _e !== void 0 ? _e : this.hideDelay;
|
|
191
|
+
this.longPressDelay = (_f = options.longPressDelay) !== null && _f !== void 0 ? _f : this.longPressDelay;
|
|
192
|
+
this.enableLongPress = (_g = options.enableLongPress) !== null && _g !== void 0 ? _g : this.enableLongPress;
|
|
193
|
+
this.host.addController(this);
|
|
194
|
+
}
|
|
195
|
+
hostConnected() {
|
|
196
|
+
this.attachListeners();
|
|
197
|
+
}
|
|
198
|
+
hostDisconnected() {
|
|
199
|
+
this.detachListeners();
|
|
200
|
+
}
|
|
201
|
+
hostUpdated() {
|
|
202
|
+
this.hoverPane = this.host.getHoverPane();
|
|
203
|
+
this.hoverPaneProps = this.host.getHoverPaneProps();
|
|
204
|
+
}
|
|
205
|
+
/** @inheritdoc */
|
|
206
|
+
getTemplate() {
|
|
207
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
208
|
+
this.hoverPaneProps = this.host.getHoverPaneProps();
|
|
209
|
+
return this.shouldRenderHoverPane
|
|
210
|
+
? html `
|
|
211
|
+
${this.touchBackdropTemplate}
|
|
212
|
+
<tile-hover-pane
|
|
213
|
+
popover
|
|
214
|
+
tabindex="-1"
|
|
215
|
+
aria-describedby="tile-hover-pane-aria-description"
|
|
216
|
+
.model=${(_a = this.hoverPaneProps) === null || _a === void 0 ? void 0 : _a.model}
|
|
217
|
+
.baseNavigationUrl=${(_b = this.hoverPaneProps) === null || _b === void 0 ? void 0 : _b.baseNavigationUrl}
|
|
218
|
+
.baseImageUrl=${(_c = this.hoverPaneProps) === null || _c === void 0 ? void 0 : _c.baseImageUrl}
|
|
219
|
+
.loggedIn=${(_d = this.hoverPaneProps) === null || _d === void 0 ? void 0 : _d.loggedIn}
|
|
220
|
+
.suppressBlurring=${(_e = this.hoverPaneProps) === null || _e === void 0 ? void 0 : _e.suppressBlurring}
|
|
221
|
+
.sortParam=${(_f = this.hoverPaneProps) === null || _f === void 0 ? void 0 : _f.sortParam}
|
|
222
|
+
.collectionTitles=${(_g = this.hoverPaneProps) === null || _g === void 0 ? void 0 : _g.collectionTitles}
|
|
223
|
+
.mobileBreakpoint=${this.mobileBreakpoint}
|
|
224
|
+
.currentWidth=${window.innerWidth}
|
|
225
|
+
></tile-hover-pane>
|
|
226
|
+
<div id="tile-hover-pane-aria-description" class="sr-only">
|
|
227
|
+
${msg('Press Up Arrow to exit item detail preview')}
|
|
228
|
+
</div>
|
|
229
|
+
`
|
|
230
|
+
: nothing;
|
|
231
|
+
}
|
|
232
|
+
/** @inheritdoc */
|
|
233
|
+
toggleHoverPane(options) {
|
|
234
|
+
var _a;
|
|
235
|
+
if (this.hoverPaneState === 'shown') {
|
|
236
|
+
this.fadeOutHoverPane();
|
|
237
|
+
this.forceTouchBackdrop = false;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
this.lastPointerClientPos = options.coords;
|
|
241
|
+
this.forceTouchBackdrop = (_a = options.enableTouchBackdrop) !== null && _a !== void 0 ? _a : false;
|
|
242
|
+
this.showHoverPane();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Produces a template for the invisible touch capture backdrop that
|
|
247
|
+
* is used to cancel the hover pane on touch devices. We want any
|
|
248
|
+
* touch interaction on the backdrop to remove the hover pane, and
|
|
249
|
+
* we don't want to bubble up mouse events that would otherwise
|
|
250
|
+
* affect the state of the hover pane (e.g., fading it back in).
|
|
251
|
+
*/
|
|
252
|
+
get touchBackdropTemplate() {
|
|
253
|
+
return this.showTouchBackdrop
|
|
254
|
+
? html `<div
|
|
255
|
+
id="touch-backdrop"
|
|
256
|
+
@touchstart=${this.handleBackdropInteraction}
|
|
257
|
+
@touchmove=${this.handleBackdropInteraction}
|
|
258
|
+
@touchend=${this.handleBackdropInteraction}
|
|
259
|
+
@touchcancel=${this.handleBackdropInteraction}
|
|
260
|
+
@mouseenter=${(e) => e.stopPropagation()}
|
|
261
|
+
@mousemove=${(e) => e.stopPropagation()}
|
|
262
|
+
@mouseleave=${(e) => e.stopPropagation()}
|
|
263
|
+
></div>`
|
|
264
|
+
: nothing;
|
|
265
|
+
}
|
|
266
|
+
get showTouchBackdrop() {
|
|
267
|
+
return ((this.isTouchEnabled && this.enableLongPress) || this.forceTouchBackdrop);
|
|
268
|
+
}
|
|
269
|
+
/** Whether to use the mobile layout */
|
|
270
|
+
get isMobileView() {
|
|
271
|
+
return !!this.mobileBreakpoint && window.innerWidth < this.mobileBreakpoint;
|
|
272
|
+
}
|
|
273
|
+
get isHoverEnabled() {
|
|
274
|
+
return window.matchMedia('(hover: hover)').matches;
|
|
275
|
+
}
|
|
276
|
+
get isTouchEnabled() {
|
|
277
|
+
return ('ontouchstart' in window &&
|
|
278
|
+
window.matchMedia('(any-pointer: coarse)').matches);
|
|
279
|
+
}
|
|
280
|
+
/** Whether this controller should currently render its hover pane. */
|
|
281
|
+
get shouldRenderHoverPane() {
|
|
282
|
+
return this.hoverPaneState !== 'hidden';
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Returns the desired top/left offsets (in pixels) for this tile's hover pane.
|
|
286
|
+
* The desired offsets balance positioning the hover pane under the primary pointer
|
|
287
|
+
* while preventing it from flowing outside the viewport. The returned offsets are
|
|
288
|
+
* relative to the viewport, intended to position the pane as a popover element.
|
|
289
|
+
*
|
|
290
|
+
* These offsets are only valid if the hover pane is already rendered with its
|
|
291
|
+
* correct width and height. If the hover pane is not present, the returned offsets
|
|
292
|
+
* will simply represent the current pointer position.
|
|
293
|
+
*/
|
|
294
|
+
makePaneDesiredOffsets(anchor) {
|
|
295
|
+
// Try to find offsets for the hover pane that:
|
|
296
|
+
// (a) cause it to lie entirely within the viewport, and
|
|
297
|
+
// (b) to the extent possible, minimize the distance between the
|
|
298
|
+
// nearest corner of the hover pane and the mouse/host element position
|
|
299
|
+
// (with some additional offsets applied after the fact).
|
|
300
|
+
var _a;
|
|
301
|
+
let [left, top] = [0, 0];
|
|
302
|
+
switch (anchor) {
|
|
303
|
+
case 'host':
|
|
304
|
+
const hostRect = this.host.getBoundingClientRect();
|
|
305
|
+
// slight inset from host top left corner
|
|
306
|
+
left = hostRect.left + 20;
|
|
307
|
+
top = hostRect.top + 30;
|
|
308
|
+
break;
|
|
309
|
+
case 'cursor':
|
|
310
|
+
left = this.lastPointerClientPos.x;
|
|
311
|
+
top = this.lastPointerClientPos.y;
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
// Flip the hover pane according to which quadrant of the viewport the coordinates are in.
|
|
315
|
+
// (Similar to how Wikipedia's link hover panes work)
|
|
316
|
+
const flipHorizontal = left > window.innerWidth / 2;
|
|
317
|
+
const flipVertical = top > window.innerHeight / 2;
|
|
318
|
+
const hoverPaneRect = (_a = this.hoverPane) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
319
|
+
if (hoverPaneRect) {
|
|
320
|
+
// If we need to flip the hover pane, do so by subtracting its width/height from left/top
|
|
321
|
+
if (flipHorizontal) {
|
|
322
|
+
left -= hoverPaneRect.width;
|
|
323
|
+
}
|
|
324
|
+
if (flipVertical) {
|
|
325
|
+
top -= hoverPaneRect.height;
|
|
326
|
+
}
|
|
327
|
+
// Apply desired offsets from the target position
|
|
328
|
+
left += (flipHorizontal ? -1 : 1) * this.offsetX;
|
|
329
|
+
top += (flipVertical ? -1 : 1) * this.offsetY;
|
|
330
|
+
// On mobile view, shunt the hover pane to avoid overflowing the viewport
|
|
331
|
+
if (this.isMobileView) {
|
|
332
|
+
left = clamp(left, 20, window.innerWidth - hoverPaneRect.width - 20);
|
|
333
|
+
top = clamp(top, 20, window.innerHeight - hoverPaneRect.height - 20);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
left += window.scrollX;
|
|
337
|
+
top += window.scrollY;
|
|
338
|
+
return { left, top };
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Adds to the host element all the listeners necessary to make the
|
|
342
|
+
* hover pane functional.
|
|
343
|
+
*/
|
|
344
|
+
attachListeners() {
|
|
345
|
+
// keyboard navigation listeners
|
|
346
|
+
this.host.addEventListener('focus', this.handleFocus);
|
|
347
|
+
this.host.addEventListener('blur', this.handleBlur);
|
|
348
|
+
this.host.addEventListener('keyup', this.handleKeyUp);
|
|
349
|
+
this.host.addEventListener('keydown', this.handleKeyDown);
|
|
350
|
+
if (this.isHoverEnabled) {
|
|
351
|
+
this.host.addEventListener('mouseenter', this.handleMouseEnter);
|
|
352
|
+
this.host.addEventListener('mousemove', this.handleMouseMove);
|
|
353
|
+
this.host.addEventListener('mouseleave', this.handleMouseLeave);
|
|
354
|
+
}
|
|
355
|
+
if (this.isTouchEnabled && this.enableLongPress) {
|
|
356
|
+
this.host.addEventListener('touchstart', this.handleTouchStart);
|
|
357
|
+
this.host.addEventListener('touchmove', this.handleLongPressCancel);
|
|
358
|
+
this.host.addEventListener('touchend', this.handleLongPressCancel);
|
|
359
|
+
this.host.addEventListener('touchcancel', this.handleLongPressCancel);
|
|
360
|
+
this.host.addEventListener('contextmenu', this.handleContextMenu);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Removes all the hover pane listeners from the host element.
|
|
365
|
+
*/
|
|
366
|
+
detachListeners() {
|
|
367
|
+
this.host.removeEventListener('mouseenter', this.handleMouseEnter);
|
|
368
|
+
this.host.removeEventListener('mousemove', this.handleMouseMove);
|
|
369
|
+
this.host.removeEventListener('mouseleave', this.handleMouseLeave);
|
|
370
|
+
this.host.removeEventListener('touchstart', this.handleTouchStart);
|
|
371
|
+
this.host.removeEventListener('touchmove', this.handleLongPressCancel);
|
|
372
|
+
this.host.removeEventListener('touchend', this.handleLongPressCancel);
|
|
373
|
+
this.host.removeEventListener('touchcancel', this.handleLongPressCancel);
|
|
374
|
+
this.host.removeEventListener('contextmenu', this.handleContextMenu);
|
|
375
|
+
// keyboard navigation listeners
|
|
376
|
+
this.host.removeEventListener('focus', this.handleFocus);
|
|
377
|
+
this.host.removeEventListener('blur', this.handleBlur);
|
|
378
|
+
this.host.removeEventListener('keyup', this.handleKeyUp);
|
|
379
|
+
this.host.removeEventListener('keydown', this.handleKeyDown);
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Aborts and restarts the timer for showing the hover pane.
|
|
383
|
+
*/
|
|
384
|
+
restartShowHoverPaneTimer() {
|
|
385
|
+
clearTimeout(this.showTimer);
|
|
386
|
+
this.showTimer = window.setTimeout(() => {
|
|
387
|
+
this.host.acquireFocus();
|
|
388
|
+
this.showHoverPane();
|
|
389
|
+
}, this.showDelay);
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Causes this tile's hover pane to be rendered, positioned, and made visible.
|
|
393
|
+
*/
|
|
394
|
+
async showHoverPane(options = {
|
|
395
|
+
anchor: 'cursor',
|
|
396
|
+
}) {
|
|
397
|
+
var _a, _b, _c, _d;
|
|
398
|
+
this.hoverPaneState = 'shown';
|
|
399
|
+
this.host.requestUpdate();
|
|
400
|
+
// Wait for the state update to render the hover pane
|
|
401
|
+
await this.host.updateComplete;
|
|
402
|
+
// Ensure the hover pane element is still in the document before showing,
|
|
403
|
+
// as it might have been removed by the previous update.
|
|
404
|
+
if (!((_a = this.hoverPane) === null || _a === void 0 ? void 0 : _a.isConnected))
|
|
405
|
+
return;
|
|
406
|
+
(_c = (_b = this.hoverPane) === null || _b === void 0 ? void 0 : _b.showPopover) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
407
|
+
await new Promise(resolve => {
|
|
408
|
+
// Pane sizes aren't accurate until next frame
|
|
409
|
+
requestAnimationFrame(resolve);
|
|
410
|
+
});
|
|
411
|
+
// Apply the correct positioning to the hover pane
|
|
412
|
+
this.repositionHoverPane(options.anchor);
|
|
413
|
+
// The hover pane is initially not visible (to avoid it shifting around
|
|
414
|
+
// while being positioned). Since it now has the correct positioning, we
|
|
415
|
+
// can make it visible and begin its fade-in animation.
|
|
416
|
+
(_d = this.hoverPane) === null || _d === void 0 ? void 0 : _d.classList.add('visible', 'fade-in');
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Causes this tile's hover pane to begin fading out and starts
|
|
420
|
+
* the timer for it to be removed.
|
|
421
|
+
*/
|
|
422
|
+
fadeOutHoverPane() {
|
|
423
|
+
var _a;
|
|
424
|
+
this.hoverPaneState = 'fading-out';
|
|
425
|
+
(_a = this.hoverPane) === null || _a === void 0 ? void 0 : _a.classList.remove('fade-in');
|
|
426
|
+
clearTimeout(this.hideTimer);
|
|
427
|
+
this.hideTimer = window.setTimeout(() => {
|
|
428
|
+
this.hoverPaneState = 'hidden';
|
|
429
|
+
if (this.hoverPane) {
|
|
430
|
+
this.hoverPane.tabIndex = -1;
|
|
431
|
+
}
|
|
432
|
+
this.host.requestUpdate();
|
|
433
|
+
}, 100);
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Positions the hover pane with the correct offsets.
|
|
437
|
+
*/
|
|
438
|
+
repositionHoverPane(anchor) {
|
|
439
|
+
if (!this.hoverPane)
|
|
440
|
+
return;
|
|
441
|
+
const { top, left } = this.makePaneDesiredOffsets(anchor);
|
|
442
|
+
this.hoverPane.style.top = `${top}px`;
|
|
443
|
+
this.hoverPane.style.left = `${left}px`;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
//# sourceMappingURL=hover-pane-controller.js.map
|